Expand angle loop settings, clean up thing info panel

This commit is contained in:
spherallic 2022-12-20 18:05:03 +01:00
parent feea30f759
commit b45861bb39
7 changed files with 128 additions and 96 deletions

View file

@ -33,7 +33,6 @@ namespace CodeImp.DoomBuilder.Controls
this.labelaction = new System.Windows.Forms.Label();
this.labelfulltype = new System.Windows.Forms.Label();
this.infopanel = new System.Windows.Forms.GroupBox();
this.anglecontrol = new CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl();
this.classname = new System.Windows.Forms.Label();
this.labelclass = new System.Windows.Forms.Label();
this.parameter = new System.Windows.Forms.Label();
@ -49,48 +48,31 @@ namespace CodeImp.DoomBuilder.Controls
this.arg2 = new System.Windows.Forms.Label();
this.arg1 = new System.Windows.Forms.Label();
this.angle = new System.Windows.Forms.Label();
this.labelangle = new System.Windows.Forms.Label();
this.tag = new System.Windows.Forms.Label();
this.position = new System.Windows.Forms.Label();
this.action = new System.Windows.Forms.Label();
this.fulltype = new System.Windows.Forms.Label();
this.labeltag = new System.Windows.Forms.Label();
this.type = new System.Windows.Forms.Label();
this.spritepanel = new System.Windows.Forms.GroupBox();
this.spritename = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.spritetex = new CodeImp.DoomBuilder.Controls.ConfigurablePictureBox();
this.flagsPanel = new System.Windows.Forms.GroupBox();
this.flags = new System.Windows.Forms.ListView();
this.flagsvaluelabel = new System.Windows.Forms.Label();
this.flagsvalue = new System.Windows.Forms.Label();
this.labelangle = new System.Windows.Forms.Label();
this.labeltag = new System.Windows.Forms.Label();
this.flagsvaluelabel = new System.Windows.Forms.Label();
this.spritetex = new CodeImp.DoomBuilder.Controls.ConfigurablePictureBox();
this.anglecontrol = new CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl();
label3 = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
this.infopanel.SuspendLayout();
this.spritepanel.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.spritetex)).BeginInit();
this.flagsPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.spritetex)).BeginInit();
this.SuspendLayout();
//
// labelangle
//
this.labelangle.AutoSize = true;
this.labelangle.Location = new System.Drawing.Point(165, 79);
this.labelangle.Name = "labelangle";
this.labelangle.Size = new System.Drawing.Size(40, 13);
this.labelangle.TabIndex = 8;
this.labelangle.Text = "Angle:";
//
// labeltag
//
this.labeltag.AutoSize = true;
this.labeltag.Location = new System.Drawing.Point(31, 79);
this.labeltag.Name = "labeltag";
this.labeltag.Size = new System.Drawing.Size(29, 13);
this.labeltag.TabIndex = 4;
this.labeltag.Text = "Tag:";
//
// label3
//
label3.AutoSize = true;
@ -163,15 +145,6 @@ namespace CodeImp.DoomBuilder.Controls
this.infopanel.TabStop = false;
this.infopanel.Text = " Thing ";
//
// anglecontrol
//
this.anglecontrol.Angle = 0;
this.anglecontrol.AngleOffset = 0;
this.anglecontrol.Location = new System.Drawing.Point(235, 73);
this.anglecontrol.Name = "anglecontrol";
this.anglecontrol.Size = new System.Drawing.Size(24, 24);
this.anglecontrol.TabIndex = 38;
//
// classname
//
this.classname.AutoEllipsis = true;
@ -317,6 +290,15 @@ namespace CodeImp.DoomBuilder.Controls
this.angle.TabIndex = 11;
this.angle.Text = "270";
//
// labelangle
//
this.labelangle.AutoSize = true;
this.labelangle.Location = new System.Drawing.Point(165, 79);
this.labelangle.Name = "labelangle";
this.labelangle.Size = new System.Drawing.Size(37, 13);
this.labelangle.TabIndex = 8;
this.labelangle.Text = "Angle:";
//
// tag
//
this.tag.AutoSize = true;
@ -353,6 +335,15 @@ namespace CodeImp.DoomBuilder.Controls
this.fulltype.TabIndex = 5;
this.fulltype.Text = "0";
//
// labeltag
//
this.labeltag.AutoSize = true;
this.labeltag.Location = new System.Drawing.Point(31, 79);
this.labeltag.Name = "labeltag";
this.labeltag.Size = new System.Drawing.Size(29, 13);
this.labeltag.TabIndex = 4;
this.labeltag.Text = "Tag:";
//
// type
//
this.type.AutoSize = true;
@ -393,22 +384,6 @@ namespace CodeImp.DoomBuilder.Controls
this.panel1.Size = new System.Drawing.Size(64, 64);
this.panel1.TabIndex = 0;
//
// spritetex
//
this.spritetex.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.Default;
this.spritetex.Dock = System.Windows.Forms.DockStyle.Fill;
this.spritetex.Highlighted = false;
this.spritetex.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
this.spritetex.Location = new System.Drawing.Point(0, 0);
this.spritetex.Name = "spritetex";
this.spritetex.PageUnit = System.Drawing.GraphicsUnit.Pixel;
this.spritetex.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
this.spritetex.Size = new System.Drawing.Size(60, 60);
this.spritetex.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.spritetex.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
this.spritetex.TabIndex = 0;
this.spritetex.TabStop = false;
//
// flagsPanel
//
this.flagsPanel.Controls.Add(this.flags);
@ -427,6 +402,7 @@ namespace CodeImp.DoomBuilder.Controls
this.flags.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.flags.CheckBoxes = true;
this.flags.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.flags.HideSelection = false;
this.flags.Location = new System.Drawing.Point(6, 18);
this.flags.Name = "flags";
this.flags.Scrollable = false;
@ -441,7 +417,7 @@ namespace CodeImp.DoomBuilder.Controls
this.flagsvalue.AutoSize = true;
this.flagsvalue.Location = new System.Drawing.Point(70, 80);
this.flagsvalue.Name = "flagsvalue";
this.flagsvalue.Size = new System.Drawing.Size(32, 13);
this.flagsvalue.Size = new System.Drawing.Size(13, 13);
this.flagsvalue.TabIndex = 0;
this.flagsvalue.Text = "0";
//
@ -450,10 +426,35 @@ namespace CodeImp.DoomBuilder.Controls
this.flagsvaluelabel.AutoSize = true;
this.flagsvaluelabel.Location = new System.Drawing.Point(6, 80);
this.flagsvaluelabel.Name = "flagsvaluelabel";
this.flagsvaluelabel.Size = new System.Drawing.Size(60, 13);
this.flagsvaluelabel.Size = new System.Drawing.Size(64, 13);
this.flagsvaluelabel.TabIndex = 0;
this.flagsvaluelabel.Text = "Flags value:";
//
// spritetex
//
this.spritetex.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.Default;
this.spritetex.Dock = System.Windows.Forms.DockStyle.Fill;
this.spritetex.Highlighted = false;
this.spritetex.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
this.spritetex.Location = new System.Drawing.Point(0, 0);
this.spritetex.Name = "spritetex";
this.spritetex.PageUnit = System.Drawing.GraphicsUnit.Pixel;
this.spritetex.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
this.spritetex.Size = new System.Drawing.Size(60, 60);
this.spritetex.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.spritetex.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
this.spritetex.TabIndex = 0;
this.spritetex.TabStop = false;
//
// anglecontrol
//
this.anglecontrol.Angle = 0;
this.anglecontrol.AngleOffset = 0;
this.anglecontrol.Location = new System.Drawing.Point(236, 61);
this.anglecontrol.Name = "anglecontrol";
this.anglecontrol.Size = new System.Drawing.Size(36, 36);
this.anglecontrol.TabIndex = 38;
//
// ThingInfoPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -469,8 +470,9 @@ namespace CodeImp.DoomBuilder.Controls
this.infopanel.PerformLayout();
this.spritepanel.ResumeLayout(false);
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.spritetex)).EndInit();
this.flagsPanel.ResumeLayout(false);
this.flagsPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.spritetex)).EndInit();
this.ResumeLayout(false);
}

View file

@ -44,7 +44,7 @@ namespace CodeImp.DoomBuilder.Controls
// Hide stuff when in Doom format
hexenformatwidth = infopanel.Width;
doomformatwidth = infopanel.Width - 190;
doomformatwidth = infopanel.Width - 180;
}
// This shows the info
@ -119,7 +119,7 @@ namespace CodeImp.DoomBuilder.Controls
position.Text = t.Position.x.ToString(CultureInfo.InvariantCulture) + ", " + t.Position.y.ToString(CultureInfo.InvariantCulture) + ", " + zinfo;
tag.Text = t.Tag + (General.Map.Options.TagLabels.ContainsKey(t.Tag) ? " - " + General.Map.Options.TagLabels[t.Tag] : string.Empty);
tag.Enabled = labeltag.Enabled = !General.Map.SRB2;
tag.Enabled = tag.Visible = labeltag.Enabled = labeltag.Visible = !General.Map.SRB2;
if (General.Map.SRB2)
{

View file

@ -117,12 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>

View file

@ -39,7 +39,7 @@
this.Name = "AngleControl";
this.Size = new System.Drawing.Size(40, 40);
this.toolTip.SetToolTip(this, "Left-click (and drag) to set angle snapped to 45-degree increment.\r\nRight-click (" +
"and drag) to set precise angle.\r\nMiddle-click (and drag) to set loop number.");
"and drag) to set precise angle.\r\nMiddle-click (and drag) to set loop number. Hold Shift for larger step size. Hold Ctrl to reset loops.");
this.Load += new System.EventHandler(this.AngleSelector_Load);
this.SizeChanged += new System.EventHandler(this.AngleSelector_SizeChanged);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.AngleSelector_MouseDown);

View file

@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
allowLoops = value;
if (value)
{
this.toolTip.SetToolTip(this, "Left-click (and drag) to set snapped angle.\r\nRight-click (and drag) to set precise angle.\r\nMiddle-click (and drag) to set loop number.");
this.toolTip.SetToolTip(this, "Left-click (and drag) to set snapped angle.\r\nRight-click (and drag) to set precise angle.\r\nMiddle-click (and drag) to set loop number. Hold Shift for larger step size. Hold Ctrl to reset loops.");
}
else
{
@ -80,7 +80,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
[Description("Drag distance in pixels for user to change the loop number.")]
[DefaultValue(16)]
public int TurnThrehold { get { return turnThreshold; } set { turnThreshold = value; } } //JBR
public int TurnThreshold { get { return turnThreshold; } set { turnThreshold = value; } } //JBR
#endregion
@ -197,17 +197,28 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
int loop = GetNumLoops(angle);
if (startAtOne && loop >= 0) loop++;
string loopStr = "↺" + loop.ToString();
string baseAngle = (angle % 360).ToString();
StringFormat strFormat = new StringFormat();
strFormat.LineAlignment = StringAlignment.Far;
strFormat.Alignment = StringAlignment.Far;
if (loop != (startAtOne ? 1 : 0))
{
g.DrawString(loopStr, Font, fill, drawRegion.Right - 1, drawRegion.Bottom - 1, strFormat);
g.DrawString(loopStr, Font, fill, drawRegion.Right + 1, drawRegion.Bottom - 1, strFormat);
g.DrawString(loopStr, Font, fill, drawRegion.Right - 1, drawRegion.Bottom + 1, strFormat);
g.DrawString(loopStr, Font, fill, drawRegion.Right + 1, drawRegion.Bottom + 1, strFormat);
g.DrawString(loopStr, Font, text, drawRegion.Right, drawRegion.Bottom, strFormat);
}
int hpos = drawRegion.Right;
if (loop != (startAtOne ? 1 : 0))
{
g.DrawString(loopStr, Font, fill, hpos - 1, drawRegion.Bottom - 1, strFormat);
g.DrawString(loopStr, Font, fill, hpos + 1, drawRegion.Bottom - 1, strFormat);
g.DrawString(loopStr, Font, fill, hpos - 1, drawRegion.Bottom + 1, strFormat);
g.DrawString(loopStr, Font, fill, hpos + 1, drawRegion.Bottom + 1, strFormat);
g.DrawString(loopStr, Font, text, hpos, drawRegion.Bottom, strFormat);
if (this.Height > 64)
{
g.DrawString(baseAngle, Font, fill, hpos - 1, drawRegion.Bottom - 13, strFormat);
g.DrawString(baseAngle, Font, fill, hpos + 1, drawRegion.Bottom - 13, strFormat);
g.DrawString(baseAngle, Font, fill, hpos - 1, drawRegion.Bottom - 11, strFormat);
g.DrawString(baseAngle, Font, fill, hpos + 1, drawRegion.Bottom - 11, strFormat);
g.DrawString(baseAngle, Font, text, hpos, drawRegion.Bottom - 12, strFormat);
}
}
}
// Draw needle
@ -233,8 +244,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private void AngleSelector_MouseDown(object sender, MouseEventArgs e) //JBR supports looping
{
startClick = new Point(e.X, e.Y);
if (e.Button == MouseButtons.Middle) return;
int thisAngle = XYToDegrees(startClick, origin);
if (e.Button == MouseButtons.Left)
@ -244,7 +253,15 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
}
if (allowLoops) thisAngle += GetNumLoops(angle) * 360;
if (thisAngle != angle)
if (e.Button == MouseButtons.Middle)
{
if ((ModifierKeys & Keys.Control) == Keys.Control)
thisAngle = angle%360;
else
return;
}
if (thisAngle != angle)
{
angle = thisAngle;
if(!this.DesignMode && AngleChanged != null) AngleChanged(this, EventArgs.Empty); //Raise event
@ -259,9 +276,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
int dist = (e.X - startClick.X) - (e.Y - startClick.Y);
if (dist < -turnThreshold || dist >= turnThreshold)
{
int mult = ((ModifierKeys & Keys.Shift) == Keys.Shift) ? 5 : 1;
startClick = new Point(e.X, e.Y);
int thisAngle = angle + 360;
if (dist < 0) thisAngle = angle - 360;
int thisAngle = angle + (360 * mult);
if (dist < 0) thisAngle = angle - (360 * mult);
if (thisAngle != angle)
{

View file

@ -39,7 +39,7 @@
this.Name = "AngleControlF";
this.Size = new System.Drawing.Size(40, 40);
this.toolTip.SetToolTip(this, "Left-click (and drag) to set snapped angle.\r\nRight-click (and drag) to set precis" +
"e angle.\r\nMiddle-click (and drag) to set loop number.");
"e angle.\r\nMiddle-click (and drag) to set loop number. Hold Shift for larger step size. Hold Ctrl to reset loops.");
this.Load += new System.EventHandler(this.AngleSelector_Load);
this.SizeChanged += new System.EventHandler(this.AngleSelector_SizeChanged);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.AngleSelector_MouseDown);

View file

@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
allowLoops = value;
if (value)
{
this.toolTip.SetToolTip(this, "Left-click (and drag) to set snapped angle.\r\nRight-click (and drag) to set precise angle.\r\nMiddle-click (and drag) to set loop number.");
this.toolTip.SetToolTip(this, "Left-click (and drag) to set snapped angle.\r\nRight-click (and drag) to set precise angle.\r\nMiddle-click (and drag) to set loop number. Hold Shift for larger step size. Hold Ctrl to reset loops.");
}
else
{
@ -82,7 +82,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
[Description("Drag distance in pixels for user to change the loop number.")]
[DefaultValue(16)]
public int TurnThrehold { get { return turnThreshold; } set { turnThreshold = value; } } //JBR
public int TurnThreshold { get { return turnThreshold; } set { turnThreshold = value; } } //JBR
[Description("Snap angle in degrees.")]
[DefaultValue(45f)]
@ -206,17 +206,28 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
int loop = GetNumLoops(angle);
if (startAtOne && loop >= 0) loop++;
string loopStr = "↺" + loop.ToString();
StringFormat strFormat = new StringFormat();
string baseAngle = (angle % 360).ToString();
StringFormat strFormat = new StringFormat();
strFormat.LineAlignment = StringAlignment.Far;
strFormat.Alignment = StringAlignment.Far;
if (loop != (startAtOne ? 1 : 0))
{
g.DrawString(loopStr, Font, fill, drawRegion.Right - 1, drawRegion.Bottom - 1, strFormat);
g.DrawString(loopStr, Font, fill, drawRegion.Right + 1, drawRegion.Bottom - 1, strFormat);
g.DrawString(loopStr, Font, fill, drawRegion.Right - 1, drawRegion.Bottom + 1, strFormat);
g.DrawString(loopStr, Font, fill, drawRegion.Right + 1, drawRegion.Bottom + 1, strFormat);
g.DrawString(loopStr, Font, text, drawRegion.Right, drawRegion.Bottom, strFormat);
}
int hpos = drawRegion.Right;
if (loop != (startAtOne ? 1 : 0))
{
g.DrawString(loopStr, Font, fill, hpos - 1, drawRegion.Bottom - 1, strFormat);
g.DrawString(loopStr, Font, fill, hpos + 1, drawRegion.Bottom - 1, strFormat);
g.DrawString(loopStr, Font, fill, hpos - 1, drawRegion.Bottom + 1, strFormat);
g.DrawString(loopStr, Font, fill, hpos + 1, drawRegion.Bottom + 1, strFormat);
g.DrawString(loopStr, Font, text, hpos, drawRegion.Bottom, strFormat);
if (this.Height > 64)
{
g.DrawString(baseAngle, Font, fill, hpos - 1, drawRegion.Bottom - 1 - Font.Size, strFormat);
g.DrawString(baseAngle, Font, fill, hpos + 1, drawRegion.Bottom - 1 - Font.Size, strFormat);
g.DrawString(baseAngle, Font, fill, hpos - 1, drawRegion.Bottom + 1 - Font.Size, strFormat);
g.DrawString(baseAngle, Font, fill, hpos + 1, drawRegion.Bottom + 1 - Font.Size, strFormat);
g.DrawString(baseAngle, Font, text, hpos, drawRegion.Bottom - Font.Size, strFormat);
}
}
}
// Draw needle
@ -242,18 +253,24 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private void AngleSelector_MouseDown(object sender, MouseEventArgs e) //JBR supports looping
{
startClick = new Point(e.X, e.Y);
if (e.Button == MouseButtons.Middle) return;
float thisAngle = XYToDegrees(startClick, origin);
if (e.Button == MouseButtons.Left)
if (e.Button == MouseButtons.Left)
{
thisAngle = (float)Math.Round(thisAngle / snapangle) * snapangle;
if (thisAngle == 360f) thisAngle = 0f;
}
if (allowLoops) thisAngle += (float)GetNumLoops(angle) * 360f;
if (thisAngle != angle)
if (e.Button == MouseButtons.Middle)
{
if ((ModifierKeys & Keys.Control) == Keys.Control)
thisAngle = angle % 360;
else
return;
}
if (thisAngle != angle)
{
angle = thisAngle;
if (!this.DesignMode && AngleChanged != null) AngleChanged(this, EventArgs.Empty); //Raise event
@ -267,10 +284,11 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
{
int dist = (e.X - startClick.X) - (e.Y - startClick.Y);
if (dist < -turnThreshold || dist >= turnThreshold)
{
startClick = new Point(e.X, e.Y);
float thisAngle = angle + 360f;
if (dist < 0) thisAngle = angle - 360f;
{
int mult = ((ModifierKeys & Keys.Shift) == Keys.Shift) ? 5 : 1;
startClick = new Point(e.X, e.Y);
float thisAngle = angle + (360f * mult);
if (dist < 0) thisAngle = angle - (360f * mult);
if (thisAngle != angle)
{