You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
(19) |
Jul
(39) |
Aug
(30) |
Sep
(14) |
Oct
(4) |
Nov
(12) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(2) |
2009 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <doc...@us...> - 2007-07-26 20:48:40
|
Revision: 130 http://openpcl.svn.sourceforge.net/openpcl/?rev=130&view=rev Author: documentsystems Date: 2007-07-26 13:48:42 -0700 (Thu, 26 Jul 2007) Log Message: ----------- Howard Hoagland. In PosPrintPages, in addPclBytesForPrintingFormNames(), added code to adjust higher the Y location of the Form Name at the bottom of the page of Legal pages shrunk to fit on Letter paper, and adjust lower to go to the bottom of the page for Letter pages printed on Legal paper. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-26 18:33:23 UTC (rev 129) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-26 20:48:42 UTC (rev 130) @@ -439,35 +439,62 @@ if (pFormName == null || pFormName.length() < 1) { return; } final int tNumPixelsFromPageEdge = 210; + final int tNumPixelsFromPageEdgeWhenShrinkLegalOnLetter = 230; + final int tYPosForLetterPortrait = (300 * 11) - tNumPixelsFromPageEdge; final int tYPosForLegalPortrait = (300 * 14) - tNumPixelsFromPageEdge; + final int tYPosForLegalPortraitWhenShrinkToLetter = (300 * 14) - tNumPixelsFromPageEdgeWhenShrinkLegalOnLetter; final int tYPosforLetterOrLegalLandscape =(int)(Math.round(300 * 8.5d) - tNumPixelsFromPageEdge); - // Default to Legal Portrait Y position - int tYPosForFormName = tYPosForLegalPortrait; - + // Default to Letter Portrait Y position + int tYPosForFormName = tYPosForLetterPortrait; + + // Set the Y position for where to put the Form Name depending on 3 things: + // 1. Portrait/Landcape + // 2. Letter/Legal + // 3. Print all on Letter/Legal if (pPageOrientation == sPageOrientationPortrait) { - if (pLetterOrLegal.equalsIgnoreCase("LTR")) { - tYPosForFormName = tYPosForLetterPortrait; + // Here for Portrait + if (pLetterOrLegal.equalsIgnoreCase("LGL")) { + // Here for Portrait and Legal + if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal()) { + // Here for Portrait and Legal and Print all on Letter (shrink Legal) + tYPosForFormName = tYPosForLegalPortraitWhenShrinkToLetter; + } else { + // Here for Portrait and Legal + tYPosForFormName = tYPosForLegalPortrait; + } + + } else if (pLetterOrLegal.equalsIgnoreCase("LTR")) { + // Here for Portrait and Letter + if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + // Here for Portrait and Letter and Print all on Legal + tYPosForFormName = tYPosForLegalPortrait; + } else { + // Here for Portrait and Letter + tYPosForFormName = tYPosForLetterPortrait; + } } } else if (pPageOrientation == sPageOrientationLandscape) { + // Here for Landscape. There's only one condition for now. If Landscape is implemented later, then add more here tYPosForFormName = tYPosforLetterOrLegalLandscape; } - - try { - pBaos.write(tFormNameFont); - pBaos.write(sbESC); - pBaos.write('*'); - pBaos.write('p'); - pBaos.write('0'); - pBaos.write('x'); - pBaos.write(String.valueOf(tYPosForFormName).getBytes()); - pBaos.write('Y'); // Cursor position to (x,y) using ESC * p 0 x 123 Y - pBaos.write(pFormName.getBytes()); - pBaos.write(tDefaultCourierFont); - } catch (IOException e) { - PriDebug.releaseln("In PosPrintPages, can't write Form Name into ByteArrayOutputStream"); - } + + // Save the PCL bytes needed to select the font, do (x,y) positioning, put the form name, reset the font to default + try { + pBaos.write(tFormNameFont); + pBaos.write(sbESC); + pBaos.write('*'); + pBaos.write('p'); + pBaos.write('0'); + pBaos.write('x'); + pBaos.write(String.valueOf(tYPosForFormName).getBytes()); + pBaos.write('Y'); // Cursor position to (x,y) using ESC * p 0 x 123 Y + pBaos.write(pFormName.getBytes()); + pBaos.write(tDefaultCourierFont); + } catch (IOException e) { + PriDebug.releaseln("In PosPrintPages, can't write Form Name into ByteArrayOutputStream"); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-26 18:33:20
|
Revision: 129 http://openpcl.svn.sourceforge.net/openpcl/?rev=129&view=rev Author: documentsystems Date: 2007-07-26 11:33:23 -0700 (Thu, 26 Jul 2007) Log Message: ----------- Howard Hoagland. In PosPrintPages in addpclBytesforPrintingFormNames(), changed the hard coded pixels from bottom edge of page of 205 in 3 lines to be the int variable tNumPixelsFromPageEdge with value 210, so that the bottom of the text of the form names at the bottom of the page, won't get chopped off due to it was too low to fit in the printabe area. This was needed for 8 point font. Using 6 point font then 205 is OK. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-26 18:29:28 UTC (rev 128) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-26 18:33:23 UTC (rev 129) @@ -438,9 +438,10 @@ // Return if form name is null or blank if (pFormName == null || pFormName.length() < 1) { return; } - int tYPosForLetterPortrait = (300 * 11) - 205; - int tYPosForLegalPortrait = (300 * 14) - 205; - int tYPosforLetterOrLegalLandscape =(int)(Math.round(300 * 8.5d) - 205); + final int tNumPixelsFromPageEdge = 210; + final int tYPosForLetterPortrait = (300 * 11) - tNumPixelsFromPageEdge; + final int tYPosForLegalPortrait = (300 * 14) - tNumPixelsFromPageEdge; + final int tYPosforLetterOrLegalLandscape =(int)(Math.round(300 * 8.5d) - tNumPixelsFromPageEdge); // Default to Legal Portrait Y position int tYPosForFormName = tYPosForLegalPortrait; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-26 18:29:28
|
Revision: 128 http://openpcl.svn.sourceforge.net/openpcl/?rev=128&view=rev Author: documentsystems Date: 2007-07-26 11:29:28 -0700 (Thu, 26 Jul 2007) Log Message: ----------- Howard Hoagland. In PclRenderImage added a ByteArrayOutputStream that is constructed once and resused for each print page to build the resulting PCL bytes to parse and draw to the bitmap for Windows Print, in the method getImageForPage() appending the added parameter byte[] pPrintTimePclBytes then the base page PCL bytes to implement the "Print Form Names" for Windows Print (PCL Direct print was already implemented previously). Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java Modified: openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java 2007-07-26 18:24:22 UTC (rev 127) +++ openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java 2007-07-26 18:29:28 UTC (rev 128) @@ -4,6 +4,7 @@ import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -75,6 +76,7 @@ protected double mCurrentZoomFactor = sDefaultZoomFactor; protected PriPclPage mPriPclPage = null; protected ArrayList<PriPclPage> mPagesArrayList = null; + protected ByteArrayOutputStream mByteArrayOutputStream = null; protected String mFullFilePathAndName = null; protected String mFileNameNoPath = null; @@ -112,7 +114,12 @@ mPriRasterDrawing = new PriRasterDrawing(this, mBufferedImageToDrawOn); mPriRectDrawing = new PriRectDrawing(this, mGraphics2D); mPriPclPage = new PriPclPage(); - mPagesArrayList = new ArrayList<PriPclPage>(4); + mPagesArrayList = new ArrayList<PriPclPage>(10); // Grows automatically if max is reached + + // Make a new ByteArrayOutputStream to hold the Pcl bytes gotten from the BLK page or from the PCL file page, + // and make it 20k bytes. Note that ByteArrayOutputStream automatically grows the storage space if it + // runs out of room by allocating a new bigger byte array then doing a memcopy to the new one. + mByteArrayOutputStream = new ByteArrayOutputStream(20 * 1024); } } @@ -910,12 +917,14 @@ * In DocMaster, this is getImage(). * * @param pPageNumber. The Pcl page number to render to the image. + * @param pPrintTimePclBytes. Draw these additional PCL bytes on the print image. * @param pIsForPrinting. If true non printing items like signature blocks won't be rendered. * @param pPaperSize. If a paper size is not specified in the PCL, this paper size will be used. "LTR" or "LGL". * @param pZoomFactor. This is mandatory (see note for why). * @return BufferedImage. If null is returned, then call getLastErrorString() */ - public BufferedImage getImageForPage(int pPageNumber, boolean pIsForPrinting, String pPaperSize, double pZoomFactor) { + public BufferedImage getImageForPage(int pPageNumber, byte[] pPrintTimePclBytes, + boolean pIsForPrinting, String pPaperSize, double pZoomFactor) { // PriDebug.infoln("PclRenderImage> getImageForPage(page=" + pPageNumber + ", boolean printing=" + // pIsForPrinting + "String paperSize=" + pPaperSize + ", double zoom=" + pZoomFactor + ")"); @@ -929,6 +938,17 @@ return null; } + // Set the char pointer in the ByteArrayOutputStream to 0 bytes, to reuse it without doing a "new" to make a new one + mByteArrayOutputStream.reset(); + + // If rendering for printing, and there are additional print time PCL bytes to draw, then write those bytes here + if (pIsForPrinting && pPrintTimePclBytes != null) { + try { + mByteArrayOutputStream.write(pPrintTimePclBytes); + } catch (IOException e) { + } + } + // Pull the Pcl bytes for this page out of the PriPclPage byte[] tPclBytes = tPriPclPage.getPclBytes(); if (tPclBytes == null || tPclBytes.length < 1) { @@ -936,12 +956,24 @@ return null; } + // Save passed in parameter to class instance variable to be accessed during the printing mIsDrawingForPrinting = pIsForPrinting; + + // Write the Pcl bytes from the page + try { + mByteArrayOutputStream.write(tPclBytes); + } catch (IOException e) { + } // PriDebug.infoln("PclRenderImage> getImageForPage() calling parseAndRender(#bytes=" + tPclBytes.length + // ", printing=" + pIsForPrinting + ", zoom=" + pZoomFactor); - - return parseAndRender(tPclBytes, pIsForPrinting, pZoomFactor); + + // Get the byte[] out of the ByteArrayOutputStream + byte[] tBytesToRender = mByteArrayOutputStream.toByteArray(); + // Draw the PCL bytes on the BufferedImage + BufferedImage tBufferedImage = parseAndRender(tBytesToRender, pIsForPrinting, pZoomFactor); + // Return the BufferedImage + return tBufferedImage; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-26 18:24:20
|
Revision: 127 http://openpcl.svn.sourceforge.net/openpcl/?rev=127&view=rev Author: documentsystems Date: 2007-07-26 11:24:22 -0700 (Thu, 26 Jul 2007) Log Message: ----------- Howard Hoagland. In OpenPCLViewer in the methods renderImageForPrintingFromPageNumber() and getImageForPage(), added the parameter byte[] pPrintTimePclBytes and code in the methods to implement the "Print Form Names" for Windows Print (PCL Direct print was already implemented previously). Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-26 18:20:14 UTC (rev 126) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-26 18:24:22 UTC (rev 127) @@ -1513,7 +1513,7 @@ // Get the image for the one selected Pcl page in the currently selected PosView its current zoom factor double tZoomFactor = mPosViewSelected.getPosZoomLogic().getCurrentZoomFactor(); - BufferedImage tBufferedImage = getImageForPage(tPageNumber, false, tPaperSize, tZoomFactor); + BufferedImage tBufferedImage = getImageForPage(tPageNumber, null, false, tPaperSize, tZoomFactor); PriDebug.infoln("OpenPCLViewer> returned from getImageForPage(tPageNumber, false, tPaperSize, tZoomFactor)"); // Pass the returned BufferedImage from above here to put it on the screen. @@ -1544,18 +1544,20 @@ public BufferedImage renderImageForPrintingFromTreeNode(PosTreeNode pPosTreeNode) { if (pPosTreeNode == null) { return null; } - // Pass only the page number of the tree node to PclRenderImage to render the BufferedImage. - // Important: Subclasses that override this method will have more complex code than just the one line below, - // so that's why there is only this one line is in this one method, so this method can be overridden in subclasses. - BufferedImage tBufferedImage = renderImageForPrintingFromPageNumber(pPosTreeNode.getNodeNumber()); + // Pass the page number of the tree node and the print time only additional PCL bytes to draw + // to PclRenderImage to render the BufferedImage. + // Important: Subclasses that override this method will have more complex code than just the below. + BufferedImage tBufferedImage = renderImageForPrintingFromPageNumber( + pPosTreeNode.getNodeNumber(), pPosTreeNode.getPrintTimePclBytes()); + return tBufferedImage; } - /** Render the BufferedImage from the page number. */ - public BufferedImage renderImageForPrintingFromPageNumber(int pPageNumber) { + /** Render the BufferedImage from the page number and the print time only additional PCL bytes to draw */ + public BufferedImage renderImageForPrintingFromPageNumber(int pPageNumber, byte[] pPrintTimePclBytes) { String tPaperSize = getPaperSizeForPage(pPageNumber); // Get the image for the one selected Pcl page in the currently selected PosView its current zoom factor - BufferedImage tBufferedImage = getImageForPage(pPageNumber, true, tPaperSize, 1.0d); + BufferedImage tBufferedImage = getImageForPage(pPageNumber, pPrintTimePclBytes, true, tPaperSize, 1.0d); return tBufferedImage; } @@ -1612,18 +1614,21 @@ * In DocMaster, this is getImage(). * * @param pPageNumber. The Pcl page number to render to the image. + * @param pPrintTimePclBytes. Draw these additional PCL bytes on the print image. * @param pIsForPrinting. If true non printing items like signature blocks won't be rendered. * @param pPaperSize. If a paper size is not specified in the PCL, this paper size will be used. "LTR" or "LGL". * @param pZoomFactor. This is mandatory (see note for why). - * @return returnserror String from PclRenderImage.getLastErrorString() + * @return BufferedImage. If null, then get the return String from PclRenderImage.getLastErrorString() */ - public BufferedImage getImageForPage(int pPageNumber, boolean pIsForPrinting, String pPaperSize, double pZoomFactor) { + public BufferedImage getImageForPage(int pPageNumber, byte[] pPrintTimePclBytes, + boolean pIsForPrinting, String pPaperSize, double pZoomFactor) { if (mPosViewSelected != null) { PriDebug.infoln("OpenPCLViewer> getImageForPage(page=" + pPageNumber + ", boolean printing=" + pIsForPrinting + "String paperSize=" + pPaperSize + ", double zoom=" + pZoomFactor + ")"); - return mPosViewSelected.getPclRenderImage().getImageForPage( - pPageNumber, pIsForPrinting, pPaperSize, pZoomFactor); + return mPosViewSelected.getPclRenderImage().getImageForPage(pPageNumber, pPrintTimePclBytes, + pIsForPrinting, pPaperSize, pZoomFactor); + } else { return null; } @@ -1676,7 +1681,7 @@ * Convenience method that calls PclRenderImage.getBufferedImageToDrawOn(). * Get the BufferedImage to draw on for purposes of an external app can call methods on the * BufferedImage object so the external app can directly draw on the image if wanted. - * @return BufferedImage or if error returns null in which case call getLastErrorString() + * @return BufferedImage. If null, then get the return String from PclRenderImage.getLastErrorString() */ public BufferedImage getBufferedImageToDrawOn() { if (mPosViewSelected != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-26 18:20:13
|
Revision: 126 http://openpcl.svn.sourceforge.net/openpcl/?rev=126&view=rev Author: documentsystems Date: 2007-07-26 11:20:14 -0700 (Thu, 26 Jul 2007) Log Message: ----------- In each of the 4 files IOpenPCL, IPclRenderImage, OpenPCLViewer, IPclRenderImage, in the method getImageForPage(), added the parameter byte[] pPrintTimePclBytes and code in the methods to implement the "Print Form Names" for Windows Print (PCL Direct print was already implemented previously). Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/api/IPclRenderImage.java openpcl/src/com/openpcl/viewer/api/IOpenPCL.java Modified: openpcl/src/com/openpcl/pclrenderimage/api/IPclRenderImage.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/api/IPclRenderImage.java 2007-07-26 01:27:15 UTC (rev 125) +++ openpcl/src/com/openpcl/pclrenderimage/api/IPclRenderImage.java 2007-07-26 18:20:14 UTC (rev 126) @@ -37,12 +37,14 @@ * In DocMaster, this is getImage(). * * @param pPageNumber. The Pcl page number to render to the image. + * @param pPrintTimePclBytes. Draw these additional PCL bytes on the print image. * @param pIsForPrinting. If true non printing items like signature blocks won't be rendered. * @param pPaperSize. If a paper size is not specified in the PCL, this paper size will be used. "LTR" or "LGL". * @param pZoomFactor. This is mandatory (see note for why). * @return BufferedImage. If null is returned, then call getLastErrorString() */ - public BufferedImage getImageForPage(int pPageNumber, boolean pIsForPrinting, String pPaperSize, double pZoomFactor); + public BufferedImage getImageForPage(int pPageNumber, byte[] pPrintTimePclBytes, + boolean pIsForPrinting, String pPaperSize, double pZoomFactor); /** * Get the last error string. Call this if getImageForPage() returned null instead of returning the BufferedImage. Modified: openpcl/src/com/openpcl/viewer/api/IOpenPCL.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-07-26 01:27:15 UTC (rev 125) +++ openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-07-26 18:20:14 UTC (rev 126) @@ -66,12 +66,14 @@ * In DocMaster, this is getImage(). * * @param pPageNumber. The Pcl page number to render to the image. + * @param pPrintTimePclBytes. Draw these additional PCL bytes on the print image. * @param pIsForPrinting. If true non printing items like signature blocks won't be rendered. * @param pPaperSize. If a paper size is not specified in the PCL, this paper size will be used. "LTR" or "LGL". * @param pZoomFactor. This is mandatory (see note for why). * @return BufferedImage. If null is returned, then call getLastErrorString() */ - public BufferedImage getImageForPage(int pPageNumber, boolean pIsForPrinting, String pPaperSize, double pZoomFactor); + public BufferedImage getImageForPage(int pPageNumber, byte[] pPrintTimePclBytes, + boolean pIsForPrinting, String pPaperSize, double pZoomFactor); /** * Convenience method that calls PclRenderImage.getLastRenderErrorString(). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-26 01:27:14
|
Revision: 125 http://openpcl.svn.sourceforge.net/openpcl/?rev=125&view=rev Author: documentsystems Date: 2007-07-25 18:27:15 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. Changed the move chars to the right to move less agressively to center the chars in each character cell box by changing Math.ceil to Math.round. Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java Modified: openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java 2007-07-26 00:59:47 UTC (rev 124) +++ openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java 2007-07-26 01:27:15 UTC (rev 125) @@ -256,12 +256,11 @@ // b. Use Math.floor for move char to the left if (spaceOnLeft < spaceOnRight) { // Move char to the right because the char is in the char cell box to far to the left and you can see it - // needs to be moved to the right. Use Math.ceil on the move chars to the right to agressively move - // chars to the right. For move right, dont use Math.floor (moves only a little bit), and Math.round is - // between those two. + // needs to be moved to the right. Use Math.round on the move chars to the right dont use Math.floor + // (moves only a little bit), and Math.ceil moves too much. // Reason is: the internal printer font char widths are wider than the screen char widths. offsetXforCenterAllCharsInCharCellBox = - (int) Math.ceil(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnLeft); + (int) Math.round(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnLeft); switch (afterSubstitutionsCharToDraw) { case 'j': @@ -274,13 +273,13 @@ } } else { // Move char to the left because the char is in the char cell box to far to the right and you can see it - // needs to be moved to the left. Use Math.round on the move chars to the left to "only a little bit" move - // chars to the left. For move left, dont use Math.ceil (aggressively moves), and Math.floor moves not enough. + // needs to be moved to the left. Use Math.floor on the move chars to the left to "only a little bit" move + // chars to the left. For move left, dont use Math.ceil (aggressively moves), and Math.round moves too much too. // Reason is: the internal printer font char widths are wider than the screen char widths, but there are // some chars that need to move left instead of move right. For example, the "r" char is flushed right // in the char cell box and needs to move only a small bit to the left, not a lot. offsetXforCenterAllCharsInCharCellBox = - -1 * ((int) Math.round(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnRight)); + -1 * ((int) Math.floor(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnRight)); // For non bold chars (leave bold chars alone) switch (afterSubstitutionsCharToDraw) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-26 00:59:50
|
Revision: 124 http://openpcl.svn.sourceforge.net/openpcl/?rev=124&view=rev Author: documentsystems Date: 2007-07-25 17:59:47 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. Fixed the bumping the chars to the left a little more to center the characters in their char cell box to look better on the screen. Also, changed the bump the "f" char 1/2 of the calculated space because it was being moved too far to the left and touching the "e" or "o" char to it's left. Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java Modified: openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java 2007-07-26 00:04:12 UTC (rev 123) +++ openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java 2007-07-26 00:59:47 UTC (rev 124) @@ -274,21 +274,20 @@ } } else { // Move char to the left because the char is in the char cell box to far to the right and you can see it - // needs to be moved to the left. Use Math.floor on the move chars to the left to "only a little bit" move - // chars to the left. For move left, dont use Math.ceil (aggressively moves), and Math.round is - // between those two. + // needs to be moved to the left. Use Math.round on the move chars to the left to "only a little bit" move + // chars to the left. For move left, dont use Math.ceil (aggressively moves), and Math.floor moves not enough. // Reason is: the internal printer font char widths are wider than the screen char widths, but there are // some chars that need to move left instead of move right. For example, the "r" char is flushed right // in the char cell box and needs to move only a small bit to the left, not a lot. offsetXforCenterAllCharsInCharCellBox = - -1 * ((int) Math.floor(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnRight)); + -1 * ((int) Math.round(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnRight)); // For non bold chars (leave bold chars alone) switch (afterSubstitutionsCharToDraw) { case 'f': // Bump to the left the specified chars 1/2 of calculated left/right difference due to // TextLayout.getBounds() has the these chars out of the bounding box to the right. - if (offsetXforCenterAllCharsInCharCellBox > 1) { offsetXforCenterAllCharsInCharCellBox /= 2; } + if (offsetXforCenterAllCharsInCharCellBox < 1) { offsetXforCenterAllCharsInCharCellBox /= 2; } break; default: break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-26 00:04:09
|
Revision: 123 http://openpcl.svn.sourceforge.net/openpcl/?rev=123&view=rev Author: documentsystems Date: 2007-07-25 17:04:12 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In PosView added getCurrentViewRectangle() and scrollViewToPosition() that OpenPCLViewer renderImageCurrentPageAndZoom() calls, so that it scolls the next page draw to where the last page was scrolled to, so that the next page draw won't always end up at upper left corner is (0,0). Modified Paths: -------------- openpcl/src/com/openpcl/viewer/panels/PosView.java Modified: openpcl/src/com/openpcl/viewer/panels/PosView.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-07-25 23:58:18 UTC (rev 122) +++ openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-07-26 00:04:12 UTC (rev 123) @@ -3,6 +3,7 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Point; +import java.awt.Rectangle; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.MouseEvent; @@ -407,6 +408,14 @@ return mViewJScrollPane.getViewport().getViewPosition(); } + public Rectangle getCurrentViewRectangle() { + return mViewJScrollPane.getViewport().getViewRect(); + } + + public void scrollViewToPosition(Rectangle pScrollBarPosition) { + mViewJScrollPane.getViewport().scrollRectToVisible(pScrollBarPosition); + } + /** While doing a cascade or tile horizontal or vertical, put a visual cue on the screen for each view * so the user knows the image is being updated and isn't done yet. The cue usually shows for less than 1/4 second * but could get to 1/2 second if there are for example more than 4 views open that are showing a very busy page */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 23:58:16
|
Revision: 122 http://openpcl.svn.sourceforge.net/openpcl/?rev=122&view=rev Author: documentsystems Date: 2007-07-25 16:58:18 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In 3 files, changed the actionShowHideTree toolbar button to pass a boolean whether the user did a Ctrl-click and if the control key was down when the user clicked the toggle show hide the tree panel, then do the hidden feature action which draws an underline under each char that was bumped to the right or left to center each character in its char cell. A red underline means the char was bumped to the right to center it. A cyan color underline means the char was bumped to the left to center it. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java openpcl/src/com/openpcl/viewer/api/IOpenPCL.java openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-25 19:57:45 UTC (rev 121) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-25 23:58:18 UTC (rev 122) @@ -1505,6 +1505,9 @@ int tPageNumber = mPosViewSelected.getCurrentPageNumberSelected(); String tPaperSize = getPaperSizeForPage(tPageNumber); + // Save the (x,y) scrolled to point + Rectangle tScrollBarPosition = mPosViewSelected.getCurrentViewRectangle(); + // Show the "Updating Image" message on the currently selected PosView mPosViewSelected.showUpdatingImageVisualCue(); @@ -1524,6 +1527,9 @@ // Make the JTree panel scroll left all the way mPosViewSelected.getTreeJScrollPane().getHorizontalScrollBar().setValue(0); + // Scroll the view to where it was before updating the image + mPosViewSelected.scrollViewToPosition(tScrollBarPosition); + if (tBufferedImage == null) { // PclRenderImage returned null for the BufferedImage, so here return the last error string from the // currently selected PosView's PclRenderImage @@ -2066,14 +2072,25 @@ } /** Toggle show/hide the pages tree */ - public void actionShowHideTree() { - if (mPosViewSelected != null) { - if (mPosViewSelected.getIsTreePanelShowing()) { - actionHideTree(); + public void actionShowHideTree(boolean pControlKeyPressed) { + if (mPosViewSelected == null) { return; } + + if (!pControlKeyPressed) { + if (mPosViewSelected.getIsTreePanelShowing()) { + actionHideTree(); + } else { + actionShowTree(); + } + } else { - actionShowTree(); + // Hidden feature. If the Control key is pressed when clicking this button, then do the below + // that draws an underline under each char that was bumped to the right or left to center each character in its char cell. + // A red underline means the char was bumped to the right to center it. + // A cyan color underline means the char was bumped to the left to center it. + boolean tToggleCenterCharInCharCellBox = mPosViewSelected.getPclRenderImage().getWantToCenterCharInCharCellBox(); + mPosViewSelected.getPclRenderImage().setWantToCenterCharInCharCellBox(!tToggleCenterCharInCharCellBox); + renderImageCurrentPageAndZoom(); } - } } /** Show the pages tree */ Modified: openpcl/src/com/openpcl/viewer/api/IOpenPCL.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-07-25 19:57:45 UTC (rev 121) +++ openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-07-25 23:58:18 UTC (rev 122) @@ -194,7 +194,7 @@ public void actionNextPage(); /** Toggle show/hide the pages tree */ - public void actionShowHideTree(); + public void actionShowHideTree(boolean pControlKeyPressed); /** Show the pages tree */ public void actionShowTree(); Modified: openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java =================================================================== --- openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-07-25 19:57:45 UTC (rev 121) +++ openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-07-25 23:58:18 UTC (rev 122) @@ -204,7 +204,13 @@ protected JButton createShowHideTreeButton() { JButton tJButton = createToolBarButton("TogglePane.gif", "Show/Hide Tree (Ctrl T)"); tJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) {mOpenPCLViewer.actionShowHideTree();} + public void actionPerformed(ActionEvent e) { + if ((e.getModifiers() & ActionEvent.CTRL_MASK) > 1) { + mOpenPCLViewer.actionShowHideTree(true); + } else { + mOpenPCLViewer.actionShowHideTree(false); + } + } }); return tJButton; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 19:58:04
|
Revision: 121 http://openpcl.svn.sourceforge.net/openpcl/?rev=121&view=rev Author: documentsystems Date: 2007-07-25 12:57:45 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In PosPrintPages, for print "PCL Direct" (doesn't implement "Windows Print" yet) added the code that does the "Print Form Names" that is on the print setup dialog. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-25 19:54:16 UTC (rev 120) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-25 19:57:45 UTC (rev 121) @@ -59,6 +59,8 @@ public static final int sProcessPrintSelected = 1; public static final int sProcessPrintChanged = 2; public static final int sProcessPrintRemaining = 3; + public static final int sPageOrientationPortrait = 1; + public static final int sPageOrientationLandscape = 2; private int mProcessPrintType = 0; private int mNumberOfPagesThatWillPrint = 0; private static final String[] mTitleBarTextForPrintDialog = { @@ -225,23 +227,30 @@ return false; } + // Call setters on the progress bar mPrintingProgressBar.setMaximum(mNumberOfPagesThatWillPrint); mPrintingProgressBar.setString("Initializing..."); mPrintingProgressBar.setValue(0); mPrintingProgressJDialog.setLocationRelativeTo(mParentFrame); + // Reorder ArrayList items depending on if "Legal first then Letter" or "Letter first then Legal" if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { moveLegalPagesToTopOfArrayList(mPagesToPrintArrayList); } else if (mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { moveLetterPagesToTopOfArrayList(mPagesToPrintArrayList); } + + // Add Pcl bytes for printing + addPclBytesForPrinting(mPagesToPrintArrayList); + // Thread for showing the progress bar final SwingWorker threadShowProgressBar = new SwingWorker() { public Object construct() { mPrintingProgressJDialog.setVisible(true); return null; }}; - + + // Thread for calling imagePrint() or calling printPclDirect() final SwingWorker threadPrintPages = new SwingWorker() { public Object construct() { // Show the JDialog that has the JProgressBar @@ -263,7 +272,7 @@ // The 5 radio buttons in the "Paper Size" group box if (mPosPrintSetupDialogChoices.isPaperSizeAsDisplayedOrSelected()) { - tMsgStringBuffer.append("\n Print as displayed/selected."); + tMsgStringBuffer.append("\n Print as displayed/selected (no order change and no paper size change)."); } else if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { tMsgStringBuffer.append("\n Print Legal first, then Letter."); @@ -281,6 +290,11 @@ // Additional copies tMsgStringBuffer.append("\n Additional Copies is " + mPosPrintSetupDialogChoices.getNumAdditionalCopies()); + // Print Form Names + if (mPosPrintSetupDialogChoices.shouldPrintFormNames()) { + tMsgStringBuffer.append("\n Print Form Names."); + } + // "Print All" or "Print Selected" or "Print Remaining" or "Print Changed" // N pages // Index numbers are: n, n, n, ... n @@ -309,6 +323,7 @@ return null; } + // After the printing thread is finished, this method is automatically called, to draw the current page being viewed again public void finished() { mPosView.getOpenPCLViewer().setIsDrawingForPrinting(false); mPosView.getOpenPCLViewer().renderImageCurrentPageAndZoom(); @@ -323,7 +338,8 @@ threadPrintPages.start(); return mPrintedOkReturn; } - + + /** Move Legal pages to the top of the ArrayList of page items */ private void moveLegalPagesToTopOfArrayList(ArrayList<PosTreeNode> pPagesToPrintArrayList) { // Hold the Letter size page entries that should be moved to the bottom ArrayList<PosTreeNode> tMoveToBottomArrayList = new ArrayList<PosTreeNode>(pPagesToPrintArrayList.size()); @@ -346,6 +362,7 @@ } } + /** Move Letter pages to the top of the ArrayList of page items */ private void moveLetterPagesToTopOfArrayList(ArrayList<PosTreeNode> pPagesToPrintArrayList) { // Hold the Legal size page entries that should be moved to the bottom ArrayList<PosTreeNode> tMoveToBottomArrayList = new ArrayList<PosTreeNode>(pPagesToPrintArrayList.size()); @@ -368,6 +385,90 @@ } } + /** Add more Pcl bytes for printing. These bytes will be used for both PCL Direct printing and Windows/Image print. */ + private void addPclBytesForPrinting(ArrayList<PosTreeNode> pPagesToPrintArrayList) { + // Where to write the Pcl bytes for printing + ByteArrayOutputStream tByteArrayOutputStream = new ByteArrayOutputStream(1024); // grows automatically if needed + + // Run through all the pages to print + for (PosTreeNode eachPosTreeNode : pPagesToPrintArrayList) { + + // If the user clicked "Yes" on "Print Form Names" on the Print Setup dialog + if (mPosPrintSetupDialogChoices.shouldPrintFormNames()) { + // Add bytes for the Form + String tFormName = mPosView.getOpenPCLViewer().getFormNameForTreeNode(eachPosTreeNode); + String tLetterOrLegal = "LGL"; + if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(eachPosTreeNode)) { + tLetterOrLegal = "LTR"; + } + addPclBytesForPrintingFormNames(tLetterOrLegal, tFormName, sPageOrientationPortrait, tByteArrayOutputStream); + } + + // Future use below. Add Pcl bytes for printing "xyz" on the page + // ... + + if (tByteArrayOutputStream.size() > 0) { + // Put the resulting Pcl bytes in the PosTreeNode byte[] mPrintTimePclBytes + eachPosTreeNode.setPrintTimePclBytes(tByteArrayOutputStream.toByteArray()); + } else { + // There's no extra drawing needed to be done so set to null + eachPosTreeNode.setPrintTimePclBytes(null); + } + + // Re-use the same ByteArrayOutputStream by setting the index pointer to 0 + tByteArrayOutputStream.reset(); + } + } + + private void addPclBytesForPrintingFormNames(String pLetterOrLegal, String pFormName, + int pPageOrientation, ByteArrayOutputStream pBaos) { + final byte[] tFormNameFont = new byte[] {sbESC, '(', 's', '4', '1', '4', '8', 't', // Univers typeface + '0', 'b', // not bold + '0', 's', // not italics + '8', 'v', // 8 point heigh + '1', 'P'}; // Proportional + + final byte[] tDefaultCourierFont = new byte[] {sbESC, '(', 's', '3', 't', // Courier typeface + '0', 'b', // not bold + '0', 's', // not italics + '1', '0', 'h', // 10 cpi + '1', '2', 'v', // 12 point heigh + '0', 'P'}; // Monospaced + + // Return if form name is null or blank + if (pFormName == null || pFormName.length() < 1) { return; } + + int tYPosForLetterPortrait = (300 * 11) - 205; + int tYPosForLegalPortrait = (300 * 14) - 205; + int tYPosforLetterOrLegalLandscape =(int)(Math.round(300 * 8.5d) - 205); + + // Default to Legal Portrait Y position + int tYPosForFormName = tYPosForLegalPortrait; + + if (pPageOrientation == sPageOrientationPortrait) { + if (pLetterOrLegal.equalsIgnoreCase("LTR")) { + tYPosForFormName = tYPosForLetterPortrait; + } + } else if (pPageOrientation == sPageOrientationLandscape) { + tYPosForFormName = tYPosforLetterOrLegalLandscape; + } + + try { + pBaos.write(tFormNameFont); + pBaos.write(sbESC); + pBaos.write('*'); + pBaos.write('p'); + pBaos.write('0'); + pBaos.write('x'); + pBaos.write(String.valueOf(tYPosForFormName).getBytes()); + pBaos.write('Y'); // Cursor position to (x,y) using ESC * p 0 x 123 Y + pBaos.write(pFormName.getBytes()); + pBaos.write(tDefaultCourierFont); + } catch (IOException e) { + PriDebug.releaseln("In PosPrintPages, can't write Form Name into ByteArrayOutputStream"); + } + } + /** * print Pcl Direct * @author Howard 6/1/06. Implemented mult page printing on 8/28/06 @@ -445,6 +546,15 @@ return false; } + // If there were any PCL bytes to include only at print time (not to be viewed on the screen) then write the bytes here + byte[] tPrintTimePclBytes = tPrintThisTreeNode.getPrintTimePclBytes(); + if (tPrintTimePclBytes != null) { + try { + tByteArrayOutputStream.write(tPrintTimePclBytes); + } catch (IOException e) { + } + } + // Write the current page bytes try { tByteArrayOutputStream.write(tModifiedPclBytes); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 19:54:16
|
Revision: 120 http://openpcl.svn.sourceforge.net/openpcl/?rev=120&view=rev Author: documentsystems Date: 2007-07-25 12:54:16 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In PosView, added getBaseNameOnJInternalFrameTitleBar() so that when doing the "Print Form Names", it can get the current full dir and filename open for that view, to print on the bottom left of the page. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/panels/PosView.java Modified: openpcl/src/com/openpcl/viewer/panels/PosView.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-07-25 19:52:25 UTC (rev 119) +++ openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-07-25 19:54:16 UTC (rev 120) @@ -361,6 +361,8 @@ return PosView.sDefaultSplitterLocPclFiles; } + public String getBaseNameOnJInternalFrameTitleBar() { return mBaseNameOnJInternalFrameTitleBar; } + public void setBaseNameOnJInternalFrameTitleBar(String pBaseNameOnJInternalFrameTitleBar) { mBaseNameOnJInternalFrameTitleBar = pBaseNameOnJInternalFrameTitleBar; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 19:52:23
|
Revision: 119 http://openpcl.svn.sourceforge.net/openpcl/?rev=119&view=rev Author: documentsystems Date: 2007-07-25 12:52:25 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In PosPrintSetupDialog, fixed the bug to make the "Print Form Names" and "Duplex" auto select the "No" radio button if the boolean is false. Previously it was auto selecting the "Yes" radio button if it was true, but wasn't auto selecting the "No" if false. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-25 19:49:33 UTC (rev 118) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-25 19:52:25 UTC (rev 119) @@ -558,13 +558,13 @@ if (mPrintChoices.shouldPrintFormNames()) { mPrintFormNamesYesJRadioButton.setSelected(true); } else { - mPrintFormNamesYesJRadioButton.setSelected(false); + mPrintFormNamesNoJRadioButton.setSelected(true); } if (mPrintChoices.shouldDuplex()) { mDuplexYesJRadioButton.setSelected(true); } else { - mDuplexYesJRadioButton.setSelected(false); + mDuplexNoJRadioButton.setSelected(true); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 19:49:30
|
Revision: 118 http://openpcl.svn.sourceforge.net/openpcl/?rev=118&view=rev Author: documentsystems Date: 2007-07-25 12:49:33 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In PosTreeNode, added byte[] mPrintTimePclBytes to implement "Print Form Names" on the print setup dialog, that is the extra PCL bytes to send to the printer for print "PCL Direct" or to draw on the bitmap for "Windows Print". Modified Paths: -------------- openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java Modified: openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java =================================================================== --- openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java 2007-07-25 19:45:22 UTC (rev 117) +++ openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java 2007-07-25 19:49:33 UTC (rev 118) @@ -22,6 +22,11 @@ // For tree nodes that are pages in a PCL file private byte[] mPclBytes = null; + + // At print time, draw these additional PCL bytes on the print image. + // 1. For PCL direct, this will be just send these bytes for the HP LaserJet to draw in the printer. + // 2. For Windows Print, this will be to use Graphics2D drawing to draw on the BufferedImage to be sent to the printer + private byte[] mPrintTimePclBytes = null; // For the Root tree node private String mRootNodeName = null; @@ -55,11 +60,13 @@ public PriRenderCounters getPrirenderCounters() { return mPriRenderCounters; } public String getRootNodeName() { return mRootNodeName; } public byte[] getPclBytes() { return mPclBytes; } + public byte[] getPrintTimePclBytes() { return mPrintTimePclBytes; } // One liner Setters public void setNodeName(String pNodeName) { mNodeName = pNodeName; } public void setPaperSize(String pPaperSize) {mPaperSize = pPaperSize; } public void setPclBytes(byte[] pPclBytes) { mPclBytes = pPclBytes; } + public void setPrintTimePclBytes(byte[] pPrintTimePclBytes) { mPrintTimePclBytes = pPrintTimePclBytes; } public void setRendersToImage(boolean pRendersToImage) { mRendersToImage = pRendersToImage; } public void setPriRenderCounters(PriRenderCounters pPriRenderCounters) { mPriRenderCounters = pPriRenderCounters; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 19:45:23
|
Revision: 117 http://openpcl.svn.sourceforge.net/openpcl/?rev=117&view=rev Author: documentsystems Date: 2007-07-25 12:45:22 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In IPluginHooksOpenPCL, added getFormNameForTreeNode() to implement "Print Form Names" on the print setup dialog. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/api/IPluginHooksOpenPCL.java Modified: openpcl/src/com/openpcl/viewer/api/IPluginHooksOpenPCL.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IPluginHooksOpenPCL.java 2007-07-25 19:14:16 UTC (rev 116) +++ openpcl/src/com/openpcl/viewer/api/IPluginHooksOpenPCL.java 2007-07-25 19:45:22 UTC (rev 117) @@ -76,6 +76,9 @@ /** Get the PCL bytes for a tree node page. This is used for "Print PCL Direct" to send the actual PCL bytes to the printer. */ public byte[] getPclBytesForTreeNode(PosTreeNode pPosTreeNode); + /** Get the Form Name for a tree node page. Used for both print "PCL Direct" and for "Windows Print". */ + public String getFormNameForTreeNode(PosTreeNode pPosTreeNode); + /** Render the BufferedImage from the tree node */ public BufferedImage renderImageForPrintingFromTreeNode(PosTreeNode pPosTreeNode); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 19:14:14
|
Revision: 116 http://openpcl.svn.sourceforge.net/openpcl/?rev=116&view=rev Author: documentsystems Date: 2007-07-25 12:14:16 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In OpenPCLViewer, added getFormNameForTreeNode() to implement "Print Form Names" on the print setup dialog. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-24 20:25:46 UTC (rev 115) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-25 19:14:16 UTC (rev 116) @@ -1307,6 +1307,14 @@ return getPclBytesForPage(pPosTreeNode.getNodeNumber()); } + /** Get the Form Name for a tree node page. Used for both print "PCL Direct" and for "Windows Print". + * Subclass plugins override this method so do not delete or rename this method. */ + public String getFormNameForTreeNode(PosTreeNode pPosTreeNode) { + if (pPosTreeNode == null) { return null; } + // Important: Subclasses that override this method will have more complex code than just the one line below. + return getPosViewSelected().getBaseNameOnJInternalFrameTitleBar() + ", " + pPosTreeNode.toString(); + } + /** Create a new view panel * Subclass plugins override this method so do not delete or rename this method. */ public PosView createNewViewPanel(String pShortName) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-24 20:25:43
|
Revision: 115 http://openpcl.svn.sourceforge.net/openpcl/?rev=115&view=rev Author: documentsystems Date: 2007-07-24 13:25:46 -0700 (Tue, 24 Jul 2007) Log Message: ----------- Howard Hoagland. Implemented print "Legal first, the Letter" and "Letter first, then Legal" by reordering the page objects in the ArrayList that gets passed to the print PCL Direct and the Image Print methods. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-24 01:11:27 UTC (rev 114) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-24 20:25:46 UTC (rev 115) @@ -230,6 +230,12 @@ mPrintingProgressBar.setValue(0); mPrintingProgressJDialog.setLocationRelativeTo(mParentFrame); + if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { + moveLegalPagesToTopOfArrayList(mPagesToPrintArrayList); + } else if (mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { + moveLetterPagesToTopOfArrayList(mPagesToPrintArrayList); + } + final SwingWorker threadShowProgressBar = new SwingWorker() { public Object construct() { mPrintingProgressJDialog.setVisible(true); @@ -318,6 +324,50 @@ return mPrintedOkReturn; } + private void moveLegalPagesToTopOfArrayList(ArrayList<PosTreeNode> pPagesToPrintArrayList) { + // Hold the Letter size page entries that should be moved to the bottom + ArrayList<PosTreeNode> tMoveToBottomArrayList = new ArrayList<PosTreeNode>(pPagesToPrintArrayList.size()); + // Look thru each entry + for (PosTreeNode eachPosTreeNode : pPagesToPrintArrayList) { + if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(eachPosTreeNode)) { + // This is a Letter page so add it to the "move to bottom" ArrayList + tMoveToBottomArrayList.add(eachPosTreeNode); + } + } + + // If there were any Letter size pages that got moved to the "move to bottom" ArrayList + if (tMoveToBottomArrayList.size() > 1) { + for (PosTreeNode removeThisPosTreeNode : tMoveToBottomArrayList) { + // Remove the Letter pages from the passed in ArrayList + pPagesToPrintArrayList.remove(removeThisPosTreeNode); + } + // Then move the Letter size pages to the bottom of the passed in ArrayList + pPagesToPrintArrayList.addAll(tMoveToBottomArrayList); + } + } + + private void moveLetterPagesToTopOfArrayList(ArrayList<PosTreeNode> pPagesToPrintArrayList) { + // Hold the Legal size page entries that should be moved to the bottom + ArrayList<PosTreeNode> tMoveToBottomArrayList = new ArrayList<PosTreeNode>(pPagesToPrintArrayList.size()); + // Look thru each entry + for (PosTreeNode eachPosTreeNode : pPagesToPrintArrayList) { + if ( !(mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(eachPosTreeNode)) ) { + // This is a Legal page so add it to the "move to bottom" ArrayList + tMoveToBottomArrayList.add(eachPosTreeNode); + } + } + + // If there were any Legal size pages that got moved to the "move to bottom" ArrayList + if (tMoveToBottomArrayList.size() > 1) { + for (PosTreeNode removeThisPosTreeNode : tMoveToBottomArrayList) { + // Remove the Legal pages from the passed in ArrayList + pPagesToPrintArrayList.remove(removeThisPosTreeNode); + } + // Then move the Legal size pages to the bottom of the passed in ArrayList + pPagesToPrintArrayList.addAll(tMoveToBottomArrayList); + } + } + /** * print Pcl Direct * @author Howard 6/1/06. Implemented mult page printing on 8/28/06 @@ -339,7 +389,6 @@ ByteArrayInputStream tByteArrayInputStream = null; ByteArrayOutputStream tByteArrayOutputStream =null; int tPageNumber = 0; - int tLegalLetterPassesToDo = 1; String tProgressBarBaseString = "Generating page: "; byte[] tPclBytes = null; byte[] tLetterlSizePaperBytes = new byte[] {sbESC, '&', 'l', '2', 'A'}; @@ -353,112 +402,64 @@ // by allocating a new bigger byte array then doing a memcopy to the new one. tByteArrayOutputStream = new ByteArrayOutputStream(20 * 1024); - // Set the int variable that controls the "Legal first, then Letter", and "Letter first, then Legal" - if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter() || - mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { - tLegalLetterPassesToDo = 2; - } else { - tLegalLetterPassesToDo = 1; - } - - // If doing "Legal first, then Letter" or doing "Letter first, then Legal", make 2 inner print passes here - for (int tLglLtrPassCount = 1; tLglLtrPassCount <= tLegalLetterPassesToDo; tLglLtrPassCount++) { + // for each page that the user selected in the tree (could be one page or multi page), get the PCL bytes + for (tPageNumber = 0; tPageNumber < pPagesToPrintArrayList.size(); tPageNumber++) { + // Get the tree node user object for this print page by indexing into the print ArrayList to get the passed in page number + tPrintThisTreeNode = mPagesToPrintArrayList.get(tPageNumber); + // null pointer protection to avoid stack dump + if (tPrintThisTreeNode == null) { continue; } - // for each page that the user selected in the tree (could be one page or multi page), get the PCL bytes - for (tPageNumber = 0; tPageNumber < pPagesToPrintArrayList.size(); tPageNumber++) { - // Get the tree node user object for this print page by indexing into the print ArrayList to get the passed in page number - tPrintThisTreeNode = mPagesToPrintArrayList.get(tPageNumber); - // null pointer protection to avoid stack dump - if (tPrintThisTreeNode == null) { continue; } - - // If doing "Legal first, then Letter" or doing "Letter first, then Legal" then skip Letter or Legal pages depending - if (tLegalLetterPassesToDo > 1) { - if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(tPrintThisTreeNode)) { - // This page is Letter size - if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { - // Print dialog setting is "Legal first, then Letter" - if (tLglLtrPassCount == 1) { - // and this is the 1st pass, so skip Letter pages - continue; - } - } else if (mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { - // Print dialog setting is "Letter first, then Legal " - if (tLglLtrPassCount == 2) { - // and this is the 2nd pass, so skip Letter pages - continue; - } - } - } else { - // This page is Legal size - if (mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { - // Print dialog setting is "Letter first, then Legal" - if (tLglLtrPassCount == 1) { - // and this is the 1st pass, so skip Legal pages - continue; - } - } else if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { - // Print dialog setting is "Legal first, then Letter" - if (tLglLtrPassCount == 2) { - // and this is the 2nd pass, so skip Legal pages - continue; - } - } - } - } // end "if (tLegalLetterPassesToDo > 1)" - - // Get the actual PCL bytes to send to the printer - tPclBytes = mPosView.getOpenPCLViewer().getPclBytesForTreeNode(tPrintThisTreeNode); + // Get the actual PCL bytes to send to the printer + tPclBytes = mPosView.getOpenPCLViewer().getPclBytesForTreeNode(tPrintThisTreeNode); - // If no bytes on this page then continue to the next page - if (tPclBytes == null || tPclBytes.length < 1) { continue; } + // If no bytes on this page then continue to the next page + if (tPclBytes == null || tPclBytes.length < 1) { continue; } - // Modify the PCL bytes - mPriModifyPclBytes.initializeState(); - mPclParser = new PclParser(tPclBytes, mPriModifyPclBytes); - mPclParser.ParsePCL(); + // Modify the PCL bytes + mPriModifyPclBytes.initializeState(); + mPclParser = new PclParser(tPclBytes, mPriModifyPclBytes); + mPclParser.ParsePCL(); - byte[] tModifiedPclBytes = mPriModifyPclBytes.getModifiedPclBytes(); - // PriDebug.releaseln("Pcl page before, after bytes: " + tPclBytes.length + ", " + tModifiedPclBytes.length); - try { - if (pPosPrintSetupDialogChoices != null && pPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { - // The user has a check in the Print Setup dialog box for "Print all on Legal paper" - // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the Blockument DSP values - // or if this is a PCL file with a letter size PCL command - tByteArrayOutputStream.write(tLegalSizePaperBytes); + byte[] tModifiedPclBytes = mPriModifyPclBytes.getModifiedPclBytes(); + // PriDebug.releaseln("Pcl page before, after bytes: " + tPclBytes.length + ", " + tModifiedPclBytes.length); + try { + if (pPosPrintSetupDialogChoices != null && pPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + // The user has a check in the Print Setup dialog box for "Print all on Legal paper" + // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the Blockument DSP values + // or if this is a PCL file with a letter size PCL command + tByteArrayOutputStream.write(tLegalSizePaperBytes); + } else { + // Pick the paper size by calling the below method which may be subclassed by a plugin. + // The below uses polymorphism because the method isTreeNodePageLetterSize() is one of the subclassed + // methods specified in the interface IPluginHooksOpenPCL + if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(tPrintThisTreeNode)) { + // Letter size + tByteArrayOutputStream.write(tLetterlSizePaperBytes); } else { - // Pick the paper size by calling the below method which may be subclassed by a plugin. - // The below uses polymorphism because the method isTreeNodePageLetterSize() is one of the subclassed - // methods specified in the interface IPluginHooksOpenPCL - if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(tPrintThisTreeNode)) { - // Letter size - tByteArrayOutputStream.write(tLetterlSizePaperBytes); - } else { - // Legal size - tByteArrayOutputStream.write(tLegalSizePaperBytes); - } + // Legal size + tByteArrayOutputStream.write(tLegalSizePaperBytes); } - } catch (IOException e) { - return false; } + } catch (IOException e) { + return false; + } - // Write the current page bytes - try { - tByteArrayOutputStream.write(tModifiedPclBytes); - if (mShouldOutputFormFeedBetweenPages) { tByteArrayOutputStream.write(sbFF); } - } catch (IOException e) { - return false; - } + // Write the current page bytes + try { + tByteArrayOutputStream.write(tModifiedPclBytes); + if (mShouldOutputFormFeedBetweenPages) { tByteArrayOutputStream.write(sbFF); } + } catch (IOException e) { + return false; + } - // Update the progress bar at each page - if (mPrintingProgressBar != null) { - mPrintingProgressBar.setValue(tPageNumber + 1); - mPrintingProgressBar.setString(tProgressBarBaseString + (tPageNumber + 1) + " of " + pPagesToPrintArrayList.size()); - } - } // end for (tPageNumber = 0; tPageNumber < pPagesToPrintArrayList.size(); tPageNumber++) - } // end "for (int tLglLtrPassCount = 0; tLglLtrPassCount < mLegalLetterPassesToDo; tLglLtrPassCount++)" + // Update the progress bar at each page + if (mPrintingProgressBar != null) { + mPrintingProgressBar.setValue(tPageNumber + 1); + mPrintingProgressBar.setString(tProgressBarBaseString + (tPageNumber + 1) + " of " + pPagesToPrintArrayList.size()); + } + } // end for (tPageNumber = 0; tPageNumber < pPagesToPrintArrayList.size(); tPageNumber++) - // The input stream for the DocPrintJob if (tByteArrayOutputStream == null || tByteArrayOutputStream.size() < 1) { return false; } tByteArrayInputStream = new ByteArrayInputStream(tByteArrayOutputStream.toByteArray()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-24 01:11:25
|
Revision: 114 http://openpcl.svn.sourceforge.net/openpcl/?rev=114&view=rev Author: documentsystems Date: 2007-07-23 18:11:27 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Howard Hoagland. Made a DocAttributeSet, then added the DocumentName to the HashDocAttributeSet, then passed the DocAttributeSet in the SimpleDoc constructor. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-23 23:38:14 UTC (rev 113) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-24 01:11:27 UTC (rev 114) @@ -11,13 +11,17 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.Locale; import javax.print.DocFlavor; import javax.print.DocPrintJob; import javax.print.PrintException; import javax.print.PrintService; import javax.print.SimpleDoc; +import javax.print.attribute.DocAttributeSet; +import javax.print.attribute.HashDocAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.standard.DocumentName; import javax.swing.BorderFactory; import javax.swing.JDialog; import javax.swing.JOptionPane; @@ -65,6 +69,7 @@ private PclParser mPclParser = null; private StringBuffer mIndexNumbersStringBuffer = null; private int mNumberOfCopies = 1; + private DocAttributeSet mDocAttributeSet = null; /** * Constructor @@ -77,6 +82,8 @@ mParentFrame = mPosView.getOpenPCLViewer().getAppFrame(); mPrintRequestAttributeSet = mPosView.getOpenPCLViewer().getPrintRequestAttributeSet(); mPosPrintSetupDialogChoices = mPosView.getOpenPCLViewer().getPosPrintSetupDialogChoices(); + mDocAttributeSet = new HashDocAttributeSet(); + mDocAttributeSet.add(new DocumentName(mPosView.getOpenPCLViewer().getAppName() + " print", Locale.getDefault())); mPosPrintBufferedImage = new PosPrintBufferedImage(mPosView); mPosPrintPageableInterface = new PosPrintPageableInterface(mPosView); mPriModifyPclBytes = new PriModifyPclBytes(); @@ -455,7 +462,7 @@ // The input stream for the DocPrintJob if (tByteArrayOutputStream == null || tByteArrayOutputStream.size() < 1) { return false; } tByteArrayInputStream = new ByteArrayInputStream(tByteArrayOutputStream.toByteArray()); - tSimpleDoc = new SimpleDoc(tByteArrayInputStream, tDocFlavor, null); + tSimpleDoc = new SimpleDoc(tByteArrayInputStream, tDocFlavor, mDocAttributeSet); if (tSimpleDoc == null) { return false; } tPrintService = pPosPrintSetupDialogChoices.getSelectedPrintService(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-23 23:38:12
|
Revision: 113 http://openpcl.svn.sourceforge.net/openpcl/?rev=113&view=rev Author: documentsystems Date: 2007-07-23 16:38:14 -0700 (Mon, 23 Jul 2007) Log Message: ----------- For PCL Direct (not Windows Print), implemented the print "Legal first, then Letter" and "Letter first, then Legal". Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-23 23:08:15 UTC (rev 112) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-23 23:38:14 UTC (rev 113) @@ -64,9 +64,8 @@ private PriModifyPclBytes mPriModifyPclBytes = null; private PclParser mPclParser = null; private StringBuffer mIndexNumbersStringBuffer = null; - private int mNumberOfPrintPasses = 1; - private int mCurrentPrintPassNumber = 1; - + private int mNumberOfCopies = 1; + /** * Constructor * @author howard 6/1/06 @@ -278,19 +277,21 @@ PriDebug.releaseln(tMsgStringBuffer.toString()); // The number of additional copies has already been validated and is guaranteed to be 0 to 3 at this point - mNumberOfPrintPasses = 1 + mPosPrintSetupDialogChoices.getNumAdditionalCopies(); + mNumberOfCopies = 1 + mPosPrintSetupDialogChoices.getNumAdditionalCopies(); // Call the print of the all/selected/remaining/changed pages "N" times depending on Additional Copies field - for (int i = 1; i <= mNumberOfPrintPasses; i++) { + for (int tNumCopies = 1; tNumCopies <= mNumberOfCopies; tNumCopies++) { + // Call "Use Windows Print" or "Print PCL Direct" - if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { - mPrintedOkReturn = printPclDirect(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, + if (mPosPrintSetupDialogChoices.isPrintFormatWindowsPrint()) { + mPrintedOkReturn = imagePrint(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, mPrintingProgressBar, mPrintRequestAttributeSet); } else { - mPrintedOkReturn = imagePrint(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, + mPrintedOkReturn = printPclDirect(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, mPrintingProgressBar, mPrintRequestAttributeSet); } - } + + } // end "for (int tNumCopies = 1; tNumCopies <= mNumberOfCopies; tNumCopies++)" return null; } @@ -331,6 +332,7 @@ ByteArrayInputStream tByteArrayInputStream = null; ByteArrayOutputStream tByteArrayOutputStream =null; int tPageNumber = 0; + int tLegalLetterPassesToDo = 1; String tProgressBarBaseString = "Generating page: "; byte[] tPclBytes = null; byte[] tLetterlSizePaperBytes = new byte[] {sbESC, '&', 'l', '2', 'A'}; @@ -344,67 +346,111 @@ // by allocating a new bigger byte array then doing a memcopy to the new one. tByteArrayOutputStream = new ByteArrayOutputStream(20 * 1024); - // Get the PCL bytes for each page that the user selected in the tree (could be one page or multi page) - for (tPageNumber = 0; tPageNumber < pPagesToPrintArrayList.size(); tPageNumber++) { - // return if the passed in page number is less than 0 or greater than the number of current pages to print - if (tPageNumber < 0 || tPageNumber >= mPagesToPrintArrayList.size()) { return false; } - // Get the tree node user object for this print page by indexing into the print ArrayList to get the passed in page number - tPrintThisTreeNode = mPagesToPrintArrayList.get(tPageNumber); - // null pointer protection due to tree node user object got assigned to null from the ArrayList.get() above - if (tPrintThisTreeNode == null) { continue; } - - // Get the actual PCL bytes to send to the printer - tPclBytes = mPosView.getOpenPCLViewer().getPclBytesForTreeNode(tPrintThisTreeNode); - - // If no bytes on this page then continue to the next page - if (tPclBytes == null || tPclBytes.length < 1) { continue; } - - // Modify the PCL bytes - mPriModifyPclBytes.initializeState(); - mPclParser = new PclParser(tPclBytes, mPriModifyPclBytes); - mPclParser.ParsePCL(); - - byte[] tModifiedPclBytes = mPriModifyPclBytes.getModifiedPclBytes(); - - // PriDebug.releaseln("Pcl page before, after bytes: " + tPclBytes.length + ", " + tModifiedPclBytes.length); - - try { - if (pPosPrintSetupDialogChoices != null && pPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { - // The user has a check in the Print Setup dialog box for "Print all on Legal paper" - // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the Blockument DSP values - // or if this is a PCL file with a letter size PCL command - tByteArrayOutputStream.write(tLegalSizePaperBytes); - - } else { - // Pick the paper size by calling the below method which may be subclassed by a plugin. - // The below uses polymorphism because the method isTreeNodePageLetterSize() is one of the subclassed - // methods specified in the interface IPluginHooksOpenPCL + // Set the int variable that controls the "Legal first, then Letter", and "Letter first, then Legal" + if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter() || + mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { + tLegalLetterPassesToDo = 2; + } else { + tLegalLetterPassesToDo = 1; + } + + // If doing "Legal first, then Letter" or doing "Letter first, then Legal", make 2 inner print passes here + for (int tLglLtrPassCount = 1; tLglLtrPassCount <= tLegalLetterPassesToDo; tLglLtrPassCount++) { + + // for each page that the user selected in the tree (could be one page or multi page), get the PCL bytes + for (tPageNumber = 0; tPageNumber < pPagesToPrintArrayList.size(); tPageNumber++) { + // Get the tree node user object for this print page by indexing into the print ArrayList to get the passed in page number + tPrintThisTreeNode = mPagesToPrintArrayList.get(tPageNumber); + // null pointer protection to avoid stack dump + if (tPrintThisTreeNode == null) { continue; } + + // If doing "Legal first, then Letter" or doing "Letter first, then Legal" then skip Letter or Legal pages depending + if (tLegalLetterPassesToDo > 1) { if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(tPrintThisTreeNode)) { - // Letter size - tByteArrayOutputStream.write(tLetterlSizePaperBytes); + // This page is Letter size + if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { + // Print dialog setting is "Legal first, then Letter" + if (tLglLtrPassCount == 1) { + // and this is the 1st pass, so skip Letter pages + continue; + } + } else if (mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { + // Print dialog setting is "Letter first, then Legal " + if (tLglLtrPassCount == 2) { + // and this is the 2nd pass, so skip Letter pages + continue; + } + } } else { - // Legal size + // This page is Legal size + if (mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { + // Print dialog setting is "Letter first, then Legal" + if (tLglLtrPassCount == 1) { + // and this is the 1st pass, so skip Legal pages + continue; + } + } else if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { + // Print dialog setting is "Legal first, then Letter" + if (tLglLtrPassCount == 2) { + // and this is the 2nd pass, so skip Legal pages + continue; + } + } + } + } // end "if (tLegalLetterPassesToDo > 1)" + + // Get the actual PCL bytes to send to the printer + tPclBytes = mPosView.getOpenPCLViewer().getPclBytesForTreeNode(tPrintThisTreeNode); + + // If no bytes on this page then continue to the next page + if (tPclBytes == null || tPclBytes.length < 1) { continue; } + + // Modify the PCL bytes + mPriModifyPclBytes.initializeState(); + mPclParser = new PclParser(tPclBytes, mPriModifyPclBytes); + mPclParser.ParsePCL(); + + byte[] tModifiedPclBytes = mPriModifyPclBytes.getModifiedPclBytes(); + // PriDebug.releaseln("Pcl page before, after bytes: " + tPclBytes.length + ", " + tModifiedPclBytes.length); + try { + if (pPosPrintSetupDialogChoices != null && pPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + // The user has a check in the Print Setup dialog box for "Print all on Legal paper" + // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the Blockument DSP values + // or if this is a PCL file with a letter size PCL command tByteArrayOutputStream.write(tLegalSizePaperBytes); + + } else { + // Pick the paper size by calling the below method which may be subclassed by a plugin. + // The below uses polymorphism because the method isTreeNodePageLetterSize() is one of the subclassed + // methods specified in the interface IPluginHooksOpenPCL + if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(tPrintThisTreeNode)) { + // Letter size + tByteArrayOutputStream.write(tLetterlSizePaperBytes); + } else { + // Legal size + tByteArrayOutputStream.write(tLegalSizePaperBytes); + } } + } catch (IOException e) { + return false; } - } catch (IOException e) { - return false; - } - // Write the current page bytes - try { - tByteArrayOutputStream.write(tModifiedPclBytes); - if (mShouldOutputFormFeedBetweenPages) { tByteArrayOutputStream.write(sbFF); } - } catch (IOException e) { - return false; - } - - // Update the progress bar at each page - if (mPrintingProgressBar != null) { - mPrintingProgressBar.setValue(tPageNumber + 1); - mPrintingProgressBar.setString(tProgressBarBaseString + (tPageNumber + 1) + " of " + pPagesToPrintArrayList.size()); - } - } // end of for loop + // Write the current page bytes + try { + tByteArrayOutputStream.write(tModifiedPclBytes); + if (mShouldOutputFormFeedBetweenPages) { tByteArrayOutputStream.write(sbFF); } + } catch (IOException e) { + return false; + } + + // Update the progress bar at each page + if (mPrintingProgressBar != null) { + mPrintingProgressBar.setValue(tPageNumber + 1); + mPrintingProgressBar.setString(tProgressBarBaseString + (tPageNumber + 1) + " of " + pPagesToPrintArrayList.size()); + } + } // end for (tPageNumber = 0; tPageNumber < pPagesToPrintArrayList.size(); tPageNumber++) + } // end "for (int tLglLtrPassCount = 0; tLglLtrPassCount < mLegalLetterPassesToDo; tLglLtrPassCount++)" + // The input stream for the DocPrintJob if (tByteArrayOutputStream == null || tByteArrayOutputStream.size() < 1) { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-23 23:08:12
|
Revision: 112 http://openpcl.svn.sourceforge.net/openpcl/?rev=112&view=rev Author: documentsystems Date: 2007-07-23 16:08:15 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Howard Hoagland. Changed PrintFormatIsGdiDriver to PrintFormatIsWindowsPrint Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-23 23:07:10 UTC (rev 111) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-23 23:08:15 UTC (rev 112) @@ -585,7 +585,7 @@ // Print format if (mIsPclPrinterJCheckBox.isSelected()) { - mPrintChoices.setPrintFormatIsGdiDriver(); + mPrintChoices.setPrintFormatIsWindowsPrint(); } else { mPrintChoices.setPrintFormatIsPclDirect(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-23 23:07:08
|
Revision: 111 http://openpcl.svn.sourceforge.net/openpcl/?rev=111&view=rev Author: documentsystems Date: 2007-07-23 16:07:10 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Howard Hoagland. Changed PrintFormatIsGdiDriver to PrintFormatIsWindowsPrint and it's setter/getter Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-20 23:53:33 UTC (rev 110) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-23 23:07:10 UTC (rev 111) @@ -8,8 +8,8 @@ */ public class PosPrintSetupDialogChoices { - public static final int sPrintFormatIsPclDirect = 1; - public static final int sPrintFormatIsGdiDriver = 2; + public static final int sPrintFormatIsWindowsPrint = 1; + public static final int sPrintFormatIsPclDirect = 2; public static final int sPaperSizeAsDisplayedSelected = 1; public static final int sPaperSizeLegalFirstThenLetter = 2; @@ -20,11 +20,12 @@ // TODO Add code to take the defaults from the user options in the Preferences, instead of the below initializations private PrintService mSelectedPrintService = null; private int mNumAdditionalCopies = 0; - private int mPrintFormat = sPrintFormatIsGdiDriver; + private int mPrintFormat = sPrintFormatIsWindowsPrint; private int mPaperSize = sPaperSizeAsDisplayedSelected; private boolean mShouldPrintFormNames = false; private boolean mShouldDuplex = false; - + + // These are run time items that don't need to be saved to persistent settings private boolean mUserHitOk = false; public PosPrintSetupDialogChoices() { @@ -38,12 +39,12 @@ public int getNumAdditionalCopies() { return mNumAdditionalCopies; } + public boolean isPrintFormatWindowsPrint() { + return (mPrintFormat == sPrintFormatIsWindowsPrint); + } public boolean isPrintFormatPclDirect() { return (mPrintFormat == sPrintFormatIsPclDirect); } - public boolean isPrintFormatGdiDriver() { - return (mPrintFormat == sPrintFormatIsGdiDriver); - } public boolean isPaperSizeAsDisplayedOrSelected() { return (mPaperSize == sPaperSizeAsDisplayedSelected); } @@ -76,12 +77,12 @@ public void setNumAdditionalCopies(int numCopies) { mNumAdditionalCopies = numCopies; } + public void setPrintFormatIsWindowsPrint() { + mPrintFormat = sPrintFormatIsWindowsPrint; + } public void setPrintFormatIsPclDirect() { mPrintFormat = sPrintFormatIsPclDirect; } - public void setPrintFormatIsGdiDriver() { - mPrintFormat = sPrintFormatIsGdiDriver; - } public void setPaperSizeAsDisplayedSelected() { mPaperSize = sPaperSizeAsDisplayedSelected; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-20 23:53:39
|
Revision: 110 http://openpcl.svn.sourceforge.net/openpcl/?rev=110&view=rev Author: documentsystems Date: 2007-07-20 16:53:33 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Howard Hoagland. Changed the PosPrintSetupChoices getter and setter method names and class variable names to match what is on the print setup dialog when the "Print Order" was changed to "Paper Size" and the "Print all on Legal" and the "Print all on Letter (shrinks Legal)" check boxes were moved into the "Print Order" group box and change to radio buttons in the radio button set with the "Legal first, then Letter" and "Letter first, then Legal". This caused the need to fix all those getter/setter method calls and radio button names in the 5 other classes checked in at this time. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java Modified: openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-07-20 23:53:33 UTC (rev 110) @@ -20,14 +20,12 @@ import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JLabel; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.border.TitledBorder; import com.openpcl.viewer.OpenPCLViewer; -import com.openpcl.viewer.panels.PosView; import com.openpcl.viewer.printing.PosPrintSetupDialog; import com.openpcl.viewer.printing.PosPrintSetupDialogChoices; import com.openpcl.viewer.util.PosReadImageIcon; @@ -216,7 +214,7 @@ private void showPrintSetupDefaultsDialog() { mPosPrintSetupDialog = new PosPrintSetupDialog(mParentFrame, "Print Setup Defaults", mOpenPCLViewer.getPosStartupOptions(), mPosPrintSetupDialogChoices, - mPrintRequestAttributeSet, mPrinterJob, "No pages will print at this time because this is Printer Setup Defaluts."); + mPrintRequestAttributeSet, mPrinterJob, "No pages will print at this time because this is Printer Setup Defaults."); mPosPrintSetupDialog.setLocationRelativeTo(mParentFrame); mPosPrintSetupDialog.setVisible(true); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-07-20 23:53:33 UTC (rev 110) @@ -98,9 +98,9 @@ // Save the passed in AffineTransform (to put it back before returning) mOrigAffineTransform = g2D.getTransform(); - if (mPosPrintSetupDialogChoices.shouldShrinkLegalToFitOnLetter() && + if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal() && ( !(mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(mPrintThisTreeNode)) )) { - // The user has a check in the "Shrink All Legal Pages to Fit On Letter" check box so shrink to Legal to fit on Letter + // The user has clicked the "Print all on Letter paper (shrinks Legal)" radio button so shrink Legal to fit on Letter g2D.transform(mShrinkLegalToLetterAffineTransform); } else { Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java 2007-07-20 23:53:33 UTC (rev 110) @@ -76,14 +76,14 @@ throw new IndexOutOfBoundsException( makeIndexOutOfBoundsInfoString(pForPageNumber, mNumberOfPages)); } else { - if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { - // The user has a check in the Print Setup dialog box for "Print all Documents on Legal size" - // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the DSP values or no matter if this is a PCL file + if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + // The user has a check in the Print Setup dialog box for "Print all on Legal paper" + // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the Blockument DSP values + // or if this is a PCL file with a letter size PCL command tBuiltPageFormat.setPaper(mLegalPaperPortrait); - } else if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.shouldShrinkLegalToFitOnLetter()) { - // The user has a check in the "Shrink All Legal Pages to Fit On Letter" check box - // so force all pages to Letter size + } else if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal()) { + // The user has clicked the "Print all on Letter paper (shrinks Legal)" radio button so force all pages to Letter size tBuiltPageFormat.setPaper(mLetterPaperPortrait); } else { Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-20 23:53:33 UTC (rev 110) @@ -236,33 +236,46 @@ threadShowProgressBar.start(); StringBuffer tMsgStringBuffer = new StringBuffer(); - tMsgStringBuffer.append(" to printer selected: "); - tMsgStringBuffer.append(mPrintService.getName()); - tMsgStringBuffer.append("\n Shrink All Legal Pages to Fit On Letter is "); - if (mPosPrintSetupDialogChoices.shouldShrinkLegalToFitOnLetter()) { - tMsgStringBuffer.append("\"True\""); + // Java Console output window will show all the below: + // "Windows Print" or "Print PCL Direct" + if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { + tMsgStringBuffer.append("\"Print PCL Direct\""); } else { - tMsgStringBuffer.append("\"False\""); + tMsgStringBuffer.append("\"Windows Print\""); } - - tMsgStringBuffer.append("\n Print all Documents on Legal Size is "); - if (mPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { - tMsgStringBuffer.append("\"True\""); - } else { - tMsgStringBuffer.append("\"False\""); + + // to printer selected + tMsgStringBuffer.append(" to printer selected: "); + tMsgStringBuffer.append(mPrintService.getName()); + + // The 5 radio buttons in the "Paper Size" group box + if (mPosPrintSetupDialogChoices.isPaperSizeAsDisplayedOrSelected()) { + tMsgStringBuffer.append("\n Print as displayed/selected."); + + } else if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { + tMsgStringBuffer.append("\n Print Legal first, then Letter."); + + } else if (mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { + tMsgStringBuffer.append("\n Print Letter first, then Legal."); + + } else if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + tMsgStringBuffer.append("\n Print all on Legal paper."); + + } else if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal()) { + tMsgStringBuffer.append("\n Print all on Letter paper (shrinks Legal). "); } - + + // Additional copies tMsgStringBuffer.append("\n Additional Copies is " + mPosPrintSetupDialogChoices.getNumAdditionalCopies()); + // "Print All" or "Print Selected" or "Print Remaining" or "Print Changed" + // N pages + // Index numbers are: n, n, n, ... n tMsgStringBuffer.append("\n " + mIndexNumbersStringBuffer); - // Console output print type "Use Windows Print" or "Print PCL Direct" - if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { - PriDebug.releaseln("\"Print PCL Direct\"" + tMsgStringBuffer.toString()); - } else { - PriDebug.releaseln("\"Windows Print\"" + tMsgStringBuffer.toString()); - } + // Send the built multi line string to the Java Console + PriDebug.releaseln(tMsgStringBuffer.toString()); // The number of additional copies has already been validated and is guaranteed to be 0 to 3 at this point mNumberOfPrintPasses = 1 + mPosPrintSetupDialogChoices.getNumAdditionalCopies(); @@ -356,9 +369,10 @@ // PriDebug.releaseln("Pcl page before, after bytes: " + tPclBytes.length + ", " + tModifiedPclBytes.length); try { - if (pPosPrintSetupDialogChoices != null && pPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { - // The user has a check in the Print Setup dialog box for "Print all Documents on Legal size" - // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the DSP values or no matter if this is a PCL file + if (pPosPrintSetupDialogChoices != null && pPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + // The user has a check in the Print Setup dialog box for "Print all on Legal paper" + // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the Blockument DSP values + // or if this is a PCL file with a letter size PCL command tByteArrayOutputStream.write(tLegalSizePaperBytes); } else { Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-20 23:53:33 UTC (rev 110) @@ -58,7 +58,6 @@ private static final long serialVersionUID = 1L; private PosPrintSetupDialog mThisPosPrintSetupDialog = null; private PosStartupOptions mPosStartupOptions = null; - private Frame mParentFrame = null; private PosPrintSetupDialogChoices mPrintChoices = null; private PrintRequestAttributeSet mPrintRequestAttributeSet = null; private PrinterJob mPrinterJob = null; @@ -121,11 +120,11 @@ private Font mTextAreaFont = new Font("Arial", Font.PLAIN, 12); // JRadioButtons - private JRadioButton mPrintOrderAsDisplayedOrSelectedJRadioButton = new JRadioButton("As displayed / selected"); - private JRadioButton mPrintOrderLegalFirstThenLetterJRadioButton = new JRadioButton("Legal first, then Letter"); - private JRadioButton mPrintOrderLetterFirstThenLegalJRadioButton = new JRadioButton("Letter first, then Legal"); - private JRadioButton mAllOnLegalJRadioButton = new JRadioButton("Print all on Legal paper"); - private JRadioButton mAllOnLetterShrinkLegalJRadioButton = new JRadioButton("Print all on Letter paper (shrinks Legal)"); + private JRadioButton mPaperSizeAsDisplayedOrSelected = new JRadioButton("As displayed / selected"); + private JRadioButton mPaperSizeLegalFirstThenLetter = new JRadioButton("Legal first, then Letter"); + private JRadioButton mPaperSizeLetterFirstThenLegal = new JRadioButton("Letter first, then Legal"); + private JRadioButton mPaperSizePrintAllOnLegal = new JRadioButton("Print all on Legal paper"); + private JRadioButton mPaperSizePrintAllOnLetterShrinksLegal = new JRadioButton("Print all on Letter paper (shrinks Legal)"); private JRadioButton mPrintFormNamesYesJRadioButton = new JRadioButton("Yes"); private JRadioButton mPrintFormNamesNoJRadioButton = new JRadioButton("No"); private JRadioButton mDuplexYesJRadioButton = new JRadioButton("Yes (If Supported by Printer)"); @@ -162,7 +161,6 @@ super(pParentFrame, pTitleBarText, true); mThisPosPrintSetupDialog = this; // needed for the ActionListeners to put up the JOptionPane info dialogs mPosStartupOptions = pPosStartupOptions; - mParentFrame = pParentFrame; // Set to false the show DSML buttons even if the user said true on the command line mPosStartupOptions.setShowDSMLPrintDialogButtons(false); @@ -279,12 +277,12 @@ mIsPclPrinterJCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (mIsPclPrinterJCheckBox.isSelected()) { - mAllOnLetterShrinkLegalJRadioButton.setEnabled(true); + mPaperSizePrintAllOnLetterShrinksLegal.setEnabled(true); } else { - if (mAllOnLetterShrinkLegalJRadioButton.isSelected()) { - mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(true); + if (mPaperSizePrintAllOnLetterShrinksLegal.isSelected()) { + mPaperSizeAsDisplayedOrSelected.setSelected(true); } - mAllOnLetterShrinkLegalJRadioButton.setEnabled(false); + mPaperSizePrintAllOnLetterShrinksLegal.setEnabled(false); } } }); @@ -399,12 +397,12 @@ private void checkforGrayOutShrinkToLetter() { if (mIsPclPrinterJCheckBox.isSelected()) { - mAllOnLetterShrinkLegalJRadioButton.setEnabled(true); + mPaperSizePrintAllOnLetterShrinksLegal.setEnabled(true); } else { - if (mAllOnLetterShrinkLegalJRadioButton.isSelected()) { - mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(true); + if (mPaperSizePrintAllOnLetterShrinksLegal.isSelected()) { + mPaperSizeAsDisplayedOrSelected.setSelected(true); } - mAllOnLetterShrinkLegalJRadioButton.setEnabled(false); + mPaperSizePrintAllOnLetterShrinksLegal.setEnabled(false); } } @@ -451,31 +449,31 @@ private JPanel makePaperSizePanel() { JPanel panel = new JPanel(); - int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + int tTextHeight = mPaperSizeAsDisplayedOrSelected.getPreferredSize().height - 6; double tloGridSpec[][] = new double[][] {{ mTloPref}, { tTextHeight, tTextHeight, tTextHeight, tTextHeight, tTextHeight}}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); - buttonGroup.add(mPrintOrderLegalFirstThenLetterJRadioButton); - buttonGroup.add(mPrintOrderLetterFirstThenLegalJRadioButton); - buttonGroup.add(mAllOnLegalJRadioButton); - buttonGroup.add(mAllOnLetterShrinkLegalJRadioButton); + buttonGroup.add(mPaperSizeAsDisplayedOrSelected); + buttonGroup.add(mPaperSizeLegalFirstThenLetter); + buttonGroup.add(mPaperSizeLetterFirstThenLegal); + buttonGroup.add(mPaperSizePrintAllOnLegal); + buttonGroup.add(mPaperSizePrintAllOnLetterShrinksLegal); - panel.add(makeFillerOnRightPanel(mPrintOrderAsDisplayedOrSelectedJRadioButton), "0, 0"); - panel.add(makeFillerOnRightPanel(mPrintOrderLegalFirstThenLetterJRadioButton), "0, 1"); - panel.add(makeFillerOnRightPanel(mPrintOrderLetterFirstThenLegalJRadioButton), "0, 2"); - panel.add(makeFillerOnRightPanel(mAllOnLegalJRadioButton), "0, 3"); - panel.add(makeFillerOnRightPanel(mAllOnLetterShrinkLegalJRadioButton), "0, 4"); + panel.add(makeFillerOnRightPanel(mPaperSizeAsDisplayedOrSelected), "0, 0"); + panel.add(makeFillerOnRightPanel(mPaperSizeLegalFirstThenLetter), "0, 1"); + panel.add(makeFillerOnRightPanel(mPaperSizeLetterFirstThenLegal), "0, 2"); + panel.add(makeFillerOnRightPanel(mPaperSizePrintAllOnLegal), "0, 3"); + panel.add(makeFillerOnRightPanel(mPaperSizePrintAllOnLetterShrinksLegal), "0, 4"); return panel; } private JPanel makePrintFormNamesPanel() { JPanel panel = new JPanel(); - int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + int tTextHeight = mPaperSizeAsDisplayedOrSelected.getPreferredSize().height - 6; double tloGridSpec[][] = new double[][] {{ mTloPref }, { tTextHeight, tTextHeight }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); @@ -491,7 +489,7 @@ private JPanel makeDuplexPanel() { JPanel panel = new JPanel(); - int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + int tTextHeight = mPaperSizeAsDisplayedOrSelected.getPreferredSize().height - 6; double tloGridSpec[][] = new double[][] {{ mTloPref }, { tTextHeight, tTextHeight }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); @@ -550,15 +548,24 @@ private void putPrintChoicesOnScreen() { mAddlCopiesJTextField.setText(Integer.toString(mPrintChoices.getNumAdditionalCopies())); mIsPclPrinterJCheckBox.setSelected(!(mPrintChoices.isPrintFormatPclDirect())); - mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(mPrintChoices.isPrintOrderAsDisplayedOrSelected()); - mPrintOrderLegalFirstThenLetterJRadioButton.setSelected(mPrintChoices.isPrintOrderLegalFirstThenLetter()); - mPrintOrderLetterFirstThenLegalJRadioButton.setSelected(mPrintChoices.isPrintOrderLetterFirstThenLegal()); - mPrintFormNamesYesJRadioButton.setSelected(mPrintChoices.shouldPrintFormNames()); - mPrintFormNamesNoJRadioButton.setSelected( !(mPrintChoices.shouldPrintFormNames()) ); - mDuplexYesJRadioButton.setSelected(mPrintChoices.shouldDuplex()); - mDuplexNoJRadioButton.setSelected( !(mPrintChoices.shouldDuplex()) ); - mAllOnLetterShrinkLegalJRadioButton.setSelected(mPrintChoices.shouldShrinkLegalToFitOnLetter()); - mAllOnLegalJRadioButton.setSelected(mPrintChoices.shouldPrintAllOnLegalSize()); + + mPaperSizeAsDisplayedOrSelected.setSelected(mPrintChoices.isPaperSizeAsDisplayedOrSelected()); + mPaperSizeLegalFirstThenLetter.setSelected(mPrintChoices.isPaperSizeLegalFirstThenLetter()); + mPaperSizeLetterFirstThenLegal.setSelected(mPrintChoices.isPaperSizeLetterFirstThenLegal()); + mPaperSizePrintAllOnLegal.setSelected(mPrintChoices.isPaperSizePrintAllOnLegal()); + mPaperSizePrintAllOnLetterShrinksLegal.setSelected(mPrintChoices.isPaperSizePrintAllOnLetterShrinksLegal()); + + if (mPrintChoices.shouldPrintFormNames()) { + mPrintFormNamesYesJRadioButton.setSelected(true); + } else { + mPrintFormNamesYesJRadioButton.setSelected(false); + } + + if (mPrintChoices.shouldDuplex()) { + mDuplexYesJRadioButton.setSelected(true); + } else { + mDuplexYesJRadioButton.setSelected(false); + } } private void getPrintChoicesFromScreen() { @@ -583,21 +590,23 @@ mPrintChoices.setPrintFormatIsPclDirect(); } - // Print order - if (mPrintOrderAsDisplayedOrSelectedJRadioButton.isSelected()) { - mPrintChoices.setPrintOrderAsDisplayedOrSelected(); - } else if (mPrintOrderLegalFirstThenLetterJRadioButton.isSelected()) { - mPrintChoices.setPrintOrderLegalFirstThenLetter(); - } else { - mPrintChoices.setPrintOrderLetterFirstThenLegal(); + // Paper Size + if (mPaperSizeAsDisplayedOrSelected.isSelected()) { + mPrintChoices.setPaperSizeAsDisplayedSelected(); + + } else if (mPaperSizeLegalFirstThenLetter.isSelected()) { + mPrintChoices.setPaperSizeLegalFirstThenLetter(); + + } else if (mPaperSizeLetterFirstThenLegal.isSelected()) { + mPrintChoices.setPaperSizeLetterFirstThenLegal(); + + } else if (mPaperSizePrintAllOnLegal.isSelected()) { + mPrintChoices.setPaperSizePrintAllOnLegal(); + + } else if (mPaperSizePrintAllOnLetterShrinksLegal.isSelected()) { + mPrintChoices.setPaperSizePrintAllOnLetterShrinksLegal(); } - // Shrink All Legal Pages to Fit On Letter - mPrintChoices.setShouldShrinkLegalToFitOnLetter(mAllOnLetterShrinkLegalJRadioButton.isSelected()); - - // Print all on legal size - mPrintChoices.setShouldPrintAllOnLegalSize(mAllOnLegalJRadioButton.isSelected()); - // Print form names mPrintChoices.setShouldPrintFormNames(mPrintFormNamesYesJRadioButton.isSelected()); @@ -609,13 +618,15 @@ private void makeArrayListOfDialogItems() { mItemsOnDialogBox.add(mListOfPrintersJList); mItemsOnDialogBox.add(mIsPclPrinterJCheckBox); - mItemsOnDialogBox.add(mAllOnLetterShrinkLegalJRadioButton); - mItemsOnDialogBox.add(mAllOnLegalJRadioButton); mItemsOnDialogBox.add(mAddlCopiesJLabel); mItemsOnDialogBox.add(mAddlCopiesJTextField); - mItemsOnDialogBox.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); - mItemsOnDialogBox.add(mPrintOrderLegalFirstThenLetterJRadioButton); - mItemsOnDialogBox.add(mPrintOrderLetterFirstThenLegalJRadioButton); + + mItemsOnDialogBox.add(mPaperSizeAsDisplayedOrSelected); + mItemsOnDialogBox.add(mPaperSizeLegalFirstThenLetter); + mItemsOnDialogBox.add(mPaperSizeLetterFirstThenLegal); + mItemsOnDialogBox.add(mPaperSizePrintAllOnLegal); + mItemsOnDialogBox.add(mPaperSizePrintAllOnLetterShrinksLegal); + mItemsOnDialogBox.add(mPrintFormNamesYesJRadioButton); mItemsOnDialogBox.add(mPrintFormNamesNoJRadioButton); mItemsOnDialogBox.add(mDuplexYesJRadioButton); @@ -740,12 +751,12 @@ mIsPclPrinterJCheckBox.setToolTipText(sPrinterModeHoverOverString); mAddlCopiesJTextField.setToolTipText("Allowed values are 0 to 3 additional copies"); - mAllOnLegalJRadioButton.setToolTipText("Print all pages on Legal paper"); - mAllOnLetterShrinkLegalJRadioButton.setToolTipText( + mPaperSizeAsDisplayedOrSelected.setToolTipText("Print pages in the order shown on the screen"); + mPaperSizeLegalFirstThenLetter.setToolTipText("Print Legal first then Letter"); + mPaperSizeLetterFirstThenLegal.setToolTipText("Print Letter first then Legal"); + mPaperSizePrintAllOnLegal.setToolTipText("Print all pages on Legal paper"); + mPaperSizePrintAllOnLetterShrinksLegal.setToolTipText( "Print all pages on Letter paper. This is grayed out if \"Use Windows Print\" is unchecked"); - mPrintOrderAsDisplayedOrSelectedJRadioButton.setToolTipText("Print pages in the order shown in the tree"); - mPrintOrderLegalFirstThenLetterJRadioButton.setToolTipText("Print Legal first then Letter"); - mPrintOrderLetterFirstThenLegalJRadioButton.setToolTipText("Print Letter first then Legal"); mPrintFormNamesYesJRadioButton.setToolTipText("Print form names"); mPrintFormNamesNoJRadioButton.setToolTipText("Don't print form names"); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-20 23:53:33 UTC (rev 110) @@ -8,22 +8,22 @@ */ public class PosPrintSetupDialogChoices { - public static final int mPrintFormatIsPclDirect = 1; - public static final int mPrintFormatIsGdiDriver = 2; + public static final int sPrintFormatIsPclDirect = 1; + public static final int sPrintFormatIsGdiDriver = 2; - public static final int mPrintOrderAsDisplayedOrSelected = 1; - public static final int mPrintOrderLegalFirstThenLetter = 2; - public static final int mPrintOrderLetterFirstThenLegal = 3; + public static final int sPaperSizeAsDisplayedSelected = 1; + public static final int sPaperSizeLegalFirstThenLetter = 2; + public static final int sPaperSizeLetterFirstThenLegal = 3; + public static final int sPaperSizePrintAllOnLegal = 4; + public static final int sPaperSizePrintAllOnLetterShrinksLegal = 5; // TODO Add code to take the defaults from the user options in the Preferences, instead of the below initializations private PrintService mSelectedPrintService = null; private int mNumAdditionalCopies = 0; - private int mPrintFormat = mPrintFormatIsGdiDriver; - private int mPrintOrder = mPrintOrderAsDisplayedOrSelected; + private int mPrintFormat = sPrintFormatIsGdiDriver; + private int mPaperSize = sPaperSizeAsDisplayedSelected; private boolean mShouldPrintFormNames = false; private boolean mShouldDuplex = false; - private boolean mShouldShrinkLegalToFitOnLetter = false; - private boolean mShouldPrintAllOnLegalSize = false; private boolean mUserHitOk = false; @@ -39,32 +39,32 @@ return mNumAdditionalCopies; } public boolean isPrintFormatPclDirect() { - return (mPrintFormat == mPrintFormatIsPclDirect); + return (mPrintFormat == sPrintFormatIsPclDirect); } public boolean isPrintFormatGdiDriver() { - return (mPrintFormat == mPrintFormatIsGdiDriver); + return (mPrintFormat == sPrintFormatIsGdiDriver); } - public boolean isPrintOrderAsDisplayedOrSelected() { - return (mPrintOrder == mPrintOrderAsDisplayedOrSelected); + public boolean isPaperSizeAsDisplayedOrSelected() { + return (mPaperSize == sPaperSizeAsDisplayedSelected); } - public boolean isPrintOrderLegalFirstThenLetter() { - return (mPrintOrder == mPrintOrderLegalFirstThenLetter); + public boolean isPaperSizeLegalFirstThenLetter() { + return (mPaperSize == sPaperSizeLegalFirstThenLetter); } - public boolean isPrintOrderLetterFirstThenLegal() { - return (mPrintOrder == mPrintOrderLetterFirstThenLegal); + public boolean isPaperSizeLetterFirstThenLegal() { + return (mPaperSize == sPaperSizeLetterFirstThenLegal); } + public boolean isPaperSizePrintAllOnLegal() { + return (mPaperSize == sPaperSizePrintAllOnLegal); + } + public boolean isPaperSizePrintAllOnLetterShrinksLegal() { + return (mPaperSize == sPaperSizePrintAllOnLetterShrinksLegal); + } public boolean shouldPrintFormNames() { return mShouldPrintFormNames; } public boolean shouldDuplex() { return mShouldDuplex; } - public boolean shouldShrinkLegalToFitOnLetter() { - return mShouldShrinkLegalToFitOnLetter; - } - public boolean shouldPrintAllOnLegalSize() { - return mShouldPrintAllOnLegalSize; - } public boolean getDidUserHitOk() { return mUserHitOk; } @@ -77,32 +77,32 @@ mNumAdditionalCopies = numCopies; } public void setPrintFormatIsPclDirect() { - mPrintFormat = mPrintFormatIsPclDirect; + mPrintFormat = sPrintFormatIsPclDirect; } public void setPrintFormatIsGdiDriver() { - mPrintFormat = mPrintFormatIsGdiDriver; + mPrintFormat = sPrintFormatIsGdiDriver; } - public void setPrintOrderAsDisplayedOrSelected() { - mPrintOrder = mPrintOrderAsDisplayedOrSelected; + public void setPaperSizeAsDisplayedSelected() { + mPaperSize = sPaperSizeAsDisplayedSelected; } - public void setPrintOrderLegalFirstThenLetter() { - mPrintOrder = mPrintOrderLegalFirstThenLetter; + public void setPaperSizeLegalFirstThenLetter() { + mPaperSize = sPaperSizeLegalFirstThenLetter; } - public void setPrintOrderLetterFirstThenLegal() { - mPrintOrder = mPrintOrderLetterFirstThenLegal; + public void setPaperSizeLetterFirstThenLegal() { + mPaperSize = sPaperSizeLetterFirstThenLegal; } + public void setPaperSizePrintAllOnLegal() { + mPaperSize = sPaperSizePrintAllOnLegal; + } + public void setPaperSizePrintAllOnLetterShrinksLegal() { + mPaperSize = sPaperSizePrintAllOnLetterShrinksLegal; + } public void setShouldPrintFormNames(boolean yesOrNo) { mShouldPrintFormNames = yesOrNo; } public void setShouldDuplex(boolean yesOrNo) { mShouldDuplex = yesOrNo; } - public void setShouldShrinkLegalToFitOnLetter(boolean yesOrNo) { - mShouldShrinkLegalToFitOnLetter = yesOrNo; - } - public void setShouldPrintAllOnLegalSize(boolean yesOrNo) { - mShouldPrintAllOnLegalSize = yesOrNo; - } public void setUserHitOk(boolean yesOrNo) { mUserHitOk = yesOrNo; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-17 01:53:19
|
Revision: 109 http://openpcl.svn.sourceforge.net/openpcl/?rev=109&view=rev Author: documentsystems Date: 2007-07-16 18:53:21 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Howard Hoagland. Changed Print Setup Dialog to move the "Print all on Legal, Print all on Letter (Shrink Legal)" from check boxes to radio buttons that are now part of the "Paper Size" group box of 5 radio buttons instead of the "Print Order" 3 radio buttons. Added the "Print Form Names" and "Duplex" group boxes with their yes/no radio buttons. Removed the "Print Bar Codes" source code because that's for generating bar codes on the fly which we are not going to do. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-16 21:46:41 UTC (rev 108) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-17 01:53:21 UTC (rev 109) @@ -2,6 +2,7 @@ import info.clearthought.layout.TableLayout; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; @@ -55,6 +56,7 @@ public class PosPrintSetupDialog extends JDialog { private static final long serialVersionUID = 1L; + private PosPrintSetupDialog mThisPosPrintSetupDialog = null; private PosStartupOptions mPosStartupOptions = null; private Frame mParentFrame = null; private PosPrintSetupDialogChoices mPrintChoices = null; @@ -94,8 +96,7 @@ private JPanel mListOfPrintersJPanel = null; private JPanel mAddlCopiesJPanel = null; private JPanel mWindowsPrintOrPclPrintJPanel = null; - private JPanel mPrintBarCodesJPanel = null; - private JPanel mPrintOrderJPanel = null; + private JPanel mPaperSizeJPanel = null; private JPanel mPrintFormNamesJPanel = null; private JPanel mDuplexJPanel = null; @@ -120,11 +121,11 @@ private Font mTextAreaFont = new Font("Arial", Font.PLAIN, 12); // JRadioButtons - private JRadioButton mPrintBarCodesYesJRadioButton = new JRadioButton("Yes"); - private JRadioButton mPrintBarCodesNoJRadioButton = new JRadioButton("No"); - private JRadioButton mPrintOrderAsDisplayedOrSelectedJRadioButton = new JRadioButton("As Displayed/Selected"); - private JRadioButton mPrintOrderLegalFirstThenLetterJRadioButton = new JRadioButton("Legal First, Then Letter"); - private JRadioButton mPrintOrderLetterFirstThenLegalJRadioButton = new JRadioButton("Letter First, Then Legal"); + private JRadioButton mPrintOrderAsDisplayedOrSelectedJRadioButton = new JRadioButton("As displayed / selected"); + private JRadioButton mPrintOrderLegalFirstThenLetterJRadioButton = new JRadioButton("Legal first, then Letter"); + private JRadioButton mPrintOrderLetterFirstThenLegalJRadioButton = new JRadioButton("Letter first, then Legal"); + private JRadioButton mAllOnLegalJRadioButton = new JRadioButton("Print all on Legal paper"); + private JRadioButton mAllOnLetterShrinkLegalJRadioButton = new JRadioButton("Print all on Letter paper (shrinks Legal)"); private JRadioButton mPrintFormNamesYesJRadioButton = new JRadioButton("Yes"); private JRadioButton mPrintFormNamesNoJRadioButton = new JRadioButton("No"); private JRadioButton mDuplexYesJRadioButton = new JRadioButton("Yes (If Supported by Printer)"); @@ -144,21 +145,14 @@ // JCheckBoxes private JCheckBox mIsPclPrinterJCheckBox = new JCheckBox("Use Windows Print (recommended)"); - private JCheckBox mShrinkLegalToFitOnLetterJCheckBox = new JCheckBox( - "Shrink All Legal Pages to Fit On Letter"); - private JCheckBox mPrintAllOnLegalSizeJCheckBox = new JCheckBox("Print All Documents on Legal Size"); // JLists private JList mListOfPrintersJList = null; private ListModel mPrintersListModel = null; private ListOfPrintersSelectionListener mListOfPrintersSelectionListener = new ListOfPrintersSelectionListener(); private JScrollPane mListOfPrintersJScrollPane = null; - + // Strings - private static final String sNotImplementedString = "Not implemented: "; - private static final String sBarCodeHoverString = - "Bar codes already in the PCL are printed, but bar codes are not generated on the fly."; - private static final String sPrinterModeHoverOverString = "<html>Unselect if printer supports PCL (Example: HP LaserJet 4050)</html>"; @@ -166,6 +160,7 @@ PosPrintSetupDialogChoices pPrintChoices, PrintRequestAttributeSet pPrintRequestAttributeSet, PrinterJob pPrinterJob, String pSelectedPageNumbers) throws HeadlessException { super(pParentFrame, pTitleBarText, true); + mThisPosPrintSetupDialog = this; // needed for the ActionListeners to put up the JOptionPane info dialogs mPosStartupOptions = pPosStartupOptions; mParentFrame = pParentFrame; // Set to false the show DSML buttons even if the user said true on the command line @@ -194,31 +189,27 @@ mListOfPrintersJPanel = makeListOfPrintersPanel(); mWindowsPrintOrPclPrintJPanel = makeWindowsPrintOrPclPrintPanel(); mAddlCopiesJPanel = makeAdditionalCopiesPanel(); - mPrintBarCodesJPanel = makePrintBarCodesPanel(); - mPrintOrderJPanel = makePrintOrderPanel(); + mPaperSizeJPanel = makePaperSizePanel(); mPrintFormNamesJPanel = makePrintFormNamesPanel(); mDuplexJPanel = makeDuplexPanel(); // Lay out tab 1 items double tloTab1GridSpec[][] = new double[][] { - { mTloFill, mTloHgap, mTloFill}, // columns - { mTloFill, mTloVgap, mTloPref, mTloPref, mTloPref, mTloPref, mTloVgap, mTloPref, mTloPref}}; // rows + { mTloPref, 10, mTloFill}, // columns + { mTloFill, mTloVgap, mTloPref, mTloPref, mTloPref}}; // rows TableLayout tloTab1Layout = new TableLayout(tloTab1GridSpec); mTab1.setLayout(tloTab1Layout); mTab1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mTab1.add(mListOfPrintersJPanel, "0, 0, 2, 0"); - mTab1.add(mWindowsPrintOrPclPrintJPanel, "0, 2, 2, 2"); - mTab1.add(makeFillerOnRightPanel(mShrinkLegalToFitOnLetterJCheckBox), "0, 3, 2, 3"); - mTab1.add(makeFillerOnRightPanel(mPrintAllOnLegalSizeJCheckBox), "0, 4, 2, 4"); - mTab1.add(mAddlCopiesJPanel, "0, 5, 2, 5"); - mTab1.add(mPrintOrderJPanel, "0, 7, 2, 7"); - mTab1.add(makeFillerOnRightPanel(mOpenJDKPrintDialogJButton), "0, 8, 2, 8"); + mTab1.add(mWindowsPrintOrPclPrintJPanel, "0, 2"); + mTab1.add(mAddlCopiesJPanel, "2, 2"); + mTab1.add(mPaperSizeJPanel, "0, 3, 0, 4"); -// mTab1.add(mPrintBarCodesJPanel, "0, 6"); -// mTab1.add(mPrintOrderJPanel, "2, 6"); -// mTab1.add(mPrintFormNamesJPanel, "0, 8"); -// mTab1.add(mDuplexJPanel, "2, 8"); + mTab1.add(mPrintFormNamesJPanel, "2, 3"); + mTab1.add(mDuplexJPanel, "2, 4"); + // mTab1.add(makeFillerOnRightPanel(mOpenJDKPrintDialogJButton), "0, 8, 2, 8"); + // Lay out tab 2 items // double tloTab2GridSpec[][] = new double[][] { // { mTloPref, mTloFill }, // columns @@ -267,7 +258,7 @@ // Add the Control Panel, JTabbedPane, and buttons panel to the contentPane double tloContentPaneGridSpec[][] = new double[][] { { mTloHgap, mTloFill, mTloHgap }, // columns - { mTloFill, mTloPref, mTloVgap }}; // rows + { mTloFill, mTloPref, 10 }}; // rows TableLayout tloContentPaneLayout = new TableLayout(tloContentPaneGridSpec); setLayout(tloContentPaneLayout); // mControlJPanel = makeControlPanel(); @@ -280,7 +271,7 @@ // ActionListeners mPrintModeMoreInfoJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - JOptionPane.showMessageDialog(mParentFrame, sPrinterModeHoverOverString, + JOptionPane.showMessageDialog(mThisPosPrintSetupDialog, sPrinterModeHoverOverString, "Info for \"Use Windows Print\"", JOptionPane.INFORMATION_MESSAGE); } }); @@ -288,30 +279,16 @@ mIsPclPrinterJCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (mIsPclPrinterJCheckBox.isSelected()) { - mShrinkLegalToFitOnLetterJCheckBox.setEnabled(true); + mAllOnLetterShrinkLegalJRadioButton.setEnabled(true); } else { - mShrinkLegalToFitOnLetterJCheckBox.setSelected(false); - mShrinkLegalToFitOnLetterJCheckBox.setEnabled(false); + if (mAllOnLetterShrinkLegalJRadioButton.isSelected()) { + mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(true); + } + mAllOnLetterShrinkLegalJRadioButton.setEnabled(false); } } }); - mShrinkLegalToFitOnLetterJCheckBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (mShrinkLegalToFitOnLetterJCheckBox.isSelected()) { - mPrintAllOnLegalSizeJCheckBox.setSelected(false); - } - } - }); - - mPrintAllOnLegalSizeJCheckBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (mPrintAllOnLegalSizeJCheckBox.isSelected()) { - mShrinkLegalToFitOnLetterJCheckBox.setSelected(false); - } - } - }); - // mFontSizeDinkyJButton.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // mFontSizeDinkyJButton.setText("*D*"); @@ -415,12 +392,22 @@ adjustFontOnDialogItems(mAdjustToSmallFont); putPrintChoicesOnScreen(); setHoverHelpOnItems(); - grayOutItemsNotImplemented(); - grayOutShrinkToLetterOrForceLegalCheckBoxes(); + checkforGrayOutShrinkToLetter(); // Make dialog box outer frame width and height exactly to be all item's preferred sizes pack(); } + private void checkforGrayOutShrinkToLetter() { + if (mIsPclPrinterJCheckBox.isSelected()) { + mAllOnLetterShrinkLegalJRadioButton.setEnabled(true); + } else { + if (mAllOnLetterShrinkLegalJRadioButton.isSelected()) { + mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(true); + } + mAllOnLetterShrinkLegalJRadioButton.setEnabled(false); + } + } + private JPanel makeListOfPrintersPanel() { JPanel panel = new JPanel(); double tloGridSpec[][] = new double[][] {{mTloHgap, mTloFill, mTloHgap }, {mTloFill, mTloVgap }}; @@ -462,57 +449,59 @@ return panel; } - private JPanel makePrintBarCodesPanel() { + private JPanel makePaperSizePanel() { JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{ mTloHgap, mTloPref, mTloFill }, { mTloPref, mTloVgap, mTloPref }}; + int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + double tloGridSpec[][] = new double[][] {{ mTloPref}, + { tTextHeight, tTextHeight, tTextHeight, tTextHeight, tTextHeight}}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); + ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(mPrintBarCodesYesJRadioButton); - buttonGroup.add(mPrintBarCodesNoJRadioButton); - panel.add(mPrintBarCodesYesJRadioButton, "1, 0"); - panel.add(mPrintBarCodesNoJRadioButton, "1, 2"); - return panel; - } - - private JPanel makePrintOrderPanel() { - JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{ mTloHgap, mTloPref, mTloFill }, { mTloPref, mTloPref, mTloPref }}; - TableLayout tloLayout = new TableLayout(tloGridSpec); - panel.setLayout(tloLayout); - ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); buttonGroup.add(mPrintOrderLegalFirstThenLetterJRadioButton); buttonGroup.add(mPrintOrderLetterFirstThenLegalJRadioButton); - panel.add(mPrintOrderAsDisplayedOrSelectedJRadioButton, "1, 0"); - panel.add(mPrintOrderLegalFirstThenLetterJRadioButton, "1, 1"); - panel.add(mPrintOrderLetterFirstThenLegalJRadioButton, "1, 2"); + buttonGroup.add(mAllOnLegalJRadioButton); + buttonGroup.add(mAllOnLetterShrinkLegalJRadioButton); + + panel.add(makeFillerOnRightPanel(mPrintOrderAsDisplayedOrSelectedJRadioButton), "0, 0"); + panel.add(makeFillerOnRightPanel(mPrintOrderLegalFirstThenLetterJRadioButton), "0, 1"); + panel.add(makeFillerOnRightPanel(mPrintOrderLetterFirstThenLegalJRadioButton), "0, 2"); + panel.add(makeFillerOnRightPanel(mAllOnLegalJRadioButton), "0, 3"); + panel.add(makeFillerOnRightPanel(mAllOnLetterShrinkLegalJRadioButton), "0, 4"); + return panel; } private JPanel makePrintFormNamesPanel() { JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{ mTloHgap, mTloPref, mTloFill }, { mTloPref, mTloVgap, mTloPref }}; + int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + double tloGridSpec[][] = new double[][] {{ mTloPref }, { tTextHeight, tTextHeight }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); + ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(mPrintFormNamesYesJRadioButton); buttonGroup.add(mPrintFormNamesNoJRadioButton); - panel.add(mPrintFormNamesYesJRadioButton, "1, 0"); - panel.add(mPrintFormNamesNoJRadioButton, "1, 2"); + + panel.add(makeFillerOnRightPanel(mPrintFormNamesYesJRadioButton), "0, 0"); + panel.add(makeFillerOnRightPanel(mPrintFormNamesNoJRadioButton), "0, 1"); return panel; } private JPanel makeDuplexPanel() { JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{ mTloHgap, mTloPref, mTloFill }, { mTloPref, mTloVgap, mTloPref }}; + int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + double tloGridSpec[][] = new double[][] {{ mTloPref }, { tTextHeight, tTextHeight }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); + ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(mDuplexYesJRadioButton); buttonGroup.add(mDuplexNoJRadioButton); - panel.add(mDuplexYesJRadioButton, "1, 0"); - panel.add(mDuplexNoJRadioButton, "1, 2"); + + panel.add(makeFillerOnRightPanel(mDuplexYesJRadioButton), "0, 0"); + panel.add(makeFillerOnRightPanel(mDuplexNoJRadioButton), "0, 1"); return panel; } @@ -547,36 +536,20 @@ } private JPanel makeFillerOnRightPanel(JComponent pJc) { - JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{mTloPref, mTloFill}, { mTloPref }}; - TableLayout tloLayout = new TableLayout(tloGridSpec); - panel.setLayout(tloLayout); - panel.add(pJc,"0,0"); - return panel; + JPanel panel1 = new JPanel(); + JPanel panel2 = new JPanel(); + panel1.setBorder(BorderFactory.createEmptyBorder()); + panel2.setBorder(BorderFactory.createEmptyBorder()); + panel2.setPreferredSize(new Dimension(0,0)); + panel1.setLayout(new BorderLayout(0,0)); + panel1.add(pJc, BorderLayout.WEST); + panel1.add(panel2, BorderLayout.CENTER); + return panel1; } - - private void grayOutShrinkToLetterOrForceLegalCheckBoxes() { - if (mIsPclPrinterJCheckBox.isSelected()) { - mShrinkLegalToFitOnLetterJCheckBox.setEnabled(true); - } else { - mShrinkLegalToFitOnLetterJCheckBox.setSelected(false); - mShrinkLegalToFitOnLetterJCheckBox.setEnabled(false); - } - - if (mShrinkLegalToFitOnLetterJCheckBox.isSelected()) { - mPrintAllOnLegalSizeJCheckBox.setSelected(false); - } - - if (mPrintAllOnLegalSizeJCheckBox.isSelected()) { - mShrinkLegalToFitOnLetterJCheckBox.setSelected(false); - } - } private void putPrintChoicesOnScreen() { mAddlCopiesJTextField.setText(Integer.toString(mPrintChoices.getNumAdditionalCopies())); mIsPclPrinterJCheckBox.setSelected(!(mPrintChoices.isPrintFormatPclDirect())); - mPrintBarCodesYesJRadioButton.setSelected(mPrintChoices.shouldPrintBarCodes()); - mPrintBarCodesNoJRadioButton.setSelected( !(mPrintChoices.shouldPrintBarCodes()) ); mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(mPrintChoices.isPrintOrderAsDisplayedOrSelected()); mPrintOrderLegalFirstThenLetterJRadioButton.setSelected(mPrintChoices.isPrintOrderLegalFirstThenLetter()); mPrintOrderLetterFirstThenLegalJRadioButton.setSelected(mPrintChoices.isPrintOrderLetterFirstThenLegal()); @@ -584,8 +557,8 @@ mPrintFormNamesNoJRadioButton.setSelected( !(mPrintChoices.shouldPrintFormNames()) ); mDuplexYesJRadioButton.setSelected(mPrintChoices.shouldDuplex()); mDuplexNoJRadioButton.setSelected( !(mPrintChoices.shouldDuplex()) ); - mShrinkLegalToFitOnLetterJCheckBox.setSelected(mPrintChoices.shouldShrinkLegalToFitOnLetter()); - mPrintAllOnLegalSizeJCheckBox.setSelected(mPrintChoices.shouldPrintAllOnLegalSize()); + mAllOnLetterShrinkLegalJRadioButton.setSelected(mPrintChoices.shouldShrinkLegalToFitOnLetter()); + mAllOnLegalJRadioButton.setSelected(mPrintChoices.shouldPrintAllOnLegalSize()); } private void getPrintChoicesFromScreen() { @@ -610,9 +583,6 @@ mPrintChoices.setPrintFormatIsPclDirect(); } - // Print bar codes - mPrintChoices.setShouldPrintBarCodes(mPrintBarCodesYesJRadioButton.isSelected()); - // Print order if (mPrintOrderAsDisplayedOrSelectedJRadioButton.isSelected()) { mPrintChoices.setPrintOrderAsDisplayedOrSelected(); @@ -622,28 +592,27 @@ mPrintChoices.setPrintOrderLetterFirstThenLegal(); } + // Shrink All Legal Pages to Fit On Letter + mPrintChoices.setShouldShrinkLegalToFitOnLetter(mAllOnLetterShrinkLegalJRadioButton.isSelected()); + + // Print all on legal size + mPrintChoices.setShouldPrintAllOnLegalSize(mAllOnLegalJRadioButton.isSelected()); + // Print form names mPrintChoices.setShouldPrintFormNames(mPrintFormNamesYesJRadioButton.isSelected()); // Duplex mPrintChoices.setShouldDuplex(mDuplexYesJRadioButton.isSelected()); - // Shrink All Legal Pages to Fit On Letter - mPrintChoices.setShouldShrinkLegalToFitOnLetter(mShrinkLegalToFitOnLetterJCheckBox.isSelected()); - - // Print all on legal size - mPrintChoices.setShouldPrintAllOnLegalSize(mPrintAllOnLegalSizeJCheckBox.isSelected()); } private void makeArrayListOfDialogItems() { mItemsOnDialogBox.add(mListOfPrintersJList); mItemsOnDialogBox.add(mIsPclPrinterJCheckBox); - mItemsOnDialogBox.add(mShrinkLegalToFitOnLetterJCheckBox); - mItemsOnDialogBox.add(mPrintAllOnLegalSizeJCheckBox); + mItemsOnDialogBox.add(mAllOnLetterShrinkLegalJRadioButton); + mItemsOnDialogBox.add(mAllOnLegalJRadioButton); mItemsOnDialogBox.add(mAddlCopiesJLabel); mItemsOnDialogBox.add(mAddlCopiesJTextField); - mItemsOnDialogBox.add(mPrintBarCodesYesJRadioButton); - mItemsOnDialogBox.add(mPrintBarCodesNoJRadioButton); mItemsOnDialogBox.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); mItemsOnDialogBox.add(mPrintOrderLegalFirstThenLetterJRadioButton); mItemsOnDialogBox.add(mPrintOrderLetterFirstThenLegalJRadioButton); @@ -691,8 +660,7 @@ mListOfPrintersJPanel.setBorder(generateTitledBorder("Printers")); mWindowsPrintOrPclPrintJPanel.setBorder(BorderFactory.createEmptyBorder()); mAddlCopiesJPanel.setBorder(BorderFactory.createEmptyBorder()); - mPrintBarCodesJPanel.setBorder(generateTitledBorder("Print Bar Codes")); - mPrintOrderJPanel.setBorder(generateTitledBorder("Print Order")); + mPaperSizeJPanel.setBorder(generateTitledBorder("Paper Size")); mPrintFormNamesJPanel.setBorder(generateTitledBorder("Print Form Names")); mDuplexJPanel.setBorder(generateTitledBorder("Duplex")); } @@ -770,28 +738,21 @@ private void setHoverHelpOnItems() { mIsPclPrinterJCheckBox.setToolTipText(sPrinterModeHoverOverString); - mShrinkLegalToFitOnLetterJCheckBox.setToolTipText( - "Shrink Legal pages to Letter not available if \"Use Windows Print\" is unchecked"); mAddlCopiesJTextField.setToolTipText("Allowed values are 0 to 3 additional copies"); - mPrintAllOnLegalSizeJCheckBox.setToolTipText("Make all pages print on Legal paper"); - mPrintBarCodesYesJRadioButton.setToolTipText(sBarCodeHoverString); - mPrintBarCodesNoJRadioButton.setToolTipText(sBarCodeHoverString); + mAllOnLegalJRadioButton.setToolTipText("Print all pages on Legal paper"); + mAllOnLetterShrinkLegalJRadioButton.setToolTipText( + "Print all pages on Letter paper. This is grayed out if \"Use Windows Print\" is unchecked"); mPrintOrderAsDisplayedOrSelectedJRadioButton.setToolTipText("Print pages in the order shown in the tree"); - mPrintOrderLegalFirstThenLetterJRadioButton.setToolTipText(sNotImplementedString + "Print Legal first then Letter"); - mPrintOrderLetterFirstThenLegalJRadioButton.setToolTipText(sNotImplementedString + "Print Letter first then Legal"); - mPrintFormNamesYesJRadioButton.setToolTipText(sNotImplementedString + "Print form names"); + mPrintOrderLegalFirstThenLetterJRadioButton.setToolTipText("Print Legal first then Letter"); + mPrintOrderLetterFirstThenLegalJRadioButton.setToolTipText("Print Letter first then Legal"); + + mPrintFormNamesYesJRadioButton.setToolTipText("Print form names"); mPrintFormNamesNoJRadioButton.setToolTipText("Don't print form names"); - mDuplexYesJRadioButton.setToolTipText(sNotImplementedString + "Duplex pages"); + mDuplexYesJRadioButton.setToolTipText("Duplex pages"); mDuplexNoJRadioButton.setToolTipText("Don't duplex pages"); } - private void grayOutItemsNotImplemented() { - mPrintBarCodesYesJRadioButton.setEnabled(false); - mPrintFormNamesYesJRadioButton.setEnabled(false); - mDuplexYesJRadioButton.setEnabled(false); - } - public class DialogWindowListener implements WindowListener { public void windowOpened(WindowEvent e) { } @@ -826,14 +787,14 @@ try { tAddlCopiesInt = Integer.parseInt(tAddlCopiesString); } catch (NumberFormatException nfe) { - JOptionPane.showMessageDialog(mParentFrame, tUserInputNumberRequiredString, + JOptionPane.showMessageDialog(mThisPosPrintSetupDialog, tUserInputNumberRequiredString, tUserInputTitleString, JOptionPane.INFORMATION_MESSAGE); // returning true means the screen didn't pass user input validation return true; } if (tAddlCopiesInt < 0 || tAddlCopiesInt > 3) { - JOptionPane.showMessageDialog(mParentFrame, tUserInputValidRange0to3String, + JOptionPane.showMessageDialog(mThisPosPrintSetupDialog, tUserInputValidRange0to3String, tUserInputTitleString, JOptionPane.INFORMATION_MESSAGE); // returning true means the screen didn't pass user input validation return true; Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-16 21:46:41 UTC (rev 108) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-17 01:53:21 UTC (rev 109) @@ -8,18 +8,17 @@ */ public class PosPrintSetupDialogChoices { - private final int mPrintFormatIsPclDirect = 1; - private final int mPrintFormatIsGdiDriver = 2; + public static final int mPrintFormatIsPclDirect = 1; + public static final int mPrintFormatIsGdiDriver = 2; - private final int mPrintOrderAsDisplayedOrSelected = 1; - private final int mPrintOrderLegalFirstThenLetter = 2; - private final int mPrintOrderLetterFirstThenLegal = 3; + public static final int mPrintOrderAsDisplayedOrSelected = 1; + public static final int mPrintOrderLegalFirstThenLetter = 2; + public static final int mPrintOrderLetterFirstThenLegal = 3; // TODO Add code to take the defaults from the user options in the Preferences, instead of the below initializations private PrintService mSelectedPrintService = null; private int mNumAdditionalCopies = 0; private int mPrintFormat = mPrintFormatIsGdiDriver; - private boolean mShouldPrintBarCodes = false; private int mPrintOrder = mPrintOrderAsDisplayedOrSelected; private boolean mShouldPrintFormNames = false; private boolean mShouldDuplex = false; @@ -45,9 +44,6 @@ public boolean isPrintFormatGdiDriver() { return (mPrintFormat == mPrintFormatIsGdiDriver); } - public boolean shouldPrintBarCodes() { - return mShouldPrintBarCodes; - } public boolean isPrintOrderAsDisplayedOrSelected() { return (mPrintOrder == mPrintOrderAsDisplayedOrSelected); } @@ -86,9 +82,6 @@ public void setPrintFormatIsGdiDriver() { mPrintFormat = mPrintFormatIsGdiDriver; } - public void setShouldPrintBarCodes(boolean yesOrNo) { - mShouldPrintBarCodes = yesOrNo; - } public void setPrintOrderAsDisplayedOrSelected() { mPrintOrder = mPrintOrderAsDisplayedOrSelected; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-16 22:12:43
|
Revision: 107 http://openpcl.svn.sourceforge.net/openpcl/?rev=107&view=rev Author: documentsystems Date: 2007-07-16 14:39:24 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Howard Hoagland. Made the call to setRenderingHints(g2D) be conditional. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-07-16 21:38:20 UTC (rev 106) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-07-16 21:39:24 UTC (rev 107) @@ -41,6 +41,7 @@ private static final String sCantAllocate = "Can't allocate memory for temporary image used for printing."; private double mPrintScale = 72.0d / 300.0d; // making width and height using 72 / 300 scale private double mShrinkLegalToLetterScale = mPrintScale * (11.0d / 14.0d); // shrink in both directions height 14" to 11" + private boolean mShouldSetRendingHints = false; // Printing looks the same on paper if rending hints are set or not public PosPrintBufferedImage(PosView pPosView) { super(); @@ -89,7 +90,7 @@ // Cast passed in Graphics to Graphics2D Graphics2D g2D = (Graphics2D)pGraphics; // Set rendering hints - setRenderingHints(g2D); + if (mShouldSetRendingHints) { setRenderingHints(g2D); } // Set background color white g2D.setBackground(Color.WHITE); // Make drawing text and rectangles and pixels be in black This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-16 21:46:39
|
Revision: 108 http://openpcl.svn.sourceforge.net/openpcl/?rev=108&view=rev Author: documentsystems Date: 2007-07-16 14:46:41 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Howard Hoagland. Added more PrintRequestAttributeSet items Chromaticity, PrinterResolution. Changed PrintQuallity from HIGH to DRAFT. When printing the force legal size image on letter paper, the left edge was missing vertical lines, so changed MediaPrintableArea from (0.2f, 0.2f, 8.1f 13.6f) to (0.18f, 0.18f, 8.14f, 13.64f). Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-16 21:39:24 UTC (rev 107) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-16 21:46:41 UTC (rev 108) @@ -27,12 +27,16 @@ import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.ResolutionSyntax; import javax.print.attribute.Size2DSyntax; +import javax.print.attribute.standard.Chromaticity; +import javax.print.attribute.standard.JobKOctets; import javax.print.attribute.standard.JobName; import javax.print.attribute.standard.MediaPrintableArea; import javax.print.attribute.standard.MediaSize; import javax.print.attribute.standard.OrientationRequested; import javax.print.attribute.standard.PrintQuality; +import javax.print.attribute.standard.PrinterResolution; import javax.print.attribute.standard.Sides; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -658,11 +662,14 @@ // Set the default choices on the print dialog for portrait, Legal, one sided, print job name, 4 margins mPrintRequestAttributeSet = new HashPrintRequestAttributeSet(); mPrintRequestAttributeSet.add(OrientationRequested.PORTRAIT); - mPrintRequestAttributeSet.add(PrintQuality.HIGH); + mPrintRequestAttributeSet.add(PrintQuality.DRAFT); // (before this was "HIGH") mPrintRequestAttributeSet.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH)); mPrintRequestAttributeSet.add(Sides.ONE_SIDED); + mPrintRequestAttributeSet.add(Chromaticity.MONOCHROME); + mPrintRequestAttributeSet.add(new PrinterResolution(300, 300, ResolutionSyntax.DPI)); + mPrintRequestAttributeSet.add(new JobKOctets((int)(1.3 * 1024))); // each page is 1.3 MB mPrintRequestAttributeSet.add(new JobName(getAppName() + " print", Locale.getDefault())); - mPrintRequestAttributeSet.add(new MediaPrintableArea(0.20f, 0.20f, 8.1f, 13.6f, MediaPrintableArea.INCH)); + mPrintRequestAttributeSet.add(new MediaPrintableArea(0.18f, 0.18f, 8.14f, 13.64f, MediaPrintableArea.INCH)); // Print Setup Defaults dialog and Print dialog (same dialog for both defaults and per print) mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-16 21:39:57
|
Revision: 106 http://openpcl.svn.sourceforge.net/openpcl/?rev=106&view=rev Author: documentsystems Date: 2007-07-16 14:38:20 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Howard Hoagland. Moved the initial instantiation of PrintRequestAttributeSet from PosPrintPages to OpenPCLViewer, so deleted import statements for setting PrintRequestAttributeSet items. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-10 02:09:57 UTC (rev 105) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-16 21:38:20 UTC (rev 106) @@ -11,22 +11,13 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.Locale; import javax.print.DocFlavor; import javax.print.DocPrintJob; import javax.print.PrintException; import javax.print.PrintService; import javax.print.SimpleDoc; -import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; -import javax.print.attribute.Size2DSyntax; -import javax.print.attribute.standard.JobName; -import javax.print.attribute.standard.MediaPrintableArea; -import javax.print.attribute.standard.MediaSize; -import javax.print.attribute.standard.OrientationRequested; -import javax.print.attribute.standard.PrintQuality; -import javax.print.attribute.standard.Sides; import javax.swing.BorderFactory; import javax.swing.JDialog; import javax.swing.JOptionPane; @@ -457,7 +448,7 @@ // Set the Pageable Interface object on the PrinterJob. // Note that this Pageable Interface object has the Printable Interface object set in it from above mPrinterJob.setPageable(mPosPrintPageableInterface); - + try { // Set the user selected printer on the PrinterJob mPrinterJob.setPrintService(mPrintService); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |