~ubuntu-branches/ubuntu/precise/simutrans/precise

« back to all changes in this revision

Viewing changes to .pc/0001-Extend-txt_convoi_count.patch/gui/depot_frame.h

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2011-11-03 19:59:02 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20111103195902-uopgwf488mfctb75
Tags: 111.0-1
* New upstream release.
* debian/rules: Update get-orig-source target for new upstream release.
* Use xz compression for source and binary packages.
* Use override_* targets to simplify debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 1997 - 2001 Hansj�rg Malthaner
3
 
 *
4
 
 * This file is part of the Simutrans project under the artistic licence.
5
 
 * (see licence.txt)
6
 
 */
7
 
 
8
 
#ifndef gui_depot_frame2_t_h
9
 
#define gui_depot_frame2_t_h
10
 
 
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"
25
 
 
26
 
class depot_t;
27
 
class vehikel_besch_t;
28
 
/**
29
 
 * Depot frame, handles all interaction with a vehicle depot.
30
 
 *
31
 
 * @author Hansj�rg Malthaner
32
 
 * @date 22-Nov-01
33
 
 */
34
 
class depot_frame_t : public gui_frame_t,
35
 
                      public action_listener_t
36
 
{
37
 
private:
38
 
        /**
39
 
         * The depot to display
40
 
         * @author Hansj�rg Malthaner
41
 
         */
42
 
        depot_t *depot;
43
 
 
44
 
        /**
45
 
         * The current convoi to display.
46
 
         * @author Volker Meyer
47
 
         * @date  09.06.2003
48
 
         */
49
 
        int     icnv;
50
 
 
51
 
        /**
52
 
         * The previous convoy being displayed
53
 
         * @author Knightly
54
 
         */
55
 
        convoihandle_t prev_cnv;
56
 
 
57
 
        /* show retired vehicles (same for all depot)
58
 
        * @author prissi
59
 
        */
60
 
        static bool show_retired_vehicles;
61
 
 
62
 
        /* show retired vehicles (same for all depot)
63
 
        * @author prissi
64
 
        */
65
 
        static bool show_all;
66
 
 
67
 
        /**
68
 
         * Gui elements
69
 
         * @author Volker Meyer
70
 
         * @date  09.06.2003
71
 
         */
72
 
        button_t bt_prev;
73
 
        gui_textinput_t inp_name;
74
 
        gui_label_t lb_convois;
75
 
        button_t bt_next;
76
 
 
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;
81
 
 
82
 
        button_t bt_start;
83
 
        button_t bt_schedule;
84
 
        button_t bt_destroy;
85
 
        button_t bt_sell;
86
 
 
87
 
        button_t bt_obsolete;
88
 
        button_t bt_show_all;
89
 
 
90
 
        gui_tab_panel_t tabs;
91
 
        gui_divider_t   div_tabbottom;
92
 
 
93
 
        gui_label_t lb_veh_action;
94
 
        button_t bt_veh_action;
95
 
 
96
 
        /**
97
 
         * buttons for new route-management
98
 
         * @author hsiegeln
99
 
         */
100
 
        button_t bt_new_line;
101
 
        button_t bt_change_line;
102
 
        button_t bt_copy_convoi;
103
 
        button_t bt_apply_line;
104
 
 
105
 
        vector_tpl<gui_image_list_t::image_data_t> convoi_pics;
106
 
        gui_image_list_t convoi;
107
 
 
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;
112
 
 
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;
125
 
 
126
 
        static char no_line_text[128];
127
 
        gui_combobox_t line_selector;
128
 
 
129
 
        gui_image_t img_bolt;
130
 
 
131
 
        linehandle_t selected_line;
132
 
 
133
 
        /**
134
 
         * Data fields for use with gui elements.
135
 
         * @author Volker Meyer
136
 
         * @date  09.06.2003
137
 
         */
138
 
        char txt_title[60];
139
 
 
140
 
        char txt_convois[40];
141
 
 
142
 
        char txt_cnv_name[118];
143
 
        char txt_old_cnv_name[118];
144
 
 
145
 
        char txt_convoi_count[40];
146
 
        char txt_convoi_value[40];
147
 
        char txt_convoi_speed[80];
148
 
        char txt_convoi_line[128];
149
 
 
150
 
        enum { va_append, va_insert, va_sell };
151
 
        uint8 veh_action;
152
 
 
153
 
        /**
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
157
 
         * @date  09.06.2003
158
 
         */
159
 
        ptrhashtable_tpl<const vehikel_besch_t *, gui_image_list_t::image_data_t *> vehicle_map;
160
 
 
161
 
        /**
162
 
         * Draw the info text for the vehicle the mouse is over - if any.
163
 
         * @author Volker Meyer, Hj. Malthaner
164
 
         * @date  09.06.2003
165
 
         * @update 09-Jan-04
166
 
         */
167
 
        void draw_vehicle_info_text(koord pos);
168
 
 
169
 
        /**
170
 
         * Calulate the values of the vehicles of the given type owned by the
171
 
         * player.
172
 
         * @author Volker Meyer
173
 
         * @date  09.06.2003
174
 
         */
175
 
        sint32 calc_restwert(const vehikel_besch_t *veh_type);
176
 
 
177
 
        /**
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
181
 
         */
182
 
        bool has_min_sizer() const {return true;}
183
 
 
184
 
        // true if already stored here
185
 
        bool is_contained(const vehikel_besch_t *info);
186
 
 
187
 
        // add a single vehicle (helper function)
188
 
        void add_to_vehicle_list(const vehikel_besch_t *info);
189
 
 
190
 
        // for convoi image
191
 
        void image_from_convoi_list(uint nr);
192
 
 
193
 
        void image_from_storage_list(gui_image_list_t::image_data_t *bild_data);
194
 
 
195
 
        karte_t* get_welt() { return depot->get_welt(); }
196
 
 
197
 
public:
198
 
        // the next two are only needed for depot_t update notifications
199
 
        void activate_convoi( convoihandle_t cnv );
200
 
 
201
 
        /**
202
 
         * Do the dynamic dialog layout
203
 
         * @author Volker Meyer
204
 
         * @date  18.06.2003
205
 
         */
206
 
        void layout(koord *);
207
 
 
208
 
        /**
209
 
         * Update texts, image lists and buttons according to the current state.
210
 
         * @author Volker Meyer
211
 
         * @date  09.06.2003
212
 
         */
213
 
        void update_data();
214
 
 
215
 
        /**
216
 
         * Reset convoy name
217
 
         * @author Knightly
218
 
         */
219
 
        void reset_convoy_name(convoihandle_t cnv);
220
 
 
221
 
        /**
222
 
         * Rename the convoy
223
 
         * @author Knightly
224
 
         */
225
 
        void rename_convoy(convoihandle_t cnv);
226
 
 
227
 
        // more general functions ...
228
 
        depot_frame_t(depot_t* depot);
229
 
        ~depot_frame_t();
230
 
 
231
 
        /**
232
 
         * Setzt die Fenstergroesse
233
 
         * @author (Mathew Hounsell)
234
 
         * @date   11-Mar-2003
235
 
         */
236
 
        void set_fenstergroesse(koord groesse);
237
 
 
238
 
        /**
239
 
         * Create and fill loks_vec and waggons_vec.
240
 
         * @author Volker Meyer
241
 
         * @date  09.06.2003
242
 
         */
243
 
        void build_vehicle_lists();
244
 
 
245
 
        /*
246
 
         * Will update the tabs (don't show empty ones).
247
 
         * @author Gerd Wachsmuth
248
 
         * @date 08.05.2009
249
 
         */
250
 
        void update_tabs();
251
 
 
252
 
        /**
253
 
         * Manche Fenster haben einen Hilfetext assoziiert.
254
 
         * @return den Dateinamen f�r die Hilfe, oder NULL
255
 
         * @author Hj. Malthaner
256
 
         */
257
 
        const char * get_hilfe_datei() const {return "depot.txt";}
258
 
 
259
 
        /**
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
263
 
         */
264
 
        bool has_next() const {return true;}
265
 
 
266
 
        /**
267
 
         * Open dialog for schedule entry.
268
 
         * @author Hj. Malthaner
269
 
         */
270
 
        void fahrplaneingabe();
271
 
 
272
 
        bool infowin_event(const event_t *ev);
273
 
 
274
 
        /**
275
 
         * Zeichnet das Frame
276
 
         * @author Hansj�rg Malthaner
277
 
         */
278
 
        void zeichnen(koord pos, koord gr);
279
 
 
280
 
        // @author hsiegeln
281
 
        void apply_line();
282
 
 
283
 
        /**
284
 
         * This method is called if an action is triggered
285
 
         * @author Hj. Malthaner
286
 
         *
287
 
         * Returns true, if action is done and no more
288
 
         * components should be triggered.
289
 
         * V.Meyer
290
 
         */
291
 
        bool action_triggered( gui_action_creator_t *komp, value_t extra);
292
 
};
293
 
 
294
 
#endif