00001 #include "edl.h" 00002 #include "edlsession.h" 00003 #include "filexml.h" 00004 #include "intauto.h" 00005 #include "intautos.h" 00006 00007 IntAuto::IntAuto(EDL *edl, IntAutos *autos) 00008 : Auto(edl, (Autos*)autos) 00009 { 00010 value = 0; 00011 } 00012 00013 IntAuto::~IntAuto() 00014 { 00015 } 00016 00017 int IntAuto::operator==(Auto &that) 00018 { 00019 return identical((IntAuto*)&that); 00020 } 00021 00022 int IntAuto::operator==(IntAuto &that) 00023 { 00024 return identical((IntAuto*)&that); 00025 } 00026 00027 int IntAuto::identical(IntAuto *that) 00028 { 00029 return that->value == value; 00030 } 00031 00032 void IntAuto::load(FileXML *file) 00033 { 00034 value = file->tag.get_property("VALUE", value); 00035 //printf("IntAuto::load 1 %d\n", value); 00036 } 00037 00038 void IntAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto) 00039 { 00040 file->tag.set_title("AUTO"); 00041 if(default_auto) 00042 file->tag.set_property("POSITION", 0); 00043 else 00044 file->tag.set_property("POSITION", position - start); 00045 file->tag.set_property("VALUE", value); 00046 file->append_tag(); 00047 file->tag.set_title("/AUTO"); 00048 file->append_tag(); 00049 file->append_newline(); 00050 } 00051 00052 00053 void IntAuto::copy_from(Auto *that) 00054 { 00055 copy_from((IntAuto*)that); 00056 //printf("IntAuto::copy_from(Auto *that) %d\n", value); 00057 } 00058 00059 void IntAuto::copy_from(IntAuto *that) 00060 { 00061 //printf("IntAuto::copy_from(IntAuto *that) %d %d\n", value, that->value); 00062 Auto::copy_from(that); 00063 this->value = that->value; 00064 } 00065 00066 float IntAuto::value_to_percentage() 00067 { 00068 // Only used for toggles so this should work. 00069 return (float)value; 00070 } 00071 00072 int IntAuto::percentage_to_value(float percentage) 00073 { 00074 return percentage > .5; 00075 } 00076 00077
1.4.4