2.  Plugins

 2.1  Astyle
 2.2  CodeSnippets
 2.3  ToDo List
 2.4  Source Code Exporter
 2.5  Thread Search
  2.5.1  Features
  2.5.2  Usage
  2.5.3  Configuration
  2.5.4  Options
  2.5.5  Thread search options
  2.5.6  Layout
  2.5.7  Panel Management
  2.5.8  Logger Type
  2.5.9  Splitter Window Mode
  2.5.10  Sort Search Results
 2.6  File Explorer and Shell Extension Plugin
 2.7  Browse Tracker
 2.8  LibFinder
  2.8.1  Searching for libraries
  2.8.2  Including libraries in projects
  2.8.3  Using LibFinder and projects generated from wizards
 2.9  AutoVersioning
  2.9.1  Introduction
  2.9.2  Features
  2.9.3  Usage
  2.9.4  Dialog notebook tabs
  2.9.5  Including in your code
  2.9.6  Change log generator
 2.10  Code statistics
 2.11  Searching Available Source Code
 2.12  Code profiler
 2.13  Symbol Table Plugin

2.1.  Astyle

Artistic Style is a source code indenter, source code formatter, and source code beautifier for the C, C++, C# programming languages. It can be used to select different styles of coding rules within CodeBlocks.


pict

Figure 2.1: Formating your source code

When indenting source code, we as programmers have a tendency to use both spaces and tab characters to create the wanted indentation. Moreover, some editors by default insert spaces instead of tabs when pressing the tab key, and other editors have the ability to prettify lines by automatically setting up the white space before the code on the line, possibly inserting spaces in a code that up to now used only tabs for indentation.

Since the number of space characters shown on screen for each tab character in the source code changes between editors, one of the standard problems programmers are facing when moving from one editor to another is that code containing both spaces and tabs that was up to now perfectly indented, suddenly becomes a mess to look at when changing to another editor. Even if you as a programmer take care to ONLY use spaces or tabs, looking at other people’s source code can still be problematic.

To address this problem, Artistic Style was created - a filter written in C++ that automatically re-indents and re-formats C / C++ / C# source files.

Note:
When copying code, for example from the internet or a manual, this code will automatically be adapted to the coding rules in CodeBlocks.

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.

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.


pict

Figure 2.2: Editing a text module

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 Editing a text module 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 will be opened in your favorite browser with the context menu ’Open Url’ .

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. CodeSnippets View 2.3 shows a typical display in the CodeSnippets window.


pict

Figure 2.3: CodeSnippets View

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.

2.3.  ToDo List

In complex software projects, where different users are involved, there is often the requirement of different tasks to be performed by different users. For this purpose, CodeBlocks offers a Todo List. This list can be opened via ’View’ /’To-Do list’ , and contains the tasks to be performed, together with their priorities, types and the responsible users. The list can be filtered for tasks, users and/or source files.


pict

Figure 2.4: Displaying the ToDo List

Note:
The To-Do list can be docked in the message console. Select the option ’Include the To-Do list in the message pane’ via the menu ’Settings’ /’Environment’ .

If the sources are opened in CodeBlocks, a Todo can be added to the list via the context menu command ’Add To-Do item’. A comment will be added in the selected line of the source code.

  // TODO (user#1#): add new dialog for next release

When adding a To-Do, a dialogue box will appear where the following settings can be made (see Dialogue for adding a ToDo 2.5).


pict

Figure 2.5: Dialogue for adding a ToDo

User
User name <user> in the operating system. Tasks for other users can also be created here. In doing so, the corresponding user name has to be created by Add new. The assignment of a Todo is then made via the selection of entries listed for the User.

Note:
Note that the Users have nothing to do with the Personalities used in CodeBlocks.
Type
By default, type is set to Todo.
Priority
The importance of tasks can be expressed by priorities (1 - 9) in CodeBlocks.
Position
This setting specifies whether the comment is to be included before, after or at the exact position of the cursor.
Comment Style
A selection of formats for comments (e.g. doxygen).

2.4.  Source Code Exporter

The necessity occurs frequently of transferring source code to other applications or to e-mails. If the text is simply copied, formatting will be lost, thus rendering the text very unclear. The CodeBlocks export function serves as a remedy for such situations. The required format for the export file can be selected via ’File’ /’Export’ . The program will then adopt the file name and target directory from the opened source file and propose these for saving the export file. The appropriate file extension in each case will be determined by the export format. The following formats are available.

html
A text-based format which can be displayed in a web browser or in word processing applications.
rtf
The Rich Text format is a text-based format which can be opened in word processing applications such as Word or OpenOffice.
odt
Open Document Text format is a standardised format which was specified by Sun and O’Reilly. This format can be processed by Word, OpenOffice and other word processing applications.
pdf
The Portable Document Format can be opened by applications such as the Acrobat Reader.

2.5.  Thread Search

Via the ’Search’ /’Thread Search’ menu, the appropriate plug-in can be shown or hidden as a tab in the Messages Console. In CodeBlocks, a preview can be displayed for the occurrence of a character string in a file, workspace or directory. In doing so, the list of search results will be displayed on the right-hand side of the ThreadSearch Console. By clicking an entry in the list, a preview is displayed on the left-hand side. By double-clicking in the list, the selected file is opened in the CodeBlocks editor.

Note:
The scope of file extensions to be included in the search, is preset and might have to be adjusted.

2.5.1.  Features

ThreadSearch plugin offers the following features:


pict

Figure 2.6: Thread Search Panel

2.5.2.  Usage

  1. Configure your search preferences (see Configuration of Thread Search 2.7)

    Once the plugin is installed, there are 4 ways to run a search:

    1. Type/Select a word in the search combo box and press enter or click on Search on the Thread search panel of the Messages notebook.
    2. Type/Select a word in the toolbar search combo box and press enter or click on Search button.
    3. Right click on any ’word’ in active editor and click on ’Find occurrences’.
    4. Click on Search/Thread search to find the current word in active editor.

      Note:
      Items 1, 2 and 3 may not be available according to current configuration.
  2. Click again on the search button to cancel current search.
  3. A single click on a result item displays it on the preview editor at right location.
  4. A double click on a result item opens or set an editor in editors notebook at right location.

2.5.3.  Configuration

To access ThreadSearch plugin configuration panel click on (see Configuration of Thread Search 2.7):


pict

Figure 2.7: Configuration of Thread Search

  1. Options button on Messages notebook Thread search panel.
  2. Options button on Thread search toolbar.
  3. Settings/Environment menu item and then on the Thread search item on the left columns.

Note:
Items 1, 2 and 3 may not be available according to current configuration.

Search in part defines the set of files that will be analysed.

2.5.4.  Options

Whole word
if checked, line matches search expression if search expression is found with no alpha-numeric +_ before and after.
Start word
if checked, line matches search expression if search expression is found at the beginning of a word, ie no alpha-numeric +_ before search expression.
Match case
if checked, the search is case sensitive.
Regular expression
the search expression is a regular expression.

Note:
If you want to search for regular expressions like n you will have to set the option ’Use Advanced RegEx searches’ via the menu ’Settings’ /’Editor’ /’General Settings’ .

2.5.5.  Thread search options

Enable ’Find occurrences contextual menu item’
If checked, the Find occurrences of ’Focused word’ entry is added to the editor contextual menu.
Use default options when running ’Find occurrences’
If checked, a set of default options is applied to the searches launched with the ’Find occurrences’ contextual menu item.Per defaut option ’Whole word’ and ’Match case’ is enabled.

2.5.6.  Layout

Display header in log window
if checked, the header are displayed in the results list control.

Note:
If unchecked, the columns are no longer resizeable but space is spared.
Draw lines between columns
Draws lines between columns in list mode.
Show ThreadSearch toolbar
Display the toolbar of Thread Search plugin.
Show search widgets in ThreadSearch Messages panel
If checked, only the results list control and the preview editor are displayed. All other search widgets are hidden (spares space).
Show code preview editor
Code preview can be hidden either with this check box or with a double click on the splitter window middle border. This is where it can be shown again.

