home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
library
/
dos
/
tegl_ii
/
intro
/
teglunit.doc
< prev
next >
Wrap
Text File
|
1991-08-16
|
15KB
|
330 lines
{-----------------------------------------------------------------------------}
{ TEGL Windows ToolKit II }
{ Copyright (C) 1990, 1991 TEGL Systems Corporation }
{ All Rights Reserved. }
{-----------------------------------------------------------------------------}
{$I switches.inc}
Unit TEGLUnit;
INTERFACE
USES
Crt, {clear keyboard}
Errorlog,
VirtMem, {virtual Memory}
IPStacks,
TEGLIntr, {keyboard/mouse}
FastGrph;
const
MSSense = TRUE;
MSClick = FALSE;
Vertslice : boolean = false;
TYPE
{ The four pointers below provides the total integration of TEGL, of which the
ImageStkPtr is the main structure that ties everything together. The
hierarchy is such that the MsClickPtrs and KeyClickPtrs are pointer chained
within an Imagestkptr. }
TimeTickPtr = ^TimeTickStk;
KeyClickPtr = ^KeyClickStk;
MsClickPtr = ^MSClickStk;
ImageStkPtr = ^ImageStack;
{ Global Keyclickptr --> Keyclickptr --> Keyclickptr
| \
| \
| \
ImageStkPtr --> ImageStkPtr --> ImageStkPtr
| | | | | |
Local Keyclickptr | Keyclickptr | Keyclickptr |
msclickptr msclickptr msclickptr
/
/
/
TimeTickPtr --> TimeTickPtr --> TimeTickPtr
}
Callproc = Function(FS:ImageStkPtr; MS: MsClickPtr):Word;
Dataproc = Function(FS:ImageStkPtr; Userkey:word; Var DataArea):Word;
XYX1Y1Rec = RECORD
x,y,x1,y1 : Word; {coordinate structure for msclick}
END;
TimeTickStk = RECORD
nexttimetick : TimeTickptr; {chain of timer tick events}
timepiece : timerecptr; {timer counter, flag}
signature : longint; {signature for dropping timer ticks}
entrycallproc : callproc; {timer event - when flag is true}
fs : ImageStkPtr; {related fs/ms for event}
ms : MsClickPtr;
END;
KeyClickStk = RECORD
nextkeyclick : Keyclickptr; {chain of keyboard click areas}
keycode : Word; {scancode for capturing}
entrycallproc : callproc; {event for scancode activation}
fs : ImageStkPtr; {related fs/ms for event}
ms : MsClickPtr;
END;
MSClickStk = RECORD
nextmsclick : MsClickPtr; {mouse click chains}
ClickNumber : Word; {assignable key for mouse click}
ms : XYX1Y1Rec; {mouse x,y,x1,y1 region}
msactive : Boolean; {sets inactive mode of mouse}
entrycallproc : callproc; {normal mouse click call event}
senseactivate : Boolean; {true-sense,false-mouse click}
sensehighlight : Boolean; {enables supervisor to auto }
{highlight a mouse click area}
MouseButtons : word; {Defines the active mouse button}
{2-right mouse button}
DoubleCallproc : callproc; {double click event}
MouseMask : maskptr; {autochanging of mouse mask}
xHotSpot : word; {mouse hot spot of mouse mask}
yHotSpot : word;
IPPtr : imagepartial; {Mouse click image partials}
{used in sliders and pop-off buttons}
END;
FrameChangePtr = ^FrameChange;
FrameChange = Record
FrameEnter : callproc; {Frame Enter Event}
FrameExit : callproc; {Frame Exit Event}
EnterMask : maskptr; {Enter frame Mouse Mask}
XEHS,YEHS : word; {Enter frame Mouse Hotspots}
ExitMask : maskptr; {Exit frame Mouse Mask}
XXHS,YXHS : word; {Exit frame Mouse Hotspots}
end;
UserRecPtr = ^UserRecord;
UserRecord = Record
NxtUserPtr : UserRecPtr; {user data area chains}
UserKey : word; {user assigned key for retrieving data}
UserDataArea : pointer; {pointer to userdata}
UserTerminate : dataproc; {terminating call event}
end;
PendingPtr = ^PendRecord;
PendRecord = Record
NxtPendPtr : PendingPtr; {pending event chains}
PendCallproc : callproc; {pending call proc}
PendingFS : imagestkptr; {pending matching FS}
PendingClose : boolean; {ignore close pending if false}
end;
moveptr = ^moverecord;
moverecord = record
nxtmove : moveptr;
movecallproc : callproc; {a user definable event when frame is
{moved}
end;
ImageStack = RECORD
nxtptr : ImageStkPtr; {forward chain of Frames}
lstptr : ImageStkPtr; {backward chain for frame stack}
signature : longint; {time code signature}
FrameActive : Word; {set by resetframeactive for locking}
{events from occuring}
x,y,x1,y1 : Word; {frame coordinates}
movable : Boolean; {flag indicating mobility of frame}
movecallproc : moveptr; {move event chain}
iconframe : pointer; {icon for putpict when moving frame}
iconcolor : word; {icon color}
emptyframe : boolean; {flag indicating empty frame}
autorotate : boolean; {indicator if frame can be rotated up}
RestrictMoveF : XYX1Y1Rec; {move area restriction}
MinMaxStretch : XYX1Y1Rec; {minimum/maximum resize}
Resizecallproc : callproc; {required event for re-drawing frame}
{after frame has been re-sized}
ImageActive : Boolean; {frame hiding/showing flag}
relatedstack : ImageStkPtr; {related fs for use in Menus and explodes}
relatedmsclick : MsClickPtr; {related ms for use in Menus and explodes}
relatedsignate : longint; {related signate for use in pending}
chainedstack : ImageStkPtr; {chained fs sub menu}
chainedmsclick : MsClickPtr; {chained ms sub menu}
IPPtr : imagepartial; {image partial chain}
IPTop : imagepartial; {image partial top of chain}
keyPtr : KeyClickPtr; {key chain for local keyclicks}
MsPtr : MsClickPtr; {ms chain for mouse click areas}
MsClickCount : Word; {ms clicks counts}
fschangePtr : Framechangeptr;{frame enter/exit events}
UserDataPtr : UserRecPtr; {user data chain}
END;
const
{*------------------------------------------------------------------------*
| Window Stack |
*------------------------------------------------------------------------*}
StackPtr : ImageStkPtr = NIL; {Central Image Stack}
KeyStackPtr : KeyClickPtr = NIL; {Global Key Stack}
TimeStackPtr : TimeTickPtr = NIL; {Global Time Stack Ptr}
PendStackPtr : PendingPtr = NIL; {Global Pending Stack Ptr}
FunctionKeyCode : Word = 0; {last TEGLKeypress}
AutoRotateUp : Boolean = FALSE; {set on for autorotate}
LastFSDetect : ImageStkPtr = NIL; {last detect fs/ms values}
LastMSDetect : MsClickPtr = NIL; {used in cursor mask changes}
StandardMask : Maskptr = nil; {and mouse click highlighting}
Standardxhs : word = 0;
Standardyhs : word = 0;
CurrentMask : Maskptr = nil;
Currentxhs : word = 0;
Currentyhs : word = 0;
MaxWindowSize : longint = $00020000; {Maximum size for frame partial}
{ $7fffffff - no size limit}
{ $00008000 - 32k limit}
{ $00004000 - 16k limit}
VAR
CtrlBreakProc : CallProc;
{*------------------------------------------------------------------------*
| Image Stack routines |
*------------------------------------------------------------------------*}
Function FrameExist(fs:ImageStkPtr) : Boolean;
Function CountFrames : Word;
Procedure PushImage(x,y,x1,y1 : Word);
Procedure PushEmptyImage(x,y,x1,y1 : Word);
Procedure PopImage;
Procedure PrepareForPartialUpdate(FS:ImageStkPtr; x,y,x1,y1: Word);
Procedure PrepareForUpdate(FS:ImageStkPtr);
Procedure CommitUpdate;
Procedure SetFrameAutoRotate(fs:imagestkptr; Autorotate:boolean);
Procedure RotateStackImage(FS1,FS2 :ImageStkPtr);
Procedure RotateUnderStackImage(FS1,FS2 :ImageStkPtr);
Procedure MoveFrame(VAR fx,fy,fx1,fy1 : Integer; rx,ry,rx1,ry1: Integer; Color : Integer);
Function FrameSelectAndMove(mxpos,mypos : Word) : ImageStkPtr;
Function SelectandMoveFrame(fs:ImageStkPtr; MouseClickPos: MsClickPtr) : Word;
Procedure SetMoveRestrictions(fs:ImageStkPtr; x,y,x1,y1:Word);
Procedure SetFrameMobility(fs:ImageStkPtr; movable : Boolean);
Procedure DropMoveFrameCallProc(fs:ImageStkPtr; EntryCallProc:callproc);
Procedure SetMoveFrameCallProc(fs:ImageStkPtr; EntryCallProc:callproc);
Procedure LinkFS(nfs,cfs:ImageStkPtr);
Procedure LinkUnderFS(nfs,cfs:ImageStkPtr);
Procedure UnLinkFS(fs:ImageStkPtr);
Procedure HideImage(fs:ImageStkPtr);
Procedure ShowImage(fs:ImageStkPtr; x,y:Word);
Procedure MoveStackImage(fs:ImageStkPtr; x,y : Word);
Procedure DropStackImage(fs:ImageStkPtr);
Procedure CreateImageBuffer(VAR fs:ImageStkPtr; x,y,x1,y1 : Word);
Procedure DropImageBuffer(fs:ImageStkPtr);
Procedure FreeImageBuffer(fs:ImageStkPtr);
Function GetFrontImage(fs:ImageStkPtr):ImageStkPtr;
Function GetPartialFrontImage(FS:ImageStkPtr; x,y,x1,y1:Word):ImageStkPtr;
Function GetPartialBackImage(FS:ImageStkPtr; x,y,x1,y1:Word):ImageStkPtr;
Function GetBackImage(fs:ImageStkPtr):ImageStkPtr;
Procedure GetFSImage(x,y:Word; fs:ImageStkPtr);
Procedure PutFSImage(x,y:Word; fs:ImageStkPtr; RmwBits:Word);
function SliceImagePartials(lastip:imagepartial; x,y,x1,y1:word):imagepartial;
Procedure ReSizeFrame(fs:ImageStkPtr; x,y,x1,y1:Word);
Procedure SetImageActive(fs:imagestkptr; ImageActive:boolean);
Procedure SetFrameEnterCallProc(fs:ImageStkPtr; EntryCallProc:callproc);
Procedure SetFrameExitCallProc(fs:ImageStkPtr; EntryCallProc:callproc);
Function ChangeUserDataKey(fs:ImageStkPtr; Userkey,NewKey:word) : boolean;
procedure GetUserDataArea(fs:imagestkptr; Userkey:word; Var Userdata);
Procedure SetUserDataArea(fs:ImageStkPtr; Userkey:word; Var Userdata; TerminatedataProc:dataproc);
Procedure DropUserDatabykey(fs:imagestkptr; Userkey:word);
Procedure DropUserDataArea(fs:imagestkptr; UD:userrecptr);
function GetfirstUserDataArea(fs:imagestkptr;TerminatedataProc:dataproc; Var Userdata):UserRecPtr;
function GetnextUserDataArea(UD:userrecptr; Var Userdata):UserRecPtr;
Procedure SetEnterExitMouseMask(fs:ImageStkPtr; EnterMask:maskptr; XEHS,YEHS:word;
ExitMask:maskptr; XXHS,YXHS:word);
Procedure SetStandardMouseMask(MouseMask:maskptr; Xhotspot,Yhotspot:word);
procedure SetFSIPCoords(fs:imagestkptr; x,y:word);
function FramesOverlapped(fs1,fs2:imagestkptr) : boolean;
{*------------------------------------------------------------------------*
| Utility Routines |
*------------------------------------------------------------------------*}
Procedure ClearKeyBoardBuf;
Procedure ClearTEGLKeyBoardBuf;
Procedure SetAutoRotate(onoff:Boolean);
function UserRelease : boolean;
procedure WaitForUserRelease;
{*------------------------------------------------------------------------*
| Find Mouse Screen positions |
*------------------------------------------------------------------------*}
Function FindFrame(mxpos,mypos : Word) :ImageStkPtr;
Procedure ResetFrameActive(fs:ImageStkPtr; active:Boolean);
{*------------------------------------------------------------------------*
| Mouse Click defines |
*------------------------------------------------------------------------*}
Function FindMouseClickPtr(fs:ImageStkPtr; Clicknumber:Word) : MsClickPtr;
Function MouseClickExist(fs:ImageStkPtr; ms:msclickptr) : Boolean;
Procedure ResetMouseClicks(fs:ImageStkPtr; ClickPtr:MsClickPtr);
Procedure ResetMSClickSense(fs:ImageStkPtr; NewSense:Boolean);
Procedure ResetMSClickCallProc(fs:ImageStkPtr; MouseClickNumber:Word; EntryCallProc:Callproc);
Procedure ResetMSClickActive(fs:ImageStkPtr; MouseClickNumber:Word; active : Boolean);
Procedure DefineMouseClickArea(fs:ImageStkPtr; x,y,x1,y1:Word; active:Boolean; EntryCallProc:callproc; sense:Boolean);
Procedure DropMouseClick(fs:ImageStkPtr; ms:MsClickPtr);
Function CheckMouseClickPos(fs:ImageStkPtr; mxpos,mypos:Word):MsClickPtr;
procedure ResetMSAssignmentNum(fs:imagestkptr; Startcount:word);
procedure AssignMouseClickNumber(fs:imagestkptr; ms:msclickptr; Clicknumber:word);
function GetLastMSPtr(fs:imagestkptr):msclickptr;
Procedure AddMouseClickMask(ms:MsClickPtr; MouseMask:maskptr; xhs,yhs:word);
Procedure DefineMaskClickArea(fs:ImageStkPtr; x,y,x1,y1:Word; active:Boolean;
EntryCallProc:callproc; sense:Boolean; MouseMask:maskptr; xhs,yhs:word);
Procedure AddDoubleClickCallproc(ms:MsClickPtr; DoubleCallProc:callproc);
Procedure DefineDoubleClickArea(fs:ImageStkPtr; x,y,x1,y1:Word; active:Boolean;
EntryCallProc:callproc; DoubleCallProc:callproc; sense:Boolean);
Procedure SetMSSenseHighlight(ms:MsClickPtr; AutoHighlight:boolean);
Procedure SetMouseButton(ms:MsClickPtr; mousebutton:word);
Procedure DefineIconFrame(x,y:word; Iconimage:pointer; iconcolor:word; active:Boolean; EntryCallProc:callproc; sense:Boolean);
{*------------------------------------------------------------------------*
| Key Click defines |
*------------------------------------------------------------------------*}
Procedure DefineGlobalKeyClickArea(fs:ImageStkPtr; ms:MsClickPtr; Keycode:Word; Repeatkey:Boolean; EntryCallProc:callproc);
Procedure DefineLocalKeyClickArea(fs:ImageStkPtr; ms:MsClickPtr; Keycode:Word; Repeatkey:Boolean; EntryCallProc:callproc);
Function FindKeyClickPtr(fs:ImageStkPtr; Keycode:Word) : KeyClickPtr;
Procedure DropKeyClick(fs:ImageStkPtr; Keycode:Word; EntryCallProc:callproc);
Procedure ResetKeyClickCallProc(fs:ImageStkPtr; KeyCode:Word; EntryCallProc:Callproc);
Procedure ResetLocalKeyClicks(fs:ImageStkPtr);
{*------------------------------------------------------------------------*
| Supervisor Loop |
*------------------------------------------------------------------------*}
Procedure ToggleOptionBar(fs:ImageStkPtr; opt,lastopt : MsClickPtr);
Function EventManager(VAR fs:ImageStkPtr; VAR ms:MsClickPtr):Word;
Procedure SetPendingEvent(fs:ImageStkPtr; pendcallproc: callproc);
Procedure ResetPendingCallProc(fs:ImageStkPtr; pendcallproc: callproc);
Procedure SetPendingClose(fs:ImageStkPtr; pendingclose: boolean);
function GetFSMS(var fs:imagestkptr; var ms:msclickptr) : word;
{*------------------------------------------------------------------------*
| Chain functions |
*------------------------------------------------------------------------*}
Procedure CheckCtrlBreak;
Procedure SetCtrlBreakFS(CBrkProc : callproc);
Procedure SetTimerTick(TimerInterrupt:Word; EntrycallProc:callproc; fs:ImageStkPtr; ms:MsClickPtr);
Procedure DropTimerTick(TimerInterrupt:Word; EntrycallProc:callproc);
Function NilUnitProc(fs:ImageStkPtr; ms:MsClickPtr):Word;
function NilDataProc(fs:ImageStkPtr; Userkey:word; Var DataArea):Word;
IMPLEMENTATION