From: <doc...@us...> - 2008-11-26 23:59:21
|
Revision: 223 http://openpcl.svn.sourceforge.net/openpcl/?rev=223&view=rev Author: documentsystems Date: 2008-11-26 23:59:17 +0000 (Wed, 26 Nov 2008) Log Message: ----------- 1) PCL Push/Pop cursor position implemented 2) Reset cursor position to x=0, y=0 on subsequent page parse Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java openpcl/src/com/openpcl/pclrenderimage/render/PriCursorPos.java openpcl/src/com/openpcl/pclrenderimage/tools/PclParser.java openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java 2008-10-17 15:59:12 UTC (rev 222) +++ openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java 2008-11-26 23:59:17 UTC (rev 223) @@ -10,6 +10,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; +import java.util.Stack; import com.openpcl.pclrenderimage.api.IPclRenderImage; import com.openpcl.pclrenderimage.render.PriCharWidthTables; @@ -90,6 +91,7 @@ protected PriCharWidthTables mPriCharWidthTables = null; protected PriCursorPos mPriCursorPos = null; + protected Stack<PriCursorPos> mPriCursorStack = null; protected PriDrawText mPriDrawText = null; protected PriFonts mPriFonts = null; protected PriPageSettings mPriPageSettings = null; @@ -135,9 +137,10 @@ if (mBufferedImageToDrawOn != null) { mGraphics2D = getGraphicsWithRenderHints(mBufferedImageToDrawOn); - // Instantiate supporing objects that this class has a reference to + // Instantiate supporting objects that this class has a reference to mPriCharWidthTables = new PriCharWidthTables(); mPriCursorPos = new PriCursorPos(this); + mPriCursorStack = new Stack<PriCursorPos>(); mPriDrawText = new PriDrawText(this, mGraphics2D); mPriFonts = new PriFonts(this, mGraphics2D); mPriPageSettings = new PriPageSettings(); @@ -272,14 +275,15 @@ */ try { // The command value is null for some commands, a parseFloat will throw an exception under this condition - if(cmdValue != null){ + if((cmdValue != null)&&(cmdValue != "")) { // Use Float.parseFloat() then Math.round() because when cmdValue is "10.00", - // Interger.parseInt() returns 0 instead of 10 + // Integer.parseInt() returns 0 instead of 10 cmdValueFloat = Float.parseFloat(cmdValue); cmdValueInt = Math.round(cmdValueFloat); } - } catch (NumberFormatException e) { - } + } catch (NumberFormatException e) { + } + // The "if else" is nested for parse speed instead of a 1 level long string compare chain. // The most frequently used commands should be nearer the top. if(cmdLeadin.equals(PCL_POSITION)){ // Position command @@ -312,7 +316,7 @@ processPrimaryFontCommand(cmdTerminator, cmdValueInt); } else if (cmdLeadin.equals(PCL_RESET)) { processResetCommand(); - } + } } private void processResetCommand() { @@ -472,6 +476,25 @@ */ private void processExecuteCommand(char cmdTerminator, int pBufferPos, int cmdValueInt) { switch(cmdTerminator){ + case 'S': //jfg added push/pop commands 11.10.2008 + switch (cmdValueInt) { + case 0: // &f0S PUSH cursor position + if (mIsStateBuildingPclPages || mIsRecordingAMacro) { return; } + //clone the current position object and place it onto the stack + PriCursorPos tPriCursorPos = (PriCursorPos)mPriCursorPos.clone(); + //place the saved cursor position onto the stack + mPriCursorStack.push(tPriCursorPos); + break; + case 1: // &f1S POP cursor position + if (mIsStateBuildingPclPages || mIsRecordingAMacro) { return; } + if (!mPriCursorStack.empty()){ + //get the last position off the stack + mPriCursorPos = mPriCursorStack.pop(); + } + break; + } + break; + case 'Y': if (mIsStateBuildingPclPages) { return; } mPriDrawText.drawBufferedUpCharsAs1String(); @@ -634,6 +657,7 @@ private void processShadeTransparencyCommand(char cmdTerminator, int cmdValueInt) { switch(cmdTerminator){ case 'T': + if (mIsStateBuildingPclPages || mIsRecordingAMacro) { return; } mPriDrawText.drawBufferedUpCharsAs1String(); // Set current Pattern. 0=black, 1=white. White text is put on top of rectangle draws sometimes mPriPageSettings.setPrintPattern(cmdValueInt); @@ -935,7 +959,7 @@ * Also some Blockument pages start with Fill instead of non fill text don't specifiy a font or LPI or top margin */ mPriFonts.setJavaBuiltInFont(4099); mPriPageSettings.setToInitialValues(); - + mPriCursorPos.setToInitialValues();//jfg fixed 11/06/2008 - without this, multiple parses of the same byte stream have xPos and yPos would never be reset mPclParser = new PclParser(mCurrentClickedPagePclBytes, this); // Parse the PCL bytes from the RmsTools PclParser mPclParser.ParsePCL(); // does callbacks to the 2 interface methods below as necessary (making the BufferedImage) Modified: openpcl/src/com/openpcl/pclrenderimage/render/PriCursorPos.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/render/PriCursorPos.java 2008-10-17 15:59:12 UTC (rev 222) +++ openpcl/src/com/openpcl/pclrenderimage/render/PriCursorPos.java 2008-11-26 23:59:17 UTC (rev 223) @@ -9,12 +9,22 @@ * All the Cursor positioning * @author howard 5/16/2006 */ -public class PriCursorPos { - protected PclRenderImage mPclRenderImage = null; +public class PriCursorPos implements Cloneable { + protected PclRenderImage mPclRenderImage = null; - /** The current X and Y drawing position */ - protected int mXpos = 0; - protected int mYpos = 0; + /** The current X and Y drawing position */ + protected int mXpos = 0; + protected int mYpos = 0; + + //clone implemented for PUSH and POP PCL cmds + public Object clone() { + try { + return super.clone(); + } + catch (CloneNotSupportedException e) { + throw new InternalError(e.toString()); + } + } /** * Constructor Modified: openpcl/src/com/openpcl/pclrenderimage/tools/PclParser.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/tools/PclParser.java 2008-10-17 15:59:12 UTC (rev 222) +++ openpcl/src/com/openpcl/pclrenderimage/tools/PclParser.java 2008-11-26 23:59:17 UTC (rev 223) @@ -82,23 +82,24 @@ public void ParsePCL() { int bufInt; - char ch; + char ch; try { while (( bufInt = buffer.read() ) != -1) { bufferPos++; // = 1; - ch = (char)bufInt; + ch = (char)bufInt; if ( ch == scESC ) { // We have an escape: getPclCommands(); // Loop for all parts of the command } else { callbackObject.charFoundEvent( ch, bufferPos ); } } + System.out.println("parsed " + bufferPos + " bytes"); } catch (ParseException pe) { System.out.println("Unable to complete PCL parsing."); pe.printStackTrace(); } - catch (IOException e) { e.printStackTrace(); } + catch (IOException e) { e.printStackTrace(); } } public void getPclCommands() throws ParseException, IOException { @@ -152,7 +153,21 @@ * ex: Soft font header: ')sxxW'; Transfer Raster: '*b,W'; etc. */ if ((pclState==4 || pclState==6 || pclState==7) && cmdTerminator == 'W' ) { - int numChars = Integer.parseInt( cmdValue ); // BOA ERROR: Throwing 'NumberFormatException' ? (Blank string) + int numChars = 0; + + try + { + + numChars = Integer.parseInt( cmdValue ); + } + catch (NumberFormatException e) + { + // TODO Auto-generated catch block + System.out.println(cmdValue); + e.printStackTrace(); + } + + // BOA ERROR: Throwing 'NumberFormatException' ? (Blank string) cmdData = GetBytesFromBuffer( numChars ); pclState = Math.min(pclState + 1, 7 ); // 4 becomes 5, 6 becomes 7 ?? } else { Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2008-10-17 15:59:12 UTC (rev 222) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2008-11-26 23:59:17 UTC (rev 223) @@ -755,6 +755,8 @@ tPosFileFilter.addExtension("pcl"); tPosFileFilter.addExtension("prn"); tPosFileFilter.addExtension("tem"); + tPosFileFilter.addExtension("txt");//jfg + tPosFileFilter.setDescription("PCL Files"); return tPosFileFilter; } @@ -1325,6 +1327,8 @@ /** Determine the file type by the file extension. * Subclass plugins override this method so do not delete or rename this method. */ public int determineFileTypeByFileExtension(String pExtensionOfFileName) { + return sFileTypePCL; //jfg : removed logic to open all files by extension +/** if (pExtensionOfFileName.equalsIgnoreCase(".PCL") || pExtensionOfFileName.equalsIgnoreCase(".PRN") || pExtensionOfFileName.equalsIgnoreCase(".TEM")) { @@ -1333,6 +1337,7 @@ } else { return sFileTypeNotSupported; } + */ } /** Show the zoom factor in the toolbar button JLabel.setText() */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2009-01-28 00:24:45
|
Revision: 226 http://openpcl.svn.sourceforge.net/openpcl/?rev=226&view=rev Author: documentsystems Date: 2009-01-28 00:24:37 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Version changed to 0.09 January 28, 2009 Modified Paths: -------------- openpcl/src/com/openpcl/install/localinstaller/HelpAbout.html openpcl/src/com/openpcl/install/localinstaller/LicenseInfo.html openpcl/src/com/openpcl/install/localinstaller/openpclviewer-izpack-shortcut-win.xml openpcl/src/com/openpcl/install/localinstaller/openpclviewer-izpack.xml openpcl/src/com/openpcl/install/website/index.html openpcl/src/com/openpcl/viewer/htmlfiles/HelpAbout.html openpcl/src/com/openpcl/viewer/htmlfiles/LicenseInfo.html Modified: openpcl/src/com/openpcl/install/localinstaller/HelpAbout.html =================================================================== --- openpcl/src/com/openpcl/install/localinstaller/HelpAbout.html 2008-12-11 01:14:38 UTC (rev 225) +++ openpcl/src/com/openpcl/install/localinstaller/HelpAbout.html 2009-01-28 00:24:37 UTC (rev 226) @@ -2,7 +2,7 @@ <html><head><title>OpenPCL Viewer Help About</title></head> <body><font size=4 face="arial"> <b>OpenPCL Viewer - Free Open Source PCL Viewer for the World.</b><br> -Version 0.08 December 5, 2007<br> +Version 0.09 January 28, 2009<br> OpenPCL is made up of OpenPCLViewer and PclRenderImage.<br> <br> <b>Features:</b> Modified: openpcl/src/com/openpcl/install/localinstaller/LicenseInfo.html =================================================================== --- openpcl/src/com/openpcl/install/localinstaller/LicenseInfo.html 2008-12-11 01:14:38 UTC (rev 225) +++ openpcl/src/com/openpcl/install/localinstaller/LicenseInfo.html 2009-01-28 00:24:37 UTC (rev 226) @@ -2,7 +2,7 @@ <html><head><title>OpenPCL Viewer License</title></head> <body><font size=4 face="arial"> <b>OpenPCL Viewer - Free Open Source PCL Viewer for the World.</b> -<br>Version 0.08 December 5, 2007 +<br>Version 0.09 January 28, 2009 <br>OpenPCL is made up of OpenPCLViewer and PclRenderImage. <br> <p>The OpenPCL license is the GNU Lesser General Public License (LGPL) which you can view at Modified: openpcl/src/com/openpcl/install/localinstaller/openpclviewer-izpack-shortcut-win.xml =================================================================== --- openpcl/src/com/openpcl/install/localinstaller/openpclviewer-izpack-shortcut-win.xml 2008-12-11 01:14:38 UTC (rev 225) +++ openpcl/src/com/openpcl/install/localinstaller/openpclviewer-izpack-shortcut-win.xml 2009-01-28 00:24:37 UTC (rev 226) @@ -12,7 +12,7 @@ workingDirectory="$INSTALL_PATH\" commandLine="" iconFile="$INSTALL_PATH\openpclviewer.ico" - description="OpenPCL Viewer - Free Open Source PCL Viewer for the World. Version 0.08 December 5, 2007"> + description="OpenPCL Viewer - Free Open Source PCL Viewer for the World. Version 0.09 January 28, 2009"> <createForPack name="Core"/> </shortcut> <shortcut name="Uninstall OpenPCLViewer (local install)" Modified: openpcl/src/com/openpcl/install/localinstaller/openpclviewer-izpack.xml =================================================================== --- openpcl/src/com/openpcl/install/localinstaller/openpclviewer-izpack.xml 2008-12-11 01:14:38 UTC (rev 225) +++ openpcl/src/com/openpcl/install/localinstaller/openpclviewer-izpack.xml 2009-01-28 00:24:37 UTC (rev 226) @@ -2,7 +2,7 @@ <installation version="1.0"> <info> <appname>OpenPCLViewer</appname> - <appversion>OpenPCL Viewer - Free Open Source PCL Viewer for the World. Version 0.08 December 5, 2007</appversion> + <appversion>OpenPCL Viewer - Free Open Source PCL Viewer for the World. Version 0.09 January 28, 2009</appversion> <appsubpath>OpenPCLViewer</appsubpath> <url>http://www.openpcl.com</url> <authors> Modified: openpcl/src/com/openpcl/install/website/index.html =================================================================== --- openpcl/src/com/openpcl/install/website/index.html 2008-12-11 01:14:38 UTC (rev 225) +++ openpcl/src/com/openpcl/install/website/index.html 2009-01-28 00:24:37 UTC (rev 226) @@ -226,12 +226,12 @@ <div id="downloadWin32Div"> <a href="openpclviewer-setup.exe" class="downloadLink"> Download OpenPCL Viewer Now!</a><br/> - v0.08 12/5/07 for Windows<br/> + v0.09 01/28/09 for Windows<br/> </div> <div id="downloadOtherDiv" style="display:none"> <a href="openpclviewer-installer.jar" class="downloadLink"> Download OpenPCL Viewer Now!</a><br/> - v0.08 12/5/07 for Mac/Linux<br/> + v0.09 01/28/09 for Mac/Linux<br/> <span class="downloadReq"> Requires Java JRE 1.5<br/> </span> @@ -266,7 +266,7 @@ <a href="javascript:loadContent('developers')" class="copyright">Developer</a> | <a href="javascript:loadContent('contact')" class="copyright">Contact</a> </td> - <td align="right" class="copyright">Copyright 2007 OpenPCL. Sponsored by <a href="http://www.docmagic.com" class="copyright">DocMagic, Inc.</a></td> + <td align="right" class="copyright">Copyright 2009 OpenPCL. Sponsored by <a href="http://www.docmagic.com" class="copyright">DocMagic, Inc.</a></td> </tr> </table> </div> Modified: openpcl/src/com/openpcl/viewer/htmlfiles/HelpAbout.html =================================================================== --- openpcl/src/com/openpcl/viewer/htmlfiles/HelpAbout.html 2008-12-11 01:14:38 UTC (rev 225) +++ openpcl/src/com/openpcl/viewer/htmlfiles/HelpAbout.html 2009-01-28 00:24:37 UTC (rev 226) @@ -2,7 +2,7 @@ <html><head><title>OpenPCL Viewer Help About</title></head> <body><font size=4 face="arial"> <b>OpenPCL Viewer - Free Open Source PCL Viewer for the World.</b><br> -Version 0.08 December 5, 2007<br> +Version 0.09 January 28, 2009<br> OpenPCL is made up of OpenPCLViewer and PclRenderImage.<br> <br> <b>Features:</b> Modified: openpcl/src/com/openpcl/viewer/htmlfiles/LicenseInfo.html =================================================================== --- openpcl/src/com/openpcl/viewer/htmlfiles/LicenseInfo.html 2008-12-11 01:14:38 UTC (rev 225) +++ openpcl/src/com/openpcl/viewer/htmlfiles/LicenseInfo.html 2009-01-28 00:24:37 UTC (rev 226) @@ -2,7 +2,7 @@ <html><head><title>OpenPCL Viewer License</title></head> <body><font size=4 face="arial"> <b>OpenPCL Viewer - Free Open Source PCL Viewer for the World.</b> -<br>Version 0.08 December 5, 2007 +<br>Version 0.09 January 28, 2009 <br>OpenPCL is made up of OpenPCLViewer and PclRenderImage. <br> <p>The OpenPCL license is the GNU Lesser General Public License (LGPL) which you can view at This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |