Home

[QSource-Highlight]

QSource-Highlight

QSource-Highlight is a Qt4 front-end for GNU Source-Highlight, http://www.gnu.org/software/src-highlite.

QSource-Highlight uses the library included in GNU Source-Highlight, since version 3, thus you need that library to build QSource-Highlight; in particular it uses Source-Highlight-Qt additional library, http://srchiliteqt.sourceforge.net, which provides highlighting in Qt relying on GNU Source-Highlight. Thus, you need to install Source-Highlight-Qt as well. we refer to GNU Source-Highlight's and Source-Highlight-Qt's websites for further information about the library and its installation (you may want to check whether your distribution already provides packages for these two libraries).

The home page of QSource-Highlight is http://qsrchilite.sf.net.

QSource-Highlight is free and open source GPL software.

Download

Sources and binaries (when available) can be downloaded from http://sourceforge.net/projects/qsrchilite/files/.

You can also get the source code via git (this way you will also access the latest version - probably the one in development stage, and not yet released):

    git clone git://qsrchilite.git.sourceforge.net/gitroot/qsrchilite/qsrchilite

and you can also browse the repository at http://qsrchilite.git.sourceforge.net.

Installation

We suggest to create a build directory, cd to that directory and then run qmake accordingly

    qmake -recursive ../qsource-highlight.pro

and then run make; the binary will be created in the bin directory.

Once the building has sucessfully finished, you can install the files with the command make install; binaries will be installed into /bin and documentation (the one readable with qt assistant) into /share/doc/qsource-highlight and html documentation into /share/doc/qsource-highlight/html. You can customize the root of the installation directory with the environment variable INSTALL_ROOT; for instance,

    INSTALL_ROOT=$HOME/usr/local make install

You might need to become root if you install in a path different from your home.

The qmake project of QSource-Highlight uses pkg-config, http://pkg-config.freedesktop.org to detect the library Source-Highlight-Qt (and implicitly also the GNU Source-Highlight library). If the library is installed in a standard system path (e.g., /usr) running qmake should be enough; otherwise you should tell pkg-config, through the environment variable PKG_CONFIG_PATH, where to find the .pc file of source-highlight-qt4 (source-highlight-qt4.pc; note that this file will also contain the references to GNU Source-highlight library and headers, so you won't have to worry about that). For instance, if you've installed source-highlight-qt4 using the prefix ~/usr/local, the .pc file will be installed into ~/usr/local/lib/pkgconfig, thus you should run qmake as follows:

    PKG_CONFIG_PATH=~/usr/local/lib/pkgconfig qmake -recursive ../qsource-highlight.pro

If pkg-config is not installed in your system, you'll have to specify the LIBS and INCLUDEPATH qmake variables manually (e.g., by modifying the .pro file), using the correct path, for instance:

    LIBS += -L~/usr/local/lib -lsource-highlight-qt4
    INCLUDEPATH = ~/usr/local/include

Main Window

The main window of qsource-highlight permits opening a file to highlight, to tweak some highlighting options, and to see the output of highlighting:

A preview of the highlighted output is available for some output formats (e.g., HTML, XHTML, etc.).

The language definition file is automatically selected according to the input file extension, but you can change it manually by using the corresponding combo box. In particular you have three combo boxes:

All the files named in these combo boxes refer to files shipped with Source-highlight, and they are searched for in the Source-highlight corresponding installation path. In case the combo boxes are empty, then the path where source-highlight searches for these files is wrong: you should then configure the correct path for source-highlight using the settings dialog (Source-Highlight Settings).

The icons corresponding to actions available in QSource-Highlight should be quite standard and their meaning should be immediate; however, there are some that require some explainations:

This opens a file as an input file (whose contents can be edited, but, most of all, highlighted).
This opens a style file to be used for highlighting. Note that this is useful when you have your own style file that is not part of source-highlight style files (thus it would not be selected in the corresponding combo box).
Saves the current input file.
Saves the current output file (i.e., the output of highlighting).
Saves the current style file (see also Style Settings).
Highlights the current input file using the selected language definition file, the selected output format and the selected style.
As above, but highlight only the currently selected lines of the input file.

Options

On the main window there is also an "Options" pane which can be used to tweak source-highlight formatting options. We refer to the documentation of source-highlight for further details; here we only briefly summarize the main options:

Document options

Line options

Settings

Style Settings

You can use the highlighting style dialog to customize the current highlighting style:

This provides a way to customize the output style of each language element recognized by the current language definition file (e.g., keywords, comments, symbols, etc.). You can also save the currently customized style.

Source-Highlight Settings

Source-highlight library uses a path (called data dir) to search for language definition file, output format definition files, style files, etc. This path must be set correctly otherwise highlighting features will not work. In a standard installation this path should already be set appropriately. However, if you use a non standard installation of source-highlight, this path might not be set correctly (a symptom, as said in the previous section, is when the combo boxes are simply empty). You can set this path using the Settings -> Source-highlight Settings menu. This will bring a dialog where you can set the path (or choose it with the browse button); notice that the dialog also checks whether the currently selected path is a valid path for source-highlight.

Tip:

In order to be a valid path, it should contain at least lang.map file and .lang, .outlang, .style files.

[QSource-Highlight]


Copyright © 2009 Lorenzo Bettini  
QSource-Highlight