COIN-OR::LEMON - Graph Library

Changeset 1838:b61682f0ee96 in lemon-0.x for gui


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

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

Location:
gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • gui/main_win.cc

    r1837 r1838  
    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}
  • gui/main_win.h

    r1837 r1838  
    2828
    2929protected:
    30   ///Window of map-showing setup. Its type is \ref MapWin
    3130  MapWin * mapwin;
     31  bool mapwinexists;
    3232
    3333  ///The graph will be drawn on this \ref GraphDisplayerCanvas
     
    6767  void registerNewNodeMap(std::string);
    6868
     69  void createMapWin();
     70  void closeMapWin();
    6971};
    7072
  • gui/map_win.cc

    r1837 r1838  
    66  if(e->keyval==GDK_Escape)
    77  {
    8     hide();
     8    mainwin.closeMapWin();
     9    //    hide();
    910  }
    1011  return true;
     
    2425  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    2526  {
    26     e_combo_array[i]=new MapSelector(eml, i, true);
     27    e_combo_array[i]=new MapSelector(eml, mainwin.getActiveEdgeMap(i), i, true);
    2728
    2829    (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
     
    4445  for(int i=0;i<NODE_PROPERTY_NUM;i++)
    4546  {
    46     n_combo_array[i]=new MapSelector(nml, i, false);
     47    n_combo_array[i]=new MapSelector(nml, mainwin.getActiveNodeMap(i), i, false);
    4748
    4849    (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
     
    6061  show_all_children();
    6162
     63}
     64
     65MapWin::~MapWin()
     66{
    6267}
    6368
     
    107112  }
    108113}
     114
     115bool MapWin::on_delete_event(GdkEventAny * event)
     116{
     117  event=event;
     118  mainwin.closeMapWin();
     119  return true;
     120}
  • gui/map_win.h

    r1837 r1838  
    4141  public:
    4242
    43     MapSelector(std::vector<std::string>, int, bool);
     43    MapSelector(std::vector<std::string>, std::string, int, bool);
    4444
    4545    sigc::signal<void, std::string> signal_cbt_ch();
     
    8080  MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, MainWin & mw);
    8181
     82  ~MapWin();
     83
     84  virtual bool on_delete_event(GdkEventAny *);
     85
    8286  void nodeMapChanged(std::string, int);
    8387
  • gui/mw-mapselector.cc

    r1837 r1838  
    11#include "map_win.h"
    22
    3 MapWin::MapSelector::MapSelector(std::vector<std::string> ml, int identifier, bool edge):id(identifier),itisedge(edge),default_state(true),set_new_map(false)
     3MapWin::MapSelector::MapSelector(std::vector<std::string> ml, std::string act, int identifier, bool edge):id(identifier),itisedge(edge),set_new_map(false)
    44{
    55  update_list(ml);
    66
    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    }
    817
    918  //binding signal to the actual entry
     
    5665void MapWin::MapSelector::update_list( std::vector< std::string > ml )
    5766{
     67  int prev_act=cbt.get_active_row_number();
    5868  cbt.clear();
    5969  std::vector< std::string >::iterator emsi=ml.begin();
     
    6373    }
    6474  cbt.prepend_text("Default values");
     75  if(prev_act!=-1)
     76    {
     77      cbt.set_active(prev_act);
     78    }
    6579}
    6680
     
    7892  else if((!default_state)&&(cbt.get_active_row_number()==0))
    7993    {
    80       signal_cbt.emit("");
    8194      reset();
    8295    }
     
    8699{
    87100  default_state=true;
     101
    88102  cbt.set_active(0);
    89103
Note: See TracChangeset for help on using the changeset viewer.