mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Added 'Font Size Override' property to most components that display text
to allow control over font size
This commit is contained in:
@@ -62,7 +62,7 @@ import org.diylc.utils.Constants;
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*/
|
||||
public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComponent<T> {
|
||||
public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponent<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -324,6 +324,11 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
if (useShapeRectAsPosition()) {
|
||||
g2d.translate(shapeRect.getX(), shapeRect.getY());
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.Project;
|
||||
|
||||
|
||||
public abstract class AbstractMultiPartComponent<T> extends AbstractTransparentComponent<T> {
|
||||
public abstract class AbstractMultiPartComponent<T> extends AbstractLabeledComponent<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -247,7 +247,12 @@ public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
: LABEL_COLOR;
|
||||
}
|
||||
g2d.setColor(finalLabelColor);
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
double centerX = (controlPoints[0].getX() + controlPoints[3].getX()) / 2;
|
||||
double centerY = (controlPoints[0].getY() + controlPoints[3].getY()) / 2;
|
||||
StringUtils.drawCenteredText(g2d, name, centerX, centerY, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
|
||||
@@ -267,7 +267,12 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
: LABEL_COLOR;
|
||||
}
|
||||
g2d.setColor(finalLabelColor);
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Rectangle bounds = body[0].getBounds();
|
||||
double centerX = bounds.getX() + bounds.width / 2;
|
||||
double centerY = bounds.getY() + bounds.height / 2;
|
||||
|
||||
@@ -225,6 +225,11 @@ public class FuseHolderPanel extends AbstractMultiPartComponent<String> {
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
@@ -400,5 +400,11 @@ public class IECSocket extends AbstractMultiPartComponent<String> {
|
||||
int margin = 20;
|
||||
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Integer getFontSizeOverride() {
|
||||
return super.getFontSizeOverride();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -55,7 +55,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Mini Relay", author = "Branislav Stojkovic", category = "Electro-Mechanical",
|
||||
instanceNamePrefix = "RY", description = "Miniature PCB mount relay, like Omron G5V-1 or G5V-2",
|
||||
zOrder = IDIYComponent.COMPONENT, enableCache = true)
|
||||
public class MiniRelay extends AbstractTransparentComponent<String> {
|
||||
public class MiniRelay extends AbstractLabeledComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -341,7 +341,12 @@ public class MiniRelay extends AbstractTransparentComponent<String> {
|
||||
}
|
||||
}
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
@@ -182,7 +182,7 @@ public class PlasticDCJack extends AbstractMultiPartComponent<String> {
|
||||
if (!outlineMode && getPolarity() != DCPolarity.NONE) {
|
||||
int spacing = (int) SPACING.convertToPixels();
|
||||
g2d.setColor(MARKING_COLOR);
|
||||
g2d.setFont(project.getFont().deriveFont(12f));
|
||||
g2d.setFont(project.getFont().deriveFont(12f));
|
||||
StringUtils.drawCenteredText(g2d, getPolarity() == DCPolarity.CENTER_NEGATIVE ? "+" : "-", controlPoints[0].getX(),
|
||||
controlPoints[0].getY() - spacing * 7 / 16, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
StringUtils.drawCenteredText(g2d, getPolarity() == DCPolarity.CENTER_NEGATIVE ? "_" : "+", controlPoints[2].getX(),
|
||||
@@ -274,5 +274,11 @@ public class PlasticDCJack extends AbstractMultiPartComponent<String> {
|
||||
int margin = 20;
|
||||
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Integer getFontSizeOverride() {
|
||||
return super.getFontSizeOverride();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,5 +331,11 @@ public class RCAJack extends AbstractMultiPartComponent<String> {
|
||||
int margin = 20;
|
||||
Rectangle2D bounds = getBody()[1].getBounds2D();
|
||||
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Integer getFontSizeOverride() {
|
||||
return super.getFontSizeOverride();
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -152,6 +152,11 @@ public class RotarySelectorSwitch extends AbstractMultiPartComponent<String> {
|
||||
if (showLabels) {
|
||||
g2d.setColor(TERMINAL_COLOR.darker());
|
||||
g2d.setFont(project.getFont().deriveFont(project.getFont().getSize2D() * 0.8f));
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
for (int i = 2; i < body.length; i++) {
|
||||
Rectangle2D bounds = body[i].getBounds2D();
|
||||
double x = (int) ((bounds.getCenterX() + controlPoints[i - 2].getX()) / 2);
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.OrientationHV;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.Theme;
|
||||
@@ -44,7 +44,7 @@ import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public abstract class AbstractGuitarPickup extends AbstractTransparentComponent<String> {
|
||||
public abstract class AbstractGuitarPickup extends AbstractLabeledComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -112,6 +112,11 @@ public abstract class AbstractGuitarPickup extends AbstractTransparentComponent<
|
||||
}
|
||||
g2d.setColor(finalLabelColor);
|
||||
g2d.setFont(project.getFont().deriveFont(Font.BOLD));
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Rectangle bounds = getBody()[0].getBounds();
|
||||
|
||||
AffineTransform originalTx = g2d.getTransform();
|
||||
|
||||
@@ -24,13 +24,13 @@ package org.diylc.components.passive;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.PositiveMeasureValidator;
|
||||
import org.diylc.core.measures.Resistance;
|
||||
|
||||
public abstract class AbstractPotentiometer extends AbstractTransparentComponent<Resistance> {
|
||||
public abstract class AbstractPotentiometer extends AbstractLabeledComponent<Resistance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -311,6 +311,10 @@ public class AudioTransformer extends AbstractMultiPartComponent<String> {
|
||||
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
// Draw winding designations
|
||||
Point2D wPoint = new Point2D.Double((int) (controlPoints[0].getX() + project.getFontSize()), (int) (controlPoints[0].getY() + leadSpacing.convertToPixels()));
|
||||
AffineTransform tx = getTx();
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -59,7 +59,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Multi-Section Capacitor", author = "Branislav Stojkovic", category = "Passive",
|
||||
instanceNamePrefix = "C", description = "Multi-section vertically mounted electrolytic capacitor, similar to JJ, CE and others",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, enableCache = true)
|
||||
public class MultiSectionCapacitor extends AbstractTransparentComponent<Capacitance[]> {
|
||||
public class MultiSectionCapacitor extends AbstractLabeledComponent<Capacitance[]> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -390,7 +390,12 @@ public class MultiSectionCapacitor extends AbstractTransparentComponent<Capacita
|
||||
}
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
@@ -301,7 +301,12 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
||||
}
|
||||
}
|
||||
// Draw caption.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
@@ -417,6 +417,11 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
+2
-2
@@ -32,12 +32,12 @@ import org.diylc.awt.StringUtils;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.netlist.ISpiceMapper;
|
||||
|
||||
public abstract class AbstractTransistorPackage extends AbstractTransparentComponent<String> implements ISpiceMapper {
|
||||
public abstract class AbstractTransistorPackage extends AbstractLabeledComponent<String> implements ISpiceMapper {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.components.AbstractLeadedComponent.LabelOriantation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.RoundedPolygon;
|
||||
import org.diylc.components.transform.DIL_ICTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
@@ -66,7 +66,7 @@ import org.diylc.utils.Constants;
|
||||
instanceNamePrefix = "BR", description = "Few variations of bridge rectifier chips",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class,
|
||||
enableCache = true)
|
||||
public class BridgeRectifier extends AbstractTransparentComponent<String> {
|
||||
public class BridgeRectifier extends AbstractLabeledComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -409,7 +409,12 @@ public class BridgeRectifier extends AbstractTransparentComponent<String> {
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
Theme theme =
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.components.transform.DIL_ICTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -59,7 +59,7 @@ import org.diylc.utils.Constants;
|
||||
instanceNamePrefix = "IC", description = "Dual-in-line package IC",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class,
|
||||
enableCache = true)
|
||||
public class DIL_IC extends AbstractTransparentComponent<String> {
|
||||
public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -359,7 +359,12 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
Theme theme =
|
||||
|
||||
@@ -202,7 +202,12 @@ public class TransistorTO1 extends AbstractTransistorPackage {
|
||||
g2d.draw(mainArea);
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
@@ -290,7 +290,12 @@ public class TransistorTO126 extends AbstractTransistorPackage {
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
@@ -327,7 +327,12 @@ public class TransistorTO220 extends AbstractTransistorPackage {
|
||||
}
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -57,7 +57,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Transistor (TO-3)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||
instanceNamePrefix = "Q", description = "Transistor with large metal body",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, enableCache = true)
|
||||
public class TransistorTO3 extends AbstractTransparentComponent<String> {
|
||||
public class TransistorTO3 extends AbstractLabeledComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -269,7 +269,12 @@ public class TransistorTO3 extends AbstractTransparentComponent<String> {
|
||||
g2d.draw(innerArea);
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
@@ -225,7 +225,12 @@ public class TransistorTO92 extends AbstractTransistorPackage {
|
||||
g2d.draw(mainArea);
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
Theme theme =
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.Project;
|
||||
@@ -48,7 +48,7 @@ import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public abstract class PassiveSMDComponent<T> extends AbstractTransparentComponent<T> {
|
||||
public abstract class PassiveSMDComponent<T> extends AbstractLabeledComponent<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -290,7 +290,12 @@ public abstract class PassiveSMDComponent<T> extends AbstractTransparentComponen
|
||||
g2d.draw(contactArea);
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
Theme theme =
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.components.transform.TO220Transformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -55,7 +55,7 @@ import org.diylc.utils.Constants;
|
||||
instanceNamePrefix = "V", description = "Sub-miniature (pencil) vacuum tube",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE,
|
||||
transformer = TO220Transformer.class)
|
||||
public class SubminiTube extends AbstractTransparentComponent<String> {
|
||||
public class SubminiTube extends AbstractLabeledComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -421,6 +421,11 @@ public class SubminiTube extends AbstractTransparentComponent<String> {
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
|
||||
Reference in New Issue
Block a user