partial dialog to control track duplication

This commit is contained in:
Paul Davis 2015-11-14 10:29:50 -05:00
parent 81afdecd30
commit aeb7246977
6 changed files with 157 additions and 4 deletions

View File

@ -111,6 +111,7 @@ typedef uint64_t microseconds_t;
#include "audio_region_view.h"
#include "big_clock_window.h"
#include "bundle_manager.h"
#include "duplicate_routes_dialog.h"
#include "engine_dialog.h"
#include "export_video_dialog.h"
#include "export_video_infobox.h"
@ -284,6 +285,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, _status_bar_visibility (X_("status-bar"))
, _feedback_exists (false)
, _log_not_acknowledged (LogLevelNone)
, duplicate_routes_dialog (0)
{
Gtkmm2ext::init (localedir);
@ -3751,8 +3753,33 @@ ARDOUR_UI::setup_order_hint (AddRouteDialog::InsertAt place)
}
void
ARDOUR_UI::duplicate_routes ()
ARDOUR_UI::start_duplicate_routes ()
{
if (!duplicate_routes_dialog) {
duplicate_routes_dialog = new DuplicateRouteDialog;
duplicate_routes_dialog->signal_response().connect (sigc::mem_fun (*this, &ARDOUR_UI::finish_duplicate_routes));
}
duplicate_routes_dialog->present ();
}
void
ARDOUR_UI::finish_duplicate_routes (int response)
{
if (!duplicate_routes_dialog) {
/* how could this happen? */
return;
}
duplicate_routes_dialog->hide ();
if (response != Gtk::RESPONSE_OK) {
return;
}
ARDOUR::PlaylistDisposition playlist_disposition = duplicate_routes_dialog->playlist_disposition ();
uint32_t count = duplicate_routes_dialog->count ();
/* Copy the track selection because it will/may change as we add new ones */
TrackSelection tracks (editor->get_selection().tracks);
int err = 0;
@ -3767,7 +3794,7 @@ ARDOUR_UI::duplicate_routes ()
}
XMLNode& state (rui->route()->get_state());
RouteList rl = _session->new_route_from_template (1, state, string(), SharePlaylist);
RouteList rl = _session->new_route_from_template (count, state, string(), playlist_disposition);
/* normally the state node would be added to a parent, and
* ownership would transfer. Because we don't do that here,

View File

@ -112,6 +112,7 @@ class ArdourKeyboard;
class AudioClock;
class ButtonJoiner;
class ConnectionEditor;
class DuplicateRouteDialog;
class MainClock;
class Mixer_UI;
class ArdourPrompter;
@ -248,7 +249,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void add_routes_part_two ();
void add_routes_thread ();
void duplicate_routes ();
void start_duplicate_routes ();
void add_video (Gtk::Window* float_window);
void remove_video ();
@ -787,6 +788,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
int do_audio_midi_setup (uint32_t);
void audioengine_became_silent ();
DuplicateRouteDialog* duplicate_routes_dialog;
void build_duplicate_routes_dialog ();
void finish_duplicate_routes (int response);
};
#endif /* __ardour_gui_h__ */

View File

@ -133,7 +133,7 @@ ARDOUR_UI::install_actions ()
ActionManager::write_sensitive_actions.push_back (act);
act = ActionManager::register_action (main_actions, X_("duplicate-routes"), _("Duplicate Tracks/Busses"),
sigc::mem_fun(*this, &ARDOUR_UI::duplicate_routes));
sigc::mem_fun(*this, &ARDOUR_UI::start_duplicate_routes));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::write_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);

View File

@ -0,0 +1,65 @@
/*
Copyright (C) 2015 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "gtkmm/stock.h"
#include "duplicate_routes_dialog.h"
#include "i18n.h"
DuplicateRouteDialog::DuplicateRouteDialog ()
: ArdourDialog (_("Duplicate Tracks & Busses"), false, false)
, copy_playlists_button (playlist_button_group, _("Copy playlists"))
, new_playlists_button (playlist_button_group, _("Create new (empty) playlists"))
, share_playlists_button (playlist_button_group, _("Share playlists"))
, count_adjustment (1.0, 1.0, 999, 1.0, 10.0)
, count_spinner (count_adjustment)
{
playlist_button_box.pack_start (copy_playlists_button, false, false);
playlist_button_box.pack_start (new_playlists_button, false, false);
playlist_button_box.pack_start (share_playlists_button, false, false);
get_vbox()->pack_start (playlist_button_box, false, false);
get_vbox()->show_all ();
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK);
}
DuplicateRouteDialog::~DuplicateRouteDialog ()
{
}
uint32_t
DuplicateRouteDialog::count() const
{
return count_adjustment.get_value ();
}
ARDOUR::PlaylistDisposition
DuplicateRouteDialog::playlist_disposition() const
{
if (new_playlists_button.get_active()) {
return ARDOUR::NewPlaylist;
} else if (copy_playlists_button.get_active()) {
return ARDOUR::CopyPlaylist;
}
return ARDOUR::SharePlaylist;
}

View File

@ -0,0 +1,55 @@
/*
Copyright (C) 2015 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __gtk_ardour_duplicate_route_dialog_h__
#define __gtk_ardour_duplicate_route_dialog_h__
#include <gtkmm/entry.h>
#include <gtkmm/box.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/spinbutton.h>
#include "ardour/types.h"
#include "ardour_dialog.h"
class Editor;
class DuplicateRouteDialog : public ArdourDialog
{
public:
DuplicateRouteDialog ();
~DuplicateRouteDialog ();
uint32_t count() const;
ARDOUR::PlaylistDisposition playlist_disposition() const;
private:
Gtk::Entry name_template_entry;
Gtk::VBox playlist_button_box;
Gtk::RadioButtonGroup playlist_button_group;
Gtk::RadioButton copy_playlists_button;
Gtk::RadioButton new_playlists_button;
Gtk::RadioButton share_playlists_button;
Gtk::Adjustment count_adjustment;
Gtk::SpinButton count_spinner;
};
#endif /* __gtk_ardour_duplicate_route_dialog_h__ */

View File

@ -56,6 +56,7 @@ gtk2_ardour_sources = [
'cursor_context.cc',
'curvetest.cc',
'debug.cc',
'duplicate_routes_dialog.cc',
'edit_note_dialog.cc',
'editing.cc',
'editor.cc',