ngscopeclient v0.3
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
StreamBrowserDialog Class Reference
Inheritance diagram for StreamBrowserDialog:
Inheritance graph
[legend]
Collaboration diagram for StreamBrowserDialog:
Collaboration graph
[legend]

Public Member Functions

 StreamBrowserDialog (Session &session, MainWindow *parent)
 
virtual bool DoRender () override
 Renders the dialog and handles UI events.
 
void FlushConfigCache ()
 
- Public Member Functions inherited from Dialog
 Dialog (const std::string &title, const std::string &id, ImVec2 defaultSize=ImVec2(300, 100), Session *session=nullptr, MainWindow *parent=nullptr)
 
virtual bool Render ()
 Renders the dialog and handles UI events.
 
void RenderAsChild ()
 Runs the dialog's contents directly into a parent window.
 
const std::string & GetID ()
 
std::string GetTitleAndID ()
 
template<typename T >
bool renderEditableProperty (float width, const string &label, string &currentValue, T &committedValue, Unit unit, const char *tooltip, optional< ImVec4 > optcolor, bool allow7SegmentDisplay, bool explicitApply)
 Render an editable numeric value.
 

Protected Types

enum  InstrumentBadge {
  BADGE_ARMED , BADGE_STOPPED , BADGE_TRIGGERED , BADGE_BUSY ,
  BADGE_AUTO
}
 State of badges used in intrument node rendering.
 

Protected Member Functions

void DoItemHelp ()
 
bool BeginBlock (const char *label, bool withButton=false, const char *tooltip=nullptr)
 
void EndBlock ()
 
void startBadgeLine ()
 prepare rendering context to display a badge at the end of current line
 
void renderBadge (ImU32 color,...)
 render a badge at the end of current line with provided color and text
 
void renderInstrumentBadge (std::shared_ptr< Instrument > inst, bool latched, InstrumentBadge badge)
 render a badge for an instrument node
 
bool renderCombo (const char *label, bool alignRight, ImVec4 color, int &selected, const std::vector< std::string > &values, bool useColorForText=false, uint8_t cropTextTo=0, bool hideArrow=true, float paddingRight=0)
 
bool renderCombo (const char *label, bool alignRight, ImVec4 color, int *selected,...)
 Render a combo box with provded color and values.
 
bool renderToggle (const char *label, bool alignRight, ImVec4 color, bool &curValue, const char *valueOff="OFF", const char *valueOn="ON", uint8_t cropTextTo=0, float paddingRight=0)
 Render a toggle button combo.
 
bool renderOnOffToggle (const char *label, bool alignRight, bool &curValue, const char *valueOff="OFF", const char *valueOn="ON", uint8_t cropTextTo=0, float paddingRight=0)
 Render an on/off toggle button combo.
 
bool renderDownloadProgress (std::shared_ptr< Instrument > inst, InstrumentChannel *chan, bool isLast)
 Render a download progress bar for a given instrument channel.
 
bool renderPsuRows (bool isVoltage, bool cc, PowerSupplyChannel *chan, std::string &currentValue, float &committedValue, std::string &measuredValue, bool &clicked, bool &hovered)
 Render a PSU properties row.
 
void renderAwgProperties (std::shared_ptr< FunctionGenerator > awg, FunctionGeneratorChannel *awgchan)
 Render AWG channel properties.
 
void renderDmmProperties (std::shared_ptr< Multimeter > dmm, MultimeterChannel *dmmchan, bool isMain, bool &clicked, bool &hovered)
 Render DMM channel properties.
 
void renderInstrumentNode (std::shared_ptr< Instrument > instrument)
 Rendering of an instrument node.
 
std::shared_ptr< StreamBrowserTimebaseInfo > GetTimebaseInfoFor (std::shared_ptr< Oscilloscope > &scope)
 
void DoTimebaseSettings (std::shared_ptr< Oscilloscope > scope)
 Add nodes for timebase controls under an instrument.
 
void DoFrequencySettings (std::shared_ptr< Oscilloscope > scope)
 
void DoSpectrometerSettings (std::shared_ptr< SCPISpectrometer > spec)
 
