summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/synti/zynaddsubfx/UI/PresetsUI.fl
blob: b527b9c4223577ec5b1ae5d5de2b5b6405714d2b (plain)
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
# data file for the Fltk User Interface Designer (fluid)
version 1.0105 
header_name {.h} 
code_name {.cc}
decl {\#include <FL/fl_ask.H>} {public
} 

decl {\#include <stdio.h>} {public
} 

decl {\#include <stdlib.h>} {public
} 

decl {\#include "../Params/Presets.h"} {public
} 

class PresetsUI_ {} {
  Function {refresh()} {open return_type {virtual void}
  } {}
  Function {~PresetsUI_()} {open return_type virtual
  } {}
} 

class PresetsUI {} {
  Function {PresetsUI()} {} {
    code {p=NULL;
make_window();} {}
  }
  Function {~PresetsUI()} {} {
    code {copywin->hide();delete(copywin);
pastewin->hide();delete(pastewin);} {}
  }
  Function {make_window()} {} {
    Fl_Window copywin {
      label {Copy to Clipboard/Preset}
      xywh {190 173 265 430} type Double box PLASTIC_THIN_UP_BOX color 238 hide modal
    } {
      Fl_Browser copybrowse {
        callback {int val=o->value();
if (val!=0){
   presetname->cut(0,presetname->maximum_size());
   presetname->insert(o->text(val));
};}
        xywh {10 25 245 320} type Select
      }
      Fl_Button copypbutton {
        label {Copy to Preset}
        callback {const char *tmp=presetname->value();
if (tmp!=NULL) {
        if (strlen(tmp)>0){
           p->copy(tmp);
	   copywin->hide();
        };
};}
        xywh {145 355 110 20} box THIN_UP_BOX
      }
      Fl_Button copybutton {
        label {Copy to Clipboard}
        callback {p->copy(NULL);
copywin->hide();}
        xywh {25 385 90 35} box THIN_UP_BOX align 192
      }
      Fl_Button {} {
        label Cancel
        callback {copywin->hide();}
        xywh {160 385 80 35} box THIN_UP_BOX align 192
      }
      Fl_Box {} {
        label {Type:}
        xywh {10 5 40 15} labelsize 12 align 20
      }
      Fl_Box copytypetext {
        xywh {50 5 205 15} box FLAT_BOX color 238 labelfont 1 labelsize 12 align 20
      }
      Fl_Input presetname {
        callback {const char *tmp=o->value();
if (tmp==NULL) tmp="";
if (strlen(tmp)>0) {
	copybutton->deactivate();
	copypbutton->activate();
} else {
	copybutton->activate();
	copypbutton->deactivate();
};}
        xywh {10 355 130 20} when 1
      }
    }
    Fl_Window pastewin {
      label {Paste from Clipboard/Preset}
      xywh {463 173 265 430} type Double box PLASTIC_THIN_UP_BOX color 238 hide modal
    } {
      Fl_Browser pastebrowse {
        callback {if (o->value()==0) {
	pastepbutton->deactivate();
	deletepbutton->deactivate();
}else{
	pastepbutton->activate();
	deletepbutton->activate();
};} selected
        xywh {10 25 245 320} type Hold
      }
      Fl_Button pastepbutton {
        label {Paste from Preset}
        callback {int n=pastebrowse->value();
if (n!=0) p->paste(n);
pastewin->hide();
pui->refresh();}
        xywh {10 355 160 20} box THIN_UP_BOX
      }
      Fl_Button pastebutton {
        label {Paste from Clipboard}
        callback {p->paste(0);
pastewin->hide();
pui->refresh();}
        xywh {25 385 90 35} box THIN_UP_BOX align 192
      }
      Fl_Button {} {
        label Cancel
        callback {pastewin->hide();}
        xywh {160 385 80 35} box THIN_UP_BOX align 192
      }
      Fl_Box pastetypetext {
        xywh {55 5 200 15} box FLAT_BOX color 238 labelfont 1 labelsize 12 align 20
      }
      Fl_Box {} {
        label {Type:}
        xywh {15 5 40 15} labelsize 12 align 20
      }
      Fl_Button deletepbutton {
        label Delete
        callback {int n=pastebrowse->value();
if (n!=0) p->deletepreset(n);
rescan();}
        xywh {180 355 75 20} box THIN_UP_BOX
      }
    }
  }
  Function {copy(Presets *p)} {} {
    code {copybutton->activate();
copypbutton->deactivate();


this->p=p;
this->pui=NULL;
bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
presetname->cut(0,presetname->maximum_size());

if (but) p->copy(NULL);
   else {
        rescan();
	copytypetext->label(&p->type[1]);
	copywin->show();
   };} {}
  }
  Function {paste(Presets *p,PresetsUI_ *pui)} {} {
    code {this->p=p;
this->pui=pui;
bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
pastepbutton->deactivate();
deletepbutton->deactivate();

if (but) {
	p->paste(0);
	pui->refresh();
} else {
        rescan();
	pastetypetext->label(&p->type[1]);
	if (p->checkclipboardtype()) pastebutton->activate();
		else pastebutton->deactivate();
	pastewin->show();
   };} {}
  }
  Function {copy(Presets *p,int n)} {} {
    code {p->setelement(n);
copy(p);} {}
  }
  Function {paste(Presets *p,PresetsUI_ *pui,int n)} {} {
    code {p->setelement(n);
paste(p,pui);} {}
  }
  Function {rescan()} {} {
    code {copybrowse->clear();
pastebrowse->clear();
p->rescanforpresets();

for (int i=0;i<MAX_PRESETS;i++){
   char *name=presetsstore.presets[i].name;
   if (name==NULL) break;
   copybrowse->add(name);
   pastebrowse->add(name);
};} {}
  }
  decl {Presets *p;} {public
  }
  decl {PresetsUI_ *pui;} {public
  }
} 

decl {PresetsUI *presetsui;} {public
}