Esempio n. 1
0
        // returns null to indicate user cancelled, or if initialNewSize = newSize that the user requested,
        // or if there was an error (out of memory)
        public static Document ResizeDocument(IWin32Window parent,
                                              Document document,
                                              Size initialNewSize,
                                              AnchorEdge initialAnchor,
                                              ColorBgra background,
                                              bool loadAndSaveMaintainAspect,
                                              bool saveAnchor)
        {
            using (CanvasSizeDialog csd = new CanvasSizeDialog())
            {
                bool maintainAspect;

                if (loadAndSaveMaintainAspect)
                {
                    maintainAspect = Settings.CurrentUser.GetBoolean(SettingNames.LastMaintainAspectRatioCS, false);
                }
                else
                {
                    maintainAspect = false;
                }

                csd.OriginalSize      = document.Size;
                csd.ImageWidth        = initialNewSize.Width;
                csd.ImageHeight       = initialNewSize.Height;
                csd.LayerCount        = document.Layers.Count;
                csd.AnchorEdge        = initialAnchor;
                csd.ConstrainToAspect = maintainAspect;

                DialogResult result  = csd.ShowDialog(parent);
                Size         newSize = new Size(csd.ImageWidth, csd.ImageHeight);

                // If they cancelled, get out
                if (result == DialogResult.Cancel)
                {
                    return(null);
                }

                // If they clicked OK, then we save the aspect checkbox, and maybe the anchor
                if (loadAndSaveMaintainAspect)
                {
                    Settings.CurrentUser.SetBoolean(SettingNames.LastMaintainAspectRatioCS, csd.ConstrainToAspect);
                }

                if (saveAnchor)
                {
                    Settings.CurrentUser.SetString(SettingNames.LastCanvasSizeAnchorEdge, csd.AnchorEdge.ToString());
                }

                try
                {
                    Utility.GCFullCollect();
                    Document newDoc = ResizeDocument(document, newSize, csd.AnchorEdge, background);
                    return(newDoc);
                }

                catch (OutOfMemoryException)
                {
                    Utility.ErrorBox(parent, PdnResources.GetString("CanvasSizeAction.ResizeDocument.OutOfMemory"));
                    return(null);
                }

                catch
                {
                    return(null);
                }
            }
        }
Esempio n. 2
0
 public EllipseShape() : base(PdnResources.GetString("EllipseShape.Name"), ShapeCategory.Basic)
 {
     this.sync = new object();
 }
Esempio n. 3
0
 private void InitializeComponent()
 {
     this.menuImageCrop            = new PdnMenuItem();
     this.menuImageResize          = new PdnMenuItem();
     this.menuImageCanvasSize      = new PdnMenuItem();
     this.menuImageSeparator1      = new ToolStripSeparator();
     this.menuImageFlip            = new PdnMenuItem();
     this.menuImageFlipHorizontal  = new PdnMenuItem();
     this.menuImageFlipVertical    = new PdnMenuItem();
     this.menuImageRotate          = new PdnMenuItem();
     this.menuImageRotate90CW      = new PdnMenuItem();
     this.menuImageRotate180CW     = new PdnMenuItem();
     this.menuImageRotate270CW     = new PdnMenuItem();
     this.menuImageRotateSeparator = new ToolStripSeparator();
     this.menuImageRotate90CCW     = new PdnMenuItem();
     this.menuImageRotate180CCW    = new PdnMenuItem();
     this.menuImageRotate270CCW    = new PdnMenuItem();
     this.menuImageSeparator2      = new ToolStripSeparator();
     this.menuImageFlatten         = new PdnMenuItem();
     //
     // ImageMenu
     //
     this.DropDownItems.AddRange(
         new System.Windows.Forms.ToolStripItem[]
     {
         this.menuImageCrop,
         this.menuImageResize,
         this.menuImageCanvasSize,
         this.menuImageSeparator1,
         this.menuImageFlip,
         this.menuImageRotate,
         this.menuImageSeparator2,
         this.menuImageFlatten
     });
     this.Name = "Menu.Image";
     this.Text = PdnResources.GetString("Menu.Image.Text");
     //
     // menuImageCrop
     //
     this.menuImageCrop.Name         = "Crop";
     this.menuImageCrop.Click       += new System.EventHandler(this.MenuImageCrop_Click);
     this.menuImageCrop.ShortcutKeys = Keys.Control | Keys.Shift | Keys.X;
     //
     // menuImageResize
     //
     this.menuImageResize.Name         = "Resize";
     this.menuImageResize.ShortcutKeys = Keys.Control | Keys.R;
     this.menuImageResize.Click       += new System.EventHandler(this.MenuImageResize_Click);
     //
     // menuImageCanvasSize
     //
     this.menuImageCanvasSize.Name         = "CanvasSize";
     this.menuImageCanvasSize.ShortcutKeys = Keys.Control | Keys.Shift | Keys.R;
     this.menuImageCanvasSize.Click       += new System.EventHandler(this.MenuImageCanvasSize_Click);
     //
     // menuImageFlip
     //
     this.menuImageFlip.Name = "Flip";
     this.menuImageFlip.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.menuImageFlipHorizontal,
         this.menuImageFlipVertical
     });
     //
     // menuImageFlipHorizontal
     //
     this.menuImageFlipHorizontal.Name   = "Horizontal";
     this.menuImageFlipHorizontal.Click += new System.EventHandler(this.MenuImageFlipHorizontal_Click);
     //
     // menuImageFlipVertical
     //
     this.menuImageFlipVertical.Name   = "Vertical";
     this.menuImageFlipVertical.Click += new System.EventHandler(this.MenuImageFlipVertical_Click);
     //
     // menuImageRotate
     //
     this.menuImageRotate.Name = "Rotate";
     this.menuImageRotate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.menuImageRotate90CW,
         this.menuImageRotate180CW,
         this.menuImageRotate270CW,
         this.menuImageRotateSeparator,
         this.menuImageRotate90CCW,
         this.menuImageRotate180CCW,
         this.menuImageRotate270CCW
     });
     //
     // menuImageRotate90CW
     //
     this.menuImageRotate90CW.Name         = "90CW";
     this.menuImageRotate90CW.ShortcutKeys = Keys.Control | Keys.H;
     this.menuImageRotate90CW.Click       += new System.EventHandler(this.MenuImageRotate90CW_Click);
     //
     // menuImageRotate180CW
     //
     this.menuImageRotate180CW.Name   = "180CW";
     this.menuImageRotate180CW.Click += new System.EventHandler(this.MenuImageRotate180CW_Click);
     //
     // menuImageRotate270CW
     //
     this.menuImageRotate270CW.Name   = "270CW";
     this.menuImageRotate270CW.Click += new System.EventHandler(this.MenuImageRotate270CW_Click);
     //
     // menuImageRotate90CCW
     //
     this.menuImageRotate90CCW.Name         = "90CCW";
     this.menuImageRotate90CCW.ShortcutKeys = Keys.Control | Keys.G;
     this.menuImageRotate90CCW.Click       += new System.EventHandler(this.MenuImageRotate90CCW_Click);
     //
     // menuImageRotate180CCW
     //
     this.menuImageRotate180CCW.Name   = "180CCW";
     this.menuImageRotate180CCW.Click += new System.EventHandler(this.MenuImageRotate180CCW_Click);
     //
     // menuImageRotate270CCW
     //
     this.menuImageRotate270CCW.Name   = "270CCW";
     this.menuImageRotate270CCW.Click += new System.EventHandler(this.MenuImageRotate270CCW_Click);
     //
     // menuImageFlatten
     //
     this.menuImageFlatten.Name         = "Flatten";
     this.menuImageFlatten.ShortcutKeys = Keys.Control | Keys.Shift | Keys.F;
     this.menuImageFlatten.Click       += new System.EventHandler(this.MenuImageFlatten_Click);
 }
