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

Last change on this file since 53 was 51, checked in by Alex Taylor, 10 years ago

Try to fix spurious error when updating PrinterPak files if there are no PPDs to reimport.

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