60ed04c5bdebd0391352c579f2ca6e1bd02b2f6e
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / zoombar.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "apatchgui.inc"
23 #include "clip.h"
24 #include "edl.h"
25 #include "edlsession.h"
26 #include "keys.h"
27 #include "language.h"
28 #include "localsession.h"
29 #include "maincursor.h"
30 #include "mwindow.h"
31 #include "mwindowgui.h"
32 #include "mainsession.h"
33 #include "mtimebar.h"
34 #include "preferences.h"
35 #include "theme.h"
36 #include "trackcanvas.h"
37 #include "tracks.h"
38 #include "units.h"
39 #include "vpatchgui.inc"
40 #include "zoombar.h"
41
42
43 ZoomBar::ZoomBar(MWindow *mwindow, MWindowGUI *gui)
44  : BC_SubWindow(mwindow->theme->mzoom_x,
45         mwindow->theme->mzoom_y,
46         mwindow->theme->mzoom_w,
47         mwindow->theme->mzoom_h)
48 {
49         this->gui = gui;
50         this->mwindow = mwindow;
51 }
52
53 ZoomBar::~ZoomBar()
54 {
55         delete sample_zoom;
56         delete amp_zoom;
57         delete track_zoom;
58 }
59
60 void ZoomBar::create_objects()
61 {
62         int xs5 = xS(5), xs10 = xS(10);
63         int x = xS(3), y = get_h()/2 -
64                 mwindow->theme->get_image_set("zoombar_menu", 0)[0]->get_h()/2;
65
66         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
67         sample_zoom = new SampleZoomPanel(mwindow, this, x, y);
68         sample_zoom->create_objects();
69         sample_zoom->set_tooltip(_("Duration visible in the timeline"));
70         x += sample_zoom->get_w();
71         amp_zoom = new AmpZoomPanel(mwindow, this, x, y);
72         amp_zoom->create_objects();
73         amp_zoom->set_tooltip(_("Audio waveform scale"));
74         x += amp_zoom->get_w();
75         track_zoom = new TrackZoomPanel(mwindow, this, x, y);
76         track_zoom->create_objects();
77         track_zoom->set_tooltip(_("Height of tracks in the timeline"));
78         x += track_zoom->get_w() + xs10;
79
80         int wid = xS(120);
81         for( int i=AUTOGROUPTYPE_AUDIO_FADE; i<=AUTOGROUPTYPE_Y; ++i ) {
82                 int ww = BC_GenericButton::calculate_w(this, AutoTypeMenu::to_text(i));
83                 if( ww > wid ) wid = ww;
84         }
85         add_subwindow(auto_type = new AutoTypeMenu(mwindow, this, x, y, wid));
86         auto_type->create_objects();
87         x += auto_type->get_w() + xs10;
88 #define DEFAULT_TEXT "000.00 to 000.00"
89         add_subwindow(auto_zoom = new AutoZoom(mwindow, this, x, y, 0));
90         x += auto_zoom->get_w();
91         add_subwindow(auto_zoom_text = new ZoomTextBox(
92                 mwindow,
93                 this,
94                 x,
95                 y,
96                 DEFAULT_TEXT));
97         x += auto_zoom_text->get_w() + xs5;
98         add_subwindow(auto_zoom = new AutoZoom(mwindow, this, x, y, 1));
99         update_autozoom();
100         x += auto_zoom->get_w() + xs5;
101
102         add_subwindow(from_value = new FromTextBox(mwindow, this, x, y));
103         x += from_value->get_w() + xs5;
104         add_subwindow(length_value = new LengthTextBox(mwindow, this, x, y));
105         x += length_value->get_w() + xs5;
106         add_subwindow(to_value = new ToTextBox(mwindow, this, x, y));
107         x += to_value->get_w() + xs5;
108         add_subwindow(title_alpha_bar = new TitleAlphaBar(mwindow, this, x, y));
109         x += title_alpha_bar->get_w() + xs5;
110         add_subwindow(title_alpha_text = new TitleAlphaText(mwindow, this, x, y));
111
112         update_formatting(from_value);
113         update_formatting(length_value);
114         update_formatting(to_value);
115
116         update();
117 }
118
119
120 void ZoomBar::update_formatting(BC_TextBox *dst)
121 {
122         dst->set_separators(
123                 Units::format_to_separators(mwindow->edl->session->time_format));
124 }
125
126 void ZoomBar::resize_event()
127 {
128         reposition_window(mwindow->theme->mzoom_x, mwindow->theme->mzoom_y,
129                 mwindow->theme->mzoom_w, mwindow->theme->mzoom_h);
130         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
131 }
132
133 void ZoomBar::redraw_time_dependancies()
134 {
135 // Recalculate sample zoom menu
136         sample_zoom->update_menu();
137         sample_zoom->update(mwindow->edl->local_session->zoom_sample);
138         update_formatting(from_value);
139         update_formatting(length_value);
140         update_formatting(to_value);
141         update_autozoom();
142         update_clocks();
143 }
144
145 int ZoomBar::draw()
146 {
147         update();
148         return 0;
149 }
150
151 void ZoomBar::update_autozoom()
152 {
153         update_autozoom(mwindow->edl->local_session->zoombar_showautocolor);
154 }
155
156 void ZoomBar::update_autozoom(int grouptype, int color)
157 {
158         mwindow->edl->local_session->zoombar_showautotype = grouptype;
159         update_autozoom(color);
160 }
161
162 void ZoomBar::update_autozoom(int color)
163 {
164         char string[BCTEXTLEN];
165         int autogroup_type = mwindow->edl->local_session->zoombar_showautotype;
166         mwindow->edl->local_session->zoombar_showautocolor = color;
167         if( color < 0 ) color = get_resources()->default_text_color;
168         switch( autogroup_type ) {
169         case AUTOGROUPTYPE_AUDIO_FADE:
170         case AUTOGROUPTYPE_VIDEO_FADE:
171                 sprintf(string, "%0.01f to %0.01f\n",
172                         mwindow->edl->local_session->automation_mins[autogroup_type],
173                         mwindow->edl->local_session->automation_maxs[autogroup_type]);
174                 break;
175         case AUTOGROUPTYPE_ZOOM:
176         case AUTOGROUPTYPE_SPEED:
177                 sprintf(string, "%0.03f to %0.03f\n",
178                         mwindow->edl->local_session->automation_mins[autogroup_type],
179                         mwindow->edl->local_session->automation_maxs[autogroup_type]);
180                 break;
181         case AUTOGROUPTYPE_X:
182         case AUTOGROUPTYPE_Y:
183                 sprintf(string, "%0.0f to %.0f\n",
184                         mwindow->edl->local_session->automation_mins[autogroup_type],
185                         mwindow->edl->local_session->automation_maxs[autogroup_type]);
186                 break;
187         }
188         auto_zoom_text->update(string);
189         const char *group_name = AutoTypeMenu::to_text(autogroup_type);
190         auto_type->set_text(group_name);
191 }
192
193
194 int ZoomBar::update()
195 {
196         sample_zoom->update(mwindow->edl->local_session->zoom_sample);
197         amp_zoom->update(mwindow->edl->local_session->zoom_y);
198         track_zoom->update(mwindow->edl->local_session->zoom_track);
199         update_autozoom();
200         update_clocks();
201         return 0;
202 }
203
204 int ZoomBar::update_clocks()
205 {
206         from_value->update_position(mwindow->edl->local_session->get_selectionstart(1));
207         length_value->update_position(mwindow->edl->local_session->get_selectionend(1) -
208                 mwindow->edl->local_session->get_selectionstart(1));
209         to_value->update_position(mwindow->edl->local_session->get_selectionend(1));
210         return 0;
211 }
212
213 TitleAlphaBar::TitleAlphaBar(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
214  : BC_FSlider(x, y, 0, xS(150), xS(200), 0, 1.0, mwindow->session->title_bar_alpha, 0)
215 {
216         this->mwindow = mwindow;
217         this->zoombar = zoombar;
218         set_precision(0.01);
219         enable_show_value(0);
220 }
221
222 int TitleAlphaBar::handle_event()
223 {
224         float v = get_value();
225         mwindow->session->title_bar_alpha = v;
226         zoombar->title_alpha_text->update(v);
227         mwindow->gui->draw_trackmovement();
228         mwindow->gui->flush();
229         return 1;
230 }
231
232 TitleAlphaText::TitleAlphaText(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
233  : BC_TextBox(x, y, xS(48), 1, mwindow->session->title_bar_alpha, 0, MEDIUMFONT, 2)
234 {
235         this->mwindow = mwindow;
236         this->zoombar = zoombar;
237         set_tooltip(_("Title Alpha"));
238 }
239
240 int TitleAlphaText::handle_event()
241 {
242         float v = atof(get_text());
243         mwindow->session->title_bar_alpha = v;
244         zoombar->title_alpha_bar->update(v);
245         mwindow->gui->draw_trackmovement();
246         mwindow->gui->flush();
247         return 1;
248 }
249
250 int ZoomBar::resize_event(int w, int h)
251 {
252 // don't change anything but y and width
253         reposition_window(0, h - this->get_h(), w, this->get_h());
254         return 0;
255 }
256
257
258 // Values for which_one
259 #define SET_FROM 1
260 #define SET_LENGTH 2
261 #define SET_TO 3
262
263
264 int ZoomBar::set_selection(int which_one)
265 {
266         double start_position = mwindow->edl->local_session->get_selectionstart(1);
267         double end_position = mwindow->edl->local_session->get_selectionend(1);
268         double length = end_position - start_position;
269
270 // Fix bogus results
271
272         switch(which_one)
273         {
274                 case SET_LENGTH:
275                         start_position = Units::text_to_seconds(from_value->get_text(),
276                                 mwindow->edl->session->sample_rate,
277                                 mwindow->edl->session->time_format,
278                                 mwindow->edl->session->frame_rate,
279                                 mwindow->edl->session->frames_per_foot);
280                         length = Units::text_to_seconds(length_value->get_text(),
281                                 mwindow->edl->session->sample_rate,
282                                 mwindow->edl->session->time_format,
283                                 mwindow->edl->session->frame_rate,
284                                 mwindow->edl->session->frames_per_foot);
285                         end_position = start_position + length;
286
287                         if(end_position < start_position)
288                         {
289                                 start_position = end_position;
290                                 mwindow->edl->local_session->set_selectionend(
291                                         mwindow->edl->local_session->get_selectionstart(1));
292                         }
293                         break;
294
295                 case SET_FROM:
296                         start_position = Units::text_to_seconds(from_value->get_text(),
297                                 mwindow->edl->session->sample_rate,
298                                 mwindow->edl->session->time_format,
299                                 mwindow->edl->session->frame_rate,
300                                 mwindow->edl->session->frames_per_foot);
301                         end_position = Units::text_to_seconds(to_value->get_text(),
302                                 mwindow->edl->session->sample_rate,
303                                 mwindow->edl->session->time_format,
304                                 mwindow->edl->session->frame_rate,
305                                 mwindow->edl->session->frames_per_foot);
306
307                         if(end_position < start_position)
308                         {
309                                 end_position = start_position;
310                                 mwindow->edl->local_session->set_selectionend(
311                                         mwindow->edl->local_session->get_selectionstart(1));
312                         }
313                         break;
314
315                 case SET_TO:
316                         start_position = Units::text_to_seconds(from_value->get_text(),
317                                 mwindow->edl->session->sample_rate,
318                                 mwindow->edl->session->time_format,
319                                 mwindow->edl->session->frame_rate,
320                                 mwindow->edl->session->frames_per_foot);
321                         end_position = Units::text_to_seconds(to_value->get_text(),
322                                 mwindow->edl->session->sample_rate,
323                                 mwindow->edl->session->time_format,
324                                 mwindow->edl->session->frame_rate,
325                                 mwindow->edl->session->frames_per_foot);
326
327                         if(end_position < start_position)
328                         {
329                                 start_position = end_position;
330                                 mwindow->edl->local_session->set_selectionend(
331                                         mwindow->edl->local_session->get_selectionstart(1));
332                         }
333                         break;
334         }
335
336         mwindow->edl->local_session->set_selectionstart(
337                 mwindow->edl->align_to_frame(start_position, 1));
338         mwindow->edl->local_session->set_selectionend(
339                 mwindow->edl->align_to_frame(end_position, 1));
340
341
342         mwindow->gui->update_timebar_highlights();
343         mwindow->gui->hide_cursor(1);
344         mwindow->gui->show_cursor(1);
345         update();
346         mwindow->sync_parameters(CHANGE_PARAMS);
347         mwindow->gui->flash_canvas(1);
348
349         return 0;
350 }
351
352
353 SampleZoomPanel::SampleZoomPanel(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
354  : ZoomPanel(mwindow, zoombar, mwindow->edl->local_session->zoom_sample,
355                 x, y, xS(130), MIN_ZOOM_TIME, MAX_ZOOM_TIME, ZOOM_TIME)
356 {
357         this->mwindow = mwindow;
358         this->zoombar = zoombar;
359 }
360 int SampleZoomPanel::handle_event()
361 {
362         mwindow->zoom_sample((int64_t)get_value());
363         return 1;
364 }
365
366
367 AmpZoomPanel::AmpZoomPanel(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
368  : ZoomPanel(mwindow, zoombar, mwindow->edl->local_session->zoom_y,
369                 x, y, xS(100), MIN_AMP_ZOOM, MAX_AMP_ZOOM, ZOOM_LONG)
370 {
371         this->mwindow = mwindow;
372         this->zoombar = zoombar;
373 }
374 int AmpZoomPanel::handle_event()
375 {
376         mwindow->zoom_amp((int64_t)get_value());
377         return 1;
378 }
379
380 TrackZoomPanel::TrackZoomPanel(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
381  : ZoomPanel(mwindow, zoombar, mwindow->edl->local_session->zoom_track,
382                 x, y, xS(90), MIN_TRACK_ZOOM, MAX_TRACK_ZOOM, ZOOM_LONG)
383 {
384         this->mwindow = mwindow;
385         this->zoombar = zoombar;
386 }
387 int TrackZoomPanel::handle_event()
388 {
389         mwindow->zoom_track((int64_t)get_value());
390         zoombar->amp_zoom->update(mwindow->edl->local_session->zoom_y);
391         return 1;
392 }
393
394
395
396
397 AutoZoom::AutoZoom(MWindow *mwindow, ZoomBar *zoombar, int x, int y, int changemax)
398  : BC_Tumbler(x, y, mwindow->theme->get_image_set("zoombar_tumbler"))
399 {
400         this->mwindow = mwindow;
401         this->zoombar = zoombar;
402         this->changemax = changemax;
403         if (changemax)
404                 set_tooltip(_("Automation range maximum"));
405         else
406                 set_tooltip(_("Automation range minimum"));
407 }
408
409 int AutoZoom::handle_up_event()
410 {
411         mwindow->change_currentautorange(mwindow->edl->local_session->zoombar_showautotype,1,changemax);
412
413         mwindow->gui->zoombar->update_autozoom();
414         mwindow->gui->draw_overlays(0);
415         mwindow->gui->update_patchbay();
416         mwindow->gui->flash_canvas(1);
417         return 1;
418 }
419
420 int AutoZoom::handle_down_event()
421 {
422         mwindow->change_currentautorange(mwindow->edl->local_session->zoombar_showautotype,0,changemax);
423
424         mwindow->gui->zoombar->update_autozoom();
425         mwindow->gui->draw_overlays(0);
426         mwindow->gui->update_patchbay();
427         mwindow->gui->flash_canvas(1);
428         return 1;
429 }
430
431
432
433 AutoTypeMenu::AutoTypeMenu(MWindow *mwindow, ZoomBar *zoombar, int x, int y, int wid)
434  : BC_PopupMenu(x, y, wid + xS(24),
435         to_text(mwindow->edl->local_session->zoombar_showautotype), 1, 0, 12)
436 {
437         this->mwindow = mwindow;
438         this->zoombar = zoombar;
439         set_tooltip(_("Automation Type"));
440 }
441
442 void AutoTypeMenu::create_objects()
443 {
444         add_item(new BC_MenuItem(to_text(AUTOGROUPTYPE_AUDIO_FADE)));
445         add_item(new BC_MenuItem(to_text(AUTOGROUPTYPE_VIDEO_FADE)));
446         add_item(new BC_MenuItem(to_text(AUTOGROUPTYPE_ZOOM)));
447         add_item(new BC_MenuItem(to_text(AUTOGROUPTYPE_SPEED)));
448         add_item(new BC_MenuItem(to_text(AUTOGROUPTYPE_X)));
449         add_item(new BC_MenuItem(to_text(AUTOGROUPTYPE_Y)));
450 }
451
452 const char* AutoTypeMenu::to_text(int mode)
453 {
454         switch(mode) {
455         case AUTOGROUPTYPE_AUDIO_FADE: return _("Audio Fade:");
456         case AUTOGROUPTYPE_VIDEO_FADE: return _("Video Fade:");
457         case AUTOGROUPTYPE_ZOOM: return _("Zoom:");
458         case AUTOGROUPTYPE_SPEED: return _("Speed:");
459         case AUTOGROUPTYPE_X: return "X:";
460         case AUTOGROUPTYPE_Y: return "Y:";
461         }
462         return "??";
463 }
464
465 int AutoTypeMenu::from_text(char *text)
466 {
467         if(!strcmp(text, to_text(AUTOGROUPTYPE_AUDIO_FADE))) return AUTOGROUPTYPE_AUDIO_FADE;
468         if(!strcmp(text, to_text(AUTOGROUPTYPE_VIDEO_FADE))) return AUTOGROUPTYPE_VIDEO_FADE;
469         if(!strcmp(text, to_text(AUTOGROUPTYPE_ZOOM))) return AUTOGROUPTYPE_ZOOM;
470         if(!strcmp(text, to_text(AUTOGROUPTYPE_SPEED))) return AUTOGROUPTYPE_SPEED;
471         if(!strcmp(text, to_text(AUTOGROUPTYPE_X))) return AUTOGROUPTYPE_X;
472         if(!strcmp(text, to_text(AUTOGROUPTYPE_Y))) return AUTOGROUPTYPE_Y;
473         return AUTOGROUPTYPE_INT255;
474 }
475
476 int AutoTypeMenu::draw_face(int dx, int color)
477 {
478         BC_PopupMenu::draw_face(dx+xS(8), color);
479         color = mwindow->edl->local_session->zoombar_showautocolor;
480         if( color >= 0 ) {
481                 set_color(color);
482                 int margin = get_margin();
483                 int mx = margin+xS(8), my = 3*margin/8;
484                 int bh = get_h() - 2*my;
485                 draw_box(mx,my, bh,bh);
486         }
487         return 1;
488 }
489
490 int AutoTypeMenu::handle_event()
491 {
492         mwindow->edl->local_session->zoombar_showautotype = from_text(this->get_text());
493         this->zoombar->update_autozoom();
494         return 1;
495 }
496
497
498 ZoomTextBox::ZoomTextBox(MWindow *mwindow, ZoomBar *zoombar, int x, int y, const char *text)
499  : BC_TextBox(x, y, xS(130), 1, text)
500 {
501         this->mwindow = mwindow;
502         this->zoombar = zoombar;
503         set_tooltip(_("Automation range"));
504 }
505
506 int ZoomTextBox::button_press_event()
507 {
508         if (!(get_buttonpress() == 4 || get_buttonpress() == 5)) {
509                 BC_TextBox::button_press_event();
510                 return 0;
511         }
512         if (!is_event_win()) return 0;
513
514         int changemax = 1;
515         if (get_relative_cursor_x() < get_w()/2)
516                 changemax = 0;
517
518         // increment
519         if (get_buttonpress() == 4)
520                 mwindow->change_currentautorange(mwindow->edl->local_session->zoombar_showautotype, 1, changemax);
521
522         // decrement
523         if (get_buttonpress() == 5)
524                 mwindow->change_currentautorange(mwindow->edl->local_session->zoombar_showautotype, 0, changemax);
525
526         mwindow->gui->zoombar->update_autozoom();
527         mwindow->gui->draw_overlays(0);
528         mwindow->gui->update_patchbay();
529         mwindow->gui->flash_canvas(1);
530         return 1;
531 }
532
533 int ZoomTextBox::handle_event()
534 {
535         float min, max;
536         if (sscanf(this->get_text(),"%f to%f",&min, &max) == 2)
537         {
538                 AUTOMATIONVIEWCLAMPS(min, mwindow->edl->local_session->zoombar_showautotype);
539                 AUTOMATIONVIEWCLAMPS(max, mwindow->edl->local_session->zoombar_showautotype);
540                 if (max > min)
541                 {
542                         mwindow->edl->local_session->automation_mins[mwindow->edl->local_session->zoombar_showautotype] = min;
543                         mwindow->edl->local_session->automation_maxs[mwindow->edl->local_session->zoombar_showautotype] = max;
544                         mwindow->gui->zoombar->update_autozoom();
545                         mwindow->gui->draw_overlays(0);
546                         mwindow->gui->update_patchbay();
547                         mwindow->gui->flash_canvas(1);
548                 }
549         }
550         // TODO: Make the text turn red when it's a bad range..
551         return 0;
552 }
553
554
555
556
557
558 FromTextBox::FromTextBox(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
559  : BC_TextBox(x, y, xS(90), 1, "")
560 {
561         this->mwindow = mwindow;
562         this->zoombar = zoombar;
563         set_tooltip(_("Selection start time"));
564 }
565
566 int FromTextBox::handle_event()
567 {
568         if(get_keypress() == NEWLINE)
569         {
570                 zoombar->set_selection(SET_FROM);
571                 return 1;
572         }
573         return 0;
574 }
575
576 int FromTextBox::update_position(double new_position)
577 {
578         Units::totext(string,
579                 new_position,
580                 mwindow->edl->session->time_format,
581                 mwindow->edl->session->sample_rate,
582                 mwindow->edl->session->frame_rate,
583                 mwindow->edl->session->frames_per_foot);
584 //printf("FromTextBox::update_position %f %s\n", new_position, string);
585         update(string);
586         return 0;
587 }
588
589
590
591
592
593
594 LengthTextBox::LengthTextBox(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
595  : BC_TextBox(x, y, xS(90), 1, "")
596 {
597         this->mwindow = mwindow;
598         this->zoombar = zoombar;
599         set_tooltip(_("Selection length"));
600 }
601
602 int LengthTextBox::handle_event()
603 {
604         if(get_keypress() == NEWLINE)
605         {
606                 zoombar->set_selection(SET_LENGTH);
607                 return 1;
608         }
609         return 0;
610 }
611
612 int LengthTextBox::update_position(double new_position)
613 {
614         Units::totext(string,
615                 new_position,
616                 mwindow->edl->session->time_format,
617                 mwindow->edl->session->sample_rate,
618                 mwindow->edl->session->frame_rate,
619                 mwindow->edl->session->frames_per_foot);
620         update(string);
621         return 0;
622 }
623
624
625
626
627
628 ToTextBox::ToTextBox(MWindow *mwindow, ZoomBar *zoombar, int x, int y)
629  : BC_TextBox(x, y, xS(90), 1, "")
630 {
631         this->mwindow = mwindow;
632         this->zoombar = zoombar;
633         set_tooltip(_("Selection end time"));
634 }
635
636 int ToTextBox::handle_event()
637 {
638         if(get_keypress() == NEWLINE)
639         {
640                 zoombar->set_selection(SET_TO);
641                 return 1;
642         }
643         return 0;
644 }
645
646 int ToTextBox::update_position(double new_position)
647 {
648         Units::totext(string, new_position,
649                 mwindow->edl->session->time_format,
650                 mwindow->edl->session->sample_rate,
651                 mwindow->edl->session->frame_rate,
652                 mwindow->edl->session->frames_per_foot);
653         update(string);
654         return 0;
655 }