From 205a90cd0c0a2e4e94e749b2b3fb28c026c9ac56 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 13 Sep 2007 09:00:40 +0000 Subject: [PATCH] 2007-09-13 10:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * source/rtl/getsys.prg * source/rtl/tgetlist.prg * source/debug/debugger.prg ! Fixed scope violation in debugger by creating a new :Get() method for HBGetList(). ! Fixed some minor issues. % Minor optimization. Like dropping HBGetList():ReadExit() which was just a wrapper to SET( _SET_EXIT ). ! Replaced a few remaining external HBGetList() var accesses with :ReadStats() calls. ! TGetList():GetApplyKey() parameter list rearranged after yesterday to keep it compatible with previous versions. This also avoids a crash in the debugger. --- harbour/ChangeLog | 15 +++++++++++ harbour/source/debug/debugger.prg | 40 ++++++++++++++-------------- harbour/source/rtl/getsys.prg | 43 ++++++++++++++----------------- harbour/source/rtl/tgetlist.prg | 24 ++++++++--------- 4 files changed, 67 insertions(+), 55 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 172a069814..45288a5ed8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,21 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-09-13 10:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * source/rtl/getsys.prg + * source/rtl/tgetlist.prg + * source/debug/debugger.prg + ! Fixed scope violation in debugger by creating + a new :Get() method for HBGetList(). + ! Fixed some minor issues. + % Minor optimization. Like dropping HBGetList():ReadExit() + which was just a wrapper to SET( _SET_EXIT ). + ! Replaced a few remaining external HBGetList() var accesses + with :ReadStats() calls. + ! TGetList():GetApplyKey() parameter list rearranged after + yesterday to keep it compatible with previous versions. + This also avoids a crash in the debugger. + 2007-09-13 04:42 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * source/rtl/memoedit.prg * source/rtl/teditor.prg diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index de80a19ccc..0031e6ade7 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -760,35 +760,35 @@ METHOD CommandWindowProcessKey( nKey ) CLASS HBDebugger CASE nKey == K_UP .OR. nKey == K_F3 IF ::nCommand > 1 - ::oGetListCommand:oGet:Assign() - ::aLastCommands[ ::nCommand ] := Trim( ::oGetListCommand:oGet:VarGet() ) + ::oGetListCommand:Get():Assign() + ::aLastCommands[ ::nCommand ] := Trim( ::oGetListCommand:Get():VarGet() ) ::nCommand-- cCommand := PadR( ::aLastCommands[ ::nCommand ], nWidth ) - ::oGetListCommand:oGet:VarPut( cCommand ) - ::oGetListCommand:oGet:Buffer := cCommand - ::oGetListCommand:oGet:Pos := Len( ::aLastCommands[ ::nCommand ] ) + 1 - ::oGetListCommand:oGet:Display() + ::oGetListCommand:Get():VarPut( cCommand ) + ::oGetListCommand:Get():Buffer := cCommand + ::oGetListCommand:Get():Pos := Len( ::aLastCommands[ ::nCommand ] ) + 1 + ::oGetListCommand:Get():Display() ENDIF CASE nKey == K_DOWN IF ::nCommand < Len( ::aLastCommands ) - ::oGetListCommand:oGet:Assign() - ::aLastCommands[ ::nCommand ] := Trim( ::oGetListCommand:oGet:VarGet() ) + ::oGetListCommand:Get():Assign() + ::aLastCommands[ ::nCommand ] := Trim( ::oGetListCommand:Get():VarGet() ) ::nCommand++ cCommand := PadR( ::aLastCommands[ ::nCommand ], nWidth ) - ::oGetListCommand:oGet:VarPut( cCommand ) - ::oGetListCommand:oGet:Buffer := cCommand - ::oGetListCommand:oGet:Pos := Len( ::aLastCommands[ ::nCommand ] ) + 1 - ::oGetListCommand:oGet:Display() + ::oGetListCommand:Get():VarPut( cCommand ) + ::oGetListCommand:Get():Buffer := cCommand + ::oGetListCommand:Get():Pos := Len( ::aLastCommands[ ::nCommand ] ) + 1 + ::oGetListCommand:Get():Display() ENDIF CASE nKey == K_ENTER /* We must call :Assign() before :VarGet(), because it's no longer * called on every change */ - ::oGetListCommand:oGet:Assign() - cCommand := Trim( ::oGetListCommand:oGet:VarGet() ) + ::oGetListCommand:Get():Assign() + cCommand := Trim( ::oGetListCommand:Get():VarGet() ) IF ! Empty( cCommand ) IF ( n := AScan( ::aLastCommands, cCommand ) ) > 0 .AND. n < Len( ::aLastCommands ) @@ -805,10 +805,10 @@ METHOD CommandWindowProcessKey( nKey ) CLASS HBDebugger DispOutAt( ::oWndCommand:nBottom - 1, ::oWndCommand:nLeft + 1, "> ",; __DbgColors()[ 2 ] ) cCommand := Space( nWidth ) - ::oGetListCommand:oGet:VarPut( cCommand ) - ::oGetListCommand:oGet:Buffer := cCommand - ::oGetListCommand:oGet:Pos := 1 - ::oGetListCommand:oGet:Display() + ::oGetListCommand:Get():VarPut( cCommand ) + ::oGetListCommand:Get():Buffer := cCommand + ::oGetListCommand:Get():Pos := 1 + ::oGetListCommand:Get():Display() OTHERWISE ::oGetListCommand:GetApplyKey( nKey ) @@ -2289,8 +2289,8 @@ METHOD SaveAppScreen() CLASS HBDebugger nTop := 1 nRight := ::nMaxCol ::oWndCommand:Resize( ::nMaxRow - 5, 0, ::nMaxRow - 1, ::nMaxCol ) - ::oGetListCommand:oGet:Row := ::oWndCommand:nBottom - 1 - ::oGetListCommand:oGet:Col := ::oWndCommand:nLeft + 3 + ::oGetListCommand:Get():Row := ::oWndCommand:nBottom - 1 + ::oGetListCommand:Get():Col := ::oWndCommand:nLeft + 3 ::oBrwStack:nTop := 2 ::oBrwStack:nLeft := ::nMaxCol - 14 ::oBrwStack:nRight := ::nMaxCol - 1 diff --git a/harbour/source/rtl/getsys.prg b/harbour/source/rtl/getsys.prg index 03524a2560..ca946239f9 100644 --- a/harbour/source/rtl/getsys.prg +++ b/harbour/source/rtl/getsys.prg @@ -64,6 +64,11 @@ #include "common.ch" #ifdef HB_COMPAT_C53 + +#define SLUPDATED 1 +#define SOACTIVEGET 8 +#define SXREADVAR 9 + FUNCTION ReadModal( GetList, nPos, oMenu, nMsgRow, nMsgLeft, nMsgRight, cMsgColor ) #else FUNCTION ReadModal( GetList, nPos ) @@ -80,9 +85,11 @@ FUNCTION ReadModal( GetList, nPos ) oGetList := HBGetList():New( GetList ) oSaveGetList := __GetListActive( ) -// oSaveGetList:lUpdated := .F. -// oSaveGetList:xReadVar := ReadVar( "" ) -// oSaveGetList:oActiveGet := GetActive( NIL ) +#ifdef HB_COMPAT_C53 +// oSaveGetList:ReadStats( SLUPDATED, .F. ) +// oSaveGetList:ReadStats( SXREADVAR, ReadVar( "" ) ) +// oSaveGetList:ReadStats( SOACTIVEGET, GetActive( NIL ) ) +#endif __GetListSetActive( oGetList ) __GetListLast( oGetList ) @@ -94,9 +101,11 @@ FUNCTION ReadModal( GetList, nPos ) #endif __GetListSetActive( oSaveGetList ) -// oSaveGetList:lUpdated := oGetList:Updated() -// ReadVar( oSaveGetList:xReadVar ) -// GetActive( oSaveGetList:oActiveGet ) +#ifdef HB_COMPAT_C53 +// oSaveGetList:ReadStats( SLUPDATED, oGetList:Updated() ) +// ReadVar( oSaveGetList:ReadStats( SXREADVAR ) ) +// GetActive( oSaveGetList:ReadStats( SOACTIVEGET ) ) +#endif SetPos( MaxRow() - 1, 0 ) @@ -152,9 +161,9 @@ PROCEDURE GetApplyKey( oGet, nKey ) IF oGetList != NIL #ifdef HB_COMPAT_C53 - oGetList:GetApplyKey( oGet, nKey, oMenu, aMsg ) + oGetList:GetApplyKey( nKey, oGet, oMenu, aMsg ) #else - oGetList:GetApplyKey( oGet, nKey ) + oGetList:GetApplyKey( nKey, oGet ) #endif ENDIF @@ -203,11 +212,7 @@ FUNCTION ReadInsert( lInsert ) FUNCTION Updated() LOCAL oGetList := __GetListLast() - IF oGetList != NIL - RETURN oGetList:Updated() - ENDIF - - RETURN .F. + RETURN iif( oGetList != NIL, oGetList:Updated(), .F. ) PROCEDURE __KillRead() LOCAL oGetList := __GetListActive() @@ -369,20 +374,12 @@ PROCEDURE GUIApplyKey( oGet, oGUI, oGetList, nKey, oMenu, aMsg ) FUNCTION GUIPreValidate( oGet, oGUI, aMsg ) LOCAL oGetList := __GetListActive() - IF oGetList != NIL - RETURN oGetList:GUIPreValidate( oGet, oGUI, aMsg ) - ENDIF - - RETURN .F. + RETURN iif( oGetList != NIL, oGetList:GUIPreValidate( oGet, oGUI, aMsg ), .F. ) FUNCTION GUIPostValidate( oGet, oGUI, aMsg ) LOCAL oGetList := __GetListActive() - IF oGetList != NIL - RETURN oGetList:GUIPostValidate( oGet, oGUI, aMsg ) - ENDIF - - RETURN .F. + RETURN iif( oGetList != NIL, oGetList:GUIPostValidate( oGet, oGUI, aMsg ), .F. ) PROCEDURE TBApplyKey( oGet, oTB, oGetList, nKey, aMsg ) diff --git a/harbour/source/rtl/tgetlist.prg b/harbour/source/rtl/tgetlist.prg index 12990e2045..d7c43b4edf 100644 --- a/harbour/source/rtl/tgetlist.prg +++ b/harbour/source/rtl/tgetlist.prg @@ -98,7 +98,7 @@ CREATE CLASS HBGetList #endif METHOD Settle( nPos, lInit ) METHOD Reader( oMenu, aMsg ) - METHOD GetApplyKey( oGet, nKey, oMenu, aMsg ) + METHOD GetApplyKey( nKey, oGet, oMenu, aMsg ) METHOD GetPreValidate( oGet, aMsg ) METHOD GetPostValidate( oGet, aMsg ) METHOD GetDoSetKey( bKeyBlock, oGet ) @@ -111,9 +111,9 @@ CREATE CLASS HBGetList METHOD ShowScoreBoard() METHOD ReadUpdated( lUpdated ) METHOD ReadVar( cNewVarName ) - METHOD ReadExit( lNew ) METHOD SetFocus() - METHOD Updated() + METHOD Updated() // returns ::lUpdated + METHOD Get() // returns ::oGet METHOD GUIReader( oGet, oMenu, aMsg ) METHOD GUIApplyKey( oGet, oGUI, nKey, oMenu, aMsg ) @@ -236,12 +236,12 @@ METHOD ReadModal( nPos ) CLASS HBGetList RETURN Self -METHOD ReadExit( lNew ) CLASS HBGetList - RETURN iif( ISLOGICAL( lNew ), Set( _SET_EXIT, lNew ), Set( _SET_EXIT ) ) - METHOD Updated() CLASS HBGetList RETURN ::lUpdated +METHOD Get() CLASS HBGetList + RETURN ::oGet + METHOD SetFocus() CLASS HBGetList __GetListSetActive( Self ) @@ -288,9 +288,9 @@ METHOD Reader( oMenu, aMsg ) CLASS HBGetList SetCursor( iif( ::nSaveCursor == SC_NONE, SC_NORMAL, ::nSaveCursor ) ) nKey := Inkey( 0 ) SetCursor( SC_NONE ) - ::GetApplyKey( oGet, nKey, oMenu, aMsg ) + ::GetApplyKey( nKey, oGet, oMenu, aMsg ) #else - ::GetApplyKey( oGet, Inkey( 0 ), oMenu, aMsg ) + ::GetApplyKey( Inkey( 0 ), oGet, oMenu, aMsg ) #endif nRow := Row() nCol := Col() @@ -325,7 +325,7 @@ METHOD Reader( oMenu, aMsg ) CLASS HBGetList RETURN Self -METHOD GetApplyKey( oGet, nKey, oMenu, aMsg ) CLASS HBGetList +METHOD GetApplyKey( nKey, oGet, oMenu, aMsg ) CLASS HBGetList LOCAL cKey LOCAL bKeyBlock @@ -709,14 +709,14 @@ METHOD Settle( nPos, lInit ) CLASS HBGetList ENDCASE IF nPos == 0 - IF ! ::ReadExit() .AND. ! ::lBumpBot + IF ! Set( _SET_EXIT ) .AND. ! ::lBumpBot ::lBumpTop := .T. nPos := ::nLastPos nExitState := GE_DOWN ENDIF ELSEIF nPos == Len( ::aGetList ) + 1 - IF ! ::ReadExit() .AND. nExitState != GE_ENTER .AND. ! ::lBumpTop + IF ! Set( _SET_EXIT ) .AND. nExitState != GE_ENTER .AND. ! ::lBumpTop ::lBumpBot := .T. nPos := ::nLastPos nExitState := GE_UP @@ -1577,7 +1577,7 @@ METHOD ReadStats( nElement, xNewValue ) CLASS HBGetList CASE nElement == SNLASTEXIT ; ::nLastExitState := xNewValue CASE nElement == SNLASTPOS ; ::nLastPos := xNewValue CASE nElement == SOACTIVEGET ; ::oActiveGet := xNewValue - CASE nElement == SXREADVAR ; ::cVarName := xNewValue + CASE nElement == SXREADVAR ; ::xReadVar := xNewValue CASE nElement == SCREADPROCNAME ; ::cReadProcName := xNewValue CASE nElement == SNREADPROCLINE ; ::nReadProcLine := xNewValue CASE nElement == SNNEXTGET ; ::nNextGet := xNewValue