Revision: 20721
          http://sourceforge.net/p/jmol/code/20721
Author:   hansonr
Date:     2015-08-22 15:39:01 +0000 (Sat, 22 Aug 2015)
Log Message:
-----------
NBO integration merge

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/viewer/JC.java
    trunk/Jmol/src/org/jmol/viewer/StateCreator.java
    trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/GuiMap.java
    trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java
    
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/Properties/Jmol-resources.properties
    trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java

Modified: trunk/Jmol/src/org/jmol/viewer/JC.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/JC.java      2015-08-22 14:45:50 UTC (rev 
20720)
+++ trunk/Jmol/src/org/jmol/viewer/JC.java      2015-08-22 15:39:01 UTC (rev 
20721)
@@ -1009,13 +1009,6 @@
     return hAlignNames[(align >> TEXT_ALIGN_SHIFT) & 3];
   }
   
-  public static final int JSV_NOT = -1;
-  public static final int JSV_SEND_JDXMOL = 0;
-  public static final int JSV_SETPEAKS = 7;
-  public static final int JSV_SELECT = 14;
-  public static final int JSV_STRUCTURE = 21;
-  public static final int JSV_SEND_H1SIMULATE = 28;
-
   public static final int SMILES_EXPLICIT_H               = 0x001;
   public static final int SMILES_TOPOLOGY                 = 0x002;
   public static final int SMILES_NOAROMATIC               = 0x004;
@@ -1032,14 +1025,32 @@
 
 
 
+  public static final int JSV_NOT = -1;
+  public static final int JSV_SEND_JDXMOL = 0;
+  public static final int JSV_SETPEAKS = 7;
+  public static final int JSV_SELECT = 14;
+  public static final int JSV_STRUCTURE = 21;
+  public static final int JSV_SEND_H1SIMULATE = 28;
+  public static final int NBO_MODEL = 35;
+  public static final int NBO_RUN = 42;
+  public static final int NBO_VIEW = 49;
+  public static final int NBO_SEARCH = 56;
+  public static final int NBO_CONFIG = 63;
 
-  public static int getJSVSyncSignal(String script) {
+
+  public static int getServiceCommand(String script) {
     return (script.length() < 7 ? -1 : ("" +
-               "JSPECVI" +
-               "PEAKS: " +
-               "SELECT:" +
-               "JSVSTR:" +
-               "H1SIMUL")
+        "JSPECVI" +
+        "PEAKS: " +
+        "SELECT:" +
+        "JSVSTR:" +
+        "H1SIMUL" +
+        "NBO:MOD" +
+        "NBO:RUN" +
+        "NBO:VIE" +
+        "NBO:SEA" +
+        "NBO:CON"
+        )
         .indexOf(script.substring(0, 7).toUpperCase()));
   }
 

Modified: trunk/Jmol/src/org/jmol/viewer/StateCreator.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/StateCreator.java    2015-08-22 14:45:50 UTC 
(rev 20720)
+++ trunk/Jmol/src/org/jmol/viewer/StateCreator.java    2015-08-22 15:39:01 UTC 
(rev 20721)
@@ -23,16 +23,17 @@
 
 package org.jmol.viewer;
 
+import javajs.awt.Font;
+import javajs.util.Lst;
+import javajs.util.PT;
+import javajs.util.SB;
+
 import java.util.Arrays;
 import java.util.Date;
 import java.util.Hashtable;
 import java.util.Map;
 
-import javajs.awt.Font;
-import javajs.util.Lst;
 import javajs.util.P3;
-import javajs.util.PT;
-import javajs.util.SB;
 
 import org.jmol.api.JmolDataManager;
 import org.jmol.api.JmolModulationSet;
