Merge changes from the custom-tab-width branch (closes #1662173).
Thanks to Joerg Desch for explaining how it needs to work. Note: this breaks the plugin API for indentation editor_prefs. Add separate Width indent pref (as well as the Tab Width pref). Add 'Tabs & Spaces' Indent Type radio option pref. Add 'Tabs and Spaces' Document menu indent option. Note: Tabs & Spaces cannot be detected (yet) when opening files; default file templates still only use tabs. Set 'Detect from file' indent type setting insensitive when Tabs & Spaces is set. Don't change per-document auto-indent setting after changing default auto-indentation type. - API changes: Add GeanyIndentPrefs struct from some GeanyEditorPrefs fields. Replace GeanyIndentPrefs::use_tabs with GeanyIndentType field 'type'. Add editor_get_indent_prefs() to the API, which should be used to get the right settings for a document/editor instead of reading any struct fields. This could also support project/filetype indentation prefs quite easily. - Core code changes: Move toggle_prefs to a function toggle_items_foreach(), which takes a PREF_DISPLAY or PREF_UPDATE argument. This means the PrefEntry array can contain runtime fields, so can read pointer contents. Add pref_item_callbacks array of functions to call; toggle_items_foreach(), spin_items_foreach(), radio_items_foreach(), combo_items_foreach(). Update keyfile.c to use foreach-style functions for SettingEntry arrays, like the new PrefEntry code in prefs.c. Add get_indent_size_after_line() to replace get_indent() for clarity, and to fix Tabs & Spaces auto-indentation > basic. Remove opening-brace indent code from get_indent() as it's now in get_brace_indent(). Change editor_close_block() to use sci_get_line_indentation() for clarity. Make editor_close_block() static. Add editor_init(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2863 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
commit
309b853b57
44
ChangeLog
44
ChangeLog
@ -1,3 +1,47 @@
|
|||||||
|
2008-08-07 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||||
|
|
||||||
|
* src/interface.c, src/prefs.c, src/plugindata.h, src/callbacks.c,
|
||||||
|
src/callbacks.h, src/keyfile.c, src/document.c, src/plugins.c,
|
||||||
|
src/main.c, src/editor.c, src/editor.h, src/ui_utils.c, geany.glade,
|
||||||
|
plugins/export.c, TODO:
|
||||||
|
Merge changes from the custom-tab-width branch (closes #1662173).
|
||||||
|
Thanks to Joerg Desch for explaining how it needs to work.
|
||||||
|
Note: this breaks the plugin API for indentation editor_prefs.
|
||||||
|
Add separate Width indent pref (as well as the Tab Width pref).
|
||||||
|
Add 'Tabs & Spaces' Indent Type radio option pref.
|
||||||
|
Add 'Tabs and Spaces' Document menu indent option.
|
||||||
|
Note: Tabs & Spaces cannot be detected (yet) when opening files;
|
||||||
|
default file templates still only use tabs.
|
||||||
|
Set 'Detect from file' indent type setting insensitive when Tabs &
|
||||||
|
Spaces is set.
|
||||||
|
Don't change per-document auto-indent setting after changing default
|
||||||
|
auto-indentation type.
|
||||||
|
- API changes:
|
||||||
|
Add GeanyIndentPrefs struct from some GeanyEditorPrefs fields.
|
||||||
|
Replace GeanyIndentPrefs::use_tabs with GeanyIndentType field 'type'.
|
||||||
|
Add editor_get_indent_prefs() to the API, which should be used to
|
||||||
|
get the right settings for a document/editor instead of reading
|
||||||
|
any struct fields. This could also support project/filetype
|
||||||
|
indentation prefs quite easily.
|
||||||
|
- Core code changes:
|
||||||
|
Move toggle_prefs to a function toggle_items_foreach(), which takes
|
||||||
|
a PREF_DISPLAY or PREF_UPDATE argument. This means the PrefEntry
|
||||||
|
array can contain runtime fields, so can read pointer contents.
|
||||||
|
Add pref_item_callbacks array of functions to call;
|
||||||
|
toggle_items_foreach(), spin_items_foreach(), radio_items_foreach(),
|
||||||
|
combo_items_foreach().
|
||||||
|
Update keyfile.c to use foreach-style functions for SettingEntry
|
||||||
|
arrays, like the new PrefEntry code in prefs.c.
|
||||||
|
Add get_indent_size_after_line() to replace get_indent() for
|
||||||
|
clarity, and to fix Tabs & Spaces auto-indentation > basic.
|
||||||
|
Remove opening-brace indent code from get_indent() as it's now in
|
||||||
|
get_brace_indent().
|
||||||
|
Change editor_close_block() to use sci_get_line_indentation() for
|
||||||
|
clarity.
|
||||||
|
Make editor_close_block() static.
|
||||||
|
Add editor_init().
|
||||||
|
|
||||||
|
|
||||||
2008-08-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
2008-08-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||||
|
|
||||||
* src/vte.c:
|
* src/vte.c:
|
||||||
|
3
TODO
3
TODO
@ -18,9 +18,6 @@ Note: features included in brackets have lower priority.
|
|||||||
o recent projects menu
|
o recent projects menu
|
||||||
o project indentation settings support
|
o project indentation settings support
|
||||||
o improve Compile toolbar button for Make (drop down radio list?)
|
o improve Compile toolbar button for Make (drop down radio list?)
|
||||||
o (for spaces indentation, distinguish between tab width vs. indent
|
|
||||||
width, e.g. GTK code uses indent width of 2 spaces, and any tabs are
|
|
||||||
worth 8 spaces.)
|
|
||||||
o (selectable menu of arguments to use for Make, from Make Custom)
|
o (selectable menu of arguments to use for Make, from Make Custom)
|
||||||
o (DBUS)
|
o (DBUS)
|
||||||
o (indent wrapped lines - Scintilla issue)
|
o (indent wrapped lines - Scintilla issue)
|
||||||
|
370
geany.glade
370
geany.glade
@ -58,7 +58,7 @@
|
|||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2548">
|
<widget class="GtkImage" id="image2576">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-new</property>
|
<property name="stock">gtk-new</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -148,7 +148,7 @@
|
|||||||
<signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
|
<signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2549">
|
<widget class="GtkImage" id="image2577">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-save</property>
|
<property name="stock">gtk-save</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -169,7 +169,7 @@
|
|||||||
<signal name="activate" handler="on_toolbutton23_clicked" last_modification_time="Mon, 24 Jul 2006 19:26:04 GMT"/>
|
<signal name="activate" handler="on_toolbutton23_clicked" last_modification_time="Mon, 24 Jul 2006 19:26:04 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2550">
|
<widget class="GtkImage" id="image2578">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-revert-to-saved</property>
|
<property name="stock">gtk-revert-to-saved</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -189,7 +189,7 @@
|
|||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2551">
|
<widget class="GtkImage" id="image2579">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-revert-to-saved</property>
|
<property name="stock">gtk-revert-to-saved</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -277,7 +277,7 @@
|
|||||||
<signal name="activate" handler="on_close_other_documents1_activate" last_modification_time="Fri, 27 Jun 2008 15:19:28 GMT"/>
|
<signal name="activate" handler="on_close_other_documents1_activate" last_modification_time="Fri, 27 Jun 2008 15:19:28 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2552">
|
<widget class="GtkImage" id="image2580">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-close</property>
|
<property name="stock">gtk-close</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -299,7 +299,7 @@
|
|||||||
<signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
|
<signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2553">
|
<widget class="GtkImage" id="image2581">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-close</property>
|
<property name="stock">gtk-close</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -498,7 +498,7 @@
|
|||||||
<signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
|
<signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2554">
|
<widget class="GtkImage" id="image2582">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-indent</property>
|
<property name="stock">gtk-indent</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -519,7 +519,7 @@
|
|||||||
<signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
|
<signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2555">
|
<widget class="GtkImage" id="image2583">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-unindent</property>
|
<property name="stock">gtk-unindent</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -575,7 +575,7 @@
|
|||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2556">
|
<widget class="GtkImage" id="image2584">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-add</property>
|
<property name="stock">gtk-add</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -660,7 +660,7 @@
|
|||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2557">
|
<widget class="GtkImage" id="image2585">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-add</property>
|
<property name="stock">gtk-add</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -692,7 +692,7 @@
|
|||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2558">
|
<widget class="GtkImage" id="image2586">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-add</property>
|
<property name="stock">gtk-add</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -790,7 +790,7 @@
|
|||||||
<signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
|
<signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2559">
|
<widget class="GtkImage" id="image2587">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-find-and-replace</property>
|
<property name="stock">gtk-find-and-replace</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -865,7 +865,7 @@
|
|||||||
<signal name="activate" handler="on_go_to_line1_activate" last_modification_time="Tue, 23 May 2006 17:10:49 GMT"/>
|
<signal name="activate" handler="on_go_to_line1_activate" last_modification_time="Tue, 23 May 2006 17:10:49 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2560">
|
<widget class="GtkImage" id="image2588">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-jump-to</property>
|
<property name="stock">gtk-jump-to</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -900,7 +900,7 @@
|
|||||||
<signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
|
<signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2561">
|
<widget class="GtkImage" id="image2589">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-select-font</property>
|
<property name="stock">gtk-select-font</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -1098,6 +1098,17 @@
|
|||||||
<signal name="activate" handler="on_spaces1_activate" last_modification_time="Thu, 04 Oct 2007 16:07:51 GMT"/>
|
<signal name="activate" handler="on_spaces1_activate" last_modification_time="Thu, 04 Oct 2007 16:07:51 GMT"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkRadioMenuItem" id="tabs_and_spaces1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">T_abs and Spaces</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<property name="active">False</property>
|
||||||
|
<property name="group">tabs1</property>
|
||||||
|
<signal name="activate" handler="on_tabs_and_spaces1_activate" last_modification_time="Thu, 31 Jul 2008 14:23:06 GMT"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
@ -1329,7 +1340,7 @@
|
|||||||
<signal name="activate" handler="on_project_new1_activate" last_modification_time="Thu, 18 Jan 2007 22:16:24 GMT"/>
|
<signal name="activate" handler="on_project_new1_activate" last_modification_time="Thu, 18 Jan 2007 22:16:24 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2562">
|
<widget class="GtkImage" id="image2590">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-new</property>
|
<property name="stock">gtk-new</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -1350,7 +1361,7 @@
|
|||||||
<signal name="activate" handler="on_project_open1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
|
<signal name="activate" handler="on_project_open1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2563">
|
<widget class="GtkImage" id="image2591">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-open</property>
|
<property name="stock">gtk-open</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -1371,7 +1382,7 @@
|
|||||||
<signal name="activate" handler="on_project_close1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
|
<signal name="activate" handler="on_project_close1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2564">
|
<widget class="GtkImage" id="image2592">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-close</property>
|
<property name="stock">gtk-close</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -1430,7 +1441,7 @@
|
|||||||
<signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
|
<signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2565">
|
<widget class="GtkImage" id="image2593">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-select-color</property>
|
<property name="stock">gtk-select-color</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -1472,7 +1483,7 @@
|
|||||||
<signal name="activate" handler="on_menu_reload_configuration1_activate" last_modification_time="Mon, 30 Jun 2008 16:19:40 GMT"/>
|
<signal name="activate" handler="on_menu_reload_configuration1_activate" last_modification_time="Mon, 30 Jun 2008 16:19:40 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2566">
|
<widget class="GtkImage" id="image2594">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-refresh</property>
|
<property name="stock">gtk-refresh</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -1506,7 +1517,7 @@
|
|||||||
<signal name="activate" handler="on_help1_activate" last_modification_time="Sun, 24 Jul 2005 15:23:11 GMT"/>
|
<signal name="activate" handler="on_help1_activate" last_modification_time="Sun, 24 Jul 2005 15:23:11 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image2567">
|
<widget class="GtkImage" id="image2595">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-help</property>
|
<property name="stock">gtk-help</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -5358,7 +5369,7 @@ Bottom
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkTable" id="table13">
|
<widget class="GtkTable" id="table13">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="n_rows">4</property>
|
<property name="n_rows">7</property>
|
||||||
<property name="n_columns">2</property>
|
<property name="n_columns">2</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="row_spacing">3</property>
|
<property name="row_spacing">3</property>
|
||||||
@ -5373,7 +5384,7 @@ Bottom
|
|||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="wrap">False</property>
|
<property name="wrap">False</property>
|
||||||
<property name="selectable">False</property>
|
<property name="selectable">False</property>
|
||||||
<property name="xalign">0.5</property>
|
<property name="xalign">0</property>
|
||||||
<property name="yalign">0.5</property>
|
<property name="yalign">0.5</property>
|
||||||
<property name="xpad">0</property>
|
<property name="xpad">0</property>
|
||||||
<property name="ypad">0</property>
|
<property name="ypad">0</property>
|
||||||
@ -5385,8 +5396,8 @@ Bottom
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="right_attach">1</property>
|
<property name="right_attach">1</property>
|
||||||
<property name="top_attach">3</property>
|
<property name="top_attach">6</property>
|
||||||
<property name="bottom_attach">4</property>
|
<property name="bottom_attach">7</property>
|
||||||
<property name="x_options">fill</property>
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
@ -5405,120 +5416,13 @@ Match braces</property>
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="right_attach">2</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="top_attach">3</property>
|
<property name="top_attach">6</property>
|
||||||
<property name="bottom_attach">4</property>
|
<property name="bottom_attach">7</property>
|
||||||
<property name="x_options">fill</property>
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options">fill</property>
|
<property name="y_options">fill</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSpinButton" id="spin_tab_width">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="tooltip" translatable="yes">The width in chars, which one tab character will take</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="climb_rate">1</property>
|
|
||||||
<property name="digits">0</property>
|
|
||||||
<property name="numeric">True</property>
|
|
||||||
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
|
|
||||||
<property name="snap_to_ticks">False</property>
|
|
||||||
<property name="wrap">True</property>
|
|
||||||
<property name="adjustment">1 1 99 1 10 10</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="top_attach">2</property>
|
|
||||||
<property name="bottom_attach">3</property>
|
|
||||||
<property name="x_options">fill</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label116">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Tab width:</property>
|
|
||||||
<property name="use_underline">False</property>
|
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
|
||||||
<property name="wrap">False</property>
|
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0</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="left_attach">0</property>
|
|
||||||
<property name="right_attach">1</property>
|
|
||||||
<property name="top_attach">2</property>
|
|
||||||
<property name="bottom_attach">3</property>
|
|
||||||
<property name="x_options">fill</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkHBox" id="hbox8">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="homogeneous">False</property>
|
|
||||||
<property name="spacing">12</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkRadioButton" id="radio_indent_tabs">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="tooltip" translatable="yes">Whether to use tabs or spaces when indentation is inserted.</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="label" translatable="yes">_Tabs</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>
|
|
||||||
<widget class="GtkRadioButton" id="radio_indent_spaces">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="tooltip" translatable="yes">Whether to use tabs or spaces when indentation is inserted.</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="label" translatable="yes">_Spaces</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>
|
|
||||||
<property name="group">radio_indent_tabs</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="top_attach">0</property>
|
|
||||||
<property name="bottom_attach">1</property>
|
|
||||||
<property name="x_options">fill</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label200">
|
<widget class="GtkLabel" id="label200">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -5537,6 +5441,34 @@ Match braces</property>
|
|||||||
<property name="single_line_mode">False</property>
|
<property name="single_line_mode">False</property>
|
||||||
<property name="angle">0</property>
|
<property name="angle">0</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="right_attach">1</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label222">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Width:</property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0</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>
|
<packing>
|
||||||
<property name="left_attach">0</property>
|
<property name="left_attach">0</property>
|
||||||
<property name="right_attach">1</property>
|
<property name="right_attach">1</property>
|
||||||
@ -5547,6 +5479,174 @@ Match braces</property>
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkSpinButton" id="spin_indent_width">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">The width in chars of a single indent</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="climb_rate">1</property>
|
||||||
|
<property name="digits">0</property>
|
||||||
|
<property name="numeric">True</property>
|
||||||
|
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
|
||||||
|
<property name="snap_to_ticks">False</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
<property name="adjustment">1 1 99 1 10 10</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
<property name="bottom_attach">1</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkRadioButton" id="radio_indent_spaces">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">Use spaces when inserting indentation</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Spaces</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="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
<property name="bottom_attach">3</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkRadioButton" id="radio_indent_tabs">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">Use one tab per indent</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">_Tabs</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>
|
||||||
|
<property name="group">radio_indent_spaces</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
<property name="bottom_attach">2</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkRadioButton" id="radio_indent_both">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">Use spaces if the total indent is less than the tab width, otherwise use both</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="label" translatable="yes">T_abs and Spaces</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>
|
||||||
|
<property name="group">radio_indent_spaces</property>
|
||||||
|
<signal name="toggled" handler="on_radio_indent_both_toggled" last_modification_time="Tue, 05 Aug 2008 15:14:37 GMT"/>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
<property name="bottom_attach">4</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkAlignment" id="alignment41">
|
||||||
|
<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">24</property>
|
||||||
|
<property name="right_padding">0</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox13">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label221">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Tab Width:</property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</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="padding">0</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkSpinButton" id="spin_tab_width">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">The width of a tab when Tabs & Spaces is set for a document</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="climb_rate">1</property>
|
||||||
|
<property name="digits">0</property>
|
||||||
|
<property name="numeric">True</property>
|
||||||
|
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
|
||||||
|
<property name="snap_to_ticks">False</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
<property name="adjustment">8 1 99 1 10 10</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">0</property>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
<property name="bottom_attach">5</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkCheckButton" id="check_detect_indent">
|
<widget class="GtkCheckButton" id="check_detect_indent">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -5563,8 +5663,8 @@ Match braces</property>
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
<property name="right_attach">2</property>
|
<property name="right_attach">2</property>
|
||||||
<property name="top_attach">1</property>
|
<property name="top_attach">5</property>
|
||||||
<property name="bottom_attach">2</property>
|
<property name="bottom_attach">6</property>
|
||||||
<property name="x_options">fill</property>
|
<property name="x_options">fill</property>
|
||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
|
@ -347,6 +347,7 @@ static void on_file_save_dialog_response(GtkDialog *dialog, gint response, gpoin
|
|||||||
|
|
||||||
static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom)
|
static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom)
|
||||||
{
|
{
|
||||||
|
GeanyEditor *editor = doc->editor;
|
||||||
gint i, style = -1, old_style = 0, column = 0;
|
gint i, style = -1, old_style = 0, column = 0;
|
||||||
gchar c, c_next, *tmp;
|
gchar c, c_next, *tmp;
|
||||||
/* 0 - fore, 1 - back, 2 - bold, 3 - italic, 4 - font size, 5 - used(0/1) */
|
/* 0 - fore, 1 - back, 2 - bold, 3 - italic, 4 - font size, 5 - used(0/1) */
|
||||||
@ -408,8 +409,8 @@ static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean
|
|||||||
}
|
}
|
||||||
case '\t':
|
case '\t':
|
||||||
{
|
{
|
||||||
gint tab_stop = geany->editor_prefs->tab_width -
|
gint tab_width = p_editor->get_indent_prefs(editor)->tab_width;
|
||||||
(column % geany->editor_prefs->tab_width);
|
gint tab_stop = tab_width - (column % tab_width);
|
||||||
|
|
||||||
column += tab_stop - 1; /* -1 because we add 1 at the end of the loop */
|
column += tab_stop - 1; /* -1 because we add 1 at the end of the loop */
|
||||||
g_string_append_printf(body, "\\hspace*{%dem}", tab_stop);
|
g_string_append_printf(body, "\\hspace*{%dem}", tab_stop);
|
||||||
@ -551,6 +552,7 @@ static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean
|
|||||||
|
|
||||||
static void write_html_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom)
|
static void write_html_file(GeanyDocument *doc, const gchar *filename, gboolean use_zoom)
|
||||||
{
|
{
|
||||||
|
GeanyEditor *editor = doc->editor;
|
||||||
gint i, style = -1, old_style = 0, column = 0;
|
gint i, style = -1, old_style = 0, column = 0;
|
||||||
gchar c, c_next;
|
gchar c, c_next;
|
||||||
/* 0 - fore, 1 - back, 2 - bold, 3 - italic, 4 - font size, 5 - used(0/1) */
|
/* 0 - fore, 1 - back, 2 - bold, 3 - italic, 4 - font size, 5 - used(0/1) */
|
||||||
@ -625,8 +627,8 @@ static void write_html_file(GeanyDocument *doc, const gchar *filename, gboolean
|
|||||||
case '\t':
|
case '\t':
|
||||||
{
|
{
|
||||||
gint j;
|
gint j;
|
||||||
gint tab_stop = geany->editor_prefs->tab_width -
|
gint tab_width = p_editor->get_indent_prefs(editor)->tab_width;
|
||||||
(column % geany->editor_prefs->tab_width);
|
gint tab_stop = tab_width - (column % tab_width);
|
||||||
|
|
||||||
column += tab_stop - 1; /* -1 because we add 1 at the end of the loop */
|
column += tab_stop - 1; /* -1 because we add 1 at the end of the loop */
|
||||||
for (j = 0; j < tab_stop; j++)
|
for (j = 0; j < tab_stop; j++)
|
||||||
|
@ -1685,6 +1685,18 @@ on_menu_duplicate_line1_activate (GtkMenuItem *menuitem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void change_line_indent(GeanyEditor *editor, gboolean increase)
|
||||||
|
{
|
||||||
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
|
ScintillaObject *sci = editor->sci;
|
||||||
|
gint line = sci_get_current_line(sci);
|
||||||
|
gint width = sci_get_line_indentation(sci, line);
|
||||||
|
|
||||||
|
width += increase ? iprefs->width : -iprefs->width;
|
||||||
|
sci_set_line_indentation(sci, line, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
on_menu_increase_indent1_activate (GtkMenuItem *menuitem,
|
on_menu_increase_indent1_activate (GtkMenuItem *menuitem,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -1699,18 +1711,7 @@ on_menu_increase_indent1_activate (GtkMenuItem *menuitem,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gint line, ind_pos, old_pos, new_pos, step;
|
change_line_indent(doc->editor, TRUE);
|
||||||
|
|
||||||
old_pos = sci_get_current_position(doc->editor->sci);
|
|
||||||
line = sci_get_line_from_position(doc->editor->sci, old_pos);
|
|
||||||
ind_pos = sci_get_line_indent_position(doc->editor->sci, line);
|
|
||||||
/* when using tabs increase cur pos by 1, when using space increase it by tab_width */
|
|
||||||
step = (doc->editor->use_tabs) ? 1 : editor_prefs.tab_width;
|
|
||||||
new_pos = (old_pos > ind_pos) ? old_pos + step : old_pos;
|
|
||||||
|
|
||||||
sci_set_current_position(doc->editor->sci, ind_pos, TRUE);
|
|
||||||
sci_cmd(doc->editor->sci, SCI_TAB);
|
|
||||||
sci_set_current_position(doc->editor->sci, new_pos, TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1729,25 +1730,7 @@ on_menu_decrease_indent1_activate (GtkMenuItem *menuitem,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gint line, ind_pos, old_pos, new_pos, step, indent;
|
change_line_indent(doc->editor, FALSE);
|
||||||
|
|
||||||
old_pos = sci_get_current_position(doc->editor->sci);
|
|
||||||
line = sci_get_line_from_position(doc->editor->sci, old_pos);
|
|
||||||
ind_pos = sci_get_line_indent_position(doc->editor->sci, line);
|
|
||||||
step = (doc->editor->use_tabs) ? 1 : editor_prefs.tab_width;
|
|
||||||
new_pos = (old_pos >= ind_pos) ? old_pos - step : old_pos;
|
|
||||||
|
|
||||||
if (ind_pos == sci_get_position_from_line(doc->editor->sci, line))
|
|
||||||
return;
|
|
||||||
|
|
||||||
sci_set_current_position(doc->editor->sci, ind_pos, TRUE);
|
|
||||||
indent = sci_get_line_indentation(doc->editor->sci, line);
|
|
||||||
indent -= editor_prefs.tab_width;
|
|
||||||
if (indent < 0)
|
|
||||||
indent = 0;
|
|
||||||
sci_set_line_indentation(doc->editor->sci, line, indent);
|
|
||||||
|
|
||||||
sci_set_current_position(doc->editor->sci, new_pos, TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2063,31 +2046,39 @@ gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
static void set_indent_type(GeanyIndentType type)
|
||||||
on_tabs1_activate (GtkMenuItem *menuitem,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
GeanyDocument *doc = document_get_current();
|
GeanyDocument *doc = document_get_current();
|
||||||
|
|
||||||
if (doc == NULL || ignore_callback)
|
if (doc == NULL || ignore_callback)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
editor_set_use_tabs(doc->editor, TRUE);
|
editor_set_indent_type(doc->editor, type);
|
||||||
ui_update_statusbar(doc, -1);
|
ui_update_statusbar(doc, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
on_tabs1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
set_indent_type(GEANY_INDENT_TYPE_TABS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
on_spaces1_activate (GtkMenuItem *menuitem,
|
on_spaces1_activate (GtkMenuItem *menuitem,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GeanyDocument *doc = document_get_current();
|
set_indent_type(GEANY_INDENT_TYPE_SPACES);
|
||||||
|
}
|
||||||
|
|
||||||
if (doc == NULL || ignore_callback)
|
|
||||||
return;
|
|
||||||
|
|
||||||
editor_set_use_tabs(doc->editor, FALSE);
|
void
|
||||||
ui_update_statusbar(doc, -1);
|
on_tabs_and_spaces1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
set_indent_type(GEANY_INDENT_TYPE_BOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2209,3 +2200,15 @@ on_menu_reload_configuration1_activate (GtkMenuItem *menuitem,
|
|||||||
main_reload_configuration();
|
main_reload_configuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
on_radio_indent_both_toggled (GtkToggleButton *togglebutton,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GtkWidget *check = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent");
|
||||||
|
gboolean active;
|
||||||
|
|
||||||
|
active = gtk_toggle_button_get_active(togglebutton);
|
||||||
|
gtk_widget_set_sensitive(check, !active);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -626,3 +626,11 @@ on_menu_reload_configuration1_activate (GtkMenuItem *menuitem,
|
|||||||
void
|
void
|
||||||
on_find_document_usage1_activate (GtkMenuItem *menuitem,
|
on_find_document_usage1_activate (GtkMenuItem *menuitem,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
void
|
||||||
|
on_tabs_and_spaces1_activate (GtkMenuItem *menuitem,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
void
|
||||||
|
on_radio_indent_both_toggled (GtkToggleButton *togglebutton,
|
||||||
|
gpointer user_data);
|
||||||
|
@ -303,15 +303,18 @@ void document_set_text_changed(GeanyDocument *doc, gboolean changed)
|
|||||||
void document_apply_update_prefs(GeanyDocument *doc)
|
void document_apply_update_prefs(GeanyDocument *doc)
|
||||||
{
|
{
|
||||||
ScintillaObject *sci;
|
ScintillaObject *sci;
|
||||||
|
GeanyEditor *editor;
|
||||||
|
|
||||||
g_return_if_fail(doc != NULL);
|
g_return_if_fail(doc != NULL);
|
||||||
|
|
||||||
sci = doc->editor->sci;
|
editor = doc->editor;
|
||||||
|
sci = editor->sci;
|
||||||
|
|
||||||
sci_set_mark_long_lines(sci, editor_prefs.long_line_type,
|
sci_set_mark_long_lines(sci, editor_prefs.long_line_type,
|
||||||
editor_prefs.long_line_column, editor_prefs.long_line_color);
|
editor_prefs.long_line_column, editor_prefs.long_line_color);
|
||||||
|
|
||||||
sci_set_tab_width(sci, editor_prefs.tab_width);
|
/* update indent width, tab width */
|
||||||
|
editor_set_indent_type(editor, editor->indent_type);
|
||||||
|
|
||||||
sci_set_autoc_max_height(sci, editor_prefs.symbolcompletion_max_height);
|
sci_set_autoc_max_height(sci, editor_prefs.symbolcompletion_max_height);
|
||||||
|
|
||||||
@ -321,8 +324,6 @@ void document_apply_update_prefs(GeanyDocument *doc)
|
|||||||
|
|
||||||
sci_set_folding_margin_visible(sci, editor_prefs.folding);
|
sci_set_folding_margin_visible(sci, editor_prefs.folding);
|
||||||
|
|
||||||
doc->editor->auto_indent = (editor_prefs.indent_mode != INDENT_NONE);
|
|
||||||
|
|
||||||
sci_assign_cmdkey(sci, SCK_HOME,
|
sci_assign_cmdkey(sci, SCK_HOME,
|
||||||
editor_prefs.smart_home_key ? SCI_VCHOMEWRAP : SCI_HOMEWRAP);
|
editor_prefs.smart_home_key ? SCI_VCHOMEWRAP : SCI_HOMEWRAP);
|
||||||
sci_assign_cmdkey(sci, SCK_END, SCI_LINEENDWRAP);
|
sci_assign_cmdkey(sci, SCK_END, SCI_LINEENDWRAP);
|
||||||
@ -571,7 +572,6 @@ GeanyDocument *document_new_file(const gchar *utf8_filename, GeanyFiletype *ft,
|
|||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
sci_convert_eols(doc->editor->sci, file_prefs.default_eol_character);
|
sci_convert_eols(doc->editor->sci, file_prefs.default_eol_character);
|
||||||
|
|
||||||
editor_set_use_tabs(doc->editor, editor_prefs.use_tabs);
|
|
||||||
sci_set_undo_collection(doc->editor->sci, TRUE);
|
sci_set_undo_collection(doc->editor->sci, TRUE);
|
||||||
sci_empty_undo_buffer(doc->editor->sci);
|
sci_empty_undo_buffer(doc->editor->sci);
|
||||||
|
|
||||||
@ -883,11 +883,18 @@ static void set_cursor_position(GeanyEditor *editor, gint pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean detect_use_tabs(ScintillaObject *sci)
|
static GeanyIndentType detect_indent_type(GeanyEditor *editor)
|
||||||
{
|
{
|
||||||
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
|
ScintillaObject *sci = editor->sci;
|
||||||
gint line;
|
gint line;
|
||||||
|
gboolean use_tabs;
|
||||||
gsize tabs = 0, spaces = 0;
|
gsize tabs = 0, spaces = 0;
|
||||||
|
|
||||||
|
/* TODO: tabs & spaces detection */
|
||||||
|
if (iprefs->type == GEANY_INDENT_TYPE_BOTH)
|
||||||
|
return GEANY_INDENT_TYPE_BOTH;
|
||||||
|
|
||||||
for (line = 0; line < sci_get_line_count(sci); line++)
|
for (line = 0; line < sci_get_line_count(sci); line++)
|
||||||
{
|
{
|
||||||
gint pos = sci_get_position_from_line(sci, line);
|
gint pos = sci_get_position_from_line(sci, line);
|
||||||
@ -905,34 +912,42 @@ static gboolean detect_use_tabs(ScintillaObject *sci)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (spaces == 0 && tabs == 0)
|
if (spaces == 0 && tabs == 0)
|
||||||
return editor_prefs.use_tabs;
|
return iprefs->type;
|
||||||
|
|
||||||
/* Skew comparison by a factor of 2 in favour of default editor pref */
|
/* Skew comparison by a factor of 2 in favour of default editor pref */
|
||||||
if (editor_prefs.use_tabs)
|
if (iprefs->type == GEANY_INDENT_TYPE_TABS)
|
||||||
return ! (spaces > tabs * 2);
|
use_tabs = ! (spaces > tabs * 2);
|
||||||
else
|
else
|
||||||
return (tabs > spaces * 2);
|
use_tabs = (tabs > spaces * 2);
|
||||||
|
|
||||||
|
return use_tabs ? GEANY_INDENT_TYPE_TABS : GEANY_INDENT_TYPE_SPACES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_indentation(GeanyDocument *doc)
|
static void set_indentation(GeanyEditor *editor)
|
||||||
{
|
{
|
||||||
/* force using tabs for indentation for Makefiles */
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
if (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_MAKE)
|
|
||||||
editor_set_use_tabs(doc->editor, TRUE);
|
|
||||||
/* force using spaces for indentation for Fortran 77 */
|
|
||||||
else if (FILETYPE_ID(doc->file_type) == GEANY_FILETYPES_F77)
|
|
||||||
editor_set_use_tabs(doc->editor, FALSE);
|
|
||||||
else if (! editor_prefs.detect_tab_mode)
|
|
||||||
editor_set_use_tabs(doc->editor, editor_prefs.use_tabs);
|
|
||||||
else
|
|
||||||
{ /* detect & set tabs/spaces */
|
|
||||||
gboolean use_tabs = detect_use_tabs(doc->editor->sci);
|
|
||||||
|
|
||||||
if (use_tabs != editor_prefs.use_tabs)
|
switch (FILETYPE_ID(editor->document->file_type))
|
||||||
ui_set_statusbar(TRUE, _("Setting %s indentation mode."),
|
{
|
||||||
(use_tabs) ? _("Tabs") : _("Spaces"));
|
case GEANY_FILETYPES_MAKE:
|
||||||
editor_set_use_tabs(doc->editor, use_tabs);
|
/* force using tabs for indentation for Makefiles */
|
||||||
|
editor_set_indent_type(editor, GEANY_INDENT_TYPE_TABS);
|
||||||
|
break;
|
||||||
|
case GEANY_FILETYPES_F77:
|
||||||
|
/* force using spaces for indentation for Fortran 77 */
|
||||||
|
editor_set_indent_type(editor, GEANY_INDENT_TYPE_SPACES);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (iprefs->detect_type)
|
||||||
|
{ /* detect & set tabs/spaces */
|
||||||
|
GeanyIndentType type = detect_indent_type(editor);
|
||||||
|
|
||||||
|
if (type != iprefs->type)
|
||||||
|
ui_set_statusbar(TRUE, _("Setting %s indentation mode."),
|
||||||
|
(type == GEANY_INDENT_TYPE_TABS) ? _("Tabs") : _("Spaces"));
|
||||||
|
editor_set_indent_type(editor, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1061,9 +1076,9 @@ GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename
|
|||||||
|
|
||||||
/* set indentation settings after setting the filetype */
|
/* set indentation settings after setting the filetype */
|
||||||
if (reload)
|
if (reload)
|
||||||
editor_set_use_tabs(doc->editor, doc->editor->use_tabs); /* resetup sci */
|
editor_set_indent_type(doc->editor, doc->editor->indent_type); /* resetup sci */
|
||||||
else
|
else
|
||||||
set_indentation(doc);
|
set_indentation(doc->editor);
|
||||||
|
|
||||||
document_set_text_changed(doc, FALSE); /* also updates tab state */
|
document_set_text_changed(doc, FALSE); /* also updates tab state */
|
||||||
ui_document_show_hide(doc); /* update the document menu */
|
ui_document_show_hide(doc); /* update the document menu */
|
||||||
|
358
src/editor.c
358
src/editor.c
@ -74,12 +74,13 @@ static gchar indent[100];
|
|||||||
|
|
||||||
static void on_new_line_added(GeanyEditor *editor);
|
static void on_new_line_added(GeanyEditor *editor);
|
||||||
static gboolean handle_xml(GeanyEditor *editor, gchar ch);
|
static gboolean handle_xml(GeanyEditor *editor, gchar ch);
|
||||||
static void get_indent(GeanyEditor *editor, gint pos, gboolean use_this_line);
|
static void get_indent(GeanyEditor *editor, gint pos);
|
||||||
|
static void insert_indent_after_line(GeanyEditor *editor, gint line);
|
||||||
static void auto_multiline(GeanyEditor *editor, gint pos);
|
static void auto_multiline(GeanyEditor *editor, gint pos);
|
||||||
static gboolean is_comment(gint lexer, gint prev_style, gint style);
|
static gboolean is_comment(gint lexer, gint prev_style, gint style);
|
||||||
static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c);
|
static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c);
|
||||||
static void auto_table(GeanyEditor *editor, gint pos);
|
static void auto_table(GeanyEditor *editor, gint pos);
|
||||||
|
static void close_block(GeanyEditor *editor, gint pos);
|
||||||
|
|
||||||
|
|
||||||
void editor_snippets_free()
|
void editor_snippets_free()
|
||||||
@ -437,7 +438,7 @@ static void on_char_added(GeanyEditor *editor, SCNotification *nt)
|
|||||||
case '}':
|
case '}':
|
||||||
{ /* closing bracket handling */
|
{ /* closing bracket handling */
|
||||||
if (editor->auto_indent)
|
if (editor->auto_indent)
|
||||||
editor_close_block(editor->document, pos - 1);
|
close_block(editor, pos - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -706,51 +707,85 @@ void on_editor_notification(GtkWidget *widget, gint scn, gpointer lscn, gpointer
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gint get_tab_width(const GeanyIndentPrefs *indent_prefs)
|
||||||
|
{
|
||||||
|
if (indent_prefs->type == GEANY_INDENT_TYPE_BOTH)
|
||||||
|
return indent_prefs->tab_width;
|
||||||
|
|
||||||
|
return indent_prefs->width; /* tab width = indent width */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Returns a string containing width chars of whitespace, filled with simple space
|
/* Returns a string containing width chars of whitespace, filled with simple space
|
||||||
* characters or with the right number of tab characters, according to the
|
* characters or with the right number of tab characters, according to the indent prefs.
|
||||||
* use_tabs setting. (Result is filled with tabs *and* spaces if width isn't a multiple of
|
* (Result is filled with tabs *and* spaces if width isn't a multiple of
|
||||||
* editor_prefs.tab_width). */
|
* editor_prefs.tab_width). */
|
||||||
static gchar *
|
static gchar *
|
||||||
get_whitespace(gint width, gboolean use_tabs)
|
get_whitespace(const GeanyIndentPrefs *iprefs, gint width)
|
||||||
{
|
{
|
||||||
gchar *str;
|
g_return_val_if_fail(width >= 0, NULL);
|
||||||
|
|
||||||
g_return_val_if_fail(width > 0, NULL);
|
if (width == 0)
|
||||||
|
return g_strdup("");
|
||||||
|
|
||||||
if (use_tabs)
|
if (iprefs->type == GEANY_INDENT_TYPE_SPACES)
|
||||||
|
{
|
||||||
|
return g_strnfill(width, ' ');
|
||||||
|
}
|
||||||
|
else
|
||||||
{ /* first fill text with tabs and fill the rest with spaces */
|
{ /* first fill text with tabs and fill the rest with spaces */
|
||||||
gint tabs = width / editor_prefs.tab_width;
|
const gint tab_width = get_tab_width(iprefs);
|
||||||
gint spaces = width % editor_prefs.tab_width;
|
gint tabs = width / tab_width;
|
||||||
|
gint spaces = width % tab_width;
|
||||||
gint len = tabs + spaces;
|
gint len = tabs + spaces;
|
||||||
|
gchar *str;
|
||||||
|
|
||||||
str = g_malloc(len + 1);
|
str = g_malloc(len + 1);
|
||||||
|
|
||||||
memset(str, '\t', tabs);
|
memset(str, '\t', tabs);
|
||||||
memset(str + tabs, ' ', spaces);
|
memset(str + tabs, ' ', spaces);
|
||||||
str[len] = '\0';
|
str[len] = '\0';
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
str = g_strnfill(width, ' ');
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void check_python_indent(GeanyEditor *editor, gint pos)
|
static const GeanyIndentPrefs *
|
||||||
|
get_default_indent_prefs(void)
|
||||||
{
|
{
|
||||||
ScintillaObject *sci = editor->sci;
|
/* In future this might depend on the current project. */
|
||||||
gint last_char = pos - editor_get_eol_char_len(editor->document) - 1;
|
return editor_prefs.indentation;
|
||||||
|
}
|
||||||
|
|
||||||
/* add extra indentation for Python after colon */
|
|
||||||
if (sci_get_char_at(sci, last_char) == ':' &&
|
/** Get the indentation prefs for the editor.
|
||||||
sci_get_style_at(sci, last_char) == SCE_P_OPERATOR)
|
* In future, the prefs might be different according to project or filetype.
|
||||||
{
|
* @warning Always get a fresh result instead of keeping a pointer to it if the editor
|
||||||
/* creates and inserts one tabulator sign or
|
* settings may have changed, or if this function has been called for a different @a editor.
|
||||||
* whitespace of the amount of the tab width */
|
* @param editor The editor, or @c NULL to get the default indent prefs.
|
||||||
gchar *text = get_whitespace(editor_prefs.tab_width, editor->use_tabs);
|
* @return The indent prefs. */
|
||||||
sci_add_text(sci, text);
|
const GeanyIndentPrefs *
|
||||||
g_free(text);
|
editor_get_indent_prefs(GeanyEditor *editor)
|
||||||
}
|
{
|
||||||
|
static GeanyIndentPrefs iprefs;
|
||||||
|
|
||||||
|
iprefs = *get_default_indent_prefs();
|
||||||
|
|
||||||
|
if (!editor)
|
||||||
|
return &iprefs;
|
||||||
|
|
||||||
|
iprefs.type = editor->indent_type;
|
||||||
|
if (!editor->auto_indent)
|
||||||
|
iprefs.auto_indent_mode = GEANY_AUTOINDENT_NONE;
|
||||||
|
return &iprefs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gchar *get_single_indent(GeanyEditor *editor)
|
||||||
|
{
|
||||||
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
|
|
||||||
|
return get_whitespace(iprefs, iprefs->width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -763,12 +798,7 @@ static void on_new_line_added(GeanyEditor *editor)
|
|||||||
/* simple indentation */
|
/* simple indentation */
|
||||||
if (editor->auto_indent)
|
if (editor->auto_indent)
|
||||||
{
|
{
|
||||||
get_indent(editor, pos, FALSE);
|
insert_indent_after_line(editor, line - 1);
|
||||||
sci_add_text(sci, indent);
|
|
||||||
|
|
||||||
if (editor_prefs.indent_mode > INDENT_BASIC &&
|
|
||||||
FILETYPE_ID(editor->document->file_type) == GEANY_FILETYPES_PYTHON)
|
|
||||||
check_python_indent(editor, pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editor_prefs.auto_continue_multiline)
|
if (editor_prefs.auto_continue_multiline)
|
||||||
@ -808,83 +838,124 @@ static gboolean lexer_has_braces(ScintillaObject *sci)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* in place indentation of one tab or equivalent spaces */
|
/* Read indent chars for the line that pos is on into indent global variable.
|
||||||
static void do_indent(gchar *buf, gsize len, guint *idx, gboolean use_tabs)
|
* Note: Use sci_get_line_indentation() and get_whitespace() instead in any new code. */
|
||||||
{
|
static void get_indent(GeanyEditor *editor, gint pos)
|
||||||
guint j = *idx;
|
|
||||||
|
|
||||||
if (use_tabs)
|
|
||||||
{
|
|
||||||
if (j < len - 1) /* leave room for a \0 terminator. */
|
|
||||||
buf[j++] = '\t';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ /* insert as many spaces as a tab would take */
|
|
||||||
guint k;
|
|
||||||
for (k = 0; k < (guint) editor_prefs.tab_width && k < len - 1; k++)
|
|
||||||
buf[j++] = ' ';
|
|
||||||
}
|
|
||||||
*idx = j;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* "use_this_line" to auto-indent only if it is a real new line
|
|
||||||
* and ignore the case of editor_close_block */
|
|
||||||
static void get_indent(GeanyEditor *editor, gint pos, gboolean use_this_line)
|
|
||||||
{
|
{
|
||||||
ScintillaObject *sci = editor->sci;
|
ScintillaObject *sci = editor->sci;
|
||||||
guint i, len, j = 0;
|
guint i, len, j = 0;
|
||||||
gint prev_line;
|
gint line;
|
||||||
gchar *linebuf;
|
gchar *linebuf;
|
||||||
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
|
|
||||||
prev_line = sci_get_line_from_position(sci, pos);
|
line = sci_get_line_from_position(sci, pos);
|
||||||
|
|
||||||
if (! use_this_line)
|
len = sci_get_line_length(sci, line);
|
||||||
prev_line--;
|
linebuf = sci_get_line(sci, line);
|
||||||
len = sci_get_line_length(sci, prev_line);
|
|
||||||
linebuf = sci_get_line(sci, prev_line);
|
|
||||||
|
|
||||||
for (i = 0; i < len && j <= (sizeof(indent) - 1); i++)
|
for (i = 0; i < len && j <= (sizeof(indent) - 1); i++)
|
||||||
{
|
{
|
||||||
if (linebuf[i] == ' ' || linebuf[i] == '\t') /* simple indentation */
|
if (linebuf[i] == ' ' || linebuf[i] == '\t') /* simple indentation */
|
||||||
indent[j++] = linebuf[i];
|
indent[j++] = linebuf[i];
|
||||||
else if (editor_prefs.indent_mode <= INDENT_BASIC)
|
else if (iprefs->auto_indent_mode <= GEANY_AUTOINDENT_BASIC)
|
||||||
break;
|
break;
|
||||||
else if (use_this_line)
|
|
||||||
break;
|
|
||||||
else /* editor_close_block */
|
|
||||||
{
|
|
||||||
if (! lexer_has_braces(sci))
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* i == (len - 1) prevents wrong indentation after lines like
|
|
||||||
* " { return bless({}, shift); }" (Perl) */
|
|
||||||
if (linebuf[i] == '{' && i == (len - 1))
|
|
||||||
{
|
|
||||||
do_indent(indent, sizeof(indent), &j, editor->use_tabs);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gint k = len - 1;
|
|
||||||
|
|
||||||
while (k > 0 && isspace(linebuf[k])) k--;
|
|
||||||
|
|
||||||
/* if last non-whitespace character is a { increase indentation by a tab
|
|
||||||
* e.g. for (...) { */
|
|
||||||
if (linebuf[k] == '{')
|
|
||||||
{
|
|
||||||
do_indent(indent, sizeof(indent), &j, editor->use_tabs);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
indent[j] = '\0';
|
indent[j] = '\0';
|
||||||
g_free(linebuf);
|
g_free(linebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gint get_brace_indent(ScintillaObject *sci, gint line)
|
||||||
|
{
|
||||||
|
guint i, len;
|
||||||
|
gint ret = 0;
|
||||||
|
gchar *linebuf;
|
||||||
|
|
||||||
|
len = sci_get_line_length(sci, line);
|
||||||
|
linebuf = sci_get_line(sci, line);
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
/* i == (len - 1) prevents wrong indentation after lines like
|
||||||
|
* " { return bless({}, shift); }" (Perl) */
|
||||||
|
if (linebuf[i] == '{' && i == (len - 1))
|
||||||
|
{
|
||||||
|
ret++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gint k = len - 1;
|
||||||
|
|
||||||
|
while (k > 0 && isspace(linebuf[k])) k--;
|
||||||
|
|
||||||
|
/* if last non-whitespace character is a { increase indentation by a tab
|
||||||
|
* e.g. for (...) { */
|
||||||
|
if (linebuf[k] == '{')
|
||||||
|
{
|
||||||
|
ret++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_free(linebuf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gint get_python_indent(ScintillaObject *sci, gint line)
|
||||||
|
{
|
||||||
|
gint last_char = sci_get_line_end_position(sci, line) - 1;
|
||||||
|
|
||||||
|
/* add extra indentation for Python after colon */
|
||||||
|
if (sci_get_char_at(sci, last_char) == ':' &&
|
||||||
|
sci_get_style_at(sci, last_char) == SCE_P_OPERATOR)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static gint get_indent_size_after_line(GeanyEditor *editor, gint line)
|
||||||
|
{
|
||||||
|
ScintillaObject *sci = editor->sci;
|
||||||
|
gint size;
|
||||||
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
|
|
||||||
|
g_return_val_if_fail(line >= 0, 0);
|
||||||
|
|
||||||
|
size = sci_get_line_indentation(sci, line);
|
||||||
|
|
||||||
|
if (iprefs->auto_indent_mode > GEANY_AUTOINDENT_BASIC)
|
||||||
|
{
|
||||||
|
if (lexer_has_braces(sci))
|
||||||
|
size += iprefs->width * get_brace_indent(sci, line);
|
||||||
|
else
|
||||||
|
if (FILETYPE_ID(editor->document->file_type) == GEANY_FILETYPES_PYTHON)
|
||||||
|
size += iprefs->width * get_python_indent(sci, line);
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void insert_indent_after_line(GeanyEditor *editor, gint line)
|
||||||
|
{
|
||||||
|
ScintillaObject *sci = editor->sci;
|
||||||
|
gint size = get_indent_size_after_line(editor, line);
|
||||||
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
|
|
||||||
|
if (size > 0)
|
||||||
|
{
|
||||||
|
gchar *text;
|
||||||
|
|
||||||
|
text = get_whitespace(iprefs, size);
|
||||||
|
sci_add_text(sci, text);
|
||||||
|
g_free(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c)
|
static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c)
|
||||||
{
|
{
|
||||||
if (! editor_prefs.complete_snippets || SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_LATEX)
|
if (! editor_prefs.complete_snippets || SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_LATEX)
|
||||||
@ -904,7 +975,7 @@ static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c)
|
|||||||
|
|
||||||
/* Finds a corresponding matching brace to the given pos
|
/* Finds a corresponding matching brace to the given pos
|
||||||
* (this is taken from Scintilla Editor.cxx,
|
* (this is taken from Scintilla Editor.cxx,
|
||||||
* fit to work with editor_close_block) */
|
* fit to work with close_block) */
|
||||||
static gint brace_match(ScintillaObject *sci, gint pos)
|
static gint brace_match(ScintillaObject *sci, gint pos)
|
||||||
{
|
{
|
||||||
gchar chBrace = sci_get_char_at(sci, pos);
|
gchar chBrace = sci_get_char_at(sci, pos);
|
||||||
@ -942,15 +1013,17 @@ static gint brace_match(ScintillaObject *sci, gint pos)
|
|||||||
|
|
||||||
|
|
||||||
/* Called after typing '}'. */
|
/* Called after typing '}'. */
|
||||||
void editor_close_block(GeanyDocument *doc, gint pos)
|
static void close_block(GeanyEditor *editor, gint pos)
|
||||||
{
|
{
|
||||||
|
GeanyDocument *doc = editor->document;
|
||||||
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
gint x = 0, cnt = 0;
|
gint x = 0, cnt = 0;
|
||||||
gint line, line_len, eol_char_len;
|
gint line, line_len, eol_char_len;
|
||||||
gchar *text, *line_buf;
|
gchar *text, *line_buf;
|
||||||
ScintillaObject *sci;
|
ScintillaObject *sci;
|
||||||
gint line_indent, last_indent;
|
gint line_indent, last_indent;
|
||||||
|
|
||||||
if (editor_prefs.indent_mode < INDENT_CURRENTCHARS)
|
if (iprefs->auto_indent_mode < GEANY_AUTOINDENT_CURRENTCHARS)
|
||||||
return;
|
return;
|
||||||
if (doc == NULL || doc->file_type == NULL)
|
if (doc == NULL || doc->file_type == NULL)
|
||||||
return;
|
return;
|
||||||
@ -979,32 +1052,35 @@ void editor_close_block(GeanyDocument *doc, gint pos)
|
|||||||
if ((line_len - eol_char_len - 1) != cnt)
|
if ((line_len - eol_char_len - 1) != cnt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (editor_prefs.indent_mode == INDENT_MATCHBRACES)
|
if (iprefs->auto_indent_mode == GEANY_AUTOINDENT_MATCHBRACES)
|
||||||
{
|
{
|
||||||
gint start_brace = brace_match(sci, pos);
|
gint start_brace = brace_match(sci, pos);
|
||||||
|
|
||||||
if (start_brace >= 0)
|
if (start_brace >= 0)
|
||||||
{
|
{
|
||||||
gint line_start;
|
gint line_start;
|
||||||
|
gint brace_line = sci_get_line_from_position(sci, start_brace);
|
||||||
|
gint size = sci_get_line_indentation(sci, brace_line);
|
||||||
|
gchar *ind = get_whitespace(iprefs, size);
|
||||||
|
|
||||||
get_indent(doc->editor, start_brace, TRUE);
|
text = g_strconcat(ind, "}", NULL);
|
||||||
text = g_strconcat(indent, "}", NULL);
|
|
||||||
line_start = sci_get_position_from_line(sci, line);
|
line_start = sci_get_position_from_line(sci, line);
|
||||||
sci_set_anchor(sci, line_start);
|
sci_set_anchor(sci, line_start);
|
||||||
SSM(sci, SCI_REPLACESEL, 0, (sptr_t) text);
|
SSM(sci, SCI_REPLACESEL, 0, (sptr_t) text);
|
||||||
g_free(text);
|
g_free(text);
|
||||||
|
g_free(ind);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* fall through - unmatched brace (possibly because of TCL, PHP lexer bugs) */
|
/* fall through - unmatched brace (possibly because of TCL, PHP lexer bugs) */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* INDENT_CURRENTCHARS */
|
/* GEANY_AUTOINDENT_CURRENTCHARS */
|
||||||
line_indent = sci_get_line_indentation(sci, line);
|
line_indent = sci_get_line_indentation(sci, line);
|
||||||
last_indent = sci_get_line_indentation(sci, line - 1);
|
last_indent = sci_get_line_indentation(sci, line - 1);
|
||||||
|
|
||||||
if (line_indent < last_indent)
|
if (line_indent < last_indent)
|
||||||
return;
|
return;
|
||||||
line_indent -= editor_prefs.tab_width;
|
line_indent -= iprefs->width;
|
||||||
line_indent = MAX(0, line_indent);
|
line_indent = MAX(0, line_indent);
|
||||||
sci_set_line_indentation(sci, line, line_indent);
|
sci_set_line_indentation(sci, line, line_indent);
|
||||||
}
|
}
|
||||||
@ -1469,7 +1545,7 @@ void editor_auto_latex(GeanyDocument *doc, gint pos)
|
|||||||
|
|
||||||
/* get the indentation */
|
/* get the indentation */
|
||||||
if (editor->auto_indent)
|
if (editor->auto_indent)
|
||||||
get_indent(editor, pos, TRUE);
|
get_indent(editor, pos);
|
||||||
eol = g_strconcat(editor_get_eol_char(doc), indent, NULL);
|
eol = g_strconcat(editor_get_eol_char(doc), indent, NULL);
|
||||||
|
|
||||||
construct = g_strdup_printf("%s\\end%s{%s}", eol, full_cmd, env);
|
construct = g_strdup_printf("%s\\end%s{%s}", eol, full_cmd, env);
|
||||||
@ -1576,9 +1652,9 @@ static gboolean snippets_complete_constructs(GeanyEditor *editor, gint pos, cons
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_indent(editor, pos, TRUE);
|
get_indent(editor, pos);
|
||||||
lindent = g_strconcat(editor_get_eol_char(editor->document), indent, NULL);
|
lindent = g_strconcat(editor_get_eol_char(editor->document), indent, NULL);
|
||||||
whitespace = get_whitespace(editor_prefs.tab_width, editor->use_tabs);
|
whitespace = get_single_indent(editor);
|
||||||
|
|
||||||
/* remove the typed word, it will be added again by the used auto completion
|
/* remove the typed word, it will be added again by the used auto completion
|
||||||
* (not really necessary but this makes the auto completion more flexible,
|
* (not really necessary but this makes the auto completion more flexible,
|
||||||
@ -1806,7 +1882,7 @@ static void auto_table(GeanyEditor *editor, gint pos)
|
|||||||
|
|
||||||
if (SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_HTML) return;
|
if (SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_HTML) return;
|
||||||
|
|
||||||
get_indent(editor, pos, TRUE);
|
get_indent(editor, pos);
|
||||||
indent_pos = sci_get_line_indent_position(sci, sci_get_line_from_position(sci, pos));
|
indent_pos = sci_get_line_indent_position(sci, sci_get_line_from_position(sci, pos));
|
||||||
if ((pos - 7) != indent_pos) /* 7 == strlen("<table>") */
|
if ((pos - 7) != indent_pos) /* 7 == strlen("<table>") */
|
||||||
{
|
{
|
||||||
@ -1825,10 +1901,10 @@ static void auto_table(GeanyEditor *editor, gint pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get indent string for generated code */
|
/* get indent string for generated code */
|
||||||
if (editor_prefs.indent_mode == INDENT_NONE)
|
if (editor->auto_indent)
|
||||||
indent_str = g_strdup("");
|
indent_str = g_strdup("");
|
||||||
else
|
else
|
||||||
indent_str = get_whitespace(editor_prefs.tab_width, editor->use_tabs);
|
indent_str = get_single_indent(editor);
|
||||||
|
|
||||||
table = g_strconcat("\n", indent, indent_str, "<tr>\n",
|
table = g_strconcat("\n", indent, indent_str, "<tr>\n",
|
||||||
indent, indent_str, indent_str, "<td>\n",
|
indent, indent_str, indent_str, "<td>\n",
|
||||||
@ -2198,7 +2274,7 @@ void editor_do_comment_toggle(GeanyDocument *doc)
|
|||||||
gint a = (first_line_was_comment) ? - co_len : co_len;
|
gint a = (first_line_was_comment) ? - co_len : co_len;
|
||||||
|
|
||||||
/* don't modify sel_start when the selection starts within indentation */
|
/* don't modify sel_start when the selection starts within indentation */
|
||||||
get_indent(doc->editor, sel_start, TRUE);
|
get_indent(doc->editor, sel_start);
|
||||||
if ((sel_start - first_line_start) <= (gint) strlen(indent))
|
if ((sel_start - first_line_start) <= (gint) strlen(indent))
|
||||||
a = 0;
|
a = 0;
|
||||||
|
|
||||||
@ -2434,10 +2510,11 @@ static void auto_multiline(GeanyEditor *editor, gint pos)
|
|||||||
gint cur_line = sci_get_current_line(sci);
|
gint cur_line = sci_get_current_line(sci);
|
||||||
gint indent_pos = sci_get_line_indent_position(sci, cur_line);
|
gint indent_pos = sci_get_line_indent_position(sci, cur_line);
|
||||||
gint indent_len = sci_get_col_from_position(sci, indent_pos);
|
gint indent_len = sci_get_col_from_position(sci, indent_pos);
|
||||||
|
gint indent_width = editor_get_indent_prefs(editor)->width;
|
||||||
|
|
||||||
/* if there is one too many spaces, delete the last space,
|
/* if there is one too many spaces, delete the last space,
|
||||||
* to return to the indent used before the multiline comment was started. */
|
* to return to the indent used before the multiline comment was started. */
|
||||||
if (indent_len % editor_prefs.tab_width == 1)
|
if (indent_len % indent_width == 1)
|
||||||
SSM(sci, SCI_DELETEBACKNOTLINE, 0, 0); /* remove whitespace indent */
|
SSM(sci, SCI_DELETEBACKNOTLINE, 0, 0); /* remove whitespace indent */
|
||||||
g_free(previous_line);
|
g_free(previous_line);
|
||||||
return;
|
return;
|
||||||
@ -2704,7 +2781,7 @@ void editor_insert_multiline_comment(GeanyDocument *doc)
|
|||||||
if (editor->auto_indent &&
|
if (editor->auto_indent &&
|
||||||
! have_multiline_comment && doc->file_type->comment_use_indent)
|
! have_multiline_comment && doc->file_type->comment_use_indent)
|
||||||
{
|
{
|
||||||
get_indent(editor, editor_info.click_pos, TRUE);
|
get_indent(editor, editor_info.click_pos);
|
||||||
text = g_strdup_printf("%s\n%s\n%s\n", indent, indent, indent);
|
text = g_strdup_printf("%s\n%s\n%s\n", indent, indent, indent);
|
||||||
text_len = strlen(text);
|
text_len = strlen(text);
|
||||||
}
|
}
|
||||||
@ -2764,10 +2841,23 @@ void editor_scroll_to_line(ScintillaObject *sci, gint line, gfloat percent_of_vi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* creates and inserts one tab or whitespace of the amount of the tab width */
|
||||||
void editor_insert_alternative_whitespace(GeanyEditor *editor)
|
void editor_insert_alternative_whitespace(GeanyEditor *editor)
|
||||||
{
|
{
|
||||||
/* creates and inserts one tab or whitespace of the amount of the tab width */
|
gchar *text;
|
||||||
gchar *text = get_whitespace(editor_prefs.tab_width, ! editor->use_tabs);
|
GeanyIndentPrefs iprefs = *editor_get_indent_prefs(editor);
|
||||||
|
|
||||||
|
switch (iprefs.type)
|
||||||
|
{
|
||||||
|
case GEANY_INDENT_TYPE_TABS:
|
||||||
|
iprefs.type = GEANY_INDENT_TYPE_SPACES;
|
||||||
|
break;
|
||||||
|
case GEANY_INDENT_TYPE_SPACES:
|
||||||
|
case GEANY_INDENT_TYPE_BOTH: /* most likely we want a tab */
|
||||||
|
iprefs.type = GEANY_INDENT_TYPE_TABS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
text = get_whitespace(&iprefs, iprefs.width);
|
||||||
sci_add_text(editor->sci, text);
|
sci_add_text(editor->sci, text);
|
||||||
g_free(text);
|
g_free(text);
|
||||||
}
|
}
|
||||||
@ -2951,7 +3041,7 @@ void editor_smart_line_indentation(GeanyDocument *doc, gint pos)
|
|||||||
|
|
||||||
/* get previous line and use it for get_indent to use that line
|
/* get previous line and use it for get_indent to use that line
|
||||||
* (otherwise it would fail on a line only containing "{" in advanced indentation mode) */
|
* (otherwise it would fail on a line only containing "{" in advanced indentation mode) */
|
||||||
get_indent(doc->editor, sci_get_position_from_line(sci, first_line - 1), TRUE);
|
get_indent(doc->editor, sci_get_position_from_line(sci, first_line - 1));
|
||||||
|
|
||||||
smart_line_indentation(doc, first_line, last_line);
|
smart_line_indentation(doc, first_line, last_line);
|
||||||
|
|
||||||
@ -3489,14 +3579,24 @@ void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void editor_set_use_tabs(GeanyEditor *editor, gboolean use_tabs)
|
/* Also sets indent width, tab width. */
|
||||||
|
void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type)
|
||||||
{
|
{
|
||||||
g_return_if_fail(editor != NULL);
|
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);
|
||||||
|
ScintillaObject *sci = editor->sci;
|
||||||
|
gboolean use_tabs = type != GEANY_INDENT_TYPE_SPACES;
|
||||||
|
|
||||||
editor->use_tabs = use_tabs;
|
editor->indent_type = type;
|
||||||
sci_set_use_tabs(editor->sci, use_tabs);
|
sci_set_use_tabs(sci, use_tabs);
|
||||||
/* remove indent spaces on backspace, if using spaces to indent */
|
|
||||||
SSM(editor->sci, SCI_SETBACKSPACEUNINDENTS, ! use_tabs, 0);
|
if (type == GEANY_INDENT_TYPE_BOTH)
|
||||||
|
sci_set_tab_width(sci, iprefs->tab_width);
|
||||||
|
else
|
||||||
|
sci_set_tab_width(sci, iprefs->width);
|
||||||
|
SSM(sci, SCI_SETINDENT, iprefs->width, 0);
|
||||||
|
|
||||||
|
/* remove indent spaces on backspace, if using any spaces to indent */
|
||||||
|
SSM(sci, SCI_SETBACKSPACEUNINDENTS, type != GEANY_INDENT_TYPE_TABS, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3647,17 +3747,29 @@ static ScintillaObject *create_new_sci(GeanyDocument *doc)
|
|||||||
|
|
||||||
GeanyEditor *editor_create(GeanyDocument *doc)
|
GeanyEditor *editor_create(GeanyDocument *doc)
|
||||||
{
|
{
|
||||||
|
const GeanyIndentPrefs *iprefs = get_default_indent_prefs();
|
||||||
GeanyEditor *editor = g_new0(GeanyEditor, 1);
|
GeanyEditor *editor = g_new0(GeanyEditor, 1);
|
||||||
|
|
||||||
editor->document = doc;
|
editor->document = doc;
|
||||||
|
|
||||||
editor->auto_indent = (editor_prefs.indent_mode != INDENT_NONE);
|
editor->sci = create_new_sci(doc);
|
||||||
|
editor_set_indent_type(editor, iprefs->type);
|
||||||
|
editor_set_font(editor, interface_prefs.editor_font);
|
||||||
|
|
||||||
|
editor->auto_indent = (iprefs->auto_indent_mode != GEANY_AUTOINDENT_NONE);
|
||||||
editor->line_wrapping = editor_prefs.line_wrapping;
|
editor->line_wrapping = editor_prefs.line_wrapping;
|
||||||
editor->scroll_percent = -1.0F;
|
editor->scroll_percent = -1.0F;
|
||||||
editor->line_breaking = FALSE;
|
editor->line_breaking = FALSE;
|
||||||
|
|
||||||
editor->sci = create_new_sci(doc);
|
|
||||||
editor_set_font(editor, interface_prefs.editor_font);
|
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void editor_init(void)
|
||||||
|
{
|
||||||
|
static GeanyIndentPrefs indent_prefs;
|
||||||
|
|
||||||
|
memset(&editor_prefs, 0, sizeof(GeanyEditorPrefs));
|
||||||
|
memset(&indent_prefs, 0, sizeof(GeanyIndentPrefs));
|
||||||
|
editor_prefs.indentation = &indent_prefs;
|
||||||
|
}
|
||||||
|
|
||||||
|
59
src/editor.h
59
src/editor.h
@ -45,20 +45,43 @@
|
|||||||
#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
|
#define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
|
||||||
|
|
||||||
|
|
||||||
|
/** Whether to use tabs, spaces or both to indent. */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
INDENT_NONE = 0,
|
GEANY_INDENT_TYPE_SPACES, /**< Spaces. */
|
||||||
INDENT_BASIC,
|
GEANY_INDENT_TYPE_TABS, /**< Tabs. */
|
||||||
INDENT_CURRENTCHARS,
|
GEANY_INDENT_TYPE_BOTH /**< Both. */
|
||||||
INDENT_MATCHBRACES
|
}
|
||||||
} IndentMode;
|
GeanyIndentType;
|
||||||
|
|
||||||
/* These are the default prefs when creating a new editor window.
|
typedef enum
|
||||||
* Some of these can be overridden per document.
|
{
|
||||||
* Remember to increment abi_version in plugindata.h when changing items. */
|
GEANY_AUTOINDENT_NONE = 0,
|
||||||
|
GEANY_AUTOINDENT_BASIC,
|
||||||
|
GEANY_AUTOINDENT_CURRENTCHARS,
|
||||||
|
GEANY_AUTOINDENT_MATCHBRACES
|
||||||
|
}
|
||||||
|
GeanyAutoIndent;
|
||||||
|
|
||||||
|
|
||||||
|
/** Indentation prefs that might be different according to project or filetype.
|
||||||
|
* Use @c editor_get_indent_prefs() to lookup the prefs for a particular document. */
|
||||||
|
typedef struct GeanyIndentPrefs
|
||||||
|
{
|
||||||
|
gint width; /**< Indent width. */
|
||||||
|
GeanyIndentType type; /**< Whether to use tabs, spaces or both to indent. */
|
||||||
|
gint tab_width; /**< Width of a tab, when using GEANY_INDENT_TYPE_BOTH. */
|
||||||
|
GeanyAutoIndent auto_indent_mode;
|
||||||
|
gboolean detect_type;
|
||||||
|
}
|
||||||
|
GeanyIndentPrefs;
|
||||||
|
|
||||||
|
|
||||||
|
/* Default prefs when creating a new editor window.
|
||||||
|
* Some of these can be overridden per document. */
|
||||||
typedef struct GeanyEditorPrefs
|
typedef struct GeanyEditorPrefs
|
||||||
{
|
{
|
||||||
/* display */
|
GeanyIndentPrefs *indentation; /*< Default indentation prefs. @see editor_get_indent_prefs(). */
|
||||||
gboolean show_white_space;
|
gboolean show_white_space;
|
||||||
gboolean show_indent_guide;
|
gboolean show_indent_guide;
|
||||||
gboolean show_line_endings;
|
gboolean show_line_endings;
|
||||||
@ -69,17 +92,12 @@ typedef struct GeanyEditorPrefs
|
|||||||
gboolean show_linenumber_margin; /* view menu */
|
gboolean show_linenumber_margin; /* view menu */
|
||||||
gboolean show_scrollbars; /* hidden pref */
|
gboolean show_scrollbars; /* hidden pref */
|
||||||
gboolean scroll_stop_at_last_line; /* hidden pref */
|
gboolean scroll_stop_at_last_line; /* hidden pref */
|
||||||
|
|
||||||
/* behaviour */
|
|
||||||
gboolean line_wrapping;
|
gboolean line_wrapping;
|
||||||
gboolean use_indicators;
|
gboolean use_indicators;
|
||||||
gboolean folding;
|
gboolean folding;
|
||||||
gboolean unfold_all_children;
|
gboolean unfold_all_children;
|
||||||
gint tab_width;
|
|
||||||
gboolean use_tabs;
|
|
||||||
gboolean use_tab_to_indent; /* hidden pref */
|
|
||||||
IndentMode indent_mode;
|
|
||||||
gboolean disable_dnd;
|
gboolean disable_dnd;
|
||||||
|
gboolean use_tab_to_indent; /* hidden pref makes pressing Tab key like Ctrl-I */
|
||||||
gboolean smart_home_key;
|
gboolean smart_home_key;
|
||||||
gboolean newline_strip;
|
gboolean newline_strip;
|
||||||
gboolean auto_complete_symbols;
|
gboolean auto_complete_symbols;
|
||||||
@ -91,7 +109,6 @@ typedef struct GeanyEditorPrefs
|
|||||||
gboolean brace_match_ltgt; /* whether to highlight < and > chars (hidden pref) */
|
gboolean brace_match_ltgt; /* whether to highlight < and > chars (hidden pref) */
|
||||||
gboolean use_gtk_word_boundaries; /* hidden pref */
|
gboolean use_gtk_word_boundaries; /* hidden pref */
|
||||||
gboolean complete_snippets_whilst_editing; /* hidden pref */
|
gboolean complete_snippets_whilst_editing; /* hidden pref */
|
||||||
gboolean detect_tab_mode;
|
|
||||||
gint line_break_column;
|
gint line_break_column;
|
||||||
gboolean auto_continue_multiline;
|
gboolean auto_continue_multiline;
|
||||||
gchar *comment_toggle_mark;
|
gchar *comment_toggle_mark;
|
||||||
@ -109,7 +126,7 @@ typedef struct GeanyEditor
|
|||||||
gboolean auto_indent; /**< @c TRUE if auto-indentation is enabled. */
|
gboolean auto_indent; /**< @c TRUE if auto-indentation is enabled. */
|
||||||
/** Percentage to scroll view by on paint, if positive. */
|
/** Percentage to scroll view by on paint, if positive. */
|
||||||
gfloat scroll_percent;
|
gfloat scroll_percent;
|
||||||
gboolean use_tabs; /**< @c TRUE if tabs are used for indentation. */
|
GeanyIndentType indent_type; /* Use editor_get_indent_prefs() instead. */
|
||||||
gboolean line_breaking; /**< Whether to split long lines as you type. */
|
gboolean line_breaking; /**< Whether to split long lines as you type. */
|
||||||
}
|
}
|
||||||
GeanyEditor;
|
GeanyEditor;
|
||||||
@ -126,14 +143,14 @@ extern EditorInfo editor_info;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void editor_init(void);
|
||||||
|
|
||||||
GeanyEditor *editor_create(GeanyDocument *doc);
|
GeanyEditor *editor_create(GeanyDocument *doc);
|
||||||
|
|
||||||
void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
|
void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
|
||||||
|
|
||||||
gboolean editor_start_auto_complete(GeanyDocument *doc, gint pos, gboolean force);
|
gboolean editor_start_auto_complete(GeanyDocument *doc, gint pos, gboolean force);
|
||||||
|
|
||||||
void editor_close_block(GeanyDocument *doc, gint pos);
|
|
||||||
|
|
||||||
gboolean editor_complete_snippet(GeanyDocument *doc, gint pos);
|
gboolean editor_complete_snippet(GeanyDocument *doc, gint pos);
|
||||||
|
|
||||||
void editor_auto_latex(GeanyDocument *doc, gint pos);
|
void editor_auto_latex(GeanyDocument *doc, gint pos);
|
||||||
@ -217,7 +234,9 @@ void editor_ensure_final_newline(GeanyDocument *doc);
|
|||||||
|
|
||||||
void editor_insert_color(GeanyDocument *doc, const gchar *colour);
|
void editor_insert_color(GeanyDocument *doc, const gchar *colour);
|
||||||
|
|
||||||
void editor_set_use_tabs(GeanyEditor *editor, gboolean use_tabs);
|
const GeanyIndentPrefs *editor_get_indent_prefs(GeanyEditor *editor);
|
||||||
|
|
||||||
|
void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type);
|
||||||
|
|
||||||
void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap);
|
void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap);
|
||||||
|
|
||||||
|
363
src/interface.c
363
src/interface.c
@ -37,7 +37,7 @@ create_window1 (void)
|
|||||||
GtkWidget *file1_menu;
|
GtkWidget *file1_menu;
|
||||||
GtkWidget *menu_new1;
|
GtkWidget *menu_new1;
|
||||||
GtkWidget *menu_new_with_template1;
|
GtkWidget *menu_new_with_template1;
|
||||||
GtkWidget *image2548;
|
GtkWidget *image2576;
|
||||||
GtkWidget *menu_new_with_template1_menu;
|
GtkWidget *menu_new_with_template1_menu;
|
||||||
GtkWidget *invisible2;
|
GtkWidget *invisible2;
|
||||||
GtkWidget *separator12;
|
GtkWidget *separator12;
|
||||||
@ -48,11 +48,11 @@ create_window1 (void)
|
|||||||
GtkWidget *menu_save1;
|
GtkWidget *menu_save1;
|
||||||
GtkWidget *menu_save_as1;
|
GtkWidget *menu_save_as1;
|
||||||
GtkWidget *menu_save_all1;
|
GtkWidget *menu_save_all1;
|
||||||
GtkWidget *image2549;
|
GtkWidget *image2577;
|
||||||
GtkWidget *menu_reload1;
|
GtkWidget *menu_reload1;
|
||||||
GtkWidget *image2550;
|
GtkWidget *image2578;
|
||||||
GtkWidget *menu_reload_as1;
|
GtkWidget *menu_reload_as1;
|
||||||
GtkWidget *image2551;
|
GtkWidget *image2579;
|
||||||
GtkWidget *menu_reload_as1_menu;
|
GtkWidget *menu_reload_as1_menu;
|
||||||
GtkWidget *invisible7;
|
GtkWidget *invisible7;
|
||||||
GtkWidget *separator21;
|
GtkWidget *separator21;
|
||||||
@ -63,9 +63,9 @@ create_window1 (void)
|
|||||||
GtkWidget *separator14;
|
GtkWidget *separator14;
|
||||||
GtkWidget *menu_close1;
|
GtkWidget *menu_close1;
|
||||||
GtkWidget *close_other_documents1;
|
GtkWidget *close_other_documents1;
|
||||||
GtkWidget *image2552;
|
GtkWidget *image2580;
|
||||||
GtkWidget *menu_close_all1;
|
GtkWidget *menu_close_all1;
|
||||||
GtkWidget *image2553;
|
GtkWidget *image2581;
|
||||||
GtkWidget *menu_separatormenuitem1;
|
GtkWidget *menu_separatormenuitem1;
|
||||||
GtkWidget *menu_quit1;
|
GtkWidget *menu_quit1;
|
||||||
GtkWidget *edit1;
|
GtkWidget *edit1;
|
||||||
@ -90,16 +90,16 @@ create_window1 (void)
|
|||||||
GtkWidget *menu_duplicate_line1;
|
GtkWidget *menu_duplicate_line1;
|
||||||
GtkWidget *separator29;
|
GtkWidget *separator29;
|
||||||
GtkWidget *menu_increase_indent1;
|
GtkWidget *menu_increase_indent1;
|
||||||
GtkWidget *image2554;
|
GtkWidget *image2582;
|
||||||
GtkWidget *menu_decrease_indent1;
|
GtkWidget *menu_decrease_indent1;
|
||||||
GtkWidget *image2555;
|
GtkWidget *image2583;
|
||||||
GtkWidget *separator37;
|
GtkWidget *separator37;
|
||||||
GtkWidget *send_selection_to2;
|
GtkWidget *send_selection_to2;
|
||||||
GtkWidget *send_selection_to2_menu;
|
GtkWidget *send_selection_to2_menu;
|
||||||
GtkWidget *invisible13;
|
GtkWidget *invisible13;
|
||||||
GtkWidget *separator18;
|
GtkWidget *separator18;
|
||||||
GtkWidget *add_comments1;
|
GtkWidget *add_comments1;
|
||||||
GtkWidget *image2556;
|
GtkWidget *image2584;
|
||||||
GtkWidget *add_comments1_menu;
|
GtkWidget *add_comments1_menu;
|
||||||
GtkWidget *menu_add_changelog_entry1;
|
GtkWidget *menu_add_changelog_entry1;
|
||||||
GtkWidget *insert_file_header1;
|
GtkWidget *insert_file_header1;
|
||||||
@ -108,11 +108,11 @@ create_window1 (void)
|
|||||||
GtkWidget *insert_gpl_notice2;
|
GtkWidget *insert_gpl_notice2;
|
||||||
GtkWidget *insert_bsd_license_notice2;
|
GtkWidget *insert_bsd_license_notice2;
|
||||||
GtkWidget *insert_date1;
|
GtkWidget *insert_date1;
|
||||||
GtkWidget *image2557;
|
GtkWidget *image2585;
|
||||||
GtkWidget *insert_date1_menu;
|
GtkWidget *insert_date1_menu;
|
||||||
GtkWidget *invisible8;
|
GtkWidget *invisible8;
|
||||||
GtkWidget *insert_include2;
|
GtkWidget *insert_include2;
|
||||||
GtkWidget *image2558;
|
GtkWidget *image2586;
|
||||||
GtkWidget *insert_include2_menu;
|
GtkWidget *insert_include2_menu;
|
||||||
GtkWidget *invisible4;
|
GtkWidget *invisible4;
|
||||||
GtkWidget *separator9;
|
GtkWidget *separator9;
|
||||||
@ -124,7 +124,7 @@ create_window1 (void)
|
|||||||
GtkWidget *find_previous1;
|
GtkWidget *find_previous1;
|
||||||
GtkWidget *find_in_files1;
|
GtkWidget *find_in_files1;
|
||||||
GtkWidget *replace1;
|
GtkWidget *replace1;
|
||||||
GtkWidget *image2559;
|
GtkWidget *image2587;
|
||||||
GtkWidget *separator33;
|
GtkWidget *separator33;
|
||||||
GtkWidget *find_nextsel1;
|
GtkWidget *find_nextsel1;
|
||||||
GtkWidget *find_prevsel1;
|
GtkWidget *find_prevsel1;
|
||||||
@ -133,11 +133,11 @@ create_window1 (void)
|
|||||||
GtkWidget *previous_message1;
|
GtkWidget *previous_message1;
|
||||||
GtkWidget *separator32;
|
GtkWidget *separator32;
|
||||||
GtkWidget *go_to_line1;
|
GtkWidget *go_to_line1;
|
||||||
GtkWidget *image2560;
|
GtkWidget *image2588;
|
||||||
GtkWidget *menu_view1;
|
GtkWidget *menu_view1;
|
||||||
GtkWidget *menu_view1_menu;
|
GtkWidget *menu_view1_menu;
|
||||||
GtkWidget *menu_change_font1;
|
GtkWidget *menu_change_font1;
|
||||||
GtkWidget *image2561;
|
GtkWidget *image2589;
|
||||||
GtkWidget *menu_separator4;
|
GtkWidget *menu_separator4;
|
||||||
GtkWidget *menu_toggle_all_additional_widgets1;
|
GtkWidget *menu_toggle_all_additional_widgets1;
|
||||||
GtkWidget *menu_fullscreen1;
|
GtkWidget *menu_fullscreen1;
|
||||||
@ -160,6 +160,7 @@ create_window1 (void)
|
|||||||
GSList *tabs1_group = NULL;
|
GSList *tabs1_group = NULL;
|
||||||
GtkWidget *tabs1;
|
GtkWidget *tabs1;
|
||||||
GtkWidget *spaces1;
|
GtkWidget *spaces1;
|
||||||
|
GtkWidget *tabs_and_spaces1;
|
||||||
GtkWidget *separator45;
|
GtkWidget *separator45;
|
||||||
GtkWidget *set_file_readonly1;
|
GtkWidget *set_file_readonly1;
|
||||||
GtkWidget *menu_write_unicode_bom1;
|
GtkWidget *menu_write_unicode_bom1;
|
||||||
@ -189,26 +190,26 @@ create_window1 (void)
|
|||||||
GtkWidget *menu_project1;
|
GtkWidget *menu_project1;
|
||||||
GtkWidget *menu_project1_menu;
|
GtkWidget *menu_project1_menu;
|
||||||
GtkWidget *project_new1;
|
GtkWidget *project_new1;
|
||||||
GtkWidget *image2562;
|
GtkWidget *image2590;
|
||||||
GtkWidget *project_open1;
|
GtkWidget *project_open1;
|
||||||
GtkWidget *image2563;
|
GtkWidget *image2591;
|
||||||
GtkWidget *project_close1;
|
GtkWidget *project_close1;
|
||||||
GtkWidget *image2564;
|
GtkWidget *image2592;
|
||||||
GtkWidget *separator34;
|
GtkWidget *separator34;
|
||||||
GtkWidget *project_properties1;
|
GtkWidget *project_properties1;
|
||||||
GtkWidget *menu_build1;
|
GtkWidget *menu_build1;
|
||||||
GtkWidget *tools1;
|
GtkWidget *tools1;
|
||||||
GtkWidget *tools1_menu;
|
GtkWidget *tools1_menu;
|
||||||
GtkWidget *menu_choose_color1;
|
GtkWidget *menu_choose_color1;
|
||||||
GtkWidget *image2565;
|
GtkWidget *image2593;
|
||||||
GtkWidget *menu_count_words1;
|
GtkWidget *menu_count_words1;
|
||||||
GtkWidget *load_tags1;
|
GtkWidget *load_tags1;
|
||||||
GtkWidget *menu_reload_configuration1;
|
GtkWidget *menu_reload_configuration1;
|
||||||
GtkWidget *image2566;
|
GtkWidget *image2594;
|
||||||
GtkWidget *menu_help1;
|
GtkWidget *menu_help1;
|
||||||
GtkWidget *menu_help1_menu;
|
GtkWidget *menu_help1_menu;
|
||||||
GtkWidget *help1;
|
GtkWidget *help1;
|
||||||
GtkWidget *image2567;
|
GtkWidget *image2595;
|
||||||
GtkWidget *keyboard_shortcuts1;
|
GtkWidget *keyboard_shortcuts1;
|
||||||
GtkWidget *website1;
|
GtkWidget *website1;
|
||||||
GtkWidget *separator16;
|
GtkWidget *separator16;
|
||||||
@ -311,9 +312,9 @@ create_window1 (void)
|
|||||||
gtk_widget_show (menu_new_with_template1);
|
gtk_widget_show (menu_new_with_template1);
|
||||||
gtk_container_add (GTK_CONTAINER (file1_menu), menu_new_with_template1);
|
gtk_container_add (GTK_CONTAINER (file1_menu), menu_new_with_template1);
|
||||||
|
|
||||||
image2548 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
|
image2576 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2548);
|
gtk_widget_show (image2576);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2548);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2576);
|
||||||
|
|
||||||
menu_new_with_template1_menu = gtk_menu_new ();
|
menu_new_with_template1_menu = gtk_menu_new ();
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_new_with_template1), menu_new_with_template1_menu);
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_new_with_template1), menu_new_with_template1_menu);
|
||||||
@ -356,25 +357,25 @@ create_window1 (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (file1_menu), menu_save_all1);
|
gtk_container_add (GTK_CONTAINER (file1_menu), menu_save_all1);
|
||||||
gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
|
gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
|
||||||
|
|
||||||
image2549 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
|
image2577 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2549);
|
gtk_widget_show (image2577);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2549);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2577);
|
||||||
|
|
||||||
menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload"));
|
menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload"));
|
||||||
gtk_widget_show (menu_reload1);
|
gtk_widget_show (menu_reload1);
|
||||||
gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload1);
|
gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload1);
|
||||||
|
|
||||||
image2550 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
|
image2578 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2550);
|
gtk_widget_show (image2578);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2550);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2578);
|
||||||
|
|
||||||
menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload As"));
|
menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload As"));
|
||||||
gtk_widget_show (menu_reload_as1);
|
gtk_widget_show (menu_reload_as1);
|
||||||
gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload_as1);
|
gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload_as1);
|
||||||
|
|
||||||
image2551 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
|
image2579 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2551);
|
gtk_widget_show (image2579);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2551);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2579);
|
||||||
|
|
||||||
menu_reload_as1_menu = gtk_menu_new ();
|
menu_reload_as1_menu = gtk_menu_new ();
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu);
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu);
|
||||||
@ -418,18 +419,18 @@ create_window1 (void)
|
|||||||
gtk_widget_show (close_other_documents1);
|
gtk_widget_show (close_other_documents1);
|
||||||
gtk_container_add (GTK_CONTAINER (file1_menu), close_other_documents1);
|
gtk_container_add (GTK_CONTAINER (file1_menu), close_other_documents1);
|
||||||
|
|
||||||
image2552 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
|
image2580 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2552);
|
gtk_widget_show (image2580);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (close_other_documents1), image2552);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (close_other_documents1), image2580);
|
||||||
|
|
||||||
menu_close_all1 = gtk_image_menu_item_new_with_mnemonic (_("C_lose All"));
|
menu_close_all1 = gtk_image_menu_item_new_with_mnemonic (_("C_lose All"));
|
||||||
gtk_widget_show (menu_close_all1);
|
gtk_widget_show (menu_close_all1);
|
||||||
gtk_container_add (GTK_CONTAINER (file1_menu), menu_close_all1);
|
gtk_container_add (GTK_CONTAINER (file1_menu), menu_close_all1);
|
||||||
gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
|
gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
|
||||||
|
|
||||||
image2553 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
|
image2581 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2553);
|
gtk_widget_show (image2581);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2553);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2581);
|
||||||
|
|
||||||
menu_separatormenuitem1 = gtk_separator_menu_item_new ();
|
menu_separatormenuitem1 = gtk_separator_menu_item_new ();
|
||||||
gtk_widget_show (menu_separatormenuitem1);
|
gtk_widget_show (menu_separatormenuitem1);
|
||||||
@ -533,17 +534,17 @@ create_window1 (void)
|
|||||||
gtk_widget_show (menu_increase_indent1);
|
gtk_widget_show (menu_increase_indent1);
|
||||||
gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1);
|
gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1);
|
||||||
|
|
||||||
image2554 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
|
image2582 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2554);
|
gtk_widget_show (image2582);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2554);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2582);
|
||||||
|
|
||||||
menu_decrease_indent1 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent"));
|
menu_decrease_indent1 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent"));
|
||||||
gtk_widget_show (menu_decrease_indent1);
|
gtk_widget_show (menu_decrease_indent1);
|
||||||
gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_decrease_indent1);
|
gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_decrease_indent1);
|
||||||
|
|
||||||
image2555 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
|
image2583 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2555);
|
gtk_widget_show (image2583);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2555);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2583);
|
||||||
|
|
||||||
separator37 = gtk_separator_menu_item_new ();
|
separator37 = gtk_separator_menu_item_new ();
|
||||||
gtk_widget_show (separator37);
|
gtk_widget_show (separator37);
|
||||||
@ -569,9 +570,9 @@ create_window1 (void)
|
|||||||
gtk_widget_show (add_comments1);
|
gtk_widget_show (add_comments1);
|
||||||
gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
|
gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
|
||||||
|
|
||||||
image2556 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
image2584 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2556);
|
gtk_widget_show (image2584);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2556);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2584);
|
||||||
|
|
||||||
add_comments1_menu = gtk_menu_new ();
|
add_comments1_menu = gtk_menu_new ();
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu);
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu);
|
||||||
@ -610,9 +611,9 @@ create_window1 (void)
|
|||||||
gtk_widget_show (insert_date1);
|
gtk_widget_show (insert_date1);
|
||||||
gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1);
|
gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1);
|
||||||
|
|
||||||
image2557 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
image2585 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2557);
|
gtk_widget_show (image2585);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2557);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2585);
|
||||||
|
|
||||||
insert_date1_menu = gtk_menu_new ();
|
insert_date1_menu = gtk_menu_new ();
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu);
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu);
|
||||||
@ -624,9 +625,9 @@ create_window1 (void)
|
|||||||
gtk_widget_show (insert_include2);
|
gtk_widget_show (insert_include2);
|
||||||
gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
|
gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
|
||||||
|
|
||||||
image2558 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
image2586 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2558);
|
gtk_widget_show (image2586);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2558);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2586);
|
||||||
|
|
||||||
insert_include2_menu = gtk_menu_new ();
|
insert_include2_menu = gtk_menu_new ();
|
||||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu);
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu);
|
||||||
@ -670,9 +671,9 @@ create_window1 (void)
|
|||||||
gtk_widget_show (replace1);
|
gtk_widget_show (replace1);
|
||||||
gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
|
gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
|
||||||
|
|
||||||
image2559 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
|
image2587 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2559);
|
gtk_widget_show (image2587);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2559);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2587);
|
||||||
|
|
||||||
separator33 = gtk_separator_menu_item_new ();
|
separator33 = gtk_separator_menu_item_new ();
|
||||||
gtk_widget_show (separator33);
|
gtk_widget_show (separator33);
|
||||||
@ -709,9 +710,9 @@ create_window1 (void)
|
|||||||
gtk_widget_show (go_to_line1);
|
gtk_widget_show (go_to_line1);
|
||||||
gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
|
gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
|
||||||
|
|
||||||
image2560 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
|
image2588 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2560);
|
gtk_widget_show (image2588);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2560);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2588);
|
||||||
|
|
||||||
menu_view1 = gtk_menu_item_new_with_mnemonic (_("_View"));
|
menu_view1 = gtk_menu_item_new_with_mnemonic (_("_View"));
|
||||||
gtk_widget_show (menu_view1);
|
gtk_widget_show (menu_view1);
|
||||||
@ -725,9 +726,9 @@ create_window1 (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (menu_view1_menu), menu_change_font1);
|
gtk_container_add (GTK_CONTAINER (menu_view1_menu), menu_change_font1);
|
||||||
gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
|
gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
|
||||||
|
|
||||||
image2561 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
|
image2589 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2561);
|
gtk_widget_show (image2589);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2561);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2589);
|
||||||
|
|
||||||
menu_separator4 = gtk_separator_menu_item_new ();
|
menu_separator4 = gtk_separator_menu_item_new ();
|
||||||
gtk_widget_show (menu_separator4);
|
gtk_widget_show (menu_separator4);
|
||||||
@ -829,6 +830,11 @@ create_window1 (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (indent_type1_menu), spaces1);
|
gtk_container_add (GTK_CONTAINER (indent_type1_menu), spaces1);
|
||||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (spaces1), TRUE);
|
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (spaces1), TRUE);
|
||||||
|
|
||||||
|
tabs_and_spaces1 = gtk_radio_menu_item_new_with_mnemonic (tabs1_group, _("T_abs and Spaces"));
|
||||||
|
tabs1_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (tabs_and_spaces1));
|
||||||
|
gtk_widget_show (tabs_and_spaces1);
|
||||||
|
gtk_container_add (GTK_CONTAINER (indent_type1_menu), tabs_and_spaces1);
|
||||||
|
|
||||||
separator45 = gtk_separator_menu_item_new ();
|
separator45 = gtk_separator_menu_item_new ();
|
||||||
gtk_widget_show (separator45);
|
gtk_widget_show (separator45);
|
||||||
gtk_container_add (GTK_CONTAINER (menu_document1_menu), separator45);
|
gtk_container_add (GTK_CONTAINER (menu_document1_menu), separator45);
|
||||||
@ -952,25 +958,25 @@ create_window1 (void)
|
|||||||
gtk_widget_show (project_new1);
|
gtk_widget_show (project_new1);
|
||||||
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_new1);
|
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_new1);
|
||||||
|
|
||||||
image2562 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
|
image2590 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2562);
|
gtk_widget_show (image2590);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2562);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2590);
|
||||||
|
|
||||||
project_open1 = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
|
project_open1 = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
|
||||||
gtk_widget_show (project_open1);
|
gtk_widget_show (project_open1);
|
||||||
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_open1);
|
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_open1);
|
||||||
|
|
||||||
image2563 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
|
image2591 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2563);
|
gtk_widget_show (image2591);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2563);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2591);
|
||||||
|
|
||||||
project_close1 = gtk_image_menu_item_new_with_mnemonic (_("_Close"));
|
project_close1 = gtk_image_menu_item_new_with_mnemonic (_("_Close"));
|
||||||
gtk_widget_show (project_close1);
|
gtk_widget_show (project_close1);
|
||||||
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_close1);
|
gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_close1);
|
||||||
|
|
||||||
image2564 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
|
image2592 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2564);
|
gtk_widget_show (image2592);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2564);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2592);
|
||||||
|
|
||||||
separator34 = gtk_separator_menu_item_new ();
|
separator34 = gtk_separator_menu_item_new ();
|
||||||
gtk_widget_show (separator34);
|
gtk_widget_show (separator34);
|
||||||
@ -997,9 +1003,9 @@ create_window1 (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (tools1_menu), menu_choose_color1);
|
gtk_container_add (GTK_CONTAINER (tools1_menu), menu_choose_color1);
|
||||||
gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
|
gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
|
||||||
|
|
||||||
image2565 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
|
image2593 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2565);
|
gtk_widget_show (image2593);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2565);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2593);
|
||||||
|
|
||||||
menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count"));
|
menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count"));
|
||||||
gtk_widget_show (menu_count_words1);
|
gtk_widget_show (menu_count_words1);
|
||||||
@ -1016,9 +1022,9 @@ create_window1 (void)
|
|||||||
gtk_container_add (GTK_CONTAINER (tools1_menu), menu_reload_configuration1);
|
gtk_container_add (GTK_CONTAINER (tools1_menu), menu_reload_configuration1);
|
||||||
gtk_tooltips_set_tip (tooltips, menu_reload_configuration1, _("Reload configuration data like snippets, templates and filetype extensions."), NULL);
|
gtk_tooltips_set_tip (tooltips, menu_reload_configuration1, _("Reload configuration data like snippets, templates and filetype extensions."), NULL);
|
||||||
|
|
||||||
image2566 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU);
|
image2594 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2566);
|
gtk_widget_show (image2594);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_configuration1), image2566);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_configuration1), image2594);
|
||||||
|
|
||||||
menu_help1 = gtk_menu_item_new_with_mnemonic (_("_Help"));
|
menu_help1 = gtk_menu_item_new_with_mnemonic (_("_Help"));
|
||||||
gtk_widget_show (menu_help1);
|
gtk_widget_show (menu_help1);
|
||||||
@ -1031,9 +1037,9 @@ create_window1 (void)
|
|||||||
gtk_widget_show (help1);
|
gtk_widget_show (help1);
|
||||||
gtk_container_add (GTK_CONTAINER (menu_help1_menu), help1);
|
gtk_container_add (GTK_CONTAINER (menu_help1_menu), help1);
|
||||||
|
|
||||||
image2567 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
|
image2595 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show (image2567);
|
gtk_widget_show (image2595);
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2567);
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2595);
|
||||||
|
|
||||||
keyboard_shortcuts1 = gtk_menu_item_new_with_mnemonic (_("_Keyboard Shortcuts"));
|
keyboard_shortcuts1 = gtk_menu_item_new_with_mnemonic (_("_Keyboard Shortcuts"));
|
||||||
gtk_widget_show (keyboard_shortcuts1);
|
gtk_widget_show (keyboard_shortcuts1);
|
||||||
@ -1556,6 +1562,9 @@ create_window1 (void)
|
|||||||
g_signal_connect ((gpointer) spaces1, "activate",
|
g_signal_connect ((gpointer) spaces1, "activate",
|
||||||
G_CALLBACK (on_spaces1_activate),
|
G_CALLBACK (on_spaces1_activate),
|
||||||
NULL);
|
NULL);
|
||||||
|
g_signal_connect ((gpointer) tabs_and_spaces1, "activate",
|
||||||
|
G_CALLBACK (on_tabs_and_spaces1_activate),
|
||||||
|
NULL);
|
||||||
g_signal_connect ((gpointer) set_file_readonly1, "toggled",
|
g_signal_connect ((gpointer) set_file_readonly1, "toggled",
|
||||||
G_CALLBACK (on_set_file_readonly1_toggled),
|
G_CALLBACK (on_set_file_readonly1_toggled),
|
||||||
NULL);
|
NULL);
|
||||||
@ -1734,7 +1743,7 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, file1_menu, "file1_menu");
|
GLADE_HOOKUP_OBJECT (window1, file1_menu, "file1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_new1, "menu_new1");
|
GLADE_HOOKUP_OBJECT (window1, menu_new1, "menu_new1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1, "menu_new_with_template1");
|
GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1, "menu_new_with_template1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2548, "image2548");
|
GLADE_HOOKUP_OBJECT (window1, image2576, "image2576");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1_menu, "menu_new_with_template1_menu");
|
GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1_menu, "menu_new_with_template1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, invisible2, "invisible2");
|
GLADE_HOOKUP_OBJECT (window1, invisible2, "invisible2");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator12, "separator12");
|
GLADE_HOOKUP_OBJECT (window1, separator12, "separator12");
|
||||||
@ -1745,11 +1754,11 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, menu_save1, "menu_save1");
|
GLADE_HOOKUP_OBJECT (window1, menu_save1, "menu_save1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_save_as1, "menu_save_as1");
|
GLADE_HOOKUP_OBJECT (window1, menu_save_as1, "menu_save_as1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_save_all1, "menu_save_all1");
|
GLADE_HOOKUP_OBJECT (window1, menu_save_all1, "menu_save_all1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2549, "image2549");
|
GLADE_HOOKUP_OBJECT (window1, image2577, "image2577");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1");
|
GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2550, "image2550");
|
GLADE_HOOKUP_OBJECT (window1, image2578, "image2578");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1");
|
GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2551, "image2551");
|
GLADE_HOOKUP_OBJECT (window1, image2579, "image2579");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu");
|
GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7");
|
GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator21, "separator21");
|
GLADE_HOOKUP_OBJECT (window1, separator21, "separator21");
|
||||||
@ -1760,9 +1769,9 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, separator14, "separator14");
|
GLADE_HOOKUP_OBJECT (window1, separator14, "separator14");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1");
|
GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, close_other_documents1, "close_other_documents1");
|
GLADE_HOOKUP_OBJECT (window1, close_other_documents1, "close_other_documents1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2552, "image2552");
|
GLADE_HOOKUP_OBJECT (window1, image2580, "image2580");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1");
|
GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2553, "image2553");
|
GLADE_HOOKUP_OBJECT (window1, image2581, "image2581");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1");
|
GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1");
|
GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, edit1, "edit1");
|
GLADE_HOOKUP_OBJECT (window1, edit1, "edit1");
|
||||||
@ -1787,16 +1796,16 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, menu_duplicate_line1, "menu_duplicate_line1");
|
GLADE_HOOKUP_OBJECT (window1, menu_duplicate_line1, "menu_duplicate_line1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator29, "separator29");
|
GLADE_HOOKUP_OBJECT (window1, separator29, "separator29");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_increase_indent1, "menu_increase_indent1");
|
GLADE_HOOKUP_OBJECT (window1, menu_increase_indent1, "menu_increase_indent1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2554, "image2554");
|
GLADE_HOOKUP_OBJECT (window1, image2582, "image2582");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1");
|
GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2555, "image2555");
|
GLADE_HOOKUP_OBJECT (window1, image2583, "image2583");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator37, "separator37");
|
GLADE_HOOKUP_OBJECT (window1, separator37, "separator37");
|
||||||
GLADE_HOOKUP_OBJECT (window1, send_selection_to2, "send_selection_to2");
|
GLADE_HOOKUP_OBJECT (window1, send_selection_to2, "send_selection_to2");
|
||||||
GLADE_HOOKUP_OBJECT (window1, send_selection_to2_menu, "send_selection_to2_menu");
|
GLADE_HOOKUP_OBJECT (window1, send_selection_to2_menu, "send_selection_to2_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, invisible13, "invisible13");
|
GLADE_HOOKUP_OBJECT (window1, invisible13, "invisible13");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator18, "separator18");
|
GLADE_HOOKUP_OBJECT (window1, separator18, "separator18");
|
||||||
GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1");
|
GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2556, "image2556");
|
GLADE_HOOKUP_OBJECT (window1, image2584, "image2584");
|
||||||
GLADE_HOOKUP_OBJECT (window1, add_comments1_menu, "add_comments1_menu");
|
GLADE_HOOKUP_OBJECT (window1, add_comments1_menu, "add_comments1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_add_changelog_entry1, "menu_add_changelog_entry1");
|
GLADE_HOOKUP_OBJECT (window1, menu_add_changelog_entry1, "menu_add_changelog_entry1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, insert_file_header1, "insert_file_header1");
|
GLADE_HOOKUP_OBJECT (window1, insert_file_header1, "insert_file_header1");
|
||||||
@ -1805,11 +1814,11 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, insert_gpl_notice2, "insert_gpl_notice2");
|
GLADE_HOOKUP_OBJECT (window1, insert_gpl_notice2, "insert_gpl_notice2");
|
||||||
GLADE_HOOKUP_OBJECT (window1, insert_bsd_license_notice2, "insert_bsd_license_notice2");
|
GLADE_HOOKUP_OBJECT (window1, insert_bsd_license_notice2, "insert_bsd_license_notice2");
|
||||||
GLADE_HOOKUP_OBJECT (window1, insert_date1, "insert_date1");
|
GLADE_HOOKUP_OBJECT (window1, insert_date1, "insert_date1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2557, "image2557");
|
GLADE_HOOKUP_OBJECT (window1, image2585, "image2585");
|
||||||
GLADE_HOOKUP_OBJECT (window1, insert_date1_menu, "insert_date1_menu");
|
GLADE_HOOKUP_OBJECT (window1, insert_date1_menu, "insert_date1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, invisible8, "invisible8");
|
GLADE_HOOKUP_OBJECT (window1, invisible8, "invisible8");
|
||||||
GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2");
|
GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2558, "image2558");
|
GLADE_HOOKUP_OBJECT (window1, image2586, "image2586");
|
||||||
GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu");
|
GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4");
|
GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator9, "separator9");
|
GLADE_HOOKUP_OBJECT (window1, separator9, "separator9");
|
||||||
@ -1821,7 +1830,7 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1");
|
GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1");
|
GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, replace1, "replace1");
|
GLADE_HOOKUP_OBJECT (window1, replace1, "replace1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2559, "image2559");
|
GLADE_HOOKUP_OBJECT (window1, image2587, "image2587");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator33, "separator33");
|
GLADE_HOOKUP_OBJECT (window1, separator33, "separator33");
|
||||||
GLADE_HOOKUP_OBJECT (window1, find_nextsel1, "find_nextsel1");
|
GLADE_HOOKUP_OBJECT (window1, find_nextsel1, "find_nextsel1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, find_prevsel1, "find_prevsel1");
|
GLADE_HOOKUP_OBJECT (window1, find_prevsel1, "find_prevsel1");
|
||||||
@ -1830,11 +1839,11 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, previous_message1, "previous_message1");
|
GLADE_HOOKUP_OBJECT (window1, previous_message1, "previous_message1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator32, "separator32");
|
GLADE_HOOKUP_OBJECT (window1, separator32, "separator32");
|
||||||
GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1");
|
GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2560, "image2560");
|
GLADE_HOOKUP_OBJECT (window1, image2588, "image2588");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_view1, "menu_view1");
|
GLADE_HOOKUP_OBJECT (window1, menu_view1, "menu_view1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_view1_menu, "menu_view1_menu");
|
GLADE_HOOKUP_OBJECT (window1, menu_view1_menu, "menu_view1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1");
|
GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2561, "image2561");
|
GLADE_HOOKUP_OBJECT (window1, image2589, "image2589");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4");
|
GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_toggle_all_additional_widgets1, "menu_toggle_all_additional_widgets1");
|
GLADE_HOOKUP_OBJECT (window1, menu_toggle_all_additional_widgets1, "menu_toggle_all_additional_widgets1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1");
|
GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1");
|
||||||
@ -1856,6 +1865,7 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, indent_type1_menu, "indent_type1_menu");
|
GLADE_HOOKUP_OBJECT (window1, indent_type1_menu, "indent_type1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, tabs1, "tabs1");
|
GLADE_HOOKUP_OBJECT (window1, tabs1, "tabs1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, spaces1, "spaces1");
|
GLADE_HOOKUP_OBJECT (window1, spaces1, "spaces1");
|
||||||
|
GLADE_HOOKUP_OBJECT (window1, tabs_and_spaces1, "tabs_and_spaces1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator45, "separator45");
|
GLADE_HOOKUP_OBJECT (window1, separator45, "separator45");
|
||||||
GLADE_HOOKUP_OBJECT (window1, set_file_readonly1, "set_file_readonly1");
|
GLADE_HOOKUP_OBJECT (window1, set_file_readonly1, "set_file_readonly1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_write_unicode_bom1, "menu_write_unicode_bom1");
|
GLADE_HOOKUP_OBJECT (window1, menu_write_unicode_bom1, "menu_write_unicode_bom1");
|
||||||
@ -1884,26 +1894,26 @@ create_window1 (void)
|
|||||||
GLADE_HOOKUP_OBJECT (window1, menu_project1, "menu_project1");
|
GLADE_HOOKUP_OBJECT (window1, menu_project1, "menu_project1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_project1_menu, "menu_project1_menu");
|
GLADE_HOOKUP_OBJECT (window1, menu_project1_menu, "menu_project1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, project_new1, "project_new1");
|
GLADE_HOOKUP_OBJECT (window1, project_new1, "project_new1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2562, "image2562");
|
GLADE_HOOKUP_OBJECT (window1, image2590, "image2590");
|
||||||
GLADE_HOOKUP_OBJECT (window1, project_open1, "project_open1");
|
GLADE_HOOKUP_OBJECT (window1, project_open1, "project_open1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2563, "image2563");
|
GLADE_HOOKUP_OBJECT (window1, image2591, "image2591");
|
||||||
GLADE_HOOKUP_OBJECT (window1, project_close1, "project_close1");
|
GLADE_HOOKUP_OBJECT (window1, project_close1, "project_close1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2564, "image2564");
|
GLADE_HOOKUP_OBJECT (window1, image2592, "image2592");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator34, "separator34");
|
GLADE_HOOKUP_OBJECT (window1, separator34, "separator34");
|
||||||
GLADE_HOOKUP_OBJECT (window1, project_properties1, "project_properties1");
|
GLADE_HOOKUP_OBJECT (window1, project_properties1, "project_properties1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_build1, "menu_build1");
|
GLADE_HOOKUP_OBJECT (window1, menu_build1, "menu_build1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, tools1, "tools1");
|
GLADE_HOOKUP_OBJECT (window1, tools1, "tools1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, tools1_menu, "tools1_menu");
|
GLADE_HOOKUP_OBJECT (window1, tools1_menu, "tools1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1");
|
GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2565, "image2565");
|
GLADE_HOOKUP_OBJECT (window1, image2593, "image2593");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1");
|
GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, load_tags1, "load_tags1");
|
GLADE_HOOKUP_OBJECT (window1, load_tags1, "load_tags1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_reload_configuration1, "menu_reload_configuration1");
|
GLADE_HOOKUP_OBJECT (window1, menu_reload_configuration1, "menu_reload_configuration1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2566, "image2566");
|
GLADE_HOOKUP_OBJECT (window1, image2594, "image2594");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_help1, "menu_help1");
|
GLADE_HOOKUP_OBJECT (window1, menu_help1, "menu_help1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, menu_help1_menu, "menu_help1_menu");
|
GLADE_HOOKUP_OBJECT (window1, menu_help1_menu, "menu_help1_menu");
|
||||||
GLADE_HOOKUP_OBJECT (window1, help1, "help1");
|
GLADE_HOOKUP_OBJECT (window1, help1, "help1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, image2567, "image2567");
|
GLADE_HOOKUP_OBJECT (window1, image2595, "image2595");
|
||||||
GLADE_HOOKUP_OBJECT (window1, keyboard_shortcuts1, "keyboard_shortcuts1");
|
GLADE_HOOKUP_OBJECT (window1, keyboard_shortcuts1, "keyboard_shortcuts1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, website1, "website1");
|
GLADE_HOOKUP_OBJECT (window1, website1, "website1");
|
||||||
GLADE_HOOKUP_OBJECT (window1, separator16, "separator16");
|
GLADE_HOOKUP_OBJECT (window1, separator16, "separator16");
|
||||||
@ -2669,14 +2679,19 @@ create_prefs_dialog (void)
|
|||||||
GtkWidget *table13;
|
GtkWidget *table13;
|
||||||
GtkWidget *label183;
|
GtkWidget *label183;
|
||||||
GtkWidget *combo_auto_indent_mode;
|
GtkWidget *combo_auto_indent_mode;
|
||||||
|
GtkWidget *label200;
|
||||||
|
GtkWidget *label222;
|
||||||
|
GtkObject *spin_indent_width_adj;
|
||||||
|
GtkWidget *spin_indent_width;
|
||||||
|
GtkWidget *radio_indent_spaces;
|
||||||
|
GSList *radio_indent_spaces_group = NULL;
|
||||||
|
GtkWidget *radio_indent_tabs;
|
||||||
|
GtkWidget *radio_indent_both;
|
||||||
|
GtkWidget *alignment41;
|
||||||
|
GtkWidget *hbox13;
|
||||||
|
GtkWidget *label221;
|
||||||
GtkObject *spin_tab_width_adj;
|
GtkObject *spin_tab_width_adj;
|
||||||
GtkWidget *spin_tab_width;
|
GtkWidget *spin_tab_width;
|
||||||
GtkWidget *label116;
|
|
||||||
GtkWidget *hbox8;
|
|
||||||
GtkWidget *radio_indent_tabs;
|
|
||||||
GSList *radio_indent_tabs_group = NULL;
|
|
||||||
GtkWidget *radio_indent_spaces;
|
|
||||||
GtkWidget *label200;
|
|
||||||
GtkWidget *check_detect_indent;
|
GtkWidget *check_detect_indent;
|
||||||
GtkWidget *label195;
|
GtkWidget *label195;
|
||||||
GtkWidget *frame14;
|
GtkWidget *frame14;
|
||||||
@ -3595,7 +3610,7 @@ create_prefs_dialog (void)
|
|||||||
gtk_widget_show (vbox25);
|
gtk_widget_show (vbox25);
|
||||||
gtk_container_add (GTK_CONTAINER (alignment30), vbox25);
|
gtk_container_add (GTK_CONTAINER (alignment30), vbox25);
|
||||||
|
|
||||||
table13 = gtk_table_new (4, 2, FALSE);
|
table13 = gtk_table_new (7, 2, FALSE);
|
||||||
gtk_widget_show (table13);
|
gtk_widget_show (table13);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox25), table13, FALSE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox25), table13, FALSE, TRUE, 0);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table13), 3);
|
gtk_table_set_row_spacings (GTK_TABLE (table13), 3);
|
||||||
@ -3603,13 +3618,14 @@ create_prefs_dialog (void)
|
|||||||
|
|
||||||
label183 = gtk_label_new (_("Auto-indent mode:"));
|
label183 = gtk_label_new (_("Auto-indent mode:"));
|
||||||
gtk_widget_show (label183);
|
gtk_widget_show (label183);
|
||||||
gtk_table_attach (GTK_TABLE (table13), label183, 0, 1, 3, 4,
|
gtk_table_attach (GTK_TABLE (table13), label183, 0, 1, 6, 7,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label183), 0, 0.5);
|
||||||
|
|
||||||
combo_auto_indent_mode = gtk_combo_box_new_text ();
|
combo_auto_indent_mode = gtk_combo_box_new_text ();
|
||||||
gtk_widget_show (combo_auto_indent_mode);
|
gtk_widget_show (combo_auto_indent_mode);
|
||||||
gtk_table_attach (GTK_TABLE (table13), combo_auto_indent_mode, 1, 2, 3, 4,
|
gtk_table_attach (GTK_TABLE (table13), combo_auto_indent_mode, 1, 2, 6, 7,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
(GtkAttachOptions) (GTK_FILL), 0, 0);
|
||||||
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("None"));
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("None"));
|
||||||
@ -3617,54 +3633,85 @@ create_prefs_dialog (void)
|
|||||||
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Current chars"));
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Current chars"));
|
||||||
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Match braces"));
|
gtk_combo_box_append_text (GTK_COMBO_BOX (combo_auto_indent_mode), _("Match braces"));
|
||||||
|
|
||||||
spin_tab_width_adj = gtk_adjustment_new (1, 1, 99, 1, 10, 10);
|
|
||||||
spin_tab_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_tab_width_adj), 1, 0);
|
|
||||||
gtk_widget_show (spin_tab_width);
|
|
||||||
gtk_table_attach (GTK_TABLE (table13), spin_tab_width, 1, 2, 2, 3,
|
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
|
||||||
gtk_tooltips_set_tip (tooltips, spin_tab_width, _("The width in chars, which one tab character will take"), NULL);
|
|
||||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
|
|
||||||
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_tab_width), GTK_UPDATE_IF_VALID);
|
|
||||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
|
|
||||||
|
|
||||||
label116 = gtk_label_new (_("Tab width:"));
|
|
||||||
gtk_widget_show (label116);
|
|
||||||
gtk_table_attach (GTK_TABLE (table13), label116, 0, 1, 2, 3,
|
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
|
||||||
gtk_misc_set_alignment (GTK_MISC (label116), 0, 0.5);
|
|
||||||
|
|
||||||
hbox8 = gtk_hbox_new (FALSE, 12);
|
|
||||||
gtk_widget_show (hbox8);
|
|
||||||
gtk_table_attach (GTK_TABLE (table13), hbox8, 1, 2, 0, 1,
|
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
|
||||||
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
|
|
||||||
|
|
||||||
radio_indent_tabs = gtk_radio_button_new_with_mnemonic (NULL, _("_Tabs"));
|
|
||||||
gtk_widget_show (radio_indent_tabs);
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox8), radio_indent_tabs, FALSE, FALSE, 0);
|
|
||||||
gtk_tooltips_set_tip (tooltips, radio_indent_tabs, _("Whether to use tabs or spaces when indentation is inserted."), NULL);
|
|
||||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_tabs), radio_indent_tabs_group);
|
|
||||||
radio_indent_tabs_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_tabs));
|
|
||||||
|
|
||||||
radio_indent_spaces = gtk_radio_button_new_with_mnemonic (NULL, _("_Spaces"));
|
|
||||||
gtk_widget_show (radio_indent_spaces);
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox8), radio_indent_spaces, FALSE, FALSE, 0);
|
|
||||||
gtk_tooltips_set_tip (tooltips, radio_indent_spaces, _("Whether to use tabs or spaces when indentation is inserted."), NULL);
|
|
||||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_spaces), radio_indent_tabs_group);
|
|
||||||
radio_indent_tabs_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_spaces));
|
|
||||||
|
|
||||||
label200 = gtk_label_new (_("Type:"));
|
label200 = gtk_label_new (_("Type:"));
|
||||||
gtk_widget_show (label200);
|
gtk_widget_show (label200);
|
||||||
gtk_table_attach (GTK_TABLE (table13), label200, 0, 1, 0, 1,
|
gtk_table_attach (GTK_TABLE (table13), label200, 0, 1, 1, 2,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
gtk_misc_set_alignment (GTK_MISC (label200), 0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label200), 0, 0.5);
|
||||||
|
|
||||||
|
label222 = gtk_label_new (_("Width:"));
|
||||||
|
gtk_widget_show (label222);
|
||||||
|
gtk_table_attach (GTK_TABLE (table13), label222, 0, 1, 0, 1,
|
||||||
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label222), 0, 0.5);
|
||||||
|
|
||||||
|
spin_indent_width_adj = gtk_adjustment_new (1, 1, 99, 1, 10, 10);
|
||||||
|
spin_indent_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_indent_width_adj), 1, 0);
|
||||||
|
gtk_widget_show (spin_indent_width);
|
||||||
|
gtk_table_attach (GTK_TABLE (table13), spin_indent_width, 1, 2, 0, 1,
|
||||||
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
|
||||||
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
|
gtk_tooltips_set_tip (tooltips, spin_indent_width, _("The width in chars of a single indent"), NULL);
|
||||||
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_indent_width), TRUE);
|
||||||
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_indent_width), GTK_UPDATE_IF_VALID);
|
||||||
|
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_indent_width), TRUE);
|
||||||
|
|
||||||
|
radio_indent_spaces = gtk_radio_button_new_with_mnemonic (NULL, _("_Spaces"));
|
||||||
|
gtk_widget_show (radio_indent_spaces);
|
||||||
|
gtk_table_attach (GTK_TABLE (table13), radio_indent_spaces, 1, 2, 2, 3,
|
||||||
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
|
gtk_tooltips_set_tip (tooltips, radio_indent_spaces, _("Use spaces when inserting indentation"), NULL);
|
||||||
|
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_spaces), radio_indent_spaces_group);
|
||||||
|
radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_spaces));
|
||||||
|
|
||||||
|
radio_indent_tabs = gtk_radio_button_new_with_mnemonic (NULL, _("_Tabs"));
|
||||||
|
gtk_widget_show (radio_indent_tabs);
|
||||||
|
gtk_table_attach (GTK_TABLE (table13), radio_indent_tabs, 1, 2, 1, 2,
|
||||||
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
|
gtk_tooltips_set_tip (tooltips, radio_indent_tabs, _("Use one tab per indent"), NULL);
|
||||||
|
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_tabs), radio_indent_spaces_group);
|
||||||
|
radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_tabs));
|
||||||
|
|
||||||
|
radio_indent_both = gtk_radio_button_new_with_mnemonic (NULL, _("T_abs and Spaces"));
|
||||||
|
gtk_widget_show (radio_indent_both);
|
||||||
|
gtk_table_attach (GTK_TABLE (table13), radio_indent_both, 1, 2, 3, 4,
|
||||||
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
|
gtk_tooltips_set_tip (tooltips, radio_indent_both, _("Use spaces if the total indent is less than the tab width, otherwise use both"), NULL);
|
||||||
|
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_indent_both), radio_indent_spaces_group);
|
||||||
|
radio_indent_spaces_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_indent_both));
|
||||||
|
|
||||||
|
alignment41 = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||||
|
gtk_widget_show (alignment41);
|
||||||
|
gtk_table_attach (GTK_TABLE (table13), alignment41, 1, 2, 4, 5,
|
||||||
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
|
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
|
||||||
|
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment41), 0, 0, 24, 0);
|
||||||
|
|
||||||
|
hbox13 = gtk_hbox_new (FALSE, 12);
|
||||||
|
gtk_widget_show (hbox13);
|
||||||
|
gtk_container_add (GTK_CONTAINER (alignment41), hbox13);
|
||||||
|
|
||||||
|
label221 = gtk_label_new (_("Tab Width:"));
|
||||||
|
gtk_widget_show (label221);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox13), label221, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
spin_tab_width_adj = gtk_adjustment_new (8, 1, 99, 1, 10, 10);
|
||||||
|
spin_tab_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_tab_width_adj), 1, 0);
|
||||||
|
gtk_widget_show (spin_tab_width);
|
||||||
|
gtk_box_pack_start (GTK_BOX (hbox13), spin_tab_width, TRUE, TRUE, 0);
|
||||||
|
gtk_tooltips_set_tip (tooltips, spin_tab_width, _("The width of a tab when Tabs & Spaces is set for a document"), NULL);
|
||||||
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
|
||||||
|
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_tab_width), GTK_UPDATE_IF_VALID);
|
||||||
|
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
|
||||||
|
|
||||||
check_detect_indent = gtk_check_button_new_with_mnemonic (_("Detect from file"));
|
check_detect_indent = gtk_check_button_new_with_mnemonic (_("Detect from file"));
|
||||||
gtk_widget_show (check_detect_indent);
|
gtk_widget_show (check_detect_indent);
|
||||||
gtk_table_attach (GTK_TABLE (table13), check_detect_indent, 1, 2, 1, 2,
|
gtk_table_attach (GTK_TABLE (table13), check_detect_indent, 1, 2, 5, 6,
|
||||||
(GtkAttachOptions) (GTK_FILL),
|
(GtkAttachOptions) (GTK_FILL),
|
||||||
(GtkAttachOptions) (0), 0, 0);
|
(GtkAttachOptions) (0), 0, 0);
|
||||||
gtk_tooltips_set_tip (tooltips, check_detect_indent, _("Whether to detect the indentation type from file contents when a file is opened."), NULL);
|
gtk_tooltips_set_tip (tooltips, check_detect_indent, _("Whether to detect the indentation type from file contents when a file is opened."), NULL);
|
||||||
@ -4766,6 +4813,10 @@ create_prefs_dialog (void)
|
|||||||
gtk_dialog_add_action_widget (GTK_DIALOG (prefs_dialog), button5, GTK_RESPONSE_OK);
|
gtk_dialog_add_action_widget (GTK_DIALOG (prefs_dialog), button5, GTK_RESPONSE_OK);
|
||||||
GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT);
|
GTK_WIDGET_SET_FLAGS (button5, GTK_CAN_DEFAULT);
|
||||||
|
|
||||||
|
g_signal_connect ((gpointer) radio_indent_both, "toggled",
|
||||||
|
G_CALLBACK (on_radio_indent_both_toggled),
|
||||||
|
NULL);
|
||||||
|
|
||||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||||
GLADE_HOOKUP_OBJECT_NO_REF (prefs_dialog, prefs_dialog, "prefs_dialog");
|
GLADE_HOOKUP_OBJECT_NO_REF (prefs_dialog, prefs_dialog, "prefs_dialog");
|
||||||
GLADE_HOOKUP_OBJECT_NO_REF (prefs_dialog, dialog_vbox3, "dialog_vbox3");
|
GLADE_HOOKUP_OBJECT_NO_REF (prefs_dialog, dialog_vbox3, "dialog_vbox3");
|
||||||
@ -4893,12 +4944,16 @@ create_prefs_dialog (void)
|
|||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, table13, "table13");
|
GLADE_HOOKUP_OBJECT (prefs_dialog, table13, "table13");
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label183, "label183");
|
GLADE_HOOKUP_OBJECT (prefs_dialog, label183, "label183");
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, combo_auto_indent_mode, "combo_auto_indent_mode");
|
GLADE_HOOKUP_OBJECT (prefs_dialog, combo_auto_indent_mode, "combo_auto_indent_mode");
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, spin_tab_width, "spin_tab_width");
|
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label116, "label116");
|
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, hbox8, "hbox8");
|
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_tabs, "radio_indent_tabs");
|
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_spaces, "radio_indent_spaces");
|
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label200, "label200");
|
GLADE_HOOKUP_OBJECT (prefs_dialog, label200, "label200");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, label222, "label222");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, spin_indent_width, "spin_indent_width");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_spaces, "radio_indent_spaces");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_tabs, "radio_indent_tabs");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, radio_indent_both, "radio_indent_both");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment41, "alignment41");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, hbox13, "hbox13");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, label221, "label221");
|
||||||
|
GLADE_HOOKUP_OBJECT (prefs_dialog, spin_tab_width, "spin_tab_width");
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_detect_indent, "check_detect_indent");
|
GLADE_HOOKUP_OBJECT (prefs_dialog, check_detect_indent, "check_detect_indent");
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label195, "label195");
|
GLADE_HOOKUP_OBJECT (prefs_dialog, label195, "label195");
|
||||||
GLADE_HOOKUP_OBJECT (prefs_dialog, frame14, "frame14");
|
GLADE_HOOKUP_OBJECT (prefs_dialog, frame14, "frame14");
|
||||||
|
143
src/keyfile.c
143
src/keyfile.c
@ -89,27 +89,107 @@ static gint hpan_position;
|
|||||||
static gint vpan_position;
|
static gint vpan_position;
|
||||||
|
|
||||||
|
|
||||||
/* Used in e.g. save_bool_prefs(). */
|
typedef enum SettingCallbackAction
|
||||||
|
{
|
||||||
|
SETTING_READ,
|
||||||
|
SETTING_WRITE
|
||||||
|
}
|
||||||
|
SettingCallbackAction;
|
||||||
|
|
||||||
|
|
||||||
typedef struct SettingEntry
|
typedef struct SettingEntry
|
||||||
{
|
{
|
||||||
|
gpointer setting;
|
||||||
const gchar *group;
|
const gchar *group;
|
||||||
const gchar *key_name;
|
const gchar *key_name;
|
||||||
gpointer setting;
|
|
||||||
gpointer default_value;
|
gpointer default_value;
|
||||||
}
|
}
|
||||||
SettingEntry;
|
SettingEntry;
|
||||||
|
|
||||||
static SettingEntry bool_prefs[] =
|
|
||||||
{
|
|
||||||
{PACKAGE, "cmdline_new_files", &file_prefs.cmdline_new_files, GINT_TO_POINTER(TRUE)},
|
|
||||||
|
|
||||||
{PACKAGE, "pref_main_suppress_search_dialogs", &search_prefs.suppress_dialogs, GINT_TO_POINTER(FALSE)},
|
static void bool_settings_foreach(GKeyFile *config, SettingCallbackAction action)
|
||||||
{PACKAGE, "pref_main_search_use_current_word", &search_prefs.use_current_word, GINT_TO_POINTER(TRUE)},
|
{
|
||||||
{"search", "pref_search_current_file_dir", &search_prefs.use_current_file_dir, GINT_TO_POINTER(TRUE)},
|
guint i;
|
||||||
{NULL, NULL, NULL, NULL} /* must be terminated */
|
SettingEntry items[] =
|
||||||
|
{
|
||||||
|
{&file_prefs.cmdline_new_files, PACKAGE, "cmdline_new_files", (gpointer)TRUE},
|
||||||
|
|
||||||
|
{&search_prefs.suppress_dialogs, PACKAGE, "pref_main_suppress_search_dialogs", (gpointer)FALSE},
|
||||||
|
{&search_prefs.use_current_word, PACKAGE, "pref_main_search_use_current_word", (gpointer)TRUE},
|
||||||
|
{&search_prefs.use_current_file_dir, "search", "pref_search_current_file_dir", (gpointer)TRUE},
|
||||||
|
|
||||||
|
{&editor_prefs.indentation->detect_type, PACKAGE, "check_detect_indent", (gpointer)FALSE},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(items); i++)
|
||||||
|
{
|
||||||
|
SettingEntry *se = &items[i];
|
||||||
|
gboolean *setting = se->setting;
|
||||||
|
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case SETTING_READ:
|
||||||
|
*setting = utils_get_setting_boolean(config, se->group, se->key_name,
|
||||||
|
GPOINTER_TO_INT(se->default_value));
|
||||||
|
break;
|
||||||
|
case SETTING_WRITE:
|
||||||
|
g_key_file_set_boolean(config, se->group, se->key_name, *setting);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void int_settings_foreach(GKeyFile *config, SettingCallbackAction action)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
SettingEntry items[] =
|
||||||
|
{
|
||||||
|
{&editor_prefs.indentation->width, PACKAGE, "pref_editor_tab_width", (gpointer)4},
|
||||||
|
{&editor_prefs.indentation->tab_width, PACKAGE, "indent_tab_width", (gpointer)8},
|
||||||
|
{&editor_prefs.indentation->auto_indent_mode, PACKAGE, "indent_mode",
|
||||||
|
(gpointer)GEANY_AUTOINDENT_CURRENTCHARS},
|
||||||
|
{&editor_prefs.indentation->type, PACKAGE, "indent_type", (gpointer)GEANY_INDENT_TYPE_TABS},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(items); i++)
|
||||||
|
{
|
||||||
|
SettingEntry *se = &items[i];
|
||||||
|
gboolean *setting = se->setting;
|
||||||
|
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case SETTING_READ:
|
||||||
|
*setting = utils_get_setting_integer(config, se->group, se->key_name,
|
||||||
|
GPOINTER_TO_INT(se->default_value));
|
||||||
|
break;
|
||||||
|
case SETTING_WRITE:
|
||||||
|
g_key_file_set_integer(config, se->group, se->key_name, *setting);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (*SettingItemsCallback)(GKeyFile *config, SettingCallbackAction action);
|
||||||
|
|
||||||
|
/* List of functions which hold the SettingEntry arrays. These allow access to
|
||||||
|
* runtime setting fields like EditorPrefs::indentation->width. */
|
||||||
|
SettingItemsCallback setting_item_callbacks[] = {
|
||||||
|
bool_settings_foreach,
|
||||||
|
int_settings_foreach
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void settings_action(GKeyFile *config, SettingCallbackAction action)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(setting_item_callbacks); i++)
|
||||||
|
setting_item_callbacks[i](config, action);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void save_recent_files(GKeyFile *config)
|
static void save_recent_files(GKeyFile *config)
|
||||||
{
|
{
|
||||||
gchar **recent_files = g_new0(gchar*, file_prefs.mru_length + 1);
|
gchar **recent_files = g_new0(gchar*, file_prefs.mru_length + 1);
|
||||||
@ -150,7 +230,7 @@ static gchar *get_session_file_string(GeanyDocument *doc)
|
|||||||
ft->name,
|
ft->name,
|
||||||
doc->readonly,
|
doc->readonly,
|
||||||
encodings_get_idx_from_charset(doc->encoding),
|
encodings_get_idx_from_charset(doc->encoding),
|
||||||
doc->editor->use_tabs,
|
doc->editor->indent_type,
|
||||||
doc->editor->auto_indent,
|
doc->editor->auto_indent,
|
||||||
doc->editor->line_wrapping,
|
doc->editor->line_wrapping,
|
||||||
doc->file_name);
|
doc->file_name);
|
||||||
@ -205,20 +285,9 @@ void configuration_save_session_files(GKeyFile *config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void save_bool_prefs(GKeyFile *config)
|
|
||||||
{
|
|
||||||
SettingEntry *pe;
|
|
||||||
|
|
||||||
for (pe = bool_prefs; pe->group != NULL; pe++)
|
|
||||||
{
|
|
||||||
g_key_file_set_boolean(config, pe->group, pe->key_name, *(gboolean*)pe->setting);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void save_dialog_prefs(GKeyFile *config)
|
static void save_dialog_prefs(GKeyFile *config)
|
||||||
{
|
{
|
||||||
save_bool_prefs(config);
|
settings_action(config, SETTING_WRITE);
|
||||||
|
|
||||||
/* Some of the key names are not consistent, but this is for backwards compatibility */
|
/* Some of the key names are not consistent, but this is for backwards compatibility */
|
||||||
|
|
||||||
@ -262,15 +331,11 @@ static void save_dialog_prefs(GKeyFile *config)
|
|||||||
g_key_file_set_integer(config, PACKAGE, "symbolcompletion_min_chars", editor_prefs.symbolcompletion_min_chars);
|
g_key_file_set_integer(config, PACKAGE, "symbolcompletion_min_chars", editor_prefs.symbolcompletion_min_chars);
|
||||||
g_key_file_set_boolean(config, PACKAGE, "use_folding", editor_prefs.folding);
|
g_key_file_set_boolean(config, PACKAGE, "use_folding", editor_prefs.folding);
|
||||||
g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", editor_prefs.unfold_all_children);
|
g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", editor_prefs.unfold_all_children);
|
||||||
g_key_file_set_integer(config, PACKAGE, "indent_mode", editor_prefs.indent_mode);
|
|
||||||
g_key_file_set_integer(config, PACKAGE, "check_detect_indent", editor_prefs.detect_tab_mode);
|
|
||||||
g_key_file_set_boolean(config, PACKAGE, "use_indicators", editor_prefs.use_indicators);
|
g_key_file_set_boolean(config, PACKAGE, "use_indicators", editor_prefs.use_indicators);
|
||||||
g_key_file_set_boolean(config, PACKAGE, "line_wrapping", editor_prefs.line_wrapping);
|
g_key_file_set_boolean(config, PACKAGE, "line_wrapping", editor_prefs.line_wrapping);
|
||||||
g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", editor_prefs.auto_close_xml_tags);
|
g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", editor_prefs.auto_close_xml_tags);
|
||||||
g_key_file_set_boolean(config, PACKAGE, "complete_snippets", editor_prefs.complete_snippets);
|
g_key_file_set_boolean(config, PACKAGE, "complete_snippets", editor_prefs.complete_snippets);
|
||||||
g_key_file_set_boolean(config, PACKAGE, "auto_complete_symbols", editor_prefs.auto_complete_symbols);
|
g_key_file_set_boolean(config, PACKAGE, "auto_complete_symbols", editor_prefs.auto_complete_symbols);
|
||||||
g_key_file_set_integer(config, PACKAGE, "pref_editor_tab_width", editor_prefs.tab_width);
|
|
||||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_use_tabs", editor_prefs.use_tabs);
|
|
||||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_disable_dnd", editor_prefs.disable_dnd);
|
g_key_file_set_boolean(config, PACKAGE, "pref_editor_disable_dnd", editor_prefs.disable_dnd);
|
||||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_smart_home_key", editor_prefs.smart_home_key);
|
g_key_file_set_boolean(config, PACKAGE, "pref_editor_smart_home_key", editor_prefs.smart_home_key);
|
||||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_newline_strip", editor_prefs.newline_strip);
|
g_key_file_set_boolean(config, PACKAGE, "pref_editor_newline_strip", editor_prefs.newline_strip);
|
||||||
@ -512,18 +577,6 @@ void configuration_load_session_files(GKeyFile *config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void load_bool_prefs(GKeyFile *config)
|
|
||||||
{
|
|
||||||
SettingEntry *pe;
|
|
||||||
|
|
||||||
for (pe = bool_prefs; pe->group != NULL; pe++)
|
|
||||||
{
|
|
||||||
*(gboolean*)pe->setting = utils_get_setting_boolean(config, pe->group, pe->key_name,
|
|
||||||
GPOINTER_TO_INT(pe->default_value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define GEANY_GET_SETTING(propertyname, value, default_value) \
|
#define GEANY_GET_SETTING(propertyname, value, default_value) \
|
||||||
if (g_object_class_find_property( \
|
if (g_object_class_find_property( \
|
||||||
G_OBJECT_GET_CLASS(G_OBJECT(gtk_settings_get_default())), propertyname)) \
|
G_OBJECT_GET_CLASS(G_OBJECT(gtk_settings_get_default())), propertyname)) \
|
||||||
@ -537,7 +590,7 @@ static void load_dialog_prefs(GKeyFile *config)
|
|||||||
gchar *tmp_string, *tmp_string2;
|
gchar *tmp_string, *tmp_string2;
|
||||||
const gchar *default_charset = NULL;
|
const gchar *default_charset = NULL;
|
||||||
|
|
||||||
load_bool_prefs(config);
|
settings_action(config, SETTING_READ);
|
||||||
|
|
||||||
/* general */
|
/* general */
|
||||||
prefs.confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", FALSE);
|
prefs.confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", FALSE);
|
||||||
@ -575,8 +628,6 @@ static void load_dialog_prefs(GKeyFile *config)
|
|||||||
editor_prefs.symbolcompletion_min_chars = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_min_chars", GEANY_MIN_SYMBOLLIST_CHARS);
|
editor_prefs.symbolcompletion_min_chars = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_min_chars", GEANY_MIN_SYMBOLLIST_CHARS);
|
||||||
editor_prefs.symbolcompletion_max_height = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_max_height", GEANY_MAX_SYMBOLLIST_HEIGHT);
|
editor_prefs.symbolcompletion_max_height = utils_get_setting_integer(config, PACKAGE, "symbolcompletion_max_height", GEANY_MAX_SYMBOLLIST_HEIGHT);
|
||||||
editor_prefs.line_wrapping = utils_get_setting_boolean(config, PACKAGE, "line_wrapping", FALSE); /* default is off for better performance */
|
editor_prefs.line_wrapping = utils_get_setting_boolean(config, PACKAGE, "line_wrapping", FALSE); /* default is off for better performance */
|
||||||
editor_prefs.indent_mode = utils_get_setting_integer(config, PACKAGE, "indent_mode", INDENT_CURRENTCHARS);
|
|
||||||
editor_prefs.detect_tab_mode = utils_get_setting_integer(config, PACKAGE, "check_detect_indent", FALSE);
|
|
||||||
editor_prefs.use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
|
editor_prefs.use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
|
||||||
editor_prefs.use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
|
editor_prefs.use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
|
||||||
editor_prefs.show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE);
|
editor_prefs.show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE);
|
||||||
@ -591,8 +642,6 @@ static void load_dialog_prefs(GKeyFile *config)
|
|||||||
editor_prefs.show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
|
editor_prefs.show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
|
||||||
editor_prefs.show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
|
editor_prefs.show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
|
||||||
editor_prefs.brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
|
editor_prefs.brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
|
||||||
editor_prefs.tab_width = utils_get_setting_integer(config, PACKAGE, "pref_editor_tab_width", 4);
|
|
||||||
editor_prefs.use_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_use_tabs", TRUE);
|
|
||||||
editor_prefs.disable_dnd = utils_get_setting_boolean(config, PACKAGE, "pref_editor_disable_dnd", FALSE);
|
editor_prefs.disable_dnd = utils_get_setting_boolean(config, PACKAGE, "pref_editor_disable_dnd", FALSE);
|
||||||
editor_prefs.smart_home_key = utils_get_setting_boolean(config, PACKAGE, "pref_editor_smart_home_key", TRUE);
|
editor_prefs.smart_home_key = utils_get_setting_boolean(config, PACKAGE, "pref_editor_smart_home_key", TRUE);
|
||||||
editor_prefs.newline_strip = utils_get_setting_boolean(config, PACKAGE, "pref_editor_newline_strip", FALSE);
|
editor_prefs.newline_strip = utils_get_setting_boolean(config, PACKAGE, "pref_editor_newline_strip", FALSE);
|
||||||
@ -876,15 +925,15 @@ static gboolean open_session_file(gchar **tmp)
|
|||||||
guint pos;
|
guint pos;
|
||||||
const gchar *ft_name;
|
const gchar *ft_name;
|
||||||
gchar *locale_filename;
|
gchar *locale_filename;
|
||||||
gint enc_idx;
|
gint enc_idx, indent_type;
|
||||||
gboolean ro, use_tabs, auto_indent, line_wrapping;
|
gboolean ro, auto_indent, line_wrapping;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
pos = atoi(tmp[0]);
|
pos = atoi(tmp[0]);
|
||||||
ft_name = tmp[1];
|
ft_name = tmp[1];
|
||||||
ro = atoi(tmp[2]);
|
ro = atoi(tmp[2]);
|
||||||
enc_idx = atoi(tmp[3]);
|
enc_idx = atoi(tmp[3]);
|
||||||
use_tabs = atoi(tmp[4]);
|
indent_type = atoi(tmp[4]);
|
||||||
auto_indent = atoi(tmp[5]);
|
auto_indent = atoi(tmp[5]);
|
||||||
line_wrapping = atoi(tmp[6]);
|
line_wrapping = atoi(tmp[6]);
|
||||||
/* try to get the locale equivalent for the filename */
|
/* try to get the locale equivalent for the filename */
|
||||||
@ -900,7 +949,7 @@ static gboolean open_session_file(gchar **tmp)
|
|||||||
|
|
||||||
if (doc)
|
if (doc)
|
||||||
{
|
{
|
||||||
editor_set_use_tabs(doc->editor, use_tabs);
|
editor_set_indent_type(doc->editor, indent_type);
|
||||||
editor_set_line_wrapping(doc->editor, line_wrapping);
|
editor_set_line_wrapping(doc->editor, line_wrapping);
|
||||||
doc->editor->auto_indent = auto_indent;
|
doc->editor->auto_indent = auto_indent;
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
11
src/main.c
11
src/main.c
@ -252,14 +252,6 @@ static void apply_settings(void)
|
|||||||
gtk_widget_hide(ui_widgets.statusbar);
|
gtk_widget_hide(ui_widgets.statusbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
ignore_callback = TRUE;
|
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
|
|
||||||
lookup_widget(main_widgets.window, "menu_line_wrapping1")), editor_prefs.line_wrapping);
|
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
|
|
||||||
lookup_widget(main_widgets.window, "menu_use_auto_indentation1")),
|
|
||||||
(editor_prefs.indent_mode != INDENT_NONE));
|
|
||||||
ignore_callback = FALSE;
|
|
||||||
|
|
||||||
/* connect the toolbar dropdown menu for the new button */
|
/* connect the toolbar dropdown menu for the new button */
|
||||||
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
|
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
|
||||||
lookup_widget(main_widgets.window, "menutoolbutton1")), ui_widgets.new_file_menu);
|
lookup_widget(main_widgets.window, "menutoolbutton1")), ui_widgets.new_file_menu);
|
||||||
@ -740,7 +732,6 @@ gint main(gint argc, gchar **argv)
|
|||||||
memset(&prefs, 0, sizeof(GeanyPrefs));
|
memset(&prefs, 0, sizeof(GeanyPrefs));
|
||||||
memset(&interface_prefs, 0, sizeof(GeanyInterfacePrefs));
|
memset(&interface_prefs, 0, sizeof(GeanyInterfacePrefs));
|
||||||
memset(&toolbar_prefs, 0, sizeof(GeanyToolbarPrefs));
|
memset(&toolbar_prefs, 0, sizeof(GeanyToolbarPrefs));
|
||||||
memset(&editor_prefs, 0, sizeof(GeanyEditorPrefs));
|
|
||||||
memset(&file_prefs, 0, sizeof(GeanyFilePrefs));
|
memset(&file_prefs, 0, sizeof(GeanyFilePrefs));
|
||||||
memset(&search_prefs, 0, sizeof(GeanySearchPrefs));
|
memset(&search_prefs, 0, sizeof(GeanySearchPrefs));
|
||||||
memset(&tool_prefs, 0, sizeof(GeanyToolPrefs));
|
memset(&tool_prefs, 0, sizeof(GeanyToolPrefs));
|
||||||
@ -795,7 +786,9 @@ gint main(gint argc, gchar **argv)
|
|||||||
main_init();
|
main_init();
|
||||||
gtk_widget_set_size_request(main_widgets.window, GEANY_WINDOW_MINIMAL_WIDTH, GEANY_WINDOW_MINIMAL_HEIGHT);
|
gtk_widget_set_size_request(main_widgets.window, GEANY_WINDOW_MINIMAL_WIDTH, GEANY_WINDOW_MINIMAL_HEIGHT);
|
||||||
gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT);
|
gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT);
|
||||||
|
|
||||||
encodings_init();
|
encodings_init();
|
||||||
|
editor_init();
|
||||||
|
|
||||||
load_settings();
|
load_settings();
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@
|
|||||||
|
|
||||||
/* The API version should be incremented whenever any plugin data types below are
|
/* The API version should be incremented whenever any plugin data types below are
|
||||||
* modified or appended to. */
|
* modified or appended to. */
|
||||||
static const gint api_version = 83;
|
static const gint api_version = 84;
|
||||||
|
|
||||||
/* The ABI version should be incremented whenever existing fields in the plugin
|
/* The ABI version should be incremented whenever existing fields in the plugin
|
||||||
* data types below have to be changed or reordered. It should stay the same if fields
|
* data types below have to be changed or reordered. It should stay the same if fields
|
||||||
* are only appended, as this doesn't affect existing fields. */
|
* are only appended, as this doesn't affect existing fields. */
|
||||||
static const gint abi_version = 43;
|
static const gint abi_version = 44;
|
||||||
|
|
||||||
/** Check the plugin can be loaded by Geany.
|
/** Check the plugin can be loaded by Geany.
|
||||||
* This performs runtime checks that try to ensure:
|
* This performs runtime checks that try to ensure:
|
||||||
@ -444,6 +444,8 @@ typedef struct EditorFuncs
|
|||||||
void (*set_indicator) (struct GeanyEditor *editor, gint start, gint end);
|
void (*set_indicator) (struct GeanyEditor *editor, gint start, gint end);
|
||||||
void (*set_indicator_on_line) (struct GeanyEditor *editor, gint line);
|
void (*set_indicator_on_line) (struct GeanyEditor *editor, gint line);
|
||||||
void (*clear_indicators) (struct GeanyEditor *editor);
|
void (*clear_indicators) (struct GeanyEditor *editor);
|
||||||
|
|
||||||
|
const struct GeanyIndentPrefs* (*get_indent_prefs)(struct GeanyEditor *editor);
|
||||||
/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
|
/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
|
||||||
* appended functions to GeanyEditor pointers. */
|
* appended functions to GeanyEditor pointers. */
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,8 @@ static DocumentFuncs doc_funcs = {
|
|||||||
static EditorFuncs editor_funcs = {
|
static EditorFuncs editor_funcs = {
|
||||||
&editor_set_indicator,
|
&editor_set_indicator,
|
||||||
&editor_set_indicator_on_line,
|
&editor_set_indicator_on_line,
|
||||||
&editor_clear_indicators
|
&editor_clear_indicators,
|
||||||
|
&editor_get_indent_prefs
|
||||||
};
|
};
|
||||||
|
|
||||||
static ScintillaFuncs sci_funcs = {
|
static ScintillaFuncs sci_funcs = {
|
||||||
|
231
src/prefs.c
231
src/prefs.c
@ -89,7 +89,14 @@ static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, g
|
|||||||
static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data);
|
||||||
|
|
||||||
|
|
||||||
/* used in e.g. init_toggle_button_prefs(). */
|
typedef enum PrefCallbackAction
|
||||||
|
{
|
||||||
|
PREF_DISPLAY,
|
||||||
|
PREF_UPDATE
|
||||||
|
}
|
||||||
|
PrefCallbackAction;
|
||||||
|
|
||||||
|
|
||||||
typedef struct PrefEntry
|
typedef struct PrefEntry
|
||||||
{
|
{
|
||||||
const gchar *widget_name;
|
const gchar *widget_name;
|
||||||
@ -97,17 +104,155 @@ typedef struct PrefEntry
|
|||||||
}
|
}
|
||||||
PrefEntry;
|
PrefEntry;
|
||||||
|
|
||||||
static PrefEntry toggle_prefs[] =
|
|
||||||
{
|
|
||||||
{"check_cmdline_new_files", &file_prefs.cmdline_new_files},
|
|
||||||
|
|
||||||
{"check_ask_suppress_search_dialogs", &search_prefs.suppress_dialogs},
|
static void toggle_prefs_foreach(PrefCallbackAction action)
|
||||||
{"check_search_use_current_word", &search_prefs.use_current_word},
|
{
|
||||||
{"check_fif_current_dir", &search_prefs.use_current_file_dir},
|
guint i;
|
||||||
{NULL, NULL} /* must be terminated */
|
PrefEntry items[] =
|
||||||
|
{
|
||||||
|
{"check_cmdline_new_files", &file_prefs.cmdline_new_files},
|
||||||
|
|
||||||
|
{"check_ask_suppress_search_dialogs", &search_prefs.suppress_dialogs},
|
||||||
|
{"check_search_use_current_word", &search_prefs.use_current_word},
|
||||||
|
{"check_fif_current_dir", &search_prefs.use_current_file_dir},
|
||||||
|
|
||||||
|
{"check_detect_indent", &editor_prefs.indentation->detect_type}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(items); i++)
|
||||||
|
{
|
||||||
|
PrefEntry *pe = &items[i];
|
||||||
|
GtkWidget *widget = lookup_widget(ui_widgets.prefs_dialog, pe->widget_name);
|
||||||
|
gboolean *setting = pe->setting;
|
||||||
|
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case PREF_DISPLAY:
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), *setting);
|
||||||
|
break;
|
||||||
|
case PREF_UPDATE:
|
||||||
|
*setting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void spin_prefs_foreach(PrefCallbackAction action)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
PrefEntry items[] =
|
||||||
|
{
|
||||||
|
{"spin_indent_width", &editor_prefs.indentation->width},
|
||||||
|
{"spin_tab_width", &editor_prefs.indentation->tab_width},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(items); i++)
|
||||||
|
{
|
||||||
|
PrefEntry *pe = &items[i];
|
||||||
|
GtkWidget *widget = lookup_widget(ui_widgets.prefs_dialog, pe->widget_name);
|
||||||
|
gint *setting = pe->setting;
|
||||||
|
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case PREF_DISPLAY:
|
||||||
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), *setting);
|
||||||
|
break;
|
||||||
|
case PREF_UPDATE:
|
||||||
|
*setting = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct RadioPrefEntry
|
||||||
|
{
|
||||||
|
const gchar *widget_name;
|
||||||
|
gpointer setting;
|
||||||
|
gint value;
|
||||||
|
}
|
||||||
|
RadioPrefEntry;
|
||||||
|
|
||||||
|
static void radio_prefs_foreach(PrefCallbackAction action)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
RadioPrefEntry items[] =
|
||||||
|
{
|
||||||
|
{"radio_indent_spaces", &editor_prefs.indentation->type, GEANY_INDENT_TYPE_SPACES},
|
||||||
|
{"radio_indent_tabs", &editor_prefs.indentation->type, GEANY_INDENT_TYPE_TABS},
|
||||||
|
{"radio_indent_both", &editor_prefs.indentation->type, GEANY_INDENT_TYPE_BOTH},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(items); i++)
|
||||||
|
{
|
||||||
|
RadioPrefEntry *pe = &items[i];
|
||||||
|
GtkWidget *widget = lookup_widget(ui_widgets.prefs_dialog, pe->widget_name);
|
||||||
|
gint *setting = pe->setting;
|
||||||
|
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case PREF_DISPLAY:
|
||||||
|
if (*setting == pe->value)
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
|
||||||
|
break;
|
||||||
|
case PREF_UPDATE:
|
||||||
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
|
||||||
|
*setting = pe->value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void combo_prefs_foreach(PrefCallbackAction action)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
PrefEntry items[] =
|
||||||
|
{
|
||||||
|
{"combo_auto_indent_mode", &editor_prefs.indentation->auto_indent_mode},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(items); i++)
|
||||||
|
{
|
||||||
|
PrefEntry *pe = &items[i];
|
||||||
|
GtkWidget *widget = lookup_widget(ui_widgets.prefs_dialog, pe->widget_name);
|
||||||
|
gint *setting = pe->setting;
|
||||||
|
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case PREF_DISPLAY:
|
||||||
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), *setting);
|
||||||
|
break;
|
||||||
|
case PREF_UPDATE:
|
||||||
|
*setting = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (*PrefItemsCallback)(PrefCallbackAction action);
|
||||||
|
|
||||||
|
/* List of functions which hold the PrefEntry arrays. These allow access to
|
||||||
|
* runtime setting fields like EditorPrefs::indentation->width. */
|
||||||
|
PrefItemsCallback pref_item_callbacks[] = {
|
||||||
|
toggle_prefs_foreach,
|
||||||
|
spin_prefs_foreach,
|
||||||
|
radio_prefs_foreach,
|
||||||
|
combo_prefs_foreach
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void prefs_action(PrefCallbackAction action)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS(pref_item_callbacks); i++)
|
||||||
|
pref_item_callbacks[i](action);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
KB_TREE_ACTION,
|
KB_TREE_ACTION,
|
||||||
@ -180,25 +325,12 @@ static void init_keybindings(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void init_toggle_button_prefs()
|
|
||||||
{
|
|
||||||
PrefEntry *pe;
|
|
||||||
|
|
||||||
for (pe = toggle_prefs; pe->widget_name != NULL; pe++)
|
|
||||||
{
|
|
||||||
GtkWidget *widget = lookup_widget(ui_widgets.prefs_dialog, pe->widget_name);
|
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), *(gboolean*)pe->setting);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void prefs_init_dialog(void)
|
void prefs_init_dialog(void)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GdkColor *color;
|
GdkColor *color;
|
||||||
|
|
||||||
init_toggle_button_prefs();
|
prefs_action(PREF_DISPLAY);
|
||||||
|
|
||||||
/* General settings */
|
/* General settings */
|
||||||
/* startup */
|
/* startup */
|
||||||
@ -400,9 +532,6 @@ void prefs_init_dialog(void)
|
|||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.final_new_line);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.final_new_line);
|
||||||
|
|
||||||
/* Editor settings */
|
/* Editor settings */
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width");
|
|
||||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.tab_width);
|
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_toggle_mark");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "entry_toggle_mark");
|
||||||
gtk_entry_set_text(GTK_ENTRY(widget), editor_prefs.comment_toggle_mark);
|
gtk_entry_set_text(GTK_ENTRY(widget), editor_prefs.comment_toggle_mark);
|
||||||
|
|
||||||
@ -418,12 +547,6 @@ void prefs_init_dialog(void)
|
|||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_end");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_end");
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_line_endings);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.show_line_endings);
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_auto_indent_mode");
|
|
||||||
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), editor_prefs.indent_mode);
|
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent");
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.detect_tab_mode);
|
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.line_wrapping);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.line_wrapping);
|
||||||
|
|
||||||
@ -450,12 +573,6 @@ void prefs_init_dialog(void)
|
|||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_newline_strip");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_newline_strip");
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.newline_strip);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.newline_strip);
|
||||||
|
|
||||||
if (editor_prefs.use_tabs)
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_tabs");
|
|
||||||
else
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_spaces");
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
|
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_indicators");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_indicators");
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_indicators);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.use_indicators);
|
||||||
|
|
||||||
@ -617,19 +734,6 @@ void prefs_init_dialog(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void update_toggle_button_prefs()
|
|
||||||
{
|
|
||||||
PrefEntry *pe;
|
|
||||||
|
|
||||||
for (pe = toggle_prefs; pe->widget_name != NULL; pe++)
|
|
||||||
{
|
|
||||||
GtkWidget *widget = lookup_widget(ui_widgets.prefs_dialog, pe->widget_name);
|
|
||||||
|
|
||||||
*(gboolean*)pe->setting = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* callbacks
|
* callbacks
|
||||||
*/
|
*/
|
||||||
@ -641,7 +745,7 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
|
|||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
update_toggle_button_prefs();
|
prefs_action(PREF_UPDATE);
|
||||||
|
|
||||||
/* General settings */
|
/* General settings */
|
||||||
/* startup */
|
/* startup */
|
||||||
@ -820,9 +924,6 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
|
|||||||
setptr(editor_prefs.comment_toggle_mark,
|
setptr(editor_prefs.comment_toggle_mark,
|
||||||
gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1));
|
gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1));
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_tab_width");
|
|
||||||
editor_prefs.tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "spin_long_line");
|
||||||
editor_prefs.long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
editor_prefs.long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
||||||
|
|
||||||
@ -842,9 +943,6 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
|
|||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_end");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_end");
|
||||||
editor_prefs.show_line_endings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
editor_prefs.show_line_endings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "combo_auto_indent_mode");
|
|
||||||
editor_prefs.indent_mode = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping");
|
||||||
editor_prefs.line_wrapping = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
editor_prefs.line_wrapping = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||||
|
|
||||||
@ -866,25 +964,6 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
|
|||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_newline_strip");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_newline_strip");
|
||||||
editor_prefs.newline_strip = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
editor_prefs.newline_strip = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_indent_tabs");
|
|
||||||
{
|
|
||||||
gboolean use_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
||||||
|
|
||||||
/* override each document setting only if the default has changed */
|
|
||||||
if (editor_prefs.use_tabs != use_tabs)
|
|
||||||
{
|
|
||||||
editor_prefs.use_tabs = use_tabs;
|
|
||||||
for (i = 0; i < documents_array->len; i++)
|
|
||||||
{
|
|
||||||
if (documents[i]->is_valid)
|
|
||||||
editor_set_use_tabs(documents[i]->editor, editor_prefs.use_tabs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_detect_indent");
|
|
||||||
editor_prefs.detect_tab_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
|
||||||
|
|
||||||
widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_multiline");
|
widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_multiline");
|
||||||
editor_prefs.auto_continue_multiline = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
editor_prefs.auto_continue_multiline = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||||
|
|
||||||
|
@ -174,8 +174,19 @@ void ui_update_statusbar(GeanyDocument *doc, gint pos)
|
|||||||
/* OVR = overwrite/overtype, INS = insert */
|
/* OVR = overwrite/overtype, INS = insert */
|
||||||
(sci_get_overtype(doc->editor->sci) ? _("OVR") : _("INS")));
|
(sci_get_overtype(doc->editor->sci) ? _("OVR") : _("INS")));
|
||||||
g_string_append(stats_str, sp);
|
g_string_append(stats_str, sp);
|
||||||
g_string_append(stats_str,
|
|
||||||
(doc->editor->use_tabs) ? _("TAB") : _("SP ")); /* SP = space */
|
switch (editor_get_indent_prefs(doc->editor)->type)
|
||||||
|
{
|
||||||
|
case GEANY_INDENT_TYPE_TABS:
|
||||||
|
g_string_append(stats_str, _("TAB"));
|
||||||
|
break;
|
||||||
|
case GEANY_INDENT_TYPE_SPACES:
|
||||||
|
g_string_append(stats_str, _("SP")); /* SP = space */
|
||||||
|
break;
|
||||||
|
case GEANY_INDENT_TYPE_BOTH:
|
||||||
|
g_string_append(stats_str, _("T/S")); /* T/S = tabs and spaces */
|
||||||
|
break;
|
||||||
|
}
|
||||||
g_string_append(stats_str, sp);
|
g_string_append(stats_str, sp);
|
||||||
g_string_append_printf(stats_str, _("mode: %s"),
|
g_string_append_printf(stats_str, _("mode: %s"),
|
||||||
editor_get_eol_char_name(doc));
|
editor_get_eol_char_name(doc));
|
||||||
@ -687,6 +698,7 @@ void ui_document_show_hide(GeanyDocument *doc)
|
|||||||
{
|
{
|
||||||
gchar *widget_name;
|
gchar *widget_name;
|
||||||
GtkWidget *item;
|
GtkWidget *item;
|
||||||
|
const GeanyIndentPrefs *iprefs;
|
||||||
|
|
||||||
if (doc == NULL)
|
if (doc == NULL)
|
||||||
doc = document_get_current();
|
doc = document_get_current();
|
||||||
@ -704,11 +716,23 @@ void ui_document_show_hide(GeanyDocument *doc)
|
|||||||
GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "line_breaking1")),
|
GTK_CHECK_MENU_ITEM(lookup_widget(main_widgets.window, "line_breaking1")),
|
||||||
doc->editor->line_breaking);
|
doc->editor->line_breaking);
|
||||||
|
|
||||||
|
iprefs = editor_get_indent_prefs(doc->editor);
|
||||||
|
|
||||||
item = lookup_widget(main_widgets.window, "menu_use_auto_indentation1");
|
item = lookup_widget(main_widgets.window, "menu_use_auto_indentation1");
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), doc->editor->auto_indent);
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), doc->editor->auto_indent);
|
||||||
gtk_widget_set_sensitive(item, editor_prefs.indent_mode != INDENT_NONE);
|
gtk_widget_set_sensitive(item,
|
||||||
|
iprefs->auto_indent_mode != GEANY_AUTOINDENT_NONE);
|
||||||
|
|
||||||
item = lookup_widget(main_widgets.window, doc->editor->use_tabs ? "tabs1" : "spaces1");
|
switch (iprefs->type)
|
||||||
|
{
|
||||||
|
case GEANY_INDENT_TYPE_SPACES:
|
||||||
|
widget_name = "spaces1"; break;
|
||||||
|
case GEANY_INDENT_TYPE_TABS:
|
||||||
|
widget_name = "tabs1"; break;
|
||||||
|
case GEANY_INDENT_TYPE_BOTH:
|
||||||
|
widget_name = "tabs_and_spaces1"; break;
|
||||||
|
}
|
||||||
|
item = lookup_widget(main_widgets.window, widget_name);
|
||||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
|
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
|
||||||
|
|
||||||
gtk_check_menu_item_set_active(
|
gtk_check_menu_item_set_active(
|
||||||
@ -1505,3 +1529,5 @@ void ui_init(void)
|
|||||||
|
|
||||||
init_document_widgets();
|
init_document_widgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user