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

Last change on this file since 43 was 43, checked in by Alex Taylor, 12 years ago

Refresh printer container when default flag is changed. Minor tweak to directory setup logic when adding a new PM driver.

File size: 93.5 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 globals.!hascups = 0
101
102 /* See if CUPSLPR.EXE (required by CUPS.PDR) is installed.
103 */
104 tcpipbin = SysSearchPath('PATH', 'inetd.exe')
105 IF tcpipbin <> '' THEN
106 tcpipbin = VRParseFileName( tcpipbin, 'DP')
107 ELSE
108 tcpipbin = globals.!bootdrv'\TCPIP\BIN'
109 globals.!programs.!cupslpr = STREAM( tcpipbin'\cupslpr.exe', 'C', 'QUERY EXISTS')
110 IF globals.!programs.!cupslpr == '' THEN
111 globals.!programs.!cupslpr = SysSearchPath('PATH', 'cupslpr.exe')
112 IF globals.!programs.!cupslpr == '' THEN
113 globals.!programs.!cupslpr = STREAM( globals.!mydir'\cupslpr.exe', 'C', 'QUERY EXISTS')
114
115 /* See if CUPS.PDR is installed.
116 */
117 IF globals.!programs.!cupslpr <> '' THEN DO
118 cups_pdr = VRGetIni('PM_PORT_DRIVER', 'CUPS', 'System')
119 IF cups_pdr == '' THEN DO
120 cups_pdr = STREAM( globals.!bootdrv'\OS2\DLL\CUPS.PDR', 'C', 'QUERY EXISTS')
121 IF cups_pdr <> '' THEN CALL VRSetIni('PM_PORT_DRIVER', 'CUPS', cups_pdr, 'System')
122 END
123 IF cups_pdr <> '' THEN
124 globals.!hascups = 1
125 END
126
127 /* See if GZIP.EXE is installed (required for unpacking CUPS PPDs).
128 */
129 globals.!programs.!gzip = SysSearchPath('PATH', 'gzip.exe')
130 IF globals.!programs.!gzip == '' THEN
131 globals.!programs.!gzip = SysSearchPath('PATH', 'gunzip.exe')
132 IF globals.!programs.!gzip == '' THEN
133 globals.!programs.!gzip = STREAM( globals.!mydir'\gzip.exe', 'C', 'QUERY EXISTS')
134
135 /* Try and find some other CUPS programs we use.
136 */
137 globals.!programs.!lpadmin = STREAM( globals.!cupsdir'\sbin\lpadmin.exe', 'C', 'QUERY EXISTS')
138 globals.!programs.!lpinfo = STREAM( globals.!cupsdir'\sbin\lpinfo.exe', 'C', 'QUERY EXISTS')
139 globals.!programs.!lpoptions = STREAM( globals.!cupsdir'\bin\lpoptions.exe', 'C', 'QUERY EXISTS')
140 globals.!programs.!lpstat = STREAM( globals.!cupsdir'\bin\lpstat.exe', 'C', 'QUERY EXISTS')
141
142RETURN
143
144/*:VRX CN_DEVICES_ContextMenu
145*/
146CN_DEVICES_ContextMenu: PROCEDURE EXPOSE globals.
147
148 _record = VRInfo("Record")
149 IF _record <> '' THEN DO
150 CALL VRMethod 'CN_DEVICES', 'SetRecordAttr', _record, 'Selected', 1
151 CALL VRMethod 'MN_DRIVERS', 'Popup'
152 END
153 ELSE
154 CALL VRMethod 'MN_CONTEXT', 'Popup'
155
156RETURN
157
158/*:VRX CN_DEVICES_KeyPress
159*/
160CN_DEVICES_KeyPress:
161 IF VRGet('CN_DEVICES', 'KeyString') == '{Backtab}' THEN
162 CALL VRMethod 'TDL_MAIN', 'SetFocus'
163return
164
165/*:VRX CN_PORTS_ContextMenu
166*/
167CN_PORTS_ContextMenu: PROCEDURE EXPOSE globals.
168
169 _record = VRInfo("Record")
170 IF _record <> '' THEN DO
171 CALL VRMethod 'CN_PORTS', 'SetRecordAttr', _record, 'Selected', 1
172 CALL VRMethod 'MN_PORT', 'Popup'
173 END
174 ELSE DO
175 CALL VRMethod 'MN_CONTEXT', 'Popup'
176 END
177
178RETURN
179
180/*:VRX CN_PORTS_KeyPress
181*/
182CN_PORTS_KeyPress:
183 IF VRGet('CN_PORTS', 'KeyString') == '{Backtab}' THEN
184 CALL VRMethod 'TDL_MAIN', 'SetFocus'
185return
186
187/*:VRX CN_PRINTERPAKS_ContextMenu
188*/
189CN_PRINTERPAKS_ContextMenu: PROCEDURE EXPOSE globals.
190 _record = VRInfo("Record")
191 IF _record <> '' THEN DO
192 CALL VRMethod 'CN_PRINTERPAKS', 'SetRecordAttr', _record, 'Selected', 1
193 CALL VRMethod 'MN_PRINTERPAK', 'Popup'
194 END
195RETURN
196
197/*:VRX CN_PRINTERS_ContextMenu
198*/
199CN_PRINTERS_ContextMenu: PROCEDURE EXPOSE globals.
200
201 _record = VRInfo("Record")
202 IF _record <> '' THEN DO
203 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', _record, 'Selected', 1
204 _flags = VRMethod('CN_PRINTERS', 'GetFieldData', _record, globals.!hcfPrinters.!flags )
205 IF POS('D', _flags ) > 0 THEN
206 CALL VRSet 'MI_PRINTER_DEFAULT', 'Checked', 1
207 ELSE
208 CALL VRSet 'MI_PRINTER_DEFAULT', 'Checked', 0
209 IF POS('P', _flags ) > 0 THEN
210 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 1
211 ELSE
212 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 0
213 CALL VRMethod 'MN_PRINTER', 'Popup'
214 END
215 ELSE
216 CALL VRMethod 'MN_CONTEXT', 'Popup'
217
218RETURN
219
220/*:VRX CN_PRINTERS_DoubleClick
221*/
222CN_PRINTERS_DoubleClick:
223 CALL PrinterOpen VRInfo("Record")
224RETURN
225
226/*:VRX CN_PRINTERS_KeyPress
227*/
228CN_PRINTERS_KeyPress:
229 IF VRGet('CN_PRINTERS', 'KeyString') == '{Backtab}' THEN
230 CALL VRMethod 'TDL_MAIN', 'SetFocus'
231RETURN
232
233/*:VRX CupsDeletePrinter
234*/
235CupsDeletePrinter: PROCEDURE EXPOSE globals.
236 PARSE ARG _host, _dest
237
238 IF TRANSLATE( _host ) <> 'LOCALHOST' THEN
239 del_cmd = globals.!programs.!lpadmin '-h' _host '-x' _dest
240 ELSE
241 del_cmd = globals.!programs.!lpadmin '-x' _dest
242 CALL LINEOUT globals.!log1, 'Delete CUPS destination' _dest' with:' del_cmd
243
244/*
245 nq = RXQUEUE('CREATE')
246 oq = RXQUEUE('SET', nq )
247 ADDRESS CMD '@' del_cmd '2>&1 | RXQUEUE' nq
248 DO QUEUED()
249 PARSE PULL _output
250 CALL LINEOUT globals.!log2, _output
251 IF LEFT( _output, 12 ) == 'Password for' & RIGHT( STRIP( _output ), 1 ) == '?' THEN DO
252 CALL SysSleep 1
253 PUSH '0d0a'x
254 END
255 END
256 CALL RXQUEUE 'SET', oq
257 CALL RXQUEUE 'DELETE', nq
258*/
259
260 _od = DIRECTORY()
261 CALL DIRECTORY VRParseFileName( globals.!programs.!lpadmin, 'DP')
262 ADDRESS CMD '@' del_cmd '2>&1 >>' globals.!log2
263 CALL DIRECTORY _od
264
265 CALL LINEOUT globals.!log2, ''
266 CALL LINEOUT globals.!log2
267 CALL LINEOUT globals.!log1, ''
268
269RETURN rc
270
271/*:VRX DDCB_DEVICE_3RDPARTY_Click
272*/
273DDCB_DEVICE_3RDPARTY_Click: PROCEDURE EXPOSE globals. shipped.
274 new_path = TRANSLATE( STRIP( VRGet('DDCB_DEVICE_3RDPARTY', 'SelectedString')))
275 IF new_path == '' THEN RETURN
276
277 old_path = VRGet('DDCB_DEVICE_3RDPARTY', 'UserData')
278 IF old_path == new_path THEN RETURN
279
280 CALL SetDriverList new_path
281RETURN
282
283/*:VRX DDCB_DEVICE_3RDPARTY_Verify
284*/
285DDCB_DEVICE_3RDPARTY_Verify: PROCEDURE EXPOSE globals. shipped.
286 old_path = VRGet('DDCB_DEVICE_3RDPARTY', 'UserData')
287 new_path = TRANSLATE( STRIP( VRGet('DDCB_DEVICE_3RDPARTY', 'Value')))
288 IF new_path == '' THEN DO
289 IF old_path <> '' THEN CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Value', old_path
290 RETURN
291 END
292
293 new_path = VRExpandFileName( new_path )
294 IF new_path == '' THEN DO
295 IF old_path <> '' THEN CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Value', old_path
296 RETURN
297 END
298
299 IF old_path == new_path THEN RETURN
300
301 CALL SetDriverList new_path
302RETURN
303
304/*:VRX DriverAdd
305*/
306DriverAdd: PROCEDURE EXPOSE globals.
307 updated = 0
308 CALL VRLoadSecondary 'SW_DEVICE_ADD', 'W'
309 IF updated == 1 THEN
310 CALL RefreshDevices
311RETURN
312
313/*:VRX DriverDelete
314*/
315DriverDelete: PROCEDURE EXPOSE globals.
316 PARSE ARG record
317 IF record == '' THEN DO
318 ok = VRMethod( "CN_DEVICES", "GetRecordList", "Selected", "recs." )
319 IF ok == 0 | recs.0 < 1 THEN RETURN
320 record = recs.1
321 END
322 CALL VRMethod 'CN_DEVICES', 'SetRecordAttr', record, 'Source', 0
323
324 _name = VRMethod('CN_DEVICES', 'GetFieldData', record, globals.!hcfDevices.!model )
325 _driver = VRMethod('CN_DEVICES', 'GetFieldData', record, globals.!hcfDevices.!driver )
326 IF _name == '' THEN RETURN
327 IF _driver == '' THEN RETURN
328
329 IF _driver == 'IBMNULL' THEN DO
330 CALL VRMessage 'WN_MAIN', NLSGetMessage( 212 ), NLSGetMessage( 209 ), 'W'
331 RETURN
332 END
333
334 device_name = _driver'.'_name
335 device_in_use = 0
336 printers.0 = 0
337 CALL RPUEnumPrinters 'printers.'
338 DO i = 1 TO printers.0
339 CALL RPUPrinterQuery printers.i.!name, 'details.'
340 CALL StringTokenize details.!drivers, ',', 'used_dev.'
341 DO j = 1 TO used_dev.0
342 IF used_dev.j == device_name THEN DO
343 device_in_use = 1
344 LEAVE
345 END
346 END
347 IF device_in_use == 1 THEN DO
348 _title = TRANSLATE( printers.i.!description, ' ', '0d0a'x)
349 CALL VRMessage 'WN_MAIN', NLSGetMessage( 208, device_name, _title ), NLSGetMessage( 209 ), 'W'
350 RETURN
351 END
352 END
353
354 _btns.0 = 2
355 _btns.1 = NLSGetMessage( 14 )
356 _btns.2 = NLSGetMessage( 15 )
357 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 203, device_name ), NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
358 IF _confirm == 1 THEN DO
359 success = DeletePrintDriver( _driver, _name )
360 IF success == 1 THEN CALL RefreshDevices
361 /* TODO check if any other _driver definitions exist and if not, offer to delete _driver files & profile */
362 END
363
364RETURN
365
366/*:VRX Fini
367*/
368Fini:
369 window = VRWindow()
370 call VRSet window, "Visible", 0
371 drop window
372return 0
373
374/*:VRX GetPrinterPaks
375*/
376GetPrinterPaks: PROCEDURE EXPOSE globals.
377 IF globals.!prdrv == '' THEN RETURN 0
378
379 IF globals.!is_ecs == 1 THEN _osname = 'eComStation'
380 ELSE _osname = 'OS/2'
381
382 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
383
384 _count = 0
385 DO WHILE LINES( globals.!prdrv ) > 0
386 /* Read the driver definition from PRDRV.LST
387 */
388 _ppdef = STRIP( LINEIN( globals.!prdrv ))
389 IF _ppdef == '' THEN ITERATE
390 PARSE VAR _ppdef _ppdriver _ppdisk _ppdesc
391 IF _ppdisk == '' THEN ITERATE
392 _ppdesc = STRIP( _ppdesc )
393 _pppath = globals.!repository'\PMDD_'_ppdisk
394
395 /* Check to see if the driver is installed/active.
396 */
397 _flags = 'R'
398 PARSE UPPER VAR _ppdriver _basename'.DRV' .
399 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _basename, 'USER') WITH used_drv '00'x .
400 IF ( used_drv <> '') & VRFileExists( used_drv ) THEN DO
401 _ppicon = '$1:'used_drv
402 _ppstatus = NLSGetMessage( 177, _osname ) NLSGetMessage( 180 )
403 _flags = 'I'
404 END
405 ELSE IF VRFileExists( _pppath'\'_ppdriver ) THEN DO
406 _ppicon = '$1:'_pppath'\'_ppdriver
407 _ppstatus = NLSGetMessage( 177, _osname )
408 END
409 ELSE ITERATE
410
411 _pprev = BldLevelVersion( _pppath'\'_ppdriver )
412
413 /* Driver found, add the record.
414 */
415 _count = _count + 1
416 _fielddata = globals.!hcfPaks.!icon';'_ppicon';' ||,
417 globals.!hcfPaks.!name';'_ppdriver';' ||,
418 globals.!hcfPaks.!status';'_ppstatus';' ||,
419 globals.!hcfPaks.!path';'_pppath';' ||,
420 globals.!hcfPaks.!version';'_pprev';' ||,
421 globals.!hcfPaks.!desc';'_ppdesc';' ||,
422 globals.!hcfPaks.!flags';'_flags';'
423 ppaks._count = ';'_ppdriver';'_ppicon';;;'_fielddata
424 END
425 CALL STREAM globals.!prdrv, 'C', 'CLOSE'
426
427 /* Now look for some known third-party drivers.
428 */
429 PARSE UPPER VALUE VRGetIni('PrinterManager', 'ThirdParty', 'USER') WITH known_3p '00'x .
430 IF known_3p == '' THEN
431 known_3p = 'ECUPS ECUPS-HP GUTENPRT PSPRINT'
432 DO i = 1 TO WORDS( known_3p )
433 _basename = WORD( known_3p, i )
434 _ppini = VRGetIni('PM_INSTALL', _basename'_DIR', 'USER')
435 IF _ppini == '' THEN ITERATE
436 PARSE VAR _ppini _pppath '00'x .
437
438 /* Check to see if the driver is installed/active.
439 */
440 _flags = ''
441 _ppdriver = _basename'.DRV'
442 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _basename, 'USER') WITH used_drv '00'x .
443 IF ( used_drv <> '') & VRFileExists( used_drv ) THEN DO
444 _ppicon = '$1:'used_drv
445 _ppstatus = NLSGetMessage( 178 ) NLSGetMessage( 180 )
446 _flags = 'I'
447 END
448 ELSE IF VRFileExists( _pppath'\'_ppdriver ) THEN DO
449 _ppicon = '$1:'_pppath'\'_ppdriver
450 _ppstatus = NLSGetMessage( 178 )
451 END
452 ELSE ITERATE
453
454 _pprev = BldLevelVersion( _pppath'\'_ppdriver )
455
456 /* Driver found, add the record.
457 */
458 _count = _count + 1
459 _fielddata = globals.!hcfPaks.!icon';'_ppicon';' ||,
460 globals.!hcfPaks.!name';'_ppdriver';' ||,
461 globals.!hcfPaks.!status';'_ppstatus';' ||,
462 globals.!hcfPaks.!path';'_pppath';' ||,
463 globals.!hcfPaks.!version';'_pprev';' ||,
464 globals.!hcfPaks.!flags';'_flags';'
465 ppaks._count = ';'_ppdriver';'_ppicon';;;'_fielddata
466 END
467
468 ppaks.0 = _count
469 CALL VRMethod 'CN_PRINTERPAKS', 'AddRecordList',, 'Last', 'ppaks.'
470
471 CALL VRSet 'WN_MAIN', 'Pointer', '<default>'
472
473RETURN _count
474
475/*:VRX GetShippedDrivers
476*/
477GetShippedDrivers: PROCEDURE EXPOSE globals. shipped.
478
479 count = 0
480 CALL LINEIN globals.!prdesc, 1, 0
481 DO WHILE LINES( globals.!prdesc )
482 _next = LINEIN( globals.!prdesc )
483 PARSE VAR _next _desc':' _rest
484 _ppak = SUBSTR( _rest, LASTPOS('(', _rest ))
485 PARSE VAR _ppak '('_drvr')' .
486 count = count + 1
487 shipped.count = ';'_desc';#2;;;NAME;'_desc';DRIVER;'_drvr';'
488 END
489 CALL STREAM globals.!prdesc, 'C', 'CLOSE'
490 shipped.0 = count
491 CALL VRSortStem 'shipped.'
492
493RETURN count
494
495/*:VRX Halt
496*/
497Halt:
498 signal _VREHalt
499return
500
501/*:VRX ImportPPD
502*/
503/* Import a new PPD file into a PostScript driver. This is unfortunately rather
504 * complicated, all the more so because we need to deal with a large number of
505 * possible situations.
506 */
507ImportPPD: PROCEDURE EXPOSE globals.
508 ARG driver, ppdfile
509 IF driver == '' THEN driver = 'PSCRIPT'
510
511 CALL LINEOUT globals.!log1, 'Going to import PPD file into driver' driver'.'
512
513 status = LocateDriverFiles( driver )
514
515 SELECT
516
517 /* An installable copy of the driver was found. No special action is
518 * required; we can proceed with the import logic below.
519 */
520 WHEN status == 1 THEN NOP
521
522 /* An installable (working) copy of the driver could not be located, but
523 * we found an installed (in use) version whence we can grab the files.
524 */
525 WHEN status == 2 THEN DO
526 /* We need somewhere for the installable copies to live. We ask
527 * the user to confirm this path, as they'll have to specify the
528 * directory later on if they install the driver from PM.
529 */
530 _btn.1 = NLSGetMessage( 2 )
531 _btn.2 = NLSGetMessage( 3 )
532 _btn.3 = NLSGetMessage( 188 )
533 _btn.0 = 3
534 _prompt = NLSGetMessage( 232, driver ) ||,
535 '0a0a0a'x || NLSGetMessage( 187, driver )
536
537 /* Try and determine a suitable default directory */
538 PARSE VALUE VRGetIni('PM_INSTALL', driver'_DIR', 'USER') WITH drvr_dir '00'x .
539 IF drvr_dir == '' THEN
540 PARSE VALUE VRGetIni('InstPDR', 'PATH_TO_'driver, 'USER') WITH drvr_dir '00'x .
541 IF drvr_dir == '' THEN
542 drvr_dir = globals.!repository'\'driver
543
544 /* Now prompt the user to confirm the path */
545 DO UNTIL _select <> 3
546 _select = VRPrompt( VRWindow(), _prompt, 'drvr_dir',,
547 NLSGetMessage( 189 ), '_btn.', 1, 2 )
548 IF _select == 3 THEN
549 drv_dir = VRXDirectoryDialog( VRWindow(), drvr_dir, NLSGetMessage( 189 ))
550 END
551 IF drvr_dir == '' THEN RETURN 1 /** RC=1 cancelled */
552 drvr_dir = VRExpandFileName( drvr_dir )
553 IF drvr_dir == '' THEN RETURN 3 /** RC=3 bad path */
554
555 /* Create the new directory if necessary */
556 IF \VRIsDir( drvr_dir ) THEN
557 IF VRMkDir( drvr_dir ) == 0 THEN RETURN 5 /** RC=5 failed to create directory */
558
559 /* Now copy the driver files */
560 IF CopyPrinterPak( driver_path, drvr_dir ) == 0 THEN RETURN 3 /** RC=4 failed to copy driver files */
561 CALL VRSetIni 'PM_INSTALL', driver'_DIR', drvr_dir||'00'x, 'USER'
562
563 /* Point to the copied driver files as our new working copy */
564 driver_path = drvr_dir'\'driver'.DRV'
565 END
566
567 OTHERWISE DO /* Driver was not found */
568 CALL VRMessage VRWindow(), NLSGetMessage( 231, driver ),,
569 NLSGetMessage( 13 ), 'E'
570 RETURN 2 /** RC=2 driver not found */
571 END
572
573 END
574
575 /* OK, we should now have an acceptable 'installable' copy of the
576 * PrinterPak files. Next, we will:
577 * - Create a temporary working directory & copy the PrinterPak files there
578 * - Pre-process the PPD file to make it ready for import, and also copy it
579 * to a driver-specific 'saved PPDs' directory for future use
580 * - Use PIN to import the PPD into into our temporary working copy
581 * - Copy the updated driver back to our installable copy
582 * - If the driver is actually installed, copy the updated driver back over
583 * the installed version as well.
584 * - If this is a 'shipped' driver (i.e. one listed in PRDRV.LST) then add
585 * the newly-defined printer to PRDESC.LST.
586 */
587
588 /** TODO should move all below this into a new shared function **/
589
590 CALL LINEOUT globals.!log1, 'Driver source: ' driver_path
591
592 workdir = SysTempFileName( globals.!tmpdir'\PPD_????')
593 ok = VRMkDir( workdir )
594 IF ok == 1 THEN ok = VrMkDir( workdir'\OUT')
595 IF ok <> 1 THEN
596 RETURN 5 /** RC=5 failed to create directory */
597
598 CALL LINEOUT globals.!log1, 'Temporary directory: ' workdir
599
600 SELECT
601 WHEN driver == 'ECUPS' THEN ppddir = globals.!repository'\PPD_E'
602 WHEN driver == 'ECUPS-HP' THEN ppddir = globals.!repository'\PPD_EHP'
603 WHEN driver == 'PSPRINT' THEN ppddir = globals.!repository'\PPD_PS'
604 WHEN driver == 'PSPRINT2' THEN ppddir = globals.!repository'\PPD_PS2'
605 WHEN driver == 'PSCRIPT2' THEN ppddir = globals.!repository'\PPD2'
606 WHEN driver == 'GUTENPRT' THEN ppddir = globals.!repository'\PPD_GP'
607 OTHERWISE ppddir = globals.!repository'\PPD'
608 END
609
610 /* Make sure ppddir (for keeping PPD files) exists */
611 CALL SysFileTree ppddir, 'dirs.', 'DO'
612 IF dirs.0 == 0 THEN DO
613 ok = VRMkDir( ppddir )
614 IF ok <> 1 THEN
615 RETURN 5 /** RC=5 failed to create directory */
616 END
617
618 CALL LINEOUT globals.!log1, 'Directory for PPD files:' ppddir
619
620 /***
621 *** Now do the actual work.
622 ***/
623
624
625 /* Copy the needed driver files to our working directories.
626 */
627 drvr_dir = VRParseFileName( driver_path, 'DP')
628 drv_out = workdir'\OUT\'driver'.DRV'
629 pin_exe = workdir'\PIN.EXE'
630 ppd_exe = workdir'\PPDENC.EXE'
631 ok = VRCopyFile( driver_path, drv_out )
632 IF ok == 1 THEN ok = VRCopyFile( drvr_dir'\PIN.EXE', pin_exe )
633 IF ok == 1 THEN ok = VRCopyFile( drvr_dir'\PPDENC.EXE', ppd_exe )
634 IF ok == 0 THEN DO
635 RETURN 4 /*** RC=4 Failed to copy driver files ***/
636 END
637
638 /* Set up the output redirection.
639 */
640 nq = RXQUEUE('CREATE')
641 oq = RXQUEUE('SET', nq )
642
643 /* If the PPD file is compressed, uncompress it.
644 */
645 IF VRParseFilePath( ppdfile, 'E') == 'GZ' THEN DO
646 decppd = workdir'\' || VRParseFilePath( ppdfile, 'N')
647 CALL LINEOUT globals.!log1, 'Decompressing' ppdfile 'to' decppd
648 ADDRESS CMD '@'globals.!programs.!gzip '-c -d' ppdfile '| RXQUEUE' nq
649 DO QUEUED()
650 PARSE PULL line
651 CALL LINEOUT decppd, line
652 END
653 CALL LINEOUT decppd
654 ppdfile = decppd
655 END
656
657 IF VRFileExists( ppdfile ) == 0 THEN DO
658 CALL LINEOUT globals.!log1, 'PPD file' ppdfile 'could not be found.'
659 RETURN 6 /** RC=6 PPD import failed **/
660 END
661
662 ppd_use = ppddir'\' || VRParseFileName( ppdfile, 'NE')
663
664 /* Now we have to clean up and validate the PPD file so PIN can use it.
665 * First, PPDENC converts the codepage if necessary, and copies the results
666 * to our working directory.
667 */
668 CALL LINEOUT globals.!log1, 'Converting PPD with:' ppd_exe ppdfile ppd_use
669 ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2>NUL | RXQUEUE' nq
670 DO QUEUED()
671 PULL output
672 CALL LINEOUT globals.!log2, output
673 END
674 CALL LINEOUT globals.!log2, ''
675 CALL LINEOUT globals.!log2
676
677 IF VRFileExists( ppd_use ) == 0 THEN DO
678 CALL LINEOUT globals.!log1, 'Hmm,' ppd_use 'was not created. Copying manually.'
679 CALL VRCopyFile ppdfile, ppd_use
680 END
681
682 /* Next we strip out some problematic PPD statements which are often
683 * encountered in (for example) CUPS-based PPD files.
684 */
685 CALL CleanPPD ppd_use, globals.!log1
686
687 /* Preparation complete. Now do the import.
688 */
689 count = 0
690 ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2>NUL | RXQUEUE' nq
691 DO QUEUED()
692 PARSE PULL output
693 CALL LINEOUT globals.!log2, output
694 PARSE VAR output . 'OK (' nickname
695 IF nickname <> '' THEN DO
696 count = count + 1
697 newprinters.count = STRIP( nickname, 'T', ')')
698 END
699 END
700 newprinters.0 = count
701 CALL LINEOUT globals.!log2, ''
702 CALL LINEOUT globals.!log2
703
704 /* End the output redirection.
705 */
706 CALL RXQUEUE 'SET', oq
707 CALL RXQUEUE 'DELETE', nq
708
709
710 /***
711 *** Post-import processing.
712 ***/
713
714 IF newprinters.0 == 0 THEN DO
715 RETURN 6 /** RC=6 PPD import failed **/
716 END
717
718 IF driver_repo == 1 THEN DO
719 /* If we're working out of the repository, we need to update the
720 * driver table in PRDESC.LST to add the new driver(s).
721 */
722
723 CALL LINEOUT globals.!log1, 'Updating' globals.!prdesc 'with new entries from' drv_out
724
725/* -- This causes a SYS3175 in the .DRV for some reason...
726 ok = UpdatePrDesc( driver'.DRV', drv_out )
727 IF ok <> 0 THEN
728 CALL LINEOUT globals.!log1, 'Failed to update' globals.!prdesc '(are EAs on' drv_out ' valid?)'
729*/
730
731 count = 0
732
733 /* First, copy all lines that don't refer to the driver just updated */
734 CALL LINEIN globals.!prdesc, 1, 0
735 DO WHILE LINES( globals.!prdesc )
736 _next = LINEIN( globals.!prdesc )
737 PARSE UPPER VAR _next . ':' _rest
738 _tail = SUBSTR( _rest, LASTPOS('(', _rest ))
739 PARSE VAR _tail '('_prdrv')' .
740 IF _prdrv == driver'.DRV' THEN ITERATE
741 count = count + 1
742 defs.count = _next
743 END
744 CALL STREAM globals.!prdesc, 'C', 'CLOSE'
745
746 /* Next, create a new list for the updated driver and merge that in */
747 newlist = workdir'\'driver'.LST'
748 CALL CreateDriverList drv_out, newlist
749 DO WHILE LINES( newlist )
750 _line = LINEIN( newlist )
751 count = count + 1
752 defs.count = _line
753 END
754 CALL STREAM newlist, 'C', 'CLOSE'
755 defs.0 = count
756
757 /* Now sort the list and recreate PRDESC.LST */
758 CALL SysStemSort 'defs.',, 'I'
759 prdesc_tmp = workdir'\PRDESC.LST'
760 IF STREAM( prdesc_tmp, 'C', 'QUERY EXISTS') <> '' THEN
761 CALL VRDeleteFile prdesc_tmp
762 DO i = 1 TO defs.0
763 CALL LINEOUT prdesc_tmp, defs.i
764 END
765 CALL LINEOUT prdesc_tmp
766 ok = VRCopyFile( prdesc_tmp, globals.!prdesc )
767 IF ok == 0 THEN DO
768 RETURN 7 /** RC=7 Error updating PRDESC.LST **/
769 END
770 CALL VRDeleteFile prdesc_tmp
771
772 END
773
774 /* Finally, copy the updated driver files.
775 */
776 target = VRParseFilePath( driver_path, 'DP')
777 CALL LINEOUT globals.!log1, 'Copying files from' workdir'\OUT to' target
778 CALL PRReplaceModule target'\'driver'.DRV', '', ''
779 ok = VRCopyFile( workdir'\OUT\'driver'.DRV', target'\'driver'.DRV')
780 IF ok == 1 THEN
781 ok = VRCopyFile( workdir'\OUT\AUXPRINT.PAK', target'\AUXPRINT.PAK')
782 IF ok == 1 THEN DO
783 /* Copy the updated files to \OS2\DLL\<driver>, replacing any
784 * existing copies. (This prevents problems if the OS/2 driver
785 * installation doesn't/fails to copy them, which can happen under
786 * some circumstances.)
787 */
788 IF VRFileExists( globals.!os2dir'\DLL\'driver'.DRV') THEN DO
789 CALL VRCopyFile workdir'\OUT\AUXPRINT.PAK',,
790 globals.!os2dir'\DLL\'driver'\AUXPRINT.PAK'
791 CALL PRReplaceModule globals.!os2dir'\DLL\'driver'\'driver'.DRV', '', ''
792 CALL VRCopyFile workdir'\OUT\'driver'.DRV', globals.!os2dir'\DLL\'driver'\'driver'.DRV'
793 END
794 END
795 IF ok == 0 THEN DO
796 CALL LINEOUT globals.!log1, VRError()
797 RETURN 4 /*** RC=4 Failed to copy driver files ***/
798 END
799
800 CALL LINEOUT globals.!log1, newprinters.0 'printers imported successfully.'
801 DO i = 1 TO newprinters.0
802 CALL LINEOUT globals.!log1, ' ->' newprinters.i
803 END
804 CALL LINEOUT globals.!log1, ''
805 CALL LINEOUT globals.!log1
806
807 /* Clean up our work directories.
808 */
809 CALL VRDeleteFile workdir'\OUT\*'
810 CALL VRDeleteFile workdir'\*'
811 CALL VRRmDir( workdir'\OUT')
812 CALL VRRmDir( workdir )
813
814RETURN 0
815
816/*:VRX Init
817*/
818Init:
819 /* Hide the VX-REXX console window
820 */
821 CALL VRSet 'Console', 'WindowListTitle', ''
822
823 CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
824 CALL SysLoadFuncs
825 CALL RxFuncAdd 'RPULoadFuncs', 'RXPRTUTL', 'RPULoadFuncs'
826 CALL RPULoadFuncs
827 CALL RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
828 CALL PRLoadFuncs
829 CALL RxFuncAdd 'WPToolsLoadFuncs', 'WPTOOLS', 'WPToolsLoadFuncs'
830 CALL WPToolsLoadFuncs
831 CALL RxFuncAdd 'VRXLoadFuncs', 'VROBJEX', 'VRXLoadFuncs'
832 CALL VRXLoadFuncs
833
834 globals.!wizard = 0
835 globals.!debug = 0
836 globals.!initstate = 0
837
838 DO i = 1 TO InitArgs.0
839 PARSE UPPER VAR InitArgs.i _arg
840 SELECT
841 WHEN _arg == '/CREATE' THEN globals.!wizard = 1
842 WHEN LEFT( _arg, 2 ) == '/D' THEN globals.!debug = 1
843 OTHERWISE NOP
844 END
845 END
846
847 CALL LoadSettings
848 CALL SetLanguage
849 CALL CheckPrograms
850
851 window = VRWindow()
852 call VRMethod window, "CenterWindow"
853 call VRMethod window, "Activate"
854 IF globals.!wizard THEN DO
855 CALL VRMethod 'Application', 'PostQueue', 0, 1, 'CALL PB_PRINTER_ADD_Click'
856 END
857 ELSE DO
858 CALL VRSet window, "Visible", 1
859 CALL VRMethod 'TDL_MAIN', 'SetFocus'
860 END
861 drop window
862
863RETURN
864
865/*:VRX InitMessageLog
866*/
867/* Initialize the message logfile. Unlike the error log, which is cleared and
868 * recreated every time the program starts, the message log is appended to
869 * until it reaches 100kB in size. If the message log is larger than 100kB when
870 * this function is called, it is renamed (with '~' appended to the name) and
871 * a new message log is started.
872 */
873InitMessageLog: PROCEDURE EXPOSE globals.
874
875 logsize = STREAM( globals.!log1, 'C', 'QUERY SIZE')
876 IF ( logsize <> '') & ( logsize > 102400 ) THEN DO
877 CALL VRCopyFile globals.!log1, globals.!log1 || '~'
878 CALL VRDeleteFile globals.!log1
879 END
880
881 datestr = DATE('L') TIME('N')
882 CALL LINEOUT globals.!log1, '--[' datestr ']' ||,
883 COPIES('-', 73 - LENGTH( datestr ))
884RETURN
885
886/*:VRX LoadSettings
887*/
888LoadSettings: PROCEDURE EXPOSE globals.
889
890 globals.!version = '0.44'
891 globals.!copyright = '2013'
892
893 me = VRGet('Application', 'Program')
894 IF me == '' THEN PARSE SOURCE . . me
895 globals.!mydir = VRParseFilePath( me, 'DP')
896
897 /* Get CUPS paths.
898 */
899 PARSE VALUE VRGetIni('eCups', 'CUPS', 'USER') WITH cupsdrv '00'x .
900 IF cupsdrv == '' THEN
901 cupsdrv = VRParseFilePath( me, 'D') || ':'
902 ELSE
903 cupsdrv = STRIP( cupsdrv, 'T', '\')
904 globals.!cupsdir = cupsdrv'\cups'
905
906 /* Get system paths.
907 */
908 globals.!bootdrv = SysBootDrive()
909 IF globals.!bootdrv == '' THEN
910 globals.!bootdrv = FILESPEC('DRIVE', VALUE('OS2_SHELL',,'OS2ENVIRONMENT'))
911 globals.!os2dir = globals.!bootdrv'\OS2'
912 globals.!tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
913 IF globals.!tmpdir == '' THEN
914 globals.!tmpdir = VALUE('TEMP',,'OS2ENVIRONMENT')
915 IF globals.!tmpdir == '' THEN
916 globals.!tmpdir = globals.!mydir
917 globals.!logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT')
918 IF globals.!logdir == '' THEN
919 globals.!logdir = globals.!mydir
920
921 globals.!log1 = globals.!logdir'\printman.l1'
922 globals.!log2 = globals.!logdir'\printman.l2'
923 CALL InitMessageLog
924 IF VRFileExists( globals.!log2 ) THEN
925 CALL VRDeleteFile globals.!log2
926
927
928 /* Get printer-related paths.
929 */
930 PARSE VALUE VRGetIni('PM_INSTALL', 'PDR_DIR', 'USER') WITH repos_dir '00'x .
931 globals.!repository = repos_dir
932 globals.!prdrv = STREAM( globals.!os2dir'\install\prdrv.lst', 'C', 'QUERY EXISTS')
933 globals.!prdesc = STREAM( globals.!os2dir'\install\prdesc.lst', 'C', 'QUERY EXISTS')
934
935 /* Set the language file name.
936 */
937 globals.!nlsname = 'printm'
938
939 /* Determine the OS.
940 */
941 IF VRFileExists( globals.!os2dir'\INSTALL\SYSLEVEL.ECS') THEN
942 globals.!is_ecs = 1
943 ELSE
944 globals.!is_ecs = 0
945
946 globals.!create_mode = ''
947
948RETURN
949
950/*:VRX MI_ABOUT_Click
951*/
952MI_ABOUT_Click:
953 CALL VRLoadSecondary 'SW_ABOUT', 'W'
954RETURN
955
956/*:VRX MI_CONTEXT_DETAIL_Click
957*/
958MI_CONTEXT_DETAIL_Click: PROCEDURE EXPOSE globals.
959 CALL MI_DETAILVIEW_Click
960RETURN
961
962/*:VRX MI_CONTEXT_ICON_Click
963*/
964MI_CONTEXT_ICON_Click: PROCEDURE EXPOSE globals.
965 CALL MI_ICONVIEW_Click
966RETURN
967
968
969/*:VRX MI_CONTEXT_INSTALL_Click
970*/
971MI_CONTEXT_INSTALL_Click: PROCEDURE EXPOSE globals.
972
973 _page = VRGet('TDL_MAIN', 'Selected')
974 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
975 _cnr = VRGet( _pagewin, 'UserData')
976 IF _cnr == '' THEN RETURN
977
978 CALL VRSet _cnr, 'Source', 0
979
980 SELECT
981 WHEN _cnr == 'CN_PRINTERS' THEN CALL PrinterWizard
982 WHEN _cnr == 'CN_PORTS' THEN CALL PortAdd
983 WHEN _cnr == 'CN_DEVICES' THEN CALL DriverAdd
984 OTHERWISE NOP
985 END
986
987RETURN
988
989/*:VRX MI_CONTEXT_REFRESH_Click
990*/
991MI_CONTEXT_REFRESH_Click: PROCEDURE EXPOSE globals.
992 CALL MI_REFRESH_Click
993RETURN
994
995/*:VRX MI_DETAILVIEW_Click
996*/
997MI_DETAILVIEW_Click: PROCEDURE EXPOSE globals.
998
999 _page = VRGet('TDL_MAIN', 'Selected')
1000 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
1001 _cnr = VRGet( _pagewin, 'UserData')
1002 IF _cnr == '' THEN RETURN
1003
1004 CALL VRSet _cnr, 'Source', 0
1005 _set = VRGet('MI_DETAILVIEW', 'Checked')
1006 IF _set == 1 THEN RETURN
1007
1008 CALL VRSet _cnr, 'View', 'Detail'
1009 CALL VRSet _cnr, 'MiniIcons', 1
1010
1011 CALL VRSet 'MI_ICONVIEW', 'Checked', 0
1012 CALL VRSet 'MI_CONTEXT_ICON', 'Checked', 0
1013 CALL VRSet 'MI_DETAILVIEW', 'Checked', 1
1014 CALL VRSet 'MI_CONTEXT_DETAIL','Checked', 1
1015
1016RETURN
1017
1018/*:VRX MI_DRIVERS_INSTALL_Click
1019*/
1020MI_DRIVERS_INSTALL_Click:
1021 CALL DriverAdd
1022return
1023
1024/*:VRX MI_DRIVERS_REMOVE_Click
1025*/
1026MI_DRIVERS_REMOVE_Click:
1027 CALL DriverDelete
1028return
1029
1030/*:VRX MI_ICONVIEW_Click
1031*/
1032MI_ICONVIEW_Click: PROCEDURE EXPOSE globals.
1033
1034 _page = VRGet('TDL_MAIN', 'Selected')
1035 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
1036 _cnr = VRGet( _pagewin, 'UserData')
1037 IF _cnr == '' THEN RETURN
1038
1039 CALL VRSet _cnr, 'Source', 0
1040 _set = VRGet('MI_ICONVIEW', 'Checked')
1041 IF _set == 1 THEN RETURN
1042
1043 CALL VRSet _cnr, 'View', 'Icon'
1044 CALL VRSet _cnr, 'MiniIcons', 0
1045
1046 CALL VRSet 'MI_ICONVIEW', 'Checked', 1
1047 CALL VRSet 'MI_CONTEXT_ICON', 'Checked', 1
1048 CALL VRSet 'MI_DETAILVIEW', 'Checked', 0
1049 CALL VRSet 'MI_CONTEXT_DETAIL', 'Checked', 0
1050
1051RETURN
1052
1053/*:VRX MI_IMPORT_Click
1054*/
1055MI_IMPORT_Click: PROCEDURE EXPOSE globals. new_ppd
1056
1057 /* Prompt the user for the PPD file to import.
1058 */
1059 new_ppd = VRFileDialog( VRWindow(), NLSGetMessage( 230 ), 'O', '*.PPD')
1060 IF new_ppd == '' THEN RETURN 0
1061
1062 /* Let the user select the Postscript driver to update.
1063 */
1064 CALL VRLoadSecondary 'SW_IMPORT', 'W'
1065
1066RETURN ok
1067
1068/*:VRX MI_MANAGE_Click
1069*/
1070MI_MANAGE_Click: PROCEDURE EXPOSE globals.
1071 CALL VRLoadSecondary 'SW_PRINTERPAKS', 'W'
1072RETURN
1073
1074/*:VRX MI_PORT_CREATE_Click
1075*/
1076MI_PORT_CREATE_Click:
1077 CALL PortAdd
1078return
1079
1080/*:VRX MI_PORT_DELETE_Click
1081*/
1082MI_PORT_DELETE_Click:
1083 CALL PortDelete
1084return
1085
1086/*:VRX MI_PORT_PROPS_Click
1087*/
1088MI_PORT_PROPS_Click:
1089 CALL PortProperties
1090RETURN
1091
1092/*:VRX MI_PPAK_COPY_Click
1093*/
1094MI_PPAK_COPY_Click:
1095 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
1096 IF ok == 0 | recs.0 < 1 THEN RETURN
1097 record = recs.1
1098
1099 _path = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!path )
1100 CALL VRMethod 'Application', 'PutClipboard', _path
1101
1102 CALL VRMethod 'CN_PRINTERPAKS', 'SetRecordAttr', record, 'Source', 0
1103RETURN
1104
1105/*:VRX MI_PPAK_MODELS_Click
1106*/
1107MI_PPAK_MODELS_Click: PROCEDURE EXPOSE globals.
1108
1109 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
1110 IF ok == 0 | recs.0 < 1 THEN RETURN
1111 CALL VRMethod 'CN_PRINTERPAKS', 'SetRecordAttr', recs.1, 'Source', 0
1112
1113 CALL VRLoadSecondary 'SW_MODELS', 'W'
1114
1115RETURN
1116
1117/*:VRX MI_PRINTER_CREATE_Click
1118*/
1119MI_PRINTER_CREATE_Click:
1120 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1121 IF ok == 1 & recs.0 > 0 THEN
1122 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', recs.1, 'Source', 0
1123 CALL PrinterWizard
1124RETURN
1125
1126/*:VRX MI_PRINTER_DEFAULT_Click
1127*/
1128MI_PRINTER_DEFAULT_Click:
1129 CALL PrinterSetDefault
1130RETURN
1131
1132/*:VRX MI_PRINTER_DELETE_Click
1133*/
1134MI_PRINTER_DELETE_Click:
1135 CALL PrinterDelete
1136RETURN
1137
1138/*:VRX MI_PRINTER_HOLD_Click
1139*/
1140MI_PRINTER_HOLD_Click:
1141 CALL PrinterHold
1142return
1143
1144/*:VRX MI_PRINTER_OPEN_Click
1145*/
1146MI_PRINTER_OPEN_Click:
1147 CALL PrinterOpen
1148RETURN
1149
1150/*:VRX MI_PRINTER_PROPS_Click
1151*/
1152MI_PRINTER_PROPS_Click:
1153 CALL PrinterProperties
1154RETURN
1155
1156/*:VRX MI_QUIT_Click
1157*/
1158MI_QUIT_Click:
1159 CALL Quit
1160return
1161
1162/*:VRX MI_REFRESH_Click
1163*/
1164MI_REFRESH_Click: PROCEDURE EXPOSE globals.
1165
1166 _page = VRGet('TDL_MAIN', 'Selected')
1167 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
1168 _cnr = VRGet( _pagewin, 'UserData')
1169 IF _cnr == '' THEN RETURN
1170
1171 CALL VRSet _cnr, 'Source', 0
1172
1173 SELECT
1174 WHEN _cnr == 'CN_PRINTERS' THEN CALL RefreshPrinters
1175 WHEN _cnr == 'CN_PORTS' THEN CALL RefreshPorts
1176 WHEN _cnr == 'CN_DEVICES' THEN CALL RefreshDevices
1177 OTHERWISE NOP
1178 END
1179
1180RETURN
1181
1182/*:VRX New_CUPS
1183*/
1184New_CUPS: PROCEDURE EXPOSE globals.
1185 PARSE ARG ppd_file
1186
1187 IF WPToolsQueryObject('<ECUPS_WIZARD>',,,'SetupString') == 1 THEN DO
1188 PARSE VAR SetupString . 'EXENAME='cupswiz';' .
1189 PARSE VAR SetupString . 'STARTUPDIR='_workdir';' .
1190 PARSE VAR SetupString . 'PARAMETERS='_parms';' .
1191 IF _workdir == '' THEN _workdir = VRParseFilePath( cupswiz, 'DP')
1192 END
1193 ELSE DO
1194 cupswiz = Stream( globals.!cupsdir'\cups\cupswiz.exe', 'C', 'QUERY EXISTS')
1195 _workdir = VRParseFilePath( cupswiz, 'DP')
1196 _parms = ''
1197 END
1198 IF cupswiz <> '' THEN DO
1199 od = DIRECTORY()
1200 CALL DIRECTORY _workdir
1201 IF ppd_file <> '' & VRFileExists( ppd_file ) THEN
1202 _parms = _parms ppd_file
1203 ADDRESS CMD 'start' cupswiz _parms
1204 CALL DIRECTORY od
1205 CALL Quit
1206 END
1207
1208RETURN
1209
1210/*:VRX New_LAN
1211*/
1212New_LAN: PROCEDURE EXPOSE globals.
1213
1214 ok = OpenPrinterTemplate('WPRPrinter')
1215 CALL Quit
1216
1217RETURN ok
1218
1219/*:VRX New_Standard
1220*/
1221New_Standard: PROCEDURE EXPOSE globals.
1222
1223 ok = OpenPrinterTemplate('WPPrinter')
1224 CALL Quit
1225
1226RETURN ok
1227
1228/*:VRX OpenPrinterTemplate
1229*/
1230OpenPrinterTemplate: PROCEDURE EXPOSE globals.
1231 PARSE ARG _class
1232
1233 ok = 0
1234 IF WPToolsFolderContent('<WP_TEMPS>', '_temps.', 'F') THEN
1235 DO i = 1 TO _temps.0
1236 IF WPToolsQueryObject( _temps.i, 'szClass') THEN DO
1237 IF szClass == _class THEN DO
1238 ok = WPToolsSetObjectData( _temps.i, 'OPEN=DEFAULT;')
1239 LEAVE
1240 END
1241 END
1242 END
1243
1244 IF ok == 0 THEN DO
1245 IF SysCreateObject( _class, _class, globals.!tmpdir,,
1246 'OBJECTID=<TEMP_PRT>;TAKEDEFAULTS=NO;TEMPLATE=YES', 'R') THEN
1247 DO
1248 ok = SysSetObjectData '<TEMP_PRT>','OPEN=DEFAULT;'
1249 CALL SysDestroyObject '<TEMP_PRT>'
1250 END
1251 END
1252
1253RETURN ok
1254
1255/*:VRX PB_ABOUT_OK_Click
1256*/
1257PB_ABOUT_OK_Click:
1258 CALL SW_ABOUT_Close
1259RETURN
1260
1261/*:VRX PB_ADDPORT_CANCEL_Click
1262*/
1263PB_ADDPORT_CANCEL_Click:
1264 CALL SW_PORT_ADD_Close
1265RETURN
1266
1267/*:VRX PB_ADDPORT_OK_Click
1268*/
1269PB_ADDPORT_OK_Click: PROCEDURE EXPOSE globals. updated
1270
1271 ok = VRMethod('CN_ADDPORT', 'GetRecordList', 'Selected', 'recs.')
1272 IF ok == 0 | recs.0 < 1 THEN RETURN
1273 record = recs.1
1274
1275 _name = VRMethod('CN_ADDPORT', 'GetFieldData', record, 'NAME')
1276 btns.0 = 2
1277 btns.1 = NLSGetMessage( 14 )
1278 btns.2 = NLSGetMessage( 15 )
1279 ok = VRMessage('SW_PORT_ADD', NLSGetMessage( 205, _name ), NLSGetMessage( 200 ), 'Q', 'btns.', 1, 2 )
1280 IF ok == 1 THEN DO
1281 _portname = GetNextPortName( _name )
1282 ok = RPUPortInstall( _name, _portname )
1283 IF ok <> 1 THEN
1284 CALL VRMessage 'SW_PORT_ADD', NLSGetMessage( 167 ) RPUERROR, NLSGetMessage( 13 ), 'E'
1285 ELSE DO
1286 CALL RPUPortDialog _name, _portname
1287 CALL SW_PORT_ADD_Close
1288 updated = 1
1289 END
1290 END
1291
1292RETURN ok
1293
1294/*:VRX PB_DEVICE_ADD_Click
1295*/
1296PB_DEVICE_ADD_Click:
1297 CALL DriverAdd
1298RETURN
1299
1300/*:VRX PB_DEVICE_CANCEL_Click
1301*/
1302PB_DEVICE_CANCEL_Click:
1303 CALL SW_DEVICE_ADD_Close
1304RETURN
1305
1306/*:VRX PB_DEVICE_INSTALL_Click
1307*/
1308PB_DEVICE_INSTALL_Click: PROCEDURE EXPOSE globals. updated
1309 updated = 1
1310
1311 ok = VRMethod('CN_DEVICE_LIST', 'GetRecordList', 'Selected', 'recs.')
1312 IF ok == 0 THEN RETURN
1313 IF recs.0 == 0 THEN RETURN
1314 selected = recs.1
1315
1316 dev_name = VRMethod('CN_DEVICE_LIST', 'GetFieldData', selected, 'NAME')
1317 dev_driver = VRMethod('CN_DEVICE_LIST', 'GetFieldData', selected, 'DRIVER')
1318 driver_short = TRANSLATE( VRParseFileName( dev_driver, 'N'))
1319 IF dev_name == '' | dev_driver == '' | driver_short == '' THEN RETURN
1320
1321 /* Shipped drivers don't include the FQ path in dev_driver so we must
1322 * resolve it first.
1323 */
1324 IF VRGet('RB_DEVICE_SHIPPED', 'Set') == 1 THEN
1325 dev_driver = GetDriverSource( driver_short )
1326 IF dev_driver == '' THEN RETURN
1327
1328 ok = InstallPrintDriver( driver_short, dev_driver, dev_name )
1329
1330 IF ok <> 0 THEN DO
1331 CALL VRMessage VRWindow(), NLSGetMessage( 168, driver_short'.'dev_name ), NLSGetMessage( 13 ), 'E'
1332 END
1333 CALL SW_DEVICE_ADD_Close
1334
1335RETURN
1336
1337/*:VRX PB_DEVICE_OTHER_Click
1338*/
1339PB_DEVICE_OTHER_Click: PROCEDURE EXPOSE globals. shipped.
1340
1341 old_path = VRGet('DDCB_DEVICE_3RDPARTY', 'UserData')
1342 new_path = VRXDirectoryDialog( VRWindow(), old_path, NLSGetMessage( 189 ))
1343 IF new_path == '' THEN RETURN
1344 IF old_path == TRANSLATE( new_path ) THEN RETURN
1345
1346 CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Value', new_path
1347 CALL SetDriverList new_path
1348
1349RETURN
1350
1351/*:VRX PB_DEVICE_REFRESH_Click
1352*/
1353PB_DEVICE_REFRESH_Click: PROCEDURE EXPOSE globals. shipped.
1354 CALL SetDriverList
1355return
1356
1357/*:VRX PB_DEVICE_REMOVE_Click
1358*/
1359PB_DEVICE_REMOVE_Click:
1360 CALL DriverDelete
1361RETURN
1362
1363/*:VRX PB_DEVICE_REMOVE_KeyPress
1364*/
1365PB_DEVICE_REMOVE_KeyPress:
1366 IF VRGet('PB_DEVICE_REMOVE', 'KeyString') == '{Tab}' THEN
1367 CALL VRMethod 'TDL_MAIN', 'SetFocus'
1368return
1369
1370/*:VRX PB_IMPORTCANCEL_Click
1371*/
1372PB_IMPORTCANCEL_Click:
1373 CALL SW_IMPORT_Close
1374return
1375
1376/*:VRX PB_IMPORTOK_Click
1377*/
1378PB_IMPORTOK_Click: PROCEDURE EXPOSE globals. new_ppd
1379
1380 IF VRGet('RB_IMPORTCUPS', 'Set') == 1 THEN DO
1381 CALL New_CUPS new_ppd
1382 CALL SW_IMPORT_Close
1383 CALL VRSet 'WN_MAIN', 'Shutdown', 1
1384 RETURN
1385 END
1386 driver = VRGet('DDCB_IMPORTDRV', 'Value')
1387 ok = ImportPPD( driver, new_ppd )
1388
1389 SELECT
1390 /* Check the return code from ImportPPD and display an appropriate message.
1391 */
1392
1393 WHEN ok == 0 THEN DO /* Success! */
1394 _message = NLSGetMessage( 238 )
1395 _mbtitle = NLSGetMessage( 16 )
1396 _mbicon = 'I'
1397 END
1398
1399 /* Note: Error codes 1 & 2 are ignored here.
1400 * 1 means the user cancelled, so no message is required.
1401 * For 2, ImportPPD itself already displayed the error message.
1402 */
1403
1404 WHEN ok == 3 THEN DO /* Invalid path specified */
1405 _message = NLSGetMessage( 222 )
1406 _mbtitle = NLSGetMessage( 13 )
1407 _mbicon = 'E'
1408 END
1409 WHEN ok == 4 THEN DO /* Failed to copy driver files */
1410 _message = NLSGetMessage( 220 )
1411 _mbtitle = NLSGetMessage( 13 )
1412 _mbicon = 'E'
1413 END
1414 WHEN ok == 5 THEN DO /* Failed to create directory */
1415 _message = NLSGetMessage( 221 )
1416 _mbtitle = NLSGetMessage( 13 )
1417 _mbicon = 'E'
1418 END
1419 WHEN ok == 6 THEN DO /* PPD import failed */
1420 _message = NLSGetMessage( 223 )
1421 _mbtitle = NLSGetMessage( 13 )
1422 _mbicon = 'E'
1423 END
1424 WHEN ok == 7 THEN DO /* Error updating PRDESC.LST */
1425 _message = NLSGetMessage( 224, globals.!prdesc )
1426 _mbtitle = NLSGetMessage( 13 )
1427 _mbicon = 'E'
1428 END
1429
1430 OTHERWISE DO
1431 _message = ''
1432 _mbtitle = ''
1433 _mbicon = 'N'
1434 END
1435 END
1436
1437 IF message <> '' THEN
1438 CALL VRMessage VRWindow(), _message, _mbtitle, _mbicon
1439
1440 CALL SW_IMPORT_Close
1441RETURN
1442
1443/*:VRX PB_MODELS_CLOSE_Click
1444*/
1445PB_MODELS_CLOSE_Click:
1446 CALL SW_MODELS_Close
1447return
1448
1449/*:VRX PB_OTHERPORT_Click
1450*/
1451PB_OTHERPORT_Click: PROCEDURE EXPOSE globals.
1452 _new_pdr = VRFileDialog('SW_PORT_ADD', NLSGetMessage( 165 ), 'O', '*.PDR')
1453 IF _new_pdr == '' THEN RETURN 0
1454
1455 ok = InstallPortDriver( _new_pdr )
1456 IF ok == 0 THEN DO
1457 _name = VRParseFileName( _new_pdr, 'N')
1458 _rec = VRMethod('CN_ADDPORT', 'AddRecord',,, _name, _new_pdr )
1459 CALL VRMethod 'CN_ADDPORT', 'SetFieldData', _rec, 'NAME', _name, 'PATH', _new_pdr
1460 END
1461 ELSE
1462 CALL VRMessage 'SW_PORT_ADD', NLSGetMessage( 166 ) || '0a0a'x || VRError(), NLSGetMessage( 13 ), 'E'
1463RETURN ok
1464
1465/*:VRX PB_PORT_ADD_Click
1466*/
1467PB_PORT_ADD_Click:
1468 CALL PortAdd
1469RETURN
1470
1471/*:VRX PB_PORT_DELETE_Click
1472*/
1473PB_PORT_DELETE_Click:
1474 CALL PortDelete
1475return
1476
1477/*:VRX PB_PORT_EDIT_Click
1478*/
1479PB_PORT_EDIT_Click:
1480 CALL PortProperties
1481return
1482
1483/*:VRX PB_PORT_EDIT_KeyPress
1484*/
1485PB_PORT_EDIT_KeyPress:
1486 IF VRGet('PB_PORT_EDIT', 'KeyString') == '{Tab}' THEN
1487 CALL VRMethod 'TDL_MAIN', 'SetFocus'
1488return
1489
1490/*:VRX PB_PPCLOSE_Click
1491*/
1492PB_PPCLOSE_Click:
1493 CALL SW_PRINTERPAKS_Close
1494return
1495
1496/*:VRX PB_PPUPDATE_Click
1497*/
1498PB_PPUPDATE_Click: PROCEDURE EXPOSE globals.
1499
1500 /* Let the user select the driver .DRV to install.
1501 */
1502 new_drv = VRFileDialog( VRWindow(), NLSGetMessage( 182 ), 'O', '*.DRV')
1503 IF new_drv == '' THEN RETURN 0
1504
1505 drv_stem = TRANSLATE( VRParseFileName( new_drv, 'N'))
1506 drv_name = TRANSLATE( VRParseFileName( new_drv, 'NE'))
1507 drv_source = TRANSLATE( VRParseFileName( new_drv, 'DP'))
1508
1509 /* See if this is the same as an existing driver (compared by filename).
1510 */
1511 existing = 0
1512 skip_repo = 0
1513 ok = VRMethod('CN_PRINTERPAKS', 'GetRecordList', 'All', 'recs.')
1514 DO i = 1 TO recs.0
1515 _ppname = VRMethod('CN_PRINTERPAKS', 'GetFieldData', recs.i, globals.!hcfPaks.!name )
1516 IF TRANSLATE( _ppname ) == TRANSLATE( new_name ) THEN DO
1517 existing = 1
1518 _pppath = VRMethod('CN_PRINTERPAKS', 'GetFieldData', recs.i, globals.!hcfPaks.!path )
1519 LEAVE
1520 END
1521 END
1522
1523 PARSE UPPER VALUE VRGetIni('PrinterManager', 'ThirdParty', 'USER') WITH known_3p '00'x .
1524 IF known_3p == '' THEN
1525 known_3p = 'ECUPS ECUPS-HP GUTENPRT PSPRINT'
1526
1527 IF existing THEN DO
1528 drv_target = TRANSLATE( _pppath )
1529 IF drv_source == drv_target ) THEN DO
1530 CALL VRMessage VRWindow(), NLSGetMessage( 183 ), NLSGetMessage( 13 ), 'E'
1531 RETURN 1
1532 END
1533 IF CheckWritablePath( drv_target ) <> 0 THEN DO
1534 existing = 0
1535 _msg.1 = NLSGetMessage( 185, drv_target )
1536 _msg.2 = ''
1537 _msg.3 = NLSGetMessage( 186, drv_name )
1538 _msg.0 = 3
1539 _btns.1 = NLSGetMessage( 2 )
1540 _btns.2 = NLSGetMessage( 3 )
1541 _btns.0 = 2
1542 _select = VRMessageStem( VRWindow(), '_msg.', NLSGetMessage( 184 ),
1543 'I', '_btns.', 1, 2 )
1544 IF _select == 2 THEN skip_repo = 1
1545 END
1546 END
1547
1548 IF \skip_repo THEN DO
1549 IF \existing THEN DO
1550 /* If we already know about this driver, try and get its saved location. */
1551 drv_target = ''
1552 IF WORDPOS( drv_stem, known_3p ) > 0 THEN
1553 PARSE UPPER VALUE VRGetIni('PM_INSTALL', drv_stem'_DIR', 'USER') WITH drv_target '00'x .
1554 ELSE DO
1555 known_3p = known_3p drv_stem
1556 CALL VRSetIni 'PrinterManager', 'ThirdParty', known_3p || '00'x, 'USER'
1557 END
1558 IF drv_target == '' THEN DO
1559 drv_target = globals.!repository'\'drv_stem
1560 _btns.1 = NLSGetMessage( 2 )
1561 _btns.2 = NLSGetMessage( 3 )
1562 _btns.3 = NLSGetMessage( 188 )
1563 _btns.0 = 3
1564 DO UNTIL _select <> 3
1565 _select = VRPrompt( VRWindow(), NLSGetMessage( 187, drv_name ),,
1566 'drv_target', NLSGetMessage( 189 ), '_btns.', 1, 2 )
1567 IF _select == 3 THEN
1568 drv_target = VRXDirectoryDialog( VRWindow(), drv_target, NLSGetMessage( 189 ))
1569 END
1570 IF _select == 2 THEN
1571 skip_repo = 1
1572 ELSE
1573 CALL VRSetIni 'PM_INSTALL', drv_stem'_DIR', TRANSLATE( drv_target ) || '00'x, 'USER'
1574 END
1575 END
1576
1577 IF \skip_repo THEN DO
1578 IF VRFileExists( drv_target ) THEN DO
1579 /* Clear any RHS attributes on existing files */
1580 CALL SysFileTree drv_target'\*', '_ignore.',,, '**---'
1581 CALL PRReplaceModule drv_target'\'drv_name, '', ''
1582 END
1583 ELSE
1584 /* Create the target directory if necessary */
1585 ok = VRMkDir( drv_target )
1586
1587 ok = CopyPrinterPak( new_drv, drv_target )
1588 IF existing & ok == 1 THEN DO
1589 CALL UpdatePrDesc new_drv, drv_target'\'new_drv
1590 END
1591 IF ok == 0 THEN DO
1592 CALL VRMessage VRWindow(), NLSGetMessage( 220 ), NLSGetMessage( 13 ), 'E'
1593 RETURN 2
1594 END
1595 ELSE
1596 CALL VRMessage VRWindow(), NLSGetMessage( 193 ), NLSGetMessage( 16 ), 'I'
1597 END
1598 END
1599
1600 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', drv_stem, 'USER') WITH drv_used '00'x .
1601 IF ( drv_used <> '') & VRFileExists( drv_used ) THEN DO
1602 /* Driver is currently installed; ask if the user wants to update the
1603 * in-use copy as well.
1604 */
1605 _btns.1 = NLSGetMessage( 14 )
1606 _btns.2 = NLSGetMessage( 15 )
1607 _btns.0 = 2
1608 _select = VRMessage( VRWindow(), NLSGetMessage( 190 ), NLSGetMessage( 191 ), 'Q', '_btns.', 1, 2 )
1609 IF _select == 1 THEN DO
1610 CALL PRSetFileAttr drv_used , 'rsh'
1611 CALL PRReplaceModule drv_used, '', ''
1612 used_target = VRParseFileName( drv_used, 'DP')
1613 ok = CopyPrinterPak( new_drv, used_target )
1614 IF ok == 0 THEN DO
1615 CALL VRMessage VRWindow(), NLSGetMessage( 220 ), NLSGetMessage( 13 ), 'E'
1616 RETURN 2
1617 END
1618 ELSE
1619 CALL VRMessage VRWindow(), NLSGetMessage( 192 ), NLSGetMessage( 16 ), 'I'
1620 END
1621 END
1622
1623 /* Refresh the list */
1624 CALL GetPrinterPaks
1625RETURN 0
1626
1627/*:VRX PB_PRINTER_ADD_Click
1628*/
1629PB_PRINTER_ADD_Click:
1630 CALL PrinterWizard
1631RETURN
1632
1633/*:VRX PB_PRINTER_DEL_Click
1634*/
1635PB_PRINTER_DEL_Click:
1636 CALL PrinterDelete
1637return
1638
1639/*:VRX PB_PRINTER_EDIT_Click
1640*/
1641PB_PRINTER_EDIT_Click:
1642 CALL PrinterProperties
1643RETURN
1644
1645/*:VRX PB_PRINTER_EDIT_KeyPress
1646*/
1647PB_PRINTER_EDIT_KeyPress:
1648 IF VRGet('PB_PRINTER_EDIT', 'KeyString') == '{Tab}' THEN
1649 CALL VRMethod 'TDL_MAIN', 'SetFocus'
1650return
1651
1652/*:VRX PB_PRINTER_OPEN_Click
1653*/
1654PB_PRINTER_OPEN_Click:
1655 CALL PrinterOpen
1656RETURN
1657
1658/*:VRX PB_WIZARD_CANCEL_Click
1659*/
1660PB_WIZARD_CANCEL_Click:
1661
1662 CALL SW_WIZARD_Close
1663
1664return
1665
1666/*:VRX PB_WIZARD_NEXT_Click
1667*/
1668PB_WIZARD_NEXT_Click: PROCEDURE EXPOSE globals.
1669 SELECT
1670 WHEN VRGet('RB_CREATE_CUPS', 'Set') == 1 THEN DO
1671 globals.!create_mode = 'C'
1672 CALL New_CUPS
1673 END
1674 WHEN ( VRGet('RB_CREATE_LEGACY', 'Set') == 1 ) & ( VRGet('RB_CREATE_STANDARD', 'Set') == 1 ) THEN DO
1675 globals.!create_mode = 'S'
1676 CALL New_Standard
1677 END
1678 WHEN ( VRGet('RB_CREATE_LEGACY', 'Set') == 1 ) & ( VRGet('RB_CREATE_LAN', 'Set') == 1 ) THEN DO
1679 globals.!create_mode = 'L'
1680 CALL New_LAN
1681 END
1682 OTHERWISE DO
1683 globals.!create_mode = ''
1684 globals.!wizard = 0
1685 END
1686 END
1687 CALL SW_WIZARD_Fini
1688
1689RETURN
1690
1691/*:VRX PortAdd
1692*/
1693PortAdd: PROCEDURE EXPOSE globals.
1694
1695 updated = 0
1696 CALL VRLoadSecondary 'SW_PORT_ADD', 'W'
1697 IF updated == 1 THEN
1698 CALL RefreshPorts
1699
1700RETURN
1701
1702/*:VRX PortDelete
1703*/
1704PortDelete: PROCEDURE EXPOSE globals.
1705 PARSE ARG record
1706 IF record == '' THEN DO
1707 ok = VRMethod( "CN_PORTS", "GetRecordList", "Selected", "recs." )
1708 IF ok == 0 | recs.0 < 1 THEN RETURN
1709 record = recs.1
1710 END
1711 CALL VRMethod 'CN_PORTS', 'SetRecordAttr', record, 'Source', 0
1712
1713 _name = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!name )
1714
1715 printers.0 = 0
1716 CALL RPUEnumPrinters 'printers.'
1717 DO i = 1 TO printers.0
1718 CALL RPUPrinterQuery printers.i.!name, 'details.'
1719 IF _name == details.!port THEN DO
1720 _title = TRANSLATE( printers.i.!description, ' ', '0d0a'x)
1721 CALL VRMessage 'WN_MAIN', NLSGetMessage( 206, _name, _title ), NLSGetMessage( 207 ), 'W'
1722 RETURN
1723 END
1724 END
1725
1726 IF _name == '' THEN RETURN
1727 _btns.0 = 2
1728 _btns.1 = NLSGetMessage( 14 )
1729 _btns.2 = NLSGetMessage( 15 )
1730 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 202, _name ), NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
1731 IF _confirm == 1 THEN DO
1732 success = RPUPortDelete( _name )
1733 IF success == 1 THEN CALL RefreshPorts
1734 END
1735
1736RETURN
1737
1738/*:VRX PortProperties
1739*/
1740PortProperties: PROCEDURE EXPOSE globals.
1741 PARSE ARG record
1742 IF record == '' THEN DO
1743 ok = VRMethod( "CN_PORTS", "GetRecordList", "Selected", "recs." )
1744 IF ok == 0 | recs.0 < 1 THEN RETURN
1745 record = recs.1
1746 END
1747
1748 _name = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!name )
1749 _module = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!driver )
1750 IF _module == '' THEN DO
1751 CALL VRMessage VRWindow(), NLSGetMessage( 211, _name ), NLSGetMessage( 210 ), 'N'
1752 RETURN
1753 END
1754
1755 CALL RPUPortDialog _module, _name
1756
1757 CALL VRMethod 'CN_PORTS', 'SetRecordAttr', record, 'Source', 0
1758RETURN
1759
1760/*:VRX PrinterDelete
1761*/
1762PrinterDelete: PROCEDURE EXPOSE globals.
1763 PARSE ARG record
1764 IF record == '' THEN DO
1765 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1766 IF ok == 0 | recs.0 < 1 THEN RETURN 0
1767 record = recs.1
1768 END
1769 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1770
1771 success = 0
1772 _title = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!title )
1773 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1774 _port = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!port )
1775
1776 _btns.0 = 2
1777 _btns.1 = NLSGetMessage( 14 )
1778 _btns.2 = NLSGetMessage( 15 )
1779 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 201, _title ), NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
1780 IF _confirm == 1 THEN DO
1781 success = RPUPrinterDelete( _queue )
1782 CALL RPUPortInfo _port, 'port.'
1783 IF port.!driver == 'CUPS' THEN DO
1784 /* If this corresponds to a locally-defined CUPS queue, offer to
1785 * to delete that as well.
1786 */
1787 cups_prnt = RPUPortQuery('CUPS', _port )
1788 IF cups_prnt <> '' & ( LENGTH( cups_prnt ) == 130 ) THEN DO
1789 PARSE VAR cups_prnt 1 _cups_host 66 _cups_queue
1790 PARSE VAR _cups_host cups_host '00'x .
1791 PARSE VAR _cups_queue cups_queue '00'x .
1792 IF ( TRANSLATE( cups_host ) == 'LOCALHOST') | cups_host = '127.0.0.1' THEN DO
1793 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 204, _title, cups_queue, _port ),,
1794 NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
1795 IF _confirm == 1 THEN DO
1796 success = CupsDeletePrinter( cups_host, cups_queue )
1797 IF success == 0 THEN DO
1798 CALL RPUPortDelete _port
1799 CALL RefreshPorts
1800 END
1801 ELSE
1802 CALL VRMessage 'WN_MAIN', NLSGetMessage( 251, cups_queue, success ), NLSGetMessage( 18 ), 'E'
1803 END
1804 END
1805 END
1806 END
1807 END
1808
1809 CALL RefreshPrinters
1810
1811RETURN success
1812
1813/*:VRX PrinterHold
1814*/
1815PrinterHold: PROCEDURE EXPOSE globals.
1816 PARSE ARG record
1817 IF record == '' THEN DO
1818 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1819 IF ok == 0 | recs.0 < 1 THEN RETURN
1820 record = recs.1
1821 END
1822 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1823 _flags = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!flags )
1824 _p = POS('P', _flags )
1825 IF _p > 0 THEN DO
1826 ok = RPUQueueHold( _queue, 'N')
1827 IF ok == 1 THEN DO
1828 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 0
1829 _flags = DELSTR( _flags, _p, 1 )
1830 CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1831 END
1832 END
1833 ELSE DO
1834 ok = RPUQueueHold( _queue, 'Y')
1835 IF ok == 1 THEN DO
1836 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 1
1837 _flags = _flags'P'
1838 CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1839 END
1840 END
1841
1842 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1843RETURN
1844
1845/*:VRX PrinterOpen
1846*/
1847PrinterOpen: PROCEDURE EXPOSE globals.
1848 PARSE ARG record
1849 IF record == '' THEN DO
1850 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1851 IF ok == 0 | recs.0 < 1 THEN RETURN
1852 record = recs.1
1853 END
1854
1855 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1856 IF _queue <> '' THEN
1857 CALL RPUOpenView _queue, 'O'
1858
1859 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1860RETURN
1861
1862/*:VRX PrinterProperties
1863*/
1864PrinterProperties: PROCEDURE EXPOSE globals.
1865 PARSE ARG record
1866 IF record == '' THEN DO
1867 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1868 IF ok == 0 | recs.0 < 1 THEN RETURN
1869 record = recs.1
1870 END
1871
1872 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1873 IF _queue <> '' THEN
1874 CALL RPUOpenView _queue, 'S'
1875
1876 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1877RETURN
1878
1879/*:VRX PrinterSetDefault
1880*/
1881PrinterSetDefault: PROCEDURE EXPOSE globals.
1882 PARSE ARG record
1883 IF record == '' THEN DO
1884 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1885 IF ok == 0 | recs.0 < 1 THEN RETURN 0
1886 record = recs.1
1887 END
1888 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1889 ok = RPUQueueDefault( _queue )
1890
1891/*** Would also need to remove 'D' flag from previous default printer. Simpler
1892 *** just to call RefreshPrinters (below) instead.
1893 *
1894 * IF ok == 1 THEN DO
1895 * CALL VRSet 'MI_PRINTER_DEFAULT', 'Checked', 1
1896 * _flags = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!flags )
1897 * IF POS( _flags, 'D') == 0 THEN DO
1898 * _flags = 'D'_flags
1899 * CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1900 * END
1901 * END
1902 */
1903
1904 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1905 CALL RefreshPrinters
1906RETURN ok
1907
1908/*:VRX PrinterWizard
1909*/
1910PrinterWizard: PROCEDURE EXPOSE globals.
1911 CALL VRLoadSecondary 'SW_WIZARD', 'N'
1912RETURN
1913
1914/*:VRX Quit
1915*/
1916Quit:
1917 window = VRWindow()
1918 call VRSet window, "Shutdown", 1
1919 drop window
1920return
1921
1922/*:VRX RB_ADVANCED_Click
1923*/
1924RB_ADVANCED_Click: PROCEDURE
1925 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 0
1926 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 0
1927RETURN
1928
1929/*:VRX RB_CREATE_CUPS_Click
1930*/
1931RB_CREATE_CUPS_Click: PROCEDURE
1932 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 0
1933 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 0
1934RETURN
1935
1936/*:VRX RB_CREATE_LEGACY_Click
1937*/
1938RB_CREATE_LEGACY_Click: PROCEDURE
1939 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 1
1940 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 1
1941RETURN
1942
1943/*:VRX RB_DEVICE_3RDPARTY_Click
1944*/
1945RB_DEVICE_3RDPARTY_Click: PROCEDURE EXPOSE globals. shipped.
1946 CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Enabled', 1
1947 CALL VRSet 'PB_DEVICE_OTHER', 'Enabled', 1
1948 CALL VRSet 'PB_DEVICE_REFRESH', 'Enabled', 1
1949 CALL SetDriverList
1950RETURN
1951
1952/*:VRX RB_DEVICE_SHIPPED_Click
1953*/
1954RB_DEVICE_SHIPPED_Click: PROCEDURE EXPOSE globals. shipped.
1955 CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Enabled', 0
1956 CALL VRSet 'PB_DEVICE_OTHER', 'Enabled', 0
1957 CALL VRSet 'PB_DEVICE_REFRESH', 'Enabled', 0
1958 CALL SetDriverList
1959RETURN
1960
1961
1962/*:VRX RefreshDevices
1963*/
1964RefreshDevices: PROCEDURE EXPOSE globals.
1965
1966 ok = RPUEnumDrivers('drivers.')
1967 IF rc <> 0 THEN DO
1968 CALL VRSet 'CN_DEVICES', 'Painting', 0
1969 CALL VRMethod 'CN_DEVICES', 'RemoveRecord', 'All'
1970 DO i = 1 TO drivers.0
1971 PARSE VAR drivers.i _pdrv'.'_model
1972 IF _pdrv == 'IBMNULL' & _model == '' THEN
1973 _model = NLSGetMessage( 106 )
1974 ELSE IF _model == '' THEN
1975 _model = '-'
1976 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _pdrv, 'USER') WITH _drvspec '00'x .
1977 driverinfo.i = ';'drivers.i';'_drvspec';;;'globals.!hcfDevices.!icon';'_drvspec';'globals.!hcfDevices.!model';'_model';'globals.!hcfDevices.!driver';'_pdrv
1978 END
1979 driverinfo.0 = drivers.0
1980 ok = VRMethod( "CN_DEVICES", "AddRecordList",,, "driverinfo.")
1981 DROP drivers.
1982 DROP driverinfo.
1983 CALL VRSet 'CN_DEVICES', 'Painting', 1
1984 END
1985
1986RETURN
1987
1988/*:VRX RefreshPorts
1989*/
1990RefreshPorts: PROCEDURE EXPOSE globals.
1991
1992 ok = RPUEnumPorts('ports.')
1993 IF rc <> 0 THEN DO
1994 CALL VRSet 'CN_PORTS', 'Painting', 0
1995 CALL VRMethod 'CN_PORTS', 'RemoveRecord', 'All'
1996 DO i = 1 TO ports.0
1997 PARSE VAR ports.i _name _driver _path
1998 SELECT
1999 WHEN _name == 'FILE' THEN _icon = '$24,PMWP'
2000 WHEN _driver == 'USBPRT' THEN _icon = '$7001,'_path
2001 WHEN _driver == 'SERIAL' THEN _icon = '$7001,'_path
2002 WHEN _driver == 'PARALLEL' THEN _icon = '$7001,'_path
2003 WHEN _driver == 'SLPR' THEN _icon = '$7001,'_path
2004 WHEN _driver == 'LPRPDRVR' THEN _icon = '$256,'_path
2005/*
2006 WHEN _driver == 'USBPRT' THEN _icon = '$7'
2007 WHEN _driver == 'SMB' THEN _icon = '$6'
2008 WHEN _driver == 'SLPR' THEN _icon = '$6'
2009 WHEN _driver == 'LPR32' THEN _icon = '$6'
2010 WHEN _driver == 'LPRPDRVR' THEN _icon = '$6'
2011 WHEN _driver == 'CUPS' THEN _icon = '$10'
2012 OTHERWISE _icon = '$5'
2013*/
2014 OTHERWISE _icon = _path
2015 END
2016
2017 portinfo.i = ';'_name';'_icon';;;'globals.!hcfPorts.!icon';'_icon';'globals.!hcfPorts.!name';'_name';'globals.!hcfPorts.!driver';'_driver';'
2018 END
2019 portinfo.0 = ports.0
2020 ok = VRMethod( "CN_PORTS", "AddRecordList",,, "portinfo.")
2021 DROP ports.
2022 DROP portinfo.
2023 CALL VRSet 'CN_PORTS', 'Painting', 1
2024 END
2025
2026RETURN
2027
2028/*:VRX RefreshPrinters
2029*/
2030RefreshPrinters: PROCEDURE EXPOSE globals.
2031 ok = RPUEnumPrinters('printers.')
2032 IF ok <> 0 THEN DO
2033 CALL VRSet 'CN_PRINTERS', 'Painting', 0
2034 CALL VRMethod 'CN_PRINTERS', 'RemoveRecord', 'All'
2035
2036 DO i = 1 TO printers.0
2037 _title = TRANSLATE( printers.i.!description, ' ', '0d0a'x)
2038 ok = RPUPrinterQuery( printers.i.!name, 'details.')
2039 IF ok == 0 THEN DO
2040 _driver = '?'
2041 _port = '?'
2042 END
2043 ELSE DO
2044 PARSE VAR details.!drivers _driver ',' .
2045 _port = details.!port
2046 END
2047 IF printers.i.!host <> '' THEN
2048 _icon = '$65,PMWP'
2049 ELSE IF _driver <> '?' THEN DO
2050 PARSE VAR _driver _pdrv'.'_model
2051 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _pdrv, 'USER') WITH _icon '00'x .
2052 END
2053 ELSE _icon = '$2'
2054
2055 printerinfo.i = ';'printers.i.!description';'_icon';;;' ||,
2056 globals.!hcfPrinters.!title';'_title';' ||,
2057 globals.!hcfPrinters.!icon';'_icon';' ||,
2058 globals.!hcfPrinters.!name';'printers.i.!name';' ||,
2059 globals.!hcfPrinters.!queue';'printers.i.!queue';' ||,
2060 globals.!hcfPrinters.!host';'printers.i.!host';' ||,
2061 globals.!hcfPrinters.!port';'_port';' ||,
2062 globals.!hcfPrinters.!driver';'_driver';' ||,
2063 globals.!hcfPrinters.!flags';'printers.i.!flags';' ||,
2064 globals.!hcfPrinters.!handle';'printers.i.!handle';'
2065 END
2066 printerinfo.0 = printers.0
2067 ok = VRMethod( "CN_PRINTERS", "AddRecordList",,, "printerinfo.")
2068 DROP printers.
2069 DROP printerinfo.
2070 DROP details.
2071
2072 CALL VRSet 'CN_PRINTERS', 'Painting', 1
2073 END
2074
2075RETURN
2076
2077/*:VRX SetDriverList
2078*/
2079SetDriverList: PROCEDURE EXPOSE globals. shipped.
2080 ARG driver_path
2081
2082 CALL VRSet VRWindow(), 'Pointer', 'WAIT'
2083 CALL VRMethod 'CN_DEVICE_LIST', 'RemoveRecord', 'All'
2084
2085 IF VRGet('RB_DEVICE_SHIPPED', 'Set') == 1 THEN DO
2086 CALL VRMethod 'CN_DEVICE_LIST', 'AddRecordList',,, 'shipped.'
2087 END
2088 ELSE DO
2089 IF driver_path == '' THEN
2090 driver_path = TRANSLATE( STRIP( VRGet('DDCB_DEVICE_3RDPARTY', 'Value')))
2091 IF driver_path <> '' THEN DO
2092 drivers.0 = 0
2093 _total = 0
2094 CALL SysFileTree driver_path'\*.DRV', 'drivers.', 'FO'
2095 DO i = 1 TO drivers.0
2096 list.0 = 0
2097 IF SysGetEA( drivers.i, '.EXPAND', 'eaval') == 0 THEN DO
2098 PARSE VAR eaval 3 ealen 5 models
2099 offs = 1
2100 datalen = C2D( REVERSE( ealen ))
2101 DO WHILE offs <= datalen
2102 start = SUBSTR( models, offs )
2103 inc = POS('00'x, start )
2104 IF inc > 1 THEN DO
2105 current_name = STRIP( SUBSTR( start, 1, inc-1 ))
2106 _total = _total + 1
2107 list._total = ';'_desc';#2;;;NAME;'current_name';DRIVER;'|| TRANSLATE( drivers.i ) ||';'
2108 END
2109 offs = offs + inc
2110 END
2111 END
2112 END
2113
2114 list.0 = _total
2115 CALL VRSortStem 'list.'
2116 CALL VRMethod 'CN_DEVICE_LIST', 'AddRecordList',,, 'list.'
2117 CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'UserData', driver_path
2118 END
2119 END
2120
2121 CALL VRSet VRWindow(), 'Pointer', '<default>'
2122
2123RETURN
2124
2125/*:VRX SetLanguage
2126*/
2127SetLanguage: PROCEDURE EXPOSE globals.
2128 PARSE ARG locale
2129
2130 /*
2131 * This function locates the proper language files, and uses the message
2132 * file to sets all UI text. If the language could not be determined, we
2133 * default to English.
2134 */
2135 execPath = VRGet('Application', 'Program')
2136 execDir = VRParseFileName( execPath, 'DP')
2137
2138 /*
2139 * First, figure out what language/message file to use.
2140 */
2141 IF locale <> '' THEN
2142 syslanguage = locale
2143 ELSE
2144 syslanguage = VALUE('LANG',,'OS2ENVIRONMENT')
2145
2146 SELECT
2147 WHEN TRANSLATE( syslanguage ) == 'ZH_TW' THEN nlv = 'tw'
2148 WHEN TRANSLATE( syslanguage ) == 'ZH_CN' THEN nlv = 'cx'
2149 OTHERWISE PARSE VAR syslanguage nlv '_' .
2150 END
2151 nlvfile = globals.!nlsname || nlv
2152 IF ( STREAM( execDir'\'nlvfile'.msg', 'C', 'QUERY EXISTS') \= '') | ( SysSearchPath('DPATH', nlvfile'.msg') \= '') THEN DO
2153 globals.!messages = nlvfile'.msg'
2154 helpfile = nlvfile'.hlp'
2155 CALL VRSet 'WN_MAIN', 'HelpFile', helpfile
2156 END
2157 ELSE DO
2158 globals.!messages = globals.!nlsname || 'en.msg'
2159 helpfile = globals.!nlsname || 'en.hlp'
2160 CALL VRSet 'WN_MAIN', 'HelpFile', helpfile
2161 END
2162
2163 /*
2164 * If the message file is missing or unreadable, display an error and then exit.
2165 */
2166 IF NLSGetMessage( 1 ) == '' THEN DO
2167 CALL VRMessage VRWindow(), 'Language file' TRANSLATE( globals.!messages ) 'could not be loaded.', 'Cannot Continue', 'E'
2168 RETURN 0
2169 END
2170
2171 /*
2172 * Now set the captions for the UI controls on the main window, according
2173 * to the specified language.
2174 */
2175 CALL NLSSetText 'WN_MAIN', 'Caption', 1
2176 CALL VRMethod 'TDL_MAIN', 'SetTabText', 1, NLSGetMessage( 100 )
2177 CALL VRMethod 'TDL_MAIN', 'SetTabText', 2, NLSGetMessage( 101 )
2178 CALL VRMethod 'TDL_MAIN', 'SetTabText', 3, NLSGetMessage( 102 )
2179
2180 CALL NLSSetText 'MN_PROGRAM', 'Caption', 20
2181 CALL NLSSetText 'MI_MANAGE', 'Caption', 21
2182 CALL NLSSetText 'MI_IMPORT', 'Caption', 22
2183 CALL NLSSetText 'MI_QUIT', 'Caption', 29
2184
2185 CALL NLSSetText 'MN_PRINTER', 'Caption', 30
2186 CALL NLSSetText 'MI_PRINTER_OPEN', 'Caption', 31
2187 CALL NLSSetText 'MI_PRINTER_PROPS', 'Caption', 32
2188 CALL NLSSetText 'MI_PRINTER_HOLD', 'Caption', 33
2189 CALL NLSSetText 'MI_PRINTER_DEFAULT', 'Caption', 34
2190 CALL NLSSetText 'MI_PRINTER_CREATE', 'Caption', 35
2191 CALL NLSSetText 'MI_PRINTER_DELETE', 'Caption', 36
2192
2193 CALL NLSSetText 'MN_PORT', 'Caption', 40
2194 CALL NLSSetText 'MI_PORT_CREATE', 'Caption', 41
2195 CALL NLSSetText 'MI_PORT_DELETE', 'Caption', 42
2196 CALL NLSSetText 'MI_PORT_PROPS', 'Caption', 43
2197
2198 CALL NLSSetText 'MN_DRIVERS', 'Caption', 50
2199 CALL NLSSetText 'MI_DRIVERS_INSTALL', 'Caption', 51
2200 CALL NLSSetText 'MI_DRIVERS_REMOVE', 'Caption', 52
2201
2202 CALL NLSSetText 'MN_VIEW', 'Caption', 60
2203 CALL NLSSetText 'MI_DETAILVIEW', 'Caption', 61
2204 CALL NLSSetText 'MI_ICONVIEW', 'Caption', 62
2205 CALL NLSSetText 'MI_REFRESH', 'Caption', 63
2206
2207 CALL NLSSetText 'MI_CONTEXT_INSTALL', 'Caption', 8
2208 CALL NLSSetText 'MI_CONTEXT_DETAIL', 'Caption', 61
2209 CALL NLSSetText 'MI_CONTEXT_ICON', 'Caption', 62
2210 CALL NLSSetText 'MI_CONTEXT_REFRESH', 'Caption', 63
2211
2212 CALL NLSSetText 'MN_PRINTERPAK', 'Caption', 70
2213 CALL NLSSetText 'MI_PPAK_MODELS', 'Caption', 71
2214 CALL NLSSetText 'MI_PPAK_COPY', 'Caption', 72
2215
2216 CALL NLSSetText 'MN_HELP', 'Caption', 80
2217 CALL NLSSetText 'MI_HELP_GENERAL', 'Caption', 81
2218 CALL NLSSetText 'MI_ABOUT', 'Caption', 89
2219
2220 CALL VRMethod 'WN_MAIN', 'InstallAccelerators'
2221
2222RETURN 1
2223
2224/*:VRX SW_ABOUT_Close
2225*/
2226SW_ABOUT_Close:
2227 call SW_ABOUT_Fini
2228return
2229
2230/*:VRX SW_ABOUT_Create
2231*/
2232SW_ABOUT_Create:
2233 call SW_ABOUT_Init
2234return
2235
2236/*:VRX SW_ABOUT_Fini
2237*/
2238SW_ABOUT_Fini:
2239 window = VRInfo( "Window" )
2240 call VRDestroy window
2241 drop window
2242return
2243/*:VRX SW_ABOUT_Init
2244*/
2245SW_ABOUT_Init: PROCEDURE EXPOSE globals.
2246
2247 IF globals.!is_ecs == 1 THEN
2248 _platform = 'eComStation'
2249 ELSE
2250 _platform = 'PM'
2251
2252 CALL NLSSetText 'SW_ABOUT', 'Caption', 130
2253 CALL NLSSetText 'DT_PRODUCT', 'Caption', 131, _platform
2254 CALL NLSSetText 'DT_VERSION', 'Caption', 132, globals.!version
2255 CALL NLSSetText 'DT_COPYRIGHT', 'Caption', 133, globals.!copyright
2256 CALL NLSSetText 'PB_ABOUT_OK', 'Caption', 2
2257
2258 PARSE VERSION _rexxver
2259 PARSE VALUE VRVersion('VROBJ.DLL') WITH _vrver .
2260 PARSE VALUE RPUVersion() WITH _rpuver .
2261 PARSE VALUE VRXVersion() WITH _vrxver .
2262 _pr1ver = PRVersion()
2263 _wptver = WPToolsVersion()
2264 _bullet = NLSGetMessage( 135 )
2265 CALL VRSet 'MLE_LICENSES', 'Value', NLSGetMessage( 134, _rexxver ) || '0a'x ,
2266 _bullet 'IBM REXXUTIL' SysUtilVersion() || '0a'x ,
2267 _bullet 'VX-REXX VROBJ' _vrver || '0a'x ,
2268 _bullet 'VX-REXX Extras (VROBJEX)' _vrxver || '0a'x ,
2269 _bullet 'RXPRTUTL' _rpuver || '0a'x ,
2270 _bullet 'WPTOOLS' _wptver || '0a'x ,
2271 _bullet _pr1ver || '0a'x||' ----- '||'0a'x || ,
2272 NLSGetMessage( 137 ) || '0a'x' ----- '||'0a'x || ,
2273 NLSGetMessage( 138 )
2274
2275 window = VRInfo( "Object" )
2276 if( \VRIsChildOf( window, "Notebook" ) ) then do
2277 call VRMethod window, "CenterWindow"
2278 call VRSet window, "Visible", 1
2279 call VRMethod window, "Activate"
2280 end
2281 drop window
2282return
2283
2284/*:VRX SW_DEVICE_ADD_Close
2285*/
2286SW_DEVICE_ADD_Close:
2287 call SW_DEVICE_ADD_Fini
2288return
2289
2290/*:VRX SW_DEVICE_ADD_Create
2291*/
2292SW_DEVICE_ADD_Create:
2293 call SW_DEVICE_ADD_Init
2294return
2295
2296/*:VRX SW_DEVICE_ADD_Fini
2297*/
2298SW_DEVICE_ADD_Fini:
2299 window = VRInfo( "Window" )
2300 call VRDestroy window
2301 drop window
2302return
2303/*:VRX SW_DEVICE_ADD_Init
2304*/
2305SW_DEVICE_ADD_Init: PROCEDURE EXPOSE globals. shipped.
2306
2307 fld_name = VRMethod('CN_DEVICE_LIST', 'AddField', 'String', NLSGetMessage( 265 ), 'NAME')
2308 fld_driver = VRMethod('CN_DEVICE_LIST', 'AddField', 'String', NLSGetMessage( 266 ), 'DRIVER')
2309
2310 IF globals.!is_ecs == 1 THEN
2311 _platform = 'eComStation'
2312 ELSE
2313 _platform = 'OS/2'
2314 CALL NLSSetText 'SW_DEVICE_ADD', 'Caption', 260
2315 CALL NLSSetText 'RB_DEVICE_SHIPPED', 'Caption', 261, _platform
2316 CALL NLSSetText 'RB_DEVICE_3RDPARTY', 'Caption', 262, _platform
2317 CALL NLSSetText 'PB_DEVICE_OTHER', 'Caption', 188
2318 CALL NLSSetText 'PB_DEVICE_REFRESH', 'Caption', 63
2319 CALL NLSSetText 'PB_DEVICE_INSTALL', 'Caption', 8
2320 CALL NLSSetText 'PB_DEVICE_CANCEL', 'Caption', 3
2321
2322 window = VRInfo( "Object" )
2323 CALL VRSet window, 'Pointer', 'WAIT'
2324
2325 extras_num = 0
2326 PARSE UPPER VALUE VRGetIni('PrinterManager', 'LastDriverPath', 'USER') WITH last_path '00'x .
2327 IF last_path <> '' THEN DO
2328 extras_num = extras_num + 1
2329 extras_path.extras_num = last_path
2330 END
2331 PARSE UPPER VALUE VRGetIni('PrinterManager', 'ThirdParty', 'USER') WITH known_3p '00'x .
2332 IF known_3p == '' THEN known_3p = 'ECUPS ECUPS-HP GUTENPRT PSPRINT'
2333 DO i = 1 TO WORDS( known_3p )
2334 _basename = WORD( known_3p, i )
2335 _ppdriver = _basename'.DRV'
2336 _ppini = VRGetIni('PM_INSTALL', _basename'_DIR', 'USER')
2337 IF _ppini == '' THEN ITERATE
2338 PARSE VAR _ppini _pppath '00'x .
2339 IF VRFileExists( _pppath'\'_ppdriver ) THEN DO
2340 extras_num = extras_num + 1
2341 extras_name.extras_num = _ppdriver
2342 extras_path.extras_num = _pppath
2343 END
2344 END
2345 extras_name.0 = extras_num
2346 extras_path.0 = extras_num
2347 CALL VRMethod 'DDCB_DEVICE_3RDPARTY', 'AddStringList', 'extras_path.'
2348 IF extras_num > 0 THEN CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Selected', 1
2349
2350 if( \VRIsChildOf( window, "Notebook" ) ) then do
2351 call VRMethod window, "CenterWindow"
2352 call VRSet window, "Visible", 1
2353 call VRMethod window, "Activate"
2354 end
2355
2356 IF GetShippedDrivers() > 0 THEN DO
2357/* CALL VRMethod 'CN_DEVICE_LIST', 'AddRecordList',,, 'shipped.' */
2358 END
2359
2360 CALL VRSet window, 'Pointer', '<default>'
2361 drop window
2362
2363RETURN
2364
2365/*:VRX SW_DEVICES_Close
2366*/
2367SW_DEVICES_Close:
2368 call SW_DEVICES_Fini
2369return
2370
2371/*:VRX SW_DEVICES_Create
2372*/
2373SW_DEVICES_Create:
2374 call SW_DEVICES_Init
2375return
2376
2377/*:VRX SW_DEVICES_Fini
2378*/
2379SW_DEVICES_Fini:
2380 window = VRInfo( "Window" )
2381 call VRDestroy window
2382 drop window
2383return
2384/*:VRX SW_DEVICES_Init
2385*/
2386SW_DEVICES_Init: PROCEDURE EXPOSE globals.
2387
2388 globals.!hcfDevices.!icon = VRMethod( "CN_DEVICES", "AddField", "Icon", "" )
2389 globals.!hcfDevices.!model = VRMethod( "CN_DEVICES", "AddField", "String", NLSGetMessage( 111 ))
2390 globals.!hcfDevices.!driver = VRMethod( "CN_DEVICES", "AddField", "String", NLSGetMessage( 116 ))
2391
2392 CALL VRSet "CN_DEVICES", "DetailSort", globals.!hcfDevices.!model
2393 ok = VRMethod( "CN_DEVICES", "SetFieldAttr", globals.!hcfDevices.!icon, "HorizSeparator", "0" )
2394
2395 CALL NLSSetText 'CN_DEVICES', 'Caption', 104
2396 CALL NLSSetText 'PB_DEVICE_ADD', 'Caption', 8
2397 CALL NLSSetText 'PB_DEVICE_REMOVE', 'Caption', 9
2398
2399 CALL RefreshDevices
2400
2401 window = VRInfo( "Object" )
2402 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2403 call VRMethod window, "CenterWindow"
2404 call VRSet window, "Visible", 1
2405 call VRMethod window, "Activate"
2406 end
2407
2408 CALL VRSet window, 'UserData', 'CN_DEVICES'
2409 drop window
2410/*
2411 globals.!initstate = globals.!initstate + 1
2412 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
2413*/
2414RETURN
2415
2416/*:VRX SW_IMPORT_Close
2417*/
2418SW_IMPORT_Close:
2419 call SW_IMPORT_Fini
2420return
2421
2422/*:VRX SW_IMPORT_Create
2423*/
2424SW_IMPORT_Create:
2425 call SW_IMPORT_Init
2426return
2427
2428/*:VRX SW_IMPORT_Fini
2429*/
2430SW_IMPORT_Fini:
2431 window = VRInfo( "Window" )
2432 call VRDestroy window
2433 drop window
2434return
2435/*:VRX SW_IMPORT_Init
2436*/
2437SW_IMPORT_Init: PROCEDURE EXPOSE globals. new_ppd
2438
2439 CALL NLSSetText 'SW_IMPORT', 'Caption', 236
2440 CALL NLSSetText 'DT_IMPORT', 'Caption', 233
2441 CALL NLSSetText 'RB_IMPORTCUPS', 'Caption', 234
2442 CALL NLSSetText 'RB_IMPORTLEGACY', 'Caption', 235
2443 CALL NLSSetText 'PB_IMPORTOK', 'Caption', 2
2444 CALL NLSSetText 'PB_IMPORTCANCEL', 'Caption', 3
2445
2446 _count = 0
2447 IF ( DriverIsInstalled('PSCRIPT') <> '') | ( GetDriverSource('PSCRIPT') <> '') THEN DO
2448 _count = _count + 1
2449 psdrv._count = 'PSCRIPT'
2450 END
2451 IF ( DriverIsInstalled('PSCRIPT2') <> '') | ( GetDriverSource('PSCRIPT2') <> '') THEN DO
2452 _count = _count + 1
2453 psdrv._count = 'PSCRIPT2'
2454 END
2455 IF ( DriverIsInstalled('PSPRINT') <> '') | ( GetDriverSource('PSPRINT') <> '') THEN DO
2456 _count = _count + 1
2457 psdrv._count = 'PSPRINT'
2458 END
2459 IF ( DriverIsInstalled('PSPRINT2') <> '') | ( GetDriverSource('PSPRINT2') <> '') THEN DO
2460 _count = _count + 1
2461 psdrv._count = 'PSPRINT2'
2462 END
2463 IF ( DriverIsInstalled('ECUPS') <> '') | ( GetDriverSource('ECUPS') <> '') THEN DO
2464 _count = _count + 1
2465 psdrv._count = 'ECUPS'
2466 END
2467 IF ( DriverIsInstalled('ECUPS-HP') <> '') | ( GetDriverSource('ECUPS-HP') <> '') THEN DO
2468 _count = _count + 1
2469 psdrv._count = 'ECUPS-HP'
2470 END
2471 IF DriverIsInstalled('GUTENPRT') <> '' THEN DO
2472 _count = _count + 1
2473 psdrv._count = 'GUTENPRT'
2474 END
2475
2476 IF _count < 1 THEN DO
2477 IF globals.!hascups == 0 THEN DO
2478 CALL VRMessage VRWindow(), NLSGetMessage( 237 ), NLSGetMessage( 13 ), 'E'
2479 CALL SW_IMPORT_Close
2480 END
2481 CALL VRSet 'RB_IMPORTCUPS', 'Set', 1
2482 CALL VRSet 'RB_IMPORTLEGACY', 'Enabled', 0
2483 CALL VRSet 'DDCB_IMPORTDRV', 'Enabled', 0
2484 END
2485 ELSE IF \globals.!hascups THEN DO
2486 CALL VRSet 'RB_IMPORTCUPS', 'Enabled', 0
2487 END
2488
2489 psdrv.0 = _count
2490 CALL VRMethod 'DDCB_IMPORTDRV', 'AddStringList', 'psdrv.'
2491 CALL VRSet 'DDCB_IMPORTDRV', 'Selected', 1
2492
2493 window = VRInfo( "Object" )
2494 if( \VRIsChildOf( window, "Notebook" ) ) then do
2495 call VRMethod window, "CenterWindow"
2496 call VRSet window, "Visible", 1
2497 call VRMethod window, "Activate"
2498 end
2499 drop window
2500RETURN
2501
2502/*:VRX SW_MODELS_Close
2503*/
2504SW_MODELS_Close:
2505 call SW_MODELS_Fini
2506return
2507
2508/*:VRX SW_MODELS_Create
2509*/
2510SW_MODELS_Create:
2511 call SW_MODELS_Init
2512return
2513
2514/*:VRX SW_MODELS_Fini
2515*/
2516SW_MODELS_Fini:
2517 window = VRInfo( "Window" )
2518 call VRDestroy window
2519 drop window
2520return
2521/*:VRX SW_MODELS_Init
2522*/
2523SW_MODELS_Init: PROCEDURE EXPOSE globals.
2524
2525 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
2526 IF ok == 0 | recs.0 < 1 THEN RETURN
2527 record = recs.1
2528
2529 _name = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!name )
2530 _path = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!path )
2531 _ver = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!version )
2532 IF _ver == '-' THEN _ver = '??'
2533 driver = _path'\'_name
2534
2535 CALL NLSSetText 'SW_MODELS', 'Caption', 194
2536 CALL NLSSetText 'PB_MODELS_CLOSE', 'Caption', 12
2537
2538 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
2539 ok = RPUEnumModels( driver, 'models.')
2540 IF ok == 1 THEN
2541 CALL VRMethod 'LB_MODELS', 'AddStringList', 'models.'
2542 CALL VRSet 'WN_MAIN', 'Pointer', '<default>'
2543
2544 CALL NLSSetText 'DT_MODELS', 'Caption', 195, _name, models.0
2545
2546 window = VRInfo( "Object" )
2547 if( \VRIsChildOf( window, "Notebook" ) ) then do
2548 call VRMethod window, "CenterWindow"
2549 call VRSet window, "Visible", 1
2550 call VRMethod window, "Activate"
2551 end
2552 drop window
2553
2554RETURN
2555
2556/*:VRX SW_PORT_ADD_Close
2557*/
2558SW_PORT_ADD_Close:
2559 call SW_PORT_ADD_Fini
2560return
2561
2562/*:VRX SW_PORT_ADD_Create
2563*/
2564SW_PORT_ADD_Create:
2565 call SW_PORT_ADD_Init
2566return
2567
2568/*:VRX SW_PORT_ADD_Fini
2569*/
2570SW_PORT_ADD_Fini:
2571 window = VRInfo( "Window" )
2572 call VRDestroy window
2573 drop window
2574return
2575/*:VRX SW_PORT_ADD_Init
2576*/
2577SW_PORT_ADD_Init: PROCEDURE EXPOSE globals. updated
2578
2579 fld_name = VRMethod('CN_ADDPORT', 'AddField', 'String',, 'NAME')
2580 fld_path = VRMethod('CN_ADDPORT', 'AddField', 'String',, 'PATH')
2581
2582 CALL NLSSetText 'SW_PORT_ADD', 'Caption', 160
2583 CALL NLSSetText 'DT_ADDPORT', 'Caption', 161
2584 CALL NLSSetText 'CN_ADDPORT', 'Caption', 162
2585 CALL NLSSetText 'DT_OTHERPORT', 'Caption', 163
2586 CALL NLSSetText 'PB_OTHERPORT', 'Caption', 164
2587
2588 CALL NLSSetText 'PB_ADDPORT_OK', 'Caption', 2
2589 CALL NLSSetText 'PB_ADDPORT_CANCEL', 'Caption', 3
2590
2591 IF GetPortDrivers() > 0 THEN DO
2592 objects.0 = portdrivers.0
2593 DO i = 1 TO portdrivers.0
2594 PARSE VAR portdrivers.i _name _path
2595 SELECT
2596 WHEN _name == 'FILE' THEN _icon = '$24,PMWP'
2597 WHEN _name == 'USBPRT' THEN _icon = '$7001,'_path
2598 WHEN _name == 'SERIAL' THEN _icon = '$7001,'_path
2599 WHEN _name == 'PARALLEL' THEN _icon = '$7001,'_path
2600 WHEN _name == 'SLPR' THEN _icon = '$7001,'_path
2601 WHEN _name == 'LPRPDRVR' THEN _icon = '$256,'_path
2602 OTHERWISE _icon = _path
2603 END
2604 objects.i = ';'_name';'_icon';;;'fld_name';'_name';'fld_path';'_path
2605 END
2606 CALL VRMethod 'CN_ADDPORT', 'AddRecordList',,, 'objects.'
2607 END
2608
2609 window = VRInfo( "Object" )
2610 if( \VRIsChildOf( window, "Notebook" ) ) then do
2611 call VRMethod window, "CenterWindow"
2612 call VRSet window, "Visible", 1
2613 call VRMethod window, "Activate"
2614 end
2615 drop window
2616RETURN
2617
2618/*:VRX SW_PORTS_Close
2619*/
2620SW_PORTS_Close:
2621 call SW_PORTS_Fini
2622return
2623
2624/*:VRX SW_PORTS_Create
2625*/
2626SW_PORTS_Create:
2627 call SW_PORTS_Init
2628return
2629
2630/*:VRX SW_PORTS_Fini
2631*/
2632SW_PORTS_Fini:
2633 window = VRInfo( "Window" )
2634 call VRDestroy window
2635 drop window
2636return
2637/*:VRX SW_PORTS_Init
2638*/
2639SW_PORTS_Init: PROCEDURE EXPOSE globals.
2640
2641 globals.!hcfPorts.!icon = VRMethod( "CN_PORTS", "AddField", "Icon", "" )
2642 globals.!hcfPorts.!name = VRMethod( "CN_PORTS", "AddField", "String", NLSGetMessage( 111 ))
2643 globals.!hcfPorts.!driver = VRMethod( "CN_PORTS", "AddField", "String", NLSGetMessage( 119 ))
2644
2645 CALL VRSet "CN_PORTS", "DetailSort", globals.!hcfPorts.!name
2646 ok = VRMethod( "CN_PORTS", "SetFieldAttr", globals.!hcfPorts.!icon, "HorizSeparator", "0" )
2647
2648 CALL NLSSetText 'CN_PORTS', 'Caption', 105
2649 CALL NLSSetText 'PB_PORT_ADD', 'Caption', 8
2650 CALL NLSSetText 'PB_PORT_DELETE', 'Caption', 9
2651 CALL NLSSetText 'PB_PORT_EDIT', 'Caption', 10
2652
2653 CALL RefreshPorts
2654
2655 window = VRInfo( "Object" )
2656 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2657 call VRMethod window, "CenterWindow"
2658 call VRSet window, "Visible", 1
2659 call VRMethod window, "Activate"
2660 end
2661
2662 CALL VRSet window, 'UserData', 'CN_PORTS'
2663 drop window
2664/*
2665 globals.!initstate = globals.!initstate + 1
2666 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
2667*/
2668RETURN
2669
2670/*:VRX SW_PRINTERPAKS_Close
2671*/
2672SW_PRINTERPAKS_Close:
2673 call SW_PRINTERPAKS_Fini
2674return
2675
2676/*:VRX SW_PRINTERPAKS_Create
2677*/
2678SW_PRINTERPAKS_Create:
2679 call SW_PRINTERPAKS_Init
2680return
2681
2682/*:VRX SW_PRINTERPAKS_Fini
2683*/
2684SW_PRINTERPAKS_Fini:
2685 window = VRInfo( "Window" )
2686 call VRDestroy window
2687 drop window
2688return
2689/*:VRX SW_PRINTERPAKS_Init
2690*/
2691SW_PRINTERPAKS_Init: PROCEDURE EXPOSE globals.
2692
2693 globals.!hcfPaks.!icon = VRMethod( "CN_PRINTERPAKS", "AddField", "Icon", "" )
2694 globals.!hcfPaks.!name = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 173 ))
2695 globals.!hcfPaks.!version= VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 181 ))
2696 globals.!hcfPaks.!status = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 176 ))
2697 globals.!hcfPaks.!path = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 175 ))
2698 globals.!hcfPaks.!desc = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 174 ))
2699 globals.!hcfPaks.!flags = VRMethod( "CN_PRINTERPAKS", "AddField", "String", 'FLAGS')
2700
2701 CALL VRSet "CN_PRINTERPAKS", "DetailSort", globals.!hcfPaks.!name
2702 ok = VRMethod( "CN_PRINTERPAKS", "SetFieldAttr", globals.!hcfPaks.!icon, "HorizSeparator", "0" )
2703 ok = VRMethod( "CN_PRINTERPAKS", "SetFieldAttr", globals.!hcfPaks.!flags, "Visible", "0" )
2704
2705 CALL NLSSetText 'SW_PRINTERPAKS', 'Caption', 170
2706 CALL NLSSetText 'DT_PRINTERPAKS', 'Caption', 171
2707 CALL NLSSetText 'PB_PPUPDATE', 'Caption', 179
2708 CALL NLSSetText 'PB_PPCLOSE', 'Caption', 12
2709
2710 CALL GetPrinterPaks
2711
2712 window = VRInfo( "Object" )
2713 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2714 call VRMethod window, "CenterWindow"
2715 call VRSet window, "Visible", 1
2716 call VRMethod window, "Activate"
2717 end
2718 drop window
2719return
2720
2721/*:VRX SW_PRINTERS_Close
2722*/
2723SW_PRINTERS_Close:
2724 call SW_PRINTERS_Fini
2725return
2726
2727/*:VRX SW_PRINTERS_Create
2728*/
2729SW_PRINTERS_Create:
2730 call SW_PRINTERS_Init
2731return
2732
2733/*:VRX SW_PRINTERS_Fini
2734*/
2735SW_PRINTERS_Fini:
2736 window = VRInfo( "Window" )
2737 call VRDestroy window
2738 drop window
2739return
2740/*:VRX SW_PRINTERS_Init
2741*/
2742SW_PRINTERS_Init: PROCEDURE EXPOSE globals.
2743
2744 CALL NLSSetText 'CN_PRINTERS', 'Caption', 103
2745 CALL NLSSetText 'PB_PRINTER_ADD', 'Caption', 8
2746 CALL NLSSetText 'PB_PRINTER_DEL', 'Caption', 9
2747 CALL NLSSetText 'PB_PRINTER_OPEN', 'Caption', 7
2748 CALL NLSSetText 'PB_PRINTER_EDIT', 'Caption', 10
2749
2750 globals.!hcfPrinters.!icon = VRMethod( "CN_PRINTERS", "AddField", "Icon", "" )
2751 globals.!hcfPrinters.!title = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 110 ))
2752 globals.!hcfPrinters.!name = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 112 ))
2753 globals.!hcfPrinters.!queue = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 113 ))
2754 globals.!hcfPrinters.!host = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 115 ))
2755 globals.!hcfPrinters.!driver = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 116 ))
2756 globals.!hcfPrinters.!port = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 117 ))
2757 globals.!hcfPrinters.!flags = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 118 ))
2758 globals.!hcfPrinters.!handle = VRMethod( "CN_PRINTERS", "AddField", "String", "HANDLE" )
2759
2760 CALL VRSet 'CN_PRINTERS', 'DetailSort', globals.!hcfPrinters.!title
2761 CALL VRSet 'CN_PRINTERS', 'LastSplitField', globals.!hcfPrinters.!host
2762 CALL VRSet 'CN_PRINTERS', 'SplitBarLeft', 3000
2763
2764 ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!icon, "HorizSeparator", "0" )
2765 ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!handle, "Visible", "0" )
2766/* ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!flags, "Visible", "0" ) */
2767
2768 CALL RefreshPrinters
2769
2770 window = VRInfo( "Object" )
2771 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2772 call VRMethod window, "CenterWindow"
2773 call VRSet window, "Visible", 1
2774 call VRMethod window, "Activate"
2775 end
2776
2777 CALL VRSet window, 'UserData', 'CN_PRINTERS'
2778 drop window
2779/*
2780 globals.!initstate = globals.!initstate + 1
2781 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
2782*/
2783
2784RETURN
2785
2786/*:VRX SW_PRINTERS_Resize
2787*/
2788SW_PRINTERS_Resize:
2789
2790return
2791
2792/*:VRX SW_WIZARD_Close
2793*/
2794SW_WIZARD_Close:
2795 call SW_WIZARD_Fini
2796return
2797
2798/*:VRX SW_WIZARD_Create
2799*/
2800SW_WIZARD_Create:
2801 call SW_WIZARD_Init
2802return
2803
2804/*:VRX SW_WIZARD_Fini
2805*/
2806SW_WIZARD_Fini:
2807 window = VRInfo( "Window" )
2808 call VRDestroy window
2809 drop window
2810
2811 IF globals.!wizard THEN CALL Quit
2812 ELSE DO
2813 call VRSet 'WN_MAIN', "Visible", 1
2814 IF globals.!create_mode == '' THEN DO
2815 call VRMethod 'WN_MAIN', "Activate"
2816 CALL VRMethod 'TDL_MAIN', 'SetFocus'
2817 END
2818 END
2819RETURN
2820/*:VRX SW_WIZARD_Init
2821*/
2822SW_WIZARD_Init:
2823
2824 CALL NLSSetText 'SW_WIZARD', 'Caption', 140
2825 IF globals.!wizard THEN
2826 CALL NLSSetText 'DT_WIZARD', 'Caption', 142
2827 ELSE
2828 CALL NLSSetText 'DT_WIZARD', 'Caption', 141
2829 CALL NLSSetText 'RB_CREATE_CUPS', 'Caption', 143
2830 CALL NLSSetText 'RB_CREATE_LEGACY', 'Caption', 144
2831 CALL NLSSetText 'RB_CREATE_STANDARD', 'Caption', 145
2832 CALL NLSSetText 'RB_CREATE_LAN', 'Caption', 146
2833 CALL NLSSetText 'RB_ADVANCED', 'Caption', 147
2834 CALL NLSSetText 'PB_WIZARD_NEXT', 'Caption', 11
2835 CALL NLSSetText 'PB_WIZARD_CANCEL', 'Caption', 3
2836 CALL NLSSetText 'PB_WIZARD_HELP', 'Caption', 4
2837
2838 IF globals.!wizard THEN CALL VRSet 'RB_ADVANCED', 'Visible', 1
2839 window = VRInfo( "Object" )
2840 if( \VRIsChildOf( window, "Notebook" ) ) then do
2841 call VRMethod window, "CenterWindow"
2842 call VRSet window, "Visible", 1
2843 call VRMethod window, "Activate"
2844 end
2845 drop window
2846
2847 globals.!create_mode = ''
2848
2849RETURN
2850
2851/*:VRX TDL_MAIN_PageSelected
2852*/
2853TDL_MAIN_PageSelected: PROCEDURE EXPOSE globals.
2854 _pageidx = VRInfo("Page")
2855 _pagewin = VRMethod( "TDL_MAIN", "GetPageWindow", _pageidx )
2856 _cnr = VRGet( _pagewin, "UserData")
2857 IF _cnr == '' THEN RETURN
2858
2859 _view = VRGet( _cnr, "View")
2860 IF _view == 'Detail' THEN DO
2861 CALL VRSet 'MI_ICONVIEW', 'Checked', 0
2862 CALL VRSet 'MI_DETAILVIEW', 'Checked', 1
2863 CALL VRSet 'MI_CONTEXT_ICON', 'Checked', 0
2864 CALL VRSet 'MI_CONTEXT_DETAIL', 'Checked', 1
2865 END
2866 ELSE DO
2867 CALL VRSet 'MI_ICONVIEW', 'Checked', 1
2868 CALL VRSet 'MI_DETAILVIEW', 'Checked', 0
2869 CALL VRSet 'MI_CONTEXT_ICON', 'Checked', 1
2870 CALL VRSet 'MI_CONTEXT_DETAIL', 'Checked', 0
2871 END
2872/*
2873 SELECT
2874 WHEN _cnr == 'CN_PRINTERS' THEN DO
2875 END
2876 WHEN _cnr == 'CN_PORTS' THEN DO
2877 END
2878 WHEN _cnr == 'CN_DEVICES' THEN DO
2879 END
2880 OTHERWISE DO
2881 END
2882 END
2883*/
2884RETURN
2885
2886/*:VRX WN_MAIN_Close
2887*/
2888WN_MAIN_Close:
2889 call Quit
2890return
2891
2892/*:VRX xxUpdatePrDesc
2893*/
2894xxUpdatePrDesc: PROCEDURE EXPOSE globals.
2895 ARG driver, fqn
2896
2897 IF globals.!prdesc == '' THEN RETURN 1
2898
2899 ok = RPUEnumModels( fqn, 'newdevs.')
2900 IF ok == 0 THEN RETURN 2
2901
2902 _count = 0
2903 CALL LINEIN globals.!prdesc, 1, 0
2904 DO WHILE LINES( globals.!prdesc )
2905 _next = LINEIN( globals.!prdesc )
2906 PARSE UPPER VAR _next WITH . ':' . '('_prdrv')' .
2907 IF _prdrv == driver THEN ITERATE
2908 _count = _count + 1
2909 prdefs.count = _next
2910 END
2911 CALL STREAM prdesc, 'C', 'CLOSE'
2912
2913 DO i = 1 TO devs.0
2914 _count = _count + 1
2915 prdefs._count = newdevs.i':' newdevs.i '('driver')'
2916 END
2917 prdefs.0 = count
2918
2919 CALL VRSortStem 'prdefs.'
2920
2921 _prdir = VRParseFileName( globals.!prdesc, 'DP')
2922 CALL VRCopyFile globals.!prdesc, _prdir'\PRDESC.BAK'
2923 CALL VRDeleteFile globals.!prdesc
2924 DO i = 1 TO prdefs.0
2925 CALL LINEOUT globals.!prdesc, prdefs.i
2926 END
2927 CALL LINEOUT globals.!prdesc
2928
2929RETURN 0
2930
Note: See TracBrowser for help on using the repository browser.