mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
some rationalization to how Editor & CueEditor (Pianoroll) handle ZoomLevel and TimeOrigin changes
This commit is contained in:
parent
37f318e417
commit
6918a8a267
7 changed files with 21 additions and 20 deletions
|
|
@ -179,11 +179,13 @@ CueEditor::get_current_zoom () const
|
|||
void
|
||||
CueEditor::reposition_and_zoom (samplepos_t pos, double spp)
|
||||
{
|
||||
set_samples_per_pixel (spp);
|
||||
pending_visual_change.add (VisualChange::ZoomLevel);
|
||||
pending_visual_change.samples_per_pixel = spp;
|
||||
|
||||
horizontal_adjustment.set_value (sample_to_pixel (pos));
|
||||
/* correct rounding errors */
|
||||
_leftmost_sample = pos;
|
||||
pending_visual_change.add (VisualChange::TimeOrigin);
|
||||
pending_visual_change.time_origin = pos;
|
||||
|
||||
ensure_visual_change_idle_handler ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -2038,7 +2038,6 @@ EditingContext::set_horizontal_position (double p)
|
|||
p = std::max (0., p);
|
||||
|
||||
horizontal_adjustment.set_value (p);
|
||||
|
||||
_leftmost_sample = (samplepos_t) floor (p * samples_per_pixel);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,6 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider,
|
|||
void reset_zoom (samplecnt_t);
|
||||
virtual double max_extents_scale() const { return 1.0; }
|
||||
virtual void set_samples_per_pixel (samplecnt_t) = 0;
|
||||
virtual void on_samples_per_pixel_changed () {}
|
||||
|
||||
virtual void cycle_zoom_focus ();
|
||||
virtual void set_zoom_focus (Editing::ZoomFocus) = 0;
|
||||
|
|
|
|||
|
|
@ -3815,10 +3815,15 @@ Editor::get_y_origin () const
|
|||
|
||||
|
||||
void
|
||||
Editor::reposition_and_zoom (samplepos_t sample, double fpu)
|
||||
Editor::reposition_and_zoom (samplepos_t pos, double spp)
|
||||
{
|
||||
reset_x_origin (sample);
|
||||
reset_zoom (fpu);
|
||||
pending_visual_change.add (VisualChange::ZoomLevel);
|
||||
pending_visual_change.samples_per_pixel = spp;
|
||||
|
||||
pending_visual_change.add (VisualChange::TimeOrigin);
|
||||
pending_visual_change.time_origin = pos;
|
||||
|
||||
ensure_visual_change_idle_handler ();
|
||||
|
||||
if (!no_save_visual) {
|
||||
undo_visual_stack.push_back (current_visual_state(false));
|
||||
|
|
|
|||
|
|
@ -343,6 +343,7 @@ MidiView::set_region (std::shared_ptr<MidiRegion> mr)
|
|||
_midi_region = mr;
|
||||
|
||||
if (!_midi_region) {
|
||||
std::cerr << "region cleared\n";
|
||||
region_going_away ();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -850,9 +850,7 @@ Pianoroll::set_samples_per_pixel (samplecnt_t spp)
|
|||
view->set_samples_per_pixel (spp);
|
||||
}
|
||||
|
||||
bbt_ruler->set_range (0, current_page_samples());
|
||||
compute_bbt_ruler_scale (0, current_page_samples());
|
||||
bbt_metric.units_per_pixel = spp;
|
||||
update_tempo_based_rulers ();
|
||||
|
||||
horizontal_adjustment.set_upper (max_zoom_extent().second.samples() / samples_per_pixel);
|
||||
horizontal_adjustment.set_page_size (current_page_samples()/ samples_per_pixel / 10);
|
||||
|
|
@ -1962,6 +1960,7 @@ Pianoroll::visual_changer (const VisualChange& vc)
|
|||
if (vc.pending & VisualChange::TimeOrigin) {
|
||||
double new_time_origin = sample_to_pixel_unrounded (vc.time_origin);
|
||||
set_horizontal_position (new_time_origin);
|
||||
update_tempo_based_rulers ();
|
||||
}
|
||||
|
||||
if (vc.pending & VisualChange::YOrigin) {
|
||||
|
|
@ -1969,7 +1968,9 @@ Pianoroll::visual_changer (const VisualChange& vc)
|
|||
}
|
||||
|
||||
if (vc.pending & VisualChange::ZoomLevel) {
|
||||
on_samples_per_pixel_changed ();
|
||||
if (!(vc.pending & VisualChange::TimeOrigin)) {
|
||||
update_tempo_based_rulers ();
|
||||
}
|
||||
} else {
|
||||
/* If the canvas is not being zoomed then the canvas items will not change
|
||||
* and cause Item::prepare_for_render to be called so do it here manually.
|
||||
|
|
@ -1985,12 +1986,6 @@ Pianoroll::visual_changer (const VisualChange& vc)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Pianoroll::on_samples_per_pixel_changed ()
|
||||
{
|
||||
update_tempo_based_rulers ();
|
||||
}
|
||||
|
||||
void
|
||||
Pianoroll::midi_action (void (MidiView::*method)())
|
||||
{
|
||||
|
|
@ -2561,6 +2556,7 @@ Pianoroll::set_region (std::shared_ptr<ARDOUR::MidiRegion> r)
|
|||
unset (false);
|
||||
|
||||
if (!r) {
|
||||
view->set_region (nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,6 @@ class Pianoroll : public CueEditor
|
|||
void mouse_mode_toggled (Editing::MouseMode);
|
||||
|
||||
void escape ();
|
||||
void on_samples_per_pixel_changed ();
|
||||
|
||||
private:
|
||||
ARDOUR::TriggerReference ref;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue