Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mainclock.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2017 Adam Williams <broadcast at earthling dot net>
5  * Copyright (C) 2003-2016 Cinelerra CV contributors
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22
23 #include "edl.h"
24 #include "edlsession.h"
25 #include "fonts.h"
26 #include "mainclock.h"
27 #include "mwindow.h"
28 #include "theme.h"
29
30 MainClock::MainClock(MWindow *mwindow, int x, int y, int w)
31  : BC_Title(x, y, "", CLOCKFONT, //MEDIUM_7SEGMENT,
32         mwindow->theme->clock_fg_color, 0, w)
33 {
34         this->mwindow = mwindow;
35         position_offset = 0;
36         set_bg_color(mwindow->theme->clock_bg_color);
37 // *** CONTEXT_HELP ***
38         context_help_set_keyword("Time Format section");
39 }
40
41 MainClock::~MainClock()
42 {
43 }
44
45 void MainClock::set_position_offset(double value)
46 {
47         position_offset = value;
48 }
49
50 void MainClock::update(double position)
51 {
52         lock_window("MainClock::update");
53         char string[BCTEXTLEN];
54         position += position_offset;
55         double timecode_offset =
56                 mwindow->edl->session->time_format == TIME_TIMECODE ?
57                         mwindow->get_timecode_offset() : 0 ;
58         Units::totext(string, position,
59                 mwindow->edl->session->time_format,
60                 mwindow->edl->session->sample_rate,
61                 mwindow->edl->session->frame_rate,
62                 mwindow->edl->session->frames_per_foot,
63                 timecode_offset);
64         BC_Title::update(string);
65         unlock_window();
66 }
67
68 void MainClock::clear()
69 {
70         lock_window("MainClock::clear");
71         BC_Title::update("");
72         unlock_window();
73 }
74