Skip to content

Commit

Permalink
Prompt user for name of Range and Region bounces (gtk part)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLoftis committed Jul 26, 2020
1 parent f564c92 commit 80a7d32
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 4 deletions.
38 changes: 36 additions & 2 deletions gtk2_ardour/editor_export_audio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@

#include "ardour_ui.h"
#include "ardour_message.h"

#include "widgets/prompter.h"

#include "audio_region_view.h"
#include "audio_time_axis.h"
#include "editor.h"
Expand Down Expand Up @@ -252,6 +255,37 @@ Editor::bounce_region_selection (bool with_processing)
* its results back in the playlist (only in the region list).
*/

/*prompt the user for a new name*/
string bounce_name;
{
ArdourWidgets::Prompter dialog (true);

dialog.set_prompt (_("Name for Bounced Region:"));

dialog.set_name ("BounceNameWindow");
dialog.set_size_request (400, -1);
dialog.set_position (Gtk::WIN_POS_MOUSE);

dialog.add_button (_("Rename"), RESPONSE_ACCEPT);
dialog.set_initial_text (bounce_name);

Label label;
label.set_text (_("Bounced Region will appear in the Source list."));
dialog.get_vbox()->set_spacing (8);
dialog.get_vbox()->pack_start (label);
label.show();

dialog.show ();

switch (dialog.run ()) {
case RESPONSE_ACCEPT:
break;
default:
return;
}
dialog.get_result(bounce_name);
}

for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {

boost::shared_ptr<Region> region ((*i)->region());
Expand All @@ -263,9 +297,9 @@ Editor::bounce_region_selection (bool with_processing)
boost::shared_ptr<Region> r;

if (with_processing) {
r = track->bounce_range (region->position(), region->position() + region->length(), itt, track->main_outs(), false);
r = track->bounce_range (region->position(), region->position() + region->length(), itt, track->main_outs(), false, bounce_name);
} else {
r = track->bounce_range (region->position(), region->position() + region->length(), itt, boost::shared_ptr<Processor>(), false);
r = track->bounce_range (region->position(), region->position() + region->length(), itt, boost::shared_ptr<Processor>(), false, bounce_name);
}
}
}
Expand Down
49 changes: 47 additions & 2 deletions gtk2_ardour/editor_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4055,6 +4055,8 @@ Editor::bounce_range_selection (bool replace, bool enable_processing)
return;
}

string bounce_name;

TrackSelection views = selection->tracks;

for (TrackViewList::iterator i = views.begin(); i != views.end(); ++i) {
Expand All @@ -4074,6 +4076,49 @@ Editor::bounce_range_selection (bool replace, bool enable_processing)
return;
}
}

RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i);
if (rtv && rtv->track()) {
if (i!=views.begin())
bounce_name.append("+");
bounce_name.append(rtv->track()->name());
}
}

/*prompt the user for a new name*/
{
ArdourWidgets::Prompter dialog (true);

if (replace) {
dialog.set_prompt (_("Name for Consolidated Region:"));
} else {
dialog.set_prompt (_("Name for Bounced Region:"));
}

dialog.set_name ("BounceNameWindow");
dialog.set_size_request (400, -1);
dialog.set_position (Gtk::WIN_POS_MOUSE);

dialog.add_button (_("Rename"), RESPONSE_ACCEPT);
dialog.set_initial_text (bounce_name);

if (!replace) {
Label label;
label.set_text (_("Bounced Range will appear in the Source list."));
dialog.get_vbox()->set_spacing (8);
dialog.get_vbox()->pack_start (label);
label.show();
}

dialog.show ();

switch (dialog.run ()) {
case RESPONSE_ACCEPT:
break;
default:
return;
}
dialog.get_result(bounce_name);
}

samplepos_t start = selection->time[clicked_selection].start;
Expand Down Expand Up @@ -4103,9 +4148,9 @@ Editor::bounce_range_selection (bool replace, bool enable_processing)
boost::shared_ptr<Region> r;

if (enable_processing) {
r = rtv->track()->bounce_range (start, start+cnt, itt, rtv->track()->main_outs(), false);
r = rtv->track()->bounce_range (start, start+cnt, itt, rtv->track()->main_outs(), false, bounce_name);
} else {
r = rtv->track()->bounce_range (start, start+cnt, itt, boost::shared_ptr<Processor>(), false);
r = rtv->track()->bounce_range (start, start+cnt, itt, boost::shared_ptr<Processor>(), false, bounce_name);
}

if (!r) {
Expand Down

0 comments on commit 80a7d32

Please sign in to comment.