mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
switchable sticky points
added themes fixed ruler precision improved board rendering
This commit is contained in:
@@ -9,9 +9,9 @@
|
|||||||
<classpathentry kind="lib" path="lib/iText-2.1.7.jar"/>
|
<classpathentry kind="lib" path="lib/iText-2.1.7.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/cloning-1.5.jar"/>
|
<classpathentry kind="lib" path="lib/cloning-1.5.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/objenesis-1.1.jar"/>
|
<classpathentry kind="lib" path="lib/objenesis-1.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/bancika-gui-framework.jar"/>
|
|
||||||
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
|
<classpathentry kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
|
||||||
<classpathentry kind="lib" path="library/main.jar"/>
|
<classpathentry kind="lib" path="library/main.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/bancika-gui-framework.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,15 +1,43 @@
|
|||||||
<map>
|
<map>
|
||||||
<entry>
|
<entry>
|
||||||
<string>metric</string>
|
<string>lastPath</string>
|
||||||
<boolean>false</boolean>
|
<string>C:\Documents and Settings\Branislav Stojkovic\My Documents\Downloads</string>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>zoom</string>
|
<string>zoom</string>
|
||||||
<double>1.0</double>
|
<double>1.0</double>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>lastPath</string>
|
<string>metric</string>
|
||||||
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>stickyPoints</string>
|
||||||
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>theme</string>
|
||||||
|
<org.diylc.core.Theme>
|
||||||
|
<name>White Realistic</name>
|
||||||
|
<bgColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</bgColor>
|
||||||
|
<gridColor>
|
||||||
|
<red>240</red>
|
||||||
|
<green>240</green>
|
||||||
|
<blue>240</blue>
|
||||||
|
<alpha>240</alpha>
|
||||||
|
</gridColor>
|
||||||
|
<labelColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</labelColor>
|
||||||
|
</org.diylc.core.Theme>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>antiAliasing</string>
|
<string>antiAliasing</string>
|
||||||
@@ -17,12 +45,16 @@
|
|||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>hiQualityRender</string>
|
<string>hiQualityRender</string>
|
||||||
<boolean>false</boolean>
|
<boolean>true</boolean>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>showTemplatesAtStartup</string>
|
<string>showTemplatesAtStartup</string>
|
||||||
<boolean>false</boolean>
|
<boolean>false</boolean>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>exportGrid</string>
|
||||||
|
<boolean>true</boolean>
|
||||||
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
<string>default.org.diylc.components.semiconductors.TransistorTO92:Orientation</string>
|
<string>default.org.diylc.components.semiconductors.TransistorTO92:Orientation</string>
|
||||||
<org.diylc.common.Orientation>DEFAULT</org.diylc.common.Orientation>
|
<org.diylc.common.Orientation>DEFAULT</org.diylc.common.Orientation>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+17
-2
@@ -11,6 +11,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.swing.plugins.edit.ComponentTransferable;
|
import org.diylc.swing.plugins.edit.ComponentTransferable;
|
||||||
|
|
||||||
import com.diyfever.gui.simplemq.IMessageListener;
|
import com.diyfever.gui.simplemq.IMessageListener;
|
||||||
@@ -30,9 +31,11 @@ import com.diyfever.gui.update.VersionNumber;
|
|||||||
* @see EventType
|
* @see EventType
|
||||||
*/
|
*/
|
||||||
public interface IPlugInPort {
|
public interface IPlugInPort {
|
||||||
|
|
||||||
public static final String ANTI_ALIASING_KEY = "antiAliasing";
|
public static final String ANTI_ALIASING_KEY = "antiAliasing";
|
||||||
public static final String HI_QUALITY_RENDER_KEY = "hiQualityRender";
|
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";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns size of the canvas that takes project dimensions into account as
|
* Returns size of the canvas that takes project dimensions into account as
|
||||||
@@ -330,9 +333,21 @@ public interface IPlugInPort {
|
|||||||
* Brings each of the selected components one step to front.
|
* Brings each of the selected components one step to front.
|
||||||
*/
|
*/
|
||||||
void bringSelectionToFront();
|
void bringSelectionToFront();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes the display to refresh.
|
* Causes the display to refresh.
|
||||||
*/
|
*/
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return currently selected theme.
|
||||||
|
*/
|
||||||
|
Theme getSelectedTheme();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the current theme.
|
||||||
|
*
|
||||||
|
* @param theme
|
||||||
|
*/
|
||||||
|
void setSelectedTheme(Theme theme);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
|
|||||||
public static Color SELECTION_COLOR = Color.red;
|
public static Color SELECTION_COLOR = Color.red;
|
||||||
public static Color LABEL_COLOR = Color.black;
|
public static Color LABEL_COLOR = Color.black;
|
||||||
public static Color LABEL_COLOR_SELECTED = Color.red;
|
public static Color LABEL_COLOR_SELECTED = Color.red;
|
||||||
public static Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 12);
|
public static Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 14);
|
||||||
|
|
||||||
@EditableProperty(defaultable = false)
|
@EditableProperty(defaultable = false)
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
@@ -39,6 +39,7 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
|
|||||||
* @param curve
|
* @param curve
|
||||||
* @param g2d
|
* @param g2d
|
||||||
* @param componentState
|
* @param componentState
|
||||||
|
* @param theme
|
||||||
*/
|
*/
|
||||||
protected abstract void drawCurve(CubicCurve2D curve, Graphics2D g2d,
|
protected abstract void drawCurve(CubicCurve2D curve, Graphics2D g2d,
|
||||||
ComponentState componentState);
|
ComponentState componentState);
|
||||||
|
|||||||
+20
-12
@@ -69,12 +69,14 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness()));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness()));
|
||||||
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
|
Color leadColor = shouldShadeLeads() ? getLeadColor(componentState).darker()
|
||||||
: getLeadColor(componentState));
|
: getLeadColor(componentState);
|
||||||
|
g2d.setColor(leadColor);
|
||||||
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
||||||
if (shouldShadeLeads()) {
|
if (shouldShadeLeads()) {
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness() - 2));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness() - 2));
|
||||||
g2d.setColor(getLeadColor(componentState));
|
leadColor = getLeadColor(componentState);
|
||||||
|
g2d.setColor(leadColor);
|
||||||
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -94,19 +96,23 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
/ MAX_ALPHA));
|
/ MAX_ALPHA));
|
||||||
}
|
}
|
||||||
if (bodyColor != null) {
|
if (bodyColor != null) {
|
||||||
g2d.setColor(bodyColor);
|
if (bodyColor != null) {
|
||||||
g2d.fill(shape);
|
g2d.setColor(bodyColor);
|
||||||
|
g2d.fill(shape);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
decorateComponentBody(g2d);
|
decorateComponentBody(g2d);
|
||||||
g2d.setComposite(oldComposite);
|
g2d.setComposite(oldComposite);
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED
|
Color finalBorderColor = componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor;
|
||||||
|
g2d.setColor(finalBorderColor);
|
||||||
g2d.draw(shape);
|
g2d.draw(shape);
|
||||||
// Draw label.
|
// Draw label.
|
||||||
g2d.setFont(LABEL_FONT);
|
g2d.setFont(LABEL_FONT);
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED
|
Color finalLabelFont = componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED : labelColor);
|
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED : labelColor;
|
||||||
|
g2d.setColor(finalLabelFont);
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics();
|
FontMetrics fontMetrics = g2d.getFontMetrics();
|
||||||
String label = display == Display.NAME ? getName() : getValue().toString();
|
String label = display == Display.NAME ? getName() : getValue().toString();
|
||||||
// Adjust label angle if needed to make sure that it's readable.
|
// Adjust label angle if needed to make sure that it's readable.
|
||||||
@@ -123,8 +129,9 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
int leadThickness = getClosestOdd(getLeadThickness());
|
int leadThickness = getClosestOdd(getLeadThickness());
|
||||||
double leadLength = (distance - shapeRect.width) / 2 - leadThickness / 2;
|
double leadLength = (distance - shapeRect.width) / 2 - leadThickness / 2;
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness));
|
||||||
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
|
Color leadColor = shouldShadeLeads() ? getLeadColor(componentState).darker()
|
||||||
: getLeadColor(componentState));
|
: getLeadColor(componentState);
|
||||||
|
g2d.setColor(leadColor);
|
||||||
int endX = (int) (points[0].x + Math.cos(theta) * leadLength);
|
int endX = (int) (points[0].x + Math.cos(theta) * leadLength);
|
||||||
int endY = (int) Math.round(points[0].y + Math.sin(theta) * leadLength);
|
int endY = (int) Math.round(points[0].y + Math.sin(theta) * leadLength);
|
||||||
g2d.drawLine(points[0].x, points[0].y, endX, endY);
|
g2d.drawLine(points[0].x, points[0].y, endX, endY);
|
||||||
@@ -133,7 +140,8 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
g2d.drawLine(points[1].x, points[1].y, endX, endY);
|
g2d.drawLine(points[1].x, points[1].y, endX, endY);
|
||||||
if (shouldShadeLeads()) {
|
if (shouldShadeLeads()) {
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness - 2));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness - 2));
|
||||||
g2d.setColor(getLeadColor(componentState));
|
leadColor = getLeadColor(componentState);
|
||||||
|
g2d.setColor(leadColor);
|
||||||
g2d.drawLine(points[0].x, points[0].y, (int) (points[0].x + Math.cos(theta)
|
g2d.drawLine(points[0].x, points[0].y, (int) (points[0].x + Math.cos(theta)
|
||||||
* leadLength), (int) (points[0].y + Math.sin(theta) * leadLength));
|
* leadLength), (int) (points[0].y + Math.sin(theta) * leadLength));
|
||||||
g2d.drawLine(points[1].x, points[1].y, (int) (points[1].x + Math.cos(theta - Math.PI)
|
g2d.drawLine(points[1].x, points[1].y, (int) (points[1].x + Math.cos(theta - Math.PI)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public interface IView {
|
|||||||
public static final int OK_OPTION = 0;
|
public static final int OK_OPTION = 0;
|
||||||
|
|
||||||
public static final String CHECK_BOX_MENU_ITEM = "org.diylc.checkBoxMenuItem";
|
public static final String CHECK_BOX_MENU_ITEM = "org.diylc.checkBoxMenuItem";
|
||||||
|
public static final String RADIO_BUTTON_GROUP_KEY = "org.diylc.radioButtonGroup";
|
||||||
|
|
||||||
void showMessage(String message, String title, int messageType);
|
void showMessage(String message, String title, int messageType);
|
||||||
|
|
||||||
|
|||||||
@@ -12,17 +12,17 @@ public class Theme implements Serializable {
|
|||||||
private Color gridColor;
|
private Color gridColor;
|
||||||
private Color componentBodyColor;
|
private Color componentBodyColor;
|
||||||
private Color componentBorderColor;
|
private Color componentBorderColor;
|
||||||
private Color componentLabelColor;
|
private Color labelColor;
|
||||||
|
|
||||||
public Theme(String name, Color bgColor, Color gridColor, Color componentBodyColor,
|
public Theme(String name, Color bgColor, Color gridColor, Color componentBodyColor,
|
||||||
Color componentBorderColor, Color componentLabelColor) {
|
Color componentBorderColor, Color labelColor) {
|
||||||
super();
|
super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.bgColor = bgColor;
|
this.bgColor = bgColor;
|
||||||
this.gridColor = gridColor;
|
this.gridColor = gridColor;
|
||||||
this.componentBodyColor = componentBodyColor;
|
this.componentBodyColor = componentBodyColor;
|
||||||
this.componentBorderColor = componentBorderColor;
|
this.componentBorderColor = componentBorderColor;
|
||||||
this.componentLabelColor = componentLabelColor;
|
this.labelColor = labelColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -45,8 +45,8 @@ public class Theme implements Serializable {
|
|||||||
return componentBorderColor;
|
return componentBorderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color getComponentLabelColor() {
|
public Color getLabelColor() {
|
||||||
return componentLabelColor;
|
return labelColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,7 +59,7 @@ public class Theme implements Serializable {
|
|||||||
result = prime * result
|
result = prime * result
|
||||||
+ ((componentBorderColor == null) ? 0 : componentBorderColor.hashCode());
|
+ ((componentBorderColor == null) ? 0 : componentBorderColor.hashCode());
|
||||||
result = prime * result
|
result = prime * result
|
||||||
+ ((componentLabelColor == null) ? 0 : componentLabelColor.hashCode());
|
+ ((labelColor == null) ? 0 : labelColor.hashCode());
|
||||||
result = prime * result + ((gridColor == null) ? 0 : gridColor.hashCode());
|
result = prime * result + ((gridColor == null) ? 0 : gridColor.hashCode());
|
||||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||||
return result;
|
return result;
|
||||||
@@ -89,10 +89,10 @@ public class Theme implements Serializable {
|
|||||||
return false;
|
return false;
|
||||||
} else if (!componentBorderColor.equals(other.componentBorderColor))
|
} else if (!componentBorderColor.equals(other.componentBorderColor))
|
||||||
return false;
|
return false;
|
||||||
if (componentLabelColor == null) {
|
if (labelColor == null) {
|
||||||
if (other.componentLabelColor != null)
|
if (other.labelColor != null)
|
||||||
return false;
|
return false;
|
||||||
} else if (!componentLabelColor.equals(other.componentLabelColor))
|
} else if (!labelColor.equals(other.labelColor))
|
||||||
return false;
|
return false;
|
||||||
if (gridColor == null) {
|
if (gridColor == null) {
|
||||||
if (other.gridColor != null)
|
if (other.gridColor != null)
|
||||||
|
|||||||
+2
-1
@@ -30,7 +30,8 @@ public enum IconLoader {
|
|||||||
"faq.png"), Component("component.png"), Plugin("plugin.png"), Manual("manual.png"), Donate(
|
"faq.png"), Component("component.png"), Plugin("plugin.png"), Manual("manual.png"), Donate(
|
||||||
"donate.png"), Bug("bug.png"), IconLarge("icon_large.png"), IconMedium(
|
"donate.png"), Bug("bug.png"), IconLarge("icon_large.png"), IconMedium(
|
||||||
"icon_medium.png"), IconSmall("icon_small.png"), DocumentEdit("document_edit.png"), EditComponent(
|
"icon_medium.png"), IconSmall("icon_small.png"), DocumentEdit("document_edit.png"), EditComponent(
|
||||||
"edit_component.png"), Size("size.png"), Front("front.png"), Back("back.png");
|
"edit_component.png"), Size("size.png"), Front("front.png"), Back("back.png"), Pens(
|
||||||
|
"pens.png");
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 922 B |
+39
-20
@@ -26,6 +26,7 @@ import org.diylc.common.ObjectCache;
|
|||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
@@ -44,14 +45,17 @@ public class DrawingManager {
|
|||||||
|
|
||||||
public static int CONTROL_POINT_SIZE = 7;
|
public static int CONTROL_POINT_SIZE = 7;
|
||||||
|
|
||||||
public static final String ANTIALIASING_KEY = "anti-aliasing";
|
|
||||||
public static final String ZOOM_KEY = "zoom";
|
public static final String ZOOM_KEY = "zoom";
|
||||||
|
public static final String THEME_KEY = "theme";
|
||||||
public static boolean DEBUG_COMPONENT_AREAS = false;
|
public static boolean DEBUG_COMPONENT_AREAS = false;
|
||||||
|
|
||||||
public static Color GRID_COLOR = new Color(240, 240, 240);
|
public static Color GRID_COLOR = new Color(240, 240, 240);
|
||||||
public static Color CONTROL_POINT_COLOR = Color.black;
|
public static Color CONTROL_POINT_COLOR = Color.black;
|
||||||
public static Color SELECTED_CONTROL_POINT_COLOR = Color.green;
|
public static Color SELECTED_CONTROL_POINT_COLOR = Color.green;
|
||||||
|
|
||||||
|
private Theme theme = new Theme("White Realistic", Constants.CANVAS_COLOR, GRID_COLOR, null,
|
||||||
|
null, null);
|
||||||
|
|
||||||
// Keeps Area object of each drawn component.
|
// Keeps Area object of each drawn component.
|
||||||
private Map<IDIYComponent<?>, Area> componentAreaMap;
|
private Map<IDIYComponent<?>, Area> componentAreaMap;
|
||||||
// Maps components to the last state they are drawn in. Also, used to
|
// Maps components to the last state they are drawn in. Also, used to
|
||||||
@@ -72,6 +76,10 @@ public class DrawingManager {
|
|||||||
this.messageDispatcher = messageDispatcher;
|
this.messageDispatcher = messageDispatcher;
|
||||||
componentAreaMap = new HashMap<IDIYComponent<?>, Area>();
|
componentAreaMap = new HashMap<IDIYComponent<?>, Area>();
|
||||||
lastDrawnStateMap = new HashMap<IDIYComponent<?>, ComponentState>();
|
lastDrawnStateMap = new HashMap<IDIYComponent<?>, ComponentState>();
|
||||||
|
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(THEME_KEY, null);
|
||||||
|
if (theme != null) {
|
||||||
|
this.theme = theme;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,12 +153,11 @@ public class DrawingManager {
|
|||||||
// AffineTransform initialTx = g2d.getTransform();
|
// AffineTransform initialTx = g2d.getTransform();
|
||||||
Dimension d = getCanvasDimensions(project, zoom, true);
|
Dimension d = getCanvasDimensions(project, zoom, true);
|
||||||
|
|
||||||
g2dWrapper.setColor(Constants.CANVAS_COLOR);
|
g2dWrapper.setColor(theme.getBgColor());
|
||||||
g2dWrapper.fillRect(0, 0, d.width, d.height);
|
g2dWrapper.fillRect(0, 0, d.width, d.height);
|
||||||
g2d.clip(new Rectangle(new Point(0, 0), d));
|
g2d.clip(new Rectangle(new Point(0, 0), d));
|
||||||
|
|
||||||
GridType gridType = (GridType) ConfigurationManager.getInstance().readObject(
|
GridType gridType = GridType.LINES;
|
||||||
ANTIALIASING_KEY, GridType.LINES);
|
|
||||||
if (drawOptions.contains(DrawOption.GRID) && gridType != GridType.NONE) {
|
if (drawOptions.contains(DrawOption.GRID) && gridType != GridType.NONE) {
|
||||||
double zoomStep = project.getGridSpacing().convertToPixels() * zoom;
|
double zoomStep = project.getGridSpacing().convertToPixels() * zoom;
|
||||||
if (gridType == GridType.CROSSHAIR) {
|
if (gridType == GridType.CROSSHAIR) {
|
||||||
@@ -162,7 +169,7 @@ public class DrawingManager {
|
|||||||
10f, new float[] { 1f, (float) zoomStep - 1 }, 0f));
|
10f, new float[] { 1f, (float) zoomStep - 1 }, 0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
g2dWrapper.setColor(GRID_COLOR);
|
g2dWrapper.setColor(theme.getGridColor());
|
||||||
for (double i = zoomStep; i < d.width; i += zoomStep) {
|
for (double i = zoomStep; i < d.width; i += zoomStep) {
|
||||||
g2dWrapper.drawLine((int) i, 0, (int) i, d.height - 1);
|
g2dWrapper.drawLine((int) i, 0, (int) i, d.height - 1);
|
||||||
}
|
}
|
||||||
@@ -224,22 +231,24 @@ public class DrawingManager {
|
|||||||
// Draw control points.
|
// Draw control points.
|
||||||
if (drawOptions.contains(DrawOption.CONTROL_POINTS)) {
|
if (drawOptions.contains(DrawOption.CONTROL_POINTS)) {
|
||||||
// Draw unselected points first to make sure they are below.
|
// Draw unselected points first to make sure they are below.
|
||||||
for (IDIYComponent<?> component : project.getComponents()) {
|
if (dragInProgress) {
|
||||||
for (int i = 0; i < component.getControlPointCount(); i++) {
|
for (IDIYComponent<?> component : project.getComponents()) {
|
||||||
VisibilityPolicy visibilityPolicy = component
|
for (int i = 0; i < component.getControlPointCount(); i++) {
|
||||||
.getControlPointVisibilityPolicy(i);
|
VisibilityPolicy visibilityPolicy = component
|
||||||
if ((groupedComponents.contains(component)
|
.getControlPointVisibilityPolicy(i);
|
||||||
&& (visibilityPolicy == VisibilityPolicy.ALWAYS || (selectedComponents
|
if ((groupedComponents.contains(component)
|
||||||
.contains(component) && visibilityPolicy == VisibilityPolicy.WHEN_SELECTED)) || (!groupedComponents
|
&& (visibilityPolicy == VisibilityPolicy.ALWAYS || (selectedComponents
|
||||||
.contains(component)
|
.contains(component) && visibilityPolicy == VisibilityPolicy.WHEN_SELECTED)) || (!groupedComponents
|
||||||
&& !selectedComponents.contains(component) && component
|
.contains(component)
|
||||||
.getControlPointVisibilityPolicy(i) == VisibilityPolicy.ALWAYS))) {
|
&& !selectedComponents.contains(component) && component
|
||||||
g2dWrapper.setColor(CONTROL_POINT_COLOR);
|
.getControlPointVisibilityPolicy(i) == VisibilityPolicy.ALWAYS))) {
|
||||||
|
g2dWrapper.setColor(CONTROL_POINT_COLOR);
|
||||||
|
|
||||||
Point controlPoint = component.getControlPoint(i);
|
Point controlPoint = component.getControlPoint(i);
|
||||||
int pointSize = CONTROL_POINT_SIZE - 2;
|
int pointSize = CONTROL_POINT_SIZE - 2;
|
||||||
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
|
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
|
||||||
- pointSize / 2, pointSize, pointSize);
|
- pointSize / 2, pointSize, pointSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -373,4 +382,14 @@ public class DrawingManager {
|
|||||||
messageDispatcher.dispatchMessage(EventType.ZOOM_CHANGED, zoomLevel);
|
messageDispatcher.dispatchMessage(EventType.ZOOM_CHANGED, zoomLevel);
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Theme getTheme() {
|
||||||
|
return theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTheme(Theme theme) {
|
||||||
|
this.theme = theme;
|
||||||
|
ConfigurationManager.getInstance().writeValue(THEME_KEY, theme);
|
||||||
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-8
@@ -30,6 +30,7 @@ import org.diylc.common.PropertyWrapper;
|
|||||||
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;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
import org.diylc.swing.plugins.edit.ComponentTransferable;
|
import org.diylc.swing.plugins.edit.ComponentTransferable;
|
||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
@@ -594,7 +595,12 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Expand control points to include all stuck components.
|
// Expand control points to include all stuck components.
|
||||||
if (!ctrlDown) {
|
boolean sticky = ConfigurationManager.getInstance().readBoolean(
|
||||||
|
IPlugInPort.STICKY_POINTS_KEY, true);
|
||||||
|
if (ctrlDown) {
|
||||||
|
sticky = !sticky;
|
||||||
|
}
|
||||||
|
if (sticky) {
|
||||||
includeStuckComponents(controlPointMap);
|
includeStuckComponents(controlPointMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -691,8 +697,9 @@ public class Presenter implements IPlugInPort {
|
|||||||
int actualDy = 0;
|
int actualDy = 0;
|
||||||
|
|
||||||
// For each component, do a simulation of the move to see if any of
|
// For each component, do a simulation of the move to see if any of
|
||||||
// them will
|
// them will overlap or go out of bounds.
|
||||||
// overlap.
|
int width = (int) currentProject.getWidth().convertToPixels();
|
||||||
|
int height = (int) currentProject.getHeight().convertToPixels();
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
for (Map.Entry<IDIYComponent<?>, Set<Integer>> entry : controlPointMap.entrySet()) {
|
for (Map.Entry<IDIYComponent<?>, Set<Integer>> entry : controlPointMap.entrySet()) {
|
||||||
IDIYComponent<?> component = entry.getKey();
|
IDIYComponent<?> component = entry.getKey();
|
||||||
@@ -715,8 +722,15 @@ public class Presenter implements IPlugInPort {
|
|||||||
// Nothing to move.
|
// Nothing to move.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
controlPoints[index].translate(actualDx, actualDy);
|
// else {
|
||||||
|
controlPoints[index].translate(actualDx, actualDy);
|
||||||
|
if (controlPoints[index].x < 0 || controlPoints[index].y < 0
|
||||||
|
|| controlPoints[index].x > width
|
||||||
|
|| controlPoints[index].y > height) {
|
||||||
|
// At least one control point went out of bounds.
|
||||||
|
return true;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For control points that may overlap, just write null,
|
// For control points that may overlap, just write null,
|
||||||
@@ -730,7 +744,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
for (int j = i + 1; j < controlPoints.length; j++) {
|
for (int j = i + 1; j < controlPoints.length; j++) {
|
||||||
if (controlPoints[i] != null && controlPoints[j] != null
|
if (controlPoints[i] != null && controlPoints[j] != null
|
||||||
&& controlPoints[i].equals(controlPoints[j])) {
|
&& controlPoints[i].equals(controlPoints[j])) {
|
||||||
LOG.error("Control points collision detected, cannot make this move.");
|
LOG.warn("Control points collision detected, cannot make this move.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -977,12 +991,22 @@ public class Presenter implements IPlugInPort {
|
|||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Theme getSelectedTheme() {
|
||||||
|
return drawingManager.getTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectedTheme(Theme theme) {
|
||||||
|
drawingManager.setTheme(theme);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the selection with the specified {@link ComponentTransferable}.
|
* Updates the selection with the specified {@link ComponentTransferable}.
|
||||||
* Also, updates control point map with all components that are stuck to the
|
* Also, updates control point map with all components that are stuck to the
|
||||||
@@ -1000,7 +1024,9 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
controlPointMap.put(component, indices);
|
controlPointMap.put(component, indices);
|
||||||
}
|
}
|
||||||
includeStuckComponents(controlPointMap);
|
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.STICKY_POINTS_KEY, true)) {
|
||||||
|
includeStuckComponents(controlPointMap);
|
||||||
|
}
|
||||||
messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED, selectedComponents,
|
messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED, selectedComponents,
|
||||||
controlPointMap.keySet());
|
controlPointMap.keySet());
|
||||||
}
|
}
|
||||||
|
|||||||
+29
@@ -17,6 +17,7 @@ import org.diylc.common.ITask;
|
|||||||
import org.diylc.common.PropertyWrapper;
|
import org.diylc.common.PropertyWrapper;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IView;
|
import org.diylc.core.IView;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.images.IconLoader;
|
import org.diylc.images.IconLoader;
|
||||||
import org.diylc.swing.gui.DialogFactory;
|
import org.diylc.swing.gui.DialogFactory;
|
||||||
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
import org.diylc.swing.gui.editor.PropertyEditorDialog;
|
||||||
@@ -141,6 +142,10 @@ public class ActionFactory {
|
|||||||
boolean defaultValue) {
|
boolean defaultValue) {
|
||||||
return new ConfigAction(plugInPort, title, configKey, defaultValue);
|
return new ConfigAction(plugInPort, title, configKey, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ThemeAction createThemeAction(IPlugInPort plugInPort, Theme theme) {
|
||||||
|
return new ThemeAction(plugInPort, theme);
|
||||||
|
}
|
||||||
|
|
||||||
// File menu actions.
|
// File menu actions.
|
||||||
|
|
||||||
@@ -825,4 +830,28 @@ public class ActionFactory {
|
|||||||
plugInPort.refresh();
|
plugInPort.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class ThemeAction extends AbstractAction {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private IPlugInPort plugInPort;
|
||||||
|
private Theme theme;
|
||||||
|
|
||||||
|
public ThemeAction(IPlugInPort plugInPort, Theme theme) {
|
||||||
|
super();
|
||||||
|
this.plugInPort = plugInPort;
|
||||||
|
this.theme = theme;
|
||||||
|
putValue(AbstractAction.NAME, theme.getName());
|
||||||
|
putValue(IView.RADIO_BUTTON_GROUP_KEY, "theme");
|
||||||
|
putValue(AbstractAction.SELECTED_KEY, plugInPort.getSelectedTheme().getName().equals(
|
||||||
|
theme.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
LOG.info(getValue(AbstractAction.NAME) + " triggered");
|
||||||
|
plugInPort.setSelectedTheme(theme);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
@@ -15,6 +15,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.ButtonGroup;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
import javax.swing.JCheckBoxMenuItem;
|
import javax.swing.JCheckBoxMenuItem;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
@@ -23,6 +24,7 @@ import javax.swing.JMenu;
|
|||||||
import javax.swing.JMenuBar;
|
import javax.swing.JMenuBar;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JRadioButtonMenuItem;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.SwingWorker;
|
import javax.swing.SwingWorker;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
@@ -62,6 +64,7 @@ public class MainFrame extends JFrame implements ISwingUI {
|
|||||||
|
|
||||||
private JMenuBar mainMenuBar;
|
private JMenuBar mainMenuBar;
|
||||||
private Map<String, JMenu> menuMap;
|
private Map<String, JMenu> menuMap;
|
||||||
|
private Map<String, ButtonGroup> buttonGroupMap;
|
||||||
|
|
||||||
private CanvasPlugin canvasPlugin;
|
private CanvasPlugin canvasPlugin;
|
||||||
|
|
||||||
@@ -71,6 +74,7 @@ public class MainFrame extends JFrame implements ISwingUI {
|
|||||||
setPreferredSize(new Dimension(800, 600));
|
setPreferredSize(new Dimension(800, 600));
|
||||||
createBasePanels();
|
createBasePanels();
|
||||||
menuMap = new HashMap<String, JMenu>();
|
menuMap = new HashMap<String, JMenu>();
|
||||||
|
buttonGroupMap = new HashMap<String, ButtonGroup>();
|
||||||
setIconImages(Arrays.asList(IconLoader.IconSmall.getImage(), IconLoader.IconMedium
|
setIconImages(Arrays.asList(IconLoader.IconSmall.getImage(), IconLoader.IconMedium
|
||||||
.getImage(), IconLoader.IconLarge.getImage()));
|
.getImage(), IconLoader.IconLarge.getImage()));
|
||||||
DialogFactory.getInstance().initialize(this);
|
DialogFactory.getInstance().initialize(this);
|
||||||
@@ -239,8 +243,20 @@ public class MainFrame extends JFrame implements ISwingUI {
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
} else {
|
} else {
|
||||||
Boolean isCheckBox = (Boolean) action.getValue(IView.CHECK_BOX_MENU_ITEM);
|
Boolean isCheckBox = (Boolean) action.getValue(IView.CHECK_BOX_MENU_ITEM);
|
||||||
|
String groupName = (String) action.getValue(IView.RADIO_BUTTON_GROUP_KEY);
|
||||||
if (isCheckBox != null && isCheckBox) {
|
if (isCheckBox != null && isCheckBox) {
|
||||||
menu.add(new JCheckBoxMenuItem(action));
|
menu.add(new JCheckBoxMenuItem(action));
|
||||||
|
} else if (groupName != null) {
|
||||||
|
ButtonGroup group;
|
||||||
|
if (buttonGroupMap.containsKey(groupName)) {
|
||||||
|
group = buttonGroupMap.get(groupName);
|
||||||
|
} else {
|
||||||
|
group = new ButtonGroup();
|
||||||
|
buttonGroupMap.put(groupName, group);
|
||||||
|
}
|
||||||
|
JRadioButtonMenuItem item = new JRadioButtonMenuItem(action);
|
||||||
|
group.add(item);
|
||||||
|
menu.add(item);
|
||||||
} else {
|
} else {
|
||||||
menu.add(action);
|
menu.add(action);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -112,7 +112,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
private RulerScrollPane getScrollPane() {
|
private RulerScrollPane getScrollPane() {
|
||||||
if (scrollPane == null) {
|
if (scrollPane == null) {
|
||||||
scrollPane = new RulerScrollPane(getCanvasPanel(), new ProjectDrawingProvider(
|
scrollPane = new RulerScrollPane(getCanvasPanel(), new ProjectDrawingProvider(
|
||||||
plugInPort, true), (int) new Size(1d, SizeUnit.cm).convertToPixels(), (int) new Size(1d,
|
plugInPort, true), new Size(1d, SizeUnit.cm).convertToPixels(), new Size(1d,
|
||||||
SizeUnit.in).convertToPixels());
|
SizeUnit.in).convertToPixels());
|
||||||
boolean metric = ConfigurationManager.getInstance().readBoolean(Presenter.METRIC_KEY,
|
boolean metric = ConfigurationManager.getInstance().readBoolean(Presenter.METRIC_KEY,
|
||||||
true);
|
true);
|
||||||
@@ -271,7 +271,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
(int) (visibleRect.y * zoomFactor), visibleRect.width, visibleRect.height);
|
(int) (visibleRect.y * zoomFactor), visibleRect.width, visibleRect.height);
|
||||||
canvasPanel.scrollRectToVisible(visibleRect);
|
canvasPanel.scrollRectToVisible(visibleRect);
|
||||||
canvasPanel.revalidate();
|
canvasPanel.revalidate();
|
||||||
|
|
||||||
zoomLevel = (Double) params[0];
|
zoomLevel = (Double) params[0];
|
||||||
break;
|
break;
|
||||||
case REPAINT:
|
case REPAINT:
|
||||||
|
|||||||
+34
@@ -1,13 +1,22 @@
|
|||||||
package org.diylc.swing.plugins.config;
|
package org.diylc.swing.plugins.config;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.common.EventType;
|
import org.diylc.common.EventType;
|
||||||
import org.diylc.common.IPlugIn;
|
import org.diylc.common.IPlugIn;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
|
import org.diylc.images.IconLoader;
|
||||||
import org.diylc.swing.ActionFactory;
|
import org.diylc.swing.ActionFactory;
|
||||||
import org.diylc.swing.ISwingUI;
|
import org.diylc.swing.ISwingUI;
|
||||||
|
|
||||||
|
import com.thoughtworks.xstream.XStream;
|
||||||
|
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls configuration menu.
|
* Controls configuration menu.
|
||||||
*
|
*
|
||||||
@@ -15,7 +24,10 @@ import org.diylc.swing.ISwingUI;
|
|||||||
*/
|
*/
|
||||||
public class ConfigPlugin implements IPlugIn {
|
public class ConfigPlugin implements IPlugIn {
|
||||||
|
|
||||||
|
private static final Logger LOG = Logger.getLogger(ConfigPlugin.class);
|
||||||
|
|
||||||
private static final String CONFIG_MENU = "Config";
|
private static final String CONFIG_MENU = "Config";
|
||||||
|
private static final String THEME_MENU = "Theme";
|
||||||
|
|
||||||
private ISwingUI swingUI;
|
private ISwingUI swingUI;
|
||||||
|
|
||||||
@@ -30,6 +42,28 @@ public class ConfigPlugin implements IPlugIn {
|
|||||||
"Anti-Aliasing", IPlugInPort.ANTI_ALIASING_KEY, true), CONFIG_MENU);
|
"Anti-Aliasing", IPlugInPort.ANTI_ALIASING_KEY, true), CONFIG_MENU);
|
||||||
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
||||||
"Hi-Quality Rendering", IPlugInPort.HI_QUALITY_RENDER_KEY, false), CONFIG_MENU);
|
"Hi-Quality Rendering", IPlugInPort.HI_QUALITY_RENDER_KEY, false), CONFIG_MENU);
|
||||||
|
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
||||||
|
"Sticky Points", IPlugInPort.STICKY_POINTS_KEY, true), CONFIG_MENU);
|
||||||
|
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
|
||||||
|
"Export Grid", IPlugInPort.EXPORT_GRID_KEY, false), CONFIG_MENU);
|
||||||
|
File themeDir = new File("themes");
|
||||||
|
if (themeDir.exists()) {
|
||||||
|
XStream xStream = new XStream(new DomDriver());
|
||||||
|
swingUI.injectSubmenu(THEME_MENU, IconLoader.Pens.getIcon(), CONFIG_MENU);
|
||||||
|
for (File file : themeDir.listFiles()) {
|
||||||
|
if (file.getName().toLowerCase().endsWith(".xml")) {
|
||||||
|
try {
|
||||||
|
InputStream in = new FileInputStream(file);
|
||||||
|
Theme theme = (Theme) xStream.fromXML(in);
|
||||||
|
LOG.debug("Found theme: " + theme.getName());
|
||||||
|
swingUI.injectMenuAction(ActionFactory.getInstance().createThemeAction(
|
||||||
|
plugInPort, theme), THEME_MENU);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Could not load theme file " + file.getName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+4
@@ -9,6 +9,7 @@ import org.diylc.common.DrawOption;
|
|||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
|
|
||||||
import com.diyfever.gui.IDrawingProvider;
|
import com.diyfever.gui.IDrawingProvider;
|
||||||
|
import com.diyfever.gui.miscutils.ConfigurationManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link IDrawingProvider} implementation that uses {@link IPlugInPort} to draw
|
* {@link IDrawingProvider} implementation that uses {@link IPlugInPort} to draw
|
||||||
@@ -33,6 +34,9 @@ public class ProjectDrawingProvider implements IDrawingProvider {
|
|||||||
if (useZoom) {
|
if (useZoom) {
|
||||||
options.add(DrawOption.ZOOM);
|
options.add(DrawOption.ZOOM);
|
||||||
}
|
}
|
||||||
|
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.EXPORT_GRID_KEY, false)) {
|
||||||
|
options.add(DrawOption.GRID);
|
||||||
|
}
|
||||||
plugInPort.draw((Graphics2D) g, options, null);
|
plugInPort.draw((Graphics2D) g, options, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ import java.awt.Toolkit;
|
|||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
public static final int PIXELS_PER_INCH = 150;
|
public static final int PIXELS_PER_INCH = 200;
|
||||||
public static final double PIXEL_SIZE = 1d * PIXELS_PER_INCH
|
public static final double PIXEL_SIZE = 1d * PIXELS_PER_INCH
|
||||||
/ Toolkit.getDefaultToolkit().getScreenResolution();
|
/ Toolkit.getDefaultToolkit().getScreenResolution();
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -45,7 +46,7 @@ public class MockDIYComponent implements IDIYComponent<Capacitance> {
|
|||||||
public MockDIYComponent() {
|
public MockDIYComponent() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canControlPointOverlap(int index) {
|
public boolean canControlPointOverlap(int index) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<org.diylc.core.Theme>
|
||||||
|
<name>Blueprint</name>
|
||||||
|
<bgColor>
|
||||||
|
<red>3</red>
|
||||||
|
<green>122</green>
|
||||||
|
<blue>198</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</bgColor>
|
||||||
|
<gridColor>
|
||||||
|
<red>29</red>
|
||||||
|
<green>140</green>
|
||||||
|
<blue>193</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</gridColor>
|
||||||
|
<componentBorderColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</componentBorderColor>
|
||||||
|
<componentBodyColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>0</alpha>
|
||||||
|
</componentBodyColor>
|
||||||
|
<labelColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</labelColor>
|
||||||
|
</org.diylc.core.Theme>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<org.diylc.core.Theme>
|
||||||
|
<name>Dark</name>
|
||||||
|
<bgColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</bgColor>
|
||||||
|
<gridColor>
|
||||||
|
<red>40</red>
|
||||||
|
<green>40</green>
|
||||||
|
<blue>40</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</gridColor>
|
||||||
|
<componentBorderColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</componentBorderColor>
|
||||||
|
<componentBodyColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>0</alpha>
|
||||||
|
</componentBodyColor>
|
||||||
|
<labelColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</labelColor>
|
||||||
|
</org.diylc.core.Theme>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<org.diylc.core.Theme>
|
||||||
|
<name>White Realistic</name>
|
||||||
|
<bgColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</bgColor>
|
||||||
|
<gridColor>
|
||||||
|
<red>240</red>
|
||||||
|
<green>240</green>
|
||||||
|
<blue>240</blue>
|
||||||
|
<alpha>240</alpha>
|
||||||
|
</gridColor>
|
||||||
|
<labelColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</labelColor>
|
||||||
|
</org.diylc.core.Theme>
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
<minor>0</minor>
|
<minor>0</minor>
|
||||||
<build>6</build>
|
<build>6</build>
|
||||||
</versionNumber>
|
</versionNumber>
|
||||||
<releaseDate>2011-01-30 20:00:00.000 CET</releaseDate>
|
<releaseDate>2011-02-07 20:00:00.000 CET</releaseDate>
|
||||||
<name></name>
|
<name></name>
|
||||||
<changes>
|
<changes>
|
||||||
<com.diyfever.gui.update.Change>
|
<com.diyfever.gui.update.Change>
|
||||||
@@ -203,5 +203,42 @@
|
|||||||
<url>http://code.google.com/p/diy-layout-creator/downloads/list
|
<url>http://code.google.com/p/diy-layout-creator/downloads/list
|
||||||
</url>
|
</url>
|
||||||
</com.diyfever.gui.update.Version>
|
</com.diyfever.gui.update.Version>
|
||||||
|
<com.diyfever.gui.update.Version>
|
||||||
|
<versionNumber>
|
||||||
|
<major>3</major>
|
||||||
|
<minor>0</minor>
|
||||||
|
<build>7</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2011-02-07 20:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Resistor and capacitor symbols are not clickable</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Boards sometimes render holes/pads on the edge</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Ruler ticks don't always match with the grid</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>DIL IC now has more pin options</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added support for themes</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
|
<com.diyfever.gui.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Sticky points may be turned off</description>
|
||||||
|
</com.diyfever.gui.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>http://code.google.com/p/diy-layout-creator/downloads/list
|
||||||
|
</url>
|
||||||
|
</com.diyfever.gui.update.Version>
|
||||||
</a>
|
</a>
|
||||||
</java.util.Arrays_-ArrayList>
|
</java.util.Arrays_-ArrayList>
|
||||||
Binary file not shown.
+4
-4
@@ -5,12 +5,14 @@ import java.awt.Color;
|
|||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Shape;
|
||||||
|
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.components.AbstractTransparentComponent;
|
import org.diylc.components.AbstractTransparentComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
@@ -26,7 +28,8 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
|||||||
public static Size DEFAULT_HEIGHT = new Size(1.2d, SizeUnit.in);
|
public static Size DEFAULT_HEIGHT = new Size(1.2d, SizeUnit.in);
|
||||||
|
|
||||||
protected String value = "";
|
protected String value = "";
|
||||||
protected Point[] controlPoints = new Point[] { new Point(0, 0),
|
protected Point[] controlPoints = new Point[] {
|
||||||
|
new Point(0, 0),
|
||||||
new Point((int) DEFAULT_WIDTH.convertToPixels(), (int) DEFAULT_HEIGHT.convertToPixels()) };
|
new Point((int) DEFAULT_WIDTH.convertToPixels(), (int) DEFAULT_HEIGHT.convertToPixels()) };
|
||||||
protected Point firstPoint = new Point();
|
protected Point firstPoint = new Point();
|
||||||
protected Point secondPoint = new Point();
|
protected Point secondPoint = new Point();
|
||||||
@@ -37,9 +40,6 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
if (checkPointsClipped(g2d.getClip())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
if (componentState != ComponentState.DRAGGING) {
|
if (componentState != ComponentState.DRAGGING) {
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
|
|||||||
+9
-2
@@ -4,11 +4,13 @@ import java.awt.AlphaComposite;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Shape;
|
||||||
|
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
@@ -31,7 +33,7 @@ public class EyeletBoard extends AbstractBoard {
|
|||||||
// private Area copperArea;
|
// private Area copperArea;
|
||||||
protected Size spacing = SPACING;
|
protected Size spacing = SPACING;
|
||||||
protected Color eyeletColor = EYELET_COLOR;
|
protected Color eyeletColor = EYELET_COLOR;
|
||||||
|
|
||||||
public EyeletBoard() {
|
public EyeletBoard() {
|
||||||
super();
|
super();
|
||||||
this.boardColor = BOARD_COLOR;
|
this.boardColor = BOARD_COLOR;
|
||||||
@@ -41,6 +43,11 @@ public class EyeletBoard extends AbstractBoard {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
|
Shape clip = g2d.getClip();
|
||||||
|
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||||
|
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.draw(g2d, componentState, project, drawingObserver);
|
super.draw(g2d, componentState, project, drawingObserver);
|
||||||
if (componentState != ComponentState.DRAGGING) {
|
if (componentState != ComponentState.DRAGGING) {
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
@@ -55,7 +62,7 @@ public class EyeletBoard extends AbstractBoard {
|
|||||||
while (p.y < secondPoint.y - spacing) {
|
while (p.y < secondPoint.y - spacing) {
|
||||||
p.x = firstPoint.x;
|
p.x = firstPoint.x;
|
||||||
p.y += spacing;
|
p.y += spacing;
|
||||||
while (p.x < secondPoint.x - spacing) {
|
while (p.x < secondPoint.x - spacing - diameter) {
|
||||||
p.x += spacing;
|
p.x += spacing;
|
||||||
g2d.setColor(eyeletColor);
|
g2d.setColor(eyeletColor);
|
||||||
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
|
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
|
||||||
|
|||||||
+8
-1
@@ -4,11 +4,13 @@ import java.awt.AlphaComposite;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Shape;
|
||||||
|
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
@@ -37,6 +39,11 @@ public class MarshallPerfBoard extends AbstractBoard {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
|
Shape clip = g2d.getClip();
|
||||||
|
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||||
|
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.draw(g2d, componentState, project, drawingObserver);
|
super.draw(g2d, componentState, project, drawingObserver);
|
||||||
if (componentState != ComponentState.DRAGGING) {
|
if (componentState != ComponentState.DRAGGING) {
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
@@ -50,7 +57,7 @@ public class MarshallPerfBoard extends AbstractBoard {
|
|||||||
while (p.y < secondPoint.y - spacing) {
|
while (p.y < secondPoint.y - spacing) {
|
||||||
p.x = firstPoint.x;
|
p.x = firstPoint.x;
|
||||||
p.y += spacing;
|
p.y += spacing;
|
||||||
while (p.x < secondPoint.x - spacing) {
|
while (p.x < secondPoint.x - spacing - holeDiameter) {
|
||||||
p.x += spacing;
|
p.x += spacing;
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
|
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
|
||||||
|
|||||||
+8
-1
@@ -4,11 +4,13 @@ import java.awt.AlphaComposite;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Shape;
|
||||||
|
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
@@ -33,6 +35,11 @@ public class PerfBoard extends AbstractBoard {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
|
Shape clip = g2d.getClip();
|
||||||
|
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||||
|
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.draw(g2d, componentState, project, drawingObserver);
|
super.draw(g2d, componentState, project, drawingObserver);
|
||||||
if (componentState != ComponentState.DRAGGING) {
|
if (componentState != ComponentState.DRAGGING) {
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
@@ -47,7 +54,7 @@ public class PerfBoard extends AbstractBoard {
|
|||||||
while (p.y < secondPoint.y - spacing) {
|
while (p.y < secondPoint.y - spacing) {
|
||||||
p.x = firstPoint.x;
|
p.x = firstPoint.x;
|
||||||
p.y += spacing;
|
p.y += spacing;
|
||||||
while (p.x < secondPoint.x - spacing) {
|
while (p.x < secondPoint.x - spacing - diameter) {
|
||||||
p.x += spacing;
|
p.x += spacing;
|
||||||
g2d.setColor(padColor);
|
g2d.setColor(padColor);
|
||||||
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
|
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
|
||||||
|
|||||||
+12
-6
@@ -5,11 +5,13 @@ import java.awt.Color;
|
|||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Shape;
|
||||||
|
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
@@ -34,8 +36,12 @@ public class VeroBoard extends AbstractBoard {
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
|
Shape clip = g2d.getClip();
|
||||||
|
if (checkPointsClipped(clip) && !clip.contains(firstPoint.x, secondPoint.y)
|
||||||
|
&& !clip.contains(secondPoint.x, firstPoint.y)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.draw(g2d, componentState, project, drawingObserver);
|
super.draw(g2d, componentState, project, drawingObserver);
|
||||||
|
|
||||||
if (componentState != ComponentState.DRAGGING) {
|
if (componentState != ComponentState.DRAGGING) {
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
@@ -51,12 +57,12 @@ public class VeroBoard extends AbstractBoard {
|
|||||||
p.x = firstPoint.x;
|
p.x = firstPoint.x;
|
||||||
p.y += spacing;
|
p.y += spacing;
|
||||||
g2d.setColor(stripColor);
|
g2d.setColor(stripColor);
|
||||||
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2,
|
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x,
|
||||||
secondPoint.x - spacing - p.x, stripSize);
|
stripSize);
|
||||||
g2d.setColor(stripColor.darker());
|
g2d.setColor(stripColor.darker());
|
||||||
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2,
|
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x,
|
||||||
secondPoint.x - spacing - p.x, stripSize);
|
stripSize);
|
||||||
while (p.x < secondPoint.x - spacing) {
|
while (p.x < secondPoint.x - spacing - holeSize) {
|
||||||
p.x += spacing;
|
p.x += spacing;
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
|
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
|
||||||
|
|||||||
+5
-3
@@ -8,6 +8,7 @@ import org.diylc.common.ObjectCache;
|
|||||||
import org.diylc.components.AbstractCurvedComponent;
|
import org.diylc.components.AbstractCurvedComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
@@ -32,11 +33,12 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
|||||||
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
|
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
|
||||||
int thickness = (int) size.convertToPixels();
|
int thickness = (int) size.convertToPixels();
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED
|
Color curveColor = componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color;
|
||||||
|
g2d.setColor(curveColor);
|
||||||
g2d.draw(curve);
|
g2d.draw(curve);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Width")
|
@EditableProperty(name = "Width")
|
||||||
public Size getSize() {
|
public Size getSize() {
|
||||||
return size;
|
return size;
|
||||||
|
|||||||
+1
@@ -9,6 +9,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|||||||
+4
-4
@@ -29,11 +29,11 @@ public class HookupWire extends AbstractCurvedComponent<Void> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
|
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
|
||||||
int thickness = (int) (Math.
|
int thickness = (int) (Math.pow(Math.E, -1.12436 - 0.11594 * gauge.getValue())
|
||||||
pow(Math.E, -1.12436 - 0.11594 * gauge.getValue())
|
|
||||||
* Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT));
|
* Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT));
|
||||||
g2d.setColor(componentState == ComponentState.SELECTED
|
Color curveColor = componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker());
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker();
|
||||||
|
g2d.setColor(curveColor);
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
|
||||||
g2d.draw(curve);
|
g2d.draw(curve);
|
||||||
if (componentState == ComponentState.NORMAL) {
|
if (componentState == ComponentState.NORMAL) {
|
||||||
|
|||||||
+1
@@ -9,6 +9,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|||||||
+3
-2
@@ -14,6 +14,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -116,12 +117,12 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
|||||||
public Point getControlPoint(int index) {
|
public Point getControlPoint(int index) {
|
||||||
return controlPoints[index];
|
return controlPoints[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isControlPointSticky(int index) {
|
public boolean isControlPointSticky(int index) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||||
return VisibilityPolicy.NEVER;
|
return VisibilityPolicy.NEVER;
|
||||||
|
|||||||
+1
@@ -14,6 +14,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|||||||
+5
-1
@@ -4,6 +4,7 @@ import java.awt.AlphaComposite;
|
|||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Shape;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -45,7 +47,9 @@ public class Image extends AbstractTransparentComponent<Void> {
|
|||||||
double s = 1d * scale / DEFAULT_SCALE;
|
double s = 1d * scale / DEFAULT_SCALE;
|
||||||
Point endPoint = new Point((int) (image.getIconWidth() * s),
|
Point endPoint = new Point((int) (image.getIconWidth() * s),
|
||||||
(int) (image.getIconHeight() * s));
|
(int) (image.getIconHeight() * s));
|
||||||
if (!g2d.getClip().contains(point) && !g2d.getClip().contains(endPoint)) {
|
Shape clip = g2d.getClip();
|
||||||
|
if (!clip.contains(point) && !clip.contains(endPoint)
|
||||||
|
&& !clip.contains(point.x, endPoint.y) && !clip.contains(endPoint.x, point.y)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|||||||
+1
@@ -12,6 +12,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
|
|||||||
+6
-3
@@ -9,6 +9,7 @@ import org.diylc.common.ObjectCache;
|
|||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.CreationMethod;
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
@@ -122,12 +123,14 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
|||||||
int markerLength = (int) (getLength().convertToPixels() * 0.2);
|
int markerLength = (int) (getLength().convertToPixels() * 0.2);
|
||||||
g2d.setColor(markerColor);
|
g2d.setColor(markerColor);
|
||||||
int width = getClosestOdd(getWidth().convertToPixels());
|
int width = getClosestOdd(getWidth().convertToPixels());
|
||||||
g2d.fillRect((int) getLength().convertToPixels() - markerLength, 0, markerLength, width);
|
g2d
|
||||||
|
.fillRect((int) getLength().convertToPixels() - markerLength, 0, markerLength,
|
||||||
|
width);
|
||||||
g2d.setColor(tickColor);
|
g2d.setColor(tickColor);
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
||||||
g2d.drawLine((int) getLength().convertToPixels() - markerLength / 2,
|
g2d.drawLine((int) getLength().convertToPixels() - markerLength / 2,
|
||||||
(int) (width / 2 - width * 0.15), (int) getLength().convertToPixels() - markerLength
|
(int) (width / 2 - width * 0.15), (int) getLength().convertToPixels()
|
||||||
/ 2, (int) (width / 2 + width * 0.15));
|
- markerLength / 2, (int) (width / 2 + width * 0.15));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -7,6 +7,7 @@ import java.awt.geom.GeneralPath;
|
|||||||
import org.diylc.components.AbstractSchematicLeadedSymbol;
|
import org.diylc.components.AbstractSchematicLeadedSymbol;
|
||||||
import org.diylc.core.CreationMethod;
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
|
|||||||
+1
@@ -17,6 +17,7 @@ import org.diylc.core.CreationMethod;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
|
|||||||
+1
@@ -11,6 +11,7 @@ import org.diylc.common.ObjectCache;
|
|||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.CreationMethod;
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
|
|||||||
+3
-2
@@ -10,6 +10,7 @@ import org.diylc.common.ResistorColorCode;
|
|||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.CreationMethod;
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.annotations.PositiveMeasureValidator;
|
import org.diylc.core.annotations.PositiveMeasureValidator;
|
||||||
@@ -46,12 +47,12 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
|||||||
public void setValue(Resistance value) {
|
public void setValue(Resistance value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Power getPower() {
|
public Power getPower() {
|
||||||
return power;
|
return power;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPower(Power power) {
|
public void setPower(Power power) {
|
||||||
this.power = power;
|
this.power = power;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-5
@@ -19,6 +19,7 @@ import org.diylc.core.CreationMethod;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
@@ -308,8 +309,8 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
|
|||||||
g2d.drawRect(margin, margin, width - 2 * margin, width - 2 * margin);
|
g2d.drawRect(margin, margin, width - 2 * margin, width - 2 * margin);
|
||||||
int shaftSize = 11;
|
int shaftSize = 11;
|
||||||
int slotSize = 2;
|
int slotSize = 2;
|
||||||
Area area = new Area(new Ellipse2D.Double(width / 2 - shaftSize / 2, width / 2 - shaftSize / 2,
|
Area area = new Area(new Ellipse2D.Double(width / 2 - shaftSize / 2, width / 2 - shaftSize
|
||||||
shaftSize, shaftSize));
|
/ 2, shaftSize, shaftSize));
|
||||||
Area slot = new Area(new Rectangle2D.Double(0, width / 2 - slotSize / 2, width, slotSize));
|
Area slot = new Area(new Rectangle2D.Double(0, width / 2 - slotSize / 2, width, slotSize));
|
||||||
slot.transform(AffineTransform.getRotateInstance(Math.PI / 4, width / 2, width / 2));
|
slot.transform(AffineTransform.getRotateInstance(Math.PI / 4, width / 2, width / 2));
|
||||||
area.subtract(slot);
|
area.subtract(slot);
|
||||||
@@ -317,18 +318,18 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
|
|||||||
g2d.fill(area);
|
g2d.fill(area);
|
||||||
g2d.setColor(SHAFT_BORDER_COLOR);
|
g2d.setColor(SHAFT_BORDER_COLOR);
|
||||||
g2d.draw(area);
|
g2d.draw(area);
|
||||||
|
|
||||||
int pinSize = 3;
|
int pinSize = 3;
|
||||||
g2d.setColor(PIN_COLOR);
|
g2d.setColor(PIN_COLOR);
|
||||||
g2d.fillOval(margin - pinSize / 2, 10 - pinSize / 2, pinSize, pinSize);
|
g2d.fillOval(margin - pinSize / 2, 10 - pinSize / 2, pinSize, pinSize);
|
||||||
g2d.setColor(PIN_BORDER_COLOR);
|
g2d.setColor(PIN_BORDER_COLOR);
|
||||||
g2d.drawOval(margin - pinSize / 2, 10 - pinSize / 2, pinSize, pinSize);
|
g2d.drawOval(margin - pinSize / 2, 10 - pinSize / 2, pinSize, pinSize);
|
||||||
|
|
||||||
g2d.setColor(PIN_COLOR);
|
g2d.setColor(PIN_COLOR);
|
||||||
g2d.fillOval(margin - pinSize / 2, 21 - pinSize / 2, pinSize, pinSize);
|
g2d.fillOval(margin - pinSize / 2, 21 - pinSize / 2, pinSize, pinSize);
|
||||||
g2d.setColor(PIN_BORDER_COLOR);
|
g2d.setColor(PIN_BORDER_COLOR);
|
||||||
g2d.drawOval(margin - pinSize / 2, 21 - pinSize / 2, pinSize, pinSize);
|
g2d.drawOval(margin - pinSize / 2, 21 - pinSize / 2, pinSize, pinSize);
|
||||||
|
|
||||||
g2d.setColor(PIN_COLOR);
|
g2d.setColor(PIN_COLOR);
|
||||||
g2d.fillOval(width - margin - pinSize / 2, width / 2 - pinSize / 2, pinSize, pinSize);
|
g2d.fillOval(width - margin - pinSize / 2, width / 2 - pinSize / 2, pinSize, pinSize);
|
||||||
g2d.setColor(PIN_BORDER_COLOR);
|
g2d.setColor(PIN_BORDER_COLOR);
|
||||||
|
|||||||
+2
-1
@@ -19,6 +19,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
@@ -307,7 +308,7 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
|
|
||||||
public static enum PinCount {
|
public static enum PinCount {
|
||||||
|
|
||||||
_4, _8, _10, _12, _14, _16, _24, _32;
|
_4, _8, _10, _12, _14, _16, _18, _20, _22, _24, _26, _28, _30, _32;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|||||||
+1
@@ -8,6 +8,7 @@ import java.awt.geom.Rectangle2D;
|
|||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.CreationMethod;
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
|
|||||||
+1
@@ -11,6 +11,7 @@ import org.diylc.common.ObjectCache;
|
|||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.CreationMethod;
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
|
|||||||
+1
@@ -17,6 +17,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|||||||
+1
@@ -18,6 +18,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
|
import org.diylc.core.Theme;
|
||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|||||||
Reference in New Issue
Block a user