13
0

Initial implementation of TransportBar

This commit is contained in:
Ben Loftis 2024-09-24 11:30:19 -05:00 committed by Robin Gareus
parent 2066f7018d
commit b9d173c17a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
8 changed files with 222 additions and 8 deletions

View File

@ -0,0 +1,144 @@
/*
* Copyright (C) 2005-2024 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2013-2024 Robin Gareus <robin@gareus.org>
* Copyright (C) 2014-2024 Ben Loftis <ben@harrisonconsoles.com>
*
* 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 <glib.h>
#include "pbd/gstdio_compat.h"
#include <gtkmm/accelmap.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/stock.h>
#include <gtkmm/uimanager.h>
#include "pbd/error.h"
#include "pbd/compose.h"
#include "pbd/convert.h"
#include "pbd/failed_constructor.h"
#include "pbd/memento_command.h"
#include "pbd/openuri.h"
#include "pbd/types_convert.h"
#include "pbd/file_utils.h"
#include <pbd/localtime_r.h>
#include "pbd/pthread_utils.h"
#include "pbd/replace_all.h"
#include "pbd/scoped_file_descriptor.h"
#include "pbd/xml++.h"
#include "gtkmm2ext/application.h"
#include "gtkmm2ext/bindings.h"
#include "gtkmm2ext/gtk_ui.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/window_title.h"
#include "widgets/tooltips.h"
#include "ardour/ardour.h"
#include "ardour/audioengine.h"
#include "ardour/profile.h"
#include "ardour/revision.h"
#include "ardour/transport_master.h"
#include "ardour/transport_master_manager.h"
#include "ardour/triggerbox.h"
#include "ardour/track.h"
#include "ardour/vca_manager.h"
#include "ardour/utils.h"
#include "control_protocol/basic_ui.h"
#include "actions.h"
#include "application_bar.h"
#include "ardour_ui.h"
#include "debug.h"
#include "gui_object.h"
#include "gui_thread.h"
#include "keyboard.h"
#include "keyeditor.h"
#include "luainstance.h"
#include "main_clock.h"
#include "meter_patterns.h"
#include "mixer_ui.h"
#include "public_editor.h"
#include "rc_option_editor.h"
#include "recorder_ui.h"
#include "session_dialog.h"
#include "session_option_editor.h"
#include "splash.h"
#include "time_info_box.h"
#include "timers.h"
#include "trigger_page.h"
#include "triggerbox_ui.h"
#include "utils.h"
#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Gtkmm2ext;
using namespace ArdourWidgets;
using namespace Gtk;
using namespace std;
static const gchar *_record_mode_strings[] = {
N_("Layered"),
N_("Non-Layered"),
N_("Snd on Snd"),
0
};
ApplicationBar::ApplicationBar ()
: _have_layout (false)
, _basic_ui (0)
{
}
ApplicationBar::~ApplicationBar ()
{
}
void
ApplicationBar::on_parent_changed (Gtk::Widget*)
{
assert (!_have_layout);
_have_layout = true;
_transport_ctrl.setup (ARDOUR_UI::instance ());
_transport_ctrl.map_actions ();
pack_start(_transport_ctrl, false, false);
}
void
ApplicationBar::set_session (Session *s)
{
SessionHandlePtr::set_session (s);
_transport_ctrl.set_session (s);
if (_basic_ui) {
delete _basic_ui;
}
_basic_ui = new BasicUI (*s);
}

View File

@ -0,0 +1,67 @@
/*
* Copyright (C) 2005-2024 Paul Davis <paul@linuxaudiosystems.com>
* Copyright (C) 2013-2024 Robin Gareus <robin@gareus.org>
* Copyright (C) 2014-2024 Ben Loftis <ben@harrisonconsoles.com>
*
* 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.
*/
#pragma once
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#include "ardour/ardour.h"
#include "ardour/types.h"
#include "ardour/session_handle.h"
#include "widgets/ardour_button.h"
#include "widgets/ardour_dropdown.h"
#include "widgets/ardour_spacer.h"
#include "main_clock.h"
#include "mini_timeline.h"
#include "shuttle_control.h"
#include "startup_fsm.h"
#include "transport_control.h"
#include "transport_control_ui.h"
#include "visibility_group.h"
#include "window_manager.h"
class BasicUI;
class TimeInfoBox;
class LevelMeterHBox;
namespace ARDOUR {
class Route;
class RouteGroup;
}
class ApplicationBar : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
public:
ApplicationBar ();
~ApplicationBar();
void set_session (ARDOUR::Session *);
private:
void on_parent_changed (Gtk::Widget*);
bool _have_layout;
BasicUI* _basic_ui;
TransportControlUI _transport_ctrl;
};

