mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
3
src/WNT/Degrees.hxx
Executable file
3
src/WNT/Degrees.hxx
Executable file
@@ -0,0 +1,3 @@
|
||||
#define pi 3.1415926535897932385
|
||||
#define DEG(x) float(((x)*pi)/180.)
|
||||
|
1654
src/WNT/EHDC.cxx
Executable file
1654
src/WNT/EHDC.cxx
Executable file
File diff suppressed because it is too large
Load Diff
200
src/WNT/EHDC.hxx
Executable file
200
src/WNT/EHDC.hxx
Executable file
@@ -0,0 +1,200 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* EXTENDED HDC */
|
||||
/* */
|
||||
/* Abstract: extends existing WIN32's HDC ( styled lines drawing etc. ) */
|
||||
/* Note : use it only in Windows 95 since Windows NT provides these */
|
||||
/* functionalities */
|
||||
/* */
|
||||
/* History : JAN-1998 EUG ( creation ) */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
#ifndef __EHDC_HXX
|
||||
# define __EHDC_HXX
|
||||
|
||||
# ifndef __cplusplus
|
||||
# error "C++ compiler required for EHDC stuff"
|
||||
# endif /* __cplusplus */
|
||||
|
||||
# ifndef _WINDOWS_
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif /* STRICT */
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# include <windowsx.h>
|
||||
# endif /* WIN32_LEAN_AND_MEAN */
|
||||
# endif /* _WINDOWS_ */
|
||||
|
||||
# define ARCF_PIE 0x00000001
|
||||
# define ARCF_CHORD 0x00000002
|
||||
|
||||
# define POLYF_NOEDGE 0x00000001
|
||||
# define POLYF_NOCLOSEDGE 0x00000002
|
||||
|
||||
# define EHDCF_XFORM 0x00000001
|
||||
# define EHDCF_EPEN 0x00000002
|
||||
# define EHDCF_JOIN 0x00000004
|
||||
# define EHDCF_PDRAW 0x00000008
|
||||
# define EHDCF_CJOIN 0x00000010
|
||||
# define EHDCF_NJOIN 0x00000020
|
||||
# define EHDCF_JBEVL 0x00000040
|
||||
# define EHDCF_SFREE 0x80000000
|
||||
# define EHDCF_TPATH 0x40000000
|
||||
# define EHDCF_TREG 0x20000000
|
||||
# define EHDCF_PPUSH 0x10000000
|
||||
# define EHDCF_BPUSH 0x08000000
|
||||
# define EHDCF_DDAF 0x04000000
|
||||
|
||||
class EHDC { /* defined extended HDC */
|
||||
|
||||
public:
|
||||
|
||||
EHDC ( HDC, PSIZE ); /* constructor */
|
||||
EHDC (); /* yet another one */
|
||||
~EHDC (); /* destructor */
|
||||
|
||||
/*****************/
|
||||
/* DC MANAGEMENT */
|
||||
/*****************/
|
||||
|
||||
void SetDC ( HDC, PSIZE );
|
||||
/* sets WIN32's DC for graphics operations */
|
||||
HDC Hdc ( void ) { return myHDC; }
|
||||
/* returns WIN32's HDC */
|
||||
HBRUSH SelectEPen ( DWORD, CONST LOGBRUSH*, DWORD, DWORD*, BOOL = FALSE );
|
||||
/* selects pen for line drawing */
|
||||
void SelectEPen ( DWORD, CONST LOGBRUSH* );
|
||||
/* selects pen for line drawing ( old one is saved ) */
|
||||
HPEN SelectEPen ( HPEN );
|
||||
/* selects pen for line drawing */
|
||||
void SelectEBrush ( PLOGBRUSH, PLOGBRUSH = NULL );
|
||||
/* selects brush for polygon filling */
|
||||
int SetPolyFillMode ( int aMode ) { return ::SetPolyFillMode ( myHDC, aMode ); }
|
||||
/* sets polygon fill mode */
|
||||
|
||||
BOOL Miter ( void ) { return !( myFlags & EHDCF_JBEVL ); }
|
||||
/* checks for line join style */
|
||||
void SetMiter ( BOOL );
|
||||
/* sets line join style */
|
||||
|
||||
void Extent ( PSIZE psz ) { *psz = mySize; }
|
||||
/* Retrieves viewport extents */
|
||||
|
||||
/*******************/
|
||||
/* DRAWING METHODS */
|
||||
/*******************/
|
||||
|
||||
void MoveToEx ( int, int, LPPOINT );
|
||||
/* moves current point and begins a new path */
|
||||
BOOL LineTo ( int, int );
|
||||
/* draws a segment from current position and */
|
||||
/* updates this position */
|
||||
void ClosePath ( void );
|
||||
/* closes current path */
|
||||
void Polyline ( CONST POINT*, int, BOOL = FALSE );
|
||||
/* draws a polyline ( path and current position */
|
||||
/* are unchanged ) */
|
||||
void Polygon ( CONST POINT*, int, DWORD = 0 );
|
||||
/* draws a filled polygon ( path and current position */
|
||||
/* are unchanged ) */
|
||||
/* Note: specify n - 1 points in parameters */
|
||||
void Arc ( int, int, int, int, double = 0.0, double = 6.283185, DWORD = 0 );
|
||||
/* Draws an arc ( path and current position */
|
||||
/* are unchanged ) */
|
||||
void Polyarc ( int, int, int, int, double = 0.0, double = 6.283185, BOOL = TRUE );
|
||||
/* draws a polyarc ( path and current position */
|
||||
/* are unchanged ) */
|
||||
void SetPixel ( int, int, COLORREF );
|
||||
/* draws single pixel */
|
||||
|
||||
/****************/
|
||||
/* TEXT METHODS */
|
||||
/****************/
|
||||
|
||||
void SetTextColor ( COLORREF );
|
||||
void SetTextAttrib ( COLORREF, HFONT, double = 0.0, double = 1.0, double = 1.0 );
|
||||
void ETextOut ( int, int, char*, double = 0.0, BOOL = FALSE );
|
||||
void ETextOut ( int, int, wchar_t*, double = 0.0, BOOL = FALSE );
|
||||
void PolyTextOut (
|
||||
int, int, char*, double = 0.0, double = 0.1, BOOL = FALSE, BOOL = FALSE,
|
||||
BOOL = FALSE
|
||||
);
|
||||
void PolyTextOut (
|
||||
int, int, wchar_t*, double = 0.0, double = 0.1, BOOL = FALSE, BOOL = FALSE,
|
||||
BOOL = FALSE
|
||||
);
|
||||
|
||||
/**************************/
|
||||
/* TRANSFORMATION METHODS */
|
||||
/**************************/
|
||||
|
||||
void SetWorldTransform ( XFORM* );
|
||||
void ModifyWorldTransform ( XFORM*, DWORD );
|
||||
void GetWorldTransform ( XFORM* xf ) { *xf = myXform; }
|
||||
void Transform ( LPPOINT, int );
|
||||
|
||||
/**************************/
|
||||
/* UPDATED REGION METHODS */
|
||||
/**************************/
|
||||
|
||||
void ResetURect ( void );
|
||||
void SetURect ( LPRECT lpRect ) { myURect = *lpRect; }
|
||||
void GetURect ( LPRECT );
|
||||
void Register ( LPPOINT, int );
|
||||
|
||||
protected:
|
||||
|
||||
void _Init ( void );
|
||||
void _DrawTo ( PPOINT );
|
||||
void _Join ( void );
|
||||
BOOL _DrawToEx ( PPOINT );
|
||||
void _LineTo ( PPOINT );
|
||||
void _ETextOut ( int, int, void*, double = 0.0, BOOL = FALSE, BOOL = FALSE );
|
||||
void _PolyTextOut (
|
||||
int, int, void*, double = 0.0, double = 0.1,
|
||||
BOOL = FALSE, BOOL = FALSE, BOOL = FALSE, BOOL = FALSE
|
||||
);
|
||||
|
||||
HDC myHDC;
|
||||
POINT myStart;
|
||||
POINT myClose;
|
||||
POINT myA, myB;
|
||||
POINT myJoin;
|
||||
POINT myCJoin;
|
||||
XFORM myXform;
|
||||
DWORD myFlags;
|
||||
PPOINT myTextPath;
|
||||
PBYTE myTextType;
|
||||
DWORD myTextNP;
|
||||
DWORD myTextBS;
|
||||
HPEN myTextPen;
|
||||
HBRUSH myTextBrush;
|
||||
HFONT myTextFont;
|
||||
double myTextSlant;
|
||||
double myTextHScale;
|
||||
double myTextVScale;
|
||||
DWORD myPWidth, myPWPush;
|
||||
HPEN myPPen, myPPenPush;
|
||||
HBRUSH myPBrush, myPBrushPush;
|
||||
BOOL myfXpenPush;
|
||||
PDWORD myPStyle;
|
||||
DWORD myPNS;
|
||||
DWORD myPBS;
|
||||
DWORD myPIndex;
|
||||
DWORD myPRlen;
|
||||
RECT myURect;
|
||||
HBRUSH myBrush, myBrushPush;
|
||||
HBRUSH myOBrush;
|
||||
SIZE mySize;
|
||||
PPOINT myDDA1;
|
||||
PPOINT myDDA2;
|
||||
DWORD myNDDA;
|
||||
DWORD myIDDA;
|
||||
|
||||
friend VOID CALLBACK ___auxDDAF ( int, int, LPARAM );
|
||||
|
||||
};
|
||||
|
||||
#endif /* __EHDC_HXX */
|
32
src/WNT/FILES
Executable file
32
src/WNT/FILES
Executable file
@@ -0,0 +1,32 @@
|
||||
WNT.edl
|
||||
WNT_WOKSteps.edl
|
||||
WNT_CMPLRS.edl
|
||||
WNT_WOKUMake.edl
|
||||
Degrees.hxx
|
||||
EHDC.hxx
|
||||
W32_Allocator.hxx
|
||||
W95_Allocator.hxx
|
||||
WNT_Allocator.hxx
|
||||
WNT_ColorRef.hxx
|
||||
WNT_Dword.hxx
|
||||
WNT_LogFont.hxx
|
||||
WNT_Long.hxx
|
||||
WNT_MFTDraw.hxx
|
||||
WNT_Uint.hxx
|
||||
WNT.h
|
||||
WNT_Bitmap.h
|
||||
WNT_WindowData.hxx
|
||||
EHDC.cxx
|
||||
W32_Allocator.cxx
|
||||
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_MFTDraw.cxx
|
||||
WNT_Uint.cxx
|
||||
WNT_WindowData.cxx
|
||||
WNT_WndProc.cxx
|
277
src/WNT/W32_Allocator.cxx
Executable file
277
src/WNT/W32_Allocator.cxx
Executable file
@@ -0,0 +1,277 @@
|
||||
// File: W32_Allocator.cxx
|
||||
// Created: Feb 1998
|
||||
// Author: PLOTNIKOV Eugeny & CHABROVSKY Dmitry
|
||||
// Copyright: Matra Datavision 1998
|
||||
|
||||
#include <W32_Allocator.hxx>
|
||||
#include <W95_Allocator.hxx>
|
||||
#include <WNT_Allocator.hxx>
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
#pragma comment( lib, "gdi32.lib" )
|
||||
#pragma comment( lib, "user32.lib" )
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// I N I T I A L I Z A T I O N //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#define DEF_BLOCK_SIZE ( 2 * s_dwPageSize )
|
||||
|
||||
static DWORD s_dwPageSize;
|
||||
|
||||
PW32_Allocator ( *W32_GetAllocator ) ( int, PW32_Allocator );
|
||||
double W32_TextFactor;
|
||||
|
||||
static PW32_Allocator W95_GetAllocator ( int anID, PW32_Allocator head ) {
|
||||
|
||||
return new W95_Allocator ( anID, head );
|
||||
|
||||
} // end W95_GetAllocator
|
||||
|
||||
static PW32_Allocator WNT_GetAllocator ( int anID, PW32_Allocator head ) {
|
||||
|
||||
return new WNT_Allocator ( anID, head );
|
||||
|
||||
} // end WNT_GetAllocator
|
||||
|
||||
class _initAllocator {
|
||||
|
||||
public:
|
||||
|
||||
_initAllocator ();
|
||||
|
||||
};
|
||||
|
||||
_initAllocator :: _initAllocator () {
|
||||
|
||||
OSVERSIONINFO os;
|
||||
SYSTEM_INFO si;
|
||||
|
||||
GetSystemInfo ( &si );
|
||||
|
||||
s_dwPageSize = si.dwPageSize;
|
||||
|
||||
os.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO );
|
||||
GetVersionEx ( &os );
|
||||
|
||||
if ( os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) {
|
||||
doWin95:
|
||||
W32_GetAllocator = &W95_GetAllocator;
|
||||
W32_TextFactor = 5.0;
|
||||
|
||||
} else {
|
||||
|
||||
GetEnvironmentVariable ( TEXT( "CSF_WNT_FORCE_WIN95" ), NULL, 0 );
|
||||
|
||||
if ( GetLastError () != ERROR_ENVVAR_NOT_FOUND ) goto doWin95;
|
||||
|
||||
W32_GetAllocator = &WNT_GetAllocator;
|
||||
W32_TextFactor = 1.0;
|
||||
|
||||
} // end else
|
||||
|
||||
} // end constructor
|
||||
|
||||
static _initAllocator s_InitAllocator;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// W 3 2 _ A L L O C A T O R S T U F F //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
W32_Allocator :: W32_Allocator ( int anID, PW32_Allocator head ) :
|
||||
myID ( anID ), myFlags ( W32F_EMPTY ), myEnd ( NULL ),
|
||||
myNext ( NULL ) {
|
||||
|
||||
LOGFONT lf;
|
||||
HDC hdc = GetDC ( NULL );
|
||||
|
||||
GetObject ( hdc, sizeof ( LOGFONT ), &lf );
|
||||
|
||||
ReleaseDC ( NULL, hdc );
|
||||
|
||||
lf.lfOutPrecision |= OUT_TT_ONLY_PRECIS;
|
||||
|
||||
if ( head != NULL ) {
|
||||
|
||||
while ( head -> myNext != NULL ) head = head -> myNext;
|
||||
|
||||
head -> myNext = this;
|
||||
|
||||
} // end if
|
||||
|
||||
myStart = MakeBlock ( DEF_BLOCK_SIZE );
|
||||
|
||||
myTextFont = CreateFontIndirect ( &lf );
|
||||
myTextSlant = 0.0;
|
||||
myTextHScale =
|
||||
myTextVScale = 1.0 / W32_TextFactor;
|
||||
|
||||
myScaleX = myScaleY = 1.0;
|
||||
myAngle = 0.0;
|
||||
myPivot.x = myMove.x =
|
||||
myPivot.y = myMove.y = 0;
|
||||
|
||||
myFlags = ( W32F_EMPTY | W32F_POUTL | W32F_DFONT );
|
||||
myPrimitive = zzNone;
|
||||
|
||||
myPointColor =
|
||||
myMarkerPointColor = RGB( 255, 255, 255 );
|
||||
|
||||
} // end constructor
|
||||
|
||||
W32_Allocator :: ~W32_Allocator () {
|
||||
|
||||
KillBlocks ( myStart );
|
||||
|
||||
if ( myFlags & W32F_DFONT ) DeleteFont( myTextFont );
|
||||
|
||||
} // end destructor
|
||||
|
||||
PW32_Block W32_Allocator :: MakeBlock ( int aBlockSize ) {
|
||||
|
||||
PW32_Block retVal;
|
||||
|
||||
aBlockSize = ( s_dwPageSize / aBlockSize + 1 ) * s_dwPageSize;
|
||||
|
||||
retVal = ( PW32_Block )VirtualAlloc (
|
||||
NULL, aBlockSize, MEM_RESERVE | MEM_COMMIT,
|
||||
PAGE_READWRITE
|
||||
);
|
||||
|
||||
if ( retVal == NULL ) RaiseException ( STATUS_NO_MEMORY, 0, 0, NULL );
|
||||
|
||||
if ( myEnd != NULL ) myEnd -> next = retVal;
|
||||
|
||||
myEnd = retVal;
|
||||
|
||||
retVal -> next = NULL;
|
||||
retVal -> size = aBlockSize / sizeof ( int ) - sizeof ( W32_Block ) / sizeof ( int );
|
||||
retVal -> free = 0;
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end W32_Allocator :: MakeBlock
|
||||
|
||||
PW32_Block W32_Allocator :: KillBlock ( PW32_Block aVictim ) {
|
||||
|
||||
PW32_Block next = aVictim -> next;
|
||||
|
||||
ReleaseBlock ( aVictim );
|
||||
|
||||
VirtualFree ( ( LPVOID )aVictim, 0, MEM_RELEASE );
|
||||
|
||||
return next;
|
||||
|
||||
} // end W32_Allocator :: KillBlock
|
||||
|
||||
void W32_Allocator :: KillBlocks ( PW32_Block aBegin ) {
|
||||
|
||||
while ( ( aBegin = KillBlock ( aBegin ) ) != NULL );
|
||||
|
||||
} // end W32_Allocator :: KillBlocks
|
||||
|
||||
void W32_Allocator :: ClearBlocks ( void ) {
|
||||
|
||||
if ( myStart -> next != NULL ) KillBlocks ( myStart -> next );
|
||||
|
||||
ReleaseBlock ( myStart );
|
||||
|
||||
myStart -> next = NULL;
|
||||
myStart -> free = 0;
|
||||
myEnd = myStart;
|
||||
|
||||
myFlags &= ~W32F_DRAWN;
|
||||
myFlags |= W32F_EMPTY;
|
||||
|
||||
} // end W32_Allocator :: ClearBlocks
|
||||
|
||||
void W32_Allocator :: ReleaseBlock ( PW32_Block pb ) {
|
||||
|
||||
for ( int i = 0; i < pb -> free; i += pb -> data[ i ] )
|
||||
|
||||
if ( pb -> data[ i + 1 ] != __W32_DATA ) {
|
||||
|
||||
W32_Note* pNote = ( W32_Note* )&( pb -> data[ i + 1 ] );
|
||||
pNote -> ~W32_Note ();
|
||||
|
||||
} // end if
|
||||
|
||||
} // end W32_Allocator :: ReleaseBlock
|
||||
|
||||
BOOL W32_Allocator :: FreeSpace ( PW32_Block aBlock, int aQuerySize ) {
|
||||
|
||||
return ( aBlock -> size >= ( aBlock -> free + aQuerySize + 1 ) );
|
||||
|
||||
} // end W32_Allocator :: FreeSpace
|
||||
|
||||
PW32_Block W32_Allocator :: ReserveData ( unsigned int iSize ) {
|
||||
|
||||
if ( !FreeSpace ( myEnd, iSize ) ) return NULL;
|
||||
|
||||
return myEnd;
|
||||
|
||||
} // end W32_Allocator :: ReserveData
|
||||
|
||||
PW32_Block W32_Allocator :: ReserveFind ( unsigned int iSize ) {
|
||||
|
||||
PW32_Block aBlock = myStart;
|
||||
for ( ; aBlock != NULL; aBlock = aBlock -> next )
|
||||
|
||||
if ( FreeSpace ( aBlock, iSize ) ) break;
|
||||
|
||||
return aBlock;
|
||||
|
||||
} // end W32_Allocator :: ReserveFind
|
||||
|
||||
void* W32_Allocator :: ReserveBlock ( PW32_Block aBlock, int aQuerySize, BOOL fData ) {
|
||||
|
||||
void* retVal;
|
||||
|
||||
++aQuerySize;
|
||||
|
||||
retVal = fData ? &( aBlock -> data[ aBlock -> free + 2 ] ) :
|
||||
&( aBlock -> data[ aBlock -> free + 1 ] );
|
||||
|
||||
aBlock -> data[ aBlock -> free ] = aQuerySize;
|
||||
aBlock -> data[ aBlock -> free + 1 ] = __W32_DATA;
|
||||
aBlock -> free += aQuerySize;
|
||||
|
||||
return retVal;
|
||||
|
||||
} // end W32_Allocator :: ReserveBlock
|
||||
|
||||
void* W32_Allocator :: NewClass ( unsigned int nBytes ) {
|
||||
|
||||
PW32_Block aBlock = myEnd;
|
||||
|
||||
nBytes = ( ( nBytes + 3 ) / sizeof ( int ) );
|
||||
|
||||
if ( !FreeSpace ( aBlock, nBytes ) ) aBlock = MakeBlock ( nBytes );
|
||||
|
||||
myFlags &= ~W32F_EMPTY;
|
||||
|
||||
return ReserveBlock ( aBlock, nBytes );
|
||||
|
||||
} // end W32_Allocator :: NewClass
|
||||
|
||||
void* W32_Allocator :: NewData ( unsigned int nBytes, BOOL fFind ) {
|
||||
|
||||
PW32_Block aBlock;
|
||||
|
||||
nBytes = ( ( nBytes + 3 ) / sizeof ( int ) ) + 1;
|
||||
|
||||
aBlock = fFind ? ReserveFind ( nBytes ) : ReserveData ( nBytes );
|
||||
|
||||
if ( aBlock == NULL ) aBlock = MakeBlock ( nBytes );
|
||||
|
||||
return ReserveBlock ( myEnd, nBytes, TRUE );
|
||||
|
||||
} // end W32_Allocator :: NewData
|
||||
|
||||
void* W32_Note :: operator new ( size_t cSize, PW32_Allocator anAllocator ) {
|
||||
|
||||
W32_Note* note = ( W32_Note* )anAllocator -> NewClass ( cSize );
|
||||
|
||||
note -> myAllocator = anAllocator;
|
||||
|
||||
return ( void* )note;
|
||||
|
||||
} // end W32_Note :: operator new
|
773
src/WNT/W32_Allocator.hxx
Executable file
773
src/WNT/W32_Allocator.hxx
Executable file
@@ -0,0 +1,773 @@
|
||||
// File: W32_Allocator.hxx
|
||||
// Created: Feb 1998
|
||||
// Author: PLOTNIKOV Eugeny & CHABROVSKY Dmitry
|
||||
// Copyright: Matra Datavision 1998
|
||||
|
||||
#ifndef __W32_ALLOCATOR_HXX
|
||||
# define __W32_ALLOCATOR_HXX
|
||||
|
||||
# ifndef _WINDOWS_
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif /* STRICT */
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# ifdef NOGDI
|
||||
# undef NOGDI /* we need GDI definitions here... */
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# endif /* WIN32_LEAN_AND_MEAN */
|
||||
# endif /* _WINDOWS */
|
||||
|
||||
# define __W32_DATA -1
|
||||
|
||||
# define EPS 0.005F
|
||||
|
||||
# define W32F_TOUTLINE 0x00000001 // text flags
|
||||
# define W32F_TUNICODE 0x00000002
|
||||
# define W32F_TINDEX 0x00000004
|
||||
# define W32F_TFREE 0x00000008
|
||||
# define W32F_TFULINED 0x00000010
|
||||
|
||||
# define W32F_EMPTY 0x00000001
|
||||
# define W32F_DRAWN 0x00000002
|
||||
# define W32F_XFORM 0x00000004
|
||||
# define W32F_MONO 0x00000008
|
||||
# define W32F_DBUFF 0x00000010
|
||||
# define W32F_START 0x00000020
|
||||
# define W32F_WIN95 0x00000040
|
||||
# define W32F_DVDRV 0x00000080
|
||||
# define W32F_TULIN 0x00000100
|
||||
# define W32F_MINIT 0x00000200
|
||||
# define W32F_NOFIL 0x00000400
|
||||
# define W32F_MFILL 0x80000000
|
||||
# define W32F_MOUTL 0x40000000
|
||||
# define W32F_POUTL 0x20000000
|
||||
# define W32F_DFONT 0x10000000
|
||||
|
||||
#define OCC5415 /* avoid warning C4291 in MS VC++ 6.0 */
|
||||
|
||||
typedef enum {
|
||||
|
||||
zzNone, zzPoint, zzLine, zzPolyRect, zzRect, zzPolyEllipse,
|
||||
zzRoundRect, zzPolyRoundRect, zzArc, zzChord, zzPolyChord, zzSector,
|
||||
zzPolySector, zzPolygon, zzPolyline, zzLinkedPolyline, zzBezier, zzText,
|
||||
zzPolyText, zzMarker
|
||||
|
||||
} W32_Primitive;
|
||||
|
||||
struct W32_Allocator;
|
||||
typedef W32_Allocator* PW32_Allocator;
|
||||
|
||||
typedef struct _W32_Block { // memory block
|
||||
|
||||
_W32_Block* next;
|
||||
int size;
|
||||
int free;
|
||||
int data[ 1 ];
|
||||
|
||||
} W32_Block, *PW32_Block;
|
||||
|
||||
typedef struct _W32_bitmap {
|
||||
|
||||
int nUsed;
|
||||
HBITMAP hBmp;
|
||||
|
||||
} W32_Bitmap, *PW32_Bitmap;
|
||||
|
||||
typedef struct _W32_FCallParam {
|
||||
|
||||
void* pAllocator;
|
||||
void* pDriver;
|
||||
|
||||
} W32_FCALLPARAM, *PW32_FCALLPARAM;
|
||||
|
||||
typedef void ( WINAPI *GetPointFunc ) ( int, int, int, LPPOINT, int*, void* );
|
||||
|
||||
typedef void ( __cdecl *W32_FCall ) ( PW32_FCALLPARAM );
|
||||
|
||||
struct W32_Note { // base class to represent graphic object
|
||||
|
||||
W32_Note () {}
|
||||
virtual ~W32_Note () {}
|
||||
|
||||
void* operator new ( size_t, W32_Allocator* );
|
||||
|
||||
virtual void Play ( BOOL = TRUE ) = 0;
|
||||
virtual void Xform ( void ) {}
|
||||
virtual void Release ( void ) {}
|
||||
|
||||
PW32_Allocator myAllocator;
|
||||
|
||||
#ifdef OCC5415
|
||||
void operator delete (void*, W32_Allocator*) {}
|
||||
private: // to protect against possible accidental usage
|
||||
void operator delete (void* p) {}
|
||||
#endif
|
||||
};
|
||||
///
|
||||
///////////////////////// POINTS ////////////////////////////
|
||||
///
|
||||
struct W32_PointNote : public W32_Note {
|
||||
|
||||
W32_PointNote ( int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
int myX, myY;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PointNote : public W32_PointNote {
|
||||
|
||||
WNT_PointNote ( int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
virtual void Xform ( void );
|
||||
|
||||
int myTX, myTY;
|
||||
|
||||
};
|
||||
|
||||
struct W32_MarkerPointNote : public W32_PointNote {
|
||||
|
||||
W32_MarkerPointNote ( int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_MarkerPointNote : public WNT_PointNote {
|
||||
|
||||
WNT_MarkerPointNote ( int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
///////////////////////// LINES //////////////////////////////
|
||||
///
|
||||
struct W32_LineNote : public W32_PointNote {
|
||||
|
||||
W32_LineNote ( int, int, int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
int myX2, myY2;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_LineNote : public WNT_PointNote {
|
||||
|
||||
WNT_LineNote ( int, int, int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
virtual void Xform ( void );
|
||||
|
||||
int myX2, myY2, myTX2, myTY2;
|
||||
|
||||
};
|
||||
///
|
||||
////////////////////// POLY ELLIPSES /////////////////////////
|
||||
///
|
||||
struct W32_PolyEllipseNote : public W32_PointNote {
|
||||
|
||||
W32_PolyEllipseNote ( int, int, int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
int myXr, myYr;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolyEllipseNote : public WNT_PointNote {
|
||||
|
||||
WNT_PolyEllipseNote ( int, int, int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
virtual void Xform ( void );
|
||||
|
||||
int myXr, myYr, myTXr, myTYr;
|
||||
|
||||
};
|
||||
///
|
||||
///////////////////////// ELLIPSES ///////////////////////////
|
||||
///
|
||||
struct W32_EllipseNote : public W32_PolyEllipseNote {
|
||||
|
||||
W32_EllipseNote ( int, int, int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_EllipseNote : public WNT_PolyEllipseNote {
|
||||
|
||||
WNT_EllipseNote ( int, int, int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
/////////////////////////// ARCS /////////////////////////////
|
||||
///
|
||||
struct W32_ArcNote : public W32_PolyEllipseNote {
|
||||
|
||||
W32_ArcNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
double mySa, myOa;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_ArcNote : public WNT_PolyEllipseNote {
|
||||
|
||||
WNT_ArcNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
virtual void Xform ( void );
|
||||
|
||||
int mySX, mySY, myTSX, myTSY,
|
||||
myEX, myEY, myTEX, myTEY,
|
||||
myDirect;
|
||||
};
|
||||
///
|
||||
/////////////////////// POLY CHORDS //////////////////////////
|
||||
///
|
||||
struct W32_PolyChordNote : public W32_ArcNote {
|
||||
|
||||
W32_PolyChordNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolyChordNote : public WNT_ArcNote {
|
||||
|
||||
WNT_PolyChordNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
////////////////////////// CHORDS ////////////////////////////
|
||||
///
|
||||
struct W32_ChordNote : public W32_PolyChordNote {
|
||||
|
||||
W32_ChordNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_ChordNote : public WNT_PolyChordNote {
|
||||
|
||||
WNT_ChordNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
////////////////////// POLY SECTORS //////////////////////////
|
||||
///
|
||||
struct W32_PolySectorNote : public W32_ArcNote {
|
||||
|
||||
W32_PolySectorNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolySectorNote : public WNT_ArcNote {
|
||||
|
||||
WNT_PolySectorNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
/////////////////////// SECTORS //////////////////////////////
|
||||
///
|
||||
struct W32_SectorNote : public W32_PolySectorNote {
|
||||
|
||||
W32_SectorNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_SectorNote : public WNT_PolySectorNote {
|
||||
|
||||
WNT_SectorNote ( int, int, int, int, double, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
/////////////////////// MARKERS //////////////////////////////
|
||||
///
|
||||
struct W32_PolyMarkerNote : public W32_Note {
|
||||
|
||||
W32_PolyMarkerNote ( int );
|
||||
|
||||
void Replace ( int, int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE ) {}
|
||||
|
||||
int myMaxPoints, mySetPoints;
|
||||
LPPOINT myPoints;
|
||||
|
||||
};
|
||||
|
||||
struct W32_PolyMarker1Note : public W32_PolyMarkerNote {
|
||||
|
||||
W32_PolyMarker1Note ( int, GetPointFunc, int, void* );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolyMarker1Note : public W32_PolyMarker1Note {
|
||||
|
||||
WNT_PolyMarker1Note ( int, GetPointFunc, int, void* );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct W32_PolyMarker2Note : public W32_PolyMarker1Note {
|
||||
|
||||
W32_PolyMarker2Note ( int, GetPointFunc, int, void* );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolyMarker2Note : public WNT_PolyMarker1Note {
|
||||
|
||||
WNT_PolyMarker2Note ( int, GetPointFunc, int, void* );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
/////////////////////// POLYGONS /////////////////////////////
|
||||
///
|
||||
struct W32_PolygonNote : public W32_PolyMarkerNote {
|
||||
|
||||
W32_PolygonNote ( int );
|
||||
|
||||
void Add ( int, int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolygonNote : public W32_PolygonNote {
|
||||
|
||||
WNT_PolygonNote ( int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
virtual void Xform ( void );
|
||||
|
||||
LPPOINT myTPoints;
|
||||
|
||||
};
|
||||
///
|
||||
/////////////////////// POLYLINES ////////////////////////////
|
||||
///
|
||||
struct W32_PolylineNote : public W32_PolygonNote {
|
||||
|
||||
W32_PolylineNote ( int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolylineNote : public WNT_PolygonNote {
|
||||
|
||||
WNT_PolylineNote ( int );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
///////////////////////// IMAGES /////////////////////////////
|
||||
///
|
||||
struct W32_ImageNote : public W32_PointNote {
|
||||
|
||||
W32_ImageNote ( int, int, PW32_Bitmap, double = 1.0 );
|
||||
virtual ~W32_ImageNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
PW32_Bitmap myBitmap;
|
||||
double myScale;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_ImageNote : public WNT_PointNote {
|
||||
|
||||
WNT_ImageNote ( int, int, PW32_Bitmap, double = 1.0 );
|
||||
virtual ~WNT_ImageNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
PW32_Bitmap myBitmap;
|
||||
double myScale;
|
||||
|
||||
};
|
||||
///
|
||||
///////////////////////// TEXTS //////////////////////////////
|
||||
///
|
||||
struct W32_TextNote : public W32_PointNote {
|
||||
|
||||
W32_TextNote ( int, int, double, void*, BOOL = FALSE, BOOL = FALSE );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
void* myText;
|
||||
double myAngle;
|
||||
DWORD myFlags;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_TextNote : public WNT_PointNote {
|
||||
|
||||
WNT_TextNote ( int, int, double, void*, BOOL = FALSE, BOOL = FALSE );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
virtual void Xform ( void );
|
||||
void SetAttribs ();
|
||||
void RestoreAttribs ();
|
||||
void PaintText ();
|
||||
void OutlineText ();
|
||||
void FillText ();
|
||||
|
||||
void* myText;
|
||||
double mySlant;
|
||||
DWORD myFlags;
|
||||
int myShift;
|
||||
XFORM RMatrix,
|
||||
IMatrix,
|
||||
SMatrix;
|
||||
|
||||
};
|
||||
///
|
||||
/////////////////////// POLYTEXTS ////////////////////////////
|
||||
///
|
||||
struct W32_PolyTextNote : public W32_TextNote {
|
||||
|
||||
W32_PolyTextNote ( int, int, double, double, void*, BOOL = FALSE, BOOL = FALSE );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
double myMargin;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolyTextNote : public WNT_TextNote {
|
||||
|
||||
WNT_PolyTextNote ( int, int, double, double, void*, BOOL = FALSE, BOOL = FALSE );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
double myMargin;
|
||||
|
||||
};
|
||||
///
|
||||
////////////////// BEGIN/END MARKERS /////////////////////////
|
||||
///
|
||||
struct W32_BeginMarkerNote : public W32_PointNote {
|
||||
|
||||
W32_BeginMarkerNote ( int, int, int, int, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
int myWidth, myHeight;
|
||||
double myAngle;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_BeginMarkerNote : public WNT_PointNote {
|
||||
|
||||
WNT_BeginMarkerNote ( int, int, int, int, double );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
virtual void Xform ( void );
|
||||
|
||||
int myWidth, myHeight;
|
||||
double myAngle, myPrevAngle;
|
||||
XFORM myMatrix;
|
||||
|
||||
};
|
||||
|
||||
struct W32_EndMarkerNote : public W32_Note {
|
||||
|
||||
W32_EndMarkerNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
|
||||
struct WNT_EndMarkerNote : public W32_Note {
|
||||
|
||||
WNT_EndMarkerNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
};
|
||||
///
|
||||
//////////////////// A T T R I B U T E S /////////////////////
|
||||
///
|
||||
struct W32_LineAttribNote : public W32_Note {
|
||||
|
||||
W32_LineAttribNote ( DWORD, PLOGBRUSH, DWORD = 0, PDWORD = NULL );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
LOGBRUSH myLogBrush;
|
||||
DWORD myPenWidth;
|
||||
DWORD myStyleCount;
|
||||
PDWORD myStyles;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_LineAttribNote : public W32_Note {
|
||||
|
||||
WNT_LineAttribNote ( DWORD, PLOGBRUSH, DWORD = 0, PDWORD = NULL );
|
||||
virtual ~WNT_LineAttribNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
HPEN myPen;
|
||||
DWORD myWidth;
|
||||
COLORREF myPointColor;
|
||||
|
||||
};
|
||||
|
||||
struct W32_PolyAttribNote : public W32_Note {
|
||||
|
||||
W32_PolyAttribNote ( PLOGBRUSH, BOOL, int = ALTERNATE );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
LOGBRUSH myBrush;
|
||||
BOOL myfEdge;
|
||||
int myFillMode;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_PolyAttribNote : public W32_Note {
|
||||
|
||||
WNT_PolyAttribNote ( PLOGBRUSH, BOOL, int = ALTERNATE );
|
||||
virtual ~WNT_PolyAttribNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
HBRUSH myBrush;
|
||||
BOOL myfEdge;
|
||||
int myFillMode;
|
||||
BOOL myNoFill;
|
||||
|
||||
};
|
||||
|
||||
struct W32_TextAttribNote : public W32_Note {
|
||||
|
||||
W32_TextAttribNote (
|
||||
HFONT, COLORREF, double = 0.0, double = 1.0, double = 1.0,
|
||||
BOOL = FALSE, BOOL = FALSE, BOOL = FALSE
|
||||
);
|
||||
virtual ~W32_TextAttribNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
COLORREF myColor;
|
||||
HFONT myFont;
|
||||
DWORD myFlags;
|
||||
double mySlant,
|
||||
myHScale,
|
||||
myVScale;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_TextAttribNote : public W32_Note {
|
||||
|
||||
WNT_TextAttribNote (
|
||||
HFONT, COLORREF, double = 0.0, double = 1.0, double = 1.0,
|
||||
BOOL = FALSE, BOOL = FALSE, BOOL = FALSE
|
||||
);
|
||||
virtual ~WNT_TextAttribNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
COLORREF myColor;
|
||||
HPEN myPen;
|
||||
HBRUSH myBrush;
|
||||
HFONT myFont;
|
||||
BOOL myfFree;
|
||||
DWORD myFlags;
|
||||
double mySlant,
|
||||
myHScale,
|
||||
myVScale;
|
||||
|
||||
};
|
||||
|
||||
struct W32_MarkerAttribNote : public W32_Note {
|
||||
|
||||
W32_MarkerAttribNote ( COLORREF, DWORD, BOOL );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
LOGBRUSH myLogBrush;
|
||||
|
||||
};
|
||||
|
||||
struct WNT_MarkerAttribNote : public W32_Note {
|
||||
|
||||
WNT_MarkerAttribNote ( COLORREF, DWORD, BOOL );
|
||||
virtual ~WNT_MarkerAttribNote ();
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
HPEN myPen;
|
||||
COLORREF myMarkerPointColor;
|
||||
BOOL myFill;
|
||||
|
||||
};
|
||||
///
|
||||
//////////////////// F U N C T I O N C A L L ////////////////
|
||||
///
|
||||
struct W32_FCallNote : public W32_Note {
|
||||
|
||||
W32_FCallNote ( W32_FCall, int, PW32_FCALLPARAM );
|
||||
|
||||
virtual void Play ( BOOL = TRUE );
|
||||
|
||||
W32_FCall myFunc;
|
||||
PW32_FCALLPARAM myParam;
|
||||
|
||||
};
|
||||
///
|
||||
//////////////////// A L L O C A T O R ///////////////////////
|
||||
///
|
||||
struct W32_Allocator {
|
||||
|
||||
W32_Allocator ( int, PW32_Allocator = NULL );
|
||||
virtual ~W32_Allocator ();
|
||||
|
||||
PW32_Block MakeBlock ( int );
|
||||
// allocates memory block
|
||||
virtual PW32_Block KillBlock ( PW32_Block );
|
||||
// deallocates memory block
|
||||
void KillBlocks ( PW32_Block );
|
||||
// deallocates memory blocks starting from specified one
|
||||
void ClearBlocks ( void );
|
||||
// resets allocator
|
||||
void ReleaseBlock ( PW32_Block );
|
||||
// releases graphics primitives in the specified block
|
||||
BOOL FreeSpace ( PW32_Block, int );
|
||||
// checks for free space in the specified block
|
||||
PW32_Block ReserveData ( unsigned int );
|
||||
// checks for free space in the current block
|
||||
PW32_Block ReserveFind ( unsigned int );
|
||||
// searches for free space
|
||||
void* ReserveBlock ( PW32_Block, int, BOOL = FALSE );
|
||||
// reserves data in the specified block
|
||||
void* NewClass ( unsigned int );
|
||||
// gets space for a new class ( W32_Note )
|
||||
void* NewData ( unsigned int, BOOL = FALSE );
|
||||
// gets space for a new data
|
||||
virtual void Xform ( void ) = 0;
|
||||
// sets world transformation in the device context
|
||||
|
||||
virtual void Play ( HDC, PSIZE ) = 0;
|
||||
// plays notes
|
||||
virtual void URect ( LPRECT ) = 0;
|
||||
// gets updated rectangle
|
||||
|
||||
virtual void Point ( int, int ) = 0;
|
||||
// stores a point
|
||||
virtual void MarkerPoint ( int, int ) = 0;
|
||||
// stores a marker point
|
||||
virtual void Line ( int, int, int, int ) = 0;
|
||||
// stores a line segment
|
||||
virtual void PolyEllipse ( int, int, int, int ) = 0;
|
||||
// stores a polyellipse
|
||||
virtual void Ellipse ( int, int, int, int ) = 0;
|
||||
// stores an ellipse
|
||||
virtual void Arc ( int, int, int, int, double, double ) = 0;
|
||||
// stores an arc
|
||||
virtual void PolyChord ( int, int, int, int, double, double ) = 0;
|
||||
// stores a polychord
|
||||
virtual void Chord ( int, int, int, int, double, double ) = 0;
|
||||
// stores a chord
|
||||
virtual void PolySector ( int, int, int, int, double, double ) = 0;
|
||||
// stores a polysector
|
||||
virtual void Sector ( int, int, int, int, double, double ) = 0;
|
||||
// stores a sector
|
||||
virtual void PolyMarker ( int ) = 0;
|
||||
// stores a polymarker
|
||||
virtual void PolyMarker1 ( int, GetPointFunc, int, void* ) = 0;
|
||||
// stores a polymarker1
|
||||
virtual void PolyMarker2 ( int, GetPointFunc, int, void* ) = 0;
|
||||
// stores a polymarker2
|
||||
virtual W32_Note* Polygon ( int ) = 0;
|
||||
// stores a polygon
|
||||
virtual W32_Note* Polyline ( int ) = 0;
|
||||
// stores a polyline
|
||||
virtual void Image ( int, int, PW32_Bitmap, double = 1.0 ) = 0;
|
||||
// stores an image
|
||||
virtual void Text ( int, int, double, void*, BOOL = FALSE, BOOL = FALSE ) = 0;
|
||||
// stores a text
|
||||
virtual void Polytext ( int, int, double, double, void*, BOOL = FALSE, BOOL = FALSE ) = 0;
|
||||
// stores a polytext
|
||||
virtual void BeginMarker ( int, int, int, int, double ) = 0;
|
||||
// stores the begin of marker
|
||||
virtual void EndMarker ( void ) = 0;
|
||||
// stores end of the marker
|
||||
virtual void LineAttrib ( DWORD, PLOGBRUSH, DWORD = 0, PDWORD = NULL ) = 0;
|
||||
// stores line attributes
|
||||
virtual void PolyAttrib ( PLOGBRUSH, BOOL, int = ALTERNATE ) = 0;
|
||||
// stores polygon attributes
|
||||
virtual void TextAttrib (
|
||||
HFONT, COLORREF, double = 0.0, double = 1.0, double = 1.0,
|
||||
BOOL = FALSE, BOOL = FALSE, BOOL = FALSE
|
||||
) = 0;
|
||||
//stores text attributes
|
||||
virtual void MarkerAttrib ( COLORREF, DWORD, BOOL ) = 0;
|
||||
// stores marker attributes
|
||||
virtual void FunCall ( W32_FCall, int, PW32_FCALLPARAM ) = 0;
|
||||
// stores function call
|
||||
|
||||
virtual int TextSize ( HDC, char*, PSIZE ) = 0;
|
||||
virtual int TextSize ( HDC, wchar_t*, PSIZE ) = 0;
|
||||
//obtains dimensions of the text string
|
||||
|
||||
int myID;
|
||||
PW32_Allocator myNext;
|
||||
PW32_Block myStart, myEnd;
|
||||
W32_Primitive myPrimitive;
|
||||
W32_Note* myNote;
|
||||
int myFillMode;
|
||||
DWORD myFlags;
|
||||
POINT myPivot;
|
||||
POINT myMove;
|
||||
double myScaleX, myScaleY;
|
||||
double myAngle;
|
||||
double myTextVScale;
|
||||
double myTextHScale;
|
||||
double myTextSlant;
|
||||
HFONT myTextFont;
|
||||
COLORREF myPointColor,
|
||||
myMarkerPointColor;
|
||||
|
||||
};
|
||||
|
||||
extern PW32_Allocator ( *W32_GetAllocator ) ( int, PW32_Allocator );
|
||||
|
||||
#define P(v) LONG( ( v ) / myPixelToUnit + 0.5 )
|
||||
#define U(v) ( ( v ) * myPixelToUnit )
|
||||
|
||||
#endif // __W32_ALLOCATOR_HXX
|
1202
src/WNT/W95_Allocator.cxx
Executable file
1202
src/WNT/W95_Allocator.cxx
Executable file
File diff suppressed because it is too large
Load Diff
73
src/WNT/W95_Allocator.hxx
Executable file
73
src/WNT/W95_Allocator.hxx
Executable file
@@ -0,0 +1,73 @@
|
||||
// File: W95_Allocator.hxx
|
||||
// Created: Feb 1998
|
||||
// Author: PLOTNIKOV Eugeny & CHABROVSKY Dmitry
|
||||
// Copyright: Matra Datavision 1998
|
||||
|
||||
#ifndef __W95_ALLOCATOR_HXX
|
||||
# define __W95_ALLOCATOR_HXX
|
||||
|
||||
# include "EHDC.hxx"
|
||||
# include "W32_Allocator.hxx"
|
||||
|
||||
struct W95_Allocator : public W32_Allocator {
|
||||
|
||||
W95_Allocator ( int, PW32_Allocator = NULL );
|
||||
virtual ~W95_Allocator ();
|
||||
|
||||
virtual void Xform ( void );
|
||||
|
||||
virtual void Play ( HDC, PSIZE );
|
||||
virtual void URect ( LPRECT );
|
||||
|
||||
virtual void Point ( int, int );
|
||||
virtual void MarkerPoint ( int, int );
|
||||
virtual void Line ( int, int, int, int );
|
||||
virtual void PolyEllipse ( int, int, int, int );
|
||||
virtual void Ellipse ( int, int, int, int );
|
||||
virtual void Arc ( int, int, int, int, double, double );
|
||||
virtual void PolyChord ( int, int, int, int, double, double );
|
||||
virtual void Chord ( int, int, int, int, double, double );
|
||||
virtual void PolySector ( int, int, int, int, double, double );
|
||||
virtual void Sector ( int, int, int, int, double, double );
|
||||
virtual void PolyMarker ( int );
|
||||
virtual void PolyMarker1 ( int, GetPointFunc, int, void* );
|
||||
virtual void PolyMarker2 ( int, GetPointFunc, int, void* );
|
||||
virtual W32_Note* Polygon ( int );
|
||||
virtual W32_Note* Polyline( int );
|
||||
virtual void Image ( int, int, PW32_Bitmap, double = 1.0 );
|
||||
virtual void Text ( int, int, double, void*, BOOL = FALSE, BOOL = FALSE );
|
||||
virtual void Polytext ( int, int, double, double, void*, BOOL = FALSE, BOOL = FALSE );
|
||||
virtual void BeginMarker ( int, int, int, int, double );
|
||||
virtual void EndMarker ( void );
|
||||
virtual void LineAttrib ( DWORD, PLOGBRUSH, DWORD = 0, PDWORD = NULL );
|
||||
virtual void PolyAttrib ( PLOGBRUSH, BOOL, int = ALTERNATE );
|
||||
virtual void TextAttrib (
|
||||
HFONT, COLORREF, double = 0.0, double = 1.0, double = 1.0,
|
||||
BOOL = FALSE, BOOL = FALSE, BOOL = FALSE
|
||||
);
|
||||
virtual void MarkerAttrib ( COLORREF, DWORD, BOOL );
|
||||
virtual void FunCall ( W32_FCall, int, PW32_FCALLPARAM );
|
||||
|
||||
virtual int TextSize ( HDC, char*, PSIZE );
|
||||
virtual int TextSize ( HDC, wchar_t*, PSIZE );
|
||||
|
||||
LOGBRUSH myLineBrush; // line attributes
|
||||
DWORD myLinePenWidth;
|
||||
DWORD myLineStyleCount;
|
||||
PDWORD myLineStyles;
|
||||
|
||||
LOGBRUSH myPolyBrush; // polygon attributes
|
||||
|
||||
COLORREF myTextColor; // text attributes
|
||||
|
||||
LOGBRUSH myMarkerBrush; // marker attributes
|
||||
LOGBRUSH myMarkerBrushOrig;
|
||||
DWORD myMarkerWidth;
|
||||
|
||||
EHDC myHDC;
|
||||
|
||||
};
|
||||
|
||||
typedef W95_Allocator* PW95_Allocator;
|
||||
|
||||
#endif // __W95_ALLOCATOR_HXX
|
184
src/WNT/WNT.cdl
Executable file
184
src/WNT/WNT.cdl
Executable file
@@ -0,0 +1,184 @@
|
||||
-- File: WNT.cdl
|
||||
-- Created: Tue Jan 23 16:05:48 1996
|
||||
-- Authors: LAVNIKOV Alexey, PLOTNIKOV Eugeny & CHABROVSKY Dmitry
|
||||
-- <eugeny@proton>
|
||||
-- Modifications: DCB at March 1998 Porting MFT for Windows NT (95)
|
||||
-- PLOTNIKOV Eugeny at July 1998 (BUC60286)
|
||||
-- VKH at October 1999 (class PixMap added)
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
package WNT
|
||||
|
||||
---Purpose: This package contains common Windows NT graphics interface.
|
||||
|
||||
uses
|
||||
|
||||
Aspect,
|
||||
Image,
|
||||
PlotMgt,
|
||||
Quantity,
|
||||
TCollection,
|
||||
TColStd,
|
||||
TShort,
|
||||
MMgt,
|
||||
OSD,
|
||||
MFT
|
||||
|
||||
is
|
||||
|
||||
|
||||
-----------------------
|
||||
-- Category: Exceptions
|
||||
-----------------------
|
||||
|
||||
|
||||
exception ClassDefinitionError inherits ConstructionError;
|
||||
---Category: Exceptions
|
||||
|
||||
exception FontMapEntryDefinitionError inherits ConstructionError;
|
||||
---Category: Exceptions
|
||||
|
||||
|
||||
--------------------
|
||||
-- Category: Classes
|
||||
--------------------
|
||||
|
||||
|
||||
class GraphicDevice;
|
||||
---Purpose: Creates the graphic device associated with DISPLAY.
|
||||
---Category: Classes
|
||||
|
||||
class WDriver;
|
||||
---Purpose: Creates the window driver.
|
||||
---Category: Classes
|
||||
|
||||
class DDriver;
|
||||
---Purpose: Creates the device driver ( for printing/plotting )
|
||||
---Category: Classes
|
||||
|
||||
class Window;
|
||||
---Purpose: Creates the Window drawable.
|
||||
---Category: Classes
|
||||
|
||||
class PixMap;
|
||||
---Purpose: Creates a windows bitmap
|
||||
---Category: Classes
|
||||
|
||||
class WClass;
|
||||
---Purpose: Creates a Windows NT window class.
|
||||
---Category: Classes
|
||||
|
||||
class IconBox;
|
||||
---Purpose: Creates the Icon Box window.
|
||||
---Category: Classes
|
||||
|
||||
class FontMapEntry;
|
||||
---Purpose: Defines correspondence between FontMapEntry from
|
||||
-- Aspect and Windows NT font handle.
|
||||
---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
|
||||
|
||||
class TextManager;
|
||||
---Purpose: Defines the class for text drawing with MFT
|
||||
---Category: Classes
|
||||
|
||||
|
||||
---------------------------
|
||||
-- Category: Enumerations
|
||||
---------------------------
|
||||
|
||||
enumeration OrientationType is
|
||||
|
||||
OT_PORTRAIT,
|
||||
OT_LANDSCAPE
|
||||
|
||||
end OrientationType;
|
||||
---Purpose: Portrait/landscape orientation.
|
||||
enumeration TypeOfImage is
|
||||
|
||||
TOI_BMP, --Windows NT's device independent bitmap
|
||||
TOI_XWD, --X windows's image format
|
||||
TOI_GIF --CompuServe's Graphic Interchange Format
|
||||
|
||||
end TypeOfImage;
|
||||
|
||||
|
||||
---------------------------
|
||||
-- Category: Imported types
|
||||
---------------------------
|
||||
|
||||
|
||||
imported Long;
|
||||
---Purpose: Defines a Windows NT LONG type.
|
||||
---Category: Imported types
|
||||
|
||||
imported Dword;
|
||||
---Purpose: Defines a Windows NT DWORD type.
|
||||
---Category: Imported types
|
||||
|
||||
imported Uint;
|
||||
---Purpose: Defines a Windows NT UINT type.
|
||||
---Category: Imported types
|
||||
|
||||
imported LogFont;
|
||||
---Purpose: Defines a Windows NT LOGFONT type.
|
||||
---Category: Imported types
|
||||
|
||||
imported ColorRef;
|
||||
---Purpose: Defines a Windows NT COLORREF type.
|
||||
---Category: Imported types
|
||||
|
||||
imported WindowData;
|
||||
---Purpose: Defines additional window data type.
|
||||
---Category: Imported types
|
||||
|
||||
|
||||
---------------------------------
|
||||
-- Category: Pointers
|
||||
---------------------------------
|
||||
|
||||
pointer WindowPtr to Window from WNT;
|
||||
|
||||
---------------------------------
|
||||
-- Category: Instantiated classes
|
||||
---------------------------------
|
||||
|
||||
class ColorTable instantiates
|
||||
Array1 from TCollection ( ColorRef from WNT );
|
||||
|
||||
class HColorTable instantiates
|
||||
HArray1 from TCollection ( ColorRef from WNT, ColorTable from WNT );
|
||||
|
||||
class FontTable instantiates
|
||||
Array1 from TCollection ( FontMapEntry from WNT );
|
||||
|
||||
class HFontTable instantiates
|
||||
HArray1 from TCollection (
|
||||
FontMapEntry from WNT,
|
||||
FontTable from WNT
|
||||
);
|
||||
|
||||
class SequenceOfImage instantiates
|
||||
Sequence from TCollection ( Image from WNT );
|
||||
|
||||
---------------------------------
|
||||
-- Changes for MFT Text drawing
|
||||
---------------------------------
|
||||
class ListOfMFTFonts instantiates
|
||||
Array1 from TCollection (FontManager from MFT);
|
||||
|
||||
class HListOfMFTFonts instantiates
|
||||
HArray1 from TCollection (FontManager from MFT, ListOfMFTFonts);
|
||||
|
||||
end WNT;
|
12
src/WNT/WNT.edl
Executable file
12
src/WNT/WNT.edl
Executable file
@@ -0,0 +1,12 @@
|
||||
--
|
||||
-- File: WNT.edl
|
||||
-- Author: Jean GAUTIER
|
||||
-- History: Thu Oct 3 13:25:43 1996 Jean GAUTIER Creation
|
||||
-- Copyright: Matra Datavision 1996
|
||||
--
|
||||
|
||||
@ifnotdefined ( %WNT_EDL) then
|
||||
|
||||
@set %WNT_EDL = "";
|
||||
|
||||
@endif;
|
26
src/WNT/WNT.h
Executable file
26
src/WNT/WNT.h
Executable file
@@ -0,0 +1,26 @@
|
||||
#ifndef __WNT_H
|
||||
# define __WNT_H
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
# ifndef __WNT_API
|
||||
# if !defined(HAVE_NO_DLL)
|
||||
# ifdef __WNT_DLL
|
||||
# define __WNT_API __declspec( dllexport )
|
||||
# else
|
||||
# define __WNT_API __declspec( dllimport )
|
||||
# endif /* __WNT_DLL */
|
||||
# else
|
||||
# define __WNT_API
|
||||
# endif
|
||||
# endif /* __WNT_API */
|
||||
|
||||
__WNT_API int WNT_SysPalInUse ( void );
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* __WNT_H */
|
1276
src/WNT/WNT_Allocator.cxx
Executable file
1276
src/WNT/WNT_Allocator.cxx
Executable file
File diff suppressed because it is too large
Load Diff
85
src/WNT/WNT_Allocator.hxx
Executable file
85
src/WNT/WNT_Allocator.hxx
Executable file
@@ -0,0 +1,85 @@
|
||||
// File: WNT_Allocator.hxx
|
||||
// Created: March 1998
|
||||
// Author: PLOTNIKOV Eugeny & CHABROVSKY Dmitry
|
||||
// Copyright: Matra Datavision 1998
|
||||
|
||||
#ifndef __WNT_ALLOCATOR_HXX
|
||||
# define __WNT_ALLOCATOR_HXX
|
||||
|
||||
# include "EHDC.hxx"
|
||||
# include "W32_Allocator.hxx"
|
||||
|
||||
struct WNT_Allocator : public W32_Allocator {
|
||||
|
||||
WNT_Allocator ( int, PW32_Allocator = NULL );
|
||||
virtual ~WNT_Allocator ();
|
||||
|
||||
virtual void Xform ( void );
|
||||
|
||||
virtual void Play ( HDC, PSIZE );
|
||||
virtual void URect ( LPRECT );
|
||||
|
||||
virtual void Point ( int, int );
|
||||
virtual void MarkerPoint ( int, int );
|
||||
virtual void Line ( int, int, int, int );
|
||||
virtual void PolyEllipse ( int, int, int, int );
|
||||
virtual void Ellipse ( int, int, int, int );
|
||||
virtual void Arc ( int, int, int, int, double, double );
|
||||
virtual void PolyChord ( int, int, int, int, double, double );
|
||||
virtual void Chord ( int, int, int, int, double, double );
|
||||
virtual void PolySector ( int, int, int, int, double, double );
|
||||
virtual void Sector ( int, int, int, int, double, double );
|
||||
virtual void PolyMarker ( int );
|
||||
virtual void PolyMarker1 ( int, GetPointFunc, int, void* );
|
||||
virtual void PolyMarker2 ( int, GetPointFunc, int, void* );
|
||||
virtual W32_Note* Polygon ( int );
|
||||
virtual W32_Note* Polyline( int );
|
||||
virtual void Image ( int, int, PW32_Bitmap, double = 1.0 );
|
||||
virtual void Text ( int, int, double, void*, BOOL = FALSE, BOOL = FALSE );
|
||||
virtual void Polytext ( int, int, double, double, void*, BOOL = FALSE, BOOL = FALSE );
|
||||
virtual void BeginMarker ( int, int, int, int, double );
|
||||
virtual void EndMarker ( void );
|
||||
virtual void LineAttrib ( DWORD, PLOGBRUSH, DWORD = 0, PDWORD = NULL );
|
||||
virtual void PolyAttrib ( PLOGBRUSH, BOOL, int = ALTERNATE );
|
||||
virtual void TextAttrib (
|
||||
HFONT, COLORREF, double = 0.0, double = 1.0, double = 1.0,
|
||||
BOOL = FALSE, BOOL = FALSE, BOOL = FALSE
|
||||
);
|
||||
virtual void MarkerAttrib ( COLORREF, DWORD, BOOL );
|
||||
virtual void FunCall ( W32_FCall, int, PW32_FCALLPARAM );
|
||||
|
||||
virtual int TextSize ( HDC, char*, PSIZE );
|
||||
virtual int TextSize ( HDC, wchar_t*, PSIZE );
|
||||
|
||||
void GetExtent ( LPSIZE lpSZ );
|
||||
void TransformPoint ( int&, int& );
|
||||
void TransformPoint ( LPPOINT );
|
||||
void RecalcMatrix ( XFORM&, double = 0.0,
|
||||
double = 0.0, double = 0.0
|
||||
);
|
||||
void Register ( int, int );
|
||||
void Register ( LPPOINT, int );
|
||||
void Register ( LPRECT );
|
||||
|
||||
SIZE mySize; // HDC's extent
|
||||
HDC myHDC; // HDC to draw
|
||||
RECT myURect; // Update RECT
|
||||
XFORM myMatrix; // World transformation matrix
|
||||
|
||||
HPEN myLinePen; // Line attributes
|
||||
DWORD myLineWidth;
|
||||
HBRUSH myPolyBrush; // Poly attributes
|
||||
HPEN myTextPen; // Text attributes
|
||||
HBRUSH myTextBrush;
|
||||
COLORREF myTextColor;
|
||||
HPEN myMarkerPen; // Marker attributes
|
||||
|
||||
HPEN myPO; // Used to remember old
|
||||
HBRUSH myBO; // pen, brush and font
|
||||
HFONT myFO;
|
||||
|
||||
};
|
||||
|
||||
typedef WNT_Allocator* PWNT_Allocator;
|
||||
|
||||
#endif // __WNT_ALLOCATOR_HXX
|
28
src/WNT/WNT_Bitmap.h
Executable file
28
src/WNT/WNT_Bitmap.h
Executable file
@@ -0,0 +1,28 @@
|
||||
#ifndef __WNT_BITMAP_H
|
||||
# define __WNT_BITMAP_H
|
||||
|
||||
# ifndef __WINDOWS_H_INCLUDED
|
||||
# define __WINDOWS_H_INCLUDED
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif /* STRICT */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
# ifdef THIS
|
||||
# undef THIS
|
||||
# endif // THIS
|
||||
# endif // __WINDOWS_H_INCLUDED
|
||||
|
||||
typedef struct _wnt_bitmap {
|
||||
|
||||
int nUsed;
|
||||
HBITMAP hBmp;
|
||||
|
||||
} WNT_Bitmap, *PWNT_Bitmap;
|
||||
|
||||
#endif /* __WNT_SAFEBITMAP_H */
|
1
src/WNT/WNT_CMPLRS.edl
Executable file
1
src/WNT/WNT_CMPLRS.edl
Executable file
@@ -0,0 +1 @@
|
||||
@string %CMPLRS_CXX_Options = %CMPLRS_CXX_Options " -D_AFXDLL ";
|
13
src/WNT/WNT_ColorRef.cxx
Executable file
13
src/WNT/WNT_ColorRef.cxx
Executable file
@@ -0,0 +1,13 @@
|
||||
#ifndef __WNT_ColorRef_HeaderFile
|
||||
# include <WNT_ColorRef.hxx>
|
||||
#endif // __WNT_ColorRef_HeaderFile
|
||||
|
||||
const Handle( Standard_Type )& STANDARD_TYPE( WNT_ColorRef ) {
|
||||
|
||||
static Handle( Standard_Type ) _aType = new Standard_Type (
|
||||
"WNT_ColorRef", sizeof ( WNT_ColorRef )
|
||||
);
|
||||
|
||||
return _aType;
|
||||
|
||||
} // end function
|
30
src/WNT/WNT_ColorRef.hxx
Executable file
30
src/WNT/WNT_ColorRef.hxx
Executable file
@@ -0,0 +1,30 @@
|
||||
#ifndef __WNT_ColorRef_HeaderFile
|
||||
# define __WNT_ColorRef_HeaderFile
|
||||
|
||||
# ifndef __WINDOWS_H_INCLUDED
|
||||
# define __WINDOWS_H_INCLUDED
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif /* STRICT */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
# ifdef THIS
|
||||
# undef THIS
|
||||
# endif // THIS
|
||||
# endif // __WINDOWS_H_INCLUDED
|
||||
|
||||
# ifndef __STANDARD_TYPE_HXX_INCLUDED
|
||||
# define __STANDARD_TYPE_HXX_INCLUDED
|
||||
# include <Standard_Type.hxx>
|
||||
# endif // __STANDARD_TYPE_HXX_INCLUDED
|
||||
|
||||
typedef COLORREF WNT_ColorRef;
|
||||
|
||||
extern const Handle( Standard_Type )& STANDARD_TYPE( WNT_ColorRef );
|
||||
|
||||
#endif // __WNT_ColorRef_HeaderFile
|
564
src/WNT/WNT_DDriver.cdl
Executable file
564
src/WNT/WNT_DDriver.cdl
Executable file
@@ -0,0 +1,564 @@
|
||||
-- File: WNT_DDriver.cdl
|
||||
-- Created: Mon Mar 17 17:28:42 1997
|
||||
-- Author: EugenyPLOTNIKOV
|
||||
-- Modified: MAR-98, MAY-98 (DCB)
|
||||
-- OCT-98 (DCB) - see CXX file for details
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
class DDriver from WNT inherits PlotterDriver from PlotMgt
|
||||
|
||||
---Purpose: Defines the device-independent Windows NT driver.
|
||||
-- After graphics output enhanced metafile will be created.
|
||||
-- It is possible to play this file on device several times
|
||||
-- by Spool () method.
|
||||
|
||||
uses
|
||||
Handle from Aspect,
|
||||
HColorTable from WNT,
|
||||
HFontTable from WNT,
|
||||
HArray1OfInteger from TColStd,
|
||||
GraphicDevice from WNT,
|
||||
OrientationType from WNT,
|
||||
TypeOfText from Aspect,
|
||||
ColorMap from Aspect,
|
||||
TypeMap from Aspect,
|
||||
WidthMap from Aspect,
|
||||
FontMap from Aspect,
|
||||
MarkMap from Aspect,
|
||||
PlotMode from Aspect,
|
||||
PlaneAngle from Quantity,
|
||||
Factor from Quantity,
|
||||
Ratio from Quantity,
|
||||
Length from Quantity,
|
||||
Array1OfShortReal from TShort,
|
||||
ExtendedString from TCollection,
|
||||
AsciiString from TCollection,
|
||||
HAsciiString from TCollection,
|
||||
HSequenceOfAsciiString from TColStd,
|
||||
FontManager from MFT,
|
||||
HListOfMFTFonts from WNT,
|
||||
HArray1OfShortReal from TShort,
|
||||
TextManager from WNT
|
||||
|
||||
raises
|
||||
|
||||
DriverDefinitionError from Aspect,
|
||||
DriverError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aDeviceName : CString from Standard;
|
||||
aFileName : CString from Standard;
|
||||
anOrientation : OrientationType from WNT = WNT_OT_LANDSCAPE;
|
||||
aScale : Factor from Quantity = 1.0;
|
||||
aCopies : Integer from Standard = 1
|
||||
) returns mutable DDriver from WNT
|
||||
raises DriverDefinitionError from Aspect;
|
||||
---Purpose: Constructs a device driver framework defined by the
|
||||
-- string aDeviceName, the path specified as an
|
||||
-- argument for OSD_Path, the type of orientation
|
||||
-- anOrientation, the scale aScale, the number of copies
|
||||
-- aCopies and the flag aPrintFlag.
|
||||
|
||||
Create (
|
||||
aFileName : CString from Standard;
|
||||
aCopies : Integer from Standard = 1
|
||||
) returns mutable DDriver from WNT;
|
||||
---Purpose:
|
||||
-- Creates the class object. An empty path is authorized
|
||||
-- and in this case, a temporary enhanced metafile is
|
||||
-- created. You can delete this file by using the EndDraw function.
|
||||
-- Warning - OSD_Path corresponds to an ASCII string.
|
||||
-- Exceptions
|
||||
-- Aspect_DriverDefinitionError if the driver could not be defined.
|
||||
|
||||
Close(me: mutable)
|
||||
is redefined;
|
||||
---C++: alias ~
|
||||
|
||||
BeginDraw ( me : mutable )
|
||||
is redefined;
|
||||
---Purpose: Begins a new picture of graphics in the enhanced metafile
|
||||
|
||||
EndDraw ( me : mutable; fSynchronize: Boolean = Standard_False )
|
||||
is redefined;
|
||||
---Purpose: Flushes all graphics, closes enhanced metafile.
|
||||
|
||||
Spool (me : mutable;
|
||||
aPlotMode : PlotMode from Aspect = Aspect_PM_FILEONLY;
|
||||
aDeviceName : CString from Standard = NULL;
|
||||
anOriginalSize : Boolean from Standard = Standard_False
|
||||
) returns Boolean from Standard
|
||||
raises DriverError from Aspect is redefined;
|
||||
---Purpose: Spools the driver onto a printer spool.
|
||||
-- Stretches the picture so that it fits into the device
|
||||
-- workspace if the Boolean anOriginalSize is False
|
||||
-- and the workspace dimensions of the original
|
||||
-- device differ from those of the current device. This
|
||||
-- flag is ignored if aDeviceName is NULL.
|
||||
-- Warning
|
||||
-- If aDeviceName is NULL, then the driver should be
|
||||
-- created with the first constructor. Otherwise, use
|
||||
-- the second constructor to create a class object.
|
||||
-- Exceptions
|
||||
-- Aspect_DriverError if the driver is not correctly defined.
|
||||
|
||||
---------------------------------------------
|
||||
-- Category: Methods to define the attributes
|
||||
---------------------------------------------
|
||||
|
||||
SetLineAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
TypeIndex : Integer from Standard;
|
||||
WidthIndex : Integer from Standard
|
||||
) raises DriverError from Aspect is redefined;
|
||||
---Purpose: Defines the Current Line Attibutes
|
||||
|
||||
SetTextAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
FontIndex : Integer from Standard
|
||||
) raises DriverError from Aspect is redefined;
|
||||
---Purpose: Defines the Current Text Attributes
|
||||
|
||||
SetTextAttrib (
|
||||
me: mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
FontIndex : Integer from Standard;
|
||||
aSlant : PlaneAngle from Quantity;
|
||||
aHScale : Factor from Quantity;
|
||||
aWScale : Factor from Quantity;
|
||||
isUnderlined : Boolean from Standard = Standard_False
|
||||
) raises DriverError from Aspect is redefined;
|
||||
---Purpose: Defines the Current Extended Text Attributes
|
||||
|
||||
SetPolyAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
TileIndex : Integer from Standard;
|
||||
DrawEdge : Boolean from Standard = Standard_False
|
||||
) raises DriverError from Aspect is redefined;
|
||||
---Purpose: Sets the poly attributes
|
||||
|
||||
SetMarkerAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
WidthIndex : Integer from Standard;
|
||||
FillMarker : Boolean from Standard = Standard_False
|
||||
) raises DriverError from Aspect is redefined;
|
||||
---Purpose: Defines the Current Marker Attributes
|
||||
|
||||
|
||||
---------------------------
|
||||
-- Category: Images methods
|
||||
---------------------------
|
||||
|
||||
IsKnownImage (
|
||||
me : mutable;
|
||||
anImage : Transient from Standard
|
||||
) returns Boolean from Standard is redefined;
|
||||
|
||||
SizeOfImageFile (
|
||||
me;
|
||||
anImageFile : CString from Standard;
|
||||
aWidth, aHeight : out Integer from Standard
|
||||
) returns Boolean from Standard is redefined;
|
||||
|
||||
ClearImage (
|
||||
me : mutable;
|
||||
anImageId : Transient from Standard
|
||||
) raises DriverError from Aspect is redefined;
|
||||
|
||||
ClearImageFile (
|
||||
me : mutable;
|
||||
anImageFile : CString from Standard
|
||||
) raises DriverError from Aspect is redefined;
|
||||
|
||||
DrawImage (
|
||||
me : mutable;
|
||||
anImageId : Transient from Standard;
|
||||
aX, aY : ShortReal from Standard
|
||||
) raises DriverError from Aspect is redefined;
|
||||
|
||||
|
||||
---------------------------------------
|
||||
-- Category: Methods to draw primitives
|
||||
---------------------------------------
|
||||
DrawImageFile (
|
||||
me : mutable;
|
||||
anImageFile : CString from Standard;
|
||||
aX, aY : ShortReal from Standard;
|
||||
aScale : Factor from Quantity = 1.0
|
||||
) raises DriverError from Aspect is redefined;
|
||||
|
||||
FillAndDrawImage (
|
||||
me : mutable;
|
||||
anImageId : Transient from Standard;
|
||||
aX, aY : ShortReal from Standard;
|
||||
aWidth, aHeight : Integer from Standard;
|
||||
anArrayOfPixels : Address from Standard
|
||||
) raises DriverError from Aspect is redefined;
|
||||
---Purpose: Fills a complete Image .
|
||||
|
||||
FillAndDrawImage (
|
||||
me : mutable;
|
||||
anImageId : Transient from Standard;
|
||||
aX, aY : ShortReal from Standard;
|
||||
anIndexOfLine, aWidth, aHeight : Integer from Standard;
|
||||
anArrayOfPixels : Address from Standard
|
||||
) raises DriverError from Aspect is redefined;
|
||||
---Purpose: Fills a line of the Image .
|
||||
-- Warning: 0 <= anIndexOfLine < aHeight
|
||||
-- anIndexOfLine = 0 must be the first call
|
||||
|
||||
PlotPolyline (me : mutable;
|
||||
xArray : Address from Standard;
|
||||
yArray : Address from Standard;
|
||||
nPts : Address from Standard;
|
||||
nParts : Integer from Standard
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws a polyline depending of the SetLineAttrib() attributes.
|
||||
|
||||
PlotPolygon (me : mutable;
|
||||
xArray : Address from Standard;
|
||||
yArray : Address from Standard;
|
||||
nPts : Address from Standard;
|
||||
nParts : Integer from Standard
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws a polygon depending of the SetPolyAttrib() attributes.
|
||||
|
||||
PlotSegment (
|
||||
me : mutable;
|
||||
X1, Y1 : ShortReal from Standard;
|
||||
X2, Y2 : ShortReal from Standard
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws a segment depending of the SetLineAttrib() attributes.
|
||||
|
||||
PlotText (
|
||||
me : mutable;
|
||||
aText : ExtendedString from TCollection;
|
||||
Xpos : ShortReal from Standard;
|
||||
Ypos : ShortReal from Standard;
|
||||
anAngle : ShortReal from Standard = 0.0;
|
||||
aType : TypeOfText from Aspect = Aspect_TOT_SOLID
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws a text depending of the SetTextAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
|
||||
PlotText (
|
||||
me : mutable;
|
||||
aText : CString from Standard;
|
||||
Xpos : ShortReal from Standard;
|
||||
Ypos : ShortReal from Standard;
|
||||
anAngle : ShortReal from Standard = 0.0;
|
||||
aType : TypeOfText from Aspect = Aspect_TOT_SOLID
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws a text depending of the SetTextAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
|
||||
PlotPolyText (
|
||||
me : mutable;
|
||||
aText : ExtendedString from TCollection;
|
||||
Xpos : ShortReal from Standard;
|
||||
Ypos : ShortReal from Standard;
|
||||
aMarge : Ratio from Quantity = 0.1;
|
||||
anAngle : ShortReal from Standard = 0.0;
|
||||
aType : TypeOfText from Aspect = Aspect_TOT_SOLID
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws an framed text depending of the
|
||||
-- SetTextAttrib() and SetPolyAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- <aMarge> defines the ratio of the space between the
|
||||
-- polygon borders and the bounding box of the text and
|
||||
-- depending of the height of the text.
|
||||
|
||||
PlotPolyText (
|
||||
me : mutable;
|
||||
aText : CString from Standard;
|
||||
Xpos : ShortReal from Standard;
|
||||
Ypos : ShortReal from Standard;
|
||||
aMarge : Ratio from Quantity = 0.1;
|
||||
anAngle : ShortReal from Standard = 0.0;
|
||||
aType : TypeOfText from Aspect = Aspect_TOT_SOLID
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws an framed text depending of the
|
||||
-- SetTextAttrib() and SetPolyAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- <aMarge> defines the ratio of the space between the
|
||||
-- polygon borders and the bounding box of the text and
|
||||
-- depending of the height of the text.
|
||||
|
||||
PlotPoint ( me : mutable; X, Y : ShortReal from Standard )
|
||||
returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws a 1 PIXEL point depending of the SetMarkerAttrib()
|
||||
-- color attribute or add a point depending of the incremental BeginXxxxxx()
|
||||
-- primitive used.
|
||||
|
||||
PlotMarker (
|
||||
me : mutable;
|
||||
aMarker : Integer from Standard;
|
||||
Xpos : ShortReal from Standard;
|
||||
Ypos : ShortReal from Standard;
|
||||
Width : ShortReal from Standard;
|
||||
Height : ShortReal from Standard;
|
||||
Angle : ShortReal from Standard = 0.0
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws the prevously defined marker <aMarker>
|
||||
-- depending of the SetMarkerAttrib() attributes.
|
||||
-- Warning: Coordinates and sizes must be defined in DWU space.
|
||||
-- Angle must be defined in RADIAN.
|
||||
-- A one pixel marker is drawn when aMarker index is undefined
|
||||
|
||||
PlotArc (
|
||||
me : mutable;
|
||||
X, Y : ShortReal from Standard;
|
||||
anXradius, anYradius : ShortReal from Standard;
|
||||
aStartAngle : ShortReal from Standard = 0.0;
|
||||
anOpenAngle : ShortReal from Standard = 6.283185
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws an Ellipsoid arc of center <X,Y> and Radius
|
||||
-- <anXradius,anYradius> of relative angle <anOpenAngle> from
|
||||
-- the base angle <aStartAngle> and depending of the SetLineAttrib() attributes
|
||||
|
||||
PlotPolyArc (
|
||||
me : mutable;
|
||||
X, Y : ShortReal from Standard;
|
||||
anXradius, anYradius : ShortReal from Standard;
|
||||
aStartAngle : ShortReal from Standard = 0.0;
|
||||
anOpenAngle : ShortReal from Standard = 6.283185
|
||||
) returns Boolean from Standard
|
||||
is redefined protected;
|
||||
---Purpose: Draws an filled Ellipsoid arc of center <X,Y> and Radius
|
||||
-- <anXradius,anYradius> of relative angle <anOpenAngle> from
|
||||
-- the base angle <aStartAngle> and depending of the SetPolyAttrib() attributes.
|
||||
|
||||
BeginPolyline ( me : mutable; aNumber : Integer ) is static;
|
||||
---Purpose: Begin an incremental polyline primitive of <aNumber> of points
|
||||
-- Warning: Points must be added by the the DrawPoint() method.
|
||||
|
||||
BeginPolygon ( me : mutable; aNumber : Integer )
|
||||
is redefined;
|
||||
---Purpose: Begin an incremental polygon primitive of <aNumber> of points
|
||||
-- Warning: Points must be added by the the DrawPoint() method.
|
||||
|
||||
BeginSegments ( me : mutable )
|
||||
is redefined;
|
||||
---Purpose: Begin a set of segments .
|
||||
-- Warning: Segments must be added by the DrawSegment() method
|
||||
|
||||
BeginArcs ( me : mutable )
|
||||
is redefined;
|
||||
---Purpose: Begin a set of circles or ellips .
|
||||
-- Warning: Arcs must be added by the DrawArc() methods
|
||||
|
||||
BeginPolyArcs ( me : mutable )
|
||||
is redefined;
|
||||
---Purpose: Begin a set of polygon circles or ellips
|
||||
-- Warning: Arcs must be added by the DrawPolyArc() methods
|
||||
|
||||
BeginMarkers ( me : mutable )
|
||||
is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of markers .
|
||||
-- Warning: Markers must be added by the DrawMarker() method
|
||||
|
||||
BeginPoints ( me : mutable )
|
||||
is redefined;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of points .
|
||||
-- Warning: Points must be added by the DrawPoint() method
|
||||
|
||||
ClosePrimitive ( me : mutable ) raises DriverError from Aspect is static;
|
||||
---Purpose: Close the last Begining primitive
|
||||
|
||||
---------------------------------------------
|
||||
-- Category: Methods to define the attributes
|
||||
---------------------------------------------
|
||||
InitializeColorMap(me: mutable; aColorMap: ColorMap from Aspect)
|
||||
raises DriverError from Aspect is redefined protected;
|
||||
---Category: Methods to define the ColorIndexs
|
||||
|
||||
InitializeTypeMap(me: mutable; aTypeMap: TypeMap from Aspect)
|
||||
raises DriverError from Aspect is redefined protected;
|
||||
---Category: Methods to define the TypeIndexs
|
||||
|
||||
InitializeWidthMap(me: mutable; aWidthMap: WidthMap from Aspect)
|
||||
raises DriverError from Aspect is redefined protected;
|
||||
---Category: Methods to define the WidthIndexs
|
||||
|
||||
InitializeFontMap(me: mutable; aFontMap: FontMap from Aspect)
|
||||
raises DriverError from Aspect is redefined protected;
|
||||
---Category: Methods to define the FontIndexs
|
||||
|
||||
InitializeMarkMap(me: mutable; aFontMap: MarkMap from Aspect)
|
||||
raises DriverError from Aspect is redefined protected;
|
||||
---Category: Methods to define the MarkIndexs
|
||||
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
|
||||
WorkSpace ( me ; Width,Heigth : out Length from Quantity ) is static;
|
||||
---Purpose: Returns the Available WorkSpace in DWU coordinates
|
||||
|
||||
Convert ( me ; PV : Integer from Standard ) returns Length from Quantity is static;
|
||||
---Purpose: Returns the DWU value depending of
|
||||
-- the PIXEL value.
|
||||
|
||||
Convert ( me ; DV : Length from Quantity ) returns Integer from Standard is static;
|
||||
---Purpose: Returns the PIXEL value depending of the DWU value.
|
||||
|
||||
Convert (
|
||||
me;
|
||||
PX, PY : Integer from Standard;
|
||||
DX, DY : out Length from Quantity
|
||||
) is static;
|
||||
---Purpose: Returns the DWU position depending of the PIXEL position .
|
||||
|
||||
Convert (
|
||||
me;
|
||||
DX, DY : Length from Quantity;
|
||||
PX, PY : out Integer from Standard
|
||||
) is static;
|
||||
---Purpose: Returns the PIXEL position depending of the DWU position
|
||||
|
||||
TextSize (
|
||||
me;
|
||||
aText : ExtendedString from TCollection;
|
||||
aWidth, aHeight : out ShortReal from Standard;
|
||||
aFontIndex : Integer from Standard = -1
|
||||
) is static;
|
||||
---Purpose: Returns the TEXT size in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
|
||||
TextSize (
|
||||
me;
|
||||
aText : ExtendedString from TCollection;
|
||||
aWidth, aHeight, anXoffset, anYoffset : out ShortReal from Standard;
|
||||
aFontIndex: Integer from Standard = -1
|
||||
) is static;
|
||||
---Purpose: Returns the TEXT size and offsets
|
||||
-- in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
|
||||
TextSize (
|
||||
me;
|
||||
aText : CString from Standard;
|
||||
aWidth, aHeight, anXoffset, anYoffset : out ShortReal from Standard;
|
||||
aFontIndex : Integer from Standard = -1
|
||||
) is static;
|
||||
---Purpose: Returns the TEXT size in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
|
||||
HDC ( me ) returns Handle from Aspect is static;
|
||||
---Purpose: Returns device context handle
|
||||
|
||||
ClientRect ( me; aWidth, aHeigth : out Integer from Standard ) is static;
|
||||
---Purpose: Returns dimensions of the device
|
||||
|
||||
GraphicDevice ( me ) returns GraphicDevice from WNT is static;
|
||||
---Purpose: Returns graphic device
|
||||
|
||||
DeviceList ( myclass )
|
||||
returns HSequenceOfAsciiString from TColStd
|
||||
raises DriverError from Aspect;
|
||||
---Purpose: Returns list of available graphic devices.
|
||||
-- First element is default device
|
||||
|
||||
DeviceSize (myclass;
|
||||
aDevice : AsciiString from TCollection;
|
||||
aWidth, aHeight: out Real from Standard);
|
||||
---Purpose: Returns size of a specified device.
|
||||
|
||||
EMFDim (
|
||||
me : mutable;
|
||||
aWidth : out Integer from Standard;
|
||||
aHeight : out Integer from Standard;
|
||||
aSwap : out Integer from Standard
|
||||
) returns Real from Standard;
|
||||
---Purpose: returns dimensions, in .01 millimeter units,
|
||||
-- of a rectangle that surrounds the picture stored
|
||||
-- in the metafile ( parameters <aWidth> & <aHeight> ).
|
||||
-- <aSwap> value idicates whether rotate operation
|
||||
-- (portrait/landscape) was performed or not. Valid
|
||||
-- values are: <0> - no rotation
|
||||
-- <1> - do rotation
|
||||
-- <2> - could not determine
|
||||
-- Returns ratio between <aWidth> & <aHeight>.
|
||||
-- Warning: returns <-1> in case of error
|
||||
|
||||
ProcessColorIndex ( me; ColorIndex : Integer from Standard )
|
||||
returns Integer from Standard is private;
|
||||
|
||||
ProcessWidthIndex ( me; WidthIndex : Integer from Standard )
|
||||
returns Length from Quantity is private;
|
||||
|
||||
ProcessTypeIndex ( me; TypeIndex : Integer from Standard )
|
||||
returns Integer from Standard is private;
|
||||
|
||||
DoSpool ( me;
|
||||
anOriginalSize : Boolean from Standard;
|
||||
aPlotMode : PlotMode from Aspect = Aspect_PM_NPLOTTER
|
||||
) returns Boolean from Standard is private;
|
||||
---Purpose: Internal methods
|
||||
|
||||
TextManager (me: mutable)
|
||||
returns TextManager from WNT;
|
||||
---C++: return const &
|
||||
---Category: Inquire methods
|
||||
|
||||
MFT_Font (me: mutable; anIndex: Integer)
|
||||
returns FontManager from MFT;
|
||||
---C++: return const &
|
||||
---Category: Inquire methods
|
||||
|
||||
MFT_Size (me: mutable; anIndex: Integer)
|
||||
returns ShortReal;
|
||||
---Category: Inquire methods
|
||||
|
||||
fields
|
||||
myRect : Address from Standard;
|
||||
myPrnName : AsciiString from TCollection; -- Name of .PRN file
|
||||
myEmfName : AsciiString from TCollection; -- Name of .EMF file
|
||||
myAllocators,
|
||||
myAllocator : Address from Standard;
|
||||
myPixelToUnit : Real from Standard;
|
||||
myImageName : HAsciiString from TCollection;
|
||||
myDevice : GraphicDevice from WNT;
|
||||
myHDC : Handle from Aspect;
|
||||
myHDCMeta : Handle from Aspect;
|
||||
myHMetaFile : Handle from Aspect;
|
||||
myImage : Handle from Aspect;
|
||||
myOrientation : OrientationType from WNT;
|
||||
myScale : Factor from Quantity;
|
||||
myFlags : Integer from Standard;
|
||||
myNCopies : Integer from Standard;
|
||||
|
||||
myColors : HColorTable from WNT;
|
||||
myFonts : HFontTable from WNT;
|
||||
myTypeIdxs : HArray1OfInteger from TColStd;
|
||||
myWidthIdxs : HArray1OfInteger from TColStd;
|
||||
myMarkerIdxs : HArray1OfInteger from TColStd;
|
||||
|
||||
myMFTFonts : HListOfMFTFonts from WNT;
|
||||
myMFTSizes : HArray1OfShortReal from TShort;
|
||||
myNTextManager : TextManager from WNT;
|
||||
|
||||
end DDriver from WNT;
|
2074
src/WNT/WNT_DDriver.cxx
Executable file
2074
src/WNT/WNT_DDriver.cxx
Executable file
File diff suppressed because it is too large
Load Diff
13
src/WNT/WNT_Dword.cxx
Executable file
13
src/WNT/WNT_Dword.cxx
Executable file
@@ -0,0 +1,13 @@
|
||||
#ifndef __WNT_Dword_HeaderFile
|
||||
# include <WNT_Dword.hxx>
|
||||
#endif // __WNT_Dword_HeaderFile
|
||||
|
||||
const Handle( Standard_Type )& STANDARD_TYPE( WNT_Dword ) {
|
||||
|
||||
static Handle( Standard_Type ) _aType = new Standard_Type (
|
||||
"WNT_Dword", sizeof ( WNT_Dword )
|
||||
);
|
||||
|
||||
return _aType;
|
||||
|
||||
} // end function
|
30
src/WNT/WNT_Dword.hxx
Executable file
30
src/WNT/WNT_Dword.hxx
Executable file
@@ -0,0 +1,30 @@
|
||||
#ifndef __WNT_Dword_HeaderFile
|
||||
# define __WNT_Dword_HeaderFile
|
||||
|
||||
# ifndef __WINDOWS_H_INCLUDED
|
||||
# define __WINDOWS_H_INCLUDED
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif /* STRICT */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
# ifdef THIS
|
||||
# undef THIS
|
||||
# endif // THIS
|
||||
# endif // __WINDOWS_H_INCLUDED
|
||||
|
||||
# ifndef __STANDARD_TYPE_HXX_INCLUDED
|
||||
# define __STANDARD_TYPE_HXX_INCLUDED
|
||||
# include <Standard_Type.hxx>
|
||||
# endif // __STANDARD_TYPE_HXX_INCLUDED
|
||||
|
||||
typedef DWORD WNT_Dword;
|
||||
|
||||
extern const Handle( Standard_Type )& STANDARD_TYPE( WNT_Dword );
|
||||
|
||||
#endif // __WNT_Dword_HeaderFile
|
128
src/WNT/WNT_FontMapEntry.cdl
Executable file
128
src/WNT/WNT_FontMapEntry.cdl
Executable file
@@ -0,0 +1,128 @@
|
||||
-- File: WNT_FontMapEntry.cdl
|
||||
-- Created: Mon Jan 29 13:07:57 1996
|
||||
-- Author: PLOTNIKOV Eugeny
|
||||
-- <eugeny@proton>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class FontMapEntry from WNT inherits TShared from MMgt
|
||||
|
||||
---Purpose: Defines correspondence between FontMapEntry from
|
||||
-- Aspect and Windows NT font handle. Also, provides
|
||||
-- some optimizations due to rotation, italics & underlining
|
||||
-- of fonts. Each font can be reffered by its name which
|
||||
-- is a character string. The format of the string takes
|
||||
-- after format of font name of X window system but there
|
||||
-- are some differences. The font name string format is:
|
||||
-- "h-w-e-o-wgt-i-u-so-cs-op-cp-q-pf-face".
|
||||
-- ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
|
||||
-- | | | | | | | | | | | | | |
|
||||
-- | | | | | | | | | | | | | +- name of the typeface
|
||||
-- | | | | | | | | | | | | | (Courier, Arial ...)
|
||||
-- | | | | | | | | | | | | +- pitch and family
|
||||
-- | | | | | | | | | | | +- quality
|
||||
-- | | | | | | | | | | +- clip precision
|
||||
-- | | | | | | | | | +- out precision
|
||||
-- | | | | | | | | +- character set
|
||||
-- | | | | | | | +- strike out
|
||||
-- | | | | | | +- underline
|
||||
-- | | | | | +- italic
|
||||
-- | | | | +- weight
|
||||
-- | | | +- orientation
|
||||
-- | | +- escapement
|
||||
-- | +- width
|
||||
-- +- height
|
||||
-- Wildcarding is allowed by specifying '*' sign. This means
|
||||
-- a default value for parameter.
|
||||
-- Example: "13-8-*-*-400-*-*-*-255-1-2-*-25-courier".
|
||||
-- For more detail information see Microsoft Windows manual.
|
||||
-- Warning: Windows can output rotated text only if the selected for
|
||||
-- drawing font is True Type.
|
||||
uses
|
||||
|
||||
Handle from Aspect,
|
||||
LogFont from WNT,
|
||||
Dword from WNT,
|
||||
Factor from Quantity,
|
||||
PlaneAngle from Quantity
|
||||
|
||||
raises
|
||||
|
||||
FontMapEntryDefinitionError from WNT
|
||||
|
||||
is
|
||||
|
||||
Create ( aFontName : CString from Standard )
|
||||
returns mutable FontMapEntry from WNT
|
||||
---Purpose: Creates a class and loads font.
|
||||
-- Warning: Windows finds the real font that most closely matches
|
||||
-- the request. In doing so, it uses a
|
||||
-- "font-mapping-algorythm". So it is possible that loaded
|
||||
-- font differs from font in the request.
|
||||
-- Trigger: Raises if font loading failed.
|
||||
raises FontMapEntryDefinitionError from WNT;
|
||||
|
||||
Destroy ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Destroys all ressources attached to the FontMapEntry
|
||||
---C++: alias ~
|
||||
|
||||
HFont ( me ) returns Handle from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns handle of the font.
|
||||
|
||||
SetAttrib (
|
||||
me : mutable;
|
||||
aFlags : Dword from WNT;
|
||||
aData : Address from Standard;
|
||||
aRepl : Boolean from Standard = Standard_False
|
||||
) returns Handle from Aspect is static;
|
||||
---Level: Internal
|
||||
---Purpose: Sets certain attributes ( italics etc. ) for font.
|
||||
-- Warning: If <aRepl> is True then creates a new handle for font.
|
||||
-- In this case calling routine MUST DELETE THE FONT ITSELF
|
||||
-- WHEN THE FONT BECOME NO LONGER NEEDED.
|
||||
|
||||
SetSlant ( me : mutable; aSlant : PlaneAngle from Quantity )
|
||||
returns PlaneAngle from Quantity is static;
|
||||
---Level: Internal
|
||||
---Purpose: Sets the font's slant and returns a previous one.
|
||||
---C++: inline
|
||||
|
||||
SetScale ( me : mutable; aScale : Factor from Quantity )
|
||||
returns Factor from Quantity is static;
|
||||
---Level: Internal
|
||||
---Purpose: Sets the font's scale and returns a previous one.
|
||||
---C++: inline
|
||||
|
||||
Slant ( me )
|
||||
returns PlaneAngle from Quantity is static;
|
||||
---Level: Internal
|
||||
---Purpose: Returns value of the font's slant.
|
||||
---C++: inline
|
||||
|
||||
Scale ( me )
|
||||
returns Factor from Quantity is static;
|
||||
---Level: Internal
|
||||
---Purpose: Returns value of the font's scale.
|
||||
---C++: inline
|
||||
|
||||
LogFont ( me )
|
||||
returns Address from Standard is static;
|
||||
---Level: Internal
|
||||
---Purpose: Returns pointer to LogFont structure.
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
|
||||
myLogFont : LogFont from WNT is protected;
|
||||
myHandle : Handle from Aspect is protected;
|
||||
myScale : Factor from Quantity is protected;
|
||||
mySlant : PlaneAngle from Quantity is protected;
|
||||
|
||||
friends
|
||||
|
||||
class WDriver from WNT,
|
||||
class DDriver from WNT
|
||||
|
||||
end FontMapEntry;
|
164
src/WNT/WNT_FontMapEntry.cxx
Executable file
164
src/WNT/WNT_FontMapEntry.cxx
Executable file
@@ -0,0 +1,164 @@
|
||||
#include <WNT_FontMapEntry.ixx>
|
||||
|
||||
#include <InterfaceGraphic_WNT.hxx>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// character for field separator
|
||||
#define FS "-"
|
||||
// character for default value
|
||||
#define DV "*"
|
||||
|
||||
WNT_FontMapEntry :: WNT_FontMapEntry ( const Standard_CString aFontName )
|
||||
{
|
||||
int i;
|
||||
char* p;
|
||||
BOOL fUseDefault = FALSE;
|
||||
|
||||
char* fName = new char[ strlen ( aFontName ) + 1 ];
|
||||
|
||||
strcpy ( fName, aFontName );
|
||||
ZeroMemory ( &myLogFont, sizeof ( WNT_LogFont ) );
|
||||
|
||||
myLogFont.lfCharSet = DEFAULT_CHARSET;
|
||||
myLogFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
myLogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
myLogFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
|
||||
myLogFont.lfQuality = PROOF_QUALITY;
|
||||
|
||||
p = strtok ( fName, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfHeight = atol ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfWidth = atol ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfEscapement = atol ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfOrientation = atol ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfWeight = atol ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfItalic = ( BYTE )atoi ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfUnderline = ( BYTE )atoi ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfStrikeOut = ( BYTE )atoi ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfCharSet = ( BYTE )atoi ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfOutPrecision = ( BYTE )atoi ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfClipPrecision = ( BYTE )atoi ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfQuality = ( BYTE )atoi ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) )
|
||||
myLogFont.lfPitchAndFamily = ( BYTE )atoi ( p );
|
||||
|
||||
p = strtok ( NULL, FS );
|
||||
if ( p && strcmp ( p, DV ) ) {
|
||||
i = strlen ( p );
|
||||
strncpy ( myLogFont.lfFaceName, p, ( i < LF_FACESIZE ) ? i : LF_FACESIZE );
|
||||
} // end if
|
||||
|
||||
myLogFont.lfOutPrecision |= OUT_TT_ONLY_PRECIS;
|
||||
myHandle = CreateFontIndirect ( &myLogFont );
|
||||
delete [] fName;
|
||||
if ( !myHandle )
|
||||
WNT_FontMapEntryDefinitionError :: Raise ( "Unable to load font" );
|
||||
} // end constructor
|
||||
|
||||
void WNT_FontMapEntry :: Destroy () {
|
||||
|
||||
DeleteObject ( myHandle );
|
||||
|
||||
} // end WNT_FontMapEntry :: Destroy
|
||||
|
||||
Aspect_Handle WNT_FontMapEntry :: HFont () const {
|
||||
|
||||
return myHandle;
|
||||
|
||||
} // WNT_FontMapEntry :: HFont
|
||||
|
||||
Aspect_Handle WNT_FontMapEntry :: SetAttrib (
|
||||
const WNT_Dword& aFlags,
|
||||
const Standard_Address aData,
|
||||
const Standard_Boolean aRepl
|
||||
) {
|
||||
|
||||
HFONT hFont;
|
||||
LOGFONT lf = myLogFont;
|
||||
FONT_DATA* fd = ( FONT_DATA* )aData;
|
||||
|
||||
if ( aFlags & faUnderlined )
|
||||
|
||||
lf.lfUnderline = fd -> fdUnderlined;
|
||||
|
||||
if ( aFlags & faItalic )
|
||||
|
||||
lf.lfItalic = fd -> fdItalic;
|
||||
|
||||
if ( aFlags & faStrikeOut )
|
||||
|
||||
lf.lfStrikeOut = fd -> fdStrikeOut;
|
||||
|
||||
if ( aFlags & faBold )
|
||||
|
||||
lf.lfWeight = fd -> fdBold;
|
||||
|
||||
if ( aFlags & faHeight )
|
||||
|
||||
lf.lfHeight = fd -> fdHeight;
|
||||
|
||||
if ( aFlags & faAngle ) {
|
||||
|
||||
lf.lfEscapement = fd -> fdOrientation;
|
||||
lf.lfOrientation = fd -> fdOrientation;
|
||||
|
||||
} // end if
|
||||
|
||||
if ( aFlags & faWidth )
|
||||
|
||||
lf.lfWidth = fd -> fdWidth;
|
||||
|
||||
if ( aFlags & faSlant )
|
||||
|
||||
lf.lfOrientation -= ( fd -> fdSlant * 10 );
|
||||
|
||||
hFont = CreateFontIndirect ( &lf );
|
||||
|
||||
if ( hFont != NULL && aRepl ) {
|
||||
|
||||
DeleteObject ( myHandle );
|
||||
myHandle = hFont;
|
||||
myLogFont = lf;
|
||||
|
||||
} // end if
|
||||
|
||||
return hFont;
|
||||
|
||||
} // WNT_FontMapEntry :: SetAttrib
|
40
src/WNT/WNT_FontMapEntry.lxx
Executable file
40
src/WNT/WNT_FontMapEntry.lxx
Executable file
@@ -0,0 +1,40 @@
|
||||
inline Quantity_PlaneAngle WNT_FontMapEntry :: SetSlant (
|
||||
const Quantity_PlaneAngle aSlant
|
||||
) {
|
||||
Quantity_PlaneAngle tmp = mySlant;
|
||||
|
||||
mySlant = aSlant;
|
||||
|
||||
return tmp;
|
||||
|
||||
} // end WNT_FontMapEntry :: SetSlant
|
||||
|
||||
inline Quantity_Factor WNT_FontMapEntry :: SetScale (
|
||||
const Quantity_Factor aScale
|
||||
) {
|
||||
|
||||
Quantity_Factor tmp = myScale;
|
||||
|
||||
myScale = aScale;
|
||||
|
||||
return tmp;
|
||||
|
||||
} // end WNT_FontMapEntry :: SetScale
|
||||
|
||||
inline Quantity_PlaneAngle WNT_FontMapEntry :: Slant () const {
|
||||
|
||||
return mySlant;
|
||||
|
||||
} // end WNT_FontMapEntry :: Slant
|
||||
|
||||
inline Quantity_Factor WNT_FontMapEntry :: Scale () const {
|
||||
|
||||
return myScale;
|
||||
|
||||
} // end WNT_FontMapEntry :: Scale
|
||||
|
||||
inline Standard_Address WNT_FontMapEntry :: LogFont () const {
|
||||
|
||||
return ( void* )&myLogFont;
|
||||
|
||||
} // end WNT_FontMapEntry :: LogFont
|
175
src/WNT/WNT_GraphicDevice.cdl
Executable file
175
src/WNT/WNT_GraphicDevice.cdl
Executable file
@@ -0,0 +1,175 @@
|
||||
-- File: WNT_GraphicDevice.cdl
|
||||
-- Created: Thu Jan 25 13:23:31 1996
|
||||
-- Author: LAVNIKOV Alexey & PLOTNIKOV Eugeny
|
||||
-- <eugeny@proton>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
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;
|
707
src/WNT/WNT_GraphicDevice.cxx
Executable file
707
src/WNT/WNT_GraphicDevice.cxx
Executable file
@@ -0,0 +1,707 @@
|
||||
/***********************************************************************
|
||||
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
|
41
src/WNT/WNT_GraphicDevice.lxx
Executable file
41
src/WNT/WNT_GraphicDevice.lxx
Executable file
@@ -0,0 +1,41 @@
|
||||
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
|
||||
|
45
src/WNT/WNT_Icon.cdl
Executable file
45
src/WNT/WNT_Icon.cdl
Executable file
@@ -0,0 +1,45 @@
|
||||
-- File: WNT_Icon.cdl
|
||||
-- Created: Th Mar 28 09:54:47 1996
|
||||
-- Author: PLOTNIKOV Eugeny
|
||||
-- <eugeny@maniax>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
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;
|
52
src/WNT/WNT_Icon.cxx
Executable file
52
src/WNT/WNT_Icon.cxx
Executable file
@@ -0,0 +1,52 @@
|
||||
// File: WNT_Icon.cxx
|
||||
// Copyright: Open Cascade 2008
|
||||
|
||||
#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
|
180
src/WNT/WNT_IconBox.cdl
Executable file
180
src/WNT/WNT_IconBox.cdl
Executable file
@@ -0,0 +1,180 @@
|
||||
-- File: WNT_IconBox.cdl
|
||||
-- Created: Mon Jan 29 14:46:25 1996
|
||||
-- Author: PLOTNIKOV Eugeny
|
||||
-- <eugeny@proton>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
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;
|
524
src/WNT/WNT_IconBox.cxx
Executable file
524
src/WNT/WNT_IconBox.cxx
Executable file
@@ -0,0 +1,524 @@
|
||||
// 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
|
||||
//***//
|
||||
//***********************************************************************//
|
266
src/WNT/WNT_IconBox_1.cxx
Executable file
266
src/WNT/WNT_IconBox_1.cxx
Executable file
@@ -0,0 +1,266 @@
|
||||
// File: WNT_IconBox_1.cxx
|
||||
// Copyright: Open Cascade 2008
|
||||
|
||||
#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
|
46
src/WNT/WNT_Image.cdl
Executable file
46
src/WNT/WNT_Image.cdl
Executable file
@@ -0,0 +1,46 @@
|
||||
-- File: WNT_Image.cdl
|
||||
-- Created: Th Mar 28 09:48:57 1996
|
||||
-- Author: PLOTNIKOV Eugeny
|
||||
-- <eugeny@maniax>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class Image from WNT inherits TShared from MMgt
|
||||
|
||||
---Purpose: Internal class for image management
|
||||
|
||||
uses
|
||||
|
||||
Handle from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create ( aBitmap : Handle from Aspect; aHashCode : Integer from Standard )
|
||||
returns mutable Image from WNT;
|
||||
---Purpose: Creates a class.
|
||||
|
||||
Destroy ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Destroys all ressources attached to the Image
|
||||
---C++: alias ~
|
||||
|
||||
HBITMAP ( me ) returns Handle from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns bitmap handle
|
||||
---C++: inline
|
||||
|
||||
Image ( me ) returns Address from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns pointer to internal structure
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
|
||||
myImage : Address from Standard is protected;
|
||||
myHashCode : Integer from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class ImageManager from WNT
|
||||
|
||||
end Image;
|
48
src/WNT/WNT_Image.cxx
Executable file
48
src/WNT/WNT_Image.cxx
Executable file
@@ -0,0 +1,48 @@
|
||||
// File: WNT_Image.cxx
|
||||
// Copyright: Open Cascade 2008
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
#include <WNT_Image.ixx>
|
||||
|
||||
#include <W32_Allocator.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : WNT_Image
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_Image::WNT_Image ( const Aspect_Handle aBitmap,
|
||||
const Standard_Integer aHashCode )
|
||||
{
|
||||
|
||||
myImage = ( Standard_Address )HeapAlloc (
|
||||
GetProcessHeap (),
|
||||
HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS,
|
||||
sizeof ( WNT_Bitmap )
|
||||
);
|
||||
|
||||
( ( PW32_Bitmap )myImage ) -> hBmp = ( ::HBITMAP )aBitmap;
|
||||
( ( PW32_Bitmap )myImage ) -> nUsed = 1;
|
||||
myHashCode = aHashCode;
|
||||
|
||||
} // end constructor
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WNT_Image::Destroy () {
|
||||
|
||||
if ( --( ( PW32_Bitmap )myImage ) -> nUsed == 0 &&
|
||||
( ( PW32_Bitmap )myImage ) -> hBmp != NULL
|
||||
) {
|
||||
|
||||
DeleteObject ( ( ( PW32_Bitmap )myImage ) -> hBmp );
|
||||
HeapFree ( GetProcessHeap (), 0, ( PVOID )myImage );
|
||||
|
||||
} // end if
|
||||
|
||||
} // end WNT_Image :: Destroy
|
||||
|
15
src/WNT/WNT_Image.lxx
Executable file
15
src/WNT/WNT_Image.lxx
Executable file
@@ -0,0 +1,15 @@
|
||||
#ifndef __WNT_BITMAP_H
|
||||
# include <WNT_Bitmap.h>
|
||||
#endif // __WNT_BITMAP_H
|
||||
|
||||
inline Aspect_Handle WNT_Image :: HBITMAP () const {
|
||||
|
||||
return ( ( PWNT_Bitmap )myImage ) -> hBmp;
|
||||
|
||||
} // end WNT_Image :: HBITMAP
|
||||
|
||||
inline Standard_Address WNT_Image :: Image () const {
|
||||
|
||||
return myImage;
|
||||
|
||||
} // end WNT_Image :: HBITMAP
|
163
src/WNT/WNT_ImageManager.cdl
Executable file
163
src/WNT/WNT_ImageManager.cdl
Executable file
@@ -0,0 +1,163 @@
|
||||
-- File: WNT_ImageManager.cdl
|
||||
-- Created: Mon Mar 11 10:51:39 1996
|
||||
-- Author: PLOTNIKOV Eugeny <eugeny@maniax>
|
||||
-- Modifications: PLOTNIKOV Eugeny at July 1998 (BUC60286)
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
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 WDriver from WNT,
|
||||
class Window from WNT
|
||||
|
||||
end ImageManager;
|
581
src/WNT/WNT_ImageManager.cxx
Executable file
581
src/WNT/WNT_ImageManager.cxx
Executable file
@@ -0,0 +1,581 @@
|
||||
// File: WNT_ImageManager.cxx
|
||||
// Created:
|
||||
// Author:
|
||||
// Modifications: PLOTNIKOV Eugeny at July 1998 (BUC60286)
|
||||
// Copyright: Matra Datavision 1998
|
||||
|
||||
// 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 M_PI 3.1415
|
||||
#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 = 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
|
||||
//***//
|
||||
//************************************************************************//
|
1759
src/WNT/WNT_ImageProcessor.cxx
Executable file
1759
src/WNT/WNT_ImageProcessor.cxx
Executable file
File diff suppressed because it is too large
Load Diff
13
src/WNT/WNT_LogFont.cxx
Executable file
13
src/WNT/WNT_LogFont.cxx
Executable file
@@ -0,0 +1,13 @@
|
||||
#ifndef __WNT_LogFont_HeaderFile
|
||||
# include <WNT_LogFont.hxx>
|
||||
#endif // __WNT_LogFont_HeaderFile
|
||||
|
||||
const Handle( Standard_Type )& STANDARD_TYPE( WNT_LogFont ) {
|
||||
|
||||
static Handle( Standard_Type ) _aType = new Standard_Type (
|
||||
"WNT_LogFont", sizeof ( WNT_LogFont )
|
||||
);
|
||||
|
||||
return _aType;
|
||||
|
||||
} // end function
|
33
src/WNT/WNT_LogFont.hxx
Executable file
33
src/WNT/WNT_LogFont.hxx
Executable file
@@ -0,0 +1,33 @@
|
||||
#ifndef __WNT_LogFont_HeaderFile
|
||||
# define __WNT_LogFont_HeaderFile
|
||||
|
||||
# ifndef __WINDOWS_H_INCLUDED
|
||||
# define __WINDOWS_H_INCLUDED
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif /* STRICT */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# ifdef NOGDI
|
||||
# undef NOGDI /* we need GDI definitions here... */
|
||||
# endif
|
||||
# include <windows.h>
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
# ifdef THIS
|
||||
# undef THIS
|
||||
# endif // THIS
|
||||
# endif // __WINDOWS_H_INCLUDED
|
||||
|
||||
# ifndef __STANDARD_TYPE_HXX_INCLUDED
|
||||
# define __STANDARD_TYPE_HXX_INCLUDED
|
||||
# include <Standard_Type.hxx>
|
||||
# endif // __STANDARD_TYPE_HXX_INCLUDED
|
||||
|
||||
typedef LOGFONT WNT_LogFont;
|
||||
|
||||
extern const Handle( Standard_Type )& STANDARD_TYPE( WNT_LogFont );
|
||||
|
||||
#endif // __WNT_LogFont_HeaderFile
|
13
src/WNT/WNT_Long.cxx
Executable file
13
src/WNT/WNT_Long.cxx
Executable file
@@ -0,0 +1,13 @@
|
||||
#ifndef __WNT_Long_HeaderFile
|
||||
# include <WNT_Long.hxx>
|
||||
#endif // __WNT_Long_HeaderFile
|
||||
|
||||
const Handle( Standard_Type )& STANDARD_TYPE( WNT_Long ) {
|
||||
|
||||
static Handle( Standard_Type ) _aType = new Standard_Type (
|
||||
"WNT_Long", sizeof ( WNT_Long )
|
||||
);
|
||||
|
||||
return _aType;
|
||||
|
||||
} // end function
|
30
src/WNT/WNT_Long.hxx
Executable file
30
src/WNT/WNT_Long.hxx
Executable file
@@ -0,0 +1,30 @@
|
||||
#ifndef __WNT_Long_HeaderFile
|
||||
# define __WNT_Long_HeaderFile
|
||||
|
||||
# ifndef __WINDOWS_H_INCLUDED
|
||||
# define __WINDOWS_H_INCLUDED
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif /* STRICT */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
# ifdef THIS
|
||||
# undef THIS
|
||||
# endif // THIS
|
||||
# endif // __WINDOWS_H_INCLUDED
|
||||
|
||||
# ifndef __STANDARD_TYPE_HXX_INCLUDED
|
||||
# define __STANDARD_TYPE_HXX_INCLUDED
|
||||
# include <Standard_Type.hxx>
|
||||
# endif // __STANDARD_TYPE_HXX_INCLUDED
|
||||
|
||||
typedef LONG WNT_Long;
|
||||
|
||||
extern const Handle( Standard_Type )& STANDARD_TYPE( WNT_Long );
|
||||
|
||||
#endif // __WNT_Long_HeaderFile
|
227
src/WNT/WNT_MFTDraw.cxx
Executable file
227
src/WNT/WNT_MFTDraw.cxx
Executable file
@@ -0,0 +1,227 @@
|
||||
// File: WNT_MFTDraw.cxx
|
||||
// Created: March 1998
|
||||
// Author: CHABROVSKY Dmitry
|
||||
// Copyright: Matra Datavision 1998
|
||||
|
||||
#define MFT // Study S3553
|
||||
|
||||
#ifdef MFT
|
||||
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include "WNT_MFTDraw.hxx"
|
||||
#include "W32_Allocator.hxx"
|
||||
#include "W95_Allocator.hxx"
|
||||
#include "WNT_Allocator.hxx"
|
||||
#include <WNT_WDriver.hxx>
|
||||
#include <WNT_DDriver.hxx>
|
||||
#include <WNT_TextManager.hxx>
|
||||
|
||||
#ifdef DrawText
|
||||
# undef DrawText
|
||||
#endif // DrawText
|
||||
|
||||
#include <MFT_FontManager.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#define ROUNDL( d ) ( ( long )( ( d ) + ( ( d ) > 0 ? 0.5 : -0.5 ) ) )
|
||||
#define TRANSFORM(i,X,Y,f95) \
|
||||
{ \
|
||||
Standard_Real x = (X),y = (Y); \
|
||||
pts[(i)].x = P( ROUNDL((double)myPT.x + x*Ca - y*Sa) );\
|
||||
if (f95) pts[(i)].y = sz.cy - P( ROUNDL((double)myPT.y + x*Sa + y*Ca) );\
|
||||
else pts[(i)].y = P( ROUNDL((double)myPT.y + x*Sa + y*Ca) );\
|
||||
}
|
||||
#define SET_DRAW_DATA(aData,aDC,aSZ) \
|
||||
{ aData.theHDC = aDC; \
|
||||
aData.theDevWidth = aSZ.cx; \
|
||||
aData.theDevHeight = aSZ.cy; }
|
||||
|
||||
void __cdecl _Do_MFTDrawText_ (PW32_FCALLPARAM lpParam)
|
||||
{
|
||||
// Declare all needed variables
|
||||
PMFT_DRAWTEXT lpDraw = (PMFT_DRAWTEXT) lpParam;
|
||||
PW32_Allocator lpW32 = (PW32_Allocator) lpDraw->theParam.pAllocator;
|
||||
WNT_WDriver* lpWDrv = (WNT_WDriver*) lpDraw->theParam.pDriver;
|
||||
WNT_DDriver* lpDDrv = (WNT_DDriver*) lpDraw->theParam.pDriver;
|
||||
int aFont = (int)lpW32->myTextFont;
|
||||
double myPixelToUnit = lpDraw->theP2U;
|
||||
XFORM xf;
|
||||
HDC MY_HDC;
|
||||
HPEN hTextPen, hOldPen, hPolyPen;
|
||||
HBRUSH hTextBrush, hOldBrush, hPolyBrush;
|
||||
float Ca = (float)Cos(lpW32->myAngle),
|
||||
Sa = (float)Sin(lpW32->myAngle);
|
||||
SIZE sz;
|
||||
// Starting point to draw
|
||||
POINT myPT = {
|
||||
ROUNDL(
|
||||
float(
|
||||
Ca*lpW32->myScaleX * (lpDraw->theXPos - float( U(lpW32->myPivot.x)) ) -
|
||||
Sa*lpW32->myScaleY * (lpDraw->theYPos - float( U(lpW32->myPivot.y)) ) +
|
||||
float( U( (lpW32->myPivot.x + lpW32->myMove.x) ) )
|
||||
)
|
||||
),
|
||||
ROUNDL(
|
||||
float(
|
||||
Sa*lpW32->myScaleX * (lpDraw->theXPos - float( U(lpW32->myPivot.x)) ) +
|
||||
Ca*lpW32->myScaleY * (lpDraw->theYPos - float( U(lpW32->myPivot.y)) ) +
|
||||
float( U( (lpW32->myPivot.y + lpW32->myMove.y) ) )
|
||||
)
|
||||
)
|
||||
};
|
||||
double uPos;
|
||||
Handle(WNT_TextManager) theTextManager;
|
||||
Handle(MFT_FontManager) theFontManager;
|
||||
Standard_ShortReal theTextSize;
|
||||
//============ Use driver to get some data ============
|
||||
if (lpW32->myFlags & W32F_DVDRV) {
|
||||
// theTextManager = lpDDrv->TextManager ();
|
||||
// theFontManager = lpDDrv->MFT_Font (aFont);
|
||||
// theTextSize = lpDDrv->MFT_Size (aFont);
|
||||
} else {
|
||||
theTextManager = lpWDrv->TextManager ();
|
||||
theFontManager = lpWDrv->MFT_Font (aFont);
|
||||
theTextSize = lpWDrv->MFT_Size (aFont);
|
||||
}
|
||||
//============== Set FontManager and TextManager attributes =============
|
||||
theFontManager->SetFontAttribs (
|
||||
Abs(theTextSize)*lpW32->myTextHScale*lpW32->myScaleX,
|
||||
Abs(theTextSize)*lpW32->myTextVScale*lpW32->myScaleY,
|
||||
lpW32->myTextSlant, 0.,
|
||||
((theTextSize > 0.) ? Standard_False : Standard_True)
|
||||
);
|
||||
uPos = (lpW32->myFlags & W32F_TULIN ?
|
||||
theFontManager->UnderlinePosition() : 0.);
|
||||
theTextManager->SetTextAttribs (
|
||||
0, Aspect_TypeOfText(lpDraw->theTextType), uPos
|
||||
);
|
||||
//=============== Calculate UpdateRect ================
|
||||
Ca = (float)Cos(lpDraw->theAngle + lpW32->myAngle);
|
||||
Sa = (float)Sin(lpDraw->theAngle + lpW32->myAngle);
|
||||
Standard_ShortReal theHeight, theWidth, theXoffset, theYoffset;
|
||||
if (lpW32->myFlags & W32F_DVDRV) {
|
||||
if (!lpDraw->isTextWide)
|
||||
lpDDrv->TextSize ((char*)lpDraw->theText, theWidth, theHeight, theXoffset,
|
||||
theYoffset, aFont);
|
||||
else
|
||||
lpDDrv->TextSize ((short*)lpDraw->theText, theWidth, theHeight, theXoffset,
|
||||
theYoffset, aFont);
|
||||
} else {
|
||||
if (!lpDraw->isTextWide)
|
||||
lpWDrv->TextSize ((char*)lpDraw->theText, theWidth, theHeight, theXoffset,
|
||||
theYoffset, aFont);
|
||||
else
|
||||
lpWDrv->TextSize ((short*)lpDraw->theText, theWidth, theHeight, theXoffset,
|
||||
theYoffset, aFont);
|
||||
}
|
||||
//================= Get some attributes ===============
|
||||
int uWidth = P(theHeight/32.);
|
||||
MFT_TEXTMAN_DATA aData = { 0, TRUE, 0, 0, uWidth, lpW32->myFlags & W32F_MONO };
|
||||
if (lpW32->myFlags & W32F_WIN95) {
|
||||
// Get necessary attributes from WIN95 Allocator
|
||||
PW95_Allocator lpW95 = (PW95_Allocator)lpW32;
|
||||
lpW95->myHDC.Extent(&sz);
|
||||
MY_HDC = lpW95->myHDC.Hdc ();
|
||||
SET_DRAW_DATA (aData, MY_HDC, sz);
|
||||
theTextManager->SetDrawAttribs ( (Standard_Address)&aData );
|
||||
hTextPen = CreatePen ( PS_SOLID, 1, lpW95->myTextColor );
|
||||
hTextBrush = CreateSolidBrush ( lpW95->myTextColor );
|
||||
hPolyPen = ((lpW32->myFlags & W32F_POUTL) ?
|
||||
CreatePen (PS_SOLID, lpW95->myLinePenWidth,
|
||||
lpW95->myLineBrush.lbColor):
|
||||
(HPEN) GetStockObject (NULL_PEN));
|
||||
hPolyBrush = ((lpW32->myFlags & W32F_NOFIL) ?
|
||||
(HBRUSH) GetStockObject (NULL_BRUSH):
|
||||
CreateBrushIndirect (&lpW95->myPolyBrush));
|
||||
} else {
|
||||
// Get necessary attributes from WINNT Allocator
|
||||
PWNT_Allocator lpWNT = (PWNT_Allocator)lpW32;
|
||||
lpWNT->GetExtent(&sz);
|
||||
MY_HDC = lpWNT->myHDC;
|
||||
aData.theWin95 = FALSE;
|
||||
SET_DRAW_DATA (aData, MY_HDC, sz);
|
||||
theTextManager->SetDrawAttribs ( (Standard_Address)&aData );
|
||||
GetWorldTransform ( MY_HDC, &xf );
|
||||
ModifyWorldTransform ( MY_HDC, NULL, MWT_IDENTITY );
|
||||
hTextPen = lpWNT->myTextPen;
|
||||
hTextBrush = lpWNT->myTextBrush;
|
||||
hPolyPen = ((lpW32->myFlags & W32F_POUTL) ?
|
||||
lpWNT->myLinePen :
|
||||
(HPEN) GetStockObject (NULL_PEN) );
|
||||
hPolyBrush = ((lpW32->myFlags & W32F_NOFIL) ?
|
||||
(HBRUSH) GetStockObject (NULL_BRUSH):
|
||||
lpWNT->myPolyBrush);
|
||||
}
|
||||
////////////////////////////////////////////////////////
|
||||
Standard_ShortReal marge =
|
||||
Standard_ShortReal(theHeight * lpDraw->theMargin);
|
||||
theWidth += 2.F*marge; theHeight += 2.F*marge;
|
||||
theXoffset -= marge; theYoffset += marge;
|
||||
////////////////////////////////////////////////////////
|
||||
BOOL fWin95 = lpW32->myFlags & W32F_WIN95;
|
||||
POINT pts[4];
|
||||
TRANSFORM (0, theXoffset, - theYoffset, fWin95);
|
||||
TRANSFORM (1, theXoffset + theWidth, - theYoffset, fWin95);
|
||||
TRANSFORM (2, theXoffset + theWidth, theHeight - theYoffset, fWin95);
|
||||
TRANSFORM (3, theXoffset, theHeight - theYoffset, fWin95);
|
||||
//============ Draw POLYGON around the text ===========
|
||||
if (lpDraw->isTextPoly) {
|
||||
hOldPen = SelectPen (MY_HDC, hPolyPen );
|
||||
hOldBrush = SelectBrush (MY_HDC, hPolyBrush);
|
||||
Polygon (MY_HDC, pts, 4);
|
||||
SelectBrush (MY_HDC, hOldBrush);
|
||||
SelectPen (MY_HDC, hOldPen );
|
||||
}
|
||||
//================= Draw text itself ==================
|
||||
hOldPen = SelectPen (MY_HDC, hTextPen);
|
||||
hOldBrush = SelectBrush (MY_HDC, hTextBrush);
|
||||
if (lpDraw->isTextWide) {
|
||||
theFontManager->DrawText (
|
||||
theTextManager, (short*)lpDraw->theText,
|
||||
myPT.x, myPT.y, (lpDraw->theAngle + lpW32->myAngle)
|
||||
);
|
||||
} else {
|
||||
theFontManager->DrawText (
|
||||
theTextManager, (char*)lpDraw->theText,
|
||||
myPT.x, myPT.y, (lpDraw->theAngle + lpW32->myAngle)
|
||||
);
|
||||
}
|
||||
SelectBrush (MY_HDC, hOldBrush);
|
||||
SelectPen (MY_HDC, hOldPen );
|
||||
//========= Register points as an UpdatedRect =========
|
||||
if (lpW32->myFlags & W32F_WIN95) {
|
||||
PW95_Allocator lpW95 = (PW95_Allocator)lpW32;
|
||||
lpW95->myHDC.Register ( pts, 4 );
|
||||
DeletePen ( hTextPen );
|
||||
DeleteBrush ( hTextBrush );
|
||||
DeletePen ( hPolyPen );
|
||||
DeleteBrush ( hPolyBrush );
|
||||
} else {
|
||||
PWNT_Allocator lpWNT = (PWNT_Allocator)lpW32;
|
||||
lpWNT->Register ( pts, 4 );
|
||||
SetWorldTransform ( MY_HDC, &xf );
|
||||
}
|
||||
//=====================================================
|
||||
/*
|
||||
TCollection_ExtendedString extText;
|
||||
if (lpDraw->isTextWide) {
|
||||
extText = TCollection_ExtendedString((short*)lpDraw->theText);
|
||||
} else {
|
||||
extText = TCollection_AsciiString ((char*) lpDraw->theText);
|
||||
}
|
||||
cout << "DRAW_TEXT: " << (int)lpW32->myTextFont << ", "
|
||||
<< lpDraw->theXPos << ", " << lpDraw->theYPos << "), A="
|
||||
<< lpDraw->theAngle << ", M=" << lpDraw->theMargin << ", T="
|
||||
<< lpDraw->theTextType << ","
|
||||
<< (lpDraw->isTextPoly ? "'Poly'" : "'Simple'") << ","
|
||||
<< (lpDraw->isTextWide ? "'WCHAR'" : "'CHAR'")
|
||||
<< ", L=" << lpDraw->theTextLength << ", ('" << extText
|
||||
<< "'), SZ: " << theTextSize << ", VS=" << lpW32->myTextVScale
|
||||
<< ", HS=" << lpW32->myTextHScale << ", SL=" << lpW32->myTextSlant
|
||||
<< endl << flush;
|
||||
*/
|
||||
}
|
||||
|
||||
#endif // MFT
|
41
src/WNT/WNT_MFTDraw.hxx
Executable file
41
src/WNT/WNT_MFTDraw.hxx
Executable file
@@ -0,0 +1,41 @@
|
||||
// File: WNT_MFTDraw.hxx
|
||||
// Created: March 1998
|
||||
// Author: CHABROVSKY Dmitry
|
||||
// Copyright: Matra Datavision 1998
|
||||
|
||||
#ifdef MFT
|
||||
|
||||
#ifndef _WNT_MFT_DRAW_HEADER_
|
||||
#define _WNT_MFT_DRAW_HEADER_
|
||||
|
||||
#define MAXCHARS 2048
|
||||
#include "W32_Allocator.hxx"
|
||||
|
||||
typedef struct _MFT_DRAWTEXT {
|
||||
W32_FCALLPARAM theParam;
|
||||
double theP2U;
|
||||
float theXPos;
|
||||
float theYPos;
|
||||
float theAngle;
|
||||
double theMargin;
|
||||
int theTextType;
|
||||
BOOL isTextPoly;
|
||||
BOOL isTextWide;
|
||||
int theTextLength;
|
||||
short theText[MAXCHARS];
|
||||
} MFT_DRAWTEXT, *PMFT_DRAWTEXT;
|
||||
|
||||
typedef struct _MFT_TEXTMAN_DATA {
|
||||
HDC theHDC;
|
||||
BOOL theWin95;
|
||||
int theDevWidth;
|
||||
int theDevHeight;
|
||||
int theUWidth;
|
||||
BOOL theMonoBuffer;
|
||||
} MFT_TEXTMAN_DATA, *PMFT_TEXTMAN_DATA;
|
||||
|
||||
extern void __cdecl _Do_MFTDrawText_ (PW32_FCALLPARAM lpParam);
|
||||
|
||||
#endif // _WNT_MFT_DRAW_HEADER_
|
||||
|
||||
#endif // MFT
|
91
src/WNT/WNT_PixMap.cdl
Executable file
91
src/WNT/WNT_PixMap.cdl
Executable file
@@ -0,0 +1,91 @@
|
||||
--
|
||||
-- File: WNT_PixMap.cdl
|
||||
-- Created: 27 October 1999
|
||||
-- Author: VKH
|
||||
-- Updated: SZV IMP100701 Add the "depth" field and method
|
||||
-- to the pixmap object.
|
||||
--
|
||||
---Copyright: MatraDatavision 1991,1992,1993
|
||||
|
||||
class PixMap from WNT
|
||||
|
||||
---Version:
|
||||
|
||||
---Purpose: This class defines a windows bitmap
|
||||
|
||||
---Keywords: Bitmap, Pixmap
|
||||
|
||||
inherits
|
||||
PixMap from Aspect
|
||||
|
||||
uses
|
||||
Handle from Aspect,
|
||||
Color from Quantity,
|
||||
Window from Aspect
|
||||
|
||||
raises
|
||||
PixmapDefinitionError from Aspect,
|
||||
PixmapError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create ( aWindow : Window from Aspect;
|
||||
aWidth, anHeight : Integer from Standard;
|
||||
aCDepth : Integer from Standard = 0 )
|
||||
returns mutable PixMap from WNT
|
||||
raises PixmapDefinitionError from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Warning! When <aDepth> is NULL , the pixmap is created
|
||||
-- with the SAME depth than the window <aWindow>
|
||||
|
||||
---------------------------------------------------
|
||||
-- Category: Methods to modify the class definition
|
||||
---------------------------------------------------
|
||||
|
||||
Destroy ( me : mutable )
|
||||
---Level: Advanced
|
||||
---Purpose: Destroies the Bitmap
|
||||
---C++: alias ~
|
||||
-- Trigger: Raises if Bitmap is not defined properly
|
||||
raises PixmapError from Aspect is virtual;
|
||||
|
||||
Dump ( me; aFilename : CString from Standard ;
|
||||
aGammaValue: Real from Standard = 1.0 )
|
||||
returns Boolean
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Dumps the Bitmap to an image file with
|
||||
-- an optional gamma correction value
|
||||
-- and returns TRUE if the dump occurs normaly.
|
||||
---Category: Methods to modify the class definition
|
||||
raises PixmapError from Aspect is virtual;
|
||||
|
||||
PixelColor ( me : in;
|
||||
theX, theY : in Integer from Standard )
|
||||
returns Color from Quantity
|
||||
is virtual;
|
||||
---Purpose:
|
||||
-- Returns the pixel color.
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
PixmapID ( me ) returns Handle from Aspect is virtual;
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the ID of the just created bitmap
|
||||
---Category: Inquire methods
|
||||
|
||||
----------------------------
|
||||
-- Category: Private methods
|
||||
----------------------------
|
||||
|
||||
PreferedDepth( me ; aWindow: Window from Aspect;
|
||||
aDepth: Integer from Standard)
|
||||
returns Integer from Standard is private;
|
||||
|
||||
fields
|
||||
myDC : Handle from Aspect is protected;
|
||||
myBitmap : Handle from Aspect is protected;
|
||||
myWND : Window from Aspect;
|
||||
end PixMap;
|
139
src/WNT/WNT_PixMap.cxx
Executable file
139
src/WNT/WNT_PixMap.cxx
Executable file
@@ -0,0 +1,139 @@
|
||||
// File WNT_PixMap.cxx
|
||||
// Created 20 December 1999
|
||||
// Author VKH
|
||||
// SZV/GG IMP100701 Add the "depth" field and method
|
||||
// to the pixmap object.
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992,1999
|
||||
|
||||
//-Version
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
|
||||
#include <WNT_PixMap.ixx>
|
||||
|
||||
#include <WNT_Window.hxx>
|
||||
|
||||
extern int DumpBitmapToFile( Handle(WNT_GraphicDevice)&, HDC, HBITMAP, char* );
|
||||
|
||||
#include <WNT_GraphicDevice.hxx>
|
||||
|
||||
Standard_Integer WNT_PixMap::PreferedDepth(
|
||||
const Handle(Aspect_Window)& aWindow,
|
||||
const Standard_Integer aCDepth) const
|
||||
{
|
||||
Standard_Integer theDepth = 32;
|
||||
if (aCDepth <= 1) theDepth = 1;
|
||||
else if (aCDepth <= 4) theDepth = 4;
|
||||
else if (aCDepth <= 8) theDepth = 8;
|
||||
else if (aCDepth <= 16) theDepth = 16;
|
||||
else if (aCDepth <= 24) theDepth = 24;
|
||||
|
||||
return theDepth;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
WNT_PixMap::WNT_PixMap ( const Handle(Aspect_Window)& aWindow,
|
||||
const Standard_Integer aWidth,
|
||||
const Standard_Integer anHeight,
|
||||
const Standard_Integer aCDepth ) :
|
||||
Aspect_PixMap(aWidth, anHeight, PreferedDepth(aWindow, aCDepth))
|
||||
{
|
||||
myWND = aWindow;
|
||||
|
||||
const Handle(WNT_Window)& hWindow = Handle(WNT_Window)::DownCast(aWindow);
|
||||
HDC hdc = GetDC ( (HWND)(hWindow->HWindow()) );
|
||||
HDC hdcMem = CreateCompatibleDC ( hdc );
|
||||
ReleaseDC ( (HWND)(hWindow->HWindow()), hdc );
|
||||
myDC = hdcMem;
|
||||
|
||||
Standard_Integer theNbColors = 0, theFormat = PFD_TYPE_RGBA;
|
||||
|
||||
#ifdef BUG // Our OpenGl driver supports only RGB mode.
|
||||
//WIL001: Color table can not be initialized - do not use
|
||||
if (myDepth <= 8)
|
||||
{
|
||||
theNbColors = (1 << myDepth);
|
||||
theFormat = PFD_TYPE_COLORINDEX;
|
||||
}
|
||||
#endif
|
||||
|
||||
Standard_Integer sizeBmi = Standard_Integer(sizeof(BITMAPINFO)+sizeof(RGBQUAD)*theNbColors);
|
||||
PBITMAPINFO pBmi = (PBITMAPINFO)(new char[sizeBmi]);
|
||||
ZeroMemory ( pBmi, sizeBmi );
|
||||
|
||||
pBmi->bmiHeader.biSize = sizeof (BITMAPINFOHEADER); //sizeBmi
|
||||
pBmi->bmiHeader.biWidth = aWidth;
|
||||
pBmi->bmiHeader.biHeight = anHeight;
|
||||
pBmi->bmiHeader.biPlanes = 1;
|
||||
pBmi->bmiHeader.biBitCount = myDepth; //WIL001: was 24
|
||||
pBmi->bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
LPVOID ppvBits;
|
||||
HBITMAP hBmp = CreateDIBSection ( hdcMem, pBmi, DIB_RGB_COLORS, &ppvBits, NULL, 0 );
|
||||
if ( !hBmp )
|
||||
Aspect_PixmapDefinitionError::Raise ( "CreateDIBSection" );
|
||||
SelectBitmap ( hdcMem, hBmp );
|
||||
myBitmap = hBmp;
|
||||
|
||||
delete[] pBmi;
|
||||
|
||||
if (myDepth > 1) {
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
ZeroMemory ( &pfd, sizeof (PIXELFORMATDESCRIPTOR) );
|
||||
pfd.nSize = sizeof (PIXELFORMATDESCRIPTOR);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_BITMAP;
|
||||
pfd.iPixelType = theFormat; //WIL001: was PFD_TYPE_RGBA
|
||||
pfd.cColorBits = myDepth; //WIL001: was 24
|
||||
pfd.cDepthBits = 24;//
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
Standard_Integer iPf = ChoosePixelFormat(hdcMem, &pfd);
|
||||
if ( !iPf )
|
||||
Aspect_PixmapDefinitionError::Raise ( "ChoosePixelFormat" );
|
||||
|
||||
if ( !DescribePixelFormat ( hdcMem, iPf, sizeof(PIXELFORMATDESCRIPTOR), &pfd ) )
|
||||
Aspect_PixmapDefinitionError::Raise ( "DescribePixelFormat" );
|
||||
|
||||
if ( !SetPixelFormat(hdcMem, iPf, &pfd) )
|
||||
Aspect_PixmapDefinitionError::Raise ( "SetPixelFormat" );
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
void WNT_PixMap::Destroy ()
|
||||
{
|
||||
if ( myDC ) DeleteDC ( (HDC)myDC );
|
||||
if ( myBitmap ) DeleteObject ( (HBITMAP)myBitmap );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Standard_Boolean WNT_PixMap::Dump ( const Standard_CString aFilename,
|
||||
const Standard_Real aGammaValue ) const
|
||||
{
|
||||
// *** gamma correction must be implemented also on WNT system ...
|
||||
const Handle(WNT_Window) hWindow = Handle(WNT_Window)::DownCast(myWND);
|
||||
|
||||
Handle(WNT_GraphicDevice) dev =
|
||||
Handle ( WNT_GraphicDevice )::DownCast ( hWindow->MyGraphicDevice );
|
||||
if ( dev.IsNull() ) return Standard_False;
|
||||
//Aspect_PixmapError::Raise ( "WNT_GraphicDevice is NULL" );
|
||||
|
||||
return DumpBitmapToFile ( dev, (HDC)myDC, (HBITMAP)myBitmap, (Standard_PCharacter)aFilename );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Standard_Address WNT_PixMap::PixmapID() const
|
||||
{
|
||||
return myDC;
|
||||
}
|
||||
|
||||
Quantity_Color WNT_PixMap::PixelColor (const Standard_Integer ,
|
||||
const Standard_Integer ) const
|
||||
{
|
||||
Aspect_PixmapError::Raise ("PixelColor() method not implemented!");
|
||||
return Quantity_Color (0.0, 0.0, 0.0, Quantity_TOC_RGB);
|
||||
}
|
120
src/WNT/WNT_TextManager.cdl
Executable file
120
src/WNT/WNT_TextManager.cdl
Executable file
@@ -0,0 +1,120 @@
|
||||
-- File: WNT_TextManager.cdl
|
||||
-- Created: Feb 1998
|
||||
-- Author: CHABROVSKY Dmitry
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
class TextManager from WNT inherits TextManager from MFT
|
||||
|
||||
uses
|
||||
Length from Quantity,
|
||||
PlaneAngle from Quantity,
|
||||
TypeOfText from Aspect
|
||||
|
||||
is
|
||||
-------------------------
|
||||
-- Category: Constructors
|
||||
-------------------------
|
||||
Create (aPixelToUnit: Real from Standard)
|
||||
returns mutable TextManager from WNT;
|
||||
|
||||
-------------------------
|
||||
-- Category: Draw methods
|
||||
-------------------------
|
||||
BeginString (me: mutable;
|
||||
X,Y: Length from Quantity;
|
||||
anOrientation: PlaneAngle from Quantity;
|
||||
aWidth,aHeight: Length from Quantity;
|
||||
aSlant: PlaneAngle from Quantity;
|
||||
aPaintType: Integer from Standard)
|
||||
is redefined;
|
||||
---Purpose: Calls when string drawing is started.
|
||||
-- with a string aspect <aPaintType> :
|
||||
-- 0 for filled string
|
||||
-- 1 for stroke string
|
||||
-- 2 for outline string
|
||||
-- The origine of the string <X>,<Y>,
|
||||
-- The orientation of the string <anOrientation>,
|
||||
-- The medium size of the char <aWidth,aHeight>,
|
||||
-- The Slant of the char <aSlant>,
|
||||
|
||||
BeginChar (me: mutable;
|
||||
aCharCode: Integer from Standard;
|
||||
X,Y: Length from Quantity)
|
||||
returns Boolean from Standard is redefined;
|
||||
---Purpose: Calls when a char drawing is started
|
||||
-- and give the current string position for this char.
|
||||
-- and give the relative char position from the beginning
|
||||
-- of the string.
|
||||
-- The application can returns FALSE for skipping the char drawing.
|
||||
|
||||
SetCharBoundingBox (me: mutable;
|
||||
X1,Y1,X2,Y2,X3,Y3,X4,Y4: Length from Quantity)
|
||||
returns Boolean from Standard is redefined;
|
||||
---Purpose: Calls to defines the current char bounding-box.
|
||||
-- The application can returns FALSE for ending the char drawing.
|
||||
|
||||
SetCharEncoding (me: mutable;
|
||||
anEncoding: CString from Standard)
|
||||
returns Boolean from Standard is redefined;
|
||||
---Purpose: Calls to defines the current char encoding.
|
||||
-- Warning: The application can returns FALSE for skipping the char drawing.
|
||||
|
||||
Moveto (me: mutable; X,Y: Length from Quantity)
|
||||
returns Boolean from Standard is redefined;
|
||||
---Purpose: Calls to sets the current string position.
|
||||
-- The application can returns FALSE for ending the char drawing.
|
||||
|
||||
Lineto (me: mutable; X,Y: Length from Quantity)
|
||||
returns Boolean from Standard is redefined;
|
||||
---Purpose: Calls to drawn to the current string position.
|
||||
-- The application can returns FALSE for ending the char drawing.
|
||||
|
||||
Curveto (me: mutable; X1,Y1,X2,Y2,X3,Y3,X4,Y4: Length from Quantity)
|
||||
returns Boolean from Standard is redefined;
|
||||
---Purpose: Calls to drawn to the current string position.
|
||||
-- The application can drawn the curve defined by
|
||||
-- his descriptor P1,P2,P3,P4 or
|
||||
-- returns FALSE to let the interpretor compute the curve
|
||||
-- vectors.
|
||||
|
||||
ClosePath (me: mutable)
|
||||
is redefined;
|
||||
---Purpose: Calls when a char path drawing is ended
|
||||
|
||||
EndChar (me: mutable; X,Y: Length from Quantity)
|
||||
returns Boolean from Standard is redefined;
|
||||
---Purpose: Calls when a char drawing is ended
|
||||
-- and give the relative char ending position from the
|
||||
-- beginning of the string.
|
||||
-- The application can returns FALSE for skipping the string
|
||||
-- drawing.
|
||||
|
||||
EndString (me: mutable)
|
||||
is redefined;
|
||||
---Purpose: Calls when string drawing is ended (Normally the last call).
|
||||
|
||||
SetDrawAttribs (me: mutable; aDrawData: Address from Standard);
|
||||
---Purpose: Called when starting to draw the string
|
||||
|
||||
-------------------------
|
||||
-- Category: Private methods
|
||||
-------------------------
|
||||
SetTextAttribs (me: mutable ;
|
||||
aTextColor: Integer from Standard;
|
||||
aTypeOfText: TypeOfText from Aspect;
|
||||
anUnderlinePosition: Length from Quantity = 0.0);
|
||||
---Purpose: Sets the current attribs of the text.
|
||||
|
||||
fields
|
||||
myPixelToUnit: Real from Standard;
|
||||
myDevContext: Integer from Standard;
|
||||
myWin95: Boolean from Standard;
|
||||
myDevWidth: Integer from Standard;
|
||||
myDevHeight: Integer from Standard;
|
||||
myUWidth: Integer from Standard;
|
||||
myMonoBuf: Integer from Standard;
|
||||
|
||||
friends
|
||||
class WDriver from WNT
|
||||
|
||||
end TextManager from WNT;
|
266
src/WNT/WNT_TextManager.cxx
Executable file
266
src/WNT/WNT_TextManager.cxx
Executable file
@@ -0,0 +1,266 @@
|
||||
// File: WNT_TextManager.cxx
|
||||
// Created: Feb 1998
|
||||
// Author: CHABROVSKY Dmitry
|
||||
// Copyright: Matra Datavision 1998
|
||||
|
||||
// include windows.h first to have all definitions available
|
||||
#include <windows.h>
|
||||
|
||||
#define MFT
|
||||
|
||||
#include <WNT_TextManager.ixx>
|
||||
#include <WNT_MFTDraw.hxx>
|
||||
#include <Aspect_Units.hxx>
|
||||
|
||||
#define CHAR_DESC_LEN 30000
|
||||
#define MY_HDC (HDC)myDevContext
|
||||
#define U2P(v) LONG( (v)/myPixelToUnit + 0.5 )
|
||||
#define TRANSFORM(X,Y) \
|
||||
{ Standard_Real x = X,y = Y; \
|
||||
X = Standard_ShortReal(x*theCosAngle - y*theSinAngle); \
|
||||
Y = Standard_ShortReal(x*theSinAngle + y*theCosAngle); \
|
||||
}
|
||||
|
||||
enum TypeOfPoint {
|
||||
TOP_MOVETO, TOP_LINETO, TOP_CURVETO
|
||||
};
|
||||
|
||||
static Standard_Integer thePaintType;
|
||||
static Standard_Integer theTextColor;
|
||||
static Aspect_TypeOfText theTypeOfText;
|
||||
static Standard_ShortReal theUnderlinePosition;
|
||||
static Standard_ShortReal theXmin,theXmax;
|
||||
static Standard_Integer theNchar;
|
||||
static Standard_Real theSinAngle,theCosAngle;
|
||||
static Standard_Real theOrientation;
|
||||
//////////////// Character description ///////////////
|
||||
static int myStrLen = 0;
|
||||
static POINT myStrDesc [CHAR_DESC_LEN];
|
||||
static TypeOfPoint myStrInfo [CHAR_DESC_LEN];
|
||||
static double myBX, myBY;
|
||||
static double myCX, myCY;
|
||||
static int myCharWidth;
|
||||
static int myCharHeight;
|
||||
static BOOL myCharInside;
|
||||
|
||||
#define ADD_POINT(X,Y,aType) \
|
||||
myStrDesc[myStrLen].x = U2P( (X)+myBX ); \
|
||||
myStrDesc[myStrLen].y = ( myWin95 ? myDevHeight - U2P((Y)+myBY) : U2P((Y)+myBY) ); \
|
||||
myStrInfo[myStrLen] = aType; myStrLen++;
|
||||
|
||||
#define CHECK_INSIDE(x,y) \
|
||||
if (!myCharInside) \
|
||||
if (myWin95) { \
|
||||
if ((x > -myCharWidth && x < (myDevWidth /*+ myCharWidth*/ )) && \
|
||||
(y > -myCharHeight && y < (myDevHeight + myCharHeight))) \
|
||||
myCharInside = TRUE; \
|
||||
} else { \
|
||||
if ((x > -myCharWidth && x < (myDevWidth /*+ myCharWidth */)) && \
|
||||
(y > -myCharHeight && y < (myDevHeight /*+ myCharHeight*/))) \
|
||||
myCharInside = TRUE; \
|
||||
}
|
||||
|
||||
#define CUR_X() myStrDesc[myStrLen-1].x
|
||||
#define CUR_Y() myStrDesc[myStrLen-1].y
|
||||
|
||||
/*==================================================================*/
|
||||
WNT_TextManager::WNT_TextManager(const Standard_Real aPixelToUnit)
|
||||
{
|
||||
myPixelToUnit = aPixelToUnit;
|
||||
myDevContext = 0;
|
||||
myDevHeight = 0;
|
||||
// Clear the memory for STRING description
|
||||
ZeroMemory (myStrDesc, sizeof(myStrDesc));
|
||||
ZeroMemory (myStrInfo, sizeof(myStrInfo));
|
||||
myStrLen = 0;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
void WNT_TextManager::BeginString(const Quantity_Length X,
|
||||
const Quantity_Length Y,
|
||||
const Quantity_PlaneAngle anOrientation,
|
||||
const Quantity_Length aWidth,
|
||||
const Quantity_Length aHeight,
|
||||
const Quantity_PlaneAngle aSlant,
|
||||
const Standard_Integer aPaintType)
|
||||
{
|
||||
myStrLen = 0;
|
||||
myCharWidth = U2P(aWidth );
|
||||
myCharHeight = U2P(aHeight);
|
||||
|
||||
thePaintType = aPaintType;
|
||||
theOrientation = anOrientation;
|
||||
myBX = X;
|
||||
myBY = Y;
|
||||
theNchar = 0;
|
||||
theXmin = theXmax = 0.F;
|
||||
if (!thePaintType) {
|
||||
if ((aHeight < (6. MILLIMETER)) ||
|
||||
(theTypeOfText == Aspect_TOT_OUTLINE))
|
||||
thePaintType = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
Standard_Boolean WNT_TextManager::BeginChar(const Standard_Integer aCharCode,
|
||||
const Standard_Real X,
|
||||
const Standard_Real Y)
|
||||
{
|
||||
myCharInside = FALSE;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
Standard_Boolean WNT_TextManager::SetCharBoundingBox(const Quantity_Length X1,
|
||||
const Quantity_Length Y1,
|
||||
const Quantity_Length X2,
|
||||
const Quantity_Length Y2,
|
||||
const Quantity_Length X3,
|
||||
const Quantity_Length Y3,
|
||||
const Quantity_Length X4,
|
||||
const Quantity_Length Y4)
|
||||
{
|
||||
if (theUnderlinePosition > 0.) {
|
||||
if (!theNchar)
|
||||
theXmin = Standard_ShortReal (X1);
|
||||
theXmax = Standard_ShortReal (Sqrt(X2*X2 + Y2*Y2));
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
Standard_Boolean WNT_TextManager::SetCharEncoding(const Standard_CString anEncoding)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
Standard_Boolean WNT_TextManager::Moveto(const Standard_Real X,
|
||||
const Standard_Real Y)
|
||||
{
|
||||
ADD_POINT (X,Y,TOP_MOVETO);
|
||||
myCX = X; myCY = Y;
|
||||
CHECK_INSIDE (CUR_X(),CUR_Y());
|
||||
if (!myCharInside)
|
||||
myStrLen--;
|
||||
return myCharInside;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
Standard_Boolean WNT_TextManager::Lineto(const Standard_Real X,
|
||||
const Standard_Real Y)
|
||||
{
|
||||
ADD_POINT (X,Y,TOP_LINETO);
|
||||
CHECK_INSIDE (CUR_X(),CUR_Y());
|
||||
if (!myCharInside)
|
||||
myStrLen--;
|
||||
return myCharInside;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
Standard_Boolean WNT_TextManager::Curveto(const Quantity_Length X1,
|
||||
const Quantity_Length Y1,
|
||||
const Quantity_Length X2,
|
||||
const Quantity_Length Y2,
|
||||
const Quantity_Length X3,
|
||||
const Quantity_Length Y3,
|
||||
const Quantity_Length X4,
|
||||
const Quantity_Length Y4)
|
||||
{
|
||||
ADD_POINT (X2,Y2,TOP_CURVETO);
|
||||
ADD_POINT (X3,Y3,TOP_CURVETO);
|
||||
ADD_POINT (X4,Y4,TOP_CURVETO);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
void WNT_TextManager::ClosePath()
|
||||
{
|
||||
ADD_POINT (myCX,myCY,TOP_LINETO);
|
||||
CHECK_INSIDE (CUR_X(),CUR_Y());
|
||||
if (!myCharInside)
|
||||
myStrLen--;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
Standard_Boolean WNT_TextManager::EndChar(const Standard_Real X,
|
||||
const Standard_Real Y)
|
||||
{
|
||||
theNchar++;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
void WNT_TextManager::EndString()
|
||||
{
|
||||
static int i, j;
|
||||
|
||||
// Draw text string
|
||||
i = 0;
|
||||
BeginPath (MY_HDC);
|
||||
do {
|
||||
switch (myStrInfo[i]) {
|
||||
case TOP_MOVETO:
|
||||
MoveToEx (MY_HDC, myStrDesc[i].x, myStrDesc[i].y, NULL);
|
||||
break;
|
||||
case TOP_LINETO:
|
||||
j = i+1;
|
||||
while ((myStrInfo[j] == TOP_LINETO) && (j < myStrLen))
|
||||
j++;
|
||||
PolylineTo (MY_HDC, &myStrDesc[i], j-i);
|
||||
i = j-1;
|
||||
break;
|
||||
case TOP_CURVETO:
|
||||
PolyBezierTo (MY_HDC, &myStrDesc[i], 3);
|
||||
i += 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} while (++i < myStrLen);
|
||||
EndPath (MY_HDC);
|
||||
if (thePaintType == 0 && !myMonoBuf) FillPath (MY_HDC);
|
||||
else StrokePath (MY_HDC);
|
||||
|
||||
// Draw underline if necessary
|
||||
if (theUnderlinePosition > 0.) {
|
||||
Standard_ShortReal theX1 = theXmin;
|
||||
Standard_ShortReal theY1 = -theUnderlinePosition;
|
||||
Standard_ShortReal theX2 = theXmax;
|
||||
Standard_ShortReal theY2 = theY1;
|
||||
theSinAngle = Sin (theOrientation);
|
||||
theCosAngle = Cos (theOrientation);
|
||||
TRANSFORM (theX1, theY1);
|
||||
TRANSFORM (theX2, theY2);
|
||||
// Draw UNDERLINE
|
||||
if (myWin95) {
|
||||
MoveToEx (MY_HDC, U2P(theX1 + myBX), myDevHeight - U2P(theY1 + myBY), NULL);
|
||||
LineTo (MY_HDC, U2P(theX2 + myBX), myDevHeight - U2P(theY2 + myBY) );
|
||||
} else {
|
||||
MoveToEx (MY_HDC, U2P(theX1 + myBX), U2P(theY1 + myBY), NULL);
|
||||
LineTo (MY_HDC, U2P(theX2 + myBX), U2P(theY2 + myBY) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
void WNT_TextManager::SetTextAttribs(const Standard_Integer aTextColor,
|
||||
const Aspect_TypeOfText aTypeOfText,
|
||||
const Quantity_Length anUnderlinePosition)
|
||||
{
|
||||
theTextColor = aTextColor;
|
||||
theTypeOfText = aTypeOfText;
|
||||
theUnderlinePosition = (Standard_ShortReal)anUnderlinePosition;
|
||||
}
|
||||
|
||||
/*==================================================================*/
|
||||
void WNT_TextManager::SetDrawAttribs(const Standard_Address aDrawData)
|
||||
{
|
||||
PMFT_TEXTMAN_DATA aData = (PMFT_TEXTMAN_DATA)aDrawData;
|
||||
myDevContext = (int)aData->theHDC;
|
||||
myWin95 = aData->theWin95;
|
||||
myDevWidth = aData->theDevWidth;
|
||||
myDevHeight = aData->theDevHeight;
|
||||
myUWidth = aData->theUWidth;
|
||||
myMonoBuf = aData->theMonoBuffer;
|
||||
}
|
13
src/WNT/WNT_Uint.cxx
Executable file
13
src/WNT/WNT_Uint.cxx
Executable file
@@ -0,0 +1,13 @@
|
||||
#ifndef __WNT_Uint_HeaderFile
|
||||
# include <WNT_Uint.hxx>
|
||||
#endif // __WNT_Uint_HeaderFile
|
||||
|
||||
const Handle( Standard_Type )& STANDARD_TYPE( WNT_Uint ) {
|
||||
|
||||
static Handle( Standard_Type ) _aType = new Standard_Type (
|
||||
"WNT_Uint", sizeof ( WNT_Uint )
|
||||
);
|
||||
|
||||
return _aType;
|
||||
|
||||
} // end function
|
30
src/WNT/WNT_Uint.hxx
Executable file
30
src/WNT/WNT_Uint.hxx
Executable file
@@ -0,0 +1,30 @@
|
||||
#ifndef __WNT_Uint_HeaderFile
|
||||
# define __WNT_Uint_HeaderFile
|
||||
|
||||
# ifndef __WINDOWS_H_INCLUDED
|
||||
# define __WINDOWS_H_INCLUDED
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif /* STRICT */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
# ifdef THIS
|
||||
# undef THIS
|
||||
# endif // THIS
|
||||
# endif // __WINDOWS_H_INCLUDED
|
||||
|
||||
# ifndef __STANDARD_TYPE_HXX_INCLUDED
|
||||
# define __STANDARD_TYPE_HXX_INCLUDED
|
||||
# include <Standard_Type.hxx>
|
||||
# endif // __STANDARD_TYPE_HXX_INCLUDED
|
||||
|
||||
typedef UINT WNT_Uint;
|
||||
|
||||
extern const Handle( Standard_Type )& STANDARD_TYPE( WNT_Uint );
|
||||
|
||||
#endif // __WNT_Uint_HeaderFile
|
94
src/WNT/WNT_WClass.cdl
Executable file
94
src/WNT/WNT_WClass.cdl
Executable file
@@ -0,0 +1,94 @@
|
||||
-- File: WNT_WClass.cdl
|
||||
-- Created: Fri Jan 26 14:13:05 1996
|
||||
-- Author: PLOTNIKOV Eugeny
|
||||
-- <eugeny@proton>
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
|
||||
class WClass from WNT inherits TShared from MMgt
|
||||
|
||||
---Purpose: This class defines a Windows NT window class.
|
||||
-- A window in Windows NT is always created based on a
|
||||
-- window class. The window class identifies the window
|
||||
-- procedure that processes messages to the window. Each
|
||||
-- window class has unique name ( character string ). More
|
||||
-- than one window can be created based on a single window
|
||||
-- class. For example, all button windows in Windows NT
|
||||
-- are created based on the same window class. The window
|
||||
-- class defines the window procedure and some other
|
||||
-- characteristics ( background, mouse cursor shape etc. )
|
||||
-- of the windows that are created based on that class.
|
||||
-- When we create a window, we define additional
|
||||
-- characteristics of the window that are unique to that
|
||||
-- window. So, we have to create and register window
|
||||
-- class before creation of any window. Of course, it's possible
|
||||
-- to create a new window class for each window inside
|
||||
-- the Window class and do not use the WClass at all.
|
||||
-- We implemented this class for sake of flexibility of
|
||||
-- event processing.
|
||||
|
||||
uses
|
||||
|
||||
Uint from WNT,
|
||||
Handle from Aspect
|
||||
|
||||
raises
|
||||
|
||||
ClassDefinitionError from WNT
|
||||
|
||||
is
|
||||
|
||||
Create (
|
||||
aClassName : CString from Standard;
|
||||
aWndProc : Address from Standard;
|
||||
aStyle : Uint from WNT;
|
||||
aClassExtra : Integer from Standard = 0;
|
||||
aWindowExtra : Integer from Standard = 0;
|
||||
aCursor : Handle from Aspect = 0;
|
||||
anIcon : Handle from Aspect = 0;
|
||||
aMenuName : CString from Standard = 0
|
||||
)
|
||||
returns mutable WClass from WNT
|
||||
---Level: Public
|
||||
---Purpose: Creates a Windows NT window class and registers it.
|
||||
---Trigger: Raises if class registration failed.
|
||||
raises ClassDefinitionError from WNT;
|
||||
|
||||
Destroy ( me : mutable )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Destroys all resources attached to the class
|
||||
---C++: alias ~
|
||||
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
|
||||
WndProc ( me ) returns Address from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns address of window procedure.
|
||||
---C++: inline
|
||||
|
||||
Name ( me ) returns CString from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Returns a class name.
|
||||
---C++: inline
|
||||
|
||||
Instance ( me ) returns Handle from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Returns a program instance handle.
|
||||
---C++: inline
|
||||
|
||||
fields
|
||||
|
||||
lpszName : CString from Standard is protected;
|
||||
hInstance : Handle from Aspect is protected;
|
||||
lpfnWndProc : Address from Standard is protected;
|
||||
|
||||
friends
|
||||
|
||||
class Window from WNT
|
||||
|
||||
end WClass;
|
66
src/WNT/WNT_WClass.cxx
Executable file
66
src/WNT/WNT_WClass.cxx
Executable file
@@ -0,0 +1,66 @@
|
||||
// File: WNT_WClass.cxx
|
||||
// Copyright: Open Cascade 2008
|
||||
|
||||
#include <windows.h>
|
||||
#include <WNT_WClass.ixx>
|
||||
|
||||
#include <InterfaceGraphic_WNT.hxx>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
//=======================================================================
|
||||
//function : WNT_WClass
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
WNT_WClass::WNT_WClass (
|
||||
const Standard_CString aClassName,
|
||||
const Standard_Address aWndProc,
|
||||
const WNT_Uint& aStyle,
|
||||
const Standard_Integer aClassExtra,
|
||||
const Standard_Integer aWindowExtra,
|
||||
const Aspect_Handle aCursor,
|
||||
const Aspect_Handle anIcon,
|
||||
const Standard_CString aMenuName
|
||||
) {
|
||||
|
||||
WNDCLASS wc;
|
||||
|
||||
hInstance = GetModuleHandle ( NULL );
|
||||
|
||||
wc.style = aStyle;
|
||||
wc.lpfnWndProc = ( aWndProc ) ? ( WNDPROC )aWndProc : DefWindowProc;
|
||||
wc.cbClsExtra = aClassExtra;
|
||||
wc.cbWndExtra = aWindowExtra + sizeof ( WINDOW_DATA* );
|
||||
wc.hInstance = ( HINSTANCE )hInstance;
|
||||
wc.hIcon = ( anIcon ) ? ( HICON )anIcon :
|
||||
LoadIcon ( NULL, IDI_APPLICATION );
|
||||
wc.hCursor = ( aCursor ) ? ( HCURSOR )aCursor :
|
||||
LoadCursor ( NULL, IDC_NO );
|
||||
wc.hbrBackground = 0;
|
||||
wc.lpszMenuName = aMenuName;
|
||||
wc.lpszClassName = aClassName;
|
||||
|
||||
if ( !RegisterClass ( &wc ) )
|
||||
|
||||
WNT_ClassDefinitionError :: Raise ( "Unable to register window class" );
|
||||
|
||||
lpszName = new char[ strlen ( aClassName ) + 1 ];
|
||||
strcpy ( (Standard_PCharacter)lpszName, aClassName );
|
||||
lpfnWndProc = wc.lpfnWndProc;
|
||||
|
||||
} // end constructor
|
||||
|
||||
//=======================================================================
|
||||
//function : Destroy
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void WNT_WClass::Destroy ()
|
||||
{
|
||||
|
||||
UnregisterClass ( lpszName, ( HINSTANCE )hInstance );
|
||||
delete [] (Standard_PCharacter)lpszName;
|
||||
|
||||
} // end WNT_WClass :: Destroy
|
||||
|
17
src/WNT/WNT_WClass.lxx
Executable file
17
src/WNT/WNT_WClass.lxx
Executable file
@@ -0,0 +1,17 @@
|
||||
inline Standard_CString WNT_WClass :: Name () const {
|
||||
|
||||
return lpszName;
|
||||
|
||||
} // end WNT_WClass :: Name
|
||||
|
||||
inline Aspect_Handle WNT_WClass :: Instance () const {
|
||||
|
||||
return hInstance;
|
||||
|
||||
} // end WNT_WClass :: Instance
|
||||
|
||||
inline Standard_Address WNT_WClass :: WndProc () const {
|
||||
|
||||
return lpfnWndProc;
|
||||
|
||||
} // end WNT_WClass :: WndProc
|
960
src/WNT/WNT_WDriver.cdl
Executable file
960
src/WNT/WNT_WDriver.cdl
Executable file
@@ -0,0 +1,960 @@
|
||||
-- File: WNT_WDriver.cdl
|
||||
-- Created: Thu Jan 25 16:02:32 1996
|
||||
-- Authors: LAVNIKOV Alexey & PLOTNIKOV Eugeny
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
class WDriver from WNT inherits WindowDriver from Aspect
|
||||
|
||||
---Purpose: This class defines Windows NT window driver
|
||||
|
||||
uses
|
||||
|
||||
ExtendedString from TCollection,
|
||||
Length from Quantity,
|
||||
Factor from Quantity,
|
||||
Ratio from Quantity,
|
||||
PlaneAngle from Quantity,
|
||||
Array1OfShortReal from TShort,
|
||||
TypeOfResize from Aspect,
|
||||
TypeOfDrawMode from Aspect,
|
||||
TypeOfText from Aspect,
|
||||
ColorMap from Aspect,
|
||||
TypeMap from Aspect,
|
||||
WidthMap from Aspect,
|
||||
FontMap from Aspect,
|
||||
MarkMap from Aspect,
|
||||
Window from WNT,
|
||||
HColorTable from WNT,
|
||||
HFontTable from WNT,
|
||||
HArray1OfInteger from TColStd,
|
||||
FontMapEntry from WNT,
|
||||
|
||||
FontManager from MFT,
|
||||
HListOfMFTFonts from WNT,
|
||||
HArray1OfShortReal from TShort,
|
||||
TextManager from WNT
|
||||
|
||||
raises
|
||||
|
||||
DriverDefinitionError from Aspect,
|
||||
DriverError from Aspect
|
||||
|
||||
is
|
||||
|
||||
Create ( aWindow : Window from WNT )
|
||||
returns mutable WDriver from WNT
|
||||
raises DriverDefinitionError from Aspect;
|
||||
---Level: Public
|
||||
---Purpose: Creates Windows NT window driver associated
|
||||
-- with the Windows NT window
|
||||
|
||||
|
||||
Destroy ( me : mutable )
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Destroy the Driver
|
||||
---Category: Methods to modify the class definition
|
||||
---C++: alias ~
|
||||
|
||||
SelectBuffer( me; aRetainBuffer: Integer from Standard) returns Address from Standard;
|
||||
---Level: Public
|
||||
---Purpose: Selects RetainBuffer for output
|
||||
---Category: Methods to manage buffers
|
||||
|
||||
|
||||
BeginDraw (
|
||||
me : mutable;
|
||||
aDoubleBuffer : Boolean = Standard_True;
|
||||
aRetainBuffer : Integer = 0
|
||||
)
|
||||
---Purpose: Begin graphics and drawn directly to the Window or Pixmap if
|
||||
--<aRetainBuffer> is 0 or in the retain buffer if > 0.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not open.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
EndDraw ( me : mutable; aSynchronize : Boolean = Standard_False ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Called by the method Graphic2d_View::Update, this
|
||||
-- method manages the buffer flushing and Wait after up to date
|
||||
-- display when Synchronize is TRUE.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
ResizeSpace ( me: mutable )
|
||||
returns TypeOfResize from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Resizes the WorkSpace depending of the Window size
|
||||
-- MUST be call after a Resize or Move WindowDriver Event
|
||||
-- Returns the TypeOfResize gravity mode.
|
||||
-- Trigger: Raises if the type of resizing is unknown.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
|
||||
---------------------------------------------
|
||||
-- Category: Methods to set the attributes
|
||||
---------------------------------------------
|
||||
|
||||
|
||||
SetHighlightColor ( me; aColorIdx : Integer from Standard )
|
||||
returns Boolean from Standard is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets the highlight color for the drawing. Returns False
|
||||
-- if the graphic device does not support palette mechanism.
|
||||
|
||||
SetDrawMode (
|
||||
me : mutable;
|
||||
aMode : TypeOfDrawMode from Aspect
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Change the current drawing mode of the Driver
|
||||
-- TODM_REPLACE : the primitive is drawn with his defined color.
|
||||
-- TODM_ERASE : the primitive is erased from the window.
|
||||
-- TODM_XOR : the primitive is xored to the window.
|
||||
-- TODM_XORLIGHT: the primitive is xored depending of the current
|
||||
-- highlight and background colors.
|
||||
|
||||
SetLineAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
TypeIndex : Integer from Standard;
|
||||
WidthIndex : Integer from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Sets the line attributes.
|
||||
-- Category: Methods to set the line attributes
|
||||
-- Trigger: Raises if one of the index is out of range.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
SetTextAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
FontIndex : Integer from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Sets the text attributes.
|
||||
-- Category: Methods to set the text attributes
|
||||
-- Trigger: Raises if one of the index is out of range.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
SetTextAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
FontIndex : Integer from Standard;
|
||||
aSlant : PlaneAngle from Quantity;
|
||||
aHScale : Factor from Quantity;
|
||||
aWScale : Factor from Quantity;
|
||||
isUnderlined : Boolean from Standard = Standard_False
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Sets the Extended text attributes.
|
||||
-- Category: Methods to set the text attributes
|
||||
-- Trigger: Raises if one of the index is out of range.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
SetPolyAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
TileIndex : Integer from Standard;
|
||||
DrawEdgeFlag : Boolean from Standard = Standard_False
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Sets the polygon attributes.
|
||||
-- Warning:
|
||||
-- <ColorIndex> is the background poly color index.
|
||||
-- <TileIndex> is the background poly fill rule index.
|
||||
-- If <DrawEdgeFlag> is TRUE the edge of the poly is drawn with the
|
||||
-- current line attributes.
|
||||
-- Category: Methods to set the poly attributes
|
||||
-- Trigger: Raises if one of the index is out of range.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
SetPolyAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
TileIndex : Integer from Standard;
|
||||
PolygonMode : Integer from Standard;
|
||||
DrawEdgeFlag : Boolean from Standard = Standard_False
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Sets the polygon attributes.
|
||||
-- Warning:
|
||||
-- <PolygonMode> way to fill consecutive lines
|
||||
-- Category: Methods to set the poly attributes
|
||||
-- Trigger: Raises if one of the index is out of range.
|
||||
raises DriverError from Aspect;
|
||||
|
||||
SetMarkerAttrib (
|
||||
me : mutable;
|
||||
ColorIndex : Integer from Standard;
|
||||
EdgeWidthIndex : Integer from Standard;
|
||||
FillMarker : Boolean from Standard = Standard_False
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Sets the marker attributes.
|
||||
-- Warning:
|
||||
-- <ColorIndex> is the edge or fill marker color index.
|
||||
-- <EdgeWidthIndex> is the edge marker thickness index.
|
||||
-- If <FillMarker> is TRUE the marker is filled on the first set
|
||||
-- of consecutive drawn points.
|
||||
-- Trigger: Raises if one of the index is out of range.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
|
||||
-----------------------------------------
|
||||
-- Category: Methods to manage the images
|
||||
-----------------------------------------
|
||||
|
||||
IsKnownImage ( me : mutable; anImage : Transient from Standard )
|
||||
returns Boolean from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns Standard_True if the associated driver
|
||||
-- have stored the image and Standard_False if not.
|
||||
|
||||
SizeOfImageFile (
|
||||
me;
|
||||
anImageFile : CString from Standard;
|
||||
aWidth,aHeight : out Integer from Standard
|
||||
)
|
||||
returns Boolean from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns Standard_True and the Image Size in PIXEL
|
||||
-- if the image file exist and can be computed by the driver,
|
||||
-- NOTE that only XWD and DIB image file type are recognized
|
||||
-- today.
|
||||
|
||||
ClearImage (
|
||||
me : mutable;
|
||||
anImageId : Transient from Standard
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Clears the image in <me>.
|
||||
|
||||
ClearImageFile (
|
||||
me : mutable;
|
||||
anImageFile : CString from Standard
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Clears the image associated with the image file.
|
||||
|
||||
DrawImage (
|
||||
me : mutable;
|
||||
anImageId : Transient from Standard;
|
||||
aX, aY : ShortReal from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws the image in <me>.
|
||||
-- <aX>, <aY> is the center of the image.
|
||||
-- Image center must be defined in DWU space.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: If the anImageId is not found
|
||||
|
||||
DrawImageFile (
|
||||
me : mutable;
|
||||
anImageFile : CString from Standard;
|
||||
aX, aY : ShortReal from Standard;
|
||||
aScale : Factor from Quantity = 1.0
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws the image file in <me>.
|
||||
-- <aX>, <aY> is the center of the image.
|
||||
-- <aScale> the scale factor which is apply on this image
|
||||
-- Image center must be defined in DWU space.
|
||||
-- anImageFile must be defined with the full pathname
|
||||
-- of the form dev:\path\name.ext or $DIR\name.ext
|
||||
-- with DIR defined in a setenv variable.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: If the anImageFile is not found
|
||||
-- or the Image type is neither XWD nor DIB.
|
||||
|
||||
FillAndDrawImage (
|
||||
me : mutable;
|
||||
anImageId : Transient from Standard;
|
||||
aX, aY : ShortReal from Standard;
|
||||
Width, Height : Integer from Standard;
|
||||
anArrayOfPixels : Address from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Stores a complete image and draws it in <me>.
|
||||
-- Image size must be defined in DWU space>
|
||||
-- Trigger: Raises if the creation of the image failed.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
FillAndDrawImage (
|
||||
me : mutable;
|
||||
anImageId : Transient from Standard;
|
||||
aX, aY : ShortReal from Standard;
|
||||
anIndexOfLine, Width, Height : Integer from Standard;
|
||||
anArrayOfPixels : Address from Standard
|
||||
)
|
||||
---Level: Advanced
|
||||
---Purpose: Stores a line of an image and draws it in <me>.
|
||||
-- Warning: 0<= anIndexOfLine < aHeight
|
||||
-- anIndexOfLine = 0 must be the first call
|
||||
-- Trigger: Raises if the creation of the image failed.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
|
||||
---------------------------------------
|
||||
-- Category: Methods to draw primitives
|
||||
---------------------------------------
|
||||
|
||||
|
||||
DrawPolyline (
|
||||
me : mutable;
|
||||
ListX : Array1OfShortReal from TShort;
|
||||
ListY : Array1OfShortReal from TShort
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws the polyline depending of SetLineAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- Trigger: Raises if Polyline has too many points (> 1024)
|
||||
-- Raises if the length of <ListX> is not equal to
|
||||
-- the length of <ListY>.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawPolygon (
|
||||
me : mutable;
|
||||
ListX : Array1OfShortReal from TShort;
|
||||
ListY : Array1OfShortReal from TShort
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws the polygone depending of SetPolyAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- Trigger: Raises if Polygone has too many points (> 1024)
|
||||
-- Raises if the length of <ListX> is not equal to
|
||||
-- the length of <ListY>.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawSegment (
|
||||
me : mutable;
|
||||
X1, Y1 : ShortReal from Standard;
|
||||
X2, Y2 : ShortReal from Standard
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws the segment depending of SetLineAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawText (
|
||||
me : mutable;
|
||||
Text : ExtendedString from TCollection;
|
||||
Xpos, Ypos : ShortReal from Standard;
|
||||
anAngle : ShortReal from Standard = 0.0;
|
||||
aType : TypeOfText from Aspect = Aspect_TOT_SOLID
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws the text depending of SetTextAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- Trigger: Raises if Text has too many chars (> 1024)
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawText (
|
||||
me : mutable;
|
||||
Text : CString from Standard;
|
||||
Xpos, Ypos : ShortReal from Standard;
|
||||
anAngle : ShortReal from Standard = 0.0;
|
||||
aType : TypeOfText from Aspect = Aspect_TOT_SOLID
|
||||
)
|
||||
---Level : Public
|
||||
---Purpose: Draws the text depending of SetTextAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- Angle must be defined in RADIAN.
|
||||
-- Trigger: Raises if Text has too many chars (> 1024)
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawPolyText (
|
||||
me : mutable;
|
||||
aText : ExtendedString from TCollection;
|
||||
Xpos : ShortReal from Standard;
|
||||
Ypos : ShortReal from Standard;
|
||||
aMarge : Ratio from Quantity = 0.1;
|
||||
anAngle : ShortReal from Standard = 0.0;
|
||||
aType : TypeOfText from Aspect = Aspect_TOT_SOLID
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws an framed text depending of the
|
||||
-- SetTextAttrib() and SetPolyAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- <aMarge> defines the ratio of the space between the
|
||||
-- polygon borders and the bounding box of the text and
|
||||
-- depending of the height of the text.
|
||||
-- Trigger: Raises if Text has too many chars (> 1024)
|
||||
-- or <aMarge is < 0 or > 1.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawPolyText (
|
||||
me : mutable;
|
||||
aText : CString from Standard;
|
||||
Xpos : ShortReal from Standard;
|
||||
Ypos : ShortReal from Standard;
|
||||
aMarge : Ratio from Quantity = 0.1;
|
||||
anAngle : ShortReal from Standard = 0.0;
|
||||
aType : TypeOfText from Aspect = Aspect_TOT_SOLID
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws an framed text depending of the
|
||||
-- SetTextAttrib() and SetPolyAttrib() attributes.
|
||||
-- Warning: Coordinates must be defined in DWU space.
|
||||
-- <aMarge> defines the ratio of the space between the
|
||||
-- polygon borders and the bounding box of the text and
|
||||
-- depending of the height of the text.
|
||||
-- Trigger: Raises if Text has too many chars (> 1024)
|
||||
-- or <aMarge is < 0 or > 1.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawPoint ( me : mutable; X, Y : ShortReal from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Draws a 1 PIXEL point depending of the SetMarkerAttrib()
|
||||
-- color attribute or add a point depending of the incremental
|
||||
-- BeginXxxxxx() primitive used.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawMarker (
|
||||
me : mutable;
|
||||
aMarker : Integer from Standard;
|
||||
Xpos, Ypos : ShortReal from Standard;
|
||||
Width, Height : ShortReal from Standard;
|
||||
Angle : ShortReal from Standard = 0.0
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Draws the previously defined marker depending of
|
||||
-- the SetMarkerAttrib() attributes.
|
||||
-- Warning: Coordinates and sizes must be defined in DWU space.
|
||||
-- Angle must be defined in RADIAN.
|
||||
-- A one pixel marker is drawn when aMarker index is undefined.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawArc (
|
||||
me : mutable;
|
||||
X, Y : ShortReal from Standard;
|
||||
aXradius, aYradius : ShortReal from Standard;
|
||||
aStartAngle : ShortReal from Standard = 0.0;
|
||||
anOpenAngle : ShortReal from Standard = 6.283185
|
||||
)
|
||||
returns Boolean
|
||||
---Level: Public
|
||||
---Purpose: Draws an Ellipsoid arc of center <X,Y> and Radius
|
||||
-- <aXradius,aYradius> of relative angle <anOpenAngle> from
|
||||
-- the base angle <aStartAngle>
|
||||
-- Warning: Returns FALSE if the hardware can't drawing this
|
||||
-- primitive properly,application must to simulate it.
|
||||
-- Trigger: Raises if one of <aXradius,aYradius> is <= 0.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
DrawPolyArc (
|
||||
me : mutable;
|
||||
X, Y : ShortReal from Standard;
|
||||
anXradius, anYradius : ShortReal from Standard;
|
||||
aStartAngle : ShortReal from Standard = 0.0;
|
||||
anOpenAngle : ShortReal from Standard = 6.283185
|
||||
)
|
||||
returns Boolean
|
||||
---Level: Public
|
||||
---Purpose: Draws an filled Ellipsoid arc of center <X,Y> and Radius
|
||||
-- <anXradius,anYradius> of relative angle <anOpenAngle> from
|
||||
-- the base angle <aStartAngle> and depending of the
|
||||
-- SetPolyAttrib() attributes.
|
||||
-- Warning: Returns FALSE if the hardware can't drawing this
|
||||
-- primitive properly,application must to simulate it.
|
||||
-- Trigger: Raises if one of <aXradius,aYradius> is <= 0.
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
BeginPolyline ( me : mutable; aNumber : Integer ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Begin a polyline primitive of <aNumber> of points.
|
||||
-- Warning: Points must be added by the DrawPoint() method.
|
||||
|
||||
BeginPolygon ( me : mutable; aNumber : Integer ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Begin a polygon primitive of <aNumber> of points .
|
||||
-- Warning: Points must be added by the DrawPoint() method.
|
||||
|
||||
BeginSegments ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of segments .
|
||||
-- Warning: Segments must be added by DrawSegment() method.
|
||||
|
||||
BeginArcs ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of circles or ellips .
|
||||
-- Warning: Arcs must be added by the DrawArc() method.
|
||||
|
||||
BeginPolyArcs ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of polygon circles or ellips .
|
||||
-- Warning: Arcs must be added by the DrawPolyArc() method.
|
||||
|
||||
BeginMarkers ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of markers .
|
||||
-- Warning: Markers must be added by the DrawMarker() method.
|
||||
|
||||
BeginPoints ( me : mutable ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Begin a set of points .
|
||||
-- Warning: Points must be added by the DrawPoint() method.
|
||||
|
||||
ClosePrimitive ( me : mutable )
|
||||
---Level: Public
|
||||
---Purpose: Close the last Begining primitive
|
||||
-- Trigger: Raises if no primitive have been opened by BeginXxxxxx().
|
||||
raises DriverError from Aspect is virtual;
|
||||
|
||||
|
||||
---------------------------------------------
|
||||
-- Category: Methods to define the attributes
|
||||
---------------------------------------------
|
||||
|
||||
|
||||
InitializeColorMap (
|
||||
me : mutable;
|
||||
Colormap : ColorMap from Aspect
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Defines the color map.
|
||||
-- Level: Public
|
||||
-- Trigger: Raises if the definition failed.
|
||||
raises DriverError from Aspect is virtual protected;
|
||||
---Category: Methods to define the color indices.
|
||||
|
||||
InitializeTypeMap (
|
||||
me : mutable;
|
||||
Typemap : TypeMap from Aspect
|
||||
)
|
||||
---Purpose: Defines the line type map.
|
||||
-- Level: Public
|
||||
-- Trigger: Raises if the definition failed.
|
||||
raises DriverError from Aspect is virtual protected;
|
||||
---Category: Methods to define the type of line indices.
|
||||
|
||||
InitializeWidthMap (
|
||||
me : mutable;
|
||||
Widthmap : WidthMap from Aspect
|
||||
)
|
||||
---Purpose: Defines the width line map.
|
||||
-- Level: Public
|
||||
-- Trigger: Raises if the definition failed.
|
||||
raises DriverError from Aspect is virtual protected;
|
||||
---Category: Methods to define the width of line indices.
|
||||
|
||||
InitializeFontMap (
|
||||
me : mutable;
|
||||
Fontmap : FontMap from Aspect
|
||||
)
|
||||
---Purpose: Defines the font map.
|
||||
-- Level: Public
|
||||
-- Trigger: Raises if the definition failed.
|
||||
raises DriverError from Aspect is virtual protected;
|
||||
---Category: Methods to define the font indices.
|
||||
|
||||
InitializeMarkMap (
|
||||
me : mutable;
|
||||
Markmap : MarkMap from Aspect
|
||||
)
|
||||
---Purpose: Defines the mark map.
|
||||
-- Level: Public
|
||||
-- Trigger: Raises if the definition failed.
|
||||
raises DriverError from Aspect is virtual protected;
|
||||
---Category: Methods to define the marker indices.
|
||||
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- Category: Methods to define or edit a buffer of primitives
|
||||
-------------------------------------------------------------
|
||||
InternalOpenBuffer (
|
||||
me : mutable;
|
||||
aRetainBuffer : Integer;
|
||||
aMono : Boolean;
|
||||
aPivotX : ShortReal;
|
||||
aPivotY : ShortReal;
|
||||
aColorIndex : Integer;
|
||||
aWidthIndex : Integer;
|
||||
aTypeIndex : Integer;
|
||||
aFontIndex : Integer;
|
||||
aDrawMode : TypeOfDrawMode = Aspect_TODM_REPLACE
|
||||
)
|
||||
returns Address is private;
|
||||
|
||||
OpenBuffer (
|
||||
me : mutable;
|
||||
aRetainBuffer : Integer;
|
||||
aPivotX : ShortReal = 0.0;
|
||||
aPivotY : ShortReal = 0.0;
|
||||
aWidthIndex : Integer = 0;
|
||||
aColorIndex : Integer = 0;
|
||||
aFontIndex : Integer = 0;
|
||||
aDrawMode : TypeOfDrawMode = Aspect_TODM_REPLACE
|
||||
)
|
||||
returns Boolean is virtual;
|
||||
---Purpose: Allocate the retain buffer <aRetainBuffer> ,
|
||||
-- Defines the DWU coordinates of the pivot point for all primitives
|
||||
-- contains inside.
|
||||
-- Defines the buffer color and font index :
|
||||
-- the default color is the highlight color of the colormap.
|
||||
-- the default font is the default system font of the fontmap.
|
||||
-- The other attributes are fixed :
|
||||
-- line type is Solid,
|
||||
-- line width is 1 Pixel,
|
||||
-- polygon fill mode is Solid,
|
||||
-- Returns TRUE if the buffer is allocated and enabled for drawing.
|
||||
|
||||
OpenColorBuffer (
|
||||
me : mutable;
|
||||
aRetainBuffer : Integer;
|
||||
aPivotX : ShortReal = 0.0;
|
||||
aPivotY : ShortReal = 0.0;
|
||||
aWidthIndex : Integer = 0;
|
||||
aColorIndex : Integer = 0;
|
||||
aFontIndex : Integer = 0;
|
||||
aDrawMode : TypeOfDrawMode = Aspect_TODM_REPLACE
|
||||
)
|
||||
returns Boolean;
|
||||
---Purpose: Allocate the retain buffer <aRetainBuffer> ,
|
||||
-- Defines the DWU coordinates of the pivot point for all primitives
|
||||
-- contains inside.
|
||||
-- Defines the buffer color and font index :
|
||||
-- the default color is the highlight color of the colormap.
|
||||
-- the default font is the default system font of the fontmap.
|
||||
-- the default line type,
|
||||
-- the default line width,
|
||||
-- the default polygon fill mode,
|
||||
-- Returns TRUE if the buffer is allocated and enabled for drawing.
|
||||
|
||||
|
||||
CloseBuffer (
|
||||
me ;
|
||||
aRetainBuffer: Integer
|
||||
)
|
||||
---Purpose: Clear & Deallocate the retain buffer <aRetainBuffer>.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
ClearBuffer (
|
||||
me;
|
||||
aRetainBuffer: Integer
|
||||
)
|
||||
---Purpose: Erase & Clear ALL primitives retains in the buffer <aRetainBuffer>.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
DrawBuffer ( me; aRetainBuffer : Integer )
|
||||
---Purpose: Draw ALL primitives retains in the buffer <aRetainBuffer>.
|
||||
-- Warning: Note that the aspect of a retain buffer drawing is
|
||||
-- mono-colored with the current buffer Attributes and
|
||||
-- Depending of the DoubleBuffer state flag at the BeginDraw() buffer time,
|
||||
-- when DB is TRUE,an XOR method is use for drawing and erasing buffers in the
|
||||
-- same way.In this case,some color side effect can occurs depending of the
|
||||
-- traversal primitive colors and the supported hardware.
|
||||
-- when DB is FALSE and the background drawing has been generated with
|
||||
-- DB at TRUE,no color side effect occurs because the DB is used for restoring
|
||||
-- the drawing context at EraseBuffer() time,this is more powerfull for the
|
||||
-- drawing quality excepted for large buffers (flicking) .
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
EraseBuffer ( me; aRetainBuffer : Integer )
|
||||
---Purpose: Erase ALL primitives retains in the buffer <aRetainBuffer>.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
MoveBuffer (
|
||||
me;
|
||||
aRetainBuffer : Integer;
|
||||
aPivotX : ShortReal = 0.0;
|
||||
aPivotY : ShortReal = 0.0
|
||||
)
|
||||
---Purpose: Erase , Translate and reDraw ALL primitives retains in the buffer
|
||||
-- <aRetainBuffer>.
|
||||
-- <aPivotX,aPivotY> are the new DWU attached point absolute coordinates
|
||||
-- of the buffer pivot point.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
ScaleBuffer (
|
||||
me;
|
||||
aRetainBuffer : Integer;
|
||||
aScaleX : Factor = 1.0;
|
||||
aScaleY : Factor = 1.0
|
||||
)
|
||||
---Purpose: Erase , Scale the buffer from the Pivot point and reDraw ALL primitives
|
||||
-- retains in the buffer <aRetainBuffer>.
|
||||
-- <aScaleX,aScaleY> are the absolute scale factors apply on the two axis.
|
||||
-- Warning: Note that the scalling of some primitives can provided some bad
|
||||
-- smoothing side effect (i.e: Circles,...)
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened or
|
||||
--one of <aScale> factor is <= 0.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
RotateBuffer (
|
||||
me;
|
||||
aRetainBuffer : Integer;
|
||||
anAngle : PlaneAngle = 0.0
|
||||
)
|
||||
---Purpose: Erase , Rotate the buffer from the Pivot point and reDraw ALL primitives
|
||||
-- retains in the buffer <aRetainBuffer>.
|
||||
-- <anAngle> is the absolute counter-clockwise rotation angle from the
|
||||
-- Horizontal axis.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
|
||||
----------------------------
|
||||
-- Category: Inquire methods
|
||||
----------------------------
|
||||
|
||||
WorkSpace ( me; Width, Heigth : out Length from Quantity ) is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Available WorkSpace in DWU coordinates
|
||||
|
||||
Convert ( me; PV : Integer from Standard )
|
||||
returns Length from Quantity is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DWU value depending of
|
||||
-- the PIXEL value.
|
||||
|
||||
Convert ( me; DV : Length from Quantity )
|
||||
returns Integer from Standard is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL value depending of
|
||||
-- the DWU value.
|
||||
|
||||
Convert (
|
||||
me;
|
||||
PX, PY : Integer from Standard;
|
||||
DX, DY : out Length from Quantity
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the DWU position depending of
|
||||
-- the PIXEL position .
|
||||
|
||||
Convert (
|
||||
me;
|
||||
DX, DY : Length from Quantity;
|
||||
PX, PY : out Integer from Standard
|
||||
)
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the PIXEL position depending of
|
||||
-- the DWU position .
|
||||
|
||||
ProcessColorIndex( me; ColorIndex : Integer) returns Integer from Standard is private;
|
||||
|
||||
ProcessWidthIndex( me; WidthIndex : Integer) returns Length from Quantity is private;
|
||||
|
||||
ProcessTypeIndex ( me; TypeIndex : Integer) returns Integer from Standard is private;
|
||||
|
||||
BufferIsOpen ( me; aRetainBuffer : Integer )
|
||||
returns Boolean is virtual;
|
||||
---Purpose: Returns TRUE if the retain buffer <aRetainBuffer> is enabled
|
||||
--for drawing.
|
||||
|
||||
BufferIsEmpty ( me; aRetainBuffer : Integer )
|
||||
returns Boolean is virtual;
|
||||
---Purpose: Returns TRUE if the retain buffer has not been opened or empty.
|
||||
--- Returns FALSE if a lot of primitives have been stored inside
|
||||
-- because a BeginDraw(..,<aRetainBuffer>) has been done previously.
|
||||
|
||||
BufferIsDrawn ( me; aRetainBuffer : Integer )
|
||||
returns Boolean is virtual;
|
||||
---Purpose: Returns TRUE if the retain buffer s actually displayed at screen.
|
||||
|
||||
AngleOfBuffer ( me; aRetainBuffer : Integer; anAngle: out PlaneAngle )
|
||||
---Purpose: Returns the current buffer rotate angle from the X axis.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
ScaleOfBuffer ( me; aRetainBuffer : Integer; aScaleX,aScaleY : out Factor )
|
||||
---Purpose: Returns the current buffer scale factors.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
PositionOfBuffer (
|
||||
me;
|
||||
aRetainBuffer : Integer;
|
||||
aPivotX, aPivotY : out ShortReal
|
||||
)
|
||||
---Purpose: Returns the current buffer position.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Trigger: Raises if the retain buffer is not opened.
|
||||
-- call BufferIsOpen() method before.
|
||||
|
||||
TextSize (
|
||||
me;
|
||||
aText : ExtendedString from TCollection;
|
||||
aWidth, aHeight : out ShortReal from Standard;
|
||||
aFontIndex : Integer from Standard = -1
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Returns the TEXT size in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
-- Trigger: Raises if font is not defined.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Category: Inquire methods
|
||||
|
||||
TextSize (
|
||||
me;
|
||||
aText : ExtendedString from TCollection;
|
||||
aWidth, aHeight, anXoffset, anYoffset : out ShortReal from Standard;
|
||||
aFontIndex: Integer from Standard = -1)
|
||||
---Level: Public
|
||||
---Purpose: Returns the TEXT size and offsets
|
||||
-- in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
-- Trigger: Raises if font is not defined.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Category: Inquire methods
|
||||
|
||||
TextSize (
|
||||
me;
|
||||
aText : CString from Standard;
|
||||
aWidth, aHeight,
|
||||
anXoffset, anYoffset : out ShortReal from Standard;
|
||||
aFontIndex : Integer from Standard = -1
|
||||
)
|
||||
---Level: Public
|
||||
---Purpose: Returns the TEXT size in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
-- Trigger: Raises if font is not defined.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Category: Inquire methods
|
||||
|
||||
FontSize (
|
||||
me;
|
||||
aSlant : out PlaneAngle from Quantity;
|
||||
aSize,aBheight : out ShortReal from Standard;
|
||||
aFontIndex : Integer from Standard = -1
|
||||
)
|
||||
returns CString from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the font string,slant,size and
|
||||
-- baseline height in DWU space depending
|
||||
-- of the required FontIndex if aFontIndex is >= 0
|
||||
-- or the current FontIndex if < 0 (default).
|
||||
-- Trigger: Raises if font is not defined.
|
||||
raises DriverError from Aspect is virtual;
|
||||
---Category: Inquire methods
|
||||
|
||||
ColorBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual color indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalColorIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the local colormap hardware index from a virtual driver color
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
FontBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual font indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalFontIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the associated fontmap hardware index from a virtual driver font
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
TypeBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual type indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalTypeIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the associated typemap hardware index from a virtual driver type
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
WidthBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual width indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalWidthIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the associated widthmap hardware index from a virtual driver width
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
MarkBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard)
|
||||
is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the min and max driver virtual marker indexs.
|
||||
---Category: Inquire methods
|
||||
|
||||
LocalMarkIndex(me; anIndex : Integer from Standard)
|
||||
returns Integer from Standard is redefined;
|
||||
---Level: Advanced
|
||||
---Purpose:
|
||||
-- Returns the local markmap hardware index from a virtual driver marker
|
||||
-- index or returns -1 if the index is not defined.
|
||||
---Category: Inquire methods
|
||||
|
||||
TextManager (me: mutable)
|
||||
returns TextManager from WNT;
|
||||
---C++: return const &
|
||||
---Category: Inquire methods
|
||||
|
||||
MFT_Font (me: mutable; anIndex: Integer)
|
||||
returns FontManager from MFT;
|
||||
---C++: return const &
|
||||
---Category: Inquire methods
|
||||
|
||||
MFT_Size (me: mutable; anIndex: Integer)
|
||||
returns ShortReal;
|
||||
---Category: Inquire methods
|
||||
|
||||
fields
|
||||
|
||||
myAllocators,
|
||||
myAllocator : Address from Standard;
|
||||
myWNTWindow : Window from WNT;
|
||||
myPixelToUnit : Real from Standard;
|
||||
|
||||
myColors : HColorTable from WNT;
|
||||
myFonts : HFontTable from WNT;
|
||||
myTypeIdxs : HArray1OfInteger from TColStd;
|
||||
myWidthIdxs : HArray1OfInteger from TColStd;
|
||||
myMarkerIdxs : HArray1OfInteger from TColStd;
|
||||
|
||||
myMFTFonts : HListOfMFTFonts from WNT;
|
||||
myMFTSizes : HArray1OfShortReal from TShort;
|
||||
myTextManager : TextManager from WNT;
|
||||
|
||||
end WDriver;
|
2180
src/WNT/WNT_WDriver.cxx
Executable file
2180
src/WNT/WNT_WDriver.cxx
Executable file
File diff suppressed because it is too large
Load Diff
21
src/WNT/WNT_WOKSteps.edl
Executable file
21
src/WNT/WNT_WOKSteps.edl
Executable file
@@ -0,0 +1,21 @@
|
||||
-- File: WNT_WOKSteps.edl
|
||||
-- Author: Jean GAUTIER
|
||||
-- History: Tue Aug 12 17:21:24 1997 Jean GAUTIER Creation
|
||||
-- Copyright: Matra Datavision 1997
|
||||
|
||||
@ifnotdefined ( %WNT_WOKSteps_EDL) then
|
||||
@set %WNT_WOKSteps_EDL = "";
|
||||
|
||||
@if ( %Station != "wnt" ) then
|
||||
|
||||
@set %WOKSteps_ObjGroup = "obj.nocompil";
|
||||
@set %WOKSteps_LibGroup = "";
|
||||
|
||||
@set %WOKSteps_obj_nocompil = "WOKStep_Compile";
|
||||
|
||||
@set %WOKSteps_toolkit_ListWith = "obj.nocompil";
|
||||
@set %WOKSteps_toolkit_LinksWith = "obj.nocompil";
|
||||
|
||||
@endif;
|
||||
|
||||
@endif;
|
58
src/WNT/WNT_WOKUMake.edl
Executable file
58
src/WNT/WNT_WOKUMake.edl
Executable file
@@ -0,0 +1,58 @@
|
||||
--
|
||||
-- File: WNT_WOKUMake.edl
|
||||
-- Author: Jean GAUTIER
|
||||
-- History: Thu Oct 3 13:12:20 1996 Jean GAUTIER Creation
|
||||
-- Copyright: Matra Datavision 1996
|
||||
--
|
||||
|
||||
@ifnotdefined ( %WNT_WOKUMake_EDL) then
|
||||
|
||||
@set %WNT_WOKUMake_EDL = "";
|
||||
|
||||
@uses "WNT.edl";
|
||||
|
||||
@if ( %Station == "sun" ) then
|
||||
-- Pas de WNT sur SUN
|
||||
@set %WOKUMake_Steps = "";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps "*src ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.fill(src) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.src(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.header(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps ".xcpp.template(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " obj.inc(src,xcpp.src) ";
|
||||
@endif;
|
||||
|
||||
@if ( %Station == "sil" ) then
|
||||
-- Pas de WNT sur SGI
|
||||
@set %WOKUMake_Steps = "";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps "*src ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.fill(src) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.src(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.header(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps ".xcpp.template(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " obj.inc(src,xcpp.src) ";
|
||||
@endif;
|
||||
|
||||
@if ( %Station == "ao1" ) then
|
||||
-- Pas de WNT sur DEC
|
||||
@set %WOKUMake_Steps = "";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps "*src ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.fill(src) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.src(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.header(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps ".xcpp.template(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " obj.inc(src,xcpp.src) ";
|
||||
@endif;
|
||||
|
||||
@if ( %Station == "hp" ) then
|
||||
-- Pas de WNT sur HP
|
||||
@set %WOKUMake_Steps = "";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps "*src ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.fill(src) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.src(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " xcpp.header(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps ".xcpp.template(xcpp.fill) ";
|
||||
@string %WOKUMake_Steps = %WOKUMake_Steps " obj.inc(src,xcpp.src) ";
|
||||
@endif;
|
||||
|
||||
@endif;
|
581
src/WNT/WNT_Window.cdl
Executable file
581
src/WNT/WNT_Window.cdl
Executable file
@@ -0,0 +1,581 @@
|
||||
-- File: WNT_Window.cdl
|
||||
-- Created: Fri Jan 26 13:07:39 1996
|
||||
-- Author: PLOTNIKOV Eugeny
|
||||
-- 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)
|
||||
---Copyright: Matra Datavision 1996
|
||||
|
||||
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 Aspect,
|
||||
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
|
||||
|
||||
raises
|
||||
|
||||
WindowDefinitionError 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;
|
||||
theClass : WClass from WNT;
|
||||
theStyle : Dword from WNT;
|
||||
thePxLeft : Integer from Standard;
|
||||
thePxTop : Integer from Standard;
|
||||
thePxWidth : Integer from Standard;
|
||||
thePxHeight : Integer from Standard;
|
||||
theBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY;
|
||||
theParent : Handle from Aspect = 0;
|
||||
theMenu : Handle from Aspect = 0;
|
||||
theClientStruct : Address from Standard = 0)
|
||||
returns mutable Window from WNT
|
||||
---Level: Public
|
||||
---Purpose: Creates a Window defined by his position and size
|
||||
-- in pixles from the Parent Window.
|
||||
-- Trigger: Raises WindowDefinitionError if the Position out of the
|
||||
-- Screen Space or the window creation failed.
|
||||
raises WindowDefinitionError from Aspect;
|
||||
|
||||
Create (
|
||||
aDevice : GraphicDevice from WNT;
|
||||
aHandle : Handle from Aspect;
|
||||
aBackColor : NameOfColor from Quantity = Quantity_NOC_MATRAGRAY
|
||||
)
|
||||
returns mutable Window from WNT;
|
||||
---Level: Public
|
||||
---Purpose: Creates a Window based on the existing window handle.
|
||||
-- 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
|
||||
)
|
||||
returns mutable Window from WNT;
|
||||
---Level: Public
|
||||
---Purpose: Creates a Window based on the existing window <aHandle>.
|
||||
|
||||
Destroy ( me : mutable )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Destroies the Window and all resourses attached to it.
|
||||
---C++: alias ~
|
||||
|
||||
|
||||
---------------------------------------------------
|
||||
-- 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
|
||||
---Purpose: Opens the window <me>.
|
||||
|
||||
Map ( me; aMapMode : Integer from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Opens a window <me> according to <aMapMode>.
|
||||
-- This method is specific to Windows NT.
|
||||
-- <aMapMode> can be one of SW_xxx constants defined
|
||||
-- in <windows.h>. See documentation.
|
||||
|
||||
Unmap ( me )
|
||||
is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Closes the window <me>.
|
||||
|
||||
DoResize ( me )
|
||||
returns TypeOfResize from Aspect
|
||||
---Level: Public
|
||||
---Purpose: Applies the resizing to the window <me>.
|
||||
raises WindowError from Aspect is virtual;
|
||||
|
||||
DoMapping ( me ) returns Boolean from Standard
|
||||
raises WindowError from Aspect is virtual;
|
||||
---Level: Advanced
|
||||
---Purpose: Apply the mapping change to the window <me>
|
||||
-- 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 )
|
||||
returns PixMap from Aspect
|
||||
---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
|
||||
---Purpose: Changes variables due to window position.
|
||||
|
||||
SetFlags ( me : mutable; aFlags : Integer from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Sets user defined flags in the extra window data area.
|
||||
-- Supported flags WDF_* are listed in InterfaceGraphic_WNT.hxx
|
||||
-- In particular, the window backround can be turned off using this method.
|
||||
|
||||
ResetFlags ( me : mutable; aFlags : Integer from Standard )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Reset specified flags in the extra window data area.
|
||||
-- Supported flags WDF_* are listed in InterfaceGraphic_WNT.hxx
|
||||
-- In particular, the window backround can be turned on using this method.
|
||||
|
||||
|
||||
----------------------------
|
||||
-- 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
|
||||
---Purpose: Returns True if the window <me> is opened
|
||||
-- and False if the window is closed.
|
||||
|
||||
Ratio ( me )
|
||||
returns Ratio from Quantity is virtual;
|
||||
---Level: Public
|
||||
---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;
|
||||
Y1 : out Integer from Standard;
|
||||
X2 : out Integer from Standard;
|
||||
Y2 : out Integer from Standard
|
||||
)
|
||||
is virtual;
|
||||
---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;
|
||||
Height : out Integer from Standard
|
||||
)
|
||||
is virtual;
|
||||
---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
|
||||
---Purpose: Returns the Windows NT handle of the created window <me>.
|
||||
---C++: inline
|
||||
|
||||
HParentWindow ( me )
|
||||
returns Handle from Aspect is static;
|
||||
---Level: Public
|
||||
---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;
|
||||
---Level: Private
|
||||
---Purpose: private method
|
||||
|
||||
fields
|
||||
|
||||
aXLeft : Integer from Standard is protected; -- Window coordinates
|
||||
aYTop : Integer from Standard is protected;
|
||||
aXRight : Integer from Standard is protected;
|
||||
aYBottom : Integer from Standard is protected;
|
||||
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 WDriver from WNT,
|
||||
class IconBox from WNT,
|
||||
class PixMap from WNT
|
||||
|
||||
end Window;
|
1244
src/WNT/WNT_Window.cxx
Executable file
1244
src/WNT/WNT_Window.cxx
Executable file
File diff suppressed because it is too large
Load Diff
38
src/WNT/WNT_Window.lxx
Executable file
38
src/WNT/WNT_Window.lxx
Executable file
@@ -0,0 +1,38 @@
|
||||
// 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;
|
||||
|
||||
} // end WNT_Window :: HWindow
|
||||
|
||||
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
|
14
src/WNT/WNT_WindowData.cxx
Executable file
14
src/WNT/WNT_WindowData.cxx
Executable file
@@ -0,0 +1,14 @@
|
||||
#ifndef __WNT_WindowData_HeaderFile
|
||||
# include <WNT_WindowData.hxx>
|
||||
#endif // __WNT_WindowData_HeaderFile
|
||||
|
||||
const Handle( Standard_Type )& STANDARD_TYPE( WNT_WindowData ) {
|
||||
|
||||
static Handle( Standard_Type ) _aType = new Standard_Type (
|
||||
"WNT_WindowData",
|
||||
sizeof ( WNT_WindowData )
|
||||
);
|
||||
|
||||
return _aType;
|
||||
|
||||
} // end function
|
32
src/WNT/WNT_WindowData.hxx
Executable file
32
src/WNT/WNT_WindowData.hxx
Executable file
@@ -0,0 +1,32 @@
|
||||
#ifndef __WNT_WindowData_HeaderFile
|
||||
# define __WNT_WindowData_HeaderFile
|
||||
|
||||
# ifndef __WINDOWS_H_INCLUDED
|
||||
# define __WINDOWS_H_INCLUDED
|
||||
# ifndef STRICT
|
||||
# define STRICT
|
||||
# endif // STRICT
|
||||
# include <windows.h>
|
||||
# include <windowsx.h>
|
||||
|
||||
# ifdef DrawText
|
||||
# undef DrawText
|
||||
# endif // DrawText
|
||||
|
||||
# ifdef THIS
|
||||
# undef THIS
|
||||
# endif // THIS
|
||||
# endif // __WINDOWS_H_INCLUDED
|
||||
|
||||
# ifndef __STANDARD_TYPE_HXX_INCLUDED
|
||||
# define __STANDARD_TYPE_HXX_INCLUDED
|
||||
# include <Standard_Type.hxx>
|
||||
# endif // __STANDARD_TYPE_HXX_INCLUDED
|
||||
|
||||
#include <InterfaceGraphic_WNT.hxx>
|
||||
|
||||
typedef WINDOW_DATA WNT_WindowData;
|
||||
|
||||
extern const Handle( Standard_Type )& STANDARD_TYPE( WNT_WindowData );
|
||||
|
||||
#endif // __WNT_WindowData_HeaderFile
|
67
src/WNT/WNT_WndProc.cxx
Executable file
67
src/WNT/WNT_WndProc.cxx
Executable file
@@ -0,0 +1,67 @@
|
||||
// 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