SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Helper for icons loading and usage 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 00023 00024 // =========================================================================== 00025 // included modules 00026 // =========================================================================== 00027 #ifdef _MSC_VER 00028 #include <windows_config.h> 00029 #else 00030 #include <config.h> 00031 #endif 00032 00033 #include <fx.h> 00034 #include <cassert> 00035 #include "GUIIcons.h" 00036 #include "GUIIconSubSys.h" 00037 00038 #include "filesave.xpm" 00039 #include "fileopen.xpm" 00040 #include "netopen.xpm" 00041 #include "play.xpm" 00042 #include "stop.xpm" 00043 #include "step.xpm" 00044 #include "new_window.xpm" 00045 #include "document.xpm" 00046 00047 #include "app_tracker.xpm" 00048 #include "app_finder.xpm" 00049 #include "app_breakpoints.xpm" 00050 #include "app_tlstracker.xpm" 00051 #include "app_table.xpm" 00052 #include "app_selector.xpm" 00053 00054 #include "locate.xpm" 00055 #include "locate_junction.xpm" 00056 #include "locate_edge.xpm" 00057 #include "locate_vehicle.xpm" 00058 #include "locate_tls.xpm" 00059 #include "locate_add.xpm" 00060 #include "locate_shape.xpm" 00061 00062 #include "colorwheel.xpm" 00063 #include "savedb.xpm" 00064 #include "removedb.xpm" 00065 #include "recenter_view.xpm" 00066 #include "allow_rotation.xpm" 00067 #include "show_tooltips.xpm" 00068 #include "magnify.xpm" 00069 #include "zoomstyle.xpm" 00070 #include "yes.xpm" 00071 #include "no.xpm" 00072 00073 #include "extract_streets.xpm" 00074 #include "dilate.xpm" 00075 #include "erode.xpm" 00076 #include "opening.xpm" 00077 #include "closing.xpm" 00078 #include "erase_stains.xpm" 00079 #include "close_gaps.xpm" 00080 #include "skeletonize.xpm" 00081 #include "rarify.xpm" 00082 #include "create_graph.xpm" 00083 #include "open_bmp_dialog.xpm" 00084 #include "eyedrop.xpm" 00085 #include "rubber1x.xpm" 00086 #include "rubber2x.xpm" 00087 #include "rubber3x.xpm" 00088 #include "rubber4x.xpm" 00089 #include "rubber5x.xpm" 00090 #include "paintbrush1x.xpm" 00091 #include "paintbrush2x.xpm" 00092 #include "paintbrush3x.xpm" 00093 #include "paintbrush4x.xpm" 00094 #include "paintbrush5x.xpm" 00095 #include "edit_graph.xpm" 00096 00097 00098 #include "flag.cpp" 00099 #include "flag_plus.cpp" 00100 #include "flag_minus.cpp" 00101 #include "windows_cascade.xpm" 00102 #include "windows_tile_vertically.xpm" 00103 #include "windows_tile_horizontally.xpm" 00104 #include "reload.xpm" 00105 #include "manip.cpp" 00106 #include "camera.xpm" 00107 00108 #include "undo.xpm" 00109 #include "redo.xpm" 00110 #include "netedit.xpm" 00111 00112 #include "cut.xpm" 00113 #include "ext.xpm" 00114 00115 00116 static const char* empty_xpm[] = { 00117 " 1 1 1 1", 00118 ". c None", 00119 "." 00120 }; 00121 00122 00123 #ifdef CHECK_MEMORY_LEAKS 00124 #include <foreign/nvwa/debug_new.h> 00125 #endif // CHECK_MEMORY_LEAKS 00126 00127 00128 // =========================================================================== 00129 // static member variable definitions 00130 // =========================================================================== 00131 GUIIconSubSys* GUIIconSubSys::myInstance = 0; 00132 00133 00134 // =========================================================================== 00135 // member definitions 00136 // =========================================================================== 00137 GUIIconSubSys::GUIIconSubSys(FXApp* a) { 00138 // build icons 00139 myIcons[ICON_APP] = new FXXPMIcon(a, document_xpm); 00140 myIcons[ICON_EMPTY] = new FXXPMIcon(a, empty_xpm); 00141 myIcons[ICON_OPEN_CONFIG] = new FXXPMIcon(a, fileopen_xpm); 00142 myIcons[ICON_OPEN_NET] = new FXXPMIcon(a, netopen_xpm); 00143 myIcons[ICON_RELOAD] = new FXXPMIcon(a, reload_xpm); 00144 myIcons[ICON_SAVE] = new FXXPMIcon(a, filesave_xpm); 00145 myIcons[ICON_CLOSE] = 0;//new FXXPMIcon(a, close); 00146 myIcons[ICON_START] = new FXXPMIcon(a, play_xpm); 00147 myIcons[ICON_STOP] = new FXXPMIcon(a, stop_xpm); 00148 myIcons[ICON_STEP] = new FXXPMIcon(a, step_xpm); 00149 myIcons[ICON_MICROVIEW] = new FXXPMIcon(a, new_window_xpm); 00150 myIcons[ICON_LAGGRVIEW] = new FXXPMIcon(a, new_window_xpm); 00151 myIcons[ICON_RECENTERVIEW] = new FXXPMIcon(a, recenter_view_xpm); 00152 myIcons[ICON_ALLOWROTATION] = new FXXPMIcon(a, allow_rotation_xpm); 00153 myIcons[ICON_EDITVIEWPORT] = new FXXPMIcon(a, magnify_xpm); 00154 myIcons[ICON_ZOOMSTYLE] = new FXXPMIcon(a, zoomstyle_xpm); 00155 00156 myIcons[ICON_APP_TRACKER] = new FXXPMIcon(a, app_tracker_xpm); 00157 myIcons[ICON_APP_FINDER] = new FXXPMIcon(a, app_finder_xpm); 00158 myIcons[ICON_APP_BREAKPOINTS] = new FXXPMIcon(a, app_breakpoints_xpm); 00159 myIcons[ICON_APP_TLSTRACKER] = new FXXPMIcon(a, app_tlstracker_xpm); 00160 myIcons[ICON_APP_TABLE] = new FXXPMIcon(a, app_table_xpm); 00161 myIcons[ICON_APP_SELECTOR] = new FXXPMIcon(a, app_selector_xpm); 00162 00163 myIcons[ICON_LOCATE] = new FXXPMIcon(a, locate_xpm); 00164 myIcons[ICON_LOCATEJUNCTION] = new FXXPMIcon(a, locate_junction_xpm); 00165 myIcons[ICON_LOCATEEDGE] = new FXXPMIcon(a, locate_edge_xpm); 00166 myIcons[ICON_LOCATEVEHICLE] = new FXXPMIcon(a, locate_vehicle_xpm); 00167 myIcons[ICON_LOCATETLS] = new FXXPMIcon(a, locate_tls_xpm); 00168 myIcons[ICON_LOCATEADD] = new FXXPMIcon(a, locate_add_xpm); 00169 myIcons[ICON_LOCATESHAPE] = new FXXPMIcon(a, locate_shape_xpm); 00170 00171 myIcons[ICON_COLORWHEEL] = new FXXPMIcon(a, colorwheel_xpm); 00172 myIcons[ICON_SAVEDB] = new FXXPMIcon(a, savedb_xpm); 00173 myIcons[ICON_REMOVEDB] = new FXXPMIcon(a, removedb_xpm); 00174 myIcons[ICON_SHOWTOOLTIPS] = new FXXPMIcon(a, show_tooltips_xpm); 00175 myIcons[ICON_YES] = new FXXPMIcon(a, yes_xpm); 00176 myIcons[ICON_NO] = new FXXPMIcon(a, no_xpm); 00177 myIcons[ICON_FLAG] = new FXGIFIcon(a, flag); 00178 myIcons[ICON_FLAG_PLUS] = new FXGIFIcon(a, flag_plus); 00179 myIcons[ICON_FLAG_MINUS] = new FXGIFIcon(a, flag_minus); 00180 // window arrangements 00181 myIcons[ICON_WINDOWS_CASCADE] = new FXXPMIcon(a, windows_cascade_xpm); 00182 myIcons[ICON_WINDOWS_TILE_VERT] = new FXXPMIcon(a, windows_tile_vertically_xpm); 00183 myIcons[ICON_WINDOWS_TILE_HORI] = new FXXPMIcon(a, windows_tile_horizontally_xpm); 00184 // manipulate 00185 myIcons[ICON_MANIP] = new FXGIFIcon(a, manip); 00186 myIcons[ICON_CAMERA] = new FXXPMIcon(a, camera_xpm); 00187 myIcons[ICON_EXTRACT] = new FXXPMIcon(a, extract_streets_xpm); 00188 myIcons[ICON_DILATE] = new FXXPMIcon(a, dilate_xpm); 00189 myIcons[ICON_ERODE] = new FXXPMIcon(a, erode_xpm); 00190 myIcons[ICON_OPENING] = new FXXPMIcon(a, opening_xpm); 00191 myIcons[ICON_CLOSING] = new FXXPMIcon(a, closing_xpm); 00192 myIcons[ICON_ERASE_STAINS] = new FXXPMIcon(a, erase_stains_xpm); 00193 myIcons[ICON_CLOSE_GAPS] = new FXXPMIcon(a, close_gaps_xpm); 00194 myIcons[ICON_SKELETONIZE] = new FXXPMIcon(a, skeletonize_xpm); 00195 myIcons[ICON_RARIFY] = new FXXPMIcon(a, rarify_xpm); 00196 myIcons[ICON_CREATE_GRAPH] = new FXXPMIcon(a, create_graph_xpm); 00197 myIcons[ICON_OPEN_BMP_DIALOG] = new FXXPMIcon(a, open_bmp_dialog_xpm); 00198 myIcons[ICON_EYEDROP] = new FXXPMIcon(a, eyedrop_xpm); 00199 myIcons[ICON_PAINTBRUSH1X] = new FXXPMIcon(a, paintbrush1x_xpm); 00200 myIcons[ICON_PAINTBRUSH2X] = new FXXPMIcon(a, paintbrush2x_xpm); 00201 myIcons[ICON_PAINTBRUSH3X] = new FXXPMIcon(a, paintbrush3x_xpm); 00202 myIcons[ICON_PAINTBRUSH4X] = new FXXPMIcon(a, paintbrush4x_xpm); 00203 myIcons[ICON_PAINTBRUSH5X] = new FXXPMIcon(a, paintbrush5x_xpm); 00204 myIcons[ICON_RUBBER1X] = new FXXPMIcon(a, rubber1x_xpm); 00205 myIcons[ICON_RUBBER2X] = new FXXPMIcon(a, rubber2x_xpm); 00206 myIcons[ICON_RUBBER3X] = new FXXPMIcon(a, rubber3x_xpm); 00207 myIcons[ICON_RUBBER4X] = new FXXPMIcon(a, rubber4x_xpm); 00208 myIcons[ICON_RUBBER5X] = new FXXPMIcon(a, rubber5x_xpm); 00209 myIcons[ICON_EDITGRAPH] = new FXXPMIcon(a, edit_graph_xpm); 00210 00211 myIcons[ICON_UNDO] = new FXXPMIcon(a, undo_xpm); 00212 myIcons[ICON_REDO] = new FXXPMIcon(a, redo_xpm); 00213 myIcons[ICON_NETEDIT] = new FXXPMIcon(a, netedit_xpm); 00214 00215 myIcons[ICON_EXT] = new FXXPMIcon(a, ext_xpm); 00216 myIcons[ICON_CUT_SWELL] = new FXXPMIcon(a, cut_xpm); 00217 00218 // ... and create them 00219 for (int i = 0; i < ICON_MAX; i++) { 00220 if (myIcons[i] != 0) { 00221 myIcons[i]->create(); 00222 } 00223 } 00224 } 00225 00226 00227 GUIIconSubSys::~GUIIconSubSys() { 00228 for (int i = 0; i < ICON_MAX; i++) { 00229 delete myIcons[i]; 00230 } 00231 } 00232 00233 00234 void 00235 GUIIconSubSys::init(FXApp* a) { 00236 assert(myInstance == 0); 00237 myInstance = new GUIIconSubSys(a); 00238 } 00239 00240 00241 FXIcon* 00242 GUIIconSubSys::getIcon(GUIIcon which) { 00243 return myInstance->myIcons[which]; 00244 } 00245 00246 00247 void 00248 GUIIconSubSys::close() { 00249 delete myInstance; 00250 myInstance = 0; 00251 } 00252 00253 00254 00255 /****************************************************************************/ 00256