home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
swCHIP 1991 January
/
swCHIP_95-1.bin
/
desktop
/
cb210
/
lines.pa_
/
lines.pa
Wrap
Text File
|
1995-12-09
|
5KB
|
205 lines
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}
{$I ..\VER}
Const
LineThick : Integer = 2;
DiscMode : Boolean = True;
CLBVer : VerString = AddInMasterVer;
Var
GTxInBtn : Boolean;
{$D Lines Add-In for Clysbar - clySmic Software}
{-----------------------------------------------}
{ --- Perform Add-In's initialization --- }
Function AddInInit(CurVer : PChar; TxInBtn : Boolean) : InitResult; Export;
Begin
Randomize;
{ Version check }
If StrLComp(CurVer,CLBVer,3) <> 0
Then AddInInit := InitNotOk
Else AddInInit := InitOk;
{ Save text-in-button flag }
GTxInBtn := TxInBtn;
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);
If GTxInBtn
Then Rect.Right := Rect.Left + GetSystemMetrics(sm_cxIcon) + 18;
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 --- }
Procedure AddInAbout(Str1,Str2 : PChar;
Var TheIcon : HIcon;
Var TitleCol,TxCol,BkCol : TColorRef); Export;
Begin
StrCopy(Str1,'Lines V');
StrCat(Str1,MasterVer);
StrCopy(Str2,'A Random Line Drawer'#13'⌐ 1992 - 1994 by clySmic Software.'#13'All Rights Reserved.');
TheIcon := LoadIcon(hInstance,'ABOUT');
TitleCol := RGB(255,255,0);
TxCol := RGB(0,0,128);
BkCol := RGB(0,128,0);
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.