2019-09-23 16:49:06 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005-2007 Doug McLain <doug@nostar.net>
|
|
|
|
* Copyright (C) 2005-2017 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
* Copyright (C) 2005-2019 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
|
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2006-2015 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2008-2010 Sakari Bergen <sakari.bergen@beatwaves.net>
|
|
|
|
* Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2013-2015 Colin Fletcher <colin.m.fletcher@googlemail.com>
|
|
|
|
* Copyright (C) 2013-2016 John Emmas <john@creativepost.co.uk>
|
|
|
|
* Copyright (C) 2013-2016 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
* Copyright (C) 2015 André Nusser <andre.nusser@googlemail.com>
|
|
|
|
* Copyright (C) 2016-2018 Len Ovens <len@ovenwerks.net>
|
|
|
|
* Copyright (C) 2017 Johannes Mueller <github@johannes-mueller.org>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "gtk2ardour-config.h"
|
|
|
|
#include "gtk2ardour-version.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ardour/monitor_processor.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/route.h"
|
|
|
|
|
|
|
|
#include "actions.h"
|
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "audio_clock.h"
|
|
|
|
#include "gui_thread.h"
|
|
|
|
#include "main_clock.h"
|
|
|
|
#include "public_editor.h"
|
|
|
|
#include "ui_config.h"
|
|
|
|
|
2019-09-26 00:11:30 -04:00
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
2019-09-23 16:49:06 -04:00
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace PBD;
|
|
|
|
using namespace Gtkmm2ext;
|
|
|
|
using namespace ArdourWidgets;
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace std;
|
|
|
|
using namespace Editing;
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::cancel_solo ()
|
|
|
|
{
|
|
|
|
if (_session) {
|
|
|
|
_session->cancel_all_solo ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::reset_focus (Gtk::Widget* w)
|
|
|
|
{
|
|
|
|
/* this resets focus to the first focusable parent of the given widget,
|
|
|
|
* or, if there is no focusable parent, cancels focus in the toplevel
|
|
|
|
* window that the given widget is packed into (if there is one).
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!w) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Gtk::Widget* top = w->get_toplevel();
|
|
|
|
|
2022-01-26 17:08:55 -05:00
|
|
|
if (!top || !top->get_is_toplevel()) {
|
2019-09-23 16:49:06 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
w = w->get_parent ();
|
|
|
|
|
|
|
|
while (w) {
|
|
|
|
|
2022-01-26 17:08:55 -05:00
|
|
|
if (w->get_is_toplevel()) {
|
2019-09-23 16:49:06 -04:00
|
|
|
/* Setting the focus widget to a Gtk::Window causes all
|
|
|
|
* subsequent calls to ::has_focus() on the nominal
|
|
|
|
* focus widget in that window to return
|
|
|
|
* false. Workaround: never set focus to the toplevel
|
|
|
|
* itself.
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w->get_can_focus ()) {
|
|
|
|
Gtk::Window* win = dynamic_cast<Gtk::Window*> (top);
|
|
|
|
win->set_focus (*w);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
w = w->get_parent ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (top == &_main_window) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no focusable parent found, cancel focus in top level window.
|
|
|
|
C++ API cannot be used for this. Thanks, references.
|
|
|
|
*/
|
|
|
|
|
|
|
|
gtk_window_set_focus (GTK_WINDOW(top->gobj()), 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::monitor_dim_all ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Route> mon = _session->monitor_out ();
|
2019-09-23 16:49:06 -04:00
|
|
|
if (!mon) {
|
|
|
|
return;
|
|
|
|
}
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MonitorProcessor> _monitor = mon->monitor_control ();
|
2019-09-23 16:49:06 -04:00
|
|
|
|
|
|
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-dim-all");
|
|
|
|
_monitor->set_dim_all (tact->get_active());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::monitor_cut_all ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Route> mon = _session->monitor_out ();
|
2019-09-23 16:49:06 -04:00
|
|
|
if (!mon) {
|
|
|
|
return;
|
|
|
|
}
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MonitorProcessor> _monitor = mon->monitor_control ();
|
2019-09-23 16:49:06 -04:00
|
|
|
|
|
|
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-cut-all");
|
|
|
|
_monitor->set_cut_all (tact->get_active());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::monitor_mono ()
|
|
|
|
{
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Route> mon = _session->monitor_out ();
|
2019-09-23 16:49:06 -04:00
|
|
|
if (!mon) {
|
|
|
|
return;
|
|
|
|
}
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MonitorProcessor> _monitor = mon->monitor_control ();
|
2019-09-23 16:49:06 -04:00
|
|
|
|
|
|
|
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action (X_("Monitor"), "monitor-mono");
|
|
|
|
_monitor->set_mono (tact->get_active());
|
|
|
|
}
|
|
|
|
|
|
|
|
Gtk::Menu*
|
|
|
|
ARDOUR_UI::shared_popup_menu ()
|
|
|
|
{
|
|
|
|
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::shared_popup_menu, ignored);
|
|
|
|
|
2022-01-26 15:21:06 -05:00
|
|
|
assert (!_shared_popup_menu || !_shared_popup_menu->get_visible());
|
2019-09-23 16:49:06 -04:00
|
|
|
delete _shared_popup_menu;
|
|
|
|
_shared_popup_menu = new Gtk::Menu;
|
|
|
|
return _shared_popup_menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::set_flat_buttons ()
|
|
|
|
{
|
|
|
|
CairoWidget::set_flat_buttons( UIConfiguration::instance().get_flat_buttons() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2020-10-05 00:52:17 -04:00
|
|
|
ARDOUR_UI::update_transport_clocks (samplepos_t p)
|
2019-09-23 16:49:06 -04:00
|
|
|
{
|
2020-10-05 00:52:17 -04:00
|
|
|
timepos_t pos (p);
|
|
|
|
|
2022-11-02 13:42:40 -04:00
|
|
|
primary_clock->set (pos);
|
|
|
|
secondary_clock->set (pos);
|
2019-09-23 16:49:06 -04:00
|
|
|
|
|
|
|
if (big_clock_window) {
|
|
|
|
big_clock->set (pos);
|
|
|
|
}
|
2019-11-08 23:03:38 -05:00
|
|
|
|
|
|
|
if (!editor->preview_video_drag_active ()) {
|
2020-10-05 00:52:17 -04:00
|
|
|
ARDOUR_UI::instance()->video_timeline->manual_seek_video_monitor(p);
|
2019-11-08 23:03:38 -05:00
|
|
|
}
|
2019-09-23 16:49:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
ARDOUR_UI::record_state_changed ()
|
|
|
|
{
|
|
|
|
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed);
|
|
|
|
|
|
|
|
if (!_session) {
|
|
|
|
/* why bother - the clock isn't visible */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ActionManager::set_sensitive (ActionManager::rec_sensitive_actions, !_session->actively_recording());
|
|
|
|
|
2024-09-30 18:04:19 -04:00
|
|
|
if (_session->record_status () == Recording && _session->have_rec_enabled_track ()) {
|
2021-02-27 13:25:23 -05:00
|
|
|
big_clock->set_active (true);
|
|
|
|
} else {
|
|
|
|
big_clock->set_active (false);
|
2019-09-23 16:49:06 -04:00
|
|
|
}
|
|
|
|
}
|
2023-07-28 11:50:23 -04:00
|
|
|
|