2.5.7.  Panel Management

You can choose different modes how the the ThreadSearch window is managed. With the setting ’Message Notebook’ the ThreadSearch window will be a dockable window in the message panel. If you choose the setting ’Layout’ you will be able to undock the window from the message panel and put it somewhere else.

2.5.8.  Logger Type

The view of the search results can be displayed in different ways. The setting ’List’ displays all occurrences as list. The other mode ’Tree’ gathers all occurrences within a file as a node.

2.5.9.  Splitter Window Mode

The user can configure a horizontal or vertical splitting of the preview window and the output window of the search results.

2.5.10.  Sort Search Results

The view of the search results may be sorted by path or file name.

2.6.  File Explorer and Shell Extension Plugin

The File Explorer The file manager 2.8 is included in the Shell Extensions plugin, and can be found in the ’Files’ tab. The composition of the File Explorer is shown in The file manager 2.8.

On top you will find a field for entering the path. By clicking the button at the end of this field, the drop-down field will list a history of the past entries which can be navigated via a scroll bar. The up arrow key on the right-hand side of the field moves up the directory structure one directory.

In the ’Wildcard’ field you can enter a filter term for the file display. Leaving the field empty or entering * results in all files being displayed. Entering *.c;*.h, for example will result in solely C sources and header files being displayed. Opneing the pull-down field will, again, list a history of the last entries.


pict

Figure 2.8: The file manager

Pressing the Shift key and clicking selects a group of files or directories, pressing the Ctrl key and clicking selects multiple separate files or directories.

The following operations can be started via the context menu if one or multiple directories are selected in the File Explorer:

Make Root
defines the current directory as the root directory.
Add to Favorites
sets a marker for the directory and stores it as a favourite. This function allows you to navigate quickly between frequently used directories, also on different network drives.
New File
creates a new file in the selected directory.
Make Directory
creates a new subdirectory in the selected directory.

The following operations can be started via the context menu if one or multiple files or directories are selected in the File Explorer:

Duplicate
copies a file/directory and renames it.
Copy To
opens a dialogue for entering the target directory in which the copied file/directory is to be stored.
Move To
moves the selection to the target location.
Delete
deletes the selected files/directories.
Show Hidden Files
activates/deactivates the display of hidden system files. When activated, this menu entry is checkmarked.
Refresh
update the display of the directory tree.

The following operations can be started via the context menu if one or multiple files are selected in the File Explorer:

Open in CB Editor
opens the selected file in the CodeBlocks editor.
Rename
renames the selected file.
Add to active project
adds the file(s) to the active project.

Note:
The files/directories selected in the File Explorer can be accessed in the Shell Extensions plugin via the mpaths variable.

User-defined functions can be specified via the menu command ’Settings’ /’Environment’ /’Shell Extensions’ . In the Shell Extensions mask, a new function which can be named at random, is created via the ’New’ button. In the ’ShellCommand Executable’ field, the executable program is stated, and in the field at the bottom of the window, additional parameters can be passed to the program. By clicking the function in the context menu or the Shell Extensions menu, the function is started and will then process the selected files/directories. The output is redirected to a separate shell window.

For example a menu entry in ’Shell Extensions’ /’SVN’ and in the context menu is created for ’SVN’. $file in this context means the file selected in the File Explorer, $mpath the selected files or directories (see Variable Expansion 3.2).

   Add;$interpreter add $mpaths;;;

This and every subsequent command will create a submenu, in this case called ’Extensions’ /’SVN’ /’Add’ . The context menu is extended accordingly. Clicking the command in the context menu will make the SVN command add process the selected files/directories.

TortoiseSVN is a widespread SVN program with integration in the explorer. The program TortoiseProc.exe of TortoiseSVN can be started in the command line and dispalys a dialogue to collect user input. So you can perform the commands, that are available as context menu in the explorer also in the command line. Therefore you can integrate it also a shell extension in CodeBlocks. For example the command

  TortoiseProc.exe /command:diff /path:$file

