mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
0023712: Remove dependency on Aspect_GraphicDevice from Aspect_Window
This commit is contained in:
@@ -21,10 +21,7 @@ W95_Allocator.cxx
|
||||
WNT_Allocator.cxx
|
||||
WNT_ColorRef.cxx
|
||||
WNT_Dword.cxx
|
||||
WNT_IconBox_1.cxx
|
||||
WNT_ImageProcessor.cxx
|
||||
WNT_LogFont.cxx
|
||||
WNT_Long.cxx
|
||||
WNT_Uint.cxx
|
||||
WNT_WindowData.cxx
|
||||
WNT_WndProc.cxx
|
||||
|
@@ -52,11 +52,6 @@ package WNT
|
||||
-- Category: Classes
|
||||
--------------------
|
||||
|
||||
|
||||
class GraphicDevice;
|
||||
---Purpose: Creates the graphic device associated with DISPLAY.
|
||||
---Category: Classes
|
||||
|
||||
class Window;
|
||||
---Purpose: Creates the Window drawable.
|
||||
---Category: Classes
|
||||
@@ -65,22 +60,10 @@ package WNT
|
||||
---Purpose: Creates a Windows NT window class.
|
||||
---Category: Classes
|
||||
|
||||
class IconBox;
|
||||
---Purpose: Creates the Icon Box window.
|
||||
---Category: Classes
|
||||
|
||||
class ImageManager;
|
||||
---Purpose: Creates and manages images and/or icons.
|
||||
---Category: Classes
|
||||
|
||||
class Image;
|
||||
---Purpose: Defines the class
|
||||
---Category: Classes
|
||||
|
||||
class Icon;
|
||||
---Purpose: Defines the class
|
||||
---Category: Classes
|
||||
|
||||
---------------------------
|
||||
-- Category: Enumerations
|
||||
---------------------------
|
||||
|
@@ -1,190 +0,0 @@
|
||||
-- Created on: 1996-01-25
|
||||
-- Created by: LAVNIKOV Alexey & PLOTNIKOV Eugeny
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
class GraphicDevice from WNT inherits GraphicDevice from Aspect
|
||||
|
||||
---Purpose: This class defines Windows NT display device.
|
||||
-- A Graphic Device defines color management. Windows can run in three
|
||||
-- different color modes depending of the installed graphic board:
|
||||
-- - Low color resolution which allows us to use 16 predefined pure
|
||||
-- colors for drawing lines and unlimited number of dithered colors
|
||||
-- for window's background, solid filled areas etc. Here Graphic Device
|
||||
-- will approximate requested colors by existing ones for line colors
|
||||
-- ( really this approximation is doing by Windows ). A dithering
|
||||
-- technique will be used for window's backgrounds, solid fills etc.
|
||||
-- ( this is doing by WIndows also ). A dithering techique will be use
|
||||
-- for solid fill.
|
||||
-- - Medium color resolution which requires a Windows palette manager.
|
||||
-- This mode takes after X window system's PseudoColor Visual. The
|
||||
-- application can create a LOGICAL PALETTE to represent 20 reserved
|
||||
-- by Windows colors and 236 programmable ones. It's possible to reserve
|
||||
-- odd entries in the palette for highlighting purposes ( but real
|
||||
-- technique is not the same as in X window system - see Windows manual ).
|
||||
-- It's possible to create several logical palettes. To do it create
|
||||
-- other GraphicDevice but in this case color "flicking" is possible.
|
||||
-- - High color resolution. Here 65 536 or 16 777 216 colors are available.
|
||||
-- Any color we like will be exactly displayed on the screen, but
|
||||
-- highlighting technique is not available. This mode often called
|
||||
-- TrueColor but it's not the same as X window TrueColor.
|
||||
-- A Graphic Device also defines physical dimensions of the screen.
|
||||
|
||||
uses
|
||||
|
||||
Color from Quantity,
|
||||
Length from Quantity,
|
||||
ColorMap from Aspect,
|
||||
Handle from Aspect,
|
||||
ColorRef from WNT,
|
||||
HColorTable from WNT,
|
||||
Long from WNT,
|
||||
GraphicDriver from Aspect
|
||||
|
||||
raises
|
||||
|
||||
GraphicDeviceDefinitionError from Aspect,
|
||||
BadAccess from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aColorCube : Boolean from Standard = Standard_False;
|
||||
aDevContext : Handle from Aspect = 0
|
||||
)
|
||||
returns mutable GraphicDevice from WNT
|
||||
---Level: Public
|
||||
---Purpose: Creates a GraphicDevice and logical palette.
|
||||
-- Builds an OpenGL colorcube on that palette depending
|
||||
-- of the aColorCube flag and hardware.
|
||||
-- Warning: Raises if createion of the logical palette failed.
|
||||
raises GraphicDeviceDefinitionError from Aspect;
|
||||
|
||||
Create (
|
||||
aColorCube : Boolean from Standard;
|
||||
aDevContext : Integer from Standard
|
||||
) returns mutable GraphicDevice from WNT
|
||||
---Purpose: same as previous one (to provide access form CCL)
|
||||
raises GraphicDeviceDefinitionError from Aspect;
|
||||
|
||||
Destroy ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Destroies all ressources attached to the GraphicDevice.
|
||||
---C++: alias ~
|
||||
|
||||
SetColor (
|
||||
me : mutable;
|
||||
aColor : Color from Quantity;
|
||||
aHighlight : Boolean from Standard = Standard_False
|
||||
)
|
||||
returns ColorRef from WNT is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the color value in form specific to Windows NT.
|
||||
-- Sets the color values in the logical palette if the
|
||||
-- hardware supports it. If in this case there are not
|
||||
-- free cell in the logical palette then this method will
|
||||
-- search for nearest color in the palette.
|
||||
-- If <aHighlight> is True then sets a highlight color.
|
||||
|
||||
SetColor (
|
||||
me : mutable;
|
||||
aRed : Integer from Standard;
|
||||
aGreen : Integer from Standard;
|
||||
aBlue : Integer from Standard;
|
||||
aHighlight : Boolean from Standard = Standard_False
|
||||
)
|
||||
returns ColorRef from WNT is virtual;
|
||||
---Level: Public
|
||||
---Purpose: See above
|
||||
|
||||
SetColor ( me : mutable; aPixel : Long from WNT )
|
||||
is virtual;
|
||||
---Level: Internal
|
||||
---Purpose: Color allocation for images.
|
||||
|
||||
MapColors (
|
||||
me : mutable;
|
||||
aColorMap : ColorMap from Aspect;
|
||||
aColorTable : in out HColorTable from WNT
|
||||
) is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the color value in form specific to WIndows NT
|
||||
-- in the <aColorTable>. See SetColor method.
|
||||
-- Warning: The dimensions and index ranges of the <aColorMap> and
|
||||
-- <aColorTable> must be the same;
|
||||
|
||||
HPalette ( me ) returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns logical palette handle attached to the
|
||||
-- GraphicDevice.
|
||||
---C++: inline
|
||||
|
||||
DisplaySize ( me; aWidth, aHeight : out Integer from Standard ) is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Display size in PIXEL
|
||||
---C++: inline
|
||||
|
||||
DisplaySize ( me; aWidth, aHeight : out Length from Quantity ) is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Display size in working units units
|
||||
---C++: inline
|
||||
|
||||
IsPaletteDevice ( me ) returns Boolean from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns True if hardware is palette-compatible.
|
||||
---C++: inline
|
||||
|
||||
NumColors ( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns number of available colors.
|
||||
---C++: inline
|
||||
|
||||
HighlightColor ( me ) returns ColorRef from WNT is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns highlight color.
|
||||
---C++: inline
|
||||
|
||||
GraphicDriver ( me ) returns GraphicDriver from Aspect is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Dummy method
|
||||
|
||||
Init (
|
||||
me : mutable;
|
||||
aColorCube : Boolean from Standard;
|
||||
aDevContext : Handle from Aspect
|
||||
) is protected;
|
||||
|
||||
fields
|
||||
|
||||
myMWidth,
|
||||
myMHeight : Length from Quantity is protected;
|
||||
myWidth,
|
||||
myHeight,
|
||||
myNumColors : Integer from Standard is protected;
|
||||
myFreeIndex : Integer from Standard is protected;
|
||||
myPalette : Handle from Aspect is protected;
|
||||
myLogPal : Address from Standard is protected;
|
||||
myHighlightColor : ColorRef from WNT is protected;
|
||||
myOpenGLPalette : Boolean from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class Window from WNT
|
||||
|
||||
end GraphicDevice;
|
@@ -1,725 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
/***********************************************************************
|
||||
FONCTION :
|
||||
----------
|
||||
Classe WNT_GraphicDevice.cxx :
|
||||
|
||||
HISTORIQUE DES MODIFICATIONS :
|
||||
--------------------------------
|
||||
03-01-95 : EUG -> Creation.
|
||||
20-11-97 : FMN -> Portage WIN95
|
||||
MAR-98 : EUG -> Porting Win95
|
||||
JUN-98 : EUG -> Modifications to provide access to this class
|
||||
from CCL (second constructor + Init () method)
|
||||
SEP-98 : DCB -> Avoid memory crash when color indices do not follow
|
||||
each other or do not begin with '1'
|
||||
JAN-99 : EUG -> Modifications to provide treating display window
|
||||
as graphic device
|
||||
************************************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
|
||||
#include <WNT.h>
|
||||
#include <WNT_GraphicDevice.ixx>
|
||||
#include <Aspect_ColorMapEntry.hxx>
|
||||
#include <Aspect_GraphicDriver.hxx>
|
||||
#include <Aspect_Units.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Constantes
|
||||
*/
|
||||
|
||||
#define PAL ((PLOGPALETTE)myLogPal)
|
||||
#define MAX_PAL_ERROR (3*256*256L)
|
||||
#define DEFAULT_GAMMA 1.4
|
||||
|
||||
static int __fastcall _createColorRamp ( HPALETTE* );
|
||||
static BOOL s_SysPalInUse;
|
||||
|
||||
extern HWINSTA ( WINAPI *NTOpenWindowStation ) ( LPTSTR, BOOL, DWORD );
|
||||
extern BOOL ( WINAPI *NTSetProcessWindowStation ) ( HWINSTA );
|
||||
extern HDESK ( WINAPI *NTOpenDesktop ) ( LPTSTR, DWORD, BOOL, DWORD );
|
||||
extern BOOL ( WINAPI *NTSetThreadDesktop ) ( HDESK );
|
||||
extern BOOL ( WINAPI *NTCloseDesktop ) ( HDESK );
|
||||
extern BOOL ( WINAPI *NTCloseWindowStation ) ( HWINSTA );
|
||||
|
||||
extern OSVERSIONINFO WNT_osVer;
|
||||
|
||||
//=======================================================================
|
||||
//function : WNT_GraphicDevice
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_GraphicDevice::WNT_GraphicDevice (
|
||||
const Standard_Boolean aColorCube,
|
||||
const Aspect_Handle aDevContext
|
||||
)
|
||||
{
|
||||
|
||||
Init ( aColorCube, aDevContext );
|
||||
|
||||
} // end constructor ( 1 )
|
||||
|
||||
//=======================================================================
|
||||
//function : WNT_GraphicDevice
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_GraphicDevice::WNT_GraphicDevice (
|
||||
const Standard_Boolean aColorCube,
|
||||
const Standard_Integer aDevContext
|
||||
)
|
||||
{
|
||||
|
||||
Init ( aColorCube, ( Aspect_Handle )aDevContext );
|
||||
|
||||
} // end constructor ( 2 )
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WNT_GraphicDevice::Init (
|
||||
const Standard_Boolean aColorCube,
|
||||
const Aspect_Handle aDevContext
|
||||
)
|
||||
{
|
||||
|
||||
HDC hDC;
|
||||
BOOL palDev;
|
||||
HWND hwnd = NULL;
|
||||
HBITMAP hBmp = NULL;
|
||||
int numRes, palSize, nPlanes, nBits;
|
||||
|
||||
hDC = ( aDevContext == NULL ) ? GetDC ( NULL ) :
|
||||
( HDC )aDevContext, hwnd = WindowFromDC ( ( HDC )aDevContext );
|
||||
|
||||
// It is found that the error occurs in the place in the source code that is
|
||||
// responsible for connecting to the desktop and window pointed by the environment
|
||||
// variable CSF_DISPLAY.
|
||||
// For the moment it is unclear at all what this code is needed for. Therefore it
|
||||
// is removed from the sources in order to fix this bug. This allowed to run the
|
||||
// code without problems on both win32 and win64 platforms.
|
||||
// It is needed to carry out special investigations about this subject. Probably it
|
||||
// can be used to connect to a virtual desktop in order to make snapshots on the
|
||||
// Windows station on which no user is logged in.
|
||||
//
|
||||
// if ( aDevContext == 0 && WNT_osVer.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
|
||||
|
||||
// HWINSTA hWst = NULL;
|
||||
// HDESK hDsk = NULL;
|
||||
// DWORD dwLen, dwLenOrig;
|
||||
// LPTSTR buff = NULL;
|
||||
// LPTSTR sNam = NULL;
|
||||
// LPTSTR dNam = NULL;
|
||||
// BOOL fSts = FALSE;
|
||||
|
||||
// dwLenOrig = GetEnvironmentVariable( TEXT( "CSF_DISPLAY" ), NULL, 0 );
|
||||
|
||||
// if ( dwLenOrig == 0 )
|
||||
|
||||
// dwLen = sizeof ( TEXT( "WinSta0\\Default" ) );
|
||||
|
||||
// else
|
||||
|
||||
// dwLen = dwLenOrig + sizeof ( TCHAR );
|
||||
|
||||
// buff = ( LPTSTR )HeapAlloc (
|
||||
// GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, dwLen
|
||||
// );
|
||||
|
||||
// if ( dwLenOrig != 0 )
|
||||
|
||||
// GetEnvironmentVariable ( TEXT( "CSF_DISPLAY" ), buff, dwLen );
|
||||
|
||||
// else
|
||||
|
||||
// lstrcpy ( buff, TEXT( "WinSta0\\Default" ) );
|
||||
|
||||
// dwLen = 0;
|
||||
|
||||
// while ( buff[ dwLen ] != TEXT( '\\' ) && buff[ dwLen ] != TEXT( '\x00' ) ) ++dwLen;
|
||||
|
||||
// sNam = ( LPTSTR )HeapAlloc (
|
||||
// GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS,
|
||||
// dwLen * sizeof ( TCHAR ) + sizeof ( TCHAR )
|
||||
// );
|
||||
|
||||
// dwLenOrig = 0;
|
||||
|
||||
// while ( dwLenOrig != dwLen ) {
|
||||
|
||||
// sNam[ dwLenOrig ] = buff[ dwLenOrig ];
|
||||
// ++dwLenOrig;
|
||||
|
||||
// } // end while
|
||||
|
||||
// sNam[ dwLenOrig ] = TEXT( '\x00' );
|
||||
|
||||
// if ( buff[ dwLen ] == TEXT( '\x00' ) ) goto leave;
|
||||
|
||||
// lstrcpy ( buff, &buff[ dwLen + 1 ] );
|
||||
|
||||
// dNam = ( LPTSTR )HeapAlloc (
|
||||
// GetProcessHeap (), HEAP_GENERATE_EXCEPTIONS,
|
||||
// lstrlen ( buff ) * sizeof ( TCHAR ) + sizeof ( TCHAR )
|
||||
// );
|
||||
|
||||
// lstrcpy ( dNam, buff );
|
||||
|
||||
// if ( ( hWst = ( *NTOpenWindowStation ) ( sNam, FALSE, MAXIMUM_ALLOWED ) ) == NULL ||
|
||||
// !( *NTSetProcessWindowStation ) ( hWst )
|
||||
// ) goto leave;
|
||||
|
||||
// if ( ( hDsk = ( *NTOpenDesktop ) ( dNam, 0, FALSE, MAXIMUM_ALLOWED ) ) == NULL ||
|
||||
// !( *NTSetThreadDesktop ) ( hDsk )
|
||||
// )
|
||||
|
||||
// if ( GetLastError () == ERROR_BUSY ) {
|
||||
|
||||
// if ( hDsk != NULL ) ( *NTCloseDesktop ) ( hDsk );
|
||||
// if ( hWst != NULL ) ( *NTCloseWindowStation ) ( hWst );
|
||||
|
||||
// } else goto leave;
|
||||
|
||||
// fSts = TRUE;
|
||||
//leave:
|
||||
// if ( sNam != NULL ) HeapFree ( GetProcessHeap (), 0, ( LPVOID )sNam );
|
||||
// if ( dNam != NULL ) HeapFree ( GetProcessHeap (), 0, ( LPVOID )dNam );
|
||||
// if ( buff != NULL ) HeapFree ( GetProcessHeap (), 0, ( LPVOID )buff );
|
||||
|
||||
// if ( !fSts ) {
|
||||
|
||||
// if ( hDsk != NULL ) ( *NTCloseDesktop ) ( hDsk );
|
||||
// if ( hWst != NULL ) ( *NTCloseWindowStation ) ( hWst );
|
||||
|
||||
// Aspect_GraphicDeviceDefinitionError :: Raise ( "Access to station is denied" );
|
||||
|
||||
// } // end if
|
||||
|
||||
// } // end if
|
||||
|
||||
palDev = ( GetDeviceCaps ( hDC, RASTERCAPS ) & RC_PALETTE ) ? TRUE : FALSE;
|
||||
numRes = GetDeviceCaps ( hDC, NUMRESERVED );
|
||||
palSize = ( palDev ) ? GetDeviceCaps ( hDC, SIZEPALETTE ) : 0;
|
||||
nPlanes = GetDeviceCaps ( hDC, PLANES );
|
||||
nBits = GetDeviceCaps ( hDC, BITSPIXEL );
|
||||
myWidth = GetDeviceCaps ( hDC, HORZRES );
|
||||
myHeight = GetDeviceCaps ( hDC, VERTRES );
|
||||
myMWidth = ( float )GetDeviceCaps ( hDC, HORZSIZE ) / ( 1. MILLIMETER );
|
||||
myMHeight = ( float )GetDeviceCaps ( hDC, VERTSIZE ) / ( 1. MILLIMETER );
|
||||
|
||||
if ( aDevContext != NULL && hwnd != NULL ) {
|
||||
|
||||
RECT r;
|
||||
|
||||
GetClientRect ( hwnd, &r );
|
||||
|
||||
myMWidth = myMWidth * r.right / myWidth;
|
||||
myMHeight = myMHeight * r.bottom / myHeight;
|
||||
myWidth = r.right;
|
||||
myHeight = r.bottom;
|
||||
|
||||
} else {
|
||||
|
||||
BITMAP bm;
|
||||
|
||||
hBmp = ( HBITMAP )GetCurrentObject ( hDC, OBJ_BITMAP );
|
||||
|
||||
if ( GetObject ( hBmp, sizeof ( BITMAP ), &bm ) ) {
|
||||
|
||||
myMWidth = myMWidth * bm.bmWidth / myWidth;
|
||||
myMHeight = myMHeight * bm.bmHeight / myHeight;
|
||||
// Tempory correction for Windows 98
|
||||
if ( WNT_osVer.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS ) {
|
||||
//
|
||||
myWidth = bm.bmWidth;
|
||||
myHeight = bm.bmHeight;
|
||||
|
||||
} else hBmp = NULL;
|
||||
// Tempory correction for Windows 98
|
||||
}
|
||||
//
|
||||
|
||||
} // end else
|
||||
|
||||
if ( aDevContext == NULL ) ReleaseDC ( NULL, hDC );
|
||||
|
||||
myNumColors = ( 1 << ( nBits * nPlanes ) );
|
||||
|
||||
if ( palDev ) myNumColors -= numRes;
|
||||
|
||||
myFreeIndex = 0;
|
||||
myOpenGLPalette = aColorCube;
|
||||
|
||||
if ( palDev ) {
|
||||
|
||||
if ( hwnd == NULL && hBmp == NULL ) {
|
||||
|
||||
myLogPal = HeapAlloc (
|
||||
GetProcessHeap (), HEAP_ZERO_MEMORY,
|
||||
sizeof( LOGPALETTE ) +
|
||||
sizeof( PALETTEENTRY ) * myNumColors
|
||||
);
|
||||
|
||||
if ( !myLogPal )
|
||||
|
||||
Aspect_GraphicDeviceDefinitionError :: Raise ( "Out of memory" );
|
||||
|
||||
PAL -> palVersion = 0x300;
|
||||
PAL -> palNumEntries = 1;
|
||||
|
||||
myPalette = CreatePalette ( PAL );
|
||||
|
||||
if ( !myPalette ) {
|
||||
|
||||
HeapFree ( GetProcessHeap (), 0, myLogPal );
|
||||
Aspect_GraphicDeviceDefinitionError :: Raise ( "Unable to create user palette" );
|
||||
|
||||
} // end if
|
||||
|
||||
myFreeIndex = 0;
|
||||
|
||||
if ( myOpenGLPalette && !_createColorRamp ( ( HPALETTE* )&myPalette ) )
|
||||
|
||||
Aspect_GraphicDeviceDefinitionError :: Raise ( "Colorcube creation failed" );
|
||||
|
||||
} else {
|
||||
|
||||
myPalette = GetCurrentObject ( hDC, OBJ_PAL );
|
||||
myLogPal = NULL;
|
||||
|
||||
} // end else
|
||||
|
||||
} else { // not a palette device
|
||||
|
||||
myPalette = 0;
|
||||
myLogPal = NULL;
|
||||
|
||||
} // end else ( palDev . . . )
|
||||
|
||||
myHighlightColor = RGB( 255, 255, 255 );
|
||||
|
||||
} // end WNT_GraphicDevice :: Init
|
||||
|
||||
void WNT_GraphicDevice :: Destroy () {
|
||||
|
||||
if ( myPalette && myLogPal != NULL ) {
|
||||
|
||||
DeletePalette ( myPalette );
|
||||
HeapFree ( GetProcessHeap (), 0, myLogPal );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end WNT_GraphicDevice :: Destroy
|
||||
|
||||
WNT_ColorRef WNT_GraphicDevice :: SetColor (
|
||||
const Quantity_Color& aColor,
|
||||
const Standard_Boolean aHighlight
|
||||
) {
|
||||
|
||||
Standard_Real r, g, b;
|
||||
Standard_Integer red, green, blue;
|
||||
|
||||
aColor.Values ( r, g, b, Quantity_TOC_RGB );
|
||||
|
||||
red = ( Standard_Integer )( 255. * r );
|
||||
green = ( Standard_Integer )( 255. * g );
|
||||
blue = ( Standard_Integer )( 255. * b );
|
||||
|
||||
return SetColor ( red, green, blue, aHighlight );
|
||||
|
||||
} // end WNT_GraphicDevice :: SetColor( 1 )
|
||||
|
||||
WNT_ColorRef WNT_GraphicDevice :: SetColor (
|
||||
const Standard_Integer aRed,
|
||||
const Standard_Integer aGreen,
|
||||
const Standard_Integer aBlue,
|
||||
const Standard_Boolean aHighlight
|
||||
) {
|
||||
|
||||
int i;
|
||||
WNT_ColorRef retVal;
|
||||
BYTE red, green, blue;
|
||||
|
||||
red = ( BYTE )aRed;
|
||||
green = ( BYTE )aGreen;
|
||||
blue = ( BYTE )aBlue;
|
||||
|
||||
if ( !myPalette )
|
||||
|
||||
retVal = RGB( red, green, blue );
|
||||
|
||||
else if ( myOpenGLPalette )
|
||||
|
||||
retVal = PALETTEINDEX(
|
||||
GetNearestPaletteIndex (
|
||||
( HPALETTE )myPalette, RGB( red, green, blue )
|
||||
)
|
||||
);
|
||||
|
||||
else {
|
||||
|
||||
if ( myFreeIndex < myNumColors ) {
|
||||
|
||||
for ( i = 0; i < myFreeIndex; ++i ) // avoid color duplication
|
||||
|
||||
if ( PAL -> palPalEntry[ i ].peRed == red &&
|
||||
PAL -> palPalEntry[ i ].peGreen == green &&
|
||||
PAL -> palPalEntry[ i ].peBlue == blue
|
||||
)
|
||||
|
||||
break;
|
||||
|
||||
if ( i == myFreeIndex ) { // add new color entry
|
||||
|
||||
PAL -> palPalEntry[ i ].peRed = red;
|
||||
PAL -> palPalEntry[ i ].peGreen = green;
|
||||
PAL -> palPalEntry[ i ].peBlue = blue;
|
||||
PAL -> palPalEntry[ i ].peFlags = 0;
|
||||
++myFreeIndex;
|
||||
ResizePalette ( ( HPALETTE )myPalette, myFreeIndex );
|
||||
SetPaletteEntries ( ( HPALETTE )myPalette, i, 1, &PAL -> palPalEntry[ i ] );
|
||||
|
||||
} // end if
|
||||
|
||||
retVal = PALETTEINDEX( i );
|
||||
|
||||
} else // get closest color
|
||||
|
||||
retVal = PALETTEINDEX(
|
||||
GetNearestPaletteIndex (
|
||||
( HPALETTE )myPalette, RGB( red, green, blue )
|
||||
)
|
||||
);
|
||||
|
||||
} // end else ( !myPalette . . . )
|
||||
|
||||
if ( aHighlight )
|
||||
|
||||
myHighlightColor = retVal;
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_GraphicDevice :: SetColor(2)
|
||||
|
||||
void WNT_GraphicDevice :: SetColor ( const WNT_Long& aPixel ) {
|
||||
|
||||
if ( myPalette && !myOpenGLPalette && myFreeIndex < myNumColors ) {
|
||||
|
||||
int idx;
|
||||
BYTE red, green, blue;
|
||||
|
||||
blue = (BYTE) (aPixel & 0xFF);
|
||||
green = (BYTE) (( aPixel >> 8 ) & 0xFF);
|
||||
red = (BYTE) (( aPixel >> 16 ) & 0xFF);
|
||||
|
||||
idx = myFreeIndex;
|
||||
|
||||
for ( int i = 2; i < myFreeIndex; ++i ) // avoid color duplication
|
||||
|
||||
if ( PAL -> palPalEntry[ i ].peRed == red &&
|
||||
PAL -> palPalEntry[ i ].peGreen == green &&
|
||||
PAL -> palPalEntry[ i ].peBlue == blue
|
||||
)
|
||||
|
||||
return;
|
||||
|
||||
PAL -> palPalEntry[ idx ].peRed = red;
|
||||
PAL -> palPalEntry[ idx ].peGreen = green;
|
||||
PAL -> palPalEntry[ idx ].peBlue = blue;
|
||||
PAL -> palPalEntry[ idx ].peFlags = 0;
|
||||
++myFreeIndex;
|
||||
ResizePalette ( ( HPALETTE )myPalette, myFreeIndex );
|
||||
SetPaletteEntries ( ( HPALETTE )myPalette, idx, 1, &PAL -> palPalEntry[ idx ] );
|
||||
|
||||
} // end if ( myPalette . . . )
|
||||
|
||||
} // end WNT_GraphicDevice :: SetColor(3)
|
||||
|
||||
void WNT_GraphicDevice :: MapColors (
|
||||
const Handle( Aspect_ColorMap )& aColorMap,
|
||||
Handle( WNT_HColorTable )& aColorTable
|
||||
) {
|
||||
|
||||
Aspect_ColorMapEntry entry;
|
||||
Quantity_Color color;
|
||||
COLORREF dwColor;
|
||||
Standard_Real r, g, b;
|
||||
int i, index;
|
||||
|
||||
if ( myOpenGLPalette || !IsPaletteDevice () ) // readonly palette or no palette
|
||||
|
||||
for ( i = 1; i <= aColorMap -> Size (); ++i ) {
|
||||
|
||||
entry = aColorMap -> Entry ( i );
|
||||
color = entry.Color ();
|
||||
aColorTable -> SetValue ( entry.Index (), SetColor ( color ) );
|
||||
|
||||
} // end for
|
||||
|
||||
else { // writable palette
|
||||
|
||||
for ( i = 1; i <= aColorMap -> Size (); ++i ) {
|
||||
|
||||
entry = aColorMap -> Entry ( i );
|
||||
color = entry.Color ();
|
||||
dwColor = aColorTable -> Value ( i );
|
||||
index = dwColor & 0x01000000 ? dwColor & 0x00FFFFFF : 0xFFFFFFFF;
|
||||
|
||||
if ( index != 0xFFFFFFFF && index < myFreeIndex ) {
|
||||
|
||||
color.Values ( r, g, b, Quantity_TOC_RGB );
|
||||
PAL -> palPalEntry[ index ].peRed = ( BYTE )( 255. * r );
|
||||
PAL -> palPalEntry[ index ].peGreen = ( BYTE )( 255. * g );
|
||||
PAL -> palPalEntry[ index ].peBlue = ( BYTE )( 255. * b );
|
||||
|
||||
} else
|
||||
|
||||
aColorTable -> SetValue ( i, SetColor ( color ) );
|
||||
|
||||
} // end for
|
||||
|
||||
SetPaletteEntries (
|
||||
( HPALETTE )myPalette, 0, myFreeIndex, &PAL -> palPalEntry[ 0 ]
|
||||
);
|
||||
|
||||
} // end else
|
||||
|
||||
} // WNT_GraphicDevice :: MapColors
|
||||
|
||||
Handle( Aspect_GraphicDriver ) WNT_GraphicDevice :: GraphicDriver () const {
|
||||
|
||||
Handle( Aspect_GraphicDriver ) dummy;
|
||||
|
||||
return dummy;
|
||||
|
||||
} // WNT_GraphicDevice :: GraphicDriver
|
||||
//***//
|
||||
//*** Function to create RGB color map for use with OpenGL. ***//
|
||||
//*** For OpenGL RGB rendering we need to know red, green, & blue ***//
|
||||
//*** component bit sizes and positions. This program creates an RGB color ***//
|
||||
//*** cube with a default gamma of 1.4. ***//
|
||||
//*** Unfortunately, because the standard 20 colors in the system palette ***//
|
||||
//*** cannot be changed, if we select this palette into a display DC, ***//
|
||||
//*** we will not realize all of the logical palette. The function ***//
|
||||
//*** changes some of the entries in the logical palette to match enties in ***//
|
||||
//*** the system palette using a least-squares calculation to find which ***//
|
||||
//*** entries to replace. ***//
|
||||
//***//
|
||||
static int __fastcall _createColorRamp ( HPALETTE* pal ) {
|
||||
|
||||
int i, j;
|
||||
int sysPalSize, logPalSize;
|
||||
int red_max, green_max, blue_max,
|
||||
red_mask, green_mask, blue_mask;
|
||||
int iPf;
|
||||
HDC hDC;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
PPALETTEENTRY sysPal, colorRamp;
|
||||
PBYTE gRed, gGreen, gBlue;
|
||||
BYTE inc;
|
||||
LONG error, min_error, error_index, delta;
|
||||
double dv, gamma;
|
||||
char buff[ 32 ];
|
||||
|
||||
ZeroMemory ( ( PVOID )&pfd, sizeof ( PIXELFORMATDESCRIPTOR ) );
|
||||
|
||||
pfd.nSize = sizeof ( PIXELFORMATDESCRIPTOR );
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 24;
|
||||
pfd.cDepthBits = 32;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
hDC = GetDC ( NULL );
|
||||
|
||||
iPf = ChoosePixelFormat ( hDC, &pfd );
|
||||
i = DescribePixelFormat (
|
||||
hDC, iPf, sizeof ( PIXELFORMATDESCRIPTOR ), &pfd
|
||||
);
|
||||
|
||||
if ( !i ) {
|
||||
|
||||
ReleaseDC ( NULL, hDC );
|
||||
|
||||
return 0;
|
||||
|
||||
} // end if
|
||||
|
||||
sysPalSize = GetDeviceCaps ( hDC, NUMCOLORS );
|
||||
logPalSize = 1 << pfd.cColorBits;
|
||||
sysPal = new PALETTEENTRY[ sysPalSize + logPalSize ];
|
||||
colorRamp = sysPal + sysPalSize;
|
||||
GetSystemPaletteEntries ( hDC, 0, sysPalSize, sysPal );
|
||||
|
||||
ReleaseDC ( NULL, hDC );
|
||||
|
||||
red_max = 1 << pfd.cRedBits;
|
||||
green_max = 1 << pfd.cGreenBits;
|
||||
blue_max = 1 << pfd.cBlueBits;
|
||||
|
||||
red_mask = red_max - 1;
|
||||
green_mask = green_max - 1;
|
||||
blue_mask = blue_max - 1;
|
||||
|
||||
gRed = new BYTE[ red_max + green_max + blue_max ];
|
||||
gGreen = gRed + red_max;
|
||||
gBlue = gGreen + green_max;
|
||||
|
||||
inc = ( BYTE )( 255.0F / ( float )red_mask );
|
||||
|
||||
if ( GetEnvironmentVariable ( "CSF_GammaValue", buff, 32 ) ) {
|
||||
|
||||
gamma = Atof ( buff );
|
||||
|
||||
if ( gamma == 0.0 )
|
||||
|
||||
gamma = DEFAULT_GAMMA;
|
||||
|
||||
} else
|
||||
|
||||
gamma = DEFAULT_GAMMA;
|
||||
|
||||
for ( i = 0; i < red_max; ++i ) {
|
||||
|
||||
gRed[ i ] = ( i * inc ) & 0xFF;
|
||||
dv = ( 255. * pow ( gRed[ i ] / 255., 1. / gamma ) ) + 0.5;
|
||||
gRed[ i ] = ( BYTE )dv;
|
||||
|
||||
} // end for
|
||||
|
||||
inc = ( BYTE )( 255.0F / ( float )green_mask );
|
||||
|
||||
for ( i = 0; i < green_max; ++i ) {
|
||||
|
||||
gGreen[ i ] = ( i * inc ) & 0xFF;
|
||||
dv = ( 255. * pow ( gGreen[ i ] / 255., 1. / gamma ) ) + 0.5;
|
||||
gGreen[ i ] = ( BYTE )dv;
|
||||
|
||||
} // end for
|
||||
|
||||
inc = ( BYTE )( 255.0F / ( float )blue_mask );
|
||||
|
||||
for ( i = 0; i < blue_max; ++i ) {
|
||||
|
||||
gBlue[ i ] = ( i * inc ) & 0xFF;
|
||||
dv = ( 255. * pow ( gBlue[ i ] / 255., 1. / gamma ) ) + 0.5;
|
||||
gBlue[ i ] = ( BYTE )dv;
|
||||
|
||||
} // end for
|
||||
|
||||
for ( i = 0; i < logPalSize; ++i ) {
|
||||
|
||||
colorRamp[ i ].peRed =
|
||||
gRed[ ( i >> pfd.cRedShift ) & red_mask ];
|
||||
colorRamp[ i ].peGreen =
|
||||
gGreen[ ( i >> pfd.cGreenShift ) & green_mask ];
|
||||
colorRamp[ i ].peBlue =
|
||||
gBlue[ ( i >> pfd.cBlueShift ) & blue_mask ];
|
||||
colorRamp[ i ].peFlags = 0;
|
||||
|
||||
} // end for
|
||||
|
||||
if ( pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ) {
|
||||
|
||||
s_SysPalInUse = TRUE;
|
||||
|
||||
for ( i = 1; i < logPalSize - 1; ++i ) colorRamp[ i ].peFlags = PC_NOCOLLAPSE;
|
||||
|
||||
} else {
|
||||
|
||||
for ( i = 0; i < sysPalSize; ++i )
|
||||
|
||||
for ( j = 0; j < logPalSize; ++j )
|
||||
|
||||
if ( sysPal[ i ].peRed == colorRamp[ j ].peRed &&
|
||||
sysPal[ i ].peGreen == colorRamp[ j ].peRed &&
|
||||
sysPal[ i ].peBlue == colorRamp[ j ].peRed
|
||||
)
|
||||
|
||||
sysPal[ i ].peFlags = colorRamp[ i ].peFlags = 1;
|
||||
|
||||
else
|
||||
|
||||
sysPal[ i ].peFlags = colorRamp[ i ].peFlags = 0;
|
||||
|
||||
for ( i = 0; i < sysPalSize; ++i ) {
|
||||
|
||||
if ( sysPal[ i ].peFlags ) continue;
|
||||
|
||||
min_error = MAX_PAL_ERROR;
|
||||
|
||||
for ( j = 0; j < logPalSize; ++j ) {
|
||||
|
||||
if ( colorRamp[ j ].peFlags ) continue;
|
||||
|
||||
delta = colorRamp[ j ].peRed - sysPal[ i ].peRed;
|
||||
error = delta * delta;
|
||||
delta = colorRamp[ j ].peGreen - sysPal[ i ].peGreen;
|
||||
error += delta * delta;
|
||||
delta = colorRamp[ j ].peBlue - sysPal[ i ].peBlue;
|
||||
error += delta * delta;
|
||||
|
||||
if ( error < min_error ) {
|
||||
|
||||
error_index = j;
|
||||
min_error = error;
|
||||
|
||||
} // end if
|
||||
|
||||
} // end for ( j . . . )
|
||||
|
||||
colorRamp[ error_index ].peRed = sysPal[ i ].peRed;
|
||||
colorRamp[ error_index ].peGreen = sysPal[ i ].peGreen;
|
||||
colorRamp[ error_index ].peBlue = sysPal[ i ].peBlue;
|
||||
colorRamp[ error_index ].peFlags = PC_EXPLICIT;
|
||||
|
||||
} // end for ( i . . . )
|
||||
|
||||
} // end else
|
||||
|
||||
ResizePalette ( *pal, logPalSize );
|
||||
SetPaletteEntries ( *pal, 0, logPalSize, colorRamp );
|
||||
|
||||
delete [] gRed;
|
||||
delete [] sysPal;
|
||||
|
||||
return 1;
|
||||
|
||||
} // end createColorRamp
|
||||
|
||||
int WNT_SysPalInUse ( void ) {
|
||||
|
||||
return s_SysPalInUse;
|
||||
|
||||
} // end WNT_SysPalInUse
|
@@ -1,59 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
inline Aspect_Handle WNT_GraphicDevice :: HPalette () const {
|
||||
|
||||
return myPalette;
|
||||
|
||||
} // end WNT_GraphicDevice :: HPalette
|
||||
|
||||
inline void WNT_GraphicDevice :: DisplaySize (
|
||||
Standard_Integer& aWidth, Standard_Integer& aHeight
|
||||
) const {
|
||||
|
||||
aWidth = myWidth;
|
||||
aHeight = myHeight;
|
||||
|
||||
} // end WNT_GraphicDevice :: DisplaySize
|
||||
|
||||
inline void WNT_GraphicDevice :: DisplaySize (
|
||||
Quantity_Length& aWidth, Quantity_Length& aHeight
|
||||
) const {
|
||||
aWidth = myMWidth;
|
||||
aHeight = myMHeight;
|
||||
|
||||
} // end WNT_GraphicDevice :: DisplaySize
|
||||
|
||||
inline Standard_Boolean WNT_GraphicDevice :: IsPaletteDevice () const {
|
||||
|
||||
return ( myPalette != 0 );
|
||||
|
||||
} // end WNT_GraphicDevice :: IsPaletteDevice
|
||||
|
||||
inline Standard_Integer WNT_GraphicDevice :: NumColors () const {
|
||||
|
||||
return myNumColors;
|
||||
|
||||
} // end WNT_GraphicDevice :: NumColors
|
||||
|
||||
inline WNT_ColorRef WNT_GraphicDevice :: HighlightColor () const {
|
||||
|
||||
return myHighlightColor;
|
||||
|
||||
} // end WNT_GraphicDevice :: HighlightColor
|
||||
|
@@ -1,59 +0,0 @@
|
||||
-- Created by: PLOTNIKOV Eugeny
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
class Icon from WNT inherits Image from WNT
|
||||
|
||||
---Purpose: Internal class for icon management
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aName : CString from Standard;
|
||||
aBitmap : Handle from Aspect;
|
||||
aHashCode : Integer from Standard
|
||||
)
|
||||
returns mutable Icon from WNT;
|
||||
---Purpose: Creates a class.
|
||||
|
||||
Destroy ( me : mutable ) is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Destroys all resources attached to the Icon.
|
||||
---C++: alias ~
|
||||
|
||||
SetName ( me : mutable; aName : CString from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets a name for icon.
|
||||
|
||||
fields
|
||||
|
||||
myName : PCharacter from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class ImageManager from WNT,
|
||||
class IconBox from WNT
|
||||
|
||||
end Icon;
|
@@ -1,68 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#include <WNT_Icon.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : WNT_Icon
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_Icon::WNT_Icon (
|
||||
const Standard_CString aName,
|
||||
const Aspect_Handle aBitmap,
|
||||
const Standard_Integer aHashCode
|
||||
) : WNT_Image ( aBitmap, aHashCode )
|
||||
{
|
||||
|
||||
myName = new char[ strlen ( aName ) + 1 ];
|
||||
|
||||
strcpy ( myName, aName );
|
||||
|
||||
} // end constructor
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WNT_Icon::Destroy () {
|
||||
|
||||
delete [] myName;
|
||||
|
||||
} // end WNT_Icon :: Destroy
|
||||
|
||||
//=======================================================================
|
||||
//function : SetName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WNT_Icon::SetName ( const Standard_CString aName ) {
|
||||
|
||||
if ( strlen ( myName ) < strlen ( aName ) ) {
|
||||
|
||||
delete [] myName;
|
||||
|
||||
myName = new char[ strlen ( aName ) + 1 ];
|
||||
|
||||
} // end if
|
||||
|
||||
strcpy ( myName, aName );
|
||||
|
||||
} // end WNT_Icon :: SetName
|
@@ -1,195 +0,0 @@
|
||||
-- Created on: 1996-01-29
|
||||
-- Created by: PLOTNIKOV Eugeny
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
|
||||
class IconBox from WNT inherits Window from WNT
|
||||
|
||||
---Purpose: This class defines a Windows NT icon box
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect,
|
||||
GraphicDevice from WNT,
|
||||
WClass from WNT,
|
||||
Window from WNT,
|
||||
Uint from WNT,
|
||||
Long from WNT,
|
||||
Dword from WNT,
|
||||
NameOfColor from Quantity
|
||||
|
||||
raises
|
||||
|
||||
WindowDefinitionError from Aspect,
|
||||
WindowError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aName : CString from Standard;
|
||||
aStyle : Dword from WNT = 0;
|
||||
Xc : Real from Standard = 0.5;
|
||||
Yc : Real from Standard = 0.5;
|
||||
aBkColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
)
|
||||
returns mutable IconBox from WNT
|
||||
---Level: Public
|
||||
---Purpose: Creates an IconBox defined by his Center in DSU.
|
||||
-- ALL Icons are loaded from the Icon File Directory Name:
|
||||
-- "[$SYMBOL]xxxxxxx[.ifd]"
|
||||
-- Warning: Raises if the Position is out of the Screen Space
|
||||
-- or the Icon File Directory Name don't exist
|
||||
raises WindowDefinitionError from Aspect;
|
||||
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
LoadIcons ( me : mutable; Name : CString from Standard )
|
||||
returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Loads Icon Box from an Other Icon File Directory Name
|
||||
-- and returns the loaded icons number.
|
||||
-- Warning: The Icons previously loaded are NOT cleared.
|
||||
|
||||
Show ( me ) is static;
|
||||
---Level: Public
|
||||
---Purpose: Shows Icon Box to the screen
|
||||
-- Warning: The Icon Box is displayed at the centered position
|
||||
-- specified at the creation time and the size depend
|
||||
-- of the Icon number really loaded inside.
|
||||
|
||||
UnloadIcons (
|
||||
me : mutable;
|
||||
Name : CString from Standard
|
||||
)
|
||||
returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Unloads All previously loaded Icons in the IconBox
|
||||
-- and returns the unloaded icons number.
|
||||
|
||||
Destroy ( me : mutable ) is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Destroies the IconBox
|
||||
---C++: alias ~
|
||||
|
||||
AddIcon (
|
||||
me : mutable;
|
||||
W : Window from WNT;
|
||||
Name : CString from Standard;
|
||||
aWidth : Integer from Standard = 0;
|
||||
aHeight : Integer from Standard = 0
|
||||
) is static;
|
||||
---Level: Public
|
||||
---Purpose: Adds an Icon of Size aWidth,aHeight given in PIXEL
|
||||
-- to the Icon Box from a FULL Existing Window
|
||||
-- NOTE that if aWidth or aHeight is 0 the default icon size is taken.
|
||||
|
||||
SaveIcons ( me ) returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Save all new created Icons as iconname.xwd file in the user
|
||||
-- directory and returns the saved icons number.
|
||||
|
||||
SetDim (
|
||||
me : mutable;
|
||||
aWidth : Integer from Standard;
|
||||
aHeight : Integer from Standard
|
||||
) is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets dimensions for icons which are visible in the box.
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
|
||||
IconNumber ( me )
|
||||
returns Integer from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Number of Icons loaded in the Icon Box.
|
||||
|
||||
IconName ( me; Index : Integer from Standard )
|
||||
returns CString from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the Name of the N ime Icon
|
||||
-- Warning: Raises if Index if out of range depending of the
|
||||
-- Number of Loaded Icons.
|
||||
raises WindowError from Aspect is static;
|
||||
|
||||
IconSize (
|
||||
me;
|
||||
Name : CString from Standard;
|
||||
Width, Height : out Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Pixmap Size attached to the Icon Name
|
||||
-- Warning: May return FALSE if Icon doesn't exist in the IconBox.
|
||||
---Category: Inquire methods
|
||||
|
||||
IconPixmap ( me; Name : CString from Standard )
|
||||
returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Pixmap attached to the Icon Name
|
||||
-- Warning: May return 0 if Icon doesn't exist in the IconBox.
|
||||
|
||||
IconPixmap (
|
||||
me;
|
||||
Name : CString from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard
|
||||
) returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Centered part of the Pixmap of required Size
|
||||
-- attached to the Icon Name
|
||||
-- Warning: May return 0 if Icon doesn't exist in the IconBox.
|
||||
|
||||
HandleEvent (
|
||||
me : mutable;
|
||||
hwnd : Handle from Aspect;
|
||||
uMsg : Uint from WNT;
|
||||
wParam : Dword from WNT;
|
||||
lParam : Dword from WNT
|
||||
)
|
||||
returns Long from WNT is static;
|
||||
---Level: Internal
|
||||
---Purpose: routine to process events sent to the icon box
|
||||
fields
|
||||
|
||||
myIconWidth : Integer from Standard is protected;
|
||||
myIconHeight : Integer from Standard is protected;
|
||||
myFont : Handle from Aspect is protected;
|
||||
myPen : Handle from Aspect is protected;
|
||||
|
||||
-- fields for event management
|
||||
|
||||
myDragging : Boolean from Standard is protected;
|
||||
myStart,
|
||||
myIncX,
|
||||
myIncY,
|
||||
myNX,
|
||||
myNY,
|
||||
myNPos,
|
||||
myMaxPos : Integer from Standard is protected;
|
||||
|
||||
end IconBox;
|
@@ -1,542 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include <WNT_IconBox.ixx>
|
||||
|
||||
#include <WNT_WClass.hxx>
|
||||
#include <WNT_ImageManager.hxx>
|
||||
#include <WNT_Icon.hxx>
|
||||
|
||||
//***//
|
||||
static void __fastcall _get_filename ( char*, int, char*, char* );
|
||||
//***//
|
||||
HBITMAP LoadImageFromFile ( Handle( WNT_GraphicDevice )&, char*, HDC = NULL );
|
||||
int SaveBitmapToFile (
|
||||
Handle( WNT_GraphicDevice )& gDev,
|
||||
HBITMAP, char*, int, int, int, int
|
||||
);
|
||||
LRESULT CALLBACK WNT_IconBoxWndProc ( HWND, UINT, WPARAM, LPARAM );
|
||||
//***//
|
||||
//*************************** Constructor *******************************//
|
||||
//***//
|
||||
WNT_IconBox :: WNT_IconBox (
|
||||
const Handle( WNT_GraphicDevice )& aDevice,
|
||||
const Standard_CString aName,
|
||||
const WNT_Dword& aStyle,
|
||||
const Standard_Real Xc,
|
||||
const Standard_Real Yc,
|
||||
const Quantity_NameOfColor aBkColor
|
||||
) : WNT_Window (
|
||||
aDevice, aName,
|
||||
new WNT_WClass (
|
||||
"WNT_IconBoxClass", WNT_IconBoxWndProc,
|
||||
CS_HREDRAW | CS_VREDRAW
|
||||
),
|
||||
aStyle | WS_VSCROLL,
|
||||
Xc, Yc, 0.5, 0.2, aBkColor
|
||||
) {
|
||||
|
||||
if ( LoadIcons ( aName ) == 0 )
|
||||
|
||||
Aspect_WindowDefinitionError :: Raise ( "Unable to load icons" );
|
||||
|
||||
myFont = NULL;
|
||||
SetDim ( 70, 70 );
|
||||
myStart = 1;
|
||||
|
||||
myPen = CreatePen ( PS_SOLID, 3, RGB( 0, 255, 0 ) );
|
||||
|
||||
} // end constructor
|
||||
//***//
|
||||
//********************************* Destroy *****************************//
|
||||
//***//
|
||||
void WNT_IconBox :: Destroy () {
|
||||
|
||||
if ( myFont != NULL )
|
||||
|
||||
DeleteObject ( myFont );
|
||||
|
||||
if ( myPen != NULL )
|
||||
|
||||
DeleteObject ( myPen );
|
||||
|
||||
} // end WNT_IconBox :: Destroy
|
||||
//***//
|
||||
//******************************* LoadIcons *****************************//
|
||||
//***//
|
||||
Standard_Integer WNT_IconBox :: LoadIcons (
|
||||
const Standard_CString Name
|
||||
) {
|
||||
|
||||
int len;
|
||||
Standard_Integer retVal = 0;
|
||||
ifstream is;
|
||||
char fileName[ MAX_PATH ];
|
||||
char fName[ MAX_PATH ];
|
||||
char iName[ MAX_PATH ];
|
||||
Standard_Integer iHCode;
|
||||
HBITMAP hBmp;
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
_get_filename ( fileName, MAX_PATH, (Standard_PCharacter)Name, "ifd" );
|
||||
|
||||
is.open ( fileName );
|
||||
|
||||
if ( is ) {
|
||||
|
||||
while ( !is.eof () ) {
|
||||
|
||||
is >> fName >> iName;
|
||||
|
||||
if ( is.bad () ) break;
|
||||
|
||||
if ( fName[ 0 ] == '\x00' || iName[ 0 ] == '\x00' ) continue;
|
||||
|
||||
if ( fName[ 0 ] == '#' ) continue;
|
||||
|
||||
_get_filename ( fileName, MAX_PATH, fName, "" );
|
||||
|
||||
iHCode = myImages -> StringHashCode ( fileName );
|
||||
len = myImages -> Size ();
|
||||
int i;
|
||||
|
||||
for ( i = 1; i <= len; ++i )
|
||||
|
||||
if ( myImages -> HashCode ( i ) == iHCode ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( lstrcmp ( iName, icon -> myName ) ) {
|
||||
|
||||
i = len + 1;
|
||||
break;
|
||||
|
||||
} /* end if */
|
||||
|
||||
} /* end if */
|
||||
|
||||
if ( i > len ) {
|
||||
|
||||
hBmp = LoadImageFromFile ( gDev, fileName );
|
||||
|
||||
if ( hBmp ) {
|
||||
|
||||
icon = new WNT_Icon ( iName, hBmp, iHCode );
|
||||
myImages -> Add ( icon );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if ( i > len . . . )
|
||||
|
||||
fName[ 0 ] = iName[ 0 ] = '\x00';
|
||||
|
||||
} // end while
|
||||
|
||||
retVal = myImages -> Size ();
|
||||
|
||||
} // end if
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_IconBox :: LoadIcons
|
||||
//***//
|
||||
//********************************** Show *******************************//
|
||||
//***//
|
||||
void WNT_IconBox :: Show () const {
|
||||
|
||||
Map ();
|
||||
|
||||
} // end WNT_IconBox :: Show
|
||||
//***//
|
||||
//******************************* UnloadIcons ***************************//
|
||||
//***//
|
||||
Standard_Integer WNT_IconBox :: UnloadIcons (
|
||||
const Standard_CString Name
|
||||
) {
|
||||
|
||||
Standard_Integer retVal = 0;
|
||||
ifstream is;
|
||||
char fileName[ MAX_PATH ];
|
||||
char fName[ MAX_PATH ];
|
||||
char iName[ MAX_PATH ];
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
_get_filename ( fileName, MAX_PATH, (Standard_PCharacter)Name, "ifd" );
|
||||
|
||||
is.open ( fileName );
|
||||
|
||||
if ( is ) {
|
||||
|
||||
while ( !is.eof () ) {
|
||||
|
||||
is >> fName >> iName;
|
||||
|
||||
if ( is.bad () ) break;
|
||||
|
||||
if ( fName[ 0 ] == '#' ) continue;
|
||||
|
||||
for ( int i = 1; i <= myImages -> Size (); ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( icon.IsNull () ) continue;
|
||||
|
||||
if ( lstrcmp ( icon -> myName, iName ) ) continue;
|
||||
|
||||
myImages -> Delete ( i );
|
||||
++retVal;
|
||||
|
||||
} // end for
|
||||
|
||||
} // end while
|
||||
|
||||
} // end if
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_IconBox :: UnloadIcons
|
||||
//***//
|
||||
//********************************* AddIcon *****************************//
|
||||
//***//
|
||||
void WNT_IconBox :: AddIcon (
|
||||
const Handle( WNT_Window )& W,
|
||||
const Standard_CString Name,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight
|
||||
) {
|
||||
|
||||
Handle( WNT_Icon ) icon = W -> myIcon;
|
||||
|
||||
if ( !icon.IsNull () )
|
||||
|
||||
myImages -> Add ( W -> myIcon );
|
||||
|
||||
} // end WNT_IconBox :: AddIcon
|
||||
//***//
|
||||
//********************************* SaveIcons ***************************//
|
||||
//***//
|
||||
Standard_Integer WNT_IconBox :: SaveIcons () const {
|
||||
|
||||
int w, h;
|
||||
Standard_Integer retVal = 0;
|
||||
char ext[ 5 ];
|
||||
char fName[ MAX_PATH ];
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
switch ( myFormat ) {
|
||||
|
||||
case WNT_TOI_XWD:
|
||||
|
||||
strcpy ( ext, ".xwd" );
|
||||
|
||||
break;
|
||||
|
||||
case WNT_TOI_BMP:
|
||||
|
||||
strcpy ( ext, ".bmp" );
|
||||
|
||||
break;
|
||||
|
||||
case WNT_TOI_GIF:
|
||||
|
||||
strcpy ( ext, ".gif" );
|
||||
|
||||
} // end switch
|
||||
|
||||
for ( int i = 1; i <= myImages -> Size (); ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( icon.IsNull () ) continue;
|
||||
|
||||
strcpy ( fName, icon -> myName );
|
||||
|
||||
if ( strchr ( fName, '.' ) == NULL )
|
||||
|
||||
strcat ( fName, ext );
|
||||
|
||||
myImages -> Dim ( i, w, h );
|
||||
|
||||
if ( SaveBitmapToFile (
|
||||
gDev, ( HBITMAP )( myImages -> ImageHandle ( i ) ), fName,
|
||||
0, 0, w, h
|
||||
)
|
||||
)
|
||||
|
||||
++retVal;
|
||||
|
||||
} // end for
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_IconBox :: SaveIcons
|
||||
//***//
|
||||
//********************************* IconNumber **************************//
|
||||
//***//
|
||||
Standard_Integer WNT_IconBox :: IconNumber () const {
|
||||
|
||||
return myImages -> Size ();
|
||||
|
||||
} // end WNT_IconBox :: IconNumber
|
||||
//***//
|
||||
//********************************* IconName ****************************//
|
||||
//***//
|
||||
Standard_CString WNT_IconBox :: IconName (
|
||||
const Standard_Integer Index
|
||||
) const {
|
||||
|
||||
Handle( WNT_Icon ) icon = Handle( WNT_Icon ) :: DownCast (
|
||||
myImages -> Image ( Index )
|
||||
);
|
||||
|
||||
return icon -> myName;
|
||||
|
||||
} // end WNT_IconBox :: IconName
|
||||
//***//
|
||||
//********************************* IconSize ****************************//
|
||||
//***//
|
||||
Standard_Boolean WNT_IconBox :: IconSize (
|
||||
const Standard_CString Name,
|
||||
Standard_Integer& Width,
|
||||
Standard_Integer& Height
|
||||
) const {
|
||||
|
||||
int i, len = myImages -> Size ();
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
for ( i = 1; i <= len; ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( !strcmp ( icon -> myName, Name ) ) break;
|
||||
|
||||
} // end for
|
||||
|
||||
return ( i > len ) ? Standard_False :
|
||||
myImages -> Dim ( i, Width, Height ), Standard_True;
|
||||
|
||||
} // end WNT_IconBox :: IconSize
|
||||
//***//
|
||||
//********************************* IconPixmap (1) **********************//
|
||||
//***//
|
||||
Aspect_Handle WNT_IconBox :: IconPixmap (
|
||||
const Standard_CString Name
|
||||
) const {
|
||||
|
||||
int i, len = myImages -> Size ();
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
for ( i = 1; i <= len; ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( !strcmp ( icon -> myName, Name ) ) break;
|
||||
|
||||
} // end for
|
||||
|
||||
return ( i > len ) ? NULL : myImages -> ImageHandle ( i );
|
||||
|
||||
} // end WNT_IconBox :: IconPixmap
|
||||
//***//
|
||||
//********************************* IconPixmap (2) **********************//
|
||||
//***//
|
||||
Aspect_Handle WNT_IconBox :: IconPixmap (
|
||||
const Standard_CString Name,
|
||||
const Standard_Integer Width,
|
||||
const Standard_Integer Height
|
||||
) const {
|
||||
|
||||
HBITMAP retVal = NULL;
|
||||
int len = myImages -> Size ();
|
||||
int i, w, h;
|
||||
Handle( WNT_Icon ) icon;
|
||||
HPALETTE hOldPal;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
for ( i = 1; i <= len; ++i ) {
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );
|
||||
|
||||
if ( !strcmp ( icon -> myName, Name ) ) break;
|
||||
|
||||
} // end for
|
||||
|
||||
if ( i <= len ) {
|
||||
|
||||
HDC hDC, hDCmemSrc, hDCmemDst;
|
||||
|
||||
hDC = GetDC ( NULL );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () ) {
|
||||
|
||||
hOldPal = SelectPalette ( hDC, ( HPALETTE )( gDev -> HPalette () ), FALSE );
|
||||
RealizePalette ( hDC );
|
||||
|
||||
} // end if
|
||||
|
||||
hDCmemSrc = CreateCompatibleDC ( hDC );
|
||||
hDCmemDst = CreateCompatibleDC ( hDC );
|
||||
|
||||
retVal = CreateCompatibleBitmap ( hDC, Width, Height );
|
||||
|
||||
if ( retVal != NULL ) {
|
||||
|
||||
myImages -> Dim ( i, w, h );
|
||||
|
||||
SelectBitmap ( hDCmemSrc, myImages -> ImageHandle ( i ) );
|
||||
SelectBitmap ( hDCmemDst, retVal );
|
||||
|
||||
BitBlt (
|
||||
hDCmemDst, 0, 0, Width, Height, hDCmemSrc,
|
||||
w / 2 - Width / 2, h / 2 - Height / 2, SRCCOPY
|
||||
);
|
||||
|
||||
} // end if
|
||||
|
||||
DeleteDC ( hDCmemDst );
|
||||
DeleteDC ( hDCmemSrc );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () )
|
||||
|
||||
SelectPalette ( hDC, hOldPal, FALSE );
|
||||
|
||||
ReleaseDC ( NULL, hDC );
|
||||
|
||||
} // end if
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_IconBox :: IconPixmap
|
||||
//***//
|
||||
//******************************* SetDim ********************************//
|
||||
//***//
|
||||
void WNT_IconBox :: SetDim (
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight
|
||||
) {
|
||||
|
||||
LOGFONT lf;
|
||||
|
||||
myIconWidth = aWidth;
|
||||
myIconHeight = aHeight;
|
||||
|
||||
ZeroMemory ( &lf, sizeof ( LOGFONT ) );
|
||||
|
||||
lf.lfHeight = myIconHeight / 5;
|
||||
strcpy ( lf.lfFaceName, "Modern" );
|
||||
|
||||
if ( myFont != NULL ) DeleteObject ( myFont );
|
||||
|
||||
myFont = CreateFontIndirect ( &lf );
|
||||
|
||||
} // end WNT_IconBox :: SetDim
|
||||
//***//
|
||||
//***********************************************************************//
|
||||
//***//
|
||||
static void __fastcall _get_filename ( char* retVal, int len, char* name, char* ext ) {
|
||||
|
||||
char* ptr, *ptr1;
|
||||
char eNameVal[ MAX_PATH ];
|
||||
char fNameVal[ MAX_PATH ];
|
||||
DWORD eNameLen;
|
||||
|
||||
len = Min ( MAX_PATH, len );
|
||||
|
||||
ZeroMemory ( ( PVOID )eNameVal, sizeof ( eNameVal ) );
|
||||
ZeroMemory ( ( PVOID )fNameVal, sizeof ( fNameVal ) );
|
||||
|
||||
if ( name != NULL ) {
|
||||
|
||||
strncpy ( fNameVal, name, len );
|
||||
|
||||
if ( *name == '$' ) {
|
||||
|
||||
ptr = strpbrk ( fNameVal, "\\/" );
|
||||
|
||||
if ( ptr != NULL ) {
|
||||
|
||||
*ptr++ = '\x00';
|
||||
ptr1 = fNameVal + 1;
|
||||
|
||||
if (
|
||||
( eNameLen = GetEnvironmentVariable ( ptr1, eNameVal, MAX_PATH ) ) != 0
|
||||
)
|
||||
|
||||
strncpy ( retVal, eNameVal, len );
|
||||
|
||||
strncat ( retVal, "\\", len );
|
||||
|
||||
} else
|
||||
|
||||
ptr = fNameVal;
|
||||
|
||||
strncat ( retVal, ptr, len );
|
||||
|
||||
} else
|
||||
|
||||
strncpy ( retVal, fNameVal, len );
|
||||
|
||||
if ( strpbrk ( retVal, "." ) == NULL ) {
|
||||
|
||||
strncat ( retVal, ".", len );
|
||||
strncat ( retVal, ext, len );
|
||||
|
||||
} // end if
|
||||
|
||||
ptr = retVal;
|
||||
|
||||
for ( int i = 0; i < ( int )( strlen ( retVal ) ); ++i )
|
||||
|
||||
if ( ptr[ i ] == '/' ) ptr[ i ] = '\\';
|
||||
|
||||
} // end if
|
||||
|
||||
} // end _get_filename
|
||||
//***//
|
||||
//***********************************************************************//
|
||||
//***//
|
||||
LRESULT CALLBACK WNT_IconBoxWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WINDOW_DATA* wd = (WINDOW_DATA* )GetWindowLongPtr (hwnd, GWLP_USERDATA);
|
||||
if (wd != NULL)
|
||||
{
|
||||
WNT_IconBox* ib = (WNT_IconBox* )(wd->WNT_Window_Ptr);
|
||||
return ib->HandleEvent (hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
return DefWindowProc (hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
} // end WNT_IconBoxWndProc
|
||||
//***//
|
||||
//***********************************************************************//
|
@@ -1,281 +0,0 @@
|
||||
// Copyright (c) 2008-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
#include <WNT_IconBox.hxx>
|
||||
|
||||
#include <WNT_GraphicDevice.hxx>
|
||||
#include <WNT_ImageManager.hxx>
|
||||
#include <WNT_Icon.hxx>
|
||||
|
||||
#define X_SPACING 10
|
||||
#define Y_SPACING 10
|
||||
|
||||
//=======================================================================
|
||||
//function : HandleEvent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_Long WNT_IconBox::HandleEvent (
|
||||
const Aspect_Handle hwnd,
|
||||
const WNT_Uint& uMsg,
|
||||
const WNT_Dword& wParam,
|
||||
const WNT_Dword& lParam
|
||||
)
|
||||
{
|
||||
|
||||
switch ( uMsg ) {
|
||||
|
||||
case WM_SIZE : {
|
||||
|
||||
int len;
|
||||
RECT r;
|
||||
SCROLLINFO si;
|
||||
|
||||
GetClientRect ( ( HWND )hwnd, &r );
|
||||
|
||||
myIncX = myIconWidth + X_SPACING + 6;
|
||||
myNX = r.right / myIncX;
|
||||
|
||||
if ( myNX == 0 ) ++myNX;
|
||||
|
||||
myIncY = myIconHeight + Y_SPACING + 11 + myIconHeight / Y_SPACING;
|
||||
myNY = r.bottom / myIncY;
|
||||
|
||||
if ( myNY == 0 ) ++myNY;
|
||||
|
||||
len = myImages -> Size ();
|
||||
|
||||
if ( myNX * myNY >= len )
|
||||
|
||||
ShowScrollBar ( ( HWND )hwnd, SB_VERT, FALSE );
|
||||
|
||||
else {
|
||||
|
||||
si.cbSize = sizeof ( SCROLLINFO );
|
||||
si.fMask = SIF_POS | SIF_RANGE;
|
||||
si.nPos = myNPos = 0;
|
||||
si.nMin = 0;
|
||||
si.nMax = myMaxPos = len / myNX;
|
||||
|
||||
SetScrollInfo ( ( HWND )hwnd, SB_VERT, &si, TRUE );
|
||||
ShowScrollBar ( ( HWND )hwnd, SB_VERT, TRUE );
|
||||
myStart = 1;
|
||||
|
||||
} // end else
|
||||
|
||||
return 0;
|
||||
|
||||
} // WM_SIZE
|
||||
|
||||
case WM_VSCROLL : {
|
||||
|
||||
int nCurPos;
|
||||
int nScrollCode;
|
||||
int newStart;
|
||||
int len;
|
||||
SCROLLINFO si;
|
||||
|
||||
nScrollCode = ( Standard_Integer )LOWORD( wParam );
|
||||
len = myImages -> Size ();
|
||||
|
||||
switch ( nScrollCode ) {
|
||||
|
||||
case SB_LINEUP :
|
||||
case SB_PAGEUP :
|
||||
|
||||
newStart = myStart - myNX;
|
||||
myStart = newStart >= 1 ? --myNPos, newStart : ( ( myNPos = 0 ), 1 );
|
||||
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN :
|
||||
case SB_PAGEDOWN :
|
||||
|
||||
newStart = myStart + myNX;
|
||||
myStart = ( newStart <= len - myNX + 1 ) ? ( ++myNPos, newStart ) :
|
||||
( ( myNPos = myMaxPos ),
|
||||
( len - myNX + 1 )
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK :
|
||||
|
||||
myNPos = ( Standard_Integer )HIWORD( wParam );
|
||||
myStart = myNPos * myNX;
|
||||
|
||||
break;
|
||||
|
||||
case SB_ENDSCROLL :
|
||||
|
||||
return 0;
|
||||
|
||||
} // end switch
|
||||
|
||||
if ( myStart == 0 ) ++myStart;
|
||||
|
||||
nCurPos = GetScrollPos ( ( HWND )hwnd, SB_VERT );
|
||||
|
||||
if ( nCurPos == myNPos ) return 0;
|
||||
|
||||
si.cbSize = sizeof ( SCROLLINFO );
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = myNPos;
|
||||
|
||||
SetScrollInfo ( ( HWND )hwnd, SB_VERT, &si, TRUE );
|
||||
InvalidateRect ( ( HWND )hwnd, NULL, TRUE );
|
||||
|
||||
return 0;
|
||||
|
||||
} // WM_VSCROLL
|
||||
|
||||
case WM_PAINT : {
|
||||
|
||||
HDC hDCsrc, hDCdst;
|
||||
PAINTSTRUCT ps;
|
||||
HPEN hOldPen;
|
||||
HFONT hOldFont;
|
||||
HPALETTE hOldPal;
|
||||
int i, j, x, y, ow, oh, cnt, len;
|
||||
|
||||
Handle( WNT_Icon ) icon;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( GraphicDevice () );
|
||||
|
||||
if ( !myDragging ) {
|
||||
|
||||
hDCdst = BeginPaint ( ( HWND )hwnd, &ps );
|
||||
hDCsrc = CreateCompatibleDC ( hDCdst );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () ) {
|
||||
|
||||
hOldPal = SelectPalette ( hDCdst, ( HPALETTE )( gDev -> HPalette () ), FALSE );
|
||||
RealizePalette ( hDCdst );
|
||||
|
||||
} // end if
|
||||
|
||||
len = myImages -> Size ();
|
||||
hOldPen = SelectPen ( hDCdst, myPen );
|
||||
hOldFont = SelectFont ( hDCdst, myFont );
|
||||
SetTextAlign ( hDCdst, TA_CENTER | TA_TOP );
|
||||
SetStretchBltMode ( hDCdst, COLORONCOLOR );
|
||||
|
||||
for ( i = 0, y = Y_SPACING, cnt = myStart; i < myNY; ++i, y += myIncY )
|
||||
|
||||
for ( j = 0, x = X_SPACING; j < myNX; ++j, ++cnt, x += myIncX ) {
|
||||
|
||||
if ( cnt > len ) goto exit_display;
|
||||
|
||||
icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( cnt ) );
|
||||
|
||||
if ( icon.IsNull () ) continue;
|
||||
|
||||
myImages -> Dim ( cnt, ow, oh );
|
||||
SelectBitmap ( hDCsrc, icon -> myImage );
|
||||
|
||||
Rectangle ( hDCdst, x, y, x + myIconWidth + 4, y + myIconHeight + 4 );
|
||||
TextOut (
|
||||
hDCdst, x + myIconWidth / 2, y + myIconHeight + 10,
|
||||
icon -> myName, strlen ( icon -> myName )
|
||||
);
|
||||
|
||||
StretchBlt (
|
||||
hDCdst, x + 2, y + 2, myIconWidth, myIconHeight,
|
||||
hDCsrc, 0, 0, ow, oh,
|
||||
SRCCOPY
|
||||
);
|
||||
|
||||
} // end for
|
||||
|
||||
exit_display:
|
||||
|
||||
SelectFont ( hDCdst, hOldFont );
|
||||
SelectPen ( hDCdst, hOldPen );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () )
|
||||
|
||||
SelectPalette ( hDCdst, hOldPal, FALSE );
|
||||
|
||||
DeleteDC ( hDCsrc );
|
||||
EndPaint ( ( HWND )hwnd, &ps );
|
||||
|
||||
return 0;
|
||||
|
||||
} else
|
||||
|
||||
return DefWindowProc ( ( HWND )hwnd, uMsg, wParam, lParam );
|
||||
|
||||
} // WM_PAINT
|
||||
|
||||
case WM_ENTERSIZEMOVE :
|
||||
|
||||
myDragging = TRUE;
|
||||
|
||||
return 0;
|
||||
|
||||
case WM_EXITSIZEMOVE :
|
||||
|
||||
myDragging = FALSE;
|
||||
InvalidateRect ( ( HWND )hwnd, NULL, TRUE );
|
||||
|
||||
return 0;
|
||||
|
||||
case WM_QUERYNEWPALETTE: {
|
||||
|
||||
HDC hDC = GetDC ( ( HWND )hwnd );
|
||||
WINDOW_DATA* wd = (WINDOW_DATA* )GetWindowLongPtr ((HWND )hwnd, GWLP_USERDATA);
|
||||
|
||||
SelectPalette ( hDC, wd -> hPal, FALSE );
|
||||
|
||||
// if ( RealizePalette ( hDC ) );
|
||||
if ( RealizePalette ( hDC ) )
|
||||
InvalidateRect ( ( HWND )hwnd, NULL, FALSE );
|
||||
|
||||
ReleaseDC ( ( HWND )hwnd, hDC );
|
||||
|
||||
return TRUE;
|
||||
|
||||
} // WM_QUERYNEWPALETTE
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
|
||||
if ( hwnd != ( HWND )wParam ) {
|
||||
|
||||
HDC hDC = GetDC ( ( HWND )hwnd );
|
||||
WINDOW_DATA* wd = (WINDOW_DATA* )GetWindowLongPtr ((HWND )hwnd, GWLP_USERDATA);
|
||||
SelectPalette ( hDC, wd -> hPal, TRUE );
|
||||
|
||||
if ( RealizePalette ( hDC ) )
|
||||
|
||||
UpdateColors ( hDC );
|
||||
|
||||
ReleaseDC ( ( HWND )hwnd, hDC );
|
||||
|
||||
return 0;
|
||||
|
||||
} // end if
|
||||
|
||||
default:
|
||||
|
||||
return DefWindowProc ( ( HWND )hwnd, uMsg, wParam, lParam );
|
||||
|
||||
} // end switch
|
||||
|
||||
} // end WNT_IconBox :: HandleEvent
|
@@ -53,8 +53,4 @@ class Image from WNT inherits TShared from MMgt
|
||||
myImage : Address from Standard is protected;
|
||||
myHashCode : Integer from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class ImageManager from WNT
|
||||
|
||||
end Image;
|
||||
|
@@ -1,178 +0,0 @@
|
||||
-- Created on: 1996-03-11
|
||||
-- Created by: PLOTNIKOV Eugeny <eugeny@maniax>
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
--
|
||||
-- The content of this file is subject to the Open CASCADE Technology Public
|
||||
-- License Version 6.5 (the "License"). You may not use the content of this file
|
||||
-- except in compliance with the License. Please obtain a copy of the License
|
||||
-- at http://www.opencascade.org and read it completely before using this file.
|
||||
--
|
||||
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
--
|
||||
-- The Original Code and all software distributed under the License is
|
||||
-- distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
-- Initial Developer hereby disclaims all such warranties, including without
|
||||
-- limitation, any warranties of merchantability, fitness for a particular
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
-- Modifications: PLOTNIKOV Eugeny at July 1998 (BUC60286)
|
||||
|
||||
|
||||
class ImageManager from WNT inherits TShared from MMgt
|
||||
|
||||
---Purpose: This class defines image management
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect,
|
||||
Window from WNT,
|
||||
SequenceOfImage from WNT,
|
||||
TypeOfImage from WNT,
|
||||
Image from WNT,
|
||||
WindowPtr from WNT
|
||||
|
||||
is
|
||||
|
||||
Create ( aWindow : WindowPtr from WNT )
|
||||
returns mutable ImageManager from WNT;
|
||||
---Purpose: Creates a class instance
|
||||
|
||||
Destroy ( me : mutable )
|
||||
is virtual;
|
||||
---Purpose: Deletes all resources associated with the class instance.
|
||||
---C++: alias ~
|
||||
|
||||
SetFormat ( me : mutable; aFormat : TypeOfImage from WNT = WNT_TOI_XWD )
|
||||
is static;
|
||||
---Purpose: Sets image format for output.
|
||||
|
||||
Add ( me : mutable; anImage : Image from WNT )
|
||||
is static;
|
||||
---Purpose: Adds <anImage> to manager.
|
||||
|
||||
Image ( me : mutable; anIndex : Integer from Standard )
|
||||
returns Image from WNT is static;
|
||||
---Purpose: returns Image stored at <anIndex>.
|
||||
|
||||
Load ( me : mutable; aFileName : CString from Standard )
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
---Purpose: Loads image from file and returns its index in the
|
||||
-- sequence.
|
||||
-- Warning: Returns 0 if loading was failed.
|
||||
|
||||
Save (
|
||||
me;
|
||||
aFileName : CString from Standard;
|
||||
aX, aY, aWidth, aHeight : Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Stories image to the file according to <myFormat>
|
||||
-- class field. Returns True on success, otherwise
|
||||
-- returns False.
|
||||
|
||||
SaveBuffer (
|
||||
me;
|
||||
aFileName : CString from Standard;
|
||||
aX, aY, aWidth, aHeight : Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---Purpose: Stories contents of the double buffer window pixmap.
|
||||
-- See "Save" method.
|
||||
|
||||
Draw (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard;
|
||||
Xc, Yc : Integer from Standard;
|
||||
aWidth : Integer from Standard;
|
||||
aHeight : Integer from Standard;
|
||||
anAngle : Real from Standard = 0.0
|
||||
)
|
||||
is static;
|
||||
---Purpose: Displays the image according to the DoubleBuffer state
|
||||
-- of the associated window.
|
||||
|
||||
Delete ( me : mutable; anIndex : Integer from Standard )
|
||||
is static;
|
||||
---Purpose: Deletes an image at index <anIndex>.
|
||||
|
||||
Discard ( me : mutable; anIndex : Integer from Standard )
|
||||
is static;
|
||||
---Purpose: Places an image to the trash
|
||||
|
||||
Scale (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard;
|
||||
aScaleX : Real from Standard;
|
||||
aScaleY : Real from Standard;
|
||||
aReplace : Boolean from Standard = Standard_False
|
||||
) returns Handle from Aspect is static;
|
||||
---Purpose: Scales the specified image.
|
||||
|
||||
Size ( me ) returns Integer from Standard is static;
|
||||
---Purpose: Returns number of loaded images.
|
||||
|
||||
ImageHandle (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard
|
||||
) returns Handle from Aspect is static;
|
||||
---Purpose: Returns image handle.
|
||||
|
||||
Dim (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard;
|
||||
aWidth, aHeight : out Integer from Standard
|
||||
)
|
||||
is static;
|
||||
---Purpose: Returns image dimensions.
|
||||
|
||||
HashCode (
|
||||
me : mutable;
|
||||
anIndex : Integer from Standard
|
||||
)
|
||||
returns Integer from Standard is redefined static;
|
||||
---Purpose: Returns image's hash code.
|
||||
|
||||
Index (
|
||||
me : mutable;
|
||||
aHashCode : Integer from Standard
|
||||
)
|
||||
returns Integer from Standard is static;
|
||||
---Purpose: Returns image's index.
|
||||
|
||||
StringHashCode (
|
||||
me : mutable;
|
||||
aString : CString from Standard
|
||||
)
|
||||
returns Integer from Standard is static;
|
||||
---Purpose: Returns hash code of the string.
|
||||
|
||||
Open (
|
||||
me : mutable;
|
||||
aDC : Handle from Aspect;
|
||||
aWidth : Integer from Standard;
|
||||
aHeight : Integer from Standard;
|
||||
aHashCode : Integer from Standard
|
||||
)
|
||||
returns Integer from Standard is static;
|
||||
---Purpose: Creates new empty image and returns its index
|
||||
|
||||
fields
|
||||
|
||||
myWindow : Address from Standard is protected;
|
||||
myImages : SequenceOfImage from WNT is protected;
|
||||
myTrash : SequenceOfImage from WNT is protected;
|
||||
myFormat : TypeOfImage from WNT is protected;
|
||||
myLastImage : Image from WNT is protected;
|
||||
myLastIndex : Integer from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class Window from WNT
|
||||
|
||||
end ImageManager;
|
@@ -1,594 +0,0 @@
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
// Modifications: PLOTNIKOV Eugeny at July 1998 (BUC60286)
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include <WNT_ImageManager.ixx>
|
||||
|
||||
#include <WNT_Image.hxx>
|
||||
#include <WNT_GraphicDevice.hxx>
|
||||
|
||||
#include <WNT_Bitmap.h>
|
||||
|
||||
#define TRASH_SIZE 8
|
||||
|
||||
#define PWND ( ( WNT_WindowPtr )myWindow )
|
||||
|
||||
HBITMAP LoadImageFromFile ( Handle( WNT_GraphicDevice )&, char*, HDC = NULL );
|
||||
int SaveWindowToFile (
|
||||
Handle( WNT_GraphicDevice )&, HWND, char*, int, int, int, int
|
||||
);
|
||||
int SaveBitmapToFile (
|
||||
Handle( WNT_GraphicDevice )&, HBITMAP, char*, int, int, int, int
|
||||
);
|
||||
void SetOutputFormat ( WNT_TypeOfImage );
|
||||
//***//
|
||||
//***************************** Constructor ******************************//
|
||||
//***//
|
||||
WNT_ImageManager :: WNT_ImageManager ( const WNT_WindowPtr& aWindow ) {
|
||||
|
||||
myWindow = aWindow;
|
||||
myLastIndex = 0;
|
||||
|
||||
} // end constructor
|
||||
//***//
|
||||
//******************************* Destroy ********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Destroy () {
|
||||
|
||||
|
||||
} // end WNT_ImageManager :: Destroy
|
||||
//***//
|
||||
//******************************* SetFormat ******************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: SetFormat ( const WNT_TypeOfImage aFormat ) {
|
||||
|
||||
myFormat = aFormat;
|
||||
SetOutputFormat ( aFormat );
|
||||
|
||||
} // end WNT_ImageManager :: SetFormat
|
||||
//***//
|
||||
//********************************** Load ********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: Load ( const Standard_CString aFileName ) {
|
||||
|
||||
Handle( WNT_Image ) image;
|
||||
Standard_Integer i, iHCode, len, retVal = 0;
|
||||
HBITMAP hBmp;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
iHCode = StringHashCode ( aFileName );
|
||||
|
||||
if ( myLastIndex && myLastImage -> myHashCode == iHCode ) return myLastIndex;
|
||||
|
||||
for ( i = 1; i <= myTrash.Length (); ++i )
|
||||
|
||||
if ( myTrash.Value ( i ) -> myHashCode == iHCode ) {
|
||||
|
||||
myLastImage = myTrash.Value ( i );
|
||||
retVal = -i;
|
||||
|
||||
goto end;
|
||||
|
||||
} /* end if */
|
||||
|
||||
len = myImages.Length ();
|
||||
|
||||
for ( i = 1; i <= len; ++i )
|
||||
|
||||
if ( myImages.Value ( i ) -> myHashCode == iHCode ) {
|
||||
|
||||
myLastImage = myImages.Value ( i );
|
||||
retVal = i;
|
||||
|
||||
goto end;
|
||||
|
||||
} // end if
|
||||
|
||||
hBmp = LoadImageFromFile ( gDev,(Standard_PCharacter) aFileName );
|
||||
|
||||
if ( hBmp ) {
|
||||
|
||||
myLastImage = new WNT_Image ( hBmp, iHCode );
|
||||
myImages.Append ( myLastImage );
|
||||
retVal = myImages.Length ();
|
||||
|
||||
} // end if
|
||||
end:
|
||||
return myLastIndex = retVal;
|
||||
|
||||
} // end WNT_ImageManager :: Load
|
||||
//***//
|
||||
//********************************** Save ********************************//
|
||||
//***//
|
||||
Standard_Boolean WNT_ImageManager :: Save (
|
||||
const Standard_CString aFileName,
|
||||
const Standard_Integer aX,
|
||||
const Standard_Integer aY,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight
|
||||
) const {
|
||||
|
||||
Standard_Boolean retVal;
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
retVal = SaveWindowToFile (
|
||||
gDev, ( HWND )( PWND -> HWindow () ),
|
||||
(Standard_PCharacter) aFileName, aX, aY, aWidth, aHeight
|
||||
);
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_ImageManager :: Save
|
||||
//***//
|
||||
//****************************** SaveBuffer ******************************//
|
||||
//***//
|
||||
Standard_Boolean WNT_ImageManager :: SaveBuffer (
|
||||
const Standard_CString aFileName,
|
||||
const Standard_Integer aX,
|
||||
const Standard_Integer aY,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight
|
||||
) const {
|
||||
|
||||
Standard_Boolean retVal;
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
retVal = SaveBitmapToFile (
|
||||
gDev, ( HBITMAP )( PWND -> HPixmap () ),
|
||||
(Standard_PCharacter)aFileName, aX, aY, aWidth, aHeight
|
||||
);
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_ImageManager :: SaveBuffer
|
||||
//***//
|
||||
//********************************** Draw ********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Draw (
|
||||
const Standard_Integer anIndex,
|
||||
const Standard_Integer Xc,
|
||||
const Standard_Integer Yc,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight,
|
||||
const Standard_Real anAngle
|
||||
) {
|
||||
|
||||
HDC hDC, hDCmemSrc, hDCmemDst = 0;
|
||||
HPALETTE hPal, hOldPal;
|
||||
Standard_Integer iw, ih;
|
||||
|
||||
if ( myLastIndex != anIndex ) {
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
} // end if
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
Dim ( anIndex, iw, ih );
|
||||
|
||||
hDC = GetDC ( ( HWND )( PWND -> HWindow () ) );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () ) {
|
||||
|
||||
hOldPal = SelectPalette (
|
||||
hDC, hPal = ( HPALETTE )( gDev -> HPalette () ), FALSE
|
||||
);
|
||||
|
||||
if ( RealizePalette ( hDC ) )
|
||||
|
||||
UpdateColors ( hDC );
|
||||
|
||||
} // end if
|
||||
|
||||
if ( PWND -> DoubleBuffer () ) {
|
||||
|
||||
hDCmemDst = CreateCompatibleDC ( hDC );
|
||||
SelectBitmap ( hDCmemDst, PWND -> HPixmap () );
|
||||
|
||||
} else
|
||||
|
||||
hDCmemDst = hDC;
|
||||
|
||||
hDCmemSrc = CreateCompatibleDC ( hDC );
|
||||
SetStretchBltMode ( hDCmemDst, COLORONCOLOR );
|
||||
|
||||
SelectBitmap (
|
||||
hDCmemSrc, ( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp
|
||||
);
|
||||
|
||||
if ( aWidth == iw && aHeight == ih && anAngle == 0.0F )
|
||||
|
||||
BitBlt (
|
||||
hDCmemDst, Xc - aWidth / 2 - ( aWidth & 1 ),
|
||||
Yc - aHeight / 2, aWidth, aHeight,
|
||||
hDCmemSrc, 0, 0, SRCCOPY
|
||||
);
|
||||
|
||||
else if ( anAngle == 0.0F )
|
||||
|
||||
StretchBlt (
|
||||
hDCmemDst, Xc - aWidth / 2,
|
||||
Yc - aHeight / 2 + ( aHeight & 1 ), aWidth, aHeight,
|
||||
hDCmemSrc, 0, 0, iw, ih, SRCCOPY
|
||||
);
|
||||
|
||||
else {
|
||||
|
||||
XFORM x;
|
||||
POINT pivot;
|
||||
POINT pts[ 3 ];
|
||||
double sinVal, cosVal, angle;
|
||||
|
||||
SetGraphicsMode ( hDCmemDst, GM_ADVANCED );
|
||||
|
||||
angle = ( double )anAngle * ( M_PI / 180. );
|
||||
cosVal = Cos ( angle );
|
||||
sinVal = Sin ( angle );
|
||||
|
||||
pts[ 0 ].x = Xc - aWidth / 2;
|
||||
pts[ 0 ].y = Yc - aHeight / 2 + ( aHeight & 1 );
|
||||
|
||||
pts[ 1 ].x = Xc + aWidth / 2;
|
||||
pts[ 1 ].y = pts[ 0 ].y;
|
||||
|
||||
pts[ 2 ].x = pts[ 0 ].x;
|
||||
pts[ 2 ].y = Yc + aHeight / 2 + ( aHeight & 1 );
|
||||
|
||||
pivot.x = ( pts[ 1 ].x + pts[ 2 ].x ) / 2;
|
||||
pivot.y = ( pts[ 1 ].y + pts[ 2 ].y ) / 2;
|
||||
|
||||
x.eM11 = 1.0F; x.eM12 = 0.0F;
|
||||
x.eM21 = 0.0F; x.eM22 = 1.0F;
|
||||
x.eDx = ( float )-pivot.x;
|
||||
x.eDy = ( float )-pivot.y;
|
||||
ModifyWorldTransform ( hDCmemDst, &x, MWT_RIGHTMULTIPLY );
|
||||
|
||||
x.eM11 = ( float )cosVal; x.eM12 = ( float )-sinVal;
|
||||
x.eM21 = ( float )sinVal; x.eM22 = ( float ) cosVal;
|
||||
x.eDx = 0.0F;
|
||||
x.eDy = 0.0F;
|
||||
ModifyWorldTransform ( hDCmemDst, &x, MWT_RIGHTMULTIPLY );
|
||||
|
||||
x.eM11 = 1.0F; x.eM12 = 0.0F;
|
||||
x.eM21 = 0.0F; x.eM22 = 1.0F;
|
||||
x.eDx = ( float )pivot.x;
|
||||
x.eDy = ( float )pivot.y;
|
||||
ModifyWorldTransform ( hDCmemDst, &x, MWT_RIGHTMULTIPLY );
|
||||
|
||||
PlgBlt ( hDCmemDst, pts, hDCmemSrc, 0, 0, iw, ih, NULL, 0, 0 );
|
||||
|
||||
} // end else
|
||||
|
||||
DeleteDC ( hDCmemSrc );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () )
|
||||
|
||||
SelectPalette ( hDC, hOldPal, FALSE );
|
||||
|
||||
if ( PWND -> DoubleBuffer () )
|
||||
|
||||
DeleteDC ( hDCmemDst );
|
||||
|
||||
ReleaseDC ( ( HWND )( PWND -> HWindow () ), hDC );
|
||||
|
||||
} // end WNT_ImageManager :: Draw
|
||||
//***//
|
||||
//********************************** Scale *******************************//
|
||||
//***//
|
||||
Aspect_Handle WNT_ImageManager :: Scale (
|
||||
const Standard_Integer anIndex,
|
||||
const Standard_Real aScaleX,
|
||||
const Standard_Real aScaleY,
|
||||
const Standard_Boolean aReplace
|
||||
) {
|
||||
|
||||
Standard_Integer iw, ih, iNw, iNh;
|
||||
HDC hDCmemSrc, hDCmemDst, hDC;
|
||||
HPALETTE hOldPal = NULL;
|
||||
HBITMAP hBitmap, hOldBitmap, hBmp;
|
||||
|
||||
if ( myLastIndex != anIndex ) {
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
} // end if
|
||||
|
||||
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
|
||||
DownCast ( PWND -> GraphicDevice () );
|
||||
|
||||
Dim ( anIndex, iw, ih );
|
||||
|
||||
iNw = ( Standard_Integer )( iw * aScaleX );
|
||||
iNh = ( Standard_Integer )( ih * aScaleY );
|
||||
|
||||
hDC = GetDC ( NULL );
|
||||
|
||||
if ( gDev -> IsPaletteDevice () )
|
||||
|
||||
hOldPal = SelectPalette ( hDC, ( HPALETTE )( gDev -> HPalette () ), FALSE );
|
||||
|
||||
hDCmemSrc = CreateCompatibleDC ( hDC );
|
||||
hDCmemDst = CreateCompatibleDC ( hDC );
|
||||
|
||||
SetStretchBltMode ( hDCmemDst, COLORONCOLOR );
|
||||
|
||||
hBitmap = CreateCompatibleBitmap ( hDC, iNw, iNh );
|
||||
|
||||
if ( hBitmap ) {
|
||||
|
||||
hBmp = ( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp;
|
||||
hOldBitmap = SelectBitmap ( hDCmemSrc, hBmp );
|
||||
SelectBitmap ( hDCmemDst, hBitmap );
|
||||
|
||||
StretchBlt (
|
||||
hDCmemDst, 0, 0, iNw, iNh,
|
||||
hDCmemSrc, 0, 0, iw, ih, SRCCOPY
|
||||
);
|
||||
|
||||
SelectBitmap ( hDCmemSrc, hOldBitmap );
|
||||
|
||||
if ( aReplace ) {
|
||||
|
||||
DeleteObject ( hBmp );
|
||||
( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp = hBitmap;
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
DeleteDC ( hDCmemDst );
|
||||
DeleteDC ( hDCmemSrc );
|
||||
|
||||
if ( hOldPal != NULL ) SelectPalette ( hDC, hOldPal, FALSE );
|
||||
|
||||
ReleaseDC ( NULL, hDC );
|
||||
|
||||
return ( Aspect_Handle )hBitmap;
|
||||
|
||||
} // end WNT_ImageManager :: Scale
|
||||
//***//
|
||||
//******************************** HashCode ******************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: StringHashCode (
|
||||
const Standard_CString aString
|
||||
) {
|
||||
|
||||
Standard_Integer i, n, aHashCode = 0;
|
||||
|
||||
union {
|
||||
|
||||
char charPtr[ 80 ];
|
||||
int intPtr[ 20 ];
|
||||
|
||||
} u;
|
||||
|
||||
n = (Standard_Integer) strlen ( aString );
|
||||
|
||||
if ( n > 0 ) {
|
||||
|
||||
if ( n < 80 ) {
|
||||
|
||||
n = ( n + 3 ) / 4;
|
||||
u.intPtr[ n - 1 ] = 0;
|
||||
strcpy ( u.charPtr, aString );
|
||||
|
||||
} else {
|
||||
|
||||
n = 20;
|
||||
strncpy ( u.charPtr, aString, 80 );
|
||||
|
||||
} // end else
|
||||
|
||||
for ( i = 0; i < n; ++i )
|
||||
|
||||
aHashCode = aHashCode ^ u.intPtr[ i ];
|
||||
|
||||
} // end if
|
||||
|
||||
return Abs ( aHashCode ) + 1;
|
||||
|
||||
} // end WNT_ImageManager :: HashCode
|
||||
//***//
|
||||
//**************************** ImageHandle *******************************//
|
||||
//***//
|
||||
Aspect_Handle WNT_ImageManager :: ImageHandle (
|
||||
const Standard_Integer anIndex
|
||||
) {
|
||||
|
||||
if ( myLastIndex == anIndex ) return ( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp;
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
return ( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp;
|
||||
|
||||
} // end WNT_ImageManager :: ImageHandle
|
||||
//***//
|
||||
//******************************** Dim ***********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Dim (
|
||||
const Standard_Integer anIndex,
|
||||
Standard_Integer& aWidth,
|
||||
Standard_Integer& aHeight
|
||||
) {
|
||||
|
||||
BITMAP bmp;
|
||||
|
||||
if ( myLastIndex != anIndex ) {
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
} // end if
|
||||
|
||||
GetObject (
|
||||
( ( PWNT_Bitmap )myLastImage -> myImage ) -> hBmp,
|
||||
sizeof ( BITMAP ), ( LPVOID )&bmp
|
||||
);
|
||||
|
||||
aWidth = bmp.bmWidth;
|
||||
aHeight = bmp.bmHeight;
|
||||
|
||||
} // WNT_ImageManager :: Dim
|
||||
//***//
|
||||
//****************************** HashCode ********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: HashCode (
|
||||
const Standard_Integer anIndex
|
||||
) {
|
||||
|
||||
if ( myLastIndex == anIndex ) return myLastImage -> myHashCode;
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
return myLastImage -> myHashCode;
|
||||
|
||||
} // end WNT_ImageManager :: HashCode
|
||||
//***//
|
||||
//****************************** Index ***********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: Index (
|
||||
const Standard_Integer aHashCode
|
||||
) {
|
||||
|
||||
Standard_Integer retVal = 0;
|
||||
|
||||
if ( myLastImage -> myHashCode == aHashCode ) return myLastIndex;
|
||||
|
||||
for ( int i = 1; i <= myImages.Length (); ++i )
|
||||
|
||||
if ( myImages.Value ( i ) -> myHashCode == aHashCode ) {
|
||||
|
||||
myLastImage = myImages.Value ( retVal = myLastIndex = i );
|
||||
break;
|
||||
|
||||
} // end if
|
||||
|
||||
if ( retVal == 0 )
|
||||
|
||||
for ( int i = 1; i <= myTrash.Length (); ++i )
|
||||
|
||||
if ( myTrash.Value ( i ) -> myHashCode == aHashCode ) {
|
||||
|
||||
myLastImage = myImages.Value ( i );
|
||||
retVal = myLastIndex = -i;
|
||||
break;
|
||||
|
||||
} // end if
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end WNT_ImageManager :: Index
|
||||
//***//
|
||||
//****************************** Delete **********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Delete ( const Standard_Integer anIndex ) {
|
||||
|
||||
myImages.Remove ( anIndex );
|
||||
|
||||
if ( myLastIndex == anIndex ) myLastIndex = 0;
|
||||
|
||||
} // end WNT_ImageManager :: Delete
|
||||
//***//
|
||||
//****************************** Delete **********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Discard ( const Standard_Integer anIndex ) {
|
||||
|
||||
if ( anIndex > 0 ) {
|
||||
|
||||
int len = myTrash.Length ();
|
||||
|
||||
if ( len == TRASH_SIZE ) myTrash.Remove ( len );
|
||||
|
||||
myTrash.Prepend ( myImages.Value ( anIndex ) );
|
||||
|
||||
myImages.Remove ( anIndex );
|
||||
|
||||
if ( myLastIndex == anIndex ) myLastIndex = 0;
|
||||
|
||||
} // end if
|
||||
|
||||
} // end WNT_ImageManager :: Delete
|
||||
//***//
|
||||
//******************************** Size **********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: Size () const {
|
||||
|
||||
return myImages.Length ();
|
||||
|
||||
} // end WNT_ImageManager :: Size
|
||||
//***//
|
||||
//******************************** Add ***********************************//
|
||||
//***//
|
||||
void WNT_ImageManager :: Add ( const Handle_WNT_Image& anImage ) {
|
||||
|
||||
myImages.Append ( myLastImage = anImage );
|
||||
|
||||
myLastIndex = myImages.Length ();
|
||||
|
||||
} // end WNT_ImageManager :: Add
|
||||
//***//
|
||||
//******************************** Image *********************************//
|
||||
//***//
|
||||
Handle( WNT_Image ) WNT_ImageManager :: Image (
|
||||
const Standard_Integer anIndex
|
||||
) {
|
||||
|
||||
if ( myLastIndex == anIndex ) return myLastImage;
|
||||
|
||||
myLastIndex = anIndex;
|
||||
myLastImage = anIndex < 0 ? myTrash.Value ( -anIndex ) : myImages.Value ( anIndex );
|
||||
|
||||
return myLastImage;
|
||||
|
||||
} // end WNT_ImageManager :: Image
|
||||
//***//
|
||||
//******************************** Open **********************************//
|
||||
//***//
|
||||
Standard_Integer WNT_ImageManager :: Open (
|
||||
const Aspect_Handle aDC,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer aHeight,
|
||||
const Standard_Integer aHashCode
|
||||
) {
|
||||
|
||||
HDC hdc = ( HDC )aDC;
|
||||
HBITMAP hBmp = CreateCompatibleBitmap ( hdc, aWidth, aHeight );
|
||||
|
||||
myImages.Append ( myLastImage = new WNT_Image ( hBmp, aHashCode ) );
|
||||
|
||||
return myLastIndex = myImages.Length ();
|
||||
|
||||
} // end WNT_ImageMagager :: Open
|
||||
//***//
|
||||
//************************************************************************//
|
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@
|
||||
#include <windows.h>
|
||||
#include <WNT_WClass.ixx>
|
||||
|
||||
#include <Standard_PCharacter.hxx>
|
||||
#include <InterfaceGraphic_WNT.hxx>
|
||||
|
||||
#include <string.h>
|
||||
|
@@ -18,49 +18,22 @@
|
||||
-- purpose or non-infringement. Please see the License for the specific terms
|
||||
-- and conditions governing the rights and limitations under the License.
|
||||
|
||||
-- Modified: FMN - 23/01/98 -> Add DoMapping
|
||||
-- Modified : GG 28/01/00 G004
|
||||
-- Add gamma correction computation just before dumping an image.
|
||||
-- GG 07/03/00 G004 Add MMSize() method
|
||||
-- TCL 26/10/00 G002 SetBackground(aName: CString) method
|
||||
-- GG - RIC120302 Add NEW HParentWindow methods.
|
||||
-- SAV 24/11/01 SetBackground(Quantity_Color)
|
||||
|
||||
class Window from WNT inherits Window from Aspect
|
||||
|
||||
---Purpose: This class defines Windows NT window
|
||||
-- Warning: The position and size for the creation of the window
|
||||
-- are defined in Device Screen Unit (DSU)
|
||||
-- floating [0,1] space.
|
||||
--
|
||||
-- As 3D view window is the main purpose of this class,
|
||||
-- and 3D view does not need its background to be drawn
|
||||
-- by the system, by default the window background is not drawn.
|
||||
-- This can be overridden by calling ClearFlags( WDF_NOERASEBKGRND ).
|
||||
-- See also WNT_WndProc.cxx and InterfaceGraphic_WNT.hxx.
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect,
|
||||
Background from Aspect,
|
||||
GradientBackground from Aspect,
|
||||
TypeOfResize from Aspect,
|
||||
FillMethod from Aspect,
|
||||
GradientFillMethod from Aspect,
|
||||
PixMap from Image,
|
||||
NameOfColor from Quantity,
|
||||
Color from Quantity,
|
||||
Parameter from Quantity,
|
||||
Ratio from Quantity,
|
||||
GraphicDevice from WNT,
|
||||
WClass from WNT,
|
||||
Uint from WNT,
|
||||
Long from WNT,
|
||||
Dword from WNT,
|
||||
WindowData from WNT,
|
||||
Icon from WNT,
|
||||
ImageManager from WNT,
|
||||
TypeOfImage from WNT
|
||||
WindowData from WNT
|
||||
|
||||
raises
|
||||
|
||||
@@ -68,43 +41,8 @@ class Window from WNT inherits Window from Aspect
|
||||
WindowError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aTitle : CString from Standard;
|
||||
aClass : WClass from WNT;
|
||||
aStyle : Dword from WNT = 0;
|
||||
Xc : Parameter from Quantity = 0.5;
|
||||
Yc : Parameter from Quantity = 0.5;
|
||||
aWidth : Parameter from Quantity = 0.5;
|
||||
aHeight : Parameter from Quantity = 0.5;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY;
|
||||
aParent : Handle from Aspect = 0;
|
||||
aMenu : Handle from Aspect = 0;
|
||||
aClientStruct : Address from Standard = 0
|
||||
)
|
||||
returns mutable Window from WNT
|
||||
---Level: Public
|
||||
---Purpose: Creates a Window defined by his Center and his Size
|
||||
-- in DSU from the Parent Window. If <aParent> is 0 then
|
||||
-- creates a window without parent.
|
||||
-- Creation of an WNT_Window automatically determines the
|
||||
-- smaller dimension of the screen (usually the height)
|
||||
-- and parametrises it as 1.0.
|
||||
-- The smaller dimension of the window is limited to 1.0
|
||||
-- We can give a value greater than 1.0 to the larger
|
||||
-- dimension.
|
||||
-- No matter how large the values passed in argument, the
|
||||
-- window is automatically limited to the maximum size of
|
||||
-- the screen.
|
||||
-- The ratio of width to height of a conventional screen is
|
||||
-- of the order of 1.3.
|
||||
-- Trigger: Raises WindowDefinitionError if the Position out of the
|
||||
-- Screen Space or the window creation failed.
|
||||
raises WindowDefinitionError from Aspect;
|
||||
|
||||
Create (theDevice : GraphicDevice from WNT;
|
||||
theTitle : CString from Standard;
|
||||
|
||||
Create (theTitle : CString from Standard;
|
||||
theClass : WClass from WNT;
|
||||
theStyle : Dword from WNT;
|
||||
thePxLeft : Integer from Standard;
|
||||
@@ -124,7 +62,6 @@ class Window from WNT inherits Window from Aspect
|
||||
raises WindowDefinitionError from Aspect;
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aHandle : Handle from Aspect;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
)
|
||||
@@ -134,7 +71,6 @@ class Window from WNT inherits Window from Aspect
|
||||
-- This handle equals ( aPart1 << 16 ) + aPart2.
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aPart1 : Integer from Standard;
|
||||
aPart2 : Integer from Standard;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
@@ -154,106 +90,12 @@ class Window from WNT inherits Window from Aspect
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
Background : Background from Aspect
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
BackColor : NameOfColor from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
color : Color from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
aBackPixmap : Handle from Aspect
|
||||
) is static;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window background.
|
||||
|
||||
SetBackground (
|
||||
me : mutable;
|
||||
aName : CString from Standard ;
|
||||
aMethod: FillMethod from Aspect = Aspect_FM_CENTERED
|
||||
) returns Boolean from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Loads the window background from an image file <aName>
|
||||
-- defined with a supported format XWD,GIF or BMP
|
||||
-- and returns TRUE if the operation is successfull.
|
||||
-- Category: Methods to modify the class definition
|
||||
|
||||
SetBackground ( me : mutable ;
|
||||
Background : GradientBackground from Aspect ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window gradient background.
|
||||
-- Warning: the gradient background colours is ignored when the quality
|
||||
-- of this window is TRANSPARENT.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetBackground( me : mutable;
|
||||
aCol1 : Color from Quantity;
|
||||
aCol2 : Color from Quantity;
|
||||
aMethod : GradientFillMethod from Aspect = Aspect_GFM_HOR);
|
||||
---Level: Public
|
||||
---Purpose: Modifies the window gradient background.
|
||||
-- Warning: the gradient background colours are ignored when the quality
|
||||
-- of this window is TRANSPARENT.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
SetCursor ( me; aCursor : Handle from Aspect )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets cursor <aCursor> for ENTIRE WINDOW CLASS to which
|
||||
-- the Window belongs.
|
||||
|
||||
SetIcon (
|
||||
me : mutable;
|
||||
anIcon : Handle from Aspect;
|
||||
aName : CString from Standard = 0
|
||||
)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets icon <anIcon> for window
|
||||
|
||||
SetIconName ( me : mutable; aName : CString from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets name for window's icon
|
||||
|
||||
SetDoubleBuffer (
|
||||
me : mutable;
|
||||
DBmode : Boolean from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Activates/Deactivates the Double Buffering capability
|
||||
-- for this window.
|
||||
-- Warning: Double Buffering is always DISABLE by default.
|
||||
-- Trigger: Raises if BackingStore () isn't allowed for this Window
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
Flush ( me )
|
||||
---Level: Public
|
||||
---Purpose: Flushes all graphics to the screen and Swap the Double
|
||||
-- buffer if Enable
|
||||
-- Trigger: Raises if Something is WRONG at Drawing Time.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
Map ( me )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
@@ -285,115 +127,6 @@ class Window from WNT inherits Window from Aspect
|
||||
-- and returns TRUE if the window is mapped at screen.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
|
||||
Clear ( me )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Clears the Window in the Background color.
|
||||
|
||||
ClearArea (
|
||||
me;
|
||||
Xc : Integer from Standard;
|
||||
Yc : Integer from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Clears the Window Area defined by his center and PIXEL
|
||||
-- size in the Background color
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
Restore ( me )
|
||||
---Level: Public
|
||||
---Purpose: Restores The Window from the BackingStored Window
|
||||
-- See BackingStore () method.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
RestoreArea (
|
||||
me;
|
||||
Xc : Integer from Standard;
|
||||
Yc : Integer from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Restores The Window Area defined by his center
|
||||
-- and PIXEL size from the BackingStored Window
|
||||
-- See BackingStore () method.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
Dump (
|
||||
me;
|
||||
aFilename : CString from Standard;
|
||||
aGammaValue: Real from Standard = 1.0
|
||||
)
|
||||
returns Boolean
|
||||
---Level: Public
|
||||
---Purpose: Dumps the Window to an XWD,GIF or BMP filei with
|
||||
-- an optional gamma correction value according to the graphic system.
|
||||
-- and returns TRUE if the dump occurs normaly.
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
DumpArea (
|
||||
me;
|
||||
aFilename : CString from Standard;
|
||||
Xc : Integer from Standard;
|
||||
Yc : Integer from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard;
|
||||
aGammaValue: Real from Standard = 1.0
|
||||
)
|
||||
returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Dumps the Window Area defined by his center and PIXEL size
|
||||
-- to an image file with an optional gamma correction value
|
||||
-- and returns TRUE if the dump occurs normaly.
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
-- or the area is out of the Window.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
ToPixMap ( me ; theImage : in out PixMap from Image )
|
||||
returns Boolean
|
||||
---Level : Public
|
||||
---Purpose : dump the full contents of the window to a pixmap.
|
||||
is virtual;
|
||||
|
||||
Load ( me; aFilename : CString from Standard )
|
||||
returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Loads the XWD file to this Window.
|
||||
-- Returns TRUE if the loading occurs normaly.
|
||||
-- Warning: Note that the Window is enlarged automatically
|
||||
-- when the image size is too large for this window.
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
LoadArea (
|
||||
me;
|
||||
aFilename : CString from Standard;
|
||||
Xc : Integer from Standard;
|
||||
Yc : Integer from Standard;
|
||||
Width : Integer from Standard;
|
||||
Height : Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Loads the XWD file to Window Area defined by his center
|
||||
-- and PIXEL size.
|
||||
-- Returns TRUE if the loading occurs normaly.
|
||||
-- Warning: Note that the Image is zoomed automatically
|
||||
-- when the image size is too large for this window area.
|
||||
-- Trigger: Raises if Window is not defined properly
|
||||
-- or the area is out of the Window.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
SetOutputFormat ( me : mutable; aFormat : TypeOfImage from WNT )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets format of the image file created by Dump or
|
||||
-- DumpArea methods.
|
||||
|
||||
SetPos ( me : mutable; X, Y, X1, Y1 : Integer from Standard )
|
||||
is static;
|
||||
---Level: Internal
|
||||
@@ -418,22 +151,6 @@ class Window from WNT inherits Window from Aspect
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
|
||||
BackingStore ( me )
|
||||
returns Boolean from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the BackingStore capability for this Window.
|
||||
-- If Answer is True Exposure can be recovered by
|
||||
-- Restore RestoreArea methods.
|
||||
-- If Answer is False, Application must Redraw the
|
||||
-- exposed area.
|
||||
|
||||
DoubleBuffer ( me )
|
||||
returns Boolean from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DoubleBuffer state.
|
||||
---C++: inline
|
||||
|
||||
IsMapped ( me )
|
||||
returns Boolean from Standard is virtual;
|
||||
---Level: Public
|
||||
@@ -446,17 +163,6 @@ class Window from WNT inherits Window from Aspect
|
||||
---Purpose: Returns The Window RATIO equal to the physical
|
||||
-- WIDTH/HEIGHT dimensions.
|
||||
|
||||
Position (
|
||||
me;
|
||||
X1 : out Parameter from Quantity;
|
||||
Y1 : out Parameter from Quantity;
|
||||
X2 : out Parameter from Quantity;
|
||||
Y2 : out Parameter from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window POSITION in DSU
|
||||
|
||||
Position (
|
||||
me;
|
||||
X1 : out Integer from Standard;
|
||||
@@ -468,15 +174,6 @@ class Window from WNT inherits Window from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window POSITION in PIXEL
|
||||
|
||||
Size (
|
||||
me;
|
||||
Width : out Parameter from Quantity;
|
||||
Height : out Parameter from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in DSU
|
||||
|
||||
Size (
|
||||
me;
|
||||
Width : out Integer from Standard;
|
||||
@@ -486,49 +183,6 @@ class Window from WNT inherits Window from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in PIXEL
|
||||
|
||||
MMSize (
|
||||
me;
|
||||
Width : out Real from Standard;
|
||||
Height : out Real from Standard
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns The Window SIZE in MM
|
||||
|
||||
Convert (
|
||||
me;
|
||||
PV : Integer from Standard
|
||||
)
|
||||
returns Parameter from Quantity is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DSU value depending of the PIXEL value.
|
||||
|
||||
Convert (
|
||||
me;
|
||||
DV : Parameter from Quantity
|
||||
)
|
||||
returns Integer from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL value depending of the DSU value.
|
||||
|
||||
Convert (
|
||||
me;
|
||||
PX, PY : Integer from Standard;
|
||||
DX, DY : out Parameter from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DSU position depending of the PIXEL position.
|
||||
|
||||
Convert (
|
||||
me;
|
||||
DX, DY : Parameter from Quantity;
|
||||
PX, PY : out Integer from Standard
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL position depending of the DSU position.
|
||||
|
||||
HWindow ( me )
|
||||
returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
@@ -541,29 +195,8 @@ class Window from WNT inherits Window from Aspect
|
||||
---Purpose: Returns the Windows NT handle parent of the created window <me>.
|
||||
---C++: inline
|
||||
|
||||
HPixmap ( me )
|
||||
returns Handle from Aspect is static;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the Windows NT double buffer pixmap handle
|
||||
-- of the created window <me>.
|
||||
-- If BackingStore () is permitted.
|
||||
---C++: inline
|
||||
|
||||
WndProc ( me )
|
||||
returns Address from Standard;
|
||||
---Level: Internal
|
||||
---Purpose: Returns address of the window procedure.
|
||||
---C++: inline
|
||||
|
||||
ImageManager ( me )
|
||||
returns ImageManager from WNT is static;
|
||||
---Level: Internal
|
||||
---Purpose: Returns ImageManager of the Window.
|
||||
---C++: inline
|
||||
|
||||
doCreate (
|
||||
me : mutable;
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aHandle : Handle from Aspect;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
) is static private;
|
||||
@@ -579,17 +212,7 @@ class Window from WNT inherits Window from Aspect
|
||||
myWClass : WClass from WNT is protected; -- Window class
|
||||
myHWindow : Handle from Aspect is protected; -- Window handle
|
||||
myHParentWindow : Handle from Aspect is protected; -- Parent window handle
|
||||
myHPixmap : Handle from Aspect is protected; -- Bitmap handle
|
||||
myDoubleBuffer : Boolean from Standard is protected; -- DoubleBuffer flag
|
||||
myExtraData : WindowData from WNT is protected; -- additional data
|
||||
myFormat : TypeOfImage from WNT is protected; -- type of output image
|
||||
myImages : ImageManager from WNT is protected;
|
||||
myIcon : Icon from WNT is protected;
|
||||
myWndProc : Address from Standard is protected; -- address of window procedure
|
||||
myUsrData : Address from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class IconBox from WNT
|
||||
|
||||
end Window;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -19,18 +19,6 @@
|
||||
// GG RIC120302 Add a NEW HParentWindow method which enable
|
||||
// to retrieve the parent of the actual Hwindow handle.
|
||||
|
||||
inline Standard_Address WNT_Window :: WndProc () const {
|
||||
|
||||
return myWndProc;
|
||||
|
||||
} // end WNT_Window :: WndProc
|
||||
|
||||
inline Standard_Boolean WNT_Window :: DoubleBuffer () const {
|
||||
|
||||
return myDoubleBuffer;
|
||||
|
||||
} // end WNT_Window :: DoubleBuffer
|
||||
|
||||
inline Aspect_Handle WNT_Window :: HWindow () const {
|
||||
|
||||
return myHWindow;
|
||||
@@ -42,15 +30,3 @@ inline Aspect_Handle WNT_Window :: HParentWindow () const {
|
||||
return myHParentWindow;
|
||||
|
||||
} // end WNT_Window :: HWindow
|
||||
|
||||
inline Aspect_Handle WNT_Window :: HPixmap () const {
|
||||
|
||||
return myHPixmap;
|
||||
|
||||
} // end WNT_Window :: HPixmap
|
||||
|
||||
inline Handle_WNT_ImageManager WNT_Window :: ImageManager () const {
|
||||
|
||||
return myImages;
|
||||
|
||||
} // end WNT_Window :: ImageManager
|
||||
|
@@ -1,85 +0,0 @@
|
||||
// Copyright (c) 1996-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
|
||||
#include <WNT_Window.hxx>
|
||||
|
||||
//***//
|
||||
//*** This window procedure provides management of the window background. ***//
|
||||
//*** Background belongs to the window class but we need that windows which ***//
|
||||
//*** are based on the same class have different backgrounds. So, we are ***//
|
||||
//*** using window subclassing technique to provide this ability. ***//
|
||||
//***//
|
||||
LRESULT CALLBACK WNT_WndProc (
|
||||
HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
|
||||
) {
|
||||
|
||||
HDC hDC;
|
||||
HPALETTE hOldPal;
|
||||
WNDPROC lpfnWndProc;
|
||||
WINDOW_DATA* wd;
|
||||
WNT_Window* win;
|
||||
RECT invRect;
|
||||
|
||||
wd = (WINDOW_DATA* )GetWindowLongPtr (hwnd, GWLP_USERDATA);
|
||||
win = (WNT_Window* )wd->WNT_Window_Ptr;
|
||||
lpfnWndProc = (WNDPROC )win->WndProc();
|
||||
|
||||
if ( msg == WM_ERASEBKGND && !( wd -> dwFlags & WDF_NOERASEBKGRND ) ) {
|
||||
|
||||
hDC = ( HDC )wParam;
|
||||
|
||||
if ( wd -> hPal ) {
|
||||
|
||||
hOldPal = SelectPalette ( hDC, wd -> hPal, FALSE );
|
||||
|
||||
if ( RealizePalette ( hDC ) )
|
||||
|
||||
UpdateColors ( hDC );
|
||||
|
||||
} // end if
|
||||
|
||||
GetClipBox ( hDC, &invRect );
|
||||
FillRect ( hDC, &invRect, ( HBRUSH )( win -> HBackground () ) );
|
||||
|
||||
if ( wd -> hPal )
|
||||
|
||||
SelectPalette ( hDC, hOldPal, FALSE );
|
||||
|
||||
return TRUE;
|
||||
|
||||
} else if ( msg == WM_MOVE ) {
|
||||
|
||||
WINDOWPLACEMENT wp;
|
||||
|
||||
wp.length = sizeof ( WINDOWPLACEMENT );
|
||||
GetWindowPlacement ( hwnd, &wp );
|
||||
|
||||
win -> SetPos (
|
||||
wp.rcNormalPosition.left, wp.rcNormalPosition.top,
|
||||
wp.rcNormalPosition.right, wp.rcNormalPosition.bottom
|
||||
);
|
||||
|
||||
} // end else
|
||||
|
||||
return CallWindowProc ( lpfnWndProc, hwnd, msg, wParam, lParam );
|
||||
|
||||
} // end WNT_WndProc
|
||||
//***//
|
Reference in New Issue
Block a user