mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
auto-create pads
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
<map>
|
<map>
|
||||||
|
<entry>
|
||||||
|
<string>default.org.diylc.components.passive.TrimmerPotentiometer:Type</string>
|
||||||
|
<org.diylc.components.passive.TrimmerPotentiometer_-TrimmerType>FLAT_LARGE</org.diylc.components.passive.TrimmerPotentiometer_-TrimmerType>
|
||||||
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>lastPath</string>
|
<string>lastPath</string>
|
||||||
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
||||||
@@ -25,13 +29,17 @@
|
|||||||
</gridColor>
|
</gridColor>
|
||||||
</org.diylc.core.Theme>
|
</org.diylc.core.Theme>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>autoCreatePads</string>
|
||||||
|
<boolean>false</boolean>
|
||||||
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>antiAliasing</string>
|
<string>antiAliasing</string>
|
||||||
<boolean>true</boolean>
|
<boolean>true</boolean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>snapToGrid</string>
|
<string>snapToGrid</string>
|
||||||
<boolean>false</boolean>
|
<boolean>true</boolean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>hiQualityRender</string>
|
<string>hiQualityRender</string>
|
||||||
|
|||||||
Binary file not shown.
@@ -40,6 +40,8 @@ public class DIYLCStarter {
|
|||||||
LOG.error("Could not initialize log4j configuration", 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"));
|
LOG.info("Starting DIYLC with working directory " + System.getProperty("user.dir"));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
+1
@@ -38,6 +38,7 @@ public interface IPlugInPort {
|
|||||||
public static final String STICKY_POINTS_KEY = "stickyPoints";
|
public static final String STICKY_POINTS_KEY = "stickyPoints";
|
||||||
public static final String METRIC_KEY = "metric";
|
public static final String METRIC_KEY = "metric";
|
||||||
public static final String SNAP_TO_GRID_KEY = "snapToGrid";
|
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
|
* Returns size of the canvas that takes project dimensions into account as
|
||||||
|
|||||||
+17
-4
@@ -27,6 +27,7 @@ import org.diylc.common.IComponentFiler;
|
|||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
|
import org.diylc.components.connectivity.SolderPad;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
@@ -364,7 +365,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
IDIYComponent<?> component = instantiationManager.instantiateComponent(
|
IDIYComponent<?> component = instantiationManager.instantiateComponent(
|
||||||
componentTypeSlot, scaledPoint, currentProject);
|
componentTypeSlot, scaledPoint, currentProject);
|
||||||
addComponent(component, componentTypeSlot);
|
addComponent(component, componentTypeSlot, true);
|
||||||
// Select the new component
|
// Select the new component
|
||||||
// messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED,
|
// messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED,
|
||||||
// selectedComponents);
|
// selectedComponents);
|
||||||
@@ -402,7 +403,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
// On the second click, add the component to the project.
|
// On the second click, add the component to the project.
|
||||||
IDIYComponent<?> componentSlot = instantiationManager.getComponentSlot();
|
IDIYComponent<?> componentSlot = instantiationManager.getComponentSlot();
|
||||||
componentSlot.setControlPoint(scaledPoint, 1);
|
componentSlot.setControlPoint(scaledPoint, 1);
|
||||||
addComponent(componentSlot, componentTypeSlot);
|
addComponent(componentSlot, componentTypeSlot, true);
|
||||||
// Select the new component if it's not locked.
|
// Select the new component if it's not locked.
|
||||||
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>();
|
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>();
|
||||||
if (!isComponentLocked(componentSlot)) {
|
if (!isComponentLocked(componentSlot)) {
|
||||||
@@ -835,7 +836,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
component.setControlPoint(point, i);
|
component.setControlPoint(point, i);
|
||||||
}
|
}
|
||||||
addComponent(component, ComponentProcessor.getInstance().extractComponentTypeFrom(
|
addComponent(component, ComponentProcessor.getInstance().extractComponentTypeFrom(
|
||||||
(Class<? extends IDIYComponent<?>>) component.getClass()));
|
(Class<? extends IDIYComponent<?>>) component.getClass()), false);
|
||||||
}
|
}
|
||||||
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, cloner
|
messageDispatcher.dispatchMessage(EventType.PROJECT_MODIFIED, oldProject, cloner
|
||||||
.deepClone(currentProject), "Add");
|
.deepClone(currentProject), "Add");
|
||||||
@@ -1100,7 +1101,8 @@ public class Presenter implements IPlugInPort {
|
|||||||
* @param component
|
* @param component
|
||||||
* @param componentType
|
* @param componentType
|
||||||
*/
|
*/
|
||||||
private void addComponent(IDIYComponent<?> component, ComponentType componentType) {
|
private void addComponent(IDIYComponent<?> component, ComponentType componentType,
|
||||||
|
boolean canCreatePads) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while (index < currentProject.getComponents().size()
|
while (index < currentProject.getComponents().size()
|
||||||
&& componentType.getZOrder() >= ComponentProcessor.getInstance()
|
&& componentType.getZOrder() >= ComponentProcessor.getInstance()
|
||||||
@@ -1114,6 +1116,17 @@ public class Presenter implements IPlugInPort {
|
|||||||
} else {
|
} else {
|
||||||
currentProject.getComponents().add(component);
|
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
|
@Override
|
||||||
|
|||||||
+2
@@ -48,6 +48,8 @@ public class ConfigPlugin implements IPlugIn {
|
|||||||
"Export Grid", IPlugInPort.EXPORT_GRID_KEY, false), CONFIG_MENU);
|
"Export Grid", IPlugInPort.EXPORT_GRID_KEY, false), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
||||||
"Snap to Grid", IPlugInPort.SNAP_TO_GRID_KEY, true), CONFIG_MENU);
|
"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");
|
File themeDir = new File("themes");
|
||||||
if (themeDir.exists()) {
|
if (themeDir.exists()) {
|
||||||
XStream xStream = new XStream(new DomDriver());
|
XStream xStream = new XStream(new DomDriver());
|
||||||
|
|||||||
@@ -248,6 +248,10 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Snap to Grid may be turned off</description>
|
<description>Snap to Grid may be turned off</description>
|
||||||
</com.diyfever.gui.update.Change>
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Auto-create solder pads</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>http://code.google.com/p/diy-layout-creator/downloads/list
|
<url>http://code.google.com/p/diy-layout-creator/downloads/list
|
||||||
</url>
|
</url>
|
||||||
|
|||||||
Reference in New Issue
Block a user