public void SetToDefaults() { this.antiAliasing = true; this.fontSmoothing = FontSmoothing.Smooth; this.primaryColor = ColorBgra.FromBgra(0, 0, 0, 255); this.secondaryColor = ColorBgra.FromBgra(255, 255, 255, 255); this.gradientInfo = new GradientInfo(GradientType.LinearClamped, false); this.penInfo = new PenInfo(PenInfo.DefaultDashStyle, 2.0f, PenInfo.DefaultLineCap, PenInfo.DefaultLineCap, PenInfo.DefaultCapScale); this.brushInfo = new BrushInfo(BrushType.Solid, HatchStyle.BackwardDiagonal); try { this.fontInfo = new FontInfo(new FontFamily("Arial"), 12, FontStyle.Regular); } catch (Exception) { this.fontInfo = new FontInfo(new FontFamily(GenericFontFamilies.SansSerif), 12, FontStyle.Regular); } this.textAlignment = TextAlignment.Left; this.shapeDrawType = ShapeDrawType.Outline; this.alphaBlending = true; this.tolerance = 0.5f; this.colorPickerClickBehavior = ColorPickerClickBehavior.NoToolSwitch; this.resamplingAlgorithm = ResamplingAlgorithm.Bilinear; this.selectionCombineMode = CombineMode.Replace; this.floodMode = FloodMode.Local; this.selectionDrawModeInfo = SelectionDrawModeInfo.CreateDefault(); }
public override bool Equals(object obj) { GradientInfo asGI = obj as GradientInfo; if (asGI == null) { return(false); } return(asGI.GradientType == this.GradientType && asGI.AlphaOnly == this.AlphaOnly); }
public void LoadFrom(AppEnvironment appEnvironment) { this.textAlignment = appEnvironment.textAlignment; this.gradientInfo = appEnvironment.gradientInfo.Clone(); this.fontSmoothing = appEnvironment.fontSmoothing; this.fontInfo = appEnvironment.fontInfo.Clone(); this.penInfo = appEnvironment.penInfo.Clone(); this.brushInfo = appEnvironment.brushInfo.Clone(); this.primaryColor = appEnvironment.primaryColor; this.secondaryColor = appEnvironment.secondaryColor; this.alphaBlending = appEnvironment.alphaBlending; this.shapeDrawType = appEnvironment.shapeDrawType; this.antiAliasing = appEnvironment.antiAliasing; this.colorPickerClickBehavior = appEnvironment.colorPickerClickBehavior; this.resamplingAlgorithm = appEnvironment.resamplingAlgorithm; this.tolerance = appEnvironment.tolerance; PerformAllChanged(); }
private void InitializeComponent() { this.brushSeparator = new ToolStripSeparator(); this.brushStyleLabel = new ToolStripLabel(); this.brushStyleComboBox = new ToolStripComboBox(); this.shapeSeparator = new ToolStripSeparator(); this.shapeButton = new ToolStripSplitButton(); this.gradientSeparator1 = new ToolStripSeparator(); this.gradientLinearClampedButton = new ToolStripButton(); this.gradientLinearReflectedButton = new ToolStripButton(); this.gradientLinearDiamondButton = new ToolStripButton(); this.gradientRadialButton = new ToolStripButton(); this.gradientConicalButton = new ToolStripButton(); this.gradientSeparator2 = new ToolStripSeparator(); this.gradientChannelsSplitButton = new ToolStripSplitButton(); this.penSeparator = new ToolStripSeparator(); this.penSizeLabel = new ToolStripLabel(); this.penSizeDecButton = new ToolStripButton(); this.penSizeComboBox = new ToolStripComboBox(); this.penSizeIncButton = new ToolStripButton(); this.blendingSeparator = new ToolStripSeparator(); this.antiAliasingSplitButton = new ToolStripSplitButton(); this.alphaBlendingSplitButton = new ToolStripSplitButton(); this.toleranceSeparator = new ToolStripSeparator(); this.toleranceLabel = new ToolStripLabel(); this.toleranceSlider = new ToleranceSliderControl(); this.toleranceSliderStrip = new ToolStripControlHost(this.toleranceSlider); this.fontSeparator = new ToolStripSeparator(); this.fontLabel = new ToolStripLabel(); this.fontFamilyComboBox = new ToolStripComboBox(); this.fontSizeComboBox = new ToolStripComboBox(); this.fontSmoothingComboBox = new ToolStripComboBox(); this.fontStyleSeparator = new ToolStripSeparator(); this.fontBoldButton = new ToolStripButton(); this.fontItalicsButton = new ToolStripButton(); this.fontUnderlineButton = new ToolStripButton(); this.fontAlignSeparator = new ToolStripSeparator(); this.fontAlignLeftButton = new ToolStripButton(); this.fontAlignCenterButton = new ToolStripButton(); this.fontAlignRightButton = new ToolStripButton(); this.resamplingSeparator = new ToolStripSeparator(); this.resamplingLabel = new ToolStripLabel(); this.resamplingComboBox = new ToolStripComboBox(); this.colorPickerSeparator = new ToolStripSeparator(); this.colorPickerLabel = new ToolStripLabel(); this.colorPickerComboBox = new ToolStripComboBox(); this.SuspendLayout(); // // brushStyleLabel // this.brushStyleLabel.Name = "fillStyleLabel"; // // brushStyleComboBox // this.brushStyleComboBox.Name = "styleComboBox"; this.brushStyleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.brushStyleComboBox.DropDownWidth = 234; this.brushStyleComboBox.AutoSize = true; // // brushStyleComboBox.ComboBox // this.brushStyleComboBox.ComboBox.DrawMode = DrawMode.OwnerDrawVariable; this.brushStyleComboBox.ComboBox.MeasureItem += ComboBoxStyle_MeasureItem; this.brushStyleComboBox.ComboBox.SelectedValueChanged += ComboBoxStyle_SelectedValueChanged; this.brushStyleComboBox.ComboBox.DrawItem += ComboBoxStyle_DrawItem; // // shapeButton // this.shapeButton.Name = "shapeButton"; this.shapeButton.DropDownOpening += new EventHandler(ShapeButton_DropDownOpening); this.shapeButton.DropDownClosed += delegate(object sender, EventArgs e) { this.shapeButton.DropDownItems.Clear(); }; this.shapeButton.ButtonClick += delegate(object sender, EventArgs e) { switch (ShapeDrawType) { case ShapeDrawType.Outline: ShapeDrawType = ShapeDrawType.Interior; break; case ShapeDrawType.Interior: ShapeDrawType = ShapeDrawType.Both; break; case ShapeDrawType.Both: ShapeDrawType = ShapeDrawType.Outline; break; default: throw new InvalidEnumArgumentException(); } }; // // gradientSeparator // this.gradientSeparator1.Name = "gradientSeparator"; // // gradientLinearClampedButton // this.gradientLinearClampedButton.Name = "gradientLinearClampedButton"; this.gradientLinearClampedButton.Click += GradientTypeButtonClicked; this.gradientLinearClampedButton.Tag = GradientType.LinearClamped; // // gradientLinearReflectedButton // this.gradientLinearReflectedButton.Name = "gradientLinearReflectedButton"; this.gradientLinearReflectedButton.Click += GradientTypeButtonClicked; this.gradientLinearReflectedButton.Tag = GradientType.LinearReflected; // // gradientLinearDiamondButton // this.gradientLinearDiamondButton.Name = "gradientLinearDiamondButton"; this.gradientLinearDiamondButton.Click += GradientTypeButtonClicked; this.gradientLinearDiamondButton.Tag = GradientType.LinearDiamond; // // gradientRadialButton // this.gradientRadialButton.Name = "gradientRadialButton"; this.gradientRadialButton.Click += GradientTypeButtonClicked; this.gradientRadialButton.Tag = GradientType.Radial; // // gradientConicalButton // this.gradientConicalButton.Name = "gradientConicalButton"; this.gradientConicalButton.Click += GradientTypeButtonClicked; this.gradientConicalButton.Tag = GradientType.Conical; // // gradientSeparator2 // this.gradientSeparator2.Name = "gradientSeparator2"; // // gradientChannelsSplitButton // this.gradientChannelsSplitButton.Name = "gradientChannelsSplitButton"; this.gradientChannelsSplitButton.DropDownOpening += new EventHandler(GradientChannelsSplitButton_DropDownOpening); this.gradientChannelsSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.gradientChannelsSplitButton.DropDownItems.Clear(); }; this.gradientChannelsSplitButton.ButtonClick += delegate(object sender, EventArgs e) { GradientInfo = new GradientInfo(GradientInfo.GradientType, !GradientInfo.AlphaOnly); }; // // penSeparator // this.penSeparator.Name = "penSeparator"; // // penSizeLabel // this.penSizeLabel.Name = "brushSizeLabel"; // // penSizeDecButton // this.penSizeDecButton.Name = "penSizeDecButton"; this.penSizeDecButton.Click += delegate(object sender, EventArgs e) { AddToPenSize(-1.0f); }; // // penSizeComboBox // this.penSizeComboBox.Name = "penSizeComboBox"; this.penSizeComboBox.Validating += new CancelEventHandler(this.BrushSizeComboBox_Validating); this.penSizeComboBox.TextChanged += new EventHandler(this.SizeComboBox_TextChanged); this.penSizeComboBox.AutoSize = false; this.penSizeComboBox.Width = 44; // // penSizeIncButton // this.penSizeIncButton.Name = "penSizeIncButton"; this.penSizeIncButton.Click += delegate(object sender, EventArgs e) { AddToPenSize(1.0f); }; // // antiAliasingSplitButton // this.antiAliasingSplitButton.Name = "antiAliasingSplitButton"; this.antiAliasingSplitButton.DisplayStyle = ToolStripItemDisplayStyle.Image; this.antiAliasingSplitButton.DropDownOpening += new EventHandler(AntiAliasingSplitButton_DropDownOpening); this.antiAliasingSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.antiAliasingSplitButton.DropDownItems.Clear(); }; this.antiAliasingSplitButton.ButtonClick += delegate(object sender, EventArgs e) { AntiAliasing = !AntiAliasing; }; // // alphaBlendingSplitButton // this.alphaBlendingSplitButton.Name = "alphaBlendingSplitButton"; this.alphaBlendingSplitButton.DisplayStyle = ToolStripItemDisplayStyle.Image; this.alphaBlendingSplitButton.DropDownOpening += new EventHandler(AlphaBlendingSplitButton_DropDownOpening); this.alphaBlendingSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.alphaBlendingSplitButton.DropDownItems.Clear(); }; this.alphaBlendingSplitButton.ButtonClick += delegate(object sender, EventArgs e) { AlphaBlending = !AlphaBlending; }; // // toleranceLabel // this.toleranceLabel.Name = "toleranceLabel"; // // toleranceSlider // this.toleranceSlider.Name = "toleranceSlider"; this.toleranceSlider.ToleranceChanged += new EventHandler(ToleranceSlider_ToleranceChanged); this.toleranceSlider.Size = new Size(120, 16); // // toleranceSliderStrip // this.toleranceSliderStrip.Name = "toleranceSliderStrip"; this.toleranceSliderStrip.AutoSize = false; // // fontLabel // this.fontLabel.Name = "fontLabel"; // // fontFamilyComboBox // this.fontFamilyComboBox.Name = "fontComboBox"; this.fontFamilyComboBox.AllowDrop = true; this.fontFamilyComboBox.DropDownWidth = 240; this.fontFamilyComboBox.MaxDropDownItems = 12; this.fontFamilyComboBox.Sorted = true; this.fontFamilyComboBox.GotFocus += new EventHandler(FontFamilyComboBox_GotFocus); this.fontFamilyComboBox.Items.Add(arialName); this.fontFamilyComboBox.SelectedItem = arialName; this.fontFamilyComboBox.SelectedIndexChanged += FontFamilyComboBox_SelectedIndexChanged; this.fontFamilyComboBox.DropDownStyle = ComboBoxStyle.DropDownList; // // fontFamilyComboBox.ComboBox // this.fontFamilyComboBox.ComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.fontFamilyComboBox.ComboBox.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.FontFamilyComboBox_MeasureItem); this.fontFamilyComboBox.ComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.FontFamilyComboBox_DrawItem); // // fontSizeComboBox // this.fontSizeComboBox.Name = "fontSizeComboBox"; this.fontSizeComboBox.AutoSize = false; this.fontSizeComboBox.TextChanged += new EventHandler(FontSizeComboBox_TextChanged); this.fontSizeComboBox.Validating += new CancelEventHandler(FontSizeComboBox_Validating); this.fontSizeComboBox.Text = initialFontSize.ToString(); this.fontSizeComboBox.Width = 44; // // fontSmoothingComboBox // this.fontSmoothingComboBox.Name = "smoothingComboBOx"; this.fontSmoothingComboBox.AutoSize = false; this.fontSmoothingComboBox.Sorted = false; this.fontSmoothingComboBox.Width = 70; this.fontSmoothingComboBox.DropDownStyle = ComboBoxStyle.DropDownList; this.fontSmoothingComboBox.SelectedIndexChanged += new EventHandler(SmoothingComboBox_SelectedIndexChanged); // // fontBoldButton // this.fontBoldButton.Name = "boldButton"; // // fontItalicsButton // this.fontItalicsButton.Name = "italicsButton"; // // fontUnderlineButton // this.fontUnderlineButton.Name = "underlineButton"; // // fontAlignLeftButton // this.fontAlignLeftButton.Name = "alignLeftButton"; // // fontAlignCenterButton // this.fontAlignCenterButton.Name = "alignCenterButton"; // // fontAlignRightButton // this.fontAlignRightButton.Name = "alignRightButton"; // // resamplingSeparator // this.resamplingSeparator.Name = "resamplingSeparator"; // // resamplingLabel // this.resamplingLabel.Name = "resamplingLabel"; // // resamplingComboBox // this.resamplingComboBox.Name = "resamplingComboBox"; this.resamplingComboBox.AutoSize = true; this.resamplingComboBox.DropDownStyle = ComboBoxStyle.DropDownList; this.resamplingComboBox.Sorted = false; this.resamplingComboBox.Width = 100; this.resamplingComboBox.DropDownWidth = 100; this.resamplingComboBox.SelectedIndexChanged += new EventHandler(ResamplingComboBox_SelectedIndexChanged); // // colorPickerSeparator // this.colorPickerSeparator.Name = "colorPickerSeparator"; // // colorPickerLabel // this.colorPickerLabel.Name = "colorPickerLabel"; // // colorPickerComboBox // this.colorPickerComboBox.Name = "colorPickerComboBox"; this.colorPickerComboBox.AutoSize = true; this.colorPickerComboBox.DropDownStyle = ComboBoxStyle.DropDownList; this.colorPickerComboBox.Width = 200; this.colorPickerComboBox.DropDownWidth = 200; this.colorPickerComboBox.Sorted = false; this.colorPickerComboBox.SelectedIndexChanged += new EventHandler(ColorPickerComboBox_SelectedIndexChanged); // // DrawConfigStrip // this.AutoSize = true; this.Items.Add(this.resamplingSeparator); this.Items.Add(this.resamplingLabel); this.Items.Add(this.resamplingComboBox); this.Items.Add(this.colorPickerSeparator); this.Items.Add(this.colorPickerLabel); this.Items.Add(this.colorPickerComboBox); this.Items.Add(this.fontSeparator); this.Items.Add(this.fontLabel); this.Items.Add(this.fontFamilyComboBox); this.Items.Add(this.fontSizeComboBox); this.Items.Add(this.fontSmoothingComboBox); this.Items.Add(this.fontStyleSeparator); this.Items.Add(this.fontBoldButton); this.Items.Add(this.fontItalicsButton); this.Items.Add(this.fontUnderlineButton); this.Items.Add(this.fontAlignSeparator); this.Items.Add(this.fontAlignLeftButton); this.Items.Add(this.fontAlignCenterButton); this.Items.Add(this.fontAlignRightButton); this.Items.Add(this.shapeSeparator); this.Items.Add(this.shapeButton); this.Items.Add(this.gradientSeparator1); this.Items.Add(this.gradientLinearClampedButton); this.Items.Add(this.gradientLinearReflectedButton); this.Items.Add(this.gradientLinearDiamondButton); this.Items.Add(this.gradientRadialButton); this.Items.Add(this.gradientConicalButton); this.Items.Add(this.gradientSeparator2); this.Items.Add(this.gradientChannelsSplitButton); this.Items.Add(this.penSeparator); this.Items.Add(this.penSizeLabel); this.Items.Add(this.penSizeDecButton); this.Items.Add(this.penSizeComboBox); this.Items.Add(this.penSizeIncButton); this.Items.Add(this.brushSeparator); this.Items.Add(this.brushStyleLabel); this.Items.Add(this.brushStyleComboBox); this.Items.Add(this.toleranceSeparator); this.Items.Add(this.toleranceLabel); this.Items.Add(this.toleranceSliderStrip); this.Items.Add(this.blendingSeparator); this.Items.Add(this.antiAliasingSplitButton); this.Items.Add(this.alphaBlendingSplitButton); this.ResumeLayout(false); }
private void GradientTypeButtonClicked(object sender, EventArgs e) { GradientType newType = (GradientType)((ToolStripButton)sender).Tag; GradientInfo = new GradientInfo(newType, GradientInfo.AlphaOnly); }
private void GradientChannelsSplitButton_DropDownOpening(object sender, EventArgs e) { ToolStripMenuItem allChannels = new ToolStripMenuItem( PdnResources.GetString("GradientChannels.AllColorChannels.Text"), this.gradientAllColorChannelsImage.Reference, delegate(object sender2, EventArgs e2) { GradientInfo = new GradientInfo(GradientInfo.GradientType, false); }); ToolStripMenuItem alphaOnly = new ToolStripMenuItem( PdnResources.GetString("GradientChannels.AlphaChannelOnly.Text"), this.gradientAlphaChannelOnlyImage.Reference, delegate(object sender3, EventArgs e3) { GradientInfo = new GradientInfo(GradientInfo.GradientType, true); }); allChannels.Checked = !GradientInfo.AlphaOnly; alphaOnly.Checked = GradientInfo.AlphaOnly; this.gradientChannelsSplitButton.DropDownItems.Clear(); this.gradientChannelsSplitButton.DropDownItems.AddRange( new ToolStripItem[] { allChannels, alphaOnly }); }
private void InitializeComponent() { this.brushSeparator = new ToolStripSeparator(); this.brushStyleLabel = new ToolStripLabel(); this.brushStyleComboBox = new ToolStripComboBox(); this.shapeSeparator = new ToolStripSeparator(); this.shapeButton = new ToolStripSplitButton(); this.gradientSeparator1 = new ToolStripSeparator(); this.gradientLinearClampedButton = new ToolStripButton(); this.gradientLinearReflectedButton = new ToolStripButton(); this.gradientLinearDiamondButton = new ToolStripButton(); this.gradientRadialButton = new ToolStripButton(); this.gradientConicalButton = new ToolStripButton(); this.gradientSeparator2 = new ToolStripSeparator(); this.gradientChannelsSplitButton = new ToolStripSplitButton(); this.penSeparator = new ToolStripSeparator(); this.penSizeLabel = new ToolStripLabel(); this.penSizeDecButton = new ToolStripButton(); this.penSizeComboBox = new ToolStripComboBox(); this.penSizeIncButton = new ToolStripButton(); this.penStyleLabel = new ToolStripLabel(); this.penStartCapSplitButton = new ToolStripSplitButton(); this.penDashStyleSplitButton = new ToolStripSplitButton(); this.penEndCapSplitButton = new ToolStripSplitButton(); this.blendingSeparator = new ToolStripSeparator(); this.antiAliasingSplitButton = new ToolStripSplitButton(); this.alphaBlendingSplitButton = new ToolStripSplitButton(); this.toleranceSeparator = new ToolStripSeparator(); this.toleranceLabel = new ToolStripLabel(); this.toleranceSlider = new ToleranceSliderControl(); this.toleranceSliderStrip = new ToolStripControlHost(this.toleranceSlider); this.fontSeparator = new ToolStripSeparator(); this.fontLabel = new ToolStripLabel(); this.fontFamilyComboBox = new ToolStripComboBox(); this.fontSizeComboBox = new ToolStripComboBox(); this.fontSmoothingComboBox = new ToolStripComboBox(); this.fontStyleSeparator = new ToolStripSeparator(); this.fontBoldButton = new ToolStripButton(); this.fontItalicsButton = new ToolStripButton(); this.fontUnderlineButton = new ToolStripButton(); this.fontAlignSeparator = new ToolStripSeparator(); this.fontAlignLeftButton = new ToolStripButton(); this.fontAlignCenterButton = new ToolStripButton(); this.fontAlignRightButton = new ToolStripButton(); this.resamplingSeparator = new ToolStripSeparator(); this.resamplingLabel = new ToolStripLabel(); this.resamplingComboBox = new ToolStripComboBox(); this.colorPickerSeparator = new ToolStripSeparator(); this.colorPickerLabel = new ToolStripLabel(); this.colorPickerComboBox = new ToolStripComboBox(); this.selectionCombineModeSeparator = new ToolStripSeparator(); this.selectionCombineModeLabel = new ToolStripLabel(); this.selectionCombineModeSplitButton = new ToolStripSplitButton(); this.floodModeSeparator = new ToolStripSeparator(); this.floodModeLabel = new ToolStripLabel(); this.floodModeSplitButton = new ToolStripSplitButton(); this.selectionDrawModeSeparator = new ToolStripSeparator(); this.selectionDrawModeModeLabel = new ToolStripLabel(); this.selectionDrawModeSplitButton = new ToolStripSplitButton(); this.selectionDrawModeWidthLabel = new ToolStripLabel(); this.selectionDrawModeWidthTextBox = new ToolStripTextBox(); this.selectionDrawModeSwapButton = new ToolStripButton(); this.selectionDrawModeHeightLabel = new ToolStripLabel(); this.selectionDrawModeHeightTextBox = new ToolStripTextBox(); this.selectionDrawModeUnits = new UnitsComboBoxStrip(); this.SuspendLayout(); // // brushStyleLabel // this.brushStyleLabel.Name = "fillStyleLabel"; // // brushStyleComboBox // this.brushStyleComboBox.Name = "styleComboBox"; this.brushStyleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.brushStyleComboBox.DropDownWidth = 234; this.brushStyleComboBox.AutoSize = true; // // brushStyleComboBox.ComboBox // this.brushStyleComboBox.ComboBox.DrawMode = DrawMode.OwnerDrawVariable; this.brushStyleComboBox.ComboBox.MeasureItem += ComboBoxStyle_MeasureItem; this.brushStyleComboBox.ComboBox.SelectedValueChanged += ComboBoxStyle_SelectedValueChanged; this.brushStyleComboBox.ComboBox.DrawItem += ComboBoxStyle_DrawItem; // // shapeButton // this.shapeButton.Name = "shapeButton"; this.shapeButton.DropDownOpening += new EventHandler(ShapeButton_DropDownOpening); this.shapeButton.DropDownClosed += delegate(object sender, EventArgs e) { this.shapeButton.DropDownItems.Clear(); }; this.shapeButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(shapeButton)"); switch (ShapeDrawType) { case ShapeDrawType.Outline: ShapeDrawType = ShapeDrawType.Interior; break; case ShapeDrawType.Interior: ShapeDrawType = ShapeDrawType.Both; break; case ShapeDrawType.Both: ShapeDrawType = ShapeDrawType.Outline; break; default: throw new InvalidEnumArgumentException(); } }; // // gradientSeparator // this.gradientSeparator1.Name = "gradientSeparator"; // // gradientLinearClampedButton // this.gradientLinearClampedButton.Name = "gradientLinearClampedButton"; this.gradientLinearClampedButton.Click += GradientTypeButtonClicked; this.gradientLinearClampedButton.Tag = GradientType.LinearClamped; // // gradientLinearReflectedButton // this.gradientLinearReflectedButton.Name = "gradientLinearReflectedButton"; this.gradientLinearReflectedButton.Click += GradientTypeButtonClicked; this.gradientLinearReflectedButton.Tag = GradientType.LinearReflected; // // gradientLinearDiamondButton // this.gradientLinearDiamondButton.Name = "gradientLinearDiamondButton"; this.gradientLinearDiamondButton.Click += GradientTypeButtonClicked; this.gradientLinearDiamondButton.Tag = GradientType.LinearDiamond; // // gradientRadialButton // this.gradientRadialButton.Name = "gradientRadialButton"; this.gradientRadialButton.Click += GradientTypeButtonClicked; this.gradientRadialButton.Tag = GradientType.Radial; // // gradientConicalButton // this.gradientConicalButton.Name = "gradientConicalButton"; this.gradientConicalButton.Click += GradientTypeButtonClicked; this.gradientConicalButton.Tag = GradientType.Conical; // // gradientSeparator2 // this.gradientSeparator2.Name = "gradientSeparator2"; // // gradientChannelsSplitButton // this.gradientChannelsSplitButton.Name = "gradientChannelsSplitButton"; this.gradientChannelsSplitButton.DropDownOpening += new EventHandler(GradientChannelsSplitButton_DropDownOpening); this.gradientChannelsSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.gradientChannelsSplitButton.DropDownItems.Clear(); }; this.gradientChannelsSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(gradientChannelsSplitButton)"); GradientInfo = new GradientInfo(GradientInfo.GradientType, !GradientInfo.AlphaOnly); }; // // penSeparator // this.penSeparator.Name = "penSeparator"; // // penSizeLabel // this.penSizeLabel.Name = "brushSizeLabel"; // // penSizeDecButton // this.penSizeDecButton.Name = "penSizeDecButton"; this.penSizeDecButton.Click += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(penSizeDecButton)"); float amount = -1.0f; if ((Control.ModifierKeys & Keys.Control) != 0) { amount *= 5.0f; } AddToPenSize(amount); }; // // penSizeComboBox // this.penSizeComboBox.Name = "penSizeComboBox"; this.penSizeComboBox.Validating += new CancelEventHandler(this.BrushSizeComboBox_Validating); this.penSizeComboBox.TextChanged += new EventHandler(this.SizeComboBox_TextChanged); this.penSizeComboBox.AutoSize = false; this.penSizeComboBox.Width = 44; // // penSizeIncButton // this.penSizeIncButton.Name = "penSizeIncButton"; this.penSizeIncButton.Click += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(penSizeIncButton)"); float amount = 1.0f; if ((Control.ModifierKeys & Keys.Control) != 0) { amount *= 5.0f; } AddToPenSize(amount); }; // // penStartCapLabel // this.penStyleLabel.Name = "penStartCapLabel"; // // penStartCapSplitButton // this.penStartCapSplitButton.Name = "penStartCapSplitButton"; this.penStartCapSplitButton.DropDownOpening += PenCapSplitButton_DropDownOpening; this.penStartCapSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.penStartCapSplitButton.DropDownItems.Clear(); }; this.penStartCapSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(penStartCapSplitButton)"); CyclePenStartCap(); }; // // penDashStyleSplitButton // this.penDashStyleSplitButton.Name = "penDashStyleSplitButton"; this.penDashStyleSplitButton.ImageScaling = ToolStripItemImageScaling.None; this.penDashStyleSplitButton.DropDownOpening += PenDashStyleButton_DropDownOpening; this.penDashStyleSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.penDashStyleSplitButton.DropDownItems.Clear(); }; this.penDashStyleSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(penDashStyleSplitButton)"); CyclePenDashStyle(); }; // // penEndCapSplitButton // this.penEndCapSplitButton.Name = "penEndCapSplitButton"; this.penEndCapSplitButton.DropDownOpening += PenCapSplitButton_DropDownOpening; this.penEndCapSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.penEndCapSplitButton.DropDownItems.Clear(); }; this.penEndCapSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(penEndCapSplitButton)"); CyclePenEndCap(); }; // // antiAliasingSplitButton // this.antiAliasingSplitButton.Name = "antiAliasingSplitButton"; this.antiAliasingSplitButton.DisplayStyle = ToolStripItemDisplayStyle.Image; this.antiAliasingSplitButton.DropDownOpening += AntiAliasingSplitButton_DropDownOpening; this.antiAliasingSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.antiAliasingSplitButton.DropDownItems.Clear(); }; this.antiAliasingSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(antiAliasingSplitButton)"); AntiAliasing = !AntiAliasing; }; // // alphaBlendingSplitButton // this.alphaBlendingSplitButton.Name = "alphaBlendingSplitButton"; this.alphaBlendingSplitButton.DisplayStyle = ToolStripItemDisplayStyle.Image; this.alphaBlendingSplitButton.DropDownOpening += new EventHandler(AlphaBlendingSplitButton_DropDownOpening); this.alphaBlendingSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.alphaBlendingSplitButton.DropDownItems.Clear(); }; this.alphaBlendingSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(alphaBlendingSplitButton)"); AlphaBlending = !AlphaBlending; }; // // toleranceLabel // this.toleranceLabel.Name = "toleranceLabel"; // // toleranceSlider // this.toleranceSlider.Name = "toleranceSlider"; this.toleranceSlider.ToleranceChanged += new EventHandler(ToleranceSlider_ToleranceChanged); this.toleranceSlider.Size = new Size(150, 16); // // toleranceSliderStrip // this.toleranceSliderStrip.Name = "toleranceSliderStrip"; this.toleranceSliderStrip.AutoSize = false; // // fontLabel // this.fontLabel.Name = "fontLabel"; // // fontFamilyComboBox // this.fontFamilyComboBox.Name = "fontComboBox"; this.fontFamilyComboBox.DropDownWidth = 240; this.fontFamilyComboBox.MaxDropDownItems = 12; this.fontFamilyComboBox.Sorted = true; this.fontFamilyComboBox.GotFocus += new EventHandler(FontFamilyComboBox_GotFocus); this.fontFamilyComboBox.Items.Add(arialName); this.fontFamilyComboBox.SelectedItem = arialName; this.fontFamilyComboBox.SelectedIndexChanged += FontFamilyComboBox_SelectedIndexChanged; this.fontFamilyComboBox.DropDownStyle = ComboBoxStyle.DropDownList; // // fontFamilyComboBox.ComboBox // this.fontFamilyComboBox.ComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.fontFamilyComboBox.ComboBox.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.FontFamilyComboBox_MeasureItem); this.fontFamilyComboBox.ComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.FontFamilyComboBox_DrawItem); // // fontSizeComboBox // this.fontSizeComboBox.Name = "fontSizeComboBox"; this.fontSizeComboBox.AutoSize = false; this.fontSizeComboBox.TextChanged += new EventHandler(FontSizeComboBox_TextChanged); this.fontSizeComboBox.Validating += new CancelEventHandler(FontSizeComboBox_Validating); this.fontSizeComboBox.Text = initialFontSize.ToString(); this.fontSizeComboBox.Width = 44; // // fontSmoothingComboBox // this.fontSmoothingComboBox.Name = "smoothingComboBOx"; this.fontSmoothingComboBox.AutoSize = false; this.fontSmoothingComboBox.Sorted = false; this.fontSmoothingComboBox.Width = 70; this.fontSmoothingComboBox.DropDownStyle = ComboBoxStyle.DropDownList; this.fontSmoothingComboBox.SelectedIndexChanged += new EventHandler(SmoothingComboBox_SelectedIndexChanged); // // fontBoldButton // this.fontBoldButton.Name = "boldButton"; // // fontItalicsButton // this.fontItalicsButton.Name = "italicsButton"; // // fontUnderlineButton // this.fontUnderlineButton.Name = "underlineButton"; // // fontAlignLeftButton // this.fontAlignLeftButton.Name = "alignLeftButton"; // // fontAlignCenterButton // this.fontAlignCenterButton.Name = "alignCenterButton"; // // fontAlignRightButton // this.fontAlignRightButton.Name = "alignRightButton"; // // resamplingSeparator // this.resamplingSeparator.Name = "resamplingSeparator"; // // resamplingLabel // this.resamplingLabel.Name = "resamplingLabel"; // // resamplingComboBox // this.resamplingComboBox.Name = "resamplingComboBox"; this.resamplingComboBox.AutoSize = true; this.resamplingComboBox.DropDownStyle = ComboBoxStyle.DropDownList; this.resamplingComboBox.Sorted = false; this.resamplingComboBox.Width = 100; this.resamplingComboBox.DropDownWidth = 100; this.resamplingComboBox.SelectedIndexChanged += new EventHandler(ResamplingComboBox_SelectedIndexChanged); // // colorPickerSeparator // this.colorPickerSeparator.Name = "colorPickerSeparator"; // // colorPickerLabel // this.colorPickerLabel.Name = "colorPickerLabel"; // // colorPickerComboBox // this.colorPickerComboBox.Name = "colorPickerComboBox"; this.colorPickerComboBox.AutoSize = true; this.colorPickerComboBox.DropDownStyle = ComboBoxStyle.DropDownList; this.colorPickerComboBox.Width = 200; this.colorPickerComboBox.DropDownWidth = 200; this.colorPickerComboBox.Sorted = false; this.colorPickerComboBox.SelectedIndexChanged += new EventHandler(ColorPickerComboBox_SelectedIndexChanged); // // selectionCombineModeSeparator // this.selectionCombineModeSeparator.Name = "selectionCombineModeSeparator"; // // selectionCombineModeLabel // this.selectionCombineModeLabel.Name = "selectionCombineModeLabel"; // // selectionCombineModeSplitButton // this.selectionCombineModeSplitButton.Name = "selectionCombineModeSplitButton"; this.selectionCombineModeSplitButton.DisplayStyle = ToolStripItemDisplayStyle.Image; this.selectionCombineModeSplitButton.DropDownOpening += new EventHandler(SelectionCombineModeSplitButton_DropDownOpening); this.selectionCombineModeSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.selectionCombineModeSplitButton.DropDownItems.Clear(); }; this.selectionCombineModeSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(selectionCombineModeSplitButton)"); this.SelectionCombineMode = CycleSelectionCombineMode(this.SelectionCombineMode); }; // // floodModeSeparator // this.floodModeSeparator.Name = "floodModeSeparator"; // // floodModeLabel // this.floodModeLabel.Name = "floodModeLabel"; // // floodModeSplitButton // this.floodModeSplitButton.Name = "floodModeSplitButton"; this.floodModeSplitButton.DisplayStyle = ToolStripItemDisplayStyle.Image; this.floodModeSplitButton.DropDownOpening += new EventHandler(FloodModeSplitButton_DropDownOpening); this.floodModeSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.floodModeSplitButton.DropDownItems.Clear(); }; this.floodModeSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(floodModeSplitButton)"); this.FloodMode = CycleFloodMode(this.FloodMode); }; // // selectionDrawModeSeparator // this.selectionDrawModeSeparator.Name = "selectionDrawModeSeparator"; // // selectionDrawModeModeLabel // this.selectionDrawModeModeLabel.Name = "selectionDrawModeModeLabel"; // // selectionDrawModeSplitButton // this.selectionDrawModeSplitButton.Name = "selectionDrawModeSplitButton"; this.selectionDrawModeSplitButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; this.selectionDrawModeSplitButton.DropDownOpening += new EventHandler(SelectionDrawModeSplitButton_DropDownOpening); this.selectionDrawModeSplitButton.DropDownClosed += delegate(object sender, EventArgs e) { this.selectionDrawModeSplitButton.DropDownItems.Clear(); }; this.selectionDrawModeSplitButton.ButtonClick += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(selectionDrawModeSplitButton)"); SelectionDrawMode newSDM = CycleSelectionDrawMode(this.SelectionDrawModeInfo.DrawMode); this.SelectionDrawModeInfo = this.SelectionDrawModeInfo.CloneWithNewDrawMode(newSDM); }; // // selectionDrawModeWidthLabel // this.selectionDrawModeWidthLabel.Name = "selectionDrawModeWidthLabel"; // // selectionDrawModeWidthTextBox // this.selectionDrawModeWidthTextBox.Name = "selectionDrawModeWidthTextBox"; this.selectionDrawModeWidthTextBox.TextBox.Width = 50; this.selectionDrawModeWidthTextBox.TextBoxTextAlign = HorizontalAlignment.Right; this.selectionDrawModeWidthTextBox.Enter += delegate(object sender, EventArgs e) { this.selectionDrawModeWidthTextBox.TextBox.Select(0, this.selectionDrawModeWidthTextBox.TextBox.Text.Length); }; this.selectionDrawModeWidthTextBox.Leave += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(selectionDrawModeWidthTextBox.Leave)"); double newWidth; if (double.TryParse(this.selectionDrawModeWidthTextBox.Text, out newWidth)) { this.SelectionDrawModeInfo = this.selectionDrawModeInfo.CloneWithNewWidth(newWidth); } else { this.selectionDrawModeWidthTextBox.Text = this.selectionDrawModeInfo.Width.ToString(); } }; // // selectionDrawModeSwapButton // this.selectionDrawModeSwapButton.Name = "selectionDrawModeSwapButton"; this.selectionDrawModeSwapButton.Click += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(selectionDrawModeSwapButton)"); SelectionDrawModeInfo oldSDMI = this.SelectionDrawModeInfo; SelectionDrawModeInfo newSDMI = new SelectionDrawModeInfo(oldSDMI.DrawMode, oldSDMI.Height, oldSDMI.Width, oldSDMI.Units); this.SelectionDrawModeInfo = newSDMI; }; // // selectionDrawModeHeightLabel // this.selectionDrawModeHeightLabel.Name = "selectionDrawModeHeightLabel"; // // selectionDrawModeHeightTextBox // this.selectionDrawModeHeightTextBox.Name = "selectionDrawModeHeightTextBox"; this.selectionDrawModeHeightTextBox.TextBox.Width = 50; this.selectionDrawModeHeightTextBox.TextBoxTextAlign = HorizontalAlignment.Right; this.selectionDrawModeHeightTextBox.Enter += delegate(object sender, EventArgs e) { this.selectionDrawModeHeightTextBox.TextBox.Select(0, this.selectionDrawModeHeightTextBox.TextBox.Text.Length); }; this.selectionDrawModeHeightTextBox.Leave += delegate(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(selectionDrawModeHeightTextBox.Leave)"); double newHeight; if (double.TryParse(this.selectionDrawModeHeightTextBox.Text, out newHeight)) { this.SelectionDrawModeInfo = this.selectionDrawModeInfo.CloneWithNewHeight(newHeight); } else { this.selectionDrawModeHeightTextBox.Text = this.selectionDrawModeInfo.Height.ToString(); } }; // // selectionDrawModeUnits // this.selectionDrawModeUnits.Name = "selectionDrawModeUnits"; this.selectionDrawModeUnits.UnitsDisplayType = UnitsDisplayType.Plural; this.selectionDrawModeUnits.LowercaseStrings = true; this.selectionDrawModeUnits.Size = new Size(90, this.selectionDrawModeUnits.Height); // // DrawConfigStrip // this.AutoSize = true; this.Items.AddRange( new ToolStripItem[] { this.selectionCombineModeSeparator, this.selectionCombineModeLabel, this.selectionCombineModeSplitButton, this.selectionDrawModeSeparator, this.selectionDrawModeModeLabel, this.selectionDrawModeSplitButton, this.selectionDrawModeWidthLabel, this.selectionDrawModeWidthTextBox, this.selectionDrawModeSwapButton, this.selectionDrawModeHeightLabel, this.selectionDrawModeHeightTextBox, this.selectionDrawModeUnits, this.floodModeSeparator, this.floodModeLabel, this.floodModeSplitButton, this.resamplingSeparator, this.resamplingLabel, this.resamplingComboBox, this.colorPickerSeparator, this.colorPickerLabel, this.colorPickerComboBox, this.fontSeparator, this.fontLabel, this.fontFamilyComboBox, this.fontSizeComboBox, this.fontSmoothingComboBox, this.fontStyleSeparator, this.fontBoldButton, this.fontItalicsButton, this.fontUnderlineButton, this.fontAlignSeparator, this.fontAlignLeftButton, this.fontAlignCenterButton, this.fontAlignRightButton, this.shapeSeparator, this.shapeButton, this.gradientSeparator1, this.gradientLinearClampedButton, this.gradientLinearReflectedButton, this.gradientLinearDiamondButton, this.gradientRadialButton, this.gradientConicalButton, this.gradientSeparator2, this.gradientChannelsSplitButton, this.penSeparator, this.penSizeLabel, this.penSizeDecButton, this.penSizeComboBox, this.penSizeIncButton, this.penStyleLabel, this.penStartCapSplitButton, this.penDashStyleSplitButton, this.penEndCapSplitButton, this.brushSeparator, this.brushStyleLabel, this.brushStyleComboBox, this.toleranceSeparator, this.toleranceLabel, this.toleranceSliderStrip, this.blendingSeparator, this.antiAliasingSplitButton, this.alphaBlendingSplitButton }); this.ResumeLayout(false); }
private void GradientTypeButtonClicked(object sender, EventArgs e) { Tracing.LogFeature("ToolConfigStrip(GradientTypeButtonClicked)"); GradientType newType = (GradientType)((ToolStripButton)sender).Tag; GradientInfo = new GradientInfo(newType, GradientInfo.AlphaOnly); }
public void LoadFrom(AppEnvironment appEnvironment) { this.textAlignment = appEnvironment.textAlignment; this.gradientInfo = appEnvironment.gradientInfo.Clone(); this.fontSmoothing = appEnvironment.fontSmoothing; this.fontInfo = appEnvironment.fontInfo.Clone(); this.penInfo = appEnvironment.penInfo.Clone(); this.brushInfo = appEnvironment.brushInfo.Clone(); this.primaryColor = appEnvironment.primaryColor; this.secondaryColor = appEnvironment.secondaryColor; this.alphaBlending = appEnvironment.alphaBlending; this.shapeDrawType = appEnvironment.shapeDrawType; this.antiAliasing = appEnvironment.antiAliasing; this.colorPickerClickBehavior = appEnvironment.colorPickerClickBehavior; this.resamplingAlgorithm = appEnvironment.resamplingAlgorithm; this.tolerance = appEnvironment.tolerance; this.selectionCombineMode = appEnvironment.selectionCombineMode; this.floodMode = appEnvironment.floodMode; this.selectionDrawModeInfo = appEnvironment.selectionDrawModeInfo.Clone(); PerformAllChanged(); }