void renderChannelNode (std::shared_ptr< Instrument > instrument, size_t channelIndex, bool isLast)
 Rendering of a channel node.
 
void renderChannelProperties (std::shared_ptr< Oscilloscope > scope, OscilloscopeChannel *scopechan, size_t channelIndex, std::shared_ptr< OscilloscopeState > scopeState)
 Rendering of channel properties.
 
void renderStreamNode (std::shared_ptr< Instrument > instrument, InstrumentChannel *channel, size_t streamIndex, bool renderName, bool renderProps)
 Rendering of a stream node.
 
void renderFilterNode (Filter *filter)
 Rendering of a Filter node.
 
void SmallDisabledButton (const char *label)
 Helper to render a small button that's non-interactive.
 
- Protected Member Functions inherited from Dialog
bool TextInputWithExplicitApply (const std::string &label, std::string &currentValue, std::string &committedValue)
 
bool IntInputWithImplicitApply (const std::string &label, int &currentValue, int &committedValue)
 
bool UnitInputWithExplicitApply (const std::string &label, std::string &currentValue, float &committedValue, Unit unit)
 Input box for a floating point value with an associated unit and an "apply" button.
 
void renderNumericValue (const std::string &value, bool &clicked, bool &hovered, std::optional< ImVec4 > optcolor=std::nullopt, bool allow7SegmentDisplay=false, float digitHeight=0, bool clickable=true)
 Render a numeric value.
 
void renderReadOnlyProperty (float width, const std::string &label, const std::string &value, const char *tooltip=nullptr)
 Render a read-only instrument property value.
 
template<typename T >
bool renderEditableProperty (float width, const std::string &label, std::string &currentValue, T &committedValue, Unit unit, const char *tooltip=nullptr, std::optional< ImVec4 > optcolor=std::nullopt, bool allow7SegmentDisplay=false, bool explicitApply=false)
 
template<typename T >
bool renderEditablePropertyWithExplicitApply (float width, const std::string &label, std::string &currentValue, T &committedValue, Unit unit, const char *tooltip=nullptr, std::optional< ImVec4 > optcolor=std::nullopt, bool allow7SegmentDisplay=false)
 Render an editable numeric value with explicit apply (if the input value needs to explicitly be applied by clicking the apply button)
 
void renderBadge (float width, ImVec4 color, const std::string &label)
 Render a badge with text inside.
 
void RenderErrorPopup ()
 Popup message when we fail to connect.
 
void ShowErrorPopup (const std::string &title, const std::string &msg)
 Opens the error popup.
 
void Render7SegmentDigit (ImDrawList *drawList, uint8_t digit, ImVec2 size, ImVec2 position, float thikness, ImU32 colorOn, ImU32 colorOff)
 Render a single digit in 7 segment display style.
 
void Render7SegmentValue (const std::string &value, ImVec4 color, float digitHeight)
 Render a numeric value with a 7 segment display style.
 
void Render7SegmentValue (const std::string &value, ImVec4 color, float digitHeight, bool &clicked, bool &hovered, bool clickable=true)
 Render a numeric value with a 7 segment display style.
 

Protected Attributes

float m_badgeXMin
 Positions for badge display.
 
float m_badgeXCur
 
std::map< std::shared_ptr< Instrument >, bool > m_instrumentDownloadIsSlow
 
std::map< std::shared_ptr< Instrument >, std::pair< double, InstrumentBadge > > m_instrumentLastBadge
 Store the last state of an intrument badge (used for badge state latching)
 
std::map< std::shared_ptr< Instrument >, std::shared_ptr< StreamBrowserTimebaseInfo > > m_timebaseConfig
 Map of instruments to timebase settings.
 
std::shared_ptr< StreamGroupDescriptor > m_streamGroupDesciptor
 Reference to currently dragged StreamGroupDesciptor.
 
- Protected Attributes inherited from Dialog
bool m_open
 
std::string m_id
 
std::string m_title
 
ImVec2 m_defaultSize
 
std::string m_errorPopupTitle
 
std::string m_errorPopupMessage
 
Session * m_session
 optional reference to session
 
MainWindow * m_parent
 optional reference to parent MainWindow
 
