mirror of
https://github.com/ShareX/ShareX.git
synced 2024-08-18 19:51:39 +12:00
Only show options which can be used by current shape type
This commit is contained in:
parent
cd2cbbabc2
commit
a57cf2b26e
1 changed files with 74 additions and 21 deletions
|
@ -200,10 +200,11 @@ private void CreateContextMenu()
|
||||||
cmsContextMenu.Items.Add(tsmiShapeType);
|
cmsContextMenu.Items.Add(tsmiShapeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsContextMenu.Items.Add(new ToolStripSeparator());
|
ToolStripSeparator tssShapeOptions = new ToolStripSeparator();
|
||||||
|
cmsContextMenu.Items.Add(tssShapeOptions);
|
||||||
|
|
||||||
ToolStripMenuItem tsmiChangeBorderColor = new ToolStripMenuItem("Border color...");
|
ToolStripMenuItem tsmiBorderColor = new ToolStripMenuItem("Border color...");
|
||||||
tsmiChangeBorderColor.Click += (sender, e) =>
|
tsmiBorderColor.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
surface.Pause();
|
surface.Pause();
|
||||||
|
|
||||||
|
@ -212,16 +213,16 @@ private void CreateContextMenu()
|
||||||
if (dialogColor.ShowDialog() == DialogResult.OK)
|
if (dialogColor.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
config.ShapeBorderColor = dialogColor.NewColor;
|
config.ShapeBorderColor = dialogColor.NewColor;
|
||||||
if (tsmiChangeBorderColor.Image != null) tsmiChangeBorderColor.Image.Dispose();
|
if (tsmiBorderColor.Image != null) tsmiBorderColor.Image.Dispose();
|
||||||
tsmiChangeBorderColor.Image = ImageHelpers.CreateColorPickerIcon(config.ShapeBorderColor, new Rectangle(0, 0, 16, 16));
|
tsmiBorderColor.Image = ImageHelpers.CreateColorPickerIcon(config.ShapeBorderColor, new Rectangle(0, 0, 16, 16));
|
||||||
UpdateCurrentShape();
|
UpdateCurrentShape();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surface.Resume();
|
surface.Resume();
|
||||||
};
|
};
|
||||||
tsmiChangeBorderColor.Image = ImageHelpers.CreateColorPickerIcon(config.ShapeBorderColor, new Rectangle(0, 0, 16, 16));
|
tsmiBorderColor.Image = ImageHelpers.CreateColorPickerIcon(config.ShapeBorderColor, new Rectangle(0, 0, 16, 16));
|
||||||
cmsContextMenu.Items.Add(tsmiChangeBorderColor);
|
cmsContextMenu.Items.Add(tsmiBorderColor);
|
||||||
|
|
||||||
ToolStripLabeledNumericUpDown tslnudBorderSize = new ToolStripLabeledNumericUpDown();
|
ToolStripLabeledNumericUpDown tslnudBorderSize = new ToolStripLabeledNumericUpDown();
|
||||||
tslnudBorderSize.LabeledNumericUpDownControl.Text = "Border size:";
|
tslnudBorderSize.LabeledNumericUpDownControl.Text = "Border size:";
|
||||||
|
@ -235,8 +236,8 @@ private void CreateContextMenu()
|
||||||
};
|
};
|
||||||
cmsContextMenu.Items.Add(tslnudBorderSize);
|
cmsContextMenu.Items.Add(tslnudBorderSize);
|
||||||
|
|
||||||
ToolStripMenuItem tsmiChangeFillColor = new ToolStripMenuItem("Fill color...");
|
ToolStripMenuItem tsmiFillColor = new ToolStripMenuItem("Fill color...");
|
||||||
tsmiChangeFillColor.Click += (sender, e) =>
|
tsmiFillColor.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
surface.Pause();
|
surface.Pause();
|
||||||
|
|
||||||
|
@ -245,16 +246,16 @@ private void CreateContextMenu()
|
||||||
if (dialogColor.ShowDialog() == DialogResult.OK)
|
if (dialogColor.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
config.ShapeFillColor = dialogColor.NewColor;
|
config.ShapeFillColor = dialogColor.NewColor;
|
||||||
if (tsmiChangeFillColor.Image != null) tsmiChangeFillColor.Image.Dispose();
|
if (tsmiFillColor.Image != null) tsmiFillColor.Image.Dispose();
|
||||||
tsmiChangeFillColor.Image = ImageHelpers.CreateColorPickerIcon(config.ShapeFillColor, new Rectangle(0, 0, 16, 16));
|
tsmiFillColor.Image = ImageHelpers.CreateColorPickerIcon(config.ShapeFillColor, new Rectangle(0, 0, 16, 16));
|
||||||
UpdateCurrentShape();
|
UpdateCurrentShape();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surface.Resume();
|
surface.Resume();
|
||||||
};
|
};
|
||||||
tsmiChangeFillColor.Image = ImageHelpers.CreateColorPickerIcon(config.ShapeFillColor, new Rectangle(0, 0, 16, 16));
|
tsmiFillColor.Image = ImageHelpers.CreateColorPickerIcon(config.ShapeFillColor, new Rectangle(0, 0, 16, 16));
|
||||||
cmsContextMenu.Items.Add(tsmiChangeFillColor);
|
cmsContextMenu.Items.Add(tsmiFillColor);
|
||||||
|
|
||||||
ToolStripLabeledNumericUpDown tslnudRoundedRectangleRadius = new ToolStripLabeledNumericUpDown();
|
ToolStripLabeledNumericUpDown tslnudRoundedRectangleRadius = new ToolStripLabeledNumericUpDown();
|
||||||
tslnudRoundedRectangleRadius.LabeledNumericUpDownControl.Text = "Corner radius:";
|
tslnudRoundedRectangleRadius.LabeledNumericUpDownControl.Text = "Corner radius:";
|
||||||
|
@ -281,17 +282,17 @@ private void CreateContextMenu()
|
||||||
};
|
};
|
||||||
cmsContextMenu.Items.Add(tslnudBlurRadius);
|
cmsContextMenu.Items.Add(tslnudBlurRadius);
|
||||||
|
|
||||||
ToolStripLabeledNumericUpDown tslnudPixelSize = new ToolStripLabeledNumericUpDown();
|
ToolStripLabeledNumericUpDown tslnudPixelateSize = new ToolStripLabeledNumericUpDown();
|
||||||
tslnudPixelSize.LabeledNumericUpDownControl.Text = "Pixel size:";
|
tslnudPixelateSize.LabeledNumericUpDownControl.Text = "Pixel size:";
|
||||||
tslnudPixelSize.LabeledNumericUpDownControl.Minimum = 2;
|
tslnudPixelateSize.LabeledNumericUpDownControl.Minimum = 2;
|
||||||
tslnudPixelSize.LabeledNumericUpDownControl.Maximum = 100;
|
tslnudPixelateSize.LabeledNumericUpDownControl.Maximum = 100;
|
||||||
tslnudPixelSize.LabeledNumericUpDownControl.Value = config.ShapeRoundedRectangleRadius;
|
tslnudPixelateSize.LabeledNumericUpDownControl.Value = config.ShapeRoundedRectangleRadius;
|
||||||
tslnudPixelSize.LabeledNumericUpDownControl.ValueChanged = (sender, e) =>
|
tslnudPixelateSize.LabeledNumericUpDownControl.ValueChanged = (sender, e) =>
|
||||||
{
|
{
|
||||||
config.ShapePixelateSize = (int)tslnudPixelSize.LabeledNumericUpDownControl.Value;
|
config.ShapePixelateSize = (int)tslnudPixelateSize.LabeledNumericUpDownControl.Value;
|
||||||
UpdateCurrentShape();
|
UpdateCurrentShape();
|
||||||
};
|
};
|
||||||
cmsContextMenu.Items.Add(tslnudPixelSize);
|
cmsContextMenu.Items.Add(tslnudPixelateSize);
|
||||||
|
|
||||||
cmsContextMenu.Items.Add(new ToolStripSeparator());
|
cmsContextMenu.Items.Add(new ToolStripSeparator());
|
||||||
|
|
||||||
|
@ -367,6 +368,58 @@ private void CreateContextMenu()
|
||||||
tsmiShowCrosshair.CheckOnClick = true;
|
tsmiShowCrosshair.CheckOnClick = true;
|
||||||
tsmiShowCrosshair.Click += (sender, e) => config.ShowCrosshair = tsmiShowCrosshair.Checked;
|
tsmiShowCrosshair.Click += (sender, e) => config.ShowCrosshair = tsmiShowCrosshair.Checked;
|
||||||
tsmiOptions.DropDownItems.Add(tsmiShowCrosshair);
|
tsmiOptions.DropDownItems.Add(tsmiShowCrosshair);
|
||||||
|
|
||||||
|
cmsContextMenu.Opening += (sender, e) =>
|
||||||
|
{
|
||||||
|
switch (CurrentShapeType)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
tssShapeOptions.Visible = false;
|
||||||
|
break;
|
||||||
|
case ShapeType.RegionRoundedRectangle:
|
||||||
|
case ShapeType.DrawingRectangle:
|
||||||
|
case ShapeType.DrawingRoundedRectangle:
|
||||||
|
case ShapeType.DrawingEllipse:
|
||||||
|
case ShapeType.DrawingLine:
|
||||||
|
case ShapeType.DrawingArrow:
|
||||||
|
case ShapeType.DrawingBlur:
|
||||||
|
case ShapeType.DrawingPixelate:
|
||||||
|
tssShapeOptions.Visible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (CurrentShapeType)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
tsmiBorderColor.Visible = false;
|
||||||
|
tslnudBorderSize.Visible = false;
|
||||||
|
break;
|
||||||
|
case ShapeType.DrawingRectangle:
|
||||||
|
case ShapeType.DrawingRoundedRectangle:
|
||||||
|
case ShapeType.DrawingEllipse:
|
||||||
|
case ShapeType.DrawingLine:
|
||||||
|
case ShapeType.DrawingArrow:
|
||||||
|
tsmiBorderColor.Visible = true;
|
||||||
|
tslnudBorderSize.Visible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (CurrentShapeType)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
tsmiFillColor.Visible = false;
|
||||||
|
break;
|
||||||
|
case ShapeType.DrawingRectangle:
|
||||||
|
case ShapeType.DrawingRoundedRectangle:
|
||||||
|
case ShapeType.DrawingEllipse:
|
||||||
|
tsmiFillColor.Visible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tslnudRoundedRectangleRadius.Visible = CurrentShapeType == ShapeType.RegionRoundedRectangle || CurrentShapeType == ShapeType.DrawingRoundedRectangle;
|
||||||
|
tslnudBlurRadius.Visible = CurrentShapeType == ShapeType.DrawingBlur;
|
||||||
|
tslnudPixelateSize.Visible = CurrentShapeType == ShapeType.DrawingPixelate;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void surface_MouseDown(object sender, MouseEventArgs e)
|
private void surface_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue