1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0023663: Removing 2D viewer library

Deleted TKV2d toolkit and CGM, MFT,FontMFT, PlotMgt, PS packages. Deleted 2d test cases.
Deleted WNT_WDriver and Xw_Driver, edited Aspect_Driver.
Deleted trailing spaces, removed WNT_FontMapEntry, WNT_FontTable, WNT_HFontTable
Deleting tests for 2D viewer
This commit is contained in:
aba
2013-01-25 18:11:16 +04:00
parent 474be6cde1
commit 128cc8df34
488 changed files with 119 additions and 99326 deletions

View File

@@ -11,7 +11,6 @@ WNT_ColorRef.hxx
WNT_Dword.hxx
WNT_LogFont.hxx
WNT_Long.hxx
WNT_MFTDraw.hxx
WNT_Uint.hxx
WNT.h
WNT_Bitmap.h
@@ -26,7 +25,6 @@ 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

View File

@@ -29,14 +29,12 @@ package WNT
Aspect,
Image,
PlotMgt,
Quantity,
TCollection,
TColStd,
TShort,
MMgt,
OSD,
MFT
OSD
is
@@ -49,9 +47,6 @@ package WNT
exception ClassDefinitionError inherits ConstructionError;
---Category: Exceptions
exception FontMapEntryDefinitionError inherits ConstructionError;
---Category: Exceptions
--------------------
-- Category: Classes
@@ -62,14 +57,6 @@ package WNT
---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
@@ -82,11 +69,6 @@ package WNT
---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
@@ -99,11 +81,6 @@ package WNT
---Purpose: Defines the class
---Category: Classes
class TextManager;
---Purpose: Defines the class for text drawing with MFT
---Category: Classes
---------------------------
-- Category: Enumerations
---------------------------
@@ -170,25 +147,7 @@ package 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;

View File

@@ -1,580 +0,0 @@
-- Created on: 1997-03-17
-- Created by: EugenyPLOTNIKOV
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
-- Modified: MAR-98, MAY-98 (DCB)
-- OCT-98 (DCB) - see CXX file for details
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;

File diff suppressed because it is too large Load Diff

View File

@@ -1,143 +0,0 @@
-- Created on: 1996-01-29
-- Created by: PLOTNIKOV Eugeny
-- Copyright (c) 1996-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class 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;

View File

@@ -1,181 +0,0 @@
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <WNT_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 )
{
Standard_Size i;
char* p;
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

View File

@@ -1,58 +0,0 @@
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
inline 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

View File

@@ -173,7 +173,6 @@ class ImageManager from WNT inherits TShared from MMgt
friends
class WDriver from WNT,
class Window from WNT
end ImageManager;

View File

@@ -1,242 +0,0 @@
// Created by: CHABROVSKY Dmitry
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#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

View File

@@ -1,56 +0,0 @@
// Created by: CHABROVSKY Dmitry
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#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

View File

@@ -1,135 +0,0 @@
-- Created by: CHABROVSKY Dmitry
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
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;

View File

@@ -1,281 +0,0 @@
// Created by: CHABROVSKY Dmitry
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
// 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;
}

View File

@@ -1,976 +0,0 @@
-- Created on: 1996-01-25
-- Created by: s: LAVNIKOV Alexey & PLOTNIKOV Eugeny
-- Copyright (c) 1996-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
class 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;

File diff suppressed because it is too large Load Diff

View File

@@ -590,7 +590,6 @@ class Window from WNT inherits Window from Aspect
friends
class WDriver from WNT,
class IconBox from WNT
end Window;