diff options
Diffstat (limited to 'src/frontend/dialog_setlength.fl')
-rwxr-xr-x | src/frontend/dialog_setlength.fl | 204 |
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) | ||
2 | version 1.0107 | ||
3 | header_name {.h} | ||
4 | code_name {.cxx} | ||
5 | decl {\#include <hd24fs.h>} {public | ||
6 | } | ||
7 | |||
8 | decl {\#include <convertlib.h>} {public | ||
9 | } | ||
10 | |||
11 | class 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 | ||
37 | Fl_Window * x = Fl::first_window(); | ||
38 | x->~Fl_Window();} | ||
39 | xywh {300 270 70 20} labelsize 12 | ||
40 | } | ||
41 | Fl_Button button_cancel { | ||
42 | label Cancel | ||
43 | callback {buttonclicked=2; //Cancel | ||
44 | useasrange=0; | ||
45 | Fl_Window * x = Fl::first_window(); | ||
46 | x->~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()); | ||
52 | unsigned long realrate=currsong->samplerate()/chmult; | ||
53 | |||
54 | locpoint-=(unsigned long)(3600*realrate*(currsong->display_hours(locpoint))); | ||
55 | locpoint+=(unsigned long)(3600*realrate*(strtol(hr->value(),0,10))); | ||
56 | setuiloc(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()); | ||
63 | unsigned long realrate=currsong->samplerate()/chmult; | ||
64 | |||
65 | locpoint-=(unsigned long)(60*realrate*(currsong->display_minutes(locpoint))); | ||
66 | locpoint+=(unsigned long)(60*realrate*(strtol(min->value(),0,10))); | ||
67 | setuiloc(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()); | ||
74 | unsigned long realrate=currsong->samplerate()/chmult; | ||
75 | |||
76 | locpoint-=(unsigned long)(realrate*(currsong->display_seconds(locpoint))); | ||
77 | locpoint+=(unsigned long)(realrate*(strtol(sec->value(),0,10))); | ||
78 | setuiloc(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 | |||
91 | unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels()); | ||
92 | unsigned long realrate=currsong->samplerate()/chmult; | ||
93 | |||
94 | long subseconds=currsong->display_subseconds(locpoint); | ||
95 | |||
96 | locpoint-=subseconds; | ||
97 | |||
98 | long frames=0; | ||
99 | switch(mode) { | ||
100 | case 0: frames=100; break; | ||
101 | case 1: frames=realrate; break; | ||
102 | case 2: frames=30; break; | ||
103 | } | ||
104 | locpoint+=(unsigned long)(strtol(subsec->value(),0,10)*currsong->samplerate()/(frames*chmult)); | ||
105 | setuiloc(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; | ||
112 | switch(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 | } | ||
137 | setuiloc(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 | ||
158 | recovery information to a header file on your computer. | ||
159 | |||
160 | This operation WILL NOT write to your HD24 drive, and as such should | ||
161 | be completely safe, while permitting you to save your missing audio. | ||
162 | Once this operation is complete, you should TRANSFER ALL AUDIO | ||
163 | that you want to keep from the HD24 drive and then re-format it, | ||
164 | before recording any more audio to it. | ||
165 | |||
166 | Cancel 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; | ||
174 | if (offset>maxoffset) { | ||
175 | offset=maxoffset; | ||
176 | locpoint=offset; | ||
177 | } | ||
178 | string* strhr=Convert::int2str(currsong->display_hours(offset)); | ||
179 | hr->value(strhr->c_str()); | ||
180 | delete strhr; | ||
181 | |||
182 | string* strmin=Convert::int2str(currsong->display_minutes(offset)); | ||
183 | min->value(strmin->c_str()); | ||
184 | delete strmin; | ||
185 | |||
186 | string* strsec=Convert::int2str(currsong->display_seconds(offset)); | ||
187 | sec->value(strsec->c_str()); | ||
188 | delete strsec; | ||
189 | |||
190 | string* strsubsec; | ||
191 | |||
192 | long subseconds=currsong->display_subseconds(offset); | ||
193 | long subsecval; | ||
194 | switch(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 | } | ||
200 | strsubsec=Convert::int2str(subsecval); | ||
201 | subsec->value(strsubsec->c_str()); | ||
202 | delete strsubsec;} {} | ||
203 | } | ||
204 | } | ||