diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj
index aaf2675d..d79a9fd6 100644
--- a/Source/Core/Builder.csproj
+++ b/Source/Core/Builder.csproj
@@ -1017,6 +1017,8 @@
+
+
diff --git a/Source/Core/Controls/ScriptEditorControl.cs b/Source/Core/Controls/ScriptEditorControl.cs
index 88ae666d..3054604b 100644
--- a/Source/Core/Controls/ScriptEditorControl.cs
+++ b/Source/Core/Controls/ScriptEditorControl.cs
@@ -27,6 +27,7 @@ using System.Collections;
using System.Globalization;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Properties;
+using CodeImp.DoomBuilder.Windows;
#endregion
@@ -828,6 +829,12 @@ namespace CodeImp.DoomBuilder.Controls
e.Handled = true;
}
}
+
+ //mxd. Handle screenshot saving
+ else if(DelayedForm.ProcessSaveScreenshotAction((int)e.KeyData))
+ {
+ e.Handled = true;
+ }
}
// Key released
diff --git a/Source/Core/GZBuilder/Windows/ExceptionDialog.cs b/Source/Core/GZBuilder/Windows/ExceptionDialog.cs
index d431738d..59e226e0 100644
--- a/Source/Core/GZBuilder/Windows/ExceptionDialog.cs
+++ b/Source/Core/GZBuilder/Windows/ExceptionDialog.cs
@@ -7,8 +7,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Windows
{
public partial class ExceptionDialog : Form
{
- private bool cannotContinue;
- private string logPath;
+ private readonly bool cannotContinue;
+ private readonly string logPath;
public ExceptionDialog(UnhandledExceptionEventArgs e) {
InitializeComponent();
diff --git a/Source/Core/GZBuilder/Windows/TagStatisticsForm.cs b/Source/Core/GZBuilder/Windows/TagStatisticsForm.cs
index 7d4a9bb8..c1482004 100644
--- a/Source/Core/GZBuilder/Windows/TagStatisticsForm.cs
+++ b/Source/Core/GZBuilder/Windows/TagStatisticsForm.cs
@@ -6,10 +6,11 @@ using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Editing;
+using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.GZBuilder.Windows
{
- public partial class TagStatisticsForm : Form
+ public partial class TagStatisticsForm : DelayedForm
{
private static Size size = Size.Empty;
private static Point location = Point.Empty;
diff --git a/Source/Core/GZBuilder/Windows/ThingStatisticsForm.cs b/Source/Core/GZBuilder/Windows/ThingStatisticsForm.cs
index bc46b125..89817827 100644
--- a/Source/Core/GZBuilder/Windows/ThingStatisticsForm.cs
+++ b/Source/Core/GZBuilder/Windows/ThingStatisticsForm.cs
@@ -7,10 +7,11 @@ using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map;
+using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.GZBuilder.Windows
{
- public partial class ThingStatisticsForm : Form
+ public partial class ThingStatisticsForm : DelayedForm
{
private static Size size = Size.Empty;
private static Point location = Point.Empty;
diff --git a/Source/Core/Properties/Resources.Designer.cs b/Source/Core/Properties/Resources.Designer.cs
index a03fe696..b96dc21c 100644
--- a/Source/Core/Properties/Resources.Designer.cs
+++ b/Source/Core/Properties/Resources.Designer.cs
@@ -536,6 +536,20 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
+ internal static System.Drawing.Bitmap Screenshot {
+ get {
+ object obj = ResourceManager.GetObject("Screenshot", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ internal static System.Drawing.Bitmap ScreenshotActiveWindow {
+ get {
+ object obj = ResourceManager.GetObject("ScreenshotActiveWindow", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
internal static System.Drawing.Bitmap Script2 {
get {
object obj = ResourceManager.GetObject("Script2", resourceCulture);
diff --git a/Source/Core/Properties/Resources.resx b/Source/Core/Properties/Resources.resx
index f4fb21d9..b0d4214a 100644
--- a/Source/Core/Properties/Resources.resx
+++ b/Source/Core/Properties/Resources.resx
@@ -181,15 +181,15 @@
..\Resources\Splash3_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\Screenshot.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\ScriptPalette.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\ScriptHelp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\KnownTextureSet.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -202,6 +202,9 @@
..\Resources\ThingStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -307,12 +310,15 @@
..\Resources\MCrash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\ModelDisabled.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\Zoom_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
..\Resources\PuzzlePiece.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -385,8 +391,8 @@
..\Resources\ViewTextureFloor.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -436,7 +442,7 @@
..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\ModelDisabled.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\ScreenshotActiveWindow.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
\ No newline at end of file
diff --git a/Source/Core/Resources/Actions.cfg b/Source/Core/Resources/Actions.cfg
index 9d97027b..cfba04b3 100644
--- a/Source/Core/Resources/Actions.cfg
+++ b/Source/Core/Resources/Actions.cfg
@@ -187,9 +187,9 @@ savescreenshot
//mxd
saveeditareascreenshot
{
- title = "Save Screenshot (editing area only)";
+ title = "Save Screenshot (active window)";
category = "tools";
- description = "Saves a screenshot of editing area into 'Screenshots' folder.";
+ description = "Saves a screenshot of currently active window, or editing area if no windows are open into 'Screenshots' folder.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
diff --git a/Source/Core/Resources/Screenshot.png b/Source/Core/Resources/Screenshot.png
new file mode 100644
index 00000000..13997699
Binary files /dev/null and b/Source/Core/Resources/Screenshot.png differ
diff --git a/Source/Core/Resources/ScreenshotActiveWindow.png b/Source/Core/Resources/ScreenshotActiveWindow.png
new file mode 100644
index 00000000..1eb2afe8
Binary files /dev/null and b/Source/Core/Resources/ScreenshotActiveWindow.png differ
diff --git a/Source/Core/Windows/CenterOnCoordinatesForm.cs b/Source/Core/Windows/CenterOnCoordinatesForm.cs
index 991bd810..bd95a12b 100644
--- a/Source/Core/Windows/CenterOnCoordinatesForm.cs
+++ b/Source/Core/Windows/CenterOnCoordinatesForm.cs
@@ -4,18 +4,20 @@ using CodeImp.DoomBuilder.Geometry;
namespace CodeImp.DoomBuilder.Windows
{
- public partial class CenterOnCoordinatesForm : Form
+ public partial class CenterOnCoordinatesForm : DelayedForm
{
private static Vector2D coordinates;
public Vector2D Coordinates { get { return coordinates; } }
- public CenterOnCoordinatesForm() {
+ public CenterOnCoordinatesForm()
+ {
InitializeComponent();
gotox.Text = coordinates.x.ToString();
gotoy.Text = coordinates.y.ToString();
}
- private void accept_Click(object sender, EventArgs e) {
+ private void accept_Click(object sender, EventArgs e)
+ {
coordinates.x = (float)Math.Round(General.Clamp(gotox.GetResult((int)coordinates.x), General.Map.FormatInterface.MinCoordinate, General.Map.FormatInterface.MaxCoordinate));
coordinates.y = (float)Math.Round(General.Clamp(gotoy.GetResult((int)coordinates.y), General.Map.FormatInterface.MinCoordinate, General.Map.FormatInterface.MaxCoordinate));
@@ -23,7 +25,8 @@ namespace CodeImp.DoomBuilder.Windows
this.Close();
}
- private void cancel_Click(object sender, EventArgs e) {
+ private void cancel_Click(object sender, EventArgs e)
+ {
this.DialogResult = DialogResult.Cancel;
this.Close();
}
diff --git a/Source/Core/Windows/DelayedForm.cs b/Source/Core/Windows/DelayedForm.cs
index 924dbe3f..222436d1 100644
--- a/Source/Core/Windows/DelayedForm.cs
+++ b/Source/Core/Windows/DelayedForm.cs
@@ -18,6 +18,8 @@
using System;
using System.Windows.Forms;
+using CodeImp.DoomBuilder.Actions;
+using Action = CodeImp.DoomBuilder.Actions.Action;
#endregion
@@ -36,6 +38,8 @@ namespace CodeImp.DoomBuilder.Windows
// Constructor
public DelayedForm()
{
+ this.Opacity = 0; //mxd
+
// Create a timer that we need to show the form
formshowtimer = new Timer();
formshowtimer.Interval = 1;
@@ -50,6 +54,9 @@ namespace CodeImp.DoomBuilder.Windows
// Start the timer to show the form
formshowtimer.Enabled = true;
+
+ // Bind any methods (mxd)
+ if(!DesignMode) General.Actions.BindMethods(this);
}
// When the form is to be shown
@@ -66,11 +73,40 @@ namespace CodeImp.DoomBuilder.Windows
}
}
- // Block this
+ // Block this. MainForm overrides this, so it's only called from child DelayedForms (mxd).
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
- //return base.ProcessCmdKey(ref msg, keyData);
+ ProcessSaveScreenshotAction((int)keyData);
return false;
}
+
+ // mxd. Handle screenshot saving from any form
+ internal static bool ProcessSaveScreenshotAction(int key)
+ {
+ Action[] actions = General.Actions.GetActionsByKey(key);
+ foreach(Action action in actions)
+ {
+ if(action.ShortName == "savescreenshot" || action.ShortName == "saveeditareascreenshot") {
+ General.Actions.InvokeAction(action.Name);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ //mxd
+ [BeginAction("savescreenshot", BaseAction = true)]
+ internal void SaveScreenshot()
+ {
+ General.MainWindow.SaveScreenshot(false);
+ }
+
+ //mxd
+ [BeginAction("saveeditareascreenshot", BaseAction = true)]
+ internal void SaveEditAreaScreenshot()
+ {
+ General.MainWindow.SaveScreenshot(true);
+ }
}
}
diff --git a/Source/Core/Windows/ErrorsForm.cs b/Source/Core/Windows/ErrorsForm.cs
index ad0f337e..683eb25c 100644
--- a/Source/Core/Windows/ErrorsForm.cs
+++ b/Source/Core/Windows/ErrorsForm.cs
@@ -27,7 +27,7 @@ using System.Windows.Forms;
namespace CodeImp.DoomBuilder.Windows
{
- public partial class ErrorsForm : Form
+ public partial class ErrorsForm : DelayedForm
{
#region ================== Variables
diff --git a/Source/Core/Windows/MainForm.Designer.cs b/Source/Core/Windows/MainForm.Designer.cs
index dc80a91c..8a9cb49a 100644
--- a/Source/Core/Windows/MainForm.Designer.cs
+++ b/Source/Core/Windows/MainForm.Designer.cs
@@ -363,7 +363,7 @@ namespace CodeImp.DoomBuilder.Windows
this.menuhelp});
this.menumain.Location = new System.Drawing.Point(0, 0);
this.menumain.Name = "menumain";
- this.menumain.Size = new System.Drawing.Size(328, 24);
+ this.menumain.Size = new System.Drawing.Size(420, 24);
this.menumain.TabIndex = 0;
//
// menufile
@@ -977,7 +977,7 @@ namespace CodeImp.DoomBuilder.Windows
// itemreloadresources
//
this.itemreloadresources.Name = "itemreloadresources";
- this.itemreloadresources.Size = new System.Drawing.Size(233, 22);
+ this.itemreloadresources.Size = new System.Drawing.Size(246, 22);
this.itemreloadresources.Tag = "builder_reloadresources";
this.itemreloadresources.Text = "&Reload Resources";
this.itemreloadresources.Click += new System.EventHandler(this.InvokeTaggedAction);
@@ -985,7 +985,7 @@ namespace CodeImp.DoomBuilder.Windows
// itemReloadModedef
//
this.itemReloadModedef.Name = "itemReloadModedef";
- this.itemReloadModedef.Size = new System.Drawing.Size(233, 22);
+ this.itemReloadModedef.Size = new System.Drawing.Size(246, 22);
this.itemReloadModedef.Tag = "builder_gzreloadmodeldef";
this.itemReloadModedef.Text = "Reload MODELDEF/VOXELDEF";
this.itemReloadModedef.Click += new System.EventHandler(this.InvokeTaggedAction);
@@ -993,7 +993,7 @@ namespace CodeImp.DoomBuilder.Windows
// itemReloadGldefs
//
this.itemReloadGldefs.Name = "itemReloadGldefs";
- this.itemReloadGldefs.Size = new System.Drawing.Size(233, 22);
+ this.itemReloadGldefs.Size = new System.Drawing.Size(246, 22);
this.itemReloadGldefs.Tag = "builder_gzreloadgldefs";
this.itemReloadGldefs.Text = "Reload GLDEFS";
this.itemReloadGldefs.Click += new System.EventHandler(this.InvokeTaggedAction);
@@ -1001,7 +1001,7 @@ namespace CodeImp.DoomBuilder.Windows
// itemReloadMapinfo
//
this.itemReloadMapinfo.Name = "itemReloadMapinfo";
- this.itemReloadMapinfo.Size = new System.Drawing.Size(233, 22);
+ this.itemReloadMapinfo.Size = new System.Drawing.Size(246, 22);
this.itemReloadMapinfo.Tag = "builder_gzreloadmapinfo";
this.itemReloadMapinfo.Text = "Reload (Z)MAPINFO";
this.itemReloadMapinfo.Click += new System.EventHandler(this.InvokeTaggedAction);
@@ -1010,7 +1010,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.itemshowerrors.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning;
this.itemshowerrors.Name = "itemshowerrors";
- this.itemshowerrors.Size = new System.Drawing.Size(233, 22);
+ this.itemshowerrors.Size = new System.Drawing.Size(246, 22);
this.itemshowerrors.Tag = "builder_showerrors";
this.itemshowerrors.Text = "&Errors and Warnings...";
this.itemshowerrors.Click += new System.EventHandler(this.InvokeTaggedAction);
@@ -1019,12 +1019,12 @@ namespace CodeImp.DoomBuilder.Windows
//
this.seperatortoolsresources.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.seperatortoolsresources.Name = "seperatortoolsresources";
- this.seperatortoolsresources.Size = new System.Drawing.Size(230, 6);
+ this.seperatortoolsresources.Size = new System.Drawing.Size(243, 6);
//
// configurationToolStripMenuItem
//
this.configurationToolStripMenuItem.Name = "configurationToolStripMenuItem";
- this.configurationToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
+ this.configurationToolStripMenuItem.Size = new System.Drawing.Size(246, 22);
this.configurationToolStripMenuItem.Tag = "builder_configuration";
this.configurationToolStripMenuItem.Text = "&Game Configurations...";
this.configurationToolStripMenuItem.Click += new System.EventHandler(this.InvokeTaggedAction);
@@ -1032,7 +1032,7 @@ namespace CodeImp.DoomBuilder.Windows
// preferencesToolStripMenuItem
//
this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem";
- this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
+ this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(246, 22);
this.preferencesToolStripMenuItem.Tag = "builder_preferences";
this.preferencesToolStripMenuItem.Text = "Preferences...";
this.preferencesToolStripMenuItem.Click += new System.EventHandler(this.InvokeTaggedAction);
@@ -1041,34 +1041,36 @@ namespace CodeImp.DoomBuilder.Windows
//
this.seperatortoolsconfig.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.seperatortoolsconfig.Name = "seperatortoolsconfig";
- this.seperatortoolsconfig.Size = new System.Drawing.Size(230, 6);
+ this.seperatortoolsconfig.Size = new System.Drawing.Size(243, 6);
//
// screenshotToolStripMenuItem
//
+ this.screenshotToolStripMenuItem.Image = global::CodeImp.DoomBuilder.Properties.Resources.Screenshot;
this.screenshotToolStripMenuItem.Name = "screenshotToolStripMenuItem";
- this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
+ this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(246, 22);
this.screenshotToolStripMenuItem.Tag = "builder_savescreenshot";
this.screenshotToolStripMenuItem.Text = "Save Screenshot";
this.screenshotToolStripMenuItem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// editAreaScreenshotToolStripMenuItem
//
+ this.editAreaScreenshotToolStripMenuItem.Image = global::CodeImp.DoomBuilder.Properties.Resources.ScreenshotActiveWindow;
this.editAreaScreenshotToolStripMenuItem.Name = "editAreaScreenshotToolStripMenuItem";
- this.editAreaScreenshotToolStripMenuItem.Size = new System.Drawing.Size(233, 22);
+ this.editAreaScreenshotToolStripMenuItem.Size = new System.Drawing.Size(246, 22);
this.editAreaScreenshotToolStripMenuItem.Tag = "builder_saveeditareascreenshot";
- this.editAreaScreenshotToolStripMenuItem.Text = "Save Screenshot (editing area)";
+ this.editAreaScreenshotToolStripMenuItem.Text = "Save Screenshot (active window)";
this.editAreaScreenshotToolStripMenuItem.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// separatortoolsscreenshots
//
this.separatortoolsscreenshots.Name = "separatortoolsscreenshots";
- this.separatortoolsscreenshots.Size = new System.Drawing.Size(230, 6);
+ this.separatortoolsscreenshots.Size = new System.Drawing.Size(243, 6);
//
// itemtestmap
//
this.itemtestmap.Image = global::CodeImp.DoomBuilder.Properties.Resources.Test;
this.itemtestmap.Name = "itemtestmap";
- this.itemtestmap.Size = new System.Drawing.Size(233, 22);
+ this.itemtestmap.Size = new System.Drawing.Size(246, 22);
this.itemtestmap.Tag = "builder_testmap";
this.itemtestmap.Text = "&Test Map";
this.itemtestmap.Click += new System.EventHandler(this.InvokeTaggedAction);
@@ -1593,7 +1595,7 @@ namespace CodeImp.DoomBuilder.Windows
this.lightsshowanimated.Text = "Show animated dynamic lights";
this.lightsshowanimated.Click += new System.EventHandler(this.ChangeLightRenderingMode);
//
- // modelmode
+ // modelrendermode
//
this.modelrendermode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.modelrendermode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -1603,7 +1605,7 @@ namespace CodeImp.DoomBuilder.Windows
this.modelrendermode.Enabled = false;
this.modelrendermode.Image = global::CodeImp.DoomBuilder.Properties.Resources.Model;
this.modelrendermode.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.modelrendermode.Name = "modelmode";
+ this.modelrendermode.Name = "modelrendermode";
this.modelrendermode.Size = new System.Drawing.Size(32, 22);
this.modelrendermode.Tag = "builder_gztogglemodels";
this.modelrendermode.Text = "Model rendering mode";
@@ -2237,6 +2239,7 @@ namespace CodeImp.DoomBuilder.Windows
this.KeyPreview = true;
this.MainMenuStrip = this.menumain;
this.Name = "MainForm";
+ this.Opacity = 1;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "GZDoom Builder";
this.Deactivate += new System.EventHandler(this.MainForm_Deactivate);
diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs
index 3e4f4b8f..42ff7466 100644
--- a/Source/Core/Windows/MainForm.cs
+++ b/Source/Core/Windows/MainForm.cs
@@ -239,9 +239,6 @@ namespace CodeImp.DoomBuilder.Windows
toolbarContextMenu.KeyDown += toolbarContextMenu_KeyDown;
toolbarContextMenu.KeyUp += toolbarContextMenu_KeyUp;
- // Bind any methods
- General.Actions.BindMethods(this);
-
// Apply shortcut keys
ApplyShortcutKeys();
@@ -2809,8 +2806,6 @@ namespace CodeImp.DoomBuilder.Windows
itemReloadGldefs.Enabled = enabled;
itemReloadMapinfo.Enabled = enabled;
itemReloadModedef.Enabled = enabled;
- screenshotToolStripMenuItem.Enabled = enabled;
- editAreaScreenshotToolStripMenuItem.Enabled = enabled;
}
// Errors and Warnings
@@ -2891,27 +2886,12 @@ namespace CodeImp.DoomBuilder.Windows
}
//mxd
- [BeginAction("savescreenshot")]
- internal void SaveScreenshot() {
- saveScreenshot(false);
- }
-
- //mxd
- [BeginAction("saveeditareascreenshot")]
- internal void SaveEditAreaScreenshot() {
- saveScreenshot(true);
- }
-
- //mxd
- private void saveScreenshot(bool editAreaOnly) {
- if (General.Map == null) {
- DisplayStatus(StatusType.Warning, "Please load a map first!");
- return;
- }
-
+ internal void SaveScreenshot(bool activeControlOnly)
+ {
//pick a valid folder
string folder = General.Settings.ScreenshotsPath;
- if (!Directory.Exists(folder)) {
+ if (!Directory.Exists(folder))
+ {
if (folder != General.DefaultScreenshotsPath
&& General.ShowErrorMessage("Screenshots save path '" + folder
+ "' does not exist!\nPress OK to save to the default folder ('"
@@ -2923,15 +2903,30 @@ namespace CodeImp.DoomBuilder.Windows
if(!Directory.Exists(folder)) Directory.CreateDirectory(folder);
}
- //create name
+ // Create name and bounds
string name;
Rectangle bounds;
- if(editAreaOnly) {
- name = Path.GetFileNameWithoutExtension(General.Map.FileTitle) + " (edit area) at ";
- bounds = this.display.Bounds;
- bounds.Offset(this.PointToScreen(new Point()));
- } else {
- name = Path.GetFileNameWithoutExtension(General.Map.FileTitle) + " at ";
+ bool displayextrainfo = false;
+ string mapname = (General.Map != null ? Path.GetFileNameWithoutExtension(General.Map.FileTitle) : General.ThisAssembly.GetName().Name);
+
+ if(activeControlOnly)
+ {
+ if (!this.IsActiveWindow && OwnedForms.Length > 0)
+ {
+ name = mapname + " (" + OwnedForms[0].Text + ") at ";
+ bounds = OwnedForms[0].Bounds;
+ }
+ else
+ {
+ name = mapname + " (edit area) at ";
+ bounds = this.display.Bounds;
+ bounds.Offset(this.PointToScreen(new Point()));
+ displayextrainfo = true;
+ }
+ }
+ else
+ {
+ name = mapname + " at ";
bounds = this.Bounds;
}
@@ -2946,20 +2941,24 @@ namespace CodeImp.DoomBuilder.Windows
string path = Path.Combine(folder, name + date + " [" + revision + "].jpg");
//save image
- using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) {
- using(Graphics g = Graphics.FromImage(bitmap)) {
+ using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
+ {
+ using(Graphics g = Graphics.FromImage(bitmap))
+ {
g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
//draw the cursor
if(!cursorLocation.IsEmpty) g.DrawImage(Resources.Cursor, cursorLocation);
//gather some info
- string info = string.Empty;
- if (editAreaOnly && General.Editing.Mode != null) {
+ string info;
+ if(displayextrainfo && General.Editing.Mode != null)
+ {
info = General.Map.FileTitle + " | " + General.Map.Options.CurrentName + " | ";
//get map coordinates
- if (General.Editing.Mode is ClassicMode) {
+ if (General.Editing.Mode is ClassicMode)
+ {
Vector2D pos = ((ClassicMode) General.Editing.Mode).MouseMapPos;
//mouse inside the view?
@@ -2968,13 +2967,17 @@ namespace CodeImp.DoomBuilder.Windows
} else {
info += "X:" + Math.Round(General.Map.Renderer2D.TranslateX) + " Y:" + Math.Round(General.Map.Renderer2D.TranslateY);
}
- } else { //should be visual mode
+ }
+ else
+ { //should be visual mode
info += "X:" + Math.Round(General.Map.VisualCamera.Position.x) + " Y:" + Math.Round(General.Map.VisualCamera.Position.y) + " Z:" + Math.Round(General.Map.VisualCamera.Position.z);
}
//add the revision number
info += " | " + revision;
- } else {
+ }
+ else
+ {
//just use the revision number
info = revision;
}
@@ -2990,11 +2993,14 @@ namespace CodeImp.DoomBuilder.Windows
g.DrawString(info, font, brush, px + 2, py + 2);
}
- try {
+ try
+ {
ImageCodecInfo jpegCodec = null;
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders();
- foreach(ImageCodecInfo codec in codecs) {
- if(codec.FormatID == ImageFormat.Jpeg.Guid) {
+ foreach(ImageCodecInfo codec in codecs)
+ {
+ if(codec.FormatID == ImageFormat.Jpeg.Guid)
+ {
jpegCodec = codec;
break;
}
@@ -3006,7 +3012,9 @@ namespace CodeImp.DoomBuilder.Windows
bitmap.Save(path, jpegCodec, encoderParams);
DisplayStatus(StatusType.Info, "Screenshot saved to '" + path + "'");
- } catch(ExternalException e) {
+ }
+ catch(ExternalException e)
+ {
DisplayStatus(StatusType.Warning, "Failed to save screenshot...");
General.ErrorLogger.Add(ErrorType.Error, "Failed to save screenshot: " + e.Message);
}
@@ -3153,31 +3161,39 @@ namespace CodeImp.DoomBuilder.Windows
}
//mxd
- public void ShowHints(string hintsText) {
- if (!string.IsNullOrEmpty(hintsText)) {
+ public void ShowHints(string hintsText)
+ {
+ if (!string.IsNullOrEmpty(hintsText))
+ {
hintsPanel.SetHints(hintsText);
- } else {
+ }
+ else
+ {
ClearHints();
}
}
//mxd
- public void ClearHints() {
+ public void ClearHints()
+ {
hintsPanel.ClearHints();
}
//mxd
- internal void AddHintsDocker() {
+ internal void AddHintsDocker()
+ {
if(!dockerspanel.Contains(hintsDocker)) dockerspanel.Add(hintsDocker);
}
//mxd
- internal void RemoveHintsDocker() {
+ internal void RemoveHintsDocker()
+ {
dockerspanel.Remove(hintsDocker);
}
//mxd
- public void UpdateStatistics() {
+ public void UpdateStatistics()
+ {
statistics.UpdateStatistics();
}
diff --git a/Source/Core/Windows/ScriptEditorForm.cs b/Source/Core/Windows/ScriptEditorForm.cs
index 5a791d78..e020bde7 100644
--- a/Source/Core/Windows/ScriptEditorForm.cs
+++ b/Source/Core/Windows/ScriptEditorForm.cs
@@ -25,7 +25,7 @@ using CodeImp.DoomBuilder.Controls;
namespace CodeImp.DoomBuilder.Windows
{
- internal partial class ScriptEditorForm : Form
+ internal partial class ScriptEditorForm : DelayedForm
{
#region ================== Variables
diff --git a/Source/Core/Windows/TextureBrowserForm.cs b/Source/Core/Windows/TextureBrowserForm.cs
index 72960181..57ecce12 100644
--- a/Source/Core/Windows/TextureBrowserForm.cs
+++ b/Source/Core/Windows/TextureBrowserForm.cs
@@ -28,7 +28,7 @@ using System.IO;
namespace CodeImp.DoomBuilder.Windows
{
- internal partial class TextureBrowserForm : Form
+ internal partial class TextureBrowserForm : DelayedForm
{
// Variables
private string selectedname;
diff --git a/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.cs b/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.cs
index 6e184a62..b5aed860 100644
--- a/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.cs
+++ b/Source/Plugins/BuilderEffects/Interface/JitterSectorsForm.cs
@@ -8,7 +8,7 @@ using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.BuilderEffects
{
- public partial class JitterSectorsForm : Form
+ public partial class JitterSectorsForm : DelayedForm
{
private readonly string editingModeName;
private readonly List visualSectors;
diff --git a/Source/Plugins/BuilderEffects/Interface/JitterThingsForm.cs b/Source/Plugins/BuilderEffects/Interface/JitterThingsForm.cs
index 6cf4bd6a..26aa474a 100644
--- a/Source/Plugins/BuilderEffects/Interface/JitterThingsForm.cs
+++ b/Source/Plugins/BuilderEffects/Interface/JitterThingsForm.cs
@@ -6,12 +6,13 @@ using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.VisualModes;
using CodeImp.DoomBuilder.Geometry;
+using CodeImp.DoomBuilder.Windows;
#endregion
namespace CodeImp.DoomBuilder.BuilderEffects
{
- public partial class JitterThingsForm : Form
+ public partial class JitterThingsForm : DelayedForm
{
#region Variables
diff --git a/Source/Plugins/BuilderEffects/Interface/JitterVerticesForm.cs b/Source/Plugins/BuilderEffects/Interface/JitterVerticesForm.cs
index 417fd7c2..61a68292 100644
--- a/Source/Plugins/BuilderEffects/Interface/JitterVerticesForm.cs
+++ b/Source/Plugins/BuilderEffects/Interface/JitterVerticesForm.cs
@@ -8,7 +8,7 @@ using CodeImp.DoomBuilder.Geometry;
namespace CodeImp.DoomBuilder.BuilderEffects
{
- public partial class JitterVerticesForm : Form
+ public partial class JitterVerticesForm : DelayedForm
{
private readonly string editingModeName;
private readonly List selection;
diff --git a/Source/Plugins/BuilderEffects/Interface/ObjImportSettingsForm.cs b/Source/Plugins/BuilderEffects/Interface/ObjImportSettingsForm.cs
index 2f5e6fa6..1ef3583d 100644
--- a/Source/Plugins/BuilderEffects/Interface/ObjImportSettingsForm.cs
+++ b/Source/Plugins/BuilderEffects/Interface/ObjImportSettingsForm.cs
@@ -3,12 +3,13 @@
using System;
using System.IO;
using System.Windows.Forms;
+using CodeImp.DoomBuilder.Windows;
#endregion
namespace CodeImp.DoomBuilder.BuilderEffects
{
- public partial class ObjImportSettingsForm : Form
+ public partial class ObjImportSettingsForm : DelayedForm
{
#region ================== Variables
diff --git a/Source/Plugins/BuilderModes/Interface/BridgeModeForm.cs b/Source/Plugins/BuilderModes/Interface/BridgeModeForm.cs
index 6c3df224..94888c44 100644
--- a/Source/Plugins/BuilderModes/Interface/BridgeModeForm.cs
+++ b/Source/Plugins/BuilderModes/Interface/BridgeModeForm.cs
@@ -1,6 +1,7 @@
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.BuilderModes.ClassicModes;
+using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.BuilderModes.Interface {
@@ -20,7 +21,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface {
public static string[] BRIGHTNESS_INTERPOLATION_MODES = { LINEAR, BRIGHTNESS_HIGHEST, BRIGHTNESS_LOWEST };
}
- public partial class BridgeModeForm : Form {
+ public partial class BridgeModeForm : DelayedForm {
internal int Subdivisions {
get {
diff --git a/Source/Plugins/BuilderModes/Interface/FilterSelectedThingsForm.cs b/Source/Plugins/BuilderModes/Interface/FilterSelectedThingsForm.cs
index 4ea5a33b..3fdf918f 100644
--- a/Source/Plugins/BuilderModes/Interface/FilterSelectedThingsForm.cs
+++ b/Source/Plugins/BuilderModes/Interface/FilterSelectedThingsForm.cs
@@ -5,10 +5,11 @@ using System.Drawing;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config;
+using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.BuilderModes
{
- public partial class FilterSelectedThingsForm : Form
+ public partial class FilterSelectedThingsForm : DelayedForm
{
private static Size size = Size.Empty;
private static Point location = Point.Empty;
diff --git a/Source/Plugins/BuilderModes/Interface/PastePropertiesOptionsForm.cs b/Source/Plugins/BuilderModes/Interface/PastePropertiesOptionsForm.cs
index 31625aa9..e11501da 100644
--- a/Source/Plugins/BuilderModes/Interface/PastePropertiesOptionsForm.cs
+++ b/Source/Plugins/BuilderModes/Interface/PastePropertiesOptionsForm.cs
@@ -4,10 +4,11 @@ using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls;
+using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.BuilderModes.Interface
{
- public partial class PastePropertiesOptionsForm : Form
+ public partial class PastePropertiesOptionsForm : DelayedForm
{
private static Size size = Size.Empty;
private static Point location = Point.Empty;
diff --git a/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs b/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs
index e510b4df..c498a64c 100644
--- a/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs
+++ b/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs
@@ -24,7 +24,7 @@ using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.BuilderModes
{
- public partial class PreferencesForm : Form
+ public partial class PreferencesForm : DelayedForm
{
#region ================== Variables
diff --git a/Source/Plugins/BuilderModes/Interface/SelectSimilarElementOptionsPanel.cs b/Source/Plugins/BuilderModes/Interface/SelectSimilarElementOptionsPanel.cs
index eed55afc..78859a03 100644
--- a/Source/Plugins/BuilderModes/Interface/SelectSimilarElementOptionsPanel.cs
+++ b/Source/Plugins/BuilderModes/Interface/SelectSimilarElementOptionsPanel.cs
@@ -9,7 +9,7 @@ using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.BuilderModes
{
- public partial class SelectSimilarElementOptionsPanel : Form
+ public partial class SelectSimilarElementOptionsPanel : DelayedForm
{
private static Size size = Size.Empty;
private static Point location = Point.Empty;
diff --git a/Source/Plugins/BuilderModes/Interface/WavefrontSettingsForm.cs b/Source/Plugins/BuilderModes/Interface/WavefrontSettingsForm.cs
index 1434a2ce..18432b6c 100644
--- a/Source/Plugins/BuilderModes/Interface/WavefrontSettingsForm.cs
+++ b/Source/Plugins/BuilderModes/Interface/WavefrontSettingsForm.cs
@@ -3,12 +3,13 @@
using System;
using System.Windows.Forms;
using System.IO;
+using CodeImp.DoomBuilder.Windows;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes.Interface
{
- public partial class WavefrontSettingsForm : Form
+ public partial class WavefrontSettingsForm : DelayedForm
{
#region ================== Properties
diff --git a/Source/Plugins/VisplaneExplorer/InterfaceForm.cs b/Source/Plugins/VisplaneExplorer/InterfaceForm.cs
index fdd367e7..9dfe474e 100644
--- a/Source/Plugins/VisplaneExplorer/InterfaceForm.cs
+++ b/Source/Plugins/VisplaneExplorer/InterfaceForm.cs
@@ -10,7 +10,7 @@ using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
{
- public partial class InterfaceForm : Form
+ public partial class InterfaceForm : DelayedForm
{
#region ================== Constants