Revision: 18686
          http://sourceforge.net/p/jmol/code/18686
Author:   hansonr
Date:     2013-09-22 23:12:37 +0000 (Sun, 22 Sep 2013)
Log Message:
-----------
___JmolVersion="13.3.6_dev_2013.09.22"

new feature: CAPTURE command
    -- application and signed applet only (no JS)
    -- creates animated GIF
    -- uses ANIMATION MODE to determine looping 
      -- both PALINDROME and LOOP create looping; ONCE (default) does not
    -- uses ANIMATION FPS to determine play-back rate.
    CAPTURE "filename" 
      -- starts capturing
    CAPTURE "filename" ROTATE x|y|z degrees
      -- does a clean rocking of the molecule about one of the three major axes
      -- axis and degrees optional; y 5 assumed
      -- based on: rotate Y 10 10;delay 2.0; rotate Y -10 -10; delay 2.0;rotate 
Y -10 -10; delay 2.0;rotate Y 10 10;delay 2.0 
    CAPTURE off/on
      -- temporarily disables/enables capturing
    CAPTURE "" or just CAPTURE 
      -- end capturing

code: overhaul of image creation methods

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/api/JmolStateCreator.java
    trunk/Jmol/src/org/jmol/awt/LocalOutputChannel.java
    trunk/Jmol/src/org/jmol/awtjs2d/JSPopup.java
    trunk/Jmol/src/org/jmol/awtjs2d/WebOutputChannel.java
    trunk/Jmol/src/org/jmol/popup/GenericPopup.java
    trunk/Jmol/src/org/jmol/popup/JmolAbstractMenu.java
    trunk/Jmol/src/org/jmol/popup/JmolPopup.java
    trunk/Jmol/src/org/jmol/popup/MainPopupResourceBundle.java
    trunk/Jmol/src/org/jmol/popup/SwingPopup.java
    trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java
    trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/StateCreator.java
    trunk/Jmol/src/org/jmol/viewer/Viewer.java

Added Paths:
-----------
    trunk/Jmol/src/org/jmol/api/JmolOutputChannel.java

Added: trunk/Jmol/src/org/jmol/api/JmolOutputChannel.java
===================================================================
--- trunk/Jmol/src/org/jmol/api/JmolOutputChannel.java                          
(rev 0)
+++ trunk/Jmol/src/org/jmol/api/JmolOutputChannel.java  2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -0,0 +1,7 @@
+package org.jmol.api;
+
+public interface JmolOutputChannel {
+
+  String getFileName();
+  
+}

Modified: trunk/Jmol/src/org/jmol/api/JmolStateCreator.java
===================================================================
--- trunk/Jmol/src/org/jmol/api/JmolStateCreator.java   2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/api/JmolStateCreator.java   2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -1,7 +1,5 @@
 package org.jmol.api;
 
-import java.io.OutputStream;
-
 import java.util.Map;
 
 import org.jmol.modelset.Group;
@@ -85,7 +83,7 @@
   String writeFileData(String fileName, String type, 
                         int modelIndex, Object[] parameters);
 
-  OutputStream getOutputStream(String localName, String[] fullPath);
+  JmolOutputChannel getOutputStream(String localName, String[] fullPath);
 
   void openFileAsync(String fileName, boolean pdbCartoons);
 

Modified: trunk/Jmol/src/org/jmol/awt/LocalOutputChannel.java
===================================================================
--- trunk/Jmol/src/org/jmol/awt/LocalOutputChannel.java 2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/awt/LocalOutputChannel.java 2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -4,6 +4,8 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 
+import org.jmol.api.JmolOutputChannel;
+
 /**
  * 
  * A wrapper for FileOutputStream, allowing debugging.
@@ -11,10 +13,14 @@
  *  
  */
 