Esempio n. 4
0
        public VectorSliderPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            SuspendLayout();

            this.header          = new HeaderLabel();
            this.sliderX         = new TrackBar();
            this.numericUpDownX  = new PdnNumericUpDown();
            this.resetButtonX    = new Button();
            this.sliderY         = new TrackBar();
            this.numericUpDownY  = new PdnNumericUpDown();
            this.resetButtonY    = new Button();
            this.descriptionText = new Label();

            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.sliderX.Name          = "sliderX";
            this.sliderX.AutoSize      = false;
            this.sliderX.ValueChanged += new EventHandler(SliderX_ValueChanged);
            this.sliderX.Orientation   = Orientation.Horizontal;
            this.SliderShowTickMarksX  = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksX].Value;

            this.numericUpDownX.Name          = "numericUpDownX";
            this.numericUpDownX.ValueChanged += new EventHandler(NumericUpDownX_ValueChanged);
            this.numericUpDownX.TextAlign     = HorizontalAlignment.Right;

            this.resetButtonX.Name      = "resetButtonX";
            this.resetButtonX.AutoSize  = false;
            this.resetButtonX.FlatStyle = FlatStyle.Standard;
            this.resetButtonX.Click    += new EventHandler(ResetButtonX_Click);
            this.resetButtonX.Image     = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
            this.resetButtonX.Visible   = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            this.ToolTip.SetToolTip(this.resetButtonX, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));

            this.sliderY.Name          = "sliderY";
            this.sliderY.AutoSize      = false;
            this.sliderY.ValueChanged += new EventHandler(SliderY_ValueChanged);
            this.sliderY.Orientation   = Orientation.Horizontal;
            this.SliderShowTickMarksY  = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksY].Value;

            this.numericUpDownY.Name          = "numericUpDownY";
            this.numericUpDownY.ValueChanged += new EventHandler(NumericUpDownY_ValueChanged);
            this.numericUpDownY.TextAlign     = HorizontalAlignment.Right;

            this.resetButtonY.Name      = "resetButtonY";
            this.resetButtonY.AutoSize  = false;
            this.resetButtonY.FlatStyle = FlatStyle.Standard;
            this.resetButtonY.Click    += new EventHandler(ResetButtonY_Click);
            this.resetButtonY.Image     = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
            this.resetButtonY.Visible   = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            this.ToolTip.SetToolTip(this.resetButtonY, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));

            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            ValidateUIRanges();

            ResetUIRanges();

            Controls.AddRange(
                new Control[]
            {
                this.header,
                this.sliderX,
                this.numericUpDownX,
                this.resetButtonX,
                this.sliderY,
                this.numericUpDownY,
                this.resetButtonY,
                this.descriptionText
            });

            ResumeLayout(false);
        }
 public InvertColorsEffect()
     : base(PdnResources.GetString("InvertColorsEffect.Name"),
            PdnResources.GetImage("Icons.InvertColorsEffect.png"))
 {
     this.invertOp = new UnaryPixelOps.Invert();
 }
Esempio n. 6
0
        private void MenuFileOpenRecent_DropDownOpening(object sender, System.EventArgs e)
        {
            AppWorkspace.MostRecentFiles.LoadMruList();
            MostRecentFile[] filesReverse = AppWorkspace.MostRecentFiles.GetFileList();
            MostRecentFile[] files        = new MostRecentFile[filesReverse.Length];
            int i;

            for (i = 0; i < filesReverse.Length; ++i)
            {
                files[files.Length - i - 1] = filesReverse[i];
            }

            foreach (ToolStripItem mi in menuFileOpenRecent.DropDownItems)
            {
                mi.Click -= new EventHandler(MenuFileOpenRecentFile_Click);
            }

            menuFileOpenRecent.DropDownItems.Clear();

            i = 0;

            foreach (MostRecentFile mrf in files)
            {
                string menuName;

                if (i < 9)
                {
                    menuName = "&";
                }
                else
                {
                    menuName = "";
                }

                menuName += (1 + i).ToString() + " " + Path.GetFileName(mrf.FileName);
                ToolStripMenuItem mi = new ToolStripMenuItem(menuName);
                mi.Click       += new EventHandler(MenuFileOpenRecentFile_Click);
                mi.ImageScaling = ToolStripItemImageScaling.None;
                mi.Image        = (Image)mrf.Thumb.Clone();
                menuFileOpenRecent.DropDownItems.Add(mi);
                ++i;
            }

            if (menuFileOpenRecent.DropDownItems.Count == 0)
            {
                ToolStripMenuItem none = new ToolStripMenuItem(PdnResources.GetString("Menu.File.OpenRecent.None"));
                none.Enabled = false;
                menuFileOpenRecent.DropDownItems.Add(none);
            }
            else
            {
                ToolStripSeparator separator = new ToolStripSeparator();
                menuFileOpenRecent.DropDownItems.Add(separator);

                ToolStripMenuItem clearList = new ToolStripMenuItem();
                clearList.Text = PdnResources.GetString("Menu.File.OpenRecent.ClearThisList");
                menuFileOpenRecent.DropDownItems.Add(clearList);
                Image deleteIcon = PdnResources.GetImageResource("Icons.MenuEditEraseSelectionIcon.png").Reference;
                clearList.ImageTransparentColor = Utility.TransparentKey;
                clearList.ImageAlign            = ContentAlignment.MiddleCenter;
                clearList.ImageScaling          = ToolStripItemImageScaling.None;
                int    iconSize = AppWorkspace.MostRecentFiles.IconSize;
                Bitmap bitmap   = new Bitmap(iconSize + 2, iconSize + 2);

                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.Clear(clearList.ImageTransparentColor);

                    Point offset = new Point((bitmap.Width - deleteIcon.Width) / 2,
                                             (bitmap.Height - deleteIcon.Height) / 2);

                    g.CompositingMode = CompositingMode.SourceCopy;
                    g.DrawImage(deleteIcon, offset.X, offset.Y, deleteIcon.Width, deleteIcon.Height);
                }

                clearList.Image  = bitmap;
                clearList.Click += new EventHandler(ClearList_Click);
            }
        }
Esempio n. 7
0
 public DdsFileType()
     : base(PdnResources.GetString("DdsFileType.Name"),
            FileTypeFlags.SupportsLoading | FileTypeFlags.SupportsSaving | FileTypeFlags.SavesWithProgress,
            new string[] { ".dds" })
 {
 }
Esempio n. 8
0
        protected override ControlInfo OnCreateConfigUI(PropertyCollection props)
        {
            ControlInfo configUI = CreateDefaultConfigUI(props);

            configUI.SetPropertyControlValue(PropertyNames.Tolerance, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("RedEyeRemoveEffect.ConfigDialog.Amount1Label"));
            configUI.SetPropertyControlValue(PropertyNames.Saturation, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("RedEyeRemoveEffect.ConfigDialog.Amount2Label"));
            configUI.SetPropertyControlValue(PropertyNames.Saturation, ControlInfoPropertyNames.Description, PdnResources.GetString("RedEyeRemoveEffectDialog.UsageHintLabel.Text"));

            return(configUI);
        }
