diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7ddedf39a5..83282d9d2e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,84 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-17 02:29 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + + contrib/hbide + + contrib/hbide/hbide.prg + + contrib/hbide/hbmk.hbm + + contrib/hbide/resources + + contrib/hbide/resources/build.png + + contrib/hbide/resources/buildlaunch.png + + contrib/hbide/resources/buildrun.png + + contrib/hbide/resources/close.png + + contrib/hbide/resources/column.png + + contrib/hbide/resources/compile.png + + contrib/hbide/resources/copy.png + + contrib/hbide/resources/cut.png + + contrib/hbide/resources/debug.png + + contrib/hbide/resources/envconfig.png + + contrib/hbide/resources/exit.png + + contrib/hbide/resources/filec.png + + contrib/hbide/resources/fileprg.png + + contrib/hbide/resources/find.png + + contrib/hbide/resources/gotoline.png + + contrib/hbide/resources/gotomark.png + + contrib/hbide/resources/info.png + + contrib/hbide/resources/invertcase.png + + contrib/hbide/resources/launch.png + + contrib/hbide/resources/lense.png + + contrib/hbide/resources/matchobj.png + + contrib/hbide/resources/new.png + + contrib/hbide/resources/notepad.png + + contrib/hbide/resources/open.png + + contrib/hbide/resources/paste.png + + contrib/hbide/resources/placeremovemark.png + + contrib/hbide/resources/ppo.png + + contrib/hbide/resources/print.png + + contrib/hbide/resources/properties.png + + contrib/hbide/resources/rebuild.png + + contrib/hbide/resources/rebuildlaunch.png + + contrib/hbide/resources/redo.png + + contrib/hbide/resources/save.png + + contrib/hbide/resources/search.png + + contrib/hbide/resources/selectall.png + + contrib/hbide/resources/stream.png + + contrib/hbide/resources/text.png + + contrib/hbide/resources/tolower.png + + contrib/hbide/resources/tools.png + + contrib/hbide/resources/toupper.png + + contrib/hbide/resources/trashpage.png + + contrib/hbide/resources/undo.png + + contrib/hbide/resources/vr.png + + * contrib/hbqt/generator/qt45.qtp + + + contrib/hbqt/qth/QSyntaxHighlighter.qth + * + * contrib/hbqt/hbqt.ch + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_slots.cpp + * contrib/hbqt/hbqt_slots.h + * contrib/hbqt/moc_slots.cpp + + * contrib/hbqt/qtgui/filelist.mk + + contrib/hbqt/qtgui/QSyntaxHighlighter.cpp + + contrib/hbqt/qtgui/TQSyntaxHighlighter.prg + + * contrib/hbxbp/xbpmenubar.prg + * contrib/hbxbp/xbptoolbar.prg + + * contrib/hbxbp/tests/demoxbp.prg + + + Added first commit of HBIDE, just something in the making. + + NOTE: I have extracted icons from xMate.exe ( with due apology to Andy ) + to give it a familiar look and feel of xMate because of wide + acceptance of its user interface. + + EXECUTE HbIde.exe hbide.prg ( or any .c or .prg file name ) + + Suggestions are welcome. + 2009-11-17 10:32 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/errapi.c * src/rtl/philes.c diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg new file mode 100644 index 0000000000..dee6e9c81e --- /dev/null +++ b/harbour/contrib/hbide/hbide.prg @@ -0,0 +1,405 @@ +/* + * $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. + * + */ +/*----------------------------------------------------------------------*/ + +#include "common.ch" +#include "xbp.ch" +#include "appevent.ch" +#include "inkey.ch" +#include "gra.ch" +#include "set.ch" +#include "hbclass.ch" + +#ifdef __HARBOUR__ + #define UNU( x ) HB_SYMBOL_UNUSED( x ) +#else + #define UNU( x ) ( x := x ) +#endif + +/*----------------------------------------------------------------------*/ + +#define TAB_1 1 +#define TAB_2 2 +#define TAB_3 3 +#define TAB_4 4 +#define TAB_5 5 +#define TAB_6 6 +#define TAB_7 7 +#define TAB_8 8 + +#define CRLF chr( 13 )+chr( 10 ) + +STATIC s_resPath + +/*----------------------------------------------------------------------*/ + +PROCEDURE Main( cProjectOrSource ) + LOCAL oIde + + s_resPath := hb_DirBase() + "resources" + hb_OsPathSeparator() + + oIde := HbIde():new( cProjectOrSource ) + oIde:create() + oIde:destroy() + + RETURN + +/*----------------------------------------------------------------------*/ + +PROCEDURE AppSys() + RETURN + +/*----------------------------------------------------------------------*/ + +CLASS HbIde + + DATA oDlg + DATA mp1, mp2, oXbp, nEvent + DATA oDa + DATA oSBar + DATA oMenu + DATA oTBar + DATA aTabs INIT {} + DATA cProjFile + + DATA nCurTab INIT 0 + DATA nPrevTab INIT 0 + + DATA qLayout + DATA oFont + + METHOD new( cProjectOrSource ) + METHOD create( cProjectOrSource ) + METHOD destroy() + + METHOD buildDialog() + METHOD buildMenu() + METHOD buildStatusBar() + METHOD buildToolbar() + METHOD manageToolBar() + METHOD manageMenu() + METHOD editSource() + METHOD buildTabPage() + #if 0 + METHOD () + METHOD () + METHOD () + #endif + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:destroy() + ::oSBar := NIL + ::oMenu := NIL + ::oTBar := NIL + RETURN self + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:new( cProjectOrSource ) + + ::cProjFile := cProjectOrSource + + RETURN self + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:create( cProjectOrSource ) + LOCAL aSize + + IF hb_isChar( cProjectOrSource ) + ::cProjFile := cProjectOrSource + ENDIF + + /* Create Application Window */ + ::BuildDialog() + + /* In this block just ceck if any of the documents are edited and are not saved */ + ::oDlg:close := {|| MsgBox( "You can also close me by pressing [ESC]" ), .T. } + + SetAppWindow( ::oDlg ) + ::oDlg:Show() + + ::oDa := ::oDlg:drawingArea + + ::oDa:oTabWidget := XbpTabWidget():new( ::oDa, , ::oDa:aPos, ::oDa:aSize, , .t. ):create() + ::oDa:oTabWidget:oWidget:setTabsClosable( .t. ) + + ::qLayout := QBoxLayout():new() + ::qLayout:setDirection( 0 ) + ::qLayout:setContentsMargins( 0,0,0,0 ) + + ::qLayout:addWidget( QT_PTROFXBP( ::oDa:oTabWidget ) ) + + ::oDa:oWidget:setLayout( QT_PTROF( ::qLayout ) ) + + /* Obtain desktop dimensions */ + aSize := AppDesktop():currentSize() + /* Place on the center of desktop */ + ::oDlg:setPos( { ( aSize[ 1 ] - ::oDlg:currentSize()[ 1 ] ) / 2, ; + ( aSize[ 2 ] - ::oDlg:currentSize()[ 2 ] ) / 2 } ) + + /* Editor's Font */ + ::oFont := XbpFont():new() + ::oFont:fixed := .t. + ::oFont:create( "10.Courier" ) + + /* Install menu system */ + ::buildMenu() + + /* Install Statusbar */ + ::buildStatusBar() + + /* Install Toolbar */ + ::buildToolBar() + + ::editSource() + + ::oDlg:Show() + + /* Enter Xbase++ Event Loop - working */ + DO WHILE .t. + ::nEvent := AppEvent( @::mp1, @::mp2, @::oXbp ) + IF ( ::nEvent == xbeP_Close ) .OR. ( ::nEvent == xbeP_Keyboard .and. ::mp1 == xbeK_ESC ) + EXIT + ENDIF + ::oXbp:handleEvent( ::nEvent, ::mp1, ::mp2 ) + ENDDO + + /* Very important - destroy resources */ + ::oDlg:destroy() + + RETURN self + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:buildDialog() + + ::oDlg := XbpDialog():new( , , {10,10}, {900,500}, , .f. ) + + ::oDlg:icon := s_resPath + "vr.png" //"hbide.ico" + ::oDlg:title := "Harbour-Qt IDE" + + ::oDlg:create() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:buildTabPage( oWnd, cSource ) + LOCAL aPos := { 5,5 } + LOCAL aSize := { 890, 420 } + LOCAL oTab + LOCAL cPath, cFile, cExt//, qIcon + LOCAL nIndex := len( ::aTabs ) + + DEFAULT cSource TO "Untitled" + + hb_fNameSplit( cSource, @cPath, @cFile, @cExt ) + + oTab := XbpTabPage():new( oWnd, , aPos, aSize, , .t. ) + oTab:caption := cFile + cExt + oTab:minimized := .F. + + oTab:create() + + IF lower( cExt ) $ ".c;.cpp" + ::oDa:oTabWidget:oWidget:setTabIcon( nIndex, s_resPath + "filec.png" ) + ELSE + ::oDa:oTabWidget:oWidget:setTabIcon( nIndex, s_resPath + "fileprg.png" ) + ENDIF + ::oDa:oTabWidget:oWidget:setTabTooltip( nIndex, cSource ) + + RETURN oTab + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:editSource( cSourceFile ) + LOCAL oTab, qEdit, qHiliter, qLayout + + DEFAULT cSourceFile TO ::cProjFile + + oTab := ::buildTabPage( ::oDa, cSourceFile ) + + qEdit := QTextEdit():new( QT_PTROFXBP( oTab ) ) + qEdit:setLineWrapMode( QTextEdit_NoWrap ) + qEdit:setPlainText( memoread( ::cProjFile ) ) + qEdit:setFont( QT_PTROFXBP( ::oFont ) ) + qEdit:setTextBackgroundColor( QT_PTROF( QColor():new( 255,255,255 ) ) ) + + qLayout := QBoxLayout():new() + qLayout:setDirection( 0 ) + qLayout:setContentsMargins( 0,0,0,0 ) + qLayout:addWidget( QT_PTROF( qEdit ) ) + + oTab:oWidget:setLayout( QT_PTROF( qLayout ) ) + + qHiliter := QSyntaxHighlighter():new( qEdit:document() ) + + qEdit:show() + + aadd( ::aTabs, { oTab, qEdit, qHiliter, qLayout, cSourceFile } ) + + ::nPrevTab := ::nCurTab + ::nCurTab := len( ::aTabs ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:buildMenu() + LOCAL oMenuBar, oSubMenu + + oMenuBar := SetAppWindow():MenuBar() + + oSubMenu := XbpMenu():new( oMenuBar ):create() + oSubMenu:title := "~File" + oSubMenu:addItem( { "Open", {|| ::manageMenu( 1 ) } } ) + oSubMenu:addItem( { "Save", {|| ::manageMenu( 2 ) } } ) + oSubMenu:addItem( { NIL, NIL, XBPMENUBAR_MIS_SEPARATOR, NIL } ) + oSubMenu:addItem( { "Exit", {|| ::manageMenu( 3 ) } } ) + oMenuBar:addItem( { oSubMenu, NIL } ) + + Return Self + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:manageMenu( nMode ) + + DO CASE + CASE nMode == 1 + CASE nMode == 2 + ENDCASE + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:buildToolBar() + + ::oTBar := XbpToolBar():new( ::oDA ) + ::oTBar:create( , , { 0, ::oDa:currentSize()[ 2 ]-60 }, ; + { ::oDa:currentSize()[ 1 ], 60 } ) + + ::oTBar:imageWidth := 20 + ::oTBar:imageHeight := 20 + + ::oTBar:addItem( "Exit" , s_resPath + "exit.png" , , , , , "1" ) + ::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + ::oTBar:addItem( "Properties" , s_resPath + "properties.png" , , , , , "2" ) + ::oTBar:addItem( "Open" , s_resPath + "open.png" , , , , , "3" ) + ::oTBar:addItem( "Save" , s_resPath + "save.png" , , , , , "4" ) + ::oTBar:addItem( "Close" , s_resPath + "close.png" , , , , , "5" ) + ::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + ::oTBar:addItem( "Compile" , s_resPath + "compile.png" , , , , , "5" ) + ::oTBar:addItem( "Compile to PPO" , s_resPath + "ppo.png" , , , , , "6" ) + ::oTBar:addItem( "Build Project" , s_resPath + "build.png" , , , , , "7" ) + ::oTBar:addItem( "Build and Launch Project" , s_resPath + "buildlaunch.png" , , , , , "8" ) + ::oTBar:addItem( "Rebuild Project" , s_resPath + "rebuild.png" , , , , , "9" ) + ::oTBar:addItem( "Rebuild and Launch Project" , s_resPath + "rebuildlaunch.png" , , , , , "10" ) + ::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + // + // + ::oTBar:addItem( "Undo" , s_resPath + "undo.png" , , , , , "13" ) + ::oTBar:addItem( "Redo" , s_resPath + "redo.png" , , , , , "14" ) + ::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + ::oTBar:addItem( "Cut" , s_resPath + "cut.png" , , , , , "15" ) + ::oTBar:addItem( "Copy" , s_resPath + "copy.png" , , , , , "16" ) + ::oTBar:addItem( "Paste" , s_resPath + "paste.png" , , , , , "17" ) + ::oTBar:addItem( "Select All" , s_resPath + "selectall.png" , , , , , "18" ) + ::oTBar:addItem( "Column/Stream Selection" , s_resPath + "stream.png" , , , , , "19" ) + ::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + ::oTBar:addItem( "Find" , s_resPath + "find.png" , , , , , "20" ) + ::oTBar:addItem( "Search" , s_resPath + "search.png" , , , , , "21" ) + ::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + ::oTBar:addItem( "Place/Remove Mark" , s_resPath + "placeremovemark.png", , , , , "22" ) + ::oTBar:addItem( "Goto Mark" , s_resPath + "gotomark.png" , , , , , "23" ) + ::oTBar:addItem( "Goto Line" , s_resPath + "gotoline.png" , , , , , "24" ) + ::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + ::oTBar:addItem( "To Upper" , s_resPath + "toupper.png" , , , , , "25" ) + ::oTBar:addItem( "To Lower" , s_resPath + "tolower.png" , , , , , "26" ) + ::oTBar:addItem( "Invert Case" , s_resPath + "invertcase.png" , , , , , "27" ) + ::oTBar:addItem( "Match Pairs" , s_resPath + "matchobj.png" , , , , , "28" ) + ::oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) + + ::oTBar:transparentColor := GraMakeRGBColor( { 0,255,255 } ) // GRA_CLR_INVALID + ::oTBar:buttonClick := {|oButton| ::manageToolbar( oButton ) } + + RETURN nil + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:manageToolbar( oButton ) + + DO CASE + CASE oButton:caption == "Save" + CASE oButton:caption == "Open" + ENDCASE + + RETURN nil + +/*----------------------------------------------------------------------*/ + +METHOD HbIde:buildStatusBar() + LOCAL oPanel + + ::oSBar := XbpStatusBar():new() + ::oSBar:create( ::oDlg, , { 0,0 }, { ::oDlg:currentSize()[1],30 } ) + + oPanel := ::oSBar:getItem( 1 ) + oPanel:caption := "Ready" + oPanel:autosize := XBPSTATUSBAR_AUTOSIZE_SPRING + + RETURN Self + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbide/hbmk.hbm b/harbour/contrib/hbide/hbmk.hbm new file mode 100644 index 0000000000..9d9c3f7056 --- /dev/null +++ b/harbour/contrib/hbide/hbmk.hbm @@ -0,0 +1,7 @@ +# +# $Id$ +# + +../hbxbp/hbxbp.hbc + +-w3 -es2 diff --git a/harbour/contrib/hbide/resources/build.png b/harbour/contrib/hbide/resources/build.png new file mode 100644 index 0000000000..c257bc17ef Binary files /dev/null and b/harbour/contrib/hbide/resources/build.png differ diff --git a/harbour/contrib/hbide/resources/buildlaunch.png b/harbour/contrib/hbide/resources/buildlaunch.png new file mode 100644 index 0000000000..439bd4d199 Binary files /dev/null and b/harbour/contrib/hbide/resources/buildlaunch.png differ diff --git a/harbour/contrib/hbide/resources/buildrun.png b/harbour/contrib/hbide/resources/buildrun.png new file mode 100644 index 0000000000..0a0042e355 Binary files /dev/null and b/harbour/contrib/hbide/resources/buildrun.png differ diff --git a/harbour/contrib/hbide/resources/close.png b/harbour/contrib/hbide/resources/close.png new file mode 100644 index 0000000000..b8c56a5ea7 Binary files /dev/null and b/harbour/contrib/hbide/resources/close.png differ diff --git a/harbour/contrib/hbide/resources/column.png b/harbour/contrib/hbide/resources/column.png new file mode 100644 index 0000000000..8d07af90d6 Binary files /dev/null and b/harbour/contrib/hbide/resources/column.png differ diff --git a/harbour/contrib/hbide/resources/compile.png b/harbour/contrib/hbide/resources/compile.png new file mode 100644 index 0000000000..6af8f18e3e Binary files /dev/null and b/harbour/contrib/hbide/resources/compile.png differ diff --git a/harbour/contrib/hbide/resources/copy.png b/harbour/contrib/hbide/resources/copy.png new file mode 100644 index 0000000000..52b249587d Binary files /dev/null and b/harbour/contrib/hbide/resources/copy.png differ diff --git a/harbour/contrib/hbide/resources/cut.png b/harbour/contrib/hbide/resources/cut.png new file mode 100644 index 0000000000..59ea77d984 Binary files /dev/null and b/harbour/contrib/hbide/resources/cut.png differ diff --git a/harbour/contrib/hbide/resources/debug.png b/harbour/contrib/hbide/resources/debug.png new file mode 100644 index 0000000000..feadd1d9e7 Binary files /dev/null and b/harbour/contrib/hbide/resources/debug.png differ diff --git a/harbour/contrib/hbide/resources/envconfig.png b/harbour/contrib/hbide/resources/envconfig.png new file mode 100644 index 0000000000..bfcbba89f8 Binary files /dev/null and b/harbour/contrib/hbide/resources/envconfig.png differ diff --git a/harbour/contrib/hbide/resources/exit.png b/harbour/contrib/hbide/resources/exit.png new file mode 100644 index 0000000000..ba0074a0fb Binary files /dev/null and b/harbour/contrib/hbide/resources/exit.png differ diff --git a/harbour/contrib/hbide/resources/filec.png b/harbour/contrib/hbide/resources/filec.png new file mode 100644 index 0000000000..083d3266b2 Binary files /dev/null and b/harbour/contrib/hbide/resources/filec.png differ diff --git a/harbour/contrib/hbide/resources/fileprg.png b/harbour/contrib/hbide/resources/fileprg.png new file mode 100644 index 0000000000..603d4de385 Binary files /dev/null and b/harbour/contrib/hbide/resources/fileprg.png differ diff --git a/harbour/contrib/hbide/resources/find.png b/harbour/contrib/hbide/resources/find.png new file mode 100644 index 0000000000..8a28d64a6b Binary files /dev/null and b/harbour/contrib/hbide/resources/find.png differ diff --git a/harbour/contrib/hbide/resources/gotoline.png b/harbour/contrib/hbide/resources/gotoline.png new file mode 100644 index 0000000000..3b57714dea Binary files /dev/null and b/harbour/contrib/hbide/resources/gotoline.png differ diff --git a/harbour/contrib/hbide/resources/gotomark.png b/harbour/contrib/hbide/resources/gotomark.png new file mode 100644 index 0000000000..eccfe794fd Binary files /dev/null and b/harbour/contrib/hbide/resources/gotomark.png differ diff --git a/harbour/contrib/hbide/resources/info.png b/harbour/contrib/hbide/resources/info.png new file mode 100644 index 0000000000..905e2a572c Binary files /dev/null and b/harbour/contrib/hbide/resources/info.png differ diff --git a/harbour/contrib/hbide/resources/invertcase.png b/harbour/contrib/hbide/resources/invertcase.png new file mode 100644 index 0000000000..b7cfe2cbee Binary files /dev/null and b/harbour/contrib/hbide/resources/invertcase.png differ diff --git a/harbour/contrib/hbide/resources/launch.png b/harbour/contrib/hbide/resources/launch.png new file mode 100644 index 0000000000..c6a743e117 Binary files /dev/null and b/harbour/contrib/hbide/resources/launch.png differ diff --git a/harbour/contrib/hbide/resources/lense.png b/harbour/contrib/hbide/resources/lense.png new file mode 100644 index 0000000000..488f0283a2 Binary files /dev/null and b/harbour/contrib/hbide/resources/lense.png differ diff --git a/harbour/contrib/hbide/resources/matchobj.png b/harbour/contrib/hbide/resources/matchobj.png new file mode 100644 index 0000000000..e5d05532d2 Binary files /dev/null and b/harbour/contrib/hbide/resources/matchobj.png differ diff --git a/harbour/contrib/hbide/resources/new.png b/harbour/contrib/hbide/resources/new.png new file mode 100644 index 0000000000..fab50edad5 Binary files /dev/null and b/harbour/contrib/hbide/resources/new.png differ diff --git a/harbour/contrib/hbide/resources/notepad.png b/harbour/contrib/hbide/resources/notepad.png new file mode 100644 index 0000000000..59c72b606e Binary files /dev/null and b/harbour/contrib/hbide/resources/notepad.png differ diff --git a/harbour/contrib/hbide/resources/open.png b/harbour/contrib/hbide/resources/open.png new file mode 100644 index 0000000000..fb2e7120fd Binary files /dev/null and b/harbour/contrib/hbide/resources/open.png differ diff --git a/harbour/contrib/hbide/resources/paste.png b/harbour/contrib/hbide/resources/paste.png new file mode 100644 index 0000000000..16a17e2868 Binary files /dev/null and b/harbour/contrib/hbide/resources/paste.png differ diff --git a/harbour/contrib/hbide/resources/placeremovemark.png b/harbour/contrib/hbide/resources/placeremovemark.png new file mode 100644 index 0000000000..b6c4e40f86 Binary files /dev/null and b/harbour/contrib/hbide/resources/placeremovemark.png differ diff --git a/harbour/contrib/hbide/resources/ppo.png b/harbour/contrib/hbide/resources/ppo.png new file mode 100644 index 0000000000..afb0a642a5 Binary files /dev/null and b/harbour/contrib/hbide/resources/ppo.png differ diff --git a/harbour/contrib/hbide/resources/print.png b/harbour/contrib/hbide/resources/print.png new file mode 100644 index 0000000000..1b18ef2e37 Binary files /dev/null and b/harbour/contrib/hbide/resources/print.png differ diff --git a/harbour/contrib/hbide/resources/properties.png b/harbour/contrib/hbide/resources/properties.png new file mode 100644 index 0000000000..b68303f54b Binary files /dev/null and b/harbour/contrib/hbide/resources/properties.png differ diff --git a/harbour/contrib/hbide/resources/rebuild.png b/harbour/contrib/hbide/resources/rebuild.png new file mode 100644 index 0000000000..1af9b8dfc5 Binary files /dev/null and b/harbour/contrib/hbide/resources/rebuild.png differ diff --git a/harbour/contrib/hbide/resources/rebuildlaunch.png b/harbour/contrib/hbide/resources/rebuildlaunch.png new file mode 100644 index 0000000000..35682b2b29 Binary files /dev/null and b/harbour/contrib/hbide/resources/rebuildlaunch.png differ diff --git a/harbour/contrib/hbide/resources/redo.png b/harbour/contrib/hbide/resources/redo.png new file mode 100644 index 0000000000..4c992935fb Binary files /dev/null and b/harbour/contrib/hbide/resources/redo.png differ diff --git a/harbour/contrib/hbide/resources/save.png b/harbour/contrib/hbide/resources/save.png new file mode 100644 index 0000000000..4391089907 Binary files /dev/null and b/harbour/contrib/hbide/resources/save.png differ diff --git a/harbour/contrib/hbide/resources/search.png b/harbour/contrib/hbide/resources/search.png new file mode 100644 index 0000000000..5e642e047e Binary files /dev/null and b/harbour/contrib/hbide/resources/search.png differ diff --git a/harbour/contrib/hbide/resources/selectall.png b/harbour/contrib/hbide/resources/selectall.png new file mode 100644 index 0000000000..3171c776f6 Binary files /dev/null and b/harbour/contrib/hbide/resources/selectall.png differ diff --git a/harbour/contrib/hbide/resources/stream.png b/harbour/contrib/hbide/resources/stream.png new file mode 100644 index 0000000000..1f932dd013 Binary files /dev/null and b/harbour/contrib/hbide/resources/stream.png differ diff --git a/harbour/contrib/hbide/resources/text.png b/harbour/contrib/hbide/resources/text.png new file mode 100644 index 0000000000..614ad480ac Binary files /dev/null and b/harbour/contrib/hbide/resources/text.png differ diff --git a/harbour/contrib/hbide/resources/tolower.png b/harbour/contrib/hbide/resources/tolower.png new file mode 100644 index 0000000000..12edeb8c7a Binary files /dev/null and b/harbour/contrib/hbide/resources/tolower.png differ diff --git a/harbour/contrib/hbide/resources/tools.png b/harbour/contrib/hbide/resources/tools.png new file mode 100644 index 0000000000..148b72a7da Binary files /dev/null and b/harbour/contrib/hbide/resources/tools.png differ diff --git a/harbour/contrib/hbide/resources/toupper.png b/harbour/contrib/hbide/resources/toupper.png new file mode 100644 index 0000000000..c30dfb8367 Binary files /dev/null and b/harbour/contrib/hbide/resources/toupper.png differ diff --git a/harbour/contrib/hbide/resources/trashpage.png b/harbour/contrib/hbide/resources/trashpage.png new file mode 100644 index 0000000000..eccfe794fd Binary files /dev/null and b/harbour/contrib/hbide/resources/trashpage.png differ diff --git a/harbour/contrib/hbide/resources/undo.png b/harbour/contrib/hbide/resources/undo.png new file mode 100644 index 0000000000..2f0ee64a78 Binary files /dev/null and b/harbour/contrib/hbide/resources/undo.png differ diff --git a/harbour/contrib/hbide/resources/vr.png b/harbour/contrib/hbide/resources/vr.png new file mode 100644 index 0000000000..e67cc3183e Binary files /dev/null and b/harbour/contrib/hbide/resources/vr.png differ diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index 1c78b6c0cf..e6d7ee76de 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -211,6 +211,7 @@ QStyleOptionToolBox.qth QStyleOptionToolButton.qth QStyleOptionViewItem.qth QStylePainter.qth +QSyntaxHighlighter.qth QSystemTrayIcon.qth QTabBar.qth QTableView.qth diff --git a/harbour/contrib/hbqt/hbqt.ch b/harbour/contrib/hbqt/hbqt.ch index 72292e150b..9d61a4274e 100644 --- a/harbour/contrib/hbqt/hbqt.ch +++ b/harbour/contrib/hbqt/hbqt.ch @@ -73,7 +73,8 @@ #xtranslate HBQT_DEBUG( [] ) => iif( .T.,, ) #endif -#define QT_PTROF( oObj ) ( oObj:pPtr ) +#define QT_PTROF( oObj ) ( oObj:pPtr ) +#define QT_PTROFXBP( oXbp ) ( oXbp:oWidget:pPtr ) #define QEvent_None 0 // Not an event. #define QEvent_Timer 1 // Regular timer events (QTimerEvent). @@ -2129,6 +2130,12 @@ #define QEventLoop_WaitForMoreEvents 0x04 // Wait for events if no pending events are available. #define QEventLoop_DeferredDeletion 0x10 // deprecated - do not use. // The ProcessEventsFlags type is a typedef for QFlags. It stores an OR combination of ProcessEventsFlag values. + +#define QTextEdit_NoWrap 0 +#define QTextEdit_WidgetWidth 1 +#define QTextEdit_FixedPixelWidth 2 +#define QTextEdit_FixedColumnWidth 3 + /*----------------------------------------------------------------------*/ #define _HBQT_CH diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index 36c7eed773..ea123e9d62 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -291,6 +291,7 @@ const HB_GC_FUNCS * gcFuncs( void ); #define hbqt_par_QStyleOptionViewItem( n ) ( ( QStyleOptionViewItem * ) hbqt_gcpointer( n ) ) #define hbqt_par_QStyleOptionViewItem( n ) ( ( QStyleOptionViewItem * ) hbqt_gcpointer( n ) ) #define hbqt_par_QStylePainter( n ) ( ( QStylePainter * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QSyntaxHighlighter( n ) ( ( QSyntaxHighlighter * ) hbqt_gcpointer( n ) ) #define hbqt_par_QSystemTrayIcon( n ) ( ( QSystemTrayIcon * ) hbqt_gcpointer( n ) ) #define hbqt_par_QTabBar( n ) ( ( QTabBar * ) hbqt_gcpointer( n ) ) #define hbqt_par_QTableView( n ) ( ( QTableView * ) hbqt_gcpointer( n ) ) diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index 7ecb3ab72c..c1287aef33 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -2737,7 +2737,7 @@ HB_FUNC( QT_MUTEXDESTROY ) } /*----------------------------------------------------------------------*/ -/*----------------------------------------------------------------------*/ +/* */ /*----------------------------------------------------------------------*/ MyDrawingArea::MyDrawingArea(QWidget *parent) @@ -2769,6 +2769,94 @@ HB_FUNC( QT_MYDRAWINGAREA ) hb_retptr( ( MyDrawingArea * ) new MyDrawingArea() ); } +/*----------------------------------------------------------------------*/ +/* */ +/*----------------------------------------------------------------------*/ + +HbSyntaxHighlighter::HbSyntaxHighlighter( QTextDocument *parent ) + : QSyntaxHighlighter( parent ) +{ + HighlightingRule rule; + + keywordFormat.setForeground( Qt::darkBlue ); + keywordFormat.setFontWeight( QFont::Bold ); + QStringList keywordPatterns; + keywordPatterns << "\\bchar\\b" << "\\bclass\\b" << "\\bconst\\b" + << "\\bdouble\\b" << "\\benum\\b" << "\\bexplicit\\b" + << "\\bfriend\\b" << "\\binline\\b" << "\\bint\\b" + << "\\blong\\b" << "\\bnamespace\\b" << "\\boperator\\b" + << "\\bprivate\\b" << "\\bprotected\\b" << "\\bpublic\\b" + << "\\bshort\\b" << "\\bsignals\\b" << "\\bsigned\\b" + << "\\bslots\\b" << "\\bstatic\\b" << "\\bstruct\\b" + << "\\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 ); + } + + classFormat.setFontWeight( QFont::Bold ); + classFormat.setForeground( Qt::darkMagenta ); + rule.pattern = QRegExp( "\\bQ[A-Za-z]+\\b" ); + 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 HbSyntaxHighlighter::highlightBlock( const QString &text ) +{ + foreach ( const HighlightingRule &rule, highlightingRules ) { + QRegExp expression( rule.pattern ); + int 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 ) { + int endIndex = commentEndExpression.indexIn( text, startIndex ); + int commentLength; + 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 ); + } +} + /*----------------------------------------------------------------------*/ #endif diff --git a/harbour/contrib/hbqt/hbqt_slots.h b/harbour/contrib/hbqt/hbqt_slots.h index 96e3a48b32..93b21fe79a 100644 --- a/harbour/contrib/hbqt/hbqt_slots.h +++ b/harbour/contrib/hbqt/hbqt_slots.h @@ -340,4 +340,42 @@ protected: }; /*----------------------------------------------------------------------*/ + +#include +#include +#include + +class QTextDocument; + +class HbSyntaxHighlighter : public QSyntaxHighlighter +{ + Q_OBJECT + +public: + HbSyntaxHighlighter( QTextDocument *parent = 0 ); + +protected: + void highlightBlock( const QString &text ); + +private: + struct HighlightingRule + { + QRegExp pattern; + QTextCharFormat format; + }; + QVector highlightingRules; + + QRegExp commentStartExpression; + QRegExp commentEndExpression; + + QTextCharFormat keywordFormat; + QTextCharFormat classFormat; + QTextCharFormat singleLineCommentFormat; + QTextCharFormat multiLineCommentFormat; + QTextCharFormat quotationFormat; + QTextCharFormat functionFormat; +}; + +/*----------------------------------------------------------------------*/ + #endif diff --git a/harbour/contrib/hbqt/moc_slots.cpp b/harbour/contrib/hbqt/moc_slots.cpp index b9cb972c50..fab98e1ac9 100644 --- a/harbour/contrib/hbqt/moc_slots.cpp +++ b/harbour/contrib/hbqt/moc_slots.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'hbqt_slots.h' ** -** Created: Sun Nov 1 13:17:43 2009 +** Created: Sun Nov 15 13:20:23 2009 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2) ** ** WARNING! All changes made in this file will be lost! @@ -725,4 +725,47 @@ int Events::qt_metacall(QMetaObject::Call _c, int _id, void **_a) return _id; return _id; } +static const uint qt_meta_data_HbSyntaxHighlighter[] = { + + // content: + 2, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + + 0 // eod +}; + +static const char qt_meta_stringdata_HbSyntaxHighlighter[] = { + "HbSyntaxHighlighter\0" +}; + +const QMetaObject HbSyntaxHighlighter::staticMetaObject = { + { &QSyntaxHighlighter::staticMetaObject, qt_meta_stringdata_HbSyntaxHighlighter, + qt_meta_data_HbSyntaxHighlighter, 0 } +}; + +const QMetaObject *HbSyntaxHighlighter::metaObject() const +{ + return &staticMetaObject; +} + +void *HbSyntaxHighlighter::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_HbSyntaxHighlighter)) + return static_cast(const_cast< HbSyntaxHighlighter*>(this)); + return QSyntaxHighlighter::qt_metacast(_clname); +} + +int HbSyntaxHighlighter::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QSyntaxHighlighter::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} QT_END_MOC_NAMESPACE diff --git a/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp b/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp new file mode 100644 index 0000000000..926ba867a4 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp @@ -0,0 +1,175 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * 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. + * + */ +/*----------------------------------------------------------------------*/ + +#include "hbapi.h" +#include "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +#include + +#include +#include "../hbqt_slots.h" + +/* + * QSyntaxHighlighter ( QObject * parent ) + * QSyntaxHighlighter ( QTextDocument * parent ) + * QSyntaxHighlighter ( QTextEdit * parent ) + * virtual ~QSyntaxHighlighter () + */ + +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSyntaxHighlighter > pq; +} QGC_POINTER_QSyntaxHighlighter; + +QT_G_FUNC( release_QSyntaxHighlighter ) +{ + QGC_POINTER_QSyntaxHighlighter * p = ( QGC_POINTER_QSyntaxHighlighter * ) Cargo; + + 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 ) + { + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) + { + ( ( QSyntaxHighlighter * ) p->ph )->~QSyntaxHighlighter(); + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_QSyntaxHighlighter Object deleted!" ) ); + #if defined( __HB_DEBUG__ ) + hbqt_debug( " YES release_QSyntaxHighlighter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ); + #endif + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "release_QSyntaxHighlighter Object Name Missing!" ) ); + #if defined( __HB_DEBUG__ ) + hbqt_debug( " NO release_QSyntaxHighlighter" ); + #endif + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "release_QSyntaxHighlighter Object Allready deleted!" ) ); + #if defined( __HB_DEBUG__ ) + hbqt_debug( " DEL release_QSyntaxHighlighter" ); + #endif + } +} + +void * gcAllocate_QSyntaxHighlighter( void * pObj ) +{ + QGC_POINTER_QSyntaxHighlighter * p = ( QGC_POINTER_QSyntaxHighlighter * ) hb_gcAllocate( sizeof( QGC_POINTER_QSyntaxHighlighter ), gcFuncs() ); + + p->ph = pObj; + p->func = release_QSyntaxHighlighter; + new( & p->pq ) QPointer< QSyntaxHighlighter >( ( QSyntaxHighlighter * ) pObj ); + #if defined( __HB_DEBUG__ ) + hbqt_debug( " new_QSyntaxHighlighter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ); + #endif + return( p ); +} + +HB_FUNC( QT_QSYNTAXHIGHLIGHTER ) +{ + void * pObj = NULL; + + if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) + { + pObj = new HbSyntaxHighlighter( hbqt_par_QTextDocument( 1 ) ) ; + } + + hb_retptrGC( gcAllocate_QSyntaxHighlighter( pObj ) ); +} +/* + * QTextDocument * document () const + */ +HB_FUNC( QT_QSYNTAXHIGHLIGHTER_DOCUMENT ) +{ + hb_retptr( ( QTextDocument* ) hbqt_par_QSyntaxHighlighter( 1 )->document() ); +} + +/* + * void setDocument ( QTextDocument * doc ) + */ +HB_FUNC( QT_QSYNTAXHIGHLIGHTER_SETDOCUMENT ) +{ + hbqt_par_QSyntaxHighlighter( 1 )->setDocument( hbqt_par_QTextDocument( 2 ) ); +} + +/* + * void rehighlight () + */ +HB_FUNC( QT_QSYNTAXHIGHLIGHTER_REHIGHLIGHT ) +{ + hbqt_par_QSyntaxHighlighter( 1 )->rehighlight(); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg b/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg new file mode 100644 index 0000000000..944f8d13a8 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg @@ -0,0 +1,105 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * 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. + * + */ +/*----------------------------------------------------------------------*/ + + +#include "hbclass.ch" + + +CREATE CLASS QSyntaxHighlighter INHERIT QObject + + VAR pPtr + + METHOD new() + METHOD configure( xObject ) + + METHOD document() + METHOD setDocument( pDoc ) + METHOD rehighlight() + + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD QSyntaxHighlighter:new( pParent ) + ::pPtr := Qt_QSyntaxHighlighter( pParent ) + 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 ) + + +METHOD QSyntaxHighlighter:setDocument( pDoc ) + RETURN Qt_QSyntaxHighlighter_setDocument( ::pPtr, pDoc ) + + +METHOD QSyntaxHighlighter:rehighlight() + RETURN Qt_QSyntaxHighlighter_rehighlight( ::pPtr ) + diff --git a/harbour/contrib/hbqt/qtgui/filelist.mk b/harbour/contrib/hbqt/qtgui/filelist.mk index 824b976777..9f858105a0 100644 --- a/harbour/contrib/hbqt/qtgui/filelist.mk +++ b/harbour/contrib/hbqt/qtgui/filelist.mk @@ -165,6 +165,7 @@ CPP_SOURCES := \ QStyleOptionToolButton.cpp \ QStyleOptionViewItem.cpp \ QStylePainter.cpp \ + QSyntaxHighlighter.cpp \ QSystemTrayIcon.cpp \ QTabBar.cpp \ QTableView.cpp \ @@ -374,6 +375,7 @@ PRG_SOURCES := \ TQStyleOptionToolButton.prg \ TQStyleOptionViewItem.prg \ TQStylePainter.prg \ + TQSyntaxHighlighter.prg \ TQSystemTrayIcon.prg \ TQTabBar.prg \ TQTableView.prg \ diff --git a/harbour/contrib/hbqt/qth/QSyntaxHighlighter.qth b/harbour/contrib/hbqt/qth/QSyntaxHighlighter.qth new file mode 100644 index 0000000000..1b64608fbe --- /dev/null +++ b/harbour/contrib/hbqt/qth/QSyntaxHighlighter.qth @@ -0,0 +1,105 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * 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. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = +Inherits = QObject +Type = +New = + + + + + + +oSynHiliter := QSyntaxHighlighter():new( pObject ) +oSynHiliter := QSyntaxHighlighter():new( "QTextDocument", pQTextDocument ) +oSynHiliter := QSyntaxHighlighter():new( "QTextEdit", pQTextEdit ) + + + +#include +#include "../hbqt_slots.h" + +/* + * QSyntaxHighlighter ( QObject * parent ) + * QSyntaxHighlighter ( QTextDocument * parent ) + * QSyntaxHighlighter ( QTextEdit * parent ) + * virtual ~QSyntaxHighlighter () + */ +HB_FUNC( QT_QSYNTAXHIGHLIGHTER ) +{ + if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) ) + { + hb_retptr( new HbSyntaxHighlighter( hbqt_par_QTextDocument( 1 ) ) ); + } +} + + + + + + +QTextDocument * document () const +void setDocument ( QTextDocument * doc ) + + + +void rehighlight () + + + + diff --git a/harbour/contrib/hbxbp/tests/demoxbp.prg b/harbour/contrib/hbxbp/tests/demoxbp.prg index 67e89c0764..35ee4d27d5 100644 --- a/harbour/contrib/hbxbp/tests/demoxbp.prg +++ b/harbour/contrib/hbxbp/tests/demoxbp.prg @@ -432,7 +432,7 @@ STATIC FUNCTION MyFunctionXbp( nMode ) /*----------------------------------------------------------------------*/ FUNCTION Build_ToolBar( oDA ) - LOCAL oTBar + LOCAL oTBar, s, txt_:= {} // Create an XbpToolBar object and // add it at the top of the dialog @@ -466,6 +466,24 @@ FUNCTION Build_ToolBar( oDA ) oTBar:transparentColor := GRA_CLR_INVALID oTBar:buttonClick := {|oButton| ExeToolbar( oButton, oDa ) } + #ifdef __HARBOUR__ + aadd( txt_, ' ' ) + aadd( txt_, ' QToolBar { ' ) + aadd( txt_, ' background: cyan; ' ) + aadd( txt_, ' spacing: 3px; /* spacing between items in the tool bar */ ' ) + aadd( txt_, ' } ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' QToolBar::handle { ' ) + aadd( txt_, ' image: url(save.png); ' ) + aadd( txt_, ' } ' ) + aadd( txt_, ' ' ) + + s := "" + aeval( txt_, {|e| s += e + chr( 13 )+chr( 10 ) } ) + + oTBar:setStyleSheet( s ) + #endif + RETURN nil /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpmenubar.prg b/harbour/contrib/hbxbp/xbpmenubar.prg index 4891d2b47c..06a1da3ef0 100644 --- a/harbour/contrib/hbxbp/xbpmenubar.prg +++ b/harbour/contrib/hbxbp/xbpmenubar.prg @@ -260,11 +260,8 @@ METHOD xbpMenuBar:delItem( nItemIndex ) LOCAL lResult := .T. LOCAL oAction -//HBXBP_DEBUG( nItemIndex, len( ::aMenuItems ), len( ::aMenuItems[ nItemIndex ] ) ) - IF nItemIndex > 0 .AND. nItemIndex <= ::numItems() IF ::aMenuItems[ nItemIndex, 1 ] == QMF_POPUP -//HBXBP_DEBUG( valtype( ::aMenuItems[ nItemIndex, 4 ] ), __ObjGetClsName( ::aMenuItems[ nItemIndex, 4 ] ) ) //::aMenuItems[ nItemIndex, 4 ]:destroy() ELSE oAction := ::aMenuItems[ nItemIndex, 5 ] @@ -272,8 +269,8 @@ METHOD xbpMenuBar:delItem( nItemIndex ) QT_DISCONNECT_SIGNAL( QT_PTROF( oAction ), "hovered()" ) oAction:pPtr := 0 ENDIF -// ADEL( ::aMenuItems, nItemIndex ) -// ASIZE( ::aMenuItems, LEN( ::aMenuItems ) - 1 ) + ADEL( ::aMenuItems, nItemIndex ) + ASIZE( ::aMenuItems, LEN( ::aMenuItems ) - 1 ) ENDIF RETURN lResult @@ -302,7 +299,6 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos ) ELSE oAction:pPtr := ::oWidget:addSeparator() ENDIF - //aItem := { QMF_SEPARATOR, 0, 0, NIL, NIL, oAction } aItem := { QMF_SEPARATOR, 0, 0, NIL, oAction } CASE cType == "C" diff --git a/harbour/contrib/hbxbp/xbptoolbar.prg b/harbour/contrib/hbxbp/xbptoolbar.prg index d0574b5392..919a17e897 100644 --- a/harbour/contrib/hbxbp/xbptoolbar.prg +++ b/harbour/contrib/hbxbp/xbptoolbar.prg @@ -179,7 +179,6 @@ METHOD XbpToolbar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::show() ENDIF - ::setStyle() ::oParent:AddChild( SELF ) RETURN Self @@ -200,17 +199,13 @@ METHOD XbpToolbar:destroy() //Win_DeleteObject( ::aItems[ i,2 ]:hotImage ) ENDIF -// QT_DISCONNECT_SIGNAL( QT_PTROF( ::aMenuItems[ i, 5 ] ), "triggered(bool)" ) -// QT_DISCONNECT_SIGNAL( QT_PTROF( ::aMenuItems[ i, 5 ] ), "hovered()" ) - ::aItems[ i,2 ]:oAction:pPtr := 0 - ::aItems[ i,2 ]:oAction := NIL + IF ::aItems[ i,3 ] == XBPTOOLBAR_BUTTON_DEFAULT + ::aItems[ i,2 ]:oAction:pPtr := 0 + ::aItems[ i,2 ]:oAction := NIL + ENDIF NEXT ENDIF - IF !empty( ::hImageList ) - //WAPI_ImageList_Destroy( ::hImageList ) - ENDIF - ::xbpWindow:destroy() RETURN NIL @@ -239,26 +234,34 @@ METHOD XbpToolbar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS HB_SYMBOL_UNUSED( cDLL ) HB_SYMBOL_UNUSED( nMapRGB ) + DEFAULT nStyle TO XBPTOOLBAR_BUTTON_DEFAULT + oBtn := XbpToolbarButton():new( cCaption, nStyle, cKey ) oBtn:index := ::numItems + 1 oBtn:command := 100 + oBtn:index - /* Create an action */ - oBtn:oAction := QAction():new( QT_PTROF( ::oWidget ) ) - oBtn:oAction:setText( cCaption ) + IF nStyle == XBPTOOLBAR_BUTTON_SEPARATOR + ::oWidget:addSeparator() + + ELSE + /* Create an action */ + oBtn:oAction := QAction():new( QT_PTROF( ::oWidget ) ) + oBtn:oAction:setText( cCaption ) + + IF valtype( xImage ) == "C" .and. hb_FileExists( xImage ) + oBtn:oAction:setIcon( xImage ) + ENDIF + + /* Attach codeblock to be triggered */ + ::Connect( QT_PTROF( oBtn:oAction ), "triggered(bool)", {|| ::exeBlock( oBtn ) } ) + + /* Attach Action with Toolbar */ + ::oWidget:addAction( QT_PTROF( oBtn:oAction ) ) - IF valtype( xImage ) == "C" .and. hb_FileExists( xImage ) - oBtn:oAction:setIcon( xImage ) ENDIF - /* Attach codeblock to be triggered */ - ::Connect( QT_PTROF( oBtn:oAction ), "triggered(bool)", {|| ::exeBlock( oBtn ) } ) - - /* Attach Action with Toolbar */ - ::oWidget:addAction( QT_PTROF( oBtn:oAction ) ) - - aadd( ::aItems, { oBtn:command, oBtn } ) + aadd( ::aItems, { oBtn:command, oBtn, nStyle } ) RETURN oBtn