home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1B
/
DATAFILE_PDCD1B.iso
/
_pocketbk
/
pocketbook
/
003
/
bit_zip
/
BITMEIST.OPL
< prev
next >
Wrap
Text File
|
1992-01-01
|
16KB
|
618 lines
PROC main:
local key%,list$(18),a$(5),mod%
global h&,w&,xcur%,ycur%,id%(2),idmax%,idat%,xan%,yan%,anbool%,clip%
global name$(2,128),viewwin%(2),statwin%,viewwin$(8),statwin$(10),short$(2,10)
list$="NGOASLCIEBVURX"
statwin$="Status On"
viewwin$="View On"
idat% = 1
statwin% = gCREATE(180,6,60,70,0) : gborder 1 REM Create Status Window
REM Need to fill in Status Window
gAT 12,10 : GXprint "Status",2
WHILE 1 REM Main loop of program
IF statwin$="Status Off" AND idmax%>0
Statup:
ENDIF
if idmax%>0
IF anbool%
gAT min(xan%,xcur%),min(yan%,ycur%)
CURSOR id%(idat%),0,max((xcur%-xan%+4),xan%-xcur%+4),max((ycur%-yan%+4),yan%-ycur%+4)
ELSE
cursor id%(idat%),0,4,4
ENDIF
key%=GET : mod%=KMOD
else
key%=290
endif
If key%=290 or key%>512 REM Menu Key was hit
IF key%>512
key%=(key%-512)
IF loc(list$,chr$(key%))=0
continue
ENDIF
ELSE
mInit
mCARD "File","New File",%N,"Open File",%O,"Save as",%A,"Save",%S,"Close Bitmap",%L
mCARD "Edit","Copy",%C,"Insert",%I,"Change Bitmap",%G
mCARD "Draw","Empty Box",%E,"Filled Box",%B
mCARD "Special",viewwin$,%V,statwin$,%U,"Clear Screen",%R,"Exit",%X
key%=MENU
ENDIF
IF key% REM Not Esc
a$="proc"+CHR$(key%) REM Set which proc
@(a$): REM Call the correct procedure
ENDIF
ELSE REM IF keyhit is Not Psion-Something
IF key%=8 and anbool%=1 rem Delete
cut:
continue
endif
IF key%>255 AND key<260
DIRECT:(key%,mod%)
ENDIF
IF key%=32 AND anbool%=0 REM Space
gFILL 4,4,2
gUSE viewwin%(idat%)
gAT (xcur%+3)/4,(ycur%+3)/4 : gFill 1,1,2
gUSE id%(idat%)
ENDIF
ENDIF
ENDWH
ENDP
PROC PROCR:
if idmax%=0
giprint "Load Bitmap First..."
return
endif
IF abandon:("Clear Bitmap")
giprint "Clearing Bitmap..."
if anbool%
anbool%=0
endif
gAT 1,1 : gFILL (w&*4),(h&*4),1
ycur%=1:xcur%=1
gSETWIN 0,0
gUSE viewwin%(idat%) : gCLS :gAT 1,1
gUSE id%(idat%)
ENDIF
ENDP
PROC PROCL: REM Close Bitmap
IF idmax%=0
beep 2,400 :GIPRINT "Load Bitmap First..."
RETURN
ENDIF
if abandon:("Close Bitmap")
giprint "Closing Bitmap..."
anbool%=0
gCLOSE id%(idat%)
gCLOSE viewwin%(idat%)
IF idat%=1 AND idmax%=2
viewwin%(1)=viewwin%(2)
id%(1)=id%(2)
name$(1)=name$(2)
short$(1)=short$(2)
ENDIF
idmax%=idmax%-1
idat%=1
IF idmax%
gUSE id%(1) :gVISIBLE ON
xcur%=1:ycur%=1
w&=(gWIDTH-2)/4 : h&=(gHEIGHT-2)/4
IF viewwin$="View Off"
gUSE viewwin%(1) :gVISIBLE ON
gUSE id%(1)
ENDIF
ELSE
IF statwin$="Status Off"
statwin$="Status On"
gUSE statwin%
gVisible OFF
endif
endif
ENDIF
RETURN
ENDP
PROC Abandon:(temp$)
dInit
dTEXT "",temp$,2
dTEXT "","Are You Sure?",2
dBUTTONS "No",%N,"Yes",%Y
RETURN UPPER$(chr$(DIALOG))="Y"
ENDP
PROC DIRECT:(key%,mod%)
IF (mod% AND 2) AND anbool%=0
xan%=xcur% : yan%=ycur% : anbool%=1
IF viewwin$="View Off"
procV:
ENDIF
ENDIF
If key%=256 REM UP
IF ycur%>1
ycur%=ycur%-4
ELSE
beep 4,600
ENDIF
IF ycur%<IABS(gORIGINY)
gSETWIN gORIGINX,gORIGINY+4
ENDIF
ENDIF
If key%=257 REM DOWN
IF ycur%<(h&*4)-3
ycur%=ycur%+4
ELSE
beep 4,600
RETURN
ENDIF
IF (ycur%-IABS(gORIGINY))>74
gSETWIN gORIGINX,GORIGINY-4
ENDIF
ENDIF
If key%=259 REM LEFT
IF xcur%>1
xcur%=xcur%-4
ELSE
beep 4,600
ENDIF
IF xcur%<IABS(gORIGINx)
gSETWIN gORIGINX+4,gORIGINY
ENDIF
ENDIF
If key%=258 REM RIGHT
IF xcur%<(w&*4)-3
xcur%=xcur%+4
ELSE
beep 4,600
RETURN
ENDIF
IF (xcur%-IABS(gORIGINx))>235
gSETWIN gORIGINX-4,GORIGINY
ENDIF
ENDIF
IF anbool%=0
gAT xcur%,ycur%
ELSE
IF (mod% AND 2)=0
anbool%=0
gAT xcur%,ycur%
ENDIF
endif
RETURN
ENDP
PROC GETNAME$:(nam$)
local pos%,loc%,ext$(12)
pos%=len(nam$)+1
DO
pos%=pos%-1
UNTIL mid$(nam$,pos%,1)="\"
ext$=UPPER$(right$(nam$,len(nam$)-pos%))
loc%=loc(ext$,".")
if loc%
return left$(ext$,loc%-1)
else
return ext$
endif
ENDP
PROC Statup:
local x%,y%,pos$(8)
IF idmax%=0
beep 2,400 :GIPRINT "Load Bitmap First..."
RETURN
ENDIF
x% = (xcur%-1)/4 : y% = (ycur%-1)/4
pos$ = gen$(x%+1,3)+" "+gen$(y%+1,3)
gUSE statwin%
gFONT 3: gAT 2,20 : gPrintb pos$,56,3 REM Current Position
gFONT 1: gAT 2,31 : gPrintb short$(idat%),56,3 REM Current File
gAT 2,43 : gPrintb "Wdth: "+gen$(w&,3),56,3
gAT 2,54 : gPrintb "Hght: "+gen$(h&,3),56,3
gAT 2,65 : gPRINTB "MAP "+gen$(idat%,1)+" of "+gen$(idmax%,1),56,3 rem using bitmap #/# of bitmaps
gUSE id%(idat%)
ENDP
PROC procC: REM Copy to Clipboard
local x1%,x2%,y1%,y2%,wid%,hgt%,temp%
IF anbool%=0
beep 2,400: gIPRINT "Highlight Something First..."
RETURN
ENDIF
BUSY "BUSY"
temp%=gIDENTITY
if clip%>0
gCLOSE clip%
endif
x1% =(xan%+3)/4 : x2%=(xcur%+3)/4
y1% =(yan%+3)/4 : y2%=(ycur%+3)/4
wid%=max((x2%-x1%+1),x1%-x2%+1)
hgt%=max((y2%-y1%+1),y1%-y2%+1)
clip%=gCREATE(0,0,wid%,hgt%,0)
gCOPY viewwin%(idat%),min(x1%,x2%),min(y1%,y2%),wid%,hgt%,3
gUSE temp%
BUSY OFF
giprint "Copied"
RETURN
ENDP
PROC cut: REM Cut to Clipboard
local x1%,x2%,y1%,y2%,wid%,hgt%,temp%
IF anbool%=0
beep 2,400: gIPRINT "Highlight Something First..."
RETURN
ENDIF
BUSY "BUSY"
temp%=gIDENTITY
if clip%>0
gCLOSE clip%
endif
x1% =(xan%+3)/4 : x2%=(xcur%+3)/4
y1% =(yan%+3)/4 : y2%=(ycur%+3)/4
wid%=max((x2%-x1%+1),x1%-x2%+1)
hgt%=max((y2%-y1%+1),y1%-y2%+1)
clip%=gCREATE(0,0,wid%,hgt%,0)
gCOPY viewwin%(idat%),min(x1%,x2%),min(y1%,y2%),wid%,hgt%,3
gUSE viewwin%(idat%)
gAT min(x1%,x2%),min(y1%,y2%)
gFILL wid%,hgt%,1
gUSE temp%
gAT min(xan%,xcur%),min(yan%,ycur%)
gFILL max((xcur%-xan%+4),xan%-xcur%+4),max((ycur%-yan%+4),yan%-ycur%+4),1
gAT xcur%,ycur%
anbool%=0
BUSY OFF
giprint "Cut"
RETURN
ENDP
PROC PROCB: REM Filled Box
local x1%,x2%,y1%,y2%,wid%,hgt%,ch%
IF anbool%=0
beep 2,400: gIPRINT "Highlight Something First..."
RETURN
ENDIF
dINIT "Filled Box Choices"
dCHOICE ch%,"In Box, ","Set Bits,Clear Bits,Invert Bits"
IF dialog=0
RETURN
ENDIF
BUSY "BUSY"
x1% =(xan%+3)/4 : x2%=(xcur%+3)/4
y1% =(yan%+3)/4 : y2%=(ycur%+3)/4
wid%=max((x2%-x1%+1),x1%-x2%+1)
hgt%=max((y2%-y1%+1),y1%-y2%+1)
gUSE viewwin%(idat%)
gAT min(x1%,x2%),min(y1%,y2%)
gFILL wid%,hgt%,ch%-1
gUSE id%(idat%)
gAT min(xan%,xcur%),min(yan%,ycur%)
gFILL max((xcur%-xan%+4),xan%-xcur%+4),max((ycur%-yan%+4),yan%-ycur%+4),ch%-1
gAT xcur%,ycur%
anbo