Sunday, 9 October 2011

Windraw_bas SBASIC tool

There are many editing tools for SBASIC. - QD and the editor built into SBASIC and accessed by the ED command being amongst the best. Some also like the Editor from DP. QD is amongst QL Heavens favourite programmes but there are times especially when typing in SBASIC listing that ED is preferable. Launching Windraw_bas as a daughter SBASIC job from Launchpad allows a movable reconfigurable set of SBASIC windows to configure for an SBASIC editing session using ED. Here is Windraw_bas and below some pictures of it in action. Credits to James Lucy and SA Hall and also QL Heaven for a tweak to this program.


100 REMark Move & Resize Basic's Windows
110 REMark James Lucy's program, much added to by S.A.Hall 04/06/97.
120 :
130 WDB0 = PEEK_L(PEEK_L(!!120))
140 xs=800:ys=400:xo=200:yo=68 : REMark my preferences for setup
150 :
160 errt=FOPEN(#0,con_)
170 errt=FOPEN(#1,con_):errt=FOPEN(#2,con_) : Get_pal 0
180 x% = SCR_XLIM(#0) :y% = SCR_YLIM(#0)        : REMark Get Screen Dims
190 setscreens:OUTLN#0,xs,ys,xo,yo
200 s=20                                        : REMark  speed to 10
210 POKE_W !!136,0                              : REMark caps lock off
220 REPeat draw_box
230   key=CODE(INKEY$(-1))                      : REMark Wait for key
240   m=1
250   SELect ON key
260    =102 : s=20                              : REMark "f" fast, moves in steps of 10
270    =115 : s=1                               : REMark "s" slow, moves in steps of 1
280    =208 : yo=yo-s : IF yo<0: yo=0           : REMark csr up
290    =216 : yo=yo+s : IF yo+ys>y%:yo=yo-s      : REMark csr down
300    =192:xo=xo-s:IF xo<0:xo=0                    : REMark csr left
310    =200:xo=xo+s: IF xo+xs>x%:xo=xo-s            : REMark csr right
320                                                REMark shift csr down
330    =220:ys=ys+s:m=0:IF ys+yo>y%:ys=y%-yo :m=0
340                                                REMark shift csr up
350    =212:ys=ys-s:m=0:IF ys<80:ys=80       :m=0
360                                                REMark shift csr right
370    =204:xs=xs+s:m=0:IF xs+xo>x%:xs=x%-xo :m=0
380                                                REMark shift csr left
390    =196:xs=xs-s:m=0:IF xs<160:xs=160     :m=0
400    =10: setscreens:CLS#0:CLS:CLS#2:NEW          : REMark Hit ; outline
410 END SELect
420 OUTLN#0,xs,ys,xo,yo:BORDER#0,1,Wbcol:CLS#0
430 IF m=1 :setscreens
440 IF s= 20 : a$='Fast':ELSE a$='Slow'
450 AT#0,0,1:PRINT#0, xs;'x';ys;' a ';xo;'x';yo;' ';:WM_INK#0,Wicol:PRINT#0,a$: OVER#0,-1
460 WM_INK#0,Wicol
470 END REPeat draw_box
480 :
490 DEFine PROCedure setscreens
500 xs12 = INT(xs*.5)                               : REMark Divide width &
510 xs2=INT(xs*.75)
520 ys12 = INT(ys*.8)                         : REMark Divide height to
530 ys0 = INT(ys*.2)                          : REMark keep it in scale
540 WINDOW#0,xs,ys0,xo,ys12+yo :WM_PAPER#0,Wpcol:INK#0,0:WM_BORDER#0,1,Wbcol
550 WINDOW xs,ys12,xo,yo:WM_PAPER Wpcol:WM_INK Wicol: WM_BORDER 1,Wbcol
560 WINDOW#2,xs2,ys12,xo,yo:WM_PAPER#2,Wpcol:WM_INK#2,Wicol:WM_BORDER#2,1,Wbcol:CSIZE#2,1,0
570 END DEFine
580 :
590 DEFine PROCedure Get_pal (syspal)
600 LOCal mem,num
610 REMark this is a general function to GET a system palette....
620   num = 57                  : REMark number of entries in palette
630   mem = ALCHP(num * 2)      : REMark mem needed for palette entries
640   SP_GET syspal,mem,0,57
650   Wpcol=PEEK_W (mem+23*2)    : REMark get palette entries in memory
660   Wicol=PEEK_W (mem+4)
670   Wbcol=PEEK_W (mem)         : REMark get palette entries in memory
680   CLCHP mem
690 END DEFine Get_pal
700 :



No comments:

Post a Comment