// Add the given source viewer to the global collection of source files. private static void AddSourceViewer(SourceViewerBaseForm source) { Debug.Assert(source != null); object key = source.GetHashKey(); Debug.Assert(key != null); m_sourceList.Add(key, source); }
// Handle key commands that don't require source focus (like Stepping). public static void HandleGlobalKeyCommand(KeyEventArgs e) { // Find th SourceViewerBaseForm f = m_ActiveSourceFile; if (m_ActiveSourceFile != null) { f.HandleGlobalKeyCommandWorker(e); } }
// There's one SourceViewerForm instance for each source-file // Get the instance for the new source file. // Called on UI thread. public static SourceViewerBaseForm GetSourceFile(MainForm parent, MDbgFunction function) { var source = (SourceViewerBaseForm)m_sourceList[function]; if (source == null) { source = new VirtualSourceViewerForm(parent, function); AddSourceViewer(source); } m_ActiveSourceFile = source; return(source); }
// Track the "active" source file. The UI can use this as the default // target for input (eg, who processes the stepping commands). // There's one SourceViewerForm instance for each source-file // Get the instance for the new source file. // Called on UI thread. public static SourceViewerForm GetSourceFile(MainForm parent, string path) { path = CommandBase.Shell.FileLocator.GetFileLocation(path); var source = (SourceViewerForm)m_sourceList[path]; if (source == null) { source = SourceViewerForm.Build(parent, path); if (source != null) { AddSourceViewer(source); } } m_ActiveSourceFile = source; return(source); }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { // if disposing==true, then we release managed + unmanaged resources. // if disposing==false, then we only release unmanaged resources. if (disposing) { m_sourceList.Remove(GetHashKey()); if (m_ActiveSourceFile == this) { m_ActiveSourceFile = null; } if (components != null) { components.Dispose(); } } base.Dispose(disposing); }
// There's one SourceViewerForm instance for each source-file // Get the instance for the new source file. // Called on UI thread. public static SourceViewerBaseForm GetSourceFile(MainForm parent, MDbgFunction function) { var source = (SourceViewerBaseForm) m_sourceList[function]; if (source == null) { source = new VirtualSourceViewerForm(parent, function); AddSourceViewer(source); } m_ActiveSourceFile = source; return source; }
// Track the "active" source file. The UI can use this as the default // target for input (eg, who processes the stepping commands). // There's one SourceViewerForm instance for each source-file // Get the instance for the new source file. // Called on UI thread. public static SourceViewerForm GetSourceFile(MainForm parent, string path) { path = CommandBase.Shell.FileLocator.GetFileLocation(path); var source = (SourceViewerForm) m_sourceList[path]; if (source == null) { source = SourceViewerForm.Build(parent, path); if (source != null) { AddSourceViewer(source); } } m_ActiveSourceFile = source; return source; }
// this is called on the UI thread. private bool ShowSourceFile(SourceViewerBaseForm f) { if (f == null) { return false; } f.Focus(); cmdInput.Focus(); return true; }