4 * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
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.
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.
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
22 #include "androidcontrol.h"
23 #include "awindowgui.h"
25 #include "bcdisplayinfo.h"
27 #include "bcsignals.h"
28 #include "cwindowgui.h"
30 #include "channelinfo.h"
33 #include "editpopup.h"
36 #include "edlsession.h"
37 #include "filesystem.h"
38 #include "keyframepopup.h"
41 #include "localsession.h"
42 #include "mainclock.h"
43 #include "maincursor.h"
45 #include "mainsession.h"
49 #include "mwindowgui.h"
51 #include "panedividers.h"
54 #include "pluginpopup.h"
55 #include "pluginset.h"
57 #include "recordgui.h"
58 #include "renderengine.h"
59 #include "resourcethread.h"
60 #include "samplescroll.h"
61 #include "shbtnprefs.h"
62 #include "statusbar.h"
65 #include "trackcanvas.h"
66 #include "trackscroll.h"
68 #include "transitionpopup.h"
69 #include "vwindowgui.h"
73 #define PANE_DRAG_MARGIN 50
76 // the main window uses its own private colormap for video
77 MWindowGUI::MWindowGUI(MWindow *mwindow)
78 : BC_Window(_(PROGRAM_NAME ": Program"),
79 mwindow->session->mwindow_x,
80 mwindow->session->mwindow_y,
81 mwindow->session->mwindow_w,
82 mwindow->session->mwindow_h,
89 this->mwindow = mwindow;
96 focused_pane = TOP_LEFT_PANE;
105 for(int i = 0; i < TOTAL_PANES; i++)
122 cwindow_remote_handler = 0;
123 record_remote_handler = 0;
128 MWindowGUI::~MWindowGUI()
130 delete android_control;
131 delete cwindow_remote_handler;
132 delete record_remote_handler;
133 delete remote_control;
134 // delete samplescroll;
135 // delete trackscroll;
136 for(int i = 0; i < TOTAL_PANES; i++)
137 if(pane[i]) delete pane[i];
139 delete render_engine;
140 delete resource_thread;
141 resource_pixmaps.remove_all_objects();
150 void MWindowGUI::get_scrollbars(int flush)
152 //int64_t h_needed = mwindow->edl->get_tracks_height(mwindow->theme);
153 //int64_t w_needed = mwindow->edl->get_tracks_width();
154 int need_xscroll = 0;
155 int need_yscroll = 0;
156 view_w = mwindow->theme->mcanvas_w;
157 view_h = mwindow->theme->mcanvas_h;
159 // Scrollbars are constitutive
160 need_xscroll = need_yscroll = 1;
161 view_h = mwindow->theme->mcanvas_h;
162 view_w = mwindow->theme->mcanvas_w;
164 // for(int i = 0; i < 2; i++)
166 // if(w_needed > view_w)
169 // view_h = mwindow->theme->mcanvas_h - SCROLL_SPAN;
174 // if(h_needed > view_h)
177 // view_w = mwindow->theme->mcanvas_w - SCROLL_SPAN;
182 //printf("MWindowGUI::get_scrollbars 1\n");
184 if(canvas && (view_w != canvas->get_w() || view_h != canvas->get_h()))
186 canvas->reposition_window(mwindow->theme->mcanvas_x,
187 mwindow->theme->mcanvas_y,
195 add_subwindow(samplescroll = new SampleScroll(mwindow,
197 mwindow->theme->mhscroll_x,
198 mwindow->theme->mhscroll_y,
199 mwindow->theme->mhscroll_w));
201 samplescroll->resize_event();
203 samplescroll->set_position(0);
207 if(samplescroll) delete samplescroll;
209 mwindow->edl->local_session->view_start = 0;
215 //printf("MWindowGUI::get_scrollbars 1.1 %p %p\n", this, canvas);
217 add_subwindow(trackscroll = new TrackScroll(mwindow,
219 mwindow->theme->mvscroll_x,
220 mwindow->theme->mvscroll_y,
221 mwindow->theme->mvscroll_h));
223 trackscroll->resize_event();
226 //printf("MWindowGUI::get_scrollbars 1.2\n");
227 trackscroll->update_length(mwindow->edl->get_tracks_height(mwindow->theme),
228 mwindow->edl->local_session->track_start,
231 //printf("MWindowGUI::get_scrollbars 1.3\n");
235 if(trackscroll) delete trackscroll;
237 mwindow->edl->local_session->track_start = 0;
240 if(flush) this->flush();
245 void MWindowGUI::create_objects()
249 resource_thread = new ResourceThread(mwindow, this);
250 resource_thread->create_objects();
253 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
254 set_icon(mwindow->theme->get_image("mwindow_icon"));
255 remote_control = new RemoteControl(this);
256 cwindow_remote_handler = new CWindowRemoteHandler(remote_control);
257 record_remote_handler = new RecordRemoteHandler(remote_control);
258 mwindow->reset_android_remote();
260 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
262 int x = get_w() - MainShBtns::calculate_w(0);
263 add_subwindow(mainmenu = new MainMenu(mwindow, this, x));
264 add_subwindow(mainshbtns = new MainShBtns(mwindow, x, 0));
265 mainshbtns->load(mwindow->preferences);
266 mwindow->theme->get_mwindow_sizes(this, get_w(), get_h());
267 mwindow->theme->draw_mwindow_bg(this);
268 mainmenu->create_objects();
269 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
271 add_subwindow(mbuttons = new MButtons(mwindow, this));
272 mbuttons->create_objects();
274 pane[TOP_LEFT_PANE] = new TimelinePane(mwindow,
276 mwindow->theme->mcanvas_x,
277 mwindow->theme->mcanvas_y,
278 mwindow->theme->mcanvas_w,
279 mwindow->theme->mcanvas_h);
280 pane[TOP_LEFT_PANE]->create_objects();
282 // add_subwindow(timebar = new MTimeBar(mwindow,
284 // mwindow->theme->mtimebar_x,
285 // mwindow->theme->mtimebar_y,
286 // mwindow->theme->mtimebar_w,
287 // mwindow->theme->mtimebar_h));
288 // timebar->create_objects();
290 // if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
291 // add_subwindow(patchbay = new PatchBay(mwindow, this));
292 // patchbay->create_objects();
294 // if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
295 // get_scrollbars(0);
297 // if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
298 // mwindow->gui->add_subwindow(canvas = new TrackCanvas(mwindow, this));
299 // canvas->create_objects();
302 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
303 add_subwindow(zoombar = new ZoomBar(mwindow, this));
304 zoombar->create_objects();
307 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
308 add_subwindow(statusbar = new StatusBar(mwindow, this));
309 statusbar->create_objects();
313 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
314 add_subwindow(mainclock = new MainClock(mwindow,
315 mwindow->theme->mclock_x,
316 mwindow->theme->mclock_y,
317 mwindow->theme->mclock_w));
318 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
319 mainclock->update(0);
323 // if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
324 // cursor = new MainCursor(mwindow, this);
325 // cursor->create_objects();
328 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
329 add_subwindow(edit_menu = new EditPopup(mwindow, this));
330 edit_menu->create_objects();
333 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
334 add_subwindow(plugin_menu = new PluginPopup(mwindow, this));
335 plugin_menu->create_objects();
338 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
339 add_subwindow(keyframe_menu = new KeyframePopup(mwindow, this));
340 keyframe_menu->create_objects();
343 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
344 add_subwindow(transition_menu = new TransitionPopup(mwindow, this));
345 transition_menu->create_objects();
347 channel_info = new ChannelInfo(mwindow);
348 db_window = new DbWindow(mwindow);
349 swindow = new SWindow(mwindow);
351 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
353 add_subwindow(pane_button = new PaneButton(mwindow,
354 get_w() - mwindow->theme->get_image_set("pane")[0]->get_w(),
355 mwindow->theme->mzoom_y + 1 - mwindow->theme->get_image_set("pane")[0]->get_h()));
357 pane[TOP_LEFT_PANE]->canvas->activate();
359 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
362 void MWindowGUI::redraw_time_dependancies()
364 zoombar->redraw_time_dependancies();
365 for(int i = 0; i < TOTAL_PANES; i++)
366 if(pane[i] && pane[i]->timebar) pane[i]->timebar->update(0);
367 mainclock->update(mwindow->edl->local_session->get_selectionstart(1));
370 int MWindowGUI::focus_in_event()
372 for(int i = 0; i < TOTAL_PANES; i++)
373 if(pane[i]) pane[i]->cursor->focus_in_event();
377 int MWindowGUI::focus_out_event()
379 for(int i = 0; i < TOTAL_PANES; i++)
380 if(pane[i]) pane[i]->cursor->focus_out_event();
385 int MWindowGUI::resize_event(int w, int h)
387 //printf("MWindowGUI::resize_event %d\n", __LINE__);
388 mwindow->session->mwindow_w = w;
389 mwindow->session->mwindow_h = h;
390 mwindow->theme->get_mwindow_sizes(this, w, h);
391 mwindow->theme->draw_mwindow_bg(this);
392 // mainmenu->reposition_window(0, 0, w, mainmenu->get_h());
393 mbuttons->resize_event();
394 statusbar->resize_event();
396 resource_thread->stop_draw(1);
399 if(total_panes() == 1)
401 pane[TOP_LEFT_PANE]->resize_event(
402 mwindow->theme->mcanvas_x,
403 mwindow->theme->mcanvas_y,
404 mwindow->theme->mcanvas_w,
405 mwindow->theme->mcanvas_h);
408 if(horizontal_panes())
410 pane[TOP_LEFT_PANE]->resize_event(
411 pane[TOP_LEFT_PANE]->x,
412 pane[TOP_LEFT_PANE]->y,
413 pane[TOP_LEFT_PANE]->w,
414 mwindow->theme->mcanvas_h);
415 pane[TOP_RIGHT_PANE]->resize_event(
416 pane[TOP_RIGHT_PANE]->x,
417 pane[TOP_RIGHT_PANE]->y,
418 mwindow->theme->mcanvas_w - pane[TOP_RIGHT_PANE]->x,
419 mwindow->theme->mcanvas_h);
424 pane[TOP_LEFT_PANE]->resize_event(
425 pane[TOP_LEFT_PANE]->x,
426 pane[TOP_LEFT_PANE]->y,
427 mwindow->theme->mcanvas_w,
428 pane[TOP_LEFT_PANE]->h);
429 pane[BOTTOM_LEFT_PANE]->resize_event(
430 pane[BOTTOM_LEFT_PANE]->x,
431 pane[BOTTOM_LEFT_PANE]->y,
432 mwindow->theme->mcanvas_w,
433 mwindow->theme->mcanvas_y +
434 mwindow->theme->mcanvas_h -
435 pane[BOTTOM_LEFT_PANE]->y);
439 pane[TOP_LEFT_PANE]->resize_event(
440 pane[TOP_LEFT_PANE]->x,
441 pane[TOP_LEFT_PANE]->y,
442 pane[TOP_LEFT_PANE]->w,
443 pane[TOP_LEFT_PANE]->h);
444 pane[TOP_RIGHT_PANE]->resize_event(
445 pane[TOP_RIGHT_PANE]->x,
446 pane[TOP_RIGHT_PANE]->y,
447 mwindow->theme->mcanvas_w - pane[TOP_RIGHT_PANE]->x,
448 pane[TOP_RIGHT_PANE]->h);
449 pane[BOTTOM_LEFT_PANE]->resize_event(
450 pane[BOTTOM_LEFT_PANE]->x,
451 pane[BOTTOM_LEFT_PANE]->y,
452 pane[BOTTOM_LEFT_PANE]->w,
453 mwindow->theme->mcanvas_y +
454 mwindow->theme->mcanvas_h -
455 pane[BOTTOM_LEFT_PANE]->y);
456 pane[BOTTOM_RIGHT_PANE]->resize_event(
457 pane[BOTTOM_RIGHT_PANE]->x,
458 pane[BOTTOM_RIGHT_PANE]->y,
459 mwindow->theme->mcanvas_w -
460 pane[BOTTOM_RIGHT_PANE]->x,
461 mwindow->theme->mcanvas_y +
462 mwindow->theme->mcanvas_h -
463 pane[BOTTOM_RIGHT_PANE]->y);
466 resource_thread->start_draw();
468 update_pane_dividers();
469 zoombar->resize_event();
470 pane_button->reposition_window(w - mwindow->theme->get_image_set("pane")[0]->get_w(),
471 mwindow->theme->mzoom_y + 1 - mwindow->theme->get_image_set("pane")[0]->get_h());
472 // get_scrollbars(0);
473 // canvas->resize_event();
474 //printf("MWindowGUI::resize_event %d\n", __LINE__);
479 int MWindowGUI::total_panes()
482 for(int i = 0; i < TOTAL_PANES; i++)
487 int MWindowGUI::vertical_panes()
489 return total_panes() == 2 &&
490 pane[TOP_LEFT_PANE] &&
491 pane[BOTTOM_LEFT_PANE];
494 int MWindowGUI::horizontal_panes()
496 return total_panes() == 2 &&
497 pane[TOP_LEFT_PANE] &&
498 pane[TOP_RIGHT_PANE];
501 TimelinePane* MWindowGUI::get_focused_pane()
503 if(pane[focused_pane]) return pane[focused_pane];
504 for(int i = 0; i < TOTAL_PANES; i++)
506 if(pane[i]) return pane[i];
511 void MWindowGUI::activate_timeline()
513 if(pane[focused_pane])
515 pane[focused_pane]->activate();
519 for(int i = 0; i < TOTAL_PANES; i++)
530 void MWindowGUI::deactivate_timeline()
532 for(int i = 0; i < TOTAL_PANES; i++)
536 pane[i]->canvas->deactivate();
541 void MWindowGUI::update_title(char *path)
544 char filename[BCTEXTLEN], string[BCTEXTLEN];
545 fs.extract_name(filename, path);
546 sprintf(string, _(PROGRAM_NAME ": %s"), filename);
548 //printf("MWindowGUI::update_title %s\n", string);
552 void MWindowGUI::draw_overlays(int flash_it)
554 for(int i = 0; i < TOTAL_PANES; i++)
558 pane[i]->canvas->draw_overlays();
559 if(flash_it) pane[i]->canvas->flash();
564 void MWindowGUI::update_timebar(int flush_it)
566 for(int i = 0; i < TOTAL_PANES; i++)
568 if(pane[i] && pane[i]->timebar)
570 pane[i]->timebar->update(flush_it);
575 void MWindowGUI::update_timebar_highlights()
577 for(int i = 0; i < TOTAL_PANES; i++)
579 if(pane[i] && pane[i]->timebar)
581 pane[i]->timebar->update_highlights();
587 void MWindowGUI::update_patchbay()
589 for(int i = 0; i < TOTAL_PANES; i++)
591 if(pane[i] && pane[i]->patchbay)
593 pane[i]->patchbay->update();
598 void MWindowGUI::draw_indexes(Indexable *indexable)
600 for(int i = 0; i < TOTAL_PANES; i++)
604 pane[i]->canvas->draw_indexes(indexable);
609 void MWindowGUI::draw_canvas(int mode /* = 0 */, int hide_cursor /* = 1 */)
611 if(mode != IGNORE_THREAD)
613 resource_thread->stop_draw(1);
617 for(int i = 0; i < TOTAL_PANES; i++)
621 pane[i]->canvas->draw(mode, hide_cursor);
626 if(mode != IGNORE_THREAD)
628 resource_thread->start_draw();
633 void MWindowGUI::flash_canvas(int flush)
635 for(int i = 0; i < TOTAL_PANES; i++)
639 pane[i]->canvas->flash(flush);
644 void MWindowGUI::draw_cursor(int do_plugintoggles)
646 for(int i = 0; i < TOTAL_PANES; i++)
650 pane[i]->cursor->draw(do_plugintoggles);
655 void MWindowGUI::show_cursor(int do_plugintoggles)
657 for(int i = 0; i < TOTAL_PANES; i++)
661 pane[i]->cursor->show(do_plugintoggles);
666 void MWindowGUI::hide_cursor(int do_plugintoggles)
668 for(int i = 0; i < TOTAL_PANES; i++)
672 pane[i]->cursor->hide(do_plugintoggles);
677 void MWindowGUI::update_cursor()
679 for(int i = 0; i < TOTAL_PANES; i++)
683 pane[i]->cursor->update();
688 void MWindowGUI::set_playing_back(int value)
690 for(int i = 0; i < TOTAL_PANES; i++)
694 pane[i]->cursor->playing_back = value;
699 void MWindowGUI::update_plugintoggles()
701 for(int i = 0; i < TOTAL_PANES; i++)
705 pane[i]->canvas->refresh_plugintoggles();
711 void MWindowGUI::update_scrollbars(int flush)
713 for(int i = 0; i < TOTAL_PANES; i++)
717 pane[i]->update(1, 0, 0, 0);
720 if(flush) this->flush();
723 void MWindowGUI::reset_meters()
725 for(int i = 0; i < TOTAL_PANES; i++)
727 if(pane[i] && pane[i]->patchbay)
729 pane[i]->patchbay->reset_meters();
734 void MWindowGUI::stop_meters()
736 for(int i = 0; i < TOTAL_PANES; i++)
738 if(pane[i] && pane[i]->patchbay)
740 pane[i]->patchbay->stop_meters();
745 void MWindowGUI::update_meters(ArrayList<double> *module_levels)
747 for(int i = 0; i < TOTAL_PANES; i++)
749 if(pane[i] && pane[i]->patchbay)
751 pane[i]->patchbay->update_meters(module_levels);
756 void MWindowGUI::set_editing_mode(int flush)
758 for(int i = 0; i < TOTAL_PANES; i++)
762 pane[i]->canvas->update_cursor(flush);
767 void MWindowGUI::set_meter_format(int mode, int min, int max)
769 for(int i = 0; i < TOTAL_PANES; i++)
771 if(pane[i] && pane[i]->patchbay)
773 pane[i]->patchbay->set_meter_format(mode, min, max);
778 void MWindowGUI::update(int scrollbars,
787 if(debug) PRINT_TRACE
791 mwindow->edl->tracks->update_y_pixels(mwindow->theme);
793 if(do_canvas && do_canvas != IGNORE_THREAD)
795 resource_thread->stop_draw(1);
798 for(int i = 0; i < TOTAL_PANES; i++)
800 if(pane[i]) pane[i]->update(scrollbars,
806 if(do_canvas && do_canvas != IGNORE_THREAD)
808 resource_thread->start_draw();
811 // if(scrollbars) this->get_scrollbars(0);
812 // if(timebar) this->timebar->update(0);
813 if(zoombar) this->zoombar->update();
814 // if(patchbay) this->patchbay->update();
815 if(clock) this->mainclock->update(
816 mwindow->edl->local_session->get_selectionstart(1));
817 if(debug) PRINT_TRACE
823 // this->canvas->draw(do_canvas);
824 // this->cursor->show();
825 // this->canvas->flash(0);
826 // Activate causes the menubar to deactivate. Don't want this for
828 // if(canvas != IGNORE_THREAD) this->canvas->activate();
830 if(debug) PRINT_TRACE
834 if(buttonbar) mbuttons->update();
835 if(debug) PRINT_TRACE
837 // Can't age if the cache called this to draw missing picons
838 // or the GUI is updating the status of the draw toggle.
839 if(do_canvas != FORCE_REDRAW && do_canvas != IGNORE_THREAD)
842 mwindow->age_caches();
843 lock_window("MWindowGUI::update");
847 if(debug) PRINT_TRACE
850 int MWindowGUI::visible(int64_t x1, int64_t x2, int64_t view_x1, int64_t view_x2)
852 return (x1 >= view_x1 && x1 < view_x2) ||
853 (x2 > view_x1 && x2 <= view_x2) ||
854 (x1 <= view_x1 && x2 >= view_x2);
858 int MWindowGUI::show_message(char *message, int color)
860 // printf("MWindowGUI::show_message %d: %s 0x%08x 0x%08x\n",
861 // __LINE__, message, color, mwindow->theme->message_normal);
862 if(color < 0) color = mwindow->theme->message_normal;
863 statusbar->status_text->set_color(color);
864 statusbar->status_text->update(message);
869 // Drag motion called from other window
870 int MWindowGUI::drag_motion()
872 if(get_hidden()) return 0;
874 Track *over_track = 0;
876 PluginSet *over_pluginset = 0;
877 Plugin *over_plugin = 0;
882 drag_popup->cursor_motion_event();
886 // there's no point in drawing highlights has until drag operation has been set
887 if (!mwindow->session->current_operation)
890 if(mwindow->session->free_drag) redraw = 1;
895 mwindow->session->free_drag = 1;
899 mwindow->session->free_drag = 0;
903 for(int i = 0; i < TOTAL_PANES; i++)
905 if(pane[i]) pane[i]->canvas->drag_motion(
914 if(mwindow->session->track_highlighted != over_track)
916 mwindow->session->track_highlighted = over_track;
920 if(mwindow->session->edit_highlighted != over_edit)
922 mwindow->session->edit_highlighted = over_edit;
926 if(mwindow->session->pluginset_highlighted != over_pluginset)
928 mwindow->session->pluginset_highlighted = over_pluginset;
932 if(mwindow->session->plugin_highlighted != over_plugin)
934 mwindow->session->plugin_highlighted = over_plugin;
938 // printf("drag_motion %d %d over_track=%p over_edit=%p\n",
945 lock_window("MWindowGUI::drag_motion");
952 int MWindowGUI::drag_stop()
954 if(get_hidden()) return 0;
955 int result = 0, redraw = 0;
957 for(int i = 0; i < TOTAL_PANES; i++)
959 if(pane[i]) result |= pane[i]->canvas->drag_stop(
964 // since we don't have subwindows we have to terminate any drag operation
967 if (mwindow->session->track_highlighted
968 || mwindow->session->edit_highlighted
969 || mwindow->session->plugin_highlighted
970 || mwindow->session->pluginset_highlighted)
972 mwindow->session->track_highlighted = 0;
973 mwindow->session->edit_highlighted = 0;
974 mwindow->session->plugin_highlighted = 0;
975 mwindow->session->pluginset_highlighted = 0;
976 mwindow->session->current_operation = NO_OPERATION;
980 //printf("TrackCanvas::drag_stop %d %d\n", redraw, mwindow->session->current_operation);
983 mwindow->edl->tracks->update_y_pixels(mwindow->theme);
984 update_scrollbars(0);
999 void MWindowGUI::default_positions()
1001 //printf("MWindowGUI::default_positions 1\n");
1002 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
1003 mwindow->vwindows.get(0) : 0;
1004 if( vwindow ) vwindow->gui->lock_window("MWindowGUI::default_positions");
1005 mwindow->cwindow->gui->lock_window("MWindowGUI::default_positions");
1006 mwindow->awindow->gui->lock_window("MWindowGUI::default_positions");
1008 // printf("MWindowGUI::default_positions 1 %d %d %d %d\n", mwindow->session->vwindow_x,
1009 // mwindow->session->vwindow_y,
1010 // mwindow->session->vwindow_w,
1011 // mwindow->session->vwindow_h);
1012 reposition_window(mwindow->session->mwindow_x,
1013 mwindow->session->mwindow_y,
1014 mwindow->session->mwindow_w,
1015 mwindow->session->mwindow_h);
1016 if( vwindow ) vwindow->gui->reposition_window(mwindow->session->vwindow_x,
1017 mwindow->session->vwindow_y,
1018 mwindow->session->vwindow_w,
1019 mwindow->session->vwindow_h);
1020 mwindow->cwindow->gui->reposition_window(mwindow->session->cwindow_x,
1021 mwindow->session->cwindow_y,
1022 mwindow->session->cwindow_w,
1023 mwindow->session->cwindow_h);
1024 mwindow->awindow->gui->reposition_window(mwindow->session->awindow_x,
1025 mwindow->session->awindow_y,
1026 mwindow->session->awindow_w,
1027 mwindow->session->awindow_h);
1028 //printf("MWindowGUI::default_positions 1\n");
1030 resize_event(mwindow->session->mwindow_w,
1031 mwindow->session->mwindow_h);
1032 //printf("MWindowGUI::default_positions 1\n");
1033 if( vwindow ) vwindow->gui->resize_event(mwindow->session->vwindow_w,
1034 mwindow->session->vwindow_h);
1035 //printf("MWindowGUI::default_positions 1\n");
1036 mwindow->cwindow->gui->resize_event(mwindow->session->cwindow_w,
1037 mwindow->session->cwindow_h);
1038 //printf("MWindowGUI::default_positions 1\n");
1039 mwindow->awindow->gui->resize_event(mwindow->session->awindow_w,
1040 mwindow->session->awindow_h);
1042 //printf("MWindowGUI::default_positions 1\n");
1045 if( vwindow ) vwindow->gui->flush();
1046 mwindow->cwindow->gui->flush();
1047 mwindow->awindow->gui->flush();
1049 if( vwindow ) vwindow->gui->unlock_window();
1050 mwindow->cwindow->gui->unlock_window();
1051 mwindow->awindow->gui->unlock_window();
1052 //printf("MWindowGUI::default_positions 2\n");
1071 int MWindowGUI::repeat_event(int64_t duration)
1073 // if(duration == 100)
1074 // mwindow->sync_parameters(CHANGE_ALL);
1076 for(int i = 0; i < TOTAL_PANES; i++)
1078 if(pane[i]) result = pane[i]->cursor->repeat_event(duration);
1084 int MWindowGUI::translation_event()
1086 //printf("MWindowGUI::translation_event 1 %d %d\n", get_x(), get_y());
1087 mwindow->session->mwindow_x = get_x();
1088 mwindow->session->mwindow_y = get_y();
1093 int MWindowGUI::save_defaults(BC_Hash *defaults)
1095 defaults->update("MWINDOWWIDTH", get_w());
1096 defaults->update("MWINDOWHEIGHT", get_h());
1097 mainmenu->save_defaults(defaults);
1098 BC_WindowBase::save_defaults(defaults);
1102 int MWindowGUI::keypress_event()
1104 //printf("MWindowGUI::keypress_event 1 %d\n", get_keypress());
1106 result = mbuttons->keypress_event();
1110 switch(get_keypress())
1112 case '1': case '2': case '3': case '4':
1113 case '5': case '6': case '7': case '8':
1114 if( !alt_down() || shift_down() ) break;
1115 if( !mwindow->select_asset(get_keypress()-'1',1) )
1124 mbuttons->transport->handle_transport(STOP, 1, 0, 0);
1125 lock_window("MWindowGUI::keypress_event 1");
1126 mwindow->prev_edit_handle(shift_down());
1129 mwindow->move_left();
1139 mbuttons->transport->handle_transport(STOP, 1, 0, 0);
1140 lock_window("MWindowGUI::keypress_event 2");
1141 mwindow->next_edit_handle(shift_down());
1144 mwindow->move_right();
1152 mwindow->expand_y();
1158 mwindow->expand_autos();
1163 mwindow->expand_sample();
1171 mwindow->zoom_in_y();
1177 mwindow->shrink_autos();
1182 mwindow->zoom_in_sample();
1195 mwindow->expand_t();
1203 mwindow->move_down();
1208 mwindow->zoom_in_t();
1215 // //int cursor_x = 0;
1216 // int cursor_y = 0;
1217 // for(int i = 0; i < TOTAL_PANES; i++)
1221 // //cursor_x = pane[i]->canvas->get_relative_cursor_x();
1222 // cursor_y = pane[i]->canvas->get_relative_cursor_y();
1227 // if(get_keypress() == TAB)
1229 // // Switch the record button
1230 // for(Track *track = mwindow->edl->tracks->first; track; track = track->next)
1232 // int64_t track_x, track_y, track_w, track_h;
1233 // canvas->track_dimensions(track, track_x, track_y, track_w, track_h);
1235 // if(cursor_y >= track_y &&
1236 // cursor_y < track_y + track_h)
1238 // if (track->record)
1239 // track->record = 0;
1241 // track->record = 1;
1249 // Track *this_track = 0;
1250 // for(Track *track = mwindow->edl->tracks->first; track; track = track->next)
1252 // int64_t track_x, track_y, track_w, track_h;
1253 // canvas->track_dimensions(track, track_x, track_y, track_w, track_h);
1255 // if(cursor_y >= track_y &&
1256 // cursor_y < track_y + track_h)
1258 // // This is our track
1259 // this_track = track;
1264 // int total_selected = mwindow->edl->tracks->total_of(Tracks::RECORD);
1266 // // nothing previously selected
1267 // if(total_selected == 0)
1269 // mwindow->edl->tracks->select_all(Tracks::RECORD,
1273 // if(total_selected == 1)
1275 // // this patch was previously the only one on
1276 // if(this_track && this_track->record)
1278 // mwindow->edl->tracks->select_all(Tracks::RECORD,
1281 // // another patch was previously the only one on
1284 // mwindow->edl->tracks->select_all(Tracks::RECORD,
1287 // this_track->record = 1;
1292 // if(total_selected > 1)
1294 // mwindow->edl->tracks->select_all(Tracks::RECORD,
1297 // this_track->record = 1;
1310 // mwindow->cwindow->update(0, 1, 1);
1311 // lock_window("TrackCanvas::keypress_event 3");
1317 // since things under cursor have changed...
1319 cursor_motion_event();
1326 int MWindowGUI::keyboard_listener(BC_WindowBase *wp)
1328 return keyboard_listener(wp->get_keypress());
1331 int MWindowGUI::keyboard_listener(int key)
1336 if( !record->running() )
1339 record->record_gui->interrupt_thread->start(0);
1345 channel_info->toggle_scan();
1348 if( !remote_control->deactivate() )
1349 remote_control->activate();
1359 void MWindowGUI::use_android_remote(int on)
1362 delete android_control;
1363 android_control = 0;
1366 if( android_control ) return;
1367 android_control = new AndroidControl(this);
1370 int MWindowGUI::close_event()
1376 void MWindowGUI::stop_drawing()
1378 resource_thread->stop_draw(1);
1381 int MWindowGUI::menu_h()
1383 return mainmenu->get_h();
1386 void MWindowGUI::start_x_pane_drag()
1390 x_pane_drag = new BC_Popup(this,
1391 get_abs_cursor_x(0) - mwindow->theme->pane_w,
1392 get_resources()->get_top_border() +
1394 mwindow->theme->mcanvas_y,
1395 mwindow->theme->pane_w,
1396 mwindow->theme->mcanvas_h,
1397 mwindow->theme->drag_pane_color);
1398 x_pane_drag->draw_3segmentv(0,
1400 x_pane_drag->get_h(),
1401 mwindow->theme->get_image_set("xpane")[BUTTON_DOWNHI]);
1402 x_pane_drag->flash(1);
1407 void MWindowGUI::start_y_pane_drag()
1411 //printf("MWindowGUI::start_y_pane_drag %d %d %d\n", __LINE__, get_x(), get_y());
1412 y_pane_drag = new BC_Popup(this,
1413 get_resources()->get_left_border() +
1415 mwindow->theme->mcanvas_x,
1416 get_abs_cursor_y(0) - mwindow->theme->pane_h,
1417 mwindow->theme->mcanvas_w,
1418 mwindow->theme->pane_h,
1419 mwindow->theme->drag_pane_color);
1420 y_pane_drag->draw_3segmenth(0,
1422 y_pane_drag->get_w(),
1423 mwindow->theme->get_image_set("ypane")[BUTTON_DOWNHI]);
1424 y_pane_drag->flash(1);
1429 void MWindowGUI::handle_pane_drag()
1435 x_pane_drag->reposition_window(
1436 get_abs_cursor_x(0) - mwindow->theme->pane_w,
1437 x_pane_drag->get_y());
1442 y_pane_drag->reposition_window(
1443 y_pane_drag->get_x(),
1444 get_abs_cursor_y(0) - mwindow->theme->pane_h);
1450 void MWindowGUI::create_x_pane(int cursor_x)
1452 if(total_panes() == 1)
1454 // create a horizontal pane
1455 // do this 1st so the resize_event knows there are 2 panes
1456 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] =
1457 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] +
1459 mwindow->theme->patchbay_w;
1460 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
1462 mwindow->theme->mcanvas_x +
1464 mwindow->theme->mcanvas_y,
1465 mwindow->theme->mcanvas_x +
1466 mwindow->theme->mcanvas_w -
1468 mwindow->theme->mcanvas_h);
1469 pane[TOP_LEFT_PANE]->resize_event(
1470 mwindow->theme->mcanvas_x,
1471 mwindow->theme->mcanvas_y,
1472 cursor_x - mwindow->theme->pane_w,
1473 mwindow->theme->mcanvas_h);
1474 pane[TOP_RIGHT_PANE]->create_objects();
1477 if(vertical_panes())
1479 // create 2 horizontal panes
1480 mwindow->edl->local_session->track_start[TOP_RIGHT_PANE] =
1481 mwindow->edl->local_session->track_start[TOP_LEFT_PANE];
1482 mwindow->edl->local_session->track_start[BOTTOM_RIGHT_PANE] =
1483 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE];
1484 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] =
1485 mwindow->edl->local_session->view_start[BOTTOM_RIGHT_PANE] =
1486 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] +
1488 mwindow->theme->patchbay_w;
1489 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
1491 mwindow->theme->mcanvas_x +
1493 pane[TOP_LEFT_PANE]->y,
1494 mwindow->theme->mcanvas_x +
1495 mwindow->theme->mcanvas_w -
1497 pane[TOP_LEFT_PANE]->h);
1498 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
1500 mwindow->theme->mcanvas_x +
1502 pane[BOTTOM_LEFT_PANE]->y,
1503 mwindow->theme->mcanvas_x +
1504 mwindow->theme->mcanvas_w -
1506 pane[BOTTOM_LEFT_PANE]->h);
1507 pane[TOP_LEFT_PANE]->resize_event(
1508 pane[TOP_LEFT_PANE]->x,
1509 pane[TOP_LEFT_PANE]->y,
1510 cursor_x - mwindow->theme->pane_w,
1511 pane[TOP_LEFT_PANE]->h);
1512 pane[BOTTOM_LEFT_PANE]->resize_event(
1513 pane[BOTTOM_LEFT_PANE]->x,
1514 pane[BOTTOM_LEFT_PANE]->y,
1515 cursor_x - mwindow->theme->pane_w,
1516 pane[BOTTOM_LEFT_PANE]->h);
1517 pane[TOP_RIGHT_PANE]->create_objects();
1518 pane[BOTTOM_RIGHT_PANE]->create_objects();
1521 if(horizontal_panes())
1523 // resize a horizontal pane
1524 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] +=
1526 pane[TOP_RIGHT_PANE]->x;
1527 if(mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] < 0)
1528 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] = 0;
1529 pane[TOP_LEFT_PANE]->resize_event(
1530 mwindow->theme->mcanvas_x,
1531 mwindow->theme->mcanvas_y,
1532 cursor_x - mwindow->theme->pane_w,
1533 mwindow->theme->mcanvas_h);
1534 pane[TOP_RIGHT_PANE]->resize_event(
1535 mwindow->theme->mcanvas_x +
1537 pane[TOP_RIGHT_PANE]->y,
1538 mwindow->theme->mcanvas_x +
1539 mwindow->theme->mcanvas_w -
1541 mwindow->theme->mcanvas_h);
1545 // resize 2 horizontal panes
1546 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] +=
1548 pane[TOP_RIGHT_PANE]->x;
1549 if(mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] < 0)
1550 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] = 0;
1551 mwindow->edl->local_session->view_start[BOTTOM_RIGHT_PANE] =
1552 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE];
1554 pane[TOP_LEFT_PANE]->resize_event(
1555 mwindow->theme->mcanvas_x,
1556 pane[TOP_LEFT_PANE]->y,
1557 cursor_x - mwindow->theme->pane_w,
1558 pane[TOP_LEFT_PANE]->h);
1559 pane[TOP_RIGHT_PANE]->resize_event(
1560 mwindow->theme->mcanvas_x +
1562 pane[TOP_RIGHT_PANE]->y,
1563 mwindow->theme->mcanvas_x +
1564 mwindow->theme->mcanvas_w -
1566 pane[TOP_RIGHT_PANE]->h);
1567 pane[BOTTOM_LEFT_PANE]->resize_event(
1568 mwindow->theme->mcanvas_x,
1569 pane[BOTTOM_LEFT_PANE]->y,
1570 cursor_x - mwindow->theme->pane_w,
1571 pane[BOTTOM_LEFT_PANE]->h);
1572 pane[BOTTOM_RIGHT_PANE]->resize_event(
1573 mwindow->theme->mcanvas_x +
1575 pane[BOTTOM_RIGHT_PANE]->y,
1576 mwindow->theme->mcanvas_x +
1577 mwindow->theme->mcanvas_w -
1579 pane[BOTTOM_RIGHT_PANE]->h);
1585 void MWindowGUI::delete_x_pane(int cursor_x)
1587 // give left panes coordinates of right pane
1588 if(cursor_x < mwindow->theme->patchbay_w + PANE_DRAG_MARGIN &&
1589 pane[TOP_RIGHT_PANE])
1591 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] =
1592 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] -
1593 pane[TOP_RIGHT_PANE]->x + mwindow->theme->patchbay_w;
1594 if(mwindow->edl->local_session->view_start[TOP_LEFT_PANE] < 0)
1595 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] = 0;
1596 mwindow->edl->local_session->view_start[BOTTOM_LEFT_PANE] =
1597 mwindow->edl->local_session->view_start[TOP_LEFT_PANE];
1600 switch(total_panes())
1603 if(pane[TOP_LEFT_PANE] && pane[TOP_RIGHT_PANE])
1605 // delete right pane
1606 delete pane[TOP_RIGHT_PANE];
1607 pane[TOP_RIGHT_PANE] = 0;
1608 pane[TOP_LEFT_PANE]->resize_event(
1609 mwindow->theme->mcanvas_x,
1610 mwindow->theme->mcanvas_y,
1611 mwindow->theme->mcanvas_w,
1612 mwindow->theme->mcanvas_h);
1618 // delete right panes
1619 delete pane[TOP_RIGHT_PANE];
1620 pane[TOP_RIGHT_PANE] = 0;
1621 delete pane[BOTTOM_RIGHT_PANE];
1622 pane[BOTTOM_RIGHT_PANE] = 0;
1623 pane[TOP_LEFT_PANE]->resize_event(
1624 mwindow->theme->mcanvas_x,
1625 pane[TOP_LEFT_PANE]->y,
1626 mwindow->theme->mcanvas_w,
1627 pane[TOP_LEFT_PANE]->h);
1628 pane[BOTTOM_LEFT_PANE]->resize_event(
1629 mwindow->theme->mcanvas_x,
1630 pane[BOTTOM_LEFT_PANE]->y,
1631 mwindow->theme->mcanvas_w,
1632 pane[BOTTOM_LEFT_PANE]->h);
1637 void MWindowGUI::create_y_pane(int cursor_y)
1639 if(total_panes() == 1)
1641 mwindow->edl->local_session->view_start[BOTTOM_LEFT_PANE] =
1642 mwindow->edl->local_session->view_start[TOP_LEFT_PANE];
1643 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] =
1644 mwindow->edl->local_session->track_start[TOP_LEFT_PANE] +
1646 mwindow->theme->mtimebar_h;
1647 // do this 1st so the resize_event knows there are 2 panes
1648 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
1650 mwindow->theme->mcanvas_x,
1651 mwindow->theme->mcanvas_y +
1653 mwindow->theme->mcanvas_w,
1654 mwindow->theme->mcanvas_h -
1656 pane[TOP_LEFT_PANE]->resize_event(
1657 mwindow->theme->mcanvas_x,
1658 mwindow->theme->mcanvas_y,
1659 mwindow->theme->mcanvas_w,
1660 pane[BOTTOM_LEFT_PANE]->y -
1661 mwindow->theme->mcanvas_y -
1662 mwindow->theme->pane_h);
1663 pane[BOTTOM_LEFT_PANE]->create_objects();
1666 if(horizontal_panes())
1669 mwindow->edl->local_session->view_start[BOTTOM_LEFT_PANE] =
1670 mwindow->edl->local_session->view_start[TOP_LEFT_PANE];
1671 mwindow->edl->local_session->view_start[BOTTOM_RIGHT_PANE] =
1672 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE];
1673 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] =
1674 mwindow->edl->local_session->track_start[BOTTOM_RIGHT_PANE] =
1675 mwindow->edl->local_session->track_start[TOP_LEFT_PANE] +
1677 mwindow->theme->mtimebar_h;
1679 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
1681 pane[TOP_LEFT_PANE]->x,
1682 mwindow->theme->mcanvas_y +
1684 pane[TOP_LEFT_PANE]->w,
1685 mwindow->theme->mcanvas_h -
1687 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
1689 pane[TOP_RIGHT_PANE]->x,
1690 mwindow->theme->mcanvas_y +
1692 pane[TOP_RIGHT_PANE]->w,
1693 mwindow->theme->mcanvas_h -
1696 pane[TOP_LEFT_PANE]->resize_event(
1697 pane[TOP_LEFT_PANE]->x,
1698 pane[TOP_LEFT_PANE]->y,
1699 pane[TOP_LEFT_PANE]->w,
1700 pane[BOTTOM_LEFT_PANE]->y -
1701 mwindow->theme->mcanvas_y -
1702 mwindow->theme->pane_h);
1703 pane[TOP_RIGHT_PANE]->resize_event(
1704 pane[TOP_RIGHT_PANE]->x,
1705 pane[TOP_RIGHT_PANE]->y,
1706 pane[TOP_RIGHT_PANE]->w,
1707 pane[BOTTOM_RIGHT_PANE]->y -
1708 mwindow->theme->mcanvas_y -
1709 mwindow->theme->pane_h);
1711 pane[BOTTOM_LEFT_PANE]->create_objects();
1712 pane[BOTTOM_RIGHT_PANE]->create_objects();
1715 if(vertical_panes())
1718 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] +=
1720 (pane[BOTTOM_LEFT_PANE]->y - mwindow->theme->mcanvas_y);
1721 if(mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] < 0)
1722 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] = 0;
1723 pane[TOP_LEFT_PANE]->resize_event(
1724 mwindow->theme->mcanvas_x,
1725 mwindow->theme->mcanvas_y,
1726 mwindow->theme->mcanvas_w,
1727 cursor_y - mwindow->theme->pane_h);
1728 pane[BOTTOM_LEFT_PANE]->resize_event(
1729 pane[BOTTOM_LEFT_PANE]->x,
1731 mwindow->theme->mcanvas_y,
1732 mwindow->theme->mcanvas_w,
1733 mwindow->theme->mcanvas_h -
1739 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] +=
1741 (pane[BOTTOM_LEFT_PANE]->y - mwindow->theme->mcanvas_y);
1742 if(mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] < 0)
1743 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] = 0;
1744 mwindow->edl->local_session->track_start[BOTTOM_RIGHT_PANE] =
1745 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE];
1746 pane[TOP_LEFT_PANE]->resize_event(
1747 pane[TOP_LEFT_PANE]->x,
1748 pane[TOP_LEFT_PANE]->y,
1749 pane[TOP_LEFT_PANE]->w,
1750 cursor_y - mwindow->theme->pane_h);
1751 pane[BOTTOM_LEFT_PANE]->resize_event(
1752 pane[BOTTOM_LEFT_PANE]->x,
1754 mwindow->theme->mcanvas_y,
1755 pane[BOTTOM_LEFT_PANE]->w,
1756 mwindow->theme->mcanvas_h -
1758 pane[TOP_RIGHT_PANE]->resize_event(
1759 pane[TOP_RIGHT_PANE]->x,
1760 pane[TOP_RIGHT_PANE]->y,
1761 pane[TOP_RIGHT_PANE]->w,
1762 cursor_y - mwindow->theme->pane_h);
1763 pane[BOTTOM_RIGHT_PANE]->resize_event(
1764 pane[BOTTOM_RIGHT_PANE]->x,
1766 mwindow->theme->mcanvas_y,
1767 pane[BOTTOM_RIGHT_PANE]->w,
1768 mwindow->theme->mcanvas_h -
1773 void MWindowGUI::delete_y_pane(int cursor_y)
1775 if(cursor_y < mwindow->theme->mtimebar_h +
1777 pane[BOTTOM_LEFT_PANE])
1779 // give top pane coordinates of bottom pane
1780 mwindow->edl->local_session->track_start[TOP_LEFT_PANE] =
1781 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] -
1782 pane[BOTTOM_LEFT_PANE]->y;
1783 if(mwindow->edl->local_session->track_start[TOP_LEFT_PANE] < 0)
1784 mwindow->edl->local_session->track_start[TOP_LEFT_PANE] = 0;
1785 mwindow->edl->local_session->track_start[TOP_RIGHT_PANE] =
1786 mwindow->edl->local_session->track_start[TOP_LEFT_PANE];
1790 switch(total_panes())
1793 delete pane[BOTTOM_LEFT_PANE];
1794 pane[BOTTOM_LEFT_PANE] = 0;
1795 pane[TOP_LEFT_PANE]->resize_event(
1796 mwindow->theme->mcanvas_x,
1797 mwindow->theme->mcanvas_y,
1798 mwindow->theme->mcanvas_w,
1799 mwindow->theme->mcanvas_h);
1803 // delete bottom 2 panes
1805 delete pane[BOTTOM_LEFT_PANE];
1806 pane[BOTTOM_LEFT_PANE] = 0;
1807 delete pane[BOTTOM_RIGHT_PANE];
1808 pane[BOTTOM_RIGHT_PANE] = 0;
1809 pane[TOP_LEFT_PANE]->resize_event(
1810 pane[TOP_LEFT_PANE]->x,
1811 mwindow->theme->mcanvas_y,
1812 pane[TOP_LEFT_PANE]->w,
1813 mwindow->theme->mcanvas_h);
1814 pane[TOP_RIGHT_PANE]->resize_event(
1815 pane[TOP_RIGHT_PANE]->x,
1816 mwindow->theme->mcanvas_y,
1817 pane[TOP_RIGHT_PANE]->w,
1818 mwindow->theme->mcanvas_h);
1823 void MWindowGUI::stop_pane_drag()
1826 resource_thread->stop_draw(1);
1830 // cursor position relative to canvas
1831 int cursor_x = x_pane_drag->get_x() -
1833 get_resources()->get_left_border() -
1834 mwindow->theme->mcanvas_x +
1835 mwindow->theme->pane_w;
1840 if(cursor_x >= mwindow->theme->patchbay_w + PANE_DRAG_MARGIN &&
1841 cursor_x < mwindow->theme->mcanvas_w -
1842 BC_ScrollBar::get_span(SCROLL_VERT) -
1845 create_x_pane(cursor_x);
1846 mwindow->edl->local_session->x_pane = cursor_x;
1851 delete_x_pane(cursor_x);
1852 mwindow->edl->local_session->x_pane = -1;
1860 // cursor position relative to canvas
1861 int cursor_y = y_pane_drag->get_y() -
1863 get_resources()->get_top_border() -
1864 mwindow->theme->mcanvas_y +
1865 mwindow->theme->pane_h;
1871 if(cursor_y >= mwindow->theme->mtimebar_h +
1873 cursor_y < mwindow->theme->mcanvas_h -
1874 BC_ScrollBar::get_span(SCROLL_HORIZ) -
1877 create_y_pane(cursor_y);
1878 mwindow->edl->local_session->y_pane = cursor_y;
1882 delete_y_pane(cursor_y);
1883 mwindow->edl->local_session->y_pane = -1;
1887 update_pane_dividers();
1889 // required to get new widgets to appear
1891 resource_thread->start_draw();
1894 // create panes from EDL
1895 void MWindowGUI::load_panes()
1897 int need_x_panes = 0;
1898 int need_y_panes = 0;
1899 // use names from create functions
1900 int cursor_x = mwindow->edl->local_session->x_pane;
1901 int cursor_y = mwindow->edl->local_session->y_pane;
1903 resource_thread->stop_draw(1);
1905 mwindow->theme->patchbay_w + PANE_DRAG_MARGIN &&
1907 mwindow->theme->mcanvas_w -
1908 BC_ScrollBar::get_span(SCROLL_VERT) -
1915 mwindow->theme->mtimebar_h + PANE_DRAG_MARGIN &&
1917 mwindow->theme->mcanvas_h -
1918 BC_ScrollBar::get_span(SCROLL_HORIZ) -
1924 //printf("MWindowGUI::load_panes %d %d %d\n", __LINE__, need_x_panes, need_y_panes);
1932 if(total_panes() == 1)
1935 //printf("MWindowGUI::load_panes %d\n", __LINE__);
1936 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
1938 mwindow->theme->mcanvas_x +
1940 mwindow->theme->mcanvas_y,
1941 mwindow->theme->mcanvas_x +
1942 mwindow->theme->mcanvas_w -
1944 cursor_y - mwindow->theme->pane_h);
1945 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
1947 mwindow->theme->mcanvas_x,
1948 mwindow->theme->mcanvas_y +
1950 cursor_x - mwindow->theme->pane_w,
1951 mwindow->theme->mcanvas_h -
1953 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
1955 pane[TOP_RIGHT_PANE]->x,
1956 mwindow->theme->mcanvas_y +
1958 pane[TOP_RIGHT_PANE]->w,
1959 mwindow->theme->mcanvas_h -
1961 pane[TOP_LEFT_PANE]->resize_event(
1962 pane[TOP_LEFT_PANE]->x,
1963 pane[TOP_LEFT_PANE]->y,
1964 cursor_x - mwindow->theme->pane_w,
1965 cursor_y - mwindow->theme->pane_h);
1966 pane[TOP_RIGHT_PANE]->create_objects();
1967 pane[BOTTOM_LEFT_PANE]->create_objects();
1968 pane[BOTTOM_RIGHT_PANE]->create_objects();
1971 if(horizontal_panes())
1973 // create vertical panes
1974 //printf("MWindowGUI::load_panes %d\n", __LINE__);
1975 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
1977 mwindow->theme->mcanvas_x,
1978 mwindow->theme->mcanvas_y +
1980 cursor_x - mwindow->theme->pane_w,
1981 mwindow->theme->mcanvas_h -
1983 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
1985 pane[TOP_RIGHT_PANE]->x,
1986 mwindow->theme->mcanvas_y +
1988 pane[TOP_RIGHT_PANE]->w,
1989 mwindow->theme->mcanvas_h -
1991 pane[TOP_LEFT_PANE]->resize_event(
1992 pane[TOP_LEFT_PANE]->x,
1993 pane[TOP_LEFT_PANE]->y,
1994 cursor_x - mwindow->theme->pane_w,
1995 cursor_y - mwindow->theme->pane_h);
1996 pane[TOP_RIGHT_PANE]->resize_event(
1997 mwindow->theme->mcanvas_x +
1999 mwindow->theme->mcanvas_y,
2000 mwindow->theme->mcanvas_x +
2001 mwindow->theme->mcanvas_w -
2003 cursor_y - mwindow->theme->pane_h);
2004 pane[BOTTOM_LEFT_PANE]->create_objects();
2005 pane[BOTTOM_RIGHT_PANE]->create_objects();
2008 if(vertical_panes())
2010 // create horizontal panes
2011 //printf("MWindowGUI::load_panes %d\n", __LINE__);
2012 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
2014 mwindow->theme->mcanvas_x +
2016 mwindow->theme->mcanvas_y,
2017 mwindow->theme->mcanvas_x +
2018 mwindow->theme->mcanvas_w -
2020 cursor_y - mwindow->theme->pane_h);
2021 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
2023 pane[TOP_RIGHT_PANE]->x,
2024 mwindow->theme->mcanvas_y +
2026 pane[TOP_RIGHT_PANE]->w,
2027 mwindow->theme->mcanvas_h -
2029 pane[TOP_LEFT_PANE]->resize_event(
2030 pane[TOP_LEFT_PANE]->x,
2031 pane[TOP_LEFT_PANE]->y,
2032 cursor_x - mwindow->theme->pane_w,
2033 cursor_y - mwindow->theme->pane_h);
2034 pane[BOTTOM_LEFT_PANE]->resize_event(
2035 pane[TOP_LEFT_PANE]->x,
2036 mwindow->theme->mcanvas_y +
2038 mwindow->theme->mcanvas_x +
2039 mwindow->theme->mcanvas_w -
2041 mwindow->theme->mcanvas_h -
2043 pane[TOP_RIGHT_PANE]->create_objects();
2044 pane[BOTTOM_RIGHT_PANE]->create_objects();
2051 //printf("MWindowGUI::load_panes %d\n", __LINE__);
2052 pane[TOP_LEFT_PANE]->resize_event(
2053 pane[TOP_LEFT_PANE]->x,
2054 pane[TOP_LEFT_PANE]->y,
2055 cursor_x - mwindow->theme->pane_w,
2056 cursor_y - mwindow->theme->pane_h);
2057 pane[TOP_RIGHT_PANE]->resize_event(
2058 mwindow->theme->mcanvas_x +
2060 mwindow->theme->mcanvas_y,
2061 mwindow->theme->mcanvas_x +
2062 mwindow->theme->mcanvas_w -
2064 cursor_y - mwindow->theme->pane_h);
2065 pane[BOTTOM_LEFT_PANE]->resize_event(
2066 pane[TOP_LEFT_PANE]->x,
2067 mwindow->theme->mcanvas_y +
2069 mwindow->theme->mcanvas_x +
2070 mwindow->theme->mcanvas_w -
2072 mwindow->theme->mcanvas_h -
2074 pane[BOTTOM_RIGHT_PANE]->resize_event(
2075 pane[TOP_RIGHT_PANE]->x,
2076 mwindow->theme->mcanvas_y +
2078 pane[TOP_RIGHT_PANE]->w,
2079 mwindow->theme->mcanvas_h -
2088 if(pane[BOTTOM_LEFT_PANE]) delete pane[BOTTOM_LEFT_PANE];
2089 if(pane[BOTTOM_RIGHT_PANE]) delete pane[BOTTOM_RIGHT_PANE];
2090 pane[BOTTOM_LEFT_PANE] = 0;
2091 pane[BOTTOM_RIGHT_PANE] = 0;
2093 if(!pane[TOP_RIGHT_PANE])
2095 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
2097 mwindow->theme->mcanvas_x +
2099 mwindow->theme->mcanvas_y,
2100 mwindow->theme->mcanvas_x +
2101 mwindow->theme->mcanvas_w -
2103 mwindow->theme->mcanvas_h);
2104 pane[TOP_LEFT_PANE]->resize_event(
2105 mwindow->theme->mcanvas_x,
2106 mwindow->theme->mcanvas_y,
2107 cursor_x - mwindow->theme->pane_w,
2108 mwindow->theme->mcanvas_h);
2109 pane[TOP_RIGHT_PANE]->create_objects();
2113 pane[TOP_LEFT_PANE]->resize_event(
2114 mwindow->theme->mcanvas_x,
2115 mwindow->theme->mcanvas_y,
2116 cursor_x - mwindow->theme->pane_w,
2117 mwindow->theme->mcanvas_h);
2118 pane[TOP_RIGHT_PANE]->resize_event(
2119 mwindow->theme->mcanvas_x +
2121 pane[TOP_RIGHT_PANE]->y,
2122 mwindow->theme->mcanvas_x +
2123 mwindow->theme->mcanvas_w -
2125 mwindow->theme->mcanvas_h);
2133 if(pane[TOP_RIGHT_PANE]) delete pane[TOP_RIGHT_PANE];
2134 if(pane[BOTTOM_RIGHT_PANE]) delete pane[BOTTOM_RIGHT_PANE];
2135 pane[TOP_RIGHT_PANE] = 0;
2136 pane[BOTTOM_RIGHT_PANE] = 0;
2138 if(!pane[BOTTOM_LEFT_PANE])
2140 //printf("MWindowGUI::load_panes %d\n", __LINE__);
2141 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
2143 mwindow->theme->mcanvas_x,
2144 mwindow->theme->mcanvas_y +
2146 mwindow->theme->mcanvas_w,
2147 mwindow->theme->mcanvas_h -
2149 pane[TOP_LEFT_PANE]->resize_event(
2150 mwindow->theme->mcanvas_x,
2151 mwindow->theme->mcanvas_y,
2152 mwindow->theme->mcanvas_w,
2153 pane[BOTTOM_LEFT_PANE]->y -
2154 mwindow->theme->mcanvas_y -
2155 mwindow->theme->pane_h);
2156 pane[BOTTOM_LEFT_PANE]->create_objects();
2160 pane[TOP_LEFT_PANE]->resize_event(
2161 mwindow->theme->mcanvas_x,
2162 mwindow->theme->mcanvas_y,
2163 mwindow->theme->mcanvas_w,
2164 cursor_y - mwindow->theme->pane_h);
2165 pane[BOTTOM_LEFT_PANE]->resize_event(
2166 pane[BOTTOM_LEFT_PANE]->x,
2168 mwindow->theme->mcanvas_y,
2169 mwindow->theme->mcanvas_w,
2170 mwindow->theme->mcanvas_h -
2177 if(pane[TOP_RIGHT_PANE]) delete pane[TOP_RIGHT_PANE];
2178 if(pane[BOTTOM_RIGHT_PANE]) delete pane[BOTTOM_RIGHT_PANE];
2179 if(pane[BOTTOM_LEFT_PANE]) delete pane[BOTTOM_LEFT_PANE];
2180 pane[TOP_RIGHT_PANE] = 0;
2181 pane[BOTTOM_RIGHT_PANE] = 0;
2182 pane[BOTTOM_LEFT_PANE] = 0;
2183 pane[TOP_LEFT_PANE]->resize_event(
2184 mwindow->theme->mcanvas_x,
2185 mwindow->theme->mcanvas_y,
2186 mwindow->theme->mcanvas_w,
2187 mwindow->theme->mcanvas_h);
2190 update_pane_dividers();
2193 resource_thread->start_draw();
2196 void MWindowGUI::update_pane_dividers()
2199 if(horizontal_panes() || total_panes() == 4)
2201 int x = pane[TOP_RIGHT_PANE]->x - mwindow->theme->pane_w;
2202 int y = mwindow->theme->mcanvas_y;
2203 int h = mwindow->theme->mcanvas_h;
2207 add_subwindow(x_divider = new PaneDivider(
2208 mwindow, x, y, h, 1));
2209 x_divider->create_objects();
2213 x_divider->reposition_window(x, y, h);
2226 if(vertical_panes() || total_panes() == 4)
2228 int x = mwindow->theme->mcanvas_x;
2229 int y = pane[BOTTOM_LEFT_PANE]->y -
2230 mwindow->theme->pane_h;
2231 int w = mwindow->theme->mcanvas_w;
2234 add_subwindow(y_divider = new PaneDivider(
2235 mwindow, x, y, w, 0));
2236 y_divider->create_objects();
2240 y_divider->reposition_window(x, y, w);
2254 void MWindowGUI::draw_samplemovement()
2261 update_scrollbars(1);
2264 void MWindowGUI::draw_trackmovement()
2266 update_scrollbars(0);
2274 PaneButton::PaneButton(MWindow *mwindow, int x, int y)
2275 : BC_Button(x, y, mwindow->theme->get_image_set("pane"))
2277 this->mwindow = mwindow;
2280 int PaneButton::cursor_motion_event()
2282 if(get_top_level()->get_button_down() &&
2284 get_status() == BUTTON_DOWNHI &&
2287 // printf("PaneButton::cursor_motion_event %d\n", __LINE__);
2289 if(get_cursor_x() < 0 && !mwindow->gui->dragging_pane)
2291 mwindow->gui->start_x_pane_drag();
2294 if(get_cursor_y() < 0 && !mwindow->gui->dragging_pane)
2296 mwindow->gui->start_y_pane_drag();
2300 mwindow->gui->handle_pane_drag();
2302 int result = BC_Button::cursor_motion_event();
2306 int PaneButton::button_release_event()
2308 mwindow->gui->stop_pane_drag();
2311 int result = BC_Button::button_release_event();