Merge pull request #216 from enderw88/Configure-design-window-font-size
RocketInfo font size now configurable in options.
This commit is contained in:
commit
eaa6c32918
@ -274,6 +274,10 @@ pref.dlg.ZIParchives = ZIP archives (*.zip)
|
|||||||
pref.dlg.checkbox.Checkupdates = Check for software updates at startup
|
pref.dlg.checkbox.Checkupdates = Check for software updates at startup
|
||||||
pref.dlg.ttip.Checkupdatesnow = Check for software updates now
|
pref.dlg.ttip.Checkupdatesnow = Check for software updates now
|
||||||
pref.dlg.lbl.Selectprefunits = Select your preferred units:
|
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.Rocketdimensions = Rocket dimensions:
|
||||||
pref.dlg.lbl.Linedensity = Line density:
|
pref.dlg.lbl.Linedensity = Line density:
|
||||||
pref.dlg.lbl.Motordimensions = Motor dimensions:
|
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_ENABLE_AA = "OpenGL_Antialiasing_Is_Enabled";
|
||||||
public static final String OPENGL_USE_FBO = "OpenGL_Use_FBO";
|
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;
|
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.
|
* 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:
|
//// Position to insert new body components:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para");
|
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
|
//// Always ask
|
||||||
//// Insert in middle
|
//// Insert in middle
|
||||||
//// Add to end
|
//// Add to end
|
||||||
@ -178,7 +178,17 @@ public class PreferencesDialog extends JDialog {
|
|||||||
//// Delete
|
//// Delete
|
||||||
//// Confirm
|
//// Confirm
|
||||||
trans.get("pref.dlg.PrefBooleanSelector1"),
|
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:
|
//// User-defined thrust curves:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap");
|
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 preference;
|
||||||
private final String[] descriptions;
|
private final String[] descriptions;
|
||||||
|
|
||||||
public PrefChoiseSelector(String preference, String... descriptions) {
|
public PrefChoiceSelector(String preference, String... descriptions) {
|
||||||
this.preference = preference;
|
this.preference = preference;
|
||||||
this.descriptions = descriptions;
|
this.descriptions = descriptions;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,9 @@ public class RocketInfo implements FigureElement {
|
|||||||
public void paint(Graphics2D myG2, double scale, Rectangle visible) {
|
public void paint(Graphics2D myG2, double scale, Rectangle visible) {
|
||||||
this.g2 = myG2;
|
this.g2 = myG2;
|
||||||
this.line = FONT.getLineMetrics("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
this.line = FONT.getLineMetrics("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||||
myG2.getFontRenderContext()).getHeight();
|
myG2.getFontRenderContext()).getHeight() +
|
||||||
|
FONT.getLineMetrics("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
||||||
|
myG2.getFontRenderContext()).getDescent();
|
||||||
|
|
||||||
x1 = visible.x + MARGIN;
|
x1 = visible.x + MARGIN;
|
||||||
x2 = visible.x + visible.width - MARGIN;
|
x2 = visible.x + visible.width - MARGIN;
|
||||||
@ -429,11 +431,13 @@ public class RocketInfo implements FigureElement {
|
|||||||
|
|
||||||
|
|
||||||
private GlyphVector createText(String text) {
|
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) {
|
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