initial commit
[goodguy/history.git] / cinelerra-5.0 / cinelerra / localsession.h
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 #ifndef LOCALSESSION_H
23 #define LOCALSESSION_H
24
25 #include "bcwindowbase.inc"
26 #include "bchash.inc"
27 #include "edl.inc"
28 #include "filexml.inc"
29 #include "mwindowgui.inc"
30
31
32 // Unique session for every EDL
33
34 class LocalSession
35 {
36 public:
37         LocalSession(EDL *edl);
38         ~LocalSession();
39
40
41 // Get selected range based on precidence of in/out points and
42 // highlighted region.
43 // 1) If a highlighted selection exists it's used.
44 // 2) If in_point or out_point exists they're used.
45 // 3) If no in/out points exist, the insertion point is returned.
46 // highlight_only - forces it to use highlighted region only.
47         double get_selectionstart(int highlight_only = 0);
48         double get_selectionend(int highlight_only = 0);
49         double get_inpoint();
50         double get_outpoint();
51         int inpoint_valid();
52         int outpoint_valid();
53         void set_selectionstart(double value);
54         void set_selectionend(double value);
55         void set_inpoint(double value);
56         void set_outpoint(double value);
57         void unset_inpoint();
58         void unset_outpoint();
59
60
61         void copy_from(LocalSession *that);
62         void save_xml(FileXML *file, double start);
63         void load_xml(FileXML *file, unsigned long load_flags);
64         int load_defaults(BC_Hash *defaults);
65         int save_defaults(BC_Hash *defaults);
66 // Used to copy parameters that affect rendering.
67         void synchronize_params(LocalSession *that);
68
69         void boundaries();
70
71
72         EDL *edl;
73
74
75 // Variables specific to each EDL
76 // Number of samples if pasted from a clipboard.
77 // If 0 use longest track
78         double clipboard_length;
79 // Title if clip
80         char clip_title[BCTEXTLEN];
81         char clip_notes[BCTEXTLEN];
82 // Folder in parent EDL of clip
83         char folder[BCTEXTLEN];
84
85         int loop_playback;
86         double loop_start;
87         double loop_end;
88
89
90
91 // Vertical start of track view in pixels
92         int64_t track_start[TOTAL_PANES];
93 // Horizontal start of view in pixels.  This has to be pixels since either
94 // samples or seconds would require drawing in fractional pixels.
95         int64_t view_start[TOTAL_PANES];
96 // position of pane dividers or -1 if none
97         int x_pane;
98         int y_pane;
99
100
101 // Zooming of the timeline.  Number of samples per pixel.  
102         int64_t zoom_sample;
103 // Amplitude zoom
104         int64_t zoom_y;
105 // Track zoom
106         int64_t zoom_track;
107 // Vertical automation scale
108         float automation_min;
109         float automation_max;
110 // Default type of float keyframe
111         int floatauto_type;
112
113 // Eye dropper
114         float red, green, blue;
115
116         double preview_start;
117         double preview_end;
118
119 private:
120 // The reason why selection ranges and inpoints have to be separate:
121 // The selection position has to change to set new in points.
122 // For editing functions we have a precidence for what determines
123 // the selection.
124
125         double selectionstart, selectionend;
126         double in_point, out_point;
127 };
128
129 #endif