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