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
23 #include "edlsession.h"
28 IntAuto::IntAuto(EDL *edl, IntAutos *autos)
29 : Auto(edl, (Autos*)autos)
38 int IntAuto::operator==(Auto &that)
40 return identical((IntAuto*)&that);
43 int IntAuto::operator==(IntAuto &that)
45 return identical((IntAuto*)&that);
48 int IntAuto::identical(IntAuto *that)
50 return that->value == value;
53 void IntAuto::load(FileXML *file)
55 value = file->tag.get_property("VALUE", value);
56 //printf("IntAuto::load 1 %d\n", value);
59 void IntAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
61 file->tag.set_title("AUTO");
63 file->tag.set_property("POSITION", 0);
65 file->tag.set_property("POSITION", position - start);
66 file->tag.set_property("VALUE", value);
68 file->tag.set_title("/AUTO");
70 file->append_newline();
74 void IntAuto::copy_from(Auto *that)
76 copy_from((IntAuto*)that);
77 //printf("IntAuto::copy_from(Auto *that) %d\n", value);
80 void IntAuto::copy_from(IntAuto *that)
82 //printf("IntAuto::copy_from(IntAuto *that) %d %d\n", value, that->value);
83 Auto::copy_from(that);
84 this->value = that->value;
87 int IntAuto::percentage_to_value(float percentage)
89 return percentage > .5;