will diff a selected file in the CodeBlocks file explorer with the SVN base. See Add a shell extension to the context menu 2.9 how to integrate this command.

Note:
For files that are under SVN control the file explorer shows overlay icons if they are actived via menu ’View’ /’SVN Decorators’ .

pict

Figure 2.9: Add a shell extension to the context menu

Example

You can use the file explorer to diff files or directories. Follow these steps:

  1. Add the name via menu ’Settings’ /’Environment’ /’Shell Extensions’ . This is shown as entry in the interpreter menu and the context menu.
  2. Select the absolute path of Diff executable (e.g. kdiff3). The program is accessed with the variable $interpreter.
  3. Add parameters of the interpreter
      Diff;$interpreter $mpaths;;;

This command will be executed using the selected files or directories as parameter. The selection is accessed via the variable $mpaths. This is an easy way to diff files or directories.

Note:
The plug-in supports the use of CodeBlocks variables within the shell extension.
$interpreter

Call this executable.

$fname

Name of the file without extension.

$fext

Extension of the selected file.

$file

Name of the file.

$relfile

Name of the file without path info.

$dir

Name of the selected directory.

$reldir

Name of directory without path info.

$path

Absolute path.

$relpath

Relative path of file or directory.

$mpaths

List of current selected files or directories.

$inputstr{<msg>}

String that is entered in a message window.

$parentdir

Parent directory (../).

Note:
The entries of shell extension are also available as context menu in the CodeBlocks editor.

2.7.  Browse Tracker

Browse Tracker is a plug-in that helps navigating between recently opened files in CodeBlocks. The list of recent files is saved in a history. With the menu ’View’ /’Browse Tracker’ /’Clear All’ the history is cleared.

With the window ’Browsed Tabs’ you can navigate between the items of the recently opened files using the menu entry ’View’ /’Browse Tracker’ /’Backward Ed/Forward Ed’ or the shortcut Alt-Left/Alt-Right. The Browse Tracker menu is also accessible as context menu. The markers are saved in the layout file <projectName>.bmarks

A common procedure when developing software is to struggle with a set of functions which are implemented in different files. The BrowseTracks plug-in will help you solve this problem by showing you the order in which the files were selected. You can then comfortably navigate the function calls.

The plug-in allows even browse markers within each file in the CodeBlocks editor. The cursor position is memorized for every file. You can set this markers using the menu item ’View’ /’ Browse Tracker’ /’ Set BrowseMarks’ or with selecting a line with the left mouse button. A marker with is shown in the left margin. With the menu ’View’ /’Browse Tracker’ /’Prev Mark/Next Mark’ or the shortcut Alt-up/Alt-down you can navigate through the markers within a file. If you want to navigate in a file between markers sorted by line numbers then just select the menu ’View’ /’Browse Tracker’ /’Sort BrowseMark’ .

With the ’Clear BrowseMark’ the marker in a selected line is removed. If a marker is set for a line, holding left-mouse button down for 1/4 second while pressing the Ctrl key will delete the marker for this line. Via the menu ’Clear All BrowseMarks’ or with a Ctrl-left click on any unmarked line will reset the markers within a file.

The settings of the plug-in can be configure via the menu ’View’ /’Browse Tracker’ /’Settings’ .

Mark Style
Browse Marks are displayed per default as within the margin. With the setting ’Book_Marks’ they will be displayed like Bookmarks as blue arrow in the margin. With hide the display of Browse Marks is suppressed.
Toggle Browse Mark key
Markers can be set or removed either by a click with the left mouse button or with a click while holding the crtl key.
Toggle Delay
The duration of holding the left mouse button to enter the Browse Marker mode.
Clear All BrowseMarks
while holding Ctrl key either by a simple or a double click with the left mouse button.

The configuration of the plug-in is stored in your application data directory in the file default.conf. If you use the personality feature of CodeBlocks the configuration is read from the file <personality>.conf.

2.8.  LibFinder

If you want to use some libraries in your application, you have to configure your project to use them. Such configuration process may be hard and annoying because each library can use custom options scheme. Another problem is that configuration differs on platforms which result in incompatibility between unix and windows projects.

