switchable sticky points

added themes
fixed ruler precision
improved board rendering
This commit is contained in:
bancika
2011-02-12 20:35:09 +00:00
parent b8545d27a1
commit e5d33fb80d
51 changed files with 462 additions and 99 deletions
@@ -9,9 +9,9 @@
<classpathentry kind="lib" path="lib/iText-2.1.7.jar"/>
<classpathentry kind="lib" path="lib/cloning-1.5.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/poi-3.5-FINAL-20090928.jar"/>
<classpathentry kind="lib" path="library/main.jar"/>
<classpathentry kind="lib" path="lib/bancika-gui-framework.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -1,15 +1,43 @@
<map>
<entry>
<string>metric</string>
<boolean>false</boolean>
<string>lastPath</string>
<string>C:\Documents and Settings\Branislav Stojkovic\My Documents\Downloads</string>
</entry>
<entry>
<string>zoom</string>
<double>1.0</double>
</entry>
<entry>
<string>lastPath</string>
<string>C:\Documents and Settings\Branislav Stojkovic\Desktop</string>
<string>metric</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>
<string>antiAliasing</string>
@@ -17,12 +45,16 @@
</entry>
<entry>
<string>hiQualityRender</string>
<boolean>false</boolean>
<boolean>true</boolean>
</entry>
<entry>
<string>showTemplatesAtStartup</string>
<boolean>false</boolean>
</entry>
<entry>
<string>exportGrid</string>
<boolean>true</boolean>
</entry>
<entry>
<string>default.org.diylc.components.semiconductors.TransistorTO92:Orientation</string>
<org.diylc.common.Orientation>DEFAULT</org.diylc.common.Orientation>
@@ -11,6 +11,7 @@ import java.util.Set;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.swing.plugins.edit.ComponentTransferable;
import com.diyfever.gui.simplemq.IMessageListener;
@@ -33,6 +34,8 @@ public interface IPlugInPort {
public static final String ANTI_ALIASING_KEY = "antiAliasing";
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
@@ -335,4 +338,16 @@ public interface IPlugInPort {
* Causes the display to refresh.
*/
void refresh();
/**
* @return currently selected theme.
*/
Theme getSelectedTheme();
/**
* Changes the current theme.
*
* @param theme
*/
void setSelectedTheme(Theme theme);
}
@@ -24,7 +24,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
public static Color SELECTION_COLOR = Color.red;
public static Color LABEL_COLOR = Color.black;
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)
@Override
@@ -39,6 +39,7 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
* @param curve
* @param g2d
* @param componentState
* @param theme
*/
protected abstract void drawCurve(CubicCurve2D curve, Graphics2D g2d,
ComponentState componentState);
@@ -69,12 +69,14 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
return;
}
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness()));
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState));
Color leadColor = shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState);
g2d.setColor(leadColor);
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
if (shouldShadeLeads()) {
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);
}
return;
@@ -94,19 +96,23 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
/ MAX_ALPHA));
}
if (bodyColor != null) {
g2d.setColor(bodyColor);
g2d.fill(shape);
if (bodyColor != null) {
g2d.setColor(bodyColor);
g2d.fill(shape);
}
}
decorateComponentBody(g2d);
g2d.setComposite(oldComposite);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
Color finalBorderColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor;
g2d.setColor(finalBorderColor);
g2d.draw(shape);
// Draw label.
g2d.setFont(LABEL_FONT);
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED : labelColor);
Color finalLabelFont = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED : labelColor;
g2d.setColor(finalLabelFont);
FontMetrics fontMetrics = g2d.getFontMetrics();
String label = display == Display.NAME ? getName() : getValue().toString();
// 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());
double leadLength = (distance - shapeRect.width) / 2 - leadThickness / 2;
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness));
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState));
Color leadColor = shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState);
g2d.setColor(leadColor);
int endX = (int) (points[0].x + Math.cos(theta) * leadLength);
int endY = (int) Math.round(points[0].y + Math.sin(theta) * leadLength);
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);
if (shouldShadeLeads()) {
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)
* 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)
@@ -23,6 +23,7 @@ public interface IView {
public static final int OK_OPTION = 0;
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);
@@ -12,17 +12,17 @@ public class Theme implements Serializable {
private Color gridColor;
private Color componentBodyColor;
private Color componentBorderColor;
private Color componentLabelColor;
private Color labelColor;
public Theme(String name, Color bgColor, Color gridColor, Color componentBodyColor,
Color componentBorderColor, Color componentLabelColor) {
Color componentBorderColor, Color labelColor) {
super();
this.name = name;
this.bgColor = bgColor;
this.gridColor = gridColor;
this.componentBodyColor = componentBodyColor;
this.componentBorderColor = componentBorderColor;
this.componentLabelColor = componentLabelColor;
this.labelColor = labelColor;
}
public String getName() {
@@ -45,8 +45,8 @@ public class Theme implements Serializable {
return componentBorderColor;
}
public Color getComponentLabelColor() {
return componentLabelColor;
public Color getLabelColor() {
return labelColor;
}
@Override
@@ -59,7 +59,7 @@ public class Theme implements Serializable {
result = prime * result
+ ((componentBorderColor == null) ? 0 : componentBorderColor.hashCode());
result = prime * result
+ ((componentLabelColor == null) ? 0 : componentLabelColor.hashCode());
+ ((labelColor == null) ? 0 : labelColor.hashCode());
result = prime * result + ((gridColor == null) ? 0 : gridColor.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
@@ -89,10 +89,10 @@ public class Theme implements Serializable {
return false;
} else if (!componentBorderColor.equals(other.componentBorderColor))
return false;
if (componentLabelColor == null) {
if (other.componentLabelColor != null)
if (labelColor == null) {
if (other.labelColor != null)
return false;
} else if (!componentLabelColor.equals(other.componentLabelColor))
} else if (!labelColor.equals(other.labelColor))
return false;
if (gridColor == null) {
if (other.gridColor != null)
@@ -30,7 +30,8 @@ public enum IconLoader {
"faq.png"), Component("component.png"), Plugin("plugin.png"), Manual("manual.png"), Donate(
"donate.png"), Bug("bug.png"), IconLarge("icon_large.png"), IconMedium(
"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;
Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

@@ -26,6 +26,7 @@ import org.diylc.common.ObjectCache;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.utils.Constants;
@@ -44,14 +45,17 @@ public class DrawingManager {
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 THEME_KEY = "theme";
public static boolean DEBUG_COMPONENT_AREAS = false;
public static Color GRID_COLOR = new Color(240, 240, 240);
public static Color CONTROL_POINT_COLOR = Color.black;
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.
private Map<IDIYComponent<?>, Area> componentAreaMap;
// Maps components to the last state they are drawn in. Also, used to
@@ -72,6 +76,10 @@ public class DrawingManager {
this.messageDispatcher = messageDispatcher;
componentAreaMap = new HashMap<IDIYComponent<?>, Area>();
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();
Dimension d = getCanvasDimensions(project, zoom, true);
g2dWrapper.setColor(Constants.CANVAS_COLOR);
g2dWrapper.setColor(theme.getBgColor());
g2dWrapper.fillRect(0, 0, d.width, d.height);
g2d.clip(new Rectangle(new Point(0, 0), d));
GridType gridType = (GridType) ConfigurationManager.getInstance().readObject(
ANTIALIASING_KEY, GridType.LINES);
GridType gridType = GridType.LINES;
if (drawOptions.contains(DrawOption.GRID) && gridType != GridType.NONE) {
double zoomStep = project.getGridSpacing().convertToPixels() * zoom;
if (gridType == GridType.CROSSHAIR) {
@@ -162,7 +169,7 @@ public class DrawingManager {
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) {
g2dWrapper.drawLine((int) i, 0, (int) i, d.height - 1);
}
@@ -224,22 +231,24 @@ public class DrawingManager {
// Draw control points.
if (drawOptions.contains(DrawOption.CONTROL_POINTS)) {
// Draw unselected points first to make sure they are below.
for (IDIYComponent<?> component : project.getComponents()) {
for (int i = 0; i < component.getControlPointCount(); i++) {
VisibilityPolicy visibilityPolicy = component
.getControlPointVisibilityPolicy(i);
if ((groupedComponents.contains(component)
&& (visibilityPolicy == VisibilityPolicy.ALWAYS || (selectedComponents
.contains(component) && visibilityPolicy == VisibilityPolicy.WHEN_SELECTED)) || (!groupedComponents
.contains(component)
&& !selectedComponents.contains(component) && component
.getControlPointVisibilityPolicy(i) == VisibilityPolicy.ALWAYS))) {
g2dWrapper.setColor(CONTROL_POINT_COLOR);
if (dragInProgress) {
for (IDIYComponent<?> component : project.getComponents()) {
for (int i = 0; i < component.getControlPointCount(); i++) {
VisibilityPolicy visibilityPolicy = component
.getControlPointVisibilityPolicy(i);
if ((groupedComponents.contains(component)
&& (visibilityPolicy == VisibilityPolicy.ALWAYS || (selectedComponents
.contains(component) && visibilityPolicy == VisibilityPolicy.WHEN_SELECTED)) || (!groupedComponents
.contains(component)
&& !selectedComponents.contains(component) && component
.getControlPointVisibilityPolicy(i) == VisibilityPolicy.ALWAYS))) {
g2dWrapper.setColor(CONTROL_POINT_COLOR);
Point controlPoint = component.getControlPoint(i);
int pointSize = CONTROL_POINT_SIZE - 2;
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
- pointSize / 2, pointSize, pointSize);
Point controlPoint = component.getControlPoint(i);
int pointSize = CONTROL_POINT_SIZE - 2;
g2dWrapper.fillOval(controlPoint.x - pointSize / 2, controlPoint.y
- pointSize / 2, pointSize, pointSize);
}
}
}
}
@@ -373,4 +382,14 @@ public class DrawingManager {
messageDispatcher.dispatchMessage(EventType.ZOOM_CHANGED, zoomLevel);
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);
}
}
@@ -30,6 +30,7 @@ import org.diylc.common.PropertyWrapper;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IView;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.measures.SizeUnit;
import org.diylc.swing.plugins.edit.ComponentTransferable;
import org.diylc.utils.Constants;
@@ -594,7 +595,12 @@ public class Presenter implements IPlugInPort {
}
}
// 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);
}
}
@@ -691,8 +697,9 @@ public class Presenter implements IPlugInPort {
int actualDy = 0;
// For each component, do a simulation of the move to see if any of
// them will
// overlap.
// them will overlap or go out of bounds.
int width = (int) currentProject.getWidth().convertToPixels();
int height = (int) currentProject.getHeight().convertToPixels();
boolean isFirst = true;
for (Map.Entry<IDIYComponent<?>, Set<Integer>> entry : controlPointMap.entrySet()) {
IDIYComponent<?> component = entry.getKey();
@@ -715,8 +722,15 @@ public class Presenter implements IPlugInPort {
// Nothing to move.
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,
@@ -730,7 +744,7 @@ public class Presenter implements IPlugInPort {
for (int j = i + 1; j < controlPoints.length; j++) {
if (controlPoints[i] != null && controlPoints[j] != null
&& 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;
}
}
@@ -983,6 +997,16 @@ public class Presenter implements IPlugInPort {
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}.
* 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);
}
includeStuckComponents(controlPointMap);
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.STICKY_POINTS_KEY, true)) {
includeStuckComponents(controlPointMap);
}
messageDispatcher.dispatchMessage(EventType.SELECTION_CHANGED, selectedComponents,
controlPointMap.keySet());
}
@@ -17,6 +17,7 @@ import org.diylc.common.ITask;
import org.diylc.common.PropertyWrapper;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IView;
import org.diylc.core.Theme;
import org.diylc.images.IconLoader;
import org.diylc.swing.gui.DialogFactory;
import org.diylc.swing.gui.editor.PropertyEditorDialog;
@@ -142,6 +143,10 @@ public class ActionFactory {
return new ConfigAction(plugInPort, title, configKey, defaultValue);
}
public ThemeAction createThemeAction(IPlugInPort plugInPort, Theme theme) {
return new ThemeAction(plugInPort, theme);
}
// File menu actions.
public static class NewAction extends AbstractAction {
@@ -825,4 +830,28 @@ public class ActionFactory {
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);
}
}
}
@@ -15,6 +15,7 @@ import java.util.Map;
import javax.swing.Action;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
@@ -23,6 +24,7 @@ import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import javax.swing.Timer;
@@ -62,6 +64,7 @@ public class MainFrame extends JFrame implements ISwingUI {
private JMenuBar mainMenuBar;
private Map<String, JMenu> menuMap;
private Map<String, ButtonGroup> buttonGroupMap;
private CanvasPlugin canvasPlugin;
@@ -71,6 +74,7 @@ public class MainFrame extends JFrame implements ISwingUI {
setPreferredSize(new Dimension(800, 600));
createBasePanels();
menuMap = new HashMap<String, JMenu>();
buttonGroupMap = new HashMap<String, ButtonGroup>();
setIconImages(Arrays.asList(IconLoader.IconSmall.getImage(), IconLoader.IconMedium
.getImage(), IconLoader.IconLarge.getImage()));
DialogFactory.getInstance().initialize(this);
@@ -239,8 +243,20 @@ public class MainFrame extends JFrame implements ISwingUI {
menu.addSeparator();
} else {
Boolean isCheckBox = (Boolean) action.getValue(IView.CHECK_BOX_MENU_ITEM);
String groupName = (String) action.getValue(IView.RADIO_BUTTON_GROUP_KEY);
if (isCheckBox != null && isCheckBox) {
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 {
menu.add(action);
}
@@ -112,7 +112,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
private RulerScrollPane getScrollPane() {
if (scrollPane == null) {
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());
boolean metric = ConfigurationManager.getInstance().readBoolean(Presenter.METRIC_KEY,
true);
@@ -1,13 +1,22 @@
package org.diylc.swing.plugins.config;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.EnumSet;
import org.apache.log4j.Logger;
import org.diylc.common.EventType;
import org.diylc.common.IPlugIn;
import org.diylc.common.IPlugInPort;
import org.diylc.core.Theme;
import org.diylc.images.IconLoader;
import org.diylc.swing.ActionFactory;
import org.diylc.swing.ISwingUI;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
/**
* Controls configuration menu.
*
@@ -15,7 +24,10 @@ import org.diylc.swing.ISwingUI;
*/
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 THEME_MENU = "Theme";
private ISwingUI swingUI;
@@ -30,6 +42,28 @@ public class ConfigPlugin implements IPlugIn {
"Anti-Aliasing", IPlugInPort.ANTI_ALIASING_KEY, true), CONFIG_MENU);
swingUI.injectMenuAction(ActionFactory.getInstance().createConfigAction(plugInPort,
"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
@@ -9,6 +9,7 @@ import org.diylc.common.DrawOption;
import org.diylc.common.IPlugInPort;
import com.diyfever.gui.IDrawingProvider;
import com.diyfever.gui.miscutils.ConfigurationManager;
/**
* {@link IDrawingProvider} implementation that uses {@link IPlugInPort} to draw
@@ -33,6 +34,9 @@ public class ProjectDrawingProvider implements IDrawingProvider {
if (useZoom) {
options.add(DrawOption.ZOOM);
}
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.EXPORT_GRID_KEY, false)) {
options.add(DrawOption.GRID);
}
plugInPort.draw((Graphics2D) g, options, null);
}
@@ -7,7 +7,7 @@ import java.awt.Toolkit;
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
/ Toolkit.getDefaultToolkit().getScreenResolution();
@@ -8,6 +8,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -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>
<build>6</build>
</versionNumber>
<releaseDate>2011-01-30 20:00:00.000 CET</releaseDate>
<releaseDate>2011-02-07 20:00:00.000 CET</releaseDate>
<name></name>
<changes>
<com.diyfever.gui.update.Change>
@@ -203,5 +203,42 @@
<url>http://code.google.com/p/diy-layout-creator/downloads/list
</url>
</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>
</java.util.Arrays_-ArrayList>
@@ -5,12 +5,14 @@ import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractTransparentComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.EditableProperty;
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);
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()) };
protected Point firstPoint = new Point();
protected Point secondPoint = new Point();
@@ -37,9 +40,6 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
@Override
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
IDrawingObserver drawingObserver) {
if (checkPointsClipped(g2d.getClip())) {
return;
}
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
if (componentState != ComponentState.DRAGGING) {
Composite oldComposite = g2d.getComposite();
@@ -4,11 +4,13 @@ import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -41,6 +43,11 @@ public class EyeletBoard extends AbstractBoard {
@Override
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
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);
if (componentState != ComponentState.DRAGGING) {
if (alpha < MAX_ALPHA) {
@@ -55,7 +62,7 @@ public class EyeletBoard extends AbstractBoard {
while (p.y < secondPoint.y - spacing) {
p.x = firstPoint.x;
p.y += spacing;
while (p.x < secondPoint.x - spacing) {
while (p.x < secondPoint.x - spacing - diameter) {
p.x += spacing;
g2d.setColor(eyeletColor);
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
@@ -4,11 +4,13 @@ import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -37,6 +39,11 @@ public class MarshallPerfBoard extends AbstractBoard {
@Override
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
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);
if (componentState != ComponentState.DRAGGING) {
if (alpha < MAX_ALPHA) {
@@ -50,7 +57,7 @@ public class MarshallPerfBoard extends AbstractBoard {
while (p.y < secondPoint.y - spacing) {
p.x = firstPoint.x;
p.y += spacing;
while (p.x < secondPoint.x - spacing) {
while (p.x < secondPoint.x - spacing - holeDiameter) {
p.x += spacing;
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter,
@@ -4,11 +4,13 @@ import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -33,6 +35,11 @@ public class PerfBoard extends AbstractBoard {
@Override
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
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);
if (componentState != ComponentState.DRAGGING) {
if (alpha < MAX_ALPHA) {
@@ -47,7 +54,7 @@ public class PerfBoard extends AbstractBoard {
while (p.y < secondPoint.y - spacing) {
p.x = firstPoint.x;
p.y += spacing;
while (p.x < secondPoint.x - spacing) {
while (p.x < secondPoint.x - spacing - diameter) {
p.x += spacing;
g2d.setColor(padColor);
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
@@ -5,11 +5,13 @@ import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -34,8 +36,12 @@ public class VeroBoard extends AbstractBoard {
@Override
public void draw(Graphics2D g2d, ComponentState componentState, Project project,
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);
if (componentState != ComponentState.DRAGGING) {
Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) {
@@ -51,12 +57,12 @@ public class VeroBoard extends AbstractBoard {
p.x = firstPoint.x;
p.y += spacing;
g2d.setColor(stripColor);
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2,
secondPoint.x - spacing - p.x, stripSize);
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x,
stripSize);
g2d.setColor(stripColor.darker());
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2,
secondPoint.x - spacing - p.x, stripSize);
while (p.x < secondPoint.x - spacing) {
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x,
stripSize);
while (p.x < secondPoint.x - spacing - holeSize) {
p.x += spacing;
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
@@ -8,6 +8,7 @@ import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractCurvedComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -32,8 +33,9 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
int thickness = (int) size.convertToPixels();
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
Color curveColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color;
g2d.setColor(curveColor);
g2d.draw(curve);
}
@@ -9,6 +9,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -29,11 +29,11 @@ public class HookupWire extends AbstractCurvedComponent<Void> {
@Override
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
int thickness = (int) (Math.
pow(Math.E, -1.12436 - 0.11594 * gauge.getValue())
int thickness = (int) (Math.pow(Math.E, -1.12436 - 0.11594 * gauge.getValue())
* Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT));
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker());
Color curveColor = componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker();
g2d.setColor(curveColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
g2d.draw(curve);
if (componentState == ComponentState.NORMAL) {
@@ -9,6 +9,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -14,6 +14,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -14,6 +14,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -4,6 +4,7 @@ import java.awt.AlphaComposite;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import javax.swing.ImageIcon;
@@ -12,6 +13,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -45,7 +47,9 @@ public class Image extends AbstractTransparentComponent<Void> {
double s = 1d * scale / DEFAULT_SCALE;
Point endPoint = new Point((int) (image.getIconWidth() * 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;
}
Composite oldComposite = g2d.getComposite();
@@ -12,6 +12,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -12,6 +12,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.measures.Size;
@@ -9,6 +9,7 @@ import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Capacitance;
@@ -122,12 +123,14 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
int markerLength = (int) (getLength().convertToPixels() * 0.2);
g2d.setColor(markerColor);
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.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
g2d.drawLine((int) getLength().convertToPixels() - markerLength / 2,
(int) (width / 2 - width * 0.15), (int) getLength().convertToPixels() - markerLength
/ 2, (int) (width / 2 + width * 0.15));
(int) (width / 2 - width * 0.15), (int) getLength().convertToPixels()
- markerLength / 2, (int) (width / 2 + width * 0.15));
}
}
}
@@ -7,6 +7,7 @@ import java.awt.geom.GeneralPath;
import org.diylc.components.AbstractSchematicLeadedSymbol;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Capacitance;
@@ -17,6 +17,7 @@ import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -11,6 +11,7 @@ import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Capacitance;
@@ -10,6 +10,7 @@ import org.diylc.common.ResistorColorCode;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.annotations.PositiveMeasureValidator;
@@ -19,6 +19,7 @@ import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
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);
int shaftSize = 11;
int slotSize = 2;
Area area = new Area(new Ellipse2D.Double(width / 2 - shaftSize / 2, width / 2 - shaftSize / 2,
shaftSize, shaftSize));
Area area = new Area(new Ellipse2D.Double(width / 2 - shaftSize / 2, width / 2 - shaftSize
/ 2, shaftSize, shaftSize));
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));
area.subtract(slot);
@@ -19,6 +19,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -307,7 +308,7 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
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
public String toString() {
@@ -8,6 +8,7 @@ import java.awt.geom.Rectangle2D;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -11,6 +11,7 @@ import org.diylc.common.ObjectCache;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.CreationMethod;
import org.diylc.core.IDIYComponent;
import org.diylc.core.Theme;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -17,6 +17,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -18,6 +18,7 @@ import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
import org.diylc.core.Project;
import org.diylc.core.Theme;
import org.diylc.core.VisibilityPolicy;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;