View File

@ -182,6 +182,7 @@
#include "time_axis_view_item.h"
#include "time_info_box.h"
#include "timers.h"
#include "application_bar.h" //TODO: remove this and put in Rec/Edit/Mix/Cue
#include "transport_masters_dialog.h"
#include "trigger_page.h"
#include "triggerbox_ui.h"
@ -439,8 +440,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
std::function<void (string)> pc (std::bind (&ARDOUR_UI::parameter_changed, this, _1));
UIConfiguration::instance().map_parameters (pc);
transport_ctrl.setup (this);
ARDOUR::DiskWriter::Overrun.connect (forever_connections, MISSING_INVALIDATOR, std::bind (&ARDOUR_UI::disk_overrun_handler, this), gui_context());
ARDOUR::DiskReader::Underrun.connect (forever_connections, MISSING_INVALIDATOR, std::bind (&ARDOUR_UI::disk_underrun_handler, this), gui_context());
@ -578,6 +577,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
_process_thread = new ProcessThread ();
ARDOUR::Port::set_connecting_blocked (ARDOUR_COMMAND_LINE::no_connect_ports);
application_bar = new ApplicationBar(); //TODO: move this to Editor, Cue, Rec, Mix
}
GlobalPortMatrixWindow*
@ -694,8 +695,6 @@ ARDOUR_UI::post_engine ()
throw failed_constructor (); // TODO catch me if you can
}
transport_ctrl.map_actions ();
/* Do this after setup_windows (), as that's when the _status_bar_visibility is created */
XMLNode* n = Config->extra_xml (X_("UI"));
if (n) {

View File

@ -166,6 +166,7 @@ class SessionDialog;
class SessionOptionEditorWindow;
class Splash;
class TimeInfoBox;
class ApplicationBar;
class Meterbridge;
class LuaWindow;
class MidiTracer;
@ -525,7 +526,7 @@ private:
void set_transport_controllable_state (const XMLNode&);
XMLNode& get_transport_controllable_state ();
TransportControlUI transport_ctrl;
ApplicationBar *application_bar;
ArdourWidgets::ArdourButton punch_in_button;
ArdourWidgets::ArdourButton punch_out_button;

View File

@ -65,6 +65,7 @@
#include "main_clock.h"
#include "mixer_ui.h"
#include "recorder_ui.h"
#include "application_bar.h" //TODO: move to each window
#include "trigger_page.h"
#include "utils.h"
#include "time_info_box.h"
@ -552,7 +553,6 @@ ARDOUR_UI::setup_transport ()
button_height_size_group->add_widget (*secondary_clock->left_btn());
button_height_size_group->add_widget (*secondary_clock->right_btn());
button_height_size_group->add_widget (transport_ctrl.size_button ());
button_height_size_group->add_widget (sync_button);
button_height_size_group->add_widget (auto_return_button);
@ -597,7 +597,7 @@ ARDOUR_UI::setup_transport ()
int col = 0;
#define TCOL col, col + 1
transport_table.attach (transport_ctrl, TCOL, 0, 1 , SHRINK, SHRINK, 0, 0);
transport_table.attach (*application_bar, TCOL, 0, 1 , SHRINK, SHRINK, 0, 0);
transport_table.attach (*ssbox, TCOL, 1, 2 , FILL, SHRINK, 0, 0);
++col;

View File

@ -86,6 +86,7 @@
#include "sfdb_ui.h"
#include "time_info_box.h"
#include "timers.h"
#include "application_bar.h" //TODO: remove
#include "transport_masters_dialog.h"
#include "trigger_page.h"
#include "virtual_keyboard_window.h"
@ -123,7 +124,7 @@ ARDOUR_UI::set_session (Session *s)
ActionManager::set_sensitive (ActionManager::range_sensitive_actions, false);
}
transport_ctrl.set_session (s);
application_bar->set_session (s);
update_path_label ();
update_sample_rate ();

View File

@ -81,6 +81,7 @@
#include "rc_option_editor.h"
#include "sfdb_ui.h"
#include "transport_masters_dialog.h"
#include "application_bar.h"
#include "ui_config.h"
#include "utils.h"

View File

@ -19,6 +19,7 @@ gtk2_ardour_sources = [
'add_route_dialog.cc',
'ambiguous_file_dialog.cc',
'analysis_window.cc',
'application_bar.cc',
'ardour_dialog.cc',
'ardour_http.cc',
'ardour_message.cc',