Adobe 65007312 Programming Guide - Page 82

Creating a User Interface for Your Plug-in, Adding custom dialog views

Page 82 highlights

5 Creating a User Interface for Your Plug-in You can define a user interface to your plug-in with these tools: X Your plug-in can define one or more custom sections to be displayed in the Plug-in Manager dialog or Export dialog, above and/or below the Lightroom standard sections. The custom sections are displayed when the user chooses your export destination. You define the UI elements of a custom section using LrView objects; see "Adding custom dialog views" on page 82. X You can call the functions of the LrDialog namespace to display messages, prompts, and errors to users in predefined dialogs. See "Displaying predefined dialog boxes" on page 83. X You can use the functions in the LrDialog and LrView namespaces to create your own dialog boxes. You can display them when users choose your custom menu items, invoke them from tasks, or invoke them in response to selections in controls you have added to the Export dialog. See "Creating custom dialog boxes" on page 84. The LrView class models a node tree, where each node is a UI element, represented by a specific type of LrView object. A node can be a container or parent of other nodes, or a control, an individual UI element such as a checkbox, which displays a value and can allow user input. Containers and controls are arranged in a node tree, or view hierarchy. A view hierarchy has a top-level container node, additional child containers if needed, and leaf nodes that are the controls. The LrView namespace and class provides a set of interface elements, with functionality to lay out and localize the display, and a binding mechanism that lets you tie the displayed values to your plug-in data and settings. X "User interface elements" on page 84 introduces the UI elements you can create with LrView. X "Binding UI values to data values" on page 94 explains the binding mechanism, with examples of how to create various relationships between your data and your display. X ""Determining layout" on page 107 explains the placement options and gives examples of various layout techniques. Adding custom dialog views You can create custom sections to be displayed in the Plug-in Manager or Export dialog using these service-script entries: sectionsForTopOfDialog = function( viewFactory, propertyTable ) ... end, sectionsForBottomOfDialog = function( viewFactory, propertyTable ) ... end, X The function that you define here is slightly different for the two dialogs; see "Adding custom sections to the Plug-in Manager" on page 32 and "Adding custom sections to the Export or Publishing Manager dialog" on page 53. X For an Export Filter Provider, a very similar function, sectionForFilterInDialog, creates only one section, rather than multiple sections. See "Defining a post-process action" on page 45. In any case, however, the function must define the UI to be displayed when each dialog-box section is expanded. To do so, use the viewFactory object to construct all of the elements of a view hierarchy. 82

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204

82
5
Creating a User Interface for Your Plug-in
You can define a user interface to your plug-in with these tools:
X
Your plug-in can define one or more custom sections to be displayed in the Plug-in Manager dialog or
Export dialog, above and/or below the Lightroom standard sections. The custom sections are
displayed when the user chooses your export destination. You define the UI elements of a custom
section using
LrView
objects; see
“Adding custom dialog views” on page 82
.
X
You can call the functions of the
LrDialog
namespace to display messages, prompts, and errors to
users in predefined dialogs. See
“Displaying predefined dialog boxes” on page 83
.
X
You can use the functions in the
LrDialog
and
LrView
namespaces to create your own dialog boxes.
You can display them when users choose your custom menu items, invoke them from tasks, or invoke
them in response to selections in controls you have added to the Export dialog. See
“Creating custom
dialog boxes” on page 84
.
The
LrView
class models a node tree, where each node is a UI element, represented by a specific type of
LrView
object. A node can be a
container
or parent of other nodes, or a
control
, an individual UI element
such as a checkbox, which displays a value and can allow user input. Containers and controls are arranged
in a node tree, or
view hierarchy
. A view hierarchy has a top-level container node, additional child
containers if needed, and leaf nodes that are the controls.
The
LrView
namespace and class provides a set of interface elements, with functionality to lay out and
localize the display, and a binding mechanism that lets you tie the displayed values to your plug-in data
and settings.
X
“User interface elements” on page 84
introduces the UI elements you can create with
LrView
.
X
“Binding UI values to data values” on page 94
explains the binding mechanism, with examples of how
to create various relationships between your data and your display.
X
“Determining layout” on page 107
explains the placement options and gives examples of various
layout techniques.
Adding custom dialog views
You can create custom sections to be displayed in the Plug-in Manager or Export dialog using these
service-script entries:
sectionsForTopOfDialog = function( viewFactory, propertyTable ) ... end,
sectionsForBottomOfDialog = function( viewFactory, propertyTable ) ... end,
X
The function that you define here is slightly different for the two dialogs; see
“Adding custom sections
to the Plug-in Manager” on page 32
and
“Adding custom sections to the Export or Publishing
Manager dialog” on page 53
.
X
For an Export Filter Provider, a very similar function,
sectionForFilterInDialog
, creates only one
section, rather than multiple sections. See
“Defining a post-process action” on page 45
.
In any case, however, the function must define the UI to be displayed when each dialog-box section is
expanded. To do so, use the
viewFactory
object to construct all of the elements of a view hierarchy.