Added keybinding to show and hide all additional widgets(statusbar, toolbar, sidebar and messages window).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1505 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-05-04 16:59:00 +00:00
parent 4030b92f07
commit 0514bba3d3
7 changed files with 65 additions and 9 deletions

View File

@ -3,6 +3,10 @@
* doc/geany.docbook, src/main.c, src/prefs.c:
Set widget names for the main widgets to allow users to define custom
styles in .gtkrc-2.0.
* doc/geany.docbook, src/keybindings.c, src/keybindings.h, src/prefs.c,
src/ui_utils.c, src/ui_utils.h:
Added keybinding to show and hide all additional widgets(statusbar,
toolbar, sidebar and messages window).
2007-05-03 Nick Treleaven <nick.treleaven@btinternet.com>

View File

@ -1712,6 +1712,11 @@ widget "GeanyPrefsDialog" style "geanyStyle"
<entry>Toggle Sidebar</entry>
<entry>Shows or hides the sidebar.</entry>
</row>
<row>
<entry>Hide and show all additional widgets</entry>
<entry>Hide and show all additional widgets like the sidebar, the
toolbar, the messages window and the statusbar.</entry>
</row>
<row>
<entry>Zoom In</entry>
<entry>Zooms in the text</entry>

View File

@ -94,6 +94,7 @@ static void cb_func_switch_tableft(guint key_id);
static void cb_func_switch_tabright(guint key_id);
static void cb_func_switch_tablastused(guint key_id);
static void cb_func_toggle_sidebar(guint key_id);
static void cb_func_hide_show_all(guint key_id);
// common function for editing keybindings, only valid when scintilla has focus.
static void cb_func_edit(guint key_id);
@ -171,6 +172,8 @@ void keybindings_init(void)
0, 0, "menu_messagewindow", _("Toggle Messages Window"));
keys[GEANY_KEYS_MENU_SIDEBAR] = fill(cb_func_toggle_sidebar,
0, 0, "toggle_sidebar", _("Toggle Sidebar"));
keys[GEANY_KEYS_MENU_HIDESHOWALL] = fill(cb_func_hide_show_all,
0, 0, "hide_show_all", _("Hide and show all additional widgets"));
keys[GEANY_KEYS_MENU_ZOOMIN] = fill(cb_func_menu_zoomin,
GDK_plus, GDK_CONTROL_MASK, "menu_zoomin", _("Zoom In"));
keys[GEANY_KEYS_MENU_ZOOMOUT] = fill(cb_func_menu_zoomout,
@ -1002,6 +1005,44 @@ static void cb_func_toggle_sidebar(G_GNUC_UNUSED guint key_id)
}
static void cb_func_hide_show_all(G_GNUC_UNUSED guint key_id)
{
static gint hide_all = FALSE;
GtkCheckMenuItem *msgw = GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1"));
GtkCheckMenuItem *toolbari = GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_toolbar1"));
hide_all = ! hide_all;
if (hide_all)
{
if (gtk_check_menu_item_get_active(msgw))
gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
if (app->sidebar_visible)
cb_func_toggle_sidebar(key_id);
ui_statusbar_showhide(FALSE);
if (gtk_check_menu_item_get_active(toolbari))
gtk_check_menu_item_set_active(toolbari, ! gtk_check_menu_item_get_active(toolbari));
}
else
{
if (! gtk_check_menu_item_get_active(msgw))
gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
if (! app->sidebar_visible)
cb_func_toggle_sidebar(key_id);
ui_statusbar_showhide(TRUE);
if (! gtk_check_menu_item_get_active(toolbari))
gtk_check_menu_item_set_active(toolbari, ! gtk_check_menu_item_get_active(toolbari));
}
}
static void goto_matching_brace(gint idx)
{
gint pos, new_pos;

View File

@ -80,6 +80,7 @@ enum
GEANY_KEYS_MENU_SIDEBAR,
GEANY_KEYS_MENU_ZOOMIN,
GEANY_KEYS_MENU_ZOOMOUT,
GEANY_KEYS_MENU_HIDESHOWALL,
GEANY_KEYS_MENU_REPLACETABS,
GEANY_KEYS_MENU_FOLDALL,

View File

@ -685,19 +685,12 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
#endif
// apply the changes made
ui_statusbar_showhide(app->statusbar_visible);
ui_update_toolbar_items();
ui_update_toolbar_icons(app->toolbar_icon_size);
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_style);
ui_treeviews_show_hide(FALSE);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), app->show_notebook_tabs);
// handle statusbar visibility
if (app->statusbar_visible)
{
gtk_widget_show(app->statusbar);
ui_update_statusbar(-1, -1);
}
else
gtk_widget_hide(app->statusbar);
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), app->tab_pos_editor);
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), app->tab_pos_msgwin);

View File

@ -1212,4 +1212,14 @@ static void ui_path_box_open_clicked(GtkButton *button, gpointer user_data)
gtk_widget_destroy(dialog);
}
void ui_statusbar_showhide(gboolean state)
{
// handle statusbar visibility
if (state)
{
gtk_widget_show(app->statusbar);
ui_update_statusbar(-1, -1);
}
else
gtk_widget_hide(app->statusbar);
}

View File

@ -115,4 +115,6 @@ gboolean ui_tree_view_find_next(GtkTreeView *treeview, TVMatchCallback cb);
void ui_widget_modify_font_from_string(GtkWidget *wid, const gchar *str);
void ui_statusbar_showhide(gboolean state);
#endif