home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
new
/
util
/
wb
/
picticon
/
source
/
picticon.e
< prev
next >
Wrap
Text File
|
1994-12-04
|
47KB
|
1,686 lines
MODULE 'exec/nodes','exec/ports','exec/types','exec/memory',
'intuition/intuition','intuition/screens','intuition/gadgetclass',
'intuition/screens','dos/dos','dos/dosextens','gadtools',
'libraries/gadtools','graphics/rastport','graphics/gfx','graphics/text',
'graphics/view','graphics/gfxbase','workbench/workbench',
'workbench/startup','wb','icon','graphics/clip','diskfont',
'libraries/diskfont','libraries/iffparse','iffparse','Asl','libraries/Asl',
'datatypes/datatypes','datatypes/datatypesclass','datatypes/pictureclass',
'utility/hooks','intuition/classes','intuition/classusr',
'libraries/locale',
'mathffp','dos/dosasl',
'datatypes','layers','keymap','devices/inputevent','mathtrans','locale'
MODULE 'newicon','libraries/newicon'
MODULE 'whatis','libraries/whatisbase'
MODULE '*doloaddt'
/* options:
MAXIWIDTH=x ;buffer size width
MAXIHEIGHT=x ;buffer size height
APPICON=$ ;name of App-icon image
TEMPLATE_ICON=$ ;name of icon to modify (tooltypes, positions)
BACKGROUND_ICON=$ ;Name of background icon.
CHUNKYMODE=B ;save icon with ReadPixels, not bitmap->image.
FORCE_EIGHT=B ;If YES then eight planes are saved.
PIC_X_POS=x ;Offset for image.
PIC_Y_POS=x ;Offset for image.
PIC_X_SIZE=x ;Real size of image (not always, but at least < than)
PIC_Y_SIZE=x ;Real size of image.
CENTER=B ;Center icon? Only valid with PIC_X_SIZE/PIC_Y_SIZE
SHOWSIZE_X=x ;X pos for size coords
SHOWSIZE_Y=x ;Y pos for size coords
LOWPRI=B ;If= "yes" then run at priority -1
FREE_ICON_POS=B ;Set icon to "unsnapshot"
HIGHPEN=x ;topmost pen to use
SHOWSIZE_OUTLINE=B;If yes, then outline the size, otherwise, shadow it
SHOWSIZE_NORMAL=B ;If yes, then no shadow, no outline.
SHOWSIZE_TALL=B ;If yes, then font is 8 high, not 6.
QUIET=B ;If yes then surpress ALL output.
APP_X_POS=x ;x pos of appicon
APP_Y_POS=y ;y pos of appicon
DITHER=B ;if YES then do dithering
; The following are EXPERT tooltypes, only...
TWOPASS=B ;if YES and dithering on, then do left to right, right to left passes.
D_THRESHOLD=x ;a pos value for the minimum addition value (dithering) (EXPERT)
D_IGNORE=x ;a pos value. If error<x then igrnore error in dithering. (EXPERT)
D_LIMIT=x ;a pos value for the maximum addition value (dithering) (EXPERT)
D_TYPE=x ;0 is default 3/8 , 0/0 , 3/8 , 1/4 x 1st value (x=from here)
;1 is FS? 7/16, 3/16, 5/16, 1/16 2nd 3rd 4th values
;2 is alternate 1/2 , 0/0, 1/2, 0/0
;3 is crosshatch 0/0 , 1/2, 0/0, 1/2 (all EXPERT tooltypes!)
;4 is linear 1/1 , 0/0, 0/0, 0/0
;5 is equal 1/4 , 1/4, 1/4, 1/4
*/
ENUM E_NONE,L_OK,
L_E_GENERAL,L_E_FILE,L_E_NOFILE,L_E_BADICON,L_E_NOWRITEICON,L_E_CLIP,
L_E_DATATYPE,L_E_NOPICTURE,L_E_GADGET,
L_EF_LIBRARY,L_EF_FATAL,L_EF_PUBSCREEN,L_EF_CHIPBUFFER,L_EF_VISUAL,L_EF_MENUS,
L_EF_MSGPORT,L_EF_WINDOW,L_EF_MEMORY,L_TEXTTITLE,
L_PICTURE,L_FILEOF,L_LOADING,L_SCALING,L_REMAPPING,L_SAVING,L_PERCENT,
L_TITLE,L_BODY,L_BUTTONS,L_RENDERING,L_PERCENT2,L_ENDS
ENUM MODE_CLI,MODE_WB,MODE_QUIET,MODE_APP
ENUM TEXT_NORMAL,TEXT_SHADOW,TEXT_OUTLINE
OBJECT mybitmapstruct
bytesperrow:INT;rows:INT;flags:CHAR;depth:CHAR;pad:INT
plane1:LONG;plane2:LONG;plane3:LONG;plane4:LONG
plane5:LONG;plane6:LONG;plane7:LONG;plane8:LONG
ENDOBJECT
DEF dumstr[500]:STRING
DEF texttype=TEXT_SHADOW,tallfont=FALSE
DEF iff:PTR TO iffhandle,ierror
DEF sp=NIL:PTR TO storedproperty
DEF freeme=FALSE
DEF curfile=1,totfile=1
DEF screenfont=NIL:PTR TO textfont
DEF window=NIL:PTR TO window,rast,drawinfo,fgx,fgy,fgw,fgh
DEF showflag=FALSE,showx=0,showy=0,bitsizex,bitsizey,sizestr[50]:STRING
DEF black,white,writecolors=2
DEF posx=0,posy=0,sizex=0,sizey=0,centerflag=FALSE,posflag=FALSE
DEF noappitem=FALSE
DEF minimumx,minimumy
DEF quietflag=FALSE,goodload
DEF requestsizex,requestsizey,highestcolor
DEF k[15]:LIST
DEF redt[256]:LIST,grnt[256]:LIST,blut[256]:LIST
DEF ditz,dang,dumb,body
DEF osversion,quitter,newicon=FALSE
DEF abort
DEF aspectx=1,aspecty=1,useaspect=TRUE
DEF radian,pointfive
DEF catalog,sl[500]:LIST
DEF iconianheader[80]:STRING
DEF scratch,ret,dummy
DEF appimagedata,diskobj=NIL:PTR TO diskobject,newdiskobj=NIL:PTR TO newdiskobject
DEF progname[500]:STRING,sleepername[500]:STRING,templatename[500]:STRING
DEF backname[500]:STRING
DEF gaugestr[100]:STRING
DEF toolobject=NIL:PTR TO diskobject
DEF usewhatis=TRUE
DEF chunkyflag=FALSE,force8=FALSE,first4=-1
DEF maxiwidth=128,maxiheight=100,maxiw=127,maxih=99
DEF filename[500]:STRING
DEF mode=MODE_CLI
DEF scr=NIL:PTR TO screen,viewport:PTR TO viewport
DEF bitmap:PTR TO bitmap,depth,colormap=0,newcolormap=0,cmbuf=0
DEF currast=NIL:PTR TO rastport,curbitmap=NIL:PTR TO bitmap
DEF appname[500]:STRING
DEF visual=NIL,winx=-1,winy=-1
DEF oldpx=-1
DEF appx=-1,appy=-1
DEF dither=TRUE
DEF twopass=FALSE
DEF rawdata=0
DEF div1=3,div2=0,div3=3,div4=1,rem1=8,rem2=1,rem3=8,rem4=4
DEF thres=2,ignore=16,lim=255,typ=0
DEF iinfo=0:PTR TO imageinfo
PROC main()
NEW iinfo
openlibs()
radian:=sp_div_tf_tf_f(10000,572958)
pointfive:=sp_div_tf_tf_f(10,5)
StrCopy(iconianheader,'Picticon 0.96',ALL)
loadwinpos()
handwb()
savewinpos()
leave(0)
ENDPROC
versionstring:
CHAR '\0$VER: picticon 0.96 (4.12.94)\0'
CHAR 0,0,0,0
PROC setraw(x,y,r,g,b)
IF rawdata
PutLong(rawdata+(limit(x,0,maxiwidth)*12)+(limit(y,0,1)*12*maxiwidth),r)
PutLong(rawdata+(limit(x,0,maxiwidth)*12)+4+(limit(y,0,1)*12*maxiwidth),g)
PutLong(rawdata+(limit(x,0,maxiwidth)*12)+8+(limit(y,0,1)*12*maxiwidth),b)
ENDIF
ENDPROC
PROC rawred(x,y)
RETURN Long(rawdata+(x*12)+(y*12*maxiwidth))
ENDPROC
PROC rawgrn(x,y)
RETURN Long(rawdata+4+(x*12)+(y*12*maxiwidth))
ENDPROC
PROC rawblu(x,y)
RETURN Long(rawdata+8+(x*12)+(y*12*maxiwidth))
ENDPROC
PROC processicon() HANDLE
DEF gadget:PTR TO gadget
DEF backobj=NIL:PTR TO diskobject
DEF screenattr:PTR TO textattr,sfonth=8
DEF heystring[500]:STRING,file[500]:STRING
DEF iiii,tttt,oldshowx,loo,gc1,gc2
DEF inw,inh,lock
DEF imsg:PTR TO intuimessage
oldshowx:=showx
window:=NIL
IF StrLen(filename)<1 THEN Raise(E_NONE)
IF ((scr:=LockPubScreen('Workbench'))=0) THEN Raise(L_EF_PUBSCREEN)
visual:=GetVisualInfoA(scr,NIL)
viewport:=scr.viewport
colormap:=viewport.colormap
bitmap:=scr.bitmap
depth:=bitmap.depth
IF (newicon)
newcolormap:=GetColorMap(256)
cmbuf:=New(32)
FOR loo:=0 TO 255
gc1:=loo AND (Shl(1,depth)-1)
GetRGB32(colormap,gc1,1,cmbuf)
SetRGB32CM(newcolormap,loo,Long(cmbuf),Long(cmbuf+4),Long(cmbuf+8))
ENDFOR
colormap:=newcolormap
Dispose(cmbuf)
ENDIF
IF (curbitmap:=myallocbitmap(maxiwidth,maxiheight,8,BMF_CLEAR OR BMF_STANDARD,NIL))=NIL THEN Raise(L_EF_CHIPBUFFER)
IF (currast:=New(SIZEOF rastport))=NIL THEN Raise(L_EF_FATAL)
InitRastPort(currast);currast.bitmap:=curbitmap
screenattr:=scr.font
sfonth:=screenattr.ysize
IF ((mode<>MODE_QUIET) AND (mode<>MODE_CLI))
inw:=bigger(300,12*StrLen(FilePart(filename)))
inh:=sfonth*3+20-((totfile>1)*(sfonth+4))
IF winx=-1 THEN winx:=(((scr.width-300)/2))
IF winy=-1 THEN winy:=(((scr.height-(sfonth*2+16))/2))
window:=OpenWindowTagList(0,[WA_LEFT,winx,
WA_TOP,winy,
WA_INNERWIDTH,inw,
WA_INNERHEIGHT,inh,
WA_FLAGS,WFLG_DRAGBAR OR WFLG_DEPTHGADGET OR WFLG_CLOSEGADGET,
WA_IDCMP,IDCMP_CLOSEWINDOW,
WA_TITLE,sl[L_TEXTTITLE],
WA_CUSTOMSCREEN,scr,
WA_AUTOADJUST,TRUE,
NIL,NIL])
rast:=window.rport
screenfont:=OpenFont(scr.font)
IF screenfont THEN SetFont(rast,screenfont)
fgx:=4+window.borderleft
fgw:=window.width-(8+window.borderleft+window.borderright)
fgh:=window.height-(window.bordertop+4+window.borderbottom)-(sfonth*2)-8+((totfile>1)*(sfonth+4))
fgy:=window.height-(sfonth*2)-18
SetAPen(rast,2)
shadowtext(rast,fgx,fgy+6+fgh+screenfont.baseline,'0%',2)
shadowtext(rast,fgx+fgw-TextLength(rast,'100%',4),fgy+fgh