Ejemplo n.º 1
0
        // nothing = replace
        // Ctrl = union
        // RMB = exclude
        // Ctrl+RMB = xor

        protected override void OnActivate()
        {
            DocumentWorkspace.EnableSelectionTinting = true;
            this.cursorMouseUp = new Cursor(PdnResources.GetResourceStream("Cursors.MagicWandToolCursor.cur"));
            this.Cursor        = cursorMouseUp;
            base.OnActivate();
        }
Ejemplo n.º 2
0
 protected override void OnActivate()
 {
     this.roundedRectangleCursor = new Cursor(PdnResources.GetResourceStream("Cursors.RoundedRectangleToolCursor.cur"));
     this.Cursor = this.roundedRectangleCursor;
     this.roundedRectangleToolIcon = this.Image;
     base.OnActivate();
 }
Ejemplo n.º 3
0
        protected override void OnActivate()
        {
            this.toolCursor          = new Cursor(PdnResources.GetResourceStream("Cursors.GenericToolCursor.cur"));
            this.toolMouseDownCursor = new Cursor(PdnResources.GetResourceStream("Cursors.GenericToolCursorMouseDown.cur"));
            this.Cursor   = this.toolCursor;
            this.toolIcon = this.Image;

            this.startNub         = new MoveNubRenderer(RendererList);
            this.startNub.Visible = false;
            this.startNub.Shape   = MoveNubShape.Circle;
            RendererList.Add(this.startNub, false);

            this.endNub         = new MoveNubRenderer(RendererList);
            this.endNub.Visible = false;
            this.endNub.Shape   = MoveNubShape.Circle;
            RendererList.Add(this.endNub, false);

            this.moveNubs =
                new MoveNubRenderer[]
            {
                this.startNub,
                this.endNub
            };

            AppEnvironment.PrimaryColorChanged   += new EventHandler(RenderBecauseOfEvent);
            AppEnvironment.SecondaryColorChanged += new EventHandler(RenderBecauseOfEvent);
            AppEnvironment.GradientInfoChanged   += new EventHandler(RenderBecauseOfEvent);
            AppEnvironment.AlphaBlendingChanged  += new EventHandler(RenderBecauseOfEvent);
            AppWorkspace.UnitsChanged            += new EventHandler(RenderBecauseOfEvent);

            base.OnActivate();
        }
Ejemplo n.º 4
0
 public ShapeTool(DocumentWorkspace documentWorkspace,
                  ImageResource toolBarImage,
                  string name,
                  string helpText,
                  char hotKey,
                  ToolBarConfigItems toolBarConfigItemsInclude,
                  ToolBarConfigItems toolBarConfigItemsExclude)
     : base(documentWorkspace,
            toolBarImage,
            name,
            helpText,
            hotKey,
            false,
            (toolBarConfigItemsInclude |
             (ToolBarConfigItems.Brush |
              ToolBarConfigItems.Pen |
              ToolBarConfigItems.ShapeType |
              ToolBarConfigItems.Antialiasing |
              ToolBarConfigItems.AlphaBlending)) &
            ~(toolBarConfigItemsExclude))
 {
     this.mouseDown       = false;
     this.points          = null;
     this.cursorMouseUp   = new Cursor(PdnResources.GetResourceStream("Cursors.ShapeToolCursor.cur"));
     this.cursorMouseDown = new Cursor(PdnResources.GetResourceStream("Cursors.ShapeToolCursorMouseDown.cur"));
 }