LibFinder provides two major functionalities:

2.8.1.  Searching for libraries

Searching for libraries is available under ’Plugins’ /’Library finder’ menu. It’s purpose is to detect libraries installed on your system and store the results inside LibFinder’s database (note that these results are not written into CodeBlocks project files). Searching starts with dialogue where you can provide set of directories with installed libraries. LibFinder will scan them recursively so if you’re not sure you may select some generic directories. You may even enter whole disks — in such case searching process will take more time but it may detect more libraries (see List of directories 2.10).


pict

Figure 2.10: List of directories

When LibFinder scans for libraries, it uses special rules to detect presence of library. Each set of rules is located in xml file. Currently LibFinder can search for wxWidgets 2.6/2.8, CodeBlocks SDK and GLFW — the list will be extended in future.

Note:
To get more details on how to add library support into LibFinder, read src/plugins/contrib/lib_finder/lib_finder/readme.txt in CodeBlocks sources.

After completing the scan, LibFinder shows the results (see Search results 2.11).


pict

Figure 2.11: Search results

In the list you check libraries which should be stored into LibFinder’s database. Note that each library may have more than one valid configuration and settings added ealier are more likely to be used while building projects.

Below the list you can select what to do with results of previous scans:

Do not clear previous results
This option works like an update to existing results — it adds new ones and updates those which already exist. This option is not recommended.
Second option (Clear previous results for selected libraries)
will clear all results for libraries which are selected before adding new results. This is the recommended option.
Clear all previous library settings
when you select this option, LibFinder’s database will be cleared before adding new results. It’s useful when you want to clean some invalid LibFinder’s database.

Another option in this dialogue is ’Set up Global Variables’ . When you check this option, LibFinder will try automatically configure Global Variables which are also used to help dealing with libraries.

If you have pkg-config installed on your system (it’s installed automatically on most linux versions) LibFinder will also provide libraries from this tool. There is no need to perform scanning for them — they are automatically loaded when CodeBlocks starts.

2.8.2.  Including libraries in projects

LibFinder adds extra tab in Project Properties ’Libraries’ — this tab shows libs used in project and libs known in LibFinder. To add library into your project, select it in right pane and click < button. To remove library from project, select it on the left pane and click > button (see Project configuration 2.12).


pict

Figure 2.12: Project configuration

You can filter libraries known to LibFinder by providing search filter. The ’Show as Tree’ checkbox allows to switch between categorized and uncategorized view.

If you want to add library which is not available in LibFinder’s database, you may use ’Unknown Library’ field. Note that you should enter library’s shortcode (which usually matches global variable name) or name of library in pkg-config. List of suggested shortcodes can be found at Global Variables. Using this option is recommended only when preparing project to be built on other machines where such library exists and is properly detected by LibFinder. You can access a global variable within CodeBlocks like:

  $(#GLOBAL_VAR_NAME.include)

Checking the ’Don’t setup automatically’ option will notify LibFinder that it should not add libraries automatically while compiling this project. In such case, LibFinder can be invoked from build script. Example of such script is generated and added to project by pressing ’Add manual build script’ .

2.8.3.  Using LibFinder and projects generated from wizards

Wizards will create projects that don’t use LibFinder. To integrate them with this plugin, you will have to manually update project build options. This can be easily achieved by removing all library-specific settings and adding library through ’Libraries’ tab in project properties.

Such project becomes cross-platform. As long as used libs are defined in LibFinder’s database, project’s build options will be automatically updated to match platform-specific library settings.

2.9.  AutoVersioning

An application versioning plug in that increments the version and build number of your application every time a change has been made and stores it in version.h with easy to use variable declarations. Also have a feature for committing changes a la SVN style, a version scheme editor, a change log generator and more

2.9.1.  Introduction

The idea of the AutoVersioning plugin was made during the development of a pre-alpha software that required the version info and status. Been to busy coding, without time to maintain the version number, just decided to develop a plugin that could do the job with little intervention as possible.

2.9.2.  Features

Here is the list of features the plugin covers summarized:

2.9.3.  Usage

Just go to ’Project’ /’Autoversioning’ menu. A pop up window like this will appear:


pict

Figure 2.13: Configure project for Autoversioning

When hitting yes on the ask to configure message box, the main auto versioning configuration dialog will open, to let you configure the version info of your project.

After configuring your project for auto versioning, the settings that you entered on the configuration dialog will be stored on the project file, and a version.h file will be created. For now, every time that you hit the ’Project’ /’Autoversioning’ menu the configuration dialog will popup to let you edit your project version and versioning related settings, unless you don’t save the new changes made by the plugin to the project file.

2.9.4.  Dialog notebook tabs

2.9.4.1 Version Values

Here you just enter the corresponding version values or let the auto versioning plugin increment them for you (see Set Version Values 2.14).

Major
Increments by 1 when the minor version reaches its maximum
Minor
Increments by 1 when the build number pass the barrier of build times, the value is reset to 0 when it reach its maximum value.
Build Number
(also equivalent to Release) - Increments by 1 every time that the revision number is incremented.
Revision
Increments randomly when the project has been modified and then compiled.

pict

Figure 2.14: Set Version Values

2.9.4.2 Status

Some fields to keep track of your software status with a list of predefined values for convenience(see Set Status of Autoversioning 2.15).

Software Status
The typical example should be v1.0 Alpha
Abbreviation
Same as software status but like this: v1.0a

pict

Figure 2.15: Set Status of Autoversioning

2.9.4.3 Scheme

Lets you edit how the plugin will increment the version values (see Scheme of autoversioning 2.16).


pict

Figure 2.16: Scheme of autoversioning

Minor maximum
The maximum number that the Minor value can reach, after this value is reached the Major is incremented by 1 and next time project is compiled the Minor is set to 0.
Build Number maximum
When the value is reached, the next time the project is compiled is set to 0. Put a 0 for unlimited.
Revision maximum
Same as Build Number maximum. Put a 0 for unlimited
Revision random maximum
The revision increments by random numbers that you decide, if you put here 1, the revision obviously will increment by 1.
Build times before incrementing Minor
After successful changes to code and compilation the build history will increment, and when it reaches this value the Minor will increment.
2.9.4.4 Settings

Here you can set some settings of the auto versioning behavior (see Settings of Autoversioning 2.17).


pict

Figure 2.17: Settings of Autoversioning

Autoincrement Major and Minor
Lets the plugin increments this values by you using the scheme. If not marked only the Build Number and Revision will increment.
Create date declarations
Create entries in the version.h file with dates and ubuntu style version.
Do Auto Increment
This tells the plugin to automatically increment the changes when a modification is made, this incrementation will occur before compilation.
Header language
Select the language output of version.h
Ask to increment
If marked, Do Auto Increment, it ask you before compilation (if changes has been made) to increment the version values.
svn enabled
Search for the svn revision and date in the current folder and generates the correct entries in version.h
2.9.4.5 Changes Log

This lets you enter every change made to the project to generate a ChangesLog.txt file (see Changelog of Autoversioning 2.18).


pict

Figure 2.18: Changelog of Autoversioning

Show changes editor when incrementing version
Will pop up the changes log editor when incrementing the version.
Title Format
A format able title with a list of predefined values.

2.9.5.  Including in your code

To use the variables generated by the plugin just #include <version.h>. An example code would be like the following:

  #include <iostream>
  #include "version.h"
  
  void main(){
      std::cout<<AutoVersion::Major<<endl;
  }

2.9.5.1 Output of version.h

The generated header file. Here is a sample content of the file on c++ mode:

  #ifndef VERSION_H
  #define VERSION_H
  
  namespace AutoVersion{
  
   //Date Version Types
   static const char DATE[] = "15";
   static const char MONTH[] = "09";
   static const char YEAR[] = "2007";
   static const double UBUNTU_VERSION_STYLE = 7.09;
  
   //Software Status
   static const char STATUS[] = "Pre-alpha";
   static const char STATUS_SHORT[] = "pa";
  
   //Standard Version Type
   static const long MAJOR = 0;
   static const long MINOR = 10;
   static const long BUILD = 1086;
   static const long REVISION = 6349;
  
   //Miscellaneous Version Types
   static const long BUILDS_COUNT = 1984;
   #define RC_FILEVERSION 0,10,1086,6349
   #define RC_FILEVERSION_STRING "0, 10, 1086, 6349\0"
   static const char FULLVERSION_STRING[] = "0.10.1086.6349";
  
  }
  #endif //VERSION_h

On C mode is the same as C++ but without the namespace:

  #ifndef VERSION_H
  #define VERSION_H
  
   //Date Version Types
   static const char DATE[] = "15";
   static const char MONTH[] = "09";
   static const char YEAR[] = "2007";
   static const double UBUNTU_VERSION_STYLE = 7.09;
  
   //Software Status
   static const char STATUS[] = "Pre-alpha";
   static const char STATUS_SHORT[] = "pa";
  
   //Standard Version Type
   static const long MAJOR = 0;
   static const long MINOR = 10;
   static const long BUILD = 1086;
   static const long REVISION = 6349;
  
   //Miscellaneous Version Types
   static const long BUILDS_COUNT = 1984;
   #define RC_FILEVERSION 0,10,1086,6349
   #define RC_FILEVERSION_STRING "0, 10, 1086, 6349\0"
   static const char FULLVERSION_STRING[] = "0.10.1086.6349";
  
  #endif //VERSION_h

2.9.6.  Change log generator

This dialog is accessible from the menu ’Project’ /’Changes Log’ . Also if checked Show changes editor when incrementing version on the changes log settings, the window will open to let you enter the list of changes after a modification to the project sources or an incrementation event (see Changes for a project 2.19).


pict

Figure 2.19: Changes for a project

2.9.6.1 Buttons Summary
Add
Appends a row in to the data grid
Edit
Enables the modification of the selected cell
Delete
Removes the current row from the data grid
Save
Stores into a temporary file (changes.tmp) the actual data for later procesing into the changes log file
Write
Process the data grid data to the changes log file
Cancel
Just closes the dialog without taking any action

Here is an example of the output generated by the plugin to the ChangesLog.txt file:

  03 September 2007
     released version 0.7.34 of AutoVersioning-Linux
  
       Change log:
          -Fixed: pointer declaration
          -Bug: blah blah
  
  02 September 2007
     released version 0.7.32 of AutoVersioning-Linux
  
       Change log:
          -Documented some areas of the code
          -Reorganized the code for readability
  
  01 September 2007
     released version 0.7.30 of AutoVersioning-Linux
  
       Change log:
          -Edited the change log window
          -If the change log windows is leave blank no changes.txt is modified

2.10.  Code statistics


pict

Figure 2.20: Konfiguration für Code Statistik

Based on the entries in the configuration mask, this simple plugin detects the proportions of code, commentaries and blank lines for a project. The evaluation is called via the menu command ’Plugins’ /’Code statistics’ .

2.11.  Searching Available Source Code

This plugin makes it possible to select a term within the editor and to search for this term via the context menu ’Search at Koders’ in the [?] database. The dialogue offers the additional possibilities to of filtering for program languages and licences.

This database search will help you find source code originating from other world-wide projects of universities, consortiums and organisations such as Apache, Mozilla, Novell Forge, SourceForge and many others, which can be re-used without having to reinvent the wheel every time. Please observe the licence of the source code in each individual case.

2.12.  Code profiler

A simple graphical interface to the GNU GProf Profiler.

2.13.  Symbol Table Plugin

This plugin makes it possible to search for symbols in objects and libraries. The options and the path for the command line program nm are defined in the Options tab.


pict

Figure 2.21: Configuring the Symbol Table

Clicking the ’Search’ stats the search, the results of the NM program are displayed in a separate window caleld ’SymTabs Result’. The name of the objects or libraries containing the symbol are listed under the title ’NM’s Output’.