Esempio n. 9
0
 protected override void OnDragDrop(DragEventArgs drgevent)
 {
     base.Activate();
     if ((!PdnBaseForm.IsInThreadModalLoop && base.Enabled) && drgevent.Data.GetDataPresent(System.Windows.Forms.DataFormats.FileDrop))
     {
         string[] data = drgevent.Data.GetData(System.Windows.Forms.DataFormats.FileDrop) as string[];
         if (data == null)
         {
             return;
         }
         string[] fileNames = this.PruneDirectories(data);
         bool     flag      = true;
         if (fileNames.Length == 0)
         {
             return;
         }
         if ((fileNames.Length == 1) && (this.appWorkspace.DocumentWorkspaces.Length == 0))
         {
             flag = false;
         }
         else
         {
             string     str4;
             string     str    = (fileNames.Length > 1) ? "Plural" : "Singular";
             Icon       icon   = PdnResources.GetImageResource("Icons.DragDrop.OpenOrImport.FormIcon.png").Reference.ToIcon();
             string     str2   = PdnResources.GetString("DragDrop.OpenOrImport.Title");
             string     str3   = PdnResources.GetString("DragDrop.OpenOrImport.InfoText." + str);
             TaskButton button = new TaskButton(PdnResources.GetImageResource("Icons.MenuFileOpenIcon.png").Reference, PdnResources.GetString("DragDrop.OpenOrImport.OpenButton.ActionText"), PdnResources.GetString("DragDrop.OpenOrImport.OpenButton.ExplanationText." + str));
             if (this.appWorkspace.DocumentWorkspaces.Length == 0)
             {
                 str4 = PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ExplanationText.NoImagesYet.Plural");
             }
             else
             {
                 str4 = PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ExplanationText." + str);
             }
             TaskButton button2 = new TaskButton(PdnResources.GetImageResource("Icons.MenuLayersAddNewLayerIcon.png").Reference, PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ActionText." + str), str4);
             TaskButton button3 = new TaskButton(PdnResources.GetImageResource("Icons.CancelIcon.png").Reference, PdnResources.GetString("TaskButton.Cancel.ActionText"), PdnResources.GetString("TaskButton.Cancel.ExplanationText"));
             TaskDialog dialog2 = new TaskDialog {
                 Icon  = icon,
                 Title = str2,
                 ScaleTaskImageWithDpi = false,
                 IntroText             = str3
             };
             dialog2.TaskButtons  = new TaskButton[] { button, button2, button3 };
             dialog2.CancelButton = button3;
             TaskButton button4 = dialog2.Show(this);
             if (button4 == button)
             {
                 flag = false;
             }
             else if (button4 == button2)
             {
                 flag = true;
             }
             else
             {
                 return;
             }
         }
         if (!flag)
         {
             this.appWorkspace.OpenFilesInNewWorkspace(fileNames);
         }
         else
         {
             if (this.appWorkspace.ActiveDocumentWorkspace == null)
             {
                 SizeInt32 newDocumentSize = this.appWorkspace.GetNewDocumentSize();
                 this.appWorkspace.CreateBlankDocumentInNewWorkspace(newDocumentSize, Document.DefaultDpuUnit, Document.GetDefaultDpu(Document.DefaultDpuUnit), false);
             }
             HistoryMemento memento = new ImportFromFileAction().ImportMultipleFiles(this.appWorkspace.ActiveDocumentWorkspace, fileNames);
             if (memento != null)
             {
                 this.appWorkspace.ActiveDocumentWorkspace.History.PushNewMemento(memento);
             }
         }
     }
     base.OnDragDrop(drgevent);
 }
Esempio n. 10
0
 private void InitializeComponent()
 {
     this.menuFileNew                        = new PdnMenuItem();
     this.menuFileOpen                       = new PdnMenuItem();
     this.menuFileOpenRecent                 = new PdnMenuItem();
     this.menuFileOpenRecentSentinel         = new PdnMenuItem();
     this.menuFileAcquire                    = new PdnMenuItem();
     this.menuFileAcquireFromScannerOrCamera = new PdnMenuItem();
     this.menuFileClose                      = new PdnMenuItem();
     this.menuFileSeparator1                 = new ToolStripSeparator();
     this.menuFileSave                       = new PdnMenuItem();
     this.menuFileSaveAs                     = new PdnMenuItem();
     this.menuFileSeparator2                 = new ToolStripSeparator();
     this.menuFilePrint                      = new PdnMenuItem();
     this.menuFileSeparator3                 = new ToolStripSeparator();
     this.menuFileExit                       = new PdnMenuItem();
     //
     // FileMenu
     //
     this.DropDownItems.AddRange(
         new ToolStripItem[]
     {
         this.menuFileNew,
         this.menuFileOpen,
         this.menuFileOpenRecent,
         this.menuFileAcquire,
         this.menuFileClose,
         this.menuFileSeparator1,
         this.menuFileSave,
         this.menuFileSaveAs,
         this.menuFileSeparator2,
         this.menuFilePrint,
         this.menuFileSeparator3,
         this.menuFileExit
     });
     this.Name = "Menu.File";
     this.Text = PdnResources.GetString("Menu.File.Text");
     //
     // menuFileNew
     //
     this.menuFileNew.Name         = "New";
     this.menuFileNew.ShortcutKeys = Keys.Control | Keys.N;
     this.menuFileNew.Click       += new System.EventHandler(this.MenuFileNew_Click);
     //
     // menuFileOpen
     //
     this.menuFileOpen.Name         = "Open";
     this.menuFileOpen.ShortcutKeys = Keys.Control | Keys.O;
     this.menuFileOpen.Click       += new System.EventHandler(this.MenuFileOpen_Click);
     //
     // menuFileOpenRecent
     //
     this.menuFileOpenRecent.Name = "OpenRecent";
     this.menuFileOpenRecent.DropDownItems.AddRange(
         new ToolStripItem[]
     {
         this.menuFileOpenRecentSentinel
     });
     this.menuFileOpenRecent.DropDownOpening += new System.EventHandler(this.MenuFileOpenRecent_DropDownOpening);
     //
     // menuFileOpenRecentSentinel
     //
     this.menuFileOpenRecentSentinel.Text = "sentinel";
     //
     // menuFileAcquire
     //
     this.menuFileAcquire.Name = "Acquire";
     this.menuFileAcquire.DropDownItems.AddRange(
         new ToolStripItem[]
     {
         this.menuFileAcquireFromScannerOrCamera
     });
     this.menuFileAcquire.DropDownOpening += new System.EventHandler(this.MenuFileAcquire_DropDownOpening);
     //
     // menuFileAcquireFromScannerOrCamera
     //
     this.menuFileAcquireFromScannerOrCamera.Name   = "FromScannerOrCamera";
     this.menuFileAcquireFromScannerOrCamera.Click += new System.EventHandler(this.MenuFileAcquireFromScannerOrCamera_Click);
     //
     // menuFileClose
     //
     this.menuFileClose.Name         = "Close";
     this.menuFileClose.Click       += new EventHandler(MenuFileClose_Click);
     this.menuFileClose.ShortcutKeys = Keys.Control | Keys.W;
     //
     // menuFileSave
     //
     this.menuFileSave.Name         = "Save";
     this.menuFileSave.ShortcutKeys = Keys.Control | Keys.S;
     this.menuFileSave.Click       += new System.EventHandler(this.MenuFileSave_Click);
     //
     // menuFileSaveAs
     //
     this.menuFileSaveAs.Name         = "SaveAs";
     this.menuFileSaveAs.ShortcutKeys = Keys.Control | Keys.Shift | Keys.S;
     this.menuFileSaveAs.Click       += new System.EventHandler(this.MenuFileSaveAs_Click);
     //
     // menuFilePrint
     //
     this.menuFilePrint.Name         = "Print";
     this.menuFilePrint.ShortcutKeys = Keys.Control | Keys.P;
     this.menuFilePrint.Click       += new System.EventHandler(this.MenuFilePrint_Click);
     //
     // menuFileExit
     //
     this.menuFileExit.Name   = "Exit";
     this.menuFileExit.Click += new System.EventHandler(this.MenuFileExit_Click);
 }
Esempio n. 11
0
        protected override ControlInfo OnCreateConfigUI(PropertyCollection props)
        {
            ControlInfo configUI = CreateDefaultConfigUI(props);

            configUI.SetPropertyControlValue(PropertyNames.Intensity, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("AddNoiseEffect.Amount1Label"));
            configUI.SetPropertyControlValue(PropertyNames.Saturation, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("AddNoiseEffect.Amount2Label"));
            configUI.SetPropertyControlValue(PropertyNames.Coverage, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("AddNoiseEffect.Coverage"));
            configUI.SetPropertyControlValue(PropertyNames.Coverage, ControlInfoPropertyNames.UseExponentialScale, true);

            return(configUI);
        }
Esempio n. 12
0
 public ResizeDialog() : base(ImageSizeDialogType.ImageResize)
 {
     this.Text = PdnResources.GetString("ResizeDialog.Text");
     base.Icon = PdnResources.GetImageResource("Icons.MenuImageResizeIcon.png").Reference.ToIcon();
 }
Esempio n. 13
0
        public SliderPropertyControl(PropertyControlInfo propInfo)
            : base(propInfo)
        {
            this.header          = new HeaderLabel();
            this.slider          = new TrackBar();
            this.numericUpDown   = new PdnNumericUpDown();
            this.resetButton     = new Button();
            this.descriptionText = new Label();

            this.slider.BeginInit();

            SuspendLayout();

            this.header.Name        = "header";
            this.header.RightMargin = 0;
            this.header.Text        = this.DisplayName;

            this.numericUpDown.DecimalPlaces = 0;
            this.numericUpDown.Name          = "numericUpDown";
            this.numericUpDown.TextAlign     = HorizontalAlignment.Right;
            this.numericUpDown.TabIndex      = 1;

            this.slider.Name         = "slider";
            this.slider.AutoSize     = false;
            this.slider.Orientation  = Orientation.Horizontal;
            this.slider.TabIndex     = 0;
            this.SliderShowTickMarks = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarks].Value;

            this.resetButton.AutoSize  = false;
            this.resetButton.Name      = "resetButton";
            this.resetButton.FlatStyle = FlatStyle.Standard;
            this.resetButton.Click    += new EventHandler(ResetButton_Click);
            this.resetButton.Image     = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
            this.resetButton.TabIndex  = 2;
            this.resetButton.Visible   = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
            this.ToolTip.SetToolTip(this.resetButton, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));

            this.descriptionText.Name     = "descriptionText";
            this.descriptionText.AutoSize = false;
            this.descriptionText.Text     = this.Description;

            // In order to make sure that setting the ranges on the controls doesn't affect the property in weird ways,
            // we don't set up our ValueChanged handlers until after we set up the controls.
            ValidateUIRanges();
            ResetUIRanges();

            this.numericUpDown.ValueChanged += new EventHandler(NumericUpDown_ValueChanged);
            this.slider.ValueChanged        += new EventHandler(Slider_ValueChanged);

            Controls.AddRange(
                new Control[]
            {
                this.header,
                this.slider,
                this.numericUpDown,
                this.resetButton,
                this.descriptionText
            });

            this.slider.EndInit();

            ResumeLayout(false);
        }
