pixel hunting and visual artifacts fixed
authorDennis Ushakov <dennis.ushakov@gmail.com>
Fri, 27 Jan 2012 13:30:13 +0000 (17:30 +0400)
committerDennis Ushakov <dennis.ushakov@gmail.com>
Fri, 27 Jan 2012 13:39:47 +0000 (17:39 +0400)
platform/lang-impl/src/com/intellij/execution/ui/layout/impl/JBRunnerTabs.java
platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java

index 944876b1cca37f05a950faafa69d334a65b097e1..d32d0d97dbc163e219ca74697d9857a365eef60c 100644 (file)
@@ -65,9 +65,9 @@ public class
     Insets insets = getTabsBorder().getEffectiveBorder();
 
     int _x = effectiveBounds.x + insets.left;
-    int _y = effectiveBounds.y + insets.top + 5;
+    int _y = effectiveBounds.y + insets.top + 3;
     int _width = effectiveBounds.width - insets.left - insets.right;
-    int _height = effectiveBounds.height - insets.top - insets.bottom - 5;
+    int _height = effectiveBounds.height - insets.top - insets.bottom - 3;
     _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
 
     g2d
@@ -113,10 +113,10 @@ public class
     height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
 
     rectangle = new Rectangle(maxOffset, y, r2.width - maxOffset - insets.left - insets.right, height);
-    
+
     g2d.setPaint(UIUtil.getPanelBackground());
     g2d.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
-    g2d.fillRect(0, 0, rectangle.x + rectangle.width, 5);
+    g2d.fillRect(0, 0, rectangle.x + rectangle.width, 3);
     g2d.fillRect(2, maxLength, getSize().width, getSize().height);
     g2d.drawLine(0, 0, 0, getSize().height);
   }
@@ -126,7 +126,7 @@ public class
 
     TabLabel label = getSelectedLabel();
     Rectangle r = label.getBounds();
-    r = new Rectangle(r.x, r.y + 5, r.width, r.height - 5);
+    r = new Rectangle(r.x, r.y + 3, r.width, r.height - 3);
 
     ShapeInfo selectedShape = _computeSelectedLabelShape(r);
 
@@ -138,15 +138,22 @@ public class
     int _height = r.height;
 
     if (!isHideTabs()) {
-      g2d.setPaint(new GradientPaint(_x, _y, new SameColor(255), _x, _y + _height, UIUtil.getPanelBackground()));
+      g2d.setPaint(new GradientPaint(_x, _y, new SameColor(255), _x, _y + _height - 3, UIUtil.getPanelBackground()));
 
       g2d.fill(selectedShape.fillPath.getShape());
 
       g2d.setColor(new Color(255, 255, 255, 180));
       g2d.draw(selectedShape.fillPath.getShape());
+
+      // fix right side due to swing stupidity (fill & draw will occupy different shapes)
+      g2d.draw(selectedShape.labelPath
+                 .transformLine(selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getY() +
+                                                                                                       selectedShape.labelPath.deltaY(1),
+                                selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getMaxY() -
+                                                                                                       selectedShape.labelPath.deltaY(4)));
     }
     g2d.setColor(UIUtil.getPanelBackground());
-    g2d.fillRect(2, selectedShape.labelPath.getMaxY() - 3, selectedShape.path.getMaxX() - 3, 4);
+    g2d.fillRect(2, selectedShape.labelPath.getMaxY() - 2, selectedShape.path.getMaxX() - 2, 3);
     g2d.drawLine(1, selectedShape.labelPath.getMaxY(), 1, getHeight() - 1);
     g2d.drawLine(selectedShape.path.getMaxX() - 1, selectedShape.labelPath.getMaxY() - 4,
                  selectedShape.path.getMaxX() - 1, getHeight() - 1);
@@ -199,7 +206,7 @@ public class
   public int getToolbarInset() {
     return 8;
   }
-  
+
   public boolean shouldAddToGlobal(Point point) {
     final TabLabel label = getSelectedLabel();
     if (label == null || point == null) {
@@ -218,6 +225,8 @@ public class
     if (c instanceof GridImpl) {
       bounds.x -= 1;
       bounds.width += 1;
+      bounds.y -= 1;
+      bounds.height += 1;
     }
     return super.layout(c, bounds);
   }
@@ -249,7 +258,7 @@ public class
     public void apply(UiDecorator.UiDecoration decoration) {
       setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
       myLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
-      setBorder(new EmptyBorder(7, 5, 7, 5));
+      setBorder(new EmptyBorder(5, 5, 7, 5));
     }
 
     @Override
index 1206aa14c2f7413d1fbaa259a45bda4fe27f1e13..42c2d7c48830146061ed720e47b8dc073653b1ac 100644 (file)
@@ -612,7 +612,6 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
     if (grid != null || !createIfMissing) return grid;
 
     grid = new GridImpl(this, mySessionName);
-    grid.setBorder(new EmptyBorder(1, 0, 0, 0));
 
     if (myCurrentOver != null || myOriginal != null) {
       Integer forcedDropIndex = content.getUserData(RunnerLayout.DROP_INDEX);