From ab7d4b205456d01bd0ced5f58d0c91810c15a0b3 Mon Sep 17 00:00:00 2001 From: MaxED <j.maxed@gmail.com> Date: Wed, 22 Oct 2014 13:07:17 +0000 Subject: [PATCH] Renamed "Save Screenshot (editing area only)" action to "Save Screenshot (active window)". It will now save a screenshot of currently active window, or editing area if no windows are open. Added icons for "Save Screenshot" menu items. Development: "Save Screenshot (active window)" action will work on a child Form only if it is inherited from DelayedForm. --- Source/Core/Builder.csproj | 2 + Source/Core/Controls/ScriptEditorControl.cs | 7 ++ .../Core/GZBuilder/Windows/ExceptionDialog.cs | 4 +- .../GZBuilder/Windows/TagStatisticsForm.cs | 3 +- .../GZBuilder/Windows/ThingStatisticsForm.cs | 3 +- Source/Core/Properties/Resources.Designer.cs | 14 +++ Source/Core/Properties/Resources.resx | 24 ++-- Source/Core/Resources/Actions.cfg | 4 +- Source/Core/Resources/Screenshot.png | Bin 0 -> 578 bytes .../Core/Resources/ScreenshotActiveWindow.png | Bin 0 -> 508 bytes .../Core/Windows/CenterOnCoordinatesForm.cs | 11 +- Source/Core/Windows/DelayedForm.cs | 40 +++++- Source/Core/Windows/ErrorsForm.cs | 2 +- Source/Core/Windows/MainForm.Designer.cs | 37 +++--- Source/Core/Windows/MainForm.cs | 114 ++++++++++-------- Source/Core/Windows/ScriptEditorForm.cs | 2 +- Source/Core/Windows/TextureBrowserForm.cs | 2 +- .../Interface/JitterSectorsForm.cs | 2 +- .../Interface/JitterThingsForm.cs | 3 +- .../Interface/JitterVerticesForm.cs | 2 +- .../Interface/ObjImportSettingsForm.cs | 3 +- .../BuilderModes/Interface/BridgeModeForm.cs | 3 +- .../Interface/FilterSelectedThingsForm.cs | 3 +- .../Interface/PastePropertiesOptionsForm.cs | 3 +- .../BuilderModes/Interface/PreferencesForm.cs | 2 +- .../SelectSimilarElementOptionsPanel.cs | 2 +- .../Interface/WavefrontSettingsForm.cs | 3 +- .../Plugins/VisplaneExplorer/InterfaceForm.cs | 2 +- 28 files changed, 196 insertions(+), 101 deletions(-) create mode 100644 Source/Core/Resources/Screenshot.png create mode 100644 Source/Core/Resources/ScreenshotActiveWindow.png diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index aaf2675d2..d79a9fd6d 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -1017,6 +1017,8 @@ <Content Include="Resources\Model.png" /> <None Include="Resources\ModelDisabled.png" /> <Content Include="Resources\Model_selected.png" /> + <None Include="Resources\ScreenshotActiveWindow.png" /> + <None Include="Resources\Screenshot.png" /> <None Include="Resources\PuzzlePiece.png" /> <None Include="Resources\Search.png" /> <None Include="Resources\SnapVerts.png" /> diff --git a/Source/Core/Controls/ScriptEditorControl.cs b/Source/Core/Controls/ScriptEditorControl.cs index 88ae666dc..3054604b2 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 d431738d1..59e226e08 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 7d4a9bb82..c14820046 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 bc46b125a..89817827a 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 a03fe6961..b96dc21ca 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 f4fb21d9b..b0d4214a6 100644 --- a/Source/Core/Properties/Resources.resx +++ b/Source/Core/Properties/Resources.resx @@ -181,15 +181,15 @@ <data name="Splash3_small" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\Splash3_small.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="Screenshot" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Screenshot.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> <data name="ScriptPalette" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\ScriptPalette.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> <data name="ScriptHelp" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\ScriptHelp.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> - <data name="Light_animate" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> - </data> <data name="KnownTextureSet" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\KnownTextureSet.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> @@ -202,6 +202,9 @@ <data name="ThingStatistics" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\ThingStatistics.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="Grid2_arrowup" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> <data name="Grid2" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> @@ -307,12 +310,15 @@ <data name="MCrash" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\MCrash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> - <data name="ScriptCompile" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + <data name="ModelDisabled" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\ModelDisabled.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> <data name="Zoom_arrowup" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\Zoom_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="ScriptCompile" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\ScriptCompile.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> <data name="PuzzlePiece" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\PuzzlePiece.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> @@ -385,8 +391,8 @@ <data name="ViewTextureFloor" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\ViewTextureFloor.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> - <data name="Grid2_arrowup" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\Resources\Grid2_arrowup.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + <data name="Light_animate" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Light_animate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> <data name="Pin" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\Pin.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> @@ -436,7 +442,7 @@ <data name="Check" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> - <data name="ModelDisabled" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\Resources\ModelDisabled.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + <data name="ScreenshotActiveWindow" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\ScreenshotActiveWindow.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> </root> \ No newline at end of file diff --git a/Source/Core/Resources/Actions.cfg b/Source/Core/Resources/Actions.cfg index 9d97027b9..cfba04b3a 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 0000000000000000000000000000000000000000..139976998143bd646aa07230ca4c3752e3d07204 GIT binary patch literal 578 zcmV-I0=@l-P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUz<Vi$9RCwBylizF8P!z{M&62cDO`5L7 z)v-;6=z|JH2Qmafq3qvK#2=ve<X<olhoB7f$rte-5CmbOzQ|r=LaB%{IuT^l&ap(- zE@O#VQg2pTI%jb`@a3L+59fQo_nvcN#bWV3a9JQjfA&k@34-8fxm<2W76ie*5LuKH z<;u~`g+hT?EY{ccVHieBCL%zv?i^m2nB?@yQ;Z)zN<8$*W=*W+2EHnxWRjRt$X0cY ziw~zeIdT^p6PZc2tOoIsCZpOQX(^4YxX3Ak)S(>iT8+fPe7Az#1h=PdP+ltGIv#}+ z$H_|??(jH@rn4z+v!2#j@$KFO_V+sH!ei7OmwfUFoY6>VA`nktG(az{@@@XjE&{20 zqihbd_|;)U_t<b95lw(8kc90|4hz$78C%eME4cOX8H0h3zvM9_|KLhZWo$IV?9;oH z=AM&Pb-W>?H^FQ573xZj-=AGZYG;{O=lJse1s?U5T*)L{WiLUyBnRHT#0gq~>W4+D z?V>Ab7#JXQ*M;AD!avK{PTpg_P~dm@e}AIrOdc%H?5zEuqu{aqh*|3%wrz7Mb?v`x z9JRe+7##xZyfu|;=9*kJZ|-XjBuS!DsYI?76BBhuIM)SoeU7sgiT@+O018SYkabY{ Q!~g&Q07*qoM6N<$g8lmnMF0Q* literal 0 HcmV?d00001 diff --git a/Source/Core/Resources/ScreenshotActiveWindow.png b/Source/Core/Resources/ScreenshotActiveWindow.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb2afe877f71fcd0f5f967d51c2ce17c15392ec GIT binary patch literal 508 zcmV<Y0R#StP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUzo=HSORCwCNlgmmYK^TR<l<CgJv`HtR zQH&DCIG}<z5D{Fs(Z`sLD`8eXft%R|d;(uU5C#IyY{Z=dK@dgo0wNj}6^ypnJ#D(D zny4gW0+B5I;ZTRFpHru*PWfEdrJ3?IE8u@q^7%fhl##gfSI*3gPck+%O1d{gz_Cdr zV%(hGW2*v14-pd%PiNPBTVC?o=OorerNFp8iFsoYD7mCUaXN)gQc+2_#`)TrA}SR0 z_T+1OpG2g}!Q$)!+Xs0}!(w=FfTRdxcBN6m8js?cyQs#6eOvnuyt+LvGVSzJG)$7A zFE9}%7?ulxAZ_=c<*zu|{9Pqbbp++Hi~VDR2hHNaG~{X!ViF;E-Zj`-+Ms7ktMB0Z z&MNVejeTIz;lE_Qpwg4l$*%k$pIalLYFHg@^#y*Z>!=q6{_dG{7pB-$a~%HpiAAw& zSHy6x{(DR>NH1Y>BQ3%s@1aCpf^o@3nV09Y5+hX(jFMA3GPZPJSMWMV$h?H3ufZf9 yd3(P71sUat9K4i78Wb?RC|BOW=lsTh0t^7%`Hz3Err{R=0000<MNUMnLSTY@f8^%? literal 0 HcmV?d00001 diff --git a/Source/Core/Windows/CenterOnCoordinatesForm.cs b/Source/Core/Windows/CenterOnCoordinatesForm.cs index 991bd8100..bd95a12ba 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 924dbe3fc..222436d16 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 ad0f337e6..683eb25c9 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 dc80a91c9..8a9cb49a4 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 3e4f4b8f6..42ff74664 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 5a791d782..e020bde71 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 72960181e..57ecce120 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 6e184a625..b5aed8606 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<VisualSector> visualSectors; diff --git a/Source/Plugins/BuilderEffects/Interface/JitterThingsForm.cs b/Source/Plugins/BuilderEffects/Interface/JitterThingsForm.cs index 6cf4bd6a7..26aa474a7 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 417fd7c2f..61a682927 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<Vertex> selection; diff --git a/Source/Plugins/BuilderEffects/Interface/ObjImportSettingsForm.cs b/Source/Plugins/BuilderEffects/Interface/ObjImportSettingsForm.cs index 2f5e6fa61..1ef3583d7 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 6c3df2247..94888c446 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 4ea5a33b4..3fdf918f3 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 31625aa90..e11501da9 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 e510b4df7..c498a64c0 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 eed55afc2..78859a038 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 1434a2ce8..18432b6c9 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 fdd367e77..9dfe474e8 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 -- GitLab