dialog_iemgui.html 22.2 KB
Newer Older
1
2
3
<!DOCTYPE html>
<html>
  <head>
Jonathan Wilkes's avatar
Jonathan Wilkes committed
4
5
    <link id="page_style" rel="stylesheet"
          type="text/css" href="css/default.css">
6
  </head>
7
  <body class="dialog_body">
8
9
10
11
12
13
14
15
16
17
18
19
20
    <div class="container">
    <form> 
      <fieldset> 
        <legend data-i18n="iem.prop.heading.size"></legend> 

        <table class="pairs">
          <tr class="size prop hidden">
            <td>
              <label data-i18n="[title]iem.prop.size_tt">
                <span data-i18n="iem.prop.size"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.size_tt">
21
22
              <input type="text" name="size"
                     onchange="update_attr(this);">
23
24
            </td>
          </tr>
25
          <tr class="selection_size prop hidden">
26
27
28
29
30
31
            <td>
              <label data-i18n="[title]iem.select_size_tt">
                <span data-i18n="iem.prop.select_size"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.select_size_tt">
32
              <input type="text" name="selection_size"
33
                     onchange="update_attr(this);">
34
35
36
37
38
39
40
41
42
            </td>
          </tr>
          <tr class="number prop hidden">
            <td>
              <label data-i18n="[title]iem.prop.number_tt">
                <span data-i18n="iem.prop.number"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.number_tt">
43
44
              <input type="number" name="number"
                     onchange="update_attr(this);">
45
46
            </td>
          </tr>
47
          <tr class="nonzero_value prop hidden">
48
49
50
51
52
53
            <td>
              <label data-i18n="[title]iem.prop.nonzero_value_tt">
                <span data-i18n="iem.prop.nonzero_value"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.nonzero_value_tt">
54
              <input type="text" name="nonzero_value"
55
                     onchange="update_attr(this);">
56
57
58
59
            </td>
          </tr>
          <tr class="width prop hidden">
            <td>
60
61
              <label data-i18n="[title]iem.prop.width_tt" class="mknob_size_tt"> 
                <span data-i18n="iem.prop.width" class="mknob_size"></span>
62
63
              </label>
            </td>
64
            <td data-i18n="[title]iem.prop.width_tt" class="mknob_size_tt">
65
66
              <input type="text" name="width"
                     onchange="update_attr(this);">
67
68
            </td>
            <td>
69
70
              <label data-i18n="[title]iem.prop.height_tt" class="mknob_steps_tt">
                <span data-i18n="iem.prop.height" class="mknob_steps"></span>
71
72
              </label>
            </td>
73
            <td data-i18n="[title]iem.prop.height_tt" class="mknob_steps_tt">
74
75
              <input type="text" name="height"
                     onchange="update_attr(this);">
76
77
            </td>
          </tr>
78
          <tr class="visible_width prop hidden">
79
80
81
82
83
84
            <td>
              <label data-i18n="[title]iem.prop.visible_width_tt">
                <span data-i18n="iem.prop.visible_width"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.visible_width_tt">
85
              <input type="text" name="visible_width"
86
                     onchange="update_attr(this);">
87
88
89
90
91
92
93
            </td>
            <td>
              <label data-i18n="iem.prop.visible_height">
                <span data-i18n="iem.prop.visible_height"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.visible_height_tt">
94
              <input type="text" name="visible_height"
95
                     onchange="update_attr(this);">
96
97
            </td>
          </tr>
98
          <tr class="minimum_range prop pair hidden">
99
100
101
102
103
104
            <td>
              <label data-i18n="[title]iem.prop.minimum_tt">
                <span data-i18n="iem.prop.minimum"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.minimum_tt">
105
              <input type="text" name="minimum_range"
106
                     onchange="update_attr(this);">
107
108
109
110
111
112
            </td>
            <td>
              <label data-i18n="[title]iem.prop.maximum_tt">
                <span data-i18n="iem.prop.maximum"></span>
              </label>
            </td>
113
114
            <td data-i18n="[title]iem.prop.max_mum_tt">
              <input type="text" name="maximum_range"
115
                     onchange="update_attr(this);">
116
117
            </td>
          </tr>
118
          <tr class="flash_interrupt prop hidden">
119
120
121
122
123
124
            <td>
              <label data-i18n="[title]iem.prop.flash_interrupt_tt">
                <span data-i18n="iem.prop.flash_interrupt"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.flash_interrupt_tt">
125
              <input type="text" name="flash_interrupt"
126
                     onchange="update_attr(this);">
127
128
129
130
131
132
133
            </td>
            <td>
              <label data-i18n="[title]iem.prop.flash_hold_tt">
                <span data-i18n="iem.prop.flash_hold"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.flash_hold_tt">
134
              <input type="text" name="flash_hold"
135
                     onchange="update_attr(this);">
136
137
            </td>
          </tr>
138
          <tr class="log_height prop hidden">
139
140
141
142
143
144
145
            <td></td><td></td>
            <td>
              <label data-i18n="[title]iem.prop.log_height_tt">
                <span data-i18n="iem.prop.log_height"></span>
              </label>
            </td>
            <td>
146
              <input type="text" name="log_height"
147
                     onchange="update_attr(this);">
148
149
150
151
152
153
            </td>
          </tr>
        </table>

        <div class="init prop hidden">
          <label data-i18n="[title]iem.prop.init_tt">
154
155
            <input type="checkbox" name="init" value="on"
                   onchange="update_attr(this);">
156
157
158
159
160
            <span data-i18n="iem.prop.init"></span>
          </label>
          <br>
        </div>

161
        <div class="vu_scale prop hidden">
162
163
          <label data-i18n="[title]iem.prop.vu_scale_tt">
            <span data-i18n="iem.prop.vu_scale"></span>
164
            <input type="checkbox" name="vu_scale" value="on"
165
                   onchange="update_attr(this);">
166
167
168
169
          </label>
          <br>
        </div>

170
        <div class="log_scaling prop hidden">
171
          <label data-i18n="[title]iem.prop.log_scale_tt">
172
            <input type="checkbox" name="log_scaling" value="on"
173
                   onchange="update_attr(this);">
174
175
176
177
178
            <span data-i18n="iem.prop.log_scale"></span>
          </label>
          <br>
        </div>

179
        <div class="steady_on_click prop hidden">
180
          <label data-i18n="[title]iem.prop.steady_tt">
181
            <input type="checkbox" name="steady_on_click" value="on"
182
                   onchange="update_attr(this);">
183
184
185
186
187
188
189
190
191
192
            <span data-i18n="iem.prop.steady"></span>
          </label>
          <br>
        </div>
      </fieldset> 

      <fieldset> 
        <legend data-i18n="iem.prop.heading.messages"></legend> 

        <table>
193
          <tr class="send_symbol prop hidden">
194
195
196
197
198
199
            <td>
              <label data-i18n="[title]iem.prop.send_tt">
                <span data-i18n="iem.prop.send"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.send_tt">
200
              <input type="text" name="send_symbol"
201
                     onchange="update_attr(this, true);">
202
203
            </td>
            <td>
204
          <tr class="receive_symbol prop hidden">
205
206
207
208
209
210
            <td>
              <label data-i18n="[title]iem.prop.receive_tt">
                <span data-i18n="iem.prop.receive"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.receive_tt">
211
              <input type="text" name="receive_symbol"
212
                     onchange="update_attr(this, true);">
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
            </td>
            <td>
          </tr>
        </table>
      </fieldset> 

      <fieldset> 
        <legend data-i18n="iem.prop.heading.label">wrong stuff</legend> 

        <table class="pairs">
          <tr class="label prop hidden">
            <td>
              <label data-i18n="[title]iem.prop.label_tt">
                <span data-i18n="iem.prop.label"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.label_tt">
230
              <input type="text" name="label"
231
                     onchange="update_attr(this, true);">
232
233
234
235
236
237
238
            </td>
            <td>
              <label data-i18n="[title]iem.prop.xoffset_tt">
                <span data-i18n="iem.prop.xoffset"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.xoffset_tt">
239
              <input type="text" name="x_offset"
240
                     onchange="update_attr(this);">
241
242
243
244
245
246
247
            </td>
            <td>
              <label data-i18n="[title]iem.prop.yoffset_tt">
                <span data-i18n="iem.prop.yoffset"></span>
              </label>
            </td>
            <td data-i18n="[title]iem.prop.yoffset_tt">
248
              <input type="text" name="y_offset"
249
                     onchange="update_attr(this);">
250
251
            </td>
          </tr>
252
          <tr class="font_style prop hidden">
253
254
255
256
257
            <td>
              <label data-i18n="[title]iem.prop.font_tt">
                <span data-i18n="iem.prop.font"></span>
            </td>
            <td data-i18n="[title]iem.prop.font_tt">
258
              <select name="font_style"
259
                      onchange="update_attr(this);">
260
261
262
                <option>DejaVu Sans Mono</option>
                <option>Helvetica</option>
                <option>Times</option>
263
264
265
266
267
              </select>
            </td>
            <td colspan="4">
              <label data-i18n="[title]iem.prop.fontsize_tt">
                <span data-i18n="iem.prop.fontsize"></span>
268
                <input type="text" name="font_size"
269
                       onchange="update_attr(this);">
270
271
272
273
274
275
276
277
278
              <label>
            </td>
          </tr>
        </table>
      </fieldset> 

      <fieldset> 
      <legend data-i18n="iem.prop.heading.colors"></legend> 

279
      <div class="background_color prop hidden">
280
        <label data-i18n="[title]iem.prop.bgcolor_tt">
281
          <input type="color" name="background_color"
282
                 onchange="update_attr(this);">
283
284
285
286
287
          <span data-i18n="iem.prop.bgcolor"></span>
        </label>
        <br>
      </div>

288
      <div class="foreground_color prop hidden">
289
        <label data-i18n="[title]iem.prop.fgcolor_tt">
290
          <input type="color" name="foreground_color"
291
                 onchange="update_attr(this);">
292
293
294
295
296
          <span data-i18n="iem.prop.fgcolor"></span>
        </label>
        <br>
      </div>

297
      <div class="label_color prop hidden">
298
        <label data-i18n="[title]iem.prop.label_color_tt">
299
          <input type="color" name="label_color"
300
                 onchange="update_attr(this);">
301
302
303
304
305
306
307
          <span data-i18n="iem.prop.label_color"></span>
        </label>
        <br>
      </div>
    </fieldset> 

    <div class="prop hidden">
308
309
310
      <input type="hidden" name="minimum_size">
      <input type="hidden" name="range_schedule">
      <input type="hidden" name="hide_frame">
311
312
313
314
315
316
317
318
319
    </div>

    <div class="submit_buttons">
      <button type="button" onClick="ok()" data-i18n="[title]iem.prop.ok_tt">
        <span data-i18n="iem.prop.ok"></span>
      </button>
      <button type="button" onClick="apply()" data-i18n="[title]iem.prop.apply_tt">
        <span data-i18n="iem.prop.apply"></span>
      </button>
320
      <button type="button" onClick="cancel(true)" data-i18n="[title]iem.prop.cancel_tt">
321
322
323
324
325
326
327
328
        <span data-i18n="iem.prop.cancel"></span>
      </button>
    </div>

  </form> 
  </div>      

  <script>
329
"use strict";
Hugo Neves de Carvalho's avatar
Hugo Neves de Carvalho committed
330
331
332
333
334
335
336

if (typeof(pdbundle) !== "undefined"){
    var pdgui = pdbundle.pdgui
  }else{
    var gui = require("nw.gui");
    var pdgui = require("./pdgui.js");
}
337

338
339
// For translations
var l = pdgui.get_local_string;
340

Jonathan Wilkes's avatar
Jonathan Wilkes committed
341
// gui preset
342
pdgui.skin.apply(window);
Jonathan Wilkes's avatar
Jonathan Wilkes committed
343

344
345
346
var pd_object_callback,
    old_attrs = {}, // original state. Used if we cancel the dialog
    new_attrs = {}; // changed state. Used if we apply or click "Ok"
347

348
349
function substitute_space(arg) {
    var fake_space = String.fromCharCode(11);
350
    return arg.split(" ").join(fake_space);
351
}
352

353
function strip_problem_chars(arg) {
354
    var problem_chars = [";", ",", "\\"],
355
356
357
        ret = arg,
        i;
    for(i = 0; i < problem_chars.length; i++) {
358
        ret = ret.split(problem_chars[i]).join("");
359
    }
360
361
    return ret;
}
362

