OSDN Git Service

Preview items on palette drags
authorTor Norbye <tnorbye@google.com>
Thu, 11 Nov 2010 02:03:07 +0000 (18:03 -0800)
committerTor Norbye <tnorbye@google.com>
Fri, 12 Nov 2010 22:39:48 +0000 (14:39 -0800)
commitab784698270a3b49d0f082715c8b4bb9dff04d67
tree696814da5f71a3418d9c26b69760f6243c2fd5fd
parent8e482f2908ccecd785cd84bb425014f4ec333759
Preview items on palette drags

This checkin renders previews of Android views as you drag them from
the palette, using the current theme settings you have for the
associated editor. If you are using version 5 or later of the layout
library, you get full alpha-blending on the rendered views (so for
example in an analog clock you see right through it), and on older
version it simply crops out the edge color.

The preview image is semi-translucent, and the image is centered under
the mouse pointer. The drag feedback operations all relate to the top
left corner of the dragged item, so they are passed in the mouse
cursor minus the delta to the top left corner of the image.

The size of the preview is also used to provide bounds for the drag
feedback, such that we can show a preview rectangle rather than just
the insert point over layouts that support drop feedback.

Some views can't be rendered (e.g. QuickContactBadge), and some views
don't have any pixels painted (e.g. all the empty layouts), and in
that case we fall back to showing the palette item itself (the icon
and label) as you're dragging.

There's also a new utility class for SWT common utilities, like image
conversion.

Change-Id: I315c2dd733317bbada8dae89f57280ced2d7bb51
12 files changed:
eclipse/dictionary.txt
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtils.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/IGraphicalLayoutEditor.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GlobalCanvasDragInfo.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageOverlay.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/MoveGesture.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteComposite.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SimpleElement.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SwtUtils.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/descriptors/DescriptorsUtilsTest.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SwtUtilsTest.java [new file with mode: 0644]