Preset Widget

From wiki
Revision as of 21:55, 5 July 2006 by FosterBrereton (Talk | contribs) (initial population)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The basis of a dialog is the collection of valid parameters in order to execute a command. Many times the client would like to store these parameters (or a subset of them) for use in a later execution of the same command. The Preset widget is a general-use solution to save, manage and apply these collections of reusable parameters for a command.

The Eve Syntax

A preset widget in the Eve syntax would look as follows. Only parameters directly pertaining to the semantics of this widget are presented:

preset(domain: "Photoshop", name: "NewDocument",
       bind: [ [ @resolution, "<xstr id='resolution'>Resolution</xstr>" ],
               [ @bkg_contents, "<xstr id='bkg_contents'>Background Contents</xstr>" ],
               [ @color_mode, "<xstr id='color_mode'>Color Mode</xstr>" ],
               [ @color_profile, "<xstr id='color_profile'>Color Profile</xstr>" ],
               [ @bit_depth, "<xstr id='bit_depth'>Bit Depth</xstr>" ],
               [ @aspect_ratio, "<xstr id='aspect_ratio'>Pixel Aspect Ratio</xstr>" ],
               [ [ @width_pixels, @width_inches ], "<xstr id='width'>Width</xstr>" ],
               [ [ @height_pixels, @height_inches ], "<xstr id='height'>Height</xstr>" ]
The domain of the preset is typically the application under which this command is commonly run. This allows one heirarchical level under which a group of command presets may be stored.
This is the "name" of the command for which this preset is being made available. A combination of this value and the domain combine to form a path under which the preset values will be stored. The path is a unique identifier for the presets of a command, which would be stored in a file on the user's machine under, say: ~/Library/Application Support/Adobe/Photoshop/Presets/NewDocument.preset (and some other relevant location on Win32).
This array is a set of pairs representing the potential parameters that can be pulled from the current state of the model and saved as a preset. For each pair, the first element is either an adobe::name_t that identifies a cell, or an adobe::array_t of adobe::name_t elements identifying a set of cells combined under a single identifier. The second element in the pair is a localizeable name to be used when saving a preset in the Add Preset dialog.

Visual Representation

The "widget" itself is actually a self-contained suite of functionality for managing and selecting presets. Visually there is a popup labelled "Presets" which contains the names of all the presets currently saved for this command. There is also an icon to the right of the popup. When the user clicks on the icon, they get a manu containing (in this order):

  • Load Presets...
  • Add Preset...
  • Delete Preset...

Load Presets

NOTE (fbrereto) : This is likely going away soon. This allows you to load a file full of presets from an external location into your current preset list

Add Presets

This lets you save the currently contributing set of values to the command model as a preset, allowing you to selectively include/discard parameters from the preset. When this option is selected a dialog box will show. In it will be an edit text field where the user can give a name to the preset. Also available to the user will be a series of checkboxes. Each checkbox will have a name (from the localizeable list of names described in the Eve definition for this preset) and a set of model cells to which they are bound. When the user hits OK to this dialog, the cells in the model that have their respective checkboxes checked will be added to the preset, and the preset as a whole will be appended to the list on disk. Likewise, the preset widget in the main dialog will be updated.

Delete Preset

This lets you select a preset from the list of saved presets to have it removed permanently. When this option is a selected a dialog box will show with a popup filled with the names of the currently saved presets. The user then selects a preset from the popup and hits the OK button in the dialog, and that preset is removed from the list of saved presets. The preset widget in the main dialog is then updated to reflect this change. Likewise, the preset file on-disk is updated with the preset deleted.

Future Work

  • The Presets also need to be able to be dynamically populated as you can now pick an existing open document as a preset (make this document like that one). This feature was buried before in the Window menu.
  • An interesting issue here (which I'm not quite sure how to solve). Luckily I don't think we need a solution for this dialog.
When I click that I want to add something to my preset - my expectation would be that it is added even if it doesn't currently contribute. But doing this would allow us to potentially "over constrain" the preset by capturing more than you could.
One potential solution would be to bring the dialog up with only items which currently contribute set. If you turn a checkbox on which isn't currently contributing, we touch the cell and anything which is no longer contributing gets disabled.
For this dialog none of the presets are "optionally" contributing (except within the width/height sets) so we can ignore it for now. But something to note and think about.