move grid updating code and members into EditingContext

This commit is contained in:
Paul Davis 2025-01-29 10:52:51 -07:00
parent ef6502d88d
commit 852ad9a7da
8 changed files with 32 additions and 28 deletions

View file

@ -90,6 +90,7 @@ CueEditor::autoscroll_active() const
void
CueEditor::redisplay_grid (bool immediate_redraw)
{
update_grid ();
}
Temporal::timecnt_t

View file

@ -168,6 +168,7 @@ EditingContext::EditingContext (std::string const & name)
, entered_regionview (nullptr)
, clear_entered_track (false)
, grid_lines (nullptr)
, time_line_group (nullptr)
{
using namespace Gtk::Menu_Helpers;
@ -254,6 +255,7 @@ EditingContext::EditingContext (std::string const & name)
EditingContext::~EditingContext()
{
delete grid_lines;
}
void
@ -3348,3 +3350,25 @@ EditingContext::maybe_draw_grid_lines (ArdourCanvas::Container* group)
grid_lines->show();
}
void
EditingContext::update_grid ()
{
if (!_session) {
return;
}
if (_grid_type == GridTypeNone) {
hide_grid_lines ();
} else if (grid_musical()) {
// Temporal::TempoMapPoints grid;
// grid.reserve (4096);
// if (bbt_ruler_scale != bbt_show_many) {
// compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples());
// }
maybe_draw_grid_lines (time_line_group);
} else {
maybe_draw_grid_lines (time_line_group);
}
}

View file

@ -480,6 +480,8 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider
Gtkmm2ext::Bindings* get_bindings() const { return bindings; }
virtual void update_grid ();
protected:
std::string _name;
bool within_track_canvas;
@ -765,6 +767,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider
std::vector<ArdourCanvas::Ruler::Mark> grid_marks;
GridLines* grid_lines;
ArdourCanvas::Container* time_line_group;
void drop_grid ();
void hide_grid_lines ();

View file

@ -154,7 +154,6 @@
#include "selection_properties_box.h"
#include "simple_progress_dialog.h"
#include "sfdb_ui.h"
#include "grid_lines.h"
#include "time_axis_view.h"
#include "timers.h"
#include "ui_config.h"
@ -318,7 +317,6 @@ Editor::Editor ()
, _stationary_playhead (false)
, _maximised (false)
, global_rect_group (0)
, time_line_group (0)
, tempo_marker_menu (0)
, meter_marker_menu (0)
, bbt_marker_menu (0)
@ -3406,27 +3404,6 @@ Editor::cycle_marker_click_behavior ()
}
}
void
Editor::update_grid ()
{
if (!_session) {
return;
}
if (_grid_type == GridTypeNone) {
hide_grid_lines ();
} else if (grid_musical()) {
Temporal::TempoMapPoints grid;
grid.reserve (4096);
if (bbt_ruler_scale != bbt_show_many) {
compute_current_bbt_points (grid, _leftmost_sample, _leftmost_sample + current_page_samples());
}
maybe_draw_grid_lines (time_line_group);
} else {
maybe_draw_grid_lines (time_line_group);
}
}
void
Editor::toggle_stationary_playhead ()
{

View file

@ -250,7 +250,7 @@ public:
/* tempo */
void update_grid ();
// void update_grid ();
/* analysis window */
@ -1640,7 +1640,6 @@ private:
bool _maximised;
ArdourCanvas::Container* global_rect_group;
ArdourCanvas::Container* time_line_group;
void new_tempo_section ();

View file

@ -538,6 +538,8 @@ Pianoroll::canvas_allocate (Gtk::Allocation alloc)
zoom_to_show (timecnt_t (timepos_t (max_extents_scale() * max_zoom_extent ().second.samples())));
zoom_in_allocate = false;
}
update_grid ();
}
timepos_t
@ -1714,7 +1716,7 @@ Pianoroll::visual_changer (const VisualChange& vc)
/* If we are only scrolling vertically there is no need to update these */
if (vc.pending != VisualChange::YOrigin) {
// XXX update_fixed_rulers ();
// XXX redisplay_grid (true);
redisplay_grid (true);
}
}

View file

@ -188,7 +188,6 @@ class Pianoroll : public CueEditor
ArdourCanvas::Container* global_rect_group;
ArdourCanvas::Container* no_scroll_group;
ArdourCanvas::Container* data_group;
ArdourCanvas::Container* time_line_group;
ArdourCanvas::Ruler* bbt_ruler;
ArdourCanvas::Rectangle* tempo_bar;
ArdourCanvas::Rectangle* meter_bar;

View file

@ -191,7 +191,6 @@ public:
add_location_mark_with_flag (where, flags, cue_id);
}
virtual void add_location_mark_with_flag (Temporal::timepos_t const & where, ARDOUR::Location::Flags, int32_t cue_id) = 0;
virtual void update_grid () = 0;
virtual void remove_tracks () = 0;
virtual void set_loop_range (Temporal::timepos_t const & start, Temporal::timepos_t const & end, std::string cmd) = 0;
virtual void set_punch_range (Temporal::timepos_t const & start, Temporal::timepos_t const & end, std::string cmd) = 0;