- public void loadInline(String string)
- {
- loadedInline = true;
- // TODO: re JAL-623
- // viewer.loadInline(strModel, isAppend);
- // could do this:
- // construct fake fullPathName and fileName so we can identify the file
- // later.
- // Then, construct pass a reader for the string to Jmol.
- // ((org.jmol.Viewer.Viewer) viewer).loadModelFromFile(fullPathName,
- // fileName, null, reader, false, null, null, 0);
- // viewer.openStringInline(string);
- log("cannot load inline in Chimera, yet");
- }
-
- public void mouseOverStructure(int atomIndex, String strInfo)
- {
- // function to parse a mouseOver event from Chimera
- //
- int pdbResNum;
- int alocsep = strInfo.indexOf("^");
- int mdlSep = strInfo.indexOf("/");
- int chainSeparator = strInfo.indexOf(":"), chainSeparator1 = -1;
-
- if (chainSeparator == -1)
- {
- chainSeparator = strInfo.indexOf(".");
- if (mdlSep > -1 && mdlSep < chainSeparator)
- {
- chainSeparator1 = chainSeparator;
- chainSeparator = mdlSep;
- }
- }
- // handle insertion codes
- if (alocsep != -1)
- {
- pdbResNum = Integer.parseInt(strInfo.substring(
- strInfo.indexOf("]") + 1, alocsep));
-
- }
- else
- {
- pdbResNum = Integer.parseInt(strInfo.substring(
- strInfo.indexOf("]") + 1, chainSeparator));
- }
- String chainId;
-
- if (strInfo.indexOf(":") > -1)
- {
- chainId = strInfo.substring(strInfo.indexOf(":") + 1,
- strInfo.indexOf("."));
- }
- else
- {
- chainId = " ";
- }
-
- String pdbfilename = modelFileNames[frameNo]; // default is first or current
- // model
- if (mdlSep > -1)
- {
- if (chainSeparator1 == -1)
- {
- chainSeparator1 = strInfo.indexOf(".", mdlSep);
- }
- String mdlId = (chainSeparator1 > -1) ? strInfo.substring(mdlSep + 1,
- chainSeparator1) : strInfo.substring(mdlSep + 1);
- try
- {
- // recover PDB filename for the model hovered over.
- int _mp = _modelFileNameMap.length - 1, mnumber = new Integer(mdlId)
- .intValue() - 1;
- while (mnumber < _modelFileNameMap[_mp])
- {
- _mp--;
- }
- pdbfilename = modelFileNames[_mp];
- if (pdbfilename == null)
- {
- // pdbfilename = new File(viewer.getModelFileName(mnumber))
- // .getAbsolutePath();
- }
-
- } catch (Exception e)
- {
- }
- ;
- }
- if (lastMessage == null || !lastMessage.equals(strInfo))
- {
- ssm.mouseOverStructure(pdbResNum, chainId, pdbfilename);
- }
-
- lastMessage = strInfo;
- }
-
- public void notifyAtomPicked(int atomIndex, String strInfo, String strData)
- {
- /**
- * this implements the toggle label behaviour copied from the original
- * structure viewer, MCView
- */
- if (strData != null)
- {
- System.err.println("Ignoring additional pick data string " + strData);
- }
- // rewrite these selections for chimera (DNA, RNA and protein)
- int chainSeparator = strInfo.indexOf(":");
- int p = 0;
- if (chainSeparator == -1)
- {
- chainSeparator = strInfo.indexOf(".");
- }
-
- String picked = strInfo.substring(strInfo.indexOf("]") + 1,
- chainSeparator);
- String mdlString = "";
- if ((p = strInfo.indexOf(":")) > -1)
- {
- picked += strInfo.substring(p + 1, strInfo.indexOf("."));
- }
-
- if ((p = strInfo.indexOf("/")) > -1)
- {
- mdlString += strInfo.substring(p, strInfo.indexOf(" #"));
- }
- picked = "((" + picked + ".CA" + mdlString + ")|(" + picked + ".P"
- + mdlString + "))";
- viewerCommandHistory(false);
-
- if (!atomsPicked.contains(picked))
- {
- viewer.select(picked);
- atomsPicked.add(picked);
- }
- else
- {
- viewer.select("not " + picked);
- atomsPicked.remove(picked);
- }
- viewerCommandHistory(true);
- // TODO: in application this happens
- //
- // if (scriptWindow != null)
- // {
- // scriptWindow.sendConsoleMessage(strInfo);
- // scriptWindow.sendConsoleMessage("\n");
- // }
-
- }
-
- // incremented every time a load notification is successfully handled -
- // lightweight mechanism for other threads to detect when they can start
- // referring to new structures.
- private long loadNotifiesHandled = 0;
-