mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-06 05:05:42 +13:00
Added "Show FPS" to options sub menu
This commit is contained in:
parent
7eaac502c7
commit
5aef55152b
3 changed files with 21 additions and 13 deletions
|
@ -356,14 +356,14 @@ private void DrawMenuTip(Graphics g)
|
||||||
{
|
{
|
||||||
// TODO: Translate
|
// TODO: Translate
|
||||||
string tipText = "Tip: Right click to open options menu";
|
string tipText = "Tip: Right click to open options menu";
|
||||||
Size textSize = g.MeasureString(tipText, textFont).ToSize();
|
Size textSize = g.MeasureString(tipText, infoFontMedium).ToSize();
|
||||||
int offset = 10;
|
int offset = 10;
|
||||||
int padding = 3;
|
int padding = 3;
|
||||||
int rectWidth = textSize.Width + padding * 2;
|
int rectWidth = textSize.Width + padding * 2;
|
||||||
int rectHeight = textSize.Height + padding * 2;
|
int rectHeight = textSize.Height + padding * 2;
|
||||||
Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
|
Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
|
||||||
Rectangle textRectangle = new Rectangle(primaryScreenBounds.X + (primaryScreenBounds.Width / 2) - (rectWidth / 2), primaryScreenBounds.Y + offset, rectWidth, rectHeight);
|
Rectangle textRectangle = new Rectangle(primaryScreenBounds.X + (primaryScreenBounds.Width / 2) - (rectWidth / 2), primaryScreenBounds.Y + offset, rectWidth, rectHeight);
|
||||||
DrawInfoText(g, tipText, textRectangle, textFont, padding);
|
DrawInfoText(g, tipText, textRectangle, infoFontMedium, padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void WriteTips(StringBuilder sb)
|
protected virtual void WriteTips(StringBuilder sb)
|
||||||
|
|
|
@ -53,7 +53,7 @@ public abstract class SurfaceForm : Form
|
||||||
protected GraphicsPath regionFillPath, regionDrawPath;
|
protected GraphicsPath regionFillPath, regionDrawPath;
|
||||||
protected Pen borderPen, borderDotPen, textBackgroundPenWhite, textBackgroundPenBlack, markerPen;
|
protected Pen borderPen, borderDotPen, textBackgroundPenWhite, textBackgroundPenBlack, markerPen;
|
||||||
protected Brush nodeBackgroundBrush, textBackgroundBrush;
|
protected Brush nodeBackgroundBrush, textBackgroundBrush;
|
||||||
protected Font textFont, infoFont;
|
protected Font infoFont, infoFontMedium, infoFontBig;
|
||||||
protected Stopwatch timerStart, timerFPS;
|
protected Stopwatch timerStart, timerFPS;
|
||||||
protected int frameCount;
|
protected int frameCount;
|
||||||
protected bool isKeyAllowed;
|
protected bool isKeyAllowed;
|
||||||
|
@ -84,8 +84,9 @@ public SurfaceForm()
|
||||||
borderDotPen = new Pen(Color.White);
|
borderDotPen = new Pen(Color.White);
|
||||||
borderDotPen.DashPattern = new float[] { 5, 5 };
|
borderDotPen.DashPattern = new float[] { 5, 5 };
|
||||||
nodeBackgroundBrush = new SolidBrush(Color.White);
|
nodeBackgroundBrush = new SolidBrush(Color.White);
|
||||||
textFont = new Font("Verdana", 12);
|
|
||||||
infoFont = new Font("Verdana", 9);
|
infoFont = new Font("Verdana", 9);
|
||||||
|
infoFontMedium = new Font("Verdana", 12);
|
||||||
|
infoFontBig = new Font("Verdana", 16, FontStyle.Bold);
|
||||||
textBackgroundBrush = new SolidBrush(Color.FromArgb(75, Color.Black));
|
textBackgroundBrush = new SolidBrush(Color.FromArgb(75, Color.Black));
|
||||||
textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White));
|
textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White));
|
||||||
textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black));
|
textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black));
|
||||||
|
@ -249,7 +250,7 @@ protected override void OnPaint(PaintEventArgs e)
|
||||||
if (Config.ShowFPS)
|
if (Config.ShowFPS)
|
||||||
{
|
{
|
||||||
CheckFPS();
|
CheckFPS();
|
||||||
DrawInfo(g);
|
DrawFPS(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pause)
|
if (!pause)
|
||||||
|
@ -397,13 +398,13 @@ private void CheckFPS()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawInfo(Graphics g)
|
private void DrawFPS(Graphics g)
|
||||||
{
|
{
|
||||||
string text = "FPS: " + FPS;
|
string text = "FPS: " + FPS;
|
||||||
|
|
||||||
SizeF textSize = g.MeasureString(text, textFont);
|
SizeF textSize = g.MeasureString(text, infoFontBig);
|
||||||
|
|
||||||
int offset = 30;
|
int offset = 10;
|
||||||
|
|
||||||
Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
|
Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
|
||||||
Rectangle textRectangle = new Rectangle(primaryScreenBounds.X + offset, primaryScreenBounds.Y + offset, (int)textSize.Width, (int)textSize.Height);
|
Rectangle textRectangle = new Rectangle(primaryScreenBounds.X + offset, primaryScreenBounds.Y + offset, (int)textSize.Width, (int)textSize.Height);
|
||||||
|
@ -413,7 +414,7 @@ private void DrawInfo(Graphics g)
|
||||||
textRectangle.Y = primaryScreenBounds.Height - textRectangle.Height - offset;
|
textRectangle.Y = primaryScreenBounds.Height - textRectangle.Height - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageHelpers.DrawTextWithOutline(g, text, textRectangle.Location, textFont, Color.White, Color.Black);
|
ImageHelpers.DrawTextWithOutline(g, text, textRectangle.Location, infoFontBig, Color.White, Color.Black);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Rectangle CalculateAreaFromNodes()
|
protected Rectangle CalculateAreaFromNodes()
|
||||||
|
@ -470,8 +471,9 @@ protected override void Dispose(bool disposing)
|
||||||
if (borderPen != null) borderPen.Dispose();
|
if (borderPen != null) borderPen.Dispose();
|
||||||
if (borderDotPen != null) borderDotPen.Dispose();
|
if (borderDotPen != null) borderDotPen.Dispose();
|
||||||
if (nodeBackgroundBrush != null) nodeBackgroundBrush.Dispose();
|
if (nodeBackgroundBrush != null) nodeBackgroundBrush.Dispose();
|
||||||
if (textFont != null) textFont.Dispose();
|
|
||||||
if (infoFont != null) infoFont.Dispose();
|
if (infoFont != null) infoFont.Dispose();
|
||||||
|
if (infoFontMedium != null) infoFontMedium.Dispose();
|
||||||
|
if (infoFontBig != null) infoFontBig.Dispose();
|
||||||
if (textBackgroundBrush != null) textBackgroundBrush.Dispose();
|
if (textBackgroundBrush != null) textBackgroundBrush.Dispose();
|
||||||
if (textBackgroundPenWhite != null) textBackgroundPenWhite.Dispose();
|
if (textBackgroundPenWhite != null) textBackgroundPenWhite.Dispose();
|
||||||
if (textBackgroundPenBlack != null) textBackgroundPenBlack.Dispose();
|
if (textBackgroundPenBlack != null) textBackgroundPenBlack.Dispose();
|
||||||
|
|
|
@ -362,13 +362,13 @@ private void CreateContextMenu()
|
||||||
tsmiQuickCrop.Click += (sender, e) => config.QuickCrop = !tsmiQuickCrop.Checked;
|
tsmiQuickCrop.Click += (sender, e) => config.QuickCrop = !tsmiQuickCrop.Checked;
|
||||||
tsmiOptions.DropDownItems.Add(tsmiQuickCrop);
|
tsmiOptions.DropDownItems.Add(tsmiQuickCrop);
|
||||||
|
|
||||||
ToolStripMenuItem tsmiShowInfo = new ToolStripMenuItem("Position and size info");
|
ToolStripMenuItem tsmiShowInfo = new ToolStripMenuItem("Show position and size info");
|
||||||
tsmiShowInfo.Checked = config.ShowInfo;
|
tsmiShowInfo.Checked = config.ShowInfo;
|
||||||
tsmiShowInfo.CheckOnClick = true;
|
tsmiShowInfo.CheckOnClick = true;
|
||||||
tsmiShowInfo.Click += (sender, e) => config.ShowInfo = tsmiShowInfo.Checked;
|
tsmiShowInfo.Click += (sender, e) => config.ShowInfo = tsmiShowInfo.Checked;
|
||||||
tsmiOptions.DropDownItems.Add(tsmiShowInfo);
|
tsmiOptions.DropDownItems.Add(tsmiShowInfo);
|
||||||
|
|
||||||
ToolStripMenuItem tsmiShowMagnifier = new ToolStripMenuItem("Magnifier");
|
ToolStripMenuItem tsmiShowMagnifier = new ToolStripMenuItem("Show magnifier");
|
||||||
tsmiShowMagnifier.Checked = config.ShowMagnifier;
|
tsmiShowMagnifier.Checked = config.ShowMagnifier;
|
||||||
tsmiShowMagnifier.CheckOnClick = true;
|
tsmiShowMagnifier.CheckOnClick = true;
|
||||||
tsmiShowMagnifier.Click += (sender, e) => config.ShowMagnifier = tsmiShowMagnifier.Checked;
|
tsmiShowMagnifier.Click += (sender, e) => config.ShowMagnifier = tsmiShowMagnifier.Checked;
|
||||||
|
@ -397,12 +397,18 @@ private void CreateContextMenu()
|
||||||
tslnudMagnifierPixelSize.LabeledNumericUpDownControl.ValueChanged = (sender, e) => config.MagnifierPixelSize = (int)tslnudMagnifierPixelSize.LabeledNumericUpDownControl.Value;
|
tslnudMagnifierPixelSize.LabeledNumericUpDownControl.ValueChanged = (sender, e) => config.MagnifierPixelSize = (int)tslnudMagnifierPixelSize.LabeledNumericUpDownControl.Value;
|
||||||
tsmiOptions.DropDownItems.Add(tslnudMagnifierPixelSize);
|
tsmiOptions.DropDownItems.Add(tslnudMagnifierPixelSize);
|
||||||
|
|
||||||
ToolStripMenuItem tsmiShowCrosshair = new ToolStripMenuItem("Screen wide crosshair");
|
ToolStripMenuItem tsmiShowCrosshair = new ToolStripMenuItem("Show screen wide crosshair");
|
||||||
tsmiShowCrosshair.Checked = config.ShowCrosshair;
|
tsmiShowCrosshair.Checked = config.ShowCrosshair;
|
||||||
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);
|
||||||
|
|
||||||
|
ToolStripMenuItem tsmiShowFPS = new ToolStripMenuItem("Show FPS");
|
||||||
|
tsmiShowFPS.Checked = config.ShowFPS;
|
||||||
|
tsmiShowFPS.CheckOnClick = true;
|
||||||
|
tsmiShowFPS.Click += (sender, e) => config.ShowFPS = tsmiShowFPS.Checked;
|
||||||
|
tsmiOptions.DropDownItems.Add(tsmiShowFPS);
|
||||||
|
|
||||||
CurrentShapeTypeChanged += shapeType =>
|
CurrentShapeTypeChanged += shapeType =>
|
||||||
{
|
{
|
||||||
foreach (ToolStripMenuItem tsmi in cmsContextMenu.Items.OfType<ToolStripMenuItem>().Where(x => x.Tag is ShapeType))
|
foreach (ToolStripMenuItem tsmi in cmsContextMenu.Items.OfType<ToolStripMenuItem>().Where(x => x.Tag is ShapeType))
|
||||||
|
|
Loading…
Reference in a new issue