COIN-OR::LEMON - Graph Library

Changeset 194:6b2b718420eb in glemon-0.x for nbtab.cc


Ignore:
Timestamp:
02/28/07 19:20:28 (13 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3205
Message:

Header reorganising

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nbtab.cc

    r191 r194  
    1818
    1919#include <nbtab.h>
     20#include <mapstorage.h>
    2021#include <eps_win.h>
    21 
    22 NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false), mapstorage(*this)
    23 {
     22#include <map_win.h>
     23#include <design_win.h>
     24#include <graph_displayer_canvas.h>
     25
     26
     27
     28NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false)
     29{
     30  mapstorage=new MapStorage(*this);
     31
    2432  Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow);
    2533  gd_canvas=new GraphDisplayerCanvas(*this);
     
    2836
    2937  //connecting signals - controller character
    30   mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
    31   mapstorage.signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
    32   mapstorage.signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
     38  mapstorage->signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
     39  mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
     40  mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
    3341  show_all_children();
    3442  show();
     
    3745void NoteBookTab::readFile(const std::string &file)
    3846{
    39   mapstorage.readFromFile(file);
    40   mapstorage.file_name = file;
    41   mapstorage.modified = false;
     47  mapstorage->readFromFile(file);
     48  mapstorage->file_name = file;
     49  mapstorage->modified = false;
    4250  gd_canvas->drawGraph();
    4351  if(mapwinexists)
    4452    {
    45       mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     53      mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
    4654    }
    4755  signal_title.emit(Glib::filename_display_basename(file));
     
    5058void NoteBookTab::newFile()
    5159{
    52   if (mapstorage.modified)
     60  if (mapstorage->modified)
    5361  {
    5462    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
     
    6977  }
    7078  gd_canvas->clear();
    71   mapstorage.clear();
    72   if(mapwinexists)
    73     {
    74       mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     79  mapstorage->clear();
     80  if(mapwinexists)
     81    {
     82      mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
    7583    }
    7684  signal_title.emit("unsaved file");
     
    7987void NoteBookTab::openFile()
    8088{
    81   if (mapstorage.modified)
     89  if (mapstorage->modified)
    8290  {
    8391    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
     
    103111  {
    104112    gd_canvas->clear();
    105     mapstorage.clear();
     113    mapstorage->clear();
    106114    Glib::ustring filename = fcdialog.get_filename();
    107     if (!mapstorage.readFromFile(filename))
    108     {
    109       mapstorage.file_name = filename;
    110       mapstorage.modified = false;
     115    if (!mapstorage->readFromFile(filename))
     116    {
     117      mapstorage->file_name = filename;
     118      mapstorage->modified = false;
    111119      gd_canvas->drawGraph();
    112120      if(mapwinexists)
    113121        {
    114           mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     122          mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
    115123        }
    116124      signal_title.emit(Glib::filename_display_basename(filename));
     
    121129void NoteBookTab::saveFile()
    122130{
    123   if (mapstorage.file_name == "") {
     131  if (mapstorage->file_name == "") {
    124132    saveFileAs();
    125133  }
    126134  else
    127135  {
    128     mapstorage.writeToFile(mapstorage.file_name);
    129     mapstorage.modified = false;
    130     signal_title.emit(Glib::filename_display_basename(mapstorage.file_name));
     136    mapstorage->writeToFile(mapstorage->file_name);
     137    mapstorage->modified = false;
     138    signal_title.emit(Glib::filename_display_basename(mapstorage->file_name));
    131139  }
    132140}
     
    140148  {
    141149    Glib::ustring filename = fcdialog.get_filename();
    142     mapstorage.file_name = filename;
    143     mapstorage.writeToFile(filename);
    144     mapstorage.modified = false;
     150    mapstorage->file_name = filename;
     151    mapstorage->writeToFile(filename);
     152    mapstorage->modified = false;
    145153    signal_title.emit(Glib::filename_display_basename(filename));
    146154  }
     
    149157void NoteBookTab::close()
    150158{
    151   if (mapstorage.modified)
     159  if (mapstorage->modified)
    152160  {
    153161    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
     
    168176  }
    169177  gd_canvas->clear();
    170   mapstorage.clear();
    171   if(mapwinexists)
    172     {
    173       mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
     178  mapstorage->clear();
     179  if(mapwinexists)
     180    {
     181      mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
    174182    }
    175183  signal_title.emit("unsaved file");
     
    178186void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
    179187{
    180   mapstorage.changeActiveMap(itisedge, prop, mapname);
     188  mapstorage->changeActiveMap(itisedge, prop, mapname);
    181189}
    182190
     
    193201std::string NoteBookTab::getActiveEdgeMap(int prop)
    194202{
    195   return mapstorage.getActiveEdgeMap(prop);
     203  return mapstorage->getActiveEdgeMap(prop);
    196204}
    197205
    198206std::string NoteBookTab::getActiveNodeMap(int prop)
    199207{
    200   return mapstorage.getActiveNodeMap(prop);
     208  return mapstorage->getActiveNodeMap(prop);
    201209}
    202210
     
    221229  if(!mapwinexists)
    222230    {
    223       mapwin=new MapWin("Map Setup - "+name, mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
    224       mapst2mapwin=mapstorage.signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
     231      mapwin=new MapWin("Map Setup - "+name, mapstorage->getEdgeMapList(), mapstorage->getNodeMapList(), *this);
     232      mapst2mapwin=mapstorage->signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));
    225233      mapwin->show();
    226234      mapwinexists=true;
     
    245253      double attraction, propulsation;
    246254      int iterations;
    247       mapstorage.get_design_data(attraction, propulsation, iterations);
     255      mapstorage->get_design_data(attraction, propulsation, iterations);
    248256      designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this);
    249257
     
    255263      designwin->signal_delete_event().connect(sigc::mem_fun(*this, &NoteBookTab::closeDesignWin));
    256264
    257       mapst2designwin=mapstorage.signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));
     265      mapst2designwin=mapstorage->signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));
    258266
    259267      designwin->show();
     
    307315void NoteBookTab::active_maps_needed()
    308316{
    309   mapstorage.broadcastActiveMaps();
     317  mapstorage->broadcastActiveMaps();
    310318}
    311319
    312320void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename)
    313321{
    314   mapstorage.exportGraphToEPS(options, filename);
    315 }
     322  mapstorage->exportGraphToEPS(options, filename);
     323}
Note: See TracChangeset for help on using the changeset viewer.