X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fremotecontrol.C;h=5e1df35d8095127b4469f37efe58e820e98db8ce;hb=def7a2e3e4f053af598be006210a4cd29d984305;hp=1fa93d9c215b5658565ddc1401ad17729fd43d29;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/remotecontrol.C b/cinelerra-5.1/cinelerra/remotecontrol.C index 1fa93d9c..5e1df35d 100644 --- a/cinelerra-5.1/cinelerra/remotecontrol.C +++ b/cinelerra-5.1/cinelerra/remotecontrol.C @@ -1,3 +1,22 @@ +/* + * CINELERRA + * Copyright (C) 2016-2020 William Morrow + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ #include "bccolors.h" #include "mainsession.h" @@ -9,9 +28,11 @@ RemoteWindow::RemoteWindow(RemoteControl *remote_control) : BC_Window(_(PROGRAM_NAME ": RemoteWindow"), - 0, 0, 16, 16, -1, -1, 1, 0, 1) + 0, 0, xS(16), yS(16), -1, -1, 1, 0, 1) { this->remote_control = remote_control; +// *** CONTEXT_HELP *** + context_help_set_keyword("Remote Control for DVB"); } RemoteWindow::~RemoteWindow() @@ -53,14 +74,18 @@ RemoteControl::~RemoteControl() int RemoteControl::activate(RemoteHandler *handler) { int result = 0; - active_lock->lock("RemoteControl::activate"); - if( !is_active() ) { - if( !handler ) handler = !mwindow_gui->record->running() ? + deactivate(); + if( !handler ) + handler = !mwindow_gui->record->running() ? (RemoteHandler *)mwindow_gui->cwindow_remote_handler : (RemoteHandler *)mwindow_gui->record_remote_handler ; + active_lock->lock("RemoteControl::activate"); + if( handler ) { + gui->lock_window("RemoteControl::activate"); gui->set_active(handler); gui->set_color(handler->color); gui->fill_color(handler->color); + gui->unlock_window(); result = 1; } active_lock->unlock(); @@ -70,19 +95,21 @@ int RemoteControl::activate(RemoteHandler *handler) int RemoteControl::deactivate() { int result = 0; - active_lock->lock("RemoteControl::deactivate"); if( is_active() ) { - gui->set_inactive(); - result = 1; + active_lock->lock("RemoteControl::deactivate"); + if( is_active() ) { + gui->set_inactive(); + result = 1; + } + active_lock->unlock(); } - active_lock->unlock(); return result; } int RemoteControl::remote_key(int key) { if( !is_active() ) return 0; - return handler->remote_process_key(this, key); + return handler->remote_key(key); } void RemoteControl::set_color(int color) @@ -100,7 +127,8 @@ void RemoteControl::fill_color(int color) } RemoteGUI::RemoteGUI(BC_WindowBase *wdw, RemoteControl *remote_control) - : BC_Popup(wdw, remote_control->mwindow_gui->mwindow->session->mwindow_x,0,16,16, -1, 1) + : BC_Popup(wdw, remote_control->mwindow_gui->mwindow->session->mwindow_x,0, + xS(16),yS(16), -1, 1) { this->remote_control = remote_control; } @@ -169,8 +197,7 @@ int RemoteGUI::keypress_event() return result; } -RemoteHandler:: -RemoteHandler(RemoteGUI *gui, int color) +RemoteHandler::RemoteHandler(RemoteGUI *gui, int color) { this->gui = gui; this->color = color; @@ -180,4 +207,14 @@ RemoteHandler::~RemoteHandler() { } +int RemoteHandler::remote_key(int key) +{ + gui->set_inactive(); + return -1; +} + +int RemoteHandler::process_key(int key) +{ + return -1; +}