/*
 * $VER: SkinCrop 0.7 (5.7.99)
 *
 * Arexx program for the ImageFX image processing system.
 * Written by Zer0-X / o'Moses   (zrx.oms@sci.fi)
 *
 * All Rights Released
 *
 * SkinCrop - Script to easily chop out the important parts of images for
 *            creating skins for (mainly) the Amiga's MPEG-Audio player.
 *
 *            The script will ask you to choose the buffer where the image
 *            to be converted is stored and informs if something is wrong.
 *
 *            It might be easier with the fonts to copy them from some
 *            ready-made skin and edit if neccessary.
 *
 *            And remember this: All temporary & final images will be
 *            saved to the selected path overwriting anything that exists!
 *
 *            More information about this subject can be found from:
 *            http://www.algonet.se/~daniel7/winamp/skinspecs.html
 *
 *
 * 0.1
 *    31.05.99 Just had an idea and started this thing out.
 *             It actually seems to be working quite OK.
 * 0.2
 *    01.06.99 Some coordinate adjustments to suit better for AmigaAMP.
 *             Cleaning the script (SPEED) & commenting it a bit.
 *             Imagebuffer selector & sizecheck added.
 *             Now copies the titlebar from the main image too.
 *             Some more frames added to the buttons to help to coordinate.
 *             Added destination directory requester & few error handlings.
 * 0.3
 *    02.06.99 Added some conversion options to create a framed backup of
 *             the main image (MAIN_BAK) to help finding the used areas, to
 *             set the frame color, to delete the temporary images, to
 *             disable the NUMBERS, PLAYPAUS & TEXT images creation & to
 *             disable the creation of help frames.
 *             Now resets the drawtool, mode, style & colors to defaults.
 * 0.4
 *    04.06.99 Added option to create 3D beveled edges ready for the buttons.
 *             Added few more output filetypes to choose from. (The backup of
 *             MAIN image is still saved in the IFF-ILBM format for quality.)
 * 0.5
 *    17.06.99 Fixed the beveling to create a bit more rounded edges.
 *             Added options to create a custom NUMBERS & PLAYPAUS images.
 *             Added one more help frame to the end of NUMBERS that seems to
 *             be shown if no songs are loaded when a new skin is loaded.
 *             Added some more look to the POSBAR, VOLUME & PANNING sliders.
 *             Added option to bevel also the MAIN image.
 * 0.6
 *    23.06.99 Added option to create markings for the play-control buttons.
 *             Changed file VOLBAR to VOLUME as this seems to be the name
 *             used more often and works now on TMLG too.
 *             POSBAR, VOLUME & PANNING sliders now use the help frame color.
 *             Fixed a little graphics bug between SHUFFLE & REPEAT buttons.
 *             Changed default options a bit (Hopefully doesn't matter).
 *             Added option to change the amount of beveling.
 *             Added option to create lights for the SHUFREP images.
 * 0.7
 *    05.07.99 Fixed a little bug in the MONOSTER image (TMLG once more).
 *             Fixed few coordinates to make the skins more compatible with
 *             AmigaAMP, AMPlifier, TMLG (and WinAMP if you prefer that).
 *             Added option to create beveled edges for the other visuals.
 *
 */

OPTIONS RESULTS

SIGNAL ON BREAK_C
SIGNAL ON ERROR

path = 'RAM:'
fform = 'ILBM'
jpgq = ''
fsuf = 'IFF'

LockInput
LockGui
Undo Off


SelectBuffer
GetMain
IF RESULT = "" THEN DO
   RequestNotify 'No image available.'
   CALL ERROR
END
PARSE VAR RESULT name width height pad last
IF (width ~= 275) | (height ~= 116) THEN DO
   IF (height ~= 275) | (pad ~= 116) THEN DO
      RequestNotify 'Image must be 275 x 116 pixels.'
      CALL ERROR
   END
END

PARAM.1 = 'CHECK 12 1 15 15 "Backup MAIN image with used areas marked." 0'
PARAM.2 = 'CHECK 12 15 15 15 "Create help frames for buttons & MONO/STEREO." 0'
PARAM.3 = 'CHECK 12 29 15 15 "3D Beveled buttons (Overrides help frames)." 1'
PARAM.4 = 'CHECK 12 57 15 15 "Create NUMBERS, PLAYPAUS & TEXT frame images." 0'
PARAM.5 = 'CHECK 380 71 15 15 "Delete temporary images." 1'
PARAM.6 = 'SLIDER 420 20 80 12 "Red" 200 0 255 %ld'
PARAM.7 = 'SLIDER 420 34 80 12 "Green" 128 0 255 %ld'
PARAM.8 = 'SLIDER 420 48 80 12 "Blue" 255 0 255 %ld'
PARAM.9 = 'TEXT 455 3 1 1 "Help Frame & Slider Color" JU=2'
PARAM.10 = 'BORDER 370 16 170 50'
PARAM.11 = 'CYCLE 454 109 60 12 "Output format:" 0 "IFF/JPG/BMP"'
PARAM.12 = 'SLIDER 439 124 80 12 "JPG Quality" 85 1 100 %ld'
PARAM.13 = 'CHECK 12 71 15 15 "Custom NUMBERS image (Overrides frames)." 1'
PARAM.14 = 'CHECK 12 85 15 15 "Custom PLAYPAUS image (Overrides frames)." 1'
PARAM.15 = 'CHECK 12 43 15 15 "3D Beveled MAIN image." 1'
PARAM.16 = 'CHECK 12 99 15 15 "Custom play control button markings." 1'
PARAM.17 = 'SLIDER 439 89 80 12 "Bevel amount" 64 0 255 %ld'
PARAM.18 = 'CHECK 12 113 15 15 "Create lights for SHUFREP button images." 1'
PARAM.19 = 'CHECK 12 127 15 15 "Bevel other visual blocks." 1'
PARAM.20 = 'END'

NewComplexRequest '"Skin Conversion Options"' PARAM 550 145
IF rc ~= 0 THEN CALL ERROR

PRMBAK = RESULT.1
PRMHLP = RESULT.2
PRMBEV = RESULT.3
PRMNUM = RESULT.4
PRMDEL = RESULT.5
PRMCNU = RESULT.13
PRMCPL = RESULT.14
PRMBMA = RESULT.15
PRMMRK = RESULT.16
PRMLIG = RESULT.18
PRMBVI = RESULT.19
RR = RESULT.6
GG = RESULT.7
BB = RESULT.8
BEV = RESULT.17

IF RESULT.11 = 1 THEN DO
   fform = 'JPEG'
   jpgq = RESULT.12
   fsuf = 'JPG'
END
ELSE IF RESULT.11 = 2 THEN DO
   fform = 'BMP'
   fsuf = 'BMP'
END

RequestFile '"Select destination directory:"' path DIRONLY
IF rc ~= 0 THEN CALL ERROR
outpath = result
IF RIGHT(outpath,1) ~= ':' THEN DO
   outpath = outpath || '/'
END


Pen 0 1
oldpen = RESULT
DrawTool FREEDRAW
oldtool = RESULT
DrawMode NORMAL
oldmode = RESULT
DrawStyle NORMAL
oldstyle = RESULT
FillMode SOLID
oldfill = RESULT
GetPalette 0
oldpal0 = RESULT
SetPalette 0 0 0 0
GetPalette 1
oldpal1 = RESULT
SetPalette 1 RR GG BB
GetPalette 2
oldpal2 = RESULT
SetPalette 2 0 128 255
GetPalette 3
oldpal3 = RESULT
SetPalette 3 255 255 0
GetPalette 4
oldpal4 = RESULT
SetPalette 4 0 255 0
GetPalette 5
oldpal5 = RESULT
SetPalette 5 0 128 0
GetPalette 6
oldpal6 = RESULT
SetPalette 6 255 0 0
GetPalette 7
oldpal7 = RESULT
SetPalette 7 128 0 0
ActiveColor 0
oldcol = RESULT


SaveBufferAs ILBM '"'||outpath||'_Main_Image.IFF"' Force


LoadBuffer '"'||outpath||'_Main_Image.IFF"' Force New
IF PRMBMA ~= 0 THEN DO
   xc=0 ; yc=0 ; xs=275 ; ys=116 ; CALL BBoxUO
END
IF PRMBVI ~= 0 THEN DO
   xc=9 ; yc=21 ; xs=10 ; ys=45 ; CALL BBoxDO	/* Clutterbar */
   xc=23 ; yc=27 ; xs=13 ; ys=7 ; CALL BBoxDO	/* Play Stop Pause Indicator */
   FilledBox 24 28 11 9
   xc=39 ; yc=31 ; xs=8 ; ys=3 ; CALL BBoxDO	/* Minus Sign */
   FilledBox 40 32 6 1
   xc=47 ; yc=25 ; xs=11 ; ys=15 ; CALL BBoxDO	/* Minute Digit 10s */
   FilledBox 48 26 9 13
   xc=59 ; yc=25 ; xs=11 ; ys=15 ; CALL BBoxDO	/* Minute Digit 1s */
   FilledBox 60 26 9 13
   xc=77 ; yc=25 ; xs=11 ; ys=15 ; CALL BBoxDO	/* Second Digit 10s */
   FilledBox 78 26 9 13
   xc=89 ; yc=25 ; xs=11 ; ys=15 ; CALL BBoxDO	/* Second Digit 1s */
   FilledBox 90 26 9 13
   xc=23 ; yc=42 ; xs=79 ; ys=18 ; CALL BBoxDO	/* Spectrometer Display */
   FilledBox 24 43 77 16
   xc=111 ; yc=26 ; xs=154 ; ys=8 ; CALL BBoxDO	/* Song Title Display */
   FilledBox 112 27 152 6
   xc=110 ; yc=42 ; xs=18 ; ys=8 ; CALL BBoxDO	/* Bitrate Display */
   FilledBox 111 43 16 6
   xc=155 ; yc=42 ; xs=12 ; ys=8 ; CALL BBoxDO	/* Sample Rate Display */
   FilledBox 156 43 10 6
   xc=106 ; yc=56 ; xs=70 ; ys=15 ; CALL BBoxDO	/* Volume Slider */
   xc=176 ; yc=56 ; xs=40 ; ys=15 ; CALL BBoxDO	/* Panning Slider */
   xc=15 ; yc=71 ; xs=250 ; ys=12 ; CALL BBoxDO	/* Position Bar */
