Changeset 17 for trunk/gui/printer/cupswiz/cupswiz.VRX
- Timestamp:
- Nov 6, 2012, 6:22:25 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/printer/cupswiz/cupswiz.VRX
r16 r17 202 202 queue_name = GetQueueName( printer_title ) 203 203 port_name = GetNextPortName('CUPS') 204 use_drv = globals.!prdrv 205 206 /* Determine the source directories/files to pass to RINSTPRN.EXE. (Some 207 * of this logic is repeated from ImportPPD, but we have to do it again 208 * here because (a) we might not have gone through ImportPPD to get to this 209 * point, and (b) even if we did, the repository information might have 210 * changed.) 211 */ 212 copied_driver = 0 204 205 /* Determine the printer driver source directories/files. Yes, this is 206 * repeated from ImportPPD, but we have to do it again here because 207 * (a) we might not have gone through ImportPPD to get to this point, and 208 * (b) even if we did, the repository information might have changed. 209 */ 213 210 driver_path = GetDriverSource( prnt_drv ) 214 215 IF ( pmdx <> '') & ( globals.!prdrv <> '') & ( globals.!prdesc <> '') THEN DO 216 /* Printer driver is in the local repository, so we can just point 217 * to that, and use the system PRDESC.LST file. 211 IF driver_path == '' THEN 212 /* Driver was not found in the repository. Check for a previously- 213 * installed copy under \OS2\DLL. 218 214 */ 219 use_desc = globals.!prdesc 220 use_src = globals.!repository 221 END 222 ELSE IF driver_path <> '' THEN DO 223 /* Driver is not in the repository, but was found in another designated 224 * location. Point to that location, and create a temporary PRDESC.LST 225 * file for it. 226 */ 227 use_src = VRParseFilePath( driver_path, 'DP') 228 use_desc = use_src'\PRDESC.LST' 229 CALL CreateDriverList driver_path, use_desc 230 END 231 ELSE DO 232 /* Driver is not in the repository. Try to grab the installed files 233 * from under \OS2\DLL, copy them into a temporary working directory, 234 * and create a temporary PRDESC.LST file. 235 */ 236 driver_path = globals.!os2dir'\DLL\'prnt_drv'\'prnt_drv'.DRV' 237 238 use_src = SysTempFileName( globals.!tmpdir'\PDR_????') 239 use_desc = use_src'\PRDESC.LST' 240 241 IF VRMkDir( use_src ) == 0 THEN DO 242 CALL LINEOUT globals.!log1, 'Failed to create working directory' use_src':' VRError() 243 RETURN 1 244 END 245 IF CopyDriverToSource( driver_path, use_src ) == 0 THEN DO 246 CALL LINEOUT globals.!log1, 'Failed to copy driver' driver_path 'to working directory' use_src'.' 247 RETURN 1 248 END 249 CALL CreateDriverList driver_path, use_desc 250 copied_driver = 1 215 driver_path = STREAM( globals.!os2dir'\DLL\'prnt_drv'\'prnt_drv'.DRV', 'C', 'QUERY EXISTS') 216 217 IF driver_path == '' THEN DO 218 /* TODO allow the user to browse for the driver on their system */ 219 CALL VRMessage VRWindow(), 'The printer driver' prnt_drv 'could not ', 220 'be located. If you have the driver ', 221 'files, please copy them to the directory ', 222 globals.!os2dir'\DLL\'prnt_drv' and then ', 223 'try again.', 'Driver Not Found', 'E' 224 RETURN 1 251 225 END 252 226 … … 257 231 RETURN 1 258 232 259 rsp_file = globals.!tmpdir'\printer.rsp' 260 CALL RSPCreatePrinter rsp_file, prnt_drv, printer_model,, 261 port_name, queue_name, printer_title 262 263 /* Install the printer driver. (We do this manually because doing it 264 * through RINSTPRN seems not to work properly on some systems.) 265 */ 233 /* New logic to create the printer ourselves (instead of using RINSTPRN). 234 * There are two necessary steps: make sure the driver is installed, and 235 * then create the printer object (which causes the underlying device and 236 * queue to be created automatically as well). 237 */ 238 266 239 result = InstallPrintDriver( prnt_drv, driver_path, printer_model ) 267 IF result == 0 THEN CALL RSPInstallDriver rsp_file, prnt_drv, printer_model 268 269 /* Now call RINSTPRN to create the printer queue/device and object. 270 */ 271 result = ExecRINSTPRN( use_desc, use_drv, use_src, rsp_file ) 240 CALL LINEOUT globals.!log1, 'InstallPrintDriver(' prnt_drv',' driver_path',' printer_model ') RC =' result 241 242 IF result == 0 THEN 243 result = CreatePrinterObject( prnt_drv, printer_model,, 244 port_name, queue_name, printer_title ) 245 CALL LINEOUT globals.!log1, 'CreatePrinterObject(' prnt_drv',' printer_model, 246 ',' port_name',' queue_name',' printer_title, 247 ') RC =' result 248 272 249 IF result <> 0 THEN 273 250 CALL DeletePort port_name … … 278 255 'usable until the desktop is restarted.',, 279 256 'Port Driver Problem', 'W' 280 END281 282 IF copied_driver == 1 THEN DO283 CALL VRDeleteFile use_src'\*'284 CALL VRRmDir use_src285 257 END 286 258 … … 313 285 END 314 286 ELSE IF PrinterExistsInDRV( globals.!os2driver, globals.!prt_nick ) == 0 THEN DO 315 IF globals.!prt_ppd == '' THEN 287 cups_ppd = globals.!prt_ppd 288 IF cups_ppd == '' THEN 289 cups_ppd = STREAM( globals.!cupsdir'\etc\cups\ppd'globals.!prt_name'.ppd', 'C', 'QUERY EXISTS') 290 IF cups_ppd == '' THEN 316 291 CALL PromptForPMName 317 292 ELSE DO 318 ok = ImportPPD(globals.!os2driver, globals.!prt_ppd )293 ok = ImportPPD(globals.!os2driver, cups_ppd ) 319 294 IF ok <> 0 THEN DO 320 295 CALL LINEOUT globals.!log1, 'PPD import failed:' ok … … 618 593 manufacturers.count.!printers.1.!remark2 = '' 619 594 manufacturers.0 = count 595 596 CALL VRSet 'DT_INFO', 'Caption', 'Select the printer manufacturer and model from the list below.' 620 597 621 598 RETURN … … 1403 1380 'no similar models were found. The generic PostScript', 1404 1381 'driver will be used for application support.',, 1405 'Printer Name Not Found', ' E'1382 'Printer Name Not Found', 'W' 1406 1383 globals.!prt_nick = 'Generic PostScript Printer' 1407 1384 RETURN … … 1448 1425 1449 1426 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 1450 CALL VRSet 'DT_INFO', 'Caption', 'Select your printer model.'1451 1427 1452 1428 /* Populate the manufacturer list */
Note:
See TracChangeset
for help on using the changeset viewer.