diff options
Diffstat (limited to 'src/frontend/dialog_setlocate.fl')
-rwxr-xr-x | src/frontend/dialog_setlocate.fl | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/src/frontend/dialog_setlocate.fl b/src/frontend/dialog_setlocate.fl new file mode 100755 index 0000000..30de1a6 --- /dev/null +++ b/src/frontend/dialog_setlocate.fl | |||
@@ -0,0 +1,209 @@ | |||
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_setlocate {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 {Edit locate point} open | ||
28 | xywh {160 247 385 100} type Double color 52 | ||
29 | code0 {currsong=p_currsong; buttonclicked=0; mode=2; locnum=p_locnum;} | ||
30 | code1 {locpoint=currsong->getlocatepos(locnum); locname->value(currsong->getlocatename(locnum)->c_str());} | ||
31 | code2 {setuiloc(currsong->getlocatepos(locnum)); subsecmax=29;} | ||
32 | code3 {if ((locnum!=1) && (locnum!=2)) { setasrange->hide(); }; if (locnum==1) { setasrange->label("Set as start of export range"); } if (locnum==2) { setasrange->label("Set as end of export range"); }} modal visible | ||
33 | } { | ||
34 | Fl_Button button_ok { | ||
35 | label OK | ||
36 | callback {buttonclicked=1; //OK | ||
37 | char dest[10]; | ||
38 | strncpy(&dest[0],locname->value(),8); | ||
39 | dest[9]='\\0'; | ||
40 | string* newname=new string(dest); | ||
41 | currsong->setlocatename(locnum,*newname); | ||
42 | currsong->setlocatepos(locnum,locpoint); | ||
43 | useasrange=setasrange->value(); | ||
44 | delete newname; | ||
45 | Fl_Window * x = Fl::first_window(); | ||
46 | x->~Fl_Window();} | ||
47 | xywh {235 75 70 20} labelsize 12 | ||
48 | } | ||
49 | Fl_Button button_cancel { | ||
50 | label Cancel | ||
51 | callback {buttonclicked=2; //Cancel | ||
52 | useasrange=0; | ||
53 | Fl_Window * x = Fl::first_window(); | ||
54 | x->~Fl_Window();} | ||
55 | xywh {310 75 70 20} labelsize 12 | ||
56 | } | ||
57 | Fl_Input hr { | ||
58 | label {New locate point:} | ||
59 | callback {unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels()); | ||
60 | unsigned long realrate=currsong->samplerate()/chmult; | ||
61 | |||
62 | locpoint-=(unsigned long)(3600*realrate*(currsong->display_hours(locpoint))); | ||
63 | locpoint+=(unsigned long)(3600*realrate*(strtol(hr->value(),0,10))); | ||
64 | setuiloc(locpoint);} | ||
65 | xywh {150 45 50 20} type Int labelsize 12 textsize 12 | ||
66 | code0 {o->maximum_size(2);} | ||
67 | } | ||
68 | Fl_Input min { | ||
69 | label {:} | ||
70 | callback {unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels()); | ||
71 | unsigned long realrate=currsong->samplerate()/chmult; | ||
72 | |||
73 | locpoint-=(unsigned long)(60*realrate*(currsong->display_minutes(locpoint))); | ||
74 | locpoint+=(unsigned long)(60*realrate*(strtol(min->value(),0,10))); | ||
75 | setuiloc(locpoint);} | ||
76 | xywh {210 45 45 20} type Int labelfont 1 labelsize 12 textsize 12 | ||
77 | code0 {o->maximum_size(2);} | ||
78 | } | ||
79 | Fl_Input sec { | ||
80 | label {:} | ||
81 | callback {unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels()); | ||
82 | unsigned long realrate=currsong->samplerate()/chmult; | ||
83 | |||
84 | locpoint-=(unsigned long)(realrate*(currsong->display_seconds(locpoint))); | ||
85 | locpoint+=(unsigned long)(realrate*(strtol(sec->value(),0,10))); | ||
86 | setuiloc(locpoint);} | ||
87 | xywh {265 45 45 20} type Int labelfont 1 labelsize 12 textsize 12 | ||
88 | code0 {o->maximum_size(2);} | ||
89 | } | ||
90 | Fl_Input subsec { | ||
91 | label {.} | ||
92 | callback {if (strtol(subsec->value(),0,10)>subsecmax) { | ||
93 | string* strmax=Convert::int2str(subsecmax); | ||
94 | subsec->value(strmax->c_str()); | ||
95 | delete strmax; | ||
96 | |||
97 | } | ||
98 | |||
99 | unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels()); | ||
100 | unsigned long realrate=currsong->samplerate()/chmult; | ||
101 | |||
102 | long subseconds=currsong->display_subseconds(locpoint); | ||
103 | |||
104 | locpoint-=subseconds; | ||
105 | |||
106 | long frames=0; | ||
107 | switch(mode) { | ||
108 | case 0: frames=100; break; | ||
109 | case 1: frames=realrate; break; | ||
110 | case 2: frames=30; break; | ||
111 | } | ||
112 | locpoint+=(unsigned long)(strtol(subsec->value(),0,10)*currsong->samplerate()/(frames*chmult)); | ||
113 | setuiloc(locpoint);} | ||
114 | xywh {320 45 60 20} type Int labelfont 1 labelsize 12 textsize 12 | ||
115 | code0 {o->maximum_size(5);} | ||
116 | } | ||
117 | Fl_Button button_mode { | ||
118 | label Frames | ||
119 | callback {mode=(mode+1)%3; | ||
120 | switch(mode) { | ||
121 | case 0: | ||
122 | { | ||
123 | o->label("Sec/100"); | ||
124 | subsecmax=99; | ||
125 | break; | ||
126 | } | ||
127 | case 1: | ||
128 | { | ||
129 | |||
130 | if ((currsong->physical_channels()/currsong->logical_channels())==2) { | ||
131 | o->label("2*Sams"); | ||
132 | } else { | ||
133 | o->label("Samples"); | ||
134 | } | ||
135 | subsecmax=currsong->samplerate()/(currsong->physical_channels()/currsong->logical_channels()); | ||
136 | break; | ||
137 | } | ||
138 | case 2: | ||
139 | { | ||
140 | o->label("Frames"); | ||
141 | subsecmax=29; | ||
142 | break; | ||
143 | } | ||
144 | } | ||
145 | setuiloc(locpoint);} | ||
146 | xywh {320 25 60 20} labelsize 12 align 18 | ||
147 | } | ||
148 | Fl_Input locname { | ||
149 | label {Location Name:} | ||
150 | callback {char templabel[10]; | ||
151 | strncpy(&templabel[0],o->value(),8); | ||
152 | templabel[8]='\\0'; | ||
153 | o->value(templabel);} | ||
154 | xywh {150 5 115 20} labelsize 12 textsize 12 | ||
155 | code0 {o->maximum_size(8);} | ||
156 | } | ||
157 | Fl_Check_Button setasrange { | ||
158 | label {Set as start of export range} | ||
159 | xywh {25 75 205 20} down_box DOWN_BOX value 1 labelsize 12 | ||
160 | } | ||
161 | Fl_Box {} { | ||
162 | label Hr | ||
163 | xywh {150 28 50 17} labelsize 12 | ||
164 | } | ||
165 | Fl_Box {} { | ||
166 | label Min | ||
167 | xywh {210 28 45 17} labelsize 12 | ||
168 | } | ||
169 | Fl_Box {} { | ||
170 | label Sec | ||
171 | xywh {265 28 45 17} labelsize 12 | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | Function {setuiloc(unsigned long offset)} {open return_type void | ||
176 | } { | ||
177 | code {unsigned long maxoffset=currsong->getlocatepos(25); | ||
178 | if (offset>maxoffset) { | ||
179 | offset=maxoffset; | ||
180 | locpoint=offset; | ||
181 | } | ||
182 | string* strhr=Convert::int2str(currsong->display_hours(offset)); | ||
183 | hr->value(strhr->c_str()); | ||
184 | delete strhr; | ||
185 | |||
186 | string* strmin=Convert::int2str(currsong->display_minutes(offset)); | ||
187 | min->value(strmin->c_str()); | ||
188 | delete strmin; | ||
189 | |||
190 | string* strsec=Convert::int2str(currsong->display_seconds(offset)); | ||
191 | sec->value(strsec->c_str()); | ||
192 | delete strsec; | ||
193 | |||
194 | string* strsubsec; | ||
195 | |||
196 | long subseconds=currsong->display_subseconds(offset); | ||
197 | long subsecval; | ||
198 | switch(mode) { | ||
199 | case 0: subsecval=((subseconds*100)/ ( currsong->samplerate()/ (currsong->physical_channels()/currsong->logical_channels()) ) ); break; | ||
200 | case 1: subsecval=(subseconds); break; | ||
201 | case 2: subsecval=((subseconds*30)/( currsong->samplerate()/ (currsong->physical_channels()/currsong->logical_channels()) ) ); ; break; | ||
202 | default: subsecval=0; | ||
203 | } | ||
204 | strsubsec=Convert::int2str(subsecval); | ||
205 | subsec->value(strsubsec->c_str()); | ||
206 | delete strsubsec;} {selected | ||
207 | } | ||
208 | } | ||
209 | } | ||