Esempio n. 14
0
 public TrapezoidShape() : base(PdnResources.GetString("TrapezoidShape.Name"), ShapeCategory.Basic)
 {
 }
Esempio n. 15
0
        protected override PdnGraphicsPath CreateShapePath(PointF[] points)
        {
            PointF     a = points[0];
            PointF     b = points[points.Length - 1];
            RectangleF rect;

            if ((ModifierKeys & Keys.Shift) != 0)
            {
                PointF dir    = new PointF(b.X - a.X, b.Y - a.Y);
                float  len    = (float)Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y);
                PointF center = new PointF((a.X + b.X) / 2.0f, (a.Y + b.Y) / 2.0f);
                float  radius = len / 2.0f;
                rect = Utility.RectangleFromCenter(center, radius);
            }
            else
            {
                rect = Utility.PointsToRectangle(a, b);
            }

            if (rect.Width == 0 || rect.Height == 0)
            {
                return(null);
            }

            PdnGraphicsPath path = new PdnGraphicsPath();

            path.AddEllipse(rect);
            path.Flatten(Utility.IdentityMatrix, 0.10f);

            MeasurementUnit units = AppWorkspace.Units;

            double widthPhysical  = Math.Abs(Document.PixelToPhysicalX(rect.Width, units));
            double heightPhysical = Math.Abs(Document.PixelToPhysicalY(rect.Height, units));
            double areaPhysical   = Math.PI * (widthPhysical / 2.0) * (heightPhysical / 2.0);

            string numberFormat;
            string unitsAbbreviation;

            if (units != MeasurementUnit.Pixel)
            {
                string unitsAbbreviationName = "MeasurementUnit." + units.ToString() + ".Abbreviation";
                unitsAbbreviation = PdnResources.GetString(unitsAbbreviationName);
                numberFormat      = "F2";
            }
            else
            {
                unitsAbbreviation = string.Empty;
                numberFormat      = "F0";
            }

            string unitsString = PdnResources.GetString("MeasurementUnit." + units.ToString() + ".Plural");

            string statusText = string.Format(
                this.statusTextFormat,
                widthPhysical.ToString(numberFormat),
                unitsAbbreviation,
                heightPhysical.ToString(numberFormat),
                unitsAbbreviation,
                areaPhysical.ToString(numberFormat),
                unitsString);

            this.SetStatus(this.ellipseToolIcon, statusText);
            return(path);
        }
Esempio n. 16
0
 protected override void OnShown(EventArgs e)
 {
     this.SetTitleText();
     base.OnShown(e);
     if (PdnInfo.IsExpired)
     {
         foreach (Form form in Application.OpenForms)
         {
             form.Enabled = false;
         }
         TaskButton   button      = new TaskButton(PdnResources.GetImageResource("Icons.MenuUtilitiesCheckForUpdatesIcon.png").Reference, PdnResources.GetString("ExpiredTaskDialog.CheckForUpdatesTB.ActionText"), PdnResources.GetString("ExpiredTaskDialog.CheckForUpdatesTB.ExplanationText"));
         TaskButton   button2     = new TaskButton(PdnResources.GetImageResource("Icons.MenuHelpPdnWebsiteIcon.png").Reference, PdnResources.GetString("ExpiredTaskDialog.GoToWebSiteTB.ActionText"), PdnResources.GetString("ExpiredTaskDialog.GoToWebSiteTB.ExplanationText"));
         TaskButton   button3     = new TaskButton(PdnResources.GetImageResource("Icons.CancelIcon.png").Reference, PdnResources.GetString("ExpiredTaskDialog.DoNotCheckForUpdatesTB.ActionText"), PdnResources.GetString("ExpiredTaskDialog.DoNotCheckForUpdatesTB.ExplanationText"));
         TaskButton[] buttonArray = new TaskButton[] { button, button2, button3 };
         TaskDialog   dialog1     = new TaskDialog {
             Icon                  = base.Icon,
             Title                 = PdnInfo.FullAppName,
             TaskImage             = PdnResources.GetImageResource("Icons.WarningIcon.png").Reference,
             ScaleTaskImageWithDpi = true,
             IntroText             = PdnResources.GetString("ExpiredTaskDialog.InfoText"),
             TaskButtons           = buttonArray,
             AcceptButton          = button,
             CancelButton          = button3,
             PixelWidth96Dpi       = 450
         };
         TaskButton button4 = dialog1.Show(this);
         if (button4 == button)
         {
             UpdatesService.Instance.PerformUpdateCheck();
         }
         else if (button4 == button2)
         {
             PdnInfo.LaunchWebSite(this, "redirect/pdnexpired.html");
         }
         base.Close();
     }
     if (this.appWorkspace.ActiveDocumentWorkspace != null)
     {
         this.appWorkspace.ActiveDocumentWorkspace.Focus();
     }
     else
     {
         this.appWorkspace.Focus();
     }
 }
Esempio n. 17
0
        private void MenuFileViewPluginLoadErrors_Click(object sender, EventArgs e)
        {
            IList <Triple <Assembly, Type, Exception> > allErrors = AppWorkspace.GetEffectLoadErrors();
            IList <Triple <Assembly, Type, Exception> > errors    = RemoveDuplicates(allErrors);

            using (Form errorsDialog = new Form())
            {
                errorsDialog.Icon = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.MenuFileViewPluginLoadErrorsIcon.png").Reference);
                errorsDialog.Text = PdnResources.GetString("Effects.PluginLoadErrorsDialog.Text");

                Label messageLabel = new Label();
                messageLabel.Name = "messageLabel";
                messageLabel.Text = PdnResources.GetString("Effects.PluginLoadErrorsDialog.Message.Text");

                TextBox errorsBox = new TextBox();
                errorsBox.Font       = new Font(FontFamily.GenericMonospace, errorsBox.Font.Size);
                errorsBox.ReadOnly   = true;
                errorsBox.Multiline  = true;
                errorsBox.ScrollBars = ScrollBars.Vertical;

                StringBuilder allErrorsText    = new StringBuilder();
                string        headerTextFormat = PdnResources.GetString("EffectErrorMessage.HeaderFormat");

                for (int i = 0; i < errors.Count; ++i)
                {
                    Assembly  assembly  = errors[i].First;
                    Type      type      = errors[i].Second;
                    Exception exception = errors[i].Third;

                    string headerText = string.Format(headerTextFormat, i + 1, errors.Count);
                    string errorText  = AppWorkspace.GetLocalizedEffectErrorMessage(assembly, type, exception);

                    allErrorsText.Append(headerText);
                    allErrorsText.Append(Environment.NewLine);
                    allErrorsText.Append(errorText);

                    if (i != errors.Count - 1)
                    {
                        allErrorsText.Append(Environment.NewLine);
                    }
                }

                errorsBox.Text = allErrorsText.ToString();

                errorsDialog.Layout +=
                    delegate(object sender2, LayoutEventArgs e2)
                {
                    int hMargin    = UI.ScaleWidth(8);
                    int vMargin    = UI.ScaleHeight(8);
                    int insetWidth = errorsDialog.ClientSize.Width - (hMargin * 2);

                    messageLabel.Location = new Point(hMargin, vMargin);
                    messageLabel.Width    = insetWidth;
                    messageLabel.Size     = messageLabel.GetPreferredSize(new Size(messageLabel.Width, 1));

                    errorsBox.Location = new Point(hMargin, messageLabel.Bottom + vMargin);
                    errorsBox.Width    = insetWidth;
                    errorsBox.Height   = errorsDialog.ClientSize.Height - vMargin - errorsBox.Top;
                };

                errorsDialog.StartPosition = FormStartPosition.CenterParent;
                errorsDialog.ShowInTaskbar = false;
                errorsDialog.MinimizeBox   = false;
                errorsDialog.Width        *= 2;
                errorsDialog.Size          = UI.ScaleSize(errorsDialog.Size);
                errorsDialog.Controls.Add(messageLabel);
                errorsDialog.Controls.Add(errorsBox);

                errorsDialog.ShowDialog(AppWorkspace);
            }
        }
Esempio n. 18
0
        protected override ControlInfo OnCreateConfigUI(PropertyCollection props)
        {
            ControlInfo configUI = CreateDefaultConfigUI(props);

            configUI.SetPropertyControlValue(PropertyNames.Softness, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("SoftenPortraitEffect.ConfigDialog.SoftnessLabel"));
            configUI.SetPropertyControlValue(PropertyNames.Lighting, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("SoftenPortraitEffect.ConfigDialog.LightingLabel"));
            configUI.SetPropertyControlValue(PropertyNames.Warmth, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("SoftenPortraitEffect.ConfigDialog.WarmthLabel"));

            return(configUI);
        }
