RocketInfo font size now configurable in option. Small is 11, medium is 14, large is 17.
Corrected spelling on PrefChoiseSelector name, will get the translation keys some other time. Added LineMetrics.descent to the line height for laying out the text in RocketInfo.
This commit is contained in:
parent
c85fe63ed8
commit
4310cd4b51
@ -274,6 +274,10 @@ pref.dlg.ZIParchives = ZIP archives (*.zip)
|
||||
pref.dlg.checkbox.Checkupdates = Check for software updates at startup
|
||||
pref.dlg.ttip.Checkupdatesnow = Check for software updates now
|
||||
pref.dlg.lbl.Selectprefunits = Select your preferred units:
|
||||
pref.dlg.lbl.Rocketinfofontsize = Size of text in rocket design panel:
|
||||
pref.dlg.PrefFontSmall = Small
|
||||
pref.dlg.PrefFontMedium = Medium
|
||||
pref.dlg.PrefFontLarge = Large
|
||||
pref.dlg.lbl.Rocketdimensions = Rocket dimensions:
|
||||
pref.dlg.lbl.Linedensity = Line density:
|
||||
pref.dlg.lbl.Motordimensions = Motor dimensions:
|
||||
|
@ -55,6 +55,8 @@ public abstract class Preferences {
|
||||
public static final String OPENGL_ENABLE_AA = "OpenGL_Antialiasing_Is_Enabled";
|
||||
public static final String OPENGL_USE_FBO = "OpenGL_Use_FBO";
|
||||
|
||||
public static final String ROCKET_INFO_FONT_SIZE = "RocketInfoFontSize";
|
||||
|
||||
/*
|
||||
* ******************************************************************************************
|
||||
*
|
||||
@ -104,6 +106,10 @@ public abstract class Preferences {
|
||||
return 0.3;
|
||||
}
|
||||
|
||||
public final float getRocketInfoFontSize() {
|
||||
return (float) (11.0 + 3 * Application.getPreferences().getChoice(Preferences.ROCKET_INFO_FONT_SIZE, 2, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable the auto-opening of the last edited design file on startup.
|
||||
*/
|
||||
|
@ -164,7 +164,7 @@ public class PreferencesDialog extends JDialog {
|
||||
|
||||
//// Position to insert new body components:
|
||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para");
|
||||
panel.add(new JComboBox(new PrefChoiseSelector(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY,
|
||||
panel.add(new JComboBox(new PrefChoiceSelector(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY,
|
||||
//// Always ask
|
||||
//// Insert in middle
|
||||
//// Add to end
|
||||
@ -178,7 +178,17 @@ public class PreferencesDialog extends JDialog {
|
||||
//// Delete
|
||||
//// Confirm
|
||||
trans.get("pref.dlg.PrefBooleanSelector1"),
|
||||
trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap 40lp, growx, sg combos");
|
||||
trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap, growx, sg combos");
|
||||
//// Position to insert new body components:
|
||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rocketinfofontsize")), "gapright para");
|
||||
|
||||
panel.add(new JComboBox(new PrefChoiceSelector(Preferences.ROCKET_INFO_FONT_SIZE,
|
||||
//// Small
|
||||
//// Medium
|
||||
//// Large
|
||||
trans.get("pref.dlg.PrefFontSmall"),
|
||||
trans.get("pref.dlg.PrefFontMedium"),
|
||||
trans.get("pref.dlg.PrefFontLarge"))), "wrap 40lp, growx, sg combos");
|
||||
|
||||
//// User-defined thrust curves:
|
||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap");
|
||||
@ -673,11 +683,11 @@ public class PreferencesDialog extends JDialog {
|
||||
|
||||
|
||||
|
||||
private class PrefChoiseSelector extends AbstractListModel implements ComboBoxModel {
|
||||
private class PrefChoiceSelector extends AbstractListModel implements ComboBoxModel {
|
||||
private final String preference;
|
||||
private final String[] descriptions;
|
||||
|
||||
public PrefChoiseSelector(String preference, String... descriptions) {
|
||||
public PrefChoiceSelector(String preference, String... descriptions) {
|
||||
this.preference = preference;
|
||||
this.descriptions = descriptions;
|
||||
}
|
||||
|
@ -77,7 +77,9 @@ public class RocketInfo implements FigureElement {
|
||||
public void paint(Graphics2D myG2, double scale, Rectangle visible) {
|
||||
this.g2 = myG2;
|
||||
this.line = FONT.getLineMetrics("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||
myG2.getFontRenderContext()).getHeight();
|
||||
myG2.getFontRenderContext()).getHeight() +
|
||||
FONT.getLineMetrics("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||
myG2.getFontRenderContext()).getDescent();
|
||||
|
||||
x1 = visible.x + MARGIN;
|
||||
x2 = visible.x + visible.width - MARGIN;
|
||||
@ -429,11 +431,13 @@ public class RocketInfo implements FigureElement {
|
||||
|
||||
|
||||
private GlyphVector createText(String text) {
|
||||
return FONT.createGlyphVector(g2.getFontRenderContext(), text);
|
||||
float size=Application.getPreferences().getRocketInfoFontSize();
|
||||
return (FONT.deriveFont(size)).createGlyphVector(g2.getFontRenderContext(), text);
|
||||
}
|
||||
|
||||
private GlyphVector createSmallText(String text) {
|
||||
return SMALLFONT.createGlyphVector(g2.getFontRenderContext(), text);
|
||||
float size=(float) (Application.getPreferences().getRocketInfoFontSize()-2.0);
|
||||
return (SMALLFONT.deriveFont(size)).createGlyphVector(g2.getFontRenderContext(), text);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user