22* *
33* ngscopeclient *
44* *
5- * Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
5+ * Copyright (c) 2012-2025 Andrew D. Zonenberg and contributors *
66* All rights reserved. *
77* *
88* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
@@ -42,6 +42,33 @@ using namespace std;
4242// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4343// TimePoint
4444
45+ string TimePoint::PrettyPrintDate () const
46+ {
47+ auto base = GetSec ();
48+ auto offset = GetFs ();
49+
50+ // If offset is >1 sec, shift the timestamp
51+ if (offset > FS_PER_SECOND )
52+ {
53+ base += (offset / FS_PER_SECOND );
54+ offset = offset % (int64_t )FS_PER_SECOND ;
55+ }
56+
57+ // Format timestamp
58+ char tmp[128 ];
59+ struct tm ltime;
60+
61+ #ifdef _WIN32
62+ localtime_s (<ime, &base);
63+ #else
64+ localtime_r (&base, <ime);
65+ #endif
66+
67+ strftime (tmp, sizeof (tmp), " %F" , <ime);
68+ string stime = tmp;
69+ return stime;
70+ }
71+
4572string TimePoint::PrettyPrint () const
4673{
4774 auto base = GetSec ();
@@ -65,7 +92,6 @@ string TimePoint::PrettyPrint() const
6592#endif
6693
6794 // round to nearest 100ps for display
68- // TODO: do we want to include date as an optional column or something??
6995 strftime (tmp, sizeof (tmp), " %H:%M:%S." , <ime);
7096 string stime = tmp;
7197 snprintf (tmp, sizeof (tmp), " %010zu" , static_cast <size_t >(offset / 100000 ));
@@ -148,6 +174,37 @@ bool HistoryDialog::DoRender()
148174 m_selectionChanged = true ;
149175 m_selectedMarker = nullptr ;
150176 }
177+ if (ImGui::IsItemHovered (ImGuiHoveredFlags_DelayNormal))
178+ {
179+ // Format full details for saved waveforms
180+ string strDetails;
181+ strDetails += string (" Waveform acquired on " ) + point->m_time .PrettyPrintDate () +
182+ " at " + point->m_time .PrettyPrint () + " \n " ;
183+ strDetails += " \n " ;
184+ strDetails += string (" Data for " ) + to_string (point->m_history .size ());
185+ if (point->m_history .size () > 1 )
186+ strDetails += " instruments:\n " ;
187+ else
188+ strDetails += " instrument:\n " ;
189+ for (auto & jt : point->m_history )
190+ {
191+ // Figure out how many channels actually have non-null waveform data
192+ size_t numNonNull = 0 ;
193+ for (auto & kt : jt.second )
194+ {
195+ if (kt.second )
196+ numNonNull ++;
197+ }
198+
199+ strDetails += " * " + jt.first ->m_nickname + " (" + to_string (numNonNull) + " channels with data)\n " ;
200+ }
201+
202+ ImGui::BeginTooltip ();
203+ ImGui::PushTextWrapPos (ImGui::GetFontSize () * 50 );
204+ ImGui::TextUnformatted (strDetails.c_str ());
205+ ImGui::PopTextWrapPos ();
206+ ImGui::EndTooltip ();
207+ }
151208
152209 if (ImGui::BeginPopupContextItem ())
153210 {
0 commit comments