Skip to content

Commit 16daf17

Browse files
committed
HistoryDialog: when waveform label text box is focused or hovered, suppress the tooltip on the timestamp which would otherwise mess with focus
1 parent 28ed200 commit 16daf17

File tree

1 file changed

+39
-32
lines changed

1 file changed

+39
-32
lines changed

src/ngscopeclient/HistoryDialog.cpp

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -175,38 +175,7 @@ bool HistoryDialog::DoRender()
175175
m_selectionChanged = true;
176176
m_selectedMarker = nullptr;
177177
}
178-
if(ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal))
179-
{
180-
//Format full details for saved waveforms
181-
string strDetails;
182-
strDetails += string("Waveform acquired on ") + point->m_time.PrettyPrintDate() +
183-
" at " + point->m_time.PrettyPrint() + "\n";
184-
strDetails += "\n";
185-
strDetails += string("Data for ") + to_string(point->m_history.size());
186-
if(point->m_history.size() > 1)
187-
strDetails += " instruments:\n";
188-
else
189-
strDetails += " instrument:\n";
190-
for(auto& jt : point->m_history)
191-
{
192-
//Figure out how many channels actually have non-null waveform data
193-
size_t numNonNull = 0;
194-
for(auto& kt : jt.second)
195-
{
196-
if(kt.second)
197-
numNonNull ++;
198-
}
199-
200-
strDetails += " * " + jt.first->m_nickname + " (" + to_string(numNonNull) + " channels with data)\n";
201-
}
202-
203-
ImGui::BeginTooltip();
204-
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 50);
205-
ImGui::TextUnformatted(strDetails.c_str());
206-
ImGui::PopTextWrapPos();
207-
ImGui::EndTooltip();
208-
}
209-
178+
bool rowIsHovered = ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal);
210179
if(ImGui::BeginPopupContextItem())
211180
{
212181
if(ImGui::MenuItem("Delete"))
@@ -242,16 +211,54 @@ bool HistoryDialog::DoRender()
242211

243212
//Editable nickname box
244213
ImGui::TableSetColumnIndex(2);
214+
bool nicknameFocused = false;
245215
if(rowIsSelected)
246216
{
247217
if(m_selectionChanged)
248218
ImGui::SetKeyboardFocusHere();
249219
ImGui::SetNextItemWidth(ImGui::GetColumnWidth() - 4);
250220
ImGui::InputText("###nick", &point->m_nickname);
221+
222+
if(ImGui::IsItemFocused() || ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNone))
223+
nicknameFocused = true;
251224
}
252225
else
253226
ImGui::TextUnformatted(point->m_nickname.c_str());
254227

228+
//If hovered, but NOT focused on the nickname
229+
if(rowIsHovered && !nicknameFocused)
230+
{
231+
//Format full details for saved waveforms
232+
string strDetails;
233+
strDetails += string("Waveform acquired on ") + point->m_time.PrettyPrintDate() +
234+
" at " + point->m_time.PrettyPrint() + "\n";
235+
strDetails += "\n";
236+
strDetails += string("Data for ") + to_string(point->m_history.size());
237+
if(point->m_history.size() > 1)
238+
strDetails += " instruments:\n";
239+
else
240+
strDetails += " instrument:\n";
241+
for(auto& jt : point->m_history)
242+
{
243+
//Figure out how many channels actually have non-null waveform data
244+
size_t numNonNull = 0;
245+
for(auto& kt : jt.second)
246+
{
247+
if(kt.second)
248+
numNonNull ++;
249+
}
250+
251+
strDetails += " * " + jt.first->m_nickname + " (" + to_string(numNonNull) + " channels with data)\n";
252+
}
253+
254+
ImGui::BeginTooltip();
255+
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 50);
256+
ImGui::TextUnformatted(strDetails.c_str());
257+
ImGui::PopTextWrapPos();
258+
ImGui::EndTooltip();
259+
}
260+
261+
255262
//Child nodes for markers
256263
if(open)
257264
{

0 commit comments

Comments
 (0)