Ejemplo n.º 5
0
        protected override void OnActivate()
        {
            this.lineToolCursor          = new Cursor(PdnResources.GetResourceStream("Cursors.LineToolCursor.cur"));
            this.lineToolMouseDownCursor = new Cursor(PdnResources.GetResourceStream("Cursors.GenericToolCursorMouseDown.cur"));
            this.Cursor       = this.lineToolCursor;
            this.lineToolIcon = this.Image;

            this.moveNubs = new MoveNubRenderer[controlPointCount];
            for (int i = 0; i < this.moveNubs.Length; ++i)
            {
                this.moveNubs[i]         = new MoveNubRenderer(this.RendererList);
                this.moveNubs[i].Visible = false;
                this.RendererList.Add(this.moveNubs[i], false);
            }

            AppEnvironment.PrimaryColorChanged   += new EventHandler(RenderShapeBecauseOfEvent);
            AppEnvironment.SecondaryColorChanged += new EventHandler(RenderShapeBecauseOfEvent);
            AppEnvironment.AntiAliasingChanged   += new EventHandler(RenderShapeBecauseOfEvent);
            AppEnvironment.AlphaBlendingChanged  += new EventHandler(RenderShapeBecauseOfEvent);
            AppEnvironment.BrushInfoChanged      += new EventHandler(RenderShapeBecauseOfEvent);
            AppEnvironment.PenInfoChanged        += new EventHandler(RenderShapeBecauseOfEvent);
            AppWorkspace.UnitsChanged            += new EventHandler(RenderShapeBecauseOfEvent);

            base.OnActivate();
        }
Ejemplo n.º 6
0
        protected override void OnActivate()
        {
            base.OnActivate();

            cursorMouseDown          = new Cursor(PdnResources.GetResourceStream("Cursors.GenericToolCursorMouseDown.cur"));
            cursorMouseDownSetSource = new Cursor(PdnResources.GetResourceStream("Cursors.CloneStampToolCursorSetSource.cur"));
            cursorMouseUp            = new Cursor(PdnResources.GetResourceStream("Cursors.CloneStampToolCursor.cur"));
            this.Cursor = cursorMouseUp;

            this.rendererDst = new BrushPreviewRenderer(this.RendererList);
            this.RendererList.Add(this.rendererDst, false);

            this.rendererSrc = new BrushPreviewRenderer(this.RendererList);
            this.rendererSrc.BrushLocation = GetStaticData().takeFrom;
            this.rendererSrc.BrushSize     = AppEnvironment.PenInfo.Width / 2.0f;
            this.rendererSrc.Visible       = (GetStaticData().takeFrom != Point.Empty);
            this.RendererList.Add(this.rendererSrc, false);

            if (ActiveLayer != null)
            {
                switchedTo   = true;
                historyRects = new Vector <Rectangle>();

                if (GetStaticData().wr != null && GetStaticData().wr.IsAlive)
                {
                    takeFromLayer = (BitmapLayer)GetStaticData().wr.Target;
                }
                else
                {
                    takeFromLayer = null;
                }
            }

            AppEnvironment.PenInfoChanged += new EventHandler(Environment_PenInfoChanged);
        }
Ejemplo n.º 7
0
 protected override void OnActivate()
 {
     this.ellipseToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.EllipseToolCursor.cur"));
     this.ellipseToolIcon   = this.Image;
     this.Cursor            = this.ellipseToolCursor;
     base.OnActivate();
 }
Ejemplo n.º 8
0
        protected override void OnActivate()
        {
            base.OnActivate();

            this.pencilToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.PencilToolCursor.cur"));
            this.Cursor           = this.pencilToolCursor;

            this.savedRects = new List <Rectangle>();

            if (ActiveLayer != null)
            {
                bitmapLayer = (BitmapLayer)ActiveLayer;
                renderArgs  = new RenderArgs(bitmapLayer.Surface);
                tracePoints = new List <Point>();
            }
            else
            {
                bitmapLayer = null;

                if (renderArgs != null)
                {
                    renderArgs.Dispose();
                    renderArgs = null;
                }
            }
        }
Ejemplo n.º 9
0
        private void Activate()
        {
            this._active = true;

            this.HandCursor          = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursor.cur"));
            this.HandCursorMouseDown = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursorMouseDown.cur"));
            this.HandCursorInvalid   = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursorInvalid.cur"));
            this.HandCursor          = Cursors.Hand;
            this.HandCursorMouseDown = Cursors.Arrow;
            this.HandCursorInvalid   = Cursors.Arrow;

            this._mouseDownCount = 0;
            this._savedTiles     = null;
            this._saveRegion     = null;

            this._scratchSurface = DocumentWorkspace.BorrowScratchSurface();
            //
            //                        Selection.Changing += new EventHandler(SelectionChangingHandler);
            //                        Selection.Changed += new EventHandler(SelectionChangedHandler);
            //                        HistoryStack.ExecutingHistoryMemento += new ExecutingHistoryMementoEventHandler(ExecutingHistoryMemento);
            //                        HistoryStack.ExecutedHistoryMemento += new ExecutedHistoryMementoEventHandler(ExecutedHistoryMemento);
            //                        HistoryStack.FinishedStepGroup += new EventHandler(FinishedHistoryStepGroup);

            this._trackingNub         = new MoveNubRenderer(this.RendererList);
            this._trackingNub.Visible = false;
            this._trackingNub.Size    = new SizeF(10, 10);
            this._trackingNub.Shape   = MoveNubShape.Compass;
            this.RendererList.Add(this._trackingNub, false);

            OnActivate();
        }
Ejemplo n.º 10
0
 protected override void OnActivate()
 {
     this.cursorMouseUp   = new Cursor(PdnResources.GetResourceStream("Cursors.EllipseSelectToolCursor.cur"));
     this.cursorMouseDown = new Cursor(PdnResources.GetResourceStream("Cursors.EllipseSelectToolCursorMouseDown.cur"));
     this.Cursor          = cursorMouseUp;
     base.OnActivate();
 }
Ejemplo n.º 11
0
        protected override void OnActivate()
        {
            base.OnActivate();

            // cursor-transitions
            this.cursorMouseUp   = new Cursor(PdnResources.GetResourceStream("Cursors.EraserToolCursor.cur"));
            this.cursorMouseDown = new Cursor(PdnResources.GetResourceStream("Cursors.EraserToolCursorMouseDown.cur"));
            this.Cursor          = cursorMouseUp;

            this.savedRects = new List <Rectangle>();

            if (ActiveLayer != null)
            {
                bitmapLayer = (BitmapLayer)ActiveLayer;
                renderArgs  = new RenderArgs(bitmapLayer.Surface);
            }
            else
            {
                bitmapLayer = null;
                renderArgs  = null;
            }

            this.previewRenderer = new BrushPreviewRenderer(this.RendererList);
            this.RendererList.Add(this.previewRenderer, false);
        }
Ejemplo n.º 12
0
        protected override void OnActivate()
        {
            // cursor-transitions
            cursorMouseUp = new Cursor(PdnResources.GetResourceStream("Cursors.PaintBucketToolCursor.cur"));
            Cursor        = cursorMouseUp;

            base.OnActivate();
        }
Ejemplo n.º 13
0
 protected override void OnActivate()
 {
     // cursor-action assignments
     this.cursorMouseDown    = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursorMouseDown.cur"));
     this.cursorMouseUp      = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursor.cur"));
     this.cursorMouseInvalid = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursorInvalid.cur"));
     this.Cursor             = cursorMouseUp;
     base.OnActivate();
 }
Ejemplo n.º 14
0
        public PanControl()
        {
            if (!this.DesignMode)
            {
                handCursor          = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursor.cur"));
                handMouseDownCursor = new Cursor(PdnResources.GetResourceStream("Cursors.PanToolCursorMouseDown.cur"));
                this.Cursor         = handCursor;
            }

            InitializeComponent();
        }
Ejemplo n.º 15
0
        protected void SetCursors(
            string cursorMouseUpResName,
            string cursorMouseUpMinusResName,
            string cursorMouseUpPlusResName,
            string cursorMouseDownResName)
        {
            if (this.cursorMouseUp != null)
            {
                this.cursorMouseUp.Dispose();
                this.cursorMouseUp = null;
            }

            if (cursorMouseUpResName != null)
            {
                this.cursorMouseUp = new Cursor(PdnResources.GetResourceStream(cursorMouseUpResName));
            }

            if (this.cursorMouseUpMinus != null)
            {
                this.cursorMouseUpMinus.Dispose();
                this.cursorMouseUpMinus = null;
            }

            if (cursorMouseUpMinusResName != null)
            {
                this.cursorMouseUpMinus = new Cursor(PdnResources.GetResourceStream(cursorMouseUpMinusResName));
            }

            if (this.cursorMouseUpPlus != null)
            {
                this.cursorMouseUpPlus.Dispose();
                this.cursorMouseUpPlus = null;
            }

            if (cursorMouseUpPlusResName != null)
            {
                this.cursorMouseUpPlus = new Cursor(PdnResources.GetResourceStream(cursorMouseUpPlusResName));
            }

            if (this.cursorMouseDown != null)
            {
                this.cursorMouseDown.Dispose();
                this.cursorMouseDown = null;
            }

            if (cursorMouseDownResName != null)
            {
                this.cursorMouseDown = new Cursor(PdnResources.GetResourceStream(cursorMouseDownResName));
            }
        }
