From: <doc...@us...> - 2007-09-14 00:17:28
|
Revision: 170 http://openpcl.svn.sourceforge.net/openpcl/?rev=170&view=rev Author: documentsystems Date: 2007-09-13 17:17:27 -0700 (Thu, 13 Sep 2007) Log Message: ----------- Howard Hoagland. I changed 4 classes (OpenPCLViewer, PosView, PosWindowControlList, PosStatusBar) to move the full file path and file name from the JInternalFrame title bar to a subpanel in the status bar. Since there is only one status bar for several possible open files, I added code to update the file path and file name in the status bar every time the user clicks to a differernt open file or uses the toolbar icon to switch views. Also I changed 3 classes (IOpenPCL, PosToolBar, OpenPCLViewer) to include a hidden feature to execute code to show hidden white text "Signer Tags" that are in the PCL bytes to view, and draw the hidden text in black instead of in white to show the hidden text on the screen, upon a Control-Click on the Options button in the toolbar. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java openpcl/src/com/openpcl/viewer/api/IOpenPCL.java openpcl/src/com/openpcl/viewer/panels/PosView.java openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java openpcl/src/com/openpcl/viewer/statusbar/PosStatusBar.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-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-09-14 00:17:27 UTC (rev 170) @@ -1227,7 +1227,8 @@ mPosViewSelected = pPosView; double tZoomFactor = mPosViewSelected.getPosZoomLogic().getCurrentZoomFactor(); showZoomFactorOnToolbarButton(tZoomFactor); - PriDebug.releaseln(mPosViewSelected.getPageNameForTitleBar()); + mPosStatusBar.setFileNameText(mPosViewSelected.getFilePathAndFileName()); + PriDebug.releaseln(mPosViewSelected.getPageNameForTitleBar() + ", " + mPosViewSelected.getFilePathAndFileName()); } } @@ -1244,6 +1245,8 @@ // There is only one JInternalFrame showing now and when this one closes, then none will be showing // so write the JInternalFrame's (x,y) and (width, height) and last opened file to the local client platform savePersistedViewValues(pPosView.getJInternalFrame(), mPackagePreferences, mPosPersistViewValues); + mPosStatusBar.setFileNameText("File name"); + mPosStatusBar.setCursorPixelLocationText(""); mPosManageToolBar.setNoViewsOpen(); } } @@ -1330,7 +1333,7 @@ // Update the zoom slider and pass false to not allow recursive event screen updating mPosZoomSlider.setZoomSliderLocationFromZoomFactor(pZoomFactor, false); } - + /** Get the current view window width */ public int getCurrentViewWindowWidth() { if (mPosViewSelected != null && mPosViewSelected.getIsMultiPageParseFinished()) { @@ -1423,7 +1426,7 @@ 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(); + return pPosTreeNode.toString() + ", " + getPosViewSelected().getFilePathAndFileName(); } /** Returns true if this tree node page must print on the front side (not on the back of a page) when duplexing. @@ -1454,7 +1457,7 @@ tErrorString = tPosView.getPclRenderImage().getLastRenderErrorString(); if (tErrorString != null) { return tErrorString ; } - tPosView.setBaseNameOnJInternalFrameTitleBar(pLongName); + tPosView.setFilePathAndFileName(pLongName); // Make sure max views hasn't been reached int tLowestIndex = findLowestIndexAvailableView(); @@ -2440,9 +2443,14 @@ } /** Show the Options dialog */ - public void actionShowOptionsDialog() { - mPosUserOptionsDialog.setLocationRelativeTo(getAppFrame()); - mPosUserOptionsDialog.setVisible(true); + public void actionShowOptionsDialog(boolean pControlKeyPressed) { + if (!pControlKeyPressed) { + mPosUserOptionsDialog.setLocationRelativeTo(getAppFrame()); + mPosUserOptionsDialog.setVisible(true); + } else { + // Hidden feature. If the Control key is pressed when clicking this button, then toggle show/hide to see white text + // by redrawing the text in black, only if the text starts with the specified text. Also draw a box around the now visible txt. + } } /** Toggle show/hide the help choices popup */ Modified: openpcl/src/com/openpcl/viewer/api/IOpenPCL.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-09-14 00:17:27 UTC (rev 170) @@ -250,7 +250,7 @@ public void actionCascadeWindows(); /** Show the Options dialog */ - public void actionShowOptionsDialog(); + public void actionShowOptionsDialog(boolean pControlKeyPressed); /** Toggle show/hide the print choices popup */ public void actionShowHideHelpChoicesPopup(); Modified: openpcl/src/com/openpcl/viewer/panels/PosView.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-09-14 00:17:27 UTC (rev 170) @@ -55,7 +55,7 @@ private PosPrintPages mPosPrintPages =null; private PosBuildListOfPagesToPrint mPosBuildListOfPagesToPrint = null; private String mShortName = null; - private String mBaseNameOnJInternalFrameTitleBar = null; + private String mFilePathAndFileName = null; private String mChangingPartNameOnJInternalFrameTitleBar = null; private StringBuffer mToStringStringBuffer = null; private PosTreeNode mCurrentTreeNode = null; @@ -362,35 +362,24 @@ return PosView.sDefaultSplitterLocPclFiles; } - public String getBaseNameOnJInternalFrameTitleBar() { return mBaseNameOnJInternalFrameTitleBar; } - - public void setBaseNameOnJInternalFrameTitleBar(String pBaseNameOnJInternalFrameTitleBar) { - mBaseNameOnJInternalFrameTitleBar = pBaseNameOnJInternalFrameTitleBar; - } + public String getFilePathAndFileName() { return mFilePathAndFileName; } + public void setFilePathAndFileName(String pFilePathAndFileName) { mFilePathAndFileName = pFilePathAndFileName; } public String toString() { mToStringStringBuffer = new StringBuffer(100); - mToStringStringBuffer.append("View #" + mViewNumber + "."); + mToStringStringBuffer.append("View #" + mViewNumber); if (mShortName != null && mShortName.length() > 0) { - mToStringStringBuffer.append(" " + mShortName); + mToStringStringBuffer.append(", " + mShortName); } return mToStringStringBuffer.toString(); } public String getPageNameForTitleBar() { mToStringStringBuffer = new StringBuffer(100); - if (mOpenPCLViewer.getPosStartupOptions().getShowFileNameOnViewTitleBar()) { - mToStringStringBuffer.append("View #" + mViewNumber + "."); - if (mBaseNameOnJInternalFrameTitleBar != null && mBaseNameOnJInternalFrameTitleBar.length() > 0) { - mToStringStringBuffer.append(" " + mBaseNameOnJInternalFrameTitleBar); - } - } + mToStringStringBuffer.append("View #" + mViewNumber); if (mChangingPartNameOnJInternalFrameTitleBar != null && mChangingPartNameOnJInternalFrameTitleBar.length() > 0) { - if (mOpenPCLViewer.getPosStartupOptions().getShowFileNameOnViewTitleBar()) { - mToStringStringBuffer.append(", "); - } - mToStringStringBuffer.append(mChangingPartNameOnJInternalFrameTitleBar); + mToStringStringBuffer.append(", " + mChangingPartNameOnJInternalFrameTitleBar); } return mToStringStringBuffer.toString(); } Modified: openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java 2007-09-14 00:17:27 UTC (rev 170) @@ -141,16 +141,16 @@ return -1; } - /* Parse the String that looks like "View# 1. filename.ext" to the int which is the view number */ + /* Parse the String that looks like "View# 1, filename.ext" to the int which is the view number */ private int getViewNumberFromString(String pViewString) { if (pViewString == null) { return -1; } // if null passed then return -1 meaning view number not found int tLocOfPoundsign = pViewString.indexOf("#"); // Find the # in the string if (tLocOfPoundsign >= 0) { - int tLocOfPeriod = pViewString.indexOf(".", tLocOfPoundsign); // Find the . after the # - if (tLocOfPeriod >= 0) { + int tLocEnd = pViewString.indexOf(",", tLocOfPoundsign); // Find the , after the # + if (tLocEnd >= 0) { // Pull out the substring that is only the view number - String tViewNumberString = pViewString.substring( tLocOfPoundsign + 1, tLocOfPeriod); + String tViewNumberString = pViewString.substring( tLocOfPoundsign + 1, tLocEnd); try { int tViewNumber = Integer.parseInt(tViewNumberString); // Convert to int if (tViewNumber > 0) { Modified: openpcl/src/com/openpcl/viewer/statusbar/PosStatusBar.java =================================================================== --- openpcl/src/com/openpcl/viewer/statusbar/PosStatusBar.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/statusbar/PosStatusBar.java 2007-09-14 00:17:27 UTC (rev 170) @@ -21,12 +21,14 @@ // Panels private JPanel mStatusBarMsgsJPanel = null; private JPanel mZoomSliderJPanel = null; + private JPanel mOnScreenZoomSliderJPanel = new JPanel(); + private JPanel mFileNameJPanel = null; private JPanel mCursorPixelLocationJPanel = null; - private JPanel mOnScreenZoomSliderJPanel = new JPanel(); // Text labels private JLabel mStatusTextLineJLabel = null; private JLabel mCursorLocationJLabel = null; + private JLabel mFileNameJLabel = null; // TableLayout private double mTloPref = TableLayout.PREFERRED; @@ -52,16 +54,27 @@ // One liner getters public String getStatusBarText() { return mStatusTextLineJLabel.getText(); } + public String getFileNameJLabelText() { return mFileNameJLabel.getText(); } public String getCursorPixelLocationText() { return mCursorLocationJLabel.getText(); } public JPanel getOnScreenZoomSliderJPanel() { return mOnScreenZoomSliderJPanel; } // One liner setters public void setStatusBarText(String pText) { mStatusTextLineJLabel.setText(pText); } - public void setCursorPixelLocationText(String pText) { mCursorLocationJLabel.setText(pText); } + public void setFileNameJLabel(String pText) { mFileNameJLabel.setText(pText); } + + public void setCursorPixelLocationText(String pText) { + mCursorLocationJLabel.setText(pText); + adjustCursorPixelLocationPanelSize(); + } public void setDefaultStatusBarMsg() { mStatusTextLineJLabel.setText(""); } + + public void setFileNameText(String pFileNameString) { + setFileNameJLabel(pFileNameString); + adjustFileNamePanelSize(); + } public void setMouseMoveLocation(int pViewNum, int pXPixel, int pYPixel, double pXInches, double pYInches) { String tPixelLocationString = "View #" + pViewNum + ". " + @@ -75,7 +88,8 @@ private void buildUI() { mStatusTextLineJLabel = new JLabel(""); setDefaultStatusBarMsg(); - + + mFileNameJLabel = new JLabel("File name"); mCursorLocationJLabel = new JLabel(""); mStatusBarMsgsJPanel = makeStatusLineMsgsPanel(); @@ -84,23 +98,29 @@ } mCursorPixelLocationJPanel = makeCursorPixelLocationPanel(); + mFileNameJPanel = makeFileNamePanel(); TableLayout tloLayout = null; - double tloGridSpecWithZoomPanel[][] = new double[][] {{mTloFill, mTloPref, mTloPref}, {mTloFill }}; - double tloGridSpecWithoutZoomPanel[][] = new double[][] {{mTloFill, mTloPref}, {mTloFill }}; + double tloGridSpecWithZoomPanel[][] = new double[][] {{mTloFill, mTloPref, mTloPref, mTloPref}, {mTloFill }}; + double tloGridSpecWithoutZoomPanel[][] = new double[][] {{mTloFill, mTloPref, mTloPref}, {mTloFill }}; if (mWantZoomSliderPanel) { tloLayout = new TableLayout(tloGridSpecWithZoomPanel); setLayout(tloLayout); add("0,0", mStatusBarMsgsJPanel); add("1,0", mZoomSliderJPanel); - add("2,0", mCursorPixelLocationJPanel); + add("2,0", mFileNameJPanel); + add("3,0", mCursorPixelLocationJPanel); } else { tloLayout = new TableLayout(tloGridSpecWithoutZoomPanel); setLayout(tloLayout); add("0,0", mStatusBarMsgsJPanel); - add("1,0", mCursorPixelLocationJPanel); + add("1,0", mFileNameJPanel); + add("2,0", mCursorPixelLocationJPanel); } + + adjustFileNamePanelSize(); + adjustCursorPixelLocationPanelSize(); } private JPanel makeStatusLineMsgsPanel() { @@ -122,11 +142,21 @@ panel.add("0,0", mOnScreenZoomSliderJPanel); return panel; } + + private JPanel makeFileNamePanel() { + JPanel panel = new JPanel(); + setStatusBarSectionAttributes(panel); + double tloGridSpec[][] = new double[][] {{mTloPref}, {mTloPref }}; + TableLayout tloLayout = new TableLayout(tloGridSpec); + panel.setLayout(tloLayout); + panel.add("0,0", mFileNameJLabel); + return panel; + } + private JPanel makeCursorPixelLocationPanel() { JPanel panel = new JPanel(); setStatusBarSectionAttributes(panel); - adjustCursorPixelLocationPanelSize(); double tloGridSpec[][] = new double[][] {{mTloPref}, {mTloPref }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); @@ -143,12 +173,23 @@ BorderFactory.createEmptyBorder(1, 2, 0, 2))); } + private void adjustFileNamePanelSize() { + Font tJLabelFont = mFileNameJLabel.getFont(); + FontMetrics tJLabelFontMetrics = mFileNameJLabel.getFontMetrics(tJLabelFont); + mCursorLocationJLabel.setPreferredSize(new Dimension( + tJLabelFontMetrics.stringWidth(mFileNameJLabel.getText()), tJLabelFontMetrics.getHeight())); + } + public void adjustCursorPixelLocationPanelSize() { Font tJLabelFont = mCursorLocationJLabel.getFont(); FontMetrics tJLabelFontMetrics = mCursorLocationJLabel.getFontMetrics(tJLabelFont); - mCalculatedMaxWidthOfMouseLocationString = tJLabelFontMetrics.stringWidth( - "View #9. 9.99 x 99.99 inches (9999,9999)"); - mCursorLocationJLabel.setPreferredSize( - new Dimension(mCalculatedMaxWidthOfMouseLocationString, tJLabelFontMetrics.getHeight())); + if (mCursorLocationJLabel.getText().length() < 1) { + mCursorLocationJLabel.setPreferredSize(new Dimension(20, tJLabelFontMetrics.getHeight())); + } else { + mCalculatedMaxWidthOfMouseLocationString = tJLabelFontMetrics.stringWidth( + "View #9. 9.99 x 99.99 inches (9999,9999)"); + mCursorLocationJLabel.setPreferredSize( + new Dimension(mCalculatedMaxWidthOfMouseLocationString, tJLabelFontMetrics.getHeight())); + } } } Modified: openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java =================================================================== --- openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-09-14 00:17:27 UTC (rev 170) @@ -274,7 +274,13 @@ protected JButton createOptionsButton() { JButton tJButton = createToolBarButton("V221Options.png", "Options"); tJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) {mOpenPCLViewer.actionShowOptionsDialog();} + public void actionPerformed(ActionEvent e) { + if ((e.getModifiers() & ActionEvent.CTRL_MASK) > 1) { + mOpenPCLViewer.actionShowOptionsDialog(true); + } else { + mOpenPCLViewer.actionShowOptionsDialog(false); + } + } }); return tJButton; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |