- Timestamp:
- Dec 17, 2014, 1:36:21 PM (11 years ago)
- Location:
- trunk/gui
- Files:
-
- 4 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/printer/manager/PRINTOOL.VRP
r39 r49 2 2 VRX: PRINTOOL.VRX 3 3 VXOFile: VROBJEX 4 MacroPath: VRM: G:\netlabs\svn\ecups\trunk\gui\printer\manager5 EXEPath: G:\netlabs\svn\ecups\trunk\gui\printer\manager\PRINTMAN.EXE4 MacroPath: VRM:E:\DEVELOPMENT\VXREXX\Projects\PrintTool 5 EXEPath: E:\Development\VXREXX\Projects\PrintTool\PRINTMAN.EXE 6 6 RunParameters: 7 7 RunDirectory: 8 VRXWindow: __VREMainWindow,1,5 54,4095,6697,80469 VRXWindow: __VRESectionListWindow,1,6 87,16044,4204,405910 VRXWindow: __VREToolsWindow,1,6 87,14309,4963,166911 VRXWindow: __VREWindListWindow,1,4 902,16044,3505,40598 VRXWindow: __VREMainWindow,1,506,4095,6697,8046 9 VRXWindow: __VRESectionListWindow,1,614,16044,4204,4059 10 VRXWindow: __VREToolsWindow,1,638,14309,5472,1659 11 VRXWindow: __VREWindListWindow,1,4854,16044,3505,4059 12 12 UserFile: 1 13 13 UserWindow: WN_MAIN,1 -
trunk/gui/printer/manager/PRINTOOL.VRX
r48 r49 507 507 * possible situations. 508 508 */ 509 ImportPPD: PROCEDURE EXPOSE globals. 509 ImportPPD: PROCEDURE EXPOSE globals. driver_path 510 510 ARG driver, ppdfile 511 511 IF driver == '' THEN driver = 'PSCRIPT' … … 522 522 WHEN status == 1 THEN NOP 523 523 524 /* An installable ( working) copy of the driver could not be located, but525 * we found an installed (in use) version whence we can grab the files.524 /* An installable (distribution) copy of the driver could not be located, 525 * but we found an installed (in use) version whence we can grab the files. 526 526 */ 527 527 WHEN status == 2 THEN DO … … 588 588 */ 589 589 590 /** TODO should move all below this into a new shared function **/ 590 /**** Moved all below this into a shared function 591 591 592 592 CALL LINEOUT globals.!log1, 'Driver source: ' driver_path … … 782 782 IF ok == 1 THEN 783 783 ok = VRCopyFile( workdir'\OUT\AUXPRINT.PAK', target'\AUXPRINT.PAK') 784 784 785 IF ok == 1 THEN DO 785 786 /* Copy the updated files to \OS2\DLL\<driver>, replacing any 786 787 * existing copies. (This prevents problems if the OS/2 driver 787 * installation doesn't/fails to copy them, which can happen under788 * somecircumstances.)788 * installation fails to copy them, which can happen under some 789 * circumstances.) 789 790 */ 790 791 IF VRFileExists( globals.!os2dir'\DLL\'driver'\'driver'.DRV') THEN DO … … 814 815 CALL VRRmDir( workdir ) 815 816 816 RETURN 0 817 ****/ 818 819 ok = PinWrapper( 1, driver, ppdfile ) 820 821 RETURN ok 817 822 818 823 /*:VRX Init … … 890 895 LoadSettings: PROCEDURE EXPOSE globals. 891 896 892 globals.!version = '0. 46'893 globals.!copyright = '2013 '897 globals.!version = '0.50' 898 globals.!copyright = '2013-2014' 894 899 895 900 me = VRGet('Application', 'Program') … … 1194 1199 END 1195 1200 ELSE DO 1196 cupswiz = Stream( globals.!cupsdir'\cups \cupswiz.exe', 'C', 'QUERY EXISTS')1201 cupswiz = Stream( globals.!cupsdir'\cupswiz.exe', 'C', 'QUERY EXISTS') 1197 1202 _workdir = VRParseFilePath( cupswiz, 'DP') 1198 1203 _parms = '' … … 1203 1208 IF ppd_file <> '' & VRFileExists( ppd_file ) THEN 1204 1209 _parms = _parms ppd_file 1210 CALL LINEOUT globals.!log1, 'Launching CUPS wizard with: start' cupswiz _parms 1205 1211 ADDRESS CMD 'start' cupswiz _parms 1206 1212 CALL DIRECTORY od 1207 1213 CALL Quit 1208 1214 END 1215 ELSE DO 1216 CALL LINEOUT globals.!log1, 'Failed to locate CUPS wizard.' 1217 END 1218 1209 1219 1210 1220 RETURN … … 1387 1397 END 1388 1398 driver = VRGet('DDCB_IMPORTDRV', 'Value') 1389 ok = ImportPPD( driver, new_ppd ) 1399 ok = ImportPPD( driver, new_ppd ) /* Also sets driver_path variable */ 1390 1400 1391 1401 SELECT … … 1439 1449 IF message <> '' THEN 1440 1450 CALL VRMessage VRWindow(), _message, _mbtitle, _mbicon 1451 1452 IF ok == 0 THEN DO 1453 /* The PPD was imported into the driver install directory. Now we should 1454 * ask the user if they want to actually install this printer driver so 1455 * that existing printer objects can use it. 1456 */ 1457 _new_model = GetNameFromPPD( new_ppd ) 1458 _btns.0 = 2 1459 _btns.1 = NLSGetMessage( 14 ) 1460 _btns.2 = NLSGetMessage( 15 ) 1461 _create = VRMessage( VRWindow(), NLSGetMessage( 240, _new_model ) || '0d0d0a'x ||, 1462 NLSGetMessage( 241 ), NLSGetMessage( 239 ), 'Q', '_btns.', 1, 2 ) 1463 IF _create == 1 THEN DO 1464 _ipd = InstallPrintDriver( driver, driver_path, _new_model ) 1465 IF _ipd <> 0 THEN 1466 CALL VRMessage VRWindow(), NLSGetMessage( 168, driver'.'_new_model ), NLSGetMessage( 13 ), 'E' 1467 END 1468 END 1441 1469 1442 1470 CALL SW_IMPORT_Close … … 1588 1616 1589 1617 ok = CopyPrinterPak( new_drv, drv_target ) 1618 1619 /* Update any previously-imported PPDs for this driver 1620 */ 1621 IF ok == 1 THEN DO 1622 /* TODO use drv_target and parse it for pmdx directly */ 1623 driver_path = GetDriverSource( drv_stem ) /* Also sets pmdx */ 1624 IF pmdx == '' THEN 1625 driver_repo = 0 1626 ELSE 1627 driver_repo = 1 1628 pwok = PinWrapper( 0, drv_stem, '') 1629 IF pwok <> 0 THEN DO 1630 CALL CHAROUT globals.!log1, 'Encountered error' pwok 'from PIN wrapper:' 1631 SELECT 1632 WHEN ok == 3 THEN CALL LINEOUT globals.!log1, 'Invalid path specified' 1633 WHEN ok == 4 THEN CALL LINEOUT globals.!log1, 'Failed to copy driver files' 1634 WHEN ok == 5 THEN CALL LINEOUT globals.!log1, 'Failed to create directory' 1635 WHEN ok == 6 THEN CALL LINEOUT globals.!log1, 'PPD import failed' 1636 WHEN ok == 7 THEN CALL LINEOUT globals.!log1, 'Error updating PRDESC.LST' 1637 OTHERWISE CALL LINEOUT globals.!log1, 'Unknown error' 1638 END 1639 ok = 0 1640 END 1641 END 1642 1590 1643 IF existing & ok == 1 THEN DO 1591 CALL UpdatePrDesc new_drv, drv_target'\'new_drv1644 CALL UpdatePrDesc drv_name, drv_target'\'drv_name 1592 1645 END 1593 1646 IF ok == 0 THEN DO … … 1597 1650 ELSE 1598 1651 CALL VRMessage VRWindow(), NLSGetMessage( 193 ), NLSGetMessage( 16 ), 'I' 1652 1653 new_drv = drv_target'\'drv_name 1599 1654 END 1600 1655 END -
trunk/gui/printer/manager/printm_en.txt
r39 r49 251 251 PTM0237I: You cannot import a PPD file unless you have either CUPS or at least one legacy PostScript driver installed. 252 252 PTM0238I: The PPD has been imported. 253 PTM0239 ?:254 PTM0240 ?:255 PTM0241 ?:253 PTM0239I: Install Driver? 254 PTM0240I: The driver "%1" is now available. Do you want to install this driver? 255 PTM0241I: (Saying 'Yes' will allow existing printer objects to use this driver.) 256 256 PTM0242?: 257 257 PTM0243?: -
trunk/gui/printer/manager/readme.txt
r48 r49 1 1 PM Printer Manager 2 Version 0. 462 Version 0.50 3 3 4 4 Printer Manager is a new graphical printer management tool designed to 5 5 replace several older, separate programs by integrating their functions 6 in one, centralize utility:6 in one, centralized utility: 7 7 - INSTPDR.EXE (done) 8 8 - ECSPRINT.EXE (done) … … 16 16 - WPTOOLS.DLL (widely available, included with eCS) 17 17 - PR1UTIL.DLL (widely available, included with eCS 2.x) 18 - VROBJEX.DLL (included here, to be included in eCS 2.2) 18 - VROBJEX.DLL (available from http://trac.netlabs.org/vxapps, 19 included in eCS 2.2) 19 20 - RXPRTUTL.DLL (included here) 20 21 … … 71 72 -- 72 73 Alex Taylor 73 May201474 December 2014 -
trunk/gui/shared/PrManUtl.VRS
r45 r49 275 275 copyfile = drv_dir'\AUXPRINT.PAK' 276 276 IF STREAM( copyfile, 'C', 'QUERY EXISTS') <> '' THEN DO 277 ok = VRCopyFile( copyfile, newdrvdir'\AUXPRINT.PAK' 277 ok = VRCopyFile( copyfile, newdrvdir'\AUXPRINT.PAK') 278 278 CALL LINEOUT globals.!log1, ' -' copyfile ':' ok 279 279 END … … 760 760 761 761 762 /*:VRX PinWrapper 763 */ 764 /* Wrapper for PIN, which performs the following tasks: 765 * - Create a temporary working directory & copy the PrinterPak files there. 766 * - Pre-process the PPD file to make it ready for import, and saves it in 767 * a driver-specific 'saved PPDs' directory for future use. 768 * - Uses PIN to import the PPD into our temporary working copy of the driver. 769 * - Copy the updated driver back to our installable copy. 770 * - If update_all is 1 then also do the following: 771 * - If the driver is actually installed, copy the updated driver back 772 * over the installed version as well. 773 * - If this is a 'shipped' driver (i.e. one listed in PRDRV.LST) then 774 * add the newly-defined printer to PRDESC.LST. 775 */ 776 PinWrapper: PROCEDURE EXPOSE globals. driver_path driver_repo 777 ARG update_all, driver, ppdfile 778 779 CALL LINEOUT globals.!log1, 'Driver source: ' driver_path 780 781 workdir = SysTempFileName( globals.!tmpdir'\PPD_????') 782 ok = VRMkDir( workdir ) 783 IF ok == 1 THEN ok = VrMkDir( workdir'\OUT') 784 IF ok <> 1 THEN 785 RETURN 5 /** RC=5 failed to create directory */ 786 787 CALL LINEOUT globals.!log1, 'Temporary directory: ' workdir 788 789 SELECT 790 WHEN driver == 'ECUPS' THEN ppddir = globals.!repository'\PPD_E' 791 WHEN driver == 'ECUPS-HP' THEN ppddir = globals.!repository'\PPD_EHP' 792 WHEN driver == 'PSPRINT' THEN ppddir = globals.!repository'\PPD_PS' 793 WHEN driver == 'PSPRINT2' THEN ppddir = globals.!repository'\PPD_PS2' 794 WHEN driver == 'PSCRIPT2' THEN ppddir = globals.!repository'\PPD2' 795 WHEN driver == 'GUTENPRT' THEN ppddir = globals.!repository'\PPD_GP' 796 OTHERWISE ppddir = globals.!repository'\PPD' 797 END 798 799 /* Make sure ppddir (for keeping PPD files) exists */ 800 CALL SysFileTree ppddir, 'dirs.', 'DO' 801 IF dirs.0 == 0 THEN DO 802 ok = VRMkDir( ppddir ) 803 IF ok <> 1 THEN 804 RETURN 5 /** RC=5 failed to create directory */ 805 END 806 807 CALL LINEOUT globals.!log1, 'Directory for PPD files:' ppddir 808 809 /*** 810 *** Now do the actual work. 811 ***/ 812 813 /* Copy the needed driver files to our working directories. 814 */ 815 drvr_dir = VRParseFileName( driver_path, 'DP') 816 drv_out = workdir'\OUT\'driver'.DRV' 817 pin_exe = workdir'\PIN.EXE' 818 ppd_exe = workdir'\PPDENC.EXE' 819 ok = VRCopyFile( driver_path, drv_out ) 820 IF ok == 1 THEN ok = VRCopyFile( drvr_dir'\PIN.EXE', pin_exe ) 821 IF ok == 1 THEN ok = VRCopyFile( drvr_dir'\PPDENC.EXE', ppd_exe ) 822 IF ok == 0 THEN DO 823 RETURN 4 /*** RC=4 Failed to copy driver files ***/ 824 END 825 826 /* Set up the output redirection. 827 */ 828 nq = RXQUEUE('CREATE') 829 oq = RXQUEUE('SET', nq ) 830 831 /* If we are importing a new PPD file, prep it first. 832 * (If ppdfile is undefined, it means we are reimporting a directory of 833 * previously-imported PPDs, and we can assume they are already prepped.) 834 */ 835 IF ppdfile <> '' THEN DO 836 837 /* If the PPD file is compressed, uncompress it. 838 */ 839 IF VRParseFilePath( ppdfile, 'E') == 'GZ' THEN DO 840 decppd = workdir'\' || VRParseFilePath( ppdfile, 'N') 841 CALL LINEOUT globals.!log1, 'Decompressing' ppdfile 'to' decppd 842 ADDRESS CMD '@'globals.!programs.!gzip '-c -d' ppdfile '| RXQUEUE' nq 843 DO QUEUED() 844 PARSE PULL line 845 CALL LINEOUT decppd, line 846 END 847 CALL LINEOUT decppd 848 ppdfile = decppd 849 END 850 851 IF VRFileExists( ppdfile ) == 0 THEN DO 852 CALL LINEOUT globals.!log1, 'PPD file' ppdfile 'could not be found.' 853 RETURN 6 /** RC=6 PPD import failed **/ 854 END 855 856 ppd_use = ppddir'\' || VRParseFileName( ppdfile, 'NE') 857 858 /* Now we have to clean up and validate the PPD file so PIN can use it. 859 * First, PPDENC converts the codepage if necessary, and copies the results 860 * to our working directory. 861 */ 862 CALL LINEOUT globals.!log1, 'Converting PPD with:' ppd_exe ppdfile ppd_use 863 ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2>NUL | RXQUEUE' nq 864 DO QUEUED() 865 PULL output 866 CALL LINEOUT globals.!log2, output 867 END 868 CALL LINEOUT globals.!log2, '' 869 CALL LINEOUT globals.!log2 870 871 IF VRFileExists( ppd_use ) == 0 THEN DO 872 CALL LINEOUT globals.!log1, 'Hmm,' ppd_use 'was not created. Copying manually.' 873 CALL VRCopyFile ppdfile, ppd_use 874 END 875 876 /* Next we strip out some problematic PPD statements which are often 877 * encountered in (for example) CUPS-based PPD files. 878 */ 879 CALL CleanPPD ppd_use, globals.!log1 880 881 END 882 883 /* Preparation complete. Now do the import. 884 */ 885 count = 0 886 ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2>NUL | RXQUEUE' nq 887 DO QUEUED() 888 PARSE PULL output 889 CALL LINEOUT globals.!log2, output 890 PARSE VAR output . 'OK (' nickname 891 IF nickname <> '' THEN DO 892 count = count + 1 893 newprinters.count = STRIP( nickname, 'T', ')') 894 END 895 END 896 newprinters.0 = count 897 CALL LINEOUT globals.!log2, '' 898 CALL LINEOUT globals.!log2 899 900 /* End the output redirection. 901 */ 902 CALL RXQUEUE 'SET', oq 903 CALL RXQUEUE 'DELETE', nq 904 905 IF newprinters.0 == 0 THEN DO 906 RETURN 6 /** RC=6 PPD import failed **/ 907 END 908 909 /*** 910 *** Post-import processing. 911 ***/ 912 913 IF ( driver_repo == 1 ) & ( update_all <> 0 ) THEN DO 914 /* If we're working out of the repository, we need to update the 915 * driver table in PRDESC.LST to add the new driver(s). 916 */ 917 918 CALL LINEOUT globals.!log1, 'Updating' globals.!prdesc 'with new entries from' drv_out 919 920 /* -- This causes a SYS3175 in the .DRV for some reason... 921 ok = UpdatePrDesc( driver'.DRV', drv_out ) 922 IF ok <> 0 THEN 923 CALL LINEOUT globals.!log1, 'Failed to update' globals.!prdesc '(are EAs on' drv_out ' valid?)' 924 */ 925 926 count = 0 927 928 /* First, copy all lines that don't refer to the driver just updated */ 929 CALL LINEIN globals.!prdesc, 1, 0 930 DO WHILE LINES( globals.!prdesc ) 931 _next = LINEIN( globals.!prdesc ) 932 PARSE UPPER VAR _next . ':' _rest 933 _tail = SUBSTR( _rest, LASTPOS('(', _rest )) 934 PARSE VAR _tail '('_prdrv')' . 935 IF _prdrv == driver'.DRV' THEN ITERATE 936 count = count + 1 937 defs.count = _next 938 END 939 CALL STREAM globals.!prdesc, 'C', 'CLOSE' 940 941 /* Next, create a new list for the updated driver and merge that in */ 942 newlist = workdir'\'driver'.LST' 943 CALL CreateDriverList drv_out, newlist 944 DO WHILE LINES( newlist ) 945 _line = LINEIN( newlist ) 946 count = count + 1 947 defs.count = _line 948 END 949 CALL STREAM newlist, 'C', 'CLOSE' 950 defs.0 = count 951 952 /* Now sort the list and recreate PRDESC.LST */ 953 CALL SysStemSort 'defs.',, 'I' 954 prdesc_tmp = workdir'\PRDESC.LST' 955 IF STREAM( prdesc_tmp, 'C', 'QUERY EXISTS') <> '' THEN 956 CALL VRDeleteFile prdesc_tmp 957 DO i = 1 TO defs.0 958 CALL LINEOUT prdesc_tmp, defs.i 959 END 960 CALL LINEOUT prdesc_tmp 961 ok = VRCopyFile( prdesc_tmp, globals.!prdesc ) 962 IF ok == 0 THEN DO 963 RETURN 7 /** RC=7 Error updating PRDESC.LST **/ 964 END 965 CALL VRDeleteFile prdesc_tmp 966 967 END 968 969 /* Finally, copy the updated driver files. 970 */ 971 target = VRParseFilePath( driver_path, 'DP') 972 CALL LINEOUT globals.!log1, 'Copying files from' workdir'\OUT to' target 973 CALL PRReplaceModule target'\'driver'.DRV', '', '' 974 ok = VRCopyFile( workdir'\OUT\'driver'.DRV', target'\'driver'.DRV') 975 IF ok == 1 THEN 976 ok = VRCopyFile( workdir'\OUT\AUXPRINT.PAK', target'\AUXPRINT.PAK') 977 978 IF ( ok == 1 ) & ( update_all <> 0 ) THEN DO 979 /* Copy the updated files to \OS2\DLL\<driver>, replacing any 980 * existing copies. (This prevents problems if the OS/2 driver 981 * installation fails to copy them, which can happen under some 982 * circumstances.) 983 */ 984 IF VRFileExists( globals.!os2dir'\DLL\'driver'\'driver'.DRV') THEN DO 985 CALL VRCopyFile workdir'\OUT\AUXPRINT.PAK',, 986 globals.!os2dir'\DLL\'driver'\AUXPRINT.PAK' 987 CALL PRReplaceModule globals.!os2dir'\DLL\'driver'\'driver'.DRV', '', '' 988 CALL VRCopyFile workdir'\OUT\'driver'.DRV', globals.!os2dir'\DLL\'driver'\'driver'.DRV' 989 END 990 END 991 IF ok == 0 THEN DO 992 CALL LINEOUT globals.!log1, VRError() 993 RETURN 4 /*** RC=4 Failed to copy driver files ***/ 994 END 995 996 CALL LINEOUT globals.!log1, newprinters.0 'printers imported successfully.' 997 DO i = 1 TO newprinters.0 998 CALL LINEOUT globals.!log1, ' ->' newprinters.i 999 END 1000 CALL LINEOUT globals.!log1, '' 1001 CALL LINEOUT globals.!log1 1002 1003 /* Clean up our work directories. 1004 */ 1005 CALL VRDeleteFile workdir'\OUT\*' 1006 CALL VRDeleteFile workdir'\*' 1007 CALL VRRmDir( workdir'\OUT') 1008 CALL VRRmDir( workdir ) 1009 1010 RETURN 0 1011 1012 762 1013 /*:VRX UpdatePrDesc 763 1014 */ … … 781 1032 CALL STREAM globals.!prdesc, 'C', 'CLOSE' 782 1033 783 DO i = 1 TO devs.01034 DO i = 1 TO newdevs.0 784 1035 _count = _count + 1 785 1036 prdefs._count = newdevs.i':' newdevs.i '('driver')'
Note:
See TracChangeset
for help on using the changeset viewer.