Classic modes: added "Toggle Grid" action (default key is Alt-G), new menu item in the View menu and new toolbar button.

Changed, Things mode, cosmetic: tweaked thing sprite/bounding box appearance a bit more...
Fixed, Linedefs mode, cosmetic: fixed event lines and sector highlights flickering when view panning was started while displaying action highlight.
This commit is contained in:
MaxED 2015-08-04 23:28:02 +00:00
parent ce7510c153
commit b9b5b00213
9 changed files with 151 additions and 83 deletions

View file

@ -116,6 +116,7 @@ namespace CodeImp.DoomBuilder.Config
private bool storeSelectedEditTab;
private bool checkforupdates;
private bool rendercomments;
private bool rendergrid;
// These are not stored in the configuration, only used at runtime
private int defaultbrightness;
@ -203,6 +204,7 @@ namespace CodeImp.DoomBuilder.Config
public bool StoreSelectedEditTab { get { return storeSelectedEditTab; } internal set { storeSelectedEditTab = value; } }
internal bool CheckForUpdates { get { return checkforupdates; } set { checkforupdates = value; } } //mxd
public bool RenderComments { get { return rendercomments; } internal set { rendercomments = value; } } //mxd
public bool RenderGrid { get { return rendergrid; } internal set { rendergrid = value; } } //mxd
//mxd. Left here for compatibility reasons...
public string DefaultTexture { get { return General.Map != null ? General.Map.Options.DefaultWallTexture : "-"; } set { if(General.Map != null) General.Map.Options.DefaultWallTexture = value; } }
@ -313,6 +315,7 @@ namespace CodeImp.DoomBuilder.Config
storeSelectedEditTab = cfg.ReadSetting("storeselectededittab", true);
checkforupdates = cfg.ReadSetting("checkforupdates", true); //mxd
rendercomments = cfg.ReadSetting("rendercomments", true); //mxd
rendergrid = cfg.ReadSetting("rendergrid", true); //mxd
//mxd. Sector defaults
defaultceilheight = cfg.ReadSetting("defaultceilheight", 128);
@ -407,6 +410,7 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("storeselectededittab", storeSelectedEditTab);
cfg.WriteSetting("checkforupdates", checkforupdates); //mxd
cfg.WriteSetting("rendercomments", rendercomments); //mxd
cfg.WriteSetting("rendergrid", rendergrid); //mxd
//mxd. Sector defaults
cfg.WriteSetting("defaultceilheight", defaultceilheight);

View file

@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Constants for static instances
public const float THINGS_BACK_ALPHA = 0.3f;
public const float THINGS_HIDDEN_ALPHA = 0.66f;
public const float THINGS_ALPHA = 0.8f; //mxd
public const float THINGS_ALPHA = 1.0f; //mxd
// Static instances
private static Presentation standard;

View file

@ -18,7 +18,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Drawing;
using CodeImp.DoomBuilder.Map;
using SlimDX.Direct3D9;
@ -45,6 +44,7 @@ namespace CodeImp.DoomBuilder.Rendering
#region ================== Constants
private const float FSAA_FACTOR = 0.6f;
private const int MAP_CENTER_SIZE = 16; //mxd
private const float THING_ARROW_SIZE = 1.4f;
//private const float THING_ARROW_SHRINK = 2f;
//private const float THING_CIRCLE_SIZE = 1f;
@ -822,34 +822,44 @@ namespace CodeImp.DoomBuilder.Rendering
// This renders all grid
private unsafe void RenderBackgroundGrid()
{
Plotter gridplotter;
DataRectangle lockedrect;
// Do we need to redraw grid?
if((lastgridsize != General.Map.Grid.GridSize) || (lastgridscale != scale) ||
(lastgridx != offsetx) || (lastgridy != offsety))
{
// Lock background rendertarget memory
lockedrect = backtex.LockRectangle(0, LockFlags.NoSystemLock);
DataRectangle lockedrect = backtex.LockRectangle(0, LockFlags.NoSystemLock);
// Create a plotter
gridplotter = new Plotter((PixelColor*)lockedrect.Data.DataPointer.ToPointer(), lockedrect.Pitch / sizeof(PixelColor), backsize.Height, backsize.Width, backsize.Height);
Plotter gridplotter = new Plotter((PixelColor*)lockedrect.Data.DataPointer.ToPointer(), lockedrect.Pitch / sizeof(PixelColor), backsize.Height, backsize.Width, backsize.Height);
gridplotter.Clear();
// Render normal grid
RenderGrid(General.Map.Grid.GridSize, General.Colors.Grid, gridplotter);
if(General.Settings.RenderGrid) //mxd
{
// Render normal grid
RenderGrid(General.Map.Grid.GridSize, General.Colors.Grid, gridplotter);
// Render 64 grid
if(General.Map.Grid.GridSize <= 64) RenderGrid(64f, General.Colors.Grid64, gridplotter);
// Render 64 grid
if(General.Map.Grid.GridSize <= 64) RenderGrid(64f, General.Colors.Grid64, gridplotter);
}
else
{
//mxd. Render map format bounds
Vector2D tl = new Vector2D(General.Map.Config.LeftBoundary, General.Map.Config.TopBoundary).GetTransformed(translatex, translatey, scale, -scale);
Vector2D rb = new Vector2D(General.Map.Config.RightBoundary, General.Map.Config.BottomBoundary).GetTransformed(translatex, translatey, scale, -scale);
PixelColor g = General.Colors.Grid64;
gridplotter.DrawGridLineH((int)tl.y, (int)tl.x, (int)rb.x, ref g);
gridplotter.DrawGridLineH((int)rb.y, (int)tl.x, (int)rb.x, ref g);
gridplotter.DrawGridLineV((int)tl.x, (int)tl.y, (int)rb.y, ref g);
gridplotter.DrawGridLineV((int)rb.x, (int)tl.y, (int)rb.y, ref g);
}
//mxd. Render center of map
int size = 16;
Vector2D center = new Vector2D().GetTransformed(translatex, translatey, scale, -scale);
int cx = (int)center.x;
int cy = (int)center.y;
PixelColor c = General.Colors.Highlight;
gridplotter.DrawLineSolid(cx, cy + size, cx, cy - size, ref c);
gridplotter.DrawLineSolid(cx - size, cy, cx + size, cy, ref c);
gridplotter.DrawLineSolid(cx, cy + MAP_CENTER_SIZE, cx, cy - MAP_CENTER_SIZE, ref c);
gridplotter.DrawLineSolid(cx - MAP_CENTER_SIZE, cy, cx + MAP_CENTER_SIZE, cy, ref c);
// Done
backtex.UnlockRectangle(0);
@ -926,6 +936,12 @@ namespace CodeImp.DoomBuilder.Rendering
}
}
//mxd
internal void GridVisibilityChanged()
{
lastgridscale = -1;
}
#endregion
#region ================== Things

View file

