home *** CD-ROM | disk | FTP | other *** search
- Library Lines;
-
- {define Debug}
-
- {$ifndef Debug}
- {$R-,I-,D-,L-,S-,V-,W-,G+}
- {$endif}
-
- {$C MOVEABLE PRELOAD DISCARDABLE}
- {$R LINES}
-
- Uses
- WinTypes,WinProcs,Strings,WinDOS;
-
- {$I ADD-IN.INC}
-
- Const
- LineThick : Integer = 2;
- DiscMode : Boolean = True;
-
- CLBVer : VerString = '2.00';
-
- {$D Lines Add-In. (C) 1992, 1993 by clySmic Software. All Rights Resv'd.}
-
- {-----------------------------------------------}
-
- { --- Perform Add-In's initialization --- }
-
- Function AddInInit(CurVer : PChar) : InitResult; Export;
-
- Begin
- Randomize;
-
- { Version check }
- If StrComp(CurVer,CLBVer) <> 0
- Then AddInInit := InitNotOk
- Else AddInInit := InitOk;
- End {AddInInit};
-
- {-----------------------------------------------}
-
- { --- Paint on the button (Clysbar does the background) --- }
-
- Procedure AddInPaint(Wnd : HWnd; DC : HDC; Pressed : Boolean); Export;
-
- Begin
- End {AddInPaint};
-
- {-----------------------------------------------}
-
- { --- Tell Clysbar what kind of timer we need --- }
-
- Function AddInTimerNeeded : Integer; Export;
-
- Begin
- AddInTimerNeeded := ait_Fast;
- End {TimerNeeded};
-
- {-----------------------------------------------}
-
- { --- Proc called when timer expires, perform timed duties --- }
-
- Procedure AddInTimerTick(Wnd : HWnd; DC : HDC); Export;
-
- Const
- xSav : Integer = 5;
- ySav : Integer = 5;
-
- Var
- Rect : TRect;
- OldPen,ThePen : HPen;
-
- Begin
- { If add-in is never uncovered, Wnd will be NULL }
- If Wnd = 0
- Then Exit;
-
- { Don't draw over button "edges" }
- GetClientRect(Wnd,Rect);
- InflateRect(Rect,-6,-6);
-
- { Draw a random line in a random color }
- ThePen := CreatePen(ps_Solid,LineThick,RGB(Random(256),Random(256),Random(256)));
- OldPen := SelectObject(DC,ThePen);
-
- If DiscMode
- Then Begin
- { Disconnected lines }
- MoveTo(Dc,Random(Rect.Right-2) + Rect.Left-2,
- Random(Rect.Bottom-2) + Rect.Top-2);
- LineTo(Dc,Random(Rect.Right-2) + Rect.Left-2,
- Random(Rect.Bottom-2) + Rect.Top-2);
- End
- Else Begin
- { Connected lines }
- MoveTo(DC,xSav,ySav);
- xSav := Random(Rect.Right-2) + Rect.Left-2;
- ySav := Random(Rect.Bottom-2) + Rect.Top-2;
- LineTo(DC,xSav,ySav);
- End;
-
- { Clean up }
- SelectObject(DC,OldPen);
- DeleteObject(ThePen);
- End {AddInTimerTick};
-
- {-----------------------------------------------}
-
- { --- Proc called when button pressed --- }
-
- Procedure AddInPressed(Wnd : HWnd; DC : HDC); Export;
-
- Begin
- LineThick := Random(4) + 1; {1..4}
-
- DiscMode := Not DiscMode;
-
- AddInPaint(Wnd,DC,False);
- End {AddInPressed};
-
- {-----------------------------------------------}
-
- { --- Exit processing for Add-In --- }
-
- Procedure AddInExit; Export;
-
- Begin
- End {AddInExit};
-
- {-----------------------------------------------}
-
- { --- Clysbar queries Add-In about itself (N.B.: not implemented yet) --- }
-
- Procedure AddInAbout(Str1,Str2 : PChar;
- Var TheIcon : HIcon;
- Var TitleCol,TxCol,BkCol : TColorRef); Export;
-
- Begin
- StrCopy(Str1,'Lines V2.00');
- StrCopy(Str2,'A Random Line Drawer'#13'⌐ 1992, 1993 by clySmic Software.'#13'All Rights Reserved.');
-
- TheIcon := LoadIcon(hInstance,'ABOUT');
-
- TitleCol := RGB(255,0,255);
- TxCol := RGB(128,0,128);
- BkCol := RGB(255,255,255);
- End {AddInAbout};
-
- {-----------------------------------------------}
-
- { --- Clysbar queries Add-In whether it'll accept d'n'd --- }
-
- Function AddInAcceptDrops : Boolean; Export;
-
- Begin
- AddInAcceptDrops := False;
- End {AddInAcceptDrops};
-
- {-----------------------------------------------}
-
- { --- Clysbar informs Add-In of a d'n'd drop --- }
-
- Procedure AddInDrop(hDrop : THandle); Export;
-
- Begin
- End {AddInDrop};
-
- {-----------------------------------------------}
-
- { --- Clysbar queries Add-In for Info Window text --- }
-
- { Return a zero-length string if you don't want to chg the text }
-
- Procedure AddInGetInfoWinTx(Tx : PChar); Export;
-
- Begin
- StrCopy(Tx,'');
- End {AddInGetInfoWinTx};
-
- {-----------------------------------------------}
-
- Exports AddInInit Index 1,
- AddInPaint Index 2,
- AddInTimerNeeded Index 3,
- AddInTimerTick Index 4,
- AddInPressed Index 5,
- AddInExit Index 6,
- AddInAbout Index 7,
- AddInAcceptDrops Index 8,
- AddInDrop Index 9,
- AddInGetInfoWinTx Index 10;
-
- Begin
- End.
-