diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml b/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml index c3950f4e..3f4471bf 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml @@ -1,22 +1,42 @@ + + lastPath + C:\Documents and Settings\Branislav Stojkovic\Desktop + + + stickyPoints + true + theme - Blueprint + Light - 3 - 122 - 198 + 255 + 255 + 255 255 - 29 - 140 - 193 - 255 + 240 + 240 + 240 + 240 + + antiAliasing + true + + + snapToGrid + false + + + hiQualityRender + false + showTemplatesAtStartup false diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/common/IPlugInPort.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/common/IPlugInPort.java index b42b4320..dd17e617 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/common/IPlugInPort.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/common/IPlugInPort.java @@ -36,6 +36,8 @@ public interface IPlugInPort { public static final String HI_QUALITY_RENDER_KEY = "hiQualityRender"; public static final String EXPORT_GRID_KEY = "exportGrid"; public static final String STICKY_POINTS_KEY = "stickyPoints"; + public static final String METRIC_KEY = "metric"; + public static final String SNAP_TO_GRID_KEY = "snapToGrid"; /** * Returns size of the canvas that takes project dimensions into account as diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/Presenter.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/Presenter.java index 3abb426a..9fcac554 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/Presenter.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/Presenter.java @@ -53,7 +53,6 @@ public class Presenter implements IPlugInPort { public static final VersionNumber CURRENT_VERSION = new VersionNumber(3, 0, 7); public static final String DEFAULTS_KEY_PREFIX = "default."; - public static final String METRIC_KEY = "metric"; public static final List> EMPTY_SELECTION = Collections.emptyList(); @@ -92,8 +91,6 @@ public class Presenter implements IPlugInPort { private Point previousDragPoint = null; private Project preDragProject = null; - private boolean snapToGrid = true; - public Presenter(IView view) { super(); this.view = view; @@ -361,7 +358,8 @@ public class Presenter implements IPlugInPort { switch (componentTypeSlot.getCreationMethod()) { case SINGLE_CLICK: try { - if (snapToGrid) { + if (ConfigurationManager.getInstance().readBoolean( + IPlugInPort.SNAP_TO_GRID_KEY, true)) { CalcUtils.snapPointToGrid(scaledPoint, currentProject.getGridSpacing()); } IDIYComponent component = instantiationManager.instantiateComponent( @@ -385,7 +383,8 @@ public class Presenter implements IPlugInPort { case POINT_BY_POINT: // First click is just to set the controlPointSlot and // componentSlot. - if (snapToGrid) { + if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.SNAP_TO_GRID_KEY, + true)) { CalcUtils.snapPointToGrid(scaledPoint, currentProject.getGridSpacing()); } if (instantiationManager.getComponentSlot() == null) { @@ -460,7 +459,7 @@ public class Presenter implements IPlugInPort { Map, Set> components = new HashMap, Set>(); Point scaledPoint = scalePoint(point); if (instantiationManager.getComponentTypeSlot() != null) { - if (snapToGrid) { + if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.SNAP_TO_GRID_KEY, true)) { CalcUtils.snapPointToGrid(scaledPoint, currentProject.getGridSpacing()); } boolean refresh = false; @@ -469,7 +468,8 @@ public class Presenter implements IPlugInPort { refresh = instantiationManager.updatePointByPoint(scaledPoint); break; case SINGLE_CLICK: - refresh = instantiationManager.updateSingleClick(scaledPoint, snapToGrid, + refresh = instantiationManager.updateSingleClick(scaledPoint, ConfigurationManager + .getInstance().readBoolean(IPlugInPort.SNAP_TO_GRID_KEY, true), currentProject.getGridSpacing()); break; } @@ -712,7 +712,8 @@ public class Presenter implements IPlugInPort { if (isFirst) { isFirst = false; controlPoints[index].translate(dx, dy); - if (snapToGrid) { + if (ConfigurationManager.getInstance().readBoolean( + IPlugInPort.SNAP_TO_GRID_KEY, true)) { CalcUtils.snapPointToGrid(controlPoints[index], currentProject .getGridSpacing()); } diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/plugins/config/ConfigPlugin.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/plugins/config/ConfigPlugin.java index f824dde8..c0f7bf1e 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/plugins/config/ConfigPlugin.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/swing/plugins/config/ConfigPlugin.java @@ -46,6 +46,8 @@ public class ConfigPlugin implements IPlugIn { "Sticky Points", IPlugInPort.STICKY_POINTS_KEY, true), CONFIG_MENU); swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort, "Export Grid", IPlugInPort.EXPORT_GRID_KEY, false), CONFIG_MENU); + swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort, + "Snap to Grid", IPlugInPort.SNAP_TO_GRID_KEY, true), CONFIG_MENU); File themeDir = new File("themes"); if (themeDir.exists()) { XStream xStream = new XStream(new DomDriver()); diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/update.xml b/ diy-layout-creator --username bancika@gmail.com/DIYLC/update.xml index 16ef009a..32905f83 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/update.xml +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/update.xml @@ -244,6 +244,10 @@ NEW_FEATURE Sticky points may be turned off + + NEW_FEATURE + Snap to Grid may be turned off + http://code.google.com/p/diy-layout-creator/downloads/list