From 116a871d20e150f295c917f7f741baefe234dd97 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 6 Apr 2024 21:45:21 -0600 Subject: [PATCH] add and use simplified livetrax add tracks dialog --- gtk2_ardour/ardour_ui.cc | 21 ++++++++ gtk2_ardour/ardour_ui.h | 3 ++ gtk2_ardour/livetrax_add_track_dialog.cc | 61 ++++++++++++++++++++++++ gtk2_ardour/livetrax_add_track_dialog.h | 47 ++++++++++++++++++ gtk2_ardour/wscript | 1 + 5 files changed, 133 insertions(+) create mode 100644 gtk2_ardour/livetrax_add_track_dialog.cc create mode 100644 gtk2_ardour/livetrax_add_track_dialog.h diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index c3c7fa341a..f94acfb3d2 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -151,6 +151,7 @@ #include "keyboard.h" #include "keyeditor.h" #include "library_download_dialog.h" +#include "livetrax_add_track_dialog.h" #include "location_ui.h" #include "lua_script_manager.h" #include "luawindow.h" @@ -339,6 +340,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) , plugin_dsp_load_window (X_("plugin-dsp-load"), _("Plugin DSP Load")) , dsp_statistics_window (X_("dsp-statistics"), _("Performance Meters")) , transport_masters_window (X_("transport-masters"), _("Transport Masters")) + , livetrax_track_dialog (nullptr) , session_option_editor (X_("session-options-editor"), _("Properties"), boost::bind (&ARDOUR_UI::create_session_option_editor, this)) , add_video_dialog (X_("add-video"), _("Add Video"), boost::bind (&ARDOUR_UI::create_add_video_dialog, this)) , bundle_manager (X_("bundle-manager"), _("Bundle Manager"), boost::bind (&ARDOUR_UI::create_bundle_manager, this)) @@ -2863,6 +2865,16 @@ ARDOUR_UI::add_route () return; } + if (Profile->get_livetrax()) { + if (!livetrax_track_dialog) { + livetrax_track_dialog = new LiveTraxAddTrackDialog; + livetrax_track_dialog->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::add_route_dialog_response)); + } + livetrax_track_dialog->set_position (WIN_POS_MOUSE); + livetrax_track_dialog->present (); + return; + } + if (!add_route_dialog.get (false)) { add_route_dialog->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::add_route_dialog_response)); } @@ -2884,6 +2896,15 @@ ARDOUR_UI::add_route_dialog_response (int r) return; } + if (Profile->get_livetrax()) { + if (r == RESPONSE_OK) { + int nchan = livetrax_track_dialog->stereo() ? 2 : 1; + session_add_audio_route (true, nchan, nchan, ARDOUR::Normal, nullptr, livetrax_track_dialog->num_tracks(), string(), false, PresentationInfo::max_order, false); + } + livetrax_track_dialog->hide (); + return; + } + if (!AudioEngine::instance()->running ()) { switch (r) { case AddRouteDialog::Add: diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 462a75f5af..96f4cbda61 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -177,6 +177,7 @@ class LevelMeterHBox; class GUIObjectState; class BasicUI; class LiveTraxMeters; +class LiveTraxAddTrackDialog; namespace ARDOUR { class ControlProtocolInfo; @@ -794,6 +795,8 @@ private: WM::Proxy dsp_statistics_window; WM::Proxy transport_masters_window; + LiveTraxAddTrackDialog* livetrax_track_dialog; + /* Windows/Dialogs that require a creator method */ WM::ProxyWithConstructor session_option_editor; diff --git a/gtk2_ardour/livetrax_add_track_dialog.cc b/gtk2_ardour/livetrax_add_track_dialog.cc new file mode 100644 index 0000000000..7f2023e927 --- /dev/null +++ b/gtk2_ardour/livetrax_add_track_dialog.cc @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2024 Paul Davis + * + * 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. + */ + +#include + +#include "livetrax_add_track_dialog.h" + +#include "pbd/i18n.h" + +using namespace Gtk; + +LiveTraxAddTrackDialog::LiveTraxAddTrackDialog () + : ArdourDialog (_("Add Tracks")) + , track_count (1.0, 1.0, 1024.0, 1.0, 10.) + , track_count_spinner (track_count) + , mono_button (channel_button_group, _("Mono")) + , stereo_button (channel_button_group, _("Stereo")) +{ + + get_vbox()->pack_start (track_count_spinner); + get_vbox()->pack_start (mono_button); + get_vbox()->pack_start (stereo_button); + + mono_button.set_active(); + + add_button (Stock::CANCEL, RESPONSE_CANCEL); + add_button (Stock::OK, RESPONSE_OK); + + show_all (); +} + +LiveTraxAddTrackDialog::~LiveTraxAddTrackDialog() +{ +} + +int +LiveTraxAddTrackDialog::num_tracks() const +{ + return track_count.get_value(); +} + +bool +LiveTraxAddTrackDialog::stereo() const +{ + return stereo_button.get_active(); +} diff --git a/gtk2_ardour/livetrax_add_track_dialog.h b/gtk2_ardour/livetrax_add_track_dialog.h new file mode 100644 index 0000000000..2867fa164b --- /dev/null +++ b/gtk2_ardour/livetrax_add_track_dialog.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2024 Paul Davis + * + * 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. + */ + +#ifndef __gtk_ardour_livetrax_add_track_dialog_h__ +#define __gtk_ardour_livetrax_add_track_dialog_h__ + +#include +#include +#include +#include +#include + +#include "ardour_dialog.h" + +class LiveTraxAddTrackDialog : public ArdourDialog +{ +public: + LiveTraxAddTrackDialog (); + ~LiveTraxAddTrackDialog (); + + int num_tracks() const; + bool stereo () const; + +private: + Gtk::Adjustment track_count; + Gtk::SpinButton track_count_spinner; + Gtk::RadioButtonGroup channel_button_group; + Gtk::RadioButton mono_button; + Gtk::RadioButton stereo_button; +}; + +#endif // __gtk_ardour_livetrax_add_track_dialog_h__ */ diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 2165a19c8c..9fc55ddce1 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -143,6 +143,7 @@ gtk2_ardour_sources = [ 'led.cc', 'level_meter.cc', 'library_download_dialog.cc', + 'livetrax_add_track_dialog.cc', 'livetrax_meters.cc', 'location_ui.cc', 'loudness_dialog.cc',