From 896beaa4fdd58c658a69b8be0213064224eb32e3 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Mon, 1 Aug 2011 10:01:26 +0200 Subject: [PATCH] Add the goto line number dialogue --- Sources/GuiTools/MainWindows/MenuBar.cpp | 2 + .../WindowsManager/WindowsManager.cpp | 42 ++++++++++++++++++- avancement.boo | 1 - 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Sources/GuiTools/MainWindows/MenuBar.cpp b/Sources/GuiTools/MainWindows/MenuBar.cpp index 4ff9db5..c20f3a8 100644 --- a/Sources/GuiTools/MainWindows/MenuBar.cpp +++ b/Sources/GuiTools/MainWindows/MenuBar.cpp @@ -224,6 +224,8 @@ MenuBar::MenuBar(void) : MsgBroadcast("Menu bar", EDN_CAT_GUI) tmp->AddSeparator(); tmp->AddGen(GTK_STOCK_SELECT_ALL, "ctrl+a", EDN_MSG__CURRENT_SELECT_ALL, true); tmp->AddGen("Unselect", "ctrl+shift+a", EDN_MSG__CURRENT_UN_SELECT, true); + tmp->AddSeparator(); + tmp->AddGen("Goto Line number ...", "ctrl+l", EDN_MSG__GUI_SHOW_GOTO_LINE, true); // tmp->AddSeparator(); // tmp->AddGen(GTK_STOCK_PREFERENCES, NULL, EDN_MSG__GUI_SHOW_PREFERENCE, true); m_listMenu.PushBack(tmp); diff --git a/Sources/GuiTools/WindowsManager/WindowsManager.cpp b/Sources/GuiTools/WindowsManager/WindowsManager.cpp index b6f6251..20a867c 100644 --- a/Sources/GuiTools/WindowsManager/WindowsManager.cpp +++ b/Sources/GuiTools/WindowsManager/WindowsManager.cpp @@ -156,7 +156,7 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID) case EDN_MSG__GUI_SHOW_ABOUT: { // dlg to confirm the quit event : - GtkWidget *myDialog = gtk_dialog_new_with_buttons("About", + GtkWidget *myDialog = gtk_dialog_new_with_buttons("Goto Line", NULL, GTK_DIALOG_MODAL, GTK_STOCK_QUIT, GTK_RESPONSE_NO, @@ -203,6 +203,44 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID) } } break; - + case EDN_MSG__GUI_SHOW_GOTO_LINE: + { + // dlg to confirm the quit event : + GtkWidget *myDialog = gtk_dialog_new_with_buttons("About", + GTK_WINDOW(m_mainWindow->GetWidget()), + GTK_DIALOG_MODAL, + "Jump", GTK_RESPONSE_YES, + GTK_STOCK_QUIT, GTK_RESPONSE_NO, + NULL); + // Set over main windows + gtk_window_set_transient_for(GTK_WINDOW(myDialog), GTK_WINDOW(m_mainWindow->GetWidget())); + // add writting area + GtkWidget *myContentArea = gtk_dialog_get_content_area( GTK_DIALOG(myDialog)); + GtkWidget *myEntry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(myContentArea), myEntry, TRUE, TRUE, 0); + // Display it + gtk_widget_show_all(myContentArea); + int32_t result = gtk_dialog_run (GTK_DIALOG (myDialog)); + // Get data from the gtk entry + const char *myData = gtk_entry_get_text(GTK_ENTRY(myEntry)); + if (NULL != myData) { + int32_t lineID=0; + if (1==sscanf(myData, "%d",&lineID)) { + EDN_DEBUG("find in : \"" << myData << "\" = " << lineID); + if(GTK_RESPONSE_YES == result) { + SendMessage(EDN_MSG__CURRENT_GOTO_LINE, lineID-1); + } + } else { + if (GTK_RESPONSE_YES == result) { + EDN_WARNING("find in : \"" << myData << "\" line Number is not correct "); + } + } + } else { + EDN_DEBUG("no line Writen ..."); + } + // Remove dialogue + gtk_widget_destroy(myDialog); + } + break; } } \ No newline at end of file diff --git a/avancement.boo b/avancement.boo index 3348eb5..5af232c 100644 --- a/avancement.boo +++ b/avancement.boo @@ -31,7 +31,6 @@ * matlab * java script * SQL - * Assembleur - project : list of current files open - gui : demander l'enregistrement avant de fermer (quand c'est nécessaire) - gui : demande de création de nouveaux fichier ou quiter l'editeur ...