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

Last change on this file since 96 was 94, checked in by Alex Taylor, 3 years ago

Use system window-text font for UI, with dynamic scaling.
Fix command-line parsing when multiple parameters specified.
Double-clicking on a PrinterPak opens model view.

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