mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
show/hide rulers and grid
This commit is contained in:
@@ -44,6 +44,8 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
|
||||
public static final String OUTLINE_KEY = "outline";
|
||||
public static final String THEME_KEY = "theme";
|
||||
public static final String RECENT_COMPONENTS_KEY = "recentComponents";
|
||||
public static final String SHOW_RULERS_KEY = "showRulers";
|
||||
public static final String SHOW_GRID_KEY = "showGrid";
|
||||
|
||||
public static final int DND_TOGGLE_STICKY = 0x1;
|
||||
public static final int DND_TOGGLE_SNAP = 0x40000000;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,6 @@ import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IComponentTransformer;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ISelectionProcessor;
|
||||
import org.diylc.common.ITask;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.ExpansionMode;
|
||||
|
||||
@@ -110,14 +110,16 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
}
|
||||
Graphics2D g2d = (Graphics2D) bufferImage.getGraphics();
|
||||
g2d.setClip(getVisibleRect());
|
||||
Set<DrawOption> drawOptions =
|
||||
EnumSet.of(DrawOption.GRID, DrawOption.SELECTION, DrawOption.ZOOM, DrawOption.CONTROL_POINTS);
|
||||
Set<DrawOption> drawOptions = EnumSet.of(DrawOption.SELECTION, DrawOption.ZOOM, DrawOption.CONTROL_POINTS);
|
||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.ANTI_ALIASING_KEY, true)) {
|
||||
drawOptions.add(DrawOption.ANTIALIASING);
|
||||
}
|
||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.OUTLINE_KEY, false)) {
|
||||
drawOptions.add(DrawOption.OUTLINE_MODE);
|
||||
}
|
||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.SHOW_GRID_KEY, false)) {
|
||||
drawOptions.add(DrawOption.GRID);
|
||||
}
|
||||
plugInPort.draw(g2d, drawOptions, null);
|
||||
if (USE_HARDWARE_ACCELLERATION) {
|
||||
VolatileImage volatileImage = (VolatileImage) bufferImage;
|
||||
|
||||
@@ -97,6 +97,16 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
||||
} catch (BadPositionException e) {
|
||||
LOG.error("Could not install canvas plugin", e);
|
||||
}
|
||||
|
||||
getScrollPane().setRulerVisible(ConfigurationManager.getInstance().readBoolean(IPlugInPort.SHOW_RULERS_KEY, true));
|
||||
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.SHOW_RULERS_KEY, new IConfigListener() {
|
||||
|
||||
@Override
|
||||
public void valueChanged(String key, Object value) {
|
||||
if (IPlugInPort.SHOW_RULERS_KEY.equals(key))
|
||||
getScrollPane().setRulerVisible((Boolean) value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public CanvasPanel getCanvasPanel() {
|
||||
|
||||
@@ -55,6 +55,12 @@ public class ConfigPlugin implements IPlugIn {
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Continuous Creation",
|
||||
IPlugInPort.CONTINUOUS_CREATION_KEY, false), CONFIG_MENU);
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Show Rulers", IPlugInPort.SHOW_RULERS_KEY, true),
|
||||
CONFIG_MENU);
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Show Grid", IPlugInPort.SHOW_GRID_KEY, true),
|
||||
CONFIG_MENU);
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Export Grid", IPlugInPort.EXPORT_GRID_KEY, false),
|
||||
CONFIG_MENU);
|
||||
|
||||
@@ -1554,6 +1554,14 @@
|
||||
<releaseDate>2017-01-05 20:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Show/hide rulers</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Show/hide the grid</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Applying a template shouldn't affect component placement</description>
|
||||
|
||||
Reference in New Issue
Block a user