@@ -1784,8 +1785,15 @@
     if (disableSend)
       sm.setSyncDriver(StatusManager.SYNC_DISABLE);
     if (script.indexOf("Mouse: ") != 0) {
-      int jsvMode = JC.getJSVSyncSignal(script);
-      switch (jsvMode) {
+      int serviceMode = JC.getServiceCommand(script);
+      switch (serviceMode) {
+      case JC.NBO_CONFIG:
+      case JC.NBO_MODEL:
+      case JC.NBO_RUN:
+      case JC.NBO_VIEW:
+      case JC.NBO_SEARCH:
+        sm.syncSend(script, ".", port);
+        return;        
       case JC.JSV_NOT:
         break;
       case JC.JSV_SEND_JDXMOL:
@@ -1797,7 +1805,7 @@
       case JC.JSV_SETPEAKS:
       case JC.JSV_SELECT:
         // from JSpecView...
-        if ((script = vwr.getJSV().processSync(script, jsvMode)) == null)
+        if ((script = vwr.getJSV().processSync(script, serviceMode)) == null)
           return;
       }
       //System.out.println("Jmol executing script for JSpecView: " + script);

Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/GuiMap.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/GuiMap.java       
2015-08-22 14:45:50 UTC (rev 20720)
+++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/GuiMap.java       
2015-08-22 15:39:01 UTC (rev 20721)
@@ -184,7 +184,12 @@
     labels.put("definecenter", GT._("Define &Center"));
     labels.put("tools", GT._("&Tools"));
     labels.put("gauss", GT._("&Gaussian..."));
-    labels.put("nbo", GT._("&NBO..."));
+    labels.put("nboMenu", "&NBO...");
+    labels.put("nboConfigScript", GT._("&Config"));
+    labels.put("nboModelScript", GT._("&Model"));
+    labels.put("nboRunScript", GT._("&Run"));
+    labels.put("nboViewScript", GT._("&View"));
+    labels.put("nboSearchScript", GT._("&Search"));
     labels.put("viewMeasurementTable", GT._("&Measurements") + "...");
     labels.put("distanceUnitsMenu", GT._("Distance &Units"));
     labels.put("distanceNanometersScript", GT._("&Nanometers 1E-9"));

Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java    
2015-08-22 14:45:50 UTC (rev 20720)
+++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java    
2015-08-22 15:39:01 UTC (rev 20721)
@@ -201,7 +201,7 @@
   private static final String copyScriptActionProperty = "copyScript";
   private static final String surfaceToolActionProperty = "surfaceTool";  
private static final String pasteClipboardActionProperty = "pasteClipboard";
   private static final String gaussianAction = "gauss";
-  private static final String nboAction = "nbo";
+//  private static final String nboAction = "nbo";
   private static final String resizeAction = "resize";
   //private static final String saveasAction = "saveas";
   //private static final String vibAction = "vibrate";
@@ -951,6 +951,8 @@
           String menuKey = ((JmolAbstractButton) e.getSource()).getKey();
           if (menuKey.equals("display") || menuKey.equals("tools"))
             setMenuState();
+          if (menuKey.equals("nboMenu"))
+            setMenuNBO((JMenu) e.getSource());
         }
         @Override
         public void menuDeselected(MenuEvent e) {
@@ -1008,7 +1010,7 @@
       new RecentFilesAction(), povrayAction, writeAction, toWebAction, 
       new ScriptWindowAction(), new ScriptEditorAction(),
       new AtomSetChooserAction(), viewMeasurementTableAction, 
-      new GaussianAction(), new NBOAction(), new ResizeAction(), 
surfaceToolAction }
+      new GaussianAction(), /*new NBOAction(),*/ new ResizeAction(), 
surfaceToolAction }
   ;
 
   class CloseAction extends AbstractAction {
@@ -1090,17 +1092,6 @@
     }
   }
     
