Changeset 194:6b2b718420eb in glemon-0.x for nbtab.cc
- Timestamp:
- 02/28/07 19:20:28 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3205
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nbtab.cc
r191 r194 18 18 19 19 #include <nbtab.h> 20 #include <mapstorage.h> 20 21 #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 28 NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false) 29 { 30 mapstorage=new MapStorage(*this); 31 24 32 Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow); 25 33 gd_canvas=new GraphDisplayerCanvas(*this); … … 28 36 29 37 //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)); 33 41 show_all_children(); 34 42 show(); … … 37 45 void NoteBookTab::readFile(const std::string &file) 38 46 { 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; 42 50 gd_canvas->drawGraph(); 43 51 if(mapwinexists) 44 52 { 45 mapwin->update(mapstorage .getEdgeMapList(), mapstorage.getNodeMapList());53 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); 46 54 } 47 55 signal_title.emit(Glib::filename_display_basename(file)); … … 50 58 void NoteBookTab::newFile() 51 59 { 52 if (mapstorage .modified)60 if (mapstorage->modified) 53 61 { 54 62 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, … … 69 77 } 70 78 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()); 75 83 } 76 84 signal_title.emit("unsaved file"); … … 79 87 void NoteBookTab::openFile() 80 88 { 81 if (mapstorage .modified)89 if (mapstorage->modified) 82 90 { 83 91 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, … … 103 111 { 104 112 gd_canvas->clear(); 105 mapstorage .clear();113 mapstorage->clear(); 106 114 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; 111 119 gd_canvas->drawGraph(); 112 120 if(mapwinexists) 113 121 { 114 mapwin->update(mapstorage .getEdgeMapList(), mapstorage.getNodeMapList());122 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); 115 123 } 116 124 signal_title.emit(Glib::filename_display_basename(filename)); … … 121 129 void NoteBookTab::saveFile() 122 130 { 123 if (mapstorage .file_name == "") {131 if (mapstorage->file_name == "") { 124 132 saveFileAs(); 125 133 } 126 134 else 127 135 { 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)); 131 139 } 132 140 } … … 140 148 { 141 149 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; 145 153 signal_title.emit(Glib::filename_display_basename(filename)); 146 154 } … … 149 157 void NoteBookTab::close() 150 158 { 151 if (mapstorage .modified)159 if (mapstorage->modified) 152 160 { 153 161 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, … … 168 176 } 169 177 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()); 174 182 } 175 183 signal_title.emit("unsaved file"); … … 178 186 void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname) 179 187 { 180 mapstorage .changeActiveMap(itisedge, prop, mapname);188 mapstorage->changeActiveMap(itisedge, prop, mapname); 181 189 } 182 190 … … 193 201 std::string NoteBookTab::getActiveEdgeMap(int prop) 194 202 { 195 return mapstorage .getActiveEdgeMap(prop);203 return mapstorage->getActiveEdgeMap(prop); 196 204 } 197 205 198 206 std::string NoteBookTab::getActiveNodeMap(int prop) 199 207 { 200 return mapstorage .getActiveNodeMap(prop);208 return mapstorage->getActiveNodeMap(prop); 201 209 } 202 210 … … 221 229 if(!mapwinexists) 222 230 { 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)); 225 233 mapwin->show(); 226 234 mapwinexists=true; … … 245 253 double attraction, propulsation; 246 254 int iterations; 247 mapstorage .get_design_data(attraction, propulsation, iterations);255 mapstorage->get_design_data(attraction, propulsation, iterations); 248 256 designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this); 249 257 … … 255 263 designwin->signal_delete_event().connect(sigc::mem_fun(*this, &NoteBookTab::closeDesignWin)); 256 264 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)); 258 266 259 267 designwin->show(); … … 307 315 void NoteBookTab::active_maps_needed() 308 316 { 309 mapstorage .broadcastActiveMaps();317 mapstorage->broadcastActiveMaps(); 310 318 } 311 319 312 320 void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename) 313 321 { 314 mapstorage .exportGraphToEPS(options, filename);315 } 322 mapstorage->exportGraphToEPS(options, filename); 323 }
Note: See TracChangeset
for help on using the changeset viewer.