X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/33a5f978014e65a402a3d376c7e47bd8ee8ab8ab..44617167ac216781537290dce9cc097df89dc3d2:/Constructor/src/constructor.cpp?ds=sidebyside diff --git a/Constructor/src/constructor.cpp b/Constructor/src/constructor.cpp index facfd8d..86e8842 100644 --- a/Constructor/src/constructor.cpp +++ b/Constructor/src/constructor.cpp @@ -1,4 +1,5 @@ #include "constructor.h" +#include Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtr& refGlade):Gtk::Window(cobject) { @@ -22,7 +23,15 @@ Constructor::Constructor(BaseObjectType* cobject, const Glib::RefPtrset_text(Glib::locale_to_utf8(s)); + 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); @@ -70,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 @@ -112,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)); @@ -207,14 +221,35 @@ 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(); +} +bool Constructor::on_delete_event(GdkEventAny *e) +{ + std::cout<<"terminando constructor"<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() {