Revision: 2044 http://geany.svn.sourceforge.net/geany/?rev=2044&view=rev Author: eht16 Date: 2007-11-12 01:27:43 -0800 (Mon, 12 Nov 2007)
Log Message: ----------- Rename "Contruct autocompletion" to "Snippets". Allow changing height of the symbol completion list even if automatic symbol is disabled, it still can be forced by keybinding.
Modified Paths: -------------- trunk/ChangeLog trunk/Makefile.am trunk/doc/geany.1.in trunk/doc/geany.html trunk/doc/geany.txt trunk/geany.glade trunk/src/document.c trunk/src/editor.c trunk/src/geany.h trunk/src/highlighting.c trunk/src/interface.c trunk/src/keybindings.c trunk/src/keybindings.h trunk/src/keyfile.c trunk/src/keyfile.h trunk/src/main.c trunk/src/plugindata.h trunk/src/prefs.c
Added Paths: ----------- trunk/data/snippets.conf
Removed Paths: ------------- trunk/data/autocomplete.conf
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/ChangeLog 2007-11-12 09:27:43 UTC (rev 2044) @@ -1,3 +1,16 @@ +2007-11-12 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * Makefile.am, geany.glade, data/autocomplete.conf, data/snippets.conf, + doc/geany.txt, doc/geany.html, doc/geany.1.in, src/document.c, + src/editor.c, src/geany.h, src/highlighting.c, src/interface.c, + src/keybindings.c, src/keybindings.h, src/keyfile.c, src/keyfile.h, + src/main.c, src/plugindata.h, src/prefs.c: + Rename "Contruct autocompletion" to "Snippets". + Allow changing height of the symbol completion list even if automatic + symbol is disabled, it still can be forced by keybinding. + + + 2007-11-11 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/templates.c, src/utils.c, src/utils.h: @@ -13,6 +26,7 @@ src/main.c: Apply patch from Bo Lorentsen to add support for project session files (thank you).
+ 2007-11-08 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/prefs.c:
Modified: trunk/Makefile.am =================================================================== --- trunk/Makefile.am 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/Makefile.am 2007-11-12 09:27:43 UTC (rev 2044) @@ -18,7 +18,7 @@ data/html_entities.tags \ $(srcdir)/data/filetypes.* \ data/filetype_extensions.conf \ - data/autocomplete.conf + data/snippets.conf
EXTRA_DIST = \ autogen.sh \
Deleted: trunk/data/autocomplete.conf =================================================================== --- trunk/data/autocomplete.conf 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/data/autocomplete.conf 2007-11-12 09:27:43 UTC (rev 2044) @@ -1,48 +0,0 @@ -# Geany's auto completion configuration file -# use \n or %newline% for a new line (it will be replaced by the used EOL char(s) - LF, CR/LF, CR) -# use \t ot %ws% for an indentation step, if using only spaces for indentation only spaces will be used -# use \s to force whitespace at beginning or end of a value ('key= value' won't work, use 'key=\svalue') -# use %cursor% to define where the cursor should be placed after completion -# use %key% for all keys defined in the [Special] section -# you can define a section for each supported filetype to overwrite default settings, the section -# name must match exactly the internal filetype name, run 'geany --ft-names' for a full list - -# filetype names: -# C, C++, D, Java, Pascal, ASM, Fortran, CAML, Haskell, VHDL, Perl, PHP, Javascript, Python, Ruby, -# Tcl, Lua, Ferite, Sh, Make, O-Matrix, XML, Docbook, HTML, CSS, SQL, LaTeX, Diff, Conf, None - -# Default is used for all filetypes and keys can be overwritten by [filetype] sections -[Default] -if=if (%cursor%)%brace_open%\n%brace_close% -else=else%brace_open%%cursor%\n%brace_close% -for=for (i = 0; i < %cursor%; i++)%brace_open%\n%brace_close% -while=while (%cursor%)%brace_open%\n%brace_close% -do=do%brace_open%%cursor%\n%brace_close% while () -switch=switch (%cursor%)%brace_open%case : break;\n%ws%default: \n%brace_close% -try=try%block_cursor%catch ()%block% - -# special keys to be used in other completions, cannot be used "standalone" -# can be used by %key%, e.g. %brace_open% -# nesting of special keys is not supported (e.g. brace_open=\n{\n%brace_close% won't work) -# key "wordchars" is very special, it defines the word delimiting characters when looking for -# a word to auto complete, leave commented to use the default wordchars -[Special] -brace_open=\n{\n\t -brace_close=}\n -block=\n{\n\t\n}\n -block_cursor=\n{\n\t%cursor%\n}\n -#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 - -[C++] -for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close% - -[Java] -for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close% - -[PHP] -for=for ($i = 0; $i < %cursor%; $i++)%brace_open%\n%brace_close% - -[Ferite] -iferr=iferr%block_cursor%fix%block% -monitor=monitor%block_cursor%handle%block% -
Added: trunk/data/snippets.conf =================================================================== --- trunk/data/snippets.conf (rev 0) +++ trunk/data/snippets.conf 2007-11-12 09:27:43 UTC (rev 2044) @@ -0,0 +1,48 @@ +# Geany's snippets configuration file +# use \n or %newline% for a new line (it will be replaced by the used EOL char(s) - LF, CR/LF, CR) +# use \t ot %ws% for an indentation step, if using only spaces for indentation only spaces will be used +# use \s to force whitespace at beginning or end of a value ('key= value' won't work, use 'key=\svalue') +# use %cursor% to define where the cursor should be placed after completion +# use %key% for all keys defined in the [Special] section +# you can define a section for each supported filetype to overwrite default settings, the section +# name must match exactly the internal filetype name, run 'geany --ft-names' for a full list + +# filetype names: +# C, C++, D, Java, Pascal, ASM, Fortran, CAML, Haskell, VHDL, Perl, PHP, Javascript, Python, Ruby, +# Tcl, Lua, Ferite, Sh, Make, O-Matrix, XML, Docbook, HTML, CSS, SQL, LaTeX, Diff, Conf, None + +# Default is used for all filetypes and keys can be overwritten by [filetype] sections +[Default] +if=if (%cursor%)%brace_open%\n%brace_close% +else=else%brace_open%%cursor%\n%brace_close% +for=for (i = 0; i < %cursor%; i++)%brace_open%\n%brace_close% +while=while (%cursor%)%brace_open%\n%brace_close% +do=do%brace_open%%cursor%\n%brace_close% while () +switch=switch (%cursor%)%brace_open%case : break;\n%ws%default: \n%brace_close% +try=try%block_cursor%catch ()%block% + +# special keys to be used in other snippets, cannot be used "standalone" +# can be used by %key%, e.g. %brace_open% +# nesting of special keys is not supported (e.g. brace_open=\n{\n%brace_close% won't work) +# key "wordchars" is very special, it defines the word delimiting characters when looking for +# a word to auto complete, leave commented to use the default wordchars +[Special] +brace_open=\n{\n\t +brace_close=}\n +block=\n{\n\t\n}\n +block_cursor=\n{\n\t%cursor%\n}\n +#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 + +[C++] +for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close% + +[Java] +for=for (int i = 0; i < %cursor%; i++)%brace_open%\n%brace_close% + +[PHP] +for=for ($i = 0; $i < %cursor%; $i++)%brace_open%\n%brace_close% + +[Ferite] +iferr=iferr%block_cursor%fix%block% +monitor=monitor%block_cursor%handle%block% +
Modified: trunk/doc/geany.1.in =================================================================== --- trunk/doc/geany.1.in 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/doc/geany.1.in 2007-11-12 09:27:43 UTC (rev 2044) @@ -21,7 +21,7 @@ .IP "\fB-d\fP \fB--debug\fP " 10 Run Geany in debug mode, which means being verbose and printing lots of information. .IP "\fB\fP \fB--ft-names\fP " 10 -Print a list of Geany's internal filetype names (useful for the auto completion list). +Print a list of Geany's internal filetype names (useful snippets configuration). .IP "\fB-g\fP \fB--generate-tags\fP " 10 Generate a global tags file (see documentation). .IP "\fB-P\fP \fB--no-preprocessing\fP " 10 @@ -35,7 +35,7 @@ Don't show the message window. Use this option if you don't need compiler messages or VTE support. .IP "\fB-n\fP \fB--no-ctags\fP " 10 -Don't load auto completion and call tip data. Use this option, if you don't want to use them. +Don't load symbol completion and call tip data. Use this option, if you don't want to use them. For more information please see documentation. .IP "\fB-p\fP \fB--no-plugins\fP " 10 Don't load plugin support. @@ -57,9 +57,8 @@ Geany supports all generic GTK options, a list is available on the help screen. .SH "AUTHOR" .PP -This manual page was written by Enrico Troeger enrico.troeger@uvena.de. Permission is +This manual page was written by the Geany develoepr team. Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. +the terms of the GNU General Public License, Version 2. .PP The complete text of the GNU General Public License can be found in @GEANY_DATA_DIR@/GPL-2.
Modified: trunk/doc/geany.html =================================================================== --- trunk/doc/geany.html 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/doc/geany.html 2007-11-12 09:27:43 UTC (rev 2044) @@ -3,10 +3,10 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> +<meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" /> <title>Geany</title> <meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" /> -<meta name="date" content="2007-10-28" /> +<meta name="date" content="2007-11-01" /> <style type="text/css">
/* @@ -133,7 +133,7 @@ <br />Nick Treleaven <br />Frank Lanitz</td></tr> <tr><th class="docinfo-name">Date:</th> -<td>2007-10-28</td></tr> +<td>2007-11-01</td></tr> <tr><th class="docinfo-name">Version:</th> <td>0.13</td></tr> </tbody> @@ -183,7 +183,7 @@ <li><a class="reference" href="#code-navigation-history" id="id27" name="id27">Code Navigation History</a></li> <li><a class="reference" href="#send-text-through-definable-commands" id="id28" name="id28">Send text through definable commands</a></li> <li><a class="reference" href="#context-actions" id="id29" name="id29">Context actions</a></li> -<li><a class="reference" href="#user-definable-auto-completion" id="id30" name="id30">User-definable auto completion</a></li> +<li><a class="reference" href="#user-definable-snippets" id="id30" name="id30">User-definable snippets</a></li> <li><a class="reference" href="#inserting-unicode-characters" id="id31" name="id31">Inserting unicode characters</a></li> </ul> </li> @@ -448,7 +448,7 @@ <tr><td><em>none</em></td> <td>--ft-names</td> <td>Print a list of Geany's internal filetype names (useful -for the auto completion list).</td> +for snippets configuration).</td> </tr> <tr><td>-g</td> <td>--generate-tags</td> @@ -476,7 +476,7 @@ </tr> <tr><td>-n</td> <td>--no-ctags</td> -<td>Do not load auto completion and call tip data. Use this +<td>Do not load symbol completion and call tip data. Use this option if you do not want to use them.</td> </tr> <tr><td>-p</td> @@ -807,10 +807,12 @@ called firefox) and it will open the address: <a class="reference" href="http://www.php.net/echo">http://www.php.net/echo</a>.</p> </div> <div class="section"> -<h3><a class="toc-backref" href="#id30" id="user-definable-auto-completion" name="user-definable-auto-completion">User-definable auto completion</a></h3> -<p>Geany can complete pre-defined constructs and often used strings -automatically. To know what to complete or replace Geany reads a -configuration file called <tt class="docutils literal"><span class="pre">autocomplete.conf</span></tt> at startup.</p> +<h3><a class="toc-backref" href="#id30" id="user-definable-snippets" name="user-definable-snippets">User-definable snippets</a></h3> +<p>Snippets are small strings or code constructs which can be replaced or +completed to a more complex string. So you can save a lot of time by +not typing often used strings and letting Geany do the work for you. +To know what to complete or replace Geany reads a configuration file +called <tt class="docutils literal"><span class="pre">snippets.conf</span></tt> at startup.</p> <p>The system-wide configuration file can be found in <tt class="docutils literal"><span class="pre">$prefix/share/geany</span></tt>, where <tt class="docutils literal"><span class="pre">$prefix</span></tt> is the path where Geany is installed (commonly <tt class="docutils literal"><span class="pre">/usr/local</span></tt>). It is not recommended to edit the @@ -819,30 +821,29 @@ in your configuration directory (usually <tt class="docutils literal"><span class="pre">~/.geany/</span></tt>).</p> <p>For example:</p> <pre class="literal-block"> -% cp /usr/local/share/geany/autocomplete.conf /home/username/.geany/ +% cp /usr/local/share/geany/snippets.conf /home/username/.geany/ </pre> <p>Then you can edit the file and the changes are also available after an update of Geany because the file resides in your configuration directory. Alternatively, you can create a file -<tt class="docutils literal"><span class="pre">~/.geany/autocomplete.conf</span></tt> and add only these settings you want -to change. All missing settings will be read from the global auto -completion file in <tt class="docutils literal"><span class="pre">$prefix/share/geany</span></tt>.</p> -<p>The file <tt class="docutils literal"><span class="pre">autocomplete.conf</span></tt> may contain several sections for each +<tt class="docutils literal"><span class="pre">~/.geany/snippets.conf</span></tt> and add only these settings you want +to change. All missing settings will be read from the global snippets +file in <tt class="docutils literal"><span class="pre">$prefix/share/geany</span></tt>.</p> +<p>The file <tt class="docutils literal"><span class="pre">snippets.conf</span></tt> may contain several sections for each filetype. It also contains two additional sections "Default" and -"Special". Default contains all completions which are available +"Special". Default contains all snippets which are available for every filetype. You may define another section for a certain -filetype(e.g. C++) containing the same completions. Then when using -such a completion in a C++ file the completion defined in the C++ -section will be used. In any other file the completion defined in the -Default section will be used unless a section for the current filetype -exists and the used completion is defined in this section. The section -"Special" contains special completions which can only be used in other -completions. So you can define often used parts of completions and just -use the special completion as a placeholder (see the <tt class="docutils literal"><span class="pre">autocomplete.conf</span></tt> -for details).</p> -<p>To define completions you can use several special characters which -will be replaced when using the completion:</p> -<p><strong>Wildcards for auto completion</strong></p> +filetype(e.g. C++) containing the same snippets. Then when using +such a snippet in a C++ file the snippet defined in the C++ section will +be used. In any other file the snippet defined in the Default section will +be used unless a section for the current filetype exists and the used +snippet is defined in this section. The section "Special" contains special +snippets which can only be used in other snippets. So you can define often +used parts of snippets and just use the special snippet as a placeholder +(see the <tt class="docutils literal"><span class="pre">snippets.conf</span></tt> for details).</p> +<p>To define snippets you can use several special characters which +will be replaced when using the snippet:</p> +<p><strong>Wildcards for snippets</strong></p> <table border="1" class="docutils"> <colgroup> <col width="22%" /> @@ -868,17 +869,16 @@ <tr><td>%...%</td> <td>"..." means the name of a key in the "Special" section. If you have defined a key "brace_open" in the "Special" -section you can use %brace_open" in any other completion.</td> +section you can use %brace_open" in any other snippet.</td> </tr> </tbody> </table> -<p>Defined completions must not contain spaces otherwise they won't +<p>Defined snippets must not contain spaces otherwise they won't work correctly. But beside that you can define almost everything -string as a completion and use it later in Geany. It is not limited +string as a snippet and use it later in Geany. It is not limited to existing contructs of certain programming languages(like <tt class="docutils literal"><span class="pre">if</span></tt>, <tt class="docutils literal"><span class="pre">for</span></tt>, <tt class="docutils literal"><span class="pre">switch</span></tt>). Define whatever you need.</p> -<p>Maybe you need to often type your name, so define a completion -like this:</p> +<p>Maybe you need to often type your name, so define a snippet like this:</p> <pre class="literal-block"> [Default] myname=Enrico Tröger @@ -886,10 +886,10 @@ <p>Everytime you write <tt class="docutils literal"><span class="pre">myname</span></tt> <TAB> in Geany, it will replace "myname" with "Enrico Tröger". The key to start auto completion can be changed in the preferences dialog, by default it is TAB.</p> -<p>You may change the behaviour Geany recognizes the word to auto complete, +<p>You may change the behaviour Geany recognizes the word to complete, i.e. where define the start and end of a word. The section "Special" may contain a key "wordchars" which lists all characters a string may contain -to be recognized as a word for auto completion. Leave it commented to use +to be recognized as a word for completion. Leave it commented to use default characters or define it to add or remove characters to fit your needs.</p> </div> @@ -1124,16 +1124,16 @@ <h3><a class="toc-backref" href="#id47" id="workspace-tags" name="workspace-tags">Workspace tags</a></h3> <p>Tags for each document are parsed whenever a file is loaded or saved. These are shown in the Symbol list in the Sidebar. These tags -are also used for autocompletion and calltips for all documents open -in the current session that have the same filetype.</p> +are also used for autocompletion of symbols and calltips for all documents +open in the current session that have the same filetype.</p> <p>The <em>Go to Tag</em> commands can be used with all workspace tags. See <a class="reference" href="#go-to-tag-definition">Go to tag definition</a>.</p> </div> <div class="section"> <h3><a class="toc-backref" href="#id48" id="global-tags" name="global-tags">Global tags</a></h3> -<p>Global tags are used to provide autocompletion and calltips without -having to open the corresponding source files. This is intended for -library APIs, as the tags file only has to be updated when you upgrade +<p>Global tags are used to provide autocompletion of symbols and calltips +without having to open the corresponding source files. This is intended +for library APIs, as the tags file only has to be updated when you upgrade the library.</p> <p>You can load a custom global tags file in two ways:</p> <ul class="simple"> @@ -3107,7 +3107,7 @@ <div class="footer"> <hr class="footer" /> <a class="reference" href="geany.txt">View document source</a>. -Generated on: 2007-11-01 16:20 UTC. +Generated on: 2007-11-12 09:15 UTC. Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt =================================================================== --- trunk/doc/geany.txt 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/doc/geany.txt 2007-11-12 09:27:43 UTC (rev 2044) @@ -187,7 +187,7 @@ and printing lots of information.
*none* --ft-names Print a list of Geany's internal filetype names (useful - for the auto completion list). + for snippets configuration).
-g --generate-tags Generate a global tags file (see `Generating a global tags file`_). @@ -203,7 +203,7 @@ -m --no-msgwin Do not show the message window. Use this option if you do not need compiler messages or VTE support.
--n --no-ctags Do not load auto completion and call tip data. Use this +-n --no-ctags Do not load symbol completion and call tip data. Use this option if you do not want to use them.
-p --no-plugins Do not load plugins or plugin support. @@ -565,12 +565,14 @@ called firefox) and it will open the address: http://www.php.net/echo.
-User-definable auto completion -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +User-definable snippets +^^^^^^^^^^^^^^^^^^^^^^^
-Geany can complete pre-defined constructs and often used strings -automatically. To know what to complete or replace Geany reads a -configuration file called ``autocomplete.conf`` at startup. +Snippets are small strings or code constructs which can be replaced or +completed to a more complex string. So you can save a lot of time by +not typing often used strings and letting Geany do the work for you. +To know what to complete or replace Geany reads a configuration file +called ``snippets.conf`` at startup.
The system-wide configuration file can be found in ``$prefix/share/geany``, where ``$prefix`` is the path where Geany is @@ -582,33 +584,32 @@
For example::
- % cp /usr/local/share/geany/autocomplete.conf /home/username/.geany/ + % cp /usr/local/share/geany/snippets.conf /home/username/.geany/
Then you can edit the file and the changes are also available after an update of Geany because the file resides in your configuration directory. Alternatively, you can create a file -``~/.geany/autocomplete.conf`` and add only these settings you want -to change. All missing settings will be read from the global auto -completion file in ``$prefix/share/geany``. +``~/.geany/snippets.conf`` and add only these settings you want +to change. All missing settings will be read from the global snippets +file in ``$prefix/share/geany``.
-The file ``autocomplete.conf`` may contain several sections for each +The file ``snippets.conf`` may contain several sections for each filetype. It also contains two additional sections "Default" and -"Special". Default contains all completions which are available +"Special". Default contains all snippets which are available for every filetype. You may define another section for a certain -filetype(e.g. C++) containing the same completions. Then when using -such a completion in a C++ file the completion defined in the C++ -section will be used. In any other file the completion defined in the -Default section will be used unless a section for the current filetype -exists and the used completion is defined in this section. The section -"Special" contains special completions which can only be used in other -completions. So you can define often used parts of completions and just -use the special completion as a placeholder (see the ``autocomplete.conf`` -for details). +filetype(e.g. C++) containing the same snippets. Then when using +such a snippet in a C++ file the snippet defined in the C++ section will +be used. In any other file the snippet defined in the Default section will +be used unless a section for the current filetype exists and the used +snippet is defined in this section. The section "Special" contains special +snippets which can only be used in other snippets. So you can define often +used parts of snippets and just use the special snippet as a placeholder +(see the ``snippets.conf`` for details).
-To define completions you can use several special characters which -will be replaced when using the completion: +To define snippets you can use several special characters which +will be replaced when using the snippet:
-**Wildcards for auto completion** +**Wildcards for snippets**
================ ========================================================= \n or %newline% Insert a new line (it will be replaced by the used EOL @@ -625,17 +626,16 @@
%...% "..." means the name of a key in the "Special" section. If you have defined a key "brace_open" in the "Special" - section you can use %brace_open" in any other completion. + section you can use %brace_open" in any other snippet. ================ =========================================================
-Defined completions must not contain spaces otherwise they won't +Defined snippets must not contain spaces otherwise they won't work correctly. But beside that you can define almost everything -string as a completion and use it later in Geany. It is not limited +string as a snippet and use it later in Geany. It is not limited to existing contructs of certain programming languages(like ``if``, ``for``, ``switch``). Define whatever you need.
-Maybe you need to often type your name, so define a completion -like this:: +Maybe you need to often type your name, so define a snippet like this::
[Default] myname=Enrico Tröger @@ -644,10 +644,10 @@ with "Enrico Tröger". The key to start auto completion can be changed in the preferences dialog, by default it is TAB.
-You may change the behaviour Geany recognizes the word to auto complete, +You may change the behaviour Geany recognizes the word to complete, i.e. where define the start and end of a word. The section "Special" may contain a key "wordchars" which lists all characters a string may contain -to be recognized as a word for auto completion. Leave it commented to use +to be recognized as a word for completion. Leave it commented to use default characters or define it to add or remove characters to fit your needs.
@@ -913,8 +913,8 @@
Tags for each document are parsed whenever a file is loaded or saved. These are shown in the Symbol list in the Sidebar. These tags -are also used for autocompletion and calltips for all documents open -in the current session that have the same filetype. +are also used for autocompletion of symbols and calltips for all documents +open in the current session that have the same filetype.
The *Go to Tag* commands can be used with all workspace tags. See `Go to tag definition`_. @@ -923,9 +923,9 @@ Global tags ^^^^^^^^^^^
-Global tags are used to provide autocompletion and calltips without -having to open the corresponding source files. This is intended for -library APIs, as the tags file only has to be updated when you upgrade +Global tags are used to provide autocompletion of symbols and calltips +without having to open the corresponding source files. This is intended +for library APIs, as the tags file only has to be updated when you upgrade the library.
You can load a custom global tags file in two ways:
Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/geany.glade 2007-11-12 09:27:43 UTC (rev 2044) @@ -5980,11 +5980,11 @@ <property name="spacing">0</property>
<child> - <widget class="GtkCheckButton" id="check_auto_complete"> + <widget class="GtkCheckButton" id="check_complete_snippets"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Automatic completion of often used constructs like if and for</property> + <property name="tooltip" translatable="yes">Type a defined short character sequence and complete it to a more complex string using a single keypress.</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Construct autocompletion</property> + <property name="label" translatable="yes">Snippet completion</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">False</property> @@ -6002,7 +6002,7 @@ <child> <widget class="GtkCheckButton" id="check_xmltag"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Automatic completion of open XML tags (includes HTML tags)</property> + <property name="tooltip" translatable="yes">Automatic completion and closing of XML tags (includes HTML tags)</property> <property name="can_focus">True</property> <property name="label" translatable="yes">XML tag autocompletion</property> <property name="use_underline">True</property> @@ -6024,7 +6024,7 @@ <property name="visible">True</property> <property name="tooltip" translatable="yes">Automatic completion of known symbols in open files (function names, global variables, ...)</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Symbol autocompletion</property> + <property name="label" translatable="yes">Automatic symbol completion</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">False</property> @@ -6048,7 +6048,7 @@ <child> <widget class="GtkLabel" id="label173"> <property name="visible">True</property> - <property name="label" translatable="yes">Rows of autocompletion list:</property> + <property name="label" translatable="yes">Rows of symbol completion list:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -6071,7 +6071,7 @@ </child>
<child> - <widget class="GtkSpinButton" id="spin_autocheight"> + <widget class="GtkSpinButton" id="spin_symbollistheight"> <property name="visible">True</property> <property name="tooltip" translatable="yes">Number of rows to display in the autocompletion list.</property> <property name="can_focus">True</property> @@ -6104,7 +6104,7 @@ <child> <widget class="GtkLabel" id="label177"> <property name="visible">True</property> - <property name="label" translatable="yes"><b>Autocompletion</b></property> + <property name="label" translatable="yes"><b>Completions</b></property> <property name="use_underline">False</property> <property name="use_markup">True</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/document.c 2007-11-12 09:27:43 UTC (rev 2044) @@ -272,7 +272,7 @@
sci_set_tab_width(sci, editor_prefs.tab_width);
- sci_set_autoc_max_height(sci, editor_prefs.autocompletion_max_height); + sci_set_autoc_max_height(sci, editor_prefs.symbolcompletion_max_height);
sci_set_indentation_guides(sci, editor_prefs.show_indent_guide); sci_set_visible_white_spaces(sci, editor_prefs.show_white_space);
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/editor.c 2007-11-12 09:27:43 UTC (rev 2044) @@ -419,7 +419,7 @@ } }
- if (editor_prefs.auto_complete_constructs) + if (editor_prefs.complete_snippets) { // " * " auto completion in multiline C/C++/D/Java comments auto_multiline(sci, pos); @@ -531,7 +531,7 @@
static void auto_close_bracket(ScintillaObject *sci, gint pos, gchar c) { - if (! editor_prefs.auto_complete_constructs || SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_LATEX) + if (! editor_prefs.complete_snippets || SSM(sci, SCI_GETLEXER, 0, 0) != SCLEX_LATEX) return;
if (c == '[') @@ -1091,14 +1091,14 @@ }
-static gchar *ac_find_completion_by_name(const gchar *type, const gchar *name) +static gchar *snippets_find_completion_by_name(const gchar *type, const gchar *name) { gchar *result = NULL; GHashTable *tmp;
g_return_val_if_fail(type != NULL && name != NULL, NULL);
- tmp = g_hash_table_lookup(editor_prefs.auto_completions, type); + tmp = g_hash_table_lookup(editor_prefs.snippets, type); if (tmp != NULL) { result = g_hash_table_lookup(tmp, name); @@ -1107,7 +1107,7 @@ // the particular completion for this filetype is not set (result is NULL) if (tmp == NULL || result == NULL) { - tmp = g_hash_table_lookup(editor_prefs.auto_completions, "Default"); + tmp = g_hash_table_lookup(editor_prefs.snippets, "Default"); if (tmp != NULL) { result = g_hash_table_lookup(tmp, name); @@ -1124,9 +1124,9 @@ * modified when replacing a completion but the foreach function still passes the old pointer * to ac_replace_specials, so we use a global pointer outside of ac_replace_specials and * ac_complete_constructs. Any hints to improve this are welcome. */ -static gchar *global_pattern = NULL; +static gchar *snippets_global_pattern = NULL;
-void ac_replace_specials(gpointer key, gpointer value, gpointer user_data) +void snippets_replace_specials(gpointer key, gpointer value, gpointer user_data) { gchar *needle;
@@ -1135,12 +1135,12 @@
needle = g_strconcat("%", (gchar*) key, "%", NULL);
- global_pattern = utils_str_replace(global_pattern, needle, (gchar*) value); + snippets_global_pattern = utils_str_replace(snippets_global_pattern, needle, (gchar*) value); g_free(needle); }
-static gboolean ac_complete_constructs(gint idx, gint pos, const gchar *word) +static gboolean snippets_complete_constructs(gint idx, gint pos, const gchar *word) { gchar *str; gchar *pattern; @@ -1154,7 +1154,7 @@ str = g_strdup(word); g_strstrip(str);
- pattern = ac_find_completion_by_name(filetypes[ft_id]->name, str); + pattern = snippets_find_completion_by_name(filetypes[ft_id]->name, str); if (pattern == NULL || pattern[0] == '\0') { utils_free_pointers(str, pattern, NULL); // free pattern in case it is "" @@ -1175,13 +1175,13 @@ pos -= str_len; // pos has changed while deleting
// replace 'special' completions - specials = g_hash_table_lookup(editor_prefs.auto_completions, "Special"); + specials = g_hash_table_lookup(editor_prefs.snippets, "Special"); if (specials != NULL) { // ugly hack using global_pattern - global_pattern = pattern; - g_hash_table_foreach(specials, ac_replace_specials, NULL); - pattern = global_pattern; + snippets_global_pattern = pattern; + g_hash_table_foreach(specials, snippets_replace_specials, NULL); + pattern = snippets_global_pattern; }
// replace line breaks and whitespaces @@ -1227,7 +1227,7 @@ }
-gboolean editor_auto_complete(gint idx, gint pos) +gboolean editor_complete_snippet(gint idx, gint pos) { gboolean result = FALSE; gint lexer, style; @@ -1245,14 +1245,14 @@ lexer = SSM(sci, SCI_GETLEXER, 0, 0); style = SSM(sci, SCI_GETSTYLEAT, pos - 2, 0);
- wc = ac_find_completion_by_name("Special", "wordchars"); + wc = snippets_find_completion_by_name("Special", "wordchars"); editor_find_current_word(sci, pos, current_word, sizeof current_word, wc);
// prevent completion of "for " if (! isspace(sci_get_char_at(sci, pos - 1))) // pos points to the line end char so use pos -1 { sci_start_undo_action(sci); // needed because we insert a space separately from construct - result = ac_complete_constructs(idx, pos, current_word); + result = snippets_complete_constructs(idx, pos, current_word); sci_end_undo_action(sci); }
@@ -2554,7 +2554,7 @@
void editor_finalize() { - g_hash_table_destroy(editor_prefs.auto_completions); + g_hash_table_destroy(editor_prefs.snippets);
scintilla_release_resources(); }
Modified: trunk/src/geany.h =================================================================== --- trunk/src/geany.h 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/geany.h 2007-11-12 09:27:43 UTC (rev 2044) @@ -54,7 +54,7 @@ #define GEANY_TOGGLE_MARK "~ " #define GEANY_MAX_WORD_LENGTH 192 #define GEANY_MAX_AUTOCOMPLETE_WORDS 30 -#define GEANY_MAX_AUTOCOMPLETE_HEIGHT 10 +#define GEANY_MAX_SYMBOLLIST_HEIGHT 10 #define GEANY_STRING_UNTITLED _("untitled") #define GEANY_MSGWIN_HEIGHT 208 #define GEANY_WINDOW_MINIMAL_WIDTH 620
Modified: trunk/src/highlighting.c =================================================================== --- trunk/src/highlighting.c 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/highlighting.c 2007-11-12 09:27:43 UTC (rev 2044) @@ -574,7 +574,7 @@ // have to set whitespace after setting wordchars SSM(sci, SCI_SETWHITESPACECHARS, 0, (sptr_t) whitespace_chars);
- SSM(sci, SCI_AUTOCSETMAXHEIGHT, editor_prefs.autocompletion_max_height, 0); + SSM(sci, SCI_AUTOCSETMAXHEIGHT, editor_prefs.symbolcompletion_max_height, 0); }
@@ -2982,7 +2982,7 @@ void highlighting_set_styles(ScintillaObject *sci, gint filetype_idx) { filetypes_load_config(filetype_idx); - + switch (filetype_idx) { styleset_case(GEANY_FILETYPES_ASM, asm);
Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/interface.c 2007-11-12 09:27:43 UTC (rev 2044) @@ -2596,13 +2596,13 @@ GtkWidget *frame18; GtkWidget *alignment21; GtkWidget *vbox19; - GtkWidget *check_auto_complete; + GtkWidget *check_complete_snippets; GtkWidget *check_xmltag; GtkWidget *check_symbol_auto_completion; GtkWidget *hbox6; GtkWidget *label173; - GtkObject *spin_autocheight_adj; - GtkWidget *spin_autocheight; + GtkObject *spin_symbollistheight_adj; + GtkWidget *spin_symbollistheight; GtkWidget *label177; GtkWidget *label95; GtkWidget *vbox18; @@ -3650,19 +3650,19 @@ gtk_widget_show (vbox19); gtk_container_add (GTK_CONTAINER (alignment21), vbox19);
- check_auto_complete = gtk_check_button_new_with_mnemonic (_("Construct autocompletion")); - gtk_widget_show (check_auto_complete); - gtk_box_pack_start (GTK_BOX (vbox19), check_auto_complete, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, check_auto_complete, _("Automatic completion of often used constructs like if and for"), NULL); - gtk_button_set_focus_on_click (GTK_BUTTON (check_auto_complete), FALSE); + check_complete_snippets = gtk_check_button_new_with_mnemonic (_("Snippet completion")); + gtk_widget_show (check_complete_snippets); + gtk_box_pack_start (GTK_BOX (vbox19), check_complete_snippets, FALSE, FALSE, 0); + gtk_tooltips_set_tip (tooltips, check_complete_snippets, _("Type a defined short character sequence and complete it to a more complex string using a single keypress."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_complete_snippets), FALSE);
check_xmltag = gtk_check_button_new_with_mnemonic (_("XML tag autocompletion")); gtk_widget_show (check_xmltag); gtk_box_pack_start (GTK_BOX (vbox19), check_xmltag, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, check_xmltag, _("Automatic completion of open XML tags (includes HTML tags)"), NULL); + gtk_tooltips_set_tip (tooltips, check_xmltag, _("Automatic completion and closing of XML tags (includes HTML tags)"), NULL); gtk_button_set_focus_on_click (GTK_BUTTON (check_xmltag), FALSE);
- check_symbol_auto_completion = gtk_check_button_new_with_mnemonic (_("Symbol autocompletion")); + check_symbol_auto_completion = gtk_check_button_new_with_mnemonic (_("Automatic symbol completion")); gtk_widget_show (check_symbol_auto_completion); gtk_box_pack_start (GTK_BOX (vbox19), check_symbol_auto_completion, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, check_symbol_auto_completion, _("Automatic completion of known symbols in open files (function names, global variables, ...)"), NULL); @@ -3672,19 +3672,19 @@ gtk_widget_show (hbox6); gtk_box_pack_start (GTK_BOX (vbox19), hbox6, FALSE, FALSE, 0);
- label173 = gtk_label_new (_("Rows of autocompletion list:")); + label173 = gtk_label_new (_("Rows of symbol completion list:")); gtk_widget_show (label173); gtk_box_pack_start (GTK_BOX (hbox6), label173, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label173), 0, 0.5);
- spin_autocheight_adj = gtk_adjustment_new (10, 1, 99, 1, 10, 10); - spin_autocheight = gtk_spin_button_new (GTK_ADJUSTMENT (spin_autocheight_adj), 1, 0); - gtk_widget_show (spin_autocheight); - gtk_box_pack_start (GTK_BOX (hbox6), spin_autocheight, FALSE, TRUE, 0); - gtk_tooltips_set_tip (tooltips, spin_autocheight, _("Number of rows to display in the autocompletion list."), NULL); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_autocheight), TRUE); + spin_symbollistheight_adj = gtk_adjustment_new (10, 1, 99, 1, 10, 10); + spin_symbollistheight = gtk_spin_button_new (GTK_ADJUSTMENT (spin_symbollistheight_adj), 1, 0); + gtk_widget_show (spin_symbollistheight); + gtk_box_pack_start (GTK_BOX (hbox6), spin_symbollistheight, FALSE, TRUE, 0); + gtk_tooltips_set_tip (tooltips, spin_symbollistheight, _("Number of rows to display in the autocompletion list."), NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_symbollistheight), TRUE);
- label177 = gtk_label_new (_("<b>Autocompletion</b>")); + label177 = gtk_label_new (_("<b>Completions</b>")); gtk_widget_show (label177); gtk_frame_set_label_widget (GTK_FRAME (frame18), label177); gtk_label_set_use_markup (GTK_LABEL (label177), TRUE); @@ -4396,12 +4396,12 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, frame18, "frame18"); GLADE_HOOKUP_OBJECT (prefs_dialog, alignment21, "alignment21"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox19, "vbox19"); - GLADE_HOOKUP_OBJECT (prefs_dialog, check_auto_complete, "check_auto_complete"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_complete_snippets, "check_complete_snippets"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_xmltag, "check_xmltag"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_symbol_auto_completion, "check_symbol_auto_completion"); GLADE_HOOKUP_OBJECT (prefs_dialog, hbox6, "hbox6"); GLADE_HOOKUP_OBJECT (prefs_dialog, label173, "label173"); - GLADE_HOOKUP_OBJECT (prefs_dialog, spin_autocheight, "spin_autocheight"); + GLADE_HOOKUP_OBJECT (prefs_dialog, spin_symbollistheight, "spin_symbollistheight"); GLADE_HOOKUP_OBJECT (prefs_dialog, label177, "label177"); GLADE_HOOKUP_OBJECT (prefs_dialog, label95, "label95"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox18, "vbox18");
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/keybindings.c 2007-11-12 09:27:43 UTC (rev 2044) @@ -288,10 +288,10 @@ GDK_space, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip")); keys[GEANY_KEYS_EDIT_MACROLIST] = fill(cb_func_edit, GDK_Return, GDK_CONTROL_MASK, "edit_macrolist", _("Show macro list")); - keys[GEANY_KEYS_EDIT_COMPLETECONSTRUCT] = fill(NULL, // has special callback - GDK_Tab, 0, "edit_completeconstruct", _("Complete construct")); - keys[GEANY_KEYS_EDIT_SUPPRESSCOMPLETION] = fill(cb_func_edit, - 0, 0, "edit_suppresscompletion", _("Suppress construct completion")); + keys[GEANY_KEYS_EDIT_COMPLETESNIPPET] = fill(NULL, // has special callback + GDK_Tab, 0, "edit_completesnippet", _("Complete snippet")); + keys[GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION] = fill(cb_func_edit, + 0, 0, "edit_suppresssnippetcompletion", _("Suppress snippet completion"));
keys[GEANY_KEYS_EDIT_SELECTWORD] = fill(cb_func_edit, GDK_w, GDK_SHIFT_MASK | GDK_MOD1_MASK, "edit_selectword", _("Select current word")); @@ -647,11 +647,11 @@ }
-/* We have a special case for GEANY_KEYS_EDIT_COMPLETECONSTRUCT, because we need to +/* We have a special case for GEANY_KEYS_EDIT_COMPLETESNIPPET, because we need to * return FALSE if no completion occurs, so the tab or space is handled normally. */ -static gboolean check_construct_completion(GdkEventKey *event) +static gboolean check_snippet_completion(GdkEventKey *event) { - const guint i = GEANY_KEYS_EDIT_COMPLETECONSTRUCT; + const guint i = GEANY_KEYS_EDIT_COMPLETESNIPPET;
if (keys[i]->key == event->keyval && keys[i]->mods == event->state) { @@ -664,8 +664,8 @@ ScintillaObject *sci = doc_list[idx].sci; gint pos = sci_get_current_position(sci);
- if (editor_prefs.auto_complete_constructs) - return editor_auto_complete(idx, pos); + if (editor_prefs.complete_snippets) + return editor_complete_snippet(idx, pos); } } return FALSE; @@ -738,7 +738,7 @@ if (vte_info.have_vte && check_vte(event->state, keyval)) return FALSE; #endif - if (check_construct_completion(event)) + if (check_snippet_completion(event)) return TRUE;
for (i = 0; i < GEANY_MAX_KEYS; i++) @@ -830,9 +830,7 @@
static void cb_func_menu_print(G_GNUC_UNUSED guint key_id) { - gint idx = document_get_cur_idx(); - if (idx == -1 || ! doc_list[idx].is_valid) return; - document_print(idx); + on_print1_activate(NULL, NULL); }
static void cb_func_menu_undo(G_GNUC_UNUSED guint key_id) @@ -1243,8 +1241,8 @@ editor_show_macro_list(doc_list[idx].sci); break;
- case GEANY_KEYS_EDIT_SUPPRESSCOMPLETION: - switch (keys[GEANY_KEYS_EDIT_COMPLETECONSTRUCT]->key) + case GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION: + switch (keys[GEANY_KEYS_EDIT_COMPLETESNIPPET]->key) { case GDK_space: sci_add_text(doc_list[idx].sci, " ");
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/keybindings.h 2007-11-12 09:27:43 UTC (rev 2044) @@ -160,8 +160,8 @@ GEANY_KEYS_EDIT_AUTOCOMPLETE = GEANY_KEYS_GROUP_TAGS, GEANY_KEYS_EDIT_CALLTIP, GEANY_KEYS_EDIT_MACROLIST, - GEANY_KEYS_EDIT_COMPLETECONSTRUCT, - GEANY_KEYS_EDIT_SUPPRESSCOMPLETION, + GEANY_KEYS_EDIT_COMPLETESNIPPET, + GEANY_KEYS_EDIT_SUPPRESSSNIPPETCOMPLETION, GEANY_KEYS_POPUP_GOTOTAGDEFINITION, GEANY_KEYS_POPUP_GOTOTAGDECLARATION,
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/keyfile.c 2007-11-12 09:27:43 UTC (rev 2044) @@ -181,7 +181,7 @@ g_key_file_set_string(config, PACKAGE, "long_line_color", editor_prefs.long_line_color);
// editor - g_key_file_set_integer(config, PACKAGE, "autocompletion_max_height", editor_prefs.autocompletion_max_height); + g_key_file_set_integer(config, PACKAGE, "symbolcompletion_max_height", editor_prefs.symbolcompletion_max_height); 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_integer(config, PACKAGE, "indent_mode", editor_prefs.indent_mode); @@ -189,7 +189,7 @@ g_key_file_set_boolean(config, PACKAGE, "use_indicators", editor_prefs.use_indicators); g_key_file_set_boolean(config, PACKAGE, "line_breaking", 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_complete_constructs", editor_prefs.auto_complete_constructs); + 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_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); @@ -455,7 +455,7 @@ editor_prefs.long_line_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0); editor_prefs.long_line_color = utils_get_setting_string(config, PACKAGE, "long_line_color", "#C2EBC2"); editor_prefs.long_line_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72); - editor_prefs.autocompletion_max_height = utils_get_setting_integer(config, PACKAGE, "autocompletion_max_height", GEANY_MAX_AUTOCOMPLETE_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_breaking", 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); @@ -465,7 +465,7 @@ editor_prefs.show_white_space = utils_get_setting_boolean(config, PACKAGE, "show_white_space", FALSE); editor_prefs.show_line_endings = utils_get_setting_boolean(config, PACKAGE, "show_line_endings", FALSE); editor_prefs.auto_close_xml_tags = utils_get_setting_boolean(config, PACKAGE, "auto_close_xml_tags", TRUE); - editor_prefs.auto_complete_constructs = utils_get_setting_boolean(config, PACKAGE, "auto_complete_constructs", TRUE); + editor_prefs.complete_snippets = utils_get_setting_boolean(config, PACKAGE, "complete_snippets", TRUE); editor_prefs.auto_complete_symbols = utils_get_setting_boolean(config, PACKAGE, "auto_complete_symbols", TRUE); editor_prefs.folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE); editor_prefs.unfold_all_children = utils_get_setting_boolean(config, PACKAGE, "unfold_all_children", FALSE); @@ -920,13 +920,10 @@ }
-void configuration_read_autocompletions() +void configuration_read_snippets() { gsize i, j, len = 0, len_keys = 0; - gchar *sysconfigfile = g_strconcat(app->datadir, G_DIR_SEPARATOR_S, - "autocomplete.conf", NULL); - gchar *userconfigfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, - "autocomplete.conf", NULL); + gchar *sysconfigfile, *userconfigfile; gchar **groups_user, **groups_sys; gchar **keys_user, **keys_sys; gchar *value; @@ -934,11 +931,20 @@ GKeyFile *userconfig = g_key_file_new(); GHashTable *tmp;
+ sysconfigfile = g_strconcat(app->datadir, G_DIR_SEPARATOR_S, "snippets.conf", NULL); + userconfigfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "snippets.conf", NULL); + + // check for old autocomplete.conf files (backwards compatibility) + if (! g_file_test(userconfigfile, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK)) + setptr(userconfigfile, + g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "autocomplete.conf", NULL)); + + // load the actual config files g_key_file_load_from_file(sysconfig, sysconfigfile, G_KEY_FILE_NONE, NULL); g_key_file_load_from_file(userconfig, userconfigfile, G_KEY_FILE_NONE, NULL);
// keys are strings, values are GHashTables, so use g_free and g_hash_table_destroy - editor_prefs.auto_completions = + editor_prefs.snippets = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_destroy);
// first read all globally defined auto completions @@ -948,7 +954,7 @@ keys_sys = g_key_file_get_keys(sysconfig, groups_sys[i], &len_keys, NULL); // create new hash table for the read section (=> filetype) tmp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(editor_prefs.auto_completions, g_strdup(groups_sys[i]), tmp); + g_hash_table_insert(editor_prefs.snippets, g_strdup(groups_sys[i]), tmp);
for (j = 0; j < len_keys; j++) { @@ -964,11 +970,11 @@ { keys_user = g_key_file_get_keys(userconfig, groups_user[i], &len_keys, NULL);
- tmp = g_hash_table_lookup(editor_prefs.auto_completions, groups_user[i]); + tmp = g_hash_table_lookup(editor_prefs.snippets, groups_user[i]); if (tmp == NULL) { // new key found, create hash table tmp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(editor_prefs.auto_completions, g_strdup(groups_user[i]), tmp); + g_hash_table_insert(editor_prefs.snippets, g_strdup(groups_user[i]), tmp); } for (j = 0; j < len_keys; j++) {
Modified: trunk/src/keyfile.h =================================================================== --- trunk/src/keyfile.h 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/keyfile.h 2007-11-12 09:27:43 UTC (rev 2044) @@ -37,7 +37,7 @@
void configuration_read_filetype_extensions();
-void configuration_read_autocompletions(); +void configuration_read_snippets();
/* set some settings which are already read from the config file, but need other things, like the * realisation of the main window */
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/main.c 2007-11-12 09:27:43 UTC (rev 2044) @@ -684,7 +684,7 @@ document_init_doclist(); treeviews_init(); configuration_read_filetype_extensions(); - configuration_read_autocompletions(); + configuration_read_snippets();
// set window icon { @@ -792,7 +792,7 @@ #endif if (app->project != NULL) project_close(); - + navqueue_free(); keybindings_free(); filetypes_save_commands();
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/plugindata.h 2007-11-12 09:27:43 UTC (rev 2044) @@ -71,7 +71,7 @@
/* The API version should be incremented whenever any plugin data types below are * modified or appended to. */ -static const gint api_version = 28; +static const gint api_version = 29;
/* 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
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2007-11-11 19:06:41 UTC (rev 2043) +++ trunk/src/prefs.c 2007-11-12 09:27:43 UTC (rev 2044) @@ -75,7 +75,6 @@ static void on_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data); -static void on_symbol_auto_completion_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_openfiles_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data);
@@ -363,8 +362,8 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.line_wrapping);
- widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_complete"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_complete_constructs); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_complete_snippets"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.complete_snippets);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_xmltag"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_close_xml_tags); @@ -397,10 +396,9 @@
widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.auto_complete_symbols); - on_symbol_auto_completion_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
- widget = lookup_widget(ui_widgets.prefs_dialog, "spin_autocheight"); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.autocompletion_max_height); + widget = lookup_widget(ui_widgets.prefs_dialog, "spin_symbollistheight"); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.symbolcompletion_max_height);
// Tools Settings @@ -693,8 +691,8 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_line_wrapping"); editor_prefs.line_wrapping = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- widget = lookup_widget(ui_widgets.prefs_dialog, "check_auto_complete"); - editor_prefs.auto_complete_constructs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_complete_snippets"); + editor_prefs.complete_snippets = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_xmltag"); editor_prefs.auto_close_xml_tags = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); @@ -733,8 +731,8 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion"); editor_prefs.auto_complete_symbols = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
- widget = lookup_widget(ui_widgets.prefs_dialog, "spin_autocheight"); - editor_prefs.autocompletion_max_height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); + widget = lookup_widget(ui_widgets.prefs_dialog, "spin_symbollistheight"); + editor_prefs.symbolcompletion_max_height = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
// Tools Settings @@ -1183,14 +1181,6 @@ }
-static void on_symbol_auto_completion_toggled(GtkToggleButton *togglebutton, gpointer user_data) -{ - gboolean sens = gtk_toggle_button_get_active(togglebutton); - - gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "hbox6"), sens); -} - - static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data) { gboolean sens = gtk_toggle_button_get_active(togglebutton); @@ -1275,8 +1265,6 @@ "toggled", G_CALLBACK(on_show_notebook_tabs_toggled), NULL); g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_folding"), "toggled", G_CALLBACK(on_use_folding_toggled), NULL); - g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_symbol_auto_completion"), - "toggled", G_CALLBACK(on_symbol_auto_completion_toggled), NULL); g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding"), "toggled", G_CALLBACK(on_open_encoding_toggled), NULL); g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles"),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.