mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
UISettings — use smart state class (stored properties), part 3
This commit is contained in:
@@ -64,16 +64,18 @@ class UISettings : BaseState(), PersistentStateComponent<UISettings> {
|
||||
|
||||
@Suppress("unused")
|
||||
@Deprecated("Use hideToolStripes", replaceWith = ReplaceWith("hideToolStripes"))
|
||||
@JvmField var HIDE_TOOL_STRIPES = true
|
||||
@JvmField
|
||||
@Transient
|
||||
var HIDE_TOOL_STRIPES = true
|
||||
|
||||
@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)
|
||||
@get:OptionTag("HIDE_TOOL_STRIPES") var hideToolStripes by storedProperty(true)
|
||||
@get:OptionTag("WIDESCREEN_SUPPORT") var wideScreenSupport by storedProperty(false)
|
||||
@get:OptionTag("LEFT_HORIZONTAL_SPLIT") var leftGorizontalSplit by storedProperty(false)
|
||||
@get:OptionTag("RIGHT_HORIZONTAL_SPLIT") var rightGorizontalSplit by storedProperty(false)
|
||||
|
||||
@JvmField var WIDESCREEN_SUPPORT = false
|
||||
@JvmField var LEFT_HORIZONTAL_SPLIT = false
|
||||
@JvmField var RIGHT_HORIZONTAL_SPLIT = false
|
||||
@JvmField var SHOW_EDITOR_TOOLTIP = true
|
||||
@JvmField var SHOW_MEMORY_INDICATOR = false
|
||||
@JvmField var ALLOW_MERGE_BUTTONS = true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,8 +59,8 @@ public final class ToolWindowAnchor {
|
||||
}
|
||||
|
||||
public boolean isSplitVertically() {
|
||||
return this == LEFT && !UISettings.getInstance().LEFT_HORIZONTAL_SPLIT
|
||||
|| this == RIGHT && !UISettings.getInstance().RIGHT_HORIZONTAL_SPLIT;
|
||||
return this == LEFT && !UISettings.getInstance().getLeftGorizontalSplit()
|
||||
|| this == RIGHT && !UISettings.getInstance().getRightGorizontalSplit();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -213,14 +213,14 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
update |= settings.USE_SMALL_LABELS_ON_TABS != myComponent.myUseSmallLabelsOnTabs.isSelected();
|
||||
settings.USE_SMALL_LABELS_ON_TABS = myComponent.myUseSmallLabelsOnTabs.isSelected();
|
||||
|
||||
update |= settings.WIDESCREEN_SUPPORT != myComponent.myWidescreenLayoutCheckBox.isSelected();
|
||||
settings.WIDESCREEN_SUPPORT = myComponent.myWidescreenLayoutCheckBox.isSelected();
|
||||
update |= settings.getWideScreenSupport() != myComponent.myWidescreenLayoutCheckBox.isSelected();
|
||||
settings.setWideScreenSupport(myComponent.myWidescreenLayoutCheckBox.isSelected());
|
||||
|
||||
update |= settings.LEFT_HORIZONTAL_SPLIT != myComponent.myLeftLayoutCheckBox.isSelected();
|
||||
settings.LEFT_HORIZONTAL_SPLIT = myComponent.myLeftLayoutCheckBox.isSelected();
|
||||
update |= settings.getLeftGorizontalSplit() != myComponent.myLeftLayoutCheckBox.isSelected();
|
||||
settings.setLeftGorizontalSplit(myComponent.myLeftLayoutCheckBox.isSelected());
|
||||
|
||||
update |= settings.RIGHT_HORIZONTAL_SPLIT != myComponent.myRightLayoutCheckBox.isSelected();
|
||||
settings.RIGHT_HORIZONTAL_SPLIT = myComponent.myRightLayoutCheckBox.isSelected();
|
||||
update |= settings.getRightGorizontalSplit() != myComponent.myRightLayoutCheckBox.isSelected();
|
||||
settings.setRightGorizontalSplit(myComponent.myRightLayoutCheckBox.isSelected());
|
||||
|
||||
update |= settings.NAVIGATE_TO_PREVIEW != (myComponent.myNavigateToPreviewCheckBox.isVisible() && myComponent.myNavigateToPreviewCheckBox.isSelected());
|
||||
settings.NAVIGATE_TO_PREVIEW = myComponent.myNavigateToPreviewCheckBox.isSelected();
|
||||
@@ -351,9 +351,9 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
myComponent.myOverrideLAFFonts.setSelected(settings.OVERRIDE_NONIDEA_LAF_FONTS);
|
||||
myComponent.myDisableMnemonics.setSelected(settings.DISABLE_MNEMONICS);
|
||||
myComponent.myUseSmallLabelsOnTabs.setSelected(settings.USE_SMALL_LABELS_ON_TABS);
|
||||
myComponent.myWidescreenLayoutCheckBox.setSelected(settings.WIDESCREEN_SUPPORT);
|
||||
myComponent.myLeftLayoutCheckBox.setSelected(settings.LEFT_HORIZONTAL_SPLIT);
|
||||
myComponent.myRightLayoutCheckBox.setSelected(settings.RIGHT_HORIZONTAL_SPLIT);
|
||||
myComponent.myWidescreenLayoutCheckBox.setSelected(settings.getWideScreenSupport());
|
||||
myComponent.myLeftLayoutCheckBox.setSelected(settings.getLeftGorizontalSplit());
|
||||
myComponent.myRightLayoutCheckBox.setSelected(settings.getRightGorizontalSplit());
|
||||
myComponent.myNavigateToPreviewCheckBox.setSelected(settings.NAVIGATE_TO_PREVIEW);
|
||||
myComponent.myNavigateToPreviewCheckBox.setVisible(false);//disabled for a while
|
||||
myComponent.myColorBlindnessPanel.setColorBlindness(settings.COLOR_BLINDNESS);
|
||||
@@ -416,9 +416,9 @@ public class AppearanceConfigurable extends BaseConfigurable implements Searchab
|
||||
isModified |= myComponent.myDisableMnemonicInControlsCheckBox.isSelected() != settings.DISABLE_MNEMONICS_IN_CONTROLS;
|
||||
|
||||
isModified |= myComponent.myUseSmallLabelsOnTabs.isSelected() != settings.USE_SMALL_LABELS_ON_TABS;
|
||||
isModified |= myComponent.myWidescreenLayoutCheckBox.isSelected() != settings.WIDESCREEN_SUPPORT;
|
||||
isModified |= myComponent.myLeftLayoutCheckBox.isSelected() != settings.LEFT_HORIZONTAL_SPLIT;
|
||||
isModified |= myComponent.myRightLayoutCheckBox.isSelected() != settings.RIGHT_HORIZONTAL_SPLIT;
|
||||
isModified |= myComponent.myWidescreenLayoutCheckBox.isSelected() != settings.getWideScreenSupport();
|
||||
isModified |= myComponent.myLeftLayoutCheckBox.isSelected() != settings.getLeftGorizontalSplit();
|
||||
isModified |= myComponent.myRightLayoutCheckBox.isSelected() != settings.getRightGorizontalSplit();
|
||||
isModified |= myComponent.myNavigateToPreviewCheckBox.isSelected() != settings.NAVIGATE_TO_PREVIEW;
|
||||
isModified |= myComponent.myColorBlindnessPanel.getColorBlindness() != settings.COLOR_BLINDNESS;
|
||||
|
||||
|
||||
@@ -111,9 +111,9 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
myHorizontalSplitter.setDividerWidth(0);
|
||||
myHorizontalSplitter.setDividerMouseZoneSize(Registry.intValue("ide.splitter.mouseZone"));
|
||||
myHorizontalSplitter.setBackground(Color.gray);
|
||||
myWidescreen = UISettings.getInstance().WIDESCREEN_SUPPORT;
|
||||
myLeftHorizontalSplit = UISettings.getInstance().LEFT_HORIZONTAL_SPLIT;
|
||||
myRightHorizontalSplit = UISettings.getInstance().RIGHT_HORIZONTAL_SPLIT;
|
||||
myWidescreen = UISettings.getInstance().getWideScreenSupport();
|
||||
myLeftHorizontalSplit = UISettings.getInstance().getLeftGorizontalSplit();
|
||||
myRightHorizontalSplit = UISettings.getInstance().getRightGorizontalSplit();
|
||||
if (myWidescreen) {
|
||||
myHorizontalSplitter.setInnerComponent(myVerticalSplitter);
|
||||
}
|
||||
@@ -577,9 +577,10 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
}
|
||||
|
||||
private void updateLayout() {
|
||||
if (myWidescreen != UISettings.getInstance().WIDESCREEN_SUPPORT) {
|
||||
UISettings uiSettings = UISettings.getInstance();
|
||||
if (myWidescreen != uiSettings.getWideScreenSupport()) {
|
||||
JComponent documentComponent = (myWidescreen ? myVerticalSplitter : myHorizontalSplitter).getInnerComponent();
|
||||
myWidescreen = UISettings.getInstance().WIDESCREEN_SUPPORT;
|
||||
myWidescreen = uiSettings.getWideScreenSupport();
|
||||
if (myWidescreen) {
|
||||
myVerticalSplitter.setInnerComponent(null);
|
||||
myHorizontalSplitter.setInnerComponent(myVerticalSplitter);
|
||||
@@ -592,7 +593,7 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
myLayeredPane.add(myWidescreen ? myHorizontalSplitter : myVerticalSplitter, DEFAULT_LAYER);
|
||||
setDocumentComponent(documentComponent);
|
||||
}
|
||||
if (myLeftHorizontalSplit != UISettings.getInstance().LEFT_HORIZONTAL_SPLIT) {
|
||||
if (myLeftHorizontalSplit != uiSettings.getLeftGorizontalSplit()) {
|
||||
JComponent component = getComponentAt(ToolWindowAnchor.LEFT);
|
||||
if (component instanceof Splitter) {
|
||||
Splitter splitter = (Splitter)component;
|
||||
@@ -602,9 +603,9 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
? first.getWindowInfo().getWeight()
|
||||
: first.getWindowInfo().getWeight() + second.getWindowInfo().getWeight());
|
||||
}
|
||||
myLeftHorizontalSplit = UISettings.getInstance().LEFT_HORIZONTAL_SPLIT;
|
||||
myLeftHorizontalSplit = uiSettings.getLeftGorizontalSplit();
|
||||
}
|
||||
if (myRightHorizontalSplit != UISettings.getInstance().RIGHT_HORIZONTAL_SPLIT) {
|
||||
if (myRightHorizontalSplit != uiSettings.getRightGorizontalSplit()) {
|
||||
JComponent component = getComponentAt(ToolWindowAnchor.RIGHT);
|
||||
if (component instanceof Splitter) {
|
||||
Splitter splitter = (Splitter)component;
|
||||
@@ -614,7 +615,7 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
? first.getWindowInfo().getWeight()
|
||||
: first.getWindowInfo().getWeight() + second.getWindowInfo().getWeight());
|
||||
}
|
||||
myRightHorizontalSplit = UISettings.getInstance().RIGHT_HORIZONTAL_SPLIT;
|
||||
myRightHorizontalSplit = uiSettings.getRightGorizontalSplit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,10 +804,10 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
@Override
|
||||
public void uiSettingsChanged(UISettings uiSettings) {
|
||||
if (anchor == ToolWindowAnchor.LEFT) {
|
||||
setOrientation(!uiSettings.LEFT_HORIZONTAL_SPLIT);
|
||||
setOrientation(!uiSettings.getLeftGorizontalSplit());
|
||||
}
|
||||
else if (anchor == ToolWindowAnchor.RIGHT) {
|
||||
setOrientation(!uiSettings.RIGHT_HORIZONTAL_SPLIT);
|
||||
setOrientation(!uiSettings.getRightGorizontalSplit());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -819,14 +820,14 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
boolean isSplitterHorizontalNow = !splitter.isVertical();
|
||||
UISettings settings = UISettings.getInstance();
|
||||
if (anchor == ToolWindowAnchor.LEFT) {
|
||||
if (settings.LEFT_HORIZONTAL_SPLIT != isSplitterHorizontalNow) {
|
||||
settings.LEFT_HORIZONTAL_SPLIT = isSplitterHorizontalNow;
|
||||
if (settings.getLeftGorizontalSplit() != isSplitterHorizontalNow) {
|
||||
settings.setLeftGorizontalSplit(isSplitterHorizontalNow);
|
||||
settings.fireUISettingsChanged();
|
||||
}
|
||||
}
|
||||
if (anchor == ToolWindowAnchor.RIGHT) {
|
||||
if (settings.RIGHT_HORIZONTAL_SPLIT != isSplitterHorizontalNow) {
|
||||
settings.RIGHT_HORIZONTAL_SPLIT = isSplitterHorizontalNow;
|
||||
if (settings.getRightGorizontalSplit() != isSplitterHorizontalNow) {
|
||||
settings.setRightGorizontalSplit(isSplitterHorizontalNow);
|
||||
settings.fireUISettingsChanged();
|
||||
}
|
||||
}
|
||||
@@ -896,8 +897,7 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
public final void run() {
|
||||
try {
|
||||
// Show component.
|
||||
final UISettings uiSettings = UISettings.getInstance();
|
||||
if (!myDirtyMode && uiSettings.getAnimateWindows() && !RemoteDesktopDetector.isRemoteSession()) {
|
||||
if (!myDirtyMode && UISettings.getInstance().getAnimateWindows() && !RemoteDesktopDetector.isRemoteSession()) {
|
||||
// Prepare top image. This image is scrolling over bottom image.
|
||||
final Image topImage = myLayeredPane.getTopImage();
|
||||
final Graphics topGraphics = topImage.getGraphics();
|
||||
@@ -927,7 +927,7 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
bottomGraphics.dispose();
|
||||
}
|
||||
// Start animation.
|
||||
final Surface surface = new Surface(topImage, bottomImage, 1, myInfo.getAnchor(), uiSettings.ANIMATION_DURATION);
|
||||
final Surface surface = new Surface(topImage, bottomImage, 1, myInfo.getAnchor(), UISettings.ANIMATION_DURATION);
|
||||
myLayeredPane.add(surface, JLayeredPane.PALETTE_LAYER);
|
||||
surface.setBounds(bounds);
|
||||
myLayeredPane.validate();
|
||||
|
||||
Reference in New Issue
Block a user