1 #include "bcdisplayinfo.h"
5 #include "edlsession.h"
7 #include "mainsession.h"
8 #include "meterpanel.h"
10 #include "mwindowgui.h"
13 MainSession::MainSession(MWindow *mwindow)
15 this->mwindow = mwindow;
18 // playback_cursor_visible = 0;
19 // is_playing_back = 0;
20 track_highlighted = 0;
21 plugin_highlighted = 0;
22 pluginset_highlighted = 0;
23 vcanvas_highlighted = 0;
24 ccanvas_highlighted = 0;
26 current_operation = NO_OPERATION;
27 drag_pluginservers = new ArrayList<PluginServer*>;
29 drag_auto_gang = new ArrayList<Auto*>;
30 drag_clips = new ArrayList<EDL*>;
31 drag_edits = new ArrayList<Edit*>;
41 cwindow_fullscreen = 0;
42 rwindow_fullscreen = 0;
43 vwindow_fullscreen = 0;
46 MainSession::~MainSession()
48 delete drag_pluginservers;
49 delete drag_auto_gang;
54 void MainSession::boundaries()
56 lwindow_x = MAX(0, lwindow_x);
57 lwindow_y = MAX(0, lwindow_y);
58 mwindow_x = MAX(0, mwindow_x);
59 mwindow_y = MAX(0, mwindow_y);
60 cwindow_x = MAX(0, cwindow_x);
61 cwindow_y = MAX(0, cwindow_y);
62 vwindow_x = MAX(0, vwindow_x);
63 vwindow_y = MAX(0, vwindow_y);
64 awindow_x = MAX(0, awindow_x);
65 awindow_y = MAX(0, awindow_y);
66 gwindow_x = MAX(0, gwindow_x);
67 gwindow_y = MAX(0, gwindow_y);
68 rwindow_x = MAX(0, rwindow_x);
69 rwindow_y = MAX(0, rwindow_y);
70 rmonitor_x = MAX(0, rmonitor_x);
71 rmonitor_y = MAX(0, rmonitor_y);
72 cwindow_controls = CLIP(cwindow_controls, 0, 1);
75 void MainSession::default_window_positions()
77 // Get defaults based on root window size
78 BC_DisplayInfo display_info;
82 int root_w = display_info.get_root_w();
83 int root_h = display_info.get_root_h();
87 int border_bottom = 0;
89 border_left = display_info.get_left_border();
90 border_top = display_info.get_top_border();
91 border_right = display_info.get_right_border();
92 border_bottom = display_info.get_bottom_border();
94 // Wider than 16:9, narrower than dual head
95 if((float)root_w / root_h > 1.8) root_w /= 2;
101 vwindow_w = root_w / 2 - border_left - border_right;
102 vwindow_h = root_h * 6 / 10 - border_top - border_bottom;
104 cwindow_x = root_x + root_w / 2;
106 cwindow_w = vwindow_w;
107 cwindow_h = vwindow_h;
109 ctool_x = cwindow_x + cwindow_w / 2;
110 ctool_y = cwindow_y + cwindow_h / 2;
113 mwindow_y = vwindow_y + vwindow_h + border_top + border_bottom;
114 mwindow_w = root_w * 2 / 3 - border_left - border_right;
115 mwindow_h = root_h - mwindow_y - border_top - border_bottom;
117 awindow_x = mwindow_x + border_left + border_right + mwindow_w;
118 awindow_y = mwindow_y;
119 awindow_w = root_x + root_w - awindow_x - border_left - border_right;
120 awindow_h = mwindow_h;
126 lwindow_w = MeterPanel::get_meters_width(mwindow->edl->session->audio_channels, 1);
131 lwindow_x = root_w - lwindow_w;
132 lwindow_h = mwindow_y;
139 rmonitor_x = rwindow_x + rwindow_w + 10;
140 rmonitor_y = rwindow_y;
141 rmonitor_w = root_w - rmonitor_x;
142 rmonitor_h = rwindow_h;
146 batchrender_x = root_w / 2 - batchrender_w / 2;
147 batchrender_y = root_h / 2 - batchrender_h / 2;
150 int MainSession::load_defaults(BC_Hash *defaults)
152 // Setup main windows
153 default_window_positions();
154 vwindow_x = defaults->get("VWINDOW_X", vwindow_x);
155 vwindow_y = defaults->get("VWINDOW_Y", vwindow_y);
156 vwindow_w = defaults->get("VWINDOW_W", vwindow_w);
157 vwindow_h = defaults->get("VWINDOW_H", vwindow_h);
160 cwindow_x = defaults->get("CWINDOW_X", cwindow_x);
161 cwindow_y = defaults->get("CWINDOW_Y", cwindow_y);
162 cwindow_w = defaults->get("CWINDOW_W", cwindow_w);
163 cwindow_h = defaults->get("CWINDOW_H", cwindow_h);
165 ctool_x = defaults->get("CTOOL_X", ctool_x);
166 ctool_y = defaults->get("CTOOL_Y", ctool_y);
168 gwindow_x = defaults->get("GWINDOW_X", gwindow_x);
169 gwindow_y = defaults->get("GWINDOW_Y", gwindow_y);
171 mwindow_x = defaults->get("MWINDOW_X", mwindow_x);
172 mwindow_y = defaults->get("MWINDOW_Y", mwindow_y);
173 mwindow_w = defaults->get("MWINDOW_W", mwindow_w);
174 mwindow_h = defaults->get("MWINDOW_H", mwindow_h);
176 lwindow_x = defaults->get("LWINDOW_X", lwindow_x);
177 lwindow_y = defaults->get("LWINDOW_Y", lwindow_y);
178 lwindow_w = defaults->get("LWINDOW_W", lwindow_w);
179 lwindow_h = defaults->get("LWINDOW_H", lwindow_h);
182 awindow_x = defaults->get("AWINDOW_X", awindow_x);
183 awindow_y = defaults->get("AWINDOW_Y", awindow_y);
184 awindow_w = defaults->get("AWINDOW_W", awindow_w);
185 awindow_h = defaults->get("AWINDOW_H", awindow_h);
187 ewindow_w = defaults->get("EWINDOW_W", ewindow_w);
188 ewindow_h = defaults->get("EWINDOW_H", ewindow_h);
190 //printf("MainSession::load_defaults 1\n");
193 afolders_w = defaults->get("ABINS_W", 100);
194 rwindow_x = defaults->get("RWINDOW_X", rwindow_x);
195 rwindow_y = defaults->get("RWINDOW_Y", rwindow_y);
196 rwindow_w = defaults->get("RWINDOW_W", rwindow_w);
197 rwindow_h = defaults->get("RWINDOW_H", rwindow_h);
199 rmonitor_x = defaults->get("RMONITOR_X", rmonitor_x);
200 rmonitor_y = defaults->get("RMONITOR_Y", rmonitor_y);
201 rmonitor_w = defaults->get("RMONITOR_W", rmonitor_w);
202 rmonitor_h = defaults->get("RMONITOR_H", rmonitor_h);
204 batchrender_x = defaults->get("BATCHRENDER_X", batchrender_x);
205 batchrender_y = defaults->get("BATCHRENDER_Y", batchrender_y);
206 batchrender_w = defaults->get("BATCHRENDER_W", batchrender_w);
207 batchrender_h = defaults->get("BATCHRENDER_H", batchrender_h);
209 show_vwindow = defaults->get("SHOW_VWINDOW", 1);
210 show_awindow = defaults->get("SHOW_AWINDOW", 1);
211 show_cwindow = defaults->get("SHOW_CWINDOW", 1);
212 show_lwindow = defaults->get("SHOW_LWINDOW", 0);
213 show_gwindow = defaults->get("SHOW_GWINDOW", 0);
215 cwindow_controls = defaults->get("CWINDOW_CONTROLS", cwindow_controls);
217 plugindialog_w = defaults->get("PLUGINDIALOG_W", 510);
218 plugindialog_h = defaults->get("PLUGINDIALOG_H", 415);
219 menueffect_w = defaults->get("MENUEFFECT_W", 580);
220 menueffect_h = defaults->get("MENUEFFECT_H", 350);
222 current_tip = defaults->get("CURRENT_TIP", current_tip);
228 int MainSession::save_defaults(BC_Hash *defaults)
232 defaults->update("MWINDOW_X", mwindow_x);
233 defaults->update("MWINDOW_Y", mwindow_y);
234 defaults->update("MWINDOW_W", mwindow_w);
235 defaults->update("MWINDOW_H", mwindow_h);
237 defaults->update("LWINDOW_X", lwindow_x);
238 defaults->update("LWINDOW_Y", lwindow_y);
239 defaults->update("LWINDOW_W", lwindow_w);
240 defaults->update("LWINDOW_H", lwindow_h);
242 defaults->update("VWINDOW_X", vwindow_x);
243 defaults->update("VWINDOW_Y", vwindow_y);
244 defaults->update("VWINDOW_W", vwindow_w);
245 defaults->update("VWINDOW_H", vwindow_h);
247 defaults->update("CWINDOW_X", cwindow_x);
248 defaults->update("CWINDOW_Y", cwindow_y);
249 defaults->update("CWINDOW_W", cwindow_w);
250 defaults->update("CWINDOW_H", cwindow_h);
252 defaults->update("CTOOL_X", ctool_x);
253 defaults->update("CTOOL_Y", ctool_y);
255 defaults->update("GWINDOW_X", gwindow_x);
256 defaults->update("GWINDOW_Y", gwindow_y);
258 defaults->update("AWINDOW_X", awindow_x);
259 defaults->update("AWINDOW_Y", awindow_y);
260 defaults->update("AWINDOW_W", awindow_w);
261 defaults->update("AWINDOW_H", awindow_h);
263 defaults->update("EWINDOW_W", ewindow_w);
264 defaults->update("EWINDOW_H", ewindow_h);
266 defaults->update("ABINS_W", afolders_w);
268 defaults->update("RMONITOR_X", rmonitor_x);
269 defaults->update("RMONITOR_Y", rmonitor_y);
270 defaults->update("RMONITOR_W", rmonitor_w);
271 defaults->update("RMONITOR_H", rmonitor_h);
273 defaults->update("RWINDOW_X", rwindow_x);
274 defaults->update("RWINDOW_Y", rwindow_y);
275 defaults->update("RWINDOW_W", rwindow_w);
276 defaults->update("RWINDOW_H", rwindow_h);
278 defaults->update("BATCHRENDER_X", batchrender_x);
279 defaults->update("BATCHRENDER_Y", batchrender_y);
280 defaults->update("BATCHRENDER_W", batchrender_w);
281 defaults->update("BATCHRENDER_H", batchrender_h);
283 defaults->update("SHOW_VWINDOW", show_vwindow);
284 defaults->update("SHOW_AWINDOW", show_awindow);
285 defaults->update("SHOW_CWINDOW", show_cwindow);
286 defaults->update("SHOW_LWINDOW", show_lwindow);
287 defaults->update("SHOW_GWINDOW", show_gwindow);
289 defaults->update("CWINDOW_CONTROLS", cwindow_controls);
291 defaults->update("PLUGINDIALOG_W", plugindialog_w);
292 defaults->update("PLUGINDIALOG_H", plugindialog_h);
294 defaults->update("MENUEFFECT_W", menueffect_w);
295 defaults->update("MENUEFFECT_H", menueffect_h);
297 defaults->update("CURRENT_TIP", current_tip);
305 // c-file-style: "linux"