Ejemplo n.º 16
0
        protected override void OnActivate()
        {
            DocumentWorkspace.EnableSelectionTinting = true;

            this.moveToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.MoveSelectionToolCursor.cur"));
            this.Cursor         = this.moveToolCursor;

            this.context.offset       = new Point(0, 0);
            this.context.liftedBounds = Selection.GetBoundsF();

            this.tracking = false;
            PositionNubs(this.context.currentMode);

            base.OnActivate();
        }
Ejemplo n.º 17
0
        private static PropertyItem GetPropertyItem()
        {
            if (propertyItemImage == null)
            {
                Stream stream = PdnResources.GetResourceStream("Images.PropertyItem.png");
                propertyItemImage = Image.FromStream(stream);
            }

            PropertyItem pi = propertyItemImage.PropertyItems[0];

            pi.Id    = 0;
            pi.Len   = 0;
            pi.Type  = 0;
            pi.Value = new byte[0];

            return(pi);
        }
Ejemplo n.º 18
0
        protected override void OnActivate()
        {
            this.cursorZoom    = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomToolCursor.cur"));
            this.cursorZoomIn  = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomInToolCursor.cur"));
            this.cursorZoomOut = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomOutToolCursor.cur"));
            this.cursorZoomPan = new Cursor(PdnResources.GetResourceStream("Cursors.ZoomOutToolCursor.cur"));
            this.Cursor        = this.cursorZoom;

            base.OnActivate();

            this.outline         = new Selection();
            this.outlineRenderer = new SelectionRenderer(this.RendererList, this.outline, this.DocumentWorkspace);
            this.outlineRenderer.InvertedTinting = true;
            this.outlineRenderer.TintColor       = Color.FromArgb(128, 255, 255, 255);
            this.outlineRenderer.ResetOutlineWhiteOpacity();
            this.RendererList.Add(this.outlineRenderer, true);
        }
Ejemplo n.º 19
0
        protected override void OnActivate()
        {
            base.OnActivate();

            // initialize any state information you need
            cursorMouseUp              = new Cursor(PdnResources.GetResourceStream("Cursors.RecoloringToolCursor.cur"));
            cursorMouseDown            = new Cursor(PdnResources.GetResourceStream("Cursors.GenericToolCursorMouseDown.cur"));
            cursorMouseDownPickColor   = new Cursor(PdnResources.GetResourceStream("Cursors.RecoloringToolCursorPickColor.cur"));
            cursorMouseDownAdjustColor = new Cursor(PdnResources.GetResourceStream("Cursors.RecoloringToolCursorAdjustColor.cur"));

            this.previewRenderer = new BrushPreviewRenderer(this.RendererList);
            this.RendererList.Add(this.previewRenderer, false);

            Cursor    = cursorMouseUp;
            mouseDown = false;

            // fetch colors from workspace palette
            this.colorToReplace = this.AppEnvironment.PrimaryColor;
            this.colorReplacing = this.AppEnvironment.SecondaryColor;

            this.aaPoints         = this.ScratchSurface;
            this.isPointAlreadyAA = new BitVector2D(aaPoints.Width, aaPoints.Height);

            if (savedSurfaces != null)
            {
                foreach (PlacedSurface ps in savedSurfaces)
                {
                    ps.Dispose();
                }
            }

            savedSurfaces = new ArrayList();

            if (ActiveLayer != null)
            {
                bitmapLayer = (BitmapLayer)ActiveLayer;
                renderArgs  = new RenderArgs(bitmapLayer.Surface);
            }
            else
            {
                bitmapLayer = null;
                renderArgs  = null;
            }
        }
