Commit
…ontrollerHub/IChemModelRelay; fixes issue JChemPaint#13
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ | |
import org.openscience.cdk.tools.manipulator.MolecularFormulaManipulator; | ||
import org.openscience.cdk.tools.manipulator.ReactionManipulator; | ||
import org.openscience.cdk.validate.ProblemMarker; | ||
import org.openscience.jchempaint.RenderPanel; | ||
import org.openscience.jchempaint.applet.JChemPaintAbstractApplet; | ||
import org.openscience.jchempaint.controller.undoredo.IUndoRedoFactory; | ||
import org.openscience.jchempaint.controller.undoredo.IUndoRedoable; | ||
|
@@ -111,7 +112,7 @@ public class ControllerHub implements IMouseEventRelay, IChemModelRelay { | |
|
||
private IRenderer renderer; | ||
|
||
private IViewEventRelay eventRelay; | ||
private RenderPanel eventRelay; | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rwst
Author
Owner
|
||
private List<IControllerModule> generalModules; | ||
|
||
|
@@ -146,7 +147,7 @@ public class ControllerHub implements IMouseEventRelay, IChemModelRelay { | |
private String phantomText = null; | ||
|
||
public ControllerHub(IControllerModel controllerModel, IRenderer renderer, | ||
IChemModel chemModel, IViewEventRelay eventRelay, | ||
IChemModel chemModel, RenderPanel eventRelay, | ||
UndoRedoHandler undoredohandler, IUndoRedoFactory undoredofactory, | ||
boolean isViewer, JChemPaintAbstractApplet applet) { | ||
this.controllerModel = controllerModel; | ||
|
@@ -272,8 +273,8 @@ public void mouseClickedDown(int screenX, int screenY) { | |
if (activeModule != null) | ||
activeModule.mouseClickedDown(modelCoord); | ||
|
||
if (renderer.getCursor() == Cursor.HAND_CURSOR | ||
|| renderer.getCursor() == Cursor.HAND_CURSOR) { | ||
if (getCursor() == Cursor.HAND_CURSOR | ||
|| getCursor() == Cursor.HAND_CURSOR) { | ||
setCursor(Cursor.MOVE_CURSOR); | ||
oldMouseCursor = Cursor.HAND_CURSOR; | ||
} else { | ||
|
@@ -2655,8 +2656,22 @@ public IChemModel getChemModel() { | |
return chemModel; | ||
} | ||
|
||
/** | ||
* Sets the mouse cursor shown on the renderPanel. | ||
* | ||
* @param cursor One of the constants from java.awt.Cursor. | ||
*/ | ||
public void setCursor(int cursor) { | ||
renderer.setCursor(cursor); | ||
eventRelay.setCursor(new Cursor(cursor)); | ||
} | ||
|
||
/** | ||
* Tells the mouse cursor shown on the renderPanel. | ||
* | ||
* @return One of the constants from java.awt.Cursor. | ||
*/ | ||
public int getCursor() { | ||
return eventRelay.getCursor().getType(); | ||
} | ||
|
||
/** | ||
|
5 comments
on commit c58ca2f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ralf, this is a patch that, when cleaned up should go into CDK/CDK-JChemPaint.
Do you think you can rebase it as patch on cdk-1.4.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What patch? The last 4 lines? You cannot mean the whole commit because it undoes something that is only in JCP. Please be more specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the full patch (minus that .orig file): c58ca2f
I am sorry... This GitHub review website is not too intuitive...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this patch 1. removes something from Renderer that is only in JCP, and 2. adds something to ControllerHub. You can only mean 2. add getCursor functionality to ControllerHub in CDK. But I still haven't agreed to backport anything to CDK controller. Remember that I first wanted to have an overview to decide which parts of controller belong to JCP vs. CDK. This principle decision hasn't been made (and probably won't for some time), so I won't know if I'll backport that patch until then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, understood :)
In general it is better to write against interfaces than implementations. Also, the commit message suggests to me you could reuse an existing class, but then you would simply remove an interface, not?
Anyway, getCursor() should indeed not be part of the Renderer... so, I second very much fixing that.