Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / labels.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 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 #ifndef LABEL_H
24 #define LABEL_H
25
26 #include <stdio.h>
27 #include <stdint.h>
28
29 #include "edl.inc"
30 #include "guicast.h"
31 #include "filexml.inc"
32 #include "labels.inc"
33 #include "mwindow.inc"
34 #include "recordlabel.inc"
35 #include "stringfile.inc"
36 #include "timebar.inc"
37
38 #define LABELSIZE 15
39
40 class LabelToggle : public BC_Label
41 {
42 public:
43         LabelToggle(MWindow *mwindow, Label *label, int x, int y, long position);
44         ~LabelToggle();
45
46         int handle_event();
47         MWindow *mwindow;
48         Label *label;
49 };
50
51 class Label : public ListItem<Label>
52 {
53 public:
54         Label(EDL *edl, Labels *labels, double position, const char *textstr=0);
55         Label();
56         ~Label();
57
58
59         EDL *edl;
60         Labels *labels;
61         char textstr[BCTEXTLEN];
62 // Seconds
63         double position;
64         int id, orig_id;
65 };
66
67 class Labels : public List<Label>
68 {
69 public:
70         Labels(EDL *edl, const char *xml_tag);
71         virtual ~Labels();
72
73         void dump(FILE *fp=stdout);
74
75         Labels& operator=(Labels &that);
76         void copy_from(Labels *labels);
77         int toggle_label(double start, double end);
78         int delete_all();
79         int save(FileXML *xml);
80         int load(FileXML *xml, uint32_t load_flags);
81         void insert_labels(Labels *labels,
82                 double start,
83                 double length,
84                 int paste_silence = 1);
85 // Always add label without toggling
86         void insert_label(double position);
87
88         int modify_handles(double oldposition, double newposition, int currentend);
89         int copy(double start, double end, FileXML *xml);
90         int copy_length(long start, long end); // return number of Labels in selection
91         Label *add_label(double position);
92         int insert(double start, double length);
93         int paste(long start, long end, long total_length, FileXML *xml);
94         int paste_output(long startproject, long endproject, long startsource, long endsource, RecordLabels *labels);
95 // Setting follow to 1 causes labels to move forward after clear.
96 // Setting it to 0 implies ignoring the labels follow edits setting.
97         int clear(double start, double end, int follow = 1);
98         int paste_silence(double start, double end);
99         int optimize();  // delete duplicates
100 // Get nearest labels or 0 if start or end of timeline
101         Label* prev_label(double position);
102         Label* next_label(double position);
103         Label* get_label(int id);
104
105         Label* label_of(double position); // first label on or after position
106         TimeBar *timebar;
107         EDL *edl;
108         const char *xml_tag;
109 };
110
111 #endif