 Tk NotePad by Joseph Acosta
 modified by Matthieu PHILIPPE 01/01/2003
 Some bug corrected
 - cut/paste with ctrl-x/ctrl-v
 - select then unselect then type any key doesn't crash scipad any more !

 modified by Matthieu PHILIPPE 03/01/2002
 added
 - Number line
 - Goto Line
 - Higlighting Braces
 - Some Keys and Words Binding
 - Colorization for Scilab syntaxes
 - Recolorization of a cuted and pasted text
 - Multiple opened files.

 ES 28/7/2003: 
 changed text font from helvetica bold to courier medium
 added accelerators Ctrl-w, Ctrl-n, Ctrl-q, Ctrl-p, Ctrl-P, Ctrl-S, Ctrl-g; 
  Alt-L
 fixed "unset pad" in closewin rather than exitapp - fixes a bug apparent when
   exiting scipad by closing the last active buffer and trying to relaunch it
 colorization: added "punct", "operator"; changed colors of the colorization
 corrected "parencesis" in blinkbrace - fixes highlighting of ()
 "Scilab specials" in colorize -- added code to distinguish {} [], () from ;: 
 [external but connected: new list of keywords "words"]

ES 4/9/2003
 * added colorization pattern for "number"; separated pattern "xmltag" from 
   "rem2";
 * xmltags colorized only if filename contains ".xml"
 *corrected bug - scipad(newfilename) began in an unnamed buffer
   [connected in scipad.sci: scipad(filename) does not open an additional 
   "Untitled.sce"]

ES 11/9/2003
 closing/reopening scipad remembers previous font size
 cursor doesn't disappear any more (it used to every second keypress or so or 
  mouse move)
 cursor is red
 cursor is positioned at 1.1 when opening an existing file 

