4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
30 #include "filexml.inc"
32 #include "mwindow.inc"
33 #include "recordlabel.inc"
34 #include "stringfile.inc"
35 #include "timebar.inc"
39 class LabelToggle : public BC_Label
42 LabelToggle(MWindow *mwindow, Label *label, int x, int y, long position);
50 class Label : public ListItem<Label>
53 Label(EDL *edl, Labels *labels, double position, const char *textstr=0);
60 char textstr[BCTEXTLEN];
66 class Labels : public List<Label>
69 Labels(EDL *edl, const char *xml_tag);
72 void dump(FILE *fp=stdout);
74 Labels& operator=(Labels &that);
75 void copy_from(Labels *labels);
76 int toggle_label(double start, double end);
78 int save(FileXML *xml);
79 int load(FileXML *xml, uint32_t load_flags);
80 void insert_labels(Labels *labels,
83 int paste_silence = 1);
84 // Always add label without toggling
85 void insert_label(double position);
87 int modify_handles(double oldposition, double newposition, int currentend);
88 int copy(double start, double end, FileXML *xml);
89 int copy_length(long start, long end); // return number of Labels in selection
90 Label *add_label(double position);
91 int insert(double start, double length);
92 int paste(long start, long end, long total_length, FileXML *xml);
93 int paste_output(long startproject, long endproject, long startsource, long endsource, RecordLabels *labels);
94 // Setting follow to 1 causes labels to move forward after clear.
95 // Setting it to 0 implies ignoring the labels follow edits setting.
96 int clear(double start, double end, int follow = 1);
97 int paste_silence(double start, double end);
98 int optimize(); // delete duplicates
99 // Get nearest labels or 0 if start or end of timeline
100 Label* prev_label(double position);
101 Label* next_label(double position);
102 Label* get_label(int id);
104 Label* label_of(double position); // first label on or after position