From: Miguel <mig...@us...> - 2004-11-22 16:17:25
|
Update of /cvsroot/jmol/Jmol/src/org/openscience/jmol/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13903/src/org/openscience/jmol/app Modified Files: PovrayDialog.java Log Message: Hacked povray so that it uses double quotes iff necessary for Win32 Index: PovrayDialog.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/openscience/jmol/app/PovrayDialog.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- PovrayDialog.java 22 Nov 2004 06:01:32 -0000 1.21 +++ PovrayDialog.java 22 Nov 2004 16:17:15 -0000 1.22 @@ -47,6 +47,8 @@ import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.border.TitledBorder; +import javax.swing.JComponent; +import javax.swing.InputVerifier; import java.io.FileNotFoundException; import java.io.File; @@ -145,6 +147,14 @@ updateCommandLine(); } }); + saveField.setInputVerifier(new InputVerifier() { + public boolean verify(JComponent component) { + JTextField fld = (JTextField)component; + basename = fld.getText(); + updateCommandLine(); + return true; + } + }); saveBox.add(saveField); justSavingBox.add(saveBox); @@ -923,32 +933,32 @@ commandLine = povrayPath + - " +I\"" + savePath + basename + ".pov\""; + " +I" + doubleQuoteIfContainsSpace(savePath + basename + ".pov"); // Output format options + String outputExtension = ".tga"; + String outputFileType = " +FT"; if ((outputFormatBox != null) && (outputFormatBox.isSelected())) { switch (outputFormatCombo.getSelectedIndex()) { case 0: // Compressed TARGA - commandLine += - " +O\"" + savePath + basename + ".tga\"" + " +FC"; + outputFileType = " +FC"; break; case 1: // PNG - commandLine += - " +O\"" + savePath + basename + ".png\"" + " +FN"; + outputExtension = ".png"; + outputFileType = " +FN"; break; case 2: // PPM - commandLine += - " +0\"" + savePath + basename + ".ppm\"" + " +FP"; + outputExtension = ".ppm"; + outputFileType = " +FP"; break; default: // Uncompressed TARGA - commandLine += - " +O\"" + savePath + basename + ".tga\"" + " +FT"; break; } - } else { - commandLine += - " +O\"" + savePath + basename + ".tga\"" + " +FT"; } + commandLine += + " +O" + + doubleQuoteIfContainsSpace(savePath + basename + outputExtension) + + outputFileType; // Output alpha options if ((outputAlphaBox != null) && (outputAlphaBox.isSelected())) { @@ -1047,4 +1057,10 @@ Jmol.getHistoryFile().addProperties(props); } + String doubleQuoteIfContainsSpace(String str) { + for (int i = str.length(); --i >= 0; ) + if (str.charAt(i) == ' ') + return "\"" + str + "\""; + return str; + } } |