bugfix: trimmer display should not be static

code cleanup
This commit is contained in:
bancika
2016-10-28 12:03:45 +02:00
parent 6312e251f6
commit abb9c5ce6f
12 changed files with 17 additions and 18 deletions
@@ -15,7 +15,6 @@ import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Dot", category = "Connectivity", author = "Branislav Stojkovic",
description = "Connector dot", instanceNamePrefix = "Dot", stretchable = false, zOrder = IDIYComponent.COMPONENT,
@@ -89,6 +89,7 @@ public class BatterySnap9V extends AbstractTransparentComponent<String> {
g2d.draw(body[2]);
}
@SuppressWarnings("incomplete-switch")
public Shape[] getBody() {
if (body == null) {
body = new Shape[3];
@@ -117,6 +117,7 @@ public class HumbuckerPickup extends AbstractTransparentComponent<String> {
VerticalAlignment.CENTER);
}
@SuppressWarnings("incomplete-switch")
public Shape[] getBody() {
if (body == null) {
body = new Shape[4];
@@ -115,6 +115,7 @@ public class LeverSwitch extends AbstractTransparentComponent<String> {
g2d.draw(body[2]);
}
@SuppressWarnings("incomplete-switch")
public Shape[] getBody() {
if (body == null) {
body = new Shape[3];
@@ -199,6 +200,7 @@ public class LeverSwitch extends AbstractTransparentComponent<String> {
return body;
}
@SuppressWarnings("incomplete-switch")
private void updateControlPoints() {
int x = controlPoints[0].x;
int y = controlPoints[0].y;
@@ -113,6 +113,7 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
VerticalAlignment.CENTER);
}
@SuppressWarnings("incomplete-switch")
public Shape[] getBody() {
if (body == null) {
body = new Shape[3];
@@ -33,12 +33,14 @@ public class Label extends AbstractComponent<Void> {
private String text = DEFAULT_TEXT;
private Font font = LABEL_FONT;
private Color color = LABEL_COLOR;
@SuppressWarnings("unused")
@Deprecated
private boolean center;
private HorizontalAlignment horizontalAlignment = HorizontalAlignment.CENTER;
private VerticalAlignment verticalAlignment = VerticalAlignment.CENTER;
private Orientation orientation = Orientation.DEFAULT;
@SuppressWarnings("incomplete-switch")
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
IDrawingObserver drawingObserver) {
@@ -40,6 +40,7 @@ public class PCBText extends AbstractComponent<Void> {
private VerticalAlignment verticalAlignment = VerticalAlignment.CENTER;
private Orientation orientation = Orientation.DEFAULT;
@SuppressWarnings("incomplete-switch")
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
IDrawingObserver drawingObserver) {
@@ -53,7 +53,7 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
protected Color bodyColor = BODY_COLOR;
protected Color borderColor = BORDER_COLOR;
protected static Display display = DISPLAY;
protected Display display = DISPLAY;
// Array of 7 elements: 3 lug connectors, 1 pot body and 3 lugs
transient protected Shape[] body = null;
@@ -327,7 +327,7 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
int y = (panelHeight - textHeight) / 2 + fontMetrics.getAscent();
String label = "";
label = (getDisplay() == Display.NAME) ? getName() : getValue().toString();
label = (getDisplay() == Display.NAME) ? getName() : (getValue() == null ? "" : getValue().toString());
if (getDisplay() == Display.NONE) {
label = "";
}
@@ -387,7 +387,7 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
@EditableProperty
public Display getDisplay() {
if (display == null) {
display = Display.VALUE;
display = DISPLAY;
}
return display;
}
@@ -52,7 +52,7 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
if (checkPointsClipped(g2d.getClip())) {
return;
}
int pinSpacing = (int) PIN_SPACING.convertToPixels();
Color finalColor;
if (componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING) {
finalColor = SELECTION_COLOR;
@@ -67,9 +67,6 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
// Draw transistor
int x = controlPoints[0].x;
int y = controlPoints[0].y;
Shape[] body = getBody();
int rotation = 0;
@@ -1,16 +1,9 @@
package org.diylc.components.shapes;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Point;
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.VisibilityPolicy;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@@ -3,7 +3,6 @@ package org.diylc;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.Properties;
import javax.swing.JOptionPane;
@@ -13,7 +12,6 @@ import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.diylc.appframework.miscutils.ConfigurationManager;
import org.diylc.appframework.miscutils.PropertyInjector;
import org.diylc.appframework.miscutils.Utils;
import org.diylc.presenter.Presenter;
import org.diylc.swing.gui.MainFrame;
import org.diylc.swing.gui.TemplateDialog;
+4
View File
@@ -1354,6 +1354,10 @@
<changeType>IMPROVEMENT</changeType>
<description>Auto save and recovery made a bit smarter</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Changing Display to one trimmer affects all trimmers and does not get saved to the file</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>