ImGuiID m_editedItemId = 0
 Id of the item currently beeing edited.
 
ImGuiID m_lastEditedItemId = 0
 Id of the last edited item.
 

Additional Inherited Members

- Static Public Member Functions inherited from Dialog
static bool Combo (const std::string &label, const std::vector< std::string > &items, int &selection, bool *open=nullptr)
 Displays a combo box from a vector<string>
 
static bool UnitInputWithImplicitApply (const std::string &label, std::string &currentValue, float &committedValue, Unit unit)
 Input box for a floating point value with an associated unit.
 
static bool UnitInputWithImplicitApply (const std::string &label, std::string &currentValue, double &committedValue, Unit unit)
 Input box for a double precision floating point value with an associated unit.
 
static bool UnitInputWithImplicitApply (const std::string &label, std::string &currentValue, int64_t &committedValue, Unit unit)
 Input box for an integer value with an associated unit.
 
static bool TextInputWithImplicitApply (const std::string &label, std::string &currentValue, std::string &committedValue)
 
static void Tooltip (const std::string &str, bool allowDisabled=false)
 Helper based on imgui demo for displaying tooltip text over the previously rendered widget.
 
static void HelpMarker (const std::string &str)
 
static void HelpMarker (const std::string &header, const std::vector< std::string > &bullets)
 

Member Function Documentation

◆ DoRender()

bool StreamBrowserDialog::DoRender ( )
overridevirtual

Renders the dialog and handles UI events.

Returns
True if we should continue showing the dialog False if it's been closed

Implements Dialog.

◆ renderAwgProperties()

void StreamBrowserDialog::renderAwgProperties ( std::shared_ptr< FunctionGenerator >  awg,
FunctionGeneratorChannel *  awgchan 
)
protected

Render AWG channel properties.

Parameters
awgthe AWG to render channel properties for
awgchanthe AWG channel to render properties for

◆ renderBadge()

void StreamBrowserDialog::renderBadge ( ImU32  color,
  ... 
)
protected

render a badge at the end of current line with provided color and text

Parameters
colorthe color of the badge
...a null terminated list of labels form the largest to the smallest to use as a badge label according to the available space

◆ renderChannelNode()

void StreamBrowserDialog::renderChannelNode ( std::shared_ptr< Instrument >  instrument,
size_t  channelIndex,
bool  isLast 
)
protected

Rendering of a channel node.

Parameters
instrumentthe instrument containing the instrument to render
channelIndexthe index of the channel to render
isLasttrue if this is the last channel of the instrument

◆ renderChannelProperties()

void StreamBrowserDialog::renderChannelProperties ( std::shared_ptr< Oscilloscope >  scope,
OscilloscopeChannel *  scopechan,
size_t  channelIndex,
std::shared_ptr< OscilloscopeState >  scopeState 
)
protected

Rendering of channel properties.

Parameters
scopethe scope
scopechanthe scope channel
channelIndexthe index of the channel
scopeStatethe OscilloscopeState

◆ renderCombo()

bool StreamBrowserDialog::renderCombo ( const char *  label,
bool  alignRight,
ImVec4  color,
int *  selected,
  ... 
)
protected

Render a combo box with provded color and values.

Parameters
labelLabel for the combo box
alignRighttrue if the combo should be aligned to the right
colorthe color of the combo box
selectedthe selected value index (in/out)
...the combo box values
Returns
true if the selected value of the combo has been changed

◆ renderDmmProperties()

void StreamBrowserDialog::renderDmmProperties ( std::shared_ptr< Multimeter >  dmm,
MultimeterChannel *  dmmchan,
bool  isMain,
bool &  clicked,
bool &  hovered 
)
protected

Render DMM channel properties.

Parameters
dmmthe DMM to render channel properties for
dmmchanthe DMM channel to render properties for
clickedoutput param for clicked state
hoveredoutput param for hovered state

◆ renderDownloadProgress()

bool StreamBrowserDialog::renderDownloadProgress ( std::shared_ptr< Instrument >  inst,
InstrumentChannel *  chan,
bool  isLast 
)
protected

Render a download progress bar for a given instrument channel.

