@@ -370,6 +370,8 @@ bool StreamBrowserDialog::renderCombo(
370370 @param color the color of the toggle button
371371 @param curValue the value of the toggle button
372372 @return the selected value for the toggle button
373+
374+ TODO: replace with renderToggleEXT
373375 */
374376bool StreamBrowserDialog::renderToggle (const char * label, bool alignRight, ImVec4 color, bool curValue)
375377{
@@ -378,11 +380,28 @@ bool StreamBrowserDialog::renderToggle(const char* label, bool alignRight, ImVec
378380 return (selection == 1 );
379381}
380382
383+ /* *
384+ @brief Render a toggle button combo
385+
386+ @param color the color of the toggle button
387+ @param curValue the value of the toggle button
388+ @return true if selection has changed
389+ */
390+ bool StreamBrowserDialog::renderToggleEXT (const char * label, bool alignRight, ImVec4 color, bool & curValue)
391+ {
392+ int selection = (int )curValue;
393+ bool ret = renderCombo (label, alignRight, color, &selection, " OFF" , " ON" , nullptr );
394+ curValue = (selection == 1 );
395+ return ret;
396+ }
397+
381398/* *
382399 @brief Render an on/off toggle button combo
383400
384401 @param curValue the value of the toggle button
385402 @return the selected value for the toggle button
403+
404+ TODO: replace with renderOnOffToggleEXT
386405 */
387406bool StreamBrowserDialog::renderOnOffToggle (const char * label, bool alignRight, bool curValue)
388407{
@@ -394,6 +413,22 @@ bool StreamBrowserDialog::renderOnOffToggle(const char* label, bool alignRight,
394413 return renderToggle (label, alignRight, color, curValue);
395414}
396415
416+ /* *
417+ @brief Render an on/off toggle button combo
418+
419+ @param curValue the value of the toggle button
420+ @return true if value has changed
421+ */
422+ bool StreamBrowserDialog::renderOnOffToggleEXT (const char * label, bool alignRight, bool & curValue)
423+ {
424+ auto & prefs = m_session.GetPreferences ();
425+ ImVec4 color = ImGui::ColorConvertU32ToFloat4 (
426+ (curValue ?
427+ prefs.GetColor (" Appearance.Stream Browser.instrument_on_badge_color" ) :
428+ prefs.GetColor (" Appearance.Stream Browser.instrument_off_badge_color" )));
429+ return renderToggleEXT (label, alignRight, color, curValue);
430+ }
431+
397432/* *
398433 @brief Render a download progress bar for a given instrument channel
399434
@@ -1053,7 +1088,7 @@ void StreamBrowserDialog::DoTimebaseSettings(shared_ptr<Oscilloscope> scope)
10531088 ImGui::SetNextItemWidth (width);
10541089 bool disabled = !scope->CanInterleave ();
10551090 ImGui::BeginDisabled (disabled);
1056- if (renderOnOffToggle (" Interleaving" , false , config->m_interleaving ))
1091+ if (renderOnOffToggleEXT (" Interleaving" , false , config->m_interleaving ))
10571092 {
10581093 scope->SetInterleaving (config->m_interleaving );
10591094 refresh = true ;
0 commit comments