mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
get mouse-centered zoom working in cue editor
This commit is contained in:
parent
953091bdd2
commit
0ff0d4df8b
5 changed files with 10 additions and 4 deletions
|
|
@ -72,7 +72,7 @@ class CueEditor : public EditingContext, public PBD::HistoryOwner, public sigc::
|
|||
|
||||
void set_zoom_focus (Editing::ZoomFocus);
|
||||
samplecnt_t get_current_zoom () const;
|
||||
void set_samples_per_pixel (samplecnt_t);
|
||||
virtual void set_samples_per_pixel (samplecnt_t);
|
||||
void reposition_and_zoom (samplepos_t, double);
|
||||
|
||||
void set_mouse_mode (Editing::MouseMode, bool force = false);
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ EditingContext::EditingContext (std::string const & name)
|
|||
, bbt_ruler_scale (bbt_show_many)
|
||||
, bbt_bars (0)
|
||||
, bbt_bar_helper_on (0)
|
||||
, _track_canvas_width (0)
|
||||
, _visible_canvas_width (0)
|
||||
, _visible_canvas_height (0)
|
||||
, quantize_dialog (nullptr)
|
||||
|
|
@ -2874,7 +2875,7 @@ EditingContext::temporal_zoom (samplecnt_t spp)
|
|||
nspp = std::min (spp, (samplecnt_t) 2592000);
|
||||
nspp = std::max ((samplecnt_t) 1, nspp);
|
||||
|
||||
new_page_size = (samplepos_t) floor (_visible_canvas_width * nspp);
|
||||
new_page_size = (samplepos_t) floor (_track_canvas_width * nspp);
|
||||
half_page_size = new_page_size / 2;
|
||||
|
||||
Editing::ZoomFocus zf = effective_zoom_focus();
|
||||
|
|
@ -2925,6 +2926,7 @@ EditingContext::temporal_zoom (samplecnt_t spp)
|
|||
}
|
||||
|
||||
if (use_mouse_sample) {
|
||||
|
||||
l = - ((new_page_size * ((where - current_leftmost)/(double)current_page)) - where);
|
||||
|
||||
if (l < 0) {
|
||||
|
|
@ -3150,6 +3152,6 @@ EditingContext::window_event_sample (GdkEvent const * event, double* pcx, double
|
|||
*pcy = d.y;
|
||||
}
|
||||
|
||||
return pixel_to_sample (d.x);
|
||||
return pixel_to_sample (canvas_to_timeline (d.x));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider
|
|||
void reset_x_origin (samplepos_t);
|
||||
void reset_y_origin (double);
|
||||
void reset_zoom (samplecnt_t);
|
||||
void set_samples_per_pixel (samplecnt_t);
|
||||
virtual void set_samples_per_pixel (samplecnt_t) = 0;
|
||||
virtual void on_samples_per_pixel_changed () {}
|
||||
|
||||
virtual void cycle_zoom_focus ();
|
||||
|
|
@ -599,6 +599,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider
|
|||
uint32_t count_bars (Temporal::Beats const & start, Temporal::Beats const & end) const;
|
||||
void compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper);
|
||||
|
||||
double _track_canvas_width;
|
||||
double _visible_canvas_width;
|
||||
double _visible_canvas_height; ///< height of the visible area of the track canvas
|
||||
|
||||
|
|
|
|||
|
|
@ -314,6 +314,7 @@ Editor::track_canvas_viewport_size_allocated ()
|
|||
|
||||
_visible_canvas_width = _canvas_viewport_allocation.get_width ();
|
||||
_visible_canvas_height = _canvas_viewport_allocation.get_height ();
|
||||
_track_canvas_width = _visible_canvas_width;
|
||||
|
||||
_canvas_drop_zone->set_y1 (_canvas_drop_zone->y0() + (_visible_canvas_height - 20.0));
|
||||
|
||||
|
|
|
|||
|
|
@ -412,6 +412,8 @@ MidiCueEditor::canvas_allocate (Gtk::Allocation alloc)
|
|||
bg->set_size (alloc.get_width(), alloc.get_height() - timebars);
|
||||
view->set_height (alloc.get_height() - timebars);
|
||||
prh->set (ArdourCanvas::Rect (0, 0, prh->x1(), view->midi_context().height()));
|
||||
|
||||
_track_canvas_width = _visible_canvas_width - prh->x1();
|
||||
}
|
||||
|
||||
timepos_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue