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

Last change on this file since 48 was 48, checked in by Alex Taylor, 11 years ago

Fix bug causing AUXPRINT.PAK to not be updated in OS2\DLL\<driver> directory after importing a PPD.

File size: 93.8 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.
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 (working) copy of the driver could not be located, but
525 * 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 /** TODO should move all below this into a new 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 IF ok == 1 THEN DO
785 /* Copy the updated files to \OS2\DLL\<driver>, replacing any
786 * existing copies. (This prevents problems if the OS/2 driver
787 * installation doesn't/fails to copy them, which can happen under
788 * some circumstances.)
789 */
790 IF VRFileExists( globals.!os2dir'\DLL\'driver'\'driver'.DRV') THEN DO
791 CALL VRCopyFile workdir'\OUT\AUXPRINT.PAK',,
792 globals.!os2dir'\DLL\'driver'\AUXPRINT.PAK'
793 CALL PRReplaceModule globals.!os2dir'\DLL\'driver'\'driver'.DRV', '', ''
794 CALL VRCopyFile workdir'\OUT\'driver'.DRV', globals.!os2dir'\DLL\'driver'\'driver'.DRV'
795 END
796 END
797 IF ok == 0 THEN DO
798 CALL LINEOUT globals.!log1, VRError()
799 RETURN 4 /*** RC=4 Failed to copy driver files ***/
800 END
801
802 CALL LINEOUT globals.!log1, newprinters.0 'printers imported successfully.'
803 DO i = 1 TO newprinters.0
804 CALL LINEOUT globals.!log1, ' ->' newprinters.i
805 END
806 CALL LINEOUT globals.!log1, ''
807 CALL LINEOUT globals.!log1
808
809 /* Clean up our work directories.
810 */
811 CALL VRDeleteFile workdir'\OUT\*'
812 CALL VRDeleteFile workdir'\*'
813 CALL VRRmDir( workdir'\OUT')
814 CALL VRRmDir( workdir )
815
816RETURN 0
817
818/*:VRX Init
819*/
820Init:
821 /* Hide the VX-REXX console window
822 */
823 CALL VRSet 'Console', 'WindowListTitle', ''
824
825 CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
826 CALL SysLoadFuncs
827 CALL RxFuncAdd 'RPULoadFuncs', 'RXPRTUTL', 'RPULoadFuncs'
828 CALL RPULoadFuncs
829 CALL RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
830 CALL PRLoadFuncs
831 CALL RxFuncAdd 'WPToolsLoadFuncs', 'WPTOOLS', 'WPToolsLoadFuncs'
832 CALL WPToolsLoadFuncs
833 CALL RxFuncAdd 'VRXLoadFuncs', 'VROBJEX', 'VRXLoadFuncs'
834 CALL VRXLoadFuncs
835
836 globals.!wizard = 0
837 globals.!debug = 0
838 globals.!initstate = 0
839
840 DO i = 1 TO InitArgs.0
841 PARSE UPPER VAR InitArgs.i _arg
842 SELECT
843 WHEN _arg == '/CREATE' THEN globals.!wizard = 1
844 WHEN LEFT( _arg, 2 ) == '/D' THEN globals.!debug = 1
845 OTHERWISE NOP
846 END
847 END
848
849 CALL LoadSettings
850 CALL SetLanguage
851 CALL CheckPrograms
852
853 window = VRWindow()
854 call VRMethod window, "CenterWindow"
855 call VRMethod window, "Activate"
856 IF globals.!wizard THEN DO
857 CALL VRMethod 'Application', 'PostQueue', 0, 1, 'CALL PB_PRINTER_ADD_Click'
858 END
859 ELSE DO
860 CALL VRSet window, "Visible", 1
861 CALL VRMethod 'TDL_MAIN', 'SetFocus'
862 END
863 drop window
864
865RETURN
866
867/*:VRX InitMessageLog
868*/
869/* Initialize the message logfile. Unlike the error log, which is cleared and
870 * recreated every time the program starts, the message log is appended to
871 * until it reaches 100kB in size. If the message log is larger than 100kB when
872 * this function is called, it is renamed (with '~' appended to the name) and
873 * a new message log is started.
874 */
875InitMessageLog: PROCEDURE EXPOSE globals.
876
877 logsize = STREAM( globals.!log1, 'C', 'QUERY SIZE')
878 IF ( logsize <> '') & ( logsize > 102400 ) THEN DO
879 CALL VRCopyFile globals.!log1, globals.!log1 || '~'
880 CALL VRDeleteFile globals.!log1
881 END
882
883 datestr = DATE('L') TIME('N')
884 CALL LINEOUT globals.!log1, '--[' datestr ']' ||,
885 COPIES('-', 73 - LENGTH( datestr ))
886RETURN
887
888/*:VRX LoadSettings
889*/
890LoadSettings: PROCEDURE EXPOSE globals.
891
892 globals.!version = '0.46'
893 globals.!copyright = '2013'
894
895 me = VRGet('Application', 'Program')
896 IF me == '' THEN PARSE SOURCE . . me
897 globals.!mydir = VRParseFilePath( me, 'DP')
898
899 /* Get CUPS paths.
900 */
901 PARSE VALUE VRGetIni('eCups', 'CUPS', 'USER') WITH cupsdrv '00'x .
902 IF cupsdrv == '' THEN
903 cupsdrv = VRParseFilePath( me, 'D') || ':'
904 ELSE
905 cupsdrv = STRIP( cupsdrv, 'T', '\')
906 globals.!cupsdir = cupsdrv'\cups'
907
908 /* Get system paths.
909 */
910 globals.!bootdrv = SysBootDrive()
911 IF globals.!bootdrv == '' THEN
912 globals.!bootdrv = FILESPEC('DRIVE', VALUE('OS2_SHELL',,'OS2ENVIRONMENT'))
913 globals.!os2dir = globals.!bootdrv'\OS2'
914 globals.!tmpdir = VALUE('TMP',,'OS2ENVIRONMENT')
915 IF globals.!tmpdir == '' THEN
916 globals.!tmpdir = VALUE('TEMP',,'OS2ENVIRONMENT')
917 IF globals.!tmpdir == '' THEN
918 globals.!tmpdir = globals.!mydir
919 globals.!logdir = VALUE('LOGFILES',,'OS2ENVIRONMENT')
920 IF globals.!logdir == '' THEN
921 globals.!logdir = globals.!mydir
922
923 globals.!log1 = globals.!logdir'\printman.l1'
924 globals.!log2 = globals.!logdir'\printman.l2'
925 CALL InitMessageLog
926 IF VRFileExists( globals.!log2 ) THEN
927 CALL VRDeleteFile globals.!log2
928
929
930 /* Get printer-related paths.
931 */
932 PARSE VALUE VRGetIni('PM_INSTALL', 'PDR_DIR', 'USER') WITH repos_dir '00'x .
933 globals.!repository = repos_dir
934 globals.!prdrv = STREAM( globals.!os2dir'\install\prdrv.lst', 'C', 'QUERY EXISTS')
935 globals.!prdesc = STREAM( globals.!os2dir'\install\prdesc.lst', 'C', 'QUERY EXISTS')
936
937 /* Set the language file name.
938 */
939 globals.!nlsname = 'printm'
940
941 /* Determine the OS.
942 */
943 IF VRFileExists( globals.!os2dir'\INSTALL\SYSLEVEL.ECS') THEN
944 globals.!is_ecs = 1
945 ELSE
946 globals.!is_ecs = 0
947
948 globals.!create_mode = ''
949
950RETURN
951
952/*:VRX MI_ABOUT_Click
953*/
954MI_ABOUT_Click:
955 CALL VRLoadSecondary 'SW_ABOUT', 'W'
956RETURN
957
958/*:VRX MI_CONTEXT_DETAIL_Click
959*/
960MI_CONTEXT_DETAIL_Click: PROCEDURE EXPOSE globals.
961 CALL MI_DETAILVIEW_Click
962RETURN
963
964/*:VRX MI_CONTEXT_ICON_Click
965*/
966MI_CONTEXT_ICON_Click: PROCEDURE EXPOSE globals.
967 CALL MI_ICONVIEW_Click
968RETURN
969
970
971/*:VRX MI_CONTEXT_INSTALL_Click
972*/
973MI_CONTEXT_INSTALL_Click: PROCEDURE EXPOSE globals.
974
975 _page = VRGet('TDL_MAIN', 'Selected')
976 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
977 _cnr = VRGet( _pagewin, 'UserData')
978 IF _cnr == '' THEN RETURN
979
980 CALL VRSet _cnr, 'Source', 0
981
982 SELECT
983 WHEN _cnr == 'CN_PRINTERS' THEN CALL PrinterWizard
984 WHEN _cnr == 'CN_PORTS' THEN CALL PortAdd
985 WHEN _cnr == 'CN_DEVICES' THEN CALL DriverAdd
986 OTHERWISE NOP
987 END
988
989RETURN
990
991/*:VRX MI_CONTEXT_REFRESH_Click
992*/
993MI_CONTEXT_REFRESH_Click: PROCEDURE EXPOSE globals.
994 CALL MI_REFRESH_Click
995RETURN
996
997/*:VRX MI_DETAILVIEW_Click
998*/
999MI_DETAILVIEW_Click: PROCEDURE EXPOSE globals.
1000
1001 _page = VRGet('TDL_MAIN', 'Selected')
1002 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
1003 _cnr = VRGet( _pagewin, 'UserData')
1004 IF _cnr == '' THEN RETURN
1005
1006 CALL VRSet _cnr, 'Source', 0
1007 _set = VRGet('MI_DETAILVIEW', 'Checked')
1008 IF _set == 1 THEN RETURN
1009
1010 CALL VRSet _cnr, 'View', 'Detail'
1011 CALL VRSet _cnr, 'MiniIcons', 1
1012
1013 CALL VRSet 'MI_ICONVIEW', 'Checked', 0
1014 CALL VRSet 'MI_CONTEXT_ICON', 'Checked', 0
1015 CALL VRSet 'MI_DETAILVIEW', 'Checked', 1
1016 CALL VRSet 'MI_CONTEXT_DETAIL','Checked', 1
1017
1018RETURN
1019
1020/*:VRX MI_DRIVERS_INSTALL_Click
1021*/
1022MI_DRIVERS_INSTALL_Click:
1023 CALL DriverAdd
1024return
1025
1026/*:VRX MI_DRIVERS_REMOVE_Click
1027*/
1028MI_DRIVERS_REMOVE_Click:
1029 CALL DriverDelete
1030return
1031
1032/*:VRX MI_ICONVIEW_Click
1033*/
1034MI_ICONVIEW_Click: PROCEDURE EXPOSE globals.
1035
1036 _page = VRGet('TDL_MAIN', 'Selected')
1037 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
1038 _cnr = VRGet( _pagewin, 'UserData')
1039 IF _cnr == '' THEN RETURN
1040
1041 CALL VRSet _cnr, 'Source', 0
1042 _set = VRGet('MI_ICONVIEW', 'Checked')
1043 IF _set == 1 THEN RETURN
1044
1045 CALL VRSet _cnr, 'View', 'Icon'
1046 CALL VRSet _cnr, 'MiniIcons', 0
1047
1048 CALL VRSet 'MI_ICONVIEW', 'Checked', 1
1049 CALL VRSet 'MI_CONTEXT_ICON', 'Checked', 1
1050 CALL VRSet 'MI_DETAILVIEW', 'Checked', 0
1051 CALL VRSet 'MI_CONTEXT_DETAIL', 'Checked', 0
1052
1053RETURN
1054
1055/*:VRX MI_IMPORT_Click
1056*/
1057MI_IMPORT_Click: PROCEDURE EXPOSE globals. new_ppd
1058
1059 /* Prompt the user for the PPD file to import.
1060 */
1061 new_ppd = VRFileDialog( VRWindow(), NLSGetMessage( 230 ), 'O', '*.PPD')
1062 IF new_ppd == '' THEN RETURN 0
1063
1064 /* Let the user select the Postscript driver to update.
1065 */
1066 CALL VRLoadSecondary 'SW_IMPORT', 'W'
1067
1068RETURN ok
1069
1070/*:VRX MI_MANAGE_Click
1071*/
1072MI_MANAGE_Click: PROCEDURE EXPOSE globals.
1073 CALL VRLoadSecondary 'SW_PRINTERPAKS', 'W'
1074RETURN
1075
1076/*:VRX MI_PORT_CREATE_Click
1077*/
1078MI_PORT_CREATE_Click:
1079 CALL PortAdd
1080return
1081
1082/*:VRX MI_PORT_DELETE_Click
1083*/
1084MI_PORT_DELETE_Click:
1085 CALL PortDelete
1086return
1087
1088/*:VRX MI_PORT_PROPS_Click
1089*/
1090MI_PORT_PROPS_Click:
1091 CALL PortProperties
1092RETURN
1093
1094/*:VRX MI_PPAK_COPY_Click
1095*/
1096MI_PPAK_COPY_Click:
1097 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
1098 IF ok == 0 | recs.0 < 1 THEN RETURN
1099 record = recs.1
1100
1101 _path = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!path )
1102 CALL VRMethod 'Application', 'PutClipboard', _path
1103
1104 CALL VRMethod 'CN_PRINTERPAKS', 'SetRecordAttr', record, 'Source', 0
1105RETURN
1106
1107/*:VRX MI_PPAK_MODELS_Click
1108*/
1109MI_PPAK_MODELS_Click: PROCEDURE EXPOSE globals.
1110
1111 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
1112 IF ok == 0 | recs.0 < 1 THEN RETURN
1113 CALL VRMethod 'CN_PRINTERPAKS', 'SetRecordAttr', recs.1, 'Source', 0
1114
1115 CALL VRLoadSecondary 'SW_MODELS', 'W'
1116
1117RETURN
1118
1119/*:VRX MI_PRINTER_CREATE_Click
1120*/
1121MI_PRINTER_CREATE_Click:
1122 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1123 IF ok == 1 & recs.0 > 0 THEN
1124 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', recs.1, 'Source', 0
1125 CALL PrinterWizard
1126RETURN
1127
1128/*:VRX MI_PRINTER_DEFAULT_Click
1129*/
1130MI_PRINTER_DEFAULT_Click:
1131 CALL PrinterSetDefault
1132RETURN
1133
1134/*:VRX MI_PRINTER_DELETE_Click
1135*/
1136MI_PRINTER_DELETE_Click:
1137 CALL PrinterDelete
1138RETURN
1139
1140/*:VRX MI_PRINTER_HOLD_Click
1141*/
1142MI_PRINTER_HOLD_Click:
1143 CALL PrinterHold
1144return
1145
1146/*:VRX MI_PRINTER_OPEN_Click
1147*/
1148MI_PRINTER_OPEN_Click:
1149 CALL PrinterOpen
1150RETURN
1151
1152/*:VRX MI_PRINTER_PROPS_Click
1153*/
1154MI_PRINTER_PROPS_Click:
1155 CALL PrinterProperties
1156RETURN
1157
1158/*:VRX MI_QUIT_Click
1159*/
1160MI_QUIT_Click:
1161 CALL Quit
1162return
1163
1164/*:VRX MI_REFRESH_Click
1165*/
1166MI_REFRESH_Click: PROCEDURE EXPOSE globals.
1167
1168 _page = VRGet('TDL_MAIN', 'Selected')
1169 _pagewin = VRMethod('TDL_MAIN', 'GetPageWindow', _page )
1170 _cnr = VRGet( _pagewin, 'UserData')
1171 IF _cnr == '' THEN RETURN
1172
1173 CALL VRSet _cnr, 'Source', 0
1174
1175 SELECT
1176 WHEN _cnr == 'CN_PRINTERS' THEN CALL RefreshPrinters
1177 WHEN _cnr == 'CN_PORTS' THEN CALL RefreshPorts
1178 WHEN _cnr == 'CN_DEVICES' THEN CALL RefreshDevices
1179 OTHERWISE NOP
1180 END
1181
1182RETURN
1183
1184/*:VRX New_CUPS
1185*/
1186New_CUPS: PROCEDURE EXPOSE globals.
1187 PARSE ARG ppd_file
1188
1189 IF WPToolsQueryObject('<ECUPS_WIZARD>',,,'SetupString') == 1 THEN DO
1190 PARSE VAR SetupString . 'EXENAME='cupswiz';' .
1191 PARSE VAR SetupString . 'STARTUPDIR='_workdir';' .
1192 PARSE VAR SetupString . 'PARAMETERS='_parms';' .
1193 IF _workdir == '' THEN _workdir = VRParseFilePath( cupswiz, 'DP')
1194 END
1195 ELSE DO
1196 cupswiz = Stream( globals.!cupsdir'\cups\cupswiz.exe', 'C', 'QUERY EXISTS')
1197 _workdir = VRParseFilePath( cupswiz, 'DP')
1198 _parms = ''
1199 END
1200 IF cupswiz <> '' THEN DO
1201 od = DIRECTORY()
1202 CALL DIRECTORY _workdir
1203 IF ppd_file <> '' & VRFileExists( ppd_file ) THEN
1204 _parms = _parms ppd_file
1205 ADDRESS CMD 'start' cupswiz _parms
1206 CALL DIRECTORY od
1207 CALL Quit
1208 END
1209
1210RETURN
1211
1212/*:VRX New_LAN
1213*/
1214New_LAN: PROCEDURE EXPOSE globals.
1215
1216 ok = OpenPrinterTemplate('WPRPrinter')
1217 CALL Quit
1218
1219RETURN ok
1220
1221/*:VRX New_Standard
1222*/
1223New_Standard: PROCEDURE EXPOSE globals.
1224
1225 ok = OpenPrinterTemplate('WPPrinter')
1226 CALL Quit
1227
1228RETURN ok
1229
1230/*:VRX OpenPrinterTemplate
1231*/
1232OpenPrinterTemplate: PROCEDURE EXPOSE globals.
1233 PARSE ARG _class
1234
1235 ok = 0
1236 IF WPToolsFolderContent('<WP_TEMPS>', '_temps.', 'F') THEN
1237 DO i = 1 TO _temps.0
1238 IF WPToolsQueryObject( _temps.i, 'szClass') THEN DO
1239 IF szClass == _class THEN DO
1240 ok = WPToolsSetObjectData( _temps.i, 'OPEN=DEFAULT;')
1241 LEAVE
1242 END
1243 END
1244 END
1245
1246 IF ok == 0 THEN DO
1247 IF SysCreateObject( _class, _class, globals.!tmpdir,,
1248 'OBJECTID=<TEMP_PRT>;TAKEDEFAULTS=NO;TEMPLATE=YES', 'R') THEN
1249 DO
1250 ok = SysSetObjectData '<TEMP_PRT>','OPEN=DEFAULT;'
1251 CALL SysDestroyObject '<TEMP_PRT>'
1252 END
1253 END
1254
1255RETURN ok
1256
1257/*:VRX PB_ABOUT_OK_Click
1258*/
1259PB_ABOUT_OK_Click:
1260 CALL SW_ABOUT_Close
1261RETURN
1262
1263/*:VRX PB_ADDPORT_CANCEL_Click
1264*/
1265PB_ADDPORT_CANCEL_Click:
1266 CALL SW_PORT_ADD_Close
1267RETURN
1268
1269/*:VRX PB_ADDPORT_OK_Click
1270*/
1271PB_ADDPORT_OK_Click: PROCEDURE EXPOSE globals. updated
1272
1273 ok = VRMethod('CN_ADDPORT', 'GetRecordList', 'Selected', 'recs.')
1274 IF ok == 0 | recs.0 < 1 THEN RETURN
1275 record = recs.1
1276
1277 _name = VRMethod('CN_ADDPORT', 'GetFieldData', record, 'NAME')
1278 btns.0 = 2
1279 btns.1 = NLSGetMessage( 14 )
1280 btns.2 = NLSGetMessage( 15 )
1281 ok = VRMessage('SW_PORT_ADD', NLSGetMessage( 205, _name ), NLSGetMessage( 200 ), 'Q', 'btns.', 1, 2 )
1282 IF ok == 1 THEN DO
1283 _portname = GetNextPortName( _name )
1284 ok = RPUPortInstall( _name, _portname )
1285 IF ok <> 1 THEN
1286 CALL VRMessage 'SW_PORT_ADD', NLSGetMessage( 167 ) RPUERROR, NLSGetMessage( 13 ), 'E'
1287 ELSE DO
1288 CALL RPUPortDialog _name, _portname
1289 CALL SW_PORT_ADD_Close
1290 updated = 1
1291 END
1292 END
1293
1294RETURN ok
1295
1296/*:VRX PB_DEVICE_ADD_Click
1297*/
1298PB_DEVICE_ADD_Click:
1299 CALL DriverAdd
1300RETURN
1301
1302/*:VRX PB_DEVICE_CANCEL_Click
1303*/
1304PB_DEVICE_CANCEL_Click:
1305 CALL SW_DEVICE_ADD_Close
1306RETURN
1307
1308/*:VRX PB_DEVICE_INSTALL_Click
1309*/
1310PB_DEVICE_INSTALL_Click: PROCEDURE EXPOSE globals. updated
1311 updated = 1
1312
1313 ok = VRMethod('CN_DEVICE_LIST', 'GetRecordList', 'Selected', 'recs.')
1314 IF ok == 0 THEN RETURN
1315 IF recs.0 == 0 THEN RETURN
1316 selected = recs.1
1317
1318 dev_name = VRMethod('CN_DEVICE_LIST', 'GetFieldData', selected, 'NAME')
1319 dev_driver = VRMethod('CN_DEVICE_LIST', 'GetFieldData', selected, 'DRIVER')
1320 driver_short = TRANSLATE( VRParseFileName( dev_driver, 'N'))
1321 IF dev_name == '' | dev_driver == '' | driver_short == '' THEN RETURN
1322
1323 /* Shipped drivers don't include the FQ path in dev_driver so we must
1324 * resolve it first.
1325 */
1326 IF VRGet('RB_DEVICE_SHIPPED', 'Set') == 1 THEN
1327 dev_driver = GetDriverSource( driver_short )
1328 IF dev_driver == '' THEN RETURN
1329
1330 ok = InstallPrintDriver( driver_short, dev_driver, dev_name )
1331
1332 IF ok <> 0 THEN DO
1333 CALL VRMessage VRWindow(), NLSGetMessage( 168, driver_short'.'dev_name ), NLSGetMessage( 13 ), 'E'
1334 END
1335 CALL SW_DEVICE_ADD_Close
1336
1337RETURN
1338
1339/*:VRX PB_DEVICE_OTHER_Click
1340*/
1341PB_DEVICE_OTHER_Click: PROCEDURE EXPOSE globals. shipped.
1342
1343 old_path = VRGet('DDCB_DEVICE_3RDPARTY', 'UserData')
1344 new_path = VRXDirectoryDialog( VRWindow(), old_path, NLSGetMessage( 189 ))
1345 IF new_path == '' THEN RETURN
1346 IF old_path == TRANSLATE( new_path ) THEN RETURN
1347
1348 CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Value', new_path
1349 CALL SetDriverList new_path
1350
1351RETURN
1352
1353/*:VRX PB_DEVICE_REFRESH_Click
1354*/
1355PB_DEVICE_REFRESH_Click: PROCEDURE EXPOSE globals. shipped.
1356 CALL SetDriverList
1357return
1358
1359/*:VRX PB_DEVICE_REMOVE_Click
1360*/
1361PB_DEVICE_REMOVE_Click:
1362 CALL DriverDelete
1363RETURN
1364
1365/*:VRX PB_DEVICE_REMOVE_KeyPress
1366*/
1367PB_DEVICE_REMOVE_KeyPress:
1368 IF VRGet('PB_DEVICE_REMOVE', 'KeyString') == '{Tab}' THEN
1369 CALL VRMethod 'TDL_MAIN', 'SetFocus'
1370return
1371
1372/*:VRX PB_IMPORTCANCEL_Click
1373*/
1374PB_IMPORTCANCEL_Click:
1375 CALL SW_IMPORT_Close
1376return
1377
1378/*:VRX PB_IMPORTOK_Click
1379*/
1380PB_IMPORTOK_Click: PROCEDURE EXPOSE globals. new_ppd
1381
1382 IF VRGet('RB_IMPORTCUPS', 'Set') == 1 THEN DO
1383 CALL New_CUPS new_ppd
1384 CALL SW_IMPORT_Close
1385 CALL VRSet 'WN_MAIN', 'Shutdown', 1
1386 RETURN
1387 END
1388 driver = VRGet('DDCB_IMPORTDRV', 'Value')
1389 ok = ImportPPD( driver, new_ppd )
1390
1391 SELECT
1392 /* Check the return code from ImportPPD and display an appropriate message.
1393 */
1394
1395 WHEN ok == 0 THEN DO /* Success! */
1396 _message = NLSGetMessage( 238 )
1397 _mbtitle = NLSGetMessage( 16 )
1398 _mbicon = 'I'
1399 END
1400
1401 /* Note: Error codes 1 & 2 are ignored here.
1402 * 1 means the user cancelled, so no message is required.
1403 * For 2, ImportPPD itself already displayed the error message.
1404 */
1405
1406 WHEN ok == 3 THEN DO /* Invalid path specified */
1407 _message = NLSGetMessage( 222 )
1408 _mbtitle = NLSGetMessage( 13 )
1409 _mbicon = 'E'
1410 END
1411 WHEN ok == 4 THEN DO /* Failed to copy driver files */
1412 _message = NLSGetMessage( 220 )
1413 _mbtitle = NLSGetMessage( 13 )
1414 _mbicon = 'E'
1415 END
1416 WHEN ok == 5 THEN DO /* Failed to create directory */
1417 _message = NLSGetMessage( 221 )
1418 _mbtitle = NLSGetMessage( 13 )
1419 _mbicon = 'E'
1420 END
1421 WHEN ok == 6 THEN DO /* PPD import failed */
1422 _message = NLSGetMessage( 223 )
1423 _mbtitle = NLSGetMessage( 13 )
1424 _mbicon = 'E'
1425 END
1426 WHEN ok == 7 THEN DO /* Error updating PRDESC.LST */
1427 _message = NLSGetMessage( 224, globals.!prdesc )
1428 _mbtitle = NLSGetMessage( 13 )
1429 _mbicon = 'E'
1430 END
1431
1432 OTHERWISE DO
1433 _message = ''
1434 _mbtitle = ''
1435 _mbicon = 'N'
1436 END
1437 END
1438
1439 IF message <> '' THEN
1440 CALL VRMessage VRWindow(), _message, _mbtitle, _mbicon
1441
1442 CALL SW_IMPORT_Close
1443RETURN
1444
1445/*:VRX PB_MODELS_CLOSE_Click
1446*/
1447PB_MODELS_CLOSE_Click:
1448 CALL SW_MODELS_Close
1449return
1450
1451/*:VRX PB_OTHERPORT_Click
1452*/
1453PB_OTHERPORT_Click: PROCEDURE EXPOSE globals.
1454 _new_pdr = VRFileDialog('SW_PORT_ADD', NLSGetMessage( 165 ), 'O', '*.PDR')
1455 IF _new_pdr == '' THEN RETURN 0
1456
1457 ok = InstallPortDriver( _new_pdr )
1458 IF ok == 0 THEN DO
1459 _name = VRParseFileName( _new_pdr, 'N')
1460 _rec = VRMethod('CN_ADDPORT', 'AddRecord',,, _name, _new_pdr )
1461 CALL VRMethod 'CN_ADDPORT', 'SetFieldData', _rec, 'NAME', _name, 'PATH', _new_pdr
1462 END
1463 ELSE
1464 CALL VRMessage 'SW_PORT_ADD', NLSGetMessage( 166 ) || '0a0a'x || VRError(), NLSGetMessage( 13 ), 'E'
1465RETURN ok
1466
1467/*:VRX PB_PORT_ADD_Click
1468*/
1469PB_PORT_ADD_Click:
1470 CALL PortAdd
1471RETURN
1472
1473/*:VRX PB_PORT_DELETE_Click
1474*/
1475PB_PORT_DELETE_Click:
1476 CALL PortDelete
1477return
1478
1479/*:VRX PB_PORT_EDIT_Click
1480*/
1481PB_PORT_EDIT_Click:
1482 CALL PortProperties
1483return
1484
1485/*:VRX PB_PORT_EDIT_KeyPress
1486*/
1487PB_PORT_EDIT_KeyPress:
1488 IF VRGet('PB_PORT_EDIT', 'KeyString') == '{Tab}' THEN
1489 CALL VRMethod 'TDL_MAIN', 'SetFocus'
1490return
1491
1492/*:VRX PB_PPCLOSE_Click
1493*/
1494PB_PPCLOSE_Click:
1495 CALL SW_PRINTERPAKS_Close
1496return
1497
1498/*:VRX PB_PPUPDATE_Click
1499*/
1500PB_PPUPDATE_Click: PROCEDURE EXPOSE globals.
1501
1502 /* Let the user select the driver .DRV to install.
1503 */
1504 new_drv = VRFileDialog( VRWindow(), NLSGetMessage( 182 ), 'O', '*.DRV')
1505 IF new_drv == '' THEN RETURN 0
1506
1507 drv_stem = TRANSLATE( VRParseFileName( new_drv, 'N'))
1508 drv_name = TRANSLATE( VRParseFileName( new_drv, 'NE'))
1509 drv_source = TRANSLATE( VRParseFileName( new_drv, 'DP'))
1510
1511 /* See if this is the same as an existing driver (compared by filename).
1512 */
1513 existing = 0
1514 skip_repo = 0
1515 ok = VRMethod('CN_PRINTERPAKS', 'GetRecordList', 'All', 'recs.')
1516 DO i = 1 TO recs.0
1517 _ppname = VRMethod('CN_PRINTERPAKS', 'GetFieldData', recs.i, globals.!hcfPaks.!name )
1518 IF TRANSLATE( _ppname ) == TRANSLATE( new_name ) THEN DO
1519 existing = 1
1520 _pppath = VRMethod('CN_PRINTERPAKS', 'GetFieldData', recs.i, globals.!hcfPaks.!path )
1521 LEAVE
1522 END
1523 END
1524
1525 PARSE UPPER VALUE VRGetIni('PrinterManager', 'ThirdParty', 'USER') WITH known_3p '00'x .
1526 IF known_3p == '' THEN
1527 known_3p = 'ECUPS ECUPS-HP GUTENPRT PSPRINT'
1528
1529 IF existing THEN DO
1530 drv_target = TRANSLATE( _pppath )
1531 IF drv_source == drv_target ) THEN DO
1532 CALL VRMessage VRWindow(), NLSGetMessage( 183 ), NLSGetMessage( 13 ), 'E'
1533 RETURN 1
1534 END
1535 IF CheckWritablePath( drv_target ) <> 0 THEN DO
1536 existing = 0
1537 _msg.1 = NLSGetMessage( 185, drv_target )
1538 _msg.2 = ''
1539 _msg.3 = NLSGetMessage( 186, drv_name )
1540 _msg.0 = 3
1541 _btns.1 = NLSGetMessage( 2 )
1542 _btns.2 = NLSGetMessage( 3 )
1543 _btns.0 = 2
1544 _select = VRMessageStem( VRWindow(), '_msg.', NLSGetMessage( 184 ),
1545 'I', '_btns.', 1, 2 )
1546 IF _select == 2 THEN skip_repo = 1
1547 END
1548 END
1549
1550 IF \skip_repo THEN DO
1551 IF \existing THEN DO
1552 /* If we already know about this driver, try and get its saved location. */
1553 drv_target = ''
1554 IF WORDPOS( drv_stem, known_3p ) > 0 THEN
1555 PARSE UPPER VALUE VRGetIni('PM_INSTALL', drv_stem'_DIR', 'USER') WITH drv_target '00'x .
1556 ELSE DO
1557 known_3p = known_3p drv_stem
1558 CALL VRSetIni 'PrinterManager', 'ThirdParty', known_3p || '00'x, 'USER'
1559 END
1560 IF drv_target == '' THEN DO
1561 drv_target = globals.!repository'\'drv_stem
1562 _btns.1 = NLSGetMessage( 2 )
1563 _btns.2 = NLSGetMessage( 3 )
1564 _btns.3 = NLSGetMessage( 188 )
1565 _btns.0 = 3
1566 DO UNTIL _select <> 3
1567 _select = VRPrompt( VRWindow(), NLSGetMessage( 187, drv_name ),,
1568 'drv_target', NLSGetMessage( 189 ), '_btns.', 1, 2 )
1569 IF _select == 3 THEN
1570 drv_target = VRXDirectoryDialog( VRWindow(), drv_target, NLSGetMessage( 189 ))
1571 END
1572 IF _select == 2 THEN
1573 skip_repo = 1
1574 ELSE
1575 CALL VRSetIni 'PM_INSTALL', drv_stem'_DIR', TRANSLATE( drv_target ) || '00'x, 'USER'
1576 END
1577 END
1578
1579 IF \skip_repo THEN DO
1580 IF VRFileExists( drv_target ) THEN DO
1581 /* Clear any RHS attributes on existing files */
1582 CALL SysFileTree drv_target'\*', '_ignore.',,, '**---'
1583 CALL PRReplaceModule drv_target'\'drv_name, '', ''
1584 END
1585 ELSE
1586 /* Create the target directory if necessary */
1587 ok = VRMkDir( drv_target )
1588
1589 ok = CopyPrinterPak( new_drv, drv_target )
1590 IF existing & ok == 1 THEN DO
1591 CALL UpdatePrDesc new_drv, drv_target'\'new_drv
1592 END
1593 IF ok == 0 THEN DO
1594 CALL VRMessage VRWindow(), NLSGetMessage( 220 ), NLSGetMessage( 13 ), 'E'
1595 RETURN 2
1596 END
1597 ELSE
1598 CALL VRMessage VRWindow(), NLSGetMessage( 193 ), NLSGetMessage( 16 ), 'I'
1599 END
1600 END
1601
1602 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', drv_stem, 'USER') WITH drv_used '00'x .
1603 IF ( drv_used <> '') & VRFileExists( drv_used ) THEN DO
1604 /* Driver is currently installed; ask if the user wants to update the
1605 * in-use copy as well.
1606 */
1607 _btns.1 = NLSGetMessage( 14 )
1608 _btns.2 = NLSGetMessage( 15 )
1609 _btns.0 = 2
1610 _select = VRMessage( VRWindow(), NLSGetMessage( 190 ), NLSGetMessage( 191 ), 'Q', '_btns.', 1, 2 )
1611 IF _select == 1 THEN DO
1612 CALL PRSetFileAttr drv_used , 'rsh'
1613 CALL PRReplaceModule drv_used, '', ''
1614 used_target = VRParseFileName( drv_used, 'DP')
1615 ok = CopyPrinterPak( new_drv, used_target )
1616 IF ok == 0 THEN DO
1617 CALL VRMessage VRWindow(), NLSGetMessage( 220 ), NLSGetMessage( 13 ), 'E'
1618 RETURN 2
1619 END
1620 ELSE
1621 CALL VRMessage VRWindow(), NLSGetMessage( 192 ), NLSGetMessage( 16 ), 'I'
1622 END
1623 END
1624
1625 /* Refresh the list */
1626 CALL GetPrinterPaks
1627RETURN 0
1628
1629/*:VRX PB_PRINTER_ADD_Click
1630*/
1631PB_PRINTER_ADD_Click:
1632 CALL PrinterWizard
1633RETURN
1634
1635/*:VRX PB_PRINTER_DEL_Click
1636*/
1637PB_PRINTER_DEL_Click:
1638 CALL PrinterDelete
1639return
1640
1641/*:VRX PB_PRINTER_EDIT_Click
1642*/
1643PB_PRINTER_EDIT_Click:
1644 CALL PrinterProperties
1645RETURN
1646
1647/*:VRX PB_PRINTER_EDIT_KeyPress
1648*/
1649PB_PRINTER_EDIT_KeyPress:
1650 IF VRGet('PB_PRINTER_EDIT', 'KeyString') == '{Tab}' THEN
1651 CALL VRMethod 'TDL_MAIN', 'SetFocus'
1652return
1653
1654/*:VRX PB_PRINTER_OPEN_Click
1655*/
1656PB_PRINTER_OPEN_Click:
1657 CALL PrinterOpen
1658RETURN
1659
1660/*:VRX PB_WIZARD_CANCEL_Click
1661*/
1662PB_WIZARD_CANCEL_Click:
1663
1664 CALL SW_WIZARD_Close
1665
1666return
1667
1668/*:VRX PB_WIZARD_NEXT_Click
1669*/
1670PB_WIZARD_NEXT_Click: PROCEDURE EXPOSE globals.
1671 SELECT
1672 WHEN VRGet('RB_CREATE_CUPS', 'Set') == 1 THEN DO
1673 globals.!create_mode = 'C'
1674 CALL New_CUPS
1675 END
1676 WHEN ( VRGet('RB_CREATE_LEGACY', 'Set') == 1 ) & ( VRGet('RB_CREATE_STANDARD', 'Set') == 1 ) THEN DO
1677 globals.!create_mode = 'S'
1678 CALL New_Standard
1679 END
1680 WHEN ( VRGet('RB_CREATE_LEGACY', 'Set') == 1 ) & ( VRGet('RB_CREATE_LAN', 'Set') == 1 ) THEN DO
1681 globals.!create_mode = 'L'
1682 CALL New_LAN
1683 END
1684 OTHERWISE DO
1685 globals.!create_mode = ''
1686 globals.!wizard = 0
1687 END
1688 END
1689 CALL SW_WIZARD_Fini
1690
1691RETURN
1692
1693/*:VRX PortAdd
1694*/
1695PortAdd: PROCEDURE EXPOSE globals.
1696
1697 updated = 0
1698 CALL VRLoadSecondary 'SW_PORT_ADD', 'W'
1699 IF updated == 1 THEN
1700 CALL RefreshPorts
1701
1702RETURN
1703
1704/*:VRX PortDelete
1705*/
1706PortDelete: PROCEDURE EXPOSE globals.
1707 PARSE ARG record
1708 IF record == '' THEN DO
1709 ok = VRMethod( "CN_PORTS", "GetRecordList", "Selected", "recs." )
1710 IF ok == 0 | recs.0 < 1 THEN RETURN
1711 record = recs.1
1712 END
1713 CALL VRMethod 'CN_PORTS', 'SetRecordAttr', record, 'Source', 0
1714
1715 _name = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!name )
1716
1717 printers.0 = 0
1718 CALL RPUEnumPrinters 'printers.'
1719 DO i = 1 TO printers.0
1720 CALL RPUPrinterQuery printers.i.!name, 'details.'
1721 IF _name == details.!port THEN DO
1722 _title = TRANSLATE( printers.i.!description, ' ', '0d0a'x)
1723 CALL VRMessage 'WN_MAIN', NLSGetMessage( 206, _name, _title ), NLSGetMessage( 207 ), 'W'
1724 RETURN
1725 END
1726 END
1727
1728 IF _name == '' THEN RETURN
1729 _btns.0 = 2
1730 _btns.1 = NLSGetMessage( 14 )
1731 _btns.2 = NLSGetMessage( 15 )
1732 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 202, _name ), NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
1733 IF _confirm == 1 THEN DO
1734 success = RPUPortDelete( _name )
1735 IF success == 1 THEN CALL RefreshPorts
1736 END
1737
1738RETURN
1739
1740/*:VRX PortProperties
1741*/
1742PortProperties: PROCEDURE EXPOSE globals.
1743 PARSE ARG record
1744 IF record == '' THEN DO
1745 ok = VRMethod( "CN_PORTS", "GetRecordList", "Selected", "recs." )
1746 IF ok == 0 | recs.0 < 1 THEN RETURN
1747 record = recs.1
1748 END
1749
1750 _name = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!name )
1751 _module = VRMethod('CN_PORTS', 'GetFieldData', record, globals.!hcfPorts.!driver )
1752 IF _module == '' THEN DO
1753 CALL VRMessage VRWindow(), NLSGetMessage( 211, _name ), NLSGetMessage( 210 ), 'N'
1754 RETURN
1755 END
1756
1757 CALL RPUPortDialog _module, _name
1758
1759 CALL VRMethod 'CN_PORTS', 'SetRecordAttr', record, 'Source', 0
1760RETURN
1761
1762/*:VRX PrinterDelete
1763*/
1764PrinterDelete: PROCEDURE EXPOSE globals.
1765 PARSE ARG record
1766 IF record == '' THEN DO
1767 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1768 IF ok == 0 | recs.0 < 1 THEN RETURN 0
1769 record = recs.1
1770 END
1771 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1772
1773 success = 0
1774 _title = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!title )
1775 _device= VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!name )
1776 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1777 _port = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!port )
1778
1779 _btns.0 = 2
1780 _btns.1 = NLSGetMessage( 14 )
1781 _btns.2 = NLSGetMessage( 15 )
1782 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 201, _title ), NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
1783 IF _confirm == 1 THEN DO
1784 IF _queue == '' THEN
1785 success = RPUDeviceDelete( _device )
1786 ELSE
1787 success = RPUPrinterDelete( _queue )
1788 CALL RPUPortInfo _port, 'port.'
1789 IF port.!driver == 'CUPS' THEN DO
1790 /* If this corresponds to a locally-defined CUPS queue, offer to
1791 * to delete that as well.
1792 */
1793 cups_prnt = RPUPortQuery('CUPS', _port )
1794 IF cups_prnt <> '' & ( LENGTH( cups_prnt ) == 130 ) THEN DO
1795 PARSE VAR cups_prnt 1 _cups_host 66 _cups_queue
1796 PARSE VAR _cups_host cups_host '00'x .
1797 PARSE VAR _cups_queue cups_queue '00'x .
1798 IF ( TRANSLATE( cups_host ) == 'LOCALHOST') | cups_host = '127.0.0.1' THEN DO
1799 _confirm = VRMessage('WN_MAIN', NLSGetMessage( 204, _title, cups_queue, _port ),,
1800 NLSGetMessage( 200 ), 'Q', '_btns.', 2, 2 )
1801 IF _confirm == 1 THEN DO
1802 success = CupsDeletePrinter( cups_host, cups_queue )
1803 IF success == 0 THEN DO
1804 CALL RPUPortDelete _port
1805 CALL RefreshPorts
1806 END
1807 ELSE
1808 CALL VRMessage 'WN_MAIN', NLSGetMessage( 251, cups_queue, success ), NLSGetMessage( 18 ), 'E'
1809 END
1810 END
1811 END
1812 END
1813 END
1814
1815 CALL RefreshPrinters
1816
1817RETURN success
1818
1819/*:VRX PrinterHold
1820*/
1821PrinterHold: PROCEDURE EXPOSE globals.
1822 PARSE ARG record
1823 IF record == '' THEN DO
1824 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1825 IF ok == 0 | recs.0 < 1 THEN RETURN
1826 record = recs.1
1827 END
1828 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1829 _flags = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!flags )
1830 _p = POS('P', _flags )
1831 IF _p > 0 THEN DO
1832 ok = RPUQueueHold( _queue, 'N')
1833 IF ok == 1 THEN DO
1834 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 0
1835 _flags = DELSTR( _flags, _p, 1 )
1836 CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1837 END
1838 END
1839 ELSE DO
1840 ok = RPUQueueHold( _queue, 'Y')
1841 IF ok == 1 THEN DO
1842 CALL VRSet 'MI_PRINTER_HOLD', 'Checked', 1
1843 _flags = _flags'P'
1844 CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1845 END
1846 END
1847
1848 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1849RETURN
1850
1851/*:VRX PrinterOpen
1852*/
1853PrinterOpen: PROCEDURE EXPOSE globals.
1854 PARSE ARG record
1855 IF record == '' THEN DO
1856 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1857 IF ok == 0 | recs.0 < 1 THEN RETURN
1858 record = recs.1
1859 END
1860
1861 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1862 IF _queue <> '' THEN
1863 CALL RPUOpenView _queue, 'O'
1864
1865 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1866RETURN
1867
1868/*:VRX PrinterProperties
1869*/
1870PrinterProperties: PROCEDURE EXPOSE globals.
1871 PARSE ARG record
1872 IF record == '' THEN DO
1873 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1874 IF ok == 0 | recs.0 < 1 THEN RETURN
1875 record = recs.1
1876 END
1877
1878 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1879 IF _queue <> '' THEN
1880 CALL RPUOpenView _queue, 'S'
1881
1882 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1883RETURN
1884
1885/*:VRX PrinterSetDefault
1886*/
1887PrinterSetDefault: PROCEDURE EXPOSE globals.
1888 PARSE ARG record
1889 IF record == '' THEN DO
1890 ok = VRMethod( "CN_PRINTERS", "GetRecordList", "Selected", "recs." )
1891 IF ok == 0 | recs.0 < 1 THEN RETURN 0
1892 record = recs.1
1893 END
1894 _queue = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!queue )
1895 ok = RPUQueueDefault( _queue )
1896
1897/*** Would also need to remove 'D' flag from previous default printer. Simpler
1898 *** just to call RefreshPrinters (below) instead.
1899 *
1900 * IF ok == 1 THEN DO
1901 * CALL VRSet 'MI_PRINTER_DEFAULT', 'Checked', 1
1902 * _flags = VRMethod('CN_PRINTERS', 'GetFieldData', record, globals.!hcfPrinters.!flags )
1903 * IF POS( _flags, 'D') == 0 THEN DO
1904 * _flags = 'D'_flags
1905 * CALL VRMethod 'CN_PRINTERS', 'SetFieldData', record, globals.!hcfPrinters.!flags, _flags
1906 * END
1907 * END
1908 */
1909
1910 CALL VRMethod 'CN_PRINTERS', 'SetRecordAttr', record, 'Source', 0
1911 CALL RefreshPrinters
1912RETURN ok
1913
1914/*:VRX PrinterWizard
1915*/
1916PrinterWizard: PROCEDURE EXPOSE globals.
1917 CALL VRLoadSecondary 'SW_WIZARD', 'N'
1918RETURN
1919
1920/*:VRX Quit
1921*/
1922Quit:
1923 window = VRWindow()
1924 call VRSet window, "Shutdown", 1
1925 drop window
1926return
1927
1928/*:VRX RB_ADVANCED_Click
1929*/
1930RB_ADVANCED_Click: PROCEDURE
1931 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 0
1932 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 0
1933RETURN
1934
1935/*:VRX RB_CREATE_CUPS_Click
1936*/
1937RB_CREATE_CUPS_Click: PROCEDURE
1938 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 0
1939 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 0
1940RETURN
1941
1942/*:VRX RB_CREATE_LEGACY_Click
1943*/
1944RB_CREATE_LEGACY_Click: PROCEDURE
1945 CALL VRSet 'RB_CREATE_STANDARD', 'Enabled', 1
1946 CALL VRSet 'RB_CREATE_LAN', 'Enabled', 1
1947RETURN
1948
1949/*:VRX RB_DEVICE_3RDPARTY_Click
1950*/
1951RB_DEVICE_3RDPARTY_Click: PROCEDURE EXPOSE globals. shipped.
1952 CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Enabled', 1
1953 CALL VRSet 'PB_DEVICE_OTHER', 'Enabled', 1
1954 CALL VRSet 'PB_DEVICE_REFRESH', 'Enabled', 1
1955 CALL SetDriverList
1956RETURN
1957
1958/*:VRX RB_DEVICE_SHIPPED_Click
1959*/
1960RB_DEVICE_SHIPPED_Click: PROCEDURE EXPOSE globals. shipped.
1961 CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Enabled', 0
1962 CALL VRSet 'PB_DEVICE_OTHER', 'Enabled', 0
1963 CALL VRSet 'PB_DEVICE_REFRESH', 'Enabled', 0
1964 CALL SetDriverList
1965RETURN
1966
1967
1968/*:VRX RefreshDevices
1969*/
1970RefreshDevices: PROCEDURE EXPOSE globals.
1971
1972 ok = RPUEnumDrivers('drivers.')
1973 IF rc <> 0 THEN DO
1974 CALL VRSet 'CN_DEVICES', 'Painting', 0
1975 CALL VRMethod 'CN_DEVICES', 'RemoveRecord', 'All'
1976 DO i = 1 TO drivers.0
1977 PARSE VAR drivers.i _pdrv'.'_model
1978 IF _pdrv == 'IBMNULL' & _model == '' THEN
1979 _model = NLSGetMessage( 106 )
1980 ELSE IF _model == '' THEN
1981 _model = '-'
1982 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _pdrv, 'USER') WITH _drvspec '00'x .
1983 driverinfo.i = ';'drivers.i';'_drvspec';;;'globals.!hcfDevices.!icon';'_drvspec';'globals.!hcfDevices.!model';'_model';'globals.!hcfDevices.!driver';'_pdrv
1984 END
1985 driverinfo.0 = drivers.0
1986 ok = VRMethod( "CN_DEVICES", "AddRecordList",,, "driverinfo.")
1987 DROP drivers.
1988 DROP driverinfo.
1989 CALL VRSet 'CN_DEVICES', 'Painting', 1
1990 END
1991
1992RETURN
1993
1994/*:VRX RefreshPorts
1995*/
1996RefreshPorts: PROCEDURE EXPOSE globals.
1997
1998 ok = RPUEnumPorts('ports.')
1999 IF rc <> 0 THEN DO
2000 CALL VRSet 'CN_PORTS', 'Painting', 0
2001 CALL VRMethod 'CN_PORTS', 'RemoveRecord', 'All'
2002 DO i = 1 TO ports.0
2003 PARSE VAR ports.i _name _driver _path
2004 SELECT
2005 WHEN _name == 'FILE' THEN _icon = '$24,PMWP'
2006 WHEN _driver == 'USBPRT' THEN _icon = '$7001,'_path
2007 WHEN _driver == 'SERIAL' THEN _icon = '$7001,'_path
2008 WHEN _driver == 'PARALLEL' THEN _icon = '$7001,'_path
2009 WHEN _driver == 'SLPR' THEN _icon = '$7001,'_path
2010 WHEN _driver == 'LPRPDRVR' THEN _icon = '$256,'_path
2011/*
2012 WHEN _driver == 'USBPRT' THEN _icon = '$7'
2013 WHEN _driver == 'SMB' THEN _icon = '$6'
2014 WHEN _driver == 'SLPR' THEN _icon = '$6'
2015 WHEN _driver == 'LPR32' THEN _icon = '$6'
2016 WHEN _driver == 'LPRPDRVR' THEN _icon = '$6'
2017 WHEN _driver == 'CUPS' THEN _icon = '$10'
2018 OTHERWISE _icon = '$5'
2019*/
2020 OTHERWISE _icon = _path
2021 END
2022
2023 portinfo.i = ';'_name';'_icon';;;'globals.!hcfPorts.!icon';'_icon';'globals.!hcfPorts.!name';'_name';'globals.!hcfPorts.!driver';'_driver';'
2024 END
2025 portinfo.0 = ports.0
2026 ok = VRMethod( "CN_PORTS", "AddRecordList",,, "portinfo.")
2027 DROP ports.
2028 DROP portinfo.
2029 CALL VRSet 'CN_PORTS', 'Painting', 1
2030 END
2031
2032RETURN
2033
2034/*:VRX RefreshPrinters
2035*/
2036RefreshPrinters: PROCEDURE EXPOSE globals.
2037 ok = RPUEnumPrinters('printers.')
2038 IF ok <> 0 THEN DO
2039 CALL VRSet 'CN_PRINTERS', 'Painting', 0
2040 CALL VRMethod 'CN_PRINTERS', 'RemoveRecord', 'All'
2041
2042 DO i = 1 TO printers.0
2043 _title = TRANSLATE( printers.i.!description, ' ', '0d0a'x)
2044 ok = RPUPrinterQuery( printers.i.!name, 'details.')
2045 IF ok == 0 THEN DO
2046 _driver = '?'
2047 _port = '?'
2048 END
2049 ELSE DO
2050 PARSE VAR details.!drivers _driver ',' .
2051 _port = details.!port
2052 END
2053 IF printers.i.!host <> '' THEN
2054 _icon = '$65,PMWP'
2055 ELSE IF _driver <> '?' THEN DO
2056 PARSE VAR _driver _pdrv'.'_model
2057 PARSE VALUE VRGetIni('PM_DEVICE_DRIVERS', _pdrv, 'USER') WITH _icon '00'x .
2058 END
2059 ELSE _icon = '$2'
2060
2061 printerinfo.i = ';'printers.i.!description';'_icon';;;' ||,
2062 globals.!hcfPrinters.!title';'_title';' ||,
2063 globals.!hcfPrinters.!icon';'_icon';' ||,
2064 globals.!hcfPrinters.!name';'printers.i.!name';' ||,
2065 globals.!hcfPrinters.!queue';'printers.i.!queue';' ||,
2066 globals.!hcfPrinters.!host';'printers.i.!host';' ||,
2067 globals.!hcfPrinters.!port';'_port';' ||,
2068 globals.!hcfPrinters.!driver';'_driver';' ||,
2069 globals.!hcfPrinters.!flags';'printers.i.!flags';' ||,
2070 globals.!hcfPrinters.!handle';'printers.i.!handle';'
2071 END
2072 printerinfo.0 = printers.0
2073 ok = VRMethod( "CN_PRINTERS", "AddRecordList",,, "printerinfo.")
2074 DROP printers.
2075 DROP printerinfo.
2076 DROP details.
2077
2078 CALL VRSet 'CN_PRINTERS', 'Painting', 1
2079 END
2080
2081RETURN
2082
2083/*:VRX SetDriverList
2084*/
2085SetDriverList: PROCEDURE EXPOSE globals. shipped.
2086 ARG driver_path
2087
2088 CALL VRSet VRWindow(), 'Pointer', 'WAIT'
2089 CALL VRMethod 'CN_DEVICE_LIST', 'RemoveRecord', 'All'
2090
2091 IF VRGet('RB_DEVICE_SHIPPED', 'Set') == 1 THEN DO
2092 CALL VRMethod 'CN_DEVICE_LIST', 'AddRecordList',,, 'shipped.'
2093 END
2094 ELSE DO
2095 IF driver_path == '' THEN
2096 driver_path = TRANSLATE( STRIP( VRGet('DDCB_DEVICE_3RDPARTY', 'Value')))
2097 IF driver_path <> '' THEN DO
2098 drivers.0 = 0
2099 _total = 0
2100 CALL SysFileTree driver_path'\*.DRV', 'drivers.', 'FO'
2101 DO i = 1 TO drivers.0
2102 list.0 = 0
2103 IF SysGetEA( drivers.i, '.EXPAND', 'eaval') == 0 THEN DO
2104 PARSE VAR eaval 3 ealen 5 models
2105 offs = 1
2106 datalen = C2D( REVERSE( ealen ))
2107 DO WHILE offs <= datalen
2108 start = SUBSTR( models, offs )
2109 inc = POS('00'x, start )
2110 IF inc > 1 THEN DO
2111 current_name = STRIP( SUBSTR( start, 1, inc-1 ))
2112 _total = _total + 1
2113 list._total = ';'_desc';#2;;;NAME;'current_name';DRIVER;'|| TRANSLATE( drivers.i ) ||';'
2114 END
2115 offs = offs + inc
2116 END
2117 END
2118 END
2119
2120 list.0 = _total
2121 CALL VRSortStem 'list.'
2122 CALL VRMethod 'CN_DEVICE_LIST', 'AddRecordList',,, 'list.'
2123 CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'UserData', driver_path
2124 END
2125 END
2126
2127 CALL VRSet VRWindow(), 'Pointer', '<default>'
2128
2129RETURN
2130
2131/*:VRX SetLanguage
2132*/
2133SetLanguage: PROCEDURE EXPOSE globals.
2134 PARSE ARG locale
2135
2136 /*
2137 * This function locates the proper language files, and uses the message
2138 * file to sets all UI text. If the language could not be determined, we
2139 * default to English.
2140 */
2141 execPath = VRGet('Application', 'Program')
2142 execDir = VRParseFileName( execPath, 'DP')
2143
2144 /*
2145 * First, figure out what language/message file to use.
2146 */
2147 IF locale <> '' THEN
2148 syslanguage = locale
2149 ELSE
2150 syslanguage = VALUE('LANG',,'OS2ENVIRONMENT')
2151
2152 SELECT
2153 WHEN TRANSLATE( syslanguage ) == 'ZH_TW' THEN nlv = 'tw'
2154 WHEN TRANSLATE( syslanguage ) == 'ZH_CN' THEN nlv = 'cx'
2155 OTHERWISE PARSE VAR syslanguage nlv '_' .
2156 END
2157 nlvfile = globals.!nlsname || nlv
2158 IF ( STREAM( execDir'\'nlvfile'.msg', 'C', 'QUERY EXISTS') \= '') | ( SysSearchPath('DPATH', nlvfile'.msg') \= '') THEN DO
2159 globals.!messages = nlvfile'.msg'
2160 helpfile = nlvfile'.hlp'
2161 CALL VRSet 'WN_MAIN', 'HelpFile', helpfile
2162 END
2163 ELSE DO
2164 globals.!messages = globals.!nlsname || 'en.msg'
2165 helpfile = globals.!nlsname || 'en.hlp'
2166 CALL VRSet 'WN_MAIN', 'HelpFile', helpfile
2167 END
2168
2169 /*
2170 * If the message file is missing or unreadable, display an error and then exit.
2171 */
2172 IF NLSGetMessage( 1 ) == '' THEN DO
2173 CALL VRMessage VRWindow(), 'Language file' TRANSLATE( globals.!messages ) 'could not be loaded.', 'Cannot Continue', 'E'
2174 RETURN 0
2175 END
2176
2177 /*
2178 * Now set the captions for the UI controls on the main window, according
2179 * to the specified language.
2180 */
2181 CALL NLSSetText 'WN_MAIN', 'Caption', 1
2182 CALL VRMethod 'TDL_MAIN', 'SetTabText', 1, NLSGetMessage( 100 )
2183 CALL VRMethod 'TDL_MAIN', 'SetTabText', 2, NLSGetMessage( 101 )
2184 CALL VRMethod 'TDL_MAIN', 'SetTabText', 3, NLSGetMessage( 102 )
2185
2186 CALL NLSSetText 'MN_PROGRAM', 'Caption', 20
2187 CALL NLSSetText 'MI_MANAGE', 'Caption', 21
2188 CALL NLSSetText 'MI_IMPORT', 'Caption', 22
2189 CALL NLSSetText 'MI_QUIT', 'Caption', 29
2190
2191 CALL NLSSetText 'MN_PRINTER', 'Caption', 30
2192 CALL NLSSetText 'MI_PRINTER_OPEN', 'Caption', 31
2193 CALL NLSSetText 'MI_PRINTER_PROPS', 'Caption', 32
2194 CALL NLSSetText 'MI_PRINTER_HOLD', 'Caption', 33
2195 CALL NLSSetText 'MI_PRINTER_DEFAULT', 'Caption', 34
2196 CALL NLSSetText 'MI_PRINTER_CREATE', 'Caption', 35
2197 CALL NLSSetText 'MI_PRINTER_DELETE', 'Caption', 36
2198
2199 CALL NLSSetText 'MN_PORT', 'Caption', 40
2200 CALL NLSSetText 'MI_PORT_CREATE', 'Caption', 41
2201 CALL NLSSetText 'MI_PORT_DELETE', 'Caption', 42
2202 CALL NLSSetText 'MI_PORT_PROPS', 'Caption', 43
2203
2204 CALL NLSSetText 'MN_DRIVERS', 'Caption', 50
2205 CALL NLSSetText 'MI_DRIVERS_INSTALL', 'Caption', 51
2206 CALL NLSSetText 'MI_DRIVERS_REMOVE', 'Caption', 52
2207
2208 CALL NLSSetText 'MN_VIEW', 'Caption', 60
2209 CALL NLSSetText 'MI_DETAILVIEW', 'Caption', 61
2210 CALL NLSSetText 'MI_ICONVIEW', 'Caption', 62
2211 CALL NLSSetText 'MI_REFRESH', 'Caption', 63
2212
2213 CALL NLSSetText 'MI_CONTEXT_INSTALL', 'Caption', 8
2214 CALL NLSSetText 'MI_CONTEXT_DETAIL', 'Caption', 61
2215 CALL NLSSetText 'MI_CONTEXT_ICON', 'Caption', 62
2216 CALL NLSSetText 'MI_CONTEXT_REFRESH', 'Caption', 63
2217
2218 CALL NLSSetText 'MN_PRINTERPAK', 'Caption', 70
2219 CALL NLSSetText 'MI_PPAK_MODELS', 'Caption', 71
2220 CALL NLSSetText 'MI_PPAK_COPY', 'Caption', 72
2221
2222 CALL NLSSetText 'MN_HELP', 'Caption', 80
2223 CALL NLSSetText 'MI_HELP_GENERAL', 'Caption', 81
2224 CALL NLSSetText 'MI_ABOUT', 'Caption', 89
2225
2226 CALL VRMethod 'WN_MAIN', 'InstallAccelerators'
2227
2228RETURN 1
2229
2230/*:VRX SW_ABOUT_Close
2231*/
2232SW_ABOUT_Close:
2233 call SW_ABOUT_Fini
2234return
2235
2236/*:VRX SW_ABOUT_Create
2237*/
2238SW_ABOUT_Create:
2239 call SW_ABOUT_Init
2240return
2241
2242/*:VRX SW_ABOUT_Fini
2243*/
2244SW_ABOUT_Fini:
2245 window = VRInfo( "Window" )
2246 call VRDestroy window
2247 drop window
2248return
2249/*:VRX SW_ABOUT_Init
2250*/
2251SW_ABOUT_Init: PROCEDURE EXPOSE globals.
2252
2253 IF globals.!is_ecs == 1 THEN
2254 _platform = 'eComStation'
2255 ELSE
2256 _platform = 'PM'
2257
2258 CALL NLSSetText 'SW_ABOUT', 'Caption', 130
2259 CALL NLSSetText 'DT_PRODUCT', 'Caption', 131, _platform
2260 CALL NLSSetText 'DT_VERSION', 'Caption', 132, globals.!version
2261 CALL NLSSetText 'DT_COPYRIGHT', 'Caption', 133, globals.!copyright
2262 CALL NLSSetText 'PB_ABOUT_OK', 'Caption', 2
2263
2264 PARSE VERSION _rexxver
2265 PARSE VALUE VRVersion('VROBJ.DLL') WITH _vrver .
2266 PARSE VALUE RPUVersion() WITH _rpuver .
2267 PARSE VALUE VRXVersion() WITH _vrxver .
2268 _pr1ver = PRVersion()
2269 _wptver = WPToolsVersion()
2270 _bullet = NLSGetMessage( 135 )
2271 CALL VRSet 'MLE_LICENSES', 'Value', NLSGetMessage( 134, _rexxver ) || '0a'x ,
2272 _bullet 'IBM REXXUTIL' SysUtilVersion() || '0a'x ,
2273 _bullet 'VX-REXX VROBJ' _vrver || '0a'x ,
2274 _bullet 'VX-REXX Extras (VROBJEX)' _vrxver || '0a'x ,
2275 _bullet 'RXPRTUTL' _rpuver || '0a'x ,
2276 _bullet 'WPTOOLS' _wptver || '0a'x ,
2277 _bullet _pr1ver || '0a'x||' ----- '||'0a'x || ,
2278 NLSGetMessage( 137 ) || '0a'x' ----- '||'0a'x || ,
2279 NLSGetMessage( 138 )
2280
2281 window = VRInfo( "Object" )
2282 if( \VRIsChildOf( window, "Notebook" ) ) then do
2283 call VRMethod window, "CenterWindow"
2284 call VRSet window, "Visible", 1
2285 call VRMethod window, "Activate"
2286 end
2287 drop window
2288return
2289
2290/*:VRX SW_DEVICE_ADD_Close
2291*/
2292SW_DEVICE_ADD_Close:
2293 call SW_DEVICE_ADD_Fini
2294return
2295
2296/*:VRX SW_DEVICE_ADD_Create
2297*/
2298SW_DEVICE_ADD_Create:
2299 call SW_DEVICE_ADD_Init
2300return
2301
2302/*:VRX SW_DEVICE_ADD_Fini
2303*/
2304SW_DEVICE_ADD_Fini:
2305 window = VRInfo( "Window" )
2306 call VRDestroy window
2307 drop window
2308return
2309/*:VRX SW_DEVICE_ADD_Init
2310*/
2311SW_DEVICE_ADD_Init: PROCEDURE EXPOSE globals. shipped.
2312
2313 fld_name = VRMethod('CN_DEVICE_LIST', 'AddField', 'String', NLSGetMessage( 265 ), 'NAME')
2314 fld_driver = VRMethod('CN_DEVICE_LIST', 'AddField', 'String', NLSGetMessage( 266 ), 'DRIVER')
2315
2316 IF globals.!is_ecs == 1 THEN
2317 _platform = 'eComStation'
2318 ELSE
2319 _platform = 'OS/2'
2320 CALL NLSSetText 'SW_DEVICE_ADD', 'Caption', 260
2321 CALL NLSSetText 'RB_DEVICE_SHIPPED', 'Caption', 261, _platform
2322 CALL NLSSetText 'RB_DEVICE_3RDPARTY', 'Caption', 262, _platform
2323 CALL NLSSetText 'PB_DEVICE_OTHER', 'Caption', 188
2324 CALL NLSSetText 'PB_DEVICE_REFRESH', 'Caption', 63
2325 CALL NLSSetText 'PB_DEVICE_INSTALL', 'Caption', 2
2326 CALL NLSSetText 'PB_DEVICE_CANCEL', 'Caption', 3
2327
2328 window = VRInfo( "Object" )
2329 CALL VRSet window, 'Pointer', 'WAIT'
2330
2331 extras_num = 0
2332 PARSE UPPER VALUE VRGetIni('PrinterManager', 'LastDriverPath', 'USER') WITH last_path '00'x .
2333 IF last_path <> '' THEN DO
2334 extras_num = extras_num + 1
2335 extras_path.extras_num = last_path
2336 END
2337 PARSE UPPER VALUE VRGetIni('PrinterManager', 'ThirdParty', 'USER') WITH known_3p '00'x .
2338 IF known_3p == '' THEN known_3p = 'ECUPS ECUPS-HP GUTENPRT PSPRINT'
2339 DO i = 1 TO WORDS( known_3p )
2340 _basename = WORD( known_3p, i )
2341 _ppdriver = _basename'.DRV'
2342 _ppini = VRGetIni('PM_INSTALL', _basename'_DIR', 'USER')
2343 IF _ppini == '' THEN ITERATE
2344 PARSE VAR _ppini _pppath '00'x .
2345 IF VRFileExists( _pppath'\'_ppdriver ) THEN DO
2346 extras_num = extras_num + 1
2347 extras_name.extras_num = _ppdriver
2348 extras_path.extras_num = _pppath
2349 END
2350 END
2351 extras_name.0 = extras_num
2352 extras_path.0 = extras_num
2353 CALL VRMethod 'DDCB_DEVICE_3RDPARTY', 'AddStringList', 'extras_path.'
2354 IF extras_num > 0 THEN CALL VRSet 'DDCB_DEVICE_3RDPARTY', 'Selected', 1
2355
2356 if( \VRIsChildOf( window, "Notebook" ) ) then do
2357 call VRMethod window, "CenterWindow"
2358 call VRSet window, "Visible", 1
2359 call VRMethod window, "Activate"
2360 end
2361
2362 IF GetShippedDrivers() > 0 THEN DO
2363/* CALL VRMethod 'CN_DEVICE_LIST', 'AddRecordList',,, 'shipped.' */
2364 END
2365
2366 CALL VRSet window, 'Pointer', '<default>'
2367 drop window
2368
2369RETURN
2370
2371/*:VRX SW_DEVICES_Close
2372*/
2373SW_DEVICES_Close:
2374 call SW_DEVICES_Fini
2375return
2376
2377/*:VRX SW_DEVICES_Create
2378*/
2379SW_DEVICES_Create:
2380 call SW_DEVICES_Init
2381return
2382
2383/*:VRX SW_DEVICES_Fini
2384*/
2385SW_DEVICES_Fini:
2386 window = VRInfo( "Window" )
2387 call VRDestroy window
2388 drop window
2389return
2390/*:VRX SW_DEVICES_Init
2391*/
2392SW_DEVICES_Init: PROCEDURE EXPOSE globals.
2393
2394 globals.!hcfDevices.!icon = VRMethod( "CN_DEVICES", "AddField", "Icon", "" )
2395 globals.!hcfDevices.!model = VRMethod( "CN_DEVICES", "AddField", "String", NLSGetMessage( 111 ))
2396 globals.!hcfDevices.!driver = VRMethod( "CN_DEVICES", "AddField", "String", NLSGetMessage( 116 ))
2397
2398 CALL VRSet "CN_DEVICES", "DetailSort", globals.!hcfDevices.!model
2399 ok = VRMethod( "CN_DEVICES", "SetFieldAttr", globals.!hcfDevices.!icon, "HorizSeparator", "0" )
2400
2401 CALL NLSSetText 'CN_DEVICES', 'Caption', 104
2402 CALL NLSSetText 'PB_DEVICE_ADD', 'Caption', 8
2403 CALL NLSSetText 'PB_DEVICE_REMOVE', 'Caption', 9
2404
2405 CALL RefreshDevices
2406
2407 window = VRInfo( "Object" )
2408 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2409 call VRMethod window, "CenterWindow"
2410 call VRSet window, "Visible", 1
2411 call VRMethod window, "Activate"
2412 end
2413
2414 CALL VRSet window, 'UserData', 'CN_DEVICES'
2415 drop window
2416/*
2417 globals.!initstate = globals.!initstate + 1
2418 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
2419*/
2420RETURN
2421
2422/*:VRX SW_IMPORT_Close
2423*/
2424SW_IMPORT_Close:
2425 call SW_IMPORT_Fini
2426return
2427
2428/*:VRX SW_IMPORT_Create
2429*/
2430SW_IMPORT_Create:
2431 call SW_IMPORT_Init
2432return
2433
2434/*:VRX SW_IMPORT_Fini
2435*/
2436SW_IMPORT_Fini:
2437 window = VRInfo( "Window" )
2438 call VRDestroy window
2439 drop window
2440return
2441/*:VRX SW_IMPORT_Init
2442*/
2443SW_IMPORT_Init: PROCEDURE EXPOSE globals. new_ppd
2444
2445 CALL NLSSetText 'SW_IMPORT', 'Caption', 236
2446 CALL NLSSetText 'DT_IMPORT', 'Caption', 233
2447 CALL NLSSetText 'RB_IMPORTCUPS', 'Caption', 234
2448 CALL NLSSetText 'RB_IMPORTLEGACY', 'Caption', 235
2449 CALL NLSSetText 'PB_IMPORTOK', 'Caption', 2
2450 CALL NLSSetText 'PB_IMPORTCANCEL', 'Caption', 3
2451
2452 _count = 0
2453 IF ( DriverIsInstalled('PSCRIPT') <> '') | ( GetDriverSource('PSCRIPT') <> '') THEN DO
2454 _count = _count + 1
2455 psdrv._count = 'PSCRIPT'
2456 END
2457 IF ( DriverIsInstalled('PSCRIPT2') <> '') | ( GetDriverSource('PSCRIPT2') <> '') THEN DO
2458 _count = _count + 1
2459 psdrv._count = 'PSCRIPT2'
2460 END
2461 IF ( DriverIsInstalled('PSPRINT') <> '') | ( GetDriverSource('PSPRINT') <> '') THEN DO
2462 _count = _count + 1
2463 psdrv._count = 'PSPRINT'
2464 END
2465 IF ( DriverIsInstalled('PSPRINT2') <> '') | ( GetDriverSource('PSPRINT2') <> '') THEN DO
2466 _count = _count + 1
2467 psdrv._count = 'PSPRINT2'
2468 END
2469 IF ( DriverIsInstalled('ECUPS') <> '') | ( GetDriverSource('ECUPS') <> '') THEN DO
2470 _count = _count + 1
2471 psdrv._count = 'ECUPS'
2472 END
2473 IF ( DriverIsInstalled('ECUPS-HP') <> '') | ( GetDriverSource('ECUPS-HP') <> '') THEN DO
2474 _count = _count + 1
2475 psdrv._count = 'ECUPS-HP'
2476 END
2477 IF DriverIsInstalled('GUTENPRT') <> '' THEN DO
2478 _count = _count + 1
2479 psdrv._count = 'GUTENPRT'
2480 END
2481
2482 IF _count < 1 THEN DO
2483 IF globals.!hascups == 0 THEN DO
2484 CALL VRMessage VRWindow(), NLSGetMessage( 237 ), NLSGetMessage( 13 ), 'E'
2485 CALL SW_IMPORT_Close
2486 END
2487 CALL VRSet 'RB_IMPORTCUPS', 'Set', 1
2488 CALL VRSet 'RB_IMPORTLEGACY', 'Enabled', 0
2489 CALL VRSet 'DDCB_IMPORTDRV', 'Enabled', 0
2490 END
2491 ELSE IF \globals.!hascups THEN DO
2492 CALL VRSet 'RB_IMPORTCUPS', 'Enabled', 0
2493 END
2494
2495 psdrv.0 = _count
2496 CALL VRMethod 'DDCB_IMPORTDRV', 'AddStringList', 'psdrv.'
2497 CALL VRSet 'DDCB_IMPORTDRV', 'Selected', 1
2498
2499 window = VRInfo( "Object" )
2500 if( \VRIsChildOf( window, "Notebook" ) ) then do
2501 call VRMethod window, "CenterWindow"
2502 call VRSet window, "Visible", 1
2503 call VRMethod window, "Activate"
2504 end
2505 drop window
2506RETURN
2507
2508/*:VRX SW_MODELS_Close
2509*/
2510SW_MODELS_Close:
2511 call SW_MODELS_Fini
2512return
2513
2514/*:VRX SW_MODELS_Create
2515*/
2516SW_MODELS_Create:
2517 call SW_MODELS_Init
2518return
2519
2520/*:VRX SW_MODELS_Fini
2521*/
2522SW_MODELS_Fini:
2523 window = VRInfo( "Window" )
2524 call VRDestroy window
2525 drop window
2526return
2527/*:VRX SW_MODELS_Init
2528*/
2529SW_MODELS_Init: PROCEDURE EXPOSE globals.
2530
2531 ok = VRMethod( "CN_PRINTERPAKS", "GetRecordList", "Selected", "recs." )
2532 IF ok == 0 | recs.0 < 1 THEN RETURN
2533 record = recs.1
2534
2535 _name = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!name )
2536 _path = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!path )
2537 _ver = VRMethod('CN_PRINTERPAKS', 'GetFieldData', record, globals.!hcfPaks.!version )
2538 IF _ver == '-' THEN _ver = '??'
2539 driver = _path'\'_name
2540
2541 CALL NLSSetText 'SW_MODELS', 'Caption', 194
2542 CALL NLSSetText 'PB_MODELS_CLOSE', 'Caption', 12
2543
2544 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
2545 ok = RPUEnumModels( driver, 'models.')
2546 IF ok == 1 THEN
2547 CALL VRMethod 'LB_MODELS', 'AddStringList', 'models.'
2548 CALL VRSet 'WN_MAIN', 'Pointer', '<default>'
2549
2550 CALL NLSSetText 'DT_MODELS', 'Caption', 195, _name, models.0
2551
2552 window = VRInfo( "Object" )
2553 if( \VRIsChildOf( window, "Notebook" ) ) then do
2554 call VRMethod window, "CenterWindow"
2555 call VRSet window, "Visible", 1
2556 call VRMethod window, "Activate"
2557 end
2558 drop window
2559
2560RETURN
2561
2562/*:VRX SW_PORT_ADD_Close
2563*/
2564SW_PORT_ADD_Close:
2565 call SW_PORT_ADD_Fini
2566return
2567
2568/*:VRX SW_PORT_ADD_Create
2569*/
2570SW_PORT_ADD_Create:
2571 call SW_PORT_ADD_Init
2572return
2573
2574/*:VRX SW_PORT_ADD_Fini
2575*/
2576SW_PORT_ADD_Fini:
2577 window = VRInfo( "Window" )
2578 call VRDestroy window
2579 drop window
2580return
2581/*:VRX SW_PORT_ADD_Init
2582*/
2583SW_PORT_ADD_Init: PROCEDURE EXPOSE globals. updated
2584
2585 fld_name = VRMethod('CN_ADDPORT', 'AddField', 'String',, 'NAME')
2586 fld_path = VRMethod('CN_ADDPORT', 'AddField', 'String',, 'PATH')
2587
2588 CALL NLSSetText 'SW_PORT_ADD', 'Caption', 160
2589 CALL NLSSetText 'DT_ADDPORT', 'Caption', 161
2590 CALL NLSSetText 'CN_ADDPORT', 'Caption', 162
2591 CALL NLSSetText 'DT_OTHERPORT', 'Caption', 163
2592 CALL NLSSetText 'PB_OTHERPORT', 'Caption', 164
2593
2594 CALL NLSSetText 'PB_ADDPORT_OK', 'Caption', 2
2595 CALL NLSSetText 'PB_ADDPORT_CANCEL', 'Caption', 3
2596
2597 IF GetPortDrivers() > 0 THEN DO
2598 objects.0 = portdrivers.0
2599 DO i = 1 TO portdrivers.0
2600 PARSE VAR portdrivers.i _name _path
2601 SELECT
2602 WHEN _name == 'FILE' THEN _icon = '$24,PMWP'
2603 WHEN _name == 'USBPRT' THEN _icon = '$7001,'_path
2604 WHEN _name == 'SERIAL' THEN _icon = '$7001,'_path
2605 WHEN _name == 'PARALLEL' THEN _icon = '$7001,'_path
2606 WHEN _name == 'SLPR' THEN _icon = '$7001,'_path
2607 WHEN _name == 'LPRPDRVR' THEN _icon = '$256,'_path
2608 OTHERWISE _icon = _path
2609 END
2610 objects.i = ';'_name';'_icon';;;'fld_name';'_name';'fld_path';'_path
2611 END
2612 CALL VRMethod 'CN_ADDPORT', 'AddRecordList',,, 'objects.'
2613 END
2614
2615 window = VRInfo( "Object" )
2616 if( \VRIsChildOf( window, "Notebook" ) ) then do
2617 call VRMethod window, "CenterWindow"
2618 call VRSet window, "Visible", 1
2619 call VRMethod window, "Activate"
2620 end
2621 drop window
2622RETURN
2623
2624/*:VRX SW_PORTS_Close
2625*/
2626SW_PORTS_Close:
2627 call SW_PORTS_Fini
2628return
2629
2630/*:VRX SW_PORTS_Create
2631*/
2632SW_PORTS_Create:
2633 call SW_PORTS_Init
2634return
2635
2636/*:VRX SW_PORTS_Fini
2637*/
2638SW_PORTS_Fini:
2639 window = VRInfo( "Window" )
2640 call VRDestroy window
2641 drop window
2642return
2643/*:VRX SW_PORTS_Init
2644*/
2645SW_PORTS_Init: PROCEDURE EXPOSE globals.
2646
2647 globals.!hcfPorts.!icon = VRMethod( "CN_PORTS", "AddField", "Icon", "" )
2648 globals.!hcfPorts.!name = VRMethod( "CN_PORTS", "AddField", "String", NLSGetMessage( 111 ))
2649 globals.!hcfPorts.!driver = VRMethod( "CN_PORTS", "AddField", "String", NLSGetMessage( 119 ))
2650
2651 CALL VRSet "CN_PORTS", "DetailSort", globals.!hcfPorts.!name
2652 ok = VRMethod( "CN_PORTS", "SetFieldAttr", globals.!hcfPorts.!icon, "HorizSeparator", "0" )
2653
2654 CALL NLSSetText 'CN_PORTS', 'Caption', 105
2655 CALL NLSSetText 'PB_PORT_ADD', 'Caption', 8
2656 CALL NLSSetText 'PB_PORT_DELETE', 'Caption', 9
2657 CALL NLSSetText 'PB_PORT_EDIT', 'Caption', 10
2658
2659 CALL RefreshPorts
2660
2661 window = VRInfo( "Object" )
2662 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2663 call VRMethod window, "CenterWindow"
2664 call VRSet window, "Visible", 1
2665 call VRMethod window, "Activate"
2666 end
2667
2668 CALL VRSet window, 'UserData', 'CN_PORTS'
2669 drop window
2670/*
2671 globals.!initstate = globals.!initstate + 1
2672 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
2673*/
2674RETURN
2675
2676/*:VRX SW_PRINTERPAKS_Close
2677*/
2678SW_PRINTERPAKS_Close:
2679 call SW_PRINTERPAKS_Fini
2680return
2681
2682/*:VRX SW_PRINTERPAKS_Create
2683*/
2684SW_PRINTERPAKS_Create:
2685 call SW_PRINTERPAKS_Init
2686return
2687
2688/*:VRX SW_PRINTERPAKS_Fini
2689*/
2690SW_PRINTERPAKS_Fini:
2691 window = VRInfo( "Window" )
2692 call VRDestroy window
2693 drop window
2694return
2695/*:VRX SW_PRINTERPAKS_Init
2696*/
2697SW_PRINTERPAKS_Init: PROCEDURE EXPOSE globals.
2698
2699 globals.!hcfPaks.!icon = VRMethod( "CN_PRINTERPAKS", "AddField", "Icon", "" )
2700 globals.!hcfPaks.!name = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 173 ))
2701 globals.!hcfPaks.!version= VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 181 ))
2702 globals.!hcfPaks.!status = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 176 ))
2703 globals.!hcfPaks.!path = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 175 ))
2704 globals.!hcfPaks.!desc = VRMethod( "CN_PRINTERPAKS", "AddField", "String", NLSGetMessage( 174 ))
2705 globals.!hcfPaks.!flags = VRMethod( "CN_PRINTERPAKS", "AddField", "String", 'FLAGS')
2706
2707 CALL VRSet "CN_PRINTERPAKS", "DetailSort", globals.!hcfPaks.!name
2708 ok = VRMethod( "CN_PRINTERPAKS", "SetFieldAttr", globals.!hcfPaks.!icon, "HorizSeparator", "0" )
2709 ok = VRMethod( "CN_PRINTERPAKS", "SetFieldAttr", globals.!hcfPaks.!flags, "Visible", "0" )
2710
2711 CALL NLSSetText 'SW_PRINTERPAKS', 'Caption', 170
2712 CALL NLSSetText 'DT_PRINTERPAKS', 'Caption', 171
2713 CALL NLSSetText 'PB_PPUPDATE', 'Caption', 179
2714 CALL NLSSetText 'PB_PPCLOSE', 'Caption', 12
2715
2716 CALL GetPrinterPaks
2717
2718 window = VRInfo( "Object" )
2719 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2720 call VRMethod window, "CenterWindow"
2721 call VRSet window, "Visible", 1
2722 call VRMethod window, "Activate"
2723 end
2724 drop window
2725return
2726
2727/*:VRX SW_PRINTERS_Close
2728*/
2729SW_PRINTERS_Close:
2730 call SW_PRINTERS_Fini
2731return
2732
2733/*:VRX SW_PRINTERS_Create
2734*/
2735SW_PRINTERS_Create:
2736 call SW_PRINTERS_Init
2737return
2738
2739/*:VRX SW_PRINTERS_Fini
2740*/
2741SW_PRINTERS_Fini:
2742 window = VRInfo( "Window" )
2743 call VRDestroy window
2744 drop window
2745return
2746/*:VRX SW_PRINTERS_Init
2747*/
2748SW_PRINTERS_Init: PROCEDURE EXPOSE globals.
2749
2750 CALL NLSSetText 'CN_PRINTERS', 'Caption', 103
2751 CALL NLSSetText 'PB_PRINTER_ADD', 'Caption', 8
2752 CALL NLSSetText 'PB_PRINTER_DEL', 'Caption', 9
2753 CALL NLSSetText 'PB_PRINTER_OPEN', 'Caption', 7
2754 CALL NLSSetText 'PB_PRINTER_EDIT', 'Caption', 10
2755
2756 globals.!hcfPrinters.!icon = VRMethod( "CN_PRINTERS", "AddField", "Icon", "" )
2757 globals.!hcfPrinters.!title = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 110 ))
2758 globals.!hcfPrinters.!name = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 112 ))
2759 globals.!hcfPrinters.!queue = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 113 ))
2760 globals.!hcfPrinters.!host = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 115 ))
2761 globals.!hcfPrinters.!driver = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 116 ))
2762 globals.!hcfPrinters.!port = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 117 ))
2763 globals.!hcfPrinters.!flags = VRMethod( "CN_PRINTERS", "AddField", "String", NLSGetMessage( 118 ))
2764 globals.!hcfPrinters.!handle = VRMethod( "CN_PRINTERS", "AddField", "String", "HANDLE" )
2765
2766 CALL VRSet 'CN_PRINTERS', 'DetailSort', globals.!hcfPrinters.!title
2767 CALL VRSet 'CN_PRINTERS', 'LastSplitField', globals.!hcfPrinters.!host
2768 CALL VRSet 'CN_PRINTERS', 'SplitBarLeft', 3000
2769
2770 ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!icon, "HorizSeparator", "0" )
2771 ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!handle, "Visible", "0" )
2772/* ok = VRMethod( "CN_PRINTERS", "SetFieldAttr", globals.!hcfPrinters.!flags, "Visible", "0" ) */
2773
2774 CALL RefreshPrinters
2775
2776 window = VRInfo( "Object" )
2777 if( \VRIsChildOf( window, "TabbedDialog" ) ) then do
2778 call VRMethod window, "CenterWindow"
2779 call VRSet window, "Visible", 1
2780 call VRMethod window, "Activate"
2781 end
2782
2783 CALL VRSet window, 'UserData', 'CN_PRINTERS'
2784 drop window
2785/*
2786 globals.!initstate = globals.!initstate + 1
2787 IF globals.!initstate == 3 THEN CALL VRSet 'TM_REFRESH', 'Enabled', 1
2788*/
2789
2790RETURN
2791
2792/*:VRX SW_PRINTERS_Resize
2793*/
2794SW_PRINTERS_Resize:
2795
2796return
2797
2798/*:VRX SW_WIZARD_Close
2799*/
2800SW_WIZARD_Close:
2801 call SW_WIZARD_Fini
2802return
2803
2804/*:VRX SW_WIZARD_Create
2805*/
2806SW_WIZARD_Create:
2807 call SW_WIZARD_Init
2808return
2809
2810/*:VRX SW_WIZARD_Fini
2811*/
2812SW_WIZARD_Fini:
2813 window = VRInfo( "Window" )
2814 call VRDestroy window
2815 drop window
2816
2817 IF globals.!wizard THEN CALL Quit
2818 ELSE DO
2819 call VRSet 'WN_MAIN', "Visible", 1
2820 IF globals.!create_mode == '' THEN DO
2821 call VRMethod 'WN_MAIN', "Activate"
2822 CALL VRMethod 'TDL_MAIN', 'SetFocus'
2823 END
2824 END
2825RETURN
2826/*:VRX SW_WIZARD_Init
2827*/
2828SW_WIZARD_Init:
2829
2830 CALL NLSSetText 'SW_WIZARD', 'Caption', 140
2831 IF globals.!wizard THEN
2832 CALL NLSSetText 'DT_WIZARD', 'Caption', 142
2833 ELSE
2834 CALL NLSSetText 'DT_WIZARD', 'Caption', 141
2835 CALL NLSSetText 'RB_CREATE_CUPS', 'Caption', 143
2836 CALL NLSSetText 'RB_CREATE_LEGACY', 'Caption', 144
2837 CALL NLSSetText 'RB_CREATE_STANDARD', 'Caption', 145
2838 CALL NLSSetText 'RB_CREATE_LAN', 'Caption', 146
2839 CALL NLSSetText 'RB_ADVANCED', 'Caption', 147
2840 CALL NLSSetText 'PB_WIZARD_NEXT', 'Caption', 11
2841 CALL NLSSetText 'PB_WIZARD_CANCEL', 'Caption', 3
2842 CALL NLSSetText 'PB_WIZARD_HELP', 'Caption', 4
2843
2844 IF globals.!wizard THEN CALL VRSet 'RB_ADVANCED', 'Visible', 1
2845 window = VRInfo( "Object" )
2846 if( \VRIsChildOf( window, "Notebook" ) ) then do
2847 call VRMethod window, "CenterWindow"
2848 call VRSet window, "Visible", 1
2849 call VRMethod window, "Activate"
2850 end
2851 drop window
2852
2853 globals.!create_mode = ''
2854
2855RETURN
2856
2857/*:VRX TDL_MAIN_PageSelected
2858*/
2859TDL_MAIN_PageSelected: PROCEDURE EXPOSE globals.
2860 _pageidx = VRInfo("Page")
2861 _pagewin = VRMethod( "TDL_MAIN", "GetPageWindow", _pageidx )
2862 _cnr = VRGet( _pagewin, "UserData")
2863 IF _cnr == '' THEN RETURN
2864
2865 _view = VRGet( _cnr, "View")
2866 IF _view == 'Detail' THEN DO
2867 CALL VRSet 'MI_ICONVIEW', 'Checked', 0
2868 CALL VRSet 'MI_DETAILVIEW', 'Checked', 1
2869 CALL VRSet 'MI_CONTEXT_ICON', 'Checked', 0
2870 CALL VRSet 'MI_CONTEXT_DETAIL', 'Checked', 1
2871 END
2872 ELSE DO
2873 CALL VRSet 'MI_ICONVIEW', 'Checked', 1
2874 CALL VRSet 'MI_DETAILVIEW', 'Checked', 0
2875 CALL VRSet 'MI_CONTEXT_ICON', 'Checked', 1
2876 CALL VRSet 'MI_CONTEXT_DETAIL', 'Checked', 0
2877 END
2878/*
2879 SELECT
2880 WHEN _cnr == 'CN_PRINTERS' THEN DO
2881 END
2882 WHEN _cnr == 'CN_PORTS' THEN DO
2883 END
2884 WHEN _cnr == 'CN_DEVICES' THEN DO
2885 END
2886 OTHERWISE DO
2887 END
2888 END
2889*/
2890RETURN
2891
2892/*:VRX WN_MAIN_Close
2893*/
2894WN_MAIN_Close:
2895 call Quit
2896return
2897
2898/*:VRX xxUpdatePrDesc
2899*/
2900xxUpdatePrDesc: PROCEDURE EXPOSE globals.
2901 ARG driver, fqn
2902
2903 IF globals.!prdesc == '' THEN RETURN 1
2904
2905 ok = RPUEnumModels( fqn, 'newdevs.')
2906 IF ok == 0 THEN RETURN 2
2907
2908 _count = 0
2909 CALL LINEIN globals.!prdesc, 1, 0
2910 DO WHILE LINES( globals.!prdesc )
2911 _next = LINEIN( globals.!prdesc )
2912 PARSE UPPER VAR _next WITH . ':' . '('_prdrv')' .
2913 IF _prdrv == driver THEN ITERATE
2914 _count = _count + 1
2915 prdefs.count = _next
2916 END
2917 CALL STREAM prdesc, 'C', 'CLOSE'
2918
2919 DO i = 1 TO devs.0
2920 _count = _count + 1
2921 prdefs._count = newdevs.i':' newdevs.i '('driver')'
2922 END
2923 prdefs.0 = count
2924
2925 CALL VRSortStem 'prdefs.'
2926
2927 _prdir = VRParseFileName( globals.!prdesc, 'DP')
2928 CALL VRCopyFile globals.!prdesc, _prdir'\PRDESC.BAK'
2929 CALL VRDeleteFile globals.!prdesc
2930 DO i = 1 TO prdefs.0
2931 CALL LINEOUT globals.!prdesc, prdefs.i
2932 END
2933 CALL LINEOUT globals.!prdesc
2934
2935RETURN 0
2936
Note: See TracBrowser for help on using the repository browser.