~ubuntu-branches/ubuntu/maverick/universalindentgui/maverick-proposed

« back to all changes in this revision

Viewing changes to src/UiGuiHighlighter.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2009-04-29 10:50:58 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090429105058-7xj26rwxxnir1tr7
Tags: 1.0.2-1
* New upstream release:
  - The default editor font type is now Monospace instead of Courier.
    (Closes: #483873)
* Add 01_disable_check_for_update.diff patch:
  Automatic check for update is disabled by default. (Closes: #514999)
* Bump debian/compat to 7.
* Update debian/control:
  - Set Thomas Schweitzer as maintainer and myself as uploader.
    (Closes: #483068)
  - Bump debhelper build-dependency to 7.
  - Bump Standards-Version to 3.8.1. No changes needed.
  - Update recommended beautifier list.
  - Update description to list all supported beautifiers.
* Update debian/copyright:
  - Add PerlTidy.pm and JsDecoder.js missing copyrights.
* Cleanup debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2006-2009 by Thomas Schweitzer                          *
 
3
 *   thomas-schweitzer(at)arcor.de                                         *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License version 2.0 as   *
 
7
 *   published by the Free Software Foundation.                            *
 
8
 *                                                                         *
 
9
 *   This program is distributed in the hope that it will be useful,       *
 
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
 *   GNU General Public License for more details.                          *
 
13
 *                                                                         *
 
14
 *   You should have received a copy of the GNU General Public License     *
 
15
 *   along with this program in the file LICENSE.GPL; if not, write to the *
 
16
 *   Free Software Foundation, Inc.,                                       *
 
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
18
 ***************************************************************************/
 
19
 
 
20
#ifndef UIGUIHIGHLIGHTER_H
 
21
#define UIGUIHIGHLIGHTER_H
 
22
 
 
23
#include <QObject>
 
24
#include <QMap>
 
25
#include <QMenu>
 
26
#include <QCoreApplication>
 
27
#include <Qsci/qsciscintilla.h>
 
28
#include <Qsci/qscilexer.h>
 
29
#include <Qsci/qscilexerbash.h>
 
30
#include <Qsci/qscilexerbatch.h>
 
31
#include <Qsci/qscilexercmake.h>
 
32
#include <Qsci/qscilexercpp.h>
 
33
#include <Qsci/qscilexercsharp.h>
 
34
#include <Qsci/qscilexercss.h>
 
35
#include <Qsci/qscilexerd.h>
 
36
#include <Qsci/qscilexerdiff.h>
 
37
#if ( QSCINTILLA_VERSION >= 0x020300 )
 
38
#include <Qsci/qscilexerfortran.h>
 
39
#include <Qsci/qscilexerfortran77.h>
 
40
#endif
 
41
#include <Qsci/qscilexerhtml.h>
 
42
#include <Qsci/qscilexeridl.h>
 
43
#include <Qsci/qscilexerjava.h>
 
44
#include <Qsci/qscilexerjavascript.h>
 
45
#include <Qsci/qscilexerlua.h>
 
46
#include <Qsci/qscilexermakefile.h>
 
47
#if ( QSCINTILLA_VERSION >= 0x020300 )
 
48
#include <Qsci/qscilexerpascal.h>
 
49
#endif
 
50
#include <Qsci/qscilexerperl.h>
 
51
#if ( QSCINTILLA_VERSION >= 0x020300 )
 
52
#include <Qsci/qscilexerpostscript.h>
 
53
#endif
 
54
#include <Qsci/qscilexerpov.h>
 
55
#include <Qsci/qscilexerproperties.h>
 
56
#include <Qsci/qscilexerpython.h>
 
57
#include <Qsci/qscilexerruby.h>
 
58
#include <Qsci/qscilexersql.h>
 
59
#if ( QSCINTILLA_VERSION >= 0x020300 )
 
60
#include <Qsci/qscilexertcl.h>
 
61
#endif
 
62
#include <Qsci/qscilexertex.h>
 
63
#include <Qsci/qscilexervhdl.h>
 
64
#if ( QSCINTILLA_VERSION >= 0x020300 )
 
65
#include <Qsci/qscilexerxml.h>
 
66
#include <Qsci/qscilexeryaml.h>
 
67
#endif
 
68
 
 
69
 
 
70
class UiGuiHighlighter : public QObject
 
71
{
 
72
    Q_OBJECT
 
73
 
 
74
public:
 
75
    UiGuiHighlighter(QsciScintilla *parent);
 
76
    void turnHighlightOff();
 
77
    void turnHighlightOn();
 
78
        
 
79
        bool readCurrentSettings(const char *prefix);
 
80
        void writeCurrentSettings(const char *prefix);
 
81
    QStringList getAvailableHighlighters();
 
82
 
 
83
private:
 
84
    bool highlightningIsOn;
 
85
    QsciScintilla *qsciEditorParent;
 
86
    QMap<int, QFont> fontForStyles;
 
87
    QMap<int, QColor> colorForStyles;
 
88
    QsciLexer* lexer;
 
89
    QSettings *settings;
 
90
    QMap<QString, QStringList> mapHighlighternameToExtension;
 
91
 
 
92
public slots:
 
93
    //! The foreground color for style number \a style is set to \a color.  If
 
94
    //! \a style is -1 then the color is set for all styles.
 
95
    void setColor(const QColor &color, int style = -1);
 
96
 
 
97
    //! The font for style number \a style is set to \a font.  If \a style is
 
98
    //! -1 then the font is set for all styles.
 
99
    void setFont(const QFont &font, int style = -1);
 
100
 
 
101
        //! Sets the lexer that is responsible for the given \a extension.
 
102
        int setLexerForExtension( QString extension );
 
103
 
 
104
    void setLexerByName( QString lexerName );
 
105
 
 
106
        void setHighlighterByAction(QAction* highlighterAction);
 
107
};
 
108
 
 
109
#endif  // UIGUIHIGHLIGHTER_H