Changeset 95:628c0b383d2f in glemon-0.x
- Timestamp:
- 11/30/05 14:24:23 (19 years ago)
- Branch:
- gui
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2391
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main_win.cc
r94 r95 2 2 #include "icons/guipixbufs.h" 3 3 4 MainWin::MainWin() 5 { 6 mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this); 4 MainWin::MainWin():mapwinexists(false) 5 { 7 6 gd_canvas=new GraphDisplayerCanvas(*this); 8 7 … … 106 105 ag->add( Gtk::Action::create("ShowMenu", "_Show") ); 107 106 ag->add( Gtk::Action::create("ShowMaps", "_Maps"), 108 sigc::mem_fun(*(this->mapwin), &MapWin::show));107 sigc::mem_fun(*this, &MainWin::createMapWin)); 109 108 110 109 Gtk::RadioAction::Group tool_group; … … 213 212 mapstorage.modified = false; 214 213 gd_canvas->drawGraph(); 215 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 214 if(mapwinexists) 215 { 216 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 217 } 216 218 set_title(Glib::filename_display_basename(file) + " - " + prog_name); 217 219 } … … 239 241 gd_canvas->clear(); 240 242 mapstorage.clear(); 241 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 243 if(mapwinexists) 244 { 245 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 246 } 242 247 set_title("unsaved file - " + prog_name); 243 248 } … … 276 281 mapstorage.modified = false; 277 282 gd_canvas->drawGraph(); 278 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 283 if(mapwinexists) 284 { 285 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 286 } 279 287 set_title(Glib::filename_display_basename(filename) + " - " + prog_name); 280 288 } … … 333 341 gd_canvas->clear(); 334 342 mapstorage.clear(); 335 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 343 if(mapwinexists) 344 { 345 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 346 } 336 347 set_title("unsaved file - " + prog_name); 337 348 } … … 360 371 void MainWin::registerNewEdgeMap(std::string mapname) 361 372 { 362 mapwin->registerNewEdgeMap(mapname); 373 if(mapwinexists) 374 { 375 mapwin->registerNewEdgeMap(mapname); 376 } 363 377 } 364 378 365 379 void MainWin::registerNewNodeMap(std::string mapname) 366 380 { 367 mapwin->registerNewNodeMap(mapname); 368 } 381 if(mapwinexists) 382 { 383 mapwin->registerNewNodeMap(mapname); 384 } 385 } 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 } -
main_win.h
r94 r95 28 28 29 29 protected: 30 ///Window of map-showing setup. Its type is \ref MapWin31 30 MapWin * mapwin; 31 bool mapwinexists; 32 32 33 33 ///The graph will be drawn on this \ref GraphDisplayerCanvas … … 67 67 void registerNewNodeMap(std::string); 68 68 69 void createMapWin(); 70 void closeMapWin(); 69 71 }; 70 72 -
map_win.cc
r94 r95 6 6 if(e->keyval==GDK_Escape) 7 7 { 8 hide(); 8 mainwin.closeMapWin(); 9 // hide(); 9 10 } 10 11 return true; … … 24 25 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 25 26 { 26 e_combo_array[i]=new MapSelector(eml, i, true);27 e_combo_array[i]=new MapSelector(eml, mainwin.getActiveEdgeMap(i), i, true); 27 28 28 29 (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); … … 44 45 for(int i=0;i<NODE_PROPERTY_NUM;i++) 45 46 { 46 n_combo_array[i]=new MapSelector(nml, i, false);47 n_combo_array[i]=new MapSelector(nml, mainwin.getActiveNodeMap(i), i, false); 47 48 48 49 (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); … … 60 61 show_all_children(); 61 62 63 } 64 65 MapWin::~MapWin() 66 { 62 67 } 63 68 … … 107 112 } 108 113 } 114 115 bool MapWin::on_delete_event(GdkEventAny * event) 116 { 117 event=event; 118 mainwin.closeMapWin(); 119 return true; 120 } -
map_win.h
r94 r95 41 41 public: 42 42 43 MapSelector(std::vector<std::string>, int, bool);43 MapSelector(std::vector<std::string>, std::string, int, bool); 44 44 45 45 sigc::signal<void, std::string> signal_cbt_ch(); … … 80 80 MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, MainWin & mw); 81 81 82 ~MapWin(); 83 84 virtual bool on_delete_event(GdkEventAny *); 85 82 86 void nodeMapChanged(std::string, int); 83 87 -
mw-mapselector.cc
r94 r95 1 1 #include "map_win.h" 2 2 3 MapWin::MapSelector::MapSelector(std::vector<std::string> ml, int identifier, bool edge):id(identifier),itisedge(edge),default_state(true),set_new_map(false)3 MapWin::MapSelector::MapSelector(std::vector<std::string> ml, std::string act, int identifier, bool edge):id(identifier),itisedge(edge),set_new_map(false) 4 4 { 5 5 update_list(ml); 6 6 7 cbt.set_active(0); 7 if(act=="") 8 { 9 cbt.set_active(0); 10 default_state=true; 11 } 12 else 13 { 14 cbt.set_active_text((Glib::ustring)act); 15 default_state=false; 16 } 8 17 9 18 //binding signal to the actual entry … … 56 65 void MapWin::MapSelector::update_list( std::vector< std::string > ml ) 57 66 { 67 int prev_act=cbt.get_active_row_number(); 58 68 cbt.clear(); 59 69 std::vector< std::string >::iterator emsi=ml.begin(); … … 63 73 } 64 74 cbt.prepend_text("Default values"); 75 if(prev_act!=-1) 76 { 77 cbt.set_active(prev_act); 78 } 65 79 } 66 80 … … 78 92 else if((!default_state)&&(cbt.get_active_row_number()==0)) 79 93 { 80 signal_cbt.emit("");81 94 reset(); 82 95 } … … 86 99 { 87 100 default_state=true; 101 88 102 cbt.set_active(0); 89 103
Note: See TracChangeset
for help on using the changeset viewer.