mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-04 04:06:05 +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
|
||||
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 padding = 3;
|
||||
int rectWidth = textSize.Width + padding * 2;
|
||||
int rectHeight = textSize.Height + padding * 2;
|
||||
Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
|
||||
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)
|
||||
|
|
|
@ -53,7 +53,7 @@ public abstract class SurfaceForm : Form
|
|||
protected GraphicsPath regionFillPath, regionDrawPath;
|
||||
protected Pen borderPen, borderDotPen, textBackgroundPenWhite, textBackgroundPenBlack, markerPen;
|
||||
protected Brush nodeBackgroundBrush, textBackgroundBrush;
|
||||
protected Font textFont, infoFont;
|
||||
protected Font infoFont, infoFontMedium, infoFontBig;
|
||||
protected Stopwatch timerStart, timerFPS;
|
||||
protected int frameCount;
|
||||
protected bool isKeyAllowed;
|
||||
|
@ -84,8 +84,9 @@ public SurfaceForm()
|
|||
borderDotPen = new Pen(Color.White);
|
||||
borderDotPen.DashPattern = new float[] { 5, 5 };
|
||||
nodeBackgroundBrush = new SolidBrush(Color.White);
|
||||
textFont = new Font("Verdana", 12);
|
||||
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));
|
||||
textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White));
|
||||
textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black));
|
||||
|
@ -249,7 +250,7 @@ protected override void OnPaint(PaintEventArgs e)
|
|||
if (Config.ShowFPS)
|
||||
{
|
||||
CheckFPS();
|
||||
DrawInfo(g);
|
||||
DrawFPS(g);
|
||||
}
|
||||
|
||||
if (!pause)
|
||||
|
@ -397,13 +398,13 @@ private void CheckFPS()
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawInfo(Graphics g)
|
||||
private void DrawFPS(Graphics g)
|
||||
{
|
||||
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 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;
|
||||
}
|
||||
|
||||
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()
|
||||
|
@ -470,8 +471,9 @@ protected override void Dispose(bool disposing)
|
|||
if (borderPen != null) borderPen.Dispose();
|
||||
if (borderDotPen != null) borderDotPen.Dispose();
|
||||
if (nodeBackgroundBrush != null) nodeBackgroundBrush.Dispose();
|
||||
if (textFont != null) textFont.Dispose();
|
||||
if (infoFont != null) infoFont.Dispose();
|
||||
if (infoFontMedium != null) infoFontMedium.Dispose();
|
||||
if (infoFontBig != null) infoFontBig.Dispose();
|
||||
if (textBackgroundBrush != null) textBackgroundBrush.Dispose();
|
||||
if (textBackgroundPenWhite != null) textBackgroundPenWhite.Dispose();
|
||||
if (textBackgroundPenBlack != null) textBackgroundPenBlack.Dispose();
|
||||
|
|
|
@ -362,13 +362,13 @@ private void CreateContextMenu()
|
|||
tsmiQuickCrop.Click += (sender, e) => config.QuickCrop = !tsmiQuickCrop.Checked;
|
||||
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.CheckOnClick = true;
|
||||
tsmiShowInfo.Click += (sender, e) => config.ShowInfo = tsmiShowInfo.Checked;
|
||||
tsmiOptions.DropDownItems.Add(tsmiShowInfo);
|
||||
|
||||
ToolStripMenuItem tsmiShowMagnifier = new ToolStripMenuItem("Magnifier");
|
||||
ToolStripMenuItem tsmiShowMagnifier = new ToolStripMenuItem("Show magnifier");
|
||||
tsmiShowMagnifier.Checked = config.ShowMagnifier;
|
||||
tsmiShowMagnifier.CheckOnClick = true;
|
||||
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;
|
||||
tsmiOptions.DropDownItems.Add(tslnudMagnifierPixelSize);
|
||||
|
||||
ToolStripMenuItem tsmiShowCrosshair = new ToolStripMenuItem("Screen wide crosshair");
|
||||
ToolStripMenuItem tsmiShowCrosshair = new ToolStripMenuItem("Show screen wide crosshair");
|
||||
tsmiShowCrosshair.Checked = config.ShowCrosshair;
|
||||
tsmiShowCrosshair.CheckOnClick = true;
|
||||
tsmiShowCrosshair.Click += (sender, e) => config.ShowCrosshair = tsmiShowCrosshair.Checked;
|
||||
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 =>
|
||||
{
|
||||
foreach (ToolStripMenuItem tsmi in cmsContextMenu.Items.OfType<ToolStripMenuItem>().Where(x => x.Tag is ShapeType))
|
||||
|
|
Loading…
Reference in a new issue