summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-06-17 22:09:07 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-06-17 22:09:07 +0000
commit1ee298a2354dd14faf925383ec765048a089c0e6 (patch)
tree8ef52f138454a359b1b6409d6ef72842ddca63ac
parentfe85a922ec4a3e0cf1107adadfa50ad7b8417aa3 (diff)
new fade in/out handle cursors from chrisg (maybe to be improved); show MIDI note velocities; try to show note length while dragging notes (in progress); some debugging output
git-svn-id: svn://localhost/ardour2/branches/3.0@7271 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor.cc12
-rw-r--r--gtk2_ardour/editor.h2
-rw-r--r--gtk2_ardour/editor_drag.cc3
-rw-r--r--gtk2_ardour/editor_mouse.cc15
-rw-r--r--gtk2_ardour/icons/fade_in_cursor.pngbin0 -> 1261 bytes
-rw-r--r--gtk2_ardour/icons/fade_out_cursor.pngbin0 -> 1250 bytes
-rw-r--r--gtk2_ardour/midi_region_view.cc65
-rw-r--r--gtk2_ardour/mixer_strip.cc2
8 files changed, 89 insertions, 10 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 98287553ba..fd3ad7471d 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -211,6 +211,8 @@ Gdk::Cursor* Editor::selector_cursor = 0;
Gdk::Cursor* Editor::trimmer_cursor = 0;
Gdk::Cursor* Editor::left_side_trim_cursor = 0;
Gdk::Cursor* Editor::right_side_trim_cursor = 0;
+Gdk::Cursor* Editor::fade_in_cursor = 0;
+Gdk::Cursor* Editor::fade_out_cursor = 0;
Gdk::Cursor* Editor::grabber_cursor = 0;
Gdk::Cursor* Editor::grabber_edit_point_cursor = 0;
Gdk::Cursor* Editor::zoom_cursor = 0;
@@ -1253,6 +1255,16 @@ Editor::build_cursors ()
right_side_trim_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 23, 11);
}
+ {
+ Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("fade_in_cursor"));
+ fade_in_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 1, 41);
+ }
+
+ {
+ Glib::RefPtr<Gdk::Pixbuf> apixbuf (::get_icon ("fade_out_cursor"));
+ fade_out_cursor = new Gdk::Cursor (Gdk::Display::get_default(), apixbuf, 28, 41);
+ }
+
selector_cursor = new Gdk::Cursor (XTERM);
time_fx_cursor = new Gdk::Cursor (SIZING);
wait_cursor = new Gdk::Cursor (WATCH);
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 65af453982..66b580aea5 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -453,6 +453,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
static Gdk::Cursor* trimmer_cursor;
static Gdk::Cursor* right_side_trim_cursor;
static Gdk::Cursor* left_side_trim_cursor;
+ static Gdk::Cursor* fade_in_cursor;
+ static Gdk::Cursor* fade_out_cursor;
static Gdk::Cursor* selector_cursor;
static Gdk::Cursor* grabber_cursor;
static Gdk::Cursor* grabber_edit_point_cursor;
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index ee27e001fd..7f95feb0a8 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -1590,7 +1590,7 @@ NoteResizeDrag::NoteResizeDrag (Editor* e, ArdourCanvas::Item* i)
}
void
-NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
+NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
{
Gdk::Cursor* cursor;
ArdourCanvas::CanvasNote* cnote = dynamic_cast<ArdourCanvas::CanvasNote*>(_item);
@@ -1609,7 +1609,6 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
cursor = _editor->right_side_trim_cursor;
at_front = false;
}
- cerr << "Set cursor for note resize\n";
_item->grab(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, *cursor, event->motion.time);
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 3bf0b3d352..ea9cce3047 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -325,6 +325,8 @@ Editor::mouse_mode_toggled (MouseMode m)
instant_save ();
+ cerr << "Mouse mode toggled to " << m << endl;
+
if (!internal_editing()) {
if (mouse_mode != MouseRange && _join_object_range_state == JOIN_OBJECT_RANGE_NONE) {
@@ -1592,7 +1594,18 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
track_canvas->get_window()->set_cursor (*timebar_cursor);
}
break;
+
case FadeInHandleItem:
+ if (mouse_mode == MouseObject) {
+ ArdourCanvas::SimpleRect *rect = dynamic_cast<ArdourCanvas::SimpleRect *> (item);
+ if (rect) {
+ rect->property_fill_color_rgba() = 0;
+ rect->property_outline_pixels() = 1;
+ }
+ track_canvas->get_window()->set_cursor (*fade_in_cursor);
+ }
+ break;
+
case FadeOutHandleItem:
if (mouse_mode == MouseObject) {
ArdourCanvas::SimpleRect *rect = dynamic_cast<ArdourCanvas::SimpleRect *> (item);
@@ -1600,7 +1613,7 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
rect->property_fill_color_rgba() = 0;
rect->property_outline_pixels() = 1;
}
- track_canvas->get_window()->set_cursor (*grabber_cursor);
+ track_canvas->get_window()->set_cursor (*fade_out_cursor);
}
break;
diff --git a/gtk2_ardour/icons/fade_in_cursor.png b/gtk2_ardour/icons/fade_in_cursor.png
new file mode 100644
index 0000000000..d57a76eccf
--- /dev/null
+++ b/gtk2_ardour/icons/fade_in_cursor.png
Binary files differ
diff --git a/gtk2_ardour/icons/fade_out_cursor.png b/gtk2_ardour/icons/fade_out_cursor.png
new file mode 100644
index 0000000000..fc7f48aa97
--- /dev/null
+++ b/gtk2_ardour/icons/fade_out_cursor.png
Binary files differ
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 46748f1e7f..9062b369fb 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -538,6 +538,8 @@ MidiRegionView::scroll (GdkEventScroll* ev)
bool
MidiRegionView::key_press (GdkEventKey* ev)
{
+ cerr << "MRV key press\n";
+
/* since GTK bindings are generally activated on press, and since
detectable auto-repeat is the name of the game and only sends
repeated presses, carry out key actions at key press, not release.
@@ -614,9 +616,13 @@ MidiRegionView::key_press (GdkEventKey* ev)
return true;
} else if (ev->keyval == GDK_r) {
- /* if we're not step editing, this really doesn't matter */
- midi_view()->step_edit_rest ();
- return true;
+ /* yes, this steals r */
+ if (midi_view()->midi_track()->step_editing()) {
+ midi_view()->step_edit_rest ();
+ cerr << "Stole that r because " << midi_view()->midi_track()->name()
+ << " is step editing!\n";
+ return true;
+ }
}
return false;
@@ -2085,6 +2091,8 @@ MidiRegionView::begin_resizing (bool /*at_front*/)
void
MidiRegionView::update_resizing (ArdourCanvas::CanvasNote* primary, bool at_front, double delta_x, bool relative)
{
+ bool cursor_set = false;
+
for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
SimpleRect* resize_rect = (*i)->resize_rect;
CanvasNote* canvas_note = (*i)->canvas_note;
@@ -2111,6 +2119,37 @@ MidiRegionView::update_resizing (ArdourCanvas::CanvasNote* primary, bool at_fron
resize_rect->property_x2() = snap_to_pixel(current_x);
resize_rect->property_x1() = canvas_note->x1();
}
+
+ if (!cursor_set) {
+ double beats;
+
+ beats = snap_pixel_to_frame (current_x);
+ beats = frames_to_beats (beats);
+
+ double len;
+
+ if (at_front) {
+ if (beats < canvas_note->note()->end_time()) {
+ len = canvas_note->note()->time() - beats;
+ len += canvas_note->note()->length();
+ } else {
+ len = 0;
+ }
+ } else {
+ if (beats >= canvas_note->note()->end_time()) {
+ len = beats - canvas_note->note()->time();
+ } else {
+ len = 0;
+ }
+ }
+
+ char buf[16];
+ snprintf (buf, sizeof (buf), "%.3g beats", len);
+ trackview.editor().show_verbose_canvas_cursor_with (buf);
+
+ cursor_set = true;
+ }
+
}
}
@@ -2186,8 +2225,8 @@ MidiRegionView::change_note_velocity(CanvasNoteEvent* event, int8_t velocity, bo
new_velocity = velocity;
}
- event->show_velocity ();
-
+ // event->show_velocity ();
+
diff_add_change (event, MidiModel::DiffCommand::Velocity, new_velocity);
}
@@ -2336,6 +2375,13 @@ MidiRegionView::change_velocities (bool up, bool fine, bool allow_smush)
i = next;
}
+ if (!_selection.empty()) {
+ char buf[24];
+ snprintf (buf, sizeof (buf), "Vel %d",
+ (int) (*_selection.begin())->note()->velocity());
+ trackview.editor().show_verbose_canvas_cursor_with (buf);
+ }
+
apply_diff();
}
@@ -2830,8 +2876,11 @@ MidiRegionView::snap_changed ()
void
MidiRegionView::show_verbose_canvas_cursor (boost::shared_ptr<NoteType> n) const
{
- char buf[12];
- snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (n->note()).c_str(), (int) n->note ());
+ char buf[24];
+ snprintf (buf, sizeof (buf), "%s (%d)\nVel %d",
+ Evoral::midi_note_name (n->note()).c_str(),
+ (int) n->note (),
+ (int) n->velocity());
trackview.editor().show_verbose_canvas_cursor_with (buf);
}
@@ -2848,6 +2897,8 @@ MidiRegionView::maybe_select_by_position (GdkEventButton* ev, double x, double y
Events e;
MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
+ cerr << "Selecting by position\n";
+
uint16_t chn_mask = mtv->channel_selector().get_selected_channels();
if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index bbef4ffbf6..a7cb17b0db 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -1838,6 +1838,7 @@ MixerStrip::on_key_press_event (GdkEventKey* ev)
break;
case GDK_r:
+ cerr << "Stole that r\n";
rec_enable_press (&fake);
return true;
break;
@@ -1890,6 +1891,7 @@ MixerStrip::on_key_release_event (GdkEventKey* ev)
break;
case GDK_r:
+ cerr << "Stole that r\n";
rec_enable_release (&fake);
return true;
break;