rename window autosize property and remove hardcoded text strings
This commit is contained in:
parent
770f227637
commit
91b91777de
|
@ -28,6 +28,8 @@ public enum Language {
|
|||
setting_accuracy,
|
||||
setting_locked,
|
||||
setting_warnOnReset,
|
||||
setting_windowUserResizable,
|
||||
setting_windowWidth,
|
||||
|
||||
// Settings > Color
|
||||
setting_color_background,
|
||||
|
@ -139,6 +141,7 @@ public enum Language {
|
|||
error_read_file,
|
||||
error_write_file,
|
||||
error_import_run,
|
||||
error_window_width,
|
||||
|
||||
// Actions
|
||||
action_accept,
|
||||
|
@ -248,6 +251,7 @@ public enum Language {
|
|||
TIME,
|
||||
UNTITLED,
|
||||
WARNING,
|
||||
WINDOW_SIZE,
|
||||
|
||||
/*
|
||||
* 1.4
|
||||
|
|
|
@ -73,7 +73,7 @@ public class Llanfair extends BorderlessFrame implements TableModelListener,
|
|||
|
||||
RESOURCES = new Resources();
|
||||
registerFonts();
|
||||
setResizable(Settings.windowAutoSize.get());
|
||||
setResizable(Settings.windowUserResizable.get());
|
||||
setLookAndFeel();
|
||||
addComponentListener(this);
|
||||
|
||||
|
@ -351,11 +351,11 @@ public class Llanfair extends BorderlessFrame implements TableModelListener,
|
|||
|| Settings.footerShowDeltaLabels.equals(property)
|
||||
|| Settings.footerVerbose.equals(property)
|
||||
|| Settings.footerMultiline.equals(property)
|
||||
|| Settings.windowAutoSize.equals(property)
|
||||
|| Settings.windowUserResizable.equals(property)
|
||||
|| Settings.windowWidth.equals(property)
|
||||
|| Run.NAME_PROPERTY.equals(property)) {
|
||||
setResizable(Settings.windowAutoSize.get());
|
||||
MenuItem.enableResizeOptions(Settings.windowAutoSize.get());
|
||||
setResizable(Settings.windowUserResizable.get());
|
||||
MenuItem.enableResizeOptions(Settings.windowUserResizable.get());
|
||||
forceResize();
|
||||
}
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ public class Llanfair extends BorderlessFrame implements TableModelListener,
|
|||
public void componentResized(ComponentEvent e) {
|
||||
// we may have to override the width, but allow the height to grow as needed
|
||||
// don't have to change anything if autosizing
|
||||
if (!Settings.windowAutoSize.get())
|
||||
if (!Settings.windowUserResizable.get())
|
||||
setSize(new Dimension(Settings.windowWidth.get(), getHeight()));
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ public class Llanfair extends BorderlessFrame implements TableModelListener,
|
|||
private void forceResize() {
|
||||
Dimension newSize = new Dimension();
|
||||
newSize.height = getHeight();
|
||||
if (Settings.windowAutoSize.get())
|
||||
if (Settings.windowUserResizable.get())
|
||||
newSize.width = getWidth();
|
||||
else
|
||||
newSize.width = Settings.windowWidth.get();
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Settings {
|
|||
public static final Property<Compare> compareMethod = new Property<>( "compareMethod" );
|
||||
public static final Property<Accuracy> accuracy = new Property<>( "accuracy" );
|
||||
public static final Property<Boolean> warnOnReset = new Property<>( "warnOnReset" );
|
||||
public static final Property<Boolean> windowAutoSize = new Property<>( "windowAutoSize" );
|
||||
public static final Property<Boolean> windowUserResizable = new Property<>( "windowUserResizable" );
|
||||
public static final Property<Integer> windowWidth = new Property<>( "windowWidth" );
|
||||
|
||||
/* COLOR properties */
|
||||
|
@ -213,7 +213,7 @@ public class Settings {
|
|||
global.put( compareMethod.key, Compare.BEST_OVERALL_RUN );
|
||||
global.put( accuracy.key, Accuracy.TENTH );
|
||||
global.put( warnOnReset.key, true );
|
||||
global.put( windowAutoSize.key, true );
|
||||
global.put( windowUserResizable.key, true );
|
||||
global.put( windowWidth.key, null );
|
||||
|
||||
global.put( colorBackground.key, Color.decode("0x000000") );
|
||||
|
|
|
@ -42,7 +42,7 @@ public class TabGeneral extends SettingsTab implements ActionListener {
|
|||
|
||||
private JLabel windowSizeLabel;
|
||||
|
||||
private JCheckBox windowAutoSize;
|
||||
private JCheckBox windowUserResizable;
|
||||
|
||||
private JTextField windowSize;
|
||||
|
||||
|
@ -83,20 +83,20 @@ public class TabGeneral extends SettingsTab implements ActionListener {
|
|||
warnOnReset.setSelected(Settings.warnOnReset.get());
|
||||
warnOnReset.addActionListener(this);
|
||||
|
||||
windowSizeLabel = new JLabel("Window Width");
|
||||
windowSizeLabel = new JLabel("" + Language.WINDOW_SIZE);
|
||||
|
||||
windowAutoSize = new JCheckBox("Autosize");
|
||||
windowAutoSize.setSelected(Settings.windowAutoSize.get());
|
||||
windowAutoSize.addActionListener(this);
|
||||
windowUserResizable = new JCheckBox("" + Language.setting_windowUserResizable);
|
||||
windowUserResizable.setSelected(Settings.windowUserResizable.get());
|
||||
windowUserResizable.addActionListener(this);
|
||||
|
||||
String windowWidthText = "";
|
||||
if (Settings.windowWidth.get() != null)
|
||||
windowWidthText = "" + Settings.windowWidth.get();
|
||||
windowSize = new JTextField(windowWidthText, 4);
|
||||
windowSize.setEnabled(!windowAutoSize.isSelected());
|
||||
windowSize.setEnabled(!windowUserResizable.isSelected());
|
||||
windowSize.addActionListener(this);
|
||||
|
||||
windowSizeUnitsText = new JLabel("pixels");
|
||||
windowSizeUnitsText = new JLabel("" + Language.setting_windowWidth);
|
||||
|
||||
languageText = new JLabel("" + Language.setting_language);
|
||||
alwaysOnTopText = new JLabel("" + Language.APPLICATION);
|
||||
|
@ -123,8 +123,8 @@ public class TabGeneral extends SettingsTab implements ActionListener {
|
|||
}
|
||||
} else if (source.equals(warnOnReset)) {
|
||||
Settings.warnOnReset.set(warnOnReset.isSelected());
|
||||
} else if (source.equals(windowAutoSize)) {
|
||||
windowSize.setEnabled(!windowAutoSize.isSelected());
|
||||
} else if (source.equals(windowUserResizable)) {
|
||||
windowSize.setEnabled(!windowUserResizable.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,15 +133,15 @@ public class TabGeneral extends SettingsTab implements ActionListener {
|
|||
void doDelayedSettingChange() throws InvalidSettingException {
|
||||
Settings.alwaysOnTop.set(alwaysOnTop.isSelected());
|
||||
|
||||
Settings.windowAutoSize.set(windowAutoSize.isSelected());
|
||||
Settings.windowUserResizable.set(windowUserResizable.isSelected());
|
||||
|
||||
if (!windowAutoSize.isSelected()) {
|
||||
if (!windowUserResizable.isSelected()) {
|
||||
int windowWidth;
|
||||
try {
|
||||
windowWidth = Integer.parseInt(windowSize.getText().trim());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new InvalidSettingException(this, windowSize, "Window Width must be a positive integer.");
|
||||
throw new InvalidSettingException(this, windowSize, "" + Language.error_window_width);
|
||||
}
|
||||
|
||||
Settings.windowWidth.set(windowWidth);
|
||||
|
@ -191,7 +191,7 @@ public class TabGeneral extends SettingsTab implements ActionListener {
|
|||
add(accuracyPanel, GBC.grid(1, 4).fill(GBC.H).insets(10, 0));
|
||||
|
||||
add(windowSizeLabel, GBC.grid(0, 5).anchor(GBC.LE).insets(5, 10));
|
||||
add(windowAutoSize, GBC.grid(1, 5).anchor(GBC.LS));
|
||||
add(windowUserResizable, GBC.grid(1, 5).anchor(GBC.LS));
|
||||
JPanel windowSizeContainer = new JPanel();
|
||||
windowSizeContainer.add(windowSize);
|
||||
windowSizeContainer.add(windowSizeUnitsText);
|
||||
|
|
|
@ -410,7 +410,7 @@ class Core extends JPanel implements ActionListener {
|
|||
} else if (Settings.coreOtherTimeFont.equals(property)) {
|
||||
updateFonts(TIME);
|
||||
forceResize();
|
||||
} else if (Settings.windowAutoSize.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
} else if (Settings.windowUserResizable.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
updateSize();
|
||||
forceResize();
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ class Footer extends JPanel {
|
|||
} else if (Settings.coreOtherTimeFont.equals(property)) {
|
||||
updateFonts(TIME | DELTA);
|
||||
forceResize();
|
||||
} else if (Settings.windowAutoSize.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
} else if (Settings.windowUserResizable.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
updateSize();
|
||||
forceResize();
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ class Graph extends JPanel {
|
|||
}
|
||||
} else if (Settings.coreFont.equals(property)) {
|
||||
updateFonts(ALL);
|
||||
} else if (Settings.windowAutoSize.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
} else if (Settings.windowUserResizable.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
updateSize();
|
||||
forceResize();
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ public class History extends JPanel {
|
|||
updateValues(TIME | LIVE);
|
||||
updateColors(TIME);
|
||||
forceResize();
|
||||
} else if (Settings.windowAutoSize.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
} else if (Settings.windowUserResizable.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
updateSize();
|
||||
forceResize();
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ public class RunPane extends JPanel {
|
|||
updateFonts(TITLE);
|
||||
} else if (Settings.coreFont.equals(property)) {
|
||||
updateFonts(ALL & ~TITLE);
|
||||
} else if (Settings.windowAutoSize.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
} else if (Settings.windowUserResizable.equals(property) || Settings.windowWidth.equals(property)) {
|
||||
updateSize();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ setting_compareMethod = Compare Method
|
|||
setting_accuracy = Accuracy
|
||||
setting_locked =
|
||||
setting_warnOnReset = Warn on Reset if better times
|
||||
setting_windowUserResizable = User Resizable
|
||||
setting_windowWidth = Fixed Width (Pixels)
|
||||
|
||||
# Settings > Color
|
||||
setting_color_background = Background
|
||||
|
@ -120,6 +122,7 @@ menuItem_exit = Exit
|
|||
error_read_file = "{0}" isn't a valid Llanfair run or you do not have permission to read it.
|
||||
error_write_file = You do not have permission to write in that folder.
|
||||
error_import_run = "{0}" isn't a recognized run file.
|
||||
error_window_width = Window Width must be a positive integer.
|
||||
|
||||
# Actions
|
||||
action_accept =
|
||||
|
@ -222,6 +225,7 @@ SPLIT = Split:
|
|||
TIME = Time (Split)
|
||||
UNTITLED = <untitled>
|
||||
WARNING = Warning
|
||||
WINDOW_SIZE = Window Size
|
||||
|
||||
# 1.4
|
||||
INCREMENT =
|
||||
|
|
Reference in a new issue