OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 1 | when search will only display the search index not the translate result |
| 2 | |
| 3 | From: Xiangfu Liu <xiangfu@sharism.cc> |
| 4 | |
| 5 | when press "enter" will goto the translate result text |
| 6 | "esc" will go back or new search |
| 7 | |
| 8 | Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc> |
| 9 | --- |
| 10 | |
| 11 | src/mainwin.cpp | 27 ++++++++++++++++++++------- |
| 12 | src/mainwin.h | 1 + |
| 13 | src/stardict.cpp | 4 ++++ |
| 14 | 3 files changed, 25 insertions(+), 7 deletions(-) |
| 15 | |
| 16 | |
| 17 | diff --git a/src/mainwin.cpp b/src/mainwin.cpp |
| 18 | index ccd5adc..a1d6373 100644 |
| 19 | --- a/src/mainwin.cpp |
| 20 | +++ b/src/mainwin.cpp |
| 21 | @@ -165,8 +165,13 @@ void TopWin::on_entry_changed(GtkEntry *entry, TopWin *oTopWin) |
| 22 | return; |
| 23 | const gchar *sWord = gtk_entry_get_text(entry); |
| 24 | if(sWord[0]!='\0') { |
| 25 | + gtk_widget_show(gpAppFrame->oMidWin.oIndexWin.notebook); |
| 26 | + gtk_widget_hide(gpAppFrame->oMidWin.vbox1); |
| 27 | gpAppFrame->TopWinWordChange(sWord); |
| 28 | } else { |
| 29 | + gtk_widget_hide(gpAppFrame->oMidWin.oIndexWin.notebook); |
| 30 | + gtk_widget_show(gpAppFrame->oMidWin.vbox1); |
| 31 | + |
| 32 | gpAppFrame->oMidWin.oTextWin.queryWord.clear(); |
| 33 | gpAppFrame->oMidWin.oIndexWin.oResultWin.Clear(); |
| 34 | gpAppFrame->oMidWin.oTextWin.ShowTips(); |
| 35 | @@ -581,8 +586,13 @@ void TopWin::SetText(const gchar *word, bool notify) |
| 36 | if (!notify) |
| 37 | return; |
| 38 | if(word[0]!='\0') { |
| 39 | + gtk_widget_show(gpAppFrame->oMidWin.oIndexWin.notebook); |
| 40 | + gtk_widget_hide(gpAppFrame->oMidWin.vbox1); |
| 41 | gpAppFrame->TopWinWordChange(word); |
| 42 | } else { |
| 43 | + gtk_widget_hide(gpAppFrame->oMidWin.oIndexWin.notebook); |
| 44 | + gtk_widget_show(gpAppFrame->oMidWin.vbox1); |
| 45 | + |
| 46 | gpAppFrame->oMidWin.oTextWin.queryWord.clear(); |
| 47 | gpAppFrame->oMidWin.oIndexWin.oResultWin.Clear(); |
| 48 | gpAppFrame->oMidWin.oTextWin.ShowTips(); |
| 49 | @@ -1815,18 +1825,19 @@ void TextWin::ShowTips() |
| 50 | { |
| 51 | query_result = TEXT_WIN_TIPS; |
| 52 | view->set_text( |
| 53 | - _(" Welcome to StarDict!\n\n" |
| 54 | + _(" Please type a word to start searching. \n\n" |
| 55 | + " Welcome to StarDict.\n" |
| 56 | " Press Ctrl+Q to quit. \n" |
| 57 | + " Press Alt+C or ESC to clear the input entry's text.\n" |
| 58 | #ifndef CONFIG_NANONOTE |
| 59 | " Press Alt+Z to iconify the window or Alt+X to hide the window.\n" |
| 60 | -#endif |
| 61 | - " Press Alt+C or ESC to clear the input entry's text.\n" |
| 62 | " Press Space key to move focus to the input entry.\n" |
| 63 | - " If the query word was not found, you can press Tab key to select the first word in the word list.\n" |
| 64 | " After selected some text, clicking the middle mouse button on the main window's Definition area or on the notification area icon will look up that word.\n" |
| 65 | + " When the floating window reports that a word was not found, double clicking will perform a fuzzy query.\n" |
| 66 | +#endif |
| 67 | + " If the query word was not found, you can press Tab key to select the first word in the word list.\n" |
| 68 | " StarDict can match strings against patterns containing '*' (wildcard) and '?' (joker).\n" |
| 69 | - " Input a word beginning with \'/\' to do a Fuzzy query.\n" |
| 70 | - " When the floating window reports that a word was not found, double clicking will perform a fuzzy query.\n") |
| 71 | + " Input a word beginning with \'/\' to do a Fuzzy query.\n") |
| 72 | ); |
| 73 | view->scroll_to(0); |
| 74 | } |
| 75 | @@ -2689,8 +2700,10 @@ void MidWin::Create(GtkWidget *vbox) |
| 76 | oLeftWin.Create(hbox, has_treedict); |
| 77 | gtk_box_pack_start(GTK_BOX(hbox),notebook, true, true, 0); |
| 78 | |
| 79 | - GtkWidget *vbox1 = gtk_vbox_new(FALSE, 0); |
| 80 | + vbox1 = gtk_vbox_new(FALSE, 0); |
| 81 | +#ifndef CONFIG_NANONOTE |
| 82 | gtk_widget_show(vbox1); |
| 83 | +#endif |
| 84 | oToolWin.Create(vbox1); |
| 85 | oTextWin.Create(vbox1); |
| 86 | gtk_paned_pack2(GTK_PANED(hpaned), vbox1, TRUE, FALSE); |
| 87 | diff --git a/src/mainwin.h b/src/mainwin.h |
| 88 | index c3589c6..569c978 100644 |
| 89 | --- a/src/mainwin.h |
| 90 | +++ b/src/mainwin.h |
| 91 | @@ -307,6 +307,7 @@ class MidWin { |
| 92 | public: |
| 93 | GtkWidget* hpaned; |
| 94 | GtkWidget* notebook; |
| 95 | + GtkWidget* vbox1; |
| 96 | |
| 97 | LeftWin oLeftWin; |
| 98 | IndexWin oIndexWin; |
| 99 | diff --git a/src/stardict.cpp b/src/stardict.cpp |
| 100 | index b84f5c5..07cb57a 100644 |
| 101 | --- a/src/stardict.cpp |
| 102 | +++ b/src/stardict.cpp |
| 103 | @@ -425,6 +425,8 @@ void AppCore::Create(gchar *queryword) |
| 104 | } else { |
| 105 | oMidWin.oTextWin.ShowInitFailed(); |
| 106 | } |
| 107 | + gtk_widget_hide(oMidWin.oIndexWin.notebook); |
| 108 | + gtk_widget_show(oMidWin.vbox1); |
| 109 | } |
| 110 | |
| 111 | gboolean AppCore::on_delete_event(GtkWidget * window, GdkEvent *event , AppCore *app) |
| 112 | @@ -588,6 +590,8 @@ gboolean AppCore::vKeyPressReleaseCallback(GtkWidget * window, GdkEventKey *even |
| 113 | gtk_tree_model_get(model, &iter, 0, &word, -1); |
| 114 | oAppCore->ListClick(word); |
| 115 | g_free(word); |
| 116 | + gtk_widget_hide(oAppCore->oMidWin.oIndexWin.notebook); |
| 117 | + gtk_widget_show(oAppCore->oMidWin.vbox1); |
| 118 | /* here to dispaly the result windows */ |
| 119 | } |
| 120 | } |
| 121 |
