52#include "../scopehal/PacketDecoder.h"
65 , m_direction(direction)
74 : m_group(rhs.m_group)
75 , m_direction(rhs.m_direction)
76 , m_stream(rhs.m_stream)
92 std::shared_ptr<WaveformGroup> m_group;
107 std::shared_ptr<Dialog> m_dlg;
116 MainWindow(std::shared_ptr<QueueHandle> queue);
121 void LogMemoryUsage();
123 void AddDialog(std::shared_ptr<Dialog> dlg);
126 void OnScopeAdded(std::shared_ptr<Oscilloscope> scope,
bool createViews);
128 void QueueSplitGroup(std::shared_ptr<WaveformGroup> group, ImGuiDir direction,
StreamDescriptor stream)
132 void ShowInstrumentProperties(std::shared_ptr<Instrument> instrumet);
133 void ShowTriggerProperties();
134 void ShowManageInstruments();
135 void ShowSyncWizard(std::shared_ptr<TriggerGroup> group, std::shared_ptr<Oscilloscope> secondary);
141 int64_t duration = 0,
164 void RenderWaveformTextures(
165 vk::raii::CommandBuffer& cmdbuf,
166 std::vector<std::shared_ptr<DisplayedChannel> >& channels);
171 void ClearPersistence()
177 virtual void Render();
179 void QueueCloseSession()
185 float GetTraceAlpha()
188 float GetPersistDecay()
191 void SetPersistDecay(
float f)
195 const std::string& name,
198 bool showProperties =
true,
199 bool addToArea =
true);
204 const std::vector<std::string>& GetEyeGradients()
205 {
return m_eyeGradients; }
207 std::string GetEyeGradientFriendlyName(std::string internalName)
208 {
return m_eyeGradientFriendlyNames[internalName]; }
224 virtual void DoRender(vk::raii::CommandBuffer& cmdBuf);
232 virtual void RenderUI();
239 std::vector<time_t>& timestamps,
240 std::map<time_t, std::vector<std::string> >& reverseMap,
241 const std::string& typePretty,
242 const std::string& defaultName,
243 const std::string& typeInternal
259 void ToolbarButtons();
260 void TriggerStartDropdown(
float buttonsize);
261 void TriggerSingleDropdown(
float buttonsize);
262 void TriggerForceDropdown(
float buttonsize);
263 void TriggerStopDropdown(
float buttonsize);
264 void DoTriggerDropdown(
const char* action, std::shared_ptr<TriggerGroup>& group,
bool& all);
266 void StatusBar(
float height);
269 void LoadGradient(
const std::string& friendlyName,
const std::string& internalName);
270 std::map<std::string, std::string> m_eyeGradientFriendlyNames;
271 std::vector<std::string> m_eyeGradients;
293 std::map<std::shared_ptr<SCPIMultimeter>, std::shared_ptr<Dialog> >
m_meterDialogs;
296 std::map<std::shared_ptr<SCPIPowerSupply>, std::shared_ptr<Dialog> >
m_psuDialogs;
302 std::map<std::shared_ptr<SCPIBERT>, std::shared_ptr<Dialog> >
m_bertDialogs;
308 std::map<std::shared_ptr<SCPILoad>, std::shared_ptr<Dialog> >
m_loadDialogs;
331 std::string NameNewWaveformGroup();
375 void OnDialogClosed(
const std::shared_ptr<Dialog>& dlg);
415 void DoOpenFile(
const std::string& sessionPath,
bool online);
419 bool LoadUIConfiguration(
int version,
const YAML::Node& node);
421 void OnGraphEditorConfigModified(
const std::string& blob)
424 const std::string& GetGraphEditorConfigBlob()
465 std::string GetDataDir()
483 void LoadRecentInstrumentList();
484 void SaveRecentInstrumentList();
491 void LoadRecentFileList();
492 void SaveRecentFileList();
495 void AddToRecentInstrumentList(std::shared_ptr<SCPIInstrument> inst);
502 std::string m_errorPopupTitle;
503 std::string m_errorPopupMessage;
505 bool m_showingLoadWarnings;
506 bool m_loadConfirmationChecked;
511 void ShowErrorPopup(
const std::string& title,
const std::string& msg);
537 bool DropdownButton(
const char*
id,
float height);
546 auto desc =
m_session.GetPreferences().GetFont(name.c_str());
556 {
return ImGui::GetFontSize() / 13; }
558 ImU32 GetColorPref(
const std::string& name)
559 {
return m_session.GetPreferences().GetColor(name); }
561 ImTextureID GetTexture(
const std::string& name)
562 {
return m_texmgr.GetTexture(name); }
565 {
return &m_texmgr; }
586 void AddStatusHelp(
const std::string& icon,
const std::string& text)
587 { m_statusHelp[icon] = text; }
590 std::map<std::string, std::string> m_statusHelp;
596 int64_t m_toneMapTime;
599 int64_t GetToneMapTime()
600 {
return m_toneMapTime; }
MemoryPressureLevel
Levels of memory pressure.
Definition: AcceleratorBuffer.h:67
MemoryPressureType
Types of memory pressure.
Definition: AcceleratorBuffer.h:84
Declaration of FilterGraphEditor.
Declaration of FontManager.
Declaration of ManageInstrumentsDialog.
Declaration of ProtocolAnalyzerDialog.
Declaration of StreamBrowserDialog.
Declaration of TextureManager.
Declaration of TriggerPropertiesDialog.
Declaration of VulkanWindow.
Declaration of Workspace.
Definition: CreateFilterBrowser.h:44
Pending request to dock a dialog as a top level tab (TODO other options)
Definition: MainWindow.h:101
Abstract base class for a dialog that displays a file picker window.
Definition: FileBrowser.h:44
Abstract base class for all filter graph blocks which are not physical instrument channels.
Definition: Filter.h:95
Definition: FontManager.h:49
ImFont * GetFont(FontDescription desc)
Gets the font, if any, for the provided description.
Definition: FontManager.h:59
WaveShape
Predefined waveform shapes.
Definition: FunctionGenerator.h:55
UI for the history system.
Definition: HistoryDialog.h:47
Top level application window.
Definition: MainWindow.h:114
void DebugSCPIConsoleMenu()
Runs the Debug | SCPI Console menu.
Definition: MainWindow_Menus.cpp:788
std::string m_lastWindowTitle
Last window title set (glfw doesnt let us get this)
Definition: MainWindow.h:462
std::vector< YAML::Node > m_fileBeingLoaded
YAML structure for file we're currently loading.
Definition: MainWindow.h:450
void AddChannelsMenu()
Run the Add | Channels menu.
Definition: MainWindow_Menus.cpp:368
void AddAreaForStreamIfNotAlreadyVisible(StreamDescriptor stream)
Makes sure we have at least one waveform area displaying a given stream.
Definition: MainWindow.cpp:331
std::shared_ptr< CreateFilterBrowser > m_filterPalette
Filter palette.
Definition: MainWindow.h:364
std::map< std::shared_ptr< SCPIBERT >, std::shared_ptr< Dialog > > m_bertDialogs
Map of BERTs to BERT control dialogs.
Definition: MainWindow.h:302
std::vector< SplitGroupRequest > m_splitRequests
Pending requests to split waveform groups.
Definition: MainWindow.h:378
bool LoadSessionFromYaml(const YAML::Node &node, const std::string &dataDir, bool online)
Deserialize a YAML::Node (and associated data directory) to the current session.
Definition: MainWindow.cpp:2370
bool m_fileLoadInProgress
True if we're actively loading a file.
Definition: MainWindow.h:453
Filter * CreateFilter(const std::string &name, WaveformArea *area, StreamDescriptor initialStream, bool showProperties=true, bool addToArea=true)
Creates a filter optionally and adds all of its streams to the best waveform area.
Definition: MainWindow.cpp:1913
std::string m_sessionDataDir
Current session data directory.
Definition: MainWindow.h:459
void RemoveFunctionGenerator(std::shared_ptr< SCPIFunctionGenerator > gen)
Closes the function generator dialog, if we have one.
Definition: MainWindow.cpp:1873
void OnOpenFile(bool online)
Handler for file | open menu. Spawns the browser dialog.
Definition: MainWindow.cpp:2186
std::vector< std::shared_ptr< WaveformGroup > > m_newWaveformGroups
Set of newly created waveform groups that aren't yet docked.
Definition: MainWindow.h:326
std::string m_sessionFileName
Current session file path.
Definition: MainWindow.h:456
std::map< uintptr_t, std::string > GetGraphEditorGroups()
Returns the groups we have configured for our graph editor.
Definition: MainWindow.h:220
YAML::Node SerializeUIConfiguration()
Serialize waveform areas etc to a YAML::Node.
Definition: MainWindow.cpp:3150
void OnCursorMoved(int64_t offset)
Called when a cursor is moved, so protocol analyzers can move highlights as needed.
Definition: MainWindow.cpp:2174
int m_nextWaveformGroup
Name for next autogenerated waveform group.
Definition: MainWindow.h:329
std::shared_ptr< Dialog > m_logViewerDialog
Logfile viewer.
Definition: MainWindow.h:334
Session m_session
Our session object.
Definition: MainWindow.h:404
std::atomic< bool > m_clearPersistence
True if we should clear persistence on the next render pass.
Definition: MainWindow.h:529
bool m_openOnline
True if the pending file is to be opened online.
Definition: MainWindow.h:471
void WindowPSUMenu()
Run the Window | Power Supply menu.
Definition: MainWindow_Menus.cpp:732
std::string GetIconForFilter(Filter *f)
Gets the icon to use for a filter.
Definition: MainWindow_Icons.cpp:608
std::set< std::shared_ptr< Dialog > > m_dialogs
All dialogs and other pop-up UI elements.
Definition: MainWindow.h:290
void LoadStatusBarIcons()
Load icons for the status bar.
Definition: MainWindow_Icons.cpp:227
std::map< std::string, time_t > m_recentInstruments
List of recently used instruments.
Definition: MainWindow.h:481
void LoadToolbarIcons()
Load toolbar icons from disk if preferences changed.
Definition: MainWindow_Icons.cpp:770
void RefreshStreamBrowserDialog()
Update the timebase properties dialog.
Definition: MainWindow.h:147
static bool OnMemoryPressureStatic(MemoryPressureLevel level, MemoryPressureType type, size_t requestedSize)
Static wrapper for calling OnMemoryPressure.
Definition: MainWindow.cpp:3484
void WindowMenu()
Run the Window menu.
Definition: MainWindow_Menus.cpp:533
void DebugMenu()
Run the Debug menu.
Definition: MainWindow_Menus.cpp:814
void WindowGeneratorMenu()
Run the Window | Generator menu.
Definition: MainWindow_Menus.cpp:697
void RefreshTriggerPropertiesDialog()
Update the trigger properties dialog.
Definition: MainWindow.h:156
std::map< InstrumentChannel *, std::shared_ptr< Dialog > > m_channelPropertiesDialogs
Map of channels to properties dialogs.
Definition: MainWindow.h:314
std::shared_ptr< FileBrowser > m_fileBrowser
Browser for pending file loads.
Definition: MainWindow.h:447
std::string GetIconForWaveformShape(FunctionGenerator::WaveShape shape)
Gets the icon to use for a given wave shape.
Definition: MainWindow_Icons.cpp:758
std::shared_ptr< Workspace > m_initialWorkspaceDockRequest
Pending requests to dock initial stuff.
Definition: MainWindow.h:381
void ViewMenu()
Run the View menu.
Definition: MainWindow_Menus.cpp:225
void LoadFilterIcons()
Load icons for the filter graph.
Definition: MainWindow_Icons.cpp:249
std::vector< std::shared_ptr< WaveformGroup > > m_waveformGroups
Waveform groups.
Definition: MainWindow.h:320
std::map< std::shared_ptr< SCPIRFSignalGenerator >, std::shared_ptr< Dialog > > m_rfgeneratorDialogs
Map of RF generators to generator control dialogs.
Definition: MainWindow.h:305
ImVec2 m_workPos
Start position of the viewport minus the menu and toolbar.
Definition: MainWindow.h:281
void AddMenu()
Run the Add menu.
Definition: MainWindow_Menus.cpp:247
std::map< std::type_index, std::string > m_filterIconMap
Map of filter types to class names.
Definition: MainWindow.h:575
std::shared_ptr< Dialog > m_notesDialog
Lab notes.
Definition: MainWindow.h:355
void NavigateToTimestamp(int64_t stamp, int64_t duration=0, StreamDescriptor target=StreamDescriptor(nullptr, 0))
Scrolls all waveform groups so that the specified timestamp is visible.
Definition: MainWindow.cpp:1394
void FileRecentMenu()
Runs the File | Recent menu.
Definition: MainWindow_Menus.cpp:174
void AddImportMenu()
Run the Add | Import menu.
Definition: MainWindow_Menus.cpp:421
void RenderErrorPopup()
Popup message when something big goes wrong.
Definition: MainWindow.cpp:1683
std::shared_ptr< MeasurementsDialog > m_measurementsDialog
Measurements dialog.
Definition: MainWindow.h:373
std::shared_ptr< Dialog > m_preferenceDialog
Preferences.
Definition: MainWindow.h:340
FontWithSize GetFontPref(const std::string &name)
Returns a font, given the name of a preference setting.
Definition: MainWindow.h:544
std::map< std::shared_ptr< SCPIPowerSupply >, std::shared_ptr< Dialog > > m_psuDialogs
Map of PSUs to power supply control dialogs.
Definition: MainWindow.h:296
std::shared_ptr< Dialog > m_persistenceDialog
Persistence settings.
Definition: MainWindow.h:352
std::map< uintptr_t, std::string > m_graphEditorGroups
Group IDs and names for the graph editor.
Definition: MainWindow.h:370
std::unique_ptr< vk::raii::CommandPool > m_cmdPool
Command pool for allocating our command buffers.
Definition: MainWindow.h:532
std::unique_ptr< vk::raii::CommandBuffer > m_cmdBuffer
Command buffer used during rendering operations.
Definition: MainWindow.h:535
bool SetupDataDirectory(const std::string &dataDir)
Make sure the data directory exists.
Definition: MainWindow.cpp:3064
void WindowAnalyzerMenu()
Run the Window | Analyzer menu.
Definition: MainWindow_Menus.cpp:650
void LoadWaveformShapeIcons()
Load icons for wave shape preview.
Definition: MainWindow_Icons.cpp:661
std::map< std::shared_ptr< SCPIInstrument >, std::shared_ptr< Dialog > > m_scpiConsoleDialogs
Map of instruments to SCPI console dialogs.
Definition: MainWindow.h:311
void LoadLabNotes(const std::string &dataDir)
Loads the lab notes from Markdown files in the data directory.
Definition: MainWindow.cpp:2966
float GetFontScale()
Get scaling factor for fonts being drawn with ImDrawList.
Definition: MainWindow.h:555
void OnSaveAs()
Handler for file | save as menu. Spawns the browser dialog.
Definition: MainWindow.cpp:2202
std::map< PacketDecoder *, std::shared_ptr< ProtocolAnalyzerDialog > > m_protocolAnalyzerDialogs
Map of filters to analyzer dialogs.
Definition: MainWindow.h:317
std::map< FunctionGenerator::WaveShape, std::string > m_waveformShapeIconMap
Map of Waveform Shapes to icons.
Definition: MainWindow.h:578
bool PreLoadSessionFromYaml(const YAML::Node &node, const std::string &dataDir, bool online)
Sanity check a YAML::Node (and associated data directory) to the current session without fully loadin...
Definition: MainWindow.cpp:2336
void UpdateFonts()
Font.
Definition: MainWindow.cpp:1889
std::string m_graphEditorConfigBlob
Config blob for filter graph editor.
Definition: MainWindow.h:367
std::map< std::shared_ptr< SCPILoad >, std::shared_ptr< Dialog > > m_loadDialogs
Map of loads to control dialogs.
Definition: MainWindow.h:308
std::shared_ptr< TriggerPropertiesDialog > m_triggerDialog
Trigger properties.
Definition: MainWindow.h:346
float m_traceAlpha
Trace alpha.
Definition: MainWindow.h:392
std::shared_ptr< ManageInstrumentsDialog > m_manageInstrumentsDialog
Manage instruments.
Definition: MainWindow.h:349
void DoSaveFile(std::string sessionPath)
Actually save a file (may be triggered by file|save or file|save as)
Definition: MainWindow.cpp:2863
void FindAreaForStream(WaveformArea *area, StreamDescriptor stream)
Given a stream and optionally a WaveformArea, adds the stream to some area.
Definition: MainWindow.cpp:1989
float m_persistenceDecay
Persistence decay factor.
Definition: MainWindow.h:395
SCPITransport * MakeTransport(const std::string &trans, const std::string &args)
Helper function for creating a transport and printing an error if the connection is unsuccessful.
Definition: MainWindow.cpp:1631
void HelpMenu()
Run the Help menu.
Definition: MainWindow_Menus.cpp:838
std::map< std::shared_ptr< SCPIFunctionGenerator >, std::shared_ptr< Dialog > > m_generatorDialogs
Map of generators to generator control dialogs.
Definition: MainWindow.h:299
void ToneMapAllWaveforms(vk::raii::CommandBuffer &cmdbuf)
Run the tone-mapping shader on all of our waveforms.
Definition: MainWindow.cpp:549
std::shared_ptr< StreamBrowserDialog > m_streamBrowser
Stream browser.
Definition: MainWindow.h:361
bool LoadDialogs(const YAML::Node &node)
Load dialog configuration.
Definition: MainWindow.cpp:2643
ImVec2 m_workSize
Size position of the viewport minus the menu and toolbar.
Definition: MainWindow.h:284
std::shared_ptr< WaveformGroup > GetBestGroupForWaveform(StreamDescriptor stream)
Figure out what group to use for a newly added stream, based on unit compatibility etc.
Definition: MainWindow.cpp:355
void DoOpenFile(const std::string &sessionPath, bool online)
Actually open a file (may be triggered by dialog, command line request, or recent file menu)
Definition: MainWindow.cpp:2246
void AddGenerateMenu()
Run the Add | Generate menu.
Definition: MainWindow_Menus.cpp:456
void ShowErrorPopup(const std::string &title, const std::string &msg)
Opens the error popup.
Definition: MainWindow.cpp:1674
void LoadGradient(const std::string &friendlyName, const std::string &internalName)
Load a single gradient.
Definition: MainWindow.cpp:840
std::map< std::string, time_t > m_recentFiles
List of recently used files.
Definition: MainWindow.h:489
void InitializeDefaultSession()
Creates a new session initialized with some default windows.
Definition: MainWindow.cpp:204
std::set< std::pair< OscilloscopeChannel *, WaveformArea * > > m_pendingChannelDisplayRequests
Pending requests to display a channel in a waveform area (from CreateFilter())
Definition: MainWindow.h:398
void SetupMenu()
Run the Setup menu.
Definition: MainWindow_Menus.cpp:493
void SaveLabNotes(const std::string &dataDir)
Saves the lab notes to Markdown files in the data directory.
Definition: MainWindow.cpp:2918
std::map< std::shared_ptr< SCPIMultimeter >, std::shared_ptr< Dialog > > m_meterDialogs
Map of multimeters to meter control dialogs.
Definition: MainWindow.h:293
void LoadGradients()
Load gradient images.
Definition: MainWindow.cpp:821
std::shared_ptr< Dialog > m_metricsDialog
Performance metrics.
Definition: MainWindow.h:337
YAML::Node SerializeDialogs()
Serializes the list of open dialogs.
Definition: MainWindow.cpp:3232
void MainMenu()
Run the top level menu bar.
Definition: MainWindow_Menus.cpp:103
void WindowMultimeterMenu()
Run the Window | Multimeter menu.
Definition: MainWindow_Menus.cpp:760
bool SaveSessionToYaml(YAML::Node &node, const std::string &dataDir)
Serialize the current session to a YAML::Node.
Definition: MainWindow.cpp:3016
bool m_showDemo
Enable flag for main imgui demo window.
Definition: MainWindow.h:278
void DoAddSubMenu(std::vector< time_t > ×tamps, std::map< time_t, std::vector< std::string > > &reverseMap, const std::string &typePretty, const std::string &defaultName, const std::string &typeInternal)
Run the Add | (instrument type) submenu.
Definition: MainWindow_Menus.cpp:290
bool m_sessionClosing
True if a close-session request came in this frame.
Definition: MainWindow.h:407
void OnScopeAdded(std::shared_ptr< Oscilloscope > scope, bool createViews)
Handles creation of a new oscilloscope.
Definition: MainWindow.cpp:383
void OnFilterReconfigured(Filter *f)
Handle a filter being reconfigured.
Definition: MainWindow.cpp:2154
std::shared_ptr< HistoryDialog > m_historyDialog
History.
Definition: MainWindow.h:343
std::vector< size_t > m_groupsToClose
Pending requests to close waveform groups.
Definition: MainWindow.h:384
std::recursive_mutex m_waveformGroupsMutex
Mutex for controlling access to m_waveformGroups.
Definition: MainWindow.h:323
bool m_needRender
True if a resize or other event this frame requires we re-rasterize waveforms.
Definition: MainWindow.h:524
int m_toolbarIconSize
Cached toolbar icon size.
Definition: MainWindow.h:389
std::shared_ptr< MeasurementsDialog > GetMeasurementsDialog(bool createIfNotExisting)
Return the measurements dialog, if we have one.
Definition: MainWindow.cpp:1657
std::shared_ptr< FilterGraphEditor > m_graphEditor
Filter graph editor.
Definition: MainWindow.h:358
std::set< std::shared_ptr< Workspace > > m_workspaces
Workspaces (can't be with other dialogs because they can contain other stuff)
Definition: MainWindow.h:287
void RenderFileBrowser()
Runs the file browser dialog.
Definition: MainWindow.cpp:2217
void RenderLoadWarningPopup()
Popup message when loading a file that might not match the current hardware setup.
Definition: MainWindow.cpp:1705
void FileMenu()
Run the File menu.
Definition: MainWindow_Menus.cpp:121
Definition: MeasurementsDialog.h:42
Definition: MultimeterDialog.h:42
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47
A Session stores all of the instrument configuration and other state the user has open.
Definition: Session.h:95
Definition: MainWindow.h:61
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46
Manages loading and saving texture resources to files.
Definition: TextureManager.h:103
A GLFW window containing a Vulkan surface.
Definition: VulkanWindow.h:44