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