ES 18/9/2003
 *changed $Size to Size in the option menu entries - the correct radiobutton  
   is tagged at startup
 *commented destroy $textarea in proc closefile - seems to solve the shrink
   bug (if the initial Untitled.sce is closed, then the next setfontscipadN,
   openfile,newfile command causes the window to shrink to its minimal size).
    Not sure it is the right thing to do. The bug is cured and the only 
   apparent side effect is that the window does not resize upon font change
   (was never exact anyway) 
 *fixed tagging of radiobuttons in the windows menu when files are closed 
 *added comment selection command (glitch - adds // after the last newline 
  also when the selection ends there)
 *added uncomment selection command (glitch - removes also the white space 
  between beginning of line and //)

ES 25/9/2003
 *the code is now free of TKSetCursor's (even in FindIt)
 *restored default mouseclicks actions (double-1=select word, triple-1=select 
   line, 2=paste sel) 
 *deglitched "\n//" in comment selection and restore selection in uncomment 
   (not yet 100.0% ok)
 *selection remains on after copytext
 *accelerator Ctrl-Z for Undo (more standard)
 *accelerator F1 for About
 *Help opens the scipad page in the helpbrowser
 *version -> 1.2
 *button3 popsup the edit menu (not so useful but why not - perhaps in future 
   I'll replace it with a tailored menu)
 *"(modified)" appears on the titlebar, and the corresponding entry in the 
   windows menu is colored (and of course things are reverted to normal when
    the buffer is saved)
 *translated to french (!!?) some "file already open"
 *created the Execute menu; added the command execute selection and its 
   accelerator Ctrl-y (inherits problems from ScilabEval/execstr() - most 
   dangerous problem, goes amok when the selection contains a function without
   endfunction) -- glitch: splits quoted strings containing // as if // starts
   a comment
 *bug solved: Esc or Ctrl-c on a find/replace dialog used to hang scipad
 *copy/paste (Ctrl-{c,v}) possible on find/replace strings [but not cut nor 
   replace-paste --why?]

ES 2/10/2003
 * $pad.statusind goes Salmon when the buffer is modified
 * splitted long lines in the code for improved readability
 * the popup menu doesn't pop on the bottom bar
 * bug fixed: upon closing a buffer, the radiobutton of the one previously
    opened (which becomes the current buffer) was not correctly checked
 * shift-button3 and ctrl-button3 popup execute and options
 * bug fixed: search and replace strings can begin with "-"
 * copytext doesn't tag the buffer as modified
 * glitch corrected: //..."string"... is all colorized as comment, "...//..."
    as string
 * glitch corrected: gotoline didn't scroll to make the target line visible
 * begun proc whichfun

ES 9/10/2003
 * corrected bad continued line "Annuler"
 * progress in whichfun, execselection, etc. 

ES 19/10/2003
 * F5 Save and Run
 * cosmetic - compacted the command passed and displayed by execselection
 * pad remembers its geometry when quitting/reopening 
 * moved option stuff (colors, fontsize, geometry) at the top -- later I might
   add that it is read from an options file
 * the background color of found text is $SELCOLOR, as selection
 * bug fixed: missing $textarea when printing with Ctrl-p

ES 21/10/2003
 * added font micro (ok on my laptop)
 * rationalized setfontscipad procedures, font size changes also menu fonts
 * accelerator F2=Save
 * added catch to delinfo in proc showinfo - prevents a "missing variable
   .pad" which appears ocasionally on reopening

27/10/2003
 * proc helpword
 * message "file NNNN saved"

around november: made colorization TIMES faster, by scanning only to
 wordend (not end-of-text) for scilab keywords in proc colorize.

28/12/2003
 * added IndentSel, UnIndentSel (plain \s\s, no smart logical indent)
 * little deglitch in CommentSel, UncommentSel
 * rationalization of Alt-x-x keyboard menu activations
 * fixed Ctrl-w cut selection AND close window
 * text pasted with Button-2 is colorized

4/1/2004
 * bug fixed - to interfering bindings from Ctrl-v caused no or double paste.
 * removed some "particular" bindings for Ctrl-c/v/x and transformed them
   to All or Text: copy paste works better in find and filename dialogs
 * fixed Ctrl-y bind, does not paste selection surretptitiously
 * cursor position info (keyposn) updated when switching buffers

15/2/2004
 * file dialogs for "all files" show also * files 

30/2/2004
 * fixed remalltags for textquoted and rem2 (i.e., lines with "aaa//bbb",
    "123456", //123 etc. should be colorized consistently 
 * comment/uncomment, indent/unindent applies to the current line 
    if unselected

Francois VOGEL, 16/04/2004
 * fixed silent clearing of selection in one buffer that occurred when another
   buffer was modified
 * added Ctrl-F6 binding and proc switchbuffer to switch opened buffers
 * fixed bug that occurred when a copy-paste modification on a buffer was
   undone once too much (a "lifo($id) pop error, empty" resulted)

19/4/2004
 * added "Import matlab file..."
 * version --> 1.3
 * switchbuffer --> prevbuffer (F6) and nextbuffer (F7); bug corrected, wrong 
   buffer when one or more previously open buffers were closed
 * added bindings Ctrl-+/- to increase/decrease fontsize

Francois VOGEL, 21/04/2004
 * fixed size/position bug of sliders when switching buffers or opening a new file
 * corrected minor typos in french texts, added french text where was missing
 * restored cursor blinking as I could not make it disappear any more while
   moving it with the arrows - was probably a tcl bug, seems to work with 8.4.6
 * many improvements in find/replace/replaceall:
     - added forward and backward automatic wrap-around
     - added message box in case of no match found
     - added message box in case of find or replace with an empty string
     - if text is selected, find or replace occurs inside that selection (for find,
       if not found, then asks for extending the search to the entire buffer)
     - starting from a saved file, doing stuff and then undoing all changes does
       not report the file as modified any more
 * added Ctrl-F6 (prevbuffer) and Ctrl-F7 (nextbuffer) bindings

Francois VOGEL, 13/05/04
 * breakpoint and debug tools added - type help scipad in Scilab for detailed
   explanations
   Note: matsys.f as provided under bug 718 correction should be used
 * proc whichfun now can search in a buffer different from the current one (used
   for breakpoint stuff)
 * Find/Replace now can use a regexp mode
 * cosmetic: replaced tab indents by 4 spaces in the code (e.g. in proc findtext)
   Please use spaces instead of tabs for further updates of the code!
 * cosmetic: harmonised accelerator names through menus (e.g. ctrl-x changed to
   ctrl+x)
 * rearranged bindings in find/replace dialogs - were not always consistent with
   the underlines, especially for the french dialog
 * cursor blinks only if tk version is >= 8.4
 * message at the bottom of the Scipad window is cleared when colorization ends
 * bugzilla bug 723 corrected - an error poped when trying to write text in
   Scipad when a selection was active in another tcl/tk application such as the
   Scilab help
 * version --> 2.0

Francois VOGEL, 18/05/04
 * closing the find dialog using the cross at the upper right corner does not
   produce an error any more (patch provided by ES)
 * added display of the line number in function in the status bar (provided by ES)
   note: this required moving proc whichfun before proc keyposn
 * removed \n in ScilabEval as this hangs unix versions and does not cure the
   loosing of first characters. Added 5 leading spaces trying to limit the issue.
 * added quotes around strings tested in if conditions (used to hang unix versions)
 * debug commands now check if scilab is busy before sending commands to scilab
   shell
 * version --> 2.1

Francois VOGEL, 21/05/04
 * fixed expose binding issue (100% CPU and edge blinking when find dialog was open)
 * solved bug that occurred when trying to input an argument of a function when the
   listbox was empty
 * improved proc whichfun to treat some pathological cases:
   - comments ended by ...
   - continued lines without ... (therefore, check for unmatched brackets and braces
     on any single line)
   - also corrected slight bugs in that proc, but it is still not perfect
 * added a second status indicator to display line number in function at the bottom
   of the pad instead of displaying that information in the message area
 * version --> 2.2

ES 27/5/2004
* split scipad.tcl in several sourcefiles, buried in the directory scipadsources. The
  distribution now includes: $SCI/scipad.tcl, $SCI/words, $SCI/scipadsources/*
* buffer dependent colorization: scilab/xml/none: added field listoffile($,language)
  in the relevant places, override colorization entries in menu Options, extension-based
  automatic selection when opening files; no line-in-function displayed in non-scilab
  mode (TO DO: disabling menues in non-scilab mode)
* minor editing in words: removed scilab, added macr2tree, tree2code, getcwd
* version --> 2.3

Francois VOGEL, 27/05/04
 * Debug menu is disabled in non-scilab mode
 * F9 doesn't pink lines any more if in non-scilab mode (partially done)
 * Options/Font size and Options/Language scheme are now submenus in cascade
 * version --> 2.4

ES, 30/5/2004
* version -> 2.4.1 
* reverted the Options menu as in 2.3
* underlines for language schemes
* Execute/Load is disabled for non-scilab files
* proc schememenus sets/deletes bindings
* proc whichfun always returns "" for non-scilab
* less color for the "none" and "xml" schemes (no punctuation, no operators)
* added % to scichset if proc colorize - corrects colorization of %variables

ES, 2/6/04
* version 2.4.2
* proc execselection disp's an echo only for unix - because in windows the
  command is sent to the history, and there is no need. I do not know about
  mac.
* editing in words: removed demos, graph-list, ScilabEval, Example, 
  AdCommunication; added xmltohtml, all the variables output by who at startup
* replaced tabs with spaces in filecommands.tcl; added a few [] and ""
  which allow openfile to open numeric filenames (except for 0, which
  triggers still some other bug)
* removed seminal listoffile(,language) tests in debugger.tcl, no longer
  needed
* bug corrected in  whichfun.tcl/proc checkcontbraceorbracket: check for
  $ind2=={}, whose omission gave an error when typing [ or { within function
  bodies

Francois VOGEL, 07/06/04
 * added support of special filenames such as those that evaluate to zero, or
   those that evaluate to an index keyword of the menu widget. Any file name is
   now legal
 * reworked the debugger to add the watch window. This should still be improved:
   - <TODO>: pass to Scilab the watch variables changed by the user in the watch
     window (this relies on the correction of a bug in the resume function, see
     bug 818)
   - <TODO>: improve retrieval of the Scilab variables from Scipad:
     . since the length of the command line is limited to ca 500 characters on
       the 3.0 CVS version (June'04)
     . since part of the information is lost by the current implementation if
       string(var) returns a string matrix and not a single string
 * reindented full cutcopypaste.tcl, and part of inputtext.tcl, getting rid of tabs
 * improved test of the selection owner in deletetext, backspacetext and puttext
   (see bug 723)
 * removed a superfluous test and many globals in all the procs of cutcopypaste.tcl
   note: the code in cutcopypaste.tcl requires improvement as it is inefficient
 * version --> 2.5


ES, 13/6/04
*restructured the hyerarchy of the source files, for future maintainability.
 Now scipad.tcl loads first sources which define procs only, then files
 which contain main level code only. This should help a lot in avoiding
 interdependencies and feedback within the whole code.
 In particular: mainlevel code in textarea.tcl moved in mainwindow.tcl
        and menues.tcl;
      procs in mainwindow.tcl moved into textarea.tcl;
      proc schememenus in menues.tcl moved to colorize.tcl;
      proc extractindexfromlabel in menues.tcl moved to filecommands.tcl;
      mainlevel code from infomessages.tcl to mainwindow.tcl;
      mainlevel code from undoredo.tcl to mainwindow.tcl;
      (TO DO: relocate also the mainlevel code of debugger.tcl)
*filecommands.tcl restructured: detabbed, common code in subprocs; some calls
 to extractindexoflabel replaced by simpler lookiffileisopen; proc byebye
 extracted from proc closefile
*infomessages.tcl: replaced entry objects with labels (same behavior in tcl 
 8.3 and 8.4); column numbers shown by keyposn start at 1
*hopefully, scipad now remembers correctly the window geometry upon
 closing/reopening (in RH9/gnome, there is still a quirk - the height decreases
 by 2 gridlines at every reopening, but it is probably a WM quirk in 
 repositioning the window) 
*detabbed colorize.tcl
*proc setfontscipad (mainwindow.tcl) reports on the statusmessage and 
 resizes also menu entries and status labels (TO DO: also subwindows
 like file dialogs, Find,... inherit the current font size)
*systematically replaced [gettextareacur] with $textareacur in cutcopypaste.tcl
 (rationalization)
*proc helpword improved - trims white space, does not open help if the 
 selection includes only spaces
*hopefully, colorization of scilab buffers with extended chars does not hang
 anymore (the bug was platform-dependent)  
*version --> 2.6

Francois VOGEL, 14/06/04
 * the buffer is no more reported as modified if one paste from an empty clipboard
 * relocated the mainlevel code of debugger.tcl in defaults.tcl
 * fixed shrinking of the watch window in some cases
 * .tst and .dem files get now colorized as .sci/.sce files
 * debugger watch window: improved retrieval of the Scilab variables from Scipad:
   - string(var) is no more used in creategetfromshellcomm but replaced by
     FormatStringsForDebugWatch(var). This is a new Scilab command that is now part
     of the Scipad package in SCI/tcl/scipadsources. This function is getf'd on
     invoking the watch window
   - the commands are no more passed directly to ScilabEval, but rather through
     a .sce file built by Scipad and saved in SCI/tcl/scipadsources. This overcomes
     any limitation in characters number of the Scilab command line
 * saving a buffer for the first time, the proposed name is now the first function
   name found in the buffer
 * version --> 2.7

ES, 17/06/04
 * bugs corrected in filecommands.tcl/proposedname: for buffers containing
   more than one function the proposed name is the first found, for buffers
   containing no functions it remains the original one
 * bug corrected in filecommands.tcl/openfile - the field listoffile($,new)
   was not set
 * enforced the use of fullpath in proc filecommands.tcl/lookiffileisopen
 * common code for file types in procs filesaveas and showopenwin moved to
   new proc knowntypes
 * end-of-line homogeneously translated to unix (was mixed in several files)
 * incorporated FV's correction to colorize.tcl mentioned in bug #749
 * version --> 2.7.1

Francois VOGEL, 17/06/04
 * added quotes in the getf FormatStringsForDebugWatch so that it sleeps with paths
   containing spaces
 * active breakpoint is now displayed in raised relief instead of underlined (nicer)
 * improvements in FormatStringsForDebugWatch:
   - upgraded to full support for:
     . polynomial matrices       (type= 2)
     . integer matrices          (type= 8)
     . character string matrices (type=10)
   - added full support of:
     . sparse matrices         (type= 5)
     . boolean sparse matrices (type= 6)
     . lists                   (type=15)
     . tlists                  (type=16)
     . mlists                  (type=17)
 * the .sce file built by Scipad and containing the watch variable retrieving commands
   is now saved in TMPDIR instead of in SCI/tcl/scipadsources - should better cope with
   file permissions that way. TMPDIR is set for Scipad in scipad.sci
 * splitted debugger.tcl in several sub-files to ease maintainability
 * version --> 3.0 (submitted to the Scilab team under bug #559). This is the version
   included in Scilab 3.0, but the debugger menu is hidden in the distribution (shortcuts
   do work however)

Francois VOGEL, 07/07/04
 * simplified the use of the debugger: Scipad now maintains a state variable containing
   "NoDebug" (no debugger correct configuration performed nor debug session started),
   "ReadyForDebug" (debugger configuration performed OK but no debug session started), or
   "DebugInProgress" (debug session started, Scilab prompt is -1->)
   A schematic of the state machine is available in db_state.tcl
   This allows for the following improvements:
   - commands add/remove breakpoint and add/remove breakpoint during debug merged in the
     debug menu - Scipad now knows if the setbpt/delbpt should be sent or not
   - commands remove all breakpoints and remove all breakpoints in Scilab merged in the
     debug menu - selecting this now deletes all breakpoints both in Scipad and in Scilab
   - debug menu entries are disabled/enabled depending on the debugger state, so that the
     user should get less confused about the possible actions at any given time of the
     debug session (this copes also with colorization schemes)
   - if no debug session was initialized, the button-3 popup menu is the edit menu
     otherwise it is the debug menu - this is the 1st contextual menu in Scipad
   - the debugger state is made known to the user from the background color of the message
     area at the bottom of the Scipad window - for improved readability, messages are now
     displayed in black instead of blue
 * getf "FormatStringsForDebugWatch.sci" moved to db_states.tcl. If the user did not open
   the watch window before launching a debug session, this .sci file was not getf'ed in
   the right workspace and was therefore unknown later on during the debug session
   Note: putting a ScilabEval at the mainlevel (e.g. defaults.tcl) does not work!
 * exec getwatchcomm.sce is no more performed if unnecessary, i.e. if there is no watch
   variable defined by the user
 * added a binding to help fixing watch window repositioning that occurred sometimes
 * the watch variables changed by the user in the watch window are now correctly passed
   to Scilab (bug 818 in the resume function has been corrected in the CVS)
 * the debugger now handles correctly functions containing varargin as an input argument
 * incorporated some corrections from ES:
   - proc importmatlab corrected with quotes as mentioned in bug #856 (was also included
     in the CVS by the Scilab Team)
   - removed the # at line 3 of scipad.tcl, so that Scipad can again be launched directly
     in Unix shells
   - on Unix the cursor is always on again, regardless of the TCL/TK version
 * 'Remove all breakpoints' now removes the breakpoints in all the opened buffers
 * On start of a debug session, the currently displayed file is exec'ed. Now the buffer
   containing the function selected during the configuration phase is also exec'ed
 * Breakpoints sent to Scilab on start of a debug session are now collected through all
   the opened buffers, and removed accordingly in Scilab at the end of the debug session
 * When adding a new watch variable, its value is now immediately retrieved from Scilab,
   it is no more necessary to resume execution
 * incorporated Scilab Team's changes in the CVS Scipad:
   - changed 'Scilab Group' into 'Scilab Consortium' in the About window (proc aboutme)
   - added echo of the ScilabEval command in proc execfile from ScilabExec.tcl whatever
     the platform (and changed the disp into a mprintf - saves space in the shell!)
 * added int16, int32, uint8, uint16, uint32 in file "words"
 * proc load_words now closes the file "words" after having read it
 * active breakpoint tagging dramatically improved:
   - corrected active breakpoint tag when breakpoint is in conditional structure (for,
     while, or anything else)
   - works now with sub-functions or other nested structures containing breakpoints
   - displays the correct buffer (if already opened), i.e. the buffer where the active
     breakpoint lies
 * When the watch window was open at the same time the user configured execution in the
   configure box, the next time the Add button was hit in the watch window an error poped
   out. This is now fixed
 * version --> 3.1

Francois VOGEL, 18/07/04
 * The debugger state is now reset to "NoDebug" on closing of buffers if there is no
   pre-existing configured execution (i.e. if the configure box is empty after the buffer
   is closed)
 * Changed shortcuts bindings of the debugger commands so that they apply to all the
   windows in Scipad rather than to the toplevel window only - Fixes possible problems of
   shortcut activation on some systems with specific focus management
 * Minor editing in words (keywords added, such as 'continue')
 * Scipad now starts from the path of the latest opened file when opening further files
 * Command "Display call stack" removed from the Debug menu. Instead, the call stack is
   automatically displayed in the watch window at each stop of the debugger.
   Note that this functionality requires that a Scilab bug in the where() function be fixed.
   where.f as provided under bug 908 (or even better, bug 922) correction should be used.
   This corrected where.f is part of the CVS since 3 August 04
 * Reworked display of the watch window: now this window is updated (and opened) on the
   screen only if it was already open (avoids undesired pop up)
 * version --> 3.2

Francois VOGEL, 20/07/04
 * Removed file db_tagsmanagement.tcl from the distribution (was obsolete and never sourced)
 * Bug fixed: F9 during debug could unset the active breakpoint, but could not reset it
 * Improved visibility of the active breakpoint: added bold style and increased borderwidth
 * Relocated the mainlevel code of the debugger in a new db_init.tcl file
 * version --> 3.3

Francois VOGEL, 17/10/04
 * If the number of leading spaces of a line was odd, then trying to unindent the selection
   until there is no space remaining did never remove the last space. This is now fixed
   (just changed "^  " into "^ {1,2}" in the regsub of proc UnIndenSel)
 * Keypress did not replace the selection after buffers were switched. This was due to the
   clearing of the X selection that was introduced to fix another bug (see above 16/04/2004).
   It is now fixed in proc nextbuffer and proc prevbuffer, but it required a trick since
   there is no "selection set" command in tcl. Solution used: the sel tag is well maintained
   inside different buffers. Therefore the selection is obtained using this tag and set
   again to that same range using that tag, which has the desired side effect of also
   setting the X selection.
 * Added option -anchor w in label statusind2 so that the line number in function can always
   be read, even if the function name is too long to fit in the (fixed) alloted space.
 * Added textquoted tag for Scilab text between simple quotes ('). Just duplicated portion
   of code dealing with double quotes (") in proc colorize. There is a side effect on some
   operations using more than one matrix transpose in a single line, such as A=B'+C', but
   this is believed to be less important than having the text strings properly colorized
   regardless of the quote type that sets its limits, since simple quotes are widely used
   in the current Scilab source code especially the oldest parts. Moreover, code lines such
   as mprintf("%s",'this is a function') brakes the line number counting in functions if
   not properly colorized as textquoted.
 * Fixed a bug in proc checkcontbraceorbracket: lines such as mprintf('['); were detected
   as continued lines, and that resulted in wrong line number in function displayed in
   statusind2. Now checkcontbraceorbracket checks whether the brace or bracket found is
   tagged as textquoted or not, which solves the issue.
 * Added a catch {} in bindings.tcl  and proc newfilebind to avoid error popup message in
   case listoffile("$textarea",language) has already been unset in proc byebye which is called
   on ctrl-w to close the current buffer. Proc keyposn uses this variable, and if byebye
   finished before or faster than the <KeyRelease> or <ButtonRelease> binding, an error
   occurred.
 * A bit of rework in proc ReplaceAll to account for the possibility that the user, without
   checking the Match case box, tries to replace a string S1 with a string S2 that is only
   different from S1 by the character case. This used to hang Scipad.
 * Moved scipad.tcl and words in scipadsources (and changed scipad.sci to reflect it).
 * Added the new "sync" and/or "seq" arguments to ScilabEvals whenever required
   To do (when situation is totally clear, and as soon as ScilabEval "seq" bug is fixed on
   Windows...):
    - remove the extra spaces at the beginning of the seq/sync scilabevals
    - remove the checkscilabbusy tests between ScilabEvals
    - suppress the temporary file getwatchcomm.sce and replace by successive ScilabEvals
      with adequate options - this is started but not yet mature
    - find out how to close bug #885 (send multiple ScilabEvals? what about continued lines?)
 * version --> 3.4

Francois VOGEL, 20/10/04
 * Work on proc updateactivebreakpoint and proc checkendofdebug_bp to take into account the
   additional level in the where() output due to the "seq" option of ScilabEval.
   There was a quirk for subroutines of the exec'ed function: for the main function, where()
   returns the line number just before the breakpoint, but for subfunctions it returns the
   exact line number of the breakpoint. Probably a Scilab bug, but Scipad implements a
   workaround. This is bug 1054.
   Note: FormatWhereForDebugWatch.sci could be slightly improved.
 * Implemented a workaround for bug 633 (workspace erased after abort of a callback). This
   was required to fix the command "Cancel debug".
 * Suppressed the temporary file getwatchcomm.sce and replaced by successive ScilabEvals.
 * Proc updateactivebreakpointtag bullet-proofed against values of $activeline. Scipad hangs
   no more if $activeline is 0 or less, or greater than the length of $activemacro.
 * Now a debug session seems to work fully (tested on Windows only however). The main issue
   was that ScilabEval "sync" was called during a paused ScilabEval "seq". Currently, the
   user still has to hit the return key in the main Scilab window in order to launch execution
   of the ScilabEvals, but this is outside of Scipad.
 * version --> 3.5

Francois VOGEL, 21/10/04
 * Increased character size of the active breakpoint so that it is more visible.
 * Active breakpoint character size is now changed accordingly when other font sizes are
   changed.
 * Removed the extra spaces at the beginning of the seq/sync scilabevals since they are
   no more required.
 * Removed the checkscilabbusy tests between ScilabEvals in the debugger. Proc checkscilabbusy
   is no more bypassed where it is useful.
 * On trying to exec or to start debugging a file that contains an error reported by the
   shell, this error is now trapped by Scipad, a message box is displayed explaining the
   error, and the offending line is blinked in Scipad.
 * version --> 3.6

Francois VOGEL, 27/10/04
 * Removed the workaround (i.e. the offset management) in proc updateactivebreakpoint
   since I corrected bug 1054.
 * FormatWhereForDebugWatch slightly improved to suppress display of the highest calling
   level, i.e. the ScilabEval call to the breakpointed function to debug.
 * Fixed bug: When the function to debug returned before the first breakpoint, the debugger
   state did not go back to "NoDebug". 
 * Line 1 of a function can now be tagged by proc updateactivebreakpointtag.
 * version --> 3.7

Francois VOGEL, 29/10/04
 * Fixed bug in proc updateactivebreakpointtag. This proc could spit 'TK_EvalStr, bad text
   index "" at line 1' when launched from the Scilab command line by TK_EvalStr("scipad eval
   {updateactivebreakpointtag 1 foo}"). This occurred when the commented word "function" was
   present in the buffer and function foo was not defined in that buffer.
 * version --> 3.8

Francois VOGEL, 01/11/04
 * Fixed further bug in proc updateactivebreakpointtag. The first line of the function
   defined just after the function searched for could be tagged.
 * The insertion cursor is now positioned at the beginning of the active breakpoint on an
   update of its position. This is an option of proc updateactivebreakpointtag.
 * Simplified the debugger. Start debug (CTRL-F11) and Go to next breakpoint (F11) merged
   into one single command.
 * Improved proc scilaberror following ES' suggestions
 * version --> 3.9

ES 3/11/04:
 * the writable status of files which are opened is checked. [ReadOnly] is tagged 
   on the title bar. If a file is not writable (either because of an invalid path
   or because the file is readonly), a warning pops up, and Save translates to
   "Save as..."
 * version --> 3.10

Francois VOGEL, 04/11/04
 * Added debugger icons in the watch window as an initial attempt for having a toolbar.
 * Added same icon images in the debug menu.
 * Removed the workaround for bug 633 (workspace erased after aborting a callback) since
   this bug has been solved in the CVS.
 * version --> 3.11

Francois VOGEL, 10/11/04
 * Reworked reading of icons from disk. Resized icons independently of their original
   size (for display in a toolbar such as in the watch window). Same icons with further
   reduced size are now displayed in the debug menu. There is now an icon for each debug
   menu entry (thanks to ES for the design!)
 * Changed the order of the menues in the menubar.
 * Changed the order of the items in the help menu.
 * The watch window content is now updated instead of completely redrawn at a breakpoint
   stop.
 * Added ES' changes for addition of the Revert to saved command in the file menu.
 * version --> 3.12

ES 15/11/04:
 * added support for user preference file $env(HOME)/.SciPadPreferences.tcl,
   loaded at startup by defaults.tcl and saved on exit
 * wm geometry in strict pixels (avoids cross-session shrinking due to wm decorations
 * outside of Scipad: removed %scipad_fontsize from SCI/scilab.star and 
   SCI/macros/util/scipad.sci: overridden by the user preferences file
 * version --> 3.13

ES 16/11/04
 * button-2 bound to the new proc button2copypaste - [almost] fixes
   the issue of importing external X selections into scipad
 * version --> 3.14 (and I resist from calling it pi)

Francois VOGEL, 01/01/05
 * Improved proc scilaberror since I fixed bug 1091
 * Added automatic popup bubbles (balloons) displaying a help text when the mouse is
   over an icon of the watch window
 * Added Ctrl+a binding to select all the text in the current buffer (more common
   in Windows than Ctrl+/)
 * Added test in proc scilabexec, to cope with string length limits in C language
   (related to bug 885 correction I made in the Scilab core code). Now the selection
   to execute is displayed in the shell if and only if its length is less than 509
   characters. The full string is however passed for execution in the shell. If its
   length is greater than bsiz (currently 4096 chars), it is truncated in
   TK_ScilabCallback.c to avoid internal buffer overflow. In that case, the
   truncated string is executed and a warning is printed in the shell.
 * Added two new debug commands: "Run to cursor" and "Break". They are not yet
   working correctly due to bugs 1086 and 1120, and they should not be used.
 * version --> 3.15

ES 10/1/2005
* proc execfile returns a value (0=success, 1 scilab busy, 2 cancel, -1 fail)
* added new commands "Create help skeleton" and "Compile as a help page"
* version -> 3.16

ES 13/1/2005
* "Create help skeleton" warns about preexisting xml files. Messages
   there in french too.

Francois VOGEL, 19/01/05
 * Strings containing slashes are now correctly handled in the watch window.
 * The watch variables area and/or the call stack area in the watch window
   can now be hidden/shown.
 * version --> 3.17

Francois VOGEL, 20/01/05
 * Added accelerator name on the watch window buttons tooltips
 * version --> 3.18

ES 24/1/05
 * new tagging classes for scilab keywords: libfun and predef
 * keyword lists for them derived from scilab at launch time
 * file "words" purged of all the keywords in the two lists above
 * new colors for them
 * version --> 3.19

ES 26/1/05
 * Ctrl-B1 clicking, or issuing F8 when the cursor is in a libfun
   opens the source file (via get_function_path()) of that libfun
   (undocumented yet, nor reported in a menu)
 * a nicer color for libfun
 * filename printed in the message "file is alread opened" 
 * version 3.20

Francois VOGEL, 27/01/05
 * Bug corrected - When hitting return somewhere in the active breakpoint
   line, the related activebreakpoint tag was not updated
 * The buffer is now locked during a debug session, no changes allowed
 * version --> 3.21

ES 27/1/05
 * "open function source" added in the File menu, enabled if in case
 * corrected search for keywords in colorize.tcl, whichfun.tcl: scilab
   names ae not just words in the tcl sense, they can contain %#!?$
 * version --> 3.22

Francois VOGEL, 27/01/05
 * Bug corrected - Ctrl-x was still able to cut text in a locked buffer
 * version --> 3.23

ES 3/02/05
 * fixed colorization bug introduced with 3.22 (one char to the left
   too much colorized as keyword while typing)
 * fixed some tag range issues for the name of the function to be
   opened by mouseclick or menu command
 * catched the saving of the preference file, so no error is reported
   if it cannot be written
 * version 3.24

Francois VOGEL, 09/02/05
 * Debugger commands Run to cursor and Break are now temporarily disabled
   since parser issues in Scilab are not solved. Bugs 1086 and 1120 must
   be solved first. These commands can be quickly activated again for debug
   or development by setting dev_debug to "true" in db_init.tcl
 * version --> 3.25

Francois VOGEL, 12/02/05
 * Bug 1203 corrected (darkred replaced by red for QTXTCOLOR to work on HP)
 * Implementation of message files using msgcat.
   Reference: http://wiki.tcl.tk/1488
   Note: Menues underlines are not yet translated, since they are not handled
         by the msgcat package. That's why some if {$lang=="eng"} are still
         in the code.
 * version --> 3.26

Francois VOGEL, 13/02/05
 * Some french menues underlines changed (were duplicates or unconvenient)
 * Menues/buttons underlines are now taken into account without if {$lang==
   Reference: http://wiki.tcl.tk/3665 (magic ampersand)
 * Some bindings changed in the Find and Replace dialogs. Bindings are now
   locale-independent, as well as shortcuts (accelerators in menues).
 * Select all is now binded to Ctrl+a instead of Ctrl+/
 * Open function source is now binded to Ctrl+/ instead of F8 (reserved for
   the debugger step by step commands) 
 * version --> 3.27

ES 15/2/05
 * added a void fallback definition of ScipadEval and sciprompt in scipad.tcl.
   This is useful for running scipad independently of scilab, e.g. in wish,
   in order to debug the tcl code.
 * void fallback chset(scilab.predef) and chset(scilab.libfun) in colorize.tcl
 * moved a few toplevel code lines from scipad.tcl to mainwindow.tcl and
   slighly reedited the latter
 * version --> 3.28

Francois VOGEL, 16/02/05
 * Cosmetic: Aligned strings in the About box
             Translated message for fake ScilabEval
 * version --> 3.29

ES 16/02/05
 * indent/unindent supports a fixed arbitrary number of spaces, set by
   the preference variable indentspaces
 * localization to italian (proof of the concept)
 * typo corrected in fr.msg
 * fake ScilabEval also puts to stdout
 * version --> 3.30

Francois VOGEL, 16/02/05
 * Removed duplicate "Add/Change" in fr.msg and it.msg
 * Added strings in the message files
 * .ScipadPreferences.tcl is now saved in the home of Scilab
 * version --> 3.31

Francois VOGEL, 17/02/05
 * Drag'n'drop one or more files at once from the explorer to Scipad now
   works (opens the file(s)).
   Reference: TkDnD package - http://sourceforge.net/projects/tkdnd
   Possible absence of the package is catched (no warning issued).
 * version --> 3.32

Francois VOGEL, 21/02/05
 * Scipad now displays only pruned filenames (and full pathnames in
   case of ambiguity) in the titlebar and windows menu.
 * A lot of drastic code cleaning in filecommands.tcl, infomessages.tcl,
   buffernavigation.tcl, inputtext.tcl plus a few more around those files,
   rationalizing, suppressing old unused or duplicate procs, reindenting,
   removing superfluous comments but adding explanatory comments.
 * version --> 3.33

Francois VOGEL, 23/02/05
 * Few glitches correction about pruned file names.
 * New buffers are now tagged as modified (required changes in scipad.sci).
 * Trying to paste with button-2 when there is no selection does no more
   tag the buffer as modified.
 * Further drastic code cleaning. The only unclean file is now undoredo.tcl
   but this will be removed one day or another anyway to be replaced by the
   text widget undo/redo features.
 * version --> 3.34

Francois VOGEL, 24/02/05
 * New buffers are no more tagged as modified.
 * Trying to exec an empty buffer is catched.
 * Code rationalization:
     - replaced $pad.textarea by $pad.new$winopened
     - inccount, outccount, getccount become setmodified, unsetmodified,
       and getmodified
 * version --> 3.35

Francois VOGEL, 26/02/05
 * The list of the 4 more recently opened/saved files is now available in
   the file menu for quick access.
 * version --> 3.36

Francois VOGEL, 27/02/05
 * Added a number in front of the recent files names.
 * version --> 3.37

ES, 1/3/2005
 * $winopened starts from 1 (i.e the first new buffer is Untitled1.sce)
 * scipad.sci takes care to close $pad.new1, not $pad.new0, when needed
 * found where to drop a magic update (top of mainwindow.tcl) which makes
   the initial buffer reactive to drag&drop under linux (and possibly 
   solves old obscure geometry problems related to the initial buffer)
 * proc openlistoffiles in filecommands.tcl removes the eventual
   prefix "file://" - needed for d&d in linux
 * version --> 3.38

Francois VOGEL, 01/03/05
 * Directory dropping in Scipad now handled (opens all the files in it)
 * Wrong underline removed for >9 recent files in the file menu (hack)
 * version --> 3.39

ES, 6/3/05
 * fine-tuning for linux drag&drop (.* files considered when dragging
   directories, .. and . excluded, warning for drops of non file://
   objects (e.g. ftp:// or http://). Filenames with non escaped spaces
   (or with %20) not yet supported.
 * warning issued when trying to open a file from the recent list, if the
   file does not exist anymore.
 * preference added scilabSingleQuotedStrings=yes/no
 * removed the unnecessary input argument to proc showopenwin
 * version --> 3.40

Francois VOGEL, 06/03/05
 * Request 168 fixed:
     - focus stays in Find/replace dialog (the new tag foundtext is used
       instead of the (special) sel tag)
     - Find Next button added in the Replace dialog
     - Intelligent move of the dialog occurs in case the text found would
       have been hidden behind the dialog
 * In case of opening a precendently opened file from the recent file list,
   the corresponding entry is moved at the top of the list.
 * version --> 3.41

Francois VOGEL, 07/03/05
 * Further changes related to request 168:
     - position of the text found/replaced is now given in the status bar
     - the foundtext tag that stayed forever after a find next triggered
       by F3 is now removed on keypress or buttonpress event
     - when the user hits replace, now the previously found text is replaced
       instead of the next one - if no match was previously found, then a
       search occurs, immediately followed by a replace if successful
     - now the possibly existing selection remains visible while the find
       dialog is open
 * version --> 3.42

ES 8/3/2005
 * Options menu splitted in Scheme and Options
 * Word Wrap moved to Options menu
 * all scipad colors are configurable within scilab with the Option/Colors
   submenu, and immediately updated
 * version --> 3.43

Francois VOGEL, 09/03/05
 * Again changes related to request 168, and find/replace:
     - bindings corrected for the replace dialog (still ctrl-key bindings)
     - trying to replace with an empty string now works correctly
     - there were tricky cases where replace all could enter an endless loop
      (e.g. replace d by dd, starting the replace between two matches on
      the same line) - this is fixed
 * maxrecentfiles = 0 is now fully supported in case that value is selected
   in the options menu to come
 * Find in selection now works correctly on Linux also
 * Wrt the new Options/colors, propagated changes to french messages
 * version --> 3.44

Francois VOGEL, 09/03/05
 * Word wrap is now correctly taken into account between Scilab sessions
 * version --> 3.45

ES  09/03/05
 * procs openlibfunsource1 and wordwrap eliminated; the menu entries using them
   can just inline them. 
 * version --> 3.46

Francois VOGEL, 12/03/05
 * New options made available:
     - File names: Full, or Full if ambiguous, or Pruned file names
     - Indentation spaces number - used for Ctrl-d as well as Tab
     - Binding for Tab: insert spaces to the next tab stop, or indent the
       selection if it starts at the beginning of a line - useful for
       quickly reindenting code parts newly enclosed in ifs for example
 * Fixed: some menues did not have the same fonts than the others
 * version --> 3.47

Francois VOGEL, 13/03/05
 * New options made available:
     - Tab key inserts spaces or tabs
     - Max number of recent files in the file menu (possibly zero)
 * version --> 3.48

ES 15/03/05
 * new option available: single quoted strings colorized as strings/not
 * version --> 3.49

Francois VOGEL, 16/03/05
 * Several minor glitches corrected for Find/Replace, in selection or full
   text, related to changing search direction between searches
 * version --> 3.50

Francois VOGEL, 16/03/05
 * Differences of keysyms between Linux and Windows platforms are now fully
   handled
 * version --> 3.51

Francois VOGEL, 19/03/05
 * Added an "Exec done" showinfo so that the user has a visual feedback of his
   action when it results in no change in the Scilab window.
 * F10 (Configure execution) in the debugger now accepts function definitions
   splitted on multiple continued lines, possibly with interlaced comments.
   There is still a limitation due to the tcl fact that matches must be within
   a single text line. Therefore the keyword "function" and the function name
   must still be within a single line.
 * Find/Replace with regexps could highlight the wrong number of matched chars.
   This is fixed but there is still something unclear about the text widget
   search command, whose switch -count var does not always update variable var
   with the length of the match. Worked around and code cleaned from -count
   switch.
 * Drag and drop of text within a buffer is now implemented. Possible actions
   are move (Shift-Button-1) and copy (Shift-Control-Button-1).
 * version --> 3.52

Francois VOGEL, 20/03/05
 * Changed bindings for drag and drop of text within Scipad for more standard
   ones: Button-1 now moves, whereas Control-Button-1 copies.
 * Binding for openlibfunsource is now Shift-Control-Button-1 (had no better
   idea...)
 * version --> 3.53

Francois VOGEL, 21/03/05
 * Drag and drop improvements for text within Scipad:
     - action can now be switched between copy and move during a drag operation
     - the cursor can no more be located inside a selection
     - scrolling of the window when drop location approaches the window border
     - cursor changes shape when over a selection
 * No more blinking of the cursor on Windows (temporary patch because of a
   glitch with drag and drop)
 * version --> 3.54

Francois VOGEL, 23/03/05
 * Again drag and drop improvements:
     - restored dnd for text/uri-list that was broken on Linux
     - Control-Button1 binding fixed - can now be pressed before drag start
     - fixed wrong behavior with quick drags (selection was sometimes extended)
 * version --> 3.55

Francois VOGEL, 24/03/05
 * Last minute drag and drop improvements:
     - restored cursor blinking on Windows (found a tricky workaround for
       tk bug 1169429)
     - further fix for quick drags, on Linux this time
 * version --> 3.56

Francois VOGEL, 25/03/05
 * version --> 4.0

Francois VOGEL, 03/04/05
 * Scipad silently displays the already opened buffer if the corresponding
   file menu entry is selected - no complain any more
 * Bindings with shift modifier corrected for Solaris Sun OS
 * env(SCIHOME) is now used instead of env(HOME) for saving the preferences
   file (changes by A. Cornet)
 * version --> 4.1 - This version comes with Scilab 3.1RC

Francois VOGEL, 10/04/05
 * Dropping text at the same place it was dragged from does no more tag the
   buffer as modified
 * version --> 4.2

ES, 13/04/05
 * menu Options/Colors colorized enforcing background and foreground
   color settings - makes it as readable as the textarea will be.
 * version --> 4.3

ES, 14/04/05
 * fixed linux printing. Checked, it works both with "lpr" and 
   "a2ps -2 -Pprinter". If the buffer is unmodified, no temporary 
   file is created (a2ps adds the proper header, which is nice)
   The syntax has to be "$printCommand $file" (this excludes for the
   moment e.g. "cat $file | lpr", but that could be reworked), and
   if $printCommand reports something (e.g. the job number or the number
   of pages, as a2ps does), that is popped up.
 * Preference values are written in {} in the preference file. This was
   necessary since $printCommand can contain spaces, minuses, piping chars.
 * Credit message in proc aboutme desourced, and expanded in each *.msg file.
   This will ease adding information, such as translator credits.
 * version --> 4.4

Francois VOGEL, 15/04/05
 * Slight change in proc OKconf_bp to avoid executing foo(1,2,,,) in case some
   input parameters are not given. This lead to wrong value of rhs (5 in this
   example). A call such as this one is now trimmed to foo(1,2), giving the
   correct rhs=2
 * Consistent change made in proc checkarglist to avoid Scipad complain when
   argument order is not the same as what is in the function definition, and
   argument value is "" (meaning this argument will not be sent on execution)
 * Bug fixed: The message box "Check function definition" could inopportunely
   pop up when there was more than one opened buffer
 * Added a popup for the debugger: if the user right-clicks on a selection
   he can now quickly add the selection as a watch variable
 * The debug session is now properly canceled on Scipad close, so that Scilab
   is no more in a messy state in such a case
 * The debug session is aborted if the user closes the buffer that contains
   the function launched for debug. If another buffer is closed, all the
   breakpoints of the closed buffers are removed from Scilab and the debug
   session can go on
 * Minor bug fixed: the watch window icons for run to cursor and break (these
   features are still pending, waiting for the Scilab parsers to be fixed...)
   were sometimes inopportunely enabled
 * Selection made visible even if overlayed by a breakpoint
 * Bux fixed: In the debugger watch window with several watch variables, when
   execution has stopped due to a breakpoint, when the user changes the value
   of some variables and then adds a new variable (Add/Change button or
   right-click on selection), then the changes previously made on the other
   watch variables were lost
 * Credit given to Gunnar in the About box for the se translation
 * version --> 4.5

Francois VOGEL, 18/04/05
 * Refined the popup menu for "Add watch" to include the selected text.
 * Made use of the existing tags as well as of a regexp deduced from help
   names in Scilab. Only valid variables can now (in principle) be added
   on right-click on selection during debug
 * Some editing in the message files - German version added
 * version --> 4.6

Francois VOGEL, 26/04/05
 * RamDebugger capability added (MUST be set to "no" for committed
   files, see at the top of defaults.tcl)
 * Bug fixed: Replace all could hang Scipad when the string to search was
   included in the string to replace
 * Bug fixed: Trying to drag and drop in the call stack area of the watch
   window produced an error - Now this operation is no more allowed
 * version --> 4.7

Francois VOGEL, 27/04/05
 * Better fix for the Replace all bug supposedly fixed in 4.7 (there were
   still cases that could hang Scipad) - Rewrote proc ReplaceAll
 * Bug fixed: Regexps finds or replaces could produce an error if the
   search was performed independently of character case (e.g searching
   for [ab] in a buffer containing xxAxx)
 * version --> 4.8

Francois VOGEL, 29/04/05
 * Fixed: selection bounds could miss the first and/or last characters after
   a replace whose first or last match started or ended at the selection
   bounds
 * Watch window made resizable, and with 2 paned windows inside to adjust
   size of the call stack area and the variables area, and inside the variables
   area, the respective sizes of the variable names and the variable content.
   There is still a quirk, which is Tk bug 1192323 (partially solved in
   Tk8.5a3 cvs 29/04/05), but one can certainly live with it for the moment
 * Add arg window made resizable
 * version --> 4.9

Francois VOGEL, 03/05/05
 * Bug fixed: when in debug mode and there was no mouseoversel before, there
   was an error
 * version --> 4.10

Francois VOGEL, 05/05/05
 * Bug fixed: line/column indication in the bottom bar was no longer updated
   when the insertion cursor was moved by clicking on the text area. This bug
   was introduced in Scipad 4.7
 * version --> 4.11

ES, 05/05/05
 * cosmetic: colored activeforegrounds in menue Options/Colors
 * version --> 4.12

Francois VOGEL, 05/05/05
 * Proposal for a better activeforeground colorization scheme in Options/Colors
   menu, using http://aspn.activestate.com/ASPN/Cookbook/Tcl/Recipe/133529
 * version --> 4.13

Francois VOGEL, 06/05/05
 * Second proposal for a better activeforeground colorization scheme in
   Options/Colors menu, now better taking into account 16-bit colors as
   selected by the user in the color picker
 * version --> 4.14

Francois VOGEL, 08/05/05
 * Simplified shading of colors for the activeforeground colorization
   scheme in Options/Colors menu, following discussion on comp.lang.tcl
 * Added a checkbutton in the watch window add variable dialog box in order
   to force acquisition of the current value of this variable from the shell.
   This is useful during a debug session when the user adds a new watch
   variable just to check its current value without changing it. Previously,
   update was only performed after the next breakpoint stop
 * version --> 4.15

Francois VOGEL, 09/05/05
 * Fixed: "grab failed" on Linux happened when the user double-clicked on
   a variable name in the watch or configure box
 * version --> 4.16

ES, 16/05/05
 * version --> 5.0, incrementing the major for the new scilab release 3.1

Francois VOGEL, 17/05/05
 * Bug 1228 fixed - Cancel button removed when Scipad is exited because of
   a Scilab quit (but kept when exit is called from Scipad)
 * version --> still 5.0