Esempio n. 19
0
 private void InitializeComponent()
 {
     this.menuFileNew                  = new PdnMenuItem();
     this.menuFileOpen                 = new PdnMenuItem();
     this.menuFileOpenRecent           = new PdnMenuItem();
     this.menuFileOpenRecentSentinel   = new PdnMenuItem();
     this.menuFileClose                = new PdnMenuItem();
     this.menuFileSeparator1           = new ToolStripSeparator();
     this.menuFileSave                 = new PdnMenuItem();
     this.menuFileSaveAs               = new PdnMenuItem();
     this.menuFileSeparator2           = new ToolStripSeparator();
     this.menuFileViewPluginLoadErrors = new PdnMenuItem();
     this.menuFileSeparator3           = new ToolStripSeparator();
     this.menuFileExit                 = new PdnMenuItem();
     //
     // FileMenu
     //
     this.DropDownItems.AddRange(GetMenuItemsToAdd(true));
     this.Name = "Menu.File";
     this.Text = PdnResources.GetString("Menu.File.Text");
     //
     // menuFileNew
     //
     this.menuFileNew.Name         = "New";
     this.menuFileNew.ShortcutKeys = Keys.Control | Keys.N;
     this.menuFileNew.Click       += new System.EventHandler(this.MenuFileNew_Click);
     //
     // menuFileOpen
     //
     this.menuFileOpen.Name         = "Open";
     this.menuFileOpen.ShortcutKeys = Keys.Control | Keys.O;
     this.menuFileOpen.Click       += new System.EventHandler(this.MenuFileOpen_Click);
     //
     // menuFileOpenRecent
     //
     this.menuFileOpenRecent.Name = "OpenRecent";
     this.menuFileOpenRecent.DropDownItems.AddRange(
         new ToolStripItem[]
     {
         this.menuFileOpenRecentSentinel
     });
     this.menuFileOpenRecent.DropDownOpening += new System.EventHandler(this.MenuFileOpenRecent_DropDownOpening);
     //
     // menuFileOpenRecentSentinel
     //
     this.menuFileOpenRecentSentinel.Text = "sentinel";
     //
     // menuFileClose
     //
     this.menuFileClose.Name         = "Close";
     this.menuFileClose.Click       += new EventHandler(MenuFileClose_Click);
     this.menuFileClose.ShortcutKeys = Keys.Control | Keys.W;
     //
     // menuFileSave
     //
     this.menuFileSave.Name         = "Save";
     this.menuFileSave.ShortcutKeys = Keys.Control | Keys.S;
     this.menuFileSave.Click       += new System.EventHandler(this.MenuFileSave_Click);
     //
     // menuFileSaveAs
     //
     this.menuFileSaveAs.Name         = "SaveAs";
     this.menuFileSaveAs.ShortcutKeys = Keys.Control | Keys.Shift | Keys.S;
     this.menuFileSaveAs.Click       += new System.EventHandler(this.MenuFileSaveAs_Click);
     //
     // menuFileViewPluginLoadErrors
     //
     this.menuFileViewPluginLoadErrors.Name   = "ViewPluginLoadErrors";
     this.menuFileViewPluginLoadErrors.Click += new EventHandler(MenuFileViewPluginLoadErrors_Click);
     //
     // menuFileExit
     //
     this.menuFileExit.Name   = "Exit";
     this.menuFileExit.Click += new System.EventHandler(this.MenuFileExit_Click);
 }
Esempio n. 20
0
        protected override ControlInfo OnCreateConfigUI(PropertyCollection props)
        {
            ControlInfo configUI = CreateDefaultConfigUI(props);

            configUI.SetPropertyControlValue(PropertyNames.CellSize, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("PixelateEffect.ConfigDialog.SliderLabel"));
            // TODO: units label?
            //aecg.SliderUnitsName = PdnResources.GetString("PixelateEffect.ConfigDialog.SliderUnitsName");

            return(configUI);
        }
        public static HistoryFunctionResult ApplyFunction(this DocumentWorkspace dw, HistoryFunction function)
        {
            HistoryFunctionResult successNoOp;
            bool flag = false;

            if ((function.ActionFlags & ActionFlags.KeepToolActive) != ActionFlags.KeepToolActive)
            {
                dw.PushNullTool();
                dw.Update();
                flag = true;
            }
            try
            {
                using (new WaitCursorChanger(dw))
                {
                    string         localizedErrorText;
                    HistoryMemento memento   = null;
                    Exception      exception = null;
                    try
                    {
                        memento = function.Execute(dw);
                        if (memento == null)
                        {
                            successNoOp = HistoryFunctionResult.SuccessNoOp;
                        }
                        else
                        {
                            successNoOp = HistoryFunctionResult.Success;
                        }
                        localizedErrorText = null;
                    }
                    catch (HistoryFunctionNonFatalException exception2)
                    {
                        exception = exception2;
                        if (exception2.InnerException is OutOfMemoryException)
                        {
                            successNoOp = HistoryFunctionResult.OutOfMemory;
                        }
                        else
                        {
                            successNoOp = HistoryFunctionResult.NonFatalError;
                        }
                        if (exception2.LocalizedErrorText != null)
                        {
                            localizedErrorText = exception2.LocalizedErrorText;
                        }
                        else if (exception2.InnerException is OutOfMemoryException)
                        {
                            localizedErrorText = PdnResources.GetString("ExecuteFunction.GenericOutOfMemory");
                        }
                        else
                        {
                            localizedErrorText = PdnResources.GetString("ExecuteFunction.GenericError");
                        }
                    }
                    if ((localizedErrorText != null) && (exception != null))
                    {
                        ExceptionDialog.ShowErrorDialog(dw, localizedErrorText, exception);
                    }
                    else if ((localizedErrorText != null) && (exception == null))
                    {
                        MessageBoxUtil.ErrorBox(dw, localizedErrorText);
                    }
                    if (memento != null)
                    {
                        dw.History.PushNewMemento(memento);
                    }
                }
            }
            finally
            {
                if (flag)
                {
                    dw.PopNullTool();
                }
            }
            return(successNoOp);
        }
Esempio n. 22
0
 public ToolsForm()
 {
     this.InitializeComponent();
     this.Text = PdnResources.GetString("MainToolBarForm.Text");
 }
Esempio n. 23
0
        public override ControlInfo OnCreateSaveConfigUI(PropertyCollection props)
        {
            ControlInfo info = PropertyBasedFileType.CreateDefaultSaveConfigUI(props);

            info.SetPropertyControlValue(PropertyNames.BitDepth, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("BmpFileType.ConfigUI.BitDepth.DisplayName"));
            PropertyControlInfo info2 = info.FindControlForPropertyName(PropertyNames.BitDepth);

            info2.SetValueDisplayName(BmpBitDepthUIChoices.AutoDetect, PdnResources.GetString("BmpFileType.ConfigUI.BitDepth.AutoDetect.DisplayName"));
            info2.SetValueDisplayName(BmpBitDepthUIChoices.Bpp24, PdnResources.GetString("BmpFileType.ConfigUI.BitDepth.Bpp24.DisplayName"));
            info2.SetValueDisplayName(BmpBitDepthUIChoices.Bpp8, PdnResources.GetString("BmpFileType.ConfigUI.BitDepth.Bpp8.DisplayName"));
            info.SetPropertyControlType(PropertyNames.BitDepth, PropertyControlType.RadioButton);
            info.SetPropertyControlValue(PropertyNames.DitherLevel, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("BmpFileType.ConfigUI.DitherLevel.DisplayName"));
            return(info);
        }
Esempio n. 24
0
        protected override ControlInfo OnCreateConfigUI(PropertyCollection props)
        {
            ControlInfo configUI = CreateDefaultConfigUI(props);

            configUI.SetPropertyControlValue(PropertyNames.Angle, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("RadialBlurEffect.ConfigDialog.RadialLabel"));
            configUI.FindControlForPropertyName(PropertyNames.Angle).ControlType.Value = PropertyControlType.AngleChooser;

            configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("RadialBlurEffect.ConfigDialog.OffsetLabel"));
            configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderSmallChangeX, 0.05);
            configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderLargeChangeX, 0.25);
            configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.UpDownIncrementX, 0.01);
            configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderSmallChangeY, 0.05);
            configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.SliderLargeChangeY, 0.25);
            configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.UpDownIncrementY, 0.01);

            Surface       sourceSurface = this.EnvironmentParameters.SourceSurface;
            Bitmap        bitmap        = sourceSurface.CreateAliasedBitmap();
            ImageResource imageResource = ImageResource.FromImage(bitmap);

            configUI.SetPropertyControlValue(PropertyNames.Offset, ControlInfoPropertyNames.StaticImageUnderlay, imageResource);

            configUI.SetPropertyControlValue(PropertyNames.Quality, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("RadialBlurEffect.ConfigDialog.QualityLabel"));
            configUI.SetPropertyControlValue(PropertyNames.Quality, ControlInfoPropertyNames.Description, PdnResources.GetString("RadialBlurEffect.ConfigDialog.QualityDescription"));

            return(configUI);
        }
