mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-04 20:55:48 +01:00
make region renaming even more accessible
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2724 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d9032350e0
commit
b7e01e92b3
3 changed files with 36 additions and 41 deletions
|
|
@ -1708,6 +1708,7 @@ Editor::add_region_context_items (AudioStreamView* sv, boost::shared_ptr<Region>
|
|||
|
||||
region_menu->signal_map_event().connect (bind (mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, boost::weak_ptr<Region>(region)));
|
||||
|
||||
items.push_back (MenuElem (_("Rename"), mem_fun(*this, &Editor::rename_region)));
|
||||
items.push_back (MenuElem (_("Popup region editor"), mem_fun(*this, &Editor::edit_region)));
|
||||
items.push_back (MenuElem (_("Raise to top layer"), mem_fun(*this, &Editor::raise_region_to_top)));
|
||||
items.push_back (MenuElem (_("Lower to bottom layer"), mem_fun (*this, &Editor::lower_region_to_bottom)));
|
||||
|
|
|
|||
|
|
@ -944,6 +944,7 @@ class Editor : public PublicEditor
|
|||
void remove_clicked_region ();
|
||||
void destroy_clicked_region ();
|
||||
void edit_region ();
|
||||
void rename_region ();
|
||||
void duplicate_some_regions (RegionSelection&, float times);
|
||||
void duplicate_selection (float times);
|
||||
void region_fill_selection ();
|
||||
|
|
@ -980,10 +981,6 @@ class Editor : public PublicEditor
|
|||
void region_from_selection ();
|
||||
void create_region_from_selection (std::vector<boost::shared_ptr<ARDOUR::AudioRegion> >&);
|
||||
|
||||
bool region_renamed;
|
||||
void rename_region ();
|
||||
void rename_region_finished (bool);
|
||||
|
||||
void play_from_start ();
|
||||
void play_from_edit_point ();
|
||||
void play_selected_region ();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <pbd/basename.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
#include <pbd/memento_command.h>
|
||||
#include <pbd/whitespace.h>
|
||||
|
||||
#include <gtkmm2ext/utils.h>
|
||||
#include <gtkmm2ext/choice.h>
|
||||
|
|
@ -2159,60 +2160,56 @@ Editor::edit_region ()
|
|||
}
|
||||
|
||||
void
|
||||
Editor::rename_region ()
|
||||
Editor::rename_region()
|
||||
{
|
||||
Dialog dialog;
|
||||
Entry entry;
|
||||
Button ok_button (_("OK"));
|
||||
Button cancel_button (_("Cancel"));
|
||||
|
||||
if (selection->regions.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WindowTitle title(Glib::get_application_name());
|
||||
WindowTitle title (Glib::get_application_name());
|
||||
title += _("Rename Region");
|
||||
|
||||
dialog.set_title (title.get_string());
|
||||
dialog.set_name ("RegionRenameWindow");
|
||||
dialog.set_size_request (300, -1);
|
||||
dialog.set_position (Gtk::WIN_POS_MOUSE);
|
||||
dialog.set_modal (true);
|
||||
ArdourDialog d (*this, title.get_string(), true, false);
|
||||
Entry entry;
|
||||
Label label (_("New name:"));
|
||||
HBox hbox;
|
||||
|
||||
dialog.get_vbox()->set_border_width (10);
|
||||
dialog.get_vbox()->pack_start (entry);
|
||||
dialog.get_action_area()->pack_start (ok_button);
|
||||
dialog.get_action_area()->pack_start (cancel_button);
|
||||
hbox.set_spacing (6);
|
||||
hbox.pack_start (label, false, false);
|
||||
hbox.pack_start (entry, true, true);
|
||||
|
||||
entry.set_name ("RegionNameDisplay");
|
||||
ok_button.set_name ("EditorGTKButton");
|
||||
cancel_button.set_name ("EditorGTKButton");
|
||||
d.get_vbox()->set_border_width (12);
|
||||
d.get_vbox()->pack_start (hbox, false, false);
|
||||
|
||||
region_renamed = false;
|
||||
d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
||||
d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
|
||||
entry.signal_activate().connect (bind (mem_fun(*this, &Editor::rename_region_finished), true));
|
||||
ok_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::rename_region_finished), true));
|
||||
cancel_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::rename_region_finished), false));
|
||||
d.set_size_request (300, -1);
|
||||
d.set_position (Gtk::WIN_POS_MOUSE);
|
||||
|
||||
/* recurse */
|
||||
entry.set_text (selection->regions.front()->region()->name());
|
||||
entry.select_region (0, -1);
|
||||
|
||||
dialog.show_all ();
|
||||
Main::run ();
|
||||
entry.signal_activate().connect (bind (mem_fun (d, &Dialog::response), RESPONSE_OK));
|
||||
|
||||
d.show_all ();
|
||||
|
||||
entry.grab_focus();
|
||||
|
||||
if (region_renamed) {
|
||||
(*selection->regions.begin())->region()->set_name (entry.get_text());
|
||||
redisplay_regions ();
|
||||
int ret = d.run();
|
||||
|
||||
d.hide ();
|
||||
|
||||
if (ret == RESPONSE_OK) {
|
||||
std::string str = entry.get_text();
|
||||
strip_whitespace_edges (str);
|
||||
if (!str.empty()) {
|
||||
selection->regions.front()->region()->set_name (str);
|
||||
redisplay_regions ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::rename_region_finished (bool status)
|
||||
|
||||
{
|
||||
region_renamed = status;
|
||||
Main::quit ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::audition_playlist_region_via_route (boost::shared_ptr<Region> region, Route& route)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue