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;
21 data_h = edl->local_session->zoom_atrack;
29 // Used by PlaybackEngine
30 void STrack::synchronize_params(Track *track)
32 Track::synchronize_params(track);
35 int STrack::copy_settings(Track *track)
37 Track::copy_settings(track);
41 int STrack::load_defaults(BC_Hash *defaults)
43 Track::load_defaults(defaults);
47 void STrack::set_default_title()
49 Track *current = ListItem<Track>::list->first;
51 for(i = 0; current; current = NEXT)
53 if(current->data_type == TRACK_SUBTITLE) i++;
55 sprintf(title, _("Subttl %d"), i);
58 void STrack::create_objects()
60 Track::create_objects();
61 automation = new SAutomation(edl, this);
62 automation->create_objects();
63 edits = new SEdits(edl, this);
66 int STrack::vertical_span(Theme *theme)
68 int track_h = Track::vertical_span(theme);
69 int patch_h = theme->title_h;
71 patch_h += theme->play_h;
72 return MAX(track_h, patch_h);
76 int64_t STrack::to_units(double position, int round)
80 return Units::round(position * edl->session->frame_rate);
84 // Kludge for rounding errors, just on a smaller scale than formal rounding
85 position *= edl->session->frame_rate;
86 return Units::to_int64(position);
90 double STrack::to_doubleunits(double position)
92 return position * edl->session->frame_rate;
96 double STrack::from_units(int64_t position)
98 return (double)position / edl->session->frame_rate;
104 int STrack::identical(int64_t sample1, int64_t sample2)
107 if(labs(sample1 - sample2) <= 1) return 1; else return 0;
110 int STrack::save_header(FileXML *file)
112 file->tag.set_property("TYPE", "SUBTTL");
116 int STrack::save_derived(FileXML *file)
118 file->append_newline();
122 int STrack::load_header(FileXML *file, uint32_t load_flags)
127 int STrack::load_derived(FileXML *file, uint32_t load_flags)
133 int STrack::get_dimensions(int pane_number,
138 view_start = edl->local_session->view_start[pane_number] * edl->session->frame_rate;
140 // view_units = Units::toframes(tracks->view_samples(), mwindow->session->sample_rate, mwindow->session->frame_rate);
141 zoom_units = edl->local_session->zoom_sample / edl->session->sample_rate * edl->session->frame_rate;
145 int64_t STrack::length()
147 return edits->length();
150 SEdit::SEdit(EDL *edl, Edits *edits)
163 copy_from(Edit *edit)
165 Edit::copy_from(edit);
166 SEdit *sedit = (SEdit*)edit;
167 strcpy(text,sedit->text);
170 int SEdit::load_properties_derived(FileXML *xml)
172 xml->tag.get_property("TEXT", text);
176 int SEdit::copy_properties_derived(FileXML *xml, int64_t length_in_selection)
178 xml->tag.set_property("TEXT", text);
183 int SEdit::dump_derived()
189 int64_t SEdit::get_source_end(int64_t default_)
191 return default_; // Infinity