Dec 222017
 
Turbo Pascal unit to put Turbo Vision apps into graphics mode. Comes with a modified TVDemo.Pas which has styxes running in little windows.
File TVGR70.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Turbo Pascal unit to put Turbo Vision apps into graphics mode. Comes with a modified TVDemo.Pas which has styxes running in little windows.
File Name File Size Zip Size Zip Type
GAPP.TPU 11584 4698 deflated
GCOLORS.TPU 20048 7161 deflated
GDIALOGS.TPU 32832 11564 deflated
GDRIVERS.TPU 11488 5862 deflated
GMENU6.TPU 22352 8497 deflated
GMSGBOX.TPU 4528 2112 deflated
GOBJECTS.TPU 22560 9407 deflated
GSTDDLG.TPU 27440 10232 deflated
GVIEWS.TPU 51440 19247 deflated
GWINDOW.TPU 8096 3388 deflated
MCURSOR2.TPU 4848 2044 deflated
MYGRAPH3.TPU 28672 12081 deflated
REFER10.DOC 65204 18136 deflated
RODENT.TPU 2176 628 deflated
TEXTVIEW.DOC 8910 3248 deflated
TVGDEMO1.PAS 44570 12934 deflated
TVGRAFIC.DOC 55168 17069 deflated

Download File TVGR70.ZIP Here

Contents of the REFER10.DOC file


file Refer10.DOC

10/7/93

REFERENCE SECTION

NOTE
Changes are relative to Turbo Vision 1.0 unless otherwise noted.
Turbo Pascal 6.0 includes documentation for Turbo Vision 1.0.

Turbo Vision 2.0 comes with Pascal 7.0 and expands on TV 1.0,
adding additional objects and methods. Most of these objects and
methods are not present in TVGraphic at this time.

TVGraphic
For objects that are analogous to Turbo Vision objects, only
methods that have been modified are listed in this section.
New methods are always listed. Assume unlisted methods are unchanged.
However, where the changes in a View's method
1. are solely to use graphic coords instead of text coords
and/or
2. only involve limiting redrawing area or frequency

then the method is not listed.

Unit Version Numbers:
Each unit exports a version number string constant under
the name of GVersion. This can be checked by using the IDE's
Evaluation window - for example include GObjects in a uses
statement and then evaluate GObjects.GVersion to
get the version of the GObjects unit.
------------------------

Application Palette