Parameters
instthe instrument to render the progress channel for
chanthe channel to render the progress for
isLasttrue if it is the last channel of the instrument
Returns
Returns true if the progress bar has been rendered

hysteresis threshold for a channel finishing a download faster than this to be declared fast

hysteresis threshold for a channel finishing a still being in progress for longer than this to be declared slow

Width used to display progress bars (e.g. download progress bar)

◆ renderFilterNode()

void StreamBrowserDialog::renderFilterNode ( Filter *  filter)
protected

Rendering of a Filter node.

Parameters
filterthe filter to render

◆ renderInstrumentBadge()

void StreamBrowserDialog::renderInstrumentBadge ( std::shared_ptr< Instrument >  inst,
bool  latched,
InstrumentBadge  badge 
)
protected

render a badge for an instrument node

Parameters
instthe instrument to render the badge for
latchedtrue if the redering of this batch should be latched (i.e. only render if previous badge has been here for more than a given time)
badgethe badge type

◆ renderInstrumentNode()

void StreamBrowserDialog::renderInstrumentNode ( std::shared_ptr< Instrument >  instrument)
protected

Rendering of an instrument node.

Parameters
instrumentthe instrument to render

◆ renderOnOffToggle()

bool StreamBrowserDialog::renderOnOffToggle ( const char *  label,
bool  alignRight,
bool &  curValue,
const char *  valueOff = "OFF",
const char *  valueOn = "ON",
uint8_t  cropTextTo = 0,
float  paddingRight = 0 
)
protected

Render an on/off toggle button combo.

Parameters
labelLabel for the combo box
alignRighttrue if the combo should be aligned to the right
curValuethe value of the toggle button
valueOfflabel for value off (optional, defaults to "OFF")
valueOnlabel for value on (optional, defaults to "ON")
cropTextToif >0 crop the combo text up to this number of characters to have it fit the available space (optional, defaults to 0)
paddingRightthe padding to leave at the right of the combo when alighRight is true (defaults to 0)
Returns
true if value has changed

◆ renderPsuRows()

bool StreamBrowserDialog::renderPsuRows ( bool  isVoltage,
bool  cc,
PowerSupplyChannel *  chan,
std::string &  currentValue,
float &  committedValue,
std::string &  measuredValue,
bool &  clicked,
bool &  hovered 
)
protected

Render a PSU properties row.

Parameters
isVoltagetrue for voltage rows, false for current rows
cctrue if the PSU channel is in constant current mode, false for constant voltage mode
chanthe PSU channel to render properties for
setValuethe set value text
committedValuethe last commited value
measuredValuethe measured value text
clickedoutput param for clicked state
hoveredoutput param for hovered state
Returns
true if the value has been modified

◆ renderStreamNode()

void StreamBrowserDialog::renderStreamNode ( std::shared_ptr< Instrument >  instrument,
InstrumentChannel *  channel,
size_t  streamIndex,
bool  renderName,
bool  renderProps 
)
protected

Rendering of a stream node.

Parameters
instrumentthe instrument containing the stream to render (may be null if the stream is in a Filter)
channelthe channel or the Filter containing the stream to render
streamIndexthe index of the stream to render
renderNametrue if the name of the stream should be rendred as a selectable item
renderPropstrue if a properties block should be rendered for this stream

◆ renderToggle()

bool StreamBrowserDialog::renderToggle ( const char *  label,
bool  alignRight,
ImVec4  color,
bool &  curValue,
const char *  valueOff = "OFF",
const char *  valueOn = "ON",
uint8_t  cropTextTo = 0,
float  paddingRight = 0 
)
protected

Render a toggle button combo.

Parameters
labelLabel for the combo box
alignRighttrue if the combo should be aligned to the right
colorthe color of the toggle button
curValuethe value of the toggle button
valueOfflabel for value off (optional, defaults to "OFF")
valueOnlabel for value on (optional, defaults to "ON")
cropTextToif >0 crop the combo text up to this number of characters to have it fit the available space (optional, defaults to 0)
paddingRightthe padding to leave at the right of the combo when alighRight is true (defaults to 0)
Returns
true if selection has changed

The documentation for this class was generated from the following files: