extract xcode like scrollbars as a separate option

This commit is contained in:
Sergey Ignatov
2014-11-22 13:52:43 +03:00
parent edfefcb5f3
commit 743907c126
3 changed files with 13 additions and 10 deletions
@@ -692,7 +692,7 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
}
private void paintMacThumb(Graphics g, Rectangle thumbBounds) {
if (isMacScrollbarHiddenAndDistractionFreeEnabled()) return;
if (isMacScrollbarHiddenAndXcodeLikeScrollbar()) return;
thumbBounds = getMacScrollBarBounds(thumbBounds, true);
Graphics2D g2d = (Graphics2D)g;
@@ -837,12 +837,12 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
return new EmptyButton();
}
protected boolean isMacScrollbarHiddenAndDistractionFreeEnabled() {
return myMacScrollbarHidden && isMacOverlayScrollbarSupported() && isDistractionFreeMode();
protected boolean isMacScrollbarHiddenAndXcodeLikeScrollbar() {
return myMacScrollbarHidden && isMacOverlayScrollbarSupported() && xcodeLikeScrollbar();
}
protected static boolean isDistractionFreeMode() {
return Registry.is("editor.distraction.free.mode");
protected static boolean xcodeLikeScrollbar() {
return Registry.is("editor.xcode.like.scrollbar");
}
public void registerRepaintCallback(ScrollbarRepaintCallback callback) {
@@ -520,8 +520,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
}
@Override
protected boolean isMacScrollbarHiddenAndDistractionFreeEnabled() {
return super.isMacScrollbarHiddenAndDistractionFreeEnabled() && isRealFileEditor(myEditor);
protected boolean isMacScrollbarHiddenAndXcodeLikeScrollbar() {
return super.isMacScrollbarHiddenAndXcodeLikeScrollbar() && isRealFileEditor(myEditor);
}
@Override
@@ -606,7 +606,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
@Override
protected boolean alwaysPaintThumb() {
if (scrollbar.getOrientation() == Adjustable.VERTICAL) return !(isDistractionFreeMode() && isRealFileEditor(myEditor));
if (scrollbar.getOrientation() == Adjustable.VERTICAL) return !(xcodeLikeScrollbar() && isRealFileEditor(myEditor));
return super.alwaysPaintThumb();
}
@@ -644,7 +644,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
@Override
protected void doPaintTrack(@NotNull Graphics g, @NotNull JComponent c, @NotNull Rectangle bounds) {
if (isMacScrollbarHiddenAndDistractionFreeEnabled()) {
if (isMacScrollbarHiddenAndXcodeLikeScrollbar()) {
paintTrackBasement(g, bounds);
return;
}
@@ -876,7 +876,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
@Override
public void mouseMoved(@NotNull MouseEvent e) {
if (isMacScrollbarHiddenAndDistractionFreeEnabled()) return;
if (isMacScrollbarHiddenAndXcodeLikeScrollbar()) return;
EditorImpl.MyScrollBar scrollBar = myEditor.getVerticalScrollBar();
int buttonHeight = scrollBar.getDecScrollButtonHeight();
int lineCount = getDocument().getLineCount() + myEditor.getSettings().getAdditionalLinesCount();
@@ -489,3 +489,6 @@ editor.caret.width.description=Caret width
editor.caret.width.restartRequired=true
editor.transparent.scrollbar=true
editor.xcode.like.scrollbar=false
editor.xcode.like.scrollbar.description=Enables auto-hideable Xcode-like editor stripes