Changeset 12
- Timestamp:
- Nov 14, 2011, 3:30:15 PM (14 years ago)
- Location:
- trunk/gui/printer/cupswiz
- Files:
-
- 5 edited
-
cupswiz.VRP (modified) (3 diffs)
-
cupswiz.VRX (modified) (14 diffs)
-
cupswiz.VRY (modified) ( previous)
-
readme.1st (modified) (2 diffs)
-
todo (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/printer/cupswiz/cupswiz.VRP
r11 r12 1 1 VX-REXX OS/2 V2.14 Build B3 2 2 VRX: cupswiz.VRX 3 MacroPath: VRM: G:\netlabs\svn\ecups\trunk\gui\printer\cupswiz3 MacroPath: VRM:\cupswiz 4 4 EXEPath: 5 5 RunParameters: f:\cups … … 7 7 VRXWindow: __VREMainWindow,1,602,2554,5770,9106 8 8 VRXWindow: __VRESectionListWindow,1,662,11804,4529,3891 9 VRXWindow: __VREToolsWindow,1,1674,9877,49 89,16679 VRXWindow: __VREToolsWindow,1,1674,9877,49,1667 10 10 VRXWindow: __VREWindListWindow,1,5215,11804,2650,3891 11 11 UserFile: 1 … … 14 14 UserWindow: SW_CREATE,1 15 15 UserWindow: SW_MODEL,1 16 -
trunk/gui/printer/cupswiz/cupswiz.VRX
r11 r12 412 412 IF _queue == '' THEN _desc = '('_protocol')' 413 413 ELSE _desc = _queue '('_protocol')' 414 devices.i = 'Detected network printer' _desc 'at' _host 414 devices.i = 'Detected network printer' _desc 'at' _host 415 415 END 416 416 ELSE IF _type <> 'direct' THEN ITERATE … … 439 439 /*:VRX GetCupsPrinters 440 440 */ 441 GetCupsPrinters: PROCEDURE EXPOSE globals. 441 GetCupsPrinters: PROCEDURE EXPOSE globals. 442 442 443 443 CALL VRSet 'DT_INFO', 'Caption', 'Getting list of supported printers. Please wait...' … … 452 452 ADDRESS CMD '@' lpinfo_cmd listqueue 453 453 i = 0 454 454 455 DO QUEUED() 455 456 PARSE PULL line 456 457 IF LEFT( line, 6 ) == 'drv://' THEN ITERATE 458 457 459 PARSE VAR line _ppd '.ppd.gz ' _name 458 460 _ppd = _ppd'.ppd.gz' … … 465 467 END 466 468 IF _name <> '' THEN DO 469 470 467 471 i = i + 1 468 472 ppds.i = _ppd … … 477 481 CALL DIRECTORY _od 478 482 479 CALL VRSet 'LB_SELECT', 'Painting', 0 480 CALL VRMethod 'LB_SELECT', 'AddString', '-- Other printer (requires PPD) --',, '' 481 CALL VRMethod 'LB_SELECT', 'AddStringList', 'models.',, 'ppds.' 482 CALL VRSet 'LB_SELECT', 'Selected', 1 483 CALL VRSet 'LB_SELECT', 'Painting', 1 484 485 CALL VRSet 'DT_INFO', 'Caption', 'Select your printer model.' 483 /* Now build the 'manufacturers' stem. 484 * This stem takes the following format: 485 * manufacturers.0 number of manufacturers 486 * manufacturers.i.!name manufacturer name (e.g. 'Apple') 487 * manufacturers.i.!printers.0 number of printer models 488 * manufacturers.i.!printers.j.!model printer model name, short form (e.g. 'LaserWriter 330') 489 * manufacturers.i.!printers.j.!type driver version/type (e.g. 'Gutenprint v5.2.7') 490 * manufacturers.i.!printers.j.!driver the internal CUPS printer driver name (PPD or URI) 491 * - by preference this is the "simplified" version if available 492 * manufacturers.i.!printers.j.!remark any distinguishing remarks (e.g. 'Simplified') 493 * manufacturers.i.!printers.j.!driver2 alternate driver in case there is more than one (PPD or URI) 494 * - if defined this is usually the non-"simplified" driver 495 * manufacturers.i.!printers.j.!remark2 any distinguishing remarks for the alternate driver 496 */ 497 498 manufacturers.0 = WORDS( makers ) 499 DO i = 1 TO manufacturers.0 500 manufacturers.i.!name = WORD( makers, i ) 501 manufacturers.i.!printers.0 = 0 502 END 503 504 DO i = 1 TO models.0 505 PARSE VAR models.i _brand _model ' - CUPS+' _type 506 man = WORDPOS( _brand, makers ) 507 IF man == 0 THEN ITERATE 508 509 PARSE VAR _type _version 'Simplified' . 510 _version = STRIP( _version ) 511 _flag = RIGHT( _type, 10 ) 512 513 count = manufacturers.man.!printers.0 514 IF count > 0 THEN DO 515 /* If there are two or more printers defined with the same model 516 * name and driver version, keep the first and last as the regular 517 * and alternate drivers; if one if them is 'Simplified', make that 518 * the regular driver by preference. 519 */ 520 IF ( manufacturers.man.!printers.count.!model == _model ) & , 521 ( manufacturers.man.!printers.count.!type == _version ) THEN 522 DO 523 IF ( WORD( _version, 1 ) == 'Gutenprint') & ( _flag == 'Simplified') THEN DO 524 manufacturers.man.!printers.count.!driver2 = manufacturers.man.!printers.count.!driver 525 manufacturers.man.!printers.count.!remark2 = manufacturers.man.!printers.count.!remark 526 manufacturers.man.!printers.count.!driver = ppds.i 527 manufacturers.man.!printers.count.!remark = 'Simplified' 528 END 529 ELSE DO 530 manufacturers.man.!printers.count.!driver2 = ppds.i 531 IF _flag == 'Simplified' THEN 532 manufacturers.man.!printers.count.!remark2 = 'Simplified' 533 ELSE 534 manufacturers.man.!printers.count.!remark2 = '' 535 END 536 ITERATE 537 END 538 END 539 count = count + 1 540 manufacturers.man.!printers.count.!model = _model 541 manufacturers.man.!printers.count.!type = _version 542 manufacturers.man.!printers.count.!driver = ppds.i 543 IF _flag == 'Simplified' THEN 544 manufacturers.man.!printers.count.!remark = 'Simplified' 545 ELSE 546 manufacturers.man.!printers.count.!remark = '' 547 manufacturers.man.!printers.count.!driver2 = '' 548 manufacturers.man.!printers.count.!remark2 = '' 549 manufacturers.man.!printers.0 = count 550 END 551 552 /* Add one more category for special items ... 553 */ 554 count = manufacturers.0 + 1 555 manufacturers.count.!name = '-- Custom --' 556 manufacturers.count.!printers.0 = 1 557 manufacturers.count.!printers.1.!model = '-- Other printer (requires PPD) --' 558 manufacturers.count.!printers.1.!driver = '' 559 manufacturers.count.!printers.1.!type = '' 560 manufacturers.count.!printers.1.!remark = '-- Other printer (requires PPD) --' 561 manufacturers.count.!printers.1.!driver2 = '' 562 manufacturers.count.!printers.1.!remark2 = '' 563 manufacturers.0 = count 486 564 487 565 RETURN … … 835 913 RETURN 836 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 837 991 /*:VRX LoadSettings 838 992 */ … … 904 1058 RETURN lo_name 905 1059 1060 1061 1062 1063 1064 1065 906 1066 /*:VRX PB_CANCEL_Click 907 1067 */ … … 1014 1174 /*:VRX PB_NEXT_Click 1015 1175 */ 1016 PB_NEXT_Click: PROCEDURE EXPOSE globals. 1176 PB_NEXT_Click: PROCEDURE EXPOSE globals. 1017 1177 1018 1178 SELECT 1019 1179 WHEN globals.!page == 1 THEN DO 1180 1181 1020 1182 selected = VRGet('LB_SELECT', 'Selected') 1021 1183 IF selected == 0 THEN RETURN 1022 1184 1023 ppd = VRMethod('LB_SELECT', 'GetItemData', selected ) 1024 IF ppd == '' THEN DO 1185 CALL VRSet 'WN_MAIN', 'StatusText', '' 1186 1187 which = VRMethod('LB_SELECT', 'GetItemData', selected ) 1188 IF which == '' THEN DO 1025 1189 globals.!mode = 2 /* Mode 2: user-selected PPD file */ 1026 1190 ppd = VRFileDialog( VRWindow(), 'Select PPD', 'O', '*.ppd') … … 1031 1195 END 1032 1196 ELSE DO 1197 1198 1199 1200 1201 1202 1033 1203 globals.!mode = 1 /* Mode 1: CUPS-included model */ 1034 1204 IF POS('exe://', ppd ) > 0 THEN DO 1035 1205 globals.!prt_ppd = '' 1036 1206 globals.!prt_dev = ppd 1037 sel_name = VRMethod('LB_SELECT', 'GetString', selected ) 1207 sel_brand = VRGet('LB_BRAND', 'SelectedString') 1208 sel_name = sel_brand VRMethod('LB_SELECT', 'GetString', selected ) 1038 1209 PARSE VAR sel_name _nick ' - CUPS' . 1039 1210 IF _nick == '' THEN … … 1051 1222 1052 1223 CALL InitMessageLog 1053 IF globals.!mode == 2 THEN1224 IF globals.!mode ==2 THEN 1054 1225 CALL LINEOUT globals.!log1, 'Starting printer install with user-provided PPD:' 1055 1226 ELSE … … 1133 1304 RETURN 1134 1305 1306 1307 1308 1309 1310 1311 1135 1312 /*:VRX PromptForPMName 1136 1313 */ … … 1166 1343 /*:VRX SetPage1 1167 1344 */ 1168 SetPage1: PROCEDURE EXPOSE globals. 1169 1170 CALL VRSet 'LB_SELECT', 'Visible', 1 1171 CALL VRSet 'GB_INFO', 'Visible', 0 1345 SetPage1: PROCEDURE EXPOSE globals. manufacturers. 1346 1347 CALL VRSet 'LB_BRAND', 'Visible', 1 1348 1349 /* Resize LB_SELECT if necessary to make room for LB_BRAND */ 1350 lb_x = VRGet('LB_BRAND', 'Left') + VRGet('LB_BRAND', 'Width') + 60 1351 lb_w = VRGet('GB_INFO', 'Width') - lb_x + VRGet('GB_INFO', 'Left') 1352 CALL VRSet 'LB_SELECT', 'Left', lb_x 1353 CALL VRSet 'LB_SELECT', 'Width', lb_w 1354 1355 CALL VRSet 'LB_SELECT', 'Visible', 1 1356 CALL VRSet 'GB_INFO', 'Visible', 0 1172 1357 1173 1358 globals.!page = 1 1174 1359 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 1175 1360 CALL GetCupsPrinters 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1176 1375 CALL VRMethod 'LB_SELECT', 'SetFocus' 1177 1376 CALL VRSet 'WN_MAIN', 'Pointer', '<default>' 1377 1178 1378 RETURN 1179 1379 … … 1183 1383 1184 1384 globals.!page = 2 1385 1386 1387 1388 1389 1390 1391 1392 1393 1185 1394 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 1186 1395 CALL GetCupsPorts … … 1223 1432 1224 1433 globals.!page = 4 1225 CALL VRSet 'LB_SELECT', 'Visible', 0 1226 CALL VRSet 'GB_INFO', 'Visible', 0 1227 1228 RETURN 1434 CALL VRSet 'LB_SELECT', 'Visible', 0 1435 CALL VRSet 'GB_INFO', 'Visible', 0 1436 CALL VRSet 'WN_MAIN', 'StatusText', '' 1437 1438 RETURN 1439 1440 /*:VRX SW_ABOUT_Close 1441 */ 1442 SW_ABOUT_Close: 1443 call SW_ABOUT_Fini 1444 return 1445 1446 /*:VRX SW_ABOUT_Create 1447 */ 1448 SW_ABOUT_Create: 1449 call SW_ABOUT_Init 1450 return 1451 1452 /*:VRX SW_ABOUT_Fini 1453 */ 1454 SW_ABOUT_Fini: 1455 window = VRInfo( "Window" ) 1456 call VRDestroy window 1457 drop window 1458 return 1459 /*:VRX SW_ABOUT_Init 1460 */ 1461 SW_ABOUT_Init: 1462 1463 CALL VRSet 'DT_BOOTDRIVE', 'Caption', 'System boot volume:' TRANSLATE( globals.!bootdrv ) 1464 CALL VRSet 'DT_CUPSPATH', 'Caption', 'Local CUPS directory:' TRANSLATE( globals.!cupsdir ) 1465 CALL VRSet 'DT_REPOSITORY', 'Caption', 'Local driver repository:' TRANSLATE( globals.!repository ) 1466 1467 window = VRInfo( "Object" ) 1468 if( \VRIsChildOf( window, "Notebook" ) ) then do 1469 call VRMethod window, "CenterWindow" 1470 call VRSet window, "Visible", 1 1471 call VRMethod window, "Activate" 1472 end 1473 drop window 1474 return 1229 1475 1230 1476 /*:VRX SW_CREATE_Close -
trunk/gui/printer/cupswiz/readme.1st
r11 r12 1 1 CUPSWIZ - prototype CUPS printer-creation wizard 2 Test release x2 Test release 3 3 4 4 Make sure cupsport.exe is either in the current directory or in the PATH. … … 22 22 Current limitations: 23 23 - The CUPS printer is always created with default job options. 24 - The GUI is still somewhat unpolished. All printer models are currently25 displayed in one massive list (not broken down by manufacturer yet).26 24 - If your %TMP% directory has spaces in the pathname, the program will 27 25 almost certainly fail to work properly. The same applies to your -
trunk/gui/printer/cupswiz/todo
r11 r12 1 1 - Check to make sure CUPS.PDR is installed, and (offer to) install if missing. 2 2 - Ditto for gzip.exe, rinstprn.exe and cupsport.exe 3 - Split first-page printer list into manufacturer-model lists.4 3 - Use OS2.INI eCups::CUPS ||'\cups' for cups path if found. 5 4 - How to support total remote CUPS (i.e. no local CUPS install)? 5
Note:
See TracChangeset
for help on using the changeset viewer.
