Revision: 20321
          http://sourceforge.net/p/jmol/code/20321
Author:   hansonr
Date:     2015-02-23 03:16:31 +0000 (Mon, 23 Feb 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.3.12_2015.02.23"

new feature: show image CLOSE                 # "all" presumed 
new feature: show image CLOSE ""              # the model image
new feature: show image CLOSE "c:/temp/t.bmp" # the image for this file

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/io/JmolUtil.java
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/viewer/FileManager.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/StatusManager.java
    trunk/Jmol/src/org/jmol/viewer/Viewer.java

Modified: trunk/Jmol/src/org/jmol/io/JmolUtil.java
===================================================================
--- trunk/Jmol/src/org/jmol/io/JmolUtil.java    2015-02-22 22:49:07 UTC (rev 
20320)
+++ trunk/Jmol/src/org/jmol/io/JmolUtil.java    2015-02-23 03:16:31 UTC (rev 
20321)
@@ -716,7 +716,7 @@
       createImage = true;
     }
     if (createImage)
-      image = apiPlatform.createImage(fullPathNameOrBytes);
+      image = apiPlatform.createImage("\1close".equals(fullPathNameOrBytes) ? 
"\1close" + echoName : fullPathNameOrBytes);
 
     /**
      * @j2sNative

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-02-22 22:49:07 UTC 
(rev 20320)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-02-23 03:16:31 UTC 
(rev 20321)
@@ -3285,7 +3285,7 @@
       isImage = PT.isOneOf(type.toLowerCase(), JC.IMAGE_OR_SCENE);
       if (isImage && isShow && fileName == null) {
         isShow = false;
-        fileName = "\1write " +  type;
+        fileName = "\1";
       }
       if (scripts != null) {
         if (type.equals("PNG"))
@@ -3576,7 +3576,7 @@
       if (token != null)
         tok = token.tok;
     }
-    if (tok != T.symop && tok != T.state && tok != T.property)
+    if (tok != T.symop && tok != T.state && tok != T.property && tok != 
T.image)
       checkLength(-3);
     if (slen == 2 && str.indexOf("?") >= 0) {
       showString(vwr.getAllSettings(str.substring(0, str.indexOf("?"))));
@@ -3588,11 +3588,22 @@
         msg = ((SV) eval.theToken).escape();
       break;
     case T.image:
-      eval.checkLength23();
+      if (slen == 2 && !chk) {
+        write(null);
+        return;
+      }
+      String fileName = eval.optParameterAsString(2);
+      boolean isClose = false;
+      if (fileName.equalsIgnoreCase("close")) {
+        eval.checkLength(-4);
+        isClose = true;
+        fileName = (slen == 3 ? "none" : eval.optParameterAsString(3));
+      } else {
+        eval.checkLength23();
+      }
       len = st.length;
-      String fileName = eval.optParameterAsString(2);
       if (!chk)
-        vwr.fm.loadImage(fileName, "\1" + fileName);
+        vwr.fm.loadImage(len == 2 ? null : isClose ? "\1close" : fileName, 
"\1" + fileName);
       str = null;
       break;
     case T.domains:

Modified: trunk/Jmol/src/org/jmol/viewer/FileManager.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/FileManager.java     2015-02-22 22:49:07 UTC 
(rev 20320)
+++ trunk/Jmol/src/org/jmol/viewer/FileManager.java     2015-02-23 03:16:31 UTC 
(rev 20321)
@@ -902,6 +902,10 @@
     Object image = null;
     String nameOrError = null;
     byte[] bytes = null;
+    if ("\1close".equals(nameOrBytes)) {
+      vwr.loadImageData(null, "\1close", echoName, null);
+      return;
+    }
     if (nameOrBytes instanceof Map) {
       nameOrBytes = (((Map<String, Object>) nameOrBytes).containsKey("_DATA_") 
? ((Map<String, Object>) nameOrBytes)
           .get("_DATA_") : ((Map<String, Object>) nameOrBytes).get("_IMAGE_"));
@@ -915,8 +919,8 @@
       bytes = ((BArray) nameOrBytes).data;
     } else if (echoName == null || nameOrBytes instanceof String){
       String[] names = getClassifiedName((String) nameOrBytes, true);
-      nameOrError = (names == null ? "cannot read file name: " + nameOrBytes
-          : names[0].replace('\\', '/'));
+        nameOrError = (names == null ? "cannot read file name: " + nameOrBytes
+            : names[0].replace('\\', '/'));
       if (names != null)
         image = jmb.getImage(vwr, nameOrError, echoName);
     } else {

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-02-22 22:49:07 UTC 
(rev 20320)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-02-23 03:16:31 UTC 
(rev 20321)
@@ -15,8 +15,14 @@
 TODO: remove HTML5 dependency on synchronous file loading (check SCRIPT 
command for problems)
 TODO: implement SHOW IMAGE in JavaScript/Browser 
 
-Jmol.___JmolVersion="14.3.12_2015.02.22d"
+Jmol.___JmolVersion="14.3.12_2015.02.23"
 
+new feature: show image CLOSE                 # "all" presumed 
+new feature: show image CLOSE ""              # the model image
+new feature: show image CLOSE "c:/temp/t.bmp" # the image for this file
+
+JmolVersion="14.3.12_2015.02.22d"
+
 bug fix: restriction against getting SMILES string for biomolecule lifted
 bug fix: end-on bonds may appear to disappear
 bug fix: JavaScript -2.format("%8.3") gives 2.000 not -2.000

Modified: trunk/Jmol/src/org/jmol/viewer/StatusManager.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/StatusManager.java   2015-02-22 22:49:07 UTC 
(rev 20320)
+++ trunk/Jmol/src/org/jmol/viewer/StatusManager.java   2015-02-23 03:16:31 UTC 
(rev 20321)
@@ -373,18 +373,19 @@
     if (imageMap == null)
       imageMap = new Hashtable<String, JmolImageDialog>();
     JmolImageDialog d = imageMap.get(title);
-    System.out.println("statusma1n " + d + " " + image);
+    if (Boolean.FALSE.equals(image)) {
+      if (d != null)
+        d.closeMe();
+      return;
+    }
     if (d == null && image != null)
       d = vwr.apiPlatform.getImageDialog(title, imageMap);
-    System.out.println("statusman2 " + d + " " + image);
     if (d == null)
       return;
     if (image == null)
       d.closeMe();
     else
       d.setImage(image);
-    System.out.println("statusman done");
-
   }
   
   synchronized void setFileLoadStatus(String fullPathName, String fileName,

Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Viewer.java  2015-02-22 22:49:07 UTC (rev 
20320)
+++ trunk/Jmol/src/org/jmol/viewer/Viewer.java  2015-02-23 03:16:31 UTC (rev 
20321)
@@ -7986,12 +7986,14 @@
    */
   void loadImageData(Object image, String nameOrError, String echoName,
                      ScriptContext sc) {
-    if (image == null && !"\1none".equalsIgnoreCase(echoName))
+    boolean isClose = ("\1close".equalsIgnoreCase(nameOrError));
+    if (image == null && !"\1none".equalsIgnoreCase(echoName) &&  
+        nameOrError != null && !isClose)
       scriptEcho(nameOrError);
     if (echoName == null) {
       setBackgroundImage((image == null ? null : nameOrError), image);
     } else if (echoName.startsWith("\1")){
-      sm.showImage(echoName.substring(1), image);
+      sm.showImage(echoName.substring(1), (isClose ? Boolean.FALSE : image));
     } else {
       shm.loadShape(JC.SHAPE_ECHO);
       setShapeProperty(JC.SHAPE_ECHO, "text", nameOrError);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to