END
SaveBufferAs fform '"'||outpath||'MAIN.'||fsuf||'"' jpgq Force


/*
 * Scissors
 * Box 10 22 8 43
 * SaveBrushAs ILBM '"'||outpath||'_Clutterbar.IFF"'
 * Scissors
 * Box 24 28 11 9
 * SaveBrushAs ILBM '"'||outpath||'_Play_Stop_Pause_Indicator.IFF"'
 * Scissors
 * Box 40 32 6 1
 * SaveBrushAs ILBM '"'||outpath||'_Minus_Sign.IFF"'
 * Scissors
 * Box 48 26 9 13
 * SaveBrushAs ILBM '"'||outpath||'_Minute_Digit_10s.IFF"'
 * Scissors
 * Box 60 26 9 13
 * SaveBrushAs ILBM '"'||outpath||'_Minute_Digit_1s.IFF"'
 * Scissors
 * Box 78 26 9 13
 * SaveBrushAs ILBM '"'||outpath||'_Second_Digit_10s.IFF"'
 * Scissors
 * Box 90 26 9 13
 * SaveBrushAs ILBM '"'||outpath||'_Second_Digit_1s.IFF"'
 * Scissors
 * Box 24 43 77 16
 * SaveBrushAs ILBM '"'||outpath||'_Spectrometer_Display.IFF"'
 * Scissors
 * Box 112 27 152 6
 * SaveBrushAs ILBM '"'||outpath||'_Song_Title_Display.IFF"'
 * Scissors
 * Box 111 43 16 6
 * SaveBrushAs ILBM '"'||outpath||'_Bitrate_Display.IFF"'
 * Scissors
 * Box 156 43 10 6
 * SaveBrushAs ILBM '"'||outpath||'_Sample_Rate_Display.IFF"'
 * Scissors
 * Box 177 57 38 13
 * SaveBrushAs ILBM '"'||outpath||'_Panning_Slider.IFF"'
 * Scissors
 * Box 253 91 13 15
 * SaveBrushAs ILBM '"'||outpath||'_About_Button.IFF"'
 */


Scissors
Box 0 0 275 14
SaveBrushAs ILBM '"'||outpath||'_Titlebar.IFF"'
Scissors
Box 212 41 29 12
SaveBrushAs ILBM '"'||outpath||'_Mono_Indicator.IFF"'
Scissors
Box 239 41 29 12
SaveBrushAs ILBM '"'||outpath||'_Stereo_Indicator.IFF"'
Scissors
Box 107 57 68 13
SaveBrushAs ILBM '"'||outpath||'_Volume_Slider.IFF"'
Scissors
Box 219 58 23 12
SaveBrushAs ILBM '"'||outpath||'_Equalizer_Button.IFF"'
Scissors
Box 242 58 23 12
SaveBrushAs ILBM '"'||outpath||'_Playlist_Editor_Button.IFF"'
Scissors
Box 16 72 248 10
SaveBrushAs ILBM '"'||outpath||'_Position_Bar.IFF"'
Scissors
Box 16 88 114 18
SaveBrushAs ILBM '"'||outpath||'_Play_Control_Buttons.IFF"'
Scissors
Box 136 89 22 16
SaveBrushAs ILBM '"'||outpath||'_Eject_Button.IFF"'
Scissors
Box 164 89 46 15
SaveBrushAs ILBM '"'||outpath||'_Shuffle_Button.IFF"'
Scissors
Box 210 89 28 15
SaveBrushAs ILBM '"'||outpath||'_Repeat_Button.IFF"'
KillBrush
KillBuffer Force


/*
 * Create framed backup of the main image.
 */
IF PRMBAK ~= 0 THEN DO
   LoadBuffer '"'||outpath||'_Main_Image.IFF"' Force New
   ActiveColor 1
   Box 10 22 8 43
   Box 24 28 11 9
   Line 40 32 45 32
   Box 48 26 9 13
   Box 60 26 9 13
   Box 78 26 9 13
   Box 90 26 9 13
   Box 24 43 77 16
   Box 112 27 152 6
   Box 111 43 16 6
   Box 156 43 10 6
   Box 177 57 38 13
   Box 253 91 13 15
   Box 0 0 275 14
   Box 212 41 27 12
   Box 239 41 29 12
   Box 107 57 68 13
   Box 219 58 23 12
   Box 242 58 23 12
   Box 16 72 248 10
   Box 16 88 114 18
   Box 136 89 22 16
   Box 164 89 46 15
   Box 210 89 28 15
   SaveBufferAs ILBM '"'||outpath||'MAIN_BAK.IFF"' Force
   KillBuffer Force
END


/*
 * Title bar & option buttons.
 */

   CreateBuffer 344 87 Force 255 255 255 New
   ActiveColor 0
   Box 0 0 9 9
   Box 0 9 9 9
   Box 9 0 9 9
   Box 9 9 9 9
   Box 18 0 9 9
   Box 18 9 9 9
   Box 0 18 9 9
   Box 9 18 9 9
   Box 0 27 9 9
   Box 9 27 9 9
   Box 0 36 17 7
   Box 17 36 3 7
   Box 20 36 3 7
   Box 23 36 3 7
   LoadBrush '"'||outpath||'_Titlebar.IFF"'
   BrushHandle 0 0
   Point 27 0
   Point 27 15
   KillBrush
   Box 27 29 275 14
   Box 27 42 275 14
   Box 27 57 275 14
   Box 27 72 275 14
   Box 304 0 8 43
   Box 312 0 8 43
   Box 304 44 8 43
   Box 312 44 8 43
   Box 320 44 8 43
   Box 328 44 8 43
   Box 336 44 8 43
   Box 196 31 7 10
   Box 203 31 10 10
   Box 213 31 9 10
   Box 222 31 9 10
   Box 231 31 11 10
   Box 242 31 10 10
   Box 196 44 7 10
   Box 203 44 10 10
   Box 213 44 9 10
   Box 222 44 9 10
   Box 231 44 11 10
   Box 242 44 10 10
   Box 106 34 38 4
   Box 157 33 3 6
   Box 161 33 10 6
   Box 174 33 10 6
   Box 253 33 17 7
   Box 106 47 38 4
   Box 157 46 3 6
   Box 161 46 10 6
   Box 174 46 10 6
   Box 253 46 17 7
   IF PRMBEV ~= 0 THEN DO
      xc=33 ; yc=3 ; xs=9 ; ys=9 ; CALL BBoxU
      xc=271 ; yc=3 ; xs=9 ; ys=9 ; CALL BBoxU
      xc=281 ; yc=3 ; xs=9 ; ys=9 ; CALL BBoxU
      xc=291 ; yc=3 ; xs=9 ; ys=9 ; CALL BBoxU
      xc=33 ; yc=18 ; xs=9 ; ys=9 ; CALL BBoxU
      xc=271 ; yc=18 ; xs=9 ; ys=9 ; CALL BBoxU
      xc=281 ; yc=18 ; xs=9 ; ys=9 ; CALL BBoxU
      xc=291 ; yc=18 ; xs=9 ; ys=9 ; CALL BBoxU
   END
   ELSE IF PRMHLP ~= 0 THEN DO
      ActiveColor 1
      Box 33 3 9 9
      Box 271 3 9 9
      Box 281 3 9 9
      Box 291 3 9 9
      Box 33 18 9 9
      Box 271 18 9 9
      Box 281 18 9 9
      Box 291 18 9 9
      ActiveColor 0
   END
   Box 33 32 9 9
   Box 271 32 9 9
   Box 281 32 9 9
   Box 291 32 9 9
   Box 33 45 9 9
   Box 271 45 9 9
   Box 281 45 9 9
   Box 291 45 9 9
   Box 33 60 9 9
   Box 271 60 9 9
   Box 281 60 9 9
   Box 291 60 9 9
   Box 33 75 9 9
   Box 271 75 9 9
   Box 281 75 9 9
   Box 291 75 9 9
   Box 305 46 6 8
   Box 313 54 6 8
   Box 321 62 6 8
   Box 329 70 6 8
   Box 337 78 6 7
   SaveBufferAs fform '"'||outpath||'TITLEBAR.'||fsuf||'"' jpgq Force
   KillBuffer Force


/*
 * Position bar.
 */

   CreateBuffer 307 10 Force 255 255 255 New
   LoadBrush '"'||outpath||'_Position_Bar.IFF"'
   BrushHandle 0 0
   Point 0 0
   KillBrush
   ActiveColor 1
   FilledBox 248 0 29 10
   xc=248 ; yc=0 ; xs=29 ; ys=10 ; CALL BBoxUO
   FilledBox 278 0 29 10
   xc=278 ; yc=0 ; xs=29 ; ys=10 ; CALL BBoxDO
   SaveBufferAs fform '"'||outpath||'POSBAR.'||fsuf||'"' jpgq Force
   KillBuffer Force


/*
 * Volume & panning sliders.
 */

   CreateBuffer 68 433 Force 255 255 255 New
   LoadBrush '"'||outpath||'_Volume_Slider.IFF"'
   BrushHandle 0 0
   i = 0
   DO UNTIL i = 420
      Point 0 i
      i = i + 15
   END
   KillBrush
   FilledBox 0 422 14 11
   xc=0 ; yc=422 ; xs=14 ; ys=11 ; CALL BBoxDO
   FilledBox 15 422 14 11
   xc=15 ; yc=422 ; xs=14 ; ys=11 ; CALL BBoxUO
   SaveBufferAs fform '"'||outpath||'VOLUME.'||fsuf||'"' jpgq Force
   KillBuffer Force


