diff --git a/gui/display_settings.cc b/gui/display_settings.cc index 0ecbfcf84..a2b7218c2 100644 --- a/gui/display_settings.cc +++ b/gui/display_settings.cc @@ -76,25 +76,25 @@ gui_frame_t( translator::translate("Helligk. u. Farben") ) set_table_layout(1,0); // Show thememanager - buttons[23].init(button_t::roundbox_state | button_t::flexible, "Select a theme for display"); - add_component(buttons+23); + buttons[/*23*/IDBTNs_Show_thememanager].init(button_t::roundbox_state | button_t::flexible, "Select a theme for display"); + add_component(buttons+/*23*/IDBTNs_Show_thememanager); // Change font - buttons[25].init(button_t::roundbox_state | button_t::flexible, "Select display font"); - add_component(buttons+25); + buttons[/*25*/IDBTNs_Change_font].init(button_t::roundbox_state | button_t::flexible, "Select display font"); + add_component(buttons+/*25*/IDBTNs_Change_font); add_table(2,0); // Show grid checkbox - buttons[17].init(button_t::square_state, "show grid"); - add_component(buttons+17, 2); + buttons[/*17*/IDBTNs_Show_grid].init(button_t::square_state, "show grid"); + add_component(buttons+/*17*/IDBTNs_Show_grid, 2); // Underground view checkbox - buttons[16].init(button_t::square_state, "underground mode"); - add_component(buttons+16, 2); + buttons[/*16*/IDBTNs_Underground_view].init(button_t::square_state, "underground mode"); + add_component(buttons+/*16*/IDBTNs_Underground_view, 2); // Show slice map view checkbox - buttons[20].init(button_t::square_state, "sliced underground mode"); - add_component(buttons+20); + buttons[/*20*/IDBTNs_Show_slice_map_view].init(button_t::square_state, "sliced underground mode"); + add_component(buttons+/*20*/IDBTNs_Show_slice_map_view); // underground slice edit inp_underground_level.set_value( grund_t::underground_mode==grund_t::ugm_level ? grund_t::underground_level : welt->get_zeiger()->get_pos().z); @@ -103,9 +103,9 @@ gui_frame_t( translator::translate("Helligk. u. Farben") ) add_component( &inp_underground_level ); // Day/night change checkbox - buttons[9].init(button_t::square_state, "8WORLD_CHOOSE"); - buttons[9].pressed = env_t::night_shift; - add_component(buttons+9, 2); + buttons[/*9*/IDBTNs_Day_Night_change].init(button_t::square_state, "8WORLD_CHOOSE"); + buttons[/*9*/IDBTNs_Day_Night_change].pressed = env_t::night_shift; + add_component(buttons+/*9*/IDBTNs_Day_Night_change, 2); // Brightness label new_component("1LIGHT_CHOOSE"); @@ -117,9 +117,9 @@ gui_frame_t( translator::translate("Helligk. u. Farben") ) add_component(&brightness); // Scroll inverse checkbox - buttons[6].init(button_t::square_state, "4LIGHT_CHOOSE"); - buttons[6].pressed = env_t::scroll_multi < 0; - add_component(buttons+6, 2); + buttons[/*6*/IDBTNs_Scroll_inverse].init(button_t::square_state, "4LIGHT_CHOOSE"); + buttons[/*6*/IDBTNs_Scroll_inverse].pressed = env_t::scroll_multi < 0; + add_component(buttons+/*6*/IDBTNs_Scroll_inverse, 2); // Scroll speed label new_component("3LIGHT_CHOOSE"); @@ -134,13 +134,13 @@ gui_frame_t( translator::translate("Helligk. u. Farben") ) new_component_span(2); // Transparent instead of hidden checkbox - buttons[10].init(button_t::square_state, "hide transparent"); - buttons[10].pressed = env_t::hide_with_transparency; - add_component(buttons+10, 2); + buttons[/*10*/IDBTNs_Transparent_instead_of_hidden].init(button_t::square_state, "hide transparent"); + buttons[/*10*/IDBTNs_Transparent_instead_of_hidden].pressed = env_t::hide_with_transparency; + add_component(buttons+/*10*/IDBTNs_Transparent_instead_of_hidden, 2); // Hide trees checkbox - buttons[11].init(button_t::square_state, "hide trees"); - add_component(buttons+11, 2); + buttons[/*11*/IDBTNs_Hide_trees].init(button_t::square_state, "hide trees"); + add_component(buttons+/*11*/IDBTNs_Hide_trees, 2); // Hide buildings hide_buildings.set_focusable(false); @@ -151,9 +151,9 @@ gui_frame_t( translator::translate("Helligk. u. Farben") ) add_component(&hide_buildings, 2); hide_buildings.add_listener(this); - buttons[21].set_tooltip( "hide objects under cursor" ); - buttons[21].init( button_t::square_state , "Smart hide objects" ); - add_component(buttons+21); + buttons[/*21*/IDBTNs_Hide_buildings].set_tooltip( "hide objects under cursor" ); + buttons[/*21*/IDBTNs_Hide_buildings].init( button_t::square_state , "Smart hide objects" ); + add_component(buttons+/*21*/IDBTNs_Hide_buildings); // Smart hide objects edit cursor_hide_range.set_value(env_t::cursor_hide_range); @@ -165,42 +165,42 @@ gui_frame_t( translator::translate("Helligk. u. Farben") ) new_component_span(2); // Transparent station coverage - buttons[14].init(button_t::square_state, "transparent station coverage"); - buttons[14].pressed = env_t::use_transparency_station_coverage; - add_component(buttons+14, 2); + buttons[/*14*/IDBTNs_Transparent_station_coverage].init(button_t::square_state, "transparent station coverage"); + buttons[/*14*/IDBTNs_Transparent_station_coverage].pressed = env_t::use_transparency_station_coverage; + add_component(buttons+/*14*/IDBTNs_Transparent_station_coverage, 2); // Show station coverage - buttons[15].init(button_t::square_state, "show station coverage"); - add_component(buttons+15, 2); + buttons[/*15*/IDBTNs_Show_station_coverage].init(button_t::square_state, "show station coverage"); + add_component(buttons+/*15*/IDBTNs_Show_station_coverage, 2); // Show station names arrow add_table(2,1); { - buttons[18].set_typ(button_t::arrowright); - buttons[18].set_tooltip("show station names"); - add_component(buttons+18); + buttons[/*18*/IDBTNs_Show_station_names_arrow].set_typ(button_t::arrowright); + buttons[/*18*/IDBTNs_Show_station_names_arrow].set_tooltip("show station names"); + add_component(buttons+/*18*/IDBTNs_Show_station_names_arrow); new_component("show station names"); } end_table(); new_component(); // Show waiting bars checkbox - buttons[19].init(button_t::square_state, "show waiting bars"); - buttons[19].pressed = env_t::show_names&2; - add_component(buttons+19, 2); + buttons[/*19*/IDBTNs_Show_waiting_bars].init(button_t::square_state, "show waiting bars"); + buttons[/*19*/IDBTNs_Show_waiting_bars].pressed = env_t::show_names&2; + add_component(buttons+/*19*/IDBTNs_Show_waiting_bars, 2); // Divider 3 new_component_span(2); // Pedestrians in towns checkbox - buttons[8].init(button_t::square_state, "6LIGHT_CHOOSE"); - buttons[8].pressed = welt->get_settings().get_random_pedestrians(); - add_component(buttons+8, 2); + buttons[/*8*/IDBTNs_Pedestrians_in_towns].init(button_t::square_state, "6LIGHT_CHOOSE"); + buttons[/*8*/IDBTNs_Pedestrians_in_towns].pressed = welt->get_settings().get_random_pedestrians(); + add_component(buttons+/*8*/IDBTNs_Pedestrians_in_towns, 2); // Pedestrians at stops checkbox - buttons[7].init(button_t::square_state, "5LIGHT_CHOOSE"); - buttons[7].pressed = welt->get_settings().get_show_pax(); - add_component(buttons+7, 2); + buttons[/*7*/IDBTNs_Pedestrians_at_stops].init(button_t::square_state, "5LIGHT_CHOOSE"); + buttons[/*7*/IDBTNs_Pedestrians_at_stops].pressed = welt->get_settings().get_show_pax(); + add_component(buttons+/*7*/IDBTNs_Pedestrians_at_stops, 2); // Traffic density label new_component("6WORLD_CHOOSE"); @@ -221,8 +221,8 @@ gui_frame_t( translator::translate("Helligk. u. Farben") ) convoy_tooltip.add_listener(this); // Show schedule's stop checkbox - buttons[22].init( button_t::square_state , "Highlite schedule" ); - add_component(buttons+22, 2); + buttons[/*22*/IDBTNs_Show_schedules_stop].init( button_t::square_state , "Highlite schedule" ); + add_component(buttons+/*22*/IDBTNs_Show_schedules_stop, 2); // convoi booking message options money_booking.set_focusable( false ); @@ -235,9 +235,9 @@ gui_frame_t( translator::translate("Helligk. u. Farben") ) // Toggle simple drawing for debugging #ifdef DEBUG - buttons[24].init(button_t::square_state, "Simple drawing"); - buttons[24].pressed = env_t::simple_drawing; - add_component(buttons+24, 2); + buttons[/*24*/IDBTNs_simple_drawing].init(button_t::square_state, "Simple drawing"); + buttons[/*24*/IDBTNs_simple_drawing].pressed = env_t::simple_drawing; + add_component(buttons+/*24*/IDBTNs_simple_drawing, 2); #endif // Divider 4 @@ -299,7 +299,7 @@ bool color_gui_t::action_triggered( gui_action_creator_t *comp, value_t v) // Scroll speed edit if(&scrollspeed==comp) { - env_t::scroll_multi = (sint16)( buttons[6].pressed ? -v.i : v.i ); + env_t::scroll_multi = (sint16)( buttons[/*6*/IDBTNs_Scroll_inverse].pressed ? -v.i : v.i ); } else // Smart hide objects edit @@ -313,40 +313,40 @@ bool color_gui_t::action_triggered( gui_action_creator_t *comp, value_t v) } else // Scroll inverse checkbox - if((buttons+6)==comp) { - buttons[6].pressed ^= 1; + if((buttons+/*6*/IDBTNs_Scroll_inverse)==comp) { + buttons[/*6*/IDBTNs_Scroll_inverse].pressed ^= 1; env_t::scroll_multi = -env_t::scroll_multi; } else // Pedestrians at stops checkbox - if((buttons+7)==comp) { + if((buttons+/*7*/IDBTNs_Pedestrians_at_stops)==comp) { if( !env_t::networkmode || welt->get_active_player_nr()==1 ) { welt->set_tool( tool_t::simple_tool[TOOL_TOOGLE_PAX&0xFFF], welt->get_active_player() ); } } else // Pedestrians in towns checkbox - if((buttons+8)==comp) { + if((buttons+/*8*/IDBTNs_Pedestrians_in_towns)==comp) { if( !env_t::networkmode || welt->get_active_player_nr()==1 ) { welt->set_tool( tool_t::simple_tool[TOOL_TOOGLE_PEDESTRIANS&0xFFF], welt->get_active_player() ); } } else // Day/night change checkbox - if((buttons+9)==comp) { + if((buttons+/*9*/IDBTNs_Day_Night_change)==comp) { env_t::night_shift = !env_t::night_shift; - buttons[9].pressed ^= 1; + buttons[/*9*/IDBTNs_Day_Night_change].pressed ^= 1; } else // Transparent instead of hidden checkbox - if((buttons+10)==comp) { + if((buttons+/*10*/IDBTNs_Transparent_instead_of_hidden)==comp) { env_t::hide_with_transparency = !env_t::hide_with_transparency; - buttons[10].pressed ^= 1; + buttons[/*10*/IDBTNs_Transparent_instead_of_hidden].pressed ^= 1; baum_t::recalc_outline_color(); } else // Hide trees checkbox - if((buttons+11)==comp) { + if((buttons+/*11*/IDBTNs_Hide_trees)==comp) { env_t::hide_trees = !env_t::hide_trees; baum_t::recalc_outline_color(); } else @@ -357,22 +357,22 @@ bool color_gui_t::action_triggered( gui_action_creator_t *comp, value_t v) } else // Transparent station coverage - if((buttons+14)==comp) { + if((buttons+/*14*/IDBTNs_Transparent_station_coverage)==comp) { env_t::use_transparency_station_coverage = !env_t::use_transparency_station_coverage; - buttons[14].pressed ^= 1; + buttons[/*14*/IDBTNs_Transparent_station_coverage].pressed ^= 1; } else // Show station coverage - if((buttons+15)==comp) { + if((buttons+/*15*/IDBTNs_Show_station_coverage)==comp) { env_t::station_coverage_show = env_t::station_coverage_show==0 ? 0xFF : 0; } else // Underground view checkbox - if((buttons+16)==comp) { + if((buttons+/*16*/IDBTNs_Underground_view)==comp) { // see simtool.cc::tool_show_underground_t::init - grund_t::set_underground_mode(buttons[16].pressed ? grund_t::ugm_none : grund_t::ugm_all, inp_underground_level.get_value()); - buttons[16].pressed = grund_t::underground_mode == grund_t::ugm_all; + grund_t::set_underground_mode(buttons[/*16*/IDBTNs_Underground_view].pressed ? grund_t::ugm_none : grund_t::ugm_all, inp_underground_level.get_value()); + buttons[/*16*/IDBTNs_Underground_view].pressed = grund_t::underground_mode == grund_t::ugm_all; // calc new images welt->update_underground(); @@ -382,12 +382,12 @@ bool color_gui_t::action_triggered( gui_action_creator_t *comp, value_t v) } else // Show grid checkbox - if((buttons+17)==comp) { + if((buttons+/*17*/IDBTNs_Show_grid)==comp) { grund_t::toggle_grid(); } else // Show station names arrow - if((buttons+18)==comp) { + if((buttons+/*18*/IDBTNs_Show_station_names_arrow)==comp) { if( env_t::show_names&1 ) { if( (env_t::show_names>>2) == 2 ) { env_t::show_names &= 2; @@ -403,16 +403,16 @@ bool color_gui_t::action_triggered( gui_action_creator_t *comp, value_t v) } else // Show waiting bars checkbox - if((buttons+19)==comp) { + if((buttons+/*19*/IDBTNs_Show_waiting_bars)==comp) { env_t::show_names ^= 2; } else // Show slice map view checkbox - if((buttons+20)==comp) { + if((buttons+/*20*/IDBTNs_Show_slice_map_view)==comp) { // see simtool.cc::tool_show_underground_t::init - grund_t::set_underground_mode(buttons[20].pressed ? grund_t::ugm_none : grund_t::ugm_level, inp_underground_level.get_value()); - buttons[20].pressed = grund_t::underground_mode == grund_t::ugm_level; + grund_t::set_underground_mode(buttons[/*20*/IDBTNs_Show_slice_map_view].pressed ? grund_t::ugm_none : grund_t::ugm_level, inp_underground_level.get_value()); + buttons[/*20*/IDBTNs_Show_slice_map_view].pressed = grund_t::underground_mode == grund_t::ugm_level; // calc new images welt->update_underground(); @@ -422,20 +422,20 @@ bool color_gui_t::action_triggered( gui_action_creator_t *comp, value_t v) } else // Hide buildings and trees under mouse cursor checkbox - if((buttons+21)==comp) { + if((buttons+/*21*/IDBTNs_Hide_buildings)==comp) { // see simtool.cc::tool_hide_under_cursor_t::init env_t::hide_under_cursor = !env_t::hide_under_cursor && env_t::cursor_hide_range>0; - buttons[21].pressed = env_t::hide_under_cursor; + buttons[/*21*/IDBTNs_Hide_buildings].pressed = env_t::hide_under_cursor; // renew toolbar tool_t::update_toolbars(); } else // Show schedule's stop checkbox - if((buttons+22)==comp) { + if((buttons+/*22*/IDBTNs_Show_schedules_stop)==comp) { env_t::visualize_schedule = !env_t::visualize_schedule; - buttons[22].pressed = env_t::visualize_schedule; + buttons[/*22*/IDBTNs_Show_schedules_stop].pressed = env_t::visualize_schedule; } else // underground slice edit @@ -448,14 +448,14 @@ bool color_gui_t::action_triggered( gui_action_creator_t *comp, value_t v) } } else - if((buttons+23)==comp) { + if((buttons+/*23*/IDBTNs_Show_thememanager)==comp) { create_win(new themeselector_t(), w_info, magic_themes); } - if((buttons+24)==comp) { + if((buttons+/*24*/IDBTNs_simple_drawing)==comp) { env_t::simple_drawing = !env_t::simple_drawing; - buttons[24].pressed = env_t::simple_drawing; + buttons[/*24*/IDBTNs_simple_drawing].pressed = env_t::simple_drawing; } - if((buttons+25)==comp) { + if((buttons+/*25*/IDBTNs_Change_font)==comp) { create_win(new loadfont_frame_t(), w_info, magic_font); } if( &money_booking==comp ) { @@ -508,18 +508,18 @@ void color_gui_t::update_labels() void color_gui_t::draw(scr_coord pos, scr_size size) { // Update button states that was changed with keyboard ... - buttons[ 7].pressed = welt->get_settings().get_show_pax(); - buttons[ 8].pressed = welt->get_settings().get_random_pedestrians(); - buttons[11].pressed = env_t::hide_trees; - buttons[21].pressed = env_t::hide_under_cursor; - buttons[15].pressed = env_t::station_coverage_show; - buttons[16].pressed = grund_t::underground_mode == grund_t::ugm_all; - buttons[17].pressed = grund_t::show_grid; - buttons[19].pressed = (env_t::show_names&2)!=0; - buttons[20].pressed = grund_t::underground_mode == grund_t::ugm_level; - buttons[22].pressed = env_t::visualize_schedule; - buttons[24].pressed = env_t::simple_drawing; - buttons[24].enable(welt->is_paused()); + buttons[/*7*/IDBTNs_Pedestrians_at_stops].pressed = welt->get_settings().get_show_pax(); + buttons[/*8*/IDBTNs_Pedestrians_in_towns].pressed = welt->get_settings().get_random_pedestrians(); + buttons[/*11*/IDBTNs_Hide_trees].pressed = env_t::hide_trees; + buttons[/*21*/IDBTNs_Hide_buildings].pressed = env_t::hide_under_cursor; + buttons[/*15*/IDBTNs_Show_station_coverage].pressed = env_t::station_coverage_show; + buttons[/*16*/IDBTNs_Underground_view].pressed = grund_t::underground_mode == grund_t::ugm_all; + buttons[/*17*/IDBTNs_Show_grid].pressed = grund_t::show_grid; + buttons[/*19*/IDBTNs_Show_waiting_bars].pressed = (env_t::show_names&2)!=0; + buttons[/*20*/IDBTNs_Show_slice_map_view].pressed = grund_t::underground_mode == grund_t::ugm_level; + buttons[/*22*/IDBTNs_Show_schedules_stop].pressed = env_t::visualize_schedule; + buttons[/*24*/IDBTNs_simple_drawing].pressed = env_t::simple_drawing; + buttons[/*24*/IDBTNs_simple_drawing].enable(welt->is_paused()); update_labels(); diff --git a/gui/display_settings.h b/gui/display_settings.h index 4ecf1e9b2..58dc5c77b 100644 --- a/gui/display_settings.h +++ b/gui/display_settings.h @@ -13,7 +13,7 @@ #include "components/gui_numberinput.h" #include "components/gui_combobox.h" -#define COLORS_MAX_BUTTONS (26) +//#define COLORS_MAX_BUTTONS (26) /** @@ -24,6 +24,28 @@ class color_gui_t : public gui_frame_t, private action_listener_t { private: +enum { + /*6*/IDBTNs_Scroll_inverse, + /*7*/IDBTNs_Pedestrians_at_stops, + /*8*/IDBTNs_Pedestrians_in_towns, + /*9*/IDBTNs_Day_Night_change, + /*10*/IDBTNs_Transparent_instead_of_hidden, + /*11*/IDBTNs_Hide_trees, + /*14*/IDBTNs_Transparent_station_coverage, + /*15*/IDBTNs_Show_station_coverage, + /*16*/IDBTNs_Underground_view, + /*17*/IDBTNs_Show_grid, + /*18*/IDBTNs_Show_station_names_arrow, + /*19*/IDBTNs_Show_waiting_bars, + /*20*/IDBTNs_Show_slice_map_view, + /*21*/IDBTNs_Hide_buildings, + /*22*/IDBTNs_Show_schedules_stop, + /*23*/IDBTNs_Show_thememanager, + /*24*/IDBTNs_simple_drawing, + /*25*/IDBTNs_Change_font, + COLORS_MAX_BUTTONS, +}; + button_t buttons[COLORS_MAX_BUTTONS]; gui_numberinput_t