5 #include "edlsession.h"
8 #include "localsession.h"
9 #include "mainsession.h"
12 #include "trackcanvas.h"
17 STrack::STrack(EDL *edl, Tracks *tracks)
20 data_type = TRACK_SUBTITLE;
28 // Used by PlaybackEngine
29 void STrack::synchronize_params(Track *track)
31 Track::synchronize_params(track);
34 int STrack::copy_settings(Track *track)
36 Track::copy_settings(track);
40 int STrack::load_defaults(BC_Hash *defaults)
42 Track::load_defaults(defaults);
46 void STrack::set_default_title()
48 Track *current = ListItem<Track>::list->first;
50 for(i = 0; current; current = NEXT)
52 if(current->data_type == TRACK_SUBTITLE) i++;
54 sprintf(title, _("Subttl %d"), i);
57 void STrack::create_objects()
59 Track::create_objects();
60 automation = new SAutomation(edl, this);
61 automation->create_objects();
62 edits = new SEdits(edl, this);
65 int STrack::vertical_span(Theme *theme)
67 int track_h = Track::vertical_span(theme);
69 return track_h + patch_h;
73 int64_t STrack::to_units(double position, int round)
77 return Units::round(position * edl->session->frame_rate);
81 // Kludge for rounding errors, just on a smaller scale than formal rounding
82 position *= edl->session->frame_rate;
83 return Units::to_int64(position);
87 double STrack::to_doubleunits(double position)
89 return position * edl->session->frame_rate;
93 double STrack::from_units(int64_t position)
95 return (double)position / edl->session->frame_rate;
101 int STrack::identical(int64_t sample1, int64_t sample2)
104 if(labs(sample1 - sample2) <= 1) return 1; else return 0;
107 int STrack::save_header(FileXML *file)
109 file->tag.set_property("TYPE", "SUBTTL");
113 int STrack::save_derived(FileXML *file)
115 file->append_newline();
119 int STrack::load_header(FileXML *file, uint32_t load_flags)
124 int STrack::load_derived(FileXML *file, uint32_t load_flags)
130 int STrack::get_dimensions(int pane_number,
135 view_start = edl->local_session->view_start[pane_number] * edl->session->frame_rate;
137 // view_units = Units::toframes(tracks->view_samples(), mwindow->session->sample_rate, mwindow->session->frame_rate);
138 zoom_units = edl->local_session->zoom_sample / edl->session->sample_rate * edl->session->frame_rate;
142 int64_t STrack::length()
144 return edits->length();
147 SEdit::SEdit(EDL *edl, Edits *edits)
160 copy_from(Edit *edit)
162 Edit::copy_from(edit);
163 SEdit *sedit = (SEdit*)edit;
164 strcpy(text,sedit->text);
167 int SEdit::load_properties_derived(FileXML *xml)
169 xml->tag.get_property("TEXT", text);
173 int SEdit::copy_properties_derived(FileXML *xml, int64_t length_in_selection)
175 xml->tag.set_property("TEXT", text);
180 int SEdit::dump_derived()
186 int64_t SEdit::get_source_end(int64_t default_)
188 return default_; // Infinity