-  class NBOAction extends AbstractAction {
-    public NBOAction() {
-      super(nboAction);
-    }
-    
-    @Override
-    public void actionPerformed(ActionEvent e) {
-      startNBO();
-    }
-  }
-    
   class NewwinAction extends AbstractAction {
 
     NewwinAction() {
@@ -1120,12 +1111,34 @@
     newFrame.setVisible(true);
   }
   
-  void startNBO() {
+  void setMenuNBO(JMenu item) {
+    Component[] nodes = item.getMenuComponents();
+    for (int i = nodes.length; --i >= 0;) {
+      String text = ((JMenuItem) nodes[i]).getText();
+      nodes[i].setEnabled(text.equals("Config"));
+    }
     getNBOService();
+    if (!nboService.restartIfNecessary()) {
+      return;
+    }
     if (nboDialog == null)
       nboDialog = new NBODialog(frame, vwr, nboService);
+    // individual nodes here
+    nodes[1].setEnabled(true); // model
+    nodes[2].setEnabled(true);//vwr.ms.at.length > 0); // run
+    //boolean viewOK = "gennbo".equals(vwr.ms.getInfo(vwr.am.cmi, "fileType"));
+    nodes[3].setEnabled(true); // view    
+    nodes[4].setEnabled(true); // search
+  }
+  void startNBO(String type) {
+    getNBOService();
+    if (nboDialog == null)
+      nboDialog = new NBODialog(frame, vwr, nboService);
     else
       nboDialog.setVisible(true);
+    if (type != null)
+      nboDialog.openPanel(type.charAt(0));
+    
   }
 
   class UguideAction extends AbstractAction {

Modified: 
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/Properties/Jmol-resources.properties
===================================================================
--- 
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/Properties/Jmol-resources.properties
      2015-08-22 14:45:50 UTC (rev 20720)
+++ 
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/Properties/Jmol-resources.properties
      2015-08-22 15:39:01 UTC (rev 20721)
@@ -166,7 +166,7 @@
 #
 #tools=viewMeasurementTable animate vibrate graph chemicalShifts crystprop
 tools=viewMeasurementTable distanceUnitsMenu animateMenu vibrateMenu 
atomsetchooser \
-               surfaceTool gauss nbo spectrumMenu
+               surfaceTool gauss nboMenu spectrumMenu
 viewMeasurementTableImage=rulerButton.gif
 distanceUnitsMenuImage=distanceUnitsButton.png
 animateMenuImage=animateButton.png
@@ -177,6 +177,16 @@
 #crystpropImage=crystalButton.gif
 
 #
+# NBO Menu
+#
+nboMenu=nboConfigScript nboModelScript nboRunScript nboViewScript 
nboSearchScript
+nboConfigScript=sync on; sync . "NBO:Config"
+nboModelScript=sync on; sync . "NBO:Model"
+nboRunScript=sync on; sync . "NBO:Run"
+nboViewScript=sync on; sync . "NBO:View"
+nboSearchScript=sync on; sync . "NBO:Search"
+
+#
 # Spectrum Menu
 #
 

Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java       
2015-08-22 14:45:50 UTC (rev 20720)
+++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java       
2015-08-22 15:39:01 UTC (rev 20721)
@@ -30,7 +30,6 @@
 import org.jmol.api.JmolSyncInterface;
 import org.jmol.c.CBK;
 import org.jmol.dialog.Dialog;
-import javajs.awt.Dimension;
 import javajs.util.PT;
 
 import org.jmol.util.Logger;
@@ -146,13 +145,13 @@
           menuName = "";
         display.status.setStatus(1, menuName);
         if (jmol.frame != null) {
-          Font f = jmol.frame.getFont();
-          if (f != null) {
-            int m = jmol.frame.getFontMetrics(f).stringWidth("M");
-            int n = jmol.frame.getWidth() / m;
+          //Font f = jmol.frame.getFont();
+          //if (f != null) {
+            //int m = jmol.frame.getFontMetrics(f).stringWidth("M");
+            //int n = jmol.frame.getWidth() / m;
             //if (n < menuName.length())
               //menuName = menuName.substring(0, n) + "...";
-          }
+          //}
           jmol.frame.setTitle(menuName);
         }
         //        if (jSpecViewFrame != null)
@@ -222,6 +221,10 @@
             .getPreference(data[2].toString()));
         return;
       }
+      if (strInfo != null && strInfo.toLowerCase().startsWith("nbo:")) {
+        jmol.startNBO(strInfo.substring(4).toLowerCase());
+        return;
+      }
       jmol.sendNioMessage(((Integer) data[3]).intValue(), strInfo);
       return;
     case DRAGDROP:

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


------------------------------------------------------------------------------
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to