COIN-OR::LEMON - Graph Library

Changeset 95:628c0b383d2f in glemon-0.x for main_win.cc


Ignore:
Timestamp:
11/30/05 14:24:23 (18 years ago)
Author:
Hegyi Péter
Branch:
gui
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2391
Message:

MapWin? is created and disposed from now instead of being show and hide.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main_win.cc

    r94 r95  
    22#include "icons/guipixbufs.h"
    33
    4 MainWin::MainWin()
    5 {
    6   mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
     4MainWin::MainWin():mapwinexists(false)
     5{
    76  gd_canvas=new GraphDisplayerCanvas(*this);
    87
     
    106105  ag->add( Gtk::Action::create("ShowMenu", "_Show") );
    107106  ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
    108       sigc::mem_fun(*(this->mapwin), &MapWin::show));
     107           sigc::mem_fun(*this, &MainWin::createMapWin));
    109108
    110109  Gtk::RadioAction::Group tool_group;
     
    213212  mapstorage.modified = false;
    214213  gd_canvas->drawGraph();
    215   mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     214  if(mapwinexists)
     215    {
     216      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     217    }
    216218  set_title(Glib::filename_display_basename(file) + " - " + prog_name);
    217219}
     
    239241  gd_canvas->clear();
    240242  mapstorage.clear();
    241   mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     243  if(mapwinexists)
     244    {
     245      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     246    }
    242247  set_title("unsaved file - " + prog_name);
    243248}
     
    276281      mapstorage.modified = false;
    277282      gd_canvas->drawGraph();
    278       mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     283      if(mapwinexists)
     284        {
     285          mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     286        }
    279287      set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
    280288    }
     
    333341  gd_canvas->clear();
    334342  mapstorage.clear();
    335   mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     343  if(mapwinexists)
     344    {
     345      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     346    }
    336347  set_title("unsaved file - " + prog_name);
    337348}
     
    360371void MainWin::registerNewEdgeMap(std::string mapname)
    361372{
    362   mapwin->registerNewEdgeMap(mapname);
     373  if(mapwinexists)
     374    {
     375      mapwin->registerNewEdgeMap(mapname);
     376    }
    363377}
    364378
    365379void MainWin::registerNewNodeMap(std::string mapname)
    366380{
    367   mapwin->registerNewNodeMap(mapname);
    368 }
     381  if(mapwinexists)
     382    {
     383      mapwin->registerNewNodeMap(mapname);
     384    }
     385}
     386
     387void 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
     397void MainWin::closeMapWin()
     398{
     399  mapwinexists=false;
     400  delete mapwin;
     401}
Note: See TracChangeset for help on using the changeset viewer.