Changeset 18 for trunk/gui/printer/cupswiz/cupswiz.VRX
- Timestamp:
- Jan 23, 2013, 1:10:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/printer/cupswiz/cupswiz.VRX
r17 r18 119 119 CALL SetPage4 120 120 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 121 CALL VRSet 'DT_INFO', 'Caption', 'Creating printer...'121 CALL NLSSetText 'DT_INFO', 'Caption', 50 /* 50: Creating printer... */ 122 122 ok = CreatePrinter( globals.!os2printer ) 123 123 124 CALL VRSet 'DT_INFO', 'Caption', '' 124 125 CALL VRSet 'WN_MAIN', 'Pointer', '<default>' … … 126 127 IF ok <> 0 THEN DO 127 128 SELECT 128 WHEN ok == 1 THEN reason = 'Error importing PPD file.'129 WHEN ok == 2 THEN reason = 'Error creating CUPS printer. See' globals.!log1 'for more information.'130 WHEN ok == 3 THEN reason = 'Error creating printer object. See' globals.!log1 'for more information.'131 OTHERWISE reason = 'Unknown error.'132 END 133 CALL VRMessage VRWindow(), 'The following error occurred when trying to create the printer:' ||,134 '0d0a0d0a'x || reason, 'Error Creating Printer', 'E'135 CALL VRSet 'DT_INFO', 'Caption', 'The printer could not be created.'136 CALL VRSet 'PB_NEXT', 'Caption', 'Return'129 WHEN ok == 1 THEN reason = NLSGetMessage( 70 ) /* 70: Error importing PPD file. */ 130 WHEN ok == 2 THEN reason = NLSGetMessage( 71, globals.!log1 ) /* 71: Error creating CUPS printer. See %1 for more information. */ 131 WHEN ok == 3 THEN reason = NLSGetMessage( 72, globals.!log1 ) /* 72: Error creating printer object. See %1 for more information. */ 132 OTHERWISE reason = NLSGetMessage( 73) /* 73: Unknown error. */ 133 END 134 CALL VRMessage VRWindow(), NLSGetMessage( 60 ) ||, /* 60: The following error occurred when trying to create the printer: */ 135 '0d0a0d0a'x || reason, NLSGetMessage( 56 ), 'E' /* 56: Error Creating Printer */ 136 CALL NLSSetText 'DT_INFO', 'Caption', 52 /* 52: The printer could not be created. */ 137 CALL NLSSetText 'PB_NEXT', 'Caption', 54 /* 54: Return */ 137 138 END 138 139 ELSE DO 139 CALL VRSet 'DT_INFO', 'Caption', 'The printer has been created.'140 CALL VRSet 'PB_NEXT', 'Caption', 'Create another'141 END 142 CALL VRSet 'PB_CANCEL', 'Caption', 'Close'140 CALL NLSSetText 'DT_INFO', 'Caption', NLSGetMessage( 51 ) /* 51: The printer has been created. */ 141 CALL NLSSetText 'PB_NEXT', 'Caption', NLSGetMessage( 53 ) /* 53: Create another */ 142 END 143 CALL NLSSetText 'PB_CANCEL', 'Caption', NLSGetMessage( 55 ) /* 55: Close */ 143 144 144 145 CALL LINEOUT globals.!log1, '' … … 160 161 IF globals.!prt_dev <> '' THEN 161 162 cups_cmd = cups_cmd '-v "'globals.!prt_port'" -m' globals.!prt_dev 162 ELSE IF globals.!mode == 2 THEN 163 ELSE IF globals.!mode == 2 THEN 163 164 cups_cmd = cups_cmd '-v "'globals.!prt_port'" -P "'globals.!prt_ppd'"' 164 165 ELSE DO … … 204 205 205 206 /* Determine the printer driver source directories/files. Yes, this is 206 * repeated from ImportPPD, but we have to do it again here because 207 * repeated from ImportPPD, but we have to do it again here because 207 208 * (a) we might not have gone through ImportPPD to get to this point, and 208 209 * (b) even if we did, the repository information might have changed. … … 217 218 IF driver_path == '' THEN DO 218 219 /* TODO allow the user to browse for the driver on their system */ 219 CALL VRMessage VRWindow(), 'The printer driver' prnt_drv 'could not ', 220 'be located. If you have the driver ', 221 'files, please copy them to the directory ', 222 globals.!os2dir'\DLL\'prnt_drv' and then ', 223 'try again.', 'Driver Not Found', 'E' 220 CALL VRMessage VRWindow(),, 221 NLSGetMessage( 61, prnt_drv, globals.!os2dir'\DLL\'prnt_drv ),, /* 61: The printer driver %1 could not be located. If you have the driver files, please copy them to the directory %2 and then try again. */ 222 NLSGetMessage( 57 ), 'E' /* 57: Driver Not Found */ 224 223 RETURN 1 225 224 END … … 232 231 233 232 /* New logic to create the printer ourselves (instead of using RINSTPRN). 234 * There are two necessary steps: make sure the driver is installed, and 233 * There are two necessary steps: make sure the driver is installed, and 235 234 * then create the printer object (which causes the underlying device and 236 235 * queue to be created automatically as well). … … 240 239 CALL LINEOUT globals.!log1, 'InstallPrintDriver(' prnt_drv',' driver_path',' printer_model ') RC =' result 241 240 242 IF result == 0 THEN 241 IF result == 0 THEN 243 242 result = CreatePrinterObject( prnt_drv, printer_model,, 244 243 port_name, queue_name, printer_title ) … … 250 249 CALL DeletePort port_name 251 250 ELSE IF port_ok == 1 THEN DO 252 CALL VRMessage VRWindow(), 253 'The installed version of CUPS.PDR appears to be out of ', 254 'date. As a result, the desktop printer will not be ', 255 'usable until the desktop is restarted.',, 256 'Port Driver Problem', 'W' 251 CALL VRMessage VRWindow(),, 252 NLSGetMessage( 62 ),, /* 62: The installed version of CUPS.PDR appears to be out of date. As a result, the desktop printer will not be usable until the desktop is restarted. */ 253 NLSGetMessage( 58 ), 'W' /* 58: Port Driver Problem */ 257 254 END 258 255 … … 281 278 IF ok <> 0 THEN DO 282 279 CALL LINEOUT globals.!log1, 'PPD import failed:' ok 283 RETURN 1 /** RC=1 PPD import failed **/ 280 CALL VRMessage VRWindow(), NLSGetMessage( 69 ),, /* 69: The printer parameters could not ... PPD file. */ 281 NLSGetMessage( 70 ), 'W' /* 70: Error importing PPD file */ 282 CALL PromptForPMName 283 /* RETURN 1 RC=1 PPD import failed **/ 284 284 END 285 285 END … … 294 294 IF ok <> 0 THEN DO 295 295 CALL LINEOUT globals.!log1, 'PPD import failed:' ok 296 RETURN 1 /** RC=1 PPD import failed **/ 296 CALL VRMessage VRWindow(), NLSGetMessage( 69 ), NLSGetMessage( 70 ), 'W' 297 CALL PromptForPMName 298 /* RETURN 1 RC=1 PPD import failed **/ 297 299 END 298 300 END … … 308 310 /*:VRX DDCB_PROTOCOL_Change 309 311 */ 310 DDCB_PROTOCOL_Change: PROCEDURE 312 DDCB_PROTOCOL_Change: PROCEDURE EXPOSE globals. 311 313 312 314 idx = VRGet('DDCB_PROTOCOL', 'Selected') … … 317 319 show_user = 1 318 320 show_pass = 1 319 CALL VRSet 'DT_SERVER', 'Caption', 'Printer or server address:'320 CALL VRSet 'DT_QUEUE', 'Caption', 'Printer queue name:'321 CALL VRSet 'DT_USERID', 'Caption', 'User ID:'321 server_caption = 82 /* 82: Printer or server address: */ 322 queue_caption = 84 /* 84: Printer queue name: */ 323 userid_caption = 86 /* 86: User ID: */ 322 324 END 323 325 WHEN which == 2 THEN DO /* SOCKET */ … … 325 327 show_user = 0 326 328 show_pass = 0 327 CALL VRSet 'DT_SERVER', 'Caption', 'Printer or server address:' 329 server_caption = 82 /* 82: Printer or server address: */ 330 queue_caption = 84 /* 84: Printer queue name: */ 331 userid_caption = 86 /* 86: User ID: */ 328 332 END 329 333 WHEN which == 3 THEN DO /* LPD */ … … 331 335 show_user = 1 332 336 show_pass = 0 333 CALL VRSet 'DT_SERVER', 'Caption', 'Printer or server address:'334 CALL VRSet 'DT_QUEUE', 'Caption', 'Printer queue name:'335 CALL VRSet 'DT_USERID', 'Caption', 'User ID (if required):'337 server_caption = 82 /* 82: Printer or server address: */ 338 queue_caption = 84 /* 84: Printer queue name: */ 339 userid_caption = 87 /* 87: User ID (if required): */ 336 340 END 337 341 WHEN which == 4 THEN DO /* SMB */ … … 339 343 show_user = 1 340 344 show_pass = 1 341 CALL VRSet 'DT_SERVER', 'Caption', 'Print server name:'342 CALL VRSet 'DT_QUEUE', 'Caption', 'Shared printer name:'343 CALL VRSet 'DT_USERID', 'Caption', 'User ID:'345 server_caption = 83 /* 83: Print server name: */ 346 queue_caption = 85 /* 85: Shared printer name: */ 347 userid_caption = 86 /* 86: User ID: */ 344 348 END 345 349 OTHERWISE DO /* CUPS */ … … 347 351 show_user = 0 348 352 show_pass = 0 349 CALL VRSet 'DT_SERVER', 'Caption', 'CUPS server name:' 350 CALL VRSet 'DT_QUEUE', 'Caption', 'CUPS printer name:' 351 END 352 END 353 server_caption = 88 /* 88: CUPS server name: */ 354 queue_caption = 89 /* 89: CUPS printer name: */ 355 userid_caption = 86 /* 86: User ID: */ 356 END 357 END 358 359 r = NLSSetText('DT_SERVER', 'Caption', server_caption ) 360 r = NLSSetText('DT_QUEUE', 'Caption', queue_caption ) 361 r = NLSSetText('DT_USERID', 'Caption', userid_caption ) 353 362 354 363 CALL VRSet 'DT_QUEUE', 'Visible', show_queue … … 395 404 GetCupsPorts: PROCEDURE EXPOSE globals. 396 405 397 CALL VRSet 'DT_INFO', 'Caption', 'Looking for connected printers. Please wait...'406 CALL NLSSetText 'DT_INFO', 'Caption', 30 /* 30: Looking for connected printers. Please wait... */ 398 407 399 408 lpinfo_cmd = globals.!cupsdir'\sbin\lpinfo.exe -v |rxqueue' … … 405 414 defqueue = RXQUEUE('SET', listqueue ) 406 415 407 /* Use the SNMP backend to find network printers. We do this in addition 408 * to lpinfo because SNMP may provide the actual printer name. We'll 416 /* Use the SNMP backend to find network printers. We do this in addition 417 * to lpinfo because SNMP may provide the actual printer name. We'll 409 418 * merge this with the output of lpinfo in the next step. 410 419 */ … … 432 441 i = i + 1 433 442 IF _queue <> '' THEN _queue = '(queue '_queue')' 434 IF SYMBOL('netnames._name') == 'VAR' THEN 435 devices.i = 'Detected network printer ('_protocol') "'netnames._name'" at' _host _queue443 IF SYMBOL('netnames._name') == 'VAR' THEN 444 devices.i = NLSGetMessage( 32, _protocol, netnames._name, _host _queue ) /* 32: Detected network printer (%1) "%2" at %3 */ 436 445 ELSE 437 devices.i = 'Detected network printer ('_protocol') at' _host _queue446 devices.i = NLSGetMessage( 33, _protocol, _host _queue ) /* 33: Detected network printer (%1) at %2 */ 438 447 END 439 448 ELSE IF _type <> 'direct' THEN ITERATE … … 441 450 IF _name == 'hp' THEN ITERATE 442 451 i = i + 1 443 devices.i = 'Local printer:' _name452 devices.i = NLSGetMessage( 35, _name ) /* 35: Local printer: %1 */ 444 453 END 445 454 ports.i = _name … … 453 462 CALL VRSet 'LB_SELECT', 'Painting', 0 454 463 CALL VRMethod 'LB_SELECT', 'AddStringList', 'devices.',, 'ports.' 455 CALL VRMethod 'LB_SELECT', 'AddString', 'Network printer (manual configuration)',, ''464 CALL VRMethod 'LB_SELECT', 'AddString', NLSGetMessage( 34 ),, '' /* 34: Network printer (manual configuration) */ 456 465 CALL VRSet 'LB_SELECT', 'Selected', 1 457 466 CALL VRSet 'LB_SELECT', 'Painting', 1 458 467 459 CALL VRSet 'DT_INFO', 'Caption', 'Select the connection for this printer.'468 CALL VRSet 'DT_INFO', 'Caption', NLSGetMessage( 31 ) /* 31: Select the connection for this printer. */ 460 469 461 470 RETURN … … 465 474 GetCupsPrinters: PROCEDURE EXPOSE globals. manufacturers. 466 475 467 CALL VRSet 'DT_INFO', 'Caption', 'Getting list of supported printers. Please wait...'476 CALL NLSSetText 'DT_INFO', 'Caption', 20 /* 20: Getting list of supported printers. Please wait... */ 468 477 469 478 lpinfo_cmd = globals.!cupsdir'\sbin\lpinfo.exe --exclude-schemes drv -m 2>&1 |rxqueue' … … 519 528 * manufacturers.i.!printers.j.!remark2 any distinguishing remarks for the alternate driver 520 529 */ 521 522 530 manufacturers.0 = WORDS( makers ) 523 531 DO i = 1 TO manufacturers.0 … … 584 592 */ 585 593 count = manufacturers.0 + 1 586 manufacturers.count.!name = '-- Custom --'594 manufacturers.count.!name = NLSGetMessage( 22 ) /* 22: -- Custom -- */ 587 595 manufacturers.count.!printers.0 = 1 588 manufacturers.count.!printers.1.!model = '-- Other printer (requires PPD) --'596 manufacturers.count.!printers.1.!model = NLSGetMessage( 23 ) /* 23: -- Other printer (requires PPD) -- */ 589 597 manufacturers.count.!printers.1.!driver = '' 590 598 manufacturers.count.!printers.1.!type = '' 591 manufacturers.count.!printers.1.!remark = '-- Other printer (requires PPD) --'599 manufacturers.count.!printers.1.!remark = manufacturers.count.!printers.1.!model 592 600 manufacturers.count.!printers.1.!driver2 = '' 593 601 manufacturers.count.!printers.1.!remark2 = '' 594 602 manufacturers.0 = count 595 603 596 CALL VRSet 'DT_INFO', 'Caption', 'Select the printer manufacturer and model from the list below.'604 CALL NLSSetText 'DT_INFO', 'Caption', 21 /* 21: Select the printer manufacturer and model from the list below. */ 597 605 598 606 RETURN … … 653 661 * directory later on if they install the driver from PM. 654 662 */ 655 pbtn.1 = 'OK'656 pbtn.2 = 'Cancel'663 pbtn.1 = NLSGetMessage( 2 ) /* 2: OK */ 664 pbtn.2 = NLSGetMessage( 3 ) /* 3: Cancel */ 657 665 pbtn.0 = 2 658 ptext = 'The install files for the' driver 'driver could not be ' ||, 659 'located. These files will be recreated from the driver ' ||, 660 'files which are already installed on your system.' ||, 661 '0d0a0d0a'x || 'Please enter the directory where the ' ||, 662 'install files will be placed.' 666 ptext = NLSGetMessage( 63, driver ) ||, /* 63: The install files for the %1 driver could not be located. These files will be recreated from the driver files which are already installed on your system. */ 667 '0d0a0d0a'x || NLSGetMessage( 64 ) /* 64: Please enter the directory where the install files will be placed. */ 668 663 669 PARSE VALUE VRGetIni('PM_INSTALL', driver'_DIR', 'USER') WITH drvr_dir '00'x . 664 670 IF drvr_dir == '' THEN 665 671 PARSE VALUE VRGetIni('InstPDR', 'PATH_TO_'driver, 'USER') WITH drvr_dir '00'x . 666 ok = VRPrompt('WN_MAIN', ptext, 'drvr_dir',, 667 'Enter Directory', 'pbtn.', 1, 2 ) 672 ok = VRPrompt('WN_MAIN', ptext, 'drvr_dir', NLSGetMessage( 59 ), 'pbtn.', 1, 2 ) /* 59: Enter Directory */ 668 673 IF ok <> 1 THEN RETURN 9 /** RC=9 User cancelled **/ 669 674 drvr_dir = VRExpandFileName( drvr_dir ) … … 766 771 * to our working directory. 767 772 */ 768 ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2> &1| RXQUEUE' nq773 ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2>NUL 1| RXQUEUE' nq 769 774 DO QUEUED() 770 775 PULL output … … 782 787 */ 783 788 count = 0 784 ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2> &1| RXQUEUE' nq789 ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2>NUL 1| RXQUEUE' nq 785 790 DO QUEUED() 786 791 PARSE PULL output … … 898 903 SIGNAL ON NOVALUE NAME __NoValue 899 904 905 /* Hide the VX-REXX console window 906 */ 907 CALL VRSet 'Console', 'WindowListTitle', '' 908 900 909 CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs' 901 910 CALL SysLoadFuncs 902 911 903 912 CALL LoadSettings 913 CALL SetLanguage 904 914 905 915 IF InitArgs.0 > 0 THEN globals.!cupsdir = InitArgs.1 … … 907 917 IF \VRIsDir( globals.!cupsdir ) THEN DO 908 918 IF TRANSLATE( globals.!cupsdir ) <> '/R' THEN 909 CALL VRMessage VRWindow(),, 910 'CUPS could not be located. If you wish to use ' ||, 911 'a local installation of CUPS, please specify ' ||, 912 'the path where CUPS is installed on the command '||, 913 'line to this program (e.g "CUPSWIZ F:\CUPS").' ||, 914 '0d0a0d0a'x ||, 915 'Only remote CUPS queues will be available for ' ||, 916 'printers created in this session. (To skip ' ||, 917 'this message in the future, start this program ' ||, 918 'with the /R parameter.)',, 919 'CUPS Path Not Found or Not Valid', 'E' 919 CALL VRMessage VRWindow(), 920 NLSGetMessage( 65, 'CUPSWIZ F:\CUPS') ||, /* 65: CUPS could not be located ... on the command line to this program (e.g "%1"). */ 921 '0d0a0d0a'x || NLSGetMessage( 66 ),, /* 66: Only remote CUPS queues ... start this program with the /R parameter.) */ 922 NLSGetMessage( 28 ), 'E' /* 28: CUPS Path Not Found or Not Valid */ 920 923 globals.!cupsdir = '' 921 924 END … … 932 935 drop window 933 936 937 manufacturers.0 = 0 934 938 CALL SetPage1 935 939 … … 1023 1027 IF driver == '' THEN 1024 1028 type = '' 1025 ELSE IF remark == '' THEN 1029 ELSE IF remark == '' THEN 1026 1030 type = ' ('driver')' 1027 1031 ELSE … … 1078 1082 globals.!prdrv = STREAM( globals.!os2dir'\install\prdrv.lst', 'C', 'QUERY EXISTS') 1079 1083 globals.!prdesc = STREAM( globals.!os2dir'\install\prdesc.lst', 'C', 'QUERY EXISTS') 1084 1085 /* Set the language file name. 1086 */ 1087 globals.!nlsfile = 'cupswz' 1080 1088 1081 1089 RETURN 0 … … 1109 1117 /*:VRX PB_ABOUT_Click 1110 1118 */ 1111 PB_ABOUT_Click: 1119 PB_ABOUT_Click: 1112 1120 CALL SW_ABOUT_Close 1113 1121 RETURN … … 1214 1222 1215 1223 IF invalid == 1 THEN DO 1216 CALL VRMessage VRWindow(), 'Missing required value(s).', 'Missing Value(s)', 'E' 1224 CALL VRMessage VRWindow(), NLSGetMessage( 74 ),, /* 74: Missing required value(s). */ 1225 NLSGetMessage( 75 ), 'E' /* 75: Missing Value(s) */ 1217 1226 RETURN 1218 1227 END … … 1239 1248 IF which == '' THEN DO 1240 1249 globals.!mode = 2 /* Mode 2: user-selected PPD file */ 1241 ppd = VRFileDialog( VRWindow(), 'Select PPD', 'O', '*.ppd')1250 ppd = VRFileDialog( VRWindow(), NLSGetMessage( 24 ), 'O', '*.ppd') /* 24: Select PPD */ 1242 1251 IF ppd == '' THEN RETURN 1243 1252 globals.!prt_ppd = ppd … … 1245 1254 globals.!prt_nick = GetNameFromPPD( ppd ) 1246 1255 IF globals.!prt_nick == '' THEN DO 1247 CALL VRMessage VRWindow(), 'Could not read printer name '||,1248 'from' ppd'.', 'Invalid PPD', 'E'1256 CALL VRMessage VRWindow(), NLSGetMessage( 76, ppd ),, /* 76: Could not read printer name from %1. */ 1257 NLSGetMessage( 77 ), 'E' /* 77: Invalid PPD */ 1249 1258 RETURN 1250 1259 END … … 1318 1327 DO 1319 1328 IF ( globals.!remotecups <> '') THEN 1320 _errmsg = 'You must enter a description.'1329 _errmsg = NLSGetMessage( 42 ) /* 42: You must enter a description. */ 1321 1330 ELSE 1322 _errmsg = 'You must enter a name, a location, and a description.'1323 CALL VRMessage VRWindow(), _errmsg, 'Missing Value(s)', 'E'1331 _errmsg = NLSGetMessage( 43 ) /* 43: You must enter a name, a location, and a description. */ 1332 CALL VRMessage VRWindow(), _errmsg, NLSGetMessage( 75 ), 'E' /* 75: Missing Value(s) */ 1324 1333 RETURN 1325 1334 END … … 1329 1338 ( VERIFY( globals.!prt_name, '/# ' || '09'x, 'MATCH') <> 0 )) THEN 1330 1339 DO 1331 CALL VRMessage VRWindow(), 'The printer name must start ' ||, 1332 'with a letter, and may not include "/", "#", ' ||, 1333 'space, or tab characters.', 'Invalid Name', 'E' 1340 CALL VRMessage VRWindow(), NLSGetMessage( 44 ),, /* 44: The printer name must start with ... or tab characters. */ 1341 NLSGetMessage( 45 ), 'E' /* 45: Invalid Name */ 1334 1342 RETURN 1335 1343 END … … 1348 1356 1349 1357 WHEN globals.!page == 4 THEN DO 1350 CALL VRSet 'PB_NEXT', 'Caption', 'Next >'1358 CALL NLSSetText 'PB_NEXT', 'Caption', 5 /* 5: Next > */ 1351 1359 CALL VRSet 'EF_NAME', 'Value', '' 1352 1360 CALL VRSet 'EF_LOCATION', 'Value', '' … … 1375 1383 * Just use the generic PS driver. 1376 1384 */ 1377 CALL VRMessage VRWindow(),, 1378 'The printer "'globals.!prt_nick'" does not appear to' , 1379 'be supported by the' globals.!os2driver 'driver, and' , 1380 'no similar models were found. The generic PostScript', 1381 'driver will be used for application support.',, 1382 'Printer Name Not Found', 'W' 1385 CALL VRMessage VRWindow(), NLSGetMessage( 67, globals.!prt_nick, globals.!os2driver ),, /* 67: The printer "%1" does not ... application support. */ 1386 NLSGetMessage( 68 ), 'W' /* 68: Printer Name Not Found */ 1383 1387 globals.!prt_nick = 'Generic PostScript Printer' 1384 1388 RETURN … … 1397 1401 return 1398 1402 1403 /*:VRX SetLanguage 1404 */ 1405 SetLanguage: PROCEDURE EXPOSE globals. 1406 PARSE ARG locale 1407 1408 /* 1409 * This function locates the proper language files, and uses the message 1410 * file to sets all UI text. If the language could not be determined, we 1411 * default to English. 1412 */ 1413 execPath = VRGet('Application', 'Program') 1414 execDir = VRParseFileName( execPath, 'DP') 1415 1416 /* 1417 * First, figure out what language/message file to use. 1418 */ 1419 IF locale <> '' THEN 1420 syslanguage = locale 1421 ELSE 1422 syslanguage = VALUE('LANG',,'OS2ENVIRONMENT') 1423 1424 SELECT 1425 WHEN TRANSLATE( syslanguage ) == 'ZH_TW' THEN nlv = 'tw' 1426 WHEN TRANSLATE( syslanguage ) == 'ZH_CN' THEN nlv = 'cx' 1427 OTHERWISE PARSE VAR syslanguage nlv '_' . 1428 END 1429 nlvfile = globals.!nlsfile || nlv 1430 IF ( STREAM( execDir'\'nlvfile'.msg', 'C', 'QUERY EXISTS') \= '') | ( SysSearchPath('DPATH', nlvfile'.msg') \= '') THEN DO 1431 globals.!messages = nlvfile'.msg' 1432 helpfile = nlvfile'.hlp' 1433 CALL VRSet 'WN_MAIN', 'HelpFile', helpfile 1434 END 1435 ELSE DO 1436 globals.!messages = globals.!nlsfile || 'en.msg' 1437 helpfile = globals.!nlsfile || 'en.hlp' 1438 CALL VRSet 'WN_MAIN', 'HelpFile', helpfile 1439 END 1440 1441 /* 1442 * If the message file is missing or unreadable, display an error and then exit. 1443 */ 1444 IF NLSGetMessage( 1 ) == '' THEN DO 1445 CALL VRMessage VRWindow(), 'Language file' TRANSLATE( globals.!messages ) 'could not be loaded.', 'Cannot Continue', 'E' 1446 RETURN 0 1447 END 1448 1449 /* 1450 * Now set the captions for the UI controls on the main window, according 1451 * to the specified language. 1452 */ 1453 CALL NLSSetText 'WN_MAIN', 'Caption', 1 /* 1: Create CUPS Printer */ 1454 CALL NLSSetText 'PB_NEXT', 'Caption', 5 /* 5: Next > */ 1455 CALL NLSSetText 'PB_CANCEL', 'Caption', 3 /* 3: Cancel */ 1456 CALL NLSSetText 'PB_REFRESH', 'Caption', 6 /* 6: Refresh */ 1457 1458 RETURN 1 1459 1399 1460 /*:VRX SetPage1 1400 1461 */ 1401 1462 SetPage1: PROCEDURE EXPOSE globals. manufacturers. 1402 1463 1464 CALL VRMethod 'LB_BRAND', 'Clear' 1403 1465 CALL VRSet 'PB_NEXT', 'Enabled', 0 1404 1466 CALL VRSet 'LB_BRAND', 'Visible', 1 … … 1426 1488 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 1427 1489 1428 /* Populate the manufacturer list */ 1429 IF globals.!cupsdir == '' THEN DO 1430 manufacturers.1.!name = '-- Custom --' 1431 manufacturers.1.!printers.0 = 1 1432 manufacturers.1.!printers.1.!model = '-- Other printer (requires PPD) --' 1433 manufacturers.1.!printers.1.!driver = '' 1434 manufacturers.1.!printers.1.!type = '' 1435 manufacturers.1.!printers.1.!remark = '-- Other printer (requires PPD) --' 1436 manufacturers.1.!printers.1.!driver2 = '' 1437 manufacturers.1.!printers.1.!remark2 = '' 1438 manufacturers.0 = 1 1439 END 1440 ELSE 1441 CALL GetCupsPrinters 1490 IF manufacturers.0 == 0 THEN DO 1491 1492 /* Populate the manufacturer list */ 1493 IF globals.!cupsdir == '' THEN DO 1494 manufacturers.1.!name = NLSGetMessage( 22 ) /* 22: -- Custom -- */ 1495 manufacturers.1.!printers.0 = 1 1496 manufacturers.1.!printers.1.!model = NLSGetMessage( 23 ) /* 23: -- Other printer (requires PPD) -- */ 1497 manufacturers.1.!printers.1.!driver = '' 1498 manufacturers.1.!printers.1.!type = '' 1499 manufacturers.1.!printers.1.!remark = NLSGetMessage( 23 ) /* 23: -- Other printer (requires PPD) -- */ 1500 manufacturers.1.!printers.1.!driver2 = '' 1501 manufacturers.1.!printers.1.!remark2 = '' 1502 manufacturers.0 = 1 1503 END 1504 ELSE 1505 CALL GetCupsPrinters 1506 1507 END 1442 1508 1443 1509 CALL VRSet 'LB_BRAND', 'Painting', 0 … … 1464 1530 CALL VRSet 'LB_BRAND', 'Visible', 0 1465 1531 CALL VRSet 'PB_NEXT', 'Enabled', 0 1466 CALL VRSet 'WN_MAIN', 'StatusText', 'Selected printer: ' globals.!prt_nick1532 CALL NLSSetText 'WN_MAIN', 'StatusText', 29, globals.!prt_nick /* 29: Selected printer: %1 */ 1467 1533 1468 1534 /* Resize LB_SELECT to the full width of GB_INFO */ … … 1476 1542 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 1477 1543 IF globals.!cupsdir == '' THEN DO 1478 CALL VRMethod 'LB_SELECT', 'AddString', 'Network printer (manual configuration)',, ''1544 CALL VRMethod 'LB_SELECT', 'AddString', NLSGetMessage( 34 ),, '' /* 34: Network printer (manual configuration) */ 1479 1545 CALL VRSet 'LB_SELECT', 'Selected', 1 1480 1546 END … … 1492 1558 globals.!page = 3 1493 1559 CALL VRSet 'EF_DESC', 'Value', globals.!prt_nick 1560 CALL NLSSetText DT_NAME, 'Caption', 103 /* 103: Name: */ 1561 CALL NLSSetText DT_LOCATION, 'Caption', 105 /* 105: Location: */ 1562 CALL NLSSetText DT_DESC, 'Caption', 106 /* 106: Description: */ 1494 1563 1495 1564 CALL VRMethod 'LB_SELECT', 'Clear' … … 1498 1567 CALL VRSet 'GB_INFO', 'Visible', 1 1499 1568 IF globals.!remotecups == '' THEN DO 1500 CALL VRSet 'DT_INFO', 'Caption', 'Choose the printer name, and enter its location and a short description.'1569 CALL NLSSetText 'DT_INFO', 'Caption', 40 /* 40: Choose the printer name, and enter its location and a short description. */ 1501 1570 CALL VRSet 'DT_NAME', 'Visible', 1 1502 1571 CALL VRSet 'EF_NAME', 'Visible', 1 … … 1505 1574 END 1506 1575 ELSE 1507 CALL VRSet 'DT_INFO', 'Caption', 'Enter a short description of this printer. ', 1508 'This will be used for the printer object that appears on your desktop.' 1576 CALL NLSSetText 'DT_INFO', 'Caption', 41 /* 41: Enter a short description of this printer. This will be used for the printer object that appears on your desktop. */ 1509 1577 CALL VRSet 'DT_DESC', 'Visible', 1 1510 1578 CALL VRSet 'EF_DESC', 'Visible', 1 … … 1527 1595 /*:VRX SW_ABOUT_Close 1528 1596 */ 1529 SW_ABOUT_Close: 1597 SW_ABOUT_Close: 1530 1598 call SW_ABOUT_Fini 1531 1599 return … … 1533 1601 /*:VRX SW_ABOUT_Create 1534 1602 */ 1535 SW_ABOUT_Create: 1603 SW_ABOUT_Create: 1536 1604 call SW_ABOUT_Init 1537 1605 return … … 1539 1607 /*:VRX SW_ABOUT_Fini 1540 1608 */ 1541 SW_ABOUT_Fini: 1609 SW_ABOUT_Fini: 1542 1610 window = VRInfo( "Window" ) 1543 1611 call VRDestroy window … … 1546 1614 /*:VRX SW_ABOUT_Init 1547 1615 */ 1548 SW_ABOUT_Init: 1549 1550 CALL VRSet 'DT_BOOTDRIVE', 'Caption', 'System boot volume:' TRANSLATE( globals.!bootdrv ) 1551 CALL VRSet 'DT_CUPSPATH', 'Caption', 'Local CUPS directory:' TRANSLATE( globals.!cupsdir ) 1552 CALL VRSet 'DT_REPOSITORY', 'Caption', 'Local driver repository:' TRANSLATE( globals.!repository ) 1616 SW_ABOUT_Init: 1617 1618 CALL NLSSetText 'SW_ABOUT', 'Caption', 10 /* 10: Product Information */ 1619 CALL NLSSetText 'DT_ABOUT1', 'Caption', 11 /* 11: eCups Printer Install Utility */ 1620 CALL NLSSetText 'DT_ABOUT2', 'Caption', 12, '0.98' /* 12: Version %1 */ 1621 CALL NLSSetText 'DT_ABOUT3', 'Caption', 13, '2010,2012' /* 13: (C) %1 Alex Taylor */ 1622 CALL NLSSetText 'PB_ABOUT', 'Caption', 2 /* 10: Product Information */ 1623 1624 CALL NLSSetText 'DT_BOOTDRIVE', 'Caption', 14, TRANSLATE( globals.!bootdrv ) /* 14: System boot volume: %1 */ 1625 CALL NLSSetText 'DT_CUPSPATH', 'Caption', 15, TRANSLATE( globals.!cupsdir ) /* 15: Local CUPS directory: %1 */ 1626 CALL NLSSetText 'DT_REPOSITORY', 'Caption', 16, TRANSLATE( globals.!repository ) /* 16: Local driver repository: %1 */ 1553 1627 1554 1628 window = VRInfo( "Object" ) … … 1584 1658 SW_CREATE_Init: 1585 1659 1660 CALL NLSSetText 'SW_CREATE', 'Caption', 115 /* 115: Confirm Create Printer */ 1661 CALL NLSSetText 'DT_CRMODEL', 'Caption', 102 /* 102: Model: */ 1662 CALL NLSSetText 'DT_CRLOC', 'Caption', 105 /* 105: Location: */ 1663 CALL NLSSetText 'DT_CRDESC', 'Caption', 106 /* 106: Description: */ 1664 1665 CALL NLSSetText 'CHK_CREATEPM', 'Caption', 109 /* 109: Create printer object */ 1666 CALL NLSSetText 'DT_PRESDRV', 'Caption', 110 /* 110: Presentation driver: */ 1667 CALL NLSSetText 'PB_CREATEOK', 'Caption', 111 /* 111: Create */ 1668 CALL NLSSetText 'PB_CREATECANCEL', 'Caption', 3 /* 3: Cancel */ 1669 CALL NLSSetText 'PB_CREATEHELP', 'Caption', 4 /* 4: ~Help */ 1670 1586 1671 CALL VRSet 'EF_CRMODEL', 'Value', globals.!prt_nick 1587 1672 … … 1591 1676 * that points to it. 1592 1677 */ 1593 CALL VRSet 'DT_CREATE', 'Caption', 'Ready to create printer object with the following parameters.'1678 CALL NLSSetText 'DT_CREATE', 'Caption', 101 /* 101: Ready to create printer object with the following parameters. */ 1594 1679 1595 1680 PARSE VAR globals.!remotecups cups_host cups_printer . 1596 CALL VRSet 'DT_CRNAME', 'Caption', 'CUPS server:' 1681 CALL NLSSetText 'DT_CRNAME', 'Caption', 107 /* 107: CUPS server: */ 1682 CALL NLSSetText 'DT_CRURI', 'Caption', 108 /* 108: CUPS queue: */ 1683 CALL VRSet 'DT_CRLOC', 'Visible', 0 1597 1684 CALL VRSet 'EF_CRNAME', 'Value', cups_host 1598 CALL VRSet 'DT_CRURI', 'Caption', 'CUPS queue:'1599 1685 CALL VRSet 'EF_CRURI', 'Value', cups_printer 1600 CALL VRSet 'DT_CRLOC', 'Visible', 01601 1686 CALL VRSet 'EF_CRLOC', 'Visible', 0 1602 1687 CALL VRSet 'CHK_CREATEPM', 'Visible', 0 1603 1688 END 1604 1689 ELSE DO 1690 CALL NLSSetText 'DT_CREATE', 'Caption', 100 /* 100: Ready to create CUPS printer with the following parameters. */ 1691 CALL NLSSetText 'DT_CRNAME', 'Caption', 103 /* 103: Name: */ 1692 CALL NLSSetText 'DT_CRURI', 'Caption', 104 /* 104: URI: */ 1605 1693 CALL VRSet 'EF_CRNAME', 'Value', globals.!prt_name 1606 1694 CALL VRSet 'EF_CRURI', 'Value', globals.!prt_port … … 1620 1708 CALL VRSet 'DDCB_PRESDRV', 'Selected', def_idx 1621 1709 END 1622 ELSE DO 1623 CALL VRMessage VRWindow(), 'No eCups-compatible OS/2 presentation drivers are installed.', 1624 '0d0a0d0a'x || 'Please install the ECUPS or ECUPS-HP printer driver before continuing.',, 1625 'Missing PM Driver', 'E' 1710 ELSE DO /* 112: No eCups-compatible OS/2 presentation drivers are installed. */ 1711 /* 113: Please install the ECUPS or ECUPS-HP printer driver before continuing. */ 1712 CALL VRMessage VRWindow(), 1713 NLSGetMessage( 112 ) || '0d0a0d0a'x || NLSGetMessage( 113 ),, 1714 NLSGetMessage( 114 ), 'E' /* 114: Missing PM Driver */ 1626 1715 CALL VRSet 'PB_CREATEOK', 'Enabled', 0 1627 1716 /* TODO give an error if no drivers were found */ … … 1664 1753 SW_MODEL_Init: 1665 1754 1755 CALL NLSSetText 'SW_MODEL', 'Caption', 120 /* 120: Select Printer Model */ 1756 1666 1757 /* We should have a list of suggested printer models whose names at least 1667 1758 * partially match the requested model, sorted in order with the closest … … 1672 1763 CALL VRSet 'LB_OS2MODELS', 'Selected', best 1673 1764 1674 CALL VRSet 'DT_MODEL1', 'Caption',, 1675 'The printer "'globals.!prt_nick'" could not be found in the' , 1676 globals.!os2driver'.DRV driver under that name. Please choose', 1677 'the model of printer which will be reported to applications.' 1765 CALL NLSSetText 'DT_MODEL1', 'Caption',, 1766 121, globals.!prt_nick, globals.!os2driver /* 121: The printer "%1" could not ... to applications. */ 1767 CALL NLSSetText 'DT_MODEL2', 'Caption', 122 /* 122: You can select one of ... use a generic driver. */ 1768 1769 CALL NLSSetText 'PB_MODELOK', 'Caption', 2 /* 2: OK */ 1770 CALL NLSSetText 'PB_MODELCANCEL', 'Caption', 3 /* 3: Cancel */ 1678 1771 1679 1772 CALL VRSet 'WN_MAIN', 'Pointer', '<default>' … … 1712 1805 SW_NETWORK_Init: 1713 1806 1807 CALL NLSSetText 'SW_NETWORK', 'Caption', 80 /* 80: Network Printer */ 1808 CALL NLSSetText 'DT_PROTOCOL', 'Caption', 81 /* 81: Network protocol: */ 1809 CALL NLSSetText 'DT_PASSWORD', 'Caption', 90 /* 90: Password: */ 1810 CALL NLSSetText 'PB_NETOK', 'Caption', 2 /* 2: OK */ 1811 CALL NLSSetText 'PB_NETCANCEL', 'Caption', 3 /* 3: Cancel */ 1812 CALL NLSSetText 'PB_NETHELP', 'Caption', 4 /* 4: ~Help */ 1813 1714 1814 IF globals.!cupsdir == '' THEN DO 1715 1815 protos.0 = 1 1716 protos.1 = 'Existing CUPS printer (remote server)'1816 protos.1 = NLSGetMessage( 91 ) /* 91: Existing CUPS printer (remote server) */ 1717 1817 pnums.0 = 1 1718 1818 pnums.1 = 5 … … 1720 1820 ELSE DO 1721 1821 protos.0 = 5 1722 protos.1 = 'Internet Printing Protocol (IPP)'1723 protos.2 = 'AppSocket/JetDirect'1724 protos.3 = 'Line Printer Remote daemon (LPD)'1725 protos.4 = 'Windows/SMB network'1726 protos.5 = 'Existing CUPS printer'1822 protos.1 = NLSGetMessage( 92 ) /* 92: Internet Printing Protocol (IPP) */ 1823 protos.2 = NLSGetMessage( 93 ) /* 93: AppSocket/JetDirect */ 1824 protos.3 = NLSGetMessage( 94 ) /* 94: Line Printer Remote daemon (LPD) */ 1825 protos.4 = NLSGetMessage( 95 ) /* 95: Windows/SMB network */ 1826 protos.5 = NLSGetMessage( 96 ) /* 96: Existing CUPS printer */ 1727 1827 pnums.0 = 5 1728 1828 pnums.1 = 1
Note:
See TracChangeset
for help on using the changeset viewer.