home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 107
/
af107sub.adf
/
gui4cli.LZX
/
Gui4Cli
/
Dir
/
dir.gfxcon
< prev
next >
Wrap
Text File
|
2003-12-15
|
5KB
|
275 lines
G4C
; dir.gfxcon - by dck January 1997
; A GUI for the great picture format converter :
; GfxCon V1.7 © Dirk Farin / farindk@trick.informatik.uni-stuttgart.de
; (Available on Aminet)
; Looks for GFXcon under the name contained in variable $DEF.GFXCON
WINBIG 180 15 200 166 "GfxCon V1.7"
WinType 11110001
varpath dir.gc
xOnLoad
ifexists file $*DEF.GFXCON ; you MUST have configured dir.gc
; You're my kind of guy..
else
EZReq "GFXcon not found!\nPlease configure\nDir.gc correctly." "OK" ""
guiquit dir.gfxcon
stop
endif
gfx_format = ILBM ; our variables
gfx_colors = ""
gfx_bw = ""
gfx_flip = ""
gfx_rot = ""
gfx_x = 320
gfx_y = 250
gfx_size = ""
gfx_file = ""
gfx_mode = FILES
gosub dir.gfxcon FileMode
guiopen dir.gfxcon
xOnClose
delvar gfx_#?
guiquit dir.gfxcon
xRoutine FileMode
setgad dir.gfxcon 1/13 HIDE
setgad dir.gfxcon 21/25 SHOW
redraw dir.gfxcon
xRoutine ConvertMode
setgad dir.gfxcon 1/13 SHOW
setgad dir.gfxcon 21/25 HIDE
redraw dir.gfxcon
XCYCLER 0 0 200 14 "" gfx_mode
cstr "Choose/Add Files" FILES
Cstr "Converting Options" CONVERT
if $gfx_mode = CONVERT
gosub dir.gfxcon ConvertMode
else
gosub dir.gfxcon FileMode
endif
;------------------------------- PRETTY OBVIOUS OPTIONS GADGETS
XCYCLER 70 15 125 14 Format gfx_format
GadID 1
cstr ILBM ILBM
cstr GIF GIF
cstr JPEG JPEG
cstr PCX PCX
cstr PostScript Postscript
cstr RGB-Raw RGB-Raw
XCYCLER 70 30 125 14 Colors gfx_colors
GadId 2
cstr Default ""
cstr 16 16
cstr 32 32
cstr 128 128
cstr 256 256
cstr 2 2
cstr 4 4
cstr 8 8
XCYCLER 70 45 125 14 Type gfx_bw
GadId 3
cstr Default ""
cstr GRAYSCALE GRAYSCALE
cstr BW BW
cstr INVERT INVERS
cstr "NO Red" NORED
cstr "NO Green" NOGREEN
cstr "NO Blue" NOBLUE
XCYCLER 70 60 125 14 Flip gfx_flip
gadid 11
Cstr None ""
cstr "Flip X" FLIPX
cstr "Filp Y" FLIPY
cstr "Flip XY" "FLIPX FLIPY"
XCYCLER 70 75 125 14 Rotate gfx_rot
gadid 12
cstr None ""
cstr "90 Left" ROTATELEFT
cstr "90 Right" ROTATERIGHT
; NOT IMPLEMENTED YET
; slider contrast CONTRAST 0-100
; slider brightness BRIGHTNESS 0-255
;---- Size
XCYCLER 70 90 125 14 Size gfx_size
gadid 4
cstr Same ""
cstr BOXFIT BOXFIT
cstr SIZE SIZE
if $gfx_size = NONE
setgad dir.gfxcon 5 OFF
setgad dir.gfxcon 6 OFF
else
setgad dir.gfxcon 5 ON
setgad dir.gfxcon 6 ON
endif
; -- Size textin gadgets
XTEXTIN 70 105 61 14 "" gfx_x 320 10
gadid 5
SetGad dir.gfxcon 6 ON
XTEXTIN 135 105 59 14 "" gfx_y 250 10
gadid 6
; -------------------- Status Boxes
TEXT 5 112 40 10 "Status:" 20 NOBOX
gadid 7
TEXT 4 123 190 12 "No Files" 130 BOX
GadID 8
TEXT 4 136 190 12 "Idle.." 40 BOX
gadid 13
xPIPE pipe:gfxcon ON
if $gfx_mode = CONVERT
update dir.gfxcon 13 '$$PIPE'
endif
;--------------------- LISTVIEW SHOWING FILES TO CONVERT
XLISTVIEW 0 15 198 132 "" gfx_file "" 10 MULTI
gadid 21
XBUTTON 0 150 50 14 View
gadid 25
lvuse dir.gfxcon 21
lvmulti first
while $gfx_file > ""
*RUNMODE = 'run >nil:'
*FILENAME = $gfx_file
gosub viewfile.g ViewFile
lvmulti next
endwhile
XBUTTON 50 150 50 14 Add ; add files selected from dir.gc
gadid 22
id = $$lv.id
lvuse dir.gc $id
lvmulti first
while $lv_file > ""
lvuse dir.gfxcon 21
lvadd $lv_file
lvuse dir.gc $id
lvmulti off
lvmulti next
endwhile
XBUTTON 100 150 50 14 Del ; delete selected files
gadid 23
lvuse dir.gfxcon 21
lvmulti first
while $gfx_file > ""
lvdel -1
lvmulti first ; use first again since last first was deleted
endwhile
XBUTTON 150 150 50 14 Clr
gadid 24
lvuse dir.gfxcon 21
lvclear
;-------------------- Cancel the relaunch of gfxcon
XBUTTON 100 150 95 14 CANCEL
gadfont topaz.font 8 010
gadid 9
gfx_flag = 1
;-------------------- This is where we do our stuff!
XBUTTON 5 150 95 14 "Convert"
gadid 10
gadfont topaz.font 8 010
gfx_flag = 0
lvuse dir.gfxcon 21
lvgo #0
gfx_cfile = $$lv.rec
if $gfx_cfile > ""
lvdel 0
update dir.gfxcon 7 Converting:
update dir.gfxcon 8 $gfx_cfile
gosub dir.gfxcon makecom
setstack 20000
Launch 1 '$*DEF.GFXCON >pipe:gfxcon $gfx_cfile $gfx_com'
setstack 4000
endif
; This is where the Launch command will return to when the program
; it has run has finished executing. We then tell it to do it again
xOnReturn 1
if $gfx_mode = CONVERT
update dir.gfxcon 13 Idle
update dir.gfxcon 7 Status:
update dir.gfxcon 8 Finished
endif
if $gfx_flag = 1
stop
endif
lvuse dir.gfxcon 21
lvgo #0
gfx_cfile = $$lv.rec
if $gfx_cfile > ""
lvdel 0
update dir.gfxcon 7 Converting:
update dir.gfxcon 8 $gfx_cfile
gosub dir.gfxcon makecom
setstack 20000
Launch 1 '$*DEF.GFXCON >pipe:gfxcon $gfx_cfile $gfx_com'
setstack 4000
endif
; ------------ Routine to form command line
xroutine makecom
gfx_com = 'FORMAT $gfx_format'
if $gfx_colors > ""
appvar gfx_com ' COLORS $gfx_colors'
endif
if $gfx_bw > ""
appvar gfx_com ' $gfx_bw'
endif
if $gfx_flip > ""
appvar gfx_com ' $gfx_flip'
endif
if $gfx_rot > ""
appvar gfx_com ' $gfx_rot'
endif
if $gfx_size > ""
appvar gfx_com ' $gfx_size $gfx_x $gfx_y'
endif
; --------------
; This is where we'll end up if anything goes wrong..
; i.e. such as GFXcon not finding the file and returning an error status
xOnFail
EZReq "An error occured.\nClick on Convert to continue." "OK" ""