Пример #1
0
 public VignetteEffect()
     : base(PdnResources.GetString("VignetteEffect.Name"),
            PdnResources.GetImageResource("Icons.VignetteEffectIcon.png").Reference,
            SubmenuNames.Photo,
            EffectFlags.Configurable)
 {
 }
Пример #2
0
        public override HistoryMemento OnExecute(IHistoryWorkspace historyWorkspace)
        {
            SelectionData state = null;
            SegmentedList <HistoryMemento> actions = new SegmentedList <HistoryMemento>();

            if (!historyWorkspace.Selection.IsEmpty)
            {
                state = historyWorkspace.Selection.Save();
                HistoryMemento memento3 = new DeselectFunction().Execute(historyWorkspace);
                actions.Add(memento3);
            }
            ReplaceDocumentHistoryMemento item = new ReplaceDocumentHistoryMemento(null, null, historyWorkspace);

            actions.Add(item);
            CompoundHistoryMemento memento2 = new CompoundHistoryMemento(StaticName, PdnResources.GetImageResource("Icons.MenuImageFlattenIcon.png"), actions);
            Document document = RetryManager.RunMemorySensitiveOperation <Document>(() => historyWorkspace.Document.Flatten());

            base.EnterCriticalRegion();
            historyWorkspace.Document = document;
            if (state != null)
            {
                SelectionHistoryMemento newHA = new SelectionHistoryMemento(null, null, historyWorkspace);
                historyWorkspace.Selection.Restore(state);
                memento2.AddMemento(newHA);
            }
            return(memento2);
        }
Пример #3
0
 public FreeformShapeTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            PdnResources.GetImageResource("Icons.FreeformShapeToolIcon.png"),
            PdnResources.GetString("FreeformShapeTool.Name"),
            PdnResources.GetString("FreeformShapeTool.HelpText"))
 {
 }
Пример #4
0
 public AutoLevelEffect()
     : base(PdnResources.GetString("AutoLevel.Name"),
            PdnResources.GetImageResource("Icons.AutoLevel.png").Reference,
            null,
            EffectFlags.None)
 {
 }
Пример #5
0
 public RedEyeRemoveEffect()
     : base(PdnResources.GetString("RedEyeRemoveEffect.Name"),
            PdnResources.GetImageResource("Icons.RedEyeRemoveEffect.png").Reference,
            SubmenuNames.Photo,
            EffectFlags.Configurable)
 {
 }
Пример #6
0
 public FragmentEffect()
     : base(PdnResources.GetString("FragmentEffect.Name"),
            PdnResources.GetImageResource("Icons.FragmentEffectIcon.png").Reference,
            SubmenuNames.Blurs,
            EffectFlags.Configurable)
 {
 }
Пример #7
0
        public static ImageResource GetCloseButtonImageResource(PushButtonState closeButtonState)
        {
            string str;

            if (OS.IsWin8OrLater)
            {
                str = "Metro";
            }
            else
            {
                PdnTheme effectiveTheme = ThemeConfig.EffectiveTheme;
                if (effectiveTheme != PdnTheme.Classic)
                {
                    if (effectiveTheme != PdnTheme.Aero)
                    {
                        throw ExceptionUtil.InvalidEnumArgumentException <PdnTheme>(ThemeConfig.EffectiveTheme, "ThemeConfig.EffectiveTheme");
                    }
                    str = "Aero";
                }
                else
                {
                    str = "Classic";
                }
            }
            string str2 = "." + str + ".png";
            string str3 = closeButtonState.ToString();

            return(PdnResources.GetImageResource("Images.ImageStrip.CloseButton." + str3 + str2));
        }
Пример #8
0
 public RoundedRectangleTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            PdnResources.GetImageResource("Icons.RoundedRectangleToolIcon.png"),
            PdnResources.GetString("RoundedRectangleTool.Name"),
            PdnResources.GetString("RoundedRectangleTool.HelpText"))
 {
 }
Пример #9
0
 public RadialBlurEffect()
     : base(StaticName,
            PdnResources.GetImageResource("Icons.RadialBlurEffect.png").Reference,
            SubmenuNames.Blurs,
            EffectFlags.Configurable)
 {
 }
