aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/dialog_setlocate.fl
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/dialog_setlocate.fl')
-rwxr-xr-xsrc/frontend/dialog_setlocate.fl209
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)
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_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
37char dest[10];
38strncpy(&dest[0],locname->value(),8);
39dest[9]='\\0';
40string* newname=new string(dest);
41currsong->setlocatename(locnum,*newname);
42currsong->setlocatepos(locnum,locpoint);
43useasrange=setasrange->value();
44delete newname;
45Fl_Window * x = Fl::first_window();
46x->~Fl_Window();}
47 xywh {235 75 70 20} labelsize 12
48 }
49 Fl_Button button_cancel {
50 label Cancel
51 callback {buttonclicked=2; //Cancel
52useasrange=0;
53Fl_Window * x = Fl::first_window();
54x->~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());
60unsigned long realrate=currsong->samplerate()/chmult;
61
62locpoint-=(unsigned long)(3600*realrate*(currsong->display_hours(locpoint)));
63locpoint+=(unsigned long)(3600*realrate*(strtol(hr->value(),0,10)));
64setuiloc(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());
71unsigned long realrate=currsong->samplerate()/chmult;
72
73locpoint-=(unsigned long)(60*realrate*(currsong->display_minutes(locpoint)));
74locpoint+=(unsigned long)(60*realrate*(strtol(min->value(),0,10)));
75setuiloc(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());
82unsigned long realrate=currsong->samplerate()/chmult;
83
84locpoint-=(unsigned long)(realrate*(currsong->display_seconds(locpoint)));
85locpoint+=(unsigned long)(realrate*(strtol(sec->value(),0,10)));
86setuiloc(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
99unsigned int chmult=(currsong->physical_channels()/currsong->logical_channels());
100unsigned long realrate=currsong->samplerate()/chmult;
101
102long subseconds=currsong->display_subseconds(locpoint);
103
104locpoint-=subseconds;
105
106long frames=0;
107switch(mode) {
108 case 0: frames=100; break;
109 case 1: frames=realrate; break;
110 case 2: frames=30; break;
111}
112locpoint+=(unsigned long)(strtol(subsec->value(),0,10)*currsong->samplerate()/(frames*chmult));
113setuiloc(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;
120switch(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}
145setuiloc(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];
151strncpy(&templabel[0],o->value(),8);
152templabel[8]='\\0';
153o->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);
178if (offset>maxoffset) {
179 offset=maxoffset;
180 locpoint=offset;
181}
182string* strhr=Convert::int2str(currsong->display_hours(offset));
183hr->value(strhr->c_str());
184delete strhr;
185
186string* strmin=Convert::int2str(currsong->display_minutes(offset));
187min->value(strmin->c_str());
188delete strmin;
189
190string* strsec=Convert::int2str(currsong->display_seconds(offset));
191sec->value(strsec->c_str());
192delete strsec;
193
194string* strsubsec;
195
196long subseconds=currsong->display_subseconds(offset);
197long subsecval;
198switch(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}
204strsubsec=Convert::int2str(subsecval);
205subsec->value(strsubsec->c_str());
206delete strsubsec;} {selected
207 }
208 }
209}