2
* Copyright (c) 1997 - 2001 Hansj�rg Malthaner
4
* This file is part of the Simutrans project under the artistic licence.
8
#ifndef gui_depot_frame2_t_h
9
#define gui_depot_frame2_t_h
11
#include "gui_frame.h"
12
#include "components/gui_label.h"
13
#include "components/gui_image.h"
14
#include "components/gui_image_list.h"
15
#include "components/gui_textinput.h"
16
#include "components/gui_combobox.h"
17
#include "components/gui_divider.h"
18
#include "../tpl/ptrhashtable_tpl.h"
19
#include "../tpl/vector_tpl.h"
20
#include "components/gui_tab_panel.h"
21
#include "components/gui_button.h"
22
#include "components/action_listener.h"
23
#include "components/gui_scrollpane.h"
24
#include "../simtypes.h"
27
class vehikel_besch_t;
29
* Depot frame, handles all interaction with a vehicle depot.
31
* @author Hansj�rg Malthaner
34
class depot_frame_t : public gui_frame_t,
35
public action_listener_t
39
* The depot to display
40
* @author Hansj�rg Malthaner
45
* The current convoi to display.
46
* @author Volker Meyer
52
* The previous convoy being displayed
55
convoihandle_t prev_cnv;
57
/* show retired vehicles (same for all depot)
60
static bool show_retired_vehicles;
62
/* show retired vehicles (same for all depot)
69
* @author Volker Meyer
73
gui_textinput_t inp_name;
74
gui_label_t lb_convois;
77
gui_label_t lb_convoi_count;
78
gui_label_t lb_convoi_speed;
79
gui_label_t lb_convoi_value;
80
gui_label_t lb_convoi_line;
91
gui_divider_t div_tabbottom;
93
gui_label_t lb_veh_action;
94
button_t bt_veh_action;
97
* buttons for new route-management
100
button_t bt_new_line;
101
button_t bt_change_line;
102
button_t bt_copy_convoi;
103
button_t bt_apply_line;
105
vector_tpl<gui_image_list_t::image_data_t> convoi_pics;
106
gui_image_list_t convoi;
108
vector_tpl<gui_image_list_t::image_data_t> pas_vec;
109
vector_tpl<gui_image_list_t::image_data_t> electrics_vec;
110
vector_tpl<gui_image_list_t::image_data_t> loks_vec;
111
vector_tpl<gui_image_list_t::image_data_t> waggons_vec;
113
gui_image_list_t pas;
114
gui_image_list_t electrics;
115
gui_image_list_t loks;
116
gui_image_list_t waggons;
117
gui_scrollpane_t scrolly_pas;
118
gui_scrollpane_t scrolly_electrics;
119
gui_scrollpane_t scrolly_loks;
120
gui_scrollpane_t scrolly_waggons;
121
gui_container_t cont_pas;
122
gui_container_t cont_electrics;
123
gui_container_t cont_loks;
124
gui_container_t cont_waggons;
126
static char no_line_text[128];
127
gui_combobox_t line_selector;
129
gui_image_t img_bolt;
131
linehandle_t selected_line;
134
* Data fields for use with gui elements.
135
* @author Volker Meyer
140
char txt_convois[40];
142
char txt_cnv_name[118];
143
char txt_old_cnv_name[118];
145
char txt_convoi_count[40];
146
char txt_convoi_value[40];
147
char txt_convoi_speed[80];
148
char txt_convoi_line[128];
150
enum { va_append, va_insert, va_sell };
154
* A helper map to update loks_vec and waggons_Vec. All entries from
155
* loks_vec and waggons_vec are referenced here.
156
* @author Volker Meyer
159
ptrhashtable_tpl<const vehikel_besch_t *, gui_image_list_t::image_data_t *> vehicle_map;
162
* Draw the info text for the vehicle the mouse is over - if any.
163
* @author Volker Meyer, Hj. Malthaner
167
void draw_vehicle_info_text(koord pos);
170
* Calulate the values of the vehicles of the given type owned by the
172
* @author Volker Meyer
175
sint32 calc_restwert(const vehikel_besch_t *veh_type);
178
* Does this window need a min size button in the title bar?
179
* @return true if such a button is needed
180
* @author Hj. Malthaner
182
bool has_min_sizer() const {return true;}
184
// true if already stored here
185
bool is_contained(const vehikel_besch_t *info);
187
// add a single vehicle (helper function)
188
void add_to_vehicle_list(const vehikel_besch_t *info);
191
void image_from_convoi_list(uint nr);
193
void image_from_storage_list(gui_image_list_t::image_data_t *bild_data);
195
karte_t* get_welt() { return depot->get_welt(); }
198
// the next two are only needed for depot_t update notifications
199
void activate_convoi( convoihandle_t cnv );
202
* Do the dynamic dialog layout
203
* @author Volker Meyer
206
void layout(koord *);
209
* Update texts, image lists and buttons according to the current state.
210
* @author Volker Meyer
219
void reset_convoy_name(convoihandle_t cnv);
225
void rename_convoy(convoihandle_t cnv);
227
// more general functions ...
228
depot_frame_t(depot_t* depot);
232
* Setzt die Fenstergroesse
233
* @author (Mathew Hounsell)
236
void set_fenstergroesse(koord groesse);
239
* Create and fill loks_vec and waggons_vec.
240
* @author Volker Meyer
243
void build_vehicle_lists();
246
* Will update the tabs (don't show empty ones).
247
* @author Gerd Wachsmuth
253
* Manche Fenster haben einen Hilfetext assoziiert.
254
* @return den Dateinamen f�r die Hilfe, oder NULL
255
* @author Hj. Malthaner
257
const char * get_hilfe_datei() const {return "depot.txt";}
260
* Does this window need a next button in the title bar?
261
* @return true if such a button is needed
262
* @author Volker Meyer
264
bool has_next() const {return true;}
267
* Open dialog for schedule entry.
268
* @author Hj. Malthaner
270
void fahrplaneingabe();
272
bool infowin_event(const event_t *ev);
276
* @author Hansj�rg Malthaner
278
void zeichnen(koord pos, koord gr);
284
* This method is called if an action is triggered
285
* @author Hj. Malthaner
287
* Returns true, if action is done and no more
288
* components should be triggered.
291
bool action_triggered( gui_action_creator_t *komp, value_t extra);