diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b0b8c13a03..2b54f6def8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,19 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-05 02:40 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/gtwvg/*.prg + * formatted using hbformat, critical manual fixups + ; TOFIX: hbformat breaks code like this: + FUNCTION Hello( /* comment */ ) + + * contrib/gtwvg/tests/*.prg + * formatted using hbformat, manual fixups + + * extras/gtwvw/*.c + * extras/gtwvw/*.h + * formatted using uncrustify + hbc.cfg + 2012-10-05 01:18 UTC+0200 Viktor Szakats (vszakats syenar.net) - extras/gtwvw/readme.txt - empty file deleted diff --git a/harbour/contrib/gtwvg/3state.prg b/harbour/contrib/gtwvg/3state.prg index 1208781317..cfaf9c7319 100644 --- a/harbour/contrib/gtwvg/3state.prg +++ b/harbour/contrib/gtwvg/3state.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -101,7 +102,8 @@ CLASS Wvg3State INHERIT WvgWindow, WvgDataRef METHOD handleEvent( nMessage, aNM ) - ENDCLASS +ENDCLASS + // METHOD Wvg3State:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -148,7 +150,7 @@ METHOD Wvg3State:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD Wvg3State:handleEvent( nMessage, aNM ) - hb_traceLog( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + hb_traceLog( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage ) DO CASE @@ -157,7 +159,7 @@ METHOD Wvg3State:handleEvent( nMessage, aNM ) ::editBuffer := WVG_Button_GetCheck( ::hWnd ) IF HB_ISBLOCK( ::sl_lbClick ) - eval( ::sl_lbClick, ::editBuffer, NIL, self ) + Eval( ::sl_lbClick, ::editBuffer, NIL, self ) RETURN 0 ENDIF diff --git a/harbour/contrib/gtwvg/activex.prg b/harbour/contrib/gtwvg/activex.prg index 5a532d864c..b8cd92b7d5 100644 --- a/harbour/contrib/gtwvg/activex.prg +++ b/harbour/contrib/gtwvg/activex.prg @@ -50,6 +50,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -90,7 +91,7 @@ CLASS WvgActiveXControl FROM WvgWindow DATA server INIT NIL DATA license INIT NIL DATA controlFlags INIT 0 - DATA default INIT .F. + DATA DEFAULT INIT .F. DATA cancel INIT .F. DATA interface @@ -125,7 +126,7 @@ CLASS WvgActiveXControl FROM WvgWindow ERROR HANDLER OnError - ENDCLASS +ENDCLASS // @@ -143,6 +144,7 @@ METHOD WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisibl // METHOD WvgActiveXControl:Create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLicense ) + LOCAL hObj, hWnd ::WvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -165,15 +167,15 @@ METHOD WvgActiveXControl:Create( oParent, oOwner, aPos, aSize, aPresParams, lVis Win_AxInit() hWnd := WAPI_CreateWindowEX( ::exStyle, "AtlAxWin", ::CLSID, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ; - ::aSize[ 1 ], ::aSize[ 2 ], Win_N2P( ::hContainer ), 0 ) - IF empty( hWnd ) + ::aSize[ 1 ], ::aSize[ 2 ], Win_N2P( ::hContainer ), 0 ) + IF Empty( hWnd ) RETURN NIL ENDIF ::hWnd := Win_P2N( hWnd ) ::pWnd := hWnd hObj := __AxGetControl( ::pWnd ) - if empty( hObj ) + IF Empty( hObj ) RETURN NIL ENDIF ::oOLE:__hObj := hObj @@ -203,16 +205,18 @@ METHOD WvgActiveXControl:Create( oParent, oOwner, aPos, aSize, aPresParams, lVis // PROCEDURE execEvent( nEvent, ... ) CLASS WvgActiveXControl + #if 0 - LOCAL cEvents := HB_ValToStr( nEvent ) + ", " + + LOCAL cEvents := hb_ValToStr( nEvent ) + ", " LOCAL aEvents := { ... } - aEval( aEvents, {| xEvent | cEvents += HB_ValToStr( xEvent ) + ", " } ) - hb_TraceLog( cEvents ) + AEval( aEvents, {| xEvent | cEvents += hb_ValToStr( xEvent ) + ", " } ) + hb_traceLog( cEvents ) #endif - IF hb_hHaskey( ::hEvents, nEvent ) - eval( ::hEvents[ nEvent ], ... ) + IF hb_HHasKey( ::hEvents, nEvent ) + Eval( ::hEvents[ nEvent ], ... ) ENDIF RETURN @@ -220,6 +224,7 @@ PROCEDURE execEvent( nEvent, ... ) CLASS WvgActiveXControl // METHOD WvgActiveXControl:handleEvent( nEvent, aNM ) + LOCAL nHandled := 0 HB_SYMBOL_UNUSED( aNM ) @@ -231,7 +236,7 @@ METHOD WvgActiveXControl:handleEvent( nEvent, aNM ) ::rePosition() ENDIF IF HB_ISBLOCK( ::sl_resize ) - eval( ::sl_resize, NIL, NIL, Self ) + Eval( ::sl_resize, NIL, NIL, Self ) ENDIF EXIT @@ -245,16 +250,19 @@ METHOD WvgActiveXControl:handleEvent( nEvent, aNM ) // METHOD WvgActiveXControl:OnError() + #if 0 - hb_TraceLog( "HI: " + HB_ValToStr( __GetMessage() ) + " : " + str( len( HB_AParams() ) ) ) + + hb_traceLog( "HI: " + hb_ValToStr( __GetMessage() ) + " : " + Str( Len( hb_AParams() ) ) ) #endif - RETURN HB_ExecFromArray( ::oOLE, __GetMessage(), HB_AParams() ) + + RETURN hb_ExecFromArray( ::oOLE, __GetMessage(), hb_AParams() ) // METHOD WvgActiveXControl:Destroy() - IF ! empty( ::oOLE:__hObj ) + IF ! Empty( ::oOLE:__hObj ) IF WAPI_IsWindow( ::pWnd ) WAPI_DestroyWindow( ::pWnd ) ENDIF @@ -277,63 +285,75 @@ METHOD WvgActiveXControl:mapEvent( nEvent, bBlock ) // METHOD WvgActiveXControl:inheritPresParams() - Local lSuccess := .T. + + LOCAL lSuccess := .T. RETURN lSuccess // METHOD WvgActiveXControl:presParamsChanged() + RETURN Self // METHOD WvgActiveXControl:setInputFocus() + RETURN Self // METHOD WvgActiveXControl:subscribeStdEvents() + RETURN NIL // METHOD WvgActiveXControl:unsubscribeStdEvents() + RETURN Self // METHOD WvgActiveXControl:keyDown() + RETURN Self // METHOD WvgActiveXControl:click() + RETURN Self // METHOD WvgActiveXControl:dblClick() + RETURN Self // METHOD WvgActiveXControl:mouseDown() + RETURN Self // METHOD WvgActiveXControl:mouseUp() + RETURN Self // METHOD WvgActiveXControl:mouseMove() + RETURN Self // METHOD WvgActiveXControl:activate() + RETURN Self // diff --git a/harbour/contrib/gtwvg/bitmap.prg b/harbour/contrib/gtwvg/bitmap.prg index ebde5fb603..a91bb17ae5 100644 --- a/harbour/contrib/gtwvg/bitmap.prg +++ b/harbour/contrib/gtwvg/bitmap.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -112,7 +113,7 @@ CLASS WvgBitmap METHOD getPicture() VIRTUAL METHOD setPicture() VIRTUAL - ENDCLASS +ENDCLASS // diff --git a/harbour/contrib/gtwvg/checkbox.prg b/harbour/contrib/gtwvg/checkbox.prg index 36b1e325ad..98724970a0 100644 --- a/harbour/contrib/gtwvg/checkbox.prg +++ b/harbour/contrib/gtwvg/checkbox.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -89,17 +90,18 @@ CLASS WvgCheckBox INHERIT WvgWindow, WvgDataRef METHOD destroy() METHOD handleEvent( nMessage, aNM ) - #if 0 +#if 0 METHOD editBuffer() INLINE ( WVG_Button_GetCheck( ::hWnd ) == BST_CHECKED ) METHOD getData() INLINE ( WVG_Button_GetCheck( ::hWnd ) == BST_CHECKED ) METHOD setData( lCheck ) INLINE ::sendMessage( BM_SETCHECK, iif( lCheck, BST_CHECKED, BST_UNCHECKED ), 0 ) - #endif +#endif METHOD setCaption( xCaption ) ACCESS selected INLINE ::sl_lbClick ASSIGN selected( bBlock ) INLINE ::sl_lbClick := bBlock - ENDCLASS +ENDCLASS + // METHOD WvgCheckBox:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -158,7 +160,7 @@ METHOD WvgCheckBox:handleEvent( nMessage, aNM ) IF ::isParentCrt() ::oParent:setFocus() ENDIF - eval( ::sl_lbClick, ::editBuffer, NIL, Self ) + Eval( ::sl_lbClick, ::editBuffer, NIL, Self ) IF ::pointerFocus ::setFocus() ENDIF @@ -184,7 +186,7 @@ METHOD WvgCheckBox:handleEvent( nMessage, aNM ) ::oParent:setFocus() ::sendMessage( BM_SETCHECK, iif( WVG_Button_GetCheck( ::hWnd ) == BST_CHECKED, BST_UNCHECKED, BST_CHECKED ), 0 ) ::editBuffer := ( WVG_Button_GetCheck( ::hWnd ) == BST_CHECKED ) - eval( ::sl_lbClick, NIL, NIL, Self ) + Eval( ::sl_lbClick, NIL, NIL, Self ) ENDIF ENDIF ENDIF @@ -197,13 +199,17 @@ METHOD WvgCheckBox:handleEvent( nMessage, aNM ) // METHOD WvgCheckBox:destroy() + ::wvgWindow:destroy() + RETURN NIL // METHOD WvgCheckBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + RETURN Self // diff --git a/harbour/contrib/gtwvg/class.prg b/harbour/contrib/gtwvg/class.prg index 22d91a188a..6495fe66ac 100644 --- a/harbour/contrib/gtwvg/class.prg +++ b/harbour/contrib/gtwvg/class.prg @@ -54,6 +54,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -146,7 +147,7 @@ CLASS wvtDialog DATA nCurObj INIT 1 DATA nLastObj INIT 0 DATA nObjOver INIT 0 - DATA nLastOver INIT -1 + DATA nLastOver INIT - 1 DATA nUseObj DATA oMenu DATA aDialogKeys INIT {} @@ -168,10 +169,10 @@ CLASS wvtDialog DATA lTabStops INIT .F. DATA bOnCreate - ACCESS nObjects INLINE len( ::aObjects ) + ACCESS nObjects INLINE Len( ::aObjects ) - METHOD New( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth,nFontBold,nFontQuality ) - METHOD Create() + METHOD New( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth, nFontBold, nFontQuality ) + METHOD create() METHOD Destroy() METHOD Event() METHOD Execute() @@ -179,20 +180,21 @@ CLASS wvtDialog METHOD MouseOver() METHOD Update() METHOD CreateObjects() - METHOD Eval( bBlock, p1,p2,p3,p4,p5 ) + METHOD Eval( bBlock, p1, p2, p3, p4, p5 ) METHOD ActivateMenu() - METHOD AddObject( oObject ) INLINE aadd( ::aObjects, oObject ) + METHOD AddObject( oObject ) INLINE AAdd( ::aObjects, oObject ) METHOD MaxRow() INLINE ::nRows - 1 METHOD MaxCol() INLINE ::nCols - 1 - METHOD OnTimer() INLINE aeval( ::aObjects, {| o | o:OnTimer() } ) + METHOD OnTimer() INLINE AEval( ::aObjects, {| o | o:OnTimer() } ) - ENDCLASS +ENDCLASS // -METHOD wvtDialog:New( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth,nFontBold,nFontQuality ) - LOCAL fnt_:= Wvt_GetFontInfo() +METHOD wvtDialog:New( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth, nFontBold, nFontQuality ) + + LOCAL fnt_ := Wvt_GetFontInfo() DEFAULT nRows TO 25 DEFAULT nCols TO 80 @@ -203,18 +205,18 @@ METHOD wvtDialog:New( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth,nFont DEFAULT nFontBold TO fnt_[ 4 ] DEFAULT nFontQuality TO fnt_[ 5 ] - IF empty( cFont ) + IF Empty( cFont ) cFont := fnt_[ 1 ] ENDIF - IF empty( nFontHeight ) + IF Empty( nFontHeight ) nFontHeight := fnt_[ 2 ] ENDIF - IF empty( nFontWidth ) + IF Empty( nFontWidth ) nFontWidth := fnt_[ 3 ] ENDIF - ::nOldRows := MaxRow()+1 - ::nOldCols := MaxCol()+1 + ::nOldRows := MaxRow() + 1 + ::nOldCols := MaxCol() + 1 ::aOldFont := Wvt_GetFontInfo() ::cOldTitle := Wvt_GetTitle() ::cOldColor := SetColor() @@ -237,7 +239,7 @@ METHOD wvtDialog:New( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth,nFont ::nFontBold := nFontBold ::nFontQuality := nFontQuality - ::cPaintBlockID := strzero( Hb_Random( 99999998 ),8 ) + ::cPaintBlockID := StrZero( hb_Random( 99999998 ), 8 ) ::nObjOver := 0 ::nKey := 0 ::cColor := "N/W" @@ -249,6 +251,7 @@ METHOD wvtDialog:New( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth,nFont // METHOD wvtDialog:Create() + LOCAL aPalette, i, j ::oldToolTipActive := Wvt_SetToolTipActive( .T. ) @@ -263,20 +266,20 @@ METHOD wvtDialog:Create() ENDIF aPalette := Wvt_GetPalette() - aPalette[ 9 ] := RGB( 175,175,175 ) + aPalette[ 9 ] := RGB( 175, 175, 175 ) Wvt_SetPalette( aPalette ) - ::cScreen := SaveScreen( 0, 0, maxrow(), maxcol() ) - ::aWvtScreen := Wvt_SaveScreen( 0, 0, maxrow(), maxcol() ) + ::cScreen := SaveScreen( 0, 0, MaxRow(), MaxCol() ) + ::aWvtScreen := Wvt_SaveScreen( 0, 0, MaxRow(), MaxCol() ) ::aOldPnt := WvtSetPaint( {} ) SetMode( ::nRows, ::nCols ) - do while .T. + DO WHILE .T. IF Wvt_SetFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontBold, ::nFontQuality ) EXIT ENDIF ::nFontHeight-- - enddo + ENDDO /* Wvt_SetFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontBold, ::nFontQuality ) */ SetMode( ::nRows, ::nCols ) @@ -288,21 +291,21 @@ METHOD wvtDialog:Create() ::CreateObjects() - IF len( ::aObjects ) > 0 + IF Len( ::aObjects ) > 0 ::oCurObj := ::aObjects[ 1 ] ENDIF - FOR i := 1 to len( ::aObjects ) - IF !empty( ::aObjects[ i ]:aPaint ) - FOR j := 1 to len( ::aObjects[ i ]:aPaint ) + FOR i := 1 TO Len( ::aObjects ) + IF !Empty( ::aObjects[ i ]:aPaint ) + FOR j := 1 TO Len( ::aObjects[ i ]:aPaint ) wvg_SetPaint( ::cPaintBlockID, ::nPaintID++, ; - ::aObjects[ i ]:aPaint[ j,1 ], ::aObjects[ i ]:aPaint[ j,2 ] ) - next + ::aObjects[ i ]:aPaint[ j,1 ], ::aObjects[ i ]:aPaint[ j,2 ] ) + NEXT ENDIF - next + NEXT WvtSetPaint( wvg_GetPaint( ::cPaintBlockID ) ) - IF ascan( ::aObjects, {| o | o:lTabStop } ) > 0 + IF AScan( ::aObjects, {| o | o:lTabStop } ) > 0 ::lTabStops := .T. ENDIF @@ -324,9 +327,9 @@ METHOD wvtDialog:Destroy() ::oMenu:Destroy() ENDIF - aeval( ::aObjects, {| o | o:destroy() } ) + AEval( ::aObjects, {| o | o:destroy() } ) - Wvt_SetTooltip( 0,0,0,0,"" ) + Wvt_SetTooltip( 0, 0, 0, 0, "" ) Wvt_SetTooltipActive( ::oldToolTipActive ) Wvt_setTooltipWidth( ::oldTooltipWidth ) Wvt_SetTooltipBkColor( ::oldTooltipBkColor ) @@ -343,25 +346,25 @@ METHOD wvtDialog:Destroy() SetColor( ::cOldColor ) SetCursor( ::nOldCursor ) - IF ::oldMenuHandle != nil .and. ::oldMenuHandle != 0 + IF ::oldMenuHandle != nil .AND. ::oldMenuHandle != 0 Wvt_SetMenu( ::oldMenuHandle ) ENDIF SetKey( Wvt_SetMenuKeyEvent(), ::oldMenuBlock ) - RestScreen( 0, 0, maxrow(), maxcol(), ::cScreen ) - Wvt_RestScreen( 0, 0 ,maxrow(), maxcol(), ::aWvtScreen ) + RestScreen( 0, 0, MaxRow(), MaxCol(), ::cScreen ) + Wvt_RestScreen( 0, 0 , MaxRow(), MaxCol(), ::aWvtScreen ) wvg_PurgePaint( ::cPaintBlockID ) WvtSetPaint( ::aOldPnt ) Wvt_SetGui( ::lGui ) - RETURN nil // METHOD wvtDialog:Event() + LOCAL nKey - IF ( nKey := inkey( 0.1, INKEY_ALL + HB_INKEY_GTEVENT ) ) == 0 + IF ( nKey := Inkey( 0.1, INKEY_ALL + HB_INKEY_GTEVENT ) ) == 0 IF Wvt_IsLButtonPressed() nKey := K_LBUTTONPRESSED ENDIF @@ -375,7 +378,7 @@ METHOD wvtDialog:Execute() IF ::nObjects == 0 DO WHILE .T. - IF inkey( 0.1, INKEY_ALL + HB_INKEY_GTEVENT ) == K_ESC + IF Inkey( 0.1, INKEY_ALL + HB_INKEY_GTEVENT ) == K_ESC EXIT ENDIF ENDDO @@ -389,6 +392,7 @@ METHOD wvtDialog:Execute() // METHOD wvtDialog:Inkey() + LOCAL n, oObj, nID, i ::lEventHandled := .F. @@ -398,7 +402,7 @@ METHOD wvtDialog:Inkey() ::OnTimer() IF ::nKey != 0 - IF ::nKey == K_ESC .or. ::nKey == K_CTRL_ENTER + IF ::nKey == K_ESC .OR. ::nKey == K_CTRL_ENTER RETURN K_ESC ENDIF @@ -434,11 +438,11 @@ METHOD wvtDialog:Inkey() ::lEventHandled := .T. - CASE ::nKey == K_MOUSEMOVE .or. ::nKey == K_MMLEFTDOWN + CASE ::nKey == K_MOUSEMOVE .OR. ::nKey == K_MMLEFTDOWN ::MouseOver() IF ::nObjOver == 0 Wvt_SetPointer( WVT_IDC_ARROW ) - ELSEIF ::oObjOver:nPointer != nil .and. ::oObjOver:lActive + ELSEIF ::oObjOver:nPointer != nil .AND. ::oObjOver:lActive Wvt_SetPointer( ::oObjOver:nPointer ) ELSE Wvt_SetPointer( WVT_IDC_ARROW ) @@ -447,25 +451,25 @@ METHOD wvtDialog:Inkey() ENDCASE - IF ::nKey == K_LBUTTONDOWN .or. ; - ::nKey == K_LBUTTONUP .or. ; - ::nKey == K_LDBLCLK .or. ; - ::nKey == K_MMLEFTDOWN .or. ; - ::nKey == K_LBUTTONPRESSED .or. ; + IF ::nKey == K_LBUTTONDOWN .OR. ; + ::nKey == K_LBUTTONUP .OR. ; + ::nKey == K_LDBLCLK .OR. ; + ::nKey == K_MMLEFTDOWN .OR. ; + ::nKey == K_LBUTTONPRESSED .OR. ; ::nKey == K_RBUTTONDOWN ::MouseOver() IF ::nObjOver > 0 - IF ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_BUTTON .or. ; - ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_TOOLBAR .or. ; - ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_PUSHBUTTON .or. ; + IF ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_BUTTON .OR. ; + ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_TOOLBAR .OR. ; + ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_PUSHBUTTON .OR. ; ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_SCROLLBAR oObj := ::aObjects[ ::nObjOver ] IF oObj:oParent:ClassName == "WVTBROWSE" nID := oObj:oParent:nID - IF ( n := ascan( ::aObjects, {| o | o:nID == nID } ) ) > 0 + IF ( n := AScan( ::aObjects, {| o | o:nID == nID } ) ) > 0 ::nCurObj := n ENDIF ENDIF @@ -492,13 +496,13 @@ METHOD wvtDialog:Inkey() ENDIF IF ::nObjOver == 0 - Wvt_SetTooltip( 0,0,0,0,"" ) + Wvt_SetTooltip( 0, 0, 0, 0, "" ) ELSEIF ::oObjOver:lActive ::oObjOver:SetTooltip() ELSE - Wvt_SetTooltip( 0,0,0,0,"" ) + Wvt_SetTooltip( 0, 0, 0, 0, "" ) ENDIF ENDIF @@ -518,7 +522,7 @@ METHOD wvtDialog:Inkey() ::oLastObj := ::aObjects[ ::nCurObj ] IF ::oCurObj:nType == DLG_OBJ_BROWSE - Select( ::oCurObj:cAlias ) + SELECT( ::oCurObj:cAlias ) ENDIF @@ -570,14 +574,14 @@ METHOD wvtDialog:Inkey() ENDIF ENDIF - IF ::nKey == K_RBUTTONDOWN .and. ::nUseObj > 0 + IF ::nKey == K_RBUTTONDOWN .AND. ::nUseObj > 0 ::lEventHandled := ::aObjects[ ::nUseObj ]:ShowPopup() ENDIF IF !( ::lEventHandled ) IF ::nCurObj > 0 - IF !empty( ::aDialogKeys ) - IF ( n := ascan( ::aDialogKeys, {| e_ | e_[ 1 ] == ::nKey } ) ) > 0 + IF !Empty( ::aDialogKeys ) + IF ( n := AScan( ::aDialogKeys, {| e_ | e_[ 1 ] == ::nKey } ) ) > 0 Eval( ::aDialogKeys[ n, 2 ], self, ::oCurObj ) ENDIF ENDIF @@ -587,10 +591,10 @@ METHOD wvtDialog:Inkey() IF ( ::lEventHandled ) IF ::oCurObj:nChildren > 0 FOR i := 1 to ::oCurObj:nChildren - IF ascan( ::oCurObj:aChildren[ i, OBJ_CHILD_EVENTS ],::nKey ) > 0 + IF AScan( ::oCurObj:aChildren[ i, OBJ_CHILD_EVENTS ], ::nKey ) > 0 ::oCurObj:NotifyChild( i, ::nKey, ::oCurObj ) ENDIF - next + NEXT ENDIF ENDIF ENDIF @@ -608,15 +612,16 @@ METHOD wvtDialog:Inkey() // METHOD wvtDialog:MouseOver() + LOCAL mRow := MRow() LOCAL mCol := MCol() LOCAL nObj - nObj := ascan( ::aObjects, ; - {| o | o:nType != DLG_OBJ_STATIC .AND. ; - o:nType != DLG_OBJ_TOOLBAR .AND. ; - mRow >= o:nTop .AND. mRow <= o:nBottom .AND. ; - mCol >= o:nLeft .AND. mCol <= o:nRight } ) + nObj := AScan( ::aObjects, ; + {| o | o:nType != DLG_OBJ_STATIC .AND. ; + o:nType != DLG_OBJ_TOOLBAR .AND. ; + mRow >= o:nTop .AND. mRow <= o:nBottom .AND. ; + mCol >= o:nLeft .AND. mCol <= o:nRight } ) ::nObjOver := nObj ::oObjOver := iif( nObj > 0, ::aObjects[ nObj ], nil ) @@ -632,18 +637,19 @@ METHOD wvtDialog:MouseOver() METHOD wvtDialog:Update() - Wvt_InvalidateRect( 0, 0, ::maxrow(), ::maxcol() ) + Wvt_InvalidateRect( 0, 0, ::MaxRow(), ::MaxCol() ) RETURN Self // METHOD wvtDialog:CreateObjects() + LOCAL i, nObjs - nObjs := len( ::aObjects ) + nObjs := Len( ::aObjects ) - FOR i := 1 to nObjs + FOR i := 1 TO nObjs switch ::aObjects[ i ]:nType CASE DLG_OBJ_BROWSE @@ -688,17 +694,18 @@ METHOD wvtDialog:CreateObjects() ::aObjects[ i ]:Create() EXIT end - next + NEXT RETURN self // -METHOD wvtDialog:Eval( bBlock, p1,p2,p3,p4,p5 ) +METHOD wvtDialog:Eval( bBlock, p1, p2, p3, p4, p5 ) + LOCAL lRet IF ( lRet := HB_ISBLOCK( bBlock ) ) - eval( bBlock, p1,p2,p3,p4,p5 ) + Eval( bBlock, p1, p2, p3, p4, p5 ) ENDIF RETURN lRet @@ -706,14 +713,15 @@ METHOD wvtDialog:Eval( bBlock, p1,p2,p3,p4,p5 ) // METHOD wvtDialog:ActivateMenu() - LOCAL nMenu:= Wvt_GetLastMenuEvent() + + LOCAL nMenu := Wvt_GetLastMenuEvent() LOCAL aMenuItem - IF !EMPTY( nMenu ) + IF !Empty( nMenu ) IF HB_ISOBJECT( ::oMenu ) - IF !EMPTY( aMenuItem := ::oMenu:FindMenuItemById( nMenu ) ) + IF !Empty( aMenuItem := ::oMenu:FindMenuItemById( nMenu ) ) IF HB_ISBLOCK( aMenuItem[ WVT_MENU_ACTION ] ) - EVAL( aMenuItem[ WVT_MENU_ACTION ] ) + Eval( aMenuItem[ WVT_MENU_ACTION ] ) ENDIF ENDIF ENDIF @@ -810,11 +818,11 @@ CLASS WvtObject DATA bOnHilite INIT {|| NIL } DATA bOnDeHilite INIT {|| NIL } - ACCESS nChildren INLINE len( ::aChildren ) + ACCESS nChildren INLINE Len( ::aChildren ) DATA nIndexOrder METHOD New( oParent, nType, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD Destroy() METHOD CreatePopup() METHOD ShowPopup() @@ -822,8 +830,8 @@ CLASS WvtObject METHOD SetToolTip() INLINE Wvt_SetToolTip( ::nTop, ::nLeft, ::nBottom, ::nRight, ::Tooltip ) METHOD Refresh() INLINE Wvt_InvalidateRect( ::nTop, ::nLeft, ::nTop, ::nLeft ) METHOD Eval( bBlock ) INLINE iif( HB_ISBLOCK( bBlock ), Eval( bBlock, self ), nil ) - METHOD AddChild( aChild ) INLINE aadd( ::aChildren, aChild ) - METHOD AddParent( aParent ) INLINE aadd( ::aParent, aParent ) + METHOD AddChild( aChild ) INLINE AAdd( ::aChildren, aChild ) + METHOD AddParent( aParent ) INLINE AAdd( ::aParent, aParent ) METHOD PaintBlock() INLINE nil METHOD Hilite() INLINE nil @@ -842,7 +850,7 @@ CLASS WvtObject METHOD DeActivate() INLINE nil METHOD NotifyChild( /*nChild*/ ) INLINE nil - ENDCLASS +ENDCLASS // @@ -954,19 +962,20 @@ METHOD WvtObject:Destroy() // METHOD WvtObject:CreatePopup() + LOCAL i, nID - IF !empty( ::aPopup ) .and. ::hPopup == nil + IF !Empty( ::aPopup ) .AND. ::hPopup == nil ::hPopup := Wvt_CreatePopupMenu() - FOR i := 1 to len( ::aPopup ) + FOR i := 1 TO Len( ::aPopup ) - aSize( ::aPopup[ i ],3 ) + ASize( ::aPopup[ i ], 3 ) nID := ::nPopupItemID++ ::aPopup[ i,3 ] := nID Wvt_AppendMenu( ::hPopup, MF_ENABLED + MF_STRING, nID, ::aPopup[ i,1 ] ) - next + NEXT ENDIF RETURN Self @@ -974,15 +983,16 @@ METHOD WvtObject:CreatePopup() // METHOD WvtObject:ShowPopup() - LOCAL lRet := .F., nRet, n, aPos + + LOCAL lRet := .F. , nRet, n, aPos IF ::hPopup != nil aPos := Wvt_GetCursorPos() - nRet := Wvt_TrackPopupMenu( ::hPopup, TPM_CENTERALIGN +TPM_RETURNCMD, ; - aPos[ 1 ], aPos[ 2 ], 0, Wvt_GetWindowHandle() ) + nRet := Wvt_TrackPopupMenu( ::hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, ; + aPos[ 1 ], aPos[ 2 ], 0, Wvt_GetWindowHandle() ) IF nRet > 0 - IF ( n := ascan( ::aPopup, {| e_ | e_[ 3 ] == nRet } ) ) > 0 + IF ( n := AScan( ::aPopup, {| e_ | e_[ 3 ] == nRet } ) ) > 0 lRet := .T. IF HB_ISBLOCK( ::aPopup[ n,2 ] ) @@ -1021,7 +1031,7 @@ CLASS WvtBrowse FROM WvtObject ASSIGN cDesc( cText ) INLINE ::cText := cText METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD PaintBlock( nPaintObj ) METHOD Hilite() METHOD DeHilite() @@ -1034,7 +1044,7 @@ CLASS WvtBrowse FROM WvtObject METHOD RestSettings() METHOD NotifyChild( nIndex, nKey, oCurObj ) - ENDCLASS +ENDCLASS // @@ -1048,12 +1058,12 @@ METHOD WvtBrowse:New( oParent, nID, nTop, nLeft, nBottom, nRight ) METHOD WvtBrowse:Create() - Select( ::cAlias ) + SELECT( ::cAlias ) #if 0 - ::nTop := ::oBrw:nTop-2 - ::nLeft := ::oBrw:nLeft-2 - ::nBottom := iif( ::lHSBar, ::oBrw:nBottom, ::oBrw:nBottom+1 ) - ::nRight := iif( ::lVSBar, ::oBrw:nRight , ::oBrw:nRight+2 ) + ::nTop := ::oBrw:nTop - 2 + ::nLeft := ::oBrw:nLeft - 2 + ::nBottom := iif( ::lHSBar, ::oBrw:nBottom, ::oBrw:nBottom + 1 ) + ::nRight := iif( ::lVSBar, ::oBrw:nRight , ::oBrw:nRight + 2 ) #else ::nTop := ::oBrw:nTop ::nLeft := ::oBrw:nLeft @@ -1067,8 +1077,8 @@ METHOD WvtBrowse:Create() ::Super:Create() - DEFAULT ::bTotalRecords TO {|| ( ::cAlias )->( OrdKeyCount() ) } - DEFAULT ::bCurrentRecord TO {|| ( ::cAlias )->( OrdKeyNo() ) } + DEFAULT ::bTotalRecords TO {|| ( ::cAlias )->( ordKeyCount() ) } + DEFAULT ::bCurrentRecord TO {|| ( ::cAlias )->( ordKeyNo() ) } ::SetVBar() DEFAULT ::bTotalColumns TO {|| ::oBrw:ColCount } @@ -1086,26 +1096,26 @@ METHOD WvtBrowse:SetVBar() IF ::lVSBar ::oVBar := WvtScrollBar():New( self, 999991, ; - ::oBrw:nTop, ::oBrw:nRight+1, ::oBrw:nBottom, ::oBrw:nRight+2 ) + ::oBrw:nTop, ::oBrw:nRight + 1, ::oBrw:nBottom, ::oBrw:nRight + 2 ) ::oVBar:nBarType := WVT_SCROLLBAR_VERT ::oVBar:bTotal := ::bTotalRecords ::oVBar:bCurrent := ::bCurrentRecord - ::oVBar:aPxlBtnTop := { -2,2,0,0 } - ::oVBar:aPxlBtnBtm := { 0,2,2,0 } - ::oVBar:aPxlScroll := { 0,2,0,0 } + ::oVBar:aPxlBtnTop := { - 2, 2, 0, 0 } + ::oVBar:aPxlBtnBtm := { 0, 2, 2, 0 } + ::oVBar:aPxlScroll := { 0, 2, 0, 0 } ::oVBar:Create() - aadd( ::aPaint, { ::oVBar:bBtnLeftTop, ; - { WVT_BLOCK_BUTTON, ::oVBar:nBtn1Top, ::oVBar:nBtn1Left, ; - ::oVBar:nBtn1Bottom, ::oVBar:nBtn1Right } } ) + AAdd( ::aPaint, { ::oVBar:bBtnLeftTop, ; + { WVT_BLOCK_BUTTON, ::oVBar:nBtn1Top, ::oVBar:nBtn1Left, ; + ::oVBar:nBtn1Bottom, ::oVBar:nBtn1Right } } ) - aadd( ::aPaint, { ::oVBar:bBtnRightBottom, ; - { WVT_BLOCK_BUTTON, ::oVBar:nBtn2Top, ::oVBar:nBtn2Left, ; - ::oVBar:nBtn2Bottom, ::oVBar:nBtn2Right } } ) + AAdd( ::aPaint, { ::oVBar:bBtnRightBottom, ; + { WVT_BLOCK_BUTTON, ::oVBar:nBtn2Top, ::oVBar:nBtn2Left, ; + ::oVBar:nBtn2Bottom, ::oVBar:nBtn2Right } } ) - aadd( ::aPaint, { ::oVBar:bBtnScroll, ; - { WVT_BLOCK_BUTTON, ::oVBar:nSTop, ::oVBar:nSLeft, ; - ::oVBar:nSBottom, ::oVBar:nSRight } } ) + AAdd( ::aPaint, { ::oVBar:bBtnScroll, ; + { WVT_BLOCK_BUTTON, ::oVBar:nSTop, ::oVBar:nSLeft, ; + ::oVBar:nSBottom, ::oVBar:nSRight } } ) ::oParent:AddObject( ::oVBar ) ENDIF @@ -1118,24 +1128,24 @@ METHOD WvtBrowse:SetHBar() IF ::lHSBar ::oHBar := WvtScrollBar():New( self, 999990, ; - ::oBrw:nBottom+1, ::oBrw:nLeft, ::oBrw:nBottom+1, ::oBrw:nRight ) + ::oBrw:nBottom + 1, ::oBrw:nLeft, ::oBrw:nBottom + 1, ::oBrw:nRight ) ::oHBar:nBarType := 2 ::oHBar:bTotal := ::bTotalColumns ::oHBar:bCurrent := ::bCurrentColumn - ::oHBar:aPxlBtnLft := { 2,-2,0,0 } - ::oHBar:aPxlBtnRgt := { 2, 0,0,2 } - ::oHBar:aPxlScroll := { 2, 0,0,0 } + ::oHBar:aPxlBtnLft := { 2, - 2, 0, 0 } + ::oHBar:aPxlBtnRgt := { 2, 0, 0, 2 } + ::oHBar:aPxlScroll := { 2, 0, 0, 0 } ::oHBar:Create() - aadd( ::aPaint, { ::oHBar:bBtnLeftTop, ; - { WVT_BLOCK_BUTTON, ::oHBar:nBtn1Top, ::oHBar:nBtn1Left, ; - ::oHBar:nBtn1Bottom, ::oHBar:nBtn1Right } } ) - aadd( ::aPaint, { ::oHBar:bBtnRightBottom, ; - { WVT_BLOCK_BUTTON, ::oHBar:nBtn2Top, ::oHBar:nBtn2Left, ; - ::oHBar:nBtn2Bottom, ::oHBar:nBtn2Right } } ) - aadd( ::aPaint, { ::oHBar:bBtnScroll, ; - { WVT_BLOCK_BUTTON, ::oHBar:nSTop, ::oHBar:nSLeft, ; - ::oHBar:nSBottom, ::oHBar:nSRight } } ) + AAdd( ::aPaint, { ::oHBar:bBtnLeftTop, ; + { WVT_BLOCK_BUTTON, ::oHBar:nBtn1Top, ::oHBar:nBtn1Left, ; + ::oHBar:nBtn1Bottom, ::oHBar:nBtn1Right } } ) + AAdd( ::aPaint, { ::oHBar:bBtnRightBottom, ; + { WVT_BLOCK_BUTTON, ::oHBar:nBtn2Top, ::oHBar:nBtn2Left, ; + ::oHBar:nBtn2Bottom, ::oHBar:nBtn2Right } } ) + AAdd( ::aPaint, { ::oHBar:bBtnScroll, ; + { WVT_BLOCK_BUTTON, ::oHBar:nSTop, ::oHBar:nSLeft, ; + ::oHBar:nSBottom, ::oHBar:nSRight } } ) ::oParent:AddObject( ::oHBar ) ENDIF @@ -1145,17 +1155,18 @@ METHOD WvtBrowse:SetHBar() // METHOD WvtBrowse:Refresh() + LOCAL nWorkArea := Select() IF HB_ISBLOCK( ::bOnRefresh ) - eval( ::bOnRefresh, self ) + Eval( ::bOnRefresh, self ) ELSE - Select( ::cAlias ) + SELECT( ::cAlias ) ::oBrw:RefreshAll() ::oBrw:ForceStable() - Select( nWorkArea ) + SELECT( nWorkArea ) ENDIF RETURN Self @@ -1163,10 +1174,11 @@ METHOD WvtBrowse:Refresh() // METHOD WvtBrowse:HandleEvent( nKey ) + LOCAL lRet := .F. - IF valtype( ::bHandleEvent ) == "B" - lRet := eval( ::bHandleEvent, self, ::oParent:cPaintBlockID, ::oBrw, nKey ) + IF ValType( ::bHandleEvent ) == "B" + lRet := Eval( ::bHandleEvent, self, ::oParent:cPaintBlockID, ::oBrw, nKey ) ENDIF RETURN lRet @@ -1174,19 +1186,20 @@ METHOD WvtBrowse:HandleEvent( nKey ) // METHOD WvtBrowse:NotifyChild( nIndex, nKey, oCurObj ) + LOCAL xData, i - IF nIndex > 0 .and. nIndex <= len( ::aChildren ) - IF valtype( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) == "B" - xData := eval( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) + IF nIndex > 0 .AND. nIndex <= Len( ::aChildren ) + IF ValType( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) == "B" + xData := Eval( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) ENDIF - eval( ::aChildren[ nIndex, OBJ_CHILD_REFRESHBLOCK ], ; - ::aChildren[ nIndex, OBJ_CHILD_OBJ ],; - ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oParent:cPaintBlockID, ; - ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oBrw, ; - nKey, ; - xData ) + Eval( ::aChildren[ nIndex, OBJ_CHILD_REFRESHBLOCK ], ; + ::aChildren[ nIndex, OBJ_CHILD_OBJ ], ; + ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oParent:cPaintBlockID, ; + ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oBrw, ; + nKey, ; + xData ) IF ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:nChildren > 0 /* Pretend IF focus is current on this object */ @@ -1194,7 +1207,7 @@ METHOD WvtBrowse:NotifyChild( nIndex, nKey, oCurObj ) FOR i := 1 to ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:nChildren ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:NotifyChild( i, nKey, ::aChildren[ nIndex, OBJ_CHILD_OBJ ] ) - next + NEXT /* Restore previous environments */ Eval( oCurObj:bOnFocus, oCurObj ) @@ -1206,35 +1219,38 @@ METHOD WvtBrowse:NotifyChild( nIndex, nKey, oCurObj ) // METHOD WvtBrowse:Hilite() + LOCAL b := ::oBrw - DispOutAt( b:nTop-2, b:nLeft-2, pad( " "+::cDesc, b:nRight-b:nLeft+5 ), ::cColorHilite ) + DispOutAt( b:nTop - 2, b:nLeft - 2, Pad( " " + ::cDesc, b:nRight - b:nLeft + 5 ), ::cColorHilite ) RETURN Self // METHOD WvtBrowse:DeHilite() + LOCAL b := ::oBrw - DispOutAt( b:nTop-2, b:nLeft-2, pad( " "+::cDesc, b:nRight-b:nLeft+5 ), ::cColorDeHilite ) + DispOutAt( b:nTop - 2, b:nLeft - 2, Pad( " " + ::cDesc, b:nRight - b:nLeft + 5 ), ::cColorDeHilite ) RETURN Self // METHOD WvtBrowse:SetTooltip() + LOCAL cTip, nArea IF HB_ISBLOCK( ::bTooltip ) ::SaveSettings() nArea := Select( ::cAlias ) - Select( ::cAlias ) + SELECT( ::cAlias ) cTip := Eval( ::bTooltip ) - Select( nArea ) + SELECT( nArea ) ::RestSettings() ENDIF @@ -1261,7 +1277,7 @@ METHOD WvtBrowse:SaveSettings() METHOD WvtBrowse:RestSettings() - IF ::xSettings != nil .and. HB_ISBLOCK( ::bRestSettings ) + IF ::xSettings != nil .AND. HB_ISBLOCK( ::bRestSettings ) Eval( ::bRestSettings, self ) ENDIF @@ -1270,28 +1286,29 @@ METHOD WvtBrowse:RestSettings() // METHOD WvtBrowse:PaintBlock( nPaintObj ) + LOCAL bBlock, b := ::oBrw switch nPaintObj CASE 1 - bBlock := {|| Wvt_DrawBoxRaised( b:nTop-2,b:nLeft-2,b:nBottom+1,b:nRight+2 ) } - aadd( ::aPaint, { bBlock, { WVT_BLOCK_BOX, b:nTop-3,b:nLeft-3,b:nBottom+2,b:nRight+3 } } ) + bBlock := {|| Wvt_DrawBoxRaised( b:nTop - 2, b:nLeft - 2, b:nBottom + 1, b:nRight + 2 ) } + AAdd( ::aPaint, { bBlock, { WVT_BLOCK_BOX, b:nTop - 3,b:nLeft - 3,b:nBottom + 2,b:nRight + 3 } } ) EXIT CASE 2 - bBlock := {|| Wvt_DrawBoxRecessed( b:nTop,b:nLeft,b:nBottom,b:nRight ) } - aadd( ::aPaint, { bBlock, { WVT_BLOCK_BOX, b:nTop-1,b:nLeft-1,b:nBottom+1,b:nRight+1 } } ) + bBlock := {|| Wvt_DrawBoxRecessed( b:nTop, b:nLeft, b:nBottom, b:nRight ) } + AAdd( ::aPaint, { bBlock, { WVT_BLOCK_BOX, b:nTop - 1,b:nLeft - 1,b:nBottom + 1,b:nRight + 1 } } ) EXIT CASE 3 - bBlock := {|| Wvt_DrawGridHorz( b:nTop+3, b:nLeft, b:nRight, b:nBottom - b:nTop - 2 ) } - aadd( ::aPaint, { bBlock, { WVT_BLOCK_GRID_H, b:nTop+4, b:nLeft+1, b:nBottom-1, b:nRight-1 } } ) + bBlock := {|| Wvt_DrawGridHorz( b:nTop + 3, b:nLeft, b:nRight, b:nBottom - b:nTop - 2 ) } + AAdd( ::aPaint, { bBlock, { WVT_BLOCK_GRID_H, b:nTop + 4, b:nLeft + 1, b:nBottom - 1, b:nRight - 1 } } ) EXIT CASE 4 - bBlock := {|| Wvt_DrawGridVert( b:nTop, b:nBottom, b:aColumnsSep, len( b:aColumnsSep ) ) } - aadd( ::aPaint, { bBlock, { WVT_BLOCK_GRID_V, b:nTop+1, b:nLeft+1, b:nBottom-1, b:nRight-1, b } } ) + bBlock := {|| Wvt_DrawGridVert( b:nTop, b:nBottom, b:aColumnsSep, Len( b:aColumnsSep ) ) } + AAdd( ::aPaint, { bBlock, { WVT_BLOCK_GRID_V, b:nTop + 1, b:nLeft + 1, b:nBottom - 1, b:nRight - 1, b } } ) EXIT end @@ -1314,7 +1331,7 @@ CLASS WvtStatusBar FROM WvtObject DATA cColor METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD SetPanels( aPanels ) METHOD SetText( nPanel, cText, cColor ) METHOD SetIcon( nPanel, cIconFile ) @@ -1322,7 +1339,7 @@ CLASS WvtStatusBar FROM WvtObject METHOD PaintBlock() METHOD Refresh() - ENDCLASS +ENDCLASS // @@ -1353,23 +1370,25 @@ METHOD WvtStatusBar:Create() // METHOD WvtStatusBar:PaintBlock() - LOCAL a_:= {}, nPanels - aeval( ::aPanels, {| o | aadd( a_,o:nTop ) , aadd( a_,o:nLeft ), ; - aadd( a_,o:nBottom ), aadd( a_,o:nRight ) } ) + LOCAL a_ := {}, nPanels + + AEval( ::aPanels, {| o | AAdd( a_,o:nTop ) , AAdd( a_,o:nLeft ), ; + AAdd( a_, o:nBottom ), AAdd( a_, o:nRight ) } ) a_[ len( a_ ) ]++ - nPanels := len( ::aPanels ) + nPanels := Len( ::aPanels ) ::bPaint := {|| Wvt_DrawStatusBar( nPanels, a_ ) } - aadd( ::aPaint, { ::bPaint,; - { WVT_BLOCK_STATUSBAR, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) + AAdd( ::aPaint, { ::bPaint, ; + { WVT_BLOCK_STATUSBAR, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) RETURN Self // METHOD WvtStatusBar:SetPanels( aPanels ) + LOCAL i, oPanel, nID LOCAL nLastCol := ::oParent:MaxCol() @@ -1379,33 +1398,34 @@ METHOD WvtStatusBar:SetPanels( aPanels ) oPanel := WvtPanel():New( ::oParent, ++nID, ::nTop, 0 ) - aadd( ::aPanels, oPanel ) + AAdd( ::aPanels, oPanel ) IF aPanels != nil - FOR i := 1 to len( aPanels ) + FOR i := 1 TO Len( aPanels ) IF ::oParent:MaxCol() > aPanels[ i ] oPanel := WvtPanel():New( ::oParent, ++nID, ::nTop, aPanels[ i ] ) - aadd( ::aPanels, oPanel ) + AAdd( ::aPanels, oPanel ) ENDIF - next + NEXT ENDIF - atail( ::aPanels ):nRight := nLastCol + ATail( ::aPanels ):nRight := nLastCol - FOR i := len( ::aPanels ) - 1 TO 1 STEP -1 + FOR i := Len( ::aPanels ) - 1 TO 1 STEP - 1 oPanel := ::aPanels[ i ] oPanel:nRight := ::aPanels[ i+1 ]:nLeft oPanel:cColor := ::cColor - next + NEXT RETURN self // METHOD WvtStatusBar:Update( nPanel, cText, cColor ) + LOCAL oPanel - IF nPanel > 0 .and. nPanel <= len( ::aPanels ) + IF nPanel > 0 .AND. nPanel <= Len( ::aPanels ) oPanel := ::aPanels[ nPanel ] oPanel:Text := cText oPanel:cColor := iif( cColor == nil, "N/W", cColor ) @@ -1417,11 +1437,12 @@ METHOD WvtStatusBar:Update( nPanel, cText, cColor ) // METHOD WvtStatusBar:SetText( nPanel, cText, cColor ) + LOCAL oPanel DEFAULT cColor TO ::cColor - IF nPanel > 0 .and. nPanel <= len( ::aPanels ) + IF nPanel > 0 .AND. nPanel <= Len( ::aPanels ) oPanel := ::aPanels[ nPanel ] oPanel:Text := cText oPanel:cColor := cColor @@ -1433,7 +1454,7 @@ METHOD WvtStatusBar:SetText( nPanel, cText, cColor ) METHOD WvtStatusBar:SetIcon( nPanel, cIconFile ) - IF nPanel > 0 .and. nPanel <= len( ::aPanels ) + IF nPanel > 0 .AND. nPanel <= Len( ::aPanels ) ::aPanels[ nPanel ]:cIconFile := cIconFile ENDIF @@ -1442,11 +1463,12 @@ METHOD WvtStatusBar:SetIcon( nPanel, cIconFile ) // METHOD WvtStatusBar:Refresh() + LOCAL i - FOR i := 1 to len( ::aPanels ) + FOR i := 1 TO Len( ::aPanels ) ::aPanels[ i ]:Refresh() - next + NEXT RETURN nil @@ -1466,13 +1488,13 @@ CLASS WvtPanel FROM WvtObject DATA cTxt DATA cIconFile - ACCESS Text INLINE ::cTxt - ASSIGN Text( cText ) INLINE ::cTxt := pad( cText, ::nRight - ::nLeft-2 ) + ACCESS TEXT INLINE ::cTxt + ASSIGN TEXT( cText ) INLINE ::cTxt := Pad( cText, ::nRight - ::nLeft - 2 ) METHOD New( oParent, nId, nTop, nLeft ) METHOD Refresh() - ENDCLASS +ENDCLASS // @@ -1487,7 +1509,7 @@ METHOD WvtPanel:New( oParent, nId, nTop, nLeft ) METHOD WvtPanel:Refresh() IF ::Text != nil - DispOutAt( ::nTop, ::nLeft+1, ::Text, ::cColor ) + DispOutAt( ::nTop, ::nLeft + 1, ::Text, ::cColor ) ENDIF RETURN Self @@ -1504,11 +1526,11 @@ METHOD WvtPanel:Refresh() CLASS WvtLabel FROM WvtObject - ACCESS Text INLINE iif( ::cText == nil, "", ::cText ) - ASSIGN Text( cTxt ) INLINE ::cText := iif( cTxt == nil, "", cTxt ) + ACCESS TEXT INLINE iif( ::cText == nil, "", ::cText ) + ASSIGN TEXT( cTxt ) INLINE ::cText := iif( cTxt == nil, "", cTxt ) METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create( lConfg ) + METHOD create( lConfg ) METHOD Configure() METHOD Refresh() METHOD HoverOn() @@ -1517,7 +1539,7 @@ CLASS WvtLabel FROM WvtObject METHOD SetTextColor( nRGB ) METHOD SetBackColor( nRGB ) - ENDCLASS +ENDCLASS // @@ -1534,19 +1556,19 @@ METHOD WvtLabel:Create( lConfg ) DEFAULT lConfg TO .F. DEFAULT ::nBottom TO ::nTop - DEFAULT ::nRight TO ::nLeft + len( ::Text ) - DEFAULT ::nTextColor TO RGB( 0,0,0 ) + DEFAULT ::nRight TO ::nLeft + Len( ::Text ) + DEFAULT ::nTextColor TO RGB( 0, 0, 0 ) ::nTextColorHoverOff := ::nTextColor ::nBackColorHoverOff := ::nBackColor - ::hFont := Wvt_CreateFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontWeight, ::lItalic,; - ::lUnderline, ::lStrikeout, ::nCharSet, ::nFontQuality, ::nAngle ) + ::hFont := Wvt_CreateFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontWeight, ::lItalic, ; + ::lUnderline, ::lStrikeout, ::nCharSet, ::nFontQuality, ::nAngle ) IF ::hFont != 0 IF !( lConfg ) - ::bPaint := {|| Wvt_DrawLabelObj( ::nTop, ::nLeft, ::nBottom, ::nRight,; - ::Text, ::nAlignHorz, ::nAlignVert, ::nTextColor, ::nBackColor, ::hFont ) } - aadd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) + ::bPaint := {|| Wvt_DrawLabelObj( ::nTop, ::nLeft, ::nBottom, ::nRight, ; + ::Text, ::nAlignHorz, ::nAlignVert, ::nTextColor, ::nBackColor, ::hFont ) } + AAdd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) ENDIF ENDIF @@ -1566,7 +1588,7 @@ METHOD WvtLabel:Refresh() METHOD WvtLabel:SetText( cTxt ) - IF valtype( cTxt ) == "C" + IF ValType( cTxt ) == "C" ::Text := cTxt ::Refresh() ENDIF @@ -1577,7 +1599,7 @@ METHOD WvtLabel:SetText( cTxt ) METHOD WvtLabel:SetTextColor( nRGB ) - IF valtype( nRGB ) == "N" + IF ValType( nRGB ) == "N" ::nTextColor := nRGB ::nTextColorHoverOff := nRGB ::Refresh() @@ -1589,7 +1611,7 @@ METHOD WvtLabel:SetTextColor( nRGB ) METHOD WvtLabel:SetBackColor( nRGB ) - IF valtype( nRGB ) == "N" + IF ValType( nRGB ) == "N" ::nBackColor := nRGB ::nBackColorHoverOff := nRGB ::Refresh() @@ -1608,14 +1630,15 @@ METHOD WvtLabel:Configure() WVG_DeleteObject( ::hFont ) ENDIF - ::hFont := Wvt_CreateFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontWeight, ::lItalic,; - ::lUnderline, ::lStrikeout, ::nCharSet, ::nFontQuality, ::nAngle ) + ::hFont := Wvt_CreateFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontWeight, ::lItalic, ; + ::lUnderline, ::lStrikeout, ::nCharSet, ::nFontQuality, ::nAngle ) RETURN Self // METHOD WvtLabel:HoverOn() + LOCAL lOn := .F. IF ::nTextColorHoverOn != nil @@ -1636,6 +1659,7 @@ METHOD WvtLabel:HoverOn() // METHOD WvtLabel:HoverOff() + LOCAL lOn := .F. IF ::nTextColorHoverOn != nil @@ -1651,7 +1675,7 @@ METHOD WvtLabel:HoverOff() ::Refresh() ENDIF - Return Self + RETURN Self // // @@ -1674,12 +1698,12 @@ CLASS WvtToolBar FROM WvtObject DATA wScreen DATA cScreen DATA nBtnLeft INIT 0 - DATA nRGBSep INIT RGB( 150,150,150 ) + DATA nRGBSep INIT RGB( 150, 150, 150 ) - ACCESS nButtons INLINE len( ::aButtons ) + ACCESS nButtons INLINE Len( ::aButtons ) METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD Refresh() METHOD AddButton( cFileImage, bBlock, cTooltip ) METHOD PaintToolBar() @@ -1714,11 +1738,11 @@ METHOD WvtToolBar:Create() ::lHidden := .T. ENDIF - aeval( ::aObjects, {| o | o:lActive := ::lActive } ) + AEval( ::aObjects, {| o | o:lActive := ::lActive } ) ::bPaint := {|| ::PaintToolBar() } - aadd( ::aPaint, { ::bPaint,; - { WVT_BLOCK_TOOLBAR, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) + AAdd( ::aPaint, { ::bPaint, ; + { WVT_BLOCK_TOOLBAR, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) ::Super:Create() @@ -1749,9 +1773,10 @@ METHOD WvtToolBar:PaintToolBar() // METHOD WvtToolBar:AddButton( cFileImage, bBlock, cTooltip ) + LOCAL oObj, nCol - nCol := ( ::nBottom-::nTop+1 ) * 2 + nCol := ( ::nBottom - ::nTop + 1 ) * 2 oObj := WvtToolButton():New( self ) @@ -1760,7 +1785,7 @@ METHOD WvtToolBar:AddButton( cFileImage, bBlock, cTooltip ) oObj:nLeft := ::nBtnLeft + 1 oObj:nBottom := ::nBottom - IF valtype( cFileImage ) == "C" + IF ValType( cFileImage ) == "C" oObj:nBtnType := TLB_BUTTON_TYPE_IMAGE oObj:nRight := oObj:nLeft + nCol - 1 oObj:cFileImage := cFileImage @@ -1771,7 +1796,7 @@ METHOD WvtToolBar:AddButton( cFileImage, bBlock, cTooltip ) oObj:nRight := oObj:nLeft ENDIF - aadd( ::aObjects, oObj ) + AAdd( ::aObjects, oObj ) ::nBtnLeft := oObj:nRight + 1 ::nCurButton++ @@ -1784,14 +1809,14 @@ METHOD WvtToolBar:AddButton( cFileImage, bBlock, cTooltip ) METHOD WvtToolBar:HoverOn() - IF ::lFloating .and. ::lHidden + IF ::lFloating .AND. ::lHidden ::lHidden := .F. ::lActive := .T. - #IF 0 +#if 0 ::cScreen := SaveScreen( ::nTop, ::nLeft, ::nBottom, ::nRight ) ::wScreen := Wvt_SaveScreen( ::nTop, ::nLeft, ::nBottom, ::nRight ) - #ENDIF - aeval( ::aObjects, {| o | o:lActive := ::lActive } ) +#endif + AEval( ::aObjects, {| o | o:lActive := ::lActive } ) ::Refresh() ENDIF @@ -1802,14 +1827,14 @@ METHOD WvtToolBar:HoverOn() METHOD WvtToolBar:HoverOff() - IF ::lFloating .and. !( ::lHidden ) + IF ::lFloating .AND. !( ::lHidden ) ::lHidden := .T. ::lActive := .F. - aeval( ::aObjects, {| o | o:lActive := ::lActive } ) - #IF 0 + AEval( ::aObjects, {| o | o:lActive := ::lActive } ) +#if 0 RestScreen( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cScreen ) Wvt_RestScreen( ::nTop, ::nLeft, ::nBottom, ::nRight, ::wScreen, .F. ) - #ENDIF +#endif ::Refresh() ENDIF @@ -1830,10 +1855,10 @@ CLASS WvtToolButton FROM WvtObject DATA cFileImage DATA nCurState INIT 0 DATA nBtnType INIT TLB_BUTTON_TYPE_IMAGE - DATA aPxlOffSet INIT { 0, -1, -3, 1 } + DATA aPxlOffSet INIT { 0, - 1, - 3, 1 } METHOD New( oParent ) - METHOD Create() + METHOD create() METHOD Refresh() METHOD LeftDown() METHOD LeftUp() @@ -1841,7 +1866,7 @@ CLASS WvtToolButton FROM WvtObject METHOD HoverOff() METHOD PaintButton() - ENDCLASS +ENDCLASS // @@ -1856,8 +1881,8 @@ METHOD WvtToolButton:New( oParent ) METHOD WvtToolButton:Create() ::bPaint := {|| ::PaintButton() } - aadd( ::aPaint, { ::bPaint,; - { WVT_BLOCK_BUTTON, ::nTop, ::nLeft, ::nBottom, ::nRight }} ) + AAdd( ::aPaint, { ::bPaint, ; + { WVT_BLOCK_BUTTON, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) ::Super:Create() @@ -1879,7 +1904,7 @@ METHOD WvtToolButton:PaintButton() IF ::lActive IF ::nBtnType == TLB_BUTTON_TYPE_IMAGE - Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cFileImage, {4,4,-6,-4} ) + Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cFileImage, { 4, 4, - 6, - 4 } ) ELSE Wvt_DrawLine( ::nTop, ::nLeft, ::nBottom, ::nRight, 1, 1, , , , ::oParent:nRGBSep ) ENDIF @@ -1890,9 +1915,10 @@ METHOD WvtToolButton:PaintButton() // METHOD WvtToolButton:LeftDown() + LOCAL lRet := .F. - IF ::lActive .and. ::nBtnType == TLB_BUTTON_TYPE_IMAGE + IF ::lActive .AND. ::nBtnType == TLB_BUTTON_TYPE_IMAGE Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet, 2 ) lRet := .T. ENDIF @@ -1902,9 +1928,10 @@ METHOD WvtToolButton:LeftDown() // METHOD WvtToolButton:LeftUp() + LOCAL lRet := .F. - IF ::lActive .and. ::nBtnType == TLB_BUTTON_TYPE_IMAGE + IF ::lActive .AND. ::nBtnType == TLB_BUTTON_TYPE_IMAGE Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet, 1 ) Eval( ::bOnLeftUp ) lRet := .T. @@ -1918,7 +1945,7 @@ METHOD WvtToolButton:HoverOn() ::oParent:HoverOn() - IF ::lActive .and. ::nBtnType == TLB_BUTTON_TYPE_IMAGE + IF ::lActive .AND. ::nBtnType == TLB_BUTTON_TYPE_IMAGE Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet, 1 ) ENDIF @@ -1930,8 +1957,8 @@ METHOD WvtToolButton:HoverOff() ::oParent:HoverOff() - IF ::lActive .and. ::nBtnType == TLB_BUTTON_TYPE_IMAGE - Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight,::aPxlOffSet, 0 ) + IF ::lActive .AND. ::nBtnType == TLB_BUTTON_TYPE_IMAGE + Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet, 0 ) ENDIF RETURN Self @@ -1954,10 +1981,10 @@ CLASS WvtImage FROM WvtObject ASSIGN cImage( cImg ) INLINE ::cImageFile := cImg METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD SetImage( cImage ) - ENDCLASS +ENDCLASS // @@ -1971,11 +1998,11 @@ METHOD WvtImage:New( oParent, nID, nTop, nLeft, nBottom, nRight ) METHOD WvtImage:Create() - ::bPaint := {|| iif( file( ::cImage ), ; - Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cImage ),"" ) } + ::bPaint := {|| iif( File( ::cImage ), ; + Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cImage ), "" ) } - aadd( ::aPaint, { ::bPaint,; - { WVT_BLOCK_IMAGE, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) + AAdd( ::aPaint, { ::bPaint, ; + { WVT_BLOCK_IMAGE, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) ::Super:Create() @@ -1985,7 +2012,7 @@ METHOD WvtImage:Create() METHOD WvtImage:SetImage( cImage ) - IF cImage != nil .and. file( cImage ) + IF cImage != nil .AND. File( cImage ) ::cImageFile := cImage ::Refresh() ENDIF @@ -2024,12 +2051,12 @@ CLASS WvtStatic FROM WvtObject DATA aPxlOffSet INIT {} METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD Refresh() METHOD HoverOn() METHOD HoverOff() - ENDCLASS +ENDCLASS // @@ -2042,6 +2069,7 @@ METHOD WvtStatic:New( oParent, nID, nTop, nLeft, nBottom, nRight ) // METHOD WvtStatic:Create() + LOCAL lInside := .F. SWITCH ::nStatic @@ -2049,7 +2077,7 @@ METHOD WvtStatic:Create() CASE WVT_STATIC_LINE lInside := .T. ::bPaint := {|| Wvt_DrawLine( ::nTop, ::nLeft, ::nBottom, ::nRight, ; - ::nOrient, ::nFormat, ::nAlign, ::nStyle, ::nThick, ::nColor ) } + ::nOrient, ::nFormat, ::nAlign, ::nStyle, ::nThick, ::nColor ) } EXIT CASE WVT_STATIC_BOXRAISED @@ -2095,7 +2123,7 @@ METHOD WvtStatic:Create() CASE WVT_STATIC_SHADEDRECT lInside := .T. ::bPaint := {|| Wvt_DrawShadedRect( ::nTop, ::nLeft, ::nBottom, ::nRight, ; - ::aPxlOffSet, ::nHorzVert, ::aRGBb, ::aRGBe ) } + ::aPxlOffSet, ::nHorzVert, ::aRGBb, ::aRGBe ) } EXIT ENDSWITCH @@ -2112,8 +2140,8 @@ METHOD WvtStatic:Create() ::nfRight := ::nRight + 1 ENDIF - aadd( ::aPaint, { ::bPaint,; - { WVT_BLOCK_STATIC, ::nfTop, ::nfLeft, ::nfBottom, ::nfRight }} ) + AAdd( ::aPaint, { ::bPaint, ; + { WVT_BLOCK_STATIC, ::nfTop, ::nfLeft, ::nfBottom, ::nfRight } } ) ::Super:Create() @@ -2158,7 +2186,7 @@ CLASS WvtPushButton FROM WvtObject ASSIGN block( bBlock ) INLINE ::bOnLeftUp := bBlock METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD LeftDown() METHOD LeftUp() METHOD PaintButton() @@ -2179,8 +2207,8 @@ METHOD WvtPushButton:Create() ::bPaint := {|| ::PaintButton() } - aadd( ::aPaint, { ::bPaint,; - { WVT_BLOCK_BUTTON, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) + AAdd( ::aPaint, { ::bPaint, ; + { WVT_BLOCK_BUTTON, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) ::Super:Create() @@ -2191,11 +2219,11 @@ METHOD WvtPushButton:Create() METHOD WvtPushButton:PaintButton() IF ::cCaption == nil - Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cFileImage, { 4, 4,-4, -4 } ) + Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cFileImage, { 4, 4, - 4, - 4 } ) ELSE Wvt_DrawButton( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cCaption, , 4 ) ENDIF - Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, {0,0,0,0}, 1 ) + Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, { 0, 0, 0, 0 }, 1 ) RETURN Self @@ -2203,7 +2231,7 @@ METHOD WvtPushButton:PaintButton() METHOD WvtPushButton:LeftDown() - Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight,{0,0,0,0} , 2 ) + Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, { 0, 0, 0, 0 } , 2 ) RETURN .T. @@ -2211,7 +2239,7 @@ METHOD WvtPushButton:LeftDown() METHOD WvtPushButton:LeftUp() - Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, {0,0,0,0}, 1 ) + Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, { 0, 0, 0, 0 }, 1 ) ::Eval( ::bOnLeftUp ) RETURN .T. @@ -2235,13 +2263,13 @@ CLASS WvtGets FROM WvtObject DATA cDesc INIT "" METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD KillFocus() METHOD SetFocus() METHOD HandleEvent( nKey ) METHOD AddGets( nRow, nCol, xVar, cPic, cColor, bValid, bWhen ) METHOD PaintBlock( nIndex ) - METHOD Read() + METHOD READ() METHOD Hilite() METHOD DeHilite() METHOD GetData() @@ -2260,11 +2288,12 @@ METHOD WvtGets:New( oParent, nID, nTop, nLeft, nBottom, nRight ) // METHOD WvtGets:Create() + LOCAL i, GetList - LOCAL nCurRow := row() + LOCAL nCurRow := Row() LOCAL nCurCol := Col() - FOR i := 1 to len( ::aGetList ) + FOR i := 1 TO Len( ::aGetList ) GetList := {} DEFAULT ::aGetList[ i,7 ] TO "N/W*,N/W*,,,N/GR*" @@ -2273,12 +2302,12 @@ METHOD WvtGets:Create() @ ::aGetList[ i,1 ], ::aGetList[ i,2 ] GET ::aGetList[ i,3 ] PICTURE ::aGetList[ i,4 ] COLOR ::aGetList[ i,7 ] - aadd( ::GetList, GetList[ 1 ] ) + AAdd( ::GetList, GetList[ 1 ] ) ::GetList[ i ]:Display() ::PaintBlock( i ) - next - SetPos( nCurRow, nCurCol ) + NEXT + setPos( nCurRow, nCurCol ) ::Super:Create() ::Dehilite() @@ -2288,15 +2317,16 @@ METHOD WvtGets:Create() // METHOD WvtGets:PaintBlock( nIndex ) + LOCAL nLen, bPaint - nLen := len( Transform( ::aGetList[ nIndex,3 ], ::aGetList[ nIndex,4 ] ) ) + nLen := Len( Transform( ::aGetList[ nIndex,3 ], ::aGetList[ nIndex,4 ] ) ) bPaint := {|| Wvt_DrawBoxGet( ::aGetList[ nIndex,1 ], ::aGetList[ nIndex,2 ], nLen ) } - aadd( ::aPaint, { bPaint,; - { WVT_BLOCK_GETS, ::aGetList[ nIndex,1 ]-1, ::aGetList[ nIndex,2 ]-1, ; - ::aGetList[ nIndex,1 ]-1, ::aGetList[ nIndex,2 ]+nLen } } ) + AAdd( ::aPaint, { bPaint, ; + { WVT_BLOCK_GETS, ::aGetList[ nIndex,1 ] - 1, ::aGetList[ nIndex,2 ] - 1, ; + ::aGetList[ nIndex,1 ] - 1, ::aGetList[ nIndex,2 ] + nLen } } ) RETURN Self @@ -2316,13 +2346,14 @@ METHOD WvtGets:KillFocus() METHOD WvtGets:AddGets( nRow, nCol, xVar, cPic, cColor, bValid, bWhen ) - aadd( ::aGetList, { nRow, nCol, xVar, cPic, bValid, bWhen, cColor } ) + AAdd( ::aGetList, { nRow, nCol, xVar, cPic, bValid, bWhen, cColor } ) RETURN Self // METHOD WvtGets:HandleEvent( nKey ) + LOCAL lRet := .F. DO CASE @@ -2344,6 +2375,7 @@ METHOD WvtGets:Read() // METHOD WvtGets:GetData() + LOCAL aData := NIL RETURN aData @@ -2358,7 +2390,7 @@ METHOD WvtGets:SetData( /*aData*/ ) METHOD WvtGets:Hilite() - DispOutAt( ::nTop, ::nLeft, pad( " "+::cDesc, ::nRight-::nLeft+1 ), ::cColorHilite ) + DispOutAt( ::nTop, ::nLeft, Pad( " " + ::cDesc, ::nRight - ::nLeft + 1 ), ::cColorHilite ) RETURN Self @@ -2366,7 +2398,7 @@ METHOD WvtGets:Hilite() METHOD WvtGets:DeHilite() - DispOutAt( ::nTop, ::nLeft, pad( " "+::cDesc, ::nRight-::nLeft+1 ), ::cColorDeHilite ) + DispOutAt( ::nTop, ::nLeft, Pad( " " + ::cDesc, ::nRight - ::nLeft + 1 ), ::cColorDeHilite ) RETURN Self @@ -2412,11 +2444,11 @@ CLASS WvtScrollBar FROM WvtObject DATA bCurrent DATA lHidden INIT .T. - DATA aPxlBtnTop INIT {0,0,0,0} - DATA aPxlBtnLft INIT {0,0,0,0} - DATA aPxlBtnBtm INIT {0,0,0,0} - DATA aPxlBtnRgt INIT {0,0,0,0} - DATA aPxlScroll INIT {0,0,0,0} + DATA aPxlBtnTop INIT { 0, 0, 0, 0 } + DATA aPxlBtnLft INIT { 0, 0, 0, 0 } + DATA aPxlBtnBtm INIT { 0, 0, 0, 0 } + DATA aPxlBtnRgt INIT { 0, 0, 0, 0 } + DATA aPxlScroll INIT { 0, 0, 0, 0 } DATA lLeftDown INIT .F. DATA lOnThumb INIT .F. @@ -2426,16 +2458,16 @@ CLASS WvtScrollBar FROM WvtObject DATA nScrollUnits INIT 0 METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD Configure( nTop, nLeft, nBottom, nRight ) METHOD Refresh() METHOD HandleEvent( nKey ) - METHOD SetPos( nTotal, nCurrent ) + METHOD setPos( nTotal, nCurrent ) METHOD GetPos() METHOD ThumbPos() METHOD SetTooltip() - ENDCLASS +ENDCLASS // @@ -2449,8 +2481,8 @@ METHOD wvtScrollbar:New( oParent, nID, nTop, nLeft, nBottom, nRight ) METHOD wvtScrollbar:Create() - IF ::nTop == nil .or. ::nLeft == nil - return nil + IF ::nTop == nil .OR. ::nLeft == nil + RETURN nil ENDIF IF ::nBarType == WVT_SCROLLBAR_VERT @@ -2458,7 +2490,7 @@ METHOD wvtScrollbar:Create() DEFAULT ::nRight TO ::nLeft + 1 ::nRight := ::nLeft + 1 - ::nBottom := max( 7, ::nBottom ) + ::nBottom := Max( 7, ::nBottom ) ::nBtn1Top := ::nTop ::nBtn1Left := ::nLeft @@ -2482,23 +2514,23 @@ METHOD wvtScrollbar:Create() ::ThumbPos() ::bBtnLeftTop := ; - {|| Wvt_DrawScrollButton( ::nBtn1Top,::nBtn1Left,::nBtn1Bottom,::nBtn1Right,::aPxlBtnTop,1 ) } + {|| Wvt_DrawScrollButton( ::nBtn1Top, ::nBtn1Left, ::nBtn1Bottom, ::nBtn1Right, ::aPxlBtnTop, 1 ) } ::bBtnRightBottom := ; - {|| Wvt_DrawScrollButton( ::nBtn2Top,::nBtn2Left,::nBtn2Bottom,::nBtn2Right,::aPxlBtnBtm,3 ) } + {|| Wvt_DrawScrollButton( ::nBtn2Top, ::nBtn2Left, ::nBtn2Bottom, ::nBtn2Right, ::aPxlBtnBtm, 3 ) } ::bBtnScroll := ; - {|| Wvt_DrawScrollThumbVert( ::nSTop ,::nSLeft ,::nSBottom,::nSRight,::aPxlScroll,; - ::nThumbPos ) } + {|| Wvt_DrawScrollThumbVert( ::nSTop , ::nSLeft , ::nSBottom, ::nSRight, ::aPxlScroll, ; + ::nThumbPos ) } ::bBtnLeftTopDep := ; - {|| Wvt_DrawScrollButton( ::nBtn1Top,::nBtn1Left,::nBtn1Bottom,::nBtn1Right,::aPxlBtnTop,1,.T. ) } + {|| Wvt_DrawScrollButton( ::nBtn1Top, ::nBtn1Left, ::nBtn1Bottom, ::nBtn1Right, ::aPxlBtnTop, 1, .T. ) } ::bBtnRightBottomDep := ; - {|| Wvt_DrawScrollButton( ::nBtn2Top,::nBtn2Left,::nBtn2Bottom,::nBtn2Right,::aPxlBtnBtm,3,.T. ) } + {|| Wvt_DrawScrollButton( ::nBtn2Top, ::nBtn2Left, ::nBtn2Bottom, ::nBtn2Right, ::aPxlBtnBtm, 3, .T. ) } ELSE DEFAULT ::nBottom TO ::nTop DEFAULT ::nRight TO ::nLeft + 11 ::nBottom := ::nTop - ::nRight := max( 11, ::nRight ) + ::nRight := Max( 11, ::nRight ) ::nBtn1Top := ::nTop ::nBtn1Left := ::nLeft @@ -2523,15 +2555,15 @@ METHOD wvtScrollbar:Create() ::ThumbPos() ::bBtnLeftTop := ; - {|| Wvt_DrawScrollButton( ::nBtn1Top,::nBtn1Left,::nBtn1Bottom,::nBtn1Right,::aPxlBtnLft,2 ) } + {|| Wvt_DrawScrollButton( ::nBtn1Top, ::nBtn1Left, ::nBtn1Bottom, ::nBtn1Right, ::aPxlBtnLft, 2 ) } ::bBtnRightBottom := ; - {|| Wvt_DrawScrollButton( ::nBtn2Top,::nBtn2Left,::nBtn2Bottom,::nBtn2Right,::aPxlBtnRgt,4 ) } + {|| Wvt_DrawScrollButton( ::nBtn2Top, ::nBtn2Left, ::nBtn2Bottom, ::nBtn2Right, ::aPxlBtnRgt, 4 ) } ::bBtnScroll := ; - {|| Wvt_DrawScrollThumbHorz( ::nSTop,::nSLeft,::nSBottom,::nSRight, ::aPxlScroll,::nThumbPos ) } + {|| Wvt_DrawScrollThumbHorz( ::nSTop, ::nSLeft, ::nSBottom, ::nSRight, ::aPxlScroll, ::nThumbPos ) } ::bBtnLeftTopDep := ; - {|| Wvt_DrawScrollButton( ::nBtn1Top,::nBtn1Left,::nBtn1Bottom,::nBtn1Right,::aPxlBtnLft,2,.T. ) } + {|| Wvt_DrawScrollButton( ::nBtn1Top, ::nBtn1Left, ::nBtn1Bottom, ::nBtn1Right, ::aPxlBtnLft, 2, .T. ) } ::bBtnRightBottomDep := ; - {|| Wvt_DrawScrollButton( ::nBtn2Top,::nBtn2Left,::nBtn2Bottom,::nBtn2Right,::aPxlBtnRgt,4,.T. ) } + {|| Wvt_DrawScrollButton( ::nBtn2Top, ::nBtn2Left, ::nBtn2Bottom, ::nBtn2Right, ::aPxlBtnRgt, 4, .T. ) } ENDIF @@ -2558,7 +2590,7 @@ METHOD wvtScrollbar:Configure( nTop, nLeft, nBottom, nRight ) IF ::nBarType == WVT_SCROLLBAR_VERT ::nRight := ::nLeft + 1 - ::nBottom := max( 7, ::nBottom ) + ::nBottom := Max( 7, ::nBottom ) ::nBtn1Top := ::nTop ::nBtn1Left := ::nLeft @@ -2582,7 +2614,7 @@ METHOD wvtScrollbar:Configure( nTop, nLeft, nBottom, nRight ) ::ThumbPos() ELSE ::nBottom := ::nTop - ::nRight := max( 11, ::nRight ) + ::nRight := Max( 11, ::nRight ) ::nBtn1Top := ::nTop ::nBtn1Left := ::nLeft @@ -2621,7 +2653,7 @@ METHOD wvtScrollbar:Refresh() // -METHOD wvtScrollbar:SetPos( nTotal, nCurrent ) +METHOD wvtScrollbar:setPos( nTotal, nCurrent ) DEFAULT nTotal TO Eval( ::bTotal ) DEFAULT nCurrent TO Eval( ::bCurrent ) @@ -2637,11 +2669,12 @@ METHOD wvtScrollbar:SetPos( nTotal, nCurrent ) // METHOD wvtScrollbar:ThumbPos() + LOCAL nNewPos, nRecPerUnit, nCurUnit IF ::nBarType == WVT_SCROLLBAR_VERT nRecPerUnit := ::nTotal / ::nScrollUnits - nCurUnit := int( ::nCurrent / nRecPerUnit ) + nCurUnit := Int( ::nCurrent / nRecPerUnit ) IF ::nCurrent == 1 nCurUnit := 0 @@ -2658,10 +2691,10 @@ METHOD wvtScrollbar:ThumbPos() ELSE IF ::nTotal < ::nScrollUnits - nCurUnit := ::nCurrent * int( ::nScrollUnits / ::nTotal ) + nCurUnit := ::nCurrent * Int( ::nScrollUnits / ::nTotal ) ELSE nRecPerUnit := ::nTotal / ::nScrollUnits - nCurUnit := int( ::nCurrent / nRecPerUnit ) + nCurUnit := Int( ::nCurrent / nRecPerUnit ) ENDIF IF ::nCurrent == 1 @@ -2675,7 +2708,7 @@ METHOD wvtScrollbar:ThumbPos() IF nNewPos < ::nSLeft nNewPos := ::nSLeft ELSEIF nNewPos > ::nSRight - 1 - nNewPos := ::nSRight-1 + nNewPos := ::nSRight - 1 ENDIF ENDIF @@ -2694,8 +2727,8 @@ METHOD wvtScrollbar:GetPos() METHOD wvtScrollbar:SetTooltip() - ::Tooltip := ltrim( str( ::nCurrent,12,0 ) ) + " / " + ; - ltrim( str( ::nTotal ,12,0 ) ) + ::Tooltip := LTrim( Str( ::nCurrent,12,0 ) ) + " / " + ; + LTrim( Str( ::nTotal ,12,0 ) ) Wvt_SetToolTip( ::nTop, ::nLeft, ::nBottom, ::nRight, ::Tooltip ) @@ -2704,11 +2737,12 @@ METHOD wvtScrollbar:SetTooltip() // METHOD wvtScrollbar:HandleEvent( nKey ) + LOCAL nmRow, nmCol, nOff LOCAL lHit := .F. - LOCAL mKeys_:={ K_LBUTTONDOWN, K_LBUTTONUP, K_MMLEFTDOWN, K_LBUTTONPRESSED } + LOCAL mKeys_ := { K_LBUTTONDOWN, K_LBUTTONUP, K_MMLEFTDOWN, K_LBUTTONPRESSED } - IF ascan( mKeys_, nKey ) == 0 + IF AScan( mKeys_, nKey ) == 0 RETURN .F. ENDIF @@ -2720,13 +2754,13 @@ METHOD wvtScrollbar:HandleEvent( nKey ) lHit := .T. DO CASE - CASE ::lAnchored .and. nKey == K_MMLEFTDOWN + CASE ::lAnchored .AND. nKey == K_MMLEFTDOWN IF nmRow != ::nThumbPos nOff := ::nThumbPos - nmRow IF nOff > 0 - ::nThumbPos := max( ::nTop+1, nmRow ) + ::nThumbPos := Max( ::nTop + 1, nmRow ) ELSE - ::nThumbPos := min( ::nBottom-1, nmRow ) + ::nThumbPos := Min( ::nBottom - 1, nmRow ) ENDIF ::nCurrent := ( ::nTotal * ( ::nThumbPos - ::nTop ) / ::nScrollUnits ) @@ -2737,7 +2771,7 @@ METHOD wvtScrollbar:HandleEvent( nKey ) ::nCurrent := 1 ENDIF - ::SetPos( ::nTotal, ::nCurrent ) + ::setPos( ::nTotal, ::nCurrent ) ::SetTooltip() Wvt_Keyboard( K_SBTHUMBTRACKVERT ) @@ -2745,17 +2779,17 @@ METHOD wvtScrollbar:HandleEvent( nKey ) lHit := .F. ENDIF - CASE ::lAnchored .and. nKey == K_LBUTTONUP + CASE ::lAnchored .AND. nKey == K_LBUTTONUP ::lAnchored := .F. OTHERWISE lHit := .F. - IF nmCol >= ::nLeft .and. nmCol <= ::nRight + IF nmCol >= ::nLeft .AND. nmCol <= ::nRight lHit := .T. DO CASE - CASE nmRow == ::nThumbPos .and. nKey == K_LBUTTONDOWN + CASE nmRow == ::nThumbPos .AND. nKey == K_LBUTTONDOWN ::lAnchored := .T. CASE nKey == K_LBUTTONUP @@ -2765,8 +2799,8 @@ METHOD wvtScrollbar:HandleEvent( nKey ) Eval( ::bBtnLeftTop ) CASE nmRow == ::nBottom Eval( ::bBtnRightBottom ) - CASE nmRow < ::nThumbPos .and. nmRow > ::nTop - CASE nmRow > ::nThumbPos .and. nmRow < ::nBottom + CASE nmRow < ::nThumbPos .AND. nmRow > ::nTop + CASE nmRow > ::nThumbPos .AND. nmRow < ::nBottom OTHERWISE lHit := .F. ENDCASE @@ -2782,9 +2816,9 @@ METHOD wvtScrollbar:HandleEvent( nKey ) Wvt_Keyboard( K_SBLINEUP ) CASE nmRow == ::nBottom Wvt_Keyboard( K_SBLINEDOWN ) - CASE nmRow < ::nThumbPos .and. nmRow > ::nTop + CASE nmRow < ::nThumbPos .AND. nmRow > ::nTop Wvt_Keyboard( K_SBPAGEUP ) - CASE nmRow > ::nThumbPos .and. nmRow < ::nBottom + CASE nmRow > ::nThumbPos .AND. nmRow < ::nBottom Wvt_Keyboard( K_SBPAGEDOWN ) OTHERWISE lHit := .F. @@ -2799,9 +2833,9 @@ METHOD wvtScrollbar:HandleEvent( nKey ) CASE nmRow == ::nBottom Eval( ::bBtnRightBottomDep ) Wvt_Keyboard( K_SBLINEDOWN ) - CASE nmRow < ::nThumbPos .and. nmRow > ::nTop + CASE nmRow < ::nThumbPos .AND. nmRow > ::nTop Wvt_Keyboard( K_SBPAGEUP ) - CASE nmRow > ::nThumbPos .and. nmRow < ::nBottom + CASE nmRow > ::nThumbPos .AND. nmRow < ::nBottom Wvt_Keyboard( K_SBPAGEDOWN ) OTHERWISE lHit := .F. @@ -2816,17 +2850,17 @@ METHOD wvtScrollbar:HandleEvent( nKey ) CASE ::nBarType == WVT_SCROLLBAR_HORZ DO CASE - CASE ::lAnchored .and. nKey == K_MMLEFTDOWN - IF ( lHit := ( nmCol < ::nThumbPos .or. nmCol > ::nThumbPos+1 ) ) + CASE ::lAnchored .AND. nKey == K_MMLEFTDOWN + IF ( lHit := ( nmCol < ::nThumbPos .OR. nmCol > ::nThumbPos + 1 ) ) nOff := ::nThumbPos - nmCol IF nOff > 0 - ::nThumbPos := max( ::nLeft+2, nmCol ) + ::nThumbPos := Max( ::nLeft + 2, nmCol ) ELSE - ::nThumbPos := min( ::nRight-2, nmCol ) + ::nThumbPos := Min( ::nRight - 2, nmCol ) ENDIF - ::nCurrent := ( ::nTotal * ( ::nThumbPos - ::nLeft+1 ) / ::nScrollUnits ) + ::nCurrent := ( ::nTotal * ( ::nThumbPos - ::nLeft + 1 ) / ::nScrollUnits ) IF ::nCurrent > ::nTotal ::nCurrent := ::nTotal @@ -2835,33 +2869,33 @@ METHOD wvtScrollbar:HandleEvent( nKey ) ::nCurrent := 1 ENDIF - ::SetPos( ::nTotal, ::nCurrent ) + ::setPos( ::nTotal, ::nCurrent ) Wvt_Keyboard( K_SBTHUMBTRACKHORZ ) ENDIF - CASE ::lAnchored .and. nKey == K_LBUTTONUP + CASE ::lAnchored .AND. nKey == K_LBUTTONUP ::lAnchored := .F. lHit := .T. OTHERWISE - IF ( lHit := nmRow == ::nTop .and. nmCol >= ::nLeft .and. nmCol <= ::nRight ) + IF ( lHit := nmRow == ::nTop .AND. nmCol >= ::nLeft .AND. nmCol <= ::nRight ) DO CASE - CASE nKey == K_LBUTTONDOWN .and. nmCol >= ::nThumbPos .and. nmCol <= ::nThumbPos+1 + CASE nKey == K_LBUTTONDOWN .AND. nmCol >= ::nThumbPos .AND. nmCol <= ::nThumbPos + 1 ::lAnchored := .T. CASE nKey == K_LBUTTONUP IF ( lHit := ::lOnLeftDown ) DO CASE - CASE nmCol >= ::nLeft .and. nmCol <= ::nLeft+1 + CASE nmCol >= ::nLeft .AND. nmCol <= ::nLeft + 1 Eval( ::bBtnLeftTop ) - CASE nmCol >= ::nRight-1 .and. nmCol <= ::nRight + CASE nmCol >= ::nRight - 1 .AND. nmCol <= ::nRight Eval( ::bBtnRightBottom ) CASE nmCol < ::nThumbPos - CASE nmCol > ::nThumbPos+1 + CASE nmCol > ::nThumbPos + 1 OTHERWISE lHit := .F. ENDCASE @@ -2873,13 +2907,13 @@ METHOD wvtScrollbar:HandleEvent( nKey ) CASE nKey == K_LBUTTONPRESSED IF ( lHit := ::lOnLeftDown ) DO CASE - CASE nmCol == ::nLeft .or. nmCol == ::nLeft+1 + CASE nmCol == ::nLeft .OR. nmCol == ::nLeft + 1 Wvt_Keyboard( K_SBLINELEFT ) - CASE nmCol == ::nRight .or. nmCol == ::nRight-1 + CASE nmCol == ::nRight .OR. nmCol == ::nRight - 1 Wvt_Keyboard( K_SBLINERIGHT ) CASE nmCol < ::nThumbPos Wvt_Keyboard( K_SBPAGELEFT ) - CASE nmCol > ::nThumbPos+1 + CASE nmCol > ::nThumbPos + 1 Wvt_Keyboard( K_SBPAGERIGHT ) OTHERWISE lHit := .F. @@ -2888,15 +2922,15 @@ METHOD wvtScrollbar:HandleEvent( nKey ) CASE nKey == K_LBUTTONDOWN DO CASE - CASE nmCol == ::nLeft .or. nmCol == ::nLeft+1 + CASE nmCol == ::nLeft .OR. nmCol == ::nLeft + 1 Eval( ::bBtnLeftTopDep ) Wvt_Keyboard( K_SBLINELEFT ) - CASE nmCol == ::nRight .or. nmCol == ::nRight-1 + CASE nmCol == ::nRight .OR. nmCol == ::nRight - 1 Eval( ::bBtnRightBottomDep ) Wvt_Keyboard( K_SBLINERIGHT ) CASE nmCol < ::nThumbPos Wvt_Keyboard( K_SBPAGELEFT ) - CASE nmCol > ::nThumbPos+1 + CASE nmCol > ::nThumbPos + 1 Wvt_Keyboard( K_SBPAGERIGHT ) OTHERWISE lHit := .F. @@ -2939,7 +2973,7 @@ CLASS WvtBanner FROM WvtObject DATA nCurAlign METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD Configure() METHOD Refresh() METHOD HoverOn() @@ -2948,7 +2982,7 @@ CLASS WvtBanner FROM WvtObject METHOD SetText( cText ) METHOD Destroy() - ENDCLASS +ENDCLASS // @@ -2984,7 +3018,7 @@ METHOD WvtBanner:Create() ::oLabel:Create() ::nCurSeconds := Seconds() - ::nTextLen := len( ::cText ) + ::nTextLen := Len( ::cText ) ::nTextIndex := iif( ::nDirection == 0, 1, ::nTextLen ) ::nCurAlign := ::nDirection @@ -3028,9 +3062,10 @@ METHOD WvtBanner:SetText( cText ) // METHOD WvtBanner:Refresh() + LOCAL nNewTime - IF abs( ( nNewTime := Seconds() ) - ::nCurSeconds ) >= ::nTimeDelay + IF Abs( ( nNewTime := Seconds() ) - ::nCurSeconds ) >= ::nTimeDelay ::nCurSeconds := nNewTime IF ::nDirection == 0 @@ -3041,9 +3076,9 @@ METHOD WvtBanner:Refresh() ENDIF IF ::nCurAlign == 0 /* Left */ - ::cDispText := substr( ::cText,::nTextIndex ) + ::cDispText := SubStr( ::cText, ::nTextIndex ) ELSE /* Right */ - ::cDispText := substr( ::cText, 1, ::nTextIndex ) + ::cDispText := SubStr( ::cText, 1, ::nTextIndex ) ENDIF ELSE ::nTextIndex-- @@ -3053,9 +3088,9 @@ METHOD WvtBanner:Refresh() ENDIF IF ::nCurAlign == 0 /* Left */ - ::cDispText := substr( ::cText,::nTextIndex ) + ::cDispText := SubStr( ::cText, ::nTextIndex ) ELSE /* Right */ - ::cDispText := substr( ::cText, 1, ::nTextIndex ) + ::cDispText := SubStr( ::cText, 1, ::nTextIndex ) ENDIF ENDIF @@ -3097,14 +3132,14 @@ CLASS WvtTextBox FROM WvtObject DATA cText INIT "" METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() + METHOD create() METHOD Configure() METHOD Refresh() METHOD SetText( cText ) METHOD HoverOn() METHOD HoverOff() - ENDCLASS +ENDCLASS // @@ -3121,15 +3156,15 @@ METHOD WvtTextBox:Create() ::nTextColorHoverOff := ::nTextColor ::hFont := Wvt_CreateFont( ::cFont, ::nFontHeight, ::nFontWidth, ; - ::nFontWeight, ::lItalic, ::lUnderline, ::lStrikeout, ; - ::nCharSet, ::nFontQuality, 0 ) + ::nFontWeight, ::lItalic, ::lUnderline, ::lStrikeout, ; + ::nCharSet, ::nFontQuality, 0 ) IF ::hFont != 0 ::bPaint := {|| Wvt_DrawTextBox( ::nTop, ::nLeft, ::nBottom, ::nRight, ; - ::aPxlTLBR, ::cText, ::nAlignHorz, ::nAlignVert, ; - ::nTextColor, ::nBackColor, ::nBackMode, ::hFont ) } + ::aPxlTLBR, ::cText, ::nAlignHorz, ::nAlignVert, ; + ::nTextColor, ::nBackColor, ::nBackMode, ::hFont ) } - aadd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) + AAdd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) ENDIF ::Super:Create() @@ -3181,7 +3216,7 @@ METHOD WvtTextBox:HoverOff( /*cText*/ ) ::Refresh() ENDIF -RETURN Self + RETURN Self // // @@ -3201,7 +3236,7 @@ CLASS WvtProgressBar FROM WvtObject DATA lVertical INIT .F. DATA lActive INIT .F. - DATA nBarColor INIT RGB( 0,0,128 ) + DATA nBarColor INIT RGB( 0, 0, 128 ) DATA nCurrent INIT 0 DATA nTotal INIT 1 DATA nPercent INIT 0 @@ -3210,12 +3245,12 @@ CLASS WvtProgressBar FROM WvtObject DATA cScreen METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) - METHOD Create() - METHOD Display( nCurrent, nTotal ) + METHOD create() + METHOD display( nCurrent, nTotal ) METHOD Activate() METHOD DeActivate() - ENDCLASS +ENDCLASS // @@ -3233,11 +3268,11 @@ METHOD WvtProgressBar:Create() DEFAULT ::nLeft TO 0 DEFAULT ::nBottom TO iif( ::lVertical, ::nTop + 9, ::nTop ) DEFAULT ::nRight TO iif( ::lVertical, ::nLeft + 1, ::nLeft + 19 ) - DEFAULT ::nTextColor TO RGB( 255,255,255 ) - DEFAULT ::nBackColor TO RGB( 198,198,198 ) + DEFAULT ::nTextColor TO RGB( 255, 255, 255 ) + DEFAULT ::nBackColor TO RGB( 198, 198, 198 ) ::bPaint := {|| ::Display() } - aadd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) + AAdd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } ) ::Super:Create() @@ -3248,7 +3283,7 @@ METHOD WvtProgressBar:Create() METHOD WvtProgressBar:Display( nCurrent, nTotal ) IF !( ::lActive ) - return Self + RETURN Self ENDIF DEFAULT nCurrent TO ::nCurrent @@ -3261,10 +3296,11 @@ METHOD WvtProgressBar:Display( nCurrent, nTotal ) ::nCurrent := ::nTotal ENDIF - ::nPercent := int( ::nCurrent / ::nTotal * 100 ) + ::nPercent := Int( ::nCurrent / ::nTotal * 100 ) Wvt_DrawProgressBar( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlTLBR, ::nPercent, ; - ::nBackColor, ::nBarColor, ::cImage, ::lVertical, ::nDirection ) + ::nBackColor, ::nBarColor, ::cImage, ::lVertical, ::nDirection ) + RETURN Self // @@ -3302,7 +3338,7 @@ METHOD WvtProgressBar:DeActivate() CLASS wvtMenu - METHOD Create( cCaption ) + METHOD create( cCaption ) METHOD AddItem( cCaption, bAction ) METHOD DelAllItems() METHOD DelItem( nItemNum ) @@ -3321,19 +3357,20 @@ CLASS wvtMenu VAR Caption VAR IdNumber - ENDCLASS +ENDCLASS // METHOD wvtMenu:Create( cCaption ) + ::aItems := {} - IF EMPTY( ::hMenu:= Wvt_CreateMenu() ) - #IF 0 + IF Empty( ::hMenu := Wvt_CreateMenu() ) +#if 0 Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Init()", "Create Menu Error", { cCaption, cCaption },"wvt.prg" ) ) - #ENDIF +#endif ENDIF - ::Caption:= iif( cCaption == NIL, "", cCaption ) + ::Caption := iif( cCaption == NIL, "", cCaption ) RETURN Self @@ -3341,15 +3378,15 @@ METHOD wvtMenu:Create( cCaption ) METHOD wvtMenu:Destroy() - IF !EMPTY( ::hMenu ) + IF !Empty( ::hMenu ) ::DelAllItems() IF !Wvt_DestroyMenu( ::hMenu ) - #IF 0 +#if 0 Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Destroy()", "Destroy menu FAILED", {},"wvt.prg" ) ) - #ENDIF +#endif ENDIF - ::hMenu:= 0 + ::hMenu := 0 ENDIF RETURN .T. @@ -3357,30 +3394,31 @@ METHOD wvtMenu:Destroy() // METHOD wvtMenu:AddItem( cCaption, bAction ) - LOCAL lResult:= .F., aItem - IF !EMPTY( ::hMenu ) .AND. ( !EMPTY( cCaption ) .OR. !EMPTY( bAction ) ) + LOCAL lResult := .F. , aItem + + IF !Empty( ::hMenu ) .AND. ( !Empty( cCaption ) .OR. !Empty( bAction ) ) IF HB_ISOBJECT( bAction ) - cCaption:= iif(!EMPTY(cCaption),cCaption,bAction:Caption) - aItem:= {MF_POPUP,bAction:hMenu,cCaption,bAction} /* bAction is a wvtMenu object reference */ - ELSEIF HB_ISBLOCK(bAction) - aItem:= {MF_STRING,::MenuItemId++,cCaption,bAction} /* bAction is a code block to execute */ - ELSEIF left( cCaption, 1 )=="-" - aItem:= {MF_SEPARATOR,0,0,NIL} + cCaption := iif( !Empty( cCaption ), cCaption, bAction:Caption ) + aItem := { MF_POPUP, bAction:hMenu, cCaption, bAction } /* bAction is a wvtMenu object reference */ + ELSEIF HB_ISBLOCK( bAction ) + aItem := { MF_STRING, ::MenuItemId++, cCaption, bAction } /* bAction is a code block to execute */ + ELSEIF Left( cCaption, 1 ) == "-" + aItem := { MF_SEPARATOR, 0, 0, NIL } ELSE - #IF 0 +#if 0 Throw( ErrorNew( "wvtMenu", 3101, "wvtMenu:AddItem()", "Argument Error", { cCaption, bAction },"wvt.prg" ) ) - #ENDIF +#endif ENDIF - IF !Wvt_AppendMenu(::hMenu, aItem[WVT_MENU_TYPE],aItem[WVT_MENU_IDENTIFIER],aItem[WVT_MENU_CAPTION]) - #IF 0 + IF !Wvt_AppendMenu( ::hMenu, aItem[WVT_MENU_TYPE], aItem[WVT_MENU_IDENTIFIER], aItem[WVT_MENU_CAPTION] ) +#if 0 Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:AddItem()", "Add menu item", { cCaption, bAction },"wvt.prg" ) ) - #ENDIF +#endif ENDIF - AADD(::aItems, aItem) - lResult:= .T. + AAdd( ::aItems, aItem ) + lResult := .T. ENDIF RETURN lResult @@ -3388,10 +3426,11 @@ METHOD wvtMenu:AddItem( cCaption, bAction ) // METHOD wvtMenu:DelAllItems() - LOCAL lResult:= .T., nItems + + LOCAL lResult := .T. , nItems nItems := ::NumItems() - DO WHILE nItems>0 .AND. lResult + DO WHILE nItems > 0 .AND. lResult lResult := ::DelItem( nItems ) nItems-- ENDDO @@ -3401,20 +3440,21 @@ METHOD wvtMenu:DelAllItems() // METHOD wvtMenu:DelItem( nItemNum ) - LOCAL lResult:= .F. + + LOCAL lResult := .F. IF nItemNum > 0 .AND. nItemNum <= ::NumItems() - IF ::aItems[ nItemNum,WVT_MENU_TYPE ]== MF_POPUP + IF ::aItems[ nItemNum,WVT_MENU_TYPE ] == MF_POPUP ::aItems[ nItemNum,WVT_MENU_MENUOBJ ]:Destroy() ENDIF - IF ( lResult:= Wvt_DeleteMenu(::hMenu, nItemNum-1,MF_BYPOSITION)) /* Remember ZERO base */ - ADEL( ::aItems, nItemNum ) - ASIZE( ::aItems, LEN( ::aItems ) - 1 ) + IF ( lResult := Wvt_DeleteMenu( ::hMenu, nItemNum - 1,MF_BYPOSITION ) ) /* Remember ZERO base */ + ADel( ::aItems, nItemNum ) + ASize( ::aItems, Len( ::aItems ) - 1 ) ELSE - #IF 0 +#if 0 Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:DelItem()", "Delete menu item FAILED", { nItemNum },"wvt.prg" ) ) - #ENDIF +#endif ENDIF ENDIF @@ -3423,10 +3463,11 @@ METHOD wvtMenu:DelItem( nItemNum ) // METHOD wvtMenu:EnableItem( nItemNum ) - LOCAL nPrevious:= -1 - IF !EMPTY( ::hMenu ) .AND. !EMPTY( nItemNum ) - nPrevious:= Wvt_EnableMenuItem( ::hMenu, nItemNum-1, MF_BYPOSITION + MF_ENABLED ) + LOCAL nPrevious := - 1 + + IF !Empty( ::hMenu ) .AND. !Empty( nItemNum ) + nPrevious := Wvt_EnableMenuItem( ::hMenu, nItemNum - 1, MF_BYPOSITION + MF_ENABLED ) ENDIF RETURN nPrevious @@ -3434,10 +3475,11 @@ METHOD wvtMenu:EnableItem( nItemNum ) // METHOD wvtMenu:DisableItem( nItemNum ) - LOCAL nPrevious:= -1 - IF !EMPTY( ::hMenu ) .AND. !EMPTY( nItemNum ) - nPrevious:= Wvt_EnableMenuItem( ::hMenu, nItemNum-1, MF_BYPOSITION + MF_GRAYED ) + LOCAL nPrevious := - 1 + + IF !Empty( ::hMenu ) .AND. !Empty( nItemNum ) + nPrevious := Wvt_EnableMenuItem( ::hMenu, nItemNum - 1, MF_BYPOSITION + MF_GRAYED ) ENDIF RETURN nPrevious @@ -3446,15 +3488,16 @@ METHOD wvtMenu:DisableItem( nItemNum ) METHOD wvtMenu:NumItems() - RETURN LEN( ::aItems ) + RETURN Len( ::aItems ) // METHOD wvtMenu:GetItem( nItemNum ) - LOCAL nItems := ::NumItems(), aResult:= NIL + + LOCAL nItems := ::NumItems(), aResult := NIL IF nItemNum > 0 .AND. nItemNum <= nItems - aResult:= ::aItems[ nItemNum ] + aResult := ::aItems[ nItemNum ] ENDIF RETURN aResult @@ -3462,13 +3505,14 @@ METHOD wvtMenu:GetItem( nItemNum ) // METHOD wvtMenu:FindMenuItemById( nId ) - LOCAL x, aResult:= {} - IF !EMPTY( nId ) - x:= ::NumItems() - DO WHILE x > 0 .AND. EMPTY( aResult ) + LOCAL x, aResult := {} + + IF !Empty( nId ) + x := ::NumItems() + DO WHILE x > 0 .AND. Empty( aResult ) IF ::aItems[ x,WVT_MENU_TYPE ] == MF_POPUP - aResult:= ::aItems[ x,WVT_MENU_MENUOBJ ]:FindMenuItemById( nId ) + aResult := ::aItems[ x,WVT_MENU_MENUOBJ ]:FindMenuItemById( nId ) ELSEIF ::aItems[ x,WVT_MENU_IDENTIFIER ] == nId aResult := ::aItems[ x ] ENDIF @@ -3502,31 +3546,32 @@ CLASS WvtConsole FROM WvtObject METHOD Say( nRow, nCol, xExp, cColor ) METHOD Box( nRow, nCol, n2Row, n2Col, cBoxChars, cColor ) - ENDCLASS +ENDCLASS // METHOD WvtConsole:New( oParent ) - ::Super:New( oParent, DLG_OBJ_CONSOLE, , -1, -1, -1, -1 ) + ::Super:New( oParent, DLG_OBJ_CONSOLE, , - 1, - 1, - 1, - 1 ) RETURN Self // METHOD WvtConsole:Say( nRow, nCol, xExp, cColor ) + LOCAL nCRow, nCCol, nCursor - IF nRow >=0 .and. nCol >= 0 .and. xExp != nil + IF nRow >= 0 .AND. nCol >= 0 .AND. xExp != nil nCursor := SetCursor( SC_NONE ) nCRow := Row() nCCol := Col() DispOutAt( nRow, nCol, xExp, cColor ) - SetPos( nCRow, nCCol ) + setPos( nCRow, nCCol ) SetCursor( nCursor ) ENDIF -RETURN Self + RETURN Self // @@ -3534,12 +3579,12 @@ METHOD WvtConsole:Box( nRow, nCol, n2Row, n2Col, cBoxChars, cColor ) LOCAL nCRow, nCCol, nCursor - IF nRow >=0 .and. nCol >= 0 + IF nRow >= 0 .AND. nCol >= 0 nCursor := SetCursor( SC_NONE ) nCRow := Row() nCCol := Col() DispBox( nRow, nCol, n2Row, n2Col, cBoxChars, cColor ) - SetPos( nCRow, nCCol ) + setPos( nCRow, nCCol ) SetCursor( nCursor ) ENDIF @@ -3579,11 +3624,12 @@ CLASS TBrowseWVG FROM TBrowse METHOD SetVisible() - ENDCLASS +ENDCLASS // METHOD TBrowseWVG:SetVisible() + LOCAL lFirst, aCol, nColPos ::Super:SetVisible() @@ -3602,7 +3648,7 @@ METHOD TBrowseWVG:SetVisible() nColPos += Int( aCol[ _TBCI_SEPWIDTH ]/2 ) ENDIF - aadd( ::aColumnsSep, nColPos ) + AAdd( ::aColumnsSep, nColPos ) ENDIF ENDIF NEXT diff --git a/harbour/contrib/gtwvg/combobox.prg b/harbour/contrib/gtwvg/combobox.prg index 3977e95cbd..e13fd9f778 100644 --- a/harbour/contrib/gtwvg/combobox.prg +++ b/harbour/contrib/gtwvg/combobox.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -78,7 +79,7 @@ CLASS WvgComboBox INHERIT WvgWindow, WvgDataRef - DATA type INIT WVGCOMBO_DROPDOWN + DATA TYPE INIT WVGCOMBO_DROPDOWN DATA drawMode INIT WVG_DRAW_NORMAL DATA nCurSelected INIT 0 @@ -96,10 +97,10 @@ CLASS WvgComboBox INHERIT WvgWindow, WvgDataRef METHOD sleSize() METHOD addItem( cItem ) - METHOD clear() INLINE ::sendCBMessage( CB_RESETCONTENT ) - METHOD delItem( nIndex ) INLINE ::sendCBMessage( CB_DELETESTRING, nIndex-1 ) - METHOD getItem( nIndex ) INLINE ::sendCBMessage( CB_GETLBTEXT, nIndex-1 ) - METHOD insItem( nIndex, cItem ) INLINE ::sendCBMessage( CB_INSERTSTRING, nIndex-1, cItem ) + METHOD CLEAR() INLINE ::sendCBMessage( CB_RESETCONTENT ) + METHOD delItem( nIndex ) INLINE ::sendCBMessage( CB_DELETESTRING, nIndex - 1 ) + METHOD getItem( nIndex ) INLINE ::sendCBMessage( CB_GETLBTEXT, nIndex - 1 ) + METHOD insItem( nIndex, cItem ) INLINE ::sendCBMessage( CB_INSERTSTRING, nIndex - 1, cItem ) METHOD setItem( nIndex, cItem ) VIRTUAL METHOD setIcon( nItem, cIcon ) @@ -116,7 +117,7 @@ CLASS WvgComboBox INHERIT WvgWindow, WvgDataRef METHOD itemSelected( ... ) SETGET METHOD drawItem( ... ) SETGET - ENDCLASS +ENDCLASS // @@ -125,7 +126,7 @@ METHOD WvgComboBox:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::wvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::style := WS_CHILD + WS_TABSTOP + WS_BORDER + WS_VSCROLL + CBS_NOINTEGRALHEIGHT + CBS_AUTOHSCROLL - //::exStyle := WS_EX_CLIENTEDGE +//::exStyle := WS_EX_CLIENTEDGE ::className := "COMBOBOX" ::objType := objTypeComboBox @@ -160,7 +161,7 @@ METHOD WvgComboBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::setPosAndSize() /* Build SLE and ListBox Part - May not be available for all Windows Versions - How to handle then ? */ - IF ! empty( ::aInfo := ::sendCBMessage( CB_GETCOMBOBOXINFO ) ) + IF ! Empty( ::aInfo := ::sendCBMessage( CB_GETCOMBOBOXINFO ) ) ::oSLE := WvgSLE():new() ::oSLE:oParent := Self ::oSLE:hWnd := ::aInfo[ 5 ] @@ -177,13 +178,17 @@ METHOD WvgComboBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) // METHOD WvgComboBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + RETURN Self // METHOD WvgComboBox:destroy() + #if 0 + IF HB_ISOBJECT( ::oSLE ) ::oSLE:destroy() ENDIF @@ -192,6 +197,7 @@ METHOD WvgComboBox:destroy() ENDIF #endif ::wvgWindow:destroy() + RETURN NIL // @@ -208,7 +214,7 @@ METHOD WvgComboBox:handleEvent( nMessage, aNM ) CASE nMessage == HB_GTE_COMMAND IF aNM[ 1 ] == CBN_SELCHANGE - ::nCurSelected := ::editBuffer := WVG_LBGetCurSel( ::hWnd )+ 1 + ::nCurSelected := ::editBuffer := WVG_LBGetCurSel( ::hWnd ) + 1 IF ::isParentCrt() ::oParent:setFocus() ENDIF @@ -275,11 +281,12 @@ METHOD WvgComboBox:addItem( cItem ) RETURN ::sendCBMessage( CB_ADDSTRING, cItem ) ENDIF - RETURN -1 + RETURN - 1 // METHOD WvgComboBox:listBoxFocus( lFocus ) + LOCAL lOldFocus := ::sendCBMessage( CB_GETDROPPEDSTATE ) IF HB_ISLOGICAL( lFocus ) @@ -296,7 +303,7 @@ METHOD WvgComboBox:sleSize() RETURN ::oSLE:currentSize() ENDIF - RETURN {0,0} + RETURN { 0, 0 } // @@ -306,44 +313,55 @@ METHOD WvgComboBox:listBoxSize() RETURN ::oListBox:currentSize() ENDIF - RETURN {0,0} + RETURN { 0, 0 } // METHOD WvgComboBox:setIcon( nItem, cIcon ) + HB_SYMBOL_UNUSED( nItem ) HB_SYMBOL_UNUSED( cIcon ) + RETURN Self // METHOD WvgComboBox:itemMarked( ... ) - LOCAL a_:= hb_aParams() - IF len( a_ ) == 1 .AND. HB_ISBLOCK( a_[ 1 ] ) + + LOCAL a_ := hb_AParams() + + IF Len( a_ ) == 1 .AND. HB_ISBLOCK( a_[ 1 ] ) ::sl_itemMarked := a_[ 1 ] - ELSEIF len( a_ ) >= 0 .AND. HB_ISBLOCK( ::sl_itemMarked ) - eval( ::sl_itemMarked, NIL, NIL, Self ) + ELSEIF Len( a_ ) >= 0 .AND. HB_ISBLOCK( ::sl_itemMarked ) + Eval( ::sl_itemMarked, NIL, NIL, Self ) ENDIF + RETURN Self // METHOD WvgComboBox:itemSelected( ... ) - LOCAL a_:= hb_aParams() - IF len( a_ ) == 1 .AND. HB_ISBLOCK( a_[ 1 ] ) + + LOCAL a_ := hb_AParams() + + IF Len( a_ ) == 1 .AND. HB_ISBLOCK( a_[ 1 ] ) ::sl_itemSelected := a_[ 1 ] - ELSEIF len( a_ ) >= 0 .AND. HB_ISBLOCK( ::sl_itemSelected ) - eval( ::sl_itemSelected, NIL, NIL, Self ) + ELSEIF Len( a_ ) >= 0 .AND. HB_ISBLOCK( ::sl_itemSelected ) + Eval( ::sl_itemSelected, NIL, NIL, Self ) ENDIF + RETURN Self // METHOD WvgComboBox:drawItem( ... ) - LOCAL a_:= hb_aParams() - IF len( a_ ) == 1 .AND. HB_ISBLOCK( a_[ 1 ] ) + + LOCAL a_ := hb_AParams() + + IF Len( a_ ) == 1 .AND. HB_ISBLOCK( a_[ 1 ] ) ::sl_xbePDrawItem := a_[ 1 ] - ELSEIF len( a_ ) >= 2 .AND. HB_ISBLOCK( ::sl_xbePDrawItem ) - eval( ::sl_xbePDrawItem, a_[ 1 ], a_[ 2 ], Self ) + ELSEIF Len( a_ ) >= 2 .AND. HB_ISBLOCK( ::sl_xbePDrawItem ) + Eval( ::sl_xbePDrawItem, a_[ 1 ], a_[ 2 ], Self ) ENDIF + RETURN Self diff --git a/harbour/contrib/gtwvg/crt.prg b/harbour/contrib/gtwvg/crt.prg index dc63e64f4d..adb498dc00 100644 --- a/harbour/contrib/gtwvg/crt.prg +++ b/harbour/contrib/gtwvg/crt.prg @@ -49,18 +49,19 @@ * If you do not wish that, delete this exception notice. * */ + // // // - * - * EkOnkar - * ( The LORD is ONE ) - * - * Xbase++ Compatible xbpCrt Class - * - * Pritpal Bedi - * 08Nov2008 - * +// +// EkOnkar +// ( The LORD is ONE ) +// +// Xbase++ Compatible xbpCrt Class +// +// Pritpal Bedi +// 08Nov2008 +// // // // @@ -157,7 +158,7 @@ CLASS WvgCrt INHERIT WvgWindow, WvgPartHandler /* HARBOUR implementation */ DATA resizable INIT .T. DATA resizeMode INIT HB_GTI_RESIZEMODE_FONT - DATA style INIT (WS_OVERLAPPED + WS_CAPTION + WS_SYSMENU + WS_SIZEBOX + WS_MINIMIZEBOX + WS_MAXIMIZEBOX) + DATA style INIT ( WS_OVERLAPPED + WS_CAPTION + WS_SYSMENU + WS_SIZEBOX + WS_MINIMIZEBOX + WS_MAXIMIZEBOX ) DATA exStyle INIT 0 DATA lModal INIT .F. DATA pGTp @@ -166,8 +167,8 @@ CLASS WvgCrt INHERIT WvgWindow, WvgPartHandler DATA ClassName INIT "WVGCRT" DATA drawingArea DATA hWnd - DATA aPos INIT { 0,0 } - DATA aSize INIT { 24,79 } + DATA aPos INIT { 0, 0 } + DATA aSize INIT { 24, 79 } DATA aPresParams INIT {} DATA lHasInputFocus INIT .F. DATA nFrameState INIT 0 /* normal */ @@ -238,9 +239,9 @@ CLASS WvgCrt INHERIT WvgWindow, WvgPartHandler METHOD rbDown( xParam ) SETGET METHOD rbUp( xParam ) SETGET METHOD wheel( xParam ) SETGET - METHOD close( xParam ) SETGET + METHOD CLOSE( xParam ) SETGET METHOD helpRequest( xParam ) SETGET - METHOD keyboard( xParam ) SETGET + METHOD KEYBOARD( xParam ) SETGET METHOD killDisplayFocus( xParam ) SETGET METHOD killInputFocus( xParam ) SETGET METHOD move( xParam ) SETGET @@ -254,10 +255,10 @@ CLASS WvgCrt INHERIT WvgWindow, WvgPartHandler METHOD dragLeave( xParam ) SETGET METHOD dragDrop( xParam, xParam1 ) SETGET - ENDCLASS +ENDCLASS // - * Instance Initiation +// Instance Initiation // METHOD WvgCrt:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -283,11 +284,12 @@ METHOD WvgCrt:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) RETURN Self // - * Life Cycle +// Life Cycle // METHOD WvgCrt:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - Local lRowCol := .T. + + LOCAL lRowCol := .T. DEFAULT oParent TO ::oParent DEFAULT oOwner TO ::oOwner @@ -316,8 +318,8 @@ METHOD WvgCrt:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::pGT := hb_gtSelect() ENDIF - HB_GtInfo( HB_GTI_NOTIFIERBLOCKGUI, {| nEvent, ... | ::notifier( nEvent, ... ) } ) - HB_GtInfo( HB_GTI_NOTIFIERBLOCK , {| nEvent, ... | ::notifierBlock( nEvent, ... ) } ) + hb_gtInfo( HB_GTI_NOTIFIERBLOCKGUI, {| nEvent, ... | ::notifier( nEvent, ... ) } ) + hb_gtInfo( HB_GTI_NOTIFIERBLOCK , {| nEvent, ... | ::notifierBlock( nEvent, ... ) } ) IF ::lModal ::style := WS_POPUP + WS_CAPTION + WS_SYSMENU @@ -328,13 +330,13 @@ METHOD WvgCrt:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) hb_gtInfo( HB_GTI_RESIZABLE, ::resizable ) hb_gtInfo( HB_GTI_PRESPARAMS, { ::exStyle, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ; - ::maxRow+1, ::maxCol+1, ::pGTp, .F., lRowCol, HB_WNDTYPE_CRT } ) + ::maxRow + 1, ::maxCol + 1, ::pGTp, .F. , lRowCol, HB_WNDTYPE_CRT } ) hb_gtInfo( HB_GTI_SETFONT, { ::fontName, ::fontHeight, ::fontWidth } ) IF HB_ISNUMERIC( ::icon ) hb_gtInfo( HB_GTI_ICONRES, ::icon ) ELSE - IF ( ".ico" $ lower( ::icon ) ) + IF ( ".ico" $ Lower( ::icon ) ) hb_gtInfo( HB_GTI_ICONFILE, ::icon ) ELSE hb_gtInfo( HB_GTI_ICONRES, ::icon ) @@ -346,7 +348,7 @@ METHOD WvgCrt:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::hWnd := hb_gtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE ) ::setFocus() - Hb_GtInfo( HB_GTI_CLOSABLE , ::closable ) + hb_gtInfo( HB_GTI_CLOSABLE , ::closable ) hb_gtInfo( HB_GTI_WINTITLE , ::title ) hb_gtInfo( HB_GTI_RESIZEMODE, iif( ::resizeMode == HB_GTI_RESIZEMODE_ROWS, HB_GTI_RESIZEMODE_ROWS, HB_GTI_RESIZEMODE_FONT ) ) @@ -355,7 +357,7 @@ METHOD WvgCrt:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ENDIF IF ::visible - Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) + hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) ::lHasInputFocus := .T. ENDIF @@ -390,7 +392,7 @@ METHOD WvgCrt:destroy() ENDIF IF Len( ::aChildren ) > 0 - aeval( ::aChildren, {| o | o:destroy() } ) + AEval( ::aChildren, {| o | o:destroy() } ) ::aChildren := {} ENDIF @@ -409,7 +411,7 @@ METHOD WvgCrt:destroy() RETURN Self // - * Methods +// Methods // METHOD WvgCrt:currentPos() @@ -489,8 +491,8 @@ METHOD WvgCrt:invalidateRect( nTop, nLeft, nBottom, nRight ) DEFAULT nTop TO 0 DEFAULT nLeft TO 0 - DEFAULT nBottom TO maxrow() - DEFAULT nRight TO maxcol() + DEFAULT nBottom TO MaxRow() + DEFAULT nRight TO MaxCol() Wvt_InvalidateRect( nTop, nLeft, nBottom, nRight ) @@ -557,7 +559,8 @@ METHOD WvgCrt:setFontCompoundName() // METHOD WvgCrt:setFrameState( nState ) - Local lSuccess := .F. + + LOCAL lSuccess := .F. DO CASE @@ -573,6 +576,7 @@ METHOD WvgCrt:setFrameState( nState ) ENDCASE RETURN lSuccess + // METHOD WvgCrt:setModalState() @@ -613,12 +617,12 @@ METHOD WvgCrt:setPresParam() METHOD WvgCrt:setSize( aSize, lPaint ) - if HB_ISARRAY( aSize ) + IF HB_ISARRAY( aSize ) DEFAULT lPaint TO .T. hb_gtInfo( HB_GTI_SCREENHEIGHT, aSize[ 1 ] ) hb_gtInfo( HB_GTI_SCREENWIDTH , aSize[ 2 ] ) - endif + ENDIF RETURN Self @@ -626,7 +630,7 @@ METHOD WvgCrt:setSize( aSize, lPaint ) METHOD WvgCrt:show() - Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) + hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) ::lHasInputFocus := .T. RETURN Self @@ -646,6 +650,7 @@ METHOD WvgCrt:toBack() // METHOD WvgCrt:toFront() + RETURN WVG_SetWindowPosToTop( ::hWnd ) // @@ -661,20 +666,20 @@ METHOD WvgCrt:winDevice() RETURN Self // - * Callback Methods +// Callback Methods // METHOD WvgCrt:enter( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_enter ) - eval( ::sl_enter, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_enter ) + Eval( ::sl_enter, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_enter := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -682,15 +687,15 @@ METHOD WvgCrt:enter( xParam ) METHOD WvgCrt:leave( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_leave ) - eval( ::sl_leave, NIL, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_leave ) + Eval( ::sl_leave, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_leave := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -698,15 +703,15 @@ METHOD WvgCrt:leave( xParam ) METHOD WvgCrt:lbClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_lbClick ) - eval( ::sl_lbClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_lbClick ) + Eval( ::sl_lbClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -714,15 +719,15 @@ METHOD WvgCrt:lbClick( xParam ) METHOD WvgCrt:lbDblClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_lbDblClick ) - eval( ::sl_lbDblClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_lbDblClick ) + Eval( ::sl_lbDblClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbDblClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -730,15 +735,15 @@ METHOD WvgCrt:lbDblClick( xParam ) METHOD WvgCrt:lbDown( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_lbDown ) - eval( ::sl_lbDown, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_lbDown ) + Eval( ::sl_lbDown, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbDown := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -746,15 +751,15 @@ METHOD WvgCrt:lbDown( xParam ) METHOD WvgCrt:lbUp( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_lbUp ) - eval( ::sl_lbUp, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_lbUp ) + Eval( ::sl_lbUp, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbUp := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -762,15 +767,15 @@ METHOD WvgCrt:lbUp( xParam ) METHOD WvgCrt:mbClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_mbClick ) - eval( ::sl_mbClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_mbClick ) + Eval( ::sl_mbClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_mbClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -778,15 +783,15 @@ METHOD WvgCrt:mbClick( xParam ) METHOD WvgCrt:mbDblClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_mbDblClick ) - eval( ::sl_mbDblClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_mbDblClick ) + Eval( ::sl_mbDblClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_mbDblClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -794,15 +799,15 @@ METHOD WvgCrt:mbDblClick( xParam ) METHOD WvgCrt:mbDown( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_mbDown ) - eval( ::sl_mbDown, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_mbDown ) + Eval( ::sl_mbDown, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_mbDown := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -810,15 +815,15 @@ METHOD WvgCrt:mbDown( xParam ) METHOD WvgCrt:mbUp( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_mbUp ) - eval( ::sl_mbUp, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_mbUp ) + Eval( ::sl_mbUp, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_mbUp := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -826,15 +831,15 @@ METHOD WvgCrt:mbUp( xParam ) METHOD WvgCrt:motion( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_motion ) - eval( ::sl_motion, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_motion ) + Eval( ::sl_motion, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_motion := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -842,15 +847,15 @@ METHOD WvgCrt:motion( xParam ) METHOD WvgCrt:rbClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_rbClick ) - eval( ::sl_rbClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_rbClick ) + Eval( ::sl_rbClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_rbClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -858,15 +863,15 @@ METHOD WvgCrt:rbClick( xParam ) METHOD WvgCrt:rbDblClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_rbDblClick ) - eval( ::sl_rbDblClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_rbDblClick ) + Eval( ::sl_rbDblClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_rbDblClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -874,15 +879,15 @@ METHOD WvgCrt:rbDblClick( xParam ) METHOD WvgCrt:rbDown( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_rbDown ) - eval( ::sl_rbDown, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_rbDown ) + Eval( ::sl_rbDown, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_rbDown := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -890,15 +895,15 @@ METHOD WvgCrt:rbDown( xParam ) METHOD WvgCrt:rbUp( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_rbUp ) - eval( ::sl_rbUp, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_rbUp ) + Eval( ::sl_rbUp, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_rbUp := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -906,33 +911,33 @@ METHOD WvgCrt:rbUp( xParam ) METHOD WvgCrt:wheel( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_wheel ) - eval( ::sl_wheel, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_wheel ) + Eval( ::sl_wheel, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_wheel := xParam RETURN NIL - endif + ENDIF RETURN Self // - * Other Messages +// Other Messages // METHOD WvgCrt:close( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_close ) - eval( ::sl_close, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_close ) + Eval( ::sl_close, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_close := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -940,15 +945,15 @@ METHOD WvgCrt:close( xParam ) METHOD WvgCrt:helpRequest( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_helpRequest ) - eval( ::sl_helpRequest, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_helpRequest ) + Eval( ::sl_helpRequest, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_helpRequest := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -956,15 +961,15 @@ METHOD WvgCrt:helpRequest( xParam ) METHOD WvgCrt:keyboard( xParam ) - if HB_ISNUMERIC( xParam ) .and. HB_ISBLOCK( ::sl_keyboard ) - eval( ::sl_keyboard, xParam, NIL, Self ) + IF HB_ISNUMERIC( xParam ) .AND. HB_ISBLOCK( ::sl_keyboard ) + Eval( ::sl_keyboard, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_keyboard := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -972,15 +977,15 @@ METHOD WvgCrt:keyboard( xParam ) METHOD WvgCrt:killDisplayFocus( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_killDisplayFocus ) - eval( ::sl_killDisplayFocus, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_killDisplayFocus ) + Eval( ::sl_killDisplayFocus, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_killDisplayFocus := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -988,15 +993,15 @@ METHOD WvgCrt:killDisplayFocus( xParam ) METHOD WvgCrt:killInputFocus( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_killInputFocus ) - eval( ::sl_killInputFocus, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_killInputFocus ) + Eval( ::sl_killInputFocus, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_killInputFocus := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1004,15 +1009,15 @@ METHOD WvgCrt:killInputFocus( xParam ) METHOD WvgCrt:move( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_move ) - eval( ::sl_move, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_move ) + Eval( ::sl_move, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_move := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1020,15 +1025,15 @@ METHOD WvgCrt:move( xParam ) METHOD WvgCrt:paint( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_paint ) - eval( ::sl_paint, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_paint ) + Eval( ::sl_paint, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_paint := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1036,15 +1041,15 @@ METHOD WvgCrt:paint( xParam ) METHOD WvgCrt:quit( xParam, xParam1 ) - if HB_ISNUMERIC( xParam ) .and. HB_ISBLOCK( ::sl_quit ) - eval( ::sl_quit, xParam, xParam1, Self ) + IF HB_ISNUMERIC( xParam ) .AND. HB_ISBLOCK( ::sl_quit ) + Eval( ::sl_quit, xParam, xParam1, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_quit := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1052,11 +1057,11 @@ METHOD WvgCrt:quit( xParam, xParam1 ) METHOD WvgCrt:resize( xParam ) - if HB_ISBLOCK( xParam )/* .or. HB_ISNIL( xParam ) */ + IF HB_ISBLOCK( xParam )/* .or. HB_ISNIL( xParam ) */ ::sl_resize := xParam RETURN NIL - endif - IF empty( xParam ) + ENDIF + IF Empty( xParam ) ::sendMessage( WM_SIZE, 0, 0 ) ENDIF @@ -1066,15 +1071,15 @@ METHOD WvgCrt:resize( xParam ) METHOD WvgCrt:setDisplayFocus( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::setDisplayFocus ) - eval( ::setDisplayFocus, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::setDisplayFocus ) + Eval( ::setDisplayFocus, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::setDisplayFocus := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1082,15 +1087,15 @@ METHOD WvgCrt:setDisplayFocus( xParam ) METHOD WvgCrt:setInputFocus( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_setInputFocus ) - eval( ::sl_setInputFocus, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_setInputFocus ) + Eval( ::sl_setInputFocus, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_setInputFocus := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1098,15 +1103,15 @@ METHOD WvgCrt:setInputFocus( xParam ) METHOD WvgCrt:dragEnter( xParam, xParam1 ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_dragEnter ) - eval( ::sl_dragEnter, xParam, xParam1, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_dragEnter ) + Eval( ::sl_dragEnter, xParam, xParam1, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_dragEnter := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1114,15 +1119,15 @@ METHOD WvgCrt:dragEnter( xParam, xParam1 ) METHOD WvgCrt:dragMotion( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_dragMotion ) - eval( ::sl_dragMotion, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_dragMotion ) + Eval( ::sl_dragMotion, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_dragMotion := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1130,15 +1135,15 @@ METHOD WvgCrt:dragMotion( xParam ) METHOD WvgCrt:dragLeave( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_dragLeave ) - eval( ::sl_dragLeave, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_dragLeave ) + Eval( ::sl_dragLeave, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_dragLeave := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1146,15 +1151,15 @@ METHOD WvgCrt:dragLeave( xParam ) METHOD WvgCrt:dragDrop( xParam, xParam1 ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_dragDrop ) - eval( ::sl_dragDrop, xParam, xParam1, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_dragDrop ) + Eval( ::sl_dragDrop, xParam, xParam1, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_dragDrop := xParam RETURN NIL - endif + ENDIF RETURN Self diff --git a/harbour/contrib/gtwvg/dataref.prg b/harbour/contrib/gtwvg/dataref.prg index aee19ef76a..614ca1eb10 100644 --- a/harbour/contrib/gtwvg/dataref.prg +++ b/harbour/contrib/gtwvg/dataref.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -99,7 +100,7 @@ CLASS WvgDataRef METHOD validate( xParam ) SETGET - ENDCLASS +ENDCLASS // @@ -125,22 +126,22 @@ METHOD WvgDataRef:getData() ::sl_editBuffer := WVG_GetMessageText( ::hWnd, WM_GETTEXT, ::bufferLength + 1 ) CASE ::className == "LISTBOX" - ::sl_editBuffer := WVG_LBGetCurSel( ::hWnd )+ 1 + ::sl_editBuffer := WVG_LBGetCurSel( ::hWnd ) + 1 #if 0 /* This is contrary the documentation of Xbase++ */ IF ::oParent:className == "COMBOBOX" ::sl_editBuffer := {} FOR i := 1 TO ::numItems() - aadd( ::sl_editBuffer, ::getItem( i ) ) + AAdd( ::sl_editBuffer, ::getItem( i ) ) NEXT ELSE - ::sl_editBuffer := WVG_LBGetCurSel( ::hWnd )+ 1 + ::sl_editBuffer := WVG_LBGetCurSel( ::hWnd ) + 1 ENDIF #endif ENDCASE IF HB_ISBLOCK( ::dataLink ) - eval( ::dataLink, ::sl_editBuffer ) + Eval( ::dataLink, ::sl_editBuffer ) ENDIF RETURN ::sl_editBuffer @@ -148,12 +149,13 @@ METHOD WvgDataRef:getData() // METHOD WvgDataRef:setData( xValue, mp2 ) + LOCAL s HB_SYMBOL_UNUSED( mp2 ) IF HB_ISBLOCK( ::dataLink ) - ::sl_editBuffer := eval( ::dataLink ) + ::sl_editBuffer := Eval( ::dataLink ) ELSEIF xValue != NIL ::sl_editBuffer := xValue ENDIF @@ -169,7 +171,7 @@ METHOD WvgDataRef:setData( xValue, mp2 ) ENDIF CASE ::className == "SysTreeView32" - IF ::sl_editBuffer != NIL .and. ::sl_editBuffer:hItem != NIL + IF ::sl_editBuffer != NIL .AND. ::sl_editBuffer:hItem != NIL WVG_TreeView_SelectItem( ::hWnd, ::sl_editBuffer:hItem ) ENDIF @@ -206,8 +208,8 @@ METHOD WvgDataRef:undo() METHOD WvgDataRef:validate( xParam ) - IF PCount() == 0 .and. HB_ISBLOCK( ::sl_validate ) - RETURN eval( ::sl_validate, self ) + IF PCount() == 0 .AND. HB_ISBLOCK( ::sl_validate ) + RETURN Eval( ::sl_validate, self ) ELSEIF HB_ISBLOCK( xParam ) ::sl_validate := xParam ENDIF diff --git a/harbour/contrib/gtwvg/dialog.prg b/harbour/contrib/gtwvg/dialog.prg index b01af210b6..ec84eacccc 100644 --- a/harbour/contrib/gtwvg/dialog.prg +++ b/harbour/contrib/gtwvg/dialog.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -95,11 +96,12 @@ CLASS WvgDialog FROM WvgWindow METHOD setTitle( cTitle ) INLINE ::title := cTitle, hb_gtInfo( HB_GTI_WINTITLE, cTitle ) METHOD getTitle() INLINE hb_gtInfo( HB_GTI_WINTITLE ) METHOD calcClientRect() INLINE ::aRect := WVG_GetClientRect( ::hWnd ), ; - { 0, 0, ::aRect[ 3 ], ::aRect[ 4 ] } - METHOD calcFrameRect() INLINE ::aRect := WVG_GetWindowRect( ::hWnd ),; - { ::aRect[ 1 ], ::aRect[ 2 ], ; - ::aRect[ 3 ]-::aRect[ 1 ], ::aRect[ 4 ]-::aRect[ 2 ] } - ENDCLASS + { 0, 0, ::aRect[ 3 ], ::aRect[ 4 ] } + METHOD calcFrameRect() INLINE ::aRect := WVG_GetWindowRect( ::hWnd ), ; + { ::aRect[ 1 ], ::aRect[ 2 ], ; + ::aRect[ 3 ] - ::aRect[ 1 ], ::aRect[ 4 ] - ::aRect[ 2 ] } + +ENDCLASS // @@ -112,13 +114,14 @@ METHOD WvgDialog:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::mouseMode := 0 ::objType := objTypeDialog - ::style := WS_THICKFRAME+WS_OVERLAPPED+WS_CAPTION+WS_SYSMENU+WS_MINIMIZEBOX+WS_MAXIMIZEBOX + ::style := WS_THICKFRAME + WS_OVERLAPPED + WS_CAPTION + WS_SYSMENU + WS_MINIMIZEBOX + WS_MAXIMIZEBOX RETURN Self // METHOD WvgDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + LOCAL oW ::WvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -126,19 +129,19 @@ METHOD WvgDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) if ::lModal ::pGT := hb_gtCreate( "WGU" ) ::pGTp := hb_gtSelect( ::pGT ) - else + ELSE hb_gtReload( "WGU" ) ::pGT := hb_gtSelect() - endif + ENDIF hb_gtInfo( HB_GTI_PRESPARAMS, { ::exStyle, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ; - ::aSize[ 1 ], ::aSize[ 2 ], ::pGTp, .F., .F., HB_WNDTYPE_DIALOG } ) + ::aSize[ 1 ], ::aSize[ 2 ], ::pGTp, .F. , .F. , HB_WNDTYPE_DIALOG } ) if ::visible hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) ELSE hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_HIDE ) - endif + ENDIF ::hWnd := hb_gtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE ) @@ -146,26 +149,26 @@ METHOD WvgDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) hb_gtInfo( HB_GTI_CLOSABLE , ::closable ) hb_gtInfo( HB_GTI_WINTITLE , ::title ) - if !empty( ::icon ) - if HB_ISNUMERIC( ::icon ) + IF !Empty( ::icon ) + IF HB_ISNUMERIC( ::icon ) hb_gtInfo( HB_GTI_ICONRES, ::icon ) - elseif HB_ISSTRING( ::icon ) + ELSEIF HB_ISSTRING( ::icon ) hb_gtInfo( HB_GTI_ICONFILE, ::icon ) - endif - endif + ENDIF + ENDIF if ::lModal hb_gtInfo( HB_GTI_DISABLE, ::pGTp ) - endif + ENDIF if ::visible ::lHasInputFocus := .T. ENDIF - oW := WvgDrawingArea():new( Self ):create( , , {0,0}, Self:currentSize(), , .F. ) - IF ! empty( oW:hWnd ) + oW := WvgDrawingArea():new( Self ):create( , , { 0, 0 }, Self:currentSize(), , .F. ) + IF ! Empty( oW:hWnd ) ::drawingArea := oW ELSE ::drawingArea := Self @@ -192,10 +195,10 @@ METHOD WvgDialog:destroy() ENDIF IF Len( ::aChildren ) > 0 - aeval( ::aChildren, {| o | o:destroy() } ) + AEval( ::aChildren, {| o | o:destroy() } ) ENDIF - IF !empty( ::hBrushBG ) + IF !Empty( ::hBrushBG ) WVG_DeleteObject( ::hBrushBG ) ENDIF @@ -207,6 +210,7 @@ METHOD WvgDialog:destroy() // METHOD WvgDialog:setFrameState( nState ) + LOCAL lSuccess := .F. DO CASE diff --git a/harbour/contrib/gtwvg/drawarea.prg b/harbour/contrib/gtwvg/drawarea.prg index 399efd4971..90372cf7e9 100644 --- a/harbour/contrib/gtwvg/drawarea.prg +++ b/harbour/contrib/gtwvg/drawarea.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -87,7 +88,8 @@ CLASS WvgDrawingArea INHERIT WvgWindow METHOD destroy() METHOD handleEvent( nMessage, aNM ) - ENDCLASS +ENDCLASS + // METHOD WvgDrawingArea:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -128,9 +130,9 @@ METHOD WvgDrawingArea:handleEvent( nMessage, aNM ) DO CASE CASE nMessage == HB_GTE_RESIZED IF HB_ISBLOCK( ::sl_resize ) - eval( ::sl_resize, NIL, NIL, self ) + Eval( ::sl_resize, NIL, NIL, self ) ENDIF - aeval( ::aChildren, {| o | o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } ) + AEval( ::aChildren, {| o | o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } ) RETURN EVENT_HANDELLED CASE nMessage == HB_GTE_CTLCOLOR @@ -139,7 +141,7 @@ METHOD WvgDrawingArea:handleEvent( nMessage, aNM ) ENDIF IF HB_ISNUMERIC( ::hBrushBG ) WVG_SetBkMode( aNM[ 1 ], 1 ) - WVG_FillRect( aNM[ 1 ], { 0,0,::currentSize()[1],::currentSize()[2]}, ::hBrushBG ) + WVG_FillRect( aNM[ 1 ], { 0, 0, ::currentSize()[1], ::currentSize()[2] }, ::hBrushBG ) RETURN EVENT_HANDELLED ENDIF diff --git a/harbour/contrib/gtwvg/genrc.prg b/harbour/contrib/gtwvg/genrc.prg index 2fc63d1aa3..916232447e 100644 --- a/harbour/contrib/gtwvg/genrc.prg +++ b/harbour/contrib/gtwvg/genrc.prg @@ -49,18 +49,19 @@ * If you do not wish that, delete this exception notice. * */ + // // // - * - * EkOnkar - * ( The LORD is ONE ) - * - * Xbase++ Parts Compatible functions - * - * Pritpal Bedi - * 03Dec2011 - * +// +// EkOnkar +// ( The LORD is ONE ) +// +// Xbase++ Parts Compatible functions +// +// Pritpal Bedi +// 03Dec2011 +// // // // @@ -80,7 +81,7 @@ // -EXIT PROCEDURE KillGTChildren() + EXIT PROCEDURE KillGTChildren() IF HB_ISOBJECT( s_oCrt ) .AND. __objGetClsName( s_oCrt ) == "WVGCRT" .AND. s_oCrt:isGT s_oCrt:destroy() @@ -92,14 +93,15 @@ EXIT PROCEDURE KillGTChildren() // FUNCTION WvgSetAppWindow( oCrt ) + LOCAL ooCrt := s_oCrt - IF empty( oCrt ) - IF empty( s_oCrt ) + IF Empty( oCrt ) + IF Empty( s_oCrt ) s_oCrt := WvgCrt():new() s_oCrt:hWnd := Wvt_GetWindowHandle() s_oCrt:pWnd := Win_N2P( s_oCrt:hWnd ) - HB_GtInfo( HB_GTI_NOTIFIERBLOCKGUI, {| nEvent, ... | s_oCrt:notifier( nEvent, ... ) } ) + hb_gtInfo( HB_GTI_NOTIFIERBLOCKGUI, {| nEvent, ... | s_oCrt:notifier( nEvent, ... ) } ) s_oCrt:isGT := .T. RETURN s_oCrt ENDIF diff --git a/harbour/contrib/gtwvg/htmlview.prg b/harbour/contrib/gtwvg/htmlview.prg index 745bf541fc..55e8aa07ef 100644 --- a/harbour/contrib/gtwvg/htmlview.prg +++ b/harbour/contrib/gtwvg/htmlview.prg @@ -50,6 +50,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -139,7 +140,7 @@ CLASS WvgHTMLViewer INHERIT WvgActiveXControl DATA CLSID INIT "Shell.Explorer" PROTECTED - ENDCLASS +ENDCLASS // @@ -158,7 +159,7 @@ METHOD WvgHTMLViewer:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::mapEvent( evBeforeNavigate, {| cURL, Flags, TFName, PData, Headers | ; - ::xBeforeNavigate( cURL, Flags, TFName, PData, Headers ) } ) + ::xBeforeNavigate( cURL, Flags, TFName, PData, Headers ) } ) ::mapEvent( evStatusTextChange, {| cText| ::xStatusTextChange( cText ) } ) @@ -172,7 +173,6 @@ METHOD WvgHTMLViewer:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ::WvgActiveXControl:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - RETURN Self // @@ -184,8 +184,8 @@ METHOD WvgHTMLViewer:xBeforeNavigate( cURL, Flags, TFName, PData, Headers ) HB_SYMBOL_UNUSED( PData ) HB_SYMBOL_UNUSED( Headers ) - IF PCount() >= 1 .and. HB_ISBLOCK( ::sl_beforeNavigate ) - eval( ::sl_beforeNavigate, cURL, NIL, Self ) + IF PCount() >= 1 .AND. HB_ISBLOCK( ::sl_beforeNavigate ) + Eval( ::sl_beforeNavigate, cURL, NIL, Self ) RETURN nil ENDIF @@ -196,7 +196,7 @@ METHOD WvgHTMLViewer:xBeforeNavigate( cURL, Flags, TFName, PData, Headers ) METHOD WvgHTMLViewer:xStatusTextChange( cText ) IF HB_ISBLOCK( ::sl_statusTextChange ) - eval( ::sl_statusTextChange, cText, NIL, Self ) + Eval( ::sl_statusTextChange, cText, NIL, Self ) ENDIF RETURN Self @@ -206,7 +206,7 @@ METHOD WvgHTMLViewer:xStatusTextChange( cText ) METHOD WvgHTMLViewer:xNavigateComplete( cURL ) IF HB_ISBLOCK( ::sl_navigateComplete ) - eval( ::sl_navigateComplete, cURL, NIL, Self ) + Eval( ::sl_navigateComplete, cURL, NIL, Self ) ENDIF RETURN Self @@ -216,7 +216,7 @@ METHOD WvgHTMLViewer:xNavigateComplete( cURL ) METHOD WvgHTMLViewer:xProgressChange( nProgress, nProgMax ) IF HB_ISBLOCK( ::sl_progressChange ) - eval( ::sl_progressChange, nProgress, nProgMax, Self ) + Eval( ::sl_progressChange, nProgress, nProgMax, Self ) ENDIF RETURN Self @@ -226,7 +226,7 @@ METHOD WvgHTMLViewer:xProgressChange( nProgress, nProgMax ) METHOD WvgHTMLViewer:xTitleChange( cTitle ) IF HB_ISBLOCK( ::sl_titleChange ) - eval( ::sl_titleChange, cTitle, NIL, Self ) + Eval( ::sl_titleChange, cTitle, NIL, Self ) ENDIF RETURN Self @@ -236,7 +236,7 @@ METHOD WvgHTMLViewer:xTitleChange( cTitle ) METHOD WvgHTMLViewer:xDocumentComplete( cURI ) IF HB_ISBLOCK( ::sl_documentComplete ) - eval( ::sl_documentComplete, cURI, NIL, Self ) + Eval( ::sl_documentComplete, cURI, NIL, Self ) ENDIF RETURN Self @@ -251,3 +251,4 @@ METHOD WvgHTMLViewer:setHTML( cHTML ) RETURN self // + diff --git a/harbour/contrib/gtwvg/listbox.prg b/harbour/contrib/gtwvg/listbox.prg index bb0f2c7af4..21f7e33690 100644 --- a/harbour/contrib/gtwvg/listbox.prg +++ b/harbour/contrib/gtwvg/listbox.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -97,14 +98,14 @@ CLASS WvgListBox INHERIT WvgWindow, WvgDataRef METHOD getVisibleItems() VIRTUAL METHOD numItems() INLINE ::sendMessage( LB_GETCOUNT, 0, 0 ) METHOD setItemsHeight( nPixel ) INLINE ::sendMessage( LB_SETITEMHEIGHT, 0, nPixel ) - METHOD setTopItem( nIndex ) INLINE ::sendMessage( LB_SETTOPINDEX, nIndex-1, 0 ) + METHOD setTopItem( nIndex ) INLINE ::sendMessage( LB_SETTOPINDEX, nIndex - 1, 0 ) METHOD addItem( cItem ) INLINE WVG_SendMessageText( ::hWnd, LB_ADDSTRING, 0, cItem ) - METHOD clear() - METHOD delItem( nIndex ) INLINE ::sendMessage( LB_DELETESTRING, nIndex-1, 0 ) - METHOD getItem( nIndex ) INLINE WVG_LBGetText( ::hWnd, nIndex-1 ) + METHOD CLEAR() + METHOD delItem( nIndex ) INLINE ::sendMessage( LB_DELETESTRING, nIndex - 1, 0 ) + METHOD getItem( nIndex ) INLINE WVG_LBGetText( ::hWnd, nIndex - 1 ) METHOD getTabstops() VIRTUAL - METHOD insItem( nIndex, cItem ) INLINE WVG_SendMessageText( ::hWnd, LB_INSERTSTRING, nIndex-1, cItem ) + METHOD insItem( nIndex, cItem ) INLINE WVG_SendMessageText( ::hWnd, LB_INSERTSTRING, nIndex - 1, cItem ) METHOD setColumnWidth() VIRTUAL METHOD setItem( nIndex, cItem ) INLINE ::delItem( nIndex ), ::insItem( nIndex, cItem ) METHOD setTabstops() VIRTUAL @@ -137,7 +138,7 @@ CLASS WvgListBox INHERIT WvgWindow, WvgDataRef DATA nCurSelected INIT 0 METHOD getCurItem() INLINE ::getItem( ::nCurSelected ) - ENDCLASS +ENDCLASS // @@ -196,12 +197,12 @@ METHOD WvgListBox:handleEvent( nMessage, aNM ) CASE nMessage == HB_GTE_COMMAND IF aNM[ 1 ] == LBN_SELCHANGE - ::nCurSelected := WVG_LBGetCurSel( ::hWnd )+ 1 + ::nCurSelected := WVG_LBGetCurSel( ::hWnd ) + 1 IF ::isParentCrt() ::oParent:setFocus() ENDIF IF HB_ISBLOCK( ::sl_itemMarked ) - eval( ::sl_itemMarked, NIL, NIL, self ) + Eval( ::sl_itemMarked, NIL, NIL, self ) ENDIF IF ::isParentCrt() IF ::pointerFocus @@ -215,7 +216,7 @@ METHOD WvgListBox:handleEvent( nMessage, aNM ) ::oParent:setFocus() ENDIF IF HB_ISBLOCK( ::sl_itemSelected ) - eval( ::sl_itemSelected, NIL, NIL, self ) + Eval( ::sl_itemSelected, NIL, NIL, self ) ENDIF IF ::isParentCrt() IF ::pointerFocus @@ -237,7 +238,7 @@ METHOD WvgListBox:handleEvent( nMessage, aNM ) ::oParent:setFocus() ENDIF IF HB_ISBLOCK( ::sl_itemSelected ) - eval( ::sl_itemSelected, NIL, NIL, self ) + Eval( ::sl_itemSelected, NIL, NIL, self ) ENDIF IF ::isParentCrt() IF ::pointerFocus @@ -266,7 +267,7 @@ METHOD WvgListBox:handleEvent( nMessage, aNM ) IF ::isParentCrt() ::oParent:setFocus() ENDIF - eval( ::sl_itemMarked, NIL, NIL, self ) + Eval( ::sl_itemMarked, NIL, NIL, self ) IF ::isParentCrt() ::setFocus() ENDIF @@ -278,7 +279,7 @@ METHOD WvgListBox:handleEvent( nMessage, aNM ) IF ::isParentCrt() ::oParent:setFocus() ENDIF - eval( ::sl_itemSelected, NIL, NIL, self ) + Eval( ::sl_itemSelected, NIL, NIL, self ) IF ::isParentCrt() ::setFocus() ENDIF @@ -292,7 +293,7 @@ METHOD WvgListBox:handleEvent( nMessage, aNM ) IF ::isParentCrt() ::oParent:setFocus() ENDIF - eval( ::sl_itemMarked, NIL, NIL, self ) + Eval( ::sl_itemMarked, NIL, NIL, self ) IF ::isParentCrt() ::setFocus() ENDIF @@ -315,11 +316,15 @@ METHOD WvgListBox:clear() // METHOD WvgListBox:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + RETURN Self // METHOD WvgListBox:destroy() + ::WvgWindow:destroy() + RETURN NIL diff --git a/harbour/contrib/gtwvg/menubar.prg b/harbour/contrib/gtwvg/menubar.prg index 588e616c4c..fcdb4fbc7a 100644 --- a/harbour/contrib/gtwvg/menubar.prg +++ b/harbour/contrib/gtwvg/menubar.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -101,7 +102,7 @@ CLASS wvgMenuBar INHERIT wvgWindow DATA className INIT "MENUBAR" - METHOD numItems() INLINE len( ::aMenuItems ) + METHOD numItems() INLINE Len( ::aMenuItems ) METHOD new( oParent, aPresParams, lVisible ) METHOD create( oParent, aPresParams, lVisible ) @@ -135,7 +136,7 @@ CLASS wvgMenuBar INHERIT wvgWindow PROTECTED: METHOD putItem( aItem, nPos, lInsert ) - ENDCLASS +ENDCLASS // @@ -175,16 +176,16 @@ METHOD WvgMenuBar:create( oParent, aPresParams, lVisible ) TO DO */ /* finally set the menu */ - #if 0 +#if 0 WVG_SetMenu( ::oParent:getHWND(), ::hMenu ) - #endif +#endif /* how to make menu invisible ? */ IF ( ::visible ) - #if 0 +#if 0 WVG_ShowWindow( ::oParent:getHWND(), SW_MINIMIZE ) WVG_ShowWindow( ::oParent:getHWND(), SW_NORMAL ) - #endif +#endif ENDIF ::oParent:oMenu := Self @@ -212,13 +213,13 @@ METHOD WvgMenuBar:configure( oParent, aPresParams, lVisible ) METHOD WvgMenuBar:destroy() - IF !empty( ::hMenu ) + IF !Empty( ::hMenu ) ::DelAllItems() IF !WVG_DestroyMenu( ::hMenu ) - #if 0 +#if 0 Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Destroy()", "Destroy menu FAILED", {},"wvt.prg" ) ) - #endif +#endif ENDIF ::hMenu := 0 @@ -229,7 +230,8 @@ METHOD WvgMenuBar:destroy() // METHOD WvgMenuBar:delAllItems() - LOCAL lResult:= .T., nItems + + LOCAL lResult := .T. , nItems nItems := ::numItems() DO WHILE nItems > 0 .AND. lResult @@ -242,20 +244,21 @@ METHOD WvgMenuBar:delAllItems() // METHOD WvgMenuBar:delItem( nItemNum ) - LOCAL lResult:= .F. + + LOCAL lResult := .F. IF nItemNum > 0 .AND. nItemNum <= ::numItems() IF ::aMenuItems[ nItemNum, WVT_MENU_TYPE ] == MF_POPUP ::aMenuItems[ nItemNum, WVT_MENU_MENUOBJ ]:Destroy() ENDIF - IF ( lResult := WVG_DeleteMenu( ::hMenu, nItemNum-1, MF_BYPOSITION ) ) /* Remember ZERO base */ - ADEL( ::aMenuItems, nItemNum ) - ASIZE( ::aMenuItems, LEN( ::aMenuItems ) - 1 ) + IF ( lResult := WVG_DeleteMenu( ::hMenu, nItemNum - 1, MF_BYPOSITION ) ) /* Remember ZERO base */ + ADel( ::aMenuItems, nItemNum ) + ASize( ::aMenuItems, Len( ::aMenuItems ) - 1 ) ELSE - #if 0 +#if 0 Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:DelItem()", "Delete menu item FAILED", { nItemNum },"wvt.prg" ) ) - #endif +#endif ENDIF ENDIF @@ -265,10 +268,12 @@ METHOD WvgMenuBar:delItem( nItemNum ) /* * { xCaption, bAction, nStyle, nAttrb } */ + METHOD WvgMenuBar:addItem( aItem, p2, p3, p4 ) + LOCAL xCaption, bAction, nStyle, nAttrib - IF PCount() == 1 .AND. valtype( aItem ) == "A" + IF PCount() == 1 .AND. ValType( aItem ) == "A" ASize( aItem, 4 ) xCaption := aItem[ 1 ] bAction := aItem[ 2 ] @@ -281,11 +286,12 @@ METHOD WvgMenuBar:addItem( aItem, p2, p3, p4 ) nAttrib := p4 ENDIF - RETURN ::putItem( { xCaption, bAction, nStyle, nAttrib }, -1, .T. ) + RETURN ::putItem( { xCaption, bAction, nStyle, nAttrib }, - 1, .T. ) // METHOD WvgMenuBar:putItem( aItem, nPos, lInsert ) + LOCAL nItemIndex, cCaption LOCAL xCaption, bAction, nStyle, nAttrib @@ -300,13 +306,13 @@ METHOD WvgMenuBar:putItem( aItem, nPos, lInsert ) /* xCaption : NIL | cPrompt | ncResource | oMenu */ - SWITCH valtype( xCaption ) + SWITCH ValType( xCaption ) CASE "U" /* Separator */ aItem := { MF_SEPARATOR, 0, 0, NIL, nStyle, nAttrib } EXIT CASE "C" - IF left( xCaption,1 ) == "-" + IF Left( xCaption, 1 ) == "-" aItem := { MF_SEPARATOR, 0, 0, NIL, nStyle, nAttrib } ELSE aItem := { MF_STRING, ++::nMenuItemID, xCaption, bAction, nStyle, nAttrib } @@ -324,31 +330,31 @@ METHOD WvgMenuBar:putItem( aItem, nPos, lInsert ) ENDSWITCH IF nPos <= 0 - aadd( ::aMenuItems, aItem ) - nItemIndex := len( ::aMenuItems ) + AAdd( ::aMenuItems, aItem ) + nItemIndex := Len( ::aMenuItems ) WVG_AppendMenu( ::hMenu, ; - aItem[ 1 ], ; - aItem[ 2 ], ; - iif( HB_ISSTRING( aItem[ 3 ] ), strtran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ) ) + aItem[ 1 ], ; + aItem[ 2 ], ; + iif( HB_ISSTRING( aItem[ 3 ] ), StrTran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ) ) ELSE nItemIndex := nPos IF lInsert ::aMenuItems := hb_AIns( ::aMenuItems, nPos, aItem, .T. ) WVG_InsertMenu( ::hMenu, ; - nItemIndex - 1, ; - aItem[ 1 ] + MF_BYPOSITION, ; - aItem[ 2 ], ; - iif( HB_ISSTRING( aItem[ 3 ] ), strtran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ) ) + nItemIndex - 1, ; + aItem[ 1 ] + MF_BYPOSITION, ; + aItem[ 2 ], ; + iif( HB_ISSTRING( aItem[ 3 ] ), StrTran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ) ) ELSE - IF valtype( xCaption ) == "C" + IF ValType( xCaption ) == "C" aItem[ 2 ] := ::aMenuItems[ nItemIndex, 2 ] ENDIF ::aMenuItems[ nItemIndex ] := aItem WVG_SetMenuItem( ::hMenu, ; - nItemIndex - 1, ; - aItem[ 2 ], ; - iif( HB_ISSTRING( aItem[ 3 ] ), strtran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ),; - valtype( xCaption ) == "C" ) + nItemIndex - 1, ; + aItem[ 2 ], ; + iif( HB_ISSTRING( aItem[ 3 ] ), StrTran( aItem[ 3 ], "~", "&" ), aItem[ 3 ] ), ; + ValType( xCaption ) == "C" ) ENDIF ENDIF @@ -367,14 +373,15 @@ METHOD WvgMenuBar:putItem( aItem, nPos, lInsert ) // METHOD WvgMenuBar:findMenuItemById( nId ) - LOCAL x, aResult :={} - IF !empty( nId ) + LOCAL x, aResult := {} + + IF !Empty( nId ) x := ::numItems() - DO WHILE x > 0 .AND. empty( aResult ) + DO WHILE x > 0 .AND. Empty( aResult ) IF ::aMenuItems[ x, WVT_MENU_TYPE ] == MF_POPUP - aResult:= ::aMenuItems[ x,WVT_MENU_MENUOBJ ]:findMenuItemById( nId ) + aResult := ::aMenuItems[ x,WVT_MENU_MENUOBJ ]:findMenuItemById( nId ) ELSEIF ::aMenuItems[ x, WVT_MENU_IDENTIFIER ] == nId aResult := { x, ::aMenuItems[ x, WVT_MENU_ACTION ], ::sl_itemSelected, Self } @@ -389,12 +396,13 @@ METHOD WvgMenuBar:findMenuItemById( nId ) // METHOD WvgMenuBar:findMenuPosById( nId ) + LOCAL x, nPos - IF !empty( nId ) + IF !Empty( nId ) x := ::numItems() - DO WHILE x > 0 .AND. empty( nPos ) + DO WHILE x > 0 .AND. Empty( nPos ) IF ::aMenuItems[ x,WVT_MENU_TYPE ] == MF_POPUP nPos := ::aMenuItems[ x,WVT_MENU_MENUOBJ ]:findMenuPosById( nId ) @@ -411,23 +419,25 @@ METHOD WvgMenuBar:findMenuPosById( nId ) // METHOD WvgMenuBar:checkItem( nItemNum, lCheck ) - LOCAL nRet := -1 + + LOCAL nRet := - 1 DEFAULT lCheck TO .T. - IF !empty( ::hMenu ) .AND. HB_ISNUMERIC( nItemNum ) - nRet := WVG_CheckMenuItem( ::hMenu, nItemNum-1, MF_BYPOSITION + iif( lCheck, MF_CHECKED, MF_UNCHECKED ) ) + IF !Empty( ::hMenu ) .AND. HB_ISNUMERIC( nItemNum ) + nRet := WVG_CheckMenuItem( ::hMenu, nItemNum - 1, MF_BYPOSITION + iif( lCheck, MF_CHECKED, MF_UNCHECKED ) ) ENDIF - RETURN iif( nRet == -1, .F., .T. ) + RETURN iif( nRet == - 1, .F. , .T. ) // METHOD WvgMenuBar:enableItem( nItemNum ) + LOCAL lSuccess := .F. - IF !empty( ::hMenu ) .AND. HB_ISNUMERIC( nItemNum ) - lSuccess := WVG_EnableMenuItem( ::hMenu, nItemNum-1, MF_BYPOSITION + MF_ENABLED ) + IF !Empty( ::hMenu ) .AND. HB_ISNUMERIC( nItemNum ) + lSuccess := WVG_EnableMenuItem( ::hMenu, nItemNum - 1, MF_BYPOSITION + MF_ENABLED ) ENDIF RETURN lSuccess @@ -435,10 +445,11 @@ METHOD WvgMenuBar:enableItem( nItemNum ) // METHOD WvgMenuBar:disableItem( nItemNum ) + LOCAL lSuccess := .F. - IF !empty( ::hMenu ) .AND. !empty( nItemNum ) - lSuccess := WVG_EnableMenuItem( ::hMenu, nItemNum-1, MF_BYPOSITION + MF_GRAYED ) + IF !Empty( ::hMenu ) .AND. !Empty( nItemNum ) + lSuccess := WVG_EnableMenuItem( ::hMenu, nItemNum - 1, MF_BYPOSITION + MF_GRAYED ) ENDIF RETURN lSuccess @@ -447,7 +458,7 @@ METHOD WvgMenuBar:disableItem( nItemNum ) METHOD WvgMenuBar:getItem( nItemNum ) - IF HB_ISNUMERIC( nItemNum ) .AND. nItemNum > 0 .AND. nItemNum <= len( ::aMenuItems ) + IF HB_ISNUMERIC( nItemNum ) .AND. nItemNum > 0 .AND. nItemNum <= Len( ::aMenuItems ) RETURN { ::aMenuItems[ nItemNum, 3 ], ::aMenuItems[ nItemNum, 4 ], ::aMenuItems[ nItemNum, 5 ], ::aMenuItems[ nItemNum, 6 ] } ENDIF @@ -465,13 +476,13 @@ METHOD WvgMenuBar:insItem( nItemNum, aItem ) METHOD WvgMenuBar:isItemChecked( nItemNum ) - RETURN WVG_IsMenuItemChecked( ::hMenu, nItemNum-1 ) + RETURN WVG_IsMenuItemChecked( ::hMenu, nItemNum - 1 ) // METHOD WvgMenuBar:isItemEnabled( nItemNum ) - RETURN WVG_IsMenuItemEnabled( ::hMenu, nItemNum-1 ) + RETURN WVG_IsMenuItemEnabled( ::hMenu, nItemNum - 1 ) // @@ -490,12 +501,12 @@ METHOD WvgMenuBar:setItem( nItemNum, aItem ) RETURN ::putItem( aItem, nItemNum, .F. ) // -/* Callback Methods */ + /* Callback Methods */ // METHOD WvgMenuBar:beginMenu( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_beginMenu := xParam RETURN NIL ENDIF @@ -506,7 +517,7 @@ METHOD WvgMenuBar:beginMenu( xParam ) METHOD WvgMenuBar:endMenu( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_endMenu := xParam RETURN NIL ENDIF @@ -517,7 +528,7 @@ METHOD WvgMenuBar:endMenu( xParam ) METHOD WvgMenuBar:itemMarked( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_itemMarked := xParam RETURN NIL ENDIF @@ -528,7 +539,7 @@ METHOD WvgMenuBar:itemMarked( xParam ) METHOD WvgMenuBar:itemSelected( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_itemSelected := xParam RETURN NIL ENDIF @@ -539,7 +550,7 @@ METHOD WvgMenuBar:itemSelected( xParam ) METHOD WvgMenuBar:drawItem( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_drawItem := xParam RETURN NIL ENDIF @@ -550,7 +561,7 @@ METHOD WvgMenuBar:drawItem( xParam ) METHOD WvgMenuBar:measureItem( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_measureItem := xParam RETURN NIL ENDIF @@ -561,7 +572,7 @@ METHOD WvgMenuBar:measureItem( xParam ) METHOD WvgMenuBar:onMenuKey( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_onMenuKey := xParam RETURN NIL ENDIF @@ -587,9 +598,9 @@ CLASS wvgMenu INHERIT wvgMenuBar METHOD getTitle() METHOD setTitle( cTitle ) - METHOD popUp( oXbp, aPos, nDefaultItem, nControl ) + METHOD Popup( oXbp, aPos, nDefaultItem, nControl ) - ENDCLASS +ENDCLASS // @@ -637,7 +648,8 @@ METHOD WvgMenu:setTitle( cTitle ) // -METHOD WvgMenu:popUp( oXbp, aPos, nDefaultItem, nControl ) +METHOD WvgMenu:Popup( oXbp, aPos, nDefaultItem, nControl ) + LOCAL nCmd, aMenuItem HB_SYMBOL_UNUSED( nDefaultItem ) @@ -646,7 +658,7 @@ METHOD WvgMenu:popUp( oXbp, aPos, nDefaultItem, nControl ) nCmd := WVG_TrackPopupMenu( ::hMenu, TPM_LEFTALIGN + TPM_TOPALIGN + TPM_RETURNCMD, aPos[ 1 ], aPos[ 2 ], oXbp:hWnd ) aMenuItem := ::findMenuItemById( nCmd ) - IF HB_ISARRAY( aMenuItem ) .and. HB_ISBLOCK( aMenuItem[ 2 ] ) + IF HB_ISARRAY( aMenuItem ) .AND. HB_ISBLOCK( aMenuItem[ 2 ] ) Eval( aMenuItem[ 2 ], aMenuItem[ 1 ], NIL, aMenuItem[ 4 ] ) ENDIF diff --git a/harbour/contrib/gtwvg/mle.prg b/harbour/contrib/gtwvg/mle.prg index bec3cb6a44..3becd22616 100644 --- a/harbour/contrib/gtwvg/mle.prg +++ b/harbour/contrib/gtwvg/mle.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -99,11 +100,11 @@ CLASS WvgMLE INHERIT WvgWindow, WvgDataRef METHOD destroy() METHOD handleEvent( nMessage, aNM ) - METHOD clear() + METHOD CLEAR() METHOD copyMarked() METHOD cutMarked() METHOD deleteMarked() VIRTUAL - METHOD delete() VIRTUAL + METHOD DELETE() VIRTUAL METHOD pasteMarked() VIRTUAL METHOD queryFirstChar() VIRTUAL METHOD queryMarked() VIRTUAL @@ -131,7 +132,7 @@ CLASS WvgMLE INHERIT WvgWindow, WvgDataRef METHOD changed( lChanged ) SETGET - ENDCLASS +ENDCLASS // @@ -199,22 +200,22 @@ METHOD WvgMLE:handleEvent( nMessage, aNM ) DO CASE CASE aNM[ NMH_code ] == EN_KILLFOCUS IF HB_ISBLOCK( ::sl_killInputFocus ) - eval( ::sl_killInputFocus, NIL, NIL, Self ) + Eval( ::sl_killInputFocus, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == EN_SETFOCUS IF HB_ISBLOCK( ::sl_setInputFocus ) - eval( ::sl_setInputFocus, NIL, NIL, Self ) + Eval( ::sl_setInputFocus, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == EN_HSCROLL IF HB_ISBLOCK( ::sl_hScroll ) - eval( ::sl_hScroll, NIL, NIL, Self ) + Eval( ::sl_hScroll, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == EN_VSCROLL IF HB_ISBLOCK( ::sl_vScroll ) - eval( ::sl_vScroll, NIL, NIL, Self ) + Eval( ::sl_vScroll, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == EN_CHANGE @@ -246,22 +247,22 @@ METHOD WvgMLE:handleEvent( nMessage, aNM ) CASE aNM[ NMH_code ] == WM_KILLFOCUS IF HB_ISBLOCK( ::sl_killInputFocus ) - eval( ::sl_killInputFocus, NIL, NIL, Self ) + Eval( ::sl_killInputFocus, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == WM_SETFOCUS IF HB_ISBLOCK( ::sl_setInputFocus ) - eval( ::sl_setInputFocus, NIL, NIL, Self ) + Eval( ::sl_setInputFocus, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == WM_HSCROLL IF HB_ISBLOCK( ::sl_hScroll ) - eval( ::sl_hScroll, NIL, NIL, Self ) + Eval( ::sl_hScroll, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == WM_VSCROLL IF HB_ISBLOCK( ::sl_vScroll ) - eval( ::sl_vScroll, NIL, NIL, Self ) + Eval( ::sl_vScroll, NIL, NIL, Self ) ENDIF ENDCASE @@ -284,6 +285,7 @@ METHOD WvgMLE:destroy() // METHOD WvgMLE:changed( lChanged ) + LOCAL lChg := ::sendMessage( EM_GETMODIFY, 0, 0 ) IF HB_ISLOGICAL( lChanged ) @@ -295,15 +297,17 @@ METHOD WvgMLE:changed( lChanged ) // METHOD WvgMLE:clear() + LOCAL cText := ::getData() ::setData( "" ) - RETURN len( cText ) + RETURN Len( cText ) // METHOD WvgMLE:copyMarked() + LOCAL n, nB, nE n := ::sendMessage( EM_GETSEL ) @@ -311,7 +315,7 @@ METHOD WvgMLE:copyMarked() nE := WVG_HIWORD( n ) IF ( n := nE - nB ) > 0 - Wvt_SetClipboard( substr( ::getData(), nB, n ) ) + Wvt_SetClipboard( SubStr( ::getData(), nB, n ) ) ENDIF RETURN n @@ -319,6 +323,7 @@ METHOD WvgMLE:copyMarked() // METHOD WvgMLE:cutMarked() + LOCAL n, nB, nE, cText n := ::sendMessage( EM_GETSEL ) @@ -327,7 +332,7 @@ METHOD WvgMLE:cutMarked() IF ( n := nE - nB ) > 0 cText := ::getData() - ::setData( substr( cText, 1, nB-1 ) + substr( cText, nE ) ) + ::setData( SubStr( cText, 1, nB - 1 ) + SubStr( cText, nE ) ) ENDIF RETURN n diff --git a/harbour/contrib/gtwvg/paint.prg b/harbour/contrib/gtwvg/paint.prg index fc450eec8e..1e3c8a061c 100644 --- a/harbour/contrib/gtwvg/paint.prg +++ b/harbour/contrib/gtwvg/paint.prg @@ -47,6 +47,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -64,87 +65,93 @@ // -thread static t_paint_:= { { "", {} } } +THREAD STATIC t_paint_ := { { "", {} } } // /* * This function must have to be defined in your appls */ #if 0 -function Wvt_Paint() + +FUNCTION Wvt_Paint() /* Call this function from this funtion */ WvtPaintObjects() - return nil + RETURN nil + #endif + // -function WvtPaintObjects() +FUNCTION WvtPaintObjects() + LOCAL i, lExe, nLeft, nRight, b, tlbr_, aBlocks, nBlocks aBlocks := WvtSetPaint() - if ( nBlocks := len( aBlocks ) ) > 0 - tlbr_:= Wvt_GetPaintRect() + IF ( nBlocks := Len( aBlocks ) ) > 0 + tlbr_ := Wvt_GetPaintRect() - for i := 1 to nBlocks + FOR i := 1 TO nBlocks lExe := .T. - if aBlocks[ i,3 ] != nil .and. !empty( aBlocks[ i,3 ] ) + IF aBlocks[ i,3 ] != nil .AND. !Empty( aBlocks[ i,3 ] ) /* Check parameters against tlbr_ depending upon the * type of object and attributes contained in aAttr */ - do case - case aBlocks[ i,3,1 ] == WVT_BLOCK_GRID_V + DO CASE + CASE aBlocks[ i,3,1 ] == WVT_BLOCK_GRID_V b := aBlocks[ i,3,6 ] - if len( b:aColumnsSep ) == 0 + IF Len( b:aColumnsSep ) == 0 lExe := .F. - else + ELSE nLeft := b:aColumnsSep[ 1 ] nRight := b:aColumnsSep[ len( b:aColumnsSep ) ] - if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; /* top < bottom */ - tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; /* bootm > top */ - tlbr_[ 2 ] <= nRight + 1 .and. ; /* left < right */ - tlbr_[ 4 ] >= nLeft - 2 ) /* right > left */ + IF !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .AND. ; /* top < bottom */ + tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .AND. ; /* bootm > top */ + tlbr_[ 2 ] <= nRight + 1 .AND. ; /* left < right */ + tlbr_[ 4 ] >= nLeft - 2 ) /* right > left */ lExe := .F. - endif - endif + ENDIF + ENDIF - case aBlocks[ i,3,1 ] == WVT_BLOCK_GETS - if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; /* top < bott */ - tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; /* bootm > top */ - tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .and. ; /* left < righ */ - tlbr_[ 4 ] >= aBlocks[ i,3,3 ] ) /* right > left */ + CASE aBlocks[ i,3,1 ] == WVT_BLOCK_GETS + IF !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .AND. ; /* top < bott */ + tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .AND. ; /* bootm > top */ + tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .AND. ; /* left < righ */ + tlbr_[ 4 ] >= aBlocks[ i,3,3 ] ) /* right > left */ lExe := .F. - endif + ENDIF - otherwise + OTHERWISE /* If refreshing rectangle's top is less than objects' bottom */ /* and left is less than objects' right */ /* */ - if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; /* top <= bottom */ - tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; /* bootm >= top */ - tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .and. ; /* left < right */ - tlbr_[ 4 ] >= aBlocks[ i,3,3 ] ) /* right > left */ + IF !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .AND. ; /* top <= bottom */ + tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .AND. ; /* bootm >= top */ + tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .AND. ; /* left < right */ + tlbr_[ 4 ] >= aBlocks[ i,3,3 ] ) /* right > left */ lExe := .F. - endif - endcase - endif + ENDIF + ENDCASE + ENDIF - if lExe - eval( aBlocks[ i,2 ] ) - endif - next - endif + IF lExe + Eval( aBlocks[ i,2 ] ) + ENDIF + NEXT + ENDIF - return 0 + RETURN 0 // -function WvtSetPaint( a_ ) - local o - thread static t +FUNCTION WvtSetPaint( a_ ) + + LOCAL o + + THREAD STATIC t IF t == nil t := {} @@ -152,97 +159,102 @@ function WvtSetPaint( a_ ) o := t - if a_ != nil + IF a_ != nil t := a_ - endif + ENDIF - return o + RETURN o // -function wvg_SetPaint( cID, nAction, xData, aAttr ) - local n, n1, oldData +FUNCTION wvg_SetPaint( cID, nAction, xData, aAttr ) - if xData != nil - if ( n := ascan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 - if ( n1 := ascan( t_paint_[ n, 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 + LOCAL n, n1, oldData + + IF xData != nil + IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 + IF ( n1 := AScan( t_paint_[ n, 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 oldData := t_paint_[ n,2,n1,2 ] t_paint_[ n,2,n1,2 ] := xData t_paint_[ n,2,n1,3 ] := aAttr - else - aadd( t_paint_[ n,2 ], { nAction,xData,aAttr } ) - endif - else - aadd( t_paint_, { cID, {} } ) - n := len( t_paint_ ) - aadd( t_paint_[ n,2 ], { nAction, xData, aAttr } ) - endif - endif + ELSE + AAdd( t_paint_[ n,2 ], { nAction, xData, aAttr } ) + ENDIF + ELSE + AAdd( t_paint_, { cID, {} } ) + n := Len( t_paint_ ) + AAdd( t_paint_[ n,2 ], { nAction, xData, aAttr } ) + ENDIF + ENDIF - return oldData + RETURN oldData // -function wvg_GetPaint( cID ) - local n +FUNCTION wvg_GetPaint( cID ) - if ( n := ascan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 - return t_paint_[ n,2 ] - endif + LOCAL n - return {} + IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 + RETURN t_paint_[ n,2 ] + ENDIF + + RETURN {} // -function wvg_DelPaint( cID, nAction ) - local xData, n1, n +FUNCTION wvg_DelPaint( cID, nAction ) - if ( n := ascan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 - if ( n1 := ascan( t_paint_[ n, 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 + LOCAL xData, n1, n + + IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 + IF ( n1 := AScan( t_paint_[ n, 2 ], {| e_ | e_[ 1 ] == nAction } ) ) > 0 xData := t_paint_[ n,2,n1,2 ] t_paint_[ n,2,n1,2 ] := {|| .T. } - endif - endif + ENDIF + ENDIF - return xData + RETURN xData // -function wvg_PurgePaint( cID,lDummy ) - local n, aPaint +FUNCTION wvg_PurgePaint( cID, lDummy ) + + LOCAL n, aPaint DEFAULT lDummy TO .F. - if ( n := ascan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 + IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 aPaint := t_paint_[ n ] ADel( t_paint_, n ) - aSize( t_paint_, len( t_paint_ ) - 1 ) - endif + ASize( t_paint_, Len( t_paint_ ) - 1 ) + ENDIF - if lDummy + IF lDummy WvtSetPaint( {} ) - endif + ENDIF - return aPaint + RETURN aPaint // -function wvg_InsertPaint( cID, aPaint, lSet ) - local n +FUNCTION wvg_InsertPaint( cID, aPaint, lSet ) + + LOCAL n DEFAULT lSet TO .F. - if ( n := ascan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 + IF ( n := AScan( t_paint_, {| e_ | e_[ 1 ] == cID } ) ) > 0 t_paint_[ n ] := aPaint - else - aadd( t_paint_, aPaint ) - endif + ELSE + AAdd( t_paint_, aPaint ) + ENDIF - if lSet + IF lSet WvtSetPaint( aPaint ) - endif + ENDIF - return nil + RETURN nil // // @@ -255,14 +267,16 @@ function wvg_InsertPaint( cID, aPaint, lSet ) // // // -/* nMode : 0 == Rows/cols - DEFAULT 1 == DlagUnits as from any standard dialog definition */ + /* nMode : 0 == Rows/cols - DEFAULT 1 == DlagUnits as from any standard dialog definition */ + FUNCTION Wvt_SetDlgCoMode( nMode ) + LOCAL nOldMode STATIC sMode := 0 nOldMode := sMode - IF HB_ISNUMERIC( nMode ) .and. nMode <= 1 .and. nMode >= 0 + IF HB_ISNUMERIC( nMode ) .AND. nMode <= 1 .AND. nMode >= 0 sMode := nMode ENDIF @@ -270,9 +284,8 @@ FUNCTION Wvt_SetDlgCoMode( nMode ) // - FUNCTION Wvt_MakeDlgTemplate( nTop, nLeft, nRows, nCols, aOffSet, cTitle, nStyle, ; - cFaceName, nPointSize, nWeight, lItalic, nHelpId, nExStyle ) + cFaceName, nPointSize, nWeight, lItalic, nHelpId, nExStyle ) LOCAL aDlg := { {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {} } LOCAL aXY, nX, nY, nW, nH, nXM, nYM @@ -284,7 +297,7 @@ FUNCTION Wvt_MakeDlgTemplate( nTop, nLeft, nRows, nCols, aOffSet, cTitle, nStyle IF nMode == 0 DEFAULT aOffSet TO {} - aSize( aOffSet,4 ) + ASize( aOffSet, 4 ) DEFAULT aOffSet[ 1 ] TO 0 DEFAULT aOffSet[ 2 ] TO 0 DEFAULT aOffSet[ 3 ] TO 0 @@ -299,7 +312,7 @@ FUNCTION Wvt_MakeDlgTemplate( nTop, nLeft, nRows, nCols, aOffSet, cTitle, nStyle /* Position it exactly where user has requested */ - aXY := Wvt_ClientToScreen( nTop,nLeft ) + aXY := Wvt_ClientToScreen( nTop, nLeft ) nX := aXY[ 1 ] + aOffSet[ 2 ] nY := aXY[ 2 ] + aOffSet[ 1 ] @@ -322,38 +335,39 @@ FUNCTION Wvt_MakeDlgTemplate( nTop, nLeft, nRows, nCols, aOffSet, cTitle, nStyle nH := nRows ENDIF - If !HB_ISNUMERIC( nStyle ) + IF !HB_ISNUMERIC( nStyle ) nStyle := + WS_CAPTION + WS_SYSMENU ; - + WS_GROUP + WS_TABSTOP + DS_SETFONT ; - + WS_THICKFRAME + WS_VISIBLE + WS_POPUP ; - + DS_3DLOOK - EndIf + + WS_GROUP + WS_TABSTOP + DS_SETFONT ; + + WS_THICKFRAME + WS_VISIBLE + WS_POPUP ; + + DS_3DLOOK + ENDIF - aAdd( aDlg[ 1 ] , iif( Empty( nHelpId ), 0, nHelpId ) ) - aAdd( aDlg[ 1 ] , iif( Empty( nExStyle ), 0, nExStyle ) ) - aAdd( aDlg[ 1 ] , nStyle ) - aAdd( aDlg[ 1 ] , 0 ) - aAdd( aDlg[ 1 ] , nX ) - aAdd( aDlg[ 1 ] , nY ) - aAdd( aDlg[ 1 ] , nW ) - aAdd( aDlg[ 1 ] , nH ) - aAdd( aDlg[ 1 ] , 0 ) - aAdd( aDlg[ 1 ] , 0 ) - aAdd( aDlg[ 1 ] , iif( ValType( cTitle ) == "C", cTitle, "" ) ) + AAdd( aDlg[ 1 ] , iif( Empty( nHelpId ), 0, nHelpId ) ) + AAdd( aDlg[ 1 ] , iif( Empty( nExStyle ), 0, nExStyle ) ) + AAdd( aDlg[ 1 ] , nStyle ) + AAdd( aDlg[ 1 ] , 0 ) + AAdd( aDlg[ 1 ] , nX ) + AAdd( aDlg[ 1 ] , nY ) + AAdd( aDlg[ 1 ] , nW ) + AAdd( aDlg[ 1 ] , nH ) + AAdd( aDlg[ 1 ] , 0 ) + AAdd( aDlg[ 1 ] , 0 ) + AAdd( aDlg[ 1 ] , iif( ValType( cTitle ) == "C", cTitle, "" ) ) - if hb_bitAnd( nStyle, DS_SETFONT ) == DS_SETFONT - aAdd( aDlg[ 1 ], iif( ValType( nPointSize ) == "N", nPointSize, 8 ) ) - aAdd( aDlg[ 1 ], iif( ValType( nWeight ) == "N", nWeight , 400 ) ) - aAdd( aDlg[ 1 ], iif( ValType( lItalic ) == "L", lItalic , .F. ) ) - aAdd( aDlg[ 1 ], iif( ValType( cFaceName ) == "C", cFaceName , "MS Sans Serif" ) ) - EndIf + IF hb_bitAnd( nStyle, DS_SETFONT ) == DS_SETFONT + AAdd( aDlg[ 1 ], iif( ValType( nPointSize ) == "N", nPointSize, 8 ) ) + AAdd( aDlg[ 1 ], iif( ValType( nWeight ) == "N", nWeight , 400 ) ) + AAdd( aDlg[ 1 ], iif( ValType( lItalic ) == "L", lItalic , .F. ) ) + AAdd( aDlg[ 1 ], iif( ValType( cFaceName ) == "C", cFaceName , "MS Sans Serif" ) ) + ENDIF - Return aDlg + RETURN aDlg // -Function Wvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet,; - cnId, cnDlgClass, nStyle, cText, nHelpId, nExStyle ) +FUNCTION Wvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet, ; + cnId, cnDlgClass, nStyle, cText, nHelpId, nExStyle ) + LOCAL aXY, nX, nY, nW, nH, nXM, nYM LOCAL nBaseUnits, nBaseUnitsX, nBaseUnitsY LOCAL nBottom, nRight @@ -365,7 +379,7 @@ Function Wvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet,; DEFAULT aOffSet TO {} - aSize( aOffSet,4 ) + ASize( aOffSet, 4 ) DEFAULT aOffSet[ 1 ] TO 0 DEFAULT aOffSet[ 2 ] TO 0 @@ -380,7 +394,7 @@ Function Wvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet,; nX := aXY[ 1 ] + aOffSet[ 2 ] nY := aXY[ 2 ] + aOffSet[ 1 ] - aXY := Wvt_GetXYFromRowCol( nBottom+1, nRight+1 ) + aXY := Wvt_GetXYFromRowCol( nBottom + 1, nRight + 1 ) nW := aXY[ 1 ] + aOffSet[ 4 ] - nX nH := aXY[ 2 ] + aOffSet[ 3 ] - nY @@ -400,87 +414,89 @@ Function Wvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet,; aDlg[ 1,4 ]++ /* item count */ - aAdd( aDlg[ 2 ] , iif( ValType( nHelpId ) == "N", nHelpId , 0 ) ) - aAdd( aDlg[ 3 ] , iif( ValType( nExStyle ) == "N", nExStyle, 0 ) ) - aAdd( aDlg[ 4 ] , iif( ValType( nStyle ) == "N", nStyle , WS_CHILD + WS_VISIBLE ) ) - aAdd( aDlg[ 5 ] , nX ) - aAdd( aDlg[ 6 ] , nY ) - aAdd( aDlg[ 7 ] , nW ) - aAdd( aDlg[ 8 ] , nH ) - aAdd( aDlg[ 9 ] , cnId ) - aAdd( aDlg[ 10 ] , cnDlgClass ) - aAdd( aDlg[ 11 ] , iif( HB_ISSTRING( cText ), cText, iif( HB_ISNUMERIC( cText ), cText, "" ) ) ) - aAdd( aDlg[ 12 ] , 0 ) + AAdd( aDlg[ 2 ] , iif( ValType( nHelpId ) == "N", nHelpId , 0 ) ) + AAdd( aDlg[ 3 ] , iif( ValType( nExStyle ) == "N", nExStyle, 0 ) ) + AAdd( aDlg[ 4 ] , iif( ValType( nStyle ) == "N", nStyle , WS_CHILD + WS_VISIBLE ) ) + AAdd( aDlg[ 5 ] , nX ) + AAdd( aDlg[ 6 ] , nY ) + AAdd( aDlg[ 7 ] , nW ) + AAdd( aDlg[ 8 ] , nH ) + AAdd( aDlg[ 9 ] , cnId ) + AAdd( aDlg[ 10 ] , cnDlgClass ) + AAdd( aDlg[ 11 ] , iif( HB_ISSTRING( cText ), cText, iif( HB_ISNUMERIC( cText ), cText, "" ) ) ) + AAdd( aDlg[ 12 ] , 0 ) - Return aDlg + RETURN aDlg // -Function Wvt_CreateDialog( acnDlg, lOnTop, cbDlgProc, ncIcon, nTimerTicks, hMenu ) +FUNCTION Wvt_CreateDialog( acnDlg, lOnTop, cbDlgProc, ncIcon, nTimerTicks, hMenu ) + LOCAL hDlg, cType, xTemplate, nDlgMode - if valtype( cbDlgProc ) == "C" - cbDlgProc := upper( cbDlgProc ) - endif + IF ValType( cbDlgProc ) == "C" + cbDlgProc := Upper( cbDlgProc ) + ENDIF - cType := Valtype( acnDlg ) + cType := ValType( acnDlg ) nDlgMode := iif( cType == "C", 0, iif( cType == "N", 1, 2 ) ) - if cType == "A" + IF cType == "A" xTemplate := Wvt__MakeDlgTemplate( acnDlg[ 1 ] , acnDlg[ 2 ] , acnDlg[ 3 ] , acnDlg[ 4 ] , ; - acnDlg[ 5 ] , acnDlg[ 6 ] , acnDlg[ 7 ] , acnDlg[ 8 ] , ; - acnDlg[ 9 ] , acnDlg[ 10 ] , acnDlg[ 11 ] , acnDlg[ 12 ] ) - else + acnDlg[ 5 ] , acnDlg[ 6 ] , acnDlg[ 7 ] , acnDlg[ 8 ] , ; + acnDlg[ 9 ] , acnDlg[ 10 ] , acnDlg[ 11 ] , acnDlg[ 12 ] ) + ELSE xTemplate := acnDlg - endif + ENDIF hDlg := Wvt_CreateDialogDynamic( xTemplate, lOnTop, cbDlgProc, nDlgMode ) - if hDlg != 0 - if ncIcon != nil + IF hDlg != 0 + IF ncIcon != nil Wvt_DlgSetIcon( hDlg, ncIcon ) - endif + ENDIF - if valtype( nTimerTicks ) == "N" + IF ValType( nTimerTicks ) == "N" WVG_SetTimer( hDlg, 1001, nTimerTicks ) - endif + ENDIF - if hMenu != nil + IF hMenu != nil WVG_SetMenu( hDlg, hMenu ) - endif + ENDIF - endif + ENDIF - Return hDlg + RETURN hDlg // -Function Wvt_DialogBox( acnDlg, cbDlgProc, hWndParent ) +FUNCTION Wvt_DialogBox( acnDlg, cbDlgProc, hWndParent ) + LOCAL nResult, cType, xTemplate, nDlgMode - if valtype( cbDlgProc ) == "C" - cbDlgProc := upper( cbDlgProc ) - endif + IF ValType( cbDlgProc ) == "C" + cbDlgProc := Upper( cbDlgProc ) + ENDIF - cType := Valtype( acnDlg ) + cType := ValType( acnDlg ) nDlgMode := iif( cType == "C", 0, iif( cType == "N", 1, 2 ) ) - if cType == "A" + IF cType == "A" xTemplate := Wvt__MakeDlgTemplate( acnDlg[ 1 ] , acnDlg[ 2 ] , acnDlg[ 3 ] , acnDlg[ 4 ] , ; - acnDlg[ 5 ] , acnDlg[ 6 ] , acnDlg[ 7 ] , acnDlg[ 8 ] , ; - acnDlg[ 9 ] , acnDlg[ 10 ] , acnDlg[ 11 ] , acnDlg[ 12 ] ) - else + acnDlg[ 5 ] , acnDlg[ 6 ] , acnDlg[ 7 ] , acnDlg[ 8 ] , ; + acnDlg[ 9 ] , acnDlg[ 10 ] , acnDlg[ 11 ] , acnDlg[ 12 ] ) + ELSE xTemplate := acnDlg - endif + ENDIF - nResult := Wvt_CreateDialogModal( xTemplate, .F., cbDlgProc, nDlgMode, hWndParent ) + nResult := Wvt_CreateDialogModal( xTemplate, .F. , cbDlgProc, nDlgMode, hWndParent ) Wvg_SetFocus( hWndParent ) - Return nResult + RETURN nResult // /* @@ -498,7 +514,9 @@ cDefName: DEFAULT file name Returns: If OFN_ALLOWMULTISELECT ? Array of files selected : FileName. */ + FUNCTION WVT_GetOpenFileName( hWnd, cPath, cTitle, acFilter, nFlags, cInitDir, cDefExt, nFilterIndex, cDefName ) + LOCAL cRet, aTmp, xRet, i HB_SYMBOL_UNUSED( hWnd ) @@ -514,10 +532,10 @@ FUNCTION WVT_GetOpenFileName( hWnd, cPath, cTitle, acFilter, nFlags, cInitDir, c IF WVG_And( nFlags, OFN_ALLOWMULTISELECT ) > 0 xRet := {} - IF ! empty( aTmp := hb_aTokens( cRet, chr( 0 ) ) ) + IF ! Empty( aTmp := hb_ATokens( cRet, Chr( 0 ) ) ) cPath := aTmp[ 1 ] - FOR i := 2 TO len( aTmp ) - aadd( xRet, cPath + "\" + aTmp[ i ] ) + FOR i := 2 TO Len( aTmp ) + AAdd( xRet, cPath + "\" + aTmp[ i ] ) NEXT ENDIF ELSE @@ -543,6 +561,7 @@ Returns: FileName. */ FUNCTION WVT_GetSaveFileName( hWnd, cDefName, cTitle, acFilter, nFlags, cInitDir, cDefExt, nFilterIndex ) + LOCAL cRet, aTmp, xRet, i, cPath HB_SYMBOL_UNUSED( hWnd ) @@ -557,10 +576,10 @@ FUNCTION WVT_GetSaveFileName( hWnd, cDefName, cTitle, acFilter, nFlags, cInitDir IF WVG_And( nFlags, OFN_ALLOWMULTISELECT ) > 0 xRet := {} - IF ! empty( aTmp := hb_aTokens( cRet, chr( 0 ) ) ) + IF ! Empty( aTmp := hb_ATokens( cRet, Chr( 0 ) ) ) cPath := aTmp[ 1 ] - FOR i := 2 TO len( aTmp ) - aadd( xRet, cPath + "\" + aTmp[ i ] ) + FOR i := 2 TO Len( aTmp ) + AAdd( xRet, cPath + "\" + aTmp[ i ] ) NEXT ENDIF ELSE @@ -586,28 +605,28 @@ FUNCTION WVT_GetSaveFileName( hWnd, cDefName, cTitle, acFilter, nFlags, cInitDir FUNCTION Wvt_SetTitle( cTitle ) - RETURN Hb_GtInfo( HB_GTI_WINTITLE, cTitle ) + RETURN hb_gtInfo( HB_GTI_WINTITLE, cTitle ) // FUNCTION Wvt_GetTitle() - RETURN Hb_GtInfo( HB_GTI_WINTITLE ) + RETURN hb_gtInfo( HB_GTI_WINTITLE ) // FUNCTION Wvt_SetIcon( ncIconRes, cIconName ) - if valtype( ncIconRes ) == "N" - Hb_GtInfo( HB_GTI_ICONRES, ncIconRes ) + IF ValType( ncIconRes ) == "N" + hb_gtInfo( HB_GTI_ICONRES, ncIconRes ) - elseif valtype( cIconName ) == "C" - Hb_GtInfo( HB_GTI_ICONRES, cIconName ) + ELSEIF ValType( cIconName ) == "C" + hb_gtInfo( HB_GTI_ICONRES, cIconName ) - elseif valtype( ncIconRes ) == "C" - Hb_GtInfo( HB_GTI_ICONFILE, ncIconRes ) + ELSEIF ValType( ncIconRes ) == "C" + hb_gtInfo( HB_GTI_ICONFILE, ncIconRes ) - endif + ENDIF RETURN NIL @@ -615,37 +634,37 @@ FUNCTION Wvt_SetIcon( ncIconRes, cIconName ) FUNCTION Wvt_SetFont( cFontName, nSize, nWidth, nWeight, nQuality ) - DEFAULT cFontName TO Hb_GtInfo( HB_GTI_FONTNAME ) - DEFAULT nWidth TO Hb_GtInfo( HB_GTI_FONTWIDTH ) - DEFAULT nWeight TO Hb_GtInfo( HB_GTI_FONTWEIGHT ) - DEFAULT nQuality TO Hb_GtInfo( HB_GTI_FONTQUALITY ) - DEFAULT nSize TO Hb_GtInfo( HB_GTI_FONTSIZE ) + DEFAULT cFontName TO hb_gtInfo( HB_GTI_FONTNAME ) + DEFAULT nWidth TO hb_gtInfo( HB_GTI_FONTWIDTH ) + DEFAULT nWeight TO hb_gtInfo( HB_GTI_FONTWEIGHT ) + DEFAULT nQuality TO hb_gtInfo( HB_GTI_FONTQUALITY ) + DEFAULT nSize TO hb_gtInfo( HB_GTI_FONTSIZE ) - RETURN Hb_GtInfo( HB_GTI_SETFONT, { cFontName, nSize, nWidth, nWeight, nQuality } ) + RETURN hb_gtInfo( HB_GTI_SETFONT, { cFontName, nSize, nWidth, nWeight, nQuality } ) // FUNCTION Wvt_SetCodePage( nCodePage ) - RETURN Hb_GtInfo( HB_GTI_CODEPAGE, nCodePage ) + RETURN hb_gtInfo( HB_GTI_CODEPAGE, nCodePage ) // FUNCTION Wvt_GetPalette() - RETURN Hb_GtInfo( HB_GTI_PALETTE ) + RETURN hb_gtInfo( HB_GTI_PALETTE ) // FUNCTION Wvt_SetPalette( aRGB ) - RETURN Hb_GtInfo( HB_GTI_PALETTE, aRGB ) + RETURN hb_gtInfo( HB_GTI_PALETTE, aRGB ) // FUNCTION Wvt_GetRGBColor( nIndex ) - RETURN Hb_GtInfo( HB_GTI_PALETTE, nIndex ) + RETURN hb_gtInfo( HB_GTI_PALETTE, nIndex ) // #define BLACK RGB( 0x0 ,0x0 ,0x0 ) @@ -666,29 +685,30 @@ FUNCTION Wvt_GetRGBColor( nIndex ) #define WHITE RGB( 0xFF,0xFF,0xFF ) FUNCTION Wvt_GetRGBColorByString( cColor, nForeBack ) + LOCAL s, n, lEnh LOCAL nIndex := 0 - LOCAL a_:= { "N", "B", "G", "BG", "R", "RB", "GR", "W" } + LOCAL a_ := { "N", "B", "G", "BG", "R", "RB", "GR", "W" } nForeBack := iif( HB_ISNUMERIC( nForeBack ), nForeBack, 0 ) IF HB_ISSTRING( cColor ) - IF ( n := at( "/", cColor ) ) > 0 + IF ( n := At( "/", cColor ) ) > 0 IF nForeBack == 0 - s := substr( cColor, 1, n-1 ) + s := SubStr( cColor, 1, n - 1 ) ELSE - s := substr( cColor, n+1 ) + s := SubStr( cColor, n + 1 ) ENDIF ELSE s := cColor ENDIF - s := upper( s ) + s := Upper( s ) lEnh := ( "*" $ s ) .OR. ( "+" $ s ) IF lEnh - s := strtran( s, "*" ) - s := strtran( s, "+" ) + s := StrTran( s, "*" ) + s := StrTran( s, "+" ) ENDIF - nIndex := ascan( a_, {| e | e == s } ) + nIndex := AScan( a_, {| e | e == s } ) IF nIndex > 0 IF lEnh nIndex += 8 @@ -697,31 +717,31 @@ FUNCTION Wvt_GetRGBColorByString( cColor, nForeBack ) ENDIF ENDIF - RETURN Hb_GtInfo( HB_GTI_PALETTE, nIndex ) + RETURN hb_gtInfo( HB_GTI_PALETTE, nIndex ) // FUNCTION Wvt_SetAltF4Close( lSetClose ) - RETURN Hb_GtInfo( HB_GTI_CLOSABLE, lSetClose ) + RETURN hb_gtInfo( HB_GTI_CLOSABLE, lSetClose ) // FUNCTION Wvt_GetScreenWidth() - RETURN Hb_GtInfo( HB_GTI_DESKTOPWIDTH ) + RETURN hb_gtInfo( HB_GTI_DESKTOPWIDTH ) // FUNCTION Wvt_GetScreenHeight() - RETURN Hb_GtInfo( HB_GTI_DESKTOPHEIGHT ) + RETURN hb_gtInfo( HB_GTI_DESKTOPHEIGHT ) // FUNCTION Wvt_GetWindowHandle() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE ) // @@ -730,7 +750,7 @@ FUNCTION Wvt_CenterWindow( lCenter, lRePaint ) DEFAULT lCenter TO .T. DEFAULT lRePaint TO .F. - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_CENTERWINDOW, { lCenter, lRePaint } ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_CENTERWINDOW, { lCenter, lRePaint } ) // @@ -739,13 +759,13 @@ FUNCTION Wvt_WindowCentre( lCenter, lRePaint ) DEFAULT lCenter TO .T. DEFAULT lRePaint TO .F. - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_CENTERWINDOW, { lCenter, lRePaint } ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_CENTERWINDOW, { lCenter, lRePaint } ) // FUNCTION Wvt_ProcessMessages() - Hb_GtInfo( HB_GTI_SPEC, HB_GTS_PROCESSMESSAGES ) + hb_gtInfo( HB_GTI_SPEC, HB_GTS_PROCESSMESSAGES ) RETURN .T. @@ -753,7 +773,7 @@ FUNCTION Wvt_ProcessMessages() FUNCTION Wvt_KeyBoard( nKey ) - Hb_GtInfo( HB_GTI_SPEC, HB_GTS_KEYBOARD, nKey ) + hb_gtInfo( HB_GTI_SPEC, HB_GTS_KEYBOARD, nKey ) RETURN NIL @@ -761,25 +781,26 @@ FUNCTION Wvt_KeyBoard( nKey ) FUNCTION Wvt_GetClipboard() - RETURN Hb_GtInfo( HB_GTI_CLIPBOARDDATA ) + RETURN hb_gtInfo( HB_GTI_CLIPBOARDDATA ) // FUNCTION Wvt_SetClipboard( cText ) - RETURN Hb_GtInfo( HB_GTI_CLIPBOARDDATA, cText ) + RETURN hb_gtInfo( HB_GTI_CLIPBOARDDATA, cText ) // FUNCTION Wvt_PasteFromClipboard() - Local cText, nLen, i - cText := Hb_GtInfo( HB_GTI_CLIPBOARDDATA ) - if ( nLen := Len( cText ) ) > 0 - for i := 1 to nLen - Wvt_KeyBoard( asc( substr( cText, i, 1 ) ) ) - next - endif + LOCAL cText, nLen, i + + cText := hb_gtInfo( HB_GTI_CLIPBOARDDATA ) + IF ( nLen := Len( cText ) ) > 0 + FOR i := 1 TO nLen + Wvt_KeyBoard( Asc( SubStr( cText, i, 1 ) ) ) + NEXT + ENDIF RETURN NIL @@ -787,72 +808,72 @@ FUNCTION Wvt_PasteFromClipboard() FUNCTION Wvt_ResetWindow() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_RESETWINDOW ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_RESETWINDOW ) // FUNCTION Wvt_SetTimer( nTimerID, nMiliSeconds ) - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SETTIMER, { nTimerID, nMiliSeconds } ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_SETTIMER, { nTimerID, nMiliSeconds } ) // FUNCTION Wvt_KillTimer( nTimerID ) - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_KILLTIMER, nTimerID ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_KILLTIMER, nTimerID ) // FUNCTION Wvt_SetOnTop() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_SETONTOP ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_SETONTOP ) // FUNCTION Wvt_SetAsNormal() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_SETASNORMAL ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_SETASNORMAL ) // FUNCTION Wvt_Minimize() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MINIMIZED ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MINIMIZED ) // FUNCTION Wvt_Maximize() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) // FUNCTION Wvt_Hide() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_HIDDEN ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_HIDDEN ) // FUNCTION Wvt_Show() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_NORMAL ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_NORMAL ) // FUNCTION Wvt_SetWindowPos( nX, nY ) - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SETPOSITION, { nX, nY } ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_SETPOSITION, { nX, nY } ) // FUNCTION Wvt_ShowWindow( nState ) - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, nState ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, nState ) // FUNCTION Wvt_Update() - RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_UPDATEWINDOW ) + RETURN hb_gtInfo( HB_GTI_SPEC, HB_GTS_UPDATEWINDOW ) // diff --git a/harbour/contrib/gtwvg/parthdlr.prg b/harbour/contrib/gtwvg/parthdlr.prg index 6cfb83ef8c..f24124d36e 100644 --- a/harbour/contrib/gtwvg/parthdlr.prg +++ b/harbour/contrib/gtwvg/parthdlr.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -109,7 +110,7 @@ CLASS WvgPartHandler DATA sb_notifier METHOD notifierBlock( ... ) SETGET - ENDCLASS +ENDCLASS // @@ -176,17 +177,18 @@ METHOD WvgPartHandler:status() METHOD WvgPartHandler:addChild( oWvg ) oWvg:nNameID := oWvg:nID - aadd( ::aChildren, oWvg ) + AAdd( ::aChildren, oWvg ) RETURN Self // METHOD WvgPartHandler:childFromName( nNameId ) + LOCAL i, oWvg - FOR i := 1 TO len( ::aChildren ) - IF ::aChildren[ i ]:nNameID != NIL .and. ::aChildren[ i ]:nNameID == nNameID + FOR i := 1 TO Len( ::aChildren ) + IF ::aChildren[ i ]:nNameID != NIL .AND. ::aChildren[ i ]:nNameID == nNameID oWvg := ::aChildren[ i ] ENDIF NEXT @@ -202,10 +204,11 @@ METHOD WvgPartHandler:childList() // METHOD WvgPartHandler:removeChild( oChild ) + LOCAL n - IF ( n := ascan( ::aChildren, {| o | o == oChild } ) ) > 0 - hb_aDel( ::aChildren, n, .T. ) + IF ( n := AScan( ::aChildren, {| o | o == oChild } ) ) > 0 + hb_ADel( ::aChildren, n, .T. ) ENDIF RETURN Self @@ -213,23 +216,25 @@ METHOD WvgPartHandler:removeChild( oChild ) // METHOD WvgPartHandler:delChild( oWvg ) + LOCAL n - n := ascan( ::aChildren, {| o | o == oWvg } ) + n := AScan( ::aChildren, {| o | o == oWvg } ) IF n > 0 oWvg:destroy() - adel( ::aChildren, n ) - asize( ::aChildren, len( ::aChildren )-1 ) - endif + ADel( ::aChildren, n ) + ASize( ::aChildren, Len( ::aChildren ) - 1 ) + ENDIF RETURN Self // METHOD WvgPartHandler:setName( nNameId ) + LOCAL nOldNameId := ::nNameId - IF Valtype( nNameId ) == "N" + IF ValType( nNameId ) == "N" ::nNameID := nNameId ENDIF @@ -238,9 +243,10 @@ METHOD WvgPartHandler:setName( nNameId ) // METHOD WvgPartHandler:setOwner( oWvg ) + LOCAL oOldXbp := ::oOwner - IF valtype( oWvg ) == "O" + IF ValType( oWvg ) == "O" ::oOwner := oWvg ENDIF @@ -249,9 +255,10 @@ METHOD WvgPartHandler:setOwner( oWvg ) // METHOD WvgPartHandler:setParent( oWvg ) + LOCAL oOldXbp := ::oParent - IF valtype( oWvg ) == "O" + IF ValType( oWvg ) == "O" ::oParent := oWvg ENDIF @@ -260,7 +267,8 @@ METHOD WvgPartHandler:setParent( oWvg ) // METHOD WvgPartHandler:notifierBlock( ... ) - LOCAL a_:= hb_AParams() + + LOCAL a_ := hb_AParams() IF ! Empty( a_ ) .AND. HB_ISBLOCK( a_[ 1 ] ) ::sb_notifier := a_[ 1 ] @@ -277,8 +285,10 @@ METHOD WvgPartHandler:notifierBlock( ... ) /* This will be called by the WvgCRT() console FOR various events TO be propogated TO child controls */ + METHOD WvgPartHandler:notifier( nEvent, xParams ) - Local aPos, aMenuItem, nIndex, nCtrlID, oObj + + LOCAL aPos, aMenuItem, nIndex, nCtrlID, oObj LOCAL nReturn := 0 DO CASE @@ -286,9 +296,9 @@ METHOD WvgPartHandler:notifier( nEvent, xParams ) CASE nEvent == HB_GTE_MOUSE IF xParams[ 1 ] == WM_MOUSEHOVER aPos := { xParams[ 3 ], xParams[ 4 ] } - elseif xParams[ 1 ] == WM_MOUSELEAVE + ELSEIF xParams[ 1 ] == WM_MOUSELEAVE /* Nothing */ - else + ELSE aPos := iif( ::mouseMode == 2, { xParams[ 3 ], xParams[ 4 ] }, { xParams[ 5 ], xParams[ 6 ] } ) ENDIF @@ -296,67 +306,67 @@ METHOD WvgPartHandler:notifier( nEvent, xParams ) CASE WM_MOUSEHOVER IF HB_ISBLOCK( ::sl_enter ) - eval( ::sl_enter, aPos, NIL, Self ) + Eval( ::sl_enter, aPos, NIL, Self ) ENDIF EXIT CASE WM_MOUSELEAVE IF HB_ISBLOCK( ::sl_leave ) - eval( ::sl_leave, aPos, NIL, Self ) + Eval( ::sl_leave, aPos, NIL, Self ) ENDIF EXIT CASE WM_RBUTTONDOWN IF HB_ISBLOCK( ::sl_rbDown ) - eval( ::sl_rbDown, aPos, NIL, Self ) + Eval( ::sl_rbDown, aPos, NIL, Self ) ENDIF EXIT CASE WM_LBUTTONDOWN IF HB_ISBLOCK( ::sl_lbDown ) - eval( ::sl_lbDown, aPos, NIL, Self ) + Eval( ::sl_lbDown, aPos, NIL, Self ) ENDIF EXIT CASE WM_RBUTTONUP IF HB_ISBLOCK( ::sl_rbUp ) - eval( ::sl_rbUp, aPos, NIL, Self ) + Eval( ::sl_rbUp, aPos, NIL, Self ) ENDIF EXIT CASE WM_LBUTTONUP IF HB_ISBLOCK( ::sl_lbUp ) - eval( ::sl_lbUp, aPos, NIL, Self ) + Eval( ::sl_lbUp, aPos, NIL, Self ) ENDIF EXIT CASE WM_RBUTTONDBLCLK IF HB_ISBLOCK( ::sl_rbDblClick ) - eval( ::sl_rbDblClick, aPos, NIL, Self ) + Eval( ::sl_rbDblClick, aPos, NIL, Self ) ENDIF EXIT CASE WM_LBUTTONDBLCLK IF HB_ISBLOCK( ::sl_lbDblClick ) - eval( ::sl_lbDblClick, aPos, NIL, Self ) + Eval( ::sl_lbDblClick, aPos, NIL, Self ) ENDIF EXIT CASE WM_MBUTTONDOWN IF HB_ISBLOCK( ::sl_mbDown ) - eval( ::sl_mbDown, aPos, NIL, Self ) + Eval( ::sl_mbDown, aPos, NIL, Self ) ENDIF EXIT CASE WM_MBUTTONUP IF HB_ISBLOCK( ::sl_mbClick ) - eval( ::sl_mbClick, aPos, NIL, Self ) + Eval( ::sl_mbClick, aPos, NIL, Self ) ENDIF EXIT CASE WM_MBUTTONDBLCLK IF HB_ISBLOCK( ::sl_mbDblClick ) - eval( ::sl_mbDblClick, aPos, NIL, Self ) + Eval( ::sl_mbDblClick, aPos, NIL, Self ) ENDIF EXIT CASE WM_MOUSEMOVE IF HB_ISBLOCK( ::sl_motion ) - eval( ::sl_motion, aPos, NIL, Self ) + Eval( ::sl_motion, aPos, NIL, Self ) ENDIF EXIT CASE WM_MOUSEWHEEL IF HB_ISBLOCK( ::sl_wheel ) - eval( ::sl_wheel, aPos, NIL, Self ) + Eval( ::sl_wheel, aPos, NIL, Self ) ENDIF EXIT CASE WM_NCMOUSEMOVE @@ -365,20 +375,20 @@ METHOD WvgPartHandler:notifier( nEvent, xParams ) CASE nEvent == HB_GTE_KEYBOARD IF HB_ISBLOCK( ::keyboard ) - eval( ::keyboard, xParams, NIL, Self ) + Eval( ::keyboard, xParams, NIL, Self ) ENDIF CASE nEvent == HB_GTE_SETFOCUS /* aeval( ::aChildren, {| o | WVG_InvalidateRect( o:hWnd ) } ) */ IF HB_ISBLOCK( ::sl_setInputFocus ) - eval( ::sl_setInputFocus, NIL, NIL, Self ) + Eval( ::sl_setInputFocus, NIL, NIL, Self ) ENDIF ::lHasInputFocus := .T. CASE nEvent == HB_GTE_KILLFOCUS IF HB_ISBLOCK( ::sl_killInputFocus ) - eval( ::sl_killInputFocus, NIL, NIL, Self ) + Eval( ::sl_killInputFocus, NIL, NIL, Self ) ENDIF ::lHasInputFocus := .F. @@ -389,18 +399,18 @@ METHOD WvgPartHandler:notifier( nEvent, xParams ) /* Eventally every window be checked if it falls within returned rectangle or not * then it will avoid a lot of flickering */ - aeval( ::aChildren, {| o | WVG_InvalidateRect( o:hWnd ) } ) + AEval( ::aChildren, {| o | WVG_InvalidateRect( o:hWnd ) } ) CASE nEvent == HB_GTE_CLOSE IF HB_ISBLOCK( ::close ) - nReturn := eval( ::close, NIL, NIL, Self ) + nReturn := Eval( ::close, NIL, NIL, Self ) ENDIF CASE nEvent == HB_GTE_MENU DO CASE CASE xParams[ 1 ] == 0 /* menu selected */ IF HB_ISOBJECT( ::oMenu ) - IF !empty( aMenuItem := ::oMenu:FindMenuItemById( xParams[ 2 ] ) ) + IF !Empty( aMenuItem := ::oMenu:FindMenuItemById( xParams[ 2 ] ) ) IF HB_ISBLOCK( aMenuItem[ 2 ] ) Eval( aMenuItem[ 2 ], aMenuItem[ 1 ], NIL, aMenuItem[ 4 ] ) @@ -411,12 +421,12 @@ METHOD WvgPartHandler:notifier( nEvent, xParams ) ENDIF ENDIF - CASE xParams[ 1 ] == 1 .and. HB_ISOBJECT( ::oMenu ) /* enter menu loop */ + CASE xParams[ 1 ] == 1 .AND. HB_ISOBJECT( ::oMenu ) /* enter menu loop */ IF HB_ISBLOCK( ::oMenu:sl_beginMenu ) Eval( ::oMenu:sl_beginMenu, NIL, NIL, Self ) ENDIF - CASE xParams[ 1 ] == 2 .and. HB_ISOBJECT( ::oMenu ) /* exit menu loop */ + CASE xParams[ 1 ] == 2 .AND. HB_ISOBJECT( ::oMenu ) /* exit menu loop */ IF HB_ISBLOCK( ::oMenu:sl_endMenu ) Eval( ::oMenu:sl_endMenu, NIL, NIL, Self ) ENDIF @@ -425,13 +435,13 @@ METHOD WvgPartHandler:notifier( nEvent, xParams ) CASE nEvent == HB_GTE_NOTIFY nCtrlID := xParams[ 1 ] - IF ( nIndex := ascan( ::aChildren, {| o | o:nID == nCtrlID } ) ) > 0 + IF ( nIndex := AScan( ::aChildren, {| o | o:nID == nCtrlID } ) ) > 0 RETURN ::aChildren[ nIndex ]:handleEvent( HB_GTE_NOTIFY, xParams ) ENDIF CASE nEvent == HB_GTE_COMMAND nCtrlID := xParams[ 2 ] - IF ( nIndex := ascan( ::aChildren, {| o | o:nID == nCtrlID } ) ) > 0 + IF ( nIndex := AScan( ::aChildren, {| o | o:nID == nCtrlID } ) ) > 0 RETURN ::aChildren[ nIndex ]:handleEvent( HB_GTE_COMMAND, xParams ) ENDIF @@ -464,13 +474,13 @@ METHOD WvgPartHandler:notifier( nEvent, xParams ) CASE nEvent == HB_GTE_RESIZED IF ::objType == objTypeDialog IF ::drawingArea:objType == objTypeDA - ::drawingArea:setPosAndSize( {0,0}, ::currentSize(), .F. ) + ::drawingArea:setPosAndSize( { 0, 0 }, ::currentSize(), .F. ) ENDIF ENDIF IF HB_ISBLOCK( ::sl_resize ) - eval( ::sl_resize, { xParams[ 1 ], xParams[ 2 ] }, { xParams[ 3 ], xParams[ 4 ] }, Self ) + Eval( ::sl_resize, { xParams[ 1 ], xParams[ 2 ] }, { xParams[ 3 ], xParams[ 4 ] }, Self ) ENDIF - aeval( ::aChildren, {| o | o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } ) + AEval( ::aChildren, {| o | o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } ) CASE nEvent == HB_GTE_KEYTOITEM IF xParams[ 3 ] == ::hWnd @@ -490,13 +500,15 @@ METHOD WvgPartHandler:notifier( nEvent, xParams ) /* This will be called if a control is assigned its own WndProc via ::SetWindowProcCallback() */ + METHOD WvgPartHandler:controlWndProc( hWnd, nMessage, nwParam, nlParam ) + LOCAL nCtrlID, nNotifctn, hWndCtrl, nObj, aMenuItem, oObj, nReturn SWITCH nMessage CASE WM_ERASEBKGND - IF ::objType == objTypeDA .AND. ! empty( ::hBrushBG ) + IF ::objType == objTypeDA .AND. ! Empty( ::hBrushBG ) ::handleEvent( HB_GTE_CTLCOLOR, { nwParam, nlParam } ) ENDIF EXIT @@ -508,7 +520,7 @@ METHOD WvgPartHandler:controlWndProc( hWnd, nMessage, nwParam, nlParam ) IF hWndCtrl == 0 /* It is menu */ IF HB_ISOBJECT( ::oMenu ) - IF !empty( aMenuItem := ::oMenu:FindMenuItemById( nCtrlID ) ) + IF !Empty( aMenuItem := ::oMenu:FindMenuItemById( nCtrlID ) ) IF HB_ISBLOCK( aMenuItem[ 2 ] ) Eval( aMenuItem[ 2 ], aMenuItem[ 1 ], NIL, aMenuItem[ 4 ] ) @@ -520,7 +532,7 @@ METHOD WvgPartHandler:controlWndProc( hWnd, nMessage, nwParam, nlParam ) ENDIF RETURN 0 ELSE - IF ( nObj := ascan( ::aChildren, {| o | o:nID == nCtrlID } ) ) > 0 + IF ( nObj := AScan( ::aChildren, {| o | o:nID == nCtrlID } ) ) > 0 nReturn := ::aChildren[ nObj ]:handleEvent( HB_GTE_COMMAND, { nNotifctn, nCtrlID, hWndCtrl } ) IF HB_ISNUMERIC( nReturn ) .AND. nReturn == 0 RETURN 0 @@ -530,7 +542,7 @@ METHOD WvgPartHandler:controlWndProc( hWnd, nMessage, nwParam, nlParam ) EXIT CASE WM_NOTIFY - IF ( nObj := ascan( ::aChildren, {| o | o:nID == nwParam } ) ) > 0 + IF ( nObj := AScan( ::aChildren, {| o | o:nID == nwParam } ) ) > 0 nReturn := ::aChildren[ nObj ]:handleEvent( HB_GTE_NOTIFY, { nwParam, nlParam } ) IF HB_ISNUMERIC( nReturn ) .AND. nReturn == EVENT_HANDELLED RETURN 0 diff --git a/harbour/contrib/gtwvg/pushbut.prg b/harbour/contrib/gtwvg/pushbut.prg index 9acc681a3e..ea8961be83 100644 --- a/harbour/contrib/gtwvg/pushbut.prg +++ b/harbour/contrib/gtwvg/pushbut.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -84,7 +85,7 @@ CLASS WvgPushButton INHERIT WvgWindow DATA pointerFocus INIT .T. DATA preSelect INIT .F. DATA drawMode INIT WVG_DRAW_NORMAL - DATA default INIT .F. + DATA DEFAULT INIT .F. DATA cancel INIT .F. METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -100,7 +101,7 @@ CLASS WvgPushButton INHERIT WvgWindow METHOD setColorFG() INLINE NIL METHOD setColorBG() INLINE NIL - ENDCLASS +ENDCLASS // @@ -123,9 +124,9 @@ METHOD WvgPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible IF HB_ISNUMERIC( ::caption ) ::style += BS_BITMAP ELSEIF HB_ISSTRING( ::caption ) - IF ".ICO" == upper( right( ::caption, 4 ) ) + IF ".ICO" == Upper( Right( ::caption, 4 ) ) ::style += BS_ICON - ELSEIF ".BMP" == upper( right( ::caption, 4 ) ) + ELSEIF ".BMP" == Upper( Right( ::caption, 4 ) ) ::style += BS_BITMAP ENDIF ENDIF @@ -160,7 +161,7 @@ METHOD WvgPushButton:handleEvent( nMessage, aNM ) ENDIF ::sendMessage( WM_SIZE, 0, 0 ) IF HB_ISBLOCK( ::sl_resize ) - eval( ::sl_resize, NIL, NIL, self ) + Eval( ::sl_resize, NIL, NIL, self ) ENDIF CASE nMessage == HB_GTE_COMMAND @@ -169,7 +170,7 @@ METHOD WvgPushButton:handleEvent( nMessage, aNM ) IF ::isParentCrt() ::oParent:setFocus() ENDIF - eval( ::sl_lbClick, NIL, NIL, self ) + Eval( ::sl_lbClick, NIL, NIL, self ) IF ::pointerFocus ::setFocus() ENDIF @@ -196,7 +197,7 @@ METHOD WvgPushButton:handleEvent( nMessage, aNM ) IF ::isParentCrt() ::oParent:setFocus() ENDIF - eval( ::sl_lbClick, NIL, NIL, Self ) + Eval( ::sl_lbClick, NIL, NIL, Self ) ENDIF ENDIF #endif @@ -207,13 +208,17 @@ METHOD WvgPushButton:handleEvent( nMessage, aNM ) // METHOD WvgPushButton:destroy() + ::wvgWindow:destroy() + RETURN NIL // METHOD WvgPushButton:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + RETURN Self // @@ -225,9 +230,9 @@ METHOD WvgPushButton:setCaption( xCaption, cDll ) IF HB_ISSTRING( xCaption ) ::caption := xCaption - IF ".ico" == lower( right( ::caption, 4 ) ) + IF ".ico" == Lower( Right( ::caption, 4 ) ) WVG_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_ICON, WVG_LoadImage( ::caption, 2, IMAGE_ICON ) ) - ELSEIF ".BMP" == upper( right( ::caption, 4 ) ) + ELSEIF ".BMP" == Upper( Right( ::caption, 4 ) ) WVG_SendMessage( ::hWnd, BM_SETIMAGE, IMAGE_BITMAP, WVG_LoadImage( ::caption, 2, IMAGE_BITMAP ) ) ELSE WVG_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::caption ) @@ -245,7 +250,7 @@ METHOD WvgPushButton:setCaption( xCaption, cDll ) METHOD WvgPushButton:activate( xParam ) - IF HB_ISBLOCK( xParam ) .OR. ( xParam == NIL ) + IF HB_ISBLOCK( xParam ) .OR. xParam == NIL ::sl_lbClick := xParam ENDIF @@ -255,7 +260,7 @@ METHOD WvgPushButton:activate( xParam ) METHOD WvgPushButton:draw( xParam ) - IF HB_ISBLOCK( xParam ) .or. ( xParam == NIL ) + IF HB_ISBLOCK( xParam ) .OR. xParam == NIL ::sl_paint := xParam ENDIF diff --git a/harbour/contrib/gtwvg/radiobut.prg b/harbour/contrib/gtwvg/radiobut.prg index 9706c654e5..bcd4f1e5b9 100644 --- a/harbour/contrib/gtwvg/radiobut.prg +++ b/harbour/contrib/gtwvg/radiobut.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -100,7 +101,7 @@ CLASS WvgRadioButton INHERIT WvgWindow, WvgDataRef ACCESS selected INLINE ::sl_lbClick ASSIGN selected( bBlock ) INLINE ::sl_lbClick := bBlock - ENDCLASS +ENDCLASS // @@ -151,7 +152,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgRadioButton ::editBuffer := ( WVG_Button_GetCheck( ::hWnd ) == BST_CHECKED ) IF HB_ISBLOCK( ::sl_lbClick ) - eval( ::sl_lbClick, ::editBuffer, NIL, self ) + Eval( ::sl_lbClick, ::editBuffer, NIL, self ) RETURN 0 ENDIF ENDIF diff --git a/harbour/contrib/gtwvg/scrollbr.prg b/harbour/contrib/gtwvg/scrollbr.prg index bf2cbe3d47..207270b479 100644 --- a/harbour/contrib/gtwvg/scrollbr.prg +++ b/harbour/contrib/gtwvg/scrollbr.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -74,54 +75,14 @@ #include "wvtwin.ch" #include "wvgparts.ch" -// -#if 0 - -#include "xhb.ch" -#include "cstruct.ch" -#include "wintypes.ch" - -typedef struct tagSCROLLBARINFO {; - DWORD cbSize; - RECT rcScrollBar; - int dxyLineButton; - int xyThumbTop; - int xyThumbBottom; - int reserved; - DWORD x; /* rgstate[CCHILDREN_SCROLLBAR+1]; */ -} SCROLLBARINFO - -typedef struct tagSCROLLINFO {; - UINT cbSize; - UINT fMask; - int nMin; - int nMax; - UINT nPage; - int nPos; - int nTrackPos; -} SCROLLINFO - -typedef struct tagPOINT {; - LONG x; - LONG y; -} POINT - -typedef struct tagRECT { ; - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECT - -#endif // CLASS WvgScrollBar INHERIT WvgWindow, WvgDataRef DATA autoTrack INIT .T. - DATA range INIT {0,1} - DATA scrollBoxSize INIT -1 - DATA type INIT WVGSCROLL_HORIZONTAL + DATA RANGE INIT { 0, 1 } + DATA scrollBoxSize INIT - 1 + DATA TYPE INIT WVGSCROLL_HORIZONTAL DATA excludeScrollBox INIT .F. DATA sl_xbeSB_Scroll @@ -134,12 +95,12 @@ CLASS WvgScrollBar INHERIT WvgWindow, WvgDataRef METHOD destroy() METHOD handleEvent( nMessage, aNM ) - METHOD scroll( xParam ) SETGET + METHOD Scroll( xParam ) SETGET METHOD setRange( aRange ) METHOD setScrollBoxSize( nUnits ) - ENDCLASS +ENDCLASS // @@ -194,6 +155,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSc // METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar + LOCAL nScrMsg, nScrPos, nCommand DO CASE @@ -219,7 +181,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar ENDIF nScrMsg := aNM[ 1 ] - IF nScrMsg == SB_THUMBPOSITION .or. nScrMsg == SB_THUMBTRACK + IF nScrMsg == SB_THUMBPOSITION .OR. nScrMsg == SB_THUMBTRACK nScrPos := aNM[ 2 ] ELSE nScrPos := WAPI_GetScrollPos( ::pWnd, SB_CTL ) @@ -277,7 +239,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar ENDCASE ::sl_editBuffer := nScrPos - eval( ::sl_xbeSB_Scroll, { nScrPos, nCommand }, NIL, Self ) + Eval( ::sl_xbeSB_Scroll, { nScrPos, nCommand }, NIL, Self ) RETURN EVENT_HANDELLED @@ -287,7 +249,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar ENDIF nScrMsg := aNM[ 1 ] - IF nScrMsg == SB_THUMBPOSITION .or. nScrMsg == SB_THUMBTRACK + IF nScrMsg == SB_THUMBPOSITION .OR. nScrMsg == SB_THUMBTRACK nScrPos := aNM[ 2 ] ELSE nScrPos := WAPI_GetScrollPos( ::pWnd, SB_CTL ) @@ -349,7 +311,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar ENDCASE ::sl_editBuffer := nScrPos - eval( ::sl_xbeSB_Scroll, { nScrPos, nCommand }, NIL, self ) + Eval( ::sl_xbeSB_Scroll, { nScrPos, nCommand }, NIL, self ) RETURN EVENT_HANDELLED ENDCASE @@ -368,7 +330,7 @@ METHOD destroy() CLASS WvgScrollBar // -METHOD scroll( xParam ) CLASS WvgScrollBar +METHOD Scroll( xParam ) CLASS WvgScrollBar IF HB_ISBLOCK( xParam ) ::sl_xbeSB_Scroll := xParam @@ -379,6 +341,7 @@ METHOD scroll( xParam ) CLASS WvgScrollBar // METHOD setRange( aRange ) CLASS WvgScrollBar + LOCAL aOldRange, nMin, nMax IF WAPI_GetScrollRange( ::pWnd, SB_CTL, @nMin, @nMax ) @@ -396,276 +359,7 @@ METHOD setRange( aRange ) CLASS WvgScrollBar // METHOD setScrollBoxSize( nUnits ) CLASS WvgScrollBar + LOCAL nOldUnits := nUnits RETURN nOldUnits - -// -#if 0 - -Scroll Bar -This section contains information about the programming elements used with scroll bars. -A window can display a data object, such as a document or a bitmap, that is larger than -the windows client area. When provided with a scroll bar, the user can scroll a data -object in the client area to bring into view the portions of the object that extend beyond -the borders of the window. - - -Overviews -About Scroll Bars -A scroll bar consists of a shaded shaft with an arrow button at each end and a scroll -box (sometimes called a thumb) between the arrow buttons. - -Using Scroll Bars -When creating an overlapped, pop-up, or child window, you can add standard scroll bars -by using the CreateWindowEx function and specifying WS_HSCROLL, WS_VSCROLL, or both styles. - - - -Functions -EnableScrollBar -The EnableScrollBar function enables or disables one or both scroll bar arrows. - -GetScrollBarInfo -The GetScrollBarInfo function retrieves information about the specified scroll bar. - -GetScrollInfo -The GetScrollInfo function retrieves the parameters of a scroll bar, including -the minimum and maximum scrolling positions, the page size, and the position of the -scroll box (thumb). - -GetScrollPos -The GetScrollPos function retrieves the current position of the scroll box (thumb) -in the specified scroll bar. The current position is a relative value that depends on -the current scrolling range. For example, if the scrolling range is 0 through 100 and the -scroll box is in the middle of the bar, the current position is 50. - -Note The GetScrollPos function is provided for backward compatibility. New applications -should use the GetScrollInfo function. - -GetScrollRange -The GetScrollRange function retrieves the current minimum and maximum scroll box -(thumb) positions for the specified scroll bar. - -Note The GetScrollRange function is provided for compatibility only. New applications -should use the GetScrollInfo function. - -ScrollDC -The ScrollDC function scrolls a rectangle of bits horizontally and vertically. - -ScrollWindow -The ScrollWindow function scrolls the contents of the specified windows client area. - -Note The ScrollWindow function is provided for backward compatibility. -New applications should use the ScrollWindowEx function. - -ScrollWindowEx -The ScrollWindowEx function scrolls the contents of the specified windows client area. - -SetScrollInfo -The SetScrollInfo function sets the parameters of a scroll bar, including the -minimum and maximum scrolling positions, the page size, and the position of the -scroll box (thumb). The function also redraws the scroll bar, if requested. - -SetScrollPos -The SetScrollPos function sets the position of the scroll box (thumb) in the specified -scroll bar and, if requested, redraws the scroll bar to reflect the new position of -the scroll box. - -Note The SetScrollPos function is provided for backward compatibility. -New applications should use the SetScrollInfo function. - -SetScrollRange -The SetScrollRange function sets the minimum and maximum scroll box positions for -the specified scroll bar. - -Note The SetScrollRange function is provided for backward compatibility. -New applications should use the SetScrollInfo function. - -ShowScrollBar -The ShowScrollBar function shows or hides the specified scroll bar. - - - -Messages -======== - -SBM_ENABLE_ARROWS -An application sends the SBM_ENABLE_ARROWS message to enable or disable one or -both arrows of a scroll bar control. - -SBM_GETPOS -The SBM_GETPOS message is sent to retrieve the current position of the scroll box -of a scroll bar control. The current position is a relative value that depends on the -current scrolling range. For example, if the scrolling range is 0 through 100 and the -scroll box is in the middle of the bar, the current position is 50. - -Applications should not send this message directly. Instead, they should use the -GetScrollPos function. A window receives this message through its WindowProc function. -Applications which implement a custom scroll bar control must respond to these messages -for the GetScrollPos function to function properly. - -SBM_GETRANGE -The SBM_GETRANGE message is sent to retrieve the minimum and maximum position values -for the scroll bar control. - -Applications should not send this message directly. Instead, they should use the -GetScrollRange function. A window receives this message through its WindowProc function. -Applications which implement a custom scroll bar control must respond to these -messages for the GetScrollRange function to work properly. - -SBM_GETSCROLLBARINFO -Sent by an application to retrieve information about the specified scroll bar. - -SBM_GETSCROLLINFO -The SBM_GETSCROLLINFO message is sent to retrieve the parameters of a scroll bar. - -Applications should not send this message directly. Instead, they should use -the GetScrollInfo function. A window receives this message through its WindowProc function. -Applications which implement a custom scroll bar control must respond to these -messages for the GetScrollInfo function to work properly. - -SBM_SETPOS -The SBM_SETPOS message is sent to set the position of the scroll box (thumb) and, -if requested, redraw the scroll bar to reflect the new position of the scroll box. - -Applications should not send this message directly. Instead, they should use the -SetScrollPos function. A window receives this message through its WindowProc function. -Applications which implement a custom scroll bar control must respond to -these messages for the SetScrollPos function to work properly. - -SBM_SETRANGE -The SBM_SETRANGE message is sent to set the minimum and maximum position values -for the scroll bar control. - -Applications should not send this message directly. Instead, they should use the -SetScrollRange function. A window receives this message through its WindowProc function. -Applications which implement a custom scroll bar control must respond to these -messages for the SetScrollRange function to work properly. - -SBM_SETRANGEREDRAW -An application sends the SBM_SETRANGEREDRAW message to a scroll bar control to -set the minimum and maximum position values and to redraw the control. - -SBM_SETSCROLLINFO -The SBM_SETSCROLLINFO message is sent to set the parameters of a scroll bar. - -Applications should not send this message directly. Instead, they should use -the SetScrollInfo function. A window receives this message through its WindowProc function. -Applications which implement a custom scroll bar control must respond to -these messages for the SetScrollInfo function to function properly. - - - -Notifications - -WM_CTLCOLORSCROLLBAR -The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a -scroll bar control when the control is about to be drawn. By responding to this -message, the parent window can use the display context handle to set the background -color of the scroll bar control. - -A window receives this message through its WindowProc function. - -WM_HSCROLL -The WM_HSCROLL message is sent to a window when a scroll event occurs in the -windows standard horizontal scroll bar. This message is also sent to the owner -of a horizontal scroll bar control when a scroll event occurs in the control. - -A window receives this message through its WindowProc function. - -WM_VSCROLL -The WM_VSCROLL message is sent to a window when a scroll event occurs in the windows -standard vertical scroll bar. This message is also sent to the owner of a vertical -scroll bar control when a scroll event occurs in the control. - -A window receives this message through its WindowProc function. - - - -Structures -========== -SCROLLBARINFO -The SCROLLBARINFO structure contains scroll bar information. - -SCROLLINFO -The SCROLLINFO structure contains scroll bar parameters to be set by the SetScrollInfo function (or SBM_SETSCROLLINFO message), or retrieved by the GetScrollInfo function (or SBM_GETSCROLLINFO message). - - - -Constants -========= -Scroll Bar Control Styles - -To create a scroll bar control using the CreateWindow or CreateWindowEx -function specify the SCROLLBAR class, appropriate window style constants, -and a combination of the following scroll bar control styles. Some of the styles -create a scroll bar control that uses a default width or height. However, -you must always specify the x- and y-coordinates and the other dimensions of the -scroll bar when you call CreateWindow or CreateWindowEx. - - -SBS_BOTTOMALIGN - -Aligns the bottom edge of the scroll bar with the bottom edge of the rectangle -defined by the x, y, nWidth, and nHeight parameters of CreateWindowEx function. -The scroll bar has the default height for system scroll bars. Use this style with -the SBS_HORZ style. - -SBS_HORZ - -Designates a horizontal scroll bar. If neither the SBS_BOTTOMALIGN nor SBS_TOPALIGN -style is specified, the scroll bar has the height, width, and position specified by the -x, y, nWidth, and nHeight parameters of CreateWindowEx. - -SBS_LEFTALIGN - -Aligns the left edge of the scroll bar with the left edge of the rectangle defined -by the x, y, nWidth, and nHeight parameters of CreateWindowEx. The scroll bar has -the default width for system scroll bars. Use this style with the SBS_VERT style. - -SBS_RIGHTALIGN - -Aligns the right edge of the scroll bar with the right edge of the rectangle defined -by the x, y, nWidth, and nHeight parameters of CreateWindowEx. The scroll bar has the -default width for system scroll bars. Use this style with the SBS_VERT style. - -SBS_SIZEBOX - -Designates a size box. If you specify neither the SBS_SIZEBOXBOTTOMRIGHTALIGN nor the -SBS_SIZEBOXTOPLEFTALIGN style, the size box has the height, width, and position -specified by the x, y, nWidth, and nHeight parameters of CreateWindowEx. - -SBS_SIZEBOXBOTTOMRIGHTALIGN - -Aligns the lower right corner of the size box with the lower right corner of the -rectangle specified by the x, y, nWidth, and nHeight parameters of CreateWindowEx. -The size box has the default size for system size boxes. Use this style with the -SBS_SIZEBOX style. - -SBS_SIZEBOXTOPLEFTALIGN - -Aligns the upper left corner of the size box with the upper left corner of the -rectangle specified by the x, y, nWidth, and nHeight parameters of CreateWindowEx. -The size box has the default size for system size boxes. Use this style with the -SBS_SIZEBOX style. - -SBS_SIZEGRIP - -Same as SBS_SIZEBOX, but with a raised edge. - -SBS_TOPALIGN - -Aligns the top edge of the scroll bar with the top edge of the rectangle defined -by the x, y, nWidth, and nHeight parameters of CreateWindowEx. The scroll bar has -the default height for system scroll bars. Use this style with the SBS_HORZ style. - -SBS_VERT - -Designates a vertical scroll bar. If you specify neither the SBS_RIGHTALIGN nor -the SBS_LEFTALIGN style, the scroll bar has the height, width, and position specified -by the x, y, nWidth, and nHeight parameters of CreateWindowEx. - - -#endif -// diff --git a/harbour/contrib/gtwvg/sle.prg b/harbour/contrib/gtwvg/sle.prg index 97173ce777..3c3547cfee 100644 --- a/harbour/contrib/gtwvg/sle.prg +++ b/harbour/contrib/gtwvg/sle.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -93,7 +94,7 @@ CLASS WvgSLE INHERIT WvgWindow, WvgDataRef METHOD destroy() METHOD handleEvent( nMessage, aNM ) - METHOD clear() + METHOD CLEAR() METHOD copyMarked() METHOD cutMarked() METHOD delMarked() VIRTUAL @@ -119,7 +120,7 @@ CLASS WvgSLE INHERIT WvgWindow, WvgDataRef DATA sl_returnPressed METHOD returnPressed( ... ) SETGET - ENDCLASS +ENDCLASS // @@ -136,7 +137,8 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSLE // METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSLE - LOCAL es_:= { ES_LEFT, ES_RIGHT, ES_CENTER } + + LOCAL es_ := { ES_LEFT, ES_RIGHT, ES_CENTER } ::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -171,7 +173,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgSL ::setPosAndSize() IF HB_ISOBJECT( ::datalink ) - eval( ::datalink ) + Eval( ::datalink ) ENDIF ::sendMessage( EM_SETLIMITTEXT, ::bufferLength ) @@ -200,12 +202,12 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE CASE aNM[ NMH_code ] == EN_KILLFOCUS IF HB_ISBLOCK( ::sl_killInputFocus ) - eval( ::sl_killInputFocus, NIL, NIL, Self ) + Eval( ::sl_killInputFocus, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == EN_SETFOCUS IF HB_ISBLOCK( ::sl_setInputFocus ) - eval( ::sl_setInputFocus, NIL, NIL, Self ) + Eval( ::sl_setInputFocus, NIL, NIL, Self ) ENDIF ENDCASE @@ -225,12 +227,12 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE DO CASE CASE aNM[ NMH_code ] == WM_KILLFOCUS IF HB_ISBLOCK( ::sl_killInputFocus ) - eval( ::sl_killInputFocus, NIL, NIL, Self ) + Eval( ::sl_killInputFocus, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == WM_SETFOCUS IF HB_ISBLOCK( ::sl_setInputFocus ) - eval( ::sl_setInputFocus, NIL, NIL, Self ) + Eval( ::sl_setInputFocus, NIL, NIL, Self ) ENDIF CASE aNM[ NMH_code ] == WM_KEYDOWN @@ -239,7 +241,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgSLE ::oParent:setFocus() ENDIF IF HB_ISBLOCK( ::sl_returnPressed ) - eval( ::sl_returnPressed, NIL, NIL, Self ) + Eval( ::sl_returnPressed, NIL, NIL, Self ) ENDIF ELSEIF aNM[ 2 ] == VK_TAB IF ::isParentCrt() @@ -269,6 +271,7 @@ METHOD destroy() CLASS WvgSLE // METHOD WvgSLE:changed( lChanged ) + LOCAL lChg := ::sendMessage( EM_GETMODIFY, 0, 0 ) IF HB_ISLOGICAL( lChanged ) @@ -280,15 +283,17 @@ METHOD WvgSLE:changed( lChanged ) // METHOD WvgSLE:clear() + LOCAL cText := ::getData() ::setData( "" ) - RETURN len( cText ) + RETURN Len( cText ) // METHOD WvgSLE:copyMarked() + LOCAL n, nB, nE n := ::sendMessage( EM_GETSEL ) @@ -296,7 +301,7 @@ METHOD WvgSLE:copyMarked() nE := WVG_HIWORD( n ) IF ( n := nE - nB ) > 0 - Wvt_SetClipboard( substr( ::getData(), nB, n ) ) + Wvt_SetClipboard( SubStr( ::getData(), nB, n ) ) ENDIF RETURN n @@ -304,6 +309,7 @@ METHOD WvgSLE:copyMarked() // METHOD WvgSLE:cutMarked() + LOCAL n, nB, nE, cText n := ::sendMessage( EM_GETSEL ) @@ -312,7 +318,7 @@ METHOD WvgSLE:cutMarked() IF ( n := nE - nB ) > 0 cText := ::getData() - ::setData( substr( cText, 1, nB-1 ) + substr( cText, nE ) ) + ::setData( SubStr( cText, 1, nB - 1 ) + SubStr( cText, nE ) ) ENDIF RETURN n @@ -320,12 +326,15 @@ METHOD WvgSLE:cutMarked() // METHOD WvgSLE:returnPressed( ... ) - LOCAL a_:= hb_aParams() - IF len( a_ ) == 1 .AND. HB_ISBLOCK( a_[ 1 ] ) + + LOCAL a_ := hb_AParams() + + IF Len( a_ ) == 1 .AND. HB_ISBLOCK( a_[ 1 ] ) ::sl_returnPressed := a_[ 1 ] - ELSEIF len( a_ ) >= 0 .AND. HB_ISBLOCK( ::sl_returnPressed ) - eval( ::sl_returnPressed, NIL, NIL, Self ) + ELSEIF Len( a_ ) >= 0 .AND. HB_ISBLOCK( ::sl_returnPressed ) + Eval( ::sl_returnPressed, NIL, NIL, Self ) ENDIF + RETURN Self // diff --git a/harbour/contrib/gtwvg/statbar.prg b/harbour/contrib/gtwvg/statbar.prg index 216d0707ce..84284837fe 100644 --- a/harbour/contrib/gtwvg/statbar.prg +++ b/harbour/contrib/gtwvg/statbar.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -100,11 +101,11 @@ CLASS WvgStatusBar INHERIT WvgWindow /* WvgActiveXControl */ METHOD addItem( cCaption, xImage, cDLL, nStyle, cKey, nMode ) METHOD delItem( nItemORcKey ) METHOD getItem( nItemORcKey ) - METHOD clear() + METHOD CLEAR() METHOD panelClick( xParam ) SETGET METHOD panelDblClick( xParam ) SETGET - ENDCLASS +ENDCLASS // @@ -138,17 +139,18 @@ METHOD WvgStatusBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ::show() ENDIF - ::addItem( , , , , , -1 ) + ::addItem( , , , , , - 1 ) RETURN Self // METHOD WvgStatusBar:handleEvent( nMessage, aNM ) + LOCAL nHandled := 1 LOCAL nObj, aNMH - hb_traceLog( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + hb_traceLog( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage ) DO CASE @@ -158,7 +160,7 @@ METHOD WvgStatusBar:handleEvent( nMessage, aNM ) CASE nMessage == HB_GTE_COMMAND IF HB_ISBLOCK( ::sl_lbClick ) - eval( ::sl_lbClick, NIL, NIL, self ) + Eval( ::sl_lbClick, NIL, NIL, self ) RETURN 0 ENDIF @@ -200,6 +202,7 @@ METHOD WvgStatusBar:handleEvent( nMessage, aNM ) // METHOD WvgStatusBar:destroy() + LOCAL i, nItems hb_traceLog( " %s:destroy()", __objGetClsName() ) @@ -225,6 +228,7 @@ METHOD WvgStatusBar:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisib // METHOD WvgStatusBar:addItem( cCaption, xImage, cDLL, nStyle, cKey, nMode ) + LOCAL oPanel, lSuccess DEFAULT nMode TO 0 @@ -240,28 +244,29 @@ METHOD WvgStatusBar:addItem( cCaption, xImage, cDLL, nStyle, cKey, nMode ) lSuccess := Wvg_StatusBarCreatePanel( ::hWnd, nMode ) IF lSuccess - aadd( ::aItems, oPanel ) + AAdd( ::aItems, oPanel ) ELSE RETURN nil - endif + ENDIF RETURN oPanel // METHOD WvgStatusBar:delItem( nItemORcKey ) + LOCAL nIndex := 0 IF HB_ISNUMERIC( nItemORcKey ) - nIndex := ascan( ::aItems, {| o | o:key == nItemORcKey } ) + nIndex := AScan( ::aItems, {| o | o:key == nItemORcKey } ) ELSEIF HB_ISNUMERIC( nItemORcKey ) nIndex := nItemORcKey ENDIF IF nIndex > 0 /* Delete panel by window */ - adel( ::aItems, nIndex ) - asize( ::aItems, len( ::aItems ) - 1 ) + ADel( ::aItems, nIndex ) + ASize( ::aItems, Len( ::aItems ) - 1 ) ENDIF RETURN Self @@ -269,10 +274,11 @@ METHOD WvgStatusBar:delItem( nItemORcKey ) // METHOD WvgStatusBar:getItem( nItemORcKey ) + LOCAL nIndex := 0, oPanel IF HB_ISSTRING( nItemORcKey ) - nIndex := ascan( ::aItems, {| o | o:key == nItemORcKey } ) + nIndex := AScan( ::aItems, {| o | o:key == nItemORcKey } ) ELSEIF HB_ISNUMERIC( nItemORcKey ) nIndex := nItemORcKey @@ -286,7 +292,9 @@ METHOD WvgStatusBar:getItem( nItemORcKey ) RETURN oPanel // + METHOD WvgStatusBar:clear() + LOCAL i FOR i := 1 TO ::numItems @@ -302,7 +310,7 @@ METHOD WvgStatusBar:clear() METHOD WvgStatusBar:panelClick( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbClick := xParam ENDIF @@ -312,7 +320,7 @@ METHOD WvgStatusBar:panelClick( xParam ) METHOD WvgStatusBar:panelDblClick( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbDblClick := xParam ENDIF @@ -334,8 +342,8 @@ CLASS WvgStatusBarPanel DATA autosize INIT WVGSTATUSBAR_AUTOSIZE_NONE DATA bevel INIT WVGSTATUSBAR_BEVEL_INSET DATA enabled INIT .T. - DATA index INIT 0 - DATA key INIT "" + DATA INDEX INIT 0 + DATA KEY INIT "" DATA style INIT WVGSTATUSBAR_PANEL_TEXT DATA sl_caption INIT "" DATA image INIT NIL @@ -350,8 +358,10 @@ CLASS WvgStatusBarPanel DATA oParent - ENDCLASS +ENDCLASS + // + METHOD WvgStatusBarPanel:new( cCaption, nStyle, cKey ) DEFAULT cCaption TO ::sl_caption @@ -363,7 +373,9 @@ METHOD WvgStatusBarPanel:new( cCaption, nStyle, cKey ) ::key := cKey RETURN Self + // + METHOD WvgStatusBarPanel:caption( cCaption ) IF cCaption == NIL diff --git a/harbour/contrib/gtwvg/static.prg b/harbour/contrib/gtwvg/static.prg index ba27d15ab3..36a47835c4 100644 --- a/harbour/contrib/gtwvg/static.prg +++ b/harbour/contrib/gtwvg/static.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -82,8 +83,8 @@ CLASS WvgStatic INHERIT WvgWindow DATA caption INIT "" DATA clipParent INIT .T. DATA clipSiblings INIT .F. - DATA options INIT -1 /* WVGSTATIC_TEXT_LEFT */ - DATA type INIT -1 /* WVGSTATIC_TYPE_TEXT */ + DATA options INIT - 1 /* WVGSTATIC_TEXT_LEFT */ + DATA TYPE INIT - 1 /* WVGSTATIC_TYPE_TEXT */ DATA hBitmap @@ -95,7 +96,7 @@ CLASS WvgStatic INHERIT WvgWindow METHOD setCaption( xCaption, cDll ) - ENDCLASS +ENDCLASS // @@ -117,7 +118,7 @@ METHOD WvgStatic:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - #if 0 +#if 0 SS_ETCHEDFRAME SS_SUNKEN SS_LEFTNOWORDWRAP @@ -128,7 +129,7 @@ METHOD WvgStatic:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) SS_ETCHEDHORZ SS_ETCHEDVERT SS_RIGHTJUST - #endif +#endif SWITCH ::type @@ -200,9 +201,9 @@ METHOD WvgStatic:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) EXIT ENDSWITCH /* ::type */ - #if 1 +#if 1 /* Options */ - IF ( ascan( { WVGSTATIC_TYPE_FGNDFRAME, WVGSTATIC_TYPE_BGNDFRAME, WVGSTATIC_TYPE_HALFTONEFRAME }, ::type ) > 0 ) + IF ( AScan( { WVGSTATIC_TYPE_FGNDFRAME, WVGSTATIC_TYPE_BGNDFRAME, WVGSTATIC_TYPE_HALFTONEFRAME }, ::type ) > 0 ) IF ( hb_bitAnd( ::options, WVGSTATIC_FRAMETHIN ) == WVGSTATIC_FRAMETHIN ) ::style += WS_BORDER @@ -211,8 +212,8 @@ METHOD WvgStatic:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ENDIF ENDIF - #endif - #if 0 +#endif +#if 0 IF ::type == WVGSTATIC_TYPE_TEXT IF ::options == WVGSTATIC_FRAMETHIN ::style += WS_BORDER @@ -220,7 +221,7 @@ METHOD WvgStatic:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::style += WS_DLGFRAME ENDIF ENDIF - #endif +#endif ::oParent:addChild( SELF ) @@ -248,9 +249,9 @@ METHOD WvgStatic:handleEvent( nMessage, aNM ) ::rePosition() ENDIF IF HB_ISBLOCK( ::sl_resize ) - eval( ::sl_resize, NIL, NIL, self ) + Eval( ::sl_resize, NIL, NIL, self ) ENDIF - aeval( ::aChildren, {|o| o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } ) + AEval( ::aChildren, {|o| o:handleEvent( HB_GTE_RESIZED, { 0, 0, 0, 0, 0 } ) } ) RETURN EVENT_HANDELLED CASE nMessage == HB_GTE_CTLCOLOR @@ -288,7 +289,9 @@ METHOD WvgStatic:destroy() // METHOD WvgStatic:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + RETURN Self // diff --git a/harbour/contrib/gtwvg/syswnd.prg b/harbour/contrib/gtwvg/syswnd.prg index 8ba06a95fa..e95c7af931 100644 --- a/harbour/contrib/gtwvg/syswnd.prg +++ b/harbour/contrib/gtwvg/syswnd.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -78,7 +79,6 @@ CLASS WvgSysWindow INHERIT WvgPartHandler - METHOD new( oParent, oOwner, aPos ) METHOD create( oParent, oOwner, aPos ) METHOD configure() @@ -109,10 +109,10 @@ CLASS WvgSysWindow INHERIT WvgPartHandler ASSIGN move( bBlock ) INLINE ::sl_move := bBlock DATA sl_quit - ACCESS quit INLINE ::sl_quit + ACCESS QUIT INLINE ::sl_quit ASSIGN quit( bBlock ) INLINE ::sl_quit := bBlock - ENDCLASS +ENDCLASS // @@ -193,6 +193,7 @@ METHOD WvgSysWindow:setPos( aPos ) // METHOD WvgSysWindow:currentPos() + LOCAL aRect aRect := WVG_GetWindowRect( ::hWnd ) @@ -202,6 +203,7 @@ METHOD WvgSysWindow:currentPos() // METHOD WvgSysWindow:currentSize() + LOCAL aRect aRect := WVG_GetClientRect( ::hWnd ) @@ -246,8 +248,8 @@ CLASS WvgFontDialog INHERIT WvgSysWindow DATA outLine INIT .T. - DATA previewBGClr INIT RGB( 255,255,255 ) - DATA previewFGClr INIT RGB( 0,0,0 ) + DATA previewBGClr INIT RGB( 255, 255, 255 ) + DATA previewFGClr INIT RGB( 0, 0, 0 ) DATA previewString INIT " " DATA printerPS INIT NIL DATA screenPS INIT NIL @@ -289,7 +291,7 @@ CLASS WvgFontDialog INHERIT WvgSysWindow METHOD wndProc( hWnd, nMessage, nwParam, nlParam ) METHOD GetWvgFont( aFont ) PROTECTED - ENDCLASS +ENDCLASS // @@ -327,10 +329,10 @@ METHOD create( oParent, oOwner, oScreenPS, oPrinterPS, aPos ) CLASS WvgFontDialo ::oPrinterPS := oPrinterPS ::aPos := aPos - IF ::viewPrinterFonts .and. ::oPrinterPS == NIL + IF ::viewPrinterFonts .AND. ::oPrinterPS == NIL ::viewPrinterFonts := .F. ENDIF - IF ( ! ::viewScreenFonts .and. ! ::viewPrinterFonts ) + IF ( ! ::viewScreenFonts .AND. ! ::viewPrinterFonts ) ::viewScreenFonts := .T. ENDIF @@ -343,6 +345,7 @@ METHOD create( oParent, oOwner, oScreenPS, oPrinterPS, aPos ) CLASS WvgFontDialo // METHOD wndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgFontDialog + LOCAL aRect, nL, nH HB_SYMBOL_UNUSED( nlParam ) @@ -352,7 +355,7 @@ METHOD wndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgFontDialog CASE nMessage == WM_INITDIALOG ::hWnd := hWnd - IF !empty( ::title ) + IF !Empty( ::title ) WVG_SetWindowText( ::hWnd, ::title ) ENDIF IF !( ::buttonCancel ) @@ -382,7 +385,7 @@ METHOD wndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgFontDialog IF ::aPos[ 1 ] > 0 .OR. ::aPos[ 2 ] > 0 aRect := WVG_GetWindowRect( ::hWnd ) - WVG_MoveWindow( ::hWnd, ::aPos[ 1 ], ::aPos[ 2 ], aRect[3]-aRect[1], aRect[4]-aRect[2], .F. ) + WVG_MoveWindow( ::hWnd, ::aPos[ 1 ], ::aPos[ 2 ], aRect[3] - aRect[1], aRect[4] - aRect[2], .F. ) ENDIF RETURN 1 @@ -398,17 +401,17 @@ METHOD wndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgFontDialog CASE nL == IDOK ::ok := .T. IF HB_ISBLOCK( ::sl_activateOk ) - eval( ::sl_activateOk, ::GetWvgFont(), NIL, Self ) + Eval( ::sl_activateOk, ::GetWvgFont(), NIL, Self ) ENDIF CASE nL == IDCANCEL IF HB_ISBLOCK( ::sl_activateCancel ) - eval( ::sl_activateCancel, NIL, NIL, Self ) + Eval( ::sl_activateCancel, NIL, NIL, Self ) ENDIF CASE nL == 1026 IF HB_ISBLOCK( ::sl_activateApply ) - eval( ::sl_activateApply, ::GetWvgFont(), NIL, Self ) + Eval( ::sl_activateApply, ::GetWvgFont(), NIL, Self ) ENDIF CASE nL == 1038 /* Help */ @@ -422,6 +425,7 @@ METHOD wndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgFontDialog // METHOD display( nMode ) CLASS WvgFontDialog + LOCAL hWnd, aInfo IF nMode == 0 @@ -432,8 +436,8 @@ METHOD display( nMode ) CLASS WvgFontDialog ::ok := .F. aInfo := Wvg_ChooseFont( hWnd, {| h, m, w, l | ::wndProc( h, m, w, l ) }, ::familyName, ; - ::nominalPointSize, ::viewScreenFonts, ::viewPrinterFonts ) - IF !( ::ok ) + ::nominalPointSize, ::viewScreenFonts, ::viewPrinterFonts ) + IF ! ::ok RETURN NIL ENDIF @@ -451,7 +455,9 @@ METHOD destroy() CLASS WvgFontDialog /* * Only callable from ::activateOK and ::activateApply */ + METHOD GetWvgFont( aFont ) CLASS WvgFontDialog + LOCAL oWvgFont DEFAULT aFont TO Wvg_ChooseFont_GetLogFont( ::hWnd ) @@ -467,8 +473,8 @@ METHOD GetWvgFont( aFont ) CLASS WvgFontDialog oWvgFont:underscore := aFont[ 6 ] oWvgFont:strikeOut := aFont[ 7 ] oWvgFont:codePage := aFont[ 8 ] - oWvgFont:setCompoundName( trim( aFont[ 1 ] +" "+ iif( oWvgFont:bold, "Bold ", "" ) + ; - iif( oWvgFont:italic, "Italic", "" ) ) ) + oWvgFont:setCompoundName( Trim( aFont[ 1 ] + " " + iif( oWvgFont:bold, "Bold ", "" ) + ; + iif( oWvgFont:italic, "Italic", "" ) ) ) oWvgFont:create() RETURN oWvgFont @@ -504,7 +510,7 @@ CLASS WvgFont DATA underscore INIT .F. DATA codePage INIT DEFAULT_CHARSET - DATA fixed INIT .F. + DATA FIXED INIT .F. DATA antiAliased INIT .F. DATA compoundName INIT "" @@ -529,7 +535,7 @@ CLASS WvgFont DESTRUCTOR destroy() - ENDCLASS +ENDCLASS // @@ -578,6 +584,7 @@ METHOD destroy() CLASS WvgFont // METHOD list() CLASS WvgFont + LOCAL aList := {} RETURN aList @@ -585,6 +592,7 @@ METHOD list() CLASS WvgFont // METHOD createFont() CLASS WvgFont + LOCAL aFont IF ::hFont != NIL @@ -596,7 +604,7 @@ METHOD createFont() CLASS WvgFont ::height := Wvg_PointSizeToHeight( ::oPS:hdc, ::nominalPointSize ) ENDIF - ::aFontInfo := array( 15 ) + ::aFontInfo := Array( 15 ) ::aFontInfo[ 1 ] := ::familyName ::aFontInfo[ 2 ] := ::height @@ -615,7 +623,7 @@ METHOD createFont() CLASS WvgFont aFont := Wvg_FontCreate( ::aFontInfo ) - IF empty( aFont[ 1 ] ) + IF Empty( aFont[ 1 ] ) RETURN nil ENDIF diff --git a/harbour/contrib/gtwvg/tabpage.prg b/harbour/contrib/gtwvg/tabpage.prg index f6bc574949..7b830aefbf 100644 --- a/harbour/contrib/gtwvg/tabpage.prg +++ b/harbour/contrib/gtwvg/tabpage.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -89,8 +90,8 @@ CLASS WvgTabPage INHERIT WvgWindow DATA minimized INIT .T. /* Determines whether the XbpTabPage is minimized after it is created (the page is not visible). */ DATA postOffset INIT 80 /* Determines the distance between the end of the tab and the end of the page as a percentage of the page width. */ DATA preOffset INIT 0 /* Determines the distance between the start of the tab and the start of the page as a percentage of the page width.*/ - DATA tabHeight INIT -1 /* Determines the height of the tab. */ - DATA type INIT WVGTABPAGE_TAB_TOP /* Determines the position of the tab. */ + DATA tabHeight INIT - 1 /* Determines the height of the tab. */ + DATA TYPE INIT WVGTABPAGE_TAB_TOP /* Determines the position of the tab. */ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) @@ -104,7 +105,7 @@ CLASS WvgTabPage INHERIT WvgWindow DATA sl_tabActivate METHOD tabActivate( xParam ) SETGET - ENDCLASS +ENDCLASS // @@ -157,9 +158,10 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTa // METHOD handleEvent( nMessage, aNM ) CLASS WvgTabPage + LOCAL aHdr - hb_traceLog( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) + hb_traceLog( " %s:handleEvent( %i )", __objGetClsName( self ), nMessage ) DO CASE @@ -180,7 +182,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgTabPage aHdr := Wvg_GetNMHdrInfo( aNM[ 2 ] ) DO CASE - CASE aHdr[ NMH_code ] == -551 /* TCN_SELCHANGE */ + CASE aHdr[ NMH_code ] == - 551 /* TCN_SELCHANGE */ ENDCASE diff --git a/harbour/contrib/gtwvg/tests/activex.prg b/harbour/contrib/gtwvg/tests/activex.prg index 93b189f94b..03472322da 100644 --- a/harbour/contrib/gtwvg/tests/activex.prg +++ b/harbour/contrib/gtwvg/tests/activex.prg @@ -5,6 +5,7 @@ /* * Pritpal Bedi */ + // #include "inkey.ch" @@ -17,10 +18,13 @@ // // The function has to be called via hb_threadStart( {|| ExecuteActiveX( nActiveX ) } ) // + FUNCTION ExecuteActiveX( nActiveX, xParam ) - Local oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 + + LOCAL oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 LOCAL oListBox, oStatic2, oDA LOCAL oPanel, oPanel1, oPanel2 + // LOCAL cVarA := "Test A", cVarB := "Test B" // LOCAL aState := {"not selected", "selected", "undefined"} LOCAL aParts := {} @@ -29,18 +33,18 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) HB_SYMBOL_UNUSED( xParam ) HB_SYMBOL_UNUSED( oCom ) - //--------------------------- Dialog -------------------------------\\ - #if 1 - oCrt := WvgDialog():new( , , { 30,30 }, { 800,600 }, , .T. ) +//--------------------------- Dialog -------------------------------\\ +#if 1 + oCrt := WvgDialog():new( , , { 30, 30 }, { 800, 600 }, , .T. ) oCrt:closable := .T. oCrt:create() - #else - oCrt := WvgCrt():new( , , { 5,5 }, { 30,60 }, , .T. ) +#else + oCrt := WvgCrt():new( , , { 5, 5 }, { 30, 60 }, , .T. ) oCrt:resizeMode := HB_GTI_RESIZEMODE_ROWS oCrt:closable := .T. oCrt:create() SetCursor( .F. ) - #endif +#endif oDA := oCrt:drawingArea @@ -64,53 +68,53 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oStatic := WvgStatic():new( oDA ) oStatic:type := WVGSTATIC_TYPE_TEXT oStatic:options := WVGSTATIC_TEXT_CENTER - oStatic:caption := chr(13)+'Implemented Xbase++ Parts' - oStatic:create( , , { 0, oTBar:currentSize()[2]+3 }, { 120, oCrt:currentSize()[2]-; - oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .T. ) + oStatic:caption := Chr( 13 ) + 'Implemented Xbase++ Parts' + oStatic:create( , , { 0, oTBar:currentSize()[2] + 3 }, { 120, oCrt:currentSize()[2] - ; + oTBar:currentSize()[2] - oSBar:currentSize()[2] - 4 }, , .T. ) oStatic:setColorBG( RGB( 198,198,198 ) ) #if 0 // panel //--------------------------- Static + Radio + Checkbox ----------\\ - oStatic2:= WvgStatic():New( oCrt, , { 150, 150 }, { 500,310 }, , .F. ) - //oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME + oStatic2 := WvgStatic():New( oCrt, , { 150, 150 }, { 500, 310 }, , .F. ) +// oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME oStatic2:exStyle += WS_EX_WINDOWEDGE - //oStatic2:options := WVGSTATIC_FRAMETHICK +// oStatic2:options := WVGSTATIC_FRAMETHICK oStatic2:create() - //oStatic2:setColorBG( RGB( 198,198,198 ) ) +// oStatic2:setColorBG( RGB( 198,198,198 ) ) oXbp := WvgPushButton():new( oStatic2 ) oXbp:caption := "Hide" - oXbp:create( , , { 430,275 }, { 60,25 } ) + oXbp:create( , , { 430, 275 }, { 60, 25 } ) oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } - oRadio := WvgRadioButton():new( oStatic2,, { 10,10 }, { 100,15 } ) + oRadio := WvgRadioButton():new( oStatic2, , { 10, 10 }, { 100, 15 } ) oRadio:caption := "Com 1" oRadio:selection := .T. - oRadio:selected := {| m1, m2, obj | m1:=m1, m2:=m2, WVG_MessageBox( , obj:caption + iif( obj:selection, '< S >', '< N >' ) ) } + oRadio:selected := {| m1, m2, obj | m1 := m1, m2 := m2, WVG_MessageBox( , obj:caption + iif( obj:selection, '< S >', '< N >' ) ) } oRadio:create() - oRadio := WvgRadioButton():new( oStatic2,, { 10,35 }, { 100,15 } ) + oRadio := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } ) oRadio:caption := "Com 2" oRadio:create() - oCheck := WvgCheckBox():New( oStatic2, , { 10,70 }, { 100,15 }, , .T. ) + oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100, 15 }, , .T. ) oCheck:caption := 'Checkbox A' oCheck:create() - oCheck:selected := {| m1, m2, o | m1:=m1,m2:=m2, WVG_MessageBox( , iif( o:getData(), 'I am selected','I am not selected' ) ) } + oCheck:selected := {| m1, m2, o | m1 := m1, m2 := m2, WVG_MessageBox( , iif( o:getData(), 'I am selected','I am not selected' ) ) } // Create first 3State button, passing the position to :create() oXbp := Wvg3State():new( oStatic2 ) oXbp:caption := "3 State A" - oXbp:create( , , { 10,100 }, { 100,15 } ) + oXbp:create( , , { 10, 100 }, { 100, 15 } ) // Determine current state using mp1 - oXbp:selected := {| m1, m2, oBtn | m2:=m2, oBtn:=oBtn, oPanel1:caption := "3State A ["+aState[ m1+1 ]+"]" } + oXbp:selected := {| m1, m2, oBtn | m2 := m2, oBtn := oBtn, oPanel1:caption := "3State A [" + aState[ m1+1 ] + "]" } // Create second 3State Button, passing the position to :new() - oXbp := Wvg3State():new( oStatic2, , { 10,125 }, { 100,15 } ) + oXbp := Wvg3State():new( oStatic2, , { 10, 125 }, { 100, 15 } ) oXbp:caption := "3 State B" oXbp:create( oStatic2 ) // Determine current state using :getData() - oXbp:selected := {| m1, m2, oBtn | m1:=m1,m2:=m2, WVG_MessageBox( , "3State B", aState[ oBtn:getData()+1 ] ) } + oXbp:selected := {| m1, m2, oBtn | m1 := m1, m2 := m2, WVG_MessageBox( , "3State B", aState[ oBtn:getData()+1 ] ) } // Create first SLE, specify position using :create() // On :typeOut set the focus to the second SLE @@ -119,19 +123,19 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oXbp:bufferLength := 20 // Data code block containing assignment to LOCAL variable oXbp:dataLink := {| x | iif( x == NIL, cVarA, cVarA := x ) } - oXbp:create( , , { 10,170 }, { 150,20 } ) + oXbp:create( , , { 10, 170 }, { 150, 20 } ) oXbp:setData() // Assign the value of the edit buffer to a LOCAL variable when the input focus is lost - oXbp:killInputFocus := {| x, y, oSLE | x:=x,y:=y, oSLE:getData(), oPanel:caption := "cVarA =" + cVarA } + oXbp:killInputFocus := {| x, y, oSLE | x := x, y := y, oSLE:getData(), oPanel:caption := "cVarA =" + cVarA } // Create second SLE, specify position using :new() - oXbp := WvgSLE():new( oStatic2, , { 10,200 }, { 150,20 } ) + oXbp := WvgSLE():new( oStatic2, , { 10, 200 }, { 150, 20 } ) oXbp:tabStop := .T. oXbp:bufferLength := 15 oXbp:dataLink := {| x | iif( x == NIL, cVarB, cVarB := x ) } oXbp:create( ) oXbp:setData() - oXbp:killInputFocus := {| x, y, oSLE | x:=x,y:=y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB } + oXbp:killInputFocus := {| x, y, oSLE | x := x, y := y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB } // Read file into LOCAL variable cText := MemoRead( "hbmk.hbm" ) @@ -141,7 +145,7 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oMLE:wordWrap := .F. oMLE:border := .T. oMLE:dataLink := {| x | iif( x == NIL, cText, cText := x ) } - oMLE:create( oStatic2, , { 180,10 }, { 310,250 } ) + oMLE:create( oStatic2, , { 180, 10 }, { 310, 250 } ) // Copy text from LOCAL variable into edit buffer via :dataLink oMLE:setData() #endif @@ -152,36 +156,36 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oListBox:setColorFG( RGB( 218,61,34 ) ) - aadd( aParts, 'XbpDialog' ) - aadd( aParts, 'XbpMenuBar' ) - aadd( aParts, 'XbpToolBar' ) - aadd( aParts, 'XbpStatusBar' ) - aadd( aParts, 'XbpStatic' ) - aadd( aParts, 'XbpTreeView' ) - aadd( aParts, 'XbpActiveX' ) - aadd( aParts, 'XbpListBox' ) - aadd( aParts, 'XbpPushButton' ) - aadd( aParts, 'XbpCheckBox' ) - aadd( aParts, 'XbpRadioButton') - aadd( aParts, 'Xbp3State' ) - aadd( aParts, 'XbpSLE' ) - aadd( aParts, 'XbpMLE' ) - aadd( aParts, 'DataRef' ) + AAdd( aParts, 'XbpDialog' ) + AAdd( aParts, 'XbpMenuBar' ) + AAdd( aParts, 'XbpToolBar' ) + AAdd( aParts, 'XbpStatusBar' ) + AAdd( aParts, 'XbpStatic' ) + AAdd( aParts, 'XbpTreeView' ) + AAdd( aParts, 'XbpActiveX' ) + AAdd( aParts, 'XbpListBox' ) + AAdd( aParts, 'XbpPushButton' ) + AAdd( aParts, 'XbpCheckBox' ) + AAdd( aParts, 'XbpRadioButton' ) + AAdd( aParts, 'Xbp3State' ) + AAdd( aParts, 'XbpSLE' ) + AAdd( aParts, 'XbpMLE' ) + AAdd( aParts, 'DataRef' ) - aeval( aParts, {| e | oListBox:addItem( e ) } ) + AEval( aParts, {| e | oListBox:addItem( e ) } ) oListBox:itemSelected := {|| WVG_MessageBox( , oListBox:getCurItem() ) } oListBox:setData( 3 ) //--------------------------- PushButton --------------------------\\ oXbp := WvgPushButton():new( oStatic ) oXbp:caption := "Hide" - oXbp:create( , , { 20,440 }, {80,30} ) - oXbp:activate:= {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } + oXbp:create( , , { 20, 440 }, { 80, 30 } ) + oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } //--------------------------- TreeView ---------------------------\\ - oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[1]-160,oTBar:currentSize()[2]+3 }, ; - { 160, oCrt:currentSize()[2]-; - oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .T. ) + oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[1] - 160, oTBar:currentSize()[2] + 3 }, ; + { 160, oCrt:currentSize()[2] - ; + oTBar:currentSize()[2] - oSBar:currentSize()[2] - 4 }, , .T. ) oTree:hasLines := .T. oTree:hasButtons := .T. oTree:alwaysShowSelection := .T. @@ -201,47 +205,50 @@ FUNCTION ExecuteActiveX( nActiveX, xParam ) oItem2:addItem( "Third level B" ) oItem2:addItem( "Third level C" ) - #if 0 +#if 0 oItem1:expand( .T. ) - #else - oTree:showExpanded( .T., 2 ) - #endif +#else + oTree:showExpanded( .T. , 2 ) +#endif oTree:setData( oItem2 ) //--------------------------- Misc Config ------------------------\\ - oTBar:buttonClick := {| oBtn | iif( oBtn:caption == 'Hide' , oStatic:hide(), nil ),; - iif( oBtn:caption == 'Show' , oStatic:show(), nil ),; - iif( oBtn:caption == 'Tools', oStatic2:show():toFront(), nil ),; - iif( oBtn:caption $ 'Hide,Show', oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ),; - oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } + oTBar:buttonClick := {| oBtn | iif( oBtn:caption == 'Hide' , oStatic:hide(), NIL ), ; + iif( oBtn:caption == 'Show' , oStatic:show(), NIL ), ; + iif( oBtn:caption == 'Tools', oStatic2:show():toFront(), NIL ), ; + iif( oBtn:caption $ 'Hide,Show', oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ), ; + oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } oDA:resize := {|| ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) } - #if 1 +#if 1 //--------------------------- Active-X ---------------------------\\ oCom := BuildActiveXControl( nActiveX, oDA ) - if HB_ISOBJECT( oCom ) + IF HB_ISOBJECT( oCom ) oCrt:sendMessage( WM_SIZE, 0, 0 ) oCrt:show() ExeActiveX( nActiveX, oCom, xParam ) ENDIF - #else +#else oCrt:show() DO WHILE .T. - IF inkey() == K_ESC + IF Inkey() == K_ESC EXIT ENDIF ENDDO - #endif +#endif oCrt:Destroy() - Return NIL + + RETURN NIL // STATIC FUNCTION ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) + LOCAL aCrt, aTBar, aSBar LOCAL nH, nT + // LOCAL aStatic, aCom, aTree aCrt := oCrt:currentSize() @@ -252,23 +259,24 @@ STATIC FUNCTION ResizeDialog( oCrt, oTBar, oSBar, oStatic, oCom, oTree ) // aCom := oCom:currentSize() nT := aTBar[2] - nH := aCrt[2]-aTBar[2]-aSBar[2] + nH := aCrt[2] - aTBar[2] - aSBar[2] IF oStatic:isVisible - oStatic:setPosAndSize( { 0, nT+3 }, { 120, nH-4 }, .T. ) - oCom:setPosAndSize( { 120, nT }, { aCrt[1]-120-150, nH }, .T. ) - oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .T. ) + oStatic:setPosAndSize( { 0, nT + 3 }, { 120, nH - 4 }, .T. ) + oCom:setPosAndSize( { 120, nT }, { aCrt[1] - 120 - 150, nH }, .T. ) + oTree:setPosAndSize( { aCrt[1] - 150, nT }, { 150, nH }, .T. ) ELSE - oCom:setPosAndSize( { 0, nT }, { aCrt[1]-150, nH }, .T. ) - oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .T. ) + oCom:setPosAndSize( { 0, nT }, { aCrt[1] - 150, nH }, .T. ) + oTree:setPosAndSize( { aCrt[1] - 150, nT }, { 150, nH }, .T. ) ENDIF RETURN 1 // -Static Function ActiveXBuildMenu( oCrt, oStatic, oStatic2 ) - Local oMenuBar, oSubMenu +STATIC FUNCTION ActiveXBuildMenu( oCrt, oStatic, oStatic2 ) + + LOCAL oMenuBar, oSubMenu oMenuBar := WvgMenuBar():new( oCrt ):create() @@ -280,7 +288,7 @@ Static Function ActiveXBuildMenu( oCrt, oStatic, oStatic2 ) oSubMenu:title := "~Procedural" oSubMenu:addItem( { "Play Charge ~1", } ) oSubMenu:addItem( { "Play Nannyboo ~2", } ) - oSubMenu:itemSelected := {| mp1 | MyFunction( 100+mp1 ) } + oSubMenu:itemSelected := {| mp1 | MyFunction( 100 + mp1 ) } oMenuBar:addItem( { oSubMenu, NIL } ) // Define submenu in the functional style: @@ -297,61 +305,62 @@ Static Function ActiveXBuildMenu( oCrt, oStatic, oStatic2 ) oSubMenu := WvgMenu():new( oMenuBar ):create() oSubMenu:title := "F~eatures" oSubMenu:addItem( { "~Hide or Show Left Panel" , {|| iif( oStatic:isVisible, ; - oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE,0,0 ) } } ) + oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE, 0, 0 ) } } ) oSubMenu:addItem( { "~Show My Panel" , {|| oStatic2:show() } } ) oMenuBar:addItem( { oSubMenu, NIL } ) - Return NIL + RETURN NIL // STATIC FUNCTION BuildActiveXControl( nActiveX, oDA ) + LOCAL oCom DEFAULT nActiveX TO 2 oCom := WvgActiveXControl():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) - do case - case nActiveX == 1 - hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'http://harbour.vouch.info'+' ]' ) + DO CASE + CASE nActiveX == 1 + hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2' + ' [ ' + 'http://harbour.vouch.info' + ' ]' ) oCom:CLSID := 'Shell.Explorer.2' oCom:mapEvent( 269, {|| WAPI_OutputDebugString( ' E X P L O R E R - 2 6 9' ) } ) oCom:mapEvent( 105, {|| WAPI_OutputDebugString( ' E X P L O R E R - 105' ) } ) - case nActiveX == 11 - hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'MSHTML Demo'+' ]' ) + CASE nActiveX == 11 + hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2' + ' [ ' + 'MSHTML Demo' + ' ]' ) oCom:CLSID := "MSHTML:" + "

Stream Test

This HTML content is being loaded from a stream." oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) - case nActiveX == 2 - #define evClick 1 - #define evDblClk 2 - #define evBtnDown 3 - #define evMouseMove 4 - #define evBtnUp 5 + CASE nActiveX == 2 +#define evClick 1 +#define evDblClk 2 +#define evBtnDown 3 +#define evMouseMove 4 +#define evBtnUp 5 hb_gtInfo( HB_GTI_WINTITLE, 'AnalogClockControl.AnalogClock' ) oCom:CLSID := 'AnalogClockControl.AnalogClock' oCom:Id := 5 - oCom:mapEvent( evDblClk, {|| oCom:Value := seconds()/86400 ,; - oCom:BackColor := RGB( 0,140,210 ),; - oCom:Refresh() ,; - oCom:ShowSecondsHand := .T. ,; - oCom:Hands3D := .T. ,; - oCom:Refresh() ,; - oCom:showAboutBox() ; - } ) + oCom:mapEvent( evDblClk, {|| oCom:Value := Seconds()/86400 , ; + oCom:BackColor := RGB( 0, 140, 210 ), ; + oCom:Refresh() , ; + oCom:ShowSecondsHand := .T. , ; + oCom:Hands3D := .T. , ; + oCom:Refresh() , ; + oCom:showAboutBox() ; + } ) oCom:mapEvent( evBtnUp, {| nBtn | iif( nBtn == 2, oCom:oParent:sendMessage( WM_CLOSE,0,0 ), NIL ) } ) - case nActiveX == 3 + CASE nActiveX == 3 hb_gtInfo( HB_GTI_WINTITLE, 'file://' + hb_DirBase() + 'myharu.pdf' ) oCom:CLSID := 'file://' + hb_DirBase() + 'myharu.pdf' oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) - case nActiveX == 4 + CASE nActiveX == 4 hb_gtInfo( HB_GTI_WINTITLE, 'RM Chart [ Attributes Next Charts ]' ) oCom:CLSID := 'RMChart.RMChartX' @@ -359,11 +368,11 @@ STATIC FUNCTION BuildActiveXControl( nActiveX, oDA ) // Trying to set it generates GPF. // Please download RMChart.ocx from http://www.rmchart.com/ . It is free in everysense. - case nActiveX == 5 + CASE nActiveX == 5 hb_gtInfo( HB_GTI_WINTITLE, 'Image Viewer' ) oCom:CLSID := 'SCRIBBLE.ScribbleCtrl.1' - endcase + ENDCASE oCom:create() @@ -372,70 +381,71 @@ STATIC FUNCTION BuildActiveXControl( nActiveX, oDA ) // STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) - Local nKey, sData - static nTurn := 0 + LOCAL nKey, sData + + STATIC nTurn := 0 // After :CREATE() Messages // - if nActiveX == 1 - hb_gtInfo( HB_GTI_WINTITLE, iif( empty( xParam ), 'http://hbide.vouch.info', xParam ) ) + IF nActiveX == 1 + hb_gtInfo( HB_GTI_WINTITLE, iif( Empty( xParam ), 'http://hbide.vouch.info', xParam ) ) oCom:AddressBar := .T. - oCom:Navigate( iif( empty( xParam ), 'http://hbide.vouch.info', xParam ) ) + oCom:Navigate( iif( Empty( xParam ), 'http://hbide.vouch.info', xParam ) ) - elseif nActiveX == 4 + ELSEIF nActiveX == 4 ConfigureRMChart( oCom ) oCom:Draw( .T. ) oCom:Draw2Clipboard() - elseif nActiveX == 5 + ELSEIF nActiveX == 5 oCom:loadMultiPage( hb_DirBase() + 'myharu.pdf', 2 ) oCom:addGradientBorder( 10, RGB( 12,20,233 ), RGB( 100,255,20 ), 0 ) - oCom:drawText( 10,10,'Vouch' ) + oCom:drawText( 10, 10, 'Vouch' ) //oCom:emboss( 3,0 ) oCom:copy2ClipBoard() oCom:view := 11 oCom:setBackGroundColor( rgb( 225,225,225 ) ) //oCom:rotate90() - endif + ENDIF - do while .T. - nKey := inkey() + DO WHILE .T. + nKey := Inkey() IF nActiveX == 2 - oCom:Value := seconds()/86400 + oCom:Value := Seconds()/86400 ENDIF - if nKey == K_F12 - if nActiveX == 1 + IF nKey == K_F12 + IF nActiveX == 1 oCom:Navigate( 'www.vouch.info' ) - elseif nActiveX == 11 + ELSEIF nActiveX == 11 //oCom:document( 0 ):InnerHTML := "

Stream Test

This HTML content in a document." - elseif nActiveX == 4 + ELSEIF nActiveX == 4 oCom:RMCBackColor := 23456142 oCom:RMCStyle := 2 oCom:RMCUserWatermark := 'Vouch' - oCom:Region(1):SetProperties( 5.0,5.0,-5.0,-5.0 ) + oCom:Region( 1 ):SetProperties( 5.0, 5.0, -5.0, -5.0 ) oCom:Draw( .T. ) - endif + ENDIF - elseif nKey == K_F11 - if nActiveX == 4 + ELSEIF nKey == K_F11 + IF nActiveX == 4 nTurn++ - if nTurn > 6 + IF nTurn > 6 nTurn := 1 - endif + ENDIF sData := NIL sData := '' - do case - case nTurn == 1 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] ' + 'Stacked Bars' ) + DO CASE + CASE nTurn == 1 + hb_gtInfo( HB_GTI_WINTITLE, 'RMChart [ Next:F11 ] ' + 'Stacked Bars' ) //SetMode( 30,100 ) sData += "00003600|00004450|000051|000061|000073|00008-6972|00009412|00011Tahoma|100011|10" @@ -455,8 +465,8 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) sData += "140033|140045|140055|14006-1|1400925|140131|14014-1|140171|14019-4684277|1402111" sData += "|140221|140236|140535000*9000*12000*6000*10000*5000" - case nTurn == 2 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Floating Bars' ) + CASE nTurn == 2 + hb_gtInfo( HB_GTI_WINTITLE, 'RMChart [ Next:F11 ] ' + 'Floating Bars' ) //SetMode( 20,90 ) sData += "00003550|00004300|000051|000073|00008-2894893|00009412|00011Tahoma|100011|100035" @@ -470,8 +480,8 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) sData += "531*3*4*6*6*4*7*4*9*3*10*3|120011|120026|120044|120101|120132|12019-47872|120211" sData += "1|120221|1202312|120531*.5*1.5*10.5*12*1*12*1*12.5*.5*2*11" - case nTurn == 3 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Four Regions' ) + CASE nTurn == 3 + hb_gtInfo( HB_GTI_WINTITLE, 'RMChart [ Next:F11 ] ' + 'Four Regions' ) //SetMode( 40,120 ) sData += "00003700|00004500|000054|000061|000071|00008-984833|00009412|00011Tahoma|100011|" @@ -503,8 +513,8 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) sData += "171|42019-16744448|4202115|420221|4202310|420261|420538.1*6.2*4.3*2.2*1.2*3.1*5." sData += "2*11.4*7.3*4.2" - case nTurn == 4 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'10 Biggest Companies' ) + CASE nTurn == 4 + hb_gtInfo( HB_GTI_WINTITLE, 'RMChart [ Next:F11 ] ' + '10 Biggest Companies' ) //SetMode( 25,90 ) sData += "00003670|00004450|000051|000061|000071|00008-10185235|00009412|00011Tahoma|10001" @@ -521,8 +531,8 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) sData += "0052|120061|120071|1200970|120111|120121|120131|1201421|120171|12019-16744448|12" sData += "02115|120221|1202310|120261|120538.9*4.1*4.4*2.1*.3*.3*5.9*11.3*6.7*6" - case nTurn == 5 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Grouped Bars' ) + CASE nTurn == 5 + hb_gtInfo( HB_GTI_WINTITLE, 'RMChart [ Next:F11 ] ' + 'Grouped Bars' ) //SetMode( 25,80 ) sData += "00003600|00004450|000051|000061|000075|00008-2|00009412|00010paper.jpg|00011Taho" @@ -534,8 +544,8 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) sData += "0*50*70*60|130011|130022|130044|130131|1302111|130221|130235|1305340*10*30*20*80" sData += "|140011|140022|140044|140131|1402111|140221|140235|1405370*50*80*40*30" - case nTurn == 6 - hb_gtInfo( HB_GTI_WINTITLE,'RMChart [ Next:F11 ] '+'Flow Chart' ) + CASE nTurn == 6 + hb_gtInfo( HB_GTI_WINTITLE, 'RMChart [ Next:F11 ] ' + 'Flow Chart' ) //SetMode( 30,50 ) sData += "00003305|00004400|000051|00008-984833|00009412|00011Tahoma|100011|100035|100045|" @@ -570,35 +580,36 @@ STATIC FUNCTION ExeActiveX( nActiveX, oCom, xParam ) sData += "20|01013100|01015-39322|010191|010209|01026RMChart is not a flowchart tool. This" sData += " is just an example for the use of CustomObjects!|01030-256" - endcase + ENDCASE oCom:Reset() oCom:RMCFile := sData oCom:Draw( .T. ) - endif + ENDIF - endif + ENDIF - if nKey == K_ESC - exit - endif - enddo + IF nKey == K_ESC + EXIT + ENDIF + ENDDO RETURN NIL // STATIC FUNCTION ConfigureRMChart( RMChart ) + LOCAL oRegion LOCAL oCaption LOCAL oChart - #define RMC_CTRLSTYLEFLAT 0 - #define RMC_PIE_GRADIENT 52 - #define RMC_FULL 1 - #define RMC_EXPLODE_NONE 0 - #define RMC_VLABEL_ABSOLUTE 6 - #define RMC_HATCHBRUSH_OFF 0 +#define RMC_CTRLSTYLEFLAT 0 +#define RMC_PIE_GRADIENT 52 +#define RMC_FULL 1 +#define RMC_EXPLODE_NONE 0 +#define RMC_VLABEL_ABSOLUTE 6 +#define RMC_HATCHBRUSH_OFF 0 /* The code pulled from freewin sources */ RMChart:Font := "Tahoma" @@ -634,31 +645,31 @@ STATIC FUNCTION ConfigureRMChart( RMChart ) STATIC FUNCTION MyFunction( nMode ) - #define MUSIC_WAITON {800, 1600} +#define MUSIC_WAITON { 800, 1600 } - do case - case nMode == 1 - tone( MUSIC_WAITON[1], 1 ) - tone( MUSIC_WAITON[2], 1 ) + DO CASE + CASE nMode == 1 + Tone( MUSIC_WAITON[ 1 ], 1 ) + Tone( MUSIC_WAITON[ 2 ], 1 ) - case nMode == 2 - tone( MUSIC_WAITON[2], 1 ) - tone( MUSIC_WAITON[1], 1 ) + CASE nMode == 2 + Tone( MUSIC_WAITON[ 2 ], 1 ) + Tone( MUSIC_WAITON[ 1 ], 1 ) - case nMode == 3 + CASE nMode == 3 WVG_MessageBox( , "Button clicked!" ) - case nMode == 101 // Charge - Eval( {|| tone(523,2),tone(698,2),tone(880,2),tone(1046,4),tone(880,2),tone(1046,8) } ) + CASE nMode == 101 // Charge + Eval( {|| Tone( 523,2 ), Tone( 698,2 ), Tone( 880,2 ), Tone( 1046,4 ), Tone( 880,2 ), Tone( 1046,8 ) } ) - case nMode == 102 // NannyBoo - AEval( {{196,2},{196,2},{164,2},{220,2},{196,4},{164,4}}, {| a | tone( a[ 1 ], a[ 2 ] ) } ) + CASE nMode == 102 // NannyBoo + AEval( { { 196,2 }, { 196,2 }, { 164,2 }, { 220,2 }, { 196,4 }, { 164,4 } }, {| a | Tone( a[ 1 ], a[ 2 ] ) } ) - case nMode == 103 // BADKEY - tone( 480,0.25 ) - tone( 240,0.25 ) + CASE nMode == 103 // BADKEY + Tone( 480, 0.25 ) + Tone( 240, 0.25 ) - endcase + ENDCASE RETURN NIL diff --git a/harbour/contrib/gtwvg/tests/cuigdlgs.prg b/harbour/contrib/gtwvg/tests/cuigdlgs.prg index 72c58ec373..a5326e6c48 100644 --- a/harbour/contrib/gtwvg/tests/cuigdlgs.prg +++ b/harbour/contrib/gtwvg/tests/cuigdlgs.prg @@ -24,24 +24,26 @@ PROCEDURE ExecGCUI() IF hb_mtvm() - Hb_ThreadStart( {| oCrt | oCrt := WvgCrt():New( , , { 2,4 }, { 20,81 }, , .T. ) , ; - oCrt:icon := GetResource( "dia_excl.ico" ),; - oCrt:create(), ; - GCUIConsole( oCrt ) , ; - oCrt:destroy() } ) + hb_threadStart( {| oCrt | oCrt := WvgCrt():New( , , { 2,4 }, { 20,81 }, , .T. ) , ; + oCrt:icon := GetResource( "dia_excl.ico" ), ; + oCrt:create(), ; + GCUIConsole( oCrt ) , ; + oCrt:destroy() } ) ENDIF + RETURN // -#xTranslate Alert( => MyAlert( +#xtranslate Alert( => MyAlert( PROCEDURE GCUIConsole( oCrt ) - LOCAL dDate := date() - LOCAL cName := pad( 'Some Usefule Name' , 35 ) - LOCAL cAdd1 := pad( 'Linda Goldman Avenue', 35 ) - LOCAL cAdd2 := pad( 'Excellent Street' , 35 ) - LOCAL cAdd3 := pad( 'Suit #415' , 35 ) + + LOCAL dDate := Date() + LOCAL cName := Pad( 'Some Usefule Name' , 35 ) + LOCAL cAdd1 := Pad( 'Linda Goldman Avenue', 35 ) + LOCAL cAdd2 := Pad( 'Excellent Street' , 35 ) + LOCAL cAdd3 := Pad( 'Suit #415' , 35 ) LOCAL nSlry := 9000 LOCAL nColGet := 8 LOCAL GetList := {} @@ -53,7 +55,7 @@ PROCEDURE GCUIConsole( oCrt ) CLS hb_gtInfo( HB_GTI_WINTITLE, "WVG Simplified yet Powerful CUI-GUI Console!" ) - @ MaxRow(), 0 SAY PadC( "Navigate the Gets", maxcol()+1 ) COLOR "W+/B" + @ MaxRow(), 0 SAY PadC( "Navigate the Gets", MaxCol() + 1 ) COLOR "W+/B" @ 2, nColGet SAY "< Date >" @ 5, nColGet SAY "<" + PadC( "Name" , 33 ) + ">" @@ -61,45 +63,45 @@ PROCEDURE GCUIConsole( oCrt ) @ 15, nColGet SAY "< Salary >" @ 3, nColGet GET dDate ; - WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 1 ) ) } ; - Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,0 ) ), .T. } + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 1 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,0 ) ), .T. } @ 6, nColGet GET cName ; - WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 2 ) ) } ; - Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,0 ) ), ; - Wvg_SetGObjState( hBoxR, 3 ), .T. } + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 2 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,0 ) ), ; + Wvg_SetGObjState( hBoxR, 3 ), .T. } @ 9, nColGet GET cAdd1 ; - WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 3 ) ) } ; - Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,255 ) ), .T. } + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 3 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,255 ) ), .T. } @ 11, nColGet GET cAdd2 ; - WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 4 ) ) } ; - Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,255 ) ), ; - Wvg_SetGObjState( hBoxR, 1 ), .T. } + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 4 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,255 ) ), ; + Wvg_SetGObjState( hBoxR, 1 ), .T. } @ 13, nColGet GET cAdd3 ; - WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 198,21,140 ) ), .T. } + WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 198,21,140 ) ), .T. } @ 16, nColGet GET nSlry PICTURE "@Z 9999999.99" ; - WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 0,0,0 ) ), .T. } + WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 0,0,0 ) ), .T. } // The only additional calls to render your console GUI // // The GETLIST : This can be embedded via @ GET preprocessor command - aEval( GetList, {| oGet | Wvg_BoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) + AEval( GetList, {| oGet | Wvg_BoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) // - hBoxR := Wvg_BoxRaised( 1,2,18,49, {-5,-5,5,5} ) + hBoxR := Wvg_BoxRaised( 1, 2, 18, 49, { -5, -5, 5, 5 } ) // - Wvg_BoxRecessed( 1,2,18,49 ) + Wvg_BoxRecessed( 1, 2, 18, 49 ) // - // Wvg_BoxGroup( 2,4,17,47 ) + // Wvg_BoxGroup( 2, 4, 17, 47 ) // - Wvg_BoxGroupRaised( 2,4,17,47, {-7,-7,7,7} ) + Wvg_BoxGroupRaised( 2, 4, 17, 47, { -7, -7, 7, 7 } ) // - hTxt := Wvg_TextBox( 3,57,16,75, {10,10,-10,-10}, 'This is first TextBox Line!', 2, 2 ) + hTxt := Wvg_TextBox( 3, 57, 16, 75, { 10, 10, -10, -10 }, 'This is first TextBox Line!', 2, 2 ) // - Wvg_Image( 15,36,16,42, {-3,-3,3,3}, GOBJ_IMAGESOURCE_FILE, GetResource( 'Vouch1.bmp' ) ) - Wvg_BoxRaised( 15,36,16,42,{-2,-2,2,2} ) + Wvg_Image( 15, 36, 16, 42, { -3, -3, 3, 3 }, GOBJ_IMAGESOURCE_FILE, GetResource( 'Vouch1.bmp' ) ) + Wvg_BoxRaised( 15, 36, 16, 42, { -2, -2, 2, 2 } ) // - Wvg_ShadedRect( 1,54,18,79, { -5,-5,5,5 }, 0, {65000,21000,7000,56000}, {255,32255,16000,32500} ) + Wvg_ShadedRect( 1, 54, 18, 79, { -5, -5, 5, 5 }, 0, { 65000, 21000, 7000, 56000 }, { 255, 32255, 16000, 32500 } ) // - Wvg_BoxRaised( 1,54,18,79, {-5,-5,5,5} ) + Wvg_BoxRaised( 1, 54, 18, 79, { -5, -5, 5, 5 } ) // Instruct GT to Repaint the Screen with GUI elements. oCrt:refresh() @@ -107,14 +109,15 @@ PROCEDURE GCUIConsole( oCrt ) // Issue the read READ -// Alert( 'How did you like the "Alert" replacement?', { 'WOW','OK','OOps'} ) - My_Alert( 'How did you like the "Alert" replacement?', { 'WOW','OK','OOps'} ) + // Alert( 'How did you like the "Alert" replacement?', { 'WOW','OK','OOps'} ) + My_Alert( 'How did you like the "Alert" replacement?', { 'WOW', 'OK', 'OOps' } ) RETURN // STATIC FUNCTION FetchText( nMode ) + LOCAL cText DO CASE diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index 0cb9839000..e303ea34b8 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -51,7 +51,7 @@ REQUEST DbfNtx // #ifndef __SQL__ -ANNOUNCE Hb_NoStartUpWindow + ANNOUNCE Hb_NoStartUpWindow #endif // @@ -60,10 +60,10 @@ MEMVAR cCdxExp, First, Last, City // - THREAD STATIC t_wvtScreen := {} +THREAD STATIC t_wvtScreen := {} #ifdef __XCC__ - STATIC s_paint_:= { { "", {} } } +STATIC s_paint_ := { { "", {} } } #endif // @@ -85,9 +85,10 @@ EXIT PROCEDURE CleanHandles() // PROCEDURE Main() + LOCAL aLastPaint, clr, scr, pGT LOCAL hPopup - LOCAL dDate := stod() + LOCAL dDate := SToD() LOCAL cName := Pad( "Pritpal Bedi", 35 ) LOCAL cAdd1 := Pad( "60, New Professor Colony", 35 ) LOCAL cAdd2 := Pad( "Ludhiana, INDIA", 35 ) @@ -107,7 +108,7 @@ PROCEDURE Main() SET DATE ANSI - SET( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT ) + Set( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT ) Wvt_SetGui( .T. ) WvtSetKeys( .T. ) @@ -123,45 +124,45 @@ PROCEDURE Main() oLastMenu:disableItem( 11 ) oLastMenu:checkItem( 1 ) oLastMenu:insItem( 11, { "I am inserted later !", ; - {|| Wvg_MessageBox( , "Hi " + iif( oLastMenu:isItemChecked( 1 ), "Yes", "No" ) + ; - iif( oLastMenu:isItemEnabled( 12 ), " Yes", " No" ) ) } } ) + {|| Wvg_MessageBox( , "Hi " + iif( oLastMenu:isItemChecked( 1 ), "Yes", "No" ) + ; + iif( oLastMenu:isItemEnabled( 12 ), " Yes", " No" ) ) } } ) oLastMenu:setItem( 14, { "This is Set Against Prev Menu", {|| Wvg_MessageBox( , "Hi" ) } } ) - SetMode( maxrow()+1, maxcol()+1 ) /* Needed to accomodate attached menu */ + SetMode( MaxRow() + 1, MaxCol() + 1 ) /* Needed to accomodate attached menu */ SetKey( K_F12 , {|| hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY ) } ) - SetKey( K_CTRL_V , {|| __KeyBoard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } ) - SetKey( K_RBUTTONDOWN, {|| __KeyBoard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } ) + SetKey( K_CTRL_V , {|| __Keyboard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } ) + SetKey( K_RBUTTONDOWN, {|| __Keyboard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } ) hPopup := Wvt_SetPopupMenu() pGT := SetGT( 1, hb_gtSelect() ) /* Force mouse pointer right below the Harbour label */ - Wvt_SetMousePos( 2,40 ) + Wvt_SetMousePos( 2, 40 ) - aAdd( aBlocks, {|| Wvt_SetIcon( GetResource( "vr_1.ico" ) ) } ) - aAdd( aBlocks, {|| Wvt_SetTitle( "Vouch" ) } ) - aAdd( aBlocks, {|| Wvt_DrawLabel( 1,40, cLabel,6,, rgb(255,255,255), rgb(198,198,198), "Arial", 26, , , , , .T., .T. ) } ) - aAdd( aBlocks, {|| Wvt_DrawBoxRaised( nTop, nLft, nBtm, nRgt ) } ) - aAdd( aBlocks, {|| Wvt_DrawBoxRecessed( 7, 61, 13, 70 ) } ) - aAdd( aBlocks, {|| Wvt_DrawBoxGroup( 15, 59, 18, 72 ) } ) - aAdd( aBlocks, {|| Wvt_DrawBoxGroup( 5, 6, 19, 44 ) } ) - aAdd( aBlocks, {|| Wvt_DrawImage( 8,62,12,69, IMAGE_VOUCH ) } ) - aAdd( aBlocks, {|| Wvt_DrawBoxRecessed( 7, 48, 13, 55 ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( maxrow()-2,0,maxrow()-2,maxcol(),WVT_LINE_HORZ,WVT_LINE_RECESSED,WVT_LINE_BOTTOM ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( maxrow()-1,41,maxrow(),41,WVT_LINE_VERT,WVT_LINE_RECESSED,WVT_LINE_CENTER ) } ) - aAdd( aBlocks, {|| aEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) } ) + AAdd( aBlocks, {|| Wvt_SetIcon( GetResource( "vr_1.ico" ) ) } ) + AAdd( aBlocks, {|| Wvt_SetTitle( "Vouch" ) } ) + AAdd( aBlocks, {|| Wvt_DrawLabel( 1,40, cLabel,6,, rgb(255,255,255 ), rgb(198,198,198 ), "Arial", 26, , , , , .T. , .T. ) } ) + AAdd( aBlocks, {|| Wvt_DrawBoxRaised( nTop, nLft, nBtm, nRgt ) } ) + AAdd( aBlocks, {|| Wvt_DrawBoxRecessed( 7, 61, 13, 70 ) } ) + AAdd( aBlocks, {|| Wvt_DrawBoxGroup( 15, 59, 18, 72 ) } ) + AAdd( aBlocks, {|| Wvt_DrawBoxGroup( 5, 6, 19, 44 ) } ) + AAdd( aBlocks, {|| Wvt_DrawImage( 8,62,12,69, IMAGE_VOUCH ) } ) + AAdd( aBlocks, {|| Wvt_DrawBoxRecessed( 7, 48, 13, 55 ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( MaxRow() - 2,0,MaxRow() - 2,MaxCol(),WVT_LINE_HORZ,WVT_LINE_RECESSED,WVT_LINE_BOTTOM ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( MaxRow() - 1,41,MaxRow(),41,WVT_LINE_VERT,WVT_LINE_RECESSED,WVT_LINE_CENTER ) } ) + AAdd( aBlocks, {|| AEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) } ) - aAdd( aBlocks, {|| Wvt_Mouse( -1000001 ) } ) + AAdd( aBlocks, {|| Wvt_Mouse( -1000001 ) } ) aLastPaint := WvtSetBlocks( aBlocks ) /* XBase++ compatible pure GUI controls onto CUI console */ BuildButtons() - scr := SaveScreen( 0,0,maxrow(),maxcol() ) + scr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) clr := SetColor( "N/W" ) CLS SetColor( "N/W,N/GR*,,,N/W*" ) @@ -171,10 +172,10 @@ PROCEDURE Main() @ 12, nColGet SAY "<" + PadC( "Address", 33 ) + ">" @ 16, 61 SAY "< Salary >" - dDate := stod( "20040401" ) + dDate := SToD( "20040401" ) @ 7, nColGet GET dDate WHEN DispStatusMsg( "Date must be valid" ) VALID ClearStatusMsg() - @ 10, nColGet GET cName WHEN DispStatusMsg( "Must be one of the list!" ) VALID ( VouChoice() < 7 .and. ClearStatusMsg() ) + @ 10, nColGet GET cName WHEN DispStatusMsg( "Must be one of the list!" ) VALID ( VouChoice() < 7 .AND. ClearStatusMsg() ) @ 13, nColGet GET cAdd1 @ 15, nColGet GET cAdd2 @ 17, nColGet GET cAdd3 @@ -189,7 +190,7 @@ PROCEDURE Main() WvtSetBlocks( aLastPaint ) WvtSetObjects( aObjects ) SetColor( clr ) - RestScreen( 0,0,maxrow(),maxcol(), scr ) + RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) WvtSetKeys( .F. ) Wvt_SetPopupMenu( hPopup ) @@ -202,10 +203,12 @@ PROCEDURE Main() // -FUNCTION HB_GTSYS() +FUNCTION hb_GTSYS() + REQUEST HB_GT_WVG_DEFAULT REQUEST HB_GT_WVT REQUEST HB_GT_WGU + RETURN NIL // @@ -215,10 +218,10 @@ PROCEDURE WvtConsoleGets( nMode ) DEFAULT nMode TO 0 IF hb_mtvm() - Hb_ThreadStart( {| oCrt | hb_gtReload( 'WVT' ) , ; - oCrt := hb_gtSelect(), ; - iif( nMode == 0, WvtNextGetsConsole(), GoogleMap() ) , ; - oCrt := NIL } ) + hb_threadStart( {| oCrt | hb_gtReload( 'WVT' ) , ; + oCrt := hb_gtSelect(), ; + iif( nMode == 0, WvtNextGetsConsole(), GoogleMap() ) , ; + oCrt := NIL } ) ENDIF RETURN @@ -226,7 +229,8 @@ PROCEDURE WvtConsoleGets( nMode ) // PROCEDURE WvtNextGetsConsole() - LOCAL dDate := stod() + + LOCAL dDate := SToD() LOCAL cName := Space( 35 ) LOCAL cAdd1 := Space( 35 ) LOCAL cAdd2 := Space( 35 ) @@ -235,16 +239,16 @@ PROCEDURE WvtNextGetsConsole() LOCAL nColGet := 8 LOCAL GetList := {} - SetMode( 20,51 ) + SetMode( 20, 51 ) SetColor( "N/W,N/GR*,,,N/W*" ) CLS hb_gtInfo( HB_GTI_WINTITLE, "WVT Console in WVG Application" ) - @ MaxRow(), 0 SAY PadC( "GTWVT in GTWVG Console Gets", maxcol()+1 ) COLOR "W+/B*" + @ MaxRow(), 0 SAY PadC( "GTWVT in GTWVG Console Gets", MaxCol() + 1 ) COLOR "W+/B*" @ 2, nColGet SAY "< Date >" @ 5, nColGet SAY "<" + PadC( "Name", 33 ) + ">" - @ 8, nColGet SAY "<" + PadC( "Address", 33) + ">" + @ 8, nColGet SAY "<" + PadC( "Address", 33 ) + ">" @ 15, nColGet SAY "< Salary >" @ 3, nColGet GET dDate @@ -263,8 +267,8 @@ PROCEDURE WvtNextGetsConsole() PROCEDURE WvtNextGets() IF hb_mtvm() - Hb_ThreadStart( {|| Hb_gtReload( 'WVG' ), Wvt_setFont( 'Terminal',20 ), ; - hb_clear(), Wvt_ShowWindow( SW_RESTORE ), WvtNextGets_X() } ) + hb_threadStart( {|| hb_gtReload( 'WVG' ), Wvt_setFont( 'Terminal',20 ), ; + hb_clear(), Wvt_ShowWindow( SW_RESTORE ), WvtNextGets_X() } ) ELSE WvtNextGets_X() ENDIF @@ -274,8 +278,9 @@ PROCEDURE WvtNextGets() // PROCEDURE WvtNextGets_X() + LOCAL aLastPaint, clr - LOCAL dDate := stod() + LOCAL dDate := SToD() LOCAL cName := Space( 35 ) LOCAL cAdd1 := Space( 35 ) LOCAL cAdd2 := Space( 35 ) @@ -285,12 +290,12 @@ PROCEDURE WvtNextGets_X() LOCAL nColGet := 8 LOCAL GetList := {} LOCAL aPalette := Wvt_GetPalette() - LOCAL aNewPalette:= aclone( aPalette ) + LOCAL aNewPalette := AClone( aPalette ) LOCAL aObjects := WvtSetObjects( {} ) LOCAL nRow := Row() LOCAL nCol := Col() - LOCAL scr := SaveScreen( 0,0,maxrow(),maxcol() ) - LOCAL wvtScr := Wvt_SaveScreen( 0,0,maxrow(),maxcol() ) + LOCAL scr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) + LOCAL wvtScr := Wvt_SaveScreen( 0, 0, MaxRow(), MaxCol() ) STATIC nPalletMultiplier := 0 @@ -301,33 +306,33 @@ PROCEDURE WvtNextGets_X() Wvt_SetPalette( aNewPalette ) - aAdd( aBlocks, {|| Wvt_SetTitle( "Wvt Gets 2nd Window with Different Palette" ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( maxrow()-1,0,maxrow()-1,maxcol() ) } ) - aAdd( aBlocks, {|| Wvt_SetBrush( 0, rgb( 32,255,100 ) ) } ) - aAdd( aBlocks, {|| Wvt_DrawEllipse( 6,50,10,58 ) } ) - aAdd( aBlocks, {|| Wvt_SetBrush( 2, rgb( 255,255,100 ),1 ) } ) - aAdd( aBlocks, {|| Wvt_DrawRectangle( 11, 50, 13, 58 ) } ) - aAdd( aBlocks, {|| Wvt_DrawBoxGroupRaised( 5, 6, 19, 72 ) } ) - aAdd( aBlocks, {|| aEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) } ) + AAdd( aBlocks, {|| Wvt_SetTitle( "Wvt Gets 2nd Window with Different Palette" ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( MaxRow() - 1,0,MaxRow() - 1,MaxCol() ) } ) + AAdd( aBlocks, {|| Wvt_SetBrush( 0, rgb( 32,255,100 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawEllipse( 6,50,10,58 ) } ) + AAdd( aBlocks, {|| Wvt_SetBrush( 2, rgb( 255,255,100 ),1 ) } ) + AAdd( aBlocks, {|| Wvt_DrawRectangle( 11, 50, 13, 58 ) } ) + AAdd( aBlocks, {|| Wvt_DrawBoxGroupRaised( 5, 6, 19, 72 ) } ) + AAdd( aBlocks, {|| AEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) } ) - aAdd( aBlocks, {|| Wvt_DrawButton( 21, 6,22, 9,"New" ,"vouch1.bmp" ) } ) - aAdd( aBlocks, {|| Wvt_DrawButton( 21,11,22,14,"Browse","vouch1.bmp", 1, rgb( 255,255,255 ) ) } ) - aAdd( aBlocks, {|| Wvt_DrawButton( 21,16,22,19, ,"vouch1.bmp" ) } ) - aAdd( aBlocks, {|| Wvt_DrawButton( 21,21,22,24,"Data",, 0, rgb( 100,22,241 ), rgb( 198,198,198 ) ) } ) - aAdd( aBlocks, {|| Wvt_DrawButton( 21,26,22,29,"Flat",IMAGE_VR,2 ) } ) - aAdd( aBlocks, {|| Wvt_DrawButton( 21,31,22,34,"Outline",IMAGE_VR,3 ) } ) - aAdd( aBlocks, {|| Wvt_DrawButton( 22,36,22,41,"Data",, 0, rgb( 100,22,241 ), rgb( 198,198,198 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawButton( 21, 6,22, 9,"New" ,"vouch1.bmp" ) } ) + AAdd( aBlocks, {|| Wvt_DrawButton( 21,11,22,14,"Browse","vouch1.bmp", 1, rgb( 255,255,255 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawButton( 21,16,22,19, ,"vouch1.bmp" ) } ) + AAdd( aBlocks, {|| Wvt_DrawButton( 21,21,22,24,"Data",, 0, rgb( 100,22,241 ), rgb( 198,198,198 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawButton( 21,26,22,29,"Flat",IMAGE_VR,2 ) } ) + AAdd( aBlocks, {|| Wvt_DrawButton( 21,31,22,34,"Outline",IMAGE_VR,3 ) } ) + AAdd( aBlocks, {|| Wvt_DrawButton( 22,36,22,41,"Data",, 0, rgb( 100,22,241 ), rgb( 198,198,198 ) ) } ) aLastPaint := WvtSetBlocks( aBlocks ) clr := SetColor( "N/W,N/GR*,,,N/W*" ) CLS - @ MaxRow(), 0 SAY PadC( "Harbour + WVT Console GUI Screen",80 ) COLOR "R+/W" + @ MaxRow(), 0 SAY PadC( "Harbour + WVT Console GUI Screen", 80 ) COLOR "R+/W" @ 6, nColGet SAY "< Date >" @ 9, nColGet SAY "<" + PadC( "Name", 33 ) + ">" - @ 12, nColGet SAY "<" + PadC( "Address", 33) + ">" + @ 12, nColGet SAY "<" + PadC( "Address", 33 ) + ">" @ 16, 61 SAY "< Salary >" @ 7, nColGet GET dDate @@ -346,15 +351,17 @@ PROCEDURE WvtNextGets_X() WvtSetBlocks( aLastPaint ) SetColor( clr ) - RestScreen( 0, 0,maxrow(), maxcol(), scr ) + RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) Wvt_RestScreen( wvtScr ) SetPos( nRow, nCol ) + RETURN // FUNCTION WvtPartialScreen() - LOCAL scr := SaveScreen( 7,20,15,60 ) + + LOCAL scr := SaveScreen( 7, 20, 15, 60 ) LOCAL wvtScr := Wvt_SaveScreen( 0, 0, MaxRow(), MaxCol() ) LOCAL wvtScr1 LOCAL aLastPaint @@ -363,31 +370,31 @@ FUNCTION WvtPartialScreen() aLastPaint := WvtSetBlocks( {} ) DispBox( 7, 20, 15, 60, " ", "W/GR*" ) - @ 10,25 SAY "Wvt_SaveScreen()" COLOR "N/GR*" - @ 11,25 SAY "Wvt_RestScreen()" COLOR "N/GR*" - @ 13,25 SAY "Press Esc " COLOR "N/GR*" - Wvt_DrawBoxRecessed( 8,22,14,58 ) + @ 10, 25 SAY "Wvt_SaveScreen()" COLOR "N/GR*" + @ 11, 25 SAY "Wvt_RestScreen()" COLOR "N/GR*" + @ 13, 25 SAY "Press Esc " COLOR "N/GR*" + Wvt_DrawBoxRecessed( 8, 22, 14, 58 ) - wvtScr1 := Wvt_SaveScreen( 7,20,15,60 ) + wvtScr1 := Wvt_SaveScreen( 7, 20, 15, 60 ) - DO WHILE inkey( 0 ) != K_ESC + DO WHILE Inkey( 0 ) != K_ESC ENDDO DispBox( 7, 20, 15, 60, " ", "W/B*" ) - @ 10,25 SAY "Wvt_SaveScreen()" COLOR "N/B*" - @ 11,25 SAY "Wvt_RestScreen()" COLOR "N/B*" - @ 13,25 SAY "Press Esc " COLOR "N/B*" - Wvt_DrawBoxRecessed( 8,22,14,58 ) + @ 10, 25 SAY "Wvt_SaveScreen()" COLOR "N/B*" + @ 11, 25 SAY "Wvt_RestScreen()" COLOR "N/B*" + @ 13, 25 SAY "Press Esc " COLOR "N/B*" + Wvt_DrawBoxRecessed( 8, 22, 14, 58 ) - DO WHILE inkey( 0 ) != K_ESC + DO WHILE Inkey( 0 ) != K_ESC ENDDO - Wvt_RestScreen( 7,20,15,60, wvtScr1 ) + Wvt_RestScreen( 7, 20, 15, 60, wvtScr1 ) - DO WHILE inkey( 0 ) != K_ESC + DO WHILE Inkey( 0 ) != K_ESC ENDDO - RestScreen( 7,20,15,60,scr ) + RestScreen( 7, 20, 15, 60, scr ) Wvt_RestScreen( 0, 0, MaxRow(), MaxCol(), wvtScr ) WvtSetBlocks( aLastPaint ) Wvt_SetPopupMenu( hPopup ) @@ -397,10 +404,11 @@ FUNCTION WvtPartialScreen() // FUNCTION WvtLines() - LOCAL scr := SaveScreen( 0,0,maxrow(),maxcol() ) + + LOCAL scr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) LOCAL clr := SetColor( "N/W" ) - LOCAL nRows := maxrow() - LOCAL nCols := maxcol() + LOCAL nRows := MaxRow() + LOCAL nCols := MaxCol() LOCAL aLastPaint := WvtSetBlocks( {} ) LOCAL aObjects := WvtSetObjects( {} ) LOCAL hPopup := Wvt_SetPopupMenu() @@ -408,39 +416,39 @@ FUNCTION WvtLines() CLS - aAdd( aBlocks, {|| Wvt_DrawLine( 0, 0, 0, nCols, WVT_LINE_HORZ, WVT_LINE_RAISED , WVT_LINE_CENTER ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 1, 0, 1, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_TOP ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 2, 0, 2, nCols, WVT_LINE_HORZ, WVT_LINE_PLAIN , WVT_LINE_CENTER, WVT_LINE_SOLID, 4, Rgb( 255,255,255 ) ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 3, 0, 3, nCols, WVT_LINE_HORZ, WVT_LINE_RAISED , WVT_LINE_CENTER, WVT_LINE_DASH , 0, Rgb( 255,0,0 ) ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 4, 0, 4, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 0, 0, 0, nCols, WVT_LINE_HORZ, WVT_LINE_RAISED , WVT_LINE_CENTER ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 1, 0, 1, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_TOP ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 2, 0, 2, nCols, WVT_LINE_HORZ, WVT_LINE_PLAIN , WVT_LINE_CENTER, WVT_LINE_SOLID, 4, Rgb( 255,255,255 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 3, 0, 3, nCols, WVT_LINE_HORZ, WVT_LINE_RAISED , WVT_LINE_CENTER, WVT_LINE_DASH , 0, Rgb( 255,0,0 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 4, 0, 4, nCols, WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } ) @ 0, 1 SAY "Center Raised" - @ 1,11 say "Top Recessed" - @ 2,21 say "Center Plain White 3 Pixels" - @ 3,31 say "Center Raised Dotted" - @ 4,41 SAY "Bottom Recessed" + @ 1, 11 SAY "Top Recessed" + @ 2, 21 SAY "Center Plain White 3 Pixels" + @ 3, 31 SAY "Center Raised Dotted" + @ 4, 41 SAY "Bottom Recessed" @ 5, 1 SAY "Bottom Checked" - @ nRows, 0 Say PadC( "Press ESC to Quit", nCols+1 ) COLOR "GR+/W" + @ nRows, 0 SAY PadC( "Press ESC to Quit", nCols + 1 ) COLOR "GR+/W" - aAdd( aBlocks, {|| Wvt_DrawLine( 11, 5,nRows-2, 5, WVT_LINE_VERT, WVT_LINE_RAISED , WVT_LINE_CENTER ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 11, 6,nRows-2, 6, WVT_LINE_VERT, WVT_LINE_RECESSED, WVT_LINE_CENTER ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 11, 7,nRows-2, 7, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_LEFT ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 11, 8,nRows-2, 8, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_CENTER ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 11, 9,nRows-2, 9, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_RIGHT ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 11,10,nRows-2,10, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_CENTER, WVT_LINE_DOT, 0, RGB( 0,0,255 ) ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 11,11,nRows-2,11, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_CENTER, WVT_LINE_DASH, 0, RGB( 255,0,0 ) ) } ) - aAdd( aBlocks, {|| Wvt_DrawLine( 11,12,nRows-2,12, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_CENTER, WVT_LINE_DASHDOT, 0, RGB( 0,255,0 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 11, 5,nRows - 2, 5, WVT_LINE_VERT, WVT_LINE_RAISED , WVT_LINE_CENTER ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 11, 6,nRows - 2, 6, WVT_LINE_VERT, WVT_LINE_RECESSED, WVT_LINE_CENTER ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 11, 7,nRows - 2, 7, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_LEFT ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 11, 8,nRows - 2, 8, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_CENTER ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 11, 9,nRows - 2, 9, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_RIGHT ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 11,10,nRows - 2,10, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_CENTER, WVT_LINE_DOT, 0, RGB( 0,0,255 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 11,11,nRows - 2,11, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_CENTER, WVT_LINE_DASH, 0, RGB( 255,0,0 ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawLine( 11,12,nRows - 2,12, WVT_LINE_VERT, WVT_LINE_PLAIN , WVT_LINE_CENTER, WVT_LINE_DASHDOT, 0, RGB( 0,255,0 ) ) } ) WvtSetBlocks( aBlocks ) - @ 12,5 Say "A" - @ 13,6 Say "B" - @ 14,7 Say "C" - @ 15,8 Say "D" - @ 16,9 Say "E" + @ 12, 5 SAY "A" + @ 13, 6 SAY "B" + @ 14, 7 SAY "C" + @ 15, 8 SAY "D" + @ 16, 9 SAY "E" - DO WHILE ( inkey(0) != K_ESC ) + DO WHILE ( Inkey( 0 ) != K_ESC ) ENDDO // Restore Environments @@ -451,84 +459,85 @@ FUNCTION WvtLines() WvtSetObjects( aObjects ) Wvt_SetPopupMenu( hPopup ) - RestScreen( 0,0,maxrow(),maxcol(), scr ) + RestScreen( 0, 0, MaxRow(), MaxCol(), scr ) RETURN NIL // FUNCTION BuildMainMenu() + LOCAL oMenu LOCAL g_oMenuBar := WvgSetAppWindow():menuBar() oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() - oMenu:Caption:= "Wvt*Classes" + oMenu:Caption := "Wvt*Classes" oMenu:AddItem( "Dialog One . New Window . Threaded" , {|| DialogWvgClassesOne( 1 ) } ) oMenu:AddItem( "Dialog One . Main Window . Primary Thread", {|| DialogWvgClassesOne( 2 ) } ) oMenu:AddItem( "-" ) oMenu:AddItem( "Dialog Two" , {|| DialogWvgClassesTwo() } ) oMenu:AddItem( "-" ) - oMenu:AddItem( "Exit" , {|| __keyboard( K_ESC ) } ) + oMenu:AddItem( "Exit" , {|| __Keyboard( K_ESC ) } ) g_oMenuBar:addItem( { oMenu, "Wvt*Classes" } ) oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() oMenu:caption := "Traditional" oMenu:AddItem( "Gets . GTWVG . Threaded" , {|| WvtNextGets() } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Gets . GTWVT . Threaded" , {|| WvtConsoleGets( 0 ) } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Browser . GTWVG . Threaded " , {|| WvtMyBrowse() } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Partial Screen . Main Window", {|| WvtPartialScreen() } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Wvt Lines . Main Window" , {|| WvtLines() } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Google Maps" , {|| WvtConsoleGets( 1 ) } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Wvg Console with GCUI" , {|| ExecGCUI() } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Modal Window" , {|| DoModalWindow() } ) g_oMenuBar:addItem( { oMenu, "Traditional" } ) oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() - oMenu:Caption:= "Common Dialogs" + oMenu:Caption := "Common Dialogs" oMenu:AddItem( "Fonts" , {|| Wvt_ChooseFont() } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Colors" , {|| Wvt_ChooseColor() } ) g_oMenuBar:addItem( { oMenu, "Common Dialogs" } ) oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() - oMenu:Caption:= "Functionality" + oMenu:Caption := "Functionality" oMenu:AddItem( "Expand" , {|| WvtWindowExpand( 1 ) } ) oMenu:AddItem( "Shrink" , {|| WvtWindowExpand( -1 ) } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Minimize" , {|| Wvt_Minimize() } ) oMenu:AddItem( "Maximize" , {|| hb_gtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) } ) g_oMenuBar:addItem( { oMenu, "Functionality" } ) oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() - oMenu:Caption:= "Modeless Dialogs" + oMenu:Caption := "Modeless Dialogs" oMenu:AddItem( "Dynamic Dialog . Modeless" , {|| DynWinDialog( 1 ) } ) oMenu:AddItem( "Dynamic Dialog . Modal " , {|| DynWinDialog( 2 ) } ) - oMenu:AddItem( "-") + oMenu:AddItem( "-" ) oMenu:AddItem( "Slide Show . Modeless" , {|| DlgSlideShow() } ) g_oMenuBar:addItem( { oMenu, "Modeless Dialogs" } ) oMenu := WvgMenu():new( g_oMenuBar, , .T. ):create() oMenu:Caption := "~XbpDialog()s" - oMenu:AddItem( "Pure Xbase++" , {|| Hb_ThreadStart( {|| demoXbp() } ) } ) - oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - Internet Explorer" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 1 ) } ) } ) - oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - Visualize a PDF" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 3 ) } ) } ) - oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - Explorer . DHTML" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 11 ) } ) } ) - oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - RMChart" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 4 ) } ) } ) - oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - Analog Clock" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 2 ) } ) } ) - oMenu:AddItem( "-") - oMenu:AddItem( "ActiveX - Image Viewer" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 5 ) } ) } ) + oMenu:AddItem( "Pure Xbase++" , {|| hb_threadStart( {|| demoXbp() } ) } ) + oMenu:AddItem( "-" ) + oMenu:AddItem( "ActiveX - Internet Explorer" , {|| hb_threadStart( {|| ExecuteActiveX( 1 ) } ) } ) + oMenu:AddItem( "-" ) + oMenu:AddItem( "ActiveX - Visualize a PDF" , {|| hb_threadStart( {|| ExecuteActiveX( 3 ) } ) } ) + oMenu:AddItem( "-" ) + oMenu:AddItem( "ActiveX - Explorer . DHTML" , {|| hb_threadStart( {|| ExecuteActiveX( 11 ) } ) } ) + oMenu:AddItem( "-" ) + oMenu:AddItem( "ActiveX - RMChart" , {|| hb_threadStart( {|| ExecuteActiveX( 4 ) } ) } ) + oMenu:AddItem( "-" ) + oMenu:AddItem( "ActiveX - Analog Clock" , {|| hb_threadStart( {|| ExecuteActiveX( 2 ) } ) } ) + oMenu:AddItem( "-" ) + oMenu:AddItem( "ActiveX - Image Viewer" , {|| hb_threadStart( {|| ExecuteActiveX( 5 ) } ) } ) g_oMenuBar:addItem( { oMenu, "~XbpDialog()s" } ) RETURN oMenu /* The last submenu item */ @@ -536,40 +545,41 @@ FUNCTION BuildMainMenu() // STATIC FUNCTION GoogleMap() + LOCAL mfrom1, mto1, mfrom2, mto2, mfrom3, mto3, mweb - LOCAL nCursor := setcursor() + LOCAL nCursor := SetCursor() LOCAL getlist := {} - SetMode( 22,65 ) - setcolor( 'N/W,N/GR*,,,N/W*' ) + SetMode( 22, 65 ) + SetColor( 'N/W,N/GR*,,,N/W*' ) cls hb_gtInfo( HB_GTI_WINTITLE, 'Google Maps' ) - mfrom1 := mto1 := space(20) - mfrom2 := mto2 := space(40) - mfrom3 := mto3 := space(50) + mfrom1 := mto1 := Space( 20 ) + mfrom2 := mto2 := Space( 40 ) + mfrom3 := mto3 := Space( 50 ) WHILE .T. - @ 05, 01 say "FROM :" - @ 07, 01 say "State ...:" get mfrom1 picture "@!" - @ 08, 01 say "City ....:" get mfrom2 picture "@!" - @ 09, 01 say "Street ..:" get mfrom3 picture "@!" - @ 11, 01 say "TO :" - @ 13, 01 say "State ...:" get mto1 picture "@!" - @ 14, 01 say "City ....:" get mto2 picture "@!" - @ 15, 01 say "Street ..:" get mto3 picture "@!" + @ 05, 01 SAY "FROM :" + @ 07, 01 SAY "State ...:" GET mfrom1 PICTURE "@!" + @ 08, 01 SAY "City ....:" GET mfrom2 PICTURE "@!" + @ 09, 01 SAY "Street ..:" GET mfrom3 PICTURE "@!" + @ 11, 01 SAY "TO :" + @ 13, 01 SAY "State ...:" GET mto1 PICTURE "@!" + @ 14, 01 SAY "City ....:" GET mto2 PICTURE "@!" + @ 15, 01 SAY "Street ..:" GET mto3 PICTURE "@!" - setcursor(1); read; setcursor(nCursor) + SetCursor( 1 ); read; SetCursor( nCursor ) - IF lastkey() == K_ESC + IF LastKey() == K_ESC EXIT ENDIF - mweb := "http://maps.google.com/maps?q=from " +; - alltrim( mfrom3 ) +" "+ alltrim( mfrom2 ) +" "+ alltrim( mfrom1 ) + " to " +; - alltrim( mto3 ) +" "+ alltrim( mto2 ) +" "+ alltrim( mto1 ) + mweb := "http://maps.google.com/maps?q=from " + ; + AllTrim( mfrom3 ) + " " + AllTrim( mfrom2 ) + " " + AllTrim( mfrom1 ) + " to " + ; + AllTrim( mto3 ) + " " + AllTrim( mto2 ) + " " + AllTrim( mto1 ) - Hb_ThreadStart( {|| ExecuteActiveX( 1, mweb ) } ) + hb_threadStart( {|| ExecuteActiveX( 1, mweb ) } ) ENDDO RETURN NIL @@ -577,53 +587,54 @@ STATIC FUNCTION GoogleMap() // FUNCTION BuildButtons() + LOCAL oXbp oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := "Hi" - oXbp:create( , , { {|| -( maxrow()-1 ) }, -1 }, { -2, -4 } ) + oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -1 }, { -2, -4 } ) oXbp:activate := {|| Wvg_MessageBox( , "Harbour!" ) } oXbp:toolTipText := "Harbour CUI/GUI Console" oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_VOUCH - oXbp:create( , , { {|| -( maxrow()-1 ) }, -6 }, { -2, -4 } ) + oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -6 }, { -2, -4 } ) oXbp:activate := {|| Wvt_Keyboard( K_F2 ) } oXbp:toolTipText := "Open Another GET Screen" oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_BROWSE - oXbp:create( , , { {|| -( maxrow()-1 ) }, -11 }, { -2, -4 } ) + oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -11 }, { -2, -4 } ) oXbp:activate := {|| Wvt_Keyboard( K_F5 ) } oXbp:toolTipText := "TBrowse + GUI Controls" oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_NOTES - oXbp:create( , , { {|| -( maxrow()-1 ) }, -16 }, { -2, -4 } ) + oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -16 }, { -2, -4 } ) oXbp:activate := {|| Wvt_Keyboard( K_F3 ) } oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_TOOLS - oXbp:create( , , { {|| -( maxrow()-1 ) }, -21 }, { -2, -4 } ) + oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -21 }, { -2, -4 } ) oXbp:activate := {|| Wvt_Keyboard( K_F6 ) } oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_HELP - oXbp:create( , , { {|| -( maxrow()-1 ) }, -26 }, { -2, -4 } ) + oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -26 }, { -2, -4 } ) oXbp:activate := {|| Wvt_Keyboard( K_F7 ) } oXbp := WvgPushButton():new() oXbp:pointerFocus := .F. oXbp:caption := IMAGE_VR oXbp:border := .F. - oXbp:create( , , { {|| -( maxrow()-1 ) }, -31 }, { -2, -4 } ) - oXbp:activate := {|| Hb_ThreadStart( {|| demoXbp() } ) } // {|| Wvt_Keyboard( K_F8 ) } + oXbp:create( , , { {|| -( MaxRow() - 1 ) }, -31 }, { -2, -4 } ) + oXbp:activate := {|| hb_threadStart( {|| demoXbp() } ) } // {|| Wvt_Keyboard( K_F8 ) } oXbp:toolTipText := "Flat Button . Lines: press ESC when finished." RETURN NIL diff --git a/harbour/contrib/gtwvg/tests/demowvg1.prg b/harbour/contrib/gtwvg/tests/demowvg1.prg index 19ce80a250..8ca3e3aaeb 100644 --- a/harbour/contrib/gtwvg/tests/demowvg1.prg +++ b/harbour/contrib/gtwvg/tests/demowvg1.prg @@ -33,10 +33,11 @@ MEMVAR GetList // PROCEDURE Main() + LOCAL aPaint SET DATE ANSI - SET( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT ) + Set( _SET_EVENTMASK, INKEY_ALL + HB_INKEY_GTEVENT ) Wvt_SetGui( .T. ) Wvt_SetFont( "Courier New", 18, 0, 0 ) @@ -46,21 +47,21 @@ PROCEDURE Main() CLS Wvt_ShowWindow( SW_RESTORE ) Wvt_SetTitle( "Harbour's GTWVG Demo ( Simplified )" ) - Wvt_SetIcon( hb_dirBase() + "vr_1.ico" ) + Wvt_SetIcon( hb_DirBase() + "vr_1.ico" ) SetGT( 1, hb_gtSelect() ) aPaint := {} - aAdd( aPaint, { "Label" , {|| Wvt_DrawLabel( 1, 40, "Harbour Console GUI Demo", 6, , rgb( 255,255,255 ), rgb( 198,198,198 ), "Arial", 26, , , , , .T., .T. ) } , { WVT_BLOCK_LABEL, 1, 10, 3, 50 } } ) - aAdd( aPaint, { "Box_1" , {|| Wvt_DrawBoxRaised( 4, 4, 20, 75 ) } , { WVT_BLOCK_BOX , 4, 4, 20, 75 } } ) - aAdd( aPaint, { "Box_2" , {|| Wvt_DrawBoxRecessed( 7, 61, 13, 70 ) } , { WVT_BLOCK_BOX , 7, 61, 13, 70 } } ) - aAdd( aPaint, { "Box_3" , {|| Wvt_DrawBoxGroup( 15, 59, 18, 72 ) } , { WVT_BLOCK_BOX , 15, 59, 18, 72 } } ) - aAdd( aPaint, { "Box_4" , {|| Wvt_DrawBoxGroup( 5, 6, 19, 44 ) } , { WVT_BLOCK_BOX , 5, 6, 19, 44 } } ) - aAdd( aPaint, { "Image" , {|| Wvt_DrawImage( 8,62,12,69, IMAGE_VOUCH ) } , { WVT_BLOCK_IMAGE, 8, 62, 12, 69 } } ) - aAdd( aPaint, { "Box_5" , {|| Wvt_DrawBoxRecessed( 7, 48, 13, 55 ) } , { WVT_BLOCK_BOX , 7, 48, 13, 55 } } ) - aAdd( aPaint, { "Line_1", {|| Wvt_DrawLine( maxrow()-2, 0, maxrow()-2, maxcol(), WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } , NIL } ) - aAdd( aPaint, { "Gets" , {|| aEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) }, NIL } ) + AAdd( aPaint, { "Label" , {|| Wvt_DrawLabel( 1, 40, "Harbour Console GUI Demo", 6, , rgb( 255,255,255 ), rgb( 198,198,198 ), "Arial", 26, , , , , .T. , .T. ) } , { WVT_BLOCK_LABEL, 1, 10, 3, 50 } } ) + AAdd( aPaint, { "Box_1" , {|| Wvt_DrawBoxRaised( 4, 4, 20, 75 ) } , { WVT_BLOCK_BOX , 4, 4, 20, 75 } } ) + AAdd( aPaint, { "Box_2" , {|| Wvt_DrawBoxRecessed( 7, 61, 13, 70 ) } , { WVT_BLOCK_BOX , 7, 61, 13, 70 } } ) + AAdd( aPaint, { "Box_3" , {|| Wvt_DrawBoxGroup( 15, 59, 18, 72 ) } , { WVT_BLOCK_BOX , 15, 59, 18, 72 } } ) + AAdd( aPaint, { "Box_4" , {|| Wvt_DrawBoxGroup( 5, 6, 19, 44 ) } , { WVT_BLOCK_BOX , 5, 6, 19, 44 } } ) + AAdd( aPaint, { "Image" , {|| Wvt_DrawImage( 8,62,12,69, IMAGE_VOUCH ) } , { WVT_BLOCK_IMAGE, 8, 62, 12, 69 } } ) + AAdd( aPaint, { "Box_5" , {|| Wvt_DrawBoxRecessed( 7, 48, 13, 55 ) } , { WVT_BLOCK_BOX , 7, 48, 13, 55 } } ) + AAdd( aPaint, { "Line_1", {|| Wvt_DrawLine( MaxRow() - 2, 0, MaxRow() - 2, MaxCol(), WVT_LINE_HORZ, WVT_LINE_RECESSED, WVT_LINE_BOTTOM ) } , NIL } ) + AAdd( aPaint, { "Gets" , {|| AEval( GetList, {| oGet | Wvt_DrawBoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) }, NIL } ) ExecForm( aPaint ) @@ -70,15 +71,18 @@ PROCEDURE Main() /* This function must be linked with the application */ FUNCTION Wvt_Paint() + WvtPaintObjects() + RETURN NIL // STATIC FUNCTION ExecForm( aPaint ) + LOCAL cColor := SetColor() LOCAL aPnt - LOCAL dDate := date() + LOCAL dDate := Date() LOCAL cName := Pad( "Pritpal Bedi", 35 ) LOCAL cAdd1 := Pad( "60, New Professor Colony", 35 ) LOCAL cAdd2 := Pad( "Ludhiana, INDIA", 35 ) @@ -115,31 +119,39 @@ STATIC FUNCTION ExecForm( aPaint ) // -FUNCTION HB_GTSYS() - REQUEST HB_GT_WVG_DEFAULT - REQUEST HB_GT_WVT - REQUEST HB_GT_WGU +FUNCTION hb_GTSYS() + +REQUEST HB_GT_WVG_DEFAULT + +REQUEST HB_GT_WVT + +REQUEST HB_GT_WGU + RETURN NIL // FUNCTION SetGT( nIndex, pGT ) + LOCAL oldGT - STATIC pGT_:= { NIL, NIL, NIL } + STATIC pGT_ := { NIL, NIL, NIL } + oldGT := pGT_[ nIndex ] IF PCount() == 2 pGT_[ nIndex ] := pGT ENDIF + RETURN oldGT // STATIC FUNCTION MyChoice( aChoices ) + LOCAL scr, clr, nChoice - DEFAULT aChoices TO { "One","Two","Three","Four","Five","Six","Seven" } + DEFAULT aChoices TO { "One", "Two", "Three", "Four", "Five", "Six", "Seven" } - scr := SaveScreen( 7,48,13,55 ) + scr := SaveScreen( 7, 48, 13, 55 ) clr := SetColor( "N/W*,GR+/B*,,,GR+/B" ) nChoice := AChoice( 7, 48, 13, 55, aChoices ) @@ -151,7 +163,8 @@ STATIC FUNCTION MyChoice( aChoices ) // -FUNCTION rgb( r,g,b ) +FUNCTION rgb( r, g, b ) + RETURN r + ( g * 256 ) + ( b * 256 * 256 ) // @@ -169,10 +182,11 @@ FUNCTION DispStatusMsg( cMsg ) // FUNCTION ClearStatusMsg() + LOCAL nRow := Row() LOCAL nCol := Col() - DispOutAt( MaxRow(), 42, space( 37 ), "W/W" ) + DispOutAt( MaxRow(), 42, Space( 37 ), "W/W" ) SetPos( nRow, nCol ) RETURN .T. @@ -180,22 +194,23 @@ FUNCTION ClearStatusMsg() // FUNCTION DoModalDialog() + LOCAL oCrt, nSel LOCAL aPnt := WvtSetPaint( {} ) LOCAL aPaint := {} - oCrt := WvgCrt():New( , , { 4,8 }, { 12,49 }, , .T. ) + oCrt := WvgCrt():New( , , { 4, 8 }, { 12, 49 }, , .T. ) oCrt:lModal := .T. oCrt:resizable := .F. oCrt:closable := .F. oCrt:title := 'Modal Dialog!' - oCrt:icon := hb_dirBase() + "vr_1.ico" + oCrt:icon := hb_DirBase() + "vr_1.ico" oCrt:Create() oCrt:show() - aAdd( aPaint, { "Box_V" , {|| Wvt_DrawBoxRaised( 1, 2, 11, 47 ) }, NIL, { WVT_BLOCK_BOX, 0, 0, MaxRow(), MaxCol() } } ) + AAdd( aPaint, { "Box_V" , {|| Wvt_DrawBoxRaised( 1, 2, 11, 47 ) }, NIL, { WVT_BLOCK_BOX, 0, 0, MaxRow(), MaxCol() } } ) WvtSetPaint( aPaint ) SetColor( 'N/W' ) @@ -210,6 +225,7 @@ FUNCTION DoModalDialog() oCrt:Destroy() WvtSetPaint( aPnt ) - Return NIL + + RETURN NIL // diff --git a/harbour/contrib/gtwvg/tests/demoxbp.prg b/harbour/contrib/gtwvg/tests/demoxbp.prg index 0f839bb0b2..f9a000c89d 100644 --- a/harbour/contrib/gtwvg/tests/demoxbp.prg +++ b/harbour/contrib/gtwvg/tests/demoxbp.prg @@ -28,15 +28,16 @@ // PROCEDURE Main() - Local oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 + + LOCAL oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 LOCAL oListBox, oCheck, oRadio, oStatic2, oMLE, oAddr LOCAL oPanel, oPanel1, oPanel2, cText, cNavigate, oDA LOCAL cVarA := "Test A", cVarB := "Test B" - LOCAL aState := {"not selected", "selected", "undefined"} + LOCAL aState := { "not selected", "selected", "undefined" } LOCAL aParts := {} //--------------------------- Dialog -------------------------------\\ - oCrt := WvgDialog():new( , , { 30,30 }, { 900,600 }, , .T. ) + oCrt := WvgDialog():new( , , { 30, 30 }, { 900, 600 }, , .T. ) oCrt:closable := .T. oCrt:icon := "vr_1.ico" oCrt:create() @@ -65,10 +66,10 @@ PROCEDURE Main() oStatic := WvgStatic():new( oDA ) oStatic:type := WVGSTATIC_TYPE_TEXT oStatic:options := WVGSTATIC_TEXT_CENTER - oStatic:caption := chr(13)+'Implemented Xbase++ Parts' + oStatic:caption := Chr( 13 ) + 'Implemented Xbase++ Parts' - oStatic:create( , , { 0, oTBar:currentSize()[2]+3 }, { 120, oCrt:currentSize()[2]-; - oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .T. ) + oStatic:create( , , { 0, oTBar:currentSize()[2] + 3 }, { 120, oCrt:currentSize()[2] - ; + oTBar:currentSize()[2] - oSBar:currentSize()[2] - 4 }, , .T. ) oStatic:setColorBG( RGB( 200,200,200 ) ) //--------------------------- ListBox -----------------------------\\ @@ -76,46 +77,46 @@ PROCEDURE Main() oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } ) oListBox:setColorFG( RGB( 218,61,34 ) ) - //oListBox:setColorBG( RGB( 250,244,182 ) ) +// oListBox:setColorBG( RGB( 250,244,182 ) ) - aadd( aParts, 'XbpDialog' ) - aadd( aParts, 'XbpMenuBar' ) - aadd( aParts, 'XbpToolBar' ) - aadd( aParts, 'XbpToolBarButton' ) - aadd( aParts, 'XbpStatusBar' ) - aadd( aParts, 'XbpStatic' ) - aadd( aParts, 'XbpTreeView' ) - aadd( aParts, 'XbpTreeViewItem' ) - aadd( aParts, 'XbpActiveXControl') - aadd( aParts, 'XbpListBox' ) - aadd( aParts, 'XbpPushButton' ) - aadd( aParts, 'XbpCheckBox' ) - aadd( aParts, 'XbpRadioButton' ) - aadd( aParts, 'Xbp3State' ) - aadd( aParts, 'XbpSLE' ) - aadd( aParts, 'XbpMLE' ) - aadd( aParts, 'XbpHTMLViewer' ) - aadd( aParts, 'XbpSysWindow' ) - aadd( aParts, 'XbpFontDialog' ) - aadd( aParts, 'XbpFont' ) - aadd( aParts, '-------------' ) - aadd( aParts, 'DataRef' ) + AAdd( aParts, 'XbpDialog' ) + AAdd( aParts, 'XbpMenuBar' ) + AAdd( aParts, 'XbpToolBar' ) + AAdd( aParts, 'XbpToolBarButton' ) + AAdd( aParts, 'XbpStatusBar' ) + AAdd( aParts, 'XbpStatic' ) + AAdd( aParts, 'XbpTreeView' ) + AAdd( aParts, 'XbpTreeViewItem' ) + AAdd( aParts, 'XbpActiveXControl' ) + AAdd( aParts, 'XbpListBox' ) + AAdd( aParts, 'XbpPushButton' ) + AAdd( aParts, 'XbpCheckBox' ) + AAdd( aParts, 'XbpRadioButton' ) + AAdd( aParts, 'Xbp3State' ) + AAdd( aParts, 'XbpSLE' ) + AAdd( aParts, 'XbpMLE' ) + AAdd( aParts, 'XbpHTMLViewer' ) + AAdd( aParts, 'XbpSysWindow' ) + AAdd( aParts, 'XbpFontDialog' ) + AAdd( aParts, 'XbpFont' ) + AAdd( aParts, '-------------' ) + AAdd( aParts, 'DataRef' ) - aeval( aParts, {| e | oListBox:addItem( e ) } ) + AEval( aParts, {| e | oListBox:addItem( e ) } ) oListBox:itemSelected := {|| WVG_MessageBox( , oListBox:getCurItem() ) } oListBox:setData( 3 ) // show selected 'XbpToolBar' //--------------------------- PushButton --------------------------\\ oXbp := WvgPushButton():new( oStatic ) oXbp:caption := "Hide" - oXbp:create( , , { 20,440 }, {80,30} ) - oXbp:activate:= {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } + oXbp:create( , , { 20, 440 }, { 80, 30 } ) + oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } //--------------------------- TreeView ---------------------------\\ - oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[1]-160,oTBar:currentSize()[2]+3 }, ; - { 160, oCrt:currentSize()[2]-; - oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .T. ) + oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[1] - 160, oTBar:currentSize()[2] + 3 }, ; + { 160, oCrt:currentSize()[2] - ; + oTBar:currentSize()[2] - oSBar:currentSize()[2] - 4 }, , .T. ) oTree:hasLines := .T. oTree:hasButtons := .T. oTree:alwaysShowSelection := .T. @@ -135,25 +136,25 @@ PROCEDURE Main() oItem2:addItem( "Third level B" ) oItem2:addItem( "Third level C" ) - #if 0 +#if 0 oItem1:expand( .T. ) - #else - oTree:showExpanded( .T., 2 ) - #endif +#else + oTree:showExpanded( .T. , 2 ) +#endif oTree:setData( oItem2 ) //--------------------------- Active-X ---------------------------\\ hb_gtInfo( HB_GTI_WINTITLE, 'http://www.harbour.vouch.info' ) - #if 0 +#if 0 oCom := WvgActiveXControl():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) oCom:CLSID := 'Shell.Explorer.2' oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) - #else +#else oCom := WvgHTMLViewer():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) oCom:beforeNavigate := {| cURL, x, oHTML | x := x, oHTML := oHTML, oPanel:caption := cURL } oCom:statusTextChange := {| cText | oPanel:caption := cText } - #endif +#endif oCom:create() oCom:Navigate( 'http://www.harbour.vouch.info' ) @@ -164,52 +165,52 @@ PROCEDURE Main() oAddr:dataLink := {| x | iif( x == NIL, cNavigate, cNavigate := x ) } oAddr:setColorFG( RGB( 0,0,255 ) ) oAddr:setColorBG( RGB( 0,255,255 ) ) - oAddr:create( oDA, , { 120, oTBar:currentSize()[2] }, { 500,20 }, , .T. ) + oAddr:create( oDA, , { 120, oTBar:currentSize()[2] }, { 500, 20 }, , .T. ) oAddr:setData() - oAddr:killInputFocus := {| m1, m2, oS | m1:=m1, m2:=m2, oS:getData(), oCom:navigate( cNavigate ) } + oAddr:killInputFocus := {| m1, m2, oS | m1 := m1, m2 := m2, oS:getData(), oCom:navigate( cNavigate ) } //----------------- Panel : Static + Radio + Checkbox ----------\\ - oStatic2:= WvgStatic():New( oDA, , { 150, 150 }, { 500,310 }, , .F. ) - //oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME + oStatic2 := WvgStatic():New( oDA, , { 150, 150 }, { 500, 310 }, , .F. ) +// oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME oStatic2:exStyle += WS_EX_WINDOWEDGE - //oStatic2:options := WVGSTATIC_FRAMETHICK +// oStatic2:options := WVGSTATIC_FRAMETHICK oStatic2:create() oStatic2:setColorBG( RGB( 175,175,175 ) ) oXbp := WvgPushButton():new( oStatic2 ) oXbp:caption := "Hide" oXbp:caption := "Hide" - oXbp:create( , , { 430,275 }, { 60,25 } ) + oXbp:create( , , { 430, 275 }, { 60, 25 } ) oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } - oRadio := WvgRadioButton():new( oStatic2,, { 10,10 }, { 100,15 } ) + oRadio := WvgRadioButton():new( oStatic2, , { 10, 10 }, { 100, 15 } ) oRadio:caption := "Com 1" oRadio:selection := .T. - oRadio:selected := {| m1, m2, obj | m1:=m1, m2:=m2, WVG_MessageBox( , obj:caption + iif( obj:selection, '< S >', '< N >' ) ) } + oRadio:selected := {| m1, m2, obj | m1 := m1, m2 := m2, WVG_MessageBox( , obj:caption + iif( obj:selection, '< S >', '< N >' ) ) } oRadio:create() - oRadio := WvgRadioButton():new( oStatic2,, { 10,35 }, { 100,15 } ) + oRadio := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } ) oRadio:caption := "Com 2" oRadio:create() - oCheck := WvgCheckBox():New( oStatic2, , { 10,70 }, { 100,15 }, , .T. ) + oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100, 15 }, , .T. ) oCheck:caption := 'Checkbox A' oCheck:create() - oCheck:selected := {| m1, m2, o | m1:=m1,m2:=m2, WVG_MessageBox( , iif( o:getData(), 'I am selected','I am not selected' ) ) } + oCheck:selected := {| m1, m2, o | m1 := m1, m2 := m2, WVG_MessageBox( , iif( o:getData(), 'I am selected','I am not selected' ) ) } // Create first 3State button, passing the position to :create() oXbp := Wvg3State():new() oXbp:caption := "3 State A" - oXbp:create( oStatic2, , { 10,100 }, { 100,15 } ) + oXbp:create( oStatic2, , { 10, 100 }, { 100, 15 } ) // Determine current state using mp1 - oXbp:selected := {| m1, m2, oBtn | m2:=m2, oBtn:=oBtn, oPanel1:caption := "3State A ["+aState[ m1+1 ]+"]" } + oXbp:selected := {| m1, m2, oBtn | m2 := m2, oBtn := oBtn, oPanel1:caption := "3State A [" + aState[ m1+1 ] + "]" } // Create second 3State Button, passing the position to :new() - oXbp := Wvg3State():new( oStatic2, , { 10,125 }, { 100,15 } ) + oXbp := Wvg3State():new( oStatic2, , { 10, 125 }, { 100, 15 } ) oXbp:caption := "3 State B" oXbp:create( oStatic2 ) // Determine current state using :getData() - oXbp:selected := {| m1, m2, oBtn | m1:=m1,m2:=m2, WVG_MessageBox( , "3State B", aState[ oBtn:getData()+1 ] ) } + oXbp:selected := {| m1, m2, oBtn | m1 := m1, m2 := m2, WVG_MessageBox( , "3State B", aState[ oBtn:getData()+1 ] ) } // Create first SLE, specify position using :create() // On :typeOut set the focus to the second SLE @@ -218,19 +219,19 @@ PROCEDURE Main() oXbp:bufferLength := 20 // Data code block containing assignment to LOCAL variable oXbp:dataLink := {| x | iif( x == NIL, cVarA, cVarA := x ) } - oXbp:create( oStatic2, , { 10,170 }, { 150,20 } ) + oXbp:create( oStatic2, , { 10, 170 }, { 150, 20 } ) oXbp:setData() // Assign the value of the edit buffer to a LOCAL variable when the input focus is lost - oXbp:killInputFocus := {| x, y, oSLE | x:=x,y:=y, oSLE:getData(), oPanel:caption := "cVarA =" + cVarA } + oXbp:killInputFocus := {| x, y, oSLE | x := x, y := y, oSLE:getData(), oPanel:caption := "cVarA =" + cVarA } // Create second SLE, specify position using :new() - oXbp := WvgSLE():new( , , { 10,200 }, { 150,20 } ) + oXbp := WvgSLE():new( , , { 10, 200 }, { 150, 20 } ) oXbp:tabStop := .T. oXbp:bufferLength := 15 oXbp:dataLink := {| x | iif( x == NIL, cVarB, cVarB := x ) } oXbp:create( oStatic2 ) oXbp:setData() - oXbp:killInputFocus := {| x, y, oSLE | x:=x,y:=y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB } + oXbp:killInputFocus := {| x, y, oSLE | x := x, y := y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB } // Read file into LOCAL variable cText := MemoRead( 'gtwvg.hbc' ) @@ -240,17 +241,17 @@ PROCEDURE Main() oMLE:wordWrap := .F. oMLE:border := .T. oMLE:dataLink := {| x | iif( x == NIL, cText, cText := x ) } - oMLE:create( oStatic2, , { 180,10 }, { 310,250 } ) + oMLE:create( oStatic2, , { 180, 10 }, { 310, 250 } ) // Copy text from LOCAL variable into edit buffer via :dataLink oMLE:setData() //--------------------------- Misc Config ------------------------\\ - oTBar:buttonClick := {| oBtn | iif( oBtn:caption == 'Hide' , oStatic:hide(), nil ),; - iif( oBtn:caption == 'Show' , oStatic:show(), nil ),; - iif( oBtn:caption == 'Tools' , oStatic2:show():toFront(), nil ),; - iif( oBtn:caption == 'FontDlg', ExeFontDialog( oCrt ), nil ),; - iif( oBtn:caption $ 'Hide,Show', oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ),; - oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } + oTBar:buttonClick := {| oBtn | iif( oBtn:caption == 'Hide' , oStatic:hide(), NIL ), ; + iif( oBtn:caption == 'Show' , oStatic:show(), NIL ), ; + iif( oBtn:caption == 'Tools' , oStatic2:show():toFront(), NIL ), ; + iif( oBtn:caption == 'FontDlg', ExeFontDialog( oCrt ), NIL ), ; + iif( oBtn:caption $ 'Hide,Show', oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ), ; + oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } oCrt:resize := {|| ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr ) } @@ -258,7 +259,7 @@ PROCEDURE Main() oCrt:show() DO WHILE .T. - IF inkey() == K_ESC + IF Inkey() == K_ESC EXIT ENDIF ENDDO @@ -270,6 +271,7 @@ PROCEDURE Main() // STATIC FUNCTION ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr ) + LOCAL aCrt, aTBar, aSBar LOCAL nH, nT @@ -281,15 +283,15 @@ STATIC FUNCTION ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr nH := aCrt[2] - aTBar[2] - aSBar[2] IF oStatic:isVisible - oStatic:setPosAndSize( { 0, nT+3 }, { 120, nH-4 }, .T. ) - oAddr:setPosAndSize( { 120, nT+2 }, { aCrt[1]-120-150, 20 }, .T. ) - oCom:setPosAndSize( { 120, nT+2+20 }, { aCrt[1]-120-150, nH-20 }, .T. ) - oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .T. ) + oStatic:setPosAndSize( { 0, nT + 3 }, { 120, nH - 4 }, .T. ) + oAddr:setPosAndSize( { 120, nT + 2 }, { aCrt[1] - 120 - 150, 20 }, .T. ) + oCom:setPosAndSize( { 120, nT + 2 + 20 }, { aCrt[1] - 120 - 150, nH - 20 }, .T. ) + oTree:setPosAndSize( { aCrt[1] - 150, nT }, { 150, nH }, .T. ) ELSE - oAddr:setPosAndSize( { 0, nT+2 }, { aCrt[1]-150, 20 }, .T. ) - oCom:setPosAndSize( { 0, nT+2+20 }, { aCrt[1]-150, nH-20 }, .T. ) - oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .T. ) + oAddr:setPosAndSize( { 0, nT + 2 }, { aCrt[1] - 150, 20 }, .T. ) + oCom:setPosAndSize( { 0, nT + 2 + 20 }, { aCrt[1] - 150, nH - 20 }, .T. ) + oTree:setPosAndSize( { aCrt[1] - 150, nT }, { 150, nH }, .T. ) ENDIF @@ -297,8 +299,9 @@ STATIC FUNCTION ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr // -Static Function ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 ) - Local oMenuBar, oSubMenu +STATIC FUNCTION ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 ) + + LOCAL oMenuBar, oSubMenu oMenuBar := WvgMenuBar():new( oCrt ):create() @@ -310,7 +313,7 @@ Static Function ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 ) oSubMenu:title := "~Procedural" oSubMenu:addItem( { "Play Charge ~1", } ) oSubMenu:addItem( { "Play Nannyboo ~2", } ) - oSubMenu:itemSelected := {| mp1 | MyFunctionXbp( 100+mp1 ) } + oSubMenu:itemSelected := {| mp1 | MyFunctionXbp( 100 + mp1 ) } oMenuBar:addItem( { oSubMenu, NIL } ) // Define submenu in the functional style: @@ -327,20 +330,22 @@ Static Function ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 ) oSubMenu := WvgMenu():new( oMenuBar ):create() oSubMenu:title := "F~eatures" oSubMenu:addItem( { "~Hide or Show Left Panel" , {|| iif( oStatic:isVisible, ; - oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE,0,0 ) } } ) + oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE, 0, 0 ) } } ) oSubMenu:addItem( { "~Show My Panel" , {|| oStatic2:show():toFront() } } ) oSubMenu:addItem() oSubMenu:addItem( { "~Font Dialog" , {|| ExeFontDialog( oCrt ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) - Return nil + RETURN NIL + // STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt ) + LOCAL oTBar - oTBar := WvgToolBar():new( oCrt , , { 0,0 }, { 0,0 }, , .T. ) + oTBar := WvgToolBar():new( oCrt , , { 0, 0 }, { 0, 0 }, , .T. ) oTBar:style := WVGTOOLBAR_STYLE_FLAT @@ -370,39 +375,40 @@ STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt ) // -Static Function MyFunctionXbp( nMode ) +STATIC FUNCTION MyFunctionXbp( nMode ) - #define MUSIC_WAITON {800, 1600} +#define MUSIC_WAITON {800, 1600} - do case - case nMode == 1 - tone( MUSIC_WAITON[1], 1 ) - tone( MUSIC_WAITON[2], 1 ) + DO CASE + CASE nMode == 1 + Tone( MUSIC_WAITON[1], 1 ) + Tone( MUSIC_WAITON[2], 1 ) - case nMode == 2 - tone( MUSIC_WAITON[2], 1 ) - tone( MUSIC_WAITON[1], 1 ) + CASE nMode == 2 + Tone( MUSIC_WAITON[2], 1 ) + Tone( MUSIC_WAITON[1], 1 ) - case nMode == 3 + CASE nMode == 3 WVG_MessageBox( , "Button clicked!" ) - case nMode == 101 // Charge - Eval( {|| tone(523,2),tone(698,2),tone(880,2),tone(1046,4),tone(880,2),tone(1046,8) } ) + CASE nMode == 101 // Charge + Eval( {|| Tone( 523,2 ), Tone( 698,2 ), Tone( 880,2 ), Tone( 1046,4 ), Tone( 880,2 ), Tone( 1046,8 ) } ) - case nMode == 102 // NannyBoo - AEval( {{196,2},{196,2},{164,2},{220,2},{196,4},{164,4}}, {| a | tone(a[1],a[2]) } ) + CASE nMode == 102 // NannyBoo + AEval( { { 196,2 }, { 196,2 }, { 164,2 }, { 220,2 }, { 196,4 }, { 164,4 } }, {| a | Tone( a[1],a[2] ) } ) - case nMode == 103 // BADKEY - tone( 480,0.25 ) - tone( 240,0.25 ) + CASE nMode == 103 // BADKEY + Tone( 480, 0.25 ) + Tone( 240, 0.25 ) - endcase + ENDCASE - Return nil + RETURN NIL // STATIC FUNCTION ExeFontDialog( oCrt ) + LOCAL oFontDlg, oWvgFont STATIC nMode := 0 @@ -410,32 +416,32 @@ STATIC FUNCTION ExeFontDialog( oCrt ) oFontDlg := WvgFontDialog():new( oCrt ) oFontDlg:title := 'Select a Screen Font' - oFontDlg:aPos := { 150,150 } + oFontDlg:aPos := { 150, 150 } oFontDlg:buttonApply := .T. oFontDlg:activateApply := {|| NIL } oFontDlg:familyName := "Courier New" oFontDlg:strikeout := .T. oFontDlg:underscore := .F. - //oFontDlg:activateOk := {|| WVG_MessageBox( , 'activateOK Event Handelled in Windows!' ) } +// oFontDlg:activateOk := {|| WVG_MessageBox( , 'activateOK Event Handelled in Windows!' ) } oFontDlg:nominalPointSize := 12 - //oFontDlg:size := .F. - //oFontDlg:style := .F. +// oFontDlg:size := .F. +// oFontDlg:style := .F. oFontDlg:create() - // Every 2nd FontDialog will be MODAL + // Every 2nd FontDialog will be MODAL oWvgFont := oFontDlg:display( ++nMode % 2 ) HB_SYMBOL_UNUSED( oWvgFont ) oFontDlg:destroy() - RETURN nil + RETURN NIL // -STATIC FUNCTION HB_GTSYS() +FUNCTION hb_GTSYS() REQUEST HB_GT_GUI_DEFAULT REQUEST HB_GT_WVG diff --git a/harbour/contrib/gtwvg/tests/dyndlgs.prg b/harbour/contrib/gtwvg/tests/dyndlgs.prg index b40ff2c840..00823d40b0 100644 --- a/harbour/contrib/gtwvg/tests/dyndlgs.prg +++ b/harbour/contrib/gtwvg/tests/dyndlgs.prg @@ -44,20 +44,22 @@ THREAD STATIC t_aSlides := {} // FUNCTION DynWinDialog( nInfo ) - Local hDlg, aDlg, nStyle, cDlgIcon, cDlgProc, lOnTop, hMenu -// Local bDlgProc -// Local nTimerTicks + + LOCAL hDlg, aDlg, nStyle, cDlgIcon, cDlgProc, lOnTop, hMenu + +// LOCAL bDlgProc +// LOCAL nTimerTicks nStyle := DS_SETFONT + WS_VISIBLE + WS_POPUP + WS_CAPTION + WS_SYSMENU + WS_THICKFRAME + WS_MINIMIZEBOX - aDlg := Wvt_MakeDlgTemplate( 1, 4, 21, 60, {0,0,0,0}, ; - "Dialog First [ " + ltrim( str( nInfo,10,0 ) ) + " ] "+; - iif( nInfo%2==0, "Modeless", "Modal" )," Dialog !", nStyle ) + aDlg := Wvt_MakeDlgTemplate( 1, 4, 21, 60, { 0, 0, 0, 0 }, ; + "Dialog First [ " + LTrim( Str( nInfo,10,0 ) ) + " ] " + ; + iif( nInfo % 2 == 0, "Modeless", "Modal" ), " Dialog !", nStyle ) // Multi line edit control // nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOVSCROLL + ES_MULTILINE + ; - ES_WANTRETURN + WS_BORDER + WS_VSCROLL + ES_WANTRETURN + WS_BORDER + WS_VSCROLL aDlg := Wvt_AddDlgItem( aDlg, 1, 2, 15, 35, {}, ID_MLE , "EDIT" , nStyle, /* cText, nHelpId, nExStyle */ ) // Two Horz and Vert Lines @@ -79,35 +81,35 @@ FUNCTION DynWinDialog( nInfo ) aDlg := Wvt_AddDlgItem( aDlg, 18, 15, 1, 10, {}, ID_CHK_SATIS , "BUTTON" , nStyle, "Satisfied?" ) nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_RIGHT + ES_READONLY - aDlg := Wvt_AddDlgItem( aDlg, 18, 30, 1, 7, {3}, ID_EDT_TIME , "EDIT" , nStyle, "" ) + aDlg := Wvt_AddDlgItem( aDlg, 18, 30, 1, 7, { 3 }, ID_EDT_TIME , "EDIT" , nStyle, "" ) nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + LBS_NOTIFY + WS_VSCROLL + WS_BORDER aDlg := Wvt_AddDlgItem( aDlg, 1, 41, 4, 17, {}, ID_LST_LIST , "LISTBOX", nStyle, "ListBox" ) nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT - aDlg := Wvt_AddDlgItem( aDlg, 4, 41, 1, 17, {3,0,0,0}, -1 , "STATIC" , nStyle, "Degree" ) + aDlg := Wvt_AddDlgItem( aDlg, 4, 41, 1, 17, { 3, 0, 0, 0 }, -1 , "STATIC" , nStyle, "Degree" ) nStyle := WS_VISIBLE + WS_TABSTOP + CBS_DROPDOWNLIST + WS_BORDER + WS_VSCROLL aDlg := Wvt_AddDlgItem( aDlg, 5, 41, 6, 17, {}, ID_CMB_COMBO , "COMBOBOX" , nStyle, "Combo" ) nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_GROUPBOX - aDlg := Wvt_AddDlgItem( aDlg, 7, 41, 4, 17, {0,0,4,0},ID_GRP_COMP, "BUTTON" , nStyle, "Compiler" ) + aDlg := Wvt_AddDlgItem( aDlg, 7, 41, 4, 17, { 0, 0, 4, 0 }, ID_GRP_COMP, "BUTTON" , nStyle, "Compiler" ) nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_AUTORADIOBUTTON aDlg := Wvt_AddDlgItem( aDlg, 8, 43, 1, 14, {}, ID_RDO_XH , "BUTTON" , nStyle, "Harbour" ) aDlg := Wvt_AddDlgItem( aDlg, 9, 43, 1, 14, {}, ID_RDO_CLIP , "BUTTON" , nStyle, "Clipper" ) - aDlg := Wvt_AddDlgItem( aDlg,10, 43, 1, 14, {}, ID_RDO_XBASE , "BUTTON" , nStyle, "Xbase++" ) + aDlg := Wvt_AddDlgItem( aDlg, 10, 43, 1, 14, {}, ID_RDO_XBASE , "BUTTON" , nStyle, "Xbase++" ) nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT - aDlg := Wvt_AddDlgItem( aDlg, 12, 41, 1, 17, {3,0,0,0}, ID_STA_TEXT, "STATIC" , nStyle, "Scrollable Text" ) + aDlg := Wvt_AddDlgItem( aDlg, 12, 41, 1, 17, { 3, 0, 0, 0 }, ID_STA_TEXT, "STATIC" , nStyle, "Scrollable Text" ) nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOHSCROLL + WS_BORDER aDlg := Wvt_AddDlgItem( aDlg, 13, 41, 1, 17, {}, ID_EDT_TEXT , "EDIT" , nStyle, "This is Text Field" ) nStyle := WS_CHILD + WS_VISIBLE + SS_LEFT - aDlg := Wvt_AddDlgItem( aDlg, 14, 41, 1, 17, {3,0,0,0}, -1, "STATIC" , nStyle, "Right Justified Numerics" ) + aDlg := Wvt_AddDlgItem( aDlg, 14, 41, 1, 17, { 3, 0, 0, 0 }, -1, "STATIC" , nStyle, "Right Justified Numerics" ) nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + ES_AUTOHSCROLL + ES_NUMBER + ES_RIGHT + WS_BORDER aDlg := Wvt_AddDlgItem( aDlg, 15, 41, 1, 17, {}, ID_EDT_NUMB , "EDIT" , nStyle, "1234567" ) nStyle := WS_CHILD + WS_VISIBLE + WS_TABSTOP + BS_PUSHBUTTON - aDlg := Wvt_AddDlgItem( aDlg, 18, 50, 1, 8, {-3,0,3,0}, ID_BTN_OK, "BUTTON" , nStyle, "OK" ) + aDlg := Wvt_AddDlgItem( aDlg, 18, 50, 1, 8, { -3, 0, 3, 0 }, ID_BTN_OK, "BUTTON" , nStyle, "OK" ) hMenu := Wvt_CreateMenu() Wvt_AppendMenu( hMenu, MF_STRING + MF_ENABLED, ID_MNU_FILE , "File" ) @@ -119,120 +121,121 @@ FUNCTION DynWinDialog( nInfo ) cDlgIcon := "v_notes.ico" // nTimerTicks := 1000 // 1 second - if nInfo == 2 + IF nInfo == 2 // Modal Dialog // //hDlg := Wvt_DialogBox( aDlg, bDlgProc, Wvt_GetWindowHandle() ) hDlg := Wvt_DialogBox( aDlg, cDlgProc, Wvt_GetWindowHandle() ) - else + ELSE // Modeless Dialog // hDlg := Wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, /*nTimerTicks*/, hMenu ) // Using Function name. //hDlg := Wvt_CreateDialog( aDlg, lOnTop, cDlgProc, cDlgIcon, nTimerTicks, hMenu, lModal ) - endif + ENDIF RETURN hDlg // FUNCTION DynDlgProc( hDlg, nMsg, wParam, lParam ) - Local lClicked, cPrompt, nIndex, hFont, aHFonts + + LOCAL lClicked, cPrompt, nIndex, hFont, aHFonts Switch ( nMsg ) - case WM_TIMER + CASE WM_TIMER WVG_SetDlgItemText( hDlg, ID_EDT_TIME, Time() ) - exit + EXIT - case WM_COMMAND - do case + CASE WM_COMMAND + DO CASE - case wParam == ID_CHK_SATIS + CASE wParam == ID_CHK_SATIS lClicked := ( WVG_IsDlgButtonChecked( hDlg,ID_CHK_SATIS ) == 1 ) WVG_MessageBox( hDlg, iif( lClicked, "Satisfied", "UnSatisfied" ), "CheckBoxStatus" ) - case wParam == ID_RDO_XH + CASE wParam == ID_RDO_XH WVG_MessageBox( hDlg, "Harbour", "Compiler" ) - case wParam == ID_RDO_CLIP + CASE wParam == ID_RDO_CLIP WVG_MessageBox( hDlg, "Clipper", "Compiler" ) - case wParam == ID_RDO_XBASE + CASE wParam == ID_RDO_XBASE WVG_MessageBox( hDlg, "Xbase++", "Compiler" ) - case wParam == ID_MNU_FILE + CASE wParam == ID_MNU_FILE WVG_MessageBox( hDlg, "Execute Menu Action!", "File" ) - case wParam == ID_MNU_CONTROL + CASE wParam == ID_MNU_CONTROL WVG_MessageBox( hDlg, "Controls are from Windows!", "Controls" ) - case WVG_LOWORD( wParam ) == ID_LST_LIST - if WVG_HIWORD( wParam ) == LBN_SELCHANGE + CASE WVG_LOWORD( wParam ) == ID_LST_LIST + IF WVG_HIWORD( wParam ) == LBN_SELCHANGE nIndex := WVG_SendMessage( WVG_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETCURSEL, 0, 0 ) - cPrompt := space( 20 ) + cPrompt := Space( 20 ) WVG_SendMessage( WVG_GetDlgItem( hDlg, ID_LST_LIST ), LB_GETTEXT, nIndex, @cPrompt ) WVG_MessageBox( hDlg, cPrompt, "ListBox" ) - endif + ENDIF - case WVG_LOWORD( wParam ) == ID_CMB_COMBO - if WVG_HIWORD( wParam ) == CBN_SELCHANGE + CASE WVG_LOWORD( wParam ) == ID_CMB_COMBO + IF WVG_HIWORD( wParam ) == CBN_SELCHANGE nIndex := WVG_SendMessage( WVG_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETCURSEL, 0, 0 ) - cPrompt := space( 20 ) + cPrompt := Space( 20 ) WVG_SendMessage( WVG_GetDlgItem( hDlg, ID_CMB_COMBO ), CB_GETLBTEXT, nIndex, @cPrompt ) WVG_MessageBox( hDlg, cPrompt, "Combo Box" ) - endif + ENDIF - endcase - exit + ENDCASE + EXIT CASE WM_CTLCOLOREDIT IF ( WVG_GetDlgItem( hDlg,ID_MLE ) == lParam ) WVG_SetTextColor( wParam, RGB( 0,0,255 ) ) WVG_SetBkColor( wParam, RGB( 255,255,200 ) ) - return 1 + RETURN 1 ELSEIF ( WVG_GetDlgItem( hDlg,ID_EDT_TEXT ) == lParam ) WVG_SetTextColor( wParam, RGB( 255,255,255 ) ) WVG_SetBkColor( wParam, RGB( 10,200,45 ) ) - Return 1 + RETURN 1 ENDIF EXIT CASE WM_CTLCOLORSTATIC IF ( WVG_GetDlgItem( hDlg,ID_STA_TEXT ) == lParam ) WVG_SetTextColor( wParam, RGB( 255,255,255 ) ) - Return 1 + RETURN 1 ENDIF EXIT CASE WM_INITDIALOG WVG_SetTimer( hDlg, 5001, 1000 ) // 1 sec - IF empty( aHFonts := SetFonts() ) + IF Empty( aHFonts := SetFonts() ) IF ( hFont := Wvt_CreateFont( "Times New Roman", 18 ) ) != 0 SetFonts( hFont ) ENDIF ENDIF - IF len( aHFonts ) > 0 + IF Len( aHFonts ) > 0 WVG_SendMessage( WVG_GetDlgItem( hDlg, ID_MLE ), WM_SETFONT, ahFonts[ 1 ], 0 ) ENDIF - IF empty( SetIcons() ) + IF Empty( SetIcons() ) SetIcons( WVG_LoadIcon( "vr_1.ico" ) ) ENDIF - IF !empty( SetIcons() ) + IF !Empty( SetIcons() ) WVG_SendMessage( WVG_GetDlgItem( hDlg, ID_ICO_VOUCH ), STM_SETIMAGE, IMAGE_ICON, SetIcons()[ 1 ] ) ENDIF /* - if t_hImage == nil + IF t_hImage == NIL t_hImage := WVG_LoadImage( "vouch1.bmp", 2 ) - endif - if t_hImage != nil .and. t_hImage != 0 + ENDIF + IF t_hImage != NIL .AND. t_hImage != 0 WVG_SendMessage( WVG_GetDlgItem( hDlg, ID_STA_IMAGE ), STM_SETIMAGE, IMAGE_BITMAP, t_hImage ) - endif + ENDIF */ WVG_SetDlgItemText( hDlg, ID_MLE , GetEditText() ) WVG_CheckDlgButton( hDlg, ID_CHK_SATIS, .T. ) @@ -264,7 +267,8 @@ FUNCTION DynDlgProc( hDlg, nMsg, wParam, lParam ) // Do whatevert you want to do with cText // Each box will retrieve its own text. // - /* cText := */ WVG_GetDlgItemText( hDlg, ID_MLE ) + /* cText := */ + WVG_GetDlgItemText( hDlg, ID_MLE ) EXIT END @@ -273,6 +277,7 @@ FUNCTION DynDlgProc( hDlg, nMsg, wParam, lParam ) // STATIC FUNCTION GetEditText() + LOCAL cText := "" cText += "Welcome in the Wonderful World of Harbour!" @@ -305,6 +310,7 @@ STATIC FUNCTION GetEditText() // FUNCTION DlgSlideShow() + LOCAL hDlg, aDlg, nStyle t_aSlides := { "vouch1.bmp", "v_notes.ico", "2000.gif", "v_lock.bmp", "v_help.ico" } @@ -313,7 +319,7 @@ FUNCTION DlgSlideShow() aDlg := Wvt_MakeDlgTemplate( 0, 0, 20, 40, {}, "Slide Show", nStyle ) - hDlg := Wvt_CreateDialog( aDlg, .F., "DlgSlideShowProc", "vr_1.ico", 5000 ) + hDlg := Wvt_CreateDialog( aDlg, .F. , "DlgSlideShowProc", "vr_1.ico", 5000 ) RETURN hDlg @@ -338,7 +344,7 @@ FUNCTION DlgSlideShowProc( hDlg, nMsg, wParam, lParam ) CASE WM_TIMER nSlide++ - IF nSlide > len( t_aSlides ) + IF nSlide > Len( t_aSlides ) nSlide := 1 ENDIF DrawSlide( hDlg, nSlide ) @@ -351,17 +357,18 @@ FUNCTION DlgSlideShowProc( hDlg, nMsg, wParam, lParam ) // FUNCTION DrawSlide( hDlg, nSlide ) + LOCAL hDC, aRect hDC := WVG_GetDC( hDlg ) aRect := WVG_GetClientRect( hDlg ) - Win_Rectangle( hDC, aRect[ 1 ]+10, aRect[ 2 ]+10, aRect[ 3 ]-10, aRect[ 4 ]-10 ) - WVG_DrawImage( hDC, aRect[ 1 ]+10, aRect[ 2 ]+10, aRect[ 3 ] - aRect[ 1 ] -20, ; - aRect[ 4 ] - aRect[ 2 ] - 20, t_aSlides[ nSlide ] ) + Win_Rectangle( hDC, aRect[ 1 ] + 10, aRect[ 2 ] + 10, aRect[ 3 ] - 10, aRect[ 4 ] - 10 ) + WVG_DrawImage( hDC, aRect[ 1 ] + 10, aRect[ 2 ] + 10, aRect[ 3 ] - aRect[ 1 ] - 20, ; + aRect[ 4 ] - aRect[ 2 ] - 20, t_aSlides[ nSlide ] ) - WVG_ReleaseDC( hDlg,hDC ) + WVG_ReleaseDC( hDlg, hDC ) - Return NIL + RETURN NIL // diff --git a/harbour/contrib/gtwvg/tests/modal.prg b/harbour/contrib/gtwvg/tests/modal.prg index df6878c86e..97b92ea38d 100644 --- a/harbour/contrib/gtwvg/tests/modal.prg +++ b/harbour/contrib/gtwvg/tests/modal.prg @@ -4,6 +4,7 @@ /* * Pritpal Bedi */ + // #include "inkey.ch" @@ -15,12 +16,13 @@ // -#xUntranslate alert( => +#xuntranslate alert( => FUNCTION MyAlert( cMsg, aOpt ) + LOCAL nSel, oCrt - oCrt := WvgCrt():New( , , { -1,-1 }, { 9, MaxCol()-6 }, , .T. ) + oCrt := WvgCrt():New( , , { -1, -1 }, { 9, MaxCol() - 6 }, , .T. ) oCrt:lModal := .T. oCrt:icon := "dia_excl.ico" oCrt:create() @@ -36,19 +38,23 @@ FUNCTION MyAlert( cMsg, aOpt ) RETURN nSel -#xTranslate Alert( => MyAlert( +#xtranslate Alert( => MyAlert( // FUNCTION My_Alert( cMessage, aOptions, cCaption, nInit, nTime ) - RETURN DialogAlert( cCaption, cMessage, aOptions, nInit, , ,nTime ) + + RETURN DialogAlert( cCaption, cMessage, aOptions, nInit, , , nTime ) // -#xUntranslate alert( => +#xuntranslate alert( => + FUNCTION Just_Alert( cMsg, aOpt ) + RETURN Alert( cMsg, aOpt ) -#xTranslate Alert( => MyAlert( + +#xtranslate Alert( => MyAlert( // @@ -70,96 +76,97 @@ FUNCTION Just_Alert( cMsg, aOpt ) #define K_RIGHT_UP 1005 #xtranslate B_CRT ,,, ; - [ TITLE ] ; - [ ICON ] ; - [ ] ; - [ ] ; - [ ] ; - [ ] ; - [ AT , ] ; - [ ] ; - INTO ; - => ; - := CreateOCrt( , , , , , , ; - <.lModal.>, <.lRowCols.>, <.lHidden.>, <.lCenter.>, ; - , , <.lNoTitleBar.> ) + [ TITLE ] ; + [ ICON ] ; + [ ] ; + [ ] ; + [ ] ; + [ ] ; + [ AT , ] ; + [ ] ; + INTO < oCrt > ; + => ; + < oCrt > := CreateOCrt( < nTop > , < nLeft > , < nBottom > , < nRight > , < ttl > , < icon > , ; + < .lModal. > , < .lRowCols. > , < .lHidden. > , < .lCenter. > , ; + < nRow > , < nCol > , < .lNoTitleBar. > ) // FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime ) + LOCAL nLinesRqd, nColRqd, nLeft, nBottom, nRight, oCrt LOCAL nColTxt, nColCap, nColBut, nBtnRow LOCAL i, nTopReq, lGo, nKey, nMCol, nMRow, nTrg - LOCAL maxCol := maxcol() - LOCAL maxRow := maxrow() + LOCAL maxCol := MaxCol() + LOCAL maxRow := MaxRow() LOCAL nBtnCol_ - LOCAL pal_ := {"w+/n","w/r","n/w","n/bg","r/bg","N/W","n/B","w+/B"} - LOCAL aTrg_ , x_:={} + LOCAL pal_ := { "w+/n", "w/r", "n/w", "n/bg", "r/bg", "N/W", "n/B", "w+/B" } + LOCAL aTrg_ , x_ := {} DEFAULT cCaption TO "Your Attention Please!" - DEFAULT aButtons_ TO {"OK"} + DEFAULT aButtons_ TO { "OK" } DEFAULT aText_ TO {} DEFAULT aMessage_ TO {} DEFAULT sel TO 1 DEFAULT nTime TO 10 - if nTime == 0 + IF nTime == 0 nTime := 10000 // Seconds - endif + ENDIF - if valtype( aText_ ) == "C" - aText_:= {aText_} - endif + IF ValType( aText_ ) == "C" + aText_ := { aText_ } + ENDIF - if valtype(aButtons_) == "C" - aButtons_:= {aButtons_} - endif + IF ValType( aButtons_ ) == "C" + aButtons_ := { aButtons_ } + ENDIF - nLinesRqd := len( aText_ )+ iif( len( aText_ )== 0, 4, 5 ) - nTopReq := int( ( maxRow - nLinesRqd ) / 2 ) - nTop := iif( nTop == nil, nTopReq, iif( nTop > nTopReq, nTop, nTopReq ) ) + nLinesRqd := Len( aText_ ) + iif( Len( aText_ ) == 0, 4, 5 ) + nTopReq := Int( ( maxRow - nLinesRqd ) / 2 ) + nTop := iif( nTop == NIL, nTopReq, iif( nTop > nTopReq, nTop, nTopReq ) ) nBottom := nTop + nLinesRqd - 1 // 1 for shadow // check for columns // place 2 spaces before and after the buttons - nColCap := len( cCaption )+ 7 // " - "+" "+caption+" " + nColCap := Len( cCaption ) + 7 // " - "+" "+caption+" " nColTxt := 0 - if !empty(aText_) - aeval(aText_, {| e | nColTxt := max( nColTxt, len( e ) ) } ) - endif + IF !Empty( aText_ ) + AEval( aText_, {| e | nColTxt := Max( nColTxt, Len( e ) ) } ) + ENDIF nColTxt += 6 // for two spaces at both sides nColBut := 0 - aeval( aButtons_, {| e | nColBut += len( e ) + 7 } ) + AEval( aButtons_, {| e | nColBut += Len( e ) + 7 } ) nColBut += 3 nColRqd := 0 - aeval( { nColCap, nColTxt, nColBut }, {| e | nColRqd := max( nColRqd, e ) } ) + AEval( { nColCap, nColTxt, nColBut }, {| e | nColRqd := Max( nColRqd, e ) } ) - nLeft := iif( maxCol > nColRqd, int( ( maxCol - nColRqd ) / 2 ), 0 ) - nRight := nLeft+nColRqd + nLeft := iif( maxCol > nColRqd, Int( ( maxCol - nColRqd ) / 2 ), 0 ) + nRight := nLeft + nColRqd - aTrg_:= array( len( aButtons_ ) ) - for i := 1 to len( aButtons_ ) - aTrg_[i] := upper( substr( aButtons_[ i ], 1, 1 ) ) - next + aTrg_ := Array( Len( aButtons_ ) ) + FOR i := 1 TO Len( aButtons_ ) + aTrg_[i] := Upper( SubStr( aButtons_[ i ], 1, 1 ) ) + NEXT // Create a new Window // - B_CRT nTop, nLeft, nBottom-1, nRight MODAL ICON "dia_excl.ico" TITLE ' '+cCaption INTO oCrt + B_CRT nTop, nLeft, nBottom - 1, nRight MODAL ICON "dia_excl.ico" TITLE ' ' + cCaption INTO oCrt nTop := -1 nLeft := 0 nBottom := nTop + nLinesRqd - 1 nRight := nLeft + nColRqd - nBtnRow := nTop + 1 + len( aText_ ) + iif( len( aText_ ) == 0, 1, 2 ) + nBtnRow := nTop + 1 + Len( aText_ ) + iif( Len( aText_ ) == 0, 1, 2 ) - nBtnCol_ := array( len( aButtons_ ) ) + nBtnCol_ := Array( Len( aButtons_ ) ) - nBtnCol_[ 1 ] := int( ( nColRqd - nColBut ) / 2 ) + 3 - if len( aButtons_ ) > 1 - for i := 2 to len( aButtons_ ) - nBtnCol_[ i ] := nBtnCol_[ i-1 ] + len( aButtons_[ i-1 ] ) + 3 + 4 - next + nBtnCol_[ 1 ] := Int( ( nColRqd - nColBut ) / 2 ) + 3 + IF Len( aButtons_ ) > 1 + FOR i := 2 TO Len( aButtons_ ) + nBtnCol_[ i ] := nBtnCol_[ i-1 ] + Len( aButtons_[ i-1 ] ) + 3 + 4 + NEXT ENDIF SetCursor( 0 ) @@ -172,113 +179,114 @@ FUNCTION DialogAlert( cCaption, aText_, aButtons_, sel, aMessage_, nTop, nTime ) Wvg_BoxRaised( nTop, nLeft, nBottom, nRight ) SetColor( pal_[ DLG_CLR_TEXT ] ) - if !empty( aText_ ) - FOR i := 1 to len( aText_ ) - @ nTop+1+i, nLeft SAY padc( aText_[ i ], nRight-nLeft+1 ) + IF !Empty( aText_ ) + FOR i := 1 TO Len( aText_ ) + @ nTop + 1 + i, nLeft SAY PadC( aText_[ i ], nRight - nLeft + 1 ) NEXT ENDIF // display buttons // - for i := 1 to len( aButtons_ ) + FOR i := 1 TO Len( aButtons_ ) SetColor( pal_[ DLG_CLR_BTN ] ) - @ nBtnRow, nBtnCol_[ i ] SAY " "+aButtons_[ i ]+" " + @ nBtnRow, nBtnCol_[ i ] SAY " " + aButtons_[ i ] + " " SetColor( pal_[ DLG_CLR_TRG ] ) - @ nBtnRow, nBtnCol_[ i ]+2 say substr( aButtons_[ i ],1,1 ) + @ nBtnRow, nBtnCol_[ i ] + 2 SAY SubStr( aButtons_[ i ], 1, 1 ) - aadd( x_, { nBtnRow, nBtnCol_[ i ], nBtnRow, nBtnCol_[ i ] + len( aButtons_[ i ] ) + 3 } ) - next + AAdd( x_, { nBtnRow, nBtnCol_[ i ], nBtnRow, nBtnCol_[ i ] + Len( aButtons_[ i ] ) + 3 } ) + NEXT - setColor( pal_[ DLG_CLR_HILITE ] ) - @ nBtnRow, nBtnCol_[ sel ] SAY " "+aButtons_[sel]+" " + SetColor( pal_[ DLG_CLR_HILITE ] ) + @ nBtnRow, nBtnCol_[ sel ] SAY " " + aButtons_[sel] + " " - setColor( pal_[ DLG_CLR_HISEL ] ) - @ nBtnRow, nBtnCol_[ sel ]+2 SAY substr( aButtons_[ sel ],1,1 ) + SetColor( pal_[ DLG_CLR_HISEL ] ) + @ nBtnRow, nBtnCol_[ sel ] + 2 SAY SubStr( aButtons_[ sel ], 1, 1 ) - aeval( x_, {| e_ | Wvg_BoxRaised( e_[ 1 ], e_[ 2 ], e_[ 3 ], e_[ 4 ] ) } ) + AEval( x_, {| e_ | Wvg_BoxRaised( e_[ 1 ], e_[ 2 ], e_[ 3 ], e_[ 4 ] ) } ) - dispend() + DispEnd() lGo := .T. - do while lGo + DO WHILE lGo IF ( nKey := Inkey() ) == 0 LOOP ENDIF - if nKey == K_ESC + IF nKey == K_ESC sel := 0 - exit - endif + EXIT + ENDIF nMRow := MRow() nMCol := MCol() - do case - case nKey == K_RIGHT_DOWN + DO CASE + CASE nKey == K_RIGHT_DOWN sel := 0 lGo := .F. - case nKey == K_LEFT_DOWN - if nMRow == nTop - if nMCol >= nLeft .and. nMCol <= nLeft+3 + CASE nKey == K_LEFT_DOWN + IF nMRow == nTop + IF nMCol >= nLeft .AND. nMCol <= nLeft + 3 sel := 0 lGo := .F. - endif - elseif nMRow == nBtnRow - for i := 1 to len( nBtnCol_ ) - if nMCol >= nBtnCol_[ i ] .and. nMCol <= nBtnCol_[ i ] + len( aButtons_[ i ] )+4 + ENDIF + ELSEIF nMRow == nBtnRow + FOR i := 1 TO Len( nBtnCol_ ) + IF nMCol >= nBtnCol_[ i ] .AND. nMCol <= nBtnCol_[ i ] + Len( aButtons_[ i ] ) + 4 sel := i lGo := .F. - endif - next - endif - case nKey == K_ESC + ENDIF + NEXT + ENDIF + CASE nKey == K_ESC sel := 0 lGo := .F. - case nKey == K_ENTER + CASE nKey == K_ENTER lGo := .F. - case nKey == K_LEFT .or. nKey == K_DOWN + CASE nKey == K_LEFT .OR. nKey == K_DOWN sel-- - case nKey == K_RIGHT .or. nKey == K_UP + CASE nKey == K_RIGHT .OR. nKey == K_UP sel++ - case ( nTrg := ascan( aTrg_, upper( chr( nKey ) ) ) ) > 0 + CASE ( nTrg := AScan( aTrg_, Upper( Chr( nKey ) ) ) ) > 0 sel := nTrg lGo := .F. - otherwise - if setkey( nKey ) != nil - eval( setKey( nKey ) ) - endif - endcase + OTHERWISE + IF SetKey( nKey ) != NIL + Eval( SetKey( nKey ) ) + ENDIF + ENDCASE - if sel > len( aButtons_ ) + IF sel > Len( aButtons_ ) sel := 1 - elseif sel < 1 - sel := len( aButtons_ ) - endif + ELSEIF sel < 1 + sel := Len( aButtons_ ) + ENDIF - dispbegin() - for i := 1 to len ( aButtons_ ) - setColor( pal_[ DLG_CLR_BTN ] ) - @ nBtnRow, nBtnCol_[ i ] SAY " "+aButtons_[i]+" " - setColor( pal_[ DLG_CLR_TRG]) - @ nBtnRow, nBtnCol_[i]+2 say substr(aButtons_[i],1,1) - next - if sel > 0 - setColor( pal_[ DLG_CLR_HILITE ] ) - @ nBtnRow, nBtnCol_[sel] SAY " "+aButtons_[ sel ]+" " - setColor( pal_[ DLG_CLR_HISEL ] ) - @ nBtnRow, nBtnCol_[ sel ]+2 SAY substr( aButtons_[ sel ], 1, 1 ) - endif + DispBegin() + FOR i := 1 TO Len ( aButtons_ ) + SetColor( pal_[ DLG_CLR_BTN ] ) + @ nBtnRow, nBtnCol_[ i ] SAY " " + aButtons_[i] + " " + SetColor( pal_[ DLG_CLR_TRG] ) + @ nBtnRow, nBtnCol_[i] + 2 SAY SubStr( aButtons_[i], 1, 1 ) + NEXT + IF sel > 0 + SetColor( pal_[ DLG_CLR_HILITE ] ) + @ nBtnRow, nBtnCol_[sel] SAY " " + aButtons_[ sel ] + " " + SetColor( pal_[ DLG_CLR_HISEL ] ) + @ nBtnRow, nBtnCol_[ sel ] + 2 SAY SubStr( aButtons_[ sel ], 1, 1 ) + ENDIF - dispend() - enddo + DispEnd() + ENDDO oCrt:destroy() - return sel + RETURN sel // FUNCTION CreateOCrt( nT, nL, nB, nR, cTitle, xIcon, lModal, lRowCols, lHidden, ; - lCenter, nRow, nCol, lNoTitleBar ) + lCenter, nRow, nCol, lNoTitleBar ) + LOCAL oCrt, aPos DEFAULT cTitle TO 'Info' @@ -288,7 +296,7 @@ FUNCTION CreateOCrt( nT, nL, nB, nR, cTitle, xIcon, lModal, lRowCols, lHidden, ; DEFAULT lCenter TO .F. DEFAULT lNoTitleBar TO .F. - aPos := iif( lCenter, {-1,-1}, iif( nRow == NIL, { nT, nL }, { nRow,nCol } ) ) + aPos := iif( lCenter, { -1, -1 }, iif( nRow == NIL, { nT, nL }, { nRow,nCol } ) ) oCrt := WvgCrt():new( , , aPos, { nB - nT, nR - nL }, , !lHidden ) oCrt:lModal := lModal @@ -301,10 +309,10 @@ FUNCTION CreateOCrt( nT, nL, nB, nR, cTitle, xIcon, lModal, lRowCols, lHidden, ; IF HB_ISNUMERIC( xIcon ) hb_gtInfo( HB_GTI_ICONRES, xIcon ) ELSE - IF ( '.ico' $ lower( xIcon ) ) + IF ( '.ico' $ Lower( xIcon ) ) hb_gtInfo( HB_GTI_ICONFILE, xIcon ) ELSE - IF '.bmp' $ lower( xIcon ) + IF '.bmp' $ Lower( xIcon ) xIcon := 'VW_DFT' ENDIF hb_gtInfo( HB_GTI_ICONRES, xIcon ) @@ -321,23 +329,25 @@ FUNCTION CreateOCrt( nT, nL, nB, nR, cTitle, xIcon, lModal, lRowCols, lHidden, ; // FUNCTION DoModalWindow() + LOCAL oCrt, nSel, pGT LOCAL aLastPaint := WvtSetBlocks( {} ) /* This part can be clubbed in a separate prg for different dialogs * OR can be loaded from a data dictionary. */ - oCrt := WvgCrt():New( , , { 4,8 }, { 12,49 }, , .T. ) + + oCrt := WvgCrt():New( , , { 4, 8 }, { 12, 49 }, , .T. ) oCrt:lModal := .T. oCrt:resizable := .F. oCrt:closable := .F. oCrt:title := 'Information! [R:4 C:8]' - oCrt:rbUp := {|| DispOutAt( maxrow(), 0, padc( 'rbUp', maxcol()+1 ),'W+/R*' ) } - oCrt:lbUp := {|| DispOutAt( maxrow(), 0, padc( 'lbUp', maxcol()+1 ),'W+/B*' ) } - oCrt:leave := {|| DispOutAt( maxrow(), 0, padc( 'Leaving', maxcol()+1 ), 'W+/RB' ) } - oCrt:enter := {|| DispOutAt( maxrow(), 0, padc( 'Entering', maxcol()+1 ), 'W+/B' ) } + oCrt:rbUp := {|| DispOutAt( MaxRow(), 0, PadC( 'rbUp', MaxCol() + 1 ), 'W+/R*' ) } + oCrt:lbUp := {|| DispOutAt( MaxRow(), 0, PadC( 'lbUp', MaxCol() + 1 ), 'W+/B*' ) } + oCrt:leave := {|| DispOutAt( MaxRow(), 0, PadC( 'Leaving', MaxCol() + 1 ), 'W+/RB' ) } + oCrt:enter := {|| DispOutAt( MaxRow(), 0, PadC( 'Entering', MaxCol() + 1 ), 'W+/B' ) } oCrt:Create() oCrt:show() @@ -348,19 +358,20 @@ FUNCTION DoModalWindow() // SetColor( 'N/W' ) CLS - do while .T. + DO WHILE .T. nSel := Just_Alert( 'I am in modal window !;< Try: MMove LBUp RBUp >;Click Parent Window', { 'OK' } ) - if nSel == 0 .or. nSel == 1 - exit + IF nSel == 0 .OR. nSel == 1 + EXIT - endif - enddo + ENDIF + ENDDO SetGT( 3, pGT ) oCrt:Destroy() WvtSetBlocks( aLastPaint ) - Return NIL + + RETURN NIL // diff --git a/harbour/contrib/gtwvg/tests/tbrowser.prg b/harbour/contrib/gtwvg/tests/tbrowser.prg index bd6f2d2ad8..9a0f23ffa5 100644 --- a/harbour/contrib/gtwvg/tests/tbrowser.prg +++ b/harbour/contrib/gtwvg/tests/tbrowser.prg @@ -11,6 +11,7 @@ * * Pritpal Bedi */ + // #include "inkey.ch" @@ -42,14 +43,14 @@ FUNCTION WvtMyBrowse() IF hb_mtvm() - Hb_ThreadStart( {| oCrt | oCrt := WvgCrt():new( , , { -1,-2 }, { 34,69 }, , .T. ), ; - oCrt:resizeMode := HB_GTI_RESIZEMODE_ROWS,; - oCrt:icon := GetResource( "dia_excl.ico" ),; - oCrt:create(),; - Wvt_SetGui( .T. ),; - ExecBrowser( oCrt ),; - oCrt:destroy(); - } ) + hb_threadStart( {| oCrt | oCrt := WvgCrt():new( , , { -1, -2 }, { 34,69 }, , .T. ), ; + oCrt:resizeMode := HB_GTI_RESIZEMODE_ROWS, ; + oCrt:icon := GetResource( "dia_excl.ico" ), ; + oCrt:create(), ; + Wvt_SetGui( .T. ), ; + ExecBrowser( oCrt ), ; + oCrt:destroy(); + } ) ELSE ExecBrowser() @@ -60,35 +61,37 @@ FUNCTION WvtMyBrowse() // FUNCTION ExecBrowser( oCrt ) + LOCAL nKey, bBlock, oBrowse , aLastPaint, i, pGT LOCAL cFileIndex, cFileDbf, cRDD, nIndex, oTBar, cScr, info_ //, oLB LOCAL lEnd := .F. LOCAL aBlocks := {} LOCAL nTop := 4 LOCAL nLeft := 3 - LOCAL nBottom := maxrow() - 2 - LOCAL nRight := maxcol() - 3 - LOCAL nCursor := setCursor( 0 ) - LOCAL nRow := row() - LOCAL nCol := col() + LOCAL nBottom := MaxRow() - 2 + LOCAL nRight := MaxCol() - 3 + LOCAL nCursor := SetCursor( 0 ) + LOCAL nRow := Row() + LOCAL nCol := Col() LOCAL cColor := SetColor( "N/W*,N/GR*,,,N/W*" ) LOCAL aObjects := WvtSetObjects( {} ) LOCAL hPopup := Wvt_SetPopupMenu() LOCAL oVBar, oHBar, oCom, oTre, oChk, oSLE, oLBx, aNvg, oIdx STATIC nStyle := 0 + THREAD STATIC nFactor := 200 THREAD STATIC lActiveX := .F. IF oCrt == NIL - cScr := SaveScreen( 0,0,maxrow(),maxcol() ) + cScr := SaveScreen( 0, 0, MaxRow(), MaxCol() ) ENDIF BrwBuildMenu( oCrt ) oTBar := BrwBuildToolBar( oCrt ) oTBar:buttonClick := {| oBtn | Vou_ExecTBarAction( oBtn ) } - SetMode( maxrow()+1, maxCol()+1 ) /* Neccessary because adding menu has reduced the overall size of window */ + SetMode( MaxRow() + 1, MaxCol() + 1 ) /* Neccessary because adding menu has reduced the overall size of window */ pGT := SetGT( 2, hb_gtSelect() ) @@ -100,7 +103,7 @@ FUNCTION ExecBrowser( oCrt ) IF NetErr() RETURN NIL ENDIF - IF fLock() + IF FLock() INDEX ON Test->FIRST TAG "001" TO ( cFileIndex ) INDEX ON Test->LAST TAG "002" TO ( cFileIndex ) INDEX ON Test->CITY TAG "003" TO ( cFileIndex ) @@ -109,9 +112,9 @@ FUNCTION ExecBrowser( oCrt ) SET INDEX TO SET INDEX TO ( cFileIndex ) SET ORDER TO 1 - DbGoTo( 50 ) + dbGoto( 50 ) - info_:= DbStruct() + info_ := dbStruct() Popups( 2 ) @@ -121,32 +124,32 @@ FUNCTION ExecBrowser( oCrt ) oBrowse:HeadSep := "__" oBrowse:GoTopBlock := {|| dbGoTop() } oBrowse:GoBottomBlock := {|| dbGoBottom() } - oBrowse:SkipBlock := {| nSkip | dbSkipBlock( nSkip,oBrowse ) } + oBrowse:SkipBlock := {| nSkip | dbSkipBlock( nSkip, oBrowse ) } - for i := 1 to len( info_ ) + FOR i := 1 TO Len( info_ ) bBlock := VouBlockField( i ) oBrowse:AddColumn( TBColumnNew( info_[ i,1 ], bBlock ) ) - next + NEXT oBrowse:configure() - if nStyle > 5 + IF nStyle > 5 nStyle := 0 - endif + ENDIF Wvt_SetPen( nStyle, 0, rgb( 210,1210,210 ) ) nStyle++ hb_gtInfo( HB_GTI_WINTITLE, "WVT Gui TBrowse()" ) - aAdd( aBlocks, {|| Wvt_DrawBoxRaised( oBrowse:nTop-2, oBrowse:nLeft-2, oBrowse:nBottom+1, oBrowse:nRight+2 ) } ) - aAdd( aBlocks, {|| Wvt_DrawBoxRecessed( oBrowse:nTop, oBrowse:nLeft, oBrowse:nBottom, oBrowse:nRight ) } ) - aAdd( aBlocks, {|| Wvt_DrawGridHorz( oBrowse:nTop+3, oBrowse:nLeft, oBrowse:nRight, oBrowse:nBottom - oBrowse:nTop - 2 ) } ) - aAdd( aBlocks, {|| Wvt_DrawGridVert( oBrowse:nTop, oBrowse:nBottom, oBrowse:aColumnsSep, len( oBrowse:aColumnsSep ) ) } ) + AAdd( aBlocks, {|| Wvt_DrawBoxRaised( oBrowse:nTop - 2, oBrowse:nLeft - 2, oBrowse:nBottom + 1, oBrowse:nRight + 2 ) } ) + AAdd( aBlocks, {|| Wvt_DrawBoxRecessed( oBrowse:nTop, oBrowse:nLeft, oBrowse:nBottom, oBrowse:nRight ) } ) + AAdd( aBlocks, {|| Wvt_DrawGridHorz( oBrowse:nTop + 3, oBrowse:nLeft, oBrowse:nRight, oBrowse:nBottom - oBrowse:nTop - 2 ) } ) + AAdd( aBlocks, {|| Wvt_DrawGridVert( oBrowse:nTop, oBrowse:nBottom, oBrowse:aColumnsSep, Len( oBrowse:aColumnsSep ) ) } ) Vou_BrwAddScrollBars( oCrt, oBrowse, @oVBar, @oHBar ) aLastPaint := WvtSetBlocks( aBlocks ) - DispBox( 0, 0, maxrow(), maxcol(), " ", "N/W" ) - DispOutAt( oBrowse:nTop-2, oBrowse:nleft-2, padc( cFileDbf, oBrowse:nRight-oBrowse:nLeft+5 ), "W+/B*" ) + DispBox( 0, 0, MaxRow(), MaxCol(), " ", "N/W" ) + DispOutAt( oBrowse:nTop - 2, oBrowse:nleft - 2, PadC( cFileDbf, oBrowse:nRight - oBrowse:nLeft + 5 ), "W+/B*" ) oCom := BrwBuildActiveX( oCrt, oBrowse ) oChk := BrwBuildCheckBox( oCrt, oBrowse, @lActiveX ) @@ -160,15 +163,15 @@ FUNCTION ExecBrowser( oCrt ) Wvt_Keyboard( HB_K_RESIZE ) /* Refresh All GUI Controls */ WHILE ! lEnd - dispbegin() - DO WHILE ( ( nKey := inkey( , INKEY_ALL + HB_INKEY_GTEVENT ) ) == 0 .or. nKey == K_MOVING ) .and. ! oBrowse:stabilize() + DispBegin() + DO WHILE ( ( nKey := Inkey( , INKEY_ALL + HB_INKEY_GTEVENT ) ) == 0 .OR. nKey == K_MOVING ) .AND. ! oBrowse:stabilize() ENDDO - dispend() + DispEnd() IF nKey == 0 - oVBar:setData( OrdKeyNo() ) + oVBar:setData( ordKeyNo() ) oHBar:setData( oBrowse:colPos ) - DO WHILE ( ( nKey := inkey( , INKEY_ALL + HB_INKEY_GTEVENT ) ) == 0 .or. nKey == K_MOVING ) + DO WHILE ( ( nKey := Inkey( , INKEY_ALL + HB_INKEY_GTEVENT ) ) == 0 .OR. nKey == K_MOVING ) ENDDO ENDIF @@ -219,9 +222,9 @@ FUNCTION ExecBrowser( oCrt ) SetColor( cColor ) SetCursor( nCursor ) - DBCloseArea() + dbCloseArea() IF oCrt == NIL - RestScreen( 0, 0, maxrow(), maxcol(), cScr ) + RestScreen( 0, 0, MaxRow(), MaxCol(), cScr ) ENDIF Wvt_setPopupMenu( hPopup ) SetGT( 2, pGT ) @@ -239,22 +242,22 @@ STATIC FUNCTION BrwHandleResize( oCrt, oBrw, oVBar, oHBar, oCom, oSLE, oLBx, oTr oCrt:setFocus() - oBrw:nBottom := iif( lActiveX, 20, maxrow()-3 ) - oBrw:nRight := maxcol()-4 + oBrw:nBottom := iif( lActiveX, 20, MaxRow() - 3 ) + oBrw:nRight := MaxCol() - 4 oBrw:configure() - DispBox( 0, 0, maxrow(), maxcol(), " ", "N/W" ) - DispOutAt( oBrw:nTop-2, oBrw:nleft-2, padc( cFileDbf, oBrw:nRight - oBrw:nLeft + 5 ), "W+/B*" ) + DispBox( 0, 0, MaxRow(), MaxCol(), " ", "N/W" ) + DispOutAt( oBrw:nTop - 2, oBrw:nleft - 2, PadC( cFileDbf, oBrw:nRight - oBrw:nLeft + 5 ), "W+/B*" ) oVBar:setPosAndSize() oHBar:setPosAndSize() oCom:setPosAndSize() -// oSLE:setPosAndSize() -// oLBx:setPosAndSize() -// oIdx:setPosAndSize() +// oSLE:setPosAndSize() +// oLBx:setPosAndSize() +// oIdx:setPosAndSize() oTre:setPosAndSize() -// oChk:setPosAndSize() +// oChk:setPosAndSize() BrwReposButtons( oCrt ) /* Because we are repositioning at the center of console width */ @@ -277,6 +280,7 @@ STATIC FUNCTION BrwHandleResize( oCrt, oBrw, oVBar, oHBar, oCom, oSLE, oLBx, oTr // STATIC FUNCTION BrwShowColumn( oBrw, cHeading ) + LOCAL i, j, nCur nCur := oBrw:colPos @@ -286,12 +290,12 @@ STATIC FUNCTION BrwShowColumn( oBrw, cHeading ) ENDIF NEXT IF i < nCur - FOR j := nCur-1 TO i STEP -1 - oBrw:left() + FOR j := nCur - 1 TO i STEP -1 + oBrw:Left() NEXT ELSEIF i > nCur - FOR j := nCur+1 TO i - oBrw:right() + FOR j := nCur + 1 TO i + oBrw:Right() NEXT ENDIF oBrw:refreshCurrent() @@ -302,13 +306,14 @@ STATIC FUNCTION BrwShowColumn( oBrw, cHeading ) // STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ ) + LOCAL oTree, oItem1, oItem2 oTree := WvgTreeView():new( oCrt ) oTree:hasLines := .T. oTree:hasButtons := .T. oTree:alwaysShowSelection := .T. - oTree:create( , , { -24, -1 }, { {|| -( maxrow()-1-24 ) }, -10 } ) + oTree:create( , , { -24, -1 }, { {|| -( MaxRow() - 1 - 24 ) }, -10 } ) oTree:setColorFG( "W+" ) oTree:setColorBG( "R*" ) oTree:itemSelected := {| oItem | WVG_MessageBox( , iif( oItem != NIL, oItem:caption, "Some Problem" ) ) } @@ -324,7 +329,7 @@ STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ ) oItem2:addItem( "Third level y" ) oItem2:addItem( "Third level z" ) - oTree:showExpanded( .T., 2 ) + oTree:showExpanded( .T. , 2 ) oTree:setData( oItem2 ) oTree:tooltipText := "Treeview embedded onto CUI window" @@ -334,13 +339,14 @@ STATIC FUNCTION BrwBuildTree( oCrt /*, oBrw*/ ) // STATIC FUNCTION BrwBuildActiveX( oCrt, oBrw ) + LOCAL oCom HB_SYMBOL_UNUSED( oBrw ) - oCom := WvgActiveXControl():new( oCrt, , { -24, -13 }, { {|| -( maxrow()-1-24 ) }, {|| -( maxcol()-1-13 ) } }, , .F. ) + oCom := WvgActiveXControl():new( oCrt, , { -24, -13 }, { {|| -( MaxRow() - 1 - 24 ) }, {|| -( MaxCol() - 1 - 13 ) } }, , .F. ) oCom:CLSID := 'Shell.Explorer.2' - //oCom:mapEvent( 269, {|| uiDebug( ' E X P L O R E R - 2 6 9' ) } ) +// oCom:mapEvent( 269, {|| uiDebug( ' E X P L O R E R - 2 6 9' ) } ) oCom:create() oCom:navigate( "http://hbide.vouch.info" ) @@ -349,10 +355,11 @@ STATIC FUNCTION BrwBuildActiveX( oCrt, oBrw ) // STATIC FUNCTION BrwBuildListBox( oCrt, oBrw ) + LOCAL oXbp, i oXbp := WvgListBox():new( oCrt ) - oXbp:create( , , { -4,-1 }, { -10, -10 }, , .T. ) + oXbp:create( , , { -4, -1 }, { -10, -10 }, , .T. ) oXbp:setColorFG( "W+" ) oXbp:setColorBG( "B*" ) oXbp:itemMarked := {| m1, m2, o | m1 := m1, m2 := m2, BrwShowColumn( oBrw, o:getCurItem() ) } @@ -367,31 +374,34 @@ STATIC FUNCTION BrwBuildListBox( oCrt, oBrw ) // STATIC FUNCTION BrwSetThisOrder( oBrw, nOrd ) - DbSetOrder( nOrd ) + + dbSetOrder( nOrd ) oBrw:refreshAll() oBrw:forceStable() + RETURN NIL // STATIC FUNCTION BrwBuildListBoxIdx( oCrt, oBrw ) + LOCAL oXbp, i, cKey, aIdx := {} FOR i := 1 TO 10 IF ( cKey := IndexKey( i ) ) == "" EXIT ENDIF - aadd( aIdx, OrdName( i ) + ": " + cKey ) + AAdd( aIdx, ordName( i ) + ": " + cKey ) NEXT oXbp := WvgComboBox():new( oCrt ) oXbp:type := WVGCOMBO_DROPDOWN - oXbp:create( , , { -18,-1 }, { -5, -10 }, , .T. ) + oXbp:create( , , { -18, -1 }, { -5, -10 }, , .T. ) oXbp:setColorFG( "W+" ) oXbp:setColorBG( "B*" ) - oXbp:itemMarked := {| m1, m2, o | m1 := m2, BrwSetThisOrder( oBrw, o:XbpListBox:getData()-1 ) } + oXbp:itemMarked := {| m1, m2, o | m1 := m2, BrwSetThisOrder( oBrw, o:XbpListBox:getData() - 1 ) } oXbp:addItem( "Natural Order" ) - FOR i := 1 TO len( aIdx ) + FOR i := 1 TO Len( aIdx ) oXbp:addItem( aIdx[ i ] ) NEXT oXbp:tooltipText := "Click on an index to order database!" @@ -401,6 +411,7 @@ STATIC FUNCTION BrwBuildListBoxIdx( oCrt, oBrw ) // STATIC FUNCTION BrwBuildSLE( oCrt, oBrw ) + LOCAL oXbp oXbp := WvgStatic():new( oCrt ) @@ -415,7 +426,7 @@ STATIC FUNCTION BrwBuildSLE( oCrt, oBrw ) oXbp:create( , , { -16, -1 }, { -1, -10 } ) oXbp:setColorFG( "N" ) oXbp:setColorBG( "BG+" ) - oXbp:returnPressed := {| m1, m2, o | m1:=m1, m2:=m2, BrwShowColumn( oBrw, upper( trim( o:getData() ) ) ) } + oXbp:returnPressed := {| m1, m2, o | m1 := m1, m2 := m2, BrwShowColumn( oBrw, Upper( Trim( o:getData() ) ) ) } oXbp:tooltipText := "Type in a field name and press ENTER" RETURN oXbp @@ -423,6 +434,7 @@ STATIC FUNCTION BrwBuildSLE( oCrt, oBrw ) // STATIC FUNCTION BrwBuildNvg( oCrt, oBrw, oCom ) + LOCAL oLbl, oXbp HB_SYMBOL_UNUSED( oBrw ) @@ -437,10 +449,10 @@ STATIC FUNCTION BrwBuildNvg( oCrt, oBrw, oCom ) oXbp := WvgSLE():new( oCrt ) oXbp:bufferLength := 300 - oXbp:create( , , { -23, -19 }, { -1, {|| -( maxcol()-1-19 ) } }, , .F. ) + oXbp:create( , , { -23, -19 }, { -1, {|| -( MaxCol() - 1 - 19 ) } }, , .F. ) oXbp:setColorFG( "N" ) oXbp:setColorBG( "BG+" ) - oXbp:returnPressed := {| m1, m2, o | m1:=m2, oCom:navigate( trim( o:getData() ) ) } + oXbp:returnPressed := {| m1, m2, o | m1 := m2, oCom:navigate( Trim( o:getData() ) ) } oXbp:tooltipText := "Type-in a http:// address and press ENTER" oXbp:setData( "http://hbide.vouch.info/" ) @@ -449,6 +461,7 @@ STATIC FUNCTION BrwBuildNvg( oCrt, oBrw, oCom ) // STATIC FUNCTION BrwBuildCheckBox( oCrt, oBrw, lActiveX ) + LOCAL oXbp HB_SYMBOL_UNUSED( oBrw ) @@ -458,7 +471,7 @@ STATIC FUNCTION BrwBuildCheckBox( oCrt, oBrw, lActiveX ) oXbp:caption := "ActiveX" oXbp:selected := {| x, y, o | x := y, lActiveX := o:getData(), Wvt_Keyboard( HB_K_RESIZE ) } oXbp:selection := .F. - oXbp:create( , , { -23,-1 }, { -1,-10 } ) + oXbp:create( , , { -23, -1 }, { -1, -10 } ) oXbp:setColorFG( "R+" ) oXbp:setColorBG( "W" ) oXbp:tooltipText := "Naviagate: http://hbide.vouch.info" @@ -468,20 +481,21 @@ STATIC FUNCTION BrwBuildCheckBox( oCrt, oBrw, lActiveX ) // STATIC FUNCTION BrwReposButtons( oCrt ) + LOCAL oXbp, nOff, nTtl, nG, i LOCAL aW := { 10, 10, 10, 10, 10 } nG := 2 nTtl := 0 - aeval( aW, {| e | nTtl += e } ) - nTtl += ( len( aW ) - 1 ) * nG + AEval( aW, {| e | nTtl += e } ) + nTtl += ( Len( aW ) - 1 ) * nG - nOff := ( ( maxcol()+1 ) - nTtl ) / 2 + nOff := ( ( MaxCol() + 1 ) - nTtl ) / 2 i := 0 FOR EACH oXbp IN oCrt:childList() - IF __ObjGetClsName( oXbp ) == "WVGPUSHBUTTON" + IF __objGetClsName( oXbp ) == "WVGPUSHBUTTON" i++ - oXbp:setPosAndSize( { -maxrow(), -nOff }, { -1, -aW[ i ] } ) + oXbp:setPosAndSize( { -MaxRow(), -nOff }, { -1, -aW[ i ] } ) nOff += aW[ i ] + nG ENDIF NEXT @@ -491,33 +505,34 @@ STATIC FUNCTION BrwReposButtons( oCrt ) // STATIC FUNCTION BrwBuildButtons( oCrt, oBrw ) + LOCAL oPB, nOff, nTtl, nG, i LOCAL aPmt := { "Modal Window", "Maximize", "Go Top", "Go Bottom", "Right Most" } LOCAL aAct := { {|| Wvt_Keyboard( K_F3 ) }, ; - {|| Wvt_Keyboard( K_F4 ) }, ; - {|| oBrw:goTop(), oBrw:forceStable() }, ; - {|| oBrw:goBottom(), oBrw:forceStable() }, ; - {|| oBrw:panEnd(), oBrw:forceStable() } } + {|| Wvt_Keyboard( K_F4 ) }, ; + {|| oBrw:goTop(), oBrw:forceStable() }, ; + {|| oBrw:goBottom(), oBrw:forceStable() }, ; + {|| oBrw:panEnd(), oBrw:forceStable() } } LOCAL aW := { 10, 10, 10, 10, 10 } nG := 2 nTtl := 0 - aeval( aW, {| e | nTtl += e } ) - nTtl += ( len( aW ) - 1 ) * nG + AEval( aW, {| e | nTtl += e } ) + nTtl += ( Len( aW ) - 1 ) * nG - nOff := ( ( maxcol()+1 ) - nTtl ) / 2 + nOff := ( ( MaxCol() + 1 ) - nTtl ) / 2 - FOR i := 1 TO len( aPmt ) + FOR i := 1 TO Len( aPmt ) oPB := WvgPushButton():new( oCrt ) IF i == 3 /* We do not want this button to gain focus anytime */ oPB:pointerFocus := .F. ENDIF - IF i == len( aPmt ) - oPB:caption := hb_dirBase() + "\" + "v_lock.bmp" - oPB:create( , , { {|| -maxrow() }, -nOff }, { -1,-aW[ i ] } ) + IF i == Len( aPmt ) + oPB:caption := hb_DirBase() + "\" + "v_lock.bmp" + oPB:create( , , { {|| -MaxRow() }, -nOff }, { -1, -aW[ i ] } ) ELSE oPB:caption := aPmt[ i ] - oPB:create( , , { {|| -maxrow() }, -nOff }, { -1,-aW[ i ] } ) + oPB:create( , , { {|| -MaxRow() }, -nOff }, { -1, -aW[ i ] } ) ENDIF oPB:activate := aAct[ i ] oPB:setColorFG( RGB( 0,255,0 ) ) @@ -532,15 +547,15 @@ STATIC FUNCTION BrwBuildButtons( oCrt, oBrw ) FUNCTION Vou_BrwAddScrollBars( oCrt, oBrw, oVBar, oHBar ) - oHBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nBottom+1 ) }, {|| -( oBrw:nLeft ) } }, ; - { -1, {|| -( oBrw:nRight - oBrw:nLeft + 1 ) } } ) + oHBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nBottom + 1 ) }, {|| -( oBrw:nLeft ) } }, ; + { -1, {|| -( oBrw:nRight - oBrw:nLeft + 1 ) } } ) oHBar:range := { 1, oBrw:colCount } oHBar:type := WVGSCROLL_HORIZONTAL oHBar:create() oHBar:scroll := {| mp1 | oBrw:colPos := mp1[ 1 ], oBrw:refreshCurrent(), oBrw:forceStable() } - oVBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nTop ) }, {|| -( oBrw:nRight+1 ) } }, ; - { {|| -( oBrw:nBottom-oBrw:nTop+1 ) }, {|| -( 2 ) } } ) + oVBar := WvgScrollBar():new( oCrt, , { {|| -( oBrw:nTop ) }, {|| -( oBrw:nRight + 1 ) } }, ; + { {|| -( oBrw:nBottom - oBrw:nTop + 1 ) }, {|| -2 } } ) oVBar:range := { 1, LastRec() } oVBar:type := WVGSCROLL_VERTICAL oVBar:create() @@ -551,29 +566,30 @@ FUNCTION Vou_BrwAddScrollBars( oCrt, oBrw, oVBar, oHBar ) // STATIC FUNCTION BrwBuildMenu( oCrt ) + LOCAL oMenu, oSMenu oMenu := oCrt:menubar() oSMenu := WvgMenu():new( oMenu ):create() - oSMenu:addItem( { '~First' , {|| alert( 'First' ) } } ) - oSMenu:addItem( { '~Second', {|| alert( 'Second' ) } } ) + oSMenu:addItem( { '~First' , {|| Alert( 'First' ) } } ) + oSMenu:addItem( { '~Second', {|| Alert( 'Second' ) } } ) oSMenu:addItem() - oSMenu:addItem( { '~Third' , {|| alert( 'Third' ) } } ) + oSMenu:addItem( { '~Third' , {|| Alert( 'Third' ) } } ) oMenu:addItem( { oSMenu, '~Hello' } ) oSMenu := WvgMenu():new( oMenu ):create() - oSMenu:addItem( { '~First' , {|| alert( 'First' ) } } ) + oSMenu:addItem( { '~First' , {|| Alert( 'First' ) } } ) oSMenu:addItem( '-' ) - oSMenu:addItem( { '~Second', {|| alert( 'Second' ) } } ) - oSMenu:addItem( { '~Third' , {|| alert( 'Third' ) } } ) + oSMenu:addItem( { '~Second', {|| Alert( 'Second' ) } } ) + oSMenu:addItem( { '~Third' , {|| Alert( 'Third' ) } } ) oMenu:addItem( { oSMenu, '~MyFriends' } ) oSMenu := WvgMenu():new( oMenu ):create() oSMenu:title := "~Procedural" oSMenu:addItem( { "Procedure ~1", } ) oSMenu:addItem( { "Procedure ~2", } ) - oSMenu:itemSelected := {| mp1 | MyMenuProcedure( 100+mp1 ) } + oSMenu:itemSelected := {| mp1 | MyMenuProcedure( 100 + mp1 ) } oSMenu:checkItem( 2 ) oMenu:addItem( { oSMenu, NIL } ) @@ -582,9 +598,10 @@ STATIC FUNCTION BrwBuildMenu( oCrt ) // STATIC FUNCTION BrwBuildToolBar( oCrt ) - LOCAL oTBar, nRGB := RGB( 172,172,172 ) - oTBar := WvgToolBar():new( oCrt, , { -0.1,-0.1 }, { -3, {|| -( maxcol()+1 ) } } ) + LOCAL oTBar, nRGB := RGB( 172, 172, 172 ) + + oTBar := WvgToolBar():new( oCrt, , { -0.1, -0.1 }, { -3, {|| -( MaxCol() + 1 ) } } ) oTBar:style := WVGTOOLBAR_STYLE_FLAT oTBar:borderStyle := WVGFRAME_RECT @@ -615,6 +632,7 @@ STATIC FUNCTION BrwBuildToolBar( oCrt ) // STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd ) + LOCAL lVMove := .F. LOCAL lHMove := .F. LOCAL lRet := .T. @@ -697,7 +715,7 @@ STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd ) ENDCASE - IF lHMove .or. lVMove + IF lHMove .OR. lVMove oBrowse:forceStable() ENDIF @@ -706,10 +724,11 @@ STATIC FUNCTION BrwHandleKey( oBrowse, nKey, lEnd ) // FUNCTION Vou_NavigateToCell( oBrowse ) + LOCAL nCount IF LastKey() == K_LBUTTONUP - IF oBrowse:hitTest( mrow(), mcol() ) == -5121 // on a cell + IF oBrowse:HitTest( MRow(), MCol() ) == -5121 // on a cell oBrowse:deHilite() oBrowse:refreshCurrent() oBrowse:forceStable() @@ -717,23 +736,23 @@ FUNCTION Vou_NavigateToCell( oBrowse ) nCount := oBrowse:mRowPos - oBrowse:RowPos DispBegin() - WHILE ( nCount < 0 ) + WHILE nCount < 0 nCount++ oBrowse:Up() ENDDO - WHILE ( nCount > 0 ) + WHILE nCount > 0 nCount -- oBrowse:Down() ENDDO nCount := oBrowse:mColPos - oBrowse:ColPos - WHILE ( nCount < 0 ) + WHILE nCount < 0 nCount++ oBrowse:Left() ENDDO - WHILE ( nCount > 0 ) + WHILE nCount > 0 nCount-- oBrowse:Right() ENDDO @@ -750,16 +769,17 @@ FUNCTION Vou_NavigateToCell( oBrowse ) // STATIC FUNCTION DbSkipBlock( n ) + LOCAL nSkipped := 0 IF n == 0 - DBSkip( 0 ) + dbSkip( 0 ) ELSEIF n > 0 DO WHILE nSkipped != n .AND. TBNext() nSkipped++ - enddo - else + ENDDO + ELSE DO WHILE nSkipped != n .AND. TBPrev() nSkipped-- ENDDO @@ -770,16 +790,17 @@ STATIC FUNCTION DbSkipBlock( n ) // STATIC FUNCTION TBNext() - LOCAL nSaveRecNum := recno() + + LOCAL nSaveRecNum := RecNo() LOCAL lMoved := .T. - IF Eof() + IF EOF() lMoved := .F. ELSE - DBSkip( 1 ) - IF Eof() + dbSkip( 1 ) + IF EOF() lMoved := .F. - DBGoTo( nSaveRecNum ) + dbGoto( nSaveRecNum ) ENDIF ENDIF @@ -788,13 +809,14 @@ STATIC FUNCTION TBNext() // STATIC FUNCTION TBPrev() - LOCAL nSaveRecNum := Recno() + + LOCAL nSaveRecNum := RecNo() LOCAL lMoved := .T. - DBSkip( -1 ) + dbSkip( -1 ) - IF Bof() - DBGoTo( nSaveRecNum ) + IF BOF() + dbGoto( nSaveRecNum ) lMoved := .F. ENDIF @@ -803,7 +825,8 @@ STATIC FUNCTION TBPrev() // STATIC FUNCTION VouBlockField( i ) - RETURN {|| fieldget( i ) } + + RETURN {|| FieldGet( i ) } // @@ -851,17 +874,17 @@ FUNCTION Vou_BrwSetVScroll( mp1, oBrowse ) EXIT CASE WVGSB_NEXTPAGE - OrdKeyGoTo( mp1[ 1 ] ) + ordKeyGoto( mp1[ 1 ] ) oBrowse:refreshAll() EXIT CASE WVGSB_PREVPAGE - OrdKeyGoTo( mp1[ 1 ] ) + ordKeyGoto( mp1[ 1 ] ) oBrowse:refreshAll() EXIT CASE WVGSB_ENDTRACK - OrdKeyGoTo( mp1[ 1 ] ) + ordKeyGoto( mp1[ 1 ] ) oBrowse:refreshAll() EXIT @@ -871,13 +894,13 @@ FUNCTION Vou_BrwSetVScroll( mp1, oBrowse ) RETURN NIL - // /* For brosers inside WvtDialog() */ // STATIC FUNCTION BrwOnEvent( oWvtBrw, cPaintID, oBrowse, nKey ) - LOCAL lRet := .T., lRefAll := .F. + + LOCAL lRet := .T. , lRefAll := .F. HB_SYMBOL_UNUSED( cPaintID ) @@ -935,7 +958,7 @@ STATIC FUNCTION BrwOnEvent( oWvtBrw, cPaintID, oBrowse, nKey ) oBrowse:up() CASE nKey == K_SBTHUMBTRACKVERT - OrdKeyGoTo( oWvtBrw:oVBar:GetPos() ) + ordKeyGoto( oWvtBrw:oVBar:GetPos() ) lRefAll := .T. CASE nKey == K_SBTHUMBTRACKHORZ @@ -948,22 +971,22 @@ STATIC FUNCTION BrwOnEvent( oWvtBrw, cPaintID, oBrowse, nKey ) oBrowse:down() CASE nKey == K_SBPAGEUP - oBrowse:pageUp() + oBrowse:pageUp() CASE nKey == K_SBPAGEDOWN oBrowse:pageDown() CASE nKey == K_SBLINELEFT - oBrowse:left() + oBrowse:Left() CASE nKey == K_SBLINERIGHT - oBrowse:right() + oBrowse:Right() CASE nKey == K_SBPAGELEFT - oBrowse:left() + oBrowse:Left() CASE nKey == K_SBPAGERIGHT - oBrowse:right() + oBrowse:Right() OTHERWISE lRet := .F. @@ -976,8 +999,8 @@ STATIC FUNCTION BrwOnEvent( oWvtBrw, cPaintID, oBrowse, nKey ) ENDIF oBrowse:forceStable() - oWvtBrw:oVBar:setPos( OrdKeyCount(),OrdKeyNo() ) - oWvtBrw:oHBar:setPos( oBrowse:ColCount, oBrowse:ColPos ) + oWvtBrw:oVBar:SetPos( ordKeyCount(), ordKeyNo() ) + oWvtBrw:oHBar:SetPos( oBrowse:ColCount, oBrowse:ColPos ) ENDIF RETURN lRet @@ -985,18 +1008,19 @@ STATIC FUNCTION BrwOnEvent( oWvtBrw, cPaintID, oBrowse, nKey ) // FUNCTION ConfigBrowser( aFields, cUseAlias, aTLBR, cDesc, oParent, cColorSpec, nID ) + LOCAL info_, oWvtBrw, oBrowse, i, bBlock LOCAL aPopup := {} - aadd( aPopup, { "Down" , {|| oBrowse:Down() , oBrowse:ForceStable() } } ) - aadd( aPopup, { "Up" , {|| oBrowse:Up() , oBrowse:ForceStable() } } ) - aadd( aPopup, { "Page Down", {|| oBrowse:PageDown(), oBrowse:ForceStable() } } ) - aadd( aPopup, { "Page Up" , {|| oBrowse:PageUp() , oBrowse:ForceStable() } } ) - aadd( aPopup, { "Top" , {|| oBrowse:GoTop() , oBrowse:ForceStable() } } ) - aadd( aPopup, { "Bottom" , {|| oBrowse:GoBottom(), oBrowse:ForceStable() } } ) + AAdd( aPopup, { "Down" , {|| oBrowse:Down() , oBrowse:ForceStable() } } ) + AAdd( aPopup, { "Up" , {|| oBrowse:Up() , oBrowse:ForceStable() } } ) + AAdd( aPopup, { "Page Down", {|| oBrowse:PageDown(), oBrowse:ForceStable() } } ) + AAdd( aPopup, { "Page Up" , {|| oBrowse:PageUp() , oBrowse:ForceStable() } } ) + AAdd( aPopup, { "Top" , {|| oBrowse:GoTop() , oBrowse:ForceStable() } } ) + AAdd( aPopup, { "Bottom" , {|| oBrowse:GoBottom(), oBrowse:ForceStable() } } ) - Select( cUseAlias ) - info_:= DbStruct() + SELECT( cUseAlias ) + info_ := dbStruct() oBrowse := TBrowseWVG():New( aTLBR[ 1 ], aTLBR[ 2 ], aTLBR[ 3 ], aTLBR[ 4 ] ) @@ -1005,16 +1029,16 @@ FUNCTION ConfigBrowser( aFields, cUseAlias, aTLBR, cDesc, oParent, cColorSpec, n oBrowse:ColorSpec := cColorSpec oBrowse:GoTopBlock := {|| dbGoTop() } oBrowse:GoBottomBlock := {|| dbGoBottom() } - oBrowse:SkipBlock := {| nSkip | dbSkipBlock( nSkip,oBrowse ) } + oBrowse:SkipBlock := {| nSkip | dbSkipBlock( nSkip, oBrowse ) } - FOR i := 1 TO len( aFields ) + FOR i := 1 TO Len( aFields ) bBlock := VouBlockField( aFields[ i ] ) oBrowse:AddColumn( TBColumnNew( info_[ aFields[ i ],1 ], bBlock ) ) NEXT oBrowse:configure() - oWvtBrw := WvtBrowse():New( oParent,nID ) + oWvtBrw := WvtBrowse():New( oParent, nID ) oWvtBrw:nTop := aTLBR[ 1 ] oWvtBrw:nLeft := aTLBR[ 2 ] @@ -1028,7 +1052,7 @@ FUNCTION ConfigBrowser( aFields, cUseAlias, aTLBR, cDesc, oParent, cColorSpec, n oWvtBrw:Tooltip := cDesc oWvtBrw:aPopup := aPopup - oWvtBrw:bHandleEvent := {| oWvtBrw, cPaintID, oBrowse, nKey | BrwOnEvent( oWvtBrw,cPaintID,oBrowse,nKey ) } + oWvtBrw:bHandleEvent := {| oWvtBrw, cPaintID, oBrowse, nKey | BrwOnEvent( oWvtBrw, cPaintID, oBrowse, nKey ) } RETURN oWvtBrw diff --git a/harbour/contrib/gtwvg/tests/utils.prg b/harbour/contrib/gtwvg/tests/utils.prg index 539e6a6449..4c70287ec2 100644 --- a/harbour/contrib/gtwvg/tests/utils.prg +++ b/harbour/contrib/gtwvg/tests/utils.prg @@ -5,6 +5,7 @@ /* * Pritpal Bedi */ + // #include "inkey.ch" @@ -48,7 +49,7 @@ // -THREAD STATIC t_keys_:= { , , , , , , , , , , , , , , , , , , , } +THREAD STATIC t_keys_ := { , , , , , , , , , , , , , , , , , , , } THREAD STATIC t_pic_ := { , , , , , , , , , , , , , , , , , , , } // @@ -64,7 +65,7 @@ FUNCTION WvtSetKeys( lSet ) t_keys_[ 7 ] := SetKey( K_F7, {|| WvtPartialScreen() } ) t_keys_[ 8 ] := SetKey( K_F8, {|| WvtLines() } ) t_keys_[ 9 ] := SetKey( K_F9, {|| Wvt_ChooseFont() } ) - t_keys_[ 10] := SetKey( K_F10,{|| Wvt_ChooseColor() } ) + t_keys_[ 10] := SetKey( K_F10, {|| Wvt_ChooseColor() } ) ELSE SetKey( K_F2, t_keys_[ 2 ] ) SetKey( K_F3, t_keys_[ 3 ] ) @@ -77,51 +78,61 @@ FUNCTION WvtSetKeys( lSet ) SetKey( K_F10, t_keys_[ 10] ) ENDIF - RETURN Nil + RETURN NIL + // // Wvt_Paint() must be a FUNCTION in your application // as it is called when Window gets WM_PAINT message. // + FUNCTION Wvt_Paint() + LOCAL aBlocks := WvtSetBlocks() - aEval( aBlocks, {| e | eval( e ) } ) + AEval( aBlocks, {| e | Eval( e ) } ) WvtPaintObjects() RETURN 0 + // // Wvt_SetFocus() must be a FUNCTION in your application // needs to process messages sent through WM_SETFOCUS message // received by the window. // #if 0 + FUNCTION Wvt_SetFocus() - LOCAL nRow := row() - LOCAL nCol := col() + LOCAL nRow := Row() + LOCAL nCol := Col() - DispOutAt( 1,3, "Focus Gained!", "R/W" ) + DispOutAt( 1, 3, "Focus Gained!", "R/W" ) DevPos( nRow, nCol ) - RETURN nil + RETURN NIL + #endif + // // Wvt_KillFocus() must be a FUNCTION in your application // needs to process messages sent through WM_KILLFOCUS message // received by the window. // #if 0 -FUNCTION Wvt_KillFocus() - LOCAL nRow := row() - LOCAL nCol := col() - DispOutAt( 1,3, "Focus Lost...", "B/W" ) +FUNCTION Wvt_KillFocus() + + LOCAL nRow := Row() + LOCAL nCol := Col() + + DispOutAt( 1, 3, "Focus Lost...", "B/W" ) DevPos( nRow, nCol ) RETURN NIL + #endif // @@ -132,13 +143,14 @@ FUNCTION Wvt_KillFocus() // FUNCTION Wvt_Mouse( nKey, nRow, nCol ) + LOCAL nLen, aObjects := WvtSetObjects() LOCAL nObj - STATIC nLastObj := 0 - STATIC nLastKey := 0 + STATIC s_nLastObj := 0 + STATIC s_nLastKey := 0 - IF ( nLen := len( aObjects ) ) == 0 + IF ( nLen := Len( aObjects ) ) == 0 RETURN NIL ENDIF @@ -150,13 +162,13 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol ) FOR nObj := 1 TO nLen DO CASE CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_DISP - eval( aObjects[ nObj, WVT_OBJ_ONDISP ] ) + Eval( aObjects[ nObj, WVT_OBJ_ONDISP ] ) CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_MOUSEOVER - eval( aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] ) + Eval( aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] ) CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_BUTTONDOWN - eval( aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] ) + Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] ) CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_BUTTONUP - eval( aObjects[ nObj, WVT_OBJ_ONDISP ] ) + Eval( aObjects[ nObj, WVT_OBJ_ONDISP ] ) CASE aObjects[ nObj, WVT_OBJ_STATE ] == OBJ_STATE_HIDE ENDCASE @@ -164,45 +176,45 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol ) RETURN NIL ENDIF - nObj := ascan( aObjects, {| e_ | e_[ WVT_OBJ_ROW ] <= nRow .AND. ; - e_[ WVT_OBJ_ROWTO ] >= nRow .AND. ; - e_[ WVT_OBJ_COL ] <= nCol .AND. ; - e_[ WVT_OBJ_COLTO ] >= nCol } ) + nObj := AScan( aObjects, {| e_ | e_[ WVT_OBJ_ROW ] <= nRow .AND. ; + e_[ WVT_OBJ_ROWTO ] >= nRow .AND. ; + e_[ WVT_OBJ_COL ] <= nCol .AND. ; + e_[ WVT_OBJ_COLTO ] >= nCol } ) IF nObj == 0 - IF nLastObj > 0 - aObjects[ nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_DISP - eval( aObjects[ nLastObj, WVT_OBJ_ONDISP ] ) - nLastObj := 0 + IF s_nLastObj > 0 + aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_DISP + Eval( aObjects[ s_nLastObj, WVT_OBJ_ONDISP ] ) + s_nLastObj := 0 ENDIF RETURN NIL ENDIF - IF nLastObj == nObj .and. nLastKey == nKey + IF s_nLastObj == nObj .AND. s_nLastKey == nKey RETURN NIL ENDIF - nLastObj := nObj - nLastKey := nKey + s_nLastObj := nObj + s_nLastKey := nKey DO CASE CASE nKey == K_MOUSEMOVE - IF aObjects[ nLastObj, WVT_OBJ_STATE ] != OBJ_STATE_MOUSEOVER - aObjects[ nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_MOUSEOVER - IF aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] != nil - eval( aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] ) + IF aObjects[ s_nLastObj, WVT_OBJ_STATE ] != OBJ_STATE_MOUSEOVER + aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_MOUSEOVER + IF aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] != NIL + Eval( aObjects[ nObj, WVT_OBJ_ONMOUSEOVER ] ) ENDIF ENDIF CASE nKey == K_LBUTTONDOWN - aObjects[ nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_BUTTONDOWN - IF aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] != nil - eval( aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] ) + aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_BUTTONDOWN + IF aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] != NIL + Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONDOWN ] ) ENDIF CASE nKey == K_LBUTTONUP - aObjects[ nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_DISP - IF aObjects[ nObj, WVT_OBJ_ONBUTTONUP ] != nil - eval( aObjects[ nObj, WVT_OBJ_ONBUTTONUP ] ) + aObjects[ s_nLastObj, WVT_OBJ_STATE ] := OBJ_STATE_DISP + IF aObjects[ nObj, WVT_OBJ_ONBUTTONUP ] != NIL + Eval( aObjects[ nObj, WVT_OBJ_ONBUTTONUP ] ) ENDIF ENDCASE @@ -214,13 +226,15 @@ FUNCTION Wvt_Mouse( nKey, nRow, nCol ) // FUNCTION WvtSetBlocks( a_ ) + LOCAL o + THREAD STATIC t := {} - o := aclone( t ) + o := AClone( t ) - IF a_ != nil - t := aclone( a_ ) + IF a_ != NIL + t := AClone( a_ ) ENDIF RETURN o @@ -230,24 +244,25 @@ FUNCTION WvtSetBlocks( a_ ) // FUNCTION WvtSetObjects( aObject ) + LOCAL oObjects - THREAD STATIC aObjects := {} + THREAD STATIC t_aObjects := {} - oObjects := aclone( aObjects ) + oObjects := AClone( t_aObjects ) IF aObject != NIL - IF empty( aObject ) - aObjects := {} + IF Empty( aObject ) + t_aObjects := {} ELSE - IF valtype( aObject[ 1 ] ) == "A" - aeval( aObject, {| e_ | aadd( aObjects, e_ ) } ) + IF ValType( aObject[ 1 ] ) == "A" + AEval( aObject, {| e_ | AAdd( t_aObjects, e_ ) } ) ELSE - aSize( aObject, WVT_OBJ_VRBLS ) + ASize( aObject, WVT_OBJ_VRBLS ) DEFAULT aObject[ WVT_OBJ_STATE ] TO OBJ_STATE_DISP - aadd( aObjects, aObject ) + AAdd( t_aObjects, aObject ) ENDIF ENDIF ENDIF @@ -257,44 +272,49 @@ FUNCTION WvtSetObjects( aObject ) // FUNCTION SetMouseCheck( lYes ) + LOCAL lOYes - STATIC lSYes := .T. - lOYes := lSYes + STATIC s_lSYes := .T. + + lOYes := s_lSYes IF lYes != NIL - lSYes := lYes + s_lSYes := lYes ENDIF + RETURN lOYes // FUNCTION WvtWindowExpand( nUnits ) - STATIC sUnits := 18 + STATIC s_nUnits := 18 - sUnits += nUnits + s_nUnits += nUnits - Wvt_setFont( "Courier New", sUnits ) + Wvt_setFont( "Courier New", s_nUnits ) RETURN .T. // -FUNCTION rgb( r,g,b ) +FUNCTION rgb( r, g, b ) + RETURN r + ( g * 256 ) + ( b * 256 * 256 ) // FUNCTION VouChoice( aChoices ) + LOCAL scr, clr, nChoice - DEFAULT aChoices TO { "One","Two","Three","Four","Five","Six","Seven" } + DEFAULT aChoices TO { "One", "Two", "Three", "Four", "Five", "Six", "Seven" } - scr := SaveScreen( 7,48,13,55 ) + scr := SaveScreen( 7, 48, 13, 55 ) clr := SetColor( "N/W*,GR+/B*,,,GR+/B" ) - nChoice := aChoice( 7, 48, 13, 55, aChoices ) + nChoice := AChoice( 7, 48, 13, 55, aChoices ) - setColor( clr ) + SetColor( clr ) RestScreen( 7, 48, 13, 55, scr ) RETURN nChoice @@ -302,28 +322,33 @@ FUNCTION VouChoice( aChoices ) // FUNCTION Hb_Clear() + CLS + RETURN .F. // FUNCTION MyMenuProcedure( nID ) + DO CASE CASE nID == 101 - alert( 'Procedure 101' ) + Alert( 'Procedure 101' ) CASE nID == 102 - alert( 'Procedure 102' ) + Alert( 'Procedure 102' ) ENDCASE + RETURN .T. // FUNCTION BuildWvgToolBar( oDA, nActiveX ) + LOCAL oTBar DEFAULT nActiveX TO 0 - oTBar := WvgToolBar():new( oDA, , { 0,0 }, { oDA:currentSize()[ 1 ], 30 }, , .T. ) + oTBar := WvgToolBar():new( oDA, , { 0, 0 }, { oDA:currentSize()[ 1 ], 30 }, , .T. ) oTBar:style := WVGTOOLBAR_STYLE_FLAT oTBar:borderStyle := WVGFRAME_RECT @@ -352,43 +377,53 @@ FUNCTION BuildWvgToolBar( oDA, nActiveX ) // FUNCTION SetGT( nIndex, pGT ) + LOCAL oldGT - STATIC pGT_:= { NIL, NIL, NIL } - oldGT := pGT_[ nIndex ] + STATIC s_pGT_ := { NIL, NIL, NIL } + + oldGT := s_pGT_[ nIndex ] IF PCount() == 2 - pGT_[ nIndex ] := pGT + s_pGT_[ nIndex ] := pGT ENDIF + RETURN oldGT // FUNCTION SetFonts( hFont ) + LOCAL oldFont + THREAD STATIC t_ahFonts := {} oldFont := t_ahFonts - IF !empty( hFont ) - aadd( t_ahFonts, hFont ) + IF !Empty( hFont ) + AAdd( t_ahFonts, hFont ) ENDIF + RETURN oldFont // FUNCTION SetIcons( hIcon ) + LOCAL oldIcon + THREAD STATIC t_ahIcons := {} oldIcon := t_ahIcons - IF !empty( hIcon ) - aadd( t_ahIcons, hIcon ) + IF !Empty( hIcon ) + AAdd( t_ahIcons, hIcon ) ENDIF + RETURN oldIcon // FUNCTION Popups( nID, lDestroy ) - LOCAL hPop, hPop1 - LOCAL nPrompt := MF_ENABLED+MF_STRING - THREAD STATIC hPop_:= { , , , , , , , , } + LOCAL hPop, hPop1 + LOCAL nPrompt := MF_ENABLED + MF_STRING + + THREAD STATIC t_hPop_ := { , , , , , , , , } IF nID == NIL Wvt_SetPopupMenu() @@ -396,16 +431,16 @@ FUNCTION Popups( nID, lDestroy ) ENDIF IF lDestroy != NIL - Wvt_DestroyMenu( hPop_[ nID ] ) + Wvt_DestroyMenu( t_hPop_[ nID ] ) RETURN NIL ENDIF - hPop := hPop_[ nID ] + hPop := t_hPop_[ nID ] DO CASE CASE nID == 1 // Data Entry Module - IF hPop == nil + IF hPop == NIL hPop := Wvt_CreatePopupMenu() Wvt_AppendMenu( hPop, nPrompt, K_F2, "Second Get Screen" ) Wvt_AppendMenu( hPop, nPrompt, K_F3, "Expand Window" ) @@ -415,7 +450,7 @@ FUNCTION Popups( nID, lDestroy ) Wvt_AppendMenu( hPop, nPrompt, K_F7, "Partial Screen" ) Wvt_AppendMenu( hPop, nPrompt, K_F8, "Lines" ) Wvt_AppendMenu( hPop, nPrompt, K_F9, "Choose Font" ) - Wvt_AppendMenu( hPop, nPrompt, K_F10,"Choose Color" ) + Wvt_AppendMenu( hPop, nPrompt, K_F10, "Choose Color" ) Wvt_AppendMenu( hPop, MF_SEPARATOR ) @@ -442,31 +477,32 @@ FUNCTION Popups( nID, lDestroy ) Wvt_AppendMenu( hPop1, nPrompt, K_END , "End" ) Wvt_AppendMenu( hPop1, nPrompt, K_HOME , "Home" ) - Wvt_AppendMenu( hPop, MF_ENABLED+MF_POPUP, hPop1, "Column Movement" ) + Wvt_AppendMenu( hPop, MF_ENABLED + MF_POPUP, hPop1, "Column Movement" ) ENDIF ENDCASE - hPop_[ nID ] := hPop + t_hPop_[ nID ] := hPop - RETURN Wvt_SetPopupMenu( hPop_[ nID ] ) + RETURN Wvt_SetPopupMenu( t_hPop_[ nID ] ) // FUNCTION DispStatusMsg( cMsg ) - Wvt_DrawLabel( MaxRow(), 60, cMsg, 6, , 0, rgb(198,198,198), "Arial", 18, , 900 ) + Wvt_DrawLabel( MaxRow(), 60, cMsg, 6, , 0, rgb( 198,198,198 ), "Arial", 18, , 900 ) RETURN .T. // FUNCTION ClearStatusMsg() + LOCAL nRow := Row() LOCAL nCol := Col() - DispOutAt( MaxRow(), 42, space( 37 ), "W/W" ) + DispOutAt( MaxRow(), 42, Space( 37 ), "W/W" ) SetPos( nRow, nCol ) @@ -474,9 +510,9 @@ FUNCTION ClearStatusMsg() // -FUNCTION WvtPictures( nSlot,cFilePic ) +FUNCTION WvtPictures( nSlot, cFilePic ) - IF nSlot != NIL .AND. nSlot <= 20 .AND. file( cFilePic ) + IF nSlot != NIL .AND. nSlot <= 20 .AND. File( cFilePic ) IF !( t_pic_[ nSlot ] == cFilePic ) IF Wvt_LoadPicture( cFilePic, nSlot ) t_pic_[ nSlot ] := cFilePic @@ -499,15 +535,17 @@ FUNCTION WvtExePicture( nTop, nLeft, nBottom, nRight, nSlot, aOffset ) // FUNCTION GetResource( cName ) - RETURN hb_dirBase() + cName + + RETURN hb_DirBase() + cName // FUNCTION uiDebug( ... ) - LOCAL aP := hb_aParams() + + LOCAL aP := hb_AParams() LOCAL s := "" - aeval( aP, {| e | s += hb_valTOstr( e ) + " " } ) + AEval( aP, {| e | s += hb_ValToStr( e ) + " " } ) WAPI_OutputDebugString( s ) @@ -520,11 +558,11 @@ FUNCTION MyError( oError ) ? oError:description ? oError:operation - ? procname( 1 ), procline( 1 ) - ? procname( 2 ), procline( 2 ) - ? procname( 3 ), procline( 3 ) - ? procname( 4 ), procline( 4 ) - DO WHILE inkey() != K_ESC + ? ProcName( 1 ), ProcLine( 1 ) + ? ProcName( 2 ), ProcLine( 2 ) + ? ProcName( 3 ), ProcLine( 3 ) + ? ProcName( 4 ), ProcLine( 4 ) + DO WHILE Inkey() != K_ESC ENDDO RETURN NIL diff --git a/harbour/contrib/gtwvg/tests/wvtcls.prg b/harbour/contrib/gtwvg/tests/wvtcls.prg index 1077612214..7a1b4491c3 100644 --- a/harbour/contrib/gtwvg/tests/wvtcls.prg +++ b/harbour/contrib/gtwvg/tests/wvtcls.prg @@ -11,6 +11,7 @@ * * Pritpal Bedi */ + // #include "inkey.ch" @@ -23,32 +24,35 @@ // FUNCTION DialogWvgClassesOne( nMode ) - Local bBlock - if hb_mtvm() - if nMode == 2 + LOCAL bBlock + + IF hb_mtvm() + IF nMode == 2 MyDialogOne() - else + ELSE bBlock := {| oCrt | ; - oCrt := WvgCrt():New( , , { -1,-1 }, { 54,184 }, , .F. ), ; - oCrt:fontName := 'Courier',; - oCrt:fontHeight := 13 ,; - oCrt:fontWidth := 0 ,; - oCrt:Create() ,; - MyDialogOne( oCrt ) ,; - oCrt:destroy() ; - } + oCrt := WvgCrt():New( , , { -1, -1 }, { 54, 184 }, , .F. ), ; + oCrt:fontName := 'Courier', ; + oCrt:fontHeight := 13 , ; + oCrt:fontWidth := 0 , ; + oCrt:Create() , ; + MyDialogOne( oCrt ) , ; + oCrt:destroy() ; + } hb_threadStart( bBlock ) - endif - else + ENDIF + ELSE MyDialogOne() - endif + ENDIF + RETURN NIL // STATIC FUNCTION MyDialogOne( oCrt ) - LOCAL aObjects:= WvtSetBlocks( {} ) + + LOCAL aObjects := WvtSetBlocks( {} ) LOCAL nWinRows, nWinCols, cWinTitle, cFont, nHeight LOCAL oDlg, oBar, cUseAlias LOCAL oText, oTBar, aImg_, oImg, oLine, oBox, oBtn, oBtn2 @@ -56,7 +60,7 @@ STATIC FUNCTION MyDialogOne( oCrt ) LOCAL oBRsd, cTxt, oRct, nGetCol, nSayCol, bBlock, bBlock1 LOCAL oWvtBrw, oWvtBrw1, lOpen, lOpen1, cUseAlias1, oGetArea, oGet1 LOCAL hPopup, nGetRow, aGets_, lChkMouse - LOCAL g_oMenuBar, oPBar2,oPBar3, oMenu + LOCAL g_oMenuBar, oPBar2, oPBar3, oMenu HB_SYMBOL_UNUSED( oCrt ) @@ -75,13 +79,13 @@ STATIC FUNCTION MyDialogOne( oCrt ) cTxt := cTxt + "Enjoy - Pritpal Bedi, INDIA" aImg_ := {} - aadd( aImg_, GetResource( "v_lock.bmp" ) ) - aadd( aImg_, GetResource( "v_new.bmp" ) ) - aadd( aImg_, GetResource( "v_clclt.bmp" ) ) - aadd( aImg_, GetResource( "v_calend.bmp" ) ) - aadd( aImg_, GetResource( "v_index.bmp" ) ) - aadd( aImg_, GetResource( "v_notes1.bmp" ) ) - aadd( aImg_, GetResource( "v_selct1.bmp" ) ) + AAdd( aImg_, GetResource( "v_lock.bmp" ) ) + AAdd( aImg_, GetResource( "v_new.bmp" ) ) + AAdd( aImg_, GetResource( "v_clclt.bmp" ) ) + AAdd( aImg_, GetResource( "v_calend.bmp" ) ) + AAdd( aImg_, GetResource( "v_index.bmp" ) ) + AAdd( aImg_, GetResource( "v_notes1.bmp" ) ) + AAdd( aImg_, GetResource( "v_selct1.bmp" ) ) ? '.' Wvt_ShowWindow( 1 ) nWinRows := 55 @@ -92,10 +96,10 @@ STATIC FUNCTION MyDialogOne( oCrt ) oDlg := WvtDialog():New( nWinRows, nWinCols, cWinTitle, cFont, nHeight ) oDlg:nTooltipWidth := 300 - oDlg:nTooltipTextColor := RGB( 255,0,0 ) + oDlg:nTooltipTextColor := RGB( 255, 0, 0 ) - oBar := WvtStatusBar():New( oDlg,201 ) - oBar:SetPanels( { 50,100 } ) + oBar := WvtStatusBar():New( oDlg, 201 ) + oBar:SetPanels( { 50, 100 } ) oBar:SetText( 1, "Tab.SH_Tab.Left_Click - Select a Browse" ) oBar:SetText( 2, "GtWvt is Fantastic", "w+/W" ) oBar:SetText( 3, "WOW" ) @@ -103,11 +107,11 @@ STATIC FUNCTION MyDialogOne( oCrt ) oBar:Tooltip := "GtWvt Statusbar with 3 panels" oDlg:AddObject( oBar ) - oBox := WvtStatic():New( oDlg,110,4,oDlg:MaxCol()-40,7,oDlg:MaxCol()-2 ) + oBox := WvtStatic():New( oDlg, 110, 4, oDlg:MaxCol() - 40, 7, oDlg:MaxCol() - 2 ) oBox:nStatic := WVT_STATIC_BOXRECESSED oDlg:AddObject( oBox ) - oText := WvtLabel():New( oDlg, 101, 4, oDlg:MaxCol()-40, 7,oDlg:MaxCol()-2 ) + oText := WvtLabel():New( oDlg, 101, 4, oDlg:MaxCol() - 40, 7, oDlg:MaxCol() - 2 ) oText:Text := "Harbour" oText:nFontHeight := 36 oText:nAlignHorz := 2 @@ -122,12 +126,12 @@ STATIC FUNCTION MyDialogOne( oCrt ) oText:bOnSelect := {|| .T. } oDlg:AddObject( oText ) - oImg := WvtImage():New( oDlg,102,20,oDlg:MaxCol()-40,37,oDlg:MaxCol()-2 ) + oImg := WvtImage():New( oDlg, 102, 20, oDlg:MaxCol() - 40, 37, oDlg:MaxCol() - 2 ) oImg:cImage := aImg_[ 5 ] oImg:Tooltip := "WvtImage():New()" oDlg:AddObject( oImg ) - oTBar := WvtToolbar():New( oDlg,103, 0,0,2 ) + oTBar := WvtToolbar():New( oDlg, 103, 0, 0, 2 ) oTBar:lFloating := .F. oTBar:Tooltip := "Toolbar" oTBar:AddButton( aImg_[ 1 ], {|| oImg:SetImage( aImg_[ 1 ] ) } , "Lock" ) @@ -145,11 +149,11 @@ STATIC FUNCTION MyDialogOne( oCrt ) oLine:nStatic := WVT_STATIC_LINE oDlg:AddObject( oLine ) - oBBox := WvtStatic():New( oDlg,125,4,127,37,139 ) + oBBox := WvtStatic():New( oDlg, 125, 4, 127, 37, 139 ) oBBox:nStatic := WVT_STATIC_BOXGROUP oDlg:AddObject( oBBox ) - oBtn := WvtPushButton():New(oDlg, 124, 6, 129, 7, 137 ) + oBtn := WvtPushButton():New( oDlg, 124, 6, 129, 7, 137 ) oBtn:cCaption := "Print" oBtn:bOnLeftUp := {|| Wvt_Keyboard( 379 ) } oBtn:Tooltip := "Open Printing Dialog for the Browser in Focus" @@ -162,7 +166,7 @@ STATIC FUNCTION MyDialogOne( oCrt ) oDlg:AddObject( oBtn2 ) oPBar2 := WvtProgressBar():New( oDlg, , 14, 129, 25, 137 ) - oPBar2:nBarColor := RGB( 240,240,0 ) + oPBar2:nBarColor := RGB( 240, 240, 0 ) oPBar2:cBackColor := "W/N*" oPBar2:lVertical := .T. oPBar2:nDirection := 0 @@ -170,14 +174,14 @@ STATIC FUNCTION MyDialogOne( oCrt ) oDlg:AddObject( oPBar2 ) oPBar3 := WvtProgressBar():New( oDlg, , 26, 129, 36, 137 ) - oPBar3:nBarColor := RGB( 240,240,0 ) + oPBar3:nBarColor := RGB( 240, 240, 0 ) oPBar3:cBackColor := "W/N*" oPBar3:lVertical := .T. oPBar3:nDirection := 1 oPBar3:cImage := GetResource( "vouch1.bmp" ) oDlg:AddObject( oPBar3 ) - oBBox2 := WvtStatic():New( oDlg, , 9, oDlg:MaxCol()-40, 18, oDlg:Maxcol()-2 ) + oBBox2 := WvtStatic():New( oDlg, , 9, oDlg:MaxCol() - 40, 18, oDlg:MaxCol() - 2 ) oBBox2:nStatic := WVT_STATIC_BOXGROUP oDlg:AddObject( oBBox2 ) @@ -185,55 +189,55 @@ STATIC FUNCTION MyDialogOne( oCrt ) oDlg:AddObject( oCon ) nGetCol := 158 - bBlock := {|| oCon:Say( 12, 148, "Name" ,"N/W" ),; - oCon:Say( 14, 148, "Date" ,"N/W" ),; - oCon:Say( 16, 148, "Amount","N/W" ) } + bBlock := {|| oCon:Say( 12, 148, "Name" , "N/W" ), ; + oCon:Say( 14, 148, "Date" , "N/W" ), ; + oCon:Say( 16, 148, "Amount", "N/W" ) } - oGet := WvtGets():New( oDlg, 210, 9, oDlg:Maxcol()-40, 18, oDlg:Maxcol()-2 ) - oGet:AddGets( 12, nGetCol, "GTWvt ", "@! ","W+/B*,N/W*" ) - oGet:AddGets( 14, nGetCol, date() ) - oGet:AddGets( 16, nGetCol, 2122.57, "@Z 99999999.99","w+/R,GR+/B" ) + oGet := WvtGets():New( oDlg, 210, 9, oDlg:MaxCol() - 40, 18, oDlg:MaxCol() - 2 ) + oGet:AddGets( 12, nGetCol, "GTWvt ", "@! ", "W+/B*,N/W*" ) + oGet:AddGets( 14, nGetCol, Date() ) + oGet:AddGets( 16, nGetCol, 2122.57, "@Z 99999999.99", "w+/R,GR+/B" ) oGet:Tooltip := "WvtGets():New() - ReadModal() like Clipper" oGet:cDesc := "Normal Get Box" oGet:bOnCreate := bBlock oDlg:AddObject( oGet ) - oBnr := WvtBanner():New( oDlg, 101, 0, 127, 1, oDlg:MaxCol()-2 ) + oBnr := WvtBanner():New( oDlg, 101, 0, 127, 1, oDlg:MaxCol() - 2 ) oBnr:nTimeDelay := 0.25 oBnr:cText := "the compiler that EXTENDS with you" oBnr:nFontHeight := 24 oBnr:nFontWeight := 0 oBnr:nDirection := 0 oBnr:nAlignVert := 2 - oBnr:nTextColor := RGB( 253,251,170 ) - oBnr:nBackColor := RGB( 128,227,142 ) - oBnr:nTextColorHoverOn := RGB( 255,255, 0 ) - oBnr:nBackColorHoverOn := RGB( 255,100, 12 ) + oBnr:nTextColor := RGB( 253, 251, 170 ) + oBnr:nBackColor := RGB( 128, 227, 142 ) + oBnr:nTextColorHoverOn := RGB( 255, 255, 0 ) + oBnr:nBackColorHoverOn := RGB( 255, 100, 12 ) oBnr:Tooltip := "WvtBanner():New()" oDlg:AddObject( oBnr ) - oBRsd := WvtStatic():New( oDlg, , 41,127,52,oDlg:MaxCol()-2 ) + oBRsd := WvtStatic():New( oDlg, , 41, 127, 52, oDlg:MaxCol() - 2 ) oBRsd:nStatic := WVT_STATIC_BOXGROUPRAISED oDlg:AddObject( oBRsd ) - oRct := WvtStatic():New( oDlg, , 41,127,52,oDlg:MaxCol()-2 ) + oRct := WvtStatic():New( oDlg, , 41, 127, 52, oDlg:MaxCol() - 2 ) oRct:nStatic := WVT_STATIC_SHADEDRECT oRct:aRGBb := { 0xffff, 0x0000, 0x0000, 0x0000 } oRct:aRGBe := { 0x0000, 0xffff, 0xffff, 0x0000 } oDlg:AddObject( oRct ) - oTBx := WvtTextBox():New( oDlg, , 42,129,51,oDlg:MaxCol()-4 ) + oTBx := WvtTextBox():New( oDlg, , 42, 129, 51, oDlg:MaxCol() - 4 ) oTBx:cText := cTxt oTBx:Tooltip := "WvtTextBox():New()" oTBx:nFontHeight := 16 oTBx:lItalic := .T. oTBx:lUnderline := .T. oTBx:nAlignHorz := 2 - oTBx:nTextColor := RGB( 255,255,255 ) - oTBx:nTextColorHoverOn := RGB( 0,0,255 ) + oTBx:nTextColor := RGB( 255, 255, 255 ) + oTBx:nTextColorHoverOn := RGB( 0, 0, 255 ) oTBx:aPopup := {} - aadd( oTBx:aPopup, { "Getsome" , {|| .T. } } ) - aadd( oTBx:aPopup, { "Getsome2", {|| .T. } } ) + AAdd( oTBx:aPopup, { "Getsome" , {|| .T. } } ) + AAdd( oTBx:aPopup, { "Getsome2", {|| .T. } } ) oDlg:AddObject( oTBx ) oGetArea := WvtStatic():New( oDlg, , 4, 2, 37, 62 ) @@ -243,36 +247,36 @@ STATIC FUNCTION MyDialogOne( oCrt ) nGetCol := 20 nSayCol := 7 nGetRow := 7 - bBlock1 := {|| oCon:Say( nGetRow+00, nSayCol, "First Name" ,"N/W" ),; - oCon:Say( nGetRow+02, nSayCol, "Last Name " ,"N/W" ),; - oCon:Say( nGetRow+04, nSayCol, "Street" ,"N/W" ),; - oCon:Say( nGetRow+06, nSayCol, "City" ,"W+/W"),; - oCon:Say( nGetRow+08, nSayCol, "State" ,"N/W" ),; - oCon:Say( nGetRow+10, nSayCol, "Zip" ,"B+/W"),; - oCon:Say( nGetRow+12, nSayCol, "Date Hired" ,"B+/W"),; - oCon:Say( nGetRow+14, nSayCol, "Married" ,"B+/W"),; - oCon:Say( nGetRow+16, nSayCol, "Age" ,"B+/W"),; - oCon:Say( nGetRow+18, nSayCol, "Salary" ,"B+/W"),; - oCon:Say( nGetRow+20, nSayCol, "Notes", ,"B+/W") ; - } + bBlock1 := {|| oCon:Say( nGetRow + 00, nSayCol, "First Name" , "N/W" ), ; + oCon:Say( nGetRow + 02, nSayCol, "Last Name " , "N/W" ), ; + oCon:Say( nGetRow + 04, nSayCol, "Street" , "N/W" ), ; + oCon:Say( nGetRow + 06, nSayCol, "City" , "W+/W" ), ; + oCon:Say( nGetRow + 08, nSayCol, "State" , "N/W" ), ; + oCon:Say( nGetRow + 10, nSayCol, "Zip" , "B+/W" ), ; + oCon:Say( nGetRow + 12, nSayCol, "Date Hired" , "B+/W" ), ; + oCon:Say( nGetRow + 14, nSayCol, "Married" , "B+/W" ), ; + oCon:Say( nGetRow + 16, nSayCol, "Age" , "B+/W" ), ; + oCon:Say( nGetRow + 18, nSayCol, "Salary" , "B+/W" ), ; + oCon:Say( nGetRow + 20, nSayCol, "Notes", , "B+/W" ) ; + } - aGets_:= { pad("Pritpal",20 ), pad( "Bedi",20 ), pad( "60, New Professor Colony",30 ), ; - pad( "Ludhiana, INDIA",30 ),; - "PB", pad( "141004",10 ), stod( "20040622" ), .T., 48, 17000, ; - pad( "Wvtgui is a classical example of Harbour capabilities...",65 ) } + aGets_ := { Pad( "Pritpal", 20 ), Pad( "Bedi", 20 ), Pad( "60, New Professor Colony", 30 ), ; + Pad( "Ludhiana, INDIA", 30 ), ; + "PB", Pad( "141004", 10 ), SToD( "20040622" ), .T. , 48, 17000, ; + Pad( "Wvtgui is a classical example of Harbour capabilities...", 65 ) } oGet1 := WvtGets():New( oDlg, , 4, 2, 37, 62 ) - oGet1:AddGets( nGetRow+00, nGetCol, aGets_[ 1 ], "@ " , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+02, nGetCol, aGets_[ 2 ], "@ " , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+04, nGetCol, aGets_[ 3 ], "@ " , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+06, nGetCol, aGets_[ 4 ], "@ " , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+08, nGetCol, aGets_[ 5 ], "@ " , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+10, nGetCol, aGets_[ 6 ], "@ " , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+12, nGetCol, aGets_[ 7 ], "@ " , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+14, nGetCol, aGets_[ 8 ], "@Y" , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+16, nGetCol, aGets_[ 9 ], "@Z 99" , "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+18, nGetCol, aGets_[ 10], "@Z 999999", "N/W*,N/GR*" ) - oGet1:AddGets( nGetRow+20, nGetCol, aGets_[ 11], "@S35" , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 00, nGetCol, aGets_[ 1 ], "@ " , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 02, nGetCol, aGets_[ 2 ], "@ " , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 04, nGetCol, aGets_[ 3 ], "@ " , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 06, nGetCol, aGets_[ 4 ], "@ " , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 08, nGetCol, aGets_[ 5 ], "@ " , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 10, nGetCol, aGets_[ 6 ], "@ " , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 12, nGetCol, aGets_[ 7 ], "@ " , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 14, nGetCol, aGets_[ 8 ], "@Y" , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 16, nGetCol, aGets_[ 9 ], "@Z 99" , "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 18, nGetCol, aGets_[ 10], "@Z 999999", "N/W*,N/GR*" ) + oGet1:AddGets( nGetRow + 20, nGetCol, aGets_[ 11], "@S35" , "N/W*,N/GR*" ) oGet1:cDesc := "test.dbf Fields" oGet1:Tooltip := "Double Click to Activate ReadModal()" oGet1:bOnCreate := bBlock1 @@ -284,55 +288,56 @@ STATIC FUNCTION MyDialogOne( oCrt ) oMenu:AddItem( "Dialog Two", {|| DialogWvgClassesTwo() } ) oMenu:AddItem( "-" ) oMenu:AddItem( "Exit", {|| Wvt_Keyboard( K_ESC ) } ) - g_oMenuBar:addItem( "",oMenu ) + g_oMenuBar:addItem( "", oMenu ) oDlg:oMenu := g_oMenuBar lOpen := .F. cUseAlias := "TEST" - USE ( hb_DirBase() + ".." + hb_ps() + ".." + hb_ps() + ".." + hb_ps() + "tests" + hb_ps() + "test.dbf" ) NEW ALIAS ( cUseAlias ) SHARED - if !NetErr() + USE ( hb_DirBase() + ".." + hb_ps() + ".." + hb_ps() + ".." + hb_ps() + "tests" + hb_ps() + "test.dbf" ) NEW Alias ( cUseAlias ) SHARED + IF !NetErr() lOpen := .T. - oWvtBrw := ConfigBrowser( { 1,7,9,10,8 }, cUseAlias, { 6,67,36,120 }, "test.dbf - 1,7,9,10,8", oDlg, "N/W*,N/GR*",1001 ) + oWvtBrw := ConfigBrowser( { 1, 7, 9, 10, 8 }, cUseAlias, { 6, 67, 36, 120 }, "test.dbf - 1,7,9,10,8", oDlg, "N/W*,N/GR*", 1001 ) oDlg:AddObject( oWvtBrw ) - endif + ENDIF lOpen1 := .F. cUseAlias1 := "TEST1" - USE ( hb_DirBase() + ".." + hb_ps() + ".." + hb_ps() + ".." + hb_ps() + "tests" + hb_ps() + "test.dbf" ) NEW ALIAS ( cUseAlias1 ) SHARED - if !NetErr() + USE ( hb_DirBase() + ".." + hb_ps() + ".." + hb_ps() + ".." + hb_ps() + "tests" + hb_ps() + "test.dbf" ) NEW Alias ( cUseAlias1 ) SHARED + IF !NetErr() lOpen1 := .T. - oWvtBrw1 := ConfigBrowser( { 1,2,3,4,5,6 }, cUseAlias1, { 43,4,51,120 }, "test.dbf - 1,2,3,4,5,6",oDlg, "N/BG*,N/W*",1002 ) + oWvtBrw1 := ConfigBrowser( { 1, 2, 3, 4, 5, 6 }, cUseAlias1, { 43, 4, 51, 120 }, "test.dbf - 1,2,3,4,5,6", oDlg, "N/BG*,N/W*", 1002 ) oDlg:AddObject( oWvtBrw1 ) - endif + ENDIF - Setkey( K_F12, {|| hb_gtInfo( HB_GTI_SPEC, HB_GTS_FACTOR, 200 ) } ) + SetKey( K_F12, {|| hb_gtInfo( HB_GTI_SPEC, HB_GTS_FACTOR, 200 ) } ) oDlg:Create() oDlg:Execute() oDlg:Destroy() - if lOpen - Select( cUseAlias ) + IF lOpen + SELECT( cUseAlias ) USE - endif - if lOpen1 - Select( cUseAlias1 ) + ENDIF + IF lOpen1 + SELECT( cUseAlias1 ) USE - endif + ENDIF WvtSetBlocks( aObjects ) WvtSetKeys( .T. ) Wvt_SetPopupMenu( hPopup ) SetMouseCheck( lChkMouse ) - RETURN Nil + RETURN NIL // FUNCTION DialogWvgClassesTwo() + LOCAL aObjects := WvtSetBlocks( {} ) - LOCAL oDlg := WvtDialog():New( 30,90,"My Dialog Two" ) + LOCAL oDlg := WvtDialog():New( 30, 90, "My Dialog Two" ) LOCAL g_oMenuBar, oMenu, oPBar LOCAL oPBar1, oPBar2, oPBar3, oPBar4 @@ -342,25 +347,25 @@ FUNCTION DialogWvgClassesTwo() oMenu:AddItem( "Progressbar", {|| ExeProgBar( oPBar,oPBar1,oPBar2,oPBar3, oPBar4 ) } ) oMenu:AddItem( "-" ) oMenu:AddItem( "Exit", {|| Wvt_Keyboard( K_ESC ) } ) - g_oMenuBar:addItem( "",oMenu ) + g_oMenuBar:addItem( "", oMenu ) oDlg:oMenu := g_oMenuBar oPBar := WvtProgressBar():New( oDlg, , 3, 10, 5, 80 ) - oPBar:nBarColor := RGB( 0,240,240 ) + oPBar:nBarColor := RGB( 0, 240, 240 ) oPBar:cBackColor := "W/N*" oPBar:nDirection := 1 oPBar:cImage := "vouch1.bmp" oDlg:AddObject( oPBar ) oPBar1 := WvtProgressBar():New( oDlg, , 7, 10, 8, 80 ) - oPBar1:nBarColor := RGB( 11,255,196 ) + oPBar1:nBarColor := RGB( 11, 255, 196 ) oPBar1:cBackColor := "W/N*" oPBar1:nDirection := 0 oDlg:AddObject( oPBar1 ) oPBar2 := WvtProgressBar():New( oDlg, , 11, 10, 28, 19 ) - oPBar2:nBarColor := RGB( 240,240,0 ) + oPBar2:nBarColor := RGB( 240, 240, 0 ) oPBar2:cBackColor := "W/N*" oPBar2:lVertical := .T. oPBar2:nDirection := 0 @@ -368,14 +373,14 @@ FUNCTION DialogWvgClassesTwo() oDlg:AddObject( oPBar2 ) oPBar3 := WvtProgressBar():New( oDlg, , 11, 77, 28, 80 ) - oPBar3:nBarColor := RGB( 0,0,255 ) + oPBar3:nBarColor := RGB( 0, 0, 255 ) oPBar3:cBackColor := "W/N*" oPBar3:lVertical := .T. oPBar3:nDirection := 1 oDlg:AddObject( oPBar3 ) oPBar4 := WvtProgressBar():New( oDlg, , 22, 22, 28, 74 ) - oPBar4:nBarColor := RGB( 255,255,0 ) + oPBar4:nBarColor := RGB( 255, 255, 0 ) oPBar4:cBackColor := "W/N*" oPBar4:lVertical := .T. oPBar4:nDirection := 0 @@ -386,11 +391,13 @@ FUNCTION DialogWvgClassesTwo() oDlg:Destroy() WvtSetBlocks( aObjects ) - RETURN Nil + + RETURN NIL // -STATIC FUNCTION ExeProgBar( oPBar,oPBar1,oPBar2,oPBar3,oPBar4 ) +STATIC FUNCTION ExeProgBar( oPBar, oPBar1, oPBar2, oPBar3, oPBar4 ) + LOCAL i oPBar:Activate() @@ -398,35 +405,36 @@ STATIC FUNCTION ExeProgBar( oPBar,oPBar1,oPBar2,oPBar3,oPBar4 ) oPBar2:Activate() oPBar3:Activate() oPBar4:Activate() - for i := 1 to 100 + FOR i := 1 TO 100 oPBar:Display( i, 100 ) oPBar1:Display( i, 100 ) oPBar2:Display( i, 100 ) oPBar3:Display( i, 100 ) oPBar4:Display( i, 100 ) - inkey( 0.3 ) - next - inkey( 0 ) + Inkey( 0.3 ) + NEXT + Inkey( 0 ) oPBar:DeActivate() oPBar1:DeActivate() oPBar2:DeActivate() oPBar3:DeActivate() oPBar4:DeActivate() - RETURN nil + RETURN NIL // STATIC FUNCTION ExeProgressBar( oPBar, oPBar3 ) + LOCAL i oPBar:Activate() oPBar3:Activate() - for i := 1 to 100 + FOR i := 1 TO 100 oPBar:Display( i, 100 ) oPBar3:Display( i, 100 ) - inkey( 0.3 ) - next + Inkey( 0.3 ) + NEXT oPBar:DeActivate() oPBar3:DeActivate() diff --git a/harbour/contrib/gtwvg/tests/xbp.prg b/harbour/contrib/gtwvg/tests/xbp.prg index 6a2ef00a1d..b87aa91430 100644 --- a/harbour/contrib/gtwvg/tests/xbp.prg +++ b/harbour/contrib/gtwvg/tests/xbp.prg @@ -26,15 +26,16 @@ // FUNCTION demoxbp() - Local oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 + + LOCAL oCrt, oTBar, oSBar, oStatic, oCom, oXbp, oTree, oItem1, oItem2 LOCAL oListBox, oCheck, oRadio, oStatic2, oMLE, oAddr LOCAL oPanel, oPanel1, oPanel2, cText, cNavigate, oDA LOCAL cVarA := "Test A", cVarB := "Test B" - LOCAL aState := {"not selected", "selected", "undefined"} + LOCAL aState := { "not selected", "selected", "undefined" } LOCAL aParts := {} //--------------------------- Dialog -------------------------------\\ - oCrt := WvgDialog():new( , , { 30,30 }, { 900,600 }, , .T. ) + oCrt := WvgDialog():new( , , { 30, 30 }, { 900, 600 }, , .T. ) oCrt:closable := .T. oCrt:icon := GetResource( "vr_1.ico" ) oCrt:create() @@ -63,10 +64,10 @@ FUNCTION demoxbp() oStatic := WvgStatic():new( oDA ) oStatic:type := WVGSTATIC_TYPE_TEXT oStatic:options := WVGSTATIC_TEXT_CENTER - oStatic:caption := chr(13)+'Implemented Xbase++ Parts' + oStatic:caption := Chr( 13 ) + 'Implemented Xbase++ Parts' - oStatic:create( , , { 0, oTBar:currentSize()[2]+3 }, { 120, oCrt:currentSize()[2]-; - oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .T. ) + oStatic:create( , , { 0, oTBar:currentSize()[ 2 ] + 3 }, { 120, oCrt:currentSize()[ 2 ] - ; + oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. ) oStatic:setColorBG( RGB( 200,200,200 ) ) //--------------------------- ListBox -----------------------------\\ @@ -74,46 +75,46 @@ FUNCTION demoxbp() oListBox:create( oStatic, , { 5, 55 }, { 107, 380 } ) oListBox:setColorFG( RGB( 218,61,34 ) ) - //oListBox:setColorBG( RGB( 250,244,182 ) ) +// oListBox:setColorBG( RGB( 250,244,182 ) ) - aadd( aParts, 'XbpDialog' ) - aadd( aParts, 'XbpMenuBar' ) - aadd( aParts, 'XbpToolBar' ) - aadd( aParts, 'XbpToolBarButton' ) - aadd( aParts, 'XbpStatusBar' ) - aadd( aParts, 'XbpStatic' ) - aadd( aParts, 'XbpTreeView' ) - aadd( aParts, 'XbpTreeViewItem' ) - aadd( aParts, 'XbpActiveXControl') - aadd( aParts, 'XbpListBox' ) - aadd( aParts, 'XbpPushButton' ) - aadd( aParts, 'XbpCheckBox' ) - aadd( aParts, 'XbpRadioButton' ) - aadd( aParts, 'Xbp3State' ) - aadd( aParts, 'XbpSLE' ) - aadd( aParts, 'XbpMLE' ) - aadd( aParts, 'XbpHTMLViewer' ) - aadd( aParts, 'XbpSysWindow' ) - aadd( aParts, 'XbpFontDialog' ) - aadd( aParts, 'XbpFont' ) - aadd( aParts, '-------------' ) - aadd( aParts, 'DataRef' ) + AAdd( aParts, 'XbpDialog' ) + AAdd( aParts, 'XbpMenuBar' ) + AAdd( aParts, 'XbpToolBar' ) + AAdd( aParts, 'XbpToolBarButton' ) + AAdd( aParts, 'XbpStatusBar' ) + AAdd( aParts, 'XbpStatic' ) + AAdd( aParts, 'XbpTreeView' ) + AAdd( aParts, 'XbpTreeViewItem' ) + AAdd( aParts, 'XbpActiveXControl' ) + AAdd( aParts, 'XbpListBox' ) + AAdd( aParts, 'XbpPushButton' ) + AAdd( aParts, 'XbpCheckBox' ) + AAdd( aParts, 'XbpRadioButton' ) + AAdd( aParts, 'Xbp3State' ) + AAdd( aParts, 'XbpSLE' ) + AAdd( aParts, 'XbpMLE' ) + AAdd( aParts, 'XbpHTMLViewer' ) + AAdd( aParts, 'XbpSysWindow' ) + AAdd( aParts, 'XbpFontDialog' ) + AAdd( aParts, 'XbpFont' ) + AAdd( aParts, '-------------' ) + AAdd( aParts, 'DataRef' ) - aeval( aParts, {| e | oListBox:addItem( e ) } ) + AEval( aParts, {| e | oListBox:addItem( e ) } ) oListBox:itemSelected := {|| WVG_MessageBox( , oListBox:getCurItem() ) } oListBox:setData( 3 ) // show selected 'XbpToolBar' //--------------------------- PushButton --------------------------\\ oXbp := WvgPushButton():new( oStatic ) oXbp:caption := "Hide" - oXbp:create( , , { 20,440 }, {80,30} ) - oXbp:activate:= {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } + oXbp:create( , , { 20, 440 }, { 80, 30 } ) + oXbp:activate := {|| oStatic:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } //--------------------------- TreeView ---------------------------\\ - oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[1]-160,oTBar:currentSize()[2]+3 }, ; - { 160, oCrt:currentSize()[2]-; - oTBar:currentSize()[2]-oSBar:currentSize()[2]-4 }, , .T. ) + oTree := WvgTreeView():new( oDA, , { oCrt:currentSize()[ 1 ] - 160, oTBar:currentSize()[ 2 ] + 3 }, ; + { 160, oCrt:currentSize()[ 2 ] - ; + oTBar:currentSize()[ 2 ] - oSBar:currentSize()[ 2 ] - 4 }, , .T. ) oTree:hasLines := .T. oTree:hasButtons := .T. oTree:alwaysShowSelection := .T. @@ -133,26 +134,26 @@ FUNCTION demoxbp() oItem2:addItem( "Third level B" ) oItem2:addItem( "Third level C" ) - #if 0 +#if 0 oItem1:expand( .T. ) - #else - oTree:showExpanded( .T., 2 ) - #endif +#else + oTree:showExpanded( .T. , 2 ) +#endif oTree:setData( oItem2 ) //--------------------------- Active-X ---------------------------\\ hb_gtInfo( HB_GTI_WINTITLE, 'http://www.harbour.vouch.info' ) - #if 0 +#if 0 oCom := WvgActiveXControl():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) oCom:CLSID := 'Shell.Explorer.2' oCom:mapEvent( 269, {|| QOut( ' E X P L O R E R - 2 6 9' ) } ) - #else +#else oCom := WvgHTMLViewer():New( oDA, , { 0, 0 }, { 100, 100 }, , .T. ) oCom:beforeNavigate := {| cURL, x, oHTML | x := x, oHTML := oHTML, oPanel:caption := cURL } oCom:statusTextChange := {| cText | oPanel:caption := cText } oCom:mapEvent( 112, {|| oPanel:caption := ' E X P L O R E R - 2 6 9' } ) - #endif +#endif oCom:create() oCom:Navigate( 'http://www.harbour.vouch.info' ) @@ -163,52 +164,52 @@ FUNCTION demoxbp() oAddr:dataLink := {| x | iif( x == NIL, cNavigate, cNavigate := x ) } oAddr:setColorFG( RGB( 0,0,255 ) ) oAddr:setColorBG( RGB( 0,255,255 ) ) - oAddr:create( oDA, , { 120, oTBar:currentSize()[2] }, { 500,20 }, , .T. ) + oAddr:create( oDA, , { 120, oTBar:currentSize()[ 2 ] }, { 500, 20 }, , .T. ) oAddr:setData() - oAddr:killInputFocus := {| m1, m2, oS | m1:=m1, m2:=m2, oS:getData(), oCom:navigate( cNavigate ) } + oAddr:killInputFocus := {| m1, m2, oS | m1 := m1, m2 := m2, oS:getData(), oCom:navigate( cNavigate ) } //----------------- Panel : Static + Radio + Checkbox ----------\\ - oStatic2:= WvgStatic():New( oDA, , { 150, 150 }, { 500,310 }, , .F. ) - //oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME + oStatic2 := WvgStatic():New( oDA, , { 150, 150 }, { 500, 310 }, , .F. ) +// oStatic2:type := WVGSTATIC_TYPE_RAISEDBOX //BGNDFRAME oStatic2:exStyle += WS_EX_WINDOWEDGE - //oStatic2:options := WVGSTATIC_FRAMETHICK +// oStatic2:options := WVGSTATIC_FRAMETHICK oStatic2:create() oStatic2:setColorBG( RGB( 175,175,175 ) ) oXbp := WvgPushButton():new( oStatic2 ) oXbp:caption := "Hide" oXbp:caption := "Hide" - oXbp:create( , , { 430,275 }, { 60,25 } ) + oXbp:create( , , { 430, 275 }, { 60, 25 } ) oXbp:activate := {|| oStatic2:hide(), oCrt:sendMessage( WM_SIZE, 0, 0 ) } - oRadio := WvgRadioButton():new( oStatic2,, { 10,10 }, { 100,15 } ) + oRadio := WvgRadioButton():new( oStatic2, , { 10, 10 }, { 100, 15 } ) oRadio:caption := "Com 1" oRadio:selection := .T. - oRadio:selected := {| m1, m2, obj | m1:=m1, m2:=m2, WVG_MessageBox( , obj:caption + iif( obj:selection, '< S >', '< N >' ) ) } + oRadio:selected := {| m1, m2, obj | m1 := m1, m2 := m2, WVG_MessageBox( , obj:caption + iif( obj:selection, '< S >', '< N >' ) ) } oRadio:create() - oRadio := WvgRadioButton():new( oStatic2,, { 10,35 }, { 100,15 } ) + oRadio := WvgRadioButton():new( oStatic2, , { 10, 35 }, { 100, 15 } ) oRadio:caption := "Com 2" oRadio:create() - oCheck := WvgCheckBox():New( oStatic2, , { 10,70 }, { 100,15 }, , .T. ) + oCheck := WvgCheckBox():New( oStatic2, , { 10, 70 }, { 100, 15 }, , .T. ) oCheck:caption := 'Checkbox A' oCheck:create() - oCheck:selected := {| m1, m2, o | m1:=m1,m2:=m2, WVG_MessageBox( , iif( o:getData(), 'I am selected','I am not selected' ) ) } + oCheck:selected := {| m1, m2, o | m1 := m1, m2 := m2, WVG_MessageBox( , iif( o:getData(), 'I am selected','I am not selected' ) ) } // Create first 3State button, passing the position to :create() oXbp := Wvg3State():new() oXbp:caption := "3 State A" - oXbp:create( oStatic2, , { 10,100 }, { 100,15 } ) + oXbp:create( oStatic2, , { 10, 100 }, { 100, 15 } ) // Determine current state using mp1 - oXbp:selected := {| m1, m2, oBtn | m2:=m2, oBtn:=oBtn, oPanel1:caption := "3State A ["+aState[ m1+1 ]+"]" } + oXbp:selected := {| m1, m2, oBtn | m2 := m2, oBtn := oBtn, oPanel1:caption := "3State A [" + aState[ m1+1 ] + "]" } // Create second 3State Button, passing the position to :new() - oXbp := Wvg3State():new( oStatic2, , { 10,125 }, { 100,15 } ) + oXbp := Wvg3State():new( oStatic2, , { 10, 125 }, { 100, 15 } ) oXbp:caption := "3 State B" oXbp:create( oStatic2 ) // Determine current state using :getData() - oXbp:selected := {| m1, m2, oBtn | m1:=m1,m2:=m2, WVG_MessageBox( , "3State B", aState[ oBtn:getData()+1 ] ) } + oXbp:selected := {| m1, m2, oBtn | m1 := m1, m2 := m2, WVG_MessageBox( , "3State B", aState[ oBtn:getData()+1 ] ) } // Create first SLE, specify position using :create() // On :typeOut set the focus to the second SLE @@ -217,19 +218,19 @@ FUNCTION demoxbp() oXbp:bufferLength := 20 // Data code block containing assignment to LOCAL variable oXbp:dataLink := {| x | iif( x == NIL, cVarA, cVarA := x ) } - oXbp:create( oStatic2, , { 10,170 }, { 150,20 } ) + oXbp:create( oStatic2, , { 10, 170 }, { 150, 20 } ) oXbp:setData() // Assign the value of the edit buffer to a LOCAL variable when the input focus is lost - oXbp:killInputFocus := {| x, y, oSLE | x:=x,y:=y, oSLE:getData(), oPanel:caption := "cVarA =" + cVarA } + oXbp:killInputFocus := {| x, y, oSLE | x := x, y := y, oSLE:getData(), oPanel:caption := "cVarA =" + cVarA } // Create second SLE, specify position using :new() - oXbp := WvgSLE():new( , , { 10,200 }, { 150,20 } ) + oXbp := WvgSLE():new( , , { 10, 200 }, { 150, 20 } ) oXbp:tabStop := .T. oXbp:bufferLength := 15 oXbp:dataLink := {| x | iif( x == NIL, cVarB, cVarB := x ) } oXbp:create( oStatic2 ) oXbp:setData() - oXbp:killInputFocus := {| x, y, oSLE | x:=x,y:=y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB } + oXbp:killInputFocus := {| x, y, oSLE | x := x, y := y, oSLE:getData(), oPanel:caption := "cVarB =" + cVarB } // Read file into LOCAL variable cText := MemoRead( GetResource( 'gtwvg.hbc' ) ) @@ -238,18 +239,18 @@ FUNCTION demoxbp() oMLE := WvgMLE():new() oMLE:wordWrap := .F. oMLE:border := .T. - oMLE:dataLink := {| x | iif( x==NIL, cText, cText := x ) } - oMLE:create( oStatic2, , { 180,10 }, { 310,250 } ) + oMLE:dataLink := {| x | iif( x == NIL, cText, cText := x ) } + oMLE:create( oStatic2, , { 180, 10 }, { 310, 250 } ) // Copy text from LOCAL variable into edit buffer via :dataLink oMLE:setData() //--------------------------- Misc Config ------------------------\\ - oTBar:buttonClick := {| oBtn | iif( oBtn:caption == 'Hide' , oStatic:hide(), nil ),; - iif( oBtn:caption == 'Show' , oStatic:show(), nil ),; - iif( oBtn:caption == 'Tools' , oStatic2:show():toFront(), nil ),; - iif( oBtn:caption == 'FontDlg', ExeFontDialogXbp( oCrt ), nil ),; - iif( oBtn:caption $ 'Hide,Show', oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ),; - oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } + oTBar:buttonClick := {| oBtn | iif( oBtn:caption == 'Hide' , oStatic:hide(), NIL ), ; + iif( oBtn:caption == 'Show' , oStatic:show(), NIL ), ; + iif( oBtn:caption == 'Tools' , oStatic2:show():toFront(), NIL ), ; + iif( oBtn:caption == 'FontDlg', ExeFontDialogXbp( oCrt ), NIL ), ; + iif( oBtn:caption $ 'Hide,Show', oCrt:sendMessage( WM_SIZE, 0, 0 ), NIL ), ; + oPanel2:caption := "Button [ " + oBtn:caption + " ] clicked!" } oCrt:resize := {|| ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr ) } @@ -257,18 +258,19 @@ FUNCTION demoxbp() oCrt:show() DO WHILE .T. - IF inkey() == K_ESC + IF Inkey() == K_ESC EXIT ENDIF ENDDO oCrt:Destroy() - Return nil + RETURN NIL // STATIC FUNCTION ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr ) + LOCAL aCrt, aTBar, aSBar LOCAL nH, nT @@ -276,19 +278,19 @@ STATIC FUNCTION ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr aTBar := oTBar:currentSize() aSBar := oSBar:currentSize() - nT := aTBar[2] - nH := aCrt[2] - aTBar[2] - aSBar[2] + nT := aTBar[ 2 ] + nH := aCrt[ 2 ] - aTBar[ 2 ] - aSBar[ 2 ] IF oStatic:isVisible - oStatic:setPosAndSize( { 0, nT+3 }, { 120, nH-4 }, .T. ) - oAddr:setPosAndSize( { 120, nT+2 }, { aCrt[1]-120-150, 20 }, .T. ) - oCom:setPosAndSize( { 120, nT+2+20 }, { aCrt[1]-120-150, nH-20 }, .T. ) - oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .T. ) + oStatic:setPosAndSize( { 0, nT + 3 }, { 120, nH - 4 }, .T. ) + oAddr:setPosAndSize( { 120, nT + 2 }, { aCrt[ 1 ] - 120 - 150, 20 }, .T. ) + oCom:setPosAndSize( { 120, nT + 2 + 20 }, { aCrt[ 1 ] - 120 - 150, nH - 20 }, .T. ) + oTree:setPosAndSize( { aCrt[ 1 ] - 150, nT }, { 150, nH }, .T. ) ELSE - oAddr:setPosAndSize( { 0, nT+2 }, { aCrt[1]-150, 20 }, .T. ) - oCom:setPosAndSize( { 0, nT+2+20 }, { aCrt[1]-150, nH-20 }, .T. ) - oTree:setPosAndSize( { aCrt[1]-150, nT }, { 150, nH }, .T. ) + oAddr:setPosAndSize( { 0, nT + 2 }, { aCrt[ 1 ] - 150, 20 }, .T. ) + oCom:setPosAndSize( { 0, nT + 2 + 20 }, { aCrt[ 1 ] - 150, nH - 20 }, .T. ) + oTree:setPosAndSize( { aCrt[ 1 ] - 150, nT }, { 150, nH }, .T. ) ENDIF @@ -297,7 +299,8 @@ STATIC FUNCTION ResizeDialogXbp( oCrt, oTBar, oSBar, oStatic, oCom, oTree, oAddr // STATIC FUNCTION ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 ) - Local oMenuBar, oSubMenu + + LOCAL oMenuBar, oSubMenu oMenuBar := WvgMenuBar():new( oCrt ):create() @@ -309,7 +312,7 @@ STATIC FUNCTION ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 ) oSubMenu:title := "~Procedural" oSubMenu:addItem( { "Play Charge ~1", } ) oSubMenu:addItem( { "Play Nannyboo ~2", } ) - oSubMenu:itemSelected := {| mp1 | MyFunctionXbp( 100+mp1 ) } + oSubMenu:itemSelected := {| mp1 | MyFunctionXbp( 100 + mp1 ) } oMenuBar:addItem( { oSubMenu, NIL } ) // Define submenu in the functional style: @@ -326,7 +329,7 @@ STATIC FUNCTION ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 ) oSubMenu := WvgMenu():new( oMenuBar ):create() oSubMenu:title := "F~eatures" oSubMenu:addItem( { "~Hide or Show Left Panel" , {|| iif( oStatic:isVisible, ; - oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE,0,0 ) } } ) + oStatic:hide(), oStatic:show() ), oCrt:sendMessage( WM_SIZE, 0, 0 ) } } ) oSubMenu:addItem( { "~Show My Panel" , {|| oStatic2:show():toFront() } } ) oSubMenu:addItem() oSubMenu:addItem( { "~Font Dialog" , {|| ExeFontDialogXbp( oCrt ) } } ) @@ -334,12 +337,14 @@ STATIC FUNCTION ActiveXBuildMenuXbp( oCrt, oStatic, oStatic2 ) oMenuBar:addItem( { oSubMenu, NIL } ) RETURN NIL + // STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt ) + LOCAL oTBar - oTBar := WvgToolBar():new( oCrt , , { 0,0 }, { 0,0 }, , .T. ) + oTBar := WvgToolBar():new( oCrt , , { 0, 0 }, { 0, 0 }, , .T. ) oTBar:style := WVGTOOLBAR_STYLE_FLAT @@ -369,63 +374,64 @@ STATIC FUNCTION ActiveXBuildToolBarXbp( oCrt ) // -Static Function MyFunctionXbp( nMode ) +STATIC FUNCTION MyFunctionXbp( nMode ) - do case - case nMode == 1 - tone( MUSIC_WAITON[1], 1 ) - tone( MUSIC_WAITON[2], 1 ) + DO CASE + CASE nMode == 1 + Tone( MUSIC_WAITON[ 1 ], 1 ) + Tone( MUSIC_WAITON[ 2 ], 1 ) - case nMode == 2 - tone( MUSIC_WAITON[2], 1 ) - tone( MUSIC_WAITON[1], 1 ) + CASE nMode == 2 + Tone( MUSIC_WAITON[ 2 ], 1 ) + Tone( MUSIC_WAITON[ 1 ], 1 ) - case nMode == 3 + CASE nMode == 3 WVG_MessageBox( , "Button clicked!" ) - case nMode == 101 // Charge - Eval( {|| tone(523,2),tone(698,2),tone(880,2),tone(1046,4),tone(880,2),tone(1046,8) } ) + CASE nMode == 101 // Charge + Eval( {|| Tone( 523,2 ), Tone( 698,2 ), Tone( 880,2 ), Tone( 1046,4 ), Tone( 880,2 ), Tone( 1046,8 ) } ) - case nMode == 102 // NannyBoo - AEval( {{196,2},{196,2},{164,2},{220,2},{196,4},{164,4}}, {| a | tone( a[ 1 ], a[ 2 ] ) } ) + CASE nMode == 102 // NannyBoo + AEval( { { 196,2 }, { 196,2 }, { 164,2 }, { 220,2 }, { 196,4 }, { 164,4 } }, {| a | Tone( a[ 1 ], a[ 2 ] ) } ) - case nMode == 103 // BADKEY - tone( 480,0.25 ) - tone( 240,0.25 ) + CASE nMode == 103 // BADKEY + Tone( 480, 0.25 ) + Tone( 240, 0.25 ) - endcase + ENDCASE - Return nil + RETURN NIL // STATIC FUNCTION ExeFontDialogXbp( oCrt ) + LOCAL oFontDlg - STATIC nMode := 0 + STATIC s_nMode := 0 oFontDlg := WvgFontDialog():new( oCrt ) oFontDlg:title := 'Select a Screen Font' - oFontDlg:aPos := { 150,150 } + oFontDlg:aPos := { 150, 150 } oFontDlg:buttonApply := .T. oFontDlg:activateApply := {|| NIL } oFontDlg:familyName := "Courier New" oFontDlg:strikeout := .T. oFontDlg:underscore := .F. - //oFontDlg:activateOk := {|| WVG_MessageBox( , 'activateOK Event Handelled in Windows!' ) } +// oFontDlg:activateOk := {|| WVG_MessageBox( , 'activateOK Event Handelled in Windows!' ) } oFontDlg:nominalPointSize := 12 - //oFontDlg:size := .F. - //oFontDlg:style := .F. +// oFontDlg:size := .F. +// oFontDlg:style := .F. oFontDlg:create() // Every 2nd FontDialog will be MODAL - oFontDlg:display( ++nMode % 2 ) + oFontDlg:display( ++s_nMode % 2 ) oFontDlg:destroy() - RETURN nil + RETURN NIL // diff --git a/harbour/contrib/gtwvg/toolbar.prg b/harbour/contrib/gtwvg/toolbar.prg index 1c12f76a3d..dbf0f6e99e 100644 --- a/harbour/contrib/gtwvg/toolbar.prg +++ b/harbour/contrib/gtwvg/toolbar.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -112,7 +113,7 @@ CLASS WvgToolBar INHERIT WvgWindow /*WvgActiveXControl*/ METHOD delItem() METHOD getItem() - METHOD clear() + METHOD CLEAR() METHOD customize() METHOD loadImageSet() METHOD saveToolbar() @@ -125,7 +126,7 @@ CLASS WvgToolBar INHERIT WvgWindow /*WvgActiveXControl*/ METHOD buttonMenuClick( xParam ) SETGET METHOD buttonDropDown( xParam ) SETGET - ENDCLASS +ENDCLASS // @@ -133,10 +134,10 @@ METHOD WvgToolBar:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::WvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - #if 0 - + TBSTYLE_LIST caption to the right, otherwise caption to the bottom +#if 0 + + TBSTYLE_LIST caption TO the right, OTHERWISE caption TO the bottom ::style := WS_CHILD + TBSTYLE_FLAT + CCS_ADJUSTABLE + CCS_NODIVIDER + CCS_VERT - #endif +#endif ::exStyle := TBSTYLE_EX_DOUBLEBUFFER + TBSTYLE_EX_MIXEDBUTTONS ::className := TOOLBARCLASSNAME @@ -168,26 +169,26 @@ METHOD WvgToolBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) IF ::borderStyle == WVGFRAME_RECT ::style += WS_BORDER ENDIF - #if 0 +#if 0 IF ::appearance == WVG_APPEARANCE_3D ENDIF - #endif +#endif ::oParent:AddChild( SELF ) ::createControl() - #if 0 +#if 0 /* Should not be defined as we only require its notifications * so the parent of toolbar will process them anyway * All other functionality should be default until ownerdraw is introduced. */ - ::SetWindowProcCallback() - #endif + ::SetWindowProcCallback() +#endif - IF !empty( ::hWnd ) + IF !Empty( ::hWnd ) ::SendToolbarMessage( TB_BUTTONSTRUCTSIZE ) - ::hImageList := WAPI_ImageList_Create( ::imageWidth, ::imageHeight, ILC_COLOR32+ILC_MASK, 0, 1 ) + ::hImageList := WAPI_ImageList_Create( ::imageWidth, ::imageHeight, ILC_COLOR32 + ILC_MASK, 0, 1 ) ::SendToolbarMessage( TB_SETIMAGELIST, ::hImageList ) ::SendToolbarMessage( TB_BUTTONSTRUCTSIZE ) @@ -203,6 +204,7 @@ METHOD WvgToolBar:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) // METHOD WvgToolBar:handleEvent( nMessage, aNM ) + LOCAL nObj, aNMMouse SWITCH nMessage @@ -223,7 +225,7 @@ METHOD WvgToolBar:handleEvent( nMessage, aNM ) DO CASE CASE aNMMouse[ NMH_code ] == NM_CLICK - IF ( nObj := ascan( ::aItems, {| e_ | e_[ 1 ] == aNMMouse[ NMH_dwItemSpec ] } ) ) > 0 + IF ( nObj := AScan( ::aItems, {| e_ | e_[ 1 ] == aNMMouse[ NMH_dwItemSpec ] } ) ) > 0 IF HB_ISBLOCK( ::sl_lbClick ) IF ::isParentCrt() ::oParent:setFocus() @@ -247,6 +249,7 @@ METHOD WvgToolBar:handleEvent( nMessage, aNM ) // METHOD WvgToolBar:destroy() + LOCAL i, nItems IF ( nItems := Len( ::aItems ) ) > 0 @@ -263,7 +266,7 @@ METHOD WvgToolBar:destroy() NEXT ENDIF - IF !empty( ::hImageList ) + IF !Empty( ::hImageList ) WAPI_ImageList_Destroy( ::hImageList ) ENDIF @@ -288,6 +291,7 @@ METHOD WvgToolBar:sendToolbarMessage( nMsg, p1, p2 ) // METHOD WvgToolBar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey, nMapRGB ) + LOCAL oBtn, pBitmap, cType, nBtn HB_SYMBOL_UNUSED( xDisabledImage ) @@ -296,9 +300,9 @@ METHOD WvgToolBar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS /* Issue this at the begining of first item */ IF ! ::lSized - #if 0 +#if 0 ::SendToolbarMessage( TB_SETBUTTONWIDTH, ::buttonWidth, ::buttonWidth ) - #endif +#endif ::lSized := .T. ENDIF @@ -307,26 +311,26 @@ METHOD WvgToolBar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS oBtn:index := ::numItems + 1 oBtn:command := 100 + oBtn:index - cType := valtype( xImage ) + cType := ValType( xImage ) DO CASE CASE cType == "C" - IF ( "." $ xImage ) .or. ( "/" $ xImage ) .or. ( "\" $ xImage ) .or. ( ":" $ xImage ) .or. file( xImage ) - pBitmap := Wvg_PrepareBitmapFromFile( xImage, ::imageWidth, ::imageHeight, .T., ::hWnd ) + IF ( "." $ xImage ) .OR. ( "/" $ xImage ) .OR. ( "\" $ xImage ) .OR. ( ":" $ xImage ) .OR. File( xImage ) + pBitmap := Wvg_PrepareBitmapFromFile( xImage, ::imageWidth, ::imageHeight, .T. , ::hWnd ) ELSE - pBitmap := Wvg_PrepareBitmapFromResourceName( xImage, ::imageWidth, ::imageHeight, .T., ::hWnd ) + pBitmap := Wvg_PrepareBitmapFromResourceName( xImage, ::imageWidth, ::imageHeight, .T. , ::hWnd ) ENDIF CASE cType == "N" - pBitmap := Wvg_PrepareBitmapFromResourceID( xImage, ::imageWidth, ::imageHeight, .T., ::hWnd ) + pBitmap := Wvg_PrepareBitmapFromResourceID( xImage, ::imageWidth, ::imageHeight, .T. , ::hWnd ) CASE cType == "P" pBitmap := xImage ENDCASE - IF ! empty( pBitmap ) + IF ! Empty( pBitmap ) /* oBtn:image := pBitmap */ IF HB_ISNUMERIC( nMapRGB ) @@ -343,17 +347,17 @@ METHOD WvgToolBar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS /* Set Button Size */ ::SendToolbarMessage( TB_SETBUTTONSIZE, ::buttonWidth, ::buttonHeight ) - #if 0 +#if 0 SendMessage( hWndTB, TB_SETPADDING, ( WPARAM ) 0, ( LPARAM ) MAKELPARAM( 10,10 ) ); - ::sendToolbarMessage( TB_SETPADDING, 10, 10 ) - #endif + ::sendToolbarMessage( TB_SETPADDING, 10, 10 ) +#endif ::sendToolbarMessage( TB_AUTOSIZE ) ELSE Wvg_AddToolbarButton( ::pWnd, , , oBtn:command, 3, .F. ) ENDIF - aadd( ::aItems, { oBtn:command, oBtn } ) + AAdd( ::aItems, { oBtn:command, oBtn } ) RETURN oBtn @@ -417,7 +421,7 @@ METHOD WvgToolBar:setSize() METHOD WvgToolBar:buttonClick( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbClick := xParam ENDIF @@ -427,7 +431,7 @@ METHOD WvgToolBar:buttonClick( xParam ) METHOD WvgToolBar:change( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_change := xParam ENDIF @@ -437,7 +441,7 @@ METHOD WvgToolBar:change( xParam ) METHOD WvgToolBar:buttonMenuClick( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_buttonMenuClick := xParam ENDIF @@ -447,7 +451,7 @@ METHOD WvgToolBar:buttonMenuClick( xParam ) METHOD WvgToolBar:buttonDropDown( xParam ) - IF HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_buttonDropDown := xParam ENDIF @@ -466,8 +470,8 @@ METHOD WvgToolBar:buttonDropDown( xParam ) CLASS WvgToolBarButton DATA enabled INIT .T. - DATA index INIT 0 - DATA key INIT "" + DATA INDEX INIT 0 + DATA KEY INIT "" DATA style INIT WVGTOOLBAR_BUTTON_DEFAULT DATA caption INIT "" DATA image INIT NIL @@ -477,8 +481,8 @@ CLASS WvgToolBarButton DATA pressed INIT .F. DATA visible INIT .T. DATA left INIT 0 - DATA bottom INIT 0 - DATA top INIT 0 + DATA BOTTOM INIT 0 + DATA TOP INIT 0 DATA width INIT 0 DATA height INIT 0 DATA description INIT "" @@ -487,7 +491,7 @@ CLASS WvgToolBarButton METHOD new( cCaption, nStyle, cKey ) - ENDCLASS +ENDCLASS // diff --git a/harbour/contrib/gtwvg/treeview.prg b/harbour/contrib/gtwvg/treeview.prg index a921175944..50cf914c77 100644 --- a/harbour/contrib/gtwvg/treeview.prg +++ b/harbour/contrib/gtwvg/treeview.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -118,9 +119,9 @@ CLASS WvgTreeView INHERIT WvgWindow, WvgDataRef METHOD setColorBG( nRGB ) INLINE WVG_TreeView_SetBkColor( ::hWnd, iif( HB_ISSTRING( nRGB ), Wvt_GetRGBColorByString( nRGB, 1 ), nRGB ) ) METHOD setColorLines( nRGB ) INLINE WVG_TreeView_SetLineColor( ::hWnd, nRGB ) METHOD showExpanded( lExpanded, nLevels ) INLINE Wvg_TreeView_ShowExpanded( ::hWnd, ; - iif( HB_ISNIL( lExpanded ), .F., lExpanded ), nLevels ) + iif( HB_ISNIL( lExpanded ), .F. , lExpanded ), nLevels ) - ENDCLASS +ENDCLASS // @@ -174,6 +175,7 @@ METHOD WvgTreeView:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) // METHOD WvgTreeView:handleEvent( nMessage, aNM ) + LOCAL aHdr SWITCH nMessage @@ -186,7 +188,7 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM ) CASE HB_GTE_COMMAND IF HB_ISBLOCK( ::sl_lbClick ) - eval( ::sl_lbClick, NIL, NIL, self ) + Eval( ::sl_lbClick, NIL, NIL, self ) RETURN EVENT_HANDELLED ENDIF EXIT @@ -201,7 +203,7 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM ) ::oParent:setFocus() ENDIF IF HB_ISBLOCK( ::sl_itemSelected ) - Eval( ::sl_itemSelected, ::oItemSelected, { 0,0,0,0 }, Self ) + Eval( ::sl_itemSelected, ::oItemSelected, { 0, 0, 0, 0 }, Self ) ENDIF IF ::isParentCrt() IF ::pointerFocus @@ -218,7 +220,7 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM ) ::oParent:setFocus() ENDIF IF HB_ISBLOCK( ::sl_itemMarked ) - Eval( ::sl_itemMarked, ::oItemSelected, { 0,0,0,0 }, Self ) + Eval( ::sl_itemMarked, ::oItemSelected, { 0, 0, 0, 0 }, Self ) ENDIF IF ::isParentCrt() IF ::pointerFocus @@ -244,7 +246,7 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM ) IF ::isParentCrt() ::oParent:setFocus() ENDIF - eval( ::sl_lbClick, NIL, NIL, Self ) + Eval( ::sl_lbClick, NIL, NIL, Self ) IF ::isParentCrt() ::setFocus() ENDIF @@ -257,7 +259,7 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM ) IF ::isParentCrt() ::oParent:setFocus() ENDIF - Eval( ::sl_itemSelected, ::oItemSelected, { 0,0,0,0 }, Self ) + Eval( ::sl_itemSelected, ::oItemSelected, { 0, 0, 0, 0 }, Self ) IF ::isParentCrt() ::setFocus() ENDIF @@ -274,25 +276,28 @@ METHOD WvgTreeView:handleEvent( nMessage, aNM ) // METHOD WvgTreeView:destroy() + ::wvgWindow:destroy() + RETURN NIL // METHOD WvgTreeView:getSelectionInfo( nlParam ) + LOCAL hItemSelected, hParentOfSelected - LOCAL cParent := space( 20 ) - LOCAL cText := space( 20 ) + LOCAL cParent := Space( 20 ) + LOCAL cText := Space( 20 ) LOCAL n Wvg_TreeView_GetSelectionInfo( ::hWnd, nlParam, @cParent, @cText, @hParentOfSelected, @hItemSelected ) ::hParentSelected := hParentOfSelected ::hItemSelected := hItemSelected - ::textParentSelected := trim( cParent ) - ::textItemSelected := trim( cText ) + ::textParentSelected := Trim( cParent ) + ::textItemSelected := Trim( cText ) - IF ( n := ascan( ::aItems, {| o | o:hItem == hItemSelected } ) ) > 0 + IF ( n := AScan( ::aItems, {| o | o:hItem == hItemSelected } ) ) > 0 ::oItemSelected := ::aItems[ n ] ENDIF @@ -301,20 +306,24 @@ METHOD WvgTreeView:getSelectionInfo( nlParam ) // METHOD WvgTreeView:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + RETURN Self // METHOD WvgTreeView:itemFromPos( aPos ) + HB_SYMBOL_UNUSED( aPos ) + RETURN Self // METHOD WvgTreeView:itemCollapsed( xParam ) - IF HB_ISBLOCK( xParam ) .or. ( xParam == NIL ) + IF HB_ISBLOCK( xParam ) .OR. xParam == NIL ::sl_paint := xParam ENDIF @@ -324,7 +333,7 @@ METHOD WvgTreeView:itemCollapsed( xParam ) METHOD WvgTreeView:itemExpanded( xParam ) - IF HB_ISBLOCK( xParam ) .or. ( xParam == NIL ) + IF HB_ISBLOCK( xParam ) .OR. xParam == NIL ::sl_itemExpanded := xParam ENDIF @@ -334,7 +343,7 @@ METHOD WvgTreeView:itemExpanded( xParam ) METHOD WvgTreeView:itemMarked( xParam ) - IF HB_ISBLOCK( xParam ) .or. ( xParam == NIL ) + IF HB_ISBLOCK( xParam ) .OR. xParam == NIL ::sl_itemMarked := xParam ENDIF @@ -342,24 +351,28 @@ METHOD WvgTreeView:itemMarked( xParam ) // #if 0 + METHOD WvgTreeView:itemSelected( xParam ) - IF HB_ISBLOCK( xParam ) .or. ( xParam == NIL ) + IF HB_ISBLOCK( xParam ) .OR. xParam == NIL ::sl_itemSelected := xParam ENDIF RETURN Self + #endif + // /* Class WvgTreeViewItem */ // + CLASS WvgTreeViewItem DATA caption INIT "" DATA dllName INIT NIL - DATA expandedImage INIT -1 - DATA image INIT -1 - DATA markedImage INIT -1 + DATA expandedImage INIT - 1 + DATA image INIT - 1 + DATA markedImage INIT - 1 DATA hTree DATA hItem @@ -375,7 +388,7 @@ CLASS WvgTreeViewItem METHOD destroy() METHOD expand( lExpand ) INLINE WVG_TreeView_Expand( ::hTree, ::hItem, ; - iif( HB_ISLOGICAL( lExpand ), lExpand, .T. ) ) + iif( HB_ISLOGICAL( lExpand ), lExpand, .T. ) ) METHOD isExpanded() METHOD setCaption( cCaption ) METHOD setExpandedImage( nResIdoBitmap ) @@ -388,7 +401,8 @@ CLASS WvgTreeViewItem METHOD getParentItem() METHOD insItem() - ENDCLASS +ENDCLASS + // METHOD new() CLASS WvgTreeViewItem @@ -432,6 +446,7 @@ METHOD setCaption( cCaption ) CLASS WvgTreeViewItem METHOD setExpandedImage( nResIdoBitmap ) CLASS WvgTreeViewItem HB_SYMBOL_UNUSED( nResIdoBitmap ) + RETURN NIL // @@ -453,7 +468,8 @@ METHOD setMarkedImage( nResIdoBitmap ) CLASS WvgTreeViewItem // METHOD addItem( cCaption ) CLASS WvgTreeViewItem - Local oItem, hParent + + LOCAL oItem, hParent oItem := WvgTreeViewItem():New() @@ -466,7 +482,7 @@ METHOD addItem( cCaption ) CLASS WvgTreeViewItem oItem:hItem := Wvg_TreeView_AddItem( oItem:hTree, hParent, oItem:caption ) - aadd( oItem:oWnd:aItems, oItem ) + AAdd( oItem:oWnd:aItems, oItem ) RETURN oItem diff --git a/harbour/contrib/gtwvg/wnd.prg b/harbour/contrib/gtwvg/wnd.prg index ba349853c4..698b66ea88 100644 --- a/harbour/contrib/gtwvg/wnd.prg +++ b/harbour/contrib/gtwvg/wnd.prg @@ -49,6 +49,7 @@ * If you do not wish that, delete this exception notice. * */ + // // // @@ -75,12 +76,12 @@ #include "wvgparts.ch" // - * To Switch Over from ASCALLBACK() to SET/GET_Prop() calls - * +// To Switch Over from ASCALLBACK() to SET/GET_Prop() calls +// #if 0 - #define __BYASCALLBACK__ +#define __BYASCALLBACK__ #else - #define __BYSETPROP__ +#define __BYSETPROP__ #endif // @@ -163,8 +164,8 @@ CLASS WvgWindow INHERIT WvgPartHandler DATA hWnd DATA pWnd - DATA aPos INIT { 0,0 } - DATA aSize INIT { 0,0 } + DATA aPos INIT { 0, 0 } + DATA aSize INIT { 0, 0 } DATA aPresParams INIT {} DATA lHasInputFocus INIT .F. DATA nFrameState INIT 0 /* normal */ @@ -248,9 +249,9 @@ CLASS WvgWindow INHERIT WvgPartHandler METHOD rbDown( xParam ) SETGET METHOD rbUp( xParam ) SETGET METHOD wheel( xParam ) SETGET - METHOD close( xParam ) SETGET + METHOD CLOSE( xParam ) SETGET METHOD helpRequest( xParam ) SETGET - METHOD keyboard( xParam ) SETGET + METHOD KEYBOARD( xParam ) SETGET METHOD killDisplayFocus( xParam ) SETGET METHOD killInputFocus( xParam ) SETGET METHOD move( xParam ) SETGET @@ -263,13 +264,13 @@ CLASS WvgWindow INHERIT WvgPartHandler METHOD dragMotion( xParam ) SETGET METHOD dragLeave( xParam ) SETGET METHOD dragDrop( xParam, xParam1 ) SETGET -PROTECTED: + PROTECTED: METHOD getPosAndSize( aPs, aSz ) METHOD isParentCrt() INLINE ( ::oParent:objType == objTypeCrt ) METHOD rePosition() METHOD createControl() - ENDCLASS +ENDCLASS // @@ -311,7 +312,7 @@ METHOD WvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::aPresParams := aPresParams ::visible := lVisible - IF empty( ::oParent ) + IF Empty( ::oParent ) IF ! ( __objGetClsName( Self ) $ "WVGCRT,WVGDIALOG" ) ::oParent := WvgSetAppWindow() ENDIF @@ -338,12 +339,12 @@ METHOD WvgWindow:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible METHOD WvgWindow:destroy() - IF ! empty( ::oParent ) + IF ! Empty( ::oParent ) ::oParent:removeChild( Self ) ENDIF IF Len( ::aChildren ) > 0 - aeval( ::aChildren, {| o | o:destroy() } ) + AEval( ::aChildren, {| o | o:destroy() } ) ::aChildren := {} ENDIF @@ -427,12 +428,15 @@ METHOD WvgWindow:destroy() // METHOD WvgWindow:SetWindowProcCallback() + ::nOldProc := WVG_SetWindowProcBlock( ::pWnd, {| h, m, w, l | ::ControlWndProc( h, m, w, l ) } ) + RETURN Self // METHOD WvgWindow:captureMouse() + RETURN Self // @@ -489,6 +493,7 @@ METHOD WvgWindow:lockUpdate() // METHOD WvgWindow:setColorBG( nRGB ) + LOCAL hBrush IF HB_ISSTRING( nRGB ) @@ -500,7 +505,7 @@ METHOD WvgWindow:setColorBG( nRGB ) ::clr_BG := nRGB ::hBrushBG := hBrush - IF ::className == "WVGDIALOG" .OR. __ObjGetClsName( Self ) == "WVGCHECKBOX" + IF ::className == "WVGDIALOG" .OR. __objGetClsName( Self ) == "WVGCHECKBOX" Wvg_SetCurrentBrush( ::hWnd, ::hBrushBG ) ENDIF ENDIF @@ -529,6 +534,7 @@ METHOD WvgWindow:setTrackPointer() // METHOD WvgWindow:setPos( aPos, lPaint ) + LOCAL aPosSz IF HB_ISARRAY( aPos ) @@ -547,11 +553,10 @@ METHOD WvgWindow:setPos( aPos, lPaint ) END ENDIF - RETURN Self // -/* This will always be called from HB_GTE_RESIZED message of WVG engine */ + /* This will always be called from HB_GTE_RESIZED message of WVG engine */ METHOD WvgWindow:rePosition() @@ -560,6 +565,7 @@ METHOD WvgWindow:rePosition() // METHOD WvgWindow:setPosAndSize( aPos, aSize, lPaint ) + LOCAL aPosSz DEFAULT aPos TO ::aPos @@ -586,6 +592,7 @@ METHOD WvgWindow:setPosAndSize( aPos, aSize, lPaint ) // METHOD WvgWindow:setSize( aSize, lPaint ) + LOCAL aPosSz IF HB_ISARRAY( aSize ) @@ -603,23 +610,25 @@ METHOD WvgWindow:setSize( aSize, lPaint ) END ENDIF + RETURN Self // METHOD WvgWindow:isDerivedFrom( cClassORoObject ) + LOCAL lTrue := .F. - LOCAL cCls := __ObjGetClsName( self ) + LOCAL cCls := __objGetClsName( self ) /* Compares without Xbp or Wvg prefixes */ IF HB_ISSTRING( cClassORoObject ) - IF upper( substr( cClassORoObject,4 ) ) == upper( substr( cCls,4 ) ) + IF Upper( SubStr( cClassORoObject,4 ) ) == Upper( SubStr( cCls,4 ) ) lTrue := .T. ENDIF ELSEIF HB_ISOBJECT( cClassORoObject ) - IF upper( substr( cClassORoObject:className,4 ) ) == upper( substr( cCls,4 ) ) + IF Upper( SubStr( cClassORoObject:className,4 ) ) == Upper( SubStr( cCls,4 ) ) lTrue := .T. ENDIF ENDIF @@ -647,6 +656,7 @@ METHOD WvgWindow:toBack() METHOD WvgWindow:toFront() /*RETURN WVG_SetForeGroundWindow( ::hWnd ) */ + RETURN WVG_SetWindowPosToTop( ::hWnd ) // @@ -670,34 +680,35 @@ METHOD WvgWindow:setFont() // METHOD WvgWindow:setFontCompoundName( xFont ) + LOCAL cOldFont, s, n, nPoint, cFont, cAttr, cFace - LOCAL aAttr := { "normal","italic","bold" } + LOCAL aAttr := { "normal", "italic", "bold" } cOldFont := ::fnt_COMMPOUNDNAME IF HB_ISNUMERIC( cFont ) ELSE - IF !empty( xFont ) + IF !Empty( xFont ) cFont := xFont - s := lower( cFont ) - n := ascan( aAttr, {| e | at( e, cFont ) > 0 } ) + s := Lower( cFont ) + n := AScan( aAttr, {| e | At( e, cFont ) > 0 } ) IF n > 0 cAttr := aAttr[ n ] - n := at( cAttr, s ) - cFont := substr( cFont,1,n-1 ) + n := At( cAttr, s ) + cFont := SubStr( cFont, 1, n - 1 ) ELSE cAttr := "normal" ENDIF - IF ( n := at( ".", cFont ) ) > 0 - nPoint := val( substr( cFont,1,n-1 ) ) - cFont := substr( cFont,n+1 ) + IF ( n := At( ".", cFont ) ) > 0 + nPoint := Val( SubStr( cFont,1,n - 1 ) ) + cFont := SubStr( cFont, n + 1 ) ELSE nPoint := 0 ENDIF - cFace := alltrim( cFont ) + cFace := AllTrim( cFont ) HB_SYMBOL_UNUSED( cFace ) HB_SYMBOL_UNUSED( cAttr ) @@ -716,6 +727,7 @@ METHOD WvgWindow:setPresParam() // METHOD WvgWindow:currentPos() + LOCAL aRect := WVG_GetWindowRect( ::hWnd ) RETURN { aRect[ 1 ], aRect[ 2 ] } @@ -723,6 +735,7 @@ METHOD WvgWindow:currentPos() // METHOD WvgWindow:currentSize() + LOCAL aRect aRect := WVG_GetClientRect( ::hWnd ) @@ -748,20 +761,20 @@ METHOD WvgWindow:hasInputFocus() RETURN Self // - * Callback Methods +// Callback Methods // METHOD WvgWindow:enter( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_enter ) - eval( ::sl_enter, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_enter ) + Eval( ::sl_enter, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_enter := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -769,15 +782,15 @@ METHOD WvgWindow:enter( xParam ) METHOD WvgWindow:leave( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_leave ) - eval( ::sl_leave, NIL, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_leave ) + Eval( ::sl_leave, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_leave := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -785,15 +798,15 @@ METHOD WvgWindow:leave( xParam ) METHOD WvgWindow:lbClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_lbClick ) - eval( ::sl_lbClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_lbClick ) + Eval( ::sl_lbClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -801,15 +814,15 @@ METHOD WvgWindow:lbClick( xParam ) METHOD WvgWindow:lbDblClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_lbDblClick ) - eval( ::sl_lbDblClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_lbDblClick ) + Eval( ::sl_lbDblClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbDblClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -817,15 +830,15 @@ METHOD WvgWindow:lbDblClick( xParam ) METHOD WvgWindow:lbDown( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_lbDown ) - eval( ::sl_lbDown, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_lbDown ) + Eval( ::sl_lbDown, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbDown := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -833,15 +846,15 @@ METHOD WvgWindow:lbDown( xParam ) METHOD WvgWindow:lbUp( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_lbUp ) - eval( ::sl_lbUp, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_lbUp ) + Eval( ::sl_lbUp, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_lbUp := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -849,15 +862,15 @@ METHOD WvgWindow:lbUp( xParam ) METHOD WvgWindow:mbClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_mbClick ) - eval( ::sl_mbClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_mbClick ) + Eval( ::sl_mbClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_mbClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -865,15 +878,15 @@ METHOD WvgWindow:mbClick( xParam ) METHOD WvgWindow:mbDblClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_mbDblClick ) - eval( ::sl_mbDblClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_mbDblClick ) + Eval( ::sl_mbDblClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_mbDblClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -881,15 +894,15 @@ METHOD WvgWindow:mbDblClick( xParam ) METHOD WvgWindow:mbDown( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_mbDown ) - eval( ::sl_mbDown, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_mbDown ) + Eval( ::sl_mbDown, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_mbDown := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -897,15 +910,15 @@ METHOD WvgWindow:mbDown( xParam ) METHOD WvgWindow:mbUp( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_mbUp ) - eval( ::sl_mbUp, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_mbUp ) + Eval( ::sl_mbUp, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_mbUp := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -913,15 +926,15 @@ METHOD WvgWindow:mbUp( xParam ) METHOD WvgWindow:motion( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_motion ) - eval( ::sl_motion, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_motion ) + Eval( ::sl_motion, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_motion := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -929,15 +942,15 @@ METHOD WvgWindow:motion( xParam ) METHOD WvgWindow:rbClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_rbClick ) - eval( ::sl_rbClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_rbClick ) + Eval( ::sl_rbClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_rbClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -945,15 +958,15 @@ METHOD WvgWindow:rbClick( xParam ) METHOD WvgWindow:rbDblClick( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_rbDblClick ) - eval( ::sl_rbDblClick, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_rbDblClick ) + Eval( ::sl_rbDblClick, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_rbDblClick := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -961,15 +974,15 @@ METHOD WvgWindow:rbDblClick( xParam ) METHOD WvgWindow:rbDown( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_rbDown ) - eval( ::sl_rbDown, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_rbDown ) + Eval( ::sl_rbDown, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_rbDown := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -977,15 +990,15 @@ METHOD WvgWindow:rbDown( xParam ) METHOD WvgWindow:rbUp( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_rbUp ) - eval( ::sl_rbUp, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_rbUp ) + Eval( ::sl_rbUp, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_rbUp := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -993,49 +1006,51 @@ METHOD WvgWindow:rbUp( xParam ) METHOD WvgWindow:wheel( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_wheel ) - eval( ::sl_wheel, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_wheel ) + Eval( ::sl_wheel, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_wheel := xParam RETURN NIL - endif + ENDIF RETURN Self // - * Other Messages +// Other Messages // METHOD WvgWindow:close( xParam ) - if ::objType == objTypeCrt - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_close ) - eval( ::sl_close, NIL, NIL, Self ) - RETURN Self - endif - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + if ::objType == objTypeCrt + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_close ) + Eval( ::sl_close, NIL, NIL, Self ) + RETURN Self + ENDIF + + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_close := xParam RETURN NIL - endif - endif + ENDIF + ENDIF + RETURN Self // METHOD WvgWindow:helpRequest( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_helpRequest ) - eval( ::sl_helpRequest, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_helpRequest ) + Eval( ::sl_helpRequest, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_helpRequest := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1043,47 +1058,49 @@ METHOD WvgWindow:helpRequest( xParam ) METHOD WvgWindow:keyboard( xParam ) - if HB_ISNUMERIC( xParam ) .and. HB_ISBLOCK( ::sl_keyboard ) - eval( ::sl_keyboard, xParam, NIL, Self ) + IF HB_ISNUMERIC( xParam ) .AND. HB_ISBLOCK( ::sl_keyboard ) + Eval( ::sl_keyboard, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_keyboard := xParam RETURN NIL - endif + ENDIF RETURN Self // METHOD WvgWindow:killDisplayFocus( xParam ) - if ::objType == objTypeCrt - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_killDisplayFocus ) - eval( ::sl_killDisplayFocus, NIL, NIL, Self ) - RETURN Self - endif - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + if ::objType == objTypeCrt + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_killDisplayFocus ) + Eval( ::sl_killDisplayFocus, NIL, NIL, Self ) + RETURN Self + ENDIF + + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_killDisplayFocus := xParam RETURN NIL - endif - endif + ENDIF + ENDIF + RETURN Self // METHOD WvgWindow:killInputFocus( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_killInputFocus ) - eval( ::sl_killInputFocus, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_killInputFocus ) + Eval( ::sl_killInputFocus, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_killInputFocus := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1091,15 +1108,15 @@ METHOD WvgWindow:killInputFocus( xParam ) METHOD WvgWindow:move( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_move ) - eval( ::sl_move, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_move ) + Eval( ::sl_move, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_move := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1107,15 +1124,15 @@ METHOD WvgWindow:move( xParam ) METHOD WvgWindow:paint( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_paint ) - eval( ::sl_paint, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_paint ) + Eval( ::sl_paint, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_paint := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1123,15 +1140,15 @@ METHOD WvgWindow:paint( xParam ) METHOD WvgWindow:quit( xParam, xParam1 ) - if HB_ISNUMERIC( xParam ) .and. HB_ISBLOCK( ::sl_quit ) - eval( ::sl_quit, xParam, xParam1, Self ) + IF HB_ISNUMERIC( xParam ) .AND. HB_ISBLOCK( ::sl_quit ) + Eval( ::sl_quit, xParam, xParam1, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_quit := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1139,15 +1156,15 @@ METHOD WvgWindow:quit( xParam, xParam1 ) METHOD WvgWindow:resize( xParam, xParam1 ) - if HB_ISARRAY( xParam ) .and. HB_ISARRAY( xParam1 ) .and. HB_ISBLOCK( ::sl_resize ) - eval( ::sl_resize, xParam, xParam1, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISARRAY( xParam1 ) .AND. HB_ISBLOCK( ::sl_resize ) + Eval( ::sl_resize, xParam, xParam1, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) /*.or. HB_ISNIL( xParam )*/ + IF HB_ISBLOCK( xParam ) /*.or. HB_ISNIL( xParam )*/ ::sl_resize := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1156,31 +1173,32 @@ METHOD WvgWindow:resize( xParam, xParam1 ) METHOD WvgWindow:setDisplayFocus( xParam ) if ::objType == objTypeCrt - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::setDisplayFocus ) - eval( ::setDisplayFocus, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::setDisplayFocus ) + Eval( ::setDisplayFocus, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::setDisplayFocus := xParam RETURN NIL - endif - endif + ENDIF + ENDIF + RETURN Self // METHOD WvgWindow:setInputFocus( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_setInputFocus ) - eval( ::sl_setInputFocus, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_setInputFocus ) + Eval( ::sl_setInputFocus, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_setInputFocus := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1188,15 +1206,15 @@ METHOD WvgWindow:setInputFocus( xParam ) METHOD WvgWindow:dragEnter( xParam, xParam1 ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_dragEnter ) - eval( ::sl_dragEnter, xParam, xParam1, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_dragEnter ) + Eval( ::sl_dragEnter, xParam, xParam1, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_dragEnter := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1204,15 +1222,15 @@ METHOD WvgWindow:dragEnter( xParam, xParam1 ) METHOD WvgWindow:dragMotion( xParam ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_dragMotion ) - eval( ::sl_dragMotion, xParam, NIL, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_dragMotion ) + Eval( ::sl_dragMotion, xParam, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_dragMotion := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1220,15 +1238,15 @@ METHOD WvgWindow:dragMotion( xParam ) METHOD WvgWindow:dragLeave( xParam ) - if HB_ISNIL( xParam ) .and. HB_ISBLOCK( ::sl_dragLeave ) - eval( ::sl_dragLeave, NIL, NIL, Self ) + IF HB_ISNIL( xParam ) .AND. HB_ISBLOCK( ::sl_dragLeave ) + Eval( ::sl_dragLeave, NIL, NIL, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_dragLeave := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1236,15 +1254,15 @@ METHOD WvgWindow:dragLeave( xParam ) METHOD WvgWindow:dragDrop( xParam, xParam1 ) - if HB_ISARRAY( xParam ) .and. HB_ISBLOCK( ::sl_dragDrop ) - eval( ::sl_dragDrop, xParam, xParam1, Self ) + IF HB_ISARRAY( xParam ) .AND. HB_ISBLOCK( ::sl_dragDrop ) + Eval( ::sl_dragDrop, xParam, xParam1, Self ) RETURN Self - endif + ENDIF - if HB_ISBLOCK( xParam ) .or. HB_ISNIL( xParam ) + IF HB_ISBLOCK( xParam ) .OR. HB_ISNIL( xParam ) ::sl_dragDrop := xParam RETURN NIL - endif + ENDIF RETURN Self @@ -1271,21 +1289,25 @@ METHOD WvgWindow:Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible // METHOD WvgWindow:setFocus() + WVG_SetFocus( ::hWnd ) + RETURN Self // METHOD WvgWindow:sendMessage( nMessage, nlParam, nwParam ) + RETURN WVG_SendMessage( ::hWnd, nMessage, nlParam, nwParam ) // METHOD WvgWindow:findObjectByHandle( hWnd ) + LOCAL nObj - IF len( ::aChildren ) > 0 - IF ( nObj := ascan( ::aChildren, {| o | o:hWnd == hWnd } ) ) > 0 + IF Len( ::aChildren ) > 0 + IF ( nObj := AScan( ::aChildren, {| o | o:hWnd == hWnd } ) ) > 0 RETURN ::aChildren[ nObj ] ENDIF ENDIF @@ -1295,44 +1317,45 @@ METHOD WvgWindow:findObjectByHandle( hWnd ) // METHOD WvgWindow:getPosAndSize( aPs, aSz ) + LOCAL nX, nY, nW, nH, aXY LOCAL aPos, aSize LOCAL nFH, nFW - DEFAULT aPs TO aclone( ::aPos ) - DEFAULT aSz TO aclone( ::aSize ) + DEFAULT aPs TO AClone( ::aPos ) + DEFAULT aSz TO AClone( ::aSize ) - aPos := aclone( aPs ) - aSize := aclone( aSz ) + aPos := AClone( aPs ) + aSize := AClone( aSz ) IF ::isParentCrt() IF HB_ISBLOCK( aPos[ 1 ] ) - aPos[ 1 ] := eval( aPos[ 1 ] ) + aPos[ 1 ] := Eval( aPos[ 1 ] ) ENDIF IF HB_ISBLOCK( aPos[ 2 ] ) - aPos[ 2 ] := eval( aPos[ 2 ] ) + aPos[ 2 ] := Eval( aPos[ 2 ] ) ENDIF IF HB_ISBLOCK( aSize[ 1 ] ) - aSize[ 1 ] := eval( aSize[ 1 ] ) + aSize[ 1 ] := Eval( aSize[ 1 ] ) ENDIF IF HB_ISBLOCK( aSize[ 2 ] ) - aSize[ 2 ] := eval( aSize[ 2 ] ) + aSize[ 2 ] := Eval( aSize[ 2 ] ) ENDIF IF aPos[ 1 ] < 0 .AND. aPos[ 2 ] < 0 .AND. aSize[ 1 ] < 0 .AND. aSize[ 2 ] < 0 - nX := abs( aPos[ 2 ] ) + nX := Abs( aPos[ 2 ] ) IF nX < 1 nX := 0 ENDIF - nY := abs( aPos[ 1 ] ) + nY := Abs( aPos[ 1 ] ) IF nY < 1 nY := 0 ENDIF - nW := abs( aSize[ 2 ] ) + nW := Abs( aSize[ 2 ] ) IF nW < 1 nW := 0 ENDIF - nH := abs( aSize[ 1 ] ) + nH := Abs( aSize[ 1 ] ) IF nH < 1 nH := 0 ENDIF @@ -1361,6 +1384,7 @@ METHOD WvgWindow:toolTipText( cText ) // METHOD WvgWindow:createControl() + LOCAL hWnd, aPosSz ::nID := ::oParent:GetControlId() @@ -1368,15 +1392,15 @@ METHOD WvgWindow:createControl() aPosSz := ::getPosAndSize( ::aPos, ::aSize ) hWnd := WVG_CreateWindowEx( ::exStyle, ; - ::className, ; - "", ; /* window name */ - ::style, ; - aPosSz[ 1 ], aPosSz[ 2 ], ; - aPosSz[ 3 ], aPosSz[ 4 ], ; - ::oParent:hWnd, ; - ::nID, ; /* hMenu */ - NIL, ; /* hInstance */ - NIL ) /* lParam */ + ::className, ; + "", ; /* window name */ + ::style, ; + aPosSz[ 1 ], aPosSz[ 2 ], ; + aPosSz[ 3 ], aPosSz[ 4 ], ; + ::oParent:hWnd, ; + ::nID, ; /* hMenu */ + NIL, ; /* hInstance */ + NIL ) /* lParam */ IF WVG_IsWindow( hWnd ) ::hWnd := hWnd ::pWnd := WIN_N2P( hWnd ) diff --git a/harbour/extras/gtwvw/gtwvw.c b/harbour/extras/gtwvw/gtwvw.c index 9f6f984053..fddd82ce27 100644 --- a/harbour/extras/gtwvw/gtwvw.c +++ b/harbour/extras/gtwvw/gtwvw.c @@ -1,5 +1,5 @@ /* -* $Id$ + * $Id$ */ /* @@ -76,30 +76,30 @@ */ /* -* Individual authors: -* (C) 2003-2004 Giancarlo Niccolai -* Standard xplatform GT Info system, -* Graphical object system and event system. -* GTINFO() And GTO_* implementation. -* -* (C) 2004 Mauricio Abre -* Cross-GT, multiplatform Graphics API -* -* (C) 2009 Cristiam Azambuja -* Marson de Paula -* Data Cempro Informatica (www.datacempro.com.br) -* Refactoring for xHarbour 1.2.1 -*/ + * Individual authors: + * (C) 2003-2004 Giancarlo Niccolai + * Standard xplatform GT Info system, + * Graphical object system and event system. + * GTINFO() And GTO_* implementation. + * + * (C) 2004 Mauricio Abre + * Cross-GT, multiplatform Graphics API + * + * (C) 2009 Cristiam Azambuja + * Marson de Paula + * Data Cempro Informatica (www.datacempro.com.br) + * Refactoring for xHarbour 1.2.1 + */ #include "hbgtwvw.h" -#if defined(__WATCOMC__) +#if defined( __WATCOMC__ ) #include #endif #include "hbgfxdef.ch" -#define SubclassWindow(hwnd, lpfn) \ - ((WNDPROC)SetWindowLongPtr((hwnd), GWLP_WNDPROC, (LPARAM)(WNDPROC)(lpfn))) +#define SubclassWindow( hwnd, lpfn ) \ + ( ( WNDPROC ) SetWindowLongPtr( ( hwnd ), GWLP_WNDPROC, ( LPARAM ) ( WNDPROC ) ( lpfn ) ) ) @@ -112,7 +112,7 @@ //static BOOL s_bVertCaret = FALSE; /* if TRUE, caret is in Vertical style */ //static BOOL s_bNOSTARTUPSUBWINDOW = FALSE; /* if TRUE, subwindow will not be displayed during opening */ - /* use WVW_NOSTARTUPSUBWINDOW() to check/set it */ +/* use WVW_NOSTARTUPSUBWINDOW() to check/set it */ //static BOOL s_bDefCentreWindow = FALSE; /* default CentreWindow setting for subwindows */ @@ -122,13 +122,13 @@ //static int s_byDefLineSpacing = 0; /* default line spacing */ //static int s_iDefLSpaceColor = -1; /* if >= 0 this will be the color index - //for spacing between lines */ +//for spacing between lines */ //static BOOL s_bAllowNonTop = FALSE; /* allow non-topmost window's control to - //accept input */ +//accept input */ //static BOOL s_bRecurseCBlock = FALSE; /* allow control's codeblock - //to recurse */ +//to recurse */ //static LOGFONT s_lfPB = { 0 }; /* default font for pushbuttons */ @@ -148,13 +148,13 @@ //static BOOL s_bQuickSetMode = FALSE; /* quick SetMode(), to reset maxrow() and maxcol() only */ //static BOOL s_bFlashingWindow = FALSE; /* topmost window is flashing - //due to invalid input on other - //window */ +//due to invalid input on other +//window */ //static int s_iScrolling = 0; /* scrollbar is scrolling */ //static int s_iWrongButtonUp = 0; /* number of consecutive scrollbar's WM_LBUTTONUP encountered by gtProcessMessages */ //static int s_iMaxWrongButtonUp = 500; /* max number of s_iWrongButtonUp. If it goes higher than this number, - //the scrollbar is forced to stop */ +//the scrollbar is forced to stop */ //static TCHAR szAppName[] = TEXT( "Harbour WVW" ); //static TCHAR szSubWinName[] = TEXT( "Harbour WVW subwindows" ); @@ -165,9 +165,9 @@ //static WIN_DATA *s_pWindows[ WVW_MAXWINDOWS ]; /*array of WIN_DATA */ //static APP_DATA s_sApp; /*application wide vars */ -WVW_DATA *s_pWvwData; -static BOOL bStartMode = TRUE; -static COLORREF _COLORS[] = { +WVW_DATA * s_pWvwData; +static BOOL bStartMode = TRUE; +static COLORREF _COLORS[] = { BLACK, BLUE, GREEN, @@ -187,15 +187,15 @@ static COLORREF _COLORS[] = { }; #ifdef WVW_DEBUG -static int nCountPuts=0,nCountScroll=0, nCountPaint=0, nSetFocus=0, nKillFocus=0; +static int nCountPuts = 0, nCountScroll = 0, nCountPaint = 0, nSetFocus = 0, nKillFocus = 0; #endif -static int K_Ctrl[] = { - K_CTRL_A, K_CTRL_B, K_CTRL_C, K_CTRL_D, K_CTRL_E, K_CTRL_F, K_CTRL_G, K_CTRL_H, - K_CTRL_I, K_CTRL_J, K_CTRL_K, K_CTRL_L, K_CTRL_M, K_CTRL_N, K_CTRL_O, K_CTRL_P, - K_CTRL_Q, K_CTRL_R, K_CTRL_S, K_CTRL_T, K_CTRL_U, K_CTRL_V, K_CTRL_W, K_CTRL_X, - K_CTRL_Y, K_CTRL_Z - }; +static int K_Ctrl[] = { + K_CTRL_A, K_CTRL_B, K_CTRL_C, K_CTRL_D, K_CTRL_E, K_CTRL_F, K_CTRL_G, K_CTRL_H, + K_CTRL_I, K_CTRL_J, K_CTRL_K, K_CTRL_L, K_CTRL_M, K_CTRL_N, K_CTRL_O, K_CTRL_P, + K_CTRL_Q, K_CTRL_R, K_CTRL_S, K_CTRL_T, K_CTRL_U, K_CTRL_V, K_CTRL_W, K_CTRL_X, + K_CTRL_Y, K_CTRL_Z +}; /* */ @@ -203,7 +203,7 @@ static int K_Ctrl[] = { /* */ HB_EXTERN_BEGIN static void hb_gtInitStatics( UINT usWinNum, LPCTSTR lpszWinName, USHORT usRow1, USHORT usCol1, USHORT usRow2, USHORT usCol2 ); -static void hb_gt_wvwAddCharToInputQueue ( int data ); +static void hb_gt_wvwAddCharToInputQueue( int data ); static HWND hb_gt_wvwCreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow ); static BOOL hb_gt_wvwInitWindow( WIN_DATA * pWindowData, HWND hWnd, USHORT col, USHORT row ); @@ -215,15 +215,15 @@ static BOOL hb_gt_wvwAllocSpBuffer( WIN_DATA * pWindowData, USHORT col, USHOR static void hb_gt_wvwSetWindowTitle( UINT usWinNum, const char * title ); static BOOL hb_gt_wvw_GetWindowTitle( UINT usWinNum, char ** title ); //static DWORD hb_gt_wvwSetWindowIcon( UINT usWinNum, int icon, char *lpIconName ); -static HICON hb_gt_wvwSetWindowIcon( UINT usWinNum, int icon, const char *lpIconName ); +static HICON hb_gt_wvwSetWindowIcon( UINT usWinNum, int icon, const char * lpIconName ); //static DWORD hb_gt_wvwSetWindowIconFromFile( UINT usWinNum, char *icon ); -static HICON hb_gt_wvwSetWindowIconFromFile( UINT usWinNum, const char *icon ); +static HICON hb_gt_wvwSetWindowIconFromFile( UINT usWinNum, const char * icon ); static BOOL hb_gt_wvwSetCentreWindow( UINT usWinNum, BOOL bCentre, BOOL bPaint ); static BOOL hb_gt_wvwValidWindowSize( WIN_DATA * pWindowData, int rows, int cols, HFONT hFont, int iWidth, - int *pmaxrows, int *pmaxcols ); + int * pmaxrows, int * pmaxcols ); static void hb_gt_wvwSetCaretOn( WIN_DATA * pWindowData, BOOL bOn ); static BOOL hb_gt_wvwSetCaretPos( WIN_DATA * pWindowData ); @@ -240,9 +240,9 @@ static void hb_gt_wvwDoInvalidateRect( WIN_DATA * pWindowData ); static void hb_gt_wvwHandleMenuSelection( int ); -static void hb_gt_wvwUnreachedXY( WIN_DATA * pWindowData, int *cols, int *rows ); -static POINT hb_gt_wvwGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHORT y); -static POINT hb_gt_wvwTBGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHORT y); +static void hb_gt_wvwUnreachedXY( WIN_DATA * pWindowData, int * cols, int * rows ); +static POINT hb_gt_wvwGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHORT y ); +static POINT hb_gt_wvwTBGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHORT y ); static POINT hb_gt_wvwGetColRowForTextBuffer( WIN_DATA * pWindowData, USHORT index ); @@ -255,8 +255,8 @@ static BOOL hb_gt_wvwSetColors( WIN_DATA * pWindowData, HDC hdc, BYTE attr ); -static BOOL hb_gt_wvwTextOut( WIN_DATA * pWindowData, HDC hdc, USHORT col, USHORT row, LPCTSTR lpString, USHORT cbString ); -static void hb_gt_wvwSetStringInTextBuffer( WIN_DATA * pWindowData, int col, int row, BYTE color, BYTE attr, BYTE *sBuffer, ULONG length ); +static BOOL hb_gt_wvwTextOut( WIN_DATA * pWindowData, HDC hdc, USHORT col, USHORT row, LPCTSTR lpString, USHORT cbString ); +static void hb_gt_wvwSetStringInTextBuffer( WIN_DATA * pWindowData, int col, int row, BYTE color, BYTE attr, BYTE * sBuffer, ULONG length ); static USHORT hb_gt_wvwGetIndexForTextBuffer( WIN_DATA * pWindowData, USHORT col, USHORT row ); @@ -280,7 +280,7 @@ static BOOL hb_gt_wvwBufferedKey( LONG lKey ); static void hb_gt_wvwInputNotAllowed( UINT usWinNum, UINT message, WPARAM wParam, LPARAM lParam ); static BOOL hb_gt_wvwInWindow( UINT usWinNum, USHORT usrow, USHORT uscol ); -static UINT hb_gt_wvwFindWindow(USHORT usRow, USHORT usCol); +static UINT hb_gt_wvwFindWindow( USHORT usRow, USHORT usCol ); static UINT hb_gt_wvwSetCurWindow( UINT usWinNum ); /* functions created in order to allow us operating MainCoord Mode: */ @@ -290,8 +290,8 @@ static void hb_wvw_vmouse_SetPos( WIN_DATA * pWindowData, USHORT usRow, USHORT static int hb_gt_wvw_usDispCount( WIN_DATA * pWindowData ); static void hb_gt_wvw_vDispBegin( WIN_DATA * pWindowData ); static void hb_gt_wvw_vDispEnd( WIN_DATA * pWindowData ); -static void hb_gt_wvw_vGetText( WIN_DATA * pWindowData, USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer); -static void hb_gt_wvw_vPuts( WIN_DATA * pWindowData, int iRow, int iCol, BYTE byColor, BYTE byAttr, BYTE *pbyStr, ULONG ulLen ); +static void hb_gt_wvw_vGetText( WIN_DATA * pWindowData, USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer ); +static void hb_gt_wvw_vPuts( WIN_DATA * pWindowData, int iRow, int iCol, BYTE byColor, BYTE byAttr, BYTE * pbyStr, ULONG ulLen ); static void hb_gt_wvw_vReplicate( WIN_DATA * pWindowData, int iRow, int iCol, int bColor, BYTE bAttr, USHORT usChar, ULONG ulLen ); static void hb_gt_wvw_vPutText( WIN_DATA * pWindowData, USHORT top, USHORT left, USHORT bottom, USHORT right, const char * sBuffer, int bColor ); static void hb_gt_wvw_vSetAttribute( WIN_DATA * pWindowData, int iTop, int iLeft, int iBottom, int iRight, int bColor ); @@ -306,33 +306,33 @@ static void hb_wvw_UpdatePendingRect( WIN_DATA * pWindowData, USHORT usRow1, U static void hb_gt_wvwFillLineSpace( WIN_DATA * pWindowData, HDC hdc, USHORT startCol, USHORT irow, USHORT len, BYTE byAttrib ); -static BITMAPINFO * PackedDibLoad (PTSTR szFileName); -static int PackedDibGetWidth (BITMAPINFO * pPackedDib); -static int PackedDibGetHeight (BITMAPINFO * pPackedDib); -static int PackedDibGetBitCount (BITMAPINFO * pPackedDib); +static BITMAPINFO * PackedDibLoad( PTSTR szFileName ); +static int PackedDibGetWidth( BITMAPINFO * pPackedDib ); +static int PackedDibGetHeight( BITMAPINFO * pPackedDib ); +static int PackedDibGetBitCount( BITMAPINFO * pPackedDib ); -static int PackedDibGetInfoHeaderSize (BITMAPINFO * pPackedDib); -static int PackedDibGetColorsUsed (BITMAPINFO * pPackedDib); -static int PackedDibGetNumColors (BITMAPINFO * pPackedDib); -static int PackedDibGetColorTableSize (BITMAPINFO * pPackedDib); +static int PackedDibGetInfoHeaderSize( BITMAPINFO * pPackedDib ); +static int PackedDibGetColorsUsed( BITMAPINFO * pPackedDib ); +static int PackedDibGetNumColors( BITMAPINFO * pPackedDib ); +static int PackedDibGetColorTableSize( BITMAPINFO * pPackedDib ); -static BYTE * PackedDibGetBitsPtr (BITMAPINFO * pPackedDib); +static BYTE * PackedDibGetBitsPtr( BITMAPINFO * pPackedDib ); /* picture caching function: */ -static IPicture * FindPictureHandle( const char * szFileName, int * piWidth, int * piHeight); -static void AddPictureHandle( const char * szFileName, IPicture * iPicture, int iWidth, int iHeight); +static IPicture * FindPictureHandle( const char * szFileName, int * piWidth, int * piHeight ); +static void AddPictureHandle( const char * szFileName, IPicture * iPicture, int iWidth, int iHeight ); /* bitmap caching functions for user drawn bitmaps (wvw_drawimage) */ -static HBITMAP FindUserBitmapHandle(const char * szFileName, int * piWidth, int * piHeight); -static void AddUserBitmapHandle(const char * szFileName, HBITMAP hBitmap, int iWidth, int iHeight); +static HBITMAP FindUserBitmapHandle( const char * szFileName, int * piWidth, int * piHeight ); +static void AddUserBitmapHandle( const char * szFileName, HBITMAP hBitmap, int iWidth, int iHeight ); -static int GetControlClass(UINT usWinNum, HWND hWndCtrl); +static int GetControlClass( UINT usWinNum, HWND hWndCtrl ); -static void RunControlBlock(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT message, WPARAM wParam, LPARAM lParam, int iEventType ); -static void ReposControls(UINT usWinNum, BYTE byCtrlClass); +static void RunControlBlock( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT message, WPARAM wParam, LPARAM lParam, int iEventType ); +static void ReposControls( UINT usWinNum, BYTE byCtrlClass ); static BOOL hb_wvw_Move_Ready( BOOL b_p_IsReady ); static BOOL hb_wvw_Size_Ready( BOOL b_p_SizeIsReady ); @@ -348,50 +348,50 @@ static BOOL hb_wvw_Size_Ready( BOOL b_p_SizeIsReady ); /* set in mainwin.c */ /* */ -extern int hb_iCmdShow; +extern int hb_iCmdShow; -static int s_iCursorStyle; -static int s_iOldCurStyle; +static int s_iCursorStyle; +static int s_iOldCurStyle; -static HB_FHANDLE s_iStdIn, s_iStdOut, s_iStdErr; +static HB_FHANDLE s_iStdIn, s_iStdOut, s_iStdErr; static int s_GtId; static HB_GT_FUNCS SuperTable; -#define HB_GTSUPER (&SuperTable) -#define HB_GTID_PTR (&s_GtId) +#define HB_GTSUPER ( &SuperTable ) +#define HB_GTID_PTR ( &s_GtId ) HB_EXTERN_END -LONG GetFontDialogUnits(HWND h,HFONT f) +LONG GetFontDialogUnits( HWND h, HFONT f ) { - HFONT hFont; - HFONT hFontOld; - LONG avgWidth; - HDC hDc; - char * tmp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - SIZE sz; + HFONT hFont; + HFONT hFontOld; + LONG avgWidth; + HDC hDc; + char * tmp = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + SIZE sz; - //get the hdc to the main window - hDc = GetDC(h); + //get the hdc to the main window + hDc = GetDC( h ); - //with the current font attributes, select the font - hFont = f;//GetStockObject(ANSI_VAR_FONT) ; - hFontOld = ( HFONT )SelectObject(hDc, &hFont) ; + //with the current font attributes, select the font + hFont = f; //GetStockObject(ANSI_VAR_FONT) ; + hFontOld = ( HFONT ) SelectObject( hDc, &hFont ); - //get its length, then calculate the average character width + //get its length, then calculate the average character width - GetTextExtentPoint32(hDc, tmp, 52, &sz); - avgWidth = (sz.cx / 52) ; + GetTextExtentPoint32( hDc, tmp, 52, &sz ); + avgWidth = ( sz.cx / 52 ); - //re-select the previous font & delete the hDc - SelectObject(hDc, hFontOld) ; - DeleteObject(hFont) ; - ReleaseDC(h, hDc); + //re-select the previous font & delete the hDc + SelectObject( hDc, hFontOld ); + DeleteObject( hFont ); + ReleaseDC( h, hDc ); - return avgWidth ; + return avgWidth; } @@ -408,105 +408,105 @@ LONG GetFontDialogUnits(HWND h,HFONT f) static void hb_gt_wvw_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr ) { - HANDLE hInstance; - HANDLE hPrevInstance; - int iCmdShow; + HANDLE hInstance; + HANDLE hPrevInstance; + int iCmdShow; /* FSG: filename var for application name */ - PHB_FNAME pFileName; - USHORT i; + PHB_FNAME pFileName; + USHORT i; - if ( bStartMode ) + if( bStartMode ) { - s_pWvwData = (WVW_DATA*) hb_xgrab( sizeof (WVW_DATA ) ) ; - memset( s_pWvwData, 0, sizeof( WVW_DATA ) ) ; - s_pWvwData->s_sApp = (APP_DATA *) hb_xgrab( sizeof( APP_DATA ) ); - memset(s_pWvwData->s_sApp, 0, sizeof( APP_DATA ) ) ; + s_pWvwData = ( WVW_DATA * ) hb_xgrab( sizeof( WVW_DATA ) ); + memset( s_pWvwData, 0, sizeof( WVW_DATA ) ); + s_pWvwData->s_sApp = ( APP_DATA * ) hb_xgrab( sizeof( APP_DATA ) ); + memset( s_pWvwData->s_sApp, 0, sizeof( APP_DATA ) ); - s_pWvwData->s_uiPaintRefresh = 100; - s_pWvwData->s_bMainCoordMode = FALSE; - s_pWvwData->s_bVertCaret = FALSE; - s_pWvwData->s_bNOSTARTUPSUBWINDOW = FALSE; - s_pWvwData->s_bDefCentreWindow = FALSE; - s_pWvwData->s_bDefHCentreWindow = FALSE; - s_pWvwData->s_bDefVCentreWindow = FALSE; - s_pWvwData->s_byDefLineSpacing = 0; - s_pWvwData->s_iDefLSpaceColor = -1; - s_pWvwData->s_bAllowNonTop = FALSE; - s_pWvwData->s_bRecurseCBlock = FALSE; - s_pWvwData->hWndTT = 0; - s_pWvwData->s_bQuickSetMode = FALSE; - s_pWvwData->s_bFlashingWindow = FALSE; - s_pWvwData->s_iScrolling = 0; - s_pWvwData->s_iWrongButtonUp = 0; - s_pWvwData->s_iMaxWrongButtonUp = 500; + s_pWvwData->s_uiPaintRefresh = 100; + s_pWvwData->s_bMainCoordMode = FALSE; + s_pWvwData->s_bVertCaret = FALSE; + s_pWvwData->s_bNOSTARTUPSUBWINDOW = FALSE; + s_pWvwData->s_bDefCentreWindow = FALSE; + s_pWvwData->s_bDefHCentreWindow = FALSE; + s_pWvwData->s_bDefVCentreWindow = FALSE; + s_pWvwData->s_byDefLineSpacing = 0; + s_pWvwData->s_iDefLSpaceColor = -1; + s_pWvwData->s_bAllowNonTop = FALSE; + s_pWvwData->s_bRecurseCBlock = FALSE; + s_pWvwData->hWndTT = 0; + s_pWvwData->s_bQuickSetMode = FALSE; + s_pWvwData->s_bFlashingWindow = FALSE; + s_pWvwData->s_iScrolling = 0; + s_pWvwData->s_iWrongButtonUp = 0; + s_pWvwData->s_iMaxWrongButtonUp = 500; strcpy( s_pWvwData->szAppName, "Harbour WVW" ); - strcpy( s_pWvwData->szSubWinName , "Harbour WVW subwindows" ); - s_pWvwData->s_bSWRegistered = FALSE; - s_pWvwData->s_usCurWindow = 0; - bStartMode = FALSE; + strcpy( s_pWvwData->szSubWinName, "Harbour WVW subwindows" ); + s_pWvwData->s_bSWRegistered = FALSE; + s_pWvwData->s_usCurWindow = 0; + bStartMode = FALSE; } HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Init()" ) ); /* stdin && stdout && stderr */ - s_iStdIn = hFilenoStdin; - s_iStdOut = hFilenoStdout; - s_iStdErr = hFilenoStderr; + s_iStdIn = hFilenoStdin; + s_iStdOut = hFilenoStdout; + s_iStdErr = hFilenoStderr; if( ! hb_winmainArgGet( &hInstance, &hPrevInstance, &iCmdShow ) ) hb_errInternal( 10001, "It's not a GUI program", NULL, NULL ); - s_iOldCurStyle = s_iCursorStyle = SC_NORMAL; + s_iOldCurStyle = s_iCursorStyle = SC_NORMAL; s_pWvwData->s_usNumWindows = 0; - for(i = 0; i < WVW_MAXWINDOWS; i++) + for( i = 0; i < WVW_MAXWINDOWS; i++ ) { - s_pWvwData->s_pWindows[i] = NULL; + s_pWvwData->s_pWindows[ i ] = NULL; } - hb_gt_wvwWindowPrologue( ); + hb_gt_wvwWindowPrologue(); - hb_gtInitStatics(0, (LPCTSTR) s_pWvwData->szAppName, 0, 0, WVW_DEFAULT_ROWS-1, WVW_DEFAULT_COLS-1 ); + hb_gtInitStatics( 0, ( LPCTSTR ) s_pWvwData->szAppName, 0, 0, WVW_DEFAULT_ROWS - 1, WVW_DEFAULT_COLS - 1 ); - s_pWvwData->hInstance = ( HINSTANCE ) hInstance; + s_pWvwData->hInstance = ( HINSTANCE ) hInstance; - s_pWvwData->s_pWindows[0]->hWnd = hb_gt_wvwCreateWindow( ( HINSTANCE ) hInstance, ( HINSTANCE ) hPrevInstance, "", iCmdShow ); + s_pWvwData->s_pWindows[ 0 ]->hWnd = hb_gt_wvwCreateWindow( ( HINSTANCE ) hInstance, ( HINSTANCE ) hPrevInstance, "", iCmdShow ); - if ( !s_pWvwData->s_pWindows[0]->hWnd ) + if( ! s_pWvwData->s_pWindows[ 0 ]->hWnd ) { - /* Runtime error - */ - hb_errRT_TERM( EG_CREATE, 10001, "WINAPI CreateWindow() failed", "hb_gt_Init()", 0, 0 ); + /* Runtime error + */ + hb_errRT_TERM( EG_CREATE, 10001, "WINAPI CreateWindow() failed", "hb_gt_Init()", 0, 0 ); } - pFileName = hb_fsFNameSplit( hb_cmdargARGV()[0] ); + pFileName = hb_fsFNameSplit( hb_cmdargARGV()[ 0 ] ); - hb_gt_wvwSetWindowTitle( 0, (char*) pFileName->szName ); + hb_gt_wvwSetWindowTitle( 0, ( char * ) pFileName->szName ); hb_xfree( pFileName ); - hb_gt_wvwCreateObjects(0); - s_pWvwData->s_pWindows[0]->hdc = GetDC( s_pWvwData->s_pWindows[0]->hWnd ); - s_pWvwData->s_pWindows[0]->hCompDC = CreateCompatibleDC( s_pWvwData->s_pWindows[0]->hdc ); + hb_gt_wvwCreateObjects( 0 ); + s_pWvwData->s_pWindows[ 0 ]->hdc = GetDC( s_pWvwData->s_pWindows[ 0 ]->hWnd ); + s_pWvwData->s_pWindows[ 0 ]->hCompDC = CreateCompatibleDC( s_pWvwData->s_pWindows[ 0 ]->hdc ); /* Apos o Device Context e as PENs e BRUSHes criados, atribuo uma PEN e um BRUSH qualquer apenas para pegar o handle original da PEN e BRUSH do Device Context - */ - s_pWvwData->s_sApp->OriginalPen = (HPEN) SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HPEN) s_pWvwData->s_sApp->penWhite ); - s_pWvwData->s_sApp->OriginalBrush = (HBRUSH) SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HBRUSH) s_pWvwData->s_sApp->currentBrush ); + */ + s_pWvwData->s_sApp->OriginalPen = ( HPEN ) SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HPEN ) s_pWvwData->s_sApp->penWhite ); + s_pWvwData->s_sApp->OriginalBrush = ( HBRUSH ) SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HBRUSH ) s_pWvwData->s_sApp->currentBrush ); /* E, logo apos, restaura aos valores originais mantendo em s_pWvwData->s_sApp os valores salvos para restauracao quando for utilizar DeleteObject() - */ - SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HPEN) s_pWvwData->s_sApp->OriginalPen ); - SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HBRUSH) s_pWvwData->s_sApp->OriginalBrush ); + */ + SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HPEN ) s_pWvwData->s_sApp->OriginalPen ); + SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HBRUSH ) s_pWvwData->s_sApp->OriginalBrush ); /* SUPER GT initialization */ HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ); - HB_GTSELF_RESIZE( pGT, s_pWvwData->s_pWindows[0]->ROWS, s_pWvwData->s_pWindows[0]->COLS ); + HB_GTSELF_RESIZE( pGT, s_pWvwData->s_pWindows[ 0 ]->ROWS, s_pWvwData->s_pWindows[ 0 ]->COLS ); } @@ -516,7 +516,7 @@ BOOL hb_gt_wvwDestroyPicture( IPicture * iPicture ) { BOOL bResult = FALSE; - if ( iPicture ) + if( iPicture ) { iPicture->lpVtbl->Release( iPicture ); bResult = TRUE; @@ -527,263 +527,264 @@ BOOL hb_gt_wvwDestroyPicture( IPicture * iPicture ) static void hb_gt_wvw_Exit( PHB_GT pGT ) -//void gt_Exit( void ) { - int i; - int j; - WIN_DATA * pWindowData; - BITMAP_HANDLE * pbh; - PICTURE_HANDLE * pph; - CONTROL_DATA * pcd; +//void gt_Exit( void ) + int i; + int j; + WIN_DATA * pWindowData; + BITMAP_HANDLE * pbh; + PICTURE_HANDLE * pph; + CONTROL_DATA * pcd; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Exit()" ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Exit()" ) ); - HB_GTSUPER_EXIT( pGT ); + HB_GTSUPER_EXIT( pGT ); - for ( i = 0; i < WVW_DLGML_MAX; i++ ) - { - if ( s_pWvwData->s_sApp->hDlgModeless[ i ] ) - { - SendMessage( s_pWvwData->s_sApp->hDlgModeless[ i ], WM_CLOSE, 0, 0 ); - } - } + for( i = 0; i < WVW_DLGML_MAX; i++ ) + { + if( s_pWvwData->s_sApp->hDlgModeless[ i ] ) + { + SendMessage( s_pWvwData->s_sApp->hDlgModeless[ i ], WM_CLOSE, 0, 0 ); + } + } - /* destroy all objects from all windows */ + /* destroy all objects from all windows */ - for (j= (int) (s_pWvwData->s_usNumWindows-1); j >= 0; j--) - { - pWindowData = (WIN_DATA*) s_pWvwData->s_pWindows[ j ]; + for( j = ( int ) ( s_pWvwData->s_usNumWindows - 1 ); j >= 0; j-- ) + { + pWindowData = ( WIN_DATA * ) s_pWvwData->s_pWindows[ j ]; - if ( pWindowData->hWnd ) - { + if( pWindowData->hWnd ) + { KillTimer( pWindowData->hWnd, WVW_ID_SYSTEM_TIMER ); - if ( s_pWvwData->s_sApp->pSymWVW_TIMER ) + if( s_pWvwData->s_sApp->pSymWVW_TIMER ) { - KillTimer( pWindowData->hWnd, WVW_ID_BASE_TIMER+j ); + KillTimer( pWindowData->hWnd, WVW_ID_BASE_TIMER + j ); } DeleteObject( ( HFONT ) pWindowData->hFont ); /* - Faz apenas para a janela 0 (a primeira) ja que existe, na criacao das mesmas, uma condicao para que - apenas a primeira seja criada - Obs: A exclusao desses objetos precisa ocorrer antes da Release do Device Context - */ - if (j==0) + Faz apenas para a janela 0 (a primeira) ja que existe, na criacao das mesmas, uma condicao para que + apenas a primeira seja criada + Obs: A exclusao desses objetos precisa ocorrer antes da Release do Device Context + */ + if( j == 0 ) { /* - Seleciona PEN e BRUSH Originais - */ - SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HPEN) s_pWvwData->s_sApp->OriginalPen ); - SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HBRUSH) s_pWvwData->s_sApp->OriginalBrush ); + Seleciona PEN e BRUSH Originais + */ + SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HPEN ) s_pWvwData->s_sApp->OriginalPen ); + SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HBRUSH ) s_pWvwData->s_sApp->OriginalBrush ); /* - Com PENs e BRUSHes liberadas, efetua exclusao - */ - if (s_pWvwData->s_sApp->penWhite) + Com PENs e BRUSHes liberadas, efetua exclusao + */ + if( s_pWvwData->s_sApp->penWhite ) { - DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penWhite ); + DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penWhite ); } - if (s_pWvwData->s_sApp->penWhiteDim) + if( s_pWvwData->s_sApp->penWhiteDim ) { - DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penWhiteDim ); + DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penWhiteDim ); } - if (s_pWvwData->s_sApp->penBlack) + if( s_pWvwData->s_sApp->penBlack ) { - DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penBlack ); + DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penBlack ); } - if (s_pWvwData->s_sApp->penDarkGray) + if( s_pWvwData->s_sApp->penDarkGray ) { - DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penDarkGray ); + DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penDarkGray ); } - if (s_pWvwData->s_sApp->penGray) + if( s_pWvwData->s_sApp->penGray ) { - DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penGray ); + DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penGray ); } - if (s_pWvwData->s_sApp->penNull) + if( s_pWvwData->s_sApp->penNull ) { - DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penNull ); + DeleteObject( ( HPEN ) s_pWvwData->s_sApp->penNull ); } - if (s_pWvwData->s_sApp->currentPen) + if( s_pWvwData->s_sApp->currentPen ) { - DeleteObject( ( HPEN ) s_pWvwData->s_sApp->currentPen ); + DeleteObject( ( HPEN ) s_pWvwData->s_sApp->currentPen ); } - if (s_pWvwData->s_sApp->currentBrush) + if( s_pWvwData->s_sApp->currentBrush ) { DeleteObject( ( HBRUSH ) s_pWvwData->s_sApp->currentBrush ); } - if (s_pWvwData->s_sApp->diagonalBrush) + if( s_pWvwData->s_sApp->diagonalBrush ) { DeleteObject( ( HBRUSH ) s_pWvwData->s_sApp->diagonalBrush ); } - if (s_pWvwData->s_sApp->solidBrush) + if( s_pWvwData->s_sApp->solidBrush ) { DeleteObject( ( HBRUSH ) s_pWvwData->s_sApp->solidBrush ); } - if (s_pWvwData->s_sApp->wvwWhiteBrush) + if( s_pWvwData->s_sApp->wvwWhiteBrush ) { DeleteObject( ( HBRUSH ) s_pWvwData->s_sApp->wvwWhiteBrush ); } - if (s_pWvwData->s_sApp->gridPen) + if( s_pWvwData->s_sApp->gridPen ) { DeleteObject( ( HPEN ) s_pWvwData->s_sApp->gridPen ); } } - if (pWindowData->hIcon) + if( pWindowData->hIcon ) { - DestroyIcon( (HICON) pWindowData->hIcon ); + DestroyIcon( ( HICON ) pWindowData->hIcon ); } - if ( pWindowData->hdc ) + if( pWindowData->hdc ) { ReleaseDC( pWindowData->hWnd, pWindowData->hdc ); } - if ( pWindowData->hCompDC ) + if( pWindowData->hCompDC ) { DeleteDC( pWindowData->hCompDC ); } - while (pWindowData->pcdCtrlList) + while( pWindowData->pcdCtrlList ) { - pcd = pWindowData->pcdCtrlList->pNext; - DestroyWindow (pWindowData->pcdCtrlList->hWndCtrl) ; + pcd = pWindowData->pcdCtrlList->pNext; + DestroyWindow( pWindowData->pcdCtrlList->hWndCtrl ); - if (pWindowData->pcdCtrlList->phiCodeBlock) - { - hb_itemRelease( pWindowData->pcdCtrlList->phiCodeBlock ); + if( pWindowData->pcdCtrlList->phiCodeBlock ) + { + hb_itemRelease( pWindowData->pcdCtrlList->phiCodeBlock ); - } + } - hb_xfree( pWindowData->pcdCtrlList ); - pWindowData->pcdCtrlList = pcd; + hb_xfree( pWindowData->pcdCtrlList ); + pWindowData->pcdCtrlList = pcd; } DestroyWindow( pWindowData->hWnd ); - if (pWindowData->hPBfont) + if( pWindowData->hPBfont ) { - DeleteObject( ( HFONT ) pWindowData->hPBfont ); + DeleteObject( ( HFONT ) pWindowData->hPBfont ); } - if (pWindowData->hCBfont) + if( pWindowData->hCBfont ) { - DeleteObject( ( HFONT ) pWindowData->hCBfont ); + DeleteObject( ( HFONT ) pWindowData->hCBfont ); } - if (pWindowData->hCXfont) + if( pWindowData->hCXfont ) { - DeleteObject( ( HFONT ) pWindowData->hCXfont ); + DeleteObject( ( HFONT ) pWindowData->hCXfont ); } - if (pWindowData->hSBfont) + if( pWindowData->hSBfont ) { - DeleteObject( ( HFONT ) pWindowData->hSBfont ); + DeleteObject( ( HFONT ) pWindowData->hSBfont ); } - if (pWindowData->hSTfont) + if( pWindowData->hSTfont ) { - DeleteObject( ( HFONT ) pWindowData->hSTfont ); - } } + DeleteObject( ( HFONT ) pWindowData->hSTfont ); + } + } - hb_gt_wvwWindowEpilogue( ); - } + hb_gt_wvwWindowEpilogue(); + } - if ( s_pWvwData->s_bSWRegistered ) - { + if( s_pWvwData->s_bSWRegistered ) + { UnregisterClass( s_pWvwData->szSubWinName, s_pWvwData->hInstance ); - } + } - UnregisterClass( s_pWvwData->szAppName, s_pWvwData->hInstance ); + UnregisterClass( s_pWvwData->szAppName, s_pWvwData->hInstance ); - for ( i = 0; i < WVW_PICTURES_MAX; i++ ) - { - if ( s_pWvwData->s_sApp->iPicture[ i ] ) - { - hb_gt_wvwDestroyPicture( s_pWvwData->s_sApp->iPicture[ i ] ); - } - } + for( i = 0; i < WVW_PICTURES_MAX; i++ ) + { + if( s_pWvwData->s_sApp->iPicture[ i ] ) + { + hb_gt_wvwDestroyPicture( s_pWvwData->s_sApp->iPicture[ i ] ); + } + } - for ( i = 0; i < WVW_FONTS_MAX; i++ ) - { - if ( s_pWvwData->s_sApp->hUserFonts[ i ] ) - { - DeleteObject( (HFONT) s_pWvwData->s_sApp->hUserFonts[ i ] ); - } - } + for( i = 0; i < WVW_FONTS_MAX; i++ ) + { + if( s_pWvwData->s_sApp->hUserFonts[ i ] ) + { + DeleteObject( ( HFONT ) s_pWvwData->s_sApp->hUserFonts[ i ] ); + } + } - for ( i = 0; i < WVW_PENS_MAX; i++ ) - { - if ( s_pWvwData->s_sApp->hUserPens[ i ] ) - { - DeleteObject( (HPEN) s_pWvwData->s_sApp->hUserPens[ i ] ); - } - } + for( i = 0; i < WVW_PENS_MAX; i++ ) + { + if( s_pWvwData->s_sApp->hUserPens[ i ] ) + { + DeleteObject( ( HPEN ) s_pWvwData->s_sApp->hUserPens[ i ] ); + } + } - if ( s_pWvwData->s_sApp->hMSImg32 ) - { - FreeLibrary( s_pWvwData->s_sApp->hMSImg32 ); - } + if( s_pWvwData->s_sApp->hMSImg32 ) + { + FreeLibrary( s_pWvwData->s_sApp->hMSImg32 ); + } - while (s_pWvwData->s_sApp->pbhBitmapList) - { - pbh = s_pWvwData->s_sApp->pbhBitmapList->pNext; - DeleteObject (s_pWvwData->s_sApp->pbhBitmapList->hBitmap) ; + while( s_pWvwData->s_sApp->pbhBitmapList ) + { + pbh = s_pWvwData->s_sApp->pbhBitmapList->pNext; + DeleteObject( s_pWvwData->s_sApp->pbhBitmapList->hBitmap ); hb_xfree( s_pWvwData->s_sApp->pbhBitmapList ); s_pWvwData->s_sApp->pbhBitmapList = pbh; - } + } - while (s_pWvwData->s_sApp->pphPictureList) - { - pph = s_pWvwData->s_sApp->pphPictureList->pNext; - hb_gt_wvwDestroyPicture(s_pWvwData->s_sApp->pphPictureList->iPicture) ; + while( s_pWvwData->s_sApp->pphPictureList ) + { + pph = s_pWvwData->s_sApp->pphPictureList->pNext; + hb_gt_wvwDestroyPicture( s_pWvwData->s_sApp->pphPictureList->iPicture ); hb_xfree( s_pWvwData->s_sApp->pphPictureList ); s_pWvwData->s_sApp->pphPictureList = pph; - } + } - while (s_pWvwData->s_sApp->pbhUserBitmap) - { - pbh = s_pWvwData->s_sApp->pbhUserBitmap->pNext; - DeleteObject (s_pWvwData->s_sApp->pbhUserBitmap->hBitmap) ; + while( s_pWvwData->s_sApp->pbhUserBitmap ) + { + pbh = s_pWvwData->s_sApp->pbhUserBitmap->pNext; + DeleteObject( s_pWvwData->s_sApp->pbhUserBitmap->hBitmap ); hb_xfree( s_pWvwData->s_sApp->pbhUserBitmap ); s_pWvwData->s_sApp->pbhUserBitmap = pbh; - } - if ( s_pWvwData->s_sApp ) - hb_xfree( s_pWvwData->s_sApp ); - if ( s_pWvwData) - hb_xfree( s_pWvwData ) ; + } + if( s_pWvwData->s_sApp ) + hb_xfree( s_pWvwData->s_sApp ); + if( s_pWvwData ) + hb_xfree( s_pWvwData ); } -void hb_gt_wvw_SetPos(PHB_GT pGT, int iRow, int iCol ) +void hb_gt_wvw_SetPos( PHB_GT pGT, int iRow, int iCol ) { - int i_Row = iRow; - int i_Col = iCol; + int i_Row = iRow; + int i_Col = iCol; - pGT->iRow = iRow; - pGT->iCol = iCol; + pGT->iRow = iRow; + pGT->iCol = iCol; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_SetPos( %hd, %hd )", iRow, iCol ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_SetPos( %hd, %hd )", iRow, iCol ) ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCPrologue(2, &i_Row, &i_Col, NULL, NULL); - } + hb_gt_wvwFUNCPrologue( 2, &i_Row, &i_Col, NULL, NULL ); + } - hb_gt_wvw_vSetPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], i_Row, i_Col ); + hb_gt_wvw_vSetPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], i_Row, i_Col ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCEpilogue( ); - } + hb_gt_wvwFUNCEpilogue(); + } } @@ -805,22 +806,22 @@ static int hb_gt_wvw_MaxRow( PHB_GT pGT ) BOOL hb_gt_wvw_IsColor( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_IsColor()" ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_IsColor()" ) ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - return( TRUE ); + return TRUE; } static int hb_gt_wvw_GetCursorStyle( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_GetCursorStyle()" ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_GetCursorStyle()" ) ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - return( s_iCursorStyle ); + return s_iCursorStyle; } @@ -831,52 +832,52 @@ static int hb_gt_wvw_GetCursorStyle( PHB_GT pGT ) static void hb_gt_wvw_SetCursorStyle( PHB_GT pGT, int iStyle ) { - BOOL bCursorOn= TRUE; - WIN_DATA * pWindowData; - USHORT usFullSize; + BOOL bCursorOn = TRUE; + WIN_DATA * pWindowData; + USHORT usFullSize; - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_SetCursorStyle( %hu )", iStyle ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_SetCursorStyle( %hu )", iStyle ) ); - pWindowData = (WIN_DATA*) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; - usFullSize = (USHORT) (s_pWvwData->s_bVertCaret ? pWindowData->PTEXTSIZE.x : pWindowData->PTEXTSIZE.y); + pWindowData = ( WIN_DATA * ) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; + usFullSize = ( USHORT ) ( s_pWvwData->s_bVertCaret ? pWindowData->PTEXTSIZE.x : pWindowData->PTEXTSIZE.y ); - s_iCursorStyle = iStyle; + s_iCursorStyle = iStyle; - switch( iStyle ) - { - case SC_NONE: - pWindowData->CaretSize = 0 ; - bCursorOn= FALSE; - break ; - case SC_INSERT: - pWindowData->CaretSize = ( usFullSize / 2 ) ; - break; - case SC_SPECIAL1: - pWindowData->CaretSize = usFullSize ; - break; - case SC_SPECIAL2: - pWindowData->CaretSize = -( usFullSize / 2 ) ; - break; - case SC_NORMAL: - default: - pWindowData->CaretSize = 2 ; - break; - } + switch( iStyle ) + { + case SC_NONE: + pWindowData->CaretSize = 0; + bCursorOn = FALSE; + break; + case SC_INSERT: + pWindowData->CaretSize = ( usFullSize / 2 ); + break; + case SC_SPECIAL1: + pWindowData->CaretSize = usFullSize; + break; + case SC_SPECIAL2: + pWindowData->CaretSize = -( usFullSize / 2 ); + break; + case SC_NORMAL: + default: + pWindowData->CaretSize = 2; + break; + } - if ( bCursorOn ) - { - if (!s_pWvwData->s_bVertCaret) - { - s_pWvwData->s_sApp->CaretExist = CreateCaret( pWindowData->hWnd, ( HBITMAP ) NULL, pWindowData->PTEXTSIZE.x, pWindowData->CaretSize ); - } - else - { - s_pWvwData->s_sApp->CaretExist = CreateCaret( pWindowData->hWnd, ( HBITMAP ) NULL, pWindowData->CaretSize, pWindowData->PTEXTSIZE.y ); - } - } - hb_gt_wvwSetCaretOn( pWindowData, bCursorOn ); + if( bCursorOn ) + { + if( ! s_pWvwData->s_bVertCaret ) + { + s_pWvwData->s_sApp->CaretExist = CreateCaret( pWindowData->hWnd, ( HBITMAP ) NULL, pWindowData->PTEXTSIZE.x, pWindowData->CaretSize ); + } + else + { + s_pWvwData->s_sApp->CaretExist = CreateCaret( pWindowData->hWnd, ( HBITMAP ) NULL, pWindowData->CaretSize, pWindowData->PTEXTSIZE.y ); + } + } + hb_gt_wvwSetCaretOn( pWindowData, bCursorOn ); } @@ -884,11 +885,11 @@ static void hb_gt_wvw_SetCursorStyle( PHB_GT pGT, int iStyle ) static void hb_gt_wvw_DispBegin( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_DispBegin()" ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_DispBegin()" ) ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - hb_gt_wvw_vDispBegin( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ] ); + hb_gt_wvw_vDispBegin( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ] ); } @@ -896,11 +897,11 @@ static void hb_gt_wvw_DispBegin( PHB_GT pGT ) static void hb_gt_wvw_DispEnd( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_DispEnd()" ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_DispEnd()" ) ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - hb_gt_wvw_vDispEnd( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ] ); + hb_gt_wvw_vDispEnd( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ] ); } @@ -908,80 +909,80 @@ static void hb_gt_wvw_DispEnd( PHB_GT pGT ) static int hb_gt_wvw_DispCount( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_DispCount()" ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_DispCount()" ) ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - return( hb_gt_wvw_usDispCount( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ] ) ); + return hb_gt_wvw_usDispCount( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ] ); } static void hb_gt_wvw_Replicate( PHB_GT pGT, int iRow, int iCol, int bColor, BYTE bAttr, USHORT usChar, ULONG ulLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Replicate( %hu, %hu, %hu, %i, %lu )", iRow, iCol, bColor, bAttr, usChar, ulLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Replicate( %hu, %hu, %hu, %i, %lu )", iRow, iCol, bColor, bAttr, usChar, ulLen ) ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCPrologue(2, &iRow, &iCol, NULL, NULL); - } + hb_gt_wvwFUNCPrologue( 2, &iRow, &iCol, NULL, NULL ); + } - hb_gt_wvw_vReplicate( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], iRow, iCol, bColor, bAttr, usChar, ulLen ); + hb_gt_wvw_vReplicate( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], iRow, iCol, bColor, bAttr, usChar, ulLen ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCEpilogue( ); - } + hb_gt_wvwFUNCEpilogue(); + } } static void hb_gt_wvw_PutText( PHB_GT pGT, int iRow, int iCol, int bColor, const char * pText, ULONG ulLen ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_PutText(%hu, %hu, %p, %lu, %hu)", iRow, iCol, pText, ulLen, bColor)); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_PutText(%hu, %hu, %p, %lu, %hu)", iRow, iCol, pText, ulLen, bColor ) ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { - hb_gt_wvwFUNCPrologue(2, &iRow, &iCol, NULL, NULL); - } + if( s_pWvwData->s_bMainCoordMode ) + { + hb_gt_wvwFUNCPrologue( 2, &iRow, &iCol, NULL, NULL ); + } - hb_gt_wvw_vPutText( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], (USHORT)iRow, (USHORT)iCol, (USHORT)iRow, (USHORT) ulLen == 0 ? (USHORT)0 : (USHORT) iCol+((USHORT)(ULONG)(ulLen))-1, pText, bColor); + hb_gt_wvw_vPutText( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], ( USHORT ) iRow, ( USHORT ) iCol, ( USHORT ) iRow, ( USHORT ) ulLen == 0 ? ( USHORT ) 0 : ( USHORT ) iCol + ( ( USHORT ) ( ULONG ) ( ulLen ) ) - 1, pText, bColor ); - if ( s_pWvwData->s_bMainCoordMode ) - { - hb_gt_wvwFUNCEpilogue( ); - } + if( s_pWvwData->s_bMainCoordMode ) + { + hb_gt_wvwFUNCEpilogue(); + } } static void hb_gt_wvw_SetAttribute( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, int bColor ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_hb_gt_wvw_SetbColoribute( %hu, %hu, %hu, %hu, %hu", iTop, iLeft, iBottom, iRight, bColor ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_hb_gt_wvw_SetbColoribute( %hu, %hu, %hu, %hu, %hu", iTop, iLeft, iBottom, iRight, bColor ) ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCPrologue(4, &iTop, &iLeft, &iBottom, &iRight); - } + hb_gt_wvwFUNCPrologue( 4, &iTop, &iLeft, &iBottom, &iRight ); + } - hb_gt_wvw_vSetAttribute( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], iTop, iLeft, iBottom, iRight, bColor ); + hb_gt_wvw_vSetAttribute( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], iTop, iLeft, iBottom, iRight, bColor ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCEpilogue( ); - } + hb_gt_wvwFUNCEpilogue(); + } } @@ -989,78 +990,78 @@ static void hb_gt_wvw_SetAttribute( PHB_GT pGT, int iTop, int iLeft, int iBottom /* copied from gtwin... */ /* */ -static void hb_gt_wvw_Scroll(PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, int bColor, USHORT bChar, int iRows, int iCols ) +static void hb_gt_wvw_Scroll( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, int bColor, USHORT bChar, int iRows, int iCols ) { - LONG usSaveRow, usSaveCol; + LONG usSaveRow, usSaveCol; - BYTE ucBlank[ WVW_CHAR_BUFFER ], ucBuff[ WVW_CHAR_BUFFER * 2 ] ; - BYTE * fpBlank ; - BYTE * fpBuff ; - int iLength = ( iRight - iLeft ) + 1; - int iCount, iColOld, iColNew, iColSize; - BOOL bMalloc = FALSE; + BYTE ucBlank[ WVW_CHAR_BUFFER ], ucBuff[ WVW_CHAR_BUFFER * 2 ]; + BYTE * fpBlank; + BYTE * fpBuff; + int iLength = ( iRight - iLeft ) + 1; + int iCount, iColOld, iColNew, iColSize; + BOOL bMalloc = FALSE; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Scroll( %hu, %hu, %hu, %hu, %hu, %hd, %hd )", iTop, iLeft, iBottom, iRight, bColor, iRows, iCols ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Scroll( %hu, %hu, %hu, %hu, %hu, %hd, %hd )", iTop, iLeft, iBottom, iRight, bColor, iRows, iCols ) ); - HB_SYMBOL_UNUSED( pGT ); - HB_SYMBOL_UNUSED( bChar ); + HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( bChar ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCPrologue(4, &iTop, &iLeft, &iBottom, &iRight); - } + hb_gt_wvwFUNCPrologue( 4, &iTop, &iLeft, &iBottom, &iRight ); + } - if ( iLength > WVW_CHAR_BUFFER ) - { /* Avoid allocating memory if possible */ - fpBlank = ( BYTE * ) hb_xgrab( iLength ); - fpBuff = ( BYTE * ) hb_xgrab( iLength * 2 ); /* *2 room for attribs */ - bMalloc = TRUE; - } - else - { - fpBlank = ucBlank ; - fpBuff = ucBuff ; - } + if( iLength > WVW_CHAR_BUFFER ) /* Avoid allocating memory if possible */ + { + fpBlank = ( BYTE * ) hb_xgrab( iLength ); + fpBuff = ( BYTE * ) hb_xgrab( iLength * 2 ); /* *2 room for attribs */ + bMalloc = TRUE; + } + else + { + fpBlank = ucBlank; + fpBuff = ucBuff; + } - memset( fpBlank, hb_gtGetClearChar(), iLength ); + memset( fpBlank, hb_gtGetClearChar(), iLength ); - iColOld = iColNew = iLeft; - iColSize = iLength -1; - if( iCols >= 0 ) - { - iColOld += iCols; - iColSize -= iCols; - } - else - { - iColNew -= iCols; - iColSize += iCols; - } - /* use the ScrollWindowEx() where possible ( Optimised for Terminal Server ) - * if both iCols & iRows are ZERO then the entire area is to be cleared and - * there is no advantage in using ScrollWindowEx() - */ + iColOld = iColNew = iLeft; + iColSize = iLength - 1; + if( iCols >= 0 ) + { + iColOld += iCols; + iColSize -= iCols; + } + else + { + iColNew -= iCols; + iColSize += iCols; + } + /* use the ScrollWindowEx() where possible ( Optimised for Terminal Server ) + * if both iCols & iRows are ZERO then the entire area is to be cleared and + * there is no advantage in using ScrollWindowEx() + */ - s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->InvalidateWindow = hb_gt_wvw_usDispCount( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ) > 0 || ( !iRows && !iCols ) ; + s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->InvalidateWindow = hb_gt_wvw_usDispCount( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ) > 0 || ( ! iRows && ! iCols ); - if ( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->InvalidateWindow ) - { - hb_gt_wvw_vDispBegin( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); - } + if( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->InvalidateWindow ) + { + hb_gt_wvw_vDispBegin( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); + } - usSaveCol = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.x; - usSaveRow = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.y; - for( iCount = ( iRows >= 0 ? iTop : iBottom ); - ( iRows >= 0 ? iCount <= iBottom : iCount >= iTop ); - ( iRows >= 0 ? iCount++ : iCount-- ) ) - { + usSaveCol = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.x; + usSaveRow = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.y; + for( iCount = ( iRows >= 0 ? iTop : iBottom ); + ( iRows >= 0 ? iCount <= iBottom : iCount >= iTop ); + ( iRows >= 0 ? iCount++ : iCount-- ) ) + { int iRowPos = iCount + iRows; /* Read the text to be scrolled into the current row */ if( ( iRows || iCols ) && iRowPos <= iBottom && iRowPos >= iTop ) { - hb_gt_wvw_vGetText( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], (USHORT)iRowPos, (USHORT)iColOld, (USHORT)iRowPos, (USHORT)iColOld + (USHORT)iColSize, fpBuff ); + hb_gt_wvw_vGetText( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], ( USHORT ) iRowPos, ( USHORT ) iColOld, ( USHORT ) iRowPos, ( USHORT ) iColOld + ( USHORT ) iColSize, fpBuff ); } /* Blank the scroll region in the current row */ @@ -1070,51 +1071,51 @@ static void hb_gt_wvw_Scroll(PHB_GT pGT, int iTop, int iLeft, int iBottom, int i if( ( iRows || iCols ) && iRowPos <= iBottom && iRowPos >= iTop ) { - hb_gt_wvw_vPutText( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], (USHORT)iCount, (USHORT)iColNew , (USHORT)iCount , (USHORT)iColNew + (USHORT)iColSize, fpBuff , 0); + hb_gt_wvw_vPutText( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], ( USHORT ) iCount, ( USHORT ) iColNew, ( USHORT ) iCount, ( USHORT ) iColNew + ( USHORT ) iColSize, fpBuff, 0 ); } - } + } - hb_gt_wvw_vSetPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], usSaveRow, usSaveCol ); + hb_gt_wvw_vSetPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], usSaveRow, usSaveCol ); - if ( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->InvalidateWindow ) - { - hb_gt_wvw_vDispEnd( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); + if( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->InvalidateWindow ) + { + hb_gt_wvw_vDispEnd( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); - } - else - { - RECT cr = { 0 }, crInvalid = { 0 }; + } + else + { + RECT cr = { 0 }, crInvalid = { 0 }; - cr.left = iLeft + ( iCols>0 ? 1 : 0 ) ; - cr.top = iTop + ( iRows>0 ? 1 : 0 ) ; - cr.right = iRight - ( iCols<0 ? 1 : 0 ) ; - cr.bottom = iBottom - ( iRows<0 ? 1 : 0 ) ; + cr.left = iLeft + ( iCols > 0 ? 1 : 0 ); + cr.top = iTop + ( iRows > 0 ? 1 : 0 ); + cr.right = iRight - ( iCols < 0 ? 1 : 0 ); + cr.bottom = iBottom - ( iRows < 0 ? 1 : 0 ); - cr = hb_gt_wvwGetXYFromColRowRect( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], cr ); + cr = hb_gt_wvwGetXYFromColRowRect( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], cr ); - cr.top -= ( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->byLineSpacing / 2 ); + cr.top -= ( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->byLineSpacing / 2 ); - cr.bottom += ( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->byLineSpacing / 2 ); + cr.bottom += ( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->byLineSpacing / 2 ); - ScrollWindowEx( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->hWnd, -iCols * s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->PTEXTSIZE.x, -iRows * hb_wvw_LineHeight( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ), &cr, NULL, NULL, &crInvalid, 0 ) ; - InvalidateRect( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->hWnd, &crInvalid, FALSE ); - s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->InvalidateWindow = TRUE ; + ScrollWindowEx( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->hWnd, -iCols * s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->PTEXTSIZE.x, -iRows * hb_wvw_LineHeight( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ), &cr, NULL, NULL, &crInvalid, 0 ); + InvalidateRect( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->hWnd, &crInvalid, FALSE ); + s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->InvalidateWindow = TRUE; - } - if ( bMalloc ) - { - hb_xfree( fpBlank ); - hb_xfree( fpBuff ); - } + } + if( bMalloc ) + { + hb_xfree( fpBlank ); + hb_xfree( fpBuff ); + } - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCEpilogue( ); - } + hb_gt_wvwFUNCEpilogue(); + } #ifdef WVW_DEBUG - nCountScroll++; + nCountScroll++; #endif } @@ -1129,21 +1130,21 @@ static BOOL hb_gt_wvw_SetMode( PHB_GT pGT, int iRow, int iCol ) HB_SYMBOL_UNUSED( pGT ); - if (s_pWvwData->s_bQuickSetMode) - { /*this is eg. done when we are closing window - *we do nothing here, what we need is performed by GTAPI level - *ie. setting its s_height and s_width (= maxrow() and maxcol() ) - */ - return( TRUE ); + if( s_pWvwData->s_bQuickSetMode ) /*this is eg. done when we are closing window + *we do nothing here, what we need is performed by GTAPI level + *ie. setting its s_height and s_width (= maxrow() and maxcol() ) + */ + { + return TRUE; } - return( hb_gt_wvw_bSetMode( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], (USHORT)iRow, (USHORT)iCol) ); + return hb_gt_wvw_bSetMode( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], ( USHORT ) iRow, ( USHORT ) iCol ); } static void hb_gt_wvw_WriteAt( PHB_GT pGT, int iRow, int iCol, const char * pText, ULONG ulLength ) { - HB_GTSELF_PUTTEXT( pGT, iRow, iCol, (BYTE)HB_GTSELF_GETCOLOR( pGT ), pText, ulLength ); + HB_GTSELF_PUTTEXT( pGT, iRow, iCol, ( BYTE ) HB_GTSELF_GETCOLOR( pGT ), pText, ulLength ); /* Finally, save the new cursor position, even if off-screen */ HB_GTSELF_SETPOS( pGT, iRow, iCol + ( int ) ulLength ); @@ -1153,18 +1154,18 @@ static void hb_gt_wvw_WriteAt( PHB_GT pGT, int iRow, int iCol, const char * pTex static BOOL hb_gt_wvw_GetBlink( PHB_GT pGT ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_GetBlink()" ) ); - HB_SYMBOL_UNUSED( pGT ); - return( TRUE ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_GetBlink()" ) ); + HB_SYMBOL_UNUSED( pGT ); + return TRUE; } static void hb_gt_wvw_SetBlink( PHB_GT pGT, BOOL bBlink ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_SetBlink( %d )", ( int ) bBlink ) ); - HB_SYMBOL_UNUSED( pGT ); - HB_SYMBOL_UNUSED( bBlink ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_SetBlink( %d )", ( int ) bBlink ) ); + HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( bBlink ); } @@ -1174,196 +1175,197 @@ static const char * hb_gt_wvw_Version( PHB_GT pGT, int iType ) HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Version()" ) ); HB_SYMBOL_UNUSED( pGT ); - if ( iType == 0 ) + if( iType == 0 ) return HB_GT_DRVNAME( HB_GT_NAME ); - return( "Harbour Terminal: Windows buffered WVW" ); + return "Harbour Terminal: Windows buffered WVW"; } static void hb_gt_wvw_Box( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, const char * pbyFrame, int bColor ) { - int i_Top = (iTop < 0 ? 0 : iTop); - int i_Left = (iLeft < 0 ? 0 : iLeft); - int i_Bottom = (iBottom < 0 ? 0 : iBottom); - int i_Right = (iRight < 0 ? 0 : iRight); + int i_Top = ( iTop < 0 ? 0 : iTop ); + int i_Left = ( iLeft < 0 ? 0 : iLeft ); + int i_Bottom = ( iBottom < 0 ? 0 : iBottom ); + int i_Right = ( iRight < 0 ? 0 : iRight ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { - hb_gt_wvwFUNCPrologue(4, &i_Top, &i_Left, &i_Bottom, &i_Right); - } + if( s_pWvwData->s_bMainCoordMode ) + { + hb_gt_wvwFUNCPrologue( 4, &i_Top, &i_Left, &i_Bottom, &i_Right ); + } - hb_gt_wvw_usBox( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], i_Top, i_Left, i_Bottom, i_Right, pbyFrame, bColor ) ; + hb_gt_wvw_usBox( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], i_Top, i_Left, i_Bottom, i_Right, pbyFrame, bColor ); - if ( s_pWvwData->s_bMainCoordMode ) - { - hb_gt_wvwFUNCEpilogue( ); - } + if( s_pWvwData->s_bMainCoordMode ) + { + hb_gt_wvwFUNCEpilogue(); + } } static void hb_gt_wvw_HorizLine( PHB_GT pGT, int iRow, int iLeft, int iRight, USHORT bChar, int bColor ) { - int iWidth; - int i_Row = (iRow < 0 ? 0 : iRow); - int i_Left = (iLeft < 0 ? 0 : iLeft); - int i_Right = (iRight < 0 ? 0 : iRight); + int iWidth; + int i_Row = ( iRow < 0 ? 0 : iRow ); + int i_Left = ( iLeft < 0 ? 0 : iLeft ); + int i_Right = ( iRight < 0 ? 0 : iRight ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - if (i_Left > i_Right) - { - int temp; - temp = i_Left; - i_Left = i_Right; - i_Right = temp; - } - hb_gt_wvwFUNCPrologue(4, &i_Row, &i_Left, NULL, &i_Right); - } + if( i_Left > i_Right ) + { + int temp; + temp = i_Left; + i_Left = i_Right; + i_Right = temp; + } + hb_gt_wvwFUNCPrologue( 4, &i_Row, &i_Left, NULL, &i_Right ); + } - iWidth = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->COLS; + iWidth = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->COLS; - if( i_Row < iWidth ) - { + if( i_Row < iWidth ) + { if( i_Left >= iWidth ) { - i_Left = iWidth - 1; + i_Left = iWidth - 1; } if( i_Right >= iWidth ) { - i_Right = iWidth - 1; + i_Right = iWidth - 1; } if( i_Left < i_Right ) { - hb_gt_wvw_vReplicate( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], i_Row, i_Left, bColor, HB_GT_ATTR_BOX, bChar, i_Right - i_Left + 1 ); + hb_gt_wvw_vReplicate( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], i_Row, i_Left, bColor, HB_GT_ATTR_BOX, bChar, i_Right - i_Left + 1 ); } else { - hb_gt_wvw_vReplicate( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], i_Row, i_Right, bColor, HB_GT_ATTR_BOX, bChar, i_Left - i_Right + 1 ); + hb_gt_wvw_vReplicate( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], i_Row, i_Right, bColor, HB_GT_ATTR_BOX, bChar, i_Left - i_Right + 1 ); } - } + } - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCEpilogue( ); - } + hb_gt_wvwFUNCEpilogue(); + } } static void hb_gt_wvw_VertLine( PHB_GT pGT, int iCol, int iTop, int iBottom, USHORT bChar, int bColor ) { - int i_Width ; - int i_Height; - int i_Row; - int i_Col = (iCol < 0 ? 0 : iCol); - int i_Top = (iTop < 0 ? 0 : iTop); - int i_Bottom = (iBottom < 0 ? 0 : iBottom); + int i_Width; + int i_Height; + int i_Row; + int i_Col = ( iCol < 0 ? 0 : iCol ); + int i_Top = ( iTop < 0 ? 0 : iTop ); + int i_Bottom = ( iBottom < 0 ? 0 : iBottom ); - HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - if (i_Top > i_Bottom) + if( i_Top > i_Bottom ) { - int temp; - temp = i_Top; - i_Top = i_Bottom; - i_Bottom = temp; + int temp; + temp = i_Top; + i_Top = i_Bottom; + i_Bottom = temp; } - hb_gt_wvwFUNCPrologue(3, &i_Top, &i_Col, &i_Bottom, NULL); - } + hb_gt_wvwFUNCPrologue( 3, &i_Top, &i_Col, &i_Bottom, NULL ); + } - i_Width = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->COLS; - i_Height = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->ROWS; + i_Width = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->COLS; + i_Height = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->ROWS; - if( i_Col < i_Width ) - { + if( i_Col < i_Width ) + { - if( i_Top >= i_Height ) - { - i_Top = i_Height - 1; - } + if( i_Top >= i_Height ) + { + i_Top = i_Height - 1; + } - if( i_Bottom >= i_Height ) - { - i_Bottom = i_Height - 1; - } - if( i_Top <= i_Bottom ) - { - i_Row = i_Top; - } - else - { - i_Row = i_Bottom; - i_Bottom = i_Top; - } + if( i_Bottom >= i_Height ) + { + i_Bottom = i_Height - 1; + } + if( i_Top <= i_Bottom ) + { + i_Row = i_Top; + } + else + { + i_Row = i_Bottom; + i_Bottom = i_Top; + } - hb_gt_wvw_vDispBegin( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); + hb_gt_wvw_vDispBegin( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); - while( i_Row <= i_Bottom ) - { + while( i_Row <= i_Bottom ) + { - hb_gt_wvw_vxPutch( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], (USHORT)i_Row++, (USHORT)i_Col, bColor, bChar ); - } + hb_gt_wvw_vxPutch( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], ( USHORT ) i_Row++, ( USHORT ) i_Col, bColor, bChar ); + } - hb_gt_wvw_vDispEnd( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); - } + hb_gt_wvw_vDispEnd( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); + } - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCEpilogue( ); - } + hb_gt_wvwFUNCEpilogue(); + } } static void hb_gt_wvw_OutStd( PHB_GT pGT, const char * pbyStr, HB_SIZE ulLen ) { - HB_SYMBOL_UNUSED( pGT ); - hb_fsWriteLarge( s_iStdOut, ( BYTE * ) pbyStr, ulLen ); + HB_SYMBOL_UNUSED( pGT ); + hb_fsWriteLarge( s_iStdOut, ( BYTE * ) pbyStr, ulLen ); } static void hb_gt_wvw_OutErr( PHB_GT pGT, const char * pbyStr, HB_SIZE ulLen ) { - HB_SYMBOL_UNUSED( pGT ); - hb_fsWriteLarge( s_iStdErr, ( BYTE * ) pbyStr, ulLen ); + HB_SYMBOL_UNUSED( pGT ); + hb_fsWriteLarge( s_iStdErr, ( BYTE * ) pbyStr, ulLen ); } -static BOOL hb_gt_wvwGetCharFromInputQueue ( int *c ) +static BOOL hb_gt_wvwGetCharFromInputQueue( int * c ) { - UINT uiWindow = s_pWvwData->s_usNumWindows - 1; - WIN_DATA *pWindow = s_pWvwData->s_pWindows [ uiWindow ] ; + UINT uiWindow = s_pWvwData->s_usNumWindows - 1; + WIN_DATA * pWindow = s_pWvwData->s_pWindows[ uiWindow ]; + /* - int iNextPos; - BOOL bRet = FALSE; + int iNextPos; + BOOL bRet = FALSE; - *c = 0; + *c = 0; - iNextPos = ( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->keyPointerOut >= WVW_CHAR_QUEUE_SIZE - 1 ) ? 0 : s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->keyPointerOut+1 ; - if ( iNextPos != s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->keyPointerIn ) - { - *c = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->Keys[ iNextPos ] ; + iNextPos = ( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->keyPointerOut >= WVW_CHAR_QUEUE_SIZE - 1 ) ? 0 : s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->keyPointerOut+1 ; + if ( iNextPos != s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->keyPointerIn ) + { + *c = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->Keys[ iNextPos ] ; s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->keyPointerOut = iNextPos ; bRet = TRUE; - } - return( bRet ); - */ + } + return( bRet ); + */ if( pWindow->keyPointerOut != pWindow->keyPointerIn ) { *c = pWindow->Keys[ pWindow->keyPointerOut ]; @@ -1383,19 +1385,19 @@ static BOOL hb_gt_wvwGetCharFromInputQueue ( int *c ) static int hb_gt_wvw_ReadKey( PHB_GT pGT, int eventmask ) { - int c = 0; - BOOL bKey; + int c = 0; + BOOL bKey; - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_ReadKey( %d )", ( int ) eventmask ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_ReadKey( %d )", ( int ) eventmask ) ); - HB_SYMBOL_UNUSED( pGT ); - HB_SYMBOL_UNUSED( eventmask ); + HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( eventmask ); - hb_gt_wvwProcessMessages( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]) ; + hb_gt_wvwProcessMessages( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); - bKey = hb_gt_wvwGetCharFromInputQueue( &c ); + bKey = hb_gt_wvwGetCharFromInputQueue( &c ); - return( bKey ? c : 0 ); + return bKey ? c : 0; } @@ -1405,7 +1407,7 @@ static int hb_gt_wvw_ReadKey( PHB_GT pGT, int eventmask ) /* */ static void hb_gt_wvw_Tone( PHB_GT pGT, double dFrequency, double dDuration ) { - HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvw_Tone(%lf, %lf)", dFrequency, dDuration)); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Tone(%lf, %lf)", dFrequency, dDuration ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1416,9 +1418,9 @@ static void hb_gt_wvw_Tone( PHB_GT pGT, double dFrequency, double dDuration ) static void hb_gt_wvw_mouse_Init( PHB_GT pGT ) { - HB_SYMBOL_UNUSED( pGT ); - hb_wvw_vmouse_Init(); - hb_gt_wvwCreateToolTipWindow(s_pWvwData->s_pWindows[0]); + HB_SYMBOL_UNUSED( pGT ); + hb_wvw_vmouse_Init(); + hb_gt_wvwCreateToolTipWindow( s_pWvwData->s_pWindows[ 0 ] ); } @@ -1426,16 +1428,16 @@ static void hb_gt_wvw_mouse_Init( PHB_GT pGT ) static void hb_gt_wvw_mouse_Exit( PHB_GT pGT ) { - HB_SYMBOL_UNUSED( pGT ); - hb_wvw_vmouse_Exit(); + HB_SYMBOL_UNUSED( pGT ); + hb_wvw_vmouse_Exit(); } static BOOL hb_gt_wvw_mouse_IsPresent( PHB_GT pGT ) { - HB_SYMBOL_UNUSED( pGT ); - return( TRUE ); + HB_SYMBOL_UNUSED( pGT ); + return TRUE; } @@ -1443,53 +1445,53 @@ static BOOL hb_gt_wvw_mouse_IsPresent( PHB_GT pGT ) static int hb_gt_wvw_mouse_Col( PHB_GT pGT ) { - HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { - return( hb_gt_wvwGetMouseX( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ] ) + hb_gt_wvwColOfs( s_pWvwData->s_usNumWindows-1 ) ); - } - else - { - return( hb_gt_wvwGetMouseX( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ) ); - } + HB_SYMBOL_UNUSED( pGT ); + if( s_pWvwData->s_bMainCoordMode ) + { + return hb_gt_wvwGetMouseX( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ] ) + hb_gt_wvwColOfs( s_pWvwData->s_usNumWindows - 1 ); + } + else + { + return hb_gt_wvwGetMouseX( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); + } } static int hb_gt_wvw_mouse_Row( PHB_GT pGT ) { - HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { - return( hb_gt_wvwGetMouseY( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ] ) + hb_gt_wvwRowOfs( s_pWvwData->s_usNumWindows-1 )); - } - else - { - return( hb_gt_wvwGetMouseY( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ) ); - } + HB_SYMBOL_UNUSED( pGT ); + if( s_pWvwData->s_bMainCoordMode ) + { + return hb_gt_wvwGetMouseY( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ] ) + hb_gt_wvwRowOfs( s_pWvwData->s_usNumWindows - 1 ); + } + else + { + return hb_gt_wvwGetMouseY( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ] ); + } } static void hb_gt_wvw_mouse_SetPos( PHB_GT pGT, int iRow, int iCol ) { - int i_Row = (iRow < 0 ? 0 : iRow); - int i_Col = (iCol < 0 ? 0 : iCol); + int i_Row = ( iRow < 0 ? 0 : iRow ); + int i_Col = ( iCol < 0 ? 0 : iCol ); - HB_SYMBOL_UNUSED( pGT ); - if ( s_pWvwData->s_bMainCoordMode ) - { + HB_SYMBOL_UNUSED( pGT ); + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCPrologue(2, &i_Row, &i_Col, NULL, NULL); - } + hb_gt_wvwFUNCPrologue( 2, &i_Row, &i_Col, NULL, NULL ); + } - hb_wvw_vmouse_SetPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], (USHORT)i_Row, (USHORT)i_Col ); + hb_wvw_vmouse_SetPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ], ( USHORT ) i_Row, ( USHORT ) i_Col ); - if ( s_pWvwData->s_bMainCoordMode ) - { + if( s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwFUNCEpilogue( ); - } + hb_gt_wvwFUNCEpilogue(); + } } @@ -1497,19 +1499,19 @@ static void hb_gt_wvw_mouse_SetPos( PHB_GT pGT, int iRow, int iCol ) static void hb_gt_wvw_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol ) { - HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvw_mouse_GetPos(%p,%p,%p)", pGT, piRow, piCol)); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_mouse_GetPos(%p,%p,%p)", pGT, piRow, piCol ) ); HB_SYMBOL_UNUSED( pGT ); - *piRow = hb_gt_wvw_mouse_Row( pGT ); - *piCol = hb_gt_wvw_mouse_Col( pGT ); + *piRow = hb_gt_wvw_mouse_Row( pGT ); + *piCol = hb_gt_wvw_mouse_Col( pGT ); } static BOOL hb_gt_wvw_mouse_ButtonState( PHB_GT pGT, int iButton ) { - HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvw_mouse_ButtonState(%p,%i)", pGT, iButton) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_mouse_ButtonState(%p,%i)", pGT, iButton ) ); HB_SYMBOL_UNUSED( pGT ); @@ -1528,26 +1530,26 @@ static BOOL hb_gt_wvw_mouse_ButtonState( PHB_GT pGT, int iButton ) static int hb_gt_wvw_mouse_CountButton( PHB_GT pGT ) { - HB_SYMBOL_UNUSED( pGT ); - return( GetSystemMetrics( SM_CMOUSEBUTTONS ) ) ; + HB_SYMBOL_UNUSED( pGT ); + return GetSystemMetrics( SM_CMOUSEBUTTONS ); } /* *********************************************************************** */ /*WARNING: assume working on current window - *NOTES: in MainCoord Mode current window is always the Main Window + *NOTES: in MainCoord Mode current window is always the Main Window */ //int gt_info(int iMsgType, BOOL bUpdate, int iParam, void *vpParam ) static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; - int iVal; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; + int iVal; HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvw_Info(%p,%d,%p)", pGT, iType, pInfo ) ); HB_SYMBOL_UNUSED( pGT ); - switch ( iType ) + switch( iType ) { case HB_GTI_ISSCREENPOS: case HB_GTI_KBDSUPPORT: @@ -1556,7 +1558,7 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) break; case HB_GTI_ISUNICODE: -#if defined(UNICODE) +#if defined( UNICODE ) pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE ); #else pInfo->pResult = hb_itemPutL( pInfo->pResult, FALSE ); @@ -1565,41 +1567,41 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_INPUTFD: pInfo->pResult = hb_itemPutNInt( pInfo->pResult, - ( UINT_PTR ) GetStdHandle( STD_INPUT_HANDLE ) ); + ( UINT_PTR ) GetStdHandle( STD_INPUT_HANDLE ) ); break; case HB_GTI_OUTPUTFD: pInfo->pResult = hb_itemPutNInt( pInfo->pResult, - ( UINT_PTR ) GetStdHandle( STD_OUTPUT_HANDLE ) ); + ( UINT_PTR ) GetStdHandle( STD_OUTPUT_HANDLE ) ); break; case HB_GTI_ERRORFD: pInfo->pResult = hb_itemPutNInt( pInfo->pResult, - ( UINT_PTR ) GetStdHandle( STD_ERROR_HANDLE ) ); + ( UINT_PTR ) GetStdHandle( STD_ERROR_HANDLE ) ); break; case HB_GTI_FONTSIZE: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWindowData->PTEXTSIZE.y ); - iVal = hb_itemGetNI( pInfo->pNewVal ); + iVal = hb_itemGetNI( pInfo->pNewVal ); if( iVal > 0 ) { HFONT hFont = hb_gt_wvwGetFont( pWindowData->fontFace, iVal, pWindowData->fontWidth, pWindowData->fontWeight, pWindowData->fontQuality, pWindowData->CodePage ); /* make sure the font could actually be created */ - if ( hFont ) + if( hFont ) { pWindowData->fontHeight = iVal; /* is the window already opened? */ - if ( pWindowData->hWnd ) + if( pWindowData->hWnd ) { - /* resize the window based on new fonts - */ - hb_gt_wvwResetWindowSize( pWindowData, pWindowData->hWnd ); + /* resize the window based on new fonts + */ + hb_gt_wvwResetWindowSize( pWindowData, pWindowData->hWnd ); - /* force resize of caret - */ - hb_gt_wvwKillCaret( pWindowData ); - hb_gt_wvwCreateCaret( pWindowData ); - HB_GTSELF_REFRESH( hb_gt_Base() ); + /* force resize of caret + */ + hb_gt_wvwKillCaret( pWindowData ); + hb_gt_wvwCreateCaret( pWindowData ); + HB_GTSELF_REFRESH( hb_gt_Base() ); } DeleteObject( hFont ); @@ -1609,7 +1611,7 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_FONTWIDTH: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWindowData->fontWidth ); - iVal = hb_itemGetNI( pInfo->pNewVal ); + iVal = hb_itemGetNI( pInfo->pNewVal ); if( iVal > 0 ) { /* store font status for next operation on fontsize */ @@ -1632,24 +1634,24 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case FW_EXTRALIGHT: case FW_LIGHT: iVal = HB_GTI_FONTW_THIN; - break; + break; case FW_DONTCARE: case FW_NORMAL: case FW_MEDIUM: iVal = HB_GTI_FONTW_NORMAL; - break; + break; case FW_SEMIBOLD: case FW_BOLD: case FW_EXTRABOLD: case FW_HEAVY: iVal = HB_GTI_FONTW_BOLD; - break; + break; default: iVal = 0; - break; + break; } pInfo->pResult = hb_itemPutNI( pInfo->pResult, iVal ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) @@ -1682,10 +1684,10 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) break; case NONANTIALIASED_QUALITY: case PROOF_QUALITY: - iVal = HB_GTI_FONTQ_DRAFT; + iVal = HB_GTI_FONTQ_DRAFT; break; default: - iVal = 0; + iVal = 0; break; } pInfo->pResult = hb_itemPutNI( pInfo->pResult, iVal ); @@ -1694,13 +1696,13 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) switch( hb_itemGetNI( pInfo->pNewVal ) ) { case HB_GTI_FONTQ_HIGH: - pWindowData->fontQuality = ANTIALIASED_QUALITY; + pWindowData->fontQuality = ANTIALIASED_QUALITY; break; case HB_GTI_FONTQ_NORMAL: - pWindowData->fontQuality = DEFAULT_QUALITY; + pWindowData->fontQuality = DEFAULT_QUALITY; break; case HB_GTI_FONTQ_DRAFT: - pWindowData->fontQuality = DRAFT_QUALITY; + pWindowData->fontQuality = DRAFT_QUALITY; break; } } @@ -1708,38 +1710,38 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_SCREENHEIGHT: /*NOTE 20040618 currently not includes StatusBar and ToolBar, if any. - *TODO I Think it should return ALL window height, incl + *TODO I Think it should return ALL window height, incl * StatusBar and ToolBar * ie. hb_gt_wvwCalcPixelHeight() - *SEEALSO hb_gt_wvwCalcPixelHeight() + **SEEALSO hb_gt_wvwCalcPixelHeight() */ /*NOTE 20040719 screenheight includes linespacing, if any */ pInfo->pResult = hb_itemPutNI( pInfo->pResult, hb_wvw_LineHeight( pWindowData ) * pWindowData->ROWS ); - iVal = hb_itemGetNI( pInfo->pNewVal ); + iVal = hb_itemGetNI( pInfo->pNewVal ); if( iVal > 0 ) { - hb_gt_wvw_bSetMode( pWindowData, (USHORT) (iVal/hb_wvw_LineHeight( pWindowData )), pWindowData->COLS ); + hb_gt_wvw_bSetMode( pWindowData, ( USHORT ) ( iVal / hb_wvw_LineHeight( pWindowData ) ), pWindowData->COLS ); } break; case HB_GTI_SCREENWIDTH: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWindowData->PTEXTSIZE.x * pWindowData->COLS ); - iVal = hb_itemGetNI( pInfo->pNewVal ); + iVal = hb_itemGetNI( pInfo->pNewVal ); if( iVal > 0 ) { - hb_gt_wvw_bSetMode( pWindowData, pWindowData->ROWS, (USHORT) (iVal/pWindowData->PTEXTSIZE.x) ); + hb_gt_wvw_bSetMode( pWindowData, pWindowData->ROWS, ( USHORT ) ( iVal / pWindowData->PTEXTSIZE.x ) ); } break; case HB_GTI_DESKTOPWIDTH: { - RECT rDesk = { 0 }; - HWND hDesk; + RECT rDesk = { 0 }; + HWND hDesk; - hDesk = GetDesktopWindow(); + hDesk = GetDesktopWindow(); GetWindowRect( hDesk, &rDesk ); pInfo->pResult = hb_itemPutNI( pInfo->pResult, rDesk.right - rDesk.left ); break; @@ -1748,12 +1750,12 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_DESKTOPHEIGHT: { /*NOTE 20040618 currently includes StatusBar and ToolBar, if any. - *TODO Think: should it return chars area only? - *SEEALSO hb_gt_wvwCalcPixelHeight() - usSBHeight - usTBHeight + *TODO Think: should it return chars area only? + *SEEALSO hb_gt_wvwCalcPixelHeight() - usSBHeight - usTBHeight */ - RECT rDesk = { 0 }; - HWND hDesk = GetDesktopWindow(); + RECT rDesk = { 0 }; + HWND hDesk = GetDesktopWindow(); GetWindowRect( hDesk, &rDesk ); pInfo->pResult = hb_itemPutNI( pInfo->pResult, rDesk.bottom - rDesk.top ); break; @@ -1761,34 +1763,34 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_DESKTOPCOLS: { - RECT rDesk = { 0 }; - HWND hDesk; + RECT rDesk = { 0 }; + HWND hDesk; - hDesk = GetDesktopWindow(); + hDesk = GetDesktopWindow(); GetClientRect( hDesk, &rDesk ); pInfo->pResult = hb_itemPutNI( pInfo->pResult, - ( rDesk.right - rDesk.left ) / pWindowData->PTEXTSIZE.x ); + ( rDesk.right - rDesk.left ) / pWindowData->PTEXTSIZE.x ); break; } case HB_GTI_DESKTOPROWS: { /*NOTE 20040618 currently includes StatusBar and ToolBar, if any. - *TODO I Think it should it return chars area only? - *SEEALSO hb_gt_wvwCalcPixelHeight() - usSBHeight - usTBHeight + *TODO I Think it should it return chars area only? + *SEEALSO hb_gt_wvwCalcPixelHeight() - usSBHeight - usTBHeight */ /*NOTE 20040719 screenheight includes linespacing, if any */ - RECT rDesk = { 0 }; - HWND hDesk; + RECT rDesk = { 0 }; + HWND hDesk; - hDesk = GetDesktopWindow(); + hDesk = GetDesktopWindow(); GetClientRect( hDesk, &rDesk ); pInfo->pResult = hb_itemPutNI( pInfo->pResult, - ( rDesk.bottom - rDesk.top ) / hb_wvw_LineHeight( pWindowData ) ); + ( rDesk.bottom - rDesk.top ) / hb_wvw_LineHeight( pWindowData ) ); break; } case HB_GTI_WINTITLE: @@ -1804,7 +1806,7 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } case HB_GTI_CODEPAGE: pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWindowData->CodePage ); - iVal = hb_itemGetNI( pInfo->pNewVal ); + iVal = hb_itemGetNI( pInfo->pNewVal ); if( iVal > 0 && iVal != pWindowData->CodePage ) { hb_gt_wvwSetCodePage( s_pWvwData->s_usCurWindow, iVal );; @@ -1817,7 +1819,7 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { LPTSTR lpImage = HB_TCHAR_CONVTO( hb_itemGetCPtr( pInfo->pNewVal ) ); - hIcon = (HICON) hb_gt_wvwSetWindowIconFromFile( s_pWvwData->s_usCurWindow, (char *) lpImage ); + hIcon = ( HICON ) hb_gt_wvwSetWindowIconFromFile( s_pWvwData->s_usCurWindow, ( char * ) lpImage ); HB_TCHAR_FREE( lpImage ); } pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( UINT_PTR ) hIcon ); @@ -1829,12 +1831,12 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) HICON hIcon = NULL; if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { - LPSTR lpIcon = (LPSTR)hb_itemGetCPtr( pInfo->pNewVal ); - hIcon = (HICON) hb_gt_wvwSetWindowIcon( s_pWvwData->s_usCurWindow, 0, (char *) lpIcon ); + LPSTR lpIcon = ( LPSTR ) hb_itemGetCPtr( pInfo->pNewVal ); + hIcon = ( HICON ) hb_gt_wvwSetWindowIcon( s_pWvwData->s_usCurWindow, 0, ( char * ) lpIcon ); } else if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) { - hIcon = (HICON) hb_gt_wvwSetWindowIcon( s_pWvwData->s_usCurWindow, hb_itemGetNI( pInfo->pNewVal ), NULL ); + hIcon = ( HICON ) hb_gt_wvwSetWindowIcon( s_pWvwData->s_usCurWindow, hb_itemGetNI( pInfo->pNewVal ), NULL ); } pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( UINT_PTR ) hIcon ); break; @@ -1886,28 +1888,27 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { int iX, iY; - if( !pInfo->pResult ) + if( ! pInfo->pResult ) { pInfo->pResult = hb_itemNew( NULL ); } hb_arrayNew( pInfo->pResult, 2 ); - hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult,2 ), pWindowData->PTEXTSIZE.y * pWindowData->ROWS ); - hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult,1 ), pWindowData->PTEXTSIZE.x * pWindowData->COLS ); - iY = hb_itemGetNI( hb_arrayGetItemPtr( pInfo->pNewVal,2 ) ); - iX = hb_itemGetNI( hb_arrayGetItemPtr( pInfo->pNewVal,1 ) ); + hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult, 2 ), pWindowData->PTEXTSIZE.y * pWindowData->ROWS ); + hb_itemPutNI( hb_arrayGetItemPtr( pInfo->pResult, 1 ), pWindowData->PTEXTSIZE.x * pWindowData->COLS ); + iY = hb_itemGetNI( hb_arrayGetItemPtr( pInfo->pNewVal, 2 ) ); + iX = hb_itemGetNI( hb_arrayGetItemPtr( pInfo->pNewVal, 1 ) ); - if( iY > 0 ) + if( iY > 0 ) { //BOOL bOldCentre = pWindowData->CentreWindow; //pWVT->CentreWindow = pWVT->bMaximized ? TRUE : FALSE; - hb_gt_wvw_bSetMode( pWindowData, (USHORT) ( iY / pWindowData->PTEXTSIZE.y ), (USHORT) ( iX / pWindowData->PTEXTSIZE.x ) ); + hb_gt_wvw_bSetMode( pWindowData, ( USHORT ) ( iY / pWindowData->PTEXTSIZE.y ), ( USHORT ) ( iX / pWindowData->PTEXTSIZE.x ) ); //pWindowData->CentreWindow = bOldCentre; } break; } case HB_GTI_PALETTE: - { if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) { int iIndex = hb_itemGetNI( pInfo->pNewVal ); @@ -1925,7 +1926,7 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) else { int i; - if( !pInfo->pResult ) + if( ! pInfo->pResult ) { pInfo->pResult = hb_itemNew( NULL ); } @@ -1943,7 +1944,6 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } } break; - } default: return HB_GTSUPER_INFO( hb_gt_Base(), iType, pInfo ); } @@ -1961,35 +1961,35 @@ static BOOL hb_gt_wvw_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) * */ -#define SetGFXContext() hPen=CreatePen(PS_SOLID,1,color); hOldPen=(HPEN) SelectObject(hdc,hPen); hBrush=(HBRUSH) CreateSolidBrush(color); hOldBrush=(HBRUSH) SelectObject(hdc,hBrush); bOut=TRUE +#define SetGFXContext() hPen = CreatePen( PS_SOLID, 1, color ); hOldPen = ( HPEN ) SelectObject( hdc, hPen ); hBrush = ( HBRUSH ) CreateSolidBrush( color ); hOldBrush = ( HBRUSH ) SelectObject( hdc, hBrush ); bOut = TRUE /*WARNING: assume working on current window - *NOTES: in MainCoord Mode current window is always the Main Window + *NOTES: in MainCoord Mode current window is always the Main Window */ -static int hb_gt_wvw_gfxPrimitive(PHB_GT pGT, int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) +static int hb_gt_wvw_gfxPrimitive( PHB_GT pGT, int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor ) { -COLORREF color; -HPEN hPen = NULL, hOldPen = NULL; -HBRUSH hBrush = NULL, hOldBrush = NULL; -HDC hdc; -BOOL bOut = FALSE; -int iRet = 0; -WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; + COLORREF color; + HPEN hPen = NULL, hOldPen = NULL; + HBRUSH hBrush = NULL, hOldBrush = NULL; + HDC hdc; + BOOL bOut = FALSE; + int iRet = 0; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; HB_SYMBOL_UNUSED( pGT ); hdc = GetDC( pWindowData->hWnd ); - switch ( iType ) + switch( iType ) { case HB_GFX_ACQUIRESCREEN: case HB_GFX_RELEASESCREEN: - ReleaseDC(pWindowData->hWnd, hdc); + ReleaseDC( pWindowData->hWnd, hdc ); return 1; case HB_GFX_MAKECOLOR: - ReleaseDC(pWindowData->hWnd, hdc); - return (int) ( iTop << 16 | iLeft << 8 | iBottom ); + ReleaseDC( pWindowData->hWnd, hdc ); + return ( int ) ( iTop << 16 | iLeft << 8 | iBottom ); case HB_GFX_PUTPIXEL: color = RGB( iBottom >> 16, ( iBottom & 0xFF00 ) >> 8, iBottom & 0xFF ); SetGFXContext(); @@ -1997,7 +1997,7 @@ WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; MoveToEx( hdc, iLeft, iTop, NULL ); LineTo( hdc, iLeft, iTop ); - iRet = 1; + iRet = 1; break; case HB_GFX_LINE: color = RGB( iColor >> 16, ( iColor & 0xFF00 ) >> 8, iColor & 0xFF ); @@ -2011,12 +2011,12 @@ WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; case HB_GFX_RECT: { RECT r = { 0 }; - r.left = iLeft; - r.top = iTop; - r.right = iRight; + r.left = iLeft; + r.top = iTop; + r.right = iRight; r.bottom = iBottom; - color = RGB( iColor >> 16, ( iColor & 0xFF00 ) >> 8, iColor & 0xFF ); + color = RGB( iColor >> 16, ( iColor & 0xFF00 ) >> 8, iColor & 0xFF ); SetGFXContext(); FrameRect( hdc, &r, hBrush ); @@ -2030,7 +2030,7 @@ WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; Rectangle( hdc, iLeft, iTop, iRight, iBottom ); - iRet = 1; + iRet = 1; break; case HB_GFX_CIRCLE: color = RGB( iRight >> 16, ( iRight & 0xFF00 ) >> 8, iRight & 0xFF ); @@ -2038,7 +2038,7 @@ WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; Arc( hdc, iLeft - iBottom / 2, iTop - iBottom / 2, iLeft + iBottom / 2, iTop + iBottom / 2, 0, 0, 0, 0 ); - iRet = 1; + iRet = 1; break; case HB_GFX_FILLEDCIRCLE: color = RGB( iRight >> 16, ( iRight & 0xFF00 ) >> 8, iRight & 0xFF ); @@ -2046,7 +2046,7 @@ WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; Ellipse( hdc, iLeft - iBottom / 2, iTop - iBottom / 2, iLeft + iBottom / 2, iTop + iBottom / 2 ); - iRet = 1; + iRet = 1; break; case HB_GFX_ELLIPSE: color = RGB( iColor >> 16, ( iColor & 0xFF00 ) >> 8, iColor & 0xFF ); @@ -2054,7 +2054,7 @@ WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; Arc( hdc, iLeft - iRight / 2, iTop - iBottom / 2, iLeft + iRight / 2, iTop + iBottom / 2, 0, 0, 0, 0 ); - iRet = 1; + iRet = 1; break; case HB_GFX_FILLEDELLIPSE: color = RGB( iColor >> 16, ( iColor & 0xFF00 ) >> 8, iColor & 0xFF ); @@ -2062,7 +2062,7 @@ WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; Ellipse( hdc, iLeft - iRight / 2, iTop - iBottom / 2, iLeft + iRight / 2, iTop + iBottom / 2 ); - iRet = 1; + iRet = 1; break; case HB_GFX_FLOODFILL: color = RGB( iBottom >> 16, ( iBottom & 0xFF00 ) >> 8, iBottom & 0xFF ); @@ -2072,28 +2072,28 @@ WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; iRet = 1; break; - } + } - if ( bOut ) - { - SelectObject( hdc, hOldPen ); - SelectObject( hdc, hOldBrush ); - DeleteObject( hBrush ); - DeleteObject( hPen ); - } + if( bOut ) + { + SelectObject( hdc, hOldPen ); + SelectObject( hdc, hOldBrush ); + DeleteObject( hBrush ); + DeleteObject( hPen ); + } - ReleaseDC(pWindowData->hWnd, hdc); - return iRet; + ReleaseDC( pWindowData->hWnd, hdc ); + return iRet; } -void gt_gfxText( int iTop, int iLeft, char *cBuf, int iColor, int iSize, int iWidth ) +void gt_gfxText( int iTop, int iLeft, char * cBuf, int iColor, int iSize, int iWidth ) { - HB_SYMBOL_UNUSED( iTop ); - HB_SYMBOL_UNUSED( iLeft ); - HB_SYMBOL_UNUSED( cBuf ); - HB_SYMBOL_UNUSED( iColor ); - HB_SYMBOL_UNUSED( iSize ); - HB_SYMBOL_UNUSED( iWidth ); + HB_SYMBOL_UNUSED( iTop ); + HB_SYMBOL_UNUSED( iLeft ); + HB_SYMBOL_UNUSED( cBuf ); + HB_SYMBOL_UNUSED( iColor ); + HB_SYMBOL_UNUSED( iSize ); + HB_SYMBOL_UNUSED( iWidth ); } /* ******** Graphics API end ******** */ @@ -2108,17 +2108,17 @@ void gt_gfxText( int iTop, int iLeft, char *cBuf, int iColor, int iSize, int iWi BOOL CALLBACK hb_gt_wvwDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { int iIndex, iType; - long int bReturn = FALSE ; - PHB_ITEM pFunc = NULL; + long int bReturn = FALSE; + PHB_ITEM pFunc = NULL; - iType = (int) NULL; + iType = ( int ) NULL; - for ( iIndex = 0; iIndex < WVW_DLGML_MAX; iIndex++ ) + for( iIndex = 0; iIndex < WVW_DLGML_MAX; iIndex++ ) { - if ( ( s_pWvwData->s_sApp->hDlgModeless[ iIndex ] != NULL ) && ( s_pWvwData->s_sApp->hDlgModeless[ iIndex ] == hDlg ) ) + if( ( s_pWvwData->s_sApp->hDlgModeless[ iIndex ] != NULL ) && ( s_pWvwData->s_sApp->hDlgModeless[ iIndex ] == hDlg ) ) { - if ( s_pWvwData->s_sApp->pFunc[ iIndex ] != NULL ) + if( s_pWvwData->s_sApp->pFunc[ iIndex ] != NULL ) { pFunc = s_pWvwData->s_sApp->pFunc[ iIndex ]; iType = s_pWvwData->s_sApp->iType[ iIndex ]; @@ -2127,60 +2127,57 @@ BOOL CALLBACK hb_gt_wvwDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPA } } - if ( pFunc ) + if( pFunc ) { - switch ( iType ) + switch( iType ) { case 1: - { if( hb_vmRequestReenter() ) { hb_vmPushDynSym( ( PHB_DYNS ) pFunc ); hb_vmPushNil(); - hb_vmPushNumInt(( HB_MAXINT ) ( HB_PTRDIFF ) hDlg ); + hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hDlg ); hb_vmPushNumInt( message ); hb_vmPushNumInt( wParam ); hb_vmPushNumInt( lParam ); - hb_vmDo( 4 ); + hb_vmDo( 4 ); bReturn = hb_parnl( -1 ); hb_vmRequestRestore(); } break; - } case 2: - { /* eval the codeblock */ /* - if (s_pWvwData->s_sApp->pFunc[ iIndex ]->type == HB_IT_BLOCK) - { - HB_ITEM hihDlg, himessage, hiwParam, hilParam; - PHB_ITEM pReturn; + if (s_pWvwData->s_sApp->pFunc[ iIndex ]->type == HB_IT_BLOCK) + { + HB_ITEM hihDlg, himessage, hiwParam, hilParam; + PHB_ITEM pReturn; - hihDlg.type = HB_IT_NIL; - hb_itemPutNL( &hihDlg, (ULONG) hDlg ); + hihDlg.type = HB_IT_NIL; + hb_itemPutNL( &hihDlg, (ULONG) hDlg ); - himessage.type = HB_IT_NIL; - hb_itemPutNL( &himessage, (ULONG) message ); + himessage.type = HB_IT_NIL; + hb_itemPutNL( &himessage, (ULONG) message ); - hiwParam.type = HB_IT_NIL; - hb_itemPutNL( &hiwParam, (ULONG) wParam ); + hiwParam.type = HB_IT_NIL; + hb_itemPutNL( &hiwParam, (ULONG) wParam ); - hilParam.type = HB_IT_NIL; - hb_itemPutNL( &hilParam, (ULONG) lParam ); + hilParam.type = HB_IT_NIL; + hb_itemPutNL( &hilParam, (ULONG) lParam ); - pReturn = hb_itemDo( (PHB_ITEM) s_pWvwData->s_sApp->pFunc[ iIndex ], 4, &hihDlg, &himessage, &hiwParam, &hilParam ); + pReturn = hb_itemDo( (PHB_ITEM) s_pWvwData->s_sApp->pFunc[ iIndex ], 4, &hihDlg, &himessage, &hiwParam, &hilParam ); - bReturn = hb_itemGetNL( pReturn ); - hb_itemRelease( pReturn ); + bReturn = hb_itemGetNL( pReturn ); + hb_itemRelease( pReturn ); - } - */ - if ( HB_IS_BLOCK( pFunc ) ) + } + */ + if( HB_IS_BLOCK( pFunc ) ) { if( hb_vmRequestReenter() ) { @@ -2193,63 +2190,51 @@ BOOL CALLBACK hb_gt_wvwDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPA hb_vmSend( 4 ); bReturn = hb_parnl( -1 ); hb_vmRequestRestore(); + } } - } - else { } break; - } } } switch( message ) { case WM_COMMAND: - { switch( LOWORD( wParam ) ) { case IDOK: - { DestroyWindow( hDlg ); bReturn = TRUE; - } - break; + break; case IDCANCEL: - { DestroyWindow( hDlg ); bReturn = FALSE; - } - break; + break; } - } - break; + break; case WM_CLOSE: - { DestroyWindow( hDlg ); bReturn = FALSE; - } - break; + break; case WM_NCDESTROY: - { - if ( s_pWvwData->s_sApp->pFunc[ iIndex ] != NULL && s_pWvwData->s_sApp->iType[ iIndex ] == 2 ) + if( s_pWvwData->s_sApp->pFunc[ iIndex ] != NULL && s_pWvwData->s_sApp->iType[ iIndex ] == 2 ) { hb_itemRelease( s_pWvwData->s_sApp->pFunc[ iIndex ] ); } - s_pWvwData->s_sApp->hDlgModeless[ iIndex ] = NULL; + s_pWvwData->s_sApp->hDlgModeless[ iIndex ] = NULL; - s_pWvwData->s_sApp->pFunc[ iIndex ] = NULL; - s_pWvwData->s_sApp->iType[ iIndex ] = (int) NULL; - bReturn = FALSE; - } - break; + s_pWvwData->s_sApp->pFunc[ iIndex ] = NULL; + s_pWvwData->s_sApp->iType[ iIndex ] = ( int ) NULL; + bReturn = FALSE; + break; } return bReturn; @@ -2260,25 +2245,25 @@ BOOL CALLBACK hb_gt_wvwDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPA BOOL CALLBACK hb_gt_wvwDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { int iIndex, iType; - long int bReturn = FALSE ; - PHB_ITEM pFunc = NULL; + long int bReturn = FALSE; + PHB_ITEM pFunc = NULL; - int iFirst = ( int ) lParam; + int iFirst = ( int ) lParam; - if ( iFirst > 0 && iFirst <= WVW_DLGMD_MAX ) + if( iFirst > 0 && iFirst <= WVW_DLGMD_MAX ) { - s_pWvwData->s_sApp->hDlgModal[ iFirst-1 ] = hDlg ; + s_pWvwData->s_sApp->hDlgModal[ iFirst - 1 ] = hDlg; SendMessage( hDlg, WM_INITDIALOG, 0, 0 ); - return ( bReturn ); + return bReturn; } iType = ( int ) NULL; - for ( iIndex = 0; iIndex < WVW_DLGMD_MAX; iIndex++ ) + for( iIndex = 0; iIndex < WVW_DLGMD_MAX; iIndex++ ) { - if ( ( s_pWvwData->s_sApp->hDlgModal[ iIndex ] != NULL ) && ( s_pWvwData->s_sApp->hDlgModal[ iIndex ] == hDlg ) ) + if( ( s_pWvwData->s_sApp->hDlgModal[ iIndex ] != NULL ) && ( s_pWvwData->s_sApp->hDlgModal[ iIndex ] == hDlg ) ) { - if ( s_pWvwData->s_sApp->pFuncModal[ iIndex ] != NULL ) + if( s_pWvwData->s_sApp->pFuncModal[ iIndex ] != NULL ) { pFunc = s_pWvwData->s_sApp->pFuncModal[ iIndex ]; iType = s_pWvwData->s_sApp->iTypeModal[ iIndex ]; @@ -2287,12 +2272,11 @@ BOOL CALLBACK hb_gt_wvwDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPA } } - if ( pFunc ) + if( pFunc ) { - switch ( iType ) + switch( iType ) { case 1: - { if( hb_vmRequestReenter() ) { hb_vmPushDynSym( ( PHB_DYNS ) pFunc ); @@ -2302,41 +2286,39 @@ BOOL CALLBACK hb_gt_wvwDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPA hb_vmPushNumInt( message ); hb_vmPushNumInt( wParam ); hb_vmPushNumInt( lParam ); - hb_vmDo( 4 ); + hb_vmDo( 4 ); bReturn = hb_parnl( -1 ); hb_vmRequestRestore(); - } + } break; - } case 2: - { /* eval the codeblock */ /* - if (s_pWvwData->s_sApp->pFuncModal[ iIndex ]->type == HB_IT_BLOCK ) - { - HB_ITEM hihDlg, himessage, hiwParam, hilParam; - PHB_ITEM pReturn; + if (s_pWvwData->s_sApp->pFuncModal[ iIndex ]->type == HB_IT_BLOCK ) + { + HB_ITEM hihDlg, himessage, hiwParam, hilParam; + PHB_ITEM pReturn; - hihDlg.type = HB_IT_NIL; - hb_itemPutNL( &hihDlg, (ULONG) hDlg ); + hihDlg.type = HB_IT_NIL; + hb_itemPutNL( &hihDlg, (ULONG) hDlg ); - himessage.type = HB_IT_NIL; - hb_itemPutNL( &himessage, (ULONG) message ); + himessage.type = HB_IT_NIL; + hb_itemPutNL( &himessage, (ULONG) message ); - hiwParam.type = HB_IT_NIL; - hb_itemPutNL( &hiwParam, (ULONG) wParam ); + hiwParam.type = HB_IT_NIL; + hb_itemPutNL( &hiwParam, (ULONG) wParam ); - hilParam.type = HB_IT_NIL; - hb_itemPutNL( &hilParam, (ULONG) lParam ); + hilParam.type = HB_IT_NIL; + hb_itemPutNL( &hilParam, (ULONG) lParam ); - pReturn = hb_itemDo( (PHB_ITEM) s_pWvwData->s_sApp->pFuncModal[ iIndex ], 4, &hihDlg, &himessage, &hiwParam, &hilParam ); - bReturn = hb_itemGetNL( pReturn ); - hb_itemRelease( pReturn ); - } - */ - if ( HB_IS_BLOCK( pFunc ) ) + pReturn = hb_itemDo( (PHB_ITEM) s_pWvwData->s_sApp->pFuncModal[ iIndex ], 4, &hihDlg, &himessage, &hiwParam, &hilParam ); + bReturn = hb_itemGetNL( pReturn ); + hb_itemRelease( pReturn ); + } + */ + if( HB_IS_BLOCK( pFunc ) ) { if( hb_vmRequestReenter() ) { @@ -2351,50 +2333,39 @@ BOOL CALLBACK hb_gt_wvwDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPA hb_vmRequestRestore(); } } - else { } break; - } } } switch( message ) { case WM_COMMAND: - { switch( LOWORD( wParam ) ) { case IDOK: - { EndDialog( hDlg, IDOK ); bReturn = TRUE; - } - break; + break; case IDCANCEL: - { EndDialog( hDlg, IDCANCEL ); bReturn = FALSE; - } - break; + break; } - } - break; + break; case WM_CLOSE: - { EndDialog( hDlg, IDCANCEL ); bReturn = FALSE; - } - break; + break; case WM_NCDESTROY: - { - if ( s_pWvwData->s_sApp->pFuncModal[ iIndex ] != NULL && s_pWvwData->s_sApp->iTypeModal[ iIndex ] == 2 ) + if( s_pWvwData->s_sApp->pFuncModal[ iIndex ] != NULL && s_pWvwData->s_sApp->iTypeModal[ iIndex ] == 2 ) { hb_itemRelease( s_pWvwData->s_sApp->pFuncModal[ iIndex ] ); @@ -2402,9 +2373,8 @@ BOOL CALLBACK hb_gt_wvwDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPA s_pWvwData->s_sApp->hDlgModal[ iIndex ] = NULL; s_pWvwData->s_sApp->pFuncModal[ iIndex ] = NULL; s_pWvwData->s_sApp->iTypeModal[ iIndex ] = ( int ) NULL; - bReturn = FALSE; - } - break; + bReturn = FALSE; + break; } return bReturn; @@ -2434,38 +2404,38 @@ static void hb_gt_wvwCreateObjects( UINT usWinNum ) (2) do the creation and deletion only when required */ /* 20040923 choose #1 of above option */ - if (usWinNum>0) + if( usWinNum > 0 ) { return; } - s_pWvwData->s_sApp->penWhite = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 255,255,255 ) ); - s_pWvwData->s_sApp->penBlack = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 0, 0, 0 ) ); - s_pWvwData->s_sApp->penWhiteDim = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 205,205,205 ) ); - s_pWvwData->s_sApp->penDarkGray = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 150,150,150 ) ); - s_pWvwData->s_sApp->penGray = CreatePen( PS_SOLID, 0, ( COLORREF ) _COLORS[ 7 ] ); - s_pWvwData->s_sApp->penNull = CreatePen( PS_NULL , 0, ( COLORREF ) _COLORS[ 7 ] ); - s_pWvwData->s_sApp->currentPen = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 0, 0, 0 ) ); + s_pWvwData->s_sApp->penWhite = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 255, 255, 255 ) ); + s_pWvwData->s_sApp->penBlack = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 0, 0, 0 ) ); + s_pWvwData->s_sApp->penWhiteDim = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 205, 205, 205 ) ); + s_pWvwData->s_sApp->penDarkGray = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 150, 150, 150 ) ); + s_pWvwData->s_sApp->penGray = CreatePen( PS_SOLID, 0, ( COLORREF ) _COLORS[ 7 ] ); + s_pWvwData->s_sApp->penNull = CreatePen( PS_NULL, 0, ( COLORREF ) _COLORS[ 7 ] ); + s_pWvwData->s_sApp->currentPen = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 0, 0, 0 ) ); - lb.lbStyle = BS_NULL; - lb.lbColor = RGB( 198,198,198 ); - lb.lbHatch = 0; - s_pWvwData->s_sApp->currentBrush = CreateBrushIndirect( &lb ); + lb.lbStyle = BS_NULL; + lb.lbColor = RGB( 198, 198, 198 ); + lb.lbHatch = 0; + s_pWvwData->s_sApp->currentBrush = CreateBrushIndirect( &lb ); - lb.lbStyle = BS_HATCHED; - lb.lbColor = RGB( 210,210,210 ); - lb.lbHatch = HS_DIAGCROSS; /* HS_BDIAGONAL; */ - s_pWvwData->s_sApp->diagonalBrush = CreateBrushIndirect( &lb ); + lb.lbStyle = BS_HATCHED; + lb.lbColor = RGB( 210, 210, 210 ); + lb.lbHatch = HS_DIAGCROSS; /* HS_BDIAGONAL; */ + s_pWvwData->s_sApp->diagonalBrush = CreateBrushIndirect( &lb ); - lb.lbStyle = BS_SOLID; - lb.lbColor = 0; /* RGB( 0,0,0 ); */ - lb.lbHatch = 0; - s_pWvwData->s_sApp->solidBrush = CreateBrushIndirect( &lb ); + lb.lbStyle = BS_SOLID; + lb.lbColor = 0; /* RGB( 0,0,0 ); */ + lb.lbHatch = 0; + s_pWvwData->s_sApp->solidBrush = CreateBrushIndirect( &lb ); - lb.lbStyle = BS_SOLID; - lb.lbColor = _COLORS[ 7 ]; - lb.lbHatch = 0; - s_pWvwData->s_sApp->wvwWhiteBrush= CreateBrushIndirect( &lb ); + lb.lbStyle = BS_SOLID; + lb.lbColor = _COLORS[ 7 ]; + lb.lbHatch = 0; + s_pWvwData->s_sApp->wvwWhiteBrush = CreateBrushIndirect( &lb ); } @@ -2475,45 +2445,45 @@ static void hb_gt_wvwCreateObjects( UINT usWinNum ) static USHORT hb_gt_wvwCalcPixelHeight( WIN_DATA * pWindowData ) { - return( hb_wvw_LineHeight( pWindowData )*pWindowData->ROWS + + return hb_wvw_LineHeight( pWindowData ) * pWindowData->ROWS + pWindowData->usSBHeight + - pWindowData->usTBHeight); + pWindowData->usTBHeight; } static USHORT hb_gt_wvwCalcPixelWidth( WIN_DATA * pWindowData ) { - return( (USHORT) pWindowData->PTEXTSIZE.x*pWindowData->COLS ); + return ( USHORT ) pWindowData->PTEXTSIZE.x * pWindowData->COLS; } static BOOL hb_gt_wvwAllocSpBuffer( WIN_DATA * pWindowData, USHORT col, USHORT row ) { - BOOL bRet = TRUE; + BOOL bRet = TRUE; - pWindowData->COLS = col; - pWindowData->ROWS = row; - pWindowData->BUFFERSIZE = col * row * sizeof( char ); - pWindowData->pBuffer = pWindowData->byBuffer ; - pWindowData->pColors = pWindowData->byColors; + pWindowData->COLS = col; + pWindowData->ROWS = row; + pWindowData->BUFFERSIZE = col * row * sizeof( char ); + pWindowData->pBuffer = pWindowData->byBuffer; + pWindowData->pColors = pWindowData->byColors; - memset( pWindowData->pBuffer, ' ', pWindowData->BUFFERSIZE ); + memset( pWindowData->pBuffer, ' ', pWindowData->BUFFERSIZE ); - if (pWindowData->byWinId==0) - { + if( pWindowData->byWinId == 0 ) + { - memset( pWindowData->pColors, 0x07, pWindowData->BUFFERSIZE ); + memset( pWindowData->pColors, 0x07, pWindowData->BUFFERSIZE ); - } - else - { - memset( pWindowData->pColors, hb_gtGetCurrColor(), pWindowData->BUFFERSIZE ); - } + } + else + { + memset( pWindowData->pColors, hb_gtGetCurrColor(), pWindowData->BUFFERSIZE ); + } - return( bRet ); + return bRet; } @@ -2521,11 +2491,11 @@ static BOOL hb_gt_wvwAllocSpBuffer( WIN_DATA * pWindowData, USHORT col, USHORT r static BOOL hb_gt_wvwInitWindow( WIN_DATA * pWindowData, HWND hWnd, USHORT col, USHORT row ) { - BOOL bRet = hb_gt_wvwAllocSpBuffer( pWindowData, col, row ); + BOOL bRet = hb_gt_wvwAllocSpBuffer( pWindowData, col, row ); - hb_gt_wvwResetWindowSize( pWindowData, hWnd ); + hb_gt_wvwResetWindowSize( pWindowData, hWnd ); - return( bRet ); + return bRet; } @@ -2533,294 +2503,293 @@ static BOOL hb_gt_wvwInitWindow( WIN_DATA * pWindowData, HWND hWnd, USHORT col, /* WVT commented out this function. WVW is still using it. */ static BOOL hb_gt_wvwValidWindowSize( WIN_DATA * pWindowData, int rows, int cols, HFONT hFont, int iWidth, - int *pmaxrows, int *pmaxcols ) + int * pmaxrows, int * pmaxcols ) { - HDC hdc; - HFONT hOldFont ; - USHORT width, height, maxWidth, maxHeight; - USHORT diffHeight, diffWidth; - TEXTMETRIC tm = { 0 }; - RECT rcWorkArea = { 0 }; + HDC hdc; + HFONT hOldFont; + USHORT width, height, maxWidth, maxHeight; + USHORT diffHeight, diffWidth; + TEXTMETRIC tm = { 0 }; + RECT rcWorkArea = { 0 }; - RECT wi = { 0 }, ci = { 0 }; + RECT wi = { 0 }, ci = { 0 }; - SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 ); + SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 ); - maxWidth = (SHORT) ( rcWorkArea.right - rcWorkArea.left + 1); - maxHeight = (SHORT) ( rcWorkArea.bottom - rcWorkArea.top + 1); + maxWidth = ( SHORT ) ( rcWorkArea.right - rcWorkArea.left + 1 ); + maxHeight = ( SHORT ) ( rcWorkArea.bottom - rcWorkArea.top + 1 ); - hdc = GetDC( pWindowData->hWnd ); - hOldFont = ( HFONT ) SelectObject( hdc, hFont ); - GetTextMetrics( hdc, &tm ); - SelectObject( hdc, hOldFont ); + hdc = GetDC( pWindowData->hWnd ); + hOldFont = ( HFONT ) SelectObject( hdc, hFont ); + GetTextMetrics( hdc, &tm ); + SelectObject( hdc, hOldFont ); - ReleaseDC( pWindowData->hWnd, hdc ); + ReleaseDC( pWindowData->hWnd, hdc ); - width = (iWidth < 0 ? (USHORT)-iWidth : (USHORT)((USHORT)(LONG)(tm.tmAveCharWidth))) * (USHORT)cols ; /* Total pixel width this setting would take */ - height = (USHORT)((USHORT)(LONG)(tm.tmHeight)) * (USHORT)rows; /* Total pixel height this setting would take */ + width = ( iWidth < 0 ? ( USHORT ) -iWidth : ( USHORT ) ( ( USHORT ) ( LONG ) ( tm.tmAveCharWidth ) ) ) * ( USHORT ) cols; /* Total pixel width this setting would take */ + height = ( USHORT ) ( ( USHORT ) ( LONG ) ( tm.tmHeight ) ) * ( USHORT ) rows; /* Total pixel height this setting would take */ - GetWindowRect( pWindowData->hWnd, &wi ); - GetClientRect( pWindowData->hWnd, &ci ); + GetWindowRect( pWindowData->hWnd, &wi ); + GetClientRect( pWindowData->hWnd, &ci ); - diffWidth = (SHORT) (( wi.right - wi.left ) - ( ci.right )); - diffHeight = (SHORT) (( wi.bottom - wi.top ) - ( ci.bottom )); - width += diffWidth; - height += diffHeight; + diffWidth = ( SHORT ) ( ( wi.right - wi.left ) - ( ci.right ) ); + diffHeight = ( SHORT ) ( ( wi.bottom - wi.top ) - ( ci.bottom ) ); + width += diffWidth; + height += diffHeight; - height += (USHORT)(pWindowData->byLineSpacing * rows); + height += ( USHORT ) ( pWindowData->byLineSpacing * rows ); - height += pWindowData->usTBHeight; + height += pWindowData->usTBHeight; - height += pWindowData->usSBHeight; + height += pWindowData->usSBHeight; - /* TODO: should also calc menu */ + /* TODO: should also calc menu */ - /* before returning, put the max possible rows/cols to pmaxrows/pmaxcols */ - if (pmaxrows) - { - (*pmaxrows) = (maxHeight - diffHeight - pWindowData->usTBHeight - pWindowData->usSBHeight) / - hb_wvw_LineHeight( pWindowData ); - } - if (pmaxcols) - { - (*pmaxcols) = (maxWidth - diffWidth) / - (iWidth < 0 ? -iWidth : tm.tmAveCharWidth); - } + /* before returning, put the max possible rows/cols to pmaxrows/pmaxcols */ + if( pmaxrows ) + { + ( *pmaxrows ) = ( maxHeight - diffHeight - pWindowData->usTBHeight - pWindowData->usSBHeight ) / + hb_wvw_LineHeight( pWindowData ); + } + if( pmaxcols ) + { + ( *pmaxcols ) = ( maxWidth - diffWidth ) / + ( iWidth < 0 ? -iWidth : tm.tmAveCharWidth ); + } - return( ( width <= maxWidth ) && ( height <= maxHeight ) ); + return ( width <= maxWidth ) && ( height <= maxHeight ); } static void hb_gt_wvwResetWindowSize( WIN_DATA * pWindowData, HWND hWnd ) { - HDC hdc; - HFONT hFont, hOldFont ; - USHORT diffWidth, diffHeight; - USHORT height, width; - RECT wi = { 0 }, ci = { 0 }; - TEXTMETRIC tm = { 0 }; + HDC hdc; + HFONT hFont, hOldFont; + USHORT diffWidth, diffHeight; + USHORT height, width; + RECT wi = { 0 }, ci = { 0 }; + TEXTMETRIC tm = { 0 }; - RECT rcWorkArea = { 0 }; - RECT rcMainClientArea = { 0 }; - int n; - WIN_DATA * pMainWindow; + RECT rcWorkArea = { 0 }; + RECT rcMainClientArea = { 0 }; + int n; + WIN_DATA * pMainWindow; - pMainWindow = s_pWvwData->s_pWindows[ 0 ]; + pMainWindow = s_pWvwData->s_pWindows[ 0 ]; - /* set the font and get it's size to determine the size of the client area - * for the required number of rows and columns - */ - hdc = GetDC( hWnd ); - hFont = hb_gt_wvwGetFont( pWindowData->fontFace, pWindowData->fontHeight, pWindowData->fontWidth, pWindowData->fontWeight, pWindowData->fontQuality, pWindowData->CodePage ); + /* set the font and get it's size to determine the size of the client area + * for the required number of rows and columns + */ + hdc = GetDC( hWnd ); + hFont = hb_gt_wvwGetFont( pWindowData->fontFace, pWindowData->fontHeight, pWindowData->fontWidth, pWindowData->fontWeight, pWindowData->fontQuality, pWindowData->CodePage ); - if ( pWindowData->hFont ) - { - DeleteObject( (HFONT) pWindowData->hFont ); - } + if( pWindowData->hFont ) + { + DeleteObject( ( HFONT ) pWindowData->hFont ); + } - pWindowData->hFont = hFont ; - hOldFont = ( HFONT ) SelectObject( hdc, hFont ); + pWindowData->hFont = hFont; + hOldFont = ( HFONT ) SelectObject( hdc, hFont ); - GetTextMetrics( hdc, &tm ); - SetTextCharacterExtra( hdc,0 ); /* do not add extra char spacing even if bold */ + GetTextMetrics( hdc, &tm ); + SetTextCharacterExtra( hdc, 0 ); /* do not add extra char spacing even if bold */ - SelectObject( hdc, hOldFont ); - ReleaseDC( hWnd, hdc ); + SelectObject( hdc, hOldFont ); + ReleaseDC( hWnd, hdc ); - /* we will need to use the font size to handle the transformations from - * row column space in the future, so we keep it around in a static! - */ - - pWindowData->PTEXTSIZE.x = pWindowData->fontWidth<0 ? -pWindowData->fontWidth : tm.tmAveCharWidth; /* For fixed FONT should == tm.tmMaxCharWidth */ - pWindowData->PTEXTSIZE.y = tm.tmHeight; /* but seems to be a problem on Win9X so */ - /* assume proportional fonts always for Win9X */ - - if (pWindowData->fontWidth < 0 || s_pWvwData->s_sApp->Win9X || ( tm.tmPitchAndFamily & TMPF_FIXED_PITCH ) || ( pWindowData->PTEXTSIZE.x != tm.tmMaxCharWidth ) ) - { - - pWindowData->FixedFont = FALSE; - } - else - { - pWindowData->FixedFont = TRUE ; - } - - for( n=0 ; n< pWindowData->COLS ; n++ ) /* pWindowData->FixedSize[] is used by ExtTextOut() to emulate */ - { /* fixed font when a proportional font is used */ - pWindowData->FixedSize[ n ] = pWindowData->PTEXTSIZE.x; - } - - if ( IsZoomed( pWindowData->hWnd ) ) - { - - if ( SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 ) ) - { - wi.top = rcWorkArea.top; - wi.left = rcWorkArea.left; - wi.bottom = rcWorkArea.bottom; - wi.right = rcWorkArea.right; - } - else - { - GetWindowRect( hWnd, &wi ); - } - - height = ((USHORT)(LONG)(wi.bottom)) - ((USHORT)(LONG)(wi.top)) + 1; - width = ((USHORT)(LONG)(wi.right)) - ((USHORT)(LONG)(wi.left)) + 1; - - } - - else if (pWindowData->byWinId==0) - { - /* resize the window to get the specified number of rows and columns - */ - height = hb_gt_wvwCalcPixelHeight( pWindowData ); - width = hb_gt_wvwCalcPixelWidth( pWindowData ); - - GetWindowRect( hWnd, &wi ); - GetClientRect( hWnd, &ci ); - - diffWidth = (SHORT) (( wi.right - wi.left ) - ( ci.right )); - diffHeight = (SHORT) (( wi.bottom - wi.top ) - ( ci.bottom )); - width += diffWidth ; - height += diffHeight; - - /* Centre the window within the CLIENT area on the screen - * but only if pWindowData->CentreWindow == TRUE - */ - - /* - if ( pWindowData->CentreWindow && SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 ) ) - { - wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right-rcWorkArea.left ) - ( width ) ) / 2 ) ; - wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom-rcWorkArea.top ) - ( height ) ) / 2 ) ; - } + /* we will need to use the font size to handle the transformations from + * row column space in the future, so we keep it around in a static! */ - if ( SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 ) ) - { - if ( pWindowData->CentreWindow ) + pWindowData->PTEXTSIZE.x = pWindowData->fontWidth < 0 ? -pWindowData->fontWidth : tm.tmAveCharWidth; /* For fixed FONT should == tm.tmMaxCharWidth */ + pWindowData->PTEXTSIZE.y = tm.tmHeight; /* but seems to be a problem on Win9X so */ + /* assume proportional fonts always for Win9X */ + + if( pWindowData->fontWidth < 0 || s_pWvwData->s_sApp->Win9X || ( tm.tmPitchAndFamily & TMPF_FIXED_PITCH ) || ( pWindowData->PTEXTSIZE.x != tm.tmMaxCharWidth ) ) + { + + pWindowData->FixedFont = FALSE; + } + else + { + pWindowData->FixedFont = TRUE; + } + + for( n = 0; n < pWindowData->COLS; n++ ) /* pWindowData->FixedSize[] is used by ExtTextOut() to emulate */ + { /* fixed font when a proportional font is used */ + pWindowData->FixedSize[ n ] = pWindowData->PTEXTSIZE.x; + } + + if( IsZoomed( pWindowData->hWnd ) ) + { + + if( SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 ) ) { - wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right-rcWorkArea.left ) - ( width ) ) / 2 ) ; - wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom-rcWorkArea.top ) - ( height ) ) / 2 ) ; + wi.top = rcWorkArea.top; + wi.left = rcWorkArea.left; + wi.bottom = rcWorkArea.bottom; + wi.right = rcWorkArea.right; } else { - if ( pWindowData->HCentreWindow ) - { - wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right-rcWorkArea.left ) - ( width ) ) / 2 ) ; - } - if ( pWindowData->VCentreWindow ) - { - wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom-rcWorkArea.top ) - ( height ) ) / 2 ) ; - } + GetWindowRect( hWnd, &wi ); } - } - } - else - { + height = ( ( USHORT ) ( LONG ) ( wi.bottom ) ) - ( ( USHORT ) ( LONG ) ( wi.top ) ) + 1; + width = ( ( USHORT ) ( LONG ) ( wi.right ) ) - ( ( USHORT ) ( LONG ) ( wi.left ) ) + 1; - /* resize the window to get the specified number of rows and columns - */ - height = hb_gt_wvwCalcPixelHeight( pWindowData ); - width = hb_gt_wvwCalcPixelWidth( pWindowData ); + } + else if( pWindowData->byWinId == 0 ) + { + /* resize the window to get the specified number of rows and columns + */ + height = hb_gt_wvwCalcPixelHeight( pWindowData ); + width = hb_gt_wvwCalcPixelWidth( pWindowData ); - GetWindowRect( hWnd, &wi ); - GetClientRect( hWnd, &ci ); + GetWindowRect( hWnd, &wi ); + GetClientRect( hWnd, &ci ); - diffWidth = (SHORT) (( wi.right - wi.left ) - ( ci.right )); - diffHeight = (SHORT) (( wi.bottom - wi.top ) - ( ci.bottom )); - width += diffWidth ; - height += diffHeight; + diffWidth = ( SHORT ) ( ( wi.right - wi.left ) - ( ci.right ) ); + diffHeight = ( SHORT ) ( ( wi.bottom - wi.top ) - ( ci.bottom ) ); + width += diffWidth; + height += diffHeight; - /* Centre the window within the area of the MAIN WINDOW - * but only if pWindowData->CentreWindow == TRUE - */ - GetWindowRect( (*pMainWindow).hWnd, &rcWorkArea); - GetClientRect( (*pMainWindow).hWnd, &rcMainClientArea); + /* Centre the window within the CLIENT area on the screen + * but only if pWindowData->CentreWindow == TRUE + */ - if ( pWindowData->CentreWindow ) - { - wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right-rcWorkArea.left ) - ( width ) ) / 2 ) ; - wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom-rcWorkArea.top ) - ( height ) ) / 2 ) ; - } - else - { + /* + if ( pWindowData->CentreWindow && SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 ) ) + { + wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right-rcWorkArea.left ) - ( width ) ) / 2 ) ; + wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom-rcWorkArea.top ) - ( height ) ) / 2 ) ; + } + */ - if ( pWindowData->HCentreWindow ) + if( SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 ) ) { - wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right-rcWorkArea.left ) - ( width ) ) / 2 ) ; + if( pWindowData->CentreWindow ) + { + wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right - rcWorkArea.left ) - ( width ) ) / 2 ); + wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom - rcWorkArea.top ) - ( height ) ) / 2 ); + } + else + { + if( pWindowData->HCentreWindow ) + { + wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right - rcWorkArea.left ) - ( width ) ) / 2 ); + } + if( pWindowData->VCentreWindow ) + { + wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom - rcWorkArea.top ) - ( height ) ) / 2 ); + } + } + } + + } + else + { + + /* resize the window to get the specified number of rows and columns + */ + height = hb_gt_wvwCalcPixelHeight( pWindowData ); + width = hb_gt_wvwCalcPixelWidth( pWindowData ); + + GetWindowRect( hWnd, &wi ); + GetClientRect( hWnd, &ci ); + + diffWidth = ( SHORT ) ( ( wi.right - wi.left ) - ( ci.right ) ); + diffHeight = ( SHORT ) ( ( wi.bottom - wi.top ) - ( ci.bottom ) ); + width += diffWidth; + height += diffHeight; + + /* Centre the window within the area of the MAIN WINDOW + * but only if pWindowData->CentreWindow == TRUE + */ + GetWindowRect( ( *pMainWindow ).hWnd, &rcWorkArea ); + GetClientRect( ( *pMainWindow ).hWnd, &rcMainClientArea ); + + if( pWindowData->CentreWindow ) + { + wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right - rcWorkArea.left ) - ( width ) ) / 2 ); + wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom - rcWorkArea.top ) - ( height ) ) / 2 ); } else { - wi.left = rcWorkArea.left + ( pWindowData->usColOfs * (*pMainWindow).PTEXTSIZE.x ); + if( pWindowData->HCentreWindow ) + { + wi.left = rcWorkArea.left + ( ( ( rcWorkArea.right - rcWorkArea.left ) - ( width ) ) / 2 ); + } + else + { + + wi.left = rcWorkArea.left + ( pWindowData->usColOfs * ( *pMainWindow ).PTEXTSIZE.x ); + } + + if( pWindowData->VCentreWindow ) + { + wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom - rcWorkArea.top ) - ( height ) ) / 2 ); + } + else + { + + wi.top = rcWorkArea.top + ( pWindowData->usRowOfs * hb_wvw_LineHeight( pMainWindow ) ); + + wi.top -= diffHeight; + + wi.top += ( ( rcWorkArea.bottom - rcWorkArea.top ) - ( rcMainClientArea.bottom ) ); + + wi.top += ( *pMainWindow ).usTBHeight; + + wi.top -= ( *pWindowData ).usTBHeight; + } } - if ( pWindowData->VCentreWindow ) - { - wi.top = rcWorkArea.top + ( ( ( rcWorkArea.bottom-rcWorkArea.top ) - ( height ) ) / 2 ) ; - } - else - { + } - wi.top = rcWorkArea.top + ( pWindowData->usRowOfs * hb_wvw_LineHeight( pMainWindow ) ); + if( ! IsZoomed( hWnd ) ) + { - wi.top -= diffHeight; + SetWindowPos( hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER ); + } + else + { - wi.top += (( rcWorkArea.bottom - rcWorkArea.top ) - ( rcMainClientArea.bottom )); + SetWindowPos( hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER ); - wi.top += (*pMainWindow).usTBHeight; + InvalidateRect( hWnd, NULL, FALSE ); + } - wi.top -= (*pWindowData).usTBHeight; - } - } + if( pWindowData->hStatusBar != NULL ) + { + SetWindowPos( pWindowData->hStatusBar, NULL, wi.left, wi.bottom - pWindowData->usSBHeight, width, pWindowData->usSBHeight, SWP_NOZORDER ); - } + } - if ( !IsZoomed( hWnd ) ) - { + if( pWindowData->hToolBar != NULL ) + { - SetWindowPos( hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER ); - } - else - { + SetWindowPos( pWindowData->hToolBar, NULL, wi.left, wi.top - pWindowData->usTBHeight, width, pWindowData->usTBHeight, SWP_NOZORDER ); - SetWindowPos( hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER ); + } - InvalidateRect( hWnd, NULL, FALSE ); - } + if( pWindowData->pcdCtrlList != NULL ) + { - if (pWindowData->hStatusBar != NULL) - { - SetWindowPos( pWindowData->hStatusBar, NULL, wi.left, wi.bottom - pWindowData->usSBHeight, width, pWindowData->usSBHeight, SWP_NOZORDER ); + ReposControls( pWindowData->byWinId, 0 ); + } - } + if( pWindowData->byWinId == s_pWvwData->s_usNumWindows - 1 ) + { + hb_gt_wvwSetCaretPos( pWindowData ); + } - if (pWindowData->hToolBar != NULL) - { - - SetWindowPos( pWindowData->hToolBar, NULL, wi.left, wi.top - pWindowData->usTBHeight, width, pWindowData->usTBHeight, SWP_NOZORDER ); - - } - - if (pWindowData->pcdCtrlList != NULL) - { - - ReposControls(pWindowData->byWinId, 0); - } - - if (pWindowData->byWinId == s_pWvwData->s_usNumWindows-1) - { - hb_gt_wvwSetCaretPos(pWindowData); - } - - if (pWindowData->byWinId == 0) - { - HB_GTSELF_RESIZE( hb_gt_Base(), pWindowData->ROWS, pWindowData->COLS ); - } + if( pWindowData->byWinId == 0 ) + { + HB_GTSELF_RESIZE( hb_gt_Base(), pWindowData->ROWS, pWindowData->COLS ); + } } @@ -2828,12 +2797,12 @@ static void hb_gt_wvwResetWindowSize( WIN_DATA * pWindowData, HWND hWnd ) static int hb_wvw_key_ansi_to_oem( int c ) { - char pszAnsi[4]; - char pszOem[4]; + char pszAnsi[ 4 ]; + char pszOem[ 4 ]; sprintf( pszAnsi, "%c", c ); CharToOemBuff( ( LPCSTR ) pszAnsi, ( LPTSTR ) pszOem, 1 ); - c = (BYTE) * pszOem; + c = ( BYTE ) *pszOem; return c; } @@ -2842,79 +2811,81 @@ static int hb_wvw_key_ansi_to_oem( int c ) static void xUserPaintNow( UINT usWinNum ) { - static BOOL bRunning = FALSE; + static BOOL bRunning = FALSE; - /*make sure we don't execute it > 1 time - *eg. if s_pWvwData->s_uiPaintRefresh is too small - */ - if (bRunning) return; + /*make sure we don't execute it > 1 time + *eg. if s_pWvwData->s_uiPaintRefresh is too small + */ + if( bRunning ) + return; - bRunning = TRUE; + bRunning = TRUE; - s_pWvwData->s_pWindows[usWinNum]->bPaintPending = FALSE; + s_pWvwData->s_pWindows[ usWinNum ]->bPaintPending = FALSE; - if (s_pWvwData->s_sApp->pSymWVW_PAINT ) - { - if( hb_vmRequestReenter() ) - { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_PAINT ); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (usWinNum) ); + if( s_pWvwData->s_sApp->pSymWVW_PAINT ) + { + if( hb_vmRequestReenter() ) + { + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_PAINT ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( usWinNum ) ); - /* follow WVT convention to not passing coordinates anymore - hb_vmPushInteger( ( int ) (rpaint.top) ); - hb_vmPushInteger( ( int ) (rpaint.left) ); - hb_vmPushInteger( ( int ) (rpaint.bottom) ); - hb_vmPushInteger( ( int ) (rpaint.right) ); - hb_vmDo( 5 ); - */ + /* follow WVT convention to not passing coordinates anymore + hb_vmPushInteger( ( int ) (rpaint.top) ); + hb_vmPushInteger( ( int ) (rpaint.left) ); + hb_vmPushInteger( ( int ) (rpaint.bottom) ); + hb_vmPushInteger( ( int ) (rpaint.right) ); + hb_vmDo( 5 ); + */ - hb_vmDo( 1 ); + hb_vmDo( 1 ); - hb_vmRequestRestore(); - } - } + hb_vmRequestRestore(); + } + } - if ( !s_pWvwData->s_pWindows[usWinNum]->bPaintPending ) - { - hb_wvw_InitPendingRect( s_pWvwData->s_pWindows[ usWinNum ] ); - } + if( ! s_pWvwData->s_pWindows[ usWinNum ]->bPaintPending ) + { + hb_wvw_InitPendingRect( s_pWvwData->s_pWindows[ usWinNum ] ); + } - bRunning = FALSE; + bRunning = FALSE; } static void xUserTimerNow( UINT usWinNum, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - static BOOL bRunning = FALSE; + static BOOL bRunning = FALSE; - /*make sure we don't execute it > 1 time - *eg. if timer interval is too small - *the call will be lost in this case - */ - if (bRunning) return; + /*make sure we don't execute it > 1 time + *eg. if timer interval is too small + *the call will be lost in this case + */ + if( bRunning ) + return; - bRunning = TRUE; + bRunning = TRUE; - if ( s_pWvwData->s_sApp->pSymWVW_TIMER ) - { - if( hb_vmRequestReenter() ) - { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_TIMER); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (usWinNum) ); - hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); - hb_vmPushNumInt( message ); - hb_vmPushNumInt( wParam ); - hb_vmPushNumInt( lParam ); - hb_vmDo( 5 ); + if( s_pWvwData->s_sApp->pSymWVW_TIMER ) + { + if( hb_vmRequestReenter() ) + { + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_TIMER ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( usWinNum ) ); + hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); + hb_vmPushNumInt( message ); + hb_vmPushNumInt( wParam ); + hb_vmPushNumInt( lParam ); + hb_vmDo( 5 ); - hb_vmRequestRestore(); - } - } + hb_vmRequestRestore(); + } + } - bRunning = FALSE; + bRunning = FALSE; } @@ -2922,1236 +2893,1199 @@ static void xUserTimerNow( UINT usWinNum, HWND hWnd, UINT message, WPARAM wParam static LRESULT CALLBACK hb_gt_wvwWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - BOOL bRet; - long int res; + BOOL bRet; + long int res; - UINT usWinNum; - WIN_DATA * pWindowData; + UINT usWinNum; + WIN_DATA * pWindowData; - for(usWinNum=0; usWinNums_usNumWindows; usWinNum++) - { - if (s_pWvwData->s_pWindows[usWinNum]->hWnd == hWnd) - { - break; - } - } - - if(usWinNum>=s_pWvwData->s_usNumWindows) - { - - usWinNum = s_pWvwData->s_usNumWindows-1; - } - - pWindowData = s_pWvwData->s_pWindows[usWinNum]; - - switch ( message ) - { - case WM_CREATE: - { - - bRet = hb_gt_wvwInitWindow( pWindowData, hWnd, pWindowData->COLS, pWindowData->ROWS ); - - return( bRet ); - } - - case WM_COMMAND: /* handle menu items */ - { - - BOOL bTopMost = (s_pWvwData->s_usNumWindows==usWinNum+1); - int iEvent = (int) HIWORD(wParam); - int iId = (int) LOWORD(wParam); - - if (iId < WVW_ID_BASE_PUSHBUTTON ) + for( usWinNum = 0; usWinNum < s_pWvwData->s_usNumWindows; usWinNum++ ) + { + if( s_pWvwData->s_pWindows[ usWinNum ]->hWnd == hWnd ) { - - if (bTopMost || s_pWvwData->s_bAllowNonTop) - { - hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); - } - else - { - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - } + break; } + } - else - if (iId <= WVW_ID_MAX_PUSHBUTTON) - { - if (bTopMost || s_pWvwData->s_bAllowNonTop) - { + if( usWinNum >= s_pWvwData->s_usNumWindows ) + { - HWND hWndCtrl = (HWND) lParam; - UINT uiPBid; - byte bStyle; + usWinNum = s_pWvwData->s_usNumWindows - 1; + } - uiPBid = (UINT) FindControlId (usWinNum, WVW_CONTROL_PUSHBUTTON, hWndCtrl, &bStyle) ; - if (uiPBid==0) - { + pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; - hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); + switch( message ) + { + case WM_CREATE: - return(0); - } + bRet = hb_gt_wvwInitWindow( pWindowData, hWnd, pWindowData->COLS, pWindowData->ROWS ); - RunControlBlock(usWinNum, WVW_CONTROL_PUSHBUTTON, hWndCtrl, message, wParam, lParam, 0 ); + return bRet; - return 0 ; - } /* button click */ - else - { - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - } - } - - else - if (iId <= WVW_ID_MAX_COMBOBOX) + case WM_COMMAND: /* handle menu items */ { - /* - int lowordwParam = (int) LOWORD(wParam); - int hiwordwParam = (int) HIWORD(wParam); - int lowordlParam = (int) LOWORD(lParam); - int hiwordlParam = (int) HIWORD(lParam); - HWND hWndCtrl = (HWND) lParam; + BOOL bTopMost = ( s_pWvwData->s_usNumWindows == usWinNum + 1 ); + int iEvent = ( int ) HIWORD( wParam ); + int iId = ( int ) LOWORD( wParam ); - TraceLog( NULL, "debugging: WM_COMMAND is processed?\n" ); - TraceLog( NULL, " lowordwParam (control id)=%i\n", lowordwParam ); - TraceLog( NULL, " hiwordwParam (notification)=%i\n", hiwordwParam ); - TraceLog( NULL, " lowordlParam=%i\n", lowordlParam ); - TraceLog( NULL, " hiwordlParam=%i\n", hiwordlParam ); - */ + if( iId < WVW_ID_BASE_PUSHBUTTON ) + { - switch( iEvent ) - { - - case CBN_SELCHANGE: - case CBN_SETFOCUS: - case CBN_KILLFOCUS: - { - - if ((iEvent==CBN_KILLFOCUS) || bTopMost || s_pWvwData->s_bAllowNonTop) + if( bTopMost || s_pWvwData->s_bAllowNonTop ) { - - HWND hWndCtrl = (HWND) lParam; - UINT uiCBid; - byte bStyle; - - uiCBid = (UINT) FindControlId (usWinNum, WVW_CONTROL_COMBOBOX, hWndCtrl, &bStyle) ; - if (uiCBid==0) - { - - hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); - - return(0); - } - - RunControlBlock(usWinNum, WVW_CONTROL_COMBOBOX, hWndCtrl, message, wParam, lParam, (int) iEvent); - - return 0 ; + hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); } else { - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - if (iEvent==CBN_SETFOCUS) - { - - SetFocus(s_pWvwData->s_pWindows[s_pWvwData->s_usNumWindows-1]->hWnd); - } + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); } - } - } - - return 1; - } /* combobox */ - - else - if (iId <= WVW_ID_MAX_EDITBOX) - { - - /* - int lowordwParam = (int) LOWORD(wParam); - int hiwordwParam = (int) HIWORD(wParam); - int lowordlParam = (int) LOWORD(lParam); - int hiwordlParam = (int) HIWORD(lParam); - HWND hWndCtrl = (HWND) lParam; - - TraceLog( NULL, "debugging: WM_COMMAND is processed?\n" ); - TraceLog( NULL, " lowordwParam (control id)=%i\n", lowordwParam ); - TraceLog( NULL, " hiwordwParam (notification)=%i\n", hiwordwParam ); - TraceLog( NULL, " lowordlParam=%i\n", lowordlParam ); - TraceLog( NULL, " hiwordlParam=%i\n", hiwordlParam ); - */ - - switch( iEvent ) - { - case EN_SETFOCUS: - case EN_KILLFOCUS: - case EN_CHANGE: - { - - if ((iEvent==EN_KILLFOCUS) || bTopMost || s_pWvwData->s_bAllowNonTop) + } + else + if( iId <= WVW_ID_MAX_PUSHBUTTON ) + { + if( bTopMost || s_pWvwData->s_bAllowNonTop ) { - HWND hWndCtrl = (HWND) lParam; - UINT uiEBid; - byte bStyle; + HWND hWndCtrl = ( HWND ) lParam; + UINT uiPBid; + byte bStyle; - uiEBid = (UINT) FindControlId (usWinNum, WVW_CONTROL_EDITBOX, hWndCtrl, &bStyle) ; - if (uiEBid==0) - { + uiPBid = ( UINT ) FindControlId( usWinNum, WVW_CONTROL_PUSHBUTTON, hWndCtrl, &bStyle ); + if( uiPBid == 0 ) + { - hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); + hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); - return(0); - } + return 0; + } - RunControlBlock(usWinNum, WVW_CONTROL_EDITBOX, hWndCtrl, message, wParam, lParam, (int) iEvent); + RunControlBlock( usWinNum, WVW_CONTROL_PUSHBUTTON, hWndCtrl, message, wParam, lParam, 0 ); - return 0 ; - } + return 0; + } /* button click */ else { - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - if (iEvent==EN_SETFOCUS) - { - - SetFocus(s_pWvwData->s_pWindows[s_pWvwData->s_usNumWindows-1]->hWnd); - } + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); } - } - } + } + else + if( iId <= WVW_ID_MAX_COMBOBOX ) + { - return 1; - } /* editbox */ + /* + int lowordwParam = (int) LOWORD(wParam); + int hiwordwParam = (int) HIWORD(wParam); + int lowordlParam = (int) LOWORD(lParam); + int hiwordlParam = (int) HIWORD(lParam); + HWND hWndCtrl = (HWND) lParam; - return( 0 ); - } + TraceLog( NULL, "debugging: WM_COMMAND is processed?\n" ); + TraceLog( NULL, " lowordwParam (control id)=%i\n", lowordwParam ); + TraceLog( NULL, " hiwordwParam (notification)=%i\n", hiwordwParam ); + TraceLog( NULL, " lowordlParam=%i\n", lowordlParam ); + TraceLog( NULL, " hiwordlParam=%i\n", hiwordlParam ); + */ - case WM_MENUSELECT: - { - if ( s_pWvwData->s_sApp->pSymWVW_MENUSELECT ) - { - if( hb_vmRequestReenter() ) - { + switch( iEvent ) + { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_MENUSELECT ); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (usWinNum) ); - hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); - hb_vmPushNumInt( message ); - hb_vmPushNumInt( wParam ); - hb_vmPushNumInt( lParam ); - hb_vmDo( 5 ); + case CBN_SELCHANGE: + case CBN_SETFOCUS: + case CBN_KILLFOCUS: - hb_vmRequestRestore(); - } + if( ( iEvent == CBN_KILLFOCUS ) || bTopMost || s_pWvwData->s_bAllowNonTop ) + { + HWND hWndCtrl = ( HWND ) lParam; + UINT uiCBid; + byte bStyle; + uiCBid = ( UINT ) FindControlId( usWinNum, WVW_CONTROL_COMBOBOX, hWndCtrl, &bStyle ); + if( uiCBid == 0 ) + { + + hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); + + return 0; + } + + RunControlBlock( usWinNum, WVW_CONTROL_COMBOBOX, hWndCtrl, message, wParam, lParam, ( int ) iEvent ); + + return 0; + } + else + { + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); + if( iEvent == CBN_SETFOCUS ) + { + + SetFocus( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hWnd ); + } + } + } + + return 1; + } /* combobox */ + else + if( iId <= WVW_ID_MAX_EDITBOX ) + { + + /* + int lowordwParam = (int) LOWORD(wParam); + int hiwordwParam = (int) HIWORD(wParam); + int lowordlParam = (int) LOWORD(lParam); + int hiwordlParam = (int) HIWORD(lParam); + HWND hWndCtrl = (HWND) lParam; + + TraceLog( NULL, "debugging: WM_COMMAND is processed?\n" ); + TraceLog( NULL, " lowordwParam (control id)=%i\n", lowordwParam ); + TraceLog( NULL, " hiwordwParam (notification)=%i\n", hiwordwParam ); + TraceLog( NULL, " lowordlParam=%i\n", lowordlParam ); + TraceLog( NULL, " hiwordlParam=%i\n", hiwordlParam ); + */ + + switch( iEvent ) + { + case EN_SETFOCUS: + case EN_KILLFOCUS: + case EN_CHANGE: + + if( ( iEvent == EN_KILLFOCUS ) || bTopMost || s_pWvwData->s_bAllowNonTop ) + { + + HWND hWndCtrl = ( HWND ) lParam; + UINT uiEBid; + byte bStyle; + + uiEBid = ( UINT ) FindControlId( usWinNum, WVW_CONTROL_EDITBOX, hWndCtrl, &bStyle ); + if( uiEBid == 0 ) + { + + hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); + + return 0; + } + + RunControlBlock( usWinNum, WVW_CONTROL_EDITBOX, hWndCtrl, message, wParam, lParam, ( int ) iEvent ); + + return 0; + } + else + { + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); + if( iEvent == EN_SETFOCUS ) + { + + SetFocus( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hWnd ); + } + } + } + + return 1; + } /* editbox */ + + return 0; } - return( 0 ); - } - case WM_PAINT: - { - PAINTSTRUCT ps = { 0 }; - HDC hdc; - USHORT irow; - RECT updateRect = { 0 }, rcRect = { 0 }; + case WM_MENUSELECT: + if( s_pWvwData->s_sApp->pSymWVW_MENUSELECT ) + { + if( hb_vmRequestReenter() ) + { - RECT ci = { 0 }; - int ixbeyond; - int iybeyond; - BOOL bR = FALSE, bB = FALSE; - int colStart = 0 , colStop = 0, rowStart = 0, rowStop = 0; - HFONT hOldFont; + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_MENUSELECT ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( usWinNum ) ); + hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); + hb_vmPushNumInt( message ); + hb_vmPushNumInt( wParam ); + hb_vmPushNumInt( lParam ); + hb_vmDo( 5 ); - GetUpdateRect( hWnd, &updateRect, FALSE ); - /* WARNING!!! - * the GetUpdateRect call MUST be made BEFORE the BeginPaint call, since - * BeginPaint resets the update rectangle - don't move it or nothing is drawn! - */ + hb_vmRequestRestore(); + } - /* 20050625 TODO: MSDN says app should NOT call BeginPaint if GetUpdateRect returns zero */ - hdc = BeginPaint( hWnd, &ps ); + } + return 0; - hOldFont = (HFONT) SelectObject( hdc, pWindowData->hFont ); - - ixbeyond = pWindowData->COLS * pWindowData->PTEXTSIZE.x; - - iybeyond = hb_wvw_LineHeight( pWindowData )*pWindowData->ROWS + - pWindowData->usTBHeight; - - if ( updateRect.left > ixbeyond || updateRect.top > iybeyond ) + case WM_PAINT: { - /* do nothing now, will be handled later */ + PAINTSTRUCT ps = { 0 }; + HDC hdc; + USHORT irow; + RECT updateRect = { 0 }, rcRect = { 0 }; - } - else - { + RECT ci = { 0 }; + int ixbeyond; + int iybeyond; + BOOL bR = FALSE, bB = FALSE; + int colStart = 0, colStop = 0, rowStart = 0, rowStop = 0; + HFONT hOldFont; - /* - * using the update rect, determine which rows and columns of text - * to paint, and do so - */ - - if ( pWindowData->pBuffer != NULL && pWindowData->pColors != NULL ) - { - - /* need to account for truncation in conversion - * i.e. redraw any 'cell' partially covered... - */ - rcRect = hb_gt_wvwGetColRowFromXYRect( pWindowData, updateRect ); - - /* - WVT uses global vars as follows: - - _s.rowStart = max( 0, rcRect.top-1 ); - _s.rowStop = min( _s.ROWS, rcRect.bottom+1 ); - _s.colStart = max( 0, rcRect.left -1 ); - _s.colStop = min( _s.COLS, rcRect.right+1 ); - - WVW can't do that way, because we use TIMER method to repaint - WVW's pending repaint rect is stored in rPaintPending + GetUpdateRect( hWnd, &updateRect, FALSE ); + /* WARNING!!! + * the GetUpdateRect call MUST be made BEFORE the BeginPaint call, since + * BeginPaint resets the update rectangle - don't move it or nothing is drawn! */ - rowStart = max( 0, rcRect.top ); + /* 20050625 TODO: MSDN says app should NOT call BeginPaint if GetUpdateRect returns zero */ - rowStop = min( pWindowData->ROWS-1, rcRect.bottom ); + hdc = BeginPaint( hWnd, &ps ); - colStart = rcRect.left; - colStop = rcRect.right; + hOldFont = ( HFONT ) SelectObject( hdc, pWindowData->hFont ); - for ( irow = (USHORT)rowStart; irow <= (USHORT)rowStop; irow++ ) - { - USHORT icol, index, startIndex, startCol, len; - BYTE oldColor, color; + ixbeyond = pWindowData->COLS * pWindowData->PTEXTSIZE.x; - icol = (USHORT)colStart; - index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, icol, irow ); - startIndex = index; - startCol = icol; - len = 0; - oldColor = *( pWindowData->pColors+index ); + iybeyond = hb_wvw_LineHeight( pWindowData ) * pWindowData->ROWS + + pWindowData->usTBHeight; - /* colorute may change mid line... - * so buffer up text with same color, and output it - * then do next section with same color, etc - */ + if( updateRect.left > ixbeyond || updateRect.top > iybeyond ) + { + /* do nothing now, will be handled later */ - while ( icol <= colStop ) + } + else + { + + /* + * using the update rect, determine which rows and columns of text + * to paint, and do so + */ + + if( pWindowData->pBuffer != NULL && pWindowData->pColors != NULL ) { - if ( index >= pWindowData->BUFFERSIZE ) - { - break; - } - color = *( pWindowData->pColors+index ); - if ( color != oldColor ) - { - hb_gt_wvwSetColors( pWindowData, hdc, oldColor ); - hb_gt_wvwTextOut( pWindowData, hdc, startCol, irow, ( char const * ) pWindowData->pBuffer+startIndex, len ); - if (pWindowData->byLineSpacing > 0) - { - hb_gt_wvwFillLineSpace( pWindowData, hdc, startCol, irow, len, oldColor ); - } + /* need to account for truncation in conversion + * i.e. redraw any 'cell' partially covered... + */ + rcRect = hb_gt_wvwGetColRowFromXYRect( pWindowData, updateRect ); - oldColor = color; - startIndex = index; - startCol = icol; - len = 0; + /* + WVT uses global vars as follows: + + _s.rowStart = max( 0, rcRect.top-1 ); + _s.rowStop = min( _s.ROWS, rcRect.bottom+1 ); + _s.colStart = max( 0, rcRect.left -1 ); + _s.colStop = min( _s.COLS, rcRect.right+1 ); + + WVW can't do that way, because we use TIMER method to repaint + WVW's pending repaint rect is stored in rPaintPending + */ + + rowStart = max( 0, rcRect.top ); + + rowStop = min( pWindowData->ROWS - 1, rcRect.bottom ); + + colStart = rcRect.left; + colStop = rcRect.right; + + for( irow = ( USHORT ) rowStart; irow <= ( USHORT ) rowStop; irow++ ) + { + USHORT icol, index, startIndex, startCol, len; + BYTE oldColor, color; + + icol = ( USHORT ) colStart; + index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, icol, irow ); + startIndex = index; + startCol = icol; + len = 0; + oldColor = *( pWindowData->pColors + index ); + + /* colorute may change mid line... + * so buffer up text with same color, and output it + * then do next section with same color, etc + */ + + while( icol <= colStop ) + { + if( index >= pWindowData->BUFFERSIZE ) + { + break; + } + color = *( pWindowData->pColors + index ); + if( color != oldColor ) + { + hb_gt_wvwSetColors( pWindowData, hdc, oldColor ); + hb_gt_wvwTextOut( pWindowData, hdc, startCol, irow, ( char const * ) pWindowData->pBuffer + startIndex, len ); + + if( pWindowData->byLineSpacing > 0 ) + { + hb_gt_wvwFillLineSpace( pWindowData, hdc, startCol, irow, len, oldColor ); + } + + oldColor = color; + startIndex = index; + startCol = icol; + len = 0; + + } + icol++; + len++; + index++; + } + + hb_gt_wvwSetColors( pWindowData, hdc, oldColor ); + hb_gt_wvwTextOut( pWindowData, hdc, startCol, irow, ( char const * ) pWindowData->pBuffer + startIndex, len ); + + if( pWindowData->byLineSpacing > 0 ) + { + hb_gt_wvwFillLineSpace( pWindowData, hdc, startCol, irow, len, oldColor ); + } + } + } + } + + /* Here we must also paint the unreachable region on the right, if any. + This beyond reach area is due to Min/Max/Close button on + a small window + OR + unreached area due to MAXIMIZED mode + */ + + if( updateRect.right == ixbeyond ) + { + + GetClientRect( hWnd, &ci ); + + if( ci.right > ixbeyond ) + { + rcRect.left = ixbeyond; + rcRect.top = updateRect.top; + rcRect.right = ci.right; + rcRect.bottom = updateRect.bottom; + + InvalidateRect( hWnd, &rcRect, FALSE ); + + bR = TRUE; - } - icol++; - len++; - index++; } - hb_gt_wvwSetColors( pWindowData, hdc, oldColor ); - hb_gt_wvwTextOut( pWindowData, hdc, startCol, irow, ( char const * ) pWindowData->pBuffer+startIndex, len ); + } + else if( updateRect.right > ixbeyond ) + { - if (pWindowData->byLineSpacing > 0) + LOGBRUSH lb = { 0 }; + HBRUSH hBrush; + + COLORREF bkColor = _COLORS[ pWindowData->byColors[ 0 ] >> 4 ]; + + rcRect.left = max( ixbeyond, updateRect.left ); + rcRect.top = updateRect.top; + rcRect.right = updateRect.right; + rcRect.bottom = updateRect.bottom; + + lb.lbStyle = BS_SOLID; + lb.lbColor = bkColor; + lb.lbHatch = 0; + + hBrush = CreateBrushIndirect( &lb ); + + FillRect( hdc, &rcRect, hBrush ); + + SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HBRUSH ) s_pWvwData->s_sApp->OriginalBrush ); + DeleteObject( hBrush ); + } + + if( IsZoomed( hWnd ) ) + { + + if( updateRect.bottom == iybeyond ) { - hb_gt_wvwFillLineSpace( pWindowData, hdc, startCol, irow, len, oldColor ); + + GetClientRect( hWnd, &ci ); + + if( ci.bottom > iybeyond ) + { + rcRect.left = updateRect.left; + rcRect.top = iybeyond; + rcRect.right = updateRect.right; + rcRect.bottom = ci.bottom; + + InvalidateRect( hWnd, &rcRect, FALSE ); + bB = TRUE; + } + } - } - } - } + /* Here we must also paint the unreachable region on the bottom, if any. + This beyond reach area is due to MAXIMIZED state of + a small window */ + else if( updateRect.bottom > iybeyond ) + { - /* Here we must also paint the unreachable region on the right, if any. - This beyond reach area is due to Min/Max/Close button on - a small window - OR - unreached area due to MAXIMIZED mode - */ + LOGBRUSH lb = { 0 }; + HBRUSH hBrush; - if ( updateRect.right == ixbeyond ) - { + COLORREF bkColor = _COLORS[ pWindowData->byColors[ 0 ] >> 4 ]; - GetClientRect( hWnd, &ci ); + rcRect.left = updateRect.left; + rcRect.top = max( iybeyond, updateRect.top ); + rcRect.right = updateRect.right; + rcRect.bottom = updateRect.bottom; - if (ci.right > ixbeyond) - { - rcRect.left = ixbeyond; - rcRect.top = updateRect.top; - rcRect.right = ci.right; - rcRect.bottom = updateRect.bottom; + lb.lbStyle = BS_SOLID; + lb.lbColor = bkColor; + lb.lbHatch = 0; - InvalidateRect( hWnd, &rcRect, FALSE ); + hBrush = CreateBrushIndirect( &lb ); - bR = TRUE; + FillRect( hdc, &rcRect, hBrush ); - } + SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HBRUSH ) s_pWvwData->s_sApp->OriginalBrush ); + DeleteObject( hBrush ); + } - } + if( bR && bB ) + { - else if ( updateRect.right > ixbeyond ) - { + rcRect.left = ixbeyond; + rcRect.top = iybeyond; + rcRect.right = ci.right; + rcRect.bottom = ci.bottom; - LOGBRUSH lb = { 0 }; - HBRUSH hBrush; + InvalidateRect( hWnd, &rcRect, FALSE ); - COLORREF bkColor = _COLORS[ pWindowData->byColors[0] >> 4 ]; - - rcRect.left = max( ixbeyond, updateRect.left ); - rcRect.top = updateRect.top; - rcRect.right = updateRect.right; - rcRect.bottom = updateRect.bottom; - - lb.lbStyle = BS_SOLID; - lb.lbColor = bkColor; - lb.lbHatch = 0; - - hBrush = CreateBrushIndirect( &lb ); - - FillRect( hdc, &rcRect, hBrush ); - - SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HBRUSH) s_pWvwData->s_sApp->OriginalBrush ); - DeleteObject( hBrush ); - } - - if (IsZoomed(hWnd)) - { - - if ( updateRect.bottom == iybeyond ) - { - - GetClientRect( hWnd, &ci ); - - if (ci.bottom > iybeyond) - { - rcRect.left = updateRect.left; - rcRect.top = iybeyond; - rcRect.right = updateRect.right; - rcRect.bottom = ci.bottom; - - InvalidateRect( hWnd, &rcRect, FALSE ); - bB = TRUE; - } - - } - - /* Here we must also paint the unreachable region on the bottom, if any. - This beyond reach area is due to MAXIMIZED state of - a small window */ - else if ( updateRect.bottom > iybeyond ) - { - - LOGBRUSH lb = { 0 }; - HBRUSH hBrush; - - COLORREF bkColor = _COLORS[ pWindowData->byColors[0] >> 4 ]; - - rcRect.left = updateRect.left; - rcRect.top = max( iybeyond, updateRect.top ); - rcRect.right = updateRect.right; - rcRect.bottom = updateRect.bottom; - - lb.lbStyle = BS_SOLID; - lb.lbColor = bkColor; - lb.lbHatch = 0; - - hBrush = CreateBrushIndirect( &lb ); - - FillRect( hdc, &rcRect, hBrush ); - - SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HBRUSH) s_pWvwData->s_sApp->OriginalBrush ); - DeleteObject( hBrush ); - } - - if ( bR && bB ) - { - - rcRect.left = ixbeyond; - rcRect.top = iybeyond; - rcRect.right = ci.right; - rcRect.bottom = ci.bottom; - - InvalidateRect( hWnd, &rcRect, FALSE ); - - } - } + } + } // if ( hb_gt_gobjects != NULL ) // { // s_wvw_paintGraphicObjects( hdc, &updateRect ); // } - SelectObject( hdc, hOldFont ); + SelectObject( hdc, hOldFont ); - EndPaint( hWnd, &ps ); + EndPaint( hWnd, &ps ); - if ( pWindowData->bPaint ) - { - if ( s_pWvwData->s_sApp->pSymWVW_PAINT ) - { + if( pWindowData->bPaint ) + { + if( s_pWvwData->s_sApp->pSymWVW_PAINT ) + { - pWindowData->bPaintPending = TRUE; + pWindowData->bPaintPending = TRUE; - hb_wvw_UpdatePendingRect( pWindowData, (USHORT) rowStart, (USHORT) colStart, - (USHORT) rowStop, (USHORT) colStop); + hb_wvw_UpdatePendingRect( pWindowData, ( USHORT ) rowStart, ( USHORT ) colStart, + ( USHORT ) rowStop, ( USHORT ) colStop ); - if (s_pWvwData->s_uiPaintRefresh==0) - { - xUserPaintNow(usWinNum); - } - } - } - else - { + if( s_pWvwData->s_uiPaintRefresh == 0 ) + { + xUserPaintNow( usWinNum ); + } + } + } + else + { - pWindowData->bPaint = TRUE; - } + pWindowData->bPaint = TRUE; + } #ifdef WVW_DEBUG - printf( "\nPuts( %d ), Scroll( %d ), Paint( %d ), SetFocus( %d ), KillFocus( %d ) ",nCountPuts, nCountScroll, ++nCountPaint, nSetFocus, nKillFocus ) ; + printf( "\nPuts( %d ), Scroll( %d ), Paint( %d ), SetFocus( %d ), KillFocus( %d ) ", nCountPuts, nCountScroll, ++nCountPaint, nSetFocus, nKillFocus ); #endif - return( 0 ); - } + return 0; + } - case WM_MY_UPDATE_CARET: - { - hb_gt_wvwSetCaretPos(pWindowData); - return( 0 ); - } + case WM_MY_UPDATE_CARET: + hb_gt_wvwSetCaretPos( pWindowData ); + return 0; - case WM_SETFOCUS: - { + case WM_SETFOCUS: #ifdef WVW_DEBUG - nSetFocus++; + nSetFocus++; #endif - if (usWinNum == s_pWvwData->s_usNumWindows-1) - { + if( usWinNum == s_pWvwData->s_usNumWindows - 1 ) + { - if (!s_pWvwData->s_bMainCoordMode) - { + if( ! s_pWvwData->s_bMainCoordMode ) + { - hb_gtSetPos((SHORT) pWindowData->caretPos.y, (SHORT) pWindowData->caretPos.x); - } - else - { + hb_gtSetPos( ( SHORT ) pWindowData->caretPos.y, ( SHORT ) pWindowData->caretPos.x ); + } + else + { - hb_gtSetPos(((USHORT)(LONG)(pWindowData->caretPos.y)) + hb_gt_wvwRowOfs( usWinNum ), - ((USHORT)(LONG)(pWindowData->caretPos.x)) + hb_gt_wvwColOfs( usWinNum )); - } + hb_gtSetPos( ( ( USHORT ) ( LONG ) ( pWindowData->caretPos.y ) ) + hb_gt_wvwRowOfs( usWinNum ), + ( ( USHORT ) ( LONG ) ( pWindowData->caretPos.x ) ) + hb_gt_wvwColOfs( usWinNum ) ); + } - hb_gt_wvwCreateCaret(pWindowData) ; + hb_gt_wvwCreateCaret( pWindowData ); - } + } - if ( pWindowData->bGetFocus ) - { + if( pWindowData->bGetFocus ) + { - if ( s_pWvwData->s_sApp->pSymWVW_SETFOCUS ) - { - if( hb_vmRequestReenter() ) - { + if( s_pWvwData->s_sApp->pSymWVW_SETFOCUS ) + { + if( hb_vmRequestReenter() ) + { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_SETFOCUS); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (usWinNum) ); - hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); - hb_vmDo( 2 ); - hb_vmRequestRestore(); - } - } + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_SETFOCUS ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( usWinNum ) ); + hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); + hb_vmDo( 2 ); + hb_vmRequestRestore(); + } + } - } - else - { + } + else + { - pWindowData->bGetFocus = TRUE; - } + pWindowData->bGetFocus = TRUE; + } - return( 0 ); - } + return 0; - case WM_KILLFOCUS: - { + case WM_KILLFOCUS: #ifdef WVW_DEBUG - nKillFocus++; + nKillFocus++; #endif - hb_gt_wvwKillCaret( pWindowData ); + hb_gt_wvwKillCaret( pWindowData ); - if ( s_pWvwData->s_sApp->pSymWVW_KILLFOCUS ) - { + if( s_pWvwData->s_sApp->pSymWVW_KILLFOCUS ) + { // hb_vmPushState(); // hb_vmPushSymbol( s_pWvwData->s_sApp->pSymWVW_KILLFOCUS->pSymbol ); - if( hb_vmRequestReenter() ) - { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_KILLFOCUS ) ; - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (usWinNum) ); - hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); - hb_vmDo( 2 ); - hb_vmRequestRestore(); - } - } - return( 0 ); - } + if( hb_vmRequestReenter() ) + { + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_KILLFOCUS ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( usWinNum ) ); + hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); + hb_vmDo( 2 ); + hb_vmRequestRestore(); + } + } + return 0; - case WM_KEYDOWN: - case WM_SYSKEYDOWN: + case WM_KEYDOWN: + case WM_SYSKEYDOWN: // case WM_CHAR: - //case WM_SYSCHAR: + //case WM_SYSCHAR: - { - BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; - - if ( !hb_gt_wvwAcceptingInput() ) { - if ( hb_gt_wvwBufferedKey( (LONG) wParam ) ) - { + BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - } - return(0); - } - - pWindowData->bIgnoreWM_SYSCHAR = FALSE; - switch ( wParam ) - { - - case VK_LEFT: - hb_gt_wvwTranslateKey( K_LEFT, K_SH_LEFT, K_ALT_LEFT, K_CTRL_LEFT ); - break; - case VK_RIGHT: - hb_gt_wvwTranslateKey( K_RIGHT, K_SH_RIGHT, K_ALT_RIGHT, K_CTRL_RIGHT ); - break; - case VK_UP: - hb_gt_wvwTranslateKey( K_UP, K_SH_UP, K_ALT_UP, K_CTRL_UP ); - break; - case VK_DOWN: - hb_gt_wvwTranslateKey( K_DOWN, K_SH_DOWN, K_ALT_DOWN, K_CTRL_DOWN ); - break; - case VK_HOME: - hb_gt_wvwTranslateKey( K_HOME, K_SH_HOME, K_ALT_HOME, K_CTRL_HOME ); - break; - case VK_END: - hb_gt_wvwTranslateKey( K_END, K_SH_END, K_ALT_END, K_CTRL_END ); - break; - case VK_DELETE: - hb_gt_wvwTranslateKey( K_DEL, K_SH_DEL, K_ALT_DEL, K_CTRL_DEL ); - break; - case VK_INSERT: - hb_gt_wvwTranslateKey( K_INS, K_SH_INS, K_ALT_INS, K_CTRL_INS ); - break; - case VK_PRIOR: - hb_gt_wvwTranslateKey( K_PGUP, K_SH_PGUP, K_ALT_PGUP, K_CTRL_PGUP ); - break; - case VK_NEXT: - hb_gt_wvwTranslateKey( K_PGDN, K_SH_PGDN, K_ALT_PGDN, K_CTRL_PGDN ); - break; - case VK_F1: - hb_gt_wvwTranslateKey( K_F1, K_SH_F1, K_ALT_F1, K_CTRL_F1 ); - break; - case VK_F2: - hb_gt_wvwTranslateKey( K_F2, K_SH_F2, K_ALT_F2, K_CTRL_F2 ); - break; - case VK_F3: - hb_gt_wvwTranslateKey( K_F3, K_SH_F3, K_ALT_F3, K_CTRL_F3 ); - break; - case VK_F4: - { - if ( s_pWvwData->s_sApp->AltF4Close && bAlt ) - { - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - else - { - hb_gt_wvwTranslateKey( K_F4, K_SH_F4, K_ALT_F4, K_CTRL_F4 ); - } - break; - } - case VK_F5: - hb_gt_wvwTranslateKey( K_F5, K_SH_F5, K_ALT_F5, K_CTRL_F5 ); - break; - case VK_F6: - hb_gt_wvwTranslateKey( K_F6, K_SH_F6, K_ALT_F6, K_CTRL_F6 ); - break; - case VK_F7: - hb_gt_wvwTranslateKey( K_F7, K_SH_F7, K_ALT_F7, K_CTRL_F7 ); - break; - case VK_F8: - hb_gt_wvwTranslateKey( K_F8, K_SH_F8, K_ALT_F8, K_CTRL_F8 ); - break; - case VK_F9: - hb_gt_wvwTranslateKey( K_F9, K_SH_F9, K_ALT_F9, K_CTRL_F9 ); - break; - case VK_F10: - hb_gt_wvwTranslateKey( K_F10, K_SH_F10, K_ALT_F10, K_CTRL_F10 ); - break; - case VK_F11: - hb_gt_wvwTranslateKey( K_F11, K_SH_F11, K_ALT_F11, K_CTRL_F11 ); - break; - case VK_F12: - hb_gt_wvwTranslateKey( K_F12, K_SH_F12, K_ALT_F12, K_CTRL_F12 ); - break; - default: - { - BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; - BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; - int iScanCode = HIWORD( lParam ) & 0xFF ; - - if ( bCtrl && iScanCode == 76 ) /* CTRL_VK_NUMPAD5 ) */ - { - hb_gt_wvwAddCharToInputQueue( KP_CTRL_5 ); - } - else if ( bCtrl && wParam == VK_TAB ) /* K_CTRL_TAB */ - { - - if ( bShift ) - { - hb_gt_wvwAddCharToInputQueue( K_CTRL_SH_TAB ); - } - else - { - hb_gt_wvwAddCharToInputQueue( K_CTRL_TAB ); - } - } - else if ( iScanCode == 70 ) /* Ctrl_Break key OR Scroll LOCK key */ - { - if ( bCtrl ) /* Not scroll lock */ - { - hb_gt_wvwAddCharToInputQueue( HB_BREAK_FLAG ); /* Pretend Alt+C pressed */ - - pWindowData->bIgnoreWM_SYSCHAR = TRUE; - } - else - { - DefWindowProc( hWnd, message, wParam, lParam ) ; /* Let windows handle ScrollLock */ - } - } - else if ( bCtrl && iScanCode==53 && bShift ) - { - hb_gt_wvwAddCharToInputQueue( K_CTRL_QUESTION ); - } - else if ( ( bAlt || bCtrl ) && ( - wParam==VK_MULTIPLY || wParam==VK_ADD || wParam== VK_SUBTRACT - || wParam== VK_DIVIDE ) ) - { - if ( bAlt ) + if( ! hb_gt_wvwAcceptingInput() ) + { + if( hb_gt_wvwBufferedKey( ( LONG ) wParam ) ) { - pWindowData->bIgnoreWM_SYSCHAR = TRUE; + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); } - switch ( wParam ) - { - case VK_MULTIPLY: - hb_gt_wvwTranslateKey( '*','*', KP_ALT_ASTERISK, KP_CTRL_ASTERISK ); - break; - case VK_ADD: - hb_gt_wvwTranslateKey( '+','+', KP_ALT_PLUS, KP_CTRL_PLUS ); - break; - case VK_SUBTRACT: - hb_gt_wvwTranslateKey( '-','-', KP_ALT_MINUS, KP_CTRL_MINUS ); - break; - case VK_DIVIDE: - hb_gt_wvwTranslateKey( '/','/', KP_ALT_SLASH, KP_CTRL_SLASH ); - break; - } - } - else if ( pWindowData->EnableShortCuts ) - { - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - } - } - return( 0 ); - } + return 0; + } - case WM_CHAR: - { - BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; - int iScanCode = HIWORD( lParam ) & 0xFF ; - int c = ( int )wParam; - HWND hMouseCapturer; + pWindowData->bIgnoreWM_SYSCHAR = FALSE; + switch( wParam ) + { - hMouseCapturer = GetCapture(); - if (hMouseCapturer) - { - - SendMessage( hMouseCapturer, WM_LBUTTONUP, 0, 0 ); - } - - if ( !hb_gt_wvwAcceptingInput() ) - { - - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - return(0); - } - - if ( !pWindowData->bIgnoreWM_SYSCHAR ) - { - - if ( bCtrl && iScanCode == 28 ) /* K_CTRL_RETURN */ - { - hb_gt_wvwAddCharToInputQueue( K_CTRL_RETURN ); - } - else if ( bCtrl && ( c >= 1 && c<= 26 ) ) /* K_CTRL_A - Z */ - { - hb_gt_wvwAddCharToInputQueue( K_Ctrl[c-1] ); - } - else - { - switch ( c ) - { - /* handle special characters */ - case VK_BACK: - hb_gt_wvwTranslateKey( K_BS, K_SH_BS, K_ALT_BS, K_CTRL_BS ); - break; - case VK_TAB: - hb_gt_wvwTranslateKey( K_TAB, K_SH_TAB, K_ALT_TAB, K_CTRL_TAB ); - break; - case VK_RETURN: - hb_gt_wvwTranslateKey( K_RETURN, K_SH_RETURN, K_ALT_RETURN, K_CTRL_RETURN ); - break; - case VK_ESCAPE: - hb_gt_wvwAddCharToInputQueue( K_ESC ); - break; + case VK_LEFT: + hb_gt_wvwTranslateKey( K_LEFT, K_SH_LEFT, K_ALT_LEFT, K_CTRL_LEFT ); + break; + case VK_RIGHT: + hb_gt_wvwTranslateKey( K_RIGHT, K_SH_RIGHT, K_ALT_RIGHT, K_CTRL_RIGHT ); + break; + case VK_UP: + hb_gt_wvwTranslateKey( K_UP, K_SH_UP, K_ALT_UP, K_CTRL_UP ); + break; + case VK_DOWN: + hb_gt_wvwTranslateKey( K_DOWN, K_SH_DOWN, K_ALT_DOWN, K_CTRL_DOWN ); + break; + case VK_HOME: + hb_gt_wvwTranslateKey( K_HOME, K_SH_HOME, K_ALT_HOME, K_CTRL_HOME ); + break; + case VK_END: + hb_gt_wvwTranslateKey( K_END, K_SH_END, K_ALT_END, K_CTRL_END ); + break; + case VK_DELETE: + hb_gt_wvwTranslateKey( K_DEL, K_SH_DEL, K_ALT_DEL, K_CTRL_DEL ); + break; + case VK_INSERT: + hb_gt_wvwTranslateKey( K_INS, K_SH_INS, K_ALT_INS, K_CTRL_INS ); + break; + case VK_PRIOR: + hb_gt_wvwTranslateKey( K_PGUP, K_SH_PGUP, K_ALT_PGUP, K_CTRL_PGUP ); + break; + case VK_NEXT: + hb_gt_wvwTranslateKey( K_PGDN, K_SH_PGDN, K_ALT_PGDN, K_CTRL_PGDN ); + break; + case VK_F1: + hb_gt_wvwTranslateKey( K_F1, K_SH_F1, K_ALT_F1, K_CTRL_F1 ); + break; + case VK_F2: + hb_gt_wvwTranslateKey( K_F2, K_SH_F2, K_ALT_F2, K_CTRL_F2 ); + break; + case VK_F3: + hb_gt_wvwTranslateKey( K_F3, K_SH_F3, K_ALT_F3, K_CTRL_F3 ); + break; + case VK_F4: + if( s_pWvwData->s_sApp->AltF4Close && bAlt ) + { + return DefWindowProc( hWnd, message, wParam, lParam ); + } + else + { + hb_gt_wvwTranslateKey( K_F4, K_SH_F4, K_ALT_F4, K_CTRL_F4 ); + } + break; + case VK_F5: + hb_gt_wvwTranslateKey( K_F5, K_SH_F5, K_ALT_F5, K_CTRL_F5 ); + break; + case VK_F6: + hb_gt_wvwTranslateKey( K_F6, K_SH_F6, K_ALT_F6, K_CTRL_F6 ); + break; + case VK_F7: + hb_gt_wvwTranslateKey( K_F7, K_SH_F7, K_ALT_F7, K_CTRL_F7 ); + break; + case VK_F8: + hb_gt_wvwTranslateKey( K_F8, K_SH_F8, K_ALT_F8, K_CTRL_F8 ); + break; + case VK_F9: + hb_gt_wvwTranslateKey( K_F9, K_SH_F9, K_ALT_F9, K_CTRL_F9 ); + break; + case VK_F10: + hb_gt_wvwTranslateKey( K_F10, K_SH_F10, K_ALT_F10, K_CTRL_F10 ); + break; + case VK_F11: + hb_gt_wvwTranslateKey( K_F11, K_SH_F11, K_ALT_F11, K_CTRL_F11 ); + break; + case VK_F12: + hb_gt_wvwTranslateKey( K_F12, K_SH_F12, K_ALT_F12, K_CTRL_F12 ); + break; default: + { + BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; + BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; + int iScanCode = HIWORD( lParam ) & 0xFF; - if( pWindowData->CodePage == OEM_CHARSET ) - { - c = hb_wvw_key_ansi_to_oem( c ); - } - hb_gt_wvwAddCharToInputQueue( c ); - break; - } - } + if( bCtrl && iScanCode == 76 ) /* CTRL_VK_NUMPAD5 ) */ + { + hb_gt_wvwAddCharToInputQueue( KP_CTRL_5 ); + } + else if( bCtrl && wParam == VK_TAB ) /* K_CTRL_TAB */ + { + + if( bShift ) + { + hb_gt_wvwAddCharToInputQueue( K_CTRL_SH_TAB ); + } + else + { + hb_gt_wvwAddCharToInputQueue( K_CTRL_TAB ); + } + } + else if( iScanCode == 70 ) /* Ctrl_Break key OR Scroll LOCK key */ + { + if( bCtrl ) /* Not scroll lock */ + { + hb_gt_wvwAddCharToInputQueue( HB_BREAK_FLAG ); /* Pretend Alt+C pressed */ + + pWindowData->bIgnoreWM_SYSCHAR = TRUE; + } + else + { + DefWindowProc( hWnd, message, wParam, lParam ); /* Let windows handle ScrollLock */ + } + } + else if( bCtrl && iScanCode == 53 && bShift ) + { + hb_gt_wvwAddCharToInputQueue( K_CTRL_QUESTION ); + } + else if( ( bAlt || bCtrl ) && ( + wParam == VK_MULTIPLY || wParam == VK_ADD || wParam == VK_SUBTRACT + || wParam == VK_DIVIDE ) ) + { + if( bAlt ) + { + + pWindowData->bIgnoreWM_SYSCHAR = TRUE; + } + switch( wParam ) + { + case VK_MULTIPLY: + hb_gt_wvwTranslateKey( '*', '*', KP_ALT_ASTERISK, KP_CTRL_ASTERISK ); + break; + case VK_ADD: + hb_gt_wvwTranslateKey( '+', '+', KP_ALT_PLUS, KP_CTRL_PLUS ); + break; + case VK_SUBTRACT: + hb_gt_wvwTranslateKey( '-', '-', KP_ALT_MINUS, KP_CTRL_MINUS ); + break; + case VK_DIVIDE: + hb_gt_wvwTranslateKey( '/', '/', KP_ALT_SLASH, KP_CTRL_SLASH ); + break; + } + } + else if( pWindowData->EnableShortCuts ) + { + return DefWindowProc( hWnd, message, wParam, lParam ); + } + } + } + return 0; } - pWindowData->bIgnoreWM_SYSCHAR = FALSE; - return( 0 ); - } - - case WM_SYSCHAR: - { - - if ( !hb_gt_wvwAcceptingInput() ) + case WM_CHAR: { + BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; + int iScanCode = HIWORD( lParam ) & 0xFF; + int c = ( int ) wParam; + HWND hMouseCapturer; - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); + hMouseCapturer = GetCapture(); + if( hMouseCapturer ) + { - pWindowData->bIgnoreWM_SYSCHAR = FALSE; - return(0); + SendMessage( hMouseCapturer, WM_LBUTTONUP, 0, 0 ); + } + + if( ! hb_gt_wvwAcceptingInput() ) + { + + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); + return 0; + } + + if( ! pWindowData->bIgnoreWM_SYSCHAR ) + { + + if( bCtrl && iScanCode == 28 ) /* K_CTRL_RETURN */ + { + hb_gt_wvwAddCharToInputQueue( K_CTRL_RETURN ); + } + else if( bCtrl && ( c >= 1 && c <= 26 ) ) /* K_CTRL_A - Z */ + { + hb_gt_wvwAddCharToInputQueue( K_Ctrl[ c - 1 ] ); + } + else + { + switch( c ) + { + /* handle special characters */ + case VK_BACK: + hb_gt_wvwTranslateKey( K_BS, K_SH_BS, K_ALT_BS, K_CTRL_BS ); + break; + case VK_TAB: + hb_gt_wvwTranslateKey( K_TAB, K_SH_TAB, K_ALT_TAB, K_CTRL_TAB ); + break; + case VK_RETURN: + hb_gt_wvwTranslateKey( K_RETURN, K_SH_RETURN, K_ALT_RETURN, K_CTRL_RETURN ); + break; + case VK_ESCAPE: + hb_gt_wvwAddCharToInputQueue( K_ESC ); + break; + default: + + if( pWindowData->CodePage == OEM_CHARSET ) + { + c = hb_wvw_key_ansi_to_oem( c ); + } + hb_gt_wvwAddCharToInputQueue( c ); + break; + } + } + } + + pWindowData->bIgnoreWM_SYSCHAR = FALSE; + return 0; } - if ( !pWindowData->bIgnoreWM_SYSCHAR ) - { - int c, iScanCode = HIWORD( lParam ) & 0xFF ; - switch ( iScanCode ) - { - case 2: - c = K_ALT_1 ; - break; - case 3: - c = K_ALT_2 ; - break; - case 4: - c = K_ALT_3 ; - break; - case 5: - c = K_ALT_4 ; - break; - case 6: - c = K_ALT_5 ; - break; - case 7: - c = K_ALT_6 ; - break; - case 8: - c = K_ALT_7 ; - break; - case 9: - c = K_ALT_8 ; - break; - case 10: - c = K_ALT_9 ; - break; - case 11: - c = K_ALT_0 ; - break; - case 13: - c = K_ALT_EQUALS ; - break; - case 14: - c = K_ALT_BS ; - break; - case 16: - c = K_ALT_Q ; - break; - case 17: - c = K_ALT_W ; - break; - case 18: - c = K_ALT_E ; - break; - case 19: - c = K_ALT_R ; - break; - case 20: - c = K_ALT_T ; - break; - case 21: - c = K_ALT_Y ; - break; - case 22: - c = K_ALT_U ; - break; - case 23: - c = K_ALT_I ; - break; - case 24: - c = K_ALT_O ; - break; - case 25: - c = K_ALT_P ; - break; - case 30: - c = K_ALT_A ; - break; - case 31: - c = K_ALT_S ; - break; - case 32: - c = K_ALT_D ; - break; - case 33: - c = K_ALT_F ; - break; - case 34: - c = K_ALT_G ; - break; - case 35: - c = K_ALT_H ; - break; - case 36: - c = K_ALT_J ; - break; - case 37: - c = K_ALT_K ; - break; - case 38: - c = K_ALT_L ; - break; - case 44: - c = K_ALT_Z ; - break; - case 45: - c = K_ALT_X ; - break; - case 46: - c = K_ALT_C ; - break; - case 47: - c = K_ALT_V ; - break; - case 48: - c = K_ALT_B ; - break; - case 49: - c = K_ALT_N ; - break; - case 50: - c = K_ALT_M ; - break; - default: - c = ( int ) wParam ; - break; - } - hb_gt_wvwAddCharToInputQueue( c ); + case WM_SYSCHAR: - } + if( ! hb_gt_wvwAcceptingInput() ) + { - pWindowData->bIgnoreWM_SYSCHAR = FALSE; - return( 0 ); - } + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - case WM_QUERYENDSESSION: /* Closing down computer */ - /* if we have set a shutdown command return false, - * so windows ( and our app )doesn't shutdown - * otherwise let the default handler take it - */ - hb_vmRequestQuit(); - return 0; + pWindowData->bIgnoreWM_SYSCHAR = FALSE; + return 0; + } - case WM_CLOSE: /* Clicked 'X' on system menu */ - { - /* if an event has been set then return it otherwise - fake an Alt+C - */ + if( ! pWindowData->bIgnoreWM_SYSCHAR ) + { + int c, iScanCode = HIWORD( lParam ) & 0xFF; + switch( iScanCode ) + { + case 2: + c = K_ALT_1; + break; + case 3: + c = K_ALT_2; + break; + case 4: + c = K_ALT_3; + break; + case 5: + c = K_ALT_4; + break; + case 6: + c = K_ALT_5; + break; + case 7: + c = K_ALT_6; + break; + case 8: + c = K_ALT_7; + break; + case 9: + c = K_ALT_8; + break; + case 10: + c = K_ALT_9; + break; + case 11: + c = K_ALT_0; + break; + case 13: + c = K_ALT_EQUALS; + break; + case 14: + c = K_ALT_BS; + break; + case 16: + c = K_ALT_Q; + break; + case 17: + c = K_ALT_W; + break; + case 18: + c = K_ALT_E; + break; + case 19: + c = K_ALT_R; + break; + case 20: + c = K_ALT_T; + break; + case 21: + c = K_ALT_Y; + break; + case 22: + c = K_ALT_U; + break; + case 23: + c = K_ALT_I; + break; + case 24: + c = K_ALT_O; + break; + case 25: + c = K_ALT_P; + break; + case 30: + c = K_ALT_A; + break; + case 31: + c = K_ALT_S; + break; + case 32: + c = K_ALT_D; + break; + case 33: + c = K_ALT_F; + break; + case 34: + c = K_ALT_G; + break; + case 35: + c = K_ALT_H; + break; + case 36: + c = K_ALT_J; + break; + case 37: + c = K_ALT_K; + break; + case 38: + c = K_ALT_L; + break; + case 44: + c = K_ALT_Z; + break; + case 45: + c = K_ALT_X; + break; + case 46: + c = K_ALT_C; + break; + case 47: + c = K_ALT_V; + break; + case 48: + c = K_ALT_B; + break; + case 49: + c = K_ALT_N; + break; + case 50: + c = K_ALT_M; + break; + default: + c = ( int ) wParam; + break; + } + hb_gt_wvwAddCharToInputQueue( c ); - /* 20040610 - reject if not accepting input (topmost window not on focus) */ - if ( !hb_gt_wvwAcceptingInput() ) - { + } - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); + pWindowData->bIgnoreWM_SYSCHAR = FALSE; + return 0; - return(0); - } + case WM_QUERYENDSESSION: /* Closing down computer */ + /* if we have set a shutdown command return false, + * so windows ( and our app )doesn't shutdown + * otherwise let the default handler take it + */ + hb_vmRequestQuit(); + return 0; - if (usWinNum == 0) - { - - /* bdj note 20060724: - We should put this line here, as per FSG change on 20060626: - hb_gtHandleClose() - However, if there is no gtSetCloseHandler, ALT+C effect is not produced as it should. - So for now I put it back to the old behaviour with the following two lines, until hb_gtHandleClose() is fixed. + case WM_CLOSE: /* Clicked 'X' on system menu */ + /* if an event has been set then return it otherwise + fake an Alt+C */ + /* 20040610 + reject if not accepting input (topmost window not on focus) */ + if( ! hb_gt_wvwAcceptingInput() ) + { + + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); + + return 0; + } + + if( usWinNum == 0 ) + { + + /* bdj note 20060724: + We should put this line here, as per FSG change on 20060626: + hb_gtHandleClose() + However, if there is no gtSetCloseHandler, ALT+C effect is not produced as it should. + So for now I put it back to the old behaviour with the following two lines, until hb_gtHandleClose() is fixed. + */ + // hb_gt_wvwAddCharToInputQueue( HB_BREAK_FLAG ); - hb_gt_wvwAddCharToInputQueue( K_ESC ); + hb_gt_wvwAddCharToInputQueue( K_ESC ); - } - else - { - hb_gt_wvwAddCharToInputQueue( K_ESC ); - } - - return( 0 ); - } - - case WM_QUIT: - case WM_DESTROY: - return( 0 ); - - case WM_ENTERIDLE: - /* FSG - 12/05/2004 - Signal than i'm on idle */ - hb_idleState(); - return 0; - - case WM_RBUTTONDOWN: - case WM_LBUTTONDOWN: - case WM_RBUTTONUP: - case WM_LBUTTONUP: - case WM_RBUTTONDBLCLK: - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MBUTTONDBLCLK: - case WM_MOUSEMOVE: - case WM_MOUSEWHEEL: - case WM_NCMOUSEMOVE: - { - - if ( !hb_gt_wvwAcceptingInput() || ( usWinNum != s_pWvwData->s_usNumWindows-1 ) ) - { - - return(0); - } - - hb_gt_wvwMouseEvent( pWindowData, hWnd, message, wParam, lParam ); - return( 0 ); - } - - case WM_TIMER: - { - - if ( wParam < WVW_ID_BASE_TIMER && pWindowData->bPaintPending ) - { - xUserPaintNow(usWinNum); - } - - if ( wParam >= WVW_ID_BASE_TIMER && s_pWvwData->s_sApp->pSymWVW_TIMER ) - { - xUserTimerNow(usWinNum, hWnd, message, wParam, lParam); - } - - return( 0 ); - } - - case WM_HSCROLL : - case WM_VSCROLL : - { - HWND hWndCtrl = (HWND) lParam; - UINT uiXBid; - byte bStyle; - BOOL bTopMost = (s_pWvwData->s_usNumWindows==usWinNum+1); - - /* reject if not accepting input (topmost window not on focus) */ - - if (!bTopMost && !s_pWvwData->s_bAllowNonTop) - { - - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - return(0); - } - - /*************/ - - uiXBid = (UINT) FindControlId (usWinNum, WVW_CONTROL_SCROLLBAR, hWndCtrl, &bStyle) ; - if (uiXBid==0) - { - - return(0); - } - - RunControlBlock(usWinNum, WVW_CONTROL_SCROLLBAR, hWndCtrl, message, wParam, lParam, 0 ); - - return 0 ; - } /* WM_VSCROLL WM_HSCROLL */ - - case WM_SIZE: - { - - if (hb_wvw_Size_Ready( 0 )) - { - - hb_gt_wvwResetWindowSize( pWindowData, hWnd ); - - if ( s_pWvwData->s_sApp->pSymWVW_SIZE ) + } + else { - if( hb_vmRequestReenter() ) - { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_SIZE ); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (usWinNum) ); - hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF )hWnd ); - hb_vmPushNumInt( message ); - hb_vmPushNumInt( wParam ); - hb_vmPushNumInt( lParam ); - hb_vmDo( 5 ); - hb_vmRequestRestore(); - } + hb_gt_wvwAddCharToInputQueue( K_ESC ); } - return( 0 ); - } - } + return 0; - case WM_MOVE: - { - if (hb_wvw_Move_Ready( 0 )) - { + case WM_QUIT: + case WM_DESTROY: + return 0; - if (s_pWvwData->s_sApp->pSymWVW_MOVE ) + case WM_ENTERIDLE: + /* FSG - 12/05/2004 - Signal than i'm on idle */ + hb_idleState(); + return 0; + + case WM_RBUTTONDOWN: + case WM_LBUTTONDOWN: + case WM_RBUTTONUP: + case WM_LBUTTONUP: + case WM_RBUTTONDBLCLK: + case WM_LBUTTONDBLCLK: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + case WM_MBUTTONDBLCLK: + case WM_MOUSEMOVE: + case WM_MOUSEWHEEL: + case WM_NCMOUSEMOVE: + + if( ! hb_gt_wvwAcceptingInput() || ( usWinNum != s_pWvwData->s_usNumWindows - 1 ) ) { - if( hb_vmRequestReenter() ) - { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_MOVE ); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (usWinNum) ); - hb_vmPushNumInt( wParam ); - hb_vmPushNumInt( lParam ); - hb_vmDo( 3 ); - hb_vmRequestRestore(); - } - } - return( 0 ); - } - } - case WM_CTLCOLORSTATIC: - case WM_CTLCOLOREDIT: - if ( s_pWvwData->s_sApp->pSymWVW_ONCTLCOLOR) - { - - SetBkMode((HDC)wParam,TRANSPARENT); - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_ONCTLCOLOR ); - hb_vmPushNil(); - hb_vmPushNumInt( wParam ); - hb_vmPushNumInt( lParam ); - hb_vmDo( 2 ); - res = hb_parnl( -1 ); - - - if( res != -1 ) - return (LRESULT) res; - - } - - case WM_SYSCOMMAND: /* handle system menu items */ /*SP-ADDED*/ - { - if (s_pWvwData->s_usNumWindows!=usWinNum+1) - { - hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); - } - else - { - switch ( LOWORD(wParam) ) - { - case SC_SIZE: - case SC_MOVE: - case SC_MINIMIZE: - case SC_MAXIMIZE: - case SC_CLOSE: - case SC_NEXTWINDOW: - case SC_RESTORE: - hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); - } - } - } - - case WM_DRAWITEM: - { - - if ( pWindowData->bSBPaint ) - { - LPDRAWITEMSTRUCT lpDIS; - PTSTR ptStr; - RECT rectCorner; - //long lSBColorForeground, lSBColorBackground; - - size_t stLen; - const _TCHAR * pEnd; - - pWindowData->bSBPaint = FALSE; - - lpDIS = (LPDRAWITEMSTRUCT) lParam; - - ptStr = (PTSTR) lpDIS->itemData; - rectCorner = lpDIS->rcItem; - - - if ( pWindowData->cSBColorForeground ) - { - //lSBColorForeground = strtol( s_cSBColorForeground, NULL, 10 ); - SetTextColor(lpDIS->hDC, pWindowData->cSBColorForeground ); //lSBColorForeground ); + return 0; } - if ( pWindowData->cSBColorBackground ) + hb_gt_wvwMouseEvent( pWindowData, hWnd, message, wParam, lParam ); + return 0; + + case WM_TIMER: + + if( wParam < WVW_ID_BASE_TIMER && pWindowData->bPaintPending ) { - //lSBColorBackground = strtol( s_cSBColorBackground, NULL, 10 ); - SetBkColor(lpDIS->hDC, pWindowData->cSBColorBackground ); //lSBColorBackground ); + xUserPaintNow( usWinNum ); } - for (pEnd = ptStr; *pEnd != _TEXT('\0'); pEnd++) - continue; + if( wParam >= WVW_ID_BASE_TIMER && s_pWvwData->s_sApp->pSymWVW_TIMER ) + { + xUserTimerNow( usWinNum, hWnd, message, wParam, lParam ); + } - stLen = pEnd-ptStr; + return 0; - ExtTextOut(lpDIS->hDC, rectCorner.top, rectCorner.left+3, 0, &lpDIS->rcItem, ptStr, stLen, NULL); + case WM_HSCROLL: + case WM_VSCROLL: + { + HWND hWndCtrl = ( HWND ) lParam; + UINT uiXBid; + byte bStyle; + BOOL bTopMost = ( s_pWvwData->s_usNumWindows == usWinNum + 1 ); - return(0); - } - } + /* reject if not accepting input (topmost window not on focus) */ - } - return( DefWindowProc( hWnd, message, wParam, lParam ) ); + if( ! bTopMost && ! s_pWvwData->s_bAllowNonTop ) + { + + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); + return 0; + } + + /*************/ + + uiXBid = ( UINT ) FindControlId( usWinNum, WVW_CONTROL_SCROLLBAR, hWndCtrl, &bStyle ); + if( uiXBid == 0 ) + { + + return 0; + } + + RunControlBlock( usWinNum, WVW_CONTROL_SCROLLBAR, hWndCtrl, message, wParam, lParam, 0 ); + + return 0; + } /* WM_VSCROLL WM_HSCROLL */ + + case WM_SIZE: + + if( hb_wvw_Size_Ready( 0 ) ) + { + + hb_gt_wvwResetWindowSize( pWindowData, hWnd ); + + if( s_pWvwData->s_sApp->pSymWVW_SIZE ) + { + if( hb_vmRequestReenter() ) + { + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_SIZE ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( usWinNum ) ); + hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) hWnd ); + hb_vmPushNumInt( message ); + hb_vmPushNumInt( wParam ); + hb_vmPushNumInt( lParam ); + hb_vmDo( 5 ); + hb_vmRequestRestore(); + } + } + + return 0; + } + + case WM_MOVE: + if( hb_wvw_Move_Ready( 0 ) ) + { + + if( s_pWvwData->s_sApp->pSymWVW_MOVE ) + { + if( hb_vmRequestReenter() ) + { + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_MOVE ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( usWinNum ) ); + hb_vmPushNumInt( wParam ); + hb_vmPushNumInt( lParam ); + hb_vmDo( 3 ); + hb_vmRequestRestore(); + } + } + return 0; + } + case WM_CTLCOLORSTATIC: + case WM_CTLCOLOREDIT: + + if( s_pWvwData->s_sApp->pSymWVW_ONCTLCOLOR ) + { + + SetBkMode( ( HDC ) wParam, TRANSPARENT ); + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_ONCTLCOLOR ); + hb_vmPushNil(); + hb_vmPushNumInt( wParam ); + hb_vmPushNumInt( lParam ); + hb_vmDo( 2 ); + res = hb_parnl( -1 ); + + + if( res != -1 ) + return ( LRESULT ) res; + + } + + case WM_SYSCOMMAND: /* handle system menu items */ /*SP-ADDED*/ + if( s_pWvwData->s_usNumWindows != usWinNum + 1 ) + { + hb_gt_wvwInputNotAllowed( usWinNum, message, wParam, lParam ); + } + else + { + switch( LOWORD( wParam ) ) + { + case SC_SIZE: + case SC_MOVE: + case SC_MINIMIZE: + case SC_MAXIMIZE: + case SC_CLOSE: + case SC_NEXTWINDOW: + case SC_RESTORE: + hb_gt_wvwHandleMenuSelection( ( int ) LOWORD( wParam ) ); + } + } + + case WM_DRAWITEM: + + if( pWindowData->bSBPaint ) + { + LPDRAWITEMSTRUCT lpDIS; + PTSTR ptStr; + RECT rectCorner; + //long lSBColorForeground, lSBColorBackground; + + size_t stLen; + const _TCHAR * pEnd; + + pWindowData->bSBPaint = FALSE; + + lpDIS = ( LPDRAWITEMSTRUCT ) lParam; + + ptStr = ( PTSTR ) lpDIS->itemData; + rectCorner = lpDIS->rcItem; + + + if( pWindowData->cSBColorForeground ) + { + //lSBColorForeground = strtol( s_cSBColorForeground, NULL, 10 ); + SetTextColor( lpDIS->hDC, pWindowData->cSBColorForeground ); //lSBColorForeground ); + } + + if( pWindowData->cSBColorBackground ) + { + //lSBColorBackground = strtol( s_cSBColorBackground, NULL, 10 ); + SetBkColor( lpDIS->hDC, pWindowData->cSBColorBackground ); //lSBColorBackground ); + } + + for( pEnd = ptStr; *pEnd != _TEXT( '\0' ); pEnd++ ) + continue; + + stLen = pEnd - ptStr; + + ExtTextOut( lpDIS->hDC, rectCorner.top, rectCorner.left + 3, 0, &lpDIS->rcItem, ptStr, stLen, NULL ); + + return 0; + } + + } + return DefWindowProc( hWnd, message, wParam, lParam ); } @@ -4159,11 +4093,11 @@ static BOOL hb_wvw_Move_Ready( BOOL b_p_IsReady ) { static BOOL s_bIsReady = FALSE; - if (b_p_IsReady) + if( b_p_IsReady ) { s_bIsReady = b_p_IsReady; } - return(s_bIsReady); + return s_bIsReady; } @@ -4171,113 +4105,113 @@ static BOOL hb_wvw_Size_Ready( BOOL b_p_SizeIsReady ) { static BOOL s_bSizeIsReady = FALSE; - if ( b_p_SizeIsReady ) + if( b_p_SizeIsReady ) { s_bSizeIsReady = b_p_SizeIsReady; } - return( s_bSizeIsReady ); + return s_bSizeIsReady; } static HWND hb_gt_wvwCreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow ) { - HWND hWnd; - WNDCLASS wndclass = { 0 }; + HWND hWnd; + WNDCLASS wndclass = { 0 }; - HB_SYMBOL_UNUSED( hPrevInstance ); - HB_SYMBOL_UNUSED( szCmdLine ); + HB_SYMBOL_UNUSED( hPrevInstance ); + HB_SYMBOL_UNUSED( szCmdLine ); - InitCommonControls(); + InitCommonControls(); - wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC; - wndclass.lpfnWndProc = hb_gt_wvwWndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = hInstance; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); - wndclass.hbrBackground = NULL; - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = s_pWvwData->szAppName; + wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC; + wndclass.lpfnWndProc = hb_gt_wvwWndProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = hInstance; + wndclass.hIcon = NULL; + wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); + wndclass.hbrBackground = NULL; + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = s_pWvwData->szAppName; - if ( ! RegisterClass( &wndclass ) ) - { - MessageBox( NULL, TEXT( "Failed to register class." ), - s_pWvwData->szAppName, MB_ICONERROR ); - return( 0 ); - } + if( ! RegisterClass( &wndclass ) ) + { + MessageBox( NULL, TEXT( "Failed to register class." ), + s_pWvwData->szAppName, MB_ICONERROR ); + return 0; + } - hWnd = CreateWindow( s_pWvwData->szAppName, /*classname */ - TEXT( "HARBOUR_WVW" ), /*window name */ + hWnd = CreateWindow( s_pWvwData->szAppName, /*classname */ + TEXT( "HARBOUR_WVW" ), /*window name */ - WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX | /*style */ - WS_CLIPCHILDREN, + WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | /*style */ + WS_CLIPCHILDREN, - 0, /*x */ - 0, /*y */ - CW_USEDEFAULT, /*width */ - CW_USEDEFAULT, /*height */ - NULL, /*window parent */ - NULL, /*menu */ - hInstance, /*instance */ - NULL ); /*lpParam */ + 0, /*x */ + 0, /*y */ + CW_USEDEFAULT, /*width */ + CW_USEDEFAULT, /*height */ + NULL, /*window parent */ + NULL, /*menu */ + hInstance, /*instance */ + NULL ); /*lpParam */ - if ( hWnd == NULL ) - { - MessageBox( NULL, TEXT( "Failed to create window." ), + if( hWnd == NULL ) + { + MessageBox( NULL, TEXT( "Failed to create window." ), TEXT( "HARBOUR_WVW" ), MB_ICONERROR ); - return NULL; - } + return NULL; + } - s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hWnd = hWnd; + s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hWnd = hWnd; - if ( s_pWvwData->s_sApp->pSymWVW_PAINT && s_pWvwData->s_uiPaintRefresh > 0) - { - SetTimer( hWnd, WVW_ID_SYSTEM_TIMER, (UINT) s_pWvwData->s_uiPaintRefresh, NULL ); - } + if( s_pWvwData->s_sApp->pSymWVW_PAINT && s_pWvwData->s_uiPaintRefresh > 0 ) + { + SetTimer( hWnd, WVW_ID_SYSTEM_TIMER, ( UINT ) s_pWvwData->s_uiPaintRefresh, NULL ); + } - /* If you wish to show window the way you want, put somewhere in your application - * ANNOUNCE HB_NOSTARTUPWINDOW - * If so compiled, then you need to issue Wvw_ShowWindow( nWinNum, SW_RESTORE ) - * at the point you desire in your code. - */ - if ( hb_dynsymFind( "HB_NOSTARTUPWINDOW" ) != NULL ) - { - iCmdShow = SW_HIDE; - } + /* If you wish to show window the way you want, put somewhere in your application + * ANNOUNCE HB_NOSTARTUPWINDOW + * If so compiled, then you need to issue Wvw_ShowWindow( nWinNum, SW_RESTORE ) + * at the point you desire in your code. + */ + if( hb_dynsymFind( "HB_NOSTARTUPWINDOW" ) != NULL ) + { + iCmdShow = SW_HIDE; + } - ShowWindow( hWnd, iCmdShow ); + ShowWindow( hWnd, iCmdShow ); - UpdateWindow( hWnd ); + UpdateWindow( hWnd ); - return( hWnd ) ; + return hWnd; } static void hb_gt_wvwCreateToolTipWindow( WIN_DATA * pWindowData ) { - INITCOMMONCONTROLSEX icex = { 0 }; + INITCOMMONCONTROLSEX icex = { 0 }; HWND hWndTT; - TOOLINFO ti = { 0 }; + TOOLINFO ti = { 0 }; /* Load the tooltip class from the DLL. */ icex.dwSize = sizeof( icex ); icex.dwICC = ICC_BAR_CLASSES; - if( !InitCommonControlsEx( &icex ) ) + if( ! InitCommonControlsEx( &icex ) ) { return; } /* Create the tooltip control. * - *TODO: shouldn't we set hWndOwner to pWindowData->hWnd instead of NULL? + **TODO: shouldn't we set hWndOwner to pWindowData->hWnd instead of NULL? */ hWndTT = CreateWindow( TOOLTIPS_CLASS, TEXT( "" ), - WS_POPUP | TTS_ALWAYSTIP , + WS_POPUP | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, @@ -4295,19 +4229,19 @@ static void hb_gt_wvwCreateToolTipWindow( WIN_DATA * pWindowData ) /* Prepare TOOLINFO structure for use as tracking tooltip. */ - ti.cbSize = sizeof( TOOLINFO ); - ti.uFlags = TTF_SUBCLASS; - ti.hwnd = pWindowData->hWnd; - ti.uId = WVW_ID_BASE_TOOLTIP+pWindowData->byWinId; - ti.hinst = s_pWvwData->hInstance; - ti.lpszText = ""; - ti.rect.left = ti.rect.top = ti.rect.bottom = ti.rect.right = 0; + ti.cbSize = sizeof( TOOLINFO ); + ti.uFlags = TTF_SUBCLASS; + ti.hwnd = pWindowData->hWnd; + ti.uId = WVW_ID_BASE_TOOLTIP + pWindowData->byWinId; + ti.hinst = s_pWvwData->hInstance; + ti.lpszText = ""; + ti.rect.left = ti.rect.top = ti.rect.bottom = ti.rect.right = 0; /* Add the tool to the control, displaying an error if needed. */ - if( ! SendMessage( s_pWvwData->hWndTT,TTM_ADDTOOL, 0, ( LPARAM ) &ti ) ) + if( ! SendMessage( s_pWvwData->hWndTT, TTM_ADDTOOL, 0, ( LPARAM ) &ti ) ) { - return ; + return; } pWindowData->hWndTT = hWndTT; @@ -4317,64 +4251,64 @@ static void hb_gt_wvwCreateToolTipWindow( WIN_DATA * pWindowData ) DWORD hb_gt_wvwProcessMessages( WIN_DATA * pWindowData ) { - MSG msg; - int iIndex; - BOOL bProcessed; + MSG msg; + int iIndex; + BOOL bProcessed; - HB_SYMBOL_UNUSED( pWindowData ); + HB_SYMBOL_UNUSED( pWindowData ); - while ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) - { + while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) + { - if ( s_pWvwData->s_iScrolling && msg.message == WM_LBUTTONUP ) - { - - s_pWvwData->s_iWrongButtonUp++; - if (s_pWvwData->s_iWrongButtonUp >= s_pWvwData->s_iMaxWrongButtonUp) + if( s_pWvwData->s_iScrolling && msg.message == WM_LBUTTONUP ) { - HWND hMouseCapturer; - hMouseCapturer = GetCapture(); - if (hMouseCapturer) - { + s_pWvwData->s_iWrongButtonUp++; + if( s_pWvwData->s_iWrongButtonUp >= s_pWvwData->s_iMaxWrongButtonUp ) + { + HWND hMouseCapturer; - SendMessage( hMouseCapturer, WM_LBUTTONUP, 0, 0 ); - ReleaseCapture(); - } + hMouseCapturer = GetCapture(); + if( hMouseCapturer ) + { - s_pWvwData->s_iScrolling = 0; + SendMessage( hMouseCapturer, WM_LBUTTONUP, 0, 0 ); + ReleaseCapture(); + } + s_pWvwData->s_iScrolling = 0; + + } + + return 0; + } + else + { + s_pWvwData->s_iWrongButtonUp = 0; + PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ); } - return 0; - } - else - { - s_pWvwData->s_iWrongButtonUp = 0; - PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ); - } + bProcessed = FALSE; + for( iIndex = 0; iIndex < WVW_DLGML_MAX; iIndex++ ) + { + if( s_pWvwData->s_sApp->hDlgModeless[ iIndex ] != 0 ) + { + if( IsDialogMessage( s_pWvwData->s_sApp->hDlgModeless[ iIndex ], &msg ) ) + { + bProcessed = TRUE; + break; + } + } + } - bProcessed = FALSE; - for ( iIndex = 0; iIndex < WVW_DLGML_MAX; iIndex++ ) - { - if ( s_pWvwData->s_sApp->hDlgModeless[ iIndex ] != 0 ) - { - if ( IsDialogMessage( s_pWvwData->s_sApp->hDlgModeless[ iIndex ], &msg ) ) - { - bProcessed = TRUE; - break; - } - } - } + if( bProcessed == FALSE ) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + } - if ( bProcessed == FALSE ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - } - - return( msg.wParam ); + return msg.wParam; } @@ -4382,37 +4316,41 @@ DWORD hb_gt_wvwProcessMessages( WIN_DATA * pWindowData ) POINT hb_gt_wvwGetXYFromColRow( WIN_DATA * pWindowData, USHORT col, USHORT row ) { - POINT xy = { 0 }; + POINT xy = { 0 }; - xy.x = ( col ) * pWindowData->PTEXTSIZE.x; + xy.x = ( col ) * pWindowData->PTEXTSIZE.x; - xy.y = ( row ) * hb_wvw_LineHeight( pWindowData ) + (pWindowData->byLineSpacing / 2); + xy.y = ( row ) * hb_wvw_LineHeight( pWindowData ) + ( pWindowData->byLineSpacing / 2 ); - xy.y += pWindowData->usTBHeight; + xy.y += pWindowData->usTBHeight; - return( xy ); + return xy; } -static void hb_gt_wvwUnreachedXY( WIN_DATA * pWindowData, int *cols, int *rows ) +static void hb_gt_wvwUnreachedXY( WIN_DATA * pWindowData, int * cols, int * rows ) { - RECT ci = { 0 }; - POINT xy = { 0 }; + RECT ci = { 0 }; + POINT xy = { 0 }; - if ( !IsZoomed( pWindowData->hWnd ) ) - { - if (rows) (*rows) = 0; - if (cols) (*cols) = 0; - return; - } + if( ! IsZoomed( pWindowData->hWnd ) ) + { + if( rows ) + ( *rows ) = 0; + if( cols ) + ( *cols ) = 0; + return; + } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, pWindowData->COLS, pWindowData->ROWS ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, pWindowData->COLS, pWindowData->ROWS ); - GetClientRect( pWindowData->hWnd, &ci ); + GetClientRect( pWindowData->hWnd, &ci ); - if (rows) (*rows) = ci.bottom - xy.y - pWindowData->usSBHeight; - if (cols) (*cols) = ci.right - xy.x; + if( rows ) + ( *rows ) = ci.bottom - xy.y - pWindowData->usSBHeight; + if( cols ) + ( *cols ) = ci.right - xy.x; } @@ -4422,28 +4360,28 @@ static void hb_gt_wvwUnreachedXY( WIN_DATA * pWindowData, int *cols, int *rows ) * This works because we are using the FIXED system font * */ -static POINT hb_gt_wvwGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHORT y) +static POINT hb_gt_wvwGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHORT y ) { - POINT colrow = { 0 }; + POINT colrow = { 0 }; - colrow.x = ( x/pWindowData->PTEXTSIZE.x ); + colrow.x = ( x / pWindowData->PTEXTSIZE.x ); - y -= pWindowData->usTBHeight; + y -= pWindowData->usTBHeight; - colrow.y = ( y/ ( pWindowData->PTEXTSIZE.y + pWindowData->byLineSpacing ) ); + colrow.y = ( y / ( pWindowData->PTEXTSIZE.y + pWindowData->byLineSpacing ) ); - return( colrow ); + return colrow; } -static POINT hb_gt_wvwTBGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHORT y) +static POINT hb_gt_wvwTBGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHORT y ) { - POINT colrow = { 0 }; + POINT colrow = { 0 }; - colrow.x = ( x/pWindowData->PTEXTSIZE.x ); + colrow.x = ( x / pWindowData->PTEXTSIZE.x ); - colrow.y = ( y/ ( pWindowData->PTEXTSIZE.y + pWindowData->byLineSpacing ) ); + colrow.y = ( y / ( pWindowData->PTEXTSIZE.y + pWindowData->byLineSpacing ) ); - return( colrow ); + return colrow; } @@ -4456,23 +4394,23 @@ static POINT hb_gt_wvwTBGetColRowFromXY( WIN_DATA * pWindowData, USHORT x, USHOR RECT hb_gt_wvwGetColRowFromXYRect( WIN_DATA * pWindowData, RECT xy ) { - RECT colrow = { 0 }; - int usLineSpaces; + RECT colrow = { 0 }; + int usLineSpaces; - xy.top -= pWindowData->usTBHeight; - xy.bottom -= pWindowData->usTBHeight; + xy.top -= pWindowData->usTBHeight; + xy.bottom -= pWindowData->usTBHeight; - /* TODO: pls improve efficiency */ - usLineSpaces = pWindowData->byLineSpacing; + /* TODO: pls improve efficiency */ + usLineSpaces = pWindowData->byLineSpacing; - colrow.left = ( xy.left / pWindowData->PTEXTSIZE.x ); - colrow.top = ( xy.top / (pWindowData->PTEXTSIZE.y + usLineSpaces) ); + colrow.left = ( xy.left / pWindowData->PTEXTSIZE.x ); + colrow.top = ( xy.top / ( pWindowData->PTEXTSIZE.y + usLineSpaces ) ); - /* Adjust for when rectangle EXACTLY overlaps characters */ - colrow.right = ( xy.right / pWindowData->PTEXTSIZE.x - ( xy.right % pWindowData->PTEXTSIZE.x ? 0 : 1 ) ); - colrow.bottom = ( xy.bottom / (pWindowData->PTEXTSIZE.y + usLineSpaces) - ( xy.bottom % (pWindowData->PTEXTSIZE.y + usLineSpaces) ? 0 : 1 ) ); + /* Adjust for when rectangle EXACTLY overlaps characters */ + colrow.right = ( xy.right / pWindowData->PTEXTSIZE.x - ( xy.right % pWindowData->PTEXTSIZE.x ? 0 : 1 ) ); + colrow.bottom = ( xy.bottom / ( pWindowData->PTEXTSIZE.y + usLineSpaces ) - ( xy.bottom % ( pWindowData->PTEXTSIZE.y + usLineSpaces ) ? 0 : 1 ) ); - return( colrow ); + return colrow; } @@ -4484,50 +4422,50 @@ RECT hb_gt_wvwGetColRowFromXYRect( WIN_DATA * pWindowData, RECT xy ) */ RECT hb_gt_wvwGetXYFromColRowRect( WIN_DATA * pWindowData, RECT colrow ) { - RECT xy = { 0 }; + RECT xy = { 0 }; - xy.left = ( colrow.left ) * pWindowData->PTEXTSIZE.x; + xy.left = ( colrow.left ) * pWindowData->PTEXTSIZE.x; - xy.top = ( colrow.top ) * hb_wvw_LineHeight( pWindowData ) + (pWindowData->byLineSpacing / 2); + xy.top = ( colrow.top ) * hb_wvw_LineHeight( pWindowData ) + ( pWindowData->byLineSpacing / 2 ); - xy.right = ( colrow.right+1 ) * pWindowData->PTEXTSIZE.x; + xy.right = ( colrow.right + 1 ) * pWindowData->PTEXTSIZE.x; - xy.bottom = ( colrow.bottom+1 ) * hb_wvw_LineHeight( pWindowData ) - - (pWindowData->byLineSpacing / 2); + xy.bottom = ( colrow.bottom + 1 ) * hb_wvw_LineHeight( pWindowData ) + - ( pWindowData->byLineSpacing / 2 ); - xy.top += pWindowData->usTBHeight; - xy.bottom += pWindowData->usTBHeight; + xy.top += pWindowData->usTBHeight; + xy.bottom += pWindowData->usTBHeight; - return( xy ); + return xy; } -static void hb_gt_wvwCreateCaret(WIN_DATA * pWindowData) +static void hb_gt_wvwCreateCaret( WIN_DATA * pWindowData ) { /* create and show the caret * create an underline caret of height - _s.CaretSize */ - if (pWindowData->byWinId == s_pWvwData->s_usNumWindows-1) + if( pWindowData->byWinId == s_pWvwData->s_usNumWindows - 1 ) { - if (!s_pWvwData->s_bVertCaret) - { - s_pWvwData->s_sApp->CaretExist = CreateCaret( pWindowData->hWnd, ( HBITMAP ) NULL, pWindowData->PTEXTSIZE.x, pWindowData->CaretSize ); - } - else - { - s_pWvwData->s_sApp->CaretExist = CreateCaret( pWindowData->hWnd, ( HBITMAP ) NULL, pWindowData->CaretSize, pWindowData->PTEXTSIZE.y ); - } + if( ! s_pWvwData->s_bVertCaret ) + { + s_pWvwData->s_sApp->CaretExist = CreateCaret( pWindowData->hWnd, ( HBITMAP ) NULL, pWindowData->PTEXTSIZE.x, pWindowData->CaretSize ); + } + else + { + s_pWvwData->s_sApp->CaretExist = CreateCaret( pWindowData->hWnd, ( HBITMAP ) NULL, pWindowData->CaretSize, pWindowData->PTEXTSIZE.y ); + } } else { - s_pWvwData->s_sApp->CaretExist = FALSE; + s_pWvwData->s_sApp->CaretExist = FALSE; } - if ( s_pWvwData->s_sApp->CaretExist && s_pWvwData->s_sApp->displayCaret ) + if( s_pWvwData->s_sApp->CaretExist && s_pWvwData->s_sApp->displayCaret ) { - hb_gt_wvwSetCaretPos(pWindowData); + hb_gt_wvwSetCaretPos( pWindowData ); ShowCaret( pWindowData->hWnd ); } } @@ -4538,10 +4476,10 @@ static void hb_gt_wvwKillCaret( WIN_DATA * pWindowData ) { HB_SYMBOL_UNUSED( pWindowData ); - if ( s_pWvwData->s_sApp->CaretExist ) + if( s_pWvwData->s_sApp->CaretExist ) { DestroyCaret(); - s_pWvwData->s_sApp->CaretExist = FALSE ; + s_pWvwData->s_sApp->CaretExist = FALSE; } } @@ -4551,36 +4489,36 @@ static void hb_gt_wvwKillCaret( WIN_DATA * pWindowData ) * the Windows function SetCaretPos ( with the expected coordinates ) */ -static BOOL hb_gt_wvwSetCaretPos(WIN_DATA * pWindowData) +static BOOL hb_gt_wvwSetCaretPos( WIN_DATA * pWindowData ) { - POINT xy = { 0 }; + POINT xy = { 0 }; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, (SHORT) pWindowData->caretPos.x, (SHORT) pWindowData->caretPos.y ); - if ( pWindowData->CaretSize > 0 ) - { - if (!s_pWvwData->s_bVertCaret) - { + xy = hb_gt_wvwGetXYFromColRow( pWindowData, ( SHORT ) pWindowData->caretPos.x, ( SHORT ) pWindowData->caretPos.y ); + if( pWindowData->CaretSize > 0 ) + { + if( ! s_pWvwData->s_bVertCaret ) + { - xy.y += ( pWindowData->PTEXTSIZE.y - pWindowData->CaretSize ); - } + xy.y += ( pWindowData->PTEXTSIZE.y - pWindowData->CaretSize ); + } - } - else - { - if (!s_pWvwData->s_bVertCaret) - { - xy.y -= pWindowData->CaretSize; - } - else - { - xy.x += pWindowData->PTEXTSIZE.x; - } - } - if ( s_pWvwData->s_sApp->CaretExist ) - { - SetCaretPos( xy.x, xy.y); - } - return( TRUE ); + } + else + { + if( ! s_pWvwData->s_bVertCaret ) + { + xy.y -= pWindowData->CaretSize; + } + else + { + xy.x += pWindowData->PTEXTSIZE.x; + } + } + if( s_pWvwData->s_sApp->CaretExist ) + { + SetCaretPos( xy.x, xy.y ); + } + return TRUE; } @@ -4590,30 +4528,30 @@ static BOOL hb_gt_wvwSetCaretPos(WIN_DATA * pWindowData) static void hb_gt_wvwValidateRow( WIN_DATA * pWindowData ) { - if ( pWindowData->caretPos.y < 0 ) - { - pWindowData->caretPos.y = pWindowData->ROWS-1; - if ( pWindowData->caretPos.x > 0 ) - { - pWindowData->caretPos.x--; - } - else - { - pWindowData->caretPos.x = pWindowData->COLS-1; - } - } - else if ( pWindowData->caretPos.y >= pWindowData->ROWS ) - { - pWindowData->caretPos.y = 0; - if ( pWindowData->caretPos.x < pWindowData->COLS-1 ) - { - pWindowData->caretPos.x++; - } - else - { - pWindowData->caretPos.x = 0; - } - } + if( pWindowData->caretPos.y < 0 ) + { + pWindowData->caretPos.y = pWindowData->ROWS - 1; + if( pWindowData->caretPos.x > 0 ) + { + pWindowData->caretPos.x--; + } + else + { + pWindowData->caretPos.x = pWindowData->COLS - 1; + } + } + else if( pWindowData->caretPos.y >= pWindowData->ROWS ) + { + pWindowData->caretPos.y = 0; + if( pWindowData->caretPos.x < pWindowData->COLS - 1 ) + { + pWindowData->caretPos.x++; + } + else + { + pWindowData->caretPos.x = 0; + } + } } @@ -4623,30 +4561,30 @@ static void hb_gt_wvwValidateRow( WIN_DATA * pWindowData ) static void hb_gt_wvwValidateCol( WIN_DATA * pWindowData ) { - if ( pWindowData->caretPos.x < 0 ) - { - pWindowData->caretPos.x = pWindowData->COLS-1; - if ( pWindowData->caretPos.y > 0 ) - { - pWindowData->caretPos.y--; - } - else - { - pWindowData->caretPos.y = pWindowData->ROWS-1; - } - } - else if ( pWindowData->caretPos.x >= pWindowData->COLS ) - { - pWindowData->caretPos.x = 0; - if ( pWindowData->caretPos.y < pWindowData->ROWS-1 ) - { - pWindowData->caretPos.y++; - } - else - { - pWindowData->caretPos.y = 0; - } - } + if( pWindowData->caretPos.x < 0 ) + { + pWindowData->caretPos.x = pWindowData->COLS - 1; + if( pWindowData->caretPos.y > 0 ) + { + pWindowData->caretPos.y--; + } + else + { + pWindowData->caretPos.y = pWindowData->ROWS - 1; + } + } + else if( pWindowData->caretPos.x >= pWindowData->COLS ) + { + pWindowData->caretPos.x = 0; + if( pWindowData->caretPos.y < pWindowData->ROWS - 1 ) + { + pWindowData->caretPos.y++; + } + else + { + pWindowData->caretPos.y = 0; + } + } } @@ -4657,12 +4595,12 @@ static void hb_gt_wvwValidateCol( WIN_DATA * pWindowData ) static void hb_gt_wvwValidateCaret( WIN_DATA * pWindowData ) { - hb_gt_wvwValidateCol( pWindowData ); - hb_gt_wvwValidateRow( pWindowData ); + hb_gt_wvwValidateCol( pWindowData ); + hb_gt_wvwValidateRow( pWindowData ); - /* send message to window to display updated caret - */ - SendMessage( pWindowData->hWnd, WM_MY_UPDATE_CARET, 0, 0 ); + /* send message to window to display updated caret + */ + SendMessage( pWindowData->hWnd, WM_MY_UPDATE_CARET, 0, 0 ); } @@ -4673,22 +4611,22 @@ static void hb_gt_wvwValidateCaret( WIN_DATA * pWindowData ) static USHORT hb_gt_wvwGetIndexForTextBuffer( WIN_DATA * pWindowData, USHORT col, USHORT row ) { - return( row * pWindowData->COLS + col ); + return row * pWindowData->COLS + col; } - /* - * hb_gt_wvwGetColRowForTextBuffer takes an index into the screen Text buffer - * and returns the corresponding row and column - */ +/* + * hb_gt_wvwGetColRowForTextBuffer takes an index into the screen Text buffer + * and returns the corresponding row and column + */ static POINT hb_gt_wvwGetColRowForTextBuffer( WIN_DATA * pWindowData, USHORT index ) { - POINT colrow = { 0 }; + POINT colrow = { 0 }; - colrow.x = index % pWindowData->COLS; - colrow.y = index / pWindowData->COLS; + colrow.x = index % pWindowData->COLS; + colrow.y = index / pWindowData->COLS; - return( colrow ); + return colrow; } @@ -4697,95 +4635,95 @@ static POINT hb_gt_wvwGetColRowForTextBuffer( WIN_DATA * pWindowData, USHORT ind * the Windows function TextOut with the expected coordinates */ -static BOOL hb_gt_wvwTextOut( WIN_DATA * pWindowData, HDC hdc, USHORT col, USHORT row, LPCTSTR lpString, USHORT cbString ) +static BOOL hb_gt_wvwTextOut( WIN_DATA * pWindowData, HDC hdc, USHORT col, USHORT row, LPCTSTR lpString, USHORT cbString ) { - BOOL Result ; - POINT xy = { 0 }; - RECT mClip = { 0 }; + BOOL Result; + POINT xy = { 0 }; + RECT mClip = { 0 }; - if ( cbString > pWindowData->COLS ) - { - cbString = pWindowData->COLS; - } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, col, row ); + if( cbString > pWindowData->COLS ) + { + cbString = pWindowData->COLS; + } + xy = hb_gt_wvwGetXYFromColRow( pWindowData, col, row ); - /* safer solution by Oscar Hernandez Suarez: */ + /* safer solution by Oscar Hernandez Suarez: */ - SetRect(&mClip, xy.x, xy.y, xy.x+cbString*pWindowData->PTEXTSIZE.x, xy.y+pWindowData->PTEXTSIZE.y); - if ( pWindowData->FixedFont ) - { - Result = ExtTextOut(hdc, xy.x, xy.y, ETO_CLIPPED|ETO_OPAQUE, &mClip, lpString, - cbString, NULL); - } - else - { - Result = ExtTextOut(hdc, xy.x, xy.y, ETO_CLIPPED|ETO_OPAQUE, &mClip, lpString, - cbString, pWindowData->FixedSize); - } + SetRect( &mClip, xy.x, xy.y, xy.x + cbString * pWindowData->PTEXTSIZE.x, xy.y + pWindowData->PTEXTSIZE.y ); + if( pWindowData->FixedFont ) + { + Result = ExtTextOut( hdc, xy.x, xy.y, ETO_CLIPPED | ETO_OPAQUE, &mClip, lpString, + cbString, NULL ); + } + else + { + Result = ExtTextOut( hdc, xy.x, xy.y, ETO_CLIPPED | ETO_OPAQUE, &mClip, lpString, + cbString, pWindowData->FixedSize ); + } - return( Result ) ; + return Result; } /* */ /* get for and background colours from attribute and set them for window -*/ + */ static BOOL hb_gt_wvwSetColors( WIN_DATA * pWindowData, HDC hdc, BYTE attr ) { - int fore = attr & 0x000F; - int back = ( attr & 0x00F0 )>>4; + int fore = attr & 0x000F; + int back = ( attr & 0x00F0 ) >> 4; - pWindowData->foreground = _COLORS[ fore ]; - pWindowData->background = _COLORS[ back ]; + pWindowData->foreground = _COLORS[ fore ]; + pWindowData->background = _COLORS[ back ]; - SetTextColor( hdc, pWindowData->foreground ); - SetBkColor( hdc, pWindowData->background ); + SetTextColor( hdc, pWindowData->foreground ); + SetBkColor( hdc, pWindowData->background ); - return( TRUE ); + return TRUE; } /* */ /* compute invalid rect in pixels, from row and col -*/ + */ static void hb_gt_wvwSetInvalidRect( WIN_DATA * pWindowData, USHORT left, USHORT top, USHORT right, USHORT bottom ) { - RECT rect = { 0 }; + RECT rect = { 0 }; - if ( pWindowData->InvalidateWindow ) - { - rect.left = left; - rect.top = top; - rect.right = right; - rect.bottom = bottom; + if( pWindowData->InvalidateWindow ) + { + rect.left = left; + rect.top = top; + rect.right = right; + rect.bottom = bottom; - rect = hb_gt_wvwGetXYFromColRowRect( pWindowData, rect ); + rect = hb_gt_wvwGetXYFromColRowRect( pWindowData, rect ); - /* check for wrapping */ - /* */ - rect.left = min( rect.left, rect.right ); - rect.top = min( rect.top, rect.bottom ); + /* check for wrapping */ + /* */ + rect.left = min( rect.left, rect.right ); + rect.top = min( rect.top, rect.bottom ); - rect.right = max( rect.left, rect.right ); - rect.bottom = max( rect.top, rect.bottom ); + rect.right = max( rect.left, rect.right ); + rect.bottom = max( rect.top, rect.bottom ); - rect.top -= (pWindowData->byLineSpacing / 2); - rect.bottom += (pWindowData->byLineSpacing / 2); + rect.top -= ( pWindowData->byLineSpacing / 2 ); + rect.bottom += ( pWindowData->byLineSpacing / 2 ); - if ( pWindowData->RectInvalid.left < 0 ) - { - memcpy( &(pWindowData->RectInvalid), &rect, sizeof( RECT ) ); - } - else - { - pWindowData->RectInvalid.left = min( pWindowData->RectInvalid.left , rect.left ); - pWindowData->RectInvalid.top = min( pWindowData->RectInvalid.top , rect.top ); - pWindowData->RectInvalid.right = max( pWindowData->RectInvalid.right , rect.right ); - pWindowData->RectInvalid.bottom = max( pWindowData->RectInvalid.bottom, rect.bottom ); - } - hb_gt_wvwDoInvalidateRect( pWindowData ) ; - } + if( pWindowData->RectInvalid.left < 0 ) + { + memcpy( &( pWindowData->RectInvalid ), &rect, sizeof( RECT ) ); + } + else + { + pWindowData->RectInvalid.left = min( pWindowData->RectInvalid.left, rect.left ); + pWindowData->RectInvalid.top = min( pWindowData->RectInvalid.top, rect.top ); + pWindowData->RectInvalid.right = max( pWindowData->RectInvalid.right, rect.right ); + pWindowData->RectInvalid.bottom = max( pWindowData->RectInvalid.bottom, rect.bottom ); + } + hb_gt_wvwDoInvalidateRect( pWindowData ); + } } @@ -4793,14 +4731,14 @@ static void hb_gt_wvwSetInvalidRect( WIN_DATA * pWindowData, USHORT left, USHORT static void hb_gt_wvwDoInvalidateRect( WIN_DATA * pWindowData ) { - if ( hb_gt_wvw_usDispCount( pWindowData ) <= 0 && ( pWindowData->RectInvalid.left != -1 ) ) - { + if( hb_gt_wvw_usDispCount( pWindowData ) <= 0 && ( pWindowData->RectInvalid.left != -1 ) ) + { - InvalidateRect( pWindowData->hWnd, &pWindowData->RectInvalid, FALSE ); + InvalidateRect( pWindowData->hWnd, &pWindowData->RectInvalid, FALSE ); - pWindowData->RectInvalid.left = -1 ; - hb_gt_wvwProcessMessages( pWindowData ); - } + pWindowData->RectInvalid.left = -1; + hb_gt_wvwProcessMessages( pWindowData ); + } } @@ -4813,76 +4751,79 @@ static void hb_gt_wvwDoInvalidateRect( WIN_DATA * pWindowData ) static void hb_gt_wvwTranslateKey( int key, int shiftkey, int altkey, int controlkey ) { - int iKey = hb_gt_wvwJustTranslateKey( key, shiftkey, altkey, controlkey ); - hb_gt_wvwAddCharToInputQueue( iKey ); + int iKey = hb_gt_wvwJustTranslateKey( key, shiftkey, altkey, controlkey ); + + hb_gt_wvwAddCharToInputQueue( iKey ); } static int hb_gt_wvwJustTranslateKey( int key, int shiftkey, int altkey, int controlkey ) { - int nVirtKey = GetKeyState( VK_MENU ); - if ( nVirtKey & 0x8000 ) - { - return( altkey ); - } - else - { - nVirtKey = GetKeyState( VK_CONTROL ); - if ( nVirtKey & 0x8000 ) - { - return( controlkey ); - } - else - { - nVirtKey = GetKeyState( VK_SHIFT ); - if ( nVirtKey & 0x8000 ) + int nVirtKey = GetKeyState( VK_MENU ); + + if( nVirtKey & 0x8000 ) + { + return altkey; + } + else + { + nVirtKey = GetKeyState( VK_CONTROL ); + if( nVirtKey & 0x8000 ) { - return( shiftkey ); + return controlkey; } else { - return( key ); + nVirtKey = GetKeyState( VK_SHIFT ); + if( nVirtKey & 0x8000 ) + { + return shiftkey; + } + else + { + return key; + } } - } - } + } } /* */ /* font stuff */ /* use the standard fixed oem font, unless the caller has requested set size fonts -*/ + */ HFONT hb_gt_wvwGetFont( const char * pszFace, int iHeight, int iWidth, int iWeight, int iQuality, int iCodePage ) { - HFONT hFont; - if ( iHeight > 0 ) - { - LOGFONT logfont = {0}; + HFONT hFont; - logfont.lfEscapement = 0; - logfont.lfOrientation = 0; - logfont.lfWeight = iWeight ; - logfont.lfItalic = 0; - logfont.lfUnderline = 0; - logfont.lfStrikeOut = 0; - logfont.lfCharSet = (BYTE)iCodePage; /* OEM_CHARSET; */ - logfont.lfOutPrecision = 0; - logfont.lfClipPrecision = 0; - logfont.lfQuality = (BYTE)iQuality; /* DEFAULT_QUALITY, DRAFT_QUALITY or PROOF_QUALITY */ - logfont.lfPitchAndFamily = FIXED_PITCH+FF_MODERN; /* all mapping depends on fixed width fonts! */ - logfont.lfHeight = iHeight; - logfont.lfWidth = iWidth < 0 ? -iWidth : iWidth ; + if( iHeight > 0 ) + { + LOGFONT logfont = { 0 }; - strcpy( logfont.lfFaceName,pszFace ); + logfont.lfEscapement = 0; + logfont.lfOrientation = 0; + logfont.lfWeight = iWeight; + logfont.lfItalic = 0; + logfont.lfUnderline = 0; + logfont.lfStrikeOut = 0; + logfont.lfCharSet = ( BYTE ) iCodePage; /* OEM_CHARSET; */ + logfont.lfOutPrecision = 0; + logfont.lfClipPrecision = 0; + logfont.lfQuality = ( BYTE ) iQuality; /* DEFAULT_QUALITY, DRAFT_QUALITY or PROOF_QUALITY */ + logfont.lfPitchAndFamily = FIXED_PITCH + FF_MODERN; /* all mapping depends on fixed width fonts! */ + logfont.lfHeight = iHeight; + logfont.lfWidth = iWidth < 0 ? -iWidth : iWidth; - hFont = CreateFontIndirect( &logfont ); - } - else - { + strcpy( logfont.lfFaceName, pszFace ); - hFont = ( HFONT ) GetStockObject( OEM_FIXED_FONT ); - } - return( hFont ); + hFont = CreateFontIndirect( &logfont ); + } + else + { + + hFont = ( HFONT ) GetStockObject( OEM_FIXED_FONT ); + } + return hFont; } @@ -4890,314 +4831,314 @@ HFONT hb_gt_wvwGetFont( const char * pszFace, int iHeight, int iWidth, int iWeig static void hb_gtInitStatics( UINT usWinNum, LPCTSTR lpszWinName, USHORT usRow1, USHORT usCol1, USHORT usRow2, USHORT usCol2 ) { - OSVERSIONINFO osvi ; - HINSTANCE h; - WIN_DATA * pWindowData; - WIN_DATA * pPrevWindow; - int iIndex; + OSVERSIONINFO osvi; + HINSTANCE h; + WIN_DATA * pWindowData; + WIN_DATA * pPrevWindow; + int iIndex; - pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; - if (usWinNum == 0) - { - pWindowData->byWinId = (int) usWinNum; - strcpy(pWindowData->szWinName, lpszWinName); + if( usWinNum == 0 ) + { + pWindowData->byWinId = ( int ) usWinNum; + strcpy( pWindowData->szWinName, lpszWinName ); - pWindowData->usRowOfs = usRow1; - pWindowData->usColOfs = usCol1; - pWindowData->uiDispCount = 0; + pWindowData->usRowOfs = usRow1; + pWindowData->usColOfs = usCol1; + pWindowData->uiDispCount = 0; - pWindowData->ROWS = usRow2-usRow1+1; - pWindowData->COLS = usCol2-usCol1+1; - pWindowData->foreground = WHITE; - pWindowData->background = BLACK; - pWindowData->BUFFERSIZE = 0; - pWindowData->pColors = NULL; - pWindowData->pBuffer = NULL; - pWindowData->caretPos.x = 0; - pWindowData->caretPos.y = 0; + pWindowData->ROWS = usRow2 - usRow1 + 1; + pWindowData->COLS = usCol2 - usCol1 + 1; + pWindowData->foreground = WHITE; + pWindowData->background = BLACK; + pWindowData->BUFFERSIZE = 0; + pWindowData->pColors = NULL; + pWindowData->pBuffer = NULL; + pWindowData->caretPos.x = 0; + pWindowData->caretPos.y = 0; - s_pWvwData->s_sApp->CaretExist = FALSE; + s_pWvwData->s_sApp->CaretExist = FALSE; - pWindowData->CaretSize = 2; - pWindowData->mousePos.x = 0; - pWindowData->mousePos.y = 0; - pWindowData->MouseMove = FALSE ; - pWindowData->hWnd = NULL; - pWindowData->keyPointerIn = 0; - pWindowData->keyPointerOut = 0; - pWindowData->keyLast = 0; - memset( &pWindowData->Keys, 0, sizeof( pWindowData->Keys ) ); + pWindowData->CaretSize = 2; + pWindowData->mousePos.x = 0; + pWindowData->mousePos.y = 0; + pWindowData->MouseMove = FALSE; + pWindowData->hWnd = NULL; + pWindowData->keyPointerIn = 0; + pWindowData->keyPointerOut = 0; + pWindowData->keyLast = 0; + memset( &pWindowData->Keys, 0, sizeof( pWindowData->Keys ) ); - s_pWvwData->s_sApp->displayCaret = TRUE; + s_pWvwData->s_sApp->displayCaret = TRUE; - pWindowData->RectInvalid.left = -1 ; + pWindowData->RectInvalid.left = -1; - pWindowData->PTEXTSIZE.x = 8; - pWindowData->PTEXTSIZE.y = 12; + pWindowData->PTEXTSIZE.x = 8; + pWindowData->PTEXTSIZE.y = 12; - pWindowData->fontHeight = 20; - pWindowData->fontWidth = 10; - pWindowData->fontWeight = FW_NORMAL; - pWindowData->fontQuality = DEFAULT_QUALITY; - strcpy( pWindowData->fontFace,"Courier New" ); + pWindowData->fontHeight = 20; + pWindowData->fontWidth = 10; + pWindowData->fontWeight = FW_NORMAL; + pWindowData->fontQuality = DEFAULT_QUALITY; + strcpy( pWindowData->fontFace, "Courier New" ); - pWindowData->LastMenuEvent = 0; - pWindowData->MenuKeyEvent = WVW_DEFAULT_MENUKEYEVENT; - pWindowData->CentreWindow = TRUE; /* Default is to always display window in centre of screen */ + pWindowData->LastMenuEvent = 0; + pWindowData->MenuKeyEvent = WVW_DEFAULT_MENUKEYEVENT; + pWindowData->CentreWindow = TRUE; /* Default is to always display window in centre of screen */ - /* two following parameters are meaningful only if CentreWindow is FALSE */ - pWindowData->HCentreWindow = FALSE; /* horizontally */ - pWindowData->VCentreWindow = FALSE; /* vertically */ + /* two following parameters are meaningful only if CentreWindow is FALSE */ + pWindowData->HCentreWindow = FALSE; /* horizontally */ + pWindowData->VCentreWindow = FALSE; /* vertically */ - pWindowData->CodePage = GetACP() ; /* Set code page to default system */ + pWindowData->CodePage = GetACP(); /* Set code page to default system */ - osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); - GetVersionEx ( &osvi ); - s_pWvwData->s_sApp->Win9X = ( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ); - s_pWvwData->s_sApp->AltF4Close = FALSE; + osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); + GetVersionEx( &osvi ); + s_pWvwData->s_sApp->Win9X = ( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ); + s_pWvwData->s_sApp->AltF4Close = FALSE; - pWindowData->InvalidateWindow = TRUE; - pWindowData->EnableShortCuts = FALSE; + pWindowData->InvalidateWindow = TRUE; + pWindowData->EnableShortCuts = FALSE; - pWindowData->bToolTipActive = FALSE; - pWindowData->hWndTT = NULL; - pWindowData->hPopup = NULL; + pWindowData->bToolTipActive = FALSE; + pWindowData->hWndTT = NULL; + pWindowData->hPopup = NULL; - s_pWvwData->s_lfPB.lfHeight = pWindowData->fontHeight - 2; - s_pWvwData->s_lfPB.lfWidth = 0; - s_pWvwData->s_lfPB.lfEscapement = 0; - s_pWvwData->s_lfPB.lfOrientation = 0; - s_pWvwData->s_lfPB.lfWeight = 0; - s_pWvwData->s_lfPB.lfItalic = 0; - s_pWvwData->s_lfPB.lfUnderline = 0; - s_pWvwData->s_lfPB.lfStrikeOut = 0; - s_pWvwData->s_lfPB.lfCharSet = DEFAULT_CHARSET; + s_pWvwData->s_lfPB.lfHeight = pWindowData->fontHeight - 2; + s_pWvwData->s_lfPB.lfWidth = 0; + s_pWvwData->s_lfPB.lfEscapement = 0; + s_pWvwData->s_lfPB.lfOrientation = 0; + s_pWvwData->s_lfPB.lfWeight = 0; + s_pWvwData->s_lfPB.lfItalic = 0; + s_pWvwData->s_lfPB.lfUnderline = 0; + s_pWvwData->s_lfPB.lfStrikeOut = 0; + s_pWvwData->s_lfPB.lfCharSet = DEFAULT_CHARSET; - s_pWvwData->s_lfPB.lfQuality = DEFAULT_QUALITY; - s_pWvwData->s_lfPB.lfPitchAndFamily = FF_DONTCARE; - strcpy( s_pWvwData->s_lfPB.lfFaceName, "Arial" ); + s_pWvwData->s_lfPB.lfQuality = DEFAULT_QUALITY; + s_pWvwData->s_lfPB.lfPitchAndFamily = FF_DONTCARE; + strcpy( s_pWvwData->s_lfPB.lfFaceName, "Arial" ); - s_pWvwData->s_lfSB.lfHeight = 12; - s_pWvwData->s_lfSB.lfWidth = 0; - s_pWvwData->s_lfSB.lfEscapement = 0; - s_pWvwData->s_lfSB.lfOrientation = 0; - s_pWvwData->s_lfSB.lfWeight = 400; // - s_pWvwData->s_lfSB.lfItalic = 0; - s_pWvwData->s_lfSB.lfUnderline = 0; - s_pWvwData->s_lfSB.lfStrikeOut = 0; - s_pWvwData->s_lfSB.lfCharSet = DEFAULT_CHARSET; + s_pWvwData->s_lfSB.lfHeight = 12; + s_pWvwData->s_lfSB.lfWidth = 0; + s_pWvwData->s_lfSB.lfEscapement = 0; + s_pWvwData->s_lfSB.lfOrientation = 0; + s_pWvwData->s_lfSB.lfWeight = 400; // + s_pWvwData->s_lfSB.lfItalic = 0; + s_pWvwData->s_lfSB.lfUnderline = 0; + s_pWvwData->s_lfSB.lfStrikeOut = 0; + s_pWvwData->s_lfSB.lfCharSet = DEFAULT_CHARSET; - s_pWvwData->s_lfSB.lfQuality = DEFAULT_QUALITY; - s_pWvwData->s_lfSB.lfPitchAndFamily = FF_DONTCARE; - strcpy( s_pWvwData->s_lfSB.lfFaceName, "Arial" ); + s_pWvwData->s_lfSB.lfQuality = DEFAULT_QUALITY; + s_pWvwData->s_lfSB.lfPitchAndFamily = FF_DONTCARE; + strcpy( s_pWvwData->s_lfSB.lfFaceName, "Arial" ); - s_pWvwData->s_lfCB.lfHeight = pWindowData->fontHeight - 2; - s_pWvwData->s_lfCB.lfWidth = 0; - s_pWvwData->s_lfCB.lfEscapement = 0; - s_pWvwData->s_lfCB.lfOrientation = 0; - s_pWvwData->s_lfCB.lfWeight = 0; - s_pWvwData->s_lfCB.lfItalic = 0; - s_pWvwData->s_lfCB.lfUnderline = 0; - s_pWvwData->s_lfCB.lfStrikeOut = 0; - s_pWvwData->s_lfCB.lfCharSet = DEFAULT_CHARSET; + s_pWvwData->s_lfCB.lfHeight = pWindowData->fontHeight - 2; + s_pWvwData->s_lfCB.lfWidth = 0; + s_pWvwData->s_lfCB.lfEscapement = 0; + s_pWvwData->s_lfCB.lfOrientation = 0; + s_pWvwData->s_lfCB.lfWeight = 0; + s_pWvwData->s_lfCB.lfItalic = 0; + s_pWvwData->s_lfCB.lfUnderline = 0; + s_pWvwData->s_lfCB.lfStrikeOut = 0; + s_pWvwData->s_lfCB.lfCharSet = DEFAULT_CHARSET; - s_pWvwData->s_lfCB.lfQuality = DEFAULT_QUALITY; - s_pWvwData->s_lfCB.lfPitchAndFamily = FF_DONTCARE; - strcpy( s_pWvwData->s_lfCB.lfFaceName, "Arial" ); + s_pWvwData->s_lfCB.lfQuality = DEFAULT_QUALITY; + s_pWvwData->s_lfCB.lfPitchAndFamily = FF_DONTCARE; + strcpy( s_pWvwData->s_lfCB.lfFaceName, "Arial" ); - s_pWvwData->s_lfEB.lfHeight = pWindowData->fontHeight - 2; - s_pWvwData->s_lfEB.lfWidth = 0; - s_pWvwData->s_lfEB.lfEscapement = 0; - s_pWvwData->s_lfEB.lfOrientation = 0; - s_pWvwData->s_lfEB.lfWeight = 0; - s_pWvwData->s_lfEB.lfItalic = 0; - s_pWvwData->s_lfEB.lfUnderline = 0; - s_pWvwData->s_lfEB.lfStrikeOut = 0; - s_pWvwData->s_lfEB.lfCharSet = DEFAULT_CHARSET; + s_pWvwData->s_lfEB.lfHeight = pWindowData->fontHeight - 2; + s_pWvwData->s_lfEB.lfWidth = 0; + s_pWvwData->s_lfEB.lfEscapement = 0; + s_pWvwData->s_lfEB.lfOrientation = 0; + s_pWvwData->s_lfEB.lfWeight = 0; + s_pWvwData->s_lfEB.lfItalic = 0; + s_pWvwData->s_lfEB.lfUnderline = 0; + s_pWvwData->s_lfEB.lfStrikeOut = 0; + s_pWvwData->s_lfEB.lfCharSet = DEFAULT_CHARSET; - s_pWvwData->s_lfEB.lfQuality = DEFAULT_QUALITY; - s_pWvwData->s_lfEB.lfPitchAndFamily = FF_DONTCARE; - strcpy( s_pWvwData->s_lfEB.lfFaceName, "Arial" ); + s_pWvwData->s_lfEB.lfQuality = DEFAULT_QUALITY; + s_pWvwData->s_lfEB.lfPitchAndFamily = FF_DONTCARE; + strcpy( s_pWvwData->s_lfEB.lfFaceName, "Arial" ); - s_pWvwData->s_lfCX.lfHeight = pWindowData->fontHeight - 2; - s_pWvwData->s_lfCX.lfWidth = 0; - s_pWvwData->s_lfCX.lfEscapement = 0; - s_pWvwData->s_lfCX.lfOrientation = 0; - s_pWvwData->s_lfCX.lfWeight = 0; - s_pWvwData->s_lfCX.lfItalic = 0; - s_pWvwData->s_lfCX.lfUnderline = 0; - s_pWvwData->s_lfCX.lfStrikeOut = 0; - s_pWvwData->s_lfCX.lfCharSet = DEFAULT_CHARSET; + s_pWvwData->s_lfCX.lfHeight = pWindowData->fontHeight - 2; + s_pWvwData->s_lfCX.lfWidth = 0; + s_pWvwData->s_lfCX.lfEscapement = 0; + s_pWvwData->s_lfCX.lfOrientation = 0; + s_pWvwData->s_lfCX.lfWeight = 0; + s_pWvwData->s_lfCX.lfItalic = 0; + s_pWvwData->s_lfCX.lfUnderline = 0; + s_pWvwData->s_lfCX.lfStrikeOut = 0; + s_pWvwData->s_lfCX.lfCharSet = DEFAULT_CHARSET; - s_pWvwData->s_lfCX.lfQuality = DEFAULT_QUALITY; - s_pWvwData->s_lfCX.lfPitchAndFamily = FF_DONTCARE; - strcpy( s_pWvwData->s_lfCX.lfFaceName, "Arial" ); + s_pWvwData->s_lfCX.lfQuality = DEFAULT_QUALITY; + s_pWvwData->s_lfCX.lfPitchAndFamily = FF_DONTCARE; + strcpy( s_pWvwData->s_lfCX.lfFaceName, "Arial" ); - s_pWvwData->s_lfST.lfHeight = pWindowData->fontHeight ; - s_pWvwData->s_lfST.lfWidth = 0; - s_pWvwData->s_lfST.lfEscapement = 0; - s_pWvwData->s_lfST.lfOrientation = 0; - s_pWvwData->s_lfST.lfWeight = 0; - s_pWvwData->s_lfST.lfItalic = 0; - s_pWvwData->s_lfST.lfUnderline = 0; - s_pWvwData->s_lfST.lfStrikeOut = 0; - s_pWvwData->s_lfST.lfCharSet = DEFAULT_CHARSET; + s_pWvwData->s_lfST.lfHeight = pWindowData->fontHeight; + s_pWvwData->s_lfST.lfWidth = 0; + s_pWvwData->s_lfST.lfEscapement = 0; + s_pWvwData->s_lfST.lfOrientation = 0; + s_pWvwData->s_lfST.lfWeight = 0; + s_pWvwData->s_lfST.lfItalic = 0; + s_pWvwData->s_lfST.lfUnderline = 0; + s_pWvwData->s_lfST.lfStrikeOut = 0; + s_pWvwData->s_lfST.lfCharSet = DEFAULT_CHARSET; - s_pWvwData->s_lfST.lfQuality = DEFAULT_QUALITY; - s_pWvwData->s_lfST.lfPitchAndFamily = FF_DONTCARE; - strcpy( s_pWvwData->s_lfST.lfFaceName, pWindowData->fontFace); + s_pWvwData->s_lfST.lfQuality = DEFAULT_QUALITY; + s_pWvwData->s_lfST.lfPitchAndFamily = FF_DONTCARE; + strcpy( s_pWvwData->s_lfST.lfFaceName, pWindowData->fontFace ); - s_pWvwData->s_sApp->pSymWVW_PAINT = hb_dynsymFind( "WVW_PAINT" ) ; - s_pWvwData->s_sApp->pSymWVW_SETFOCUS = hb_dynsymFind( "WVW_SETFOCUS" ) ; - s_pWvwData->s_sApp->pSymWVW_KILLFOCUS= hb_dynsymFind( "WVW_KILLFOCUS" ) ; - s_pWvwData->s_sApp->pSymWVW_MOUSE = hb_dynsymFind( "WVW_MOUSE" ) ; - s_pWvwData->s_sApp->pSymWVW_MENUSELECT = hb_dynsymFind( "WVW_MENUSELECT" ) ; - s_pWvwData->s_sApp->pSymWVW_TBMOUSE = hb_dynsymFind( "WVW_TBMOUSE" ) ; + s_pWvwData->s_sApp->pSymWVW_PAINT = hb_dynsymFind( "WVW_PAINT" ); + s_pWvwData->s_sApp->pSymWVW_SETFOCUS = hb_dynsymFind( "WVW_SETFOCUS" ); + s_pWvwData->s_sApp->pSymWVW_KILLFOCUS = hb_dynsymFind( "WVW_KILLFOCUS" ); + s_pWvwData->s_sApp->pSymWVW_MOUSE = hb_dynsymFind( "WVW_MOUSE" ); + s_pWvwData->s_sApp->pSymWVW_MENUSELECT = hb_dynsymFind( "WVW_MENUSELECT" ); + s_pWvwData->s_sApp->pSymWVW_TBMOUSE = hb_dynsymFind( "WVW_TBMOUSE" ); - s_pWvwData->s_sApp->pSymWVW_SIZE = hb_dynsymFind( "WVW_SIZE" ) ; - s_pWvwData->s_sApp->pSymWVW_MOVE = hb_dynsymFind( "WVW_MOVE" ) ; + s_pWvwData->s_sApp->pSymWVW_SIZE = hb_dynsymFind( "WVW_SIZE" ); + s_pWvwData->s_sApp->pSymWVW_MOVE = hb_dynsymFind( "WVW_MOVE" ); - s_pWvwData->s_sApp->pSymWVW_INPUTFOCUS = hb_dynsymFind( "WVW_INPUTFOCUS" ) ; - s_pWvwData->s_sApp->pSymWVW_TIMER = hb_dynsymFind( "WVW_TIMER" ) ; - s_pWvwData->s_sApp->pSymWVW_ONCTLCOLOR = hb_dynsymFind( "WVW_ONCTLCOLOR" ) ; + s_pWvwData->s_sApp->pSymWVW_INPUTFOCUS = hb_dynsymFind( "WVW_INPUTFOCUS" ); + s_pWvwData->s_sApp->pSymWVW_TIMER = hb_dynsymFind( "WVW_TIMER" ); + s_pWvwData->s_sApp->pSymWVW_ONCTLCOLOR = hb_dynsymFind( "WVW_ONCTLCOLOR" ); - h = LoadLibrary( "msimg32.dll" ); - if ( h ) - { - s_pWvwData->s_sApp->pfnGF = ( wvwGradientFill ) GetProcAddress( h, "GradientFill" ); - if ( s_pWvwData->s_sApp->pfnGF ) + h = LoadLibrary( "msimg32.dll" ); + if( h ) { - s_pWvwData->s_sApp->hMSImg32 = h; + s_pWvwData->s_sApp->pfnGF = ( wvwGradientFill ) GetProcAddress( h, "GradientFill" ); + if( s_pWvwData->s_sApp->pfnGF ) + { + s_pWvwData->s_sApp->hMSImg32 = h; + } } - } - for ( iIndex = 0; iIndex < WVW_DLGML_MAX; iIndex++ ) - { - s_pWvwData->s_sApp->hDlgModeless[ iIndex ] = NULL; + for( iIndex = 0; iIndex < WVW_DLGML_MAX; iIndex++ ) + { + s_pWvwData->s_sApp->hDlgModeless[ iIndex ] = NULL; - s_pWvwData->s_sApp->pFunc[ iIndex ] = NULL; - s_pWvwData->s_sApp->iType[ iIndex ] = (int) NULL; - } + s_pWvwData->s_sApp->pFunc[ iIndex ] = NULL; + s_pWvwData->s_sApp->iType[ iIndex ] = ( int ) NULL; + } - for ( iIndex = 0; iIndex < WVW_DLGMD_MAX; iIndex++ ) - { - s_pWvwData->s_sApp->hDlgModal[ iIndex ] = NULL; - s_pWvwData->s_sApp->pFuncModal[ iIndex ] = NULL; - s_pWvwData->s_sApp->iTypeModal[ iIndex ] = ( int ) NULL; - } + for( iIndex = 0; iIndex < WVW_DLGMD_MAX; iIndex++ ) + { + s_pWvwData->s_sApp->hDlgModal[ iIndex ] = NULL; + s_pWvwData->s_sApp->pFuncModal[ iIndex ] = NULL; + s_pWvwData->s_sApp->iTypeModal[ iIndex ] = ( int ) NULL; + } - s_pWvwData->s_sApp->pbhBitmapList = NULL; - s_pWvwData->s_sApp->pphPictureList = NULL; + s_pWvwData->s_sApp->pbhBitmapList = NULL; + s_pWvwData->s_sApp->pphPictureList = NULL; - s_pWvwData->s_sApp->pbhUserBitmap = NULL; - s_pWvwData->s_sApp->uiBMcache = 0; - s_pWvwData->s_sApp->uiMaxBMcache = WVW_DEFAULT_MAX_BMCACHE; + s_pWvwData->s_sApp->pbhUserBitmap = NULL; + s_pWvwData->s_sApp->uiBMcache = 0; + s_pWvwData->s_sApp->uiMaxBMcache = WVW_DEFAULT_MAX_BMCACHE; - } - else - { + } + else + { - if (!s_pWvwData->s_bMainCoordMode) - { - pPrevWindow = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; - } - else - { - pPrevWindow = s_pWvwData->s_pWindows[ usWinNum-1 ]; - } + if( ! s_pWvwData->s_bMainCoordMode ) + { + pPrevWindow = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; + } + else + { + pPrevWindow = s_pWvwData->s_pWindows[ usWinNum - 1 ]; + } - pWindowData->byWinId = usWinNum; - strcpy(pWindowData->szWinName, lpszWinName); - pWindowData->usRowOfs = usRow1; - pWindowData->usColOfs = usCol1; - pWindowData->uiDispCount = 0; + pWindowData->byWinId = usWinNum; + strcpy( pWindowData->szWinName, lpszWinName ); + pWindowData->usRowOfs = usRow1; + pWindowData->usColOfs = usCol1; + pWindowData->uiDispCount = 0; - pWindowData->ROWS = usRow2-usRow1+1; - pWindowData->COLS = usCol2-usCol1+1; + pWindowData->ROWS = usRow2 - usRow1 + 1; + pWindowData->COLS = usCol2 - usCol1 + 1; - pWindowData->foreground = pPrevWindow->foreground; - pWindowData->background = pPrevWindow->background; - pWindowData->BUFFERSIZE = 0; - pWindowData->pColors = NULL; - pWindowData->pBuffer = NULL; - pWindowData->caretPos.x = 0; - pWindowData->caretPos.y = 0; + pWindowData->foreground = pPrevWindow->foreground; + pWindowData->background = pPrevWindow->background; + pWindowData->BUFFERSIZE = 0; + pWindowData->pColors = NULL; + pWindowData->pBuffer = NULL; + pWindowData->caretPos.x = 0; + pWindowData->caretPos.y = 0; - pWindowData->CaretSize = pPrevWindow->CaretSize; - pWindowData->mousePos.x = 0; - pWindowData->mousePos.y = 0; - pWindowData->MouseMove = pPrevWindow->MouseMove; - pWindowData->hWnd = NULL; - pWindowData->keyPointerIn = 0; - pWindowData->keyPointerOut = 0; - pWindowData->keyLast = 0; - memset( &pWindowData->Keys, 0, sizeof( pWindowData->Keys ) ); + pWindowData->CaretSize = pPrevWindow->CaretSize; + pWindowData->mousePos.x = 0; + pWindowData->mousePos.y = 0; + pWindowData->MouseMove = pPrevWindow->MouseMove; + pWindowData->hWnd = NULL; + pWindowData->keyPointerIn = 0; + pWindowData->keyPointerOut = 0; + pWindowData->keyLast = 0; + memset( &pWindowData->Keys, 0, sizeof( pWindowData->Keys ) ); - pWindowData->RectInvalid.left = -1 ; - pWindowData->PTEXTSIZE.x = pPrevWindow->PTEXTSIZE.x; - pWindowData->PTEXTSIZE.y = pPrevWindow->PTEXTSIZE.y; - pWindowData->fontHeight = pPrevWindow->fontHeight; - pWindowData->fontWidth = pPrevWindow->fontWidth; - pWindowData->fontWeight = pPrevWindow->fontWeight; - pWindowData->fontQuality = pPrevWindow->fontQuality; - strcpy( pWindowData->fontFace, pPrevWindow->fontFace); - pWindowData->LastMenuEvent = 0; - pWindowData->MenuKeyEvent = WVW_DEFAULT_MENUKEYEVENT; + pWindowData->RectInvalid.left = -1; + pWindowData->PTEXTSIZE.x = pPrevWindow->PTEXTSIZE.x; + pWindowData->PTEXTSIZE.y = pPrevWindow->PTEXTSIZE.y; + pWindowData->fontHeight = pPrevWindow->fontHeight; + pWindowData->fontWidth = pPrevWindow->fontWidth; + pWindowData->fontWeight = pPrevWindow->fontWeight; + pWindowData->fontQuality = pPrevWindow->fontQuality; + strcpy( pWindowData->fontFace, pPrevWindow->fontFace ); + pWindowData->LastMenuEvent = 0; + pWindowData->MenuKeyEvent = WVW_DEFAULT_MENUKEYEVENT; - pWindowData->CentreWindow = s_pWvwData->s_bDefCentreWindow; + pWindowData->CentreWindow = s_pWvwData->s_bDefCentreWindow; - /* two following parameters are meaningful only if CentreWindow is FALSE */ - pWindowData->HCentreWindow = s_pWvwData->s_bDefHCentreWindow; /* horizontally */ - pWindowData->VCentreWindow = s_pWvwData->s_bDefVCentreWindow; /* vertically */ + /* two following parameters are meaningful only if CentreWindow is FALSE */ + pWindowData->HCentreWindow = s_pWvwData->s_bDefHCentreWindow; /* horizontally */ + pWindowData->VCentreWindow = s_pWvwData->s_bDefVCentreWindow; /* vertically */ - pWindowData->CodePage = pPrevWindow->CodePage; + pWindowData->CodePage = pPrevWindow->CodePage; - pWindowData->InvalidateWindow = TRUE; - pWindowData->EnableShortCuts = pPrevWindow->EnableShortCuts; + pWindowData->InvalidateWindow = TRUE; + pWindowData->EnableShortCuts = pPrevWindow->EnableShortCuts; - pWindowData->bToolTipActive = FALSE; - pWindowData->hWndTT = NULL; - pWindowData->hPopup = NULL; + pWindowData->bToolTipActive = FALSE; + pWindowData->hWndTT = NULL; + pWindowData->hPopup = NULL; - } + } - pWindowData->bIgnoreWM_SYSCHAR = FALSE; - pWindowData->bPaint = FALSE; - pWindowData->bGetFocus = FALSE; + pWindowData->bIgnoreWM_SYSCHAR = FALSE; + pWindowData->bPaint = FALSE; + pWindowData->bGetFocus = FALSE; - pWindowData->byLineSpacing = s_pWvwData->s_byDefLineSpacing; + pWindowData->byLineSpacing = s_pWvwData->s_byDefLineSpacing; - pWindowData->iLSpaceColor = s_pWvwData->s_iDefLSpaceColor; + pWindowData->iLSpaceColor = s_pWvwData->s_iDefLSpaceColor; - pWindowData->bPaintPending = FALSE; - hb_wvw_InitPendingRect( pWindowData ); + pWindowData->bPaintPending = FALSE; + hb_wvw_InitPendingRect( pWindowData ); - pWindowData->hStatusBar = NULL; - pWindowData->usSBHeight= 0; + pWindowData->hStatusBar = NULL; + pWindowData->usSBHeight = 0; - pWindowData->bSBPaint = FALSE; - pWindowData->cSBColorForeground = 0; - pWindowData->cSBColorBackground = 0; + pWindowData->bSBPaint = FALSE; + pWindowData->cSBColorForeground = 0; + pWindowData->cSBColorBackground = 0; - pWindowData->hToolBar = NULL; - pWindowData->usTBHeight= 0; + pWindowData->hToolBar = NULL; + pWindowData->usTBHeight = 0; - pWindowData->pcdCtrlList = NULL; + pWindowData->pcdCtrlList = NULL; - pWindowData->hPBfont = NULL; /* will be created on first creation of pushbutton, if ever */ + pWindowData->hPBfont = NULL; /* will be created on first creation of pushbutton, if ever */ - pWindowData->hCBfont = NULL; /* will be created on first creation of combobox, if ever */ + pWindowData->hCBfont = NULL; /* will be created on first creation of combobox, if ever */ - pWindowData->hEBfont = NULL; /* will be created on first creation of editbox, if ever */ + pWindowData->hEBfont = NULL; /* will be created on first creation of editbox, if ever */ - pWindowData->hCXfont = NULL; /* will be created on first creation of checkbox, if ever */ + pWindowData->hCXfont = NULL; /* will be created on first creation of checkbox, if ever */ - pWindowData->hSBfont = NULL; /* will be created on first creation of statusbar, if ever */ + pWindowData->hSBfont = NULL; /* will be created on first creation of statusbar, if ever */ - pWindowData->hSTfont = NULL; /* will be created on first creation of static control, if ever */ + pWindowData->hSTfont = NULL; /* will be created on first creation of static control, if ever */ - s_pWvwData->s_usCurWindow = usWinNum; + s_pWvwData->s_usCurWindow = usWinNum; } @@ -5207,50 +5148,51 @@ static void hb_gtInitStatics( UINT usWinNum, LPCTSTR lpszWinName, USHORT usRow1, /*NOTE: current design allows topmost window only who accepts input */ -static void hb_gt_wvwAddCharToInputQueue ( int iKey ) +static void hb_gt_wvwAddCharToInputQueue( int iKey ) { - UINT uiWinNum = s_pWvwData->s_usNumWindows-1; - int iNextPos = s_pWvwData->s_pWindows[ uiWinNum ]->keyPointerIn; - if ( iKey == K_MOUSEMOVE || iKey == K_NCMOUSEMOVE) - { - if ( s_pWvwData->s_pWindows[ uiWinNum ]->keyLast == iKey && s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->keyPointerIn != s_pWvwData->s_pWindows[ uiWinNum ]->keyPointerOut ) - return; - } + UINT uiWinNum = s_pWvwData->s_usNumWindows - 1; + int iNextPos = s_pWvwData->s_pWindows[ uiWinNum ]->keyPointerIn; - s_pWvwData->s_pWindows[ uiWinNum ]->Keys[iNextPos] = s_pWvwData->s_pWindows[ uiWinNum ]->keyLast = iKey; - if ( ++iNextPos >= WVW_CHAR_QUEUE_SIZE ) - iNextPos = 0; - if ( iNextPos != s_pWvwData->s_pWindows[ uiWinNum ]->keyPointerOut ) - s_pWvwData->s_pWindows[ uiWinNum ] ->keyPointerIn = iNextPos ; + if( iKey == K_MOUSEMOVE || iKey == K_NCMOUSEMOVE ) + { + if( s_pWvwData->s_pWindows[ uiWinNum ]->keyLast == iKey && s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->keyPointerIn != s_pWvwData->s_pWindows[ uiWinNum ]->keyPointerOut ) + return; + } + + s_pWvwData->s_pWindows[ uiWinNum ]->Keys[ iNextPos ] = s_pWvwData->s_pWindows[ uiWinNum ]->keyLast = iKey; + if( ++iNextPos >= WVW_CHAR_QUEUE_SIZE ) + iNextPos = 0; + if( iNextPos != s_pWvwData->s_pWindows[ uiWinNum ]->keyPointerOut ) + s_pWvwData->s_pWindows[ uiWinNum ]->keyPointerIn = iNextPos; } -USHORT hb_gt_wvwGetMouseX ( WIN_DATA * pWindowData ) +USHORT hb_gt_wvwGetMouseX( WIN_DATA * pWindowData ) { - return( (SHORT) pWindowData->mousePos.x ); + return ( SHORT ) pWindowData->mousePos.x; } -USHORT hb_gt_wvwGetMouseY ( WIN_DATA * pWindowData ) +USHORT hb_gt_wvwGetMouseY( WIN_DATA * pWindowData ) { - return( (SHORT) pWindowData->mousePos.y ); + return ( SHORT ) pWindowData->mousePos.y; } -static void hb_gt_wvwSetMouseX ( WIN_DATA * pWindowData, USHORT ix ) +static void hb_gt_wvwSetMouseX( WIN_DATA * pWindowData, USHORT ix ) { - pWindowData->mousePos.x = ix; + pWindowData->mousePos.x = ix; } -static void hb_gt_wvwSetMouseY ( WIN_DATA * pWindowData, USHORT iy ) +static void hb_gt_wvwSetMouseY( WIN_DATA * pWindowData, USHORT iy ) { - pWindowData->mousePos.y = iy; + pWindowData->mousePos.y = iy; } @@ -5259,27 +5201,27 @@ static void hb_gt_wvwSetMouseY ( WIN_DATA * pWindowData, USHORT iy ) * the specified caret position * It then determines the invalid rectangle, so the string will be displayed */ -static void hb_gt_wvwSetStringInTextBuffer( WIN_DATA * pWindowData, int col, int row, BYTE color, BYTE attr, BYTE *sBuffer, ULONG length ) +static void hb_gt_wvwSetStringInTextBuffer( WIN_DATA * pWindowData, int col, int row, BYTE color, BYTE attr, BYTE * sBuffer, ULONG length ) { - POINT end = { 0 }; - USHORT index; + POINT end = { 0 }; + USHORT index; - HB_SYMBOL_UNUSED( attr ); + HB_SYMBOL_UNUSED( attr ); - /* determine the index and put the string into the TextBuffer - */ - index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, (USHORT)col, (USHORT)row ); - if ( (length + index) <= (ULONG) pWindowData->BUFFERSIZE ) - { - memcpy( ( pWindowData->pBuffer+index ), sBuffer, length ); + /* determine the index and put the string into the TextBuffer + */ + index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, ( USHORT ) col, ( USHORT ) row ); + if( ( length + index ) <= ( ULONG ) pWindowData->BUFFERSIZE ) + { + memcpy( ( pWindowData->pBuffer + index ), sBuffer, length ); - memset( ( pWindowData->pColors+index ), color, length ); + memset( ( pWindowData->pColors + index ), color, length ); - /* determine bounds of rect around character to refresh - */ - end = hb_gt_wvwGetColRowForTextBuffer( pWindowData, index + ( ((USHORT)(ULONG)(length)) -1 ) ); - hb_gt_wvwSetInvalidRect( pWindowData, (USHORT) col, (USHORT) row, (USHORT) end.x, (USHORT) end.y ); - } + /* determine bounds of rect around character to refresh + */ + end = hb_gt_wvwGetColRowForTextBuffer( pWindowData, index + ( ( ( USHORT ) ( ULONG ) ( length ) ) - 1 ) ); + hb_gt_wvwSetInvalidRect( pWindowData, ( USHORT ) col, ( USHORT ) row, ( USHORT ) end.x, ( USHORT ) end.y ); + } } @@ -5287,391 +5229,387 @@ static void hb_gt_wvwSetStringInTextBuffer( WIN_DATA * pWindowData, int col, int static void hb_gt_wvwSetCaretOn( WIN_DATA * pWindowData, BOOL bOn ) { - if ( s_pWvwData->s_sApp->CaretExist ) - { - if ( bOn ) - { - hb_gt_wvwSetCaretPos(pWindowData); - ShowCaret( pWindowData->hWnd ); - } - else - { - HideCaret( pWindowData->hWnd ); - } - } + if( s_pWvwData->s_sApp->CaretExist ) + { + if( bOn ) + { + hb_gt_wvwSetCaretPos( pWindowData ); + ShowCaret( pWindowData->hWnd ); + } + else + { + HideCaret( pWindowData->hWnd ); + } + } - s_pWvwData->s_sApp->displayCaret = bOn; + s_pWvwData->s_sApp->displayCaret = bOn; } static void hb_gt_wvwHandleMenuSelection( int menuIndex ) { - s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->LastMenuEvent = menuIndex ; - hb_gt_wvwAddCharToInputQueue( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->MenuKeyEvent ); + s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->LastMenuEvent = menuIndex; + hb_gt_wvwAddCharToInputQueue( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->MenuKeyEvent ); } static void hb_gt_wvwMouseEvent( WIN_DATA * pWindowData, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - POINT xy = { 0 }, colrow = { 0 } ; - SHORT keyCode = 0; - SHORT keyState = 0; - ULONG lPopupRet ; + POINT xy = { 0 }, colrow = { 0 }; + SHORT keyCode = 0; + SHORT keyState = 0; + ULONG lPopupRet; - HB_SYMBOL_UNUSED( hWnd ); - HB_SYMBOL_UNUSED( wParam ); + HB_SYMBOL_UNUSED( hWnd ); + HB_SYMBOL_UNUSED( wParam ); - if ( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ) - { - if ( ! pWindowData->MouseMove ) - { - return; - } - } - - xy.x = LOWORD( lParam ); - xy.y = HIWORD( lParam ); - - colrow = hb_gt_wvwGetColRowFromXY( pWindowData, (SHORT) xy.x, (SHORT) xy.y); - - hb_gt_wvwSetMouseX( pWindowData, (SHORT) colrow.x ); - hb_gt_wvwSetMouseY( pWindowData, (SHORT) colrow.y ); - - switch( message ) - { - case WM_LBUTTONDBLCLK: - keyCode = K_LDBLCLK; - break; - - case WM_RBUTTONDBLCLK: - keyCode = K_RDBLCLK; - break; - - case WM_LBUTTONDOWN: + if( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ) + { + if( ! pWindowData->MouseMove ) { - - HWND hWndFocus = (HWND) GetFocus(); - - if ( GetControlClass(pWindowData->byWinId, hWndFocus) > 0 ) - { - - SetFocus(hWnd); - } - + return; } - keyCode = K_LBUTTONDOWN; - break; + } - case WM_RBUTTONDOWN: - keyCode = K_RBUTTONDOWN; - break; + xy.x = LOWORD( lParam ); + xy.y = HIWORD( lParam ); - case WM_LBUTTONUP: - keyCode = K_LBUTTONUP; - break; + colrow = hb_gt_wvwGetColRowFromXY( pWindowData, ( SHORT ) xy.x, ( SHORT ) xy.y ); - case WM_RBUTTONUP: + hb_gt_wvwSetMouseX( pWindowData, ( SHORT ) colrow.x ); + hb_gt_wvwSetMouseY( pWindowData, ( SHORT ) colrow.y ); - if ( pWindowData->hPopup ) + switch( message ) + { + case WM_LBUTTONDBLCLK: + keyCode = K_LDBLCLK; + break; + + case WM_RBUTTONDBLCLK: + keyCode = K_RDBLCLK; + break; + + case WM_LBUTTONDOWN: { - GetCursorPos( &xy ); - lPopupRet = TrackPopupMenu( pWindowData->hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, xy.x, xy.y, 0, hWnd, NULL ); - if ( lPopupRet ) + + HWND hWndFocus = ( HWND ) GetFocus(); + + if( GetControlClass( pWindowData->byWinId, hWndFocus ) > 0 ) { - hb_gt_wvwAddCharToInputQueue( lPopupRet ); + + SetFocus( hWnd ); } - return; + } - else + keyCode = K_LBUTTONDOWN; + break; + + case WM_RBUTTONDOWN: + keyCode = K_RBUTTONDOWN; + break; + + case WM_LBUTTONUP: + keyCode = K_LBUTTONUP; + break; + + case WM_RBUTTONUP: + + if( pWindowData->hPopup ) + { + GetCursorPos( &xy ); + lPopupRet = TrackPopupMenu( pWindowData->hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, xy.x, xy.y, 0, hWnd, NULL ); + if( lPopupRet ) + { + hb_gt_wvwAddCharToInputQueue( lPopupRet ); + } + return; + } + else + { + keyCode = K_RBUTTONUP; + break; + } + + case WM_MBUTTONDOWN: + keyCode = K_MBUTTONDOWN; + break; + + case WM_MBUTTONUP: + keyCode = K_MBUTTONUP; + break; + + case WM_MBUTTONDBLCLK: + keyCode = K_MDBLCLK; + break; + + case WM_MOUSEMOVE: + keyState = ( SHORT ) wParam; + + if( keyState == MK_LBUTTON ) + { + keyCode = K_MMLEFTDOWN; + } + else if( keyState == MK_RBUTTON ) + { + keyCode = K_MMRIGHTDOWN; + } + else if( keyState == MK_MBUTTON ) + { + keyCode = K_MMMIDDLEDOWN; + } + else + { + keyCode = K_MOUSEMOVE; + } + break; + + case WM_MOUSEWHEEL: + keyState = HIWORD( wParam ); + + if( keyState > 0 ) + { + keyCode = K_MWFORWARD; + } + else + { + keyCode = K_MWBACKWARD; + } + + break; + + case WM_NCMOUSEMOVE: + keyCode = K_NCMOUSEMOVE; + break; + } + + if( s_pWvwData->s_sApp->pSymWVW_MOUSE && keyCode != 0 ) + { + + if( hb_vmRequestReenter() ) { - keyCode = K_RBUTTONUP; - break; + + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_MOUSE ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( pWindowData->byWinId ) ); + hb_vmPushLong( ( SHORT ) keyCode ); + hb_vmPushLong( ( SHORT ) colrow.y ); + hb_vmPushLong( ( SHORT ) colrow.x ); + hb_vmPushLong( ( SHORT ) keyState ); + hb_vmDo( 5 ); + + hb_vmRequestRestore(); } + } - case WM_MBUTTONDOWN: - keyCode = K_MBUTTONDOWN; - break; - - case WM_MBUTTONUP: - keyCode = K_MBUTTONUP; - break; - - case WM_MBUTTONDBLCLK: - keyCode = K_MDBLCLK; - break; - - case WM_MOUSEMOVE: - keyState = (SHORT)wParam; - - if ( keyState == MK_LBUTTON ) - { - keyCode = K_MMLEFTDOWN; - } - else if ( keyState == MK_RBUTTON ) - { - keyCode = K_MMRIGHTDOWN; - } - else if ( keyState == MK_MBUTTON ) - { - keyCode = K_MMMIDDLEDOWN; - } - else - { - keyCode = K_MOUSEMOVE; - } - break; - - case WM_MOUSEWHEEL: - keyState = HIWORD( wParam ); - - if ( keyState > 0 ) - { - keyCode = K_MWFORWARD; - } - else - { - keyCode = K_MWBACKWARD; - } - - break; - - case WM_NCMOUSEMOVE: - { - keyCode = K_NCMOUSEMOVE; - } - break; - } - - if ( s_pWvwData->s_sApp->pSymWVW_MOUSE && keyCode != 0 ) - { - - if( hb_vmRequestReenter() ) - { - - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_MOUSE ); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (pWindowData->byWinId) ); - hb_vmPushLong( ( SHORT ) keyCode ); - hb_vmPushLong( ( SHORT ) colrow.y ); - hb_vmPushLong( ( SHORT ) colrow.x ); - hb_vmPushLong( ( SHORT ) keyState ); - hb_vmDo( 5 ); - - hb_vmRequestRestore(); - } - } - - hb_gt_wvwAddCharToInputQueue( keyCode ); + hb_gt_wvwAddCharToInputQueue( keyCode ); } static void hb_gt_wvwTBMouseEvent( WIN_DATA * pWindowData, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - POINT xy = { 0 }, colrow = { 0 } ; - SHORT keyCode = 0; - SHORT keyState = 0; - ULONG lPopupRet ; + POINT xy = { 0 }, colrow = { 0 }; + SHORT keyCode = 0; + SHORT keyState = 0; + ULONG lPopupRet; - HB_SYMBOL_UNUSED( hWnd ); - HB_SYMBOL_UNUSED( wParam ); + HB_SYMBOL_UNUSED( hWnd ); + HB_SYMBOL_UNUSED( wParam ); - if ( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ) - { - if ( ! pWindowData->MouseMove ) - { - return; - } - } - - xy.x = LOWORD( lParam ); - xy.y = HIWORD( lParam ); - - colrow = hb_gt_wvwTBGetColRowFromXY( pWindowData, (SHORT) xy.x, (SHORT) xy.y); - - hb_gt_wvwSetMouseX( pWindowData, (SHORT) colrow.x ); - hb_gt_wvwSetMouseY( pWindowData, (SHORT) colrow.y ); - - switch( message ) - { - case WM_LBUTTONDBLCLK: - keyCode = K_LDBLCLK; - break; - - case WM_RBUTTONDBLCLK: - keyCode = K_RDBLCLK; - break; - - case WM_LBUTTONDOWN: + if( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ) + { + if( ! pWindowData->MouseMove ) { - - HWND hWndFocus = (HWND) GetFocus(); - - if ( GetControlClass(pWindowData->byWinId, hWndFocus) > 0 ) - { - - SetFocus(hWnd); - } - + return; } - keyCode = K_LBUTTONDOWN; - break; + } - case WM_RBUTTONDOWN: - keyCode = K_RBUTTONDOWN; - break; + xy.x = LOWORD( lParam ); + xy.y = HIWORD( lParam ); - case WM_LBUTTONUP: - keyCode = K_LBUTTONUP; - break; + colrow = hb_gt_wvwTBGetColRowFromXY( pWindowData, ( SHORT ) xy.x, ( SHORT ) xy.y ); - case WM_RBUTTONUP: + hb_gt_wvwSetMouseX( pWindowData, ( SHORT ) colrow.x ); + hb_gt_wvwSetMouseY( pWindowData, ( SHORT ) colrow.y ); - if ( pWindowData->hPopup ) + switch( message ) + { + case WM_LBUTTONDBLCLK: + keyCode = K_LDBLCLK; + break; + + case WM_RBUTTONDBLCLK: + keyCode = K_RDBLCLK; + break; + + case WM_LBUTTONDOWN: { - GetCursorPos( &xy ); - lPopupRet = TrackPopupMenu( pWindowData->hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, xy.x, xy.y, 0, hWnd, NULL ); - if ( lPopupRet ) + + HWND hWndFocus = ( HWND ) GetFocus(); + + if( GetControlClass( pWindowData->byWinId, hWndFocus ) > 0 ) { - hb_gt_wvwAddCharToInputQueue( lPopupRet ); + + SetFocus( hWnd ); } - return; + } - else + keyCode = K_LBUTTONDOWN; + break; + + case WM_RBUTTONDOWN: + keyCode = K_RBUTTONDOWN; + break; + + case WM_LBUTTONUP: + keyCode = K_LBUTTONUP; + break; + + case WM_RBUTTONUP: + + if( pWindowData->hPopup ) + { + GetCursorPos( &xy ); + lPopupRet = TrackPopupMenu( pWindowData->hPopup, TPM_CENTERALIGN + TPM_RETURNCMD, xy.x, xy.y, 0, hWnd, NULL ); + if( lPopupRet ) + { + hb_gt_wvwAddCharToInputQueue( lPopupRet ); + } + return; + } + else + { + keyCode = K_RBUTTONUP; + break; + } + + case WM_MBUTTONDOWN: + keyCode = K_MBUTTONDOWN; + break; + + case WM_MBUTTONUP: + keyCode = K_MBUTTONUP; + break; + + case WM_MBUTTONDBLCLK: + keyCode = K_MDBLCLK; + break; + + case WM_MOUSEMOVE: + keyState = ( SHORT ) wParam; + + if( keyState == MK_LBUTTON ) + { + keyCode = K_MMLEFTDOWN; + } + else if( keyState == MK_RBUTTON ) + { + keyCode = K_MMRIGHTDOWN; + } + else if( keyState == MK_MBUTTON ) + { + keyCode = K_MMMIDDLEDOWN; + } + else + { + keyCode = K_MOUSEMOVE; + } + break; + + case WM_MOUSEWHEEL: + keyState = HIWORD( wParam ); + + if( keyState > 0 ) + { + keyCode = K_MWFORWARD; + } + else + { + keyCode = K_MWBACKWARD; + } + + break; + + case WM_NCMOUSEMOVE: + keyCode = K_NCMOUSEMOVE; + break; + } + + if( s_pWvwData->s_sApp->pSymWVW_TBMOUSE && keyCode != 0 ) + { + if( hb_vmRequestReenter() ) { - keyCode = K_RBUTTONUP; - break; + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_TBMOUSE ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( pWindowData->byWinId ) ); + hb_vmPushLong( ( SHORT ) keyCode ); + hb_vmPushLong( ( SHORT ) colrow.y ); + hb_vmPushLong( ( SHORT ) colrow.x ); + hb_vmPushLong( ( SHORT ) keyState ); + hb_vmDo( 5 ); + + hb_vmRequestRestore(); } - case WM_MBUTTONDOWN: - keyCode = K_MBUTTONDOWN; - break; - - case WM_MBUTTONUP: - keyCode = K_MBUTTONUP; - break; - - case WM_MBUTTONDBLCLK: - keyCode = K_MDBLCLK; - break; - - case WM_MOUSEMOVE: - keyState = (SHORT)wParam; - - if ( keyState == MK_LBUTTON ) - { - keyCode = K_MMLEFTDOWN; - } - else if ( keyState == MK_RBUTTON ) - { - keyCode = K_MMRIGHTDOWN; - } - else if ( keyState == MK_MBUTTON ) - { - keyCode = K_MMMIDDLEDOWN; - } - else - { - keyCode = K_MOUSEMOVE; - } - break; - - case WM_MOUSEWHEEL: - keyState = HIWORD( wParam ); - - if ( keyState > 0 ) - { - keyCode = K_MWFORWARD; - } - else - { - keyCode = K_MWBACKWARD; - } - - break; - - case WM_NCMOUSEMOVE: - { - keyCode = K_NCMOUSEMOVE; - } - break; - } - - if ( s_pWvwData->s_sApp->pSymWVW_TBMOUSE && keyCode != 0 ) - { - if( hb_vmRequestReenter() ) - { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_TBMOUSE ); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (pWindowData->byWinId) ); - hb_vmPushLong( ( SHORT ) keyCode ); - hb_vmPushLong( ( SHORT ) colrow.y ); - hb_vmPushLong( ( SHORT ) colrow.x ); - hb_vmPushLong( ( SHORT ) keyState ); - hb_vmDo( 5 ); - - hb_vmRequestRestore(); - } - - } + } - hb_gt_wvwAddCharToInputQueue( keyCode ); + hb_gt_wvwAddCharToInputQueue( keyCode ); } static void hb_gt_wvwWindowPrologue( void ) { - UINT uiWindow; - if (s_pWvwData->s_usNumWindows >= WVW_MAXWINDOWS) - { - /* Runtime error - */ - hb_errRT_TERM( EG_BOUND, 10001, "Maximum Number of Windows Exceeded", "hb_gt_wvwWindowPrologue()", 0, 0 ); - } + UINT uiWindow; - s_pWvwData->s_usNumWindows++; - uiWindow = s_pWvwData->s_usNumWindows ; - s_pWvwData->s_pWindows[ uiWindow - 1] = (WIN_DATA *) hb_xgrab( sizeof( WIN_DATA ) ); - memset( s_pWvwData->s_pWindows[ uiWindow - 1], 0, sizeof( WIN_DATA ) ) ; + if( s_pWvwData->s_usNumWindows >= WVW_MAXWINDOWS ) + { + /* Runtime error + */ + hb_errRT_TERM( EG_BOUND, 10001, "Maximum Number of Windows Exceeded", "hb_gt_wvwWindowPrologue()", 0, 0 ); + } + + s_pWvwData->s_usNumWindows++; + uiWindow = s_pWvwData->s_usNumWindows; + s_pWvwData->s_pWindows[ uiWindow - 1 ] = ( WIN_DATA * ) hb_xgrab( sizeof( WIN_DATA ) ); + memset( s_pWvwData->s_pWindows[ uiWindow - 1 ], 0, sizeof( WIN_DATA ) ); } static void hb_gt_wvwWindowEpilogue( void ) { - if (s_pWvwData->s_usNumWindows == 0) - { + if( s_pWvwData->s_usNumWindows == 0 ) + { - hb_errRT_TERM( EG_BOUND, 10001, "No more window to destroy", "hb_gt_wvwWindowEpilogue()", 0, 0 ); - } - hb_xfree(s_pWvwData->s_pWindows[s_pWvwData->s_usNumWindows-1]); - s_pWvwData->s_usNumWindows--; + hb_errRT_TERM( EG_BOUND, 10001, "No more window to destroy", "hb_gt_wvwWindowEpilogue()", 0, 0 ); + } + hb_xfree( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ] ); + s_pWvwData->s_usNumWindows--; - if (s_pWvwData->s_usNumWindows>0) - { - s_pWvwData->s_usCurWindow = s_pWvwData->s_usNumWindows-1; - } + if( s_pWvwData->s_usNumWindows > 0 ) + { + s_pWvwData->s_usCurWindow = s_pWvwData->s_usNumWindows - 1; + } } static UINT hb_gt_wvwOpenWindow( LPCTSTR lpszWinName, int iRow1, int iCol1, int iRow2, int iCol2, - DWORD dwStyle, int iParentWin ) -{ /*assume s_pWvwData->s_usNumWindows >= 1 (ie. this will be the second or third window) - *this is similar to gt_init(), only gt_init() is for Main Window - *usRowx and usColx determine the initial position and initial size of window - *(relative to MAIN window, NOT to parent window) - */ + DWORD dwStyle, int iParentWin ) /*assume s_pWvwData->s_usNumWindows >= 1 (ie. this will be the second or third window) + *this is similar to gt_init(), only gt_init() is for Main Window + *usRowx and usColx determine the initial position and initial size of window + *(relative to MAIN window, NOT to parent window) + */ +{ + HWND hWnd; - HWND hWnd; + WNDCLASS wndclass; + WIN_DATA * pParentWindow; + int iCmdShow; - WNDCLASS wndclass; - WIN_DATA * pParentWindow; - int iCmdShow; + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvwOpenWindow()" ) ); - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvwOpenWindow()" ) ); - - /* in MainCoord Mode make sure that usRowx and usColx are within Main Window's bound! */ + /* in MainCoord Mode make sure that usRowx and usColx are within Main Window's bound! */ // if ( s_pWvwData->s_bMainCoordMode && (!hb_gt_wvwInWindow(0, iRow1, iCol1) || !hb_gt_wvwInWindow(0, iRow2, iCol2)) ) // { // MessageBox( NULL, TEXT( "Invalid (Row,Col)" ), @@ -5679,163 +5617,162 @@ static UINT hb_gt_wvwOpenWindow( LPCTSTR lpszWinName, int iRow1, int iCol1, int // return( 0 ); // } - if (iParentWin < 0) - { + if( iParentWin < 0 ) + { pParentWindow = NULL; - } - else - { + } + else + { - pParentWindow = s_pWvwData->s_pWindows[ (USHORT) iParentWin ]; - } + pParentWindow = s_pWvwData->s_pWindows[ ( USHORT ) iParentWin ]; + } - InitCommonControls(); + InitCommonControls(); - if ( !s_pWvwData->s_bSWRegistered && (s_pWvwData->s_usNumWindows == 1) ) - { - wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC; - wndclass.lpfnWndProc = hb_gt_wvwWndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = 0; - wndclass.hInstance = s_pWvwData->hInstance; - wndclass.hIcon = NULL; - wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); - wndclass.hbrBackground = NULL; - wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = s_pWvwData->szSubWinName; + if( ! s_pWvwData->s_bSWRegistered && ( s_pWvwData->s_usNumWindows == 1 ) ) + { + wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC; + wndclass.lpfnWndProc = hb_gt_wvwWndProc; + wndclass.cbClsExtra = 0; + wndclass.cbWndExtra = 0; + wndclass.hInstance = s_pWvwData->hInstance; + wndclass.hIcon = NULL; + wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); + wndclass.hbrBackground = NULL; + wndclass.lpszMenuName = NULL; + wndclass.lpszClassName = s_pWvwData->szSubWinName; - if ( ! RegisterClass( &wndclass ) ) + if( ! RegisterClass( &wndclass ) ) { - MessageBox( NULL, TEXT( "Failed to register class." ), - s_pWvwData->szSubWinName, MB_ICONERROR ); - return( 0 ); + MessageBox( NULL, TEXT( "Failed to register class." ), + s_pWvwData->szSubWinName, MB_ICONERROR ); + return 0; } s_pWvwData->s_bSWRegistered = TRUE; - } + } - hb_gt_wvwWindowPrologue( ); - hb_gtInitStatics(s_pWvwData->s_usNumWindows-1, lpszWinName, (USHORT)iRow1, (USHORT)iCol1, (USHORT)iRow2, (USHORT)iCol2); + hb_gt_wvwWindowPrologue(); + hb_gtInitStatics( s_pWvwData->s_usNumWindows - 1, lpszWinName, ( USHORT ) iRow1, ( USHORT ) iCol1, ( USHORT ) iRow2, ( USHORT ) iCol2 ); - hWnd = CreateWindow( s_pWvwData->szSubWinName, - lpszWinName, /* window name */ + hWnd = CreateWindow( s_pWvwData->szSubWinName, + lpszWinName, /* window name */ - dwStyle, + dwStyle, - /* notes: do NOT use WS_CHILD style for subwindows - child windows can NOT get input focus - TODO: handle WM_MOVE to simulate behaviour similar to WS_CHILD's - at least to keep subwindow "nearby" the MAIN window */ + /* notes: do NOT use WS_CHILD style for subwindows + child windows can NOT get input focus + TODO: handle WM_MOVE to simulate behaviour similar to WS_CHILD's + at least to keep subwindow "nearby" the MAIN window */ - 0, /*x */ - 0, /*y */ - CW_USEDEFAULT, /*width */ - CW_USEDEFAULT, /*height */ + 0, /*x */ + 0, /*y */ + CW_USEDEFAULT, /*width */ + CW_USEDEFAULT, /*height */ - (pParentWindow==NULL ? NULL : pParentWindow->hWnd), /*x parent window */ + ( pParentWindow == NULL ? NULL : pParentWindow->hWnd ), /*x parent window */ - NULL, /*menu */ - s_pWvwData->hInstance, /*x instance */ - NULL ); /*lpParam */ + NULL, /*menu */ + s_pWvwData->hInstance, /*x instance */ + NULL ); /*lpParam */ - s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hWnd = hWnd; + s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hWnd = hWnd; - if ( hWnd == NULL ) - { + if( hWnd == NULL ) + { LPVOID lpMsgBuf; FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, - NULL - ); + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), + ( LPTSTR ) &lpMsgBuf, + 0, + NULL + ); - MessageBox( NULL, (LPCTSTR)lpMsgBuf, "WINAPI failed to CreateWindow", MB_ICONERROR ); + MessageBox( NULL, ( LPCTSTR ) lpMsgBuf, "WINAPI failed to CreateWindow", MB_ICONERROR ); LocalFree( lpMsgBuf ); - hb_gt_wvwWindowEpilogue( ); + hb_gt_wvwWindowEpilogue(); - return( 0 ); - } + return 0; + } - if ( s_pWvwData->s_sApp->pSymWVW_PAINT && s_pWvwData->s_uiPaintRefresh > 0) - { - SetTimer( hWnd, WVW_ID_SYSTEM_TIMER, (UINT) s_pWvwData->s_uiPaintRefresh, NULL ); - } + if( s_pWvwData->s_sApp->pSymWVW_PAINT && s_pWvwData->s_uiPaintRefresh > 0 ) + { + SetTimer( hWnd, WVW_ID_SYSTEM_TIMER, ( UINT ) s_pWvwData->s_uiPaintRefresh, NULL ); + } - /* If you wish to show window the way you want, put somewhere in your application - * ANNOUNCE HB_NOSTARTUPWINDOW - * If so compiled, then you need to issue Wvw_ShowWindow( nWinNum, SW_RESTORE ) - * at the point you desire in your code. - */ - - if ( s_pWvwData->s_bNOSTARTUPSUBWINDOW ) - { - iCmdShow = SW_HIDE; - } - else - { - - iCmdShow = SW_SHOWNORMAL; - } - - ShowWindow( hWnd, iCmdShow ); - UpdateWindow( hWnd ); - - hb_gt_wvwSetWindowTitle( s_pWvwData->s_usNumWindows-1, (const char*) lpszWinName ); - - hb_gt_wvwCreateObjects(s_pWvwData->s_usNumWindows-1); - - s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hdc = GetDC( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hWnd ); - s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hCompDC = CreateCompatibleDC( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hdc ); - s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hIcon = NULL; - - /* - Apos o Device Context e as PENs e BRUSHes criados, atribuo uma PEN e um BRUSH qualquer apenas para pegar - o handle original da PEN e BRUSH do Device Context + /* If you wish to show window the way you want, put somewhere in your application + * ANNOUNCE HB_NOSTARTUPWINDOW + * If so compiled, then you need to issue Wvw_ShowWindow( nWinNum, SW_RESTORE ) + * at the point you desire in your code. */ - /* - E, logo apos, restaura aos valores originais mantendo em s_pWvwData->s_sApp os valores salvos para restauracao - quando for utilizar DeleteObject() + + if( s_pWvwData->s_bNOSTARTUPSUBWINDOW ) + { + iCmdShow = SW_HIDE; + } + else + { + + iCmdShow = SW_SHOWNORMAL; + } + + ShowWindow( hWnd, iCmdShow ); + UpdateWindow( hWnd ); + + hb_gt_wvwSetWindowTitle( s_pWvwData->s_usNumWindows - 1, ( const char * ) lpszWinName ); + + hb_gt_wvwCreateObjects( s_pWvwData->s_usNumWindows - 1 ); + + s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hdc = GetDC( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hWnd ); + s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hCompDC = CreateCompatibleDC( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hdc ); + s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hIcon = NULL; + + /* + Apos o Device Context e as PENs e BRUSHes criados, atribuo uma PEN e um BRUSH qualquer apenas para pegar + o handle original da PEN e BRUSH do Device Context */ - SelectObject( s_pWvwData->s_pWindows[s_pWvwData->s_usNumWindows-1]->hdc, (HPEN) s_pWvwData->s_sApp->OriginalPen ); - SelectObject( s_pWvwData->s_pWindows[s_pWvwData->s_usNumWindows-1]->hdc, (HBRUSH) s_pWvwData->s_sApp->OriginalBrush ); + /* + E, logo apos, restaura aos valores originais mantendo em s_pWvwData->s_sApp os valores salvos para restauracao + quando for utilizar DeleteObject() + */ + SelectObject( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hdc, ( HPEN ) s_pWvwData->s_sApp->OriginalPen ); + SelectObject( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hdc, ( HBRUSH ) s_pWvwData->s_sApp->OriginalBrush ); - return ( s_pWvwData->s_usNumWindows-1 ); + return s_pWvwData->s_usNumWindows - 1; } -static void hb_gt_wvwCloseWindow( void ) -{ /*assume s_pWvwData->s_usNumWindows >= 2 (ie. we are not closing main window) - *similar to gt_exit(), only gt_exit() closes main window - */ +static void hb_gt_wvwCloseWindow( void ) /*assume s_pWvwData->s_usNumWindows >= 2 (ie. we are not closing main window) + *similar to gt_exit(), only gt_exit() closes main window + */ +{ + WIN_DATA * pWindowData; + CONTROL_DATA * pcd; - WIN_DATA * pWindowData; - CONTROL_DATA * pcd; + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvwCloseWindow()" ) ); - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvwCloseWindow()" ) ); + /* destroy objects from current (last/topmost) window */ - /* destroy objects from current (last/topmost) window */ + pWindowData = ( WIN_DATA * ) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; - pWindowData = (WIN_DATA*) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; - - if ( pWindowData->hWnd ) - { + if( pWindowData->hWnd ) + { KillTimer( pWindowData->hWnd, WVW_ID_SYSTEM_TIMER ); - if ( s_pWvwData->s_sApp->pSymWVW_TIMER ) + if( s_pWvwData->s_sApp->pSymWVW_TIMER ) { - KillTimer( pWindowData->hWnd, WVW_ID_BASE_TIMER+s_pWvwData->s_usNumWindows-1 ); + KillTimer( pWindowData->hWnd, WVW_ID_BASE_TIMER + s_pWvwData->s_usNumWindows - 1 ); } /* 20040921 IMPORTANT: @@ -5850,194 +5787,193 @@ static void hb_gt_wvwCloseWindow( void ) (2) do the creation and deletion only when required */ /* 20040923 choose #1 of above option - DeleteObject( ( HPEN ) pWindowData->penWhite ); - DeleteObject( ( HPEN ) pWindowData->penWhiteDim ); - DeleteObject( ( HPEN ) pWindowData->penBlack ); - DeleteObject( ( HPEN ) pWindowData->penDarkGray ); - DeleteObject( ( HPEN ) pWindowData->penGray ); - DeleteObject( ( HPEN ) pWindowData->penNull ); - DeleteObject( ( HPEN ) pWindowData->currentPen ); - DeleteObject( ( HBRUSH ) pWindowData->currentBrush ); - DeleteObject( ( HBRUSH ) pWindowData->diagonalBrush ); - DeleteObject( ( HBRUSH ) pWindowData->solidBrush ); - DeleteObject( ( HBRUSH ) pWindowData->wvwWhiteBrush ); - */ + DeleteObject( ( HPEN ) pWindowData->penWhite ); + DeleteObject( ( HPEN ) pWindowData->penWhiteDim ); + DeleteObject( ( HPEN ) pWindowData->penBlack ); + DeleteObject( ( HPEN ) pWindowData->penDarkGray ); + DeleteObject( ( HPEN ) pWindowData->penGray ); + DeleteObject( ( HPEN ) pWindowData->penNull ); + DeleteObject( ( HPEN ) pWindowData->currentPen ); + DeleteObject( ( HBRUSH ) pWindowData->currentBrush ); + DeleteObject( ( HBRUSH ) pWindowData->diagonalBrush ); + DeleteObject( ( HBRUSH ) pWindowData->solidBrush ); + DeleteObject( ( HBRUSH ) pWindowData->wvwWhiteBrush ); + */ DeleteObject( ( HFONT ) pWindowData->hFont ); - if ( pWindowData->hdc ) + if( pWindowData->hdc ) { - ReleaseDC( pWindowData->hWnd, pWindowData->hdc ); + ReleaseDC( pWindowData->hWnd, pWindowData->hdc ); } - if ( pWindowData->hCompDC ) + if( pWindowData->hCompDC ) { - DeleteDC( pWindowData->hCompDC ); + DeleteDC( pWindowData->hCompDC ); } - while (pWindowData->pcdCtrlList) + while( pWindowData->pcdCtrlList ) { - pcd = pWindowData->pcdCtrlList->pNext; - DestroyWindow (pWindowData->pcdCtrlList->hWndCtrl) ; + pcd = pWindowData->pcdCtrlList->pNext; + DestroyWindow( pWindowData->pcdCtrlList->hWndCtrl ); - if (pWindowData->pcdCtrlList->phiCodeBlock) - { - hb_itemRelease( pWindowData->pcdCtrlList->phiCodeBlock ); + if( pWindowData->pcdCtrlList->phiCodeBlock ) + { + hb_itemRelease( pWindowData->pcdCtrlList->phiCodeBlock ); - } + } - hb_xfree( pWindowData->pcdCtrlList ); - pWindowData->pcdCtrlList = pcd; + hb_xfree( pWindowData->pcdCtrlList ); + pWindowData->pcdCtrlList = pcd; } DestroyWindow( pWindowData->hWnd ); - if (pWindowData->hPBfont) + if( pWindowData->hPBfont ) { - DeleteObject( ( HFONT ) pWindowData->hPBfont ); + DeleteObject( ( HFONT ) pWindowData->hPBfont ); } - if (pWindowData->hCBfont) + if( pWindowData->hCBfont ) { - DeleteObject( ( HFONT ) pWindowData->hCBfont ); + DeleteObject( ( HFONT ) pWindowData->hCBfont ); } - if (pWindowData->hCXfont) + if( pWindowData->hCXfont ) { - DeleteObject( ( HFONT ) pWindowData->hCXfont ); + DeleteObject( ( HFONT ) pWindowData->hCXfont ); } - if (pWindowData->hSBfont) + if( pWindowData->hSBfont ) { - DeleteObject( ( HFONT ) pWindowData->hSBfont ); + DeleteObject( ( HFONT ) pWindowData->hSBfont ); } - if (pWindowData->hSTfont) + if( pWindowData->hSTfont ) { - DeleteObject( ( HFONT ) pWindowData->hSTfont ); + DeleteObject( ( HFONT ) pWindowData->hSTfont ); } - if (pWindowData->hIcon) + if( pWindowData->hIcon ) { - DestroyIcon( (HICON) pWindowData->hIcon ); + DestroyIcon( ( HICON ) pWindowData->hIcon ); } - } + } - hb_gt_wvwWindowEpilogue( ); + hb_gt_wvwWindowEpilogue(); - /* + /* - if (s_pWvwData->s_usNumWindows == 1) - { + if (s_pWvwData->s_usNumWindows == 1) + { if (!UnregisterClass( s_pWvwData->szSubWinName,s_pWvwData->hInstance )) { - MessageBox( NULL, TEXT( "Failed UnregisterClass" ), - s_pWvwData->szAppName, MB_ICONERROR ); + MessageBox( NULL, TEXT( "Failed UnregisterClass" ), + s_pWvwData->szAppName, MB_ICONERROR ); + } } - } */ - SetFocus( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hWnd ); + SetFocus( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hWnd ); } static BOOL hb_gt_wvwBufferedKey( LONG lKey ) { - return( lKey != VK_SHIFT && + return lKey != VK_SHIFT && lKey != VK_MENU && lKey != VK_CONTROL && lKey != VK_PAUSE && lKey != VK_CAPITAL && lKey != VK_NUMLOCK && - lKey != VK_SCROLL); + lKey != VK_SCROLL; } -static BOOL hb_gt_wvwAcceptingInput( void ) -{ /* returns TRUE if we are accepting input, - * ie. Current focused window is the topmost window - */ +static BOOL hb_gt_wvwAcceptingInput( void ) /* returns TRUE if we are accepting input, + * ie. Current focused window is the topmost window + */ +{ + HWND hWndFocus = ( HWND ) GetFocus(); - HWND hWndFocus = (HWND) GetFocus(); - - return ( hWndFocus == s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hWnd || - GetControlClass(s_pWvwData->s_usNumWindows-1, hWndFocus) > 0 ); + return hWndFocus == s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hWnd || + GetControlClass( s_pWvwData->s_usNumWindows - 1, hWndFocus ) > 0; } /* this TIMERPROC is to flash the topmost window using FlashWindow. need to do it this way since FlashWindowEx is not available in Win95 */ -static VOID CALLBACK hb_gt_wvwFlashWindow(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +static VOID CALLBACK hb_gt_wvwFlashWindow( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime ) { - static BYTE byCount = 0; + static BYTE byCount = 0; - HB_SYMBOL_UNUSED( uMsg ); - HB_SYMBOL_UNUSED( dwTime ); + HB_SYMBOL_UNUSED( uMsg ); + HB_SYMBOL_UNUSED( dwTime ); - FlashWindow( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hWnd, TRUE ); + FlashWindow( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->hWnd, TRUE ); - if (++byCount >= 15) - { + if( ++byCount >= 15 ) + { - KillTimer( hwnd, idEvent ); - byCount = 0; - s_pWvwData->s_bFlashingWindow = FALSE; - } + KillTimer( hwnd, idEvent ); + byCount = 0; + s_pWvwData->s_bFlashingWindow = FALSE; + } } static void hb_gt_wvwInputNotAllowed( UINT usWinNum, UINT message, WPARAM wParam, LPARAM lParam ) { - /* user may handle this event and returns .t. from .PRG level - using function WVW_INPUTFOCUS() - */ - if ( s_pWvwData->s_sApp->pSymWVW_INPUTFOCUS ) - { - BOOL bHandled = FALSE; + /* user may handle this event and returns .t. from .PRG level + using function WVW_INPUTFOCUS() + */ + if( s_pWvwData->s_sApp->pSymWVW_INPUTFOCUS ) + { + BOOL bHandled = FALSE; - if( hb_vmRequestReenter() ) - { + if( hb_vmRequestReenter() ) + { - hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_INPUTFOCUS ); - hb_vmPushNil(); - hb_vmPushInteger( ( int ) (usWinNum) ); - hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) s_pWvwData->s_pWindows[ usWinNum ]->hWnd ); - hb_vmPushNumInt( message ); - hb_vmPushNumInt( wParam ); - hb_vmPushNumInt( lParam ); - hb_vmDo( 5 ); + hb_vmPushDynSym( s_pWvwData->s_sApp->pSymWVW_INPUTFOCUS ); + hb_vmPushNil(); + hb_vmPushInteger( ( int ) ( usWinNum ) ); + hb_vmPushNumInt( ( HB_MAXINT ) ( HB_PTRDIFF ) s_pWvwData->s_pWindows[ usWinNum ]->hWnd ); + hb_vmPushNumInt( message ); + hb_vmPushNumInt( wParam ); + hb_vmPushNumInt( lParam ); + hb_vmDo( 5 ); - bHandled = hb_parnl( -1 ); - hb_vmRequestRestore(); - } + bHandled = hb_parnl( -1 ); + hb_vmRequestRestore(); + } - if (bHandled) - { - return; - } - } + if( bHandled ) + { + return; + } + } - MessageBeep(MB_OK); + MessageBeep( MB_OK ); - /* this simpler method is not available in Win95 - fwi.cbSize = sizeof(fwi); - fwi.hwnd = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hWnd; - fwi.dwFlags = FLASHW_CAPTION | FLASHW_TRAY; - fwi.uCount = 5; - fwi.dwTimeout = 100; - FlashWindowEx(&fwi); - */ + /* this simpler method is not available in Win95 + fwi.cbSize = sizeof(fwi); + fwi.hwnd = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->hWnd; + fwi.dwFlags = FLASHW_CAPTION | FLASHW_TRAY; + fwi.uCount = 5; + fwi.dwTimeout = 100; + FlashWindowEx(&fwi); + */ - if (!s_pWvwData->s_bFlashingWindow) - { - s_pWvwData->s_bFlashingWindow = TRUE; - SetTimer( NULL, 0, 50, (TIMERPROC) hb_gt_wvwFlashWindow ); - } + if( ! s_pWvwData->s_bFlashingWindow ) + { + s_pWvwData->s_bFlashingWindow = TRUE; + SetTimer( NULL, 0, 50, ( TIMERPROC ) hb_gt_wvwFlashWindow ); + } } /* ******************************************************************** MainCoord Mode - ******************************************************************** + ******************************************************************** In this mode an xHarbour program uses (row,col) coordinate relative to Main Window's coordinate. It is similar to old Clipper program which uses coordinate relative to the physical screen area. @@ -6046,16 +5982,16 @@ static void hb_gt_wvwInputNotAllowed( UINT usWinNum, UINT message, WPARAM wParam oldCoordMode := WVW_SetMainCoord( .t. ) Illustration: - +------ - |Main Window (Window 0) - |maxrow()=24 maxcol()=79 - | +--------------- - | |Window1 RowOfs=3 ColOfs=4 - | |maxrow()=9 maxcol()=29 - | | +--------------------------------------+ - | | |Window2 RowOfs=6 ColOfs=15 | - | | |maxrow()=3 maxcol()=49 | - | | | | + *+------ + *|Main Window (Window 0) + *|maxrow()=24 maxcol()=79 + | +--------------- + | |Window1 RowOfs=3 ColOfs=4 + | |maxrow()=9 maxcol()=29 + | | +--------------------------------------+ + | | |Window2 RowOfs=6 ColOfs=15 | + | | |maxrow()=3 maxcol()=49 | + | | | | @ 6,15 say "text1" will be written to Window2 starting at 0,0 @ 3,15 say "text2" will be written to Window1 starting at 0,11 @@ -6095,73 +6031,79 @@ static void hb_gt_wvwInputNotAllowed( UINT usWinNum, UINT message, WPARAM wParam - hb_gt_wvwTextOut() - etc -*/ + */ /* returns row offset of window usWinNum */ USHORT hb_gt_wvwRowOfs( UINT usWinNum ) { - return( s_pWvwData->s_pWindows[usWinNum]->usRowOfs ); + return s_pWvwData->s_pWindows[ usWinNum ]->usRowOfs; } /* returns col offset of window usWinNum */ USHORT hb_gt_wvwColOfs( UINT usWinNum ) { - return( s_pWvwData->s_pWindows[usWinNum]->usColOfs ); + return s_pWvwData->s_pWindows[ usWinNum ]->usColOfs; } /*(usrow,uscol) is coordinate relative to Main Window (MainCoord Mode) - *returns true if usrow and uscol is within maxrow() and maxcol() of Window usWinNum + *returns true if usrow and uscol is within maxrow() and maxcol() of Window usWinNum */ static BOOL hb_gt_wvwInWindow( UINT usWinNum, USHORT usrow, USHORT uscol ) { - return( usrow >= hb_gt_wvwRowOfs(usWinNum) && - usrow <= (s_pWvwData->s_pWindows[usWinNum]->ROWS-1 + hb_gt_wvwRowOfs(usWinNum)) && - uscol >= hb_gt_wvwColOfs(usWinNum) && - uscol <= (s_pWvwData->s_pWindows[usWinNum]->COLS-1 + hb_gt_wvwColOfs(usWinNum)) ); + return usrow >= hb_gt_wvwRowOfs( usWinNum ) && + usrow <= ( s_pWvwData->s_pWindows[ usWinNum ]->ROWS - 1 + hb_gt_wvwRowOfs( usWinNum ) ) && + uscol >= hb_gt_wvwColOfs( usWinNum ) && + uscol <= ( s_pWvwData->s_pWindows[ usWinNum ]->COLS - 1 + hb_gt_wvwColOfs( usWinNum ) ); } /*returns winnum containing (usRow,usCol) coordinate - *only meaningful in s_pWvwData->s_bMainCoordMode + *only meaningful in s_pWvwData->s_bMainCoordMode */ -static UINT hb_gt_wvwFindWindow(USHORT usRow, USHORT usCol) +static UINT hb_gt_wvwFindWindow( USHORT usRow, USHORT usCol ) { - UINT i; + UINT i; - if (!s_pWvwData->s_bMainCoordMode) - { - return (s_pWvwData->s_usNumWindows-1); - } + if( ! s_pWvwData->s_bMainCoordMode ) + { + return s_pWvwData->s_usNumWindows - 1; + } - for (i=s_pWvwData->s_usNumWindows-1; i>0; i--) - { - if ( hb_gt_wvwInWindow(i, usRow, usCol) ) - { - break; - } - } + for( i = s_pWvwData->s_usNumWindows - 1; i > 0; i-- ) + { + if( hb_gt_wvwInWindow( i, usRow, usCol ) ) + { + break; + } + } - return (i); + return i; } /* this is the prologue for any HB_GT_FUNC() that is output/coordinate oriented * called only if s_pWvwData->s_bMainCoordMode * row2 and col2 is not taken into account during window finding, but they are translated too */ -void hb_gt_wvwFUNCPrologue(BYTE byNumCoord, int * iRow1, int * iCol1, int * iRow2, int * iCol2) +void hb_gt_wvwFUNCPrologue( BYTE byNumCoord, int * iRow1, int * iCol1, int * iRow2, int * iCol2 ) { - UINT usWinNum; + UINT usWinNum; - if (byNumCoord<2) (*iCol1) = (USHORT) s_pWvwData->s_pWindows[0]->caretPos.x; - if (byNumCoord<1) (*iRow1) = (USHORT) s_pWvwData->s_pWindows[0]->caretPos.y; + if( byNumCoord < 2 ) + ( *iCol1 ) = ( USHORT ) s_pWvwData->s_pWindows[ 0 ]->caretPos.x; + if( byNumCoord < 1 ) + ( *iRow1 ) = ( USHORT ) s_pWvwData->s_pWindows[ 0 ]->caretPos.y; - usWinNum = hb_gt_wvwFindWindow((USHORT)*iRow1, (USHORT)*iCol1); + usWinNum = hb_gt_wvwFindWindow( ( USHORT ) *iRow1, ( USHORT ) *iCol1 ); - if (iRow1) (*iRow1) -= hb_gt_wvwRowOfs( usWinNum ); - if (iCol1) (*iCol1) -= hb_gt_wvwColOfs( usWinNum ); - if (iRow2) (*iRow2) -= hb_gt_wvwRowOfs( usWinNum ); - if (iCol2) (*iCol2) -= hb_gt_wvwColOfs( usWinNum ); + if( iRow1 ) + ( *iRow1 ) -= hb_gt_wvwRowOfs( usWinNum ); + if( iCol1 ) + ( *iCol1 ) -= hb_gt_wvwColOfs( usWinNum ); + if( iRow2 ) + ( *iRow2 ) -= hb_gt_wvwRowOfs( usWinNum ); + if( iCol2 ) + ( *iCol2 ) -= hb_gt_wvwColOfs( usWinNum ); - hb_gt_wvwSetCurWindow( usWinNum ); + hb_gt_wvwSetCurWindow( usWinNum ); } @@ -6171,69 +6113,73 @@ void hb_gt_wvwFUNCPrologue(BYTE byNumCoord, int * iRow1, int * iCol1, int * iRow void hb_gt_wvwFUNCEpilogue( void ) { - s_pWvwData->s_pWindows[0]->caretPos.y = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.y + hb_gt_wvwRowOfs( s_pWvwData->s_usCurWindow ); - s_pWvwData->s_pWindows[0]->caretPos.x = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.x + hb_gt_wvwColOfs( s_pWvwData->s_usCurWindow ); + s_pWvwData->s_pWindows[ 0 ]->caretPos.y = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.y + hb_gt_wvwRowOfs( s_pWvwData->s_usCurWindow ); + s_pWvwData->s_pWindows[ 0 ]->caretPos.x = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.x + hb_gt_wvwColOfs( s_pWvwData->s_usCurWindow ); - hb_gt_wvwSetCurWindow( 0 ); + hb_gt_wvwSetCurWindow( 0 ); - if ( s_pWvwData->s_sApp->CaretExist && s_pWvwData->s_sApp->displayCaret ) - { - hb_gt_wvwSetCaretPos(s_pWvwData->s_pWindows[s_pWvwData->s_usNumWindows-1]); + if( s_pWvwData->s_sApp->CaretExist && s_pWvwData->s_sApp->displayCaret ) + { + hb_gt_wvwSetCaretPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ] ); - } + } } -void hb_wvw_HBFUNCPrologue(UINT usWinNum, - USHORT * pusRow1, USHORT * pusCol1, - USHORT * pusRow2, USHORT * pusCol2) +void hb_wvw_HBFUNCPrologue( UINT usWinNum, + USHORT * pusRow1, USHORT * pusCol1, + USHORT * pusRow2, USHORT * pusCol2 ) { - if (pusRow1) (*pusRow1) -= hb_gt_wvwRowOfs( usWinNum ); - if (pusCol1) (*pusCol1) -= hb_gt_wvwColOfs( usWinNum ); - if (pusRow2) (*pusRow2) -= hb_gt_wvwRowOfs( usWinNum ); - if (pusCol2) (*pusCol2) -= hb_gt_wvwColOfs( usWinNum ); + if( pusRow1 ) + ( *pusRow1 ) -= hb_gt_wvwRowOfs( usWinNum ); + if( pusCol1 ) + ( *pusCol1 ) -= hb_gt_wvwColOfs( usWinNum ); + if( pusRow2 ) + ( *pusRow2 ) -= hb_gt_wvwRowOfs( usWinNum ); + if( pusCol2 ) + ( *pusCol2 ) -= hb_gt_wvwColOfs( usWinNum ); } /*assigns a new value to s_pWvwData->s_usCurWindow - *returns old value of s_pWvwData->s_usCurWindow - *WARNING!! we must make sure that it is done in !s_pWvwData->s_bMainCoordMode, otherwise + *returns old value of s_pWvwData->s_usCurWindow + *WARNING!! we must make sure that it is done in !s_pWvwData->s_bMainCoordMode, otherwise * some GT_FUNC will be trapped into circular reference! */ static UINT hb_gt_wvwSetCurWindow( UINT usWinNum ) { - UINT usOldWin = s_pWvwData->s_usCurWindow; - BOOL bMainCoordMode; + UINT usOldWin = s_pWvwData->s_usCurWindow; + BOOL bMainCoordMode; - if (usWinNum==usOldWin) - { - return(usOldWin); - } + if( usWinNum == usOldWin ) + { + return usOldWin; + } - s_pWvwData->s_usCurWindow = usWinNum; + s_pWvwData->s_usCurWindow = usWinNum; - bMainCoordMode = s_pWvwData->s_bMainCoordMode; - s_pWvwData->s_bMainCoordMode = FALSE; + bMainCoordMode = s_pWvwData->s_bMainCoordMode; + s_pWvwData->s_bMainCoordMode = FALSE; - /*updating GTAPI's statics: - *tell GTAPI about the new maxrow(), maxcol() - */ - s_pWvwData->s_bQuickSetMode = TRUE; + /*updating GTAPI's statics: + *tell GTAPI about the new maxrow(), maxcol() + */ + s_pWvwData->s_bQuickSetMode = TRUE; - hb_gtSetMode( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->ROWS, s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->COLS ); + hb_gtSetMode( s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->ROWS, s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->COLS ); - s_pWvwData->s_bQuickSetMode = FALSE; + s_pWvwData->s_bQuickSetMode = FALSE; - /* tell GTAPI about the new row(), col() */ + /* tell GTAPI about the new row(), col() */ - hb_gtSetPos( (SHORT) s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.y, - (SHORT) s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.x ); - /* done updating GTAPI's statics......... */ + hb_gtSetPos( ( SHORT ) s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.y, + ( SHORT ) s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]->caretPos.x ); + /* done updating GTAPI's statics......... */ - s_pWvwData->s_bMainCoordMode = bMainCoordMode; + s_pWvwData->s_bMainCoordMode = bMainCoordMode; - return(usOldWin); + return usOldWin; } @@ -6251,7 +6197,7 @@ static UINT hb_gt_wvwSetCurWindow( UINT usWinNum ) /* NOTE:works for topmost window only */ static void hb_wvw_vmouse_Init( void ) { - hb_wvw_vmouse_SetPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ], 0, 0); + hb_wvw_vmouse_SetPos( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ], 0, 0 ); } static void hb_wvw_vmouse_Exit( void ) @@ -6260,116 +6206,116 @@ static void hb_wvw_vmouse_Exit( void ) static void hb_wvw_vmouse_SetPos( WIN_DATA * pWindowData, USHORT usRow, USHORT usCol ) { - POINT xy = { 0 }; + POINT xy = { 0 }; - hb_gt_wvwSetMouseY( pWindowData, usRow ); - hb_gt_wvwSetMouseX( pWindowData, usCol ); + hb_gt_wvwSetMouseY( pWindowData, usRow ); + hb_gt_wvwSetMouseX( pWindowData, usCol ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); - if ( ClientToScreen( pWindowData->hWnd, &xy ) ) - { - SetCursorPos( xy.x, xy.y + ( pWindowData->PTEXTSIZE.y / 2 ) ); - } + if( ClientToScreen( pWindowData->hWnd, &xy ) ) + { + SetCursorPos( xy.x, xy.y + ( pWindowData->PTEXTSIZE.y / 2 ) ); + } } static int hb_gt_wvw_usDispCount( WIN_DATA * pWindowData ) { - return( pWindowData->uiDispCount ); + return pWindowData->uiDispCount; } static void hb_gt_wvw_vDispBegin( WIN_DATA * pWindowData ) { - ++(pWindowData->uiDispCount); + ++( pWindowData->uiDispCount ); } static void hb_gt_wvw_vDispEnd( WIN_DATA * pWindowData ) { - if ( pWindowData->uiDispCount > 0 ) - { - --(pWindowData->uiDispCount); - } - if ( pWindowData->uiDispCount<= 0 ) - { - hb_gt_wvwDoInvalidateRect( pWindowData ); - } + if( pWindowData->uiDispCount > 0 ) + { + --( pWindowData->uiDispCount ); + } + if( pWindowData->uiDispCount <= 0 ) + { + hb_gt_wvwDoInvalidateRect( pWindowData ); + } } static void hb_gt_wvw_vGetText( WIN_DATA * pWindowData, USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer ) { - USHORT irow, icol, index, j; + USHORT irow, icol, index, j; - j = 0; - for ( irow = top; irow <= bottom; irow++ ) - { - index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, left, irow ); - for ( icol = left; icol <= right; icol++ ) - { - if ( index >= pWindowData->BUFFERSIZE ) + j = 0; + for( irow = top; irow <= bottom; irow++ ) + { + index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, left, irow ); + for( icol = left; icol <= right; icol++ ) { - break; + if( index >= pWindowData->BUFFERSIZE ) + { + break; + } + else + { + sBuffer[ j++ ] = pWindowData->pBuffer[ index ]; + sBuffer[ j++ ] = pWindowData->pColors[ index ]; + index++; + } } - else - { - sBuffer[ j++ ] = pWindowData->pBuffer[ index ]; - sBuffer[ j++ ] = pWindowData->pColors[ index ]; - index++; - } - } - } + } } -static void hb_gt_wvw_vPuts( WIN_DATA * pWindowData, int iRow, int iCol, BYTE byColor, BYTE byAttr, BYTE *pbyStr, ULONG ulLen ) +static void hb_gt_wvw_vPuts( WIN_DATA * pWindowData, int iRow, int iCol, BYTE byColor, BYTE byAttr, BYTE * pbyStr, ULONG ulLen ) { - hb_gt_wvwSetStringInTextBuffer( pWindowData, iCol, iRow, byColor, byAttr, pbyStr, ulLen ); + hb_gt_wvwSetStringInTextBuffer( pWindowData, iCol, iRow, byColor, byAttr, pbyStr, ulLen ); #ifdef WVW_DEBUG - nCountPuts++; + nCountPuts++; #endif } static void hb_gt_wvw_vReplicate( WIN_DATA * pWindowData, int iRow, int iCol, int bColor, BYTE bAttr, USHORT usChar, ULONG ulLen ) { - BYTE ucBuff[ WVW_CHAR_BUFFER ], *byChars; - ULONG i; - BOOL bMalloc = FALSE; + BYTE ucBuff[ WVW_CHAR_BUFFER ], * byChars; + ULONG i; + BOOL bMalloc = FALSE; - if ( ulLen > WVW_CHAR_BUFFER ) - { - byChars = ( BYTE* ) hb_xgrab( ulLen ); - bMalloc= TRUE; - } - else - { - byChars = ucBuff ; - } + if( ulLen > WVW_CHAR_BUFFER ) + { + byChars = ( BYTE * ) hb_xgrab( ulLen ); + bMalloc = TRUE; + } + else + { + byChars = ucBuff; + } - for ( i = 0; i < ulLen; i++ ) - { - *( byChars+i ) = (BYTE)usChar; - } + for( i = 0; i < ulLen; i++ ) + { + *( byChars + i ) = ( BYTE ) usChar; + } - hb_gt_wvwSetStringInTextBuffer( pWindowData, iCol, iRow, bColor, bAttr, byChars, ulLen ); - if ( bMalloc ) - { - hb_xfree( byChars ); - } + hb_gt_wvwSetStringInTextBuffer( pWindowData, iCol, iRow, bColor, bAttr, byChars, ulLen ); + if( bMalloc ) + { + hb_xfree( byChars ); + } } static BOOL hb_gt_wvw_GetChar( PHB_GT pGT, int iRow, int iCol, int * pbColor, BYTE * pbAttr, USHORT * pusChar ) { - WIN_DATA * pWindowData; - long lIndex; + WIN_DATA * pWindowData; + long lIndex; HB_SYMBOL_UNUSED( pbAttr ); - pWindowData = (WIN_DATA*) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; + pWindowData = ( WIN_DATA * ) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; HB_GTSELF_CHECKPOS( pGT, iRow, iCol, &lIndex ); - if ( lIndex < pWindowData->BUFFERSIZE ) + if( lIndex < pWindowData->BUFFERSIZE ) { *pusChar = pWindowData->pBuffer[ lIndex ]; *pbColor = pWindowData->pColors[ lIndex ]; @@ -6382,35 +6328,35 @@ static BOOL hb_gt_wvw_GetChar( PHB_GT pGT, int iRow, int iCol, static BOOL hb_gt_wvw_PutChar( PHB_GT pGT, int iRow, int iCol, int bColor, BYTE bAttr, USHORT usChar ) { - WIN_DATA * pWindowData; - long lIndex; + WIN_DATA * pWindowData; + long lIndex; HB_SYMBOL_UNUSED( bAttr ); - pWindowData = (WIN_DATA*) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; + pWindowData = ( WIN_DATA * ) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; HB_GTSELF_CHECKPOS( pGT, iRow, iCol, &lIndex ); - if ( lIndex < pWindowData->BUFFERSIZE ) + if( lIndex < pWindowData->BUFFERSIZE ) { - pWindowData->pBuffer[ lIndex ] = (BYTE)usChar; - pWindowData->pColors[ lIndex ] = bColor; + pWindowData->pBuffer[ lIndex ] = ( BYTE ) usChar; + pWindowData->pColors[ lIndex ] = bColor; return TRUE; } return FALSE; } -static BOOL hb_gt_wvw_CheckPos( PHB_GT pGT, int iRow, int iCol, long *plIndex ) +static BOOL hb_gt_wvw_CheckPos( PHB_GT pGT, int iRow, int iCol, long * plIndex ) { WIN_DATA * pWindowData; HB_SYMBOL_UNUSED( pGT ); - pWindowData = (WIN_DATA*) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; - *plIndex = ( long ) hb_gt_wvwGetIndexForTextBuffer( pWindowData, (USHORT)iCol, (USHORT)iRow ); + pWindowData = ( WIN_DATA * ) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; + *plIndex = ( long ) hb_gt_wvwGetIndexForTextBuffer( pWindowData, ( USHORT ) iCol, ( USHORT ) iRow ); - return TRUE; + return TRUE; } static void hb_gt_wvw_GetSize( PHB_GT pGT, int * piRows, int * piCols ) @@ -6419,188 +6365,188 @@ static void hb_gt_wvw_GetSize( PHB_GT pGT, int * piRows, int * piCols ) HB_SYMBOL_UNUSED( pGT ); - pWindowData = (WIN_DATA*) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; + pWindowData = ( WIN_DATA * ) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; - *piRows = pWindowData->ROWS; - *piCols = pWindowData->COLS; + *piRows = pWindowData->ROWS; + *piCols = pWindowData->COLS; } static void hb_gt_wvw_Save( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, void * pBuffer ) { - BYTE * pbyBuffer = ( BYTE * ) pBuffer; + BYTE * pbyBuffer = ( BYTE * ) pBuffer; - int i_Top = (iTop < 0 ? 0 : iTop); - int i_Left = (iLeft < 0 ? 0 : iLeft); - int i_Bottom = (iBottom < 0 ? 0 : iBottom); - int i_Right = (iRight < 0 ? 0 : iRight); + int i_Top = ( iTop < 0 ? 0 : iTop ); + int i_Left = ( iLeft < 0 ? 0 : iLeft ); + int i_Bottom = ( iBottom < 0 ? 0 : iBottom ); + int i_Right = ( iRight < 0 ? 0 : iRight ); - if ( s_pWvwData->s_bMainCoordMode ) - { - hb_gt_wvwFUNCPrologue(4, &i_Top, &i_Left, &i_Bottom, &i_Right); - } + if( s_pWvwData->s_bMainCoordMode ) + { + hb_gt_wvwFUNCPrologue( 4, &i_Top, &i_Left, &i_Bottom, &i_Right ); + } while( i_Top <= i_Bottom ) { - int iColor; - USHORT usChar; - int iCol; + int iColor; + USHORT usChar; + int iCol; for( iCol = i_Left; iCol <= i_Right; ++iCol ) { - if( !HB_GTSELF_GETCHAR( pGT, i_Top, iCol, &iColor, NULL, &usChar ) ) + if( ! HB_GTSELF_GETCHAR( pGT, i_Top, iCol, &iColor, NULL, &usChar ) ) { - usChar = (USHORT)HB_GTSELF_GETCLEARCHAR( pGT ); - iColor = HB_GTSELF_GETCLEARCOLOR( pGT ); + usChar = ( USHORT ) HB_GTSELF_GETCLEARCHAR( pGT ); + iColor = HB_GTSELF_GETCLEARCOLOR( pGT ); } - *pbyBuffer++ = ( BYTE ) usChar; - *pbyBuffer++ = ( BYTE ) iColor; /* TOFIX */ + *pbyBuffer++ = ( BYTE ) usChar; + *pbyBuffer++ = ( BYTE ) iColor; /* TOFIX */ } ++i_Top; } - if ( s_pWvwData->s_bMainCoordMode ) - { - hb_gt_wvwFUNCEpilogue( ); - } + if( s_pWvwData->s_bMainCoordMode ) + { + hb_gt_wvwFUNCEpilogue(); + } } static void hb_gt_wvw_Rest( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight, const void * pBuffer ) { - BYTE * pbyBuffer = ( BYTE * ) pBuffer; + BYTE * pbyBuffer = ( BYTE * ) pBuffer; - WIN_DATA * pWindowData; - int iSaveTop; - int i_Top = (iTop < 0 ? 0 : iTop); - int i_Left = (iLeft < 0 ? 0 : iLeft); - int i_Bottom = (iBottom < 0 ? 0 : iBottom); - int i_Right = (iRight < 0 ? 0 : iRight); + WIN_DATA * pWindowData; + int iSaveTop; + int i_Top = ( iTop < 0 ? 0 : iTop ); + int i_Left = ( iLeft < 0 ? 0 : iLeft ); + int i_Bottom = ( iBottom < 0 ? 0 : iBottom ); + int i_Right = ( iRight < 0 ? 0 : iRight ); - pWindowData = (WIN_DATA*) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; + pWindowData = ( WIN_DATA * ) s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; - if ( s_pWvwData->s_bMainCoordMode ) + if( s_pWvwData->s_bMainCoordMode ) { - hb_gt_wvwFUNCPrologue(4, &i_Top, &i_Left, &i_Bottom, &i_Right); + hb_gt_wvwFUNCPrologue( 4, &i_Top, &i_Left, &i_Bottom, &i_Right ); } iSaveTop = i_Top; while( iSaveTop <= i_Bottom ) { - int bColor; - USHORT usChar; - int iCol; + int bColor; + USHORT usChar; + int iCol; for( iCol = i_Left; iCol <= i_Right; ++iCol ) { - usChar = *pbyBuffer++; - bColor = *pbyBuffer++; + usChar = *pbyBuffer++; + bColor = *pbyBuffer++; - HB_GTSELF_PUTCHAR( pGT, iSaveTop, iCol, bColor, 0, usChar ); + HB_GTSELF_PUTCHAR( pGT, iSaveTop, iCol, bColor, 0, usChar ); } ++iSaveTop; } pWindowData->InvalidateWindow = TRUE; - hb_gt_wvwSetInvalidRect( pWindowData, (USHORT)i_Left, (USHORT)i_Top, (USHORT)i_Right, (USHORT)i_Bottom ); + hb_gt_wvwSetInvalidRect( pWindowData, ( USHORT ) i_Left, ( USHORT ) i_Top, ( USHORT ) i_Right, ( USHORT ) i_Bottom ); - if ( s_pWvwData->s_bMainCoordMode ) - { - hb_gt_wvwFUNCEpilogue( ); - } + if( s_pWvwData->s_bMainCoordMode ) + { + hb_gt_wvwFUNCEpilogue(); + } } static void hb_gt_wvw_ExposeArea( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight ) { - HB_SYMBOL_UNUSED( pGT ); - HB_SYMBOL_UNUSED( iTop ); - HB_SYMBOL_UNUSED( iLeft ); - HB_SYMBOL_UNUSED( iBottom ); - HB_SYMBOL_UNUSED( iRight ); + HB_SYMBOL_UNUSED( pGT ); + HB_SYMBOL_UNUSED( iTop ); + HB_SYMBOL_UNUSED( iLeft ); + HB_SYMBOL_UNUSED( iBottom ); + HB_SYMBOL_UNUSED( iRight ); } static void hb_gt_wvw_vPutText( WIN_DATA * pWindowData, USHORT top, USHORT left, USHORT bottom, USHORT right, const char * sBuffer, int bColor ) { - USHORT irow, icol, index, j; + USHORT irow, icol, index, j; - j = 0; - for ( irow = top; irow <= bottom; irow++ ) - { - index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, left, irow ); - for ( icol = left; icol <= right; icol++ ) - { - if ( index >= pWindowData->BUFFERSIZE ) + j = 0; + for( irow = top; irow <= bottom; irow++ ) + { + index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, left, irow ); + for( icol = left; icol <= right; icol++ ) { - break; - } - else - { - pWindowData->pBuffer[ index ] = sBuffer[ j++ ]; + if( index >= pWindowData->BUFFERSIZE ) + { + break; + } + else + { + pWindowData->pBuffer[ index ] = sBuffer[ j++ ]; - if (bColor) - { - pWindowData->pColors[ index ] = bColor; - } - else - { - pWindowData->pColors[ index ] = sBuffer[ j++ ]; - } - index++; + if( bColor ) + { + pWindowData->pColors[ index ] = bColor; + } + else + { + pWindowData->pColors[ index ] = sBuffer[ j++ ]; + } + index++; + } } - } - } - hb_gt_wvwSetInvalidRect( pWindowData, (USHORT)left, (USHORT)top, (USHORT)right, (USHORT)bottom ); + } + hb_gt_wvwSetInvalidRect( pWindowData, ( USHORT ) left, ( USHORT ) top, ( USHORT ) right, ( USHORT ) bottom ); } static void hb_gt_wvw_vSetAttribute( WIN_DATA * pWindowData, int iTop, int iLeft, int iBottom, int iRight, int bColor ) { - int irow, icol, index; + int irow, icol, index; - for ( irow = iTop; irow <=iBottom; irow++ ) - { - index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, (USHORT)iLeft, (USHORT)irow ); - for ( icol = iLeft; icol <= iRight; icol++ ) - { - if ( index >= pWindowData->BUFFERSIZE ) + for( irow = iTop; irow <= iBottom; irow++ ) + { + index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, ( USHORT ) iLeft, ( USHORT ) irow ); + for( icol = iLeft; icol <= iRight; icol++ ) { - break; + if( index >= pWindowData->BUFFERSIZE ) + { + break; + } + else + { + pWindowData->pColors[ index++ ] = bColor; + } } - else - { - pWindowData->pColors[ index++ ] = bColor; - } - } - } - hb_gt_wvwSetInvalidRect( pWindowData, (USHORT)iLeft, (USHORT)iTop, (USHORT)iRight, (USHORT)iBottom ); + } + hb_gt_wvwSetInvalidRect( pWindowData, ( USHORT ) iLeft, ( USHORT ) iTop, ( USHORT ) iRight, ( USHORT ) iBottom ); } static BOOL hb_gt_wvw_bSetMode( WIN_DATA * pWindowData, USHORT row, USHORT col ) { - BOOL bResult= FALSE; + BOOL bResult = FALSE; HFONT hFont; - if ( row<= WVW_MAX_ROWS && col<= WVW_MAX_COLS ) + if( row <= WVW_MAX_ROWS && col <= WVW_MAX_COLS ) { - if ( pWindowData->hWnd ) + if( pWindowData->hWnd ) { hFont = hb_gt_wvwGetFont( pWindowData->fontFace, pWindowData->fontHeight, pWindowData->fontWidth, pWindowData->fontWeight, pWindowData->fontQuality, pWindowData->CodePage ); - if ( hFont ) + if( hFont ) { /* make sure that the mode selected along with the current * font settings will fit in the window * * JC1: See my note - *x gtwvt comments out the following condition! (see also SetFont) - *x TODO: I THINK I am right to keep it, am I? + **x gtwvt comments out the following condition! (see also SetFont) + **x TODO: I THINK I am right to keep it, am I? */ - if ( hb_gt_wvwValidWindowSize( pWindowData, row,col, hFont, pWindowData->fontWidth, NULL, NULL ) ) + if( hb_gt_wvwValidWindowSize( pWindowData, row, col, hFont, pWindowData->fontWidth, NULL, NULL ) ) { - bResult = hb_gt_wvwInitWindow( pWindowData, pWindowData->hWnd, col, row ); + bResult = hb_gt_wvwInitWindow( pWindowData, pWindowData->hWnd, col, row ); } DeleteObject( hFont ); @@ -6613,190 +6559,190 @@ static BOOL hb_gt_wvw_bSetMode( WIN_DATA * pWindowData, USHORT row, USHORT col bResult = hb_gt_wvwAllocSpBuffer( pWindowData, row, col ); } } - return( bResult ); + return bResult; } static void hb_gt_wvw_vxPutch( WIN_DATA * pWindowData, USHORT iRow, USHORT iCol, int bColor, BYTE bChar ) { - USHORT index; + USHORT index; - index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, iCol, iRow ); - if ( index < pWindowData->BUFFERSIZE ) - { - pWindowData->pBuffer[ index ] = bChar; - pWindowData->pColors[ index ] = bColor; + index = hb_gt_wvwGetIndexForTextBuffer( pWindowData, iCol, iRow ); + if( index < pWindowData->BUFFERSIZE ) + { + pWindowData->pBuffer[ index ] = bChar; + pWindowData->pColors[ index ] = bColor; - /* determine bounds of rect around character to refresh - */ - hb_gt_wvwSetInvalidRect( pWindowData, iCol, iRow, iCol, iRow ); - } + /* determine bounds of rect around character to refresh + */ + hb_gt_wvwSetInvalidRect( pWindowData, iCol, iRow, iCol, iRow ); + } } static void hb_gt_wvw_usBox( WIN_DATA * pWindowData, int iTop, int iLeft, int iBottom, int iRight, const char * pbyFrame, int bColor ) { - int i; - int iRow; - int iCol; - int iHeight; - int iWidth; - USHORT sWidth = pWindowData->COLS; - USHORT sHeight = pWindowData->ROWS; - BYTE szBox[ 10 ]; - BYTE bPadCh = (BYTE) HB_GTSELF_GETCLEARCHAR( hb_gt_Base() ); + int i; + int iRow; + int iCol; + int iHeight; + int iWidth; + USHORT sWidth = pWindowData->COLS; + USHORT sHeight = pWindowData->ROWS; + BYTE szBox[ 10 ]; + BYTE bPadCh = ( BYTE ) HB_GTSELF_GETCLEARCHAR( hb_gt_Base() ); - if( ( iLeft >= 0 && iLeft < sWidth ) || - ( iRight >= 0 && iRight < sWidth ) || - ( iTop >= 0 && iTop < sHeight ) || - ( iBottom >= 0 && iBottom < sHeight ) ) - { - if( pbyFrame ) - { - for( i = 0; *pbyFrame && i < 9; ++i ) - bPadCh = szBox[ i ] = *pbyFrame++; - } - else - i = 0; + if( ( iLeft >= 0 && iLeft < sWidth ) || + ( iRight >= 0 && iRight < sWidth ) || + ( iTop >= 0 && iTop < sHeight ) || + ( iBottom >= 0 && iBottom < sHeight ) ) + { + if( pbyFrame ) + { + for( i = 0; *pbyFrame && i < 9; ++i ) + bPadCh = szBox[ i ] = *pbyFrame++; + } + else + i = 0; - while( i < 8 ) - szBox[ i++ ] = bPadCh; - szBox[ i ] = '\0'; + while( i < 8 ) + szBox[ i++ ] = bPadCh; + szBox[ i ] = '\0'; - /* Ensure that box is drawn from Top Left to Bottom Right. */ - if( iTop > iBottom ) - { - iRow = iTop; - iTop = iBottom; - iBottom = iRow; - } - if( iLeft > iRight ) - { - iRow = iLeft; - iLeft = iRight; - iRight = iRow; - } + /* Ensure that box is drawn from Top Left to Bottom Right. */ + if( iTop > iBottom ) + { + iRow = iTop; + iTop = iBottom; + iBottom = iRow; + } + if( iLeft > iRight ) + { + iRow = iLeft; + iLeft = iRight; + iRight = iRow; + } - /* Draw the box or line as specified */ - iHeight = iBottom - iTop + 1; - iWidth = iRight - iLeft + 1; + /* Draw the box or line as specified */ + iHeight = iBottom - iTop + 1; + iWidth = iRight - iLeft + 1; - hb_gt_wvw_vDispBegin( pWindowData ); + hb_gt_wvw_vDispBegin( pWindowData ); - if( iHeight > 1 && iWidth > 1 && - iTop >= 0 && iTop < sHeight && - iLeft >= 0 && iLeft < sWidth ) - { + if( iHeight > 1 && iWidth > 1 && + iTop >= 0 && iTop < sHeight && + iLeft >= 0 && iLeft < sWidth ) + { - hb_gt_wvw_vxPutch( pWindowData, (USHORT)iTop, (USHORT)iLeft, bColor, szBox[ 0 ] ); /* Upper Left corner */ - } + hb_gt_wvw_vxPutch( pWindowData, ( USHORT ) iTop, ( USHORT ) iLeft, bColor, szBox[ 0 ] ); /* Upper Left corner */ + } - iCol = ( iWidth > 1 ? iLeft + 1 : iLeft ); - if( iCol < 0 ) - { - iWidth += iCol; - iCol = 0; - } - if( iRight >= sWidth ) - { - iWidth -= iRight - sWidth; - } + iCol = ( iWidth > 1 ? iLeft + 1 : iLeft ); + if( iCol < 0 ) + { + iWidth += iCol; + iCol = 0; + } + if( iRight >= sWidth ) + { + iWidth -= iRight - sWidth; + } - if( iCol < iRight && iCol < sWidth && - iTop >= 0 && iTop < sHeight ) - { + if( iCol < iRight && iCol < sWidth && + iTop >= 0 && iTop < sHeight ) + { - hb_gt_wvw_vReplicate( pWindowData, iTop, iCol, bColor, HB_GT_ATTR_BOX, szBox[ 1 ], iWidth + ( ( iRight - iLeft ) > 1 ? -2 : 0 ) ); /* iTop line */ - } - if( iHeight > 1 && - ( iRight - iLeft ) > 0 && iRight < sWidth && - iTop >= 0 && iTop < sHeight ) - { + hb_gt_wvw_vReplicate( pWindowData, iTop, iCol, bColor, HB_GT_ATTR_BOX, szBox[ 1 ], iWidth + ( ( iRight - iLeft ) > 1 ? -2 : 0 ) ); /* iTop line */ + } + if( iHeight > 1 && + ( iRight - iLeft ) > 0 && iRight < sWidth && + iTop >= 0 && iTop < sHeight ) + { - hb_gt_wvw_vxPutch( pWindowData, (USHORT)iTop, (USHORT)iRight, bColor, szBox[ 2 ] ); /* Upper Right corner */ - } - if( szBox[ 8 ] && iHeight > 2 && iWidth > 2 ) - { - for( iRow = iTop + 1; iRow < iBottom; iRow++ ) + hb_gt_wvw_vxPutch( pWindowData, ( USHORT ) iTop, ( USHORT ) iRight, bColor, szBox[ 2 ] ); /* Upper Right corner */ + } + if( szBox[ 8 ] && iHeight > 2 && iWidth > 2 ) + { + for( iRow = iTop + 1; iRow < iBottom; iRow++ ) + { + if( iRow >= 0 && iRow < sHeight ) { - if( iRow >= 0 && iRow < sHeight ) - { - iCol = iLeft; - if( iCol < 0 ) - { - iCol = 0; /* The width was corrected earlier. */ - } - else - { + iCol = iLeft; + if( iCol < 0 ) + { + iCol = 0; /* The width was corrected earlier. */ + } + else + { - hb_gt_wvw_vxPutch( pWindowData, (USHORT)iRow, (USHORT)iCol++, bColor, szBox[ 7 ] ); /* Left side */ - } + hb_gt_wvw_vxPutch( pWindowData, ( USHORT ) iRow, ( USHORT ) iCol++, bColor, szBox[ 7 ] ); /* Left side */ + } - hb_gt_wvw_vReplicate( pWindowData, (USHORT)iRow, (USHORT)iCol, bColor, HB_GT_ATTR_BOX, szBox[ 8 ], iWidth - 2 ); /* Fill */ - if( iRight < sWidth ) - { + hb_gt_wvw_vReplicate( pWindowData, ( USHORT ) iRow, ( USHORT ) iCol, bColor, HB_GT_ATTR_BOX, szBox[ 8 ], iWidth - 2 ); /* Fill */ + if( iRight < sWidth ) + { - hb_gt_wvw_vxPutch( pWindowData, (USHORT)iRow, (USHORT)iRight, bColor, szBox[ 3 ] ); /* Right side */ - } - } + hb_gt_wvw_vxPutch( pWindowData, ( USHORT ) iRow, ( USHORT ) iRight, bColor, szBox[ 3 ] ); /* Right side */ + } } - } - else - { - for( iRow = ( iWidth > 1 ? iTop + 1 : iTop ); iRow < ( ( iRight - iLeft ) > 1 ? iBottom : iBottom + 1 ); iRow++ ) + } + } + else + { + for( iRow = ( iWidth > 1 ? iTop + 1 : iTop ); iRow < ( ( iRight - iLeft ) > 1 ? iBottom : iBottom + 1 ); iRow++ ) + { + if( iRow >= 0 && iRow < sHeight ) { - if( iRow >= 0 && iRow < sHeight ) - { - if( iLeft >= 0 && iLeft < sWidth ) - { + if( iLeft >= 0 && iLeft < sWidth ) + { - hb_gt_wvw_vxPutch( pWindowData, (USHORT)iRow, (USHORT)iLeft, bColor, szBox[ 7 ] ); /* Left side */ - } - if( ( iWidth > 1 || iLeft < 0 ) && iRight < sWidth ) - { + hb_gt_wvw_vxPutch( pWindowData, ( USHORT ) iRow, ( USHORT ) iLeft, bColor, szBox[ 7 ] ); /* Left side */ + } + if( ( iWidth > 1 || iLeft < 0 ) && iRight < sWidth ) + { - hb_gt_wvw_vxPutch( pWindowData, (USHORT)iRow, (USHORT)iRight, bColor, szBox[ 3 ] ); /* Right side */ - } - } + hb_gt_wvw_vxPutch( pWindowData, ( USHORT ) iRow, ( USHORT ) iRight, bColor, szBox[ 3 ] ); /* Right side */ + } } - } + } + } - if( iHeight > 1 && iWidth > 1 ) - { - if( iLeft >= 0 && iBottom < sHeight ) - { + if( iHeight > 1 && iWidth > 1 ) + { + if( iLeft >= 0 && iBottom < sHeight ) + { - hb_gt_wvw_vxPutch( pWindowData, (USHORT)iBottom, (USHORT)iLeft, bColor, szBox[ 6 ] ); /* Bottom iLeft corner */ - } - iCol = iLeft + 1; - if( iCol < 0 ) - { - iCol = 0; /* The width was corrected earlier. */ - } - if( iCol <= iRight && iBottom < sHeight ) - { + hb_gt_wvw_vxPutch( pWindowData, ( USHORT ) iBottom, ( USHORT ) iLeft, bColor, szBox[ 6 ] ); /* Bottom iLeft corner */ + } + iCol = iLeft + 1; + if( iCol < 0 ) + { + iCol = 0; /* The width was corrected earlier. */ + } + if( iCol <= iRight && iBottom < sHeight ) + { - hb_gt_wvw_vReplicate( pWindowData, iBottom, iCol, bColor, HB_GT_ATTR_BOX, szBox[ 5 ], iWidth - 2 ); /* Bottom line */ - } - if( iRight < sWidth && iBottom < sHeight ) - { + hb_gt_wvw_vReplicate( pWindowData, iBottom, iCol, bColor, HB_GT_ATTR_BOX, szBox[ 5 ], iWidth - 2 ); /* Bottom line */ + } + if( iRight < sWidth && iBottom < sHeight ) + { - hb_gt_wvw_vxPutch( pWindowData, (USHORT)iBottom, (USHORT)iRight, bColor, szBox[ 4 ] ); /* Bottom Right corner */ - } - } + hb_gt_wvw_vxPutch( pWindowData, ( USHORT ) iBottom, ( USHORT ) iRight, bColor, szBox[ 4 ] ); /* Bottom Right corner */ + } + } - hb_gt_wvw_vDispEnd( pWindowData ); - } + hb_gt_wvw_vDispEnd( pWindowData ); + } } static void hb_gt_wvw_vSetPos( WIN_DATA * pWindowData, int iRow, int iCol ) { - if ( iRow >= 0 && iRow< pWindowData->ROWS && iCol>=0 && iCol <= pWindowData->COLS ) - { - pWindowData->caretPos.x = iCol; - pWindowData->caretPos.y = iRow; - hb_gt_wvwValidateCaret( pWindowData ); - } + if( iRow >= 0 && iRow < pWindowData->ROWS && iCol >= 0 && iCol <= pWindowData->COLS ) + { + pWindowData->caretPos.x = iCol; + pWindowData->caretPos.y = iRow; + hb_gt_wvwValidateCaret( pWindowData ); + } } @@ -6817,10 +6763,10 @@ static void hb_gt_wvw_vSetPos( WIN_DATA * pWindowData, int iRow, int iCol ) static void hb_wvw_InitPendingRect( WIN_DATA * pWindowData ) { - pWindowData->rPaintPending.left = WVW_MAX_COLS-1; - pWindowData->rPaintPending.top = WVW_MAX_ROWS-1; - pWindowData->rPaintPending.right = 0; - pWindowData->rPaintPending.bottom = 0; + pWindowData->rPaintPending.left = WVW_MAX_COLS - 1; + pWindowData->rPaintPending.top = WVW_MAX_ROWS - 1; + pWindowData->rPaintPending.right = 0; + pWindowData->rPaintPending.bottom = 0; } @@ -6829,16 +6775,16 @@ static void hb_wvw_InitPendingRect( WIN_DATA * pWindowData ) static void hb_wvw_UpdatePendingRect( WIN_DATA * pWindowData, USHORT usRow1, USHORT usCol1, USHORT usRow2, USHORT usCol2 ) { - pWindowData->rPaintPending.left = HB_MIN( pWindowData->rPaintPending.left, usCol1 ); - pWindowData->rPaintPending.top = HB_MIN( pWindowData->rPaintPending.top, usRow1 ); - pWindowData->rPaintPending.right = HB_MAX( pWindowData->rPaintPending.right, usCol2 ); - pWindowData->rPaintPending.bottom = HB_MAX( pWindowData->rPaintPending.bottom, usRow2 ); + pWindowData->rPaintPending.left = HB_MIN( pWindowData->rPaintPending.left, usCol1 ); + pWindowData->rPaintPending.top = HB_MIN( pWindowData->rPaintPending.top, usRow1 ); + pWindowData->rPaintPending.right = HB_MAX( pWindowData->rPaintPending.right, usCol2 ); + pWindowData->rPaintPending.bottom = HB_MAX( pWindowData->rPaintPending.bottom, usRow2 ); } /* returns lineheight, ie. including linespacing if any */ BYTE hb_wvw_LineHeight( WIN_DATA * pWindowData ) { - return ((BYTE)(LONG)(pWindowData->PTEXTSIZE.y)) + (BYTE)pWindowData->byLineSpacing; + return ( ( BYTE ) ( LONG ) ( pWindowData->PTEXTSIZE.y ) ) + ( BYTE ) pWindowData->byLineSpacing; } /* fills linespace above and below the text area. @@ -6846,37 +6792,37 @@ BYTE hb_wvw_LineHeight( WIN_DATA * pWindowData ) has no effect if linespacing == 0 */ static void hb_gt_wvwFillLineSpace( WIN_DATA * pWindowData, HDC hdc, USHORT startCol, USHORT irow, USHORT len, BYTE byAttrib ) { - RECT rc = { 0 }; - LOGBRUSH lb = { 0 }; - HBRUSH hBrush; + RECT rc = { 0 }; + LOGBRUSH lb = { 0 }; + HBRUSH hBrush; - int byColorIndex = pWindowData->iLSpaceColor < 0 ? - ( byAttrib & 0x00F0 )>>4 : - pWindowData->iLSpaceColor; - COLORREF bkColor = _COLORS[ byColorIndex ]; + int byColorIndex = pWindowData->iLSpaceColor < 0 ? + ( byAttrib& 0x00F0 )> > 4 : + pWindowData->iLSpaceColor; + COLORREF bkColor = _COLORS[ byColorIndex ]; - rc.top = irow; - rc.left = startCol; - rc.bottom = irow; - rc.right = startCol + len - 1; - rc = hb_gt_wvwGetXYFromColRowRect( pWindowData, rc ); + rc.top = irow; + rc.left = startCol; + rc.bottom = irow; + rc.right = startCol + len - 1; + rc = hb_gt_wvwGetXYFromColRowRect( pWindowData, rc ); - lb.lbStyle = BS_SOLID; - lb.lbColor = bkColor; - lb.lbHatch = 0; + lb.lbStyle = BS_SOLID; + lb.lbColor = bkColor; + lb.lbHatch = 0; - hBrush = CreateBrushIndirect( &lb ); + hBrush = CreateBrushIndirect( &lb ); - rc.bottom = rc.top; - rc.top -= (pWindowData->byLineSpacing / 2); - FillRect( hdc, &rc, hBrush ); + rc.bottom = rc.top; + rc.top -= ( pWindowData->byLineSpacing / 2 ); + FillRect( hdc, &rc, hBrush ); - rc.top = rc.bottom + pWindowData->PTEXTSIZE.y; - rc.bottom = rc.top + (pWindowData->byLineSpacing / 2); - FillRect( hdc, &rc, hBrush ); + rc.top = rc.bottom + pWindowData->PTEXTSIZE.y; + rc.bottom = rc.top + ( pWindowData->byLineSpacing / 2 ); + FillRect( hdc, &rc, hBrush ); - SelectObject( s_pWvwData->s_pWindows[0]->hdc, (HBRUSH) s_pWvwData->s_sApp->OriginalBrush ); - DeleteObject( hBrush ); + SelectObject( s_pWvwData->s_pWindows[ 0 ]->hdc, ( HBRUSH ) s_pWvwData->s_sApp->OriginalBrush ); + DeleteObject( hBrush ); } @@ -6892,104 +6838,106 @@ static void hb_gt_wvwFillLineSpace( WIN_DATA * pWindowData, HDC hdc, USHORT star BOOL hb_gt_wvwSetMenuKeyEvent( UINT usWinNum, int iMenuKeyEvent ) { - int iOldEvent; + int iOldEvent; - iOldEvent = s_pWvwData->s_pWindows[usWinNum]->MenuKeyEvent ; - if ( iMenuKeyEvent ) - { - s_pWvwData->s_pWindows[usWinNum]->MenuKeyEvent = iMenuKeyEvent; - } - return( iOldEvent ); + iOldEvent = s_pWvwData->s_pWindows[ usWinNum ]->MenuKeyEvent; + if( iMenuKeyEvent ) + { + s_pWvwData->s_pWindows[ usWinNum ]->MenuKeyEvent = iMenuKeyEvent; + } + return iOldEvent; } static BOOL hb_gt_wvwSetCentreWindow( UINT usWinNum, BOOL bCentre, BOOL bPaint ) { - BOOL bWasCentre; + BOOL bWasCentre; - bWasCentre = s_pWvwData->s_pWindows[usWinNum]->CentreWindow ; - s_pWvwData->s_pWindows[usWinNum]->CentreWindow = bCentre; - if ( bPaint ) - { + bWasCentre = s_pWvwData->s_pWindows[ usWinNum ]->CentreWindow; + s_pWvwData->s_pWindows[ usWinNum ]->CentreWindow = bCentre; + if( bPaint ) + { - if (!IsZoomed( s_pWvwData->s_pWindows[usWinNum]->hWnd )) - { - ShowWindow( s_pWvwData->s_pWindows[usWinNum]->hWnd, SW_RESTORE ); + if( ! IsZoomed( s_pWvwData->s_pWindows[ usWinNum ]->hWnd ) ) + { + ShowWindow( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, SW_RESTORE ); - } - else - { - ShowWindow( s_pWvwData->s_pWindows[usWinNum]->hWnd, SW_MAXIMIZE ); - } + } + else + { + ShowWindow( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, SW_MAXIMIZE ); + } - hb_gt_wvwResetWindowSize( s_pWvwData->s_pWindows[ usWinNum ], s_pWvwData->s_pWindows[usWinNum]->hWnd ) ; - } - return( bWasCentre ); + hb_gt_wvwResetWindowSize( s_pWvwData->s_pWindows[ usWinNum ], s_pWvwData->s_pWindows[ usWinNum ]->hWnd ); + } + return bWasCentre; } void hb_gt_wvwResetWindow( UINT usWinNum ) { - hb_gt_wvwResetWindowSize( s_pWvwData->s_pWindows[ usWinNum ], s_pWvwData->s_pWindows[usWinNum]->hWnd ) ; + hb_gt_wvwResetWindowSize( s_pWvwData->s_pWindows[ usWinNum ], s_pWvwData->s_pWindows[ usWinNum ]->hWnd ); } static BOOL hb_gt_wvwSetCodePage( UINT usWinNum, int iCodePage ) { - int iOldCodePage; + int iOldCodePage; - iOldCodePage = s_pWvwData->s_pWindows[usWinNum]->CodePage ; - if ( iCodePage ) - { - s_pWvwData->s_pWindows[usWinNum]->CodePage = iCodePage; - } - if ( iOldCodePage != iCodePage ) - { - hb_gt_wvwResetWindow( usWinNum ); - } - return( iOldCodePage ); + iOldCodePage = s_pWvwData->s_pWindows[ usWinNum ]->CodePage; + if( iCodePage ) + { + s_pWvwData->s_pWindows[ usWinNum ]->CodePage = iCodePage; + } + if( iOldCodePage != iCodePage ) + { + hb_gt_wvwResetWindow( usWinNum ); + } + return iOldCodePage; } int hb_gt_wvwGetLastMenuEvent( UINT usWinNum ) { - return( s_pWvwData->s_pWindows[usWinNum]->LastMenuEvent ); + return s_pWvwData->s_pWindows[ usWinNum ]->LastMenuEvent; } int hb_gt_wvwSetLastMenuEvent( UINT usWinNum, int iLastMenuEvent ) { - int iRetval = s_pWvwData->s_pWindows[usWinNum]->LastMenuEvent; - s_pWvwData->s_pWindows[usWinNum]->LastMenuEvent = iLastMenuEvent; - return( iRetval ); + int iRetval = s_pWvwData->s_pWindows[ usWinNum ]->LastMenuEvent; + + s_pWvwData->s_pWindows[ usWinNum ]->LastMenuEvent = iLastMenuEvent; + return iRetval; } static void hb_gt_wvwSetWindowTitle( UINT usWinNum, const char * title ) { - LPTSTR text = HB_TCHAR_CONVTO( title ); - SetWindowText( s_pWvwData->s_pWindows[usWinNum]->hWnd, text ); - HB_TCHAR_FREE( text ); + LPTSTR text = HB_TCHAR_CONVTO( title ); + + SetWindowText( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, text ); + HB_TCHAR_FREE( text ); } static BOOL hb_gt_wvw_GetWindowTitle( UINT usWinNum, char ** title ) { - TCHAR buffer[WVW_MAX_TITLE_SIZE]; - int iResult; + TCHAR buffer[ WVW_MAX_TITLE_SIZE ]; + int iResult; - iResult = GetWindowText( s_pWvwData->s_pWindows[usWinNum]->hWnd, buffer, WVW_MAX_TITLE_SIZE ); + iResult = GetWindowText( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, buffer, WVW_MAX_TITLE_SIZE ); if( iResult > 0 ) { #ifdef UNICODE - *title = hb_wcntomb( buffer, iResult ); + *title = hb_wcntomb( buffer, iResult ); #else - *title = hb_strndup( buffer, iResult ); + *title = hb_strndup( buffer, iResult ); #endif return TRUE; } @@ -7001,297 +6949,299 @@ static BOOL hb_gt_wvw_GetWindowTitle( UINT usWinNum, char ** title ) //static DWORD hb_gt_wvwSetWindowIcon( UINT usWinNum, int icon, char *lpIconName ) -static HICON hb_gt_wvwSetWindowIcon( UINT usWinNum, int icon, const char *lpIconName ) +static HICON hb_gt_wvwSetWindowIcon( UINT usWinNum, int icon, const char * lpIconName ) { - HICON hIcon; + HICON hIcon; - if( lpIconName == NULL ) - { - hIcon = LoadIcon( s_pWvwData->hInstance, MAKEINTRESOURCE( icon ) ); - } - else - { - hIcon = LoadIcon( s_pWvwData->hInstance, lpIconName ); - } + if( lpIconName == NULL ) + { + hIcon = LoadIcon( s_pWvwData->hInstance, MAKEINTRESOURCE( icon ) ); + } + else + { + hIcon = LoadIcon( s_pWvwData->hInstance, lpIconName ); + } - if ( hIcon ) - { - SendMessage( s_pWvwData->s_pWindows[usWinNum]->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM )hIcon ); /* Set Title Bar ICON */ - SendMessage( s_pWvwData->s_pWindows[usWinNum]->hWnd, WM_SETICON, ICON_BIG, ( LPARAM )hIcon ); /* Set Task List Icon */ - s_pWvwData->s_pWindows[usWinNum]->hIcon = hIcon; - } + if( hIcon ) + { + SendMessage( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) hIcon ); /* Set Title Bar ICON */ + SendMessage( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, WM_SETICON, ICON_BIG, ( LPARAM ) hIcon ); /* Set Task List Icon */ + s_pWvwData->s_pWindows[ usWinNum ]->hIcon = hIcon; + } // return( ( DWORD ) hIcon ) ; - return( hIcon ) ; + return hIcon; } //static DWORD hb_gt_wvwSetWindowIconFromFile( UINT usWinNum, char *icon ) -static HICON hb_gt_wvwSetWindowIconFromFile( UINT usWinNum, const char *icon ) +static HICON hb_gt_wvwSetWindowIconFromFile( UINT usWinNum, const char * icon ) { - HICON hIcon = (HICON) LoadImage( ( HINSTANCE ) NULL, icon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); + HICON hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, icon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); - if ( hIcon ) - { - SendMessage( s_pWvwData->s_pWindows[usWinNum]->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) hIcon ); /* Set Title Bar ICON */ - SendMessage( s_pWvwData->s_pWindows[usWinNum]->hWnd, WM_SETICON, ICON_BIG , ( LPARAM ) hIcon ); /* Set Task List Icon */ - s_pWvwData->s_pWindows[usWinNum]->hIcon = hIcon; - } + if( hIcon ) + { + SendMessage( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) hIcon ); /* Set Title Bar ICON */ + SendMessage( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, WM_SETICON, ICON_BIG, ( LPARAM ) hIcon ); /* Set Task List Icon */ + s_pWvwData->s_pWindows[ usWinNum ]->hIcon = hIcon; + } // return( ( DWORD ) hIcon ) ; - return( hIcon ) ; + return hIcon; } int hb_gt_wvwGetWindowTitle( UINT usWinNum, char * title, int length ) { - return( GetWindowText( s_pWvwData->s_pWindows[usWinNum]->hWnd, title, length ) ); + return GetWindowText( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, title, length ); } BOOL hb_gt_wvwSetFont( UINT usWinNum, const char * fontFace, int height, int width, int Bold, int Quality ) { - int size; - BOOL bResult = FALSE ; - HFONT hFont = hb_gt_wvwGetFont( fontFace, height, width, Bold, Quality, s_pWvwData->s_pWindows[usWinNum]->CodePage ); - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + int size; + BOOL bResult = FALSE; + HFONT hFont = hb_gt_wvwGetFont( fontFace, height, width, Bold, Quality, s_pWvwData->s_pWindows[ usWinNum ]->CodePage ); + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; - /* make sure the font could actually be created - */ - if ( hFont ) - { - /* make sure that the font will fit inside the - * window with the current pWindowData->ROWS and pWindowData->COLS setting - * - *JC1: There's definitely something WRONG with this way of thinking. - * This makes effectively impossible to enlarge the window from it's - * initial size. - * - *x with the above remark, gtwvt comments out the following condition: - *x TODO: I THINK I am I to keep it, am I? - */ + /* make sure the font could actually be created + */ + if( hFont ) + { + /* make sure that the font will fit inside the + * window with the current pWindowData->ROWS and pWindowData->COLS setting + * + **JC1: There's definitely something WRONG with this way of thinking. + * This makes effectively impossible to enlarge the window from it's + * initial size. + * + **x with the above remark, gtwvt comments out the following condition: + **x TODO: I THINK I am I to keep it, am I? + */ - if ( hb_gt_wvwValidWindowSize( pWindowData, pWindowData->ROWS,pWindowData->COLS, hFont, width, NULL, NULL ) ) - { - pWindowData->fontHeight = height; - pWindowData->fontWidth = width; - pWindowData->fontWeight = Bold; - pWindowData->fontQuality = Quality; - - size = strlen( fontFace ); - if ( ( size > 0 ) && ( size < LF_FACESIZE-1 ) ) + if( hb_gt_wvwValidWindowSize( pWindowData, pWindowData->ROWS, pWindowData->COLS, hFont, width, NULL, NULL ) ) { - strcpy( pWindowData->fontFace, fontFace ); - } - if ( pWindowData->hWnd ) - { - /* resize the window based on new fonts - */ - hb_gt_wvwResetWindowSize( pWindowData, pWindowData->hWnd ); + pWindowData->fontHeight = height; + pWindowData->fontWidth = width; + pWindowData->fontWeight = Bold; + pWindowData->fontQuality = Quality; - /* force resize of caret - */ - hb_gt_wvwKillCaret(pWindowData); - hb_gt_wvwCreateCaret(pWindowData); + size = strlen( fontFace ); + if( ( size > 0 ) && ( size < LF_FACESIZE - 1 ) ) + { + strcpy( pWindowData->fontFace, fontFace ); + } + if( pWindowData->hWnd ) + { + /* resize the window based on new fonts + */ + hb_gt_wvwResetWindowSize( pWindowData, pWindowData->hWnd ); + + /* force resize of caret + */ + hb_gt_wvwKillCaret( pWindowData ); + hb_gt_wvwCreateCaret( pWindowData ); + } + bResult = TRUE; } - bResult= TRUE; - } - DeleteObject( hFont ); - } - return( bResult ); + DeleteObject( hFont ); + } + return bResult; } HWND hb_gt_wvwGetWindowHandle( UINT usWinNum ) { - return( s_pWvwData->s_pWindows[usWinNum]->hWnd ); + return s_pWvwData->s_pWindows[ usWinNum ]->hWnd; } void hb_gt_wvwPostMessage( UINT usWinNum, int message ) { - SendMessage( s_pWvwData->s_pWindows[usWinNum]->hWnd, WM_CHAR,message, 0 ); + SendMessage( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, WM_CHAR, message, 0 ); } BOOL hb_gt_wvwSetWindowPos( UINT usWinNum, int left, int top ) { - RECT wi = { 0 }; + RECT wi = { 0 }; - GetWindowRect( s_pWvwData->s_pWindows[usWinNum]->hWnd, &wi ); - return( SetWindowPos( s_pWvwData->s_pWindows[usWinNum]->hWnd, NULL, left, top, ( wi.right-wi.left )+1, ( wi.bottom-wi.top )+1, SWP_NOZORDER ) ); + GetWindowRect( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, &wi ); + return SetWindowPos( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, NULL, left, top, ( wi.right - wi.left ) + 1, ( wi.bottom - wi.top ) + 1, SWP_NOZORDER ); } BOOL hb_gt_wvwSetAltF4Close( BOOL bCanClose ) { - BOOL bWas; + BOOL bWas; - bWas = s_pWvwData->s_sApp->AltF4Close; - s_pWvwData->s_sApp->AltF4Close = bCanClose; - return( bWas ); + bWas = s_pWvwData->s_sApp->AltF4Close; + s_pWvwData->s_sApp->AltF4Close = bCanClose; + return bWas; } void hb_gt_wvwDoProcessMessages( UINT usWinNum ) { - /*NOTE: despite the parameter, the following will actually process messages for all windows*/ - hb_gt_wvwProcessMessages( s_pWvwData->s_pWindows[ usWinNum ] ); + /*NOTE: despite the parameter, the following will actually process messages for all windows*/ + hb_gt_wvwProcessMessages( s_pWvwData->s_pWindows[ usWinNum ] ); } BOOL hb_gt_wvwSetMouseMove( UINT usWinNum, BOOL bHandleEvent ) { - BOOL bWas = s_pWvwData->s_pWindows[usWinNum]->MouseMove; - s_pWvwData->s_pWindows[usWinNum]->MouseMove = bHandleEvent; - return( bWas ); + BOOL bWas = s_pWvwData->s_pWindows[ usWinNum ]->MouseMove; + + s_pWvwData->s_pWindows[ usWinNum ]->MouseMove = bHandleEvent; + return bWas; } BOOL hb_gt_wvwEnableShortCuts( UINT usWinNum, BOOL bEnable ) { - BOOL bWas = s_pWvwData->s_pWindows[usWinNum]->EnableShortCuts; - s_pWvwData->s_pWindows[usWinNum]->EnableShortCuts = bEnable; - return( bWas ); + BOOL bWas = s_pWvwData->s_pWindows[ usWinNum ]->EnableShortCuts; + + s_pWvwData->s_pWindows[ usWinNum ]->EnableShortCuts = bEnable; + return bWas; } -BOOL GetIPictDimension(IPicture * pPic, int * pWidth, int * pHeight) +BOOL GetIPictDimension( IPicture * pPic, int * pWidth, int * pHeight ) { - OLE_HANDLE oHtemp; - BITMAP bmTemp; + OLE_HANDLE oHtemp; + BITMAP bmTemp; - pPic->lpVtbl->get_Handle( pPic, &oHtemp ); + pPic->lpVtbl->get_Handle( pPic, &oHtemp ); - GetObject((HBITMAP) oHtemp, sizeof(BITMAP), (LPSTR)&bmTemp); - *pWidth = bmTemp.bmWidth; - *pHeight = bmTemp.bmHeight; + GetObject( ( HBITMAP ) oHtemp, sizeof( BITMAP ), ( LPSTR ) &bmTemp ); + *pWidth = bmTemp.bmWidth; + *pHeight = bmTemp.bmHeight; - return TRUE; + return TRUE; } -BOOL GetImageDimension(const char * image, int * pWidth, int * pHeight) +BOOL GetImageDimension( const char * image, int * pWidth, int * pHeight ) { - HBITMAP hBitmap; - BOOL bResult = TRUE; + HBITMAP hBitmap; + BOOL bResult = TRUE; - *pWidth = 0; *pHeight = 0; - hBitmap = FindUserBitmapHandle(image, pWidth, pHeight); + *pWidth = 0; *pHeight = 0; + hBitmap = FindUserBitmapHandle( image, pWidth, pHeight ); - if (!hBitmap) - { - IPicture * pPic; + if( ! hBitmap ) + { + IPicture * pPic; - *pWidth = 0; *pHeight = 0; + *pWidth = 0; *pHeight = 0; - pPic = hb_gt_wvwLoadPicture( image ); - if (!pPic) - { - return FALSE; - } + pPic = hb_gt_wvwLoadPicture( image ); + if( ! pPic ) + { + return FALSE; + } - bResult = GetIPictDimension(pPic, pWidth, pHeight); + bResult = GetIPictDimension( pPic, pWidth, pHeight ); - hb_gt_wvwDestroyPicture( pPic ); - } + hb_gt_wvwDestroyPicture( pPic ); + } - return bResult; + return bResult; } -static void DrawTransparentBitmap(HDC hdc, HBITMAP hBitmap, short xStart, - short yStart, - int iDestWidth, int iDestHeight) +static void DrawTransparentBitmap( HDC hdc, HBITMAP hBitmap, short xStart, + short yStart, + int iDestWidth, int iDestHeight ) { - BITMAP bm; - COLORREF cColor; - HBITMAP bmAndBack, bmAndObject, bmAndMem; - HBITMAP bmBackOld, bmObjectOld, bmMemOld; - HDC hdcMem, hdcBack, hdcObject, hdcTemp; - HDC hdcCopy; - HBITMAP bmStretch, bmStretchOld; - POINT ptSize; - COLORREF cTransparentColor; + BITMAP bm; + COLORREF cColor; + HBITMAP bmAndBack, bmAndObject, bmAndMem; + HBITMAP bmBackOld, bmObjectOld, bmMemOld; + HDC hdcMem, hdcBack, hdcObject, hdcTemp; + HDC hdcCopy; + HBITMAP bmStretch, bmStretchOld; + POINT ptSize; + COLORREF cTransparentColor; - hdcCopy = CreateCompatibleDC(hdc); - SelectObject(hdcCopy, hBitmap); + hdcCopy = CreateCompatibleDC( hdc ); + SelectObject( hdcCopy, hBitmap ); - cTransparentColor = GetPixel(hdcCopy, - 0, - 0); + cTransparentColor = GetPixel( hdcCopy, + 0, + 0 ); - GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); - ptSize.x = bm.bmWidth; - ptSize.y = bm.bmHeight; - DPtoLP(hdcCopy, &ptSize, 1); + GetObject( hBitmap, sizeof( BITMAP ), ( LPSTR ) &bm ); + ptSize.x = bm.bmWidth; + ptSize.y = bm.bmHeight; + DPtoLP( hdcCopy, &ptSize, 1 ); - bmStretch = CreateCompatibleBitmap(hdc, iDestWidth, iDestHeight); - hdcTemp = CreateCompatibleDC(hdc); - bmStretchOld = (HBITMAP) SelectObject(hdcTemp, bmStretch); + bmStretch = CreateCompatibleBitmap( hdc, iDestWidth, iDestHeight ); + hdcTemp = CreateCompatibleDC( hdc ); + bmStretchOld = ( HBITMAP ) SelectObject( hdcTemp, bmStretch ); - StretchBlt(hdcTemp, 0, 0, - iDestWidth, iDestHeight, - hdcCopy, 0, 0, - ptSize.x, ptSize.y, - SRCCOPY); + StretchBlt( hdcTemp, 0, 0, + iDestWidth, iDestHeight, + hdcCopy, 0, 0, + ptSize.x, ptSize.y, + SRCCOPY ); - hdcBack = CreateCompatibleDC(hdc); - hdcObject = CreateCompatibleDC(hdc); - hdcMem = CreateCompatibleDC(hdc); + hdcBack = CreateCompatibleDC( hdc ); + hdcObject = CreateCompatibleDC( hdc ); + hdcMem = CreateCompatibleDC( hdc ); - bmAndBack = CreateBitmap(iDestWidth, iDestHeight, 1, 1, NULL); + bmAndBack = CreateBitmap( iDestWidth, iDestHeight, 1, 1, NULL ); - bmAndObject = CreateBitmap(iDestWidth, iDestHeight, 1, 1, NULL); + bmAndObject = CreateBitmap( iDestWidth, iDestHeight, 1, 1, NULL ); - bmAndMem = CreateCompatibleBitmap(hdc, iDestWidth, iDestHeight); + bmAndMem = CreateCompatibleBitmap( hdc, iDestWidth, iDestHeight ); - bmBackOld = (HBITMAP) SelectObject(hdcBack, bmAndBack); - bmObjectOld = (HBITMAP) SelectObject(hdcObject, bmAndObject); - bmMemOld = (HBITMAP) SelectObject(hdcMem, bmAndMem); + bmBackOld = ( HBITMAP ) SelectObject( hdcBack, bmAndBack ); + bmObjectOld = ( HBITMAP ) SelectObject( hdcObject, bmAndObject ); + bmMemOld = ( HBITMAP ) SelectObject( hdcMem, bmAndMem ); - SetMapMode(hdcTemp, GetMapMode(hdc)); + SetMapMode( hdcTemp, GetMapMode( hdc ) ); - cColor = SetBkColor(hdcTemp, cTransparentColor); + cColor = SetBkColor( hdcTemp, cTransparentColor ); - BitBlt(hdcObject, 0, 0, iDestWidth, iDestHeight, hdcTemp, 0, 0, - SRCCOPY); + BitBlt( hdcObject, 0, 0, iDestWidth, iDestHeight, hdcTemp, 0, 0, + SRCCOPY ); - SetBkColor(hdcTemp, cColor); + SetBkColor( hdcTemp, cColor ); - BitBlt(hdcBack, 0, 0, iDestWidth, iDestHeight, hdcObject, 0, 0, - NOTSRCCOPY); + BitBlt( hdcBack, 0, 0, iDestWidth, iDestHeight, hdcObject, 0, 0, + NOTSRCCOPY ); - BitBlt(hdcMem, 0, 0, iDestWidth, iDestHeight, hdc, xStart, yStart, - SRCCOPY); + BitBlt( hdcMem, 0, 0, iDestWidth, iDestHeight, hdc, xStart, yStart, + SRCCOPY ); - BitBlt(hdcMem, 0, 0, iDestWidth, iDestHeight, hdcObject, 0, 0, SRCAND); + BitBlt( hdcMem, 0, 0, iDestWidth, iDestHeight, hdcObject, 0, 0, SRCAND ); - BitBlt(hdcTemp, 0, 0, iDestWidth, iDestHeight, hdcBack, 0, 0, SRCAND); + BitBlt( hdcTemp, 0, 0, iDestWidth, iDestHeight, hdcBack, 0, 0, SRCAND ); - BitBlt(hdcMem, 0, 0, iDestWidth, iDestHeight, hdcTemp, 0, 0, SRCPAINT); + BitBlt( hdcMem, 0, 0, iDestWidth, iDestHeight, hdcTemp, 0, 0, SRCPAINT ); - BitBlt(hdc, xStart, yStart, iDestWidth, iDestHeight, hdcMem, 0, 0, - SRCCOPY); + BitBlt( hdc, xStart, yStart, iDestWidth, iDestHeight, hdcMem, 0, 0, + SRCCOPY ); - DeleteObject(SelectObject(hdcBack, bmBackOld)); - DeleteObject(SelectObject(hdcObject, bmObjectOld)); - DeleteObject(SelectObject(hdcMem, bmMemOld)); - DeleteObject(SelectObject(hdcTemp, bmStretchOld)); + DeleteObject( SelectObject( hdcBack, bmBackOld ) ); + DeleteObject( SelectObject( hdcObject, bmObjectOld ) ); + DeleteObject( SelectObject( hdcMem, bmMemOld ) ); + DeleteObject( SelectObject( hdcTemp, bmStretchOld ) ); - DeleteDC(hdcMem); - DeleteDC(hdcBack); - DeleteDC(hdcObject); - DeleteDC(hdcTemp); - DeleteDC(hdcCopy); + DeleteDC( hdcMem ); + DeleteDC( hdcBack ); + DeleteDC( hdcObject ); + DeleteDC( hdcTemp ); + DeleteDC( hdcCopy ); } /* 20060724 Notes: @@ -7306,236 +7256,236 @@ static void DrawTransparentBitmap(HDC hdc, HBITMAP hBitmap, short xStart, */ BOOL hb_gt_wvwDrawImage( UINT usWinNum, int x1, int y1, int wd, int ht, const char * image, BOOL bTransparent ) { - HBITMAP hBitmap; - BOOL bResult; - int iWidth, iHeight; - HDC hdc, hdcMem; + HBITMAP hBitmap; + BOOL bResult; + int iWidth, iHeight; + HDC hdc, hdcMem; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; - iWidth = 0; iHeight = 0; + iWidth = 0; iHeight = 0; - hBitmap = FindUserBitmapHandle(image, &iWidth, &iHeight); - if (!hBitmap) - { - IPicture * pPic; - OLE_HANDLE oHtemp; - BITMAP bmTemp; + hBitmap = FindUserBitmapHandle( image, &iWidth, &iHeight ); + if( ! hBitmap ) + { + IPicture * pPic; + OLE_HANDLE oHtemp; + BITMAP bmTemp; - pPic = hb_gt_wvwLoadPicture( image ); - if (!pPic) - { - return FALSE; - } + pPic = hb_gt_wvwLoadPicture( image ); + if( ! pPic ) + { + return FALSE; + } - /* 20060724 canNOT do it this way: - pPic->lpVtbl->get_Width( pPic,&lWidth ); - pPic->lpVtbl->get_Height( pPic,&lHeight ); - iWidth = (int) lWidth; - iHeight = (int) lHeight; - */ + /* 20060724 canNOT do it this way: + pPic->lpVtbl->get_Width( pPic,&lWidth ); + pPic->lpVtbl->get_Height( pPic,&lHeight ); + iWidth = (int) lWidth; + iHeight = (int) lHeight; + */ - pPic->lpVtbl->get_Handle( pPic, &oHtemp ); + pPic->lpVtbl->get_Handle( pPic, &oHtemp ); - hBitmap = (HBITMAP) CopyImage((HBITMAP) oHtemp, IMAGE_BITMAP,0,0, - LR_COPYRETURNORG); + hBitmap = ( HBITMAP ) CopyImage( ( HBITMAP ) oHtemp, IMAGE_BITMAP, 0, 0, + LR_COPYRETURNORG ); - hb_gt_wvwDestroyPicture( pPic ); + hb_gt_wvwDestroyPicture( pPic ); - if (!hBitmap) - { - return FALSE; - } + if( ! hBitmap ) + { + return FALSE; + } - GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bmTemp); - iWidth = bmTemp.bmWidth; - iHeight = bmTemp.bmHeight; + GetObject( hBitmap, sizeof( BITMAP ), ( LPSTR ) &bmTemp ); + iWidth = bmTemp.bmWidth; + iHeight = bmTemp.bmHeight; - AddUserBitmapHandle(image, hBitmap, iWidth, iHeight); - } + AddUserBitmapHandle( image, hBitmap, iWidth, iHeight ); + } - hdc = GetDC (pWindowData->hWnd) ; + hdc = GetDC( pWindowData->hWnd ); - if (bTransparent) - { - DrawTransparentBitmap(hdc, - hBitmap, - (short)x1, - (short)y1, - wd, - ht); - bResult = TRUE; - } - else - { - int iOldMode; + if( bTransparent ) + { + DrawTransparentBitmap( hdc, + hBitmap, + ( short ) x1, + ( short ) y1, + wd, + ht ); + bResult = TRUE; + } + else + { + int iOldMode; - hdcMem = CreateCompatibleDC(hdc); + hdcMem = CreateCompatibleDC( hdc ); - SelectObject(hdcMem, hBitmap); + SelectObject( hdcMem, hBitmap ); - iOldMode = SetStretchBltMode( hdc, COLORONCOLOR ); + iOldMode = SetStretchBltMode( hdc, COLORONCOLOR ); - bResult = StretchBlt( - hdc, /* handle to destination DC */ - x1, /* x-coord of destination upper-left corner */ - y1, /* y-coord of destination upper-left corner */ - wd, /* width of destination rectangle */ - ht, /* height of destination rectangle */ - hdcMem, /* handle to source DC */ - 0, /* x-coord of source upper-left corner */ - 0, /* y-coord of source upper-left corner */ - iWidth, /* width of source rectangle */ - iHeight, /* height of source rectangle */ - SRCCOPY /* raster operation code */ - ); + bResult = StretchBlt( + hdc, /* handle to destination DC */ + x1, /* x-coord of destination upper-left corner */ + y1, /* y-coord of destination upper-left corner */ + wd, /* width of destination rectangle */ + ht, /* height of destination rectangle */ + hdcMem, /* handle to source DC */ + 0, /* x-coord of source upper-left corner */ + 0, /* y-coord of source upper-left corner */ + iWidth, /* width of source rectangle */ + iHeight, /* height of source rectangle */ + SRCCOPY /* raster operation code */ + ); - SetStretchBltMode( hdc, iOldMode ); + SetStretchBltMode( hdc, iOldMode ); - DeleteDC(hdcMem); + DeleteDC( hdcMem ); - } + } - ReleaseDC(pWindowData->hWnd, hdc); + ReleaseDC( pWindowData->hWnd, hdc ); - return( bResult ); + return bResult; } IPicture * hb_gt_wvwLoadPicture( const char * image ) { - IStream *iStream; + IStream * iStream; - LPVOID iPicture = NULL; - HGLOBAL hGlobal; - HANDLE hFile; - DWORD nFileSize; - DWORD nReadByte; + LPVOID iPicture = NULL; + HGLOBAL hGlobal; + HANDLE hFile; + DWORD nFileSize; + DWORD nReadByte; - hFile = CreateFile( image, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); - if ( hFile != INVALID_HANDLE_VALUE ) - { - nFileSize = GetFileSize( hFile, NULL ); + hFile = CreateFile( image, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); + if( hFile != INVALID_HANDLE_VALUE ) + { + nFileSize = GetFileSize( hFile, NULL ); - if ( nFileSize != INVALID_FILE_SIZE ) - { - hGlobal = GlobalAlloc( GPTR, nFileSize ); - - if ( hGlobal ) + if( nFileSize != INVALID_FILE_SIZE ) { - if ( ReadFile( hFile, hGlobal, nFileSize, &nReadByte, NULL ) ) - { - CreateStreamOnHGlobal( hGlobal, TRUE, &iStream ); + hGlobal = GlobalAlloc( GPTR, nFileSize ); - OleLoadPicture( iStream, nFileSize, TRUE, (REFIID) &IID_IPicture, &iPicture ); + if( hGlobal ) + { + if( ReadFile( hFile, hGlobal, nFileSize, &nReadByte, NULL ) ) + { + CreateStreamOnHGlobal( hGlobal, TRUE, &iStream ); - } - GlobalFree( hGlobal ); + OleLoadPicture( iStream, nFileSize, TRUE, ( REFIID ) &IID_IPicture, &iPicture ); + + } + GlobalFree( hGlobal ); + } } - } - CloseHandle( hFile ); - } + CloseHandle( hFile ); + } - return ( IPicture * ) iPicture; + return ( IPicture * ) iPicture; } BOOL hb_gt_wvwRenderPicture( UINT usWinNum, int x1, int y1, int wd, int ht, IPicture * iPicture, BOOL bTransp ) { - LONG lWidth,lHeight; - int x,y,xe,ye; - int c = x1 ; - int r = y1 ; - int dc = wd ; - int dr = ht ; - int tor = 0 ; - int toc = 0 ; - HRGN hrgn1; - POINT lpp = { 0 }; - BOOL bResult = FALSE; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; + LONG lWidth, lHeight; + int x, y, xe, ye; + int c = x1; + int r = y1; + int dc = wd; + int dr = ht; + int tor = 0; + int toc = 0; + HRGN hrgn1; + POINT lpp = { 0 }; + BOOL bResult = FALSE; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; - if ( iPicture ) - { - /* if bTransp, we use different method */ - if ( bTransp ) - { - OLE_HANDLE oHtemp; - HDC hdc; - - iPicture->lpVtbl->get_Handle( iPicture, &oHtemp ); - - if ( oHtemp ) + if( iPicture ) + { + /* if bTransp, we use different method */ + if( bTransp ) { - hdc = GetDC (pWindowData->hWnd) ; - DrawTransparentBitmap(hdc, - (HBITMAP) oHtemp, - (short)x1, - (short)y1, - wd, - ht); - ReleaseDC(pWindowData->hWnd, hdc); + OLE_HANDLE oHtemp; + HDC hdc; - bResult = TRUE; + iPicture->lpVtbl->get_Handle( iPicture, &oHtemp ); + + if( oHtemp ) + { + hdc = GetDC( pWindowData->hWnd ); + DrawTransparentBitmap( hdc, + ( HBITMAP ) oHtemp, + ( short ) x1, + ( short ) y1, + wd, + ht ); + ReleaseDC( pWindowData->hWnd, hdc ); + + bResult = TRUE; + } + else + { + bResult = FALSE; + } + return bResult; } - else + /* endif bTransp, we use different method */ + + iPicture->lpVtbl->get_Width( iPicture, &lWidth ); + iPicture->lpVtbl->get_Height( iPicture, &lHeight ); + + if( dc == 0 ) { - bResult = FALSE; + dc = ( int ) ( ( float ) dr * lWidth / lHeight ); } - return( bResult ); - } - /* endif bTransp, we use different method */ - - iPicture->lpVtbl->get_Width( iPicture,&lWidth ); - iPicture->lpVtbl->get_Height( iPicture,&lHeight ); - - if ( dc == 0 ) - { - dc = ( int ) ( ( float ) dr * lWidth / lHeight ); - } - if ( dr == 0 ) - { - dr = ( int ) ( ( float ) dc * lHeight / lWidth ); - } - if ( tor == 0 ) - { - tor = dr; - } - if ( toc == 0 ) - { - toc = dc; - } - x = c; - y = r; - xe = c + toc - 1; - ye = r + tor - 1; - - GetViewportOrgEx( pWindowData->hdc, &lpp ); - - hrgn1 = CreateRectRgn( c+lpp.x, r+lpp.y, xe+lpp.x, ye+lpp.y ); - SelectClipRgn( pWindowData->hdc, hrgn1 ); - - while ( x < xe ) - { - while ( y < ye ) + if( dr == 0 ) { - iPicture->lpVtbl-> Render( iPicture, pWindowData->hdc, x, y, dc, dr, 0, - lHeight, lWidth, -lHeight, NULL ); - y += dr; + dr = ( int ) ( ( float ) dc * lHeight / lWidth ); } - y = r; - x += dc; - } + if( tor == 0 ) + { + tor = dr; + } + if( toc == 0 ) + { + toc = dc; + } + x = c; + y = r; + xe = c + toc - 1; + ye = r + tor - 1; - SelectClipRgn( pWindowData->hdc, NULL ); - DeleteObject( hrgn1 ); + GetViewportOrgEx( pWindowData->hdc, &lpp ); - bResult = TRUE ; - } + hrgn1 = CreateRectRgn( c + lpp.x, r + lpp.y, xe + lpp.x, ye + lpp.y ); + SelectClipRgn( pWindowData->hdc, hrgn1 ); - return( bResult ); + while( x < xe ) + { + while( y < ye ) + { + iPicture->lpVtbl->Render( iPicture, pWindowData->hdc, x, y, dc, dr, 0, + lHeight, lWidth, -lHeight, NULL ); + y += dr; + } + y = r; + x += dc; + } + + SelectClipRgn( pWindowData->hdc, NULL ); + DeleteObject( hrgn1 ); + + bResult = TRUE; + } + + return bResult; } @@ -7558,10 +7508,10 @@ BOOL hb_gt_wvwSetColorData( int iIndex, COLORREF ulCr ) { BOOL bResult = FALSE; - if ( iIndex >= 0 && iIndex < 16 ) + if( iIndex >= 0 && iIndex < 16 ) { _COLORS[ iIndex ] = ulCr; - bResult = TRUE; + bResult = TRUE; } return bResult; } @@ -7574,19 +7524,19 @@ BOOL hb_gt_wvwSetColorData( int iIndex, COLORREF ulCr ) if it is true, only one pixel lines used (outer lines are not drawn) TODO: combine it with aOffset like DrawImage ? -*/ + */ void hb_gt_wvwDrawBoxRaised( UINT usWinNum, int iTop, int iLeft, int iBottom, int iRight, BOOL bTight ) /* <-- none in gtwvt */ { WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; - if (!bTight) + if( ! bTight ) { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhiteDim ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhiteDim ); } else { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhite ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhite ); } MoveToEx( pWindowData->hdc, iLeft, iTop, NULL ); /* Top Inner */ @@ -7595,24 +7545,24 @@ void hb_gt_wvwDrawBoxRaised( UINT usWinNum, int iTop, int iLeft, int iBottom, in MoveToEx( pWindowData->hdc, iLeft, iTop, NULL ); /* Left Inner */ LineTo( pWindowData->hdc, iLeft, iBottom ); - if (!bTight) + if( ! bTight ) { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhite ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhite ); - MoveToEx( pWindowData->hdc, iLeft-1, iTop-1, NULL ); /* Top Outer */ - LineTo( pWindowData->hdc, iRight+1, iTop-1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); /* Top Outer */ + LineTo( pWindowData->hdc, iRight + 1, iTop - 1 ); - MoveToEx( pWindowData->hdc, iLeft-1, iTop-1, NULL ); /* Left Outer */ - LineTo( pWindowData->hdc, iLeft-1, iBottom+1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); /* Left Outer */ + LineTo( pWindowData->hdc, iLeft - 1, iBottom + 1 ); } - if (!bTight) + if( ! bTight ) { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penDarkGray ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penDarkGray ); } else { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penBlack ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penBlack ); } MoveToEx( pWindowData->hdc, iLeft, iBottom, NULL ); /* Bottom Inner */ @@ -7621,15 +7571,15 @@ void hb_gt_wvwDrawBoxRaised( UINT usWinNum, int iTop, int iLeft, int iBottom, in MoveToEx( pWindowData->hdc, iRight, iBottom, NULL ); /* Right Inner */ LineTo( pWindowData->hdc, iRight, iTop ); - if (!bTight) + if( ! bTight ) { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penBlack ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penBlack ); - MoveToEx( pWindowData->hdc, iLeft-1, iBottom+1, NULL ); /* Bottom Outer */ - LineTo( pWindowData->hdc, iRight+1+1, iBottom+1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iBottom + 1, NULL ); /* Bottom Outer */ + LineTo( pWindowData->hdc, iRight + 1 + 1, iBottom + 1 ); - MoveToEx( pWindowData->hdc, iRight+1, iTop-1, NULL ); /* Right Outer */ - LineTo( pWindowData->hdc, iRight+1, iBottom+1 ); + MoveToEx( pWindowData->hdc, iRight + 1, iTop - 1, NULL ); /* Right Outer */ + LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 ); } } @@ -7642,19 +7592,19 @@ void hb_gt_wvwDrawBoxRaised( UINT usWinNum, int iTop, int iLeft, int iBottom, in if it is true, only one pixel lines used (outer lines are not drawn) TODO: combine it with aOffset like DrawImage ? -*/ + */ void hb_gt_wvwDrawBoxRecessed( UINT usWinNum, int iTop, int iLeft, int iBottom, int iRight, BOOL bTight ) { WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; - if (!bTight) + if( ! bTight ) { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhiteDim ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhiteDim ); } else { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhite ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhite ); } MoveToEx( pWindowData->hdc, iRight, iTop, NULL ); /* Right Inner */ @@ -7663,15 +7613,15 @@ void hb_gt_wvwDrawBoxRecessed( UINT usWinNum, int iTop, int iLeft, int iBottom, MoveToEx( pWindowData->hdc, iLeft, iBottom, NULL ); /* Bottom Inner */ LineTo( pWindowData->hdc, iRight, iBottom ); - if (!bTight) + if( ! bTight ) { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhite ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penWhite ); - MoveToEx( pWindowData->hdc, iRight+1, iTop-1, NULL ); /* Right Outer */ - LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 ); + MoveToEx( pWindowData->hdc, iRight + 1, iTop - 1, NULL ); /* Right Outer */ + LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 ); - MoveToEx( pWindowData->hdc, iLeft - 1, iBottom + 1, NULL ); /* Bottom Outer */ - LineTo( pWindowData->hdc, iRight + 2, iBottom + 1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iBottom + 1, NULL ); /* Bottom Outer */ + LineTo( pWindowData->hdc, iRight + 2, iBottom + 1 ); } @@ -7683,15 +7633,15 @@ void hb_gt_wvwDrawBoxRecessed( UINT usWinNum, int iTop, int iLeft, int iBottom, MoveToEx( pWindowData->hdc, iLeft, iTop, NULL ); /* Top Inner */ LineTo( pWindowData->hdc, iRight, iTop ); - if (!bTight) + if( ! bTight ) { - SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penDarkGray ); + SelectObject( pWindowData->hdc, s_pWvwData->s_sApp->penDarkGray ); - MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); /* Left Outer */ - LineTo( pWindowData->hdc, iLeft - 1 , iBottom + 1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); /* Left Outer */ + LineTo( pWindowData->hdc, iLeft - 1, iBottom + 1 ); - MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); /* Top Outer */ - LineTo( pWindowData->hdc, iRight + 1, iTop - 1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); /* Top Outer */ + LineTo( pWindowData->hdc, iRight + 1, iTop - 1 ); } } @@ -7712,7 +7662,7 @@ void hb_gt_wvwDrawOutline( UINT usWinNum, int iTop, int iLeft, int iBottom, int LineTo( pWindowData->hdc, iRight, iBottom ); MoveToEx( pWindowData->hdc, iRight, iTop, NULL ); /* Right */ - LineTo( pWindowData->hdc, iRight, iBottom + 1); + LineTo( pWindowData->hdc, iRight, iBottom + 1 ); } //BOOL hb_gt_wvw_KeyEvent( message, wParam, lParam ) ; @@ -7721,61 +7671,61 @@ void hb_gt_wvwDrawOutline( UINT usWinNum, int iTop, int iLeft, int iBottom, int //static void gtFnInit( PHB_GT_FUNCS gt_funcs ) static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gtFnInit( %p )", pFuncTable ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gtFnInit( %p )", pFuncTable ) ); - pFuncTable->Init = hb_gt_wvw_Init; - pFuncTable->Exit = hb_gt_wvw_Exit; - pFuncTable->MaxCol = hb_gt_wvw_MaxCol; - pFuncTable->MaxRow = hb_gt_wvw_MaxRow; + pFuncTable->Init = hb_gt_wvw_Init; + pFuncTable->Exit = hb_gt_wvw_Exit; + pFuncTable->MaxCol = hb_gt_wvw_MaxCol; + pFuncTable->MaxRow = hb_gt_wvw_MaxRow; - pFuncTable->SetPos = hb_gt_wvw_SetPos; - pFuncTable->IsColor = hb_gt_wvw_IsColor; - pFuncTable->GetCursorStyle = hb_gt_wvw_GetCursorStyle; - pFuncTable->SetCursorStyle = hb_gt_wvw_SetCursorStyle; - pFuncTable->DispBegin = hb_gt_wvw_DispBegin; - pFuncTable->DispEnd = hb_gt_wvw_DispEnd; - pFuncTable->DispCount = hb_gt_wvw_DispCount; - pFuncTable->Replicate = hb_gt_wvw_Replicate; - pFuncTable->WriteAt = hb_gt_wvw_WriteAt; - pFuncTable->PutText = hb_gt_wvw_PutText; - pFuncTable->SetAttribute = hb_gt_wvw_SetAttribute; + pFuncTable->SetPos = hb_gt_wvw_SetPos; + pFuncTable->IsColor = hb_gt_wvw_IsColor; + pFuncTable->GetCursorStyle = hb_gt_wvw_GetCursorStyle; + pFuncTable->SetCursorStyle = hb_gt_wvw_SetCursorStyle; + pFuncTable->DispBegin = hb_gt_wvw_DispBegin; + pFuncTable->DispEnd = hb_gt_wvw_DispEnd; + pFuncTable->DispCount = hb_gt_wvw_DispCount; + pFuncTable->Replicate = hb_gt_wvw_Replicate; + pFuncTable->WriteAt = hb_gt_wvw_WriteAt; + pFuncTable->PutText = hb_gt_wvw_PutText; + pFuncTable->SetAttribute = hb_gt_wvw_SetAttribute; // pFuncTable->Scroll = hb_gt_wvw_Scroll; - pFuncTable->SetMode = hb_gt_wvw_SetMode; - pFuncTable->GetBlink = hb_gt_wvw_GetBlink; - pFuncTable->SetBlink = hb_gt_wvw_SetBlink; - pFuncTable->Version = hb_gt_wvw_Version; - pFuncTable->Box = hb_gt_wvw_Box; - pFuncTable->HorizLine = hb_gt_wvw_HorizLine; - pFuncTable->VertLine = hb_gt_wvw_VertLine; - pFuncTable->OutStd = hb_gt_wvw_OutStd; - pFuncTable->OutErr = hb_gt_wvw_OutErr; - pFuncTable->Tone = hb_gt_wvw_Tone; - pFuncTable->ReadKey = hb_gt_wvw_ReadKey; - pFuncTable->Info = hb_gt_wvw_Info; + pFuncTable->SetMode = hb_gt_wvw_SetMode; + pFuncTable->GetBlink = hb_gt_wvw_GetBlink; + pFuncTable->SetBlink = hb_gt_wvw_SetBlink; + pFuncTable->Version = hb_gt_wvw_Version; + pFuncTable->Box = hb_gt_wvw_Box; + pFuncTable->HorizLine = hb_gt_wvw_HorizLine; + pFuncTable->VertLine = hb_gt_wvw_VertLine; + pFuncTable->OutStd = hb_gt_wvw_OutStd; + pFuncTable->OutErr = hb_gt_wvw_OutErr; + pFuncTable->Tone = hb_gt_wvw_Tone; + pFuncTable->ReadKey = hb_gt_wvw_ReadKey; + pFuncTable->Info = hb_gt_wvw_Info; - pFuncTable->GetChar = hb_gt_wvw_GetChar; - pFuncTable->PutChar = hb_gt_wvw_PutChar; - pFuncTable->CheckPos = hb_gt_wvw_CheckPos; - pFuncTable->GetSize = hb_gt_wvw_GetSize; - pFuncTable->Save = hb_gt_wvw_Save; - pFuncTable->Rest = hb_gt_wvw_Rest; - pFuncTable->ExposeArea = hb_gt_wvw_ExposeArea; + pFuncTable->GetChar = hb_gt_wvw_GetChar; + pFuncTable->PutChar = hb_gt_wvw_PutChar; + pFuncTable->CheckPos = hb_gt_wvw_CheckPos; + pFuncTable->GetSize = hb_gt_wvw_GetSize; + pFuncTable->Save = hb_gt_wvw_Save; + pFuncTable->Rest = hb_gt_wvw_Rest; + pFuncTable->ExposeArea = hb_gt_wvw_ExposeArea; - /* Graphics API */ - pFuncTable->GfxPrimitive = hb_gt_wvw_gfxPrimitive; + /* Graphics API */ + pFuncTable->GfxPrimitive = hb_gt_wvw_gfxPrimitive; - pFuncTable->MouseInit = hb_gt_wvw_mouse_Init; - pFuncTable->MouseExit = hb_gt_wvw_mouse_Exit; - pFuncTable->MouseIsPresent = hb_gt_wvw_mouse_IsPresent; - pFuncTable->MouseCol = hb_gt_wvw_mouse_Col; - pFuncTable->MouseRow = hb_gt_wvw_mouse_Row; - pFuncTable->MouseSetPos = hb_gt_wvw_mouse_SetPos; - pFuncTable->MouseGetPos = hb_gt_wvw_mouse_GetPos; - pFuncTable->MouseCountButton = hb_gt_wvw_mouse_CountButton; - pFuncTable->MouseButtonState = hb_gt_wvw_mouse_ButtonState; + pFuncTable->MouseInit = hb_gt_wvw_mouse_Init; + pFuncTable->MouseExit = hb_gt_wvw_mouse_Exit; + pFuncTable->MouseIsPresent = hb_gt_wvw_mouse_IsPresent; + pFuncTable->MouseCol = hb_gt_wvw_mouse_Col; + pFuncTable->MouseRow = hb_gt_wvw_mouse_Row; + pFuncTable->MouseSetPos = hb_gt_wvw_mouse_SetPos; + pFuncTable->MouseGetPos = hb_gt_wvw_mouse_GetPos; + pFuncTable->MouseCountButton = hb_gt_wvw_mouse_CountButton; + pFuncTable->MouseButtonState = hb_gt_wvw_mouse_ButtonState; - return TRUE; + return TRUE; } #include "hbgtreg.h" @@ -7792,7 +7742,7 @@ BOOL hb_gt_wvw_GetMainCoordMode( void ) UINT hb_gt_wvw_GetNumWindows( void ) { - return s_pWvwData->s_usNumWindows ; + return s_pWvwData->s_usNumWindows; } UINT hb_gt_wvw_GetCurWindow( void ) @@ -7810,7 +7760,7 @@ char * hb_gt_wvw_GetAppName( void ) return s_pWvwData->szAppName; } -APP_DATA *hb_gt_wvwGetAppData( void ) +APP_DATA * hb_gt_wvwGetAppData( void ) { return s_pWvwData->s_sApp; } @@ -7831,196 +7781,196 @@ WVW_DATA * hb_getWvwData( void ) /*20040713 this function was named WVW_lOpenWindow() - *now it is wvw_nOpenWindow() - *it now returns numeric + *now it is wvw_nOpenWindow() + *it now returns numeric - *WVW_nOpenWindow(cWinName, row1, col1, row2, col2, ; + *WVW_nOpenWindow(cWinName, row1, col1, row2, col2, ; * nStyle, nParentWin) - *rowx and colx are relative to MAIN WINDOW (not current window!) - *rowx and colx are used for: - *(1) positioning window to its initial position, - *(2) determining the size of the window (new maxrow() and maxcol()) - *(3) saved into RowOfs and ColOfs for MainCoord mode + **rowx and colx are relative to MAIN WINDOW (not current window!) + **rowx and colx are used for: + **(1) positioning window to its initial position, + **(2) determining the size of the window (new maxrow() and maxcol()) + **(3) saved into RowOfs and ColOfs for MainCoord mode * - *nStyle is window style (eg. WS_OVERLAPPEDWINDOW, etc.) + **nStyle is window style (eg. WS_OVERLAPPEDWINDOW, etc.) * default is: WS_CAPTION|WS_SYSMENU |WS_CLIPCHILDREN * WARNING: you must know what you're doing if you supplied this param * NOTES: if you will use controls such as PUSHBUTTON, * you MUST include WS_CLIPCHILDREN. * - *nParentWin is parent window of the new on we're about to open. + **nParentWin is parent window of the new on we're about to open. * default is: current window (in Standard Mode) * last window (in MainCoord Mode) * If you want the new window to not have parent, * pass -1 as nParentWin. * * - *returns window number if successful - *returns 0 if failed + **returns window number if successful + **returns 0 if failed */ HB_FUNC( WVW_NOPENWINDOW ) { - LPCTSTR lpszWinName; + LPCTSTR lpszWinName; - int iLen; - WIN_DATA * pParentWindow; + int iLen; + WIN_DATA * pParentWindow; - WIN_DATA * pWindowData; - int irow1, icol1, irow2, icol2; - RECT wi = { 0 }, rcWorkArea = { 0 }; - UINT usWinNum; + WIN_DATA * pWindowData; + int irow1, icol1, irow2, icol2; + RECT wi = { 0 }, rcWorkArea = { 0 }; + UINT usWinNum; - DWORD dwStyle = ( HB_ISNIL( 6 ) ? ((DWORD)(WS_POPUP|WS_CAPTION|WS_SYSMENU |WS_CLIPCHILDREN)) : ((DWORD) hb_parnl( 6 )) ); - INT iParentWin = ( HB_ISNIL( 7 ) ? ( s_pWvwData->s_bMainCoordMode ? s_pWvwData->s_usNumWindows-1 : s_pWvwData->s_usCurWindow ) : ((INT) hb_parni( 7 )) ); - PHB_FNAME pFileName = NULL; + DWORD dwStyle = ( HB_ISNIL( 6 ) ? ( ( DWORD ) ( WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN ) ) : ( ( DWORD ) hb_parnl( 6 ) ) ); + INT iParentWin = ( HB_ISNIL( 7 ) ? ( s_pWvwData->s_bMainCoordMode ? s_pWvwData->s_usNumWindows - 1 : s_pWvwData->s_usCurWindow ) : ( ( INT ) hb_parni( 7 ) ) ); + PHB_FNAME pFileName = NULL; - if (s_pWvwData->s_usNumWindows == 0) - { + if( s_pWvwData->s_usNumWindows == 0 ) + { - hb_retni( 0 ); - return; - } - - if (s_pWvwData->s_usNumWindows == WVW_MAXWINDOWS) - { - MessageBox( NULL, TEXT("Too many Windows to open"), - "Error", MB_ICONERROR ); - hb_retni( 0 ); - return; - } - - if (iParentWin > (INT)s_pWvwData->s_usNumWindows-1) - { - MessageBox( NULL, TEXT("Invalid Parent Window"), - "Error", MB_ICONERROR ); - hb_retni( 0 ); - return; - } - - if (iParentWin < 0) - { - if (!s_pWvwData->s_bMainCoordMode) - { - pParentWindow = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; - } - else - { - pParentWindow = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; - } - } - else - { - - pParentWindow = s_pWvwData->s_pWindows[ (USHORT) iParentWin ]; - } - - if ( HB_ISCHAR(1) ) - { - iLen = hb_parclen(1); - if ( iLen > WVW_MAXWINNAMELENGTH-1) - { - MessageBox( NULL, TEXT( "Windows name too long" ), - TEXT("Error"), MB_ICONERROR ); hb_retni( 0 ); return; - } - lpszWinName = hb_parcx(1); - } - else if (HB_ISNIL(1)) - { + } - pFileName = hb_fsFNameSplit( hb_cmdargARGV()[0] ); - lpszWinName = pFileName->szName; + if( s_pWvwData->s_usNumWindows == WVW_MAXWINDOWS ) + { + MessageBox( NULL, TEXT( "Too many Windows to open" ), + "Error", MB_ICONERROR ); + hb_retni( 0 ); + return; + } - } - else - { + if( iParentWin > ( INT ) s_pWvwData->s_usNumWindows - 1 ) + { + MessageBox( NULL, TEXT( "Invalid Parent Window" ), + "Error", MB_ICONERROR ); + hb_retni( 0 ); + return; + } - hb_errRT_TERM( EG_DATATYPE, 10001, "Window Title must be character", "WVW_nOpenWindow()", 0, 0 ); - hb_retni( 0 ); - return; - } + if( iParentWin < 0 ) + { + if( ! s_pWvwData->s_bMainCoordMode ) + { + pParentWindow = s_pWvwData->s_pWindows[ s_pWvwData->s_usCurWindow ]; + } + else + { + pParentWindow = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; + } + } + else + { - irow1 = HB_ISNIL(2) ? 0 : hb_parni(2); - icol1 = HB_ISNIL(3) ? 0 : hb_parni(3); - irow2 = HB_ISNIL(4) ? pParentWindow->ROWS-1 : hb_parni(4); - icol2 = HB_ISNIL(5) ? pParentWindow->COLS-1 : hb_parni(5); + pParentWindow = s_pWvwData->s_pWindows[ ( USHORT ) iParentWin ]; + } - usWinNum = hb_gt_wvwOpenWindow( lpszWinName, irow1, icol1, irow2, icol2, - dwStyle, iParentWin); + if( HB_ISCHAR( 1 ) ) + { + iLen = hb_parclen( 1 ); + if( iLen > WVW_MAXWINNAMELENGTH - 1 ) + { + MessageBox( NULL, TEXT( "Windows name too long" ), + TEXT( "Error" ), MB_ICONERROR ); + hb_retni( 0 ); + return; + } + lpszWinName = hb_parcx( 1 ); + } + else if( HB_ISNIL( 1 ) ) + { - if ( usWinNum == 0 ) - { - hb_retni( 0 ); + pFileName = hb_fsFNameSplit( hb_cmdargARGV()[ 0 ] ); + lpszWinName = pFileName->szName; - if (pFileName) - { + } + else + { + + hb_errRT_TERM( EG_DATATYPE, 10001, "Window Title must be character", "WVW_nOpenWindow()", 0, 0 ); + hb_retni( 0 ); + return; + } + + irow1 = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + icol1 = HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ); + irow2 = HB_ISNIL( 4 ) ? pParentWindow->ROWS - 1 : hb_parni( 4 ); + icol2 = HB_ISNIL( 5 ) ? pParentWindow->COLS - 1 : hb_parni( 5 ); + + usWinNum = hb_gt_wvwOpenWindow( lpszWinName, irow1, icol1, irow2, icol2, + dwStyle, iParentWin ); + + if( usWinNum == 0 ) + { + hb_retni( 0 ); + + if( pFileName ) + { + hb_xfree( pFileName ); + } + + return; + } + + pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + + GetWindowRect( pWindowData->hWnd, &wi ); + SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 ); + if( wi.right < rcWorkArea.left || wi.left > rcWorkArea.right || + wi.top > rcWorkArea.bottom || wi.bottom < rcWorkArea.top ) + { + + hb_gt_wvwSetCentreWindow( 0, TRUE, TRUE ); + + hb_gt_wvwSetCentreWindow( usWinNum, s_pWvwData->s_bDefCentreWindow, TRUE ); + + } + + if( s_pWvwData->s_bMainCoordMode ) + { + + s_pWvwData->s_usCurWindow = usWinNum; + } + + hb_gtSetMode( pWindowData->ROWS, pWindowData->COLS ); + + + if( s_pWvwData->s_bMainCoordMode ) + { + + hb_gt_wvwSetCurWindow( 0 ); + } + + SendMessage( pWindowData->hWnd, WM_SETFOCUS, 0, 0 ); + + if( pFileName ) + { hb_xfree( pFileName ); - } + } - return; - } - - pWindowData = s_pWvwData->s_pWindows[usWinNum]; - - GetWindowRect( pWindowData->hWnd, &wi ); - SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 ); - if (wi.right < rcWorkArea.left || wi.left > rcWorkArea.right || - wi.top > rcWorkArea.bottom || wi.bottom < rcWorkArea.top) - { - - hb_gt_wvwSetCentreWindow( 0, TRUE, TRUE ); - - hb_gt_wvwSetCentreWindow( usWinNum, s_pWvwData->s_bDefCentreWindow, TRUE ); - - } - - if (s_pWvwData->s_bMainCoordMode) - { - - s_pWvwData->s_usCurWindow = usWinNum; - } - - hb_gtSetMode( pWindowData->ROWS, pWindowData->COLS ); - - - if (s_pWvwData->s_bMainCoordMode) - { - - hb_gt_wvwSetCurWindow( 0 ); - } - - SendMessage( pWindowData->hWnd, WM_SETFOCUS, 0, 0 ); - - if (pFileName) - { - hb_xfree( pFileName ); - } - - hb_retni( usWinNum ); + hb_retni( usWinNum ); } HB_FUNC( WVW_GET_HND_WINDOW ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; - HB_RETHANDLE( pWindowData->hWnd ); + HB_RETHANDLE( pWindowData->hWnd ); } HB_FUNC( WVW_MOVE_READY ) { BOOL bIsReady; - bIsReady = hb_wvw_Move_Ready(0); + bIsReady = hb_wvw_Move_Ready( 0 ); - if (HB_ISLOG(1)) + if( HB_ISLOG( 1 ) ) { - bIsReady = hb_wvw_Move_Ready(hb_parl(1)); + bIsReady = hb_wvw_Move_Ready( hb_parl( 1 ) ); } - hb_retl(bIsReady); + hb_retl( bIsReady ); } HB_FUNC( WVW_SIZE_READY ) @@ -8029,66 +7979,67 @@ HB_FUNC( WVW_SIZE_READY ) bIsReady = hb_wvw_Size_Ready( 0 ); - if (HB_ISLOG(1)) + if( HB_ISLOG( 1 ) ) { - bIsReady = hb_wvw_Size_Ready(hb_parl(1)); + bIsReady = hb_wvw_Size_Ready( hb_parl( 1 ) ); } - hb_retl(bIsReady); + hb_retl( bIsReady ); } /*WVW_lCloseWindow() - *closes the last/topmost window - *returns .t. if successful + *closes the last/topmost window + *returns .t. if successful */ HB_FUNC( WVW_LCLOSEWINDOW ) { - WIN_DATA * pWindowData; - if (s_pWvwData->s_usNumWindows <= 1) - { + WIN_DATA * pWindowData; - MessageBox( NULL, TEXT("No more window to close"), - "Error", MB_ICONERROR ); - hb_retl( FALSE ); - return; - } + if( s_pWvwData->s_usNumWindows <= 1 ) + { - hb_gt_wvwCloseWindow( ); + MessageBox( NULL, TEXT( "No more window to close" ), + "Error", MB_ICONERROR ); + hb_retl( FALSE ); + return; + } - if (!s_pWvwData->s_bMainCoordMode) - { + hb_gt_wvwCloseWindow(); - s_pWvwData->s_bQuickSetMode = TRUE; + if( ! s_pWvwData->s_bMainCoordMode ) + { - hb_gtSetMode( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->ROWS, s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]->COLS ); + s_pWvwData->s_bQuickSetMode = TRUE; - s_pWvwData->s_bQuickSetMode = FALSE; - } - else - { + hb_gtSetMode( s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->ROWS, s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]->COLS ); - hb_gt_wvwSetCurWindow( 0 ); - } + s_pWvwData->s_bQuickSetMode = FALSE; + } + else + { - pWindowData = s_pWvwData->s_pWindows[s_pWvwData->s_usNumWindows-1]; + hb_gt_wvwSetCurWindow( 0 ); + } - SendMessage( pWindowData->hWnd, WM_SETFOCUS, 0, 0 ); + pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; - hb_retl( TRUE ); + SendMessage( pWindowData->hWnd, WM_SETFOCUS, 0, 0 ); + + hb_retl( TRUE ); } /*WVW_nNumWindows() - *returns number of windows opened (including main window) + *returns number of windows opened (including main window) */ HB_FUNC( WVW_NNUMWINDOWS ) { - hb_retni( (int) s_pWvwData->s_usNumWindows ); + hb_retni( ( int ) s_pWvwData->s_usNumWindows ); } /*WVW_xReposWindow(lAnchored) - *reposition all windows to their initial position + *reposition all windows to their initial position * * if lAnchored == .t. (default) * all subwindows are positioned according to their respective (row1,col1) coordinate @@ -8098,116 +8049,117 @@ HB_FUNC( WVW_NNUMWINDOWS ) */ HB_FUNC( WVW_XREPOSWINDOW ) { - UINT i; - BOOL bAnchored = (HB_ISLOG(1) ? hb_parl(1) : TRUE); + UINT i; + BOOL bAnchored = ( HB_ISLOG( 1 ) ? hb_parl( 1 ) : TRUE ); - /* centerize Main Window, only if not maximized */ + /* centerize Main Window, only if not maximized */ - { - hb_gt_wvwSetCentreWindow( 0, TRUE, TRUE ); - } + { + hb_gt_wvwSetCentreWindow( 0, TRUE, TRUE ); + } - /* reposition all subwindows */ - for (i=1; is_usNumWindows; i++) - { + /* reposition all subwindows */ + for( i = 1; i < s_pWvwData->s_usNumWindows; i++ ) + { - if (bAnchored) - { - hb_gt_wvwSetCentreWindow( i, FALSE, TRUE ); - } - else - { - hb_gt_wvwSetCentreWindow( i, s_pWvwData->s_pWindows[ i ]->CentreWindow, TRUE ); - } - } + if( bAnchored ) + { + hb_gt_wvwSetCentreWindow( i, FALSE, TRUE ); + } + else + { + hb_gt_wvwSetCentreWindow( i, s_pWvwData->s_pWindows[ i ]->CentreWindow, TRUE ); + } + } } /*WVW_nSetCurWindow( nWinNum ) (0==MAIN) - *assigns nWinNum as the new current window (s_pWvwData->s_usCurWindow) - *returns old current window - *example: saved := WVW_nSetCurWindow(0) + *assigns nWinNum as the new current window (s_pWvwData->s_usCurWindow) + *returns old current window + *example: saved := WVW_nSetCurWindow(0) * ? "This will be displayed in Main Window" * WVW_nSetCurWindow(saved) - *notes: makes sense only if !s_pWvwData->s_bMainCoordMode + **notes: makes sense only if !s_pWvwData->s_bMainCoordMode */ HB_FUNC( WVW_NSETCURWINDOW ) { - INT sWinNum; - if ( HB_ISNIL(1) ) - { - hb_retni( (int) (s_pWvwData->s_usCurWindow) ); - } - else - { - sWinNum = hb_parni(1); - if (sWinNum >= 0 && sWinNum < (INT)s_pWvwData->s_usNumWindows) - { - hb_retni( (int) ( hb_gt_wvwSetCurWindow( sWinNum ) ) ); - } - else - { - hb_errRT_TERM( EG_BOUND, 10001, "Window Number out of range", "WVW_nSetCurWindow()", 0, 0 ); + INT sWinNum; - } - } + if( HB_ISNIL( 1 ) ) + { + hb_retni( ( int ) ( s_pWvwData->s_usCurWindow ) ); + } + else + { + sWinNum = hb_parni( 1 ); + if( sWinNum >= 0 && sWinNum < ( INT ) s_pWvwData->s_usNumWindows ) + { + hb_retni( ( int ) ( hb_gt_wvwSetCurWindow( sWinNum ) ) ); + } + else + { + hb_errRT_TERM( EG_BOUND, 10001, "Window Number out of range", "WVW_nSetCurWindow()", 0, 0 ); + + } + } } /*WVW_nRowOfs( [nWinNum] ) - *returns row offset of window #nWinNum (0==MAIN), relative to Main Window - *nWinNum defaults to current window + *returns row offset of window #nWinNum (0==MAIN), relative to Main Window + *nWinNum defaults to current window */ HB_FUNC( WVW_NROWOFS ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - hb_retni( (int) hb_gt_wvwRowOfs( usWinNum ) ); + hb_retni( ( int ) hb_gt_wvwRowOfs( usWinNum ) ); } /*WVW_nColOfs( [nWinNum] ) - *returns col offset of window #nWinNum (0==MAIN), relative to Main Window - *nWinNum defaults to topmost window + *returns col offset of window #nWinNum (0==MAIN), relative to Main Window + *nWinNum defaults to topmost window */ HB_FUNC( WVW_NCOLOFS ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - hb_retni( (int) hb_gt_wvwColOfs( usWinNum ) ); + hb_retni( ( int ) hb_gt_wvwColOfs( usWinNum ) ); } /* - *WVW_MAXMAXROW( [nWinNum] ) - *returns maximum possible MAXROW() in current screen setting for font used by window nWinNum + *WVW_MAXMAXROW( [nWinNum] ) + *returns maximum possible MAXROW() in current screen setting for font used by window nWinNum * */ HB_FUNC( WVW_MAXMAXROW ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int maxrows; + UINT usWinNum = WVW_WHICH_WINDOW; + int maxrows; /* rows and cols passed are dummy ones */ - hb_gt_wvwValidWindowSize( s_pWvwData->s_pWindows[usWinNum], 10, 10, s_pWvwData->s_pWindows[usWinNum]->hFont, s_pWvwData->s_pWindows[usWinNum]->fontWidth, - &maxrows, NULL ) ; - hb_retni( maxrows-1 ); + hb_gt_wvwValidWindowSize( s_pWvwData->s_pWindows[ usWinNum ], 10, 10, s_pWvwData->s_pWindows[ usWinNum ]->hFont, s_pWvwData->s_pWindows[ usWinNum ]->fontWidth, + &maxrows, NULL ); + hb_retni( maxrows - 1 ); } /* - *WVW_MAXMAXCOL( [nWinNum] ) - *returns maximum possible MAXCOL() in current screen setting for font used by window nWinNum + *WVW_MAXMAXCOL( [nWinNum] ) + *returns maximum possible MAXCOL() in current screen setting for font used by window nWinNum * */ HB_FUNC( WVW_MAXMAXCOL ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int maxcols; + UINT usWinNum = WVW_WHICH_WINDOW; + int maxcols; /* rows and cols passed are dummy ones */ - hb_gt_wvwValidWindowSize( s_pWvwData->s_pWindows[usWinNum], 10, 10, s_pWvwData->s_pWindows[usWinNum]->hFont, s_pWvwData->s_pWindows[usWinNum]->fontWidth, - NULL, &maxcols ) ; - hb_retni( maxcols-1 ); + hb_gt_wvwValidWindowSize( s_pWvwData->s_pWindows[ usWinNum ], 10, 10, s_pWvwData->s_pWindows[ usWinNum ]->hFont, s_pWvwData->s_pWindows[ usWinNum ]->fontWidth, + NULL, &maxcols ); + hb_retni( maxcols - 1 ); } /* - *WVW_UNREACHEDBR( [nWinNum], [nBottomPixels], [nRightPixels] ) + *WVW_UNREACHEDBR( [nWinNum], [nBottomPixels], [nRightPixels] ) * get unreached pixels * below maxrow() to nBottomPixels * and on the right of maxcols() to nRightPixels @@ -8215,36 +8167,38 @@ HB_FUNC( WVW_MAXMAXCOL ) */ HB_FUNC( WVW_UNREACHEDBR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int cols, rows; + UINT usWinNum = WVW_WHICH_WINDOW; + int cols, rows; - hb_gt_wvwUnreachedXY( s_pWvwData->s_pWindows[usWinNum], &cols, &rows ); - if (HB_ISBYREF(2)) hb_storni( rows, 2 ); - if (HB_ISBYREF(3)) hb_storni( cols, 3 ); + hb_gt_wvwUnreachedXY( s_pWvwData->s_pWindows[ usWinNum ], &cols, &rows ); + if( HB_ISBYREF( 2 ) ) + hb_storni( rows, 2 ); + if( HB_ISBYREF( 3 ) ) + hb_storni( cols, 3 ); } /*WVW_SetMainCoord( [lMainCoord] ) - *returns old setting of s_pWvwData->s_bMainCoordMode, - *then assigns s_pWvwData->s_bMainCoordMode := lMainCoord (if supplied) + *returns old setting of s_pWvwData->s_bMainCoordMode, + *then assigns s_pWvwData->s_bMainCoordMode := lMainCoord (if supplied) */ HB_FUNC( WVW_SETMAINCOORD ) { BOOL bOldMainCoordMode = s_pWvwData->s_bMainCoordMode; - if ( ! HB_ISNIL( 1 ) ) + if( ! HB_ISNIL( 1 ) ) { - s_pWvwData->s_bMainCoordMode = hb_parl( 1 ); + s_pWvwData->s_bMainCoordMode = hb_parl( 1 ); - if ( !s_pWvwData->s_bMainCoordMode ) - { + if( ! s_pWvwData->s_bMainCoordMode ) + { - hb_gt_wvwSetCurWindow( s_pWvwData->s_usNumWindows-1 ); - } - else - { + hb_gt_wvwSetCurWindow( s_pWvwData->s_usNumWindows - 1 ); + } + else + { - hb_gt_wvwSetCurWindow( 0 ); - } + hb_gt_wvwSetCurWindow( 0 ); + } } hb_retl( bOldMainCoordMode ); @@ -8265,208 +8219,210 @@ HB_FUNC( WVW_SETMAINCOORD ) */ HB_FUNC( WVW_ADDROWS ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - int iRows = HB_ISNIL(2) ? 0 : hb_parni(2); - USHORT height, width; - USHORT diffheight, diffwidth; - USHORT usNumChars; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + int iRows = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + USHORT height, width; + USHORT diffheight, diffwidth; + USHORT usNumChars; - RECT wi = { 0 }, ci = { 0 }; + RECT wi = { 0 }, ci = { 0 }; - if (iRows == 0) - { - hb_retl( TRUE ); - return; - } + if( iRows == 0 ) + { + hb_retl( TRUE ); + return; + } - if (/* (iRows < 0) || */ - (s_pWvwData->s_bMainCoordMode && (pWindowData->usRowOfs+pWindowData->ROWS+iRows > s_pWvwData->s_pWindows[0]->ROWS)) || - (pWindowData->ROWS+iRows > WVW_MAX_ROWS) || - (pWindowData->ROWS+iRows < 1) - ) - { - hb_retl( FALSE ); - return; - } + if( /* (iRows < 0) || */ + ( s_pWvwData->s_bMainCoordMode && ( pWindowData->usRowOfs + pWindowData->ROWS + iRows > s_pWvwData->s_pWindows[ 0 ]->ROWS ) ) || + ( pWindowData->ROWS + iRows > WVW_MAX_ROWS ) || + ( pWindowData->ROWS + iRows < 1 ) + ) + { + hb_retl( FALSE ); + return; + } - usNumChars = (USHORT)iRows * pWindowData->COLS; + usNumChars = ( USHORT ) iRows * pWindowData->COLS; - if (iRows>0) - { - /* initialize chars and attributes */ - USHORT usBufLastRow = hb_gt_wvwGetIndexForTextBuffer( pWindowData, 0, pWindowData->ROWS-1 ); - USHORT usBufStart = hb_gt_wvwGetIndexForTextBuffer( pWindowData, 0, pWindowData->ROWS ); + if( iRows > 0 ) + { + /* initialize chars and attributes */ + USHORT usBufLastRow = hb_gt_wvwGetIndexForTextBuffer( pWindowData, 0, pWindowData->ROWS - 1 ); + USHORT usBufStart = hb_gt_wvwGetIndexForTextBuffer( pWindowData, 0, pWindowData->ROWS ); - memset( &(pWindowData->byBuffer[usBufStart]), ' ', usNumChars ); + memset( &( pWindowData->byBuffer[ usBufStart ] ), ' ', usNumChars ); - memset( &(pWindowData->byColors[usBufStart]), (char) pWindowData->byColors[usBufLastRow], usNumChars ); - } + memset( &( pWindowData->byColors[ usBufStart ] ), ( char ) pWindowData->byColors[ usBufLastRow ], usNumChars ); + } - /* update vars */ - pWindowData->ROWS += (USHORT)iRows; - pWindowData->BUFFERSIZE += usNumChars * sizeof(char); + /* update vars */ + pWindowData->ROWS += ( USHORT ) iRows; + pWindowData->BUFFERSIZE += usNumChars * sizeof( char ); - if (!s_pWvwData->s_bMainCoordMode) - { - UINT usCurWindow = s_pWvwData->s_usCurWindow; - s_pWvwData->s_usCurWindow = usWinNum; + if( ! s_pWvwData->s_bMainCoordMode ) + { + UINT usCurWindow = s_pWvwData->s_usCurWindow; + s_pWvwData->s_usCurWindow = usWinNum; - s_pWvwData->s_bQuickSetMode = TRUE; + s_pWvwData->s_bQuickSetMode = TRUE; - hb_gtSetMode( pWindowData->ROWS, pWindowData->COLS ); + hb_gtSetMode( pWindowData->ROWS, pWindowData->COLS ); - s_pWvwData->s_bQuickSetMode = FALSE; + s_pWvwData->s_bQuickSetMode = FALSE; - s_pWvwData->s_usCurWindow = usCurWindow; - } + s_pWvwData->s_usCurWindow = usCurWindow; + } - /* resize the window to get the specified number of rows and columns - */ - height = hb_gt_wvwCalcPixelHeight( pWindowData ); - width = hb_gt_wvwCalcPixelWidth( pWindowData ); + /* resize the window to get the specified number of rows and columns + */ + height = hb_gt_wvwCalcPixelHeight( pWindowData ); + width = hb_gt_wvwCalcPixelWidth( pWindowData ); - GetWindowRect( pWindowData->hWnd, &wi ); - GetClientRect( pWindowData->hWnd, &ci ); - diffheight = (USHORT) ((wi.bottom-wi.top) - (ci.bottom-ci.top)); - diffwidth = (USHORT) ((wi.right-wi.left) - (ci.right-ci.left)); + GetWindowRect( pWindowData->hWnd, &wi ); + GetClientRect( pWindowData->hWnd, &ci ); + diffheight = ( USHORT ) ( ( wi.bottom - wi.top ) - ( ci.bottom - ci.top ) ); + diffwidth = ( USHORT ) ( ( wi.right - wi.left ) - ( ci.right - ci.left ) ); - height += diffheight; - width += diffwidth; + height += diffheight; + width += diffwidth; - SetWindowPos( pWindowData->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER ); + SetWindowPos( pWindowData->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER ); - if (pWindowData->hStatusBar != NULL) - { - SetWindowPos( pWindowData->hStatusBar, NULL, wi.left, wi.bottom - pWindowData->usSBHeight, width, pWindowData->usSBHeight, SWP_NOZORDER ); + if( pWindowData->hStatusBar != NULL ) + { + SetWindowPos( pWindowData->hStatusBar, NULL, wi.left, wi.bottom - pWindowData->usSBHeight, width, pWindowData->usSBHeight, SWP_NOZORDER ); - } + } - /**** THESE are not required, because we simply enlarged/shrinked the window downward - NOTICE however that some control may not be fully visible + /**** THESE are not required, because we simply enlarged/shrinked the window downward + NOTICE however that some control may not be fully visible - if (pWindowData->hToolBar != NULL) - { + if (pWindowData->hToolBar != NULL) + { - SetWindowPos( pWindowData->hToolBar, NULL, wi.left, wi.top - pWindowData->usTBHeight, width, pWindowData->usTBHeight, SWP_NOZORDER ); + SetWindowPos( pWindowData->hToolBar, NULL, wi.left, wi.top - pWindowData->usTBHeight, width, pWindowData->usTBHeight, SWP_NOZORDER ); - } + } - if (pWindowData->pcdCtrlList != NULL) - { + if (pWindowData->pcdCtrlList != NULL) + { - ReposControls(pWindowData->byWinId, 0); - } + ReposControls(pWindowData->byWinId, 0); + } - if (pWindowData->byWinId == s_pWvwData->s_usNumWindows-1) - { - hb_gt_wvwSetCaretPos(pWindowData); - } + if (pWindowData->byWinId == s_pWvwData->s_usNumWindows-1) + { + hb_gt_wvwSetCaretPos(pWindowData); + } - ******/ + ******/ - if (iRows>0) - { - /* invalidate rect of the newly added rows */ - pWindowData->InvalidateWindow = TRUE; - hb_gt_wvwSetInvalidRect( pWindowData, - (USHORT) 0, (USHORT) pWindowData->ROWS-(USHORT)iRows, - (USHORT) pWindowData->COLS-1, (USHORT) pWindowData->ROWS-1 ); - } + if( iRows > 0 ) + { + /* invalidate rect of the newly added rows */ + pWindowData->InvalidateWindow = TRUE; + hb_gt_wvwSetInvalidRect( pWindowData, + ( USHORT ) 0, ( USHORT ) pWindowData->ROWS - ( USHORT ) iRows, + ( USHORT ) pWindowData->COLS - 1, ( USHORT ) pWindowData->ROWS - 1 ); + } - hb_retl( TRUE ); + hb_retl( TRUE ); } /* - *WVW_NOCLOSE( [nWinNum] ) - *disable CLOSE 'X' button of a window + *WVW_NOCLOSE( [nWinNum] ) + *disable CLOSE 'X' button of a window * - *no return value + **no return value */ HB_FUNC( WVW_NOCLOSE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - HMENU hMenu = GetSystemMenu(s_pWvwData->s_pWindows[usWinNum]->hWnd, FALSE); + UINT usWinNum = WVW_WHICH_WINDOW; + HMENU hMenu = GetSystemMenu( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, FALSE ); - if (hMenu) + if( hMenu ) { DeleteMenu( hMenu, SC_CLOSE, MF_BYCOMMAND ); - DrawMenuBar( s_pWvwData->s_pWindows[usWinNum]->hWnd ); + DrawMenuBar( s_pWvwData->s_pWindows[ usWinNum ]->hWnd ); } } /* - *WVW_SETWINSTYLE( [nWinNum], [nStyle] ) - *Get/Set window style - *NOTES: if window has controls (eg. pushbutton, scrollbar) + *WVW_SETWINSTYLE( [nWinNum], [nStyle] ) + *Get/Set window style + *NOTES: if window has controls (eg. pushbutton, scrollbar) * you should include WS_CLIPCHILDREN in nStyle * - *SIDE EFFECT: + **SIDE EFFECT: * if window is hidden, applying nStyle here will cause it to show * - *return Window Style prior to applying the new style + **return Window Style prior to applying the new style */ HB_FUNC( WVW_SETWINSTYLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; LONG_PTR lpStyle; - if (HB_ISNUM(2)) + if( HB_ISNUM( 2 ) ) { - lpStyle = SetWindowLongPtr( s_pWvwData->s_pWindows[usWinNum]->hWnd, GWL_STYLE, (LONG_PTR) hb_parnl(2) ); - SetWindowPos( s_pWvwData->s_pWindows[usWinNum]->hWnd, + lpStyle = SetWindowLongPtr( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, GWL_STYLE, ( LONG_PTR ) hb_parnl( 2 ) ); + SetWindowPos( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, NULL, - 0,0,0,0, - SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED ); - ShowWindow( s_pWvwData->s_pWindows[usWinNum]->hWnd, SW_SHOWNORMAL ); + 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED ); + ShowWindow( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, SW_SHOWNORMAL ); } else { - lpStyle = GetWindowLongPtr( s_pWvwData->s_pWindows[usWinNum]->hWnd, GWL_STYLE ); + lpStyle = GetWindowLongPtr( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, GWL_STYLE ); } hb_retnl( lpStyle ); } /* - *WVW_ENABLEMAXIMIZE( [nWinNum], [lEnable] ) - *Get/Set maximize button + *WVW_ENABLEMAXIMIZE( [nWinNum], [lEnable] ) + *Get/Set maximize button * - *returns maximize box state prior to applying the new style + **returns maximize box state prior to applying the new style * - *NOTE: in order to enable MAXIMIZE button, app should have WVW_SIZE() callback function + **NOTE: in order to enable MAXIMIZE button, app should have WVW_SIZE() callback function */ HB_FUNC( WVW_ENABLEMAXIMIZE ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; LONG_PTR lpStyle; BOOL bState; - lpStyle = GetWindowLongPtr( s_pWvwData->s_pWindows[usWinNum]->hWnd, GWL_STYLE ); - bState = (BOOL) (lpStyle & (LONG_PTR) WS_MAXIMIZEBOX); - hb_retl(bState); + lpStyle = GetWindowLongPtr( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, GWL_STYLE ); + bState = ( BOOL ) ( lpStyle & ( LONG_PTR ) WS_MAXIMIZEBOX ); + hb_retl( bState ); - if (HB_ISLOG(2)) + if( HB_ISLOG( 2 ) ) { - if (hb_parl(2)) + if( hb_parl( 2 ) ) { - if (bState) return; /* no need */ - lpStyle |= (LONG_PTR) WS_MAXIMIZEBOX; + if( bState ) + return; /* no need */ + lpStyle |= ( LONG_PTR ) WS_MAXIMIZEBOX; } else { - if (!bState) return; /* no need */ - lpStyle &= ~ (LONG_PTR) WS_MAXIMIZEBOX; + if( ! bState ) + return; /* no need */ + lpStyle &= ~( LONG_PTR ) WS_MAXIMIZEBOX; } - SetWindowLongPtr( s_pWvwData->s_pWindows[usWinNum]->hWnd, GWL_STYLE, lpStyle ); - SetWindowPos( s_pWvwData->s_pWindows[usWinNum]->hWnd, + SetWindowLongPtr( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, GWL_STYLE, lpStyle ); + SetWindowPos( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, NULL, - 0,0,0,0, - SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED ); - ShowWindow( s_pWvwData->s_pWindows[usWinNum]->hWnd, SW_SHOW ); + 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED ); + ShowWindow( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, SW_SHOW ); } } @@ -8482,59 +8438,59 @@ HB_FUNC( WVW_ENABLEMAXIMIZE ) /*WVW_SetPaintRefresh( [nPaintRefresh] ) - *returns old setting of s_pWvwData->s_uiPaintRefresh (millisec between calls to WVW_PAINT) - *then assigns s_pWvwData->s_uiPaintRefresh:= nPaintRefresh (if supplied) - *NOTES: nPaintRefresh must be >= 50 + *returns old setting of s_pWvwData->s_uiPaintRefresh (millisec between calls to WVW_PAINT) + *then assigns s_pWvwData->s_uiPaintRefresh:= nPaintRefresh (if supplied) + *NOTES: nPaintRefresh must be >= 50 * or nPaintRefresh == 0, causing Repaint to execute immediately, as GTWVT */ HB_FUNC( WVW_SETPAINTREFRESH ) { UINT uiOldPaintRefresh = s_pWvwData->s_uiPaintRefresh; - if ( HB_ISNUM( 1 ) && (hb_parni(1) >= 50 || hb_parni(1)==0) ) + if( HB_ISNUM( 1 ) && ( hb_parni( 1 ) >= 50 || hb_parni( 1 ) == 0 ) ) { - s_pWvwData->s_uiPaintRefresh = hb_parni( 1 ); + s_pWvwData->s_uiPaintRefresh = hb_parni( 1 ); - if ( s_pWvwData->s_sApp->pSymWVW_PAINT ) - { - UINT i; - for (i=0; is_usNumWindows; i++) - { + if( s_pWvwData->s_sApp->pSymWVW_PAINT ) + { + UINT i; + for( i = 0; i < s_pWvwData->s_usNumWindows; i++ ) + { - if (s_pWvwData->s_uiPaintRefresh > 0) - { - SetTimer( s_pWvwData->s_pWindows[i]->hWnd, WVW_ID_SYSTEM_TIMER, (UINT) s_pWvwData->s_uiPaintRefresh, NULL ); + if( s_pWvwData->s_uiPaintRefresh > 0 ) + { + SetTimer( s_pWvwData->s_pWindows[ i ]->hWnd, WVW_ID_SYSTEM_TIMER, ( UINT ) s_pWvwData->s_uiPaintRefresh, NULL ); + } + else + { + KillTimer( s_pWvwData->s_pWindows[ i ]->hWnd, WVW_ID_SYSTEM_TIMER ); + } } - else - { - KillTimer( s_pWvwData->s_pWindows[i]->hWnd, WVW_ID_SYSTEM_TIMER ); - } - } - } + } } hb_retni( uiOldPaintRefresh ); } /*WVW_SetVertCaret( [lOn] ) - *if lOn is supplied: - *lOn == .t.: turn caret into vertical caret - *lOn == .f.: turn caret into horizontal caret - *return old setting of s_pWvwData->s_bVertCaret + *if lOn is supplied: + *lOn == .t.: turn caret into vertical caret + *lOn == .f.: turn caret into horizontal caret + *return old setting of s_pWvwData->s_bVertCaret */ /*TODO: do you want to make it window selective?*/ HB_FUNC( WVW_SETVERTCARET ) { - BOOL bOldVertCaret = s_pWvwData->s_bVertCaret; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows-1 ]; + BOOL bOldVertCaret = s_pWvwData->s_bVertCaret; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ s_pWvwData->s_usNumWindows - 1 ]; - if ( ! HB_ISNIL( 1 ) ) + if( ! HB_ISNIL( 1 ) ) { - s_pWvwData->s_bVertCaret = hb_parl( 1 ); + s_pWvwData->s_bVertCaret = hb_parl( 1 ); - /*TODO: we should recalculate width and height of caret! */ - hb_gt_wvwKillCaret(pWindowData); - hb_gt_wvwCreateCaret(pWindowData); + /*TODO: we should recalculate width and height of caret! */ + hb_gt_wvwKillCaret( pWindowData ); + hb_gt_wvwCreateCaret( pWindowData ); } @@ -8542,63 +8498,63 @@ HB_FUNC( WVW_SETVERTCARET ) } /*WVW_SetDefCentreWindow( [lCentre] ) - *returns old setting of s_pWvwData->s_bDefCentreWindow (default CentreWindow setting for newly opened subwindow) - *then assigns s_pWvwData->s_bDefCentreWindow := lCentre (if supplied) - *NOTES: + *returns old setting of s_pWvwData->s_bDefCentreWindow (default CentreWindow setting for newly opened subwindow) + *then assigns s_pWvwData->s_bDefCentreWindow := lCentre (if supplied) + *NOTES: * - lCentre will be the default CentreWindow for all subwindow opens */ HB_FUNC( WVW_SETDEFCENTREWINDOW ) { BOOL bOldDef = s_pWvwData->s_bDefCentreWindow; - if ( !HB_ISNIL(1) && HB_ISLOG( 1 ) ) + if( ! HB_ISNIL( 1 ) && HB_ISLOG( 1 ) ) { - s_pWvwData->s_bDefCentreWindow = hb_parl( 1 ); + s_pWvwData->s_bDefCentreWindow = hb_parl( 1 ); } hb_retl( bOldDef ); } /*WVW_SetDefHCentreWindow( [lCentre] ) - *returns old setting of s_pWvwData->s_bDefHCentreWindow (default horizontal CentreWindow setting for newly opened subwindow) - *then assigns s_pWvwData->s_bDefHCentreWindow := lCentre (if supplied) - *NOTES: + *returns old setting of s_pWvwData->s_bDefHCentreWindow (default horizontal CentreWindow setting for newly opened subwindow) + *then assigns s_pWvwData->s_bDefHCentreWindow := lCentre (if supplied) + *NOTES: * - lCentre will be the default CentreWindow for all subwindow opens */ HB_FUNC( WVW_SETDEFHCENTREWINDOW ) { BOOL bOldDef = s_pWvwData->s_bDefHCentreWindow; - if ( !HB_ISNIL(1) && HB_ISLOG( 1 ) ) + if( ! HB_ISNIL( 1 ) && HB_ISLOG( 1 ) ) { - s_pWvwData->s_bDefHCentreWindow = hb_parl( 1 ); + s_pWvwData->s_bDefHCentreWindow = hb_parl( 1 ); } hb_retl( bOldDef ); } /*WVW_SetDefVCentreWindow( [lCentre] ) - *returns old setting of s_pWvwData->s_bDefVCentreWindow (default horizontal CentreWindow setting for newly opened subwindow) - *then assigns s_pWvwData->s_bDefVCentreWindow := lCentre (if supplied) - *NOTES: + *returns old setting of s_pWvwData->s_bDefVCentreWindow (default horizontal CentreWindow setting for newly opened subwindow) + *then assigns s_pWvwData->s_bDefVCentreWindow := lCentre (if supplied) + *NOTES: * - lCentre will be the default CentreWindow for all subwindow opens */ HB_FUNC( WVW_SETDEFVCENTREWINDOW ) { BOOL bOldDef = s_pWvwData->s_bDefVCentreWindow; - if ( !HB_ISNIL(1) && HB_ISLOG( 1 ) ) + if( ! HB_ISNIL( 1 ) && HB_ISLOG( 1 ) ) { - s_pWvwData->s_bDefVCentreWindow = hb_parl( 1 ); + s_pWvwData->s_bDefVCentreWindow = hb_parl( 1 ); } hb_retl( bOldDef ); } /*WVW_SetDefLineSpacing( [nLineSpacing] ) - *returns old setting of s_pWvwData->s_byDefLineSpacing (default linespacing between lines) - *then assigns s_pWvwData->s_byDefLineSpacing:= nLineSpacing (if supplied) - *NOTES: + *returns old setting of s_pWvwData->s_byDefLineSpacing (default linespacing between lines) + *then assigns s_pWvwData->s_byDefLineSpacing:= nLineSpacing (if supplied) + *NOTES: * - nLineSpacing will be the default line spacing for all window opens * - nLineSpacing must be even, positive number <= 40 * otherwise it will be ignored @@ -8608,19 +8564,19 @@ HB_FUNC( WVW_SETDEFLINESPACING ) { int byOldLineSpacing = s_pWvwData->s_byDefLineSpacing; - if ( !HB_ISNIL(1) && HB_ISNUM( 1 ) && hb_parni(1) >= 0 && hb_parni(1) <= 40 && /*nobody is crazy enough to use > 40 */ - fmod( hb_parnd(1), 2 ) == 0 ) + if( ! HB_ISNIL( 1 ) && HB_ISNUM( 1 ) && hb_parni( 1 ) >= 0 && hb_parni( 1 ) <= 40 && /*nobody is crazy enough to use > 40 */ + fmod( hb_parnd( 1 ), 2 ) == 0 ) { - s_pWvwData->s_byDefLineSpacing = hb_parni( 1 ); + s_pWvwData->s_byDefLineSpacing = hb_parni( 1 ); } hb_retni( byOldLineSpacing ); } /*WVW_SetLineSpacing( [nWinNum], [nLineSpacing] ) - *returns old setting of linespacing between lines in window nWinNum - *then set the line spacing to nLineSpacing (if supplied) - *NOTES: + *returns old setting of linespacing between lines in window nWinNum + *then set the line spacing to nLineSpacing (if supplied) + *NOTES: * - nLineSpacing must be even, positive number <= 40 * otherwise it will be ignored * - if window size will become too high, line spacing is restored @@ -8628,24 +8584,24 @@ HB_FUNC( WVW_SETDEFLINESPACING ) */ HB_FUNC( WVW_SETLINESPACING ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - int byOldLineSpacing = pWindowData->byLineSpacing; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + int byOldLineSpacing = pWindowData->byLineSpacing; - if ( !HB_ISNIL(2) && HB_ISNUM( 2 ) && hb_parni(2) >= 0 && hb_parni(2) <= 40 && /*nobody is crazy enough to use > 40 */ - fmod( hb_parnd(2), 2 ) == 0 ) + if( ! HB_ISNIL( 2 ) && HB_ISNUM( 2 ) && hb_parni( 2 ) >= 0 && hb_parni( 2 ) <= 40 && /*nobody is crazy enough to use > 40 */ + fmod( hb_parnd( 2 ), 2 ) == 0 ) { - USHORT height, maxHeight; - RECT rcWorkArea = { 0 }; + USHORT height, maxHeight; + RECT rcWorkArea = { 0 }; - SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 ); - maxHeight = (SHORT) ( rcWorkArea.bottom - rcWorkArea.top ); + SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 ); + maxHeight = ( SHORT ) ( rcWorkArea.bottom - rcWorkArea.top ); pWindowData->byLineSpacing = hb_parni( 2 ); - height = hb_gt_wvwCalcPixelHeight( pWindowData ); + height = hb_gt_wvwCalcPixelHeight( pWindowData ); /* TODO/WARNING: this height doesn't take Menu Bar into account */ - if (height >= maxHeight) + if( height >= maxHeight ) { pWindowData->byLineSpacing = byOldLineSpacing; } @@ -8660,9 +8616,9 @@ HB_FUNC( WVW_SETLINESPACING ) } /*WVW_SetDefLSpaceColor( [nColorIndex] ) - *returns old setting of s_pWvwData->s_iDefLSpaceColor (color index of spacing between lines) - *then assigns s_pWvwData->s_iDefLSpaceColor:= nColorIndex (if supplied) - *NOTES: + *returns old setting of s_pWvwData->s_iDefLSpaceColor (color index of spacing between lines) + *then assigns s_pWvwData->s_iDefLSpaceColor:= nColorIndex (if supplied) + *NOTES: * - nColorIndex will be the default line spacing color for all window opens * - nColorIndex must >= 0 and <= 15, or == -1 * nCOlorIndex == 0:black, 1:blue, ..., 7:white, ..., 15:bright white @@ -8673,18 +8629,18 @@ HB_FUNC( WVW_SETDEFLSPACECOLOR ) { int iOldDefLSpaceColor = s_pWvwData->s_iDefLSpaceColor; - if ( !HB_ISNIL(1) && HB_ISNUM( 1 ) && hb_parni(1) >= -1 && hb_parni(1) <= 15 ) + if( ! HB_ISNIL( 1 ) && HB_ISNUM( 1 ) && hb_parni( 1 ) >= -1 && hb_parni( 1 ) <= 15 ) { - s_pWvwData->s_iDefLSpaceColor = hb_parni( 1 ); + s_pWvwData->s_iDefLSpaceColor = hb_parni( 1 ); } hb_retni( iOldDefLSpaceColor ); } /*WVW_SetLSpaceColor( [nWinNum], [nColorIndex] ) - *returns old setting of line space color in window nWinNum - *then set the line spacing color to nColorIndex (if supplied) - *NOTES: + *returns old setting of line space color in window nWinNum + *then set the line spacing color to nColorIndex (if supplied) + *NOTES: * - nColorIndex must be >= 0 and <= 15, or -1 * otherwise it will be ignored * nCOlorIndex == 0:black, 1:blue, ..., 7:white, ..., 15:bright white @@ -8693,17 +8649,17 @@ HB_FUNC( WVW_SETDEFLSPACECOLOR ) */ HB_FUNC( WVW_SETLSPACECOLOR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - int iOldLSpaceColor = pWindowData->iLSpaceColor; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + int iOldLSpaceColor = pWindowData->iLSpaceColor; - if ( !HB_ISNIL(2) && HB_ISNUM( 2 ) && hb_parni(2) >= -1 && hb_parni(2) <= 15 ) + if( ! HB_ISNIL( 2 ) && HB_ISNUM( 2 ) && hb_parni( 2 ) >= -1 && hb_parni( 2 ) <= 15 ) { pWindowData->iLSpaceColor = hb_parni( 2 ); - if ( iOldLSpaceColor != pWindowData->iLSpaceColor ) + if( iOldLSpaceColor != pWindowData->iLSpaceColor ) { - hb_gt_wvwSetInvalidRect( pWindowData, 0, 0, pWindowData->COLS-1, pWindowData->ROWS-1 ); + hb_gt_wvwSetInvalidRect( pWindowData, 0, 0, pWindowData->COLS - 1, pWindowData->ROWS - 1 ); } } @@ -8727,9 +8683,10 @@ HB_FUNC( WVW_SETLSPACECOLOR ) HB_FUNC( WVW_ALLOWNONTOPEVENT ) { BOOL bOldSetting = s_pWvwData->s_bAllowNonTop; - if ( HB_ISLOG(1) ) + + if( HB_ISLOG( 1 ) ) { - s_pWvwData->s_bAllowNonTop = hb_parl(1); + s_pWvwData->s_bAllowNonTop = hb_parl( 1 ); } hb_retl( bOldSetting ); @@ -8750,27 +8707,28 @@ HB_FUNC( WVW_ALLOWNONTOPEVENT ) HB_FUNC( WVW_RECURSECBLOCK ) { BOOL bOldSetting = s_pWvwData->s_bRecurseCBlock; - if ( HB_ISLOG(1) ) + + if( HB_ISLOG( 1 ) ) { - s_pWvwData->s_bRecurseCBlock = hb_parl(1); + s_pWvwData->s_bRecurseCBlock = hb_parl( 1 ); } hb_retl( bOldSetting ); } /*WVW_NoStartupSubWindow( [lOn] ) - *if lOn is supplied: - *lOn == .t.: when opening window, window will not be displayed - *lOn == .f.: when opening window, window will be displayed (default) - *return old setting of s_bNOSTARTUPWINDOW + *if lOn is supplied: + *lOn == .t.: when opening window, window will not be displayed + *lOn == .f.: when opening window, window will be displayed (default) + *return old setting of s_bNOSTARTUPWINDOW */ HB_FUNC( WVW_NOSTARTUPSUBWINDOW ) { BOOL bOldNOSTARTUPSUBWINDOW = s_pWvwData->s_bNOSTARTUPSUBWINDOW; - if ( ! HB_ISNIL( 1 ) ) + if( ! HB_ISNIL( 1 ) ) { - s_pWvwData->s_bNOSTARTUPSUBWINDOW = hb_parl( 1 ); + s_pWvwData->s_bNOSTARTUPSUBWINDOW = hb_parl( 1 ); } hb_retl( bOldNOSTARTUPSUBWINDOW ); @@ -8782,14 +8740,14 @@ HB_FUNC( WVW_NOSTARTUPSUBWINDOW ) HB_FUNC( WVW_GETSCREENWIDTH ) { - hb_retni( GetSystemMetrics( SM_CXSCREEN ) ); + hb_retni( GetSystemMetrics( SM_CXSCREEN ) ); } HB_FUNC( WVW_GETSCREENHEIGHT ) { - hb_retni( GetSystemMetrics( SM_CYSCREEN ) ); + hb_retni( GetSystemMetrics( SM_CYSCREEN ) ); } @@ -8800,8 +8758,9 @@ HB_FUNC( WVW_GETSCREENHEIGHT ) */ HB_FUNC( WVW_SETWINDOWCENTRE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - hb_gt_wvwSetCentreWindow( usWinNum, hb_parl( 2 ), hb_parl( 3 ) ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + + hb_gt_wvwSetCentreWindow( usWinNum, hb_parl( 2 ), hb_parl( 3 ) ); } @@ -8813,39 +8772,40 @@ HB_FUNC( WVW_SETWINDOWCENTRE ) */ HB_FUNC( WVW_ENABLESHORTCUTS ) { - UINT usWinNum = WVW_WHICH_WINDOW; - BOOL bEnable = HB_ISNIL(2) ? TRUE : hb_parl(2); + UINT usWinNum = WVW_WHICH_WINDOW; + BOOL bEnable = HB_ISNIL( 2 ) ? TRUE : hb_parl( 2 ); - hb_retl( hb_gt_wvwEnableShortCuts( usWinNum, bEnable ) ); + hb_retl( hb_gt_wvwEnableShortCuts( usWinNum, bEnable ) ); } HB_FUNC( WVW_SETALTF4CLOSE ) { - hb_retl( hb_gt_wvwSetAltF4Close( hb_parl( 1 ) ) ); + hb_retl( hb_gt_wvwSetAltF4Close( hb_parl( 1 ) ) ); } HB_FUNC( WVW_PROCESSMESSAGES ) { - UINT usWinNum = WVW_WHICH_WINDOW; - hb_gt_wvwDoProcessMessages( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; - hb_retl( 1 ); + hb_gt_wvwDoProcessMessages( usWinNum ); + + hb_retl( 1 ); } HB_FUNC( WVW_GETTITLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - BYTE ucText[ 1024 ]; + UINT usWinNum = WVW_WHICH_WINDOW; + BYTE ucText[ 1024 ]; - hb_gt_wvwGetWindowTitle( usWinNum, ( char* ) ucText, 1023 ); + hb_gt_wvwGetWindowTitle( usWinNum, ( char * ) ucText, 1023 ); - hb_retc( ( char* ) ucText ) ; + hb_retc( ( char * ) ucText ); } @@ -8867,11 +8827,11 @@ HB_FUNC( WVW_GETTITLE ) HB_FUNC( WVW_GETRGBCOLOR ) { int iColor; - if ( !HB_ISNIL( 1 ) ) + + if( ! HB_ISNIL( 1 ) ) { iColor = hb_parni( 1 ); - if ( iColor >= 0 && iColor < 16 ) /* Test bound error */ - + if( iColor >= 0 && iColor < 16 ) /* Test bound error */ { hb_retnl( _COLORS[ iColor ] ); @@ -8895,27 +8855,27 @@ HB_FUNC( WVW_GETRGBCOLOR ) HB_FUNC( WVW_GETCLIPBOARD ) { - HGLOBAL hglb; - LPTSTR lptstr; + HGLOBAL hglb; + LPTSTR lptstr; - if ( !IsClipboardFormatAvailable(CF_TEXT) ) + if( ! IsClipboardFormatAvailable( CF_TEXT ) ) { - hb_ret(); + hb_ret(); } - if (!OpenClipboard( NULL )) + if( ! OpenClipboard( NULL ) ) { - hb_ret(); + hb_ret(); } - hglb = GetClipboardData(CF_TEXT); - if (hglb != NULL) + hglb = GetClipboardData( CF_TEXT ); + if( hglb != NULL ) { - lptstr = (LPSTR) GlobalLock(hglb); - if (lptstr != NULL) + lptstr = ( LPSTR ) GlobalLock( hglb ); + if( lptstr != NULL ) { hb_retc( lptstr ); - GlobalUnlock(hglb); + GlobalUnlock( hglb ); } } CloseClipboard(); @@ -8925,52 +8885,52 @@ HB_FUNC( WVW_GETCLIPBOARD ) HB_FUNC( WVW_SETCLIPBOARD ) { - LPTSTR lptstrCopy; - HGLOBAL hglbCopy; - const char * cText; - int nLen; + LPTSTR lptstrCopy; + HGLOBAL hglbCopy; + const char * cText; + int nLen; - if ( !IsClipboardFormatAvailable( CF_TEXT ) ) + if( ! IsClipboardFormatAvailable( CF_TEXT ) ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } /* Check params */ - if ( ! HB_ISCHAR( 1 ) ) + if( ! HB_ISCHAR( 1 ) ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } - if ( ! OpenClipboard( NULL ) ) + if( ! OpenClipboard( NULL ) ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } EmptyClipboard(); /* Get text from PRG */ - cText = hb_parcx( 1 ); - nLen = hb_parclen( 1 ); + cText = hb_parcx( 1 ); + nLen = hb_parclen( 1 ); /* Allocate a global memory object for the text. */ - hglbCopy = GlobalAlloc( GMEM_MOVEABLE, ( nLen+1 ) * sizeof( TCHAR ) ); - if ( hglbCopy == NULL ) + hglbCopy = GlobalAlloc( GMEM_MOVEABLE, ( nLen + 1 ) * sizeof( TCHAR ) ); + if( hglbCopy == NULL ) { - CloseClipboard(); - hb_retl( FALSE ); - return; + CloseClipboard(); + hb_retl( FALSE ); + return; } /* Lock the handle and copy the text to the buffer. */ - lptstrCopy = ( LPSTR ) GlobalLock( hglbCopy ); - memcpy( lptstrCopy, cText, ( nLen+1 ) * sizeof( TCHAR ) ); - lptstrCopy[ nLen+1 ] = ( TCHAR ) 0; + lptstrCopy = ( LPSTR ) GlobalLock( hglbCopy ); + memcpy( lptstrCopy, cText, ( nLen + 1 ) * sizeof( TCHAR ) ); + lptstrCopy[ nLen + 1 ] = ( TCHAR ) 0; GlobalUnlock( hglbCopy ); /* Place the handle on the clipboard. @@ -8985,35 +8945,35 @@ HB_FUNC( WVW_SETCLIPBOARD ) HB_FUNC( WVW_PASTEFROMCLIPBOARD ) { - HGLOBAL hglb; - LPTSTR lptstr; - ULONG ul; + HGLOBAL hglb; + LPTSTR lptstr; + ULONG ul; - if ( !IsClipboardFormatAvailable( CF_TEXT ) ) + if( ! IsClipboardFormatAvailable( CF_TEXT ) ) { - hb_ret(); + hb_ret(); } - if ( !OpenClipboard( NULL ) ) + if( ! OpenClipboard( NULL ) ) { - hb_ret(); + hb_ret(); } hglb = GetClipboardData( CF_TEXT ); - if ( hglb != NULL ) + if( hglb != NULL ) { lptstr = ( LPSTR ) GlobalLock( hglb ); - if ( lptstr != NULL ) + if( lptstr != NULL ) { /*TraceLog( NULL, "Clipboard %s\n", (LPSTR) lptstr ); */ /*TraceLog( NULL, "Clipboard size %u\n", GlobalSize(hglb) ); */ - for ( ul=0; ul < GlobalSize( hglb ); ul++ ) + for( ul = 0; ul < GlobalSize( hglb ); ul++ ) { hb_gt_wvwAddCharToInputQueue( ( int ) lptstr[ ul ] ); /*TraceLog( NULL, "Value %i\n", ( int ) lptstr[ ul ] ); */ } - GlobalUnlock( hglb ) ; + GlobalUnlock( hglb ); } } CloseClipboard(); @@ -9034,27 +8994,27 @@ HB_FUNC( WVW_KEYBOARD ) HB_FUNC( WVW_INVALIDATERECT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - RECT rc = { 0 }; - POINT xy = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + RECT rc = { 0 }; + POINT xy = { 0 }; - USHORT usTop = ( USHORT ) hb_parni( 2 ), - usLeft = ( USHORT ) hb_parni( 3 ), - usBottom = ( USHORT ) hb_parni( 4 ), - usRight = ( USHORT ) hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - if (s_pWvwData->s_bMainCoordMode) + if( s_pWvwData->s_bMainCoordMode ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - rc.top = xy.y; - rc.left = xy.x; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight+1, usBottom+1 ); - rc.bottom = xy.y - 1; - rc.right = xy.x - 1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + rc.top = xy.y; + rc.left = xy.x; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + rc.bottom = xy.y - 1; + rc.right = xy.x - 1; InvalidateRect( pWindowData->hWnd, &rc, TRUE ); } @@ -9070,16 +9030,16 @@ HB_FUNC( WVW_ISLBUTTONPRESSED ) HB_FUNC( WVW_CLIENTTOSCREEN ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - PHB_ITEM paXY = hb_itemArrayNew(2); - POINT xy = { 0 }; - USHORT usTop = ( USHORT ) hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + PHB_ITEM paXY = hb_itemArrayNew( 2 ); + POINT xy = { 0 }; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ); - if (s_pWvwData->s_bMainCoordMode) + if( s_pWvwData->s_bMainCoordMode ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, NULL, NULL ); } xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); @@ -9105,13 +9065,14 @@ HB_FUNC( WVW_CLIENTTOSCREEN ) HB_FUNC( WVW_SETFONT ) { UINT usWinNum = WVW_WHICH_WINDOW; + hb_retl( hb_gt_wvwSetFont( usWinNum, - HB_ISNIL( 2 ) ? s_pWvwData->s_pWindows[usWinNum]->fontFace : hb_parcx( 2 ), - HB_ISNIL( 3 ) ? s_pWvwData->s_pWindows[usWinNum]->fontHeight : hb_parni( 3 ), - HB_ISNIL( 4 ) ? s_pWvwData->s_pWindows[usWinNum]->fontWidth : hb_parni( 4 ), - HB_ISNIL( 5 ) ? s_pWvwData->s_pWindows[usWinNum]->fontWeight : hb_parni( 5 ), - HB_ISNIL( 6 ) ? s_pWvwData->s_pWindows[usWinNum]->fontQuality: hb_parni( 6 ) - ) ) ; + HB_ISNIL( 2 ) ? s_pWvwData->s_pWindows[ usWinNum ]->fontFace : hb_parcx( 2 ), + HB_ISNIL( 3 ) ? s_pWvwData->s_pWindows[ usWinNum ]->fontHeight : hb_parni( 3 ), + HB_ISNIL( 4 ) ? s_pWvwData->s_pWindows[ usWinNum ]->fontWidth : hb_parni( 4 ), + HB_ISNIL( 5 ) ? s_pWvwData->s_pWindows[ usWinNum ]->fontWeight : hb_parni( 5 ), + HB_ISNIL( 6 ) ? s_pWvwData->s_pWindows[ usWinNum ]->fontQuality : hb_parni( 6 ) + ) ); } @@ -9120,14 +9081,14 @@ HB_FUNC( WVW_SETICON ) { UINT usWinNum = WVW_WHICH_WINDOW; - if ( HB_ISNUM( 2 ) || HB_ISCHAR( 3 ) ) + if( HB_ISNUM( 2 ) || HB_ISCHAR( 3 ) ) { - hb_retptr( (void*)hb_gt_wvwSetWindowIcon( usWinNum, hb_parni( 2 ), hb_parc( 3 ) ) ) ; + hb_retptr( ( void * ) hb_gt_wvwSetWindowIcon( usWinNum, hb_parni( 2 ), hb_parc( 3 ) ) ); } else { - hb_retptr( (void*) hb_gt_wvwSetWindowIconFromFile( usWinNum, hb_parcx( 2 ) ) ) ; + hb_retptr( ( void * ) hb_gt_wvwSetWindowIconFromFile( usWinNum, hb_parcx( 2 ) ) ); } } @@ -9136,8 +9097,9 @@ HB_FUNC( WVW_SETICON ) HB_FUNC( WVW_SETTITLE ) { UINT usWinNum = WVW_WHICH_WINDOW; - hb_gt_wvwSetWindowTitle( usWinNum, hb_parcx( 2 ) ) ; - return ; + + hb_gt_wvwSetWindowTitle( usWinNum, hb_parcx( 2 ) ); + return; } @@ -9146,6 +9108,7 @@ HB_FUNC( WVW_SETTITLE ) HB_FUNC( WVW_SETWINDOWPOS ) { UINT usWinNum = WVW_WHICH_WINDOW; + hb_gt_wvwSetWindowPos( usWinNum, hb_parni( 2 ), hb_parni( 3 ) ); } @@ -9154,7 +9117,8 @@ HB_FUNC( WVW_SETWINDOWPOS ) HB_FUNC( WVW_GETWINDOWHANDLE ) { UINT usWinNum = WVW_WHICH_WINDOW; - hb_retnl( ( LONG ) hb_gt_wvwGetWindowHandle( usWinNum ) ) ; + + hb_retnl( ( LONG ) hb_gt_wvwGetWindowHandle( usWinNum ) ); } @@ -9162,6 +9126,7 @@ HB_FUNC( WVW_GETWINDOWHANDLE ) HB_FUNC( WVW_SETCODEPAGE ) { UINT usWinNum = WVW_WHICH_WINDOW; + hb_retni( hb_gt_wvwSetCodePage( usWinNum, hb_parni( 2 ) ) ); } @@ -9173,8 +9138,8 @@ HB_FUNC( WVW_CENTERWINDOW ) UINT usWinNum = WVW_WHICH_WINDOW; hb_retl( hb_gt_wvwSetCentreWindow( usWinNum, - HB_ISNIL( 2 ) ? TRUE : hb_parl( 2 ), - HB_ISNIL( 3 ) ? FALSE : hb_parl( 3 ) ) ); + HB_ISNIL( 2 ) ? TRUE : hb_parl( 2 ), + HB_ISNIL( 3 ) ? FALSE : hb_parl( 3 ) ) ); } @@ -9182,9 +9147,10 @@ HB_FUNC( WVW_CENTERWINDOW ) HB_FUNC( WVW_SETMOUSEMOVE ) { UINT usWinNum = WVW_WHICH_WINDOW; - if ( HB_ISNIL( 2 ) ) + + if( HB_ISNIL( 2 ) ) { - hb_retl( s_pWvwData->s_pWindows[usWinNum]->MouseMove ); + hb_retl( s_pWvwData->s_pWindows[ usWinNum ]->MouseMove ); } else { @@ -9196,11 +9162,11 @@ HB_FUNC( WVW_SETMOUSEMOVE ) HB_FUNC( WVW_GETXYFROMROWCOL ) { - UINT usWinNum = WVW_WHICH_WINDOW; - PHB_ITEM paXY = hb_itemArrayNew(2); - POINT xy = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + PHB_ITEM paXY = hb_itemArrayNew( 2 ); + POINT xy = { 0 }; - xy = hb_gt_wvwGetXYFromColRow( s_pWvwData->s_pWindows[ usWinNum ], (USHORT) hb_parni( 3 ), (USHORT) hb_parni( 2 ) ); + xy = hb_gt_wvwGetXYFromColRow( s_pWvwData->s_pWindows[ usWinNum ], ( USHORT ) hb_parni( 3 ), ( USHORT ) hb_parni( 2 ) ); hb_arraySetNL( paXY, 1, xy.x ); hb_arraySetNL( paXY, 2, xy.y ); @@ -9215,11 +9181,11 @@ HB_FUNC( WVW_GETXYFROMROWCOL ) */ HB_FUNC( WVW_GETROWCOLFROMXY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - PHB_ITEM paRowCol = hb_itemArrayNew(2); + UINT usWinNum = WVW_WHICH_WINDOW; + PHB_ITEM paRowCol = hb_itemArrayNew( 2 ); POINT RowCol; - RowCol = hb_gt_wvwGetColRowFromXY( s_pWvwData->s_pWindows[ usWinNum ], (USHORT)hb_parni( 2 ), (USHORT)hb_parni( 3 )); + RowCol = hb_gt_wvwGetColRowFromXY( s_pWvwData->s_pWindows[ usWinNum ], ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 3 ) ); hb_arraySetNL( paRowCol, 1, RowCol.y ); hb_arraySetNL( paRowCol, 2, RowCol.x ); @@ -9231,16 +9197,16 @@ HB_FUNC( WVW_GETROWCOLFROMXY ) HB_FUNC( WVW_GETFONTINFO ) { - UINT usWinNum = WVW_WHICH_WINDOW; - PHB_ITEM info = hb_itemArrayNew(7); + UINT usWinNum = WVW_WHICH_WINDOW; + PHB_ITEM info = hb_itemArrayNew( 7 ); - hb_arraySetC( info, 1, s_pWvwData->s_pWindows[usWinNum]->fontFace ); - hb_arraySetNL( info, 2, s_pWvwData->s_pWindows[usWinNum]->fontHeight ); - hb_arraySetNL( info, 3, s_pWvwData->s_pWindows[usWinNum]->fontWidth ); - hb_arraySetNL( info, 4, s_pWvwData->s_pWindows[usWinNum]->fontWeight ); - hb_arraySetNL( info, 5, s_pWvwData->s_pWindows[usWinNum]->fontQuality ); - hb_arraySetNL( info, 6, s_pWvwData->s_pWindows[usWinNum]->PTEXTSIZE.y ); - hb_arraySetNL( info, 7, s_pWvwData->s_pWindows[usWinNum]->PTEXTSIZE.x ); + hb_arraySetC( info, 1, s_pWvwData->s_pWindows[ usWinNum ]->fontFace ); + hb_arraySetNL( info, 2, s_pWvwData->s_pWindows[ usWinNum ]->fontHeight ); + hb_arraySetNL( info, 3, s_pWvwData->s_pWindows[ usWinNum ]->fontWidth ); + hb_arraySetNL( info, 4, s_pWvwData->s_pWindows[ usWinNum ]->fontWeight ); + hb_arraySetNL( info, 5, s_pWvwData->s_pWindows[ usWinNum ]->fontQuality ); + hb_arraySetNL( info, 6, s_pWvwData->s_pWindows[ usWinNum ]->PTEXTSIZE.y ); + hb_arraySetNL( info, 7, s_pWvwData->s_pWindows[ usWinNum ]->PTEXTSIZE.x ); hb_itemReturnRelease( info ); @@ -9250,11 +9216,11 @@ HB_FUNC( WVW_GETFONTINFO ) HB_FUNC( WVW_GETPALETTE ) { - PHB_ITEM info = hb_itemArrayNew(16); - int i; + PHB_ITEM info = hb_itemArrayNew( 16 ); + int i; - for ( i = 0; i < 16; i++ ) - hb_arraySetNL( info, i+1, _COLORS[ i ] ); + for( i = 0; i < 16; i++ ) + hb_arraySetNL( info, i + 1, _COLORS[ i ] ); hb_itemReturnRelease( info ); @@ -9266,11 +9232,11 @@ HB_FUNC( WVW_GETPALETTE ) /* */ HB_FUNC( WVW_SETPALETTE ) { - int i; + int i; - for ( i = 0; i < 16; i++ ) + for( i = 0; i < 16; i++ ) { - _COLORS[ i ] = hb_parvnl( 1, i+1 ); + _COLORS[ i ] = hb_parvnl( 1, i + 1 ); } } @@ -9279,7 +9245,8 @@ HB_FUNC( WVW_SETPALETTE ) HB_FUNC( WVW_MINIMIZE ) { UINT usWinNum = WVW_WHICH_WINDOW; - ShowWindow( s_pWvwData->s_pWindows[usWinNum]->hWnd, SW_MINIMIZE ); + + ShowWindow( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, SW_MINIMIZE ); } @@ -9294,15 +9261,15 @@ HB_FUNC( WVW_MAXIMIZE ) { UINT usWinNum = WVW_WHICH_WINDOW; - if ( !(s_pWvwData->s_sApp->pSymWVW_SIZE) ) + if( ! ( s_pWvwData->s_sApp->pSymWVW_SIZE ) ) { - /* the old, default behaviour as in gtwvt */ - ShowWindow( s_pWvwData->s_pWindows[usWinNum]->hWnd, SW_RESTORE ); + /* the old, default behaviour as in gtwvt */ + ShowWindow( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, SW_RESTORE ); } else { - /* app seems to be ready to handle the maximized window */ - ShowWindow( s_pWvwData->s_pWindows[usWinNum]->hWnd, SW_MAXIMIZE ); + /* app seems to be ready to handle the maximized window */ + ShowWindow( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, SW_MAXIMIZE ); } } @@ -9319,7 +9286,7 @@ HB_FUNC( WVW_RESTORE ) { UINT usWinNum = WVW_WHICH_WINDOW; - ShowWindow( s_pWvwData->s_pWindows[usWinNum]->hWnd, SW_RESTORE ); + ShowWindow( s_pWvwData->s_pWindows[ usWinNum ]->hWnd, SW_RESTORE ); } /* about WVW_SIZE callback function: @@ -9328,10 +9295,10 @@ HB_FUNC( WVW_RESTORE ) function WVW_SIZE(nWinNum, hWnd, message, wParam, lParam) notes: - * this function is called by gtwvw AFTER the size is changed - * WARNING: screen repainting is not performed completely by gtwvw at this point of call - * WARNING: this function may be called BEFORE gtwvw initialization (use wvw_gtinit() to check) - * WARNING: this function may be called AFTER xharbour vm cleans up static variables, + * this function is called by gtwvw AFTER the size is changed + * WARNING: screen repainting is not performed completely by gtwvw at this point of call + * WARNING: this function may be called BEFORE gtwvw initialization (use wvw_gtinit() to check) + * WARNING: this function may be called AFTER xharbour vm cleans up static variables, so do NOT use static variables in this function (unless you guard the usage properly)! you may however uses MEMVAR such as PUBLIC variables @@ -9340,8 +9307,8 @@ HB_FUNC( WVW_RESTORE ) /* NOTE: this is not supported in GTWVW -HB_FUNC( WVW_SETGUI ) -{ + HB_FUNC( WVW_SETGUI ) + { BOOL bGui = s_pWvwData->s_sApp->bGui; if ( ! HB_ISNIL( 1 ) ) @@ -9350,8 +9317,8 @@ HB_FUNC( WVW_SETGUI ) } hb_retl( bGui ); -} -*/ + } + */ /* * @@ -9362,11 +9329,12 @@ HB_FUNC( WVW_SETGUI ) LPWORD lpwAlign( LPWORD lpIn ) { ULONG ul; + ul = ( ULONG ) lpIn; ul += 3; - ul >>=2; - ul <<=2; - return ( LPWORD ) ul; + ul >>= 2; + ul <<= 2; + return ( LPWORD ) ul; } int nCopyAnsiToWideChar( LPWORD lpWCStr, LPSTR lpAnsiIn ) @@ -9378,110 +9346,110 @@ int nCopyAnsiToWideChar( LPWORD lpWCStr, LPSTR lpAnsiIn ) *lpWCStr++ = ( WORD ) *lpAnsiIn; nChar++; } - while ( *lpAnsiIn++ ); + while( *lpAnsiIn++ ); return nChar; } IPicture * rr_LoadPictureFromResource( const char * resname, UINT iresimage, LONG * lwidth, LONG * lheight ) { - HBITMAP hbmpx; - IPicture *iPicture = NULL; - PICTDESC picd; + HBITMAP hbmpx; + IPicture * iPicture = NULL; + PICTDESC picd; // int nSize ; - char szResname[_MAX_PATH+1]; - int iWidth, iHeight; + char szResname[ _MAX_PATH + 1 ]; + int iWidth, iHeight; - iWidth = *lwidth; - iHeight = *lheight; + iWidth = *lwidth; + iHeight = *lheight; - if ( resname == NULL ) - { + if( resname == NULL ) + { sprintf( szResname, "?%u", iresimage ); - hbmpx = FindBitmapHandle(szResname, &iWidth, &iHeight); + hbmpx = FindBitmapHandle( szResname, &iWidth, &iHeight ); - if (!hbmpx) + if( ! hbmpx ) { - hbmpx = (HBITMAP)LoadImage(s_pWvwData->hInstance,(LPCTSTR) MAKEINTRESOURCE( (WORD) iresimage ),IMAGE_BITMAP,0,0, LR_DEFAULTCOLOR); - AddBitmapHandle(szResname, hbmpx, iWidth, iHeight); + hbmpx = ( HBITMAP ) LoadImage( s_pWvwData->hInstance, ( LPCTSTR ) MAKEINTRESOURCE( ( WORD ) iresimage ), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR ); + AddBitmapHandle( szResname, hbmpx, iWidth, iHeight ); } - } - else - { - hbmpx = FindBitmapHandle(resname, &iWidth, &iHeight); + } + else + { + hbmpx = FindBitmapHandle( resname, &iWidth, &iHeight ); - if (!hbmpx) + if( ! hbmpx ) { - hbmpx = (HBITMAP)LoadImage(s_pWvwData->hInstance,resname,IMAGE_BITMAP,0,0, LR_DEFAULTCOLOR); - AddBitmapHandle(resname, hbmpx, iWidth, iHeight); + hbmpx = ( HBITMAP ) LoadImage( s_pWvwData->hInstance, resname, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR ); + AddBitmapHandle( resname, hbmpx, iWidth, iHeight ); } - } - *lwidth = iWidth; - *lheight = iHeight; + } + *lwidth = iWidth; + *lheight = iHeight; - if (hbmpx!=NULL) - { - iPicture = FindPictureHandle(resname, &iWidth, &iHeight); + if( hbmpx != NULL ) + { + iPicture = FindPictureHandle( resname, &iWidth, &iHeight ); - if (iPicture==NULL) - { - picd.cbSizeofstruct=sizeof(PICTDESC); - picd.picType=PICTYPE_BITMAP; - picd.bmp.hbitmap=hbmpx; - OleCreatePictureIndirect(&picd,&IID_IPicture,TRUE,(LPVOID*) &iPicture); - AddPictureHandle(resname, iPicture, iWidth, iHeight); - } - } - if (iPicture!=NULL) - { - iPicture->lpVtbl->get_Width(iPicture,lwidth); - iPicture->lpVtbl->get_Height(iPicture,lheight); - } - return iPicture; + if( iPicture == NULL ) + { + picd.cbSizeofstruct = sizeof( PICTDESC ); + picd.picType = PICTYPE_BITMAP; + picd.bmp.hbitmap = hbmpx; + OleCreatePictureIndirect( &picd, &IID_IPicture, TRUE, ( LPVOID * ) &iPicture ); + AddPictureHandle( resname, iPicture, iWidth, iHeight ); + } + } + if( iPicture != NULL ) + { + iPicture->lpVtbl->get_Width( iPicture, lwidth ); + iPicture->lpVtbl->get_Height( iPicture, lheight ); + } + return iPicture; } IPicture * rr_LoadPicture( const char * filename, LONG * lwidth, LONG * lheight ) { - IStream *iStream=NULL ; - IPicture *iPicture=NULL; - HGLOBAL hGlobal; - void *pGlobal; - HANDLE hFile; - DWORD nFileSize,nReadByte; + IStream * iStream = NULL; + IPicture * iPicture = NULL; + HGLOBAL hGlobal; + void * pGlobal; + HANDLE hFile; + DWORD nFileSize, nReadByte; - hFile = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) - return NULL; - nFileSize = GetFileSize(hFile, NULL); - hGlobal = GlobalAlloc(GMEM_MOVEABLE, nFileSize+4096); - pGlobal = GlobalLock(hGlobal); - ReadFile(hFile, pGlobal, nFileSize, &nReadByte, NULL); - CloseHandle(hFile); - CreateStreamOnHGlobal(hGlobal, TRUE, &iStream); - if (iStream==NULL) - { - GlobalUnlock(hGlobal); - GlobalFree(hGlobal); - return NULL; - } - OleLoadPicture(iStream, nFileSize, TRUE, &IID_IPicture, (LPVOID*)&iPicture); - GlobalUnlock(hGlobal); - GlobalFree(hGlobal); - iStream->lpVtbl->Release(iStream); - iStream=NULL; - if (iPicture!=NULL) - { - iPicture->lpVtbl->get_Width(iPicture ,lwidth); - iPicture->lpVtbl->get_Height(iPicture,lheight); - } - return iPicture; + hFile = CreateFile( filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); + if( hFile == INVALID_HANDLE_VALUE ) + return NULL; + nFileSize = GetFileSize( hFile, NULL ); + hGlobal = GlobalAlloc( GMEM_MOVEABLE, nFileSize + 4096 ); + pGlobal = GlobalLock( hGlobal ); + ReadFile( hFile, pGlobal, nFileSize, &nReadByte, NULL ); + CloseHandle( hFile ); + CreateStreamOnHGlobal( hGlobal, TRUE, &iStream ); + if( iStream == NULL ) + { + GlobalUnlock( hGlobal ); + GlobalFree( hGlobal ); + return NULL; + } + OleLoadPicture( iStream, nFileSize, TRUE, &IID_IPicture, ( LPVOID * ) &iPicture ); + GlobalUnlock( hGlobal ); + GlobalFree( hGlobal ); + iStream->lpVtbl->Release( iStream ); + iStream = NULL; + if( iPicture != NULL ) + { + iPicture->lpVtbl->get_Width( iPicture, lwidth ); + iPicture->lpVtbl->get_Height( iPicture, lheight ); + } + return iPicture; } /* PENDING decision: -20040908 TODO: GTWVT deliberately adds new parm aOffset before nRoundHeight + 20040908 TODO: GTWVT deliberately adds new parm aOffset before nRoundHeight I hate it when doing such thing */ @@ -9493,206 +9461,211 @@ IPicture * rr_LoadPicture( const char * filename, LONG * lwidth, LONG * lheight /* Supporting functions */ -static BITMAPINFO * PackedDibLoad (PTSTR szFileName) +static BITMAPINFO * PackedDibLoad( PTSTR szFileName ) { - BITMAPFILEHEADER bmfh ; - BITMAPINFO * pbmi ; - BOOL bSuccess ; - DWORD dwPackedDibSize, dwBytesRead ; - HANDLE hFile ; + BITMAPFILEHEADER bmfh; + BITMAPINFO * pbmi; + BOOL bSuccess; + DWORD dwPackedDibSize, dwBytesRead; + HANDLE hFile; - hFile = CreateFile (szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, - OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL) ; + hFile = CreateFile( szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL ); - if (hFile == INVALID_HANDLE_VALUE) - return NULL ; + if( hFile == INVALID_HANDLE_VALUE ) + return NULL; - bSuccess = ReadFile (hFile, &bmfh, sizeof (BITMAPFILEHEADER), - &dwBytesRead, NULL) ; + bSuccess = ReadFile( hFile, &bmfh, sizeof( BITMAPFILEHEADER ), + &dwBytesRead, NULL ); - if (!bSuccess || (dwBytesRead != sizeof (BITMAPFILEHEADER)) - || (bmfh.bfType != * (WORD *) "BM")) - { - CloseHandle (hFile) ; - return NULL ; - } + if( ! bSuccess || ( dwBytesRead != sizeof( BITMAPFILEHEADER ) ) + || ( bmfh.bfType != *( WORD * ) "BM" ) ) + { + CloseHandle( hFile ); + return NULL; + } - dwPackedDibSize = bmfh.bfSize - sizeof (BITMAPFILEHEADER) ; + dwPackedDibSize = bmfh.bfSize - sizeof( BITMAPFILEHEADER ); - pbmi = (BITMAPINFO *) hb_xgrab(dwPackedDibSize) ; + pbmi = ( BITMAPINFO * ) hb_xgrab( dwPackedDibSize ); - bSuccess = ReadFile (hFile, pbmi, dwPackedDibSize, &dwBytesRead, NULL) ; - CloseHandle (hFile) ; + bSuccess = ReadFile( hFile, pbmi, dwPackedDibSize, &dwBytesRead, NULL ); + CloseHandle( hFile ); - if (!bSuccess || (dwBytesRead != dwPackedDibSize)) - { + if( ! bSuccess || ( dwBytesRead != dwPackedDibSize ) ) + { - hb_xfree (pbmi) ; - return NULL ; - } + hb_xfree( pbmi ); + return NULL; + } - return pbmi ; + return pbmi; } -static int PackedDibGetWidth (BITMAPINFO * pPackedDib) +static int PackedDibGetWidth( BITMAPINFO * pPackedDib ) { - if (pPackedDib->bmiHeader.biSize == sizeof (BITMAPCOREHEADER)) - return ((PBITMAPCOREINFO)pPackedDib)->bmciHeader.bcWidth ; - else - return pPackedDib->bmiHeader.biWidth ; + if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) + return ( ( PBITMAPCOREINFO ) pPackedDib )->bmciHeader.bcWidth; + else + return pPackedDib->bmiHeader.biWidth; } -static int PackedDibGetHeight (BITMAPINFO * pPackedDib) +static int PackedDibGetHeight( BITMAPINFO * pPackedDib ) { - if (pPackedDib->bmiHeader.biSize == sizeof (BITMAPCOREHEADER)) - return ((PBITMAPCOREINFO)pPackedDib)->bmciHeader.bcHeight ; - else - return abs (pPackedDib->bmiHeader.biHeight) ; + if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) + return ( ( PBITMAPCOREINFO ) pPackedDib )->bmciHeader.bcHeight; + else + return abs( pPackedDib->bmiHeader.biHeight ); } -static int PackedDibGetBitCount (BITMAPINFO * pPackedDib) +static int PackedDibGetBitCount( BITMAPINFO * pPackedDib ) { - if (pPackedDib->bmiHeader.biSize == sizeof (BITMAPCOREHEADER)) - return ((PBITMAPCOREINFO)pPackedDib)->bmciHeader.bcBitCount ; - else - return pPackedDib->bmiHeader.biBitCount ; + if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) + return ( ( PBITMAPCOREINFO ) pPackedDib )->bmciHeader.bcBitCount; + else + return pPackedDib->bmiHeader.biBitCount; } -static int PackedDibGetInfoHeaderSize (BITMAPINFO * pPackedDib) +static int PackedDibGetInfoHeaderSize( BITMAPINFO * pPackedDib ) { - if (pPackedDib->bmiHeader.biSize == sizeof (BITMAPCOREHEADER)) - return ((PBITMAPCOREINFO)pPackedDib)->bmciHeader.bcSize ; + if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) + return ( ( PBITMAPCOREINFO ) pPackedDib )->bmciHeader.bcSize; - else if (pPackedDib->bmiHeader.biSize == sizeof (BITMAPINFOHEADER)) - return pPackedDib->bmiHeader.biSize + - (pPackedDib->bmiHeader.biCompression == - BI_BITFIELDS ? 12 : 0) ; + else if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPINFOHEADER ) ) + return pPackedDib->bmiHeader.biSize + + ( pPackedDib->bmiHeader.biCompression == + BI_BITFIELDS ? 12 : 0 ); - else return pPackedDib->bmiHeader.biSize ; + else + return pPackedDib->bmiHeader.biSize; } -static int PackedDibGetColorsUsed (BITMAPINFO * pPackedDib) +static int PackedDibGetColorsUsed( BITMAPINFO * pPackedDib ) { - if (pPackedDib->bmiHeader.biSize == sizeof (BITMAPCOREHEADER)) - return 0 ; - else - return pPackedDib->bmiHeader.biClrUsed ; + if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) + return 0; + else + return pPackedDib->bmiHeader.biClrUsed; } -static int PackedDibGetNumColors (BITMAPINFO * pPackedDib) +static int PackedDibGetNumColors( BITMAPINFO * pPackedDib ) { - int iNumColors ; + int iNumColors; - iNumColors = PackedDibGetColorsUsed (pPackedDib) ; + iNumColors = PackedDibGetColorsUsed( pPackedDib ); - if (iNumColors == 0 && PackedDibGetBitCount (pPackedDib) < 16) - iNumColors = 1 << PackedDibGetBitCount (pPackedDib) ; + if( iNumColors == 0 && PackedDibGetBitCount( pPackedDib ) < 16 ) + iNumColors = 1 << PackedDibGetBitCount( pPackedDib ); - return iNumColors ; + return iNumColors; } -static int PackedDibGetColorTableSize (BITMAPINFO * pPackedDib) +static int PackedDibGetColorTableSize( BITMAPINFO * pPackedDib ) { - if (pPackedDib->bmiHeader.biSize == sizeof (BITMAPCOREHEADER)) - return PackedDibGetNumColors (pPackedDib) * sizeof (RGBTRIPLE) ; - else - return PackedDibGetNumColors (pPackedDib) * sizeof (RGBQUAD) ; + if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) + return PackedDibGetNumColors( pPackedDib ) * sizeof( RGBTRIPLE ); + else + return PackedDibGetNumColors( pPackedDib ) * sizeof( RGBQUAD ); } -static BYTE * PackedDibGetBitsPtr (BITMAPINFO * pPackedDib) +static BYTE * PackedDibGetBitsPtr( BITMAPINFO * pPackedDib ) { - return ((BYTE *) pPackedDib) + PackedDibGetInfoHeaderSize (pPackedDib) + - PackedDibGetColorTableSize (pPackedDib) ; + return ( ( BYTE * ) pPackedDib ) + PackedDibGetInfoHeaderSize( pPackedDib ) + + PackedDibGetColorTableSize( pPackedDib ); } /* FindBitmapHandle and AddBitmapHandle are for bitmaps associated with Windows controls such as toolbar, pushbutton, checkbox, etc */ -HBITMAP FindBitmapHandle( const char * szFileName, int * piWidth, int * piHeight) +HBITMAP FindBitmapHandle( const char * szFileName, int * piWidth, int * piHeight ) { - BITMAP_HANDLE * pbh = s_pWvwData->s_sApp->pbhBitmapList; + BITMAP_HANDLE * pbh = s_pWvwData->s_sApp->pbhBitmapList; - BOOL bStrictDimension = !(*piWidth==0 && *piHeight==0); - while (pbh) - { + BOOL bStrictDimension = ! ( *piWidth == 0 && *piHeight == 0 ); - if (strcmp(szFileName, pbh->szFilename)==0 && - (!bStrictDimension || - (*piWidth == pbh->iWidth && - *piHeight== pbh->iHeight - ) - ) - ) - { - if (!bStrictDimension) + while( pbh ) + { + + if( strcmp( szFileName, pbh->szFilename ) == 0 && + ( ! bStrictDimension || + ( *piWidth == pbh->iWidth && + *piHeight == pbh->iHeight + ) + ) + ) { - *piWidth = pbh->iWidth; - *piHeight= pbh->iHeight; + if( ! bStrictDimension ) + { + *piWidth = pbh->iWidth; + *piHeight = pbh->iHeight; + } + return pbh->hBitmap; } - return pbh->hBitmap; - } - pbh = pbh->pNext; - } - return NULL; + pbh = pbh->pNext; + } + return NULL; } -void AddBitmapHandle( const char * szFileName, HBITMAP hBitmap, int iWidth, int iHeight) +void AddBitmapHandle( const char * szFileName, HBITMAP hBitmap, int iWidth, int iHeight ) { - BITMAP_HANDLE * pbhNew = (BITMAP_HANDLE *) hb_xgrab( sizeof( BITMAP_HANDLE ) ); - memset( pbhNew, 0, sizeof( BITMAP_HANDLE ) ); + BITMAP_HANDLE * pbhNew = ( BITMAP_HANDLE * ) hb_xgrab( sizeof( BITMAP_HANDLE ) ); - strcpy(pbhNew->szFilename, szFileName); - pbhNew->hBitmap = hBitmap; - pbhNew->iWidth = iWidth; - pbhNew->iHeight = iHeight; - pbhNew->pNext = s_pWvwData->s_sApp->pbhBitmapList; + memset( pbhNew, 0, sizeof( BITMAP_HANDLE ) ); - s_pWvwData->s_sApp->pbhBitmapList = pbhNew; + strcpy( pbhNew->szFilename, szFileName ); + pbhNew->hBitmap = hBitmap; + pbhNew->iWidth = iWidth; + pbhNew->iHeight = iHeight; + pbhNew->pNext = s_pWvwData->s_sApp->pbhBitmapList; + + s_pWvwData->s_sApp->pbhBitmapList = pbhNew; } /* FindPictureHandle and AddPictureHandle are for bitmaps associated with Windows controls such as toolbar, pushbutton, checkbox, etc */ -static IPicture * FindPictureHandle( const char * szFileName, int * piWidth, int * piHeight) +static IPicture * FindPictureHandle( const char * szFileName, int * piWidth, int * piHeight ) { - PICTURE_HANDLE * pph = s_pWvwData->s_sApp->pphPictureList; + PICTURE_HANDLE * pph = s_pWvwData->s_sApp->pphPictureList; - BOOL bStrictDimension = !(*piWidth==0 && *piHeight==0); - while (pph) - { + BOOL bStrictDimension = ! ( *piWidth == 0 && *piHeight == 0 ); - if (strcmp(szFileName, pph->szFilename)==0 && - (!bStrictDimension || - (*piWidth == pph->iWidth && - *piHeight== pph->iHeight - ) - ) - ) - { - if (!bStrictDimension) + while( pph ) + { + + if( strcmp( szFileName, pph->szFilename ) == 0 && + ( ! bStrictDimension || + ( *piWidth == pph->iWidth && + *piHeight == pph->iHeight + ) + ) + ) { - *piWidth = pph->iWidth; - *piHeight= pph->iHeight; + if( ! bStrictDimension ) + { + *piWidth = pph->iWidth; + *piHeight = pph->iHeight; + } + return pph->iPicture; } - return pph->iPicture; - } - pph = pph->pNext; - } - return NULL; + pph = pph->pNext; + } + return NULL; } -static void AddPictureHandle( const char * szFileName, IPicture * iPicture, int iWidth, int iHeight) +static void AddPictureHandle( const char * szFileName, IPicture * iPicture, int iWidth, int iHeight ) { - PICTURE_HANDLE * pphNew = (PICTURE_HANDLE *) hb_xgrab( sizeof( PICTURE_HANDLE ) ); - memset( pphNew, 0 ,sizeof( PICTURE_HANDLE ) ); - strcpy(pphNew->szFilename, szFileName); - pphNew->iPicture = iPicture; - pphNew->iWidth = iWidth; - pphNew->iHeight = iHeight; - pphNew->pNext = s_pWvwData->s_sApp->pphPictureList; + PICTURE_HANDLE * pphNew = ( PICTURE_HANDLE * ) hb_xgrab( sizeof( PICTURE_HANDLE ) ); - s_pWvwData->s_sApp->pphPictureList = pphNew; + memset( pphNew, 0, sizeof( PICTURE_HANDLE ) ); + strcpy( pphNew->szFilename, szFileName ); + pphNew->iPicture = iPicture; + pphNew->iWidth = iWidth; + pphNew->iHeight = iHeight; + pphNew->pNext = s_pWvwData->s_sApp->pphPictureList; + + s_pWvwData->s_sApp->pphPictureList = pphNew; } @@ -9700,106 +9673,107 @@ static void AddPictureHandle( const char * szFileName, IPicture * iPicture, int Windows controls such as toolbar, pushbutton, checkbox, etc IOW, it is for user drawn images (wvw_drawimage) */ -static HBITMAP FindUserBitmapHandle( const char * szFileName, int * piWidth, int * piHeight) +static HBITMAP FindUserBitmapHandle( const char * szFileName, int * piWidth, int * piHeight ) { - BITMAP_HANDLE * pbh = s_pWvwData->s_sApp->pbhUserBitmap; - BOOL bStrictDimension = !(*piWidth==0 && *piHeight==0); + BITMAP_HANDLE * pbh = s_pWvwData->s_sApp->pbhUserBitmap; + BOOL bStrictDimension = ! ( *piWidth == 0 && *piHeight == 0 ); - while (pbh) - { + while( pbh ) + { - if (strcmp(szFileName, pbh->szFilename)==0 && - (!bStrictDimension || - (*piWidth == pbh->iWidth && - *piHeight== pbh->iHeight - ) - ) - ) - { - if (!bStrictDimension) + if( strcmp( szFileName, pbh->szFilename ) == 0 && + ( ! bStrictDimension || + ( *piWidth == pbh->iWidth && + *piHeight == pbh->iHeight + ) + ) + ) { - *piWidth = pbh->iWidth; - *piHeight= pbh->iHeight; + if( ! bStrictDimension ) + { + *piWidth = pbh->iWidth; + *piHeight = pbh->iHeight; + } + + return pbh->hBitmap; + } + pbh = pbh->pNext; + } + + return NULL; +} + +static void AddUserBitmapHandle( const char * szFileName, HBITMAP hBitmap, int iWidth, int iHeight ) +{ + BITMAP_HANDLE * pbhNew = ( BITMAP_HANDLE * ) hb_xgrab( sizeof( BITMAP_HANDLE ) ); + + memset( pbhNew, 0, sizeof( BITMAP_HANDLE ) ); + + strcpy( pbhNew->szFilename, szFileName ); + pbhNew->hBitmap = hBitmap; + pbhNew->iWidth = iWidth; + pbhNew->iHeight = iHeight; + + if( s_pWvwData->s_sApp->uiBMcache >= s_pWvwData->s_sApp->uiMaxBMcache ) + { + BITMAP_HANDLE * pbhTail, * pbhPrev; + + pbhTail = s_pWvwData->s_sApp->pbhUserBitmap; + pbhPrev = NULL; + while( pbhTail && pbhTail->pNext ) + { + pbhPrev = pbhTail; + pbhTail = pbhTail->pNext; } - return pbh->hBitmap; - } - pbh = pbh->pNext; - } + if( pbhTail ) + { + DeleteObject( pbhTail->hBitmap ); + hb_xfree( pbhTail ); + if( pbhPrev ) + { + pbhPrev->pNext = NULL; + } + else + { + s_pWvwData->s_sApp->pbhUserBitmap = NULL; + } + s_pWvwData->s_sApp->uiBMcache--; + } + } - return NULL; -} - -static void AddUserBitmapHandle( const char * szFileName, HBITMAP hBitmap, int iWidth, int iHeight) -{ - BITMAP_HANDLE * pbhNew = (BITMAP_HANDLE *) hb_xgrab( sizeof( BITMAP_HANDLE ) ); - memset( pbhNew, 0, sizeof( BITMAP_HANDLE ) ); - - strcpy(pbhNew->szFilename, szFileName); - pbhNew->hBitmap = hBitmap; - pbhNew->iWidth = iWidth; - pbhNew->iHeight = iHeight; - - if (s_pWvwData->s_sApp->uiBMcache >= s_pWvwData->s_sApp->uiMaxBMcache) - { - BITMAP_HANDLE *pbhTail, *pbhPrev; - - pbhTail = s_pWvwData->s_sApp->pbhUserBitmap; - pbhPrev = NULL; - while (pbhTail && pbhTail->pNext) - { - pbhPrev = pbhTail; - pbhTail = pbhTail->pNext; - } - - if (pbhTail) - { - DeleteObject( pbhTail->hBitmap ) ; - hb_xfree( pbhTail ); - if (pbhPrev) - { - pbhPrev->pNext = NULL; - } - else - { - s_pWvwData->s_sApp->pbhUserBitmap = NULL; - } - s_pWvwData->s_sApp->uiBMcache--; - } - } - - s_pWvwData->s_sApp->uiBMcache++; - pbhNew->pNext = s_pWvwData->s_sApp->pbhUserBitmap; - s_pWvwData->s_sApp->pbhUserBitmap = pbhNew; + s_pWvwData->s_sApp->uiBMcache++; + pbhNew->pNext = s_pWvwData->s_sApp->pbhUserBitmap; + s_pWvwData->s_sApp->pbhUserBitmap = pbhNew; } -static HBITMAP hPrepareBitmap(char * szBitmap, UINT uiBitmap, - int iExpWidth, int iExpHeight, - BOOL bMap3Dcolors, - HWND hCtrl ) +static HBITMAP hPrepareBitmap( char * szBitmap, UINT uiBitmap, + int iExpWidth, int iExpHeight, + BOOL bMap3Dcolors, + HWND hCtrl ) { - HBITMAP hBitmap; + HBITMAP hBitmap; - UINT uiOptions = bMap3Dcolors ? LR_LOADMAP3DCOLORS : LR_DEFAULTCOLOR; - char szResname[_MAX_PATH+1]; + UINT uiOptions = bMap3Dcolors ? LR_LOADMAP3DCOLORS : LR_DEFAULTCOLOR; + char szResname[ _MAX_PATH + 1 ]; - if (szBitmap) + if( szBitmap ) { - hBitmap = FindBitmapHandle(szBitmap, &iExpWidth, &iExpHeight); + hBitmap = FindBitmapHandle( szBitmap, &iExpWidth, &iExpHeight ); - if (!hBitmap) + if( ! hBitmap ) { hBitmap = ( HBITMAP ) LoadImage( s_pWvwData->hInstance, - szBitmap, - IMAGE_BITMAP, - iExpWidth, - iExpHeight, - uiOptions); - if (hBitmap) + szBitmap, + IMAGE_BITMAP, + iExpWidth, + iExpHeight, + uiOptions ); + if( hBitmap ) { - AddBitmapHandle(szBitmap, hBitmap, iExpWidth, iExpHeight); + AddBitmapHandle( szBitmap, hBitmap, iExpWidth, iExpHeight ); return hBitmap; } } @@ -9807,20 +9781,20 @@ static HBITMAP hPrepareBitmap(char * szBitmap, UINT uiBitmap, else { sprintf( szResname, "?%u", uiBitmap ); - hBitmap = FindBitmapHandle(szResname, &iExpWidth, &iExpHeight); + hBitmap = FindBitmapHandle( szResname, &iExpWidth, &iExpHeight ); - if (!hBitmap) + if( ! hBitmap ) { hBitmap = ( HBITMAP ) LoadImage( s_pWvwData->hInstance, - (LPCTSTR) MAKEINTRESOURCE( (WORD) uiBitmap ), - IMAGE_BITMAP, - iExpWidth, - iExpHeight, - uiOptions); + ( LPCTSTR ) MAKEINTRESOURCE( ( WORD ) uiBitmap ), + IMAGE_BITMAP, + iExpWidth, + iExpHeight, + uiOptions ); - if (hBitmap) + if( hBitmap ) { - AddBitmapHandle(szResname, hBitmap, iExpWidth, iExpHeight); + AddBitmapHandle( szResname, hBitmap, iExpWidth, iExpHeight ); return hBitmap; } else @@ -9830,132 +9804,132 @@ static HBITMAP hPrepareBitmap(char * szBitmap, UINT uiBitmap, } } - if ((!hBitmap) && (szBitmap)) + if( ( ! hBitmap ) && ( szBitmap ) ) { /* loading from file */ int iWidth, iHeight; - hBitmap = FindBitmapHandle(szBitmap, &iExpWidth, &iExpHeight); + hBitmap = FindBitmapHandle( szBitmap, &iExpWidth, &iExpHeight ); - if (!hBitmap) + if( ! hBitmap ) { - BITMAPINFO * pPackedDib = NULL; - HDC hdc; + BITMAPINFO * pPackedDib = NULL; + HDC hdc; - if (!bMap3Dcolors) + if( ! bMap3Dcolors ) { - pPackedDib = PackedDibLoad (szBitmap) ; + pPackedDib = PackedDibLoad( szBitmap ); } - if (pPackedDib || bMap3Dcolors) + if( pPackedDib || bMap3Dcolors ) { - hdc = GetDC (hCtrl) ; + hdc = GetDC( hCtrl ); - if (!bMap3Dcolors) - { + if( ! bMap3Dcolors ) + { - hBitmap = CreateDIBitmap (hdc, - (PBITMAPINFOHEADER) pPackedDib, - CBM_INIT, - PackedDibGetBitsPtr (pPackedDib), - pPackedDib, - DIB_RGB_COLORS) ; + hBitmap = CreateDIBitmap( hdc, + ( PBITMAPINFOHEADER ) pPackedDib, + CBM_INIT, + PackedDibGetBitsPtr( pPackedDib ), + pPackedDib, + DIB_RGB_COLORS ); - if (hBitmap==NULL) - { - return NULL; - } + if( hBitmap == NULL ) + { + return NULL; + } - iWidth = PackedDibGetWidth(pPackedDib); - iHeight = PackedDibGetHeight(pPackedDib); - } - else - { + iWidth = PackedDibGetWidth( pPackedDib ); + iHeight = PackedDibGetHeight( pPackedDib ); + } + else + { - hBitmap = ( HBITMAP ) LoadImage( ( HINSTANCE ) NULL, - szBitmap, - IMAGE_BITMAP, - iExpWidth, - iExpHeight, + hBitmap = ( HBITMAP ) LoadImage( ( HINSTANCE ) NULL, + szBitmap, + IMAGE_BITMAP, + iExpWidth, + iExpHeight, - LR_LOADFROMFILE | LR_LOADMAP3DCOLORS); + LR_LOADFROMFILE | LR_LOADMAP3DCOLORS ); - if (hBitmap==NULL) - { - return NULL; - } + if( hBitmap == NULL ) + { + return NULL; + } - iWidth = iExpWidth; - iHeight= iExpHeight; - } + iWidth = iExpWidth; + iHeight = iExpHeight; + } - if (iExpWidth==0 && iExpHeight==0) - { - iWidth = iExpWidth; - iHeight= iExpHeight; - } + if( iExpWidth == 0 && iExpHeight == 0 ) + { + iWidth = iExpWidth; + iHeight = iExpHeight; + } - if (iExpWidth!=iWidth || iExpHeight!=iHeight) - { + if( iExpWidth != iWidth || iExpHeight != iHeight ) + { - HDC hdcSource, hdcTarget; - HBITMAP hBitmap2; - BOOL bResult; + HDC hdcSource, hdcTarget; + HBITMAP hBitmap2; + BOOL bResult; - hdcSource = CreateCompatibleDC(hdc); - SelectObject(hdcSource, hBitmap); + hdcSource = CreateCompatibleDC( hdc ); + SelectObject( hdcSource, hBitmap ); - hdcTarget = CreateCompatibleDC(hdc); - hBitmap2 = CreateCompatibleBitmap(hdcSource, iExpWidth, iExpHeight); - SelectObject(hdcTarget, hBitmap2); + hdcTarget = CreateCompatibleDC( hdc ); + hBitmap2 = CreateCompatibleBitmap( hdcSource, iExpWidth, iExpHeight ); + SelectObject( hdcTarget, hBitmap2 ); - bResult = StretchBlt( - hdcTarget, /* handle to destination DC */ - 0, /* x-coord of destination upper-left corner */ - 0, /* y-coord of destination upper-left corner */ - iExpWidth, /* width of destination rectangle */ - iExpHeight, /* height of destination rectangle */ - hdcSource, /* handle to source DC */ - 0, /* x-coord of source upper-left corner */ - 0, /* y-coord of source upper-left corner */ - iWidth, /* width of source rectangle */ - iHeight, /* height of source rectangle */ - SRCCOPY /* raster operation code */ - ); + bResult = StretchBlt( + hdcTarget, /* handle to destination DC */ + 0, /* x-coord of destination upper-left corner */ + 0, /* y-coord of destination upper-left corner */ + iExpWidth, /* width of destination rectangle */ + iExpHeight, /* height of destination rectangle */ + hdcSource, /* handle to source DC */ + 0, /* x-coord of source upper-left corner */ + 0, /* y-coord of source upper-left corner */ + iWidth, /* width of source rectangle */ + iHeight, /* height of source rectangle */ + SRCCOPY /* raster operation code */ + ); - if (!bResult) - { + if( ! bResult ) + { MessageBox( NULL, TEXT( "Cannot shrink/stretch bitmap for WVW Control" ), s_pWvwData->szAppName, MB_ICONERROR ); - DeleteObject(hBitmap2); - } - else - { + DeleteObject( hBitmap2 ); + } + else + { - DeleteObject(hBitmap); - hBitmap = hBitmap2; - iWidth = iExpWidth; - iHeight = iExpHeight; - } + DeleteObject( hBitmap ); + hBitmap = hBitmap2; + iWidth = iExpWidth; + iHeight = iExpHeight; + } - DeleteDC(hdcSource); - DeleteDC(hdcTarget); + DeleteDC( hdcSource ); + DeleteDC( hdcTarget ); - } + } - ReleaseDC (hCtrl, hdc) ; + ReleaseDC( hCtrl, hdc ); - AddBitmapHandle(szBitmap, hBitmap, iWidth, iHeight); + AddBitmapHandle( szBitmap, hBitmap, iWidth, iHeight ); - if (pPackedDib) - { + if( pPackedDib ) + { - hb_xfree (pPackedDib) ; - } + hb_xfree( pPackedDib ); + } } else { @@ -9969,232 +9943,230 @@ static HBITMAP hPrepareBitmap(char * szBitmap, UINT uiBitmap, /* add one button to existing Toolbar */ /* - uiBitmap is resource id -*/ + uiBitmap is resource id + */ -BOOL AddTBButton(HWND hWndToolbar, char * szBitmap, UINT uiBitmap, char * pszLabel, int iCommand, int iBitmapType, BOOL bMap3Dcolors, WIN_DATA * pWindowData, BOOL bDropdown) +BOOL AddTBButton( HWND hWndToolbar, char * szBitmap, UINT uiBitmap, char * pszLabel, int iCommand, int iBitmapType, BOOL bMap3Dcolors, WIN_DATA * pWindowData, BOOL bDropdown ) { - TBBUTTON tbb; + TBBUTTON tbb; TBADDBITMAP tbab; - char szBuffer[WVW_TB_LABELMAXLENGTH+2]; - int iNewBitmap, iNewString; - int iOffset; - BOOL bSuccess; - HBITMAP hBitmap; + char szBuffer[ WVW_TB_LABELMAXLENGTH + 2 ]; + int iNewBitmap, iNewString; + int iOffset; + BOOL bSuccess; + HBITMAP hBitmap; - if (iCommand == 0) + if( iCommand == 0 ) { - tbb.iBitmap = 0; - tbb.idCommand = 0; - tbb.fsState = TBSTATE_ENABLED; - tbb.fsStyle = TBSTYLE_SEP; - tbb.dwData = 0; - tbb.iString = 0; + tbb.iBitmap = 0; + tbb.idCommand = 0; + tbb.fsState = TBSTATE_ENABLED; + tbb.fsStyle = TBSTYLE_SEP; + tbb.dwData = 0; + tbb.iString = 0; - bSuccess = (BOOL)SendMessage(hWndToolbar, TB_ADDBUTTONS, (WPARAM) 1, (LPARAM) (LPTBBUTTON) &tbb); - return( bSuccess ); + bSuccess = ( BOOL ) SendMessage( hWndToolbar, TB_ADDBUTTONS, ( WPARAM ) 1, ( LPARAM ) ( LPTBBUTTON ) &tbb ); + return bSuccess; } - switch (iBitmapType) + switch( iBitmapType ) { case 0: - iOffset = 0; - break; + iOffset = 0; + break; case 1: - iOffset = pWindowData->iStartStdBitmap; - break; + iOffset = pWindowData->iStartStdBitmap; + break; case 2: - iOffset = pWindowData->iStartViewBitmap; - break; + iOffset = pWindowData->iStartViewBitmap; + break; case 3: - iOffset = pWindowData->iStartHistBitmap; - break; + iOffset = pWindowData->iStartHistBitmap; + break; default: - iOffset = 0; - break; + iOffset = 0; + break; } - if (iBitmapType==0) + if( iBitmapType == 0 ) { int iExpWidth, iExpHeight; - iExpWidth = pWindowData->iTBImgWidth; - iExpHeight = pWindowData->iTBImgHeight; + iExpWidth = pWindowData->iTBImgWidth; + iExpHeight = pWindowData->iTBImgHeight; - hBitmap = hPrepareBitmap(szBitmap, uiBitmap, - iExpWidth, iExpHeight, - bMap3Dcolors, - hWndToolbar ); + hBitmap = hPrepareBitmap( szBitmap, uiBitmap, + iExpWidth, iExpHeight, + bMap3Dcolors, + hWndToolbar ); - if (!hBitmap) + if( ! hBitmap ) { return FALSE; } - tbab.hInst = NULL; - tbab.nID = (UINT_PTR) hBitmap; - iNewBitmap = SendMessage(hWndToolbar, TB_ADDBITMAP, (WPARAM) 1, (WPARAM) &tbab); + tbab.hInst = NULL; + tbab.nID = ( UINT_PTR ) hBitmap; + iNewBitmap = SendMessage( hWndToolbar, TB_ADDBITMAP, ( WPARAM ) 1, ( WPARAM ) &tbab ); } else /* system bitmap */ { - iNewBitmap = (int) uiBitmap + iOffset; + iNewBitmap = ( int ) uiBitmap + iOffset; } - szBuffer[0] = (char) 0; - strcat(szBuffer, pszLabel); - szBuffer[strlen(szBuffer)+1] = (char) 0; - iNewString = SendMessage(hWndToolbar, TB_ADDSTRING,(WPARAM) 0, (LPARAM) szBuffer); + szBuffer[ 0 ] = ( char ) 0; + strcat( szBuffer, pszLabel ); + szBuffer[ strlen( szBuffer ) + 1 ] = ( char ) 0; + iNewString = SendMessage( hWndToolbar, TB_ADDSTRING, ( WPARAM ) 0, ( LPARAM ) szBuffer ); - tbb.iBitmap = iNewBitmap; - tbb.idCommand = iCommand; - tbb.fsState = TBSTATE_ENABLED; - tbb.fsStyle = TBSTYLE_BUTTON; - if ( bDropdown ) + tbb.iBitmap = iNewBitmap; + tbb.idCommand = iCommand; + tbb.fsState = TBSTATE_ENABLED; + tbb.fsStyle = TBSTYLE_BUTTON; + if( bDropdown ) { tbb.fsStyle = tbb.fsStyle | 0x0080 /*BTNS_WHOLEDROPDOWN*/; } - tbb.dwData = 0; + tbb.dwData = 0; tbb.iString = iNewString; - bSuccess = SendMessage(hWndToolbar, TB_ADDBUTTONS, (WPARAM) 1, (LPARAM) (LPTBBUTTON) &tbb); + bSuccess = SendMessage( hWndToolbar, TB_ADDBUTTONS, ( WPARAM ) 1, ( LPARAM ) ( LPTBBUTTON ) &tbb ); - return (bSuccess); + return bSuccess; } -int IndexToCommand(HWND hWndTB, int iIndex) +int IndexToCommand( HWND hWndTB, int iIndex ) { TBBUTTON tbb; - if (SendMessage(hWndTB, TB_GETBUTTON,(WPARAM) iIndex, (LPARAM) (LPTBBUTTON) &tbb) ) + if( SendMessage( hWndTB, TB_GETBUTTON, ( WPARAM ) iIndex, ( LPARAM ) ( LPTBBUTTON ) &tbb ) ) { - return(tbb.idCommand); + return tbb.idCommand; } else { - return(0); + return 0; } } -int CommandToIndex(HWND hWndTB, int iCommand) +int CommandToIndex( HWND hWndTB, int iCommand ) { - return ( SendMessage(hWndTB, TB_COMMANDTOINDEX,(WPARAM) iCommand, (LPARAM) 0) ); + return SendMessage( hWndTB, TB_COMMANDTOINDEX, ( WPARAM ) iCommand, ( LPARAM ) 0 ); } void hb_gt_wvwTBinitSize( WIN_DATA * pWindowData, HWND hWndTB ) { RECT rTB = { 0 }; - SendMessage(hWndTB, TB_AUTOSIZE,(WPARAM) 0, (LPARAM) 0); + SendMessage( hWndTB, TB_AUTOSIZE, ( WPARAM ) 0, ( LPARAM ) 0 ); - if (GetClientRect(hWndTB, &rTB)) + if( GetClientRect( hWndTB, &rTB ) ) { - USHORT usTBHeight = (USHORT) rTB.bottom; + USHORT usTBHeight = ( USHORT ) rTB.bottom; - pWindowData->usTBHeight = usTBHeight + 2; + pWindowData->usTBHeight = usTBHeight + 2; } } LRESULT CALLBACK hb_gt_wvwTBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - HWND hWndParent = GetParent(hWnd); - UINT usWinNum; - WIN_DATA * pWindowData; + HWND hWndParent = GetParent( hWnd ); + UINT usWinNum; + WIN_DATA * pWindowData; - if (hWndParent==NULL) - { - /* TODO: runtime/internal error is better */ - MessageBox( NULL, TEXT( "hb_gt_wvwTBProc(): parent of toolbar is missing" ), - s_pWvwData->szAppName, MB_ICONERROR ); + if( hWndParent == NULL ) + { + /* TODO: runtime/internal error is better */ + MessageBox( NULL, TEXT( "hb_gt_wvwTBProc(): parent of toolbar is missing" ), + s_pWvwData->szAppName, MB_ICONERROR ); - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } + return DefWindowProc( hWnd, message, wParam, lParam ); + } - for(usWinNum=0; usWinNums_usNumWindows; usWinNum++) - { - if (s_pWvwData->s_pWindows[usWinNum]->hWnd == hWndParent) - { - break; - } - } - if(usWinNum>=s_pWvwData->s_usNumWindows) - { - /* TODO: runtime/internal error is better */ - MessageBox( NULL, TEXT( "hb_gt_wvwTBProc(): invalid handle of tollbar's parent" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - pWindowData = s_pWvwData->s_pWindows[usWinNum]; - - switch ( message ) - { - case WM_RBUTTONDOWN: - case WM_LBUTTONDOWN: - case WM_RBUTTONUP: - case WM_LBUTTONUP: - case WM_RBUTTONDBLCLK: - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MBUTTONDBLCLK: - case WM_MOUSEMOVE: - case WM_MOUSEWHEEL: - case WM_NCMOUSEMOVE: - { - - if ( !hb_gt_wvwAcceptingInput() || ( usWinNum != s_pWvwData->s_usNumWindows-1 ) ) + for( usWinNum = 0; usWinNum < s_pWvwData->s_usNumWindows; usWinNum++ ) + { + if( s_pWvwData->s_pWindows[ usWinNum ]->hWnd == hWndParent ) { - - return(0); + break; } + } + if( usWinNum >= s_pWvwData->s_usNumWindows ) + { + /* TODO: runtime/internal error is better */ + MessageBox( NULL, TEXT( "hb_gt_wvwTBProc(): invalid handle of tollbar's parent" ), + s_pWvwData->szAppName, MB_ICONERROR ); - hb_gt_wvwTBMouseEvent( pWindowData, hWnd, message, wParam, lParam ); + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + + switch( message ) + { + case WM_RBUTTONDOWN: + case WM_LBUTTONDOWN: + case WM_RBUTTONUP: + case WM_LBUTTONUP: + case WM_RBUTTONDBLCLK: + case WM_LBUTTONDBLCLK: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + case WM_MBUTTONDBLCLK: + case WM_MOUSEMOVE: + case WM_MOUSEWHEEL: + case WM_NCMOUSEMOVE: + + if( ! hb_gt_wvwAcceptingInput() || ( usWinNum != s_pWvwData->s_usNumWindows - 1 ) ) + { + + return 0; + } + + hb_gt_wvwTBMouseEvent( pWindowData, hWnd, message, wParam, lParam ); //return( 0 ); //TB_ISBUTTONHIGHLIGHTED - } - case WM_PAINT: - { + case WM_PAINT: + { - HGDIOBJ hOldObj; - HDC hdc; - RECT rTB = { 0 }; - int iTop, iRight; + HGDIOBJ hOldObj; + HDC hdc; + RECT rTB = { 0 }; + int iTop, iRight; - CallWindowProc( (WNDPROC) pWindowData->tbOldProc, hWnd, message, wParam, lParam ); + CallWindowProc( ( WNDPROC ) pWindowData->tbOldProc, hWnd, message, wParam, lParam ); - GetClientRect(hWnd, &rTB); - iTop = rTB.bottom - 3; - iRight = rTB.right; + GetClientRect( hWnd, &rTB ); + iTop = rTB.bottom - 3; + iRight = rTB.right; - hdc = GetDC(hWnd); + hdc = GetDC( hWnd ); - hOldObj = SelectObject( hdc, s_pWvwData->s_sApp->penWhite ); + hOldObj = SelectObject( hdc, s_pWvwData->s_sApp->penWhite ); - MoveToEx( hdc, 0, iTop, NULL ); /* Top */ - LineTo( hdc, iRight, iTop ); + MoveToEx( hdc, 0, iTop, NULL ); /* Top */ + LineTo( hdc, iRight, iTop ); - SelectObject( hdc, s_pWvwData->s_sApp->penBlack ); + SelectObject( hdc, s_pWvwData->s_sApp->penBlack ); - MoveToEx( hdc, 0, iTop+2, NULL ); /* Bottom */ - LineTo( hdc, iRight, iTop+2 ); + MoveToEx( hdc, 0, iTop + 2, NULL ); /* Bottom */ + LineTo( hdc, iRight, iTop + 2 ); - SelectObject( hdc, s_pWvwData->s_sApp->penDarkGray ); - MoveToEx( hdc, 0, iTop+1, NULL ); /* Middle */ - LineTo( hdc, iRight, iTop+1 ); + SelectObject( hdc, s_pWvwData->s_sApp->penDarkGray ); + MoveToEx( hdc, 0, iTop + 1, NULL ); /* Middle */ + LineTo( hdc, iRight, iTop + 1 ); - SelectObject( pWindowData->hdc, hOldObj ); - ReleaseDC(hWnd, hdc); + SelectObject( pWindowData->hdc, hOldObj ); + ReleaseDC( hWnd, hdc ); - return 0; - } + return 0; + } - } + } - return( CallWindowProc( (WNDPROC) pWindowData->tbOldProc, hWnd, message, wParam, lParam ) ); + return CallWindowProc( ( WNDPROC ) pWindowData->tbOldProc, hWnd, message, wParam, lParam ); } @@ -10209,397 +10181,394 @@ LRESULT CALLBACK hb_gt_wvwTBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM /*********************** start control (eg. scrollbar) list handler ***************************/ -HWND FindControlHandle(UINT usWinNum, BYTE byCtrlClass, UINT uiCtrlid, byte * pbStyle) +HWND FindControlHandle( UINT usWinNum, BYTE byCtrlClass, UINT uiCtrlid, byte * pbStyle ) { - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) - { - if (byCtrlClass == pcd->byCtrlClass && uiCtrlid == pcd->uiCtrlid) - { - *pbStyle = pcd->bStyle; - return pcd->hWndCtrl; - } - pcd = pcd->pNext; - } - return NULL; -} + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; -UINT FindControlId(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, byte * pbStyle) -{ - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) - { - if (byCtrlClass == pcd->byCtrlClass && hWndCtrl == pcd->hWndCtrl) - { - *pbStyle = pcd->bStyle; - return pcd->uiCtrlid; - } - pcd = pcd->pNext; - } - return (UINT) NULL; -} - -UINT LastControlId(UINT usWinNum, BYTE byCtrlClass) -{ - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - - while (pcd && byCtrlClass != pcd->byCtrlClass) - { - pcd = pcd->pNext; - } - - if (pcd) - { - return pcd->uiCtrlid; - } - else - { - return 0; - } -} - -void AddControlHandle(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT uiCtrlid, PHB_ITEM phiCodeBlock, RECT rCtrl, RECT rOffCtrl, byte bStyle) -{ - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcdNew = (CONTROL_DATA *) hb_xgrab( sizeof( CONTROL_DATA ) ); - memset( pcdNew, 0, sizeof( CONTROL_DATA ) ); - - pcdNew->byCtrlClass = byCtrlClass; - pcdNew->hWndCtrl = hWndCtrl; - pcdNew->uiCtrlid = uiCtrlid; - - pcdNew->phiCodeBlock = NULL; - - if (phiCodeBlock != NULL) - { - pcdNew->phiCodeBlock = hb_itemNew( phiCodeBlock ); - - } - - pcdNew->bBusy = FALSE; - pcdNew->uiBusy = 0; - - pcdNew->rCtrl.top = rCtrl.top; - pcdNew->rCtrl.left = rCtrl.left; - pcdNew->rCtrl.bottom = rCtrl.bottom; - pcdNew->rCtrl.right = rCtrl.right; - pcdNew->rOffCtrl.top = rOffCtrl.top; - pcdNew->rOffCtrl.left = rOffCtrl.left; - pcdNew->rOffCtrl.bottom = rOffCtrl.bottom; - pcdNew->rOffCtrl.right = rOffCtrl.right; - - pcdNew->bStyle = bStyle; - - pcdNew->OldProc = (WNDPROC) NULL; - - pcdNew->pNext = pWindowData->pcdCtrlList; - - pWindowData->pcdCtrlList = pcdNew; -} - -CONTROL_DATA * GetControlData(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT uiCtrlid) -{ - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) - { - if (byCtrlClass == pcd->byCtrlClass && - ((hWndCtrl && hWndCtrl == pcd->hWndCtrl) || - (uiCtrlid && uiCtrlid == pcd->uiCtrlid)) ) - { - return pcd; - } - pcd = pcd->pNext; - } - return NULL; -} - -BOOL StoreControlProc(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, WNDPROC OldProc) -{ - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) - { - if (byCtrlClass == pcd->byCtrlClass && hWndCtrl == pcd->hWndCtrl) - { - pcd->OldProc = OldProc; - return TRUE; - } - pcd = pcd->pNext; - } - return FALSE; -} - -WNDPROC GetControlProc(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl) -{ - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) - { - if (byCtrlClass == pcd->byCtrlClass && hWndCtrl == pcd->hWndCtrl) - { - return pcd->OldProc; - } - pcd = pcd->pNext; - } - return (WNDPROC) NULL; -} - -static int GetControlClass(UINT usWinNum, HWND hWndCtrl) -{ - - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) - { - if (hWndCtrl == pcd->hWndCtrl) - { - return pcd->byCtrlClass; - } - pcd = pcd->pNext; - } - return 0; -} - -static void RunControlBlock(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT message, WPARAM wParam, LPARAM lParam, int iEventType ) -{ - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd && (byCtrlClass != pcd->byCtrlClass || hWndCtrl != pcd->hWndCtrl)) - { - pcd = pcd->pNext; - } - - if (pcd==NULL) - { - return; - } - - if ( (pcd->byCtrlClass==WVW_CONTROL_SCROLLBAR || - pcd->byCtrlClass==WVW_CONTROL_PUSHBUTTON || - pcd->byCtrlClass==WVW_CONTROL_COMBOBOX || - pcd->byCtrlClass==WVW_CONTROL_EDITBOX - ) - && pcd->phiCodeBlock ) - - { - PHB_ITEM phiWinNum, phiXBid, phiXBmsg, phiXBpos; - PHB_ITEM pReturn; - - if (pcd->bBusy) - { - - if (!s_pWvwData->s_bRecurseCBlock) - { - return; - } - } - - pcd->bBusy = TRUE; - pcd->uiBusy++; - - phiWinNum = hb_itemNew(NULL); - hb_itemPutNI( phiWinNum, (int) usWinNum ); - - phiXBid = hb_itemNew(NULL); - hb_itemPutNI( phiXBid, (int) pcd->uiCtrlid ); - - if (pcd->byCtrlClass==WVW_CONTROL_SCROLLBAR) - { - phiXBmsg = hb_itemNew(NULL); - hb_itemPutNI( phiXBmsg, (int) LOWORD(wParam) ); - - phiXBpos = hb_itemNew(NULL); - hb_itemPutNI( phiXBpos, (int) HIWORD(wParam) ); - - pReturn = hb_itemDo( pcd->phiCodeBlock, 4, phiWinNum, phiXBid, phiXBmsg, phiXBpos ); - hb_itemRelease( pReturn ); - hb_itemRelease( phiXBmsg ); - hb_itemRelease( phiXBpos ); - } - else if (pcd->byCtrlClass==WVW_CONTROL_PUSHBUTTON) - { - - pReturn = hb_itemDo( pcd->phiCodeBlock, 2, phiWinNum, phiXBid ); - hb_itemRelease( pReturn ); - } - - else if (pcd->byCtrlClass==WVW_CONTROL_COMBOBOX) - { - int iCurSel; - - PHB_ITEM phiEvent, phiIndex; - - switch (iEventType) - { - case CBN_SELCHANGE: - case CBN_SETFOCUS: - case CBN_KILLFOCUS: - { - iCurSel = SendMessage((HWND) pcd->hWndCtrl, - CB_GETCURSEL, - (WPARAM) 0, - (LPARAM) 0 - ); - if (iCurSel == CB_ERR) - { - break; - } - - /*********************** - let user find by his own, what is the string of iCurSel - we don;t have to do this: - - iTextLen = SendMessage((HWND) pcd->hWndCtrl, - CB_GETLBTEXTLEN, - (WPARAM) iCurSel; - (LPARAM) 0 - ); - lptstrSelected = ( char* ) hb_xgrab( iTextLen+1 ); - - SendMessage((HWND) pcd->hWndCtrl, - CB_GETLBTEXT, - (WPARAM) iCurSel, - (LPARAM) lptstrSelected - ); - - ... - - hb_xfree( lptstrSelected ); - - **************************/ - - /* now execute the codeblock */ - phiEvent = hb_itemNew(NULL); - hb_itemPutNI( phiEvent, iEventType ); - - phiIndex = hb_itemNew(NULL); - hb_itemPutNI( phiIndex, (int) iCurSel ); - - pReturn = hb_itemDo( pcd->phiCodeBlock, 4, phiWinNum, phiXBid, phiEvent, phiIndex ); - hb_itemRelease( pReturn ); - hb_itemRelease( phiEvent ); - hb_itemRelease( phiIndex ); - - } - } - } - else if (pcd->byCtrlClass==WVW_CONTROL_EDITBOX) - { - PHB_ITEM phiEvent; - - switch (iEventType) - { - case EN_SETFOCUS: - case EN_KILLFOCUS: - case EN_CHANGE: - { - - /* now execute the codeblock */ - phiEvent = hb_itemNew(NULL); - - hb_itemPutNI( phiEvent, (int) iEventType ); - - pReturn = hb_itemDo( pcd->phiCodeBlock, 3, phiWinNum, phiXBid, phiEvent); - hb_itemRelease( pReturn ); - hb_itemRelease( phiEvent ); - - break; - } - - } - } - - hb_itemRelease( phiWinNum ); - hb_itemRelease( phiXBid ); - - pcd->uiBusy--; - - if (pcd->uiBusy == 0) - { - pcd->bBusy = FALSE; - } - } - - HB_SYMBOL_UNUSED( message ); - HB_SYMBOL_UNUSED( lParam ); - - return; -} - -static void ReposControls(UINT usWinNum, BYTE byCtrlClass) -{ - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - - while (pcd) + while( pcd ) { - if (byCtrlClass==0 || byCtrlClass==pcd->byCtrlClass) + if( byCtrlClass == pcd->byCtrlClass && uiCtrlid == pcd->uiCtrlid ) + { + *pbStyle = pcd->bStyle; + return pcd->hWndCtrl; + } + pcd = pcd->pNext; + } + return NULL; +} + +UINT FindControlId( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, byte * pbStyle ) +{ + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + + while( pcd ) + { + if( byCtrlClass == pcd->byCtrlClass && hWndCtrl == pcd->hWndCtrl ) + { + *pbStyle = pcd->bStyle; + return pcd->uiCtrlid; + } + pcd = pcd->pNext; + } + return ( UINT ) NULL; +} + +UINT LastControlId( UINT usWinNum, BYTE byCtrlClass ) +{ + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + + while( pcd && byCtrlClass != pcd->byCtrlClass ) + { + pcd = pcd->pNext; + } + + if( pcd ) + { + return pcd->uiCtrlid; + } + else + { + return 0; + } +} + +void AddControlHandle( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT uiCtrlid, PHB_ITEM phiCodeBlock, RECT rCtrl, RECT rOffCtrl, byte bStyle ) +{ + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcdNew = ( CONTROL_DATA * ) hb_xgrab( sizeof( CONTROL_DATA ) ); + + memset( pcdNew, 0, sizeof( CONTROL_DATA ) ); + + pcdNew->byCtrlClass = byCtrlClass; + pcdNew->hWndCtrl = hWndCtrl; + pcdNew->uiCtrlid = uiCtrlid; + + pcdNew->phiCodeBlock = NULL; + + if( phiCodeBlock != NULL ) + { + pcdNew->phiCodeBlock = hb_itemNew( phiCodeBlock ); + + } + + pcdNew->bBusy = FALSE; + pcdNew->uiBusy = 0; + + pcdNew->rCtrl.top = rCtrl.top; + pcdNew->rCtrl.left = rCtrl.left; + pcdNew->rCtrl.bottom = rCtrl.bottom; + pcdNew->rCtrl.right = rCtrl.right; + pcdNew->rOffCtrl.top = rOffCtrl.top; + pcdNew->rOffCtrl.left = rOffCtrl.left; + pcdNew->rOffCtrl.bottom = rOffCtrl.bottom; + pcdNew->rOffCtrl.right = rOffCtrl.right; + + pcdNew->bStyle = bStyle; + + pcdNew->OldProc = ( WNDPROC ) NULL; + + pcdNew->pNext = pWindowData->pcdCtrlList; + + pWindowData->pcdCtrlList = pcdNew; +} + +CONTROL_DATA * GetControlData( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT uiCtrlid ) +{ + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + + while( pcd ) + { + if( byCtrlClass == pcd->byCtrlClass && + ( ( hWndCtrl && hWndCtrl == pcd->hWndCtrl ) || + ( uiCtrlid && uiCtrlid == pcd->uiCtrlid ) ) ) + { + return pcd; + } + pcd = pcd->pNext; + } + return NULL; +} + +BOOL StoreControlProc( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, WNDPROC OldProc ) +{ + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + + while( pcd ) + { + if( byCtrlClass == pcd->byCtrlClass && hWndCtrl == pcd->hWndCtrl ) + { + pcd->OldProc = OldProc; + return TRUE; + } + pcd = pcd->pNext; + } + return FALSE; +} + +WNDPROC GetControlProc( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl ) +{ + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + + while( pcd ) + { + if( byCtrlClass == pcd->byCtrlClass && hWndCtrl == pcd->hWndCtrl ) + { + return pcd->OldProc; + } + pcd = pcd->pNext; + } + return ( WNDPROC ) NULL; +} + +static int GetControlClass( UINT usWinNum, HWND hWndCtrl ) +{ + + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + + while( pcd ) + { + if( hWndCtrl == pcd->hWndCtrl ) + { + return pcd->byCtrlClass; + } + pcd = pcd->pNext; + } + return 0; +} + +static void RunControlBlock( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT message, WPARAM wParam, LPARAM lParam, int iEventType ) +{ + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + + while( pcd && ( byCtrlClass != pcd->byCtrlClass || hWndCtrl != pcd->hWndCtrl ) ) + { + pcd = pcd->pNext; + } + + if( pcd == NULL ) + { + return; + } + + if( ( pcd->byCtrlClass == WVW_CONTROL_SCROLLBAR || + pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON || + pcd->byCtrlClass == WVW_CONTROL_COMBOBOX || + pcd->byCtrlClass == WVW_CONTROL_EDITBOX + ) + && pcd->phiCodeBlock ) + { + PHB_ITEM phiWinNum, phiXBid, phiXBmsg, phiXBpos; + PHB_ITEM pReturn; + + if( pcd->bBusy ) + { + + if( ! s_pWvwData->s_bRecurseCBlock ) + { + return; + } + } + + pcd->bBusy = TRUE; + pcd->uiBusy++; + + phiWinNum = hb_itemNew( NULL ); + hb_itemPutNI( phiWinNum, ( int ) usWinNum ); + + phiXBid = hb_itemNew( NULL ); + hb_itemPutNI( phiXBid, ( int ) pcd->uiCtrlid ); + + if( pcd->byCtrlClass == WVW_CONTROL_SCROLLBAR ) + { + phiXBmsg = hb_itemNew( NULL ); + hb_itemPutNI( phiXBmsg, ( int ) LOWORD( wParam ) ); + + phiXBpos = hb_itemNew( NULL ); + hb_itemPutNI( phiXBpos, ( int ) HIWORD( wParam ) ); + + pReturn = hb_itemDo( pcd->phiCodeBlock, 4, phiWinNum, phiXBid, phiXBmsg, phiXBpos ); + hb_itemRelease( pReturn ); + hb_itemRelease( phiXBmsg ); + hb_itemRelease( phiXBpos ); + } + else if( pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON ) + { + + pReturn = hb_itemDo( pcd->phiCodeBlock, 2, phiWinNum, phiXBid ); + hb_itemRelease( pReturn ); + } + else if( pcd->byCtrlClass == WVW_CONTROL_COMBOBOX ) + { + int iCurSel; + + PHB_ITEM phiEvent, phiIndex; + + switch( iEventType ) + { + case CBN_SELCHANGE: + case CBN_SETFOCUS: + case CBN_KILLFOCUS: + iCurSel = SendMessage( ( HWND ) pcd->hWndCtrl, + CB_GETCURSEL, + ( WPARAM ) 0, + ( LPARAM ) 0 + ); + if( iCurSel == CB_ERR ) + { + break; + } + + /*********************** + let user find by his own, what is the string of iCurSel + we don;t have to do this: + + iTextLen = SendMessage((HWND) pcd->hWndCtrl, + CB_GETLBTEXTLEN, + (WPARAM) iCurSel; + (LPARAM) 0 + ); + lptstrSelected = ( char* ) hb_xgrab( iTextLen+1 ); + + SendMessage((HWND) pcd->hWndCtrl, + CB_GETLBTEXT, + (WPARAM) iCurSel, + (LPARAM) lptstrSelected + ); + + ... + + hb_xfree( lptstrSelected ); + + **************************/ + + /* now execute the codeblock */ + phiEvent = hb_itemNew( NULL ); + hb_itemPutNI( phiEvent, iEventType ); + + phiIndex = hb_itemNew( NULL ); + hb_itemPutNI( phiIndex, ( int ) iCurSel ); + + pReturn = hb_itemDo( pcd->phiCodeBlock, 4, phiWinNum, phiXBid, phiEvent, phiIndex ); + hb_itemRelease( pReturn ); + hb_itemRelease( phiEvent ); + hb_itemRelease( phiIndex ); + + } + } + else if( pcd->byCtrlClass == WVW_CONTROL_EDITBOX ) + { + PHB_ITEM phiEvent; + + switch( iEventType ) + { + case EN_SETFOCUS: + case EN_KILLFOCUS: + case EN_CHANGE: + + /* now execute the codeblock */ + phiEvent = hb_itemNew( NULL ); + + hb_itemPutNI( phiEvent, ( int ) iEventType ); + + pReturn = hb_itemDo( pcd->phiCodeBlock, 3, phiWinNum, phiXBid, phiEvent ); + hb_itemRelease( pReturn ); + hb_itemRelease( phiEvent ); + + break; + + } + } + + hb_itemRelease( phiWinNum ); + hb_itemRelease( phiXBid ); + + pcd->uiBusy--; + + if( pcd->uiBusy == 0 ) + { + pcd->bBusy = FALSE; + } + } + + HB_SYMBOL_UNUSED( message ); + HB_SYMBOL_UNUSED( lParam ); + +} + +static void ReposControls( UINT usWinNum, BYTE byCtrlClass ) +{ + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + + while( pcd ) + { + if( byCtrlClass == 0 || byCtrlClass == pcd->byCtrlClass ) { POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; + int iTop, iLeft, iBottom, iRight; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, (USHORT) pcd->rCtrl.left, (USHORT) pcd->rCtrl.top ); - iTop = xy.y + pcd->rOffCtrl.top ; - iLeft = xy.x + pcd->rOffCtrl.left; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, ( USHORT ) pcd->rCtrl.left, ( USHORT ) pcd->rCtrl.top ); + iTop = xy.y + pcd->rOffCtrl.top; + iLeft = xy.x + pcd->rOffCtrl.left; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, ((USHORT)(LONG)(pcd->rCtrl.right)) + 1, ((USHORT)(LONG)(pcd->rCtrl.bottom)) + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, ( ( USHORT ) ( LONG ) ( pcd->rCtrl.right ) ) + 1, ( ( USHORT ) ( LONG ) ( pcd->rCtrl.bottom ) ) + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - if (pcd->byCtrlClass==WVW_CONTROL_SCROLLBAR) + if( pcd->byCtrlClass == WVW_CONTROL_SCROLLBAR ) { - if (pcd->bStyle==SBS_VERT) + if( pcd->bStyle == SBS_VERT ) { - iBottom = xy.y - 1 + pcd->rOffCtrl.bottom; - iRight = iLeft + pWindowData->PTEXTSIZE.y -1 + pcd->rOffCtrl.right; + iBottom = xy.y - 1 + pcd->rOffCtrl.bottom; + iRight = iLeft + pWindowData->PTEXTSIZE.y - 1 + pcd->rOffCtrl.right; } else { - iRight = xy.x - 1 + pcd->rOffCtrl.right; - iBottom = iTop + pWindowData->PTEXTSIZE.y -1 + pcd->rOffCtrl.bottom; + iRight = xy.x - 1 + pcd->rOffCtrl.right; + iBottom = iTop + pWindowData->PTEXTSIZE.y - 1 + pcd->rOffCtrl.bottom; } } - else if (pcd->byCtrlClass==WVW_CONTROL_PUSHBUTTON) + else if( pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON ) { - iBottom = xy.y - 1 + pcd->rOffCtrl.bottom; - iRight = xy.x - 1 + pcd->rOffCtrl.right; + iBottom = xy.y - 1 + pcd->rOffCtrl.bottom; + iRight = xy.x - 1 + pcd->rOffCtrl.right; } - - else if (pcd->byCtrlClass==WVW_CONTROL_PROGRESSBAR) + else if( pcd->byCtrlClass == WVW_CONTROL_PROGRESSBAR ) { - iBottom = xy.y - 1 + pcd->rOffCtrl.bottom; - iRight = xy.x - 1 + pcd->rOffCtrl.right; + iBottom = xy.y - 1 + pcd->rOffCtrl.bottom; + iRight = xy.x - 1 + pcd->rOffCtrl.right; } - - else if (pcd->byCtrlClass==WVW_CONTROL_COMBOBOX) + else if( pcd->byCtrlClass == WVW_CONTROL_COMBOBOX ) { - iBottom = xy.y - 1 + (pcd->rOffCtrl.bottom * hb_wvw_LineHeight(pWindowData)); - iRight = xy.x - 1 + pcd->rOffCtrl.right; + iBottom = xy.y - 1 + ( pcd->rOffCtrl.bottom * hb_wvw_LineHeight( pWindowData ) ); + iRight = xy.x - 1 + pcd->rOffCtrl.right; } - - else if (pcd->byCtrlClass==WVW_CONTROL_EDITBOX) + else if( pcd->byCtrlClass == WVW_CONTROL_EDITBOX ) { - iBottom = xy.y - 1 + pcd->rOffCtrl.bottom; - iRight = xy.x - 1 + pcd->rOffCtrl.right; + iBottom = xy.y - 1 + pcd->rOffCtrl.bottom; + iRight = xy.x - 1 + pcd->rOffCtrl.right; } - else { - hb_errRT_TERM( EG_NOFUNC, 10001, "Undefined Control Class", "ReposControls()", 0, 0 ); + hb_errRT_TERM( EG_NOFUNC, 10001, "Undefined Control Class", "ReposControls()", 0, 0 ); - /* dummy assignment, to avoid warning in mingw32: */ - iBottom = 0; - iRight = 0; + /* dummy assignment, to avoid warning in mingw32: */ + iBottom = 0; + iRight = 0; } - SetWindowPos( pcd->hWndCtrl, NULL, iLeft, iTop, iRight-iLeft+1, iBottom-iTop+1, SWP_NOZORDER ); + SetWindowPos( pcd->hWndCtrl, NULL, iLeft, iTop, iRight - iLeft + 1, iBottom - iTop + 1, SWP_NOZORDER ); } pcd = pcd->pNext; @@ -10614,97 +10583,90 @@ static void ReposControls(UINT usWinNum, BYTE byCtrlClass) LRESULT CALLBACK hb_gt_wvwXBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - HWND hWndParent = GetParent(hWnd); - UINT usWinNum; + HWND hWndParent = GetParent( hWnd ); + UINT usWinNum; - UINT uiXBid; - // byte bStyle; - WNDPROC OldProc; + UINT uiXBid; + // byte bStyle; + WNDPROC OldProc; - if (message == WM_MOUSEACTIVATE) - { + if( message == WM_MOUSEACTIVATE ) + { - s_pWvwData->s_iScrolling = 1; + s_pWvwData->s_iScrolling = 1; - } + } - if (hWndParent==NULL) - { + if( hWndParent == NULL ) + { - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } + return DefWindowProc( hWnd, message, wParam, lParam ); + } - for(usWinNum=0; usWinNums_usNumWindows; usWinNum++) - { - if (s_pWvwData->s_pWindows[usWinNum]->hWnd == hWndParent) - { - break; - } - } - if(usWinNum>=s_pWvwData->s_usNumWindows) - { - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - uiXBid = (UINT) GetWindowLong(hWnd, GWL_ID); - if (uiXBid==0) - { - MessageBox( NULL, TEXT( "Failed FindControlId of Scrollbar" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - OldProc = GetControlProc(usWinNum, WVW_CONTROL_SCROLLBAR, hWnd); - if (OldProc == NULL) - { - MessageBox( NULL, TEXT( "Failed GetControlProc of Scrollbar" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - switch ( message ) - { - - case WM_LBUTTONUP: - { - - CallWindowProc( OldProc, hWnd, message, wParam, lParam ); - if (GetCapture() == hWnd) + for( usWinNum = 0; usWinNum < s_pWvwData->s_usNumWindows; usWinNum++ ) + { + if( s_pWvwData->s_pWindows[ usWinNum ]->hWnd == hWndParent ) { - ReleaseCapture(); - - InvalidateRect( hWnd, NULL, FALSE ); - + break; } - return 0; + } + if( usWinNum >= s_pWvwData->s_usNumWindows ) + { - } + return DefWindowProc( hWnd, message, wParam, lParam ); + } - case WM_RBUTTONDOWN: - { + uiXBid = ( UINT ) GetWindowLong( hWnd, GWL_ID ); + if( uiXBid == 0 ) + { + MessageBox( NULL, TEXT( "Failed FindControlId of Scrollbar" ), + s_pWvwData->szAppName, MB_ICONERROR ); + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + OldProc = GetControlProc( usWinNum, WVW_CONTROL_SCROLLBAR, hWnd ); + if( OldProc == NULL ) + { + MessageBox( NULL, TEXT( "Failed GetControlProc of Scrollbar" ), + s_pWvwData->szAppName, MB_ICONERROR ); + + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + switch( message ) + { + + case WM_LBUTTONUP: + + CallWindowProc( OldProc, hWnd, message, wParam, lParam ); + if( GetCapture() == hWnd ) + { + ReleaseCapture(); + + InvalidateRect( hWnd, NULL, FALSE ); + + } + return 0; + + case WM_RBUTTONDOWN: + + s_pWvwData->s_iScrolling = 0; + + return 0; + case WM_RBUTTONUP: + + return 0; + + } + + if( message == WM_CAPTURECHANGED ) + { s_pWvwData->s_iScrolling = 0; - return 0; - } - case WM_RBUTTONUP: - { + } - return 0; - } - - } - - if (message == WM_CAPTURECHANGED) - { - s_pWvwData->s_iScrolling = 0; - - } - - return( CallWindowProc( OldProc, hWnd, message, wParam, lParam ) ); + return CallWindowProc( OldProc, hWnd, message, wParam, lParam ); } @@ -10714,243 +10676,241 @@ LRESULT CALLBACK hb_gt_wvwXBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM LRESULT CALLBACK hb_gt_wvwBtnProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - HWND hWndParent = GetParent(hWnd); - UINT usWinNum; + HWND hWndParent = GetParent( hWnd ); + UINT usWinNum; - UINT uiPBid; + UINT uiPBid; - WNDPROC OldProc; + WNDPROC OldProc; - if (hWndParent==NULL) - { - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } + if( hWndParent == NULL ) + { + return DefWindowProc( hWnd, message, wParam, lParam ); + } - for(usWinNum=0; usWinNums_usNumWindows; usWinNum++) - { - if (s_pWvwData->s_pWindows[usWinNum]->hWnd == hWndParent) - { - break; - } - } - if(usWinNum>=s_pWvwData->s_usNumWindows) - { - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - uiPBid = (UINT) GetWindowLong(hWnd, GWL_ID); - if (uiPBid==0) - { - - MessageBox( NULL, TEXT( "Failed FindControlId" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - OldProc = GetControlProc(usWinNum, WVW_CONTROL_PUSHBUTTON, hWnd); - if (OldProc == NULL) - { - - MessageBox( NULL, TEXT( "Failed GetControlProc" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - switch ( message ) - { - - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - { - BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; - BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; - BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; - - int c = (int) wParam; - - if (!bAlt && !bCtrl && !bShift && wParam == VK_SPACE) + for( usWinNum = 0; usWinNum < s_pWvwData->s_usNumWindows; usWinNum++ ) + { + if( s_pWvwData->s_pWindows[ usWinNum ]->hWnd == hWndParent ) { - break; + break; + } + } + if( usWinNum >= s_pWvwData->s_usNumWindows ) + { + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + uiPBid = ( UINT ) GetWindowLong( hWnd, GWL_ID ); + if( uiPBid == 0 ) + { + + MessageBox( NULL, TEXT( "Failed FindControlId" ), + s_pWvwData->szAppName, MB_ICONERROR ); + + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + OldProc = GetControlProc( usWinNum, WVW_CONTROL_PUSHBUTTON, hWnd ); + if( OldProc == NULL ) + { + + MessageBox( NULL, TEXT( "Failed GetControlProc" ), + s_pWvwData->szAppName, MB_ICONERROR ); + + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + switch( message ) + { + + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + { + BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; + BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; + BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; + + int c = ( int ) wParam; + + if( ! bAlt && ! bCtrl && ! bShift && wParam == VK_SPACE ) + { + break; + } + + if( ! hb_gt_wvwBufferedKey( ( LONG ) wParam ) ) + { + break; + } + + switch( c ) + { + + /* + case VK_RETURN: + { + + SendMessage(hWnd, BM_CLICK, 0, 0); + + break; + + } + */ + + default: + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + + break; + + } + return 0; + } - if ( !hb_gt_wvwBufferedKey( (LONG) wParam ) ) - { - break; - } + /* + case WM_RBUTTONDBLCLK: + case WM_LBUTTONDBLCLK: + case WM_MBUTTONDOWN: + case WM_MBUTTONUP: + case WM_MBUTTONDBLCLK: + case WM_MOUSEMOVE: + case WM_MOUSEWHEEL: + */ + { - switch ( c ) - { + } - /* - case VK_RETURN: - { + } - SendMessage(hWnd, BM_CLICK, 0, 0); - - break; - - } - */ - - default: - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - - break; - } - - } - return 0; - - } - - /* - case WM_RBUTTONDBLCLK: - case WM_LBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: - case WM_MBUTTONDBLCLK: - case WM_MOUSEMOVE: - case WM_MOUSEWHEEL: - */ - { - - } - - } - - return( CallWindowProc( (WNDPROC) OldProc, hWnd, message, wParam, lParam ) ); + return CallWindowProc( ( WNDPROC ) OldProc, hWnd, message, wParam, lParam ); } /************************ -* BEGIN button supporters -* for pushbutton and checkbox -*************************/ + * BEGIN button supporters + * for pushbutton and checkbox + *************************/ /*ASSUME: WVW_ID_BASE_PUSHBUTTON == WVW_ID_BASE_CHECKBOX * WVW_CONTROL_PUSHBUTTON == WVW_CONTROL_CHECKBOX */ -UINT ButtonCreate( UINT usWinNum, USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, LPCTSTR lpszCaption, - char * szBitmap, UINT uiBitmap, PHB_ITEM phbiCodeBlock, - int iOffTop, int iOffLeft, int iOffBottom, int iOffRight, - double dStretch, BOOL bMap3Dcolors, - int iStyle ) +UINT ButtonCreate( UINT usWinNum, USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, LPCTSTR lpszCaption, + char * szBitmap, UINT uiBitmap, PHB_ITEM phbiCodeBlock, + int iOffTop, int iOffLeft, int iOffBottom, int iOffRight, + double dStretch, BOOL bMap3Dcolors, + int iStyle ) { - WIN_DATA * pWindowData = s_pWvwData->s_pWindows[usWinNum]; - HWND hWndParent = pWindowData->hWnd; - HWND hWndButton; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - UINT uiPBid; + WIN_DATA * pWindowData = s_pWvwData->s_pWindows[ usWinNum ]; + HWND hWndParent = pWindowData->hWnd; + HWND hWndButton; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + UINT uiPBid; - if (pWindowData->hPBfont==NULL) + if( pWindowData->hPBfont == NULL ) { pWindowData->hPBfont = CreateFontIndirect( &s_pWvwData->s_lfPB ); - if (pWindowData->hPBfont==NULL) + if( pWindowData->hPBfont == NULL ) { - return 0; + return 0; } } - if (s_pWvwData->s_bMainCoordMode) + if( s_pWvwData->s_bMainCoordMode ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop ; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + iOffBottom; - iRight = xy.x - 1 + iOffRight; + iBottom = xy.y - 1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; - uiPBid = LastControlId(usWinNum, WVW_CONTROL_PUSHBUTTON); - if (uiPBid==0) + uiPBid = LastControlId( usWinNum, WVW_CONTROL_PUSHBUTTON ); + if( uiPBid == 0 ) { - uiPBid = WVW_ID_BASE_PUSHBUTTON; + uiPBid = WVW_ID_BASE_PUSHBUTTON; } else { - uiPBid++; + uiPBid++; } - if (szBitmap || uiBitmap) + if( szBitmap || uiBitmap ) { iStyle |= BS_BITMAP; } - hWndButton = CreateWindowEx( - 0L, /* no extended styles */ - "BUTTON", /* pushbutton/checkbox control class */ - (LPSTR) lpszCaption, /* text for caption */ - WS_CHILD | WS_VISIBLE | (DWORD) iStyle, /* button styles */ - iLeft, /* horizontal position */ - iTop, /* vertical position */ - iRight-iLeft+1, /* width of the button */ - iBottom-iTop+1, /* height */ - hWndParent, /* handle to parent window */ - (HMENU) uiPBid, /* id for this button control */ - s_pWvwData->hInstance, /* instance owning this window */ - (LPVOID) NULL /* pointer not needed */ - ); + hWndButton = CreateWindowEx( + 0L, /* no extended styles */ + "BUTTON", /* pushbutton/checkbox control class */ + ( LPSTR ) lpszCaption, /* text for caption */ + WS_CHILD | WS_VISIBLE | ( DWORD ) iStyle, /* button styles */ + iLeft, /* horizontal position */ + iTop, /* vertical position */ + iRight - iLeft + 1, /* width of the button */ + iBottom - iTop + 1, /* height */ + hWndParent, /* handle to parent window */ + ( HMENU ) uiPBid, /* id for this button control */ + s_pWvwData->hInstance, /* instance owning this window */ + ( LPVOID ) NULL /* pointer not needed */ + ); - if(hWndButton) + if( hWndButton ) { - RECT rXB = { 0 }, rOffXB = { 0 }; - WNDPROC OldProc; + RECT rXB = { 0 }, rOffXB = { 0 }; + WNDPROC OldProc; - if (szBitmap || uiBitmap) - { - HBITMAP hBitmap; - int iExpWidth, iExpHeight; + if( szBitmap || uiBitmap ) + { + HBITMAP hBitmap; + int iExpWidth, iExpHeight; - iExpWidth = iRight - iLeft + 1; - iExpHeight= iBottom - iTop + 1; - hBitmap = hPrepareBitmap(szBitmap, uiBitmap, - (int) dStretch*iExpWidth, (int) dStretch*iExpHeight, - bMap3Dcolors, - hWndButton ); + iExpWidth = iRight - iLeft + 1; + iExpHeight = iBottom - iTop + 1; + hBitmap = hPrepareBitmap( szBitmap, uiBitmap, + ( int ) dStretch * iExpWidth, ( int ) dStretch * iExpHeight, + bMap3Dcolors, + hWndButton ); - if (hBitmap) - { + if( hBitmap ) + { - SendMessage(hWndButton, /* handle to destination window */ - BM_SETIMAGE, /* message to send */ - (WPARAM) IMAGE_BITMAP, /* image type */ - (LPARAM) hBitmap); /* handle to the image (HANDLE) */ - } - } + SendMessage( hWndButton, /* handle to destination window */ + BM_SETIMAGE, /* message to send */ + ( WPARAM ) IMAGE_BITMAP, /* image type */ + ( LPARAM ) hBitmap ); /* handle to the image (HANDLE) */ + } + } - rXB.top = usTop; rXB.left= usLeft; - rXB.bottom=usBottom; rXB.right =usRight; - rOffXB.top = iOffTop; rOffXB.left= iOffLeft; - rOffXB.bottom=iOffBottom; rOffXB.right =iOffRight; + rXB.top = usTop; rXB.left = usLeft; + rXB.bottom = usBottom; rXB.right = usRight; + rOffXB.top = iOffTop; rOffXB.left = iOffLeft; + rOffXB.bottom = iOffBottom; rOffXB.right = iOffRight; - AddControlHandle(usWinNum, WVW_CONTROL_PUSHBUTTON, hWndButton, uiPBid, (PHB_ITEM) phbiCodeBlock, rXB, rOffXB, (byte) iStyle); + AddControlHandle( usWinNum, WVW_CONTROL_PUSHBUTTON, hWndButton, uiPBid, ( PHB_ITEM ) phbiCodeBlock, rXB, rOffXB, ( byte ) iStyle ); - //OldProc = SetWindowLongPtr (hWndButton, - //GWLP_WNDPROC, (LONG_PTR)hb_gt_wvwBtnProc) ; - OldProc = SubclassWindow( hWndButton, hb_gt_wvwBtnProc) ; + //OldProc = SetWindowLongPtr (hWndButton, + //GWLP_WNDPROC, (LONG_PTR)hb_gt_wvwBtnProc) ; + OldProc = SubclassWindow( hWndButton, hb_gt_wvwBtnProc ); - StoreControlProc(usWinNum, WVW_CONTROL_PUSHBUTTON, hWndButton, OldProc); + StoreControlProc( usWinNum, WVW_CONTROL_PUSHBUTTON, hWndButton, OldProc ); - SendMessage( hWndButton, WM_SETFONT, (WPARAM) pWindowData->hPBfont, (LPARAM) TRUE); - hb_stornl((LONG)hWndButton,12); + SendMessage( hWndButton, WM_SETFONT, ( WPARAM ) pWindowData->hPBfont, ( LPARAM ) TRUE ); + hb_stornl( ( LONG ) hWndButton, 12 ); - return uiPBid; + return uiPBid; } else { - return 0; + return 0; } } @@ -10965,267 +10925,245 @@ UINT ButtonCreate( UINT usWinNum, USHORT usTop, USHORT usLeft, USHORT usBottom, LRESULT CALLBACK hb_gt_wvwCBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - HWND hWndParent = GetParent(hWnd); - UINT usWinNum; + HWND hWndParent = GetParent( hWnd ); + UINT usWinNum; - UINT uiCBid; - WNDPROC OldProc; - BYTE bKbdType; + UINT uiCBid; + WNDPROC OldProc; + BYTE bKbdType; - if (hWndParent==NULL) - { + if( hWndParent == NULL ) + { - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } + return DefWindowProc( hWnd, message, wParam, lParam ); + } - for(usWinNum=0; usWinNums_usNumWindows; usWinNum++) - { - if (s_pWvwData->s_pWindows[usWinNum]->hWnd == hWndParent) - { - break; - } - } - if(usWinNum>=s_pWvwData->s_usNumWindows) - { - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - uiCBid = (UINT) FindControlId (usWinNum, WVW_CONTROL_COMBOBOX, hWnd, &bKbdType) ; - - if (uiCBid==0) - { - MessageBox( NULL, TEXT( "Failed FindControlId" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - OldProc = GetControlProc(usWinNum, WVW_CONTROL_COMBOBOX, hWnd); - if (OldProc == NULL) - { - MessageBox( NULL, TEXT( "Failed GetControlProc" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - switch ( message ) - { - - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - { - BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; - BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; - BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; - int c = (int) wParam; - BOOL bDropped; - - if ( !hb_gt_wvwBufferedKey( (LONG) wParam ) ) + for( usWinNum = 0; usWinNum < s_pWvwData->s_usNumWindows; usWinNum++ ) + { + if( s_pWvwData->s_pWindows[ usWinNum ]->hWnd == hWndParent ) { - break; + break; } + } + if( usWinNum >= s_pWvwData->s_usNumWindows ) + { - bDropped = SendMessage( (HWND) hWnd, - CB_GETDROPPEDSTATE, - (WPARAM) 0, - (LPARAM) 0 - ); + return DefWindowProc( hWnd, message, wParam, lParam ); + } - if (bKbdType==WVW_CB_KBD_STANDARD) + uiCBid = ( UINT ) FindControlId( usWinNum, WVW_CONTROL_COMBOBOX, hWnd, &bKbdType ); + + if( uiCBid == 0 ) + { + MessageBox( NULL, TEXT( "Failed FindControlId" ), + s_pWvwData->szAppName, MB_ICONERROR ); + + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + OldProc = GetControlProc( usWinNum, WVW_CONTROL_COMBOBOX, hWnd ); + if( OldProc == NULL ) + { + MessageBox( NULL, TEXT( "Failed GetControlProc" ), + s_pWvwData->szAppName, MB_ICONERROR ); + + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + switch( message ) + { + + case WM_KEYDOWN: + case WM_SYSKEYDOWN: { + BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; + BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; + BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; + int c = ( int ) wParam; + BOOL bDropped; - switch ( c ) - { - - case VK_F4: - { - if (bAlt) - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } + if( ! hb_gt_wvwBufferedKey( ( LONG ) wParam ) ) + { break; - } + } - case VK_ESCAPE: - { - if (!bCtrl && !bAlt && !bShift && !bDropped) + bDropped = SendMessage( ( HWND ) hWnd, + CB_GETDROPPEDSTATE, + ( WPARAM ) 0, + ( LPARAM ) 0 + ); + + if( bKbdType == WVW_CB_KBD_STANDARD ) + { + + switch( c ) { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; + + case VK_F4: + if( bAlt ) + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + break; + + case VK_ESCAPE: + if( ! bCtrl && ! bAlt && ! bShift && ! bDropped ) + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + break; + + case VK_TAB: + if( ! bCtrl && ! bAlt ) + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + break; + + case VK_NEXT: + + if( bDropped || bAlt || bShift || bCtrl ) + { + + break; + } + else + { + + if( ! bDropped ) + { + SendMessage( ( HWND ) hWnd, + CB_SHOWDROPDOWN, + ( WPARAM ) TRUE, + ( LPARAM ) 0 + ); + return 0; + } + else + { + + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + } + + case VK_RETURN: + if( ! bCtrl && ! bAlt && ! bShift && ! bDropped ) + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + break; + + default: + break; } + break; - } - case VK_TAB: - { - if (!bCtrl && !bAlt) - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - break; - } - - case VK_NEXT: - { - - if (bDropped || bAlt || bShift || bCtrl) + } /* WVW_CB_KBD_STANDARD */ + else /* assume WVW_CB_KBD_CLIPPER */ + { + switch( c ) { - break; - } - else - { + case VK_F4: + if( bAlt ) + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + break; - if (!bDropped) - { - SendMessage( (HWND) hWnd, - CB_SHOWDROPDOWN, - (WPARAM) TRUE, - (LPARAM) 0 + case VK_RETURN: + + if( bDropped || bAlt || bShift || bCtrl ) + { + + break; + } + else + { + + if( ! bDropped ) + { + SendMessage( + ( HWND ) hWnd, + CB_SHOWDROPDOWN, + ( WPARAM ) TRUE, + ( LPARAM ) 0 ); - return 0; - } - else - { + return 0; + } + else + { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - } - } + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + } - case VK_RETURN: - { - if (!bCtrl && !bAlt && !bShift && !bDropped) - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; + case VK_ESCAPE: + if( bDropped || bAlt || bShift || bCtrl ) + { + + break; + } + else + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + + case VK_UP: + case VK_DOWN: + case VK_RIGHT: + case VK_LEFT: + case VK_HOME: + case VK_END: + case VK_PRIOR: + case VK_NEXT: + if( bDropped ) + { + + break; + } + else + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + + case VK_TAB: + if( ! bCtrl && ! bAlt ) + { + + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + break; } break; - } - - default: - { - break; - } - } - - break; - - } /* WVW_CB_KBD_STANDARD */ - else /* assume WVW_CB_KBD_CLIPPER */ - { - switch(c) - { - - case VK_F4: - { - if (bAlt) - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - break; - } - - case VK_RETURN: - { - - if (bDropped || bAlt || bShift || bCtrl) - { - - break; - } - else - { - - if (!bDropped) - { - SendMessage( - (HWND) hWnd, - CB_SHOWDROPDOWN, - (WPARAM) TRUE, - (LPARAM) 0 - ); - return 0; - } - else - { - - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - } - } - - case VK_ESCAPE: - { - if (bDropped || bAlt || bShift || bCtrl) - { - - break; - } - else - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - } - - case VK_UP: - case VK_DOWN: - case VK_RIGHT: - case VK_LEFT: - case VK_HOME: - case VK_END: - case VK_PRIOR: - case VK_NEXT: - { - if (bDropped) - { - - break; - } - else - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - } - - case VK_TAB: - { - if (!bCtrl && !bAlt ) - { - - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - break; - } - } - break; + } } - } - } + } - return( CallWindowProc( (WNDPROC) OldProc, hWnd, message, wParam, lParam ) ); + return CallWindowProc( ( WNDPROC ) OldProc, hWnd, message, wParam, lParam ); } @@ -11235,474 +11173,454 @@ LRESULT CALLBACK hb_gt_wvwCBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM LRESULT CALLBACK hb_gt_wvwEBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { - HWND hWndParent = GetParent(hWnd); - UINT usWinNum; + HWND hWndParent = GetParent( hWnd ); + UINT usWinNum; - UINT uiEBid; - WNDPROC OldProc; - BYTE bEBType; - int iKey; + UINT uiEBid; + WNDPROC OldProc; + BYTE bEBType; + int iKey; - if (hWndParent==NULL) - { + if( hWndParent == NULL ) + { - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } + return DefWindowProc( hWnd, message, wParam, lParam ); + } - for(usWinNum=0; usWinNums_usNumWindows; usWinNum++) - { - if (s_pWvwData->s_pWindows[usWinNum]->hWnd == hWndParent) - { - break; - } - } - if(usWinNum>=s_pWvwData->s_usNumWindows) - { - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - uiEBid = (UINT) FindControlId (usWinNum, WVW_CONTROL_EDITBOX, hWnd, &bEBType) ; - - if (uiEBid==0) - { - MessageBox( NULL, TEXT( "Failed FindControlId" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - OldProc = GetControlProc(usWinNum, WVW_CONTROL_EDITBOX, hWnd); - if (OldProc == NULL) - { - MessageBox( NULL, TEXT( "Failed GetControlProc" ), - s_pWvwData->szAppName, MB_ICONERROR ); - - return( DefWindowProc( hWnd, message, wParam, lParam ) ); - } - - iKey = 0; - switch ( message ) - { - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - { - BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; - int c = (int) wParam; - switch(c) + for( usWinNum = 0; usWinNum < s_pWvwData->s_usNumWindows; usWinNum++ ) + { + if( s_pWvwData->s_pWindows[ usWinNum ]->hWnd == hWndParent ) { - case VK_F1: - iKey = hb_gt_wvwJustTranslateKey( K_F1, K_SH_F1, K_ALT_F1, K_CTRL_F1 ); - break; - case VK_F2: - iKey = hb_gt_wvwJustTranslateKey( K_F2, K_SH_F2, K_ALT_F2, K_CTRL_F2 ); - break; - case VK_F3: - iKey = hb_gt_wvwJustTranslateKey( K_F3, K_SH_F3, K_ALT_F3, K_CTRL_F3 ); - break; - case VK_F4: - { - if ( bAlt ) - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - else - { - iKey = hb_gt_wvwJustTranslateKey( K_F4, K_SH_F4, K_ALT_F4, K_CTRL_F4 ); - } - break; - } - case VK_F5: - iKey = hb_gt_wvwJustTranslateKey( K_F5, K_SH_F5, K_ALT_F5, K_CTRL_F5 ); - break; - case VK_F6: - iKey = hb_gt_wvwJustTranslateKey( K_F6, K_SH_F6, K_ALT_F6, K_CTRL_F6 ); - break; - case VK_F7: - iKey = hb_gt_wvwJustTranslateKey( K_F7, K_SH_F7, K_ALT_F7, K_CTRL_F7 ); - break; - case VK_F8: - iKey = hb_gt_wvwJustTranslateKey( K_F8, K_SH_F8, K_ALT_F8, K_CTRL_F8 ); - break; - case VK_F9: - iKey = hb_gt_wvwJustTranslateKey( K_F9, K_SH_F9, K_ALT_F9, K_CTRL_F9 ); - break; - case VK_F10: - iKey = hb_gt_wvwJustTranslateKey( K_F10, K_SH_F10, K_ALT_F10, K_CTRL_F10 ); - break; - case VK_F11: - iKey = hb_gt_wvwJustTranslateKey( K_F11, K_SH_F11, K_ALT_F11, K_CTRL_F11 ); - break; - case VK_F12: - iKey = hb_gt_wvwJustTranslateKey( K_F12, K_SH_F12, K_ALT_F12, K_CTRL_F12 ); - break; + break; } - break; - } + } + if( usWinNum >= s_pWvwData->s_usNumWindows ) + { - case WM_CHAR: - { - BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; - int iScanCode = HIWORD( lParam ) & 0xFF ; - int c = ( int )wParam; - if ( bCtrl && iScanCode == 28 ) - { - iKey = K_CTRL_RETURN; - } - else if ( bCtrl && ( c >= 1 && c<= 26 ) ) - { - iKey = K_Ctrl[c-1]; - } - else - { - switch ( c ) - { + return DefWindowProc( hWnd, message, wParam, lParam ); + } - case VK_BACK: - iKey = hb_gt_wvwJustTranslateKey( K_BS, K_SH_BS, K_ALT_BS, K_CTRL_BS ); - break; - case VK_TAB: - iKey = hb_gt_wvwJustTranslateKey( K_TAB, K_SH_TAB, K_ALT_TAB, K_CTRL_TAB ); - break; - case VK_RETURN: - iKey = hb_gt_wvwJustTranslateKey( K_RETURN, K_SH_RETURN, K_ALT_RETURN, K_CTRL_RETURN ); - break; - case VK_ESCAPE: - iKey = K_ESC; - break; - default: - if( s_pWvwData->s_pWindows[usWinNum]->CodePage == OEM_CHARSET ) + uiEBid = ( UINT ) FindControlId( usWinNum, WVW_CONTROL_EDITBOX, hWnd, &bEBType ); + + if( uiEBid == 0 ) + { + MessageBox( NULL, TEXT( "Failed FindControlId" ), + s_pWvwData->szAppName, MB_ICONERROR ); + + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + OldProc = GetControlProc( usWinNum, WVW_CONTROL_EDITBOX, hWnd ); + if( OldProc == NULL ) + { + MessageBox( NULL, TEXT( "Failed GetControlProc" ), + s_pWvwData->szAppName, MB_ICONERROR ); + + return DefWindowProc( hWnd, message, wParam, lParam ); + } + + iKey = 0; + switch( message ) + { + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + { + BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; + int c = ( int ) wParam; + switch( c ) + { + case VK_F1: + iKey = hb_gt_wvwJustTranslateKey( K_F1, K_SH_F1, K_ALT_F1, K_CTRL_F1 ); + break; + case VK_F2: + iKey = hb_gt_wvwJustTranslateKey( K_F2, K_SH_F2, K_ALT_F2, K_CTRL_F2 ); + break; + case VK_F3: + iKey = hb_gt_wvwJustTranslateKey( K_F3, K_SH_F3, K_ALT_F3, K_CTRL_F3 ); + break; + case VK_F4: + if( bAlt ) + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + else + { + iKey = hb_gt_wvwJustTranslateKey( K_F4, K_SH_F4, K_ALT_F4, K_CTRL_F4 ); + } + break; + case VK_F5: + iKey = hb_gt_wvwJustTranslateKey( K_F5, K_SH_F5, K_ALT_F5, K_CTRL_F5 ); + break; + case VK_F6: + iKey = hb_gt_wvwJustTranslateKey( K_F6, K_SH_F6, K_ALT_F6, K_CTRL_F6 ); + break; + case VK_F7: + iKey = hb_gt_wvwJustTranslateKey( K_F7, K_SH_F7, K_ALT_F7, K_CTRL_F7 ); + break; + case VK_F8: + iKey = hb_gt_wvwJustTranslateKey( K_F8, K_SH_F8, K_ALT_F8, K_CTRL_F8 ); + break; + case VK_F9: + iKey = hb_gt_wvwJustTranslateKey( K_F9, K_SH_F9, K_ALT_F9, K_CTRL_F9 ); + break; + case VK_F10: + iKey = hb_gt_wvwJustTranslateKey( K_F10, K_SH_F10, K_ALT_F10, K_CTRL_F10 ); + break; + case VK_F11: + iKey = hb_gt_wvwJustTranslateKey( K_F11, K_SH_F11, K_ALT_F11, K_CTRL_F11 ); + break; + case VK_F12: + iKey = hb_gt_wvwJustTranslateKey( K_F12, K_SH_F12, K_ALT_F12, K_CTRL_F12 ); + break; + } + break; + } + + case WM_CHAR: + { + BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; + int iScanCode = HIWORD( lParam ) & 0xFF; + int c = ( int ) wParam; + if( bCtrl && iScanCode == 28 ) + { + iKey = K_CTRL_RETURN; + } + else if( bCtrl && ( c >= 1 && c <= 26 ) ) + { + iKey = K_Ctrl[ c - 1 ]; + } + else + { + switch( c ) { - c = hb_wvw_key_ansi_to_oem( c ); + + case VK_BACK: + iKey = hb_gt_wvwJustTranslateKey( K_BS, K_SH_BS, K_ALT_BS, K_CTRL_BS ); + break; + case VK_TAB: + iKey = hb_gt_wvwJustTranslateKey( K_TAB, K_SH_TAB, K_ALT_TAB, K_CTRL_TAB ); + break; + case VK_RETURN: + iKey = hb_gt_wvwJustTranslateKey( K_RETURN, K_SH_RETURN, K_ALT_RETURN, K_CTRL_RETURN ); + break; + case VK_ESCAPE: + iKey = K_ESC; + break; + default: + if( s_pWvwData->s_pWindows[ usWinNum ]->CodePage == OEM_CHARSET ) + { + c = hb_wvw_key_ansi_to_oem( c ); + } + iKey = c; + break; } - iKey = c; - break; - } + } + break; } - break; - } - case WM_SYSCHAR: - { - int c, iScanCode = HIWORD( lParam ) & 0xFF ; - switch ( iScanCode ) + case WM_SYSCHAR: { - case 2: - c = K_ALT_1 ; - break; - case 3: - c = K_ALT_2 ; - break; - case 4: - c = K_ALT_3 ; - break; - case 5: - c = K_ALT_4 ; - break; - case 6: - c = K_ALT_5 ; - break; - case 7: - c = K_ALT_6 ; - break; - case 8: - c = K_ALT_7 ; - break; - case 9: - c = K_ALT_8 ; - break; - case 10: - c = K_ALT_9 ; - break; - case 11: - c = K_ALT_0 ; - break; - case 13: - c = K_ALT_EQUALS ; - break; - case 14: - c = K_ALT_BS ; - break; - case 16: - c = K_ALT_Q ; - break; - case 17: - c = K_ALT_W ; - break; - case 18: - c = K_ALT_E ; - break; - case 19: - c = K_ALT_R ; - break; - case 20: - c = K_ALT_T ; - break; - case 21: - c = K_ALT_Y ; - break; - case 22: - c = K_ALT_U ; - break; - case 23: - c = K_ALT_I ; - break; - case 24: - c = K_ALT_O ; - break; - case 25: - c = K_ALT_P ; - break; - case 30: - c = K_ALT_A ; - break; - case 31: - c = K_ALT_S ; - break; - case 32: - c = K_ALT_D ; - break; - case 33: - c = K_ALT_F ; - break; - case 34: - c = K_ALT_G ; - break; - case 35: - c = K_ALT_H ; - break; - case 36: - c = K_ALT_J ; - break; - case 37: - c = K_ALT_K ; - break; - case 38: - c = K_ALT_L ; - break; - case 44: - c = K_ALT_Z ; - break; - case 45: - c = K_ALT_X ; - break; - case 46: - c = K_ALT_C ; - break; - case 47: - c = K_ALT_V ; - break; - case 48: - c = K_ALT_B ; - break; - case 49: - c = K_ALT_N ; - break; - case 50: - c = K_ALT_M ; - break; - default: - c = ( int ) wParam ; - break; + int c, iScanCode = HIWORD( lParam ) & 0xFF; + switch( iScanCode ) + { + case 2: + c = K_ALT_1; + break; + case 3: + c = K_ALT_2; + break; + case 4: + c = K_ALT_3; + break; + case 5: + c = K_ALT_4; + break; + case 6: + c = K_ALT_5; + break; + case 7: + c = K_ALT_6; + break; + case 8: + c = K_ALT_7; + break; + case 9: + c = K_ALT_8; + break; + case 10: + c = K_ALT_9; + break; + case 11: + c = K_ALT_0; + break; + case 13: + c = K_ALT_EQUALS; + break; + case 14: + c = K_ALT_BS; + break; + case 16: + c = K_ALT_Q; + break; + case 17: + c = K_ALT_W; + break; + case 18: + c = K_ALT_E; + break; + case 19: + c = K_ALT_R; + break; + case 20: + c = K_ALT_T; + break; + case 21: + c = K_ALT_Y; + break; + case 22: + c = K_ALT_U; + break; + case 23: + c = K_ALT_I; + break; + case 24: + c = K_ALT_O; + break; + case 25: + c = K_ALT_P; + break; + case 30: + c = K_ALT_A; + break; + case 31: + c = K_ALT_S; + break; + case 32: + c = K_ALT_D; + break; + case 33: + c = K_ALT_F; + break; + case 34: + c = K_ALT_G; + break; + case 35: + c = K_ALT_H; + break; + case 36: + c = K_ALT_J; + break; + case 37: + c = K_ALT_K; + break; + case 38: + c = K_ALT_L; + break; + case 44: + c = K_ALT_Z; + break; + case 45: + c = K_ALT_X; + break; + case 46: + c = K_ALT_C; + break; + case 47: + c = K_ALT_V; + break; + case 48: + c = K_ALT_B; + break; + case 49: + c = K_ALT_N; + break; + case 50: + c = K_ALT_M; + break; + default: + c = ( int ) wParam; + break; + } + iKey = c; + break; } - iKey = c; - break; - } - } + } - if (iKey!=0) - { - PHB_ITEM pCodeblock; - PHB_ITEM hiKey = hb_itemNew( NULL ); - PHB_ITEM pReturn; - BOOL bCodeExec = FALSE; + if( iKey != 0 ) + { + PHB_ITEM pCodeblock; + PHB_ITEM hiKey = hb_itemNew( NULL ); + PHB_ITEM pReturn; + BOOL bCodeExec = FALSE; - hb_itemPutNI( hiKey, iKey ); + hb_itemPutNI( hiKey, iKey ); - pCodeblock = hb_itemDoC( "SETKEY", 1, hiKey ); - if (HB_IS_BLOCK( pCodeblock )) - { - SetFocus(hWndParent); - pReturn = hb_itemDo( pCodeblock, 0 ); - hb_itemRelease( pReturn ); - SetFocus(hWnd); - bCodeExec = TRUE; - } - hb_itemRelease( pCodeblock ); - hb_itemRelease( hiKey ); - if (bCodeExec) - { - return 0; - } - } - - switch ( message ) - { - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - { - BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; - BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; - BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; - int c = (int) wParam; - BOOL bMultiline; - - if ( !hb_gt_wvwBufferedKey( (LONG) wParam ) ) + pCodeblock = hb_itemDoC( "SETKEY", 1, hiKey ); + if( HB_IS_BLOCK( pCodeblock ) ) { - break; + SetFocus( hWndParent ); + pReturn = hb_itemDo( pCodeblock, 0 ); + hb_itemRelease( pReturn ); + SetFocus( hWnd ); + bCodeExec = TRUE; } - - bMultiline = ((bEBType & WVW_EB_MULTILINE) == WVW_EB_MULTILINE); - - switch(c) + hb_itemRelease( pCodeblock ); + hb_itemRelease( hiKey ); + if( bCodeExec ) { - - case VK_F4: - { - if (bAlt) - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - break; - } - - case VK_RETURN: - { - if (bMultiline || bAlt || bShift || bCtrl) - { - - break; - } - else - { - - if (!bMultiline) - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - } - } - - case VK_ESCAPE: - { - - if (bAlt || bShift || bCtrl) - { - - break; - } - else - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - } - - case VK_UP: - case VK_DOWN: - - case VK_PRIOR: - case VK_NEXT: - { - if (bMultiline) - { - break; - } - else - { - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - return 0; - } - } - - case VK_TAB: - { - if (!bCtrl && !bAlt ) - { - - SetFocus(hWndParent); - PostMessage(hWndParent, message, wParam, lParam); - - return 0; - } - break; - } - - case VK_BACK: - { - if (!bAlt) - { - break; - } - if ( SendMessage( - (HWND) hWnd, - EM_CANUNDO, - (WPARAM) 0, - (LPARAM) 0 - )) - { - SendMessage( - (HWND) hWnd, - EM_UNDO, - (WPARAM) 0, - (LPARAM) 0 - ); - return 0; - } - break; - } - + return 0; } - break; + } - } - - case WM_CHAR: - { - BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; - int c = (int) wParam; - switch(c) + switch( message ) + { + case WM_KEYDOWN: + case WM_SYSKEYDOWN: { - case VK_TAB: - { - return 0; - } + BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000; + BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; + BOOL bShift = GetKeyState( VK_SHIFT ) & 0x8000; + int c = ( int ) wParam; + BOOL bMultiline; - case 1: - { - if (bCtrl) - { + if( ! hb_gt_wvwBufferedKey( ( LONG ) wParam ) ) + { + break; + } - SendMessage( (HWND) hWnd, - EM_SETSEL, - (WPARAM) 0, - (LPARAM) -1 - ); - return 0; - } - break; - } + bMultiline = ( ( bEBType & WVW_EB_MULTILINE ) == WVW_EB_MULTILINE ); + + switch( c ) + { + + case VK_F4: + if( bAlt ) + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + break; + + case VK_RETURN: + if( bMultiline || bAlt || bShift || bCtrl ) + { + + break; + } + else + { + + if( ! bMultiline ) + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + } + + case VK_ESCAPE: + + if( bAlt || bShift || bCtrl ) + { + + break; + } + else + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + + case VK_UP: + case VK_DOWN: + + case VK_PRIOR: + case VK_NEXT: + if( bMultiline ) + { + break; + } + else + { + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + return 0; + } + + case VK_TAB: + if( ! bCtrl && ! bAlt ) + { + + SetFocus( hWndParent ); + PostMessage( hWndParent, message, wParam, lParam ); + + return 0; + } + break; + + case VK_BACK: + if( ! bAlt ) + { + break; + } + if( SendMessage( + ( HWND ) hWnd, + EM_CANUNDO, + ( WPARAM ) 0, + ( LPARAM ) 0 + ) ) + { + SendMessage( + ( HWND ) hWnd, + EM_UNDO, + ( WPARAM ) 0, + ( LPARAM ) 0 + ); + return 0; + } + break; + + } + break; - default: - { - break; - } } - break; - } - } + case WM_CHAR: + { + BOOL bCtrl = GetKeyState( VK_CONTROL ) & 0x8000; + int c = ( int ) wParam; + switch( c ) + { + case VK_TAB: + return 0; - return( CallWindowProc( (WNDPROC) OldProc, hWnd, message, wParam, lParam ) ); + case 1: + if( bCtrl ) + { + + SendMessage( ( HWND ) hWnd, + EM_SETSEL, + ( WPARAM ) 0, + ( LPARAM ) -1 + ); + return 0; + } + break; + + default: + break; + } + break; + + } + } + + return CallWindowProc( ( WNDPROC ) OldProc, hWnd, message, wParam, lParam ); } @@ -11716,6 +11634,6 @@ LRESULT CALLBACK hb_gt_wvwEBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM * Direct WinApi Functions - Prefixed WIN_*() * Original work of Pritpal Bedi on wvtutils.c * - *TODO: should be moved to separate modul. totally independent of GT. + **TODO: should be moved to separate modul. totally independent of GT. * */ diff --git a/harbour/extras/gtwvw/hbgtwvw.h b/harbour/extras/gtwvw/hbgtwvw.h index 8d05a4175c..0129d704b4 100644 --- a/harbour/extras/gtwvw/hbgtwvw.h +++ b/harbour/extras/gtwvw/hbgtwvw.h @@ -64,27 +64,27 @@ #ifndef HB_WVW_H_ #define HB_WVW_H_ -#define TTS_BALLOON 0x40 // added by MAG +#define TTS_BALLOON 0x40 // added by MAG #ifndef GRADIENT_FILL_RECT_H -#define GRADIENT_FILL_RECT_H 0x00000000 +#define GRADIENT_FILL_RECT_H 0x00000000 #endif #ifndef TPM_RECURSE -#define TPM_RECURSE 0x0001L +#define TPM_RECURSE 0x0001L #endif #ifndef _WIN32_IE - #define _WIN32_IE 0x0400 + #define _WIN32_IE 0x0400 #endif /* NOTE: User programs should never call this layer directly! */ /* This definition has to be placed before #include "hbapigt.h" */ -#define HB_GT_NAME WVW +#define HB_GT_NAME WVW #ifndef CINTERFACE - #define CINTERFACE 1 + #define CINTERFACE 1 #endif #include "hbset.h" @@ -110,19 +110,19 @@ #include #include -#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__DMC__) +#if defined( __MINGW32__ ) || defined( __WATCOMC__ ) || defined( _MSC_VER ) || defined( __DMC__ ) #include #include #include #include - #if defined(_MSC_VER) || defined( __DMC__ ) + #if defined( _MSC_VER ) || defined( __DMC__ ) #include #if ! defined( _MSC_VER ) - #if !defined( LONG_PTR ) - typedef __int64 LONG_PTR; + #if ! defined( LONG_PTR ) +typedef __int64 LONG_PTR; #endif #endif #endif @@ -131,196 +131,199 @@ #endif #if ( ( defined( _MSC_VER ) && ( _MSC_VER <= 1200 || defined( HB_OS_WIN_CE ) ) ) || \ - defined( __DMC__ ) ) && !defined( HB_ARCH_64BIT ) + defined( __DMC__ ) ) && ! defined( HB_ARCH_64BIT ) # ifndef GetWindowLongPtr -# define GetWindowLongPtr GetWindowLong +# define GetWindowLongPtr GetWindowLong # endif # ifndef SetWindowLongPtr -# define SetWindowLongPtr SetWindowLong +# define SetWindowLongPtr SetWindowLong # endif # ifndef SetClassLongPtr -# define SetClassLongPtr SetClassLong +# define SetClassLongPtr SetClassLong # endif #endif -#if (defined(__MSC6__) || defined(__DMC__)) - #define LONG_PTR LONG +#if ( defined( __MSC6__ ) || defined( __DMC__ ) ) + #define LONG_PTR LONG #endif #include #include /* xHarbour compatible definitions */ -#if !defined( K_SH_LEFT ) -#define K_SH_LEFT K_LEFT /* Shift-Left == Left */ -#define K_SH_UP K_UP /* Shift-Up == Up */ -#define K_SH_RIGHT K_RIGHT /* Shift-Right == Right */ -#define K_SH_DOWN K_DOWN /* Shift-Down == Down */ -#define K_SH_INS K_INS /* Shift-Ins == Ins */ -#define K_SH_DEL K_DEL /* Shift-Del == Del */ -#define K_SH_HOME K_HOME /* Shift-Home == Home */ -#define K_SH_END K_END /* Shift-End == End */ -#define K_SH_PGUP K_PGUP /* Shift-PgUp == PgUp */ -#define K_SH_PGDN K_PGDN /* Shift-PgDn == PgDn */ -#define K_SH_RETURN K_RETURN /* Shift-Enter == Enter */ -#define K_SH_ENTER K_ENTER /* Shift-Enter == Enter */ +#if ! defined( K_SH_LEFT ) +#define K_SH_LEFT K_LEFT /* Shift-Left == Left */ +#define K_SH_UP K_UP /* Shift-Up == Up */ +#define K_SH_RIGHT K_RIGHT /* Shift-Right == Right */ +#define K_SH_DOWN K_DOWN /* Shift-Down == Down */ +#define K_SH_INS K_INS /* Shift-Ins == Ins */ +#define K_SH_DEL K_DEL /* Shift-Del == Del */ +#define K_SH_HOME K_HOME /* Shift-Home == Home */ +#define K_SH_END K_END /* Shift-End == End */ +#define K_SH_PGUP K_PGUP /* Shift-PgUp == PgUp */ +#define K_SH_PGDN K_PGDN /* Shift-PgDn == PgDn */ +#define K_SH_RETURN K_RETURN /* Shift-Enter == Enter */ +#define K_SH_ENTER K_ENTER /* Shift-Enter == Enter */ #endif -#define WVW_MAXWINDOWS 40 +#define WVW_MAXWINDOWS 40 -#define WVW_MAXWINNAMELENGTH 256 +#define WVW_MAXWINNAMELENGTH 256 #define WVW_DEFAULT_MENUKEYEVENT 1024 -#define WVW_MAX_STATUS_PARTS 40 /* max # of parts in Status Bar */ -#define WVW_SPACE_BETWEEN_PARTS 2 /* pixel space between Status Bar's parts */ +#define WVW_MAX_STATUS_PARTS 40 /* max # of parts in Status Bar */ +#define WVW_SPACE_BETWEEN_PARTS 2 /* pixel space between Status Bar's parts */ #define WVW_ID_SYSTEM_TIMER 1 -#define WVW_ID_BASE_STATUSBAR 100 -#define WVW_ID_BASE_TIMER 100 +#define WVW_ID_BASE_STATUSBAR 100 +#define WVW_ID_BASE_TIMER 100 -#define WVW_ID_BASE_TOOLTIP 100 +#define WVW_ID_BASE_TOOLTIP 100 -#define WVW_ID_BASE_TOOLBAR 100 +#define WVW_ID_BASE_TOOLBAR 100 -#define WVW_ID_BASE_SCROLLBAR 100 +#define WVW_ID_BASE_SCROLLBAR 100 -#define WVW_ID_BASE_PROGRESSBAR 100 -#define WVW_ID_BASE_STATIC 200 +#define WVW_ID_BASE_PROGRESSBAR 100 +#define WVW_ID_BASE_STATIC 200 -#define WVW_ID_BASE_PUSHBUTTON 64000 -#define WVW_ID_BASE_CHECKBOX 64000 +#define WVW_ID_BASE_PUSHBUTTON 64000 +#define WVW_ID_BASE_CHECKBOX 64000 -#define WVW_ID_MAX_PUSHBUTTON WVW_ID_BASE_PUSHBUTTON+200-1 -#define WVW_ID_MAX_CHECKBOX WVW_ID_BASE_CHECKBOX+200-1 +#define WVW_ID_MAX_PUSHBUTTON WVW_ID_BASE_PUSHBUTTON + 200 - 1 +#define WVW_ID_MAX_CHECKBOX WVW_ID_BASE_CHECKBOX + 200 - 1 /* ie. effectively there are max 200 buttons on a window */ -#define WVW_ID_BASE_COMBOBOX WVW_ID_MAX_PUSHBUTTON+1 -#define WVW_CB_KBD_STANDARD 0 -#define WVW_CB_KBD_CLIPPER 1 +#define WVW_ID_BASE_COMBOBOX WVW_ID_MAX_PUSHBUTTON + 1 +#define WVW_CB_KBD_STANDARD 0 +#define WVW_CB_KBD_CLIPPER 1 -#define WVW_COMBOBOX_MAXLEN 255 /* maximum length of combobox string */ +#define WVW_COMBOBOX_MAXLEN 255 /* maximum length of combobox string */ -#define WVW_ID_MAX_COMBOBOX WVW_ID_BASE_COMBOBOX+200-1 +#define WVW_ID_MAX_COMBOBOX WVW_ID_BASE_COMBOBOX + 200 - 1 -#define WVW_ID_BASE_EDITBOX WVW_ID_MAX_COMBOBOX+1 -#define WVW_ID_MAX_EDITBOX WVW_ID_BASE_EDITBOX+200-1 +#define WVW_ID_BASE_EDITBOX WVW_ID_MAX_COMBOBOX + 1 +#define WVW_ID_MAX_EDITBOX WVW_ID_BASE_EDITBOX + 200 - 1 -#define WVW_EB_SINGLELINE 1 -#define WVW_EB_MULTILINE 2 +#define WVW_EB_SINGLELINE 1 +#define WVW_EB_MULTILINE 2 -#define WVW_CHAR_QUEUE_SIZE 128 -#define WVW_MAX_TITLE_SIZE 128 -#define WVW_CHAR_BUFFER 1024 -#define WVW_MAX_ROWS 256 -#define WVW_MAX_COLS 256 -#define WVW_DEFAULT_ROWS 25 -#define WVW_DEFAULT_COLS 80 +#define WVW_CHAR_QUEUE_SIZE 128 +#define WVW_MAX_TITLE_SIZE 128 +#define WVW_CHAR_BUFFER 1024 +#define WVW_MAX_ROWS 256 +#define WVW_MAX_COLS 256 +#define WVW_DEFAULT_ROWS 25 +#define WVW_DEFAULT_COLS 80 -#define WVW_PICTURES_MAX 20 +#define WVW_PICTURES_MAX 20 -#define WVW_FONTS_MAX 20 -#define WVW_PENS_MAX 20 -#define WVW_DLGML_MAX 20 -#define WVW_DLGMD_MAX 20 +#define WVW_FONTS_MAX 20 +#define WVW_PENS_MAX 20 +#define WVW_DLGML_MAX 20 +#define WVW_DLGMD_MAX 20 /* default maximum number of user bitmap cache One bitmap cache currently takes 280 bytes (see BITMAP_HANDLE). See also wvw_setMaxBMCache(). */ -#define WVW_DEFAULT_MAX_BMCACHE 20 +#define WVW_DEFAULT_MAX_BMCACHE 20 /* Como as descricoes sao grandes, precisei aumetar isso - Peluffo - 26/10/2007 #define WVW_TB_LABELMAXLENGTH 40 */ -#define WVW_TB_LABELMAXLENGTH 100 +#define WVW_TB_LABELMAXLENGTH 100 //#define WVW_WHICH_WINDOW ( HB_ISNIL( 1 ) ? ( s_bMainCoordMode ? s_usNumWindows-1 : s_usCurWindow ) : ((UINT) hb_parni( 1 )) ) -#define WVW_WHICH_WINDOW ( HB_ISNIL( 1 ) ? ( hb_gt_wvw_GetMainCoordMode() ? ((hb_gt_wvw_GetNumWindows())-1) : hb_gt_wvw_GetCurWindow() ) : ((UINT) hb_parni( 1 )) ) +#define WVW_WHICH_WINDOW ( HB_ISNIL( 1 ) ? ( hb_gt_wvw_GetMainCoordMode() ? ( ( hb_gt_wvw_GetNumWindows() ) - 1 ) : hb_gt_wvw_GetCurWindow() ) : ( ( UINT ) hb_parni( 1 ) ) ) -#define BLACK RGB( 0x0 ,0x0 ,0x0 ) -#define BLUE RGB( 0x0 ,0x0 ,0x85 ) -#define GREEN RGB( 0x0 ,0x85,0x0 ) -#define CYAN RGB( 0x0 ,0x85,0x85 ) -#define RED RGB( 0x85,0x0 ,0x0 ) -#define MAGENTA RGB( 0x85,0x0 ,0x85 ) -#define BROWN RGB( 0x85,0x85,0x0 ) -#define WHITE RGB( 0xC6,0xC6,0xC6 ) -#define LIGHT_GRAY RGB( 0x60,0x60,0x60 ) -#define BRIGHT_BLUE RGB( 0x00,0x00,0xFF ) -#define BRIGHT_GREEN RGB( 0x60,0xFF,0x60 ) -#define BRIGHT_CYAN RGB( 0x60,0xFF,0xFF ) -#define BRIGHT_RED RGB( 0xF8,0x00,0x26 ) -#define BRIGHT_MAGENTA RGB( 0xFF,0x60,0xFF ) -#define YELLOW RGB( 0xFF,0xFF,0x00 ) -#define BRIGHT_WHITE RGB( 0xFF,0xFF,0xFF ) +#define BLACK RGB( 0x0, 0x0, 0x0 ) +#define BLUE RGB( 0x0, 0x0, 0x85 ) +#define GREEN RGB( 0x0, 0x85, 0x0 ) +#define CYAN RGB( 0x0, 0x85, 0x85 ) +#define RED RGB( 0x85, 0x0, 0x0 ) +#define MAGENTA RGB( 0x85, 0x0, 0x85 ) +#define BROWN RGB( 0x85, 0x85, 0x0 ) +#define WHITE RGB( 0xC6, 0xC6, 0xC6 ) +#define LIGHT_GRAY RGB( 0x60, 0x60, 0x60 ) +#define BRIGHT_BLUE RGB( 0x00, 0x00, 0xFF ) +#define BRIGHT_GREEN RGB( 0x60, 0xFF, 0x60 ) +#define BRIGHT_CYAN RGB( 0x60, 0xFF, 0xFF ) +#define BRIGHT_RED RGB( 0xF8, 0x00, 0x26 ) +#define BRIGHT_MAGENTA RGB( 0xFF, 0x60, 0xFF ) +#define YELLOW RGB( 0xFF, 0xFF, 0x00 ) +#define BRIGHT_WHITE RGB( 0xFF, 0xFF, 0xFF ) -#if defined(__DMC__) +#if defined( __DMC__ ) - #define SBT_TOOLTIPS 0x0800 - #define SB_SETICON (WM_USER+15) - #define SB_SETTIPTEXT (WM_USER+17) - #define SB_GETTIPTEXT (WM_USER+18) - #define TBSTYLE_FLAT 0x0800 - #define TBSTYLE_LIST 0x1000 - #define BTNS_WHOLEDROPDOWN 0x0080 - #define TBSTYLE_CUSTOMERASE 0x2000 - #define IDB_HIST_SMALL_COLOR 8 - #define IDB_HIST_LARGE_COLOR 9 - #define TB_SETMAXTEXTROWS (WM_USER + 60) - #define PBS_VERTICAL 0x04 - #define PBS_SMOOTH 0x01 - #define CCM_FIRST 0x2000 - #define CCM_SETBKCOLOR (CCM_FIRST + 1) - #define PBM_SETBKCOLOR CCM_SETBKCOLOR - #define PBM_SETBARCOLOR (WM_USER+9) - #define PBM_GETRANGE (WM_USER+7) - #define PBM_GETPOS (WM_USER+8) + #define SBT_TOOLTIPS 0x0800 + #define SB_SETICON ( WM_USER + 15 ) + #define SB_SETTIPTEXT ( WM_USER + 17 ) + #define SB_GETTIPTEXT ( WM_USER + 18 ) + #define TBSTYLE_FLAT 0x0800 + #define TBSTYLE_LIST 0x1000 + #define BTNS_WHOLEDROPDOWN 0x0080 + #define TBSTYLE_CUSTOMERASE 0x2000 + #define IDB_HIST_SMALL_COLOR 8 + #define IDB_HIST_LARGE_COLOR 9 + #define TB_SETMAXTEXTROWS ( WM_USER + 60 ) + #define PBS_VERTICAL 0x04 + #define PBS_SMOOTH 0x01 + #define CCM_FIRST 0x2000 + #define CCM_SETBKCOLOR ( CCM_FIRST + 1 ) + #define PBM_SETBKCOLOR CCM_SETBKCOLOR + #define PBM_SETBARCOLOR ( WM_USER + 9 ) + #define PBM_GETRANGE ( WM_USER + 7 ) + #define PBM_GETPOS ( WM_USER + 8 ) - typedef DWORD UINT_PTR; +typedef DWORD UINT_PTR; - typedef struct - { - int iLow; - int iHigh; - } PBRANGE, *PPBRANGE; +typedef struct +{ + int iLow; + int iHigh; +} PBRANGE, * PPBRANGE; - #define ICC_BAR_CLASSES 0x00000004 + #define ICC_BAR_CLASSES 0x00000004 - typedef USHORT COLOR16; +typedef USHORT COLOR16; - typedef struct _TRIVERTEX { - LONG x; - LONG y; - COLOR16 Red; - COLOR16 Green; - COLOR16 Blue; - COLOR16 Alpha; - } TRIVERTEX,*PTRIVERTEX,*LPTRIVERTEX; +typedef struct _TRIVERTEX +{ + LONG x; + LONG y; + COLOR16 Red; + COLOR16 Green; + COLOR16 Blue; + COLOR16 Alpha; +} TRIVERTEX, * PTRIVERTEX, * LPTRIVERTEX; - typedef struct tagINITCOMMONCONTROLSEX { - DWORD dwSize; - DWORD dwICC; - } INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX; +typedef struct tagINITCOMMONCONTROLSEX +{ + DWORD dwSize; + DWORD dwICC; +} INITCOMMONCONTROLSEX, * LPINITCOMMONCONTROLSEX; - WINCOMMCTRLAPI BOOL WINAPI InitCommonControlsEx(LPINITCOMMONCONTROLSEX); +WINCOMMCTRLAPI BOOL WINAPI InitCommonControlsEx( LPINITCOMMONCONTROLSEX ); - typedef struct _GRADIENT_RECT { - ULONG UpperLeft; - ULONG LowerRight; - } GRADIENT_RECT,*PGRADIENT_RECT,*LPGRADIENT_RECT; +typedef struct _GRADIENT_RECT +{ + ULONG UpperLeft; + ULONG LowerRight; +} GRADIENT_RECT, * PGRADIENT_RECT, * LPGRADIENT_RECT; #endif #define WM_MY_UPDATE_CARET ( WM_USER + 0x0101 ) -typedef BOOL ( WINAPI *wvwGradientFill ) ( - HDC hdc, - PTRIVERTEX pVertex, - ULONG dwNumVertex, - PVOID pMesh, - ULONG dwNumMesh, - ULONG dwMode ); +typedef BOOL ( WINAPI * wvwGradientFill )( + HDC hdc, + PTRIVERTEX pVertex, + ULONG dwNumVertex, + PVOID pMesh, + ULONG dwNumMesh, + ULONG dwMode ); #ifndef _MAX_PATH #define _MAX_PATH 256 @@ -328,18 +331,18 @@ typedef BOOL ( WINAPI *wvwGradientFill ) ( typedef struct bitmap_handle { - char szFilename[_MAX_PATH+1]; - HBITMAP hBitmap; - int iWidth, iHeight; - struct bitmap_handle * pNext; + char szFilename[ _MAX_PATH + 1 ]; + HBITMAP hBitmap; + int iWidth, iHeight; + struct bitmap_handle * pNext; } BITMAP_HANDLE; typedef struct picture_handle { - char szFilename[_MAX_PATH+1]; - IPicture * iPicture; - int iWidth, iHeight; - struct picture_handle * pNext; + char szFilename[ _MAX_PATH + 1 ]; + IPicture * iPicture; + int iWidth, iHeight; + struct picture_handle * pNext; } PICTURE_HANDLE; #define WVW_CONTROL_SCROLLBAR 1 @@ -350,269 +353,269 @@ typedef struct picture_handle #define WVW_CONTROL_EDITBOX 5 #define WVW_CONTROL_STATIC 6 -#define WVW_MAXCAPTIONLENGTH 80 +#define WVW_MAXCAPTIONLENGTH 80 typedef struct control_data { - BYTE byCtrlClass; - HWND hWndCtrl; - UINT uiCtrlid; - PHB_ITEM phiCodeBlock; - BOOL bBusy; - UINT uiBusy; - RECT rCtrl, rOffCtrl; + BYTE byCtrlClass; + HWND hWndCtrl; + UINT uiCtrlid; + PHB_ITEM phiCodeBlock; + BOOL bBusy; + UINT uiBusy; + RECT rCtrl, rOffCtrl; - /* SCROLLBAR specifics: */ - /* also used by combobox to store kbd type */ - /* also used by editbox to store editbox type */ - byte bStyle; + /* SCROLLBAR specifics: */ + /* also used by combobox to store kbd type */ + /* also used by editbox to store editbox type */ + byte bStyle; - /* PUSHBUTTON & CHECKBOX specifics: */ - WNDPROC OldProc; + /* PUSHBUTTON & CHECKBOX specifics: */ + WNDPROC OldProc; - struct control_data * pNext; + struct control_data * pNext; } CONTROL_DATA; typedef struct app_data { - BOOL CaretExist; /* TRUE if a caret has been created */ - BOOL displayCaret; /* flag to indicate if caret is on */ + BOOL CaretExist; /* TRUE if a caret has been created */ + BOOL displayCaret; /* flag to indicate if caret is on */ - BOOL Win9X; /* Flag to say if running on Win9X not NT/2000/XP */ - BOOL AltF4Close; /* Can use Alt+F4 to close application */ + BOOL Win9X; /* Flag to say if running on Win9X not NT/2000/XP */ + BOOL AltF4Close; /* Can use Alt+F4 to close application */ - HPEN penWhite; /* White pen to draw GDI elements */ - HPEN penBlack; /* Black pen to draw GDI elements */ - HPEN penWhiteDim; /* White dim pen to draw GDI elements */ - HPEN penDarkGray; /* Dark gray pen to draw GDI elements */ - HPEN penGray; /* Gray pen equivalent to Clipper White */ - HPEN penNull; /* Null pen */ - HPEN OriginalPen; /* Handle da Pen original do Device Context */ - HPEN currentPen; /* Handle to current pen settable at runtime */ - HPEN gridPen; /* Handle da Pen para Grid */ - HBRUSH currentBrush; /* Handle to current brush settable by runtime */ - HBRUSH diagonalBrush; /* Handle to diaoganl brush to draw scrollbars */ - HBRUSH solidBrush; /* Handle to solid brush */ - HBRUSH wvwWhiteBrush; /* Wvw specific White colored brush */ - HBRUSH OriginalBrush; /* Handle da Brush original do Device Context */ + HPEN penWhite; /* White pen to draw GDI elements */ + HPEN penBlack; /* Black pen to draw GDI elements */ + HPEN penWhiteDim; /* White dim pen to draw GDI elements */ + HPEN penDarkGray; /* Dark gray pen to draw GDI elements */ + HPEN penGray; /* Gray pen equivalent to Clipper White */ + HPEN penNull; /* Null pen */ + HPEN OriginalPen; /* Handle da Pen original do Device Context */ + HPEN currentPen; /* Handle to current pen settable at runtime */ + HPEN gridPen; /* Handle da Pen para Grid */ + HBRUSH currentBrush; /* Handle to current brush settable by runtime */ + HBRUSH diagonalBrush; /* Handle to diaoganl brush to draw scrollbars */ + HBRUSH solidBrush; /* Handle to solid brush */ + HBRUSH wvwWhiteBrush; /* Wvw specific White colored brush */ + HBRUSH OriginalBrush; /* Handle da Brush original do Device Context */ - IPicture *iPicture[ WVW_PICTURES_MAX ]; /* Array to hold the Picture Streams to avoid recurring loading and unloading */ - HFONT hUserFonts[ WVW_FONTS_MAX ] ; /* User defined font handles */ - HPEN hUserPens[ WVW_PENS_MAX ]; /* User defined pens */ + IPicture * iPicture[ WVW_PICTURES_MAX ]; /* Array to hold the Picture Streams to avoid recurring loading and unloading */ + HFONT hUserFonts[ WVW_FONTS_MAX ]; /* User defined font handles */ + HPEN hUserPens[ WVW_PENS_MAX ]; /* User defined pens */ - HINSTANCE hMSImg32; /* Handle to the loaded library msimg32.dll */ - wvwGradientFill pfnGF; /* Pointer to Address of the GradientFill function in MSImg32.dll */ + HINSTANCE hMSImg32; /* Handle to the loaded library msimg32.dll */ + wvwGradientFill pfnGF; /* Pointer to Address of the GradientFill function in MSImg32.dll */ - HWND hDlgModeless[ WVW_DLGML_MAX ]; /* Handle to a modeless dialog */ + HWND hDlgModeless[ WVW_DLGML_MAX ]; /* Handle to a modeless dialog */ - PHB_ITEM pFunc[ WVW_DLGML_MAX ]; /* Function pointer for WndProc */ - /* TODO: pcbFunc is redundant and should be removed */ - PHB_ITEM pcbFunc[ WVW_DLGML_MAX ]; /* codeblock for WndProc */ - int iType[ WVW_DLGML_MAX ]; /* Type of Function Pointers - Function 1, Block 2, Method 3 */ + PHB_ITEM pFunc[ WVW_DLGML_MAX ]; /* Function pointer for WndProc */ + /* TODO: pcbFunc is redundant and should be removed */ + PHB_ITEM pcbFunc[ WVW_DLGML_MAX ]; /* codeblock for WndProc */ + int iType[ WVW_DLGML_MAX ]; /* Type of Function Pointers - Function 1, Block 2, Method 3 */ - HWND hDlgModal[ WVW_DLGMD_MAX ]; /* Handle to a modal dialog */ - PHB_ITEM pFuncModal[ WVW_DLGMD_MAX ]; /* Function pointer for WndProc */ - /* TODO: pcbFuncModal is redundant and should be removed */ - PHB_ITEM pcbFuncModal[ WVW_DLGMD_MAX ]; /* codeblock for WndProc */ - int iTypeModal[ WVW_DLGMD_MAX ]; /* Type of Function Pointers - Function 1, Block 2, Method 3 */ + HWND hDlgModal[ WVW_DLGMD_MAX ]; /* Handle to a modal dialog */ + PHB_ITEM pFuncModal[ WVW_DLGMD_MAX ]; /* Function pointer for WndProc */ + /* TODO: pcbFuncModal is redundant and should be removed */ + PHB_ITEM pcbFuncModal[ WVW_DLGMD_MAX ]; /* codeblock for WndProc */ + int iTypeModal[ WVW_DLGMD_MAX ]; /* Type of Function Pointers - Function 1, Block 2, Method 3 */ - BITMAP_HANDLE * pbhBitmapList; - PICTURE_HANDLE * pphPictureList; + BITMAP_HANDLE * pbhBitmapList; + PICTURE_HANDLE * pphPictureList; - BITMAP_HANDLE * pbhUserBitmap; /* User bitmap (wvw_drawimage) */ - UINT uiBMcache; /* number of bitmap cached */ - UINT uiMaxBMcache; /* maximum number of bitmap cached */ + BITMAP_HANDLE * pbhUserBitmap; /* User bitmap (wvw_drawimage) */ + UINT uiBMcache; /* number of bitmap cached */ + UINT uiMaxBMcache; /* maximum number of bitmap cached */ - PHB_DYNS pSymWVW_PAINT; /* Stores pointer to WVW_PAINT function */ - PHB_DYNS pSymWVW_SETFOCUS; /* Stores pointer to WVW_SETFOCUS function */ - PHB_DYNS pSymWVW_KILLFOCUS; /* Stores pointer to WVW_KILLFOCUS function */ - PHB_DYNS pSymWVW_MOUSE; /* Stores pointer to WVW_MOUSE function */ - PHB_DYNS pSymWVW_TBMOUSE; /* Stores pointer to WVW_TBMOUSE function */ - PHB_DYNS pSymWVW_MENUSELECT; /* Stores pointer to WVW_MENUSELECT function*/ + PHB_DYNS pSymWVW_PAINT; /* Stores pointer to WVW_PAINT function */ + PHB_DYNS pSymWVW_SETFOCUS; /* Stores pointer to WVW_SETFOCUS function */ + PHB_DYNS pSymWVW_KILLFOCUS; /* Stores pointer to WVW_KILLFOCUS function */ + PHB_DYNS pSymWVW_MOUSE; /* Stores pointer to WVW_MOUSE function */ + PHB_DYNS pSymWVW_TBMOUSE; /* Stores pointer to WVW_TBMOUSE function */ + PHB_DYNS pSymWVW_MENUSELECT; /* Stores pointer to WVW_MENUSELECT function*/ - PHB_DYNS pSymWVW_SIZE; /* Stores pointer to WVW_SIZE function */ - PHB_DYNS pSymWVW_MOVE; /* Stores pointer to WVW_MOVE function */ + PHB_DYNS pSymWVW_SIZE; /* Stores pointer to WVW_SIZE function */ + PHB_DYNS pSymWVW_MOVE; /* Stores pointer to WVW_MOVE function */ - PHB_DYNS pSymWVW_INPUTFOCUS; /* Stores pointer to WVW_INPUTFOCUS function*/ + PHB_DYNS pSymWVW_INPUTFOCUS; /* Stores pointer to WVW_INPUTFOCUS function*/ - PHB_DYNS pSymWVW_TIMER; /* Stores pointer to WVW_TIMER function */ - PHB_DYNS pSymWVW_ONCTLCOLOR; /* Stores pointer to WVW_TIMER function */ + PHB_DYNS pSymWVW_TIMER; /* Stores pointer to WVW_TIMER function */ + PHB_DYNS pSymWVW_ONCTLCOLOR; /* Stores pointer to WVW_TIMER function */ } APP_DATA; typedef struct win_data { - UINT byWinId; /*x Window's Id, a number 0..WVWMAXWINDOWS */ - TCHAR szWinName[ WVW_MAXWINNAMELENGTH ]; /*x name of Window ~ szAppName for Window 0 */ + UINT byWinId; /*x Window's Id, a number 0..WVWMAXWINDOWS */ + TCHAR szWinName[ WVW_MAXWINNAMELENGTH ]; /*x name of Window ~ szAppName for Window 0 */ - int byLineSpacing; /*x linespacing in pixels */ - int iLSpaceColor; /*x linespacing color index */ + int byLineSpacing; /*x linespacing in pixels */ + int iLSpaceColor; /*x linespacing color index */ - USHORT usRowOfs; /*x offset to Main Window's (0,0) */ - USHORT usColOfs; /*x offset to Main Window's (0,0) */ - int uiDispCount; /*x pending DispEnd() request */ - BOOL bPaintPending; /*x pending WVW_PAINT() execution */ - RECT rPaintPending; /*x rect of pending bPaintPending */ - HWND hStatusBar; /* handle to status bar */ - USHORT usSBHeight; /* height of status bar */ + USHORT usRowOfs; /*x offset to Main Window's (0,0) */ + USHORT usColOfs; /*x offset to Main Window's (0,0) */ + int uiDispCount; /*x pending DispEnd() request */ + BOOL bPaintPending; /*x pending WVW_PAINT() execution */ + RECT rPaintPending; /*x rect of pending bPaintPending */ + HWND hStatusBar; /* handle to status bar */ + USHORT usSBHeight; /* height of status bar */ - HWND hToolBar; /* TB handle to toolbar */ - USHORT usTBHeight; /* TB height of toolbar */ - int iStartStdBitmap, - iStartViewBitmap, - iStartHistBitmap; /* start of bitmap index */ - int iTBImgWidth, - iTBImgHeight; /* image width and height */ - WNDPROC tbOldProc; + HWND hToolBar; /* TB handle to toolbar */ + USHORT usTBHeight; /* TB height of toolbar */ + int iStartStdBitmap, + iStartViewBitmap, + iStartHistBitmap; /* start of bitmap index */ + int iTBImgWidth, + iTBImgHeight; /* image width and height */ + WNDPROC tbOldProc; - CONTROL_DATA * pcdCtrlList; /* lists of created controls, eg. scrollbars */ + CONTROL_DATA * pcdCtrlList; /* lists of created controls, eg. scrollbars */ - HFONT hPBfont; /* handle to font used by pushbuttons & checkboxes */ + HFONT hPBfont; /* handle to font used by pushbuttons & checkboxes */ - HFONT hCBfont; /* handle to font used by comboboxes */ + HFONT hCBfont; /* handle to font used by comboboxes */ - HFONT hEBfont; /* handle to font used by editboxes */ + HFONT hEBfont; /* handle to font used by editboxes */ - HFONT hSBfont; /* handle to font used by pushbuttons & checkboxes */ + HFONT hSBfont; /* handle to font used by pushbuttons & checkboxes */ - HFONT hCXfont; /* handle to font used by checkboxes when 'focused' */ - HFONT hSTfont; /* handle to font used by checkboxes when 'focused' */ + HFONT hCXfont; /* handle to font used by checkboxes when 'focused' */ + HFONT hSTfont; /* handle to font used by checkboxes when 'focused' */ - BOOL bSBPaint; - COLORREF cSBColorForeground; - COLORREF cSBColorBackground; + BOOL bSBPaint; + COLORREF cSBColorForeground; + COLORREF cSBColorBackground; - BOOL bIgnoreWM_SYSCHAR; - BOOL bPaint; - BOOL bGetFocus; + BOOL bIgnoreWM_SYSCHAR; + BOOL bPaint; + BOOL bGetFocus; - POINT PTEXTSIZE; /* size of the fixed width font */ - BOOL FixedFont; /* TRUE if current font is a fixed font */ - int FixedSize[ WVW_MAX_COLS ]; /* buffer for ExtTextOut() to emulate fixed pitch when Proportional font selected */ - USHORT ROWS; /* number of displayable rows in window */ - USHORT COLS; /* number of displayable columns in window */ - COLORREF foreground; /* foreground colour */ + POINT PTEXTSIZE; /* size of the fixed width font */ + BOOL FixedFont; /* TRUE if current font is a fixed font */ + int FixedSize[ WVW_MAX_COLS ]; /* buffer for ExtTextOut() to emulate fixed pitch when Proportional font selected */ + USHORT ROWS; /* number of displayable rows in window */ + USHORT COLS; /* number of displayable columns in window */ + COLORREF foreground; /* foreground colour */ - COLORREF background; /* background colour */ + COLORREF background; /* background colour */ - USHORT BUFFERSIZE; /* size of the screen text buffer */ - BYTE byBuffer[ WVW_MAX_ROWS * WVW_MAX_COLS ]; /* buffer with the text to be displayed on the screen */ - BYTE byColors[ WVW_MAX_ROWS * WVW_MAX_COLS ]; - BYTE *pBuffer; /* " " " */ - BYTE *pColors; /* " " " */ - POINT caretPos; /* the current caret position */ + USHORT BUFFERSIZE; /* size of the screen text buffer */ + BYTE byBuffer[ WVW_MAX_ROWS * WVW_MAX_COLS ]; /* buffer with the text to be displayed on the screen */ + BYTE byColors[ WVW_MAX_ROWS * WVW_MAX_COLS ]; + BYTE * pBuffer; /* " " " */ + BYTE * pColors; /* " " " */ + POINT caretPos; /* the current caret position */ - int CaretSize; /*x this may be specific to each windows, eg. different font size */ - POINT mousePos; /* the last mousedown position */ - BOOL MouseMove; /* Flag to say whether to return mouse movement events */ - HWND hWnd; /* the window handle */ - int Keys[ WVW_CHAR_QUEUE_SIZE ]; /* Array to hold the characters & events */ - int keyPointerIn; /* Offset into key array for character to be placed */ - int keyPointerOut; /* Offset into key array of next character to read */ - int keyLast; + int CaretSize; /*x this may be specific to each windows, eg. different font size */ + POINT mousePos; /* the last mousedown position */ + BOOL MouseMove; /* Flag to say whether to return mouse movement events */ + HWND hWnd; /* the window handle */ + int Keys[ WVW_CHAR_QUEUE_SIZE ]; /* Array to hold the characters & events */ + int keyPointerIn; /* Offset into key array for character to be placed */ + int keyPointerOut; /* Offset into key array of next character to read */ + int keyLast; - RECT RectInvalid; /* Invalid rectangle if DISPBEGIN() active */ - HFONT hFont; - int fontHeight; /* requested font height */ - int fontWidth ; /* requested font width */ - int fontWeight; /* Bold level */ - int fontQuality; - char fontFace[ LF_FACESIZE ]; /* requested font face name LF_FACESIZE #defined in wingdi.h */ + RECT RectInvalid; /* Invalid rectangle if DISPBEGIN() active */ + HFONT hFont; + int fontHeight; /* requested font height */ + int fontWidth; /* requested font width */ + int fontWeight; /* Bold level */ + int fontQuality; + char fontFace[ LF_FACESIZE ]; /* requested font face name LF_FACESIZE #defined in wingdi.h */ - int LastMenuEvent; /* Last menu item selected */ - int MenuKeyEvent; /* User definable event number for windows menu command */ - BOOL CentreWindow; /* True if window is to be Reset into centre of window */ + int LastMenuEvent; /* Last menu item selected */ + int MenuKeyEvent; /* User definable event number for windows menu command */ + BOOL CentreWindow; /* True if window is to be Reset into centre of window */ - /* if CentreWindow is FALSE, two following settings are examined */ - BOOL HCentreWindow; /* True if window is to be Reset into centre of window, horizontally */ - BOOL VCentreWindow; /* True if window is to be Reset into centre of window, vertically */ + /* if CentreWindow is FALSE, two following settings are examined */ + BOOL HCentreWindow; /* True if window is to be Reset into centre of window, horizontally */ + BOOL VCentreWindow; /* True if window is to be Reset into centre of window, vertically */ - int CodePage; /* Code page to use for display characters */ + int CodePage; /* Code page to use for display characters */ - BOOL InvalidateWindow; /* Flag for controlling whether to use ScrollWindowEx() */ - BOOL EnableShortCuts; /* Determines whether ALT key enables menu or system menu */ + BOOL InvalidateWindow; /* Flag for controlling whether to use ScrollWindowEx() */ + BOOL EnableShortCuts; /* Determines whether ALT key enables menu or system menu */ - HDC hdc; /* Handle to Windows Device Context */ + HDC hdc; /* Handle to Windows Device Context */ - HMENU hPopup; /* Handle of context menu invokable with right click */ + HMENU hPopup; /* Handle of context menu invokable with right click */ - HDC hCompDC; /* Compatible DC to _s.hdc */ - HWND hWndTT; /* Handle to hold tooltip information */ - BOOL bToolTipActive; /* Flag to set whether tooltip is active or not */ - HICON hIcon; + HDC hCompDC; /* Compatible DC to _s.hdc */ + HWND hWndTT; /* Handle to hold tooltip information */ + BOOL bToolTipActive; /* Flag to set whether tooltip is active or not */ + HICON hIcon; } WIN_DATA; typedef struct wvw_data { - UINT s_uiPaintRefresh ; /* milliseconds between timer check */ + UINT s_uiPaintRefresh; /* milliseconds between timer check */ - BOOL s_bMainCoordMode ; /* in this mode, all HB_GT_FUNC() uses Main Window's coordinate */ + BOOL s_bMainCoordMode; /* in this mode, all HB_GT_FUNC() uses Main Window's coordinate */ - BOOL s_bVertCaret ; /* if TRUE, caret is in Vertical style */ + BOOL s_bVertCaret; /* if TRUE, caret is in Vertical style */ - BOOL s_bNOSTARTUPSUBWINDOW ; /* if TRUE, subwindow will not be displayed during opening */ - /* use WVW_NOSTARTUPSUBWINDOW() to check/set it */ + BOOL s_bNOSTARTUPSUBWINDOW; /* if TRUE, subwindow will not be displayed during opening */ + /* use WVW_NOSTARTUPSUBWINDOW() to check/set it */ - BOOL s_bDefCentreWindow ; /* default CentreWindow setting for subwindows */ + BOOL s_bDefCentreWindow; /* default CentreWindow setting for subwindows */ - BOOL s_bDefHCentreWindow ; /* default HCentreWindow setting for subwindows */ - BOOL s_bDefVCentreWindow ; /* default VCentreWindow setting for subwindows */ + BOOL s_bDefHCentreWindow; /* default HCentreWindow setting for subwindows */ + BOOL s_bDefVCentreWindow; /* default VCentreWindow setting for subwindows */ - int s_byDefLineSpacing ; /* default line spacing */ + int s_byDefLineSpacing; /* default line spacing */ - int s_iDefLSpaceColor ; /* if >; //= 0 this will be the color index for spacing between lines */ + int s_iDefLSpaceColor; /* if >; //= 0 this will be the color index for spacing between lines */ - BOOL s_bAllowNonTop ; /* allow non-topmost window's control to accept input */ + BOOL s_bAllowNonTop; /* allow non-topmost window's control to accept input */ - BOOL s_bRecurseCBlock ; /* allow control's codeblock to recurse */ + BOOL s_bRecurseCBlock; /* allow control's codeblock to recurse */ - LOGFONT s_lfPB ; /* default font for pushbuttons */ + LOGFONT s_lfPB; /* default font for pushbuttons */ - LOGFONT s_lfSB ; /* default font for statusbar */ - LOGFONT s_lfCB ; /* default font for comboboxes */ + LOGFONT s_lfSB; /* default font for statusbar */ + LOGFONT s_lfCB; /* default font for comboboxes */ - LOGFONT s_lfEB ; /* default font for editboxes */ + LOGFONT s_lfEB; /* default font for editboxes */ - LOGFONT s_lfCX ; /* font for 'focused'checkbox */ - LOGFONT s_lfST ; /* font for control */ + LOGFONT s_lfCX; /* font for 'focused'checkbox */ + LOGFONT s_lfST; /* font for control */ - HWND hWndTT ; /* Window handle Tool Tip */ + HWND hWndTT; /* Window handle Tool Tip */ /* read only by user ***/ /* for GTWVW private use: ***********************************************/ - BOOL s_bQuickSetMode ; /* quick SetMode(), to reset maxrow() and maxcol() only */ + BOOL s_bQuickSetMode; /* quick SetMode(), to reset maxrow() and maxcol() only */ - BOOL s_bFlashingWindow ; - /* topmost window is flashing - due to invalid input on other - window */ + BOOL s_bFlashingWindow; + /* topmost window is flashing + due to invalid input on other + window */ - int s_iScrolling ; /* scrollbar is scrolling */ - int s_iWrongButtonUp ; /* number of consecutive scrollbar's WM_LBUTTONUP encountered by gtProcessMessages */ - int s_iMaxWrongButtonUp ; - /* max number of s_iWrongButtonUp. If it goes higher than this number, - the scrollbar is forced to stop */ + int s_iScrolling; /* scrollbar is scrolling */ + int s_iWrongButtonUp; /* number of consecutive scrollbar's WM_LBUTTONUP encountered by gtProcessMessages */ + int s_iMaxWrongButtonUp; + /* max number of s_iWrongButtonUp. If it goes higher than this number, + the scrollbar is forced to stop */ - TCHAR szAppName[13] ; - TCHAR szSubWinName[25] ; - BOOL s_bSWRegistered ; + TCHAR szAppName[ 13 ]; + TCHAR szSubWinName[ 25 ]; + BOOL s_bSWRegistered; - HINSTANCE hInstance; + HINSTANCE hInstance; - UINT s_usNumWindows; /*number of windows */ - UINT s_usCurWindow ; /*current window handled by HB_GT_FUNC(...) */ + UINT s_usNumWindows; /*number of windows */ + UINT s_usCurWindow; /*current window handled by HB_GT_FUNC(...) */ - WIN_DATA *s_pWindows[ WVW_MAXWINDOWS ]; /*array of WIN_DATA */ - APP_DATA *s_sApp; /*application wide vars */ + WIN_DATA * s_pWindows[ WVW_MAXWINDOWS ]; /*array of WIN_DATA */ + APP_DATA * s_sApp; /*application wide vars */ -}WVW_DATA ; +}WVW_DATA; - //#define HB_RETHANDLE( h ) hb_retptr( ( void * ) ( h ) ) - //#define HB_PARHANDLE( n ) hb_parptr( n ) - //#define HB_STOREHANDLE( h, n ) hb_storptr( ( void * ) ( h ), n ) +//#define HB_RETHANDLE( h ) hb_retptr( ( void * ) ( h ) ) +//#define HB_PARHANDLE( n ) hb_parptr( n ) +//#define HB_STOREHANDLE( h, n ) hb_storptr( ( void * ) ( h ), n ) #define HB_RETHANDLE( h ) hb_retnl( ( LONG ) ( h ) ) #define HB_PARHANDLE( n ) ( ( LONG ) hb_parnl( n ) ) #define HB_STOREHANDLE( h, n ) hb_stornl( ( LONG ) ( h ), n ) @@ -622,9 +625,9 @@ HB_EXTERN_BEGIN extern BOOL hb_gt_wvw_GetMainCoordMode( void ); extern UINT hb_gt_wvw_GetNumWindows( void ); extern UINT hb_gt_wvw_GetCurWindow( void ); -extern APP_DATA* hb_gt_wvwGetAppData( void ); -extern WIN_DATA * hb_gt_wvw_GetWindowsData( UINT iWin ) ; -extern WVW_DATA * hb_getWvwData( void ) ; +extern APP_DATA * hb_gt_wvwGetAppData( void ); +extern WIN_DATA * hb_gt_wvw_GetWindowsData( UINT iWin ); +extern WVW_DATA * hb_getWvwData( void ); extern char * hb_gt_wvw_GetAppName( void ); extern void hb_gt_wvwResetWindow( UINT usWinNum ); extern BOOL hb_gt_wvwSetMenuKeyEvent( UINT usWinNum, int iMenuKeyEvent ); @@ -641,35 +644,35 @@ extern RECT hb_gt_wvwGetXYFromColRowRect( WIN_DATA * pWindowData, RECT colrow extern POINT hb_gt_wvwGetXYFromColRow( WIN_DATA * pWindowData, USHORT col, USHORT row ); extern DWORD hb_gt_wvwGetColorData( int iIndex ); -extern BOOL GetImageDimension(const char * image, int * pWidth, int * pHeight); -extern BOOL GetIPictDimension(IPicture * pPic, int * pWidth, int * pHeight); +extern BOOL GetImageDimension( const char * image, int * pWidth, int * pHeight ); +extern BOOL GetIPictDimension( IPicture * pPic, int * pWidth, int * pHeight ); extern LRESULT CALLBACK hb_gt_wvwTBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); extern void hb_gt_wvwTBinitSize( WIN_DATA * pWindowData, HWND hWndTB ); -extern int IndexToCommand(HWND hWndTB, int iIndex); -extern int CommandToIndex(HWND hWndTB, int iCommand); -extern BOOL AddTBButton(HWND hWndToolbar, char * szBitmap, UINT uiBitmap, char * pszLabel, int iCommand, int iBitmapType, BOOL bMap3Dcolors, WIN_DATA * pWindowData, BOOL bDropdown); +extern int IndexToCommand( HWND hWndTB, int iIndex ); +extern int CommandToIndex( HWND hWndTB, int iCommand ); +extern BOOL AddTBButton( HWND hWndToolbar, char * szBitmap, UINT uiBitmap, char * pszLabel, int iCommand, int iBitmapType, BOOL bMap3Dcolors, WIN_DATA * pWindowData, BOOL bDropdown ); extern RECT hb_gt_wvwGetColRowFromXYRect( WIN_DATA * pWIndowData, RECT xy ); extern BYTE hb_wvw_LineHeight( WIN_DATA * pWindowData ); extern DWORD hb_gt_wvwProcessMessages( WIN_DATA * pWindowData ); /* control (eg. scrollbar) supporters: */ -extern HWND FindControlHandle(UINT usWinNum, BYTE byCtrlClass, UINT uiCtrlid, byte * pbStyle); -extern UINT FindControlId(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, byte * pbStyle); -extern UINT LastControlId(UINT usWinNum, BYTE byCtrlClass); -extern void AddControlHandle(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT uiCtrlid, PHB_ITEM phiCodeBlock, RECT rCtrl, RECT rOffCtrl, byte bStyle); +extern HWND FindControlHandle( UINT usWinNum, BYTE byCtrlClass, UINT uiCtrlid, byte * pbStyle ); +extern UINT FindControlId( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, byte * pbStyle ); +extern UINT LastControlId( UINT usWinNum, BYTE byCtrlClass ); +extern void AddControlHandle( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT uiCtrlid, PHB_ITEM phiCodeBlock, RECT rCtrl, RECT rOffCtrl, byte bStyle ); -extern CONTROL_DATA * GetControlData(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT uiCtrlid); +extern CONTROL_DATA * GetControlData( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, UINT uiCtrlid ); -extern BOOL StoreControlProc(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, WNDPROC OldProc); -extern WNDPROC GetControlProc(UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl); +extern BOOL StoreControlProc( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl, WNDPROC OldProc ); +extern WNDPROC GetControlProc( UINT usWinNum, BYTE byCtrlClass, HWND hWndCtrl ); extern LRESULT CALLBACK hb_gt_wvwXBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); extern LRESULT CALLBACK hb_gt_wvwBtnProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); -extern UINT ButtonCreate( UINT usWinNum, USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, LPCTSTR lpszCaption, +extern UINT ButtonCreate( UINT usWinNum, USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, LPCTSTR lpszCaption, char * szBitmap, UINT uiBitmap, PHB_ITEM phbiCodeBlock, int iOffTop, int iOffLeft, int iOffBottom, int iOffRight, double dStretch, BOOL bMap3Dcolors, int iStyle ); extern LRESULT CALLBACK hb_gt_wvwCBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); -extern LONG GetFontDialogUnits(HWND h,HFONT f); +extern LONG GetFontDialogUnits( HWND h, HFONT f ); extern HFONT hb_gt_wvwGetFont( const char * pszFace, int iHeight, int iWidth, int iWeight, int iQuality, int iCodePage ); extern LRESULT CALLBACK hb_gt_wvwEBProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); extern USHORT hb_gt_wvwGetMouseX( WIN_DATA * pWindowData ); diff --git a/harbour/extras/gtwvw/hbole.h b/harbour/extras/gtwvw/hbole.h index 5c2dd8e15e..60570b1130 100644 --- a/harbour/extras/gtwvw/hbole.h +++ b/harbour/extras/gtwvw/hbole.h @@ -59,36 +59,36 @@ #ifndef HB_OLE_H_ #define HB_OLE_H_ -#if defined(_MSC_VER) && !defined(HB_OS_WIN_64) && \ - !defined(__LCC__) && !defined(__POCC__) && !defined(__XCC__) +#if defined( _MSC_VER ) && ! defined( HB_OS_WIN_64 ) && \ + ! defined( __LCC__ ) && ! defined( __POCC__ ) && ! defined( __XCC__ ) #ifndef CINTERFACE -#define CINTERFACE 1 +#define CINTERFACE 1 #endif #ifndef _REFGUID_DEFINED -#define _REFGUID_DEFINED 1 -#define REFGUID const GUID * const +#define _REFGUID_DEFINED 1 +#define REFGUID const GUID * const #endif #ifndef _REFIID_DEFINED -#define _REFIID_DEFINED 1 -#define REFIID const IID * const +#define _REFIID_DEFINED 1 +#define REFIID const IID * const #endif #ifndef _REFCLSID_DEFINED -#define _REFCLSID_DEFINED 1 -#define REFCLSID const IID * const +#define _REFCLSID_DEFINED 1 +#define REFCLSID const IID * const #endif #ifndef _REFFMTID_DEFINED -#define _REFFMTID_DEFINED 1 -#define REFFMTID const IID * const +#define _REFFMTID_DEFINED 1 +#define REFFMTID const IID * const #endif #ifndef _SYS_GUID_OPERATOR_EQ_ -#define _SYS_GUID_OPERATOR_EQ_ 1 -#endif // _SYS_GUID_OPERATOR_EQ_ +#define _SYS_GUID_OPERATOR_EQ_ 1 +#endif // _SYS_GUID_OPERATOR_EQ_ -#endif // _MSC_VER -#endif // HB_OLE_H_ +#endif // _MSC_VER +#endif // HB_OLE_H_ diff --git a/harbour/extras/gtwvw/wvwcheck.c b/harbour/extras/gtwvw/wvwcheck.c index cfd45d8f90..8762766d32 100644 --- a/harbour/extras/gtwvw/wvwcheck.c +++ b/harbour/extras/gtwvw/wvwcheck.c @@ -1,5 +1,5 @@ /* -* $Id$ + * $Id$ */ /* @@ -83,21 +83,21 @@ /*WVW_CXcreate( [nWinNum], nTop, nLeft, nBottom, nRight, cText, cImage/nImage, bBlock, aOffset,; * nStretchBitmap, lMap3Dcolors) - *create CHECKBOX for window nWinNum - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nBottom: row of bottom/right corner (in character unit) defaults==nTop - *nRight: col of bottom/right corner (in character unit) defaults==?? - *cText: caption, default == "" + **create CHECKBOX for window nWinNum + **nTop: row of top/left corner (in character unit) + **nLeft: col of top/left corner (in character unit) + **nBottom: row of bottom/right corner (in character unit) defaults==nTop + **nRight: col of bottom/right corner (in character unit) defaults==?? + **cText: caption, default == "" * - *cImage: bitmap file name, can be supplied as nImage: bitmap resource id - *nStretchBitmap: a number between 0 and 1 (inclusive) as a factor to + **cImage: bitmap file name, can be supplied as nImage: bitmap resource id + **nStretchBitmap: a number between 0 and 1 (inclusive) as a factor to * stretch the bitmap. * 1.0: bitmap covers the whole button * 0.5: bitmap covers 50% of button * 0: bitmap is not stretch * (default is 1) - *lMap3Dcolors: defaults to .f. + **lMap3Dcolors: defaults to .f. * if .t. the following color mapping will be performed: * RGB(192,192,192) --> COLOR_3DFACE ("transparent") * RGB(128,128,128) --> COLOR_3DSHADOW @@ -105,91 +105,94 @@ * This might be desirable to have transparent effect. * LIMITATION: this will work on 256 colored bitmaps only * - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust + **aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust * dimension of CHECKBOX. * defaults for CHECKBOX: {-2,-2,+2,+2} * - *bBlock: codeblock to execute on every BN_CLICK event. + **bBlock: codeblock to execute on every BN_CLICK event. * This codeblock will be evaluated with these parameters: * nWinNum: window number * nCXid : CHECKBOX id * - *returns control id of newly created CHECKBOX of windows nWinNum - *returns 0 if failed + **returns control id of newly created CHECKBOX of windows nWinNum + **returns 0 if failed * - *example: + **example: */ -HB_FUNC( WVW_CXCREATE) +HB_FUNC( WVW_CXCREATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int iOffTop, iOffLeft, iOffBottom, iOffRight; + UINT usWinNum = WVW_WHICH_WINDOW; + int iOffTop, iOffLeft, iOffBottom, iOffRight; // int iStyle; - UINT uiPBid; - USHORT usTop = ( BYTE )hb_parni( 2 ), - usLeft = ( BYTE )hb_parni( 3 ), - usBottom = ( BYTE )hb_parni( 4 ), - usRight = ( BYTE )hb_parni( 5 ); - LPCTSTR lpszCaption = HB_ISCHAR(6) ? hb_parcx(6) : NULL; - char * szBitmap = HB_ISCHAR(7) ? (char*) hb_parcx(7) : NULL; - UINT uiBitmap = HB_ISNUM(7) ? (UINT) hb_parni(7) : 0; - double dStretch = !HB_ISNIL(10) ? hb_parnd(10) : 1; - BOOL bMap3Dcolors = HB_ISLOG(11) ? (BOOL) hb_parl(11) : FALSE; + UINT uiPBid; + USHORT usTop = ( BYTE ) hb_parni( 2 ), + usLeft = ( BYTE ) hb_parni( 3 ), + usBottom = ( BYTE ) hb_parni( 4 ), + usRight = ( BYTE ) hb_parni( 5 ); + LPCTSTR lpszCaption = HB_ISCHAR( 6 ) ? hb_parcx( 6 ) : NULL; + char * szBitmap = HB_ISCHAR( 7 ) ? ( char * ) hb_parcx( 7 ) : NULL; + UINT uiBitmap = HB_ISNUM( 7 ) ? ( UINT ) hb_parni( 7 ) : 0; + double dStretch = ! HB_ISNIL( 10 ) ? hb_parnd( 10 ) : 1; + BOOL bMap3Dcolors = HB_ISLOG( 11 ) ? ( BOOL ) hb_parl( 11 ) : FALSE; - if (!HB_ISBLOCK(8)) + if( ! HB_ISBLOCK( 8 ) ) { - hb_retnl(0); - return; + hb_retnl( 0 ); + return; } - iOffTop = !HB_ISNIL( 9 ) ? hb_parvni( 9,1 ) : -2 ; - iOffLeft = !HB_ISNIL( 9 ) ? hb_parvni( 9,2 ) : -2 ; - iOffBottom = !HB_ISNIL( 9 ) ? hb_parvni( 9,3 ) : +2 ; - iOffRight = !HB_ISNIL( 9 ) ? hb_parvni( 9,4 ) : +2; + iOffTop = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 1 ) : -2; + iOffLeft = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 2 ) : -2; + iOffBottom = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 3 ) : +2; + iOffRight = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 4 ) : +2; - uiPBid = ButtonCreate( usWinNum, usTop, usLeft, usBottom, usRight, lpszCaption, - szBitmap, uiBitmap, hb_param( 8, HB_IT_BLOCK ), - iOffTop, iOffLeft, iOffBottom, iOffRight, - dStretch, bMap3Dcolors, - BS_AUTOCHECKBOX); - hb_retnl( (LONG) uiPBid ); + uiPBid = ButtonCreate( usWinNum, usTop, usLeft, usBottom, usRight, lpszCaption, + szBitmap, uiBitmap, hb_param( 8, HB_IT_BLOCK ), + iOffTop, iOffLeft, iOffBottom, iOffRight, + dStretch, bMap3Dcolors, + BS_AUTOCHECKBOX ); + hb_retnl( ( LONG ) uiPBid ); } /*WVW_CXdestroy( [nWinNum], nCXid ) - *destroy checkbox nCXid for window nWinNum + *destroy checkbox nCXid for window nWinNum */ -HB_FUNC( WVW_CXDESTROY) +HB_FUNC( WVW_CXDESTROY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - UINT uiCXid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - CONTROL_DATA * pcdPrev = NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT uiCXid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + CONTROL_DATA * pcdPrev = NULL; - while (pcd) + while( pcd ) { - if (pcd->byCtrlClass == WVW_CONTROL_CHECKBOX && pcd->uiCtrlid == uiCXid) - { - break; - } - pcdPrev = pcd; - pcd = pcd->pNext; + if( pcd->byCtrlClass == WVW_CONTROL_CHECKBOX && pcd->uiCtrlid == uiCXid ) + { + break; + } + pcdPrev = pcd; + pcd = pcd->pNext; } - if (pcd==NULL) { return; } - - DestroyWindow (pcd->hWndCtrl) ; - - if (pcdPrev==NULL) + if( pcd == NULL ) { - pWindowData->pcdCtrlList = pcd->pNext; + return; + } + + DestroyWindow( pcd->hWndCtrl ); + + if( pcdPrev == NULL ) + { + pWindowData->pcdCtrlList = pcd->pNext; } else { - pcdPrev->pNext = pcd->pNext; + pcdPrev->pNext = pcd->pNext; } - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); @@ -199,135 +202,135 @@ HB_FUNC( WVW_CXDESTROY) } /*WVW_CXsetFocus( [nWinNum], nButtonId ) - *set the focus to checkbox nButtonId in window nWinNum + *set the focus to checkbox nButtonId in window nWinNum */ HB_FUNC( WVW_CXSETFOCUS ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - byte bStyle; - HWND hWndCX = FindControlHandle(usWinNum, WVW_CONTROL_CHECKBOX, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + byte bStyle; + HWND hWndCX = FindControlHandle( usWinNum, WVW_CONTROL_CHECKBOX, uiCtrlId, &bStyle ); - if (hWndCX) - { + if( hWndCX ) + { - hb_retl( SetFocus(hWndCX) != NULL ); - } - else - { - hb_retl(FALSE); - } + hb_retl( SetFocus( hWndCX ) != NULL ); + } + else + { + hb_retl( FALSE ); + } } /*WVW_CXenable( [nWinNum], nButtonId, [lToggle] ) - *enable/disable checkbox nButtonId on window nWinNum - *(lToggle defaults to .t., ie. enabling the checkbox) - *return previous state of the checkbox (TRUE:enabled FALSE:disabled) - *(if nButtonId is invalid, this function returns FALSE too) + *enable/disable checkbox nButtonId on window nWinNum + *(lToggle defaults to .t., ie. enabling the checkbox) + *return previous state of the checkbox (TRUE:enabled FALSE:disabled) + *(if nButtonId is invalid, this function returns FALSE too) */ HB_FUNC( WVW_CXENABLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - BOOL bEnable = HB_ISNIL(3) ? TRUE : hb_parl(3); - byte bStyle; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndCX = FindControlHandle(usWinNum, WVW_CONTROL_CHECKBOX, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + BOOL bEnable = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + byte bStyle; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndCX = FindControlHandle( usWinNum, WVW_CONTROL_CHECKBOX, uiCtrlId, &bStyle ); - if (hWndCX) - { - hb_retl( EnableWindow(hWndCX, bEnable)==0 ); + if( hWndCX ) + { + hb_retl( EnableWindow( hWndCX, bEnable ) == 0 ); - if (!bEnable) - { - SetFocus( pWindowData->hWnd ); - } - } - else - { - hb_retl(FALSE); - } + if( ! bEnable ) + { + SetFocus( pWindowData->hWnd ); + } + } + else + { + hb_retl( FALSE ); + } } /*WVW_CXsetcodeblock( [nWinNum], nCXid, bBlock ) - *assign (new) codeblock bBlock to button nCXid for window nWinNum + *assign (new) codeblock bBlock to button nCXid for window nWinNum * * return .t. if successful */ HB_FUNC( WVW_CXSETCODEBLOCK ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WVW_DATA * pData= hb_getWvwData( ) ; - UINT uiCXid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_CHECKBOX, NULL, uiCXid); - PHB_ITEM phiCodeBlock = hb_param( 3, HB_IT_BLOCK ); - BOOL bOldSetting = pData->s_bRecurseCBlock; + UINT usWinNum = WVW_WHICH_WINDOW; + WVW_DATA * pData = hb_getWvwData(); + UINT uiCXid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_CHECKBOX, NULL, uiCXid ); + PHB_ITEM phiCodeBlock = hb_param( 3, HB_IT_BLOCK ); + BOOL bOldSetting = pData->s_bRecurseCBlock; - if (!phiCodeBlock || pcd==NULL || pcd->bBusy) + if( ! phiCodeBlock || pcd == NULL || pcd->bBusy ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } pData->s_bRecurseCBlock = FALSE; - pcd->bBusy = TRUE; + pcd->bBusy = TRUE; - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); } - pcd->phiCodeBlock = hb_itemNew( phiCodeBlock ); + pcd->phiCodeBlock = hb_itemNew( phiCodeBlock ); - pcd->bBusy = FALSE; + pcd->bBusy = FALSE; pData->s_bRecurseCBlock = bOldSetting; hb_retl( TRUE ); } /*WVW_CXsetcheck( [nWinNum], nCXid, nCheckState ) - *assigns check-state of checkbox nCXid + *assigns check-state of checkbox nCXid * 0==unchecked BST_UNCHECKED * 1==checked BST_CHECKED * 2==indeterminate BST_INDETERMINATE - *this function always returns .t. + **this function always returns .t. */ HB_FUNC( WVW_CXSETCHECK ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCXid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - ULONG ulCheck = (ULONG) ( HB_ISNIL( 3 ) ? BST_CHECKED : hb_parni( 3 ) ); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_CHECKBOX, NULL, uiCXid); + UINT uiCXid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + ULONG ulCheck = ( ULONG ) ( HB_ISNIL( 3 ) ? BST_CHECKED : hb_parni( 3 ) ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_CHECKBOX, NULL, uiCXid ); - if (pcd->hWndCtrl) + if( pcd->hWndCtrl ) { - SendMessage(pcd->hWndCtrl, - BM_SETCHECK, (WPARAM) ulCheck, (LPARAM) 0); + SendMessage( pcd->hWndCtrl, + BM_SETCHECK, ( WPARAM ) ulCheck, ( LPARAM ) 0 ); } hb_retl( TRUE ); } /*WVW_CXgetcheck( [nWinNum], nCXid ) - *returns check-state of checkbox nCXid + *returns check-state of checkbox nCXid * 0==unchecked BST_UNCHECKED * 1==checked BST_CHECKED * 2==indeterminate BST_INDETERMINATE */ HB_FUNC( WVW_CXGETCHECK ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCXid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - ULONG ulCheck = 0; - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_CHECKBOX, NULL, uiCXid); + UINT uiCXid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + ULONG ulCheck = 0; + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_CHECKBOX, NULL, uiCXid ); - if (pcd->hWndCtrl) + if( pcd->hWndCtrl ) { - ulCheck = SendMessage(pcd->hWndCtrl, - BM_GETCHECK, (WPARAM) 0, (LPARAM) 0); + ulCheck = SendMessage( pcd->hWndCtrl, + BM_GETCHECK, ( WPARAM ) 0, ( LPARAM ) 0 ); } hb_retnl( ulCheck ); @@ -336,54 +339,54 @@ HB_FUNC( WVW_CXGETCHECK ) /*WVW_CXSetFont([nWinNum], cFontFace, nHeight, nWidth, nWeight, nQUality,; * lItalic, lUnderline, lStrikeout * -*/ + */ HB_FUNC( WVW_CXSETFONT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WVW_DATA * pData= hb_getWvwData( ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * pData = hb_getWvwData(); - BOOL retval = TRUE; + BOOL retval = TRUE; - pData->s_lfCX.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); - pData->s_lfCX.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfCX.lfWidth : hb_parni( 4 ); - pData->s_lfCX.lfEscapement = 0; - pData->s_lfCX.lfOrientation = 0; - pData->s_lfCX.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfCX.lfWeight : hb_parni( 5 ); - pData->s_lfCX.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfCX.lfItalic : ( BYTE )hb_parl( 7 ); - pData->s_lfCX.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfCX.lfUnderline : ( BYTE )hb_parl( 8 ); - pData->s_lfCX.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfCX.lfStrikeOut : ( BYTE )hb_parl( 9 ); - pData->s_lfCX.lfCharSet = DEFAULT_CHARSET; + pData->s_lfCX.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); + pData->s_lfCX.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfCX.lfWidth : hb_parni( 4 ); + pData->s_lfCX.lfEscapement = 0; + pData->s_lfCX.lfOrientation = 0; + pData->s_lfCX.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfCX.lfWeight : hb_parni( 5 ); + pData->s_lfCX.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfCX.lfItalic : ( BYTE ) hb_parl( 7 ); + pData->s_lfCX.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfCX.lfUnderline : ( BYTE ) hb_parl( 8 ); + pData->s_lfCX.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfCX.lfStrikeOut : ( BYTE ) hb_parl( 9 ); + pData->s_lfCX.lfCharSet = DEFAULT_CHARSET; - pData->s_lfCX.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfCX.lfQuality : ( BYTE )hb_parni( 6 ); - pData->s_lfCX.lfPitchAndFamily = FF_DONTCARE; - if ( HB_ISCHAR( 2 ) ) + pData->s_lfCX.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfCX.lfQuality : ( BYTE ) hb_parni( 6 ); + pData->s_lfCX.lfPitchAndFamily = FF_DONTCARE; + if( HB_ISCHAR( 2 ) ) { strcpy( pData->s_lfCX.lfFaceName, hb_parcx( 2 ) ); } - if (pWindowData->hCXfont) + if( pWindowData->hCXfont ) { HFONT hOldFont = pWindowData->hCXfont; - HFONT hFont = CreateFontIndirect( &pData->s_lfCX ); - if (hFont) + HFONT hFont = CreateFontIndirect( &pData->s_lfCX ); + if( hFont ) { /*CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) - { - if ((pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON) && + while (pcd) + { + if ((pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON) && ((HFONT) SendMessage( pcd->hWndCtrl, WM_GETFONT, (WPARAM) 0, (LPARAM) 0) == hOldFont) ) - { + { SendMessage( pcd->hWndCtrl, WM_SETFONT, (WPARAM) hFont, (LPARAM) TRUE); - } + } - pcd = pcd->pNext; - } */ + pcd = pcd->pNext; + } */ pWindowData->hCXfont = hFont; - DeleteObject( (HFONT) hOldFont ); + DeleteObject( ( HFONT ) hOldFont ); } else @@ -397,22 +400,22 @@ HB_FUNC( WVW_CXSETFONT ) HB_FUNC( WVW_CXSTATUSFONT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - UINT uiPBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - BOOL bFocus = HB_ISNIL(3) ? TRUE : hb_parl(3); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_PUSHBUTTON, NULL, uiPBid); + UINT uiPBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + BOOL bFocus = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_PUSHBUTTON, NULL, uiPBid ); - if (pcd->hWndCtrl) + if( pcd->hWndCtrl ) { - if ( bFocus ) + if( bFocus ) { - SendMessage( pcd->hWndCtrl, WM_SETFONT, (WPARAM) pWindowData->hCXfont, (LPARAM) TRUE); + SendMessage( pcd->hWndCtrl, WM_SETFONT, ( WPARAM ) pWindowData->hCXfont, ( LPARAM ) TRUE ); } else { - SendMessage( pcd->hWndCtrl, WM_SETFONT, (WPARAM) pWindowData->hPBfont, (LPARAM) TRUE); + SendMessage( pcd->hWndCtrl, WM_SETFONT, ( WPARAM ) pWindowData->hPBfont, ( LPARAM ) TRUE ); } } @@ -432,93 +435,93 @@ HB_FUNC( WVW_CXSTATUSFONT ) /*WVW_PGcreate( [nWinNum], nTop, nLeft, nBottom, nRight, [aOffset], * [nBackColor], [nBarColor], [lSmooth], [lVertical]) - *create progress bar for window nWinNum - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nBottom: row of bottom/right corner (in character unit) - *nRight: col of bottom/right corner (in character unit) - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust + **create progress bar for window nWinNum + **nTop: row of top/left corner (in character unit) + **nLeft: col of top/left corner (in character unit) + **nBottom: row of bottom/right corner (in character unit) + **nRight: col of bottom/right corner (in character unit) + **aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust * dimension of progress bar. defaults: {0, 0, 0, 0} - *nBackColor: color of background (as RGB value) - *nBarColor: color of bar (as RGB value) - *lSmooth: if .t., draw as smooth bar (default is .f.) - *lVertical: if .t., draw as vertical progress bar (default is .f.) + **nBackColor: color of background (as RGB value) + **nBarColor: color of bar (as RGB value) + **lSmooth: if .t., draw as smooth bar (default is .f.) + **lVertical: if .t., draw as vertical progress bar (default is .f.) * - *returns control id of newly created progress bar of windows nWinNum - *returns 0 if failed + **returns control id of newly created progress bar of windows nWinNum + **returns 0 if failed * - *example: - *WVW_PGcreate( , 5, 10, 5, 30) + **example: + **WVW_PGcreate( , 5, 10, 5, 30) * :: creates horiz progressbar on current window at (5,10) to (5,30) * colors using default ones. * - *WVW_PGcreate( , 5, 10, 5, 30, {-1, 0, +1, 0} ) + **WVW_PGcreate( , 5, 10, 5, 30, {-1, 0, +1, 0} ) * :: same as above, but the bar is enlarged 1 pixel to the top * and 1 pixel to the bottom * - *NOTES: - *ProgressRange is initially set as 0 - 100. - *Initial ProgressPos is 0 + **NOTES: + **ProgressRange is initially set as 0 - 100. + **Initial ProgressPos is 0 */ -HB_FUNC( WVW_PGCREATE) +HB_FUNC( WVW_PGCREATE ) { - HANDLE hInstance = NULL; - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndParent = pWindowData->hWnd; - HWND hWndPG; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - int iStyle = 0; - BOOL bBackColor= !HB_ISNIL(7); - BOOL bBarColor = !HB_ISNIL(8); - BOOL bSmooth = ( !HB_ISLOG( 9 ) ? FALSE : hb_parl( 9 ) ); - BOOL bVertical = ( !HB_ISLOG(10 ) ? FALSE : hb_parl(10 ) ); - UINT uiPGid; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + HANDLE hInstance = NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndParent = pWindowData->hWnd; + HWND hWndPG; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + int iStyle = 0; + BOOL bBackColor = ! HB_ISNIL( 7 ); + BOOL bBarColor = ! HB_ISNIL( 8 ); + BOOL bSmooth = ( ! HB_ISLOG( 9 ) ? FALSE : hb_parl( 9 ) ); + BOOL bVertical = ( ! HB_ISLOG( 10 ) ? FALSE : hb_parl( 10 ) ); + UINT uiPGid; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); InitCommonControls(); - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0; - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop ; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y-1 + iOffBottom ; - iRight = xy.x-1 + iOffRight; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy.y -= pWindowData->byLineSpacing; + iBottom = xy.y - 1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; - uiPGid = LastControlId(usWinNum, WVW_CONTROL_PROGRESSBAR); - if (uiPGid==0) + uiPGid = LastControlId( usWinNum, WVW_CONTROL_PROGRESSBAR ); + if( uiPGid == 0 ) { - uiPGid = WVW_ID_BASE_PROGRESSBAR; + uiPGid = WVW_ID_BASE_PROGRESSBAR; } else { - uiPGid++; + uiPGid++; } - if (bVertical) + if( bVertical ) { iStyle = iStyle | PBS_VERTICAL; } - if (bSmooth) + if( bSmooth ) { iStyle = iStyle | PBS_SMOOTH; @@ -527,88 +530,91 @@ HB_FUNC( WVW_PGCREATE) hb_winmainArgGet( &hInstance, NULL, NULL ); hWndPG = CreateWindowEx( - 0L, - PROGRESS_CLASS, - (LPSTR) NULL, - WS_CHILD | WS_VISIBLE | (DWORD) iStyle, - iLeft, - iTop, - iRight-iLeft+1, - iBottom-iTop+1, - hWndParent, - (HMENU) uiPGid, - (HINSTANCE) hInstance, - (LPVOID) NULL - ); + 0L, + PROGRESS_CLASS, + ( LPSTR ) NULL, + WS_CHILD | WS_VISIBLE | ( DWORD ) iStyle, + iLeft, + iTop, + iRight - iLeft + 1, + iBottom - iTop + 1, + hWndParent, + ( HMENU ) uiPGid, + ( HINSTANCE ) hInstance, + ( LPVOID ) NULL + ); - if(hWndPG) + if( hWndPG ) { - RECT rXB = { 0 } , rOffXB = { 0 }; + RECT rXB = { 0 }, rOffXB = { 0 }; - if (bBackColor) + if( bBackColor ) { - SendMessage( hWndPG, PBM_SETBKCOLOR, 0, (LPARAM) (COLORREF) hb_parnl(7) ); + SendMessage( hWndPG, PBM_SETBKCOLOR, 0, ( LPARAM ) ( COLORREF ) hb_parnl( 7 ) ); } - if (bBarColor) + if( bBarColor ) { - SendMessage( hWndPG, PBM_SETBARCOLOR, 0, (LPARAM) (COLORREF) hb_parnl(8) ); + SendMessage( hWndPG, PBM_SETBARCOLOR, 0, ( LPARAM ) ( COLORREF ) hb_parnl( 8 ) ); } - SendMessage( hWndPG, PBM_SETRANGE, 0, MAKELPARAM(0, 100) ); - SendMessage( hWndPG, PBM_SETPOS, (WPARAM) 0, 0 ); + SendMessage( hWndPG, PBM_SETRANGE, 0, MAKELPARAM( 0, 100 ) ); + SendMessage( hWndPG, PBM_SETPOS, ( WPARAM ) 0, 0 ); - rXB.top = usTop; rXB.left= usLeft; - rXB.bottom=usBottom; rXB.right =usRight; - rOffXB.top = iOffTop; rOffXB.left= iOffLeft; - rOffXB.bottom=iOffBottom; rOffXB.right =iOffRight; + rXB.top = usTop; rXB.left = usLeft; + rXB.bottom = usBottom; rXB.right = usRight; + rOffXB.top = iOffTop; rOffXB.left = iOffLeft; + rOffXB.bottom = iOffBottom; rOffXB.right = iOffRight; - AddControlHandle(usWinNum, WVW_CONTROL_PROGRESSBAR, hWndPG, uiPGid, (PHB_ITEM) NULL, rXB, rOffXB, (byte) iStyle); + AddControlHandle( usWinNum, WVW_CONTROL_PROGRESSBAR, hWndPG, uiPGid, ( PHB_ITEM ) NULL, rXB, rOffXB, ( byte ) iStyle ); - hb_retnl( (LONG) uiPGid ); + hb_retnl( ( LONG ) uiPGid ); } else { - hb_retnl( (LONG) 0 ); + hb_retnl( ( LONG ) 0 ); } } /*WVW_PGdestroy( [nWinNum], nPGid ) - *destroy progressbar nPGid for window nWinNum - *This function has no return value. + *destroy progressbar nPGid for window nWinNum + *This function has no return value. */ -HB_FUNC( WVW_PGDESTROY) +HB_FUNC( WVW_PGDESTROY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - UINT uiPGid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - CONTROL_DATA * pcdPrev = NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT uiPGid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + CONTROL_DATA * pcdPrev = NULL; - while (pcd) + while( pcd ) { - if (pcd->byCtrlClass == WVW_CONTROL_PROGRESSBAR && pcd->uiCtrlid == uiPGid) - { - break; - } + if( pcd->byCtrlClass == WVW_CONTROL_PROGRESSBAR && pcd->uiCtrlid == uiPGid ) + { + break; + } - pcdPrev = pcd; - pcd = pcd->pNext; + pcdPrev = pcd; + pcd = pcd->pNext; } - if (pcd==NULL) { return; } - - DestroyWindow (pcd->hWndCtrl) ; - - if (pcdPrev==NULL) + if( pcd == NULL ) { - pWindowData->pcdCtrlList = pcd->pNext; + return; + } + + DestroyWindow( pcd->hWndCtrl ); + + if( pcdPrev == NULL ) + { + pWindowData->pcdCtrlList = pcd->pNext; } else { - pcdPrev->pNext = pcd->pNext; + pcdPrev->pNext = pcd->pNext; } - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); @@ -618,89 +624,89 @@ HB_FUNC( WVW_PGDESTROY) } /*WVW_PGsetrange(nWinNum, PGid, [nMin], [nMax]) - *update progressbar data range (default is 0-100) - *nMin: a number in range of -32767 to +32767 - *nMax: a number in range of -32767 to +32767 + *update progressbar data range (default is 0-100) + *nMin: a number in range of -32767 to +32767 + *nMax: a number in range of -32767 to +32767 * - *Remark: progress position is reset to nMin + **Remark: progress position is reset to nMin * - *returns .t. if operation considered successfull -*/ + **returns .t. if operation considered successfull + */ HB_FUNC( WVW_PGSETRANGE ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiPGid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - byte bStyle; - HWND hWndPG = FindControlHandle(usWinNum, WVW_CONTROL_PROGRESSBAR, uiPGid, &bStyle); - int iMin = (int) ( HB_ISNIL(3) ? 0 : hb_parni( 3 ) ); - int iMax = (int) ( HB_ISNIL(4) ? 0 : hb_parni( 4 ) ); + UINT uiPGid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + byte bStyle; + HWND hWndPG = FindControlHandle( usWinNum, WVW_CONTROL_PROGRESSBAR, uiPGid, &bStyle ); + int iMin = ( int ) ( HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ) ); + int iMax = ( int ) ( HB_ISNIL( 4 ) ? 0 : hb_parni( 4 ) ); - if (uiPGid==0 || hWndPG==NULL || (iMin > iMax) ) + if( uiPGid == 0 || hWndPG == NULL || ( iMin > iMax ) ) { - hb_retl(FALSE); - return; + hb_retl( FALSE ); + return; } - SendMessage( hWndPG, PBM_SETRANGE, 0, MAKELPARAM(iMin, iMax) ); - SendMessage( hWndPG, PBM_SETPOS, (WPARAM) iMin, 0 ); + SendMessage( hWndPG, PBM_SETRANGE, 0, MAKELPARAM( iMin, iMax ) ); + SendMessage( hWndPG, PBM_SETPOS, ( WPARAM ) iMin, 0 ); - hb_retl(TRUE); + hb_retl( TRUE ); } /*WVW_PGsetpos(nWinNum, PGid, [nPos]) - *update progressbar position within current range - *nPos: a number in range of current range - *returns .t. if operation considered successfull -*/ + *update progressbar position within current range + *nPos: a number in range of current range + *returns .t. if operation considered successfull + */ HB_FUNC( WVW_PGSETPOS ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiPGid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - byte bStyle; - HWND hWndPG = FindControlHandle(usWinNum, WVW_CONTROL_PROGRESSBAR, uiPGid, &bStyle); - int iPos = (int) ( HB_ISNIL(3) ? 0 : hb_parni( 3 ) ); - PBRANGE pbrange; + UINT uiPGid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + byte bStyle; + HWND hWndPG = FindControlHandle( usWinNum, WVW_CONTROL_PROGRESSBAR, uiPGid, &bStyle ); + int iPos = ( int ) ( HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ) ); + PBRANGE pbrange; - if (uiPGid==0 || hWndPG==NULL) + if( uiPGid == 0 || hWndPG == NULL ) { - hb_retl(FALSE); - return; + hb_retl( FALSE ); + return; } - SendMessage( hWndPG, PBM_GETRANGE, (WPARAM) TRUE, (LPARAM) &pbrange ); + SendMessage( hWndPG, PBM_GETRANGE, ( WPARAM ) TRUE, ( LPARAM ) &pbrange ); - if (iPos < pbrange.iLow || iPos > pbrange.iHigh) + if( iPos < pbrange.iLow || iPos > pbrange.iHigh ) { - hb_retl(FALSE); - return; + hb_retl( FALSE ); + return; } - SendMessage( hWndPG, PBM_SETPOS, (WPARAM) iPos, 0 ); + SendMessage( hWndPG, PBM_SETPOS, ( WPARAM ) iPos, 0 ); - hb_retl(TRUE); + hb_retl( TRUE ); } /*WVW_PGgetpos(nWinNum, PGid) - *get progressbar current position - *returns 0 if operation failed -*/ + *get progressbar current position + *returns 0 if operation failed + */ HB_FUNC( WVW_PGGETPOS ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiPGid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - byte bStyle; - HWND hWndPG = FindControlHandle(usWinNum, WVW_CONTROL_PROGRESSBAR, uiPGid, &bStyle); + UINT uiPGid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + byte bStyle; + HWND hWndPG = FindControlHandle( usWinNum, WVW_CONTROL_PROGRESSBAR, uiPGid, &bStyle ); - if (uiPGid==0 || hWndPG==NULL) + if( uiPGid == 0 || hWndPG == NULL ) { - hb_retni(0); - return; + hb_retni( 0 ); + return; } - hb_retni( (int) SendMessage( hWndPG, PBM_GETPOS, (WPARAM) 0, (LPARAM) 0 ) ); + hb_retni( ( int ) SendMessage( hWndPG, PBM_GETPOS, ( WPARAM ) 0, ( LPARAM ) 0 ) ); } diff --git a/harbour/extras/gtwvw/wvwdraw.c b/harbour/extras/gtwvw/wvwdraw.c index f48889a569..2b5244c2ea 100644 --- a/harbour/extras/gtwvw/wvwdraw.c +++ b/harbour/extras/gtwvw/wvwdraw.c @@ -104,102 +104,92 @@ static COLORREF _COLORS[] = { HB_FUNC( WVW_DRAWLABELOBJ ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ) ; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight, x, y; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - RECT rect = { 0 }; - HFONT oldFont; - int oldTextAlign, iAlignHorz, iAlignVert, iAlignH = 0, iAlignV; - COLORREF oldBkColor, oldTextColor; - UINT uiOptions; - SIZE sz = { 0 }; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight, x, y; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + RECT rect = { 0 }; + HFONT oldFont; + int oldTextAlign, iAlignHorz, iAlignVert, iAlignH = 0, iAlignV; + COLORREF oldBkColor, oldTextColor; + UINT uiOptions; + SIZE sz = { 0 }; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - iOffTop = !HB_ISNIL( 12 ) ? hb_parvni( 12,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 12 ) ? hb_parvni( 12,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 12 ) ? hb_parvni( 12,3 ) : 0 ; - iOffRight = !HB_ISNIL( 12 ) ? hb_parvni( 12,4 ) : 0; + iOffTop = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 3 ) : 0; + iOffRight = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 4 ) : 0; - if ( hb_gt_wvw_GetMainCoordMode() ) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight+1, usBottom+1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + 1 + iOffBottom; - iRight = xy.x - 1 + 1 + iOffRight; + iBottom = xy.y - 1 + 1 + iOffBottom; + iRight = xy.x - 1 + 1 + iOffRight; - iAlignHorz = ( HB_ISNIL( 7 ) ? 0 : hb_parni( 7 ) ); - iAlignVert = ( HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ) ); + iAlignHorz = ( HB_ISNIL( 7 ) ? 0 : hb_parni( 7 ) ); + iAlignVert = ( HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ) ); - oldTextColor = SetTextColor( pWindowData->hdc, HB_ISNIL( 9 ) ? pWindowData->foreground : ( COLORREF ) hb_parnl( 9 ) ); - oldBkColor = SetBkColor( pWindowData->hdc, HB_ISNIL( 10 ) ? pWindowData->background : ( COLORREF ) hb_parnl( 10 ) ); - oldFont = ( HFONT ) SelectObject( pWindowData->hdc, ( HFONT ) HB_PARHANDLE( 11 ) ); + oldTextColor = SetTextColor( pWindowData->hdc, HB_ISNIL( 9 ) ? pWindowData->foreground : ( COLORREF ) hb_parnl( 9 ) ); + oldBkColor = SetBkColor( pWindowData->hdc, HB_ISNIL( 10 ) ? pWindowData->background : ( COLORREF ) hb_parnl( 10 ) ); + oldFont = ( HFONT ) SelectObject( pWindowData->hdc, ( HFONT ) HB_PARHANDLE( 11 ) ); GetTextExtentPoint32( pWindowData->hdc, hb_parcx( 6 ), strlen( hb_parcx( 6 ) ), &sz ); - x = iLeft; - y = iTop; + x = iLeft; + y = iTop; - switch ( iAlignHorz ) + switch( iAlignHorz ) { case 0: - { - iAlignH = TA_LEFT; - } - break; + iAlignH = TA_LEFT; + break; case 1: - { - iAlignH = TA_RIGHT; - x = iRight; - } - break; + iAlignH = TA_RIGHT; + x = iRight; + break; case 2: - { - iAlignH = TA_CENTER; - x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ); - } - break; + iAlignH = TA_CENTER; + x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ); + break; } iAlignV = TA_TOP; - switch ( iAlignVert ) + switch( iAlignVert ) { case 1: - { - y = iBottom - sz.cy; - } - break; + y = iBottom - sz.cy; + break; case 2: - { - y = iTop + ( ( iBottom - iTop + 1 - sz.cy ) / 2 ) ; - } - break; + y = iTop + ( ( iBottom - iTop + 1 - sz.cy ) / 2 ); + break; } - oldTextAlign = SetTextAlign( pWindowData->hdc, iAlignH | iAlignV ); + oldTextAlign = SetTextAlign( pWindowData->hdc, iAlignH | iAlignV ); - rect.top = iTop; - rect.left = iLeft; - rect.bottom = iBottom; - rect.right = iRight; + rect.top = iTop; + rect.left = iLeft; + rect.bottom = iBottom; + rect.right = iRight; - uiOptions = ETO_CLIPPED | ETO_OPAQUE ; + uiOptions = ETO_CLIPPED | ETO_OPAQUE; ExtTextOut( pWindowData->hdc, x, y, uiOptions, &rect, hb_parcx( 6 ), strlen( hb_parcx( 6 ) ), NULL ); @@ -218,43 +208,42 @@ HB_FUNC( WVW_DRAWLABELOBJ ) /* */ HB_FUNC( WVW_DRAWTOOLBUTTONSTATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iState = hb_parni( 7 ); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iState = hb_parni( 7 ); - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + hb_parvni( 6,1 ); - iLeft = xy.x + hb_parvni( 6,2 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + hb_parvni( 6, 1 ); + iLeft = xy.x + hb_parvni( 6, 2 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + hb_parvni( 6,3 ); - iRight = xy.x - 1 + hb_parvni( 6,4 ); + iBottom = xy.y - 1 + hb_parvni( 6, 3 ); + iRight = xy.x - 1 + hb_parvni( 6, 4 ); - switch ( iState ) + switch( iState ) { case 0: - { SelectObject( pWindowData->hdc, s_sApp->penGray ); MoveToEx( pWindowData->hdc, iRight, iTop, NULL ); /* Right */ - LineTo( pWindowData->hdc, iRight, iBottom + 1); + LineTo( pWindowData->hdc, iRight, iBottom + 1 ); MoveToEx( pWindowData->hdc, iLeft, iBottom, NULL ); /* Bottom */ LineTo( pWindowData->hdc, iRight, iBottom ); @@ -264,15 +253,13 @@ HB_FUNC( WVW_DRAWTOOLBUTTONSTATE ) MoveToEx( pWindowData->hdc, iLeft, iTop, NULL ); /* Top */ LineTo( pWindowData->hdc, iRight, iTop ); - } - break; + break; case 1: - { SelectObject( pWindowData->hdc, s_sApp->penBlack ); MoveToEx( pWindowData->hdc, iRight, iTop, NULL ); /* Right */ - LineTo( pWindowData->hdc, iRight, iBottom+1 ); + LineTo( pWindowData->hdc, iRight, iBottom + 1 ); MoveToEx( pWindowData->hdc, iLeft, iBottom, NULL ); /* Bottom */ LineTo( pWindowData->hdc, iRight, iBottom ); @@ -284,15 +271,13 @@ HB_FUNC( WVW_DRAWTOOLBUTTONSTATE ) MoveToEx( pWindowData->hdc, iLeft, iTop, NULL ); /* Top */ LineTo( pWindowData->hdc, iRight, iTop ); - } - break; + break; case 2: - { SelectObject( pWindowData->hdc, s_sApp->penWhite ); MoveToEx( pWindowData->hdc, iRight, iTop, NULL ); /* Right */ - LineTo( pWindowData->hdc, iRight, iBottom+1 ); + LineTo( pWindowData->hdc, iRight, iBottom + 1 ); MoveToEx( pWindowData->hdc, iLeft, iBottom, NULL ); /* Bottom */ LineTo( pWindowData->hdc, iRight, iBottom ); @@ -304,8 +289,7 @@ HB_FUNC( WVW_DRAWTOOLBUTTONSTATE ) MoveToEx( pWindowData->hdc, iLeft, iTop, NULL ); /* Top */ LineTo( pWindowData->hdc, iRight, iTop ); - } - break; + break; } hb_retl( TRUE ); @@ -318,104 +302,96 @@ HB_FUNC( WVW_DRAWTOOLBUTTONSTATE ) /* NOTE: with WVW_XB (scrollbar) this function does not seem to be usefull */ HB_FUNC( WVW_DRAWSCROLLBUTTON ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - int iTop, iLeft, iBottom, iRight; - POINT * Point; - POINT xy = { 0 }; - int iHeight, iOff; - BOOL bDepressed = HB_ISNIL( 8 ) ? FALSE : hb_parl( 8 ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + int iTop, iLeft, iBottom, iRight; + POINT * Point; + POINT xy = { 0 }; + int iHeight, iOff; + BOOL bDepressed = HB_ISNIL( 8 ) ? FALSE : hb_parl( 8 ); - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + hb_parvni( 6,1 ); - iLeft = xy.x + hb_parvni( 6,2 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + hb_parvni( 6, 1 ); + iLeft = xy.x + hb_parvni( 6, 2 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + hb_parvni( 6,3 ); - iRight = xy.x - 1 + hb_parvni( 6,4 ); + iBottom = xy.y - 1 + hb_parvni( 6, 3 ); + iRight = xy.x - 1 + hb_parvni( 6, 4 ); - Point = ( POINT * ) hb_xgrab( 3 * sizeof( POINT ) ); - iOff = 6; + Point = ( POINT * ) hb_xgrab( 3 * sizeof( POINT ) ); + iOff = 6; - iHeight = iBottom - iTop + 1; + iHeight = iBottom - iTop + 1; - if ( bDepressed ) + if( bDepressed ) { - hb_gt_wvwDrawBoxRecessed( usWinNum, iTop+1, iLeft+1, iBottom-2, iRight-2, FALSE ); + hb_gt_wvwDrawBoxRecessed( usWinNum, iTop + 1, iLeft + 1, iBottom - 2, iRight - 2, FALSE ); } else { - hb_gt_wvwDrawBoxRaised( usWinNum, iTop+1, iLeft+1, iBottom-2, iRight-2, FALSE ); + hb_gt_wvwDrawBoxRaised( usWinNum, iTop + 1, iLeft + 1, iBottom - 2, iRight - 2, FALSE ); } SelectObject( pWindowData->hdc, s_sApp->solidBrush ); - switch ( hb_parni( 7 ) ) + switch( hb_parni( 7 ) ) { case 1: - { - xy.y = iTop + iOff - 1; - xy.x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ); - Point[ 0 ] = xy ; - xy.y = iBottom - iOff - 1; - xy.x = iLeft + iOff - 1; - Point[ 1 ] = xy; - xy.x = iRight - iOff + 1; - Point[ 2 ] = xy; - } - break; + xy.y = iTop + iOff - 1; + xy.x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ); + Point[ 0 ] = xy; + xy.y = iBottom - iOff - 1; + xy.x = iLeft + iOff - 1; + Point[ 1 ] = xy; + xy.x = iRight - iOff + 1; + Point[ 2 ] = xy; + break; case 2: - { - xy.y = iTop + ( ( iBottom - iTop + 1 ) / 2 ); - xy.x = iLeft + iOff; - Point[ 0 ] = xy ; - xy.x = iRight - iOff - 1; - xy.y = iTop + iOff - 1; - Point[ 1 ] = xy; - xy.y = iBottom - iOff + 1; - Point[ 2 ] = xy; - } - break; + xy.y = iTop + ( ( iBottom - iTop + 1 ) / 2 ); + xy.x = iLeft + iOff; + Point[ 0 ] = xy; + xy.x = iRight - iOff - 1; + xy.y = iTop + iOff - 1; + Point[ 1 ] = xy; + xy.y = iBottom - iOff + 1; + Point[ 2 ] = xy; + break; case 3: - { - xy.x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ); - xy.y = iBottom - iOff; - Point[ 0 ] = xy ; - xy.x = iLeft + iOff - 1; - xy.y = iBottom - iHeight + iOff + 1; - Point[ 1 ] = xy; - xy.x = iRight - iOff + 1; - Point[ 2 ] = xy; - } - break; + xy.x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ); + xy.y = iBottom - iOff; + Point[ 0 ] = xy; + xy.x = iLeft + iOff - 1; + xy.y = iBottom - iHeight + iOff + 1; + Point[ 1 ] = xy; + xy.x = iRight - iOff + 1; + Point[ 2 ] = xy; + break; case 4: - { - xy.x = iRight - iOff - 1; - xy.y = iTop + ( ( iBottom - iTop + 1 ) / 2 ); - Point[ 0 ] = xy ; - xy.x = iLeft + iOff + 1; - xy.y = iTop + iOff - 1; - Point[ 1 ] = xy; - xy.y = iBottom - iOff + 1; - Point[ 2 ] = xy; - } - break; + xy.x = iRight - iOff - 1; + xy.y = iTop + ( ( iBottom - iTop + 1 ) / 2 ); + Point[ 0 ] = xy; + xy.x = iLeft + iOff + 1; + xy.y = iTop + iOff - 1; + Point[ 1 ] = xy; + xy.y = iBottom - iOff + 1; + Point[ 2 ] = xy; + break; } Polygon( pWindowData->hdc, Point, 3 ); @@ -430,45 +406,45 @@ HB_FUNC( WVW_DRAWSCROLLBUTTON ) /* NOTE: with WVW_XB (scrollbar) this function does not seem to be usefull */ HB_FUNC( WVW_DRAWSCROLLTHUMBVERT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iTabTop, iTabLft, iTabBtm, iTabRgt; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iTabTop, iTabLft, iTabBtm, iTabRgt; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - USHORT usTabTop = ( USHORT )hb_parni( 7 ); + USHORT usTabTop = ( USHORT ) hb_parni( 7 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); - hb_wvw_HBFUNCPrologue(usWinNum, &usTabTop, NULL, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); + hb_wvw_HBFUNCPrologue( usWinNum, &usTabTop, NULL, NULL, NULL ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + hb_parvni( 6,1 ); - iLeft = xy.x + hb_parvni( 6,2 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + hb_parvni( 6, 1 ); + iLeft = xy.x + hb_parvni( 6, 2 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + hb_parvni( 6,3 ); - iRight = xy.x - 1 + hb_parvni( 6,4 ); + iBottom = xy.y - 1 + hb_parvni( 6, 3 ); + iRight = xy.x - 1 + hb_parvni( 6, 4 ); - SetBkColor( pWindowData->hdc, RGB( 230,230,230 ) ); + SetBkColor( pWindowData->hdc, RGB( 230, 230, 230 ) ); SelectObject( pWindowData->hdc, s_sApp->diagonalBrush ); SelectObject( pWindowData->hdc, s_sApp->penNull ); - Rectangle( pWindowData->hdc, iLeft, iTop, iRight+1, iBottom+1 ); + Rectangle( pWindowData->hdc, iLeft, iTop, iRight + 1, iBottom + 1 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft /* dummy */ , usTabTop ); - iTabTop = xy.y; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft /* dummy */, usTabTop ); + iTabTop = xy.y; iTabLft = iLeft; iTabBtm = iTabTop + pWindowData->PTEXTSIZE.y - 1; @@ -476,9 +452,9 @@ HB_FUNC( WVW_DRAWSCROLLTHUMBVERT ) SelectObject( pWindowData->hdc, s_sApp->wvwWhiteBrush ); SelectObject( pWindowData->hdc, s_sApp->penGray ); - Rectangle( pWindowData->hdc, iTabLft, iTabTop, iTabRgt+1, iTabBtm ); + Rectangle( pWindowData->hdc, iTabLft, iTabTop, iTabRgt + 1, iTabBtm ); - hb_gt_wvwDrawBoxRaised( usWinNum, iTabTop+1, iTabLft+1, iTabBtm-2, iTabRgt-2, FALSE ); + hb_gt_wvwDrawBoxRaised( usWinNum, iTabTop + 1, iTabLft + 1, iTabBtm - 2, iTabRgt - 2, FALSE ); } @@ -488,50 +464,50 @@ HB_FUNC( WVW_DRAWSCROLLTHUMBVERT ) /* NOTE: with WVW_XB (scrollbar) this function does not seem to be usefull */ HB_FUNC( WVW_DRAWSCROLLTHUMBHORZ ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - POINT xy = { 0 }; - int iThumbLeft, iThumbRight; - int iTop, iLeft, iBottom, iRight; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + POINT xy = { 0 }; + int iThumbLeft, iThumbRight; + int iTop, iLeft, iBottom, iRight; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - USHORT usThumbLeft = ( USHORT )hb_parni( 7 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + USHORT usThumbLeft = ( USHORT ) hb_parni( 7 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); - hb_wvw_HBFUNCPrologue(usWinNum, NULL, &usThumbLeft, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); + hb_wvw_HBFUNCPrologue( usWinNum, NULL, &usThumbLeft, NULL, NULL ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + hb_parvni( 6,1 ); - iLeft = xy.x + hb_parvni( 6,2 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + hb_parvni( 6, 1 ); + iLeft = xy.x + hb_parvni( 6, 2 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + hb_parvni( 6,3 ); - iRight = xy.x - 1 + hb_parvni( 6,4 ); + iBottom = xy.y - 1 + hb_parvni( 6, 3 ); + iRight = xy.x - 1 + hb_parvni( 6, 4 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usThumbLeft, usTop /* dummy */ ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usThumbLeft, usTop /* dummy */ ); iThumbLeft = xy.x; iThumbRight = iThumbLeft + ( pWindowData->PTEXTSIZE.x * 2 ) - 1; - SetBkColor( pWindowData->hdc, RGB( 230,230,230 ) ); + SetBkColor( pWindowData->hdc, RGB( 230, 230, 230 ) ); SelectObject( pWindowData->hdc, s_sApp->diagonalBrush ); SelectObject( pWindowData->hdc, s_sApp->penNull ); - Rectangle( pWindowData->hdc, iLeft, iTop, iRight+1, iBottom+1 ); + Rectangle( pWindowData->hdc, iLeft, iTop, iRight + 1, iBottom + 1 ); SelectObject( pWindowData->hdc, s_sApp->wvwWhiteBrush ); SelectObject( pWindowData->hdc, s_sApp->penGray ); Rectangle( pWindowData->hdc, iThumbLeft, iTop, iThumbRight, iBottom ); - hb_gt_wvwDrawBoxRaised( usWinNum, iTop+1, iThumbLeft+1, iBottom-2, iThumbRight-2, FALSE ); + hb_gt_wvwDrawBoxRaised( usWinNum, iTop + 1, iThumbLeft + 1, iBottom - 2, iThumbRight - 2, FALSE ); } @@ -540,59 +516,59 @@ HB_FUNC( WVW_DRAWSCROLLTHUMBHORZ ) /* */ HB_FUNC( WVW_DRAWSHADEDRECT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - BOOL bGF = FALSE; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + BOOL bGF = FALSE; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - if ( s_sApp->hMSImg32 ) + if( s_sApp->hMSImg32 ) { - TRIVERTEX vert[ 2 ] ; - GRADIENT_RECT gRect = { 0 }; + TRIVERTEX vert[ 2 ]; + GRADIENT_RECT gRect = { 0 }; - int iMode = HB_ISNIL( 7 ) ? GRADIENT_FILL_RECT_H : hb_parni( 7 ) ; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; + int iMode = HB_ISNIL( 7 ) ? GRADIENT_FILL_RECT_H : hb_parni( 7 ); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + hb_parvni( 6,1 ); - iLeft = xy.x + hb_parvni( 6,2 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + hb_parvni( 6, 1 ); + iLeft = xy.x + hb_parvni( 6, 2 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + hb_parvni( 6,3 ); - iRight = xy.x - 1 + hb_parvni( 6,4 ); + iBottom = xy.y - 1 + hb_parvni( 6, 3 ); + iRight = xy.x - 1 + hb_parvni( 6, 4 ); - vert[ 0 ].x = iLeft; - vert[ 0 ].y = iTop; - vert[ 0 ].Red = (COLOR16)hb_parvni( 8,1 ); - vert[ 0 ].Green = (COLOR16)hb_parvni( 8,2 ); - vert[ 0 ].Blue = (COLOR16)hb_parvni( 8,3 ); - vert[ 0 ].Alpha = (COLOR16)hb_parvni( 8,4 ); + vert[ 0 ].x = iLeft; + vert[ 0 ].y = iTop; + vert[ 0 ].Red = ( COLOR16 ) hb_parvni( 8, 1 ); + vert[ 0 ].Green = ( COLOR16 ) hb_parvni( 8, 2 ); + vert[ 0 ].Blue = ( COLOR16 ) hb_parvni( 8, 3 ); + vert[ 0 ].Alpha = ( COLOR16 ) hb_parvni( 8, 4 ); - vert[ 1 ].x = iRight; - vert[ 1 ].y = iBottom; - vert[ 1 ].Red = ( COLOR16)hb_parvni( 9,1 ); - vert[ 1 ].Green = ( COLOR16)hb_parvni( 9,2 ); - vert[ 1 ].Blue = ( COLOR16)hb_parvni( 9,3 ); - vert[ 1 ].Alpha = ( COLOR16)hb_parvni( 9,4 ); + vert[ 1 ].x = iRight; + vert[ 1 ].y = iBottom; + vert[ 1 ].Red = ( COLOR16 ) hb_parvni( 9, 1 ); + vert[ 1 ].Green = ( COLOR16 ) hb_parvni( 9, 2 ); + vert[ 1 ].Blue = ( COLOR16 ) hb_parvni( 9, 3 ); + vert[ 1 ].Alpha = ( COLOR16 ) hb_parvni( 9, 4 ); - gRect.UpperLeft = 0; - gRect.LowerRight= 1; + gRect.UpperLeft = 0; + gRect.LowerRight = 1; - bGF = ( BOOL ) s_sApp->pfnGF( pWindowData->hdc, vert, 2, &gRect, 1, iMode ); + bGF = ( BOOL ) s_sApp->pfnGF( pWindowData->hdc, vert, 2, &gRect, 1, iMode ); } hb_retl( bGF ); } @@ -605,70 +581,64 @@ HB_FUNC( WVW_DRAWSHADEDRECT ) /* */ HB_FUNC( WVW_DRAWTEXTBOX ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; - int iAlignHorz = ( HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ) ); + int iAlignHorz = ( HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ) ); - int iAlignH = 0; + int iAlignH = 0; - COLORREF oldTextColor, oldBkColor; - HFONT oldFont; - int oldTextAlign, oldBkMode; - RECT rc = { 0 }; + COLORREF oldTextColor, oldBkColor; + HFONT oldFont; + int oldTextAlign, oldBkMode; + RECT rc = { 0 }; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + hb_parvni( 6,1 ); - iLeft = xy.x + hb_parvni( 6,2 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + hb_parvni( 6, 1 ); + iLeft = xy.x + hb_parvni( 6, 2 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + hb_parvni( 6,3 ); - iRight = xy.x - 1 + hb_parvni( 6,4 ); + iBottom = xy.y - 1 + hb_parvni( 6, 3 ); + iRight = xy.x - 1 + hb_parvni( 6, 4 ); - switch ( iAlignHorz ) + switch( iAlignHorz ) { case 0: - { - iAlignH = DT_LEFT; - } - break; + iAlignH = DT_LEFT; + break; case 1: - { - iAlignH = DT_RIGHT; - } - break; + iAlignH = DT_RIGHT; + break; case 2: - { - iAlignH = DT_CENTER; - } - break; + iAlignH = DT_CENTER; + break; } - rc.top = iTop; - rc.left = iLeft; - rc.bottom = iBottom; - rc.right = iRight; + rc.top = iTop; + rc.left = iLeft; + rc.bottom = iBottom; + rc.right = iRight; - oldTextAlign = SetTextAlign( pWindowData->hdc, TA_TOP | TA_LEFT | TA_NOUPDATECP ); - oldTextColor = SetTextColor( pWindowData->hdc, HB_ISNIL( 10 ) ? pWindowData->foreground : ( COLORREF ) hb_parnl( 10 ) ); - oldBkColor = SetBkColor( pWindowData->hdc, HB_ISNIL( 11 ) ? pWindowData->background : ( COLORREF ) hb_parnl( 11) ); - oldBkMode = SetBkMode( pWindowData->hdc, HB_ISNIL( 12 ) ? OPAQUE : hb_parni( 12 ) ); - oldFont = ( HFONT ) SelectObject( pWindowData->hdc, ( HFONT ) HB_PARHANDLE( 13 ) ); + oldTextAlign = SetTextAlign( pWindowData->hdc, TA_TOP | TA_LEFT | TA_NOUPDATECP ); + oldTextColor = SetTextColor( pWindowData->hdc, HB_ISNIL( 10 ) ? pWindowData->foreground : ( COLORREF ) hb_parnl( 10 ) ); + oldBkColor = SetBkColor( pWindowData->hdc, HB_ISNIL( 11 ) ? pWindowData->background : ( COLORREF ) hb_parnl( 11 ) ); + oldBkMode = SetBkMode( pWindowData->hdc, HB_ISNIL( 12 ) ? OPAQUE : hb_parni( 12 ) ); + oldFont = ( HFONT ) SelectObject( pWindowData->hdc, ( HFONT ) HB_PARHANDLE( 13 ) ); DrawText( pWindowData->hdc, hb_parcx( 7 ), strlen( hb_parcx( 7 ) ), &rc, iAlignH | DT_WORDBREAK | DT_TOP ); @@ -686,19 +656,19 @@ HB_FUNC( WVW_DRAWTEXTBOX ) */ HB_FUNC( WVW_DRAWPROGRESSBAR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WIN_DATA * pWinMainData = hb_gt_wvw_GetWindowsData( 0 ) ; - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - int iTop ; - int iLeft ; - int iBottom ; - int iRight ; - int iPercent, iBarUpto, iDirection; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WIN_DATA * pWinMainData = hb_gt_wvw_GetWindowsData( 0 ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + int iTop; + int iLeft; + int iBottom; + int iRight; + int iPercent, iBarUpto, iDirection; BOOL bVertical, bImage; COLORREF crBarColor; @@ -707,75 +677,75 @@ HB_FUNC( WVW_DRAWPROGRESSBAR ) RECT rc = { 0 }; POINT xy = { 0 }; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + hb_parvni( 6,1 ); - iLeft = xy.x + hb_parvni( 6,2 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + hb_parvni( 6, 1 ); + iLeft = xy.x + hb_parvni( 6, 2 ); - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + hb_parvni( 6,3 ); - iRight = xy.x - 1 + hb_parvni( 6,4 ); + iBottom = xy.y - 1 + hb_parvni( 6, 3 ); + iRight = xy.x - 1 + hb_parvni( 6, 4 ); - iPercent = hb_parni( 7 ); - bImage = HB_ISNIL( 10 ) ? FALSE : TRUE ; - bVertical = HB_ISNIL( 11 ) ? FALSE : hb_parl( 11 ) ; - iDirection = HB_ISNIL( 12 ) ? 0 : hb_parni( 12 ); + iPercent = hb_parni( 7 ); + bImage = HB_ISNIL( 10 ) ? FALSE : TRUE; + bVertical = HB_ISNIL( 11 ) ? FALSE : hb_parl( 11 ); + iDirection = HB_ISNIL( 12 ) ? 0 : hb_parni( 12 ); - if ( bVertical ) + if( bVertical ) { - if ( iDirection == 0 ) + if( iDirection == 0 ) { - iBarUpto = iTop + ( ( iBottom - iTop ) * iPercent / 100 ); - rc.top = iTop; - rc.left = iLeft; - rc.bottom = iBarUpto; - rc.right = iRight; + iBarUpto = iTop + ( ( iBottom - iTop ) * iPercent / 100 ); + rc.top = iTop; + rc.left = iLeft; + rc.bottom = iBarUpto; + rc.right = iRight; } else { - iBarUpto = iBottom - ( ( iBottom - iTop ) * iPercent / 100 ); - rc.top = iBarUpto; - rc.left = iLeft; - rc.bottom = iBottom; - rc.right = iRight; + iBarUpto = iBottom - ( ( iBottom - iTop ) * iPercent / 100 ); + rc.top = iBarUpto; + rc.left = iLeft; + rc.bottom = iBottom; + rc.right = iRight; } } else { - if ( iDirection == 0 ) + if( iDirection == 0 ) { - iBarUpto = iLeft + ( ( iRight - iLeft ) * iPercent / 100 ); - rc.top = iTop; - rc.left = iLeft; - rc.bottom = iBottom; - rc.right = iBarUpto; + iBarUpto = iLeft + ( ( iRight - iLeft ) * iPercent / 100 ); + rc.top = iTop; + rc.left = iLeft; + rc.bottom = iBottom; + rc.right = iBarUpto; } else { - iBarUpto = iRight - ( ( iRight - iLeft ) * iPercent / 100 ); - rc.top = iTop; - rc.left = iBarUpto; - rc.bottom = iBottom; - rc.right = iRight; + iBarUpto = iRight - ( ( iRight - iLeft ) * iPercent / 100 ); + rc.top = iTop; + rc.left = iBarUpto; + rc.bottom = iBottom; + rc.right = iRight; } } - if ( bImage ) + if( bImage ) { - hb_gt_wvwDrawImage( usWinNum, rc.left, rc.top, rc.right-rc.left+1, rc.bottom-rc.top+1, hb_parc( 10 ), + hb_gt_wvwDrawImage( usWinNum, rc.left, rc.top, rc.right - rc.left + 1, rc.bottom - rc.top + 1, hb_parc( 10 ), FALSE ); } else { - crBarColor = HB_ISNIL( 9 ) ? hb_gt_wvwGetColorData( 0 ) : (COLORREF) hb_parnl( 9 ); + crBarColor = HB_ISNIL( 9 ) ? hb_gt_wvwGetColorData( 0 ) : ( COLORREF ) hb_parnl( 9 ); lb.lbStyle = BS_SOLID; lb.lbColor = crBarColor; @@ -787,7 +757,7 @@ HB_FUNC( WVW_DRAWPROGRESSBAR ) rc.right++; FillRect( pWindowData->hdc, &rc, hBrush ); - SelectObject( pWinMainData->hdc, (HBRUSH) s_sApp->OriginalBrush ); + SelectObject( pWinMainData->hdc, ( HBRUSH ) s_sApp->OriginalBrush ); DeleteObject( hBrush ); } } @@ -798,48 +768,48 @@ HB_FUNC( WVW_DRAWPROGRESSBAR ) * Wvw_DrawBoxGet( [nWinNum], nRow, nCol, nWidth,; * aOffset ) <-- additional parm, not exist in GTWVT * - *NOTES: unlike GTWVT, GTWVW draw white lines on outer right and outer bottom + **NOTES: unlike GTWVT, GTWVW draw white lines on outer right and outer bottom * Besides, scope is the same as DRAWBOXRECESSED, ie. * two pixel out of char boundary */ HB_FUNC( WVW_DRAWBOXGET ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - POINT yz = { 0 }; - WIN_DATA * pWindowData; - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - USHORT usRow, usCol, usLen; + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + POINT yz = { 0 }; + WIN_DATA * pWindowData; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + USHORT usRow, usCol, usLen; pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - usRow = ( USHORT )hb_parni( 2 ); - usCol = ( USHORT )hb_parni( 3 ); - usLen = ( USHORT )hb_parni( 4 ); + usRow = ( USHORT ) hb_parni( 2 ); + usCol = ( USHORT ) hb_parni( 3 ); + usLen = ( USHORT ) hb_parni( 4 ); - iOffTop = !HB_ISNIL( 5 ) ? hb_parvni( 5,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 5 ) ? hb_parvni( 5,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 5 ) ? hb_parvni( 5,3 ) : 0 ; - iOffRight = !HB_ISNIL( 5 ) ? hb_parvni( 5,4 ) : 0; + iOffTop = ! HB_ISNIL( 5 ) ? hb_parvni( 5, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 5 ) ? hb_parvni( 5, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 5 ) ? hb_parvni( 5, 3 ) : 0; + iOffRight = ! HB_ISNIL( 5 ) ? hb_parvni( 5, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usRow, &usCol, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usRow, &usCol, NULL, NULL ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); - iTop = xy.y - 1 + iOffTop; - iLeft = xy.x - 1 + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); + iTop = xy.y - 1 + iOffTop; + iLeft = xy.x - 1 + iOffLeft; - yz = hb_gt_wvwGetXYFromColRow( pWindowData, usCol + usLen, usRow + 1 ); + yz = hb_gt_wvwGetXYFromColRow( pWindowData, usCol + usLen, usRow + 1 ); - yz.y -= pWindowData->byLineSpacing; + yz.y -= pWindowData->byLineSpacing; - iBottom = yz.y + iOffBottom; - iRight = yz.x + iOffRight; + iBottom = yz.y + iOffBottom; + iRight = yz.x + iOffRight; SelectObject( pWindowData->hdc, s_sApp->penBlack ); @@ -853,28 +823,28 @@ HB_FUNC( WVW_DRAWBOXGET ) SelectObject( pWindowData->hdc, s_sApp->penDarkGray ); - MoveToEx( pWindowData->hdc, iLeft-1, iTop-1, NULL ); + MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); - LineTo( pWindowData->hdc, iRight+1, iTop-1 ); + LineTo( pWindowData->hdc, iRight + 1, iTop - 1 ); - MoveToEx( pWindowData->hdc, iLeft-1, iTop-1, NULL ); + MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); - LineTo( pWindowData->hdc, iLeft-1, iBottom+1 ); + LineTo( pWindowData->hdc, iLeft - 1, iBottom + 1 ); /* GTWVW also draws right and bottom outer with single white line */ SelectObject( pWindowData->hdc, s_sApp->penWhite ); - MoveToEx( pWindowData->hdc, iRight+1, iTop-1, NULL ); - LineTo( pWindowData->hdc, iRight+1, iBottom+1+1 ); + MoveToEx( pWindowData->hdc, iRight + 1, iTop - 1, NULL ); + LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 + 1 ); - MoveToEx( pWindowData->hdc, iLeft-1, iBottom+1, NULL ); - LineTo( pWindowData->hdc, iRight+1, iBottom+1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iBottom + 1, NULL ); + LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 ); MoveToEx( pWindowData->hdc, iLeft, iBottom, NULL ); LineTo( pWindowData->hdc, iRight, iBottom ); MoveToEx( pWindowData->hdc, iRight, iTop, NULL ); - LineTo( pWindowData->hdc, iRight, iBottom+1 ); + LineTo( pWindowData->hdc, iRight, iBottom + 1 ); hb_retl( TRUE ); } @@ -884,62 +854,62 @@ HB_FUNC( WVW_DRAWBOXGET ) * Wvw_DrawBoxGet_XP( [nWinNum], nRow, nCol, nWidth,; * aOffset ) <-- additional parm, not exist in GTWVT * - *NOTES: unlike GTWVT, GTWVW draw white lines on outer right and outer bottom + **NOTES: unlike GTWVT, GTWVW draw white lines on outer right and outer bottom * Besides, scope is the same as DRAWBOXRECESSED, ie. * two pixel out of char boundary */ HB_FUNC( WVW_DRAWBOXGET_XP ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - POINT yz = { 0 }; - WIN_DATA * pWindowData; - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - USHORT usRow, usCol, usLen; + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + POINT yz = { 0 }; + WIN_DATA * pWindowData; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + USHORT usRow, usCol, usLen; pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - usRow = ( USHORT )hb_parni( 2 ); - usCol = ( USHORT )hb_parni( 3 ); - usLen = ( USHORT )hb_parni( 4 ); + usRow = ( USHORT ) hb_parni( 2 ); + usCol = ( USHORT ) hb_parni( 3 ); + usLen = ( USHORT ) hb_parni( 4 ); - iOffTop = !HB_ISNIL( 5 ) ? hb_parvni( 5,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 5 ) ? hb_parvni( 5,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 5 ) ? hb_parvni( 5,3 ) : 0 ; - iOffRight = !HB_ISNIL( 5 ) ? hb_parvni( 5,4 ) : 0; + iOffTop = ! HB_ISNIL( 5 ) ? hb_parvni( 5, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 5 ) ? hb_parvni( 5, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 5 ) ? hb_parvni( 5, 3 ) : 0; + iOffRight = ! HB_ISNIL( 5 ) ? hb_parvni( 5, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usRow, &usCol, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usRow, &usCol, NULL, NULL ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); - iTop = xy.y - 1 + iOffTop; - iLeft = xy.x - 1 + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); + iTop = xy.y - 1 + iOffTop; + iLeft = xy.x - 1 + iOffLeft; - yz = hb_gt_wvwGetXYFromColRow( pWindowData, usCol + usLen, usRow + 1 ); + yz = hb_gt_wvwGetXYFromColRow( pWindowData, usCol + usLen, usRow + 1 ); - yz.y -= pWindowData->byLineSpacing; + yz.y -= pWindowData->byLineSpacing; - iBottom = yz.y + iOffBottom; - iRight = yz.x + iOffRight; + iBottom = yz.y + iOffBottom; + iRight = yz.x + iOffRight; SelectObject( pWindowData->hdc, s_sApp->penGray ); - MoveToEx( pWindowData->hdc, iLeft-1, iTop-1, NULL ); - LineTo( pWindowData->hdc, iRight+1, iTop-1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); + LineTo( pWindowData->hdc, iRight + 1, iTop - 1 ); - MoveToEx( pWindowData->hdc, iLeft-1, iTop-1, NULL ); - LineTo( pWindowData->hdc, iLeft-1, iBottom+1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iTop - 1, NULL ); + LineTo( pWindowData->hdc, iLeft - 1, iBottom + 1 ); - MoveToEx( pWindowData->hdc, iLeft-1, iBottom+1, NULL ); - LineTo( pWindowData->hdc, iRight+1, iBottom+1 ); + MoveToEx( pWindowData->hdc, iLeft - 1, iBottom + 1, NULL ); + LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 ); - MoveToEx( pWindowData->hdc, iRight+1, iTop-1, NULL ); - LineTo( pWindowData->hdc, iRight+1, iBottom+1 ); + MoveToEx( pWindowData->hdc, iRight + 1, iTop - 1, NULL ); + LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 ); hb_retl( TRUE ); } @@ -963,64 +933,64 @@ HB_FUNC( WVW_DRAWBOXGET_XP ) HB_FUNC( WVW_DRAWBOXRAISED ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - WIN_DATA * pWindowData; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - BOOL bUseArray = HB_ISARRAY(6); + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + WIN_DATA * pWindowData; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + BOOL bUseArray = HB_ISARRAY( 6 ); - BOOL bTight = ( bUseArray || HB_ISNIL( 6 ) ? FALSE : hb_parl( 6 ) ); + BOOL bTight = ( bUseArray || HB_ISNIL( 6 ) ? FALSE : hb_parl( 6 ) ); int iOLeft, iOTop, iORight, iOBottom; pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - if (bTight) + if( bTight ) { - iOTop = 2; - iOLeft = 2; - iOBottom= -1; - iORight = -1; + iOTop = 2; + iOLeft = 2; + iOBottom = -1; + iORight = -1; } - else if (bUseArray) + else if( bUseArray ) { - iOTop = hb_parvni( 6,1 )-1; - iOLeft = hb_parvni( 6,2 )-1; - iOBottom= hb_parvni( 6,3 ); - iORight = hb_parvni( 6,4 ); + iOTop = hb_parvni( 6, 1 ) - 1; + iOLeft = hb_parvni( 6, 2 ) - 1; + iOBottom = hb_parvni( 6, 3 ); + iORight = hb_parvni( 6, 4 ); } else { - iOTop = -1; - iOLeft= -1; - iOBottom = 0; - iORight = 0; + iOTop = -1; + iOLeft = -1; + iOBottom = 0; + iORight = 0; } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOTop; - iLeft = xy.x + iOLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOTop; + iLeft = xy.x + iOLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight+1, usBottom+1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y + iOBottom; - iRight = xy.x + iORight; + iBottom = xy.y + iOBottom; + iRight = xy.x + iORight; hb_gt_wvwDrawBoxRaised( pWindowData->byWinId, iTop, iLeft, iBottom, iRight, - bTight ); + bTight ); hb_retl( TRUE ); } @@ -1043,63 +1013,63 @@ HB_FUNC( WVW_DRAWBOXRAISED ) HB_FUNC( WVW_DRAWBOXRECESSED ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - WIN_DATA * pWindowData; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - BOOL bUseArray = HB_ISARRAY(6); + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + WIN_DATA * pWindowData; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + BOOL bUseArray = HB_ISARRAY( 6 ); - BOOL bTight = ( bUseArray || HB_ISNIL( 6 ) ? FALSE : hb_parl( 6 ) ); + BOOL bTight = ( bUseArray || HB_ISNIL( 6 ) ? FALSE : hb_parl( 6 ) ); int iOLeft, iOTop, iORight, iOBottom; pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - if (bTight) + if( bTight ) { - iOTop = 2; - iOLeft = 2; - iOBottom= -1; - iORight = -1; + iOTop = 2; + iOLeft = 2; + iOBottom = -1; + iORight = -1; } - else if (bUseArray) + else if( bUseArray ) { - iOTop = hb_parvni( 6,1 )-1; - iOLeft = hb_parvni( 6,2 )-1; - iOBottom= hb_parvni( 6,3 ); - iORight = hb_parvni( 6,4 ); + iOTop = hb_parvni( 6, 1 ) - 1; + iOLeft = hb_parvni( 6, 2 ) - 1; + iOBottom = hb_parvni( 6, 3 ); + iORight = hb_parvni( 6, 4 ); } else { - iOTop = -1; - iOLeft= -1; - iOBottom = 0; - iORight = 0; + iOTop = -1; + iOLeft = -1; + iOBottom = 0; + iORight = 0; } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOTop; - iLeft = xy.x + iOLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOTop; + iLeft = xy.x + iOLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y + iOBottom; - iRight = xy.x + iORight; + iBottom = xy.y + iOBottom; + iRight = xy.x + iORight; hb_gt_wvwDrawBoxRecessed( pWindowData->byWinId, iTop, iLeft, iBottom, iRight, - bTight ); + bTight ); hb_retl( TRUE ); } @@ -1115,38 +1085,39 @@ HB_FUNC( WVW_DRAWBOXRECESSED ) HB_FUNC( WVW_DRAWBOXGROUP ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - WIN_DATA * pWindowData; - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + WIN_DATA * pWindowData; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0 ; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y - 1 + iOffTop; - iLeft = xy.x - 1 + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y - 1 + iOffTop; + iLeft = xy.x - 1 + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y + iOffBottom; - iRight = xy.x + iOffRight; + iBottom = xy.y + iOffBottom; + iRight = xy.x + iOffRight; SelectObject( pWindowData->hdc, s_sApp->penDarkGray ); @@ -1167,8 +1138,8 @@ HB_FUNC( WVW_DRAWBOXGROUP ) MoveToEx( pWindowData->hdc, iRight + 1, iTop, NULL ); /* Right Outer */ LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 ); - MoveToEx( pWindowData->hdc, iLeft -1, iBottom + 1, NULL ); /* Bottom Outer */ - LineTo( pWindowData->hdc, iRight + 1 + 1, iBottom + 1); + MoveToEx( pWindowData->hdc, iLeft - 1, iBottom + 1, NULL ); /* Bottom Outer */ + LineTo( pWindowData->hdc, iRight + 1 + 1, iBottom + 1 ); MoveToEx( pWindowData->hdc, iLeft, iTop, NULL ); /* Left Inner */ LineTo( pWindowData->hdc, iLeft, iBottom ); @@ -1187,33 +1158,33 @@ HB_FUNC( WVW_DRAWBOXGROUP ) HB_FUNC( WVW_DRAWBOXGROUPRAISED ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - WIN_DATA * pWindowData; - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + WIN_DATA * pWindowData; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y - 1; - iLeft = xy.x - 1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y - 1; + iLeft = xy.x - 1; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y; - iRight = xy.x; + iBottom = xy.y; + iRight = xy.x; SelectObject( pWindowData->hdc, s_sApp->penWhite ); @@ -1234,8 +1205,8 @@ HB_FUNC( WVW_DRAWBOXGROUPRAISED ) MoveToEx( pWindowData->hdc, iRight + 1, iTop, NULL ); /* Right Outer */ LineTo( pWindowData->hdc, iRight + 1, iBottom + 1 ); - MoveToEx( pWindowData->hdc, iLeft -1, iBottom + 1, NULL ); /* Bottom Outer */ - LineTo( pWindowData->hdc, iRight + 1 + 1, iBottom + 1); + MoveToEx( pWindowData->hdc, iLeft - 1, iBottom + 1, NULL ); /* Bottom Outer */ + LineTo( pWindowData->hdc, iRight + 1 + 1, iBottom + 1 ); MoveToEx( pWindowData->hdc, iLeft, iTop, NULL ); /* Left Inner */ LineTo( pWindowData->hdc, iLeft, iBottom ); @@ -1270,121 +1241,121 @@ HB_FUNC( WVW_DRAWBOXGROUPRAISED ) HB_FUNC( WVW_DRAWIMAGE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - POINT xy = { 0 }; - int iLeft, iTop, iRight = 0, iBottom = 0; - WIN_DATA * pWindowData; + UINT usWinNum = WVW_WHICH_WINDOW; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + POINT xy = { 0 }; + int iLeft, iTop, iRight = 0, iBottom = 0; + WIN_DATA * pWindowData; - BOOL bActBottom = HB_ISNIL( 4 ), - bActRight = HB_ISNIL( 5 ); - int iImgWidth =0, iImgHeight =0; + BOOL bActBottom = HB_ISNIL( 4 ), + bActRight = HB_ISNIL( 5 ); + int iImgWidth = 0, iImgHeight = 0; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - BOOL bTight = ( HB_ISARRAY(7) || HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ); - BOOL bUseArray = HB_ISARRAY(7); - BOOL bTransparent = ( HB_ISNIL( 8 ) ? FALSE : hb_parl( 8 ) ); + BOOL bTight = ( HB_ISARRAY( 7 ) || HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ); + BOOL bUseArray = HB_ISARRAY( 7 ); + BOOL bTransparent = ( HB_ISNIL( 8 ) ? FALSE : hb_parl( 8 ) ); int iOLeft, iOTop, iORight, iOBottom; BOOL bResult; pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - if (bTight) + if( bTight ) { - iOTop = 2+1; - iOLeft = 2+1; - iOBottom= -1; - iORight = -1; + iOTop = 2 + 1; + iOLeft = 2 + 1; + iOBottom = -1; + iORight = -1; } - else if (bUseArray) + else if( bUseArray ) { - iOTop = hb_parvni( 7,1 ); - iOLeft = hb_parvni( 7,2 ); - iOBottom= hb_parvni( 7,3 ); - iORight = hb_parvni( 7,4 ); + iOTop = hb_parvni( 7, 1 ); + iOLeft = hb_parvni( 7, 2 ); + iOBottom = hb_parvni( 7, 3 ); + iORight = hb_parvni( 7, 4 ); } else { - iOTop = iOLeft = iOBottom = iORight = 0; + iOTop = iOLeft = iOBottom = iORight = 0; } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOTop; - iLeft = xy.x + iOLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOTop; + iLeft = xy.x + iOLeft; - if (bActRight || bActBottom) + if( bActRight || bActBottom ) { - if (( !HB_ISNUM( 6 ) && !GetImageDimension(hb_parcx(6), &iImgWidth, &iImgHeight) ) + if( ( ! HB_ISNUM( 6 ) && ! GetImageDimension( hb_parcx( 6 ), &iImgWidth, &iImgHeight ) ) || - ( HB_ISNUM( 6 ) && !GetIPictDimension(s_sApp->iPicture[ hb_parni( 6 )-1 ], &iImgWidth, &iImgHeight) ) - ) + ( HB_ISNUM( 6 ) && ! GetIPictDimension( s_sApp->iPicture[ hb_parni( 6 ) - 1 ], &iImgWidth, &iImgHeight ) ) + ) { - bActRight = FALSE; - bActBottom = FALSE; + bActRight = FALSE; + bActBottom = FALSE; } else { - if ( bActRight && bActBottom ) + if( bActRight && bActBottom ) { - iRight = iLeft + iImgWidth - 1; - iBottom = iTop + iImgHeight - 1; + iRight = iLeft + iImgWidth - 1; + iBottom = iTop + iImgHeight - 1; } } } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - if ( !bActBottom ) + if( ! bActBottom ) { - iBottom = xy.y-1 + iOBottom; + iBottom = xy.y - 1 + iOBottom; } - if ( !bActRight ) + if( ! bActRight ) { - iRight = xy.x-1 + iORight; + iRight = xy.x - 1 + iORight; } - if (( bActBottom || bActRight ) && !( bActBottom && bActRight )) + if( ( bActBottom || bActRight ) && ! ( bActBottom && bActRight ) ) { int iDispWidth, iDispHeight; - if ( bActRight ) + if( bActRight ) { /* right corner (width) must be proportional to height */ iDispHeight = iBottom - iTop + 1; - iDispWidth = (int) ( (float) iImgWidth / iImgHeight * iDispHeight); - iRight = iLeft + iDispWidth - 1; + iDispWidth = ( int ) ( ( float ) iImgWidth / iImgHeight * iDispHeight ); + iRight = iLeft + iDispWidth - 1; } else { /* bottom corner (height) must be proportional to width */ - iDispWidth = iRight - iLeft + 1; - iDispHeight= (int) ( (float) iImgHeight / iImgWidth * iDispWidth); - iBottom = iTop + iDispHeight - 1; + iDispWidth = iRight - iLeft + 1; + iDispHeight = ( int ) ( ( float ) iImgHeight / iImgWidth * iDispWidth ); + iBottom = iTop + iDispHeight - 1; } } - if ( HB_ISNUM( 6 ) ) + if( HB_ISNUM( 6 ) ) { - bResult = hb_gt_wvwRenderPicture( usWinNum, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, s_sApp->iPicture[ hb_parni( 6 )-1 ], + bResult = hb_gt_wvwRenderPicture( usWinNum, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, s_sApp->iPicture[ hb_parni( 6 ) - 1 ], bTransparent ); } else @@ -1420,132 +1391,132 @@ HB_FUNC( WVW_DRAWIMAGE ) HB_FUNC( WVW_DRAWIMAGE_RESOURCE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - int iLeft, iTop, iRight=0, iBottom=0; - WIN_DATA * pWindowData; + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + int iLeft, iTop, iRight = 0, iBottom = 0; + WIN_DATA * pWindowData; - BOOL bActBottom = HB_ISNIL( 4 ), - bActRight = HB_ISNIL( 5 ); - int iImgWidth, iImgHeight; - LONG lImgWidth, lImgHeight; + BOOL bActBottom = HB_ISNIL( 4 ), + bActRight = HB_ISNIL( 5 ); + int iImgWidth, iImgHeight; + LONG lImgWidth, lImgHeight; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - BOOL bTight = ( HB_ISARRAY(7) || HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ); - BOOL bUseArray = HB_ISARRAY(7); - BOOL bTransparent = ( HB_ISNIL( 8 ) ? FALSE : hb_parl( 8 ) ); - int iOLeft, iOTop, iORight, iOBottom; - BOOL bResult = FALSE; - IPicture * pPic; + BOOL bTight = ( HB_ISARRAY( 7 ) || HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ); + BOOL bUseArray = HB_ISARRAY( 7 ); + BOOL bTransparent = ( HB_ISNIL( 8 ) ? FALSE : hb_parl( 8 ) ); + int iOLeft, iOTop, iORight, iOBottom; + BOOL bResult = FALSE; + IPicture * pPic; pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - if (bTight) + if( bTight ) { - iOTop = 2+1; - iOLeft = 2+1; - iOBottom= -1; - iORight = -1; + iOTop = 2 + 1; + iOLeft = 2 + 1; + iOBottom = -1; + iORight = -1; } - else if (bUseArray) + else if( bUseArray ) { - iOTop = hb_parvni( 7,1 ); - iOLeft = hb_parvni( 7,2 ); - iOBottom= hb_parvni( 7,3 ); - iORight = hb_parvni( 7,4 ); + iOTop = hb_parvni( 7, 1 ); + iOLeft = hb_parvni( 7, 2 ); + iOBottom = hb_parvni( 7, 3 ); + iORight = hb_parvni( 7, 4 ); } else { - iOTop = iOLeft = iOBottom = iORight = 0; + iOTop = iOLeft = iOBottom = iORight = 0; } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOTop; - iLeft = xy.x + iOLeft; - lImgWidth = 0; - lImgHeight = 0; - iImgWidth = 0; - iImgHeight = 0; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOTop; + iLeft = xy.x + iOLeft; + lImgWidth = 0; + lImgHeight = 0; + iImgWidth = 0; + iImgHeight = 0; - if ( !HB_ISNUM( 6 ) ) + if( ! HB_ISNUM( 6 ) ) { - pPic = rr_LoadPictureFromResource(hb_parcx(6), 0, &lImgWidth, &lImgHeight); + pPic = rr_LoadPictureFromResource( hb_parcx( 6 ), 0, &lImgWidth, &lImgHeight ); - if (pPic == NULL) - pPic = rr_LoadPicture(hb_parcx(6), &lImgWidth, &lImgHeight); + if( pPic == NULL ) + pPic = rr_LoadPicture( hb_parcx( 6 ), &lImgWidth, &lImgHeight ); } else { - pPic = rr_LoadPictureFromResource(NULL, hb_parni(6), &lImgWidth, &lImgHeight); + pPic = rr_LoadPictureFromResource( NULL, hb_parni( 6 ), &lImgWidth, &lImgHeight ); } // lImgWidth = iImgWidth; - // lImgHeight = iImgHeight; +// lImgHeight = iImgHeight; - if (pPic == NULL) - hb_retl( bResult ); + if( pPic == NULL ) + hb_retl( bResult ); - if (bActRight || bActBottom) + if( bActRight || bActBottom ) { - if ( !GetIPictDimension(pPic, &iImgWidth, &iImgHeight) ) + if( ! GetIPictDimension( pPic, &iImgWidth, &iImgHeight ) ) { - bActRight = FALSE; - bActBottom = FALSE; + bActRight = FALSE; + bActBottom = FALSE; } else { - if ( bActRight && bActBottom ) + if( bActRight && bActBottom ) { - iRight = iLeft + iImgWidth; - iBottom = iTop + iImgHeight; + iRight = iLeft + iImgWidth; + iBottom = iTop + iImgHeight; } } } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - if ( !bActBottom ) + if( ! bActBottom ) { - iBottom = xy.y-1 + iOBottom; + iBottom = xy.y - 1 + iOBottom; } - if ( !bActRight ) + if( ! bActRight ) { - iRight = xy.x-1 + iORight; + iRight = xy.x - 1 + iORight; } - if (( bActBottom || bActRight ) && !( bActBottom && bActRight )) + if( ( bActBottom || bActRight ) && ! ( bActBottom && bActRight ) ) { int iDispWidth, iDispHeight; - if ( bActRight ) + if( bActRight ) { /* right corner (width) must be proportional to height */ iDispHeight = iBottom - iTop + 1; - iDispWidth = (int) ( (float) iImgWidth / iImgHeight * iDispHeight); - iRight = iLeft + iDispWidth - 1; + iDispWidth = ( int ) ( ( float ) iImgWidth / iImgHeight * iDispHeight ); + iRight = iLeft + iDispWidth - 1; } else { /* bottom corner (height) must be proportional to width */ - iDispWidth = iRight - iLeft + 1; - iDispHeight= (int) ( (float) iImgHeight / iImgWidth * iDispWidth); - iBottom = iTop + iDispHeight - 1; + iDispWidth = iRight - iLeft + 1; + iDispHeight = ( int ) ( ( float ) iImgHeight / iImgWidth * iDispWidth ); + iBottom = iTop + iDispHeight - 1; } } @@ -1565,48 +1536,48 @@ HB_FUNC( WVW_DRAWIMAGE_RESOURCE ) HB_FUNC( WVW_DRAWLABEL ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - HFONT hFont, oldFont; - LOGFONT logfont = { 0 }; - int oldTextAlign; - COLORREF oldBkColor, oldTextColor; - WIN_DATA * pWindowData; - USHORT usRow = ( USHORT )hb_parni( 2 ), - usCol = ( USHORT )hb_parni( 3 ); + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + HFONT hFont, oldFont; + LOGFONT logfont = { 0 }; + int oldTextAlign; + COLORREF oldBkColor, oldTextColor; + WIN_DATA * pWindowData; + USHORT usRow = ( USHORT ) hb_parni( 2 ), + usCol = ( USHORT ) hb_parni( 3 ); pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usRow, &usCol, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usRow, &usCol, NULL, NULL ); } - logfont.lfEscapement = ( HB_ISNIL( 6 ) ? 0 : ( hb_parni( 6 ) * 10 ) ); - logfont.lfOrientation = 0; - logfont.lfWeight = ( HB_ISNIL( 12 ) ? 0 : hb_parni( 12 ) ); - logfont.lfItalic = ( HB_ISNIL( 15 ) ? 0 : ( BYTE )hb_parl( 15 ) ); - logfont.lfUnderline = ( HB_ISNIL( 16 ) ? 0 : ( BYTE )hb_parl( 16 ) ); - logfont.lfStrikeOut = ( HB_ISNIL( 17 ) ? 0 : ( BYTE )hb_parl( 17 ) ); - logfont.lfCharSet = ( HB_ISNIL( 14 ) ? ( BYTE )pWindowData->CodePage : ( BYTE ) hb_parni( 14 ) ); - logfont.lfOutPrecision = 0; - logfont.lfClipPrecision = 0; - logfont.lfQuality = ( HB_ISNIL( 13 ) ? DEFAULT_QUALITY : ( BYTE )hb_parni( 13 ) ); - logfont.lfPitchAndFamily = FF_DONTCARE; - logfont.lfHeight = ( HB_ISNIL( 10 ) ? pWindowData->fontHeight : hb_parni( 10 ) ); - logfont.lfWidth = ( HB_ISNIL( 11 ) ? (pWindowData->fontWidth <0 ? -pWindowData->fontWidth : pWindowData->fontWidth) : hb_parni( 11 ) ); + logfont.lfEscapement = ( HB_ISNIL( 6 ) ? 0 : ( hb_parni( 6 ) * 10 ) ); + logfont.lfOrientation = 0; + logfont.lfWeight = ( HB_ISNIL( 12 ) ? 0 : hb_parni( 12 ) ); + logfont.lfItalic = ( HB_ISNIL( 15 ) ? 0 : ( BYTE ) hb_parl( 15 ) ); + logfont.lfUnderline = ( HB_ISNIL( 16 ) ? 0 : ( BYTE ) hb_parl( 16 ) ); + logfont.lfStrikeOut = ( HB_ISNIL( 17 ) ? 0 : ( BYTE ) hb_parl( 17 ) ); + logfont.lfCharSet = ( HB_ISNIL( 14 ) ? ( BYTE ) pWindowData->CodePage : ( BYTE ) hb_parni( 14 ) ); + logfont.lfOutPrecision = 0; + logfont.lfClipPrecision = 0; + logfont.lfQuality = ( HB_ISNIL( 13 ) ? DEFAULT_QUALITY : ( BYTE ) hb_parni( 13 ) ); + logfont.lfPitchAndFamily = FF_DONTCARE; + logfont.lfHeight = ( HB_ISNIL( 10 ) ? pWindowData->fontHeight : hb_parni( 10 ) ); + logfont.lfWidth = ( HB_ISNIL( 11 ) ? ( pWindowData->fontWidth < 0 ? -pWindowData->fontWidth : pWindowData->fontWidth ) : hb_parni( 11 ) ); strcpy( logfont.lfFaceName, ( HB_ISNIL( 9 ) ? pWindowData->fontFace : hb_parcx( 9 ) ) ); hFont = CreateFontIndirect( &logfont ); - if ( hFont ) + if( hFont ) { - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); - oldBkColor = SetBkColor( pWindowData->hdc, HB_ISNIL( 8 ) ? pWindowData->background : ( COLORREF ) hb_parnl( 8 ) ); - oldTextColor = SetTextColor( pWindowData->hdc, HB_ISNIL( 7 ) ? pWindowData->foreground : ( COLORREF ) hb_parnl( 7 ) ); - oldTextAlign = SetTextAlign( pWindowData->hdc, ( HB_ISNIL( 5 ) ? TA_LEFT : hb_parni( 5 ) ) ); - oldFont = (HFONT) SelectObject( pWindowData->hdc, hFont ); + oldBkColor = SetBkColor( pWindowData->hdc, HB_ISNIL( 8 ) ? pWindowData->background : ( COLORREF ) hb_parnl( 8 ) ); + oldTextColor = SetTextColor( pWindowData->hdc, HB_ISNIL( 7 ) ? pWindowData->foreground : ( COLORREF ) hb_parnl( 7 ) ); + oldTextAlign = SetTextAlign( pWindowData->hdc, ( HB_ISNIL( 5 ) ? TA_LEFT : hb_parni( 5 ) ) ); + oldFont = ( HFONT ) SelectObject( pWindowData->hdc, hFont ); ExtTextOut( pWindowData->hdc, xy.x, xy.y, 0, NULL, hb_parcx( 4 ), strlen( hb_parcx( 4 ) ), NULL ); @@ -1631,43 +1602,43 @@ HB_FUNC( WVW_DRAWLABEL ) HB_FUNC( WVW_DRAWOUTLINE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - HPEN hPen = 0, hOldPen = 0; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; + UINT usWinNum = WVW_WHICH_WINDOW; + HPEN hPen = 0, hOldPen = 0; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - WIN_DATA * pWindowData; - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + WIN_DATA * pWindowData; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y - 1; - iLeft = xy.x - 1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y - 1; + iLeft = xy.x - 1; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight+1, usBottom+1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y; - iRight = xy.x; + iBottom = xy.y; + iRight = xy.x; - if ( HB_ISNUM( 6 ) ) + if( HB_ISNUM( 6 ) ) { hPen = CreatePen( hb_parni( 6 ), 0, ( HB_ISNIL( 8 ) ? 0 : ( COLORREF ) hb_parnl( 8 ) ) ); - if ( hPen ) + if( hPen ) { - hOldPen = (HPEN) SelectObject( pWindowData->hdc, hPen ); + hOldPen = ( HPEN ) SelectObject( pWindowData->hdc, hPen ); } } else @@ -1678,7 +1649,7 @@ HB_FUNC( WVW_DRAWOUTLINE ) hb_gt_wvwDrawOutline( usWinNum, iTop, iLeft, iBottom, iRight ); - if ( hPen ) + if( hPen ) { SelectObject( pWindowData->hdc, hOldPen ); DeleteObject( hPen ); @@ -1698,78 +1669,75 @@ HB_FUNC( WVW_DRAWOUTLINE ) HB_FUNC( WVW_DRAWLINE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight, iOffset ; + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight, iOffset; int iOffTop, iOffLeft, iOffBottom, iOffRight; int iOrient, iFormat, iAlign, iStyle, iThick; int x, y; COLORREF cr; HPEN hPen, hOldPen; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - WIN_DATA * pWindowData; - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + WIN_DATA * pWindowData; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - iOffTop = !HB_ISNIL( 12 ) ? hb_parvni( 12,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 12 ) ? hb_parvni( 12,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 12 ) ? hb_parvni( 12,3 ) : 0 ; - iOffRight = !HB_ISNIL( 12 ) ? hb_parvni( 12,4 ) : 0; + iOffTop = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 3 ) : 0; + iOffRight = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y-1 + iOffBottom; - iRight = xy.x-1 + iOffRight; + iBottom = xy.y - 1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; - iOrient = HB_ISNIL( 6 ) ? 0 : hb_parni( 6 ); - iFormat = HB_ISNIL( 7 ) ? 0 : hb_parni( 7 ); - iAlign = HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ); - iStyle = HB_ISNIL( 9 ) ? 0 : hb_parni( 9 ); - iThick = HB_ISNIL(10 ) ? 0 : hb_parni(10 ); - cr = HB_ISNIL(11 ) ? 0 : ( COLORREF ) hb_parnl( 11 ); + iOrient = HB_ISNIL( 6 ) ? 0 : hb_parni( 6 ); + iFormat = HB_ISNIL( 7 ) ? 0 : hb_parni( 7 ); + iAlign = HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ); + iStyle = HB_ISNIL( 9 ) ? 0 : hb_parni( 9 ); + iThick = HB_ISNIL( 10 ) ? 0 : hb_parni( 10 ); + cr = HB_ISNIL( 11 ) ? 0 : ( COLORREF ) hb_parnl( 11 ); - x = iLeft ; - y = iTop ; + x = iLeft; + y = iTop; - switch ( iAlign ) + switch( iAlign ) { - case 0: /* Center */ - { - if ( iOrient == 0 ) /* Horizontal */ + case 0: /* Center */ + if( iOrient == 0 ) /* Horizontal */ { - iOffset = ( ( iBottom - iTop ) / 2 ) ; - y = iTop + iOffset ; + iOffset = ( ( iBottom - iTop ) / 2 ); + y = iTop + iOffset; } else { - iOffset = ( ( iRight - iLeft ) / 2 ) ; - x = iLeft + iOffset ; + iOffset = ( ( iRight - iLeft ) / 2 ); + x = iLeft + iOffset; } - } - break; + break; case 1: /* Top */ - break; + break; case 2: /* bottom */ - { - if ( iFormat == 0 || iFormat == 1 ) + if( iFormat == 0 || iFormat == 1 ) { y = iBottom - 1; } @@ -1777,15 +1745,13 @@ HB_FUNC( WVW_DRAWLINE ) { y = iBottom; } - } - break; + break; case 3: /* Left */ - break; + break; case 4: /* Right */ - { - if ( iFormat == 0 || iFormat == 1 ) + if( iFormat == 0 || iFormat == 1 ) { x = iRight - 1; } @@ -1793,25 +1759,23 @@ HB_FUNC( WVW_DRAWLINE ) { x = iRight; } - } - break; + break; } - hPen = CreatePen( iStyle, iThick, cr ); - hOldPen = (HPEN) SelectObject( pWindowData->hdc, hPen ); + hPen = CreatePen( iStyle, iThick, cr ); + hOldPen = ( HPEN ) SelectObject( pWindowData->hdc, hPen ); - switch ( iFormat ) + switch( iFormat ) { - case 0: /* Raised */ - { - if ( iOrient == 0 ) /* Horizontal */ + case 0: /* Raised */ + if( iOrient == 0 ) /* Horizontal */ { SelectObject( pWindowData->hdc, s_sApp->penWhite ); MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, iRight, y ); SelectObject( pWindowData->hdc, hPen ); - MoveToEx( pWindowData->hdc, x, y+1, NULL ); - LineTo( pWindowData->hdc, iRight, y+1 ); + MoveToEx( pWindowData->hdc, x, y + 1, NULL ); + LineTo( pWindowData->hdc, iRight, y + 1 ); } else /* Vertical */ { @@ -1819,22 +1783,20 @@ HB_FUNC( WVW_DRAWLINE ) MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, x, iBottom ); SelectObject( pWindowData->hdc, hPen ); - MoveToEx( pWindowData->hdc, x+1, y, NULL ); - LineTo( pWindowData->hdc, x+1, iBottom ); + MoveToEx( pWindowData->hdc, x + 1, y, NULL ); + LineTo( pWindowData->hdc, x + 1, iBottom ); } - } - break; + break; case 1: /* Recessed */ - { - if ( iOrient == 0 ) /* Horizontal */ + if( iOrient == 0 ) /* Horizontal */ { SelectObject( pWindowData->hdc, hPen ); MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, iRight, y ); SelectObject( pWindowData->hdc, s_sApp->penWhite ); - MoveToEx( pWindowData->hdc, x, y+1, NULL ); - LineTo( pWindowData->hdc, iRight, y+1 ); + MoveToEx( pWindowData->hdc, x, y + 1, NULL ); + LineTo( pWindowData->hdc, iRight, y + 1 ); } else /* Vertical */ { @@ -1842,15 +1804,13 @@ HB_FUNC( WVW_DRAWLINE ) MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, x, iBottom ); SelectObject( pWindowData->hdc, s_sApp->penWhite ); - MoveToEx( pWindowData->hdc, x+1, y, NULL ); - LineTo( pWindowData->hdc, x+1, iBottom ); + MoveToEx( pWindowData->hdc, x + 1, y, NULL ); + LineTo( pWindowData->hdc, x + 1, iBottom ); } - } - break; + break; case 2: /* Plain */ - { - if ( iOrient == 0 ) /* Horizontal */ + if( iOrient == 0 ) /* Horizontal */ { SelectObject( pWindowData->hdc, hPen ); MoveToEx( pWindowData->hdc, x, y, NULL ); @@ -1862,8 +1822,7 @@ HB_FUNC( WVW_DRAWLINE ) MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, x, iBottom ); } - } - break; + break; } SelectObject( pWindowData->hdc, hOldPen ); @@ -1880,37 +1839,37 @@ HB_FUNC( WVW_DRAWLINE ) HB_FUNC( WVW_DRAWELLIPSE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - WIN_DATA * pWindowData =hb_gt_wvw_GetWindowsData( usWinNum ) ; - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - USHORT usTop = (USHORT )hb_parni( 2 ), - usLeft = (USHORT )hb_parni( 3 ), - usBottom = (USHORT )hb_parni( 4 ), - usRight = (USHORT )hb_parni( 5 ); + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0 ; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y-1 + iOffBottom; - iRight = xy.x-1 + iOffRight; + iBottom = xy.y - 1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; SelectObject( pWindowData->hdc, s_sApp->currentBrush ); SelectObject( pWindowData->hdc, s_sApp->currentPen ); @@ -1926,43 +1885,43 @@ HB_FUNC( WVW_DRAWELLIPSE ) HB_FUNC( WVW_DRAWRECTANGLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - WIN_DATA *pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ) ; - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); // Ref.: 28454 - Marson de Paula - 11/27/2007 - BOOL bUsaCurrentPen = ( HB_ISNIL( 7 ) ? TRUE : hb_parl( 7 ) ); + BOOL bUsaCurrentPen = ( HB_ISNIL( 7 ) ? TRUE : hb_parl( 7 ) ); - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0 ; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y-1 + iOffBottom; - iRight = xy.x-1 + iOffRight; + iBottom = xy.y - 1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; SelectObject( pWindowData->hdc, s_sApp->currentBrush ); // Ref.: 28454 - Marson de Paula - 11/27/2007 - if ( bUsaCurrentPen ) + if( bUsaCurrentPen ) { SelectObject( pWindowData->hdc, s_sApp->currentPen ); } @@ -1987,40 +1946,40 @@ HB_FUNC( WVW_DRAWRECTANGLE ) HB_FUNC( WVW_DRAWROUNDRECT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - int iTop, iLeft, iBottom, iRight, iWd, iHt; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - int iOffTop, iOffLeft, iOffBottom, iOffRight; + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + int iTop, iLeft, iBottom, iRight, iWd, iHt; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + int iOffTop, iOffLeft, iOffBottom, iOffRight; - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0 ; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y-1 + iOffBottom; - iRight = xy.x-1 + iOffRight; + iBottom = xy.y - 1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; - iWd = HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ); - iHt = HB_ISNIL( 7 ) ? 0 : hb_parni( 7 ); + iWd = HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ); + iHt = HB_ISNIL( 7 ) ? 0 : hb_parni( 7 ); SelectObject( pWindowData->hdc, s_sApp->currentBrush ); SelectObject( pWindowData->hdc, s_sApp->currentPen ); @@ -2036,36 +1995,36 @@ HB_FUNC( WVW_DRAWROUNDRECT ) HB_FUNC( WVW_DRAWFOCUSRECT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - RECT rc = { 0 }; - POINT xy = { 0 }; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - int iOffTop, iOffLeft, iOffBottom, iOffRight; + UINT usWinNum = WVW_WHICH_WINDOW; + RECT rc = { 0 }; + POINT xy = { 0 }; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + int iOffTop, iOffLeft, iOffBottom, iOffRight; - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0 ; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - rc.top = xy.y + iOffTop; - rc.left = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + rc.top = xy.y + iOffTop; + rc.left = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - rc.bottom = xy.y-1 + iOffBottom; - rc.right = xy.x-1 + iOffRight; + rc.bottom = xy.y - 1 + iOffBottom; + rc.right = xy.x - 1 + iOffRight; hb_retl( DrawFocusRect( pWindowData->hdc, &rc ) ); } @@ -2079,48 +2038,48 @@ HB_FUNC( WVW_DRAWFOCUSRECT ) */ HB_FUNC( WVW_DRAWCOLORRECT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WIN_DATA * pWindowMainData = hb_gt_wvw_GetWindowsData( 0 ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WIN_DATA * pWindowMainData = hb_gt_wvw_GetWindowsData( 0 ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); int iOffTop, iOffLeft, iOffBottom, iOffRight; - RECT rc = { 0 }; - POINT xy = { 0 }; - HBRUSH hBrush; + RECT rc = { 0 }; + POINT xy = { 0 }; + HBRUSH hBrush; - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0 ; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - rc.top = xy.y + iOffTop; - rc.left = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + rc.top = xy.y + iOffTop; + rc.left = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - rc.bottom = xy.y-1 + iOffBottom; - rc.right = xy.x-1 + iOffRight; + rc.bottom = xy.y - 1 + iOffBottom; + rc.right = xy.x - 1 + iOffRight; - hBrush = CreateSolidBrush( ( COLORREF ) hb_parnl( 7 ) ); + hBrush = CreateSolidBrush( ( COLORREF ) hb_parnl( 7 ) ); - if ( hBrush ) + if( hBrush ) { hb_retl( FillRect( pWindowData->hdc, &rc, hBrush ) ); - SelectObject( pWindowMainData->hdc, (HBRUSH) s_sApp->OriginalBrush ); + SelectObject( pWindowMainData->hdc, ( HBRUSH ) s_sApp->OriginalBrush ); DeleteObject( hBrush ); } } @@ -2133,41 +2092,41 @@ HB_FUNC( WVW_DRAWCOLORRECT ) HB_FUNC( WVW_DRAWGRIDHORZ ) { - UINT usWinNum = WVW_WHICH_WINDOW; - USHORT usAtRow = ( USHORT )hb_parni( 2 ); - int iRows = hb_parni( 5 ); - int i, y; - int iLeft, iRight; - WIN_DATA * pWindowData; - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; - USHORT usLeft, usRight; + UINT usWinNum = WVW_WHICH_WINDOW; + USHORT usAtRow = ( USHORT ) hb_parni( 2 ); + int iRows = hb_parni( 5 ); + int i, y; + int iLeft, iRight; + WIN_DATA * pWindowData; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + USHORT usLeft, usRight; pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - usLeft = (USHORT)hb_parni( 3 ); - usRight = (USHORT)hb_parni( 4 ); + usLeft = ( USHORT ) hb_parni( 3 ); + usRight = ( USHORT ) hb_parni( 4 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usAtRow, &usLeft, NULL, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usAtRow, &usLeft, NULL, &usRight ); } - iLeft = ( usLeft * pWindowData->PTEXTSIZE.x ); - iRight = ( ( ( usRight + 1 ) * pWindowData->PTEXTSIZE.x ) - 1 ); + iLeft = ( usLeft * pWindowData->PTEXTSIZE.x ); + iRight = ( ( ( usRight + 1 ) * pWindowData->PTEXTSIZE.x ) - 1 ); - if ( s_sApp->gridPen == NULL) + if( s_sApp->gridPen == NULL ) { - s_sApp->gridPen = CreatePen( 0, 0, GetSysColor(COLOR_BTNFACE) ); + s_sApp->gridPen = CreatePen( 0, 0, GetSysColor( COLOR_BTNFACE ) ); } SelectObject( pWindowData->hdc, s_sApp->gridPen ); - for ( i = 0; i < iRows; i++ ) + for( i = 0; i < iRows; i++ ) { - y = ( ( usAtRow ) * hb_wvw_LineHeight( pWindowData ) ); + y = ( ( usAtRow ) * hb_wvw_LineHeight( pWindowData ) ); - y += pWindowData->usTBHeight; + y += pWindowData->usTBHeight; MoveToEx( pWindowData->hdc, iLeft, y, NULL ); LineTo( pWindowData->hdc, iRight, y ); @@ -2190,57 +2149,57 @@ HB_FUNC( WVW_DRAWGRIDHORZ ) HB_FUNC( WVW_DRAWGRIDVERT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int iTop, iBottom, x; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - int i; - int iCharHeight, iCharWidth; - int iTabs = hb_parni( 5 ); - WIN_DATA * pWindowData; - USHORT usTop, usBottom, usCol; - APP_DATA * s_sApp = hb_gt_wvwGetAppData() ; + UINT usWinNum = WVW_WHICH_WINDOW; + int iTop, iBottom, x; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + int i; + int iCharHeight, iCharWidth; + int iTabs = hb_parni( 5 ); + WIN_DATA * pWindowData; + USHORT usTop, usBottom, usCol; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if ( ! iTabs ) + if( ! iTabs ) { hb_retl( FALSE ); } - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0 ; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; /* is not actually used */ + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; /* is not actually used */ HB_SYMBOL_UNUSED( iOffRight ); - usTop = ( USHORT )hb_parni( 2 ); - usBottom = ( USHORT )hb_parni( 3 ); - if (hb_gt_wvw_GetMainCoordMode()) + usTop = ( USHORT ) hb_parni( 2 ); + usBottom = ( USHORT ) hb_parni( 3 ); + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, NULL, &usBottom, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, NULL, &usBottom, NULL ); } iCharWidth = pWindowData->PTEXTSIZE.x; iCharHeight = hb_wvw_LineHeight( pWindowData ); - iTop = ( usTop * iCharHeight ) + pWindowData->usTBHeight + iOffTop; - iBottom = ( ( usBottom + 1 ) * iCharHeight ) - 1 + pWindowData->usTBHeight + iOffBottom; + iTop = ( usTop * iCharHeight ) + pWindowData->usTBHeight + iOffTop; + iBottom = ( ( usBottom + 1 ) * iCharHeight ) - 1 + pWindowData->usTBHeight + iOffBottom; - if ( s_sApp->gridPen == NULL) + if( s_sApp->gridPen == NULL ) { - s_sApp->gridPen = CreatePen( 0, 0, GetSysColor(COLOR_BTNFACE) ); + s_sApp->gridPen = CreatePen( 0, 0, GetSysColor( COLOR_BTNFACE ) ); } SelectObject( pWindowData->hdc, s_sApp->gridPen ); - for ( i = 1; i <= iTabs; i++ ) + for( i = 1; i <= iTabs; i++ ) { - usCol = (USHORT)hb_parvni( 4,i ); - if (hb_gt_wvw_GetMainCoordMode()) + usCol = ( USHORT ) hb_parvni( 4, i ); + if( hb_gt_wvw_GetMainCoordMode() ) { - usCol -= pWindowData->usColOfs; + usCol -= pWindowData->usColOfs; } x = ( usCol * iCharWidth ) + iOffLeft; @@ -2261,72 +2220,72 @@ HB_FUNC( WVW_DRAWGRIDVERT ) HB_FUNC( WVW_DRAWBUTTON ) { - UINT usWinNum = WVW_WHICH_WINDOW; - SIZE sz = { 0 }; - POINT xy = { 0 }; - RECT rc = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iAlign, oldTextAlign, oldBkMode; - int iTextHeight /*, iTextWidth */ ; - int iImageWidth, iImageHeight; + UINT usWinNum = WVW_WHICH_WINDOW; + SIZE sz = { 0 }; + POINT xy = { 0 }; + RECT rc = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iAlign, oldTextAlign, oldBkMode; + int iTextHeight /*, iTextWidth */; + int iImageWidth, iImageHeight; COLORREF /* oldBkColor, */ oldTextColor; - LOGBRUSH lb = { 0 }; - HBRUSH hBrush; - IPicture *iPicture; + LOGBRUSH lb = { 0 }; + HBRUSH hBrush; + IPicture * iPicture; - BOOL bText = HB_ISCHAR( 6 ); - BOOL bImage = !( HB_ISNIL( 7 ) ); - int iFormat = HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ); + BOOL bText = HB_ISCHAR( 6 ); + BOOL bImage = ! ( HB_ISNIL( 7 ) ); + int iFormat = HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ); - COLORREF textColor = HB_ISNIL( 9 ) ? _COLORS[ 0 ] : ( COLORREF ) hb_parnl( 9 ) ; - COLORREF bkColor = HB_ISNIL( 10 ) ? _COLORS[ 7 ] : ( COLORREF ) hb_parnl( 10) ; + COLORREF textColor = HB_ISNIL( 9 ) ? _COLORS[ 0 ] : ( COLORREF ) hb_parnl( 9 ); + COLORREF bkColor = HB_ISNIL( 10 ) ? _COLORS[ 7 ] : ( COLORREF ) hb_parnl( 10 ); - WIN_DATA * pWindowData; - WIN_DATA * pWindowMainData = hb_gt_wvw_GetWindowsData( 0 ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); - USHORT usTop = (USHORT) hb_parni( 2 ), - usLeft = (USHORT) hb_parni( 3 ), - usBottom = (USHORT) hb_parni( 4 ), - usRight = (USHORT) hb_parni( 5 ); + WIN_DATA * pWindowData; + WIN_DATA * pWindowMainData = hb_gt_wvw_GetWindowsData( 0 ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y; - iLeft = xy.x; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y; + iLeft = xy.x; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y-1; - iRight = xy.x-1; + iBottom = xy.y - 1; + iRight = xy.x - 1; - lb.lbStyle = BS_SOLID; - lb.lbColor = bkColor; - lb.lbHatch = 0; + lb.lbStyle = BS_SOLID; + lb.lbColor = bkColor; + lb.lbHatch = 0; - hBrush = CreateBrushIndirect( &lb ); + hBrush = CreateBrushIndirect( &lb ); - rc.left = iLeft ; - rc.top = iTop ; - rc.right = iRight + 1; - rc.bottom = iBottom + 1; + rc.left = iLeft; + rc.top = iTop; + rc.right = iRight + 1; + rc.bottom = iBottom + 1; FillRect( pWindowData->hdc, &rc, hBrush ); - SelectObject( pWindowMainData->hdc, (HBRUSH) s_sApp->OriginalBrush ); + SelectObject( pWindowMainData->hdc, ( HBRUSH ) s_sApp->OriginalBrush ); DeleteObject( hBrush ); - switch ( iFormat ) + switch( iFormat ) { case 1: - hb_gt_wvwDrawBoxRecessed( pWindowData->byWinId, iTop+1, iLeft+1, iBottom-1, iRight-1, + hb_gt_wvwDrawBoxRecessed( pWindowData->byWinId, iTop + 1, iLeft + 1, iBottom - 1, iRight - 1, FALSE ); break; case 2: @@ -2339,42 +2298,42 @@ HB_FUNC( WVW_DRAWBUTTON ) break; default: - hb_gt_wvwDrawBoxRaised( pWindowData->byWinId, iTop+1, iLeft+1, iBottom-1, iRight-1, + hb_gt_wvwDrawBoxRaised( pWindowData->byWinId, iTop + 1, iLeft + 1, iBottom - 1, iRight - 1, FALSE ); break; } - if ( bText ) + if( bText ) { ( HFONT ) SelectObject( pWindowData->hdc, GetStockObject( DEFAULT_GUI_FONT ) ); GetTextExtentPoint32( pWindowData->hdc, hb_parcx( 6 ), strlen( hb_parcx( 6 ) ), &sz ); - iTextHeight = sz.cy; + iTextHeight = sz.cy; - xy.x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ) ; + xy.x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ); - if ( bImage ) + if( bImage ) { xy.y = ( iBottom - 2 - iTextHeight ); } else { - xy.y = iTop + ( ( iBottom - iTop + 1 - iTextHeight ) / 2 ) ; + xy.y = iTop + ( ( iBottom - iTop + 1 - iTextHeight ) / 2 ); } - if ( iFormat == 1 ) + if( iFormat == 1 ) { - xy.x = xy.x + 2; - xy.y = xy.y + 2; + xy.x = xy.x + 2; + xy.y = xy.y + 2; } - iAlign = TA_CENTER + TA_TOP ; + iAlign = TA_CENTER + TA_TOP; - oldTextAlign = SetTextAlign( pWindowData->hdc, iAlign ); - oldBkMode = SetBkMode( pWindowData->hdc, TRANSPARENT ); - oldTextColor = SetTextColor( pWindowData->hdc, textColor ); + oldTextAlign = SetTextAlign( pWindowData->hdc, iAlign ); + oldBkMode = SetBkMode( pWindowData->hdc, TRANSPARENT ); + oldTextColor = SetTextColor( pWindowData->hdc, textColor ); ExtTextOut( pWindowData->hdc, xy.x, xy.y, 0, NULL, hb_parcx( 6 ), strlen( hb_parcx( 6 ) ), NULL ); @@ -2387,23 +2346,23 @@ HB_FUNC( WVW_DRAWBUTTON ) iTextHeight = -1; } - if ( bImage ) + if( bImage ) { - iImageWidth = ( iRight - iLeft + 1 - 8 ); + iImageWidth = ( iRight - iLeft + 1 - 8 ); - iImageHeight = ( iBottom - iTop + 1 - 8 - iTextHeight ); + iImageHeight = ( iBottom - iTop + 1 - 8 - iTextHeight ); - if ( HB_ISNUM( 7 ) ) + if( HB_ISNUM( 7 ) ) { iPicture = s_sApp->iPicture[ hb_parni( 7 ) - 1 ]; - hb_gt_wvwRenderPicture( usWinNum, iLeft+4, iTop+4, iImageWidth, iImageHeight, iPicture, + hb_gt_wvwRenderPicture( usWinNum, iLeft + 4, iTop + 4, iImageWidth, iImageHeight, iPicture, FALSE ); } else { - hb_gt_wvwDrawImage( usWinNum, iLeft+4, iTop+4, iImageWidth, iImageHeight, hb_parcx( 7 ), + hb_gt_wvwDrawImage( usWinNum, iLeft + 4, iTop + 4, iImageWidth, iImageHeight, hb_parcx( 7 ), FALSE ); } } @@ -2419,42 +2378,42 @@ HB_FUNC( WVW_DRAWBUTTON ) HB_FUNC( WVW_DRAWSTATUSBAR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); - int iPanels = hb_parni( 2 ); - int i, iNext; - int iTop, iLeft, iBottom, iRight; - POINT xy = { 0 }; - USHORT usTop , - usLeft , - usBottom , - usRight ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + int iPanels = hb_parni( 2 ); + int i, iNext; + int iTop, iLeft, iBottom, iRight; + POINT xy = { 0 }; + USHORT usTop, + usLeft, + usBottom, + usRight; iNext = 0; - for ( i = 0; i < iPanels; i++ ) + for( i = 0; i < iPanels; i++ ) { - usTop = ( USHORT )hb_parvni( 3, iNext+1 ); - usLeft = ( USHORT )hb_parvni( 3, iNext+2 ); - usBottom = ( USHORT )hb_parvni( 3, iNext+3 ); - usRight = ( USHORT )hb_parvni( 3, iNext+4 ); + usTop = ( USHORT ) hb_parvni( 3, iNext + 1 ); + usLeft = ( USHORT ) hb_parvni( 3, iNext + 2 ); + usBottom = ( USHORT ) hb_parvni( 3, iNext + 3 ); + usRight = ( USHORT ) hb_parvni( 3, iNext + 4 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y; - iLeft = xy.x + 1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y; + iLeft = xy.x + 1; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight , usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1; - iRight = xy.x - 2; + iBottom = xy.y - 1; + iRight = xy.x - 2; SelectObject( pWindowData->hdc, s_sApp->penWhite ); @@ -2475,40 +2434,40 @@ HB_FUNC( WVW_DRAWSTATUSBAR ) iNext = iNext + 4; } - usTop = ( USHORT )hb_parvni( 3, (4 * iPanels)-1 ); - usLeft = ( USHORT )hb_parvni( 3, 4 * iPanels ); + usTop = ( USHORT ) hb_parvni( 3, ( 4 * iPanels ) - 1 ); + usLeft = ( USHORT ) hb_parvni( 3, 4 * iPanels ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, NULL, NULL ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft , usTop + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iTop = xy.y - 2; - iLeft = xy.x - 2; - iBottom = iTop; - iRight = iLeft; + iTop = xy.y - 2; + iLeft = xy.x - 2; + iBottom = iTop; + iRight = iLeft; SelectObject( pWindowData->hdc, s_sApp->penBlack ); - MoveToEx( pWindowData->hdc, iLeft-4, iBottom, NULL ); - LineTo( pWindowData->hdc, iRight, iTop-4 ); - MoveToEx( pWindowData->hdc, iLeft-7, iBottom, NULL ); - LineTo( pWindowData->hdc, iRight, iTop-7 ); - MoveToEx( pWindowData->hdc, iLeft-10, iBottom, NULL ); - LineTo( pWindowData->hdc, iRight, iTop-10 ); + MoveToEx( pWindowData->hdc, iLeft - 4, iBottom, NULL ); + LineTo( pWindowData->hdc, iRight, iTop - 4 ); + MoveToEx( pWindowData->hdc, iLeft - 7, iBottom, NULL ); + LineTo( pWindowData->hdc, iRight, iTop - 7 ); + MoveToEx( pWindowData->hdc, iLeft - 10, iBottom, NULL ); + LineTo( pWindowData->hdc, iRight, iTop - 10 ); SelectObject( pWindowData->hdc, s_sApp->penWhite ); - MoveToEx( pWindowData->hdc, iLeft-5, iBottom, NULL ); - LineTo( pWindowData->hdc, iRight, iTop-5 ); - MoveToEx( pWindowData->hdc, iLeft-8, iBottom, NULL ); - LineTo( pWindowData->hdc, iRight, iTop-8 ); - MoveToEx( pWindowData->hdc, iLeft-11, iBottom, NULL ); - LineTo( pWindowData->hdc, iRight, iTop-11 ); + MoveToEx( pWindowData->hdc, iLeft - 5, iBottom, NULL ); + LineTo( pWindowData->hdc, iRight, iTop - 5 ); + MoveToEx( pWindowData->hdc, iLeft - 8, iBottom, NULL ); + LineTo( pWindowData->hdc, iRight, iTop - 8 ); + MoveToEx( pWindowData->hdc, iLeft - 11, iBottom, NULL ); + LineTo( pWindowData->hdc, iRight, iTop - 11 ); } @@ -2519,62 +2478,62 @@ HB_FUNC( WVW_DRAWSTATUSBAR ) HB_FUNC( WVW_DRAWPICTURE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - POINT xy = { 0 }; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); - int iTop, iLeft, iBottom, iRight; + UINT usWinNum = WVW_WHICH_WINDOW; + POINT xy = { 0 }; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + int iTop, iLeft, iBottom, iRight; - int iSlot = hb_parni( 6 ) - 1; + int iSlot = hb_parni( 6 ) - 1; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - BOOL bTight = ( HB_ISARRAY(7) || HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ); /* <-- none in gtwvt */ - BOOL bUseArray = HB_ISARRAY(7); + BOOL bTight = ( HB_ISARRAY( 7 ) || HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ); /* <-- none in gtwvt */ + BOOL bUseArray = HB_ISARRAY( 7 ); int iOLeft, iOTop, iORight, iOBottom; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - if (bTight) + if( bTight ) { - iOTop = 2+1; - iOLeft = 2+1; - iOBottom= -1; - iORight = -1; + iOTop = 2 + 1; + iOLeft = 2 + 1; + iOBottom = -1; + iORight = -1; } - else if (bUseArray) + else if( bUseArray ) { - iOTop = hb_parvni( 7,1 ); - iOLeft = hb_parvni( 7,2 ); - iOBottom= hb_parvni( 7,3 ); - iORight = hb_parvni( 7,4 ); + iOTop = hb_parvni( 7, 1 ); + iOLeft = hb_parvni( 7, 2 ); + iOBottom = hb_parvni( 7, 3 ); + iORight = hb_parvni( 7, 4 ); } else { - iOTop = iOLeft = iOBottom = iORight = 0; + iOTop = iOLeft = iOBottom = iORight = 0; } - if ( iSlot < WVW_PICTURES_MAX ) + if( iSlot < WVW_PICTURES_MAX ) { - if ( s_sApp->iPicture[ iSlot ] ) + if( s_sApp->iPicture[ iSlot ] ) { xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); iTop = xy.y + iOTop; iLeft = xy.x + iOLeft; xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - iBottom = xy.y-1 + iOBottom; - iRight = xy.x-1 + iORight; + iBottom = xy.y - 1 + iOBottom; + iRight = xy.x - 1 + iORight; hb_retl( hb_gt_wvwRenderPicture( usWinNum, iLeft, iTop, iRight - iLeft + 1, iBottom - iTop + 1, s_sApp->iPicture[ iSlot ], FALSE ) - ); + ); } } @@ -2588,31 +2547,31 @@ HB_FUNC( WVW_DRAWPICTURE ) HB_FUNC( WVW_DRAWLABELEX ) { - UINT usWinNum = WVW_WHICH_WINDOW; - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - POINT xy = { 0 }; - HFONT oldFont; - int oldTextAlign; - COLORREF oldBkColor, oldTextColor; - int iSlot = hb_parni( 8 ) - 1; + UINT usWinNum = WVW_WHICH_WINDOW; + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + POINT xy = { 0 }; + HFONT oldFont; + int oldTextAlign; + COLORREF oldBkColor, oldTextColor; + int iSlot = hb_parni( 8 ) - 1; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, NULL, NULL ); } - if ( s_sApp->hUserFonts[ iSlot ] ) + if( s_sApp->hUserFonts[ iSlot ] ) { - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - oldBkColor = SetBkColor( pWindowData->hdc, HB_ISNIL( 7 ) ? pWindowData->background : ( COLORREF ) hb_parnl( 7 ) ); - oldTextColor = SetTextColor( pWindowData->hdc, HB_ISNIL( 6 ) ? pWindowData->foreground : ( COLORREF ) hb_parnl( 6 ) ); - oldTextAlign = SetTextAlign( pWindowData->hdc, ( HB_ISNIL( 5 ) ? TA_LEFT : hb_parni( 5 ) ) ); - oldFont = ( HFONT ) SelectObject( pWindowData->hdc, s_sApp->hUserFonts[ iSlot ] ); + oldBkColor = SetBkColor( pWindowData->hdc, HB_ISNIL( 7 ) ? pWindowData->background : ( COLORREF ) hb_parnl( 7 ) ); + oldTextColor = SetTextColor( pWindowData->hdc, HB_ISNIL( 6 ) ? pWindowData->foreground : ( COLORREF ) hb_parnl( 6 ) ); + oldTextAlign = SetTextAlign( pWindowData->hdc, ( HB_ISNIL( 5 ) ? TA_LEFT : hb_parni( 5 ) ) ); + oldFont = ( HFONT ) SelectObject( pWindowData->hdc, s_sApp->hUserFonts[ iSlot ] ); ExtTextOut( pWindowData->hdc, xy.x, xy.y, 0, NULL, hb_parcx( 4 ), strlen( hb_parcx( 4 ) ), NULL ); @@ -2634,65 +2593,62 @@ HB_FUNC( WVW_DRAWLABELEX ) HB_FUNC( WVW_DRAWLINEEX ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight, iOffset ; - int iOrient, iFormat, iAlign ; - int x, y; - HPEN hPen; - int iSlot = hb_parni( 9 ) - 1; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight, iOffset; + int iOrient, iFormat, iAlign; + int x, y; + HPEN hPen; + int iSlot = hb_parni( 9 ) - 1; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y; - iLeft = xy.x; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y; + iLeft = xy.x; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - iBottom = xy.y-1; - iRight = xy.x-1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + iBottom = xy.y - 1; + iRight = xy.x - 1; - iOrient = HB_ISNIL( 6 ) ? 0 : hb_parni( 6 ); - iFormat = HB_ISNIL( 7 ) ? 0 : hb_parni( 7 ); - iAlign = HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ); + iOrient = HB_ISNIL( 6 ) ? 0 : hb_parni( 6 ); + iFormat = HB_ISNIL( 7 ) ? 0 : hb_parni( 7 ); + iAlign = HB_ISNIL( 8 ) ? 0 : hb_parni( 8 ); - x = iLeft ; - y = iTop ; + x = iLeft; + y = iTop; - switch ( iAlign ) + switch( iAlign ) { - case 0: /* Center */ - { - if ( iOrient == 0 ) /* Horizontal */ + case 0: /* Center */ + if( iOrient == 0 ) /* Horizontal */ { - iOffset = ( ( iBottom - iTop ) / 2 ) ; - y = iTop + iOffset ; + iOffset = ( ( iBottom - iTop ) / 2 ); + y = iTop + iOffset; } else { - iOffset = ( ( iRight - iLeft ) / 2 ) ; - x = iLeft + iOffset ; + iOffset = ( ( iRight - iLeft ) / 2 ); + x = iLeft + iOffset; } - } - break; + break; case 1: /* Top */ - break; + break; - case 2: /* bottom */ - { - if ( iFormat == 0 || iFormat == 1 ) /* Raised/Recessd */ + case 2: /* bottom */ + if( iFormat == 0 || iFormat == 1 ) /* Raised/Recessd */ { y = iBottom - 1; } @@ -2700,15 +2656,13 @@ HB_FUNC( WVW_DRAWLINEEX ) { y = iBottom; } - } - break; + break; case 3: /* Left */ - break; + break; - case 4: /* Right */ - { - if ( iFormat == 0 || iFormat == 1 ) /* Raised/Recessd */ + case 4: /* Right */ + if( iFormat == 0 || iFormat == 1 ) /* Raised/Recessd */ { x = iRight - 1; } @@ -2716,24 +2670,22 @@ HB_FUNC( WVW_DRAWLINEEX ) { x = iRight; } - } - break; + break; } hPen = s_sApp->hUserPens[ iSlot ]; - switch ( iFormat ) + switch( iFormat ) { - case 0: /* Raised */ - { - if ( iOrient == 0 ) /* Horizontal */ + case 0: /* Raised */ + if( iOrient == 0 ) /* Horizontal */ { SelectObject( pWindowData->hdc, s_sApp->penWhite ); MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, iRight, y ); SelectObject( pWindowData->hdc, hPen ); - MoveToEx( pWindowData->hdc, x, y+1, NULL ); - LineTo( pWindowData->hdc, iRight, y+1 ); + MoveToEx( pWindowData->hdc, x, y + 1, NULL ); + LineTo( pWindowData->hdc, iRight, y + 1 ); } else /* Vertical */ { @@ -2741,22 +2693,20 @@ HB_FUNC( WVW_DRAWLINEEX ) MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, x, iBottom ); SelectObject( pWindowData->hdc, hPen ); - MoveToEx( pWindowData->hdc, x+1, y, NULL ); - LineTo( pWindowData->hdc, x+1, iBottom ); + MoveToEx( pWindowData->hdc, x + 1, y, NULL ); + LineTo( pWindowData->hdc, x + 1, iBottom ); } - } - break; + break; case 1: /* Recessed */ - { - if ( iOrient == 0 ) /* Horizontal */ + if( iOrient == 0 ) /* Horizontal */ { SelectObject( pWindowData->hdc, hPen ); MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, iRight, y ); SelectObject( pWindowData->hdc, s_sApp->penWhite ); - MoveToEx( pWindowData->hdc, x, y+1, NULL ); - LineTo( pWindowData->hdc, iRight, y+1 ); + MoveToEx( pWindowData->hdc, x, y + 1, NULL ); + LineTo( pWindowData->hdc, iRight, y + 1 ); } else /* Vertical */ { @@ -2764,15 +2714,13 @@ HB_FUNC( WVW_DRAWLINEEX ) MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, x, iBottom ); SelectObject( pWindowData->hdc, s_sApp->penWhite ); - MoveToEx( pWindowData->hdc, x+1, y, NULL ); - LineTo( pWindowData->hdc, x+1, iBottom ); + MoveToEx( pWindowData->hdc, x + 1, y, NULL ); + LineTo( pWindowData->hdc, x + 1, iBottom ); } - } - break; + break; case 2: /* Plain */ - { - if ( iOrient == 0 ) /* Horizontal */ + if( iOrient == 0 ) /* Horizontal */ { SelectObject( pWindowData->hdc, hPen ); MoveToEx( pWindowData->hdc, x, y, NULL ); @@ -2784,8 +2732,7 @@ HB_FUNC( WVW_DRAWLINEEX ) MoveToEx( pWindowData->hdc, x, y, NULL ); LineTo( pWindowData->hdc, x, iBottom ); } - } - break; + break; } hb_retl( TRUE ); @@ -2798,33 +2745,33 @@ HB_FUNC( WVW_DRAWLINEEX ) HB_FUNC( WVW_DRAWOUTLINEEX ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - APP_DATA * s_sApp = hb_gt_wvwGetAppData(); - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iSlot = hb_parni( 6 ) - 1; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + APP_DATA * s_sApp = hb_gt_wvwGetAppData(); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iSlot = hb_parni( 6 ) - 1; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y - 1; - iLeft = xy.x - 1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y - 1; + iLeft = xy.x - 1; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight+1, usBottom+1 ); - iBottom = xy.y; - iRight = xy.x; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + iBottom = xy.y; + iRight = xy.x; - if ( s_sApp->hUserPens[ iSlot ] ) + if( s_sApp->hUserPens[ iSlot ] ) { SelectObject( pWindowData->hdc, s_sApp->hUserPens[ iSlot ] ); } diff --git a/harbour/extras/gtwvw/wvwedit.c b/harbour/extras/gtwvw/wvwedit.c index 09585b6ece..12271a880e 100644 --- a/harbour/extras/gtwvw/wvwedit.c +++ b/harbour/extras/gtwvw/wvwedit.c @@ -79,14 +79,14 @@ /*WVW_EBcreate( [nWinNum], nTop, nLeft, nBottom, nRight, cText, bBlock, ; * lMultiline, nMoreStyle, nMaxChar, nReserved, aOffset) - *create editbox for window nWinNum - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nBottom: row of bottom/right corner (in character unit) - *nRight: col of bottom/right corner (in character unit) - *cText: initial text to display, default = "" + **create editbox for window nWinNum + **nTop: row of top/left corner (in character unit) + **nLeft: col of top/left corner (in character unit) + **nBottom: row of bottom/right corner (in character unit) + **nRight: col of bottom/right corner (in character unit) + **cText: initial text to display, default = "" * WARNING!! must be of "C" typed! - *bBlock: codeblock to execute on these events: + **bBlock: codeblock to execute on these events: * event=EN_SETFOCUS(...): editbox got focus * event=EN_KILLFOCUS(...): editbox lose focus * This codeblock will be evaluated with these parameters: @@ -95,227 +95,231 @@ * nType : event type (EN_SETFOCUS/EN_KILLFOCUS supported) * * - *lMultiline: .f. :: single line editbox (default) + **lMultiline: .f. :: single line editbox (default) * .t. :: multi line editbox * mapped internally into two types of editbox: * WVW_EB_SINGLELINE (1): single line editbox * WVW_EB_MULTILINE (2): multi line editbox * default is WVW_EB_SINGLELINE (1) * - *nMoreStyle: more style that will be added to the predefined style + **nMoreStyle: more style that will be added to the predefined style * some examples: ES_PASSWORD, ES_READONLY * - *nMaxChar: (FUTURE FEATURE) maximum number of chars allowed + **nMaxChar: (FUTURE FEATURE) maximum number of chars allowed * - *nReserved: reserved for future use + **nReserved: reserved for future use * - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust + **aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust * dimension of editbox. * defaults: {-2,-2,+2,+2} * - *returns control id of newly created editbox of windows nWinNum - *returns 0 if failed + **returns control id of newly created editbox of windows nWinNum + **returns 0 if failed * - *example: + **example: */ -HB_FUNC( WVW_EBCREATE) +HB_FUNC( WVW_EBCREATE ) { - HANDLE hInstance = NULL; - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndParent = pWindowData->hWnd; - HWND hWndEB; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - UINT uiEBid; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - LPTSTR lpszText = (LPTSTR) hb_parcx( 6 ); + HANDLE hInstance = NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndParent = pWindowData->hWnd; + HWND hWndEB; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + UINT uiEBid; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + LPTSTR lpszText = ( LPTSTR ) hb_parcx( 6 ); - BOOL bMultiline = (HB_ISLOG(8) ? hb_parl(8) : FALSE); - BYTE bEBType = (BYTE) (bMultiline ? WVW_EB_MULTILINE : WVW_EB_SINGLELINE); + BOOL bMultiline = ( HB_ISLOG( 8 ) ? hb_parl( 8 ) : FALSE ); + BYTE bEBType = ( BYTE ) ( bMultiline ? WVW_EB_MULTILINE : WVW_EB_SINGLELINE ); - DWORD dwMoreStyle = (DWORD) (HB_ISNUM(9) ? hb_parnl(9) : 0); + DWORD dwMoreStyle = ( DWORD ) ( HB_ISNUM( 9 ) ? hb_parnl( 9 ) : 0 ); - USHORT usMaxChar = (USHORT) (HB_ISNUM(10) && hb_parni(10)>0 ? hb_parni(10) : 0); + USHORT usMaxChar = ( USHORT ) ( HB_ISNUM( 10 ) && hb_parni( 10 ) > 0 ? hb_parni( 10 ) : 0 ); - DWORD dwStyle; - WVW_DATA * pData= hb_getWvwData( ) ; - if (pWindowData->hEBfont==NULL) + DWORD dwStyle; + WVW_DATA * pData = hb_getWvwData(); + + if( pWindowData->hEBfont == NULL ) { pWindowData->hEBfont = CreateFontIndirect( &pData->s_lfEB ); - if (pWindowData->hEBfont==NULL) + if( pWindowData->hEBfont == NULL ) { - hb_retnl(0); - return; + hb_retnl( 0 ); + return; } } - iOffTop = !HB_ISNIL( 12 ) ? hb_parvni( 12,1 ) : 0; - iOffLeft = !HB_ISNIL( 12 ) ? hb_parvni( 12,2 ) : 0; - iOffBottom = !HB_ISNIL( 12 ) ? hb_parvni( 12,3 ) : 0; - iOffRight = !HB_ISNIL( 12 ) ? hb_parvni( 12,4 ) : 0; + iOffTop = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 3 ) : 0; + iOffRight = ! HB_ISNIL( 12 ) ? hb_parvni( 12, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop ; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + iOffBottom; - iRight = xy.x - 1 + iOffRight; + iBottom = xy.y - 1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; - uiEBid = LastControlId(usWinNum, WVW_CONTROL_EDITBOX); - if (uiEBid==0) + uiEBid = LastControlId( usWinNum, WVW_CONTROL_EDITBOX ); + if( uiEBid == 0 ) { - uiEBid = WVW_ID_BASE_EDITBOX; + uiEBid = WVW_ID_BASE_EDITBOX; } else { - uiEBid++; + uiEBid++; } dwStyle = WS_BORDER | WS_GROUP | WS_TABSTOP | dwMoreStyle; - if ((bEBType & WVW_EB_MULTILINE) == WVW_EB_MULTILINE) + if( ( bEBType & WVW_EB_MULTILINE ) == WVW_EB_MULTILINE ) { - dwStyle |= ES_AUTOVSCROLL | ES_MULTILINE | - ES_WANTRETURN | WS_BORDER | WS_VSCROLL; + dwStyle |= ES_AUTOVSCROLL | ES_MULTILINE | + ES_WANTRETURN | WS_BORDER | WS_VSCROLL; } else { - dwStyle |= ES_AUTOHSCROLL; + dwStyle |= ES_AUTOHSCROLL; } - if ( pWindowData->CodePage == OEM_CHARSET ) + if( pWindowData->CodePage == OEM_CHARSET ) { - dwStyle |= ES_OEMCONVERT; + dwStyle |= ES_OEMCONVERT; } hb_winmainArgGet( &hInstance, NULL, NULL ); hWndEB = CreateWindowEx( - 0L, - "EDIT", - (LPSTR) NULL, - WS_CHILD | WS_VISIBLE | (DWORD) dwStyle, - iLeft, - iTop, - iRight-iLeft+1, - iBottom-iTop+1, - hWndParent, - (HMENU) uiEBid, - (HINSTANCE) hInstance, - (LPVOID) NULL - ); + 0L, + "EDIT", + ( LPSTR ) NULL, + WS_CHILD | WS_VISIBLE | ( DWORD ) dwStyle, + iLeft, + iTop, + iRight - iLeft + 1, + iBottom - iTop + 1, + hWndParent, + ( HMENU ) uiEBid, + ( HINSTANCE ) hInstance, + ( LPVOID ) NULL + ); - if(hWndEB) + if( hWndEB ) { - RECT rXB = { 0 }, rOffXB = { 0 }; - WNDPROC OldProc; - //USHORT i; - BOOL bFromOEM = ( pWindowData->CodePage == OEM_CHARSET ); + RECT rXB = { 0 }, rOffXB = { 0 }; + WNDPROC OldProc; + //USHORT i; + BOOL bFromOEM = ( pWindowData->CodePage == OEM_CHARSET ); - if (bFromOEM) - { - ULONG ulLen = (ULONG) strlen(lpszText); - LPTSTR lpszTextANSI = (LPTSTR) hb_xgrab(ulLen+1); - OemToChar( lpszText, lpszTextANSI ); - lpszText = lpszTextANSI; - } + if( bFromOEM ) + { + ULONG ulLen = ( ULONG ) strlen( lpszText ); + LPTSTR lpszTextANSI = ( LPTSTR ) hb_xgrab( ulLen + 1 ); + OemToChar( lpszText, lpszTextANSI ); + lpszText = lpszTextANSI; + } - SendMessage( - (HWND) hWndEB, - WM_SETTEXT, - 0, - (LPARAM) lpszText - ); + SendMessage( + ( HWND ) hWndEB, + WM_SETTEXT, + 0, + ( LPARAM ) lpszText + ); - if (bFromOEM) - { - hb_xfree(lpszText); - } + if( bFromOEM ) + { + hb_xfree( lpszText ); + } - if (usMaxChar>0) - { - SendMessage( - (HWND) hWndEB, - EM_LIMITTEXT, - (WPARAM) usMaxChar, - (LPARAM) 0 - ); - } + if( usMaxChar > 0 ) + { + SendMessage( + ( HWND ) hWndEB, + EM_LIMITTEXT, + ( WPARAM ) usMaxChar, + ( LPARAM ) 0 + ); + } - rXB.top = usTop; rXB.left= usLeft; - rXB.bottom=usBottom; rXB.right =usRight; - rOffXB.top = iOffTop; rOffXB.left= iOffLeft; - rOffXB.bottom=iOffBottom; rOffXB.right =iOffRight; + rXB.top = usTop; rXB.left = usLeft; + rXB.bottom = usBottom; rXB.right = usRight; + rOffXB.top = iOffTop; rOffXB.left = iOffLeft; + rOffXB.bottom = iOffBottom; rOffXB.right = iOffRight; - AddControlHandle(usWinNum, WVW_CONTROL_EDITBOX, hWndEB, uiEBid, (PHB_ITEM) hb_param( 7, HB_IT_BLOCK ), rXB, rOffXB, (byte) bEBType); + AddControlHandle( usWinNum, WVW_CONTROL_EDITBOX, hWndEB, uiEBid, ( PHB_ITEM ) hb_param( 7, HB_IT_BLOCK ), rXB, rOffXB, ( byte ) bEBType ); - OldProc = (WNDPROC) SetWindowLongPtr (hWndEB, - GWLP_WNDPROC, (LONG_PTR) hb_gt_wvwEBProc) ; + OldProc = ( WNDPROC ) SetWindowLongPtr( hWndEB, + GWLP_WNDPROC, ( LONG_PTR ) hb_gt_wvwEBProc ); - StoreControlProc(usWinNum, WVW_CONTROL_EDITBOX, hWndEB, OldProc); + StoreControlProc( usWinNum, WVW_CONTROL_EDITBOX, hWndEB, OldProc ); - SendMessage( hWndEB, WM_SETFONT, (WPARAM) pWindowData->hEBfont, (LPARAM) TRUE); + SendMessage( hWndEB, WM_SETFONT, ( WPARAM ) pWindowData->hEBfont, ( LPARAM ) TRUE ); - hb_retnl( (LONG) uiEBid ); + hb_retnl( ( LONG ) uiEBid ); } else { - hb_retnl( (LONG) 0 ); + hb_retnl( ( LONG ) 0 ); } } /*WVW_EBdestroy( [nWinNum], nEBid ) - *destroy editbox nEBid for window nWinNum + *destroy editbox nEBid for window nWinNum */ -HB_FUNC( WVW_EBDESTROY) +HB_FUNC( WVW_EBDESTROY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - UINT uiEBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - CONTROL_DATA * pcdPrev = (CONTROL_DATA *) NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT uiEBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + CONTROL_DATA * pcdPrev = ( CONTROL_DATA * ) NULL; - while (pcd) + while( pcd ) { - if (pcd->byCtrlClass == WVW_CONTROL_EDITBOX && pcd->uiCtrlid == uiEBid) - { - break; - } + if( pcd->byCtrlClass == WVW_CONTROL_EDITBOX && pcd->uiCtrlid == uiEBid ) + { + break; + } - pcdPrev = pcd; - pcd = pcd->pNext; + pcdPrev = pcd; + pcd = pcd->pNext; } - if (pcd==NULL) { return; } - - DestroyWindow (pcd->hWndCtrl) ; - - if (pcdPrev==NULL) + if( pcd == NULL ) { - pWindowData->pcdCtrlList = pcd->pNext; + return; + } + + DestroyWindow( pcd->hWndCtrl ); + + if( pcdPrev == NULL ) + { + pWindowData->pcdCtrlList = pcd->pNext; } else { - pcdPrev->pNext = pcd->pNext; + pcdPrev->pNext = pcd->pNext; } - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); @@ -325,137 +329,137 @@ HB_FUNC( WVW_EBDESTROY) } /*WVW_EBsetFocus( [nWinNum], nEditId ) - *set the focus to editbox nEditId in window nWinNum + *set the focus to editbox nEditId in window nWinNum */ HB_FUNC( WVW_EBSETFOCUS ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - byte bStyle; - HWND hWndEB = FindControlHandle(usWinNum, WVW_CONTROL_EDITBOX, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + byte bStyle; + HWND hWndEB = FindControlHandle( usWinNum, WVW_CONTROL_EDITBOX, uiCtrlId, &bStyle ); - if (hWndEB) - { - hb_retl( SetFocus(hWndEB) != NULL ); - } - else - { - hb_retl(FALSE); - } + if( hWndEB ) + { + hb_retl( SetFocus( hWndEB ) != NULL ); + } + else + { + hb_retl( FALSE ); + } } /*WVW_EBisFocused( [nWinNum], nEditId ) - *returns .t. if the focus is on editbox nEditId in window nWinNum + *returns .t. if the focus is on editbox nEditId in window nWinNum */ HB_FUNC( WVW_EBISFOCUSED ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - byte bStyle; - HWND hWndEB = FindControlHandle(usWinNum, WVW_CONTROL_EDITBOX, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + byte bStyle; + HWND hWndEB = FindControlHandle( usWinNum, WVW_CONTROL_EDITBOX, uiCtrlId, &bStyle ); - hb_retl((HWND) GetFocus() == hWndEB); + hb_retl( ( HWND ) GetFocus() == hWndEB ); } /*WVW_EBenable( [nWinNum], nEditId, [lEnable] ) - *enable/disable editbox nEditId on window nWinNum - *(lEnable defaults to .t., ie. enabling the editbox) - *return previous state of the editbox (TRUE:enabled FALSE:disabled) - *(if nEditId is invalid, this function returns FALSE too) + *enable/disable editbox nEditId on window nWinNum + *(lEnable defaults to .t., ie. enabling the editbox) + *return previous state of the editbox (TRUE:enabled FALSE:disabled) + *(if nEditId is invalid, this function returns FALSE too) */ HB_FUNC( WVW_EBENABLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - BOOL bEnable = HB_ISNIL(3) ? TRUE : hb_parl(3); - byte bStyle; - HWND hWndEB = FindControlHandle(usWinNum, WVW_CONTROL_EDITBOX, uiCtrlId, &bStyle); - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + BOOL bEnable = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + byte bStyle; + HWND hWndEB = FindControlHandle( usWinNum, WVW_CONTROL_EDITBOX, uiCtrlId, &bStyle ); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (hWndEB) - { - hb_retl( EnableWindow(hWndEB, bEnable)==0 ); + if( hWndEB ) + { + hb_retl( EnableWindow( hWndEB, bEnable ) == 0 ); - if (!bEnable) - { - SetFocus( pWindowData->hWnd ); - } - } - else - { - hb_retl(FALSE); - } + if( ! bEnable ) + { + SetFocus( pWindowData->hWnd ); + } + } + else + { + hb_retl( FALSE ); + } } /*WVW_EBeditable( [nWinNum], nEditId, [lEditable] ) - *get/set editability attribute from editbox nEditId on window nWinNum - *(if lEditable is not specified, no change to editability) - *return previous state of the editbox (TRUE:editable FALSE:not editable) - *(if nEditId is invalid, this function returns FALSE too) + *get/set editability attribute from editbox nEditId on window nWinNum + *(if lEditable is not specified, no change to editability) + *return previous state of the editbox (TRUE:editable FALSE:not editable) + *(if nEditId is invalid, this function returns FALSE too) */ HB_FUNC( WVW_EBEDITABLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - BOOL bEditable = HB_ISNIL(3) ? TRUE : hb_parl(3); - byte bStyle; - HWND hWndEB = FindControlHandle(usWinNum, WVW_CONTROL_EDITBOX, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + BOOL bEditable = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + byte bStyle; + HWND hWndEB = FindControlHandle( usWinNum, WVW_CONTROL_EDITBOX, uiCtrlId, &bStyle ); - if (hWndEB) - { - DWORD dwStyle = (DWORD) GetWindowLong( hWndEB, GWL_STYLE ); + if( hWndEB ) + { + DWORD dwStyle = ( DWORD ) GetWindowLong( hWndEB, GWL_STYLE ); - hb_retl( !((dwStyle & ES_READONLY)==ES_READONLY) ); + hb_retl( ! ( ( dwStyle & ES_READONLY ) == ES_READONLY ) ); - if (!HB_ISNIL(3)) - { - SendMessage( - (HWND) hWndEB, - EM_SETREADONLY, - (WPARAM) !bEditable, - (LPARAM) 0 - ); - } - } - else - { - hb_retl(FALSE); - } + if( ! HB_ISNIL( 3 ) ) + { + SendMessage( + ( HWND ) hWndEB, + EM_SETREADONLY, + ( WPARAM ) ! bEditable, + ( LPARAM ) 0 + ); + } + } + else + { + hb_retl( FALSE ); + } } /*WVW_EBsetcodeblock( [nWinNum], nEBid, bBlock ) - *assign (new) codeblock bBlock to editbox nEBid for window nWinNum + *assign (new) codeblock bBlock to editbox nEBid for window nWinNum * * return .t. if successful */ HB_FUNC( WVW_EBSETCODEBLOCK ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiEBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid); - WVW_DATA * pData= hb_getWvwData( ) ; - PHB_ITEM phiCodeBlock = hb_param( 3, HB_IT_BLOCK ); - BOOL bOldSetting = pData->s_bRecurseCBlock; + UINT uiEBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid ); + WVW_DATA * pData = hb_getWvwData(); + PHB_ITEM phiCodeBlock = hb_param( 3, HB_IT_BLOCK ); + BOOL bOldSetting = pData->s_bRecurseCBlock; - if (!phiCodeBlock || pcd==NULL || pcd->bBusy) + if( ! phiCodeBlock || pcd == NULL || pcd->bBusy ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } pData->s_bRecurseCBlock = FALSE; - pcd->bBusy = TRUE; + pcd->bBusy = TRUE; - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); } - pcd->phiCodeBlock = hb_itemNew( phiCodeBlock ); + pcd->phiCodeBlock = hb_itemNew( phiCodeBlock ); - pcd->bBusy = FALSE; + pcd->bBusy = FALSE; pData->s_bRecurseCBlock = bOldSetting; hb_retl( TRUE ); @@ -464,58 +468,58 @@ HB_FUNC( WVW_EBSETCODEBLOCK ) /*WVW_EBSetFont([nWinNum], cFontFace, nHeight, nWidth, nWeight, nQUality,; * lItalic, lUnderline, lStrikeout * - *this will initialize font for ALL editboxes in window nWinNum - *(including ones created later on) + **this will initialize font for ALL editboxes in window nWinNum + **(including ones created later on) * - *TODO: ? should nHeight be ignored, and always forced to use standard char height? + **TODO: ? should nHeight be ignored, and always forced to use standard char height? */ HB_FUNC( WVW_EBSETFONT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - BOOL retval = TRUE; - WVW_DATA * pData= hb_getWvwData( ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + BOOL retval = TRUE; + WVW_DATA * pData = hb_getWvwData(); - pData->s_lfEB.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); - pData->s_lfEB.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfEB.lfWidth : hb_parni( 4 ); - pData->s_lfEB.lfEscapement = 0; - pData->s_lfEB.lfOrientation = 0; - pData->s_lfEB.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfEB.lfWeight : hb_parni( 5 ); - pData->s_lfEB.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfEB.lfItalic : ( BYTE )hb_parl( 7 ); - pData->s_lfEB.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfEB.lfUnderline : ( BYTE )hb_parl( 8 ); - pData->s_lfEB.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfEB.lfStrikeOut : ( BYTE )hb_parl( 9 ); - pData->s_lfEB.lfCharSet = DEFAULT_CHARSET; + pData->s_lfEB.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); + pData->s_lfEB.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfEB.lfWidth : hb_parni( 4 ); + pData->s_lfEB.lfEscapement = 0; + pData->s_lfEB.lfOrientation = 0; + pData->s_lfEB.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfEB.lfWeight : hb_parni( 5 ); + pData->s_lfEB.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfEB.lfItalic : ( BYTE ) hb_parl( 7 ); + pData->s_lfEB.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfEB.lfUnderline : ( BYTE ) hb_parl( 8 ); + pData->s_lfEB.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfEB.lfStrikeOut : ( BYTE ) hb_parl( 9 ); + pData->s_lfEB.lfCharSet = DEFAULT_CHARSET; - pData->s_lfEB.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfEB.lfQuality : ( BYTE )hb_parni( 6 ); - pData->s_lfEB.lfPitchAndFamily = FF_DONTCARE; - if ( HB_ISCHAR( 2 ) ) + pData->s_lfEB.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfEB.lfQuality : ( BYTE ) hb_parni( 6 ); + pData->s_lfEB.lfPitchAndFamily = FF_DONTCARE; + if( HB_ISCHAR( 2 ) ) { strcpy( pData->s_lfEB.lfFaceName, hb_parcx( 2 ) ); } - if (pWindowData->hEBfont) + if( pWindowData->hEBfont ) { HFONT hOldFont = pWindowData->hEBfont; - HFONT hFont = CreateFontIndirect( &pData->s_lfEB ); - if (hFont) + HFONT hFont = CreateFontIndirect( &pData->s_lfEB ); + if( hFont ) { CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) + while( pcd ) { - if ((pcd->byCtrlClass == WVW_CONTROL_EDITBOX) && - ((HFONT) SendMessage( pcd->hWndCtrl, WM_GETFONT, (WPARAM) 0, (LPARAM) 0) == hOldFont) - ) - { - SendMessage( pcd->hWndCtrl, WM_SETFONT, (WPARAM) hFont, (LPARAM) TRUE); + if( ( pcd->byCtrlClass == WVW_CONTROL_EDITBOX ) && + ( ( HFONT ) SendMessage( pcd->hWndCtrl, WM_GETFONT, ( WPARAM ) 0, ( LPARAM ) 0 ) == hOldFont ) + ) + { + SendMessage( pcd->hWndCtrl, WM_SETFONT, ( WPARAM ) hFont, ( LPARAM ) TRUE ); - } + } - pcd = pcd->pNext; + pcd = pcd->pNext; } pWindowData->hEBfont = hFont; - DeleteObject( (HFONT) hOldFont ); + DeleteObject( ( HFONT ) hOldFont ); } else @@ -529,324 +533,327 @@ HB_FUNC( WVW_EBSETFONT ) } /*WVW_EBIsMultiline( [nWinNum], nEBid ) - *returns .t. if editbox nEBid in window nWinNum is multiline - *otherwise .f. - *Also returns .f. if nEBid not valid + *returns .t. if editbox nEBid in window nWinNum is multiline + *otherwise .f. + *Also returns .f. if nEBid not valid */ HB_FUNC( WVW_EBISMULTILINE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiEBid = hb_parni(2); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid); - BOOL bMultiline; + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiEBid = hb_parni( 2 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid ); + BOOL bMultiline; - if (pcd==NULL) + if( pcd == NULL ) { - hb_retl(FALSE); + hb_retl( FALSE ); return; } - bMultiline = ((pcd->bStyle & WVW_EB_MULTILINE) == WVW_EB_MULTILINE); - hb_retl(bMultiline); + bMultiline = ( ( pcd->bStyle & WVW_EB_MULTILINE ) == WVW_EB_MULTILINE ); + hb_retl( bMultiline ); } /*WVW_EBgettext( [nWinNum], nEBid,; * lSoftBreak ) - *returns current text from editbox nEBid in window nWinNum - *lSoftBreak: Default is FALSE. + **returns current text from editbox nEBid in window nWinNum + **lSoftBreak: Default is FALSE. * insert soft line break character (CR+CR+LF) at wordwrap positions * can be usefull to convert the text to MEMO format * eg. converting editbox's softbreaks into memoline softbreak: * cStr := wvw_ebgettext(NIL, nEBid, .t.) * cStr := strtran(cStr, CR+CR+LF, chr(141)+LF) * - *returns "" in case of error (eg. nEBid not valid) + **returns "" in case of error (eg. nEBid not valid) */ HB_FUNC( WVW_EBGETTEXT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiEBid = hb_parni(2); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid); - BOOL bSoftBreak = (HB_ISLOG(3) ? hb_parl(3) : FALSE); - USHORT usLen; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - LPTSTR lpszTextANSI; - BOOL bToOEM = ( pWindowData->CodePage == OEM_CHARSET ); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiEBid = hb_parni( 2 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid ); + BOOL bSoftBreak = ( HB_ISLOG( 3 ) ? hb_parl( 3 ) : FALSE ); + USHORT usLen; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + LPTSTR lpszTextANSI; + BOOL bToOEM = ( pWindowData->CodePage == OEM_CHARSET ); - if (pcd==NULL) + if( pcd == NULL ) { - hb_retl(FALSE); + hb_retl( FALSE ); return; } - if (bSoftBreak) + if( bSoftBreak ) { SendMessage( - (HWND) pcd->hWndCtrl, - EM_FMTLINES, - (WPARAM) TRUE, - (LPARAM) 0 - ); + ( HWND ) pcd->hWndCtrl, + EM_FMTLINES, + ( WPARAM ) TRUE, + ( LPARAM ) 0 + ); } - usLen = ( USHORT )SendMessage( (HWND) pcd->hWndCtrl, WM_GETTEXTLENGTH, 0, 0 ) + 1 ; + usLen = ( USHORT ) SendMessage( ( HWND ) pcd->hWndCtrl, WM_GETTEXTLENGTH, 0, 0 ) + 1; - lpszTextANSI = ( LPTSTR ) hb_xgrab( usLen ); + lpszTextANSI = ( LPTSTR ) hb_xgrab( usLen ); SendMessage( - (HWND) pcd->hWndCtrl, - WM_GETTEXT, - usLen, - (LPARAM) lpszTextANSI - ); + ( HWND ) pcd->hWndCtrl, + WM_GETTEXT, + usLen, + ( LPARAM ) lpszTextANSI + ); - if (bToOEM) + if( bToOEM ) { - ULONG ulLen = (ULONG) strlen(lpszTextANSI); - LPTSTR lpszText = (LPTSTR) hb_xgrab(ulLen+1); - CharToOem( lpszTextANSI, lpszText ); - hb_retc( lpszText ); - hb_xfree( lpszText ); + ULONG ulLen = ( ULONG ) strlen( lpszTextANSI ); + LPTSTR lpszText = ( LPTSTR ) hb_xgrab( ulLen + 1 ); + CharToOem( lpszTextANSI, lpszText ); + hb_retc( lpszText ); + hb_xfree( lpszText ); } else { - hb_retc( lpszTextANSI ); + hb_retc( lpszTextANSI ); } hb_xfree( lpszTextANSI ); } /*WVW_EBsettext( [nWinNum], nEBid, cText ) - *set current text of editbox nEBid in window nWinNum - *returns .t. if successful, .f. in case of error (eg. nEBid not valid) + *set current text of editbox nEBid in window nWinNum + *returns .t. if successful, .f. in case of error (eg. nEBid not valid) */ HB_FUNC( WVW_EBSETTEXT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiEBid = hb_parni(2); - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid); - BOOL bRetval; - LPTSTR lpszText = (LPTSTR) hb_parcx( 3 ); - BOOL bFromOEM = ( pWindowData->CodePage == OEM_CHARSET ); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiEBid = hb_parni( 2 ); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid ); + BOOL bRetval; + LPTSTR lpszText = ( LPTSTR ) hb_parcx( 3 ); + BOOL bFromOEM = ( pWindowData->CodePage == OEM_CHARSET ); - if (pcd==NULL) + if( pcd == NULL ) { - hb_retl(FALSE); + hb_retl( FALSE ); return; } - if (bFromOEM) + if( bFromOEM ) { - ULONG ulLen = (ULONG) strlen(lpszText); - LPTSTR lpszTextANSI = (LPTSTR) hb_xgrab(ulLen+1); - OemToChar( lpszText, lpszTextANSI ); - lpszText = lpszTextANSI; + ULONG ulLen = ( ULONG ) strlen( lpszText ); + LPTSTR lpszTextANSI = ( LPTSTR ) hb_xgrab( ulLen + 1 ); + OemToChar( lpszText, lpszTextANSI ); + lpszText = lpszTextANSI; } bRetval = SendMessage( - (HWND) pcd->hWndCtrl, - WM_SETTEXT, - 0, - (LPARAM) lpszText - ); + ( HWND ) pcd->hWndCtrl, + WM_SETTEXT, + 0, + ( LPARAM ) lpszText + ); - if (bFromOEM) + if( bFromOEM ) { - hb_xfree(lpszText); + hb_xfree( lpszText ); } hb_retl( bRetval ); } /*WVW_EBgetsel( [nWinNum], nEBid, @nstart, @nend ) - *get selected text editbox nEBid in window nWinNum - *the start selected text (0-based) is in nstart - *the end selected text (0-based) is in nend - *returns .t. if operation successful - *returns .f. if not (eg. nEBid not valid) + *get selected text editbox nEBid in window nWinNum + *the start selected text (0-based) is in nstart + *the end selected text (0-based) is in nend + *returns .t. if operation successful + *returns .f. if not (eg. nEBid not valid) */ HB_FUNC( WVW_EBGETSEL ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiEBid = hb_parni(2); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid); - DWORD dwStart, dwEnd; + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiEBid = hb_parni( 2 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid ); + DWORD dwStart, dwEnd; - if (pcd==NULL) + if( pcd == NULL ) { - hb_retl(FALSE); + hb_retl( FALSE ); return; } - SendMessage( (HWND) pcd->hWndCtrl, + SendMessage( ( HWND ) pcd->hWndCtrl, EM_GETSEL, - (WPARAM) &dwStart, - (LPARAM) &dwEnd - ); + ( WPARAM ) &dwStart, + ( LPARAM ) &dwEnd + ); - if (HB_ISBYREF(3)) hb_stornl( dwStart, 3 ); - if (HB_ISBYREF(4)) hb_stornl( dwEnd, 4 ); - hb_retl(TRUE); + if( HB_ISBYREF( 3 ) ) + hb_stornl( dwStart, 3 ); + if( HB_ISBYREF( 4 ) ) + hb_stornl( dwEnd, 4 ); + hb_retl( TRUE ); } /*WVW_EBsetsel( [nWinNum], nEBid, nstart, nend ) - *set selected text editbox nEBid in window nWinNum - *the start selected text (0-based) is in nstart - *the end selected text (0-based) is in nend - *notes: nstart may be > nend (flipped selection) - *notes: to selet all text: WVW_EBsetsel(nwinnum, nebid, 0, -1) - *returns .t. if operation successful - *returns .f. if not (eg. nEBid not valid) + *set selected text editbox nEBid in window nWinNum + *the start selected text (0-based) is in nstart + *the end selected text (0-based) is in nend + *notes: nstart may be > nend (flipped selection) + *notes: to selet all text: WVW_EBsetsel(nwinnum, nebid, 0, -1) + *returns .t. if operation successful + *returns .f. if not (eg. nEBid not valid) */ HB_FUNC( WVW_EBSETSEL ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiEBid = hb_parni(2); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid); - DWORD dwStart = (DWORD) (HB_ISNUM(3) ? hb_parnl(3) : 0); - DWORD dwEnd = (DWORD) (HB_ISNUM(4) ? hb_parnl(4) : 0); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiEBid = hb_parni( 2 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_EDITBOX, NULL, uiEBid ); + DWORD dwStart = ( DWORD ) ( HB_ISNUM( 3 ) ? hb_parnl( 3 ) : 0 ); + DWORD dwEnd = ( DWORD ) ( HB_ISNUM( 4 ) ? hb_parnl( 4 ) : 0 ); - if (pcd==NULL) + if( pcd == NULL ) { - hb_retl(FALSE); + hb_retl( FALSE ); return; } - SendMessage( (HWND) pcd->hWndCtrl, + SendMessage( ( HWND ) pcd->hWndCtrl, EM_SETSEL, - (WPARAM) dwStart, - (LPARAM) dwEnd - ); - hb_retl(TRUE); + ( WPARAM ) dwStart, + ( LPARAM ) dwEnd + ); + hb_retl( TRUE ); } //Static controls HB_FUNC( WVW_STCREATE ) { - HANDLE hInstance = NULL; - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WVW_DATA * pData = hb_getWvwData( ) ; - HWND hWndParent = pWindowData->hWnd; - HWND hWndCB; + HANDLE hInstance = NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * pData = hb_getWvwData(); + HWND hWndParent = pWindowData->hWnd; + HWND hWndCB; //RECT r; // HDC hDc; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - UINT uiCBid; - BOOL bBorder = hb_parnl( 7 ) ; - ULONG ulExStyle = 0 | ( bBorder ? WS_EX_CLIENTEDGE:0 ); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + UINT uiCBid; + BOOL bBorder = hb_parnl( 7 ); + ULONG ulExStyle = 0 | ( bBorder ? WS_EX_CLIENTEDGE : 0 ); - USHORT usWidth = ( USHORT )hb_parni( 4 ); - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = HB_ISNUM(11) ? ( USHORT )hb_parni(11) : usTop, - usRight = HB_ISNUM(12) ? ( USHORT )hb_parni( 12 ) : usLeft + usWidth - 1; + USHORT usWidth = ( USHORT ) hb_parni( 4 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = HB_ISNUM( 11 ) ? ( USHORT ) hb_parni( 11 ) : usTop, + usRight = HB_ISNUM( 12 ) ? ( USHORT ) hb_parni( 12 ) : usLeft + usWidth - 1; //char * sText = hb_parc( 5 ); - int iStyle = ( bBorder ? WS_BORDER :0 ) ; - int iBox = HB_ISNUM(10) ? hb_parni( 10 ) : 0; - HFONT hFont = NULL; - if (iBox > 0 ) + int iStyle = ( bBorder ? WS_BORDER : 0 ); + int iBox = HB_ISNUM( 10 ) ? hb_parni( 10 ) : 0; + HFONT hFont = NULL; + + if( iBox > 0 ) iStyle |= iBox; - if (HB_ISNUM(8)) - hFont = (HFONT) HB_PARHANDLE( 8 ) ; + if( HB_ISNUM( 8 ) ) + hFont = ( HFONT ) HB_PARHANDLE( 8 ); else - if (pWindowData->hSTfont==NULL) + if( pWindowData->hSTfont == NULL ) + { + pWindowData->hSTfont = CreateFontIndirect( &pData->s_lfST ); + if( pWindowData->hSTfont == NULL ) { - pWindowData->hSTfont = CreateFontIndirect( &pData->s_lfST ); - if (pWindowData->hSTfont==NULL) - { - hb_retnl(0); - return; - } + hb_retnl( 0 ); + return; } - - - - iOffTop = !HB_ISNIL( 6 ) ? hb_parvni( 6,1 ) : 0; - iOffLeft = !HB_ISNIL( 6 ) ? hb_parvni( 6,2 ) : 0; - - iOffBottom = !HB_ISNIL( 6 ) ? hb_parvni( 6,3 ) : 0; - iOffRight = !HB_ISNIL( 6 ) ? hb_parvni( 6,4 ) : 0; - - if (hb_gt_wvw_GetMainCoordMode()) - { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop ; - iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + iOffTop = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 2 ) : 0; - iBottom = xy.y - 1 + iOffBottom ; - iRight = xy.x - 1 + iOffRight; + iOffBottom = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 3 ) : 0; + iOffRight = ! HB_ISNIL( 6 ) ? hb_parvni( 6, 4 ) : 0; - uiCBid = LastControlId( usWinNum, WVW_CONTROL_STATIC); - if (uiCBid==0) + if( hb_gt_wvw_GetMainCoordMode() ) { - uiCBid = WVW_ID_BASE_STATIC; + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); + } + + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; + + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + + xy.y -= pWindowData->byLineSpacing; + + iBottom = xy.y - 1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; + + uiCBid = LastControlId( usWinNum, WVW_CONTROL_STATIC ); + if( uiCBid == 0 ) + { + uiCBid = WVW_ID_BASE_STATIC; } else { - uiCBid++; + uiCBid++; } hb_winmainArgGet( &hInstance, NULL, NULL ); hWndCB = CreateWindowEx( - ulExStyle, - "STATIC", - (LPSTR) NULL, - WS_CHILD | WS_VISIBLE | (DWORD) iStyle, - iLeft, - iTop, - iRight-iLeft+1, - iBottom-iTop+1, - hWndParent, - (HMENU) uiCBid, - (HINSTANCE) hInstance, - (LPVOID) NULL - ); + ulExStyle, + "STATIC", + ( LPSTR ) NULL, + WS_CHILD | WS_VISIBLE | ( DWORD ) iStyle, + iLeft, + iTop, + iRight - iLeft + 1, + iBottom - iTop + 1, + hWndParent, + ( HMENU ) uiCBid, + ( HINSTANCE ) hInstance, + ( LPVOID ) NULL + ); - if(hWndCB) + if( hWndCB ) { - RECT rXB = { 0 }, rOffXB = { 0 }; + RECT rXB = { 0 }, rOffXB = { 0 }; // WNDPROC OldProc; - rXB.top = usTop; rXB.left= usLeft; - rXB.bottom=usBottom; rXB.right =usRight; - rOffXB.top = iOffTop; rOffXB.left= iOffLeft; - rOffXB.bottom=iOffBottom; rOffXB.right =iOffRight; + rXB.top = usTop; rXB.left = usLeft; + rXB.bottom = usBottom; rXB.right = usRight; + rOffXB.top = iOffTop; rOffXB.left = iOffLeft; + rOffXB.bottom = iOffBottom; rOffXB.right = iOffRight; - if( HB_ISCHAR(5)) - { - SendMessage( hWndCB, WM_SETTEXT, 0, (LPARAM) hb_parc(5) ); - } - if (hFont) - SendMessage( hWndCB, WM_SETFONT, (WPARAM) hFont, (LPARAM) TRUE); - else - SendMessage( hWndCB, WM_SETFONT, (WPARAM) pWindowData->hSTfont, (LPARAM) TRUE); - hb_retnl( (LONG) uiCBid ); - HB_STOREHANDLE( hWndCB ,9); + if( HB_ISCHAR( 5 ) ) + { + SendMessage( hWndCB, WM_SETTEXT, 0, ( LPARAM ) hb_parc( 5 ) ); + } + if( hFont ) + SendMessage( hWndCB, WM_SETFONT, ( WPARAM ) hFont, ( LPARAM ) TRUE ); + else + SendMessage( hWndCB, WM_SETFONT, ( WPARAM ) pWindowData->hSTfont, ( LPARAM ) TRUE ); + hb_retnl( ( LONG ) uiCBid ); + HB_STOREHANDLE( hWndCB, 9 ); } else { - hb_retnl( (LONG) 0 ); + hb_retnl( ( LONG ) 0 ); } } @@ -854,68 +861,68 @@ HB_FUNC( WVW_STCREATE ) HB_FUNC( WVW_STSETTEXT ) { // byte bStyle; - HWND hWndCB = (HWND) HB_PARHANDLE( 2 ); + HWND hWndCB = ( HWND ) HB_PARHANDLE( 2 ); - if (hWndCB) - { + if( hWndCB ) + { - SetWindowText( (HWND) hWndCB, (LPCTSTR) hb_parc( 3 ) ); - hb_retl(1); - } - else - { - hb_retl(FALSE); - } + SetWindowText( ( HWND ) hWndCB, ( LPCTSTR ) hb_parc( 3 ) ); + hb_retl( 1 ); + } + else + { + hb_retl( FALSE ); + } } HB_FUNC( WVW_STSETFONT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WVW_DATA * pData= hb_getWvwData( ) ; - BOOL retval = TRUE; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * pData = hb_getWvwData(); + BOOL retval = TRUE; - pData->s_lfST.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); - pData->s_lfST.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfST.lfWidth : hb_parni( 4 ); - pData->s_lfST.lfEscapement = 0; - pData->s_lfST.lfOrientation = 0; - pData->s_lfST.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfST.lfWeight : hb_parni( 5 ); - pData->s_lfST.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfST.lfItalic : ( BYTE )hb_parl( 7 ); - pData->s_lfST.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfST.lfUnderline : ( BYTE )hb_parl( 8 ); - pData->s_lfST.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfST.lfStrikeOut : ( BYTE )hb_parl( 9 ); - pData->s_lfST.lfCharSet = DEFAULT_CHARSET; + pData->s_lfST.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); + pData->s_lfST.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfST.lfWidth : hb_parni( 4 ); + pData->s_lfST.lfEscapement = 0; + pData->s_lfST.lfOrientation = 0; + pData->s_lfST.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfST.lfWeight : hb_parni( 5 ); + pData->s_lfST.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfST.lfItalic : ( BYTE ) hb_parl( 7 ); + pData->s_lfST.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfST.lfUnderline : ( BYTE ) hb_parl( 8 ); + pData->s_lfST.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfST.lfStrikeOut : ( BYTE ) hb_parl( 9 ); + pData->s_lfST.lfCharSet = DEFAULT_CHARSET; - pData->s_lfST.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfST.lfQuality : ( BYTE )hb_parni( 6 ); - pData->s_lfST.lfPitchAndFamily = FF_DONTCARE; - if ( HB_ISCHAR( 2 ) ) + pData->s_lfST.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfST.lfQuality : ( BYTE ) hb_parni( 6 ); + pData->s_lfST.lfPitchAndFamily = FF_DONTCARE; + if( HB_ISCHAR( 2 ) ) { strcpy( pData->s_lfST.lfFaceName, hb_parcx( 2 ) ); } - if (pWindowData->hSTfont) + if( pWindowData->hSTfont ) { HFONT hOldFont = pWindowData->hSTfont; - HFONT hFont = CreateFontIndirect( &pData->s_lfST ); - if (hFont) + HFONT hFont = CreateFontIndirect( &pData->s_lfST ); + if( hFont ) { CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) + while( pcd ) { - if ((pcd->byCtrlClass == WVW_CONTROL_STATIC) && - ((HFONT) SendMessage( pcd->hWndCtrl, WM_GETFONT, (WPARAM) 0, (LPARAM) 0) == hOldFont) - ) - { - SendMessage( pcd->hWndCtrl, WM_SETFONT, (WPARAM) hFont, (LPARAM) TRUE); + if( ( pcd->byCtrlClass == WVW_CONTROL_STATIC ) && + ( ( HFONT ) SendMessage( pcd->hWndCtrl, WM_GETFONT, ( WPARAM ) 0, ( LPARAM ) 0 ) == hOldFont ) + ) + { + SendMessage( pcd->hWndCtrl, WM_SETFONT, ( WPARAM ) hFont, ( LPARAM ) TRUE ); - } + } - pcd = pcd->pNext; + pcd = pcd->pNext; } pWindowData->hSTfont = hFont; - DeleteObject( (HFONT) hOldFont ); + DeleteObject( ( HFONT ) hOldFont ); } else diff --git a/harbour/extras/gtwvw/wvwfuncs.c b/harbour/extras/gtwvw/wvwfuncs.c index 21a31016d7..26baa2084a 100644 --- a/harbour/extras/gtwvw/wvwfuncs.c +++ b/harbour/extras/gtwvw/wvwfuncs.c @@ -79,23 +79,23 @@ HB_FUNC( WVW_YESCLOSE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HMENU hMenu = GetSystemMenu( pWindowData->hWnd, FALSE); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HMENU hMenu = GetSystemMenu( pWindowData->hWnd, FALSE ); - if (hMenu) + if( hMenu ) { - AppendMenu( hMenu, SC_CLOSE, MF_BYCOMMAND, ""); + AppendMenu( hMenu, SC_CLOSE, MF_BYCOMMAND, "" ); DrawMenuBar( pWindowData->hWnd ); } } HB_FUNC( WIN_SENDMESSAGE ) { - char *cText = NULL; + char * cText = NULL; if( HB_ISBYREF( 4 ) ) { - cText = ( char* ) hb_xgrab( hb_parcsiz( 4 ) ); + cText = ( char * ) hb_xgrab( hb_parcsiz( 4 ) ); hb_xmemcpy( cText, hb_parcx( 4 ), hb_parcsiz( 4 ) ); } @@ -103,11 +103,11 @@ HB_FUNC( WIN_SENDMESSAGE ) ( UINT ) hb_parni( 2 ), ( HB_ISNIL( 3 ) ? 0 : ( WPARAM ) hb_parnl( 3 ) ), ( HB_ISNIL( 4 ) ? 0 : ( HB_ISBYREF( 4 ) ? ( LPARAM ) ( LPSTR ) cText : - ( HB_ISCHAR( 4 ) ? ( LPARAM )( LPSTR ) hb_parcx( 4 ) : - ( LPARAM ) hb_parnl( 4 ) ) ) ) ) - ); + ( HB_ISCHAR( 4 ) ? ( LPARAM ) ( LPSTR ) hb_parcx( 4 ) : + ( LPARAM ) hb_parnl( 4 ) ) ) ) ) + ); - if ( HB_ISBYREF( 4 ) ) + if( HB_ISBYREF( 4 ) ) { hb_storclen( cText, hb_parcsiz( 4 ), 4 ); hb_xfree( cText ); @@ -118,12 +118,12 @@ HB_FUNC( WIN_SENDMESSAGE ) HB_FUNC( WIN_SENDDLGITEMMESSAGE ) { - char *cText; + char * cText; PHB_ITEM pText = hb_param( 5, HB_IT_STRING ); if( pText ) { - cText = ( char* ) hb_xgrab( hb_itemGetCLen( pText ) + 1 ); + cText = ( char * ) hb_xgrab( hb_itemGetCLen( pText ) + 1 ); hb_xmemcpy( cText, hb_itemGetCPtr( pText ), hb_itemGetCLen( pText ) + 1 ); } else @@ -131,23 +131,23 @@ HB_FUNC( WIN_SENDDLGITEMMESSAGE ) cText = NULL; } - hb_retnl( ( LONG ) SendDlgItemMessage( ( HWND ) HB_PARHANDLE( 1 ) , - ( int ) hb_parni( 2 ) , - ( UINT ) hb_parni( 3 ) , + hb_retnl( ( LONG ) SendDlgItemMessage( ( HWND ) HB_PARHANDLE( 1 ), + ( int ) hb_parni( 2 ), + ( UINT ) hb_parni( 3 ), ( HB_ISNIL( 4 ) ? 0 : ( WPARAM ) hb_parnl( 4 ) ), ( cText ? ( LPARAM ) cText : ( LPARAM ) hb_parnl( 5 ) ) - ) - ); + ) + ); - if( pText ) - { - hb_storclen( cText, hb_itemGetCLen( pText ), 5 ) ; - } + if( pText ) + { + hb_storclen( cText, hb_itemGetCLen( pText ), 5 ); + } - if( cText ) - { - hb_xfree( cText ); - } + if( cText ) + { + hb_xfree( cText ); + } } /* @@ -220,7 +220,7 @@ HB_FUNC( WIN_MULDIV ) HB_FUNC( WIN_GETDIALOGBASEUNITS ) { - hb_retnl( ( LONG ) GetDialogBaseUnits() ) ; + hb_retnl( ( LONG ) GetDialogBaseUnits() ); } @@ -237,14 +237,14 @@ HB_FUNC( WIN_SETDLGITEMTEXT ) HB_FUNC( WIN_GETDLGITEMTEXT ) { - USHORT iLen = (USHORT) SendMessage( (HWND)GetDlgItem( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ) ) , (UINT)WM_GETTEXTLENGTH, (WPARAM)0, (LPARAM)0 ) + 1 ; - char *cText = ( char* ) hb_xgrab( iLen +1 ); + USHORT iLen = ( USHORT ) SendMessage( ( HWND ) GetDlgItem( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ) ), ( UINT ) WM_GETTEXTLENGTH, ( WPARAM ) 0, ( LPARAM ) 0 ) + 1; + char * cText = ( char * ) hb_xgrab( iLen + 1 ); GetDlgItemText( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ), ( LPTSTR ) cText, iLen - ); + ); hb_retc( cText ); hb_xfree( cText ); @@ -262,17 +262,17 @@ HB_FUNC( WIN_CHECKDLGBUTTON ) HB_FUNC( WIN_ISDLGBUTTONCHECKED ) { - hb_retni( IsDlgButtonChecked( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ) ) ) ; + hb_retni( IsDlgButtonChecked( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ) ) ); } HB_FUNC( WIN_CHECKRADIOBUTTON ) { - hb_retl( CheckRadioButton( ( HWND ) HB_PARHANDLE( 1 ), - hb_parni( 2 ), - hb_parni( 3 ), - hb_parni( 4 ) + hb_retl( CheckRadioButton( ( HWND ) HB_PARHANDLE( 1 ), + hb_parni( 2 ), + hb_parni( 3 ), + hb_parni( 4 ) ) ); } @@ -287,7 +287,7 @@ HB_FUNC( WIN_GETDLGITEM ) HB_FUNC( WIN_MESSAGEBOX ) { - hb_retni( MessageBox( ( HWND ) HB_PARHANDLE( 1 ), hb_parcx( 2 ), hb_parcx( 3 ), HB_ISNIL( 4 ) ? MB_OK : hb_parni( 4 ) ) ) ; + hb_retni( MessageBox( ( HWND ) HB_PARHANDLE( 1 ), hb_parcx( 2 ), hb_parcx( 3 ), HB_ISNIL( 4 ) ? MB_OK : hb_parni( 4 ) ) ); } @@ -306,7 +306,7 @@ HB_FUNC( WIN_LOADICON ) { HICON hIcon; - if ( HB_ISNUM( 1 ) ) + if( HB_ISNUM( 1 ) ) { hIcon = LoadIcon( hb_getWvwData()->hInstance, MAKEINTRESOURCE( hb_parni( 1 ) ) ); } @@ -315,7 +315,7 @@ HB_FUNC( WIN_LOADICON ) hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, hb_parc( 1 ), IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); } - hb_retnl( ( ULONG ) hIcon ) ; + hb_retnl( ( ULONG ) hIcon ); } /* @@ -328,39 +328,33 @@ HB_FUNC( WIN_LOADICON ) HB_FUNC( WIN_LOADIMAGE ) { - HBITMAP hImage = NULL; - int iSource = hb_parni( 2 ); + HBITMAP hImage = NULL; + int iSource = hb_parni( 2 ); - switch ( iSource ) + switch( iSource ) { case 0: - { hImage = LoadBitmap( hb_getWvwData()->hInstance, MAKEINTRESOURCE( hb_parni( 1 ) ) ); - } - break; + break; case 1: - { hImage = LoadBitmap( hb_getWvwData()->hInstance, hb_parc( 1 ) ); - } - break; + break; case 2: - { hImage = ( HBITMAP ) LoadImage( ( HINSTANCE ) NULL, hb_parc( 1 ), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); - } - break; + break; } - hb_retnl( ( ULONG ) hImage ) ; + hb_retnl( ( ULONG ) hImage ); } HB_FUNC( WIN_GETCLIENTRECT ) { - RECT rc = { 0 }; - PHB_ITEM info = hb_itemArrayNew(4); + RECT rc = { 0 }; + PHB_ITEM info = hb_itemArrayNew( 4 ); GetClientRect( ( HWND ) HB_PARHANDLE( 1 ), &rc ); @@ -378,18 +372,18 @@ HB_FUNC( WIN_GETCLIENTRECT ) */ /* sorry, not supported in GTWVW -HB_FUNC( WIN_DRAWIMAGE ) -{ + HB_FUNC( WIN_DRAWIMAGE ) + { hb_retl( hb_wvt_DrawImage( ( HDC ) hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parc( 6 ) ) ); -} -*/ + } + */ HB_FUNC( WIN_GETDC ) { - HB_RETHANDLE( GetDC( ( HWND ) HB_PARHANDLE( 1 ) ) ); + HB_RETHANDLE( GetDC( ( HWND ) HB_PARHANDLE( 1 ) ) ); } @@ -412,9 +406,9 @@ HB_FUNC( WIN_CREATEBRUSH ) { LOGBRUSH lb = { 0 }; - lb.lbStyle = hb_parni( 1 ); - lb.lbColor = HB_ISNIL( 2 ) ? RGB( 0,0,0 ) : ( COLORREF ) hb_parnl( 2 ) ; - lb.lbHatch = HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ); + lb.lbStyle = hb_parni( 1 ); + lb.lbColor = HB_ISNIL( 2 ) ? RGB( 0, 0, 0 ) : ( COLORREF ) hb_parnl( 2 ); + lb.lbHatch = HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ); hb_retnl( ( ULONG ) CreateBrushIndirect( &lb ) ); } @@ -428,10 +422,10 @@ HB_FUNC( WIN_DRAWTEXT ) { RECT rc = { 0 }; - rc.left = hb_parvni( 3,1 ); - rc.top = hb_parvni( 3,2 ); - rc.right = hb_parvni( 3,3 ); - rc.bottom = hb_parvni( 3,4 ); + rc.left = hb_parvni( 3, 1 ); + rc.top = hb_parvni( 3, 2 ); + rc.right = hb_parvni( 3, 3 ); + rc.bottom = hb_parvni( 3, 4 ); hb_retl( DrawText( ( HDC ) HB_PARHANDLE( 1 ), hb_parc( 2 ), strlen( hb_parc( 2 ) ), &rc, hb_parni( 4 ) ) ); } @@ -445,31 +439,31 @@ HB_FUNC( WIN_DRAWTEXT ) HB_FUNC( WVW_GBCREATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int iOffTop, iOffLeft, iOffBottom, iOffRight; + UINT usWinNum = WVW_WHICH_WINDOW; + int iOffTop, iOffLeft, iOffBottom, iOffRight; // int iStyle; - UINT uiPBid; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - LPCTSTR lpszCaption = HB_ISCHAR(6) ? hb_parcx(6) : NULL; - char * szBitmap = HB_ISCHAR(7) ? (char*) hb_parcx(7) : NULL; - UINT uiBitmap = HB_ISNUM(7) ? (UINT) hb_parni(7) : 0; - double dStretch = !HB_ISNIL(10) ? hb_parnd(10) : 1; - BOOL bMap3Dcolors = HB_ISLOG(11) ? (BOOL) hb_parl(11) : FALSE; + UINT uiPBid; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + LPCTSTR lpszCaption = HB_ISCHAR( 6 ) ? hb_parcx( 6 ) : NULL; + char * szBitmap = HB_ISCHAR( 7 ) ? ( char * ) hb_parcx( 7 ) : NULL; + UINT uiBitmap = HB_ISNUM( 7 ) ? ( UINT ) hb_parni( 7 ) : 0; + double dStretch = ! HB_ISNIL( 10 ) ? hb_parnd( 10 ) : 1; + BOOL bMap3Dcolors = HB_ISLOG( 11 ) ? ( BOOL ) hb_parl( 11 ) : FALSE; - iOffTop = !HB_ISNIL( 9 ) ? hb_parvni( 9,1 ) : -1 ; - iOffLeft = !HB_ISNIL( 9 ) ? hb_parvni( 9,2 ) : -1 ; - iOffBottom = !HB_ISNIL( 9 ) ? hb_parvni( 9,3 ) : +1 ; - iOffRight = !HB_ISNIL( 9 ) ? hb_parvni( 9,4 ) : +1; + iOffTop = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 1 ) : -1; + iOffLeft = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 2 ) : -1; + iOffBottom = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 3 ) : +1; + iOffRight = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 4 ) : +1; - uiPBid = ButtonCreate( usWinNum, usTop, usLeft, usBottom, usRight, lpszCaption, - szBitmap, uiBitmap, hb_param( 8, HB_IT_BLOCK ), - iOffTop, iOffLeft, iOffBottom, iOffRight, - dStretch, bMap3Dcolors, - BS_TEXT | BS_GROUPBOX | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE ); - hb_retnl( (LONG) uiPBid ); + uiPBid = ButtonCreate( usWinNum, usTop, usLeft, usBottom, usRight, lpszCaption, + szBitmap, uiBitmap, hb_param( 8, HB_IT_BLOCK ), + iOffTop, iOffLeft, iOffBottom, iOffRight, + dStretch, bMap3Dcolors, + BS_TEXT | BS_GROUPBOX | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE ); + hb_retnl( ( LONG ) uiPBid ); } // BS_TEXT | BS_GROUPBOX | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE @@ -477,153 +471,153 @@ HB_FUNC( WVW_GBCREATE ) HB_FUNC( WVW_RBCREATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int iOffTop, iOffLeft, iOffBottom, iOffRight; + UINT usWinNum = WVW_WHICH_WINDOW; + int iOffTop, iOffLeft, iOffBottom, iOffRight; // int iStyle; - UINT uiPBid; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - LPCTSTR lpszCaption = HB_ISCHAR(6) ? hb_parcx(6) : NULL; - char * szBitmap = HB_ISCHAR(7) ? (char*) hb_parcx(7) : NULL; - UINT uiBitmap = HB_ISNUM(7) ? (UINT) hb_parni(7) : 0; - double dStretch = !HB_ISNIL(10) ? hb_parnd(10) : 1; - BOOL bMap3Dcolors = HB_ISLOG(11) ? (BOOL) hb_parl(11) : FALSE; + UINT uiPBid; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + LPCTSTR lpszCaption = HB_ISCHAR( 6 ) ? hb_parcx( 6 ) : NULL; + char * szBitmap = HB_ISCHAR( 7 ) ? ( char * ) hb_parcx( 7 ) : NULL; + UINT uiBitmap = HB_ISNUM( 7 ) ? ( UINT ) hb_parni( 7 ) : 0; + double dStretch = ! HB_ISNIL( 10 ) ? hb_parnd( 10 ) : 1; + BOOL bMap3Dcolors = HB_ISLOG( 11 ) ? ( BOOL ) hb_parl( 11 ) : FALSE; - if (!HB_ISBLOCK(8)) + if( ! HB_ISBLOCK( 8 ) ) { - hb_retnl(0); - return; + hb_retnl( 0 ); + return; } - iOffTop = !HB_ISNIL( 9 ) ? hb_parvni( 9,1 ) : -2 ; - iOffLeft = !HB_ISNIL( 9 ) ? hb_parvni( 9,2 ) : -2 ; - iOffBottom = !HB_ISNIL( 9 ) ? hb_parvni( 9,3 ) : +2 ; - iOffRight = !HB_ISNIL( 9 ) ? hb_parvni( 9,4 ) : +2; + iOffTop = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 1 ) : -2; + iOffLeft = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 2 ) : -2; + iOffBottom = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 3 ) : +2; + iOffRight = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 4 ) : +2; - uiPBid = ButtonCreate( usWinNum, usTop, usLeft, usBottom, usRight, lpszCaption, - szBitmap, uiBitmap, hb_param( 8, HB_IT_BLOCK ), - iOffTop, iOffLeft, iOffBottom, iOffRight, - dStretch, bMap3Dcolors, - BS_AUTORADIOBUTTON /*| WS_GROUP*/ ); - hb_retnl( (LONG) uiPBid ); + uiPBid = ButtonCreate( usWinNum, usTop, usLeft, usBottom, usRight, lpszCaption, + szBitmap, uiBitmap, hb_param( 8, HB_IT_BLOCK ), + iOffTop, iOffLeft, iOffBottom, iOffRight, + dStretch, bMap3Dcolors, + BS_AUTORADIOBUTTON /*| WS_GROUP*/ ); + hb_retnl( ( LONG ) uiPBid ); } HB_FUNC( WVW_SETCONTROLTEXT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - byte bStyle; - HWND hWndPB = FindControlHandle(usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + byte bStyle; + HWND hWndPB = FindControlHandle( usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle ); - if (uiCtrlId==0 || hWndPB==NULL) - { - return; - } - SetWindowText( hWndPB, hb_parcx(3) ); - hb_retl( TRUE ); + if( uiCtrlId == 0 || hWndPB == NULL ) + { + return; + } + SetWindowText( hWndPB, hb_parcx( 3 ) ); + hb_retl( TRUE ); } HB_FUNC( WVW_PBVISIBLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - BOOL bEnable = HB_ISNIL(3) ? TRUE : hb_parl(3); - byte bStyle; - HWND hWndPB = FindControlHandle(usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle); - int iCmdShow; + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + BOOL bEnable = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + byte bStyle; + HWND hWndPB = FindControlHandle( usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle ); + int iCmdShow; - if (uiCtrlId==0 || hWndPB==NULL) - { - hb_retl( FALSE ); - return; - } + if( uiCtrlId == 0 || hWndPB == NULL ) + { + hb_retl( FALSE ); + return; + } - if ( bEnable ) - { - iCmdShow = SW_SHOW; - } - else - { - iCmdShow = SW_HIDE; - } - hb_retl( ShowWindow(hWndPB, iCmdShow)==0 ); + if( bEnable ) + { + iCmdShow = SW_SHOW; + } + else + { + iCmdShow = SW_HIDE; + } + hb_retl( ShowWindow( hWndPB, iCmdShow ) == 0 ); } HB_FUNC( WVW_CBVISIBLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - BOOL bEnable = HB_ISNIL(3) ? TRUE : hb_parl(3); - byte bStyle; - HWND hWndCB = FindControlHandle(usWinNum, WVW_CONTROL_COMBOBOX, uiCtrlId, &bStyle); - int iCmdShow; + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + BOOL bEnable = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + byte bStyle; + HWND hWndCB = FindControlHandle( usWinNum, WVW_CONTROL_COMBOBOX, uiCtrlId, &bStyle ); + int iCmdShow; - if (hWndCB) - { - if ( bEnable ) - { - iCmdShow = SW_SHOW; - } - else - { - iCmdShow = SW_HIDE; - } - hb_retl( ShowWindow(hWndCB, iCmdShow)==0 ); - } - else - { - hb_retl(FALSE); - } + if( hWndCB ) + { + if( bEnable ) + { + iCmdShow = SW_SHOW; + } + else + { + iCmdShow = SW_HIDE; + } + hb_retl( ShowWindow( hWndCB, iCmdShow ) == 0 ); + } + else + { + hb_retl( FALSE ); + } } HB_FUNC( WVW_CXVISIBLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - BOOL bEnable = HB_ISNIL(3) ? TRUE : hb_parl(3); - byte bStyle; - HWND hWndPB = FindControlHandle(usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle); - int iCmdShow; + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + BOOL bEnable = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + byte bStyle; + HWND hWndPB = FindControlHandle( usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle ); + int iCmdShow; - if (uiCtrlId==0 || hWndPB==NULL) - { - hb_retl( FALSE ); - return; - } + if( uiCtrlId == 0 || hWndPB == NULL ) + { + hb_retl( FALSE ); + return; + } - if ( bEnable ) - { - iCmdShow = SW_SHOW; - } - else - { - iCmdShow = SW_HIDE; - } - hb_retl( ShowWindow(hWndPB, iCmdShow)==0 ); + if( bEnable ) + { + iCmdShow = SW_SHOW; + } + else + { + iCmdShow = SW_HIDE; + } + hb_retl( ShowWindow( hWndPB, iCmdShow ) == 0 ); } /*WVW_XBVisible( [nWinNum], nXBid, lShow ) - *show/hide scrollbar nXBid in window nWinNum (default to topmost window) - *nWinNum better be NIL - *nXBid is the handle of the scrolbar - *lShow: .T. shows the scrolbar (default) + *show/hide scrollbar nXBid in window nWinNum (default to topmost window) + *nWinNum better be NIL + *nXBid is the handle of the scrolbar + *lShow: .T. shows the scrolbar (default) * .F. hides the scrolbar - *returns .t. if successful + **returns .t. if successful */ HB_FUNC( WVW_XBVISIBLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiXBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - BOOL bShow = (BOOL) ( HB_ISLOG( 3 ) ? hb_parl( 3 ) : TRUE ); - byte bStyle; - HWND hWndXB = uiXBid == 0 ? NULL : FindControlHandle(usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle ); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiXBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + BOOL bShow = ( BOOL ) ( HB_ISLOG( 3 ) ? hb_parl( 3 ) : TRUE ); + byte bStyle; + HWND hWndXB = uiXBid == 0 ? NULL : FindControlHandle( usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle ); - if (uiXBid==0 || hWndXB==NULL) + if( uiXBid == 0 || hWndXB == NULL ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } hb_retl( ShowScrollBar( hWndXB, SB_CTL, bShow ) ); @@ -634,123 +628,126 @@ HB_FUNC( WVW_XBVISIBLE ) HB_FUNC( WVW_MOUSE_COL ) { - WVW_DATA * pData = hb_getWvwData( ) ; - if ( hb_gt_wvw_GetMainCoordMode() ) - { - hb_retni( hb_gt_wvwGetMouseX( pData->s_pWindows[ pData->s_usNumWindows-1 ] ) + hb_gt_wvwColOfs( pData->s_usNumWindows-1 ) ); - } - else - { - hb_retni( hb_gt_wvwGetMouseX( pData->s_pWindows[ pData->s_usCurWindow ] ) ); - } + WVW_DATA * pData = hb_getWvwData(); + + if( hb_gt_wvw_GetMainCoordMode() ) + { + hb_retni( hb_gt_wvwGetMouseX( pData->s_pWindows[ pData->s_usNumWindows - 1 ] ) + hb_gt_wvwColOfs( pData->s_usNumWindows - 1 ) ); + } + else + { + hb_retni( hb_gt_wvwGetMouseX( pData->s_pWindows[ pData->s_usCurWindow ] ) ); + } } HB_FUNC( WVW_MOUSE_ROW ) { - WVW_DATA * pData = hb_getWvwData( ) ; - if ( hb_gt_wvw_GetMainCoordMode() ) - { - hb_retni( hb_gt_wvwGetMouseY( pData->s_pWindows[ pData->s_usNumWindows-1 ] ) + hb_gt_wvwRowOfs( pData->s_usNumWindows-1 )); - } - else - { - hb_retni( hb_gt_wvwGetMouseY( pData->s_pWindows[ pData->s_usCurWindow ] ) ); - } + WVW_DATA * pData = hb_getWvwData(); + + if( hb_gt_wvw_GetMainCoordMode() ) + { + hb_retni( hb_gt_wvwGetMouseY( pData->s_pWindows[ pData->s_usNumWindows - 1 ] ) + hb_gt_wvwRowOfs( pData->s_usNumWindows - 1 ) ); + } + else + { + hb_retni( hb_gt_wvwGetMouseY( pData->s_pWindows[ pData->s_usCurWindow ] ) ); + } } HB_FUNC( SENDMESSAGE ) { - hb_retnl( (LONG) SendMessage( - (HWND) HB_PARHANDLE(1), // handle of destination window - (UINT) hb_parni( 2 ), // message to send - (WPARAM) hb_parnl( 3 ), // first message parameter - (HB_ISCHAR(4))? (LPARAM) hb_parc( 4 ) : - (LPARAM) hb_parnl( 4 ) // second message parameter - ) ); + hb_retnl( ( LONG ) SendMessage( + ( HWND ) HB_PARHANDLE( 1 ), // handle of destination window + ( UINT ) hb_parni( 2 ), // message to send + ( WPARAM ) hb_parnl( 3 ), // first message parameter + ( HB_ISCHAR( 4 ) ) ? ( LPARAM ) hb_parc( 4 ) : + ( LPARAM ) hb_parnl( 4 ) // second message parameter + ) ); } HB_FUNC( SETPARENT ) { - UINT usWinNum = WVW_WHICH_WINDOW; // filho - UINT usWinNum1 = ( HB_ISNIL( 2 ) ? ( hb_gt_wvw_GetMainCoordMode() ? ((hb_gt_wvw_GetNumWindows())-1) : hb_gt_wvw_GetCurWindow() ) : ((USHORT) hb_parni( 2 )) ); //pai - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WIN_DATA * pWindowData1 = hb_gt_wvw_GetWindowsData( usWinNum1 ); - HWND hWndParent = pWindowData->hWnd; - HWND hWndParent1 = pWindowData1->hWnd; + UINT usWinNum = WVW_WHICH_WINDOW; // filho + UINT usWinNum1 = ( HB_ISNIL( 2 ) ? ( hb_gt_wvw_GetMainCoordMode() ? ( ( hb_gt_wvw_GetNumWindows() ) - 1 ) : hb_gt_wvw_GetCurWindow() ) : ( ( USHORT ) hb_parni( 2 ) ) ); //pai + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WIN_DATA * pWindowData1 = hb_gt_wvw_GetWindowsData( usWinNum1 ); + HWND hWndParent = pWindowData->hWnd; + HWND hWndParent1 = pWindowData1->hWnd; - if ( usWinNum1 != 0) - SetParent(hWndParent,hWndParent1); + if( usWinNum1 != 0 ) + SetParent( hWndParent, hWndParent1 ); } HB_FUNC( BRINGTOTOP1 ) { - HWND hWnd = (HWND) HB_PARHANDLE( 1 ) ; + HWND hWnd = ( HWND ) HB_PARHANDLE( 1 ); + // DWORD ForegroundThreadID; //DWORD ThisThreadID; //DWORD timeout; - if (IsIconic(hWnd) ) + if( IsIconic( hWnd ) ) { - ShowWindow(hWnd,SW_RESTORE); - hb_retl(TRUE); + ShowWindow( hWnd, SW_RESTORE ); + hb_retl( TRUE ); return; } - BringWindowToTop(hWnd); // IE 5.5 related hack - SetForegroundWindow(hWnd); + BringWindowToTop( hWnd ); // IE 5.5 related hack + SetForegroundWindow( hWnd ); } HB_FUNC( ISWINDOW ) { - hb_retl(IsWindow((HWND) HB_PARHANDLE( 1 ) ) ) ; + hb_retl( IsWindow( ( HWND ) HB_PARHANDLE( 1 ) ) ); } HB_FUNC( ADDTOOLTIPEX ) // changed by MAG { // HWND hWnd = (HWND) hb_parnl( 1 ); - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WVW_DATA * pData = hb_getWvwData( ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * pData = hb_getWvwData(); - int iStyle = TTS_ALWAYSTIP; - INITCOMMONCONTROLSEX icex = { 0 }; - TOOLINFO ti = { 0 }; + int iStyle = TTS_ALWAYSTIP; + INITCOMMONCONTROLSEX icex = { 0 }; + TOOLINFO ti = { 0 }; /* Load the tooltip class from the DLL. */ icex.dwSize = sizeof( icex ); icex.dwICC = ICC_BAR_CLASSES; - if( !InitCommonControlsEx( &icex ) ) + if( ! InitCommonControlsEx( &icex ) ) { } // if ( lToolTipBalloon ) // { - iStyle = iStyle | TTS_BALLOON; + iStyle = iStyle | TTS_BALLOON; // } - if( !pData->hWndTT ) - pData->hWndTT = CreateWindow( TOOLTIPS_CLASS, (LPSTR) NULL, iStyle, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, (HMENU) NULL, GetModuleHandle( NULL ), NULL ); - if( !pData->hWndTT ) + if( ! pData->hWndTT ) + pData->hWndTT = CreateWindow( TOOLTIPS_CLASS, ( LPSTR ) NULL, iStyle, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + NULL, ( HMENU ) NULL, GetModuleHandle( NULL ), NULL ); + if( ! pData->hWndTT ) { hb_retnl( 0 ); return; } - ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; - ti.hwnd = pWindowData->hWnd; - ti.uId = (UINT) hb_parnl( 2 ); + ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; + ti.hwnd = pWindowData->hWnd; + ti.uId = ( UINT ) hb_parnl( 2 ); // ti.uId = (UINT) GetDlgItem( hWnd, hb_parni( 2 ) ); - ti.hinst = GetModuleHandle( NULL ); - ti.lpszText = (LPSTR) hb_parc( 3 ); + ti.hinst = GetModuleHandle( NULL ); + ti.lpszText = ( LPSTR ) hb_parc( 3 ); - hb_retl( SendMessage( pData->hWndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti) ); + hb_retl( SendMessage( pData->hWndTT, TTM_ADDTOOL, 0, ( LPARAM ) ( LPTOOLINFO ) &ti ) ); } @@ -759,23 +756,23 @@ HB_FUNC( ADDTOOLTIPEX ) // changed by MAG /* * CreateImagelist( array, cx, cy, nGrow, flags ) -*/ + */ HB_FUNC( CREATEIMAGELIST ) { - PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY ); - UINT flags = ( HB_ISNIL(5) ) ? ILC_COLOR : hb_parni(5); - HIMAGELIST himl; - ULONG ul, ulLen = hb_arrayLen( pArray ); - HBITMAP hbmp; + PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY ); + UINT flags = ( HB_ISNIL( 5 ) ) ? ILC_COLOR : hb_parni( 5 ); + HIMAGELIST himl; + ULONG ul, ulLen = hb_arrayLen( pArray ); + HBITMAP hbmp; - himl = ImageList_Create( hb_parni(2), hb_parni(3), flags, - ulLen, hb_parni(4) ); + himl = ImageList_Create( hb_parni( 2 ), hb_parni( 3 ), flags, + ulLen, hb_parni( 4 ) ); - for( ul=1; ul<=ulLen; ul++ ) + for( ul = 1; ul <= ulLen; ul++ ) { - hbmp = (HBITMAP)hb_arrayGetNL( pArray, ul ); - ImageList_Add( himl, hbmp, (HBITMAP) NULL ); - DeleteObject(hbmp); + hbmp = ( HBITMAP ) hb_arrayGetNL( pArray, ul ); + ImageList_Add( himl, hbmp, ( HBITMAP ) NULL ); + DeleteObject( hbmp ); } HB_RETHANDLE( himl ); @@ -783,21 +780,21 @@ HB_FUNC( CREATEIMAGELIST ) HB_FUNC( IMAGELIST_ADD ) { - hb_retnl( ImageList_Add( (HIMAGELIST)HB_PARHANDLE(1), (HBITMAP)HB_PARHANDLE(2), (HBITMAP) NULL ) ); + hb_retnl( ImageList_Add( ( HIMAGELIST ) HB_PARHANDLE( 1 ), ( HBITMAP ) HB_PARHANDLE( 2 ), ( HBITMAP ) NULL ) ); } HB_FUNC( IMAGELIST_ADDMASKED ) { - hb_retnl( ImageList_AddMasked( (HIMAGELIST)HB_PARHANDLE(1), (HBITMAP)HB_PARHANDLE(2), (COLORREF) hb_parnl(3) ) ); + hb_retnl( ImageList_AddMasked( ( HIMAGELIST ) HB_PARHANDLE( 1 ), ( HBITMAP ) HB_PARHANDLE( 2 ), ( COLORREF ) hb_parnl( 3 ) ) ); } HB_FUNC( GETBITMAPSIZE ) { - BITMAP bitmap; + BITMAP bitmap; PHB_ITEM aMetr = hb_itemArrayNew( 3 ); - GetObject( (HBITMAP) HB_PARHANDLE( 1 ), sizeof( BITMAP ), ( LPVOID ) &bitmap ); + GetObject( ( HBITMAP ) HB_PARHANDLE( 1 ), sizeof( BITMAP ), ( LPVOID ) &bitmap ); hb_arraySetNL( aMetr, 1, bitmap.bmWidth ); hb_arraySetNL( aMetr, 2, bitmap.bmHeight ); @@ -811,7 +808,7 @@ HB_FUNC( GETICONSIZE ) ICONINFO iinfo; PHB_ITEM aMetr = hb_itemArrayNew( 2 ); - GetIconInfo( (HICON) HB_PARHANDLE( 1 ), &iinfo ); + GetIconInfo( ( HICON ) HB_PARHANDLE( 1 ), &iinfo ); hb_arraySetNL( aMetr, 1, iinfo.xHotspot * 2 ); hb_arraySetNL( aMetr, 2, iinfo.yHotspot * 2 ); @@ -822,139 +819,140 @@ HB_FUNC( GETICONSIZE ) HB_FUNC( LOADIMAGE ) { - if ( HB_ISNUM( 2 ) ) - hb_retnl( (LONG) - LoadImage( hb_getWvwData()->hInstance, //HB_ISNIL( 1 ) ? GetModuleHandle(NULL) : (HINSTANCE) hb_parnl( 1 ), // handle of the instance that contains the image - (LPCTSTR)MAKEINTRESOURCE(hb_parnl(2)), // name or identifier of image - (UINT) hb_parni(3), // type of image - hb_parni(4), // desired width - hb_parni(5), // desired height - (UINT)hb_parni(6) // load flags - ) ); + if( HB_ISNUM( 2 ) ) + hb_retnl( ( LONG ) + LoadImage( hb_getWvwData()->hInstance, //HB_ISNIL( 1 ) ? GetModuleHandle(NULL) : (HINSTANCE) hb_parnl( 1 ), // handle of the instance that contains the image + ( LPCTSTR ) MAKEINTRESOURCE( hb_parnl( 2 ) ), // name or identifier of image + ( UINT ) hb_parni( 3 ), // type of image + hb_parni( 4 ), // desired width + hb_parni( 5 ), // desired height + ( UINT ) hb_parni( 6 ) // load flags + ) ); else HB_RETHANDLE( - LoadImage( (HINSTANCE)hb_parnl(1), // handle of the instance that contains the image - (LPCTSTR)hb_parc(2), // name or identifier of image - (UINT) hb_parni(3), // type of image - hb_parni(4), // desired width - hb_parni(5), // desired height - (UINT)hb_parni(6) // load flags - ) ); + LoadImage( ( HINSTANCE ) hb_parnl( 1 ), // handle of the instance that contains the image + ( LPCTSTR ) hb_parc( 2 ), // name or identifier of image + ( UINT ) hb_parni( 3 ), // type of image + hb_parni( 4 ), // desired width + hb_parni( 5 ), // desired height + ( UINT ) hb_parni( 6 ) // load flags + ) ); } HB_FUNC( LOADBITMAP ) { - if( HB_ISNUM(1) ) + if( HB_ISNUM( 1 ) ) { - if( !HB_ISNIL(2) && hb_parl(2) ) + if( ! HB_ISNIL( 2 ) && hb_parl( 2 ) ) // hb_retnl( (LONG) LoadBitmap( GetModuleHandle( NULL ), MAKEINTRESOURCE(hb_parnl( 1 ) )) ); - HB_RETHANDLE( LoadBitmap( NULL, (LPCTSTR) hb_parnl( 1 ) ) ); + HB_RETHANDLE( LoadBitmap( NULL, ( LPCTSTR ) hb_parnl( 1 ) ) ); else - HB_RETHANDLE( LoadBitmap( GetModuleHandle( NULL ), (LPCTSTR) hb_parnl( 1 ) ) ); + HB_RETHANDLE( LoadBitmap( GetModuleHandle( NULL ), ( LPCTSTR ) hb_parnl( 1 ) ) ); } else - HB_RETHANDLE( LoadBitmap( GetModuleHandle( NULL ), (LPCTSTR) hb_parc( 1 ) ) ); + HB_RETHANDLE( LoadBitmap( GetModuleHandle( NULL ), ( LPCTSTR ) hb_parc( 1 ) ) ); } HB_FUNC( LOADBITMAPEX ) { - HINSTANCE h = HB_ISNUM(1) ? (HINSTANCE) hb_parnl( 1 ) :GetModuleHandle( NULL ) ; - if( HB_ISNUM(1) && HB_ISNUM(2) ) + HINSTANCE h = HB_ISNUM( 1 ) ? ( HINSTANCE ) hb_parnl( 1 ) : GetModuleHandle( NULL ); + + if( HB_ISNUM( 1 ) && HB_ISNUM( 2 ) ) { - if( !HB_ISNIL(3) && hb_parl(3) ) + if( ! HB_ISNIL( 3 ) && hb_parl( 3 ) ) // hb_retnl( (LONG) LoadBitmap( h, MAKEINTRESOURCE(hb_parnl( 2 ) )) ); - HB_RETHANDLE( LoadBitmap( h, (LPCTSTR) hb_parnl( 3 ) ) ); + HB_RETHANDLE( LoadBitmap( h, ( LPCTSTR ) hb_parnl( 3 ) ) ); else - HB_RETHANDLE( LoadBitmap( (HINSTANCE) h, (LPCTSTR) hb_parnl( 2 ) ) ); + HB_RETHANDLE( LoadBitmap( ( HINSTANCE ) h, ( LPCTSTR ) hb_parnl( 2 ) ) ); } else - HB_RETHANDLE( LoadBitmap( h, (LPCTSTR) hb_parc( 2 ) ) ); + HB_RETHANDLE( LoadBitmap( h, ( LPCTSTR ) hb_parc( 2 ) ) ); } HB_FUNC( OPENIMAGE ) { - const char* cFileName = hb_parc(1); - BOOL lString = (HB_ISNIL(2))? 0 : hb_parl(2); - int iFileSize; - FILE* fp; + const char * cFileName = hb_parc( 1 ); + BOOL lString = ( HB_ISNIL( 2 ) ) ? 0 : hb_parl( 2 ); + int iFileSize; + FILE * fp; // IPicture * pPic; - LPPICTURE pPic; - IStream * pStream; - HGLOBAL hG; - HBITMAP hBitmap = 0; + LPPICTURE pPic; + IStream * pStream; + HGLOBAL hG; + HBITMAP hBitmap = 0; if( lString ) { - iFileSize = hb_parclen( 1 ); - hG = GlobalAlloc( GPTR,iFileSize ); - if( !hG ) + iFileSize = hb_parclen( 1 ); + hG = GlobalAlloc( GPTR, iFileSize ); + if( ! hG ) { - hb_retnl(0); + hb_retnl( 0 ); return; } - memcpy( (void*)hG, (void*)cFileName,iFileSize ); + memcpy( ( void * ) hG, ( void * ) cFileName, iFileSize ); } else { - fp = fopen( cFileName,"rb" ); - if( !fp ) + fp = fopen( cFileName, "rb" ); + if( ! fp ) { - hb_retnl(0); + hb_retnl( 0 ); return; } - fseek( fp,0,SEEK_END ); - iFileSize = ftell( fp ); - hG = GlobalAlloc( GPTR,iFileSize ); - if( !hG ) + fseek( fp, 0, SEEK_END ); + iFileSize = ftell( fp ); + hG = GlobalAlloc( GPTR, iFileSize ); + if( ! hG ) { fclose( fp ); - hb_retnl(0); + hb_retnl( 0 ); return; } - fseek( fp,0,SEEK_SET ); - fread( (void*)hG, 1, iFileSize, fp ); + fseek( fp, 0, SEEK_SET ); + fread( ( void * ) hG, 1, iFileSize, fp ); fclose( fp ); } - CreateStreamOnHGlobal( hG,0,&pStream ); + CreateStreamOnHGlobal( hG, 0, &pStream ); - if( !pStream ) + if( ! pStream ) { GlobalFree( hG ); - hb_retnl(0); + hb_retnl( 0 ); return; } //#if defined(__cplusplus) - //OleLoadPicture( pStream,0,0,&IID_IPicture,(void**)&pPic ); - //pStream->Release(); +//OleLoadPicture( pStream,0,0,&IID_IPicture,(void**)&pPic ); +//pStream->Release(); //#else - OleLoadPicture( pStream,0,0,&IID_IPicture,(void**)&pPic ); + OleLoadPicture( pStream, 0, 0, &IID_IPicture, ( void ** ) &pPic ); pStream->lpVtbl->Release( pStream ); //#endif GlobalFree( hG ); - if( !pPic ) + if( ! pPic ) { - hb_retnl(0); + hb_retnl( 0 ); return; } //#if defined(__cplusplus) - //pPic->get_Handle( (OLE_HANDLE*)&hBitmap ); +//pPic->get_Handle( (OLE_HANDLE*)&hBitmap ); //#else - pPic->lpVtbl->get_Handle( pPic, (OLE_HANDLE*)&hBitmap ); + pPic->lpVtbl->get_Handle( pPic, ( OLE_HANDLE * ) &hBitmap ); //#endif - hb_retnl( (LONG) CopyImage( hBitmap,IMAGE_BITMAP,0,0,LR_COPYRETURNORG ) ); + hb_retnl( ( LONG ) CopyImage( hBitmap, IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG ) ); //#if defined(__cplusplus) - //pPic->Release(); +//pPic->Release(); //#else pPic->lpVtbl->Release( pPic ); //#endif @@ -962,97 +960,97 @@ HB_FUNC( OPENIMAGE ) HB_FUNC( OPENBITMAP ) { - BITMAPFILEHEADER bmfh; - BITMAPINFOHEADER bmih; - LPBITMAPINFO lpbmi; - DWORD dwRead; - LPVOID lpvBits; - HGLOBAL hmem1, hmem2; - HBITMAP hbm; - HDC hDC = (hb_pcount()>1 && !HB_ISNIL(2))? (HDC)HB_PARHANDLE(2):NULL; - HANDLE hfbm = CreateFile( hb_parc( 1 ), GENERIC_READ, FILE_SHARE_READ, - (LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_READONLY, (HANDLE) NULL ); + BITMAPFILEHEADER bmfh; + BITMAPINFOHEADER bmih; + LPBITMAPINFO lpbmi; + DWORD dwRead; + LPVOID lpvBits; + HGLOBAL hmem1, hmem2; + HBITMAP hbm; + HDC hDC = ( hb_pcount() > 1 && ! HB_ISNIL( 2 ) ) ? ( HDC ) HB_PARHANDLE( 2 ) : NULL; + HANDLE hfbm = CreateFile( hb_parc( 1 ), GENERIC_READ, FILE_SHARE_READ, + ( LPSECURITY_ATTRIBUTES ) NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_READONLY, ( HANDLE ) NULL ); - if( ( (long int)hfbm ) <= 0 ) + if( ( ( long int ) hfbm ) <= 0 ) { - HB_RETHANDLE(NULL); + HB_RETHANDLE( NULL ); return; } /* Retrieve the BITMAPFILEHEADER structure. */ - ReadFile( hfbm, &bmfh, sizeof(BITMAPFILEHEADER), &dwRead, NULL ); + ReadFile( hfbm, &bmfh, sizeof( BITMAPFILEHEADER ), &dwRead, NULL ); /* Retrieve the BITMAPFILEHEADER structure. */ - ReadFile( hfbm, &bmih, sizeof(BITMAPINFOHEADER), &dwRead, NULL ); + ReadFile( hfbm, &bmih, sizeof( BITMAPINFOHEADER ), &dwRead, NULL ); /* Allocate memory for the BITMAPINFO structure. */ - hmem1 = GlobalAlloc( GHND, sizeof(BITMAPINFOHEADER) + - ((1<bmiHeader.biSize = bmih.biSize; - lpbmi->bmiHeader.biWidth = bmih.biWidth; - lpbmi->bmiHeader.biHeight = bmih.biHeight; - lpbmi->bmiHeader.biPlanes = bmih.biPlanes; + lpbmi->bmiHeader.biSize = bmih.biSize; + lpbmi->bmiHeader.biWidth = bmih.biWidth; + lpbmi->bmiHeader.biHeight = bmih.biHeight; + lpbmi->bmiHeader.biPlanes = bmih.biPlanes; - lpbmi->bmiHeader.biBitCount = bmih.biBitCount; - lpbmi->bmiHeader.biCompression = bmih.biCompression; - lpbmi->bmiHeader.biSizeImage = bmih.biSizeImage; + lpbmi->bmiHeader.biBitCount = bmih.biBitCount; + lpbmi->bmiHeader.biCompression = bmih.biCompression; + lpbmi->bmiHeader.biSizeImage = bmih.biSizeImage; lpbmi->bmiHeader.biXPelsPerMeter = bmih.biXPelsPerMeter; lpbmi->bmiHeader.biYPelsPerMeter = bmih.biYPelsPerMeter; - lpbmi->bmiHeader.biClrUsed = bmih.biClrUsed; - lpbmi->bmiHeader.biClrImportant = bmih.biClrImportant; + lpbmi->bmiHeader.biClrUsed = bmih.biClrUsed; + lpbmi->bmiHeader.biClrImportant = bmih.biClrImportant; /* Retrieve the color table. * 1 << bmih.biBitCount == 2 ^ bmih.biBitCount - */ - switch(bmih.biBitCount) + */ + switch( bmih.biBitCount ) { - case 1 : - case 4 : - case 8 : - ReadFile(hfbm, lpbmi->bmiColors, - ((1<bmiColors, - ( 3 * sizeof(RGBQUAD)), - &dwRead, (LPOVERLAPPED) NULL); + case 1: + case 4: + case 8: + ReadFile( hfbm, lpbmi->bmiColors, + ( ( 1 << bmih.biBitCount ) * sizeof( RGBQUAD ) ), + &dwRead, ( LPOVERLAPPED ) NULL ); break; - case 24 : + case 16: + case 32: + if( bmih.biCompression == BI_BITFIELDS ) + ReadFile( hfbm, lpbmi->bmiColors, + ( 3 * sizeof( RGBQUAD ) ), + &dwRead, ( LPOVERLAPPED ) NULL ); + break; + + case 24: break; } /* Allocate memory for the required number of bytes. */ - hmem2 = GlobalAlloc( GHND, (bmfh.bfSize - bmfh.bfOffBits) ); - lpvBits = GlobalLock(hmem2); + hmem2 = GlobalAlloc( GHND, ( bmfh.bfSize - bmfh.bfOffBits ) ); + lpvBits = GlobalLock( hmem2 ); /* Retrieve the bitmap data. */ - ReadFile(hfbm, lpvBits, (bmfh.bfSize - bmfh.bfOffBits), &dwRead, NULL ); + ReadFile( hfbm, lpvBits, ( bmfh.bfSize - bmfh.bfOffBits ), &dwRead, NULL ); - if( !hDC ) + if( ! hDC ) hDC = GetDC( 0 ); /* Create a bitmap from the data stored in the .BMP file. */ hbm = CreateDIBitmap( hDC, &bmih, CBM_INIT, lpvBits, lpbmi, DIB_RGB_COLORS ); - if( hb_pcount() < 2 || HB_ISNIL(2) ) + if( hb_pcount() < 2 || HB_ISNIL( 2 ) ) ReleaseDC( 0, hDC ); /* Unlock the global memory objects and close the .BMP file. */ - GlobalUnlock(hmem1); - GlobalUnlock(hmem2); - GlobalFree(hmem1); - GlobalFree(hmem2); - CloseHandle(hfbm); + GlobalUnlock( hmem1 ); + GlobalUnlock( hmem2 ); + GlobalFree( hmem1 ); + GlobalFree( hmem2 ); + CloseHandle( hfbm ); HB_RETHANDLE( hbm ); } @@ -1061,81 +1059,83 @@ HB_FUNC( OPENBITMAP ) HB_FUNC( SETTEXTCOLOR ) { COLORREF crColor = SetTextColor( - (HDC) HB_PARHANDLE( 1 ), // handle of device context - (COLORREF) hb_parnl( 2 ) // text color - ); - hb_retnl( (LONG) crColor ); + ( HDC ) HB_PARHANDLE( 1 ), // handle of device context + ( COLORREF ) hb_parnl( 2 ) // text color + ); + + hb_retnl( ( LONG ) crColor ); } HB_FUNC( SETBKCOLOR ) { COLORREF crColor = SetBkColor( - (HDC) HB_PARHANDLE( 1 ), // handle of device context - (COLORREF) hb_parnl( 2 ) // text color - ); - hb_retnl( (LONG) crColor ); + ( HDC ) HB_PARHANDLE( 1 ), // handle of device context + ( COLORREF ) hb_parnl( 2 ) // text color + ); + + hb_retnl( ( LONG ) crColor ); } HB_FUNC( CREATESOLIDBRUSH ) { HB_RETHANDLE( CreateSolidBrush( - (COLORREF) hb_parnl( 1 ) // brush color - ) ); + ( COLORREF ) hb_parnl( 1 ) // brush color + ) ); } HB_FUNC( CREATEHATCHBRUSH ) { HB_RETHANDLE( CreateHatchBrush( - hb_parni(1), (COLORREF) hb_parnl(2) ) ); + hb_parni( 1 ), ( COLORREF ) hb_parnl( 2 ) ) ); } HB_FUNC( RGB ) { - hb_retnl( RGB( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) ) ; + hb_retnl( RGB( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) ); } HB_FUNC( GETSYSCOLOR ) { - hb_retnl( (LONG) GetSysColor( hb_parni( 1 ) ) ); + hb_retnl( ( LONG ) GetSysColor( hb_parni( 1 ) ) ); } HB_FUNC( REDRAWWINDOW ) { RedrawWindow( - (HWND) HB_PARHANDLE( 1 ), // handle of window - NULL, // address of structure with update rectangle - NULL, // handle of update region - (UINT)hb_parni( 2 ) // array of redraw flags - ); + ( HWND ) HB_PARHANDLE( 1 ), // handle of window + NULL, // address of structure with update rectangle + NULL, // handle of update region + ( UINT ) hb_parni( 2 ) // array of redraw flags + ); } /* CreateFont( fontName, nWidth, hHeight [,fnWeight] [,fdwCharSet], [,fdwItalic] [,fdwUnderline] [,fdwStrikeOut] ) -*/ + */ HB_FUNC( CREATEFONT ) { HFONT hFont; - int fnWeight = ( HB_ISNIL(4) )? 0:hb_parni(4); - DWORD fdwCharSet = ( HB_ISNIL(5) )? 0:hb_parnl(5); - DWORD fdwItalic = ( HB_ISNIL(6) )? 0:hb_parnl(6); - DWORD fdwUnderline = ( HB_ISNIL(7) )? 0:hb_parnl(7); - DWORD fdwStrikeOut = ( HB_ISNIL(8) )? 0:hb_parnl(8); + int fnWeight = ( HB_ISNIL( 4 ) ) ? 0 : hb_parni( 4 ); + DWORD fdwCharSet = ( HB_ISNIL( 5 ) ) ? 0 : hb_parnl( 5 ); + DWORD fdwItalic = ( HB_ISNIL( 6 ) ) ? 0 : hb_parnl( 6 ); + DWORD fdwUnderline = ( HB_ISNIL( 7 ) ) ? 0 : hb_parnl( 7 ); + DWORD fdwStrikeOut = ( HB_ISNIL( 8 ) ) ? 0 : hb_parnl( 8 ); hFont = CreateFont( - hb_parni( 3 ), // logical height of font - hb_parni( 2 ), // logical average character width - 0, // angle of escapement - 0, // base-line orientation angle - fnWeight, // font weight - fdwItalic, // italic attribute flag - fdwUnderline, // underline attribute flag - fdwStrikeOut, // strikeout attribute flag - fdwCharSet, // character set identifier - 0, // output precision - 0, // clipping precision - 0, // output quality - 0, // pitch and family - (LPCTSTR) hb_parc( 1 ) // pointer to typeface name string - ); + hb_parni( 3 ), // logical height of font + hb_parni( 2 ), // logical average character width + 0, // angle of escapement + 0, // base-line orientation angle + fnWeight, // font weight + fdwItalic, // italic attribute flag + fdwUnderline, // underline attribute flag + fdwStrikeOut, // strikeout attribute flag + fdwCharSet, // character set identifier + 0, // output precision + 0, // clipping precision + 0, // output quality + 0, // pitch and family + ( LPCTSTR ) hb_parc( 1 ) // pointer to typeface name string + ); HB_RETHANDLE( hFont ); } @@ -1143,33 +1143,33 @@ HB_FUNC( CREATEFONT ) HB_FUNC( SELECTFONT ) { - CHOOSEFONT cf; - LOGFONT lf; - HFONT hfont; - PHB_ITEM pObj = ( HB_ISNIL(1) )? NULL:hb_param( 1, HB_IT_OBJECT ); + CHOOSEFONT cf; + LOGFONT lf; + HFONT hfont; + PHB_ITEM pObj = ( HB_ISNIL( 1 ) ) ? NULL : hb_param( 1, HB_IT_OBJECT ); //PHB_ITEM temp1; - PHB_ITEM aMetr = hb_itemArrayNew( 9 ); + PHB_ITEM aMetr = hb_itemArrayNew( 9 ); - cf.lStructSize = sizeof(CHOOSEFONT); - cf.hwndOwner = (HWND)NULL; - cf.hDC = (HDC)NULL; - cf.lpLogFont = &lf; - cf.iPointSize = 0; - cf.Flags = CF_SCREENFONTS | ( (pObj)? CF_INITTOLOGFONTSTRUCT:0 ); - cf.rgbColors = RGB(0,0,0); - cf.lCustData = 0L; - cf.lpfnHook = (LPCFHOOKPROC)NULL; - cf.lpTemplateName = (LPSTR)NULL; + cf.lStructSize = sizeof( CHOOSEFONT ); + cf.hwndOwner = ( HWND ) NULL; + cf.hDC = ( HDC ) NULL; + cf.lpLogFont = &lf; + cf.iPointSize = 0; + cf.Flags = CF_SCREENFONTS | ( ( pObj ) ? CF_INITTOLOGFONTSTRUCT : 0 ); + cf.rgbColors = RGB( 0, 0, 0 ); + cf.lCustData = 0L; + cf.lpfnHook = ( LPCFHOOKPROC ) NULL; + cf.lpTemplateName = ( LPSTR ) NULL; - cf.hInstance = (HINSTANCE) NULL; - cf.lpszStyle = (LPSTR)NULL; - cf.nFontType = SCREEN_FONTTYPE; - cf.nSizeMin = 0; - cf.nSizeMax = 0; + cf.hInstance = ( HINSTANCE ) NULL; + cf.lpszStyle = ( LPSTR ) NULL; + cf.nFontType = SCREEN_FONTTYPE; + cf.nSizeMin = 0; + cf.nSizeMax = 0; /* Display the CHOOSEFONT common-dialog box. */ - if( !ChooseFont(&cf) ) + if( ! ChooseFont( &cf ) ) { hb_itemRelease( aMetr ); hb_ret(); @@ -1180,7 +1180,7 @@ HB_FUNC( SELECTFONT ) /* selection and return a handle identifying */ /* that font. */ - hfont = CreateFontIndirect(cf.lpLogFont); + hfont = CreateFontIndirect( cf.lpLogFont ); hb_arraySetNInt( aMetr, 1, ( HB_PTRDIFF ) hfont ); hb_arraySetC( aMetr, 2, lf.lfFaceName ); @@ -1202,182 +1202,182 @@ HB_FUNC( INVALIDATERECT ) if( hb_pcount() > 2 ) { - rc.left = hb_parni( 3 ); - rc.top = hb_parni( 4 ); - rc.right = hb_parni( 5 ); - rc.bottom = hb_parni( 6 ); + rc.left = hb_parni( 3 ); + rc.top = hb_parni( 4 ); + rc.right = hb_parni( 5 ); + rc.bottom = hb_parni( 6 ); } InvalidateRect( - (HWND) HB_PARHANDLE( 1 ), // handle of window with changed update region - ( hb_pcount() > 2 )? &rc:NULL, // address of rectangle coordinates - hb_parni( 2 ) // erase-background flag - ); + ( HWND ) HB_PARHANDLE( 1 ), // handle of window with changed update region + ( hb_pcount() > 2 ) ? &rc : NULL, // address of rectangle coordinates + hb_parni( 2 ) // erase-background flag + ); } -HB_FUNC(TOOLBARADDBUTTONS) +HB_FUNC( TOOLBARADDBUTTONS ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndCtrl = ( HWND ) HB_PARHANDLE( 2 ) ; + HWND hWndCtrl = ( HWND ) HB_PARHANDLE( 2 ); /* HWND hToolTip = ( HWND ) hb_parnl( 5 ) ; */ - PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); - int iButtons= hb_parni( 4 ); - TBBUTTON *tb = ( struct _TBBUTTON * ) hb_xgrab( iButtons * sizeof( TBBUTTON ) ); - PHB_ITEM pTemp; + PHB_ITEM pArray = hb_param( 3, HB_IT_ARRAY ); + int iButtons = hb_parni( 4 ); + TBBUTTON * tb = ( struct _TBBUTTON * ) hb_xgrab( iButtons * sizeof( TBBUTTON ) ); + PHB_ITEM pTemp; //BOOL bSystem; - ULONG ulCount; - ULONG ulID; - DWORD style = GetWindowLong( hWndCtrl, GWL_STYLE ); - USHORT usOldHeight; + ULONG ulCount; + ULONG ulID; + DWORD style = GetWindowLong( hWndCtrl, GWL_STYLE ); + USHORT usOldHeight; - SetWindowLong(hWndCtrl,GWL_STYLE,style|TBSTYLE_TOOLTIPS |TBSTYLE_FLAT); + SetWindowLong( hWndCtrl, GWL_STYLE, style | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT ); - SendMessage( hWndCtrl, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0L); + SendMessage( hWndCtrl, TB_BUTTONSTRUCTSIZE, sizeof( TBBUTTON ), 0L ); usOldHeight = pWindowData->usTBHeight; - for ( ulCount =0 ; ( ulCount < hb_arrayLen( pArray ) ); ulCount++ ) + for( ulCount = 0; ( ulCount < hb_arrayLen( pArray ) ); ulCount++ ) { - pTemp = hb_arrayGetItemPtr( pArray , ulCount + 1 ); - ulID=hb_arrayGetNI( pTemp, 1 ); + pTemp = hb_arrayGetItemPtr( pArray, ulCount + 1 ); + ulID = hb_arrayGetNI( pTemp, 1 ); //bSystem = hb_arrayGetL( pTemp, 9 ); // if (bSystem) // if (ulID > 0 && ulID < 31 ) - // { - tb[ ulCount ].iBitmap = ulID > 0 ? ( int ) ulID : -1; +// { + tb[ ulCount ].iBitmap = ulID > 0 ? ( int ) ulID : -1; // } // else // { // tb[ ulCount ].iBitmap = ulID > 0 ? ( int ) ulCount : -1; // } tb[ ulCount ].idCommand = hb_arrayGetNI( pTemp, 2 ); - tb[ ulCount ].fsState = ( BYTE )hb_arrayGetNI( pTemp, 3 ); - tb[ ulCount ].fsStyle = ( BYTE )hb_arrayGetNI( pTemp, 4 ); + tb[ ulCount ].fsState = ( BYTE ) hb_arrayGetNI( pTemp, 3 ); + tb[ ulCount ].fsStyle = ( BYTE ) hb_arrayGetNI( pTemp, 4 ); tb[ ulCount ].dwData = hb_arrayGetNI( pTemp, 5 ); - tb[ ulCount ].iString = hb_arrayGetCLen( pTemp, 6 ) >0 ? ( int ) hb_arrayGetCPtr( pTemp, 6 ) : 0 ; + tb[ ulCount ].iString = hb_arrayGetCLen( pTemp, 6 ) > 0 ? ( int ) hb_arrayGetCPtr( pTemp, 6 ) : 0; } - SendMessage( hWndCtrl, TB_ADDBUTTONS, (WPARAM) iButtons, (LPARAM) (LPTBBUTTON) tb); + SendMessage( hWndCtrl, TB_ADDBUTTONS, ( WPARAM ) iButtons, ( LPARAM ) ( LPTBBUTTON ) tb ); SendMessage( hWndCtrl, TB_AUTOSIZE, 0, 0 ); hb_gt_wvwTBinitSize( pWindowData, hWndCtrl ); - if (pWindowData->usTBHeight != usOldHeight) + if( pWindowData->usTBHeight != usOldHeight ) { - hb_gt_wvwResetWindow( usWinNum ); + hb_gt_wvwResetWindow( usWinNum ); } hb_xfree( tb ); } -HB_FUNC(SETBITMAPRESOURCEID) +HB_FUNC( SETBITMAPRESOURCEID ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); TBADDBITMAP tbab; - HBITMAP hBitmap = (HBITMAP) HB_PARHANDLE( 3 ) ; - UINT uiBitmap = (UINT) hb_parni( 4 ); - HWND hWndToolbar = pWindowData->hToolBar; - int iNewBitmap; - int iBitmapType = hb_parni( 2 ); - int iOffset; + HBITMAP hBitmap = ( HBITMAP ) HB_PARHANDLE( 3 ); + UINT uiBitmap = ( UINT ) hb_parni( 4 ); + HWND hWndToolbar = pWindowData->hToolBar; + int iNewBitmap; + int iBitmapType = hb_parni( 2 ); + int iOffset; - switch (iBitmapType) + switch( iBitmapType ) { case 0: - iOffset = 0; - break; + iOffset = 0; + break; case 1: - iOffset = pWindowData->iStartStdBitmap; - break; + iOffset = pWindowData->iStartStdBitmap; + break; case 2: - iOffset = pWindowData->iStartViewBitmap; - break; + iOffset = pWindowData->iStartViewBitmap; + break; case 3: - iOffset = pWindowData->iStartHistBitmap; - break; + iOffset = pWindowData->iStartHistBitmap; + break; default: - iOffset = 0; - break; + iOffset = 0; + break; } - if (iBitmapType==0) + if( iBitmapType == 0 ) { - tbab.hInst = NULL; - tbab.nID = (UINT) hBitmap; - iNewBitmap = SendMessage(hWndToolbar, TB_ADDBITMAP, (WPARAM) 1, (WPARAM) &tbab); + tbab.hInst = NULL; + tbab.nID = ( UINT ) hBitmap; + iNewBitmap = SendMessage( hWndToolbar, TB_ADDBITMAP, ( WPARAM ) 1, ( WPARAM ) &tbab ); } else /* system bitmap */ { - iNewBitmap = (int) uiBitmap + iOffset; + iNewBitmap = ( int ) uiBitmap + iOffset; } - hb_retni( iNewBitmap ) ; + hb_retni( iNewBitmap ); } HB_FUNC( DRAWICON ) { - DrawIcon( (HDC)HB_PARHANDLE( 1 ), hb_parni( 3 ), hb_parni( 4 ), (HICON)HB_PARHANDLE( 2 ) ); + DrawIcon( ( HDC ) HB_PARHANDLE( 1 ), hb_parni( 3 ), hb_parni( 4 ), ( HICON ) HB_PARHANDLE( 2 ) ); } HB_FUNC( LOADICON ) { - if( HB_ISNUM(1) ) - HB_RETHANDLE( LoadIcon( NULL, (LPCTSTR) hb_parnl( 1 ) ) ); + if( HB_ISNUM( 1 ) ) + HB_RETHANDLE( LoadIcon( NULL, ( LPCTSTR ) hb_parnl( 1 ) ) ); else - HB_RETHANDLE( LoadIcon( GetModuleHandle( NULL ), (LPCTSTR) hb_parc( 1 ) ) ); + HB_RETHANDLE( LoadIcon( GetModuleHandle( NULL ), ( LPCTSTR ) hb_parc( 1 ) ) ); } HB_FUNC( DRAWBITMAP ) { - HDC hDC = (HDC) HB_PARHANDLE( 1 ); - HDC hDCmem = CreateCompatibleDC( hDC ); - DWORD dwraster = (HB_ISNIL(3))? SRCCOPY:hb_parnl(3); - HBITMAP hBitmap = (HBITMAP) HB_PARHANDLE( 2 ); - BITMAP bitmap; - int nWidthDest = ( hb_pcount()>=5 && !HB_ISNIL(6) )? hb_parni(6):0; - int nHeightDest = ( hb_pcount()>=6 && !HB_ISNIL(7) )? hb_parni(7):0; + HDC hDC = ( HDC ) HB_PARHANDLE( 1 ); + HDC hDCmem = CreateCompatibleDC( hDC ); + DWORD dwraster = ( HB_ISNIL( 3 ) ) ? SRCCOPY : hb_parnl( 3 ); + HBITMAP hBitmap = ( HBITMAP ) HB_PARHANDLE( 2 ); + BITMAP bitmap; + int nWidthDest = ( hb_pcount() >= 5 && ! HB_ISNIL( 6 ) ) ? hb_parni( 6 ) : 0; + int nHeightDest = ( hb_pcount() >= 6 && ! HB_ISNIL( 7 ) ) ? hb_parni( 7 ) : 0; SelectObject( hDCmem, hBitmap ); GetObject( hBitmap, sizeof( BITMAP ), ( LPVOID ) &bitmap ); - if( nWidthDest && ( nWidthDest != bitmap.bmWidth || nHeightDest != bitmap.bmHeight )) + if( nWidthDest && ( nWidthDest != bitmap.bmWidth || nHeightDest != bitmap.bmHeight ) ) { - StretchBlt( hDC, hb_parni(4), hb_parni(5), nWidthDest, nHeightDest, hDCmem, + StretchBlt( hDC, hb_parni( 4 ), hb_parni( 5 ), nWidthDest, nHeightDest, hDCmem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, dwraster ); } else { - BitBlt( hDC, hb_parni(4), hb_parni(5), bitmap.bmWidth, bitmap.bmHeight, hDCmem, 0, 0, dwraster ); + BitBlt( hDC, hb_parni( 4 ), hb_parni( 5 ), bitmap.bmWidth, bitmap.bmHeight, hDCmem, 0, 0, dwraster ); } DeleteDC( hDCmem ); } HB_FUNC( WINDOW2BITMAP ) { - HWND hWnd = (HWND) HB_PARHANDLE( 1 ); - BOOL lFull = ( HB_ISNIL(2) )? 0 : (BOOL)hb_parl(2); - HDC hDC = ( lFull )? GetWindowDC( hWnd ) : GetDC( hWnd ); - HDC hDCmem = CreateCompatibleDC( hDC ); - HBITMAP hBitmap; - RECT rc; + HWND hWnd = ( HWND ) HB_PARHANDLE( 1 ); + BOOL lFull = ( HB_ISNIL( 2 ) ) ? 0 : ( BOOL ) hb_parl( 2 ); + HDC hDC = ( lFull ) ? GetWindowDC( hWnd ) : GetDC( hWnd ); + HDC hDCmem = CreateCompatibleDC( hDC ); + HBITMAP hBitmap; + RECT rc; if( lFull ) GetWindowRect( hWnd, &rc ); else GetClientRect( hWnd, &rc ); - hBitmap = CreateCompatibleBitmap( hDC, rc.right-rc.left, rc.bottom-rc.top ); + hBitmap = CreateCompatibleBitmap( hDC, rc.right - rc.left, rc.bottom - rc.top ); SelectObject( hDCmem, hBitmap ); - BitBlt( hDCmem, 0, 0, rc.right-rc.left, rc.bottom-rc.top, hDC, 0, 0, SRCCOPY ); + BitBlt( hDCmem, 0, 0, rc.right - rc.left, rc.bottom - rc.top, hDC, 0, 0, SRCCOPY ); DeleteDC( hDCmem ); DeleteDC( hDC ); @@ -1408,12 +1408,12 @@ HB_FUNC( WINDOW2BITMAP ) */ HB_FUNC( WVW_SETMAXBMCACHE ) { - WVW_DATA * p = hb_getWvwData(); - UINT uiOldMaxBMcache = p->s_sApp->uiMaxBMcache; + WVW_DATA * p = hb_getWvwData(); + UINT uiOldMaxBMcache = p->s_sApp->uiMaxBMcache; - if ( ! HB_ISNIL( 1 ) ) + if( ! HB_ISNIL( 1 ) ) { - p->s_sApp->uiMaxBMcache = (UINT) hb_parni( 1 ); + p->s_sApp->uiMaxBMcache = ( UINT ) hb_parni( 1 ); } hb_retni( uiOldMaxBMcache ); @@ -1424,7 +1424,8 @@ HB_FUNC( WVW_SETMAXBMCACHE ) */ HB_FUNC( WVW_NUMBMCACHE ) { - WVW_DATA * p = hb_getWvwData(); + WVW_DATA * p = hb_getWvwData(); + hb_retni( p->s_sApp->uiBMcache ); } @@ -1450,49 +1451,49 @@ HB_FUNC( WVW_NUMBMCACHE ) /*WVW_SetTimer([nWinNum], nInterval) - *set timer event for every nInterval millisec - *(effective only if WVW_TIMER() function exists) - *eg. it can be usefull to update clock on status bar - *returns .t. if successfull + *set timer event for every nInterval millisec + *(effective only if WVW_TIMER() function exists) + *eg. it can be usefull to update clock on status bar + *returns .t. if successfull */ /*20040602: WARNING: WVT is slightly different*/ -HB_FUNC (WVW_SETTIMER) +HB_FUNC( WVW_SETTIMER ) { - WVW_DATA * p = hb_getWvwData(); - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * p = hb_getWvwData(); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if ( p->s_sApp->pSymWVW_TIMER ) + if( p->s_sApp->pSymWVW_TIMER ) { - SetTimer( pWindowData->hWnd, WVW_ID_BASE_TIMER+usWinNum, (UINT) hb_parni(2), NULL ); + SetTimer( pWindowData->hWnd, WVW_ID_BASE_TIMER + usWinNum, ( UINT ) hb_parni( 2 ), NULL ); - hb_retl( TRUE ); + hb_retl( TRUE ); } else { - hb_retl( FALSE ); + hb_retl( FALSE ); } } /*WVW_KillTimer([nWinNum]) - *kill the timer event handler for window nWinNum - *returns .t. if successfull + *kill the timer event handler for window nWinNum + *returns .t. if successfull */ /*20040602: WARNING: WVT is slightly different */ -HB_FUNC (WVW_KILLTIMER) +HB_FUNC( WVW_KILLTIMER ) { - WVW_DATA * p = hb_getWvwData(); - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * p = hb_getWvwData(); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if ( p->s_sApp->pSymWVW_TIMER ) + if( p->s_sApp->pSymWVW_TIMER ) { - KillTimer( pWindowData->hWnd, WVW_ID_BASE_TIMER+usWinNum ); - hb_retl( TRUE ); + KillTimer( pWindowData->hWnd, WVW_ID_BASE_TIMER + usWinNum ); + hb_retl( TRUE ); } else { - hb_retl( FALSE ); + hb_retl( FALSE ); } } @@ -1508,11 +1509,11 @@ HB_FUNC (WVW_KILLTIMER) /*(in WVT these is reflected in {0,0,0,0}) */ HB_FUNC( WVW_GETPAINTRECT ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - RECT rPaintRect = pWindowData->rPaintPending; - PHB_ITEM info = hb_itemArrayNew(4); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + RECT rPaintRect = pWindowData->rPaintPending; + PHB_ITEM info = hb_itemArrayNew( 4 ); hb_arraySetNI( info, 1, rPaintRect.top ); hb_arraySetNI( info, 2, rPaintRect.left ); @@ -1526,80 +1527,80 @@ HB_FUNC( WVW_GETPAINTRECT ) HB_FUNC( WVW_SETPOINTER ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iCursor = hb_parni( 2 ); - HCURSOR hCursor; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iCursor = hb_parni( 2 ); + HCURSOR hCursor; - switch ( iCursor ) + switch( iCursor ) { - case 1: - hCursor = LoadCursor( NULL, IDC_ARROW ); - break; + case 1: + hCursor = LoadCursor( NULL, IDC_ARROW ); + break; - case 2: - hCursor = LoadCursor( NULL, IDC_IBEAM ); - break; + case 2: + hCursor = LoadCursor( NULL, IDC_IBEAM ); + break; - case 3: - hCursor = LoadCursor( NULL, IDC_WAIT ); - break; + case 3: + hCursor = LoadCursor( NULL, IDC_WAIT ); + break; - case 4: - hCursor = LoadCursor( NULL, IDC_CROSS ); - break; + case 4: + hCursor = LoadCursor( NULL, IDC_CROSS ); + break; - case 5: - hCursor = LoadCursor( NULL, IDC_UPARROW ); - break; + case 5: + hCursor = LoadCursor( NULL, IDC_UPARROW ); + break; - case 6: - hCursor = LoadCursor( NULL, IDC_SIZE ); - break; + case 6: + hCursor = LoadCursor( NULL, IDC_SIZE ); + break; - case 7: - hCursor = LoadCursor( NULL, IDC_ICON ); - break; + case 7: + hCursor = LoadCursor( NULL, IDC_ICON ); + break; - case 8: - hCursor = LoadCursor( NULL, IDC_SIZENWSE ); - break; + case 8: + hCursor = LoadCursor( NULL, IDC_SIZENWSE ); + break; - case 9: - hCursor = LoadCursor( NULL, IDC_SIZENESW ); - break; + case 9: + hCursor = LoadCursor( NULL, IDC_SIZENESW ); + break; - case 10: - hCursor = LoadCursor( NULL, IDC_SIZEWE ); - break; + case 10: + hCursor = LoadCursor( NULL, IDC_SIZEWE ); + break; - case 11: - hCursor = LoadCursor( NULL, IDC_SIZENS ); - break; + case 11: + hCursor = LoadCursor( NULL, IDC_SIZENS ); + break; - case 12: - hCursor = LoadCursor( NULL, IDC_SIZEALL ); - break; + case 12: + hCursor = LoadCursor( NULL, IDC_SIZEALL ); + break; - case 13: - hCursor = LoadCursor( NULL, IDC_NO ); - break; + case 13: + hCursor = LoadCursor( NULL, IDC_NO ); + break; - case 14: - hCursor = LoadCursor( NULL, IDC_HAND ); - break; + case 14: + hCursor = LoadCursor( NULL, IDC_HAND ); + break; - case 15: - hCursor = LoadCursor( NULL, IDC_APPSTARTING ); - break; + case 15: + hCursor = LoadCursor( NULL, IDC_APPSTARTING ); + break; - case 16: - hCursor = LoadCursor( NULL, IDC_HELP ); - break; + case 16: + hCursor = LoadCursor( NULL, IDC_HELP ); + break; - default: - hCursor = LoadCursor( NULL, IDC_ARROW ); - break; + default: + hCursor = LoadCursor( NULL, IDC_ARROW ); + break; } SetClassLongPtr( pWindowData->hWnd, GCLP_HCURSOR, ( LONG_PTR ) hCursor ); @@ -1613,20 +1614,20 @@ HB_FUNC( WVW_SETPOINTER ) /* */ HB_FUNC( WVW_LOADPICTURE ) { - WVW_DATA * p = hb_getWvwData(); - IPicture * iPicture = hb_gt_wvwLoadPicture( hb_parcx( 2 ) ); - BOOL bResult = FALSE; - int iSlot = hb_parni( 1 ) - 1 ; + WVW_DATA * p = hb_getWvwData(); + IPicture * iPicture = hb_gt_wvwLoadPicture( hb_parcx( 2 ) ); + BOOL bResult = FALSE; + int iSlot = hb_parni( 1 ) - 1; - if ( iPicture ) + if( iPicture ) { - if ( p->s_sApp->iPicture[ iSlot ] ) + if( p->s_sApp->iPicture[ iSlot ] ) { hb_gt_wvwDestroyPicture( p->s_sApp->iPicture[ iSlot ] ); } - p->s_sApp->iPicture[ iSlot ] = iPicture; - bResult = TRUE; + p->s_sApp->iPicture[ iSlot ] = iPicture; + bResult = TRUE; } hb_retl( bResult ); } @@ -1638,35 +1639,35 @@ HB_FUNC( WVW_LOADPICTURE ) /* */ HB_FUNC( WVW_LOADFONT ) { - WVW_DATA * p = hb_getWvwData(); - UINT usWinNum = p->s_usNumWindows-1; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - LOGFONT logfont; - int iSlot = hb_parni( 1 ) - 1; - HFONT hFont; + WVW_DATA * p = hb_getWvwData(); + UINT usWinNum = p->s_usNumWindows - 1; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + LOGFONT logfont; + int iSlot = hb_parni( 1 ) - 1; + HFONT hFont; - logfont.lfEscapement = ( HB_ISNIL( 11 ) ? 0 : ( hb_parni( 11 ) * 10 ) ); - logfont.lfOrientation = 0; - logfont.lfWeight = ( HB_ISNIL( 5 ) ? 0 : hb_parni( 5 ) ); - logfont.lfItalic = ( HB_ISNIL( 6 ) ? 0 : ( BYTE )hb_parl( 6 ) ); - logfont.lfUnderline = ( HB_ISNIL( 7 ) ? 0 : ( BYTE )hb_parl( 7 ) ); - logfont.lfStrikeOut = ( HB_ISNIL( 8 ) ? 0 : ( BYTE )hb_parl( 8 ) ); - logfont.lfCharSet = ( HB_ISNIL( 9 ) ? ( BYTE )pWindowData->CodePage : ( BYTE )hb_parni( 9 ) ); - logfont.lfOutPrecision = 0; - logfont.lfClipPrecision = 0; - logfont.lfQuality = ( HB_ISNIL( 10 ) ? ( BYTE )DEFAULT_QUALITY : (BYTE)hb_parni( 10 ) ); - logfont.lfPitchAndFamily = FF_DONTCARE; - logfont.lfHeight = ( HB_ISNIL( 3 ) ? pWindowData->fontHeight : hb_parni( 3 ) ); - logfont.lfWidth = ( HB_ISNIL( 4 ) ? ( pWindowData->fontWidth < 0 ? -pWindowData->fontWidth : pWindowData->fontWidth ) : hb_parni( 4 ) ); + logfont.lfEscapement = ( HB_ISNIL( 11 ) ? 0 : ( hb_parni( 11 ) * 10 ) ); + logfont.lfOrientation = 0; + logfont.lfWeight = ( HB_ISNIL( 5 ) ? 0 : hb_parni( 5 ) ); + logfont.lfItalic = ( HB_ISNIL( 6 ) ? 0 : ( BYTE ) hb_parl( 6 ) ); + logfont.lfUnderline = ( HB_ISNIL( 7 ) ? 0 : ( BYTE ) hb_parl( 7 ) ); + logfont.lfStrikeOut = ( HB_ISNIL( 8 ) ? 0 : ( BYTE ) hb_parl( 8 ) ); + logfont.lfCharSet = ( HB_ISNIL( 9 ) ? ( BYTE ) pWindowData->CodePage : ( BYTE ) hb_parni( 9 ) ); + logfont.lfOutPrecision = 0; + logfont.lfClipPrecision = 0; + logfont.lfQuality = ( HB_ISNIL( 10 ) ? ( BYTE ) DEFAULT_QUALITY : ( BYTE ) hb_parni( 10 ) ); + logfont.lfPitchAndFamily = FF_DONTCARE; + logfont.lfHeight = ( HB_ISNIL( 3 ) ? pWindowData->fontHeight : hb_parni( 3 ) ); + logfont.lfWidth = ( HB_ISNIL( 4 ) ? ( pWindowData->fontWidth < 0 ? -pWindowData->fontWidth : pWindowData->fontWidth ) : hb_parni( 4 ) ); strcpy( logfont.lfFaceName, ( HB_ISNIL( 2 ) ? pWindowData->fontFace : hb_parcx( 2 ) ) ); hFont = CreateFontIndirect( &logfont ); - if ( hFont ) + if( hFont ) { - if ( p->s_sApp->hUserFonts[ iSlot ] ) + if( p->s_sApp->hUserFonts[ iSlot ] ) { - DeleteObject( (HFONT) p->s_sApp->hUserFonts[ iSlot ] ); + DeleteObject( ( HFONT ) p->s_sApp->hUserFonts[ iSlot ] ); } p->s_sApp->hUserFonts[ iSlot ] = hFont; } @@ -1679,22 +1680,22 @@ HB_FUNC( WVW_LOADFONT ) HB_FUNC( WVW_LOADPEN ) { WVW_DATA * p = hb_getWvwData(); - int iPenWidth, iPenStyle; - COLORREF crColor; - HPEN hPen; - int iSlot = hb_parni( 1 ) - 1; + int iPenWidth, iPenStyle; + COLORREF crColor; + HPEN hPen; + int iSlot = hb_parni( 1 ) - 1; - iPenStyle = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); - iPenWidth = HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ); - crColor = HB_ISNIL( 4 ) ? RGB( 0,0,0 ) : ( COLORREF ) hb_parnl( 4 ); + iPenStyle = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + iPenWidth = HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ); + crColor = HB_ISNIL( 4 ) ? RGB( 0, 0, 0 ) : ( COLORREF ) hb_parnl( 4 ); - hPen = CreatePen( iPenStyle, iPenWidth, crColor ); + hPen = CreatePen( iPenStyle, iPenWidth, crColor ); - if ( hPen ) + if( hPen ) { - if ( p->s_sApp->hUserPens[ iSlot ] ) + if( p->s_sApp->hUserPens[ iSlot ] ) { - DeleteObject( (HPEN) p->s_sApp->hUserPens[ iSlot ] ); + DeleteObject( ( HPEN ) p->s_sApp->hUserPens[ iSlot ] ); } p->s_sApp->hUserPens[ iSlot ] = hPen; @@ -1711,8 +1712,9 @@ HB_FUNC( WVW_LOADPEN ) HB_FUNC( WVW_MESSAGEBOX ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + hb_retni( MessageBox( pWindowData->hWnd, hb_parcx( 2 ), hb_parcx( 3 ), HB_ISNIL( 4 ) ? MB_OK : hb_parni( 4 ) ) ); } @@ -1733,76 +1735,76 @@ HB_FUNC( WVW_MESSAGEBOX ) HB_FUNC( WVW_CHOOSEFONT ) { - CHOOSEFONT cf = { 0 }; - LOGFONT lf = { 0 }; - LONG PointSize = 0; - WVW_DATA * p = hb_getWvwData(); + CHOOSEFONT cf = { 0 }; + LOGFONT lf = { 0 }; + LONG PointSize = 0; + WVW_DATA * p = hb_getWvwData(); - if ( ! HB_ISNIL( 2 ) ) + if( ! HB_ISNIL( 2 ) ) { - PointSize = -MulDiv( ( LONG ) hb_parnl( 2 ), GetDeviceCaps( p->s_pWindows[ p->s_usNumWindows-1 ]->hdc, LOGPIXELSY ), 72 ) ; + PointSize = -MulDiv( ( LONG ) hb_parnl( 2 ), GetDeviceCaps( p->s_pWindows[ p->s_usNumWindows - 1 ]->hdc, LOGPIXELSY ), 72 ); } - lf.lfHeight = PointSize; - lf.lfWidth = HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ); - lf.lfWeight = HB_ISNIL( 4 ) ? 0 : hb_parni( 4 ); - lf.lfItalic = HB_ISNIL( 6 ) ? 0 : ( BYTE )hb_parl( 6 ); - lf.lfUnderline = HB_ISNIL( 7 ) ? 0 : ( BYTE )hb_parl( 7 ); - lf.lfStrikeOut = HB_ISNIL( 8 ) ? 0 : ( BYTE )hb_parl( 8 ); - lf.lfCharSet = DEFAULT_CHARSET; - lf.lfQuality = HB_ISNIL( 5 ) ? DEFAULT_QUALITY : ( BYTE )hb_parni( 5 ); - lf.lfPitchAndFamily = FF_DONTCARE; - if ( HB_ISCHAR( 1 ) ) + lf.lfHeight = PointSize; + lf.lfWidth = HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ); + lf.lfWeight = HB_ISNIL( 4 ) ? 0 : hb_parni( 4 ); + lf.lfItalic = HB_ISNIL( 6 ) ? 0 : ( BYTE ) hb_parl( 6 ); + lf.lfUnderline = HB_ISNIL( 7 ) ? 0 : ( BYTE ) hb_parl( 7 ); + lf.lfStrikeOut = HB_ISNIL( 8 ) ? 0 : ( BYTE ) hb_parl( 8 ); + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfQuality = HB_ISNIL( 5 ) ? DEFAULT_QUALITY : ( BYTE ) hb_parni( 5 ); + lf.lfPitchAndFamily = FF_DONTCARE; + if( HB_ISCHAR( 1 ) ) { strcpy( lf.lfFaceName, hb_parcx( 1 ) ); } - cf.lStructSize = sizeof( CHOOSEFONT ); - cf.hwndOwner = p->s_pWindows[ p->s_usNumWindows-1 ]->hWnd; - cf.hDC = ( HDC ) NULL; - cf.lpLogFont = &lf; - cf.iPointSize = 0; - cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_SHOWHELP | CF_INITTOLOGFONTSTRUCT ; - cf.rgbColors = RGB( 0,0,0 ); - cf.lCustData = 0L; - cf.lpfnHook = ( LPCFHOOKPROC ) NULL; - cf.lpTemplateName = ( LPSTR ) NULL; - cf.hInstance = ( HINSTANCE ) NULL; - cf.lpszStyle = ( LPSTR ) NULL; - cf.nFontType = SCREEN_FONTTYPE; - cf.nSizeMin = 0; - cf.nSizeMax = 0; + cf.lStructSize = sizeof( CHOOSEFONT ); + cf.hwndOwner = p->s_pWindows[ p->s_usNumWindows - 1 ]->hWnd; + cf.hDC = ( HDC ) NULL; + cf.lpLogFont = &lf; + cf.iPointSize = 0; + cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_SHOWHELP | CF_INITTOLOGFONTSTRUCT; + cf.rgbColors = RGB( 0, 0, 0 ); + cf.lCustData = 0L; + cf.lpfnHook = ( LPCFHOOKPROC ) NULL; + cf.lpTemplateName = ( LPSTR ) NULL; + cf.hInstance = ( HINSTANCE ) NULL; + cf.lpszStyle = ( LPSTR ) NULL; + cf.nFontType = SCREEN_FONTTYPE; + cf.nSizeMin = 0; + cf.nSizeMax = 0; - if ( ChooseFont( &cf ) ) + if( ChooseFont( &cf ) ) { - PointSize = -MulDiv( lf.lfHeight, 72, GetDeviceCaps( p->s_pWindows[ p->s_usNumWindows-1 ]->hdc, LOGPIXELSY ) ) ; + PointSize = -MulDiv( lf.lfHeight, 72, GetDeviceCaps( p->s_pWindows[ p->s_usNumWindows - 1 ]->hdc, LOGPIXELSY ) ); hb_reta( 8 ); - hb_storvc( lf.lfFaceName , -1, 1 ); + hb_storvc( lf.lfFaceName, -1, 1 ); hb_storvnl( ( LONG ) PointSize, -1, 2 ); - hb_storvni( lf.lfWidth , -1, 3 ); - hb_storvni( lf.lfWeight , -1, 4 ); - hb_storvni( lf.lfQuality , -1, 5 ); - hb_storvl( lf.lfItalic , -1, 6 ); - hb_storvl( lf.lfUnderline , -1, 7 ); - hb_storvl( lf.lfStrikeOut , -1, 8 ); + hb_storvni( lf.lfWidth, -1, 3 ); + hb_storvni( lf.lfWeight, -1, 4 ); + hb_storvni( lf.lfQuality, -1, 5 ); + hb_storvl( lf.lfItalic, -1, 6 ); + hb_storvl( lf.lfUnderline, -1, 7 ); + hb_storvl( lf.lfStrikeOut, -1, 8 ); } else { hb_reta( 8 ); - hb_storvc( "" , -1, 1 ); + hb_storvc( "", -1, 1 ); hb_storvnl( ( LONG ) 0, -1, 2 ); - hb_storvni( 0 , -1, 3 ); - hb_storvni( 0 , -1, 4 ); - hb_storvni( 0 , -1, 5 ); - hb_storvl( 0 , -1, 6 ); - hb_storvl( 0 , -1, 7 ); - hb_storvl( 0 , -1, 8 ); + hb_storvni( 0, -1, 3 ); + hb_storvni( 0, -1, 4 ); + hb_storvni( 0, -1, 5 ); + hb_storvl( 0, -1, 6 ); + hb_storvl( 0, -1, 7 ); + hb_storvl( 0, -1, 8 ); } - return ; + return; } @@ -1813,27 +1815,27 @@ HB_FUNC( WVW_CHOOSEFONT ) HB_FUNC( WVW_CHOOSECOLOR ) { - CHOOSECOLOR cc ; - COLORREF crCustClr[ 16 ] ; - int i ; + CHOOSECOLOR cc; + COLORREF crCustClr[ 16 ]; + int i; WVW_DATA * p = hb_getWvwData(); - for( i = 0 ; i < 16 ; i++ ) + for( i = 0; i < 16; i++ ) { - crCustClr[ i ] = ( HB_ISARRAY( 2 ) ? (COLORREF) hb_parvnl( 2, i+1 ) : GetSysColor( COLOR_BTNFACE ) ) ; + crCustClr[ i ] = ( HB_ISARRAY( 2 ) ? ( COLORREF ) hb_parvnl( 2, i + 1 ) : GetSysColor( COLOR_BTNFACE ) ); } - cc.lStructSize = sizeof( CHOOSECOLOR ) ; - cc.hwndOwner = p->s_pWindows[ p->s_usNumWindows-1 ]->hWnd ; - cc.rgbResult = HB_ISNIL( 1 ) ? 0 : ( COLORREF ) hb_parnl( 1 ) ; - cc.lpCustColors = crCustClr ; + cc.lStructSize = sizeof( CHOOSECOLOR ); + cc.hwndOwner = p->s_pWindows[ p->s_usNumWindows - 1 ]->hWnd; + cc.rgbResult = HB_ISNIL( 1 ) ? 0 : ( COLORREF ) hb_parnl( 1 ); + cc.lpCustColors = crCustClr; - cc.Flags = ( WORD ) ( HB_ISNIL( 3 ) ? CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN : hb_parnl( 3 ) ); + cc.Flags = ( WORD ) ( HB_ISNIL( 3 ) ? CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN : hb_parnl( 3 ) ); - if ( ChooseColor( &cc ) ) + if( ChooseColor( &cc ) ) { - hb_retnl( cc.rgbResult ) ; + hb_retnl( cc.rgbResult ); } else { @@ -1853,20 +1855,20 @@ HB_FUNC( WVW_CHOOSECOLOR ) HB_FUNC( WVW_SETMOUSEPOS ) { - POINT xy = { 0 }; - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - USHORT usRow = ( USHORT )hb_parni( 2 ), - usCol = ( USHORT )hb_parni( 3 ); + POINT xy = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + USHORT usRow = ( USHORT ) hb_parni( 2 ), + usCol = ( USHORT ) hb_parni( 3 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usRow, &usCol, NULL, NULL); + hb_wvw_HBFUNCPrologue( usWinNum, &usRow, &usCol, NULL, NULL ); } xy = hb_gt_wvwGetXYFromColRow( pWindowData, usCol, usRow ); - if ( ClientToScreen( pWindowData->hWnd, &xy ) ) + if( ClientToScreen( pWindowData->hWnd, &xy ) ) { hb_retl( SetCursorPos( xy.x, xy.y + ( pWindowData->PTEXTSIZE.y / 2 ) ) ); } @@ -1894,67 +1896,67 @@ HB_FUNC( WVW_SETMOUSEPOS ) HB_FUNC( WVW_FILLRECTANGLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WVW_DATA * p = hb_getWvwData(); - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - COLORREF crRGBcolor = ( HB_ISNIL( 6 ) ? 0 : hb_parnl( 6 ) ); - BOOL bTight = ( HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ); - BOOL bUseBrush = ( HB_ISNIL( 8 ) ? FALSE : hb_parl( 8 ) ); - LOGBRUSH lb = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WVW_DATA * p = hb_getWvwData(); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + COLORREF crRGBcolor = ( HB_ISNIL( 6 ) ? 0 : hb_parnl( 6 ) ); + BOOL bTight = ( HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ); + BOOL bUseBrush = ( HB_ISNIL( 8 ) ? FALSE : hb_parl( 8 ) ); + LOGBRUSH lb = { 0 }; HBRUSH hBrush; - RECT xyRect = { 0 }; + RECT xyRect = { 0 }; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - iOffTop = !HB_ISNIL( 9 ) ? hb_parvni( 9,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 9 ) ? hb_parvni( 9,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 9 ) ? hb_parvni( 9,3 ) : 0 ; - iOffRight = !HB_ISNIL( 9 ) ? hb_parvni( 9,4 ) : 0; + iOffTop = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 3 ) : 0; + iOffRight = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 4 ) : 0; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = bTight ? xy.y+2 : xy.y; - iLeft = bTight ? xy.x+2 : xy.x; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = bTight ? xy.y + 2 : xy.y; + iLeft = bTight ? xy.x + 2 : xy.x; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y-1; - iRight = xy.x-1; + iBottom = xy.y - 1; + iRight = xy.x - 1; // Aplica OffSet - iTop += iOffTop ; - iLeft += iOffLeft ; - iBottom += iOffBottom; - iRight += iOffRight ; + iTop += iOffTop; + iLeft += iOffLeft; + iBottom += iOffBottom; + iRight += iOffRight; - xyRect.left = iLeft; - xyRect.top = iTop; - xyRect.right= iRight+1; - xyRect.bottom = iBottom+1; + xyRect.left = iLeft; + xyRect.top = iTop; + xyRect.right = iRight + 1; + xyRect.bottom = iBottom + 1; - lb.lbStyle = BS_SOLID; - lb.lbColor = crRGBcolor; - lb.lbHatch = 0; + lb.lbStyle = BS_SOLID; + lb.lbColor = crRGBcolor; + lb.lbHatch = 0; - hBrush = !bUseBrush ? CreateBrushIndirect( &lb ) : (HBRUSH) HB_PARHANDLE(6); + hBrush = ! bUseBrush ? CreateBrushIndirect( &lb ) : ( HBRUSH ) HB_PARHANDLE( 6 ); FillRect( pWindowData->hdc, &xyRect, hBrush ); - if (!bUseBrush) + if( ! bUseBrush ) { - SelectObject( p->s_pWindows[0]->hdc, (HBRUSH) p->s_sApp->OriginalBrush ); - DeleteObject( hBrush ); + SelectObject( p->s_pWindows[ 0 ]->hdc, ( HBRUSH ) p->s_sApp->OriginalBrush ); + DeleteObject( hBrush ); } hb_retl( TRUE ); @@ -1965,7 +1967,7 @@ HB_FUNC( WVW_FILLRECTANGLE ) HB_FUNC( WVW_LBADDSTRING ) { - SendMessage( GetDlgItem( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ) ), LB_ADDSTRING, 0, ( LPARAM )( LPSTR ) hb_parcx( 3 ) ); + SendMessage( GetDlgItem( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ) ), LB_ADDSTRING, 0, ( LPARAM ) ( LPSTR ) hb_parcx( 3 ) ); } HB_FUNC( WVW_LBSETCURSEL ) @@ -1976,7 +1978,7 @@ HB_FUNC( WVW_LBSETCURSEL ) /* WARNING!!! this function is not member of WVW_CB* group of functions */ HB_FUNC( WVW_CBADDSTRING ) { - SendMessage( GetDlgItem( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ) ), CB_ADDSTRING, 0, ( LPARAM )( LPSTR ) hb_parcx( 3 ) ); + SendMessage( GetDlgItem( ( HWND ) HB_PARHANDLE( 1 ), hb_parni( 2 ) ), CB_ADDSTRING, 0, ( LPARAM ) ( LPSTR ) hb_parcx( 3 ) ); } /* WARNING!!! this function is not member of WVW_CB* group of functions */ @@ -1989,7 +1991,7 @@ HB_FUNC( WVW_DLGSETICON ) { HICON hIcon; - if ( HB_ISNUM( 2 ) ) + if( HB_ISNUM( 2 ) ) { hIcon = LoadIcon( hb_getWvwData()->hInstance, MAKEINTRESOURCE( hb_parni( 2 ) ) ); } @@ -1998,13 +2000,13 @@ HB_FUNC( WVW_DLGSETICON ) hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, hb_parc( 2 ), IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); } - if ( hIcon ) + if( hIcon ) { - SendMessage( ( HWND ) HB_PARHANDLE( 1 ), WM_SETICON, ICON_SMALL, ( LPARAM ) hIcon ); /* Set Title Bar ICON */ - SendMessage( ( HWND ) HB_PARHANDLE( 1 ), WM_SETICON, ICON_BIG, ( LPARAM ) hIcon ); /* Set Task List Icon */ + SendMessage( ( HWND ) HB_PARHANDLE( 1 ), WM_SETICON, ICON_SMALL, ( LPARAM ) hIcon ); /* Set Title Bar ICON */ + SendMessage( ( HWND ) HB_PARHANDLE( 1 ), WM_SETICON, ICON_BIG, ( LPARAM ) hIcon ); /* Set Task List Icon */ } - if ( hIcon ) + if( hIcon ) { hb_retnl( ( ULONG ) hIcon ); } @@ -2032,35 +2034,35 @@ HB_FUNC( WVW_DLGSETICON ) HB_FUNC( WVW_SETPEN ) { - int iPenWidth, iPenStyle; - COLORREF crColor; - HPEN hPen; + int iPenWidth, iPenStyle; + COLORREF crColor; + HPEN hPen; WVW_DATA * p = hb_getWvwData(); - if ( HB_ISNIL( 1 ) ) + if( HB_ISNIL( 1 ) ) { hb_retl( FALSE ); } - iPenStyle = hb_parni( 1 ) ; - iPenWidth = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); - crColor = HB_ISNIL( 3 ) ? RGB( 0,0,0 ) : ( COLORREF ) hb_parnl( 3 ); + iPenStyle = hb_parni( 1 ); + iPenWidth = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + crColor = HB_ISNIL( 3 ) ? RGB( 0, 0, 0 ) : ( COLORREF ) hb_parnl( 3 ); - hPen = CreatePen( iPenStyle, iPenWidth, crColor ); + hPen = CreatePen( iPenStyle, iPenWidth, crColor ); - if ( hPen ) + if( hPen ) { /* 20040923, was: - if ( s_pWvwData->s_pWindows[usWinNum]->currentPen ) - { + if ( s_pWvwData->s_pWindows[usWinNum]->currentPen ) + { DeleteObject( (HPEN) s_pWvwData->s_pWindows[usWinNum]->currentPen ); - } - s_pWvwData->s_pWindows[usWinNum]->currentPen = hPen; - */ + } + s_pWvwData->s_pWindows[usWinNum]->currentPen = hPen; + */ - if ( p->s_sApp->currentPen ) + if( p->s_sApp->currentPen ) { - DeleteObject( (HPEN) p->s_sApp->currentPen ); + DeleteObject( ( HPEN ) p->s_sApp->currentPen ); } p->s_sApp->currentPen = hPen; @@ -2085,35 +2087,35 @@ HB_FUNC( WVW_SETPEN ) HB_FUNC( WVW_SETBRUSH ) { - HBRUSH hBrush; - LOGBRUSH lb = { 0 }; - WVW_DATA * p = hb_getWvwData(); + HBRUSH hBrush; + LOGBRUSH lb = { 0 }; + WVW_DATA * p = hb_getWvwData(); - if ( HB_ISNIL( 1 ) ) + if( HB_ISNIL( 1 ) ) { hb_retl( FALSE ); } - lb.lbStyle = hb_parnl( 1 ); - lb.lbColor = HB_ISNIL( 2 ) ? RGB( 0,0,0 ) : ( COLORREF ) hb_parnl( 2 ) ; - lb.lbHatch = HB_ISNIL( 3 ) ? 0 : hb_parnl( 3 ); + lb.lbStyle = hb_parnl( 1 ); + lb.lbColor = HB_ISNIL( 2 ) ? RGB( 0, 0, 0 ) : ( COLORREF ) hb_parnl( 2 ); + lb.lbHatch = HB_ISNIL( 3 ) ? 0 : hb_parnl( 3 ); - hBrush = CreateBrushIndirect( &lb ); + hBrush = CreateBrushIndirect( &lb ); - if ( hBrush ) + if( hBrush ) { /* 20040923,was: - if ( s_pWvwData->s_pWindows[usWinNum]->currentBrush ) - { + if ( s_pWvwData->s_pWindows[usWinNum]->currentBrush ) + { DeleteObject( (HBRUSH) s_pWvwData->s_pWindows[usWinNum]->currentBrush ); - } - s_pWvwData->s_pWindows[usWinNum]->currentBrush = hBrush; - */ + } + s_pWvwData->s_pWindows[usWinNum]->currentBrush = hBrush; + */ - if ( p->s_sApp->currentBrush ) + if( p->s_sApp->currentBrush ) { - SelectObject( p->s_pWindows[0]->hdc, (HBRUSH) p->s_sApp->OriginalBrush ); - DeleteObject( (HBRUSH) p->s_sApp->currentBrush ); + SelectObject( p->s_pWindows[ 0 ]->hdc, ( HBRUSH ) p->s_sApp->OriginalBrush ); + DeleteObject( ( HBRUSH ) p->s_sApp->currentBrush ); } p->s_sApp->currentBrush = hBrush; @@ -2128,120 +2130,123 @@ HB_FUNC( WVW_SETBRUSH ) HB_FUNC( WVW__MAKEDLGTEMPLATE ) { - WORD *p, *pdlgtemplate ; - WORD nItems = (WORD)hb_parvni( 1, 4 ) ; - int i, nchar ; - DWORD lStyle ; + WORD * p, * pdlgtemplate; + WORD nItems = ( WORD ) hb_parvni( 1, 4 ); + int i, nchar; + DWORD lStyle; - pdlgtemplate = p = ( PWORD ) LocalAlloc( LPTR, 65534 ) ; + pdlgtemplate = p = ( PWORD ) LocalAlloc( LPTR, 65534 ); - lStyle = hb_parvnl(1,3) ; + lStyle = hb_parvnl( 1, 3 ); - *p++ = 1 ; - *p++ = 0xFFFF ; - *p++ = LOWORD ( hb_parvnl(1,1) ) ; - *p++ = HIWORD ( hb_parvnl(1,1) ) ; + *p++ = 1; + *p++ = 0xFFFF; + *p++ = LOWORD( hb_parvnl( 1, 1 ) ); + *p++ = HIWORD( hb_parvnl( 1, 1 ) ); - *p++ = LOWORD ( hb_parvnl(1,2) ) ; - *p++ = HIWORD ( hb_parvnl(1,2) ) ; + *p++ = LOWORD( hb_parvnl( 1, 2 ) ); + *p++ = HIWORD( hb_parvnl( 1, 2 ) ); - *p++ = LOWORD (lStyle) ; - *p++ = HIWORD (lStyle) ; + *p++ = LOWORD( lStyle ); + *p++ = HIWORD( lStyle ); - *p++ = (WORD) nItems ; - *p++ = (short) hb_parvni(1,5) ; - *p++ = (short) hb_parvni(1,6) ; - *p++ = (short) hb_parvni(1,7) ; - *p++ = (short) hb_parvni(1,8) ; - *p++ = (short) 0 ; - *p++ = (short) 0x00 ; + *p++ = ( WORD ) nItems; + *p++ = ( short ) hb_parvni( 1, 5 ); + *p++ = ( short ) hb_parvni( 1, 6 ); + *p++ = ( short ) hb_parvni( 1, 7 ); + *p++ = ( short ) hb_parvni( 1, 8 ); + *p++ = ( short ) 0; + *p++ = ( short ) 0x00; - if ( hb_parinfa( 1,11 ) == HB_IT_STRING ) - { - nchar = nCopyAnsiToWideChar( p, TEXT( (char*) hb_parvcx( 1,11 ) ) ) ; - p += nchar ; - } - else - { - *p++ =0 ; - } + if( hb_parinfa( 1, 11 ) == HB_IT_STRING ) + { + nchar = nCopyAnsiToWideChar( p, TEXT( ( char * ) hb_parvcx( 1, 11 ) ) ); + p += nchar; + } + else + { + *p++ = 0; + } - if ( ( lStyle & DS_SETFONT ) ) - { - *p++ = (short) hb_parvni(1,12) ; - *p++ = (short) hb_parvni(1,13) ; - *p++ = (short) hb_parvni(1,14) ; + if( ( lStyle & DS_SETFONT ) ) + { + *p++ = ( short ) hb_parvni( 1, 12 ); + *p++ = ( short ) hb_parvni( 1, 13 ); + *p++ = ( short ) hb_parvni( 1, 14 ); - nchar = nCopyAnsiToWideChar( p, TEXT( (char*) hb_parvcx(1,15) ) ) ; - p += nchar ; - } ; + nchar = nCopyAnsiToWideChar( p, TEXT( ( char * ) hb_parvcx( 1, 15 ) ) ); + p += nchar; + } + ; - for ( i = 1 ; i <= nItems ; i++ ) { + for( i = 1; i <= nItems; i++ ) + { - p = lpwAlign (p) ; + p = lpwAlign( p ); - *p++ = LOWORD ( hb_parvnl(2,i) ) ; - *p++ = HIWORD ( hb_parvnl(2,i) ) ; + *p++ = LOWORD( hb_parvnl( 2, i ) ); + *p++ = HIWORD( hb_parvnl( 2, i ) ); - *p++ = LOWORD ( hb_parvnl(3,i) ) ; - *p++ = HIWORD ( hb_parvnl(3,i) ) ; + *p++ = LOWORD( hb_parvnl( 3, i ) ); + *p++ = HIWORD( hb_parvnl( 3, i ) ); - *p++ = LOWORD ( hb_parvnl(4,i) ) ; - *p++ = HIWORD ( hb_parvnl(4,i) ) ; + *p++ = LOWORD( hb_parvnl( 4, i ) ); + *p++ = HIWORD( hb_parvnl( 4, i ) ); - *p++ = (short) hb_parvni(5,i) ; - *p++ = (short) hb_parvni(6,i) ; - *p++ = (short) hb_parvni(7,i) ; - *p++ = (short) hb_parvni(8,i) ; + *p++ = ( short ) hb_parvni( 5, i ); + *p++ = ( short ) hb_parvni( 6, i ); + *p++ = ( short ) hb_parvni( 7, i ); + *p++ = ( short ) hb_parvni( 8, i ); - *p++ = LOWORD ( hb_parvnl(9,i) ) ; - *p++ = HIWORD ( hb_parvnl(9,i) ) ; + *p++ = LOWORD( hb_parvnl( 9, i ) ); + *p++ = HIWORD( hb_parvnl( 9, i ) ); - if ( hb_parinfa( 10,i ) == HB_IT_STRING ) - { - nchar = nCopyAnsiToWideChar( p, TEXT ( (char*) hb_parvcx( 10,i ) ) ) ; - p += nchar ; - } + if( hb_parinfa( 10, i ) == HB_IT_STRING ) + { + nchar = nCopyAnsiToWideChar( p, TEXT( ( char * ) hb_parvcx( 10, i ) ) ); + p += nchar; + } else - { - *p++ = 0xFFFF ; - *p++ = (WORD) hb_parvni(10,i) ; - } + { + *p++ = 0xFFFF; + *p++ = ( WORD ) hb_parvni( 10, i ); + } - if ( hb_parinfa( 11,i ) == HB_IT_STRING ) - { - nchar = nCopyAnsiToWideChar( p, ( LPSTR ) hb_parvcx( 11,i ) ) ; - p += nchar ; - } + if( hb_parinfa( 11, i ) == HB_IT_STRING ) + { + nchar = nCopyAnsiToWideChar( p, ( LPSTR ) hb_parvcx( 11, i ) ); + p += nchar; + } else - { - *p++ = 0xFFFF ; - *p++ = (WORD) hb_parvni(11,i) ; - } + { + *p++ = 0xFFFF; + *p++ = ( WORD ) hb_parvni( 11, i ); + } - *p++ = 0x00 ; - } ; + *p++ = 0x00; + } + ; - p = lpwAlign( p ) ; + p = lpwAlign( p ); - hb_retclen( ( LPSTR ) pdlgtemplate, ( ( ULONG ) p - ( ULONG ) pdlgtemplate ) ) ; + hb_retclen( ( LPSTR ) pdlgtemplate, ( ( ULONG ) p - ( ULONG ) pdlgtemplate ) ); - LocalFree( LocalHandle( pdlgtemplate ) ) ; + LocalFree( LocalHandle( pdlgtemplate ) ); } HB_FUNC( WVW_GETCURSORPOS ) - { - POINT xy = { 0 }; - PHB_ITEM info = hb_itemArrayNew(2); +{ + POINT xy = { 0 }; + PHB_ITEM info = hb_itemArrayNew( 2 ); - GetCursorPos( &xy ); + GetCursorPos( &xy ); - hb_arraySetNI( info, 1, xy.x ); - hb_arraySetNI( info, 2, xy.y ); + hb_arraySetNI( info, 1, xy.x ); + hb_arraySetNI( info, 2, xy.y ); - hb_itemReturnRelease( info ); - } + hb_itemReturnRelease( info ); +} @@ -2254,9 +2259,9 @@ HB_FUNC( WVW_GETCURSORPOS ) /* WVW_ShowWindow( [nWinNum], nCmdShow ) */ HB_FUNC( WVW_SHOWWINDOW ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iCmdShow = HB_ISNUM(2) ? hb_parni(2) : SW_SHOWNORMAL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iCmdShow = HB_ISNUM( 2 ) ? hb_parni( 2 ) : SW_SHOWNORMAL; ShowWindow( pWindowData->hWnd, iCmdShow ); } @@ -2266,9 +2271,10 @@ HB_FUNC( WVW_SHOWWINDOW ) /* WVW_UpdateWindow( [nWinNum] ) */ HB_FUNC( WVW_UPDATEWINDOW ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; + + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); UpdateWindow( pWindowData->hWnd ); } @@ -2280,33 +2286,33 @@ HB_FUNC( WVW_UPDATEWINDOW ) HB_FUNC( WVW_CREATEDIALOGDYNAMIC ) { - PHB_ITEM pFirst = hb_param( 3,HB_IT_ANY ); - PHB_ITEM pFunc = NULL ; - PHB_DYNS pExecSym; - WVW_DATA * p = hb_getWvwData(); - HWND hDlg = NULL; - int iIndex; - int iType = 0; - int iResource = hb_parni( 4 ); + PHB_ITEM pFirst = hb_param( 3, HB_IT_ANY ); + PHB_ITEM pFunc = NULL; + PHB_DYNS pExecSym; + WVW_DATA * p = hb_getWvwData(); + HWND hDlg = NULL; + int iIndex; + int iType = 0; + int iResource = hb_parni( 4 ); /* check if we still have room for a new dialog */ - for ( iIndex = 0; iIndex < WVW_DLGML_MAX; iIndex++ ) + for( iIndex = 0; iIndex < WVW_DLGML_MAX; iIndex++ ) { - if ( p->s_sApp->hDlgModeless[ iIndex ] == NULL ) + if( p->s_sApp->hDlgModeless[ iIndex ] == NULL ) { break; } } - if ( iIndex >= WVW_DLGML_MAX ) + if( iIndex >= WVW_DLGML_MAX ) { /* no more room */ - hb_retnl( (ULONG) NULL ); + hb_retnl( ( ULONG ) NULL ); return; } - if ( HB_IS_BLOCK( pFirst ) ) + if( HB_IS_BLOCK( pFirst ) ) { /* pFunc is pointing to stored code block (later) */ @@ -2316,7 +2322,7 @@ HB_FUNC( WVW_CREATEDIALOGDYNAMIC ) else if( HB_IS_STRING( pFirst ) == HB_IT_STRING ) { pExecSym = hb_dynsymFindName( hb_itemGetCPtr( pFirst ) ); - if ( pExecSym ) + if( pExecSym ) { pFunc = ( PHB_ITEM ) pExecSym; } @@ -2325,55 +2331,49 @@ HB_FUNC( WVW_CREATEDIALOGDYNAMIC ) { - if ( HB_ISNUM( 3 ) ) + if( HB_ISNUM( 3 ) ) { hDlg = CreateDialogIndirect( hb_getWvwData()->hInstance, ( LPDLGTEMPLATE ) hb_parc( 1 ), - hb_parl( 2 ) ? p->s_pWindows[0]->hWnd : NULL, - ( DLGPROC ) hb_parnl( 3 ) ); + hb_parl( 2 ) ? p->s_pWindows[ 0 ]->hWnd : NULL, + ( DLGPROC ) hb_parnl( 3 ) ); } else { - switch ( iResource ) + switch( iResource ) { case 0: - { hDlg = CreateDialog( hb_getWvwData()->hInstance, - hb_parc( 1 ), - hb_parl( 2 ) ? p->s_pWindows[0]->hWnd : NULL, - (DLGPROC) hb_gt_wvwDlgProcMLess ); - } - break; + hb_parc( 1 ), + hb_parl( 2 ) ? p->s_pWindows[ 0 ]->hWnd : NULL, + ( DLGPROC ) hb_gt_wvwDlgProcMLess ); + break; case 1: - { hDlg = CreateDialog( hb_getWvwData()->hInstance, MAKEINTRESOURCE( ( WORD ) hb_parni( 1 ) ), - hb_parl( 2 ) ? p->s_pWindows[0]->hWnd : NULL, - (DLGPROC) hb_gt_wvwDlgProcMLess ); - } - break; + hb_parl( 2 ) ? p->s_pWindows[ 0 ]->hWnd : NULL, + ( DLGPROC ) hb_gt_wvwDlgProcMLess ); + break; case 2: - { hDlg = CreateDialogIndirect( hb_getWvwData()->hInstance, ( LPDLGTEMPLATE ) hb_parc( 1 ), - hb_parl( 2 ) ? p->s_pWindows[0]->hWnd : NULL, - (DLGPROC) hb_gt_wvwDlgProcMLess ); - } - break; + hb_parl( 2 ) ? p->s_pWindows[ 0 ]->hWnd : NULL, + ( DLGPROC ) hb_gt_wvwDlgProcMLess ); + break; } } - if ( hDlg ) + if( hDlg ) { p->s_sApp->hDlgModeless[ iIndex ] = hDlg; - if ( pFunc ) + if( pFunc ) { /* if codeblock, store the codeblock and lock it there */ - if (HB_IS_BLOCK( pFirst )) + if( HB_IS_BLOCK( pFirst ) ) { p->s_sApp->pcbFunc[ iIndex ] = pFunc; @@ -2392,7 +2392,7 @@ HB_FUNC( WVW_CREATEDIALOGDYNAMIC ) else { - if (iType==2 && pFunc) + if( iType == 2 && pFunc ) { hb_itemRelease( pFunc ); } @@ -2408,83 +2408,77 @@ HB_FUNC( WVW_CREATEDIALOGDYNAMIC ) HB_FUNC( WVW_CREATEDIALOGMODAL ) { - PHB_ITEM pFirst = hb_param( 3,HB_IT_ANY ); - PHB_ITEM pFunc = NULL ; - PHB_DYNS pExecSym; - WVW_DATA * p = hb_getWvwData(); - int iIndex; - int iResource = hb_parni( 4 ); - int iResult = 0; - HWND hParent = HB_ISNIL( 5 ) ? p->s_pWindows[0]->hWnd : ( HWND ) HB_PARHANDLE( 5 ); + PHB_ITEM pFirst = hb_param( 3, HB_IT_ANY ); + PHB_ITEM pFunc = NULL; + PHB_DYNS pExecSym; + WVW_DATA * p = hb_getWvwData(); + int iIndex; + int iResource = hb_parni( 4 ); + int iResult = 0; + HWND hParent = HB_ISNIL( 5 ) ? p->s_pWindows[ 0 ]->hWnd : ( HWND ) HB_PARHANDLE( 5 ); /* check if we still have room for a new dialog */ - for ( iIndex = 0; iIndex < WVW_DLGMD_MAX; iIndex++ ) + for( iIndex = 0; iIndex < WVW_DLGMD_MAX; iIndex++ ) { - if ( p->s_sApp->hDlgModal[ iIndex ] == NULL ) + if( p->s_sApp->hDlgModal[ iIndex ] == NULL ) { break; } } - if ( iIndex >= WVW_DLGMD_MAX ) + if( iIndex >= WVW_DLGMD_MAX ) { /* no more room */ hb_retni( ( int ) NULL ); return; } - if ( HB_IS_BLOCK( pFirst ) ) + if( HB_IS_BLOCK( pFirst ) ) { /* pFunc is pointing to stored code block (later) */ - p->s_sApp->pcbFuncModal[ iIndex ] = hb_itemNew( pFirst ); + p->s_sApp->pcbFuncModal[ iIndex ] = hb_itemNew( pFirst ); - pFunc = p->s_sApp->pcbFuncModal[ iIndex ]; - p->s_sApp->pFuncModal[ iIndex ] = pFunc; - p->s_sApp->iTypeModal[ iIndex ] = 2; + pFunc = p->s_sApp->pcbFuncModal[ iIndex ]; + p->s_sApp->pFuncModal[ iIndex ] = pFunc; + p->s_sApp->iTypeModal[ iIndex ] = 2; } else if( HB_IS_STRING( pFirst ) == HB_IT_STRING ) { pExecSym = hb_dynsymFindName( hb_itemGetCPtr( pFirst ) ); - if ( pExecSym ) + if( pExecSym ) { pFunc = ( PHB_ITEM ) pExecSym; } - p->s_sApp->pFuncModal[ iIndex ] = pFunc; - p->s_sApp->iTypeModal[ iIndex ] = 1; + p->s_sApp->pFuncModal[ iIndex ] = pFunc; + p->s_sApp->iTypeModal[ iIndex ] = 1; } - switch ( iResource ) + switch( iResource ) { case 0: - { iResult = DialogBoxParam( hb_getWvwData()->hInstance, - hb_parc( 1 ), - hParent, - (DLGPROC) hb_gt_wvwDlgProcModal, - ( LPARAM ) ( DWORD ) iIndex+1 ); - } - break; + hb_parc( 1 ), + hParent, + ( DLGPROC ) hb_gt_wvwDlgProcModal, + ( LPARAM ) ( DWORD ) iIndex + 1 ); + break; case 1: - { iResult = DialogBoxParam( hb_getWvwData()->hInstance, - MAKEINTRESOURCE( ( WORD ) hb_parni( 1 ) ), - hParent, - (DLGPROC) hb_gt_wvwDlgProcModal, - ( LPARAM ) ( DWORD ) iIndex+1 ); - } - break; + MAKEINTRESOURCE( ( WORD ) hb_parni( 1 ) ), + hParent, + ( DLGPROC ) hb_gt_wvwDlgProcModal, + ( LPARAM ) ( DWORD ) iIndex + 1 ); + break; case 2: - { iResult = DialogBoxIndirectParam( hb_getWvwData()->hInstance, ( LPDLGTEMPLATE ) hb_parc( 1 ), - hParent, - (DLGPROC) hb_gt_wvwDlgProcModal, - ( LPARAM ) ( DWORD ) iIndex+1 ); - } - break; + hParent, + ( DLGPROC ) hb_gt_wvwDlgProcModal, + ( LPARAM ) ( DWORD ) iIndex + 1 ); + break; } hb_retni( iResult ); @@ -2500,9 +2494,9 @@ HB_FUNC( WVW_DELETEOBJECT ) HB_FUNC( WVW_SETONTOP ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - RECT rect = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + RECT rect = { 0 }; GetWindowRect( pWindowData->hWnd, &rect ); @@ -2518,9 +2512,9 @@ HB_FUNC( WVW_SETONTOP ) HB_FUNC( WVW_SETASNORMAL ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - RECT rect = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + RECT rect = { 0 }; GetWindowRect( pWindowData->hWnd, &rect ); @@ -2543,38 +2537,38 @@ HB_FUNC( WVW_SETASNORMAL ) HB_FUNC( WVW_SAVESCREEN ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HBITMAP hBmp, oldBmp; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight, iWidth, iHeight; - PHB_ITEM info = hb_itemArrayNew(3); + HBITMAP hBmp, oldBmp; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight, iWidth, iHeight; + PHB_ITEM info = hb_itemArrayNew( 3 ); - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y; - iLeft = xy.x; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y; + iLeft = xy.x; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - iBottom = xy.y-1; - iRight = xy.x-1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + iBottom = xy.y - 1; + iRight = xy.x - 1; - iWidth = iRight - iLeft + 1; - iHeight = iBottom - iTop + 1; + iWidth = iRight - iLeft + 1; + iHeight = iBottom - iTop + 1; - hBmp = CreateCompatibleBitmap( pWindowData->hdc, iWidth, iHeight ) ; + hBmp = CreateCompatibleBitmap( pWindowData->hdc, iWidth, iHeight ); - oldBmp = (HBITMAP) SelectObject( pWindowData->hCompDC, hBmp ); + oldBmp = ( HBITMAP ) SelectObject( pWindowData->hCompDC, hBmp ); BitBlt( pWindowData->hCompDC, 0, 0, iWidth, iHeight, pWindowData->hdc, iLeft, iTop, SRCCOPY ); SelectObject( pWindowData->hCompDC, oldBmp ); @@ -2596,67 +2590,68 @@ HB_FUNC( WVW_SAVESCREEN ) HB_FUNC( WVW_RESTSCREEN ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight, iWidth, iHeight; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight, iWidth, iHeight; - HBITMAP hBmp; + HBITMAP hBmp; - BOOL bResult = FALSE; - BOOL bDoNotDestroyBMP = HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ); - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = ( USHORT )hb_parni( 4 ), - usRight = ( USHORT )hb_parni( 5 ); - if (hb_gt_wvw_GetMainCoordMode()) + BOOL bResult = FALSE; + BOOL bDoNotDestroyBMP = HB_ISNIL( 7 ) ? FALSE : hb_parl( 7 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y; - iLeft = xy.x; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y; + iLeft = xy.x; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - iBottom = xy.y-1; - iRight = xy.x-1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + iBottom = xy.y - 1; + iRight = xy.x - 1; - iWidth = iRight - iLeft + 1 ; - iHeight = iBottom - iTop + 1 ; + iWidth = iRight - iLeft + 1; + iHeight = iBottom - iTop + 1; - hBmp = (HBITMAP) SelectObject( pWindowData->hCompDC, ( HBITMAP ) hb_parvnl( 6,3 ) ); - if ( hBmp ) + hBmp = ( HBITMAP ) SelectObject( pWindowData->hCompDC, ( HBITMAP ) hb_parvnl( 6, 3 ) ); + if( hBmp ) { - if ( ( iWidth == hb_parvni( 6,1 ) ) && ( iHeight == hb_parvni( 6,2 ) ) ) + if( ( iWidth == hb_parvni( 6, 1 ) ) && ( iHeight == hb_parvni( 6, 2 ) ) ) { - if ( BitBlt( pWindowData->hdc, - iLeft, - iTop, - iWidth, - iHeight, - pWindowData->hCompDC, - 0, - 0, - SRCCOPY ) ) + if( BitBlt( pWindowData->hdc, + iLeft, + iTop, + iWidth, + iHeight, + pWindowData->hCompDC, + 0, + 0, + SRCCOPY ) ) { bResult = TRUE; } } else { - if ( StretchBlt( pWindowData->hdc, - iLeft, - iTop, - iWidth, - iHeight, - pWindowData->hCompDC, - 0, - 0, - hb_parvni( 6,1 ), - hb_parvni( 6,2 ), - SRCCOPY ) ) + if( StretchBlt( pWindowData->hdc, + iLeft, + iTop, + iWidth, + iHeight, + pWindowData->hCompDC, + 0, + 0, + hb_parvni( 6, 1 ), + hb_parvni( 6, 2 ), + SRCCOPY ) ) { bResult = TRUE; } @@ -2665,9 +2660,9 @@ HB_FUNC( WVW_RESTSCREEN ) SelectObject( pWindowData->hCompDC, hBmp ); - if ( ! bDoNotDestroyBMP ) + if( ! bDoNotDestroyBMP ) { - DeleteObject( ( HBITMAP ) hb_parvnl( 6,3 ) ); + DeleteObject( ( HBITMAP ) hb_parvnl( 6, 3 ) ); } hb_retl( bResult ); @@ -2680,33 +2675,33 @@ HB_FUNC( WVW_RESTSCREEN ) /* */ HB_FUNC( WVW_CREATEFONT ) { - WVW_DATA * p = hb_getWvwData(); - UINT usWinNum = p->s_usNumWindows-1; + WVW_DATA * p = hb_getWvwData(); + UINT usWinNum = p->s_usNumWindows - 1; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - LOGFONT logfont; - HFONT hFont; + LOGFONT logfont; + HFONT hFont; - logfont.lfEscapement = ( HB_ISNIL( 10 ) ? 0 : ( hb_parni( 10 ) * 10 ) ); - logfont.lfOrientation = 0; - logfont.lfWeight = ( HB_ISNIL( 4 ) ? 0 : hb_parni( 4 ) ); - logfont.lfItalic = ( HB_ISNIL( 5 ) ? 0 : ( BYTE )hb_parl( 5 ) ); - logfont.lfUnderline = ( HB_ISNIL( 6 ) ? 0 : ( BYTE )hb_parl( 6 ) ); - logfont.lfStrikeOut = ( HB_ISNIL( 7 ) ? 0 : ( BYTE )hb_parl( 7 ) ); - logfont.lfCharSet = ( HB_ISNIL( 8 ) ? ( BYTE )pWindowData->CodePage : (BYTE)hb_parni( 8 ) ); - logfont.lfOutPrecision = 0; - logfont.lfClipPrecision = 0; - logfont.lfQuality = ( HB_ISNIL( 9 ) ? ( BYTE )DEFAULT_QUALITY : (BYTE)hb_parni( 9 ) ); - logfont.lfPitchAndFamily = FF_DONTCARE; - logfont.lfHeight = ( HB_ISNIL( 2 ) ? pWindowData->fontHeight : hb_parni( 2 ) ); - logfont.lfWidth = ( HB_ISNIL( 3 ) ? ( pWindowData->fontWidth < 0 ? -pWindowData->fontWidth : pWindowData->fontWidth ) : hb_parni( 3 ) ); + logfont.lfEscapement = ( HB_ISNIL( 10 ) ? 0 : ( hb_parni( 10 ) * 10 ) ); + logfont.lfOrientation = 0; + logfont.lfWeight = ( HB_ISNIL( 4 ) ? 0 : hb_parni( 4 ) ); + logfont.lfItalic = ( HB_ISNIL( 5 ) ? 0 : ( BYTE ) hb_parl( 5 ) ); + logfont.lfUnderline = ( HB_ISNIL( 6 ) ? 0 : ( BYTE ) hb_parl( 6 ) ); + logfont.lfStrikeOut = ( HB_ISNIL( 7 ) ? 0 : ( BYTE ) hb_parl( 7 ) ); + logfont.lfCharSet = ( HB_ISNIL( 8 ) ? ( BYTE ) pWindowData->CodePage : ( BYTE ) hb_parni( 8 ) ); + logfont.lfOutPrecision = 0; + logfont.lfClipPrecision = 0; + logfont.lfQuality = ( HB_ISNIL( 9 ) ? ( BYTE ) DEFAULT_QUALITY : ( BYTE ) hb_parni( 9 ) ); + logfont.lfPitchAndFamily = FF_DONTCARE; + logfont.lfHeight = ( HB_ISNIL( 2 ) ? pWindowData->fontHeight : hb_parni( 2 ) ); + logfont.lfWidth = ( HB_ISNIL( 3 ) ? ( pWindowData->fontWidth < 0 ? -pWindowData->fontWidth : pWindowData->fontWidth ) : hb_parni( 3 ) ); strcpy( logfont.lfFaceName, ( HB_ISNIL( 1 ) ? pWindowData->fontFace : hb_parcx( 1 ) ) ); hFont = CreateFontIndirect( &logfont ); - if ( hFont ) + if( hFont ) { hb_retnl( ( ULONG ) hFont ); } @@ -2718,15 +2713,15 @@ HB_FUNC( WVW_CREATEFONT ) HB_FUNC( WVW_GETKEYSTATE ) { - hb_retni( GetKeyState( hb_parni( 1 ) ) ) ; + hb_retni( GetKeyState( hb_parni( 1 ) ) ); } HB_FUNC( WVW_LOWORD ) { - hb_retni( (int) ( hb_parnl( 1 ) & 0xFFFF ) ); + hb_retni( ( int ) ( hb_parnl( 1 ) & 0xFFFF ) ); } HB_FUNC( WVW_HIWORD ) { - hb_retni( (int) ( ( hb_parnl( 1 ) >> 16 ) & 0xFFFF ) ); + hb_retni( ( int ) ( ( hb_parnl( 1 ) >> 16 ) & 0xFFFF ) ); } diff --git a/harbour/extras/gtwvw/wvwmenu.c b/harbour/extras/gtwvw/wvwmenu.c index 7e780d8a23..d298ce51ef 100644 --- a/harbour/extras/gtwvw/wvwmenu.c +++ b/harbour/extras/gtwvw/wvwmenu.c @@ -1,5 +1,5 @@ /* -* $Id$ + * $Id$ */ /* @@ -90,20 +90,21 @@ HB_FUNC( WVW_SETMENU ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWinData = hb_gt_wvw_GetWindowsData( usWinNum ); - SetMenu( pWinData->hWnd, ( HMENU ) HB_PARHANDLE( 2 ) ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWinData = hb_gt_wvw_GetWindowsData( usWinNum ); - hb_gt_wvwResetWindow( usWinNum ); + SetMenu( pWinData->hWnd, ( HMENU ) HB_PARHANDLE( 2 ) ); + + hb_gt_wvwResetWindow( usWinNum ); } HB_FUNC( WVW_SETPOPUPMENU ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWinData = hb_gt_wvw_GetWindowsData( usWinNum ); - HMENU hPopup = pWinData->hPopup ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWinData = hb_gt_wvw_GetWindowsData( usWinNum ); + HMENU hPopup = pWinData->hPopup; pWinData->hPopup = ( HMENU ) HB_PARHANDLE( 2 ); /* if ( hPopup ) */ @@ -116,14 +117,14 @@ HB_FUNC( WVW_SETPOPUPMENU ) HB_FUNC( WVW_CREATEMENU ) { - HB_RETHANDLE( CreateMenu() ) ; + HB_RETHANDLE( CreateMenu() ); } HB_FUNC( WVW_CREATEPOPUPMENU ) { - HB_RETHANDLE( CreatePopupMenu() ) ; + HB_RETHANDLE( CreatePopupMenu() ); } @@ -132,96 +133,98 @@ HB_FUNC( WVW_CREATEPOPUPMENU ) HB_FUNC( WVW_APPENDMENU ) { - char ucBuf[ 256 ]; - int i,iLen ; - LPCTSTR lpszCaption; + char ucBuf[ 256 ]; + int i, iLen; + LPCTSTR lpszCaption; - if ( !(hb_parni(2) & (MF_SEPARATOR|MF_POPUP)) && - (hb_parni(3) >= WVW_ID_BASE_PUSHBUTTON ) ) - { - MessageBox( NULL, TEXT( "Menu Command Id too high. Potential conflict with pushbutton" ), - hb_gt_wvw_GetAppName(), MB_ICONERROR ); - hb_retl( FALSE ); - return; - } + if( ! ( hb_parni( 2 ) & ( MF_SEPARATOR | MF_POPUP ) ) && + ( hb_parni( 3 ) >= WVW_ID_BASE_PUSHBUTTON ) ) + { + MessageBox( NULL, TEXT( "Menu Command Id too high. Potential conflict with pushbutton" ), + hb_gt_wvw_GetAppName(), MB_ICONERROR ); + hb_retl( FALSE ); + return; + } - if ( HB_ISCHAR( 4 ) ) - { - iLen = hb_parclen( 4 ); - if ( iLen > 0 && iLen < 256 ) - { - lpszCaption = hb_parcx( 4 ) ; - for ( i=0; i< iLen ; i++ ) + if( HB_ISCHAR( 4 ) ) + { + iLen = hb_parclen( 4 ); + if( iLen > 0 && iLen < 256 ) { - ucBuf[ i ] = ( *lpszCaption == '~' ) ? '&' : *lpszCaption ; - lpszCaption++; + lpszCaption = hb_parcx( 4 ); + for( i = 0; i < iLen; i++ ) + { + ucBuf[ i ] = ( *lpszCaption == '~' ) ? '&' : *lpszCaption; + lpszCaption++; + } + ucBuf[ iLen ] = '\0'; + lpszCaption = ucBuf; } - ucBuf[ iLen ]= '\0'; - lpszCaption = ucBuf ; - } - else - { - lpszCaption = hb_parcx( 4 ) ; - } - } - else - { - lpszCaption = ( LPCTSTR ) hb_parni( 4 ) ; - } + else + { + lpszCaption = hb_parcx( 4 ); + } + } + else + { + lpszCaption = ( LPCTSTR ) hb_parni( 4 ); + } - hb_retl( AppendMenu( ( HMENU ) HB_PARHANDLE( 1 ), ( UINT ) hb_parni( 2 ), ( UINT_PTR ) hb_parni( 3 ),( LPCTSTR ) lpszCaption ) ) ; + hb_retl( AppendMenu( ( HMENU ) HB_PARHANDLE( 1 ), ( UINT ) hb_parni( 2 ), ( UINT_PTR ) hb_parni( 3 ), ( LPCTSTR ) lpszCaption ) ); } HB_FUNC( WVW_DELETEMENU ) { - hb_retl( DeleteMenu( ( HMENU ) HB_PARHANDLE( 1 ), ( UINT ) hb_parni( 2 ), ( UINT ) hb_parni( 3 ) ) ); + hb_retl( DeleteMenu( ( HMENU ) HB_PARHANDLE( 1 ), ( UINT ) hb_parni( 2 ), ( UINT ) hb_parni( 3 ) ) ); } HB_FUNC( WVW_DESTROYMENU ) { - hb_retl( DestroyMenu( ( HMENU ) HB_PARHANDLE( 1 ) ) ); + hb_retl( DestroyMenu( ( HMENU ) HB_PARHANDLE( 1 ) ) ); } HB_FUNC( WVW_ENABLEMENUITEM ) { - hb_retni( EnableMenuItem( ( HMENU ) HB_PARHANDLE( 1 ), ( UINT ) hb_parni( 2 ), ( UINT ) hb_parni( 3 ) ) ); + hb_retni( EnableMenuItem( ( HMENU ) HB_PARHANDLE( 1 ), ( UINT ) hb_parni( 2 ), ( UINT ) hb_parni( 3 ) ) ); } HB_FUNC( WVW_GETLASTMENUEVENT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - hb_retni( hb_gt_wvwGetLastMenuEvent( usWinNum ) ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + + hb_retni( hb_gt_wvwGetLastMenuEvent( usWinNum ) ); } HB_FUNC( WVW_SETLASTMENUEVENT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - hb_retni( hb_gt_wvwSetLastMenuEvent( usWinNum, hb_parni(2) ) ); + UINT usWinNum = WVW_WHICH_WINDOW; + + hb_retni( hb_gt_wvwSetLastMenuEvent( usWinNum, hb_parni( 2 ) ) ); } HB_FUNC( WVW_SETMENUKEYEVENT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int iEvent = 0; + UINT usWinNum = WVW_WHICH_WINDOW; + int iEvent = 0; - if ( HB_ISNUM( 2 ) ) - { - iEvent = hb_parnl( 2 ) ; - } + if( HB_ISNUM( 2 ) ) + { + iEvent = hb_parnl( 2 ); + } - hb_retni( hb_gt_wvwSetMenuKeyEvent( usWinNum, iEvent ) ) ; + hb_retni( hb_gt_wvwSetMenuKeyEvent( usWinNum, iEvent ) ); } // WVW_MENUITEM_SETBITMAPS( @@ -231,72 +234,72 @@ HB_FUNC( WVW_SETMENUKEYEVENT ) // ncBitmapUnchecked, // ncBimapChecked ) // -HB_FUNC ( WVW_MENUITEM_SETBITMAPS ) +HB_FUNC( WVW_MENUITEM_SETBITMAPS ) { - HBITMAP hBitmapUnchecked = NULL; - HBITMAP hBitmapChecked = NULL; - char szResname[_MAX_PATH+1]; - int iWidth, iHeight; + HBITMAP hBitmapUnchecked = NULL; + HBITMAP hBitmapChecked = NULL; + char szResname[ _MAX_PATH + 1 ]; + int iWidth, iHeight; - if ( !HB_ISNIL(4) ) + if( ! HB_ISNIL( 4 ) ) { - if ( HB_ISNUM(4) ) - { - sprintf( szResname, "?%u", hb_parni(4) ); + if( HB_ISNUM( 4 ) ) + { + sprintf( szResname, "?%u", hb_parni( 4 ) ); - hBitmapUnchecked = FindBitmapHandle(szResname, &iWidth, &iHeight); + hBitmapUnchecked = FindBitmapHandle( szResname, &iWidth, &iHeight ); - if (!hBitmapUnchecked) - { - hBitmapUnchecked = (HBITMAP)LoadImage(hb_getWvwData()->hInstance,(LPCTSTR) MAKEINTRESOURCE( (WORD) hb_parni(4) ),IMAGE_BITMAP,0,0, LR_DEFAULTCOLOR); - AddBitmapHandle(szResname, hBitmapUnchecked, iWidth, iHeight); - } - } - else - { - hBitmapUnchecked = FindBitmapHandle(hb_parcx(4), &iWidth, &iHeight); + if( ! hBitmapUnchecked ) + { + hBitmapUnchecked = ( HBITMAP ) LoadImage( hb_getWvwData()->hInstance, ( LPCTSTR ) MAKEINTRESOURCE( ( WORD ) hb_parni( 4 ) ), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR ); + AddBitmapHandle( szResname, hBitmapUnchecked, iWidth, iHeight ); + } + } + else + { + hBitmapUnchecked = FindBitmapHandle( hb_parcx( 4 ), &iWidth, &iHeight ); - if (!hBitmapUnchecked) - { - hBitmapUnchecked = (HBITMAP)LoadImage(hb_getWvwData()->hInstance, hb_parcx(4), IMAGE_BITMAP,0,0, LR_DEFAULTCOLOR); - AddBitmapHandle(hb_parcx(4), hBitmapUnchecked , iWidth, iHeight); - } - } - } - - if ( !HB_ISNIL(5) ) - { - if ( HB_ISNUM(5) ) - { - sprintf( szResname, "?%u", hb_parni(5) ); - - hBitmapChecked = FindBitmapHandle(szResname, &iWidth, &iHeight); - - if (!hBitmapChecked) - { - hBitmapChecked = (HBITMAP)LoadImage(hb_getWvwData()->hInstance,(LPCTSTR) MAKEINTRESOURCE( (WORD) hb_parni(5) ),IMAGE_BITMAP,0,0, LR_DEFAULTCOLOR); - AddBitmapHandle(szResname, hBitmapChecked, iWidth, iHeight); - } - } - else - { - hBitmapChecked = FindBitmapHandle(hb_parcx(5), &iWidth, &iHeight); - - if (!hBitmapChecked) - { - hBitmapChecked = (HBITMAP)LoadImage(hb_getWvwData()->hInstance, hb_parcx(5), IMAGE_BITMAP,0,0, LR_DEFAULTCOLOR); - AddBitmapHandle(hb_parcx(5), hBitmapChecked , iWidth, iHeight); - } - } + if( ! hBitmapUnchecked ) + { + hBitmapUnchecked = ( HBITMAP ) LoadImage( hb_getWvwData()->hInstance, hb_parcx( 4 ), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR ); + AddBitmapHandle( hb_parcx( 4 ), hBitmapUnchecked, iWidth, iHeight ); + } + } } - if ( !HB_ISNIL(2) ) + if( ! HB_ISNIL( 5 ) ) { - SetMenuItemBitmaps( (HMENU) HB_PARHANDLE(1) , hb_parni(2), MF_BYCOMMAND , (HBITMAP) hBitmapUnchecked, (HBITMAP) hBitmapChecked ) ; + if( HB_ISNUM( 5 ) ) + { + sprintf( szResname, "?%u", hb_parni( 5 ) ); + + hBitmapChecked = FindBitmapHandle( szResname, &iWidth, &iHeight ); + + if( ! hBitmapChecked ) + { + hBitmapChecked = ( HBITMAP ) LoadImage( hb_getWvwData()->hInstance, ( LPCTSTR ) MAKEINTRESOURCE( ( WORD ) hb_parni( 5 ) ), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR ); + AddBitmapHandle( szResname, hBitmapChecked, iWidth, iHeight ); + } + } + else + { + hBitmapChecked = FindBitmapHandle( hb_parcx( 5 ), &iWidth, &iHeight ); + + if( ! hBitmapChecked ) + { + hBitmapChecked = ( HBITMAP ) LoadImage( hb_getWvwData()->hInstance, hb_parcx( 5 ), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR ); + AddBitmapHandle( hb_parcx( 5 ), hBitmapChecked, iWidth, iHeight ); + } + } + } + + if( ! HB_ISNIL( 2 ) ) + { + SetMenuItemBitmaps( ( HMENU ) HB_PARHANDLE( 1 ), hb_parni( 2 ), MF_BYCOMMAND, ( HBITMAP ) hBitmapUnchecked, ( HBITMAP ) hBitmapChecked ); } else { - SetMenuItemBitmaps( (HMENU) HB_PARHANDLE(1) , hb_parni(3), MF_BYPOSITION , (HBITMAP) hBitmapUnchecked, (HBITMAP) hBitmapChecked ) ; + SetMenuItemBitmaps( ( HMENU ) HB_PARHANDLE( 1 ), hb_parni( 3 ), MF_BYPOSITION, ( HBITMAP ) hBitmapUnchecked, ( HBITMAP ) hBitmapChecked ); } } @@ -305,64 +308,66 @@ HB_FUNC ( WVW_MENUITEM_SETBITMAPS ) HB_FUNC( WVW_DRAWMENUBAR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - DrawMenuBar( pWindowData->hWnd ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + + DrawMenuBar( pWindowData->hWnd ); } HB_FUNC( WVW_ENDMENU ) { - hb_retl( EndMenu() ) ; + hb_retl( EndMenu() ); } /* WVW_GetMenu([nWinNum]) */ HB_FUNC( WVW_GETMENU ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HB_RETHANDLE( GetMenu( pWindowData->hWnd ) ); } /* WVW_TrackPopupMenu([nWinNum], n) */ HB_FUNC( WVW_TRACKPOPUPMENU ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - POINT xy = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + POINT xy = { 0 }; GetCursorPos( &xy ); - hb_retnl( TrackPopupMenu( ( HMENU ) HB_PARHANDLE( 2 ) , - TPM_CENTERALIGN | TPM_RETURNCMD | TPM_RECURSE, - xy.x , - xy.y , - 0 , - pWindowData->hWnd , - NULL ) ); + hb_retnl( TrackPopupMenu( ( HMENU ) HB_PARHANDLE( 2 ), + TPM_CENTERALIGN | TPM_RETURNCMD | TPM_RECURSE, + xy.x, + xy.y, + 0, + pWindowData->hWnd, + NULL ) ); } HB_FUNC( WIN_SETMENU ) { - SetMenu( ( HWND ) HB_PARHANDLE( 1 ), ( HMENU ) HB_PARHANDLE( 2 ) ) ; + SetMenu( ( HWND ) HB_PARHANDLE( 1 ), ( HMENU ) HB_PARHANDLE( 2 ) ); } /* - *WVW_NOSYSMENU( [nWinNum], lRemoveClose ) - *removes System Menu of a window - *if lRemoveClose is .t., also removes the 'Close' command and 'X' button + *WVW_NOSYSMENU( [nWinNum], lRemoveClose ) + *removes System Menu of a window + *if lRemoveClose is .t., also removes the 'Close' command and 'X' button * - *no return value + **no return value */ HB_FUNC( WVW_NOSYSMENU ) { - UINT usWinNum = WVW_WHICH_WINDOW; - BOOL lRemoveClose = HB_ISNIL(2) ? FALSE : hb_parl(2); - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HMENU hMenu = GetSystemMenu(pWindowData->hWnd, FALSE); + UINT usWinNum = WVW_WHICH_WINDOW; + BOOL lRemoveClose = HB_ISNIL( 2 ) ? FALSE : hb_parl( 2 ); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HMENU hMenu = GetSystemMenu( pWindowData->hWnd, FALSE ); - if (hMenu) + if( hMenu ) { DeleteMenu( hMenu, SC_MAXIMIZE, MF_BYCOMMAND ); DeleteMenu( hMenu, SC_MINIMIZE, MF_BYCOMMAND ); @@ -370,7 +375,7 @@ HB_FUNC( WVW_NOSYSMENU ) DeleteMenu( hMenu, SC_MOVE, MF_BYCOMMAND ); DeleteMenu( hMenu, SC_RESTORE, MF_BYCOMMAND ); DeleteMenu( hMenu, SC_NEXTWINDOW, MF_BYCOMMAND ); - if (lRemoveClose) + if( lRemoveClose ) { DeleteMenu( hMenu, SC_CLOSE, MF_BYCOMMAND ); DeleteMenu( hMenu, 0, MF_BYPOSITION ); @@ -380,13 +385,14 @@ HB_FUNC( WVW_NOSYSMENU ) } /* WVW_GetSystemMenu( [nWinNum], lReset ) - *returns the System Menu of a window - *if lRemoveClose is .t., also removes the 'Close' command and 'X' button + *returns the System Menu of a window + *if lRemoveClose is .t., also removes the 'Close' command and 'X' button */ HB_FUNC( WVW_GETSYSTEMMENU ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - BOOL lReset = HB_ISNIL(2) ? FALSE : hb_parl(2); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + BOOL lReset = HB_ISNIL( 2 ) ? FALSE : hb_parl( 2 ); + hb_retnl( ( ULONG ) GetSystemMenu( pWindowData->hWnd, lReset ) ); } diff --git a/harbour/extras/gtwvw/wvwpush.c b/harbour/extras/gtwvw/wvwpush.c index 888c9aa136..f66959abea 100644 --- a/harbour/extras/gtwvw/wvwpush.c +++ b/harbour/extras/gtwvw/wvwpush.c @@ -79,24 +79,24 @@ /*WVW_PBcreate( [nWinNum], nTop, nLeft, nBottom, nRight, cText, cImage/nImage, bBlock, aOffset,; * nStretchBitmap, lMap3Dcolors) - *create pushbutton for window nWinNum - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nBottom: row of bottom/right corner (in character unit) defaults==nTop - *nRight: col of bottom/right corner (in character unit) defaults==?? - *cText: caption, default == "" + **create pushbutton for window nWinNum + **nTop: row of top/left corner (in character unit) + **nLeft: col of top/left corner (in character unit) + **nBottom: row of bottom/right corner (in character unit) defaults==nTop + **nRight: col of bottom/right corner (in character unit) defaults==?? + **cText: caption, default == "" * * - *cImage: bitmap file name, can be supplied as nImage: bitmap resource id + **cImage: bitmap file name, can be supplied as nImage: bitmap resource id * - *nStretchBitmap: a number between 0 and 1 (inclusive) as a factor to + **nStretchBitmap: a number between 0 and 1 (inclusive) as a factor to * stretch the bitmap. * 1.0: bitmap covers the whole button * 0.5: bitmap covers 50% of button * 0: bitmap is not stretch * (default is 1) * - *lMap3Dcolors: defaults to .f. + **lMap3Dcolors: defaults to .f. * if .t. the following color mapping will be performed: * RGB(192,192,192) --> COLOR_3DFACE ("transparent") * RGB(128,128,128) --> COLOR_3DSHADOW @@ -104,91 +104,94 @@ * This might be desirable to have transparent effect. * LIMITATION: this will work on 256 colored bitmaps only * - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust + **aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust * dimension of pushbutton. * defaults for pushbutton: {-2,-2,+2,+2} * - *bBlock: codeblock to execute on every BN_CLICK event. + **bBlock: codeblock to execute on every BN_CLICK event. * This codeblock will be evaluated with these parameters: * nWinNum: window number * nPBid : pushbutton id * - *returns control id of newly created pushbutton of windows nWinNum - *returns 0 if failed + **returns control id of newly created pushbutton of windows nWinNum + **returns 0 if failed * - *example: + **example: */ -HB_FUNC( WVW_PBCREATE) +HB_FUNC( WVW_PBCREATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - int iOffTop, iOffLeft, iOffBottom, iOffRight; + UINT usWinNum = WVW_WHICH_WINDOW; + int iOffTop, iOffLeft, iOffBottom, iOffRight; // int iStyle; - UINT uiPBid; - USHORT usTop = ( USHORT ) hb_parni( 2 ), - usLeft = ( USHORT ) hb_parni( 3 ), - usBottom = ( USHORT ) hb_parni( 4 ), - usRight = ( USHORT ) hb_parni( 5 ); - LPCTSTR lpszCaption = HB_ISCHAR(6) ? hb_parcx(6) : NULL; - char * szBitmap = HB_ISCHAR(7) ? (char*) hb_parcx(7) : NULL; - UINT uiBitmap = HB_ISNUM(7) ? (UINT) hb_parni(7) : 0; - double dStretch = !HB_ISNIL(10) ? hb_parnd(10) : 1; - BOOL bMap3Dcolors = HB_ISLOG(11) ? (BOOL) hb_parl(11) : FALSE; + UINT uiPBid; + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = ( USHORT ) hb_parni( 4 ), + usRight = ( USHORT ) hb_parni( 5 ); + LPCTSTR lpszCaption = HB_ISCHAR( 6 ) ? hb_parcx( 6 ) : NULL; + char * szBitmap = HB_ISCHAR( 7 ) ? ( char * ) hb_parcx( 7 ) : NULL; + UINT uiBitmap = HB_ISNUM( 7 ) ? ( UINT ) hb_parni( 7 ) : 0; + double dStretch = ! HB_ISNIL( 10 ) ? hb_parnd( 10 ) : 1; + BOOL bMap3Dcolors = HB_ISLOG( 11 ) ? ( BOOL ) hb_parl( 11 ) : FALSE; - if (!HB_ISBLOCK(8)) + if( ! HB_ISBLOCK( 8 ) ) { - hb_retnl(0); - return; + hb_retnl( 0 ); + return; } - iOffTop = !HB_ISNIL( 9 ) ? hb_parvni( 9,1 ) : -2 ; - iOffLeft = !HB_ISNIL( 9 ) ? hb_parvni( 9,2 ) : -2 ; - iOffBottom = !HB_ISNIL( 9 ) ? hb_parvni( 9,3 ) : +2 ; - iOffRight = !HB_ISNIL( 9 ) ? hb_parvni( 9,4 ) : +2; + iOffTop = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 1 ) : -2; + iOffLeft = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 2 ) : -2; + iOffBottom = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 3 ) : +2; + iOffRight = ! HB_ISNIL( 9 ) ? hb_parvni( 9, 4 ) : +2; - uiPBid = ButtonCreate( usWinNum, usTop, usLeft, usBottom, usRight, lpszCaption, - szBitmap, uiBitmap, hb_param( 8, HB_IT_BLOCK ), - iOffTop, iOffLeft, iOffBottom, iOffRight, - dStretch, bMap3Dcolors, - BS_PUSHBUTTON ); - hb_retnl( (LONG) uiPBid ); + uiPBid = ButtonCreate( usWinNum, usTop, usLeft, usBottom, usRight, lpszCaption, + szBitmap, uiBitmap, hb_param( 8, HB_IT_BLOCK ), + iOffTop, iOffLeft, iOffBottom, iOffRight, + dStretch, bMap3Dcolors, + BS_PUSHBUTTON ); + hb_retnl( ( LONG ) uiPBid ); } /*WVW_PBdestroy( [nWinNum], nPBid ) - *destroy button nPBid for window nWinNum + *destroy button nPBid for window nWinNum */ -HB_FUNC( WVW_PBDESTROY) +HB_FUNC( WVW_PBDESTROY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - UINT uiPBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - CONTROL_DATA * pcdPrev = NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT uiPBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + CONTROL_DATA * pcdPrev = NULL; - while (pcd) + while( pcd ) { - if (pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON && pcd->uiCtrlid == uiPBid) - { - break; - } - pcdPrev = pcd; - pcd = pcd->pNext; + if( pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON && pcd->uiCtrlid == uiPBid ) + { + break; + } + pcdPrev = pcd; + pcd = pcd->pNext; } - if (pcd==NULL) { return; } - - DestroyWindow (pcd->hWndCtrl) ; - - if (pcdPrev==NULL) + if( pcd == NULL ) { - pWindowData->pcdCtrlList = pcd->pNext; + return; + } + + DestroyWindow( pcd->hWndCtrl ); + + if( pcdPrev == NULL ) + { + pWindowData->pcdCtrlList = pcd->pNext; } else { - pcdPrev->pNext = pcd->pNext; + pcdPrev->pNext = pcd->pNext; } - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); @@ -198,151 +201,151 @@ HB_FUNC( WVW_PBDESTROY) } /*WVW_PBsetFocus( [nWinNum], nButtonId ) - *set the focus to button nButtonId in window nWinNum + *set the focus to button nButtonId in window nWinNum */ HB_FUNC( WVW_PBSETFOCUS ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - byte bStyle; - HWND hWndPB = FindControlHandle(usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + byte bStyle; + HWND hWndPB = FindControlHandle( usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle ); - if (hWndPB) - { + if( hWndPB ) + { - hb_retl( SetFocus(hWndPB) != NULL ); - } - else - { - hb_retl(FALSE); - } + hb_retl( SetFocus( hWndPB ) != NULL ); + } + else + { + hb_retl( FALSE ); + } } /*WVW_PBisFocused( [nWinNum], nPBid ) - *returns .t. if the focus is on button nPBid in window nWinNum + *returns .t. if the focus is on button nPBid in window nWinNum */ HB_FUNC( WVW_PBISFOCUSED ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - byte bStyle; - HWND hWndPB = FindControlHandle(usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + byte bStyle; + HWND hWndPB = FindControlHandle( usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle ); - hb_retl((HWND) GetFocus() == hWndPB); + hb_retl( ( HWND ) GetFocus() == hWndPB ); } /*WVW_PBenable( [nWinNum], nButtonId, [lToggle] ) - *enable/disable button nButtonId on window nWinNum - *(lToggle defaults to .t., ie. enabling the button) - *return previous state of the button (TRUE:enabled FALSE:disabled) - *(if nButtonId is invalid, this function returns FALSE too) + *enable/disable button nButtonId on window nWinNum + *(lToggle defaults to .t., ie. enabling the button) + *return previous state of the button (TRUE:enabled FALSE:disabled) + *(if nButtonId is invalid, this function returns FALSE too) */ HB_FUNC( WVW_PBENABLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - BOOL bEnable = HB_ISNIL(3) ? TRUE : hb_parl(3); - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - byte bStyle; - HWND hWndPB = FindControlHandle(usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + BOOL bEnable = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + byte bStyle; + HWND hWndPB = FindControlHandle( usWinNum, WVW_CONTROL_PUSHBUTTON, uiCtrlId, &bStyle ); - if (hWndPB) - { - hb_retl( EnableWindow(hWndPB, bEnable)==0 ); + if( hWndPB ) + { + hb_retl( EnableWindow( hWndPB, bEnable ) == 0 ); - if (!bEnable) - { - SetFocus( pWindowData->hWnd ); - } - } - else - { - hb_retl(FALSE); - } + if( ! bEnable ) + { + SetFocus( pWindowData->hWnd ); + } + } + else + { + hb_retl( FALSE ); + } } /*WVW_PBsetcodeblock( [nWinNum], nPBid, bBlock ) - *assign (new) codeblock bBlock to button nPBid for window nWinNum + *assign (new) codeblock bBlock to button nPBid for window nWinNum * * return .t. if successful */ HB_FUNC( WVW_PBSETCODEBLOCK ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WVW_DATA * pData= hb_getWvwData( ) ; - UINT uiPBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_PUSHBUTTON, NULL, uiPBid); - PHB_ITEM phiCodeBlock = hb_param( 3, HB_IT_BLOCK ); - BOOL bOldSetting = pData->s_bRecurseCBlock; + UINT usWinNum = WVW_WHICH_WINDOW; + WVW_DATA * pData = hb_getWvwData(); + UINT uiPBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_PUSHBUTTON, NULL, uiPBid ); + PHB_ITEM phiCodeBlock = hb_param( 3, HB_IT_BLOCK ); + BOOL bOldSetting = pData->s_bRecurseCBlock; - if (!phiCodeBlock || pcd==NULL || pcd->bBusy) + if( ! phiCodeBlock || pcd == NULL || pcd->bBusy ) { - /* - if (!HB_ISBLOCK(3)) - { - MessageBox( NULL, TEXT( "Codeblock Expected" ), - pData->szAppName, MB_ICONERROR ); - } + /* + if (!HB_ISBLOCK(3)) + { + MessageBox( NULL, TEXT( "Codeblock Expected" ), + pData->szAppName, MB_ICONERROR ); + } - if (pcd==NULL) - { - MessageBox( NULL, TEXT( "Control Data not Found" ), - pData->szAppName, MB_ICONERROR ); - } + if (pcd==NULL) + { + MessageBox( NULL, TEXT( "Control Data not Found" ), + pData->szAppName, MB_ICONERROR ); + } - if (pcd->bBusy) - { - MessageBox( NULL, TEXT( "Codeblock is busy" ), - pData->szAppName, MB_ICONERROR ); - } - */ + if (pcd->bBusy) + { + MessageBox( NULL, TEXT( "Codeblock is busy" ), + pData->szAppName, MB_ICONERROR ); + } + */ - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } pData->s_bRecurseCBlock = FALSE; - pcd->bBusy = TRUE; + pcd->bBusy = TRUE; - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); } - pcd->phiCodeBlock = hb_itemNew( phiCodeBlock ); + pcd->phiCodeBlock = hb_itemNew( phiCodeBlock ); - pcd->bBusy = FALSE; + pcd->bBusy = FALSE; pData->s_bRecurseCBlock = bOldSetting; hb_retl( TRUE ); } /*WVW_PBsetstyle( [nWinNum], nPBid, nStyle ) - *assign new style nStyle to button nPBid for window nWinNum - *typical usage: nStyle==BS_DEFPUSHBUTTON (==01) to turn the button + *assign new style nStyle to button nPBid for window nWinNum + *typical usage: nStyle==BS_DEFPUSHBUTTON (==01) to turn the button * into default push button * (thick border) * BS_PUSHBUTTON (==00) to turn the button * into regular push button * - *using other styles like BS_MULTILINE may also be usefull, - *but I haven't tried that + **using other styles like BS_MULTILINE may also be usefull, + **but I haven't tried that * * this function always return .t. */ HB_FUNC( WVW_PBSETSTYLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiPBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - ULONG ulStyle = (ULONG) ( HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ) ); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_PUSHBUTTON, NULL, uiPBid); + UINT uiPBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + ULONG ulStyle = ( ULONG ) ( HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ) ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_PUSHBUTTON, NULL, uiPBid ); - if (pcd->hWndCtrl) + if( pcd->hWndCtrl ) { - SendMessage(pcd->hWndCtrl, BM_SETSTYLE, (WPARAM) ulStyle, (LPARAM) TRUE); + SendMessage( pcd->hWndCtrl, BM_SETSTYLE, ( WPARAM ) ulStyle, ( LPARAM ) TRUE ); } hb_retl( TRUE ); @@ -351,55 +354,55 @@ HB_FUNC( WVW_PBSETSTYLE ) /*WVW_PBSetFont([nWinNum], cFontFace, nHeight, nWidth, nWeight, nQUality,; * lItalic, lUnderline, lStrikeout * - *this will initialize font for ALL pushbuttons in window nWinNum - *(including ones created later on) + **this will initialize font for ALL pushbuttons in window nWinNum + **(including ones created later on) */ HB_FUNC( WVW_PBSETFONT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WVW_DATA * pData= hb_getWvwData( ) ; - BOOL retval = TRUE; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * pData = hb_getWvwData(); + BOOL retval = TRUE; - pData->s_lfPB.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); - pData->s_lfPB.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfPB.lfWidth : hb_parni( 4 ); - pData->s_lfPB.lfEscapement = 0; - pData->s_lfPB.lfOrientation = 0; - pData->s_lfPB.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfPB.lfWeight : hb_parni( 5 ); - pData->s_lfPB.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfPB.lfItalic : ( BYTE )hb_parl( 7 ); - pData->s_lfPB.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfPB.lfUnderline : ( BYTE )hb_parl( 8 ); - pData->s_lfPB.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfPB.lfStrikeOut : ( BYTE )hb_parl( 9 ); - pData->s_lfPB.lfCharSet = DEFAULT_CHARSET; + pData->s_lfPB.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); + pData->s_lfPB.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfPB.lfWidth : hb_parni( 4 ); + pData->s_lfPB.lfEscapement = 0; + pData->s_lfPB.lfOrientation = 0; + pData->s_lfPB.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfPB.lfWeight : hb_parni( 5 ); + pData->s_lfPB.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfPB.lfItalic : ( BYTE ) hb_parl( 7 ); + pData->s_lfPB.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfPB.lfUnderline : ( BYTE ) hb_parl( 8 ); + pData->s_lfPB.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfPB.lfStrikeOut : ( BYTE ) hb_parl( 9 ); + pData->s_lfPB.lfCharSet = DEFAULT_CHARSET; - pData->s_lfPB.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfPB.lfQuality : ( BYTE )hb_parni( 6 ); - pData->s_lfPB.lfPitchAndFamily = FF_DONTCARE; - if ( HB_ISCHAR( 2 ) ) + pData->s_lfPB.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfPB.lfQuality : ( BYTE ) hb_parni( 6 ); + pData->s_lfPB.lfPitchAndFamily = FF_DONTCARE; + if( HB_ISCHAR( 2 ) ) { strcpy( pData->s_lfPB.lfFaceName, hb_parcx( 2 ) ); } - if (pWindowData->hPBfont) + if( pWindowData->hPBfont ) { HFONT hOldFont = pWindowData->hPBfont; - HFONT hFont = CreateFontIndirect( &pData->s_lfPB ); - if (hFont) + HFONT hFont = CreateFontIndirect( &pData->s_lfPB ); + if( hFont ) { CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) + while( pcd ) { - if ((pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON) && - ((HFONT) SendMessage( pcd->hWndCtrl, WM_GETFONT, (WPARAM) 0, (LPARAM) 0) == hOldFont) - ) - { - SendMessage( pcd->hWndCtrl, WM_SETFONT, (WPARAM) hFont, (LPARAM) TRUE); - } + if( ( pcd->byCtrlClass == WVW_CONTROL_PUSHBUTTON ) && + ( ( HFONT ) SendMessage( pcd->hWndCtrl, WM_GETFONT, ( WPARAM ) 0, ( LPARAM ) 0 ) == hOldFont ) + ) + { + SendMessage( pcd->hWndCtrl, WM_SETFONT, ( WPARAM ) hFont, ( LPARAM ) TRUE ); + } - pcd = pcd->pNext; + pcd = pcd->pNext; } pWindowData->hPBfont = hFont; - DeleteObject( (HFONT) hOldFont ); + DeleteObject( ( HFONT ) hOldFont ); } else @@ -422,13 +425,13 @@ HB_FUNC( WVW_PBSETFONT ) /*WVW_CBcreate( [nWinNum], nTop, nLeft, nWidth, aText, bBlock, nListLines, ; * nReserved, nKbdType, aOffset, hControl ) - *create combobox (drop-down list, no editbox) for window nWinNum - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nWidth: width of combobox (in character unit) - *aText: array of drop-down list members, default = {"empty"} + **create combobox (drop-down list, no editbox) for window nWinNum + **nTop: row of top/left corner (in character unit) + **nLeft: col of top/left corner (in character unit) + **nWidth: width of combobox (in character unit) + **aText: array of drop-down list members, default = {"empty"} * eg. {"yes","no"} - *bBlock: codeblock to execute on these events: + **bBlock: codeblock to execute on these events: * event=CBN_SELCHANGE(1): user changes selection (not executed if selection is changed programmatically) @@ -439,254 +442,257 @@ HB_FUNC( WVW_PBSETFONT ) * nCBid : combobox id * nType : event type (CBN_SELCHANGE/CBN_SETFOCUS/CBN_KILLFOCUS supported) * nIndex : index of the selected list item (0 based) - *nListLines: number of lines for list items, default = 3 + **nListLines: number of lines for list items, default = 3 * (will be automatically truncated if it's > len(aText)) - *nReserved: reserved for future (this parm is now ignored) + **nReserved: reserved for future (this parm is now ignored) * - *nKbdType: WVW_CB_KBD_STANDARD (0): similar to standard windows convention + **nKbdType: WVW_CB_KBD_STANDARD (0): similar to standard windows convention * ENTER/ESC: will kill focus from combobox * WVW_CB_KBD_CLIPPER (1): * ENTER: drop (show) the list box * UP/DOWN/TAB/SHIFTTAB/ESC: kill focus - *default is WVW_CB_KBD_STANDARD (0) + **default is WVW_CB_KBD_STANDARD (0) * - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust + **aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust * dimension of combobox. * defaults: {-2,-2,+2,+2} * NOTES: the third element (y2) is actually ignored. * height of combobox is always 1 char height * (see also wvw_cbSetFont()) * - *returns control id of newly created combobox of windows nWinNum - *returns 0 if failed + **returns control id of newly created combobox of windows nWinNum + **returns 0 if failed * - *example: + **example: */ -HB_FUNC( WVW_CBCREATE) +HB_FUNC( WVW_CBCREATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData =hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndParent = pWindowData->hWnd; - HWND hWndCB; - WVW_DATA * pData= hb_getWvwData( ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndParent = pWindowData->hWnd; + HWND hWndCB; + WVW_DATA * pData = hb_getWvwData(); // LONG cnt; - LONG numofchars; - LONG avgwidth; - LONG LongComboWidth,NewLongComboWidth; + LONG numofchars; + LONG avgwidth; + LONG LongComboWidth, NewLongComboWidth; // RECT r; - HFONT hFont = hb_gt_wvwGetFont( pWindowData->fontFace, 10, pWindowData->fontWidth, pWindowData->fontWeight, pWindowData->fontQuality, pWindowData->CodePage ); + HFONT hFont = hb_gt_wvwGetFont( pWindowData->fontFace, 10, pWindowData->fontWidth, pWindowData->fontWeight, pWindowData->fontQuality, pWindowData->CodePage ); - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; - UINT uiCBid; - USHORT usWidth = ( USHORT )hb_parni( 4 ); - USHORT usTop = ( USHORT )hb_parni( 2 ), - usLeft = ( USHORT )hb_parni( 3 ), - usBottom = usTop, - usRight = usLeft + usWidth - 1; - USHORT usNumElement = (USHORT) (HB_ISARRAY(5) ? hb_arrayLen( hb_param(5, HB_IT_ARRAY) ) : 0); - USHORT usListLines = (USHORT) (HB_ISNUM(7) ? hb_parni(7) : 3); - BYTE byCharHeight = hb_wvw_LineHeight(pWindowData); + UINT uiCBid; + USHORT usWidth = ( USHORT ) hb_parni( 4 ); + USHORT usTop = ( USHORT ) hb_parni( 2 ), + usLeft = ( USHORT ) hb_parni( 3 ), + usBottom = usTop, + usRight = usLeft + usWidth - 1; + USHORT usNumElement = ( USHORT ) ( HB_ISARRAY( 5 ) ? hb_arrayLen( hb_param( 5, HB_IT_ARRAY ) ) : 0 ); + USHORT usListLines = ( USHORT ) ( HB_ISNUM( 7 ) ? hb_parni( 7 ) : 3 ); + BYTE byCharHeight = hb_wvw_LineHeight( pWindowData ); /* in the future combobox type might be selectable by 8th parameter */ - int iStyle = CBS_DROPDOWNLIST | WS_VSCROLL; - BYTE bKbdType = HB_ISNUM(9) ? (BYTE)hb_parni(9) : (BYTE)WVW_CB_KBD_STANDARD; + int iStyle = CBS_DROPDOWNLIST | WS_VSCROLL; + BYTE bKbdType = HB_ISNUM( 9 ) ? ( BYTE ) hb_parni( 9 ) : ( BYTE ) WVW_CB_KBD_STANDARD; - if (pWindowData->hCBfont==NULL) + if( pWindowData->hCBfont == NULL ) { pWindowData->hCBfont = CreateFontIndirect( &pData->s_lfCB ); - if (pWindowData->hCBfont==NULL) + if( pWindowData->hCBfont == NULL ) { - hb_retnl(0); - return; + hb_retnl( 0 ); + return; } } LongComboWidth = 0; - iOffTop = !HB_ISNIL( 10 ) ? hb_parvni( 10,1 ) : 0; - iOffLeft = !HB_ISNIL( 10 ) ? hb_parvni( 10,2 ) : 0; + iOffTop = ! HB_ISNIL( 10 ) ? hb_parvni( 10, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 10 ) ? hb_parvni( 10, 2 ) : 0; - iOffBottom = usListLines; - iOffRight = !HB_ISNIL( 10 ) ? hb_parvni( 10,4 ) : 0; + iOffBottom = usListLines; + iOffRight = ! HB_ISNIL( 10 ) ? hb_parvni( 10, 4 ) : 0; - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop ; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - iBottom = xy.y - 1 + (iOffBottom * byCharHeight); - iRight = xy.x - 1 + iOffRight; + iBottom = xy.y - 1 + ( iOffBottom * byCharHeight ); + iRight = xy.x - 1 + iOffRight; - uiCBid = LastControlId(usWinNum, WVW_CONTROL_COMBOBOX); - if (uiCBid==0) + uiCBid = LastControlId( usWinNum, WVW_CONTROL_COMBOBOX ); + if( uiCBid == 0 ) { - uiCBid = WVW_ID_BASE_COMBOBOX; + uiCBid = WVW_ID_BASE_COMBOBOX; } else { - uiCBid++; + uiCBid++; } InitCommonControls(); hWndCB = CreateWindowEx( - 0L, - "COMBOBOX", - (LPSTR) NULL, - WS_CHILD | WS_VISIBLE | (DWORD) iStyle, - iLeft, - iTop, - iRight-iLeft+1, - iBottom-iTop+1, - hWndParent, - (HMENU) uiCBid, - hb_getWvwData()->hInstance, - (LPVOID) NULL - ); + 0L, + "COMBOBOX", + ( LPSTR ) NULL, + WS_CHILD | WS_VISIBLE | ( DWORD ) iStyle, + iLeft, + iTop, + iRight - iLeft + 1, + iBottom - iTop + 1, + hWndParent, + ( HMENU ) uiCBid, + hb_getWvwData()->hInstance, + ( LPVOID ) NULL + ); - if(hWndCB) + if( hWndCB ) { - RECT rXB = { 0 }, rOffXB = { 0 }; - WNDPROC OldProc; - USHORT i; - TCHAR szDefault[] = TEXT( "empty" ); + RECT rXB = { 0 }, rOffXB = { 0 }; + WNDPROC OldProc; + USHORT i; + TCHAR szDefault[] = TEXT( "empty" ); - SendMessage( - (HWND) hWndCB, - WM_SETREDRAW, - (WPARAM) TRUE, - (LPARAM) 0 - ); + SendMessage( + ( HWND ) hWndCB, + WM_SETREDRAW, + ( WPARAM ) TRUE, + ( LPARAM ) 0 + ); - if (usNumElement==0) - { - if (SendMessage((HWND) hWndCB, - CB_ADDSTRING, - (WPARAM) 0, - (LPARAM) (LPCTSTR) szDefault - ) < 0) - { - /* ignore failure */ - - } - } - else - { - for(i=1; i<=usNumElement; i++) - { - if (SendMessage((HWND) hWndCB, - CB_ADDSTRING, - (WPARAM) 0, - (LPARAM) (LPCTSTR) hb_parvcx( 5, i) - ) < 0) + if( usNumElement == 0 ) + { + if( SendMessage( ( HWND ) hWndCB, + CB_ADDSTRING, + ( WPARAM ) 0, + ( LPARAM ) ( LPCTSTR ) szDefault + ) < 0 ) { - /* ignore failure */ + /* ignore failure */ } - else + } + else + { + for( i = 1; i <= usNumElement; i++ ) { - numofchars =SendMessage((HWND) hWndCB,CB_GETLBTEXTLEN,i-1,0); - if ( numofchars > LongComboWidth ) - LongComboWidth=numofchars; + if( SendMessage( ( HWND ) hWndCB, + CB_ADDSTRING, + ( WPARAM ) 0, + ( LPARAM ) ( LPCTSTR ) hb_parvcx( 5, i ) + ) < 0 ) + { + /* ignore failure */ + } + else + { + numofchars = SendMessage( ( HWND ) hWndCB, CB_GETLBTEXTLEN, i - 1, 0 ); + if( numofchars > LongComboWidth ) + LongComboWidth = numofchars; + + } } - } - } + } - SendMessage( - (HWND) hWndCB, - CB_SETCURSEL, - (WPARAM) 0, - (LPARAM) 0 - ); + SendMessage( + ( HWND ) hWndCB, + CB_SETCURSEL, + ( WPARAM ) 0, + ( LPARAM ) 0 + ); - SendMessage( - (HWND) hWndCB, - CB_SETEXTENDEDUI, - (WPARAM) TRUE, - (LPARAM) 0 - ); - avgwidth =GetFontDialogUnits(hWndParent,hFont); - NewLongComboWidth = (LongComboWidth -2) *avgwidth; - SendMessage( - (HWND) hWndCB, - CB_SETDROPPEDWIDTH, - (WPARAM) NewLongComboWidth+100,//LongComboWidth+100 - (LPARAM) 0 - ); + SendMessage( + ( HWND ) hWndCB, + CB_SETEXTENDEDUI, + ( WPARAM ) TRUE, + ( LPARAM ) 0 + ); + avgwidth = GetFontDialogUnits( hWndParent, hFont ); + NewLongComboWidth = ( LongComboWidth - 2 ) * avgwidth; + SendMessage( + ( HWND ) hWndCB, + CB_SETDROPPEDWIDTH, + ( WPARAM ) NewLongComboWidth + 100, //LongComboWidth+100 + ( LPARAM ) 0 + ); - rXB.top = usTop; rXB.left= usLeft; - rXB.bottom=usBottom; rXB.right =usRight; - rOffXB.top = iOffTop; rOffXB.left= iOffLeft; + rXB.top = usTop; rXB.left = usLeft; + rXB.bottom = usBottom; rXB.right = usRight; + rOffXB.top = iOffTop; rOffXB.left = iOffLeft; - rOffXB.bottom=iOffBottom; rOffXB.right =iOffRight; + rOffXB.bottom = iOffBottom; rOffXB.right = iOffRight; - AddControlHandle(usWinNum, WVW_CONTROL_COMBOBOX, hWndCB, uiCBid, (PHB_ITEM) hb_param( 6, HB_IT_BLOCK ), rXB, rOffXB, (byte) bKbdType); + AddControlHandle( usWinNum, WVW_CONTROL_COMBOBOX, hWndCB, uiCBid, ( PHB_ITEM ) hb_param( 6, HB_IT_BLOCK ), rXB, rOffXB, ( byte ) bKbdType ); - OldProc = (WNDPROC) SetWindowLongPtr (hWndCB, - GWLP_WNDPROC, (LONG_PTR) hb_gt_wvwCBProc) ; + OldProc = ( WNDPROC ) SetWindowLongPtr( hWndCB, + GWLP_WNDPROC, ( LONG_PTR ) hb_gt_wvwCBProc ); - StoreControlProc(usWinNum, WVW_CONTROL_COMBOBOX, hWndCB, OldProc); + StoreControlProc( usWinNum, WVW_CONTROL_COMBOBOX, hWndCB, OldProc ); - SendMessage( hWndCB, WM_SETFONT, (WPARAM) pWindowData->hCBfont, (LPARAM) TRUE); - hb_stornl((LONG)hWndCB,11); + SendMessage( hWndCB, WM_SETFONT, ( WPARAM ) pWindowData->hCBfont, ( LPARAM ) TRUE ); + hb_stornl( ( LONG ) hWndCB, 11 ); - hb_retnl( (LONG) uiCBid ); + hb_retnl( ( LONG ) uiCBid ); } else { - hb_retnl( (LONG) 0 ); + hb_retnl( ( LONG ) 0 ); } } /*WVW_CBdestroy( [nWinNum], nCBid ) - *destroy combobox nCBid for window nWinNum + *destroy combobox nCBid for window nWinNum */ -HB_FUNC( WVW_CBDESTROY) +HB_FUNC( WVW_CBDESTROY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData =hb_gt_wvw_GetWindowsData( usWinNum ); - UINT uiCBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - CONTROL_DATA * pcdPrev = (CONTROL_DATA *) NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT uiCBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + CONTROL_DATA * pcdPrev = ( CONTROL_DATA * ) NULL; - while (pcd) + while( pcd ) { - if (pcd->byCtrlClass == WVW_CONTROL_COMBOBOX && pcd->uiCtrlid == uiCBid) - { - break; - } + if( pcd->byCtrlClass == WVW_CONTROL_COMBOBOX && pcd->uiCtrlid == uiCBid ) + { + break; + } - pcdPrev = pcd; - pcd = pcd->pNext; + pcdPrev = pcd; + pcd = pcd->pNext; } - if (pcd==NULL) { return; } - - DestroyWindow (pcd->hWndCtrl) ; - - if (pcdPrev==NULL) + if( pcd == NULL ) { - pWindowData->pcdCtrlList = pcd->pNext; + return; + } + + DestroyWindow( pcd->hWndCtrl ); + + if( pcdPrev == NULL ) + { + pWindowData->pcdCtrlList = pcd->pNext; } else { - pcdPrev->pNext = pcd->pNext; + pcdPrev->pNext = pcd->pNext; } - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); @@ -696,102 +702,102 @@ HB_FUNC( WVW_CBDESTROY) } /*WVW_CBsetFocus( [nWinNum], nComboId ) - *set the focus to combobox nComboId in window nWinNum + *set the focus to combobox nComboId in window nWinNum */ HB_FUNC( WVW_CBSETFOCUS ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - byte bStyle; - HWND hWndCB = FindControlHandle(usWinNum, WVW_CONTROL_COMBOBOX, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + byte bStyle; + HWND hWndCB = FindControlHandle( usWinNum, WVW_CONTROL_COMBOBOX, uiCtrlId, &bStyle ); - if (hWndCB) - { + if( hWndCB ) + { - hb_retl( SetFocus(hWndCB) != NULL ); - } - else - { - hb_retl(FALSE); - } + hb_retl( SetFocus( hWndCB ) != NULL ); + } + else + { + hb_retl( FALSE ); + } } /*WVW_CBisFocused( [nWinNum], nComboId ) - *returns .t. if the focus is on combobox nComboId in window nWinNum + *returns .t. if the focus is on combobox nComboId in window nWinNum */ HB_FUNC( WVW_CBISFOCUSED ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - byte bStyle; - HWND hWndCB = FindControlHandle(usWinNum, WVW_CONTROL_COMBOBOX, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + byte bStyle; + HWND hWndCB = FindControlHandle( usWinNum, WVW_CONTROL_COMBOBOX, uiCtrlId, &bStyle ); - hb_retl((HWND) GetFocus() == hWndCB); + hb_retl( ( HWND ) GetFocus() == hWndCB ); } /*WVW_CBenable( [nWinNum], nComboId, [lEnable] ) - *enable/disable button nComboId on window nWinNum - *(lEnable defaults to .t., ie. enabling the combobox) - *return previous state of the combobox (TRUE:enabled FALSE:disabled) - *(if nComboId is invalid, this function returns FALSE too) + *enable/disable button nComboId on window nWinNum + *(lEnable defaults to .t., ie. enabling the combobox) + *return previous state of the combobox (TRUE:enabled FALSE:disabled) + *(if nComboId is invalid, this function returns FALSE too) */ HB_FUNC( WVW_CBENABLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCtrlId = HB_ISNIL(2) ? 0 : hb_parni(2); - BOOL bEnable = HB_ISNIL(3) ? TRUE : hb_parl(3); - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - byte bStyle; - HWND hWndCB = FindControlHandle(usWinNum, WVW_CONTROL_COMBOBOX, uiCtrlId, &bStyle); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiCtrlId = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); + BOOL bEnable = HB_ISNIL( 3 ) ? TRUE : hb_parl( 3 ); + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + byte bStyle; + HWND hWndCB = FindControlHandle( usWinNum, WVW_CONTROL_COMBOBOX, uiCtrlId, &bStyle ); - if (hWndCB) - { - hb_retl( EnableWindow(hWndCB, bEnable)==0 ); + if( hWndCB ) + { + hb_retl( EnableWindow( hWndCB, bEnable ) == 0 ); - if (!bEnable) - { - SetFocus( pWindowData->hWnd ); - } - } - else - { - hb_retl(FALSE); - } + if( ! bEnable ) + { + SetFocus( pWindowData->hWnd ); + } + } + else + { + hb_retl( FALSE ); + } } /*WVW_CBsetcodeblock( [nWinNum], nCBid, bBlock ) - *assign (new) codeblock bBlock to combobox nCBid for window nWinNum + *assign (new) codeblock bBlock to combobox nCBid for window nWinNum * * return .t. if successful */ HB_FUNC( WVW_CBSETCODEBLOCK ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid); - PHB_ITEM phiCodeBlock = hb_param( 3, HB_IT_BLOCK ); - WVW_DATA * pData= hb_getWvwData( ) ; - BOOL bOldSetting = pData->s_bRecurseCBlock; + UINT uiCBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid ); + PHB_ITEM phiCodeBlock = hb_param( 3, HB_IT_BLOCK ); + WVW_DATA * pData = hb_getWvwData(); + BOOL bOldSetting = pData->s_bRecurseCBlock; - if (!phiCodeBlock || pcd==NULL || pcd->bBusy) + if( ! phiCodeBlock || pcd == NULL || pcd->bBusy ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } pData->s_bRecurseCBlock = FALSE; - pcd->bBusy = TRUE; + pcd->bBusy = TRUE; - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); } - pcd->phiCodeBlock = hb_itemNew( phiCodeBlock ); + pcd->phiCodeBlock = hb_itemNew( phiCodeBlock ); - pcd->bBusy = FALSE; + pcd->bBusy = FALSE; pData->s_bRecurseCBlock = bOldSetting; hb_retl( TRUE ); @@ -800,59 +806,59 @@ HB_FUNC( WVW_CBSETCODEBLOCK ) /*WVW_CBSetFont([nWinNum], cFontFace, nHeight, nWidth, nWeight, nQUality,; * lItalic, lUnderline, lStrikeout * - *this will initialize font for ALL comboboxes in window nWinNum - *(including ones created later on) + **this will initialize font for ALL comboboxes in window nWinNum + **(including ones created later on) * - *TODO: ? should nHeight be ignored, and always forced to use standard char height? + **TODO: ? should nHeight be ignored, and always forced to use standard char height? */ HB_FUNC( WVW_CBSETFONT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData =hb_gt_wvw_GetWindowsData( usWinNum ); - WVW_DATA * pData= hb_getWvwData( ) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * pData = hb_getWvwData(); - BOOL retval = TRUE; + BOOL retval = TRUE; - pData->s_lfCB.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); - pData->s_lfCB.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfCB.lfWidth : hb_parni( 4 ); - pData->s_lfCB.lfEscapement = 0; - pData->s_lfCB.lfOrientation = 0; - pData->s_lfCB.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfCB.lfWeight : hb_parni( 5 ); - pData->s_lfCB.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfCB.lfItalic : ( BYTE )hb_parl( 7 ); - pData->s_lfCB.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfCB.lfUnderline : ( BYTE )hb_parl( 8 ); - pData->s_lfCB.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfCB.lfStrikeOut : ( BYTE )hb_parl( 9 ); - pData->s_lfCB.lfCharSet = DEFAULT_CHARSET; + pData->s_lfCB.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); + pData->s_lfCB.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfCB.lfWidth : hb_parni( 4 ); + pData->s_lfCB.lfEscapement = 0; + pData->s_lfCB.lfOrientation = 0; + pData->s_lfCB.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfCB.lfWeight : hb_parni( 5 ); + pData->s_lfCB.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfCB.lfItalic : ( BYTE ) hb_parl( 7 ); + pData->s_lfCB.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfCB.lfUnderline : ( BYTE ) hb_parl( 8 ); + pData->s_lfCB.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfCB.lfStrikeOut : ( BYTE ) hb_parl( 9 ); + pData->s_lfCB.lfCharSet = DEFAULT_CHARSET; - pData->s_lfCB.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfCB.lfQuality : ( BYTE )hb_parni( 6 ); - pData->s_lfCB.lfPitchAndFamily = FF_DONTCARE; - if ( HB_ISCHAR( 2 ) ) + pData->s_lfCB.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfCB.lfQuality : ( BYTE ) hb_parni( 6 ); + pData->s_lfCB.lfPitchAndFamily = FF_DONTCARE; + if( HB_ISCHAR( 2 ) ) { strcpy( pData->s_lfCB.lfFaceName, hb_parcx( 2 ) ); } - if (pWindowData->hCBfont) + if( pWindowData->hCBfont ) { HFONT hOldFont = pWindowData->hCBfont; - HFONT hFont = CreateFontIndirect( &pData->s_lfCB ); - if (hFont) + HFONT hFont = CreateFontIndirect( &pData->s_lfCB ); + if( hFont ) { CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - while (pcd) + while( pcd ) { - if ((pcd->byCtrlClass == WVW_CONTROL_COMBOBOX) && - ((HFONT) SendMessage( pcd->hWndCtrl, WM_GETFONT, (WPARAM) 0, (LPARAM) 0) == hOldFont) - ) - { - SendMessage( pcd->hWndCtrl, WM_SETFONT, (WPARAM) hFont, (LPARAM) TRUE); + if( ( pcd->byCtrlClass == WVW_CONTROL_COMBOBOX ) && + ( ( HFONT ) SendMessage( pcd->hWndCtrl, WM_GETFONT, ( WPARAM ) 0, ( LPARAM ) 0 ) == hOldFont ) + ) + { + SendMessage( pcd->hWndCtrl, WM_SETFONT, ( WPARAM ) hFont, ( LPARAM ) TRUE ); - } + } - pcd = pcd->pNext; + pcd = pcd->pNext; } pWindowData->hCBfont = hFont; - DeleteObject( (HFONT) hOldFont ); + DeleteObject( ( HFONT ) hOldFont ); } else @@ -866,44 +872,44 @@ HB_FUNC( WVW_CBSETFONT ) } /*WVW_CBsetIndex( [nWinNum], nCBid, nIndex ) - *set current selection of combobox nCBid in window nWinNum to nIndex - *(nIndex is 0 based) - *returns .t. if successful. + *set current selection of combobox nCBid in window nWinNum to nIndex + *(nIndex is 0 based) + *returns .t. if successful. * - *NOTE: the better name to this function should be WVW_CBsetCurSel() + **NOTE: the better name to this function should be WVW_CBsetCurSel() * but that name is already used. * (WVW_CBsetcursel() and WVW_CBaddstring() is NOT related to other * WVW_CB* functions) */ HB_FUNC( WVW_CBSETINDEX ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCBid = hb_parni(2); - int iIndex = hb_parni(3); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid); - BOOL retval; + UINT uiCBid = hb_parni( 2 ); + int iIndex = hb_parni( 3 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid ); + BOOL retval; - if (pcd==NULL || iIndex < 0) + if( pcd == NULL || iIndex < 0 ) { - hb_retl(FALSE); - return; + hb_retl( FALSE ); + return; } - retval = (SendMessage((HWND) pcd->hWndCtrl, - CB_SETCURSEL, - (WPARAM) iIndex, - (LPARAM) 0 - )==iIndex); - hb_retl(retval); + retval = ( SendMessage( ( HWND ) pcd->hWndCtrl, + CB_SETCURSEL, + ( WPARAM ) iIndex, + ( LPARAM ) 0 + ) == iIndex ); + hb_retl( retval ); } /*WVW_CBgetIndex( [nWinNum], nCBid ) - *get current selection of combobox nCBid in window nWinNum - *return nIndex (0 based) - *returns CB_ERR (-1) if none selected + *get current selection of combobox nCBid in window nWinNum + *return nIndex (0 based) + *returns CB_ERR (-1) if none selected * - *NOTE: the better name to this function should be WVW_CBgetCurSel() + **NOTE: the better name to this function should be WVW_CBgetCurSel() * but that name is potentially misleading to WVW_CBsetCursel * which is not our family of WVW_CB* functions * (WVW_CBsetcursel() and WVW_CBaddstring() is NOT related to other @@ -911,132 +917,132 @@ HB_FUNC( WVW_CBSETINDEX ) */ HB_FUNC( WVW_CBGETINDEX ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCBid = hb_parni(2); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid); - int retval; + UINT uiCBid = hb_parni( 2 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid ); + int retval; - if (pcd==NULL) + if( pcd == NULL ) { - hb_retni(CB_ERR); - return; + hb_retni( CB_ERR ); + return; } - retval = SendMessage((HWND) pcd->hWndCtrl, - CB_GETCURSEL, - (WPARAM) 0, - (LPARAM) 0 - ); - hb_retni(retval); + retval = SendMessage( ( HWND ) pcd->hWndCtrl, + CB_GETCURSEL, + ( WPARAM ) 0, + ( LPARAM ) 0 + ); + hb_retni( retval ); } /*WVW_CBfindString( [nWinNum], nCBid, cString ) - *find index of cString in combobox nCBid in window nWinNum - *returns index of cString (0 based) - *returns CB_ERR (-1) if string not found + *find index of cString in combobox nCBid in window nWinNum + *returns index of cString (0 based) + *returns CB_ERR (-1) if string not found * - *NOTE:case insensitive + **NOTE:case insensitive */ HB_FUNC( WVW_CBFINDSTRING ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCBid = hb_parni(2); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid); - int retval; + UINT uiCBid = hb_parni( 2 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid ); + int retval; - if (pcd==NULL) + if( pcd == NULL ) { - hb_retni(CB_ERR); - return; + hb_retni( CB_ERR ); + return; } - retval = SendMessage((HWND) pcd->hWndCtrl, + retval = SendMessage( ( HWND ) pcd->hWndCtrl, CB_FINDSTRING, - (WPARAM) -1, - (LPARAM) (LPCSTR) hb_parcx(3) + ( WPARAM ) -1, + ( LPARAM ) ( LPCSTR ) hb_parcx( 3 ) ); - hb_retni(retval); + hb_retni( retval ); } /*WVW_cbGetCurText( [nWinNum], nCBid ) - *get current selected cString in combobox nCBid in window nWinNum - *returns "" if none selected + *get current selected cString in combobox nCBid in window nWinNum + *returns "" if none selected * */ HB_FUNC( WVW_CBGETCURTEXT ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCBid = hb_parni(2); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid); - int iCurSel,iTextLen; - LPTSTR lptstr = NULL; + UINT uiCBid = hb_parni( 2 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid ); + int iCurSel, iTextLen; + LPTSTR lptstr = NULL; - if (pcd==NULL) + if( pcd == NULL ) { - hb_retclen(lptstr,0); - return; + hb_retclen( lptstr, 0 ); + return; } - iCurSel = SendMessage((HWND) pcd->hWndCtrl, - CB_GETCURSEL, - (WPARAM) 0, - (LPARAM) 0 - ); - iTextLen = SendMessage((HWND) pcd->hWndCtrl, - CB_GETLBTEXTLEN, - (WPARAM) iCurSel, - (LPARAM) 0 + iCurSel = SendMessage( ( HWND ) pcd->hWndCtrl, + CB_GETCURSEL, + ( WPARAM ) 0, + ( LPARAM ) 0 ); - if (iTextLen==CB_ERR) + iTextLen = SendMessage( ( HWND ) pcd->hWndCtrl, + CB_GETLBTEXTLEN, + ( WPARAM ) iCurSel, + ( LPARAM ) 0 + ); + if( iTextLen == CB_ERR ) { - hb_retclen(lptstr, 0); - return; + hb_retclen( lptstr, 0 ); + return; } - lptstr = ( char* ) hb_xgrab( iTextLen+1 ); - if (SendMessage((HWND) pcd->hWndCtrl, - CB_GETLBTEXT, - (WPARAM) iCurSel, - (LPARAM) lptstr - )==CB_ERR) + lptstr = ( char * ) hb_xgrab( iTextLen + 1 ); + if( SendMessage( ( HWND ) pcd->hWndCtrl, + CB_GETLBTEXT, + ( WPARAM ) iCurSel, + ( LPARAM ) lptstr + ) == CB_ERR ) { - hb_retclen(lptstr, 0); + hb_retclen( lptstr, 0 ); } else { - hb_retc(lptstr); + hb_retc( lptstr ); } hb_xfree( lptstr ); } /*WVW_cbIsDropped( [nWinNum], nCBid ) - *get current dropped state of combobox nCBid in window nWinNum - *returns .t. if listbox is being shown, otherwise .f. - *Also returns .f. if nCBid not valid + *get current dropped state of combobox nCBid in window nWinNum + *returns .t. if listbox is being shown, otherwise .f. + *Also returns .f. if nCBid not valid */ HB_FUNC( WVW_CBISDROPPED ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiCBid = hb_parni(2); - CONTROL_DATA * pcd = GetControlData(usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid); - BOOL bDropped; + UINT uiCBid = hb_parni( 2 ); + CONTROL_DATA * pcd = GetControlData( usWinNum, WVW_CONTROL_COMBOBOX, NULL, uiCBid ); + BOOL bDropped; - if (pcd==NULL) + if( pcd == NULL ) { - hb_retl(FALSE); + hb_retl( FALSE ); return; } - bDropped = SendMessage( (HWND) pcd->hWndCtrl, + bDropped = SendMessage( ( HWND ) pcd->hWndCtrl, CB_GETDROPPEDSTATE, - (WPARAM) 0, - (LPARAM) 0 - ); - hb_retl(bDropped); + ( WPARAM ) 0, + ( LPARAM ) 0 + ); + hb_retl( bDropped ); } diff --git a/harbour/extras/gtwvw/wvwstbar.c b/harbour/extras/gtwvw/wvwstbar.c index 851e9f2a8f..cf01c98a14 100644 --- a/harbour/extras/gtwvw/wvwstbar.c +++ b/harbour/extras/gtwvw/wvwstbar.c @@ -82,287 +82,288 @@ /*WVW_SBcreate( [nWinNum] ) - *create status bar for window nWinNum, with one part. - *returns handle to status bar of windows nWinNum - *returns 0 if failed, eg. if there is already a status bar for this window + *create status bar for window nWinNum, with one part. + *returns handle to status bar of windows nWinNum + *returns 0 if failed, eg. if there is already a status bar for this window */ -HB_FUNC( WVW_SBCREATE) +HB_FUNC( WVW_SBCREATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndParent; - HWND hWndSB; - WVW_DATA * pData= hb_getWvwData( ) ; - int ptArray[WVW_MAX_STATUS_PARTS]; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndParent; + HWND hWndSB; + WVW_DATA * pData = hb_getWvwData(); + int ptArray[ WVW_MAX_STATUS_PARTS ]; - if (!(pWindowData->hStatusBar==NULL)) + if( ! ( pWindowData->hStatusBar == NULL ) ) { - hb_retnl( 0 ); - return; + hb_retnl( 0 ); + return; } - hWndParent = pWindowData->hWnd; - hWndSB = CreateStatusWindow(WS_CHILD | WS_VISIBLE | WS_BORDER | SBT_TOOLTIPS , - NULL, - hWndParent, - WVW_ID_BASE_STATUSBAR+usWinNum); - if(hWndSB) + hWndParent = pWindowData->hWnd; + hWndSB = CreateStatusWindow( WS_CHILD | WS_VISIBLE | WS_BORDER | SBT_TOOLTIPS, + NULL, + hWndParent, + WVW_ID_BASE_STATUSBAR + usWinNum ); + if( hWndSB ) { - RECT rSB = { 0 }; - if (pWindowData->hSBfont==NULL) - { - pWindowData->hSBfont = CreateFontIndirect( &pData->s_lfSB ); - } - if (GetClientRect(hWndSB, &rSB)) - { - pWindowData->usSBHeight = (USHORT) rSB.bottom; - } - pWindowData->hStatusBar = hWndSB; + RECT rSB = { 0 }; + if( pWindowData->hSBfont == NULL ) + { + pWindowData->hSBfont = CreateFontIndirect( &pData->s_lfSB ); + } + if( GetClientRect( hWndSB, &rSB ) ) + { + pWindowData->usSBHeight = ( USHORT ) rSB.bottom; + } + pWindowData->hStatusBar = hWndSB; - hb_gt_wvwResetWindow( usWinNum ); + hb_gt_wvwResetWindow( usWinNum ); - ptArray[0] = rSB.right; - SendMessage( hWndSB, WM_SETFONT, (WPARAM) pWindowData->hSBfont, (LPARAM) TRUE); + ptArray[ 0 ] = rSB.right; + SendMessage( hWndSB, WM_SETFONT, ( WPARAM ) pWindowData->hSBfont, ( LPARAM ) TRUE ); - SendMessage(hWndSB, SB_SETPARTS, 1, (LPARAM)(LPINT)ptArray); + SendMessage( hWndSB, SB_SETPARTS, 1, ( LPARAM ) ( LPINT ) ptArray ); } - hb_retnl ( (LONG) hWndSB ); + hb_retnl( ( LONG ) hWndSB ); } /*WVW_SBdestroy( [nWinNum] ) - *destroy status bar for window nWinNum + *destroy status bar for window nWinNum */ -HB_FUNC( WVW_SBDESTROY) +HB_FUNC( WVW_SBDESTROY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (!(pWindowData->hStatusBar==NULL)) + if( ! ( pWindowData->hStatusBar == NULL ) ) { - if ( pWindowData->hSBfont ) - { - DeleteObject( ( HFONT ) pWindowData->hSBfont ); - pWindowData->hSBfont = NULL; - } - DestroyWindow( pWindowData->hStatusBar ); - pWindowData->hStatusBar = NULL; - pWindowData->bSBPaint = FALSE; - pWindowData->usSBHeight = 0; + if( pWindowData->hSBfont ) + { + DeleteObject( ( HFONT ) pWindowData->hSBfont ); + pWindowData->hSBfont = NULL; + } + DestroyWindow( pWindowData->hStatusBar ); + pWindowData->hStatusBar = NULL; + pWindowData->bSBPaint = FALSE; + pWindowData->usSBHeight = 0; - hb_gt_wvwResetWindow( usWinNum ); + hb_gt_wvwResetWindow( usWinNum ); } } /*WVW_SBaddPart(nWinNum, cMaxText, nWidth, nStyle, lResetParts, [cIcon , cToolTip]) - *ps. - *lResetParts==.t. :: remove all previously created parts - *nStyle: 0 (default), 0x0200 (SBT_POPOUT), 0x0100 (SBT_NOBORDERS) - *nWidth: expected width in pixels - *NOTE: if cMaxText is passed, nWidth is ignored. width of cMaxText will be used instead - *NOTE: the leftmost part will eventually have width of remaining spaces - *NOTE: cIcon and cToolTip does not work currently + *ps. + *lResetParts==.t. :: remove all previously created parts + *nStyle: 0 (default), 0x0200 (SBT_POPOUT), 0x0100 (SBT_NOBORDERS) + *nWidth: expected width in pixels + *NOTE: if cMaxText is passed, nWidth is ignored. width of cMaxText will be used instead + *NOTE: the leftmost part will eventually have width of remaining spaces + *NOTE: cIcon and cToolTip does not work currently * - *returns number of parts - *returns 0 if failed + **returns number of parts + **returns 0 if failed */ -HB_FUNC (WVW_SBADDPART) +HB_FUNC( WVW_SBADDPART ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndSB; - int ptArray[WVW_MAX_STATUS_PARTS]; - int numOfParts; - int n ; - RECT rSB = { 0 }; - WORD displayFlags; - HICON hIcon; - BOOL lResetParts; - USHORT usWidth; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndSB; + int ptArray[ WVW_MAX_STATUS_PARTS ]; + int numOfParts; + int n; + RECT rSB = { 0 }; + WORD displayFlags; + HICON hIcon; + BOOL lResetParts; + USHORT usWidth; hWndSB = pWindowData->hStatusBar; - if (hWndSB==NULL) + if( hWndSB == NULL ) { - hb_retnl( 0 ); - return; + hb_retnl( 0 ); + return; } - displayFlags = HB_ISNIL(4) ? 0 : (WORD) hb_parnl(4); - lResetParts = !HB_ISNIL(5) && hb_parl(5); - usWidth = HB_ISNIL(3) || hb_parni(3) <= 0 ? 5*WVW_SPACE_BETWEEN_PARTS : (USHORT) hb_parni(3); + displayFlags = HB_ISNIL( 4 ) ? 0 : ( WORD ) hb_parnl( 4 ); + lResetParts = ! HB_ISNIL( 5 ) && hb_parl( 5 ); + usWidth = HB_ISNIL( 3 ) || hb_parni( 3 ) <= 0 ? 5 * WVW_SPACE_BETWEEN_PARTS : ( USHORT ) hb_parni( 3 ); - if (HB_ISCHAR(2)) + if( HB_ISCHAR( 2 ) ) { - HDC hDCSB = GetDC(hWndSB); - SIZE size = { 0 }; + HDC hDCSB = GetDC( hWndSB ); + SIZE size = { 0 }; - HFONT hFont = (HFONT) SendMessage( hWndSB, WM_GETFONT, (WPARAM) 0, (LPARAM) 0); - HFONT hOldFont = ( HFONT ) SelectObject( hDCSB, hFont ); + HFONT hFont = ( HFONT ) SendMessage( hWndSB, WM_GETFONT, ( WPARAM ) 0, ( LPARAM ) 0 ); + HFONT hOldFont = ( HFONT ) SelectObject( hDCSB, hFont ); - if (GetTextExtentPoint32(hDCSB, hb_parcx(2), hb_parclen(2)+1, &size)) - { - usWidth = (USHORT) size.cx; - } + if( GetTextExtentPoint32( hDCSB, hb_parcx( 2 ), hb_parclen( 2 ) + 1, &size ) ) + { + usWidth = ( USHORT ) size.cx; + } - SelectObject( hDCSB, hOldFont ); + SelectObject( hDCSB, hOldFont ); - ReleaseDC(hWndSB, hDCSB); + ReleaseDC( hWndSB, hDCSB ); } - if ( !lResetParts ) + if( ! lResetParts ) { - numOfParts = SendMessage(hWndSB,SB_GETPARTS, WVW_MAX_STATUS_PARTS , (LPARAM)(LPINT)ptArray); + numOfParts = SendMessage( hWndSB, SB_GETPARTS, WVW_MAX_STATUS_PARTS, ( LPARAM ) ( LPINT ) ptArray ); } else { - numOfParts = 0; + numOfParts = 0; } - numOfParts ++ ; + numOfParts++; - GetClientRect(hWndSB, &rSB); + GetClientRect( hWndSB, &rSB ); - ptArray[numOfParts-1] = rSB.right; - if (!lResetParts) + ptArray[ numOfParts - 1 ] = rSB.right; + if( ! lResetParts ) { - for ( n=0; n < numOfParts-1; n++) - { - ptArray[n] -= (usWidth + WVW_SPACE_BETWEEN_PARTS); - } + for( n = 0; n < numOfParts - 1; n++ ) + { + ptArray[ n ] -= ( usWidth + WVW_SPACE_BETWEEN_PARTS ); + } } - SendMessage(hWndSB, SB_SETPARTS, numOfParts,(LPARAM)(LPINT)ptArray); + SendMessage( hWndSB, SB_SETPARTS, numOfParts, ( LPARAM ) ( LPINT ) ptArray ); - if (!HB_ISNIL(6)) + if( ! HB_ISNIL( 6 ) ) { - int cy = rSB.bottom - rSB.top - 4; - int cx = cy; + int cy = rSB.bottom - rSB.top - 4; + int cx = cy; - hIcon = (HICON) LoadImage(0, hb_parcx(6), IMAGE_ICON, cx, cy, LR_LOADFROMFILE | LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT | LR_DEFAULTSIZE); + hIcon = ( HICON ) LoadImage( 0, hb_parcx( 6 ), IMAGE_ICON, cx, cy, LR_LOADFROMFILE | LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT | LR_DEFAULTSIZE ); - if (hIcon==NULL) - { - hIcon = (HICON) LoadImage(GetModuleHandle(NULL), hb_parcx(6), IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR | LR_DEFAULTSIZE); - } + if( hIcon == NULL ) + { + hIcon = ( HICON ) LoadImage( GetModuleHandle( NULL ), hb_parcx( 6 ), IMAGE_ICON, cx, cy, LR_DEFAULTCOLOR | LR_DEFAULTSIZE ); + } - if (!(hIcon==NULL)) - { - SendMessage(hWndSB, SB_SETICON, (WPARAM) numOfParts-1, (LPARAM) hIcon); - } + if( ! ( hIcon == NULL ) ) + { + SendMessage( hWndSB, SB_SETICON, ( WPARAM ) numOfParts - 1, ( LPARAM ) hIcon ); + } } - SendMessage(hWndSB, SB_SETTEXT, (numOfParts-1) | displayFlags, (LPARAM) NULL); - if (!HB_ISNIL(7)) + SendMessage( hWndSB, SB_SETTEXT, ( numOfParts - 1 ) | displayFlags, ( LPARAM ) NULL ); + if( ! HB_ISNIL( 7 ) ) { - SendMessage(hWndSB, SB_SETTIPTEXT, (WPARAM) (numOfParts-1), (LPARAM) hb_parcx(7)); + SendMessage( hWndSB, SB_SETTIPTEXT, ( WPARAM ) ( numOfParts - 1 ), ( LPARAM ) hb_parcx( 7 ) ); } hb_retni( numOfParts ); } /*WVW_SBrefresh(nWinNum) - *reinitialize StatusBar's parts, eg. after window resize - *TODO: do it automatically, after hb_gt_wvwResetWindowSize() - *returns number of parts - *returns 0 if failed + *reinitialize StatusBar's parts, eg. after window resize + *TODO: do it automatically, after hb_gt_wvwResetWindowSize() + *returns number of parts + *returns 0 if failed */ -HB_FUNC (WVW_SBREFRESH) +HB_FUNC( WVW_SBREFRESH ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndSB; - int ptArray[WVW_MAX_STATUS_PARTS]; - int numOfParts; - int n ; - int iDiff; - RECT rSB = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndSB; + int ptArray[ WVW_MAX_STATUS_PARTS ]; + int numOfParts; + int n; + int iDiff; + RECT rSB = { 0 }; hWndSB = pWindowData->hStatusBar; - if (hWndSB==NULL) + if( hWndSB == NULL ) { - hb_retnl( 0 ); - return; + hb_retnl( 0 ); + return; } - numOfParts = SendMessage(hWndSB,SB_GETPARTS, WVW_MAX_STATUS_PARTS , (LPARAM)(LPINT)ptArray); - if (numOfParts==0) + numOfParts = SendMessage( hWndSB, SB_GETPARTS, WVW_MAX_STATUS_PARTS, ( LPARAM ) ( LPINT ) ptArray ); + if( numOfParts == 0 ) { - hb_retnl( 0 ); - return; + hb_retnl( 0 ); + return; } - GetClientRect(hWndSB, &rSB); - iDiff = rSB.right - ptArray[numOfParts-1]; + GetClientRect( hWndSB, &rSB ); + iDiff = rSB.right - ptArray[ numOfParts - 1 ]; - for ( n=0; n <= numOfParts-1; n++) + for( n = 0; n <= numOfParts - 1; n++ ) { - ptArray[n] += iDiff; + ptArray[ n ] += iDiff; } - SendMessage(hWndSB, SB_SETPARTS, numOfParts,(LPARAM)(LPINT)ptArray); + SendMessage( hWndSB, SB_SETPARTS, numOfParts, ( LPARAM ) ( LPINT ) ptArray ); hb_retni( numOfParts ); } /*WVW_SBsetText([nWinNum], [nPart], cText) - *Set Text of status bar's part #npart + *Set Text of status bar's part #npart */ -HB_FUNC ( WVW_SBSETTEXT ) +HB_FUNC( WVW_SBSETTEXT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iPart = HB_ISNIL( 2 ) ? 1 : hb_parni( 2 ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iPart = HB_ISNIL( 2 ) ? 1 : hb_parni( 2 ); - if ( !HB_ISNIL( 4 ) ) + if( ! HB_ISNIL( 4 ) ) { - if (HB_ISCHAR( 4 )) - pWindowData->cSBColorForeground = strtol( hb_parc( 4 ), NULL, 10); - else - pWindowData->cSBColorForeground = hb_parnl( 4 ); + if( HB_ISCHAR( 4 ) ) + pWindowData->cSBColorForeground = strtol( hb_parc( 4 ), NULL, 10 ); + else + pWindowData->cSBColorForeground = hb_parnl( 4 ); } - if ( !HB_ISNIL( 5 ) ) + if( ! HB_ISNIL( 5 ) ) { - if (HB_ISCHAR( 5 )) - pWindowData->cSBColorBackground = strtol( hb_parc( 5 ), NULL, 10); - else - pWindowData->cSBColorBackground = hb_parnl( 5 ); + if( HB_ISCHAR( 5 ) ) + pWindowData->cSBColorBackground = strtol( hb_parc( 5 ), NULL, 10 ); + else + pWindowData->cSBColorBackground = hb_parnl( 5 ); } - if (( iPart==0 ) && (( pWindowData->cSBColorForeground ) || ( pWindowData->cSBColorBackground )) ) + if( ( iPart == 0 ) && ( ( pWindowData->cSBColorForeground ) || ( pWindowData->cSBColorBackground ) ) ) { pWindowData->bSBPaint = TRUE; - SendMessage( pWindowData->hStatusBar, SB_SETTEXT, SBT_OWNERDRAW, (LPARAM) hb_parcx(3)); + SendMessage( pWindowData->hStatusBar, SB_SETTEXT, SBT_OWNERDRAW, ( LPARAM ) hb_parcx( 3 ) ); hb_gt_wvwProcessMessages( pWindowData ); } else - SendMessage( pWindowData->hStatusBar, SB_SETTEXT, iPart, (LPARAM) hb_parcx(3)); + SendMessage( pWindowData->hStatusBar, SB_SETTEXT, iPart, ( LPARAM ) hb_parcx( 3 ) ); } /*WVW_SBgetText([nWinNum], [nPart]) - *Get Text of status bar's part #npart + *Get Text of status bar's part #npart */ -HB_FUNC (WVW_SBGETTEXT) +HB_FUNC( WVW_SBGETTEXT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iPart = HB_ISNIL( 2 ) ? 1 : hb_parni( 2 ); - char cString [1024] = ""; - SendMessage( pWindowData->hStatusBar, SB_GETTEXT, (WPARAM) iPart, (LPARAM) cString); - hb_retc(cString) ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iPart = HB_ISNIL( 2 ) ? 1 : hb_parni( 2 ); + char cString[ 1024 ] = ""; + + SendMessage( pWindowData->hStatusBar, SB_GETTEXT, ( WPARAM ) iPart, ( LPARAM ) cString ); + hb_retc( cString ); } /*WVW_SBgetparts([nWinNum]) - *Get number of parts in statusbar of window nWinNum + *Get number of parts in statusbar of window nWinNum */ -HB_FUNC (WVW_SBGETPARTS) +HB_FUNC( WVW_SBGETPARTS ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int numOfParts = (int) SendMessage( pWindowData->hStatusBar, SB_GETPARTS, WVW_MAX_STATUS_PARTS, 0 ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int numOfParts = ( int ) SendMessage( pWindowData->hStatusBar, SB_GETPARTS, WVW_MAX_STATUS_PARTS, 0 ); hb_retni( numOfParts ); } @@ -370,41 +371,41 @@ HB_FUNC (WVW_SBGETPARTS) /*WVW_SBSetFont([nWinNum], cFontFace, nHeight, nWidth, nWeight, nQUality,; * lItalic, lUnderline, lStrikeout * -*/ + */ HB_FUNC( WVW_SBSETFONT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - WVW_DATA * pData = hb_getWvwData() ; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + WVW_DATA * pData = hb_getWvwData(); - BOOL retval = TRUE; + BOOL retval = TRUE; - pData->s_lfSB.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); - pData->s_lfSB.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfSB.lfWidth : hb_parni( 4 ); - pData->s_lfSB.lfEscapement = 0; - pData->s_lfSB.lfOrientation = 0; - pData->s_lfSB.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfSB.lfWeight : hb_parni( 5 ); - pData->s_lfSB.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfSB.lfItalic : ( BYTE )hb_parl( 7 ); - pData->s_lfSB.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfSB.lfUnderline : ( BYTE )hb_parl( 8 ); - pData->s_lfSB.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfSB.lfStrikeOut : ( BYTE )hb_parl( 9 ); - pData->s_lfSB.lfCharSet = DEFAULT_CHARSET; + pData->s_lfSB.lfHeight = HB_ISNIL( 3 ) ? pWindowData->fontHeight - 2 : hb_parnl( 3 ); + pData->s_lfSB.lfWidth = HB_ISNIL( 4 ) ? pData->s_lfSB.lfWidth : hb_parni( 4 ); + pData->s_lfSB.lfEscapement = 0; + pData->s_lfSB.lfOrientation = 0; + pData->s_lfSB.lfWeight = HB_ISNIL( 5 ) ? pData->s_lfSB.lfWeight : hb_parni( 5 ); + pData->s_lfSB.lfItalic = HB_ISNIL( 7 ) ? pData->s_lfSB.lfItalic : ( BYTE ) hb_parl( 7 ); + pData->s_lfSB.lfUnderline = HB_ISNIL( 8 ) ? pData->s_lfSB.lfUnderline : ( BYTE ) hb_parl( 8 ); + pData->s_lfSB.lfStrikeOut = HB_ISNIL( 9 ) ? pData->s_lfSB.lfStrikeOut : ( BYTE ) hb_parl( 9 ); + pData->s_lfSB.lfCharSet = DEFAULT_CHARSET; - pData->s_lfSB.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfSB.lfQuality : ( BYTE )hb_parni( 6 ); - pData->s_lfSB.lfPitchAndFamily = FF_DONTCARE; - if ( HB_ISCHAR( 2 ) ) + pData->s_lfSB.lfQuality = HB_ISNIL( 6 ) ? pData->s_lfSB.lfQuality : ( BYTE ) hb_parni( 6 ); + pData->s_lfSB.lfPitchAndFamily = FF_DONTCARE; + if( HB_ISCHAR( 2 ) ) { strcpy( pData->s_lfSB.lfFaceName, hb_parcx( 2 ) ); } - if (pWindowData->hSBfont) + if( pWindowData->hSBfont ) { HFONT hOldFont = pWindowData->hSBfont; - HFONT hFont = CreateFontIndirect( &pData->s_lfSB ); - if (hFont) + HFONT hFont = CreateFontIndirect( &pData->s_lfSB ); + if( hFont ) { pWindowData->hSBfont = hFont; - DeleteObject( (HFONT) hOldFont ); + DeleteObject( ( HFONT ) hOldFont ); } else { @@ -417,23 +418,23 @@ HB_FUNC( WVW_SBSETFONT ) /*WVW_XBcreate( [nWinNum], nStyle, nTop, nLeft, nLength, bBlock, aOffset) - *create scroll bar for window nWinNum - *nStyle: SBS_HORZ (0)=horizontal, SBS_VERT (1)=vertical - *nTop: row of top/left corner (in character unit) - *nLeft: col of top/left corner (in character unit) - *nLength: length of scrollbar (in character unit) - *NOTES: width of scrollbar (in character unit) + *create scroll bar for window nWinNum + *nStyle: SBS_HORZ (0)=horizontal, SBS_VERT (1)=vertical + *nTop: row of top/left corner (in character unit) + *nLeft: col of top/left corner (in character unit) + *nLength: length of scrollbar (in character unit) + *NOTES: width of scrollbar (in character unit) * horiz: defaults to one character height * verti: defaults to one character _height_ too (!) * use aOffset to adjust the dimension - *aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust + **aOffset: array {y1,x1,y2,x2} of offsets to corner pixels, to adjust * dimension of scroll bar. * defaults for vertical scroll bar: {0,+3,0,0} * defaults for horiz scroll bar: {+3-linespacing,0,0,0} * NOTES: these defaults are meant to make room for other common * GUI elements like raised/recessed lines. * - *bBlock: codeblock to execute on every WM_VSCROLL/WM_HSCROLL event. + **bBlock: codeblock to execute on every WM_VSCROLL/WM_HSCROLL event. * This codeblock will be evaluated with these parameters: * nWinNum: window number * nXBid : scrollbar id @@ -449,183 +450,186 @@ HB_FUNC( WVW_SBSETFONT ) * SB_THUMBTRACK 5: scroll thumb is being dragged at position nXBpos * SB_ENDSCROLL 8 * - *returns control id of newly created scroll bar of windows nWinNum - *returns 0 if failed + **returns control id of newly created scroll bar of windows nWinNum + **returns 0 if failed * - *example: - *WVW_XBcreate( , 1, 10, 70, 12) + **example: + **WVW_XBcreate( , 1, 10, 70, 12) * :: creates Vertical scrollbar on current window at (10,70) with length 12 * dimensions using default ones. * buttons/parts behaviour using default ones. * - *WVW_XBcreate( , 1, 10, 70, 12, {0, +5, 0, +5} ) + **WVW_XBcreate( , 1, 10, 70, 12, {0, +5, 0, +5} ) * :: creates Vertical scrollbar on current window at (10,70) with length 12 * left and right coordinate is shifted 5 pixels to the right. * buttons/parts behaviour using default ones. * - *NOTES: - *ScrollRange is always 0 - 100. - *Initial ScrollPos is 0 + **NOTES: + **ScrollRange is always 0 - 100. + **Initial ScrollPos is 0 */ -HB_FUNC( WVW_XBCREATE) +HB_FUNC( WVW_XBCREATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndParent = pWindowData->hWnd; - HWND hWndXB; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; - int iOffTop, iOffLeft, iOffBottom, iOffRight; - int iStyle = (int) ( !HB_ISNUM( 2 ) ? -1 : hb_parni( 2 ) ); - UINT uiXBid; - USHORT usTop = ( USHORT )hb_parni( 3 ), - usLeft = ( USHORT )hb_parni( 4 ), - usBottom, - usRight; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndParent = pWindowData->hWnd; + HWND hWndXB; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; + int iOffTop, iOffLeft, iOffBottom, iOffRight; + int iStyle = ( int ) ( ! HB_ISNUM( 2 ) ? -1 : hb_parni( 2 ) ); + UINT uiXBid; + USHORT usTop = ( USHORT ) hb_parni( 3 ), + usLeft = ( USHORT ) hb_parni( 4 ), + usBottom, + usRight; - if (iStyle < SBS_HORZ || iStyle > SBS_VERT || !HB_ISBLOCK(6)) + if( iStyle < SBS_HORZ || iStyle > SBS_VERT || ! HB_ISBLOCK( 6 ) ) { - hb_retnl(0); - return; + hb_retnl( 0 ); + return; } - if (iStyle==SBS_VERT) + if( iStyle == SBS_VERT ) { - usBottom = usTop + (USHORT)hb_parni( 5 ) -1; - usRight = usLeft; + usBottom = usTop + ( USHORT ) hb_parni( 5 ) - 1; + usRight = usLeft; - iOffTop = !HB_ISNIL( 7 ) ? hb_parvni( 7,1 ) : 0 ; - iOffLeft = !HB_ISNIL( 7 ) ? hb_parvni( 7,2 ) : +3 ; - iOffBottom = !HB_ISNIL( 7 ) ? hb_parvni( 7,3 ) : 0 ; - iOffRight = !HB_ISNIL( 7 ) ? hb_parvni( 7,4 ) : 0; + iOffTop = ! HB_ISNIL( 7 ) ? hb_parvni( 7, 1 ) : 0; + iOffLeft = ! HB_ISNIL( 7 ) ? hb_parvni( 7, 2 ) : +3; + iOffBottom = ! HB_ISNIL( 7 ) ? hb_parvni( 7, 3 ) : 0; + iOffRight = ! HB_ISNIL( 7 ) ? hb_parvni( 7, 4 ) : 0; } else { - usRight = usLeft + (USHORT)hb_parni( 5 ) -1; - usBottom = usTop; + usRight = usLeft + ( USHORT ) hb_parni( 5 ) - 1; + usBottom = usTop; - iOffTop = !HB_ISNIL( 7 ) ? hb_parvni( 7,1 ) : +3-pWindowData->byLineSpacing ; - iOffLeft = !HB_ISNIL( 7 ) ? hb_parvni( 7,2 ) : 0 ; - iOffBottom = !HB_ISNIL( 7 ) ? hb_parvni( 7,3 ) : 0; - iOffRight = !HB_ISNIL( 7 ) ? hb_parvni( 7,4 ) : 0 ; + iOffTop = ! HB_ISNIL( 7 ) ? hb_parvni( 7, 1 ) : +3 - pWindowData->byLineSpacing; + iOffLeft = ! HB_ISNIL( 7 ) ? hb_parvni( 7, 2 ) : 0; + iOffBottom = ! HB_ISNIL( 7 ) ? hb_parvni( 7, 3 ) : 0; + iOffRight = ! HB_ISNIL( 7 ) ? hb_parvni( 7, 4 ) : 0; } - if (hb_gt_wvw_GetMainCoordMode()) + if( hb_gt_wvw_GetMainCoordMode() ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y + iOffTop ; - iLeft = xy.x + iOffLeft; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y + iOffTop; + iLeft = xy.x + iOffLeft; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); - xy.y -= pWindowData->byLineSpacing; + xy.y -= pWindowData->byLineSpacing; - if (iStyle==SBS_VERT) + if( iStyle == SBS_VERT ) { - iBottom = xy.y - 1 + iOffBottom; - iRight = iLeft + pWindowData->PTEXTSIZE.y -1 + iOffRight; + iBottom = xy.y - 1 + iOffBottom; + iRight = iLeft + pWindowData->PTEXTSIZE.y - 1 + iOffRight; } else { - iRight = xy.x - 1 + iOffRight; - iBottom = iTop + pWindowData->PTEXTSIZE.y -1 + iOffBottom; + iRight = xy.x - 1 + iOffRight; + iBottom = iTop + pWindowData->PTEXTSIZE.y - 1 + iOffBottom; } - uiXBid = LastControlId(usWinNum, WVW_CONTROL_SCROLLBAR); - if (uiXBid==0) + uiXBid = LastControlId( usWinNum, WVW_CONTROL_SCROLLBAR ); + if( uiXBid == 0 ) { - uiXBid = WVW_ID_BASE_SCROLLBAR; + uiXBid = WVW_ID_BASE_SCROLLBAR; } else { - uiXBid++; + uiXBid++; } hWndXB = CreateWindowEx( - 0L, /* no extended styles */ - "SCROLLBAR", /* scroll bar control class */ - (LPSTR) NULL, /* text for window title bar */ - WS_CHILD | WS_VISIBLE | (DWORD) iStyle, /* scroll bar styles */ - iLeft, /* horizontal position */ - iTop, /* vertical position */ - iRight-iLeft+1, /* width of the scroll bar */ - iBottom-iTop+1, /* height */ - hWndParent, /* handle to main window */ - (HMENU) uiXBid, /* id for this scroll bar control */ - hb_getWvwData()->hInstance, /* instance owning this window */ - (LPVOID) NULL /* pointer not needed */ - ); + 0L, /* no extended styles */ + "SCROLLBAR", /* scroll bar control class */ + ( LPSTR ) NULL, /* text for window title bar */ + WS_CHILD | WS_VISIBLE | ( DWORD ) iStyle, /* scroll bar styles */ + iLeft, /* horizontal position */ + iTop, /* vertical position */ + iRight - iLeft + 1, /* width of the scroll bar */ + iBottom - iTop + 1, /* height */ + hWndParent, /* handle to main window */ + ( HMENU ) uiXBid, /* id for this scroll bar control */ + hb_getWvwData()->hInstance, /* instance owning this window */ + ( LPVOID ) NULL /* pointer not needed */ + ); - if(hWndXB) + if( hWndXB ) { - RECT rXB = { 0 }, rOffXB = { 0 }; + RECT rXB = { 0 }, rOffXB = { 0 }; - WNDPROC OldProc; + WNDPROC OldProc; - rXB.top = usTop; rXB.left= usLeft; - rXB.bottom=usBottom; rXB.right =usRight; - rOffXB.top = iOffTop; rOffXB.left= iOffLeft; - rOffXB.bottom=iOffBottom; rOffXB.right =iOffRight; + rXB.top = usTop; rXB.left = usLeft; + rXB.bottom = usBottom; rXB.right = usRight; + rOffXB.top = iOffTop; rOffXB.left = iOffLeft; + rOffXB.bottom = iOffBottom; rOffXB.right = iOffRight; - SetScrollRange (hWndXB, SB_CTL, 0, 99, FALSE) ; - SetScrollPos (hWndXB, SB_CTL, 0, TRUE) ; + SetScrollRange( hWndXB, SB_CTL, 0, 99, FALSE ); + SetScrollPos( hWndXB, SB_CTL, 0, TRUE ); - AddControlHandle(usWinNum, WVW_CONTROL_SCROLLBAR, hWndXB, uiXBid, (PHB_ITEM) hb_param( 6, HB_IT_BLOCK ), rXB, rOffXB, (byte) iStyle); + AddControlHandle( usWinNum, WVW_CONTROL_SCROLLBAR, hWndXB, uiXBid, ( PHB_ITEM ) hb_param( 6, HB_IT_BLOCK ), rXB, rOffXB, ( byte ) iStyle ); - OldProc = (WNDPROC) SetWindowLongPtr (hWndXB, - GWLP_WNDPROC, (LONG_PTR) hb_gt_wvwXBProc) ; + OldProc = ( WNDPROC ) SetWindowLongPtr( hWndXB, + GWLP_WNDPROC, ( LONG_PTR ) hb_gt_wvwXBProc ); - StoreControlProc(usWinNum, WVW_CONTROL_SCROLLBAR, hWndXB, OldProc); + StoreControlProc( usWinNum, WVW_CONTROL_SCROLLBAR, hWndXB, OldProc ); - hb_retnl( (LONG) uiXBid ); + hb_retnl( ( LONG ) uiXBid ); } else { - hb_retnl( (LONG) 0 ); + hb_retnl( ( LONG ) 0 ); } } /*WVW_XBdestroy( [nWinNum], nXBid ) - *destroy scrollbar nXBid for window nWinNum + *destroy scrollbar nXBid for window nWinNum */ -HB_FUNC( WVW_XBDESTROY) +HB_FUNC( WVW_XBDESTROY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - UINT uiXBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - CONTROL_DATA * pcd = pWindowData->pcdCtrlList; - CONTROL_DATA * pcdPrev = NULL; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT uiXBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + CONTROL_DATA * pcd = pWindowData->pcdCtrlList; + CONTROL_DATA * pcdPrev = NULL; - while (pcd) + while( pcd ) { - if (pcd->byCtrlClass == WVW_CONTROL_SCROLLBAR && pcd->uiCtrlid == uiXBid) - { - break; - } + if( pcd->byCtrlClass == WVW_CONTROL_SCROLLBAR && pcd->uiCtrlid == uiXBid ) + { + break; + } - pcdPrev = pcd; - pcd = pcd->pNext; + pcdPrev = pcd; + pcd = pcd->pNext; } - if (pcd==NULL) { return; } - - DestroyWindow (pcd->hWndCtrl) ; - - if (pcdPrev==NULL) + if( pcd == NULL ) { - pWindowData->pcdCtrlList = pcd->pNext; + return; + } + + DestroyWindow( pcd->hWndCtrl ); + + if( pcdPrev == NULL ) + { + pWindowData->pcdCtrlList = pcd->pNext; } else { - pcdPrev->pNext = pcd->pNext; + pcdPrev->pNext = pcd->pNext; } - if (pcd->phiCodeBlock) + if( pcd->phiCodeBlock ) { hb_itemRelease( pcd->phiCodeBlock ); @@ -635,49 +639,58 @@ HB_FUNC( WVW_XBDESTROY) } /*WVW_XBupdate(nWinNum, XBid, [nPos], [nPageSize], [nMin], [nMax]) - *update scrollbar data and its display - *nPos, nPageSize, nMin, nMax are optional. - *however, both nMin & nMax must be supplied, or not at all. - *returns current position of scroll thumb. - *returns -1 if update failed. -*/ + *update scrollbar data and its display + *nPos, nPageSize, nMin, nMax are optional. + *however, both nMin & nMax must be supplied, or not at all. + *returns current position of scroll thumb. + *returns -1 if update failed. + */ HB_FUNC( WVW_XBUPDATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiXBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - byte bStyle; - HWND hWndXB = FindControlHandle(usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle); - int iPos = (int) ( HB_ISNIL(3) ? 0 : hb_parni( 3 ) ); - int iPage = (int) ( HB_ISNIL( 4 ) ? 0 : hb_parni( 4 ) ); - int iMin = (int) ( HB_ISNIL(5) ? 0 : hb_parni( 5 ) ); - int iMax = (int) ( HB_ISNIL(6) ? 0 : hb_parni( 6 ) ); - SCROLLINFO si; - int iRetval; - UINT fMask = SIF_DISABLENOSCROLL; + UINT uiXBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + byte bStyle; + HWND hWndXB = FindControlHandle( usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle ); + int iPos = ( int ) ( HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ) ); + int iPage = ( int ) ( HB_ISNIL( 4 ) ? 0 : hb_parni( 4 ) ); + int iMin = ( int ) ( HB_ISNIL( 5 ) ? 0 : hb_parni( 5 ) ); + int iMax = ( int ) ( HB_ISNIL( 6 ) ? 0 : hb_parni( 6 ) ); + SCROLLINFO si; + int iRetval; + UINT fMask = SIF_DISABLENOSCROLL; - if (uiXBid==0 || hWndXB==NULL || iPage<0) + if( uiXBid == 0 || hWndXB == NULL || iPage < 0 ) { - hb_retni(-1); - return; + hb_retni( -1 ); + return; } - if (!HB_ISNIL(3)) { fMask = fMask | SIF_POS; } - if (!HB_ISNIL(4)) { fMask = fMask | SIF_PAGE; } - if (!HB_ISNIL(5) && !HB_ISNIL(6)) { fMask = fMask | SIF_RANGE; } + if( ! HB_ISNIL( 3 ) ) + { + fMask = fMask | SIF_POS; + } + if( ! HB_ISNIL( 4 ) ) + { + fMask = fMask | SIF_PAGE; + } + if( ! HB_ISNIL( 5 ) && ! HB_ISNIL( 6 ) ) + { + fMask = fMask | SIF_RANGE; + } - si.cbSize = sizeof(si); - si.fMask = fMask; - si.nMin = iMin; - si.nMax = iMax; - si.nPage = (UINT) iPage; - si.nPos = iPos; - iRetval = SetScrollInfo(hWndXB, - SB_CTL, - (LPCSCROLLINFO) &si, - TRUE); + si.cbSize = sizeof( si ); + si.fMask = fMask; + si.nMin = iMin; + si.nMax = iMax; + si.nPage = ( UINT ) iPage; + si.nPos = iPos; + iRetval = SetScrollInfo( hWndXB, + SB_CTL, + ( LPCSCROLLINFO ) &si, + TRUE ); - hb_retni(iRetval); + hb_retni( iRetval ); } /* WVW_XBinfo( [nWinNum], XBid ) @@ -686,36 +699,36 @@ HB_FUNC( WVW_XBUPDATE ) */ HB_FUNC( WVW_XBINFO ) { - UINT usWinNum = WVW_WHICH_WINDOW; - PHB_ITEM aInfo; - SCROLLINFO si; + UINT usWinNum = WVW_WHICH_WINDOW; + PHB_ITEM aInfo; + SCROLLINFO si; - UINT uiXBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - byte bStyle; - HWND hWndXB = FindControlHandle(usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle); + UINT uiXBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + byte bStyle; + HWND hWndXB = FindControlHandle( usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle ); - if (uiXBid==0 || hWndXB==NULL ) + if( uiXBid == 0 || hWndXB == NULL ) { - aInfo = hb_itemArrayNew(0); - hb_itemReturn( aInfo ); - hb_itemRelease( aInfo ); - return; + aInfo = hb_itemArrayNew( 0 ); + hb_itemReturn( aInfo ); + hb_itemRelease( aInfo ); + return; } - si.cbSize = sizeof( si ); - si.fMask = SIF_ALL; + si.cbSize = sizeof( si ); + si.fMask = SIF_ALL; - if ( !GetScrollInfo( hWndXB, SB_CTL, &si ) ) + if( ! GetScrollInfo( hWndXB, SB_CTL, &si ) ) { - aInfo = hb_itemArrayNew(0); - hb_itemReturn( aInfo ); - hb_itemRelease( aInfo ); - return; + aInfo = hb_itemArrayNew( 0 ); + hb_itemReturn( aInfo ); + hb_itemRelease( aInfo ); + return; } - aInfo = hb_itemArrayNew(5); + aInfo = hb_itemArrayNew( 5 ); hb_arraySetNL( aInfo, 1, si.nMin ); hb_arraySetNL( aInfo, 2, si.nMax ); hb_arraySetNL( aInfo, 3, si.nPage ); @@ -726,50 +739,50 @@ HB_FUNC( WVW_XBINFO ) } /*WVW_XBenable( [nWinNum], nXBid, nFlags ) - *enable/disable scrollbar nXBid in window nWinNum (default to topmost window) - *nFlags: ESB_ENABLE_BOTH 0: enable both arrows + *enable/disable scrollbar nXBid in window nWinNum (default to topmost window) + *nFlags: ESB_ENABLE_BOTH 0: enable both arrows * ESB_DISABLE_LEFT/ESB_DISABLE_UP 1: disable left/up arrow * ESB_DISABLE_RIGHT/ESB_DISABLE_DOWN 2: disable right/down arrow * ESB_DISABLE_BOTH 3: disable both arrow - *returns .t. if successful + **returns .t. if successful */ -HB_FUNC( WVW_XBENABLE) +HB_FUNC( WVW_XBENABLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; + UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiXBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - UINT uiFlags = (UINT) ( HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ) ); - byte bStyle; - HWND hWndXB = uiXBid==0 ? NULL : FindControlHandle(usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle); + UINT uiXBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + UINT uiFlags = ( UINT ) ( HB_ISNIL( 3 ) ? 0 : hb_parni( 3 ) ); + byte bStyle; + HWND hWndXB = uiXBid == 0 ? NULL : FindControlHandle( usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle ); - if (uiXBid==0 || hWndXB==NULL || uiFlags > ESB_DISABLE_BOTH ) + if( uiXBid == 0 || hWndXB == NULL || uiFlags > ESB_DISABLE_BOTH ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } hb_retl( EnableScrollBar( hWndXB, SB_CTL, uiFlags ) ); } /*WVW_XBshow( [nWinNum], nXBid, lShow ) - *show/hide scrollbar nXBid in window nWinNum (default to topmost window) - *nXBid is the handle of the scrolbar - *lShow: .T. shows the scrolbar (default) + *show/hide scrollbar nXBid in window nWinNum (default to topmost window) + *nXBid is the handle of the scrolbar + *lShow: .T. shows the scrolbar (default) * .F. hides the scrolbar - *returns .t. if successful + **returns .t. if successful */ HB_FUNC( WVW_XBSHOW ) { - UINT usWinNum = WVW_WHICH_WINDOW; - UINT uiXBid = (UINT) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); - BOOL bShow = (BOOL) ( HB_ISLOG( 3 ) ? hb_parl( 3 ) : TRUE ); - byte bStyle; - HWND hWndXB = uiXBid == 0 ? NULL : FindControlHandle(usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle ); + UINT usWinNum = WVW_WHICH_WINDOW; + UINT uiXBid = ( UINT ) ( HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ) ); + BOOL bShow = ( BOOL ) ( HB_ISLOG( 3 ) ? hb_parl( 3 ) : TRUE ); + byte bStyle; + HWND hWndXB = uiXBid == 0 ? NULL : FindControlHandle( usWinNum, WVW_CONTROL_SCROLLBAR, uiXBid, &bStyle ); - if (uiXBid==0 || hWndXB==NULL) + if( uiXBid == 0 || hWndXB == NULL ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } hb_retl( ShowScrollBar( hWndXB, SB_CTL, bShow ) ); diff --git a/harbour/extras/gtwvw/wvwtbar.c b/harbour/extras/gtwvw/wvwtbar.c index 9a03695397..5303f5bfd1 100644 --- a/harbour/extras/gtwvw/wvwtbar.c +++ b/harbour/extras/gtwvw/wvwtbar.c @@ -78,39 +78,39 @@ #include "hbgtwvw.h" /*WVW_TBCreate([nWinNum], lDisplayText, nStyle, nSystemBitmap, nImageWidth, nImageHeight) - *creates a toolbar at the top (no button initially) - *lDisplayText==.f. button's string is used as tooltips (default) - *nStyle: toolbar style, defaults to TBSTYLE_FLAT | TBSTYLE_TOOLTIPS - *nSystemBitmap: 0:none, 1:small, 2:large (defaults: 1) + *creates a toolbar at the top (no button initially) + *lDisplayText==.f. button's string is used as tooltips (default) + *nStyle: toolbar style, defaults to TBSTYLE_FLAT | TBSTYLE_TOOLTIPS + *nSystemBitmap: 0:none, 1:small, 2:large (defaults: 1) * small=16x16 large=24x24 - *nImageWidth/Height are in effect only if nSystemBitmap==0 + **nImageWidth/Height are in effect only if nSystemBitmap==0 */ -HB_FUNC( WVW_TBCREATE) +HB_FUNC( WVW_TBCREATE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndParent = pWindowData->hWnd; - HWND hWndTB; - int iMaxTextRows = (int) ( HB_ISNIL( 2 ) ? 0 : (hb_parl( 2 ) ? 1 : 0) ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndParent = pWindowData->hWnd; + HWND hWndTB; + int iMaxTextRows = ( int ) ( HB_ISNIL( 2 ) ? 0 : ( hb_parl( 2 ) ? 1 : 0 ) ); // DWORD dwStyle = (DWORD) ( HB_ISNIL( 3 ) ? TBSTYLE_FLAT | TBSTYLE_TOOLTIPS : hb_parni( 3 ) ); - DWORD dwStyle = (DWORD) ( HB_ISNIL( 3 ) ? TBSTYLE_ALTDRAG | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_WRAPABLE : hb_parnl( 3 ) ); + DWORD dwStyle = ( DWORD ) ( HB_ISNIL( 3 ) ? TBSTYLE_ALTDRAG | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_WRAPABLE : hb_parnl( 3 ) ); - int iSystemBitmap = (int) ( HB_ISNIL( 4 ) ? 1 : hb_parni( 4 ) ); - int iImageWidth = (int) ( iSystemBitmap==0 && HB_ISNUM( 5 ) ? hb_parni( 5 ) : -1 ); - int iImageHeight = (int) ( iSystemBitmap==0 && HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ); - TBADDBITMAP tbab = { 0 }; + int iSystemBitmap = ( int ) ( HB_ISNIL( 4 ) ? 1 : hb_parni( 4 ) ); + int iImageWidth = ( int ) ( iSystemBitmap == 0 && HB_ISNUM( 5 ) ? hb_parni( 5 ) : -1 ); + int iImageHeight = ( int ) ( iSystemBitmap == 0 && HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ); + TBADDBITMAP tbab = { 0 }; InitCommonControls(); - if (pWindowData->hToolBar!=NULL) + if( pWindowData->hToolBar != NULL ) { - hb_retnl( 0 ); - return; + hb_retnl( 0 ); + return; } - if (iImageWidth < 0) + if( iImageWidth < 0 ) { - switch (iSystemBitmap) + switch( iSystemBitmap ) { case 1: iImageWidth = 16; @@ -123,99 +123,99 @@ HB_FUNC( WVW_TBCREATE) break; } } - if (iImageHeight < 0) + if( iImageHeight < 0 ) { - switch (iSystemBitmap) + switch( iSystemBitmap ) { case 1: - iImageHeight = 16; + iImageHeight = 16; break; case 2: - iImageHeight = 24; + iImageHeight = 24; break; default: - iImageHeight = iImageWidth; + iImageHeight = iImageWidth; break; } } - hWndTB = CreateToolbarEx(hWndParent, - WS_CHILD | WS_VISIBLE | dwStyle, - WVW_ID_BASE_TOOLBAR+usWinNum, - 0, - hb_getWvwData()->hInstance, - 0, - NULL, - 0, - 0, - 0, - iImageWidth, - iImageHeight, - sizeof(TBBUTTON)); + hWndTB = CreateToolbarEx( hWndParent, + WS_CHILD | WS_VISIBLE | dwStyle, + WVW_ID_BASE_TOOLBAR + usWinNum, + 0, + hb_getWvwData()->hInstance, + 0, + NULL, + 0, + 0, + 0, + iImageWidth, + iImageHeight, + sizeof( TBBUTTON ) ); - if (hWndTB == NULL) + if( hWndTB == NULL ) { MessageBox( NULL, TEXT( "Failed CreateToolbarEx..." ), hb_gt_wvw_GetAppName(), MB_ICONERROR ); - hb_retnl(0); + hb_retnl( 0 ); } - pWindowData->tbOldProc = (WNDPROC) SetWindowLongPtr (hWndTB, - GWLP_WNDPROC, (LONG_PTR) hb_gt_wvwTBProc) ; + pWindowData->tbOldProc = ( WNDPROC ) SetWindowLongPtr( hWndTB, + GWLP_WNDPROC, ( LONG_PTR ) hb_gt_wvwTBProc ); - if (iSystemBitmap > 0) + if( iSystemBitmap > 0 ) { - tbab.hInst = HINST_COMMCTRL; + tbab.hInst = HINST_COMMCTRL; - tbab.nID = iSystemBitmap == 1 ? IDB_STD_SMALL_COLOR : IDB_STD_LARGE_COLOR; - pWindowData->iStartStdBitmap= SendMessage(hWndTB, TB_ADDBITMAP, (WPARAM) 0, (WPARAM) &tbab); + tbab.nID = iSystemBitmap == 1 ? IDB_STD_SMALL_COLOR : IDB_STD_LARGE_COLOR; + pWindowData->iStartStdBitmap = SendMessage( hWndTB, TB_ADDBITMAP, ( WPARAM ) 0, ( WPARAM ) &tbab ); - tbab.nID = iSystemBitmap == 1 ? IDB_VIEW_SMALL_COLOR : IDB_VIEW_LARGE_COLOR; - pWindowData->iStartViewBitmap = SendMessage(hWndTB, TB_ADDBITMAP, (WPARAM) 0, (WPARAM) &tbab); + tbab.nID = iSystemBitmap == 1 ? IDB_VIEW_SMALL_COLOR : IDB_VIEW_LARGE_COLOR; + pWindowData->iStartViewBitmap = SendMessage( hWndTB, TB_ADDBITMAP, ( WPARAM ) 0, ( WPARAM ) &tbab ); - tbab.nID = iSystemBitmap == 1 ? IDB_HIST_SMALL_COLOR : IDB_HIST_LARGE_COLOR; - pWindowData->iStartHistBitmap = SendMessage(hWndTB, TB_ADDBITMAP, (WPARAM) 0, (WPARAM) &tbab); + tbab.nID = iSystemBitmap == 1 ? IDB_HIST_SMALL_COLOR : IDB_HIST_LARGE_COLOR; + pWindowData->iStartHistBitmap = SendMessage( hWndTB, TB_ADDBITMAP, ( WPARAM ) 0, ( WPARAM ) &tbab ); } else { - pWindowData->iStartStdBitmap = 0; + pWindowData->iStartStdBitmap = 0; pWindowData->iStartViewBitmap = 0; pWindowData->iStartHistBitmap = 0; } - pWindowData->iTBImgWidth = iImageWidth; - pWindowData->iTBImgHeight = iImageHeight; + pWindowData->iTBImgWidth = iImageWidth; + pWindowData->iTBImgHeight = iImageHeight; - SendMessage(hWndTB, TB_SETMAXTEXTROWS,(WPARAM) iMaxTextRows, (LPARAM) 0); + SendMessage( hWndTB, TB_SETMAXTEXTROWS, ( WPARAM ) iMaxTextRows, ( LPARAM ) 0 ); - if (hWndTB) + if( hWndTB ) { - hb_stornl(pWindowData->iStartStdBitmap,7); - hb_stornl(pWindowData->iStartViewBitmap,8); - hb_stornl(pWindowData->iStartHistBitmap,9); + hb_stornl( pWindowData->iStartStdBitmap, 7 ); + hb_stornl( pWindowData->iStartViewBitmap, 8 ); + hb_stornl( pWindowData->iStartHistBitmap, 9 ); - hb_gt_wvwTBinitSize( pWindowData, hWndTB ); + hb_gt_wvwTBinitSize( pWindowData, hWndTB ); - pWindowData->hToolBar = hWndTB; + pWindowData->hToolBar = hWndTB; - hb_gt_wvwResetWindow( usWinNum ); + hb_gt_wvwResetWindow( usWinNum ); } - hb_retnl ( (LONG) hWndTB ); + hb_retnl( ( LONG ) hWndTB ); } /*WVW_TBAddButton([nWinNum], nCommand, xBitmap, cLabel, nBitmapType,; * lMap3Dcolors, lDropdown) - *adds one button on the right of existing buttons - *xBitmap: - *nBitmap is resource id. or use cBitmap as bitmap file name. - *(bitmap from resources cannot have > 256 colors) + **adds one button on the right of existing buttons + **xBitmap: + **nBitmap is resource id. or use cBitmap as bitmap file name. + **(bitmap from resources cannot have > 256 colors) * - *cLabel: if lDisplayText, it will be displayed below the bitmap + **cLabel: if lDisplayText, it will be displayed below the bitmap * otherwise it will be used as tooltip - *nBitmapType: 0:custom, 1:system std bitmap, 2:system view bitmap, 3:system hist bitmap - *lMap3Dcolors: defaults to .f. + **nBitmapType: 0:custom, 1:system std bitmap, 2:system view bitmap, 3:system hist bitmap + **lMap3Dcolors: defaults to .f. * (meaningfull for custom bitmap only) * if .t. the following color mapping will be performed: * RGB(192,192,192) --> COLOR_3DFACE ("transparent") @@ -227,36 +227,36 @@ HB_FUNC( WVW_TBCREATE) HB_FUNC( WVW_TBADDBUTTON ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iCommand = HB_ISNIL(2) ? 0 : hb_parni(2); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iCommand = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); - char * szBitmap = HB_ISCHAR(3) ? (char*) hb_parcx(3) : NULL; - UINT uiBitmap = HB_ISNUM(3) ? (UINT) hb_parni(3) : 0; + char * szBitmap = HB_ISCHAR( 3 ) ? ( char * ) hb_parcx( 3 ) : NULL; + UINT uiBitmap = HB_ISNUM( 3 ) ? ( UINT ) hb_parni( 3 ) : 0; - char * szLabel= HB_ISNIL(4) ? (char*) "" : (char*) hb_parcx(4); - int iBitmapType = HB_ISNIL(5) ? 0 : (int) hb_parni(5); - BOOL bMap3Dcolors = HB_ISLOG(6) ? hb_parl(6) : FALSE; - BOOL bDropdown = HB_ISLOG(7) ? hb_parl(7) : FALSE; - HWND hWndTB; - USHORT usOldHeight; + char * szLabel = HB_ISNIL( 4 ) ? ( char * ) "" : ( char * ) hb_parcx( 4 ); + int iBitmapType = HB_ISNIL( 5 ) ? 0 : ( int ) hb_parni( 5 ); + BOOL bMap3Dcolors = HB_ISLOG( 6 ) ? hb_parl( 6 ) : FALSE; + BOOL bDropdown = HB_ISLOG( 7 ) ? hb_parl( 7 ) : FALSE; + HWND hWndTB; + USHORT usOldHeight; hWndTB = pWindowData->hToolBar; - if (hWndTB==NULL) + if( hWndTB == NULL ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } - if ( iCommand >= WVW_ID_BASE_PUSHBUTTON ) + if( iCommand >= WVW_ID_BASE_PUSHBUTTON ) { - MessageBox( NULL, TEXT( "Toolbar button Command Id too high. Potential conflict with pushbutton" ), - hb_gt_wvw_GetAppName(), MB_ICONERROR ); - hb_retl( FALSE ); - return; + MessageBox( NULL, TEXT( "Toolbar button Command Id too high. Potential conflict with pushbutton" ), + hb_gt_wvw_GetAppName(), MB_ICONERROR ); + hb_retl( FALSE ); + return; } - if (strlen(szLabel) > WVW_TB_LABELMAXLENGTH) + if( strlen( szLabel ) > WVW_TB_LABELMAXLENGTH ) { MessageBox( NULL, TEXT( "Cannot addbutton, Label too long..." ), hb_gt_wvw_GetAppName(), MB_ICONERROR ); @@ -266,92 +266,92 @@ HB_FUNC( WVW_TBADDBUTTON ) usOldHeight = pWindowData->usTBHeight; - if (! AddTBButton(hWndTB, szBitmap, uiBitmap, szLabel, iCommand, iBitmapType, bMap3Dcolors, pWindowData, bDropdown) ) + if( ! AddTBButton( hWndTB, szBitmap, uiBitmap, szLabel, iCommand, iBitmapType, bMap3Dcolors, pWindowData, bDropdown ) ) { - if ( iBitmapType == 0 ) + if( iBitmapType == 0 ) { - if (! AddTBButton(hWndTB, szBitmap, uiBitmap, szLabel, iCommand, 1, bMap3Dcolors, pWindowData, bDropdown) ) - { + if( ! AddTBButton( hWndTB, szBitmap, uiBitmap, szLabel, iCommand, 1, bMap3Dcolors, pWindowData, bDropdown ) ) + { MessageBox( NULL, TEXT( "Failed addbutton..." ), hb_gt_wvw_GetAppName(), MB_ICONERROR ); hb_retl( FALSE ); return; - } + } } else { - MessageBox( NULL, TEXT( "Failed addbutton..." ), - hb_gt_wvw_GetAppName(), MB_ICONERROR ); - hb_retl( FALSE ); - return; + MessageBox( NULL, TEXT( "Failed addbutton..." ), + hb_gt_wvw_GetAppName(), MB_ICONERROR ); + hb_retl( FALSE ); + return; } } hb_gt_wvwTBinitSize( pWindowData, hWndTB ); - if (pWindowData->usTBHeight != usOldHeight) + if( pWindowData->usTBHeight != usOldHeight ) { - hb_gt_wvwResetWindow( usWinNum ); + hb_gt_wvwResetWindow( usWinNum ); } - hb_retl ( TRUE ); + hb_retl( TRUE ); } /*WVW_TBButtonCount([nWinNum]) - *returns number of buttons in toolbar on window nWinNum + *returns number of buttons in toolbar on window nWinNum */ HB_FUNC( WVW_TBBUTTONCOUNT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndTB; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndTB; hWndTB = pWindowData->hToolBar; - if (hWndTB==NULL) + if( hWndTB == NULL ) { - hb_retni( 0 ); - return; + hb_retni( 0 ); + return; } - hb_retni ( SendMessage(hWndTB, TB_BUTTONCOUNT,(WPARAM) 0, (LPARAM) 0) ); + hb_retni( SendMessage( hWndTB, TB_BUTTONCOUNT, ( WPARAM ) 0, ( LPARAM ) 0 ) ); } /*WVW_TBDelButton([nWinNum], nButton) - *nButton is zero based index of button to delete - *index=0 is the leftmost button - *NOTE: button separator is indexed and deleteable too + *nButton is zero based index of button to delete + *index=0 is the leftmost button + *NOTE: button separator is indexed and deleteable too */ HB_FUNC( WVW_TBDELBUTTON ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iButton = HB_ISNUM(2) ? hb_parni(2) : -1; - HWND hWndTB; - USHORT usOldHeight; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iButton = HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1; + HWND hWndTB; + USHORT usOldHeight; hWndTB = pWindowData->hToolBar; - if (hWndTB==NULL || iButton < 0) + if( hWndTB == NULL || iButton < 0 ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } usOldHeight = pWindowData->usTBHeight; - if (! SendMessage(hWndTB, TB_DELETEBUTTON,(WPARAM) iButton, (LPARAM) 0) ) + if( ! SendMessage( hWndTB, TB_DELETEBUTTON, ( WPARAM ) iButton, ( LPARAM ) 0 ) ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } hb_gt_wvwTBinitSize( pWindowData, hWndTB ); - if (pWindowData->usTBHeight != usOldHeight) + if( pWindowData->usTBHeight != usOldHeight ) { - hb_gt_wvwResetWindow( usWinNum ); + hb_gt_wvwResetWindow( usWinNum ); } - hb_retl ( TRUE ); + hb_retl( TRUE ); } /* WVW_TBGetButtonRect([nWinNum], nButton) @@ -359,33 +359,33 @@ HB_FUNC( WVW_TBDELBUTTON ) */ HB_FUNC( WVW_TBGETBUTTONRECT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iButton = HB_ISNUM(2) ? hb_parni(2) : -1; - HWND hWndTB; - RECT rc; - RECT rcRect = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iButton = HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1; + HWND hWndTB; + RECT rc; + RECT rcRect = { 0 }; - PHB_ITEM aXY = hb_itemNew( NULL ); - PHB_ITEM temp; + PHB_ITEM aXY = hb_itemNew( NULL ); + PHB_ITEM temp; hWndTB = pWindowData->hToolBar; - if (hWndTB==NULL || iButton < 0 || !SendMessage(hWndTB, TB_GETRECT, (WPARAM) iButton, (LPARAM) &rc)) + if( hWndTB == NULL || iButton < 0 || ! SendMessage( hWndTB, TB_GETRECT, ( WPARAM ) iButton, ( LPARAM ) &rc ) ) { - hb_itemReturnRelease( aXY ); - return; + hb_itemReturnRelease( aXY ); + return; } temp = hb_itemNew( NULL ); hb_arrayNew( aXY, 4 ); - rcRect = hb_gt_wvwGetColRowFromXYRect( pWindowData, rc ); - hb_arraySetForward( aXY, 1, hb_itemPutNL( temp, max( 0, rcRect.top ) )); - hb_arraySetForward( aXY, 2, hb_itemPutNL( temp, rcRect.left )); + rcRect = hb_gt_wvwGetColRowFromXYRect( pWindowData, rc ); + hb_arraySetForward( aXY, 1, hb_itemPutNL( temp, max( 0, rcRect.top ) ) ); + hb_arraySetForward( aXY, 2, hb_itemPutNL( temp, rcRect.left ) ); - hb_arraySetForward( aXY, 3, hb_itemPutNL( temp, min( pWindowData->ROWS-1, rcRect.bottom ) )); - hb_arraySetForward( aXY, 4, hb_itemPutNL( temp, rcRect.right )); + hb_arraySetForward( aXY, 3, hb_itemPutNL( temp, min( pWindowData->ROWS - 1, rcRect.bottom ) ) ); + hb_arraySetForward( aXY, 4, hb_itemPutNL( temp, rcRect.right ) ); hb_itemRelease( temp ); @@ -394,98 +394,98 @@ HB_FUNC( WVW_TBGETBUTTONRECT ) /*WVW_TBEnableButton([nWinNum], nButton, [lToggle]) - *nButton is zero based index of button to enable/disable - *index=0 is the leftmost button - *NOTE: button separator is indexed too - *returns .t. if successful + *nButton is zero based index of button to enable/disable + *index=0 is the leftmost button + *NOTE: button separator is indexed too + *returns .t. if successful */ HB_FUNC( WVW_TBENABLEBUTTON ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iButton = HB_ISNUM(2) ? hb_parni(2) : -1; - BOOL bEnable = HB_ISLOG(3)? hb_parl(3) : TRUE; - int iCommand; - HWND hWndTB; - USHORT usOldHeight; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iButton = HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1; + BOOL bEnable = HB_ISLOG( 3 ) ? hb_parl( 3 ) : TRUE; + int iCommand; + HWND hWndTB; + USHORT usOldHeight; hWndTB = pWindowData->hToolBar; - if (hWndTB==NULL || iButton < 0) + if( hWndTB == NULL || iButton < 0 ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } - iCommand = IndexToCommand(hWndTB, iButton); - if (iCommand < 0) + iCommand = IndexToCommand( hWndTB, iButton ); + if( iCommand < 0 ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } usOldHeight = pWindowData->usTBHeight; - if (! SendMessage(hWndTB, TB_ENABLEBUTTON,(WPARAM) iCommand, (LPARAM) MAKELONG(bEnable,0) ) ) + if( ! SendMessage( hWndTB, TB_ENABLEBUTTON, ( WPARAM ) iCommand, ( LPARAM ) MAKELONG( bEnable, 0 ) ) ) { - hb_retl( FALSE ); - return; + hb_retl( FALSE ); + return; } hb_gt_wvwTBinitSize( pWindowData, hWndTB ); - if (pWindowData->usTBHeight != usOldHeight) + if( pWindowData->usTBHeight != usOldHeight ) { - hb_gt_wvwResetWindow( usWinNum ); + hb_gt_wvwResetWindow( usWinNum ); } - hb_retl ( TRUE ); + hb_retl( TRUE ); } /*WVW_TBdestroy( [nWinNum] ) - *destroy toolbar for window nWinNum + *destroy toolbar for window nWinNum */ -HB_FUNC( WVW_TBDESTROY) +HB_FUNC( WVW_TBDESTROY ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - if (!(pWindowData->hToolBar==NULL)) + if( ! ( pWindowData->hToolBar == NULL ) ) { - DestroyWindow( pWindowData->hToolBar ); - pWindowData->hToolBar = NULL; - pWindowData->usTBHeight = 0; + DestroyWindow( pWindowData->hToolBar ); + pWindowData->hToolBar = NULL; + pWindowData->usTBHeight = 0; - hb_gt_wvwResetWindow( usWinNum ); + hb_gt_wvwResetWindow( usWinNum ); } } /*WVW_TBINDEX2CMD([nWinNum], nIndex) - *returns Command Id of button nIndex (0 based) - *returns -1 if the button does not exist + *returns Command Id of button nIndex (0 based) + *returns -1 if the button does not exist */ HB_FUNC( WVW_TBINDEX2CMD ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndTB = pWindowData->hToolBar; - int iIndex = hb_parni(2); - int iCmd = IndexToCommand(hWndTB, iIndex); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndTB = pWindowData->hToolBar; + int iIndex = hb_parni( 2 ); + int iCmd = IndexToCommand( hWndTB, iIndex ); - hb_retni( (int) ( iCmd > 0 ? iCmd : -1 ) ); + hb_retni( ( int ) ( iCmd > 0 ? iCmd : -1 ) ); } /*WVW_TBCmd2Index([nWinNum], nCmd) - *returns Index (0 based) of button whose command id is nCmd - *returns -1 if the button does not exist + *returns Index (0 based) of button whose command id is nCmd + *returns -1 if the button does not exist */ HB_FUNC( WVW_TBCMD2INDEX ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - HWND hWndTB = pWindowData->hToolBar; - int iCmd = hb_parni(2); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + HWND hWndTB = pWindowData->hToolBar; + int iCmd = hb_parni( 2 ); - hb_retni( CommandToIndex(hWndTB, iCmd) ); + hb_retni( CommandToIndex( hWndTB, iCmd ) ); } @@ -505,17 +505,17 @@ HB_FUNC( WVW_TBCMD2INDEX ) /*WVW_SetToolTopActive([nWinNum], [lToggle]) */ HB_FUNC( WVW_SETTOOLTIPACTIVE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - BOOL bActive = pWindowData->bToolTipActive; + BOOL bActive = pWindowData->bToolTipActive; - if ( ! HB_ISNIL( 2 ) ) + if( ! HB_ISNIL( 2 ) ) { - if ( hb_parl(2) && (pWindowData->hWndTT==NULL) ) + if( hb_parl( 2 ) && ( pWindowData->hWndTT == NULL ) ) { - hb_gt_wvwCreateToolTipWindow(pWindowData); + hb_gt_wvwCreateToolTipWindow( pWindowData ); } pWindowData->bToolTipActive = hb_parl( 2 ); @@ -530,41 +530,41 @@ HB_FUNC( WVW_SETTOOLTIPACTIVE ) /* */ HB_FUNC( WVW_SETTOOLTIP ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - TOOLINFO ti = { 0 }; - POINT xy = { 0 }; - int iTop, iLeft, iBottom, iRight; + TOOLINFO ti = { 0 }; + POINT xy = { 0 }; + int iTop, iLeft, iBottom, iRight; - USHORT usTop = hb_parni( 2 ), - usLeft = hb_parni( 3 ), - usBottom = hb_parni( 4 ), - usRight = hb_parni( 5 ); + USHORT usTop = hb_parni( 2 ), + usLeft = hb_parni( 3 ), + usBottom = hb_parni( 4 ), + usRight = hb_parni( 5 ); - if ( ! pWindowData->bToolTipActive ) + if( ! pWindowData->bToolTipActive ) { return; } - if (hb_getWvwData()->s_bMainCoordMode) + if( hb_getWvwData()->s_bMainCoordMode ) { - hb_wvw_HBFUNCPrologue(usWinNum, &usTop, &usLeft, &usBottom, &usRight); + hb_wvw_HBFUNCPrologue( usWinNum, &usTop, &usLeft, &usBottom, &usRight ); } - ti.cbSize = sizeof( TOOLINFO ); - ti.hwnd = pWindowData->hWnd; - ti.uId = WVW_ID_BASE_TOOLTIP+usWinNum; + ti.cbSize = sizeof( TOOLINFO ); + ti.hwnd = pWindowData->hWnd; + ti.uId = WVW_ID_BASE_TOOLTIP + usWinNum; - if ( SendMessage( pWindowData->hWndTT, TTM_GETTOOLINFO, 0, ( LPARAM ) &ti ) ) + if( SendMessage( pWindowData->hWndTT, TTM_GETTOOLINFO, 0, ( LPARAM ) &ti ) ) { - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); - iTop = xy.y; - iLeft = xy.x; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usLeft, usTop ); + iTop = xy.y; + iLeft = xy.x; - xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight+1, usBottom+1 ); - iBottom = xy.y - 1; - iRight = xy.x - 1; + xy = hb_gt_wvwGetXYFromColRow( pWindowData, usRight + 1, usBottom + 1 ); + iBottom = xy.y - 1; + iRight = xy.x - 1; ti.lpszText = hb_parc( 6 ); ti.rect.left = iLeft; @@ -580,15 +580,15 @@ HB_FUNC( WVW_SETTOOLTIP ) HB_FUNC( WVW_SETTOOLTIPTEXT ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - TOOLINFO ti; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + TOOLINFO ti; - ti.cbSize = sizeof( TOOLINFO ); - ti.hwnd = pWindowData->hWnd; - ti.uId = 100000; + ti.cbSize = sizeof( TOOLINFO ); + ti.hwnd = pWindowData->hWnd; + ti.uId = 100000; - if ( SendMessage( pWindowData->hWndTT, TTM_GETTOOLINFO, 0, ( LPARAM ) &ti ) ) + if( SendMessage( pWindowData->hWndTT, TTM_GETTOOLINFO, 0, ( LPARAM ) &ti ) ) { ti.lpszText = hb_parcx( 2 ); SendMessage( pWindowData->hWndTT, TTM_UPDATETIPTEXT, 0, ( LPARAM ) &ti ); @@ -599,26 +599,26 @@ HB_FUNC( WVW_SETTOOLTIPTEXT ) HB_FUNC( WVW_SETTOOLTIPMARGIN ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - RECT rc = { 0 }; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + RECT rc = { 0 }; - rc.left = hb_parni( 3 ); - rc.top = hb_parni( 2 ); - rc.right = hb_parni( 5 ); - rc.bottom = hb_parni( 4 ); + rc.left = hb_parni( 3 ); + rc.top = hb_parni( 2 ); + rc.right = hb_parni( 5 ); + rc.bottom = hb_parni( 4 ); SendMessage( pWindowData->hWndTT, TTM_SETMARGIN, 0, ( LPARAM ) &rc ); } HB_FUNC( WVW_SETTOOLTIPWIDTH ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iTipWidth = SendMessage( pWindowData->hWndTT, TTM_GETMAXTIPWIDTH, 0, 0 ); + int iTipWidth = SendMessage( pWindowData->hWndTT, TTM_GETMAXTIPWIDTH, 0, 0 ); - if ( HB_ISNUM( 2 ) ) + if( HB_ISNUM( 2 ) ) { SendMessage( pWindowData->hWndTT, TTM_SETMAXTIPWIDTH, 0, ( LPARAM ) ( int ) hb_parni( 2 ) ); } @@ -630,12 +630,12 @@ HB_FUNC( WVW_SETTOOLTIPWIDTH ) HB_FUNC( WVW_SETTOOLTIPBKCOLOR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - COLORREF cr = SendMessage( pWindowData->hWndTT, TTM_GETTIPBKCOLOR, 0, 0 ); + COLORREF cr = SendMessage( pWindowData->hWndTT, TTM_GETTIPBKCOLOR, 0, 0 ); - if ( HB_ISNUM( 2 ) ) + if( HB_ISNUM( 2 ) ) { SendMessage( pWindowData->hWndTT, TTM_SETTIPBKCOLOR, ( WPARAM ) ( COLORREF ) hb_parnl( 2 ), 0 ); } @@ -646,12 +646,12 @@ HB_FUNC( WVW_SETTOOLTIPBKCOLOR ) HB_FUNC( WVW_SETTOOLTIPTEXTCOLOR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - COLORREF cr = SendMessage( pWindowData->hWndTT, TTM_GETTIPTEXTCOLOR, 0, 0 ); + COLORREF cr = SendMessage( pWindowData->hWndTT, TTM_GETTIPTEXTCOLOR, 0, 0 ); - if ( HB_ISNUM( 2 ) ) + if( HB_ISNUM( 2 ) ) { SendMessage( pWindowData->hWndTT, TTM_SETTIPTEXTCOLOR, ( WPARAM ) ( COLORREF ) hb_parnl( 2 ), 0 ); } @@ -662,16 +662,16 @@ HB_FUNC( WVW_SETTOOLTIPTEXTCOLOR ) HB_FUNC( WVW_SETTOOLTIPTITLE ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); - int iIcon; + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + int iIcon; - if ( ! HB_ISNIL( 3 ) ) + if( ! HB_ISNIL( 3 ) ) { iIcon = HB_ISNIL( 2 ) ? 0 : hb_parni( 2 ); - if ( iIcon > 3 ) + if( iIcon > 3 ) { - iIcon = 0 ; + iIcon = 0; } SendMessage( pWindowData->hWndTT, TTM_SETTITLE, ( WPARAM ) iIcon, ( LPARAM ) hb_parcx( 3 ) ); } @@ -681,8 +681,9 @@ HB_FUNC( WVW_SETTOOLTIPTITLE ) HB_FUNC( WVW_GETTOOLTIPWIDTH ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + hb_retni( SendMessage( pWindowData->hWndTT, TTM_GETMAXTIPWIDTH, 0, 0 ) ); } @@ -690,8 +691,9 @@ HB_FUNC( WVW_GETTOOLTIPWIDTH ) HB_FUNC( WVW_GETTOOLTIPBKCOLOR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + hb_retnl( ( COLORREF ) SendMessage( pWindowData->hWndTT, TTM_GETTIPBKCOLOR, 0, 0 ) ); } @@ -699,8 +701,9 @@ HB_FUNC( WVW_GETTOOLTIPBKCOLOR ) HB_FUNC( WVW_GETTOOLTIPTEXTCOLOR ) { - UINT usWinNum = WVW_WHICH_WINDOW; - WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + UINT usWinNum = WVW_WHICH_WINDOW; + WIN_DATA * pWindowData = hb_gt_wvw_GetWindowsData( usWinNum ); + hb_retnl( ( COLORREF ) SendMessage( pWindowData->hWndTT, TTM_GETTIPTEXTCOLOR, 0, 0 ) ); }