diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java index d680e8a7e173..50582bdf9f90 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java @@ -24,7 +24,6 @@ import com.intellij.ui.ColorUtil; import com.intellij.ui.Gray; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.tabs.TabInfo; -import com.intellij.ui.tabs.TabsUtil; import com.intellij.ui.tabs.UiDecorator; import com.intellij.ui.tabs.impl.JBTabsImpl; import com.intellij.ui.tabs.impl.TabLabel; @@ -75,7 +74,7 @@ public class int _y = effectiveBounds.y + insets.top + 3; int _width = effectiveBounds.width - insets.left - insets.right; int _height = effectiveBounds.height - insets.top - insets.bottom - 3; - _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + _height -= getActiveTabUnderlineHeight(); if (dark) { g2d.setPaint(UIUtil.getGradientPaint(_x, _y, ColorUtil.shift(UIUtil.getListBackground(), 1.3), _x, _y + effectiveBounds.height, UIUtil.getPanelBackground())); g2d.fillRect(_x, _y, _width, _height); @@ -122,7 +121,7 @@ public class Rectangle rectangle; int y = r2.y + insets.top; int height = maxLength - insets.top - insets.bottom; - height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + height -= getActiveTabUnderlineHeight(); rectangle = new Rectangle(maxOffset, y, r2.width - maxOffset - insets.left - insets.right, height); @@ -194,7 +193,7 @@ public class shape.insets = shape.path.transformInsets(getLayoutInsets()); shape.labelPath = shape.path.createTransform(r); - shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1); + shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1); shape.labelTopY = shape.labelPath.getY() + shape.labelPath.deltaY(1); shape.labelLeftX = shape.labelPath.getX(); shape.labelRightX = shape.labelPath.getMaxX() - shape.labelPath.deltaX(1); @@ -210,8 +209,8 @@ public class int lastX = shape.path.getWidth() - shape.path.deltaX(shape.insets.right); shape.path.lineTo(lastX, shape.labelBottomY); - shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1)); - shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1)); + shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1)); + shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1)); shape.path.closePath(); shape.fillPath = shape.path.copy(); @@ -298,7 +297,7 @@ public class @Override public Dimension getPreferredSize() { Dimension result = super.getPreferredSize(); - result.height += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + result.height += myTabs.getActiveTabUnderlineHeight(); return result; } } diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java index 43f06bff2850..5b10dbfe2b43 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java @@ -26,7 +26,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.tabs.JBTabsPosition; import com.intellij.ui.tabs.TabInfo; -import com.intellij.ui.tabs.TabsUtil; import com.intellij.ui.tabs.impl.singleRow.ScrollableSingleRowLayout; import com.intellij.ui.tabs.impl.singleRow.SingleRowLayout; import com.intellij.ui.tabs.impl.table.TableLayout; @@ -98,9 +97,11 @@ public class JBEditorTabs extends JBTabsImpl { @Override public boolean hasUnderline() { - return true; + return isSingleRow(); } + + protected void doPaintInactive(Graphics2D g2d, boolean leftGhostExists, TabLabel label, @@ -116,14 +117,14 @@ public class JBEditorTabs extends JBTabsImpl { if ((!isSingleRow() /* for multiline */) || (isSingleRow() && isHorizontalTabs())) { if (isSingleRow() && getPosition() == JBTabsPosition.bottom) { - _y += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + _y += getActiveTabUnderlineHeight(); } else { if (isSingleRow()) { - _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + _height -= getActiveTabUnderlineHeight(); } else { TabInfo info = label.getInfo(); if (((TableLayout)getEffectiveLayout()).isLastRow(info)) { - _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + _height -= getActiveTabUnderlineHeight(); } } } @@ -131,7 +132,19 @@ public class JBEditorTabs extends JBTabsImpl { final boolean vertical = getTabsPosition() == JBTabsPosition.left || getTabsPosition() == JBTabsPosition.right; final Color tabColor = label.getInfo().getTabColor(); + final Composite oldComposite = g2d.getComposite(); + //if (label != getSelectedLabel()) { + // g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f)); + //} getPainter().doPaintInactive(g2d, effectiveBounds, _x, _y, _width, _height, tabColor, row, column, vertical); + //g2d.setComposite(oldComposite); + } + + + + @Override + public int getActiveTabUnderlineHeight() { + return hasUnderline() ? super.getActiveTabUnderlineHeight() : 1; } JBEditorTabsPainter getPainter() { @@ -186,9 +199,9 @@ public class JBEditorTabs extends JBTabsImpl { int y = r2.y + insets.top; int height = maxLength - insets.top - insets.bottom; if (getTabsPosition() == JBTabsPosition.bottom) { - y = r2.height - height - insets.top + TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + y = r2.height - height - insets.top + getActiveTabUnderlineHeight(); } else { - height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + height -= getActiveTabUnderlineHeight(); } rectangle = new Rectangle(maxOffset, y, r2.width - maxOffset - insets.left - insets.right, height); @@ -229,7 +242,7 @@ public class JBEditorTabs extends JBTabsImpl { shape.insets = shape.path.transformInsets(getLayoutInsets()); shape.labelPath = shape.path.createTransform(getSelectedLabel().getBounds()); - shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1); + shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1); shape.labelTopY = shape.labelPath.getY() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? shape.labelPath.deltaY(1) : 0) ; shape.labelLeftX = shape.labelPath.getX() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX( @@ -247,8 +260,8 @@ public class JBEditorTabs extends JBTabsImpl { int lastX = shape.path.getWidth() - shape.path.deltaX(shape.insets.right); shape.path.lineTo(lastX, shape.labelBottomY); - shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1)); - shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1)); + shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1)); + shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(getActiveTabUnderlineHeight() - 1)); shape.path.closePath(); shape.fillPath = shape.path.copy(); diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java index 4c6ecada830a..97c158e08d9f 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java @@ -345,6 +345,10 @@ public class JBTabsImpl extends JComponent return this; } + public int getActiveTabUnderlineHeight() { + return TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; + } + public boolean isEditorTabs() { return false; } diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java index a360c4e9294f..8a0aa2b39473 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java @@ -53,7 +53,7 @@ public class TabLabel extends JPanel { private boolean myCentered; private final Wrapper myLabelPlaceholder = new Wrapper(false); - private final JBTabsImpl myTabs; + protected final JBTabsImpl myTabs; private BufferedImage myInactiveStateImage; private Rectangle myLastPaintedInactiveImageBounds; @@ -241,7 +241,12 @@ public class TabLabel extends JPanel { } }); + final Composite oldComposite = ((Graphics2D)g).getComposite(); + if (myTabs instanceof JBEditorTabs && !myTabs.isSingleRow() && myTabs.getSelectedInfo() != myInfo) { + ((Graphics2D)g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); + } super.paint(g); + ((Graphics2D)g).setComposite(oldComposite); doTranslate(new PairConsumer() { @Override @@ -253,7 +258,7 @@ public class TabLabel extends JPanel { protected int getNonSelectedOffset() { if (myTabs.isEditorTabs() && (myTabs.isSingleRow() || ((TableLayout)myTabs.getEffectiveLayout()).isLastRow(getInfo()))) { - return -TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT / 2 + 1; + return -myTabs.getActiveTabUnderlineHeight() / 2 + 1; } return 1; } @@ -275,7 +280,7 @@ public class TabLabel extends JPanel { switch (pos) { case top: case bottom: - if (myTabs.hasUnderline()) size.height += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1; + if (myTabs.hasUnderline()) size.height += myTabs.getActiveTabUnderlineHeight() - 1; break; case left: case right: diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java index 6bd2e1aa52bf..ca8bb535f046 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayout.java @@ -18,7 +18,6 @@ package com.intellij.ui.tabs.impl.singleRow; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.tabs.JBTabsPosition; import com.intellij.ui.tabs.TabInfo; -import com.intellij.ui.tabs.TabsUtil; import com.intellij.ui.tabs.impl.*; import org.jetbrains.annotations.Nullable; @@ -50,8 +49,8 @@ public class SingleRowLayout extends TabLayout { protected int getIconY(Rectangle iconRec) { final int shift; switch (myTabs.getTabsPosition()) { - case bottom: shift = TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT; break; - case top: shift = -(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT / 2); break; + case bottom: shift = myTabs.getActiveTabUnderlineHeight(); break; + case top: shift = -(myTabs.getActiveTabUnderlineHeight() / 2); break; default: shift = 0; } return super.getIconY(iconRec) + shift; diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/table/TableLayout.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/table/TableLayout.java index 9b313783dea7..af45cf9b1b0d 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/table/TableLayout.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/table/TableLayout.java @@ -16,7 +16,6 @@ package com.intellij.ui.tabs.impl.table; import com.intellij.ui.tabs.TabInfo; -import com.intellij.ui.tabs.TabsUtil; import com.intellij.ui.tabs.impl.JBTabsImpl; import com.intellij.ui.tabs.impl.LayoutPassInfo; import com.intellij.ui.tabs.impl.TabLabel; @@ -103,10 +102,10 @@ public class TableLayout extends TabLayout { toMove.add(data.table.get(i)); } - for (TableRow eachMove : toMove) { - data.table.remove(eachMove); - data.table.add(0, eachMove); - } + //for (TableRow eachMove : toMove) { + // data.table.remove(eachMove); + // data.table.add(0, eachMove); + //} return data; @@ -131,7 +130,7 @@ public class TableLayout extends TabLayout { int eachY = insets.top; int eachX; int row = 0; - final int tabUnderlineFix = myTabs.isEditorTabs() ? TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT : 0; + final int tabUnderlineFix = myTabs.isEditorTabs() ? myTabs.getActiveTabUnderlineHeight() : 0; for (TableRow eachRow : data.table) { eachX = insets.left; diff --git a/platform/platform-impl/src/com/intellij/ui/JBTabsPaneImpl.java b/platform/platform-impl/src/com/intellij/ui/JBTabsPaneImpl.java index fe041c5ea02b..cfea2dfb0d8e 100644 --- a/platform/platform-impl/src/com/intellij/ui/JBTabsPaneImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/JBTabsPaneImpl.java @@ -65,11 +65,11 @@ public class JBTabsPaneImpl implements TabbedPane, SwingConstants { maxOffset++; g2d.setPaint(UIUtil.getPanelBackground()); if (getFirstTabOffset() > 0) { - g2d.fillRect(clip.x, clip.y, clip.x + getFirstTabOffset() - 1, clip.y + maxLength - TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT); + g2d.fillRect(clip.x, clip.y, clip.x + getFirstTabOffset() - 1, clip.y + maxLength - getActiveTabUnderlineHeight()); } - g2d.fillRect(clip.x + maxOffset, clip.y, clip.width - maxOffset, clip.y + maxLength - TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT); + g2d.fillRect(clip.x + maxOffset, clip.y, clip.width - maxOffset, clip.y + maxLength - getActiveTabUnderlineHeight()); g2d.setPaint(new JBColor(Gray._181, UIUtil.getPanelBackground())); - g2d.drawLine(clip.x + maxOffset, clip.y + maxLength - TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT, clip.x + clip.width, clip.y + maxLength - TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT); + g2d.drawLine(clip.x + maxOffset, clip.y + maxLength - getActiveTabUnderlineHeight(), clip.x + clip.width, clip.y + maxLength - getActiveTabUnderlineHeight()); g2d.setPaint(UIUtil.getPanelBackground()); g2d.drawLine(clip.x, clip.y + maxLength, clip.width, clip.y + maxLength); }