prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / cinelerra / intauto.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  * 
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.
10  * 
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.
15  * 
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
19  * 
20  */
21
22 #include "edl.h"
23 #include "edlsession.h"
24 #include "filexml.h"
25 #include "intauto.h"
26 #include "intautos.h"
27
28 IntAuto::IntAuto(EDL *edl, IntAutos *autos)
29  : Auto(edl, (Autos*)autos)
30 {
31         value = 0;
32 }
33
34 IntAuto::~IntAuto()
35 {
36 }
37
38 int IntAuto::operator==(Auto &that)
39 {
40         return identical((IntAuto*)&that);
41 }
42
43 int IntAuto::operator==(IntAuto &that)
44 {
45         return identical((IntAuto*)&that);
46 }
47
48 int IntAuto::identical(IntAuto *that)
49 {
50         return that->value == value;
51 }
52
53 void IntAuto::load(FileXML *file)
54 {
55         value = file->tag.get_property("VALUE", value);
56 //printf("IntAuto::load 1 %d\n", value);
57 }
58
59 void IntAuto::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
60 {
61         file->tag.set_title("AUTO");
62         if(default_auto)
63                 file->tag.set_property("POSITION", 0);
64         else
65                 file->tag.set_property("POSITION", position - start);
66         file->tag.set_property("VALUE", value);
67         file->append_tag();
68         file->append_newline();
69 }
70
71
72 void IntAuto::copy_from(Auto *that)
73 {
74         copy_from((IntAuto*)that);
75 //printf("IntAuto::copy_from(Auto *that) %d\n", value);
76 }
77
78 void IntAuto::copy_from(IntAuto *that)
79 {
80 //printf("IntAuto::copy_from(IntAuto *that) %d %d\n", value, that->value);
81         Auto::copy_from(that);
82         this->value = that->value;
83 }
84
85 float IntAuto::value_to_percentage()
86 {
87 // Only used for toggles so this should work.
88         return (float)value;
89 }
90
91 int IntAuto::percentage_to_value(float percentage)
92 {
93         return percentage > .5;
94 }
95
96