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.
This commit is contained in:
MaxED 2014-10-22 13:07:17 +00:00
parent 1ae9481a03
commit ab7d4b2054
28 changed files with 196 additions and 101 deletions

View file

@ -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" />

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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>

View file

@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

View file

@ -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();
}

View file

@ -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);
}
}
}

View file

@ -27,7 +27,7 @@ using System.Windows.Forms;
namespace CodeImp.DoomBuilder.Windows
{
public partial class ErrorsForm : Form
public partial class ErrorsForm : DelayedForm
{
#region ================== Variables

View file

@ -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);

View file

@ -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();
}

View file

@ -25,7 +25,7 @@ using CodeImp.DoomBuilder.Controls;
namespace CodeImp.DoomBuilder.Windows
{
internal partial class ScriptEditorForm : Form
internal partial class ScriptEditorForm : DelayedForm
{
#region ================== Variables

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -24,7 +24,7 @@ using CodeImp.DoomBuilder.Windows;
namespace CodeImp.DoomBuilder.BuilderModes
{
public partial class PreferencesForm : Form
public partial class PreferencesForm : DelayedForm
{
#region ================== Variables

View file

@ -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;

View file

@ -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

View file

@ -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