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
|
/* ---------------------------------------------------------------------
*
* Giada - Your Hardcore Loopmachine
*
* gd_warnings
*
* ---------------------------------------------------------------------
*
* Copyright (C) 2010-2015 Giovanni A. Zuliani | Monocasual
*
* This file is part of Giada - Your Hardcore Loopmachine.
*
* Giada - Your Hardcore Loopmachine is free software: you can
* redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* Giada - Your Hardcore Loopmachine is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Giada - Your Hardcore Loopmachine. If not, see
* <http://www.gnu.org/licenses/>.
*
* ------------------------------------------------------------------ */
#include "gd_warnings.h"
void gdAlert(const char *c) {
Fl_Window *modal = new Fl_Window(
(Fl::w() / 2) - 150,
(Fl::h() / 2) - 47,
300, 90, "Alert");
modal->set_modal();
modal->begin();
gBox *box = new gBox(10, 10, 280, 40, c);
gClick *b = new gClick(210, 60, 80, 20, "Close");
modal->end();
box->labelsize(11);
b->callback(__cb_window_closer, (void *)modal);
b->shortcut(FL_Enter);
gu_setFavicon(modal);
modal->show();
}
int gdConfirmWin(const char *title, const char *msg) {
Fl_Window *win = new Fl_Window(
(Fl::w() / 2) - 150,
(Fl::h() / 2) - 47,
300, 90, title);
win->set_modal();
win->begin();
new gBox(10, 10, 280, 40, msg);
gClick *ok = new gClick(212, 62, 80, 20, "Ok");
gClick *ko = new gClick(124, 62, 80, 20, "Cancel");
win->end();
ok->shortcut(FL_Enter);
gu_setFavicon(win);
win->show();
/* no callbacks here. readqueue() check the event stack. */
int r = 0;
while (true) {
Fl_Widget *o = Fl::readqueue();
if (!o) Fl::wait();
else if (o == ok) {r = 1; break;}
else if (o == ko) {r = 0; break;}
}
//delete win;
win->hide();
return r;
}
|