/*
 * Play, pause, stop, eject & other control buttons.
 */

   CreateBuffer 136 36 Force 255 255 255 New
   LoadBrush '"'||outpath||'_Play_Control_Buttons.IFF"'
   BrushHandle 0 0
   Point 0 0
   Point 0 18
   LoadBrush '"'||outpath||'_Eject_Button.IFF"'
   BrushHandle 0 0
   Point 114 0
   Point 114 16
   KillBrush
   IF PRMBEV ~= 0 THEN DO
      xc=0 ; yc=0 ; xs=23 ; ys=18 ; CALL BBoxU
      xc=23 ; yc=0 ; xs=23 ; ys=18 ; CALL BBoxU
      xc=46 ; yc=0 ; xs=23 ; ys=18 ; CALL BBoxU
      xc=69 ; yc=0 ; xs=23 ; ys=18 ; CALL BBoxU
      xc=92 ; yc=0 ; xs=22 ; ys=18 ; CALL BBoxU
      xc=114 ; yc=0 ; xs=22 ; ys=16 ; CALL BBoxU
      xc=0 ; yc=18 ; xs=23 ; ys=18 ; CALL BBoxD
      xc=23 ; yc=18 ; xs=23 ; ys=18 ; CALL BBoxD
      xc=46 ; yc=18 ; xs=23 ; ys=18 ; CALL BBoxD
      xc=69 ; yc=18 ; xs=23 ; ys=18 ; CALL BBoxD
      xc=92 ; yc=18 ; xs=22 ; ys=18 ; CALL BBoxD
      xc=114 ; yc=16 ; xs=22 ; ys=16 ; CALL BBoxD
   END
   ELSE IF PRMHLP ~= 0 THEN DO
      ActiveColor 1
      Box 0 0 23 18
      Box 23 18 23 18
      Box 46 0 23 18
      Box 69 18 23 18
      Box 92 0 22 18
      Box 114 16 22 16
   END
   IF PRMMRK ~= 0 THEN DO
      DrawMode DARKEN 64
      Line 6 4 6 13		/* PREV */
      Line 6 4 7 4
      Line 8 8 8 9
      Line 9 7 16 4
      Line 29 4 29 13		/* PLAY */
      Line 29 4 39 8
      Line 52 4 52 13		/* PAUSE */
      Line 52 4 55 4
      Line 59 4 59 13
      Line 59 4 62 4
      Line 75 4 75 13		/* STOP */
      Line 75 4 85 4
      Line 97 4 97 13		/* NEXT */
      Point 97 4
      Line 98 4 105 8
      Line 106 4 106 13
      Line 106 4 107 4
      Line 121 7 124 4		/* EJECT */
      Line 125 4 127 6
      Line 121 10 121 11
      Line 121 10 128 10
      Line 6 22 6 31		/* PREV */
      Line 6 22 7 22
      Line 8 26 8 27
      Line 9 25 16 22
      Line 29 22 29 31		/* PLAY */
      Line 29 22 39 26
      Line 52 22 52 31		/* PAUSE */
      Line 52 22 55 22
      Line 59 22 59 31
      Line 59 22 62 22
      Line 75 22 75 31		/* STOP */
      Line 75 22 85 22
      Line 97 22 97 31		/* NEXT */
      Point 97 22
      Line 98 22 105 26
      Line 106 22 106 31
      Line 106 22 107 22
      Line 121 23 124 20	/* EJECT */
      Line 125 20 127 22
      Line 121 26 121 27
      Line 121 26 128 26

      DrawMode LIGHTEN 64
      Line 7 5 7 13		/* PREV */
      Line 9 10 16 13
      Line 16 5 16 13
      Point 30 13		/* PLAY */
      Line 31 12 39 9
      Line 53 13 55 13		/* PAUSE */
      Line 55 5 55 13
      Line 60 13 62 13
      Line 62 5 62 13
      Line 76 13 85 13		/* STOP */
      Line 85 5 85 13
      Line 98 13 105 9		/* NEXT */
      Line 107 5 107 13
      Line 122 7 128 7		/* EJECT */
      Line 122 11 128 11
      Line 7 23 7 31		/* PREV */
      Line 9 28 16 31
      Line 16 23 16 31
      Point 30 31		/* PLAY */
      Line 31 30 39 27
      Line 53 31 55 31		/* PAUSE */
      Line 55 23 55 31
      Line 60 31 62 31
      Line 62 23 62 31
      Line 76 31 85 31		/* STOP */
      Line 85 23 85 31
      Line 98 31 105 27		/* NEXT */
      Line 107 23 107 31
      Line 122 23 128 23	/* EJECT */
      Line 122 27 128 27
      DrawMode NORMAL
   END
   SaveBufferAs fform '"'||outpath||'CBUTTONS.'||fsuf||'"' jpgq Force
   KillBuffer Force


