-----------------------------------------------------------
XBrackets plugin for AkelPad text editor
-----------------------------------------------------------

This plugin allows to:
1) autocomplete brackets ([{""}]) i.e. it inserts 
   corresponding right bracket when the left bracket 
   is typed.
   The plugin uses "smart" autocompletion: 
   - next character is analysed for ([{ brackets;
   - next & previous characters are analysed for " quote.
2) highlight active brackets i.e. it highlights a bracket 
   under the cursor and its corresponding pair bracket.
3) go to matching pair bracket - using GoToMatchingBracket.
4) select a text between matching pair brackets - using
   SelToMatchingBracket.

Note:
To prevent repainting of active brackets highlighted,
XBrackets.dll must be loaded AFTER HighLight.dll.
Functions "GoToMatchingBracket" and "SelToMatchingBracket"
require the plugin to be active - i.e. its function "Main" 
must be active.

Additional options (file "AkelFiles\Plugs\XBrackets.ini"):
  common.user_brpairs = ォサ 葬 灯
    User-defined bracket pairs which can be autocompleted and highlighted
    by XBrackets. Note that bracket pairs which have identical opening and 
    closing symbols (such as "" or '') can be highlighted incorrectly because 
    there is no ability to definitely understand whether the caret is by the 
    opening or by the closing symbol of such bracket pair.
    To define your own bracket pairs, follow these rules:
    1) Bracket pairs must be separated by space (' ')
    2) Each bracket pair must consist of 2 characters: the first character
       defines left (opening) bracket symbol and the second character defines
       right (closing) bracket symbol. If you define just 1 character or
       3 or more characters as a bracket pair, this bracket pair will be
       ignored.
    3) You can define up to 30 bracket pairs.
    4) Don't forget to add new closing/opening bracket character to the
       'next_char_ok'/'prev_char_ok' set if needed.

  autobrackets.next_char_ok = .,!?:;<)]}"'>/ サ樗
    Set of characters which are OK for brackets autocompletion when
    you type an opening bracket BEFORE such character.
    Additionally, any bracket can be autocompleted before the following
    hard-coded characters: '\r', '\n', '\0', ' ' and '\t'.
    You can define up to 90 characters in this set. Spaces are ignored.

  autobrackets.prev_char_ok = ([{<= ォ蒼
    Set of characters which are OK for brackets autocompletion when
    you type a bracket AFTER such character. This rule is applied only
    to those bracket pairs which have identical opening and closing
    symbols (such as "" or '').
    Additionally, such bracket can be autocompleted after the following
    hard-coded characters: '\r', '\n', '\0', ' ' and '\t'.
    You can define up to 90 characters in this set. Spaces are ignored.

  autocomplete.all_autobr = 0
    Default behaviour: characters from the 'next_char_ok' set 
    (and from the 'prev_char_ok' set depending on the bracket type) 
    are checked to permit the brackets autocompletion.
  autocomplete.all_autobr = 1
    Brackets can be autocompleted BEFORE any character (i.e. the 
    'next_char_ok' set is ignored). This rule additionally depends 
    on the option "Even if corresponding right bracket exists".
  autocomplete.all_autobr = 2
    Brackets can be autocompleted AFTER any character (i.e. the
    'prev_char_ok' set is ignored). This rule is applied only to
    those bracket pairs which have identical opening and closing
    symbols (such as "" or '').
  autocomplete.all_autobr = 3
    Brackets can be autocompleted BEFORE and AFTER any character
    (i.e. both 'next_char_ok' and 'prev_char_ok' sets are ignored).

  autocomplete.ovr_autobr = 0
    In Overwrite mode, right (closing) bracket is not added automatically.
  autocomplete.ovr_autobr = 1
    In Overwrite mode, right (closing) bracket is added as a new character
    (not over the existing character).
  autocomplete.ovr_autobr = 2
    In Overwrite mode, right (closing) bracket appears instead of the
    existing character (i.e. over that character).

  autocomplete.sel_autobr = 0
    When left (opening) bracket is typed, the selected text is disappeared 
    (replaced with the bracket).
  autocomplete.sel_autobr = 1
    When left (opening) bracket is typed, the selected text is enclosed with
    the corresponding brackets pair.

  highlight.hlt_bothbr = 1
    When the caret is between two pair brackets, both pairs are highlighted.
  highlight.hlt_bothbr = 0
    When the caret is between two pair brackets, just one pair is highlighted
    (highest priority is to the right of a closing bracket).

  highlight.hlt_style = 3
    XBrackets redraws brackets highlighted by Coder.
    Pair brackets are highlighted using bold font.
  highlight.hlt_style = 2
    XBrackets redraws brackets highlighted by Coder.
    Pair brackets are highlighted using default font.
  highlight.hlt_style = 1
    Pair brackets are highlighted using bold font.
    XBrackets does not redraw brackets highlighted by Coder.
  highlight.hlt_style = 0
    Pair brackets are highlighted using default font.
    XBrackets does not redraw brackets highlighted by Coder.

  highlight.quote_detect_lines = 1
    Number of text lines to be processed by XBrackets while searching for
    a pair quote in both directions (when the search direction can not be
    determined, for example:  "  " ).
    If this value exceeds 'highlight.quote_max_lines', then it is decreased
    to the value of 'highlight.quote_max_lines'.
    The value of 1 means "within current line".
    The value of 0 forbids to search for a pair quote under such conditions.

  highlight.quote_max_lines = 10
    Number of text lines to be processed by XBrackets while searching for 
    a pair quote in one certain direction (when the search direction can be
    determined, for example:  "a b" ).
    The value of 1 means "within current line".
    The value of 0 forbids to search for a pair quote at all.

The plugin allows you to change the additional options without closing AkelPad.
In three steps, in this order:
  1a. Open the "Plugins" window (Settings-> Plugins...) and disable the 
function XBrackets::Main (if it is active).
  1b. (alternative) Run XBrackets::Settings and double-click (with the left 
mouse button) the caption "Status: the plugin is active". As a result, the 
caption will be changed to "Status: the plugin is NOT active".
When you deactivate the plugin it automatically saves its settings.
  2. Open the file "XBrackets.ini" (if the settings are stored in an .ini file)
or a registry key "HKEY_CURRENT_USER\Software\Akelsoft\AkelPad\Plugs" and 
change the required options of the XBrackets plugin.
Don't forget to save the modified file "XBrackets.ini".
  3. Activate the XBrackets plugin by calling its function XBrackets::Main 
or by running its function XBrackets::Settings and double-clicking (with the
left mouse button) the caption "Status: the plugin is NOT active".
When you activate the plugin it automatically re-reads its settings.

--------
History:
--------
v.4.6 (May 2011)
 - fixed: memory allocation bug appeared in v.4.4 (in AutoBracketsFunc,
   when calling sys_memalloc)

v.4.5 (May 2011)
 + pair quote searching algorithm improved
 - fixed: wrong symbol might be highlighted in multi-character comment

v.4.4 (May 2011)
 * for AkelPad 4.6.0+
 + now XBrackets works closely with Coder (if Coder is available)
 + added: parameters 'hlt_style', 'quote_detect_lines' and 'quote_max_lines'
 * changed: now all the parameter names have prefixes (see above)
 + small improvements/fixes

v.4.3 (March 2011)
 + experimental algorithm for pair quote searching
 + small improvements/fixes
 + AkelPad x64 support

v.4.2 (November 2010)
 + several small improvements

v.4.1 (November 2010)
 * the icon updated (thanks to se7h)

v.4.0 (October 2010)
 * 4th anniversary of XBrackets :)
 * for AkelPad 4.5.0+
 * removed: 'hlt_bkgnd' parameter (no more needed)
 + added: both brackets colour and the background can be set
 + other small improvements/fixes
 + icon added (thanks to se7h)

v.3.8 (July 2010)
 - fixed: now brackets are not auto-completed inside read-only file(s)
 - fixed: incorrect brackets repainting in PMDI mode

v.3.7 (June 2010)
 * for AkelPad 4.4.4+

v.3.6 (May 2010)
 + SettingsDlg: RUS and UKR languages added

v.3.5 (February 2010)
 + with 'hlt_bkgnd' enabled, highlight color is mixed with selection color

v.3.4 (February 2010)
 + added: parameter 'hlt_bkgnd'
 - fixed: highlight might not work after XBrackets::Main has been restarted

v.3.3 (February 2010)
 * for AkelPad 3.7.4+/4.4.0+

v.3.2 (November 2009)
 + changed: now 'sel_autobr = 1' replaces the whole selected text

v.3.1 (November 2009)
 + added: parameter 'all_autobr'

v.3.0 (October 2009)
 * 3rd anniversary of XBrackets :)
 + improved: you can "overtype" the closing bracket added automatically
 + added: parameters 'ovr_autobr', 'sel_autobr', 'hlt_bothbr'
 + added: parameter 'user_brpairs' (user-defined bracket pairs!)
 + added: parameters 'next_char_ok' and 'prev_char_ok'
 + plugin's documentation updated

v.2.8 (August 2009)
 * for AkelPad 3.7.3+/4.3.0+

v.2.7 (March 2009)
 * for AkelPad 3.7.0+/4.2.0+

v.2.6 (March 2009)
 + new function: SelToMatchingBracket
 - fixed: splitted windows support in AkelPad 4.1.6

v.2.5 (February 2009)
 + now you can specify file types to skip brackets after //
 + better AkelEdit support
 + other small improvements/fixes 

v.2.4 (December 2008)
 + now you can "overtype" the closing bracket added automatically
 + new option: Skip escaped bracket characters (after '\')

v.2.3 (August 2008)
 + several issues fixed

v.2.2 (August 2008)
 * for AkelPad 3.6.0+/4.0.1+
 + now GoToMatchingBracket does not require brackets to be highlighted
 + several issues fixed

v.2.1 (August 2008)
 + new function: GoToMatchingBracket
 + small optimizations

v.2.0 (July 2008)
 * for AkelPad 3.6.0+

v.1.9 (April 2008)
 * the plugin's name has been changed to XBrackets
 + several small improvements

v.1.8 (March 2008)
 - Fixed: crash when AkelPad 3.5.0 exits

v.1.7 (January 2008)
 + (optional) autocomplete ' '
 + (optional) autocomplete and highlight < />

v.1.6 (November 2007)
 + Compatibility with AkelPad 3.4.2+

v.1.5 (September 2007)
 * for AkelPad 3.4.0+
 - Fixed: commented brackets (C/C++/Pascal) were processed incorrectly

v.1.4 (August 2007)
 * for AkelPad 3.3.0+
 - Fixed: highlighted brackets could mark the LineBoard panel
 - Fixed: some internal variables were initialized incorrectly

v.1.3 (July 2007)
 * for AkelPad 3.3.0+
 + brackets are not highlighted after // inside C/C++/Pascal files 
 + calling Settings dialog does not activate the plugin (AkelBrackets::Main)
 + the plugin can be activated/deactivated from Settings dialog

v.1.2 (March 2007)
 * for AkelPad 3.3.0+
 - edit-control's formatting rectangle was determined incorrectly
 + (option) autocomplete brackets even if corresponding right bracket exists
 + size of dll-file is reduced (using Build.cmd)

v.1.1 (Feb 2007)
 * for AkelPad 3.2.1+
 + highlight active brackets
 + settings dialog

v.1.0 (Oct 2006)
 * initial version 
 * for AkelPad 3.1.2+
 + autocomplete brackets


The author expresses his thanks to Aleksander Shengalts 
aka Instructor for his help in creation and testing 
of this plugin.
-----------------------------------------------------------
The icon by se7h.
-----------------------------------------------------------
(C) Oct 2006 - May 2011, Vitaliy Dovgan aka DV
          dvv81 <at> ukr <dot> net