13
0

add and use simplified livetrax add tracks dialog

This commit is contained in:
Paul Davis 2024-04-06 21:45:21 -06:00
parent 49f0a8e16e
commit 116a871d20
5 changed files with 133 additions and 0 deletions

View File

@ -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:

View File

@ -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<DspStatisticsWindow> dsp_statistics_window;
WM::Proxy<TransportMastersWindow> transport_masters_window;
LiveTraxAddTrackDialog* livetrax_track_dialog;
/* Windows/Dialogs that require a creator method */
WM::ProxyWithConstructor<SessionOptionEditor> session_option_editor;

View File

@ -0,0 +1,61 @@
/*
* Copyright (C) 2024 Paul Davis <paul@linuxaudiosystems.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.
*/
#include <gtkmm/stock.h>
#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();
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2024 Paul Davis <paul@linuxaudiosystems.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.
*/
#ifndef __gtk_ardour_livetrax_add_track_dialog_h__
#define __gtk_ardour_livetrax_add_track_dialog_h__
#include <gtkmm/dialog.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/button.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/adjustment.h>
#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__ */

View File

@ -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',