mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-13 02:32:09 +10:00
phase 1
This commit is contained in:
@@ -25,6 +25,8 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JComboBox;
|
||||
@@ -44,7 +46,7 @@ public class EnumEditor extends JComboBox<Object> {
|
||||
|
||||
public EnumEditor(final PropertyWrapper property) {
|
||||
this.property = property;
|
||||
Object[] values = property.getType().getEnumConstants();
|
||||
Object[] values = getOfferedValues(property);
|
||||
if (property.isReadOnly())
|
||||
setEnabled(false);
|
||||
setModel(new DefaultComboBoxModel<Object>(values));
|
||||
@@ -76,4 +78,24 @@ public class EnumEditor extends JComboBox<Object> {
|
||||
setBackground(Constants.MULTI_VALUE_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
// deprecated constants stay loadable from old files but are not offered, unless one is the
|
||||
// current value, which must stay visible rather than be silently replaced
|
||||
private static Object[] getOfferedValues(PropertyWrapper property) {
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
for (Object value : property.getType().getEnumConstants()) {
|
||||
if (value.equals(property.getValue()) || !isDeprecated((Enum<?>) value)) {
|
||||
values.add(value);
|
||||
}
|
||||
}
|
||||
return values.toArray();
|
||||
}
|
||||
|
||||
private static boolean isDeprecated(Enum<?> value) {
|
||||
try {
|
||||
return value.getDeclaringClass().getField(value.name()).isAnnotationPresent(Deprecated.class);
|
||||
} catch (NoSuchFieldException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,6 +372,9 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
if (configManager.readBoolean(IPlugInPort.LOCKED_ALPHA, true)) {
|
||||
drawOptions.add(DrawOption.LOCKED_ALPHA);
|
||||
}
|
||||
if (configManager.readBoolean(IPlugInPort.FADE_FAR_SIDE_KEY, true)) {
|
||||
drawOptions.add(DrawOption.FADE_FAR_SIDE);
|
||||
}
|
||||
return drawOptions;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,9 @@ public class ConfigPlugin implements IPlugIn {
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Extra Working Area", IPlugInPort.EXTRA_SPACE_KEY, true),
|
||||
CONFIG_MENU);
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Fade Copper Under Board",
|
||||
IPlugInPort.FADE_FAR_SIDE_KEY, true), CONFIG_MENU);
|
||||
// swingUI.injectMenuAction(
|
||||
// ActionFactory.getInstance().createConfigAction(plugInPort, "Hardware Acceleration", IPlugInPort.HARDWARE_ACCELERATION, false),
|
||||
// CONFIG_MENU);
|
||||
|
||||
+3
@@ -69,6 +69,9 @@ public class ProjectDrawingProvider implements IDrawingProvider {
|
||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.OUTLINE_KEY, false)) {
|
||||
drawOptions.add(DrawOption.OUTLINE_MODE);
|
||||
}
|
||||
if (ConfigurationManager.getInstance().readBoolean(IPlugInPort.FADE_FAR_SIDE_KEY, true)) {
|
||||
drawOptions.add(DrawOption.FADE_FAR_SIDE);
|
||||
}
|
||||
if (includeExtraSpace) {
|
||||
drawOptions.add(DrawOption.EXTRA_SPACE);
|
||||
}
|
||||
|
||||
@@ -732,3 +732,4 @@ Remove default model|Standardmodell entfernen
|
||||
Value Notation|Wertnotation
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|Dezimal (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|Kupfer unter der Platine abblenden
|
||||
|
||||
@@ -725,3 +725,4 @@ Remove default model
|
||||
Value Notation
|
||||
Decimal (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board
|
||||
|
||||
@@ -728,3 +728,4 @@ Remove default model|Quitar modelo predeterminado
|
||||
Value Notation|Notación de valores
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|Decimal (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|Atenuar cobre bajo la placa
|
||||
|
||||
@@ -727,3 +727,4 @@ Remove default model|Retirer le modèle par défaut
|
||||
Value Notation|Notation des valeurs
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|Décimale (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|Estomper le cuivre sous la carte
|
||||
|
||||
@@ -729,3 +729,4 @@ Remove default model|Rimuovi modello predefinito
|
||||
Value Notation|Notazione dei valori
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|Decimale (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|Attenua il rame sotto la scheda
|
||||
|
||||
@@ -733,3 +733,4 @@ Remove default model|Standaardmodel verwijderen
|
||||
Value Notation|Waardenotatie
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|Decimaal (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|Koper onder de print vervagen
|
||||
|
||||
@@ -728,3 +728,4 @@ Remove default model|Remover modelo padrão
|
||||
Value Notation|Notação de valores
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|Decimal (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|Esmaecer cobre sob a placa
|
||||
|
||||
@@ -724,3 +724,4 @@ Remove default model|Ukloni podrazumevani model
|
||||
Value Notation|Zapis vrednosti
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|Decimalni (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|Prigušen Bakar Ispod Ploče
|
||||
|
||||
@@ -726,3 +726,4 @@ Remove default model|डिफ़ॉल्ट मॉडल हटाएँ
|
||||
Value Notation|मान संकेतन
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|दशमलव (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|बोर्ड के नीचे तांबा धुंधला करें
|
||||
|
||||
@@ -726,3 +726,4 @@ Remove default model|取消默认型号
|
||||
Value Notation|数值表示法
|
||||
Decimal (4.7K, 0.22uF, 6.3V)|小数 (4.7K, 0.22uF, 6.3V)
|
||||
RKM (4K7, 0u22, 6V3)|RKM (4K7, 0u22, 6V3)
|
||||
Fade Copper Under Board|淡化板下铜箔
|
||||
|
||||
Reference in New Issue
Block a user