more MIDI paste improvements, plus move region-mute binding to PRIMARY-m and use "m" for toggle-internal-editing
git-svn-id: svn://localhost/ardour2/branches/3.0@5525 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
84fb6ae9ba
commit
e57c4d4c43
|
@ -217,6 +217,8 @@
|
|||
<menuitem action='set-mouse-mode-zoom'/>
|
||||
<menuitem action='set-mouse-mode-timefx'/>
|
||||
<separator/>
|
||||
<menuitem action='toggle-internal-edit'/>
|
||||
<separator/>
|
||||
<menuitem action='cycle-edit-point'/>
|
||||
<menuitem action='cycle-edit-point-with-marker'/>
|
||||
<menuitem action='toggle-edit-mode'/>
|
||||
|
|
|
@ -673,8 +673,6 @@ Editor::register_actions ()
|
|||
/* in the future, this may allow other kinds of "intra-region" editing, but for now its just MIDI */
|
||||
ARDOUR_UI::instance()->tooltips().set_tip (internal_edit_button, _("Edit MIDI Notes"));
|
||||
|
||||
cerr << "Registering mouse mode actions\n";
|
||||
|
||||
act = ActionManager::register_radio_action (mouse_mode_actions, mouse_mode_group, "set-mouse-mode-object", _("Object Tool"), bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseObject));
|
||||
act->connect_proxy (mouse_move_button);
|
||||
mouse_move_button.set_image (*(manage (new Image (::get_icon("tool_object")))));
|
||||
|
|
|
@ -4011,8 +4011,6 @@ Editor::cut_copy_points (CutCopyOp op)
|
|||
void
|
||||
Editor::cut_copy_midi (CutCopyOp op)
|
||||
{
|
||||
cerr << "CCM: there are " << selection->midi_regions.size() << " MRV's to work on\n";
|
||||
|
||||
for (MidiRegionSelection::iterator i = selection->midi_regions.begin(); i != selection->midi_regions.end(); ++i) {
|
||||
MidiRegionView* mrv = *i;
|
||||
mrv->cut_copy_clear (op);
|
||||
|
@ -4347,9 +4345,6 @@ Editor::paste_internal (nframes64_t position, float times)
|
|||
ts.push_back (entered_track);
|
||||
}
|
||||
|
||||
|
||||
cerr << "Paste into " << ts.size() << " tracks\n";
|
||||
|
||||
for (nth = 0, i = ts.begin(); i != ts.end(); ++i, ++nth) {
|
||||
|
||||
/* undo/redo is handled by individual tracks/regions */
|
||||
|
@ -4362,13 +4357,11 @@ Editor::paste_internal (nframes64_t position, float times)
|
|||
|
||||
get_regions_at (rs, position, ts);
|
||||
|
||||
|
||||
cerr << " We have " << cut_buffer->midi_notes.size() << " MIDI cut buffers\n";
|
||||
|
||||
for (cb = cut_buffer->midi_notes.begin(), r = rs.begin(); cb != cut_buffer->midi_notes.end() && r != rs.end(); ++r) {
|
||||
for (cb = cut_buffer->midi_notes.begin(), r = rs.begin();
|
||||
cb != cut_buffer->midi_notes.end() && r != rs.end(); ++r) {
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*r);
|
||||
if (mrv) {
|
||||
mrv->paste (position, **cb);
|
||||
mrv->paste (position, times, **cb);
|
||||
++cb;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1674,7 +1674,6 @@ MidiRegionView::cut_copy_clear (Editing::CutCopyOp op)
|
|||
switch (op) {
|
||||
case Cut:
|
||||
case Copy:
|
||||
cerr << "Cut/Copy: get selection as CB\n";
|
||||
editor.get_cut_buffer().add (selection_as_cut_buffer());
|
||||
break;
|
||||
default:
|
||||
|
@ -1718,21 +1717,39 @@ MidiRegionView::selection_as_cut_buffer () const
|
|||
}
|
||||
|
||||
void
|
||||
MidiRegionView::paste (nframes64_t pos, const MidiCutBuffer& mcb)
|
||||
MidiRegionView::paste (nframes64_t pos, float times, const MidiCutBuffer& mcb)
|
||||
{
|
||||
MidiModel::DeltaCommand* cmd = _model->new_delta_command("paste");
|
||||
if (mcb.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
start_delta_command (_("paste"));
|
||||
|
||||
MidiModel::TimeType beat_delta;
|
||||
MidiModel::TimeType paste_pos_beats;
|
||||
MidiModel::TimeType duration;
|
||||
|
||||
duration = mcb.notes().back()->end_time() - mcb.notes().front()->time();
|
||||
paste_pos_beats = frames_to_beats (pos);
|
||||
beat_delta = mcb.notes().front()->time() - paste_pos_beats;
|
||||
paste_pos_beats = 0;
|
||||
|
||||
_selection.clear ();
|
||||
|
||||
for (int n = 0; n < (int) times; ++n) {
|
||||
|
||||
for (Evoral::Sequence<MidiModel::TimeType>::Notes::const_iterator i = mcb.notes().begin(); i != mcb.notes().end(); ++i) {
|
||||
|
||||
boost::shared_ptr<NoteType> copied_note (new NoteType (*((*i).get())));
|
||||
copied_note->set_time (copied_note->time() - beat_delta);
|
||||
cmd->add (copied_note);
|
||||
copied_note->set_time (paste_pos_beats + copied_note->time() - beat_delta);
|
||||
|
||||
/* make all newly added notes selected */
|
||||
|
||||
command_add_note (copied_note, true);
|
||||
}
|
||||
|
||||
_model->apply_command(trackview.session(), cmd);
|
||||
paste_pos_beats += duration;
|
||||
}
|
||||
|
||||
apply_command ();
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class MidiRegionView : public RegionView
|
|||
void resolve_note(uint8_t note_num, double end_time);
|
||||
|
||||
void cut_copy_clear (Editing::CutCopyOp);
|
||||
void paste (nframes64_t pos, const MidiCutBuffer&);
|
||||
void paste (nframes64_t pos, float times, const MidiCutBuffer&);
|
||||
|
||||
struct PCEvent {
|
||||
PCEvent(double a_time, uint8_t a_value, uint8_t a_channel)
|
||||
|
|
|
@ -199,7 +199,8 @@ This mode provides many different operations on both regions and control points,
|
|||
@rop|Editor/normalize-region|n|normalize
|
||||
@sess|Main/AddTrackBus|<@PRIMARY@><@TERTIARY@>n|add track(s) or bus(ses)
|
||||
@sess|Main/New|<@PRIMARY@>n|open a new session
|
||||
@rop|Editor/mute-unmute-region|m|mute/unmute
|
||||
@rop|Editor/toggle-internal-edit|<@PRIMARY@>m|toggle MIDI note editing
|
||||
@rop|Editor/mute-unmute-region|<@PRIMARY@>m|mute/unmute
|
||||
@wvis|Common/toggle-editor-mixer-on-top|<@WINDOW@>m|rotate editor \& mixer window
|
||||
|
||||
;; arrow keys, navigation etc.
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "ardour/playlist.h"
|
||||
#include "ardour/rc_configuration.h"
|
||||
|
||||
#include "midi_cut_buffer.h"
|
||||
#include "region_view.h"
|
||||
#include "selection.h"
|
||||
#include "selection_templates.h"
|
||||
|
@ -119,6 +120,9 @@ void
|
|||
Selection::clear_midi_notes ()
|
||||
{
|
||||
if (!midi_notes.empty()) {
|
||||
for (MidiNoteSelection::iterator x = midi_notes.begin(); x != midi_notes.end(); ++x) {
|
||||
delete *x;
|
||||
}
|
||||
midi_notes.clear ();
|
||||
MidiNotesChanged ();
|
||||
}
|
||||
|
@ -233,6 +237,8 @@ Selection::toggle (MidiCutBuffer* midi)
|
|||
if ((i = find (midi_notes.begin(), midi_notes.end(), midi)) == midi_notes.end()) {
|
||||
midi_notes.push_back (midi);
|
||||
} else {
|
||||
/* remember that we own the MCB */
|
||||
delete *i;
|
||||
midi_notes.erase (i);
|
||||
}
|
||||
|
||||
|
@ -369,6 +375,8 @@ Selection::add (const MidiNoteSelection& midi_list)
|
|||
void
|
||||
Selection::add (MidiCutBuffer* midi)
|
||||
{
|
||||
/* we take ownership of the MCB */
|
||||
|
||||
if (find (midi_notes.begin(), midi_notes.end(), midi) == midi_notes.end()) {
|
||||
midi_notes.push_back (midi);
|
||||
MidiNotesChanged ();
|
||||
|
@ -554,6 +562,8 @@ Selection::remove (MidiCutBuffer* midi)
|
|||
MidiNoteSelection::iterator x;
|
||||
|
||||
if ((x = find (midi_notes.begin(), midi_notes.end(), midi)) != midi_notes.end()) {
|
||||
/* remember that we own the MCB */
|
||||
delete *x;
|
||||
midi_notes.erase (x);
|
||||
MidiNotesChanged ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user