diff --git a/gui/depot_frame.cc b/gui/depot_frame.cc index f4872246a..ca24e2d28 100644 --- a/gui/depot_frame.cc +++ b/gui/depot_frame.cc @@ -83,8 +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), @@ -97,6 +95,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); @@ -220,8 +220,9 @@ DBG_DEBUG("depot_frame_t::depot_frame_t()","get_max_convoi_length()=%i",depot->g 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 +261,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 +384,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 = 8*LINESPACE + D_BUTTON_HEIGHT + D_EDIT_HEIGHT + 2*D_V_SPACE; /* * Total width is the max from [CONVOI] and [ACTIONS] width. @@ -584,34 +582,36 @@ void depot_frame_t::layout(scr_size *size) /* * [BOTTOM] */ + + //1st line 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)); - - vehicle_filter.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, INFO_VSTART + D_BUTTON_HEIGHT + D_V_SPACE)); + //2nd line + vehicle_filter.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 2 / 4 + 4 - proportional_string_width(translator::translate("Search:")), INFO_VSTART + D_BUTTON_HEIGHT + 1)); 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))); + name_filter_input.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, INFO_VSTART + D_BUTTON_HEIGHT + 2)); + 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))); - int y = name_filter_input.get_pos().y + name_filter_input.get_size().h + D_V_SPACE; - - sort_by.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, y)); + //3rd line + sort_by.set_pos(scr_coord(D_MARGIN_LEFT + DEPOT_AREA_WIDTH * 3 / 4 + 3, INFO_VSTART + D_BUTTON_HEIGHT * 2 + 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 + 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 + 2)); + bt_obsolete.align_to(&sort_by, ALIGN_CENTER_V); + + div_action_bottom.set_pos(scr_coord(0, INFO_VSTART + D_BUTTON_HEIGHT * 3)); + 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 +722,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 +741,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 +769,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 +877,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); @@ -1790,24 +1793,47 @@ void depot_frame_t::draw_vehicle_info_text(scr_coord pos) 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 - ); + switch (env_t::show_month) { + case env_t::DATE_FMT_JAPANESE: + case env_t::DATE_FMT_JAPANESE_NO_SEASON: + buf.printf( "%s %04d/%s\n", + translator::translate("Intro. date:"), + veh_type->get_intro_year_month() / 12, + translator::get_month_name( veh_type->get_intro_year_month() % 12 ) + ); + break; + default: + 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 + ); + break; + } + 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 - ); + switch (env_t::show_month) { + case env_t::DATE_FMT_JAPANESE: + case env_t::DATE_FMT_JAPANESE_NO_SEASON: + buf.printf( "%s %04d/%s\n", + translator::translate("Retire. date:"), + veh_type->get_retire_year_month() / 12, + translator::get_month_name( veh_type->get_retire_year_month() % 12 ) + ); + break; + default: + 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 + ); + } } else { buf.append( "\n" ); diff --git a/gui/depot_frame.h b/gui/depot_frame.h index a8c5b12b9..f1fc7c6f5 100644 --- a/gui/depot_frame.h +++ b/gui/depot_frame.h @@ -119,12 +119,13 @@ 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..99b6824b4 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