diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9812f0befb..b54540217d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,13 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-09-17 18:41 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * source/rtl/tbrowsys.prg + * source/rtl/getsys.prg + * source/rtl/tbrowse.prg + ! Some rearrangements to avoid including the C5.3 + compatible (and yet to be implemented) bloat in tbrowsys.prg + 2007-09-17 13:26 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * tests/rto_get.prg * tests/rto_tb.prg diff --git a/harbour/source/rtl/getsys.prg b/harbour/source/rtl/getsys.prg index 8269da42fe..b7c6fd668d 100644 --- a/harbour/source/rtl/getsys.prg +++ b/harbour/source/rtl/getsys.prg @@ -369,6 +369,18 @@ FUNCTION GUIPostValidate( oGet, oGUI, aMsg ) RETURN iif( oGetList != NIL, oGetList:GUIPostValidate( oGet, oGUI, aMsg ), .F. ) +PROCEDURE TBReader( oGet, oGetList, oMenu, aMsg ) + + IF !ISOBJECT( oGetList ) + oGetList := __GetListActive() + ENDIF + + IF oGetList != NIL + oGetlist:TBReader( oGet, oMenu, aMsg ) + ENDIF + + RETURN + PROCEDURE TBApplyKey( oGet, oTB, oGetList, nKey, aMsg ) IF !ISOBJECT( oGetList ) diff --git a/harbour/source/rtl/tbrowse.prg b/harbour/source/rtl/tbrowse.prg index a35e07784f..bcfbd68255 100644 --- a/harbour/source/rtl/tbrowse.prg +++ b/harbour/source/rtl/tbrowse.prg @@ -451,6 +451,8 @@ METHOD configure( nMode ) CLASS TBrowse // Adds a TBColumn object to the TBrowse object METHOD addColumn( oCol ) CLASS TBrowse + /* NOTE: CA-Cl*pper does no checks at all on the parameters. */ + ::Moved() /* TOFIX: This logic should go inside ::configure() */ ::nColumns++ @@ -469,11 +471,13 @@ METHOD insColumn( nPos, oCol ) CLASS TBrowse /* NOTE: CA-Cl*pper does no checks at all on the parameters. */ +#ifndef HB_C52_STRICT if nPos >= 1 - - ::Moved() /* TOFIX: This logic should go inside ::configure() */ - + if nPos > ::nColumns +#endif + + ::Moved() /* TOFIX: This logic should go inside ::configure() */ /* NOTE: CA-Cl*pper doesn't do this, but crashes instead. */ @@ -484,8 +488,11 @@ METHOD insColumn( nPos, oCol ) CLASS TBrowse AAdd( ::aColsPos, 0 ) AAdd( ::aColsInfo, ::InitColumn( oCol, .F. ) ) +#ifndef HB_C52_STRICT else + ::Moved() /* TOFIX: This logic should go inside ::configure() */ + ::nColumns++ ASize( ::aColumns, ::nColumns ) @@ -503,10 +510,13 @@ METHOD insColumn( nPos, oCol ) CLASS TBrowse ::aColsInfo[ nPos ] := ::InitColumn( oCol, .F. ) endif +#endif ::Configure( 2 ) +#ifndef HB_C52_STRICT endif +#endif return oCol @@ -520,9 +530,12 @@ METHOD setColumn( nPos, oCol ) CLASS TBrowse nPos := _eInstVar( Self, "COLUMN", nPos, "N", 1001 ) oCol := _eInstVar( Self, "COLUMN", oCol, "O", 1001 ) - /* NOTE: CA-Cl*pper doesn't check nPos range (and type in C5.3), but crashes instead. */ + /* NOTE: CA-Cl*pper doesn't check nPos range (and type in C5.3 - I didn't implement this behaviour), + but crashes instead. */ +#ifndef HB_C52_STRICT if nPos >= 1 .AND. nPos <= ::nColumns +#endif ::Moved() /* TOFIX: This logic should go inside ::configure() */ @@ -535,7 +548,9 @@ METHOD setColumn( nPos, oCol ) CLASS TBrowse ::Configure( 2 ) +#ifndef HB_C52_STRICT endif +#endif endif /* NOTE: CA-Cl*pper 5.2 NG says this will return the previously set @@ -592,7 +607,11 @@ METHOD delColumn( nPos ) CLASS TBrowse // Gets a specific TBColumn object METHOD getColumn( nColumn ) CLASS TBrowse +#ifdef HB_C52_STRICT + return ::aColumns[ nColumn ] +#else return iif( nColumn > 0 .and. nColumn <= ::nColumns, ::aColumns[ nColumn ], NIL ) +#endif // Returns the display width of a particular column METHOD colWidth( nColumn ) CLASS TBrowse @@ -2313,3 +2332,36 @@ STATIC FUNCTION tbr_CalcWidth( xValue, cType, cPicture ) ENDSWITCH RETURN 0 + +/* -------------------------------------------- */ + +FUNCTION TBMouse( oBrowse, nMRow, nMCol ) + + LOCAL n + + IF oBrowse:hitTest( nMRow, nMCol ) == HTCELL + + n := oBrowse:mRowPos - oBrowse:rowPos + DO WHILE n < 0 + n++ + oBrowse:up() + ENDDO + DO WHILE n > 0 + n-- + oBrowse:down() + ENDDO + + n := oBrowse:mColPos - oBrowse:colPos + DO WHILE n < 0 + n++ + oBrowse:left() + ENDDO + DO WHILE n > 0 + n-- + oBrowse:right() + ENDDO + + RETURN TBR_CONTINUE + ENDIF + + RETURN TBR_EXCEPTION diff --git a/harbour/source/rtl/tbrowsys.prg b/harbour/source/rtl/tbrowsys.prg index 2ffc5ab05c..b17945cc6a 100644 --- a/harbour/source/rtl/tbrowsys.prg +++ b/harbour/source/rtl/tbrowsys.prg @@ -56,49 +56,6 @@ #include "common.ch" #include "tbrowse.ch" -PROCEDURE TBReader( oGet, oGetList, oMenu, aMsg ) - - IF !ISOBJECT( oGetList ) - oGetList := __GetListActive() - ENDIF - - IF oGetList != NIL - oGetlist:TBReader( oGet, oMenu, aMsg ) - ENDIF - - RETURN - -FUNCTION TBMouse( oBrowse, nMRow, nMCol ) - - LOCAL n - - IF oBrowse:hitTest( nMRow, nMCol ) == HTCELL - - n := oBrowse:mRowPos - oBrowse:rowPos - DO WHILE n < 0 - n++ - oBrowse:up() - ENDDO - DO WHILE n > 0 - n-- - oBrowse:down() - ENDDO - - n := oBrowse:mColPos - oBrowse:colPos - DO WHILE n < 0 - n++ - oBrowse:left() - ENDDO - DO WHILE n > 0 - n-- - oBrowse:right() - ENDDO - - RETURN TBR_CONTINUE - ENDIF - - RETURN TBR_EXCEPTION - FUNCTION TApplyKey( nKey, oBrowse ) RETURN oBrowse:applyKey( nKey ) @@ -107,10 +64,6 @@ FUNCTION TBAddCol() /* TODO */ RETURN NIL -FUNCTION TBApplyKey() - /* TODO */ - RETURN NIL - FUNCTION TBBBlock() /* TODO */ RETURN NIL