aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/dialog_setlength.fl
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/dialog_setlength.fl')
-rwxr-xr-xsrc/frontend/dialog_setlength.fl204
1 files changed, 204 insertions, 0 deletions
diff --git a/src/frontend/dialog_setlength.fl b/src/frontend/dialog_setlength.fl
new file mode 100755
index 0000000..1927f95
--- /dev/null
+++ b/src/frontend/dialog_setlength.fl
@@ -0,0 +1,204 @@
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_setlength {open
12} {
13 decl {int buttonclicked;} {public
14 }
15 decl {unsigned long locpoint;} {public
16 }
17 decl {int mode;} {public
18 }
19 decl {int useasrange;} {public
20 }
21 decl {hd24song* currsong;} {}
22 decl {int locnum;} {}
23 decl {int subsecmax;} {}
24 Function {make_window(hd24song* p_currsong,int p_locnum)} {open
25 } {
26 Fl_Window {} {
27 label {Set song length} open selected
28 xywh {160 246 455 300} type Double color 52
29 code0 {currsong=p_currsong; buttonclicked=0; mode=2;}
30 code1 {locpoint=currsong->songlength_in_samples();}
31 code2 {setuiloc(locpoint); subsecmax=29;}
32 code3 {p_locnum=p_locnum;} modal visible
33 } {
34 Fl_Button button_ok {
35 label OK
36 callback {buttonclicked=1; //OK
37Fl_Window * x = Fl::first_window();
38x->~Fl_Window();}
39 xywh {300 270 70 20} labelsize 12
40 }
41 Fl_Button button_cancel {
42 label Cancel
43 callback {buttonclicked=2; //Cancel
44useasrange=0;
45Fl_Window * x = Fl::first_window();
46x->~Fl_Window();}
47 xywh {375 270 70 20} labelsize 12
48 }
49 Fl_Input hr {
50 label {New song length: }
51 callback {unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels());
52unsigned long realrate=currsong->samplerate()/chmult;
53
54locpoint-=(unsigned long)(3600*realrate*(currsong->display_hours(locpoint)));
55locpoint+=(unsigned long)(3600*realrate*(strtol(hr->value(),0,10)));
56setuiloc(locpoint);}
57 xywh {150 65 50 20} type Int labelsize 12 textsize 12
58 code0 {o->maximum_size(2);}
59 }
60 Fl_Input min {
61 label {:}
62 callback {unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels());
63unsigned long realrate=currsong->samplerate()/chmult;
64
65locpoint-=(unsigned long)(60*realrate*(currsong->display_minutes(locpoint)));
66locpoint+=(unsigned long)(60*realrate*(strtol(min->value(),0,10)));
67setuiloc(locpoint);}
68 xywh {210 65 45 20} type Int labelfont 1 labelsize 12 textsize 12
69 code0 {o->maximum_size(2);}
70 }
71 Fl_Input sec {
72 label {:}
73 callback {unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels());
74unsigned long realrate=currsong->samplerate()/chmult;
75
76locpoint-=(unsigned long)(realrate*(currsong->display_seconds(locpoint)));
77locpoint+=(unsigned long)(realrate*(strtol(sec->value(),0,10)));
78setuiloc(locpoint);}
79 xywh {265 65 45 20} type Int labelfont 1 labelsize 12 textsize 12
80 code0 {o->maximum_size(2);}
81 }
82 Fl_Input subsec {
83 label {.}
84 callback {if (strtol(subsec->value(),0,10)>subsecmax) {
85 string* strmax=Convert::int2str(subsecmax);
86 subsec->value(strmax->c_str());
87 delete strmax;
88
89}
90
91unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels());
92unsigned long realrate=currsong->samplerate()/chmult;
93
94long subseconds=currsong->display_subseconds(locpoint);
95
96locpoint-=subseconds;
97
98long frames=0;
99switch(mode) {
100 case 0: frames=100; break;
101 case 1: frames=realrate; break;
102 case 2: frames=30; break;
103}
104locpoint+=(unsigned long)(strtol(subsec->value(),0,10)*currsong->samplerate()/(frames*chmult));
105setuiloc(locpoint);}
106 xywh {320 65 60 20} type Int labelfont 1 labelsize 12 textsize 12
107 code0 {o->maximum_size(5);}
108 }
109 Fl_Button button_mode {
110 label Frames
111 callback {mode=(mode+1)%3;
112switch(mode) {
113 case 0:
114 {
115 o->label("Sec/100");
116 subsecmax=99;
117 break;
118 }
119 case 1:
120 {
121
122 if ((currsong->physical_channels()/currsong->logical_channels())==2) {
123 o->label("2*Sams");
124 } else {
125 o->label("Samples");
126 }
127 subsecmax=currsong->samplerate()/(currsong->physical_channels()/currsong->logical_channels());
128 break;
129 }
130 case 2:
131 {
132 o->label("Frames");
133 subsecmax=29;
134 break;
135 }
136}
137setuiloc(locpoint);}
138 xywh {320 45 60 20} labelsize 12 align 18
139 }
140 Fl_Box {} {
141 label Hr
142 xywh {150 48 50 17} labelsize 12
143 }
144 Fl_Box {} {
145 label Min
146 xywh {210 48 45 17} labelsize 12
147 }
148 Fl_Box {} {
149 label Sec
150 xywh {265 48 45 17} labelsize 12
151 }
152 Fl_Box {} {
153 label {Set the approximate song length here. Round up when unsure.}
154 xywh {5 5 440 30} labelsize 12 align 20
155 }
156 Fl_Box {} {
157 label {Note: This operation will requires about 40 MB of free space to write
158recovery information to a header file on your computer.
159
160This operation WILL NOT write to your HD24 drive, and as such should
161be completely safe, while permitting you to save your missing audio.
162Once this operation is complete, you should TRANSFER ALL AUDIO
163that you want to keep from the HD24 drive and then re-format it,
164before recording any more audio to it.
165
166Cancel this dialog if you're not in need of a recovery.}
167 xywh {5 100 440 160} labelsize 12 align 21
168 }
169 }
170 }
171 Function {setuiloc(unsigned long offset)} {open return_type void
172 } {
173 code {unsigned long maxoffset=0xFFFFFFFF;
174if (offset>maxoffset) {
175 offset=maxoffset;
176 locpoint=offset;
177}
178string* strhr=Convert::int2str(currsong->display_hours(offset));
179hr->value(strhr->c_str());
180delete strhr;
181
182string* strmin=Convert::int2str(currsong->display_minutes(offset));
183min->value(strmin->c_str());
184delete strmin;
185
186string* strsec=Convert::int2str(currsong->display_seconds(offset));
187sec->value(strsec->c_str());
188delete strsec;
189
190string* strsubsec;
191
192long subseconds=currsong->display_subseconds(offset);
193long subsecval;
194switch(mode) {
195 case 0: subsecval=((subseconds*100)/ ( currsong->samplerate()/ (currsong->physical_channels()/currsong->logical_channels()) ) ); break;
196 case 1: subsecval=(subseconds); break;
197 case 2: subsecval=((subseconds*30)/( currsong->samplerate()/ (currsong->physical_channels()/currsong->logical_channels()) ) ); ; break;
198 default: subsecval=0;
199}
200strsubsec=Convert::int2str(subsecval);
201subsec->value(strsubsec->c_str());
202delete strsubsec;} {}
203 }
204}