From: <ha...@us...> - 2008-09-15 03:55:34
|
Revision: 9893 http://jmol.svn.sourceforge.net/jmol/?rev=9893&view=rev Author: hansonr Date: 2008-09-15 03:55:18 +0000 (Mon, 15 Sep 2008) Log Message: ----------- 11.6.RC15 VERSION # new feature: load menu items for signed applet # new feature: save menu items for signed applet # bug fix: applet -- setting a jmolScript callback prevents menu updates # new feature: minimize menu item # new feature: signed applet allows "load ?" and includes previewer # bug fix: H-M spacegroup designations specifying nonstandard Hall symbols by default # new feature: signed applet/application load ?xxx uses load dialog # webexport help updated to reflect ability to handle files opened with "load append" Modified Paths: -------------- trunk/Jmol/src/org/jmol/export/dialog/Dialog.java trunk/Jmol/src/org/jmol/export/dialog/FilePreview.java trunk/Jmol/src/org/jmol/popup/PopupResourceBundle.java trunk/Jmol/src/org/jmol/viewer/FileManager.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/export/dialog/Dialog.java =================================================================== --- trunk/Jmol/src/org/jmol/export/dialog/Dialog.java 2008-09-14 23:54:12 UTC (rev 9892) +++ trunk/Jmol/src/org/jmol/export/dialog/Dialog.java 2008-09-15 03:55:18 UTC (rev 9893) @@ -47,6 +47,7 @@ import org.jmol.api.JmolViewer; import org.jmol.i18n.GT; import org.jmol.util.Escape; +import org.jmol.util.TextFormat; import org.jmol.viewer.FileManager; public class Dialog extends JPanel implements JmolDialogInterface { @@ -87,11 +88,20 @@ openChooser.setDialogSize(historyFile.getWindowSize(windowName)); openChooser.setDialogLocation(historyFile.getWindowPosition(windowName)); } + - if (fileName != null && fileName.length() > 0) - openChooser.setSelectedFile(new File(fileName)); - if (fileName != null && fileName.indexOf(":") < 0) - openChooser.setCurrentDirectory(FileManager.getLocalDirectory(viewer)); + if (fileName != null) { + int pt = fileName.lastIndexOf("."); + String sType = fileName.substring(pt + 1); + if (pt >= 0 && sType.length() > 0) + openChooser.addChoosableFileFilter(new TypeFilter(sType)); + if (fileName.indexOf(".") == 0) + fileName = "Jmol" + fileName; + if (fileName.length() > 0) + openChooser.setSelectedFile(new File(fileName)); + if ( fileName.indexOf(":") < 0) + openChooser.setCurrentDirectory(FileManager.getLocalDirectory(viewer)); + } File file = null; if (openChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) file = openChooser.getSelectedFile(); @@ -101,7 +111,7 @@ if (historyFile != null) historyFile.addWindowInfo(windowName, openChooser.getDialog(), null); - String url = FileManager.getLocalUrl(file.getAbsolutePath()); + String url = getLocalUrl(file); if (url != null) { fileName = url; } else { @@ -113,6 +123,33 @@ return (doAppend ? "load append " + Escape.escape(fileName) : fileName); } + private final static String[] urlPrefixes = { + "http:", "http://", + "www.", "http://www.", + "https:", "https://", + "ftp:", "ftp://", + "file:", "file:///"}; + + private static String getLocalUrl(File file) { + // entering a url on a file input box will be accepted, + // but cause an error later. We can fix that... + // return null if there is no problem, the real url if there is + if (file.getName().startsWith("=")) + return file.getName(); + String path = file.getAbsolutePath().replace('\\', '/'); + for (int i = 0; i < urlPrefixes.length; i++) + if (path.indexOf(urlPrefixes[i]) == 0) + return null; + for (int i = 0; i < urlPrefixes.length; i += 2) + if (path.indexOf(urlPrefixes[i]) > 0) + return urlPrefixes[i + 1] + + TextFormat.trim(path.substring( + path.indexOf(urlPrefixes[i]) + urlPrefixes[i].length()) + , "/"); + return null; + } + + public String getSaveFileNameFromDialog(JmolViewer viewer, String fileName, String type) { if (saveChooser == null) Modified: trunk/Jmol/src/org/jmol/export/dialog/FilePreview.java =================================================================== --- trunk/Jmol/src/org/jmol/export/dialog/FilePreview.java 2008-09-14 23:54:12 UTC (rev 9892) +++ trunk/Jmol/src/org/jmol/export/dialog/FilePreview.java 2008-09-15 03:55:18 UTC (rev 9893) @@ -125,6 +125,7 @@ */ void updatePreview(File file) { if (file != null) { + //doesn't update from use input? display.getViewer().evalStringQuiet("load \"" + file.getAbsolutePath() + "\""); display.repaint(); } else { Modified: trunk/Jmol/src/org/jmol/popup/PopupResourceBundle.java =================================================================== --- trunk/Jmol/src/org/jmol/popup/PopupResourceBundle.java 2008-09-14 23:54:12 UTC (rev 9892) +++ trunk/Jmol/src/org/jmol/popup/PopupResourceBundle.java 2008-09-15 03:55:18 UTC (rev 9893) @@ -75,10 +75,10 @@ { "@AXESCOLOR", "gray salmon maroon olive slateblue gold orchid"}, { "popupMenu", - "modelSetMenu FRAMESbyModelComputedMenu configurationComputedMenu - selectMenuText viewMenu renderMenu colorMenu - surfaceMenu SYMMETRYUNITCELLMenu - " + "modelSetMenu SIGNEDloadMenu SIGNEDwriteMenu FRAMESbyModelComputedMenu configurationComputedMenu - selectMenuText viewMenu renderMenu colorMenu - surfaceMenu SYMMETRYUNITCELLMenu - " + "zoomMenu spinMenu VIBRATIONMenu " + "FRAMESanimateMenu - " - + "measureMenu pickingMenu - JVM12showConsole JVM12showMenu SIGNEDwriteMenu - " + + "measureMenu pickingMenu - JVM12showConsole JVM12showMenu - " + "languageComputedMenu aboutComputedMenu" }, { "selectMenuText", @@ -212,8 +212,11 @@ + "showSpacegroup showState SYMMETRYshowSymmetry UNITCELLshow - showIsosurface showMo - extractMOL" }, + { "SIGNEDloadMenu", + "loadPdb loadFileOrURL loadFileUnitCell - loadScript" }, + { "SIGNEDwriteMenu", - "writeFileTextVARIABLE writeState writeHistory writeIsosurface - writeJpg writePng - writePovray writeVrml writeMaya" }, + "writeFileTextVARIABLE writeState writeHistory - writeJpg writePng writePovray - writeIsosurface writeVrml writeMaya" }, { "[set_spin_X]Menu", "s0 s5 s10 s20 s30 s40 s50" }, @@ -476,6 +479,12 @@ { "showOrient", "console on;show orientation" }, { "showSpacegroup", "console on;show spacegroup" }, { "showState", "console on;show state" }, + + { "loadPdb", "load ?=1crn" }, + { "loadFileOrURL", "load ?" }, + { "loadFileUnitCell", "load ? {1 1 1}" }, + { "loadScript", "script ?.spt" }, + { "writeFileTextVARIABLE", "write file \"?FILE?\"" }, { "writeState", "write state \"?FILEROOT?.spt\"" }, { "writeHistory", "write history \"?FILEROOT?.his\"" }, @@ -860,16 +869,22 @@ "SYMMETRYshowSymmetry", GT._("Symmetry"), "showState", GT._("Current state"), - "SIGNEDwriteMenu", GT._("Write"), + "SIGNEDloadMenu", GT._("Load"), + "loadPdb", GT._("Load PDB"), + "loadFileOrURL", GT._("Load file or URL"), + "loadFileUnitCell", GT._("Load full unit cell"), + "loadScript", GT._("Script"), + + "SIGNEDwriteMenu", GT._("Save"), "writeFileTextVARIABLE", GT._("File {0}"), - "writeState", GT._("State"), - "writeHistory", GT._("History"), - "writeIsosurface", GT._("Isosurface"), - "writeJpg", GT._("Image - JPG"), - "writePng", GT._("Image - PNG"), - "writePovray", "POV-Ray", - "writeVrml", GT._("VRML"), - "writeMaya", GT._("Maya"), + "writeState", GT._("SPT State"), + "writeHistory", GT._("SPT History"), + "writeJpg", GT._("{0} Image", "JPG"), + "writePng", GT._("{0} Image", "PNG"), + "writePovray", GT._("{0} Image", "POV-Ray"), + "writeIsosurface", GT._("JVXL Isosurface"), + "writeVrml", GT._("{0} 3D Model", "VRML"), + "writeMaya", GT._("{0} 3D Model", "Maya"), "UNITCELLshow", GT._("Unit cell"), Modified: trunk/Jmol/src/org/jmol/viewer/FileManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/FileManager.java 2008-09-14 23:54:12 UTC (rev 9892) +++ trunk/Jmol/src/org/jmol/viewer/FileManager.java 2008-09-15 03:55:18 UTC (rev 9893) @@ -515,18 +515,6 @@ return -1; } - public static String getLocalUrl(String path) { - // entering a url on a file input box will be accepted, - // but cause an error later. We can fix that... - // return null if there is no problem, the real url if there is - if (urlTypeIndex(path) < 0) - for (int i = 0; i < urlPrefixes.length; ++i) - if (path.indexOf(urlPrefixes[i]) >= 0) - return TextFormat.simpleReplace(path.substring(path.indexOf(urlPrefixes[i])) - .replace('\\', '/'), ":", ":/"); - return null; - } - private void setNames(String[] names) { if (names == null) return; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-09-14 23:54:12 UTC (rev 9892) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-09-15 03:55:18 UTC (rev 9893) @@ -1,16 +1,18 @@ # Developers: to add a description of changes you have made, # add it on a line starting with # below the "version=..." line -version=11.6.RC15_dev +version=11.6.RC15 +# new feature: load menu items for signed applet +# new feature: save menu items for signed applet # bug fix: applet -- setting a jmolScript callback prevents menu updates -# new feature: write menu items for signed applet # new feature: minimize menu item # new feature: signed applet allows "load ?" and includes previewer # bug fix: H-M spacegroup designations specifying nonstandard Hall symbols by default # new feature: signed applet/application load ?xxx uses load dialog # webexport help updated to reflect ability to handle files opened with "load append" + # ----------------------------------------------------------------------------- #version=11.6.RC14 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |