source: branches/2.20_branch/NewView/HelpWindowDimensions.pas@ 429

Last change on this file since 429 was 18, checked in by RBRi, 19 years ago

+ newview source

  • Property svn:eol-style set to native
File size: 2.6 KB
Line 
1Unit HelpWindowDimensions;
2
3// NewView - a new OS/2 Help Viewer
4// Copyright 2003 Aaron Lawrence (aaronl at consultant dot com)
5// This software is released under the Gnu Public License - see readme.txt
6
7Interface
8
9uses
10 IPFFileFormatUnit;
11
12const
13 ptCharacters = 0;
14 ptPercentage = 1;
15 ptPixels = 2;
16 ptPoints = 3;
17 ptDynamic = 4;
18
19 XPosRight = 577; // some random values as markers
20 YPosTop = 577;
21 XYPosCenter = 578;
22
23type
24 THelpWindowRect = class
25 Left: longint; // xposright means, right aligned
26 Bottom: longint; // xpostop means top aligned
27 // both: xyposcenter means centered
28 Width: longint;
29 Height: longint;
30 constructor Create;
31 procedure Assign( Rect: THelpWindowRect );
32 end;
33
34var
35 FootnoteRect: THelpWindowRect;
36
37procedure ReadHelpSize( const XY: THelpXYPair;
38 Var Rect: THelpWindowRect );
39procedure ReadHelpPosition( const XY: THelpXYPair;
40 Var Rect: THelpWindowRect );
41
42
43Implementation
44
45constructor THelpWindowRect.Create;
46begin
47 Left := -1;
48 Bottom := -1;
49 Width := -1;
50 Height := -1;
51end;
52
53procedure THelpWindowRect.Assign( Rect: THelpWindowRect );
54begin
55 Left := Rect.Left;
56 Bottom := Rect.Bottom;
57 Width := Rect.Width;
58 Height := Rect.Height;
59end;
60
61function GetPos( const PositionType: uint8;
62 const Value: longint ): longint;
63begin
64 case PositionType of
65 ptCharacters:
66 Result := Value;
67 ptPercentage:
68 Result := Value;
69 ptPixels:
70 Result := Value * 5;
71 ptPoints:
72 Result := Value;
73 ptDynamic:
74 case Value of
75 1:
76 Result := 0; // left
77 2:
78 Result := XPosRight; // right
79 4:
80 Result := YPosTop; // top
81 8:
82 Result := 0; // bottom
83 16:
84 Result := XYPosCenter; // center.
85 end;
86 end;
87end;
88
89procedure ReadHelpPosition( const XY: THelpXYPair;
90 Var Rect: THelpWindowRect );
91var
92 XPositionType: uint8;
93 YPositionType: uint8;
94begin
95 // read origin
96 XPositionType := XY.Flags div 16;
97 YPositionType := XY.Flags and 15;
98
99 if XY.X <> $ffff then
100 Rect.Left := GetPos( XPositionType, XY.X );
101 if XY.Y <> $ffff then
102 Rect.Bottom := GetPos( YPositionType, XY.Y );
103end;
104
105procedure ReadHelpSize( const XY: THelpXYPair;
106 Var Rect: THelpWindowRect );
107begin
108 if XY.X <> $ffff then
109 Rect.Width := XY.X;
110 if XY.Y <> $ffff then
111 Rect.Height := XY.Y;
112end;
113
114Initialization
115 FootnoteRect := THelpWindowRect.Create;
116 with FootnoteRect do
117 begin
118 Left := 10;
119 Width := 80;
120 Bottom := 10;
121 Height := 40;
122 end;
123
124End.
Note: See TracBrowser for help on using the repository browser.