Difference between revisions of "SpellChecker plugin"

From Code::Blocks
Line 14: Line 14:
  
 
=Configuration=
 
=Configuration=
 +
We're in the menu Settings > Editor. The spell check option are about half way down the list on the left.
 
[[File:ConfigureSpellChecker.png]]
 
[[File:ConfigureSpellChecker.png]]
 
You can find the spell check configuration in the menu Settings > Editor. The spell check option are about half way down the list on the left.
 
  
 
The meaning of the controls are:
 
The meaning of the controls are:

Revision as of 18:57, 26 September 2011


SpellChecker
SpellChecker.png
Developer(s): Daniel Anselmi
Maintainer(s): Daniel Anselmi
Version: 0.1

Introduction

A plugin to check the spelling of strings and comments. The spelling gets checked during typing. Additionally a thesaurus is provided.


Configuration

We're in the menu Settings > Editor. The spell check option are about half way down the list on the left. ConfigureSpellChecker.png

The meaning of the controls are:

Enable online spell checker

Enable or disable the spell checker.

Language

The language used for spell checking and the thesaurus is selected by choosing a dictionary. This can also be changed in the status bar.

Path settings, Dictionaries

The plugin is looking in this path for the dictionary files.

Path settings, Thesauri

The plugin is looking in this path for the files needed by the thesaurus.

Path settings, Bitmaps

(Optional) The plugin is looking in this path for the flags to show in the status bar.

Dictionaries

SpellChecker uses a library called hunspell. Hunspell is the spell checker of OpenOffice.org, Mozilla Firefox and other projects. Dictionaries available for those applications are compatible with this plugin.

Open Office provides a collection of dictionaries for several languages and dialects to download. The OOo 3.x extensions (*.oxt) are compressed archives which can be opened with your favourite archiver (for example 7-Zip or File Roller). Copy the .aff file and the .dic file to the directory configured in 'Path settings, Dictionaries' (see above).

I don't know about Windows, but if your running Linux you've probably already got compatible dictionaries installed. Look in /usr/share/hunspell or my choice is /usr/share/myspell/dicts. The reason I like the myspell files is they already include thesaurus files which are named correctly to work with the thesaurus. Don't copy these files. Just point the spell checker to where the files are already located.

Thesaurus files

The files for the thesaurus are also available from OOo, like the dictionaries. Copy the thesaurus files (th_*.dat and th_*.idx) to the directory configured in 'Path settings, Thesauri' (see above) and rename them to match the name of the dictionary but prepend "th_" and let the extension as is.

Example: If the dictionary files (for one language) are "en_GB.aff" and "en_GB.dic" the files used for the thesaurus are "th_en_GB.idx" and "th_en_GB.dat".

On my Linux system I found thesaurus files already installed in /usr/share/myspell/dicts and /usr/share/mythes. Again, don't move the files. Set the spell checker to use the files from there current location.

Bitmaps (flags)

The bitmap of the actually selected language is shown in the status bar. If no bitmap is found, the name of the language is shown. The bitmap must be a PNG image. Choose a flag from the famfamfam_flag_icons and copy it to the directory configured in 'Path settings, Bitmaps' (see above) and rename it to match the name of the dictionary but let the extension png.

Example: If the dictionary files (for one language) are "en_GB.aff" and "en_GB.dic" the the bitmap is named "en_GB.png" .

Styles to check

Only text with specific styles gets checked (for example only comments and strings). Styles are automatically set by Scintilla (CodeBlocks editing component).

The file OnlineSpellChecking.xml contains a list with indices of the styles to check. The indices differ for different programming-languages so the file contains a list for every programming-language. To add styles, look for the name of the programming-language and the indices in the corresponding lexer_XY.xml file and add this information to the file OnlineSpellChecking.xml.