OSDN Git Service

Palette with previews, categories and view modes
authorTor Norbye <tnorbye@google.com>
Fri, 21 Jan 2011 05:13:39 +0000 (21:13 -0800)
committerTor Norbye <tnorbye@google.com>
Wed, 26 Jan 2011 02:03:02 +0000 (18:03 -0800)
commit0ac475d29f793079783f501126239ed6ce8aa31d
tree798e04c9e49270a76d1f019601c988056b1a0a82
parentdfd73ee638e86ca98e55e51c44f838985f784754
Palette with previews, categories and view modes

This changeset contains the following improvements to the palette:

1. Display modes. The palette now supports several different view
   modes, and you can switch these via the context menu. The modes
   are:

   a. Previews. This renders previews for all the views using the
      current SDK platform, theme, screen density, etc.
   b. Small Previews. This is like (a), but scaled down to 75% size.
   c. Tiny Previews. Like (a), but scaled down to 50% size.
   d. Text + Icon. This shows an icon and the name of the view; this
      is the same as what the palette has looked like before this
      changeset.
   e. Icons only.

   All the modes, except for the Text+Icon mode, will lay out the
   views in a row (with vertical centering) to fit as much as possible
   in the available space for that category.

   The view mode, along with other view flags described below, are
   preserved across IDE sessions.

2. An accordion view. The palette is now using an Accordion control,
   which means it by default will keep a single category open, and it
   will always ensure that ALL the category labels are visible in the
   current view without scrolling. Via the context menu you can turn
   off the auto-close of the previous category.  The accordion view
   uses vertical scrollbars within each category content area, if
   necessary.

   The accordion view renders the category headers using open/close
   folder icons, a bold font, and a background gradient which varies
   between the normal and hovered states.

3. Categories. The category metadata is now used to organize the views
   into a handful of different categories. The categories can be
   enabled and disabled via the context menu. When you turn off
   categories, you get all the views in a single large list.

4. Alphabetical sorting. By default, the views are now sorted
   "naturally" (e.g.  the metadata provided order, where important
   views are listed first). You can switch it to alphabetical order
   via the context menu, in which case the items are listed in
   alphabetical order, either within their individual categories, or
   if categories are turned off, the global view list.

This changeset also adds a new SWT ImageControl. This is necessary to
display the preview images, because the CLabel, which is usually used
to display images in SWT, is hardcoded to hide the icon if there is
not enough horizontal space to display the full label (even when it
has no text label), so for wide preview images the images would simply
disappear when the palette was resized.

Change-Id: I1e1fe051947809206ef9f3a2dfa2fbeae0341107
22 files changed:
eclipse/dictionary.txt
eclipse/plugins/com.android.ide.eclipse.adt/icons/closed-folder.png [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.adt/icons/open-folder.png [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/RelativeLayoutRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AndroidConstants.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/AccordionControl.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.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/ImageControl.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtils.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SubmenuAction.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepository.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/extra-view-metadata.xml
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/rendering-configs.xml [new file with mode: 0644]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/ui/DecorComposite.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/preferences/AdtPrefs.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/AdtPluginTest.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtilsTest.java