Skip to content

Commit

Permalink
get cue editor "full zoom" button working
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldavisthefirst committed Dec 31, 2024
1 parent 05a18b0 commit eafa090
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
6 changes: 0 additions & 6 deletions gtk2_ardour/cue_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,6 @@ CueEditor::history_changed ()
update_undo_redo_actions (_history);
}

std::pair<Temporal::timepos_t,Temporal::timepos_t>
CueEditor::max_zoom_extent() const
{
return std::make_pair (Temporal::timepos_t (Temporal::Beats()), Temporal::timepos_t (Temporal::Beats (32, 0)));
}

Temporal::timepos_t
CueEditor::_get_preferred_edit_position (Editing::EditIgnoreOption ignore, bool from_context_menu, bool from_outside_canvas)
{
Expand Down
2 changes: 0 additions & 2 deletions gtk2_ardour/cue_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ class CueEditor : public EditingContext, public PBD::HistoryOwner, public sigc::
void do_undo (uint32_t n);
void do_redo (uint32_t n);

std::pair<Temporal::timepos_t,Temporal::timepos_t> max_zoom_extent() const;

Temporal::timepos_t _get_preferred_edit_position (Editing::EditIgnoreOption, bool use_context_click, bool from_outside_canvas);
};

20 changes: 20 additions & 0 deletions gtk2_ardour/midi_cue_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2054,3 +2054,23 @@ MidiCueEditor::build_zoom_focus_menu ()
zoom_focus_selector.set_sizing_texts (zoom_focus_strings);
}


std::pair<Temporal::timepos_t,Temporal::timepos_t>
MidiCueEditor::max_zoom_extent() const
{
if (view && view->midi_region()) {
return std::make_pair (Temporal::timepos_t (Temporal::Beats()), Temporal::timepos_t (view->midi_region()->midi_source()->length().beats()));
}

return std::make_pair (Temporal::timepos_t (Temporal::Beats()), Temporal::timepos_t (Temporal::Beats (32, 0)));
}

void
MidiCueEditor::full_zoom_clicked()
{
/* XXXX NEED LOCAL TEMPO MAP */

std::pair<Temporal::timepos_t,Temporal::timepos_t> dur (max_zoom_extent());
samplecnt_t s = dur.second.samples() - dur.first.samples();
reposition_and_zoom (0, (s / (double) _visible_canvas_width));
}
6 changes: 4 additions & 2 deletions gtk2_ardour/midi_cue_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class MidiCueEditor : public CueEditor
void set_trigger_length (Temporal::timecnt_t const &);
void set_trigger_bounds (Temporal::timepos_t const &, Temporal::timepos_t const &);

void full_zoom_clicked();

protected:
void register_actions ();

Expand Down Expand Up @@ -264,6 +266,6 @@ class MidiCueEditor : public CueEditor
void automation_state_changed ();

void build_zoom_focus_menu ();
};


std::pair<Temporal::timepos_t,Temporal::timepos_t> max_zoom_extent() const;
};

0 comments on commit eafa090

Please sign in to comment.