/// <summary> /// Event handler for the form <c>Shown</c> event. Before calling the <c>Shown</c> event handler associated with the parent form, check whether this form was /// called from the form used to display the event log and, if so, modify the image and text associated with the escape key as if this is the case, pressing /// this key should return the user to the event log form rather than home. /// </summary> /// <param name="sender">Reference to the object that raised the event.</param> /// <param name="e">Parameter passed from the object that raised the event.</param> protected override void FormDataStreamPlot_Shown(object sender, EventArgs e) { FormViewEventLog calledFromAsFormViewEventLog = CalledFrom as FormViewEventLog; if (calledFromAsFormViewEventLog != null) { DisplayFunctionKey(Escape, Resources.FunctionKeyTextEsc, Resources.FunctionKeyToolTipEsc, Resources.Edit_Undo); } base.FormDataStreamPlot_Shown(sender, e); // Hide the 'Remove Selected Plot(s)' context menu option as this is not supported on live fault log data. This feature // is only available once the fault log has been saved to disk. // Reference to the TableLayoutPanel associated with each TabPage. TableLayoutPanel tableLayoutPanel; for (int index = 0; index < m_TabControl.TabPages.Count; index++) { tableLayoutPanel = m_TabControl.TabPages[index].Controls[KeyTableLayoutPanel] as TableLayoutPanel; for (int rowIndex = 0; rowIndex < tableLayoutPanel.RowCount; rowIndex++) { IPlotterWatch plotterWatch = (tableLayoutPanel.Controls[rowIndex] as IPlotterWatch); plotterWatch.RemoveSelectedPlot.Enabled = false; plotterWatch.RemoveSelectedPlot.Visible = false; } } }
/// <summary> /// Event handler for the <c>MouseDown</c> event associated with the <c>Plotter</c> control. Check the state of the control key and if this is pressed, add or /// remove the control from the list of selected controls, depending upon whether the control is already in the list of selected controls. If the control /// key is clear then clear the existing list and add the control to the new list. /// </summary> /// <param name="sender">Reference to the object that raised the event.</param> /// <param name="e">Parameter passed from the object that raised the event.</param> private void m_Plotter_MouseDown(object sender, MouseEventArgs e) { // Skip if the Dispose() method has been called. if (IsDisposed) { return; } // Skip if this was raised by any button other than the left mouse button e.g. context menu button etc. if (e.Button != System.Windows.Forms.MouseButtons.Left) { return; } if (ModifierKeys == Keys.Control) { // Check whether the user control is in the list of selected controls. if (Plotter.SelectedControlList.Contains(this) == true) { // Yes - Remove the control from the list. Plotter.SelectedControlList.Remove(this); SetHighlight(false); } else { // No - Add the control to the list. Plotter.SelectedControlList.Add(this); SetHighlight(true); } } else { // Clear the previously selected user controls. foreach (object plotter in Plotter.SelectedControlList) { IPlotterWatch plotterAsIPlotterWatch = plotter as IPlotterWatch; if (plotterAsIPlotterWatch != null) { plotterAsIPlotterWatch.SetHighlight(false); } } Plotter.SelectedControlList.Clear(); // If the user control is not in the list of selected controls, add the user control to the list. Plotter.SelectedControlList.Add(this); SetHighlight(true); } }
/// <summary> /// Call the <c>ResetPlotter</c> or <c>ResetLogicAnalyzer</c> method, as appropriate, on the <c>Plot</c> property associated with the user control. This clears /// the graph display and channel lists so that the whole plotting process can be repeated. /// </summary> /// <param name="plotterWatch">The <c>IPlotterWatch</c> derived user control that is to have its range properties set.</param> /// <param name="parameter">The parameters, as an object array.</param> public void Reset(IPlotterWatch plotterWatch, object parameter) { // Skip, if the Dispose() method has been called. if (m_IsDisposed) { return; } if (plotterWatch == null) { return; } ResetPlotter(plotterWatch.Plot); }
/// <summary> /// Set the <c>BackColor</c>, <c>Font</c> and <c>Size</c> properties of the specified user control to the values specified in the /// <paramref name="parameter"/> object array. /// </summary> /// <param name="plotterWatch">The <c>IPlotterWatch</c> derived user control that is to have its range properties set.</param> /// <param name="parameter">The parameters, as an object array.</param> public void SetAestheticProperties(IPlotterWatch plotterWatch, object parameter) { // Skip, if the Dispose() method has been called. if (m_IsDisposed) { return; } if (plotterWatch == null) { return; } object[] parameters = parameter as object[]; if (parameters == null) { return; } if (parameters.Length < OffsetBackColor + 1) { return; } // Pop the parameter off the stack. Size plotterScalarSize = (Size)parameters[OffsetSizeScalar]; Size plotterEnumeratorSize = (Size)parameters[OffsetSizeEnumerator]; Size plotterBitmaskSize = (Size)parameters[OffsetSizeBitmask]; Font font = (Font)parameters[OffsetFont] as Font; Color backColor = (Color)parameters[OffsetBackColor]; plotterWatch.BackColor = backColor; plotterWatch.Font = font; // Update the Size property of the control. if ((plotterWatch as IPlotterScalar) != null) { plotterWatch.Size = plotterScalarSize; } else if ((plotterWatch as IPlotterEnumerator) != null) { plotterWatch.Size = plotterEnumeratorSize; } else if ((plotterWatch as IPlotterBitmask) != null) { plotterWatch.Size = plotterBitmaskSize; } }
/// <summary> /// Set the range properties of the specified user control to the values contained within the <c>PlotterRangeSelection</c> static structure. /// </summary> /// <param name="plotterWatch">The <c>IPlotterWatch</c> derived user control that is to have its range properties modified.</param> /// <param name="parameter">Not used, this should be set to null.</param> public void SetRangeProperties(IPlotterWatch plotterWatch, object parameter) { // Skip, if the Dispose() method has been called. if (m_IsDisposed) { return; } if (plotterWatch == null) { return; } plotterWatch.StartTime = PlotterRangeSelection.StartTime; plotterWatch.TimeDisplayStyle = TimeAxisStyle.Absolute; plotterWatch.XRange = PlotterRangeSelection.TimeSpan; plotterWatch.Plot.DataIntervalMs = PlotterRangeSelection.DataIntervalMs; plotterWatch.Plot.GraduationsX = DefaultGraduationsX; }