enhancement: replace top of Undo stack with setMol()

User fa1369adab

04-10-2006 14:30:05

I am using setMol() from JavaScript to replace the current molecule displayed by MarvinSketch with a new molecule. In most cases, the molecule is structurally identical, and it might differ only in some colors applied to some atoms. I would like this new molecule to replace the old one in MarvinSketch's undo stack, so if the user clicks on Undo, MarvinSketch returns to the molecule that preceded the one replaced by setMol().





So far as I can see, this facility is not currently available. It isn't of major importance, but it would be helpful.

ChemAxon 7c2d26e5cf

05-10-2006 20:27:52

We will consider your request.

ChemAxon e500b51457

09-10-2006 21:48:09

How did you apply coloring (from API or GUI)?


Did you use Format menu or atom set coloring by MolAtom.setSetSeq() ?

User fa1369adab

10-10-2006 02:39:56

We apply coloring by string operations on the MOL string. The colors are intended to point out to the user where he or she has committed a particular sort of error.

ChemAxon e500b51457

10-10-2006 20:12:27

I tried the following example: http://www.chemaxon.com/marvin/doc/dev/example-sketch3.4.html


In the textbox I entered a new mrv source where I applied coloring. After importing this (Import button), undo works and restores the starting molecule. (Here the Import button uses setMol())





Could you give me more details about how to reproduce the problem (for example mrv source)?

User fa1369adab

11-10-2006 01:42:43

I think you misunderstand. I am using LiveConnect to introduce a new molecule into a MarvinSketch applet. It works fine. But then the undo button returns me to the previous molecule that the applet was displaying. I would like the undo button to return me to the molecule before that one.





One way to imagine implementing this request is to add to the API a call undo(), which simply goes back one molecule. Then I would call undo() via LiveConnect before I call setMol(), and the effect would be just what I want.

ChemAxon 7c2d26e5cf

11-10-2006 10:37:42

It's already clear.


I have implemented JMSketch.undo() and JMSketch.redo() methods in this moment.


In next Marvin release they will be available.

User fa1369adab

24-10-2006 12:50:11

I have upgraded to Marvin 4.1.2 and verified that by Help->About Marvin





In my JavaScript, when I try
Code:
document.ans_Applet.undo();
the Java Console prints "undo Action", but I see no undo effect.

ChemAxon 7c2d26e5cf

25-10-2006 07:02:42

Thanks for the bug report.


Indead, there is a bug in the applet version. We will fix it.

ChemAxon 7c2d26e5cf

25-10-2006 09:09:30

I've fixed it. The bugfix will be available in the next release (4.1.3).