EpsWin and DesignWin does not need to know NoteBookTab.
1.1 --- a/design_win.cc Thu Mar 01 08:07:39 2007 +0000
1.2 +++ b/design_win.cc Thu Mar 01 13:33:46 2007 +0000
1.3 @@ -16,7 +16,6 @@
1.4 *
1.5 */
1.6
1.7 -#include <nbtab.h>
1.8 #include <design_win.h>
1.9
1.10 bool DesignWin::closeIfEscapeIsPressed(GdkEventKey* e)
1.11 @@ -28,11 +27,11 @@
1.12 return true;
1.13 }
1.14
1.15 -DesignWin::DesignWin(const std::string& title, double attraction_v, double propulsation_v, int iterations_v, NoteBookTab & mw):mytab(mw)
1.16 +DesignWin::DesignWin(const std::string& title, double attraction_v, double propulsation_v, int iterations_v)
1.17 {
1.18 set_title(title);
1.19
1.20 - mytab.signal_title_ch().connect(sigc::mem_fun(*this, &DesignWin::set_title));
1.21 + //mytab.signal_title_ch().connect(sigc::mem_fun(*this, &DesignWin::set_title));
1.22
1.23 signal_key_press_event().connect(sigc::mem_fun(*this, &DesignWin::closeIfEscapeIsPressed));
1.24
2.1 --- a/design_win.h Thu Mar 01 08:07:39 2007 +0000
2.2 +++ b/design_win.h Thu Mar 01 13:33:46 2007 +0000
2.3 @@ -19,8 +19,6 @@
2.4 #ifndef DESWIN_H
2.5 #define DESWIN_H
2.6
2.7 -class NoteBookTab;
2.8 -
2.9 #include <all_include.h>
2.10 #include <libgnomecanvasmm.h>
2.11 #include <libgnomecanvasmm/polygon.h>
2.12 @@ -28,9 +26,6 @@
2.13 class DesignWin : public Gtk::Window
2.14 {
2.15 private:
2.16 - ///\ref NoteBookTab to that the \ref MapWin belongs to.
2.17 - NoteBookTab & mytab;
2.18 -
2.19 Gtk::SpinButton * attraction;
2.20 Gtk::SpinButton * propulsation;
2.21 Gtk::SpinButton * iteration;
2.22 @@ -54,7 +49,7 @@
2.23 ///Constructor
2.24
2.25 ///It builds the window.
2.26 - DesignWin(const std::string&, double, double, int, NoteBookTab & mw);
2.27 + DesignWin(const std::string&, double, double, int);
2.28
2.29 sigc::signal<void, double> signal_attraction(){return signal_attraction_ch;};
2.30 sigc::signal<void, double> signal_propulsation(){return signal_propulsation_ch;};
3.1 --- a/eps_win.cc Thu Mar 01 08:07:39 2007 +0000
3.2 +++ b/eps_win.cc Thu Mar 01 13:33:46 2007 +0000
3.3 @@ -16,7 +16,6 @@
3.4 *
3.5 */
3.6
3.7 -#include <nbtab.h>
3.8 #include <eps_win.h>
3.9 #include <set>
3.10
3.11 @@ -29,7 +28,7 @@
3.12 return true;
3.13 }
3.14
3.15 -EpsWin::EpsWin(const std::string& title, NoteBookTab & mw):Gtk::Dialog(title, true, true),mytab(mw)
3.16 +EpsWin::EpsWin(const std::string& title):Gtk::Dialog(title, true, true)
3.17 {
3.18 set_default_size(200, 50);
3.19
3.20 @@ -37,8 +36,6 @@
3.21
3.22 signal_key_press_event().connect(sigc::mem_fun(*this, &EpsWin::closeIfEscapeIsPressed));
3.23
3.24 - mytab.signal_title_ch().connect(sigc::mem_fun(*this, &EpsWin::set_title));
3.25 -
3.26 table=new Gtk::Table(EPS_PROPERTY_NUM, 1, false);
3.27
3.28 std::vector<std::string> labels;
3.29 @@ -76,7 +73,7 @@
3.30 bool EpsWin::on_delete_event(GdkEventAny * event)
3.31 {
3.32 event=event;
3.33 - mytab.closeEpsWin();
3.34 + signal_eps_close.emit();
3.35 return true;
3.36 }
3.37
3.38 @@ -90,7 +87,7 @@
3.39 {
3.40 values[i]=options[i]->get_active();
3.41 }
3.42 - mytab.exportGraphToEPS(values, name.get_text());
3.43 + signal_eps_details.emit(values, name.get_text());
3.44 }
3.45 on_delete_event(NULL);
3.46 }
4.1 --- a/eps_win.h Thu Mar 01 08:07:39 2007 +0000
4.2 +++ b/eps_win.h Thu Mar 01 13:33:46 2007 +0000
4.3 @@ -19,8 +19,6 @@
4.4 #ifndef EPS_WIN_H
4.5 #define EPS_WIN_H
4.6
4.7 -class NoteBookTab;
4.8 -
4.9 #include <all_include.h>
4.10 #include <libgnomecanvasmm.h>
4.11 #include <libgnomecanvasmm/polygon.h>
4.12 @@ -33,9 +31,6 @@
4.13 class EpsWin : public Gtk::Dialog
4.14 {
4.15 protected:
4.16 - ///\ref NoteBookTab to that the \ref EpsWin belongs to.
4.17 - NoteBookTab & mytab;
4.18 -
4.19 ///Designing element
4.20 Gtk::Table * table;
4.21
4.22 @@ -63,7 +58,7 @@
4.23 ///\param eml edgemap list
4.24 ///\param nml nodemap list
4.25 ///\param mw the owner \ref NoteBookTab (\ref mytab)
4.26 - EpsWin(const std::string& title, NoteBookTab & mw);
4.27 + EpsWin(const std::string& title);
4.28
4.29 ///Deregistrates \ref EpsWin in its \ref NoteBookTab (\ref mytab)
4.30 virtual bool on_delete_event(GdkEventAny *);
4.31 @@ -79,6 +74,19 @@
4.32 ///to create EPS
4.33 virtual void on_response(int response_id);
4.34
4.35 + ///indicates that user is ready to export EPS file
4.36 + sigc::signal<void, std::vector<bool>, std::string > signal_eps_details;
4.37 +
4.38 + ///returns \ref signal_eps_details
4.39 + sigc::signal<void, std::vector<bool>, std::string > signal_eps_details_ch(){return signal_eps_details;};
4.40 +
4.41 + ///indicates that the windows can be closed
4.42 + sigc::signal<void> signal_eps_close;
4.43 +
4.44 + ///returns \ref signal_eps_close
4.45 + sigc::signal<void> signal_eps_close_ch(){return signal_eps_close;};
4.46 +
4.47 +
4.48 };
4.49
4.50 #endif //EPS_WIN_H
5.1 --- a/nbtab.cc Thu Mar 01 08:07:39 2007 +0000
5.2 +++ b/nbtab.cc Thu Mar 01 13:33:46 2007 +0000
5.3 @@ -53,7 +53,7 @@
5.4 {
5.5 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
5.6 }
5.7 - signal_title.emit(Glib::filename_display_basename(file));
5.8 + title_changed(Glib::filename_display_basename(file));
5.9 }
5.10
5.11 void NoteBookTab::newFile()
5.12 @@ -82,7 +82,7 @@
5.13 {
5.14 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
5.15 }
5.16 - signal_title.emit("unsaved file");
5.17 + title_changed("unsaved file");
5.18 }
5.19
5.20 void NoteBookTab::openFile()
5.21 @@ -122,7 +122,7 @@
5.22 {
5.23 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
5.24 }
5.25 - signal_title.emit(Glib::filename_display_basename(filename));
5.26 + title_changed(Glib::filename_display_basename(filename));
5.27 }
5.28 }
5.29 }
5.30 @@ -136,7 +136,7 @@
5.31 {
5.32 mapstorage->writeToFile(mapstorage->file_name);
5.33 mapstorage->modified = false;
5.34 - signal_title.emit(Glib::filename_display_basename(mapstorage->file_name));
5.35 + title_changed(Glib::filename_display_basename(mapstorage->file_name));
5.36 }
5.37 }
5.38
5.39 @@ -151,7 +151,7 @@
5.40 mapstorage->file_name = filename;
5.41 mapstorage->writeToFile(filename);
5.42 mapstorage->modified = false;
5.43 - signal_title.emit(Glib::filename_display_basename(filename));
5.44 + title_changed(Glib::filename_display_basename(filename));
5.45 }
5.46 }
5.47
5.48 @@ -181,7 +181,7 @@
5.49 {
5.50 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList());
5.51 }
5.52 - signal_title.emit("unsaved file");
5.53 + title_changed("unsaved file");
5.54 }
5.55
5.56 void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
5.57 @@ -240,9 +240,11 @@
5.58 {
5.59 if(!epswinexists)
5.60 {
5.61 - epswin=new EpsWin("Export to EPS - "+name, *this);
5.62 + epswin=new EpsWin("Export to EPS - "+name);
5.63 epswin->show();
5.64 epswinexists=true;
5.65 + epswin->signal_eps_details_ch().connect(sigc::mem_fun(*this, &NoteBookTab::exportGraphToEPS));
5.66 + epswin->signal_eps_close_ch().connect(sigc::mem_fun(*this, &NoteBookTab::closeEpsWin));
5.67 }
5.68 }
5.69
5.70 @@ -254,7 +256,7 @@
5.71 double attraction, propulsation;
5.72 int iterations;
5.73 mapstorage->get_design_data(attraction, propulsation, iterations);
5.74 - designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this);
5.75 + designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations);
5.76
5.77 designwin->signal_attraction().connect(sigc::mem_fun(mapstorage, &MapStorage::set_attraction));
5.78 designwin->signal_propulsation().connect(sigc::mem_fun(mapstorage, &MapStorage::set_propulsation));
5.79 @@ -322,3 +324,16 @@
5.80 {
5.81 mapstorage->exportGraphToEPS(options, filename);
5.82 }
5.83 +
5.84 +void NoteBookTab::title_changed(std::string newtitle)
5.85 +{
5.86 + signal_title.emit(newtitle);
5.87 + if(epswinexists)
5.88 + {
5.89 + epswin->set_title(newtitle);
5.90 + }
5.91 + if(designwinexists)
5.92 + {
5.93 + designwin->set_title(newtitle);
5.94 + }
5.95 +}
6.1 --- a/nbtab.h Thu Mar 01 08:07:39 2007 +0000
6.2 +++ b/nbtab.h Thu Mar 01 13:33:46 2007 +0000
6.3 @@ -234,6 +234,9 @@
6.4 void active_maps_needed();
6.5
6.6 private:
6.7 + ///Called when title of tab has changed
6.8 + void title_changed(std::string);
6.9 +
6.10 ///Signal connection from \ref MapStorage to \ref MapWin
6.11
6.12 ///If \ref MapWin is closed this connection has to be disconnected,