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"
29 #include "cwindowgui.h"
31 #include "channelinfo.h"
34 #include "editpopup.h"
37 #include "edlsession.h"
38 #include "filesystem.h"
40 #include "keyframepopup.h"
43 #include "localsession.h"
44 #include "mainclock.h"
45 #include "maincursor.h"
47 #include "mainsession.h"
51 #include "mwindowgui.h"
53 #include "panedividers.h"
56 #include "pluginpopup.h"
57 #include "pluginset.h"
58 #include "preferences.h"
61 #include "recordgui.h"
62 #include "renderengine.h"
63 #include "remotecontrol.h"
64 #include "resourcethread.h"
65 #include "samplescroll.h"
66 #include "shbtnprefs.h"
67 #include "statusbar.h"
70 #include "trackcanvas.h"
71 #include "trackpopup.h"
72 #include "trackscroll.h"
74 #include "transitionpopup.h"
75 #include "vwindowgui.h"
81 #define PANE_DRAG_MARGIN MAX(mwindow->theme->pane_w, mwindow->theme->pane_h)
84 // the main window uses its own private colormap for video
85 MWindowGUI::MWindowGUI(MWindow *mwindow)
86 : BC_Window(_(PROGRAM_NAME ": Program"),
87 mwindow->session->mwindow_x, mwindow->session->mwindow_y,
88 mwindow->session->mwindow_w, mwindow->session->mwindow_h,
89 xS(100), yS(100), 1, 1, 1)
91 this->mwindow = mwindow;
98 focused_pane = TOP_LEFT_PANE;
107 render_engine_id = -1;
108 for(int i = 0; i < TOTAL_PANES; i++)
128 cwindow_remote_handler = 0;
129 record_remote_handler = 0;
131 // *** CONTEXT_HELP ***
132 context_help_set_keyword("Program Window");
136 MWindowGUI::~MWindowGUI()
138 delete android_control;
139 delete cwindow_remote_handler;
140 delete record_remote_handler;
141 delete remote_control;
142 delete keyvalue_popup;
143 // delete samplescroll;
144 // delete trackscroll;
145 for(int i = 0; i < TOTAL_PANES; i++)
146 if(pane[i]) delete pane[i];
148 delete render_engine;
149 delete resource_thread;
150 resource_pixmaps.remove_all_objects();
160 void MWindowGUI::create_objects()
162 lock_window("MWindowGUI::create_objects");
165 resource_thread = new ResourceThread(mwindow);
166 resource_thread->create_objects();
169 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
170 set_icon(mwindow->theme->get_image("mwindow_icon"));
171 remote_control = new RemoteControl(this);
172 cwindow_remote_handler = 0;
173 record_remote_handler = 0;
175 // should be first, use if plugged
176 if( !cwindow_remote_handler && mwindow->x10tv ) {
177 cwindow_remote_handler = (RemoteHandler*)
178 new X10TVCWindowHandler(mwindow->x10tv, remote_control);
179 record_remote_handler = (RemoteHandler*)
180 new X10TVRecordHandler(mwindow->x10tv, remote_control);
184 if( !cwindow_remote_handler && mwindow->wintv ) {
185 cwindow_remote_handler = (RemoteHandler*)
186 new WinTVCWindowHandler(mwindow->wintv, remote_control);
187 record_remote_handler = (RemoteHandler*)
188 new WinTVRecordHandler(mwindow->wintv, remote_control);
191 mwindow->reset_android_remote();
192 if( !cwindow_remote_handler )
193 cwindow_remote_handler = (RemoteHandler*)
194 new CWindowKeyEvHandler(mwindow->gui->remote_control);
195 if( !record_remote_handler )
196 record_remote_handler = (RemoteHandler*)
197 new RecordKeyEvHandler(mwindow->gui->remote_control);
198 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
200 int x1 = get_w() - MainShBtns::calculate_w(-1, 0, -1) - xS(5);
201 add_subwindow(mainshbtns = new MainShBtns(mwindow, x1, -1));
202 mainshbtns->load(mwindow->preferences);
203 int x2 = x1 - mwindow->theme->stack_button_w - xS(5);
204 add_subwindow(stack_button = new StackButton(mwindow, x2, yS(2)));
205 add_subwindow(mainmenu = new MainMenu(mwindow, this, x2));
206 mainmenu->create_objects();
207 mwindow->theme->get_mwindow_sizes(this, get_w(), get_h());
208 mwindow->theme->draw_mwindow_bg(this);
209 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
211 add_subwindow(mbuttons = new MButtons(mwindow, this));
212 mbuttons->create_objects();
213 int y1 = mbuttons->get_y()+yS(2);
214 add_subwindow(proxy_toggle = new ProxyToggle(mwindow, mbuttons, x2, y1));
215 add_subwindow(ffmpeg_toggle = new FFMpegToggle(mwindow, mbuttons, x1, y1));
217 pane[TOP_LEFT_PANE] = new TimelinePane(mwindow,
219 mwindow->theme->mcanvas_x,
220 mwindow->theme->mcanvas_y,
221 mwindow->theme->mcanvas_w,
222 mwindow->theme->mcanvas_h);
223 pane[TOP_LEFT_PANE]->create_objects();
225 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
226 add_subwindow(zoombar = new ZoomBar(mwindow, this));
227 zoombar->create_objects();
230 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
231 add_subwindow(statusbar = new StatusBar(mwindow, this));
232 statusbar->create_objects();
236 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
237 add_subwindow(mainclock = new MainClock(mwindow,
238 mwindow->theme->mclock_x, mwindow->theme->mclock_y,
239 mwindow->theme->mclock_w));
240 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
241 mainclock->update(0);
245 // if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
246 // cursor = new MainCursor(mwindow, this);
247 // cursor->create_objects();
250 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
251 add_subwindow(track_menu = new TrackPopup(mwindow, this));
252 track_menu->create_objects();
253 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
254 add_subwindow(edit_menu = new EditPopup(mwindow, this));
255 edit_menu->create_objects();
258 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
259 add_subwindow(plugin_menu = new PluginPopup(mwindow, this));
260 plugin_menu->create_objects();
263 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
264 add_subwindow(keyframe_menu = new KeyframePopup(mwindow, this));
265 keyframe_menu->create_objects();
266 add_subwindow(keyframe_hide = new KeyframeHidePopup(mwindow, this));
267 keyframe_hide->create_objects();
270 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
271 add_subwindow(transition_menu = new TransitionPopup(mwindow, this));
272 transition_menu->create_objects();
275 channel_info = new ChannelInfo(mwindow);
277 #ifdef HAVE_COMMERCIAL
278 db_window = new DbWindow(mwindow);
280 swindow = new SWindow(mwindow);
282 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
284 add_subwindow(pane_button = new PaneButton(mwindow,
285 get_w() - mwindow->theme->get_image_set("pane")[0]->get_w(),
286 mwindow->theme->mzoom_y + 1 - mwindow->theme->get_image_set("pane")[0]->get_h()));
288 pane[TOP_LEFT_PANE]->canvas->activate();
290 if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
294 void MWindowGUI::redraw_time_dependancies()
296 zoombar->redraw_time_dependancies();
297 for(int i = 0; i < TOTAL_PANES; i++)
298 if(pane[i] && pane[i]->timebar) pane[i]->timebar->update(0);
299 mainclock->update(mwindow->edl->local_session->get_selectionstart(1));
302 int MWindowGUI::focus_in_event()
304 for(int i = 0; i < TOTAL_PANES; i++)
305 if(pane[i] && pane[i]->cursor) pane[i]->cursor->focus_in_event();
309 int MWindowGUI::focus_out_event()
311 for(int i = 0; i < TOTAL_PANES; i++)
312 if(pane[i] && pane[i]->cursor) pane[i]->cursor->focus_out_event();
317 int MWindowGUI::resize_event(int w, int h)
319 //printf("MWindowGUI::resize_event %d\n", __LINE__);
320 mwindow->session->mwindow_w = w;
321 mwindow->session->mwindow_h = h;
322 int x1 = w - MainShBtns::calculate_w(-1, 0, -1) - xS(5);
323 mainshbtns->reposition_window(x1, -1);
324 int x2 = x1 - mwindow->theme->stack_button_w - xS(5);
325 stack_button->reposition_window(x2, stack_button->get_y());
326 mainmenu->resize_event(x2, mainmenu->get_h());
327 mwindow->theme->get_mwindow_sizes(this, w, h);
328 mwindow->theme->draw_mwindow_bg(this);
329 mbuttons->resize_event();
330 int y1 = mbuttons->get_y()+yS(2);
331 proxy_toggle->reposition_window(x2, y1);
332 ffmpeg_toggle->reposition_window(x1, y1);
333 statusbar->resize_event();
334 zoombar->resize_event();
336 resource_thread->stop_draw(1);
338 if(total_panes() > 1)
340 if(horizontal_panes())
342 // printf("MWindowGUI::resize_event %d %d %d\n",
344 // pane[TOP_RIGHT_PANE]->x,
345 // mwindow->theme->mcanvas_w -
346 // BC_ScrollBar::get_span(SCROLL_VERT) -
347 // PANE_DRAG_MARGIN);
348 if(pane[TOP_RIGHT_PANE]->x >= mwindow->theme->mcanvas_w -
349 BC_ScrollBar::get_span(SCROLL_VERT) -
352 delete_x_pane(pane[TOP_RIGHT_PANE]->x);
353 mwindow->edl->local_session->x_pane = -1;
359 if(pane[BOTTOM_LEFT_PANE]->y >= mwindow->theme->mzoom_y -
360 BC_ScrollBar::get_span(SCROLL_HORIZ) -
363 delete_y_pane(pane[BOTTOM_LEFT_PANE]->y);
364 mwindow->edl->local_session->y_pane = -1;
369 if(pane[TOP_RIGHT_PANE]->x >= mwindow->theme->mcanvas_w -
370 BC_ScrollBar::get_span(SCROLL_VERT) -
373 delete_x_pane(pane[TOP_RIGHT_PANE]->x);
374 mwindow->edl->local_session->x_pane = -1;
377 if(pane[BOTTOM_LEFT_PANE]->y >= mwindow->theme->mzoom_y -
378 BC_ScrollBar::get_span(SCROLL_HORIZ) -
381 delete_y_pane(pane[BOTTOM_LEFT_PANE]->y);
382 mwindow->edl->local_session->y_pane = -1;
387 if(total_panes() == 1)
389 pane[TOP_LEFT_PANE]->resize_event(
390 mwindow->theme->mcanvas_x,
391 mwindow->theme->mcanvas_y,
392 mwindow->theme->mcanvas_w,
393 mwindow->theme->mcanvas_h);
396 if(horizontal_panes())
398 pane[TOP_LEFT_PANE]->resize_event(
399 pane[TOP_LEFT_PANE]->x,
400 pane[TOP_LEFT_PANE]->y,
401 pane[TOP_LEFT_PANE]->w,
402 mwindow->theme->mcanvas_h);
403 pane[TOP_RIGHT_PANE]->resize_event(
404 pane[TOP_RIGHT_PANE]->x,
405 pane[TOP_RIGHT_PANE]->y,
406 mwindow->theme->mcanvas_w - pane[TOP_RIGHT_PANE]->x,
407 mwindow->theme->mcanvas_h);
412 pane[TOP_LEFT_PANE]->resize_event(
413 pane[TOP_LEFT_PANE]->x,
414 pane[TOP_LEFT_PANE]->y,
415 mwindow->theme->mcanvas_w,
416 pane[TOP_LEFT_PANE]->h);
417 pane[BOTTOM_LEFT_PANE]->resize_event(
418 pane[BOTTOM_LEFT_PANE]->x,
419 pane[BOTTOM_LEFT_PANE]->y,
420 mwindow->theme->mcanvas_w,
421 mwindow->theme->mcanvas_y +
422 mwindow->theme->mcanvas_h -
423 pane[BOTTOM_LEFT_PANE]->y);
427 pane[TOP_LEFT_PANE]->resize_event(
428 pane[TOP_LEFT_PANE]->x,
429 pane[TOP_LEFT_PANE]->y,
430 pane[TOP_LEFT_PANE]->w,
431 pane[TOP_LEFT_PANE]->h);
432 pane[TOP_RIGHT_PANE]->resize_event(
433 pane[TOP_RIGHT_PANE]->x,
434 pane[TOP_RIGHT_PANE]->y,
435 mwindow->theme->mcanvas_w - pane[TOP_RIGHT_PANE]->x,
436 pane[TOP_RIGHT_PANE]->h);
437 pane[BOTTOM_LEFT_PANE]->resize_event(
438 pane[BOTTOM_LEFT_PANE]->x,
439 pane[BOTTOM_LEFT_PANE]->y,
440 pane[BOTTOM_LEFT_PANE]->w,
441 mwindow->theme->mcanvas_y +
442 mwindow->theme->mcanvas_h -
443 pane[BOTTOM_LEFT_PANE]->y);
444 pane[BOTTOM_RIGHT_PANE]->resize_event(
445 pane[BOTTOM_RIGHT_PANE]->x,
446 pane[BOTTOM_RIGHT_PANE]->y,
447 mwindow->theme->mcanvas_w -
448 pane[BOTTOM_RIGHT_PANE]->x,
449 mwindow->theme->mcanvas_y +
450 mwindow->theme->mcanvas_h -
451 pane[BOTTOM_RIGHT_PANE]->y);
454 update_pane_dividers();
455 pane_button->reposition_window(w - mwindow->theme->get_image_set("pane")[0]->get_w(),
456 mwindow->theme->mzoom_y + 1 - mwindow->theme->get_image_set("pane")[0]->get_h());
457 resource_thread->start_draw();
463 int MWindowGUI::total_panes()
466 for(int i = 0; i < TOTAL_PANES; i++)
471 int MWindowGUI::vertical_panes()
473 return total_panes() == 2 &&
474 pane[TOP_LEFT_PANE] &&
475 pane[BOTTOM_LEFT_PANE];
478 int MWindowGUI::horizontal_panes()
480 return total_panes() == 2 &&
481 pane[TOP_LEFT_PANE] &&
482 pane[TOP_RIGHT_PANE];
485 TimelinePane* MWindowGUI::get_focused_pane()
487 if(pane[focused_pane]) return pane[focused_pane];
488 for(int i = 0; i < TOTAL_PANES; i++)
490 if(pane[i]) return pane[i];
495 void MWindowGUI::activate_timeline()
497 if(pane[focused_pane])
499 pane[focused_pane]->activate();
503 for(int i = 0; i < TOTAL_PANES; i++)
514 void MWindowGUI::deactivate_timeline()
516 for(int i = 0; i < TOTAL_PANES; i++)
518 if(pane[i] && pane[i]->canvas)
520 pane[i]->canvas->deactivate();
525 void MWindowGUI::update_title(char *path)
528 char filename[BCTEXTLEN], string[BCTEXTLEN];
529 fs.extract_name(filename, path);
530 sprintf(string, _(PROGRAM_NAME ": %s"), filename);
532 //printf("MWindowGUI::update_title %s\n", string);
536 void MWindowGUI::draw_overlays(int flash_it)
538 for(int i = 0; i < TOTAL_PANES; i++)
540 if(pane[i] && pane[i]->canvas)
542 pane[i]->canvas->draw_overlays();
543 if(flash_it) pane[i]->canvas->flash();
548 void MWindowGUI::update_timebar(int flush_it)
550 for(int i = 0; i < TOTAL_PANES; i++)
552 if(pane[i] && pane[i]->timebar)
554 pane[i]->timebar->update(flush_it);
559 void MWindowGUI::update_timebar_highlights()
561 for(int i = 0; i < TOTAL_PANES; i++)
563 if(pane[i] && pane[i]->timebar)
565 pane[i]->timebar->update_highlights();
571 void MWindowGUI::update_patchbay()
573 for(int i = 0; i < TOTAL_PANES; i++)
575 if(pane[i] && pane[i]->patchbay)
577 pane[i]->patchbay->update();
582 void MWindowGUI::update_proxy_toggle()
584 int value = mwindow->edl->session->proxy_state == PROXY_ACTIVE ? 0 : 1;
585 proxy_toggle->set_value(value);
586 if( mwindow->edl->session->proxy_state == PROXY_INACTIVE )
587 proxy_toggle->hide();
589 proxy_toggle->show();
592 void MWindowGUI::update_plugintoggles()
594 for(int i = 0; i < TOTAL_PANES; i++)
596 if(pane[i] && pane[i]->canvas)
598 pane[i]->canvas->refresh_plugintoggles();
604 void MWindowGUI::draw_indexes(Indexable *indexable)
606 for(int i = 0; i < TOTAL_PANES; i++)
608 if(pane[i] && pane[i]->canvas)
610 pane[i]->canvas->draw_indexes(indexable);
615 void MWindowGUI::draw_canvas(int redraw, int hide_cursor)
617 resource_thread->stop_draw(0);
618 int mode = NORMAL_DRAW;
621 resource_pixmaps.remove_all_objects();
623 for(int i = 0; i < TOTAL_PANES; i++) {
625 pane[i]->canvas->draw(mode, hide_cursor);
628 resource_thread->start_draw();
631 void MWindowGUI::flash_canvas(int flush)
633 for(int i = 0; i < TOTAL_PANES; i++)
635 if(pane[i] && pane[i]->canvas)
637 pane[i]->canvas->flash(flush);
642 int MWindowGUI::show_window(int flush)
644 int ret = BC_WindowBase::show_window(flush);
645 stack_button->update();
646 update_proxy_toggle();
650 void MWindowGUI::draw_cursor(int do_plugintoggles)
652 for(int i = 0; i < TOTAL_PANES; i++)
654 if(pane[i] && pane[i]->cursor)
656 pane[i]->cursor->draw(do_plugintoggles);
661 void MWindowGUI::show_cursor(int do_plugintoggles)
663 for(int i = 0; i < TOTAL_PANES; i++)
665 if(pane[i] && pane[i]->cursor)
667 pane[i]->cursor->show(do_plugintoggles);
672 void MWindowGUI::hide_cursor(int do_plugintoggles)
674 for(int i = 0; i < TOTAL_PANES; i++)
676 if(pane[i] && pane[i]->cursor)
678 pane[i]->cursor->hide(do_plugintoggles);
683 void MWindowGUI::update_cursor()
685 for(int i = 0; i < TOTAL_PANES; i++)
687 if(pane[i] && pane[i]->cursor)
689 pane[i]->cursor->update();
694 void MWindowGUI::set_playing_back(int value)
696 for(int i = 0; i < TOTAL_PANES; i++)
698 if(pane[i] && pane[i]->cursor)
700 pane[i]->cursor->playing_back = value;
705 void MWindowGUI::update_scrollbars(int flush)
707 for(int i = 0; i < TOTAL_PANES; i++)
711 pane[i]->update(1, NO_DRAW, 0, 0);
714 if(flush) this->flush();
717 void MWindowGUI::reset_meters()
719 for(int i = 0; i < TOTAL_PANES; i++)
721 if(pane[i] && pane[i]->patchbay)
723 pane[i]->patchbay->reset_meters();
728 void MWindowGUI::stop_meters()
730 for(int i = 0; i < TOTAL_PANES; i++)
732 if(pane[i] && pane[i]->patchbay)
734 pane[i]->patchbay->stop_meters();
739 void MWindowGUI::update_meters(ArrayList<double> *module_levels)
741 for(int i = 0; i < TOTAL_PANES; i++)
743 if(pane[i] && pane[i]->patchbay)
745 pane[i]->patchbay->update_meters(module_levels);
750 void MWindowGUI::set_editing_mode(int flush)
752 for(int i = 0; i < TOTAL_PANES; i++)
754 if(pane[i] && pane[i]->canvas)
756 pane[i]->canvas->update_cursor(flush);
761 void MWindowGUI::set_meter_format(int mode, int min, int max)
763 for(int i = 0; i < TOTAL_PANES; i++)
765 if(pane[i] && pane[i]->patchbay)
767 pane[i]->patchbay->set_meter_format(mode, min, max);
772 void MWindowGUI::update(int scrollbars,
781 if(debug) PRINT_TRACE
785 mwindow->edl->tracks->update_y_pixels(mwindow->theme);
787 if( do_canvas != NO_DRAW && do_canvas != IGNORE_THREAD )
788 resource_thread->stop_draw(1);
790 if( do_canvas == FORCE_REDRAW )
791 resource_pixmaps.remove_all_objects();
793 for(int i = 0; i < TOTAL_PANES; i++)
795 if(pane[i]) pane[i]->update(scrollbars,
801 if( do_canvas != NO_DRAW && do_canvas != IGNORE_THREAD )
802 resource_thread->start_draw();
804 // if(scrollbars) this->get_scrollbars(0);
805 // if(timebar) this->timebar->update(0);
806 if(zoombar) this->zoombar->update();
807 // if(patchbay) this->patchbay->update();
808 if(clock) this->mainclock->update(
809 mwindow->edl->local_session->get_selectionstart(1));
810 if(debug) PRINT_TRACE
816 // this->canvas->draw(do_canvas);
817 // this->cursor->show();
818 // this->canvas->flash(0);
819 // Activate causes the menubar to deactivate. Don't want this for
821 // if(canvas != IGNORE_THREAD) this->canvas->activate();
823 if(debug) PRINT_TRACE
827 if(buttonbar) mbuttons->update();
828 if(debug) PRINT_TRACE
830 // Can't age if the cache called this to draw missing picons
831 // or the GUI is updating the status of the draw toggle.
832 if( do_canvas != FORCE_REDRAW && do_canvas != IGNORE_THREAD ) {
834 mwindow->age_caches();
835 lock_window("MWindowGUI::update");
839 if(debug) PRINT_TRACE
842 int MWindowGUI::visible(int64_t x1, int64_t x2, int64_t view_x1, int64_t view_x2)
844 return (x1 >= view_x1 && x1 < view_x2) ||
845 (x2 > view_x1 && x2 <= view_x2) ||
846 (x1 <= view_x1 && x2 >= view_x2);
850 void MWindowGUI::show_message(const char *message, int msg_color, int bar_color)
852 statusbar->show_message(message, msg_color, bar_color);
855 void MWindowGUI::update_default_message()
857 statusbar->update_default_message();
860 void MWindowGUI::reset_default_message()
862 statusbar->reset_default_message();
865 void MWindowGUI::default_message()
867 statusbar->default_message();
870 // Drag motion called from other window
871 int MWindowGUI::drag_motion()
873 if(get_hidden()) return 0;
875 Track *over_track = 0;
877 PluginSet *over_pluginset = 0;
878 Plugin *over_plugin = 0;
883 drag_popup->cursor_motion_event();
887 // there's no point in drawing highlights has until drag operation has been set
888 if (!mwindow->session->current_operation)
891 for(int i = 0; i < TOTAL_PANES; i++)
893 if(pane[i] && pane[i]->canvas)
894 pane[i]->canvas->drag_motion(&over_track, &over_edit,
895 &over_pluginset, &over_plugin);
898 if(mwindow->session->track_highlighted != over_track)
900 mwindow->session->track_highlighted = over_track;
904 if(mwindow->session->edit_highlighted != over_edit)
906 mwindow->session->edit_highlighted = over_edit;
910 if(mwindow->session->pluginset_highlighted != over_pluginset)
912 mwindow->session->pluginset_highlighted = over_pluginset;
916 if(mwindow->session->plugin_highlighted != over_plugin)
918 mwindow->session->plugin_highlighted = over_plugin;
922 if( mwindow->session->current_operation == DRAG_ASSET ||
923 mwindow->session->current_operation == DRAG_EDIT ||
924 mwindow->session->current_operation == DRAG_GROUP ||
925 mwindow->session->current_operation == DRAG_AEFFECT_COPY ||
926 mwindow->session->current_operation == DRAG_VEFFECT_COPY ) {
931 // printf("drag_motion %d %d over_track=%p over_edit=%p\n",
938 lock_window("MWindowGUI::drag_motion");
945 int MWindowGUI::drag_stop()
947 if(get_hidden()) return 0;
948 int result = 0, redraw = 0;
950 for(int i = 0; i < TOTAL_PANES; i++)
952 if(pane[i] && pane[i]->canvas)
953 result |= pane[i]->canvas->drag_stop(&redraw);
955 mwindow->edl->optimize();
957 // since we don't have subwindows we have to terminate any drag operation
960 if (mwindow->session->track_highlighted
961 || mwindow->session->edit_highlighted
962 || mwindow->session->plugin_highlighted
963 || mwindow->session->pluginset_highlighted)
965 mwindow->session->track_highlighted = 0;
966 mwindow->session->edit_highlighted = 0;
967 mwindow->session->plugin_highlighted = 0;
968 mwindow->session->pluginset_highlighted = 0;
969 mwindow->session->current_operation = NO_OPERATION;
973 //printf("MWindowGUI::drag_stop %d %d\n", redraw, mwindow->session->current_operation);
976 mwindow->edl->tracks->update_y_pixels(mwindow->theme);
977 update_scrollbars(0);
992 void MWindowGUI::default_positions()
994 //printf("MWindowGUI::default_positions 1\n");
995 VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ?
996 mwindow->vwindows.get(DEFAULT_VWINDOW) : 0;
997 if( vwindow && !vwindow->is_running() ) vwindow = 0;
998 if( vwindow ) vwindow->gui->lock_window("MWindowGUI::default_positions");
999 mwindow->cwindow->gui->lock_window("MWindowGUI::default_positions");
1000 mwindow->awindow->gui->lock_window("MWindowGUI::default_positions");
1002 // printf("MWindowGUI::default_positions 1 %d %d %d %d\n", mwindow->session->vwindow_x,
1003 // mwindow->session->vwindow_y,
1004 // mwindow->session->vwindow_w,
1005 // mwindow->session->vwindow_h);
1006 reposition_window(mwindow->session->mwindow_x,
1007 mwindow->session->mwindow_y,
1008 mwindow->session->mwindow_w,
1009 mwindow->session->mwindow_h);
1010 if( vwindow ) vwindow->gui->reposition_window(mwindow->session->vwindow_x,
1011 mwindow->session->vwindow_y,
1012 mwindow->session->vwindow_w,
1013 mwindow->session->vwindow_h);
1014 mwindow->cwindow->gui->reposition_window(mwindow->session->cwindow_x,
1015 mwindow->session->cwindow_y,
1016 mwindow->session->cwindow_w,
1017 mwindow->session->cwindow_h);
1018 mwindow->awindow->gui->reposition_window(mwindow->session->awindow_x,
1019 mwindow->session->awindow_y,
1020 mwindow->session->awindow_w,
1021 mwindow->session->awindow_h);
1022 //printf("MWindowGUI::default_positions 1\n");
1024 resize_event(mwindow->session->mwindow_w,
1025 mwindow->session->mwindow_h);
1026 //printf("MWindowGUI::default_positions 1\n");
1027 if( vwindow ) vwindow->gui->resize_event(mwindow->session->vwindow_w,
1028 mwindow->session->vwindow_h);
1029 //printf("MWindowGUI::default_positions 1\n");
1030 mwindow->cwindow->gui->resize_event(mwindow->session->cwindow_w,
1031 mwindow->session->cwindow_h);
1032 //printf("MWindowGUI::default_positions 1\n");
1033 mwindow->awindow->gui->resize_event(mwindow->session->awindow_w,
1034 mwindow->session->awindow_h);
1036 //printf("MWindowGUI::default_positions 1\n");
1039 if( vwindow ) vwindow->gui->flush();
1040 mwindow->cwindow->gui->flush();
1041 mwindow->awindow->gui->flush();
1043 if( vwindow ) vwindow->gui->unlock_window();
1044 mwindow->cwindow->gui->unlock_window();
1045 mwindow->awindow->gui->unlock_window();
1046 //printf("MWindowGUI::default_positions 2\n");
1047 mwindow->tile_mixers();
1051 int MWindowGUI::repeat_event(int64_t duration)
1053 // if(duration == 100)
1054 // mwindow->sync_parameters(CHANGE_ALL);
1056 for(int i = 0; i < TOTAL_PANES; i++)
1058 if(pane[i] && pane[i]->cursor)
1059 result = pane[i]->cursor->repeat_event(duration);
1065 int MWindowGUI::translation_event()
1067 //printf("MWindowGUI::translation_event 1 %d %d\n", get_x(), get_y());
1068 mwindow->session->mwindow_x = get_x();
1069 mwindow->session->mwindow_y = get_y();
1074 int MWindowGUI::save_defaults(BC_Hash *defaults)
1076 defaults->update("MWINDOWWIDTH", get_w());
1077 defaults->update("MWINDOWHEIGHT", get_h());
1078 mainmenu->save_defaults(defaults);
1079 BC_WindowBase::save_defaults(defaults);
1083 int MWindowGUI::keypress_event()
1085 //printf("MWindowGUI::keypress_event 1 %d\n", get_keypress());
1086 int result = mbuttons->keypress_event();
1087 if( result ) return result;
1089 Track *this_track = 0, *first_track = 0;
1090 int packed = 0, overwrite = 0, plugins = 0;
1091 double position = 0;
1093 switch( get_keypress() ) {
1096 if( !ctrl_down() || !shift_down() ) break;
1097 mwindow->edl->tracks->clear_selected_edits();
1103 if( !alt_down() ) break;
1104 stop_transport("MWindowGUI::keypress_event 1");
1105 mwindow->nearest_auto_keyframe(shift_down(),
1106 !ctrl_down() ? PLAY_FORWARD : PLAY_REVERSE);
1111 if( ctrl_down() && alt_down() ) {
1112 mwindow->select_edits(1);
1118 if( ctrl_down() || alt_down() ) break;
1119 mwindow->toggle_editing_mode();
1124 if( alt_down() ) break;
1125 stop_transport("MWindowGUI::keypress_event 2");
1126 mwindow->nearest_plugin_keyframe(shift_down(),
1127 !ctrl_down() ? PLAY_FORWARD : PLAY_REVERSE);
1134 if( !ctrl_down() || alt_down() ) break;
1135 mwindow->selected_edits_to_clipboard(packed);
1141 overwrite = -1; // fall thru
1143 if( !ctrl_down() || alt_down() ) break;
1144 if( mwindow->session->current_operation == DROP_TARGETING ) {
1145 mwindow->session->current_operation = NO_OPERATION;
1146 mwindow->gui->set_editing_mode(1);
1148 for( ; pane_no<TOTAL_PANES; ++pane_no ) {
1149 if( !pane[pane_no] ) continue;
1150 first_track = pane[pane_no]->over_track();
1151 if( first_track ) break;
1154 int cursor_x = pane[pane_no]->canvas->get_relative_cursor_x();
1155 position = mwindow->edl->get_cursor_position(cursor_x, pane_no);
1159 position = mwindow->edl->local_session->get_selectionstart();
1161 mwindow->paste(position, first_track, 0, overwrite);
1163 mwindow->paste_clipboard(first_track, position, 1, 0, 1, 1, 1);
1164 mwindow->edl->tracks->clear_selected_edits();
1169 mwindow->cut_selected_edits(0, 1);
1174 mwindow->cut_selected_edits(0, 0);
1179 // z and ctrl-z both are undo, z mainmenu item
1180 if( mwindow->session->current_operation == NO_OPERATION )
1181 mwindow->undo_entry(this);
1184 else if( ctrl_down() ) {
1185 mwindow->cut_selected_edits(1, 1);
1190 if( !ctrl_down() || alt_down() ) break;
1191 mwindow->cut_selected_edits(1, 0);
1196 if( !alt_down() || shift_down() ) break;
1197 if( !mwindow->select_asset(get_keypress()-'1',1) )
1202 if( !ctrl_down() ) {
1204 stop_transport("MWindowGUI::keypress_event 1");
1205 mwindow->prev_edit_handle(shift_down());
1208 mwindow->move_left();
1214 if( !ctrl_down() && !alt_down() ) {
1215 mwindow->move_left();
1221 if( !ctrl_down() ) {
1223 stop_transport("MWindowGUI::keypress_event 2");
1224 mwindow->next_edit_handle(shift_down());
1227 mwindow->move_right();
1233 if( !ctrl_down() && !alt_down() ) {
1234 mwindow->move_right();
1240 if( !ctrl_down() || !shift_down() ) break;
1241 /* code to execute is same as lines 383-401 in editpopup.C */
1246 if( ctrl_down() && !alt_down() )
1247 mwindow->expand_y();
1248 else if( !ctrl_down() && alt_down() )
1249 mwindow->expand_autos(0,1,1);
1250 else if( ctrl_down() && alt_down() )
1251 mwindow->expand_autos(1,1,1);
1253 mwindow->expand_sample();
1258 if( ctrl_down() && !alt_down() )
1259 mwindow->zoom_in_y();
1260 else if( !ctrl_down() && alt_down() )
1261 mwindow->shrink_autos(0,1,1);
1262 else if( ctrl_down() && alt_down() )
1263 mwindow->shrink_autos(1,1,1);
1265 mwindow->zoom_in_sample();
1273 mwindow->expand_t();
1279 mwindow->move_down();
1281 mwindow->zoom_in_t();
1287 for( int i=0; i<TOTAL_PANES; ++i ) {
1288 if( !pane[i] ) continue;
1289 if( (this_track = pane[i]->over_track()) != 0 ) break;
1290 if( (this_track = pane[i]->over_patchbay()) != 0 ) break;
1293 if( get_keypress() == TAB ) { // Switch the armed button
1295 this_track->armed = !this_track->armed ? 1 : 0;
1298 int total_selected = mwindow->edl->tracks->total_of(Tracks::RECORD);
1299 // all selected if nothing previously selected or
1300 // if this patch was previously the only one selected and armed
1301 int selected = !total_selected || (total_selected == 1 &&
1302 this_track && this_track->armed ) ? 1 : 0;
1303 mwindow->edl->tracks->select_all(Tracks::RECORD, selected);
1304 if( !selected && this_track ) this_track->armed = 1;
1307 update(0, NORMAL_DRAW, 0, 0, 1, 0, 1);
1309 mwindow->cwindow->update(0, 1, 1);
1310 lock_window("MWindowGUI::keypress_event 3");
1315 case KEY_F1 ... KEY_F12:
1316 resend_event(mwindow->cwindow->gui);
1320 // since things under cursor have changed...
1322 cursor_motion_event();
1325 result = context_help_check_and_show();
1330 int MWindowGUI::keyboard_listener(BC_WindowBase *wp)
1332 return key_listener(wp->get_keypress());
1335 int MWindowGUI::key_listener(int key)
1340 if( !record->running() )
1343 record->record_gui->interrupt_thread->start(0);
1350 channel_info->toggle_scan();
1354 if( !remote_control->deactivate() )
1355 remote_control->activate();
1365 void MWindowGUI::use_android_remote(int on)
1368 delete android_control;
1369 android_control = 0;
1372 if( android_control ) return;
1373 android_control = new AndroidControl(this);
1375 int MWindowGUI::keyev_grab_remote()
1377 if( cwindow_remote_handler && cwindow_remote_handler->is_keytv() &&
1378 record_remote_handler && record_remote_handler->is_keytv() )
1380 delete cwindow_remote_handler;
1381 delete record_remote_handler;
1382 cwindow_remote_handler = (RemoteHandler*)
1383 new CWindowKeyEvHandler(mwindow->gui->remote_control);
1384 record_remote_handler = (RemoteHandler*)
1385 new RecordKeyEvHandler(mwindow->gui->remote_control);
1389 int MWindowGUI::close_event()
1395 void MWindowGUI::stop_drawing()
1397 resource_thread->stop_draw(1);
1400 int MWindowGUI::menu_w()
1402 return mainmenu->get_w();
1405 int MWindowGUI::menu_h()
1407 return mainmenu->get_h();
1410 void MWindowGUI::start_x_pane_drag()
1414 x_pane_drag = new BC_Popup(this,
1415 get_abs_cursor_x(0) - mwindow->theme->pane_w,
1416 BC_DisplayInfo::get_top_border() +
1418 mwindow->theme->mcanvas_y,
1419 mwindow->theme->pane_w,
1420 mwindow->theme->mcanvas_h,
1421 mwindow->theme->drag_pane_color);
1422 x_pane_drag->draw_3segmentv(0,
1424 x_pane_drag->get_h(),
1425 mwindow->theme->get_image_set("xpane")[BUTTON_DOWNHI]);
1426 x_pane_drag->flash(1);
1431 void MWindowGUI::start_y_pane_drag()
1435 //printf("MWindowGUI::start_y_pane_drag %d %d %d\n", __LINE__, get_x(), get_y());
1436 y_pane_drag = new BC_Popup(this,
1437 BC_DisplayInfo::get_left_border() +
1439 mwindow->theme->mcanvas_x,
1440 get_abs_cursor_y(0) - mwindow->theme->pane_h,
1441 mwindow->theme->mcanvas_w,
1442 mwindow->theme->pane_h,
1443 mwindow->theme->drag_pane_color);
1444 y_pane_drag->draw_3segmenth(0,
1446 y_pane_drag->get_w(),
1447 mwindow->theme->get_image_set("ypane")[BUTTON_DOWNHI]);
1448 y_pane_drag->flash(1);
1453 void MWindowGUI::handle_pane_drag()
1459 x_pane_drag->reposition_window(
1460 get_abs_cursor_x(0) - mwindow->theme->pane_w,
1461 x_pane_drag->get_y());
1466 y_pane_drag->reposition_window(
1467 y_pane_drag->get_x(),
1468 get_abs_cursor_y(0) - mwindow->theme->pane_h);
1474 void MWindowGUI::create_x_pane(int cursor_x)
1476 if(total_panes() == 1)
1478 // create a horizontal pane
1479 // do this 1st so the resize_event knows there are 2 panes
1480 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] =
1481 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] +
1483 mwindow->theme->patchbay_w;
1484 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
1486 mwindow->theme->mcanvas_x +
1488 mwindow->theme->mcanvas_y,
1489 mwindow->theme->mcanvas_x +
1490 mwindow->theme->mcanvas_w -
1492 mwindow->theme->mcanvas_h);
1493 pane[TOP_LEFT_PANE]->resize_event(
1494 mwindow->theme->mcanvas_x,
1495 mwindow->theme->mcanvas_y,
1496 cursor_x - mwindow->theme->pane_w,
1497 mwindow->theme->mcanvas_h);
1498 pane[TOP_RIGHT_PANE]->create_objects();
1501 if(vertical_panes())
1503 // create 2 horizontal panes
1504 mwindow->edl->local_session->track_start[TOP_RIGHT_PANE] =
1505 mwindow->edl->local_session->track_start[TOP_LEFT_PANE];
1506 mwindow->edl->local_session->track_start[BOTTOM_RIGHT_PANE] =
1507 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE];
1508 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] =
1509 mwindow->edl->local_session->view_start[BOTTOM_RIGHT_PANE] =
1510 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] +
1512 mwindow->theme->patchbay_w;
1513 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
1515 mwindow->theme->mcanvas_x +
1517 pane[TOP_LEFT_PANE]->y,
1518 mwindow->theme->mcanvas_x +
1519 mwindow->theme->mcanvas_w -
1521 pane[TOP_LEFT_PANE]->h);
1522 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
1524 mwindow->theme->mcanvas_x +
1526 pane[BOTTOM_LEFT_PANE]->y,
1527 mwindow->theme->mcanvas_x +
1528 mwindow->theme->mcanvas_w -
1530 pane[BOTTOM_LEFT_PANE]->h);
1531 pane[TOP_LEFT_PANE]->resize_event(
1532 pane[TOP_LEFT_PANE]->x,
1533 pane[TOP_LEFT_PANE]->y,
1534 cursor_x - mwindow->theme->pane_w,
1535 pane[TOP_LEFT_PANE]->h);
1536 pane[BOTTOM_LEFT_PANE]->resize_event(
1537 pane[BOTTOM_LEFT_PANE]->x,
1538 pane[BOTTOM_LEFT_PANE]->y,
1539 cursor_x - mwindow->theme->pane_w,
1540 pane[BOTTOM_LEFT_PANE]->h);
1541 pane[TOP_RIGHT_PANE]->create_objects();
1542 pane[BOTTOM_RIGHT_PANE]->create_objects();
1545 if(horizontal_panes())
1547 // resize a horizontal pane
1548 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] +=
1550 pane[TOP_RIGHT_PANE]->x;
1551 if(mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] < 0)
1552 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] = 0;
1553 pane[TOP_LEFT_PANE]->resize_event(
1554 mwindow->theme->mcanvas_x,
1555 mwindow->theme->mcanvas_y,
1556 cursor_x - mwindow->theme->pane_w,
1557 mwindow->theme->mcanvas_h);
1558 pane[TOP_RIGHT_PANE]->resize_event(
1559 mwindow->theme->mcanvas_x +
1561 pane[TOP_RIGHT_PANE]->y,
1562 mwindow->theme->mcanvas_x +
1563 mwindow->theme->mcanvas_w -
1565 mwindow->theme->mcanvas_h);
1569 // resize 2 horizontal panes
1570 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] +=
1572 pane[TOP_RIGHT_PANE]->x;
1573 if(mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] < 0)
1574 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] = 0;
1575 mwindow->edl->local_session->view_start[BOTTOM_RIGHT_PANE] =
1576 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE];
1578 pane[TOP_LEFT_PANE]->resize_event(
1579 mwindow->theme->mcanvas_x,
1580 pane[TOP_LEFT_PANE]->y,
1581 cursor_x - mwindow->theme->pane_w,
1582 pane[TOP_LEFT_PANE]->h);
1583 pane[TOP_RIGHT_PANE]->resize_event(
1584 mwindow->theme->mcanvas_x +
1586 pane[TOP_RIGHT_PANE]->y,
1587 mwindow->theme->mcanvas_x +
1588 mwindow->theme->mcanvas_w -
1590 pane[TOP_RIGHT_PANE]->h);
1591 pane[BOTTOM_LEFT_PANE]->resize_event(
1592 mwindow->theme->mcanvas_x,
1593 pane[BOTTOM_LEFT_PANE]->y,
1594 cursor_x - mwindow->theme->pane_w,
1595 pane[BOTTOM_LEFT_PANE]->h);
1596 pane[BOTTOM_RIGHT_PANE]->resize_event(
1597 mwindow->theme->mcanvas_x +
1599 pane[BOTTOM_RIGHT_PANE]->y,
1600 mwindow->theme->mcanvas_x +
1601 mwindow->theme->mcanvas_w -
1603 pane[BOTTOM_RIGHT_PANE]->h);
1609 void MWindowGUI::delete_x_pane(int cursor_x)
1611 // give left panes coordinates of right pane
1612 if(cursor_x < mwindow->theme->patchbay_w + PANE_DRAG_MARGIN &&
1613 pane[TOP_RIGHT_PANE])
1615 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] =
1616 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE] -
1617 pane[TOP_RIGHT_PANE]->x + mwindow->theme->patchbay_w;
1618 if(mwindow->edl->local_session->view_start[TOP_LEFT_PANE] < 0)
1619 mwindow->edl->local_session->view_start[TOP_LEFT_PANE] = 0;
1620 mwindow->edl->local_session->view_start[BOTTOM_LEFT_PANE] =
1621 mwindow->edl->local_session->view_start[TOP_LEFT_PANE];
1624 switch(total_panes())
1627 if(pane[TOP_LEFT_PANE] && pane[TOP_RIGHT_PANE])
1629 // delete right pane
1630 delete pane[TOP_RIGHT_PANE];
1631 pane[TOP_RIGHT_PANE] = 0;
1632 pane[TOP_LEFT_PANE]->resize_event(
1633 mwindow->theme->mcanvas_x,
1634 mwindow->theme->mcanvas_y,
1635 mwindow->theme->mcanvas_w,
1636 mwindow->theme->mcanvas_h);
1642 // delete right panes
1643 delete pane[TOP_RIGHT_PANE];
1644 pane[TOP_RIGHT_PANE] = 0;
1645 delete pane[BOTTOM_RIGHT_PANE];
1646 pane[BOTTOM_RIGHT_PANE] = 0;
1647 pane[TOP_LEFT_PANE]->resize_event(
1648 mwindow->theme->mcanvas_x,
1649 pane[TOP_LEFT_PANE]->y,
1650 mwindow->theme->mcanvas_w,
1651 pane[TOP_LEFT_PANE]->h);
1652 pane[BOTTOM_LEFT_PANE]->resize_event(
1653 mwindow->theme->mcanvas_x,
1654 pane[BOTTOM_LEFT_PANE]->y,
1655 mwindow->theme->mcanvas_w,
1656 pane[BOTTOM_LEFT_PANE]->h);
1661 void MWindowGUI::create_y_pane(int cursor_y)
1663 if(total_panes() == 1)
1665 mwindow->edl->local_session->view_start[BOTTOM_LEFT_PANE] =
1666 mwindow->edl->local_session->view_start[TOP_LEFT_PANE];
1667 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] =
1668 mwindow->edl->local_session->track_start[TOP_LEFT_PANE] +
1670 mwindow->theme->mtimebar_h;
1671 // do this 1st so the resize_event knows there are 2 panes
1672 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
1674 mwindow->theme->mcanvas_x,
1675 mwindow->theme->mcanvas_y +
1677 mwindow->theme->mcanvas_w,
1678 mwindow->theme->mcanvas_h -
1680 pane[TOP_LEFT_PANE]->resize_event(
1681 mwindow->theme->mcanvas_x,
1682 mwindow->theme->mcanvas_y,
1683 mwindow->theme->mcanvas_w,
1684 pane[BOTTOM_LEFT_PANE]->y -
1685 mwindow->theme->mcanvas_y -
1686 mwindow->theme->pane_h);
1687 pane[BOTTOM_LEFT_PANE]->create_objects();
1690 if(horizontal_panes())
1693 mwindow->edl->local_session->view_start[BOTTOM_LEFT_PANE] =
1694 mwindow->edl->local_session->view_start[TOP_LEFT_PANE];
1695 mwindow->edl->local_session->view_start[BOTTOM_RIGHT_PANE] =
1696 mwindow->edl->local_session->view_start[TOP_RIGHT_PANE];
1697 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] =
1698 mwindow->edl->local_session->track_start[BOTTOM_RIGHT_PANE] =
1699 mwindow->edl->local_session->track_start[TOP_LEFT_PANE] +
1701 mwindow->theme->mtimebar_h;
1703 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
1705 pane[TOP_LEFT_PANE]->x,
1706 mwindow->theme->mcanvas_y +
1708 pane[TOP_LEFT_PANE]->w,
1709 mwindow->theme->mcanvas_h -
1711 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
1713 pane[TOP_RIGHT_PANE]->x,
1714 mwindow->theme->mcanvas_y +
1716 pane[TOP_RIGHT_PANE]->w,
1717 mwindow->theme->mcanvas_h -
1720 pane[TOP_LEFT_PANE]->resize_event(
1721 pane[TOP_LEFT_PANE]->x,
1722 pane[TOP_LEFT_PANE]->y,
1723 pane[TOP_LEFT_PANE]->w,
1724 pane[BOTTOM_LEFT_PANE]->y -
1725 mwindow->theme->mcanvas_y -
1726 mwindow->theme->pane_h);
1727 pane[TOP_RIGHT_PANE]->resize_event(
1728 pane[TOP_RIGHT_PANE]->x,
1729 pane[TOP_RIGHT_PANE]->y,
1730 pane[TOP_RIGHT_PANE]->w,
1731 pane[BOTTOM_RIGHT_PANE]->y -
1732 mwindow->theme->mcanvas_y -
1733 mwindow->theme->pane_h);
1735 pane[BOTTOM_LEFT_PANE]->create_objects();
1736 pane[BOTTOM_RIGHT_PANE]->create_objects();
1739 if(vertical_panes())
1742 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] +=
1744 (pane[BOTTOM_LEFT_PANE]->y - mwindow->theme->mcanvas_y);
1745 if(mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] < 0)
1746 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] = 0;
1747 pane[TOP_LEFT_PANE]->resize_event(
1748 mwindow->theme->mcanvas_x,
1749 mwindow->theme->mcanvas_y,
1750 mwindow->theme->mcanvas_w,
1751 cursor_y - mwindow->theme->pane_h);
1752 pane[BOTTOM_LEFT_PANE]->resize_event(
1753 pane[BOTTOM_LEFT_PANE]->x,
1755 mwindow->theme->mcanvas_y,
1756 mwindow->theme->mcanvas_w,
1757 mwindow->theme->mcanvas_h -
1763 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] +=
1765 (pane[BOTTOM_LEFT_PANE]->y - mwindow->theme->mcanvas_y);
1766 if(mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] < 0)
1767 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] = 0;
1768 mwindow->edl->local_session->track_start[BOTTOM_RIGHT_PANE] =
1769 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE];
1770 pane[TOP_LEFT_PANE]->resize_event(
1771 pane[TOP_LEFT_PANE]->x,
1772 pane[TOP_LEFT_PANE]->y,
1773 pane[TOP_LEFT_PANE]->w,
1774 cursor_y - mwindow->theme->pane_h);
1775 pane[BOTTOM_LEFT_PANE]->resize_event(
1776 pane[BOTTOM_LEFT_PANE]->x,
1778 mwindow->theme->mcanvas_y,
1779 pane[BOTTOM_LEFT_PANE]->w,
1780 mwindow->theme->mcanvas_h -
1782 pane[TOP_RIGHT_PANE]->resize_event(
1783 pane[TOP_RIGHT_PANE]->x,
1784 pane[TOP_RIGHT_PANE]->y,
1785 pane[TOP_RIGHT_PANE]->w,
1786 cursor_y - mwindow->theme->pane_h);
1787 pane[BOTTOM_RIGHT_PANE]->resize_event(
1788 pane[BOTTOM_RIGHT_PANE]->x,
1790 mwindow->theme->mcanvas_y,
1791 pane[BOTTOM_RIGHT_PANE]->w,
1792 mwindow->theme->mcanvas_h -
1797 void MWindowGUI::delete_y_pane(int cursor_y)
1799 if(cursor_y < mwindow->theme->mtimebar_h +
1801 pane[BOTTOM_LEFT_PANE])
1803 // give top pane coordinates of bottom pane
1804 mwindow->edl->local_session->track_start[TOP_LEFT_PANE] =
1805 mwindow->edl->local_session->track_start[BOTTOM_LEFT_PANE] -
1806 pane[BOTTOM_LEFT_PANE]->y;
1807 if(mwindow->edl->local_session->track_start[TOP_LEFT_PANE] < 0)
1808 mwindow->edl->local_session->track_start[TOP_LEFT_PANE] = 0;
1809 mwindow->edl->local_session->track_start[TOP_RIGHT_PANE] =
1810 mwindow->edl->local_session->track_start[TOP_LEFT_PANE];
1814 switch(total_panes())
1817 delete pane[BOTTOM_LEFT_PANE];
1818 pane[BOTTOM_LEFT_PANE] = 0;
1819 pane[TOP_LEFT_PANE]->resize_event(
1820 mwindow->theme->mcanvas_x,
1821 mwindow->theme->mcanvas_y,
1822 mwindow->theme->mcanvas_w,
1823 mwindow->theme->mcanvas_h);
1827 // delete bottom 2 panes
1829 delete pane[BOTTOM_LEFT_PANE];
1830 pane[BOTTOM_LEFT_PANE] = 0;
1831 delete pane[BOTTOM_RIGHT_PANE];
1832 pane[BOTTOM_RIGHT_PANE] = 0;
1833 pane[TOP_LEFT_PANE]->resize_event(
1834 pane[TOP_LEFT_PANE]->x,
1835 mwindow->theme->mcanvas_y,
1836 pane[TOP_LEFT_PANE]->w,
1837 mwindow->theme->mcanvas_h);
1838 pane[TOP_RIGHT_PANE]->resize_event(
1839 pane[TOP_RIGHT_PANE]->x,
1840 mwindow->theme->mcanvas_y,
1841 pane[TOP_RIGHT_PANE]->w,
1842 mwindow->theme->mcanvas_h);
1847 void MWindowGUI::stop_pane_drag()
1849 if( !dragging_pane ) return;
1851 resource_thread->stop_draw(0);
1855 // cursor position relative to canvas
1856 int cursor_x = x_pane_drag->get_x() -
1858 BC_DisplayInfo::get_left_border() -
1859 mwindow->theme->mcanvas_x +
1860 mwindow->theme->pane_w;
1865 if(cursor_x >= mwindow->theme->patchbay_w + PANE_DRAG_MARGIN &&
1866 cursor_x < mwindow->theme->mcanvas_w -
1867 BC_ScrollBar::get_span(SCROLL_VERT) -
1870 create_x_pane(cursor_x);
1871 mwindow->edl->local_session->x_pane = cursor_x;
1876 delete_x_pane(cursor_x);
1877 mwindow->edl->local_session->x_pane = -1;
1885 // cursor position relative to canvas
1886 int cursor_y = y_pane_drag->get_y() -
1888 BC_DisplayInfo::get_top_border() -
1889 mwindow->theme->mcanvas_y +
1890 mwindow->theme->pane_h;
1896 if(cursor_y >= mwindow->theme->mtimebar_h +
1898 cursor_y < mwindow->theme->mcanvas_h -
1899 BC_ScrollBar::get_span(SCROLL_HORIZ) -
1902 create_y_pane(cursor_y);
1903 mwindow->edl->local_session->y_pane = cursor_y;
1907 delete_y_pane(cursor_y);
1908 mwindow->edl->local_session->y_pane = -1;
1912 update_pane_dividers();
1914 // required to get new widgets to appear
1916 resource_thread->start_draw();
1919 // create panes from EDL
1920 void MWindowGUI::load_panes()
1922 int need_x_panes = 0;
1923 int need_y_panes = 0;
1924 // use names from create functions
1925 int cursor_x = mwindow->edl->local_session->x_pane;
1926 int cursor_y = mwindow->edl->local_session->y_pane;
1928 resource_thread->stop_draw(1);
1930 mwindow->theme->patchbay_w + PANE_DRAG_MARGIN &&
1932 mwindow->theme->mcanvas_w -
1933 BC_ScrollBar::get_span(SCROLL_VERT) -
1940 mwindow->theme->mtimebar_h + PANE_DRAG_MARGIN &&
1942 mwindow->theme->mcanvas_h -
1943 BC_ScrollBar::get_span(SCROLL_HORIZ) -
1949 //printf("MWindowGUI::load_panes %d %d %d\n", __LINE__, need_x_panes, need_y_panes);
1957 if(total_panes() == 1)
1960 //printf("MWindowGUI::load_panes %d\n", __LINE__);
1961 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
1963 mwindow->theme->mcanvas_x +
1965 mwindow->theme->mcanvas_y,
1966 mwindow->theme->mcanvas_x +
1967 mwindow->theme->mcanvas_w -
1969 cursor_y - mwindow->theme->pane_h);
1970 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
1972 mwindow->theme->mcanvas_x,
1973 mwindow->theme->mcanvas_y +
1975 cursor_x - mwindow->theme->pane_w,
1976 mwindow->theme->mcanvas_h -
1978 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
1980 pane[TOP_RIGHT_PANE]->x,
1981 mwindow->theme->mcanvas_y +
1983 pane[TOP_RIGHT_PANE]->w,
1984 mwindow->theme->mcanvas_h -
1986 pane[TOP_LEFT_PANE]->resize_event(
1987 pane[TOP_LEFT_PANE]->x,
1988 pane[TOP_LEFT_PANE]->y,
1989 cursor_x - mwindow->theme->pane_w,
1990 cursor_y - mwindow->theme->pane_h);
1991 pane[TOP_RIGHT_PANE]->create_objects();
1992 pane[BOTTOM_LEFT_PANE]->create_objects();
1993 pane[BOTTOM_RIGHT_PANE]->create_objects();
1996 if(horizontal_panes())
1998 // create vertical panes
1999 //printf("MWindowGUI::load_panes %d\n", __LINE__);
2000 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
2002 mwindow->theme->mcanvas_x,
2003 mwindow->theme->mcanvas_y +
2005 cursor_x - mwindow->theme->pane_w,
2006 mwindow->theme->mcanvas_h -
2008 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
2010 pane[TOP_RIGHT_PANE]->x,
2011 mwindow->theme->mcanvas_y +
2013 pane[TOP_RIGHT_PANE]->w,
2014 mwindow->theme->mcanvas_h -
2016 pane[TOP_LEFT_PANE]->resize_event(
2017 pane[TOP_LEFT_PANE]->x,
2018 pane[TOP_LEFT_PANE]->y,
2019 cursor_x - mwindow->theme->pane_w,
2020 cursor_y - mwindow->theme->pane_h);
2021 pane[TOP_RIGHT_PANE]->resize_event(
2022 mwindow->theme->mcanvas_x +
2024 mwindow->theme->mcanvas_y,
2025 mwindow->theme->mcanvas_x +
2026 mwindow->theme->mcanvas_w -
2028 cursor_y - mwindow->theme->pane_h);
2029 pane[BOTTOM_LEFT_PANE]->create_objects();
2030 pane[BOTTOM_RIGHT_PANE]->create_objects();
2033 if(vertical_panes())
2035 // create horizontal panes
2036 //printf("MWindowGUI::load_panes %d\n", __LINE__);
2037 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
2039 mwindow->theme->mcanvas_x +
2041 mwindow->theme->mcanvas_y,
2042 mwindow->theme->mcanvas_x +
2043 mwindow->theme->mcanvas_w -
2045 cursor_y - mwindow->theme->pane_h);
2046 pane[BOTTOM_RIGHT_PANE] = new TimelinePane(mwindow,
2048 pane[TOP_RIGHT_PANE]->x,
2049 mwindow->theme->mcanvas_y +
2051 pane[TOP_RIGHT_PANE]->w,
2052 mwindow->theme->mcanvas_h -
2054 pane[TOP_LEFT_PANE]->resize_event(
2055 pane[TOP_LEFT_PANE]->x,
2056 pane[TOP_LEFT_PANE]->y,
2057 cursor_x - mwindow->theme->pane_w,
2058 cursor_y - mwindow->theme->pane_h);
2059 pane[BOTTOM_LEFT_PANE]->resize_event(
2060 pane[TOP_LEFT_PANE]->x,
2061 mwindow->theme->mcanvas_y +
2063 mwindow->theme->mcanvas_x +
2064 mwindow->theme->mcanvas_w -
2065 cursor_x - mwindow->theme->pane_w,
2066 mwindow->theme->mcanvas_h -
2068 pane[TOP_RIGHT_PANE]->create_objects();
2069 pane[BOTTOM_RIGHT_PANE]->create_objects();
2076 //printf("MWindowGUI::load_panes %d\n", __LINE__);
2077 pane[TOP_LEFT_PANE]->resize_event(
2078 pane[TOP_LEFT_PANE]->x,
2079 pane[TOP_LEFT_PANE]->y,
2080 cursor_x - mwindow->theme->pane_w,
2081 cursor_y - mwindow->theme->pane_h);
2082 pane[TOP_RIGHT_PANE]->resize_event(
2083 mwindow->theme->mcanvas_x +
2085 mwindow->theme->mcanvas_y,
2086 mwindow->theme->mcanvas_x +
2087 mwindow->theme->mcanvas_w -
2089 cursor_y - mwindow->theme->pane_h);
2090 pane[BOTTOM_LEFT_PANE]->resize_event(
2091 pane[TOP_LEFT_PANE]->x,
2092 mwindow->theme->mcanvas_y +
2094 mwindow->theme->mcanvas_x +
2095 mwindow->theme->mcanvas_w -
2096 cursor_x - mwindow->theme->pane_w,
2097 mwindow->theme->mcanvas_h -
2099 pane[BOTTOM_RIGHT_PANE]->resize_event(
2100 pane[TOP_RIGHT_PANE]->x,
2101 mwindow->theme->mcanvas_y +
2103 pane[TOP_RIGHT_PANE]->w,
2104 mwindow->theme->mcanvas_h -
2113 if(pane[BOTTOM_LEFT_PANE]) delete pane[BOTTOM_LEFT_PANE];
2114 if(pane[BOTTOM_RIGHT_PANE]) delete pane[BOTTOM_RIGHT_PANE];
2115 pane[BOTTOM_LEFT_PANE] = 0;
2116 pane[BOTTOM_RIGHT_PANE] = 0;
2118 if(!pane[TOP_RIGHT_PANE])
2120 pane[TOP_RIGHT_PANE] = new TimelinePane(mwindow,
2122 mwindow->theme->mcanvas_x +
2124 mwindow->theme->mcanvas_y,
2125 mwindow->theme->mcanvas_x +
2126 mwindow->theme->mcanvas_w -
2128 mwindow->theme->mcanvas_h);
2129 pane[TOP_LEFT_PANE]->resize_event(
2130 mwindow->theme->mcanvas_x,
2131 mwindow->theme->mcanvas_y,
2132 cursor_x - mwindow->theme->pane_w,
2133 mwindow->theme->mcanvas_h);
2134 pane[TOP_RIGHT_PANE]->create_objects();
2138 pane[TOP_LEFT_PANE]->resize_event(
2139 mwindow->theme->mcanvas_x,
2140 mwindow->theme->mcanvas_y,
2141 cursor_x - mwindow->theme->pane_w,
2142 mwindow->theme->mcanvas_h);
2143 pane[TOP_RIGHT_PANE]->resize_event(
2144 mwindow->theme->mcanvas_x +
2146 pane[TOP_RIGHT_PANE]->y,
2147 mwindow->theme->mcanvas_x +
2148 mwindow->theme->mcanvas_w -
2150 mwindow->theme->mcanvas_h);
2158 if(pane[TOP_RIGHT_PANE]) delete pane[TOP_RIGHT_PANE];
2159 if(pane[BOTTOM_RIGHT_PANE]) delete pane[BOTTOM_RIGHT_PANE];
2160 pane[TOP_RIGHT_PANE] = 0;
2161 pane[BOTTOM_RIGHT_PANE] = 0;
2163 if(!pane[BOTTOM_LEFT_PANE])
2165 //printf("MWindowGUI::load_panes %d\n", __LINE__);
2166 pane[BOTTOM_LEFT_PANE] = new TimelinePane(mwindow,
2168 mwindow->theme->mcanvas_x,
2169 mwindow->theme->mcanvas_y +
2171 mwindow->theme->mcanvas_w,
2172 mwindow->theme->mcanvas_h -
2174 pane[TOP_LEFT_PANE]->resize_event(
2175 mwindow->theme->mcanvas_x,
2176 mwindow->theme->mcanvas_y,
2177 mwindow->theme->mcanvas_w,
2178 pane[BOTTOM_LEFT_PANE]->y -
2179 mwindow->theme->mcanvas_y -
2180 mwindow->theme->pane_h);
2181 pane[BOTTOM_LEFT_PANE]->create_objects();
2185 pane[TOP_LEFT_PANE]->resize_event(
2186 mwindow->theme->mcanvas_x,
2187 mwindow->theme->mcanvas_y,
2188 mwindow->theme->mcanvas_w,
2189 cursor_y - mwindow->theme->pane_h);
2190 pane[BOTTOM_LEFT_PANE]->resize_event(
2191 pane[BOTTOM_LEFT_PANE]->x,
2193 mwindow->theme->mcanvas_y,
2194 mwindow->theme->mcanvas_w,
2195 mwindow->theme->mcanvas_h -
2202 if(pane[TOP_RIGHT_PANE]) delete pane[TOP_RIGHT_PANE];
2203 if(pane[BOTTOM_RIGHT_PANE]) delete pane[BOTTOM_RIGHT_PANE];
2204 if(pane[BOTTOM_LEFT_PANE]) delete pane[BOTTOM_LEFT_PANE];
2205 pane[TOP_RIGHT_PANE] = 0;
2206 pane[BOTTOM_RIGHT_PANE] = 0;
2207 pane[BOTTOM_LEFT_PANE] = 0;
2208 pane[TOP_LEFT_PANE]->resize_event(
2209 mwindow->theme->mcanvas_x,
2210 mwindow->theme->mcanvas_y,
2211 mwindow->theme->mcanvas_w,
2212 mwindow->theme->mcanvas_h);
2215 update_pane_dividers();
2218 resource_thread->start_draw();
2221 void MWindowGUI::update_pane_dividers()
2224 if(horizontal_panes() || total_panes() == 4)
2226 int x = pane[TOP_RIGHT_PANE]->x - mwindow->theme->pane_w;
2227 int y = mwindow->theme->mcanvas_y;
2228 int h = mwindow->theme->mcanvas_h;
2232 add_subwindow(x_divider = new PaneDivider(
2233 mwindow, x, y, h, 1));
2234 x_divider->create_objects();
2238 x_divider->reposition_window(x, y, h);
2251 if(vertical_panes() || total_panes() == 4)
2253 int x = mwindow->theme->mcanvas_x;
2254 int y = pane[BOTTOM_LEFT_PANE]->y -
2255 mwindow->theme->pane_h;
2256 int w = mwindow->theme->mcanvas_w;
2259 add_subwindow(y_divider = new PaneDivider(
2260 mwindow, x, y, w, 0));
2261 y_divider->create_objects();
2265 y_divider->reposition_window(x, y, w);
2279 void MWindowGUI::draw_samplemovement()
2286 update_scrollbars(1);
2289 void MWindowGUI::draw_trackmovement()
2291 update_scrollbars(0);
2298 void MWindowGUI::update_mixers(Track *track, int v)
2300 for( int i=0; i<TOTAL_PANES; ++i ) {
2301 if( !pane[i] ) continue;
2302 PatchBay *patchbay = pane[i]->patchbay;
2303 if( !patchbay ) continue;
2304 for( int j=0; j<patchbay->patches.total; ++j ) {
2305 PatchGUI *patchgui = patchbay->patches.values[j];
2306 if( !patchgui->mix ) continue;
2307 if( !track || patchgui->track == track ) {
2308 patchgui->mix->update(v>=0 ? v :
2309 mwindow->mixer_track_active(patchgui->track));
2315 void MWindowGUI::stop_transport(const char *lock_msg)
2317 if( !mbuttons->transport->is_stopped() ) {
2318 if( lock_msg ) unlock_window();
2319 mbuttons->transport->handle_transport(STOP, 1);
2320 if( lock_msg ) lock_window(lock_msg);
2324 void MWindowGUI::close_keyvalue_popup()
2326 if( !keyvalue_popup ) return;
2327 delete keyvalue_popup;
2331 void MWindowGUI::open_keyvalue_popup(BC_SubWindow *popup)
2333 close_keyvalue_popup();
2334 keyvalue_popup = popup;
2337 PaneButton::PaneButton(MWindow *mwindow, int x, int y)
2338 : BC_Button(x, y, mwindow->theme->get_image_set("pane"))
2340 this->mwindow = mwindow;
2343 int PaneButton::cursor_motion_event()
2345 if(get_top_level()->get_button_down() &&
2347 get_status() == BUTTON_DOWNHI &&
2350 // printf("PaneButton::cursor_motion_event %d\n", __LINE__);
2352 if(get_cursor_x() < 0 && !mwindow->gui->dragging_pane)
2354 mwindow->gui->start_x_pane_drag();
2357 if(get_cursor_y() < 0 && !mwindow->gui->dragging_pane)
2359 mwindow->gui->start_y_pane_drag();
2363 mwindow->gui->handle_pane_drag();
2365 int result = BC_Button::cursor_motion_event();
2369 int PaneButton::button_release_event()
2371 if( get_buttonpress() != WHEEL_DOWN && get_buttonpress() != WHEEL_UP )
2372 mwindow->gui->stop_pane_drag();
2373 int result = BC_Button::button_release_event();
2378 FFMpegToggle::FFMpegToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y)
2379 : BC_Toggle(x, y, mwindow->theme->ffmpeg_toggle,
2380 mwindow->preferences->get_file_probe_armed("FFMPEG_Early") > 0 ? 1 : 0)
2382 this->mwindow = mwindow;
2383 this->mbuttons = mbuttons;
2384 set_tooltip(get_value() ? FFMPEG_EARLY_TIP : FFMPEG_LATE_TIP);
2385 // *** CONTEXT_HELP ***
2386 context_help_set_keyword("FFmpeg Early Probe Explanation");
2389 FFMpegToggle::~FFMpegToggle()
2393 int FFMpegToggle::handle_event()
2395 int ffmpeg_early_probe = get_value();
2396 set_tooltip(ffmpeg_early_probe ? FFMPEG_EARLY_TIP : FFMPEG_LATE_TIP);
2397 mwindow->preferences->set_file_probe_armed("FFMPEG_Early", ffmpeg_early_probe);
2398 mwindow->preferences->set_file_probe_armed("FFMPEG_Late", !ffmpeg_early_probe);
2399 mwindow->update_preferences(mwindow->preferences);
2400 mwindow->show_warning(&mwindow->preferences->warn_indexes,
2401 _("Changing the base codecs may require rebuilding indexes."));
2406 StackButton::StackButton(MWindow *mwindow, int x, int y)
2407 : BC_GenericButton(x, y, mwindow->theme->stack_button_w, "0")
2409 this->mwindow = mwindow;
2410 set_tooltip(_("Close EDL"));
2411 // *** CONTEXT_HELP ***
2412 context_help_set_keyword("OpenEDL");
2415 int StackButton::handle_event()
2417 mwindow->save_backup();
2418 mwindow->stack_pop();
2422 void StackButton::update()
2424 char text[BCSTRLEN];
2425 int i = mwindow->stack.size();
2426 sprintf(text, "%d", i);
2432 ProxyToggle::ProxyToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y)
2433 : BC_Toggle(x, y, ( !mwindow->edl->session->proxy_use_scaler ?
2434 mwindow->theme->proxy_p_toggle :
2435 mwindow->theme->proxy_s_toggle ),
2436 mwindow->edl->session->proxy_state == PROXY_DISABLED)
2438 this->mwindow = mwindow;
2439 this->mbuttons = mbuttons;
2440 scaler_images = mwindow->edl->session->proxy_use_scaler;
2441 set_tooltip(mwindow->edl->session->proxy_state!=PROXY_DISABLED ?
2442 _("Disable proxy") : _("Enable proxy"));
2443 // *** CONTEXT_HELP ***
2444 context_help_set_keyword("Proxy");
2447 void ProxyToggle::show()
2449 int use_scaler = mwindow->edl->session->proxy_use_scaler;
2450 if( scaler_images != use_scaler )
2451 set_images(!(scaler_images=use_scaler) ?
2452 mwindow->theme->proxy_p_toggle :
2453 mwindow->theme->proxy_s_toggle );
2459 void ProxyToggle::hide()
2465 ProxyToggle::~ProxyToggle()
2469 int ProxyToggle::handle_event()
2471 int disabled = get_value();
2472 mwindow->gui->unlock_window();
2474 mwindow->disable_proxy();
2476 mwindow->enable_proxy();
2477 mwindow->gui->lock_window("ProxyToggle::handle_event");
2478 set_tooltip(!disabled ? _("Disable proxy") : _("Enable proxy"));
2479 ProxyDialog *dialog = mwindow->gui->mainmenu->proxy->dialog;
2480 if( dialog && dialog->gui ) {
2481 dialog->gui->lock_window("ProxyToggle::handle_event");
2482 dialog->gui->update();
2483 dialog->gui->unlock_window();
2488 int ProxyToggle::keypress_event()
2490 if( ctrl_down() && !shift_down() && !alt_down() ) {
2491 int key = get_keypress();
2493 int value = get_value() ? 0 : 1;
2495 return handle_event();
2498 return context_help_check_and_show();