1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-12-22 12:46:27 +02:00

[stardict] remove-useless-buttions and splie-window patch

This commit is contained in:
Xiangfu Liu 2010-03-10 21:03:41 +08:00
parent 37e61cc824
commit 985540c7c7
2 changed files with 271 additions and 0 deletions

View File

@ -0,0 +1,205 @@
remove useless buttons
From: Xiangfu Liu <xiangfu@sharism.cc>
Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
---
src/mainwin.cpp | 47 ++++++++++++++++++++++++++---------------------
src/stardict.cpp | 5 +++--
2 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/src/mainwin.cpp b/src/mainwin.cpp
index f7dac0b..0361014 100644
--- a/src/mainwin.cpp
+++ b/src/mainwin.cpp
@@ -79,18 +79,6 @@ void TopWin::Create(GtkWidget *vbox)
gtk_box_pack_start(GTK_BOX(vbox),hbox,false,false,3);
#endif
- GtkWidget *button;
-#ifndef CONFIG_GPE
- button = gtk_button_new_from_stock(GTK_STOCK_CLEAR);
- gtk_widget_show(button);
- gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK(ClearCallback),this);
- g_signal_connect(G_OBJECT(button),"enter_notify_event", G_CALLBACK(stardict_on_enter_notify), NULL);
- gtk_box_pack_start(GTK_BOX(hbox),button,false,false,3);
- gtk_widget_set_tooltip_text(button,_("Clear the search box"));
-#endif
-
GtkListStore* list_store = gtk_list_store_new(1, G_TYPE_STRING);
LoadHistory(list_store);
WordCombo = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(list_store), 0);
@@ -106,7 +94,17 @@ void TopWin::Create(GtkWidget *vbox)
G_CALLBACK (on_entry_activate), this);
gtk_box_pack_start(GTK_BOX(hbox),WordCombo,true,true,3);
-#ifndef CONFIG_GPE
+#if !defined(CONFIG_NANONOTE) && !defined(CONFIG_GPE)
+ GtkWidget *button;
+ button = gtk_button_new_from_stock(GTK_STOCK_CLEAR);
+ gtk_widget_show(button);
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+ GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
+ g_signal_connect(G_OBJECT(button),"clicked", G_CALLBACK(ClearCallback),this);
+ g_signal_connect(G_OBJECT(button),"enter_notify_event", G_CALLBACK(stardict_on_enter_notify), NULL);
+ gtk_box_pack_start(GTK_BOX(hbox),button,false,false,3);
+ gtk_widget_set_tooltip_text(button,_("Clear the search box"));
+
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_FIND,GTK_ICON_SIZE_BUTTON));
gtk_widget_show_all(button);
@@ -118,6 +116,7 @@ void TopWin::Create(GtkWidget *vbox)
gtk_widget_set_tooltip_text(button,_("Fuzzy Query"));
#endif
+#ifndef CONFIG_NANONOTE
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_UNDO,GTK_ICON_SIZE_BUTTON));
gtk_widget_show_all(button);
@@ -129,12 +128,10 @@ void TopWin::Create(GtkWidget *vbox)
gtk_box_pack_start(GTK_BOX(hbox),button,false,false,0);
gtk_widget_set_tooltip_text(button,_("Go Back - Right button: history (Alt+Left)"));
-#ifndef CONFIG_NANONOTE
GtkWidget *label;
label = gtk_label_new("\t");
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(hbox),label,false,false,0);
-#endif
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_HOME,GTK_ICON_SIZE_BUTTON));
@@ -145,6 +142,7 @@ void TopWin::Create(GtkWidget *vbox)
g_signal_connect(G_OBJECT(button),"enter_notify_event", G_CALLBACK(stardict_on_enter_notify), NULL);
gtk_box_pack_start(GTK_BOX(hbox),button,false,false,0);
gtk_widget_set_tooltip_text(button,_("Show the main menu (Alt+M)"));
+#endif
}
void TopWin::Destroy(void)
@@ -1246,6 +1244,10 @@ LeftWin::~LeftWin()
void LeftWin::Create(GtkWidget *hbox, bool has_treedict)
{
+ choosegroup_menu = NULL;
+ UpdateChooseGroup();
+
+#ifndef CONFIG_NANONOTE
vbox = gtk_vbox_new(FALSE, 3);
if (!conf->get_bool_at("main_window/hide_list"))
gtk_widget_show(vbox);
@@ -1302,8 +1304,6 @@ void LeftWin::Create(GtkWidget *hbox, bool has_treedict)
g_signal_connect(G_OBJECT(choosegroup_button),"clicked", G_CALLBACK(on_choose_group_button_clicked),this);
gtk_box_pack_start(GTK_BOX(vbox),choosegroup_button,false,false,0);
gtk_widget_set_tooltip_text(choosegroup_button, _("Choose dict group"));
- choosegroup_menu = NULL;
- UpdateChooseGroup();
GtkWidget *button;
button=gtk_button_new();
@@ -1325,6 +1325,7 @@ void LeftWin::Create(GtkWidget *hbox, bool has_treedict)
g_signal_connect(G_OBJECT(button),"enter_notify_event", G_CALLBACK(stardict_on_enter_notify), NULL);
gtk_box_pack_end(GTK_BOX(vbox),button,false,false,0);
gtk_widget_set_tooltip_text(button,_("Previous word (Alt+Up)"));
+#endif
}
void LeftWin::on_wazard_button_toggled(GtkToggleButton *button, LeftWin *oLeftWin)
@@ -1499,6 +1500,7 @@ void ToolWin::Create(GtkWidget *vbox)
gtk_box_pack_start(GTK_BOX(vbox),hbox,false,false,3);
#endif
+#ifndef CONFIG_NANONOTE
GtkWidget *image;
ShowListButton=gtk_button_new();
image = gtk_image_new_from_stock(GTK_STOCK_GOTO_LAST,GTK_ICON_SIZE_SMALL_TOOLBAR);
@@ -1535,10 +1537,10 @@ void ToolWin::Create(GtkWidget *vbox)
gtk_widget_show(ShowListButton);
else
gtk_widget_show(HideListButton);
-
+#endif /* CONFIG_NANONOTE */
GtkWidget *button;
-#ifndef CONFIG_GPE
+#if !defined(CONFIG_NANONOTE) && !defined(CONFIG_GPE)
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_COPY,GTK_ICON_SIZE_SMALL_TOOLBAR));
gtk_widget_show_all(button);
@@ -1563,6 +1565,7 @@ void ToolWin::Create(GtkWidget *vbox)
gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(PronounceWordMenuButton), _("Pronounce the word"));
gtk_widget_set_sensitive(GTK_WIDGET(PronounceWordMenuButton), false);
+#ifndef CONFIG_NANONOTE
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_SAVE,GTK_ICON_SIZE_SMALL_TOOLBAR));
gtk_widget_show_all(button);
@@ -1575,8 +1578,9 @@ void ToolWin::Create(GtkWidget *vbox)
gtk_box_pack_start(GTK_BOX(hbox),button,false,false,5);
#endif
gtk_widget_set_tooltip_text(button,_("Save to file (Alt+E)"));
+#endif /* CONFIG_NANONOTE */
-#ifndef CONFIG_GPE
+#if !defined(CONFIG_NANONOTE) && !defined(CONFIG_GPE)
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_PRINT,GTK_ICON_SIZE_SMALL_TOOLBAR));
gtk_widget_show_all(button);
@@ -1588,6 +1592,7 @@ void ToolWin::Create(GtkWidget *vbox)
gtk_widget_set_sensitive(button, false);
#endif
+#ifndef CONFIG_NANONOTE
button=gtk_button_new();
gtk_container_add(GTK_CONTAINER(button),gtk_image_new_from_stock(GTK_STOCK_FIND,GTK_ICON_SIZE_SMALL_TOOLBAR));
gtk_widget_show_all(button);
@@ -1600,6 +1605,7 @@ void ToolWin::Create(GtkWidget *vbox)
gtk_box_pack_start(GTK_BOX(hbox),button,false,false,5);
#endif
gtk_widget_set_tooltip_text(button,_("Search in the definition text (Ctrl+F)"));
+#endif
}
void ToolWin::ShowListCallback(GtkWidget *widget, gpointer data)
@@ -2691,7 +2697,6 @@ void MidWin::Create(GtkWidget *vbox)
oTransWin.Create(notebook);
}
-
/*********************************************/
BottomWin::BottomWin()
{
diff --git a/src/stardict.cpp b/src/stardict.cpp
index 2d4acb8..b84f5c5 100644
--- a/src/stardict.cpp
+++ b/src/stardict.cpp
@@ -432,7 +432,7 @@ gboolean AppCore::on_delete_event(GtkWidget * window, GdkEvent *event , AppCore
#ifndef CONFIG_NANONOTE
app->oDockLet->minimize_to_tray();
#endif
- g_print("Quitting..\n");
+ g_print("by Windows Manager Quitting..\n");
gtk_main_quit();
return FALSE;
}
@@ -506,7 +506,7 @@ gboolean AppCore::vKeyPressReleaseCallback(GtkWidget * window, GdkEventKey *even
}
else if (event->keyval==GDK_F1 && (!(event->state & GDK_CONTROL_MASK)) && (!(event->state & GDK_MOD1_MASK)) && (!(event->state & GDK_SHIFT_MASK))) {
if (event->type==GDK_KEY_PRESS)
- show_help(NULL);
+ show_help(NULL);
}
else if ((event->keyval==GDK_f || event->keyval==GDK_F) && only_ctrl_pressed) {
if (event->type==GDK_KEY_PRESS)
@@ -588,6 +588,7 @@ gboolean AppCore::vKeyPressReleaseCallback(GtkWidget * window, GdkEventKey *even
gtk_tree_model_get(model, &iter, 0, &word, -1);
oAppCore->ListClick(word);
g_free(word);
+ /* here to dispaly the result windows */
}
}
}