/*
 * Equalizer, playlist editor, repeat & shuffle buttons.
 */

   CreateBuffer 92 85 Force 255 255 255 New
   LoadBrush '"'||outpath||'_Repeat_Button.IFF"'
   BrushHandle 0 0
   Point 0 0
   Point 0 15
   Point 0 30
   Point 0 45
   LoadBrush '"'||outpath||'_Shuffle_Button.IFF"'
   BrushHandle 0 0
   Point 28 0
   Point 28 15
   Point 28 30
   Point 28 45
   LoadBrush '"'||outpath||'_Equalizer_Button.IFF"'
   BrushHandle 0 0
   Point 0 61
   Point 46 61
   Point 0 73
   Point 46 73
   LoadBrush '"'||outpath||'_Playlist_Editor_Button.IFF"'
   BrushHandle 0 0
   Point 23 61
   Point 69 61
   Point 23 73
   Point 69 73
   KillBrush
   IF PRMBEV ~= 0 THEN DO
      xc=0 ; yc=0 ; xs=28 ; ys=15 ; CALL BBoxU
      xc=0 ; yc=15 ; xs=28 ; ys=15 ; CALL BBoxD
      xc=0 ; yc=30 ; xs=28 ; ys=15 ; CALL BBoxU
      xc=0 ; yc=45 ; xs=28 ; ys=15 ; CALL BBoxD
      xc=28 ; yc=0 ; xs=46 ; ys=15 ; CALL BBoxU
      xc=28 ; yc=15 ; xs=46 ; ys=15 ; CALL BBoxD
      xc=28 ; yc=30 ; xs=46 ; ys=15 ; CALL BBoxU
      xc=28 ; yc=45 ; xs=46 ; ys=15 ; CALL BBoxD
      xc=0 ; yc=61 ; xs=23 ; ys=12 ; CALL BBoxU
      xc=0 ; yc=73 ; xs=23 ; ys=12 ; CALL BBoxU
      xc=23 ; yc=61 ; xs=23 ; ys=12 ; CALL BBoxU
      xc=23 ; yc=73 ; xs=23 ; ys=12 ; CALL BBoxU
      xc=46 ; yc=61 ; xs=23 ; ys=12 ; CALL BBoxD
      xc=46 ; yc=73 ; xs=23 ; ys=12 ; CALL BBoxD
      xc=69 ; yc=61 ; xs=23 ; ys=12 ; CALL BBoxD
      xc=69 ; yc=73 ; xs=23 ; ys=12 ; CALL BBoxD
   END
   ELSE IF PRMHLP ~= 0 THEN DO
      Box 0 0 28 15
      Box 28 15 46 15
      Box 0 30 28 15
      Box 28 45 46 15
      Box 0 61 23 12
      Box 23 73 23 12
      Box 46 61 23 12
      Box 69 73 23 12
   END
   IF PRMLIG ~= 0 THEN DO
      xc=3 ; yc=3 ; xs=5 ; ys=4 ; CALL BBoxDO
      xc=31 ; yc=3 ; xs=5 ; ys=4 ; CALL BBoxDO
      xc=3 ; yc=18 ; xs=5 ; ys=4 ; CALL BBoxDO
      xc=31 ; yc=18 ; xs=5 ; ys=4 ; CALL BBoxDO
      xc=3 ; yc=33 ; xs=5 ; ys=4 ; CALL BBoxDO
      xc=31 ; yc=33 ; xs=5 ; ys=4 ; CALL BBoxDO
      xc=3 ; yc=48 ; xs=5 ; ys=4 ; CALL BBoxDO
      xc=31 ; yc=48 ; xs=5 ; ys=4 ; CALL BBoxDO
      xc=3 ; yc=64 ; xs=5 ; ys=3 ; CALL BBoxDO
      xc=26 ; yc=64 ; xs=5 ; ys=3 ; CALL BBoxDO
      xc=49 ; yc=64 ; xs=5 ; ys=3 ; CALL BBoxDO
      xc=72 ; yc=64 ; xs=5 ; ys=3 ; CALL BBoxDO
      xc=3 ; yc=76 ; xs=5 ; ys=3 ; CALL BBoxDO
      xc=26 ; yc=76 ; xs=5 ; ys=3 ; CALL BBoxDO
      xc=49 ; yc=76 ; xs=5 ; ys=3 ; CALL BBoxDO
      xc=72 ; yc=76 ; xs=5 ; ys=3 ; CALL BBoxDO
      ActiveColor 5
      Box 4 4 3 2
      Box 32 4 3 2
      Box 4 19 3 2
      Box 32 19 3 2
      Line 4 65 6 65
      Line 27 65 29 65
      Line 50 65 52 65
      Line 73 65 75 65
      ActiveColor 4
      Box 4 34 3 2
      Box 32 34 3 2
      Box 4 49 3 2
      Box 32 49 3 2
      Line 4 77 6 77
      Line 27 77 29 77
      Line 50 77 52 77
      Line 73 77 75 77
      ActiveColor 1
   END
   Scissors
   Box 0 0 1 15
   BrushHandle 0 0
   Point 74 0
   Point 74 15
   Point 74 30
   Point 74 45
   SaveBufferAs fform '"'||outpath||'SHUFREP.'||fsuf||'"' jpgq Force
   KillBuffer Force


