/// <summary> /// Initializes a new instance of the VGCursor class. /// Clone Constructor. Creates new cursor element that is /// identical to the given cursor. /// </summary> /// <param name="cursor">VGCursor to clone</param> private VGCursor(VGCursor cursor) : base( cursor.ShapeDrawAction, cursor.Pen, cursor.Brush, cursor.Font, cursor.FontColor, cursor.Bounds, cursor.StyleGroup, cursor.Name, cursor.ElementGroup, cursor.Sound) { this.cursorType = cursor.CursorType; }
/// <summary> /// Initializes standard values of drawing elements /// </summary> private void InitializeElements() { try { this.penGazeCursor = new Pen(Properties.Settings.Default.GazeCursorColor, Properties.Settings.Default.GazeCursorWidth); this.penGazeCursor.DashStyle = Properties.Settings.Default.GazeCursorStyle; this.penGazePath = new Pen(Properties.Settings.Default.GazePathColor, Properties.Settings.Default.GazePathWidth); this.penGazePath.DashStyle = Properties.Settings.Default.GazePathStyle; this.penGazePath.LineJoin = LineJoin.Round; this.penGazeFixation = new Pen(Properties.Settings.Default.GazeFixationsPenColor, Properties.Settings.Default.GazeFixationsPenWidth); this.penGazeFixation.DashStyle = Properties.Settings.Default.GazeFixationsPenStyle; this.penGazeFixationConnection = new Pen(Properties.Settings.Default.GazeFixationConnectionsPenColor, Properties.Settings.Default.GazeFixationConnectionsPenWidth); this.penGazeFixation.DashStyle = Properties.Settings.Default.GazeFixationConnectionsPenStyle; this.penGazeNoData = new Pen(Properties.Settings.Default.GazeNoDataColor, Properties.Settings.Default.GazeNoDataWidth); this.penGazeNoData.DashStyle = Properties.Settings.Default.GazeNoDataStyle; this.penMouseCursor = new Pen(Properties.Settings.Default.MouseCursorColor, Properties.Settings.Default.MouseCursorWidth); this.penMouseCursor.DashStyle = Properties.Settings.Default.MouseCursorStyle; this.penMousePath = new Pen(Properties.Settings.Default.MousePathColor, Properties.Settings.Default.MousePathWidth); this.penMousePath.DashStyle = Properties.Settings.Default.MousePathStyle; this.penMousePath.LineJoin = LineJoin.Round; this.penMouseFixation = new Pen(Properties.Settings.Default.MouseFixationsPenColor, Properties.Settings.Default.MouseFixationsPenWidth); this.penMouseFixation.DashStyle = Properties.Settings.Default.MouseFixationsPenStyle; this.penMouseFixationConnection = new Pen(Properties.Settings.Default.MouseFixationConnectionsPenColor, Properties.Settings.Default.MouseFixationConnectionsPenWidth); this.penMouseFixationConnection.DashStyle = Properties.Settings.Default.MouseFixationConnectionsPenStyle; this.gazePicEllipse = new VGEllipse(ShapeDrawAction.Fill, this.GrayBrush); this.gazePicEllipse.Inverted = true; this.gazePicEllipse.ElementGroup = "Default"; this.mousePicEllipse = new VGEllipse(ShapeDrawAction.Fill, this.GrayBrush); this.mousePicEllipse.Inverted = true; this.mousePicEllipse.ElementGroup = "Default"; this.gazeRawPolyline = new VGPolyline(ShapeDrawAction.Edge, this.penGazePath, VGStyleGroup.RPL_PEN_GAZE_PATH, string.Empty, string.Empty); this.gazeRawPolyline.ElementGroup = "Default"; this.mouseRawPolyline = new VGPolyline(ShapeDrawAction.Edge, this.penMousePath, VGStyleGroup.RPL_PEN_MOUSE_PATH, string.Empty, string.Empty); this.mouseRawPolyline.ElementGroup = "Default"; this.gazeFixEllipse = new VGEllipse(ShapeDrawAction.Edge, this.penGazeFixation, VGStyleGroup.RPL_PEN_GAZE_FIX, string.Empty, string.Empty); this.gazeFixEllipse.ElementGroup = "Default"; this.mouseFixEllipse = new VGEllipse(ShapeDrawAction.Edge, this.penMouseFixation, VGStyleGroup.RPL_PEN_MOUSE_FIX, string.Empty, string.Empty); this.mouseFixEllipse.ElementGroup = "Default"; this.gazeFixConPolyline = new VGPolyline(ShapeDrawAction.Edge, this.penGazeFixationConnection, VGStyleGroup.RPL_PEN_GAZE_FIXCON, string.Empty, string.Empty); this.gazeFixConPolyline.ElementGroup = "Default"; this.mouseFixConPolyline = new VGPolyline(ShapeDrawAction.Edge, this.penMouseFixationConnection, VGStyleGroup.RPL_PEN_MOUSE_FIXCON, string.Empty, string.Empty); this.mouseFixConPolyline.ElementGroup = "Default"; this.gazeFixConLine = new VGLine(ShapeDrawAction.Edge, this.penGazeFixationConnection, VGStyleGroup.RPL_PEN_GAZE_FIXCON, string.Empty, string.Empty); this.gazeFixConLine.ElementGroup = "Default"; this.mouseFixConLine = new VGLine(ShapeDrawAction.Edge, this.penMouseFixationConnection, VGStyleGroup.RPL_PEN_MOUSE_FIXCON, string.Empty, string.Empty); this.mouseFixConLine.ElementGroup = "Default"; var gazeCursorSize = (float)Properties.Settings.Default.GazeCursorSize; var gazeCursorType = (VGCursor.DrawingCursors)Enum.Parse( typeof(VGCursor.DrawingCursors), Properties.Settings.Default.GazeCursorType); this.gazeCursor = new VGCursor(this.penGazeCursor, gazeCursorType, gazeCursorSize, VGStyleGroup.RPL_PEN_GAZE_CURSOR); this.gazeCursor.ElementGroup = "Default"; var mouseCursorSize = (float)Properties.Settings.Default.MouseCursorSize; var mouseCursorType = (VGCursor.DrawingCursors)Enum.Parse( typeof(VGCursor.DrawingCursors), Properties.Settings.Default.MouseCursorType); this.mouseCursor = new VGCursor(this.penMouseCursor, mouseCursorType, mouseCursorSize, VGStyleGroup.RPL_PEN_MOUSE_CURSOR); this.mouseCursor.ElementGroup = "Default"; if (Document.ActiveDocument != null) { this.visiblePartOfScreen = new VGRectangle( ShapeDrawAction.Edge, Pens.Red, Document.ActiveDocument.PresentationSizeRectangle); this.visiblePartOfScreen.Visible = false; } } catch (Exception ex) { ExceptionMethods.HandleException(ex); } }
/// <summary> /// <see cref="DrawingCursorChanged"/> event handler. /// Is Raised when the cursor element has changed. /// Updates all graphic elements from the given group /// with the new cursor shape. /// </summary> /// <param name="sender"> /// Source of the event. /// </param> /// <param name="e"> /// A <see cref="ShapeEventArgs"/> with the new cursor shape. /// </param> public void DrawingCursorChanged(object sender, ShapeEventArgs e) { switch (e.Shape.StyleGroup) { case VGStyleGroup.RPL_PEN_GAZE_CURSOR: e.Shape.Pen = this.penGazeCursor; this.gazeCursor = (VGCursor)e.Shape; break; case VGStyleGroup.RPL_PEN_MOUSE_CURSOR: e.Shape.Pen = this.penMouseCursor; this.mouseCursor = (VGCursor)e.Shape; break; } var sublist = this.Elements.FindAllGroupMembers(e.Shape.StyleGroup); if (sublist.Count == 1) { var storeCenter = sublist[0].Center; this.Elements.Remove(sublist[0]); e.Shape.Center = storeCenter; this.Elements.Add(e.Shape); } this.DrawForeground(true); }
/// <summary> /// Draws a mouse click cursor at the given point /// </summary> /// <param name="pt"> /// A <see cref="PointF"/> with the center of the mouse click. /// </param> /// <param name="button"> /// A <see cref="MouseButtons"/> value that indicates the clicked button. /// </param> public void DrawMouseClick(PointF pt, MouseButtons button) { var cursorType = VGCursor.DrawingCursors.Mouse; switch (button) { case MouseButtons.Left: cursorType = VGCursor.DrawingCursors.MouseLeft; break; case MouseButtons.None: return; case MouseButtons.Right: cursorType = VGCursor.DrawingCursors.MouseRight; break; } var mouseClick = new VGCursor( Pens.White, Brushes.Red, cursorType, 20f, VGStyleGroup.RPL_MOUSE_CLICK); mouseClick.Center = pt; this.Elements.Add(mouseClick); }
/////////////////////////////////////////////////////////////////////////////// // Eventhandler // /////////////////////////////////////////////////////////////////////////////// #region EVENTS /////////////////////////////////////////////////////////////////////////////// // Eventhandler for Custom Defined Events // /////////////////////////////////////////////////////////////////////////////// #region CUSTOMEVENTHANDLER #endregion //CUSTOMEVENTHANDLER #endregion //EVENTS /////////////////////////////////////////////////////////////////////////////// // Methods for doing main class job // /////////////////////////////////////////////////////////////////////////////// #region METHODS /// <summary> /// Initializes standard values of drawing elements /// </summary> private void InitializeElements() { try { this.penGazeCursor = new Pen(Properties.Settings.Default.GazeCursorColor, Properties.Settings.Default.GazeCursorWidth); this.penGazeCursor.DashStyle = Properties.Settings.Default.GazeCursorStyle; this.penMouseCursor = new Pen(Properties.Settings.Default.MouseCursorColor, Properties.Settings.Default.MouseCursorWidth); this.penMouseCursor.DashStyle = Properties.Settings.Default.MouseCursorStyle; float gazeCursorSize = (float)Properties.Settings.Default.GazeCursorSize; VGCursor.DrawingCursors gazeCursorType = (VGCursor.DrawingCursors)Enum.Parse( typeof(VGCursor.DrawingCursors), Properties.Settings.Default.GazeCursorType); this.gazeCursor = new VGCursor(this.penGazeCursor, gazeCursorType, gazeCursorSize, VGStyleGroup.RPL_PEN_GAZE_CURSOR); float mouseCursorSize = (float)Properties.Settings.Default.MouseCursorSize; VGCursor.DrawingCursors mouseCursorType = (VGCursor.DrawingCursors)Enum.Parse( typeof(VGCursor.DrawingCursors), Properties.Settings.Default.MouseCursorType); this.mouseCursor = new VGCursor(this.penMouseCursor, mouseCursorType, mouseCursorSize, VGStyleGroup.RPL_PEN_MOUSE_CURSOR); } catch (Exception ex) { ExceptionMethods.HandleException(ex); } }
/// <summary> /// The <see cref="ComboBox.SelectionChangeCommitted"/> event handler for /// the <see cref="ComboBox"/> <see cref="cbbCursorType"/>. /// Updates <see cref="_cursor"/> properties and raises <see cref="CursorStyleChanged"/> event. /// </summary> /// <param name="sender">Source of the event</param> /// <param name="e">An empty <see cref="EventArgs"/></param> private void cbbCursorType_SelectionChangeCommitted(object sender, EventArgs e) { VGCursor.DrawingCursors cursorType=(VGCursor.DrawingCursors)Enum.Parse( typeof(VGCursor.DrawingCursors),cbbCursorType.SelectedItem.ToString()); _cursor = new VGCursor(_cursor.Pen, cursorType, _cursor.Width,_cursor.StyleGroup); CheckForCorrectSize(); _cursor.Center = new PointF(pnlPreview.Width / 2, pnlPreview.Height / 2); pnlPreview.Invalidate(); OnCursorStyleChanged(new ShapeEventArgs((VGElement)_cursor.Clone())); }
/// <summary> /// The controls <see cref="UserControl.Load"/> event handler. /// Creates a predefined cursor. /// </summary> /// <param name="sender">Source of the event</param> /// <param name="e">An empty <see cref="EventArgs"/></param> private void CursorSelectControl_Load(object sender, EventArgs e) { if (_cursor == null) { _cursor = new VGCursor(DEFAULT_CURSOR_PEN, DEFAULT_CURSOR_STYLE, DEFAULT_CURSOR_SIZE,VGStyleGroup.None); _cursor.Center = new PointF(pnlPreview.Width / 2, pnlPreview.Height / 2); } this.cbbCursorType.Items.AddRange(Enum.GetNames(typeof(VGCursor.DrawingCursors))); this.cbbCursorType.SelectedItem = _cursor.CursorType; }