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

Last change on this file since 57 was 57, checked in by Alex Taylor, 8 years ago

Fix crash when PRDESC.LST contains a blank (or otherwise unexpected) line

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