View File

@ -0,0 +1,66 @@
when search will only display the search index not the translate result
From: Xiangfu Liu <xiangfu@sharism.cc>
when press "enter" will goto the translate result text
"esc" will go back or new search
Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
---
src/mainwin.cpp | 4 +++-
src/mainwin.h | 1 +
src/stardict.cpp | 4 ++++
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/mainwin.cpp b/src/mainwin.cpp
index 0361014..77fa6f0 100644
--- a/src/mainwin.cpp
+++ b/src/mainwin.cpp
@@ -2688,8 +2688,10 @@ void MidWin::Create(GtkWidget *vbox)
oLeftWin.Create(hbox, has_treedict);
gtk_box_pack_start(GTK_BOX(hbox),notebook, true, true, 0);
- GtkWidget *vbox1 = gtk_vbox_new(FALSE, 0);
+ vbox1 = gtk_vbox_new(FALSE, 0);
+#ifndef CONFIG_NANONOTE
gtk_widget_show(vbox1);
+#endif
oToolWin.Create(vbox1);
oTextWin.Create(vbox1);
gtk_paned_pack2(GTK_PANED(hpaned), vbox1, TRUE, FALSE);
diff --git a/src/mainwin.h b/src/mainwin.h
index c3589c6..569c978 100644
--- a/src/mainwin.h
+++ b/src/mainwin.h
@@ -307,6 +307,7 @@ class MidWin {
public:
GtkWidget* hpaned;
GtkWidget* notebook;
+ GtkWidget* vbox1;
LeftWin oLeftWin;
IndexWin oIndexWin;
diff --git a/src/stardict.cpp b/src/stardict.cpp
index b84f5c5..8dd64ac 100644
--- a/src/stardict.cpp
+++ b/src/stardict.cpp
@@ -588,6 +588,8 @@ gboolean AppCore::vKeyPressReleaseCallback(GtkWidget * window, GdkEventKey *even
gtk_tree_model_get(model, &iter, 0, &word, -1);
oAppCore->ListClick(word);
g_free(word);
+ gtk_widget_hide(oAppCore->oMidWin.oIndexWin.notebook);
+ gtk_widget_show(oAppCore->oMidWin.vbox1);
/* here to dispaly the result windows */
}
}
@@ -613,6 +615,8 @@ gboolean AppCore::vKeyPressReleaseCallback(GtkWidget * window, GdkEventKey *even
oAppCore->oTopWin.InsertBackList();
oAppCore->oTopWin.SetText("");
oAppCore->oTopWin.grab_focus();
+ gtk_widget_show(oAppCore->oMidWin.oIndexWin.notebook);
+ gtk_widget_hide(oAppCore->oMidWin.vbox1);
} else {
if (!oAppCore->oTopWin.has_focus())
oAppCore->oTopWin.grab_focus();