Difference between revisions of "SpellChecker plugin"

From Code::Blocks
(Added usage tip.)
Line 10: Line 10:
  
 
=Introduction=
 
=Introduction=
A plugin to check the spelling of strings and comments. The spelling gets checked during typing. Additionally a thesaurus is provided.  
+
A plugin to check the spelling of strings and comments. The spelling gets checked during typing. Additionally a thesaurus is provided. Both may be accessed on-demand by selecting the word in question, then choosing either ''Spelling...'' or ''Thesaurus...'' for the ''Edit'' menu (the operation can be bound to a hot-key via the [[Keyboard Shortcuts plugin]]).
  
  
Line 53: Line 53:
 
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".
 
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.
+
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)==
 
==Bitmaps (flags)==

Revision as of 02:06, 3 October 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. Both may be accessed on-demand by selecting the word in question, then choosing either Spelling... or Thesaurus... for the Edit menu (the operation can be bound to a hot-key via the Keyboard Shortcuts plugin).


Configuration

Configuration is 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).

If you're 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, and everything is all in one location. Don't copy these files. Just point the spell checker to where the files are already located.

I understand on Windows, Firefox and Thunderbird also install compatible dictionary files. These can be found in... C:\Program Files\Mozilla Firefox\dictionaries or C:\Program Files\Mozilla Thunderbird\dictionaries

The Google Chrome browser also installs dictionaries, but they are .bdic format and the Code::Blocks spell checker plugin will not work with them.

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.