File: plugin-api.html

package info (click to toggle)
wavesurfer 1.8.8p5-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,432 kB
  • sloc: tcl: 10,849; sh: 3,957; python: 454; makefile: 8
file content (371 lines) | stat: -rw-r--r-- 12,207 bytes parent folder | download | duplicates (3)
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@osx300.apple.com" />
</head>

<body style="background-color: white">



<ul id="index">
  <li><a href="#WaveSurfer-Plug-in-API">WaveSurfer Plug-in API</a></li>
  <li><a href="#Options-to-RegisterPlugin">Options to RegisterPlugin</a></li>
  <li><a href="#POD-ERRORS">POD ERRORS</a></li>
</ul>

<h1 id="WaveSurfer-Plug-in-API">WaveSurfer Plug-in API</h1>

<p>WaveSurfer plug-ins are implemented in Tcl/Tk as a collection of procedures. During startup, the application will search certain system and user directories for plug-in scripts, and source them into the interpreter. The plugin script file must contain a call to the following procedure: <b>wsurf::RegisterPlugin</b> <i>name ?option value? ...</i> <i>name</i> is the name of the plug-in. Many of the options are used to associate event callbacks to procedures in the plug-in implementation. Note that the plug-in does not need to implement all callbacks, only the ones that are relevant to its functionality. It is advisable for all plug-ins to exist in their own namespace, with the same name as the plugin.</p>

<p>Most callbacks are invoked with the current widget as the first argument, and in the cases where the event refers to a pane, the pane window name will be the second argument.</p>

<h1 id="Options-to-RegisterPlugin">Options to RegisterPlugin</h1>

<dl>

<dt id="description">-description</dt>
<dd>

<p>Specifies a textual description of the plugin&#39;s functionality. It will be displayed in plug-ins page of the preferences dialog.</p>

<p></p>

</dd>
<dt id="url">-url</dt>
<dd>

<p>Specify a home page URL for the plugin. It will be displayed in plug-ins page of the preferences dialog.</p>

<p></p>

</dd>
<dt id="addmenuentriesproc">-addmenuentriesproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a context sensitive popup menu is created for a pane. This will allow the plug-in to add entries to the menu at the time it is posted. Callback syntax:</p>

<p><code>callback widget pane menu subMenu x y</code></p>

<p><i>menu</i> refers to the window name of the popup menu widget, <i>subMenu</i> is an identifier of a sub-menu, can be <i>create</i> or an empty string. <i>x</i> and <i>y</i> refers to the coordinates where the menu button was pressed.</p>

<p></p>

</dd>
<dt id="applypropertiesproc">-applypropertiesproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked to apply the current values in the properties dialog. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p></p>

</dd>
<dt id="copyproc">-copyproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a copy operation is performed in the widget. Callback syntax:</p>

<p><code>callback widget start end</code></p>

<p><i>start</i> and &lt;end&gt; are given in seconds as floating point numbers.</p>

<p></p>

</dd>
<dt id="cursormovedproc">-cursormovedproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when the cursor is moved. Callback syntax:</p>

<p><code>callback widget pane time value</code></p>

<p><i>time</i> is the cursor position along the time axis, in seconds. <i>value</i> is the cursor position along the value axis, in the pane&#39;s local units, see <b>getBoundsProc</b>. Both are given as floating point numbers.</p>

<p></p>

</dd>
<dt id="cutproc">-cutproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a cut operation is performed in the widget. Callback syntax:</p>

<p><code>callback widget start end</code></p>

<p><i>start</i> and &lt;end&gt; are given in seconds as floating point numbers.</p>

<p></p>

</dd>
<dt id="getboundsproc">-getboundsproc</dt>
<dd>

<p>When the a pane is redrawn, this callback is invoked to query the plugin for the extents of its contents. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p>The return value of the callback should be a list containing the time and value bounds for the plugin contents, as four elements: <i>tmin vmin tmax vmax</i>, where <i>tmin</i> and <i>tmax</i> are the minimum and maximum time, and <i>vmin</i> and <i>vmax</i> are the minimum and maximum values.</p>

<p></p>

</dd>
<dt id="getconfigurationproc">-getconfigurationproc</dt>
<dd>

<p>Specifies a callback that invoked when the widget&#39;s current configuration is to be saved, to allow the plug-in to add its own configuration statements. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p>The callback is first invoked with <i>pane</i> as an empty string, which allows the plug-in to supply configuration statements for the entire widget, then it is invoked once for each pane in the widget. The return value of the callback should be a string containing new-line separated configuration statements for the plugin. Configuration statements are regular tcl-statements that will, when executed, recreate the current configuration of the widget. The configuration statements should refer to the current widget as <code>$widget</code> and to the pane as $&lt;pane&gt;. A typical configuration statement for <i>myplugin</i> might look something like:</p>

<p><code>$widget myplugin::addSomeFeature $pane -option1 value1 -option2 value2</code></p>

<p></p>

</dd>
<dt id="getoptproc">-getoptproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked the command line of the application is being parsed. This allows the plug-in to handle its own command line switches. Callback syntax:</p>

<p><code>callback arglistVar</code></p>

<p><i>arglistVar</i> refers to a list variable name containing the command line, typically argv. The callback should remove all switches it wants to handle from <i>arglistVar</i>. This easiest done using the cmdline package in the Standard Tcl Library.</p>

<p></p>

</dd>
<dt id="openfileproc">-openfileproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a file is to be opened, to allow the plug-in to handle the file. Callback syntax:</p>

<p><code>callback widget fileName</code></p>

<p>The callback should return a boolean value to indicate whether or not it handles the file. If a plug-in returns <i>true</i>, the application will not try to handle the file internally.</p>

<p></p>

</dd>
<dt id="panecreatedproc">-panecreatedproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a new pane has been created in the widget. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p></p>

</dd>
<dt id="panedeletedproc">-panedeletedproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a pane is to be deleted in the widget. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p></p>

</dd>
<dt id="pasteproc">-pasteproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a paste operation is performed in the widget. Callback syntax:</p>

<p><code>callback widget start length</code></p>

<p><i>start</i> and <i>length</i> are given in seconds as a floating point numbers.</p>

<p></p>

</dd>
<dt id="pauseproc">-pauseproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when playback has been paused in the widget. Callback syntax:</p>

<p><code>callback widget</code></p>

<p></p>

</dd>
<dt id="playproc">-playproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when playback has been started in the widget. Callback syntax:</p>

<p><code>callback widget</code></p>

<p></p>

</dd>
<dt id="printproc">-printproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when the widget is to be printed, to allow the plug-in to redraw its contents onto a canvas for printing. Callback syntax:</p>

<p><code>callback widget pane tempCanvas x y</code></p>

<p><i>tempCanvas</i> is a temporary canvas used during printing. The plug-in is expected to re-draw the pane contents in this canvas at coordinate offset <i>x</i>,<i>y</i>.</p>

<p></p>

</dd>
<dt id="propertiespageproc">-propertiespageproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when the properties dialog is displayed. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p>The return value should be a list of the form <i>{name displayproc name displayproc ...}</i>. Each name/proc pair specifies one page in the properties dialog notebook widget. <i>name</i> is a text string that will be displayed on the notebook tab. <i>displayproc</i> should be a procedure that will be invoked to render the page. This procedure will be invoked as follows:</p>

<p><code>displayproc widget pane frame</code></p>

<p>Frame is the container frame of the notebook page, into which plugin widgets will be arranged.</p>

<p></p>

</dd>
<dt id="recordproc">-recordproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when recording has been started in the widget. Callback syntax:</p>

<p><code>callback widget</code></p>

<p></p>

</dd>
<dt id="redrawproc">-redrawproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when the contents of a pane are redrawn. All plug-ins that display graphics must implement this callback. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p></p>

</dd>
<dt id="needsaveproc">-needsaveproc</dt>
<dd>

<p>Specifies a callback procedure which is used to check whether there is unsaved information present in the pane. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p>The return value should be a boolean, indicating whether or not there is unsaved information in the pane.</p>

<p></p>

</dd>
<dt id="savefileproc">-savefileproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a file is to be saved, to allow the plug-in to save the file. Callback syntax:</p>

<p><code>callback widget fileName</code></p>

<p>The callback should return a boolean value to indicate whether or not it saves the file. If a plug-in returns <i>true</i>, the application will not try to save the file internally.</p>

<p></p>

</dd>
<dt id="scrollproc">-scrollproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when the widget is scrolled along the time axis. Callback syntax:</p>

<p><code>callback widget pane</code></p>

<p></p>

</dd>
<dt id="setselectionproc">-setselectionproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when the selection has changed.</p>

<p><code>callback widget pane t0 t1</code></p>

<p><i>t0</i> and <i>t1</i> are the start and end times for the new selection, given in seconds as floating point numbers.</p>

<p></p>

</dd>
<dt id="soundchangedproc">-soundchangedproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when the sound data has changed. This notifies a plug-in that the sound has been modified. Callback syntax:</p>

<p><code>callback widget flag</code></p>

<p><i>flag</i> is a string describing the type of change.</p>

<p></p>

</dd>
<dt id="stopproc">-stopproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when playback has been stopped in the widget. Callback syntax:</p>

<p><code>callback widget</code></p>

<p></p>

</dd>
<dt id="undoproc">-undoproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when an undo operation is performed in the widget, to allow the plugin to restore its data to the state it had before the last change. Callback syntax:</p>

<p><code>callback widget</code></p>

<p></p>

</dd>
<dt id="widgetcreatedproc">-widgetcreatedproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked upon creation of a new widget. Callback syntax:</p>

<p><code>callback widget</code></p>

<p></p>

</dd>
<dt id="widgetdeletedproc">-widgetdeletedproc</dt>
<dd>

<p>Specifies a callback procedure to be invoked when a widget is to be deleted. Callback syntax:</p>

<p><code>callback widget</code></p>

</dd>
</dl>

<h1 id="POD-ERRORS">POD ERRORS</h1>

<p>Hey! <b>The above document had some coding errors, which are explained below:</b></p>

<dl>

<dt id="Around-line-11">Around line 11:</dt>
<dd>

<p>=over without closing =back</p>

</dd>
</dl>


</body>

</html>