Revision: 18633
          http://sourceforge.net/p/jmol/code/18633
Author:   hansonr
Date:     2013-08-30 16:41:40 +0000 (Fri, 30 Aug 2013)
Log Message:
-----------
___JmolVersion="13.3.5_dev_2013.08.29"

new feature: show NMR taps into NMRDB directly
 -- for now, application only

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/applet/Jmol.java
    trunk/Jmol/src/org/jmol/appletjs/Jmol.java
    trunk/Jmol/src/org/jmol/constant/EnumCallback.java
    trunk/Jmol/src/org/jmol/viewer/JSpecView.java
    trunk/Jmol/src/org/jmol/viewer/StatusManager.java
    trunk/Jmol/src/org/jmol/viewer/Viewer.java
    trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java
    trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java

Modified: trunk/Jmol/src/org/jmol/applet/Jmol.java
===================================================================
--- trunk/Jmol/src/org/jmol/applet/Jmol.java    2013-08-30 10:38:55 UTC (rev 
18632)
+++ trunk/Jmol/src/org/jmol/applet/Jmol.java    2013-08-30 16:41:40 UTC (rev 
18633)
@@ -888,6 +888,7 @@
       case MEASURE: 
       case MESSAGE:
       case PICK:
+      case STRUCTUREMODIFIED:
       case SYNC:
       case SCRIPT:
         return true;
@@ -1027,6 +1028,9 @@
         output(strInfo);
         showStatus(strInfo);
         break;
+      case STRUCTUREMODIFIED:
+        notifyStructureModified(((Integer) data[1]).intValue(), ((Integer) 
data[2]).intValue());
+        break;
       case SYNC:
         sendScript(strInfo, (String) data[2], true, doCallback);
         return;
@@ -1057,6 +1061,11 @@
       }
     }
 
+    private void notifyStructureModified(int modelIndex, int mode) {
+      // TODO
+      
+    }
+
     private void output(String s) {
       if (outputBuffer != null && s != null)
         outputBuffer.append(s).append('\n');

Modified: trunk/Jmol/src/org/jmol/appletjs/Jmol.java
===================================================================
--- trunk/Jmol/src/org/jmol/appletjs/Jmol.java  2013-08-30 10:38:55 UTC (rev 
18632)
+++ trunk/Jmol/src/org/jmol/appletjs/Jmol.java  2013-08-30 16:41:40 UTC (rev 
18633)
@@ -506,6 +506,7 @@
       case MEASURE:
       case MESSAGE:
       case PICK:
+      case STRUCTUREMODIFIED:
       case SYNC:
       case SCRIPT:
         return true;
@@ -645,6 +646,9 @@
         output(strInfo);
         showStatus(strInfo);
         break;
+      case STRUCTUREMODIFIED:
+        notifyStructureModified(((Integer) data[1]).intValue(), ((Integer) 
data[2]).intValue());
+        break;
       case SYNC:
         sendScript(strInfo, (String) data[2], true, doCallback);
         return;
@@ -671,6 +675,12 @@
       }
     }
 
