diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 97a3371ee8..3f2786b20e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,13 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-19 17:17 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.ch + * contrib/hbide/ideactions.prg + * contrib/hbide/hbide.prg + + Implemented ::goto() method. Invoke it by "Goto Line" icon. + + Implemented save/restore position of various dialogs. + 2009-12-20 01:53 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbbtree/hb_btree.c * Fixed 'const' usage in some cast. (some cast were not diff --git a/harbour/contrib/hbide/hbide.ch b/harbour/contrib/hbide/hbide.ch index 293a35682f..1e014da2c2 100644 --- a/harbour/contrib/hbide/hbide.ch +++ b/harbour/contrib/hbide/hbide.ch @@ -70,8 +70,11 @@ #define FunctionListGeometry 5 #define RecentTabIndex 6 #define CurrentProject 7 +#define GotoDialogGeometry 8 +#define PropsDialogGeometry 9 +#define FindDialogGeometry 10 -#define INI_HBIDE_VRBLS 7 +#define INI_HBIDE_VRBLS 10 /* .hbi structure constants */ #define PRJ_PRP_PROPERTIES 1 diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 9e9a65b480..b9a22e4dc3 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -180,6 +180,7 @@ CLASS HbIde METHOD loadConfig() METHOD saveConfig() METHOD setPosAndSizeByIni() + METHOD setPosByIni() METHOD buildDialog() METHOD buildStatusBar() @@ -250,6 +251,7 @@ CLASS HbIde METHOD buildProject() METHOD buildProjectViaQt() METHOD readProcessInfo() + METHOD goto() ENDCLASS @@ -357,6 +359,11 @@ METHOD HbIde:create( cProjIni ) CASE ::mp1 == xbeK_CTRL_S ::saveSource( ::getCurrentTab(), .f. ) + CASE ::mp1 == xbeK_CTRL_G + IF !empty( ::qCurEdit ) + ::goto() + ENDIF + CASE ::mp1 == xbeK_CTRL_F IF !empty( ::qCurEdit ) ::findReplace() @@ -405,13 +412,15 @@ METHOD HbIde:saveConfig() txt_:= {} // Properties aadd( txt_, "[HBIDE]" ) - aadd( txt_, "MainWindowGeometry = " + PosAndSize( ::oDlg:oWidget ) ) - aadd( txt_, "ProjectTreeVisible = " + IIF( ::lProjTreeVisible, "YES", "NO" ) ) - aadd( txt_, "ProjectTreeGeometry = " + PosAndSize( ::oProjTree:oWidget ) ) - aadd( txt_, "FunctionListVisible = " + IIF( ::lDockRVisible, "YES", "NO" ) ) - aadd( txt_, "FunctionListGeometry = " + PosAndSize( ::oFuncList:oWidget ) ) - aadd( txt_, "RecentTabIndex = " + hb_ntos( ::qTabWidget:currentIndex() ) ) - aadd( txt_, "CurrentProject = " + "" ) + aadd( txt_, "MainWindowGeometry = " + PosAndSize( ::oDlg:oWidget ) ) + aadd( txt_, "ProjectTreeVisible = " + IIF( ::lProjTreeVisible, "YES", "NO" ) ) + aadd( txt_, "ProjectTreeGeometry = " + PosAndSize( ::oProjTree:oWidget ) ) + aadd( txt_, "FunctionListVisible = " + IIF( ::lDockRVisible, "YES", "NO" ) ) + aadd( txt_, "FunctionListGeometry = " + PosAndSize( ::oFuncList:oWidget ) ) + aadd( txt_, "RecentTabIndex = " + hb_ntos( ::qTabWidget:currentIndex() ) ) + aadd( txt_, "CurrentProject = " + "" ) + aadd( txt_, "GotoDialogGeometry = " + ::aIni[ INI_HBIDE, GotoDialogGeometry ] ) + aadd( txt_, "PropsDialogGeometry = " + ::aIni[ INI_HBIDE, PropsDialogGeometry ] ) aadd( txt_, " " ) // Projects @@ -445,8 +454,10 @@ METHOD HbIde:saveConfig() METHOD HbIde:loadConfig( cHbideIni ) LOCAL aElem, s, n, nPart, cKey, cVal, a_ - LOCAL aIdeEle := { "mainwindowgeometry", "projecttreevisible", "projecttreegeometry", "functionlistvisible", ; - "functionlistgeometry", "recenttabindex", "currentproject" } + LOCAL aIdeEle := { "mainwindowgeometry" , "projecttreevisible" , "projecttreegeometry", ; + "functionlistvisible", "functionlistgeometry", "recenttabindex" , ; + "currentproject" , "gotodialoggeometry" , "propsdialoggeometry", ; + "finddialoggeometry" } DEFAULT cHbideIni TO "hbide.ini" @@ -465,23 +476,6 @@ METHOD HbIde:loadConfig( cHbideIni ) ::aIni := { afill( array( INI_HBIDE_VRBLS ), "" ), {}, {} } IF file( ::cProjIni ) - #if 0 - [HBIDE] - MainWindowGeometry = - ProjectTreeVisible = - ProjectTreeGeometry = - FunctionListVisible = - FunctionListGeometry = - RecentTabIndex = - CurrentProject = - [PROJECTS] - c:\harbour\contrib\hbide\projects\vouch.hbi - ... - [FILES] - c:\dev_sources\vouch\source\vouch.prg : scrollpos horz : scrollpos vert : CursorPos : - ... - #endif - aElem := ReadSource( ::cProjIni ) FOR EACH s IN aElem @@ -586,6 +580,20 @@ METHOD HbIde:setPosAndSizeByIni( qWidget, nPart ) /*----------------------------------------------------------------------*/ +METHOD HbIde:setPosByIni( qWidget, nPart ) + LOCAL aRect + + IF !empty( ::aIni[ INI_HBIDE, nPart ] ) + aRect := hb_atokens( ::aIni[ INI_HBIDE, nPart ], "," ) + aeval( aRect, {|e,i| aRect[ i ] := val( e ) } ) + + qWidget:move( aRect[ 1 ], aRect[ 2 ] ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD HbIde:manageFocusInEditor() IF ::getCurrentTab() > 0 @@ -1495,6 +1503,12 @@ METHOD HbIde:executeAction( cKey ) IF !empty( ::qCurEdit ) ::findReplace() ENDIF + CASE cKey == "SetMark" + CASE cKey == "GotoMark" + CASE cKey == "Goto" + IF !empty( ::qCurEdit ) + ::goto() + ENDIF CASE cKey == "ToUpper" ::convertSelection( cKey ) CASE cKey == "ToLower" @@ -1661,7 +1675,9 @@ METHOD HbIde:fetchProjectProperties() #endif ENDIF + ::setPosByIni( ::oProps:oWidget, PropsDialogGeometry ) ::oProps:exec() + ::aIni[ INI_HBIDE, PropsDialogGeometry ] := PosAndSize( ::oProps:oWidget ) ::oProps:destroy() ::oProps := NIL @@ -1891,6 +1907,8 @@ METHOD HbIde:readProcessInfo( nMode, iBytes ) RETURN nil /*----------------------------------------------------------------------*/ +// Find / Replace +/*----------------------------------------------------------------------*/ METHOD HbIde:replace() @@ -1914,11 +1932,13 @@ METHOD HbIde:findReplace() ::oFindRepl:create() ::oFindRepl:setWindowFlags( Qt_Sheet ) - ::oFindRepl:signal( "buttonFind" , "clicked()", {|| ::find() } ) - ::oFindRepl:signal( "buttonReplace" , "clicked()", {|| ::replace() } ) - ::oFindRepl:signal( "buttonClose" , "clicked()", {|| ::oFindRepl:hide() } ) + ::oFindRepl:signal( "buttonFind" , "clicked()", {|| ::find() } ) + ::oFindRepl:signal( "buttonReplace", "clicked()", {|| ::replace() } ) + ::oFindRepl:signal( "buttonClose" , "clicked()", ; + {|| ::aIni[ INI_HBIDE, FindDialogGeometry ] := PosAndSize( ::oFindRepl:oWidget ), ::oFindRepl:hide() } ) ENDIF + ::setPosByIni( ::oFindRepl:oWidget, FindDialogGeometry ) ::oFindRepl:qObj[ "comboFindWhat" ]:setFocus() ::oFindRepl:show() @@ -1926,3 +1946,35 @@ METHOD HbIde:findReplace() /*----------------------------------------------------------------------*/ +METHOD HbIde:goto() + LOCAL qGo, nLine + LOCAL qCursor := QTextCursor():configure( ::qCurEdit:textCursor() ) + + nLine := qCursor:blockNumber() + + qGo := QInputDialog():new( ::oDlg:oWidget ) + qGo:setIntMinimum( 1 ) + qGo:setIntMaximum( ::qCurDocument:blockCount() ) + qGo:setIntValue( nLine + 1 ) + qGo:setLabelText( "Goto Line Number ?" ) + qGo:setWindowTitle( "Harbour-Qt" ) + + ::setPosByIni( qGo, GotoDialogGeometry ) + qGo:exec() + ::aIni[ INI_HBIDE, GotoDialogGeometry ] := PosAndSize( qGo ) + + nLine := qGo:intValue() - nLine + + qGo:pPtr := 0 + + IF nLine < 0 + qCursor:movePosition( QTextCursor_Up, QTextCursor_MoveAnchor, abs( nLine ) + 1 ) + ELSEIF nLine > 0 + qCursor:movePosition( QTextCursor_Down, QTextCursor_MoveAnchor, nLine - 1 ) + ENDIF + ::qCurEdit:setTextCursor( qCursor ) + + + RETURN nLine + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index 0d6d747173..07cdcb5f47 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -111,9 +111,9 @@ FUNCTION buildToolBar( oWnd, oIde ) oTBar:addItem( "Find" , cResPath + "find.png" , , , , , "Find" ) oTBar:addItem( "Search" , cResPath + "search.png" , , , , , "Search" ) oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) - oTBar:addItem( "Place/Remove Mark" , cResPath + "placeremovemark.png", , , , , "22" ) - oTBar:addItem( "Goto Mark" , cResPath + "gotomark.png" , , , , , "23" ) - oTBar:addItem( "Goto Line" , cResPath + "gotoline.png" , , , , , "24" ) + oTBar:addItem( "Place/Remove Mark" , cResPath + "placeremovemark.png", , , , , "SetMark" ) + oTBar:addItem( "Goto Mark" , cResPath + "gotomark.png" , , , , , "GotoMark" ) + oTBar:addItem( "Goto Line" , cResPath + "gotoline.png" , , , , , "Goto" ) oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR ) oTBar:addItem( "To Upper" , cResPath + "toupper.png" , , , , , "ToUpper" ) oTBar:addItem( "To Lower" , cResPath + "tolower.png" , , , , , "ToLower" )