song editing shortcuts
This commit is contained in:
parent
6e087e40e6
commit
f160cc9004
|
@ -81,6 +81,7 @@ Song
|
|||
End: Move to last pattern.
|
||||
Return: Edit selected pattern.
|
||||
Double-Click: Edit pattern at cursor.
|
||||
(or) Create pattern at cursor.
|
||||
F6: Play song starting at selection.
|
||||
|
||||
-- Measure --
|
||||
|
@ -94,9 +95,11 @@ Song
|
|||
|
||||
-- Selection --
|
||||
|
||||
Ctrl+Click: Add pattern to selection,
|
||||
remove pattern from selection.
|
||||
Click+Drag: Box select.
|
||||
Ctrl+Click: Add pattern to selection,
|
||||
remove pattern from selection.
|
||||
Click+Drag: Box select.
|
||||
Ctrl+Left/Right: Add previous/next pattern to selection.
|
||||
Ctrl+Up/Down: Add pattern on previous/next track.
|
||||
|
||||
-- Editing --
|
||||
|
||||
|
@ -107,3 +110,17 @@ Shift+Click+Drag: Move copy of pattern(s) at cursor.
|
|||
+Click+Drag: Move pattern link(s) at cursor.
|
||||
Delete: Remove selected patterns.
|
||||
Ctrl+J: Join patterns across tracks into one.
|
||||
Ctrl+D: Duplicate selection.
|
||||
Ctrl+Shift+D: Duplicate selection as link.
|
||||
Shift+Left/Right: Move patterns along track (+-step).
|
||||
Shift+Up/Down: Move patterns along frame.
|
||||
Shift+
|
||||
PageUp/PageDown: Move patterns along track (+-selection size).
|
||||
Shift+Alt+
|
||||
Left/Right: Resize selected patterns (+-step).
|
||||
Shift+Alt+
|
||||
PageUp/PageDown: Resize selected patterns (/2, *2).
|
||||
Shift+Return: Add new pattern after selection.
|
||||
(or) Add new pattern to loop.
|
||||
(or) Add new pattern at beginning.
|
||||
-- pattern will have selection size.
|
||||
|
|
121
songview.cpp
121
songview.cpp
|
@ -304,7 +304,7 @@ void SongView::add_track() {
|
|||
_tracks_changed();
|
||||
}
|
||||
|
||||
void SongView::new_pattern(const SongCursor &cur) {
|
||||
void SongView::new_pattern(const SongCursor &cur, int size) {
|
||||
if (cur.get_track() >= model->get_track_count())
|
||||
return;
|
||||
int frame = cur.get_frame();
|
||||
|
@ -314,12 +314,29 @@ void SongView::new_pattern(const SongCursor &cur) {
|
|||
(frame < model->loop.get_end())) {
|
||||
frame = model->loop.get_begin();
|
||||
pattern.set_length(model->loop.get_end() - model->loop.get_begin());
|
||||
} else if (size) {
|
||||
pattern.set_length(size);
|
||||
}
|
||||
Song::iterator event = model->song.add_event(frame, track, pattern);
|
||||
clear_selection();
|
||||
select_event(event);
|
||||
}
|
||||
|
||||
void SongView::new_pattern(int size) {
|
||||
SongCursor cur(*this);
|
||||
cur.set_track(0);
|
||||
cur.set_frame(0);
|
||||
int frame_begin, frame_end, track_begin, track_end;
|
||||
if (get_selection_range(frame_begin, frame_end,
|
||||
track_begin, track_end)) {
|
||||
cur.set_frame(frame_end);
|
||||
cur.set_track(track_begin);
|
||||
} else if (model->enable_loop) {
|
||||
cur.set_frame(model->loop.get_begin());
|
||||
}
|
||||
new_pattern(cur, size);
|
||||
}
|
||||
|
||||
void SongView::edit_pattern(Song::iterator iter) {
|
||||
_pattern_edit_request(iter);
|
||||
}
|
||||
|
@ -375,7 +392,7 @@ bool SongView::on_button_press_event(GdkEventButton* event) {
|
|||
} else if (double_click) {
|
||||
interact_mode = InteractNone;
|
||||
cur.set_frame(quantize_frame(cur.get_frame()));
|
||||
new_pattern(cur);
|
||||
new_pattern(cur, get_step_size());
|
||||
} else {
|
||||
if (!ctrl_down)
|
||||
clear_selection();
|
||||
|
@ -547,6 +564,8 @@ void SongView::join_selection() {
|
|||
}
|
||||
|
||||
void SongView::clone_selection(bool references/*=false*/) {
|
||||
invalidate_selection();
|
||||
|
||||
Song::IterList new_selection;
|
||||
|
||||
Song::IterList::iterator iter;
|
||||
|
@ -559,6 +578,7 @@ void SongView::clone_selection(bool references/*=false*/) {
|
|||
}
|
||||
|
||||
selection = new_selection;
|
||||
invalidate_selection();
|
||||
}
|
||||
|
||||
bool SongView::on_motion_notify_event(GdkEventMotion *event) {
|
||||
|
@ -609,12 +629,9 @@ bool SongView::on_motion_notify_event(GdkEventMotion *event) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void SongView::apply_move() {
|
||||
void SongView::do_move(int ofs_frame, int ofs_track) {
|
||||
invalidate_selection();
|
||||
|
||||
int ofs_frame,ofs_track;
|
||||
get_drag_offset(ofs_frame, ofs_track);
|
||||
|
||||
bool can_move = true;
|
||||
// verify that we can move
|
||||
for (Song::IterList::iterator iter = selection.begin();
|
||||
|
@ -646,14 +663,19 @@ void SongView::apply_move() {
|
|||
}
|
||||
|
||||
selection = new_selection;
|
||||
}
|
||||
invalidate_selection();
|
||||
}
|
||||
}
|
||||
|
||||
void SongView::apply_resize() {
|
||||
void SongView::apply_move() {
|
||||
invalidate_selection();
|
||||
|
||||
int ofs_frame,ofs_track;
|
||||
get_drag_offset(ofs_frame, ofs_track);
|
||||
|
||||
do_move(ofs_frame, ofs_track);
|
||||
}
|
||||
|
||||
void SongView::do_resize(int ofs_frame) {
|
||||
// verify that we can move
|
||||
for (Song::IterList::iterator iter = selection.begin();
|
||||
iter != selection.end(); ++iter) {
|
||||
|
@ -667,6 +689,13 @@ void SongView::apply_resize() {
|
|||
invalidate();
|
||||
}
|
||||
|
||||
void SongView::apply_resize() {
|
||||
|
||||
int ofs_frame,ofs_track;
|
||||
get_drag_offset(ofs_frame, ofs_track);
|
||||
do_resize(ofs_frame);
|
||||
}
|
||||
|
||||
bool SongView::on_button_release_event(GdkEventButton* event) {
|
||||
bool ctrl_down = event->state & Gdk::CONTROL_MASK;
|
||||
if (moving()) {
|
||||
|
@ -855,12 +884,72 @@ void SongView::play_from_selection() {
|
|||
bool SongView::on_key_press_event(GdkEventKey* event) {
|
||||
bool ctrl_down = event->state & Gdk::CONTROL_MASK;
|
||||
bool shift_down = event->state & Gdk::SHIFT_MASK;
|
||||
bool alt_down = event->state & Gdk::MOD1_MASK;
|
||||
|
||||
if (ctrl_down) {
|
||||
if (shift_down) {
|
||||
switch (event->keyval) {
|
||||
case GDK_Return: {
|
||||
int f0,f1,t0,t1;
|
||||
if (get_selection_range(f0,f1,t0,t1)) {
|
||||
new_pattern((f1-f0));
|
||||
} else {
|
||||
new_pattern(get_step_size());
|
||||
}
|
||||
return true;
|
||||
} break;
|
||||
case GDK_D: if (ctrl_down) {
|
||||
clone_selection(true);
|
||||
return true;
|
||||
} break;
|
||||
case GDK_Left: {
|
||||
if (alt_down)
|
||||
do_resize(-get_step_size());
|
||||
else
|
||||
do_move(-get_step_size(),0);
|
||||
return true;
|
||||
} break;
|
||||
case GDK_Right: {
|
||||
if (alt_down)
|
||||
do_resize(get_step_size());
|
||||
else
|
||||
do_move(get_step_size(),0);
|
||||
return true;
|
||||
} break;
|
||||
case GDK_Page_Down: {
|
||||
int f0,f1,t0,t1;
|
||||
if (get_selection_range(f0,f1,t0,t1)) {
|
||||
if (alt_down)
|
||||
do_resize((f1-f0));
|
||||
else
|
||||
do_move((f1-f0),0);
|
||||
}
|
||||
return true;
|
||||
} break;
|
||||
case GDK_Page_Up: {
|
||||
int f0,f1,t0,t1;
|
||||
if (get_selection_range(f0,f1,t0,t1)) {
|
||||
if (alt_down)
|
||||
do_resize(-((f1-f0)/2));
|
||||
else
|
||||
do_move(-(f1-f0),0);
|
||||
}
|
||||
return true;
|
||||
} break;
|
||||
case GDK_Up: do_move(0,-1); return true;
|
||||
case GDK_Down: do_move(0, 1); return true;
|
||||
}
|
||||
} else if (ctrl_down) {
|
||||
switch (event->keyval) {
|
||||
case GDK_d: clone_selection(); return true;
|
||||
case GDK_b: set_loop_begin(); return true;
|
||||
case GDK_e: set_loop_end(); return true;
|
||||
case GDK_j: join_selection(); return true;
|
||||
case GDK_Left: navigate(-1,0,true); return true;
|
||||
case GDK_Right: navigate(1,0,true); return true;
|
||||
case GDK_Up: navigate(0,-1,true); return true;
|
||||
case GDK_Down: navigate(0,1,true); return true;
|
||||
case GDK_Home: select_first(true); return true;
|
||||
case GDK_End: select_last(true); return true;
|
||||
default: break;
|
||||
}
|
||||
} else {
|
||||
|
@ -871,12 +960,12 @@ bool SongView::on_key_press_event(GdkEventKey* event) {
|
|||
edit_pattern(selection.front());
|
||||
return true;
|
||||
} break;
|
||||
case GDK_Left: navigate(-1,0,shift_down); return true;
|
||||
case GDK_Right: navigate(1,0,shift_down); return true;
|
||||
case GDK_Up: navigate(0,-1,shift_down); return true;
|
||||
case GDK_Down: navigate(0,1,shift_down); return true;
|
||||
case GDK_Home: select_first(shift_down); return true;
|
||||
case GDK_End: select_last(shift_down); return true;
|
||||
case GDK_Left: navigate(-1,0); return true;
|
||||
case GDK_Right: navigate(1,0); return true;
|
||||
case GDK_Up: navigate(0,-1); return true;
|
||||
case GDK_Down: navigate(0,1); return true;
|
||||
case GDK_Home: select_first(); return true;
|
||||
case GDK_End: select_last(); return true;
|
||||
case GDK_F6: play_from_selection(); return true;
|
||||
default: break;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,8 @@ public:
|
|||
void invalidate();
|
||||
|
||||
void add_track();
|
||||
void new_pattern(const SongCursor &cursor);
|
||||
void new_pattern(const SongCursor &cursor, int length);
|
||||
void new_pattern(int length);
|
||||
void edit_pattern(Song::iterator event);
|
||||
void erase_events();
|
||||
|
||||
|
@ -168,6 +169,8 @@ protected:
|
|||
|
||||
void apply_move();
|
||||
void apply_resize();
|
||||
void do_move(int frame_ofs, int track_ofs);
|
||||
void do_resize(int frame_ofs);
|
||||
|
||||
void update_adjustments();
|
||||
void on_adjustment_value_changed();
|
||||
|
|
Loading…
Reference in New Issue