> y tambien falta la funcion "nClrToCode", que esta en la linea 343 tambien de "inspect.prg"
Aqui esta la version mas actualizada de source/function/valblank.prg que include cClrToCode():
Code: Select all
#ifndef __XPP__
#ifndef __HARBOUR__
#define __CLIPPER__
#endif
#endif
#define CRLF CHR(13)+CHR(10)
#xcommand DEFAULT <uVar1> := <uVal1> ;
[, <uVarN> := <uValN> ] => ;
If( <uVar1> == nil, <uVar1> := <uVal1>, ) ;;
[ If( <uVarN> == nil, <uVarN> := <uValN>, ); ]
//----------------------------------------------------------------------------//
function uValBlank( uValue )
local cType := ValType( uValue )
local uResult
do case
case cType $ "CM"
uResult = Space( Len( uValue ) )
case cType == "N"
uResult = uValue - uValue
case cType == "L"
uResult = .f.
case cType == "D"
uResult = CToD( " - - " )
endcase
return uResult
//----------------------------------------------------------------------------//
function ReadVar()
local nWnd := AScan( GetAllWin(),;
{ | oWnd | oWnd:lFocused .and. oWnd:ClassName() == "TGET" } )
return If( nWnd != 0, GetAllWin()[ nWnd ], nil )
//----------------------------------------------------------------------------//
#ifndef __CLIPPER__
function cValToChar( uVal )
local cType := ValType( uVal )
do case
case cType == "C" .or. cType == "M"
return uVal
case cType == "D"
return DToC( uVal )
case cType == "L"
return If( uVal, ".T.", ".F." )
case cType == "N"
return AllTrim( Str( uVal ) )
case cType == "B"
return "{|| ... }"
case cType == "A"
return "{ ... }"
case cType == "O"
return "Object"
otherwise
return ""
endcase
return nil
#endif
//----------------------------------------------------------------------------//
function cValToStr( uVal, cPic )
local cVal
if uVal == nil
cVal := 'nil'
elseif Empty( cPic )
cVal := cValToChar( uVal )
#ifdef __XHARBOUR__
elseif cPic == '@T'
cVal := TTOC( uVal )
#endif
elseif ValType( uVal ) == 'D' .and. !( cPic = '@' )
cVal := Lower( cPic )
cVal := StrTran( cVal, 'dd', StrZero( Day( uVal ), 2 ) )
if 'mmmm' $ cVal
cVal := StrTran( cVal, 'mmmm', cMonth( uVal ) )
elseif 'mmm' $ cVal
cVal := StrTran( cVal, 'mmm', Left( cMonth( uVal ), 3 ) )
else
cVal := StrTran( cVal, 'mm', StrZero( Month( uVal ), 2 ) )
endif
if 'yyyy' $ cVal
cVal := StrTran( cVal, 'yyyy', Str( Year( uVal ), 4, 0 ) )
else
cVal := StrTran( cVal, 'yy', StrZero( Year( uVal ) % 100, 2 ) )
endif
else
cVal := Transform( uVal, cPic )
endif
return cVal
//----------------------------------------------------------------------------//
function WheelScroll()
#ifndef HKEY_CURRENT_USER
#define HKEY_CURRENT_USER 2147483649 // 0x80000001
#endif
static nScrLines := nil
local oReg
if nScrLines == nil
// oReg:= TReg32():New( HKEY_CURRENT_USER, "Control Panel\Desktop" )
// nScrLines := oReg:Get( "WheelScrollLines" )
// oReg:Close()
if Empty( nScrLines )
nScrLines := 1
else
nScrLines := Val( nScrLines )
endif
endif
return nScrLines
//----------------------------------------------------------------------------//
function nRGBReSet( nClr, r, g, b )
DEFAULT r := nRGBRed( nClr ), ;
g := nRGBGreen( nClr ), ;
b := nRGBBlue( nClr )
r := Min( 255, Max( 0, r ) )
g := Min( 255, Max( 0, g ) )
b := Min( 255, Max( 0, b ) )
return nRGB( r, g, b )
//----------------------------------------------------------------------------//
function nRGBAdd( nClr, r, g, b )
DEFAULT r := 0, g := 0, b := 0
r += nRGBRed( nClr )
g += nRGBGreen( nClr )
b += nRGBBlue( nClr )
r := Min( 255, Max( 0, r ) )
g := Min( 255, Max( 0, g ) )
b := Min( 255, Max( 0, b ) )
return nRGB( r, g, b )
//----------------------------------------------------------------------------//
function cClrToCode( clr )
local cCode := ""
local ctmp1, ctmp2, n
local r,g,b
local cType := ValType( clr )
local aStdClrs := { ;
{ 'CLR_BLACK', 0 }, ;
{ 'CLR_BLUE', 8388608 }, ;
{ 'CLR_GREEN', 32768 }, ;
{ 'CLR_CYAN', 8421376 }, ;
{ 'CLR_RED', 128 }, ;
{ 'CLR_MAGENTA', 8388736 }, ;
{ 'CLR_BROWN', 32896 }, ;
{ 'CLR_HGRAY', 12632256 }, ;
{ 'CLR_LIGHTGRAY', 12632256 }, ;
{ 'CLR_GRAY', 8421504 }, ;
{ 'CLR_HBLUE', 16711680 }, ;
{ 'CLR_HGREEN', 65280 }, ;
{ 'CLR_HCYAN', 16776960 }, ;
{ 'CLR_HRED', 255 }, ;
{ 'CLR_HMAGENTA', 16711935 }, ;
{ 'CLR_YELLOW', 65535 }, ;
{ 'CLR_WHITE', 16777215 } }
if ! Empty( clr )
do case
case cType == 'N'
// cCode += cClrToCode( clr )
if ( n := AScan( aStdClrs, { |a| a[ 2 ] == clr } ) ) > 0
cCode := aStdClrs[ n ][ 1 ]
else
r := nRGBRed( clr ) // clr % 256; clr := Int( clr / 256 )
g := nRGBGreen( clr ) // clr % 256; clr := Int( clr / 256 )
b := nRGBBlue( clr ) // clr % 256
cCode := "RGB(" + Str( r, 4 ) + "," + Str( g, 4 ) + "," + Str( b, 4 ) + " )"
endif
case cType == 'A'
if ValType( clr[ 1 ] ) == 'A'
cCode := '{ ;' + CRLF
for n := 1 to Len( clr )
cCode += Space( 3 ) + cClrToCode( clr[ n ] )
if n < Len( clr )
cCode += ', ;' + CRLF
else
cCode += ' ;' + CRLF
endif
next n
cCode += '}'
else
if Len( clr ) == 1
cCode := '{ ' + cClrToCode( clr ) + ' }'
elseif Len( clr ) == 2
cCode := '{ ' + ;
PadR( cClrToCode( clr[ 1 ] ) + ',', 23 ) + ;
PadR( cClrToCode( clr[ 2 ] ), 22 ) + ' }'
elseif Len( clr ) == 3
cCode := '{ ' + ;
PadR( TrimZero( Str( clr[ 1 ], 6, 4 ) ) + ',', 8 ) + ;
PadR( cClrToCode( clr[ 2 ] ) + ',', 23 ) + ;
PadR( cClrToCode( clr[ 3 ] ), 22 ) + ' }'
endif
endif
case cType == 'B'
cTmp1 := cClrToCode( Eval( clr, .t. ) )
cTmp2 := cClrToCode( Eval( clr, .f. ) )
if cTmp1 == cTmp2
if CRLF $ cTmp1
cTmp1 := Space(3) + StrTran( cTmp1, CRLF, CRLF + Space(3) )
cCode := '{ || ;' + CRLF + cTmp1 + ' ;' + CRLF + '}'
else
cCode := '{ || ' + cTmp1 + ' }'
endif
else
cTmp1 := Space(3) + StrTran( cTmp1, CRLF, CRLF + Space(3) )
cTmp2 := Space(3) + StrTran( cTmp2, CRLF, CRLF + Space(3) )
cCode := '{ | lInvert | If( ! lInvert, ;' + CRLF + ;
cTmp2 + ',;' + CRLF + cTmp1 + ;
' ;' + CRLF + ') }'
endif
endcase
endif
return cCode
//----------------------------------------------------------------------------//
static function TrimZero( c )
do while Right( c, 1 ) == '0'
c := Left( c, Len( c ) - 1 )
enddo
return c
//----------------------------------------------------------------------------//