363
function update_attr(elem, symbol_field) {
364
365
366
367
368
369
    if (!new_attrs.hasOwnProperty(elem.name)) {
        pdgui.post("warning: new_attrs[" + elem.name + "] doesn't exist");
    }
    if (elem.type === "checkbox") {
        new_attrs[elem.name] = elem.checked ? 1 : 0;
    } else if (elem.type === "select-one") {
370
371
372
        new_attrs[elem.name] = elem.selectedIndex;
    } else if (elem.type === "color") {
        new_attrs[elem.name] = parseInt(elem.value.slice(1), 16)
373
    } else {
374
375
        new_attrs[elem.name] = (elem.value === "" && !symbol_field) ?
            "0" : elem.value;
376
377
378
    }
}

379
//Clean up strings to send as symbol arguments to Pd
380
function iemgui_escape(s) {
381
    s = !s ? "empty" : s;
382
383
384
385
386
387
    var arr = s.split("");
    for (var i = 0; i < arr.length; i++) {
        if (arr[i] === "$" && i+1 < arr.length &&
            arr[i+1] >= "0" && arr[i+1] <= "9") {
            arr[i] = "#";
        }
388
    }
389
    s = arr.join("");
390
391
    s = substitute_space(s);
    s = strip_problem_chars(s);
392
    return s;
393
394
}

395
396
397
398
399
400
401
402
403
404
405
406
function iemgui_unescape(s) {
    var arr = s.split("");
    for (var i = 0; i < arr.length; i++) {
        if (arr[i] === "#" && i+1 < arr.length &&
            arr[i+1] >= "0" && arr[i+1] <= "9") {
            arr[i] = "$";
        }
    }
    s = arr.join("");
    return s;
}

407
function send_params(attrs, create_undo_point) {
408
409
410
411
412
413
414
415
    /* Not sure what these are...
        iemgui_clip_dim $id
        iemgui_clip_num $id
        iemgui_sched_rng $id
        iemgui_verify_rng $id
        iemgui_sched_rng $id
        iemgui_clip_fontsize $id
    */
416

417
418
    var send_symbol = attrs.send_symbol,
        receive_symbol = attrs.receive_symbol,
419
        label =  attrs["label"];
420
421
422
    send_symbol = iemgui_escape(send_symbol);
    receive_symbol = iemgui_escape(receive_symbol);
    label = iemgui_escape(label);
423

424
425
    var label_x_offset =  attrs.x_offset;
    var label_y_offset =  attrs.y_offset;
426

427
    // make sure the offset boxes have a value
428
429
430
431
432
433
    if (!label_x_offset) {
        label_x_offset = 0;
    }
    if (!label_y_offset) {
        label_y_offset = 0;
    }
434

435
    var height, width;
436
    var size = attrs["size"];
Jonathan Wilkes's avatar
Jonathan Wilkes committed
437
    if (size === undefined) {
438
        size = attrs.selection_size;
439
    }
440

Jonathan Wilkes's avatar
Jonathan Wilkes committed
441
    if (size !== undefined) {
442
443
444
        width = size;
        height = size;
    } else {
445
446
        width = attrs.width;
        height = attrs.height;
447
    }
448

449
450
    var slot3 = attrs.minimum_range;
    var slot4 = attrs.maximum_range;
451

Jonathan Wilkes's avatar
Jonathan Wilkes committed
452
    if (slot3 === undefined) {
453
454
        slot3 = attrs.flash_interrupt;
        slot4 = attrs.flash_hold;
455
    }
456

Jonathan Wilkes's avatar
Jonathan Wilkes committed
457
    if (slot3 === undefined) {
458
459
        slot3 = attrs.visible_width;
        slot4 = attrs.visible_height;
460
    }
461

Jonathan Wilkes's avatar
Jonathan Wilkes committed
462
    if (slot3 === undefined) { // toggle
463
        slot3 = attrs.nonzero_value;
Jonathan Wilkes's avatar
Jonathan Wilkes committed
464
        if (slot3 === undefined) {
465
            slot3 = 0;
466
        }
467
468
        slot4 = 0;
    }
469

470
471
    var slot5 = attrs.log_scaling ? +attrs.log_scaling : 0;
    // Hack to accomodate the vu_scale property, which exists in the same
472
    // slot as this one
473
    var log_scaling_div = document.querySelector(".log_scaling");
474
    var no_log_display = log_scaling_div.classList.contains("hidden");
475

476
    if (no_log_display) {
477
        slot5 = attrs.vu_scale ? +attrs.vu_scale : 0;
478
    }
479

480
481
    var init = +attrs["init"];
    if (!init) { init = 0; }
482

483
    var slot7 = attrs.log_height;
Jonathan Wilkes's avatar
Jonathan Wilkes committed
484
    if (slot7 === undefined) {
485
        slot7 = attrs["number"];
486
    }
Jonathan Wilkes's avatar
Jonathan Wilkes committed
487
    if (slot7 === undefined) {
488
        slot7 = 0;
489
490
    }

491
    var font_style = attrs.font_style;
492
    //if (font_style !== null) { font_style = 0; }
493

494
    var font_size = attrs.font_size;
Jonathan Wilkes's avatar
Jonathan Wilkes committed
495
    if (font_size === undefined) { font_size = 0; }
496

497
    // [vu] doesn't have a foreground color
498
499
500
501
    var foreground_color = attrs.foreground_color ?
        attrs.foreground_color : 0;
    var background_color = attrs.background_color;
    var label_color = attrs.label_color;
502

503
    var slot18 = attrs.steady_on_click ? +attrs.steady_on_click : 0;
504

505
    pdgui.pdsend(pd_object_callback, "dialog",
506
        width, height,
507
508
509
        slot3, // bng: flash_interrupt
               // slider: min_range
               // toggle: nonzero_value
510
               // my_canvas: visible_width
511
512
        slot4, // bng: flash_hold
               // slider: max_range
513
514
515
               // my_canvas: visible_height
        slot5, // slider: lin/log thingy
               // nbx: lin/log
516
               // vu: vu_scale
517
        init,
518
        slot7, // log_height or vradio/hradio number
519
520
521
522
523
524
        send_symbol, receive_symbol, label,
        label_x_offset, label_y_offset,
        font_style, font_size,
        background_color, foreground_color,
        label_color,
        slot18, // steady on click
525
526
527
        0, // not sure what this is doing here
        create_undo_point ? 1 : 0 // whether we set an undo point
    );
528
}
529

