ngscopeclient 0.1-dev+51fbda87c
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
FilterGraphEditor Class Reference
Inheritance diagram for FilterGraphEditor:
Inheritance graph
[legend]
Collaboration diagram for FilterGraphEditor:
Collaboration graph
[legend]

Public Member Functions

 FilterGraphEditor (Session &session, MainWindow *parent)
 
virtual bool Render ()
 Renders the dialog and handles UI events. More...
 
virtual bool DoRender ()
 Renders the dialog and handles UI events. More...
 
std::map< uintptr_t, std::string > GetGroupIDs ()
 Return a list of group IDs and names.
 
- 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 Member Functions

std::map< std::shared_ptr< Instrument >, std::vector< InstrumentChannel * > > GetAllVisibleChannels ()
 Get a list of all channels that we are displaying nodes for.
 
std::vector< FlowGraphNode * > GetAllNodes ()
 Get a list of all objects we're displaying nodes for (channels, filters, triggers, etc)
 
void RefreshGroupPorts ()
 Figure out which source/sink ports are within each group.
 
ax::NodeEditor::PinId CanonicalizePin (ax::NodeEditor::PinId port)
 Gets the actual source/sink pin given a pin which might be a hierarchical port.
 
void OutputPortTooltip (StreamDescriptor stream)
 Display tooltips when mousing over interesting stuff.
 
void DoNodeForGroup (std::shared_ptr< FilterGraphGroup > group)
 
void DoInternalLinksForGroup (std::shared_ptr< FilterGraphGroup > group)
 Handle links between nodes in a group and the hierarchical ports.
 
void DoNodeForGroupOutputs (std::shared_ptr< FilterGraphGroup > group)
 
void DoNodeForGroupInputs (std::shared_ptr< FilterGraphGroup > group)
 
void DoNodeForChannel (InstrumentChannel *channel, std::shared_ptr< Instrument > inst, bool multiInst, int64_t runtime)
 Make a node for a single channel, of any type. More...
 
void DoNodeForTrigger (Trigger *trig)
 Make a node for a trigger.
 
bool HandleNodeProperties ()
 Open the properties window when a node is right clicked. More...
 
void HandleDoubleClicks ()
 Opens a persistent properties window when a node is double clicked.
 
void HandleLinkCreationRequests (Filter *&fReconfigure)
 Handle requests to create a new link.
 
void HandleLinkDeletionRequests (Filter *&fReconfigure)
 Handle requests to delete a link.
 
void HandleBackgroundContextMenu ()
 Show add menu when background is right clicked.
 
void DoAddMenu ()
 Implement the add menu.
 
bool IsBackEdge (FlowGraphNode *src, FlowGraphNode *dst)
 Determine if a proposed edge in the filter graph is a back edge (one whose creation would lead to a cycle) More...
 
void HandleOverlaps ()
 Find nodes that are intersecting, and apply forces to resolve collisions.
 
void CalculateNodeForces (const std::vector< ax::NodeEditor::NodeId > &nodes, const std::vector< bool > &isgroup, const std::vector< bool > &dragging, const std::vector< bool > &nocollide, const std::vector< ImVec2 > &positions, const std::vector< ImVec2 > &sizes, std::vector< ImVec2 > &forces)
 Calculates the forces applied to each node in the graph based on interaction physics.
 
void ApplyNodeForces (const std::vector< ax::NodeEditor::NodeId > &nodes, const std::vector< bool > &isgroup, const std::vector< bool > &dragging, const std::vector< ImVec2 > &positions, std::vector< ImVec2 > &forces)
 Once forces are calculated, actually move the nodes (unless being dragged)
 
void ClearOldPropertiesDialogs ()
 Delete old properties dialogs for no-longer-extant nodes.
 
void NodeIcon (InstrumentChannel *chan, ImVec2 iconpos, ImVec2 iconsize, ImDrawList *list)
 Draws an icon showing the function of a node.
 
void FilterMenu (StreamDescriptor src)
 Runs the "create filter" menu.
 
void FilterSubmenu (StreamDescriptor src, const std::string &name, Filter::Category cat)
 Run the submenu for a single filter category.
 
void CreateChannelMenu ()
 Runs the "add input" menu.
 
ax::NodeEditor::NodeId GetID (FlowGraphNode *node)
 Gets the ID for an arbitrary node.
 
ax::NodeEditor::NodeId GetID (InstrumentChannel *chan)
 
ax::NodeEditor::NodeId GetID (Trigger *trig)
 
ax::NodeEditor::NodeId GetID (std::shared_ptr< FilterGraphGroup > group)
 
uintptr_t AllocateID ()
 Allocate an ID, avoiding collisions with the session IDTable.
 
ax::NodeEditor::PinId GetID (StreamDescriptor stream)
 
ax::NodeEditor::PinId GetID (std::pair< FlowGraphNode *, size_t > input)
 
ax::NodeEditor::LinkId GetID (std::pair< ax::NodeEditor::PinId, ax::NodeEditor::PinId > link)
 
ax::NodeEditor::PinId GetSourcePinForLink (StreamDescriptor source, FlowGraphNode *sink)
 Gets the source pin we should use for drawing a connection. More...
 
ax::NodeEditor::PinId GetSinkPinForLink (StreamDescriptor source, std::pair< FlowGraphNode *, int > sink)
 Gets the sink pin we should use for drawing a connection. More...
 
void RenderForceVector (ImDrawList *list, ImVec2 pos, ImVec2 size, ImVec2 vec)
 
- 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.
 

Static Protected Member Functions

static bool SaveSettingsCallback (const char *data, size_t size, ax::NodeEditor::SaveReasonFlags flags, void *pThis)
 
static size_t LoadSettingsCallback (char *data, void *pThis)
 

Protected Attributes

Sessionm_session
 Session being manipulated.
 
MainWindowm_parent
 Top level window.
 
ax::NodeEditor::Config m_config
 Graph editor setup.
 
ax::NodeEditor::EditorContext * m_context
 Context containing current state of the graph editor.
 
Bijection< StreamDescriptor, ax::NodeEditor::PinId, std::less< StreamDescriptor >, lessID< ax::NodeEditor::PinId > > m_streamIDMap
 Map of streams to output port IDs.
 
Bijection< std::pair< FlowGraphNode *, int >, ax::NodeEditor::PinId, std::less< std::pair< FlowGraphNode *, int > >, lessID< ax::NodeEditor::PinId > > m_inputIDMap
 Map of (channel, input number) to input port IDs.
 
Bijection< std::pair< ax::NodeEditor::PinId, ax::NodeEditor::PinId >, ax::NodeEditor::LinkId, lessIDPair, lessID< ax::NodeEditor::LinkId > > m_linkMap
 Map of (ID, ID) to link IDs.
 
Bijection< FlowGraphNode *, std::shared_ptr< FilterGraphGroup > > m_nodeGroupMap
 Map of signal sources to the group the source node is in (if there is one)
 
uintptr_t m_nextID
 Next link/port ID to be allocated.
 
StreamDescriptor m_newFilterSourceStream
 Source stream of the newly created filter.
 
std::map< ax::NodeEditor::NodeId, std::shared_ptr< EmbeddableDialog >, lessID< ax::NodeEditor::NodeId > > m_propertiesDialogs
 Properties dialogs for channels to be displayed inside nodes.
 
ax::NodeEditor::NodeId m_selectedProperties
 Node whose properties we're currently interacting with.
 
ImVec2 m_createMousePos
 
std::pair< FlowGraphNode *, int > m_createInput
 Input we're considering hooking a new channel up to.
 
Bijection< std::shared_ptr< FilterGraphGroup >, ax::NodeEditor::NodeId, std::less< std::shared_ptr< FilterGraphGroup > >, lessID< ax::NodeEditor::NodeId > > m_groups
 Groups.
 
std::map< ax::NodeEditor::NodeId, ImVec2, lessID< ax::NodeEditor::NodeId > > m_nodeForces
 
- 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
 

Friends

class FilterGraphGroup
 

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

◆ DoNodeForChannel()

void FilterGraphEditor::DoNodeForChannel ( InstrumentChannel channel,
std::shared_ptr< Instrument inst,
bool  multiInst,
int64_t  runtime 
)
protected

Make a node for a single channel, of any type.

TODO: this seems to fail hard if we do not have at least one input OR output on the node. Why?

◆ DoRender()

bool FilterGraphEditor::DoRender ( )
virtual

Renders the dialog and handles UI events.

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

Implements Dialog.

◆ GetSinkPinForLink()

ax::NodeEditor::PinId FilterGraphEditor::GetSinkPinForLink ( StreamDescriptor  source,
std::pair< FlowGraphNode *, int >  sink 
)
protected

Gets the sink pin we should use for drawing a connection.

Note that this may not be the literal sink if we're sinking to a hierarchical port

◆ GetSourcePinForLink()

ax::NodeEditor::PinId FilterGraphEditor::GetSourcePinForLink ( StreamDescriptor  source,
FlowGraphNode sink 
)
protected

Gets the source pin we should use for drawing a connection.

Note that this may not be the literal source if we're sourcing from a hierarchical port

◆ HandleNodeProperties()

bool FilterGraphEditor::HandleNodeProperties ( )
protected

Open the properties window when a node is right clicked.

Returns
True if a node type changed (for now, only triggers)

◆ IsBackEdge()

bool FilterGraphEditor::IsBackEdge ( FlowGraphNode src,
FlowGraphNode dst 
)
protected

Determine if a proposed edge in the filter graph is a back edge (one whose creation would lead to a cycle)

Parameters
srcSource node
dstDestination node
Returns
True if dst is equal to src, or if dst is directly or indirectly used as an input by src.

◆ LoadSettingsCallback()

size_t FilterGraphEditor::LoadSettingsCallback ( char *  data,
void *  pThis 
)
staticprotected
Parameters
dataBuffer to write data into
pThisPointer to the FilterGraphEditor object

This function is called twice, once with a null data argument to get the required size, then again with a valid pointer to store the data. The size must not change between the two invocations.

Returns
Number of bytes required for data

◆ Render()

bool FilterGraphEditor::Render ( )
virtual

Renders the dialog and handles UI events.

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

Reimplemented from Dialog.


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