OSDN Git Service

Visual adjustments to the layout feedback
authorTor Norbye <tnorbye@google.com>
Wed, 6 Oct 2010 22:30:37 +0000 (15:30 -0700)
committerTor Norbye <tnorbye@google.com>
Thu, 7 Oct 2010 00:31:32 +0000 (17:31 -0700)
commit1b7aa69940848edc01a44ec2c79a22c0f0b33259
tree9b1f4e7e8d57da51e5b9e7a0a2b44924e943699b
parent69b73d4b186ad4074a746bafcc425512e050e385
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
eclipse/plugins/com.android.ide.eclipse.adt/gscripts/BaseView.groovy
eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.AbsoluteLayout.groovy
eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.FrameLayout.groovy
eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.LinearLayout.groovy
eclipse/plugins/com.android.ide.eclipse.adt/gscripts/android.widget.RelativeLayout.groovy
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/editors/layout/gscripts/DrawingStyle.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/editors/layout/gscripts/IGraphics.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GCWrapper.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SwtDrawingStyle.java