The Document Structure
The File 'filetypes.tcl'
Bindings in the textwidget
Where to download SL-Edit
was first programmed 1999. At that time it could only handle one file at once and the only improvement to notepad was the replace function.
In 2000, the program has been completely re-written. Now it got the ability to handle more than one file at once, plugins could be embedded, and it was at last nearly as functionally than version 3.00
And in 2002, SL-Edit was re-written one more time. Now it uses the advantages of the whole BWidget package, which means that almost all modules are used. Furthermore, it got a filesystem view in order to compensate the mostly long waiting times by using DDE and opening a file from Windows' Explorer.
is a simple plain-text-editor (i.e. no WYSIWYG like letter writing and layout software) as there are many many others. Myself, I used mostly notepad, which is too simple, you have to do all yourself, so I tried many others, like UltraEdit, but even these programs had not all the functions I wish. So I thought: "Hey, why don't you write your own editor? Then you can be really sure, that everything you need can be done!".
This was the beginning of SL-Edit (I know, it's a silly name...simply put my initials S.L. and Edit together)...
And in version 3.00 it became better than I ever thought at first.
SL-Edit has these abilities:
- Handle more than one file at once using a notebook.
- Process the most important functions on the text, like search, replace, undo, toggle word-wrap, etc.
- Upgradeable with little Tcl/Tk-Scripts as plugins to give SL-Edit the abilities you need.
- Browse your filesystem to create, edit, rename, copy, move and delete files and directories.
- Easily access the main functions with help of the toolbars and the fontbar.
- Be always informed about the size of the text and your position in it, with indicators in the statusbar.
- Winico and DDE Support
- Special Character Inserting for HTML and Plaintext
- Extended Clipboard for more than 1 clipboard at once
SL-Edit has a special clipboard function to save more than one string.
If you use the default keys CTRL-x, CTRL-c, CTRL-v you save a string it in the main clipboard, which also can be accessed from all other applications.
If you want to save more than one string (for variable names, etc.), press SHIFT-CTRL-c and SHIFT-CTRL-v and then any character key. For example: select a test, then press SHIFT-CTRL-c. Your cursor now will be shown as a waiting clock. Now Press any key, e.g. 'd' and the selected string will be saved under this key. In the Clipboard menu now appears a entry for this key. To Paste the saved data, press SHIFT-CTRL-v, again the waiting clock, and then 'd', and it will be pasted.
It's very simple, but useful.
SL-Edit can show the document structure of a text. Look at the file 'filetypes.tcl' in the SL-Edit directory. There you will find a procedure called 'Filetypes::treeFill'. This procedure will always be called on any open or save. It searches in the text for a string like '>MARK<*>/MARK<'. For every string like this it will create a marker and a link to it in the Document Structure Tree. You can use it for quickly jump to a special segment in your text. You can also add a tag named '>IMG<[string]>/IMG<' where '[string]' is the filename without extension of a gif file in the ./images/ subdirectory of SL-Edit. Then this image will be shown beside the marker name
Furthermore, there is a procedure called 'Filetypes::treeFill_tcl'. This procedure will be called, when the opened file has the extension '.tcl'. It searches for procedures and creates a marker for every procedure in the text.
Write your own procedure 'Filetypes::treeFill_[extension]' for any file extension you want to upgrade the document structure. If you wrote such a procedure, please send it to Stephan.Linkel@t-online.de, so I'll add it to the next release.
You can also create temporary markers in the text, which will only exist at this runtime with the popup menu of the textwidget ('Add Marker').
Open the sourcecode ('sl-edit.tcl') to see how it looks
The File 'filetypes.tcl':
In this file you can write some procedures to support special filetypes.
The 3 procedures, that are possible are 'Filetypes::treeFill_*', 'Filetypes::init_*' and 'Filetypes::keyRelease_*', where * is the extension of the file.
'Filetypes::treeFill_*' is called when the Document Structure is processed.
'Filetypes::init_*' is called by opening a file.
'Filetypes::keyRelease_*' is called by every changing key release.
With this procedures, you are for example able to write a syntax highlighting.
See the delivered filetypes.tcl for the 3 procedures for .tcl files. I have written syntax highlighting and Document Structure processing.
SL-Edit has these bindings in the textwidget:
SL-Edit has these global bindings:
- Any key
- will update the indicators showing position and length of the text, or, if any text selected, the length of the selected text.
will call the procedure 'Filetypes::keyRelease_*', if it exists (See The File 'filetypes.tcl')
- will select the whole text
- shows the search window
- shows the replace window
- updates the Document Structure
- will do a newline with syntax indent, when syntax indent is disabled and a clear newline when it is enabled.
- will delete all white-spaces between the linestart and the insert cursor.
- will delete all white-spaces between the previous word and the insert cursor; ignores newlines.
- Will cancel most of eventually processes with long periods, e.g. Replace or File listings. This key also works for the tcl-specific procedures from the original filetypes.tcl
- open a file
- save the text
- create a new, clear tab
- Close a file
- Hide SL-Edit, if DDE and Winico are used, or exit if not used
- Ends the busy status. Use this if you found a bug which does not unset the busy status. Don't forget to report the bug to Stephan.Linkel@t-online.de
- Shows the log window of the start-up
- Shows the Tcl/Tk console
SL-Edit can be upgraded with plugins, which are little Tcl/Tk scripts named '[plugin name].tcl' in the ./plugins/ directory.
There will be a menu item in the menu 'Plugins' which will execute the script.
How it works:
SL-Edit creates a procedure with contains the source code saved in a plugin file.
You can access these variables:
Look at one of the provided plugins to see how they work and orient you at these.
- array, which contains the specifications of the config.ini file
- array, which contains values for the runtime, e.g. textvariables etc.
- array, which contains the widget paths for the most important widgets
- string, which contains the path name of the textwidget actually shown
- string, which contains the path name of the document structure tree actually shown
The Filesystem tab shows a Windows Explorer like view of the filesystem. You can do the most important functions like creating, editing, renaming, copying, moving and deleting files and directories.
Note, that the Filesystem Tab is still in beta-status.
Bindings in the listbox:
- rename the selected file or directory
- update the listbox
- create a new directory
You can download SL-Edit at http://sourceforge.net/projects/sledit