Revision: 20308
          http://sourceforge.net/p/jmol/code/20308
Author:   hansonr
Date:     2015-02-20 00:48:33 +0000 (Fri, 20 Feb 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.3.12_2015.02.19"

bug fix: "write image 500 500 png ?"   broken

NBO raw format

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/NBODialog.java
    trunk/Jmol/src/org/openscience/jmol/app/nbo/NBOService.java

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-02-18 22:57:53 UTC 
(rev 20307)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-02-20 00:48:33 UTC 
(rev 20308)
@@ -3149,7 +3149,7 @@
         tok = T.image;
         break;
       }
-      if (tok == T.image) {
+      if (tok == T.image && pt < args.length) {
         T t = T.getTokenFromName(SV.sValue(args[pt]).toLowerCase());
         if (t != null) {
           type = SV.sValue(t).toUpperCase();
@@ -3229,6 +3229,9 @@
         break;
       case T.clipboard:
         break;
+      case T.opIf:
+        fileName = (type.equals("IMAGE") || type.equals("(image)") ? 
"?jmol.png" : "?jmol." + type.toLowerCase());
+        break;
       case T.identifier:
       case T.string:
         fileName = SV.sValue(tokenAt(pt, args));
@@ -3237,6 +3240,7 @@
           fileName = null;
         break;
       default:
+        System.out.println(T.nameOf(tokAtArray(pt, args)));
         invArg();
       }
       if (type.equals("IMAGE") || type.equals("(image)")

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-02-18 22:57:53 UTC 
(rev 20307)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-02-20 00:48:33 UTC 
(rev 20308)
@@ -15,8 +15,12 @@
 TODO: remove HTML5 dependency on synchronous file loading (check SCRIPT 
command for problems)
 TODO: add 2D graphics panel for Ramachandran and NBO-style 2D graphics -- send 
to browser as data uri?
 
-Jmol.___JmolVersion="14.2.12_2015.02.18b"
+Jmol.___JmolVersion="14.3.12_2015.02.19"
 
+bug fix: "write image 500 500 png ?"   broken
+
+JmolVersion="14.3.12_2015.02.18b"
+
 bug fix: CML reader does not show proper atom names for crystal structures
 bug fix: POV-Ray renderer does not show proper backbone width (since forever)
 bug fix: POV-Ray renderer with a translucent surface shows bonds that should 
be hidden (since 13.1) 

Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/NBODialog.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/NBODialog.java    
2015-02-18 22:57:53 UTC (rev 20307)
+++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/NBODialog.java    
2015-02-20 00:48:33 UTC (rev 20308)
@@ -32,6 +32,7 @@
 import java.awt.Dimension;
 import java.awt.FlowLayout;
 import java.awt.Font;
+import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
@@ -48,6 +49,7 @@
 import javax.swing.JTabbedPane;
 import javax.swing.JTextField;
 import javax.swing.JTextPane;
+import javax.swing.SwingUtilities;
 import javax.swing.border.TitledBorder;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
@@ -72,17 +74,19 @@
 
   private JTextPane nboOutput;
 
-  private JScrollPane editPane2;
+  protected JScrollPane editPane2;
 
   private JTabbedPane inputTabs;
 
   private Component modelPanel;
 
+  private Component rawPanel;
+
   private Component viewPanel;
 
   private Component runPanel;
 
-  private JTextField modelField, viewField, runField;
+  private JTextField modelField, rawField, viewField, runField;
   
   private NBOService nboService;
 
@@ -151,6 +155,15 @@
     });
     buttonBox.add(b);
 
+    b = new JButton("Clear");
+    b.addActionListener(new ActionListener() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        clearPressed();
+      }
+    });
+    buttonBox.add(b);
+
     b = new JButton("Close");
     b.addActionListener(new ActionListener() {
       @Override
@@ -213,6 +226,7 @@
     inputTabs.addTab("Model", null, modelPanel = getModelPanel());
     inputTabs.addTab("Run", null, runPanel = getRunPanel());
     inputTabs.addTab("View", null, viewPanel = getViewPanel());
+    inputTabs.addTab("Raw", null, rawPanel = getRawPanel());
     inputTabs.setSelectedComponent(modelPanel);
     inputTabs.addChangeListener(this);
     showPanel.add(inputTabs,  BorderLayout.CENTER);
@@ -230,7 +244,8 @@
     nboOutput = new JTextPane();
     nboOutput.setContentType("text/plain");
     nboOutput.setFont(new Font("Monospaced", Font.PLAIN, 10));
-    editPane2 = new JScrollPane(nboOutput);
+    editPane2 = new JScrollPane();
+    editPane2.getViewport().add(nboOutput);
     editPanel.add(editPane2);
 
     editPanel.setPreferredSize(new Dimension(500,100));
@@ -248,6 +263,7 @@
     Component c = inputTabs.getSelectedComponent();
     modelPanel.setVisible(c == modelPanel);
     viewPanel.setVisible(c == viewPanel);
+    rawPanel.setVisible(c == rawPanel);
     runPanel.setVisible(c == runPanel);
     pack();
   }
@@ -315,6 +331,27 @@
     return showPanel;
   }
 
+  private Component getRawPanel() {
+    rawField = new JTextField("");
+    rawField.setPreferredSize(new Dimension(100, 10));
+    rawField.addActionListener(new ActionListener() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        rawCmd();        
+      }}
+    );
+    JPanel showPanel = new JPanel(new BorderLayout());
+    Box a = Box.createVerticalBox();
+    Box b = Box.createHorizontalBox();
+    b.add(newLabel("Raw Command"));
+    b.add(rawField);
+    a.add(b);
+    a.add(Box.createVerticalGlue());
+    showPanel.add(a, BorderLayout.NORTH);
+    //showPanel.add(Box.createGlue(), BorderLayout.CENTER);
+    return showPanel;
+  }
+
   private Component newLabel(String label) {
     JTextField t = new JTextField(label);
     t.setEditable(false);
@@ -324,15 +361,6 @@
 
   /////////////////////////////////////////////////////////
 
-  public void nboReport(String s) {
-    nboOutput.setText(s == null ? "" : nboOutput.getText() + s + "\n");
-    try {
-      editPane2.getVerticalScrollBar().setValue(Integer.MAX_VALUE);
-    } catch (Exception e) {
-      //
-    }
-  }
-
   protected void modelCmd() {
     nboReport(null);
     Map<String, Object> info = new Hashtable<String, Object>();
@@ -351,7 +379,7 @@
     }
     info.put("value", cmd.substring(3));
     if (!nboService.processRequest(info)) {
-      clearInfo();
+      nboReport(null);
       nboReport("You must connect first.");
     }
   }
@@ -365,7 +393,7 @@
     String cmd = runField.getText();
     info.put("value", cmd);
     if (!nboService.processRequest(info)) {
-      clearInfo();
+      nboReport(null);
       nboReport("not implemented");
     }
   }
@@ -379,14 +407,29 @@
     String cmd = viewField.getText();
     info.put("value", cmd);
     if (!nboService.processRequest(info)) {
-      clearInfo();
+      nboReport(null);
       nboReport("not implemented");
     }
   }
   
+  protected void rawCmd() {
+    nboReport(null);
+    Map<String, Object> info = new Hashtable<String, Object>();
+    info.put("mode", Integer.valueOf(NBOService.RAW));
+    info.put("sync", Boolean.FALSE);
+    info.put("action", "cmd");
+    String cmd = rawField.getText();
+    rawField.setText("");
+    info.put("value", cmd);
+    if (!nboService.processRequest(info)) {
+      nboReport(null);
+      nboReport("not implemented");
+    }
+  }
+  
   protected void connectPressed() {
     nboService.closeProcess();
-    clearInfo();
+    nboReport(null);
     String err = nboService.startProcess(true); // synchronous? 
     if (err == null) {
       nboReport("listening...");
@@ -395,6 +438,10 @@
     }
   }
 
+  protected void clearPressed() {
+    nboReport(null);
+  }
+
   /**
    * Responds to cancel being press- or equivalent eg window closed.
    */
@@ -480,9 +527,21 @@
     //workingPathLabel.setText(nboService.workingPath);
   }
 
-  void clearInfo() {
-    nboOutput.setText("");
+  public synchronized void nboReport(String s) {
+    try {
+      nboOutput.setText(s == null ? "" : nboOutput.getText() + s + "\n");
+    } catch (Exception e) {
+      System.out.println(e);
+    }
+    try {
+      SwingUtilities.invokeLater(new Runnable(){
+        @Override
+        public void run() {
+          
editPane2.getVerticalScrollBar().setValue(editPane2.getVerticalScrollBar().getMaximum());
+        }});
+    } catch (Exception e) {
+      System.out.println(e);
+    }
   }
 
-  
 }

Modified: trunk/Jmol/src/org/openscience/jmol/app/nbo/NBOService.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/nbo/NBOService.java 2015-02-18 
22:57:53 UTC (rev 20307)
+++ trunk/Jmol/src/org/openscience/jmol/app/nbo/NBOService.java 2015-02-20 
00:48:33 UTC (rev 20308)
@@ -53,6 +53,7 @@
 
   public static final int VIEW = 3;
 
+  public static final int RAW = 4;
 
   private transient Viewer vwr;
   
@@ -135,6 +136,9 @@
     case VIEW:
       s = (String) info.get("value");
       break;
+    case RAW:
+      s = (String) info.get("value");
+      break;
     default:
       nboReport("unknown mode");
       s = null;
@@ -163,7 +167,7 @@
    * @param s
    */
   private void sendToNBO(int mode, String s) {
-    s = mode + "\n" + s + "\nexit" + (nboSync ? "\nexit" : "");
+    s = (mode == RAW ? s + "\n" : mode + "\n" + s + "\nexit" + (nboSync ? 
"\nexit" : ""));
     sendCmd(s);
   }
   

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