COIN-OR::LEMON - Graph Library

Changeset 94:adfdc2f70548 in glemon-0.x for main_win.cc


Ignore:
Timestamp:
11/29/05 20:31:58 (14 years ago)
Author:
Hegyi Péter
Branch:
gui
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2389
Message:

Structure of GUI is now more clear-cut than before.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main_win.cc

    r90 r94  
    22#include "icons/guipixbufs.h"
    33
    4 MainWin::MainWin() :
    5   mapwin("Map Setup", mapstorage, gd_canvas),
    6   gd_canvas(mapstorage, mapwin, (Gtk::Window *)this)
    7 {
     4MainWin::MainWin()
     5{
     6  mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
     7  gd_canvas=new GraphDisplayerCanvas(*this);
     8
    89  set_title ("unsaved file - " + prog_name);
    910  set_default_size(WIN_WIDTH,WIN_HEIGHT);
    1011  add(vbox);
    1112
     13  //connecting signals - controller character
     14  mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
    1215
    1316  // custom icons for the toolbar
     
    9396  ag->add( Gtk::Action::create("ViewMenu", "_View") );
    9497  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));
    9699  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));
    98101  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));
    100103  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));
    102105 
    103106  ag->add( Gtk::Action::create("ShowMenu", "_Show") );
    104107  ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
    105       sigc::mem_fun(this->mapwin, &MapWin::show));
     108      sigc::mem_fun(*(this->mapwin), &MapWin::show));
    106109
    107110  Gtk::RadioAction::Group tool_group;
    108111  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) );
    110113  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) );
    112115  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) );
    114117  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) );
    116119
    117120  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) );
    119122  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) );
    121124
    122125  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 ) );
    124127
    125128  uim=Gtk::UIManager::create();
     
    195198  Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow());
    196199  pScrolledWindow->set_shadow_type(Gtk::SHADOW_IN);
    197   pScrolledWindow->add(gd_canvas);
     200  pScrolledWindow->add(*gd_canvas);
    198201  vbox.pack_start(*pScrolledWindow);
    199202
     
    209212  mapstorage.file_name = file;
    210213  mapstorage.modified = false;
    211   gd_canvas.drawGraph();
    212   mapwin.update();
     214  gd_canvas->drawGraph();
     215  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
    213216  set_title(Glib::filename_display_basename(file) + " - " + prog_name);
    214217}
     
    234237    }
    235238  }
    236   gd_canvas.clear();
     239  gd_canvas->clear();
    237240  mapstorage.clear();
    238   mapwin.update();
     241  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
    239242  set_title("unsaved file - " + prog_name);
    240243}
     
    265268  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
    266269  {
    267     gd_canvas.clear();
     270    gd_canvas->clear();
    268271    mapstorage.clear();
    269272    Glib::ustring filename = fcdialog.get_filename();
     
    272275      mapstorage.file_name = filename;
    273276      mapstorage.modified = false;
    274       gd_canvas.drawGraph();
    275       mapwin.update();
     277      gd_canvas->drawGraph();
     278      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
    276279      set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
    277280    }
     
    328331    }
    329332  }
    330   gd_canvas.clear();
     333  gd_canvas->clear();
    331334  mapstorage.clear();
    332   mapwin.update();
     335  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
    333336  set_title("unsaved file - " + prog_name);
    334337}
     338
     339void MainWin::propertyChange(bool itisedge, int prop, std::string mapname)
     340{
     341  mapstorage.changeActiveMap(itisedge, prop, mapname);
     342}
     343
     344void MainWin::popupNewMapWin(bool itisedge, int prop)
     345{
     346  prop=prop;
     347  (new NewMapWin("NewMapWin", *this, itisedge, false))->run();
     348}
     349
     350std::string MainWin::getActiveEdgeMap(int prop)
     351{
     352  return mapstorage.getActiveEdgeMap(prop);
     353}
     354
     355std::string MainWin::getActiveNodeMap(int prop)
     356{
     357  return mapstorage.getActiveNodeMap(prop);
     358}
     359
     360void MainWin::registerNewEdgeMap(std::string mapname)
     361{
     362  mapwin->registerNewEdgeMap(mapname);
     363}
     364
     365void MainWin::registerNewNodeMap(std::string mapname)
     366{
     367  mapwin->registerNewNodeMap(mapname);
     368}
Note: See TracChangeset for help on using the changeset viewer.