[1606] | 1 | #include "main_win.h" |
---|
[1659] | 2 | #include "icons/guipixbufs.h" |
---|
[1442] | 3 | |
---|
[1838] | 4 | MainWin::MainWin():mapwinexists(false) |
---|
[1442] | 5 | { |
---|
[1837] | 6 | gd_canvas=new GraphDisplayerCanvas(*this); |
---|
| 7 | |
---|
[1650] | 8 | set_title ("unsaved file - " + prog_name); |
---|
[1442] | 9 | set_default_size(WIN_WIDTH,WIN_HEIGHT); |
---|
| 10 | add(vbox); |
---|
| 11 | |
---|
[1837] | 12 | //connecting signals - controller character |
---|
| 13 | mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange)); |
---|
[1634] | 14 | |
---|
| 15 | // custom icons for the toolbar |
---|
| 16 | |
---|
| 17 | Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create(); |
---|
| 18 | |
---|
[1635] | 19 | Glib::RefPtr<Gdk::Pixbuf> p_move_pixbuf = Gdk::Pixbuf::create_from_inline( |
---|
| 20 | 2328, gui_icons_move); |
---|
| 21 | Glib::RefPtr<Gdk::Pixbuf> p_addnode_pixbuf = Gdk::Pixbuf::create_from_inline( |
---|
| 22 | 2328, gui_icons_addnode); |
---|
| 23 | Glib::RefPtr<Gdk::Pixbuf> p_addlink_pixbuf = Gdk::Pixbuf::create_from_inline( |
---|
| 24 | 2328, gui_icons_addlink); |
---|
| 25 | Glib::RefPtr<Gdk::Pixbuf> p_delete_pixbuf = Gdk::Pixbuf::create_from_inline( |
---|
| 26 | 2328, gui_icons_delete); |
---|
| 27 | Glib::RefPtr<Gdk::Pixbuf> p_editlink_pixbuf = Gdk::Pixbuf::create_from_inline( |
---|
| 28 | 2328, gui_icons_editlink); |
---|
| 29 | Glib::RefPtr<Gdk::Pixbuf> p_editnode_pixbuf = Gdk::Pixbuf::create_from_inline( |
---|
| 30 | 2328, gui_icons_editnode); |
---|
| 31 | Glib::RefPtr<Gdk::Pixbuf> p_newmap_pixbuf = Gdk::Pixbuf::create_from_inline( |
---|
| 32 | 2328, gui_icons_newmap); |
---|
[1634] | 33 | |
---|
| 34 | Gtk::IconSource move_icon_source; |
---|
[1635] | 35 | move_icon_source.set_pixbuf(p_move_pixbuf); |
---|
[1634] | 36 | Gtk::IconSet move_icon_set; |
---|
| 37 | move_icon_set.add_source(move_icon_source); |
---|
| 38 | p_icon_factory->add(Gtk::StockID("gd-move"), move_icon_set); |
---|
| 39 | |
---|
| 40 | Gtk::IconSource addnode_icon_source; |
---|
[1635] | 41 | addnode_icon_source.set_pixbuf(p_addnode_pixbuf); |
---|
[1634] | 42 | Gtk::IconSet addnode_icon_set; |
---|
| 43 | addnode_icon_set.add_source(addnode_icon_source); |
---|
| 44 | p_icon_factory->add(Gtk::StockID("gd-addnode"), addnode_icon_set); |
---|
| 45 | |
---|
| 46 | Gtk::IconSource addlink_icon_source; |
---|
[1635] | 47 | addlink_icon_source.set_pixbuf(p_addlink_pixbuf); |
---|
[1634] | 48 | Gtk::IconSet addlink_icon_set; |
---|
| 49 | addlink_icon_set.add_source(addlink_icon_source); |
---|
| 50 | p_icon_factory->add(Gtk::StockID("gd-addlink"), addlink_icon_set); |
---|
| 51 | |
---|
| 52 | Gtk::IconSource delete_icon_source; |
---|
[1635] | 53 | delete_icon_source.set_pixbuf(p_delete_pixbuf); |
---|
[1634] | 54 | Gtk::IconSet delete_icon_set; |
---|
| 55 | delete_icon_set.add_source(delete_icon_source); |
---|
| 56 | p_icon_factory->add(Gtk::StockID("gd-delete"), delete_icon_set); |
---|
| 57 | |
---|
| 58 | Gtk::IconSource editlink_icon_source; |
---|
[1635] | 59 | editlink_icon_source.set_pixbuf(p_editlink_pixbuf); |
---|
[1634] | 60 | Gtk::IconSet editlink_icon_set; |
---|
| 61 | editlink_icon_set.add_source(editlink_icon_source); |
---|
| 62 | p_icon_factory->add(Gtk::StockID("gd-editlink"), editlink_icon_set); |
---|
| 63 | |
---|
| 64 | Gtk::IconSource editnode_icon_source; |
---|
[1635] | 65 | editnode_icon_source.set_pixbuf(p_editnode_pixbuf); |
---|
[1634] | 66 | Gtk::IconSet editnode_icon_set; |
---|
| 67 | editnode_icon_set.add_source(editnode_icon_source); |
---|
| 68 | p_icon_factory->add(Gtk::StockID("gd-editnode"), editnode_icon_set); |
---|
| 69 | |
---|
| 70 | Gtk::IconSource newmap_icon_source; |
---|
[1635] | 71 | newmap_icon_source.set_pixbuf(p_newmap_pixbuf); |
---|
[1634] | 72 | Gtk::IconSet newmap_icon_set; |
---|
| 73 | newmap_icon_set.add_source(newmap_icon_source); |
---|
| 74 | p_icon_factory->add(Gtk::StockID("gd-newmap"), newmap_icon_set); |
---|
| 75 | |
---|
| 76 | p_icon_factory->add_default(); |
---|
| 77 | |
---|
| 78 | |
---|
[1442] | 79 | ag=Gtk::ActionGroup::create(); |
---|
| 80 | |
---|
| 81 | ag->add( Gtk::Action::create("FileMenu", "_File") ); |
---|
| 82 | ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW), |
---|
| 83 | sigc::mem_fun(*this, &MainWin::newFile)); |
---|
| 84 | ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN), |
---|
| 85 | sigc::mem_fun(*this, &MainWin::openFile)); |
---|
| 86 | ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE), |
---|
| 87 | sigc::mem_fun(*this, &MainWin::saveFile)); |
---|
| 88 | ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS), |
---|
| 89 | sigc::mem_fun(*this, &MainWin::saveFileAs)); |
---|
[1606] | 90 | ag->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE), |
---|
| 91 | sigc::mem_fun(*this, &MainWin::close)); |
---|
| 92 | ag->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT), |
---|
[1598] | 93 | sigc::mem_fun(*this, &MainWin::hide)); |
---|
[1442] | 94 | |
---|
| 95 | ag->add( Gtk::Action::create("ViewMenu", "_View") ); |
---|
| 96 | ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN), |
---|
[1837] | 97 | sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomIn)); |
---|
[1442] | 98 | ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT), |
---|
[1837] | 99 | sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomOut)); |
---|
[1442] | 100 | ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT), |
---|
[1837] | 101 | sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomFit)); |
---|
[1442] | 102 | ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100), |
---|
[1837] | 103 | sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoom100)); |
---|
[1442] | 104 | |
---|
| 105 | ag->add( Gtk::Action::create("ShowMenu", "_Show") ); |
---|
| 106 | ag->add( Gtk::Action::create("ShowMaps", "_Maps"), |
---|
[1838] | 107 | sigc::mem_fun(*this, &MainWin::createMapWin)); |
---|
[1442] | 108 | |
---|
[1606] | 109 | Gtk::RadioAction::Group tool_group; |
---|
[1634] | 110 | ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), "Move"), |
---|
[1837] | 111 | sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 0) ); |
---|
[1634] | 112 | ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), "Create node"), |
---|
[1837] | 113 | sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 1) ); |
---|
[1634] | 114 | ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), "Create edge"), |
---|
[1837] | 115 | sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 2) ); |
---|
[1634] | 116 | ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), "Delete"), |
---|
[1837] | 117 | sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 3) ); |
---|
[1634] | 118 | |
---|
| 119 | ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), "Edit edge map"), |
---|
[1837] | 120 | sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 4) ); |
---|
[1634] | 121 | ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), "Edit node map"), |
---|
[1837] | 122 | sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 5) ); |
---|
[1634] | 123 | |
---|
| 124 | ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")), |
---|
[1837] | 125 | sigc::mem_fun (new NewMapWin("NewMapWin", *this), &NewMapWin::show ) ); |
---|
[1502] | 126 | |
---|
[1442] | 127 | uim=Gtk::UIManager::create(); |
---|
| 128 | uim->insert_action_group(ag); |
---|
| 129 | add_accel_group(uim->get_accel_group()); |
---|
| 130 | |
---|
| 131 | try |
---|
| 132 | { |
---|
| 133 | |
---|
| 134 | Glib::ustring ui_info = |
---|
| 135 | "<ui>" |
---|
| 136 | " <menubar name='MenuBar'>" |
---|
| 137 | " <menu action='FileMenu'>" |
---|
| 138 | " <menuitem action='FileNew'/>" |
---|
| 139 | " <menuitem action='FileOpen'/>" |
---|
| 140 | " <menuitem action='FileSave'/>" |
---|
| 141 | " <menuitem action='FileSaveAs'/>" |
---|
[1606] | 142 | " <menuitem action='Close'/>" |
---|
| 143 | " <menuitem action='Quit'/>" |
---|
[1442] | 144 | " </menu>" |
---|
| 145 | " <menu action='ViewMenu'>" |
---|
| 146 | " <menuitem action='ViewZoomIn' />" |
---|
| 147 | " <menuitem action='ViewZoomOut' />" |
---|
| 148 | " <menuitem action='ViewZoom100' />" |
---|
[1777] | 149 | " <menuitem action='ViewZoomFit' />" |
---|
[1442] | 150 | " </menu>" |
---|
| 151 | " <menu action='ShowMenu'>" |
---|
| 152 | " <menuitem action='ShowMaps'/>" |
---|
| 153 | " </menu>" |
---|
| 154 | " </menubar>" |
---|
| 155 | " <toolbar name='ToolBar'>" |
---|
| 156 | " <toolitem action='FileNew' />" |
---|
| 157 | " <toolitem action='FileOpen' />" |
---|
| 158 | " <toolitem action='FileSave' />" |
---|
[1606] | 159 | " <toolitem action='Close' />" |
---|
[1442] | 160 | " <separator />" |
---|
| 161 | " <toolitem action='ViewZoomIn' />" |
---|
| 162 | " <toolitem action='ViewZoomOut' />" |
---|
| 163 | " <toolitem action='ViewZoom100' />" |
---|
[1777] | 164 | " <toolitem action='ViewZoomFit' />" |
---|
[1502] | 165 | " <separator />" |
---|
[1606] | 166 | " <toolitem action='MoveItem' />" |
---|
[1502] | 167 | " <toolitem action='CreateNode' />" |
---|
| 168 | " <toolitem action='CreateEdge' />" |
---|
| 169 | " <toolitem action='EraseItem' />" |
---|
[1550] | 170 | " <toolitem action='EditEdgeMap' />" |
---|
| 171 | " <toolitem action='EditNodeMap' />" |
---|
[1634] | 172 | " <separator />" |
---|
[1592] | 173 | " <toolitem action='AddMap' />" |
---|
[1442] | 174 | " </toolbar>" |
---|
| 175 | "</ui>"; |
---|
| 176 | |
---|
| 177 | uim->add_ui_from_string(ui_info); |
---|
| 178 | |
---|
| 179 | } |
---|
| 180 | catch(const Glib::Error& ex) |
---|
| 181 | { |
---|
| 182 | std::cerr << "building menus failed: " << ex.what(); |
---|
| 183 | } |
---|
| 184 | |
---|
| 185 | Gtk::Widget* menubar = uim->get_widget("/MenuBar"); |
---|
| 186 | if (menubar){ |
---|
| 187 | vbox.pack_start(*menubar, Gtk::PACK_SHRINK); |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | Gtk::Widget* toolbar = uim->get_widget("/ToolBar"); |
---|
| 191 | if (toolbar) |
---|
| 192 | { |
---|
| 193 | static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS); |
---|
| 194 | vbox.pack_start(*toolbar, Gtk::PACK_SHRINK); |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow()); |
---|
[1777] | 198 | pScrolledWindow->set_shadow_type(Gtk::SHADOW_IN); |
---|
[1837] | 199 | pScrolledWindow->add(*gd_canvas); |
---|
[1442] | 200 | vbox.pack_start(*pScrolledWindow); |
---|
[1601] | 201 | |
---|
| 202 | tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node"); |
---|
| 203 | tooltips.enable(); |
---|
[1442] | 204 | |
---|
| 205 | show_all_children(); |
---|
| 206 | } |
---|
| 207 | |
---|
[1616] | 208 | void MainWin::readFile(const std::string &file) |
---|
| 209 | { |
---|
| 210 | mapstorage.readFromFile(file); |
---|
| 211 | mapstorage.file_name = file; |
---|
| 212 | mapstorage.modified = false; |
---|
[1837] | 213 | gd_canvas->drawGraph(); |
---|
[1838] | 214 | if(mapwinexists) |
---|
| 215 | { |
---|
| 216 | mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); |
---|
| 217 | } |
---|
[1650] | 218 | set_title(Glib::filename_display_basename(file) + " - " + prog_name); |
---|
[1616] | 219 | } |
---|
| 220 | |
---|
[1442] | 221 | void MainWin::newFile() |
---|
| 222 | { |
---|
[1606] | 223 | if (mapstorage.modified) |
---|
| 224 | { |
---|
[1615] | 225 | Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, |
---|
| 226 | Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); |
---|
[1606] | 227 | mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT); |
---|
| 228 | mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
---|
| 229 | mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); |
---|
| 230 | switch (mdialog.run()) |
---|
| 231 | { |
---|
| 232 | case Gtk::RESPONSE_CANCEL: |
---|
| 233 | return; |
---|
| 234 | case Gtk::RESPONSE_REJECT: |
---|
| 235 | break; |
---|
| 236 | case Gtk::RESPONSE_ACCEPT: |
---|
| 237 | saveFile(); |
---|
| 238 | break; |
---|
| 239 | } |
---|
| 240 | } |
---|
[1837] | 241 | gd_canvas->clear(); |
---|
[1606] | 242 | mapstorage.clear(); |
---|
[1838] | 243 | if(mapwinexists) |
---|
| 244 | { |
---|
| 245 | mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); |
---|
| 246 | } |
---|
[1650] | 247 | set_title("unsaved file - " + prog_name); |
---|
[1442] | 248 | } |
---|
| 249 | |
---|
| 250 | void MainWin::openFile() |
---|
| 251 | { |
---|
[1606] | 252 | if (mapstorage.modified) |
---|
| 253 | { |
---|
[1615] | 254 | Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, |
---|
| 255 | Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); |
---|
[1606] | 256 | mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT); |
---|
| 257 | mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
---|
| 258 | mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); |
---|
| 259 | switch (mdialog.run()) |
---|
| 260 | { |
---|
| 261 | case Gtk::RESPONSE_CANCEL: |
---|
| 262 | return; |
---|
| 263 | case Gtk::RESPONSE_REJECT: |
---|
| 264 | break; |
---|
| 265 | case Gtk::RESPONSE_ACCEPT: |
---|
| 266 | saveFile(); |
---|
| 267 | break; |
---|
| 268 | } |
---|
| 269 | } |
---|
| 270 | Gtk::FileChooserDialog fcdialog("Open File"); |
---|
| 271 | fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
---|
| 272 | fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT); |
---|
| 273 | if (fcdialog.run() == Gtk::RESPONSE_ACCEPT) |
---|
| 274 | { |
---|
[1837] | 275 | gd_canvas->clear(); |
---|
[1650] | 276 | mapstorage.clear(); |
---|
[1606] | 277 | Glib::ustring filename = fcdialog.get_filename(); |
---|
[1645] | 278 | if (!mapstorage.readFromFile(filename)) |
---|
| 279 | { |
---|
| 280 | mapstorage.file_name = filename; |
---|
| 281 | mapstorage.modified = false; |
---|
[1837] | 282 | gd_canvas->drawGraph(); |
---|
[1838] | 283 | if(mapwinexists) |
---|
| 284 | { |
---|
| 285 | mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); |
---|
| 286 | } |
---|
[1650] | 287 | set_title(Glib::filename_display_basename(filename) + " - " + prog_name); |
---|
[1645] | 288 | } |
---|
[1606] | 289 | } |
---|
[1442] | 290 | } |
---|
| 291 | |
---|
| 292 | void MainWin::saveFile() |
---|
| 293 | { |
---|
[1606] | 294 | if (mapstorage.file_name == "") { |
---|
| 295 | saveFileAs(); |
---|
| 296 | } |
---|
| 297 | else |
---|
| 298 | { |
---|
| 299 | mapstorage.writeToFile(mapstorage.file_name); |
---|
| 300 | mapstorage.modified = false; |
---|
[1650] | 301 | set_title(Glib::filename_display_basename(mapstorage.file_name) + " - " + |
---|
| 302 | prog_name); |
---|
[1606] | 303 | } |
---|
[1442] | 304 | } |
---|
| 305 | |
---|
| 306 | void MainWin::saveFileAs() |
---|
| 307 | { |
---|
[1606] | 308 | Gtk::FileChooserDialog fcdialog("Save File", Gtk::FILE_CHOOSER_ACTION_SAVE); |
---|
| 309 | fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
---|
| 310 | fcdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); |
---|
| 311 | if (fcdialog.run() == Gtk::RESPONSE_ACCEPT) |
---|
| 312 | { |
---|
| 313 | Glib::ustring filename = fcdialog.get_filename(); |
---|
| 314 | mapstorage.file_name = filename; |
---|
| 315 | mapstorage.writeToFile(filename); |
---|
| 316 | mapstorage.modified = false; |
---|
[1650] | 317 | set_title(Glib::filename_display_basename(filename) + " - " + prog_name); |
---|
[1606] | 318 | } |
---|
[1442] | 319 | } |
---|
[1606] | 320 | |
---|
| 321 | void MainWin::close() |
---|
| 322 | { |
---|
| 323 | if (mapstorage.modified) |
---|
| 324 | { |
---|
[1615] | 325 | Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, |
---|
| 326 | Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); |
---|
[1606] | 327 | mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT); |
---|
| 328 | mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); |
---|
| 329 | mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); |
---|
| 330 | switch (mdialog.run()) |
---|
| 331 | { |
---|
| 332 | case Gtk::RESPONSE_CANCEL: |
---|
| 333 | return; |
---|
| 334 | case Gtk::RESPONSE_REJECT: |
---|
| 335 | break; |
---|
| 336 | case Gtk::RESPONSE_ACCEPT: |
---|
| 337 | saveFile(); |
---|
| 338 | break; |
---|
| 339 | } |
---|
| 340 | } |
---|
[1837] | 341 | gd_canvas->clear(); |
---|
[1606] | 342 | mapstorage.clear(); |
---|
[1838] | 343 | if(mapwinexists) |
---|
| 344 | { |
---|
| 345 | mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); |
---|
| 346 | } |
---|
[1650] | 347 | set_title("unsaved file - " + prog_name); |
---|
[1606] | 348 | } |
---|
[1837] | 349 | |
---|
| 350 | void MainWin::propertyChange(bool itisedge, int prop, std::string mapname) |
---|
| 351 | { |
---|
| 352 | mapstorage.changeActiveMap(itisedge, prop, mapname); |
---|
| 353 | } |
---|
| 354 | |
---|
| 355 | void MainWin::popupNewMapWin(bool itisedge, int prop) |
---|
| 356 | { |
---|
| 357 | prop=prop; |
---|
| 358 | (new NewMapWin("NewMapWin", *this, itisedge, false))->run(); |
---|
| 359 | } |
---|
| 360 | |
---|
| 361 | std::string MainWin::getActiveEdgeMap(int prop) |
---|
| 362 | { |
---|
| 363 | return mapstorage.getActiveEdgeMap(prop); |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | std::string MainWin::getActiveNodeMap(int prop) |
---|
| 367 | { |
---|
| 368 | return mapstorage.getActiveNodeMap(prop); |
---|
| 369 | } |
---|
| 370 | |
---|
| 371 | void MainWin::registerNewEdgeMap(std::string mapname) |
---|
| 372 | { |
---|
[1838] | 373 | if(mapwinexists) |
---|
| 374 | { |
---|
| 375 | mapwin->registerNewEdgeMap(mapname); |
---|
| 376 | } |
---|
[1837] | 377 | } |
---|
| 378 | |
---|
| 379 | void MainWin::registerNewNodeMap(std::string mapname) |
---|
| 380 | { |
---|
[1838] | 381 | if(mapwinexists) |
---|
| 382 | { |
---|
| 383 | mapwin->registerNewNodeMap(mapname); |
---|
| 384 | } |
---|
[1837] | 385 | } |
---|
[1838] | 386 | |
---|
| 387 | void MainWin::createMapWin() |
---|
| 388 | { |
---|
| 389 | if(!mapwinexists) |
---|
| 390 | { |
---|
| 391 | mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this); |
---|
| 392 | mapwin->show(); |
---|
| 393 | mapwinexists=true; |
---|
| 394 | } |
---|
| 395 | } |
---|
| 396 | |
---|
| 397 | void MainWin::closeMapWin() |
---|
| 398 | { |
---|
| 399 | mapwinexists=false; |
---|
| 400 | delete mapwin; |
---|
| 401 | } |
---|