Пример #10
0
        private void AddButton(TEnumType enumValue)
        {
            ulong num = Convert.ToUInt64(enumValue);

            if (num != 0)
            {
                Image reference = PdnResources.GetImageResource($"Icons.Enum.{typeof(TEnumType).Name}.{enumValue.ToString()}.png").Reference;
                if (reference != null)
                {
                    ToolStripItemImageScaling sizeToFit = ToolStripItemImageScaling.SizeToFit;
                    if (reference.Width > reference.Height)
                    {
                        if ((UIUtil.GetXScaleFactor() != 1f) || (UIUtil.GetYScaleFactor() != 1f))
                        {
                            reference = new Bitmap(reference, UIUtil.ScaleSize(reference.Size));
                        }
                        sizeToFit = ToolStripItemImageScaling.None;
                    }
                    ToolStripButton item = new ToolStripButton(PdnResources.GetString(typeof(TEnumType).Name + "." + enumValue.ToString(), KeyNotFoundResult.ReturnNull), reference, new EventHandler(this.OnButtonClick))
                    {
                        Tag          = num,
                        ImageScaling = sizeToFit,
                        DisplayStyle = ToolStripItemDisplayStyle.Image,
                        AutoToolTip  = true
                    };
                    this.buttons.Add(item);
                }
            }
        }
Пример #11
0
 public OilPaintingEffect()
     : base(StaticName,
            PdnResources.GetImageResource("Icons.OilPaintingEffect.png").Reference,
            SubmenuNames.Artistic,
            EffectFlags.Configurable)
 {
 }
Пример #12
0
 public EllipseTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            PdnResources.GetImageResource("Icons.EllipseToolIcon.png"),
            PdnResources.GetString("EllipseTool.Name"),
            PdnResources.GetString("EllipseTool.HelpText"))
 {
 }
Пример #13
0
        public AngleChooserPropertyControl(PropertyControlInfo propInfo) : base(propInfo)
        {
            AngleChooserPhase offsetByPi;
            DoubleProperty    property = (DoubleProperty)propInfo.Property;

            if ((property.MaxValue - property.MinValue) > 360.0)
            {
                throw new ArgumentException($"The difference between the property's minimum and maximum values cannot exceed 360.0. (Property.MinValue={property.MinValue}, Property.MaxValue={property.MaxValue}, Delta={property.MaxValue - property.MinValue})");
            }
            double minValue = property.MinValue;
            double maxValue = property.MaxValue;

            if ((property.MinValue >= -180.0) && (property.MaxValue <= 180.0))
            {
                offsetByPi = AngleChooserPhase.OffsetByPi;
            }
            else
            {
                if ((property.MinValue < 0.0) || (property.MaxValue > 360.0))
                {
                    throw new ArgumentException($"The property minimum and maximum values must either fall into the range [-180, +180] or [0, +360]. (Property.MinValue={property.MinValue}, Property.MaxValue={property.MaxValue})");
                }
                offsetByPi = AngleChooserPhase.Regular;
            }
            this.header                     = new HeadingLabel();
            this.header.Name                = "header";
            this.header.RightMargin         = 0;
            this.header.Text                = base.DisplayName;
            this.angleChooser               = new AngleChooser();
            this.angleChooser.Name          = "angleChooser";
            this.angleChooser.Phase         = offsetByPi;
            this.angleChooser.MinValue      = minValue;
            this.angleChooser.MaxValue      = maxValue;
            this.angleChooser.ValueChanged += new EventHandler(this.OnAngleChooserValueChanged);
            this.valueNud                   = new PdnNumericUpDown();
            this.valueNud.Name              = "numericUpDown";
            this.valueNud.Minimum           = (decimal)base.Property.MinValue;
            this.valueNud.Maximum           = (decimal)base.Property.MaxValue;
            this.valueNud.DecimalPlaces     = (int)propInfo.ControlProperties[ControlInfoPropertyNames.DecimalPlaces].Value;
            this.valueNud.ValueChanged     += new EventHandler(this.OnValueNudValueChanged);
            this.valueNud.TextAlign         = HorizontalAlignment.Right;
            if ((maxValue - minValue) == 360.0)
            {
                this.valueNud.RangeWraps = true;
            }
            this.resetButton         = new PdnPushButton();
            this.resetButton.Name    = "resetButton";
            this.resetButton.Click  += new EventHandler(this.OnResetButtonClick);
            this.resetButton.Image   = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
            this.resetButton.Visible = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            base.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));
            this.description          = new PdnLabel();
            this.description.Name     = "descriptionText";
            this.description.AutoSize = false;
            this.description.Text     = base.Description;
            base.SuspendLayout();
            Control[] controls = new Control[] { this.header, this.angleChooser, this.valueNud, this.resetButton, this.description };
            base.Controls.AddRange(controls);
            base.ResumeLayout(false);
        }
