From: <doc...@us...> - 2007-12-05 05:29:09
|
Revision: 199 http://openpcl.svn.sourceforge.net/openpcl/?rev=199&view=rev Author: documentsystems Date: 2007-12-04 21:29:14 -0800 (Tue, 04 Dec 2007) Log Message: ----------- Howard Hoagland. If an initial PCL file name is specified from an Applet's html file or from the command line, changed to not upper case and not lower case (just leave the same case) the filename so it tries to open the file in the same exact case (could be camel case too). Modified Paths: -------------- openpcl/src/com/openpcl/viewer/options/PosStartupOptions.java Modified: openpcl/src/com/openpcl/viewer/options/PosStartupOptions.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosStartupOptions.java 2007-12-05 05:27:26 UTC (rev 198) +++ openpcl/src/com/openpcl/viewer/options/PosStartupOptions.java 2007-12-05 05:29:14 UTC (rev 199) @@ -73,7 +73,7 @@ * Then as the constructors of the various classes are being executed at program startup time, these values are checked * to alter which features are to be shown on the screen or not.<br> * - * @author DocMagic, Document Systems Inc, Howard 1/4/07 + * @author DocMagic, Document Systems Inc, Howard Hoagland 1/4/07 * */ public class PosStartupOptions { @@ -181,25 +181,33 @@ public void parseCommandLineOptions(String[] pArgs) { if (pArgs == null || pArgs.length < 1) { return; } String commandLineArg; + String optionString; String argValueString; boolean argTrueFalse; int locOfEquals; for (int i = 0; i < pArgs.length; i++) { - // Get each command line arg and trim and convert to lower case - commandLineArg = pArgs[i].trim().toLowerCase(); + // Get each command line arg. + // Don't convert to lower case or upper case here, keep the original case in "commandLineArg" + commandLineArg = pArgs[i].trim(); // if resulting string is empty string then continue to the next command line arg if (commandLineArg.length() < 1) {continue;} + // Make the optionString be the lower case of the complete string for the "startsWith()" checks below + optionString = commandLineArg.toLowerCase(); // find out the index location of the "=" in the command line arg locOfEquals = commandLineArg.indexOf('='); + // Set "argValueString" null here for each arg because some may have the "=X" and some will be just the option without a "=X" argValueString = null; argTrueFalse = true; // Default to true because some users might omit the =true/false if (locOfEquals >= 0) { // The "=" was found so assign the remaining chars if (locOfEquals <= commandLineArg.length() - 2) { - argValueString = commandLineArg.substring(locOfEquals + 1).toUpperCase(); - if (argValueString.charAt(0) == 'F' || argValueString.charAt(0) == 'N') { - // If F or N then make it false, otherwise, leave it true + // Don't make "argValueString" upper or lower case here, leave it the same case + // so that -OpenFile=c:/dir/dir/FileName.ext below will have the same case file name instead of made lower or upper case + argValueString = commandLineArg.substring(locOfEquals + 1); + char trueFalseYesNoChar = argValueString.charAt(0); + if (trueFalseYesNoChar == 'F' || trueFalseYesNoChar == 'N' || trueFalseYesNoChar == 'f' || trueFalseYesNoChar == 'n') { + // If F or N or f or n then make it false, otherwise, leave it true argTrueFalse = false; } } @@ -207,9 +215,9 @@ // Booleans about the Toolbar only - if (commandLineArg.startsWith("-showtoolbar")) { + if (optionString.startsWith("-showtoolbar")) { mShowToolbar = argTrueFalse; - } else if (commandLineArg.startsWith("-hidealltoolbarbuttons")) { + } else if (optionString.startsWith("-hidealltoolbarbuttons")) { mHideAllToolbarButtons = argTrueFalse; if (argTrueFalse == true) { mShowFileOpenToolbarButton = false; @@ -232,70 +240,70 @@ // Booleans to show/hide individual toolbar buttons - } else if (commandLineArg.startsWith("-showfileopentoolbarbutton")) { + } else if (optionString.startsWith("-showfileopentoolbarbutton")) { mShowFileOpenToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showclosefiletoolbarbutton")) { + } else if (optionString.startsWith("-showclosefiletoolbarbutton")) { mShowCloseFileToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showcloseallfilestoolbarbutton")) { + } else if (optionString.startsWith("-showcloseallfilestoolbarbutton")) { mShowCloseAllFilesToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showprinttoolbarbutton")) { + } else if (optionString.startsWith("-showprinttoolbarbutton")) { mShowPrintToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showpreviouspagetoolbarbutton")) { + } else if (optionString.startsWith("-showpreviouspagetoolbarbutton")) { mShowPreviousPageToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-shownextpagetoolbarbutton")) { + } else if (optionString.startsWith("-shownextpagetoolbarbutton")) { mShowNextPageToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showtreecontroltoolbarbutton")) { + } else if (optionString.startsWith("-showtreecontroltoolbarbutton")) { mShowTreeControlToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showzoomouttoolbarbutton")) { + } else if (optionString.startsWith("-showzoomouttoolbarbutton")) { mShowZoomOutToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showzoomintoolbarbutton")) { + } else if (optionString.startsWith("-showzoomintoolbarbutton")) { mShowZoomInToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showzoomslidertoolbarbutton")) { + } else if (optionString.startsWith("-showzoomslidertoolbarbutton")) { mShowZoomSliderToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showzoomwidthtoolbarbutton")) { + } else if (optionString.startsWith("-showzoomwidthtoolbarbutton")) { mShowZoomWidthToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showsavetopcltoolbarbutton")) { + } else if (optionString.startsWith("-showsavetopcltoolbarbutton")) { mShowSaveToPclToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showchangelooktoolbarbutton")) { + } else if (optionString.startsWith("-showchangelooktoolbarbutton")) { mShowChangeLookToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showwindowcontroltoolbarbutton")) { + } else if (optionString.startsWith("-showwindowcontroltoolbarbutton")) { mShowWindowControlToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showoptionstoolbarbutton")) { + } else if (optionString.startsWith("-showoptionstoolbarbutton")) { mShowOptionsToolbarButton = argTrueFalse; - } else if (commandLineArg.startsWith("-showhelpchoicestoolbarbutton")) { + } else if (optionString.startsWith("-showhelpchoicestoolbarbutton")) { mShowHelpChoicesToolbarButton = argTrueFalse; // Booleans other than toolbar related - } else if (commandLineArg.startsWith("-showpagestree")) { + } else if (optionString.startsWith("-showpagestree")) { mShowPagesTree = argTrueFalse; - } else if (commandLineArg.startsWith("-showstatusbar")) { + } else if (optionString.startsWith("-showstatusbar")) { mShowStatusbar = argTrueFalse; - } else if (commandLineArg.startsWith("-changelook")) { + } else if (optionString.startsWith("-changelook")) { mChangeLook = argTrueFalse; - } else if (commandLineArg.startsWith("-showdsmlprintdialogbuttons")) { + } else if (optionString.startsWith("-showdsmlprintdialogbuttons")) { mShowDSMLPrintDialogButtons = argTrueFalse; - } else if (commandLineArg.startsWith("-showfilenameonviewtitlebar")) { + } else if (optionString.startsWith("-showfilenameonviewtitlebar")) { mShowFileNameOnViewTitleBar = argTrueFalse; - } else if (commandLineArg.equalsIgnoreCase("-help") || - commandLineArg.equalsIgnoreCase("-h") || commandLineArg.equalsIgnoreCase("-?")) { + } else if (optionString.equalsIgnoreCase("-help") || + optionString.equalsIgnoreCase("-h") || optionString.equalsIgnoreCase("-?")) { mShowCommandLineOptionsHelpText = true; // Booleans about debug or demo mode - } else if (commandLineArg.startsWith("-showembeddeddemo")) { + } else if (optionString.startsWith("-showembeddeddemo")) { mShowEmbeddedDemo = argTrueFalse; mModeToRun = sModeToRunEmbedded; - } else if (commandLineArg.startsWith("-showdebugrastercolors")) { + } else if (optionString.startsWith("-showdebugrastercolors")) { mShowDebugRasterColors = argTrueFalse; PriDebug.setBlueAndGreenRaster(mShowDebugRasterColors); - } else if (commandLineArg.startsWith("-writedebuglog")) { + } else if (optionString.startsWith("-writedebuglog")) { mWriteDebugLog = argTrueFalse; if (mWriteDebugLog) { PriDebug.setDebugVersion(); } // Strings - } else if (commandLineArg.startsWith("-openfile")) { - mOpenFile = argValueString.toLowerCase(); + } else if (optionString.startsWith("-openfile")) { + mOpenFile = argValueString; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |