source: trunk/gui/printer/manager/PRINTOOL.VRX@ 36

Last change on this file since 36 was 33, checked in by Alex Taylor, 13 years ago

Printer Manager, initial import.

File size: 75.1 KB
Line 
1/*:VRX Main
2*/
3/* Main
4*/
5Main:
6/* Process the arguments.
7 Get the parent window.
8*/
9 parse source . calledAs .
10 parent = ""
11 argCount = arg()
12 argOff = 0
13 if( calledAs \= "COMMAND" )then do
14 if argCount >= 1 then do
15 parent = arg(1)
16 argCount = argCount - 1
17 argOff = 1
18 end
19 end; else do
20 call VROptions 'ImplicitNames'
21 call VROptions 'NoEchoQuit'
22 end
23 InitArgs.0 = argCount
24 if( argCount > 0 )then do i = 1 to argCount
25 InitArgs.i = arg( i + argOff )
26 end
27 drop calledAs argCount argOff
28
29/* Load the windows
30*/
31 call VRInit
32 parse source . . spec
33 _VREPrimaryWindowPath = ,
34 VRParseFileName( spec, "dpn" ) || ".VRW"
35 _VREPrimaryWindow = ,
36 VRLoad( parent, _VREPrimaryWindowPath )
37 drop parent spec
38 if( _VREPrimaryWindow == "" )then do
39 call VRMessage "", "Cannot load window:" VRError(), ,
40 "Error!"
41 _VREReturnValue = 32000
42 signal _VRELeaveMain
43 end
44
45/* Process events
46*/
47 call Init
48 signal on halt
49 do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
50 _VREEvent = VREvent()
51 interpret _VREEvent
52 end
53_VREHalt:
54 _VREReturnValue = Fini()
55 call VRDestroy _VREPrimaryWindow
56_VRELeaveMain:
57 call VRFini
58exit _VREReturnValue
59
60VRLoadSecondary:
61 __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
62 if __vrlsWait then do
63 call VRFlush
64 end
65 __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
66 if __vrlsHWnd = '' then signal __vrlsDone
67 if __vrlsWait \= 1 then signal __vrlsDone
68 call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
69 __vrlsTmp = __vrlsWindows.0
70 if( DataType(__vrlsTmp) \= 'NUM' ) then do
71 __vrlsTmp = 1
72 end
73 else do
74 __vrlsTmp = __vrlsTmp + 1
75 end
76 __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
77 __vrlsWindows.0 = __vrlsTmp
78 do while( VRIsValidObject( VRWindow() ) = 1 )
79 __vrlsEvent = VREvent()
80 interpret __vrlsEvent
81 end
82 __vrlsTmp = __vrlsWindows.0
83 __vrlsWindows.0 = __vrlsTmp - 1
84 call VRWindow __vrlsWindows.__vrlsTmp
85 __vrlsHWnd = ''
86__vrlsDone:
87return __vrlsHWnd
88
89/*:VRX __VXREXX____APPENDS__
90*/
91__VXREXX____APPENDS__:
92/*
93#append ..\..\Shared\PrManUtl.VRS
94*/
95return
96/*:VRX CheckPrograms
97*/
98CheckPrograms: PROCEDURE EXPOSE globals.
99
100 /* See if CUPSLPR.EXE (required by CUPS.PDR) is installed.
101 */
102 tcpipbin = SysSearchPath('PATH', 'inetd.exe')
103 IF tcpipbin <> '' THEN
104 tcpipbin = VRParseFileName( tcpipbin, 'DP')
105 ELSE
106 tcpipbin = globals.!bootdrv'\TCPIP\BIN'
107 globals.!programs.!cupslpr = STREAM( tcpipbin'\cupslpr.exe', 'C', 'QUERY EXISTS')
108 IF globals.!programs.!cupslpr == '' THEN
109 globals.!programs.!cupslpr = SysSearchPath('PATH', 'cupslpr.exe')
110 IF globals.!programs.!cupslpr == '' THEN
111 globals.!programs.!cupslpr = STREAM( globals.!mydir'\cupslpr.exe', 'C', 'QUERY EXISTS')
112
113 /* See if GZIP.EXE is installed (required for unpacking CUPS PPDs).
114 */
115 globals.!programs.!gzip = SysSearchPath('PATH', 'gzip.exe')
116 IF globals.!programs.!gzip == '' THEN
117 globals.!programs.!gzip = SysSearchPath('PATH', 'gunzip.exe')
118 IF globals.!programs.!gzip == '' THEN
119 globals.!programs.!gzip = STREAM( globals.!mydir'\gzip.exe', 'C', 'QUERY EXISTS')
120
121RETURN
122
123/*:VRX CN_DEVICES_ContextMenu
124*/
125CN_DEVICES_ContextMenu: PROCEDURE EXPOSE globals.
126
127 _record = VRInfo("Record")
128 IF _record <> '' THEN DO
129 CALL VRMethod 'CN_DEVICES', 'SetRecordAttr', _record, 'Selected', 1
130 CALL VRMethod 'MN_DRIVERS', 'Popup'
131 END
132 ELSE
133 CALL VRMethod 'MN_VIEW', 'Popup'
134
135RETURN
136
137/*:VRX CN_PORTS_ContextMenu
138*/
139CN_PORTS_ContextMenu: PROCEDURE EXPOSE globals.
140
141 _record = VRInfo("Record")
142 IF _record <> '' THEN DO
143 CALL VRMethod 'CN_PORTS', 'SetRecordAttr', _record, 'Selected', 1
144 CALL VRMethod 'MN_PORT', 'Popup'
145 END
146 ELSE DO
147 CALL VRMethod 'MN_VIEW', 'Popup'
148 END
149
150RETURN
151
152/*:VRX CN_PRINTERPAKS_ContextMenu
153*/
154CN_PRINTERPAKS_ContextMenu: PROCEDURE EXPOSE globals.
155 _record = VRInfo("Record")
156 IF _record <> '' THEN DO
157 CALL VRMethod 'CN_PRINTERPAKS', 'SetRecordAttr', _record, 'Selected', 1
158 CALL VRMethod 'MN_PRINTERPAK', 'Popup'
159 END
160RETURN
161
162/*:VRX CN_PRINTERS_ContextMenu
163*/
164CN_PRINTERS_ContextMenu: PROCEDURE EXPOSE globals.
165
166 _record = VRInfo("Record")
167 IF _record <> '' THEN DO
168 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', _record, 'Selected', 1
169 _flags = VRMethod('CN_PRINTERS', 'GetFieldData', _record, globals.!hcfPrinters.!flags )
170 IF POS('D', _flags ) > 0 THEN
171 CALL VRSet 'MI_PRINTER_DEFAULT', 'Checked', 1
172 ELSE
173 CALL VRSet 'MI_PRINTER_DEFAULT', 'Checked', 0
174 IF POS('P', _flags ) > 0 THEN
175 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 1
176 ELSE
177 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 0
178 CALL VRMethod 'MN_PRINTER', 'Popup'
179 END
180 ELSE
181 CALL VRMethod 'MN_VIEW', 'Popup'
182
183RETURN
184
185/*:VRX CN_PRINTERS_DoubleClick
186*/
187CN_PRINTERS_DoubleClick:
188 CALL PrinterOpen VRInfo("Record")
189RETURN
190
191/*:VRX DriverAdd
192*/
193DriverAdd: PROCEDURE EXPOSE globals.
194
195RETURN
196
197/*:VRX DriverDelete
198*/
199DriverDelete: PROCEDURE EXPOSE globals
200
201RETURN
202
203/*:VRX Fini
204*/
205Fini:
206 window = VRWindow()
207 call VRSet window, "Visible", 0
208 drop window
209return 0
210
211/*:VRX GetPrinterPaks
212*/
213GetPrinterPaks: PROCEDURE EXPOSE globals.
214 IF globals.!prdrv == '' THEN RETURN 0
215
216 IF globals.!is_ecs == 1 THEN _osname = 'eComStation'
217 ELSE _osname = 'OS/2'
218
219 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
220
221 _count = 0
222 DO WHILE LINES( globals.!prdrv ) > 0
223 /* Read the driver definition from PRDRV.LST
224 */
225 _ppdef = STRIP( LINEIN( globals.!prdrv ))
226 IF _ppdef == '' THEN ITERATE
227 PARSE VAR _ppdef _ppdriver _ppdisk _ppdesc
228 IF _ppdisk == '' THEN ITERATE
229 _ppdesc = STRIP( _ppdesc )
230 _pppath = globals.!repository'\PMDD_'_ppdisk
231
232 /* Check to see if the driver is installed/active.
233 */
234 _flags = 'R'
235 PARSE UPPER VAR _ppdriver _basename'.DRV' .
236 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _basename, 'USER') WITH used_drv '00'x .
237 IF ( used_drv <> '') & VRFileExists( used_drv ) THEN DO
238 _ppicon = '$1:'used_drv
239 _ppstatus = NLSGetMessage( 177, _osname ) NLSGetMessage( 180 )
240 _flags = 'I'
241 END
242 ELSE IF VRFileExists( _pppath'\'_ppdriver ) THEN DO
243 _ppicon = '$1:'_pppath'\'_ppdriver
244 _ppstatus = NLSGetMessage( 177, _osname )
245 END
246 ELSE ITERATE
247
248 _pprev = BldLevelVersion( _pppath'\'_ppdriver )
249
250 /* Driver found, add the record.
251 */
252 _count = _count + 1
253 _fielddata = globals.!hcfPaks.!icon';'_ppicon';' ||,
254 globals.!hcfPaks.!name';'_ppdriver';' ||,
255 globals.!hcfPaks.!status';'_ppstatus';' ||,
256 globals.!hcfPaks.!path';'_pppath';' ||,
257 globals.!hcfPaks.!version';'_pprev';' ||,
258 globals.!hcfPaks.!desc';'_ppdesc';' ||,
259 globals.!hcfPaks.!flags';'_flags';'
260 ppaks._count = ';'_ppdriver';'_ppicon';;;'_fielddata
261 END
262 CALL STREAM globals.!prdrv, 'C', 'CLOSE'
263
264 /* Now look for some known third-party drivers.
265 */
266 PARSE UPPER VALUE VRGetIni('PrinterManager', 'ThirdParty', 'USER') WITH known_3p '00'x .
267 IF known_3p == '' THEN
268 known_3p = 'ECUPS ECUPS-HP GUTENPRT PSPRINT'
269 DO i = 1 TO WORDS( known_3p )
270 _basename = WORD( known_3p, i )
271 _ppini = VRGetIni('PM_INSTALL', _basename'_DIR', 'USER')
272 IF _ppini == '' THEN ITERATE
273 PARSE VAR _ppini _pppath '00'x .
274
275 /* Check to see if the driver is installed/active.
276 */
277 _flags = ''
278 _ppdriver = _basename'.DRV'
279 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _basename, 'USER') WITH used_drv '00'x .
280 IF ( used_drv <> '') & VRFileExists( used_drv ) THEN DO
281 _ppicon = '$1:'used_drv
282 _ppstatus = NLSGetMessage( 178 ) NLSGetMessage( 180 )
283 _flags = 'I'
284 END
285 ELSE IF VRFileExists( _pppath'\'_ppdriver ) THEN DO
286 _ppicon = '$1:'_pppath'\'_ppdriver
287 _ppstatus = NLSGetMessage( 178 )
288 END
289 ELSE ITERATE
290
291 _pprev = BldLevelVersion( _pppath'\'_ppdriver )
292
293 /* Driver found, add the record.
294 */
295 _count = _count + 1
296 _fielddata = globals.!hcfPaks.!icon';'_ppicon';' ||,
297 globals.!hcfPaks.!name';'_ppdriver';' ||,
298 globals.!hcfPaks.!status';'_ppstatus';' ||,
299 globals.!hcfPaks.!path';'_pppath';' ||,
300 globals.!hcfPaks.!version';'_pprev';' ||,
301 globals.!hcfPaks.!flags';'_flags';'
302 ppaks._count = ';'_ppdriver';'_ppicon';;;'_fielddata
303 END
304
305 ppaks.0 = _count
306 CALL VRMethod 'CN_PRINTERPAKS', 'AddRecordList',, 'Last', 'ppaks.'
307
308 CALL VRSet 'WN_MAIN', 'Pointer', '<default>'
309
310RETURN _count
311
312/*:VRX Halt
313*/
314Halt:
315 signal _VREHalt
316return
317
318/*:VRX ImportPPD
319*/
320/* Import a new PPD file into a PostScript driver. This is unfortunately rather
321 * complicated, all the more so because we need to deal with a large number of
322 * possible situations.
323 */
324ImportPPD: PROCEDURE EXPOSE globals.
325 ARG driver, ppdfile
326 IF driver == '' THEN driver = 'PSCRIPT'
327
328 CALL LINEOUT globals.!log1, 'Going to import PPD file into driver' driver'.'
329
330 status = LocateDriverFiles( driver )
331
332 SELECT
333
334 /* An installable copy of the driver was found. No special action is
335 * required; we can proceed with the import logic below.
336 */
337 WHEN status == 1 THEN NOP
338
339 /* An installable (working) copy of the driver could not be located, but
340 * we found an installed (in use) version whence we can grab the files.
341 */
342 WHEN status == 2 THEN DO
343 /* We need somewhere for the installable copies to live. We ask
344 * the user to confirm this path, as they'll have to specify the
345 * directory later on if they install the driver from PM.
346 */
347 _btn.1 = NLSGetMessage( 2 )
348 _btn.2 = NLSGetMessage( 3 )
349 _btn.3 = NLSGetMessage( 188 )
350 _btn.0 = 3
351 _prompt = NLSGetMessage( 232, driver ) ||,
352 '0a0a0a'x || NLSGetMessage( 187, driver )
353
354 /* Try and determine a suitable default directory */
355 PARSE VALUE VRGetIni('PM_INSTALL', driver'_DIR', 'USER') WITH drvr_dir '00'x .
356 IF drvr_dir == '' THEN
357 PARSE VALUE VRGetIni('InstPDR', 'PATH_TO_'driver, 'USER') WITH drvr_dir '00'x .
358 IF drvr_dir == '' THEN
359 drvr_dir = globals.!repository'\'driver
360
361 /* Now prompt the user to confirm the path */
362 DO UNTIL _select <> 3
363 _select = VRPrompt( VRWindow(), _prompt, 'drvr_dir',,
364 NLSGetMessage( 189 ), '_btn.', 1, 2 )
365 IF _select == 3 THEN
366 drv_dir = VRXDirectoryDialog( VRWindow(), drvr_dir, NLSGetMessage( 189 ))
367 END
368 IF drvr_dir == '' THEN RETURN 1 /** RC=1 cancelled */
369 drvr_dir = VRExpandFileName( drvr_dir )
370 IF drvr_dir == '' THEN RETURN 3 /** RC=3 bad path */
371
372 /* Create the new directory if necessary */
373 IF \VRIsDir( drvr_dir ) THEN
374 IF VRMkDir( drvr_dir ) == 0 THEN RETURN 5 /** RC=5 failed to create directory */
375
376 /* Now copy the driver files */
377 IF CopyPrinterPak( driver_path, drvr_dir ) == 0 THEN RETURN 3 /** RC=4 failed to copy driver files */
378 CALL VRSetIni 'PM_INSTALL', driver'_DIR', drvr_dir||'00'x, 'USER'
379
380 /* Point to the copied driver files as our new working copy */
381 driver_path = drvr_dir'\'driver'.DRV'
382 END
383
384 OTHERWISE DO /* Driver was not found */
385 CALL VRMessage VRWindow(), NLSGetMessage( 231, driver ),,
386 NLSGetMessage( 13 ), 'E'
387 RETURN 2 /** RC=2 driver not found */
388 END
389
390 END
391
392 /* OK, we should now have an acceptable 'installable' copy of the
393 * PrinterPak files. Next, we will:
394 * - Create a temporary working directory & copy the PrinterPak files there
395 * - Pre-process the PPD file to make it ready for import, and also copy it
396 * to a driver-specific 'saved PPDs' directory for future use
397 * - Use PIN to import the PPD into into our temporary working copy
398 * - Copy the updated driver back to our installable copy
399 * - If the driver is actually installed, copy the updated driver back over
400 * the installed version as well.
401 * - If this is a 'shipped' driver (i.e. one listed in PRDRV.LST) then add
402 * the newly-defined printer to PRDESC.LST.
403 */
404
405 /** TODO should move all below this into a new shared function **/
406
407 CALL LINEOUT globals.!log1, 'Driver source: ' driver_path
408
409 workdir = SysTempFileName( globals.!tmpdir'\PPD_????')
410 ok = VRMkDir( workdir )
411 IF ok == 1 THEN ok = VrMkDir( workdir'\OUT')
412 IF ok <> 1 THEN
413 RETURN 5 /** RC=5 failed to create directory */
414
415 CALL LINEOUT globals.!log1, 'Temporary directory: ' workdir
416
417 SELECT
418 WHEN driver == 'ECUPS' THEN ppddir = globals.!repository'\PPD_E'
419 WHEN driver == 'ECUPS-HP' THEN ppddir = globals.!repository'\PPD_EHP'
420 WHEN driver == 'PSPRINT' THEN ppddir = globals.!repository'\PPD_PS'
421 WHEN driver == 'PSPRINT2' THEN ppddir = globals.!repository'\PPD_PS2'
422 WHEN driver == 'PSCRIPT2' THEN ppddir = globals.!repository'\PPD2'
423 WHEN driver == 'GUTENPRT' THEN ppddir = globals.!repository'\PPD_GP'
424 OTHERWISE ppddir = globals.!repository'\PPD'
425 END
426
427 /* Make sure ppddir (for keeping PPD files) exists */
428 CALL SysFileTree ppddir, 'dirs.', 'DO'
429 IF dirs.0 == 0 THEN DO
430 ok = VRMkDir( ppddir )
431 IF ok <> 1 THEN
432 RETURN 5 /** RC=5 failed to create directory */
433 END
434
435 CALL LINEOUT globals.!log1, 'Directory for PPD files:' ppddir
436
437 /***
438 *** Now do the actual work.
439 ***/
440
441
442 /* Copy the needed driver files to our working directories.
443 */
444 drvr_dir = VRParseFileName( driver_path, 'DP')
445 drv_out = workdir'\OUT\'driver'.DRV'
446 pin_exe = workdir'\PIN.EXE'
447 ppd_exe = workdir'\PPDENC.EXE'
448 ok = VRCopyFile( driver_path, drv_out )
449 IF ok == 1 THEN ok = VRCopyFile( drvr_dir'\PIN.EXE', pin_exe )
450 IF ok == 1 THEN ok = VRCopyFile( drvr_dir'\PPDENC.EXE', ppd_exe )
451 IF ok == 0 THEN DO
452 RETURN 4 /*** RC=4 Failed to copy driver files ***/
453 END
454
455 /* Set up the output redirection.
456 */
457 nq = RXQUEUE('CREATE')
458 oq = RXQUEUE('SET', nq )
459
460 /* If the PPD file is compressed, uncompress it.
461 */
462 IF VRParseFilePath( ppdfile, 'E') == 'GZ' THEN DO
463 decppd = workdir'\' || VRParseFilePath( ppdfile, 'N')
464 CALL LINEOUT globals.!log1, 'Decompressing' ppdfile 'to' decppd
465 ADDRESS CMD '@'globals.!programs.!gzip '-c -d' ppdfile '| RXQUEUE' nq
466 DO QUEUED()
467 PARSE PULL line
468 CALL LINEOUT decppd, line
469 END
470 CALL LINEOUT decppd
471 ppdfile = decppd
472 END
473
474 IF VRFileExists( ppdfile ) == 0 THEN DO
475 CALL LINEOUT globals.!log1, 'PPD file' ppdfile 'could not be found.'
476 RETURN 6 /** RC=6 PPD import failed **/
477 END
478
479 ppd_use = ppddir'\' || VRParseFileName( ppdfile, 'NE')
480
481 /* Now we have to clean up and validate the PPD file so PIN can use it.
482 * First, PPDENC converts the codepage if necessary, and copies the results
483 * to our working directory.
484 */
485 CALL LINEOUT globals.!log1, 'Converting PPD with:' ppd_exe ppdfile ppd_use
486 ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2>NUL | RXQUEUE' nq
487 DO QUEUED()
488 PULL output
489 CALL LINEOUT globals.!log2, output
490 END
491 CALL LINEOUT globals.!log2, ''
492 CALL LINEOUT globals.!log2
493
494 IF VRFileExists( ppd_use ) == 0 THEN DO
495 CALL LINEOUT globals.!log1, 'Hmm,' ppd_use 'was not created. Copying manually.'
496 CALL VRCopyFile ppdfile, ppd_use
497 END
498
499 /* Next we strip out some problematic PPD statements which are often
500 * encountered in (for example) CUPS-based PPD files.
501 */
502 CALL CleanPPD ppd_use, globals.!log1
503
504 /* Preparation complete. Now do the import.
505 */
506 count = 0
507 ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2>NUL | RXQUEUE' nq
508 DO QUEUED()
509 PARSE PULL output
510 CALL LINEOUT globals.!log2, output
511 PARSE VAR output . 'OK (' nickname
512 IF nickname <> '' THEN DO
513 count = count + 1
514 newprinters.count = STRIP( nickname, 'T', ')')
515 END
516 END
517 newprinters.0 = count
518 CALL LINEOUT globals.!log2, ''
519 CALL LINEOUT globals.!log2
520
521 /* End the output redirection.
522 */
523 CALL RXQUEUE 'SET', oq
524 CALL RXQUEUE 'DELETE', nq
525
526
527 /***
528 *** Post-import processing.
529 ***/
530
531 IF newprinters.0 == 0 THEN DO
532 RETURN 6 /** RC=6 PPD import failed **/
533 END
534
535 IF driver_repo == 1 THEN DO
536 /* If we're working out of the repository, we need to update the
537 * driver table in PRDESC.LST to add the new driver(s).
538 */
539
540 CALL LINEOUT globals.!log1, 'Updating' globals.!prdesc 'with new entries from' drv_out
541
542/* -- This causes a SYS3175 in the .DRV for some reason...
543 ok = UpdatePrDesc( driver'.DRV', drv_out )
544 IF ok <> 0 THEN
545 CALL LINEOUT globals.!log1, 'Failed to update' globals.!prdesc '(are EAs on' drv_out ' valid?)'
546*/
547
548 count = 0
549
550 /* First, copy all lines that don't refer to the driver just updated */
551 CALL LINEIN globals.!prdesc, 1, 0
552 DO WHILE LINES( globals.!prdesc )
553 _next = LINEIN( globals.!prdesc )
554 PARSE UPPER VAR _next WITH . ':' . '('_prdrv')' .
555 IF _prdrv == driver'.DRV' THEN ITERATE
556 count = count + 1
557 defs.count = _next
558 END
559 CALL STREAM globals.!prdesc, 'C', 'CLOSE'
560
561 /* Next, create a new list for the updated driver and merge that in */
562 newlist = workdir'\'driver'.LST'
563 CALL CreateDriverList drv_out, newlist
564 DO WHILE LINES( newlist )
565 _line = LINEIN( newlist )
566 count = count + 1
567 defs.count = _line
568 END
569 CALL STREAM newlist, 'C', 'CLOSE'
570 defs.0 = count
571
572 /* Now sort the list and recreate PRDESC.LST */
573 CALL SysStemSort 'defs.',, 'I'
574 prdesc_tmp = workdir'\PRDESC.LST'
575 IF STREAM( prdesc_tmp, 'C', 'QUERY EXISTS') <> '' THEN
576 CALL VRDeleteFile prdesc_tmp
577 DO i = 1 TO defs.0
578 CALL LINEOUT prdesc_tmp, defs.i
579 END
580 CALL LINEOUT prdesc_tmp
581 ok = VRCopyFile( prdesc_tmp, globals.!prdesc )
582 IF ok == 0 THEN DO
583 RETURN 7 /** RC=7 Error updating PRDESC.LST **/
584 END
585 CALL VRDeleteFile prdesc_tmp
586
587 END
588
589 /* Finally, copy the updated driver files.
590 */
591 target = VRParseFilePath( driver_path, 'DP')
592 CALL LINEOUT globals.!log1, 'Copying files from' workdir'\OUT to' target
593 CALL PRReplaceModule target'\'driver'.DRV', '', ''
594 ok = VRCopyFile( workdir'\OUT\'driver'.DRV', target'\'driver'.DRV')
595 IF ok == 1 THEN
596 ok = VRCopyFile( workdir'\OUT\AUXPRINT.PAK', target'\AUXPRINT.PAK')
597 IF ok == 1 THEN DO
598 /* Copy the updated files to \OS2\DLL\<driver>, replacing any
599 * existing copies. (This prevents problems if the OS/2 driver
600 * installation doesn't/fails to copy them, which can happen under
601 * some circumstances.)
602 */
603 IF VRFileExists( globals.!os2dir'\DLL\'driver'.DRV') THEN DO
604 CALL VRCopyFile workdir'\OUT\AUXPRINT.PAK',,
605 globals.!os2dir'\DLL\'driver'\AUXPRINT.PAK'
606 CALL PRReplaceModule globals.!os2dir'\DLL\'driver'\'driver'.DRV', '', ''
607 CALL VRCopyFile workdir'\OUT\'driver'.DRV', globals.!os2dir'\DLL\'driver'\'driver'.DRV'
608 END
609 END
610 IF ok == 0 THEN DO
611 CALL LINEOUT globals.!log1, VRError()
612 RETURN 4 /*** RC=4 Failed to copy driver files ***/
613 END
614
615 CALL LINEOUT globals.!log1, newprinters.0 'printers imported successfully.'
616 DO i = 1 TO newprinters.0
617 CALL LINEOUT globals.!log1, ' ->' newprinters.i
618 END
619 CALL LINEOUT globals.!log1, ''
620 CALL LINEOUT globals.!log1
621
622 /* Clean up our work directories.
623 */
624 CALL VRDeleteFile workdir'\OUT\*'
625 CALL VRDeleteFile workdir'\*'
626 CALL VRRmDir( workdir'\OUT')
627 CALL VRRmDir( workdir )
628
629RETURN 0
630
631/*:VRX Init
632*/
633Init:
634
635 CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
636 CALL SysLoadFuncs
637 CALL RxFuncAdd 'RPULoadFuncs', 'RXPRTUTL', 'RPULoadFuncs'
638 CALL RPULoadFuncs
639 CALL RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
640 CALL PRLoadFuncs
641 CALL RxFuncAdd 'WPToolsLoadFuncs', 'WPTOOLS', 'WPToolsLoadFuncs'
642 CALL WPToolsLoadFuncs
643 CALL RxFuncAdd 'VRXLoadFuncs', 'VROBJEX', 'VRXLoadFuncs'
644 CALL VRXLoadFuncs
645
646 globals.!wizard = 0
647 globals.!debug = 0
648 globals.!initstate = 0
649
650 DO i = 1 TO InitArgs.0
651 PARSE UPPER VAR InitArgs.i _arg
652 SELECT
653 WHEN _arg == '/CREATE' THEN globals.!wizard = 1
654 WHEN LEFT( _arg, 2 ) == '/D' THEN globals.!debug = 1
655 OTHERWISE NOP
656 END
657 END
658
659 CALL LoadSettings
660 CALL SetLanguage
661 CALL CheckPrograms
662
663 window = VRWindow()
664 call VRMethod window, "CenterWindow"
665 call VRMethod window, "Activate"
666 IF globals.!wizard THEN DO
667 CALL VRMethod 'Application', 'PostQueue', 0, 1, 'CALL PB_PRINTER_ADD_Click'
668 END
669 ELSE
670 CALL VRSet window, "Visible", 1
671 drop window
672
673RETURN
674
675/*:VRX LoadSettings
676*/
677LoadSettings: PROCEDURE EXPOSE globals.
678
679 globals.!version = '0.21'
680 globals.!copyright = '2013'
681
682 me = VRGet('Application', 'Program')
683 IF me == '' THEN PARSE SOURCE . . me
684 globals.!mydir = VRParseFilePath( me, 'DP')
685
686 /* Get CUPS paths.
687 */
688 PARSE VALUE VRGetIni('eCups', 'CUPS', 'USER') WITH cupsdrv '00'x .
689 IF cupsdrv == '' THEN
690 cupsdrv = VRParseFilePath( me, 'D') || ':'
691 ELSE
692 cupsdrv = STRIP( cupsdrv, 'T', '\')
693 globals.!cupsdir = cupsdrv'\cups'
694
695 /** TODO Identify if CUPS and/or CUPS.PDR is installed */
696 globals.!hascups = 1
697
698 /* Get system paths.
699 */
700 globals.!bootdrv = SysBootDrive()
701 IF globals.!bootdrv == '' THEN
702 globals.!bootdrv = FILESPEC('DRIVE', VALUE('OS2_SHELL',,'OS2ENVIRONMENT'))
703 globals.!os2dir = globals.!bootdrv'\OS2'
704 globals.!tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
705 IF globals.!tmpdir == '' THEN
706 globals.!tmpdir = VALUE('TEMP',,'OS2ENVIRONMENT')
707 IF globals.!tmpdir == '' THEN
708 globals.!tmpdir = globals.!mydir
709 globals.!logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT')
710 IF globals.!logdir == '' THEN
711 globals.!logdir = globals.!mydir
712
713 globals.!log1 = globals.!logdir'\printmgr.l1'
714 globals.!log2 = globals.!logdir'\printmgr.l2'
715
716 /* Get printer-related paths.
717 */
718 PARSE VALUE VRGetIni('PM_INSTALL', 'PDR_DIR', 'USER') WITH repos_dir '00'x .
719 globals.!repository = repos_dir
720 globals.!prdrv = STREAM( globals.!os2dir'\install\prdrv.lst', 'C', 'QUERY EXISTS')
721 globals.!prdesc = STREAM( globals.!os2dir'\install\prdesc.lst', 'C', 'QUERY EXISTS')
722
723 /* Set the language file name.
724 */
725 globals.!nlsname = 'printm_'
726
727 /* Determine the OS.
728 */
729 IF VRFileExists( globals.!os2dir'\INSTALL\SYSLEVEL.ECS') THEN
730 globals.!is_ecs = 1
731 ELSE
732 globals.!is_ecs = 0
733
734 globals.!create_mode = ''
735
736RETURN
737
738/*:VRX MI_ABOUT_Click
739*/
740MI_ABOUT_Click:
741 CALL VRLoadSecondary 'SW_ABOUT', 'W'
742RETURN
743
744/*:VRX MI_DETAILVIEW_Click
745*/
746MI_DETAILVIEW_Click: PROCEDURE EXPOSE globals.
747
748 _page = VRGet('TDL_MAIN', 'Selected')
749 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
750 _cnr = VRGet( _pagewin, 'UserData')
751 IF _cnr == '' THEN RETURN
752
753 CALL VRSet _cnr, 'Source', 0
754 _set = VRGet('MI_DETAILVIEW', 'Checked')
755 IF _set == 1 THEN RETURN
756
757 CALL VRSet _cnr, 'View', 'Detail'
758 CALL VRSet _cnr, 'MiniIcons', 1
759
760 CALL VRSet 'MI_ICONVIEW', 'Checked', 0
761 CALL VRSet 'MI_DETAILVIEW', 'Checked', 1
762
763RETURN
764
765/*:VRX MI_DRIVERS_INSTALL_Click
766*/
767MI_DRIVERS_INSTALL_Click:
768 CALL DriverAdd
769return
770
771/*:VRX MI_DRIVERS_REMOVE_Click
772*/
773MI_DRIVERS_REMOVE_Click:
774 CALL DriverDelete
775return
776
777/*:VRX MI_ICONVIEW_Click
778*/
779MI_ICONVIEW_Click: PROCEDURE EXPOSE globals.
780
781 _page = VRGet('TDL_MAIN', 'Selected')
782 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
783 _cnr = VRGet( _pagewin, 'UserData')
784 IF _cnr == '' THEN RETURN
785
786 CALL VRSet _cnr, 'Source', 0
787 _set = VRGet('MI_ICONVIEW', 'Checked')
788 IF _set == 1 THEN RETURN
789
790 CALL VRSet _cnr, 'View', 'Icon'
791 CALL VRSet _cnr, 'MiniIcons', 0
792
793 CALL VRSet 'MI_ICONVIEW', 'Checked', 1
794 CALL VRSet 'MI_DETAILVIEW', 'Checked', 0
795
796RETURN
797
798/*:VRX MI_IMPORT_Click
799*/
800MI_IMPORT_Click: PROCEDURE EXPOSE globals. new_ppd
801
802 /* Prompt the user for the PPD file to import.
803 */
804 new_ppd = VRFileDialog( VRWindow(), NLSGetMessage( 230 ), 'O', '*.PPD')
805 IF new_ppd == '' THEN RETURN 0
806
807 /* Let the user select the Postscript driver to update.
808 */
809 CALL VRLoadSecondary 'SW_IMPORT', 'W'
810
811RETURN ok
812
813/*:VRX MI_MANAGE_Click
814*/
815MI_MANAGE_Click: PROCEDURE EXPOSE globals.
816 CALL VRLoadSecondary 'SW_PRINTERPAKS', 'W'
817RETURN
818
819/*:VRX MI_PORT_CREATE_Click
820*/
821MI_PORT_CREATE_Click:
822 CALL PortAdd
823return
824
825/*:VRX MI_PORT_DELETE_Click
826*/
827MI_PORT_DELETE_Click:
828 CALL PortDelete
829return
830
831/*:VRX MI_PORT_PROPS_Click
832*/
833MI_PORT_PROPS_Click:
834 CALL PortProperties
835RETURN
836
837/*:VRX MI_PPAK_COPY_Click
838*/
839MI_PPAK_COPY_Click:
840 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
841 IF ok == 0 | recs.0 < 1 THEN RETURN
842 record = recs.1
843
844 _path = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!path )
845 CALL VRMethod 'Application', 'PutClipboard', _path
846
847 CALL VRMethod 'CN_PRINTERPAKS', 'SetRecordAttr', record, 'Source', 0
848RETURN
849
850/*:VRX MI_PPAK_MODELS_Click
851*/
852MI_PPAK_MODELS_Click: PROCEDURE EXPOSE globals.
853
854 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
855 IF ok == 0 | recs.0 < 1 THEN RETURN
856 CALL VRMethod 'CN_PRINTERPAKS', 'SetRecordAttr', recs.1, 'Source', 0
857
858 CALL VRLoadSecondary 'SW_MODELS', 'W'
859
860RETURN
861
862/*:VRX MI_PRINTER_CREATE_Click
863*/
864MI_PRINTER_CREATE_Click:
865 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
866 IF ok == 1 & recs.0 > 0 THEN
867 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', recs.1, 'Source', 0
868 CALL PrinterWizard
869RETURN
870
871/*:VRX MI_PRINTER_DEFAULT_Click
872*/
873MI_PRINTER_DEFAULT_Click:
874 CALL PrinterSetDefault
875RETURN
876
877/*:VRX MI_PRINTER_DELETE_Click
878*/
879MI_PRINTER_DELETE_Click:
880 CALL PrinterDelete
881RETURN
882
883/*:VRX MI_PRINTER_HOLD_Click
884*/
885MI_PRINTER_HOLD_Click:
886 CALL PrinterHold
887return
888
889/*:VRX MI_PRINTER_OPEN_Click
890*/
891MI_PRINTER_OPEN_Click:
892 CALL PrinterOpen
893RETURN
894
895/*:VRX MI_PRINTER_PROPS_Click
896*/
897MI_PRINTER_PROPS_Click:
898 CALL PrinterProperties
899RETURN
900
901/*:VRX MI_QUIT_Click
902*/
903MI_QUIT_Click:
904 CALL Quit
905return
906
907/*:VRX MI_REFRESH_Click
908*/
909MI_REFRESH_Click: PROCEDURE EXPOSE globals.
910
911 _page = VRGet('TDL_MAIN', 'Selected')
912 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
913 _cnr = VRGet( _pagewin, 'UserData')
914 IF _cnr == '' THEN RETURN
915
916 CALL VRSet _cnr, 'Source', 0
917
918 SELECT
919 WHEN _cnr == 'CN_PRINTERS' THEN CALL RefreshPrinters
920 WHEN _cnr == 'CN_PORTS' THEN CALL RefreshPorts
921 WHEN _cnr == 'CN_DEVICES' THEN CALL RefreshDevices
922 OTHERWISE NOP
923 END
924
925RETURN
926
927/*:VRX New_CUPS
928*/
929New_CUPS: PROCEDURE EXPOSE globals.
930 PARSE ARG ppd_file
931
932 IF WPToolsQueryObject('<ECUPS_WIZARD>',,,'SetupString') == 1 THEN DO
933 PARSE VAR SetupString . 'EXENAME='cupswiz';' .
934 PARSE VAR SetupString . 'STARTUPDIR='_workdir';' .
935 PARSE VAR SetupString . 'PARAMETERS='_parms';' .
936 IF _workdir == '' THEN _workdir = VRParseFilePath( cupswiz, 'DP')
937 END
938 ELSE DO
939 cupswiz = Stream( globals.!cupsdir'\cups\cupswiz.exe', 'C', 'QUERY EXISTS')
940 _workdir = VRParseFilePath( cupswiz, 'DP')
941 _parms = ''
942 END
943 IF cupswiz <> '' THEN DO
944 od = DIRECTORY()
945 CALL DIRECTORY _workdir
946 IF ppd_file <> '' & VRFileExists( ppd_file ) THEN
947 _parms = _parms ppd_file
948 ADDRESS CMD 'start' cupswiz _parms
949 CALL DIRECTORY od
950 END
951
952RETURN
953
954/*:VRX New_LAN
955*/
956New_LAN: PROCEDURE EXPOSE globals.
957
958 ok = OpenPrinterTemplate('WPRPrinter')
959
960RETURN ok
961
962/*:VRX New_Standard
963*/
964New_Standard: PROCEDURE EXPOSE globals.
965
966 ok = OpenPrinterTemplate('WPPrinter')
967
968RETURN ok
969
970/*:VRX OpenPrinterTemplate
971*/
972OpenPrinterTemplate: PROCEDURE EXPOSE globals.
973 PARSE ARG _class
974
975 ok = 0
976 IF WPToolsFolderContent('<WP_TEMPS>', '_temps.', 'F') THEN
977 DO i = 1 TO _temps.0
978 IF WPToolsQueryObject( _temps.i, 'szClass') THEN DO
979 IF szClass == _class THEN DO
980 ok = WPToolsSetObjectData( _temps.i, 'OPEN=DEFAULT;')
981 LEAVE
982 END
983 END
984 END
985
986 IF ok == 0 THEN DO
987 IF SysCreateObject( _class, _class, globals.!tmpdir,,
988 'OBJECTID=<TEMP_PRT>;TAKEDEFAULTS=NO;TEMPLATE=YES', 'R') THEN
989 DO
990 ok = SysSetObjectData '<TEMP_PRT>','OPEN=DEFAULT;'
991 CALL SysDestroyObject '<TEMP_PRT>'
992 END
993 END
994
995RETURN ok
996
997/*:VRX PB_ABOUT_OK_Click
998*/
999PB_ABOUT_OK_Click:
1000 CALL SW_ABOUT_Close
1001RETURN
1002
1003/*:VRX PB_ADDPORT_CANCEL_Click
1004*/
1005PB_ADDPORT_CANCEL_Click:
1006 CALL SW_PORT_ADD_Close
1007RETURN
1008
1009/*:VRX PB_ADDPORT_OK_Click
1010*/
1011PB_ADDPORT_OK_Click: PROCEDURE EXPOSE globals. updated
1012
1013 ok = VRMethod('CN_ADDPORT', 'GetRecordList', 'Selected', 'recs.')
1014 IF ok == 0 | recs.0 < 1 THEN RETURN
1015 record = recs.1
1016
1017 _name = VRMethod('CN_ADDPORT', 'GetFieldData', record, 'NAME')
1018 btns.0 = 2
1019 btns.1 = NLSGetMessage( 14 )
1020 btns.2 = NLSGetMessage( 15 )
1021 ok = VRMessage('SW_PORT_ADD', NLSGetMessage( 205, _name ), NLSGetMessage( 200 ), 'Q', 'btns.', 1, 2 )
1022 IF ok == 1 THEN DO
1023 _portname = GetNextPortName( _name )
1024 ok = RPUPortInstall( _name, _portname )
1025 IF ok <> 1 THEN
1026 CALL VRMessage 'SW_PORT_ADD', NLSGetMessage( 167 ) RPUERROR, NLSGetMessage( 13 ), 'E'
1027 ELSE DO
1028 CALL RPUPortDialog _name, _portname
1029 CALL SW_PORT_ADD_Close
1030 updated = 1
1031 END
1032 END
1033
1034RETURN ok
1035
1036/*:VRX PB_DEVICE_ADD_Click
1037*/
1038PB_DEVICE_ADD_Click:
1039 CALL DriverAdd
1040RETURN
1041
1042/*:VRX PB_DEVICE_REMOVE_Click
1043*/
1044PB_DEVICE_REMOVE_Click:
1045 CALL DriverDelete
1046RETURN
1047
1048/*:VRX PB_IMPORTCANCEL_Click
1049*/
1050PB_IMPORTCANCEL_Click:
1051 CALL SW_IMPORT_Close
1052return
1053
1054/*:VRX PB_IMPORTOK_Click
1055*/
1056PB_IMPORTOK_Click: PROCEDURE EXPOSE globals. new_ppd
1057
1058 IF VRGet('RB_IMPORTCUPS', 'Set') == 1 THEN DO
1059 CALL New_CUPS new_ppd
1060 CALL SW_IMPORT_Close
1061 RETURN
1062 END
1063 driver = VRGet('DDCB_IMPORTDRV', 'Value')
1064 ok = ImportPPD( driver, new_ppd )
1065
1066 SELECT
1067 /* Check the return code from ImportPPD and display an appropriate message.
1068 */
1069
1070 WHEN ok == 0 THEN DO /* Success! */
1071 _message = NLSGetMessage( 238 )
1072 _mbtitle = NLSGetMessage( 16 )
1073 _mbicon = 'I'
1074 END
1075
1076 /* Note: Error codes 1 & 2 are ignored here.
1077 * 1 means the user cancelled, so no message is required.
1078 * For 2, ImportPPD itself already displayed the error message.
1079 */
1080
1081 WHEN ok == 3 THEN DO /* Invalid path specified */
1082 _message = NLSGetMessage( 222 )
1083 _mbtitle = NLSGetMessage( 13 )
1084 _mbicon = 'E'
1085 END
1086 WHEN ok == 4 THEN DO /* Failed to copy driver files */
1087 _message = NLSGetMessage( 220 )
1088 _mbtitle = NLSGetMessage( 13 )
1089 _mbicon = 'E'
1090 END
1091 WHEN ok == 5 THEN DO /* Failed to create directory */
1092 _message = NLSGetMessage( 221 )
1093 _mbtitle = NLSGetMessage( 13 )
1094 _mbicon = 'E'
1095 END
1096 WHEN ok == 6 THEN DO /* PPD import failed */
1097 _message = NLSGetMessage( 223 )
1098 _mbtitle = NLSGetMessage( 13 )
1099 _mbicon = 'E'
1100 END
1101 WHEN ok == 7 THEN DO /* Error updating PRDESC.LST */
1102 _message = NLSGetMessage( 224, globals.!prdesc )
1103 _mbtitle = NLSGetMessage( 13 )
1104 _mbicon = 'E'
1105 END
1106
1107 OTHERWISE DO
1108 _message = ''
1109 _mbtitle = ''
1110 _mbicon = 'N'
1111 END
1112 END
1113
1114 IF message <> '' THEN
1115 CALL VRMessage VRWindow(), _message, _mbtitle, _mbicon
1116
1117 CALL SW_IMPORT_Close
1118RETURN
1119
1120/*:VRX PB_MODELS_CLOSE_Click
1121*/
1122PB_MODELS_CLOSE_Click:
1123 CALL SW_MODELS_Close
1124return
1125
1126/*:VRX PB_OTHERPORT_Click
1127*/
1128PB_OTHERPORT_Click: PROCEDURE EXPOSE globals.
1129 _new_pdr = VRFileDialog('SW_PORT_ADD', NLSGetMessage( 165 ), 'O', '*.PDR')
1130 IF _new_pdr == '' THEN RETURN 0
1131
1132 ok = InstallPortDriver( _new_pdr )
1133 IF ok == 0 THEN DO
1134 _name = VRParseFileName( _new_pdr, 'N')
1135 _rec = VRMethod('CN_ADDPORT', 'AddRecord',,, _name, _new_pdr )
1136 CALL VRMethod 'CN_ADDPORT', 'SetFieldData', _rec, 'NAME', _name, 'PATH', _new_pdr
1137 END
1138 ELSE
1139 CALL VRMessage 'SW_PORT_ADD', NLSGetMessage( 166 ) || '0a0a'x || VRError(), NLSGetMessage( 13 ), 'E'
1140RETURN ok
1141
1142/*:VRX PB_PORT_ADD_Click
1143*/
1144PB_PORT_ADD_Click:
1145 CALL PortAdd
1146RETURN
1147
1148/*:VRX PB_PORT_DELETE_Click
1149*/
1150PB_PORT_DELETE_Click:
1151 CALL PortDelete
1152return
1153
1154/*:VRX PB_PPCLOSE_Click
1155*/
1156PB_PPCLOSE_Click:
1157 CALL SW_PRINTERPAKS_Close
1158return
1159
1160/*:VRX PB_PPUPDATE_Click
1161*/
1162PB_PPUPDATE_Click: PROCEDURE EXPOSE globals.
1163
1164 /* Let the user select the driver .DRV to install.
1165 */
1166 new_drv = VRFileDialog( VRWindow(), NLSGetMessage( 182 ), 'O', '*.DRV')
1167 IF new_drv == '' THEN RETURN 0
1168
1169 drv_stem = TRANSLATE( VRParseFileName( new_drv, 'N'))
1170 drv_name = TRANSLATE( VRParseFileName( new_drv, 'NE'))
1171 drv_source = TRANSLATE( VRParseFileName( new_drv, 'DP'))
1172
1173 /* See if this is the same as an existing driver (compared by filename).
1174 */
1175 existing = 0
1176 skip_repo = 0
1177 ok = VRMethod('CN_PRINTERPAKS', 'GetRecordList', 'All', 'recs.')
1178 DO i = 1 TO recs.0
1179 _ppname = VRMethod('CN_PRINTERPAKS', 'GetFieldData', recs.i, globals.!hcfPaks.!name )
1180 IF TRANSLATE( _ppname ) == TRANSLATE( new_name ) THEN DO
1181 existing = 1
1182 _pppath = VRMethod('CN_PRINTERPAKS', 'GetFieldData', recs.i, globals.!hcfPaks.!path )
1183 LEAVE
1184 END
1185 END
1186
1187 PARSE UPPER VALUE VRGetIni('PrinterManager', 'ThirdParty', 'USER') WITH known_3p '00'x .
1188 IF known_3p == '' THEN
1189 known_3p = 'ECUPS ECUPS-HP GUTENPRT PSPRINT'
1190
1191 IF existing THEN DO
1192 drv_target = TRANSLATE( _pppath )
1193 IF drv_source == drv_target ) THEN DO
1194 CALL VRMessage VRWindow(), NLSGetMessage( 183 ), NLSGetMessage( 13 ), 'E'
1195 RETURN 1
1196 END
1197 IF CheckWritablePath( drv_target ) <> 0 THEN DO
1198 existing = 0
1199 _msg.1 = NLSGetMessage( 185, drv_target )
1200 _msg.2 = ''
1201 _msg.3 = NLSGetMessage( 186, drv_name )
1202 _msg.0 = 3
1203 _btns.1 = NLSGetMessage( 2 )
1204 _btns.2 = NLSGetMessage( 3 )
1205 _btns.0 = 2
1206 _select = VRMessageStem( VRWindow(), '_msg.', NLSGetMessage( 184 ),
1207 'I', '_btns.', 1, 2 )
1208 IF _select == 2 THEN skip_repo = 1
1209 END
1210 END
1211
1212 IF \skip_repo THEN DO
1213 IF \existing THEN DO
1214 /* If we already know about this driver, try and get its saved location. */
1215 drv_target = ''
1216 IF WORDPOS( drv_stem, known_3p ) > 0 THEN
1217 PARSE UPPER VALUE VRGetIni('PM_INSTALL', drv_stem'_DIR', 'USER') WITH drv_target '00'x .
1218 ELSE DO
1219 known_3p = known_3p drv_stem
1220 CALL VRSetIni 'PrinterManager', 'ThirdParty', known_3p || '00'x, 'USER'
1221 END
1222 IF drv_target == '' THEN DO
1223 drv_target = globals.!repository'\'drv_target
1224 _btns.1 = NLSGetMessage( 2 )
1225 _btns.2 = NLSGetMessage( 3 )
1226 _btns.3 = NLSGetMessage( 188 )
1227 _btns.0 = 3
1228 DO UNTIL _select <> 3
1229 _select = VRPrompt( VRWindow(), NLSGetMessage( 187, drv_name ),,
1230 'drv_target', NLSGetMessage( 189 ), '_btns.', 1, 2 )
1231 IF _select == 3 THEN
1232 drv_target = VRXDirectoryDialog( VRWindow(), drv_target, NLSGetMessage( 189 ))
1233 END
1234 IF _select == 2 THEN
1235 skip_repo = 1
1236 ELSE
1237 CALL VRSetIni 'PM_INSTALL', drv_stem'_DIR', TRANSLATE( drv_target ) || '00'x, 'USER'
1238 END
1239 END
1240
1241 IF \skip_repo THEN DO
1242 IF VRFileExists( drv_target ) THEN DO
1243 /* Clear any RHS attributes on existing files */
1244 CALL SysFileTree drv_target'\*', '_ignore.',,, '**---'
1245 CALL PRReplaceModule drv_target'\'drv_name, '', ''
1246 END
1247 ELSE
1248 /* Create the target directory if necessary */
1249 ok = VRMkDir( drv_target )
1250
1251 ok = CopyPrinterPak( new_drv, drv_target )
1252 IF existing & ok == 1 THEN DO
1253 CALL UpdatePrDesc new_drv, drv_target'\'new_drv
1254 END
1255 IF ok == 0 THEN DO
1256 CALL VRMessage VRWindow(), NLSGetMessage( 220 ), NLSGetMessage( 13 ), 'E'
1257 RETURN 2
1258 END
1259 ELSE
1260 CALL VRMessage VRWindow(), NLSGetMessage( 193 ), NLSGetMessage( 16 ), 'I'
1261 END
1262 END
1263
1264 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', drv_stem, 'USER') WITH drv_used '00'x .
1265 IF ( drv_used <> '') & VRFileExists( drv_used ) THEN DO
1266 /* Driver is currently installed; ask if the user wants to update the
1267 * in-use copy as well.
1268 */
1269 _btns.1 = NLSGetMessage( 14 )
1270 _btns.2 = NLSGetMessage( 15 )
1271 _btns.0 = 2
1272 _select = VRMessage( VRWindow(), NLSGetMessage( 190 ), NLSGetMessage( 191 ), 'Q', '_btns.', 1, 2 )
1273 IF _select == 1 THEN DO
1274 CALL PRSetFileAttr drv_used , 'rsh'
1275 CALL PRReplaceModule drv_used, '', ''
1276 used_target = VRParseFileName( drv_used, 'DP')
1277 ok = CopyPrinterPak( new_drv, used_target )
1278 IF ok == 0 THEN DO
1279 CALL VRMessage VRWindow(), NLSGetMessage( 220 ), NLSGetMessage( 13 ), 'E'
1280 RETURN 2
1281 END
1282 ELSE
1283 CALL VRMessage VRWindow(), NLSGetMessage( 192 ), NLSGetMessage( 16 ), 'I'
1284 END
1285 END
1286
1287RETURN 0
1288
1289/*:VRX PB_PRINTER_ADD_Click
1290*/
1291PB_PRINTER_ADD_Click:
1292 CALL PrinterWizard
1293RETURN
1294
1295/*:VRX PB_PRINTER_DEL_Click
1296*/
1297PB_PRINTER_DEL_Click:
1298 CALL PrinterDelete
1299return
1300
1301/*:VRX PB_PRINTER_OPEN_Click
1302*/
1303PB_PRINTER_OPEN_Click:
1304 CALL PrinterOpen
1305RETURN
1306
1307/*:VRX PB_WIZARD_CANCEL_Click
1308*/
1309PB_WIZARD_CANCEL_Click:
1310
1311 CALL SW_WIZARD_Close
1312
1313return
1314
1315/*:VRX PB_WIZARD_NEXT_Click
1316*/
1317PB_WIZARD_NEXT_Click: PROCEDURE EXPOSE globals.
1318 SELECT
1319 WHEN VRGet('RB_CREATE_CUPS', 'Set') == 1 THEN DO
1320 globals.!create_mode = 'C'
1321 CALL New_CUPS
1322 END
1323 WHEN ( VRGet('RB_CREATE_LEGACY', 'Set') == 1 ) & ( VRGet('RB_CREATE_STANDARD', 'Set') == 1 ) THEN DO
1324 globals.!create_mode = 'S'
1325 CALL New_Standard
1326 END
1327 WHEN ( VRGet('RB_CREATE_LEGACY', 'Set') == 1 ) & ( VRGet('RB_CREATE_LAN', 'Set') == 1 ) THEN DO
1328 globals.!create_mode = 'L'
1329 CALL New_LAN
1330 END
1331 OTHERWISE DO
1332 globals.!create_mode = ''
1333 globals.!wizard = 0
1334 END
1335 END
1336 CALL SW_WIZARD_Fini
1337
1338RETURN
1339
1340/*:VRX PortAdd
1341*/
1342PortAdd: PROCEDURE EXPOSE globals.
1343
1344 updated = 0
1345 CALL VRLoadSecondary 'SW_PORT_ADD', 'W'
1346 IF updated == 1 THEN
1347 CALL RefreshPorts
1348
1349RETURN
1350
1351/*:VRX PortDelete
1352*/
1353PortDelete: PARSE ARG record
1354 IF record == '' THEN DO
1355 ok = VRMethod( "CN_PORTS", "GetRecordList", "Selected", "recs." )
1356 IF ok == 0 | recs.0 < 1 THEN RETURN
1357 record = recs.1
1358 END
1359
1360 _name = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!name )
1361 IF _name == '' THEN RETURN
1362 _btns.0 = 2
1363 _btns.1 = NLSGetMessage( 14 )
1364 _btns.2 = NLSGetMessage( 15 )
1365 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 202, _name ), NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
1366 IF _confirm == 1 THEN DO
1367 success = RPUPortDelete( _name )
1368 IF success == 1 THEN CALL RefreshPorts
1369 END
1370
1371 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1372
1373RETURN
1374
1375/*:VRX PortProperties
1376*/
1377PortProperties: PROCEDURE EXPOSE globals.
1378 PARSE ARG record
1379 IF record == '' THEN DO
1380 ok = VRMethod( "CN_PORTS", "GetRecordList", "Selected", "recs." )
1381 IF ok == 0 | recs.0 < 1 THEN RETURN
1382 record = recs.1
1383 END
1384
1385 _name = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!name )
1386 _module = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!driver )
1387 IF _module == '' THEN DO
1388 CALL VRMessage VRWindow(), NLSGetMessage( 211, _name ), NLSGetMessage( 210 ), 'N'
1389 RETURN
1390 END
1391
1392 CALL RPUPortDialog _module, _name
1393
1394 CALL VRMethod 'CN_PORTS', 'SetRecordAttr', record, 'Source', 0
1395RETURN
1396
1397/*:VRX PrinterDelete
1398*/
1399PrinterDelete: PROCEDURE EXPOSE globals.
1400 PARSE ARG record
1401 IF record == '' THEN DO
1402 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1403 IF ok == 0 | recs.0 < 1 THEN RETURN 0
1404 record = recs.1
1405 END
1406
1407 success = 0
1408 _title = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!title )
1409 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1410 _btns.0 = 2
1411 _btns.1 = NLSGetMessage( 14 )
1412 _btns.2 = NLSGetMessage( 15 )
1413 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 201, _title ), NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
1414 IF _confirm == 1 THEN DO
1415 success = RPUPrinterDelete( _queue )
1416 END
1417
1418 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1419RETURN success
1420
1421/*:VRX PrinterHold
1422*/
1423PrinterHold: PROCEDURE EXPOSE globals.
1424 PARSE ARG record
1425 IF record == '' THEN DO
1426 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1427 IF ok == 0 | recs.0 < 1 THEN RETURN
1428 record = recs.1
1429 END
1430 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1431 _flags = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!flags )
1432 _p = POS('P', _flags )
1433 IF _p > 0 THEN DO
1434 ok = RPUQueueHold( _queue, 'N')
1435 IF ok == 1 THEN DO
1436 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 0
1437 _flags = DELSTR( _flags, _p, 1 )
1438 CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1439 END
1440 END
1441 ELSE DO
1442 ok = RPUQueueHold( _queue, 'Y')
1443 IF ok == 1 THEN DO
1444 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 1
1445 _flags = _flags'P'
1446 CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1447 END
1448 END
1449
1450 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1451RETURN
1452
1453/*:VRX PrinterOpen
1454*/
1455PrinterOpen: PROCEDURE EXPOSE globals.
1456 PARSE ARG record
1457 IF record == '' THEN DO
1458 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1459 IF ok == 0 | recs.0 < 1 THEN RETURN
1460 record = recs.1
1461 END
1462
1463 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1464 IF _queue <> '' THEN
1465 CALL RPUOpenView _queue, 'O'
1466
1467 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1468RETURN
1469
1470/*:VRX PrinterProperties
1471*/
1472PrinterProperties: PROCEDURE EXPOSE globals.
1473 PARSE ARG record
1474 IF record == '' THEN DO
1475 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1476 IF ok == 0 | recs.0 < 1 THEN RETURN
1477 record = recs.1
1478 END
1479
1480 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1481 IF _queue <> '' THEN
1482 CALL RPUOpenView _queue, 'S'
1483
1484 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1485RETURN
1486
1487/*:VRX PrinterSetDefault
1488*/
1489PrinterSetDefault: PROCEDURE EXPOSE globals.
1490 PARSE ARG record
1491 IF record == '' THEN DO
1492 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1493 IF ok == 0 | recs.0 < 1 THEN RETURN 0
1494 record = recs.1
1495 END
1496 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1497 ok = RPUQueueDefault( _queue )
1498/*
1499 IF ok == 1 THEN DO
1500 CALL VRSet 'MI_PRINTER_DEFAULT', 'Checked', 1
1501 _flags = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!flags )
1502 IF POS( _flags, 'D') == 0 THEN DO
1503 _flags = 'D'_flags
1504 CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1505 END
1506 END
1507*/
1508 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1509RETURN ok
1510
1511/*:VRX PrinterWizard
1512*/
1513PrinterWizard: PROCEDURE EXPOSE globals.
1514 CALL VRLoadSecondary 'SW_WIZARD', 'N'
1515RETURN
1516
1517/*:VRX Quit
1518*/
1519Quit:
1520 window = VRWindow()
1521 call VRSet window, "Shutdown", 1
1522 drop window
1523return
1524
1525/*:VRX RB_ADVANCED_Click
1526*/
1527RB_ADVANCED_Click: PROCEDURE
1528 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 0
1529 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 0
1530RETURN
1531
1532/*:VRX RB_CREATE_CUPS_Click
1533*/
1534RB_CREATE_CUPS_Click: PROCEDURE
1535 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 0
1536 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 0
1537RETURN
1538
1539/*:VRX RB_CREATE_LEGACY_Click
1540*/
1541RB_CREATE_LEGACY_Click: PROCEDURE
1542 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 1
1543 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 1
1544RETURN
1545
1546/*:VRX RefreshDevices
1547*/
1548RefreshDevices: PROCEDURE EXPOSE globals.
1549
1550 ok = RPUEnumDrivers('drivers.')
1551 IF rc <> 0 THEN DO
1552 CALL VRSet 'CN_DEVICES', 'Painting', 0
1553 CALL VRMethod 'CN_DEVICES', 'RemoveRecord', 'All'
1554 DO i = 1 TO drivers.0
1555 PARSE VAR drivers.i _pdrv'.'_model
1556 IF _pdrv == 'IBMNULL' & _model == '' THEN
1557 _model = NLSGetMessage( 106 )
1558 ELSE IF _model == '' THEN
1559 _model = '-'
1560 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _pdrv, 'USER') WITH _drvspec '00'x .
1561 driverinfo.i = ';'drivers.i';'_drvspec';;;'globals.!hcfDevices.!icon';'_drvspec';'globals.!hcfDevices.!model';'_model';'globals.!hcfDevices.!driver';'_pdrv
1562 END
1563 driverinfo.0 = drivers.0
1564 ok = VRMethod( "CN_DEVICES", "AddRecordList",,, "driverinfo.")
1565 DROP drivers.
1566 DROP driverinfo.
1567 CALL VRSet 'CN_DEVICES', 'Painting', 1
1568 END
1569
1570RETURN
1571
1572/*:VRX RefreshPorts
1573*/
1574RefreshPorts: PROCEDURE EXPOSE globals.
1575
1576 ok = RPUEnumPorts('ports.')
1577 IF rc <> 0 THEN DO
1578 CALL VRSet 'CN_PORTS', 'Painting', 0
1579 CALL VRMethod 'CN_PORTS', 'RemoveRecord', 'All'
1580 DO i = 1 TO ports.0
1581 PARSE VAR ports.i _name _driver _path
1582 SELECT
1583 WHEN _name == 'FILE' THEN _icon = '$24,PMWP'
1584 WHEN _driver == 'USBPRT' THEN _icon = '$7001,'_path
1585 WHEN _driver == 'SERIAL' THEN _icon = '$7001,'_path
1586 WHEN _driver == 'PARALLEL' THEN _icon = '$7001,'_path
1587 WHEN _driver == 'SLPR' THEN _icon = '$7001,'_path
1588 WHEN _driver == 'LPRPDRVR' THEN _icon = '$256,'_path
1589/*
1590 WHEN _driver == 'USBPRT' THEN _icon = '$7'
1591 WHEN _driver == 'SMB' THEN _icon = '$6'
1592 WHEN _driver == 'SLPR' THEN _icon = '$6'
1593 WHEN _driver == 'LPR32' THEN _icon = '$6'
1594 WHEN _driver == 'LPRPDRVR' THEN _icon = '$6'
1595 WHEN _driver == 'CUPS' THEN _icon = '$10'
1596 OTHERWISE _icon = '$5'
1597*/
1598 OTHERWISE _icon = _path
1599 END
1600
1601 portinfo.i = ';'_name';'_icon';;;'globals.!hcfPorts.!icon';'_icon';'globals.!hcfPorts.!name';'_name';'globals.!hcfPorts.!driver';'_driver';'
1602 END
1603 portinfo.0 = ports.0
1604 ok = VRMethod( "CN_PORTS", "AddRecordList",,, "portinfo.")
1605 DROP ports.
1606 DROP portinfo.
1607 CALL VRSet 'CN_PORTS', 'Painting', 1
1608 END
1609
1610RETURN
1611
1612/*:VRX RefreshPrinters
1613*/
1614RefreshPrinters: PROCEDURE EXPOSE globals.
1615 ok = RPUEnumPrinters('printers.')
1616 IF ok <> 0 THEN DO
1617 CALL VRSet 'CN_PRINTERS', 'Painting', 0
1618 CALL VRMethod 'CN_PRINTERS', 'RemoveRecord', 'All'
1619
1620 DO i = 1 TO printers.0
1621 _title = TRANSLATE( printers.i.!description, ' ', '0d0a'x)
1622 ok = RPUPrinterQuery( printers.i.!name, 'details.')
1623 IF ok == 0 THEN DO
1624 _driver = '?'
1625 _port = '?'
1626 END
1627 ELSE DO
1628 PARSE VAR details.!drivers _driver ',' .
1629 _port = details.!port
1630 END
1631 IF printers.i.!host <> '' THEN
1632 _icon = '$65,PMWP'
1633 ELSE IF _driver <> '?' THEN DO
1634 PARSE VAR _driver _pdrv'.'_model
1635 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _pdrv, 'USER') WITH _icon '00'x .
1636 END
1637 ELSE _icon = '$2'
1638
1639 printerinfo.i = ';'printers.i.!description';'_icon';;;' ||,
1640 globals.!hcfPrinters.!title';'_title';' ||,
1641 globals.!hcfPrinters.!icon';'_icon';' ||,
1642 globals.!hcfPrinters.!name';'printers.i.!name';' ||,
1643 globals.!hcfPrinters.!queue';'printers.i.!queue';' ||,
1644 globals.!hcfPrinters.!host';'printers.i.!host';' ||,
1645 globals.!hcfPrinters.!port';'_port';' ||,
1646 globals.!hcfPrinters.!driver';'_driver';' ||,
1647 globals.!hcfPrinters.!flags';'printers.i.!flags';' ||,
1648 globals.!hcfPrinters.!handle';'printers.i.!handle';'
1649 END
1650 printerinfo.0 = printers.0
1651 ok = VRMethod( "CN_PRINTERS", "AddRecordList",,, "printerinfo.")
1652 DROP printers.
1653 DROP printerinfo.
1654 DROP details.
1655
1656 CALL VRSet 'CN_PRINTERS', 'Painting', 1
1657 END
1658
1659RETURN
1660
1661/*:VRX SetLanguage
1662*/
1663SetLanguage: PROCEDURE EXPOSE globals.
1664 PARSE ARG locale
1665
1666 /*
1667 * This function locates the proper language files, and uses the message
1668 * file to sets all UI text. If the language could not be determined, we
1669 * default to English.
1670 */
1671 execPath = VRGet('Application', 'Program')
1672 execDir = VRParseFileName( execPath, 'DP')
1673
1674 /*
1675 * First, figure out what language/message file to use.
1676 */
1677 IF locale <> '' THEN
1678 syslanguage = locale
1679 ELSE
1680 syslanguage = VALUE('LANG',,'OS2ENVIRONMENT')
1681
1682 SELECT
1683 WHEN TRANSLATE( syslanguage ) == 'ZH_TW' THEN nlv = 'tw'
1684 WHEN TRANSLATE( syslanguage ) == 'ZH_CN' THEN nlv = 'cx'
1685 OTHERWISE PARSE VAR syslanguage nlv '_' .
1686 END
1687 nlvfile = globals.!nlsname || nlv
1688 IF ( STREAM( execDir'\'nlvfile'.msg', 'C', 'QUERY EXISTS') \= '') | ( SysSearchPath('DPATH', nlvfile'.msg') \= '') THEN DO
1689 globals.!messages = nlvfile'.msg'
1690 helpfile = nlvfile'.hlp'
1691 CALL VRSet 'WN_MAIN', 'HelpFile', helpfile
1692 END
1693 ELSE DO
1694 globals.!messages = globals.!nlsname || 'en.msg'
1695 helpfile = globals.!nlsname || 'en.hlp'
1696 CALL VRSet 'WN_MAIN', 'HelpFile', helpfile
1697 END
1698
1699 /*
1700 * If the message file is missing or unreadable, display an error and then exit.
1701 */
1702 IF NLSGetMessage( 1 ) == '' THEN DO
1703 CALL VRMessage VRWindow(), 'Language file' TRANSLATE( globals.!messages ) 'could not be loaded.', 'Cannot Continue', 'E'
1704 RETURN 0
1705 END
1706
1707 /*
1708 * Now set the captions for the UI controls on the main window, according
1709 * to the specified language.
1710 */
1711 CALL NLSSetText 'WN_MAIN', 'Caption', 1
1712 CALL VRMethod 'TDL_MAIN', 'SetTabText', 1, NLSGetMessage( 100 )
1713 CALL VRMethod 'TDL_MAIN', 'SetTabText', 2, NLSGetMessage( 101 )
1714 CALL VRMethod 'TDL_MAIN', 'SetTabText', 3, NLSGetMessage( 102 )
1715
1716 CALL NLSSetText 'MN_PROGRAM', 'Caption', 20
1717 CALL NLSSetText 'MI_MANAGE', 'Caption', 21
1718 CALL NLSSetText 'MI_IMPORT', 'Caption', 22
1719 CALL NLSSetText 'MI_QUIT', 'Caption', 29
1720
1721 CALL NLSSetText 'MN_PRINTER', 'Caption', 30
1722 CALL NLSSetText 'MI_PRINTER_OPEN', 'Caption', 31
1723 CALL NLSSetText 'MI_PRINTER_PROPS', 'Caption', 32
1724 CALL NLSSetText 'MI_PRINTER_HOLD', 'Caption', 33
1725 CALL NLSSetText 'MI_PRINTER_DEFAULT', 'Caption', 34
1726 CALL NLSSetText 'MI_PRINTER_CREATE', 'Caption', 35
1727 CALL NLSSetText 'MI_PRINTER_DELETE', 'Caption', 36
1728
1729 CALL NLSSetText 'MN_PORT', 'Caption', 40
1730 CALL NLSSetText 'MI_PORT_CREATE', 'Caption', 41
1731 CALL NLSSetText 'MI_PORT_DELETE', 'Caption', 42
1732 CALL NLSSetText 'MI_PORT_PROPS', 'Caption', 43
1733
1734 CALL NLSSetText 'MN_DRIVERS', 'Caption', 50
1735 CALL NLSSetText 'MI_DRIVERS_INSTALL', 'Caption', 51
1736 CALL NLSSetText 'MI_DRIVERS_REMOVE', 'Caption', 52
1737
1738 CALL NLSSetText 'MN_VIEW', 'Caption', 60
1739 CALL NLSSetText 'MI_DETAILVIEW', 'Caption', 61
1740 CALL NLSSetText 'MI_ICONVIEW', 'Caption', 62
1741 CALL NLSSetText 'MI_REFRESH', 'Caption', 63
1742
1743 CALL NLSSetText 'MN_PRINTERPAK', 'Caption', 70
1744 CALL NLSSetText 'MI_PPAK_MODELS', 'Caption', 71
1745 CALL NLSSetText 'MI_PPAK_COPY', 'Caption', 72
1746
1747 CALL NLSSetText 'MN_HELP', 'Caption', 80
1748 CALL NLSSetText 'MI_HELP_GENERAL', 'Caption', 81
1749 CALL NLSSetText 'MI_ABOUT', 'Caption', 89
1750
1751RETURN 1
1752
1753/*:VRX SW_ABOUT_Close
1754*/
1755SW_ABOUT_Close:
1756 call SW_ABOUT_Fini
1757return
1758
1759/*:VRX SW_ABOUT_Create
1760*/
1761SW_ABOUT_Create:
1762 call SW_ABOUT_Init
1763return
1764
1765/*:VRX SW_ABOUT_Fini
1766*/
1767SW_ABOUT_Fini:
1768 window = VRInfo( "Window" )
1769 call VRDestroy window
1770 drop window
1771return
1772/*:VRX SW_ABOUT_Init
1773*/
1774SW_ABOUT_Init:
1775
1776 IF globals.!is_ecs == 1 THEN
1777 _platform = 'eComStation'
1778 ELSE
1779 _platform = 'PM'
1780
1781 CALL NLSSetText 'SW_ABOUT', 'Caption', 130
1782 CALL NLSSetText 'DT_PRODUCT', 'Caption', 131, _platform
1783 CALL NLSSetText 'DT_VERSION', 'Caption', 132, globals.!version
1784 CALL NLSSetText 'DT_COPYRIGHT', 'Caption', 133, globals.!copyright
1785 CALL NLSSetText 'PB_ABOUT_OK', 'Caption', 2
1786
1787 PARSE VERSION _rexxver
1788 PARSE VALUE VRVersion('VROBJ.DLL') WITH _vrver .
1789 PARSE VALUE RPUVersion() WITH _rpuver .
1790 PARSE VALUE VRXVersion() WITH _vrxver .
1791 _pr1ver = PRVersion()
1792 _wptver = WPToolsVersion()
1793 _bullet = NLSGetMessage( 135 )
1794 CALL VRSet 'MLE_LICENSES', 'Value', NLSGetMessage( 134, _rexxver ) || '0a'x ,
1795 _bullet 'IBM REXXUTIL' SysUtilVersion() || '0a'x ,
1796 _bullet 'VX-REXX VROBJ' _vrver || '0a'x ,
1797 _bullet 'VX-REXX Extras (VROBJEX)' _vrxver || '0a'x ,
1798 _bullet 'RXPRTUTL' _rpuver || '0a'x ,
1799 _bullet 'WPTOOLS' _wptver || '0a'x ,
1800 _bullet _pr1ver || '0a'x||' ----- '||'0a'x || ,
1801 NLSGetMessage( 137 ) || '0a'x' ----- '||'0a'x || ,
1802 NLSGetMessage( 138 )
1803
1804 window = VRInfo( "Object" )
1805 if( \VRIsChildOf( window, "Notebook" ) ) then do
1806 call VRMethod window, "CenterWindow"
1807 call VRSet window, "Visible", 1
1808 call VRMethod window, "Activate"
1809 end
1810 drop window
1811return
1812
1813/*:VRX SW_DEVICES_Close
1814*/
1815SW_DEVICES_Close:
1816 call SW_DEVICES_Fini
1817return
1818
1819/*:VRX SW_DEVICES_Create
1820*/
1821SW_DEVICES_Create:
1822 call SW_DEVICES_Init
1823return
1824
1825/*:VRX SW_DEVICES_Fini
1826*/
1827SW_DEVICES_Fini:
1828 window = VRInfo( "Window" )
1829 call VRDestroy window
1830 drop window
1831return
1832/*:VRX SW_DEVICES_Init
1833*/
1834SW_DEVICES_Init: PROCEDURE EXPOSE globals.
1835
1836 globals.!hcfDevices.!icon = VRMethod( "CN_DEVICES", "AddField", "Icon", "" )
1837 globals.!hcfDevices.!model = VRMethod( "CN_DEVICES", "AddField", "String", NLSGetMessage( 111 ))
1838 globals.!hcfDevices.!driver = VRMethod( "CN_DEVICES", "AddField", "String", NLSGetMessage( 116 ))
1839
1840 CALL VRSet "CN_DEVICES", "DetailSort", globals.!hcfDevices.!model
1841 ok = VRMethod( "CN_DEVICES", "SetFieldAttr", globals.!hcfDevices.!icon, "HorizSeparator", "0" )
1842
1843 CALL NLSSetText 'CN_DEVICES', 'Caption', 104
1844 CALL NLSSetText 'PB_DEVICE_ADD', 'Caption', 8
1845 CALL NLSSetText 'PB_DEVICE_REMOVE', 'Caption', 9
1846
1847 CALL RefreshDevices
1848
1849 window = VRInfo( "Object" )
1850 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
1851 call VRMethod window, "CenterWindow"
1852 call VRSet window, "Visible", 1
1853 call VRMethod window, "Activate"
1854 end
1855
1856 CALL VRSet window, 'UserData', 'CN_DEVICES'
1857 drop window
1858/*
1859 globals.!initstate = globals.!initstate + 1
1860 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
1861*/
1862RETURN
1863
1864/*:VRX SW_IMPORT_Close
1865*/
1866SW_IMPORT_Close:
1867 call SW_IMPORT_Fini
1868return
1869
1870/*:VRX SW_IMPORT_Create
1871*/
1872SW_IMPORT_Create:
1873 call SW_IMPORT_Init
1874return
1875
1876/*:VRX SW_IMPORT_Fini
1877*/
1878SW_IMPORT_Fini:
1879 window = VRInfo( "Window" )
1880 call VRDestroy window
1881 drop window
1882return
1883/*:VRX SW_IMPORT_Init
1884*/
1885SW_IMPORT_Init: PROCEDURE EXPOSE globals. new_ppd
1886
1887 CALL NLSSetText 'SW_IMPORT', 'Caption', 236
1888 CALL NLSSetText 'DT_IMPORT', 'Caption', 233
1889 CALL NLSSetText 'RB_IMPORTCUPS', 'Caption', 234
1890 CALL NLSSetText 'RB_IMPORTLEGACY', 'Caption', 235
1891 CALL NLSSetText 'PB_IMPORTOK', 'Caption', 2
1892 CALL NLSSetText 'PB_IMPORTCANCEL', 'Caption', 3
1893
1894 _count = 0
1895 IF ( DriverIsInstalled('PSCRIPT') <> '') | ( GetDriverSource('PSCRIPT') <> '') THEN DO
1896 _count = _count + 1
1897 psdrv._count = 'PSCRIPT'
1898 END
1899 IF ( DriverIsInstalled('PSCRIPT2') <> '') | ( GetDriverSource('PSCRIPT2') <> '') THEN DO
1900 _count = _count + 1
1901 psdrv._count = 'PSCRIPT2'
1902 END
1903 IF ( DriverIsInstalled('PSPRINT') <> '') | ( GetDriverSource('PSPRINT') <> '') THEN DO
1904 _count = _count + 1
1905 psdrv._count = 'PSPRINT'
1906 END
1907 IF ( DriverIsInstalled('PSPRINT2') <> '') | ( GetDriverSource('PSPRINT2') <> '') THEN DO
1908 _count = _count + 1
1909 psdrv._count = 'PSPRINT2'
1910 END
1911 IF ( DriverIsInstalled('ECUPS') <> '') | ( GetDriverSource('ECUPS') <> '') THEN DO
1912 _count = _count + 1
1913 psdrv._count = 'ECUPS'
1914 END
1915 IF ( DriverIsInstalled('ECUPS-HP') <> '') | ( GetDriverSource('ECUPS-HP') <> '') THEN DO
1916 _count = _count + 1
1917 psdrv._count = 'ECUPS-HP'
1918 END
1919 IF DriverIsInstalled('GUTENPRT') <> '' THEN DO
1920 _count = _count + 1
1921 psdrv._count = 'GUTENPRT'
1922 END
1923
1924 IF _count < 1 THEN DO
1925 IF globals.!hascups == 0 THEN DO
1926 CALL VRMessage VRWindow(), NLSGetMessage( 237 ), NLSGetMessage( 13 ), 'E'
1927 CALL SW_IMPORT_Close
1928 END
1929 CALL VRSet 'RB_IMPORTCUPS', 'Set', 1
1930 CALL VRSet 'RB_IMPORTLEGACY', 'Enabled', 0
1931 CALL VRSet 'DDCB_IMPORTDRV', 'Enabled', 0
1932 END
1933 ELSE IF \globals.!hascups THEN DO
1934 CALL VRSet 'RB_IMPORTCUPS', 'Enabled', 0
1935 END
1936
1937 psdrv.0 = _count
1938 CALL VRMethod 'DDCB_IMPORTDRV', 'AddStringList', 'psdrv.'
1939 CALL VRSet 'DDCB_IMPORTDRV', 'Selected', 1
1940
1941 window = VRInfo( "Object" )
1942 if( \VRIsChildOf( window, "Notebook" ) ) then do
1943 call VRMethod window, "CenterWindow"
1944 call VRSet window, "Visible", 1
1945 call VRMethod window, "Activate"
1946 end
1947 drop window
1948RETURN
1949
1950/*:VRX SW_MODELS_Close
1951*/
1952SW_MODELS_Close:
1953 call SW_MODELS_Fini
1954return
1955
1956/*:VRX SW_MODELS_Create
1957*/
1958SW_MODELS_Create:
1959 call SW_MODELS_Init
1960return
1961
1962/*:VRX SW_MODELS_Fini
1963*/
1964SW_MODELS_Fini:
1965 window = VRInfo( "Window" )
1966 call VRDestroy window
1967 drop window
1968return
1969/*:VRX SW_MODELS_Init
1970*/
1971SW_MODELS_Init: PROCEDURE EXPOSE globals.
1972
1973 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
1974 IF ok == 0 | recs.0 < 1 THEN RETURN
1975 record = recs.1
1976
1977 _name = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!name )
1978 _path = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!path )
1979 _ver = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!version )
1980 IF _ver == '-' THEN _ver = '??'
1981 driver = _path'\'_name
1982
1983 CALL NLSSetText 'SW_MODELS', 'Caption', 194
1984 CALL NLSSetText 'PB_MODELS_CLOSE', 'Caption', 12
1985
1986 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
1987 ok = RPUEnumModels( driver, 'models.')
1988 IF ok == 1 THEN
1989 CALL VRMethod 'LB_MODELS', 'AddStringList', 'models.'
1990 CALL VRSet 'WN_MAIN', 'Pointer', '<default>'
1991
1992 CALL NLSSetText 'DT_MODELS', 'Caption', 195, _name, models.0
1993
1994 window = VRInfo( "Object" )
1995 if( \VRIsChildOf( window, "Notebook" ) ) then do
1996 call VRMethod window, "CenterWindow"
1997 call VRSet window, "Visible", 1
1998 call VRMethod window, "Activate"
1999 end
2000 drop window
2001
2002RETURN
2003
2004/*:VRX SW_PORT_ADD_Close
2005*/
2006SW_PORT_ADD_Close:
2007 call SW_PORT_ADD_Fini
2008return
2009
2010/*:VRX SW_PORT_ADD_Create
2011*/
2012SW_PORT_ADD_Create:
2013 call SW_PORT_ADD_Init
2014return
2015
2016/*:VRX SW_PORT_ADD_Fini
2017*/
2018SW_PORT_ADD_Fini:
2019 window = VRInfo( "Window" )
2020 call VRDestroy window
2021 drop window
2022return
2023/*:VRX SW_PORT_ADD_Init
2024*/
2025SW_PORT_ADD_Init: PROCEDURE EXPOSE globals. updated
2026
2027 fld_name = VRMethod('CN_ADDPORT', 'AddField', 'String',, 'NAME')
2028 fld_path = VRMethod('CN_ADDPORT', 'AddField', 'String',, 'PATH')
2029
2030 CALL NLSSetText 'SW_PORT_ADD', 'Caption', 160
2031 CALL NLSSetText 'DT_ADDPORT', 'Caption', 161
2032 CALL NLSSetText 'CN_ADDPORT', 'Caption', 162
2033 CALL NLSSetText 'DT_OTHERPORT', 'Caption', 163
2034 CALL NLSSetText 'PB_OTHERPORT', 'Caption', 164
2035
2036 CALL NLSSetText 'PB_ADDPORT_OK', 'Caption', 2
2037 CALL NLSSetText 'PB_ADDPORT_CANCEL', 'Caption', 3
2038
2039 IF GetPortDrivers() > 0 THEN DO
2040 objects.0 = portdrivers.0
2041 DO i = 1 TO portdrivers.0
2042 PARSE VAR portdrivers.i _name _path
2043 SELECT
2044 WHEN _name == 'FILE' THEN _icon = '$24,PMWP'
2045 WHEN _name == 'USBPRT' THEN _icon = '$7001,'_path
2046 WHEN _name == 'SERIAL' THEN _icon = '$7001,'_path
2047 WHEN _name == 'PARALLEL' THEN _icon = '$7001,'_path
2048 WHEN _name == 'SLPR' THEN _icon = '$7001,'_path
2049 WHEN _name == 'LPRPDRVR' THEN _icon = '$256,'_path
2050 OTHERWISE _icon = _path
2051 END
2052 objects.i = ';'_name';'_icon';;;'fld_name';'_name';'fld_path';'_path
2053 END
2054 CALL VRMethod 'CN_ADDPORT', 'AddRecordList',,, 'objects.'
2055 END
2056
2057 window = VRInfo( "Object" )
2058 if( \VRIsChildOf( window, "Notebook" ) ) then do
2059 call VRMethod window, "CenterWindow"
2060 call VRSet window, "Visible", 1
2061 call VRMethod window, "Activate"
2062 end
2063 drop window
2064RETURN
2065
2066/*:VRX SW_PORTS_Close
2067*/
2068SW_PORTS_Close:
2069 call SW_PORTS_Fini
2070return
2071
2072/*:VRX SW_PORTS_Create
2073*/
2074SW_PORTS_Create:
2075 call SW_PORTS_Init
2076return
2077
2078/*:VRX SW_PORTS_Fini
2079*/
2080SW_PORTS_Fini:
2081 window = VRInfo( "Window" )
2082 call VRDestroy window
2083 drop window
2084return
2085/*:VRX SW_PORTS_Init
2086*/
2087SW_PORTS_Init: PROCEDURE EXPOSE globals.
2088
2089 globals.!hcfPorts.!icon = VRMethod( "CN_PORTS", "AddField", "Icon", "" )
2090 globals.!hcfPorts.!name = VRMethod( "CN_PORTS", "AddField", "String", NLSGetMessage( 111 ))
2091 globals.!hcfPorts.!driver = VRMethod( "CN_PORTS", "AddField", "String", NLSGetMessage( 119 ))
2092
2093 CALL VRSet "CN_PORTS", "DetailSort", globals.!hcfPorts.!name
2094 ok = VRMethod( "CN_PORTS", "SetFieldAttr", globals.!hcfPorts.!icon, "HorizSeparator", "0" )
2095
2096 CALL NLSSetText 'CN_PORTS', 'Caption', 105
2097 CALL NLSSetText 'PB_PORT_ADD', 'Caption', 5
2098 CALL NLSSetText 'PB_PORT_DELETE', 'Caption', 6
2099
2100 CALL RefreshPorts
2101
2102 window = VRInfo( "Object" )
2103 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2104 call VRMethod window, "CenterWindow"
2105 call VRSet window, "Visible", 1
2106 call VRMethod window, "Activate"
2107 end
2108
2109 CALL VRSet window, 'UserData', 'CN_PORTS'
2110 drop window
2111/*
2112 globals.!initstate = globals.!initstate + 1
2113 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
2114*/
2115RETURN
2116
2117/*:VRX SW_PRINTERPAKS_Close
2118*/
2119SW_PRINTERPAKS_Close:
2120 call SW_PRINTERPAKS_Fini
2121return
2122
2123/*:VRX SW_PRINTERPAKS_Create
2124*/
2125SW_PRINTERPAKS_Create:
2126 call SW_PRINTERPAKS_Init
2127return
2128
2129/*:VRX SW_PRINTERPAKS_Fini
2130*/
2131SW_PRINTERPAKS_Fini:
2132 window = VRInfo( "Window" )
2133 call VRDestroy window
2134 drop window
2135return
2136/*:VRX SW_PRINTERPAKS_Init
2137*/
2138SW_PRINTERPAKS_Init: PROCEDURE EXPOSE globals.
2139
2140 globals.!hcfPaks.!icon = VRMethod( "CN_PRINTERPAKS", "AddField", "Icon", "" )
2141 globals.!hcfPaks.!name = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 173 ))
2142 globals.!hcfPaks.!version= VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 181 ))
2143 globals.!hcfPaks.!status = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 176 ))
2144 globals.!hcfPaks.!path = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 175 ))
2145 globals.!hcfPaks.!desc = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 174 ))
2146 globals.!hcfPaks.!flags = VRMethod( "CN_PRINTERPAKS", "AddField", "String", 'FLAGS')
2147
2148 CALL VRSet "CN_PRINTERPAKS", "DetailSort", globals.!hcfPaks.!name
2149 ok = VRMethod( "CN_PRINTERPAKS", "SetFieldAttr", globals.!hcfPaks.!icon, "HorizSeparator", "0" )
2150 ok = VRMethod( "CN_PRINTERPAKS", "SetFieldAttr", globals.!hcfPaks.!flags, "Visible", "0" )
2151
2152 CALL NLSSetText 'SW_PRINTERPAKS', 'Caption', 170
2153 CALL NLSSetText 'DT_PRINTERPAKS', 'Caption', 171
2154 CALL NLSSetText 'PB_PPUPDATE', 'Caption', 179
2155 CALL NLSSetText 'PB_PPCLOSE', 'Caption', 12
2156
2157 CALL GetPrinterPaks
2158
2159 window = VRInfo( "Object" )
2160 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2161 call VRMethod window, "CenterWindow"
2162 call VRSet window, "Visible", 1
2163 call VRMethod window, "Activate"
2164 end
2165 drop window
2166return
2167
2168/*:VRX SW_PRINTERS_Close
2169*/
2170SW_PRINTERS_Close:
2171 call SW_PRINTERS_Fini
2172return
2173
2174/*:VRX SW_PRINTERS_Create
2175*/
2176SW_PRINTERS_Create:
2177 call SW_PRINTERS_Init
2178return
2179
2180/*:VRX SW_PRINTERS_Fini
2181*/
2182SW_PRINTERS_Fini:
2183 window = VRInfo( "Window" )
2184 call VRDestroy window
2185 drop window
2186return
2187/*:VRX SW_PRINTERS_Init
2188*/
2189SW_PRINTERS_Init: PROCEDURE EXPOSE globals.
2190
2191 CALL NLSSetText 'CN_PRINTERS', 'Caption', 103
2192 CALL NLSSetText 'PB_PRINTER_ADD', 'Caption', 5
2193 CALL NLSSetText 'PB_PRINTER_DEL', 'Caption', 6
2194 CALL NLSSetText 'PB_PRINTER_OPEN', 'Caption', 7
2195
2196 globals.!hcfPrinters.!icon = VRMethod( "CN_PRINTERS", "AddField", "Icon", "" )
2197 globals.!hcfPrinters.!title = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 110 ))
2198 globals.!hcfPrinters.!name = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 112 ))
2199 globals.!hcfPrinters.!queue = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 113 ))
2200 globals.!hcfPrinters.!host = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 115 ))
2201 globals.!hcfPrinters.!driver = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 116 ))
2202 globals.!hcfPrinters.!port = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 117 ))
2203 globals.!hcfPrinters.!flags = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 118 ))
2204 globals.!hcfPrinters.!handle = VRMethod( "CN_PRINTERS", "AddField", "String", "HANDLE" )
2205
2206 CALL VRSet 'CN_PRINTERS', 'DetailSort', globals.!hcfPrinters.!title
2207 CALL VRSet 'CN_PRINTERS', 'LastSplitField', globals.!hcfPrinters.!host
2208 CALL VRSet 'CN_PRINTERS', 'SplitBarLeft', 3000
2209
2210 ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!icon, "HorizSeparator", "0" )
2211 ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!handle, "Visible", "0" )
2212/* ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!flags, "Visible", "0" ) */
2213
2214 CALL RefreshPrinters
2215
2216 window = VRInfo( "Object" )
2217 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2218 call VRMethod window, "CenterWindow"
2219 call VRSet window, "Visible", 1
2220 call VRMethod window, "Activate"
2221 end
2222
2223 CALL VRSet window, 'UserData', 'CN_PRINTERS'
2224 drop window
2225/*
2226 globals.!initstate = globals.!initstate + 1
2227 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
2228*/
2229
2230RETURN
2231
2232/*:VRX SW_PRINTERS_Resize
2233*/
2234SW_PRINTERS_Resize:
2235
2236return
2237
2238/*:VRX SW_WIZARD_Close
2239*/
2240SW_WIZARD_Close:
2241 call SW_WIZARD_Fini
2242return
2243
2244/*:VRX SW_WIZARD_Create
2245*/
2246SW_WIZARD_Create:
2247 call SW_WIZARD_Init
2248return
2249
2250/*:VRX SW_WIZARD_Fini
2251*/
2252SW_WIZARD_Fini:
2253 window = VRInfo( "Window" )
2254 call VRDestroy window
2255 drop window
2256
2257 IF globals.!wizard THEN CALL Quit
2258 ELSE DO
2259 call VRSet 'WN_MAIN', "Visible", 1
2260 IF globals.!create_mode == '' THEN
2261 call VRMethod 'WN_MAIN', "Activate"
2262 END
2263RETURN
2264/*:VRX SW_WIZARD_Init
2265*/
2266SW_WIZARD_Init:
2267
2268 CALL NLSSetText 'SW_WIZARD', 'Caption', 140
2269 IF globals.!wizard THEN
2270 CALL NLSSetText 'DT_WIZARD', 'Caption', 142
2271 ELSE
2272 CALL NLSSetText 'DT_WIZARD', 'Caption', 141
2273 CALL NLSSetText 'RB_CREATE_CUPS', 'Caption', 143
2274 CALL NLSSetText 'RB_CREATE_LEGACY', 'Caption', 144
2275 CALL NLSSetText 'RB_CREATE_STANDARD', 'Caption', 145
2276 CALL NLSSetText 'RB_CREATE_LAN', 'Caption', 146
2277 CALL NLSSetText 'RB_ADVANCED', 'Caption', 147
2278 CALL NLSSetText 'PB_WIZARD_NEXT', 'Caption', 11
2279 CALL NLSSetText 'PB_WIZARD_CANCEL', 'Caption', 3
2280 CALL NLSSetText 'PB_WIZARD_HELP', 'Caption', 4
2281
2282 IF globals.!wizard THEN CALL VRSet 'RB_ADVANCED', 'Visible', 1
2283 window = VRInfo( "Object" )
2284 if( \VRIsChildOf( window, "Notebook" ) ) then do
2285 call VRMethod window, "CenterWindow"
2286 call VRSet window, "Visible", 1
2287 call VRMethod window, "Activate"
2288 end
2289 drop window
2290
2291 globals.!create_mode = ''
2292
2293RETURN
2294
2295/*:VRX TDL_MAIN_PageSelected
2296*/
2297TDL_MAIN_PageSelected: PROCEDURE EXPOSE globals.
2298 _pageidx = VRInfo("Page")
2299 _pagewin = VRMethod( "TDL_MAIN", "GetPageWindow", _pageidx )
2300 _cnr = VRGet( _pagewin, "UserData")
2301 IF _cnr == '' THEN RETURN
2302
2303 _view = VRGet( _cnr, "View")
2304 IF _view == 'Detail' THEN DO
2305 CALL VRSet 'MI_ICONVIEW', 'Checked', 0
2306 CALL VRSet 'MI_DETAILVIEW', 'Checked', 1
2307 END
2308 ELSE DO
2309 CALL VRSet 'MI_ICONVIEW', 'Checked', 1
2310 CALL VRSet 'MI_DETAILVIEW', 'Checked', 0
2311 END
2312
2313 SELECT
2314 WHEN _cnr == 'CN_PRINTERS' THEN DO
2315 END
2316 WHEN _cnr == 'CN_PORTS' THEN DO
2317 END
2318 WHEN _cnr == 'CN_DEVICES' THEN DO
2319 END
2320 OTHERWISE DO
2321 END
2322 END
2323
2324RETURN
2325
2326/*:VRX TM_REFRESH_Trigger
2327*/
2328TM_REFRESH_Trigger: PROCEDURE EXPOSE globals.
2329 CALL RefreshPrinters
2330 CALL RefreshPorts
2331 CALL RefreshDevices
2332RETURN
2333
2334/*:VRX WN_MAIN_Close
2335*/
2336WN_MAIN_Close:
2337 call Quit
2338return
2339
2340/*:VRX xxUpdatePrDesc
2341*/
2342xxUpdatePrDesc: PROCEDURE EXPOSE globals.
2343 ARG driver, fqn
2344
2345 IF globals.!prdesc == '' THEN RETURN 1
2346
2347 ok = RPUEnumModels( fqn, 'newdevs.')
2348 IF ok == 0 THEN RETURN 2
2349
2350 _count = 0
2351 CALL LINEIN globals.!prdesc, 1, 0
2352 DO WHILE LINES( globals.!prdesc )
2353 _next = LINEIN( globals.!prdesc )
2354 PARSE UPPER VAR _next WITH . ':' . '('_prdrv')' .
2355 IF _prdrv == driver THEN ITERATE
2356 _count = _count + 1
2357 prdefs.count = _next
2358 END
2359 CALL STREAM prdesc, 'C', 'CLOSE'
2360
2361 DO i = 1 TO devs.0
2362 _count = _count + 1
2363 prdefs._count = newdevs.i':' newdevs.i '('driver')'
2364 END
2365 prdefs.0 = count
2366
2367 CALL VRSortStem 'prdefs.'
2368
2369 _prdir = VRParseFileName( globals.!prdesc, 'DP')
2370 CALL VRCopyFile globals.!prdesc, _prdir'\PRDESC.BAK'
2371 CALL VRDeleteFile globals.!prdesc
2372 DO i = 1 TO prdefs.0
2373 CALL LINEOUT globals.!prdesc, prdefs.i
2374 END
2375 CALL LINEOUT globals.!prdesc
2376
2377RETURN 0
2378
Note: See TracBrowser for help on using the repository browser.