#include <gtkmm2ext/gtk_ui.h>
#include <ardour/location.h>
+#include <pbd/memento_command.h>
#include "editor.h"
#include "marker.h"
#include "gui_thread.h"
#include "simplerect.h"
#include "actions.h"
+#include "prompter.h"
#include "i18n.h"
using namespace std;
using namespace sigc;
using namespace ARDOUR;
+using namespace PBD;
using namespace Gtk;
void
void
Editor::add_new_location (Location *location)
{
+ ENSURE_GUI_THREAD (bind (mem_fun(*this, &Editor::add_new_location), location));
+
LocationMarkers *lam = new LocationMarkers;
uint32_t color;
if (session) {
Location *location = new Location (where, where, "mark", Location::IsMark);
session->begin_reversible_command (_("add marker"));
- session->add_undo (session->locations()->get_memento());
+ XMLNode &before = session->locations()->get_state();
session->locations()->add (location, true);
- session->add_redo_no_execute (session->locations()->get_memento());
+ XMLNode &after = session->locations()->get_state();
+ session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
session->commit_reversible_command ();
}
}
Editor::really_remove_marker (Location* loc)
{
session->begin_reversible_command (_("remove marker"));
- session->add_undo (session->locations()->get_memento());
+ XMLNode &before = session->locations()->get_state();
session->locations()->remove (loc);
- session->add_redo_no_execute (session->locations()->get_memento());
+ XMLNode &after = session->locations()->get_state();
+ session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
session->commit_reversible_command ();
return FALSE;
}
MenuList& items = marker_menu->items();
marker_menu->set_name ("ArdourContextMenu");
- items.push_back (MenuElem (_("Locate to mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
- items.push_back (MenuElem (_("Play from mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
- items.push_back (MenuElem (_("Set mark from playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
+ items.push_back (MenuElem (_("Locate to Mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
+ items.push_back (MenuElem (_("Play from Mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
+ items.push_back (MenuElem (_("Set Mark from Playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Rename mark"), mem_fun(*this, &Editor::marker_menu_rename)));
- items.push_back (MenuElem (_("Hide mark"), mem_fun(*this, &Editor::marker_menu_hide)));
- items.push_back (MenuElem (_("Remove mark"), mem_fun(*this, &Editor::marker_menu_remove)));
+ items.push_back (MenuElem (_("Rename Mark"), mem_fun(*this, &Editor::marker_menu_rename)));
+ items.push_back (MenuElem (_("Hide Mark"), mem_fun(*this, &Editor::marker_menu_hide)));
+ items.push_back (MenuElem (_("Remove Mark"), mem_fun(*this, &Editor::marker_menu_remove)));
}
MenuList& items = range_marker_menu->items();
range_marker_menu->set_name ("ArdourContextMenu");
- items.push_back (MenuElem (_("Locate to range mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
- items.push_back (MenuElem (_("Play from range mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
- items.push_back (MenuElem (_("Loop range"), mem_fun(*this, &Editor::marker_menu_loop_range)));
- items.push_back (MenuElem (_("Set range mark from playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
- items.push_back (MenuElem (_("Set range from range selection"), mem_fun(*this, &Editor::marker_menu_set_from_selection)));
+ items.push_back (MenuElem (_("Locate to Range Mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
+ items.push_back (MenuElem (_("Play from Range Mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
+ items.push_back (MenuElem (_("Loop Range"), mem_fun(*this, &Editor::marker_menu_loop_range)));
+ items.push_back (MenuElem (_("Set Range Mark from Playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
+ items.push_back (MenuElem (_("Set Range from Range Selection"), mem_fun(*this, &Editor::marker_menu_set_from_selection)));
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Rename range"), mem_fun(*this, &Editor::marker_menu_rename)));
- items.push_back (MenuElem (_("Hide range"), mem_fun(*this, &Editor::marker_menu_hide)));
- items.push_back (MenuElem (_("Remove range"), mem_fun(*this, &Editor::marker_menu_remove)));
+ items.push_back (MenuElem (_("Rename Range"), mem_fun(*this, &Editor::marker_menu_rename)));
+ items.push_back (MenuElem (_("Hide Range"), mem_fun(*this, &Editor::marker_menu_hide)));
+ items.push_back (MenuElem (_("Remove Range"), mem_fun(*this, &Editor::marker_menu_remove)));
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Separate regions from range"), mem_fun(*this, &Editor::marker_menu_separate_regions_using_location)));
- items.push_back (MenuElem (_("Select all in range"), mem_fun(*this, &Editor::marker_menu_select_all_selectables_using_range)));
+ items.push_back (MenuElem (_("Separate Regions in Range"), mem_fun(*this, &Editor::marker_menu_separate_regions_using_location)));
+ items.push_back (MenuElem (_("Select All in Range"), mem_fun(*this, &Editor::marker_menu_select_all_selectables_using_range)));
}
MenuList& items = new_transport_marker_menu->items();
new_transport_marker_menu->set_name ("ArdourContextMenu");
- items.push_back (MenuElem (_("Set loop range"), mem_fun(*this, &Editor::new_transport_marker_menu_set_loop)));
- items.push_back (MenuElem (_("Set punch range"), mem_fun(*this, &Editor::new_transport_marker_menu_set_punch)));
+ items.push_back (MenuElem (_("Set Loop Range"), mem_fun(*this, &Editor::new_transport_marker_menu_set_loop)));
+ items.push_back (MenuElem (_("Set Punch Range"), mem_fun(*this, &Editor::new_transport_marker_menu_set_punch)));
new_transport_marker_menu->signal_unmap_event().connect ( mem_fun(*this, &Editor::new_transport_marker_menu_popdown));
}
MenuList& items = transport_marker_menu->items();
transport_marker_menu->set_name ("ArdourContextMenu");
- items.push_back (MenuElem (_("Locate to range mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
- items.push_back (MenuElem (_("Play from range mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
- items.push_back (MenuElem (_("Set range mark from playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
- items.push_back (MenuElem (_("Set range mark from range"), mem_fun(*this, &Editor::marker_menu_set_from_selection)));
+ items.push_back (MenuElem (_("Locate to Range Mark"), mem_fun(*this, &Editor::marker_menu_set_playhead)));
+ items.push_back (MenuElem (_("Play from Range Mark"), mem_fun(*this, &Editor::marker_menu_play_from)));
+ items.push_back (MenuElem (_("Set Range Mark from Playhead"), mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
+ items.push_back (MenuElem (_("Set Range from Range Selection"), mem_fun(*this, &Editor::marker_menu_set_from_selection)));
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Hide range"), mem_fun(*this, &Editor::marker_menu_hide)));
+ items.push_back (MenuElem (_("Hide Range"), mem_fun(*this, &Editor::marker_menu_hide)));
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Separate regions from range"), mem_fun(*this, &Editor::marker_menu_separate_regions_using_location)));
- items.push_back (MenuElem (_("Select all in Range"), mem_fun(*this, &Editor::marker_menu_select_all_selectables_using_range)));
+ items.push_back (MenuElem (_("Separate Regions in Range"), mem_fun(*this, &Editor::marker_menu_separate_regions_using_location)));
+ items.push_back (MenuElem (_("Select All in Range"), mem_fun(*this, &Editor::marker_menu_select_all_selectables_using_range)));
}
void
}
}
else {
- if (!selection->audio_regions.empty()) {
- l->set_start (selection->audio_regions.start());
- l->set_end (selection->audio_regions.end_frame());
+ if (!selection->regions.empty()) {
+ l->set_start (selection->regions.start());
+ l->set_end (selection->regions.end_frame());
}
}
}
l2->set (l->start(), l->end());
// enable looping, reposition and start rolling
- session->request_auto_loop(true);
+ session->request_play_loop(true);
session->request_locate (l2->start(), true);
}
}
if (!loc) return;
- Dialog dialog;
- Entry entry;
+ ArdourPrompter dialog (true);
+ string txt;
+
+ dialog.set_prompt (_("New Name:"));
if (loc->is_mark()) {
dialog.set_title (_("ardour: rename mark"));
}
dialog.set_name ("MarkRenameWindow");
- dialog.set_size_request (300, -1);
+ dialog.set_size_request (250, -1);
dialog.set_position (Gtk::WIN_POS_MOUSE);
- dialog.set_modal (true);
-
- dialog.add_action_widget (entry, RESPONSE_ACCEPT);
- dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
- dialog.add_button (Stock::CANCEL, RESPONSE_ACCEPT);
- entry.set_text (loc->name());
- entry.set_name ("MarkerNameDisplay");
+ dialog.add_button (_("Rename"), RESPONSE_ACCEPT);
+ dialog.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
+ dialog.set_initial_text (loc->name());
- dialog.show_all ();
- entry.grab_focus ();
+ dialog.show ();
switch (dialog.run ()) {
case RESPONSE_ACCEPT:
}
begin_reversible_command ( _("rename marker") );
- session->add_undo( session->locations()->get_memento() );
+ XMLNode &before = session->locations()->get_state();
- loc->set_name (entry.get_text());
+ dialog.get_result(txt);
+ loc->set_name (txt);
- session->add_redo_no_execute( session->locations()->get_memento() );
+ XMLNode &after = session->locations()->get_state();
+ session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
commit_reversible_command ();
}
if ((tll = transport_loop_location()) == 0) {
Location* loc = new Location (temp_location->start(), temp_location->end(), _("Loop"), Location::IsAutoLoop);
- session->add_undo (session->locations()->get_memento());
+ XMLNode &before = session->locations()->get_state();
session->locations()->add (loc, true);
session->set_auto_loop_location (loc);
- session->add_redo_no_execute (session->locations()->get_memento());
+ XMLNode &after = session->locations()->get_state();
+ session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
}
else {
- session->add_undo (retype_return<void>(bind (mem_fun (*tll, &Location::set), tll->start(), tll->end())));
- session->add_redo (retype_return<void>(bind (mem_fun (*tll, &Location::set), temp_location->start(), temp_location->end())));
+ XMLNode &before = tll->get_state();
tll->set_hidden (false, this);
tll->set (temp_location->start(), temp_location->end());
+ XMLNode &after = tll->get_state();
+ session->add_command (new MementoCommand<Location>(*tll, &before, &after));
}
commit_reversible_command ();
if ((tpl = transport_punch_location()) == 0) {
tpl = new Location (temp_location->start(), temp_location->end(), _("Punch"), Location::IsAutoPunch);
- session->add_undo (session->locations()->get_memento());
+ XMLNode &before = session->locations()->get_state();
session->locations()->add (tpl, true);
session->set_auto_punch_location (tpl);
- session->add_redo_no_execute (session->locations()->get_memento());
+ XMLNode &after = session->locations()->get_state();
+ session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
} else {
- session->add_undo (retype_return<void>(bind (mem_fun (*tpl, &Location::set), tpl->start(), tpl->end())));
- session->add_redo (retype_return<void>(bind (mem_fun (*tpl, &Location::set), temp_location->start(), temp_location->end())));
+ XMLNode &before = tpl->get_state();
tpl->set_hidden(false, this);
tpl->set(temp_location->start(), temp_location->end());
+ XMLNode &after = tpl->get_state();
+ session->add_command (new MementoCommand<Location>(*tpl, &before, &after));
}
commit_reversible_command ();
Location* tll;
- if (session->get_auto_loop() && ((tll = transport_loop_location()) != 0)) {
+ if (Config->get_auto_loop() && ((tll = transport_loop_location()) != 0)) {
double x1 = frame_to_pixel (tll->start());
double x2 = frame_to_pixel (tll->end());
Location* tpl;
- if ((session->get_punch_in() || session->get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
+ if ((Config->get_punch_in() || Config->get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
double x1 = frame_to_pixel (tpl->start());
double x2 = frame_to_pixel (tpl->end());