home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn Amiga Shareware Floppies
/
ma68.dms
/
ma68.adf
/
K-WindowS_09B
/
Misc
/
Source
/
K-WindowS.ASCII
next >
Wrap
Text File
|
1996-08-12
|
12KB
|
448 lines
; BBB L III TTTTT ZZZZZ
; B B L I T Z
; BBB L I T Z
; B B L I T Z
; BBB LLLL III T ZZZZZ Basic II is simply the BEST. :-)
WBStartup:NoCli:SetErr:End:End SetErr
Version.s="$VER:K-WindowS 0.9B / Aout 1996" :Version=UnRight$(Version,5)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Ecrit en Blitz Basic. The Best.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Ecrit par Gabriel Klein
; En Princiau
; 1081 Montpreveyres
; Suisse
; BBS: 0041:(0)27 221 900. Pseudo: KGP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Source de K-WindowS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; You can use some part of this source, but you can't redistribute
; it.
; If you have made some improvement. Send this new source on my BBS
; or by mail. I'll update the version string, and the About (for
; your name).
; Vous pouver regardez dans cette source, prendre de PETITS
; bouts. Mais vous n'avez pas le droit de redistribuer une
; version... meme amelioree.
; Si vous faites une version meilleurs, envoyez-la moi et je
; m'occuperais de son numero de version, vous laisserais une
; place dans 'A Propos'.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; K-WindowS is MailWare. This Source is like K-WindowS... MailWare
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Interessting think are
; - Use of commodity
; - Use of Port for only 1 run.
; - Use of *Scree.Screen=...
; if you don't know this stucture
; try to understand it.
; Look in 'View NewType' menu
; Type in Screen.
; EX: *Scree.Screen=ActiveScren ; define struct '*Scree' address
; *Scree\NextScreen give the next Screen Intuition Adress
; (You use a internal address style.
; You can have the Intuition addresse with
; Peek.l (Addr Screen (0)).
; Usefull if you want to use Amiga Libs ( ...._ style instructions )
If IsReqToolsActive=False
If FromCLI
NPrint "":NPrint Version:NPrint "Need ReqTools.library (Nico Francois)":NPrint ""
Else
FindScreen 0:ScreensBitMap 0,0:BitMapOutput 0
For ib.b=0 To 110
Locate ib,0
Print " K-WindowS need ReqTools. Sorry."
VWait 4
Next
EndIf
End
EndIf
NEWTYPE .Ferme:Sty.b:Mem.l:Nom.s:PosY.w:Scr.l:x1.w:y1.w:x3.w:y3.w:End NEWTYPE
Dim CloseS.Ferme (120),ib.b(15)
CloseS(0)\Sty=1:CloseS(0)\Nom="Workbench Screen"
*Intui.IntuitionBase=IntuitionBase
NEWTYPE .Prefs
WaitTime.w
WayIn.b
Pri.b
Key.s
End NEWTYPE
USEPATH Prefs.Prefs
Dim Mess.s(25)
Mess(15)="Error while running K-WindowS!"
SetErr
If ILock.l<>0 Then UnlockIBase_(ILock):ILock=0
DisplayBeep_(ActiveScreen)
il.l=RTEZRequest(Version,Mess(15),"Sorry")
End
End SetErr
If ReadFile(0,"K-WindowS.Txt")=False
il.l=RTEZRequest(Version,"Text file (K-WindowS.Txt) no found.","Quit")
End
EndIf
FileInput 0
ib2.b=-1
Repeat
ib.b=-100
LoTx:
i$=Edit$(500)
If i$="" OR Left$(i$,1)=";"
ib.b+1
If ib>100 Then Pop Repeat:Goto TxLod
Goto LoTx
EndIf
ib.b=-100
If Left$(i$,1)="*"
Poke.b &i$,10
Else
ib2.b+1
j$=""
EndIf
j$+i$
Mess(ib2)=j$
Until ib>22
TxLod:
CloseFile 0
\WaitTime=Val(Mess(18))
\WayIn=Val(Mess(19))
\Key=Mess(20)
\Pri=Val(Mess(20))
If \WayIn=1
com:
If MakeCommodity("K-WindowS",Version,"C-Gabriel Klein, MailWare.")=False
DisplayBeep_(ActiveScreen)
End
EndIf
com2:
If SetHotKey(0,\Key)=False
il.l=RTEZRequest(Version,"Can't create HotKey","Retry|Change|Quit")
If il=0 Then End Else Goto com2
If il=2 Then \Key=RTEZGetString(Version,"Choose HotKey...",\Key):Goto com2
EndIf
EndIf
SetTaskPri_ FindTask_(0),\Pri
If FindPort_("KWindowS")<>0
il.l=RTEZRequest(Version,Mess(12),Mess(13))
If il=0 Then End
EndIf
il.l=CreateMsgPort("KWindowS")
WbToScreen 0
WorkBenchAddr.l=Peek.l(Addr Screen (0))
;;;;;;;;;;;;;;;;;;;;;;;;;; Boucle Principal ;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.Boucle
If ILock<>0 Then UnlockIBase_(ILock):ILock=0
.Boucle2
If \WaitTime>0 Then VWait \WaitTime
Select \WayIn
Case 0:If Joyb(0)=3 Then Goto SmeHasClick
Case 1
Wait
If CommodityEvent
il.l=ExchangeMessage
If il=0
Goto SmeHasClick
Else
Select il
Case CxAppear
Goto SmeHasClick
Case CxKill
End
End Select
EndIf
EndIf
End Select
Goto Boucle2
.SmeHasClick
ActiveW.l=ActiveWindow
ActiveS.l=ActiveScreen
il.l=RTEZRequest(Version,Mess(16),Mess(17))
Choice.b=0
If il=0 Then Goto Boucle
If il=4
ill.l=RTEZRequest(Version,Mess(4),Mess(5))
Select ill
Case 1
End
Case 2
j$=Chr$(10)
i$=Version+j$+"C-1996 Gabriel Klein"+j$+j$+"MailWare"+j$+"If you use it..."+j$
i$+"Send a nice PostCard to"+j$+"Gabriel Klein"+j$+"En Princiau"+j$+"1081 Montpreveyres"+j$
i$+"SUISSE"+j$+j$+"You can distribut this file"+j$+"in an unchanged form EVERYWHERE"+j$
i$+j$+"May the AMIGA be with you forever."+j$+"Traitor are those who buy P.C."+j$
i$+"but there are no lawn to punnish these men."+j$+j$+"Langage: "+Mess(1)+" by "+Mess(0)
il=RTEZRequest(Version,i$,"I'm a fan of you.")
Goto Boucle
Case 3
il.l=10
Default
Goto Boucle
End Select
EndIf
If il=10 Then Choice.b=1
If il=1 Then Choice=2
If il=2 Then Choice=3
If il=3 Then Choice=4
On Choice Goto HardClose,EcranFerme,WinFerme,OuvreQQCH
Goto Boucle
.HardClose
il=RTEZRequest(Version,Mess(2),Mess(3))
If il>0 AND il <3Then *Windo.Window=ActiveW:ill.l=*Windo\Parent:If il>0 Then ActivateWindow_(ill):VWait 2
WbToScreen 0:WorkBenchAddr.l=Peek.l(Addr Screen (0))
If il>2 AND WorkBenchAddr=ActiveS Then CloseWorkBench_:Goto Boucle
If il=1
ill.l=WindowLimits_(ActiveW,1,1,1,1):VWait
*Windo.Window=ActiveW
*Windo\MinWidth=1
*Windo\MinHeight=1
*Windo\Width=1:*Windo\Height=1
*Windo\PtrWidth=1
*Windo\PtrHeight=1
*Windo\LeftEdge=0
*Windo\TopEdge=0
ill.l=SizeWindow_(ActiveW,-1,-1)
; ILock.l=LockIBase_(0)
; WindowToBack_(ActiveW)
; NewWin.l=ActiveS+4
; ib.b=-100
; Repeat
; OldWin.l=NewWin.l
; NewWin.l=Peek.l(OldWin)
; ib+1:If ib>100 OR NewWin=0 Then UnlockIBase_(ILock):ILock=0:Goto Boucle
; Until NewWin=ActiveW
; Poke.l OldWin,Peek.l(NewWin)
; UnlockIBase_(ILock):ILock=0
EndIf
If il=2 Then CloseWindow_(ActiveW)
If il=3
Repeat
il.l=Peek.l(ActiveS+4)
If il=0 Then Pop Repeat:Goto CloseS1
CloseWindow_ (il)
VWait 5
Forever
CloseS1:
CloseScreen_ (ActiveS)
EndIf
If il=4
ill.l=MoveScreen_(ActiveS,0,5000)
ILock.l=LockIBase_(0)
ib.b=-100
*Intui.IntuitionBase=IntuitionBase
NewScr.l=&*Intui\FirstScreen
Repeat
OldScr.l=NewScr.l
NewScr=Peek.l(OldScr)
; il.l=RTEZRequest(Str$(IntuitionBase)+"-"+Str$(Int_Base),Hex$(OldScr)+"-"+Hex$(ActiveS),Hex$(NewScr))
ib.b+1:If ib>100 OR OldScr=0 Then UnlockIBase_(ILock):ILock=0:il=MoveScreen_(ActiveS,0,-5000):Goto Boucle
Until NewScr=ActiveS
Poke.l OldScr,Peek.l(NewScr)
Poke.l ActiveS,0
*Intui\ActiveScreen=*Intui\FirstScreen
UnlockIBase_(ILock):ILock=0
EndIf
Goto Boucle
.EcranFerme
WbToScreen 0
WorkBenchAddr.l=Peek.l(Addr Screen (0))
If ActiveS=WorkBenchAddr Then CloseWorkBench_:Goto Boucle
ill.l=MoveScreen_(ActiveS,0,5000)
ILock.l=LockIBase_(0)
ib.b=-100
*Intui.IntuitionBase=IntuitionBase
NewScr.l=&*Intui\FirstScreen
Repeat
OldScr.l=NewScr.l
NewScr=Peek.l(OldScr)
; il.l=RTEZRequest(Str$(IntuitionBase)+"-"+Str$(Int_Base),Hex$(OldScr)+"-"+Hex$(ActiveS),Hex$(NewScr))
ib.b+1:If ib>100 OR OldScr=0 Then UnlockIBase_(ILock):ILock=0:il=MoveScreen_(ActiveS,0,-5000):Goto Boucle
Until NewScr=ActiveS
Poke.l OldScr,Peek.l(NewScr)
Poke.l ActiveS,0
*Intui\ActiveScreen=*Intui\FirstScreen
UnlockIBase_(ILock):ILock=0
Gosub FirstFree
CloseS(cib.b)\Sty=1
CloseS(cib)\Mem=ActiveS
*Scree.Screen=ActiveS:CloseS(cib)\Nom=Peek$(*Scree\DefaultTitle)
Goto Boucle
.WinFerme
If Peek.l(ActiveS+4)=0 Then DisplayBeep_(ActiveScreen):Goto Boucle
ILock.l=LockIBase_(0)
NewWin.l=Peek.l(ActiveS+4)
ib.b=-100
Repeat
OldWin.l=NewWin
NewWin=Peek.l(OldWin)
ib+1:If ib>100 Then UnlockIBase_(ILock):ILock=0:Goto Boucle
Until OldWin=ActiveW
Gosub FirstFree
*Windo.Window=ActiveW
CloseS(cib.b)\Scr=ActiveS
CloseS(cib)\x1=*Windo\Width
CloseS(cib)\y1=*Windo\Height
CloseS(cib)\x3=*Windo\MinWidth
CloseS(cib)\y3=*Windo\MinHeight
*Windo\MinWidth=1
*Windo\MinHeight=1
CloseS(cib)\Sty=2
CloseS(cib)\Mem=ActiveW
*Scree.Screen=ActiveS
CloseS(cib)\Nom=Peek$(*Windo\Title)+" ("+Left$(Peek$(*Scree\Title),10)+"...)"
UnlockIBase_(ILock):ILock=0
il.l=SizeWindow_(ActiveW,-*Windo\Width+1,-*Windo\Height+1)
VWait 5
If *Windo\Width>2 OR *Windo\Height>2 ;For think that doesn't want to get small
*Windo\MinWidth=CloseS(cib)\x3
*Windo\MinHeight=CloseS(cib)\y3
CloseS(cib)\Sty=0
EndIf
Goto Boucle
.OuvreQQCH
ib2.b=0
Ouv2:
i$=Mess(6)+Chr$(10)+Chr$(10):ibb.b=0:j$=""
For ib.b=ib2 To 120
If CloseS(ib)\Sty>0
ibb+1
i$+Str$(ib)+": "
ib(ibb)=ib
If CloseS(ib)\Sty=1 Then i$+Mess(7)+" "
If CloseS(ib)\Sty=2 Then i$+Mess(8)+" "
i$+CloseS(ib)\Nom+Chr$(10)
j$+Str$(ib)+"|"
If ibb>9 Then ib2=ib:ib=121
EndIf
Next
If ibb>9 Then j$+Mess(9) Else j$+Mid$(Mess(9),1+Instr(Mess(9),"|"))
il.l=RTEZRequest(Version,i$,j$)
If il=0 Then Goto Boucle
If il=11 Then Goto Ouv2
Choix.b=ib(il)
If Choix=0 Then OpenWorkBench_:Goto Boucle
If CloseS(Choix)\Sty=1
ILock.l=LockIBase_(0)
NewScr.l=&*Intui\FirstScreen
ib.b=0
Repeat
OldScr.l=NewScr.l
NewScr=Peek.l(OldScr)
ib.b+1:If ib>100 Then UnlockIBase_(ILock):ILock=0:DisplayBeep_(ActiveScreen):Pop If:Goto Boucle
Until NewScr=0
Poke.l OldScr,CloseS(Choix)\Mem
UnlockIBase_(ILock):ILock=0
VWait:il=MoveScreen_(CloseS(Choix)\Mem,0,-5000)
CloseS(Choix)\Sty=0
ScreenToFront_(CloseS(Choix)\Mem)
EndIf
If CloseS(Choix)\Sty=2
NewScr.l=*Intui\FirstScreen
ib.b=0
Repeat
OldScr.l=NewScr.l
NewScr=Peek.l(OldScr)
ib.b+1:If ib>100 Then DisplayBeep_(ActiveScreen):Pop If:Goto Boucle
If OldScr=0
il.l=RTEZRequest(Version,Mess(10),Mess(11))
If il=1 Then CloseS(Choix)\Sty=0
If il=2 Then Goto MeuhOui
Pop If:Pop Repeat:Pop If
Goto Boucle
EndIf
Until OldScr=CloseS(Choix)\Scr
MeuhOui:
NewWin.l=CloseS(Choix)\Mem
ib.b=0
Repeat
OldWin.l=NewWin.l
NewWin=Peek.l(OldWin)
ib.b+1:If ib>100 Then DisplayBeep_(ActiveScreen):Pop If:Goto Boucle
If OldWin=0
il.l=RTEZRequest(Version,Mess(14),Mess(11))
If il=1 Then CloseS(Choix)\Sty=0
If il=2 Then Goto MeuhOui2
Pop If:Pop Repeat:Pop If
Goto Boucle
EndIf
Until OldWin=CloseS(Choix)\Mem
MeuhOui2:
If ILock<>0 Then UnlockIBase_(ILock):ILock=0
*Windo=CloseS(Choix)\Mem
*Windo\MinWidth=CloseS(Choix)\x3
*Windo\MinHeight=CloseS(Choix)\y3
CloseS(Choix)\Sty=0
ill.l=SizeWindow_(CloseS(Choix)\Mem,CloseS(Choix)\x1-1,CloseS(Choix)\y1-1)
EndIf
Goto Boucle
.FirstFree
For cib.b=1 To 120
If CloseS(cib)\Sty=0 Then Pop For:Goto Ret
Next
If ILock<>0 Then UnlockIBase_(ILock):ILock=0
il.l=RTEZRequest(Version,"Can't add more item.","Shit")
Pop Gosub
Goto Boucle
Ret:
Return