aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2010-10-06 15:30:37 -0700
committerTor Norbye <tnorbye@google.com>2010-10-06 17:31:32 -0700
commit1b7aa69940848edc01a44ec2c79a22c0f0b33259 (patch)
tree9b1f4e7e8d57da51e5b9e7a0a2b44924e943699b /eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy
parent69b73d4b186ad4074a746bafcc425512e050e385 (diff)
downloadsdk-1b7aa69940848edc01a44ec2c79a22c0f0b33259.zip
sdk-1b7aa69940848edc01a44ec2c79a22c0f0b33259.tar.gz
sdk-1b7aa69940848edc01a44ec2c79a22c0f0b33259.tar.bz2
Visual adjustments to the layout feedback
This changeset makes a number of adjustments to the visual feedback shown during layout dragging & dropping, selection, etc. These are: 1. Render text on top of a translucent mask (white on a transparent gray rectangle). This ensures that the text is readable regardless of what content is under the text. We can't just use the background color for the normal SWT drawString for two reasons: First, we need to control the alpha of the background only (since we want the text to be opaque and the background to be translucent), and second, we often want to draw multiple lines of text, so we need to manually draw a background rectangle which accommodates the maximum width of ALL the lines such taht we don't have a ragged background. 2. Paint the outline mode lines using solid, translucent lines. And adjust the bounding box computation in this case by 1 pixel such that when you have adjacent boxes (such as in LinearLayout), you don't end up with two thin lines next to each other creating a thick line. 3. Change the DrawingStyle internal API from "foreground" and "background" colors to "stroke" (border) and "fill" (interior), with individual alphas. This makes the color definitions simpler (for example we don't need two separate styles, one for the selection border and one for the selection interior). 4. Make the hover more subtle, using no border and just a light translucent gray rectangle to only slightly draw attention to the view under the mouse. 5. Change the appearance of selection to light blue and use a long dashed border around it. The anchor lines are more faint and more translucent to make them stand out less. 6. Change the appearance of the drop-preview to use a dash patterned border identical to the selection border, but colored orange instead. The matching border pattern will hopefully reinforce that the drop-preview line is where the selection (also dashed) will go. 7. Use green to show available drop zones (the grid surrounding a target in RelativeLayout, and the positions between elements in LinearLayout). 8. For invalid drops, use a white X on a red background as the overlay fill. 9. I replaced the oval+X pattern from the LayoutHelpers and replaced them with the orange dashed insert-position lines. I also adjusted the LinearLayout to draw the bounding boxes such that the middle of the bounding box, rather than the top left edge, are aligned with the insert position. Change-Id: I85c77b9fa84b732a78aac635442f96e7ccfc3983
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy')
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy5
1 files changed, 2 insertions, 3 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy b/eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy
index 97d67ba..5a30a9f 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy
@@ -48,9 +48,7 @@ public class AndroidWidgetFrameLayoutRule extends BaseLayout {
return;
}
- gc.setForeground(gc.registerColor(0x00FFFF00));
- gc.setLineStyle(IGraphics.LineStyle.LINE_SOLID);
- gc.setLineWidth(2);
+ gc.useStyle(DrawingStyle.DROP_RECIPIENT);
gc.drawRect(b);
// Get the drop point
@@ -71,6 +69,7 @@ public class AndroidWidgetFrameLayoutRule extends BaseLayout {
// the drop point.
int offsetX = x - be.x;
int offsetY = y - be.y;
+ gc.useStyle(DrawingStyle.DROP_PREVIEW);
elements.each {
drawElement(gc, it, offsetX, offsetY);
}