Configure option to set lemon prefix.
3 NoteBookTab::NoteBookTab():mapwinexists(false)
5 Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow);
6 gd_canvas=new GraphDisplayerCanvas(*this);
7 pScrolledWindow->add(*gd_canvas);
10 //connecting signals - controller character
11 mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
12 mapstorage.signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));
13 mapstorage.signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));
18 void NoteBookTab::readFile(const std::string &file)
20 mapstorage.readFromFile(file);
21 mapstorage.file_name = file;
22 mapstorage.modified = false;
23 gd_canvas->drawGraph();
26 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
28 signal_title.emit(Glib::filename_display_basename(file));
31 void NoteBookTab::newFile()
33 if (mapstorage.modified)
35 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
36 Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
37 mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
38 mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
39 mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
40 switch (mdialog.run())
42 case Gtk::RESPONSE_CANCEL:
44 case Gtk::RESPONSE_REJECT:
46 case Gtk::RESPONSE_ACCEPT:
55 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
57 signal_title.emit("unsaved file");
60 void NoteBookTab::openFile()
62 if (mapstorage.modified)
64 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
65 Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
66 mdialog.add_button("Close file _without Saving", Gtk::RESPONSE_REJECT);
67 mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
68 mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
69 switch (mdialog.run())
71 case Gtk::RESPONSE_CANCEL:
73 case Gtk::RESPONSE_REJECT:
75 case Gtk::RESPONSE_ACCEPT:
80 Gtk::FileChooserDialog fcdialog("Open File");
81 fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
82 fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
83 if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
87 Glib::ustring filename = fcdialog.get_filename();
88 if (!mapstorage.readFromFile(filename))
90 mapstorage.file_name = filename;
91 mapstorage.modified = false;
92 gd_canvas->drawGraph();
95 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
97 signal_title.emit(Glib::filename_display_basename(filename));
102 void NoteBookTab::saveFile()
104 if (mapstorage.file_name == "") {
109 mapstorage.writeToFile(mapstorage.file_name);
110 mapstorage.modified = false;
111 signal_title.emit(Glib::filename_display_basename(mapstorage.file_name));
115 void NoteBookTab::saveFileAs()
117 Gtk::FileChooserDialog fcdialog("Save File", Gtk::FILE_CHOOSER_ACTION_SAVE);
118 fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
119 fcdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
120 if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
122 Glib::ustring filename = fcdialog.get_filename();
123 mapstorage.file_name = filename;
124 mapstorage.writeToFile(filename);
125 mapstorage.modified = false;
126 signal_title.emit(Glib::filename_display_basename(filename));
130 void NoteBookTab::close()
132 if (mapstorage.modified)
134 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
135 Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
136 mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
137 mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
138 mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
139 switch (mdialog.run())
141 case Gtk::RESPONSE_CANCEL:
143 case Gtk::RESPONSE_REJECT:
145 case Gtk::RESPONSE_ACCEPT:
154 mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
156 signal_title.emit("unsaved file");
159 void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
161 mapstorage.changeActiveMap(itisedge, prop, mapname);
164 sigc::signal<void, NoteBookTab *, bool> NoteBookTab::signal_newmap_needed()
166 return signal_newmap;
169 void NoteBookTab::popupNewMapWin(bool itisedge)
171 signal_newmap.emit(this, itisedge);
174 std::string NoteBookTab::getActiveEdgeMap(int prop)
176 return mapstorage.getActiveEdgeMap(prop);
179 std::string NoteBookTab::getActiveNodeMap(int prop)
181 return mapstorage.getActiveNodeMap(prop);
184 void NoteBookTab::registerNewEdgeMap(std::string mapname)
188 mapwin->registerNewEdgeMap(mapname);
192 void NoteBookTab::registerNewNodeMap(std::string mapname)
196 mapwin->registerNewNodeMap(mapname);
200 void NoteBookTab::createMapWin(std::string name)
204 mapwin=new MapWin("Map Setup - "+name, mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
210 void NoteBookTab::closeMapWin()
216 sigc::signal<void, std::string> NoteBookTab::signal_title_ch()
221 void NoteBookTab::setView(bool autoscale, bool zoomtrack, double width, double radius)
223 gd_canvas->setView(autoscale, zoomtrack, width, radius);
226 void NoteBookTab::getView(bool & autoscale, bool & zoomtrack, double& width, double& radius)
228 gd_canvas->getView(autoscale, zoomtrack, width, radius);