Ejemplo n.º 20
0
        public LicensePage()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            this.introText.Text       = PdnResources.GetString("SetupWizard.LicensePage.IntroText.Text");
            this.agreeButton.Text     = PdnResources.GetString("SetupWizard.LicensePage.AgreeButton.Text");
            this.dontAgreeButton.Text = PdnResources.GetString("SetupWizard.LicensePage.DontAgreeButton.Text");

            Stream       licenseStream = PdnResources.GetResourceStream("Files.License.txt");
            StreamReader reader        = new StreamReader(licenseStream);
            string       licenseText   = reader.ReadToEnd();

            licenseText = licenseText.Replace("\n", "\r\n");
            this.licenseAgreementText.Text = licenseText;

            if (choseButton)
            {
                this.agreeButton.Checked     = choseAgreeButton;
                this.dontAgreeButton.Checked = !choseAgreeButton;
            }
        }
Ejemplo n.º 21
0
        protected void SetCursors(
            string cursorMouseUpResName,
            string cursorMouseUpMinusResName,
            string cursorMouseUpPlusResName,
            string cursorMouseDownResName)
        {
            CursorMouseUp?.Dispose();
            CursorMouseUp = null;

            if (cursorMouseUpResName != null)
            {
                CursorMouseUp = new Cursor(PdnResources.GetResourceStream(cursorMouseUpResName));
            }

            CursorMouseUpMinus?.Dispose();
            CursorMouseUpMinus = null;

            if (cursorMouseUpMinusResName != null)
            {
                CursorMouseUpMinus = new Cursor(PdnResources.GetResourceStream(cursorMouseUpMinusResName));
            }

            CursorMouseUpPlus?.Dispose();
            CursorMouseUpPlus = null;

            if (cursorMouseUpPlusResName != null)
            {
                CursorMouseUpPlus = new Cursor(PdnResources.GetResourceStream(cursorMouseUpPlusResName));
            }

            CursorMouseDown?.Dispose();
            CursorMouseDown = null;

            if (cursorMouseDownResName != null)
            {
                CursorMouseDown = new Cursor(PdnResources.GetResourceStream(cursorMouseDownResName));
            }
        }
Ejemplo n.º 22
0
        protected override void OnActivate()
        {
            AppEnvironment.ResamplingAlgorithmChanged += AppEnvironment_ResamplingAlgorithmChanged;

            this.moveToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.MoveToolCursor.cur"));
            this.Cursor         = this.moveToolCursor;

            this.context.lifted          = false;
            this.ourContext.LiftedPixels = null;
            this.context.offset          = new Point(0, 0);
            this.context.liftedBounds    = Selection.GetBoundsF();
            this.activeLayer             = (BitmapLayer)ActiveLayer;

            if (this.renderArgs != null)
            {
                this.renderArgs.Dispose();
                this.renderArgs = null;
            }

            if (this.activeLayer == null)
            {
                this.renderArgs = null;
            }
            else
            {
                this.renderArgs = new RenderArgs(this.activeLayer.Surface);
            }

            this.tracking = false;
            PositionNubs(this.context.currentMode);

#if ALWAYSHIGHQUALITY
            this.fullQuality = true;
#endif

            base.OnActivate();
        }
Ejemplo n.º 23
0
 protected override void OnActivate()
 {
     this.lassoToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.LassoSelectToolCursor.cur"));
     this.Cursor          = this.lassoToolCursor;
     base.OnActivate();
 }
Ejemplo n.º 24
0
 protected override void OnActivate()
 {
     this.colorPickerToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.ColorPickerToolCursor.cur"));
     this.Cursor = this.colorPickerToolCursor;
     base.OnActivate();
 }
Ejemplo n.º 25
0
 protected override void OnActivate()
 {
     this.freeformShapeToolCursor = new Cursor(PdnResources.GetResourceStream("Cursors.FreeformShapeToolCursor.cur"));
     this.Cursor = this.freeformShapeToolCursor;
     base.OnActivate();
 }