diff --git a/gui/depot_frame.cc b/gui/depot_frame.cc index f4872246a..3dc33aabd 100644 --- a/gui/depot_frame.cc +++ b/gui/depot_frame.cc @@ -83,9 +83,6 @@ depot_frame_t::depot_frame_t(depot_t* depot) : depot(depot), icnv(depot->convoi_count()-1), lb_convoi_line("Serves Line:", SYSCOL_TEXT, gui_label_t::left), - lb_sort_by("Sort by:", SYSCOL_TEXT, gui_label_t::right), - lb_name_filter_input("Search:", SYSCOL_TEXT, gui_label_t::right), - lb_veh_action("Fahrzeuge:", SYSCOL_TEXT, gui_label_t::right), convoi_pics(depot->get_max_convoi_length()), convoi(&convoi_pics), scrolly_convoi(&cont_convoi), @@ -97,6 +94,8 @@ depot_frame_t::depot_frame_t(depot_t* depot) : scrolly_electrics(&cont_electrics), scrolly_loks(&cont_loks), scrolly_waggons(&cont_waggons), + lb_sort_by("Sort by:", SYSCOL_TEXT, gui_label_t::right), + lb_name_filter("Search:", SYSCOL_TEXT, gui_label_t::right), lb_vehicle_filter("Filter:", SYSCOL_TEXT, gui_label_t::right) { scr_size size = scr_size(0,0); @@ -218,10 +217,10 @@ DBG_DEBUG("depot_frame_t::depot_frame_t()","get_max_convoi_length()=%i",depot->g add_component(&tabs); add_component(&div_tabbottom); - add_component(&lb_veh_action); add_component(&lb_sort_by); + add_component(&lb_name_filter); add_component(&lb_vehicle_filter); - add_component(&lb_name_filter_input); + add_component(&div_action_bottom); veh_action = va_append; bt_veh_action.set_typ(button_t::roundbox); @@ -260,11 +259,8 @@ DBG_DEBUG("depot_frame_t::depot_frame_t()","get_max_convoi_length()=%i",depot->g build_vehicle_lists(); // text will be translated by ourselves (after update data)! - lb_convois.set_text_pointer(txt_convois); - - lb_convoi_count.set_text_pointer(txt_convoi_count); - lb_convoi_number.set_text_pointer(txt_convoi_number); - + lb_convois.set_text_pointer( txt_convois ); + lb_convoi_number.set_text_pointer( txt_convoi_number ); lb_convoi_count.set_text_pointer( txt_convoi_count ); lb_convoi_speed.set_text_pointer( txt_convoi_speed ); lb_convoi_cost.set_text_pointer( txt_convoi_cost ); @@ -386,7 +382,7 @@ void depot_frame_t::layout(scr_size *size) /* * Structure of [VINFO] is one multiline text. */ - const scr_coord_val VINFO_HEIGHT = 7*LINESPACE + D_BUTTON_HEIGHT + D_EDIT_HEIGHT + 5*D_V_SPACE; + const scr_coord_val VINFO_HEIGHT = 6*LINESPACE + D_BUTTON_HEIGHT + D_EDIT_HEIGHT + 2*D_V_SPACE; /* * Total width is the max from [CONVOI] and [ACTIONS] width. @@ -584,34 +580,34 @@ void depot_frame_t::layout(scr_size *size) /* * [BOTTOM] */ - bt_veh_action.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, INFO_VSTART)); - bt_veh_action.set_size(scr_size(DEPOT_AREA_WIDTH - DEPOT_AREA_WIDTH * 3 / 4 - 3, D_BUTTON_HEIGHT)); - - lb_veh_action.align_to(&bt_veh_action, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_CENTER_V, scr_coord(D_V_SPACE, 0)); - - bt_show_all.set_pos(scr_coord(D_MARGIN_LEFT, INFO_VSTART + D_BUTTON_HEIGHT + 1)); - const int w = max(72, bt_show_all.get_size().w); - bt_obsolete.set_pos(scr_coord(D_MARGIN_LEFT + w + 4 + 6, INFO_VSTART + D_BUTTON_HEIGHT + 1)); + //1st line + bt_veh_action.set_pos(scr_coord(D_MARGIN_LEFT, INFO_VSTART)); + bt_veh_action.set_size(scr_size(DEPOT_AREA_WIDTH / 4 - 3, D_BUTTON_HEIGHT)); - vehicle_filter.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, INFO_VSTART + D_BUTTON_HEIGHT + D_V_SPACE)); + vehicle_filter.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 2 / 4 + 4 - proportional_string_width(translator::translate("Search:")), INFO_VSTART)); vehicle_filter.set_size(scr_size(DEPOT_AREA_WIDTH - DEPOT_AREA_WIDTH * 3 / 4 - 3, D_BUTTON_HEIGHT)); vehicle_filter.set_max_size(scr_size(D_BUTTON_WIDTH + 60, LINESPACE * 7)); + lb_vehicle_filter.align_to(&vehicle_filter, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_TOP, scr_coord(2,D_GET_CENTER_ALIGN_OFFSET(LINESPACE,D_BUTTON_HEIGHT))); - lb_vehicle_filter.align_to(&vehicle_filter, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_TOP, scr_coord(0,D_GET_CENTER_ALIGN_OFFSET(LINESPACE,D_BUTTON_HEIGHT))); - - bt_show_all.align_to(&vehicle_filter, ALIGN_CENTER_V); - bt_obsolete.align_to(&vehicle_filter, ALIGN_CENTER_V); name_filter_input.set_size( scr_size( vehicle_filter.get_size().w, D_EDIT_HEIGHT ) ); - name_filter_input.set_pos( vehicle_filter.get_pos()+scr_coord(0,D_V_SPACE+D_BUTTON_HEIGHT) ); - lb_name_filter_input.align_to(&name_filter_input, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_TOP, scr_coord(0,D_GET_CENTER_ALIGN_OFFSET(LINESPACE,D_BUTTON_HEIGHT))); - - int y = name_filter_input.get_pos().y + name_filter_input.get_size().h + D_V_SPACE; + name_filter_input.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, INFO_VSTART + 1)); + lb_name_filter.align_to(&name_filter_input, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_TOP, scr_coord(2,D_GET_CENTER_ALIGN_OFFSET(LINESPACE,D_BUTTON_HEIGHT))); - sort_by.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, y)); + //2nd line + sort_by.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, INFO_VSTART + D_BUTTON_HEIGHT + 2)); sort_by.set_size(scr_size(DEPOT_AREA_WIDTH - DEPOT_AREA_WIDTH * 3 / 4 - 3, D_BUTTON_HEIGHT)); sort_by.set_max_size(scr_size(D_BUTTON_WIDTH + 60, LINESPACE * 7)); - lb_sort_by.align_to(&sort_by, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_TOP, scr_coord(0,D_GET_CENTER_ALIGN_OFFSET(LINESPACE,D_BUTTON_HEIGHT))); + lb_sort_by.align_to(&sort_by, ALIGN_RIGHT | ALIGN_EXTERIOR_H | ALIGN_TOP, scr_coord(2,D_GET_CENTER_ALIGN_OFFSET(LINESPACE,D_BUTTON_HEIGHT))); + + bt_show_all.set_pos(scr_coord(D_MARGIN_LEFT, INFO_VSTART + D_BUTTON_HEIGHT + 2)); + bt_show_all.align_to(&sort_by, ALIGN_CENTER_V); + const int w = max(72, bt_show_all.get_size().w); + bt_obsolete.set_pos(scr_coord(D_MARGIN_LEFT + w + 4 + 6, INFO_VSTART + D_BUTTON_HEIGHT + 2)); + bt_obsolete.align_to(&sort_by, ALIGN_CENTER_V); + + div_action_bottom.set_pos(scr_coord(0, INFO_VSTART + D_BUTTON_HEIGHT * 2)); + div_action_bottom.set_width(DEPOT_FRAME_WIDTH); const scr_coord_val margin = 4; img_bolt.set_pos(scr_coord(get_windowsize().w - skinverwaltung_t::electricity->get_image(0)->get_pic()->w - margin, margin)); @@ -722,10 +718,7 @@ static int compare_engine(const vehicle_desc_t* a, const vehicle_desc_t* b) } static int compare_price(const vehicle_desc_t* a, const vehicle_desc_t* b) {return a->get_price() - b->get_price();} static int compare_cost(const vehicle_desc_t* a, const vehicle_desc_t* b) {return a->get_running_cost() - b->get_running_cost();} -static int compare_cost_per_unit(const vehicle_desc_t* a, const vehicle_desc_t* b) -{ - return a->get_running_cost()*b->get_capacity() - b->get_running_cost()*a->get_capacity(); -} +static int compare_cost_per_unit(const vehicle_desc_t* a, const vehicle_desc_t* b){return a->get_running_cost()*b->get_capacity() - b->get_running_cost()*a->get_capacity();} static int compare_topspeed(const vehicle_desc_t* a, const vehicle_desc_t* b) {return a->get_topspeed() - b->get_topspeed();} static int compare_power(const vehicle_desc_t* a, const vehicle_desc_t* b) {return (a->get_power() == 0 ? 0x7FFFFFF : a->get_power()) - (b->get_power() == 0 ? 0x7FFFFFF : b->get_power());} static int compare_weight(const vehicle_desc_t* a, const vehicle_desc_t* b) {return a->get_weight() - b->get_weight();} @@ -744,6 +737,9 @@ static bool compare_vehicles(const vehicle_desc_t* a, const vehicle_desc_t* b) case sb_price: cmp = compare_price(a, b); if (cmp != 0) return cmp < 0; + cmp = compare_cost(a, b); + if (cmp != 0) return cmp < 0; + break; case sb_cost: cmp = compare_cost(a, b); if (cmp != 0) return cmp < 0; @@ -769,6 +765,9 @@ static bool compare_vehicles(const vehicle_desc_t* a, const vehicle_desc_t* b) case sb_intro_date: cmp = compare_intro_year_month(a, b); if (cmp != 0) return cmp < 0; + cmp = compare_retire_year_month(a, b); + if (cmp != 0) return cmp < 0; + break; case sb_retire_date: cmp = compare_retire_year_month(a, b); if (cmp != 0) return cmp < 0; @@ -874,12 +873,12 @@ void depot_frame_t::build_vehicle_lists() } } } + DBG_DEBUG("depot_frame_t::build_vehicle_lists()","finally %i passenger vehicle, %i engines, %i good wagons",pas_vec.get_count(),loks_vec.get_count(),waggons_vec.get_count()); update_data(); update_tabs(); } - static void get_line_list(const depot_t* depot, vector_tpl* lines) { depot->get_owner()->simlinemgmt.get_lines(depot->get_line_type(), lines); @@ -1725,26 +1724,6 @@ void depot_frame_t::draw_vehicle_info_text(scr_coord pos) } } - { - const char *c; - switch( const uint32 count = depot->get_vehicle_list().get_count() ) { - case 0: { - c = translator::translate("Keine Einzelfahrzeuge im Depot"); - break; - } - case 1: { - c = translator::translate("1 Einzelfahrzeug im Depot"); - break; - } - default: { - buf.printf( translator::translate("%d Einzelfahrzeuge im Depot"), count ); - c = buf; - break; - } - } - display_proportional_rgb( pos.x + D_MARGIN_LEFT, pos.y + D_TITLEBAR_HEIGHT + div_tabbottom.get_pos().y + div_tabbottom.get_size().h + 1, c, ALIGN_LEFT, SYSCOL_TEXT, true ); - } - if( veh_type ) { // column 1 @@ -1780,46 +1759,41 @@ void depot_frame_t::draw_vehicle_info_text(scr_coord pos) buf.append( "\n" ); } + buf.printf( "%s %3d km/h\n", translator::translate("Max. speed:"), veh_type->get_topspeed() ); if( veh_type->get_power() > 0 ) { // LOCO - buf.printf( translator::translate("Power: %4d kW\n"), veh_type->get_power() ); - } - else { - buf.append( "\n" ); + if( veh_type->get_gear() != 64 ) { + buf.printf( translator::translate("%s %d kW (%0.2f : 1)"), translator::translate("Power:"), veh_type->get_power(), veh_type->get_gear() / 64.0 ); + } + else { + buf.printf( translator::translate("%s %d kW"), translator::translate("Power:"), veh_type->get_power() ); + } } - buf.printf( "%s %4.1ft\n", translator::translate("Weight:"), veh_type->get_weight() / 1000.0 ); - buf.printf( "%s %3d km/h", translator::translate("Max. speed:"), veh_type->get_topspeed() ); - - int yyy = pos.y + D_TITLEBAR_HEIGHT + sort_by.get_pos().y + sort_by.get_size().h - - LINESPACE; + int yyy = pos.y + D_TITLEBAR_HEIGHT + div_action_bottom.get_pos().y + div_action_bottom.get_size().h + 2; display_multiline_text_rgb( pos.x + D_MARGIN_LEFT, yyy, buf, SYSCOL_TEXT); // column 2 buf.clear(); - buf.printf( "%s %s %04d\n", - translator::translate("Intro. date:"), - translator::get_month_name( veh_type->get_intro_year_month() % 12 ), - veh_type->get_intro_year_month() / 12 + buf.append( "\n" ); + buf.printf( "%s %4.1ft\n", translator::translate("Weight:"), veh_type->get_weight() / 1000.0 ); + buf.printf( "%s %04d/%02d - ", + translator::translate("Active date:"), + veh_type->get_intro_year_month() / 12, + //translator::get_month_name( veh_type->get_intro_year_month() % 12 ), + veh_type->get_intro_year_month() % 12 + 1 ); if( veh_type->get_retire_year_month() != DEFAULT_RETIRE_DATE * 12 ) { - buf.printf( "%s %s %04d\n", - translator::translate("Retire. date:"), - translator::get_month_name( veh_type->get_retire_year_month() % 12 ), - veh_type->get_retire_year_month() / 12 + buf.printf( "%04d/%02d\n", + veh_type->get_retire_year_month() / 12, + //translator::get_month_name( veh_type->get_retire_year_month() % 12 ), + veh_type->get_retire_year_month() % 12 + 1 ); } else { buf.append( "\n" ); } - if( veh_type->get_power() > 0 && veh_type->get_gear() != 64 ) { - buf.printf( "%s %0.2f : 1\n", translator::translate("Gear:"), veh_type->get_gear() / 64.0 ); - } - else { - buf.append( "\n" ); - } - if( char const* const copyright = veh_type->get_copyright() ) { buf.printf( translator::translate("Constructed by %s"), copyright ); } @@ -1831,7 +1805,7 @@ void depot_frame_t::draw_vehicle_info_text(scr_coord pos) buf.printf( "%s %8s", translator::translate("Restwert:"), tmp ); } - display_multiline_text_rgb( pos.x + second_column_x, yyy + LINESPACE, buf, SYSCOL_TEXT); + display_multiline_text_rgb( pos.x + second_column_x, yyy, buf, SYSCOL_TEXT); // update speedbar new_vehicle_length_sb = new_vehicle_length_sb_force_zero ? 0 : convoi_length_ok_sb + convoi_length_slower_sb + convoi_length_too_slow_sb + veh_type->get_length(); diff --git a/gui/depot_frame.h b/gui/depot_frame.h index a8c5b12b9..18f143c8c 100644 --- a/gui/depot_frame.h +++ b/gui/depot_frame.h @@ -119,14 +119,14 @@ private: gui_label_t lb_sort_by; gui_combobox_t sort_by; - gui_label_t lb_name_filter_input; + gui_label_t lb_name_filter; static char name_filter_value[64]; gui_textinput_t name_filter_input; gui_tab_panel_t tabs; gui_divider_t div_tabbottom; + gui_divider_t div_action_bottom; - gui_label_t lb_veh_action; button_t bt_veh_action; /** diff --git a/gui/depot_frame.h.gch b/gui/depot_frame.h.gch new file mode 100644 index 000000000..11f366d33 Binary files /dev/null and b/gui/depot_frame.h.gch differ diff --git a/simdepot.h.gch b/simdepot.h.gch new file mode 100644 index 000000000..8cd06cb3d Binary files /dev/null and b/simdepot.h.gch differ