diff --git a/Sources/GuiTools/MainWindows/MainWindows.cpp b/Sources/GuiTools/MainWindows/MainWindows.cpp index 02c4b20..4a03538 100644 --- a/Sources/GuiTools/MainWindows/MainWindows.cpp +++ b/Sources/GuiTools/MainWindows/MainWindows.cpp @@ -175,42 +175,15 @@ void MainWindows::OnMessage(int32_t id, int32_t dataID) } } break; - case EDN_MSG__QUIT: - OnQuit(m_mainWindow, this); - break; } } bool MainWindows::OnQuit(GtkWidget *widget, gpointer data) { - EDN_INFO("quit requested"); - // dlg to confirm the quit event : - GtkWidget *p_dialog = gtk_dialog_new_with_buttons("Exit", - GTK_WINDOW(widget), - GTK_DIALOG_MODAL, - GTK_STOCK_YES, GTK_RESPONSE_YES, - GTK_STOCK_NO, GTK_RESPONSE_NO, - NULL); - GtkWidget *p_label = gtk_label_new ("Do you want exit Edn?"); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area( GTK_DIALOG(p_dialog) )), p_label, TRUE, TRUE, 0); - - gtk_widget_show(p_label); - - switch (gtk_dialog_run (GTK_DIALOG (p_dialog))) - { - case GTK_RESPONSE_YES: - gtk_widget_destroy (p_dialog); - - break; - case GTK_RESPONSE_NO: - gtk_widget_destroy (p_dialog); - // do not close the windows - return true; - break; - } - - gtk_main_quit(); - return false; + //MainWindows * self = reinterpret_cast(data); + GeneralSendMessage(EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION); + // Close is not managed here ... + return true; } @@ -233,31 +206,6 @@ gboolean MainWindows::OnStateChange(GtkWidget *widget, GdkEvent* event, gpointer } } -#if 0 - -void MainWindows::OnMenuAbout(wxCommandEvent & WXUNUSED(event)) -{ - //EDN_INFO("MainWindows::OnMenuAbout (event)"); - wxAboutDialogInfo info; - info.SetName(wxT("edn")); - info.SetVersion(wxT("0.1.0 pre-Beta")); - info.SetDescription(wxT("Editeur De N'ours, l'Editeur Desoxyribo-Nucleique\n" - "Source Code Editor")); - info.SetCopyright(wxT( "Copyright 2010 Edouard DUPIN, all right reserved\n" - "This software is distributed in the hope that it will be useful, but WITHOUT\n" - "ANY WARRANTY\n\n" - "Licence summary : \n" - " You can modify and redistribute the sources code and binaries.\n" - " You can send me the bug-fix\n" - " You can not earn money with this Software (if the source extract from Edn\n" - " represent less than 50% of original Sources)\n" - "Term of the licence in in the file licence.txt")); - wxAboutBox(info); - -} - -#endif - diff --git a/Sources/GuiTools/MainWindows/MenuBar.cpp b/Sources/GuiTools/MainWindows/MenuBar.cpp index dd351e9..2f75cc1 100644 --- a/Sources/GuiTools/MainWindows/MenuBar.cpp +++ b/Sources/GuiTools/MainWindows/MenuBar.cpp @@ -232,7 +232,7 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI) tmp->AddGen(GTK_STOCK_SAVE, "ctrl+s", EDN_MSG__CURRENT_SAVE, true); tmp->AddGen(GTK_STOCK_SAVE_AS, "ctrl+shift+s", EDN_MSG__CURRENT_SAVE_AS, true); tmp->AddSeparator(); - tmp->AddGen(GTK_STOCK_QUIT, "ctrl+shift+q", EDN_MSG__QUIT, true); + tmp->AddGen(GTK_STOCK_QUIT, "ctrl+shift+q", EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION, true); m_listMenu.PushBack(tmp); tmp = new MenuBarMain("_Edit", m_mainWidget); diff --git a/Sources/GuiTools/WindowsManager/WindowsManager.cpp b/Sources/GuiTools/WindowsManager/WindowsManager.cpp index 122f9be..8f71980 100644 --- a/Sources/GuiTools/WindowsManager/WindowsManager.cpp +++ b/Sources/GuiTools/WindowsManager/WindowsManager.cpp @@ -250,5 +250,35 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID) gtk_widget_destroy(myDialog); } break; + case EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION: + { + EDN_INFO("quit requested"); + // dlg to confirm the quit event : + GtkWidget *p_dialog = gtk_dialog_new_with_buttons("Exit", + GTK_WINDOW(m_mainWindow->GetWidget()), + GTK_DIALOG_MODAL, + GTK_STOCK_YES, GTK_RESPONSE_YES, + GTK_STOCK_NO, GTK_RESPONSE_NO, + NULL); + GtkWidget *p_label = gtk_label_new ("Do you want exit Edn ?"); + gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area( GTK_DIALOG(p_dialog) )), p_label, TRUE, TRUE, 0); + + gtk_widget_show(p_label); + + switch (gtk_dialog_run (GTK_DIALOG (p_dialog))) + { + case GTK_RESPONSE_YES: + gtk_widget_destroy (p_dialog); + gtk_main_quit(); + break; + case GTK_RESPONSE_NO: + gtk_widget_destroy (p_dialog); + break; + } + + + } + break; + } } \ No newline at end of file diff --git a/Sources/tools/MsgBroadcast/MsgBroadcast.cpp b/Sources/tools/MsgBroadcast/MsgBroadcast.cpp index 7ca9529..c42399c 100644 --- a/Sources/tools/MsgBroadcast/MsgBroadcast.cpp +++ b/Sources/tools/MsgBroadcast/MsgBroadcast.cpp @@ -79,7 +79,6 @@ static char * GetMessageChar(messageType_te Id) { switch(Id) { - MACRO_DISPLAY_MSG(EDN_MSG__QUIT) MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_CHANGE_CURRENT) MACRO_DISPLAY_MSG(EDN_MSG__USER_DISPLAY_CHANGE) @@ -91,6 +90,7 @@ static char * GetMessageChar(messageType_te Id) MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_SAVE_AS) MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_GOTO_LINE) MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_ABOUT) + MACRO_DISPLAY_MSG(EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION) MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_REMOVE) MACRO_DISPLAY_MSG(EDN_MSG__BUFFER_REMOVE_ALL) diff --git a/Sources/tools/MsgBroadcast/MsgBroadcast.h b/Sources/tools/MsgBroadcast/MsgBroadcast.h index 547a285..8b6408a 100644 --- a/Sources/tools/MsgBroadcast/MsgBroadcast.h +++ b/Sources/tools/MsgBroadcast/MsgBroadcast.h @@ -38,8 +38,6 @@ // the ID we'll use to identify our event typedef enum { EDN_MSG__NONE = 0, - // Programm is Quitting... close all if needed ... - EDN_MSG__QUIT, EDN_MSG__BUFFER_CHANGE_CURRENT, // set the new current BUFFER ... EDN_MSG__USER_DISPLAY_CHANGE, // User change the display ==> need to reload all the display depending on color internal @@ -54,6 +52,7 @@ typedef enum { EDN_MSG__GUI_SHOW_SAVE_AS, EDN_MSG__GUI_SHOW_GOTO_LINE, EDN_MSG__GUI_SHOW_ABOUT, + EDN_MSG__GUI_SHOW_EXIT_CONFIRMATION, MSG_TO_GUI_MANAGER__STOP, // DESTINATION : GUI @@ -202,7 +201,7 @@ class MsgBroadcastCore: public Singleton private: Edn::VectorType m_listMessage; - uint32_t m_messageID; + uint32_t m_messageID; Edn::VectorType m_listOfMessage; };