+    private void notifyStructureModified(int modelIndex, int mode) {
+      // TODO
+      
+    }
+
+
     private void output(String s) {
       if (outputBuffer != null && s != null)
         outputBuffer.append(s).appendC('\n');

Modified: trunk/Jmol/src/org/jmol/constant/EnumCallback.java
===================================================================
--- trunk/Jmol/src/org/jmol/constant/EnumCallback.java  2013-08-30 10:38:55 UTC 
(rev 18632)
+++ trunk/Jmol/src/org/jmol/constant/EnumCallback.java  2013-08-30 16:41:40 UTC 
(rev 18633)
@@ -44,7 +44,7 @@
   PICK,
   RESIZE,
   SCRIPT,
-  SYNC;
+  SYNC, STRUCTUREMODIFIED;
 
   public static EnumCallback getCallback(String name) {
     

Modified: trunk/Jmol/src/org/jmol/viewer/JSpecView.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/JSpecView.java       2013-08-30 10:38:55 UTC 
(rev 18632)
+++ trunk/Jmol/src/org/jmol/viewer/JSpecView.java       2013-08-30 16:41:40 UTC 
(rev 18633)
@@ -19,13 +19,15 @@
   }
   
   public void atomPicked(int atomIndex) {
+    if (atomIndex < 0)
+      return;
     String peak = getPeakAtomRecord(atomIndex);
     if (peak != null)
       sendJSpecView(peak + " src=\"JmolAtomSelect\"");
   }
   
   @SuppressWarnings("unchecked")
-  public String getPeakAtomRecord(int atomIndex) {
+  private String getPeakAtomRecord(int atomIndex) {
     Atom[] atoms = viewer.modelSet.atoms;
     int iModel = atoms[atomIndex].modelIndex;
     String type = null;

Modified: trunk/Jmol/src/org/jmol/viewer/StatusManager.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/StatusManager.java   2013-08-30 10:38:55 UTC 
(rev 18632)
+++ trunk/Jmol/src/org/jmol/viewer/StatusManager.java   2013-08-30 16:41:40 UTC 
(rev 18633)
@@ -601,6 +601,12 @@
       jmolCallbackListener.notifyCallback(EnumCallback.SYNC,
           new Object[] { null, script, appletName, Integer.valueOf(port) });
   }
+ 
+  void modifySend(int atomIndex, int modelIndex, int mode) {
+    if (notifyEnabled(EnumCallback.STRUCTUREMODIFIED))
+      jmolCallbackListener.notifyCallback(EnumCallback.STRUCTUREMODIFIED,
+          new Object[] { null, Integer.valueOf(mode), 
Integer.valueOf(atomIndex), Integer.valueOf(modelIndex) });
+  }
   
   int getSyncMode() {
     return (!isSynced ? SYNC_OFF : drivingSync ? SYNC_DRIVER : SYNC_SLAVE);

Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Viewer.java  2013-08-30 10:38:55 UTC (rev 
18632)
+++ trunk/Jmol/src/org/jmol/viewer/Viewer.java  2013-08-30 16:41:40 UTC (rev 
18633)
@@ -5790,6 +5790,8 @@
   @Override
   public boolean getBoolean(int tok) {
     switch (tok) {
+    case T.pdb:
+      return modelSet.getModelSetAuxiliaryInfoBoolean("isPDB");
     case T.allowgestures:
       return global.allowGestures;
     case T.allowmultitouch:
@@ -8894,16 +8896,20 @@
   }
 
   public int deleteAtoms(BS bs, boolean fullModels) {
+    int atomIndex = (bs == null ? -1 : bs.nextSetBit(0));
+    if (atomIndex < 0)
+      return 0;
     clearModelDependentObjects();
     if (!fullModels) {
+      statusManager.modifySend(atomIndex, 
modelSet.atoms[atomIndex].modelIndex, 4);
       modelSet.deleteAtoms(bs);
       int n = selectionManager.deleteAtoms(bs);
       setTainted(true);
+      statusManager.modifySend(atomIndex, 
modelSet.atoms[atomIndex].modelIndex, -4);
       return n;
     }
-    if (bs.cardinality() == 0)
-      return 0;
     // fileManager.addLoadScript("zap " + Escape.escape(bs));
+    statusManager.modifySend(-1, modelSet.atoms[atomIndex].modelIndex, 5);
     setCurrentModelIndexClear(0, false);
     animationManager.setAnimationOn(false);
     BS bsD0 = BSUtil.copy(getDeletedAtoms());
@@ -8921,6 +8927,7 @@
     refreshMeasures(true);
     if (bsD0 != null)
       bsDeleted.andNot(bsD0);
+    statusManager.modifySend(-1, modelSet.atoms[atomIndex].modelIndex, -5);
     return BSUtil.cardinalityOf(bsDeleted);
   }
 
@@ -9596,10 +9603,12 @@
       return;
     clearModelDependentObjects();
     if (pt == null) {
+      statusManager.modifySend(atomIndex, 
modelSet.atoms[atomIndex].modelIndex, 1);
       int atomCount = modelSet.getAtomCount();
       modelSet.assignAtom(atomIndex, type, true);
       if (!Parser.isOneOf(type,";Mi;Pl;X;"))
         modelSet.setAtomNamesAndNumbers(atomIndex, -atomCount, null);
+      statusManager.modifySend(atomIndex, 
modelSet.atoms[atomIndex].modelIndex, -1);
       refresh(3, "assignAtom");
       return;
     }
@@ -9608,6 +9617,8 @@
     P3[] pts = new P3[] { pt };
     JmolList<Atom> vConnections = new JmolList<Atom>();
     vConnections.addLast(atom);
+    int modelIndex = atom.modelIndex;
+    statusManager.modifySend(atomIndex, modelIndex, 3);
     try {
       bs = addHydrogensInline(bs, vConnections, pts);
       atomIndex = bs.nextSetBit(0);
@@ -9616,15 +9627,19 @@
       //
     }
     modelSet.setAtomNamesAndNumbers(atomIndex, -1, null);
+    statusManager.modifySend(atomIndex, modelIndex,-3);
   }
 
   public void assignConnect(int index, int index2) {
     clearModelDependentObjects();
     float[][] connections = ArrayUtil.newFloat2(1);
     connections[0] = new float[] { index, index2 };
+    int modelIndex = modelSet.atoms[index].modelIndex;
+    statusManager.modifySend(index, modelIndex, 2);
     modelSet.connect(connections);
     modelSet.assignAtom(index, ".", true);
     modelSet.assignAtom(index2, ".", true);
+    statusManager.modifySend(index, modelIndex, -2);
     refresh(3, "assignConnect");
   }
 

Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java    
2013-08-30 10:38:55 UTC (rev 18632)
+++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/JmolPanel.java    
2013-08-30 16:41:40 UTC (rev 18633)
@@ -973,7 +973,7 @@
     guimap.setSelected("measurementsCheck", 
viewer.getBoolean(T.showmeasurements));
     guimap.setSelected("axesCheck", viewer.getShowAxes());
     guimap.setSelected("boundboxCheck", viewer.getShowBbcage());
-    guimap.setEnabled("openJSpecViewScript", display.isRotateMode());
+    guimap.setEnabled("openJSpecViewScript", !viewer.getBoolean(T.pdb));
   }
 
   private static class ActionChangedListener implements PropertyChangeListener 
{

Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java       
2013-08-30 10:38:55 UTC (rev 18632)
+++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java       
2013-08-30 16:41:40 UTC (rev 18633)
@@ -91,6 +91,7 @@
     case ANIMFRAME:
     case ECHO:
     case LOADSTRUCT:
+    case STRUCTUREMODIFIED:
     case MEASURE:
     case MESSAGE:
     case PICK:
@@ -168,6 +169,13 @@
     case PICK:
       notifyAtomPicked(strInfo);
       break;
+    case STRUCTUREMODIFIED:
+      // 0 DONE; 1 in process
+      int mode = ((Integer) data[1]).intValue();
+      int atomIndex = ((Integer) data[2]).intValue();
+      int modelIndexx = ((Integer) data[3]).intValue();
+      notifyStructureModified(atomIndex, modelIndexx, mode);
+      break;
     case SYNC:
       if (strInfo != null && strInfo.toLowerCase().startsWith("jspecview")) {
         setJSpecView(strInfo.substring(9).trim(), false, false);
@@ -191,6 +199,21 @@
       appConsole.notifyCallback(type, data);
   }
 
+  private void notifyStructureModified(int atomIndex, int modelIndex, int 
mode) {
+    modificationMode = mode;
+    if (mode < 0) {
+      switch (mode) {
+      case -1: // assign atom
+      case -2: // assign bond
+      case -3: // 
+      case -4: // delete atoms
+      case -5: // delete models
+        checkJSpecView(false);
+        return;
+      }
+    }
+  }
+
   public void setCallbackFunction(String callbackType, String 
callbackFunction) {
     if (callbackType.equals("modelkit")) {
       if (callbackFunction.equals("ON"))
@@ -254,19 +277,25 @@
     }
     if (!display.haveDisplay)
       return;
-
+System.out.println("StatusListener notifyFileLoaded: " + fileName);
     // this code presumes only ptLoad = -1 (error), 0 (zap), or 3 (completed)
     String title = "Jmol";
     if (modelName != null && fileName != null)
-      title = fileName + " - " + modelName;
+      title = (fileName.contains("&") ? "" : fileName + " - ") + modelName;
     else if (fileName != null)
       title = fileName;
     else if (modelName != null)
       title = modelName;
-    jmol.notifyFileOpen(fullPathName == null ? null : fullPathName + (isAsync 
== Boolean.TRUE ? " (*)" : ""), title);    
-    if (jSpecViewFrame != null) {
+    jmol.notifyFileOpen(fullPathName == null ? null : fullPathName + (isAsync 
== Boolean.TRUE ? " (*)" : ""), title);
+    checkJSpecView(fullPathName == null);
+  }
+
+  private int modificationMode;
+  
+  private void checkJSpecView(boolean closeAll) {
+    if (jSpecViewFrame != null && modificationMode <= 0) {
       jSpecViewForceNew = jSpecViewFrame.isVisible();
-      if (fullPathName == null) {
+      if (closeAll) {
         jSpecViewFrame.syncScript("close ALL");
       } else {
         setJSpecView("", true, true);
@@ -366,8 +395,8 @@
   }
 
   public void setJSpecView(String peaks, boolean doLoadCheck, boolean 
isFileLoad) {
-    if (!display.isRotateMode())
-      return;
+    //if (!display.isRotateMode())
+      //return;
     if (peaks.startsWith(":"))
       peaks = peaks.substring(1);
     if (jSpecViewFrame == null) {

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


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&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