Esempio n. 25
0
 public ShapesTool(DocumentWorkspace docWorkspace) : base(docWorkspace, PdnResources.GetImageResource("Icons.ShapesToolIcon.16.png"), PdnResources.GetString("ShapesTool.Name"), PdnResources.GetString("ShapesTool.HelpText"), 'o', ToolBarConfigItems.None | ToolBarConfigItems.ShapeDrawType | ToolBarConfigItems.ShapeType)
 {
 }
Esempio n. 26
0
        protected override ControlInfo OnCreateConfigUI(PropertyCollection props)
        {
            ControlInfo configUI = CreateDefaultConfigUI(props);

            configUI.SetPropertyControlValue(PropertyNames.Factor, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("JuliaFractalEffect.ConfigDialog.Factor.DisplayName"));
            configUI.SetPropertyControlValue(PropertyNames.Quality, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("JuliaFractalEffect.ConfigDialog.Quality.DisplayName"));
            configUI.SetPropertyControlValue(PropertyNames.Zoom, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("JuliaFractalEffect.ConfigDialog.Zoom.DisplayName"));
            configUI.SetPropertyControlValue(PropertyNames.Angle, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("JuliaFractalEffect.ConfigDialog.Angle.DisplayName"));
            configUI.SetPropertyControlType(PropertyNames.Angle, PropertyControlType.AngleChooser);

            return(configUI);
        }
Esempio n. 27
0
 private void InitializeComponent()
 {
     this.menuWindowResetWindowLocations = new PdnMenuItem();
     this.menuWindowSeperator1           = new ToolStripSeparator();
     this.menuWindowTranslucent          = new PdnMenuItem();
     this.menuWindowSeperator2           = new ToolStripSeparator();
     this.menuWindowTools       = new PdnMenuItem();
     this.menuWindowLayers      = new PdnMenuItem();
     this.menuWindowColors      = new PdnMenuItem();
     this.menuWindowSeparator3  = new ToolStripSeparator();
     this.menuWindowOpenMdiList = new PdnMenuItem();
     this.menuWindowNextTab     = new PdnMenuItem();
     this.menuWindowPreviousTab = new PdnMenuItem();
     //
     // WindowMenu
     //
     this.DropDownItems.AddRange(
         new ToolStripItem[]
     {
         this.menuWindowResetWindowLocations,
         this.menuWindowSeperator1,
         this.menuWindowTranslucent,
         this.menuWindowSeperator2,
         this.menuWindowTools,
         this.menuWindowLayers,
         this.menuWindowColors,
         this.menuWindowSeparator3,
         this.menuWindowOpenMdiList,
         this.menuWindowNextTab,
         this.menuWindowPreviousTab
     });
     this.Name = "Menu.Window";
     this.Text = PdnResources.GetString("Menu.Window.Text");
     //
     // menuWindowResetWindowLocations
     //
     this.menuWindowResetWindowLocations.Name   = "ResetWindowLocations";
     this.menuWindowResetWindowLocations.Click += new System.EventHandler(this.MenuWindowResetWindowLocations_Click);
     //
     // menuWindowTranslucent
     //
     this.menuWindowTranslucent.Name   = "Translucent";
     this.menuWindowTranslucent.Click += new System.EventHandler(this.MenuWindowTranslucent_Click);
     //
     // menuWindowTools
     //
     this.menuWindowTools.Name         = "Tools";
     this.menuWindowTools.ShortcutKeys = Keys.F5;
     this.menuWindowTools.Click       += new System.EventHandler(this.MenuWindowTools_Click);
     //
     // menuWindowLayers
     //
     this.menuWindowLayers.Name         = "Layers";
     this.menuWindowLayers.ShortcutKeys = Keys.F7;
     this.menuWindowLayers.Click       += new System.EventHandler(this.MenuWindowLayers_Click);
     //
     // menuWindowColors
     //
     this.menuWindowColors.Name         = "Colors";
     this.menuWindowColors.ShortcutKeys = Keys.F8;
     this.menuWindowColors.Click       += new System.EventHandler(this.MenuWindowColors_Click);
     //
     // menuWindowOpenMdiList
     //
     this.menuWindowOpenMdiList.Name         = "OpenMdiList";
     this.menuWindowOpenMdiList.ShortcutKeys = Keys.Control | Keys.Q;
     this.menuWindowOpenMdiList.Click       += new EventHandler(MenuWindowOpenMdiList_Click);
     //
     // menuWindowNextTab
     //
     this.menuWindowNextTab.Name         = "NextTab";
     this.menuWindowNextTab.ShortcutKeys = Keys.Control | Keys.Tab;
     this.menuWindowNextTab.Click       += new EventHandler(MenuWindowNextTab_Click);
     //
     // menuWindowPreviousTab
     //
     this.menuWindowPreviousTab.Name         = "PreviousTab";
     this.menuWindowPreviousTab.ShortcutKeys = Keys.Control | Keys.Shift | Keys.Tab;
     this.menuWindowPreviousTab.Click       += new EventHandler(MenuWindowPreviousTab_Click);
 }
