r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / toggleautos.C
blob6af399967cfec12ed7e693c087e45abeb5df0add
1 #include "filexml.h"
2 #include "intauto.h"
3 #include "intautos.h"
5 #define MINSTACKHEIGHT 16
7 IntAutos::IntAutos(Track *track, 
8                         int color, 
9                         int default_,
10                         int stack_number, 
11                         int stack_total)
12  : Autos(track, color, default_, stack_number, stack_total)
14 // 1 is on            -1 is off
15         this->max = 1; this->min = -1;
16         this->virtual_h = 100;
19 IntAutos::~IntAutos()
23 int IntAutos::slope_adjustment(int64_t ax, float slope)
25         return 0;
28 int IntAutos::get_track_pixels(int zoom_track, int pixel, int &center_pixel, float &yscale)
30         if(zoom_track < MINSTACKHEIGHT)
31         {
32                 center_pixel = pixel + zoom_track / 2;
33                 yscale = -(float)zoom_track / (max - min) * .75;
34         }
35         else
36         if(zoom_track / stack_total < MINSTACKHEIGHT)
37         {
38                 center_pixel = pixel + MINSTACKHEIGHT / 2 + (stack_number * MINSTACKHEIGHT % zoom_track) * zoom_track;
39                 yscale = -(float)MINSTACKHEIGHT / (max - min) * .75;
40         }
41         else
42         {
43                 center_pixel = pixel + (zoom_track / stack_total) / 2 + (zoom_track / stack_total) * stack_number;
44                 yscale = -(float)(zoom_track / stack_total) / (max - min) * .75;
45         }
48 int IntAutos::draw_joining_line(BC_SubWindow *canvas, int vertical, int center_pixel, int x1, int y1, int x2, int y2)
50         if(vertical)
51         canvas->draw_line(center_pixel - y1, x1, center_pixel - y1, x2);
52         else
53         canvas->draw_line(x1, center_pixel + y1, x2, center_pixel + y1);
54         
55         if(y1 != y2)
56         {
57                 if(vertical)
58                 canvas->draw_line(center_pixel - y1, x2, center_pixel - y2, x2);
59                 else
60                 canvas->draw_line(x2, center_pixel + y1, x2, center_pixel + y2);
61         }
65 Auto* IntAutos::add_auto(int64_t position, float value)
67         IntAuto* current = (IntAuto*)autoof(position);
68         IntAuto* new_auto;
69         
70         insert_before(current, new_auto = new IntAuto(this));
72         new_auto->position = position;
73         new_auto->value = value;
74         
75         return new_auto;
79 Auto* IntAutos::append_auto()
81         return append(new IntAuto(this));
85 float IntAutos::fix_value(float value)
87         if(value >= 0) value = 1;
88         else
89         if(value < 0) value = -1;
90         return value;   
93 int IntAutos::get_testy(float slope, int cursor_x, int ax, int ay)
95         return ay;
98 int IntAutos::dump()