# HG changeset patch # User hegyi # Date 1172756026 0 # Node ID c220f9de654559313bf93a08a3bc9fe571c7f343 # Parent 125c56c1efda10492a115c51813fce4433ce7fb4 EpsWin and DesignWin does not need to know NoteBookTab. diff -r 125c56c1efda -r c220f9de6545 design_win.cc --- a/design_win.cc Thu Mar 01 08:07:39 2007 +0000 +++ b/design_win.cc Thu Mar 01 13:33:46 2007 +0000 @@ -16,7 +16,6 @@ * */ -#include #include bool DesignWin::closeIfEscapeIsPressed(GdkEventKey* e) @@ -28,11 +27,11 @@ return true; } -DesignWin::DesignWin(const std::string& title, double attraction_v, double propulsation_v, int iterations_v, NoteBookTab & mw):mytab(mw) +DesignWin::DesignWin(const std::string& title, double attraction_v, double propulsation_v, int iterations_v) { set_title(title); - mytab.signal_title_ch().connect(sigc::mem_fun(*this, &DesignWin::set_title)); + //mytab.signal_title_ch().connect(sigc::mem_fun(*this, &DesignWin::set_title)); signal_key_press_event().connect(sigc::mem_fun(*this, &DesignWin::closeIfEscapeIsPressed)); diff -r 125c56c1efda -r c220f9de6545 design_win.h --- a/design_win.h Thu Mar 01 08:07:39 2007 +0000 +++ b/design_win.h Thu Mar 01 13:33:46 2007 +0000 @@ -19,8 +19,6 @@ #ifndef DESWIN_H #define DESWIN_H -class NoteBookTab; - #include #include #include @@ -28,9 +26,6 @@ class DesignWin : public Gtk::Window { private: - ///\ref NoteBookTab to that the \ref MapWin belongs to. - NoteBookTab & mytab; - Gtk::SpinButton * attraction; Gtk::SpinButton * propulsation; Gtk::SpinButton * iteration; @@ -54,7 +49,7 @@ ///Constructor ///It builds the window. - DesignWin(const std::string&, double, double, int, NoteBookTab & mw); + DesignWin(const std::string&, double, double, int); sigc::signal signal_attraction(){return signal_attraction_ch;}; sigc::signal signal_propulsation(){return signal_propulsation_ch;}; diff -r 125c56c1efda -r c220f9de6545 eps_win.cc --- a/eps_win.cc Thu Mar 01 08:07:39 2007 +0000 +++ b/eps_win.cc Thu Mar 01 13:33:46 2007 +0000 @@ -16,7 +16,6 @@ * */ -#include #include #include @@ -29,7 +28,7 @@ return true; } -EpsWin::EpsWin(const std::string& title, NoteBookTab & mw):Gtk::Dialog(title, true, true),mytab(mw) +EpsWin::EpsWin(const std::string& title):Gtk::Dialog(title, true, true) { set_default_size(200, 50); @@ -37,8 +36,6 @@ signal_key_press_event().connect(sigc::mem_fun(*this, &EpsWin::closeIfEscapeIsPressed)); - mytab.signal_title_ch().connect(sigc::mem_fun(*this, &EpsWin::set_title)); - table=new Gtk::Table(EPS_PROPERTY_NUM, 1, false); std::vector labels; @@ -76,7 +73,7 @@ bool EpsWin::on_delete_event(GdkEventAny * event) { event=event; - mytab.closeEpsWin(); + signal_eps_close.emit(); return true; } @@ -90,7 +87,7 @@ { values[i]=options[i]->get_active(); } - mytab.exportGraphToEPS(values, name.get_text()); + signal_eps_details.emit(values, name.get_text()); } on_delete_event(NULL); } diff -r 125c56c1efda -r c220f9de6545 eps_win.h --- a/eps_win.h Thu Mar 01 08:07:39 2007 +0000 +++ b/eps_win.h Thu Mar 01 13:33:46 2007 +0000 @@ -19,8 +19,6 @@ #ifndef EPS_WIN_H #define EPS_WIN_H -class NoteBookTab; - #include #include #include @@ -33,9 +31,6 @@ class EpsWin : public Gtk::Dialog { protected: - ///\ref NoteBookTab to that the \ref EpsWin belongs to. - NoteBookTab & mytab; - ///Designing element Gtk::Table * table; @@ -63,7 +58,7 @@ ///\param eml edgemap list ///\param nml nodemap list ///\param mw the owner \ref NoteBookTab (\ref mytab) - EpsWin(const std::string& title, NoteBookTab & mw); + EpsWin(const std::string& title); ///Deregistrates \ref EpsWin in its \ref NoteBookTab (\ref mytab) virtual bool on_delete_event(GdkEventAny *); @@ -79,6 +74,19 @@ ///to create EPS virtual void on_response(int response_id); + ///indicates that user is ready to export EPS file + sigc::signal, std::string > signal_eps_details; + + ///returns \ref signal_eps_details + sigc::signal, std::string > signal_eps_details_ch(){return signal_eps_details;}; + + ///indicates that the windows can be closed + sigc::signal signal_eps_close; + + ///returns \ref signal_eps_close + sigc::signal signal_eps_close_ch(){return signal_eps_close;}; + + }; #endif //EPS_WIN_H diff -r 125c56c1efda -r c220f9de6545 nbtab.cc --- a/nbtab.cc Thu Mar 01 08:07:39 2007 +0000 +++ b/nbtab.cc Thu Mar 01 13:33:46 2007 +0000 @@ -53,7 +53,7 @@ { mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); } - signal_title.emit(Glib::filename_display_basename(file)); + title_changed(Glib::filename_display_basename(file)); } void NoteBookTab::newFile() @@ -82,7 +82,7 @@ { mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); } - signal_title.emit("unsaved file"); + title_changed("unsaved file"); } void NoteBookTab::openFile() @@ -122,7 +122,7 @@ { mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); } - signal_title.emit(Glib::filename_display_basename(filename)); + title_changed(Glib::filename_display_basename(filename)); } } } @@ -136,7 +136,7 @@ { mapstorage->writeToFile(mapstorage->file_name); mapstorage->modified = false; - signal_title.emit(Glib::filename_display_basename(mapstorage->file_name)); + title_changed(Glib::filename_display_basename(mapstorage->file_name)); } } @@ -151,7 +151,7 @@ mapstorage->file_name = filename; mapstorage->writeToFile(filename); mapstorage->modified = false; - signal_title.emit(Glib::filename_display_basename(filename)); + title_changed(Glib::filename_display_basename(filename)); } } @@ -181,7 +181,7 @@ { mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); } - signal_title.emit("unsaved file"); + title_changed("unsaved file"); } void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname) @@ -240,9 +240,11 @@ { if(!epswinexists) { - epswin=new EpsWin("Export to EPS - "+name, *this); + epswin=new EpsWin("Export to EPS - "+name); epswin->show(); epswinexists=true; + epswin->signal_eps_details_ch().connect(sigc::mem_fun(*this, &NoteBookTab::exportGraphToEPS)); + epswin->signal_eps_close_ch().connect(sigc::mem_fun(*this, &NoteBookTab::closeEpsWin)); } } @@ -254,7 +256,7 @@ double attraction, propulsation; int iterations; mapstorage->get_design_data(attraction, propulsation, iterations); - designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this); + designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations); designwin->signal_attraction().connect(sigc::mem_fun(mapstorage, &MapStorage::set_attraction)); designwin->signal_propulsation().connect(sigc::mem_fun(mapstorage, &MapStorage::set_propulsation)); @@ -322,3 +324,16 @@ { mapstorage->exportGraphToEPS(options, filename); } + +void NoteBookTab::title_changed(std::string newtitle) +{ + signal_title.emit(newtitle); + if(epswinexists) + { + epswin->set_title(newtitle); + } + if(designwinexists) + { + designwin->set_title(newtitle); + } +} diff -r 125c56c1efda -r c220f9de6545 nbtab.h --- a/nbtab.h Thu Mar 01 08:07:39 2007 +0000 +++ b/nbtab.h Thu Mar 01 13:33:46 2007 +0000 @@ -234,6 +234,9 @@ void active_maps_needed(); private: + ///Called when title of tab has changed + void title_changed(std::string); + ///Signal connection from \ref MapStorage to \ref MapWin ///If \ref MapWin is closed this connection has to be disconnected,