Esempio n. 28
0
 public Vector3SliderPropertyControl(PropertyControlInfo propInfo) : base(propInfo)
 {
     this.decimalPlaces = 2;
     base.SuspendLayout();
     this.header                       = new HeadingLabel();
     this.sliderX                      = new PdnTrackBar();
     this.numericUpDownX               = new PdnNumericUpDown();
     this.resetButtonX                 = new PdnPushButton();
     this.sliderY                      = new PdnTrackBar();
     this.numericUpDownY               = new PdnNumericUpDown();
     this.resetButtonY                 = new PdnPushButton();
     this.sliderZ                      = new PdnTrackBar();
     this.numericUpDownZ               = new PdnNumericUpDown();
     this.resetButtonZ                 = new PdnPushButton();
     this.descriptionText              = new PdnLabel();
     this.header.Name                  = "header";
     this.header.RightMargin           = 0;
     this.header.Text                  = base.DisplayName;
     this.sliderX.Name                 = "sliderX";
     this.sliderX.AutoSize             = false;
     this.sliderX.ValueChanged        += new EventHandler(this.OnSliderXValueChanged);
     this.SliderShowTickMarksX         = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksX].Value;
     this.sliderX.ResetRequested      += new EventHandler(this.OnResetButtonXClick);
     this.numericUpDownX.Name          = "numericUpDownX";
     this.numericUpDownX.ValueChanged += new EventHandler(this.OnNumericUpDownXValueChanged);
     this.numericUpDownX.TextAlign     = HorizontalAlignment.Right;
     this.resetButtonX.Name            = "resetButtonX";
     this.resetButtonX.AutoSize        = false;
     this.resetButtonX.Click          += new EventHandler(this.OnResetButtonXClick);
     this.resetButtonX.Image           = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
     this.resetButtonX.Visible         = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
     base.ToolTip.SetToolTip(this.resetButtonX, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));
     this.sliderY.Name                 = "sliderY";
     this.sliderY.AutoSize             = false;
     this.sliderY.ValueChanged        += new EventHandler(this.OnSliderYValueChanged);
     this.SliderShowTickMarksY         = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksY].Value;
     this.sliderY.ResetRequested      += new EventHandler(this.OnResetButtonYClick);
     this.numericUpDownY.Name          = "numericUpDownY";
     this.numericUpDownY.ValueChanged += new EventHandler(this.OnNumericUpDownYValueChanged);
     this.numericUpDownY.TextAlign     = HorizontalAlignment.Right;
     this.resetButtonY.Name            = "resetButtonY";
     this.resetButtonY.AutoSize        = false;
     this.resetButtonY.Click          += new EventHandler(this.OnResetButtonYClick);
     this.resetButtonY.Image           = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
     this.resetButtonY.Visible         = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
     base.ToolTip.SetToolTip(this.resetButtonY, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));
     this.sliderZ.Name                 = "sliderZ";
     this.sliderZ.AutoSize             = false;
     this.sliderZ.ValueChanged        += new EventHandler(this.OnSliderZValueChanged);
     this.SliderShowTickMarksZ         = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.SliderShowTickMarksZ].Value;
     this.sliderZ.ResetRequested      += new EventHandler(this.OnResetButtonZClick);
     this.numericUpDownZ.Name          = "numericUpDownZ";
     this.numericUpDownZ.ValueChanged += new EventHandler(this.OnNumericUpDownZValueChanged);
     this.numericUpDownZ.TextAlign     = HorizontalAlignment.Right;
     this.resetButtonZ.Name            = "resetButtonZ";
     this.resetButtonZ.AutoSize        = false;
     this.resetButtonZ.Click          += new EventHandler(this.OnResetButtonZClick);
     this.resetButtonZ.Image           = PdnResources.GetImageResource("Icons.ResetIcon.png").Reference;
     this.resetButtonZ.Visible         = (bool)propInfo.ControlProperties[ControlInfoPropertyNames.ShowResetButton].Value;
     base.ToolTip.SetToolTip(this.resetButtonZ, PdnResources.GetString("Form.ResetButton.Text").Replace("&", ""));
     this.descriptionText.Name     = "descriptionText";
     this.descriptionText.AutoSize = false;
     this.descriptionText.Text     = base.Description;
     this.ValidateUIRanges();
     this.ResetUIRanges();
     Control[] controls = new Control[] { this.header, this.sliderX, this.numericUpDownX, this.resetButtonX, this.sliderY, this.numericUpDownY, this.resetButtonY, this.sliderZ, this.numericUpDownZ, this.resetButtonZ, this.descriptionText };
     base.Controls.AddRange(controls);
     base.ResumeLayout(false);
 }
        public override HistoryMemento OnExecute(IHistoryWorkspace historyWorkspace)
        {
            int newWidth;
            int newHeight;

            // Get new width and Height
            switch (rotation)
            {
            case RotateType.Clockwise90:
            case RotateType.Clockwise270:
            case RotateType.CounterClockwise90:
            case RotateType.CounterClockwise270:
                newWidth  = historyWorkspace.Document.Height;
                newHeight = historyWorkspace.Document.Width;
                break;

            case RotateType.Clockwise180:
            case RotateType.CounterClockwise180:
                newWidth  = historyWorkspace.Document.Width;
                newHeight = historyWorkspace.Document.Height;
                break;

            default:
                throw new InvalidEnumArgumentException("invalid RotateType");
            }

            // Figure out which icon and text to use
            string iconResName;
            string suffix;

            switch (rotation)
            {
            case RotateType.Clockwise180:
                iconResName = "Icons.MenuImageRotate180CWIcon.png";
                suffix      = PdnResources.GetString("RotateAction.180CW");
                break;

            case RotateType.Clockwise270:
                iconResName = "Icons.MenuImageRotate270CWIcon.png";
                suffix      = PdnResources.GetString("RotateAction.270CW");
                break;

            case RotateType.Clockwise90:
                iconResName = "Icons.MenuImageRotate90CWIcon.png";
                suffix      = PdnResources.GetString("RotateAction.90CW");
                break;

            case RotateType.CounterClockwise180:
                iconResName = "Icons.MenuImageRotate180CCWIcon.png";
                suffix      = PdnResources.GetString("RotateAction.180CCW");
                break;

            case RotateType.CounterClockwise270:
                iconResName = "Icons.MenuImageRotate270CCWIcon.png";
                suffix      = PdnResources.GetString("RotateAction.270CCW");
                break;

            case RotateType.CounterClockwise90:
                iconResName = "Icons.MenuImageRotate90CCWIcon.png";
                suffix      = PdnResources.GetString("RotateAction.90CCW");
                break;

            default:
                throw new InvalidEnumArgumentException("invalid RotateType");
            }

            // Initialize the new Doc
            string        haNameFormat = PdnResources.GetString("RotateAction.HistoryMementoName.Format");
            string        haName       = string.Format(haNameFormat, StaticName, suffix);
            ImageResource haImage      = ImageResource.Get(iconResName);

            List <HistoryMemento> actions = new List <HistoryMemento>();

            // do the memory allocation now: if this fails, we can still bail out cleanly
            Document newDoc = new Document(newWidth, newHeight);

            if (!historyWorkspace.Selection.IsEmpty)
            {
                DeselectFunction da = new DeselectFunction();
                EnterCriticalRegion();
                HistoryMemento hm = da.Execute(historyWorkspace);
                actions.Add(hm);
            }

            ReplaceDocumentHistoryMemento rdha = new ReplaceDocumentHistoryMemento(null, null, historyWorkspace);

            actions.Add(rdha);

            newDoc.ReplaceMetaDataFrom(historyWorkspace.Document);

            // TODO: serialize oldDoc to disk, and let the GC purge it if needed
            OnProgress(0.0);

            for (int i = 0; i < historyWorkspace.Document.Layers.Count; ++i)
            {
                Layer layer = historyWorkspace.Document.Layers.GetAt(i);

                double progressStart = 100.0 * ((double)i / (double)historyWorkspace.Document.Layers.Count);
                double progressEnd   = 100.0 * ((double)(i + 1) / (double)historyWorkspace.Document.Layers.Count);

                if (layer is BitmapLayer)
                {
                    Layer nl = RotateLayer((BitmapLayer)layer, rotation, newWidth, newHeight, progressStart, progressEnd);
                    newDoc.Layers.Add(nl);
                }
                else
                {
                    throw new InvalidOperationException("Cannot Rotate non-BitmapLayers");
                }

                if (this.PleaseCancel)
                {
                    break;
                }

                OnProgress(progressEnd);
            }

            CompoundHistoryMemento chm = new CompoundHistoryMemento(
                haName,
                haImage,
                actions);

            if (this.PleaseCancel)
            {
                chm = null;
            }
            else
            {
                EnterCriticalRegion();
                historyWorkspace.Document = newDoc;
            }

            return(chm);
        }
Esempio n. 30
0
 public ToolsSettingsSection(AppSettings appSettings, AppSettings.ToolsSection toolBarSettings) : base(appSettings, PdnResources.GetString("SettingsDialog.Tools.DisplayName"), PdnResources.GetImageResource("Icons.Settings.Tools.24.png").Reference)
 {
     this.toolBarSettings = toolBarSettings;
     foreach (Setting setting in appSettings.ToolDefaults.Settings)
     {
         base.AddSetting(setting);
     }
 }