2.2 CodeSnippets |
The CodeSnippets plug-in makes it possible to structure text modules and links to files
according to categories in a tree view. The modules are used for storing often used files and constructs in
text modules and managing them in a central place. Imagine the following situation: A number of frequently used
source files are stored in different directories of the file system. The CodeSnippets window provides the
opportunity to create categories, and below the categories, links to the required files. With these features,
you can control the access to the files independently from where they are stored within the file system, and
you can navigate quickly between the files without the need to search the whole system.
Note:
You can use CodeBlocks variables or environment variables in file links e.g. $(VARNAME)/name.pdf to parametrise a link in the CodeSnippets browser.
You can use CodeBlocks variables or environment variables in file links e.g. $(VARNAME)/name.pdf to parametrise a link in the CodeSnippets browser.
The list of text modules and links can be stored in the CodeSnippets window by right-clicking and selecting
’Save Index’ from the context menu. The file
codesnippets.xml which will be
created by this procedure, can then be found in the codeblocks
subdirectory of your
Documents and
Settings\Application
data directory. Under Linux, this information is
stored in the .codeblocks
subdirectory of your HOME directory. The CodeBlocks
configuration files will be loaded during the next start-up. If you wish to save the content of CodeSnippets at
a different location, select the ’Save Index As’ entry. To load this file, select ’Load Index
File’ during the next start-up of CodeBlocks or include the directory in the ’Settings’ context
menu under ’Snippet Folder’. The settings are saved in the corresponding file
codesnippets.ini in
your application data.
For including a category, use the ’Add SubCategory’ menu. A category can contain
Snippets (text modules) or File Links. A text module is created via the ’Add Snippet’ command in the
context menu. The content is integrated into the text module as ’New snippet’ by selecting the text
passage in the CodeBlocks editor and dragging and dropping it onto the module and the properties dialog pops
up. Double-clicking the newly included entry or selecting ’Edit Text’ will open an editor for the
content.
Output of a text module is handled in CodeBlocks via the context menu command
’Apply’ or by dragging and dropping into the editor. Under Windows, the contents of a Snippet can
also be dragged and dropped into other applications. In the CodeSnippets Browser you can copy a selected item
with drag and drop to a different category.
Beyond this, text modules can be parametrised by
<name>
variables which can be accessed
via $(name) (see
Figure 2.2). The values of the variables
can be retrieved in an entry field if the text module is called via the context menu command ’Apply’.
Besides the text modules, links to files can also be created. If, after having created a text
module, you click the context menu command ’Properties’, then you can select the link target by
clicking the ’Link target’ button. This procedure will automatically convert the text module into a
link to a file. In CodeSnippets, all text modules will be marked by a T symbol, links to a file by an F symbol
and urls by an U symbol. If you want to open a selected file (link) in the codesnippets view just select the
context menu ’Open File’ or hold the ’Alt’ key and make a double click on the file.
Note:
You can add even url (e.g. http://www.codeblocks.org) in text modules. The url can be opened using the context menu ’Open Url’ or using drag and drop to your favorite web browser.
You can add even url (e.g. http://www.codeblocks.org) in text modules. The url can be opened using the context menu ’Open Url’ or using drag and drop to your favorite web browser.
With this setting, if open a link to a pdf file from the codesnippets view a pdf viewer will be started
automatically. This method makes it possible for a user to access files which are spread over the whole
network, such as cad data, layouts, documentations etc., with the common applications, simply via the link. The
content of the codesnippets is stored in the file
codesnippets.xml, the
configuration is stored in the file codesnippets.ini
in your application
data directory. This ini file will, for example,
contain the path of the file
codesnippets.xml.
CodeBlocks supports the usage of different profiles. These profiles are called personalities.
Starting CodeBlocks with the command line option
--personality=<profile>
will create a new or use an existing profile. Then the settings will not be stored in the file
default.conf, but in
<personality>.conf
in your application
data directory instead. The Codesnippets plugin will
then store its settings in the file
<personality>.codesnippets.ini.
Now, if you load a new content
<name.xml>
in the Codesnippets settings
via ’Load Index File’, this content will be stored in the corresponding ini file. The advantage of
this method lies in the fact that in case of different profiles, different configurations for text modules and
links can be managed.
The plug-in offers an additional search function for navigating between the categories and Snippets. The scope
for searching Snippets, categories or Snippets and categories can be adjusted. By entering
the required search expression, the corresponding entry is automatically selected in the view.
Figure 2.3 shows a typical display in the
CodeSnippets window.
Note:
When using voluminous text modules, the content of these modules should be saved in files via ’Convert to File Link’ in order to reduce memory usage within the system. If you delete a codesnippet or file link it will be moved to the category .trash; if you hold the Shift key the item will be deleted.
When using voluminous text modules, the content of these modules should be saved in files via ’Convert to File Link’ in order to reduce memory usage within the system. If you delete a codesnippet or file link it will be moved to the category .trash; if you hold the Shift key the item will be deleted.
2.1 Astyle
2.3 Incremental Search
Created: 2010/25/05 11:52 Updated: 2010/25/05 11:52
Author: HighTec EDV-Systeme GmbH
Copyright © 2010 HighTec EDV-Systeme GmbH
Author: HighTec EDV-Systeme GmbH
Copyright © 2010 HighTec EDV-Systeme GmbH