home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / grafica / svconvert15 / svconvert.dopus5 < prev    next >
Text File  |  2000-01-23  |  25KB  |  804 lines

  1. /*
  2.   $VER: SVConvert.dopus5 1.5 (23.01.2000)
  3.  
  4.   Written by Wayne Newark <wayne@zahadum.u-net.com>, using GoldEd/Pro.
  5.  
  6.   This is an ARexx script for DOpus Magellan that allows you to use Andreas
  7.   Kleinert's excellent SViewNG/SViewII/SViewIV to convert picture files from one
  8.   format to another. It processes all files selected in one or more source
  9.   listers, ignoring those it does not recognise.
  10.  
  11.   It will only work with a registered version of SViewNG/SViewII/SViewIV.
  12.  
  13.   This script can handle both multiple source and destination listers. All the
  14.   selected source files, from all the source listers, will be converted into
  15.   all the destination listers. As part of the conversion process the files are
  16.   renamed. It does this by stripping off all text after the last '.' and
  17.   appending an appropriate suffix.
  18.  
  19.   Example: Converting to PNG - Pic1.iff becomes Pic1.PNG
  20.            Converting to GIF - Pic2.pcx becomes Pic2.GIF
  21.  
  22.   ---------------------------------------------------------------------------
  23.  
  24.   Usage: ARexx     DOpus5:ARexx/SVConvert.dopus5 {Qp}
  25.  
  26.   format - At present this is limited to: JPEG, BMP, PNG, DEEP, PCX,
  27.                                           ILBM, PBM, RGFX, TIFF and SVG.
  28.  
  29.   Read the Superview-library.guide for further details on supported graphic
  30.   formats.
  31.  
  32.   ---------------------------------------------------------------------------
  33.  
  34.   History:
  35.  
  36.   Read document SVConvert.history for details of changes.
  37.  
  38. */
  39.  
  40. signal on Syntax                                /* intercept syntax errors                      */
  41. options results                                 /* need results                                 */
  42. options failat 11                               /* external commands are allowed return code 10 */
  43. lf='a'x                                         /* ascii code for linefeed                      */
  44.  
  45. SV_path = 'Serious:Graphics/Superview/SViewIV'  /* Location and name of SuperView program       */
  46. SV_port = 'SViewII.rx'                          /* Name of SuperView ARexx Port                 */
  47.  
  48. appname     = 'SVConvert'
  49. applongname = 'SVConvert.dopus5 - ©2000 by Wayne Newark'
  50. appinfo     = 'Script for SViewIV & DOpus 5.8+'
  51. appversion  = '1.5'
  52. apprelease  = '?'
  53. appdate     = '23.01.2000'
  54.  
  55. parse arg DOpus_port ' ' format
  56.  
  57. if DOpus_port='' then
  58.     DOpus_port='DOPUS.1'
  59.  
  60. address value DOpus_port
  61.  
  62. call Initialise
  63.  
  64. lister query source stem sl
  65. if sl.count=0 then
  66.     do
  67.         dopus request '"'txt_nosrc'"' txt_okay
  68.         exit
  69.     end
  70.  
  71. lister query dest stem dl
  72. if dl.count=0 then
  73.     do
  74.         dopus request '"'txt_nodest'"' txt_okay
  75.         exit
  76.     end
  77.  
  78. if format='' then
  79.     do
  80.         call Get_SaveType    /* Get required destination file(s) format */
  81.         if savetype='' then
  82.             exit
  83.     end
  84. else
  85.     do
  86.         do i=0 to sv.count-1
  87.             parse var sv.i sv_format '|' sv_suffix '|' sv_compression '|' sv_savetype1 '|' sv_savetype2
  88.             if sv_format=format then
  89.                 do
  90.                     suffix=sv_suffix
  91.                     savetype=sv_savetype1
  92.                     if sv_compression='Y' then
  93.                         do
  94.                             dopus request '"'txt_compress'"' txt_yesno
  95.                             if rc=1 then
  96.                                 savetype=sv_savetype2
  97.                         end
  98.                     leave
  99.                 end
  100.         end
  101.  
  102.         if savetype='' then
  103.             do
  104.                 dopus request '"'txt_format_1'"' txt_okay
  105.                 exit
  106.             end
  107.     end
  108.  
  109. /* Start Superview if not already running */
  110.  
  111. if ~show('p',SV_port) then
  112.     do
  113.         address command 'run >NIL: 'SV_path' -INSTALL_APPMENU=FALSE -INSTALL_APPICON=FALSE -INSTALL_APPWINDOW=FALSE'
  114.         address command 'WaitForPort 'SV_port
  115.         if ~show('p',SV_port) then /* If SuperView fails to start, an error is reported.  */
  116.             do
  117.                 dopus request '"'txt_sv_notfnd'"' txt_okay
  118.                 exit
  119.             end
  120.         SV_Started=1
  121.     end
  122.  
  123. address value SV_port
  124. "PUT_ICONS=NO"
  125. "ERROR_REPORT=NO"
  126. address value DOpus_port
  127.  
  128. /* lock the listers here!!! */
  129.  
  130. do s=0 to sl.count-1
  131.     lister set sl.s busy on
  132. end
  133.  
  134. do d=0 to dl.count-1
  135.     lister set dl.d busy on
  136. end
  137.  
  138. /* process source lister(s) */
  139.  
  140. do s=0 to sl.count-1
  141.     lister query sl.s path /* get path of current source lister */
  142.     src_path=strip(result,"B",'"')
  143.     lister query sl.s numselfiles /* get number of selected files */
  144.     number_files=result
  145.     lister query sl.s numselentries /* get total number of selected items */
  146.     total_selected=result
  147.     if number_files>0 then
  148.         do
  149.             complete=(1+dl.count)*number_files
  150.             sofar=0
  151.             lister clear sl.s abort
  152.             lister set sl.s newprogress abort bar name title
  153.             lister set sl.s newprogress title txt_title
  154.             lister set sl.s newprogress bar complete sofar
  155.             do t=1 to total_selected
  156.                 sofar=sofar+1 /* increase progress position */
  157.                 lister query sl.s firstsel /* obtain selected item */
  158.                 src_name=strip(result,"B",'"')
  159.                 lister query sl.s entry "'"src_name"'" stem fileinfo /* check for directories */
  160.                 if fileinfo.type<0 then
  161.                     do
  162.                         /* check for icons (those with .info suffix) and ignore them */
  163.                         if right(src_name,5)~='.info' then
  164.                             do
  165.                                 lister set sl.s newprogress name txt_loading src_name
  166.                                 lister set sl.s newprogress bar complete sofar
  167.                                 call Load_File
  168.                                 if SV_status~='No file loaded' then
  169.                                     do
  170.                                         lister query sl.s abort
  171.                                         if result then
  172.                                             do
  173.                                                 lister set sl.s newprogress off
  174.                                                 dopus request '"'txt_aborted'"' txt_okay
  175.                                                 call The_End
  176.                                                 exit
  177.                                             end
  178.                                         call Convert_File
  179.                                         do d=0 to dl.count-1 /* now save file to all destinations */
  180.                                             sofar=sofar+1 /* increase progress position */
  181.                                             if dl.count>1 then
  182.                                                 lister set sl.s newprogress name txt_saving dest_name||" "||d+1
  183.                                             else
  184.                                                 lister set sl.s newprogress name txt_saving dest_name
  185.                                             lister set sl.s newprogress bar complete sofar
  186.                                             call Save_File
  187.                                             lister query sl.s abort
  188.                                             if result then
  189.                                                 do
  190.                                                     lister set sl.s newprogress off
  191.                                                     dopus request '"'txt_aborted'"' txt_okay
  192.                                                     call The_End
  193.                                                     exit
  194.                                                 end
  195.                                         end /* end of do */
  196.                                         call Delete_File
  197.                                     end
  198.                                 else
  199.                                     do
  200.                                         sofar=sofar+dl.count
  201.                                         lister select sl.s '"'src_name'"' off /* deselect current file (invalid format) */
  202.                                     end
  203.                             end
  204.                         else
  205.                             do
  206.                                 sofar=sofar+dl.count
  207.                                 lister select sl.s '"'src_name'"' off /* deselect current file (#?.info) */
  208.                             end
  209.                     end
  210.                 else
  211.                     do
  212.                         lister select sl.s '"'src_name'"' off /* deselect current directory */
  213.                     end
  214.                 lister refresh sl.s /* refresh current source lister */
  215.             end /* end of do */
  216.             lister set sl.s newprogress off
  217.         end
  218. end
  219.  
  220. call The_End
  221.  
  222. exit
  223.  
  224. Syntax:
  225.  
  226. call The_End
  227.  
  228. address value DOpus_port
  229. dopus request '"'txt_error_fnd'"' txt_okay
  230.  
  231. exit
  232.  
  233.  
  234. /*** Called subroutines or functions follow ***/
  235.  
  236.  
  237. /*
  238. **  Tidies up listers etc.
  239. */
  240.  
  241. The_End:
  242.  
  243. /* Reread all destination listers */
  244.  
  245. /* Unlock any locked listers */
  246.  
  247.     do s=0 to sl.count-1
  248.         lister set sl.s busy off
  249.     end
  250.  
  251.     do d=0 to dl.count-1
  252.         lister query dl.d path /* obtain path of destination lister */
  253.         dest_path=strip(result,"B",'"')
  254.         lister set dl.d busy off
  255.         lister read dl.d dest_path
  256.     end
  257.  
  258. /* Quit Superview if started by this script */
  259.  
  260.     if SV_Started then
  261.         if show('p',SV_port) then
  262.             do
  263.                 address value SV_port
  264.                 "QUIT"
  265.             end
  266.     else
  267.         do
  268.            address value SV_port
  269.            "ERROR_REPORT=YES"
  270.         end
  271.  
  272.     return
  273.  
  274.  
  275. /*
  276. **   Sets Output File Format and creates new destination file name
  277. */
  278.  
  279. Convert_File:
  280.  
  281.     lang=length(src_name)
  282.     posn=lastpos('.',src_name)
  283.     po=lang-posn
  284.  
  285.     /* rename destination filename */
  286.  
  287.     if posn=0 then
  288.         dest_name=src_name || '.' || suffix
  289.     else
  290.         do
  291.             suffix_old=right(src_name,po)
  292.             dest_name=left(src_name,posn) || suffix
  293.         end
  294.  
  295.     if DATATYPE(suffix_old,'N') = 1 then
  296.         dest_name = dest_name || '.' || suffix_old
  297.  
  298.     dest_info.name=dest_name
  299.  
  300.     address value SV_port
  301.     if suffix='GIF' then
  302.         do
  303.             parse var SV_status st ' ' width 'x' height 'x' depth
  304.             if depth>8 then
  305.                 do
  306.                     "SVOPERATOR=Dither24Bit" /* reduces picture to 8 bit */
  307.                     "ACTION"
  308.                 end
  309.         end
  310.  
  311.     interpret '"SAVE_TYPE='savetype'"' /* Sets SuperView Savetype */
  312.  
  313.     return
  314.  
  315.  
  316. /*
  317. **  Causes Superview to save file to destination lister
  318. */
  319.  
  320. Save_File:
  321.  
  322.     address value DOpus_port
  323.  
  324.     lister query dl.d path /* obtain path of destination lister */
  325.     dest_path=strip(result,"B",'"')
  326.  
  327.     dest_file=dest_path||dest_name /* set up complete file name */
  328.  
  329.     if (exists(dest_file) & Overwrite_ind=0) then
  330.         do
  331.             dopus request '"'||dest_file||txt_replace_1'"' txt_replace_2
  332.             if rc=0 then
  333.                 return
  334.             if rc=2 then
  335.                 Overwrite_ind=1
  336.         end
  337.  
  338.     address value SV_port
  339.  
  340.     interpret '"SAVE='||dest_file||'"'
  341.  
  342.     address value DOpus_port
  343.  
  344.     lister addstem dl.d dest_info /* update destination lister */
  345.     lister refresh dl.d
  346.  
  347.     return
  348.  
  349.  
  350. /*
  351. ** Loads current picture into Superview
  352. */
  353.  
  354. Load_File:
  355.  
  356.     src_file=src_path||src_name
  357.  
  358.     address value SV_port
  359.     interpret '"LOAD='||src_file||'"'
  360.     'STATUS=T:SV.status'
  361.  
  362.     if open(ifile,'T:SV.status','R') then
  363.         do
  364.             SV_status=readln(ifile)
  365.             call close ifile
  366.         end
  367.     else
  368.         SV_status='No file loaded'
  369.  
  370.     address value DOpus_port
  371.  
  372.     return
  373.  
  374.  
  375. /*
  376. ** Deletes source file.
  377. **
  378. ** We need to load a dummy file into SViewII so that it frees up the current file
  379. ** for deletion.
  380. */
  381.  
  382. Delete_File:
  383.  
  384.     address value SV_port
  385.     "LOAD=T:SV.status"
  386.     address value DOpus_port
  387.  
  388.     if (exists(src_file) & Delete_ind=0) then
  389.         do
  390.             dopus request '"'||src_name||txt_delete_1'"' txt_delete_2
  391.             select
  392.                 when rc=1 then
  393.                     keep=0
  394.                 when rc=2 then
  395.                     do
  396.                         Delete_ind=1
  397.                         keep=0
  398.                     end
  399.                 when rc=3 then
  400.                     do
  401.                         Delete_ind=2
  402.                         keep=2
  403.                     end
  404.                 otherwise
  405.                     keep=1
  406.             end
  407.         end
  408.  
  409.     lister select sl.s '"'src_name'"' off /* deselect current file */
  410.  
  411.     if (Delete_ind=1 | keep=0) then
  412.         do
  413.             pragma('D', src_path)
  414.             address command 'c:delete ' || '"'src_name'"' || ' QUIET FORCE'
  415.             if rc=0 then
  416.                 lister remove sl.s '"'src_name'"'
  417.         end
  418.  
  419. /*    lister refresh sl.s    refresh current source lister */
  420.  
  421.     return
  422.  
  423.  
  424. /*
  425. ** Asks User to select destination savetype
  426. ** Used when triton libraries are installed
  427. */
  428.  
  429. Get_SaveType:
  430.     fmtlist.0=sv.count
  431.     do i=0 to sv.count-1
  432.         j=i+1
  433.         parse var sv.i dummy '|' fmtlist.j
  434.     end
  435.  
  436. /* Set up the Triton Window objects */
  437.  
  438.     Windowtags=WindowID(1),
  439.                WindowPosition('TRWP_MOUSEPOINTER'),
  440.                PubScreenName('DOPUS.1'),
  441.                WindowBackfillFB,
  442.                WindowTitle('SVConvert'),
  443.                  'HorizGroupA',
  444.                    'Space',
  445.                    'VertGroupA',
  446.                      'Space',
  447.                      NamedFrameBox(txt_format_2),
  448.                      'HorizGroupA',
  449.                        'Space',
  450.                        'VertGroupA',
  451.                          'Space',
  452.                          ListSS(fmtlist,50,0,0),
  453.                          'Space',
  454.                          'Space',
  455.                          'HorizGroupA',
  456.                            Button(txt_use,61),
  457.                            'Space',
  458.                            Button(txt_quit,62),
  459.                          'EndGroup',
  460.                          'Space',
  461.                        'EndGroup',
  462.                        'SpaceS',
  463.                      'EndGroup',
  464.                      'Space',
  465.                    'EndGroup',
  466.                    'Space',
  467.                  'EndGroup',
  468.                'EndProject'
  469.  
  470.    app = TR_CREATEAPP('TRCA_Name'     '"'appname'"',
  471.                       'TRCA_LongName' '"'applongname'"',
  472.                       'TRCA_Info'     '"'appinfo'"',
  473.                       'TRCA_Version'  '"'appversion'"',
  474.                       'TRCA_Release'  '"'apprelease'"',
  475.                       'TRCA_Date'     '"'appdate'"',
  476.                       'TAG_END')
  477.  
  478.     if app~='00000000'x then
  479.         do
  480.             fmtwin=TR_OPENPROJECT(app,Windowtags)
  481.             if fmtwin~='00000000'x then
  482.                 do
  483.                     lquit=0
  484.                     do while lquit=0
  485.                         call TR_WAIT(app,'')
  486.                         do while TR_HANDLEMSG(app,'event')
  487.                             if event.trm_class='TRMS_CLOSEWINDOW' then
  488.                                 lquit=1
  489.                             if event.trm_class='TRMS_NEWVALUE' then
  490.                                 if event.trm_id=50 then
  491.                                         if bitand(d2x(event.trm_qualifier),'0200'x)='0200'x then /* double-click */
  492.                                             lquit=1
  493.                             if event.trm_class='TRMS_ACTION' then
  494.                                 do
  495.                                     if event.trm_id=61 then /* Use button */
  496.                                         lquit=1
  497.                                     if event.trm_id=62 then /* Quit Button */
  498.                                         lquit=2
  499.                                 end
  500.                         end
  501.                     end
  502.  
  503.                     if lquit=1 then
  504.                         do
  505.                             number=TR_GETATTRIBUTE(fmtwin,50,'TRAT_Value')
  506.                             parse var sv.number suffix '|' savetype
  507.                         end
  508.                     else
  509.                         savetype=''
  510.  
  511.                     call TR_CLOSEPROJECT(fmtwin)
  512.                 end
  513.             else
  514.                 do
  515.                     dopus request '"'txt_error_fnd'"' txt_okay
  516.                     exit
  517.                 end
  518.             call TR_DELETEAPP(app)
  519.         end
  520.     else
  521.         do
  522.             dopus request '"'txt_error_fnd'"' txt_okay
  523.             exit
  524.         end
  525.  
  526.     return
  527.  
  528. /*
  529. ** Initialises variables etc.
  530. */
  531.  
  532. Initialise:
  533.     SV_Started    = 0
  534.     Overwrite_ind = 0
  535.     Delete_ind    = 0
  536.     Use_locale    = 1
  537.  
  538. /* Open locale.library */
  539.  
  540.     call Open_Catalog
  541.  
  542. /* Set up catalog details */
  543.  
  544.     MSG_USE_GAD                    = 0
  545.     MSG_QUIT_GAD                   = 1
  546.     MSG_SELECT_SVOBJECT            = 2
  547.     MSG_USE_COMPRESSION            = 3
  548.     MSG_OKAY_GAD                   = 4
  549.     MSG_YES_GAD                    = 5
  550.     MSG_NO_GAD                     = 6
  551.     MSG_ALL_GAD                    = 7
  552.     MSG_NONE_GAD                   = 8
  553.     MSG_TITLE                      = 9
  554.     MSG_SAVING                     = 10
  555.     MSG_LOADING                    = 11
  556.     MSG_USER_ABORTED               = 12
  557.     MSG_REPLACE_FILE_1             = 13
  558.     MSG_REPLACE_FILE_2             = 14
  559.     MSG_DELETE_FILE_1              = 15
  560.     MSG_DELETE_FILE_2              = 16
  561.     WARN_NO_SOURCE                 = 17
  562.     WARN_NO_DESTINATION            = 18
  563.     UNKNOWN_ERROR_FOUND            = 19
  564.     ERROR_UNKNOWN_FORMAT           = 20
  565.     ERROR_SVIEW_NOT_FOUND_1        = 21
  566.     ERROR_SVIEW_NOT_FOUND_2        = 22
  567.     ERROR_TRITON_LIB_NOT_FOUND     = 23
  568.     ERROR_TRITONREXX_LIB_NOT_FOUND = 24
  569.     ERROR_CANNOT_OPEN_TRITONREXX   = 25
  570.  
  571. /* Default catalog values (English) */
  572.  
  573.     String.0  = '_Use'
  574.     String.1  = '_Quit'
  575.     String.2  = 'Select SV Object:'
  576.     String.3  = 'Shall I use compression?'
  577.     String.4  = 'Ok'
  578.     String.5  = 'Yes'
  579.     String.6  = 'No'
  580.     String.7  = 'All'
  581.     String.8  = 'None'
  582.     String.9  = 'Converting file(s)...'
  583.     String.10 = 'Saving'
  584.     String.11 = 'Loading'
  585.     String.12 = 'User Aborted'
  586.     String.13 = ' exists.'
  587.     String.14 = 'Shall I overwrite it?'
  588.     String.15 = ' processed.'
  589.     String.16 = 'Shall I delete it?'
  590.     String.17 = 'No source(s) selected.'
  591.     String.18 = 'No destination(s) selected.'
  592.     String.19 = 'An error has occurred'
  593.     String.20 = 'Unknown Format Specified.'
  594.     String.21 = 'SViewIV can not be started,'
  595.     String.22 = 'check the path!'
  596.     String.23 = 'The triton.library could not be found!'
  597.     String.24 = 'The tritonrexx.library could not be found!'
  598.     String.25 = 'Could not open the tritonrexx.library!'
  599.  
  600. /* End of catalog details */
  601.  
  602. /* Set text strings according to users prefered language */
  603.  
  604.     txt_use       = Locale_String(MSG_USE_GAD)
  605.     txt_quit      = Locale_String(MSG_QUIT_GAD)
  606.     txt_format_1  = Locale_String(ERROR_UNKNOWN_FORMAT)
  607.     txt_format_2  = Locale_String(MSG_SELECT_SVOBJECT)
  608.     txt_nosrc     = Locale_String(WARN_NO_SOURCE)
  609.     txt_nodest    = Locale_String(WARN_NO_DESTINATION)
  610.     txt_compress  = Locale_String(MSG_USE_COMPRESSION)
  611.     txt_okay      = Locale_String(MSG_OKAY_GAD)
  612.     txt_yesno     = Locale_String(MSG_YES_GAD)'|'Locale_String(MSG_NO_GAD)
  613.     txt_sv_notfnd = Locale_String(ERROR_SVIEW_NOT_FOUND_1)'lf'Locale_String(ERROR_SVIEW_NOT_FOUND_2)
  614.     txt_title     = Locale_String(MSG_TITLE)
  615.     txt_loading   = Locale_String(MSG_LOADING)
  616.     txt_saving    = Locale_String(MSG_SAVING)
  617.     txt_aborted   = Locale_String(MSG_USER_ABORTED)
  618.     txt_error_fnd = Locale_String(UNKNOWN_ERROR_FOUND)
  619.     txt_replace_1 = Locale_String(MSG_REPLACE_FILE_1)||lf||Locale_String(MSG_REPLACE_FILE_2)
  620.     txt_replace_2 = Locale_String(MSG_YES_GAD)'|'Locale_String(MSG_ALL_GAD)'|'Locale_String(MSG_NO_GAD)
  621.     txt_delete_1  = Locale_String(MSG_DELETE_FILE_1)||lf||Locale_String(MSG_DELETE_FILE_2)
  622.     txt_delete_2  = Locale_String(MSG_YES_GAD)'|'Locale_String(MSG_ALL_GAD)'|'Locale_String(MSG_NONE_GAD)'|'Locale_String(MSG_NO_GAD)
  623.  
  624. /* Check to see if the Triton libraries are installed */
  625.  
  626.     if format='' then
  627.         do
  628.             if ~exists('Libs:triton.library') then
  629.                 do
  630.                     dopus request '"'Locale_String(ERROR_TRITON_LIB_NOT_FOUND)'"' Locale_String(MSG_OKAY_GAD)
  631.                     call Close_Catalog
  632.                     exit
  633.                 end
  634.             if ~exists('Libs:tritonrexx.library') then
  635.                 do
  636.                     dopus request '"'Locale_String(ERROR_TRITONREXX_LIB_NOT_FOUND)'"' Locale_String(MSG_OKAY_GAD)
  637.                     call Close_Catalog
  638.                     exit
  639.                 end
  640.         end
  641.  
  642. /* Open Triton Arexx Library */
  643.  
  644.     if (format='' & ~show('L','tritonrexx.library')) then
  645.         if ~addlib('tritonrexx.library',10,-30,0) then
  646.             do
  647.                 dopus request '"'Locale_String(ERROR_CANNOT_OPEN_TRITONREXX)'"' Locale_String(MSG_OKAY_GAD)
  648.                 call Close_Catalog
  649.                 exit
  650.             end
  651.  
  652.     if format='' then
  653.         do
  654. /*
  655.             sv.x - <suffix>|<savetype>
  656. */
  657.             i        = 0
  658.             sv.i     = 'iff|ACBM uncompressed'
  659.             i        = i+1
  660.             sv.i     = 'bmp|BMP (Win,OS/2)'
  661.             i        = i+1
  662.             sv.i     = 'eps|EPS (Header/PS)'
  663.             i        = i+1
  664.             sv.i     = 'iff|DEEP'
  665.             if exists('Libs:svobjects/GIF.svobject') then
  666.                 do
  667.                     i        = i+1
  668.                     sv.i     = 'gif|GIF 87a'
  669.                     i        = i+1
  670.                     sv.i     = 'gif|GIF 89a'
  671.                 end
  672.             i        = i+1
  673.             sv.i     = 'iff|ILBM CmpByteRun1'
  674.             i        = i+1
  675.             sv.i     = 'iff|ILBM uncompressed'
  676.             i        = i+1
  677.             sv.i     = 'jpg|JPEG (IJG-JFIF)'
  678.             i        = i+1
  679.             sv.i     = 'pbm|PBM CmpByteRun1'
  680.             i        = i+1
  681.             sv.i     = 'pbm|PBM uncompressed'
  682.             i        = i+1
  683.             sv.i     = 'pcx|PCX V2.5-3.0'
  684.             i        = i+1
  685.             sv.i     = 'png|PNG (PiNG)'
  686.             i        = i+1
  687.             sv.i     = 'pgm|PNM PGM (P5)'
  688.             i        = i+1
  689.             sv.i     = 'ppm|PNM PPM (P6)'
  690.             i        = i+1
  691.             sv.i     = 'iff|RGFX uncompressed'
  692.             i        = i+1
  693.             sv.i     = 'iff|RGFX XPK-compressed'
  694.             i        = i+1
  695.             sv.i     = 'qrt|QRT/POV RayTracer'
  696.             i        = i+1
  697.             sv.i     = 'sgi|SGI'
  698.             i        = i+1
  699.             sv.i     = 'i|Sourcecode Asm'
  700.             i        = i+1
  701.             sv.i     = 'c|Sourcecode C'
  702.             i        = i+1
  703.             sv.i     = 'ras|SunRaster (RAS)'
  704.             i        = i+1
  705.             sv.i     = 'svg|SVG Graphics File'
  706.             i        = i+1
  707.             sv.i     = 'tiff|TIFF V5.0'
  708.             i        = i+1
  709.             sv.i     = 'tga|Targa (TGA)'
  710.             i        = i+1
  711.             sv.i     = 'iff|YUVN (411)'
  712.             sv.count = i+1
  713.         end
  714.     else
  715.         do
  716. /*
  717.             sv.x - <image format>|<suffix>|<compression available?>|<uncompressed savetype>|<compressed savetype>
  718. */
  719.             sv.0     = 'JPEG|jpg|N|JPEG (IJG-JFIF)|x'
  720.             sv.1     = 'BMP|bmp|N|BMP (Win,OS/2)|x'
  721.             sv.2     = 'PNG|png|N|PNG (PiNG)|x'
  722.             sv.3     = 'PCX|pcx|N|PCX V2.5-3.0|x'
  723.             sv.4     = 'DEEP|iff|N|DEEP|x'
  724.             sv.5     = 'ILBM|iff|Y|ILBM uncompressed|ILBM CmpByteRun1'
  725.             sv.6     = 'PBM|pbm|Y|PBM uncompressed|PBM CmpByteRun1'
  726.             sv.7     = 'RGFX|iff|Y|RGFX uncompressed|RGFX XPK-compressed'
  727.             sv.8     = 'SVG|svg|N|SVG Graphics File|x'
  728.             sv.9     = 'TIFF|tiff|N|TIFF V5.0|x'
  729.             sv.10    = 'TGA|tga|N|Targa (TGA)|x'
  730.             sv.11    = 'PGM|pgm|N|PNM PGM (P5)|x'
  731.             sv.12    = 'PPM|ppm|N|PNM PPM (P6)|x'
  732.             sv.13    = 'SGI|sgi|N|SGI|x'
  733.             sv.14    = 'YUVN|iff|N|YUVN (411)|x'
  734.             sv.15    = 'RAS|ras|N|SunRaster (RAS)|x'
  735.             sv.16    = 'ACBM|iff|N|ACBM uncompressed|x'
  736.             if exists('Libs:svobjects/GIF.svobject') then
  737.                 do
  738.                     sv.17    = 'GIF|gif|N|GIF 89a|x'
  739.                     sv.count = 18
  740.                 end
  741.             else
  742.                 sv.count = 17
  743.         end
  744.  
  745.     savetype      = ''
  746.     suffix        = ''
  747.  
  748.     call Close_Catalog
  749.  
  750.     return
  751.  
  752. /*
  753. **  Returns the appropriate string value
  754. */
  755.  
  756. Locale_String:
  757.     parse arg stringnumber
  758.  
  759.     if Use_locale then
  760.         return(GetCatalogStr(catalog,stringnumber,string.stringnumber))
  761.     else
  762.         return(string.stringnumber)
  763.  
  764. /*
  765. **  Opens Locale catalog, if present
  766. */
  767.  
  768. Open_Catalog:
  769.     if ~show('L','locale.library') then
  770.         if ~addlib('locale.library',-10,-30,0) then
  771.             uselocale = 0
  772.  
  773.     if open(language,'ENV:Language','R') then
  774.         do
  775.             lang=READLN(language)
  776.             close(language)
  777.         end
  778.     else
  779.         lang=''
  780.  
  781.     lang=lang || '/'
  782.  
  783.     if Use_locale then
  784.         do
  785.             catalog = OpenCatalog('DOPUS5:catalogs/'lang'SVConvert.catalog','english',0)
  786.             if catalog=0 then
  787.                 catalog=OpenCatalog('SVConvert.catalog','english',0)
  788.             if catalog=0 then
  789.                 Use_locale=0
  790.         end
  791.  
  792.     return
  793.  
  794. /*
  795. **  Closes Locale catalog, if used
  796. */
  797.  
  798. Close_Catalog:
  799.     if Use_locale then
  800.         CloseCatalog(catalog)
  801.  
  802.     return
  803.  
  804.