/*
 * Mono & stereo indicators.
 */

   CreateBuffer 58 24 Force 255 255 255 New
   LoadBrush '"'||outpath||'_Stereo_Indicator.IFF"'
   BrushHandle 0 0
   Point 0 0
   Point 0 12
   LoadBrush '"'||outpath||'_Mono_Indicator.IFF"'
   BrushHandle 0 0
   Point 29 0
   Point 29 12
   KillBrush
   IF PRMHLP ~= 0 THEN DO
      Box 0 0 29 12
      Box 29 12 29 12
   END
   SaveBufferAs fform '"'||outpath||'MONOSTER.'||fsuf||'"' jpgq Force
   KillBuffer Force


/*
 * Play, pause & stop indicator lights.
 */

IF PRMCPL ~= 0 THEN DO
   CreateBuffer 42 9 Force 0 0 0 New
   ActiveColor 5
   NewArea
   AddArea 4 0
   AddArea 8 4
   AddArea 4 8
   AddArea 4 0
   Poly
   Box 10 2 3 5
   Box 14 2 3 5
   Box 20 2 5 5
   Box 36 0 3 3
   ActiveColor 4
   NewArea
   AddArea 5 2
   AddArea 7 4
   AddArea 5 6
   AddArea 5 2
   FilledPoly
   Box 11 3 1 3
   Box 15 3 1 3
   FilledBox 21 3 3 3
   Point 37 1
   ActiveColor 7
   Box 39 6 3 3
   ActiveColor 6
   Point 40 7
   ActiveColor 0
   SaveBufferAs fform '"'||outpath||'PLAYPAUS.'||fsuf||'"' jpgq Force
   KillBuffer Force
END
ELSE IF PRMNUM ~= 0 THEN DO
   CreateBuffer 42 9 Force 255 255 255 New
   ActiveColor 0
   Box 0 0 9 9
   Box 9 0 9 9
   Box 18 0 9 9
   Box 27 0 9 9
   Box 36 0 3 9
   Box 39 0 3 9
   SaveBufferAs fform '"'||outpath||'PLAYPAUS.'||fsuf||'"' jpgq Force
   KillBuffer Force
END


/*
 * Text fonts.
 */

IF PRMNUM ~= 0 THEN DO
   CreateBuffer 155 18 Force 255 255 255 New
   ActiveColor 0
   i = 0
   DO UNTIL i = 155
      Box i 0 5 6
      Box i 6 5 6
      Box i 12 5 6
      i = i + 5
   END
   SaveBufferAs fform '"'||outpath||'TEXT.'||fsuf||'"' jpgq Force
   KillBuffer Force
END


/*
 * Timer numbers.
 */

IF PRMCNU ~= 0 THEN DO
   CreateBuffer 99 13 Force 0 0 0 New
   ActiveColor 3
   Box 2 0 5 1		/* 0 */
   Box 0 2 1 3
   Box 8 2 1 3
   Box 0 8 1 3
   Box 8 8 1 3
   Box 2 12 5 1
   Box 17 2 1 3		/* 1 */
   Box 17 8 1 3
   Box 20 0 5 1		/* 2 */
   Box 26 2 1 3
   Box 20 6 5 1
   Box 18 8 1 3
   Box 20 12 5 1
   Box 29 0 5 1		/* 3 */
   Box 35 2 1 3
   Box 29 6 5 1
   Box 35 8 1 3
   Box 29 12 5 1
   Box 36 2 1 3		/* 4 */
   Box 44 2 1 3
   Box 38 6 5 1
   Box 44 8 1 3
   Box 47 0 5 1		/* 5 */
   Box 45 2 1 3
   Box 47 6 5 1
   Box 53 8 1 3
   Box 47 12 5 1
   Box 56 0 5 1		/* 6 */
   Box 54 2 1 3
   Box 56 6 5 1
   Box 54 8 1 3
   Box 62 8 1 3
   Box 56 12 5 1
   Box 65 0 5 1		/* 7 */
   Box 71 2 1 3
   Box 71 8 1 3
   Box 74 0 5 1		/* 8 */
   Box 72 2 1 3
   Box 80 2 1 3
   Box 74 6 5 1
   Box 72 8 1 3
   Box 80 8 1 3
   Box 74 12 5 1
   Box 83 0 5 1		/* 9 */
   Box 81 2 1 3
   Box 89 2 1 3
   Box 83 6 5 1
   Box 89 8 1 3
   Box 83 12 5 1
   Box 92 0 5 1		/* "0" */
   Box 90 2 1 3
   Box 98 2 1 3
   Box 90 8 1 3
   Box 98 8 1 3
   Box 92 12 5 1
   SaveBufferAs fform '"'||outpath||'NUMBERS.'||fsuf||'"' jpgq Force
   KillBuffer Force