-public class LocalOutputChannel extends FileOutputStream {
+public class LocalOutputChannel extends FileOutputStream implements 
JmolOutputChannel {
  
-  public String fileName;
+  private String fileName;
   
+  public String getFileName() {
+    return fileName;
+  }
+  
   public LocalOutputChannel(String fileName) throws FileNotFoundException {
     super(fileName);    
     this.fileName = fileName;

Modified: trunk/Jmol/src/org/jmol/awtjs2d/JSPopup.java
===================================================================
--- trunk/Jmol/src/org/jmol/awtjs2d/JSPopup.java        2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/awtjs2d/JSPopup.java        2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -372,6 +372,17 @@
      */
     {
     }
+    
   }
 
+  public void updateSpecialMenuItem(Object m) {
+    /**
+     * @j2sNative
+     * 
+     *          m.setText(this.getSpecialLabel(m.getName(), m.getText()));
+     */
+    {}    
+  }
+
+
 }

Modified: trunk/Jmol/src/org/jmol/awtjs2d/WebOutputChannel.java
===================================================================
--- trunk/Jmol/src/org/jmol/awtjs2d/WebOutputChannel.java       2013-09-22 
20:22:18 UTC (rev 18685)
+++ trunk/Jmol/src/org/jmol/awtjs2d/WebOutputChannel.java       2013-09-22 
23:12:37 UTC (rev 18686)
@@ -2,6 +2,7 @@
 
 import java.io.ByteArrayOutputStream;
 
+import org.jmol.api.JmolOutputChannel;
 import org.jmol.util.SB;
 
 /**
@@ -12,9 +13,14 @@
  *  
  */
 
-public class WebOutputChannel extends ByteArrayOutputStream {
+public class WebOutputChannel extends ByteArrayOutputStream  implements 
JmolOutputChannel {
  
   private String fileName;
+  
+  public String getFileName() {
+    return fileName;
+  }
+  
   private SB sb;
   
   public WebOutputChannel(String fileName) {

Modified: trunk/Jmol/src/org/jmol/popup/GenericPopup.java
===================================================================
--- trunk/Jmol/src/org/jmol/popup/GenericPopup.java     2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/popup/GenericPopup.java     2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -26,6 +26,7 @@
 import org.jmol.api.JmolPopupInterface;
 import org.jmol.i18n.GT;
 import org.jmol.i18n.Language;
+import org.jmol.script.T;
 import org.jmol.util.BS;
 import org.jmol.util.Elements;
 import org.jmol.util.Escape;
@@ -97,6 +98,7 @@
   private JmolList<Object> AppletOnly = new JmolList<Object>();
   private JmolList<Object> ChargesOnly = new JmolList<Object>();
   private JmolList<Object> TemperatureOnly = new JmolList<Object>();
+  private JmolList<Object> Special = new JmolList<Object>();
 
   private boolean allowSignedFeatures;
   private boolean isJS;
@@ -395,31 +397,31 @@
   }
 
   private void updateFileTypeDependentMenus() {
-    for (int i = 0; i < NotPDB.size(); i++)
+    for (int i = NotPDB.size(); --i >= 0;)
       menuEnable(NotPDB.get(i), !isPDB);
-    for (int i = 0; i < PDBOnly.size(); i++)
+    for (int i = PDBOnly.size(); --i >= 0;)
       menuEnable(PDBOnly.get(i), isPDB);
-    for (int i = 0; i < UnitcellOnly.size(); i++)
+    for (int i = UnitcellOnly.size(); --i >= 0;)
       menuEnable(UnitcellOnly.get(i), isUnitCell);
-    for (int i = 0; i < FileUnitOnly.size(); i++)
+    for (int i = FileUnitOnly.size(); --i >= 0;)
       menuEnable(FileUnitOnly.get(i), isUnitCell || fileHasUnitCell);
-    for (int i = 0; i < FileMolOnly.size(); i++)
+    for (int i = FileMolOnly.size(); --i >= 0;)
       menuEnable(FileMolOnly.get(i), isUnitCell || fileHasUnitCell);
-    for (int i = 0; i < SingleModelOnly.size(); i++)
+    for (int i = SingleModelOnly.size(); --i >= 0;)
       menuEnable(SingleModelOnly.get(i), isLastFrame);
-    for (int i = 0; i < FramesOnly.size(); i++)
+    for (int i = FramesOnly.size(); --i >= 0;)
       menuEnable(FramesOnly.get(i), isMultiFrame);
-    for (int i = 0; i < VibrationOnly.size(); i++)
+    for (int i = VibrationOnly.size(); --i >= 0;)
       menuEnable(VibrationOnly.get(i), isVibration);
-    for (int i = 0; i < SymmetryOnly.size(); i++)
+    for (int i = SymmetryOnly.size(); --i >= 0;)
       menuEnable(SymmetryOnly.get(i), isSymmetry && isUnitCell);
-    for (int i = 0; i < SignedOnly.size(); i++)
+    for (int i = SignedOnly.size(); --i >= 0;)
       menuEnable(SignedOnly.get(i), isSigned || !isApplet);
-    for (int i = 0; i < AppletOnly.size(); i++)
+    for (int i = AppletOnly.size(); --i >= 0;)
       menuEnable(AppletOnly.get(i), isApplet);
-    for (int i = 0; i < ChargesOnly.size(); i++)
+    for (int i = ChargesOnly.size(); --i >= 0;)
       menuEnable(ChargesOnly.get(i), haveCharges);
-    for (int i = 0; i < TemperatureOnly.size(); i++)
+    for (int i = TemperatureOnly.size(); --i >= 0;)
       menuEnable(TemperatureOnly.get(i), haveBFactors);
   }
 
@@ -528,6 +530,8 @@
       }
       if (item.startsWith("SIGNED"))
         SignedOnly.addLast(newMenu);
+      if (item.indexOf("SPECIAL") >= 0)
+        Special.addLast(newMenu);
 
       if (dumpList) {
         String str = item.endsWith("Menu") ? "----" : id + "." + item + "\t"
@@ -1228,6 +1232,8 @@
     updateSceneComputedMenu();
     updateModelSetComputedMenu();
     updateAboutSubmenu();
+    for (int i = Special.size(); --i >= 0;)
+      updateSpecialMenuItem(Special.get(i));
   }
 
   private void setFrankMenu(String id) {
@@ -1272,4 +1278,28 @@
       menuShowPopup(popupMenu, thisx, thisy);
   }
 
+  /**
+   * menus or menu items with SPECIAL in their name are sent here for 
on-the-fly labeling
+   *  
+   * @param name
+   * @param text
+   * @return revised text
+   */
+  protected String getSpecialLabel(String name, String text) {
+    int pt = text.indexOf(" (");
+    if (pt < 0)
+      pt = text.length();
+    String info = null;
+    if (name.indexOf("captureLooping") >= 0)
+      info = (viewer.getAnimationReplayMode().name().equals("ONCE") ? "ONCE"
+          : "LOOP");
+    else if (name.indexOf("captureFps") >= 0)
+      info = "" + viewer.getInt(T.animationfps);
+    else if (name.indexOf("captureMenu") >= 0)
+       info = (viewer.captureParams == null ? GT._("not capturing") : 
viewer.getFilePath((String)viewer.captureParams.get("captureFileName"), true) 
+           + " " + viewer.captureParams.get("captureCount"));
+    return (info == null ? text : text.substring(0, pt) + " (" + info + ")");
+  }
+
+
 }

Modified: trunk/Jmol/src/org/jmol/popup/JmolAbstractMenu.java
===================================================================
--- trunk/Jmol/src/org/jmol/popup/JmolAbstractMenu.java 2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/popup/JmolAbstractMenu.java 2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -34,4 +34,7 @@
   void   menuSetListeners();
   void   menuShowPopup(Object popup, int x, int y);
  
+  void updateSpecialMenuItem(Object menu);
+
+
 }

Modified: trunk/Jmol/src/org/jmol/popup/JmolPopup.java
===================================================================
--- trunk/Jmol/src/org/jmol/popup/JmolPopup.java        2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/popup/JmolPopup.java        2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -50,4 +50,5 @@
     GT.setDoTranslate(doTranslate);
   }
 
+
 }

Modified: trunk/Jmol/src/org/jmol/popup/MainPopupResourceBundle.java
===================================================================
--- trunk/Jmol/src/org/jmol/popup/MainPopupResourceBundle.java  2013-09-22 
20:22:18 UTC (rev 18685)
+++ trunk/Jmol/src/org/jmol/popup/MainPopupResourceBundle.java  2013-09-22 
23:12:37 UTC (rev 18686)
@@ -208,8 +208,11 @@
       {   "fileMenu",
           "SIGNEDloadFileOrUrl SIGNEDloadPdb SIGNEDloadScript - "
               + "reload SIGNEDloadFileUnitCell - "
-              + "writeFileTextVARIABLE writeState writeHistory SIGNEDwriteJmol 
SIGNEDwriteIsosurface - SIGNEDJAVAwriteGif SIGNEDNOGLwriteJpg 
SIGNEDNOGLwritePng SIGNEDNOGLwritePngJmol SIGNEDJAVAwritePovray - "
+              + "writeFileTextVARIABLE writeState writeHistory SIGNEDwriteJmol 
SIGNEDwriteIsosurface " +
+                       "- SIGNEDJAVAcaptureMenuSPECIAL " +
+                       "- SIGNEDJAVAwriteGif SIGNEDNOGLwriteJpg 
SIGNEDNOGLwritePng SIGNEDNOGLwritePngJmol SIGNEDJAVAwritePovray - "
               + "SIGNEDJAVAwriteVrml SIGNEDJAVAwriteX3d SIGNEDJAVAwriteIdtf 
SIGNEDJAVAwriteMaya" },
+      {    "SIGNEDJAVAcaptureMenuSPECIAL", "SIGNEDJAVAcaptureBegin 
SIGNEDJAVAcaptureEnd SIGNEDJAVAcaptureOff SIGNEDJAVAcaptureOn 
SIGNEDJAVAcaptureFpsSPECIAL SIGNEDJAVAcaptureLoopingSPECIAL" },
 
       { "[set_spin_X]Menu", "s0 s5 s10 s20 s30 s40 s50" },
       { "[set_spin_Y]Menu", null },
@@ -488,7 +491,15 @@
       { "SIGNEDloadFileOrUrl", "load ?" },      
       { "SIGNEDloadFileUnitCell", "load ? {1 1 1}" },      
       { "SIGNEDloadScript", "script ?.spt" },      
-
+      
+      { "SIGNEDJAVAcaptureBegin", "capture '?Jmol.gif'" },      
+      { "SIGNEDJAVAcaptureEnd", "capture ''"},      
+      { "SIGNEDJAVAcaptureOff", "capture off"},      
+      { "SIGNEDJAVAcaptureOn", "capture on"},      
+      { "SIGNEDJAVAcaptureFpsSPECIAL", "animation fps @{0+prompt('Capture 
replay frames per second?', getProperty('animationInfo.animationFPS'))}"},      
+      { "SIGNEDJAVAcaptureLoopingSPECIAL", "script inline @{\"animation mode 
\"+(getProperty('animationinfo.animationReplayMode')=='ONCE' ? 
'LOOP':'ONCE');prompt('capture looping set to ' + 
getProperty('animationinfo.animationReplayMode')}"},
+      
+      
       { "writeFileTextVARIABLE", "if (_applet && !_signedApplet) { 
console;show file } else { write file \"?FILE?\"}" },      
       { "writeState", "if (_applet && !_signedApplet) { console;show state } 
else { write state \"?FILEROOT?.spt\"}" },      
       { "writeHistory", "if (_applet && !_signedApplet) { console;show history 
} else { write history \"?FILEROOT?.his\"}" },     
@@ -896,20 +907,28 @@
         "SIGNEDloadFileUnitCell", GT._("Load full unit cell"),      
         "SIGNEDloadScript", GT._("Open script"),      
 
+        "SIGNEDJAVAcaptureMenuSPECIAL", GT._("Capture"),
+        "SIGNEDJAVAcaptureBegin", GT._("Start capturing"),
+        "SIGNEDJAVAcaptureEnd", GT._("End capturing"),
+        "SIGNEDJAVAcaptureOff", GT._("Disable capturing"),
+        "SIGNEDJAVAcaptureOn", GT._("Re-enable capturing"),
+        "SIGNEDJAVAcaptureFpsSPECIAL", GT._("Set capture replay rate"),
+        "SIGNEDJAVAcaptureLoopingSPECIAL", GT._("Toggle capture looping"),
+        
         "writeFileTextVARIABLE", GT._("Save a copy of {0}"),
         "writeState", GT._("Save script with state"),      
         "writeHistory", GT._("Save script with history"),      
-        "SIGNEDwriteJpg", GT._("Export {0} image", "JPG"),      
-        "SIGNEDwritePng", GT._("Export {0} image", "PNG"),      
-        "SIGNEDwritePngJmol", GT._("Export {0} image", "PNG+JMOL"),      
-        "SIGNEDwriteGif", GT._("Export {0} image", "GIF"),    
-        "SIGNEDwritePovray", GT._("Export {0} image", "POV-Ray"),      
+        "SIGNEDNOGLwriteJpg", GT._("Export {0} image", "JPG"),      
+        "SIGNEDNOGLwritePng", GT._("Export {0} image", "PNG"),      
+        "SIGNEDNOGLwritePngJmol", GT._("Export {0} image", "PNG+JMOL"),      
+        "SIGNEDJAVAwriteGif", GT._("Export {0} image", "GIF"),    
+        "SIGNEDJAVAwritePovray", GT._("Export {0} image", "POV-Ray"),      
         "SIGNEDwriteJmol", GT._("Save all as JMOL file (zip)"),      
         "SIGNEDwriteIsosurface", GT._("Save JVXL isosurface"),      
-        "SIGNEDwriteVrml", GT._("Export {0} 3D model", "VRML"),      
-        "SIGNEDwriteX3d", GT._("Export {0} 3D model", "X3D"),      
-        "SIGNEDwriteIdtf", GT._("Export {0} 3D model", "IDTF"),      
-        "SIGNEDwriteMaya", GT._("Export {0} 3D model", "Maya"),      
+        "SIGNEDJAVAwriteVrml", GT._("Export {0} 3D model", "VRML"),      
+        "SIGNEDJAVAwriteX3d", GT._("Export {0} 3D model", "X3D"),      
+        "SIGNEDJAVAwriteIdtf", GT._("Export {0} 3D model", "IDTF"),      
+        "SIGNEDJAVAwriteMaya", GT._("Export {0} 3D model", "Maya"),      
 
         "computationMenu", GT._("Computation"),      
         "minimize", GT._("Optimize structure"),      

Modified: trunk/Jmol/src/org/jmol/popup/SwingPopup.java
===================================================================
--- trunk/Jmol/src/org/jmol/popup/SwingPopup.java       2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/popup/SwingPopup.java       2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -83,6 +83,11 @@
       b.setActionCommand(script);
   }
 
+  public void updateSpecialMenuItem(Object menuItem) {
+    AbstractButton m = (AbstractButton) menuItem;
+    m.setText(getSpecialLabel(m.getName(), m.getText()));
+  }
+
   private Object newMenuItem(JMenuItem jmi, Object menu, String entry,
                              String script, String id) {
     updateButton(jmi, entry, script);    

Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -9446,7 +9446,7 @@
               viewer.getFilePath(filename, false)))
         invArg();
       String[] fullPath = new String[] { localName };
-      os = viewer.getOutputStream(localName, fullPath);
+      os = (OutputStream) viewer.getOutputStream(localName, fullPath);
       if (os == null)
         Logger.error("Could not create output stream for " + fullPath[0]);
       else
@@ -14511,7 +14511,7 @@
       default:
         invArg();
       }
-      if (type.equals("IMAGE") || type.equals("FRAME")
+      if (type.equals("IMAGE") || type.equals("(image)") || 
type.equals("FRAME")
           || type.equals("VIBRATION")) {
         type = (fileName != null && fileName.indexOf(".") >= 0 ? fileName
             .substring(fileName.lastIndexOf(".") + 1).toUpperCase() : "JPG");

Modified: trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java     2013-09-22 
20:22:18 UTC (rev 18685)
+++ trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java     2013-09-22 
23:12:37 UTC (rev 18686)
@@ -1840,7 +1840,7 @@
         SV.listValue(args[1]) : null);
     boolean asButtons = (buttonArray != null || args.length == 1 || 
args.length == 3 && args[2].asBoolean());
     String input = (buttonArray != null ? null : args.length >= 2 ? 
SV.sValue(args[1]) : "OK");
-    String s = viewer.prompt(label, input, buttonArray, asButtons);
+    String s = "" + viewer.prompt(label, input, buttonArray, asButtons);
     return (asButtons && buttonArray != null ? addXInt(Integer.parseInt(s) + 
1) : addXStr(s));
   }
 
@@ -3049,7 +3049,7 @@
       case T.integer:
         switch (x2.tok) {
         case T.string:
-          if ((s = (SV.sValue(x2)).trim()).indexOf(".") < 0
+          if ((s = SV.sValue(x2).trim()).indexOf(".") < 0
               && s.indexOf("+") <= 0 && s.lastIndexOf("-") <= 0)
             return addXInt(x1.intValue + x2.asInt());
           break;

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -32,6 +32,7 @@
 
 code: overhaul of image creation methods
 
+bug fix: write IMAGE "t.png" not working
 bug fix: rotate -10 -10 not working
 
 code: code merge between 13.2 and 13.3   18 Sept 2013

Modified: trunk/Jmol/src/org/jmol/viewer/StateCreator.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/StateCreator.java    2013-09-22 20:22:18 UTC 
(rev 18685)
+++ trunk/Jmol/src/org/jmol/viewer/StateCreator.java    2013-09-22 23:12:37 UTC 
(rev 18686)
@@ -35,6 +35,7 @@
 import java.util.Map;
 
 import org.jmol.api.JmolImageCreatorInterface;
+import org.jmol.api.JmolOutputChannel;
 import org.jmol.api.JmolScriptEditorInterface;
 import org.jmol.api.JmolScriptFunction;
 import org.jmol.api.JmolStateCreator;
@@ -2026,9 +2027,8 @@
     // localName will be fileName only if we are able to write to disk.
     String localName = null;
     if (!isClip) {
-      if (captureMode != Integer.MIN_VALUE && captureMode != T.movie) {
-        localName = fileName = "";
-        doCheck = false;
+      if (captureMode != Integer.MIN_VALUE) {
+        doCheck = false; // will be checked later
         mustRender = false;
       }
       if (doCheck)
@@ -2084,11 +2084,12 @@
               case T.movie:
                 if (cparams != null)
                   ((OutputStream) cparams.get("outputStream")).close();
-                os = getOutputStream(localName, null);
+                os = (OutputStream) getOutputStream(localName, null);
                 if (os == null) {
                   ret = msg = "ERROR: capture canceled";
                   viewer.captureParams = null;
                 } else {
+                  localName = ((JmolOutputChannel) os).getFileName();
                   msg = type + "_STREAM_OPEN " + localName;
                   viewer.captureParams = params;
                   params.put("captureFileName", localName);
@@ -2114,18 +2115,24 @@
                   case T.on:
                   case T.off:
                     params = cparams;
-                    params.put("captureEnabled", (captureMode == T.on ? 
Boolean.TRUE : Boolean.FALSE));
-                    ret = type + "_STREAM_" + (captureMode == T.on ? "ON" : 
"OFF");
+                    params.put("captureEnabled",
+                        (captureMode == T.on ? Boolean.TRUE : Boolean.FALSE));
+                    ret = type + "_STREAM_"
+                        + (captureMode == T.on ? "ON" : "OFF");
                     params.put("captureMode", Integer.valueOf(T.add));
                     break;
                   case T.end:
                   case T.cancel:
                     params = cparams;
                     params.put("captureMode", Integer.valueOf(captureMode));
+                    fileName = (String) params.get("captureFileName");
                     msg = type + "_STREAM_"
                         + (captureMode == T.end ? "CLOSE " : "CANCEL ")
                         + params.get("captureFileName");
                     viewer.captureParams = null;
+                    viewer.prompt(GT._("Capture") + ": " + (captureMode == 
T.cancel ? GT
+                        ._("canceled") : GT._("{0} saved",
+                        new Object[] { fileName })), "OK", null, true);
                   }
                   break;
                 }
@@ -2141,7 +2148,8 @@
               viewer.statusManager.createImage((String) ret, type, null, null,
                   quality);
             if (msg != null)
-              viewer.showString(msg + " (" + params.get("captureByteCount") + 
" bytes)", false);
+              viewer.showString(msg + " (" + params.get("captureByteCount")
+                  + " bytes)", false);
           }
         }
         if (ret instanceof byte[])
@@ -2415,7 +2423,7 @@
   public String writeFileData(String fileName, String type, 
                               int modelIndex, Object[] parameters) {
     String[] fullPath = new String[1];
-    OutputStream os = getOutputStream(fileName, fullPath);
+    OutputStream os = (OutputStream) getOutputStream(fileName, fullPath);
     if (os == null)
       return "";
     fileName = fullPath[0];
@@ -2460,7 +2468,7 @@
     return msg;
   }
 
-  public OutputStream getOutputStream(String fileName, String[] fullPath) {
+  public JmolOutputChannel getOutputStream(String fileName, String[] fullPath) 
{
     if (!viewer.isRestricted(ACCESS.ALL))
       return null;
     fileName = getOutputFileNameFromDialog(fileName, Integer.MIN_VALUE);
@@ -2470,7 +2478,7 @@
       fullPath[0] = fileName;
     String localName = (FileManager.isLocal(fileName) ? fileName : null);
     try {
-      return (OutputStream) viewer.openOutputChannel(privateKey, localName, 
false);
+      return (JmolOutputChannel) viewer.openOutputChannel(privateKey, 
localName, false);
     } catch (IOException e) {
       Logger.info(e.toString());
       return null;

Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Viewer.java  2013-09-22 20:22:18 UTC (rev 
18685)
+++ trunk/Jmol/src/org/jmol/viewer/Viewer.java  2013-09-22 23:12:37 UTC (rev 
18686)
@@ -48,6 +48,7 @@
 
 import org.jmol.adapter.smarter.SmarterJmolAdapter;
 import org.jmol.api.JmolNMRInterface;
+import org.jmol.api.JmolOutputChannel;
 import org.jmol.api.JmolPopupInterface;
 import org.jmol.api.ApiPlatform;
 import org.jmol.api.AtomIndexIterator;
@@ -135,7 +136,6 @@
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.io.Reader;
 import java.io.StringReader;
 
@@ -8662,7 +8662,7 @@
   // image and file export
   // ///////////////////////////////////////////////////////////////
 
-  public OutputStream getOutputStream(String localName, String[] fullPath) {
+  public JmolOutputChannel getOutputStream(String localName, String[] 
fullPath) {
     // called by Script LOAD AS  and ISOSURFACE AS  options 
     return getStateCreator().getOutputStream(localName, fullPath);
   }

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


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&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