Changeset 12
- Timestamp:
- Nov 14, 2011, 3:30:15 PM (14 years ago)
- Location:
- trunk/gui/printer/cupswiz
- Files:
-
- 5 edited
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:E:\DEVELOPMENT\VXREXX\Projects\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,4995,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 UserWindow: SW_ABOUT,1 -
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. manufacturers. 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 makers = '' 454 455 DO QUEUED() 455 456 PARSE PULL line 456 457 IF LEFT( line, 6 ) == 'drv://' THEN ITERATE 458 IF WORD( line, 1 ) == 'raw' THEN ITERATE 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 PARSE VAR _name _brand _model 470 IF WORDPOS( _brand, makers ) == 0 THEN makers = makers || _brand' ' 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 /*:VRX LB_BRAND_Click 916 */ 917 LB_BRAND_Click: PROCEDURE EXPOSE globals. manufacturers. 918 919 CALL VRSet 'WN_MAIN', 'StatusText', '' 920 921 index = VRGet('LB_BRAND', 'Selected') 922 IF index == 0 THEN RETURN 923 924 item = VRMethod('LB_BRAND', 'GetItemData', index ) 925 IF item == 0 THEN RETURN 926 927 DO i = 1 TO manufacturers.item.!printers.0 928 models.i = manufacturers.item.!printers.i.!model 929 /* ppds.i = manufacturers.item.!printers.i.!driver */ 930 IF manufacturers.item.!printers.i.!driver == '' THEN 931 ppds.i = '' 932 ELSE 933 ppds.i = i 934 935 /* DEBUG 936 say 'Model: ' manufacturers.item.!printers.i.!model 937 say 'Driver: ' manufacturers.item.!printers.i.!driver 938 say ' ' manufacturers.item.!printers.i.!longname 939 if manufacturers.item.!printers.i.!driver2 <> '' then 940 say 'Alternate:' manufacturers.item.!printers.i.!driver2 941 if manufacturers.item.!printers.i.!longname2 <> '' then 942 say ' ' manufacturers.item.!printers.i.!longname2 943 say 'Type: ' manufacturers.item.!printers.i.!type 944 say '---' 945 */ 946 947 END 948 models.0 = manufacturers.item.!printers.0 949 ppds.0 = manufacturers.item.!printers.0 950 951 CALL VRSet 'LB_SELECT', 'Painting', 0 952 CALL VRMethod 'LB_SELECT', 'Clear' 953 CALL VRMethod 'LB_SELECT', 'AddStringList', 'models.',, 'ppds.' 954 CALL VRSet 'LB_SELECT', 'Painting', 1 955 956 RETURN 957 958 /*:VRX LB_SELECT_Click 959 */ 960 LB_SELECT_Click: PROCEDURE EXPOSE globals. manufacturers. 961 SELECT 962 WHEN globals.!page == 1 THEN DO 963 CALL VRSet 'WN_MAIN', 'StatusText', '' 964 965 brand = VRGet('LB_BRAND', 'Selected') 966 IF brand == 0 THEN RETURN 967 selected = VRGet('LB_SELECT', 'Selected') 968 IF selected == 0 THEN RETURN 969 which = VRMethod('LB_SELECT', 'GetItemData', selected ) 970 IF which == '' THEN RETURN 971 man = VRMethod('LB_BRAND', 'GetItemData', brand ) 972 IF man == '' THEN RETURN 973 974 make = manufacturers.man.!name 975 model = manufacturers.man.!printers.which.!model 976 driver = manufacturers.man.!printers.which.!type 977 remark = manufacturers.man.!printers.which.!remark 978 IF remark == '' THEN 979 type = ' ('driver')' 980 ELSE 981 type = ' ('driver' - 'remark')' 982 983 CALL VRSet 'WN_MAIN', 'StatusText', make model type 984 END 985 986 OTHERWISE NOP 987 END 988 989 RETURN 990 837 991 /*:VRX LoadSettings 838 992 */ … … 904 1058 RETURN lo_name 905 1059 1060 /*:VRX PB_ABOUT_Click 1061 */ 1062 PB_ABOUT_Click: 1063 CALL SW_ABOUT_Close 1064 RETURN 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. manufacturers. 1017 1177 1018 1178 SELECT 1019 1179 WHEN globals.!page == 1 THEN DO 1180 brand = VRGet('LB_BRAND', 'Selected') 1181 IF brand == 0 THEN RETURN 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 man = VRMethod('LB_BRAND', 'GetItemData', brand ) 1198 IF man == '' THEN DO 1199 /* TODO display an error? But this shouldn't be possible... */ 1200 RETURN 1201 END 1202 ppd = manufacturers.man.!printers.which.!driver 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 /*:VRX PICT_ICON_Click 1307 */ 1308 PICT_ICON_Click: PROCEDURE EXPOSE globals. 1309 CALL VRLoadSecondary 'SW_ABOUT', 'W' 1310 RETURN 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 CALL VRSet 'DT_INFO', 'Caption', 'Select your printer model.' 1363 1364 /* Populate the manufacturer list */ 1365 CALL VRSet 'LB_BRAND', 'Painting', 0 1366 DO i = 1 TO manufacturers.0 1367 addman.i = manufacturers.i.!name 1368 addidx.i = i 1369 END 1370 addman.0 = manufacturers.0 1371 addidx.0 = manufacturers.0 1372 CALL VRMethod 'LB_BRAND', 'AddStringList', 'addman.',, 'addidx.' 1373 CALL VRSet 'LB_BRAND', 'Painting', 1 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 CALL VRSet 'LB_BRAND', 'Visible', 0 1386 CALL VRSet 'WN_MAIN', 'StatusText', 'Selected printer: ' globals.!prt_nick 1387 1388 /* Resize LB_SELECT to the full width of GB_INFO */ 1389 lb_x = VRGet('GB_INFO', 'Left') 1390 lb_w = VRGet('GB_INFO', 'Width') 1391 CALL VRSet 'LB_SELECT', 'Left', lb_x 1392 CALL VRSet 'LB_SELECT', 'Width', lb_w 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 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 - Offer the option to show both simplified/expert drivers
Note:
See TracChangeset
for help on using the changeset viewer.