ngscopeclient 0.1-dev+51fbda87c
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. More...
 
- Public Member Functions inherited from Dialog
 Dialog (const std::string &title, const std::string &id, ImVec2 defaultSize=ImVec2(300, 100))
 
virtual bool Render ()
 Renders the dialog and handles UI events. More...
 
void RenderAsChild ()
 Runs the dialog's contents directly into a parent window.
 
virtual bool DoRender ()=0
 
const std::string & GetID ()
 
std::string GetTitleAndID ()
 

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 ()
 
void renderInfoLink (const char *label, const char *linktext, bool &clicked, bool &hovered)
 Render a link of the "Sample rate: 4 GSa/s" type that shows up in the scope properties box.
 
void startBadgeLine ()
 prepare rendering context to display a badge at the end of current line
 
bool renderBadge (ImVec4 color,...)
 render a badge at the end of current line with provided color and text More...
 
bool renderInstrumentBadge (std::shared_ptr< Instrument > inst, bool latched, InstrumentBadge badge)
 render a badge for an instrument node More...
 
bool renderCombo (ImVec4 color, int &selected, const std::vector< string > &values, bool useColorForText=false, uint8_t cropTextTo=0)
 Render a combo box with provded color and values. More...
 
bool renderCombo (ImVec4 color, int *selected,...)
 Render a combo box with provded color and values. More...
 
bool renderToggle (ImVec4 color, bool curValue)
 Render a toggle button combo. More...
 
bool renderOnOffToggle (bool curValue)
 Render an on/off toggle button combo. More...
 
void renderDownloadProgress (std::shared_ptr< Instrument > inst, InstrumentChannel *chan, bool isLast)
 Render a download progress bar for a given instrument channel. More...
 
void renderPsuRows (bool isVoltage, bool cc, PowerSupplyChannel *chan, const char *setValue, const char *measuredValue, bool &clicked, bool &hovered)
 Render a PSU properties row. More...
 
void renderAwgProperties (std::shared_ptr< FunctionGenerator > awg, FunctionGeneratorChannel *awgchan, bool &clicked, bool &hovered)
 Render AWG channel properties. More...
 
void renderInstrumentNode (shared_ptr< Instrument > instrument)
 Rendering of an instrument node. More...
 
void renderChannelNode (shared_ptr< Instrument > instrument, size_t channelIndex, bool isLast)
 Rendering of a channel node. More...
 
void renderStreamNode (shared_ptr< Instrument > instrument, InstrumentChannel *channel, size_t streamIndex, bool renderName, bool renderProps, bool isLast)
 Rendering of a stream node. More...
 
void renderFilterNode (Filter *filter)
 Rendering of a Filter node. More...
 
- Protected Member Functions inherited from Dialog
bool FloatInputWithApplyButton (const std::string &label, float &currentValue, float &committedValue)
 Helper for displaying a floating-point input box with an "apply" button.
 
bool TextInputWithApplyButton (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. More...
 
void RenderErrorPopup ()
 Popup message when we fail to connect.
 
void ShowErrorPopup (const std::string &title, const std::string &msg)
 Opens the error popup.
 

Protected Attributes

Sessionm_session
 
MainWindowm_parent
 
float m_badgeXMin
 
float m_badgeXCur
 
std::map< std::shared_ptr< Instrument >, bool > m_instrumentDownloadIsSlow
 
std::map< std::shared_ptr< Instrument >, pair< double, InstrumentBadge > > m_instrumentLastBadge
 
- 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
 

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)
 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. More...
 
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. More...
 
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. More...
 
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,
bool &  clicked,
bool &  hovered 
)
protected

Render AWG channel properties.

Parameters
awgthe AWG to render channel properties for
awgchanthe AWG channel to render properties for
clickedoutput param for clicked state
hoveredoutput param for hovered state

◆ renderBadge()

bool StreamBrowserDialog::renderBadge ( ImVec4  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
Returns
true if the badge has been clicked

◆ renderChannelNode()

void StreamBrowserDialog::renderChannelNode ( 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

◆ renderCombo() [1/2]

bool StreamBrowserDialog::renderCombo ( ImVec4  color,
int &  selected,
const std::vector< string > &  values,
bool  useColorForText = false,
uint8_t  cropTextTo = 0 
)
protected

Render a combo box with provded color and values.

Parameters
colorthe color of the combo box
selectedthe selected value index (in/out)
valuesthe combo box values
useColorForTextif true, use the provided color for text (and a darker version of it for background color)
cropTextToif >0 crop the combo text up to this number of characters to have it fit the available space
Returns
true true if the selected value of the combo has been changed

◆ renderCombo() [2/2]

bool StreamBrowserDialog::renderCombo ( ImVec4  color,
int *  selected,
  ... 
)
protected

Render a combo box with provded color and values.

Parameters
colorthe color of the combo box
selectedthe selected value index (in/out)
...the combo box values
Returns
true true if the selected value of the combo has been changed

◆ renderDownloadProgress()

void 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

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()

bool 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 renderd it previous badge has been here for more than a given time)
badgethe badge type

◆ renderInstrumentNode()

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

Rendering of an instrument node.

Parameters
instrumentthe instrument to render

◆ renderOnOffToggle()

bool StreamBrowserDialog::renderOnOffToggle ( bool  curValue)
protected

Render an on/off toggle button combo.

Parameters
curValuethe value of the toggle button
Returns
the selected value for the toggle button

◆ renderPsuRows()

void StreamBrowserDialog::renderPsuRows ( bool  isVoltage,
bool  cc,
PowerSupplyChannel chan,
const char *  setValue,
const char *  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
measuredValuethe measured value text
clickedoutput param for clicked state
hoveredoutput param for hovered state

◆ renderStreamNode()

void StreamBrowserDialog::renderStreamNode ( shared_ptr< Instrument instrument,
InstrumentChannel channel,
size_t  streamIndex,
bool  renderName,
bool  renderProps,
bool  isLast 
)
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
isLasttrue if this is the last stream of the channel

◆ renderToggle()

bool StreamBrowserDialog::renderToggle ( ImVec4  color,
bool  curValue 
)
protected

Render a toggle button combo.

Parameters
colorthe color of the toggle button
curValuethe value of the toggle button
Returns
the selected value for the toggle button

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