530
531
function cancel(revert_changes) {
    var dirty = false, attr;
532
    //window.close(true);
Hugo Neves de Carvalho's avatar
Hugo Neves de Carvalho committed
533
    if(pdgui.is_webapp()){
534
      $("#dialog-modal").modal("hide");
Hugo Neves de Carvalho's avatar
Hugo Neves de Carvalho committed
535
    }
536
537
538
539
540
541
542
543
544
545
    if (revert_changes) {
        for (attr in old_attrs) {
            if (old_attrs[attr] !== new_attrs[attr]) {
                dirty = true;
            }
        }
        if (dirty) {
            send_params(old_attrs, false);
        }
    }
546
    pdgui.pdsend(pd_object_callback, "cancel");
547
548
}

549
550
551
552
553
554
555
556
function apply() {
    send_params(new_attrs, false);
}

function ok() {
    // Steal focus from any active input to make sure it triggers an
    // onchange event
    document.querySelector("button").focus();
557
558
    // send the old attrs first so we can set an undo point on them
    send_params(old_attrs, false);
559
560
561
562
    send_params(new_attrs, true);
    cancel(false);
}

563
564
function change_width_and_height_labels() {
    [".mknob_steps", ".mknob_size"].forEach(function(sel) {
565
566
        Array.prototype.forEach.call(
            document.body.querySelectorAll(sel), function(e) {
567
568
            e.setAttribute("data-i18n", "iem.prop" + sel);
        });
569
570
571
	Array.prototype.forEach.call(
            document.body.querySelectorAll(sel + "_tt"), function(e) {
                e.setAttribute("data-i18n", "[title]iem.prop" + sel + "_tt");
572
        });
573
574
575
    });
}

576
577
578
// This gets called from the nw_create_window function in index.html
// It provides us with our window id from the C side.  Once we have it
// we can create the menu and register event callbacks
579
function register_window_id(gfxstub, attr_object) {
580
    var attr;
581
    pd_object_callback = gfxstub;
582
583
584
585
586
587
    old_attrs = attr_object;
    for (attr in old_attrs) {
        if (old_attrs.hasOwnProperty(attr)) {
            new_attrs[attr] = old_attrs[attr];
        }
    }
588
    console.log("attr object is " + attr_object.toString());
589
    add_events(gfxstub);
590
591
592
593

    // Special case for [moonlib/mknob] which leverages the iemgui dialog--
    // change the label for "height" to "steps"
    if (attr_object.type === "mknob") {
594
        change_width_and_height_labels();
595
596
    }

597
    translate_form();
598
    populate_form(attr_object);
599
600
601
602
    // We don't turn on rendering of the "container" div until
    // We've finished displaying all the spans and populating the
    // labels and form elements.  That makes it more efficient and
    // snappier, at least on older machines.
603
604
    document.getElementsByClassName("container")[0]
        .style.setProperty("display", "inline");
605
    pdgui.resize_window(pd_object_callback);
606
}
Hugo Neves de Carvalho's avatar
Hugo Neves de Carvalho committed
607
window.register_dialog = register_window_id;
608
609

function tr_text(id) {
610
611
    var elem = document.getElementById("iem.prop." + id);
    elem.textContent = l("iem.prop." + id);
612
613
614
615
616
}

// Stop-gap translator
function translate_form() {
    var i
617
    var elements = document.querySelectorAll("[data-i18n]");
618
619
    for (i = 0; i < elements.length; i++) {
        var data = elements[i].dataset.i18n;
620
        if (data.slice(0,7) === "[title]") {
621
622
623
624
625
626
627
            elements[i].title = l(data.slice(7));
        } else {
            elements[i].textContent = l(data);
        }
    }
}

628
629
630
function populate_form(attr_object) {
    var attr;
    for(attr in attr_object) {
631
        // Unhide the span with the class with the same name as the id
632
        var prop_group = document.getElementsByClassName(attr)[0];
633
        if (prop_group !== undefined) {
634
            console.log("the thing here is " + attr);
635
            prop_group.classList.remove("hidden");
636
637
638
639
        }
        // iemguis use the string 'empty' for null because of
        // the limitations of Pd's state-saving API.  So we have
        // to filter that one out
640
        if (attr_object[attr] !== "empty") {
641
            var elem = document.getElementsByName(attr);
642
            if (elem.length > 0) {
643
                if (attr.slice(-5) === "color") {
644
                    var hex_string = Number(attr_object[attr]).toString(16);
645
                    var color_string = "#" +
646
                        (hex_string === "0" ? "000000" : hex_string);
Jonathan Wilkes's avatar
Jonathan Wilkes committed
647
                    //pdgui.post("color is " + color_string);
648
                    elem[0].value = color_string;
649
                } else if (elem[0].type === "checkbox") {
650
651
                    // The attr here is a string, so we need to
                    // force it to number, hence the "+" below
652
                    elem[0].checked = +attr_object[attr];
653
                } else if (elem[0].type === "select-one") {
654
                    elem[0].selectedIndex = +attr_object[attr];
655
                } else if (attr === "send_symbol" ||
656
657
                           attr === "receive_symbol" ||
                           attr === "label") {
658
                    elem[0].value = iemgui_unescape(attr_object[attr]);
659
                } else {
660
                    elem[0].value = attr_object[attr];
661
662
663
664
665
666
667
668
                }
            }
        }
    }
}

function add_events(name) {
    // closing the Window
Hugo Neves de Carvalho's avatar
Hugo Neves de Carvalho committed
669
670
671
672
673
674
    if(!pdgui.is_webapp()){
        gui.Window.get().on("close", function() {
            // this needs to do whatever the "cancel" button does
            cancel(false);
        });
    }
675
    pdgui.dialog_bindings(name);
676
677
678
679
680
681
    if (pdgui.is_webapp) {
      $("#dialog-modal").on("hidden.bs.modal", function (e) {
        remove_dialog(pd_object_callback)
        $("#dialog-modal").off("hidden.bs.modal")
      })
    }
682
683
684
685
686
}

  </script>
  </body>
</html>