diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index 2375387301..3a278c6d18 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -2401,7 +2401,7 @@ EditingContext::idle_visual_changer () /* set_horizontal_position() below (and maybe other calls) call gtk_main_iteration(), so it's possible that a signal will be handled half-way through this method. If this signal wants an - idle_visual_changer we must schedule another one after this one, so + idle_visual_changer we must schedule another one after this one, soa mark the idle_handler_id as -1 here to allow that. Also make a note that we are doing the visual change, so that changes in response to super-rapid-screen-update can be dropped if we are still processing @@ -2458,3 +2458,14 @@ EditingContext::reset_zoom (samplecnt_t spp) pending_visual_change.samples_per_pixel = spp; ensure_visual_change_idle_handler (); } + +void +EditingContext::pre_render () +{ + visual_change_queued = false; + + if (pending_visual_change.pending != 0) { + ensure_visual_change_idle_handler(); + } +} + diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index 6fd199e888..acacf2959a 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -375,6 +375,7 @@ public: virtual void mouse_mode_toggled (Editing::MouseMode) = 0; bool on_velocity_scroll_event (GdkEventScroll*); + void pre_render (); protected: std::string _name; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 363d245d24..27756a9ecb 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4235,16 +4235,6 @@ Editor::queue_visual_videotimeline_update () ensure_visual_change_idle_handler (); } -void -Editor::pre_render () -{ - visual_change_queued = false; - - if (pending_visual_change.pending != 0) { - ensure_visual_change_idle_handler(); - } -} - struct EditorOrderTimeAxisSorter { bool operator() (const TimeAxisView* a, const TimeAxisView* b) const { return a->order () < b->order (); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 1f7bdfac74..6a298d564e 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1055,8 +1055,6 @@ private: void tie_vertical_scrolling (); - void pre_render (); - void visual_changer (const VisualChange&); /* track views */ diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 70bd8b49e3..b72392e978 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -276,7 +276,7 @@ Editor::initialize_canvas () _track_canvas->signal_enter_notify_event().connect (sigc::mem_fun(*this, &Editor::entered_track_canvas), false); _track_canvas->set_can_focus (); - _track_canvas->PreRender.connect (sigc::mem_fun(*this, &Editor::pre_render)); + _track_canvas->PreRender.connect (sigc::mem_fun(*this, &EditingContext::pre_render)); /* set up drag-n-drop */ diff --git a/gtk2_ardour/midi_cue_editor.cc b/gtk2_ardour/midi_cue_editor.cc index 7c72305c5d..87a19b12ac 100644 --- a/gtk2_ardour/midi_cue_editor.cc +++ b/gtk2_ardour/midi_cue_editor.cc @@ -190,6 +190,8 @@ MidiCueEditor::build_canvas () _canvas->signal_event().connect (sigc::mem_fun (*this, &MidiCueEditor::canvas_pre_event), false); dynamic_cast(_canvas)->use_nsglview (UIConfiguration::instance().get_nsgl_view_mode () == NSGLHiRes); + _canvas->PreRender.connect (sigc::mem_fun(*this, &EditingContext::pre_render)); + /* scroll group for items that should not automatically scroll * (e.g verbose cursor). It shares the canvas coordinate space. */ @@ -513,8 +515,6 @@ MidiCueEditor::button_press_handler_2 (ArdourCanvas::Item*, GdkEvent*, ItemType) bool MidiCueEditor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type) { - bool were_dragging = false; - if (!Keyboard::is_context_menu_event (&event->button)) { /* see if we're finishing a drag */ @@ -526,8 +526,6 @@ MidiCueEditor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event /* grab dragged, so do nothing else */ return true; } - - were_dragging = true; } } @@ -595,11 +593,9 @@ MidiCueEditor::key_press_handler (ArdourCanvas::Item*, GdkEvent* ev, ItemType) switch (ev->key.keyval) { case GDK_d: set_mouse_mode (Editing::MouseDraw); - std::cerr << "draw\n"; break; case GDK_e: set_mouse_mode (Editing::MouseContent); - std::cerr << "content/edit\n"; break; } @@ -658,8 +654,6 @@ edit_last_mark_label (std::vector& marks, const std:: void MidiCueEditor::metric_get_bbt (std::vector& marks, samplepos_t leftmost, samplepos_t rightmost, gint /*maxchars*/) { - std::cerr << "MCE:mgb s = " << _session << std::endl; - if (_session == 0) { return; } @@ -1003,14 +997,9 @@ MidiCueEditor::metric_get_bbt (std::vector& marks, sa void MidiCueEditor::mouse_mode_toggled (Editing::MouseMode m) { - - std::cerr << "MMT " << enum_2_string (m) << std::endl; - Glib::RefPtr act = get_mouse_mode_action (m); Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); - std::cerr << "active ? " << tact->get_active() << std::endl; - if (!tact->get_active()) { /* this was just the notification that the old mode has been * left. we'll get called again with the new mode active in a @@ -1409,6 +1398,14 @@ MidiCueEditor::visual_changer (const VisualChange& vc) } } +void +MidiCueEditor::on_samples_per_pixel_changed () +{ + if (view) { + view->set_samples_per_pixel (samples_per_pixel); + } +} + void MidiCueEditor::midi_action (void (MidiView::*method)()) { diff --git a/gtk2_ardour/midi_cue_editor.h b/gtk2_ardour/midi_cue_editor.h index 593e074327..1556a31449 100644 --- a/gtk2_ardour/midi_cue_editor.h +++ b/gtk2_ardour/midi_cue_editor.h @@ -123,6 +123,7 @@ class MidiCueEditor : public CueEditor void mouse_mode_toggled (Editing::MouseMode); void escape (); + void on_samples_per_pixel_changed (); private: ArdourCanvas::GtkCanvasViewport* _canvas_viewport; diff --git a/gtk2_ardour/midi_cue_view.cc b/gtk2_ardour/midi_cue_view.cc index d4ef16bed1..e2bc66a2b1 100644 --- a/gtk2_ardour/midi_cue_view.cc +++ b/gtk2_ardour/midi_cue_view.cc @@ -114,7 +114,5 @@ MidiCueView::set_samples_per_pixel (double spp) EditingContext::TempoMapScope tms (_editing_context, map); - std::cerr << "for duration of " << duration << " pixels " << _editing_context.duration_to_pixels (duration) << std::endl; - reset_width_dependent_items (_editing_context.duration_to_pixels (duration)); }