mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
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
This commit is contained in:
parent
fe85a922ec
commit
1ee298a235
8 changed files with 89 additions and 10 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
BIN
gtk2_ardour/icons/fade_in_cursor.png
Normal file
BIN
gtk2_ardour/icons/fade_in_cursor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
gtk2_ardour/icons/fade_out_cursor.png
Normal file
BIN
gtk2_ardour/icons/fade_out_cursor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
|
|
@ -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,7 +2225,7 @@ 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)) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue