mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Added some disposers here and there.
This commit is contained in:
parent
28f306489a
commit
cfae82afe4
20 changed files with 79 additions and 63 deletions
|
@ -175,6 +175,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Draw item
|
||||
e.Graphics.FillRectangle(backbrush, e.Bounds);
|
||||
e.Graphics.DrawString(displayname, list.Font, displaybrush, e.Bounds.X, e.Bounds.Y);
|
||||
|
||||
//mxd. Dispose brushes
|
||||
backbrush.Dispose();
|
||||
displaybrush.Dispose();
|
||||
}
|
||||
|
||||
// List closed
|
||||
|
|
2
Source/Core/Controls/AngleControl.Designer.cs
generated
2
Source/Core/Controls/AngleControl.Designer.cs
generated
|
@ -151,8 +151,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
this.Name = "AngleControl";
|
||||
this.Size = new System.Drawing.Size(84, 84);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.AngleControl_Paint);
|
||||
this.Layout += new System.Windows.Forms.LayoutEventHandler(this.AngleControl_Layout);
|
||||
this.Resize += new System.EventHandler(this.AngleControl_Resize);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
|
@ -85,25 +85,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
#region ================== Interface
|
||||
|
||||
// Size changed
|
||||
protected override void OnClientSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnClientSizeChanged(e);
|
||||
AngleControl_Resize(this, e);
|
||||
}
|
||||
|
||||
// Layout changed
|
||||
private void AngleControl_Layout(object sender, LayoutEventArgs e)
|
||||
{
|
||||
AngleControl_Resize(sender, e);
|
||||
}
|
||||
|
||||
// Size changed
|
||||
private void AngleControl_Resize(object sender, EventArgs e)
|
||||
{
|
||||
//this.Size = new Size(84, 84);
|
||||
}
|
||||
|
||||
// Redraw the control
|
||||
private void AngleControl_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
@ -125,6 +106,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
e.Graphics.DrawLine(linepen, start, start);
|
||||
}
|
||||
linepen.Dispose(); //mxd
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -156,8 +156,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
if(this.DesignMode)
|
||||
{
|
||||
Pen p = new Pen(SystemColors.ControlDark, 1) {DashStyle = DashStyle.Dash};
|
||||
e.Graphics.DrawRectangle(p, 0, 0, this.ClientRectangle.Width - 1, this.ClientRectangle.Height - 1);
|
||||
using (Pen p = new Pen(SystemColors.ControlDark, 1) { DashStyle = DashStyle.Dash })
|
||||
{
|
||||
e.Graphics.DrawRectangle(p, 0, 0, this.ClientRectangle.Width - 1, this.ClientRectangle.Height - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// find the rectangle for the splitter and paint it
|
||||
Rectangle r = this.SplitterRectangle;
|
||||
e.Graphics.FillRectangle(new SolidBrush(this.BackColor), r);
|
||||
using(SolidBrush brushbg = new SolidBrush(this.BackColor))
|
||||
{
|
||||
e.Graphics.FillRectangle(brushbg, r);
|
||||
}
|
||||
|
||||
Pen pendark = new Pen(SystemColors.ControlDark);
|
||||
SolidBrush brushlightlight = new SolidBrush(SystemColors.ControlLightLight);
|
||||
|
@ -182,7 +185,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
bounds = new Rectangle(r.X, r.Y + ((r.Height - scaled[115]) / 2), scaled[8], scaled[115]);
|
||||
|
||||
// draw the background color for our control image
|
||||
e.Graphics.FillRectangle(new SolidBrush(hot ? hotcolor : this.BackColor), new Rectangle(bounds.X + scaled[1], bounds.Y, scaled[6], scaled[115]));
|
||||
using (SolidBrush bg = new SolidBrush(hot ? hotcolor : this.BackColor))
|
||||
{
|
||||
e.Graphics.FillRectangle(bg, new Rectangle(bounds.X + scaled[1], bounds.Y, scaled[6], scaled[115]));
|
||||
}
|
||||
|
||||
// draw the top & bottom lines for our control image
|
||||
e.Graphics.DrawLine(pendark, bounds.X + scaled[1], bounds.Y, bounds.X + bounds.Width - scaled[2], bounds.Y);
|
||||
|
@ -219,7 +225,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
bounds = new Rectangle(r.X + ((r.Width - scaled[115]) / 2), r.Y, scaled[115], scaled[8]);
|
||||
|
||||
// draw the background color for our control image
|
||||
e.Graphics.FillRectangle(new SolidBrush(hot ? hotcolor : this.BackColor), new Rectangle(bounds.X, bounds.Y + scaled[1], scaled[115], scaled[6]));
|
||||
using (SolidBrush bg = new SolidBrush(hot ? hotcolor : this.BackColor))
|
||||
{
|
||||
e.Graphics.FillRectangle(bg, new Rectangle(bounds.X, bounds.Y + scaled[1], scaled[115], scaled[6]));
|
||||
}
|
||||
|
||||
// draw the left & right lines for our control image
|
||||
e.Graphics.DrawLine(pendark, bounds.X, bounds.Y + scaled[1], bounds.X, bounds.Y + bounds.Height - scaled[2]);
|
||||
|
@ -249,7 +258,13 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// dark dot
|
||||
e.Graphics.FillRectangle(brushdark, x + (i * scaled[3]), y + scaled[1], scaled[2], scaled[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Dispose brushes
|
||||
pendark.Dispose();
|
||||
brushlightlight.Dispose();
|
||||
brushdark.Dispose();
|
||||
brushdarkdark.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
Brush brush = new SolidBrush(item.ForeColor);
|
||||
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) brush = Brushes.White;
|
||||
e.Graphics.DrawString(item.Text, this.Font, brush, e.Bounds.X, e.Bounds.Y);
|
||||
brush.Dispose(); //mxd
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,11 +134,16 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
textsize = g.MeasureString(imagesize, sizefont, bounds.Width * 2);
|
||||
textpos = new PointF(bounds.Left + textsize.Width / 2, bounds.Top + 1);
|
||||
imagerect = new Rectangle(bounds.Left + 1, bounds.Top + 1, (int)textsize.Width, (int)textsize.Height);
|
||||
SolidBrush labelbg = new SolidBrush(Color.FromArgb(196, base.ListView.ForeColor));
|
||||
|
||||
// Draw
|
||||
g.FillRectangle(labelbg, imagerect);
|
||||
g.DrawString(imagesize, sizefont, new SolidBrush(base.ListView.BackColor), textpos, format);
|
||||
using (SolidBrush labelbg = new SolidBrush(Color.FromArgb(196, base.ListView.ForeColor)))
|
||||
{
|
||||
g.FillRectangle(labelbg, imagerect);
|
||||
}
|
||||
using (SolidBrush labelcolor = new SolidBrush(base.ListView.BackColor))
|
||||
{
|
||||
g.DrawString(imagesize, sizefont, labelcolor, textpos, format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,8 +155,12 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
g.SmoothingMode = SmoothingMode.HighSpeed; //Make the square edges sharp
|
||||
g.FillRectangle(center, originSquare);
|
||||
|
||||
//mxd. Dispose brushes
|
||||
fill.Dispose();
|
||||
center.Dispose();
|
||||
outline.Dispose();
|
||||
marks.Dispose();
|
||||
needle.Dispose();
|
||||
|
||||
base.OnPaint(e);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
LinedefColorPreset preset = (LinedefColorPreset)Items[e.Index];
|
||||
|
||||
//draw color rectangle
|
||||
e.Graphics.FillRectangle(new SolidBrush(preset.Color.ToColor()), 2, e.Bounds.Top + 2, e.Bounds.Height, e.Bounds.Height - 5);
|
||||
e.Graphics.DrawRectangle(new Pen(Color.Black), 2, e.Bounds.Top + 2, e.Bounds.Height, e.Bounds.Height - 5);
|
||||
using(SolidBrush bg = new SolidBrush(preset.Color.ToColor()))
|
||||
{
|
||||
e.Graphics.FillRectangle(bg, 2, e.Bounds.Top + 2, e.Bounds.Height, e.Bounds.Height - 5);
|
||||
}
|
||||
using (Pen outline = new Pen(Color.Black))
|
||||
{
|
||||
e.Graphics.DrawRectangle(outline, 2, e.Bounds.Top + 2, e.Bounds.Height, e.Bounds.Height - 5);
|
||||
}
|
||||
|
||||
//draw text
|
||||
e.Graphics.DrawString(preset.ToString(), e.Font, new SolidBrush(e.ForeColor), e.Bounds.Left + e.Bounds.Height + 4, e.Bounds.Top);
|
||||
|
|
|
@ -862,14 +862,17 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
Update();
|
||||
if (tn.BackColor != SelectionBackColor)
|
||||
{
|
||||
g.DrawRectangle(new Pen(new SolidBrush(SelectionBackColor), 1), rect);
|
||||
using(Pen p = new Pen(SelectionBackColor, 1)) g.DrawRectangle(p, rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tn.BackColor != SelectionBackColor)
|
||||
{
|
||||
g.DrawRectangle(new Pen(new SolidBrush(BackColor), 1), tnMostRecentSelectedNode.Bounds.X, tnMostRecentSelectedNode.Bounds.Y, tnMostRecentSelectedNode.Bounds.Width, tnMostRecentSelectedNode.Bounds.Height);
|
||||
using (Pen p = new Pen(BackColor, 1))
|
||||
{
|
||||
g.DrawRectangle(p, tnMostRecentSelectedNode.Bounds.X, tnMostRecentSelectedNode.Bounds.Y, tnMostRecentSelectedNode.Bounds.Width, tnMostRecentSelectedNode.Bounds.Height);
|
||||
}
|
||||
}
|
||||
this.Invalidate(rect, false);
|
||||
Update();
|
||||
|
|
|
@ -731,12 +731,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
|
|||
|
||||
mde.Model.BoundingBox = BoundingBoxTools.CalculateBoundingBox(bbs);
|
||||
|
||||
//create bitmap
|
||||
Bitmap bmp = CreateVoxelTexture(palette);
|
||||
|
||||
//create texture
|
||||
MemoryStream memstream = new MemoryStream((4096 * 4) + 4096);
|
||||
bmp.Save(memstream, ImageFormat.Bmp);
|
||||
using (Bitmap bmp = CreateVoxelTexture(palette)) bmp.Save(memstream, ImageFormat.Bmp);
|
||||
memstream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
Texture texture = Texture.FromStream(device, memstream, (int)memstream.Length, 64, 64, 0, Usage.None, Format.Unknown, Pool.Managed, Filter.Point, Filter.Box, 0);
|
||||
|
@ -840,6 +837,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
|
|||
gs.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
gs.DrawImage(bmp, new Rectangle(0, 0, 64, 64), new Rectangle(0, 0, 16, 16), GraphicsUnit.Pixel);
|
||||
}
|
||||
bmp.Dispose();
|
||||
|
||||
return scaled;
|
||||
}
|
||||
|
|
|
@ -64,11 +64,6 @@ namespace CodeImp.DoomBuilder.Types
|
|||
|
||||
#region ================== Constructor
|
||||
|
||||
// Constructor
|
||||
public TypeHandler()
|
||||
{
|
||||
}
|
||||
|
||||
// This sets up the handler for arguments
|
||||
public virtual void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
|
||||
{
|
||||
|
|
|
@ -441,7 +441,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
tooltip.SetToolTip(label, null);
|
||||
label.Font = new Font(label.Font, FontStyle.Regular);
|
||||
label.ForeColor = SystemColors.WindowText;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -708,7 +708,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
tooltip.SetToolTip(label, null);
|
||||
label.Font = new Font(label.Font, FontStyle.Regular);
|
||||
label.ForeColor = SystemColors.WindowText;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3098,13 +3098,15 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
//draw info
|
||||
Font font = new Font("Tahoma", 10);
|
||||
SolidBrush brush = new SolidBrush(Color.White);
|
||||
SizeF rect = g.MeasureString(info, font);
|
||||
float px = bounds.Width - rect.Width - 4;
|
||||
float py = 4;
|
||||
|
||||
g.FillRectangle(Brushes.Black, px, py, rect.Width, rect.Height + 3);
|
||||
g.DrawString(info, font, brush, px + 2, py + 2);
|
||||
using(SolidBrush brush = new SolidBrush(Color.White))
|
||||
{
|
||||
g.DrawString(info, font, brush, px + 2, py + 2);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
|
|
@ -341,7 +341,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
tooltip.SetToolTip(label, null);
|
||||
label.Font = new Font(label.Font, FontStyle.Regular);
|
||||
label.ForeColor = SystemColors.WindowText;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -420,7 +420,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
tooltip.SetToolTip(label, null);
|
||||
label.Font = new Font(label.Font, FontStyle.Regular);
|
||||
label.ForeColor = SystemColors.WindowText;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -265,14 +265,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
foreach(SortedVisualSide side in pair.Value)
|
||||
{
|
||||
Color c = General.Colors.BrightColors[General.Random(0, General.Colors.BrightColors.Length - 1)].ToColor();
|
||||
Pen p = new Pen(c);
|
||||
Brush b = new SolidBrush(c);
|
||||
|
||||
int x = side.Bounds.X - minx + margin;
|
||||
int y = side.Bounds.Y - miny + margin;
|
||||
|
||||
g.DrawRectangle(p, x, y, side.Bounds.Width, side.Bounds.Height);
|
||||
g.DrawString(i++ + ": line " + side.Side.Sidedef.Line.Index + "; x:" + side.Bounds.X + " y:" + side.Bounds.Y, this.Font, b, x + 2, y + 2);
|
||||
using (Pen p = new Pen(c))
|
||||
{
|
||||
g.DrawRectangle(p, x, y, side.Bounds.Width, side.Bounds.Height);
|
||||
}
|
||||
using (Brush b = new SolidBrush(c))
|
||||
{
|
||||
g.DrawString(i++ + ": line " + side.Side.Sidedef.Line.Index + "; x:" + side.Bounds.X + " y:" + side.Bounds.Y, this.Font, b, x + 2, y + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ namespace CodeImp.DoomBuilder.CommentsPanel
|
|||
public partial class CommentsDocker : UserControl
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
Dictionary<string, CommentInfo> v_comments = new Dictionary<string, CommentInfo>(StringComparer.Ordinal);
|
||||
Dictionary<string, CommentInfo> l_comments = new Dictionary<string, CommentInfo>(StringComparer.Ordinal);
|
||||
Dictionary<string, CommentInfo> s_comments = new Dictionary<string, CommentInfo>(StringComparer.Ordinal);
|
||||
Dictionary<string, CommentInfo> t_comments = new Dictionary<string, CommentInfo>(StringComparer.Ordinal);
|
||||
bool preventupdate;
|
||||
|
||||
private readonly Dictionary<string, CommentInfo> v_comments = new Dictionary<string, CommentInfo>(StringComparer.Ordinal);
|
||||
private readonly Dictionary<string, CommentInfo> l_comments = new Dictionary<string, CommentInfo>(StringComparer.Ordinal);
|
||||
private readonly Dictionary<string, CommentInfo> s_comments = new Dictionary<string, CommentInfo>(StringComparer.Ordinal);
|
||||
private readonly Dictionary<string, CommentInfo> t_comments = new Dictionary<string, CommentInfo>(StringComparer.Ordinal);
|
||||
private bool preventupdate;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -121,14 +121,13 @@ namespace CodeImp.DoomBuilder.CommentsPanel
|
|||
// Update the list with comments
|
||||
foreach(KeyValuePair<string, CommentInfo> c in newcomments)
|
||||
{
|
||||
DataGridViewRow row;
|
||||
CommentInfo cc = c.Value;
|
||||
|
||||
if(!comments.ContainsKey(c.Key))
|
||||
{
|
||||
// Create grid row
|
||||
int index = grid.Rows.Add();
|
||||
row = grid.Rows[index];
|
||||
DataGridViewRow row = grid.Rows[index];
|
||||
row.Cells[0].Value = icon;
|
||||
row.Cells[0].Style.Alignment = DataGridViewContentAlignment.TopCenter;
|
||||
row.Cells[0].Style.Padding = new Padding(0, 5, 0, 0);
|
||||
|
@ -143,7 +142,7 @@ namespace CodeImp.DoomBuilder.CommentsPanel
|
|||
else
|
||||
{
|
||||
cc = comments[c.Key];
|
||||
row = cc.Row;
|
||||
//row = cc.Row;
|
||||
cc.ReplaceElements(c.Value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,6 +200,9 @@ namespace CodeImp.DoomBuilder.SoundPropagationMode
|
|||
{
|
||||
base.Dispose();
|
||||
|
||||
//mxd
|
||||
foreach (Bitmap b in distincticons) b.Dispose();
|
||||
|
||||
// This must be called to remove bound methods for actions.
|
||||
General.Actions.UnbindMethods(this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue