Search:
|
Access:
» Scintilla - an editor not just for programmersRelated categories: Library of the Month | IDE Marek SawerwainViewed: 5078 | Article date: 2006-01-18 14:05:43 Scintilla is a universal control dedicated to editing text, with a strong emphasis on source code of software.
Scintilla is used in many applications distributed under the GNU licence, for example in the styles editor cssed, as well as in commercial ones, e.g.: Komodo. The component can be embedded into applications created with diverse packages, for instance with GTK+ or QT. Ports for other programming languages, e.g. Python, are available as well. In this article Marek will demonstrate how to take advantage of the power of this component in the GTK+ environment under Linux (32-bit version for x86 processors).
The author develops software for WIN32 and Linux. Hobbies: theory of programming languages and good literature. Contact with the author: msawe@go.onet.pl
One could expect that in the field of text edition, especially in case of edition of traditional text files, all the needs should be satisfied by classical controls available in the most popular desktop environments: GNOME, KDE or WIN32. However, fairly often a need appears for more advanced features, e.g.: colouring of text or highlighting of brackets. If we are looking for a ready-to-use component aimed at edition of text that really should have features like the one mentioned above, the most powerful component of this kind is Scintilla. It is an universal control (although terms such as widget, control or component have their own, widely understood meanings, for the purpose of this article let us assume all three can be used interchangeably) dedicated to editing text, with a strong emphasis on source code of software. Scintilla is used in many applications distributed under the GNU licence, for example in the styles editor cssed, as well as in commercial ones, e.g.: Komodo. The component can be embedded into applications created with diverse packages, for instance with GTK+ or QT. Ports for other programming languages, e.g. Python, are available as well. Whenever we need a text-edition component, Scintilla is a great choice. Its primary advantage is the licence - this software is free, moreover it can be used to develop both Open Source and commercial applications; however, this is an own licence of the authors and not GNU GPL. In this article I will attempt to demonstrate how to take advantage of the power of this component in the GTK+ environment under Linux (32-bit version for x86 processors). Let me also add at this point that the editor component of Scintilla can also be used in other popular GUI environments such as Fox or wxWidgets, as well as on the Win32 platform.
Where Can We Use Scintilla?Scintilla is a component aimed at edition of text, with emphasis on source code of software. Because of this it might seem that only programmers will be able to make use of the features of this component. This is not entirely the truth - when writing an application giving a possibility to edit scripts, the best approach is to have our application contain an embedded internal editor. A perfect example here can be a database management system in which an user can construct his/her own SQL queries. The task of editing SQL statements could be accomplished with one of the plain editors made available with most GUI-builder libraries; however, presenting the user with an editor which highlights matching brackets, allows one to fold fragments of code and displays tips too will definitely boost his opinion about our system. Unfortunately there is more to making use of this component than just adding it to a window, with something like:
Additional features are not made available automatically - we have to define e.g. which words in the text are to be highlighted and set up quite a few other details. Luckily those tasks are not hard to take care of.
|
|
Copyright C 2006 by Software Developer's Journal. All rights reserved.





SDJ Users:
Shopping Cart









