Exemple #1
0
        protected override void OnMouseUp(DrawingArea canvas, ButtonReleaseEventArgs args, Cairo.PointD point)
        {
            // If the user didn't move the mouse, they want to deselect
            int tolerance = 0;

            if (Math.Abs(reset_origin.X - args.Event.X) <= tolerance && Math.Abs(reset_origin.Y - args.Event.Y) <= tolerance)
            {
                PintaCore.Actions.Edit.Deselect.Activate();
                hist.Dispose();
                hist           = null;
                handler_active = false;
                Document doc = PintaCore.Workspace.ActiveDocument;
                doc.ToolLayer.Clear();
            }
            else
            {
                if (hist != null)
                {
                    PintaCore.Workspace.ActiveDocument.History.PushNewItem(hist);
                }

                handler_active = true;
                hist           = null;
            }

            is_drawing = false;
        }
Exemple #2
0
        protected override void OnMouseUp(DrawingArea canvas, ButtonReleaseEventArgs args, Cairo.PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            // If the user didn't move the mouse, they want to deselect
            int tolerance = 0;

            if (Math.Abs(reset_origin.X - args.Event.X) <= tolerance && Math.Abs(reset_origin.Y - args.Event.Y) <= tolerance)
            {
                PintaCore.Actions.Edit.Deselect.Activate();
                hist.Dispose();
                hist           = null;
                handler_active = false;

                doc.ToolLayer.Clear();
            }
            else
            {
                ReDraw(args.Event.State);

                if (doc.Selection != null)
                {
                    doc.selHandler.PerformSelectionMode(DocumentSelection.ConvertToPolygonSet(doc.Selection.SelectionPolygons));
                    PintaCore.Workspace.Invalidate();
                }

                if (hist != null)
                {
                    doc.History.PushNewItem(hist);
                }

                handler_active = true;
                hist.Dispose();
                hist = null;
            }

            is_drawing = false;
            isResizing = false;
        }
Exemple #3
0
        protected override void OnMouseUp(DrawingArea canvas, ButtonReleaseEventArgs args, Cairo.PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            // If the user didn't move the mouse, they want to deselect
            int tolerance = 0;

            if (Math.Abs(reset_origin.X - args.Event.X) <= tolerance && Math.Abs(reset_origin.Y - args.Event.Y) <= tolerance)
            {
                // Mark as being done interactive drawing before invoking the deselect action.
                // This will allow AfterSelectionChanged() to clear the selection.
                is_drawing = false;

                if (hist != null)
                {
                    // Roll back any changes made to the selection, e.g. in OnMouseDown().
                    hist.Undo();

                    hist.Dispose();
                    hist = null;
                }

                PintaCore.Actions.Edit.Deselect.Activate();
            }
            else
            {
                ClearHandles(doc.ToolLayer);
                ReDraw(args.Event.State);
                if (doc.Selection != null)
                {
                    SelectionModeHandler.PerformSelectionMode(combine_mode, doc.Selection.SelectionPolygons);

                    doc.Selection.Origin = shape_origin;
                    doc.Selection.End    = shape_end;
                    PintaCore.Workspace.Invalidate();
                }
                if (hist != null)
                {
                    doc.History.PushNewItem(hist);
                    hist = null;
                }
            }

            is_drawing     = false;
            active_control = null;

            // Update the mouse cursor.
            UpdateCursor(point);
        }
Exemple #4
0
        protected override void OnMouseUp(DrawingArea canvas, ButtonReleaseEventArgs args, Cairo.PointD point)
        {
            Document doc = PintaCore.Workspace.ActiveDocument;

            // If the user didn't move the mouse, they want to deselect
            int tolerance = 0;

            if (Math.Abs(reset_origin.X - args.Event.X) <= tolerance && Math.Abs(reset_origin.Y - args.Event.Y) <= tolerance)
            {
                PintaCore.Actions.Edit.Deselect.Activate();
                if (hist != null)
                {
                    hist.Dispose();
                    hist = null;
                }
                doc.ToolLayer.Clear();
            }
            else
            {
                ClearHandles(doc.ToolLayer);
                ReDraw(args.Event.State);
                if (doc.Selection != null)
                {
                    SelectionModeHandler.PerformSelectionMode(combine_mode, doc.Selection.SelectionPolygons);

                    doc.Selection.Origin = shape_origin;
                    doc.Selection.End    = shape_end;
                    PintaCore.Workspace.Invalidate();
                }
                if (hist != null)
                {
                    doc.History.PushNewItem(hist);
                    hist = null;
                }
            }

            is_drawing     = false;
            active_control = null;

            // Update the mouse cursor.
            UpdateCursor(point);
        }