Adobe 65007312 Programming Guide - Page 32

Adding custom s to the Plug-in Manager, sForTopOfDialog

Page 32 highlights

CHAPTER 2: Writing a Lightroom Plug-in Customizing plug-in load behavior 32 selected in the Export dialog, never from the Plug-in Manager dialog. See "Initialization and termination functions for services" on page 38. The propertyTable parameter for both functions is an empty, observable table which you can use to keep private data for your plug-in. (See "Binding UI values to data values" on page 94.) This table is discarded when your plug-in is deselected in the Plug-in Manager or when the Plug-in Manager dialog is closed. It is not preserved across sessions. You can use LrPreferences if you want to save information across invocations. These are blocking calls. If you need to start a long-running task (such as network access), create a task using the LrTasks namespace. See "Defining function contexts and tasks" on page 20. Adding custom sections to the Plug-in Manager Your plug-in can define one or more sections to be displayed in the Plug-in Manager dialog (when defined in an LrPluginInfoProvider entry) or in the Export or Publishing Manager dialog (when defined in an LrExportServiceProvider entry). The custom sections can be shown above or below the Lightroom standard sections for the dialog. To customize the dialog, define a function that returns a table of sections, defined using LrView objects. The function is the value of one of these service entries: sectionsForTopOfDialog = function( viewFactory, propertyTable ) ... end, sectionsForBottomOfDialog = function( viewFactory, propertyTable ) ... end, NOTE: Similar functions can be defined in an Export Service Provider, to customize the Export dialog when the export destination is selected or the Publishing Manager dialog for a publish service, and also in an Export Filter Provider, to add a section to the dialog when a post-process action is selected. See "Customizing the Export and Publishing Manager dialogs" on page 52 and "Adding an export post-process action" on page 41. Lightroom passes your function a factory object which allows you to create the LrView objects that define the elements of your sections; that is, UI controls, such as buttons and text, and containers that group the controls and determine the layout. For additional details of the dialog elements you can create with LrView, see "Adding custom dialog views" on page 82." The function that you define here returns a table of tables, where each table defines one dialog section: sectionsForTopOfDialog = function( viewFactory, propertyTable ) return { { ...section entry section entry end A section entry table defines the contents of an implicit container, which Lightroom creates to hold your view hierarchy. X Each section entry sets a title and synopsis for the section; the section is identified by the title text on the left, and is collapsible. When in the collapsed state, the synopsis text is shown on the right. X The rest of the table entry creates the UI elements that are shown when the section is expanded. To create the UI elements, use the LrView factory passed to your top-level sectionsFor... function. This process is explained in more detail in "Adding custom dialog views" on page 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

C
HAPTER
2: Writing a Lightroom Plug-in
Customizing plug-in load behavior
32
selected in the Export dialog, never from the Plug-in Manager dialog. See
“Initialization and termination
functions for services” on page 38
.
The
propertyTable
parameter for both functions is an empty, observable table which you can use to keep
private data for your plug-in. (See
“Binding UI values to data values” on page 94
.) This table is discarded
when your plug-in is deselected in the Plug-in Manager or when the Plug-in Manager dialog is closed. It is
not preserved across sessions. You can use
LrPreferences
if you want to save information across
invocations.
These are blocking calls. If you need to start a long-running task (such as network access), create a
task
using the
LrTasks
namespace. See
“Defining function contexts and tasks” on page 20
.
Adding custom sections to the Plug-in Manager
Your plug-in can define one or more sections to be displayed in the Plug-in Manager dialog (when defined
in an
LrPluginInfoProvider
entry) or in the Export or Publishing Manager dialog (when defined in an
LrExportServiceProvider
entry). The custom sections can be shown above or below the Lightroom
standard sections for the dialog.
To customize the dialog, define a function that returns a table of sections, defined using
LrView
objects.
The function is the value of one of these service entries:
sectionsForTopOfDialog = function( viewFactory, propertyTable ) ... end,
sectionsForBottomOfDialog = function( viewFactory, propertyTable ) ... end,
N
OTE
:
Similar functions can be defined in an Export Service Provider, to customize the Export dialog
when the export destination is selected or the Publishing Manager dialog for a publish service, and
also in an Export Filter Provider, to add a section to the dialog when a post-process action is selected.
See
“Customizing the Export and Publishing Manager dialogs” on page 52
and
“Adding an export
post-process action” on page 41
.
Lightroom passes your function a factory object which allows you to create the
LrView
objects that define
the elements of your sections; that is, UI controls, such as buttons and text, and containers that group the
controls and determine the layout. For additional details of the dialog elements you can create with
LrView
, see
“Adding custom dialog views” on page 82
.”
The function that you define here returns a table of tables, where each table defines one dialog section:
sectionsForTopOfDialog =
function( viewFactory, propertyTable )
return {
{ ...
section entry
... },
{ ...
section entry
... },
...
}
}
end
A section entry table defines the contents of an implicit container, which Lightroom creates to hold your
view hierarchy.
X
Each section entry sets a
title
and
synopsis
for the section; the section is identified by the
title
text on the left, and is collapsible. When in the collapsed state, the
synopsis
text is shown on the
right.
X
The rest of the table entry creates the UI elements that are shown when the section is expanded. To
create the UI elements, use the
LrView
factory passed to your top-level
sectionsFor...
function.
This process is explained in more detail in
“Adding custom dialog views” on page 82
.