X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/4ddd90e71988f16c5ea79f5de86a9fcb63973ded..025f50123cb4ffad9847ea588967314e6aec0567:/Constructor/src/constructor.cpp?ds=inline diff --git a/Constructor/src/constructor.cpp b/Constructor/src/constructor.cpp index acf5bc1..cefdbdd 100644 --- a/Constructor/src/constructor.cpp +++ b/Constructor/src/constructor.cpp @@ -1,10 +1,41 @@ #include "constructor.h" +#include Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtr& refGlade):Gtk::Window(cobject) { id = 0; saved = false; set_title("Constructor"); + Gtk::Label *lbl_plaqui_version; + Gtk::Image *plaqui_logo; + Gtk::MenuItem *mnu_about; + Gtk::Button *close_about; + + plaqui_logo = 0; + lbl_plaqui_version = 0; + refGlade->get_widget("lbl_plaqui_version", lbl_plaqui_version); + refGlade->get_widget("plaqui_logo", plaqui_logo); + plaqui_logo->set(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/logo.png"); + + refGlade->get_widget("plaqui_logo", plaqui_logo); + // Calculo número de revisión. + std::string rev = "$Rev$"; + rev = rev.substr(6, rev.length() - 8); + std::string s = "PlaQui Constructor versión " VERSION " (revisión "; + s += rev + ")"; + try { + lbl_plaqui_version->set_text(Glib::locale_to_utf8(s)); + } + catch (Glib::ConvertError e) { + lbl_plaqui_version->set_text("PlaQui Constructor"); + } + catch (...) { + lbl_plaqui_version->set_text("PlaQui Constructor"); + } + + refGlade->get_widget("dlgAbout", dlg_about); + refGlade->get_widget("close_about", close_about); + refGlade->get_widget("mnu_about", mnu_about); // Cargo todas las imagenes de los iconos de los botones ico_canio = Gdk::Pixbuf::create_from_file(PACKAGE_DATA_DIR"/plaqui-constructor/pixmaps/canio_n.png"); @@ -48,6 +79,9 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtrget_widget("edit_menu_delete_all", edit_menu_delete_all); refGlade->get_widget("btn_find", btn_find); refGlade->get_widget("status_bar", status_bar); + refGlade->get_widget("dlg_quit", dlg_quit); + refGlade->get_widget("btn_dlg_quit_ok", btn_dlg_quit_ok); + refGlade->get_widget("btn_dlg_quit_cancel", btn_dlg_quit_cancel); //Obtengo el area de trabajo, la cual tiene definida su propia clase. refGlade->get_widget_derived("workplace", workplace); //fixed @@ -59,6 +93,8 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtrsignal_activate().connect( SigC::slot(*dlg_about, &Gtk::Widget::show) ); + close_about->signal_clicked().connect( SigC::slot(*dlg_about, &Gtk::Widget::hide) ); btn_canio->drag_source_set(listTargets); btn_y->drag_source_set(listTargets); btn_codo->drag_source_set(listTargets); @@ -88,6 +124,8 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtrsignal_clicked().connect(SigC::slot(*this, &Constructor::on_quick_btn_new_clicked)); quick_btn_save->signal_clicked().connect(SigC::slot(*this, &Constructor::on_quick_btn_save_clicked)); quick_btn_open->signal_clicked().connect(SigC::slot(*this, &Constructor::on_main_menu_open)); + btn_dlg_quit_ok->signal_clicked().connect(SigC::slot(*this, &Constructor::on_btn_dlg_quit_ok_clicked)); + btn_dlg_quit_cancel->signal_clicked().connect(SigC::slot(*this, &Constructor::on_btn_dlg_quit_cancel_clicked)); main_menu_quit->signal_activate().connect(SigC::slot(*this, &Constructor::on_main_menu_quit)); main_menu_new->signal_activate().connect(SigC::slot(*this, &Constructor::on_quick_btn_new_clicked)); @@ -183,14 +221,30 @@ void Constructor::on_btn_not_drag_get(const Glib::RefPtr& cont gtk_selection_data_set(selection_data, selection_data->target, 8,(const guchar*)"not_e.png",9); } -//Sale del programa. +//Sale del programa. Pregunta si desea salvar antes de salir. void Constructor::on_main_menu_quit() { - delete this; + if ( !saved ) + dlg_quit->show(); + else + Gtk::Main::quit(); +} + +//Sale del programa guardando el archivo. +void Constructor::on_btn_dlg_quit_ok_clicked() +{ + dlg_quit->hide(); + on_quick_btn_save_clicked(); +} + +//Sale del programa sin guardar el archivo. +void Constructor::on_btn_dlg_quit_cancel_clicked() +{ + dlg_quit->hide(); Gtk::Main::quit(); - //hide(); } + // Carga de un archivo XML void Constructor::on_main_menu_open() {