![]() |
|
![]() |
--|
--| There are two general types of routines in this package. One set of routines
--| is used during the creating of the output report. That output can either be
--| directly sent to an HWnd or it can be logged to a special type of file with
--| a .GDL extension. That file can later be used to bring the output report
--| back up for viewing or printing. The second set of routines deals with
--| handling those already existing files.
--|
Arial : constant string := "Arial";
Bookman_Old_Style : constant string := "Courier";
Comic_Sans_MS : constant string := "Comic Sans MS";
Courier : constant string := "Courier";
Courier_New : constant string := "Courier New";
Garamond : constant string := "Garamond";
Impact : constant string := "Impact";
MS_Sans_Serif : constant string := "MS Sans Serif";
Tahoma : constant string := "Tahoma";
Times_New_Roman : constant string := "Times New Roman";
DeviceNoError : constant := 0;
DeviceInvalidFont : constant := 1; -- invalid font requested
DeviceCancel : constant := 2; -- user canceled print job
DeviceNoDefault : constant := 3; -- no default printer defined for PC
DeviceAlreadyOpen : constant := 4; -- there is already a device open
DeviceInvalidLog : constant := 5; -- file is not a valid log
DeviceLogError : constant := 6; -- error writing or reading log file
DeviceOldLogVersion : constant := 7; -- version of the log is old or invalid
DeviceInvalidRequest : constant := 8; -- requested item out of range, etc.
DeviceInvalidPaper : constant := 9; -- requested paper structure was not filled
-- Line Thickness constants
UltraThinLine : constant := 0.0;
ThinLine : constant := 0.0125;
UltraFineLine : constant := 0.025;
FineLine : constant := 0.0375;
ThinMediumLine : constant := 0.05;
MediumLine : constant := 0.0625;
ThickMediumLine : constant := 0.075;
ThickLine : constant := 0.0875;
UltraThickLine : constant := 0.1;
LargeLine : constant := 0.1125;
UltraLargeLine : constant := 0.125;
subtype ColorType is ModSys.S_Natural;
-- color constants
DarkBlue : constant ColorType := 8_388_608; -- RGB(0,0,128) Low Intensity Blue
DarkGreen : constant ColorType := 32_768; -- RGB(0,128,0) Low Intensity Green
DarkRed : constant ColorType := 128; -- RGB(128,0,0) Low Intensity Red
DarkCyan : constant ColorType := 8_421_376; -- RGB(0,128,128) Low Intensity Cyan
DarkMagenta : constant ColorType := 8_388_736; -- RGB(128,0,128) Low Intensity Magenta
DarkYellow : constant ColorType := 32_896; -- RGB(128,128,0) Low Intensity Yellow
DarkGray : constant ColorType := 8_421_504; -- RGB(128,128,128) High Intensity Black
Black : constant ColorType := 0; -- RGB(0,0,0) Low Intensity Black
Gray : constant ColorType := 12_632_256; -- RGB(192,192,192) Low Intensity White
Blue : constant ColorType := 16_711_680; -- RGB(0,0,255) High Intensity Blue
Green : constant ColorType := 65_280; -- RGB(0,255,0) High Intensity Green
Red : constant ColorType := 255; -- RGB(255,0,0) High Intensity Red
Cyan : constant ColorType := 16_776_960; -- RGB(0,255,255) High Intensity Cyan
Magenta : constant ColorType := 16_711_935; -- RGB(255,0,255) High Intensity Magenta
Yellow : constant ColorType := 65_535; -- RGB(255,255,0) High Intensity Yellow
White : constant ColorType := 16_777_215; -- RGB(255,255,255) High Intensity White
Default : constant ColorType := ModSys.S_Natural'last;
-- pen styles
SolidPen : constant := 0;
DashPen : constant := 1;
DotPen : constant := 2;
DashDotPen : constant := 3;
DashDotDotPen : constant := 4;
NoPen : constant := 5;
InsideFramePen : constant := 6;
-- brush styles
SolidBrush : constant := 0;
HollowBrush : constant := 1;
HatchedBrush : constant := 2;
-- brush hatch kinds
HorzHatch : constant := 0;
VertHatch : constant := 1;
FDiagonalHatch : constant := 2;
BDiagonalHatch : constant := 3;
CrossHatch : constant := 4;
DiagonalCrossHatch : constant := 5;
FDiagonal1Hatch : constant := 6;
BDiagonal1Hatch : constant := 7;
SolidHatch : constant := 8;
Dense1Hatch : constant := 9;
Dense2Hatch : constant := 10;
Dense3Hatch : constant := 11;
Dense4Hatch : constant := 12;
Dense5Hatch : constant := 13;
Dense6Hatch : constant := 14;
Dense7Hatch : constant := 15;
Dense8Hatch : constant := 16;
NoShadeHatch : constant := 17;
HalfToneHatch : constant := 18;
SolidClrHatch : constant := 19;
DitheredColorHatch : constant := 20;
SolidTextColorHatch : constant := 21;
DitheredTextColorHatch : constant := 22;
SolidBkColorHatch : constant := 23;
DitheredBkColorHatch : constant := 24;
Api_MaxHatch : constant := 25;
type OrientationType is (Portrait,
Landscape);
type VertJustifyType is (TopJustify,
VertCenterJustify,
BottomJustify);
type HorzJustifyType is (LeftJustify,
HorzCenterJustify,
RightJustify);
subtype LineThicknessType is ModSys.S_Float;
type FontFormatType is (Normal,
Bold,
Underline,
BoldUnderline,
Italics,
BoldItalic,
UnderlineItalic,
BoldUnderlineItalic,
Outline,
BoldOutline,
ItalicOutline,
BoldItalicOutline);
type RectType is record
Left : ModSys.S_Natural := 0;
Right : ModSys.S_Natural := 0;
Top : ModSys.S_Natural := 0;
Bottom : ModSys.S_Natural := 0;
end record;
for RectType use record
Left at 0 range 0 .. ModSys.S_Natural_Size - 1;
Right at 4 range 0 .. ModSys.S_Natural_Size - 1;
Top at 8 range 0 .. ModSys.S_Natural_Size - 1;
Bottom at 12 range 0 .. ModSys.S_Natural_Size - 1;
end record;
type PointType is record
XVal : ModSys.S_Natural := 0;
YVal : ModSys.S_Natural := 0;
end record;
for PointType use record
XVal at 0 range 0 .. ModSys.S_Natural_Size - 1;
YVal at 4 range 0 .. ModSys.S_Natural_Size - 1;
end record;
type SizeType is record
width : ModSys.S_Natural := 0;
height : ModSys.S_Natural := 0;
end record;
for SizeType use record
width at 0 range 0 .. ModSys.S_Natural_Size - 1;
height at 4 range 0 .. ModSys.S_Natural_Size - 1;
end record;
type PrintInfoType is record
PrinterOpen : boolean := False; -- printer has been opened
pageSize : SizeType; -- width and height of full page area
PrintableOffset : SizeType; -- offset of printable area from full page edge
PrintableRect : RectType; -- rectangle of printable area
MarginRect : RectType; -- rect of printable area minus margins
XPixelsPerInch : ModSys.S_Integer := 0; -- # of horz. pixels per inch
YPixelsPerInch : ModSys.S_Integer := 0; -- # of vert. pixels per inch
CurrentPageCount : ModSys.S_Natural := 0; -- current page count
HorzJustify : HorzJustifyType; -- horz text justification
VertJustify : VertJustifyType; -- vert text justification
AvgCharWidth : ModSys.S_Integer := 0; -- average character width for font
CharHeight : ModSys.S_Integer := 0; -- character height for font
FontSize : ModSys.S_Integer := 0; -- font size
FontFormat : FontFormatType; -- font format
CharsPerLine : ModSys.S_Integer := 0; -- # characters per line (only valid with fixed font)
LinesPerPage : ModSys.S_Integer := 0; -- # lines per page (only valid with fixed font)
FixedFont : boolean := False; -- font is a fixed font
FontName : string (1 .. 32) := (others => ASCIIX.nul); -- font name
Orientation : OrientationType := Portrait; -- Orientation of output
end record;
for PrintInfoType use record
PrinterOpen at 0 range 0 .. ModSys.Boolean_Size - 1;
pageSize at 1 range 0 .. 63;
PrintableOffset at 9 range 0 .. 63;
PrintableRect at 17 range 0 .. 127;
MarginRect at 33 range 0 .. 127;
XPixelsPerInch at 49 range 0 .. ModSys.S_Integer_Size - 1;
YPixelsPerInch at 53 range 0 .. ModSys.S_Integer_Size - 1;
CurrentPageCount at 57 range 0 .. ModSys.S_Natural_Size - 1;
HorzJustify at 61 range 0 .. HorzJustifyType'size - 1;
VertJustify at 62 range 0 .. VertJustifyType'size - 1;
AvgCharWidth at 63 range 0 .. ModSys.S_Integer_Size - 1;
CharHeight at 67 range 0 .. ModSys.S_Integer_Size - 1;
FontSize at 71 range 0 .. ModSys.S_Integer_Size - 1;
FontFormat at 75 range 0 .. FontFormatType'size - 1;
CharsPerLine at 76 range 0 .. ModSys.S_Integer_Size - 1;
LinesPerPage at 80 range 0 .. ModSys.S_Integer_Size - 1;
FixedFont at 84 range 0 .. ModSys.Boolean_Size - 1;
FontName at 85 range 0 .. 255;
Orientation at 117 range 0 .. OrientationType'size - 1;
end record;
type StandardPrintType is record
ShowPrintDialog : boolean := True;
PrinterDialogTitle : string (1 .. 100) := (others => ASCIIX.nul); --| Title line of Printer dialog box
ShowPrintSelected : boolean := False; --| Show the Print Selected radio button
ShowPrintPageNums : boolean := True; --| Show the Print Page Nums radio button
MarkAllPages : boolean := True; --| Select the print all button
MarkSelectedPages : boolean := False; --| Select the print selected button
MarkPageNums : boolean := False; --| Select the print pages button
StartingPageNum : ModSys.S_Natural := 1; --| Starting page num to show
EndingPageNum : ModSys.S_Natural := 32_767; --| Ending page num to show
MinPageNum : ModSys.S_Natural := 1; --| Min page number to allow
MaxPageNum : ModSys.S_Natural := 32_767; --| Max page number to allow
ShowPrintToFile : boolean := True; --| Show the Print to file check box
ShowPrintProgress : boolean := True; --| While printing show a progress dialog
UserPrinted : boolean := False; --| Was printing completed?
RangePrinted : boolean := False; --| Did user select to print a range?
RangeStart : ModSys.S_Natural := 0; --| Starting page of range print.
RangeEnd : ModSys.S_Natural := 0; --| Ending page of range print.
end record;
for StandardPrintType use record
ShowPrintDialog at 0 range 0 .. ModSys.Boolean_Size - 1;
PrinterDialogTitle at 1 range 0 .. 799;
ShowPrintSelected at 101 range 0 .. ModSys.Boolean_Size - 1;
ShowPrintPageNums at 102 range 0 .. ModSys.Boolean_Size - 1;
MarkAllPages at 103 range 0 .. ModSys.Boolean_Size - 1;
MarkSelectedPages at 104 range 0 .. ModSys.Boolean_Size - 1;
MarkPageNums at 105 range 0 .. ModSys.Boolean_Size - 1;
StartingPageNum at 106 range 0 .. ModSys.S_Natural_Size - 1;
EndingPageNum at 110 range 0 .. ModSys.S_Natural_Size - 1;
MinPageNum at 114 range 0 .. ModSys.S_Natural_Size - 1;
MaxPageNum at 118 range 0 .. ModSys.S_Natural_Size - 1;
ShowPrintToFile at 122 range 0 .. ModSys.Boolean_Size - 1;
ShowPrintProgress at 123 range 0 .. ModSys.Boolean_Size - 1;
UserPrinted at 124 range 0 .. ModSys.Boolean_Size - 1;
RangePrinted at 125 range 0 .. ModSys.Boolean_Size - 1;
RangeStart at 126 range 0 .. ModSys.S_Natural_Size - 1;
RangeEnd at 130 range 0 .. ModSys.S_Natural_Size - 1;
end record;
StandardPrint_Size : constant := 134 * 8;
type ViewRecordType is record
LogFile : SageSpec.LongPathType := (others => ASCIIX.nul); -- Name of log file. Must end in .GDL
StartPage : ModSys.S_Natural := 0; -- Page to start on
Title : string (1 .. 100) := (others => ASCIIX.nul); -- Title to show on window
ShowTitle : boolean := True; -- Show the title bar?
ShowMinMax : boolean := True; -- Show the min and max buttons?
ShowSystemMenu : boolean := False; -- Show the system menu (upper left)?
ShowMenu : boolean := True; -- Show the menu?
ShowOpenFile : boolean := True; -- Show an Open File menu option?
ShowToolbar : boolean := True; -- Show a toolbar?
ZoomPercent : ModSys.S_Natural := 100; -- Zoom setting 100 = 1x, 110 = 1.1x (zoom in), 75 = .75x (zoom out)
SkipFactor : ModSys.S_Natural := 10; -- Number of records to move when using skip buttons.
BackgroundBmp : string (1 .. 256) := (others => ASCIIX.nul); -- Name of BMP to show in background.
WindowLoc : PointType; -- Window starting location - Upper left
XSize : ModSys.S_Natural := 0; -- X size of the window
YSize : ModSys.S_Natural := 0; -- Y size of the window
Sizeable : boolean := True; -- Is window sizeable
StandardPrint : StandardPrintType; -- standard list of printer settings.
CurrentHwnd : WinSys.Hwnd := ModSys.Null_Address; -- Hwnd of the current window to bring back to top
end record;
for ViewRecordType use record
LogFile at 0 range 0 .. SageSpec.LongPath_Size - 1;
StartPage at 257 range 0 .. ModSys.S_Natural_Size - 1;
Title at 261 range 0 .. 799;
ShowTitle at 361 range 0 .. ModSys.Boolean_Size - 1;
ShowMinMax at 362 range 0 .. ModSys.Boolean_Size - 1;
ShowSystemMenu at 363 range 0 .. ModSys.Boolean_Size - 1;
ShowMenu at 364 range 0 .. ModSys.Boolean_Size - 1;
ShowOpenFile at 365 range 0 .. ModSys.Boolean_Size - 1;
ShowToolbar at 366 range 0 .. ModSys.Boolean_Size - 1;
ZoomPercent at 367 range 0 .. ModSys.S_Natural_Size - 1;
SkipFactor at 371 range 0 .. ModSys.S_Natural_Size - 1;
BackgroundBmp at 375 range 0 .. 2_047;
WindowLoc at 631 range 0 .. 63;
XSize at 639 range 0 .. ModSys.S_Natural_Size - 1;
YSize at 643 range 0 .. ModSys.S_Natural_Size - 1;
Sizeable at 647 range 0 .. ModSys.Boolean_Size - 1;
StandardPrint at 648 range 0 .. StandardPrint_Size - 1;
CurrentHwnd at 782 range 0 .. WinSys.Hwnd_Size - 1;
end record;
type PrintRecordType is record
LogFile : SageSpec.LongPathType := (others => ASCIIX.nul);
StandardPrint : StandardPrintType; -- standard list of printer settings.
end record;
for PrintRecordType use record
LogFile at 0 range 0 .. SageSpec.LongPath_Size - 1;
StandardPrint at 257 range 0 .. StandardPrint_Size - 1;
end record;
type PaintRecordType is record
LogFile : SageSpec.LongPathType := (others => ASCIIX.nul);
Hwnd : WinSys.Hwnd := ModSys.Null_Address;
MinPageNum : ModSys.S_Natural := 1;
MaxPageNum : ModSys.S_Natural := 1;
ZoomFactor : ModSys.S_Float := 1.0;
XShift : ModSys.S_Integer := 0;
YShift : ModSys.S_Integer := 0;
PaintRect : RectType := (others => 0);
end record;
for PaintRecordType use record
LogFile at 0 range 0 .. SageSpec.LongPath_Size - 1;
Hwnd at 257 range 0 .. WinSys.Hwnd_Size - 1;
MinPageNum at 261 range 0 .. ModSys.S_Natural_Size - 1;
MaxPageNum at 265 range 0 .. ModSys.S_Natural_Size - 1;
ZoomFactor at 269 range 0 .. ModSys.S_Float_Size - 1;
XShift at 273 range 0 .. ModSys.S_Integer_Size - 1;
YShift at 277 range 0 .. ModSys.S_Integer_Size - 1;
PaintRect at 281 range 0 .. 127;
end record;
type StatsRecordType is record
DevicePageXWidth : ModSys.S_Natural := 0; -- Full X width device is capable of
DevicePageYWidth : ModSys.S_Natural := 0; -- Full Y width device is capable of
DevicePrintableXOffset : ModSys.S_Natural := 0; -- Offset of printable area from page edge
DevicePrintableYOffset : ModSys.S_Natural := 0; -- Offset of printable area from page edge
DevicePrintableXWidth : ModSys.S_Natural := 0; -- Printable area X width of device
DevicePrintableYWidth : ModSys.S_Natural := 0; -- Printable area Y width of device
DeviceXRes : ModSys.S_Natural := 0; -- Pixels per inch in X device is capable of
DeviceYRes : ModSys.S_Natural := 0; -- Pixels per inch in Y device is capable of
DeviceTopMargin : ModSys.S_Natural := 0; -- Pixels used for top margin
DeviceBottomMargin : ModSys.S_Natural := 0; -- Pixels used for bottom margin
DeviceLeftMargin : ModSys.S_Natural := 0; -- Pixels used for left margin
DeviceRightMargin : ModSys.S_Natural := 0; -- Pixels used for right margin
NumPages : ModSys.S_Natural := 0; -- Number of pages in log
Orientation : OrientationType := Portrait; -- Orientation of output
end record;
for StatsRecordType use record
DevicePageXWidth at 0 range 0 .. ModSys.S_Natural_Size - 1;
DevicePageYWidth at 4 range 0 .. ModSys.S_Natural_Size - 1;
DevicePrintableXOffset at 8 range 0 .. ModSys.S_Natural_Size - 1;
DevicePrintableYOffset at 12 range 0 .. ModSys.S_Natural_Size - 1;
DevicePrintableXWidth at 16 range 0 .. ModSys.S_Natural_Size - 1;
DevicePrintableYWidth at 20 range 0 .. ModSys.S_Natural_Size - 1;
DeviceXRes at 24 range 0 .. ModSys.S_Natural_Size - 1;
DeviceYRes at 28 range 0 .. ModSys.S_Natural_Size - 1;
DeviceTopMargin at 32 range 0 .. ModSys.S_Natural_Size - 1;
DeviceBottomMargin at 36 range 0 .. ModSys.S_Natural_Size - 1;
DeviceLeftMargin at 40 range 0 .. ModSys.S_Natural_Size - 1;
DeviceRightMargin at 44 range 0 .. ModSys.S_Natural_Size - 1;
NumPages at 48 range 0 .. ModSys.S_Natural_Size - 1;
Orientation at 52 range 0 .. OrientationType'size - 1;
end record;
--|
--| Use of Paper, PaperWidth and PaperHeight fields:
--| Paper - a unique type that represents a paper size. This can be set from
--| the types listed in the WinSys.WinGdi spec (i.e. DMPAPER_LETTER) or can be found in
--| the PaperData structure returned from either the GetDefaultPaperData or
--| GetTypePaperData routines. PaperWidth - is the inch measurement of a custom
--| size you are setting. PaperHeight - is the inch measurement of a custom height
--| you are setting.
--|
--| if PaperNumber is <> WinSys.WinGdi.DMPAPER_FIRST and <> WinSys.WinGdi.DMPAPER_USER then PaperWidth
--| and PaperHeight are ignored. It is assumed that you are setting a valued PaperNumber.
--|
--| if PaperNumber is WinSys.WinGdi.DMPAPER_FIRST and PaperWidth = 0 and PaperHeight = 0 then
--| you are telling the printer to just use whatever is the default paper set for it.
--|
--| if Paper is WinSys.WinGdi.DMPAPER_USER and PaperWidth > 0.0 and PaperHeight > 0.0 then the
--| assumption is that you are trying to set a custom paper size. That value
--| will be passed on the the printer as the size to use.
--|
type PrintSettingsRecordType is record
StandardPrint : StandardPrintType; -- standard list of printer settings.
Paper : ModSys.S_Natural := WinSys.DMPAPER_LETTER; -- Paper type to use. Use WinSys.WinGdi.DMPAPER_FIRST to default.
PaperWidth : ModSys.S_Float := 0.0; -- Width of custom paper size in inches
PaperHeight : ModSys.S_Float := 0.0; -- Height of custom paper size in inches
Orientation : OrientationType; -- Orientation of output
end record;
for PrintSettingsRecordType use record
StandardPrint at 0 range 0 .. StandardPrint_Size - 1;
Paper at 134 range 0 .. ModSys.S_Natural_Size - 1;
PaperWidth at 138 range 0 .. ModSys.S_Float_Size - 1;
PaperHeight at 142 range 0 .. ModSys.S_Float_Size - 1;
Orientation at 146 range 0 .. OrientationType'size - 1;
end record;
type PaperRecordType is record
PaperName : string (1 .. 64) := (others => ASCIIX.nul); -- Name used for this paper size
Paper : ModSys.S_Natural := WinSys.DMPAPER_FIRST; -- Type used to represent papers, see list of WinSys.WinGdi.DMPAPER_ values
width : ModSys.S_Float; -- Width in inches of this paper
Length : ModSys.S_Float; -- Length in inches of this paper
end record;
for PaperRecordType use record
PaperName at 0 range 0 .. 511;
Paper at 64 range 0 .. ModSys.S_Natural_Size - 1;
width at 68 range 0 .. ModSys.S_Float_Size - 1;
Length at 72 range 0 .. ModSys.S_Float_Size - 1;
end record;
type GDLRecordType is record
AsciiFileName : SageSpec.LongPathType := (others => ASCIIX.nul);
GDLFileName : SageSpec.LongPathType := (others => ASCIIX.nul);
Paper : ModSys.S_Natural := WinSys.DMPAPER_LETTER;
PageInchWidth : ModSys.S_Float := 0.0;
PageInchHeight : ModSys.S_Float := 0.0;
Orientation : OrientationType := Portrait;
TopMargin : ModSys.S_Float := 0.3;
BottomMargin : ModSys.S_Float := 0.0;
LeftMargin : ModSys.S_Float := 0.0;
RightMargin : ModSys.S_Float := 0.0;
IgnoreFirstFF : boolean := True;
showProgress : boolean := True;
ProgressTitle : string (1 .. 40) := (others => ASCIIX.nul);
ShowLineSizeWarning : boolean := True;
PrinterUseOnly : boolean := False;
end record;
for GDLRecordType use record
AsciiFileName at 0 range 0 .. SageSpec.LongPath_Size - 1;
GDLFileName at 257 range 0 .. SageSpec.LongPath_Size - 1;
Paper at 514 range 0 .. ModSys.S_Natural_Size - 1;
PageInchWidth at 518 range 0 .. ModSys.S_Float_Size - 1;
PageInchHeight at 522 range 0 .. ModSys.S_Float_Size - 1;
Orientation at 526 range 0 .. OrientationType'size - 1;
TopMargin at 527 range 0 .. ModSys.S_Float_Size - 1;
BottomMargin at 531 range 0 .. ModSys.S_Float_Size - 1;
LeftMargin at 535 range 0 .. ModSys.S_Float_Size - 1;
RightMargin at 539 range 0 .. ModSys.S_Float_Size - 1;
IgnoreFirstFF at 543 range 0 .. ModSys.Boolean_Size - 1;
showProgress at 544 range 0 .. ModSys.Boolean_Size - 1;
ProgressTitle at 545 range 0 .. 319;
ShowLineSizeWarning at 585 range 0 .. ModSys.Boolean_Size - 1;
PrinterUseOnly at 586 range 0 .. ModSys.Boolean_Size - 1;
end record;
subtype PenStyleType is ModSys.S_Natural;
subtype BrushStyleType is ModSys.S_Natural16;
subtype BrushHatchType is ModSys.S_Natural;
type GDIHandleType is private;
-- Callback routine to give you control when print is requested inside of viewer
type PrintProcType is access
procedure (PrintRec : in out PrintRecordType; -- Record passed to PrintLog routine
ForcePrintedTrue : in out boolean);
-- Forced user printed setting
pragma Convention
(WIN32,
PrintProcType);
procedure GetDeviceError
(GdiHandle : in out GDIHandleType;
Error : in out ModSys.S_Natural);
--*
-- GetDeviceError - Returns the device error.
--
procedure GetDefaultPrinterDeviceName
(GdiHandle : in out GDIHandleType;
DeviceName : out string;
PortName : out string;
Success : in out boolean);
--*
-- GetDefaultPrinterDeviceName - Return name of default printer or error if one not set.
--
procedure GetErrorMessage
(ErrorCode : in ModSys.S_Natural;
Message : in out string);
--*
-- GetErrorMessage - Returns a message corresponding to the error code.
--
-- Routines for basic opening, closing and getting information about the printer.
--
procedure PrinterSetup
(GdiHandle : in out GDIHandleType;
Success : in out boolean);
procedure GetPrintInfo
(GdiHandle : in out GDIHandleType;
info : in out PrintInfoType);
--*
-- GetPrintInfo - Returns the print information record.
--
procedure PixelsToInches
(GdiHandle : in out GDIHandleType;
PixelValue : in ModSys.S_Natural;
InchValue : in out ModSys.S_Float);
procedure InchesToPixels
(GdiHandle : in out GDIHandleType;
InchValue : in ModSys.S_Float;
PixelValue : in out ModSys.S_Natural);
procedure PixelsToInchesY
(GdiHandle : in out GDIHandleType;
PixelValue : in ModSys.S_Natural;
InchValue : in out ModSys.S_Float);
procedure InchesToPixelsY
(GdiHandle : in out GDIHandleType;
InchValue : in ModSys.S_Float;
PixelValue : in out ModSys.S_Natural);
procedure NumDefaultPapersAvailable
(GdiHandle : in out GDIHandleType;
NumPapers : out ModSys.S_Natural);
--*
-- NumDefaultPapersAvailable - Returns number of paper sizes available for default printer.
--
procedure GetDefaultPaperData
(GdiHandle : in out GDIHandleType;
EntryNum : in ModSys.S_Natural;
PaperData : in out PaperRecordType);
--*
-- GetDefaultPaperData - Get data about default printer paper.
--
-- Entries are 1 .. NumDefaultPapersAvailable.
--
procedure GetTypePaperData
(GdiHandle : in out GDIHandleType;
Paper : in ModSys.S_Natural;
PaperData : in out PaperRecordType);
--*
-- GetTypePaperData - Get data about printer paper using an exact paper number.
--
procedure OpenPrinter
(GdiHandle : in out GDIHandleType;
PrinterSettings : in out PrintSettingsRecordType;
OpenSuccess : out boolean);
procedure OpenWindow
(GdiHandle : in out GDIHandleType;
Hwnd : in WinSys.Hwnd);
--*
-- OpenWindow - Opens a window for output (this hWnd must must have been created and showing).
--
procedure OpenLog
(GdiHandle : in out GDIHandleType;
LogFile : in string;
Execute : in boolean);
--*
-- OpenLog - Opens a log file for output of print commands LogFile must end in .GDL.
--
procedure StartNewPage
(GdiHandle : in out GDIHandleType);
procedure EndCurrentPage
(GdiHandle : in out GDIHandleType);
procedure AbortPrinting
(GdiHandle : in out GDIHandleType);
procedure Close
(GdiHandle : in out GDIHandleType);
--*
-- Close - Closes the printer and cleans up any memory (printer/window/Log.
--
procedure SetFont
(GdiHandle : in out GDIHandleType;
FontName : in string;
FontSize : in ModSys.S_Natural;
FontFormat : in FontFormatType);
procedure SetFixedFont
(GdiHandle : in out GDIHandleType;
CharsPerLine : in ModSys.S_Natural;
LinesPerPage : in ModSys.S_Natural;
FontFormat : in FontFormatType);
procedure SetMargins
(GdiHandle : in out GDIHandleType;
Top : in ModSys.S_Float;
Bottom : in ModSys.S_Float;
Left : in ModSys.S_Float;
Right : in ModSys.S_Float);
procedure SetTextJustification
(GdiHandle : in out GDIHandleType;
HorzJustify : in HorzJustifyType;
VertJustify : in VertJustifyType);
procedure SetTextRotation
(GdiHandle : in out GDIHandleType;
degree : in ModSys.S_Natural);
function GetTextColor
(GdiHandle : in GDIHandleType) return ColorType;
function GetTextBGColor
(GdiHandle : in GDIHandleType) return ColorType;
procedure SetTextColor
(GdiHandle : in out GDIHandleType;
Color : in ColorType);
procedure SetTextBGColor
(GdiHandle : in out GDIHandleType;
Color : in ColorType);
procedure PrintText
(GdiHandle : in out GDIHandleType;
RECT : in RectType;
Text : in string);
procedure PrintTextPoint
(GdiHandle : in out GDIHandleType;
Point : in PointType;
Text : in string);
procedure PrintLine
(GdiHandle : in out GDIHandleType;
RECT : in RectType;
thickness : in LineThicknessType);
procedure PrintEllipse
(GdiHandle : in out GDIHandleType;
RECT : in RectType;
thickness : in LineThicknessType);
procedure PrintRect
(GdiHandle : in out GDIHandleType;
RECT : in RectType;
thickness : in LineThicknessType);
procedure PrintFilledRect
(GdiHandle : in out GDIHandleType;
RECT : in RectType);
--*
-- PrintFilledRect - Prints a rectangle with the current pen and filled with current brush.
--
procedure SetPenKind
(GdiHandle : in out GDIHandleType;
penStyle : in PenStyleType;
thickness : in LineThicknessType;
Color : in ColorType);
--*
-- SetPenKind - Sets the current pen style (used with PrintFilledRect).
--
procedure SetBrushKind
(GdiHandle : in out GDIHandleType;
brushStyle : in BrushStyleType;
brushHatch : in BrushHatchType;
Color : in ColorType);
--*
-- SetBrushKind - Sets the current brush style (used with PrintFilledRect).
--
procedure GetStringWidthAndHeight
(GdiHandle : in out GDIHandleType;
Str : in string;
TextWidth : in out ModSys.S_Natural;
TextHeight : in out ModSys.S_Natural);
procedure GetCharWidthAndHeight
(GdiHandle : in out GDIHandleType;
ACharacter : in character;
TextWidth : in out ModSys.S_Natural;
TextHeight : in out ModSys.S_Natural);
procedure GetMaxTextChars
(GdiHandle : in out GDIHandleType;
Str : in string;
strLen : in ModSys.S_Natural;
RECT : in RectType;
numCharsFit : in out ModSys.S_Natural);
procedure OutputBMPFile
(GdiHandle : in out GDIHandleType;
bmpFileName : in string;
rectArea : in RectType);
procedure ClosestPaper
(GdiHandle : in out GDIHandleType;
DesiredWidth : in ModSys.S_Float;
DesiredLength : in ModSys.S_Float;
Paper : out ModSys.S_Natural);
--*
-- ClosestPaper - Finds the closest paper matching the desired size.
--
procedure SetStandardPaper; --* -- SetStandardPaper - Sets the printer back to standard letter size paper 8.5 x 11.0. --
procedure PaintLog
(PaintData : in out PaintRecordType);
--*
-- PaintLog - Paints a portion of a log to an output device. LogFile must end in .GDL.
--
procedure ViewLog
(ViewData : in out ViewRecordType;
PrintProc : in PrintProcType);
--*
-- ViewLog - Opens a log file for view.
--
-- Opens a log file for view. This routine allows the user to view the
-- data in the log in a window. The user can choose to print the log
-- while viewing.
-- When this routine returns some of the values in the ViewData record have
-- been updated to reflect the changes the user may have made.
--
-- The PrintProc is called if the user decides to print from within the viewer.
-- This gives you an interecept and allows you to do other things. The two
-- parameters are a PrintRec that has been set up so that if you simply want
-- to let the system handle the printing for you then the following routine
-- would work:
--
-- procedure PrintCallbackProc
-- (PrintRec : in out GDIPrint.PrintRecordType;
-- ForcePrintedTrue : in out boolean) is
--
-- pragma Convention (Win32,
-- PrintCallbackProc);
--
-- begin
-- GDIPrint.PrintLog (PrintRec);
--
-- end PrintCallbackProc;
--
-- If you wanted to do something different for printing then you can do the following:
--
-- procedure PrintCallbackProc
-- (PrintRec : in out GDIPrint.PrintRecordType;
-- ForcePrintedTrue : in out boolean) is
--
-- pragma Convention (Win32,
-- PrintCallbackProc);
--
-- begin
-- ----- whatever you want here ----
--
-- ---- Set the force flag to true to make the system think printing was done
-- ForcePrintedTrue := True;
--
-- end PrintCallbackProc;
--
-- Setting the ForcePrintedTrue value will cause the ViewRec that eventually comes back
-- from this routine to show that printing was done. If you call the GDIPrint.PrintLog
-- routine you should NEVER set the value to true or it will override whatever the
-- user actually did.
--
procedure PrintLog
(PrintData : in out PrintRecordType);
--*
-- PrintLog - Opens a log file for printing LogFile must end in .GDL.
--
procedure GetLogStats
(LogFile : in string;
StatsRecord : in out StatsRecordType;
DeviceError : out ModSys.S_Natural);
--*
-- GetLogStats - Get some statistics about the log file.
--
--
-- This procedure returns information about the original device that was
-- opened for writing. It also returns the number of pages present in
-- the file.
--
-- CALLING SEQUENCE -
--
-- GetLogStats (LogFile, StatsRecord, DeviceError)
--
-- ENTRY -
--
-- LogFile : String
-- The name of the file to check. LogFile must end in .GDL
--
-- EXIT -
--
-- StatsRecord : StatsRecordType
-- See the documentation of the record structure at top of file.
--
-- DeviceError : Modsys.S_Natural
-- Can be checked to see if an error occurred while getting the stats.
--
procedure AsciiToGdl
(GDLRecord : in GDLRecordType;
Success : out boolean);
--*
-- AsciiToGdl - Converts an ASCII file to the equivalent GDL file.
--
--
-- This procedure will convert an ASCII file to the equivalent GDL file.
-- The GDL file can then be used to view or print the content. To print the
-- GDL file call the GDIPrint.PrintLog routine. To use the GDL view to
-- view and/or print the file call the GDIPrint.ViewLog routine.
--
-- CALLING SEQUENCE -
--
-- AsciiToGdl (GDLRecord, Success)
--
-- ENTRY -
--
-- GDLRecord : GDLRecordType
-- Record containing the following fields -
--
-- GDLRecord.AsciiFileName : string
-- The name of a ASCII file containing the text to be converted.
--
-- GDLRecord.GDLFileName : string
-- The name of the file to contain the GDL commands to reproduce the
-- ASCII file contents in a Windows environment.
--
-- GDLRecord.Paper : ModSys.S_Natural
-- Type type of paper to use. Set to DMPAPER_USER if using a custom size.
-- If and only if that value is set are the PageInchWidth and PageInchHeight
-- params used.
--
-- GDLRecord.PageInchWidth : Modsys.S_Float
-- The width in inches of the paper this is to be placed on.
--
-- GDLRecord.PageInchHeight : Modsys.S_Float
-- The height in inches of the paper this is to be placed on.
--
-- GDLRecord.Orientation : OrientationType
-- Portrait - Pages will be in portrait orientation.
-- Landscape - Pages will be in landscape orientation.
--
-- GDLRecord.IgnoreFirstFF : boolean
-- Some DOS style ASCII reports started the report with a FormFeed character
-- to make sure that the first page was set to the top of form. If your
-- report has this and you don't set this flag you will end up with a blank
-- page at the start of your report. This flag has no effect if an ASCIIX.FF
-- is not found in the first few bytes of the first line of the report.
--
-- GDLRecord.ShowProgress : boolean
-- Show a message stating that conversion is on what page.
--
-- GDLRecord.PrinterUseOnly : boolean
-- This field controls the granularity of the translation. If going to a
-- printer only then the text is converted a word (or solid line of characters)
-- at a time. However when using the viewer that can cause some items such
-- as a long line of dashes to not be shown correctly, typically they will show
-- as shorter in total length than they really are. If those same dashes are
-- converted a character at a time rather than as a single line then the viewer
-- can show them very accurately placed on the page. However the trade off is
-- speed. When this flag is FALSE so that the conversion is a character at a
-- time it does take a bit longer and the converted file will be larger. If
-- you really are going to use the resultant file for printing only you should
-- definately set this field to TRUE to gain speed on the translations.
-- If you are going to the viewer you have the choice of setting this flag.
-- Setting it to FALSE would be preferable in order to get a better WYSIWYG
-- effect on screen. Neither setting of this field has any effect on the final
-- printed copy, only on the copy shown in the viewer.
--
-- EXIT -
--
-- Success : boolean
-- True - File was successfully converted to GDL.
-- False - An error prevented the files conversion.
--
-- EXAMPLE -
--
-- ViewData : GDIPrint.ViewRecordType;
--
-- Success : boolean = False;
--
-- begin
-- StringsX.Assign ("MyRpt.txt",
-- GDLRecord.AsciiFileName,
-- Success);
--
-- StringsX.Assign ("MyRpt.txt",
-- GDLRecord.GDLFileName,
-- Success);
--
-- GDLRecord.Paper := GDIPrint.DMPAPER_USER;
-- GDLRecord.PageInchWidth := 3.5;
-- GDLRecord.PageInchHeight := 12.0;
-- GDLRecord.Orientation := GDIPrint.Portrait;
-- GDLRecord.TopMargin := 0.3;
-- GDLRecord.BottomMargin := 0.0;
-- GDLRecord.LeftMargin := 0.0;
-- GDLRecord.RightMargin := 0.0;
-- GDLRecord.IgnoreFirstFF := True;
-- GDLRecord.ShowProgress := True;
-- GDLRecord.ShowLineSizeWarning := True;
-- GDLRecord.PrinterUseOnly := False;
--
-- GDIPrint.AsciiToGdl (GDLRecord,
-- Success);
--
-- Also this routine will commonly be used in conjuction with the GDIPrint.ViewLog
-- routine in order to build a Windows friendly file viewer/printer. In order to
-- view the just converted file the following code can be used to call the viewer.
--
-- StringsX.Assign ("MyRpt.gdl",
-- ViewData.LogFile,
-- Success);
--
-- ViewData.StartPage := 1;
--
-- StringsX.Assign ("My Very Important Report",
-- ViewData.Title,
-- Success);
--
-- ViewData.ShowTitle := TRUE;
-- ViewData.ShowMinMax := FALSE;
-- ViewData.ShowSystemMenu := FALSE;
-- ViewData.ShowMenu := TRUE;
-- ViewData.ShowOpenFile := FALSE;
-- ViewData.ShowToolbar := TRUE;
-- ViewData.ZoomPercent := 100;
--
-- StringsX.Assign ("",
-- ViewData.BackgroundBmp,
-- Success);
--
-- ViewData.WindowLoc.X := 10;
-- ViewData.WindowLoc.Y := 10;
-- ViewData.XSize := 1024;
-- ViewData.YSize := 768;
-- ViewData.Sizeable := TRUE;
-- ViewData.AllowPrintRange := TRUE;
-- ViewData.ShowPrintProgress := TRUE;
-- ViewData.UserPrinted := FALSE;
--
-- GDIPrint.ViewLog (ViewData);
--
-- if ViewData.UserPrinted then
-- ......
--
procedure UnderlineRect
(GdiHandle : in out GDIHandleType;
SourceRect : in RectType);
--*
-- UnderlineRect - Draw an underline for the given rect area.
--
--
-- This procedure draws an underline in the given rect area. This
-- is useful for making text appear to be underlined.
--
-- CALLING SEQUENCE -
--
-- UnderlineRect (GdiHandle, SourceRect)
--
-- ENTRY -
--
-- GdiHandle : GDIHandleType
-- A handle to the current GDI output.
--
-- SourceRect : RectType
-- A rect to use as the boundaries of the underline drawing.
--
procedure GetSizeOf
(GdiHandle : in out GDIHandleType;
Str : in string;
StrSize : out ModSys.S_Integer);
--*
-- GetSizeOf - Get the width of the rect needed to contain the string.
--
--
-- This procedure calculates the width needed for a rect to contain this
-- text when it is drawn.
--
-- CALLING SEQUENCE -
--
-- GetSizeOf (GdiHandle, Str, StrSize)
--
-- ENTRY -
--
-- GdiHandle : GDIHandleType
-- A handle to the current GDI output.
--
-- Str : string
-- The string to be used in the calculation.
--
-- EXIT -
--
-- StrSize : ModSys.S_Integer
-- The width of a rect that will contain the given string.
--
procedure GetNextBlockLine
(GdiHandle : in out GDIHandleType;
Relation : in string;
Field : in string;
Reset : in boolean;
PrintRect : in RectType;
Value : in out string;
EndOfData : in out boolean);
--*
-- GetNextBlockLine - Get data for the rect from a block data field.
--
--
-- This procedure gets data from a block data field using the given rect.
-- The rect is used to control how much data is pulled out, in other words
-- only as much data as will fit within the rect.
--
-- CALLING SEQUENCE -
--
-- GetNextBlockLine (GdiHandle, Relation, Field, Reset, PrintRect,
-- Value, EndOfData)
--
-- ENTRY -
--
-- GdiHandle : GDIHandleType
-- A handle to the current GDI output.
--
-- Relation : string
-- The relation of the field to be used.
--
-- Field : string
-- The block field containing the data.
--
-- Reset : boolean
-- True - Reset and start at the first of the data again.
-- False - Continue getting the data from the byte just
-- past the last one read before this.
--
-- PrintRect : RectType
-- The rect that is used to contain the data.
--
-- EXIT -
--
-- Value : string
-- The next string from the block data that will fit within the rect.
--
-- EndOfData : boolean
-- True - This is the last of the block data.
-- False - There is more block data after this.
--
procedure GetNextBufferLine
(GdiHandle : in out GDIHandleType;
Buffer : in string;
Reset : in boolean;
PrintRect : in RectType;
Value : in out string;
EndOfData : in out boolean);
--*
-- GetNextBufferLine - Get data for the rect from a buffer.
--
--
-- This procedure gets data from a buffer using the given rect. The
-- rect is used to control how much data is pulled out, in other words
-- only as much data as will fit within the rect.
--
-- CALLING SEQUENCE -
--
-- GetNextBufferLine (GdiHandle, Buffer, Reset, PrintRect,
-- Value, EndOfData)
--
-- ENTRY -
--
-- GdiHandle : GDIHandleType
-- A handle to the current GDI output.
--
-- Buffer : string
-- The buffer to be used.
--
-- Reset : boolean
-- True - Reset and start at the first of the data again.
-- False - Continue getting the data from the byte just
-- past the last one read before this.
--
-- PrintRect : RectType
-- The rect that is used to contain the data.
--
-- EXIT -
--
-- Value : string
-- The next string from the block data that will fit within the rect.
--
-- EndOfData : boolean
-- True - This is the last of the block data.
-- False - There is more block data after this.
--
Send mail to
warren.merrill@inl.gov
with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance