ui: cap and cheapen the dock's events rebuild
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
baf1c73b21
commit
cb098eff75
4 files changed
+133
-34
No files matched your search
+15
-9
@@ -782,10 +782,8 @@ void attach_preview_zoom(GtkWidget* frame, const std::string& path) {
|
||||
GConnectFlags(0));
|
||||
}
|
||||
|
||||
/// A row's first line: when the event was latched, how long it is, and whether it is the one on
|
||||
/// screen. One function because two callers write it -- the row builder and the in-place
|
||||
/// re-mark -- and a mark that reads differently depending on which of them last ran would be
|
||||
/// worse than no mark.
|
||||
/// Whether the event is the one on screen: the one question the title's "(on screen)" and the dock's
|
||||
/// filled mark both ask.
|
||||
bool event_on_screen(const App& app, const EventRecord& r) {
|
||||
return std::string(app.waveform_name) == r.file;
|
||||
}
|
||||
@@ -797,6 +795,10 @@ bool event_in_group(const App& app, const EventRecord& r) {
|
||||
[&](const EventRecord& g) { return g.file == r.file; });
|
||||
}
|
||||
|
||||
/// A row's first line: when the event was latched, how long it is, and whether it is the one on
|
||||
/// screen. One function because two callers write it -- the row builder and the in-place
|
||||
/// re-mark -- and a mark that reads differently depending on which of them last ran would be
|
||||
/// worse than no mark.
|
||||
std::string event_row_title(App& app, const EventRecord& r) {
|
||||
const std::time_t t = static_cast<std::time_t>(r.wall_time);
|
||||
std::tm tm{};
|
||||
@@ -828,7 +830,7 @@ void mark_events_on_screen(App& app) {
|
||||
/// the whole pane describes whichever event happens to be newest rather than the one being read. The
|
||||
/// numbers are one line each: a list that has to load the samples to describe an event is a list that
|
||||
/// cannot show thirty of them.
|
||||
static void rebuild_events_pane_list(App& app) {
|
||||
static void rebuild_events_pane_list(App& app, std::vector<EventRecord>& records) {
|
||||
if (app.events_list == nullptr) return;
|
||||
while (GtkWidget* child = gtk_widget_get_first_child(app.events_list)) {
|
||||
gtk_list_box_remove(GTK_LIST_BOX(app.events_list), child);
|
||||
@@ -838,8 +840,8 @@ static void rebuild_events_pane_list(App& app) {
|
||||
// the one that finds out.
|
||||
app.events_thumb = nullptr;
|
||||
if (app.event_store == nullptr) return;
|
||||
// Not const: a record whose preview had to be redrawn learns its thumbnail's path here.
|
||||
std::vector<EventRecord> records = app.event_store->list();
|
||||
// `records` is the caller's list, not const: a record whose preview had to be redrawn learns its
|
||||
// thumbnail's path here.
|
||||
if (records.empty()) {
|
||||
GtkWidget* empty = gtk_label_new("no events yet -- arm the trigger");
|
||||
gtk_widget_add_css_class(empty, "dim-label");
|
||||
@@ -975,8 +977,12 @@ static void rebuild_events_pane_list(App& app) {
|
||||
/// Both views of the cache, rebuilt from the same list: the pane's rows (with their pictures) and the
|
||||
/// dock's compact ones. The dock follows even when the pane's list does not exist.
|
||||
void refresh_events_pane(App& app) {
|
||||
rebuild_events_pane_list(app);
|
||||
dock_rebuild_events(app);
|
||||
// One read of the cache directory for both views (none without a store, which the pane's rebuild
|
||||
// and the dock's both treat as nothing to list).
|
||||
std::vector<EventRecord> records;
|
||||
if (app.event_store != nullptr) records = app.event_store->list();
|
||||
rebuild_events_pane_list(app, records);
|
||||
if (app.event_store != nullptr) dock_rebuild_events(app, records);
|
||||
}
|
||||
|
||||
/// Clicking a row replays it: the same loader `--open` uses, on the event's file. The acquisition is
|
||||
|
||||
Reference in new issue
Block a user