Fixed: SaveScreenshots method was called several times when child windows were open.

Fixed incorrect screenshot size when a window was maximized.
Fixed: more than one screenshot per second can now be saved.
Changed screenshot filename date format to yyyy.mm.dd.
This commit is contained in:
MaxED 2014-10-31 09:52:07 +00:00
parent 8defbb42e3
commit ecaf9331d9
2 changed files with 11 additions and 8 deletions

View file

@ -76,7 +76,7 @@ namespace CodeImp.DoomBuilder.Windows
// Block this. MainForm overrides this, so it's only called from child DelayedForms (mxd).
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
ProcessSaveScreenshotAction((int)keyData);
if(Form.ActiveForm == this) ProcessSaveScreenshotAction((int)keyData);
return false;
}
@ -86,7 +86,8 @@ namespace CodeImp.DoomBuilder.Windows
Action[] actions = General.Actions.GetActionsByKey(key);
foreach(Action action in actions)
{
if(action.ShortName == "savescreenshot" || action.ShortName == "saveeditareascreenshot") {
if(action.ShortName == "savescreenshot" || action.ShortName == "saveeditareascreenshot")
{
General.Actions.InvokeAction(action.Name);
return true;
}
@ -99,14 +100,14 @@ namespace CodeImp.DoomBuilder.Windows
[BeginAction("savescreenshot", BaseAction = true)]
internal void SaveScreenshot()
{
General.MainWindow.SaveScreenshot(false);
if(Form.ActiveForm == this) General.MainWindow.SaveScreenshot(false);
}
//mxd
[BeginAction("saveeditareascreenshot", BaseAction = true)]
internal void SaveEditAreaScreenshot()
{
General.MainWindow.SaveScreenshot(true);
if(Form.ActiveForm == this) General.MainWindow.SaveScreenshot(true);
}
}
}

View file

@ -2914,7 +2914,9 @@ namespace CodeImp.DoomBuilder.Windows
if (Form.ActiveForm != null && Form.ActiveForm != this)
{
name = mapname + " (" + Form.ActiveForm.Text + ") at ";
bounds = Form.ActiveForm.Bounds;
bounds = (Form.ActiveForm.WindowState == FormWindowState.Maximized ?
Screen.GetWorkingArea(Form.ActiveForm) :
Form.ActiveForm.Bounds);
}
else
{
@ -2924,10 +2926,10 @@ namespace CodeImp.DoomBuilder.Windows
displayextrainfo = true;
}
}
else
else
{
name = mapname + " at ";
bounds = this.Bounds;
bounds = (this.WindowState == FormWindowState.Maximized ? Screen.GetWorkingArea(this) : this.Bounds);
}
Point cursorLocation = Point.Empty;
@ -2936,7 +2938,7 @@ namespace CodeImp.DoomBuilder.Windows
cursorLocation = Cursor.Position - new Size(bounds.Location);
//create path
string date = DateTime.Now.ToString("dd.MM.yyyy HH-mm-ss");
string date = DateTime.Now.ToString("yyyy.MM.dd HH-mm-ss.fff");
string revision = "R" + General.ThisAssembly.GetName().Version.MinorRevision;
string path = Path.Combine(folder, name + date + " [" + revision + "].jpg");