Changeset 1837:8dd6160ff699 in lemon-0.x for gui/main_win.cc
- Timestamp:
- 11/29/05 20:31:58 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2389
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/main_win.cc
r1823 r1837 2 2 #include "icons/guipixbufs.h" 3 3 4 MainWin::MainWin() : 5 mapwin("Map Setup", mapstorage, gd_canvas), 6 gd_canvas(mapstorage, mapwin, (Gtk::Window *)this) 7 { 4 MainWin::MainWin() 5 { 6 mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this); 7 gd_canvas=new GraphDisplayerCanvas(*this); 8 8 9 set_title ("unsaved file - " + prog_name); 9 10 set_default_size(WIN_WIDTH,WIN_HEIGHT); 10 11 add(vbox); 11 12 13 //connecting signals - controller character 14 mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange)); 12 15 13 16 // custom icons for the toolbar … … 93 96 ag->add( Gtk::Action::create("ViewMenu", "_View") ); 94 97 ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN), 95 sigc::mem_fun( this->gd_canvas, &GraphDisplayerCanvas::zoomIn));98 sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomIn)); 96 99 ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT), 97 sigc::mem_fun( this->gd_canvas, &GraphDisplayerCanvas::zoomOut));100 sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomOut)); 98 101 ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT), 99 sigc::mem_fun( this->gd_canvas, &GraphDisplayerCanvas::zoomFit));102 sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomFit)); 100 103 ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100), 101 sigc::mem_fun( this->gd_canvas, &GraphDisplayerCanvas::zoom100));104 sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoom100)); 102 105 103 106 ag->add( Gtk::Action::create("ShowMenu", "_Show") ); 104 107 ag->add( Gtk::Action::create("ShowMaps", "_Maps"), 105 sigc::mem_fun( this->mapwin, &MapWin::show));108 sigc::mem_fun(*(this->mapwin), &MapWin::show)); 106 109 107 110 Gtk::RadioAction::Group tool_group; 108 111 ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), "Move"), 109 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 0) );112 sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 0) ); 110 113 ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), "Create node"), 111 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 1) );114 sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 1) ); 112 115 ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), "Create edge"), 113 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 2) );116 sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 2) ); 114 117 ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), "Delete"), 115 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 3) );118 sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 3) ); 116 119 117 120 ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), "Edit edge map"), 118 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 4) );121 sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 4) ); 119 122 ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), "Edit node map"), 120 sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 5) );123 sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 5) ); 121 124 122 125 ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")), 123 sigc::mem_fun (new NewMapWin("NewMapWin", gd_canvas), &NewMapWin::show ) );126 sigc::mem_fun (new NewMapWin("NewMapWin", *this), &NewMapWin::show ) ); 124 127 125 128 uim=Gtk::UIManager::create(); … … 195 198 Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow()); 196 199 pScrolledWindow->set_shadow_type(Gtk::SHADOW_IN); 197 pScrolledWindow->add( gd_canvas);200 pScrolledWindow->add(*gd_canvas); 198 201 vbox.pack_start(*pScrolledWindow); 199 202 … … 209 212 mapstorage.file_name = file; 210 213 mapstorage.modified = false; 211 gd_canvas .drawGraph();212 mapwin .update();214 gd_canvas->drawGraph(); 215 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 213 216 set_title(Glib::filename_display_basename(file) + " - " + prog_name); 214 217 } … … 234 237 } 235 238 } 236 gd_canvas .clear();239 gd_canvas->clear(); 237 240 mapstorage.clear(); 238 mapwin .update();241 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 239 242 set_title("unsaved file - " + prog_name); 240 243 } … … 265 268 if (fcdialog.run() == Gtk::RESPONSE_ACCEPT) 266 269 { 267 gd_canvas .clear();270 gd_canvas->clear(); 268 271 mapstorage.clear(); 269 272 Glib::ustring filename = fcdialog.get_filename(); … … 272 275 mapstorage.file_name = filename; 273 276 mapstorage.modified = false; 274 gd_canvas .drawGraph();275 mapwin .update();277 gd_canvas->drawGraph(); 278 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 276 279 set_title(Glib::filename_display_basename(filename) + " - " + prog_name); 277 280 } … … 328 331 } 329 332 } 330 gd_canvas .clear();333 gd_canvas->clear(); 331 334 mapstorage.clear(); 332 mapwin .update();335 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList()); 333 336 set_title("unsaved file - " + prog_name); 334 337 } 338 339 void MainWin::propertyChange(bool itisedge, int prop, std::string mapname) 340 { 341 mapstorage.changeActiveMap(itisedge, prop, mapname); 342 } 343 344 void MainWin::popupNewMapWin(bool itisedge, int prop) 345 { 346 prop=prop; 347 (new NewMapWin("NewMapWin", *this, itisedge, false))->run(); 348 } 349 350 std::string MainWin::getActiveEdgeMap(int prop) 351 { 352 return mapstorage.getActiveEdgeMap(prop); 353 } 354 355 std::string MainWin::getActiveNodeMap(int prop) 356 { 357 return mapstorage.getActiveNodeMap(prop); 358 } 359 360 void MainWin::registerNewEdgeMap(std::string mapname) 361 { 362 mapwin->registerNewEdgeMap(mapname); 363 } 364 365 void MainWin::registerNewNodeMap(std::string mapname) 366 { 367 mapwin->registerNewNodeMap(mapname); 368 }
Note: See TracChangeset
for help on using the changeset viewer.