Add UI color for multi-comp edit color

This commit is contained in:
SiboVG 2023-09-22 18:29:06 +02:00
parent ebb4186ccb
commit 08695a8ffb
3 changed files with 36 additions and 2 deletions

View File

@ -100,6 +100,7 @@ public class RocketComponentConfig extends JPanel {
private boolean allMassive; // Checks whether all listener components, and this component, are massive private boolean allMassive; // Checks whether all listener components, and this component, are massive
private static Color darkWarningColor; private static Color darkWarningColor;
private static Color multiCompEditColor;
private static Border border; private static Border border;
static { static {
@ -203,6 +204,7 @@ public class RocketComponentConfig extends JPanel {
private static void updateColors() { private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor(); darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor();
multiCompEditColor = GUIUtil.getUITheme().getMultiCompEditColor();
border = GUIUtil.getUITheme().getBorder(); border = GUIUtil.getUITheme().getBorder();
} }
@ -270,7 +272,7 @@ public class RocketComponentConfig extends JPanel {
//// Multi-comp edit label //// Multi-comp edit label
multiCompEditLabel = new StyledLabel(" ", -1, Style.BOLD); multiCompEditLabel = new StyledLabel(" ", -1, Style.BOLD);
multiCompEditLabel.setFontColor(new Color(170, 0, 100)); multiCompEditLabel.setFontColor(multiCompEditColor);
buttonPanel.add(multiCompEditLabel, "split 2"); buttonPanel.add(multiCompEditLabel, "split 2");
//// Mass: //// Mass:

View File

@ -33,6 +33,7 @@ import net.sf.openrocket.document.events.DocumentChangeEvent;
import net.sf.openrocket.gui.components.ConfigurationComboBox; import net.sf.openrocket.gui.components.ConfigurationComboBox;
import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.util.GUIUtil; import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.util.UITheme;
import net.sf.openrocket.gui.widgets.SelectColorButton; import net.sf.openrocket.gui.widgets.SelectColorButton;
import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.FlightConfiguration; import net.sf.openrocket.rocketcomponent.FlightConfiguration;
@ -62,6 +63,12 @@ public class SimulationEditDialog extends JDialog {
private boolean isModified = false; // Whether the simulation has been modified private boolean isModified = false; // Whether the simulation has been modified
private final boolean isNewSimulation; // Whether you are editing a new simulation, or an existing one private final boolean isNewSimulation; // Whether you are editing a new simulation, or an existing one
private static Color multiCompEditColor;
static {
initColors();
}
public SimulationEditDialog(Window parent, final OpenRocketDocument document, boolean isNewSimulation, Simulation... sims) { public SimulationEditDialog(Window parent, final OpenRocketDocument document, boolean isNewSimulation, Simulation... sims) {
//// Edit simulation //// Edit simulation
super(parent, sims.length == 1 ? trans.get("simedtdlg.title.Editsim") : trans.get("simedtdlg.title.MultiSimEdit"), super(parent, sims.length == 1 ? trans.get("simedtdlg.title.Editsim") : trans.get("simedtdlg.title.MultiSimEdit"),
@ -103,6 +110,15 @@ public class SimulationEditDialog extends JDialog {
GUIUtil.setDisposableDialogOptions(this, null); GUIUtil.setDisposableDialogOptions(this, null);
} }
private static void initColors() {
updateColors();
UITheme.Theme.addUIThemeChangeListener(SimulationEditDialog::updateColors);
}
private static void updateColors() {
multiCompEditColor = GUIUtil.getUITheme().getMultiCompEditColor();
}
private boolean isSingleEdit() { private boolean isSingleEdit() {
return simulationList.length == 1; return simulationList.length == 1;
} }
@ -247,7 +263,7 @@ public class SimulationEditDialog extends JDialog {
//// Multi-simulation edit //// Multi-simulation edit
if (simulationList.length > 1) { if (simulationList.length > 1) {
StyledLabel multiSimEditLabel = new StyledLabel("", -1, StyledLabel.Style.BOLD); StyledLabel multiSimEditLabel = new StyledLabel("", -1, StyledLabel.Style.BOLD);
multiSimEditLabel.setFontColor(new Color(170, 0, 100)); multiSimEditLabel.setFontColor(multiCompEditColor);
multiSimEditLabel.setText(trans.get("simedtdlg.title.MultiSimEdit")); multiSimEditLabel.setText(trans.get("simedtdlg.title.MultiSimEdit"));
StringBuilder components = new StringBuilder(trans.get("simedtdlg.title.MultiSimEdit.ttip")); StringBuilder components = new StringBuilder(trans.get("simedtdlg.title.MultiSimEdit.ttip"));
for (int i = 0; i < simulationList.length; i++) { for (int i = 0; i < simulationList.length; i++) {

View File

@ -45,6 +45,7 @@ public class UITheme {
Color getRowBackgroundDarkerColor(); Color getRowBackgroundDarkerColor();
Color getFlightDataTextActiveColor(); Color getFlightDataTextActiveColor();
Color getFlightDataTextInactiveColor(); Color getFlightDataTextInactiveColor();
Color getMultiCompEditColor();
// Component colors // Component colors
String getDefaultBodyComponentColor(); String getDefaultBodyComponentColor();
@ -208,6 +209,11 @@ public class UITheme {
return new Color(0,0,127,127); return new Color(0,0,127,127);
} }
@Override
public Color getMultiCompEditColor() {
return new Color(170, 0, 100);
}
@Override @Override
public String getDefaultBodyComponentColor() { public String getDefaultBodyComponentColor() {
return "0,0,240"; return "0,0,240";
@ -434,6 +440,11 @@ public class UITheme {
return new Color(128, 166, 230, 127); return new Color(128, 166, 230, 127);
} }
@Override
public Color getMultiCompEditColor() {
return new Color(222, 146, 176);
}
@Override @Override
public String getDefaultBodyComponentColor() { public String getDefaultBodyComponentColor() {
return "150,162,255"; return "150,162,255";
@ -668,6 +679,11 @@ public class UITheme {
return getCurrentTheme().getFlightDataTextInactiveColor(); return getCurrentTheme().getFlightDataTextInactiveColor();
} }
@Override
public Color getMultiCompEditColor() {
return getCurrentTheme().getMultiCompEditColor();
}
@Override @Override
public String getDefaultBodyComponentColor() { public String getDefaultBodyComponentColor() {
return getCurrentTheme().getDefaultBodyComponentColor(); return getCurrentTheme().getDefaultBodyComponentColor();