mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-22 20:02:48 +00:00
Merge anotak's optimizations - stage 1
This commit is contained in:
parent
34d1af9446
commit
09b8c27dab
19 changed files with 918 additions and 808 deletions
File diff suppressed because it is too large
Load diff
|
@ -53,34 +53,41 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Only when running (this.DesignMode won't do when not this, but one of parent controls is in design mode)
|
||||
if(LicenseManager.UsageMode != LicenseUsageMode.Designtime)
|
||||
{
|
||||
//mxd. Setup script numbers
|
||||
scriptnumbers.Location = new Point(arg0.Location.X, arg0.Location.Y + 2);
|
||||
foreach(ScriptItem si in General.Map.NumberedScripts.Values)
|
||||
scriptnumbers.Items.Add(new ColoredComboBoxItem(si, si.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText));
|
||||
scriptnumbers.DropDownWidth = Tools.GetDropDownWidth(scriptnumbers);
|
||||
|
||||
//mxd. Setup script names
|
||||
if(General.Map.UDMF)
|
||||
{
|
||||
scriptnames.Location = scriptnumbers.Location;
|
||||
foreach(ScriptItem nsi in General.Map.NamedScripts.Values)
|
||||
scriptnames.Items.Add(new ColoredComboBoxItem(nsi, nsi.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText));
|
||||
scriptnames.DropDownWidth = Tools.GetDropDownWidth(scriptnames);
|
||||
}
|
||||
else
|
||||
{
|
||||
scriptnames.Visible = false;
|
||||
cbuseargstr.Visible = false;
|
||||
}
|
||||
}
|
||||
Reset();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region ================== Setup
|
||||
#region ================== Setup
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
// Only when running (this.DesignMode won't do when not this, but one of parent controls is in design mode)
|
||||
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
|
||||
{
|
||||
//mxd. Setup script numbers
|
||||
scriptnumbers.Location = new Point(arg0.Location.X, arg0.Location.Y + 2);
|
||||
scriptnumbers.Items.Clear();
|
||||
foreach (ScriptItem si in General.Map.NumberedScripts.Values)
|
||||
scriptnumbers.Items.Add(new ColoredComboBoxItem(si, si.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText));
|
||||
scriptnumbers.DropDownWidth = Tools.GetDropDownWidth(scriptnumbers);
|
||||
|
||||
//mxd. Setup script names
|
||||
if (General.Map.UDMF)
|
||||
{
|
||||
scriptnames.Items.Clear();
|
||||
scriptnames.Location = scriptnumbers.Location;
|
||||
foreach (ScriptItem nsi in General.Map.NamedScripts.Values)
|
||||
scriptnames.Items.Add(new ColoredComboBoxItem(nsi, nsi.IsInclude ? SystemColors.HotTrack : SystemColors.WindowText));
|
||||
scriptnames.DropDownWidth = Tools.GetDropDownWidth(scriptnames);
|
||||
}
|
||||
else
|
||||
{
|
||||
scriptnames.Visible = false;
|
||||
cbuseargstr.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetValue(Linedef l, bool first)
|
||||
{
|
||||
|
|
|
@ -585,10 +585,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// Show the whole thing
|
||||
this.Show();
|
||||
this.Update();
|
||||
}
|
||||
//this.Update(); // ano - don't think this is needed, and is slow
|
||||
}
|
||||
|
||||
private static void UpdateTexturePanel(Panel panel, string texturename, Label texturenamelabel, Label sizelabel, int maxlabelright, Panel image, int sizeref, bool extendedinfoshown, bool required)
|
||||
private static void UpdateTexturePanel(Panel panel, string texturename, Label texturenamelabel, Label sizelabel, int maxlabelright, Panel image, int sizeref, bool extendedinfoshown, bool required)
|
||||
{
|
||||
// Set texture name
|
||||
texturenamelabel.Text = (texturename.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH ? texturename : texturename.ToUpperInvariant());
|
||||
|
|
|
@ -369,11 +369,11 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// Show the whole thing
|
||||
this.Show();
|
||||
this.Update();
|
||||
}
|
||||
//this.Update(); // ano - don't think this is needed, and is slow
|
||||
}
|
||||
|
||||
//mxd
|
||||
private static void UpdateTexturePanel(GroupBox panel, Label texturename, List<Label> proplabels, Panel image, int sizeref, bool extendedinfoshown)
|
||||
//mxd
|
||||
private static void UpdateTexturePanel(GroupBox panel, Label texturename, List<Label> proplabels, Panel image, int sizeref, bool extendedinfoshown)
|
||||
{
|
||||
//Reposition texture name label?
|
||||
if(texturename.Width < image.Width + 2)
|
||||
|
|
|
@ -41,12 +41,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public TagsSelector()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
tagspermapelement = new List<List<int>>();
|
||||
usedtags = new List<int>();
|
||||
rangemodes = new List<int>();
|
||||
offsetmodes = new List<int>();
|
||||
infos = new List<TagInfo>();
|
||||
Reset();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -154,7 +149,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
else
|
||||
infos.Add(new TagInfo(tag, string.Empty));
|
||||
}
|
||||
|
||||
foreach(TagInfo info in infos) tagpicker.Items.Add(info);
|
||||
tagpicker.DropDownWidth = DoomBuilder.Geometry.Tools.GetDropDownWidth(tagpicker);
|
||||
}
|
||||
|
@ -216,9 +210,21 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
#region ================== Methods
|
||||
public void Reset()
|
||||
{
|
||||
tagspermapelement = new List<List<int>>();
|
||||
usedtags = new List<int>();
|
||||
rangemodes = new List<int>();
|
||||
offsetmodes = new List<int>();
|
||||
infos = new List<TagInfo>();
|
||||
tagslist.Links.Clear();
|
||||
infos.Clear();
|
||||
tagpicker.Items.Clear();
|
||||
usedtags.Clear();
|
||||
}
|
||||
|
||||
// Creates a single tag collection to display. int.MinValue means "mixed tag"
|
||||
private List<int> GetDisplayTags()
|
||||
|
@ -248,10 +254,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
string[] displaytags = new string[tags.Count];
|
||||
int displaytagslen = 0;
|
||||
tagslist.Links.Clear();
|
||||
tagslist.Links.Clear();
|
||||
|
||||
// Gather tags into a single string collection
|
||||
for(int i = 0; i < tags.Count; i++)
|
||||
// Gather tags into a single string collection
|
||||
for (int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
displaytags[i] = (tags[i] == int.MinValue ? "???" : tags[i].ToString());
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// Show the whole thing
|
||||
this.Show();
|
||||
this.Update();
|
||||
//this.Update(); // ano - don't think this is needed, and is slow
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// Show the whole thing
|
||||
this.Show();
|
||||
this.Update();
|
||||
}
|
||||
}
|
||||
//this.Update(); // ano - don't think this is needed, and is slow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
if(map == General.Map.Map)
|
||||
General.Map.UndoRedo.RecAddLinedef(this);
|
||||
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
@ -986,14 +986,21 @@ namespace CodeImp.DoomBuilder.Map
|
|||
// Limit intersection offset to the line
|
||||
if(bounded) if(u < lengthinv) u = lengthinv; else if(u > (1f - lengthinv)) u = 1f - lengthinv;
|
||||
|
||||
// Calculate intersection point
|
||||
Vector2D i = v1 + u * (v2 - v1);
|
||||
/*
|
||||
// Calculate intersection point
|
||||
Vector2D i = v1 + u * (v2 - v1);
|
||||
|
||||
// Return distance between intersection and point
|
||||
// which is the shortest distance to the line
|
||||
float ldx = p.x - i.x;
|
||||
float ldy = p.y - i.y;
|
||||
return ldx * ldx + ldy * ldy;
|
||||
*/
|
||||
|
||||
// ano - let's check to see if we can do the previous faster without using operator overloading and etc
|
||||
// the answer: running it int.MaxValue / 64 times it tended to be around 100ms faster
|
||||
float ldx = p.x - (v1.x + u * (v2.x - v1.x));
|
||||
float ldy = p.y - (v1.y + u * (v2.y - v1.y));
|
||||
return ldx * ldx + ldy * ldy;
|
||||
}
|
||||
|
||||
// This returns the shortest distance from given coordinates to line
|
||||
|
|
|
@ -2194,12 +2194,16 @@ namespace CodeImp.DoomBuilder.Map
|
|||
//DebugConsole.Clear();
|
||||
//DebugConsole.WriteLine("CorrectSectorReferences for " + lines.Count + " lines");
|
||||
|
||||
// ano - set a bunch of foreaches to be for()s because they're faster
|
||||
|
||||
// Create a list of sidedefs to perform sector creation with
|
||||
List<LinedefSide> edges = new List<LinedefSide>();
|
||||
if(existing_only)
|
||||
{
|
||||
foreach(Linedef l in lines)
|
||||
int lineCount = lines.Count;
|
||||
for(int i = 0; i < lineCount; i++)
|
||||
{
|
||||
Linedef l = lines[i];
|
||||
// Add only existing sides as edges (or front side if line has none)
|
||||
if(l.Front != null || l.Back == null)
|
||||
edges.Add(new LinedefSide(l, true));
|
||||
|
@ -2209,10 +2213,12 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
else
|
||||
{
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
// Add front side
|
||||
edges.Add(new LinedefSide(l, true));
|
||||
int lineCount = lines.Count;
|
||||
for (int i = 0; i < lineCount; i++)
|
||||
{
|
||||
Linedef l = lines[i];
|
||||
// Add front side
|
||||
edges.Add(new LinedefSide(l, true));
|
||||
|
||||
// Add back side if there's a sector
|
||||
if(General.Map.Map.GetSectorByCoordinates(l.GetSidePoint(false)) != null)
|
||||
|
@ -2221,9 +2227,11 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
HashSet<Sidedef> sides_correct = new HashSet<Sidedef>();
|
||||
foreach(LinedefSide ls in edges)
|
||||
{
|
||||
if(ls.Front && ls.Line.Front != null)
|
||||
int edgeCount = edges.Count;
|
||||
for (int i = 0; i < edgeCount; i++)
|
||||
{
|
||||
LinedefSide ls = edges[i];
|
||||
if (ls.Front && ls.Line.Front != null)
|
||||
sides_correct.Add(ls.Line.Front);
|
||||
else if(!ls.Front && ls.Line.Back != null)
|
||||
sides_correct.Add(ls.Line.Back);
|
||||
|
@ -2241,11 +2249,12 @@ namespace CodeImp.DoomBuilder.Map
|
|||
SectorBuilder builder = new SectorBuilder();
|
||||
List<Sector> sectors_reused = new List<Sector>();
|
||||
|
||||
foreach(LinedefSide ls in edges)
|
||||
{
|
||||
// Skip if edge is ignored
|
||||
//DebugConsole.WriteLine((ls.Ignore ? "Ignoring line " : "Processing line ") + ls.Line.Index);
|
||||
if(ls.Ignore) continue;
|
||||
for (int i = 0; i < edgeCount; i++)
|
||||
{
|
||||
LinedefSide ls = edges[i];
|
||||
// Skip if edge is ignored
|
||||
//DebugConsole.WriteLine((ls.Ignore ? "Ignoring line " : "Processing line ") + ls.Line.Index);
|
||||
if (ls.Ignore) continue;
|
||||
|
||||
// Run sector builder on current edge
|
||||
if(!builder.TraceSector(ls.Line, ls.Front)) continue; // Don't create sector if trace failed
|
||||
|
@ -2263,9 +2272,10 @@ namespace CodeImp.DoomBuilder.Map
|
|||
if(side_exists && sectorsides.Contains(edge.Front ? edge.Line.Front : edge.Line.Back))
|
||||
has_dragged_sides = true; //mxd
|
||||
|
||||
foreach(LinedefSide ls2 in edges)
|
||||
{
|
||||
if(ls2.Line == edge.Line)
|
||||
for (int k = 0; k < edgeCount; k++)
|
||||
{
|
||||
LinedefSide ls2 = edges[k];
|
||||
if (ls2.Line == edge.Line)
|
||||
{
|
||||
line_is_ours = true;
|
||||
if(ls2.Front == edge.Front)
|
||||
|
@ -2276,12 +2286,16 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
}
|
||||
|
||||
if(line_is_ours)
|
||||
// ano - so this inner part was already commented out
|
||||
// so i just put the /* */ around it
|
||||
/*if(line_is_ours)
|
||||
{
|
||||
//if(edge.Line.Front == null && edge.Line.Back == null)
|
||||
//has_zero_sided_lines = true;
|
||||
}
|
||||
else
|
||||
else*/
|
||||
|
||||
if(!line_is_ours)
|
||||
{
|
||||
has_existing_lines = true;
|
||||
has_existing_sides |= side_exists; //mxd
|
||||
|
@ -2330,10 +2344,11 @@ namespace CodeImp.DoomBuilder.Map
|
|||
builder.CreateSector(sector, null);
|
||||
}
|
||||
|
||||
// Remove any sides that weren't part of a sector
|
||||
foreach(LinedefSide ls in edges)
|
||||
{
|
||||
if(ls.Ignore || ls.Line == null) continue;
|
||||
// Remove any sides that weren't part of a sector
|
||||
for (int i = 0; i < edgeCount; i++)
|
||||
{
|
||||
LinedefSide ls = edges[i];
|
||||
if (ls.Ignore || ls.Line == null) continue;
|
||||
|
||||
if(ls.Front)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2859")]
|
||||
[assembly: AssemblyVersion("2.3.0.2866")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
[assembly: AssemblyHash("5a5c6d0")]
|
||||
[assembly: AssemblyHash("34d1af9")]
|
||||
|
|
|
@ -94,6 +94,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Disposing
|
||||
private bool isdisposed;
|
||||
|
||||
// ano - static stuff to prevent often alloc/dealloc performance hits
|
||||
private static StringFormat strFormat;
|
||||
private static SolidBrush brush;
|
||||
private static Pen pen;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -156,9 +161,11 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
this.texturesize = Size.Empty; //mxd
|
||||
this.updateneeded = true;
|
||||
this.textureupdateneeded = true; //mxd
|
||||
|
||||
// Register as resource
|
||||
General.Map.Graphics.RegisterResource(this);
|
||||
|
||||
InitializeStatics();
|
||||
|
||||
// Register as resource
|
||||
General.Map.Graphics.RegisterResource(this);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
@ -181,8 +188,10 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
this.updateneeded = true;
|
||||
this.textureupdateneeded = true;
|
||||
|
||||
// Register as resource
|
||||
General.Map.Graphics.RegisterResource(this);
|
||||
InitializeStatics();
|
||||
|
||||
// Register as resource
|
||||
General.Map.Graphics.RegisterResource(this);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
@ -206,10 +215,31 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// ano - share resources instead of constantly alloc/dealloc
|
||||
public void InitializeStatics()
|
||||
{
|
||||
if (strFormat == null)
|
||||
{
|
||||
strFormat = new StringFormat();
|
||||
strFormat.FormatFlags = StringFormatFlags.FitBlackBox | StringFormatFlags.NoWrap;
|
||||
strFormat.Alignment = StringAlignment.Center;
|
||||
strFormat.LineAlignment = StringAlignment.Center;
|
||||
}
|
||||
if (brush == null)
|
||||
{
|
||||
// if we actually see magenta, know we made a mistake somewhere
|
||||
brush = new SolidBrush(System.Drawing.Color.Magenta);
|
||||
}
|
||||
if (pen == null)
|
||||
{
|
||||
pen = new Pen(System.Drawing.Color.Magenta);
|
||||
}
|
||||
}
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This updates the text if needed
|
||||
public void Update(float translatex, float translatey, float scalex, float scaley)
|
||||
{
|
||||
|
@ -343,7 +373,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
//mxd
|
||||
private static Bitmap CreateLabelImage(string text, Font font, PixelColor color, PixelColor backcolor, bool drawbg, RectangleF textrect, RectangleF bgrect, Size texturesize, PointF textorigin)
|
||||
{
|
||||
Bitmap result = new Bitmap(texturesize.Width, texturesize.Height);
|
||||
|
@ -354,67 +384,64 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||
|
||||
// Draw text
|
||||
using(StringFormat sf = new StringFormat())
|
||||
// Draw text with BG
|
||||
if(drawbg)
|
||||
{
|
||||
sf.FormatFlags = StringFormatFlags.FitBlackBox | StringFormatFlags.NoWrap;
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
sf.LineAlignment = StringAlignment.Center;
|
||||
GraphicsPath p = new GraphicsPath();
|
||||
float radius = textorigin.X;
|
||||
const float outlinewidth = 1;
|
||||
|
||||
// Draw text with BG
|
||||
if(drawbg)
|
||||
{
|
||||
GraphicsPath p = new GraphicsPath();
|
||||
float radius = textorigin.X;
|
||||
const float outlinewidth = 1;
|
||||
RectangleF pathrect = bgrect;
|
||||
pathrect.Width -= 1;
|
||||
pathrect.Height -= 1;
|
||||
|
||||
RectangleF pathrect = bgrect;
|
||||
pathrect.Width -= 1;
|
||||
pathrect.Height -= 1;
|
||||
// Left line
|
||||
p.AddLine(pathrect.Left, pathrect.Bottom - radius + outlinewidth, pathrect.Left, pathrect.Top + radius);
|
||||
p.AddArc(pathrect.Left, pathrect.Top, radius, radius, 180, 90);
|
||||
|
||||
// Left line
|
||||
p.AddLine(pathrect.Left, pathrect.Bottom - radius + outlinewidth, pathrect.Left, pathrect.Top + radius);
|
||||
p.AddArc(pathrect.Left, pathrect.Top, radius, radius, 180, 90);
|
||||
// Top line
|
||||
p.AddLine(pathrect.Left + radius, pathrect.Top, pathrect.Right - radius, pathrect.Top);
|
||||
p.AddArc(pathrect.Right - radius, pathrect.Top, radius, radius, 270, 90);
|
||||
|
||||
// Top line
|
||||
p.AddLine(pathrect.Left + radius, pathrect.Top, pathrect.Right - radius, pathrect.Top);
|
||||
p.AddArc(pathrect.Right - radius, pathrect.Top, radius, radius, 270, 90);
|
||||
// Right line
|
||||
p.AddLine(pathrect.Right, pathrect.Top + radius, pathrect.Right, pathrect.Bottom - radius);
|
||||
p.AddArc(pathrect.Right - radius, pathrect.Bottom - radius, radius, radius, 0, 90);
|
||||
|
||||
// Right line
|
||||
p.AddLine(pathrect.Right, pathrect.Top + radius, pathrect.Right, pathrect.Bottom - radius);
|
||||
p.AddArc(pathrect.Right - radius, pathrect.Bottom - radius, radius, radius, 0, 90);
|
||||
// Bottom line
|
||||
p.AddLine(pathrect.Left + radius, pathrect.Bottom, pathrect.Left + radius, pathrect.Bottom);
|
||||
p.AddArc(pathrect.Left, pathrect.Bottom - radius, radius, radius, 90, 90);
|
||||
|
||||
// Bottom line
|
||||
p.AddLine(pathrect.Left + radius, pathrect.Bottom, pathrect.Left + radius, pathrect.Bottom);
|
||||
p.AddArc(pathrect.Left, pathrect.Bottom - radius, radius, radius, 90, 90);
|
||||
// Fill'n'draw bg
|
||||
brush.Color = color.ToColor();
|
||||
|
||||
// Fill'n'draw bg
|
||||
using(SolidBrush brush = new SolidBrush(color.ToColor()))
|
||||
g.FillPath(brush, p);
|
||||
g.FillPath(brush, p);
|
||||
|
||||
using(Pen pen = new Pen(backcolor.ToColor(), outlinewidth))
|
||||
g.DrawPath(pen, p);
|
||||
pen.Color = backcolor.ToColor();
|
||||
|
||||
// Draw text
|
||||
textrect.Inflate(4, 2);
|
||||
using(SolidBrush brush = new SolidBrush(backcolor.ToColor()))
|
||||
g.DrawString(text, font, brush, textrect, sf);
|
||||
}
|
||||
// Draw plain text
|
||||
else
|
||||
{
|
||||
RectangleF plainbgrect = textrect;
|
||||
if(text.Length > 1) plainbgrect.Inflate(6, 2);
|
||||
g.DrawPath(pen, p);
|
||||
|
||||
// Draw text
|
||||
textrect.Inflate(4, 2);
|
||||
brush.Color = backcolor.ToColor();
|
||||
|
||||
RectangleF plaintextrect = textrect;
|
||||
plaintextrect.Inflate(6, 4);
|
||||
|
||||
using(SolidBrush brush = new SolidBrush(backcolor.ToColor()))
|
||||
g.FillRectangle(brush, plainbgrect);
|
||||
|
||||
using(SolidBrush brush = new SolidBrush(color.ToColor()))
|
||||
g.DrawString(text, font, brush, plaintextrect, sf);
|
||||
}
|
||||
g.DrawString(text, font, brush, textrect, strFormat);
|
||||
}
|
||||
// Draw plain text
|
||||
else
|
||||
{
|
||||
RectangleF plainbgrect = textrect;
|
||||
if(text.Length > 1) plainbgrect.Inflate(6, 2);
|
||||
|
||||
RectangleF plaintextrect = textrect;
|
||||
plaintextrect.Inflate(6, 4);
|
||||
|
||||
brush.Color = backcolor.ToColor();
|
||||
g.FillRectangle(brush, plainbgrect);
|
||||
|
||||
brush.Color = color.ToColor();
|
||||
g.DrawString(text, font, brush, plaintextrect, strFormat);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -151,9 +151,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
public void Setup(ICollection<Linedef> lines)
|
||||
{
|
||||
preventchanges = true;
|
||||
|
||||
// Keep this list
|
||||
this.lines = lines;
|
||||
|
||||
argscontrol.Reset();
|
||||
undocreated = false;
|
||||
// Keep this list
|
||||
this.lines = lines;
|
||||
if(lines.Count > 1) this.Text = "Edit Linedefs (" + lines.Count + ")";
|
||||
linedefprops = new List<LinedefProperties>();
|
||||
|
||||
|
|
|
@ -245,10 +245,27 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// This sets up the form to edit the given lines
|
||||
public void Setup(ICollection<Linedef> lines)
|
||||
{
|
||||
preventchanges = true;
|
||||
|
||||
// Keep this list
|
||||
this.lines = lines;
|
||||
// Window setup
|
||||
// ano - moved this here because we don't reinstantiate the thing every time anymore
|
||||
if (General.Settings.StoreSelectedEditTab)
|
||||
{
|
||||
int activetab = General.Settings.ReadSetting("windows." + configname + ".activetab", 0);
|
||||
|
||||
// When front or back tab was previously selected, switch to appropriate side (selectfront/selectback are set in BaseVisualGeometrySidedef.OnEditEnd)
|
||||
if ((selectfront || selectback) && (activetab == 1 || activetab == 2))
|
||||
tabs.SelectTab(selectfront ? 1 : 2);
|
||||
else
|
||||
tabs.SelectTab(activetab);
|
||||
}
|
||||
|
||||
preventchanges = true;
|
||||
undocreated = false;
|
||||
argscontrol.Reset();
|
||||
tagsselector.Reset();
|
||||
|
||||
// Keep this list
|
||||
this.lines = lines;
|
||||
|
||||
if(lines.Count > 1) this.Text = "Edit Linedefs (" + lines.Count + ")";
|
||||
linedefprops = new List<LinedefProperties>();
|
||||
|
||||
|
|
|
@ -850,7 +850,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
// Refresh
|
||||
statusbar.Invalidate();
|
||||
this.Update();
|
||||
//this.Update(); // ano - this is unneeded afaict and slow
|
||||
}
|
||||
|
||||
// This changes status text to Ready
|
||||
|
@ -2115,19 +2115,22 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// This checks one of the edit mode items (and unchecks all others)
|
||||
internal void CheckEditModeButton(string modeclassname)
|
||||
{
|
||||
// Go for all items
|
||||
foreach(ToolStripItem i in editmodeitems)
|
||||
// Go for all items
|
||||
//foreach(ToolStripItem item in editmodeitems)
|
||||
int itemCount = editmodeitems.Count;
|
||||
for(int i = 0; i < itemCount; i++)
|
||||
{
|
||||
ToolStripItem item = editmodeitems[i];
|
||||
// Check what type it is
|
||||
if(i is ToolStripMenuItem)
|
||||
if(item is ToolStripMenuItem)
|
||||
{
|
||||
// Check if mode type matches with given name
|
||||
(i as ToolStripMenuItem).Checked = ((i.Tag as EditModeInfo).Type.Name == modeclassname);
|
||||
(item as ToolStripMenuItem).Checked = ((item.Tag as EditModeInfo).Type.Name == modeclassname);
|
||||
}
|
||||
else if(i is ToolStripButton)
|
||||
else if(item is ToolStripButton)
|
||||
{
|
||||
// Check if mode type matches with given name
|
||||
(i as ToolStripButton).Checked = ((i.Tag as EditModeInfo).Type.Name == modeclassname);
|
||||
(item as ToolStripButton).Checked = ((item.Tag as EditModeInfo).Type.Name == modeclassname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2135,12 +2138,15 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// This removes the config-specific editing mode buttons
|
||||
internal void RemoveEditModeButtons()
|
||||
{
|
||||
// Go for all items
|
||||
foreach(ToolStripItem i in editmodeitems)
|
||||
{
|
||||
// Remove it and restart
|
||||
menumode.DropDownItems.Remove(i);
|
||||
i.Dispose();
|
||||
// Go for all items
|
||||
//foreach(ToolStripItem item in editmodeitems)
|
||||
int itemCount = editmodeitems.Count;
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
ToolStripItem item = editmodeitems[i];
|
||||
// Remove it and restart
|
||||
menumode.DropDownItems.Remove(item);
|
||||
item.Dispose();
|
||||
}
|
||||
|
||||
// Done
|
||||
|
|
|
@ -90,9 +90,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
public void Setup(ICollection<Sector> sectors)
|
||||
{
|
||||
preventchanges = true; //mxd
|
||||
|
||||
// Keep this list
|
||||
this.sectors = sectors;
|
||||
undocreated = false;
|
||||
// Keep this list
|
||||
this.sectors = sectors;
|
||||
if(sectors.Count > 1) this.Text = "Edit Sectors (" + sectors.Count + ")";
|
||||
sectorprops = new List<SectorProperties>(); //mxd
|
||||
|
||||
|
|
|
@ -292,9 +292,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
public void Setup(ICollection<Sector> sectors)
|
||||
{
|
||||
preventchanges = true; //mxd
|
||||
|
||||
// Keep this list
|
||||
this.sectors = sectors;
|
||||
undocreated = false;
|
||||
// Keep this list
|
||||
this.sectors = sectors;
|
||||
if(sectors.Count > 1) this.Text = "Edit Sectors (" + sectors.Count + ")";
|
||||
sectorprops = new Dictionary<Sector, SectorProperties>(sectors.Count); //mxd
|
||||
|
||||
|
|
|
@ -141,9 +141,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
public void Setup(ICollection<Thing> things)
|
||||
{
|
||||
preventchanges = true;
|
||||
undocreated = false;
|
||||
argscontrol.Reset();
|
||||
|
||||
// Keep this list
|
||||
this.things = things;
|
||||
// Keep this list
|
||||
this.things = things;
|
||||
if(things.Count > 1) this.Text = "Edit Things (" + things.Count + ")";
|
||||
hint.Visible = things.Count > 1; //mxd
|
||||
hintlabel.Visible = things.Count > 1; //mxd
|
||||
|
|
|
@ -164,9 +164,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
public void Setup(ICollection<Thing> things)
|
||||
{
|
||||
preventchanges = true;
|
||||
undocreated = false;
|
||||
argscontrol.Reset();
|
||||
|
||||
// Keep this list
|
||||
this.things = things;
|
||||
// Keep this list
|
||||
this.things = things;
|
||||
if(things.Count > 1) this.Text = "Edit Things (" + things.Count + ")";
|
||||
hint.Visible = things.Count > 1; //mxd
|
||||
hintlabel.Visible = things.Count > 1; //mxd
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Resources;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2859")]
|
||||
[assembly: AssemblyVersion("2.3.0.2866")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
|
|
Loading…
Reference in a new issue