variable indent options for trees (IDEA-126373)

This commit is contained in:
Konstantin Bulenkov
2016-09-05 15:42:23 +02:00
parent 2c6de02e56
commit df13f60fce
2 changed files with 12 additions and 11 deletions
@@ -503,6 +503,9 @@ vcs.add.remove.silent=true
ide.ui.scale.override=false
ide.ui.scale=1.0
ide.ui.tree.indent=-1
ide.ui.tree.indent.description=Allows to increase or decrease indents in trees. Use -1 to use default indent
ide.new.notification.enabled=true
ide.new.notification.visible.count=2
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -18,6 +18,8 @@ package com.intellij.util.ui.tree;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.MouseEventAdapter;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
@@ -73,19 +75,15 @@ public class WideSelectionTreeUI extends BasicTreeUI {
@Override
public int getRightChildIndent() {
return isSkinny() ? 8 : super.getRightChildIndent();
return isCustomIndent() ? getCustomIndent() : super.getRightChildIndent();
}
public boolean isSkinny() {
return mySkinny;
public boolean isCustomIndent() {
return getCustomIndent() > 0;
}
/**
* Setting to <code>true</code> make tree to reduce row offset
* @param skinny <code>true</code> to reduce row offset
*/
public void setSkinny(boolean skinny) {
mySkinny = skinny;
protected int getCustomIndent() {
return JBUI.scale(Registry.intValue("ide.ui.tree.indent"));
}
@Override
@@ -237,7 +235,7 @@ public class WideSelectionTreeUI extends BasicTreeUI {
@Override
protected int getRowX(int row, int depth) {
if (isSkinny()) {
if (isCustomIndent()) {
int off = tree.isRootVisible() ? 8 : 0;
return 8 * depth + 8 + off;
} else {