Changeset 21


Ignore:
Timestamp:
Feb 25, 2013, 6:33:09 AM (13 years ago)
Author:
Alex Taylor
Message:

Some fixes to the ImportPPD routine.

Location:
trunk/gui/printer/cupswiz
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/printer/cupswiz/cupswiz.VRP

    r20 r21  
    77VRXWindow: __VREMainWindow,1,614,2554,5770,9106
    88VRXWindow: __VRESectionListWindow,1,675,11804,4529,3891
    9 VRXWindow: __VREToolsWindow,1,1686,9877,4965,1663
     9VRXWindow: __VREToolsWindow,1,1686,9877,4971,1667
    1010VRXWindow: __VREWindListWindow,1,5228,11804,2650,3891
    1111UserFile: 1
  • trunk/gui/printer/cupswiz/cupswiz.VRX

    r20 r21  
    236236     */
    237237
    238     result = InstallPrintDriver( prnt_drv, driver_path, printer_model )
    239     CALL LINEOUT globals.!log1, 'InstallPrintDriver(' prnt_drv',' driver_path',' printer_model ') RC =' result
    240 
    241     IF result == 0 THEN
    242         result = CreatePrinterObject( prnt_drv, printer_model,,
    243                                       port_name, queue_name, printer_title )
    244     CALL LINEOUT globals.!log1, 'CreatePrinterObject(' prnt_drv',' printer_model,
    245                                 ',' port_name',' queue_name',' printer_title,
    246                                 ') RC =' result
    247 
    248     IF result <> 0 THEN
     238    ok = InstallPrintDriver( prnt_drv, driver_path, printer_model )
     239    CALL LINEOUT globals.!log1, 'InstallPrintDriver(' prnt_drv',' driver_path',' printer_model ') RC =' ok
     240
     241    IF ok == 0 THEN DO
     242        ok = CreatePrinterObject( prnt_drv, printer_model,,
     243                                  port_name, queue_name, printer_title )
     244        CALL LINEOUT globals.!log1, 'CreatePrinterObject(' prnt_drv',' printer_model,
     245                                    ',' port_name',' queue_name',' printer_title ') RC =' ok
     246    END
     247
     248    IF ok <> 0 THEN
    249249        CALL DeletePort port_name
    250250    ELSE IF port_ok == 1 THEN DO
     
    254254    END
    255255
    256 RETURN result
     256RETURN ok
    257257
    258258/*:VRX         CreatePrinter
     
    278278            IF ok <> 0 THEN DO
    279279                CALL LINEOUT globals.!log1, 'PPD import failed:' ok
    280                 CALL VRMessage VRWindow(), NLSGetMessage( 69 ),,        /* 69: The printer parameters could not ... PPD file. */
    281                                NLSGetMessage( 70 ), 'W'                 /* 70: Error importing PPD file */
    282                 CALL PromptForPMName
    283                 /* RETURN 1                RC=1  PPD import failed **/
     280                buttons.1 = NLSGetMessage( 2 )                          /*  2: OK */
     281                buttons.2 = NLSGetMessage( 3 )                          /*  3: Cancel */
     282                buttons.0 = 2
     283                ok = VRMessage( VRWindow(), NLSGetMessage( 69 ),,       /* 69: The printer parameters could not ... PPD file. */
     284                                NLSGetMessage( 70 ), 'W',,              /* 70: Error importing PPD file */
     285                                'buttons.', 1, 2 )
     286                IF ok == 1 THEN
     287                    CALL PromptForPMName
     288                ELSE
     289                    RETURN 1                /* RC=1  PPD import failed **/
    284290            END
    285291        END
     
    769775     * to our working directory.
    770776     */
    771     ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2>NUL 1| RXQUEUE' nq
     777    CALL LINEOUT globals.!log1, 'Converting PPD with:' ppd_exe ppdfile ppd_use
     778    ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2>NUL | RXQUEUE' nq
    772779    DO QUEUED()
    773780        PULL output
     
    777784    CALL LINEOUT globals.!log2
    778785
     786    IF VRFileExists( ppd_use ) == 0 THEN DO
     787        CALL LINEOUT globals.!log1, 'Hmm,' ppd_use 'was not created.  Copying manually.'
     788        CALL VRCopyFile ppdfile, ppd_use
     789    END
     790
    779791    /* Next we strip out some problematic lines used which are often encountered
    780792     * in (e.g.) CUPS-based PPD files.
     
    785797     */
    786798    count = 0
    787     ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2>NUL 1| RXQUEUE' nq
     799    ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2>NUL | RXQUEUE' nq
    788800    DO QUEUED()
    789801        PARSE PULL output
     
    863875     */
    864876    target = VRParseFilePath( driver_path, 'DP')
    865     ok = VRCopyFile( workdir'\OUT\*', target )
     877    CALL LINEOUT globals.!log1, 'Copying files from' workdir'\OUT to' target
     878    ADDRESS CMD '@UNLOCK' target'\'driver'.DRV 2>NUL 1>NUL'
     879    ok = VRCopyFile( workdir'\OUT\'driver'.DRV', target'\'driver'.DRV')
     880    IF ok == 1 THEN
     881        ok = VRCopyFile( workdir'\OUT\AUXPRINT.PAK', target'\AUXPRINT.PAK')
    866882    IF ok == 1 THEN DO
    867883        /* Copy the updated files to \OS2\DLL\<driver>, replacing any
     
    873889            CALL VRCopyFile workdir'\OUT\AUXPRINT.PAK',,
    874890                            globals.!os2dir'\DLL\'driver'\AUXPRINT.PAK'
     891            ADDRESS CMD '@UNLOCK' workdir'\OUT\'driver'.DRV 2>NUL 1>NUL'
    875892            CALL VRCopyFile workdir'\OUT\'driver'.DRV',,
    876893                            globals.!os2dir'\DLL\'driver'\'driver'.DRV'
    877894        END
    878895    END
    879     IF ok == 0 THEN
     896    IF ok == 0 THEN DO
     897        CALL LINEOUT globals.!log1, VRError()
    880898        RETURN 3                        /*** RC=3  Failed to copy driver files ***/
     899    END
    881900
    882901    CALL LINEOUT globals.!log1, newprinters.0 'printers imported successfully.'
     
    16191638    CALL NLSSetText 'SW_ABOUT',  'Caption', 10                                          /* 10: Product Information */
    16201639    CALL NLSSetText 'DT_ABOUT1', 'Caption', 11                                          /* 11: eCups Printer Install Utility */
    1621     CALL NLSSetText 'DT_ABOUT2', 'Caption', 12, '0.97'                                  /* 12: Version %1 */
    1622     CALL NLSSetText 'DT_ABOUT3', 'Caption', 13, '2010, 2012'                            /* 13: (C) %1 Alex Taylor */
     1640    CALL NLSSetText 'DT_ABOUT2', 'Caption', 12, '0.98'                                  /* 12: Version %1 */
     1641    CALL NLSSetText 'DT_ABOUT3', 'Caption', 13, '2010, 2013'                            /* 13: (C) %1 Alex Taylor */
    16231642    CALL NLSSetText 'PB_ABOUT',  'Caption', 2                                           /* 10: Product Information */
    16241643
Note: See TracChangeset for help on using the changeset viewer.