From 51f3437a79fb6e927e1e490e28946ed6fc18f087 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 12 May 2010 00:41:24 +0000 Subject: [PATCH] 2010-17:24 07:29 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/plugins/savebackup.hrb * contrib/hbide/plugins/savebackup.prg ! Fine tuned to receive correct number of parameters. * contrib/hbqt/doc/en/class_hbqplaintextedit.txt * contrib/hbqt/hbqt_hbqplaintextedit.cpp * contrib/hbqt/hbqt_hbqplaintextedit.h * contrib/hbqt/qtgui/HBQPlainTextEdit.cpp * contrib/hbqt/qtgui/THBQPlainTextEdit.prg * contrib/hbqt/qth/HBQPlainTextEdit.qth * contrib/hbide/hbide.prg * contrib/hbide/idedocks.prg + Added Icon: Toggle current Line Highlight in "Lines" toolbar. Public API method is ::toggleCurrentLineHilight(). * contrib/hbide/ideedit.prg * contrib/hbide/ideeditor.prg * contrib/hbide/ideenviron.prg ! Reverted: line edits font - monospace to GUI. * contrib/hbide/ideobject.prg * contrib/hbide/ideplugins.prg ! tuned to send oIDE and cVer as first and second argument to {plugin}_init( oIde, cVer ). * contrib/hbide/ideprojmanager.prg ! Reverted: line edits font - monospace to GUI. * contrib/hbide/ideshortcuts.prg + Public Method - ::toggleCurrentLineHilight(). Toggles displaying current line in distinct color. * contrib/hbide/idethemes.prg + Activated: Selection Background slot. It facilitates to control the color of selections per theme basis. + Prepared to toggle matching braces mode - both vs single. "Setup" dialog will contain its place holder. % Fixed many other artifacts coming into way, and possibly might have broken a few ones, please report. --- harbour/ChangeLog | 44 +++++++++++ harbour/contrib/hbide/hbide.prg | 5 +- harbour/contrib/hbide/idedocks.prg | 12 +-- harbour/contrib/hbide/ideedit.prg | 12 ++- harbour/contrib/hbide/ideeditor.prg | 35 ++++++--- harbour/contrib/hbide/ideenviron.prg | 3 + harbour/contrib/hbide/ideobject.prg | 1 + harbour/contrib/hbide/ideplugins.prg | 50 ++++++------ harbour/contrib/hbide/ideprojmanager.prg | 3 +- harbour/contrib/hbide/ideshortcuts.prg | 10 ++- harbour/contrib/hbide/idethemes.prg | 14 ++-- harbour/contrib/hbide/plugins/savebackup.hrb | Bin 563 -> 583 bytes harbour/contrib/hbide/plugins/savebackup.prg | 41 ++++++---- .../hbqt/doc/en/class_hbqplaintextedit.txt | 2 + .../contrib/hbqt/hbqt_hbqplaintextedit.cpp | 71 ++++++++++++------ harbour/contrib/hbqt/hbqt_hbqplaintextedit.h | 17 +++-- .../contrib/hbqt/qtgui/HBQPlainTextEdit.cpp | 28 +++++++ .../contrib/hbqt/qtgui/THBQPlainTextEdit.prg | 10 +++ harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth | 3 + 19 files changed, 264 insertions(+), 97 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8c735a85d4..c37b1f1fdf 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,50 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-17:24 07:29 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/plugins/savebackup.hrb + * contrib/hbide/plugins/savebackup.prg + ! Fine tuned to receive correct number of parameters. + + * contrib/hbqt/doc/en/class_hbqplaintextedit.txt + * contrib/hbqt/hbqt_hbqplaintextedit.cpp + * contrib/hbqt/hbqt_hbqplaintextedit.h + * contrib/hbqt/qtgui/HBQPlainTextEdit.cpp + * contrib/hbqt/qtgui/THBQPlainTextEdit.prg + * contrib/hbqt/qth/HBQPlainTextEdit.qth + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + + Added Icon: Toggle current Line Highlight in "Lines" toolbar. + Public API method is ::toggleCurrentLineHilight(). + + * contrib/hbide/ideedit.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideenviron.prg + ! Reverted: line edits font - monospace to GUI. + + * contrib/hbide/ideobject.prg + * contrib/hbide/ideplugins.prg + ! tuned to send oIDE and cVer as first and second + argument to {plugin}_init( oIde, cVer ). + + * contrib/hbide/ideprojmanager.prg + ! Reverted: line edits font - monospace to GUI. + + * contrib/hbide/ideshortcuts.prg + + Public Method - ::toggleCurrentLineHilight(). + Toggles displaying current line in distinct color. + + * contrib/hbide/idethemes.prg + + Activated: Selection Background slot. + It facilitates to control the color of selections per theme basis. + + + Prepared to toggle matching braces mode - both vs single. + "Setup" dialog will contain its place holder. + + % Fixed many other artifacts coming into way, and possibly + might have broken a few ones, please report. + 2010-05-12 02:26 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/external/minizip/ioapi.h ! fixed FreeBSD and HAIKU builds diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 09e135690c..c2c57caf5c 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -227,6 +227,7 @@ CLASS HbIde DATA lTabCloseRequested INIT .f. DATA isColumnSelectionEnabled INIT .f. DATA lLineNumbersVisible INIT .t. + DATA lCurrentLineHighlightEnabled INIT .t. DATA cWrkProject INIT "" DATA cWrkTheme INIT "" @@ -490,7 +491,9 @@ METHOD HbIde:create( aParams ) /* Load tags last tagged projects */ ::oFN:loadTags( ::aINI[ INI_TAGGEDPROJECTS ] ) - /* hbide_loadPlugins() */ + #if 0 /* Can be controlled through setup */ + hbide_loadPlugins( Self, "1.0" ) + #endif DO WHILE .t. ::nEvent := AppEvent( @::mp1, @::mp2, @::oXbp ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 1b76cbaba3..5b1c1c2778 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -506,13 +506,13 @@ METHOD IdeDocks:buildToolBarPanels() ::oDlg:oWidget:addToolBar( Qt_LeftToolBarArea, ::qTBarLines ) aBtns := {} - aadd( aBtns, { "movelineup" , "Move Current Line Up" , {|| ::oEM:moveLine( -1 ) } } ) - aadd( aBtns, { "movelinedown" , "Move Current Line Down" , {|| ::oEM:moveLine( 1 ) } } ) - aadd( aBtns, { "deleteline" , "Delete Current Line" , {|| ::oEM:deleteLine() } } ) - aadd( aBtns, { "duplicateline" , "Duplicate Current Line" , {|| ::oEM:duplicateLine() } } ) + aadd( aBtns, { "movelineup" , "Move Current Line Up" , {|| ::oEM:moveLine( -1 ) } } ) + aadd( aBtns, { "movelinedown" , "Move Current Line Down" , {|| ::oEM:moveLine( 1 ) } } ) + aadd( aBtns, { "deleteline" , "Delete Current Line" , {|| ::oEM:deleteLine() } } ) + aadd( aBtns, { "duplicateline" , "Duplicate Current Line" , {|| ::oEM:duplicateLine() } } ) aadd( aBtns, {} ) - aadd( aBtns, { "togglelinenumber", "Toggle Line Numbers" , ; - {|| ::oIde:lLineNumbersVisible := ! ::lLineNumbersVisible, ::oEM:toggleLineNumbers() } } ) + aadd( aBtns, { "togglelinenumber", "Toggle Line Numbers" , {|| ::oEM:toggleLineNumbers() } } ) + aadd( aBtns, { "curlinehilight" , "Toggle Current Line Hilight", {|| ::oEM:toggleCurrentLineHighlightMode() } } ) FOR EACH a_ IN aBtns IF empty( a_ ) ::qTBarLines:addSeparator() diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 0daa57b857..2c08a436b1 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -207,6 +207,7 @@ CLASS IdeEdit INHERIT IdeObject METHOD blockConvert( cMode ) METHOD clearSelection() METHOD dispStatusInfo() + METHOD toggleCurrentLineHighlightMode() ENDCLASS @@ -441,11 +442,12 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) /* Book Marks reach-out buttons */ ::relayMarkButtons() - ::toggleLineNumbers() - ::updateTitleBar() + ::toggleLineNumbers() + ::toggleCurrentLineHighlightMode() ::dispStatusInfo() + ::oDK:setStatusText( SB_PNL_SELECTEDCHARS, len( ::getSelectedText() ) ) EXIT @@ -1245,6 +1247,12 @@ METHOD IdeEdit:toggleLineSelectionMode() /*----------------------------------------------------------------------*/ +METHOD IdeEdit:toggleCurrentLineHighlightMode() + ::qEdit:hbHighlightCurrentLine( ::lCurrentLineHighlightEnabled ) + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEdit:redo() ::qEdit:redo() RETURN Self diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 557963be24..43b2615933 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -140,6 +140,7 @@ CLASS IdeEditsManager INHERIT IdeObject METHOD toggleSelectionMode() METHOD toggleLineNumbers() METHOD toggleLineSelectionMode() + METHOD toggleCurrentLineHighlightMode() METHOD getText() METHOD getWord( lSelect ) @@ -551,6 +552,7 @@ METHOD IdeEditsManager:toggleLineSelectionMode() METHOD IdeEditsManager:toggleSelectionMode() LOCAL oEdit + ::oIde:isColumnSelectionEnabled := ! ::isColumnSelectionEnabled IF !empty( oEdit := ::getEditObjectCurrent() ) oEdit:toggleSelectionMode() ENDIF @@ -558,6 +560,29 @@ METHOD IdeEditsManager:toggleSelectionMode() /*----------------------------------------------------------------------*/ +METHOD IdeEditsManager:toggleCurrentLineHighlightMode() + LOCAL oEdit + + ::oIde:lCurrentLineHighlightEnabled := ! ::lCurrentLineHighlightEnabled + + IF !empty( oEdit := ::getEditObjectCurrent() ) + oEdit:toggleCurrentLineHighlightMode() + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeEditsManager:toggleLineNumbers() + LOCAL oEdit + ::oIde:lLineNumbersVisible := ! ::lLineNumbersVisible + IF !empty( oEdit := ::getEditObjectCurrent() ) + oEdit:toggleLineNumbers() + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEditsManager:duplicateLine() LOCAL oEdit IF !empty( oEdit := ::getEditObjectCurrent() ) @@ -657,15 +682,6 @@ METHOD IdeEditsManager:clearSelection() /*----------------------------------------------------------------------*/ -METHOD IdeEditsManager:toggleLineNumbers() - LOCAL oEdit - IF !empty( oEdit := ::getEditObjectCurrent() ) - oEdit:toggleLineNumbers() - ENDIF - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEditsManager:gotoFunction() LOCAL oEdit IF !empty( oEdit := ::getEditObjectCurrent() ) @@ -1310,6 +1326,7 @@ METHOD IdeEditor:activateTab( mp1, mp2, oXbp ) oEdit:setDocumentProperties() oEdit:qCoEdit:relayMarkButtons() oEdit:qCoEdit:toggleLineNumbers() + oEdit:qCoEdit:toggleCurrentLineHighlightMode() oEdit:qCoEdit:dispStatusInfo() ENDIF diff --git a/harbour/contrib/hbide/ideenviron.prg b/harbour/contrib/hbide/ideenviron.prg index d37a6a0c27..482b48c273 100644 --- a/harbour/contrib/hbide/ideenviron.prg +++ b/harbour/contrib/hbide/ideenviron.prg @@ -235,8 +235,11 @@ METHOD IdeEnvironments:show() ::oUI:signal( "buttonPathEnv" , "clicked()", {|| ::execEnv( 2 ) } ) ::oUI:q_editCompilers:setFont( ::oFont:oWidget ) + + #if 0 ::oUI:q_editPathEnv:setFont( ::oFont:oWidget ) ::oUI:q_editPathMk2:setFont( ::oFont:oWidget ) + #endif ENDIF ::oUI:q_editPathMk2 :setText( ::aINI[ INI_HBIDE, PathMk2 ] ) diff --git a/harbour/contrib/hbide/ideobject.prg b/harbour/contrib/hbide/ideobject.prg index b855c7d7ba..a5affc7661 100644 --- a/harbour/contrib/hbide/ideobject.prg +++ b/harbour/contrib/hbide/ideobject.prg @@ -197,6 +197,7 @@ CLASS IdeObject ACCESS isColumnSelectionEnabled INLINE ::oIde:isColumnSelectionEnabled ACCESS lLineNumbersVisible INLINE ::oIde:lLineNumbersVisible ACCESS lStatusBarVisible INLINE ::oIde:lStatusBarVisible + ACCESS lCurrentLineHighlightEnabled INLINE ::oIde:lCurrentLineHighlightEnabled ACCESS aMarkTBtns INLINE ::oIde:aMarkTBtns diff --git a/harbour/contrib/hbide/ideplugins.prg b/harbour/contrib/hbide/ideplugins.prg index 54e69f8e03..9fc9c5fb12 100644 --- a/harbour/contrib/hbide/ideplugins.prg +++ b/harbour/contrib/hbide/ideplugins.prg @@ -77,7 +77,7 @@ STATIC s_aLoaded := { { "", .f. } } /*----------------------------------------------------------------------*/ -FUNCTION hbide_loadPlugins() +FUNCTION hbide_loadPlugins( oIde, cVer ) LOCAL cPath := hb_dirBase() + hb_osPathSeparator() + "plugins" + hb_osPathSeparator() LOCAL dir_, a_, cFile, pHrb, bBlock @@ -86,11 +86,14 @@ FUNCTION hbide_loadPlugins() FOR EACH a_ IN dir_ hb_fNameSplit( a_[ 1 ], , @cFile ) pHrb := hb_hrbLoad( HB_HRB_BIND_OVERLOAD, cPath + cFile ) + IF ! Empty( pHrb ) .AND. ! Empty( hb_hrbGetFunSym( pHrb, cFile + "_init" ) ) bBlock := &( "{|...| " + cFile + "_init(...) }" ) - IF eval( bBlock, "1.0" ) /* Shakehand is OK */ + + IF eval( bBlock, oIde, cVer ) IF ! Empty( hb_hrbGetFunSym( pHrb, cFile + "_exec" ) ) aadd( s_aPlugins, { lower( cFile ), &( "{|...| " + cFile + "_exec(...) }" ), pHrb } ) + ENDIF ENDIF ENDIF @@ -100,7 +103,27 @@ FUNCTION hbide_loadPlugins() /*----------------------------------------------------------------------*/ -FUNCTION hbide_loadAPlugin( cPlugin ) +FUNCTION hbide_execPlugin( cPlugin, oIde, ... ) + LOCAL n, lLoaded + + cPlugin := lower( cPlugin ) + + IF ( n := ascan( s_aLoaded, {|e_| e_[ 1 ] == cPlugin } ) ) == 0 + lLoaded := hbide_loadAPlugin( cPlugin, oIde, "1.0" ) + ELSE + lLoaded := s_aLoaded[ n,2 ] + ENDIF + IF lLoaded + IF ( n := ascan( s_aPlugins, {|e_| e_[ 1 ] == cPlugin } ) ) > 0 + RETURN eval( s_aPlugins[ n, 2 ], oIde, ... ) + ENDIF + ENDIF + + RETURN NIL + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION hbide_loadAPlugin( cPlugin, oIde, cVer ) LOCAL cPath, pHrb, bBlock, lLoaded cPath := hb_dirBase() + hb_osPathSeparator() + "plugins" + hb_osPathSeparator() + cPlugin + ".hrb" @@ -111,7 +134,7 @@ FUNCTION hbide_loadAPlugin( cPlugin ) IF ! Empty( pHrb ) .AND. ! Empty( hb_hrbGetFunSym( pHrb, cPlugin + "_init" ) ) bBlock := &( "{|...| " + cPlugin + "_init(...) }" ) - IF eval( bBlock, "1.0" ) + IF eval( bBlock, oIde, cVer ) IF ! Empty( hb_hrbGetFunSym( pHrb, cPlugin + "_exec" ) ) aadd( s_aPlugins, { cPlugin, &( "{|...| " + cPlugin + "_exec(...) }" ), pHrb } ) @@ -128,22 +151,3 @@ FUNCTION hbide_loadAPlugin( cPlugin ) /*----------------------------------------------------------------------*/ -FUNCTION hbide_execPlugin( cPlugin, oAPI, ... ) - LOCAL n, lLoaded - - cPlugin := lower( cPlugin ) - - IF ( n := ascan( s_aLoaded, {|e_| e_[ 1 ] == cPlugin } ) ) == 0 - lLoaded := hbide_loadAPlugin( cPlugin ) - ELSE - lLoaded := s_aLoaded[ n,2 ] - ENDIF - IF lLoaded - IF ( n := ascan( s_aPlugins, {|e_| e_[ 1 ] == cPlugin } ) ) > 0 - RETURN eval( s_aPlugins[ n, 2 ], oAPI, ... ) - ENDIF - ENDIF - - RETURN NIL - -/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index d668b30b87..64786df57a 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -737,6 +737,7 @@ METHOD IdeProjManager:buildInterface() ::oUI:q_editSources :setFont( ::oFont:oWidget ) ::oUI:q_editHbp :setFont( ::oFont:oWidget ) + #if 0 ::oUI:q_editPrjTitle :setFont( ::oFont:oWidget ) ::oUI:q_editPrjLoctn :setFont( ::oFont:oWidget ) ::oUI:q_editWrkFolder :setFont( ::oFont:oWidget ) @@ -745,7 +746,7 @@ METHOD IdeProjManager:buildInterface() ::oUI:q_editBackup :setFont( ::oFont:oWidget ) ::oUI:q_editLaunchParams:setFont( ::oFont:oWidget ) ::oUI:q_editLaunchExe :setFont( ::oFont:oWidget ) - + #endif RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideshortcuts.prg b/harbour/contrib/hbide/ideshortcuts.prg index 27fd9b7ac5..8f652956e8 100644 --- a/harbour/contrib/hbide/ideshortcuts.prg +++ b/harbour/contrib/hbide/ideshortcuts.prg @@ -203,6 +203,7 @@ CLASS IdeShortcuts INHERIT IdeObject METHOD gotoFunction() METHOD clearSelection() METHOD execPlugin( cPlugin, ... ) + METHOD toggleCurrentLineHilight() ENDCLASS @@ -1105,7 +1106,6 @@ METHOD IdeShortcuts:toggleLineNumbersDisplay() RETURN ::oEM:toggleLineNumbers() /*----------------------------------------------------------------------*/ METHOD IdeShortcuts:toggleSelectionMode() - ::isColumnSelectionEnabled := ! ::isColumnSelectionEnabled RETURN ::oEM:toggleSelectionMode() /*----------------------------------------------------------------------*/ METHOD IdeShortcuts:toggleStatusBar() @@ -1114,7 +1114,7 @@ METHOD IdeShortcuts:toggleStatusBar() ELSE ::oSBar:oWidget:show() ENDIF - ::lStatusBarVisible := ! ::lStatusBarVisible + ::oIde:lStatusBarVisible := ! ::lStatusBarVisible RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeShortcuts:toggleLineSelectionMode() @@ -1132,6 +1132,9 @@ METHOD IdeShortcuts:clearSelection() METHOD IdeShortcuts:execPlugin( cPlugin, ... ) RETURN hbide_execPlugin( cPlugin, ::oIde, ... ) /*----------------------------------------------------------------------*/ +METHOD IdeShortcuts:toggleCurrentLineHilight() + RETURN ::oEM:toggleCurrentLineHighlightMode() +/*----------------------------------------------------------------------*/ METHOD IdeShortcuts:loadMethods() @@ -1316,6 +1319,9 @@ METHOD IdeShortcuts:loadMethods() aadd( ::aMethods, { 'execPlugin( cPlugin )', ; 'execPlugin( "" )', ; 'Attempts to execute third-party plugins. First parameter passed is the instance to SELF exposing public API methods. Next parameters are passes as a list.' } ) + aadd( ::aMethods, { 'toggleCurrentLineHilight()', ; + 'toggleCurrentLineHilight()', ; + 'Toggles the mode to highlight current line or not in the editor. The effect is global. Setting is not retained for next run' } ) RETURN Self diff --git a/harbour/contrib/hbide/idethemes.prg b/harbour/contrib/hbide/idethemes.prg index c79ad25b54..040bf2f582 100644 --- a/harbour/contrib/hbide/idethemes.prg +++ b/harbour/contrib/hbide/idethemes.prg @@ -478,6 +478,9 @@ METHOD IdeThemes:setSyntaxHilighting( qEdit, cTheme, lNew ) aAttr := ::getThemeAttribute( "LineNumbersBkColor", cTheme ) qEdit:hbSetLineAreaBkColor( QColor():new( aAttr[ THM_ATR_R ], aAttr[ THM_ATR_G ], aAttr[ THM_ATR_B ] ) ) + + aAttr := ::getThemeAttribute( "SelectionBackground", cTheme ) + qEdit:hbSetSelectionColor( QColor():new( aAttr[ THM_ATR_R ], aAttr[ THM_ATR_G ], aAttr[ THM_ATR_B ] ) ) ENDIF qHiliter:setDocument( qEdit:document() ) @@ -541,9 +544,6 @@ METHOD IdeThemes:show() ::oUI:q_listThemes:setCurrentRow( 0 ) ::oUI:q_listItems:setCurrentRow( 0 ) - //::nCurTheme := 1 - //::nCurItem := 1 - ::setTheme() ::setAttributes() ENDIF @@ -1036,7 +1036,7 @@ STATIC FUNCTION hbide_loadDefaultThemes() aadd( aIni, "CommentsAndRemarks = 165, 165, 165, No, No, No, " ) aadd( aIni, "UnrecognizedText = 0, 0, 0, No, No, No, " ) aadd( aIni, "BookMarkLineBackground = 0, 255, 255, No, No, No, " ) - aadd( aIni, "SelectionBackground = 255, 128, 255, No, No, No, " ) + aadd( aIni, "SelectionBackground = 220, 200, 135, No, No, No, " ) aadd( aIni, "CurrentLineBackground = 255, 215, 155, No, No, No, " ) aadd( aIni, "UnterminatedStrings = 255, 128, 128, No, No, No, " ) aadd( aIni, "LineNumbersBkColor = 255, 215, 155, No, No, No, " ) @@ -1057,7 +1057,7 @@ STATIC FUNCTION hbide_loadDefaultThemes() aadd( aIni, "CommentsAndRemarks = 165, 165, 165, No, No, No, " ) aadd( aIni, "UnrecognizedText = 0, 0, 0, No, No, No, " ) aadd( aIni, "BookMarkLineBackground = 0, 255, 255, No, No, No, " ) - aadd( aIni, "SelectionBackground = 255, 128, 255, No, No, No, " ) + aadd( aIni, "SelectionBackground = 160, 200, 255, No, No, No, " ) aadd( aIni, "CurrentLineBackground = 235, 235, 235, No, No, No, " ) aadd( aIni, "UnterminatedStrings = 255, 128, 128, No, No, No, " ) aadd( aIni, "LineNumbersBkColor = 235, 235, 235, No, No, No, " ) @@ -1078,7 +1078,7 @@ STATIC FUNCTION hbide_loadDefaultThemes() aadd( aIni, "CommentsAndRemarks = 0,128,255 , No, No, No, " ) aadd( aIni, "UnrecognizedText = 0,0,0 , No, No, No, " ) aadd( aIni, "BookMarkLineBackground = 0,255,255 , No, No, No, " ) - aadd( aIni, "SelectionBackground = 255,128,255 , No, No, No, " ) + aadd( aIni, "SelectionBackground = 255,200,220 , No, No, No, " ) aadd( aIni, "CurrentLineBackground = 220,220,220 , No, No, No, " ) aadd( aIni, "UnterminatedStrings = 255,128,128 , No, No, No, " ) aadd( aIni, "LineNumbersBkColor = 220,220,220 , No, No, No, " ) @@ -1141,7 +1141,7 @@ STATIC FUNCTION hbide_loadDefaultThemes() aadd( aIni, "CommentsAndRemarks = 128,128,128 , No, No, No, " ) aadd( aIni, "UnrecognizedText = 0,0,0 , No, No, No, " ) aadd( aIni, "BookMarkLineBackground = 0,255,255 , No, No, No, " ) - aadd( aIni, "SelectionBackground = 255,0,255 , No, No, No, " ) + aadd( aIni, "SelectionBackground = 125,170,150 , No, No, No, " ) aadd( aIni, "CurrentLineBackground = 220,220,110 , No, No, No, " ) aadd( aIni, "UnterminatedStrings = 128,128,0 , No, No, No, " ) aadd( aIni, "LineNumbersBkColor = 220,220,110 , No, No, No, " ) diff --git a/harbour/contrib/hbide/plugins/savebackup.hrb b/harbour/contrib/hbide/plugins/savebackup.hrb index 17900a79ab876b1c8568f70c4d47d7d44dc2caca..a2d994829eb01a5a2d0c632ad1a4d9a0f212c9f1 100644 GIT binary patch delta 222 zcmdnYa-3y@BxAiS0|Nsu1Cxq9Lp)O!i=mzYgR2aOiUR{@9=nP&Lq#5Yuw$63lcTeD zXh6JcgsU@yJy63`Mn)Ach9#Pe3<*pOjf{*k8YGc@Gxev7bljbCKfYr$ndE6 zFl=C9h-VaGRPkqMlE2fU62OpxVx%I-c*kIdB_L-oF{*?!7_c%JumSZHFcdHZFsnpN yUdrgg8_BSN2W)x(lS=gDZ;bMCu?!moK~Cm%N=(i!El>ysTAIQj!lV)pvH<|AiZ4+B delta 176 zcmX@kvYBOrBx4LG0|UcU1_l*#hKfA)V8<|5Cr4-R(13W?2v=tYdypg}qlz8F5=};i z1SWYGCV2{3>#P&;u%F4Rh$``S3 zloRr1FkodcU<1k&FcdHZFst}X-pS~~>&vi#2W& NIL :hbGetSelectionInfo() -> NIL :hbSetSelectionInfo( xSelectionInfo ) -> NIL + :hbSetSelectionColor( pColor ) -> NIL + :hbSetMatchBraces( lAll ) -> NIL $DESCRIPTION$ diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp index 6cc5909b35..21cae9cbad 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.cpp @@ -94,6 +94,7 @@ HBQPlainTextEdit::HBQPlainTextEdit( QWidget * parent ) : QPlainTextEdit( parent m_currentLineColor.setNamedColor( "#e8e8ff" ); m_lineAreaBkColor.setNamedColor( "#e4e4e4" ); m_horzRulerBkColor.setNamedColor( "whitesmoke" ); + m_matchBracesAll = false; spaces = 3; spacesTab = ""; @@ -122,6 +123,9 @@ HBQPlainTextEdit::HBQPlainTextEdit( QWidget * parent ) : QPlainTextEdit( parent horzRuler->setFrameShape( QFrame::Panel ); horzRuler->setFrameShadow( QFrame::Sunken ); + + QPalette pl( QPlainTextEdit::palette() ); + m_selectionColor = pl.color( QPalette::Highlight ); } /*----------------------------------------------------------------------*/ @@ -214,6 +218,18 @@ bool HBQPlainTextEdit::event( QEvent *event ) /*----------------------------------------------------------------------*/ +void HBQPlainTextEdit::hbSetSelectionColor( const QColor & color ) +{ + m_selectionColor = color; + + QPalette pl( QPlainTextEdit::palette() ); + pl.setColor( QPalette::Highlight, m_selectionColor ); + pl.setColor( QPalette::HighlightedText, QColor( 0,0,0 ) ); + setPalette( pl ); +} + +/*----------------------------------------------------------------------*/ + static bool isNavableKey( int k ) { return ( k == Qt::Key_Right || k == Qt::Key_Left || k == Qt::Key_Up || k == Qt::Key_Down || @@ -738,7 +754,8 @@ bool HBQPlainTextEdit::hbKeyPressColumnSelection( QKeyEvent * event ) } else { - //emit selectionChanged(); + if( selectionState > 0 ) + emit selectionChanged(); setCursorWidth( 1 ); selectionState = 0; } @@ -934,6 +951,8 @@ void HBQPlainTextEdit::paintEvent( QPaintEvent * event ) int top = ( int ) blockBoundingGeometry( tblock ).translated( contentOffset() ).top(); int bottom = top + height; + this->hbPaintSelection( event ); + while( tblock.isValid() && top <= event->rect().bottom() ) { if( tblock.isVisible() && bottom >= event->rect().top() ) @@ -960,7 +979,6 @@ void HBQPlainTextEdit::paintEvent( QPaintEvent * event ) bottom = top + height; ++blockNumber; } - this->hbPaintSelection( event ); #if 0 /* A day wasted - I could not find how I can execute paiting from within prg code */ if( block ) @@ -1115,7 +1133,7 @@ void HBQPlainTextEdit::hbPaintSelection( QPaintEvent * event ) QRect r( x, top, ( w == 0 ? 1 : w ), btm ); - p.fillRect( r, QBrush( QColor( 175, 255, 175 ) ) ); + p.fillRect( r, QBrush( m_selectionColor ) ); } else if( selectionMode == selectionMode_stream ) { @@ -1151,7 +1169,7 @@ void HBQPlainTextEdit::hbPaintSelection( QPaintEvent * event ) { r = QRect( 0, top, width, fontHeight ); } - p.fillRect( r, QBrush( QColor( 175, 255, 175 ) ) ); + p.fillRect( r, QBrush( m_selectionColor ) ); top += fontHeight; } } @@ -1159,7 +1177,7 @@ void HBQPlainTextEdit::hbPaintSelection( QPaintEvent * event ) else if( selectionMode == selectionMode_line ) { QRect r( 0, top, viewport()->width(), btm ); - p.fillRect( r, QBrush( QColor( 175, 255, 175 ) ) ); + p.fillRect( r, QBrush( m_selectionColor ) ); } } } @@ -1824,10 +1842,6 @@ void HBQPlainTextEdit::hbBraceHighlight() QColor lineColor = QColor( Qt::yellow ).lighter( 160 ); QTextDocument *doc = document(); - #if 0 - docLayout = QPlainTextDocumentLayout( doc ); - docLayout->format.setBackground( lineColor ); - #endif extraSelections.clear(); setExtraSelections( extraSelections ); @@ -1870,15 +1884,17 @@ void HBQPlainTextEdit::hbBraceHighlight() closeBrace = ">"; } + QTextCursor cursor1; + QTextCursor cursor2; + QTextCursor matches; + if( brace == openBrace ) { - QTextCursor cursor1 = doc->find( closeBrace, cursor ); - QTextCursor cursor2 = doc->find( openBrace, cursor ); + cursor1 = doc->find( closeBrace, cursor ); + cursor2 = doc->find( openBrace, cursor ); if( cursor2.isNull() ) { - selection.cursor = cursor1; - extraSelections.append( selection ); - setExtraSelections( extraSelections ); + matches = cursor1; } else { @@ -1889,22 +1905,18 @@ void HBQPlainTextEdit::hbBraceHighlight() if( cursor2.isNull() ) break; } - selection.cursor = cursor1; - extraSelections.append( selection ); - setExtraSelections( extraSelections ); + matches = cursor1; } } else { if( brace == closeBrace ) { - QTextCursor cursor1 = doc->find( openBrace, cursor, QTextDocument::FindBackward ); - QTextCursor cursor2 = doc->find( closeBrace, cursor, QTextDocument::FindBackward ); + cursor1 = doc->find( openBrace, cursor, QTextDocument::FindBackward ); + cursor2 = doc->find( closeBrace, cursor, QTextDocument::FindBackward ); if( cursor2.isNull() ) { - selection.cursor = cursor1; - extraSelections.append( selection ); - setExtraSelections( extraSelections ); + matches = cursor1; } else { @@ -1915,12 +1927,21 @@ void HBQPlainTextEdit::hbBraceHighlight() if( cursor2.isNull() ) break; } - selection.cursor = cursor1; - extraSelections.append( selection ); - setExtraSelections( extraSelections ); + matches = cursor1; } } } + if( ! matches.isNull() ) + { + if( m_matchBracesAll ) + { + selection.cursor = cursor; + extraSelections.append( selection ); + } + selection.cursor = cursor1; + extraSelections.append( selection ); + setExtraSelections( extraSelections ); + } } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h index 870527ce76..feb0352c80 100644 --- a/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h +++ b/harbour/contrib/hbqt/hbqt_hbqplaintextedit.h @@ -88,8 +88,10 @@ public: QColor m_currentLineColor; QColor m_lineAreaBkColor; QColor m_horzRulerBkColor; + QColor m_selectionColor; long m_matchingBegin; long m_matchingEnd; + bool m_matchBracesAll; void paintEvent( QPaintEvent * event ); void lineNumberAreaPaintEvent( QPaintEvent * event ); @@ -99,20 +101,20 @@ public: QString styleHightlighter; void hbSetStyleHightlighter( const QString & style ); - QString hbGetStyleHightlighter() { return styleHightlighter; } + QString hbGetStyleHightlighter() { return styleHightlighter; }; void hbShowHighlighter( const QString & style, bool b ); int hbGetIndex( const QTextCursor &crQTextCursor ); int hbGetLine( const QTextCursor &crQTextCursor ); int hbLineNumberAreaWidth(); - int hbGetSpaces() { return spaces; } + int hbGetSpaces() { return spaces; }; void hbSetSpaces( int newSpaces ); void hbBookmarks( int block ); void hbNextBookmark( int block ); void hbPrevBookmark( int block ); void hbGotoBookmark( int block ); - void hbHighlightCurrentLine( bool b ) { highlightCurLine = b; } - bool hbHighlightCurrentLine() { return highlightCurLine; } + void hbHighlightCurrentLine( bool b ) { highlightCurLine = b; update(); }; + bool hbHighlightCurrentLine() { return highlightCurLine; }; void hbSetEventBlock( PHB_ITEM pBlock ); private: @@ -185,10 +187,13 @@ public slots: void hbCut( int key ); void hbCopy(); void hbPaste(); - void hbSetSelectionMode( int mode, bool on ); - void hbGetSelectionInfo(); void hbToStream(); + void hbGetSelectionInfo(); + void hbSetSelectionMode( int mode, bool on ); void hbSetSelectionInfo( PHB_ITEM selectionInfo ); + void hbSetSelectionColor( const QColor & color ); + void hbSetMatchBraces( bool all ){ m_matchBracesAll = all; }; + private slots: void hbSlotCursorPositionChanged(); diff --git a/harbour/contrib/hbqt/qtgui/HBQPlainTextEdit.cpp b/harbour/contrib/hbqt/qtgui/HBQPlainTextEdit.cpp index 786bbc1f6c..e6f391f83f 100644 --- a/harbour/contrib/hbqt/qtgui/HBQPlainTextEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/HBQPlainTextEdit.cpp @@ -776,6 +776,34 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT_HBSETSELECTIONINFO ) } } +/* + * void hbSetSelectionColor( const QColor & color ) + */ +HB_FUNC( QT_HBQPLAINTEXTEDIT_HBSETSELECTIONCOLOR ) +{ + HBQPlainTextEdit * p = hbqt_par_HBQPlainTextEdit( 1 ); + if( p ) + ( p )->hbSetSelectionColor( *hbqt_par_QColor( 2 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQPLAINTEXTEDIT_HBSETSELECTIONCOLOR FP=( p )->hbSetSelectionColor( *hbqt_par_QColor( 2 ) ); p is NULL" ) ); + } +} + +/* + * void hbSetMatchBraces( bool all ) + */ +HB_FUNC( QT_HBQPLAINTEXTEDIT_HBSETMATCHBRACES ) +{ + HBQPlainTextEdit * p = hbqt_par_HBQPlainTextEdit( 1 ); + if( p ) + ( p )->hbSetMatchBraces( hb_parl( 2 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQPLAINTEXTEDIT_HBSETMATCHBRACES FP=( p )->hbSetMatchBraces( hb_parl( 2 ) ); p is NULL" ) ); + } +} + /*----------------------------------------------------------------------*/ #endif /* #if QT_VERSION >= 0x040500 */ diff --git a/harbour/contrib/hbqt/qtgui/THBQPlainTextEdit.prg b/harbour/contrib/hbqt/qtgui/THBQPlainTextEdit.prg index a651a611fd..1a5d16fb68 100644 --- a/harbour/contrib/hbqt/qtgui/THBQPlainTextEdit.prg +++ b/harbour/contrib/hbqt/qtgui/THBQPlainTextEdit.prg @@ -111,6 +111,8 @@ CREATE CLASS HBQPlainTextEdit INHERIT HbQtObjectHandler, QPlainTextEdit METHOD hbSetSelectionMode( nMode, lOn ) METHOD hbGetSelectionInfo() METHOD hbSetSelectionInfo( xSelectionInfo ) + METHOD hbSetSelectionColor( pColor ) + METHOD hbSetMatchBraces( lAll ) ENDCLASS @@ -299,3 +301,11 @@ METHOD HBQPlainTextEdit:hbGetSelectionInfo() METHOD HBQPlainTextEdit:hbSetSelectionInfo( xSelectionInfo ) RETURN Qt_HBQPlainTextEdit_hbSetSelectionInfo( ::pPtr, xSelectionInfo ) + +METHOD HBQPlainTextEdit:hbSetSelectionColor( pColor ) + RETURN Qt_HBQPlainTextEdit_hbSetSelectionColor( ::pPtr, hbqt_ptr( pColor ) ) + + +METHOD HBQPlainTextEdit:hbSetMatchBraces( lAll ) + RETURN Qt_HBQPlainTextEdit_hbSetMatchBraces( ::pPtr, lAll ) + diff --git a/harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth b/harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth index d1d17f0c5e..0009632445 100644 --- a/harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth +++ b/harbour/contrib/hbqt/qth/HBQPlainTextEdit.qth @@ -142,6 +142,9 @@ HB_FUNC( QT_HBQPLAINTEXTEDIT ) void hbSetSelectionMode( int mode, bool on ) void hbGetSelectionInfo() void hbSetSelectionInfo( PHB_ITEM selectionInfo ) + void hbSetSelectionColor( const QColor & color ) + void hbSetMatchBraces( bool all ) +