See individual objects for TVGraphics palette definitions.
Format
Foreground color = lower 4 bits, background = upper 4 bits.
TVGraphics allows all 16 colors for background.
There is no inherent "blink" in graphics mode.
Indices
TVGraphic windows use TV's "Blue" window portion of the palette
which starts at entry 8.
(default background color is light gray in TVGraphic).
TVGraphic Dialogs use TV's Dialog palette which starts at
entry 32. (TV Dialogs do not use the "Gray" window portion of
the palette despite what TV's documentation says).
(default background color is cyan in TVGraphic).
Views in TVGraphic do not use the sections of the palette
that TV calls "Gray" and "Cyan" windows. The Cyan
section is reserved for future Help windows.

{1 application background}
{2-7 Menus, StatusLine}
{Scrollbars: 11-12 in Blue Window, 35-36 in dialog boxes}
{BlueWindow starts at 8, 8-10 TFrame,11-12 Scrollbar,13-14 scroller,
15 reserved}
{32-40 Dialog uses directly, remaps alot of other palettes mentioned below}
{indices below are for items inserted in a dialog}
{Rule is to take view's local palette number and add 31.}
{32-34 TFrame, 35-36 scrollbar}
{37 static text, 38-40 Label}
{41-46 Buttons}
{47-49 Checkboxes and Radiobuttons}
{50-52 InputLine, 52 foreground is for scroll arrow,
background for rect border around text.}
{50-56 HistoryWindow}
{57-60 TListViewer in Dialog}
{61 InfoPane, FileDialog}

------------------------
* = unique to TVGraphic

GApp Unit
* MessageBar : PGMessageBar = nil; {Added Public Global var}

------------------------

GColor Unit
TVGraphic standard color item functions
function DesktopColorItems(Next: PColorItem): PColorItem;
function MenuColorItems(Next: PColorItem): PColorItem;
function DialogColorItems(Palette: Word; Next: PColorItem): PColorItem;
function WindowColorItems(Palette: Word; Next: PColorItem): PColorItem;

procedure RegisterColorSel;
------------------------
* = unique to TVGraphic

GDialogs Unit
* TVGraphic constants

DefaultButHt : integer = 20;
DefaultDialogFont : byte = font8x14;
{Vfont set to this in TButton,TInputLine.
Also in StaticText, ParamText, TLabel unless
overidden in Init(..,..,.,Opts) parameter.}

MouseSnapToDialogGrid : boolean = true;

VOptions constants
DefaultOpts = 0;
TStaticText
used with Opts field of text.Init's
{lower 4 bits reserved for optional font selection}
txDrawBackground = $80;
txCentered = $10;
txAdjustSize = $20;
TgInputLine
KillInstantErase = $01;
TDialog
ReturnOnAnyButton = $01;

Stream Registration numbers
CancelButton: gRegBase + 1001;
OKButton: gRegBase + 1002;
------------------------
* = unique to TVGraphic

GDrivers
DOS CRITICAL ERROR handler
TV's text mode critical error handler must be replaced by TVGraphic's
* function GSystemError(ErrorCode: Integer; Drive: Byte): Integer; far;
or by one you write.
Note: To avoid needing to allocate memory to save a portion
of the screen, GSystemError assumes that a MenuBar AND a
MessageBar view exist in your application.
You do not need a StatusLine.
DO NOT overlay the critical error handler.
GSystemError's source code is located in the demo program module.

To replace TV's handler, place following line in
your application's .Init
SysErrorFunc := GSystemError;

The following functions are called by the Critical Error handler:
function FarSelectKey : integer;
{returns user keystroke without calling DOS}
function GetCritErrorStr(ErrorCode : integer) : string;
{returns the error message}

Timer Tick Event
* procedure GetBiosTickEvent(var Event : TEvent);
if the DOS timer count differs from count at previous call to
GetBiosTickEvent, then Event returns a TVGraphic event catagory
Event.What := evTimerTick;
Event.Infolong := value return by GetBiosTicks;
otherwise Event.What is set to evNothing;

* function GetBiosTicks : longint;
returns DOS timer count stored at address $40:$6C;

* procedure WriteCStr(AStr : string; TxColor,HighlightColor : word);
Writes AStr as a single line. Text is in TxColor but anything
enclosed with ~'s is written in the highlight color. Can use
multiple pairs of ~'s to get multiple highlighted sections.
Does not draw a background under the text.

DELETED
procedure PrintStr(S: String);
SHELL ONLY - these procedures match Turbo Vision but do nothing. They are
included to make stepwise conversion from TV easier.
procedure MoveBuf(var Dest; var Source; Attr: Byte; Count: Word);
procedure MoveChar(var Dest; C: Char; Attr: Byte; Count: Word);
procedure MoveCStr(var Dest; Str: String; Attrs: Word);
procedure MoveStr(var Dest; Str: String; Attr: Byte);

------------------------
* = unique to TVGraphic

GMenu
* const {user changable}
MenuBarheight : integer = 15; {height of the MenuBar in pixels,
minmum value is 15 if using Font8x14 as assigned in Init}
MenuBoxheight : integer = Boxheight; {used to size Box menus}
MouseSnapToMenuGrid : boolean = true; {causes mouse cursor to snap
to a properly located Charlen by Boxheight grid while a BoxMenu
executes. Set false to use current grid with BoxMenus.}
DefaultMenuFont : byte = Font8x14;

Stream Registration Numbers
MenuBar: gRegBase + 40;
MenuBox: gRegBase + 41;
StatusLine: gRegBase + 42;
MessageBar: gRegBase + 1100;

------------------------
* = unique to TVGraphic

GMsgBox
DosErrorMessageBox displays appropriate DOS error message
and file name using a MessageBox. Pass the global variable DosError
as parameter DOSErrNum or pass TStream.ErrorInfo if using a Stream.
Pass the file name as FileName.

* procedure DOSErrorMessageBox(DOSErrNum : integer; FileName : string);

* procedure LowMemMsgBox; {Out of memory Messagebox}
MessageBox('Not enough memory available.',
nil, mfError + mfOkButton);

------------------------
* = unique to TVGraphic

GObjects

const
* Str80 = string[80];

const used to offset TVGraphic's stream registration numbers
* gRegBase = 60000;

type used with mouse cursor grid
* MGridRec = record
X : byte; Y : byte; Xoff : word; Yoff : word;
end;

MGridSize contains the current settings of the mouse cursor grid.
MGridSize is initialized at startup to the values shown below.
{10 pixels grid resolution, no offset}
To change MGridSize see MCur methods.

const read only
* MGridSize : MGridRec = (x : 10; y : 10; Xoff : 0; Yoff : 0);

Stream Registration Numbers
UnSortedStringCollection: gRegBase + 51;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

GViews
+ MaxViewWidth = 132*Charlen;
+ MinWinSize: TPoint = (X: 16*Charlen; Y: 6*Boxheight);


* TVGraphic constants
ScrollBarWidth = 11; {0 to 11 = 12 pixels total width}
DefaultListViewerFont : byte = font8x14;
TVColor = $FFFF;
This constant is used only by other units.
It is used in VColor field of a view to indicate
that the drawing colors should come from the palette
and not from the VColor field.

* VOptions constants
TFrame drawing control
tfDrawBackground = $01; {fill entire size rectangle}
tfVScrollBar = $02; {user sets if bar is present in Owner}
tfHScrollBar = $04;

type This is the record type used by TView.Hook
* TUserHook = record
case word of
0 : (R : TRect);
1 : (P1,P2 : pointer);
2 : (X1,Y1,X2,Y2 : integer);
end;

* function ASHR(AnInt : integer; Places : byte) : integer;
{does arithmetic shift right of Places on AnInt}
* function ASHL(AnInt : integer; Places : byte) : integer;
{does arithmetic shift left of Places on AnInt}

-----------------------
* = unique to TVGraphic

* GWindow
const
cmScreenShifted = gRegBase + 2000;
cmShiftScreenDown = gRegBase + 2001;
cmShiftScreenUp = gRegBase + 2002;

const
{number of pixels to shift screen when mouse
cursor hits edge of a Panning window.}
ScrnShiftX : word = Grid * 20;
ScrnShiftY : word = Grid * 15;
NormalMode = 0;

const
ShiftViewPtr : PShiftView = nil; {Global}

Stream Registration Numbers
ShiftView: gRegBase + 2000;
SubWindow: gRegBase + 2001;
PanWindow: gRegBase + 2002;
WinBackground: gRegBase + 2003;

procedure RegisterWindows;

-----------------------
* = unique to TVGraphic

* MCursor Unit
const
Grid = 10; {size of coarse drawing grid spacing in pixels}
FineGrid = 5; {size of fine drawing grid}

procedure FlushMouseQue; NOTE - Flushes ALL types of mouse events
from the event que.
var
MCur : TMCur; Global mouse cursor object

PMCur = ^TMCur;
TMCur = object(TPoint)
read only
MinGridX, MinGridY : integer; {min screen coords of mouse travel}
MaxGridX,MaxGridY : integer; {max screen coords for mouse travel}
constructor Init;
MickSet(12,12); {reduce mouse sensitivity, normal is 8,8}
destructor Done;
procedure CenterIt;
Computes center of screen and then calls RePosition(center)
procedure CurWhere(var Pt : TPoint);
returns cursor position
procedure Limitvert(minpos,maxpos : integer);
sets vertical limits of cursor travel
procedure Limithorz(minpos,maxpos : integer);
sets horizontal limits of cursor travel
procedure Move(P : TPoint);
moves cursor to Pt, even if hidden.
procedure RePosition(var Pt : TPoint);
Moves the cursor and calls FlushMouseQue.
If Pt is outside the area specified for the cursor travel,
then moves cursor to edge of specified area.
procedure RestrictYMove;
keeps cursor out of MenuBar
procedure RestoreYMove;
restores cursor travel to screen top
procedure SetGrid(XGrid, YGrid : byte; XGridOffset, YGridOffset : word);
SetGrid not only sets the specified grid (by setting
global var MGridSize) but also sets
the limit of mouse travel so the cursor won't disappear
off the right screen edge or the bottom.
It also repositions the mouse if necessary to be on
the new grid.
procedure LockShow;
decrements lock count, show cursor if 0
procedure LockHide;
hide cursor if visible, increment lock count.
while lock count > 0, Show and Hide have no effect.
procedure Show;
shows the cursor
procedure Hide;
hides the cursor
end;

------------------------
* = unique to TVGraphic

* Unit MyGraph3

This unit traps some BGI calls before passing them to the Graph unit.

Fonts
Unit contains the two pixel clippable bit-mapped fonts.
Font8x8 appears the same as the Graph unit Default font.
Font8x14 is the same size as and looks like an EGA text mode font.
These fonts have only one size and can only be horizontal.

NOTE: if you install enough custom fonts, eventually the BGI will
assign font numbers equal to or higher than Font8x8. You will not be
able to access custom font numbers equal to and above Font8x8.
Example: Borland Pascal 7.0 has fonts defined at numbers 0 thru 10
so you will only be able to access three custom fonts.


const {for graphics mode programs}
Charlen = 8; {width of a standard graphic char in pixels}
BoxHeight = 14; {height of the standard text line}

TVGraphic clippable, bit-mapped Fonts
Font8x8 = 14; {8 by 8 pixels}
Font8x14 = 15; {8 by 14 - same size as text on EGA}

BYOff8x8 = 4; {offset down into Boxheight to center text}
BYOff8x14 = 1;
BYOffSmallFont = 0; {for use with BGI SmallFont}

{font dependent offset down into Boxheight to center text}
BYOffset : integer = 0;
The value of BYOffset is set to one of the three BYOFF constants
by SetTextStyle according to the font being selected. It can be
used when spacing lines of text vertically using Boxheight to
properly center the text font vertically within each box.
Add BYOffset to the box's upper edge when using OutTextXY or
MyGraph.MoveTo+OutText.

BXOffset = 4; {offset from left edge of box}

Utility functions
{ ConstStr returns a string with N characters of value C }
function ConstStr(C : Char; N : Integer) : String;

function VertTextOffset(ViewYSize : integer) : integer;
Used by MenuBar,StatusLine,etc. to calc vertical offset to
center a line of text in a view. Pass view's Size.y as ViewYSize.
Font dependent - Must set font Before calling this routine!
Tested with Smallfont,Font8x8,Font8x14 in 10,15,20 pixel high
boxes.
begin
VertTextOffset := (ViewYSize +1 - TextHeight(' ')) div 2 +1;
end;

BGI functions
procedure SetTextStyle(Font, Direction : word; CharSize : word);
For font numbers less than Font8x8
calls the Graph unit SetTextStyle. If that call fails
(font not found), then sustitutes Font8x8.
Sets BYOffset to BYOffSmallFont.
For fonts Font8x8,Font8x14, sets font selection in this unit
to selected font. Sets BYOffset to matching BYOff constant.

Note that you can select the Graph unit DefaultFont (font =0)
but it doesn't clip at pixel level - see BGI/Graph unit doc.

function TextHeight(TextString : string) : word;
returns 8 for Font8x8 and 14 for Font8x14
function TextWidth(TextString : string) : word;
uses character width of 8 for fonts Font8x8 and Font8x14
to calculate width.

The following BGI calls are also intercepted
Bar
Bar3d
OutText
OutTextXY
------------------------

TApplication
In TVGraphic, Applications descend from TProgram, not TApplication!
See Deriving an Application section. See demo program.

------------------------

TBackground = object(TView)
Pattern - Not used.
In TVGraphic, Background obtains its fillstyle from the
background color of its palette entry. The fillstyle passed
to SetFillStyle is (BackgroundColor mod 4 +8).
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TgButton = object(TView)
AmDefault: Boolean; not used
+constructor Init(var Bounds: TRect; ATitle: TTitleStr; ACommand: Word;
AFlags: Word);
sets VFont := DefaultDialogFont
procedure Draw; virtual; unchanged - calls DrawState
procedure DrawState(Down: Boolean);
rewritten for graphic drawing
centers text vertically for any font
+procedure HandleEvent(var Event: TEvent); virtual;
heavily altered
summary:
mouse - left button down presses button
Enter key presses the Default button
not using cmGrabDefault, cmReleaseDefault:
usual HotKey behavior
When CommandSet is changed - code minimizes button redraws
procedure MakeDefault(Enable: Boolean);
routine is unmodified but no longer has any effect on buttons.
+procedure Press; virtual;
draws button shadow when button is pressed
+procedure SetState(AState: Word; Enable: Boolean); virtual;
different calls when AState = sfFocused
end;

To change the Default Button after initialization:
change which button has the bfDefault flag set in its Flags field
(only one button should have this flag set at a time),
then call the old and new Default buttons' DrawView.


* TVGraphic predefined buttons

Button Size is fixed at 7*Charlen long by DefaultButHt tall.
Only the Button's Origin is specified in Init.

* PGCancelButton = ^TGCancelButton;
* TGCancelButton = object(TGButton) Issues the cmCancel command.
constructor Init(var Org : TPoint);
end;

* PGOKButton = ^TGOKButton;
* TGOKButton = object(TGButton) Issues the cmOK command.
constructor Init(var Org : TPoint; DefaultButton : boolean);
if DefaultButton is true, then call to TButton sets
Turbo Vision bfDefault button flag in Flags field.
end;


+ Button Palette
background is drawn in the background color of entries 1-4
depending on State of button.
button outline/shadow:
left and top = foreground color of entry 8
right and bottom = background color of entry 8
button draws black momentarily when pushed
all text - same entries as TV

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TgCheckBoxes = object(TgCluster) unmodified

TCluster:
TVGraphic corrects TV 1.0 bug in handling nil strings in TgCluster.
This means you can have a Checkbox or RadioButton view without
individual box labels.

TgCluster = object(TView)
+constructor Init(var Bounds: TRect; AStrings: PSItem);
sets VFont := font8x8
+procedure DrawBox(Icon: String; Marker: Char);
fix TV 1.0 bug for single line horizontal Clusters
rewritten for graphics
+procedure HandleEvent(var Event: TEvent); virtual;
convert to graphics coords

{+Methods below are Private in TV 1.0.
In TVGraphic they are public and virtual.}
function FindSel(P: TPoint): Integer; virtual;
convert to graphic coords
function Column(Item: Integer): Integer; virtual;
handle nil strings
convert to graphic coords
function Row(Item: Integer): Integer; virtual;
convert to graphic coords
end;


+ Cluster Palette
background is drawn in the background color of entry 1.
cluster outline uses background color of entry 3
all text - same entries as TV

------------------------
+ = emulates TV with exceptions noted

TCollection = object(TObject)
+constructor Load(var S: TStream);
checks LowMemory before loading each item. If true, sets
Count equal to number of items loaded and exits.
Partially loaded collection is usable. Check LowMemory
to see if partially loaded.
procedure AtFree(Index: Integer);
missing from TV 1.0 manual
deletes and disposes of item at index.
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TColorGroupList = object(TListViewer)
+procedure FocusItem(Item: Integer); virtual;
modify to send message only if color has changed
end;

TColorDialog = object(TGDialog)
+constructor Init modify to allow 16 colors for background.
delete mono selector, rearrange control locations.
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TDeskTop = object(TGroup)
BackGround : PBackground;
present but not doc'd in TV 1.0
function NewBackground
vaporware in TV 1.0 documentation.
procedure InitBackground
actual TV 1.0,2.0 call - constructs background
equal in size to DeskTop, called in TDeskTop.Init
procedure HandleEvent(var Event: TEvent); virtual;
present but not documented in TV 1.0
Handles commands:
cmNext: SelectNext(False);
cmPrev: Current^.PutInFrontOf(Background);
*constructor Load(var S : TStream); {missing in TV 1.0, added}
*procedure Store(var S : TStream); {missing in TV 1.0, added}
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TgDialog = object(TWindow)
+constructor Init(var Bounds : TRect; ATitle : TTitleStr; Opts : byte);
added Opts parameter to set VOption field.
if Opts = DefaultBehavior then matches TV
if Opts = ReturnOnAnyButton then Dialog will end modal state when
any button command is issued including user defined commands.
see GDialog Unit section for other options

Init sets Frame^.VOptions := tfDrawBackground;
which causes Dialog's Frame to draw a background for the view.

*function Execute : word; virtual; NEW-ADDED
calls TGroup.Execute
if global MouseSnapToDialogGrid is true then Execute sets the
mouse grid to a Charlen by Boxheight grid before the call to
TGroup.Execute and resets grid to previous values afterwards.
If set, grid is relative to top of DeskTop - Dialog grid assumes
you will insert Dialog into DeskTop.
When inserting a Dialog, easiest way is to use the ofCentered
option in the Dialog.Option field (not VOptions field). This
will center the Dialog and match it to the grid if you dimension
the Dialog vertically using the Boxheight constant and
horizontally using the Charlen constant.
(i.e. Size.x := I*Charlen
( Size.y := N*Boxheight where I,N : integer)

+procedure HandleEvent(var Event: TEvent); virtual;
modified for ReturnOnAnyButton
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TFrame = object(TView)
+constructor Init(var Bounds: TRect);
VFont is set to font8x8; TFrame assumes this size font
is used so may not work properly with other fonts.
procedure Draw; virtual;
draws a complete background if dragging or the VOptions
tfDrawBackground is set. Otherwise checks VOption flags
tfVScrollBar and tfHScrollBar and draws background under
the standard scrollbar positions if these flags are set.
Finally calls DrawFrame.
*procedure DrawFrame; virtual;
Draws a background under top bar of window. Draws a rectangle
around the view and an inner rectangle if the view is active.
These border rectangles extend offscreen if the view has an
Interior larger then the screen. (Calls
TGroup.GetFullPanSize to get size for these outline rectangles.)
If the window number is 1 thru 9, draws a Next Window button
with number inside.
Next, if active, checks Flags field and draws usual icons
if flags are set in Flags. Finally draws title, shortening
it if necessary to fit. Windows numbered 1..9 draw a blue
background under the title using the background of
palette entry 6.
*function Exposed : boolean; virtual;
calls Owner^.Exposed
*procedure GetInteriorSize(var R : TRect); virtual;
returns in R the size of the area inside the frame that you
should fill with views. This size reflects whether the VOption
flags tfVScrollBar and tfHScrollBar are set. (They are set
automatically if you add scrollbar(s) using
TWindow.StandardScrollBar).
Note that if you set TFrame's tfDrawBackground in the
VOption field, it will fill this area with the TFrame
background color.
+procedure HandleEvent(var Event: TEvent); virtual;
Handles mouse events. If NextWindow button is pressed,
issues a command event with Event.Command := cmNext to
advance to next window. Otherwise emulates TV.
*procedure MakeLocal(Source: TPoint; var Dest: TPoint); virtual;
added to handle Panning windows. Dest is in coord system
of TFrame, not the panning window Interior.
+procedure SetState(AState: Word; Enable: Boolean); virtual;
Calls DrawView when setting sfDragging. If clearing
sfDragging or changing sfActive, calls
DrawFrame if view is Exposed.
end;

+ TFrame Palette
{ TFrame Palette layout }
{ 1 = Passive frame }
{ 2 = Passive title }
{ 3 = Active frame }
{ 4 = Active title }
{ 5 = Icons }
{*6 = highlight outline, background for title of numbered windows}
CFrame = #1#1#2#2#3#4; {add #4 to map to dialog box
scrollbar background}
Numbered,Active frames draw their inner border and their
background under the Title using background of entry 6.
{entry 6 points to same color as scrollbar's entry 1}
Icon buttons draw background with background of entry 5,
Icon uses foreground of entry 5.
Other items follow TV.
------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TGroup = object(TView)
Buffer: PVideoBuf; deleted
constructor Init(var Bounds: TRect);
does not set ofBuffered in Options field
! constructor Load(var S: TStream);
Calls LowMemory after loading each view and Exits if true.
This prevents TV's runtime halt with out of memory error.
! Warning: when Load exits due to LowMemory=true, the Group is
not complete - inter view pointers are not restored.
If you insert the Group, the computer will probably bomb - totally!
To check for incomplete Load, follow the TV recommended
practice of using TProgram.ValidView on the pointer
returned by S.Get. If LowMemory, ValidView will display
an insufficient memory message, dispose the Group and
return a nil pointer to you.

Load also calls SetClipToMax.

*function CurAtEdge(Event : TEvent; var Delta : TPoint;
AllowMenuAccess : boolean) : boolean; virtual;
Returns false with no other action here.
Overridden in descendents if panning with mouse cursor.
procedure ChangeBounds(var Bounds: TRect); virtual;
calls SetClipToMax rather than GetExtent(Clip);
procedure Draw; virtual;
sets Clip by calling GetClipRect(Clip), calls Redraw and
resets Clip with SetClipToMax {rather than GetExtent(Clip)}.
*procedure GetClip(var MyClip : TRect);
sets MyClip equal to Clip
*procedure GetFullPanSize(var ISize : TPoint); virtual;
ISize is set to Size here. Overridden by descendents with
larger then the screen Interiors to return size of
their Interior. Called by TFrame.DrawFrame to determine
what size to draw its outline rectangle to.
procedure InsertBefore(P, Target: PView);
same as TV except:
If P's ofCenterX or ofCenterY Option flags are set, then
P is centered but P's Origin is adjusted so that
if ofCenterX then P's Origin.x is a multiple of Charlen
if ofCenterY then P's Origin.y is a multiple of Boxheight.
procedure Lock;
always increments the LockFlag
procedure Redraw;
calls MCur.LockHide to lock the mouse cursor off
redraws the views from Last to First
calls MCur.LockShow;
*procedure SetClip(R : TRect);
allows you to set the Clip variable which is used in TVGraphic
by TView.Exposed. If a view is outside the Clip rectangle,
Exposed will be false and calls to DrawView (or TGroup.Redraw
which eventually calls DrawView for each view) will not draw.
*procedure SetClipToMax;
Calls GetExtent(R) then R.Move(VOffset.x,VOffset.y) and
finally SetClip(R).
This sets the Clip variable to the full size of the group
while taking into account VOffset. Clip is maintained
in local (group interior) coordinates. See Clip below.
procedure SetState(AState: Word; Enable: Boolean); virtual;
Lock and UnLock are Not called when AState =sfActive,sfDragging:
*procedure SetVOffset(VX,VY : integer); virtual;
sets VOffset.x = VX, VOffset.y = VY and shifts Clip to
match the change in VOffset. Always set VOffset by calling
SetVOffset so Clip will be updated!
*procedure SetZoomLevel(ZL : byte);
reserved
*function ShiftScreen(var Event : TEvent; var Shift : TPoint) : boolean;
virtual;
returns false with no other action. Overridden in descendents
that shift or Pan the screen.
procedure Unlock;
if the LockFlag > 0 then decrements the LockFlag. Does not
make any drawing calls.
private
Clip: TRect; in use in TVGraphic
Maintained in local coordinates, not absolute screen coords!
For a group with an Interior that is shifted by VOffset,
Clip is maintained in the Interior's coordinate system by
shifting its x coords by VOffset.x and shifting its y
coords by VOffset.y. This is handled by SetVOffset.
{If VOffset = (0,0), the group's Interior is unshifted by
definition. Then SetClipToMax will set Clip.A to (0,0) and
Clip.B to (Size.x,Size.y)}
LockFlag: Byte; in use in TVGraphic
procedure DrawSubViews(P, Bottom: PView);
TV draws subviews from First (top view) to Last (bottom view).
TVGraphic draws subviews from Last to First. Parameter
"Bottom" is actually the "Top" subview redrawn in TVGraphic.
procedure FreeBuffer;
returns with no action
procedure GetBuffer;
returns with no action
procedure SetCurrent(P: PView; Mode: SelectMode);
does not call Lock and UnLock.
end;

------------------------

THistory and related views
These views are present but have not been converted to graphic mode.
THistoryViewer = object(TListViewer)
THistoryWindow = object(TWindow)
THistory = object(TView)
The Draw method does nothing.

------------------------
+ = emulates TV with exceptions noted

TgInputLine = object(TView)
+constructor Init(var Bounds: TRect; AMaxLen: Integer; Opts : byte);
Opts parameter added
DefaultBehavior = $00;
KillInstantErase = $01
procedure Draw; virtual;
rewritten
+procedure HandleEvent(var Event: TEvent); virtual;
Ctrl-Del deletes line
KillInstantErase prevents first keystroke from erasing line.
+procedure SelectAll(Enable: Boolean);
if KillInstantErase, positions cursor at end of selected block
end;

+ InputLine Palette
overall background is drawn in the background color of entries 1-2.
background of selected text uses background of entry 3.
InputLine outline uses background color of entry 4
arrows indicating text extends beyond view use foreground
color of entry 4
cursor is fixed white color.
text - uses entries 1-2. (If selected uses entry 2, not 3.)

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TgLabel = object(TgStaticText)
+constructor Init(var Bounds : TRect; AText : String;
ALink : PView; Opts : byte);
Opts: added parameter.
Works like Opts parameter in StaticText except
txCentered - flag is ignored.
txAdjustSize
The view's Origin will be set to Bounds.A
The view's Size.x will be adjusted to the length of
AText * Charlen plus BXOffset. Size.y will be set
to Boxheight-1. Will handle text with highlighted
characters.
Note that parameter Bounds will NOT be changed if this
flag is set - you can supply a Bounds based on a
TInputline, for example, and then later reuse the width
of Bounds for setting another matching TInputLine.

Font must be uniformly spaced, 8 pixels/char such as
Font8x8,Font8x14,SmallFont.
procedure Draw; virtual;
Color and Font selection same as StaticText Draw.
Uses BYOffset in vertical positioning of text within the view.
! Text is indented 4 (BXOffset) pixels from left edge of view.
end;

------------------------

TListBox = object(TListViewer)
+constructor Init(var Bounds: TRect; ANumCols: Word;
AScrollBar: PScrollBar);
modify to use horizontal scrollbar like in FileOpen dialog.
TV 2.0 has same modification.
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TListViewer = object(TView)
constructor Init(var Bounds: TRect; ANumCols: Word;
AHScrollBar, AVScrollBar: PScrollBar);
OldTopItem := -1;
VFont := DefaultListViewerFont
constructor Load(var S: TStream);
set OldTopItem := -1 after loading standard fields
procedure ChangeBounds(var Bounds: TRect); virtual;
set OldTopItem := -1, then TV behavior
procedure Draw; virtual;
draws the complete view or just parts needing update
depending on boolean PartialRedraw.
*procedure DrawSelf;
decides whether partial or complete redraw of the view
is needed using Focused and OldTopItem. Sets boolean
PartialRedraw and calls DrawView.
procedure HandleEvent(var Event: TEvent); virtual;
calls DrawSelf rather than DrawView. Other redraw limiting.
TV 1.0 Bug fixes from TV 2.0 incorporated.
procedure SetRange(ARange: Integer);
set OldTopItem := -1 plus TV behavior
procedure SetState(AState: Word; Enable: Boolean); virtual;
Calls TView.SetState then
if AState is sfSelected or sfActive, calls DrawView.
Does not affect any scrollbars.
private
*PartialRedraw : boolean; {temp var}
*OldFocused : integer; {temp variable, used with partial redraws}
*OldTopItem : integer; {temp variable, used with partial redraws}
end;

+ ListViewer Palette
background drawn in background color of entry 1
outline of view uses background of entry 5
vertical divider uses foreground of entry 5
text - same as TV

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TMenuView = object(TView)
*DrawPartial : boolean; ADDED
+function Execute: Word; virtual;
heavily modified - see Menus in section with general discussion of
view behavior. Menus are about the most convoluted code in TV -
details will have to wait for later.
+procedure HandleEvent(var Event: TEvent); virtual;
added ability to snap mouse cursor to grid in BoxMenus if
SnapToMenuGrid is true. Previous grid is saved and restored.
function NewSubView(var Bounds: TRect; AMenu: PMenu;
AParentMenu: PMenuView): PMenuView; virtual;
code commented out
end;

TMenuView Palette - used by all menus
menu background is background of entry 1
menu border color is background of entry 3

* PGMenu = ^TGMenu; {Ancestor of graphical menus}
* TGMenu = object(TMenuView)
Xsep : integer; {number of char spaces (not pixels) between bar menu items}
{initilize to the same value as the BarMenu Xsep for Box menus also!}
Constructor Init(var Bounds : TRect; AMenu : PMenu);
function NewSubView(var Bounds: TRect; AMenu: PMenu;
AParentMenu: PMenuView): PMenuView; virtual;
code moved here from TMenuView.NewSubView
*procedure FillWindow(BorderColor,AColor : integer; FatBorder : boolean);
draws a Bar3d the size of the menu with border
constructor Load(var S: TStream);
procedure Store(var S: TStream);
end;


* PGMenuBar = ^TGMenuBar; {TVGraphic Bar Menu}
* TGMenuBar = object(TGMenu)
+Constructor Init(var Bounds : TRect; AMenu : PMenu);
Bounds.B.Y := Bounds.A.y + MenuBarHeight -1;
legend separation - if there are few enough entries, the separation
between legends will be set at 3 spaces, otherwise to 2 as in TV.
VFont := DefaultMenuFont;
procedure GetItemRect(Item: PMenuItem; var R : TRect); virtual;
procedure Draw; virtual;
end;


* PGMenuBox = ^TGMenuBox; {TVGraphic Box menu}
* TGMenuBox = object(TGMenu)
Indent : integer; {legend starts this many pixels left of window edge}
+constructor Init(var Bounds : TRect; AMenu : PMenu;
AParentMenu : PMenuView);
vertical size set to (number of entries +2) times MenuBoxHeight
Indent := Charlen;
VFont := DefaultMenuFont;
procedure GetItemRect(Item: PMenuItem; var R : TRect); virtual;
procedure Draw; virtual;
draws a cursor in left column of menu next to selected entry
plus usual menu.
constructor Load(var S: TStream);
procedure Store(var S: TStream);
end;

+ Menu Palette
background is drawn in background of entry 1
border uses background of entry 3
text - same as TV

------------------------
* = unique to TVGraphic

Unit GMenu
TVGraphic view for temporarily displaying instructions at
top edge of screen - covers MenuBar while visible.
* PGMessageBar= ^TGMessageBar;
* TGMessageBar = object(TView)
MessageText : Str80; {temp var, not saved}
constructor Init;
View is set to same size as MenuBar
State := State and not sfVisible; {set invisible!!}
handles broadcast events.
VFont := DefaultMenuFont;
procedure Busy;
shows message 'WORKING...'
procedure HandleEvent(var Event : TEvent); virtual;
responds to any cmCancel or mouse buttons by calling Hide.
procedure Hide;
calls MenuBar to redraw itself.
procedure ShowText(AText : Str80);
centers AText in the view and calls Draw.
AText may contain sections highlighted with ~'s.
procedure Draw; virtual;
uses menu palette colors. text in Selected colors.
end;

MessageBar Palette
maps directly to the Application palette - uses menu colors
background drawn in background color of entry 2
outline uses background of entry 4
normal text uses foreground of entry 5
highlighted text uses foreground of entry 7

------------------------
* = unique to TVGraphic

Unit GWindow
TPanWindow is a window with a viewable Interior larger than its
Size. It is designed to pan (shift) its Interior when
the mouse cursor reaches the edges of the screen. The usual
way to use this window is to size it to fill the entire DeskTop
DeskTop^.GetExtent(Bounds)
PanWindow.Init(Bounds,...
and then insert other TViews,TGroups,TSubWindows into the window.
Nesting of TPanWindows is not defined, but you can insert
more than one into the DeskTop. TPanWindow requires a MenuBar
but not a StatusLine.
The selected TPanWindow receives evCommand Events from the invisible
ShiftViewPtr view when ShiftView detects the mouse cursor in the
MenuBar or the StatusLine.
TPanWindow calls ShiftViewPtr^.HandleEvent to update it when
the Interior shifts or the window's State changes.
(The ShiftViewPtr view displays messages about panning
by calling the MessageBar view.)


* PPanWindow = ^TPanWindow;
* TPanWindow = object(TWindow)
InteriorSize : TPoint; {size of interior in pixels}
Mode : byte; {initialized to 0, reserved}
ScrnShiftSize : TPoint; {number of pixels to shift by}
constructor Init(var Bounds : TRect; ATitle : TTitleStr;
ANumber : integer; TheInteriorSize : TPoint; ThePanSteps : TPoint);
calls TWindow.Init, then sets
GrowMode := 0; {Size is fixed}
Flags := wfClose; {window can close, not move}
Frame^.VOptions := tfDrawBackground;
causes Frame to draw a background for the window
InteriorSize := TheInteriorSize;
The size of the Interior in pixels
ScrnShiftSize := ThePanSteps;
The number of pixels to shift by when panning

function CurAtEdge(Event : TEvent; var Delta : TPoint;
AllowMenuAccess : boolean) : boolean; virtual;
Returns true if Event is a screen shifting event as defined
below AND the Interior is able to shift in the indicated
direction, otherwise false.
Handles evMouseMove plus evCommand where commands
are either cmShiftScreenDown or cmShiftScreenUp.
Behavior at top of screen:
>Bug if setting AllowMenuAccess false.
panning is unreliable due to menubar eating
mousemoves that in menu but not at screen top<
If AllowMenuAccess is false or PanWindow is the Modal view, then
will return true when cursor is 20 pixels or less from top
of screen, otherwise will return true only when cursor reaches
top of screen (Y=0).
Behavior at bottom of screen
If PanWindow is the modal view, will
return true when cursor goes below the window bottom
or is greater than or equal to MCur.MaxGridY.
OR If no StatusLine then
returns true if cursor is greater than or equal
to MCur.MaxGridY.
Behavior at sides of screen
Returns true if cursor is greater or equal to
MCur.MaxGridX or less than or equal to MCur.MinGridX.
Function sets Delta with number of pixels to pan by. This will be
either the +-X or +-Y value of ScrnShiftSize. (Unless Interior
is closer than that to its edge. In that case, Delta will be set
with number of pixels to the edge.)
procedure GetFullPanSize(var ISize : TPoint); virtual;
ISize is set to InteriorSize. Called by Frame to get
coords for outline rectangle.
procedure HandleEvent(var Event : TEvent); virtual;
calls TWindow.HandleEvent and then
if Event.What is evMouseMove or evCommand, calls
CurAtEdge. If CurAtEdge returns true, then calls
ShiftScreen (with value of Delta from CurAtEdge
as parameter Shift) to shift the Interior.
Handles window commands cmNext and cmPrev.
function ShiftScreen(var Event : TEvent;
var Shift : TPoint) : boolean; virtual;
Uses Shift to change VOffset by calling SetVOffset.
Calls ShiftViewUpdate for vertical shifts.
Draws the window with its interior in the new position.
Moves the mouse cursor by the amount the Interior
has shifted so it will be over the same spot of the
Interior.
procedure ShiftViewUpdate;
Creates a Broadcast Event where Event.Command =
cmScreenShifted and calls ShiftViewPtr^.HandleEvent;
procedure SetState(AState : word; Enable : boolean); virtual;
Calls ShiftViewUpDate if AState = sfSelected.
Calls TWindow.SetState.
procedure SetVOffset(VX,VY : integer); virtual;
resets Vx,Vy to be multiples of the current mouse grid,
then calls TGroup.SetVOffset.
constructor Load(var S : TStream);
loads the view from a stream
procedure Store(var S : TStream);
stores the view to a stream
end;

------------------------
+ = emulates TV with exceptions noted

TgParamText = object(TgStaticText)
+constructor Init(var Bounds: TRect; AText: String;
AParamCount: Integer; Opts : byte);
Opts: added parameter - see TStaticText description
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

commands
cmNew = 30;
cmOpen = 31;
cmSave = 32;
cmSaveAs = 33;
cmSaveAll = 34;
cmChangeDir = 35;
cmDosShell = 36;
cmCloseAll = 37;
help context
hcNew = $FF01;
hcOpen = $FF02;
hcSave = $FF03;
hcSaveAs = $FF04;
hcSaveAll = $FF05;
hcChangeDir = $FF06;
hcDosShell = $FF07;
hcExit = $FF08;
hcUndo = $FF10;
hcCut = $FF11;
hcCopy = $FF12;
hcPaste = $FF13;
hcClear = $FF14;
hcTile = $FF20;
hcCascade = $FF21;
hcCloseAll = $FF22;
hcResize = $FF23;
hcZoom = $FF24;
hcNext = $FF25;
hcPrev = $FF26;
hcClose = $FF27;

TProgram = object(TGroup)
+constructor Init;
size Program to full graphics screen.
call order changed, call InitDeskTop after
InitStatusLine,InitMenuBar
+function ExecuteDialog(P: PGDialog; Data: Pointer): Word;
same as ExecuteDialog in TV 2.0
*procedure SetPalette(Pal : TPalette);
Copies palette values in Pal into the Application's palette.
+procedure InitDeskTop; virtual;
Sizes DeskTop to fill space between the MenuBar and the StatusLine.
{User does not have to have a MenuBar or StatusLine.}
procedure InitMenuBar; virtual;
never call - always override or don't call at all
+procedure InitStatusLine; virtual;
sets vertical size to MenuBoxheight. Usually overridden.
procedure SetScreenMode(Mode: Word);
shortened to SetVideoMode(Mode);
DoneMemory;
InitScreen;
Do not call this method while in BGI graphics mode!
end;

------------------------

TgRadioButtons = object(TgCluster) unmodified

------------------------
+ = emulates TV with exceptions noted

TRect
+procedure Intersect(R: TRect);
adjust to match graphic coord system
+function Empty : boolean;
adjust to match graphic coord system
Note - a rectangle with all four coords equal is NOT empty in TVGraphic.
An empty rectangle is not set to all zeros -
Always call Empty function to check.
+function Contains : boolean;
adjust to match graphic coord system

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

const for TScrollBar
CharHt = 14; not user changable
Scrollbars make alot of calculations based on assumptions
about character size. For these calculations, a scrollbar
thinks in terms of characters that are 8 pixels wide by 14
pixels tall. If your horizontal scrollbar Size is not a
multiple of 8 pixels or vertical bar is not a multiple of
14 pixels, then the indicator will not go all the way to
the right/bottom of the bar.
Things still work however.
You will not normally have to think about this.

TScrollBar = object(TView)
constructor Init(var Bounds: TRect);
If Bounds is wider than it is tall, the scrollbar will be
initialized as a horizontal scrollbar, otherwise as vertical.
The thickness of the scrollbar is set using the constant
ScrollBarWidth independent of Bounds or whether a vertical
or horizontal bar. The actual thickness is ScrollBarWidth
plus one pixels.
The scrollbar moving indicator character has changed.
Refer to TV documentation for the rest.
VFont is set to Font8x8. Other fonts are not likely to work!
procedure Draw; virtual; unchanged
*function Exposed : boolean; virtual;
added to handle Panning windows.
*procedure MakeLocal(Source: TPoint; var Dest: TPoint); virtual;
added to handle Panning windows.
*procedure SetState(AState: Word; Enable: Boolean); virtual;
calls TView.SetState and then calls DrawView if AState=sfActive.
Note that this means a scrollbar changes State independently
and does not require a TScroller view be present.
private
procedure DrawPos(Pos: Integer);
does the actual drawing, modified for graphics
Draws only the scrollbar (blue) background if not Active.
end;

+ ScrollBar Palette
overall background is drawn in background of entry 1
crosshatch is drawn using foreground of entry 1
indicators and arrows - same as TV

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TScroller = object(TView)
procedure ChangeBounds(var Bounds: TRect); virtual;
does NOT redraw the view
procedure SetState(AState: Word; Enable: Boolean); virtual;
calls TView.SetState. Does not have any affect on
any scrollbars pointed to by fields HScrollBar
or VScrollBar.
end;

------------------------
* = unique to TVGraphic

TShiftView, Unit GWindow
Special view for sensing mouse position at top edge of screen
and within the StatusLine, if one exists.
If cursor enters these areas and the selected window is a
TPanWindow and its interior can shift, then Shiftview uses
the MessageBar to display message about panning to user.
If right button is clicked in these areas, ShiftView issues
commands targeted at TPanWindow. These commands will cause the
TPanWindow's Interior to shift down if cursor is at top of
screen or up if cursor is in StatusLine.
ShiftView uses the MessageBar to display its messages -
so application must initialize the MessageBar.

* PShiftView = ^TShiftView;
* TShiftView = object(TView)
ScreenIsShiftedDown : boolean; read only
ScreenIsShiftedUp : boolean; read only
MessageDisplayed : boolean; read only
constructor Init(var Bounds: TRect);
calls TView.Init whic sets the booleans fields false.
then sets EventMask := EventMask or evMouseMove or evBroadcast;
procedure HandleEvent(var Event : TEvent); virtual;
responds to broadcasts of (Event.Command = cmScreenShifted)
by checking the InfoWord. If upper or lower byte = 'T' then
sets either ScreenIsShiftedDown,ScreenIsShiftedUp.
MouseEvents
evMousemove
if cursor is at top of screen or in StatusLine,
then displays message
'CLICK RIGHT BUTTON TO PAN SCREEN'
Clears the message if cursor moves out of these
areas.
evMouseDown and right button
if cursor is at top of screen or in StatusLine,
then issues a evCommand event with either
Command = cmShiftScreenDown or cmShiftScreenUp
Uses the MessageBar to display its messages.
constructor Load(var S : TStream);
loads the view from a stream
procedure Store(var S : TStream);
stores the view on a stream
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TgStaticText = object(TView)
+constructor Init(var Bounds : TRect; AText : String; Opts : byte);
OPts: added parameter
(examples: OPts := DefaultOpts;
Opts := txCentered + txDrawBackground)
DefaultOpts - no options
txCentered - if width of AText will fit in the view's Bounds,
centers text horizontally in Bounds and then
shrinks Bounds.A.x,Bounds.B.x to just contain AText.
Works with any font.
txAdjustSize - if width of AText will fit in the view's Bounds
adjusts Bounds.B.x to just contain AText. Works
with any font.
txDrawBackground - for maximum speed and minimum flicker, StaticText
does Not normally draw a background in TVGraphic. This is
almost never a problem with the short strings in Dialogs.
If you use a StaticText view wider than the narrowest
window/dialog you will ever drag across it, then you need
a background for partial screen redraws. Use this flag.

VColor is set to TVColor which causes Draw to use the palette
instead of VColor for color slection. To override, after Init
set VColor to desired color pair (byte). Format is the same as
Application palette entries.
Font selection - if lower 4 bits of Opts are not 0, then VFont
is set to equal to the lower four bits which represent a font
number. If 0, then VFont is set to DefaultDialogFont.
(Note this precludes your using the BGI DefaultFont which does
not clip properly.)
String Formating
If multiple lines, view will draw them spaced Boxheight apart.
AText may have the usual embedded formating characters ^M and ^C.
^C centers following text (up to a ^M) in the view.
^M causes following text to start on a new line.
The automatic line wrapping at the right side of the view and
the ^C centering of text assume the selected text font
is 8 pixels wide/character.

procedure Draw; virtual;
If multiple lines, view will draw them spaced Boxheight apart.
Uses the palette for colors unless VColor is not equal to TVColor.
Then uses the color pair in the lower byte of VColor for
text color and background.
Uses the text font stored in VFont.
Uses BYOffset in vertical positioning of text within the view.
! Text is indented 4 pixels from left edge of view.
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TGStatusLine = object(TView)
+constructor Init(var Bounds: TRect; ADefs: PStatusDef);
VFont := DefaultMenuFont;
procedure Draw; virtual; {unmodified - calls DrawSelect}
+procedure HandleEvent(var Event: TEvent); virtual;
passes right mouse button presses through with no action.
NOTE: when the StatusLine issues a command due to keypress's and
mouse buttons, TVGraphic sets the InfoPtr to @Self while
TV sets it to nil. This means that you can't close a window from
the StatusLine in TVGraphic since windows expect InfoPtr = nil.
The change enables future implementation of TVGraphic features.
private
procedure DrawSelect(Selected: PStatusItem); {rewritten for graphics}
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

Unit GWindow
TSubWindow is an ordinary window except for its GetPalette function.
Use TSubWindow when inserting a window into another window to get
correct drawing colors. TSubWindow will also work in any situation
where a regular TWindow works.

* PSubWindow = ^TSubWindow; {can be inserted into a window}
* TSubWindow = object(TWindow)
+function GetPalette : PPalette; virtual;
usual behavior unless window's owner is a TWindow,
a TSubWindow or a TPanWindow. In these cases, GetPalette
calls its owner's GetPalette.
end;


------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

In unit GObjects.
A simple collection of strings using PString pointers.
Use function NewStr(AString) to create a string and return
a PString pointer. Insert the pointer into the collection.
The collection knows how to store, load and dispose of strings.

* PUnSortedStringCollection = ^TUnSortedStringCollection;
* TUnSortedStringCollection = object(TCollection)
+procedure FreeItem(Item : Pointer); virtual;
same as TStringCollection
+function GetItem(var S : TStream) : pointer; virtual;
same as TStringCollection
+procedure PutItem(var S : TStream; Item : pointer); virtual;
same as TStringCollection
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TView = object(TObject)
*Hook : TUserHook; {for users of TVGraphic}
*VColor : word; {color pair(s) if overriding palette selection}
*VFont : byte; {for text font storage}
*VOptions : byte; {TVGraphics options}
*VOffset : TPoint; {used to offset the screen across a graphical
view that is larger then the screen.}
{Used by MakeLocal,MakeGlobal,Exposed}
*ZoomLevel : byte; {reserved by TVGraphics}

constructor Load(var S: TStream);
loads added fields
! procedure ChangeBounds(var Bounds: TRect); virtual;
ChangeBounds does NOT redraw the view. Merely calls SetBounds.
procedure DragView(Event: TEvent; Mode: Byte;
var Limits: TRect; MinSize, MaxSize: TPoint);
lock cursor while dragging,
calls DrawView after dragging.
when using arrow keys to move, jump is based on current mouse grid.
Shift arrow keys change size.
Bug if you move and resize and then hit escape to undo.
procedure Draw; virtual;
does nothing
function Exposed: Boolean; virtual;
made virtual;
checks (Owner<>nil), sfExposed, sfVisible,
LockFlag, intersection of view with Clip
procedure GetClipRect(var Clip: TRect);
returns Clip in local coordinates,modified to work with VOffset.
*function ForeColor(Color: Word): byte;
returns bits 0-3 of Color in lower 4 bits of the byte
*function BackColor(Color: Word): byte;
returns bits 4-7 of Color in lower 4 bits of the byte
*procedure GetScreenCoords(var R : TRect);
sets R to the absolute screen coords of the outline of the view.
Takes VOffset of any owner's into account.
R.A is upper left corner, R.B is lower right corner.
These coords are usefull for setting the viewport to match
the outline of the view.
R is in same coord system as mouse coords.
*procedure GetVPRelCoords(var R : TRect);
same as GetScreenCoords except R is Viewport relative.
Example: Passing R to the Rectangle call will draw a
rectangle outlining the view independent of the
viewport setting. Of course if the viewport is too small,
the rectangle will be clipped. If the viewport is
set to full screen, GetVPRelCoords returns same numbers
as GetScreenCoords.
procedure Locate(var Bounds: TRect);
implements partial redraws, major design changes
procedure MakeGlobal(Source: TPoint; var Dest: TPoint);
rewritten
coordinate transformation Source to Dest.
Source should be in view's local coordinate system -
if view is a descendent of TGroup, then Source should be
in the coordinate system of the view's Interior.
Dest is in absolute screen coords (mouse coords)
procedure MakeLocal(Source: TPoint; var Dest: TPoint); Virtual;
rewritten, made virtual;
coordinate transformation Source to Dest.
Source should be in absolute screen coords (mouse coords).
Dest is in coordinate system of view or in coordinate
system of view's Interior if view is TGroup descendent.
function MouseInView(Mouse: TPoint): Boolean; virtual;
made virtual;
procedure PutInFrontOf(Target: PView);
modified
procedure ResetCursor; virtual;
was Private method, now public.
performs no action - users can override in descendents.
procedure Select;
fix TV 1.0 bug, add test that view is selectable before selecting
procedure SetState(AState: Word; Enable: Boolean); virtual;
call ResetCurrent before DrawShow,DrawHide
procedure Store(var S: TStream);
stores added fields
*function UserHook(var P : Pointer; var R : TRect) : boolean; virtual;
provided for TVGraphic users to override in descendents.
TView version returns false and does not change its parameters.
{Following methods are not present in TVGraphic:
procedure WriteBuf(X, Y, W, H: Integer; var Buf);
procedure WriteChar(X, Y: Integer; C: Char; Color: Byte;
Count: Integer);
procedure WriteLine(X, Y, W, H: Integer; var Buf);
procedure WriteStr(X, Y: Integer; Str: String; Color: Byte); }
private
procedure DrawUnderRect(var R: TRect; LastView: PView);
totally different design. Minimizes number of redrawn views.

made public - procedure ResetCursor; virtual;
end;

------------------------
* = unique to TVGraphic

Unit GWindow
TWinBackground is a simple view for providing a background
in a window. It does not handle events.

* PWinBackground = ^TWinBackground;
* TWinBackground = object(TView)
constructor Init(var Bounds: TRect);
calls TView.Init, then sets
GrowMode := gfGrowHiX + gfGrowHiY;
EventMask := 0;
VColor := TVColor;
procedure Draw; virtual;
fills view with solid color.
If VColor = TVColor then color from palette will match
the color that TFrame will use (if one is present) for
its background. Otherwise will use VColor as background color.
end;

------------------------
* = unique to TVGraphic
+ = emulates TV with exceptions noted

TWindow = object(TGroup)
+constructor Init(var Bounds: TRect; ATitle: TTitleStr; ANumber: Integer);
sfShadow flag in State is not set.
*procedure Draw; virtual;
hides and locks the mouse cursor
Sets viewport to the intersection of Clip and the window outline.
Calls TFrame.Draw if dragging, otherwise TGroup.Draw.
Restores the viewport to previous size and unlocks the mouse cursor.
*procedure GetMaxSubViewSize(var R : TRect); virtual;
{was named GetInteriorSize in inital release}
if Frame <> nil then calls Frame^.GetInteriorSize(R),
otherwise calls GetExtent(R) and then shrinks R by one pixel
on all four sides to allow for an outline rectangle for the window.
+procedure HandleEvent(var Event: TEvent); virtual;
if Event.Command = cmZoom and the Zoom flag is set, then will zoom.
(Does not depend on value of Event.InfoPtr.)
procedure SetState(AState: Word; Enable: Boolean); virtual;
rewritten for nested windows. Same behavior as TV.
function StandardScrollBar(AOptions: Word): PScrollBar;
if the window has a Frame then the Frame's VOption field
is set with tfVScrollBar or tfHScrollBar depending on AOptions.
Next the scrollbar is sized and its width is set using constant
ScrollBarWidth. A new scrollbar is created and inserted into the
window. If AOptions includes sbHandleKeyboard, the scrollbar
Options are set to include ofPostProcess. Finally a pointer to
the scrollbar is returned as the value of StandardScrollBar.
end;

+ Window Palette
see Reference section under Application Palette






 December 22, 2017  Add comments

Leave a Reply