@ -382,6 +382,18 @@ dissolveitem
default = 131118; //Ctrl-Del
}
//mxd
togglegrid
{
title = "Toggle Grid";
category = "classic";
description = "Toggles grid rendering in classic modes.";
allowkeys = true;
allowmouse = false;
allowscroll = false;
default = 262215; //Alt-G
}
gridsetup
{
title = "Grid Setup";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -165,8 +165,10 @@ namespace CodeImp.DoomBuilder.Windows
this.buttoninsertprefabfile = new System.Windows.Forms.ToolStripButton();
this.buttoninsertpreviousprefab = new System.Windows.Forms.ToolStripButton();
this.buttonthingsfilter = new System.Windows.Forms.ToolStripButton();
this.thingfilters = new System.Windows.Forms.ToolStripDropDownButton();
this.separatorlinecolors = new System.Windows.Forms.ToolStripSeparator();
this.buttonlinededfcolors = new System.Windows.Forms.ToolStripButton();
this.linedefcolorpresets = new System.Windows.Forms.ToolStripDropDownButton();
this.separatorfilters = new System.Windows.Forms.ToolStripSeparator();
this.buttonfullbrightness = new System.Windows.Forms.ToolStripButton();
this.separatorfullbrightness = new System.Windows.Forms.ToolStripSeparator();
@ -248,8 +250,8 @@ namespace CodeImp.DoomBuilder.Windows
this.dockerscollapser = new System.Windows.Forms.Timer(this.components);
this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.modecontrolsloolbar = new System.Windows.Forms.ToolStrip();
this.linedefcolorpresets = new System.Windows.Forms.ToolStripDropDownButton();
this.thingfilters = new System.Windows.Forms.ToolStripDropDownButton();
this.menutogglegrid = new System.Windows.Forms.ToolStripMenuItem();
this.buttontogglegrid = new System.Windows.Forms.ToolStripButton();
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
@ -633,7 +635,7 @@ namespace CodeImp.DoomBuilder.Windows
this.itemgridinc.Name = "itemgridinc";
this.itemgridinc.Size = new System.Drawing.Size(219, 22);
this.itemgridinc.Tag = "builder_griddec";
this.itemgridinc.Text = "&Increase Grid";
this.itemgridinc.Text = "&Increase Grid Size";
this.itemgridinc.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// itemgriddec
@ -641,7 +643,7 @@ namespace CodeImp.DoomBuilder.Windows
this.itemgriddec.Name = "itemgriddec";
this.itemgriddec.Size = new System.Drawing.Size(219, 22);
this.itemgriddec.Tag = "builder_gridinc";
this.itemgriddec.Text = "&Decrease Grid";
this.itemgriddec.Text = "&Decrease Grid Size";
this.itemgriddec.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// itemdosnaptogrid
@ -724,6 +726,7 @@ namespace CodeImp.DoomBuilder.Windows
this.itemviewceilings,
this.seperatorviewviews,
this.menufullbrightness,
this.menutogglegrid,
this.toolStripSeparator4,
this.menuzoom,
this.menugotocoords,
@ -1204,6 +1207,7 @@ namespace CodeImp.DoomBuilder.Windows
this.linedefcolorpresets,
this.separatorfilters,
this.buttonfullbrightness,
this.buttontogglegrid,
this.separatorfullbrightness,
this.buttonviewnormal,
this.buttonviewbrightness,
@ -1243,7 +1247,7 @@ namespace CodeImp.DoomBuilder.Windows
this.toggleTesting,
this.toggleRendering});
this.toolbarContextMenu.Name = "toolbarContextMenu";
this.toolbarContextMenu.Size = new System.Drawing.Size(174, 224);
this.toolbarContextMenu.Size = new System.Drawing.Size(227, 224);
this.toolbarContextMenu.ImageScalingSize = MainForm.ScaledIconSize;
this.toolbarContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.toolbarContextMenu_Opening);
this.toolbarContextMenu.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.toolbarContextMenu_Closing);
@ -1251,70 +1255,70 @@ namespace CodeImp.DoomBuilder.Windows
// toggleFile
//
this.toggleFile.Name = "toggleFile";
this.toggleFile.Size = new System.Drawing.Size(173, 22);
this.toggleFile.Size = new System.Drawing.Size(226, 22);
this.toggleFile.Text = "New / Open / Save";
this.toggleFile.Click += new System.EventHandler(this.toggleFile_Click);
//
// toggleScript
//
this.toggleScript.Name = "toggleScript";
this.toggleScript.Size = new System.Drawing.Size(173, 22);
this.toggleScript.Size = new System.Drawing.Size(226, 22);
this.toggleScript.Text = "Script Editor";
this.toggleScript.Click += new System.EventHandler(this.toggleScript_Click);
//
// toggleUndo
//
this.toggleUndo.Name = "toggleUndo";
this.toggleUndo.Size = new System.Drawing.Size(173, 22);
this.toggleUndo.Size = new System.Drawing.Size(226, 22);
this.toggleUndo.Text = "Undo / Redo";
this.toggleUndo.Click += new System.EventHandler(this.toggleUndo_Click);
//
// toggleCopy
//
this.toggleCopy.Name = "toggleCopy";
this.toggleCopy.Size = new System.Drawing.Size(173, 22);
this.toggleCopy.Size = new System.Drawing.Size(226, 22);
this.toggleCopy.Text = "Cut / Copy / Paste";
this.toggleCopy.Click += new System.EventHandler(this.toggleCopy_Click);
//
// togglePrefabs
//
this.togglePrefabs.Name = "togglePrefabs";
this.togglePrefabs.Size = new System.Drawing.Size(173, 22);
this.togglePrefabs.Size = new System.Drawing.Size(226, 22);
this.togglePrefabs.Text = "Prefabs";
this.togglePrefabs.Click += new System.EventHandler(this.togglePrefabs_Click);
//
// toggleFilter
//
this.toggleFilter.Name = "toggleFilter";
this.toggleFilter.Size = new System.Drawing.Size(173, 22);
this.toggleFilter.Size = new System.Drawing.Size(226, 22);
this.toggleFilter.Text = "Things Filter / Linedef Colors";
this.toggleFilter.Click += new System.EventHandler(this.toggleFilter_Click);
//
// toggleViewModes
//
this.toggleViewModes.Name = "toggleViewModes";
this.toggleViewModes.Size = new System.Drawing.Size(173, 22);
this.toggleViewModes.Size = new System.Drawing.Size(226, 22);
this.toggleViewModes.Text = "View Modes";
this.toggleViewModes.Click += new System.EventHandler(this.toggleViewModes_Click);
//
// toggleGeometry
//
this.toggleGeometry.Name = "toggleGeometry";
this.toggleGeometry.Size = new System.Drawing.Size(173, 22);
this.toggleGeometry.Size = new System.Drawing.Size(226, 22);
this.toggleGeometry.Text = "Snap / Merge";
this.toggleGeometry.Click += new System.EventHandler(this.toggleGeometry_Click);
//
// toggleTesting
//
this.toggleTesting.Name = "toggleTesting";
this.toggleTesting.Size = new System.Drawing.Size(173, 22);
this.toggleTesting.Size = new System.Drawing.Size(226, 22);
this.toggleTesting.Text = "Testing";
this.toggleTesting.Click += new System.EventHandler(this.toggleTesting_Click);
//
// toggleRendering
//
this.toggleRendering.Name = "toggleRendering";
this.toggleRendering.Size = new System.Drawing.Size(173, 22);
this.toggleRendering.Size = new System.Drawing.Size(226, 22);
this.toggleRendering.Text = "Rendering";
this.toggleRendering.Click += new System.EventHandler(this.toggleRendering_Click);
//
@ -1451,6 +1455,20 @@ namespace CodeImp.DoomBuilder.Windows
this.buttonthingsfilter.Text = "Configure Things Filters";
this.buttonthingsfilter.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// thingfilters
//
this.thingfilters.AutoSize = false;
this.thingfilters.AutoToolTip = false;
this.thingfilters.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.thingfilters.Image = ((System.Drawing.Image)(resources.GetObject("thingfilters.Image")));
this.thingfilters.ImageTransparentColor = System.Drawing.Color.Magenta;
this.thingfilters.Margin = new System.Windows.Forms.Padding(1, 1, 0, 2);
this.thingfilters.Name = "thingfilters";
this.thingfilters.Size = new System.Drawing.Size(120, 22);
this.thingfilters.Text = "(show all)";
this.thingfilters.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.thingfilters.DropDownClosed += new System.EventHandler(this.LoseFocus);
//
// separatorlinecolors
//
this.separatorlinecolors.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
@ -1468,6 +1486,21 @@ namespace CodeImp.DoomBuilder.Windows
this.buttonlinededfcolors.Text = "Configure Linedef Colors";
this.buttonlinededfcolors.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// linedefcolorpresets
//
this.linedefcolorpresets.AutoSize = false;
this.linedefcolorpresets.AutoToolTip = false;
this.linedefcolorpresets.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.linedefcolorpresets.ImageTransparentColor = System.Drawing.Color.Magenta;
this.linedefcolorpresets.Margin = new System.Windows.Forms.Padding(1, 1, 0, 2);
this.linedefcolorpresets.Name = "linedefcolorpresets";
this.linedefcolorpresets.Size = new System.Drawing.Size(120, 22);
this.linedefcolorpresets.Text = "No presets";
this.linedefcolorpresets.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.linedefcolorpresets.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.linedefcolorpresets_DropDownItemClicked);
this.linedefcolorpresets.DropDownClosed += new System.EventHandler(this.LoseFocus);
this.linedefcolorpresets.Click += new System.EventHandler(this.linedefcolorpresets_MouseLeave);
//
// separatorfilters
//
this.separatorfilters.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
@ -1627,7 +1660,7 @@ namespace CodeImp.DoomBuilder.Windows
this.dynamiclightmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.Light;
this.dynamiclightmode.ImageTransparentColor = System.Drawing.Color.Magenta;
this.dynamiclightmode.Name = "dynamiclightmode";
this.dynamiclightmode.Size = new System.Drawing.Size(32, 22);
this.dynamiclightmode.Size = new System.Drawing.Size(32, 20);
this.dynamiclightmode.Tag = "builder_gztogglelights";
this.dynamiclightmode.Text = "Dynamic light mode";
this.dynamiclightmode.ButtonClick += new System.EventHandler(this.InvokeTaggedAction);
@ -1674,7 +1707,7 @@ namespace CodeImp.DoomBuilder.Windows
this.modelrendermode.Image = global::CodeImp.DoomBuilder.Properties.Resources.Model;
this.modelrendermode.ImageTransparentColor = System.Drawing.Color.Magenta;
this.modelrendermode.Name = "modelrendermode";
this.modelrendermode.Size = new System.Drawing.Size(32, 22);
this.modelrendermode.Size = new System.Drawing.Size(32, 20);
this.modelrendermode.Tag = "builder_gztogglemodels";
this.modelrendermode.Text = "Model rendering mode";
this.modelrendermode.ButtonClick += new System.EventHandler(this.InvokeTaggedAction);
@ -1727,7 +1760,7 @@ namespace CodeImp.DoomBuilder.Windows
this.buttontogglefog.Image = global::CodeImp.DoomBuilder.Properties.Resources.fog;
this.buttontogglefog.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttontogglefog.Name = "buttontogglefog";
this.buttontogglefog.Size = new System.Drawing.Size(23, 22);
this.buttontogglefog.Size = new System.Drawing.Size(23, 20);
this.buttontogglefog.Tag = "builder_gztogglefog";
this.buttontogglefog.Text = "Toggle Fog Rendering";
this.buttontogglefog.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -1739,7 +1772,7 @@ namespace CodeImp.DoomBuilder.Windows
this.buttontoggleeventlines.Image = global::CodeImp.DoomBuilder.Properties.Resources.InfoLine;
this.buttontoggleeventlines.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttontoggleeventlines.Name = "buttontoggleeventlines";
this.buttontoggleeventlines.Size = new System.Drawing.Size(23, 22);
this.buttontoggleeventlines.Size = new System.Drawing.Size(23, 20);
this.buttontoggleeventlines.Tag = "builder_gztoggleeventlines";
this.buttontoggleeventlines.Text = "Toggle Event Lines";
this.buttontoggleeventlines.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -1751,7 +1784,7 @@ namespace CodeImp.DoomBuilder.Windows
this.buttontogglevisualvertices.Image = global::CodeImp.DoomBuilder.Properties.Resources.VisualVertices;
this.buttontogglevisualvertices.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttontogglevisualvertices.Name = "buttontogglevisualvertices";
this.buttontogglevisualvertices.Size = new System.Drawing.Size(23, 22);
this.buttontogglevisualvertices.Size = new System.Drawing.Size(23, 20);
this.buttontogglevisualvertices.Tag = "builder_gztogglevisualvertices";
this.buttontogglevisualvertices.Text = "Show Editable Vertices in Visual Mode";
this.buttontogglevisualvertices.Click += new System.EventHandler(this.InvokeTaggedAction);
@ -1769,7 +1802,7 @@ namespace CodeImp.DoomBuilder.Windows
this.buttontest.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.buttontest.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttontest.Name = "buttontest";
this.buttontest.Size = new System.Drawing.Size(32, 22);
this.buttontest.Size = new System.Drawing.Size(32, 20);
this.buttontest.Tag = "builder_testmap";
this.buttontest.Text = "Test Map";
this.buttontest.ButtonClick += new System.EventHandler(this.InvokeTaggedAction);
@ -2314,34 +2347,27 @@ namespace CodeImp.DoomBuilder.Windows
this.modecontrolsloolbar.Text = "toolStrip1";
this.modecontrolsloolbar.Visible = false;
//
// linedefcolorpresets
// menutogglegrid
//
this.linedefcolorpresets.AutoSize = false;
this.linedefcolorpresets.AutoToolTip = false;
this.linedefcolorpresets.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.linedefcolorpresets.ImageTransparentColor = System.Drawing.Color.Magenta;
this.linedefcolorpresets.Margin = new System.Windows.Forms.Padding(1, 1, 0, 2);
this.linedefcolorpresets.Name = "linedefcolorpresets";
this.linedefcolorpresets.Size = new System.Drawing.Size(120, 22);
this.linedefcolorpresets.Text = "No presets";
this.linedefcolorpresets.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.linedefcolorpresets.Click += new System.EventHandler(this.linedefcolorpresets_MouseLeave);
this.linedefcolorpresets.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.linedefcolorpresets_DropDownItemClicked);
this.linedefcolorpresets.DropDownClosed += new System.EventHandler(this.LoseFocus);
this.menutogglegrid.CheckOnClick = true;
this.menutogglegrid.Image = global::CodeImp.DoomBuilder.Properties.Resources.Grid2;
this.menutogglegrid.Name = "menutogglegrid";
this.menutogglegrid.Size = new System.Drawing.Size(215, 22);
this.menutogglegrid.Tag = "builder_togglegrid";
this.menutogglegrid.Text = "&Render Grid";
this.menutogglegrid.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// thingfilters
// buttontogglegrid
//
this.thingfilters.AutoSize = false;
this.thingfilters.AutoToolTip = false;
this.thingfilters.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.thingfilters.Image = ((System.Drawing.Image)(resources.GetObject("thingfilters.Image")));
this.thingfilters.ImageTransparentColor = System.Drawing.Color.Magenta;
this.thingfilters.Margin = new System.Windows.Forms.Padding(1, 1, 0, 2);
this.thingfilters.Name = "thingfilters";
this.thingfilters.Size = new System.Drawing.Size(120, 22);
this.thingfilters.Text = "(show all)";
this.thingfilters.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.thingfilters.DropDownClosed += new System.EventHandler(this.LoseFocus);
this.buttontogglegrid.CheckOnClick = true;
this.buttontogglegrid.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.buttontogglegrid.Image = global::CodeImp.DoomBuilder.Properties.Resources.Grid2;
this.buttontogglegrid.ImageTransparentColor = System.Drawing.Color.Magenta;
this.buttontogglegrid.Name = "buttontogglegrid";
this.buttontogglegrid.Size = new System.Drawing.Size(23, 22);
this.buttontogglegrid.Tag = "builder_togglegrid";
this.buttontogglegrid.Text = "Render Grid";
this.buttontogglegrid.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// MainForm
//
@ -2600,5 +2626,7 @@ namespace CodeImp.DoomBuilder.Windows
private ToolStripButton buttonlinededfcolors;
private ToolStripDropDownButton linedefcolorpresets;
private ToolStripDropDownButton thingfilters;
private ToolStripMenuItem menutogglegrid;
private ToolStripButton buttontogglegrid;
}
}

View file

@ -2068,6 +2068,8 @@ namespace CodeImp.DoomBuilder.Windows
linedefcolorpresets.Visible = General.Settings.ToolbarFilter && maploaded; //mxd
separatorfilters.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
buttonfullbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
buttontogglegrid.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
buttontogglegrid.Checked = General.Settings.RenderGrid; //mxd
separatorfullbrightness.Visible = General.Settings.ToolbarViewModes && maploaded; //mxd
buttonviewbrightness.Visible = General.Settings.ToolbarViewModes && maploaded;
buttonviewceilings.Visible = General.Settings.ToolbarViewModes && maploaded;
@ -2861,6 +2863,20 @@ namespace CodeImp.DoomBuilder.Windows
General.Interface.RedrawDisplay();
}
//mxd
[BeginAction("togglegrid")]
protected void ToggleGrid()
{
General.Settings.RenderGrid = !General.Settings.RenderGrid;
menutogglegrid.Checked = General.Settings.RenderGrid;
buttontogglegrid.Checked = General.Settings.RenderGrid;
General.Interface.DisplayStatus(StatusType.Action, "Grid rendering is " + (General.Settings.RenderGrid ? "ENABLED" : "DISABLED"));
// Redraw display to show changes
General.Map.CRenderer2D.GridVisibilityChanged();
General.Interface.RedrawDisplay();
}
//mxd
[BeginAction("toggleautoclearsidetextures")]
internal void ToggleAutoClearSideTextures()
@ -2902,6 +2918,8 @@ namespace CodeImp.DoomBuilder.Windows
menuzoom.Enabled = (General.Map != null);
menugotocoords.Enabled = (General.Map != null); //mxd
menufullbrightness.Enabled = (General.Map != null); //mxd
menutogglegrid.Enabled = (General.Map != null); //mxd
menutogglegrid.Checked = General.Settings.RenderGrid; //mxd
itemtoggleinfo.Enabled = (General.Map != null); //mxd
itemtoggleinfo.Checked = IsInfoPanelExpanded;
itemtogglecomments.Enabled = (General.Map != null && General.Map.UDMF); //mxd

View file

@ -692,18 +692,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
protected override void BeginViewPan()
{
if(insertpreview.IsFinite())
{
insertpreview.x = float.NaN;
//undraw preveiw
if(renderer.StartOverlay(true))
{
renderer.Finish();
renderer.Present();
}
}
// We don't want vertex preview while panning
insertpreview.x = float.NaN;
base.BeginViewPan();
}

View file

@ -49,7 +49,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Highlighted item
protected Vertex highlighted;
private Vector2D insertPreview = new Vector2D(float.NaN, float.NaN); //mxd
private Vector2D insertpreview = new Vector2D(float.NaN, float.NaN); //mxd
// Interface
private bool editpressed;
@ -472,18 +472,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
List<Vector2D> points = l.GetGridIntersections();
if(points.Count == 0)
{
insertPreview = l.NearestOnLine(mousemappos);
insertpreview = l.NearestOnLine(mousemappos);
}
else
{
insertPreview = mousemappos;
insertpreview = mousemappos;
float distance = float.MaxValue;
foreach(Vector2D p in points)
{
float pdist = Vector2D.DistanceSq(p, mousemappos);
if(pdist < distance)
{
insertPreview = p;
insertpreview = p;
distance = pdist;
}
}
@ -492,23 +492,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
else
{
// Just use the nearest point on line
insertPreview = l.NearestOnLine(mousemappos);
insertpreview = l.NearestOnLine(mousemappos);
}
//render preview
if(renderer.StartOverlay(true))
{
float dist = Math.Min(Vector2D.Distance(mousemappos, insertPreview), BuilderPlug.Me.SplitLinedefsRange);
float dist = Math.Min(Vector2D.Distance(mousemappos, insertpreview), BuilderPlug.Me.SplitLinedefsRange);
byte alpha = (byte)(255 - (dist / BuilderPlug.Me.SplitLinedefsRange) * 128);
float vsize = (renderer.VertexSize + 1.0f) / renderer.Scale;
renderer.RenderRectangleFilled(new RectangleF(insertPreview.x - vsize, insertPreview.y - vsize, vsize * 2.0f, vsize * 2.0f), General.Colors.InfoLine.WithAlpha(alpha), true);
renderer.RenderRectangleFilled(new RectangleF(insertpreview.x - vsize, insertpreview.y - vsize, vsize * 2.0f, vsize * 2.0f), General.Colors.InfoLine.WithAlpha(alpha), true);
renderer.Finish();
renderer.Present();
}
}
else if(insertPreview.IsFinite())
else if(insertpreview.IsFinite())
{
insertPreview.x = float.NaN;
insertpreview.x = float.NaN;
//undraw preveiw
if(renderer.StartOverlay(true))
@ -538,9 +538,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
protected override void BeginViewPan()
{
if (insertPreview.IsFinite())
if (insertpreview.IsFinite())
{
insertPreview.x = float.NaN;
insertpreview.x = float.NaN;
//undraw preveiw
if (renderer.StartOverlay(true))