Пример #14
0
 public MotionBlurEffect()
     : base(PdnResources.GetString("MotionBlurEffect.Name"),
            PdnResources.GetImageResource("Icons.MotionBlurEffect.png").Reference,
            SubmenuNames.Blurs,
            EffectFlags.Configurable)
 {
 }
Пример #15
0
 public ReliefEffect()
     : base(PdnResources.GetString("ReliefEffect.Name"),
            PdnResources.GetImageResource("Icons.ReliefEffect.png").Reference,
            SubmenuNames.Stylize,
            EffectFlags.Configurable)
 {
 }
Пример #16
0
 public EmbossEffect()
     : base(StaticName,
            PdnResources.GetImageResource("Icons.EmbossEffect.png").Reference,
            SubmenuNames.Stylize,
            EffectFlags.Configurable)
 {
 }
Пример #17
0
 public PixelateEffect()
     : base(StaticName,
            PdnResources.GetImageResource("Icons.PixelateEffect.png").Reference,
            SubmenuNames.Distort,
            EffectFlags.Configurable)
 {
 }
Пример #18
0
 private void CloseWorkspace(AppWorkspace appWorkspace, DocumentWorkspace dw)
 {
     if (dw != null)
     {
         if (dw.Document == null)
         {
             appWorkspace.RemoveDocumentWorkspace(dw);
         }
         else if (!dw.Document.Dirty)
         {
             appWorkspace.RemoveDocumentWorkspace(dw);
         }
         else
         {
             appWorkspace.ActiveDocumentWorkspace = dw;
             TaskButton     button              = new TaskButton(PdnResources.GetImageResource("Icons.MenuFileSaveIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.SaveButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.SaveButton.ExplanationText"));
             TaskButton     button2             = new TaskButton(PdnResources.GetImageResource("Icons.MenuFileCloseIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.DontSaveButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.DontSaveButton.ExplanationText"));
             TaskButton     button3             = new TaskButton(PdnResources.GetImageResource("Icons.CancelIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.CancelButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.CancelButton.ExplanationText"));
             string         str                 = PdnResources.GetString("CloseWorkspaceAction.Title");
             string         str3                = string.Format(PdnResources.GetString("CloseWorkspaceAction.IntroText.Format"), dw.GetFileFriendlyName());
             int            thumbEdgeLength     = UIUtil.ScaleWidth(80);
             SizeInt32      num                 = ThumbnailHelpers.ComputeThumbnailSize(dw.Document.Size(), thumbEdgeLength);
             SizeInt32      fullThumbSize       = new SizeInt32(num.Width + 4, num.Height + 4);
             bool           animating           = true;
             Image          finalThumb          = null;
             Action <Image> animationEvent      = null;
             Image[]        busyAnimationFrames = AnimatedResources.Working;
             Image[]        busyAnimationThumbs = new Image[busyAnimationFrames.Length];
             int            animationHz         = 50;
             Stopwatch      timing              = new Stopwatch();
             timing.Start();
             long elapsedTicks = timing.ElapsedTicks;
             using (System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer())
             {
Пример #19
0
 public FlipLayerVerticalFunction(int layerIndex)
     : base(StaticName,
            PdnResources.GetImageResource("Icons.MenuLayersFlipVerticalIcon.png"),
            FlipType.Vertical,
            layerIndex)
 {
 }
Пример #20
0
 public PosterizeAdjustment()
     : base(PdnResources.GetString("PosterizeAdjustment.Name"),
            PdnResources.GetImageResource("Icons.PosterizeEffectIcon.png").Reference,
            null,
            EffectFlags.Configurable)
 {
 }
Пример #21
0
 public PolarInversionEffect()
     : base(PdnResources.GetString("PolarInversion.Name"),
            PdnResources.GetImageResource("Icons.PolarInversionEffect.png").Reference,
            SubmenuNames.Distort,
            EffectFlags.Configurable)
 {
 }
Пример #22
0
 public InvertColorsEffect()
     : base(PdnResources.GetString("InvertColorsEffect.Name"),
            PdnResources.GetImageResource("Icons.InvertColorsEffect.png").Reference,
            null,
            EffectFlags.None)
 {
     this.invertOp = new UnaryPixelOps.Invert();
 }
Пример #23
0
 public UpdatesDialog()
 {
     this.InstallingOnExit = false;
     this.DoubleBuffered   = true;
     base.ResizeRedraw     = true;
     this.InitializeComponent();
     base.Icon = PdnResources.GetImageResource("Icons.MenuUtilitiesCheckForUpdatesIcon.png").Reference.ToIcon();
 }
Пример #24
0
 public DesaturateEffect()
     : base(PdnResources.GetString("DesaturateEffect.Name"),
            PdnResources.GetImageResource("Icons.DesaturateEffect.png").Reference,
            null,
            EffectFlags.None)
 {
     this.desaturateOp = new UnaryPixelOps.Desaturate();
 }
Пример #25
0
 protected void SetStatus(ImageResource statusIcon, string statusText)
 {
     if ((statusIcon == null) && (statusText != null))
     {
         statusIcon = PdnResources.GetImageResource("Icons.MenuHelpHelpTopicsIcon.png");
     }
     this.DocumentWorkspace.SetStatus(statusText, statusIcon);
 }
Пример #26
0
 public DentsEffect()
     : base(PdnResources.GetString("DentsEffect.Name"),
            PdnResources.GetImageResource("Icons.DentsEffectIcon.png").Reference,
            SubmenuNames.Distort,
            EffectFlags.Configurable)
 {
     EdgeBehavior = WarpEdgeBehavior.Reflect;
 }
Пример #27
0
        private static DialogResult ShowExpandCanvasTaskDialog(IWin32Window owner, Surface thumbnail)
        {
            DialogResult result;

            Icon   formIcon  = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.MenuEditPasteIcon.png").Reference);
            string formTitle = PdnResources.GetString("ExpandCanvasQuestion.Title");

            RenderArgs taskImageRA = new RenderArgs(thumbnail);
            Image      taskImage   = taskImageRA.Bitmap;
            string     introText   = PdnResources.GetString("ExpandCanvasQuestion.IntroText");

            TaskButton yesTB = new TaskButton(
                PdnResources.GetImageResource("Icons.ExpandCanvasQuestion.YesTB.Image.png").Reference,
                PdnResources.GetString("ExpandCanvasQuestion.YesTB.ActionText"),
                PdnResources.GetString("ExpandCanvasQuestion.YesTB.ExplanationText"));

            TaskButton noTB = new TaskButton(
                PdnResources.GetImageResource("Icons.ExpandCanvasQuestion.NoTB.Image.png").Reference,
                PdnResources.GetString("ExpandCanvasQuestion.NoTB.ActionText"),
                PdnResources.GetString("ExpandCanvasQuestion.NoTB.ExplanationText"));

            TaskButton cancelTB = new TaskButton(
                TaskButton.Cancel.Image,
                PdnResources.GetString("ExpandCanvasQuestion.CancelTB.ActionText"),
                PdnResources.GetString("ExpandCanvasQuestion.CancelTB.ExplanationText"));

            int width96dpi = (TaskDialog.DefaultPixelWidth96Dpi * 3) / 2;

            TaskButton clickedTB = TaskDialog.Show(
                owner,
                formIcon,
                formTitle,
                taskImage,
                false,
                introText,
                new TaskButton[] { yesTB, noTB, cancelTB },
                yesTB,
                cancelTB,
                width96dpi);

            if (clickedTB == yesTB)
            {
                result = DialogResult.Yes;
            }
            else if (clickedTB == noTB)
            {
                result = DialogResult.No;
            }
            else
            {
                result = DialogResult.Cancel;
            }

            taskImageRA.Dispose();
            taskImageRA = null;

            return(result);
        }
Пример #28
0
        private void InitializeComponent()
        {
            Size size = new Size(UIUtil.ScaleWidth(0x10) + 6, UIUtil.ScaleHeight(0x10) + 6);

            this.toolsWindowToggleButton                = new ToolStripButton();
            this.toolsWindowToggleButton.Image          = PdnResources.GetImageResource("Icons.Settings.Tools.16.png").Reference;
            this.toolsWindowToggleButton.Checked        = true;
            this.toolsWindowToggleButton.Click         += new EventHandler(this.OnToggleButtonClick);
            this.toolsWindowToggleButton.Text           = PdnResources.GetString("Menu.Window.Tools.Text");
            this.toolsWindowToggleButton.DisplayStyle   = ToolStripItemDisplayStyle.Image;
            this.toolsWindowToggleButton.AutoSize       = false;
            this.toolsWindowToggleButton.Size           = size;
            this.toolsWindowToggleButton.Margin         = new Padding(0, 0, 1, 0);
            this.historyWindowToggleButton              = new ToolStripButton();
            this.historyWindowToggleButton.Image        = PdnResources.GetImageResource("Icons.MenuWindowHistoryIcon.16.png").Reference;
            this.historyWindowToggleButton.Checked      = true;
            this.historyWindowToggleButton.Click       += new EventHandler(this.OnToggleButtonClick);
            this.historyWindowToggleButton.Text         = PdnResources.GetString("Menu.Window.History.Text");
            this.historyWindowToggleButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.historyWindowToggleButton.AutoSize     = false;
            this.historyWindowToggleButton.Size         = size;
            this.historyWindowToggleButton.Margin       = new Padding(0, 0, 1, 0);
            this.layersWindowToggleButton               = new ToolStripButton();
            this.layersWindowToggleButton.Image         = PdnResources.GetImageResource("Icons.MenuWindowLayersIcon.16.png").Reference;
            this.layersWindowToggleButton.Checked       = true;
            this.layersWindowToggleButton.Click        += new EventHandler(this.OnToggleButtonClick);
            this.layersWindowToggleButton.Text          = PdnResources.GetString("Menu.Window.Layers.Text");
            this.layersWindowToggleButton.DisplayStyle  = ToolStripItemDisplayStyle.Image;
            this.layersWindowToggleButton.AutoSize      = false;
            this.layersWindowToggleButton.Size          = size;
            this.layersWindowToggleButton.Margin        = new Padding(0, 0, 1, 0);
            this.colorsWindowToggleButton               = new ToolStripButton();
            this.colorsWindowToggleButton.Image         = PdnResources.GetImageResource("Icons.MenuWindowColorsIcon.16.png").Reference;
            this.colorsWindowToggleButton.Checked       = true;
            this.colorsWindowToggleButton.Click        += new EventHandler(this.OnToggleButtonClick);
            this.colorsWindowToggleButton.Text          = PdnResources.GetString("Menu.Window.Colors.Text");
            this.colorsWindowToggleButton.DisplayStyle  = ToolStripItemDisplayStyle.Image;
            this.colorsWindowToggleButton.AutoSize      = false;
            this.colorsWindowToggleButton.Size          = size;
            this.showSettingsButton              = new ToolStripButton();
            this.showSettingsButton.Image        = PdnResources.GetImageResource("Icons.MenuUtilitiesSettingsIcon.16.png").Reference;
            this.showSettingsButton.Checked      = false;
            this.showSettingsButton.Click       += new EventHandler(this.OnShowSettingsClick);
            this.showSettingsButton.Text         = PdnResources.GetString("Menu.Settings.Text");
            this.showSettingsButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.showSettingsButton.AutoSize     = false;
            this.showSettingsButton.Size         = size;
            this.showSettingsButton.Margin       = new Padding(1, 0, 0, 0);
            this.helpMenu        = new HelpMenu();
            this.helpMenu.Margin = new Padding(1, 0, 0, 0);
            base.SuspendLayout();
            base.Name             = "PdnAuxMenu";
            base.LayoutStyle      = ToolStripLayoutStyle.HorizontalStackWithOverflow;
            base.ShowItemToolTips = true;
            ToolStripItem[] toolStripItems = new ToolStripItem[] { this.toolsWindowToggleButton, this.historyWindowToggleButton, this.layersWindowToggleButton, this.colorsWindowToggleButton, new ToolStripSeparator(), this.showSettingsButton, this.helpMenu };
            this.Items.AddRange(toolStripItems);
            base.ResumeLayout();
        }
Пример #29
0
 public RectangleSelectTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            PdnResources.GetImageResource("Icons.RectangleSelectToolIcon.png"),
            PdnResources.GetString("RectangleSelectTool.Name"),
            PdnResources.GetString("RectangleSelectTool.HelpText"),
            's',
            ToolBarConfigItems.SelectionDrawMode)
 {
 }
Пример #30
0
 public EllipseSelectTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            PdnResources.GetImageResource("Icons.EllipseSelectToolIcon.png"),
            PdnResources.GetString("EllipseSelectTool.Name"),
            PdnResources.GetString("EllipseSelectTool.HelpText"),
            's',
            ToolBarConfigItems.None)
 {
 }