public override void MouseDown(MouseEvent ev) { base.MouseDown(ev); IDrawingView view = ev.View; if (IsRightButtonPressed(ev)) { DelegateTool = new PanTool(Editor, CursorFactory.GetCursorFromType(Gdk.CursorType.Arrow)); } else { IHandle handle = view.FindHandle(ev.X, ev.Y); if (handle != null) { DelegateTool = new HandleTracker(Editor, new UndoableHandle(handle)); } else { IFigure figure = view.Drawing.FindFigure(ev.X, ev.Y); if (figure != null) { DelegateTool = figure.CreateFigureTool(Editor, new DragTool(Editor, figure)); } else { DelegateTool = new SelectAreaTool(Editor); } } } if (DelegateTool != null) { DelegateTool.MouseDown(ev); } }
public ResizeHandleUndoActivity(IDrawingView view, IFigure owner): base (view) { Undoable = true; Redoable = true; Owner = owner; OldDisplayBox = Owner.DisplayBox; NewDisplayBox = Owner.DisplayBox; }
public DrawInRegionVisitor(Gdk.Region region, Cairo.Context context, IDrawingView view) { this.context = context; this.region = region; this.view = view; this.figures = new List<Figure> (); }
public override void InvokeStep(double x, double y, IDrawingView view) { if (m_handle != null) { m_handle.InvokeStep(x, y, view); } }
public override void MouseDown(MouseEvent ev) { base.MouseDown(ev); IDrawingView view = ev.View; _anchorHandle.InvokeStart(ev.X, ev.Y, view); }
public override void MouseDown(MouseEvent ev) { IDrawingView view = ev.View; SetAnchorCoords(ev.X, ev.Y); View = view; Gdk.EventType type = ev.GdkEvent.Type; if (type == EventType.TwoButtonPress) { CreateUndoActivity(); _showingWidget = true; _textview.Buffer.Text = ((MultiLineTextFigure)Figure).Text; View.AddWidget(_textview, 0, 0); CalculateTextViewSize(); _textview.Show(); _textview.GrabFocus(); //selects all _textview.Buffer.SelectRange(_textview.Buffer.StartIter, _textview.Buffer.EndIter); return; } DefaultTool.MouseDown(ev); }
public override void InvokeEnd(double x, double y, IDrawingView view) { _newTarget = _newTarget ?? _oldTarget; UpdateUndoActivity(); Connect(_newTarget); Connection.UpdateConnection(); }
public override void MouseMove(MouseEvent ev) { IDrawingView view = ev.View; Widget widget = (Widget)view; IHandle handle = view.FindHandle(ev.X, ev.Y); if (handle != null) { widget.GdkWindow.Cursor = handle.CreateCursor(); } else { IFigure figure = view.Drawing.FindFigure(ev.X, ev.Y); if (figure != null) { widget.GdkWindow.Cursor = CursorFactory.GetCursorFromType(Gdk.CursorType.Fleur); } else { widget.GdkWindow.Cursor = null; } } if (DelegateTool != null) { DelegateTool.MouseMove(ev); } }
public ResizeHandleUndoActivity(IDrawingView view, IFigure owner) : base(view) { Undoable = true; Redoable = true; Owner = owner; OldDisplayBox = Owner.DisplayBox; NewDisplayBox = Owner.DisplayBox; }
public ChangeAttributeUndoActivity (IDrawingView drawingView, FigureAttribute attribute, object value) : base (drawingView) { _originalValues = new Dictionary<IFigure, object> (); Undoable = true; Redoable = true; Attribute = attribute; Value = value; }
public override void InvokeStep(double x, double y, IDrawingView view) { TargetFigure = FindConnectableFigure(x, y, view.Drawing); _newTarget = FindConnectionTarget(x, y, view.Drawing); Point = _newTarget != null?FindPoint(_newTarget) : new PointD(x, y); Connection.UpdateConnection(); }
public override void InvokeStep (double x, double y, IDrawingView view) { RectangleD r = Owner.DisplayBox; PointD new_location = new PointD (r.X, Math.Min (r.Y + r.Height, y)); PointD new_corner = new PointD (Math.Max (r.X, x), r.Y + r.Height); Owner.DisplayBox = new RectangleD (new_location, new_corner); }
protected override void CreateUndoActivity(IDrawingView view) { ChangeConnectionHandleUndoActivity activity = new ChangeConnectionHandleUndoActivity(view); activity.Owner = this; activity.OldConnector = _oldTarget; UndoActivity = activity; }
public ChangeAttributeUndoActivity(IDrawingView drawingView, FigureAttribute attribute, object value) : base(drawingView) { _originalValues = new Dictionary <IFigure, object> (); Undoable = true; Redoable = true; Attribute = attribute; Value = value; }
public override void InvokeStep(double x, double y, IDrawingView view) { RectangleD r = Owner.DisplayBox; PointD new_location = new PointD(r.X, r.Y); PointD new_corner = new PointD(r.X + r.Width, Math.Max(r.Y, y)); Owner.DisplayBox = new RectangleD(new_location, new_corner); }
protected override void CreateUndoActivity(IDrawingView view) { PolyLineHandleUndoActivity activity = new PolyLineHandleUndoActivity(view); activity.Owner = Owner as PolyLineFigure; activity.Index = Index; activity.OldPoint = activity.Owner.PointAt(Index); UndoActivity = activity; }
public override void InvokeStep(double x, double y, IDrawingView view) { RectangleD r = Owner.DisplayBox; var new_location = new PointD (Math.Min (r.X + r.Width, x), r.Y); var new_corner = new PointD (r.X + r.Width, Math.Max (r.Y, y)); Owner.DisplayBox = new RectangleD (new_location, new_corner); }
protected void CreateUndoActivity() { IDrawingView view = Editor.View; DragToolUndoActivity activity = new DragToolUndoActivity(view); activity.AffectedFigures = view.SelectionEnumerator.ToFigures(); activity.StartPoint = new PointD(AnchorX, AnchorY); UndoActivity = activity; }
public DrawingPresenter(IDrawingView drawingView, IMessageService messageService, ILoggingService loggingService) { _messageService = messageService; _loggingService = loggingService; _drawingView = drawingView; _drawingView.ClassifyDrawing += OnClassifyDrawing; _drawingView.ClearDrawing += OnClearDrawing; }
public override void InvokeStep(double x, double y, IDrawingView view) { LabelFigure label = (LabelFigure) Owner; PointD delta = label.HandleDeltaPosition(); Owner.MoveTo(x - delta.X, y - delta.Y); double offsetX = Owner.DisplayBox.Width/2 - delta.X; double offsetY = Owner.DisplayBox.Height/2 - delta.Y; label.SetPosition(new PointD(x + offsetX, y + offsetY)); }
public override void MouseUp(MouseEvent ev) { IDrawingView view = ev.View; Gdk.EventButton gdk_event = ev.GdkEvent as EventButton; DrawSelectionRect((Gtk.Widget)view, gdk_event.Window); bool shift_pressed = (gdk_event.State & ModifierType.ShiftMask) != 0; SelectFiguresOnRect(view, shift_pressed); }
public void InvokeEnd (double x, double y, IDrawingView view) { WrappedHandle.InvokeEnd(x, y, view); IUndoActivity activity = WrappedHandle.UndoActivity; if (activity != null && activity.Undoable && view.Editor.UndoManager != null) { view.Editor.UndoManager.PushUndo(activity); view.Editor.UndoManager.ClearRedos(); } }
public virtual void Draw (Context context, IDrawingView view) { RectangleD rect = ViewDisplayBox(view); context.Save(); context.LineWidth = LineWidth; context.Rectangle (GdkCairoHelper.CairoRectangle (rect)); context.Color = FillColor; context.FillPreserve (); context.Color = LineColor; context.Stroke (); context.Restore(); }
/// <inheritdoc/> void IDrawingModel.Detach([NotNull] IDrawingView view) { if (view == null) throw new ArgumentNullException(nameof(view)); if (!ReferenceEquals(canvasView, view)) { // TODO: do something. E.g. exception? return; } canvasView = null; }
public override void MouseDown(MouseEvent ev) { IDrawingView view = ev.View; base.MouseDown(ev); view.Drawing.Add(Prototype); Prototype.MoveTo(ev.X, ev.Y); view.ClearSelection(); view.AddToSelection(Prototype); CreateUndoActivity(); }
public override void InvokeEnd(double x, double y, IDrawingView view) { base.InvokeEnd(x, y, view); if (clicked) { Active = !Active; } clicked = false; }
public override void InvokeStart(double x, double y, IDrawingView view) { m_connection = CreateConnection(); m_connection.EndPoint = new PointD (x, y); m_connection.StartPoint = new PointD (x, y); m_connection.ConnectStart (Owner.ConnectorAt(x, y)); m_connection.UpdateConnection(); view.Drawing.Add(m_connection); view.ClearSelection(); view.AddToSelection(m_connection); m_handle = view.FindHandle(x, y); }
public override void InvokeStart(double x, double y, IDrawingView view) { m_connection = CreateConnection(); m_connection.EndPoint = new PointD(x, y); m_connection.StartPoint = new PointD(x, y); m_connection.ConnectStart(Owner.ConnectorAt(x, y)); m_connection.UpdateConnection(); view.Drawing.Add(m_connection); view.ClearSelection(); view.AddToSelection(m_connection); m_handle = view.FindHandle(x, y); }
public override void InvokeEnd(double x, double y, IDrawingView view) { base.InvokeEnd(x, y, view); if (clicked) { Experiment ownerExperiment = m_ownerConnection.Owner; ownerExperiment.RemoveConnection(m_ownerConnection.ExperimentNodeConnection); } clicked = false; }
public void InvokeEnd(double x, double y, IDrawingView view) { WrappedHandle.InvokeEnd(x, y, view); IUndoActivity activity = WrappedHandle.UndoActivity; if (activity != null && activity.Undoable && view.Editor.UndoManager != null) { view.Editor.UndoManager.PushUndo(activity); view.Editor.UndoManager.ClearRedos(); } }
public override void InvokeEnd (double x, double y, IDrawingView view) { PolyLineFigure figure = ((PolyLineFigure) Owner); // eliminates handles in the middle of a straight line if (figure.PointCount > 2 && Index != 0 && Index != (figure.PointCount - 1)) { PointD p1 = figure.PointAt (Index - 1); PointD p2 = figure.PointAt (Index + 1); if (Geometry.LineContainsPoint (p1.X, p1.Y, p2.X, p2.Y, x, y)) { figure.RemovePointAt (Index); } } base.InvokeEnd(x, y, view); }
protected virtual void DrawOn(Cairo.Context context, IDrawingView view) { FillColor = new Color(0.5, 0.5, 0.5, 0.3); RectangleD rect = ViewDisplayBox(view); PointD center = rect.Center; double margin = Width * 0.2; context.MoveTo(rect.Left + margin, Dot5(center.Y)); context.LineTo(rect.Right - margin, Dot5(center.Y)); context.Stroke(); }
public override void InvokeEnd (double x, double y, IDrawingView view) { base.InvokeEnd (x, y, view); if (clicked) { Experiment ownerExperiment = m_ownerConnection.Owner; ownerExperiment.RemoveConnection(m_ownerConnection.ExperimentNodeConnection); } clicked = false; }
public virtual void Draw(Context context, IDrawingView view) { RectangleD rect = ViewDisplayBox(view); context.Save(); context.LineWidth = LineWidth; context.Rectangle(GdkCairoHelper.CairoRectangle(rect)); context.Color = FillColor; context.FillPreserve(); context.Color = LineColor; context.Stroke(); context.Restore(); }
public override void InvokeEnd(double x, double y, IDrawingView view) { if (m_handle != null) { m_handle.InvokeEnd(x, y, view); } if (m_connection.EndConnector == null) { m_connection.DisconnectStart (); m_connection.DisconnectEnd (); view.Drawing.Remove(m_connection); view.ClearSelection(); } }
public void SelectFiguresOnRect (IDrawingView view, bool shift_pressed) { foreach (IFigure figure in view.Drawing.FiguresEnumeratorReverse) { RectangleD rect = figure.DisplayBox; if (_selectionRect.Contains (rect.X, rect.Y) && _selectionRect.Contains (rect.X2, rect.Y2)) { if (shift_pressed) { view.ToggleSelection (figure); } else { view.AddToSelection (figure); } } } }
public override void InvokeEnd(double x, double y, IDrawingView view) { if (m_handle != null) { m_handle.InvokeEnd(x, y, view); } if (m_connection.EndConnector == null) { m_connection.DisconnectStart(); m_connection.DisconnectEnd(); view.Drawing.Remove(m_connection); view.ClearSelection(); } }
public override void InvokeEnd (double x, double y, IDrawingView view) { base.InvokeEnd (x, y, view); if (clicked) { IEditableExperiment experiment = m_ownerComponent.ExperimentNode.Owner as IEditableExperiment; if(experiment != null) { experiment.RemoveVertex(m_ownerComponent.ExperimentNode); } } clicked = false; }
public override void Draw(Cairo.Context context, IDrawingView view) { context.Save(); if (Active) { DrawOn(context, view); } else { DrawOff(context, view); } context.Restore(); }
public override void Draw (Context context, IDrawingView view) { RectangleD rect = ViewDisplayBox(view); double middle = rect.Width / 2.0; context.LineWidth = LineWidth; context.Save (); context.Translate (rect.X + middle, rect.Y + middle); context.Arc (0.0, 0.0, middle, 0.0, 2.0 * Math.PI); context.Restore (); context.Color = new Cairo.Color (0.2, 0.2, 1.0, 0.5); context.FillPreserve (); context.Color = new Cairo.Color (0.0, 0.0, 0.0, 1.0); context.Stroke (); }
public override void Draw (Cairo.Context context, IDrawingView view) { context.Save(); base.Draw(context, view); context.LineWidth = 1.0; if (Active) { DrawOn(context, view); } else { DrawOff(context, view); } context.Restore(); }
public override void InvokeEnd(double x, double y, IDrawingView view) { base.InvokeEnd(x, y, view); if (clicked) { IEditableExperiment experiment = m_ownerComponent.ExperimentNode.Owner as IEditableExperiment; if (experiment != null) { experiment.RemoveVertex(m_ownerComponent.ExperimentNode); } } clicked = false; }
public override void InvokeEnd(double x, double y, IDrawingView view) { PolyLineFigure figure = ((PolyLineFigure)Owner); // eliminates handles in the middle of a straight line if (figure.PointCount > 2 && Index != 0 && Index != (figure.PointCount - 1)) { PointD p1 = figure.PointAt(Index - 1); PointD p2 = figure.PointAt(Index + 1); if (Geometry.LineContainsPoint(p1.X, p1.Y, p2.X, p2.Y, x, y)) { figure.RemovePointAt(Index); } } base.InvokeEnd(x, y, view); }
public override void Draw(Context context, IDrawingView view) { RectangleD rect = ViewDisplayBox(view); double middle = rect.Width / 2.0; context.LineWidth = LineWidth; context.Save(); context.Translate(rect.X + middle, rect.Y + middle); context.Arc(0.0, 0.0, middle, 0.0, 2.0 * Math.PI); context.Restore(); context.Color = new Cairo.Color(0.2, 0.2, 1.0, 0.5); context.FillPreserve(); context.Color = new Cairo.Color(0.0, 0.0, 0.0, 1.0); context.Stroke(); }
private void DeleteFigures(IDrawingView view) { List <IFigure> figures = new List <IFigure> (); foreach (IFigure fig in view.SelectionEnumerator) { figures.Add(fig); } view.ClearSelection(); foreach (IFigure fig in figures) { view.Drawing.Remove(fig); } }
public override void Draw (Context context, IDrawingView view) { RectangleD rect = ViewDisplayBox(view); context.LineWidth = LineWidth; context.MoveTo (rect.Center.X, rect.Top); context.LineTo (rect.Right, rect.Center.Y); context.LineTo (rect.Center.X, rect.Bottom); context.LineTo (rect.Left, rect.Center.Y); context.LineTo (rect.Center.X, rect.Top); context.Color = new Cairo.Color (1.0, 0.0, 0.0, 0.8); context.FillPreserve (); context.Color = new Cairo.Color (0.0, 0.0, 0.0, 1.0); context.Stroke (); }
public override void Draw(Context context, IDrawingView view) { RectangleD rect = ViewDisplayBox(view); context.LineWidth = LineWidth; context.MoveTo(rect.Center.X, rect.Top); context.LineTo(rect.Right, rect.Center.Y); context.LineTo(rect.Center.X, rect.Bottom); context.LineTo(rect.Left, rect.Center.Y); context.LineTo(rect.Center.X, rect.Top); context.Color = new Cairo.Color(1.0, 0.0, 0.0, 0.8); context.FillPreserve(); context.Color = new Cairo.Color(0.0, 0.0, 0.0, 1.0); context.Stroke(); }
public NullUndoActivity (IDrawingView view) : base (view) { Undoable = false; Redoable = false; }
public KeyEvent(IDrawingView view, Gdk.Event gdkEvent) : base(view, gdkEvent) { }
private void DeleteFigures (IDrawingView view) { List <IFigure> figures = new List <IFigure> (); foreach (IFigure fig in view.SelectionEnumerator) { figures.Add (fig); } view.ClearSelection (); foreach (IFigure fig in figures) { view.Drawing.Remove (fig); } }
public void Draw (Context context, IDrawingView view) { WrappedHandle.Draw(context, view); }
public override void InvokeStart (double x, double y, IDrawingView view) { base.InvokeStart (x, y, view); clicked = true; }
public MouseEvent(IDrawingView view, Gdk.Event gdkEvent, PointD point) : base(view, gdkEvent) { DrawingPoint = point; }
public TextToolUndoActivity(IDrawingView view): base(view) { Undoable = true; Redoable = true; }
public ChangeConnectionHandleUndoActivity(IDrawingView view): base (view) { Undoable = true; Redoable = true; }
public BringToFrontUndoActivity (IDrawingView drawingView): base (drawingView) { Undoable = true; Redoable = true; }
public PolyLineFigureToolUndoActivity(IDrawingView view) : base(view) { Undoable = true; Redoable = true; }
public void InvokeStep (double x, double y, IDrawingView view) { WrappedHandle.InvokeStep(x, y, view); }
public SelectAllUndoActivity (IDrawingView drawingView) : base (drawingView) { Undoable = true; Redoable = true; }
protected override void CreateUndoActivity (IDrawingView view) { ChangeConnectionHandleUndoActivity activity = new ChangeConnectionHandleUndoActivity(view); activity.Owner = this; activity.OldConnector = _oldTarget; UndoActivity = activity; }