Added options to show or hide the statusbar as well as the editor scrollbars.

Added sci_set_scrollbar_mode() to easily show or hide the scrollbars.	  


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1444 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-04-10 17:06:57 +00:00
parent dd7e84f33c
commit c84d9b2803
11 changed files with 173 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2007-04-10 Enrico Tröger <enrico.troeger@uvena.de>
* geany.glade, src/document.c, src/geany.h, src/interface.c,
src/keyfile.c, src/main.c, src/prefs.c, src/ui_utils.c:
Added options to show or hide the statusbar as well as the editor
scrollbars.
* src/sciwrappers.c, src/sciwrappers.h:
Added sci_set_scrollbar_mode() to easily show or hide the scrollbars.
2007-04-08 Enrico Tröger <enrico.troeger@uvena.de> 2007-04-08 Enrico Tröger <enrico.troeger@uvena.de>
* configure.in, Makefile.am, doc/Makefile.am, scintilla/Makefile.am, * configure.in, Makefile.am, doc/Makefile.am, scintilla/Makefile.am,

View File

@ -3777,6 +3777,93 @@ Bottom
<property name="fill">True</property> <property name="fill">True</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkFrame" id="frame23">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="alignment26">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="vbox22">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="check_statusbar_visible">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Whether to show the status bar at the bottom of the main window.</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show statusbar</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label187">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Miscellaneous&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="tab_expand">False</property> <property name="tab_expand">False</property>

View File

@ -300,6 +300,7 @@ static gint document_create_new_sci(const gchar *filename)
sci_set_symbol_margin(sci, app->show_markers_margin); sci_set_symbol_margin(sci, app->show_markers_margin);
sci_set_line_numbers(sci, app->show_linenumber_margin, 0); sci_set_line_numbers(sci, app->show_linenumber_margin, 0);
sci_set_lines_wrapped(sci, app->pref_editor_line_breaking); sci_set_lines_wrapped(sci, app->pref_editor_line_breaking);
sci_set_scrollbar_mode(sci, app->pref_editor_show_scrollbars);
// signal for insert-key(works without too, but to update the right status bar) // signal for insert-key(works without too, but to update the right status bar)
//g_signal_connect((GtkWidget*) sci, "key-press-event", //g_signal_connect((GtkWidget*) sci, "key-press-event",

View File

@ -91,6 +91,7 @@ typedef struct MyApp
gboolean sidebar_symbol_visible; gboolean sidebar_symbol_visible;
gboolean sidebar_openfiles_visible; gboolean sidebar_openfiles_visible;
gboolean sidebar_visible; gboolean sidebar_visible;
gboolean statusbar_visible;
gboolean msgwindow_visible; gboolean msgwindow_visible;
gboolean fullscreen; gboolean fullscreen;
gboolean beep_on_errors; gboolean beep_on_errors;
@ -115,6 +116,7 @@ typedef struct MyApp
gboolean pref_editor_auto_complete_constructs; gboolean pref_editor_auto_complete_constructs;
gboolean pref_editor_folding; gboolean pref_editor_folding;
gboolean pref_editor_unfold_all_children; gboolean pref_editor_unfold_all_children;
gboolean pref_editor_show_scrollbars;
gint pref_editor_tab_width; gint pref_editor_tab_width;
gboolean pref_editor_use_tabs; gboolean pref_editor_use_tabs;
gint pref_editor_default_encoding; gint pref_editor_default_encoding;

View File

@ -2363,6 +2363,11 @@ create_prefs_dialog (void)
GtkWidget *combo_tab_sidebar; GtkWidget *combo_tab_sidebar;
GtkWidget *combo_tab_editor; GtkWidget *combo_tab_editor;
GtkWidget *label158; GtkWidget *label158;
GtkWidget *frame23;
GtkWidget *alignment26;
GtkWidget *vbox22;
GtkWidget *check_statusbar_visible;
GtkWidget *label187;
GtkWidget *label157; GtkWidget *label157;
GtkWidget *vbox15; GtkWidget *vbox15;
GtkWidget *frame12; GtkWidget *frame12;
@ -2826,6 +2831,30 @@ create_prefs_dialog (void)
gtk_frame_set_label_widget (GTK_FRAME (frame9), label158); gtk_frame_set_label_widget (GTK_FRAME (frame9), label158);
gtk_label_set_use_markup (GTK_LABEL (label158), TRUE); gtk_label_set_use_markup (GTK_LABEL (label158), TRUE);
frame23 = gtk_frame_new (NULL);
gtk_widget_show (frame23);
gtk_box_pack_start (GTK_BOX (vbox14), frame23, TRUE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame23), GTK_SHADOW_NONE);
alignment26 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_show (alignment26);
gtk_container_add (GTK_CONTAINER (frame23), alignment26);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment26), 0, 0, 12, 0);
vbox22 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox22);
gtk_container_add (GTK_CONTAINER (alignment26), vbox22);
check_statusbar_visible = gtk_check_button_new_with_mnemonic (_("Show statusbar"));
gtk_widget_show (check_statusbar_visible);
gtk_box_pack_start (GTK_BOX (vbox22), check_statusbar_visible, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_statusbar_visible, _("Whether to show the status bar at the bottom of the main window."), NULL);
label187 = gtk_label_new (_("<b>Miscellaneous</b>"));
gtk_widget_show (label187);
gtk_frame_set_label_widget (GTK_FRAME (frame23), label187);
gtk_label_set_use_markup (GTK_LABEL (label187), TRUE);
label157 = gtk_label_new (_("Interface")); label157 = gtk_label_new (_("Interface"));
gtk_widget_show (label157); gtk_widget_show (label157);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 1), label157); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 1), label157);
@ -3836,6 +3865,11 @@ create_prefs_dialog (void)
GLADE_HOOKUP_OBJECT (prefs_dialog, combo_tab_sidebar, "combo_tab_sidebar"); GLADE_HOOKUP_OBJECT (prefs_dialog, combo_tab_sidebar, "combo_tab_sidebar");
GLADE_HOOKUP_OBJECT (prefs_dialog, combo_tab_editor, "combo_tab_editor"); GLADE_HOOKUP_OBJECT (prefs_dialog, combo_tab_editor, "combo_tab_editor");
GLADE_HOOKUP_OBJECT (prefs_dialog, label158, "label158"); GLADE_HOOKUP_OBJECT (prefs_dialog, label158, "label158");
GLADE_HOOKUP_OBJECT (prefs_dialog, frame23, "frame23");
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment26, "alignment26");
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox22, "vbox22");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_statusbar_visible, "check_statusbar_visible");
GLADE_HOOKUP_OBJECT (prefs_dialog, label187, "label187");
GLADE_HOOKUP_OBJECT (prefs_dialog, label157, "label157"); GLADE_HOOKUP_OBJECT (prefs_dialog, label157, "label157");
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox15, "vbox15"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox15, "vbox15");
GLADE_HOOKUP_OBJECT (prefs_dialog, frame12, "frame12"); GLADE_HOOKUP_OBJECT (prefs_dialog, frame12, "frame12");

View File

@ -103,9 +103,11 @@ void configuration_save()
g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", app->sidebar_symbol_visible); g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", app->sidebar_symbol_visible);
g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_visible", app->sidebar_openfiles_visible); g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_visible", app->sidebar_openfiles_visible);
g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", app->sidebar_visible); g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", app->sidebar_visible);
g_key_file_set_boolean(config, PACKAGE, "statusbar_visible", app->statusbar_visible);
g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible); g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible);
g_key_file_set_boolean(config, PACKAGE, "use_folding", app->pref_editor_folding); g_key_file_set_boolean(config, PACKAGE, "use_folding", app->pref_editor_folding);
g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", app->pref_editor_unfold_all_children); g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", app->pref_editor_unfold_all_children);
g_key_file_set_boolean(config, PACKAGE, "show_editor_scrollbars", app->pref_editor_show_scrollbars);
g_key_file_set_integer(config, PACKAGE, "indention_mode", app->pref_editor_indention_mode); g_key_file_set_integer(config, PACKAGE, "indention_mode", app->pref_editor_indention_mode);
g_key_file_set_boolean(config, PACKAGE, "use_tab_to_indent", app->use_tab_to_indent); g_key_file_set_boolean(config, PACKAGE, "use_tab_to_indent", app->use_tab_to_indent);
g_key_file_set_boolean(config, PACKAGE, "use_indicators", app->pref_editor_use_indicators); g_key_file_set_boolean(config, PACKAGE, "use_indicators", app->pref_editor_use_indicators);
@ -320,6 +322,7 @@ gboolean configuration_load()
app->sidebar_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_symbol_visible", TRUE); app->sidebar_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_symbol_visible", TRUE);
app->sidebar_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_visible", TRUE); app->sidebar_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_visible", TRUE);
app->sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE); app->sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE);
app->statusbar_visible = utils_get_setting_boolean(config, PACKAGE, "statusbar_visible", TRUE);
app->msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE); app->msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE);
app->pref_editor_line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); //default is off for better performance app->pref_editor_line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); //default is off for better performance
app->pref_editor_indention_mode = utils_get_setting_integer(config, PACKAGE, "indention_mode", INDENT_ADVANCED); app->pref_editor_indention_mode = utils_get_setting_integer(config, PACKAGE, "indention_mode", INDENT_ADVANCED);
@ -333,6 +336,7 @@ gboolean configuration_load()
app->pref_editor_auto_complete_symbols = utils_get_setting_boolean(config, PACKAGE, "auto_complete_symbols", TRUE); app->pref_editor_auto_complete_symbols = utils_get_setting_boolean(config, PACKAGE, "auto_complete_symbols", TRUE);
app->pref_editor_folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE); app->pref_editor_folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE);
app->pref_editor_unfold_all_children = utils_get_setting_boolean(config, PACKAGE, "unfold_all_children", FALSE); app->pref_editor_unfold_all_children = utils_get_setting_boolean(config, PACKAGE, "unfold_all_children", FALSE);
app->pref_editor_show_scrollbars = utils_get_setting_boolean(config, PACKAGE, "show_editor_scrollbars", FALSE);
app->show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE); app->show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
app->show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE); app->show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
app->fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE); app->fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE);

View File

@ -207,6 +207,12 @@ static void apply_settings(void)
gtk_window_set_default_size(GTK_WINDOW(app->window), app->geometry[2], app->geometry[3]); gtk_window_set_default_size(GTK_WINDOW(app->window), app->geometry[2], app->geometry[3]);
} }
// hide statusbar if desired
if (! app->statusbar_visible)
{
gtk_widget_hide(app->statusbar);
}
app->ignore_callback = TRUE; app->ignore_callback = TRUE;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM( gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
lookup_widget(app->window, "menu_line_breaking1")), app->pref_editor_line_breaking); lookup_widget(app->window, "menu_line_breaking1")), app->pref_editor_line_breaking);

View File

@ -155,6 +155,9 @@ void prefs_init_dialog(void)
widget = lookup_widget(app->prefs_dialog, "combo_tab_sidebar"); widget = lookup_widget(app->prefs_dialog, "combo_tab_sidebar");
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), app->tab_pos_sidebar); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), app->tab_pos_sidebar);
widget = lookup_widget(app->prefs_dialog, "check_statusbar_visible");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->statusbar_visible);
// Toolbar settings // Toolbar settings
widget = lookup_widget(app->prefs_dialog, "check_toolbar_show"); widget = lookup_widget(app->prefs_dialog, "check_toolbar_show");
@ -466,6 +469,9 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
widget = lookup_widget(app->prefs_dialog, "combo_tab_sidebar"); widget = lookup_widget(app->prefs_dialog, "combo_tab_sidebar");
app->tab_pos_sidebar = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); app->tab_pos_sidebar = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
widget = lookup_widget(app->prefs_dialog, "check_statusbar_visible");
app->statusbar_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
// Toolbar settings // Toolbar settings
widget = lookup_widget(app->prefs_dialog, "check_toolbar_show"); widget = lookup_widget(app->prefs_dialog, "check_toolbar_show");
@ -668,6 +674,14 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_style); gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_style);
ui_treeviews_show_hide(FALSE); ui_treeviews_show_hide(FALSE);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), app->show_notebook_tabs); 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(app->notebook), app->tab_pos_editor);
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), app->tab_pos_msgwin); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), app->tab_pos_msgwin);

View File

@ -935,3 +935,9 @@ void sci_set_selection_mode(ScintillaObject *sci, gint mode)
SSM(sci, SCI_SETSELECTIONMODE, mode, 0); SSM(sci, SCI_SETSELECTIONMODE, mode, 0);
} }
void sci_set_scrollbar_mode(ScintillaObject *sci, gboolean visible)
{
SSM(sci, SCI_SETHSCROLLBAR, visible, 0);
SSM(sci, SCI_SETVSCROLLBAR, visible, 0);
}

View File

@ -174,4 +174,6 @@ gint sci_get_overtype (ScintillaObject * sci);
void sci_set_tab_indents (ScintillaObject * sci, gboolean set); void sci_set_tab_indents (ScintillaObject * sci, gboolean set);
void sci_set_use_tabs (ScintillaObject * sci, gboolean set); void sci_set_use_tabs (ScintillaObject * sci, gboolean set);
void sci_set_scrollbar_mode (ScintillaObject * sci, gboolean visible);
#endif #endif

View File

@ -81,6 +81,9 @@ void ui_set_statusbar(const gchar *format, ...)
gchar string[512]; gchar string[512];
va_list args; va_list args;
if (! app->statusbar_visible)
return; // just do nothing if statusbar is not visible
va_start(args, format); va_start(args, format);
g_vsnprintf(string, 512, format, args); g_vsnprintf(string, 512, format, args);
va_end(args); va_end(args);
@ -96,9 +99,12 @@ void ui_update_statusbar(gint idx, gint pos)
const gchar *cur_tag; const gchar *cur_tag;
guint line, col; guint line, col;
if (! app->statusbar_visible)
return; // just do nothing if statusbar is not visible
if (idx == -1) idx = document_get_cur_idx(); if (idx == -1) idx = document_get_cur_idx();
if (idx >= 0 && doc_list[idx].is_valid) if (DOC_IDX_VALID(idx))
{ {
utils_get_current_function(idx, &cur_tag); utils_get_current_function(idx, &cur_tag);