diff --git a/harbour/ChangeLog b/harbour/ChangeLog
index 2e05d722b2..60e6426002 100644
--- a/harbour/ChangeLog
+++ b/harbour/ChangeLog
@@ -17,6 +17,45 @@
past entries belonging to author(s): Viktor Szakats.
*/
+2009-12-30 11:44 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
+ * contrib/hbqt/hbqt.h
+ * contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp
+ * contrib/hbqt/hbqt_hbqsyntaxhighlighter.h
+ * contrib/hbqt/qtgui/QSyntaxHighlighter.cpp
+ * contrib/hbqt/qtgui/TQSyntaxHighlighter.prg
+ * contrib/hbqt/qth/QSyntaxHighlighter.qth
+ + Implemented syntax highlighting mechanism at PRG level.
+
+ * contrib/hbide/hbide.hbp
+ * contrib/hbide/ideeditor.prg
+ * contrib/hbide/idemisc.prg
+ + contrib/hbide/iderequests.prg
+ * contrib/hbide/idestylesheets.prg
+ + Showcased syntax highlighting in action under prg control.
+ This implementation offer colored tokens, bold, italic,
+ underlined fonts. Please test.
+
+ TODO: User interface to build new themes besides HBIDE defined ones.
+ If you have, furinish the themes to be included as HBIDE's
+ default themes, under follwoing heads:
+ * Compiler Directives - #include...
+ * Harbour Keywords - FUNCTION, DOCASE, ...
+ * Operators - :=, .or., ...
+ * Parenthesis and braces - (), {}, ...
+ * Functions in general - DBCreate(), ...
+ * Strings - "This is text", 'and this also'
+ * Comments - // Comment, /* Useful Routine */, ..
+ * Numeric constants - 123, 212.33,...
+ * Background color
+
+ The attributes will be ( in the order shown below )
+ aRGB = { 127,213,123 }
+ lItalic = .T. | .F.
+ lBold = .T. | .F.
+ lUnderline = = .T. | .F.
+
+ There are few more exotic attributes but for later...
+
2009-12-31 03:17 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapicdp.h
* harbour/src/codepage/Makefile
diff --git a/harbour/contrib/hbide/hbide.hbp b/harbour/contrib/hbide/hbide.hbp
index 6bf2bae12c..2fdc495d6d 100644
--- a/harbour/contrib/hbide/hbide.hbp
+++ b/harbour/contrib/hbide/hbide.hbp
@@ -23,4 +23,5 @@ ideeditor.prg
idefindreplace.prg
idedocks.prg
idesaveload.prg
+iderequests.prg
ideparseexpr.c
diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg
index ac643abafa..bb7a52d73d 100644
--- a/harbour/contrib/hbide/ideeditor.prg
+++ b/harbour/contrib/hbide/ideeditor.prg
@@ -144,6 +144,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos )
::qEdit:setLineWrapMode( QTextEdit_NoWrap )
::qEdit:setFont( ::oIde:oFont:oWidget )
::qEdit:ensureCursorVisible()
+ * ::qEdit:setStyleSheet( GetStyleSheet( "QPlainTextEdit" ) )
::qDocument := QTextDocument():configure( ::qEdit:document() )
@@ -154,7 +155,8 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos )
::oTab:oWidget:setLayout( ::qLayout )
- ::qHiliter := QSyntaxHighlighter():new( ::qEdit:document() )
+ ::qHiliter := HBQSyntaxHighlighter():new( ::qEdit:document() )
+ SetSyntaxHilighting( ::qEdit, ::qHiliter )
Qt_Connect_Signal( ::qEdit , "textChanged()" , {|| ::setTabImage() } )
Qt_Connect_Signal( ::qEdit , "cursorPositionChanged()", {|| ::dispEditInfo() } )
diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg
index 6fe9540cf5..07eebbf715 100644
--- a/harbour/contrib/hbide/idemisc.prg
+++ b/harbour/contrib/hbide/idemisc.prg
@@ -479,27 +479,27 @@ FUNCTION PathNormalized( cPath, lLower )
#define CLR_MSG_INFO 'brown'
#define CLR_MSG_WARN 'blue'
-STATIC ;
-FUNCTION BuildRegExpressList( aRegList )
- AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( ".*: warning.*" ) })
- AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( ".*\) Warning W.*" ) })
- AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( "^Warning W([0-9]+).*" ) })
+STATIC FUNCTION BuildRegExpressList( aRegList )
+ AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( ".*: warning.*" ) } )
+ AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( ".*\) Warning W.*" ) } )
+ AAdd( aRegList, { MSG_TYPE_WARN, hb_RegexComp( "^Warning W([0-9]+).*" ) } )
- AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*: error.*" ) })
- AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*\) Error E.*" ) })
- AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( "^Error E([0-9]+).*" ) })
- AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( "^Error: ." ) })
- AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*:([0-9]+):([\w|\s]*)error.*" ) })
- AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*:\(\.\w+\+.*\):.*" ) })
- AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*: fatal\s.*" ) })
+ AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*: error.*" ) } )
+ AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*\) Error E.*" ) } )
+ AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( "^Error E([0-9]+).*" ) } )
+ AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( "^Error: ." ) } )
+ AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*:([0-9]+):([\w|\s]*)error.*" ) } )
+ AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*:\(\.\w+\+.*\):.*" ) } )
+ AAdd( aRegList, { MSG_TYPE_ERR , hb_RegexComp( ".*: fatal\s.*" ) } )
- AAdd( aRegList, { MSG_TYPE_INFO, hb_RegexComp( ".*: note.*" ) })
- AAdd( aRegList, { MSG_TYPE_INFO, hb_RegexComp( ".*: In function '.*" ) })
- AAdd( aRegList, { MSG_TYPE_INFO, hb_RegexComp( "^(\s*).*\s: see.*" ) })
- RETURN NIL
+ AAdd( aRegList, { MSG_TYPE_INFO, hb_RegexComp( ".*: note.*" ) } )
+ AAdd( aRegList, { MSG_TYPE_INFO, hb_RegexComp( ".*: In function '.*" ) } )
+ AAdd( aRegList, { MSG_TYPE_INFO, hb_RegexComp( "^(\s*).*\s: see.*" ) } )
-/*
- * Catch source file name & line error from an msg status from compiler result.
+ RETURN aRegList
+
+/*----------------------------------------------------------------------*//*
+* Catch source file name & line error from an msg status from compiler result.
* 29/12/2009 - 13:22:29 - vailtom
*/
FUNCTION ParseFNfromStatusMsg( cText, cFileName, nLine, lValidText )
@@ -577,6 +577,7 @@ FUNCTION ParseFNfromStatusMsg( cText, cFileName, nLine, lValidText )
cFileName := alltrim( cFileName )
RETURN !Empty( cFileName )
+/*----------------------------------------------------------------------*/
/*
* This function parses compiler result and hightlight errors & warnings using
* regular expressions. (vailtom)
@@ -607,17 +608,13 @@ FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget )
DO WHILE "<" $ cText
cText := StrTran( cText, "<", "<" )
ENDDO
-
DO WHILE ">" $ cText
cText := StrTran( cText, ">", ">" )
ENDDO
-
aLines := hb_aTokens( cText, Chr( 10 ) )
- cText := '
'
oWidget:insertHTML( cText )
-
FOR EACH cLine IN aLines
IF !Empty( cLine )
@@ -630,13 +627,8 @@ FUNCTION ConvertBuildStatusMsgToHtml( cText, oWidget )
ENDIF
oWidget:append( cLine )
-
- cText += cLine + '
'
NEXT
- cText += '
'
-
- oWidget:insertHTML( '' )
RETURN cText
/*----------------------------------------------------------------------*/
@@ -654,185 +646,90 @@ FUNCTION FilesToSources( aFiles )
RETURN aSrc
/*----------------------------------------------------------------------*/
+/*
+ * TODO: Load setting from user source
+ * Separate syntax highliters for different type of files.
+ */
+FUNCTION SetSyntaxHilighting( qEdit, qHiliter )
+ LOCAL a_, b_, qFormat
-FUNCTION RequestModules()
+ HB_SYMBOL_UNUSED( qEdit )
- hbxbp_just( QAbstractButton():new() )
- hbxbp_just( QAbstractItemModel():new() )
- hbxbp_just( QAbstractItemView():new() )
- hbxbp_just( QAbstractListModel():new() )
- hbxbp_just( QAbstractPrintDialog():new() )
- hbxbp_just( QAbstractScrollArea():new() )
- hbxbp_just( QAbstractSlider():new() )
- hbxbp_just( QAbstractSpinBox():new() )
- hbxbp_just( QAbstractTableModel():new() )
- hbxbp_just( QAction():new() )
- hbxbp_just( QApplication():new() )
- hbxbp_just( QBitmap():new() )
- hbxbp_just( QBoxLayout():new() )
- hbxbp_just( QBrush():new() )
- hbxbp_just( QButtonGroup():new() )
- hbxbp_just( QCalendarWidget():new() )
- hbxbp_just( QCheckBox():new() )
- hbxbp_just( QClipboard():new() )
- hbxbp_just( QColor():new() )
- hbxbp_just( QColorDialog():new() )
- hbxbp_just( QComboBox():new() )
- hbxbp_just( QCommandLinkButton():new() )
- hbxbp_just( QCommonStyle():new() )
- hbxbp_just( QConicalGradient():new() )
- hbxbp_just( QCoreApplication():new() )
- hbxbp_just( QCursor():new() )
- hbxbp_just( QDateEdit():new() )
- hbxbp_just( QDateTime():new() )
- hbxbp_just( QDateTimeEdit():new() )
- hbxbp_just( QDesktopWidget():new() )
- hbxbp_just( QDial():new() )
- hbxbp_just( QDialog():new() )
- hbxbp_just( QDir():new() )
- hbxbp_just( QDirModel():new() )
- hbxbp_just( QDockWidget():new() )
- hbxbp_just( QDoubleSpinBox():new() )
- hbxbp_just( QDropEvent():new() )
- hbxbp_just( QDragMoveEvent():new() )
- hbxbp_just( QDragEnterEvent():new() )
- hbxbp_just( QDragLeaveEvent():new() )
- hbxbp_just( QErrorMessage():new() )
- hbxbp_just( QEvent():new() )
- hbxbp_just( QEventLoop():new() )
- hbxbp_just( QFileDialog():new() )
- hbxbp_just( QFileSystemModel():new() )
- hbxbp_just( QFocusEvent():new() )
- hbxbp_just( QFocusFrame():new() )
- hbxbp_just( QFont():new() )
- hbxbp_just( QFontComboBox():new() )
- hbxbp_just( QFontDatabase():new() )
- hbxbp_just( QFontDialog():new() )
- hbxbp_just( QFontInfo():new() )
- hbxbp_just( QFontMetrics():new() )
- hbxbp_just( QFontMetricsF():new() )
- hbxbp_just( QFormLayout():new() )
- hbxbp_just( QFrame():new() )
- hbxbp_just( QFtp():new() )
- hbxbp_just( QGradient():new() )
- hbxbp_just( QGridLayout():new() )
- hbxbp_just( QGroupBox():new() )
- hbxbp_just( QHBoxLayout():new() )
- hbxbp_just( QHeaderView():new() )
- hbxbp_just( QHttp():new() )
- hbxbp_just( QIcon():new() )
- hbxbp_just( QImage():new() )
- hbxbp_just( QImageReader():new() )
- hbxbp_just( QImageWriter():new() )
- hbxbp_just( QInputDialog():new() )
- hbxbp_just( QInputEvent():new() )
- hbxbp_just( QIODevice():new() )
- hbxbp_just( QKeyEvent():new() )
- hbxbp_just( QKeySequence():new() )
- hbxbp_just( QLabel():new() )
- hbxbp_just( QLatin1Char():new() )
- hbxbp_just( QLatin1String():new() )
- hbxbp_just( QLayout():new() )
- hbxbp_just( QLayoutItem():new() )
- hbxbp_just( QLCDNumber():new() )
- hbxbp_just( QLine():new() )
- hbxbp_just( QLinearGradient():new() )
- hbxbp_just( QLineEdit():new() )
- hbxbp_just( QList():new() )
- hbxbp_just( QListView():new() )
- hbxbp_just( QListWidget():new() )
- hbxbp_just( QListWidgetItem():new() )
- hbxbp_just( QMainWindow():new() )
- hbxbp_just( QMenu():new() )
- hbxbp_just( QMenuBar():new() )
- hbxbp_just( QMessageBox():new() )
- hbxbp_just( QModelIndex():new() )
- hbxbp_just( QMouseEvent():new() )
- hbxbp_just( QMoveEvent():new() )
- hbxbp_just( QObject():new() )
- hbxbp_just( QPaintDevice():new() )
- hbxbp_just( QPageSetupDialog():new() )
- hbxbp_just( QPainter():new() )
- hbxbp_just( QPaintEvent():new() )
- hbxbp_just( QPalette():new() )
- hbxbp_just( QPen():new() )
- hbxbp_just( QPicture():new() )
- hbxbp_just( QPixmap():new() )
- hbxbp_just( QPoint():new() )
- hbxbp_just( QPointF():new() )
- hbxbp_just( QPrintDialog():new() )
- hbxbp_just( QPrintEngine():new() )
- hbxbp_just( QPrinter():new() )
- hbxbp_just( QPrintPreviewDialog():new() )
- hbxbp_just( QProcess():new() )
- hbxbp_just( QProgressBar():new() )
- hbxbp_just( QProgressDialog():new() )
- hbxbp_just( QPushButton():new() )
- hbxbp_just( QRadialGradient():new() )
- hbxbp_just( QRadioButton():new() )
- hbxbp_just( QRect():new() )
- hbxbp_just( QRectF():new() )
- hbxbp_just( QRegion():new() )
- hbxbp_just( QResizeEvent():new() )
- hbxbp_just( QResource():new() )
- hbxbp_just( QScrollArea():new() )
- hbxbp_just( QScrollBar():new() )
- hbxbp_just( QSignalMapper():new() )
- hbxbp_just( QSize():new() )
- hbxbp_just( QSizeF():new() )
- hbxbp_just( QSizeGrip():new() )
- hbxbp_just( QSizePolicy():new() )
- hbxbp_just( QSlider():new() )
- hbxbp_just( QSound():new() )
- hbxbp_just( QSpinBox():new() )
- hbxbp_just( QSplashScreen():new() )
- hbxbp_just( QSplitter():new() )
- hbxbp_just( QStandardItem():new() )
- hbxbp_just( QStandardItemModel():new() )
- hbxbp_just( QStatusBar():new() )
- hbxbp_just( QStringList():new() )
- hbxbp_just( QStringListModel():new() )
- hbxbp_just( QSystemTrayIcon():new() )
- hbxbp_just( QTabBar():new() )
- hbxbp_just( QTableView():new() )
- hbxbp_just( QTableWidget():new() )
- hbxbp_just( QTableWidgetItem():new() )
- hbxbp_just( QTabWidget():new() )
- hbxbp_just( QTextBlock():new() )
- hbxbp_just( QTextBlockFormat():new() )
- hbxbp_just( QTextBlockGroup():new() )
- hbxbp_just( QTextBrowser():new() )
- hbxbp_just( QTextBoundaryFinder():new() )
- hbxbp_just( QTextCharFormat():new() )
- hbxbp_just( QTextCodec():new() )
- hbxbp_just( QTextCursor():new() )
- hbxbp_just( QTextDecoder():new() )
- hbxbp_just( QTextDocument():new() )
- hbxbp_just( QTextDocumentFragment():new() )
- hbxbp_just( QTextDocumentWriter():new() )
- hbxbp_just( QTextEdit():new() )
- hbxbp_just( QTextFrame():new() )
- hbxbp_just( QTextItem():new() )
- hbxbp_just( QTextLayout():new() )
- hbxbp_just( QTextLength():new() )
- hbxbp_just( QTextLine():new() )
- hbxbp_just( QTextObject():new() )
- hbxbp_just( QTextStream():new() )
- hbxbp_just( QTimeEdit():new() )
- hbxbp_just( QTimer():new() )
- hbxbp_just( QToolBar():new() )
- hbxbp_just( QToolBox():new() )
- hbxbp_just( QToolButton():new() )
- hbxbp_just( QTreeView():new() )
- hbxbp_just( QTreeWidget():new() )
- hbxbp_just( QTreeWidgetItem():new() )
- hbxbp_just( QUrl():new() )
- hbxbp_just( QVariant():new() )
- hbxbp_just( QVBoxLayout():new() )
- hbxbp_just( QWheelEvent():new() )
- hbxbp_just( QWidget():new() )
- hbxbp_just( QWidgetItem():new() )
+ /* Compiler Directives */
+ b_:= { "include","ifdef","else","endif","command","xcommand","translate","xtranslate" }
+ a_:= {}; aeval( b_, {|e| aadd( a_, "#" + upper( e ) + "\b|#" + e + "\b" ) } )
+ SetSyntaxAttrbs( qHiliter, a_, { 120, 26,213 }, .t., .t., .f. )
- RETURN NIL
+ /* Operators */
+ a_:= { "\:\=|\:|\+|\-|\\|\*|\ IN\ |\ in\ |\=|\>|\<|\^|\%|\$|\&|\@|\.or\.|\.and\.|\.OR\.|\.AND\." }
+ SetSyntaxAttrbs( qHiliter, a_, { 255,120, 0 }, .f., .f., .f. )
+
+ /* Numerics */
+ a_:= { "\b[0-9.]+\b" }
+ SetSyntaxAttrbs( qHiliter, a_, { 127,127,127 }, .f., .f., .f. )
+
+ /* Parenthesis and Braces */
+ a_:= { "\(|\)|\{|\}|\[|\]|\|" }
+ SetSyntaxAttrbs( qHiliter, a_, { 255,127,200 }, .f., .f., .f. )
+
+ /* Harbour Keywords */
+ b_:= { 'function','return','static','local', ;
+ 'if','else','elseif','endif','end', ;
+ 'docase','case','endcase','otherwise', ;
+ 'do','while','exit',;
+ 'for','each','next','step','to',;
+ 'class','endclass','method','data','var','destructor','inline','assign','access','inherit','init','create',;
+ 'begin','sequence','try','catch','always','recover','default','hb_symbol_unused' }
+ a_:= {}; aeval( b_, {|e| aadd( a_, "\b" + upper( e ) + "\b|\b" + e + "\b" ) } )
+ SetSyntaxAttrbs( qHiliter, a_, { 40,120,240 }, .f., .t., .f. )
+
+ /* Functions in General */
+ a_:= { "\b[A-Za-z0-9_]+(?=\()" }
+ SetSyntaxAttrbs( qHiliter, a_, { 128,0,64 }, .f., .f., .f. )
+
+ /* Strings */
+ a_:= {}
+ aadd( a_, '\".*\"' )
+ aadd( a_, "\'.*\'" )
+ SetSyntaxAttrbs( qHiliter, a_, { 64,128,128 }, .f., .f., .f. )
+
+ /* Single Line Comments */
+ a_:= { "//[^\n]*" }
+ SetSyntaxAttrbs( qHiliter, a_, { 255, 0, 0 }, .f., .f., .f. )
+
+ qFormat := QTextCharFormat():new()
+ qFormat:setFontItalic( .t. )
+ qFormat:setForeGround( QBrush():new( "QColor", QColor():new( 190,190,190 ) ) )
+ qHiliter:setHBMultiLineCommentFormat( qFormat )
+
+ RETURN nil
/*----------------------------------------------------------------------*/
+
+STATIC FUNCTION SetSyntaxAttrbs( qHiliter, aRegExp, aRGB, lItalic, lBold, lUnderline )
+ LOCAL qStrList, qFormat
+
+ qStrList := QStringList():new()
+ aeval( aRegExp, {|e| qStrList:append( e ) } )
+
+ qFormat := QTextCharFormat():new()
+
+ IF hb_isLogical( lItalic )
+ qFormat:setFontItalic( lItalic )
+ ENDIF
+ IF hb_isLogical( lBold ) .and. lBold
+ qFormat:setFontWeight( 1000 )
+ ENDIF
+ IF hb_isLogical( lUnderline )
+ qFormat:setFontUnderline( lUnderline )
+ ENDIF
+ IF hb_isArray( aRGB )
+ qFormat:setForeGround( QBrush():new( "QColor", QColor():new( aRgb[ 1 ], aRgb[ 2 ], aRgb[ 3 ] ) ) )
+ ENDIF
+
+ qHiliter:setHBCompilerDirectives( qStrList, qFormat )
+
+ RETURN nil
+
+/*----------------------------------------------------------------------*/
+
diff --git a/harbour/contrib/hbide/iderequests.prg b/harbour/contrib/hbide/iderequests.prg
new file mode 100644
index 0000000000..b8aeaab979
--- /dev/null
+++ b/harbour/contrib/hbide/iderequests.prg
@@ -0,0 +1,248 @@
+/*
+ * $Id$
+ */
+
+/*
+ * Harbour Project source code:
+ *
+ * Copyright 2009 Pritpal Bedi
+ * www - http://www.harbour-project.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
+ *
+ * As a special exception, the Harbour Project gives permission for
+ * additional uses of the text contained in its release of Harbour.
+ *
+ * The exception is that, if you link the Harbour libraries with other
+ * files to produce an executable, this does not by itself cause the
+ * resulting executable to be covered by the GNU General Public License.
+ * Your use of that executable is in no way restricted on account of
+ * linking the Harbour library code into it.
+ *
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ *
+ * This exception applies only to the code released by the Harbour
+ * Project under the name Harbour. If you copy code from other
+ * Harbour Project or Free Software Foundation releases into a copy of
+ * Harbour, as the General Public License permits, the exception does
+ * not apply to the code that you add in this way. To avoid misleading
+ * anyone as to the status of such modified files, you must delete
+ * this exception notice from them.
+ *
+ * If you write modifications of your own for Harbour, it is your choice
+ * whether to permit this exception to apply to your modifications.
+ * If you do not wish that, delete this exception notice.
+ *
+ */
+/*----------------------------------------------------------------------*/
+/*----------------------------------------------------------------------*/
+/*----------------------------------------------------------------------*/
+/*
+ * EkOnkar
+ * ( The LORD is ONE )
+ *
+ * Harbour-Qt IDE
+ *
+ * Pritpal Bedi
+ * 30Nov2009
+ */
+/*----------------------------------------------------------------------*/
+/*----------------------------------------------------------------------*/
+/*----------------------------------------------------------------------*/
+
+FUNCTION RequestModules()
+
+ hbxbp_just( QAbstractButton():new() )
+ hbxbp_just( QAbstractItemModel():new() )
+ hbxbp_just( QAbstractItemView():new() )
+ hbxbp_just( QAbstractListModel():new() )
+ hbxbp_just( QAbstractPrintDialog():new() )
+ hbxbp_just( QAbstractScrollArea():new() )
+ hbxbp_just( QAbstractSlider():new() )
+ hbxbp_just( QAbstractSpinBox():new() )
+ hbxbp_just( QAbstractTableModel():new() )
+ hbxbp_just( QAction():new() )
+ hbxbp_just( QApplication():new() )
+ hbxbp_just( QBitmap():new() )
+ hbxbp_just( QBoxLayout():new() )
+ hbxbp_just( QBrush():new() )
+ hbxbp_just( QButtonGroup():new() )
+ hbxbp_just( QCalendarWidget():new() )
+ hbxbp_just( QCheckBox():new() )
+ hbxbp_just( QClipboard():new() )
+ hbxbp_just( QColor():new() )
+ hbxbp_just( QColorDialog():new() )
+ hbxbp_just( QComboBox():new() )
+ hbxbp_just( QCommandLinkButton():new() )
+ hbxbp_just( QCommonStyle():new() )
+ hbxbp_just( QConicalGradient():new() )
+ hbxbp_just( QCoreApplication():new() )
+ hbxbp_just( QCursor():new() )
+ hbxbp_just( QDateEdit():new() )
+ hbxbp_just( QDateTime():new() )
+ hbxbp_just( QDateTimeEdit():new() )
+ hbxbp_just( QDesktopWidget():new() )
+ hbxbp_just( QDial():new() )
+ hbxbp_just( QDialog():new() )
+ hbxbp_just( QDir():new() )
+ hbxbp_just( QDirModel():new() )
+ hbxbp_just( QDockWidget():new() )
+ hbxbp_just( QDoubleSpinBox():new() )
+ hbxbp_just( QDropEvent():new() )
+ hbxbp_just( QDragMoveEvent():new() )
+ hbxbp_just( QDragEnterEvent():new() )
+ hbxbp_just( QDragLeaveEvent():new() )
+ hbxbp_just( QErrorMessage():new() )
+ hbxbp_just( QEvent():new() )
+ hbxbp_just( QEventLoop():new() )
+ hbxbp_just( QFileDialog():new() )
+ hbxbp_just( QFileSystemModel():new() )
+ hbxbp_just( QFocusEvent():new() )
+ hbxbp_just( QFocusFrame():new() )
+ hbxbp_just( QFont():new() )
+ hbxbp_just( QFontComboBox():new() )
+ hbxbp_just( QFontDatabase():new() )
+ hbxbp_just( QFontDialog():new() )
+ hbxbp_just( QFontInfo():new() )
+ hbxbp_just( QFontMetrics():new() )
+ hbxbp_just( QFontMetricsF():new() )
+ hbxbp_just( QFormLayout():new() )
+ hbxbp_just( QFrame():new() )
+ hbxbp_just( QFtp():new() )
+ hbxbp_just( QGradient():new() )
+ hbxbp_just( QGridLayout():new() )
+ hbxbp_just( QGroupBox():new() )
+ hbxbp_just( QHBoxLayout():new() )
+ hbxbp_just( QHeaderView():new() )
+ hbxbp_just( QHttp():new() )
+ hbxbp_just( QIcon():new() )
+ hbxbp_just( QImage():new() )
+ hbxbp_just( QImageReader():new() )
+ hbxbp_just( QImageWriter():new() )
+ hbxbp_just( QInputDialog():new() )
+ hbxbp_just( QInputEvent():new() )
+ hbxbp_just( QIODevice():new() )
+ hbxbp_just( QKeyEvent():new() )
+ hbxbp_just( QKeySequence():new() )
+ hbxbp_just( QLabel():new() )
+ hbxbp_just( QLatin1Char():new() )
+ hbxbp_just( QLatin1String():new() )
+ hbxbp_just( QLayout():new() )
+ hbxbp_just( QLayoutItem():new() )
+ hbxbp_just( QLCDNumber():new() )
+ hbxbp_just( QLine():new() )
+ hbxbp_just( QLinearGradient():new() )
+ hbxbp_just( QLineEdit():new() )
+ hbxbp_just( QList():new() )
+ hbxbp_just( QListView():new() )
+ hbxbp_just( QListWidget():new() )
+ hbxbp_just( QListWidgetItem():new() )
+ hbxbp_just( QMainWindow():new() )
+ hbxbp_just( QMenu():new() )
+ hbxbp_just( QMenuBar():new() )
+ hbxbp_just( QMessageBox():new() )
+ hbxbp_just( QModelIndex():new() )
+ hbxbp_just( QMouseEvent():new() )
+ hbxbp_just( QMoveEvent():new() )
+ hbxbp_just( QObject():new() )
+ hbxbp_just( QPaintDevice():new() )
+ hbxbp_just( QPageSetupDialog():new() )
+ hbxbp_just( QPainter():new() )
+ hbxbp_just( QPaintEvent():new() )
+ hbxbp_just( QPalette():new() )
+ hbxbp_just( QPen():new() )
+ hbxbp_just( QPicture():new() )
+ hbxbp_just( QPixmap():new() )
+ hbxbp_just( QPoint():new() )
+ hbxbp_just( QPointF():new() )
+ hbxbp_just( QPrintDialog():new() )
+ hbxbp_just( QPrintEngine():new() )
+ hbxbp_just( QPrinter():new() )
+ hbxbp_just( QPrintPreviewDialog():new() )
+ hbxbp_just( QProcess():new() )
+ hbxbp_just( QProgressBar():new() )
+ hbxbp_just( QProgressDialog():new() )
+ hbxbp_just( QPushButton():new() )
+ hbxbp_just( QRadialGradient():new() )
+ hbxbp_just( QRadioButton():new() )
+ hbxbp_just( QRect():new() )
+ hbxbp_just( QRectF():new() )
+ hbxbp_just( QRegion():new() )
+ hbxbp_just( QResizeEvent():new() )
+ hbxbp_just( QResource():new() )
+ hbxbp_just( QScrollArea():new() )
+ hbxbp_just( QScrollBar():new() )
+ hbxbp_just( QSignalMapper():new() )
+ hbxbp_just( QSize():new() )
+ hbxbp_just( QSizeF():new() )
+ hbxbp_just( QSizeGrip():new() )
+ hbxbp_just( QSizePolicy():new() )
+ hbxbp_just( QSlider():new() )
+ hbxbp_just( QSound():new() )
+ hbxbp_just( QSpinBox():new() )
+ hbxbp_just( QSplashScreen():new() )
+ hbxbp_just( QSplitter():new() )
+ hbxbp_just( QStandardItem():new() )
+ hbxbp_just( QStandardItemModel():new() )
+ hbxbp_just( QStatusBar():new() )
+ hbxbp_just( QStringList():new() )
+ hbxbp_just( QStringListModel():new() )
+ hbxbp_just( QSystemTrayIcon():new() )
+ hbxbp_just( QTabBar():new() )
+ hbxbp_just( QTableView():new() )
+ hbxbp_just( QTableWidget():new() )
+ hbxbp_just( QTableWidgetItem():new() )
+ hbxbp_just( QTabWidget():new() )
+ hbxbp_just( QTextBlock():new() )
+ hbxbp_just( QTextBlockFormat():new() )
+ hbxbp_just( QTextBlockGroup():new() )
+ hbxbp_just( QTextBrowser():new() )
+ hbxbp_just( QTextBoundaryFinder():new() )
+ hbxbp_just( QTextCharFormat():new() )
+ hbxbp_just( QTextCodec():new() )
+ hbxbp_just( QTextCursor():new() )
+ hbxbp_just( QTextDecoder():new() )
+ hbxbp_just( QTextDocument():new() )
+ hbxbp_just( QTextDocumentFragment():new() )
+ hbxbp_just( QTextDocumentWriter():new() )
+ hbxbp_just( QTextEdit():new() )
+ hbxbp_just( QTextFrame():new() )
+ hbxbp_just( QTextItem():new() )
+ hbxbp_just( QTextLayout():new() )
+ hbxbp_just( QTextLength():new() )
+ hbxbp_just( QTextLine():new() )
+ hbxbp_just( QTextObject():new() )
+ hbxbp_just( QTextStream():new() )
+ hbxbp_just( QTimeEdit():new() )
+ hbxbp_just( QTimer():new() )
+ hbxbp_just( QToolBar():new() )
+ hbxbp_just( QToolBox():new() )
+ hbxbp_just( QToolButton():new() )
+ hbxbp_just( QTreeView():new() )
+ hbxbp_just( QTreeWidget():new() )
+ hbxbp_just( QTreeWidgetItem():new() )
+ hbxbp_just( QUrl():new() )
+ hbxbp_just( QVariant():new() )
+ hbxbp_just( QVBoxLayout():new() )
+ hbxbp_just( QWheelEvent():new() )
+ hbxbp_just( QWidget():new() )
+ hbxbp_just( QWidgetItem():new() )
+
+ RETURN NIL
+
+/*----------------------------------------------------------------------*/
+
diff --git a/harbour/contrib/hbide/idestylesheets.prg b/harbour/contrib/hbide/idestylesheets.prg
index ba4e94a9f9..51288ba87f 100644
--- a/harbour/contrib/hbide/idestylesheets.prg
+++ b/harbour/contrib/hbide/idestylesheets.prg
@@ -246,18 +246,18 @@ FUNCTION GetStyleSheet( cWidget )
aadd( txt_, ' left: 5px; /* move to the right by 5px */ ' )
aadd( txt_, '} ' )
aadd( txt_, 'QTabBar { ' )
- aadd( txt_, ' background: qlineargradient(x1:0, y1:1, x2:0, y2:0, ' )
+ aadd( txt_, ' background-color: qlineargradient(x1:0, y1:1, x2:0, y2:0, ' )
aadd( txt_, ' stop:0 lightgray, stop:1 darkgray); ' )
aadd( txt_, '} ' )
aadd( txt_, 'QTabBar::tab { ' )
aadd( txt_, ' background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, ' )
aadd( txt_, ' stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, ' )
aadd( txt_, ' stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); ' )
- aadd( txt_, ' border: 2px solid #C4C4C3; ' )
+ aadd( txt_, ' border: 2px solid #94C4C3; ' )
aadd( txt_, ' border-bottom-color: #C2C7CB; /* same as the pane color */ ' )
- aadd( txt_, ' border-top-left-radius: 4px; ' )
- aadd( txt_, ' border-top-right-radius: 4px; ' )
- aadd( txt_, ' min-width: 8ex; ' )
+ aadd( txt_, ' border-top-left-radius: 6px; ' )
+ aadd( txt_, ' border-top-right-radius: 6px; ' )
+ aadd( txt_, ' min-width: 8px; ' )
aadd( txt_, ' padding: 2px; ' )
aadd( txt_, '} ' )
aadd( txt_, ' QTabBar::tab:selected { ' )
@@ -265,16 +265,29 @@ FUNCTION GetStyleSheet( cWidget )
aadd( txt_, ' stop: 0 #fafafa, stop: 0.4 #f4f4f4, ' )
aadd( txt_, ' stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); ' )
aadd( txt_, ' } ' )
+ aadd( txt_, ' QTabBar::tab:selected:hover { ' )
+ aadd( txt_, ' background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, ' )
+ aadd( txt_, ' stop: 0 #fafafa, stop: 0.4 #f4f4f4, ' )
+ aadd( txt_, ' stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); ' )
+ aadd( txt_, ' background: yellow; ' )
+ aadd( txt_, ' } ' )
aadd( txt_, ' QTabBar::tab:hover { ' )
aadd( txt_, ' background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, ' )
aadd( txt_, ' stop: 0 yellow, stop: 0.4 #f4f4f4, ' )
- aadd( txt_, ' stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); ' )
+ aadd( txt_, ' stop: 0.5 #e7e7e7, stop: 1.0 orange); ' )
aadd( txt_, ' } ' )
aadd( txt_, ' QTabBar::tab:selected { ' )
- aadd( txt_, ' border-color: #9B9B9B; ' )
+ aadd( txt_, ' border-color: /#9B9B9B; ' )
aadd( txt_, ' border-bottom-color: #C2C7CB; /* same as pane color */ ' )
aadd( txt_, ' } ' )
+ CASE cWidget == "QPlainTextEdit"
+
+ aadd( txt_, ' QPlainTextEdit { ' )
+ aadd( txt_, ' background: qlineargradient(x1:0, y1:0, x2:0, y2:1, ' )
+ aadd( txt_, ' stop:0 white, stop:1 lightblue); ' )
+ aadd( txt_, ' } ' )
+
ENDCASE
aeval( txt_, {|e| s += trim( e ) + chr( 13 ) + chr( 10 ) } )
diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h
index b5ee570b8b..86a9cd8e4f 100644
--- a/harbour/contrib/hbqt/hbqt.h
+++ b/harbour/contrib/hbqt/hbqt.h
@@ -384,6 +384,7 @@ extern void * hbqt_pPtrFromObj( int iParam );
#define hbqt_par_HBDbfModel( n ) ( ( HBDbfModel * ) hbqt_gcpointer( n ) )
#define hbqt_par_HBQMainWindow( n ) ( ( HBQMainWindow * ) hbqt_gcpointer( n ) )
#define hbqt_par_HBQTableView( n ) ( ( HBQTableView * ) hbqt_gcpointer( n ) )
+#define hbqt_par_HBQSyntaxHighlighter( n ) ( ( HBQSyntaxHighlighter * ) hbqt_gcpointer( n ) )
#define hbqt_par_QString( n ) ( ( QString ) hb_parcx( n ) )
#define hbqt_par_QRgb( n ) ( hb_parnint( n ) )
diff --git a/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp b/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp
index 7e0604d069..f00a24d148 100644
--- a/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp
+++ b/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp
@@ -6,8 +6,6 @@
* Harbour Project source code:
* QT wrapper main header
*
- * Copyright 2009 Marcos Antonio Gambeta
- *
* Copyright 2009 Pritpal Bedi
* www - http://www.harbour-project.org
*
@@ -61,6 +59,7 @@
#include "hbqt_hbqsyntaxhighlighter.h"
+#include
#include
#include
@@ -82,10 +81,11 @@ HBQSyntaxHighlighter::HBQSyntaxHighlighter( QTextDocument *parent )
<< "\\btemplate\\b" << "\\btypedef\\b" << "\\btypename\\b"
<< "\\bunion\\b" << "\\bunsigned\\b" << "\\bvirtual\\b"
<< "\\bvoid\\b" << "\\bvolatile\\b";
- foreach ( const QString &pattern, keywordPatterns ) {
- rule.pattern = QRegExp( pattern );
- rule.format = keywordFormat;
- highlightingRules.append( rule );
+ foreach ( const QString &pattern, keywordPatterns )
+ {
+ rule.pattern = QRegExp( pattern );
+ rule.format = keywordFormat;
+ highlightingRules.append( rule );
}
classFormat.setFontWeight( QFont::Bold );
@@ -94,58 +94,176 @@ HBQSyntaxHighlighter::HBQSyntaxHighlighter( QTextDocument *parent )
rule.format = classFormat;
highlightingRules.append( rule );
- singleLineCommentFormat.setForeground( Qt::red );
- rule.pattern = QRegExp( "//[^\n]*" );
- rule.format = singleLineCommentFormat;
- highlightingRules.append( rule );
-
multiLineCommentFormat.setForeground( Qt::red );
- quotationFormat.setForeground( Qt::darkGreen );
- rule.pattern = QRegExp( "\".*\"" );
- rule.format = quotationFormat;
- highlightingRules.append( rule );
-
- functionFormat.setFontItalic( true );
- functionFormat.setForeground( Qt::blue );
- rule.pattern = QRegExp( "\\b[A-Za-z0-9_]+(?=\\()" );
- rule.format = functionFormat;
- highlightingRules.append( rule );
-
commentStartExpression = QRegExp("/\\*");
commentEndExpression = QRegExp("\\*/");
}
+void HBQSyntaxHighlighter::setHBCompilerDirectives( const QStringList & directives, const QTextCharFormat & format )
+{
+ HighlightingRule rule;
+
+ directivesFormat = format;
+ foreach ( const QString &pattern, directives )
+ {
+ rule.pattern = QRegExp( pattern );
+ rule.format = directivesFormat;
+ highlightingRules.append( rule );
+ }
+}
+
+void HBQSyntaxHighlighter::setHBMultiLineCommentFormat( const QTextCharFormat & format )
+{
+ multiLineCommentFormat = format;
+}
+
void HBQSyntaxHighlighter::highlightBlock( const QString &text )
{
- foreach ( const HighlightingRule &rule, highlightingRules ) {
- QRegExp expression( rule.pattern );
- int index = expression.indexIn( text );
- while ( index >= 0 ) {
+ int index( 0 );
+ QRegExp expression;
+
+ foreach ( const HighlightingRule &rule, highlightingRules )
+ {
+ expression = QRegExp( rule.pattern );
+ index = expression.indexIn( text );
+ while ( index >= 0 )
+ {
int length = expression.matchedLength();
setFormat( index, length, rule.format );
index = expression.indexIn( text, index + length );
}
}
+
setCurrentBlockState( 0 );
int startIndex = 0;
if ( previousBlockState() != 1 )
startIndex = commentStartExpression.indexIn( text );
- while ( startIndex >= 0 ) {
+ while ( startIndex >= 0 )
+ {
int endIndex = commentEndExpression.indexIn( text, startIndex );
int commentLength;
- if ( endIndex == -1 ) {
- setCurrentBlockState( 1 );
- commentLength = text.length() - startIndex;
- } else {
- commentLength = endIndex - startIndex
- + commentEndExpression.matchedLength();
+ if ( endIndex == -1 )
+ {
+ setCurrentBlockState( 1 );
+ commentLength = text.length() - startIndex;
+ }
+ else
+ {
+ commentLength = endIndex - startIndex + commentEndExpression.matchedLength();
}
setFormat( startIndex, commentLength, multiLineCommentFormat );
startIndex = commentStartExpression.indexIn( text, startIndex + commentLength );
}
}
+typedef struct
+{
+ void * ph;
+ QT_G_FUNC_PTR func;
+ QPointer< HBQSyntaxHighlighter > pq;
+} QGC_POINTER_HBQSyntaxHighlighter;
+
+QT_G_FUNC( release_HBQSyntaxHighlighter )
+{
+ QGC_POINTER_HBQSyntaxHighlighter * p = ( QGC_POINTER_HBQSyntaxHighlighter * ) Cargo;
+
+ HB_TRACE( HB_TR_DEBUG, ( "release_HBQSyntaxHighlighter p=%p", p));
+ HB_TRACE( HB_TR_DEBUG, ( "release_HBQSyntaxHighlighter ph=%p pq=%p", p->ph, (void *)(p->pq)));
+
+ if( p && p->ph && p->pq )
+ {
+ const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject();
+ if( ( QString ) m->className() != ( QString ) "QObject" )
+ {
+ switch( hbqt_get_object_release_method() )
+ {
+ case HBQT_RELEASE_WITH_DELETE:
+ delete ( ( HBQSyntaxHighlighter * ) p->ph );
+ break;
+ case HBQT_RELEASE_WITH_DESTRUTOR:
+ ( ( HBQSyntaxHighlighter * ) p->ph )->~HBQSyntaxHighlighter();
+ break;
+ case HBQT_RELEASE_WITH_DELETE_LATER:
+ ( ( HBQSyntaxHighlighter * ) p->ph )->deleteLater();
+ break;
+ }
+ p->ph = NULL;
+ HB_TRACE( HB_TR_DEBUG, ( "release_HBQSyntaxHighlighter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
+ }
+ else
+ {
+ HB_TRACE( HB_TR_DEBUG, ( "NO release_HBQSyntaxHighlighter Object Name Missing!" ) );
+ }
+ }
+ else
+ {
+ HB_TRACE( HB_TR_DEBUG, ( "DEL release_HBQSyntaxHighlighter Object Already deleted!" ) );
+ }
+}
+
+void * hbqt_gcAllocate_HBQSyntaxHighlighter( void * pObj )
+{
+ QGC_POINTER_HBQSyntaxHighlighter * p = ( QGC_POINTER_HBQSyntaxHighlighter * ) hb_gcAllocate( sizeof( QGC_POINTER_HBQSyntaxHighlighter ), hbqt_gcFuncs() );
+
+ p->ph = pObj;
+ p->func = release_HBQSyntaxHighlighter;
+ new( & p->pq ) QPointer< HBQSyntaxHighlighter >( ( HBQSyntaxHighlighter * ) pObj );
+ HB_TRACE( HB_TR_DEBUG, ( " new_HBQSyntaxHighlighter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
+ return( p );
+}
+
+HB_FUNC( QT_HBQSYNTAXHIGHLIGHTER )
+{
+ void * pObj = NULL;
+
+ if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) )
+ {
+ pObj = new HBQSyntaxHighlighter( hbqt_par_QTextDocument( 1 ) ) ;
+ }
+
+ hb_retptrGC( hbqt_gcAllocate_HBQSyntaxHighlighter( pObj ) );
+}
+/*
+ * QTextDocument * document () const
+ */
+HB_FUNC( QT_HBQSYNTAXHIGHLIGHTER_DOCUMENT )
+{
+ hb_retptr( ( QTextDocument* ) hbqt_par_HBQSyntaxHighlighter( 1 )->document() );
+}
+
+/*
+ * void setDocument ( QTextDocument * doc )
+ */
+HB_FUNC( QT_HBQSYNTAXHIGHLIGHTER_SETDOCUMENT )
+{
+ hbqt_par_HBQSyntaxHighlighter( 1 )->setDocument( hbqt_par_QTextDocument( 2 ) );
+}
+
+/*
+ * void rehighlight ()
+ */
+HB_FUNC( QT_HBQSYNTAXHIGHLIGHTER_REHIGHLIGHT )
+{
+ hbqt_par_HBQSyntaxHighlighter( 1 )->rehighlight();
+}
+
+/*
+ * void setHBCompilerDirectives( const QStringList & directives, const QTextCharFormat & format )
+ */
+HB_FUNC( QT_HBQSYNTAXHIGHLIGHTER_SETHBCOMPILERDIRECTIVES )
+{
+ hbqt_par_HBQSyntaxHighlighter( 1 )->setHBCompilerDirectives( *hbqt_par_QStringList( 2 ), *hbqt_par_QTextCharFormat( 3 ) );
+}
+
+/*
+ * void setHBCompilerDirectives( const QStringList & directives, const QTextCharFormat & format )
+ */
+HB_FUNC( QT_HBQSYNTAXHIGHLIGHTER_SETHBMULTILINECOMMENTFORMAT )
+{
+ hbqt_par_HBQSyntaxHighlighter( 1 )->setHBMultiLineCommentFormat( *hbqt_par_QTextCharFormat( 2 ) );
+}
+
#endif
diff --git a/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.h b/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.h
index c2ec7a01a3..2d9cb5e3eb 100644
--- a/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.h
+++ b/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.h
@@ -6,8 +6,6 @@
* Harbour Project source code:
* QT wrapper main header
*
- * Copyright 2009 Marcos Antonio Gambeta
- *
* Copyright 2009 Pritpal Bedi
* www - http://www.harbour-project.org
*
@@ -68,6 +66,9 @@ class HBQSyntaxHighlighter : public QSyntaxHighlighter
public:
HBQSyntaxHighlighter( QTextDocument *parent = 0 );
+ void setHBCompilerDirectives( const QStringList & directives, const QTextCharFormat & format );
+ void setHBMultiLineCommentFormat( const QTextCharFormat & format );
+
protected:
void highlightBlock( const QString &text );
@@ -88,8 +89,45 @@ private:
QTextCharFormat multiLineCommentFormat;
QTextCharFormat quotationFormat;
QTextCharFormat functionFormat;
+ QTextCharFormat directivesFormat;
};
/*----------------------------------------------------------------------*/
+/*
+class Highlighter : public QSyntaxHighlighter
+{ Q_OBJECT
+ public:
+ Highlighter(QTextDocument *parent = 0);
+ void SetRule(QString name,QString pattern,QTextCharFormat format);
+
+ protected:
+ void highlightBlock(const QString &text);
+ struct HighlightingRule
+ {
+ HighlightingRule() {}
+ HighlightingRule(QRegExp _pattern,QTextCharFormat _format) {pattern = _pattern;format = _format;}
+ QRegExp pattern;
+ QTextCharFormat format;
+ };
+ QMap highlightingRules;
+};
+
+class MultiLineCommentHighlighter : public Highlighter
+{ Q_OBJECT
+ public:
+ MultiLineCommentHighlighter(QTextDocument *parent = 0);
+ protected:
+ void highlightBlock(const QString &text);
+ QRegExp commentStartExpression;
+ QRegExp commentEndExpression;
+ QTextCharFormat multiLineCommentFormat;
+};
+
+class CppHighlighter : public MultiLineCommentHighlighter
+{ Q_OBJECT
+ public:
+ CppHighlighter(QTextDocument *parent = 0);
+}; l
+*/
#endif
diff --git a/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp b/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp
index 05217262af..62bc5e8b12 100644
--- a/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp
+++ b/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp
@@ -85,12 +85,12 @@ typedef struct
QPointer< QSyntaxHighlighter > pq;
} QGC_POINTER_QSyntaxHighlighter;
-QT_G_FUNC( hbqt_gcRelease_QSyntaxHighlighter )
+QT_G_FUNC( release_QSyntaxHighlighter )
{
QGC_POINTER_QSyntaxHighlighter * p = ( QGC_POINTER_QSyntaxHighlighter * ) Cargo;
- HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSyntaxHighlighter p=%p", p));
- HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSyntaxHighlighter ph=%p pq=%p", p->ph, (void *)(p->pq)));
+ HB_TRACE( HB_TR_DEBUG, ( "release_QSyntaxHighlighter p=%p", p));
+ HB_TRACE( HB_TR_DEBUG, ( "release_QSyntaxHighlighter ph=%p pq=%p", p->ph, (void *)(p->pq)));
if( p && p->ph && p->pq )
{
@@ -110,16 +110,16 @@ QT_G_FUNC( hbqt_gcRelease_QSyntaxHighlighter )
break;
}
p->ph = NULL;
- HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSyntaxHighlighter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
+ HB_TRACE( HB_TR_DEBUG, ( "release_QSyntaxHighlighter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
}
else
{
- HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSyntaxHighlighter Object Name Missing!" ) );
+ HB_TRACE( HB_TR_DEBUG, ( "NO release_QSyntaxHighlighter Object Name Missing!" ) );
}
}
else
{
- HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSyntaxHighlighter Object Already deleted!" ) );
+ HB_TRACE( HB_TR_DEBUG, ( "DEL release_QSyntaxHighlighter Object Already deleted!" ) );
}
}
@@ -128,7 +128,7 @@ void * hbqt_gcAllocate_QSyntaxHighlighter( void * pObj )
QGC_POINTER_QSyntaxHighlighter * p = ( QGC_POINTER_QSyntaxHighlighter * ) hb_gcAllocate( sizeof( QGC_POINTER_QSyntaxHighlighter ), hbqt_gcFuncs() );
p->ph = pObj;
- p->func = hbqt_gcRelease_QSyntaxHighlighter;
+ p->func = release_QSyntaxHighlighter;
new( & p->pq ) QPointer< QSyntaxHighlighter >( ( QSyntaxHighlighter * ) pObj );
HB_TRACE( HB_TR_DEBUG, ( " new_QSyntaxHighlighter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
return( p );
diff --git a/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg b/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg
index 9841bd4daf..56fbceb55d 100644
--- a/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg
+++ b/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg
@@ -63,9 +63,12 @@
#include "hbclass.ch"
-CREATE CLASS QSyntaxHighlighter INHERIT HbQtObjectHandler, QObject
+CREATE CLASS QSyntaxHighlighter INHERIT QObject
+
+ VAR pPtr
METHOD new()
+ METHOD configure( xObject )
METHOD document()
METHOD setDocument( pDoc )
@@ -73,6 +76,7 @@ CREATE CLASS QSyntaxHighlighter INHERIT HbQtObjectHandler, QObject
ENDCLASS
+/*----------------------------------------------------------------------*/
METHOD QSyntaxHighlighter:new( ... )
LOCAL p
@@ -84,6 +88,15 @@ METHOD QSyntaxHighlighter:new( ... )
RETURN Self
+METHOD QSyntaxHighlighter:configure( xObject )
+ IF hb_isObject( xObject )
+ ::pPtr := xObject:pPtr
+ ELSEIF hb_isPointer( xObject )
+ ::pPtr := xObject
+ ENDIF
+ RETURN Self
+
+
METHOD QSyntaxHighlighter:document()
RETURN Qt_QSyntaxHighlighter_document( ::pPtr )
@@ -95,3 +108,42 @@ METHOD QSyntaxHighlighter:setDocument( pDoc )
METHOD QSyntaxHighlighter:rehighlight()
RETURN Qt_QSyntaxHighlighter_rehighlight( ::pPtr )
+
+
+
+CREATE CLASS HBQSyntaxHighlighter INHERIT QSyntaxHighlighter
+
+ METHOD new()
+ METHOD configure( xObject )
+ METHOD setHBCompilerDirectives( pDirectives, pFormat, pFont )
+ METHOD setHBMultiLineCommentFormat( pFormat )
+
+ ENDCLASS
+
+METHOD HBQSyntaxHighlighter:new( ... )
+ LOCAL p
+ FOR EACH p IN { ... }
+ p := hbqt_ptr( p )
+ hb_pvalue( p:__enumIndex(), p )
+ NEXT
+ ::pPtr := Qt_QSyntaxHighlighter( ... )
+ RETURN Self
+
+
+METHOD HBQSyntaxHighlighter:configure( xObject )
+ IF hb_isObject( xObject )
+ ::pPtr := xObject:pPtr
+ ELSEIF hb_isPointer( xObject )
+ ::pPtr := xObject
+ ENDIF
+ RETURN Self
+
+
+METHOD HBQSyntaxHighlighter:setHBCompilerDirectives( pDirectives, pFormat )
+ RETURN Qt_HBQSyntaxHighlighter_setHBCompilerDirectives( ::pPtr, hbqt_ptr( pDirectives ), hbqt_ptr( pFormat ) )
+
+
+METHOD HBQSyntaxHighlighter:setHBMultiLineCommentFormat( pFormat )
+ RETURN Qt_HBQSyntaxHighlighter_setHBMultiLineCommentFormat( ::pPtr, hbqt_ptr( pFormat ) )
+
+
diff --git a/harbour/contrib/hbqt/qth/QSyntaxHighlighter.qth b/harbour/contrib/hbqt/qth/QSyntaxHighlighter.qth
index b4be24f5cf..56e1dee78b 100644
--- a/harbour/contrib/hbqt/qth/QSyntaxHighlighter.qth
+++ b/harbour/contrib/hbqt/qth/QSyntaxHighlighter.qth
@@ -62,6 +62,42 @@ New =
+
+CREATE CLASS HBQSyntaxHighlighter INHERIT QSyntaxHighlighter
+
+ METHOD new()
+ METHOD configure( xObject )
+ METHOD setHBCompilerDirectives( pDirectives, pFormat, pFont )
+ METHOD setHBMultiLineCommentFormat( pFormat )
+
+ ENDCLASS
+
+METHOD HBQSyntaxHighlighter:new( ... )
+ LOCAL p
+ FOR EACH p IN { ... }
+ p := hbqt_ptr( p )
+ hb_pvalue( p:__enumIndex(), p )
+ NEXT
+ ::pPtr := Qt_QSyntaxHighlighter( ... )
+ RETURN Self
+
+
+METHOD HBQSyntaxHighlighter:configure( xObject )
+ IF hb_isObject( xObject )
+ ::pPtr := xObject:pPtr
+ ELSEIF hb_isPointer( xObject )
+ ::pPtr := xObject
+ ENDIF
+ RETURN Self
+
+
+METHOD HBQSyntaxHighlighter:setHBCompilerDirectives( pDirectives, pFormat )
+ RETURN Qt_HBQSyntaxHighlighter_setHBCompilerDirectives( ::pPtr, hbqt_ptr( pDirectives ), hbqt_ptr( pFormat ) )
+
+
+METHOD HBQSyntaxHighlighter:setHBMultiLineCommentFormat( pFormat )
+ RETURN Qt_HBQSyntaxHighlighter_setHBMultiLineCommentFormat( ::pPtr, hbqt_ptr( pFormat ) )
+