mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
"Highlight Continuity Area" mode improvements
This commit is contained in:
@@ -126,9 +126,12 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
|
|||||||
* Note: point coordinates are scaled for zoom factor.
|
* Note: point coordinates are scaled for zoom factor.
|
||||||
*
|
*
|
||||||
* @param point
|
* @param point
|
||||||
|
* @param ctrlDown
|
||||||
|
* @param shiftDown
|
||||||
|
* @param altDown
|
||||||
* @return cursor
|
* @return cursor
|
||||||
*/
|
*/
|
||||||
Cursor getCursorAt(Point point);
|
Cursor getCursorAt(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an instance of currently loaded project.
|
* Returns an instance of currently loaded project.
|
||||||
|
|||||||
@@ -470,8 +470,7 @@ public class DrawingManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentContinuityArea != null
|
if (currentContinuityArea != null) {
|
||||||
&& (configManager.readBoolean(IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false))) {
|
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
|
||||||
g2d.setColor(Color.green);
|
g2d.setColor(Color.green);
|
||||||
|
|||||||
@@ -265,9 +265,9 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Cursor getCursorAt(Point point) {
|
public Cursor getCursorAt(Point point, boolean ctrlDown, boolean shiftDown, boolean altDown) {
|
||||||
// Only change the cursor if we're not making a new component.
|
// Only change the cursor if we're not making a new component.
|
||||||
if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false))
|
if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false) || altDown)
|
||||||
return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
|
return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
|
||||||
if (instantiationManager.getComponentTypeSlot() == null) {
|
if (instantiationManager.getComponentTypeSlot() == null) {
|
||||||
// Scale point to remove zoom factor.
|
// Scale point to remove zoom factor.
|
||||||
@@ -686,7 +686,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
drawingManager.clearContinuityArea();
|
drawingManager.clearContinuityArea();
|
||||||
projectFileManager.notifyFileChange();
|
projectFileManager.notifyFileChange();
|
||||||
}
|
}
|
||||||
} else if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false)) {
|
} else if (configManager.readBoolean(HIGHLIGHT_CONTINUITY_AREA, false) || altDown) {
|
||||||
drawingManager.findContinuityAreaAtPoint(currentProject, scaledPoint);
|
drawingManager.findContinuityAreaAtPoint(currentProject, scaledPoint);
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
} else {
|
} else {
|
||||||
@@ -717,6 +717,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
newSelection.addAll(findAllGroupedComponents(topComponent));
|
newSelection.addAll(findAllGroupedComponents(topComponent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
drawingManager.clearContinuityArea();
|
||||||
updateSelection(newSelection);
|
updateSelection(newSelection);
|
||||||
// messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED,
|
// messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED,
|
||||||
// selectedComponents);
|
// selectedComponents);
|
||||||
|
|||||||
@@ -3130,6 +3130,14 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added German UI translation</description>
|
<description>Added German UI translation</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Use ALT key to temporarily switch to "Highlight Continuity Area" mode</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Reset "Highlight Continuity Area" mode configuration on application exit to avoid confusion in the next session</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Improved Dutch translation</description>
|
<description>Improved Dutch translation</description>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import org.apache.log4j.Logger;
|
|||||||
import org.apache.log4j.PropertyConfigurator;
|
import org.apache.log4j.PropertyConfigurator;
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.appframework.miscutils.PropertyInjector;
|
import org.diylc.appframework.miscutils.PropertyInjector;
|
||||||
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
import org.diylc.lang.LangUtil;
|
import org.diylc.lang.LangUtil;
|
||||||
import org.diylc.presenter.Presenter;
|
import org.diylc.presenter.Presenter;
|
||||||
@@ -82,6 +83,11 @@ public class DIYLCStarter {
|
|||||||
|
|
||||||
ConfigurationManager.initialize("diylc");
|
ConfigurationManager.initialize("diylc");
|
||||||
|
|
||||||
|
// disable HIGHLIGHT_CONTINUITY_AREA config, keep it transient
|
||||||
|
ConfigurationManager.getInstance().writeValue(IPlugInPort.HIGHLIGHT_CONTINUITY_AREA, false);
|
||||||
|
|
||||||
|
LOG.info("Loading languages...");
|
||||||
|
|
||||||
LangUtil.configure();
|
LangUtil.configure();
|
||||||
|
|
||||||
LOG.debug("Java version: " + System.getProperty("java.runtime.version") + " by "
|
LOG.debug("Java version: " + System.getProperty("java.runtime.version") + " by "
|
||||||
|
|||||||
@@ -211,7 +211,8 @@ public class LoadlineEditorFrame extends JFrame implements IView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent e) {
|
public void mouseMoved(MouseEvent e) {
|
||||||
canvasPanel.setCursor(plugInPort.getCursorAt(e.getPoint()));
|
canvasPanel.setCursor(plugInPort.getCursorAt(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
||||||
|
e.isShiftDown(), e.isAltDown()));
|
||||||
plugInPort.mouseMoved(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
plugInPort.mouseMoved(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
||||||
e.isShiftDown(), e.isAltDown());
|
e.isShiftDown(), e.isAltDown());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class CanvasGestureListener implements DragGestureListener {
|
|||||||
forceReSelection = me.getButton() != MouseEvent.BUTTON1;
|
forceReSelection = me.getButton() != MouseEvent.BUTTON1;
|
||||||
}
|
}
|
||||||
presenter.dragStarted(dge.getDragOrigin(), dge.getDragAction(), forceReSelection);
|
presenter.dragStarted(dge.getDragOrigin(), dge.getDragAction(), forceReSelection);
|
||||||
dge.startDrag(presenter.getCursorAt(dge.getDragOrigin()), new EmptyTransferable(), new CanvasSourceListener(
|
dge.startDrag(presenter.getCursorAt(dge.getDragOrigin(), false, false, false), new EmptyTransferable(), new CanvasSourceListener(
|
||||||
presenter));
|
presenter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,8 +315,15 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
|
|
||||||
canvasPanel.addKeyListener(new KeyAdapter() {
|
canvasPanel.addKeyListener(new KeyAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyReleased(KeyEvent e) {
|
||||||
|
canvasPanel.setCursor(plugInPort.getCursorAt(canvasPanel.getMousePosition(), false, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
|
canvasPanel.setCursor(plugInPort.getCursorAt(canvasPanel.getMousePosition(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
||||||
|
e.isShiftDown(), e.isAltDown()));
|
||||||
if (plugInPort.keyPressed(e.getKeyCode(),
|
if (plugInPort.keyPressed(e.getKeyCode(),
|
||||||
Utils.isMac() ? e.isMetaDown() : e.isControlDown(), e.isShiftDown(), e.isAltDown())) {
|
Utils.isMac() ? e.isMetaDown() : e.isControlDown(), e.isShiftDown(), e.isAltDown())) {
|
||||||
e.consume();
|
e.consume();
|
||||||
@@ -330,7 +337,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
public void mouseMoved(MouseEvent e) {
|
public void mouseMoved(MouseEvent e) {
|
||||||
if (scrollPane.isMouseScrollMode())
|
if (scrollPane.isMouseScrollMode())
|
||||||
return;
|
return;
|
||||||
canvasPanel.setCursor(plugInPort.getCursorAt(e.getPoint()));
|
canvasPanel.setCursor(plugInPort.getCursorAt(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
||||||
|
e.isShiftDown(), e.isAltDown()));
|
||||||
plugInPort.mouseMoved(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
plugInPort.mouseMoved(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
||||||
e.isShiftDown(), e.isAltDown());
|
e.isShiftDown(), e.isAltDown());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class TreeGestureListener implements DragGestureListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (start)
|
if (start)
|
||||||
dge.startDrag(presenter.getCursorAt(dge.getDragOrigin()), new EmptyTransferable(),
|
dge.startDrag(presenter.getCursorAt(dge.getDragOrigin(), false, false, false), new EmptyTransferable(),
|
||||||
new TreeSourceListener(presenter));
|
new TreeSourceListener(presenter));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user