SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIIconSubSys.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Helper for icons loading and usage
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <fx.h>
34 #include <cassert>
35 #include "GUIIcons.h"
36 #include "GUIIconSubSys.h"
37 
38 #include "filesave.xpm"
39 #include "fileopen.xpm"
40 #include "netopen.xpm"
41 #include "play.xpm"
42 #include "stop.xpm"
43 #include "step.xpm"
44 #include "new_window.xpm"
45 #include "document.xpm"
46 
47 #include "app_tracker.xpm"
48 #include "app_finder.xpm"
49 #include "app_breakpoints.xpm"
50 #include "app_tlstracker.xpm"
51 #include "app_table.xpm"
52 #include "app_selector.xpm"
53 
54 #include "locate.xpm"
55 #include "locate_junction.xpm"
56 #include "locate_edge.xpm"
57 #include "locate_vehicle.xpm"
58 #include "locate_tls.xpm"
59 #include "locate_add.xpm"
60 #include "locate_shape.xpm"
61 
62 #include "colorwheel.xpm"
63 #include "savedb.xpm"
64 #include "removedb.xpm"
65 #include "recenter_view.xpm"
66 #include "allow_rotation.xpm"
67 #include "show_tooltips.xpm"
68 #include "magnify.xpm"
69 #include "zoomstyle.xpm"
70 #include "yes.xpm"
71 #include "no.xpm"
72 
73 #include "extract_streets.xpm"
74 #include "dilate.xpm"
75 #include "erode.xpm"
76 #include "opening.xpm"
77 #include "closing.xpm"
78 #include "erase_stains.xpm"
79 #include "close_gaps.xpm"
80 #include "skeletonize.xpm"
81 #include "rarify.xpm"
82 #include "create_graph.xpm"
83 #include "open_bmp_dialog.xpm"
84 #include "eyedrop.xpm"
85 #include "rubber1x.xpm"
86 #include "rubber2x.xpm"
87 #include "rubber3x.xpm"
88 #include "rubber4x.xpm"
89 #include "rubber5x.xpm"
90 #include "paintbrush1x.xpm"
91 #include "paintbrush2x.xpm"
92 #include "paintbrush3x.xpm"
93 #include "paintbrush4x.xpm"
94 #include "paintbrush5x.xpm"
95 #include "edit_graph.xpm"
96 
97 
98 #include "flag.cpp"
99 #include "flag_plus.cpp"
100 #include "flag_minus.cpp"
101 #include "windows_cascade.xpm"
102 #include "windows_tile_vertically.xpm"
103 #include "windows_tile_horizontally.xpm"
104 #include "reload.xpm"
105 #include "manip.cpp"
106 #include "camera.xpm"
107 
108 #include "undo.xpm"
109 #include "redo.xpm"
110 #include "netedit.xpm"
111 
112 #include "cut.xpm"
113 #include "ext.xpm"
114 
115 
116 static const char* empty_xpm[] = {
117  " 1 1 1 1",
118  ". c None",
119  "."
120 };
121 
122 
123 #ifdef CHECK_MEMORY_LEAKS
124 #include <foreign/nvwa/debug_new.h>
125 #endif // CHECK_MEMORY_LEAKS
126 
127 
128 // ===========================================================================
129 // static member variable definitions
130 // ===========================================================================
132 
133 
134 // ===========================================================================
135 // member definitions
136 // ===========================================================================
138  // build icons
139  myIcons[ICON_APP] = new FXXPMIcon(a, document_xpm);
140  myIcons[ICON_EMPTY] = new FXXPMIcon(a, empty_xpm);
141  myIcons[ICON_OPEN_CONFIG] = new FXXPMIcon(a, fileopen_xpm);
142  myIcons[ICON_OPEN_NET] = new FXXPMIcon(a, netopen_xpm);
143  myIcons[ICON_RELOAD] = new FXXPMIcon(a, reload_xpm);
144  myIcons[ICON_SAVE] = new FXXPMIcon(a, filesave_xpm);
145  myIcons[ICON_CLOSE] = 0;//new FXXPMIcon(a, close);
146  myIcons[ICON_START] = new FXXPMIcon(a, play_xpm);
147  myIcons[ICON_STOP] = new FXXPMIcon(a, stop_xpm);
148  myIcons[ICON_STEP] = new FXXPMIcon(a, step_xpm);
149  myIcons[ICON_MICROVIEW] = new FXXPMIcon(a, new_window_xpm);
150  myIcons[ICON_LAGGRVIEW] = new FXXPMIcon(a, new_window_xpm);
151  myIcons[ICON_RECENTERVIEW] = new FXXPMIcon(a, recenter_view_xpm);
152  myIcons[ICON_ALLOWROTATION] = new FXXPMIcon(a, allow_rotation_xpm);
153  myIcons[ICON_EDITVIEWPORT] = new FXXPMIcon(a, magnify_xpm);
154  myIcons[ICON_ZOOMSTYLE] = new FXXPMIcon(a, zoomstyle_xpm);
155 
156  myIcons[ICON_APP_TRACKER] = new FXXPMIcon(a, app_tracker_xpm);
157  myIcons[ICON_APP_FINDER] = new FXXPMIcon(a, app_finder_xpm);
158  myIcons[ICON_APP_BREAKPOINTS] = new FXXPMIcon(a, app_breakpoints_xpm);
159  myIcons[ICON_APP_TLSTRACKER] = new FXXPMIcon(a, app_tlstracker_xpm);
160  myIcons[ICON_APP_TABLE] = new FXXPMIcon(a, app_table_xpm);
161  myIcons[ICON_APP_SELECTOR] = new FXXPMIcon(a, app_selector_xpm);
162 
163  myIcons[ICON_LOCATE] = new FXXPMIcon(a, locate_xpm);
164  myIcons[ICON_LOCATEJUNCTION] = new FXXPMIcon(a, locate_junction_xpm);
165  myIcons[ICON_LOCATEEDGE] = new FXXPMIcon(a, locate_edge_xpm);
166  myIcons[ICON_LOCATEVEHICLE] = new FXXPMIcon(a, locate_vehicle_xpm);
167  myIcons[ICON_LOCATETLS] = new FXXPMIcon(a, locate_tls_xpm);
168  myIcons[ICON_LOCATEADD] = new FXXPMIcon(a, locate_add_xpm);
169  myIcons[ICON_LOCATESHAPE] = new FXXPMIcon(a, locate_shape_xpm);
170 
171  myIcons[ICON_COLORWHEEL] = new FXXPMIcon(a, colorwheel_xpm);
172  myIcons[ICON_SAVEDB] = new FXXPMIcon(a, savedb_xpm);
173  myIcons[ICON_REMOVEDB] = new FXXPMIcon(a, removedb_xpm);
174  myIcons[ICON_SHOWTOOLTIPS] = new FXXPMIcon(a, show_tooltips_xpm);
175  myIcons[ICON_YES] = new FXXPMIcon(a, yes_xpm);
176  myIcons[ICON_NO] = new FXXPMIcon(a, no_xpm);
177  myIcons[ICON_FLAG] = new FXGIFIcon(a, flag);
178  myIcons[ICON_FLAG_PLUS] = new FXGIFIcon(a, flag_plus);
179  myIcons[ICON_FLAG_MINUS] = new FXGIFIcon(a, flag_minus);
180  // window arrangements
181  myIcons[ICON_WINDOWS_CASCADE] = new FXXPMIcon(a, windows_cascade_xpm);
182  myIcons[ICON_WINDOWS_TILE_VERT] = new FXXPMIcon(a, windows_tile_vertically_xpm);
183  myIcons[ICON_WINDOWS_TILE_HORI] = new FXXPMIcon(a, windows_tile_horizontally_xpm);
184  // manipulate
185  myIcons[ICON_MANIP] = new FXGIFIcon(a, manip);
186  myIcons[ICON_CAMERA] = new FXXPMIcon(a, camera_xpm);
187  myIcons[ICON_EXTRACT] = new FXXPMIcon(a, extract_streets_xpm);
188  myIcons[ICON_DILATE] = new FXXPMIcon(a, dilate_xpm);
189  myIcons[ICON_ERODE] = new FXXPMIcon(a, erode_xpm);
190  myIcons[ICON_OPENING] = new FXXPMIcon(a, opening_xpm);
191  myIcons[ICON_CLOSING] = new FXXPMIcon(a, closing_xpm);
192  myIcons[ICON_ERASE_STAINS] = new FXXPMIcon(a, erase_stains_xpm);
193  myIcons[ICON_CLOSE_GAPS] = new FXXPMIcon(a, close_gaps_xpm);
194  myIcons[ICON_SKELETONIZE] = new FXXPMIcon(a, skeletonize_xpm);
195  myIcons[ICON_RARIFY] = new FXXPMIcon(a, rarify_xpm);
196  myIcons[ICON_CREATE_GRAPH] = new FXXPMIcon(a, create_graph_xpm);
197  myIcons[ICON_OPEN_BMP_DIALOG] = new FXXPMIcon(a, open_bmp_dialog_xpm);
198  myIcons[ICON_EYEDROP] = new FXXPMIcon(a, eyedrop_xpm);
199  myIcons[ICON_PAINTBRUSH1X] = new FXXPMIcon(a, paintbrush1x_xpm);
200  myIcons[ICON_PAINTBRUSH2X] = new FXXPMIcon(a, paintbrush2x_xpm);
201  myIcons[ICON_PAINTBRUSH3X] = new FXXPMIcon(a, paintbrush3x_xpm);
202  myIcons[ICON_PAINTBRUSH4X] = new FXXPMIcon(a, paintbrush4x_xpm);
203  myIcons[ICON_PAINTBRUSH5X] = new FXXPMIcon(a, paintbrush5x_xpm);
204  myIcons[ICON_RUBBER1X] = new FXXPMIcon(a, rubber1x_xpm);
205  myIcons[ICON_RUBBER2X] = new FXXPMIcon(a, rubber2x_xpm);
206  myIcons[ICON_RUBBER3X] = new FXXPMIcon(a, rubber3x_xpm);
207  myIcons[ICON_RUBBER4X] = new FXXPMIcon(a, rubber4x_xpm);
208  myIcons[ICON_RUBBER5X] = new FXXPMIcon(a, rubber5x_xpm);
209  myIcons[ICON_EDITGRAPH] = new FXXPMIcon(a, edit_graph_xpm);
210 
211  myIcons[ICON_UNDO] = new FXXPMIcon(a, undo_xpm);
212  myIcons[ICON_REDO] = new FXXPMIcon(a, redo_xpm);
213  myIcons[ICON_NETEDIT] = new FXXPMIcon(a, netedit_xpm);
214 
215  myIcons[ICON_EXT] = new FXXPMIcon(a, ext_xpm);
216  myIcons[ICON_CUT_SWELL] = new FXXPMIcon(a, cut_xpm);
217 
218  // ... and create them
219  for (int i = 0; i < ICON_MAX; i++) {
220  if (myIcons[i] != 0) {
221  myIcons[i]->create();
222  }
223  }
224 }
225 
226 
228  for (int i = 0; i < ICON_MAX; i++) {
229  delete myIcons[i];
230  }
231 }
232 
233 
234 void
236  assert(myInstance == 0);
237  myInstance = new GUIIconSubSys(a);
238 }
239 
240 
241 FXIcon*
243  return myInstance->myIcons[which];
244 }
245 
246 
247 void
249  delete myInstance;
250  myInstance = 0;
251 }
252 
253 
254 
255 /****************************************************************************/
256