convert rest of UISettings to smart serializable properties

This commit is contained in:
Vladimir Krivosheev
2017-02-13 15:22:44 +01:00
parent 1cfe0a2ef9
commit 3f7599efac
9 changed files with 23 additions and 16 deletions
@@ -104,6 +104,12 @@ class UISettings : BaseState(), PersistentStateComponent<UISettings> {
@Transient
var OVERRIDE_NONIDEA_LAF_FONTS = false
@Suppress("unused")
@Deprecated("Use presentationModeFontSize", replaceWith = ReplaceWith("presentationModeFontSize"))
@JvmField
@Transient
var PRESENTATION_MODE_FONT_SIZE = 24
@get:OptionTag("REUSE_NOT_MODIFIED_TABS") var reuseNotModifiedTabs by storedProperty(false)
@get:OptionTag("ANIMATE_WINDOWS") var animateWindows by storedProperty(true)
@get:OptionTag("SHOW_TOOL_WINDOW_NUMBERS") var showToolWindowsNumbers by storedProperty(true)
@@ -147,7 +153,7 @@ class UISettings : BaseState(), PersistentStateComponent<UISettings> {
@JvmField var DND_WITH_PRESSED_ALT_ONLY = false
@JvmField var DEFAULT_AUTOSCROLL_TO_SOURCE = false
@Transient var presentationMode = false
@JvmField var PRESENTATION_MODE_FONT_SIZE = 24
@get:OptionTag("PRESENTATION_MODE_FONT_SIZE") var presentationModeFontSize by storedProperty(24)
@get:OptionTag("MARK_MODIFIED_TABS_WITH_ASTERISK") var markModifiedTabsWithAsterisk by storedProperty(false)
@get:OptionTag("SHOW_TABS_TOOLTIPS") var showTabsTooltips by storedProperty(true)
@get:OptionTag("SHOW_DIRECTORY_FOR_NON_UNIQUE_FILENAMES") var showDirectoryForNonUniqueFilenames by storedProperty(true)
@@ -221,6 +227,7 @@ class UISettings : BaseState(), PersistentStateComponent<UISettings> {
EDITOR_AA_TYPE = editorAAType
PRESENTATION_MODE = presentationMode
OVERRIDE_NONIDEA_LAF_FONTS = overrideLafFonts
PRESENTATION_MODE_FONT_SIZE = presentationModeFontSize
}
private fun initDefFont() {
@@ -219,9 +219,10 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
@Override
public Font getFont(EditorFontType key) {
if (UISettings.getInstance().getPresentationMode()) {
UISettings uiSettings = UISettings.getInstance();
if (uiSettings.getPresentationMode()) {
final Font font = myFonts.get(key);
return new Font(font.getName(), font.getStyle(), UISettings.getInstance().PRESENTATION_MODE_FONT_SIZE);
return new Font(font.getName(), font.getStyle(), uiSettings.getPresentationModeFontSize());
}
return myFonts.get(key);
}
@@ -89,7 +89,7 @@ public class ConsoleViewUtil {
final DelegateColorScheme scheme = updateConsoleColorScheme(editor.getColorsScheme());
if (UISettings.getInstance().getPresentationMode()) {
scheme.setEditorFontSize(UISettings.getInstance().PRESENTATION_MODE_FONT_SIZE);
scheme.setEditorFontSize(UISettings.getInstance().getPresentationModeFontSize());
}
editor.setColorsScheme(scheme);
});
@@ -113,7 +113,7 @@ public class TogglePresentationModeAction extends AnAction implements DumbAware
private static void tweakEditorAndFireUpdateUI(UISettings settings, boolean inPresentation) {
EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
int fontSize = inPresentation ? settings.PRESENTATION_MODE_FONT_SIZE : globalScheme.getEditorFontSize();
int fontSize = inPresentation ? settings.getPresentationModeFontSize() : globalScheme.getEditorFontSize();
if (inPresentation) {
ourSavedConsoleFontSize = globalScheme.getConsoleFontSize();
globalScheme.setConsoleFontSize(fontSize);
@@ -148,7 +148,7 @@ public class TogglePresentationModeAction extends AnAction implements DumbAware
}
}
}
float scaleFactor = settings.PRESENTATION_MODE_FONT_SIZE / UIUtil.DEF_SYSTEM_FONT_SIZE;
float scaleFactor = settings.getPresentationModeFontSize() / UIUtil.DEF_SYSTEM_FONT_SIZE;
ourSavedScaleFactor = JBUI.scale(1f);
JBUI.setUserScaleFactor(scaleFactor);
for (Object key : ourSavedValues.keySet()) {
@@ -153,7 +153,7 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
initComponent();
UISettings settings = UISettings.getInstance();
int _fontSize = getIntValue(myComponent.myFontSizeCombo, settings.FONT_SIZE);
int _presentationFontSize = getIntValue(myComponent.myPresentationModeFontSize, settings.PRESENTATION_MODE_FONT_SIZE);
int _presentationFontSize = getIntValue(myComponent.myPresentationModeFontSize, settings.getPresentationModeFontSize());
boolean update = false;
boolean shouldUpdateUI = false;
String _fontFace = myComponent.myFontCombo.getFontName();
@@ -165,8 +165,8 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
update = true;
}
if (_presentationFontSize != settings.PRESENTATION_MODE_FONT_SIZE) {
settings.PRESENTATION_MODE_FONT_SIZE = _presentationFontSize;
if (_presentationFontSize != settings.getPresentationModeFontSize()) {
settings.setPresentationModeFontSize(_presentationFontSize);
shouldUpdateUI = true;
}
@@ -326,7 +326,7 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
myComponent.myAntialiasingInEditor.setSelectedItem(settings.getEditorAAType());
myComponent.myFontSizeCombo.setSelectedItem(Integer.toString(settings.FONT_SIZE));
myComponent.myPresentationModeFontSize.setSelectedItem(Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE));
myComponent.myPresentationModeFontSize.setSelectedItem(Integer.toString(settings.getPresentationModeFontSize()));
myComponent.myAnimateWindowsCheckBox.setSelected(settings.getAnimateWindows());
myComponent.myWindowShortcutsCheckBox.setSelected(settings.getShowToolWindowsNumbers());
myComponent.myShowToolStripesCheckBox.setSelected(!settings.getHideToolStripes());
@@ -416,7 +416,7 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
isModified |= myComponent.myHideIconsInQuickNavigation.isSelected() != settings.getShowIconInQuickNavigation();
isModified |= !Comparing.equal(myComponent.myPresentationModeFontSize.getEditor().getItem(), Integer.toString(settings.PRESENTATION_MODE_FONT_SIZE));
isModified |= !Comparing.equal(myComponent.myPresentationModeFontSize.getEditor().getItem(), Integer.toString(settings.getPresentationModeFontSize()));
isModified |= myComponent.myMoveMouseOnDefaultButtonCheckBox.isSelected() != settings.getMoveMouseOnDefaultButton();
isModified |= myComponent.myHideNavigationPopupsCheckBox.isSelected() != settings.HIDE_NAVIGATION_ON_FOCUS_LOSS;
@@ -860,7 +860,7 @@ public final class EditorUtil {
public static Font getEditorFont() {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
int size = UISettings.getInstance().getPresentationMode()
? UISettings.getInstance().PRESENTATION_MODE_FONT_SIZE - 4 : scheme.getEditorFontSize();
? UISettings.getInstance().getPresentationModeFontSize() - 4 : scheme.getEditorFontSize();
return new Font(scheme.getEditorFontName(), Font.PLAIN, size);
}
@@ -536,7 +536,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}, myCaretModel);
if (UISettings.getInstance().getPresentationMode()) {
setFontSize(UISettings.getInstance().PRESENTATION_MODE_FONT_SIZE);
setFontSize(UISettings.getInstance().getPresentationModeFontSize());
}
myGutterComponent.updateSize();
@@ -548,7 +548,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
if (SystemInfo.isJavaVersionAtLeast("1.8") && SystemInfo.isMacIntel64 && SystemInfo.isJetbrainsJvm && Registry.is("ide.mac.forceTouch")) {
new MacGestureSupportForEditor(getComponent());
}
}
/**
@@ -141,7 +141,7 @@ public class JBTerminalSystemSettingsProviderBase extends DefaultTabbedSettingsP
protected static int consoleFontSize(MyColorSchemeDelegate colorScheme) {
int size;
if (UISettings.getInstance().getPresentationMode()) {
size = UISettings.getInstance().PRESENTATION_MODE_FONT_SIZE;
size = UISettings.getInstance().getPresentationModeFontSize();
}
else {
size = colorScheme.getGlobal().getConsoleFontSize();
@@ -569,7 +569,7 @@ public class EditorTextField extends NonOpaquePanel implements DocumentListener,
return;
}
UISettings settings = UISettings.getInstance();
if (settings.getPresentationMode()) editor.setFontSize(settings.PRESENTATION_MODE_FONT_SIZE);
if (settings.getPresentationMode()) editor.setFontSize(settings.getPresentationModeFontSize());
}
protected boolean shouldHaveBorder() {