aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/dialog_newsong.fl
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/dialog_newsong.fl')
-rwxr-xr-xsrc/frontend/dialog_newsong.fl352
1 files changed, 352 insertions, 0 deletions
diff --git a/src/frontend/dialog_newsong.fl b/src/frontend/dialog_newsong.fl
new file mode 100755
index 0000000..3974649
--- /dev/null
+++ b/src/frontend/dialog_newsong.fl
@@ -0,0 +1,352 @@
1# data file for the Fltk User Interface Designer (fluid)
2version 1.0107
3header_name {.h}
4code_name {.cxx}
5decl {\#include <hd24fs.h>} {public
6}
7
8decl {\#include <convertlib.h>} {public
9}
10
11class dialog_newsong {open
12} {
13 decl {int buttonclicked;} {public
14 }
15 decl {char songname[65];} {public
16 }
17 decl {unsigned long songlength_in_samples;} {public
18 }
19 decl {__uint32 samplerate;} {public
20 }
21 decl {__uint32 trackcount;} {public
22 }
23 decl {int mode;} {public
24 }
25 decl {int useasrange;} {public
26 }
27 decl {int locnum;} {}
28 decl {int subsecmax;} {}
29 Function {make_window()} {open
30 } {
31 Fl_Window {} {
32 label {New song} open
33 xywh {212 241 500 180} type Double color 52
34 code0 {buttonclicked=0; mode=2; songname[0]='\\0';}
35 code1 {subsecmax=29; samplerate=44100; trackcount=24;}
36 code2 {setuiloc(0);} modal visible
37 } {
38 Fl_Button button_ok {
39 label OK
40 callback {buttonclicked=1; //OK
41strncpy(songname,currname->value(),64);
42songlength_in_samples=getsonglen();
43Fl_Window * x = Fl::first_window();
44x->~Fl_Window();}
45 xywh {345 155 70 20} labelsize 12
46 }
47 Fl_Button button_cancel {
48 label Cancel
49 callback {buttonclicked=2; //Cancel
50useasrange=0;
51Fl_Window * x = Fl::first_window();
52x->~Fl_Window();}
53 xywh {420 155 70 20} labelsize 12
54 }
55 Fl_Input hr {
56 label {Length: }
57 callback {setuiloc(getsonglen());}
58 xywh {100 130 50 20} type Int labelsize 12 textsize 12
59 code0 {o->maximum_size(2);}
60 }
61 Fl_Input min {
62 label {:}
63 callback {setuiloc(getsonglen());}
64 xywh {160 130 45 20} type Int labelfont 1 labelsize 12 textsize 12
65 code0 {o->maximum_size(2);}
66 }
67 Fl_Input sec {
68 label {:}
69 callback {setuiloc(getsonglen());}
70 xywh {215 130 45 20} type Int labelfont 1 labelsize 12 textsize 12
71 code0 {o->maximum_size(2);}
72 }
73 Fl_Input subsec {
74 label {.}
75 callback {setuiloc(getsonglen());}
76 xywh {270 130 60 20} type Int labelfont 1 labelsize 12 textsize 12
77 code0 {o->maximum_size(5);}
78 }
79 Fl_Button button_mode {
80 label Frames
81 callback {setplchan();
82
83mode=(mode+1)%3;
84switch(mode) {
85 case 0:
86 {
87 o->label("Sec/100");
88 subsecmax=99;
89 break;
90 }
91 case 1:
92 {
93
94 if ((pchan /lchan)==2) {
95 o->label("2*Sams");
96 } else {
97 o->label("Samples");
98 }
99 subsecmax=samplerate/(pchan/lchan);
100 break;
101 }
102 case 2:
103 {
104 o->label("Frames");
105 subsecmax=29;
106 break;
107 }
108}
109setuiloc(songlength_in_samples);}
110 xywh {270 110 60 20} labelsize 12 align 18
111 }
112 Fl_Box {} {
113 label Hr
114 xywh {100 113 50 17} labelsize 12
115 }
116 Fl_Box {} {
117 label Min
118 xywh {160 113 45 17} labelsize 12
119 }
120 Fl_Box {} {
121 label Sec
122 xywh {215 113 45 17} labelsize 12
123 }
124 Fl_Input currname {
125 label {Song name:}
126 callback {char filteredname[65];
127int x=strlen(o->value());
128if (x>64) { x=64; }
129int src=0;
130int filtered=0;
131for (int i=0;i<x;i++) {
132 if (
133 (o->value()[i]=='\\\\')
134 || (o->value()[i]=='/')
135 || (o->value()[i]==':')
136 || (o->value()[i]=='*')
137 || (o->value()[i]=='?')
138 || (o->value()[i]=='"')
139 || (o->value()[i]=='<')
140 || (o->value()[i]=='>')
141 || (o->value()[i]=='\\\\')
142 || (o->value()[i]=='|'))
143 {
144 filtered=1;
145 continue;
146 }
147 filteredname[src]=o->value()[i];
148 src++;
149}
150filteredname[src]='\\0';
151if (filtered==1) {
152 int pos=o->position()-1;
153 if (pos<0) pos=0;
154 o->value(filteredname);
155 o->position(pos,pos);
156}}
157 xywh {100 35 390 20} labelsize 12 when 1 textsize 12
158 code0 {o->maximum_size(64);}
159 code1 {o->value("Song Name"); o->take_focus();}
160 }
161 Fl_Choice ratechoice {
162 label {Sample rate:} open
163 xywh {100 60 145 20} down_box BORDER_BOX labelsize 12 textsize 12
164 code0 {o->value(0);}
165 } {
166 MenuItem {} {
167 label {44100 Hz}
168 callback {samplerate=44100; setuiloc(getsonglen());}
169 xywh {35 35 36 21} labelsize 12
170 }
171 MenuItem {} {
172 label {48000 Hz}
173 callback {samplerate=48000;setuiloc(getsonglen());}
174 xywh {45 45 36 21} labelsize 12
175 }
176 MenuItem {} {
177 label {88200 Hz}
178 callback {samplerate=88200; setuiloc(getsonglen());
179if (numtracks->value()>7)
180{
181 numtracks->value(7);
182 trackcount=12;
183}}
184 xywh {55 55 36 21} labelsize 12
185 }
186 MenuItem {} {
187 label {96000 Hz}
188 callback {samplerate=96000; setuiloc(getsonglen());
189if (numtracks->value()>7)
190{
191 numtracks->value(7);
192 trackcount=12;
193}}
194 xywh {65 65 36 21} labelsize 12
195 }
196 }
197 Fl_Choice numtracks {
198 label {\# of Tracks:} open
199 xywh {100 85 145 20} down_box BORDER_BOX labelsize 12 textsize 12
200 code0 {o->value(10);}
201 } {
202 MenuItem {} {
203 label 1
204 callback {trackcount=1;}
205 xywh {45 45 36 21} labelsize 12
206 }
207 MenuItem {} {
208 label 2
209 callback {trackcount=2;}
210 xywh {55 55 36 21} labelsize 12
211 }
212 MenuItem {} {
213 label 3
214 callback {trackcount=3;}
215 xywh {65 65 36 21} labelsize 12
216 }
217 MenuItem {} {
218 label 4
219 callback {trackcount=4;}
220 xywh {75 75 36 21} labelsize 12
221 }
222 MenuItem {} {
223 label 6
224 callback {trackcount=6;}
225 xywh {85 85 36 21} labelsize 12
226 }
227 MenuItem {} {
228 label 8
229 callback {trackcount=8;}
230 xywh {95 95 36 21} labelsize 12
231 }
232 MenuItem {} {
233 label 9
234 callback {trackcount=9;}
235 xywh {105 105 36 21} labelsize 12
236 }
237 MenuItem {} {
238 label 12
239 callback {trackcount=12;}
240 xywh {105 105 36 21} labelsize 12
241 }
242 MenuItem {} {
243 label 16
244 callback {trackcount=16;
245if (samplerate>=88200)
246{
247 trackcount=12;
248 numtracks->value(7);
249}}
250 xywh {115 115 36 21} labelsize 12
251 }
252 MenuItem {} {
253 label 18
254 callback {trackcount=18;
255if (samplerate>=88200)
256{
257 trackcount=12;
258 numtracks->value(7);
259}}
260 xywh {125 125 36 21} labelsize 12
261 }
262 MenuItem {} {
263 label 24
264 callback {trackcount=24;
265if (samplerate>=88200)
266{
267 trackcount=12;
268 numtracks->value(7);
269}}
270 xywh {135 135 36 21} labelsize 12
271 }
272 }
273 Fl_Box {} {
274 label {Please specify the parameters for the new song below:}
275 xywh {5 8 485 19} labelfont 1 labelsize 12 align 20
276 }
277 }
278 }
279 Function {setuiloc(__uint32 offset)} {open return_type void
280 } {
281 code {setplchan();
282unsigned int chmult=(pchan/lchan);
283unsigned long realrate=samplerate/chmult;
284
285string* strhr=Convert::int2str(hd24song::display_hours(offset,realrate));
286hr->value(strhr->c_str());
287delete strhr;
288
289string* strmin=Convert::int2str(hd24song::display_minutes(offset,realrate));
290min->value(strmin->c_str());
291delete strmin;
292
293string* strsec=Convert::int2str(hd24song::display_seconds(offset,realrate));
294sec->value(strsec->c_str());
295delete strsec;
296
297string* strsubsec;
298
299long subseconds=hd24song::display_subseconds(offset,realrate);
300long subsecval;
301setplchan();
302
303switch(mode) {
304 case 0: subsecval=((subseconds*100)/ realrate ); break;
305 case 1: subsecval=(subseconds); break;
306 case 2: subsecval=((subseconds*30)/realrate ); break;
307 default: subsecval=0;
308}
309strsubsec=Convert::int2str(subsecval);
310subsec->value(strsubsec->c_str());
311delete strsubsec;} {}
312 }
313 Function {setplchan()} {open
314 } {
315 code {lchan = trackcount;
316if (this->samplerate>=88200) {
317 pchan=lchan*2;
318} else {
319 pchan=lchan;
320}} {}
321 }
322 decl {int pchan;} {}
323 decl {int lchan;} {}
324 Function {getsonglen()} {open return_type __uint32
325 } {
326 code {setplchan();
327unsigned int chmult=(pchan/lchan);
328unsigned long realrate=samplerate/chmult;
329
330long frames=0;
331switch(mode) {
332 case 0: frames=100; break;
333 case 1: frames=realrate; break;
334 case 2: frames=30; break;
335}
336
337__uint64 mylocpoint=((__uint64)3600* (__uint64)strtol( hr->value(),0,10) )
338 +((__uint64) 60* (__uint64)strtol(min->value(),0,10) )
339 +((__uint64) 1* (__uint64)strtol(sec->value(),0,10) )
340 ;
341
342mylocpoint=(__uint64)((__uint64)realrate*(__uint64)mylocpoint);
343
344mylocpoint+=(__uint64)(strtol(subsec->value(),0,10)*samplerate/(frames*chmult));
345
346if (mylocpoint>0xFFFFFFFF) {
347 mylocpoint=0xFFFFFFFF;
348}
349return (__uint32)mylocpoint;} {selected
350 }
351 }
352}