END
ELSE IF PRMNUM ~= 0 THEN DO
   CreateBuffer 99 13 Force 255 255 255 New
   ActiveColor 0
   i = 0
   DO UNTIL i = 90
      Box i 0 9 13
      i = i + 9
   END
   Box 19 6 6 1
   SaveBufferAs fform '"'||outpath||'NUMBERS.'||fsuf||'"' jpgq Force
   KillBuffer Force
END


/*
 * Delete temporary images.
 */

IF PRMDEL ~= 0 THEN DO
   ADDRESS COMMAND 'Delete "'||outpath||'_Main_Image.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Titlebar.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Mono_Indicator.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Stereo_Indicator.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Volume_Slider.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Equalizer_Button.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Playlist_Editor_Button.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Position_Bar.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Play_Control_Buttons.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Eject_Button.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Shuffle_Button.IFF"'
   ADDRESS COMMAND 'Delete "'||outpath||'_Repeat_Button.IFF"'
END


BREAK_C:
   RequestNotify 'Script completed!'

ERROR:
   ActiveColor oldcol
   SetPalette 7 oldpal7
   SetPalette 6 oldpal6
   SetPalette 5 oldpal5
   SetPalette 4 oldpal4
   SetPalette 3 oldpal3
   SetPalette 2 oldpal2
   SetPalette 1 oldpal1
   SetPalette 0 oldpal0
   Pen oldpen
   DrawTool oldtool
   DrawMode oldmode
   DrawStyle oldstyle
   FillMode oldfill

Undo On
UnlockGui
UnlockInput

EXIT



BBoxUO:
   DrawMode DARKEN BEV
   Point xc+xs-1 yc+ys-1
   Point xc+xs-2 yc+ys-1
   Point xc+xs-1 yc+ys-2
   DrawTool FREELINE
   Line xc+xs-1 yc xc+xs-1 yc+ys-1
   Line xc+xs-1 yc+ys-1 xc yc+ys-1
   DrawTool FREEDRAW
   DrawMode LIGHTEN BEV
   Point xc yc
   Point xc+1 yc
   Point xc yc+1
   DrawTool FREELINE
   Line xc yc+ys-1 xc yc
   Line xc yc xc+xs-1 yc
   DrawTool FREEDRAW
   DrawMode NORMAL
   Return 0

BBoxU:
   DrawMode DARKEN BEV
   Point xc+xs-1 yc+ys-2
   Point xc+xs-2 yc+ys-2
   Point xc+xs-2 yc+ys-2
   Point xc+xs-2 yc+ys-2
   Point xc+xs-2 yc+ys-1
   DrawTool FREELINE
   Line xc+xs-1 yc+1 xc+xs-1 yc+ys-2
   Line xc+1 yc+ys-1 xc+xs-2 yc+ys-1
   DrawTool FREEDRAW
   DrawMode LIGHTEN BEV
   Point xc+1 yc+ys-2
   Point xc yc+1
   Point xc+1 yc+1
   Point xc+1 yc+1
   Point xc+1 yc+1
   Point xc+1 yc
   Point xc+xs-2 yc+1
   DrawTool FREELINE
   Line xc yc+1 xc yc+ys-2
   Line xc+1 yc xc+xs-2 yc
   DrawTool FREEDRAW
   DrawMode NORMAL
   Return 0


BBoxDO:
   DrawMode DARKEN BEV
   Point xc yc
   Point xc+1 yc
   Point xc yc+1
   DrawTool FREELINE
   Line xc yc+ys-1 xc yc
   Line xc yc xc+xs-1 yc
   DrawTool FREEDRAW
   DrawMode LIGHTEN BEV
   Point xc+xs-1 yc+ys-1
   Point xc+xs-2 yc+ys-1
   Point xc+xs-1 yc+ys-2
   DrawTool FREELINE
   Line xc+xs-1 yc xc+xs-1 yc+ys-1
   Line xc+xs-1 yc+ys-1 xc yc+ys-1
   DrawTool FREEDRAW
   DrawMode NORMAL
   Return 0

BBoxD:
   DrawMode DARKEN BEV
   Point xc+1 yc+ys-2
   Point xc yc+1
   Point xc+1 yc+1
   Point xc+1 yc+1
   Point xc+1 yc+1
   Point xc+1 yc
   Point xc+xs-2 yc+1
   DrawTool FREELINE
   Line xc yc+1 xc yc+ys-2
   Line xc+1 yc xc+xs-2 yc
   DrawTool FREEDRAW
   DrawMode LIGHTEN BEV
   Point xc+xs-1 yc+ys-2
   Point xc+xs-2 yc+ys-2
   Point xc+xs-2 yc+ys-2
   Point xc+xs-2 yc+ys-2
   Point xc+xs-2 yc+ys-1
   DrawTool FREELINE
   Line xc+xs-1 yc+1 xc+xs-1 yc+ys-2
   Line xc+1 yc+ys-1 xc+xs-2 yc+ys-1
   DrawTool FREEDRAW
   DrawMode NORMAL
   Return 0
