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 3f4471bf..96dcbee2 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml @@ -1,4 +1,8 @@ + + default.org.diylc.components.passive.TrimmerPotentiometer:Type + FLAT_LARGE + lastPath C:\Documents and Settings\Branislav Stojkovic\Desktop @@ -25,13 +29,17 @@ + + autoCreatePads + false + antiAliasing true snapToGrid - false + true hiQualityRender diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar b/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar index 5e7bf539..1924c119 100644 Binary files a/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar and b/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar differ diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/DIYLCStarter.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/DIYLCStarter.java index 512a8a60..850c355f 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/DIYLCStarter.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/DIYLCStarter.java @@ -39,6 +39,8 @@ public class DIYLCStarter { } catch (Exception e) { LOG.error("Could not initialize log4j configuration", e); } + + LOG.debug("Java version: " + System.getProperty("java.runtime.version") + " by " + System.getProperty("java.vm.vendor")); LOG.info("Starting DIYLC with working directory " + System.getProperty("user.dir")); 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 dd17e617..91aecc47 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 @@ -38,6 +38,7 @@ public interface IPlugInPort { public static final String STICKY_POINTS_KEY = "stickyPoints"; public static final String METRIC_KEY = "metric"; public static final String SNAP_TO_GRID_KEY = "snapToGrid"; + public static final String AUTO_PADS_KEY = "autoCreatePads"; /** * 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 9fcac554..3b5ffcc3 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 @@ -27,6 +27,7 @@ import org.diylc.common.IComponentFiler; import org.diylc.common.IPlugIn; import org.diylc.common.IPlugInPort; import org.diylc.common.PropertyWrapper; +import org.diylc.components.connectivity.SolderPad; import org.diylc.core.IDIYComponent; import org.diylc.core.IView; import org.diylc.core.Project; @@ -364,7 +365,7 @@ public class Presenter implements IPlugInPort { } IDIYComponent component = instantiationManager.instantiateComponent( componentTypeSlot, scaledPoint, currentProject); - addComponent(component, componentTypeSlot); + addComponent(component, componentTypeSlot, true); // Select the new component // messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED, // selectedComponents); @@ -402,7 +403,7 @@ public class Presenter implements IPlugInPort { // On the second click, add the component to the project. IDIYComponent componentSlot = instantiationManager.getComponentSlot(); componentSlot.setControlPoint(scaledPoint, 1); - addComponent(componentSlot, componentTypeSlot); + addComponent(componentSlot, componentTypeSlot, true); // Select the new component if it's not locked. List> newSelection = new ArrayList>(); if (!isComponentLocked(componentSlot)) { @@ -835,7 +836,7 @@ public class Presenter implements IPlugInPort { component.setControlPoint(point, i); } addComponent(component, ComponentProcessor.getInstance().extractComponentTypeFrom( - (Class>) component.getClass())); + (Class>) component.getClass()), false); } messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, cloner .deepClone(currentProject), "Add"); @@ -1100,7 +1101,8 @@ public class Presenter implements IPlugInPort { * @param component * @param componentType */ - private void addComponent(IDIYComponent component, ComponentType componentType) { + private void addComponent(IDIYComponent component, ComponentType componentType, + boolean canCreatePads) { int index = 0; while (index < currentProject.getComponents().size() && componentType.getZOrder() >= ComponentProcessor.getInstance() @@ -1114,6 +1116,17 @@ public class Presenter implements IPlugInPort { } else { currentProject.getComponents().add(component); } + if (canCreatePads + && ConfigurationManager.getInstance().readBoolean(IPlugInPort.AUTO_PADS_KEY, false)) { + for (int i = 0; i < component.getControlPointCount(); i++) { + if (component.isControlPointSticky(i)) { + SolderPad pad = new SolderPad(); + pad.setControlPoint(component.getControlPoint(i), 0); + addComponent(pad, ComponentProcessor.getInstance().extractComponentTypeFrom( + SolderPad.class), false); + } + } + } } @Override 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 c0f7bf1e..56a7c9bf 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 @@ -48,6 +48,8 @@ public class ConfigPlugin implements IPlugIn { "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); + swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort, + "Auto-Create Pads", IPlugInPort.AUTO_PADS_KEY, false), 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 32905f83..e42485fc 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/update.xml +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/update.xml @@ -248,6 +248,10 @@ NEW_FEATURE Snap to Grid may be turned off + + NEW_FEATURE + Auto-create solder pads + http://code.google.com/p/diy-layout-creator/downloads/list