Added, Draw Ellipse mode: added "Angle" parameter. Can be used to rotate the shape.

Changed, Draw Ellipse mode: lowered minimum subdivisions to 3.
Fixed, Browse Action and Browse Effect windows: first option was always selected for any generalized action/effect parameter during generalized action/effect setup.
This commit is contained in:
MaxED 2016-03-06 20:52:19 +00:00
parent 831cff45e6
commit b7b0041388
7 changed files with 70 additions and 12 deletions

View file

@ -749,7 +749,7 @@ namespace CodeImp.DoomBuilder
MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
// Go to DirectX End-User Runtime Web Installer page (mxd)
OpenWebsite("http://www.microsoft.com/en-us/download/details.aspx?id=35");
OpenWebsite("https://www.microsoft.com/en-us/download/details.aspx?id=35&44F86079-8679-400C-BFF2-9CA5F2BCBDFC=1");
}
// End program here

View file

@ -101,7 +101,7 @@ namespace CodeImp.DoomBuilder.Windows
if((actionbits & ab.Index) == ab.Index)
{
options[i].SelectedItem = ab;
break; //mxd
if(ab.Index > 0) break; //mxd
}
}
}

View file

@ -88,7 +88,7 @@ namespace CodeImp.DoomBuilder.Windows
if((effect & ab.Index) == ab.Index)
{
options[i].SelectedItem = ab;
break; //mxd
if(ab.Index > 0) break; //mxd
}
}
}

View file

@ -21,6 +21,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
#region ================== Variables
// Drawing
private float angle; // in radians
// Interface
private DrawEllipseOptionsPanel panel;
@ -35,11 +38,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
override protected void SetupInterface()
{
maxsubdivisions = 512;
minsubdivisions = 4;
minsubdivisions = 3;
minpointscount = 3;
alwaysrendershapehints = true;
// Load stored settings
subdivisions = General.Clamp(General.Settings.ReadPluginSetting("drawellipsemode.subdivisions", 8), minsubdivisions, maxsubdivisions);
bevelwidth = General.Settings.ReadPluginSetting("drawellipsemode.bevelwidth", 0);
int angledeg = General.Settings.ReadPluginSetting("drawellipsemode.angle", 0);
angle = Angle2D.DegToRad(angledeg);
currentbevelwidth = bevelwidth;
//Add options docker
@ -49,6 +56,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
panel.MinSpikiness = (int)General.Map.FormatInterface.MinCoordinate;
panel.MaxSpikiness = (int)General.Map.FormatInterface.MaxCoordinate;
panel.Spikiness = bevelwidth;
panel.Angle = angledeg;
panel.Subdivisions = subdivisions;
panel.OnValueChanged += OptionsPanelOnValueChanged;
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
@ -67,6 +75,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Store settings
General.Settings.WritePluginSetting("drawellipsemode.subdivisions", subdivisions);
General.Settings.WritePluginSetting("drawellipsemode.bevelwidth", bevelwidth);
General.Settings.WritePluginSetting("drawellipsemode.angle", panel.Angle);
General.Settings.WritePluginSetting("drawellipsemode.continuousdrawing", panel.ContinuousDrawing);
// Remove the buttons
@ -100,7 +109,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
int hh = height / 2;
Vector2D center = new Vector2D(pStart.x + hw, pStart.y + hh);
float curAngle = 0;
float curAngle = angle;
float angleStep = -Angle2D.PI / subdivisions * 2;
for(int i = 0; i < subdivisions; i++)
@ -139,6 +148,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
switch(points.Count - 1) // Last point matches the first one
{
case 3: undoname = "Triangle draw"; shapename = "triangle"; break;
case 4: undoname = "Rhombus draw"; shapename = "rhombus"; break;
case 5: undoname = "Pentagon draw"; shapename = "pentagon"; break;
case 6: undoname = "Hexagon draw"; shapename = "hexagon"; break;
@ -166,6 +176,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
bevelwidth = panel.Spikiness;
subdivisions = Math.Min(maxsubdivisions, panel.Subdivisions);
angle = Angle2D.DegToRad(panel.Angle);
Update();
}

View file

@ -44,6 +44,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected Vector2D end;
protected int width;
protected int height;
protected int minpointscount;
protected bool alwaysrendershapehints;
// Interface
private DrawRectangleOptionsPanel panel;
@ -78,6 +80,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void SetupInterface()
{
maxsubdivisions = 16;
minpointscount = 4;
// Load stored settings
subdivisions = General.Clamp(General.Settings.ReadPluginSetting("drawrectanglemode.subdivisions", 0), minsubdivisions, maxsubdivisions);
@ -158,7 +161,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
//got beveled corners?
if(shape.Length > 5)
if(alwaysrendershapehints || shape.Length > minpointscount + 1)
{
//render hint
if(width > 64 * vsize && height > 16 * vsize)
@ -265,11 +268,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
return "BVL: " + bevelwidth + "; SUB: " + subdivisions;
}
//update top-left and bottom-right points, which define drawing shape
// Update top-left and bottom-right points, which define drawing shape
private void UpdateReferencePoints(DrawnVertex p1, DrawnVertex p2)
{
if(!p1.pos.IsFinite() || !p2.pos.IsFinite()) return;
// Make sure start always stays at left and up from the end
if(p1.pos.x < p2.pos.x)
{
start.x = p1.pos.x;
@ -292,6 +296,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
end.y = p1.pos.y;
}
// Update size
width = (int)(end.x - start.x);
height = (int)(end.y - start.y);
}
@ -351,7 +356,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Settings.FindDefaultDrawSettings();
// When we have a rectangle or a line
if(points.Count > 4 || points.Count == 2)
if(points.Count > minpointscount || points.Count == 2)
{
// Make undo for the draw
General.Map.UndoRedo.CreateUndo(undoname);

View file

@ -35,6 +35,8 @@
this.subdivs = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
this.spikinesslabel = new System.Windows.Forms.ToolStripLabel();
this.spikiness = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
this.anglelabel = new System.Windows.Forms.ToolStripLabel();
this.angle = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
this.reset = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
@ -48,10 +50,12 @@
this.subdivs,
this.spikinesslabel,
this.spikiness,
this.anglelabel,
this.angle,
this.reset});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(348, 25);
this.toolStrip1.Size = new System.Drawing.Size(582, 25);
this.toolStrip1.TabIndex = 6;
this.toolStrip1.Text = "toolStrip1";
//
@ -126,6 +130,35 @@
0,
0,
0,
0});
//
// anglelabel
//
this.anglelabel.Name = "anglelabel";
this.anglelabel.Size = new System.Drawing.Size(41, 22);
this.anglelabel.Text = "Angle:";
//
// angle
//
this.angle.AutoSize = false;
this.angle.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.angle.Maximum = new decimal(new int[] {
360,
0,
0,
0});
this.angle.Minimum = new decimal(new int[] {
360,
0,
0,
-2147483648});
this.angle.Name = "angle";
this.angle.Size = new System.Drawing.Size(56, 23);
this.angle.Text = "0";
this.angle.Value = new decimal(new int[] {
0,
0,
0,
0});
//
// reset
@ -134,7 +167,7 @@
this.reset.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Reset;
this.reset.ImageTransparentColor = System.Drawing.Color.Magenta;
this.reset.Name = "reset";
this.reset.Size = new System.Drawing.Size(23, 20);
this.reset.Size = new System.Drawing.Size(23, 22);
this.reset.Text = "Reset";
this.reset.Click += new System.EventHandler(this.reset_Click);
//
@ -144,7 +177,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.toolStrip1);
this.Name = "DrawEllipseOptionsPanel";
this.Size = new System.Drawing.Size(348, 60);
this.Size = new System.Drawing.Size(582, 60);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
@ -162,5 +195,7 @@
private System.Windows.Forms.ToolStripButton reset;
private System.Windows.Forms.ToolStripButton continuousdrawing;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripLabel anglelabel;
private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown angle;
}
}

View file

@ -11,6 +11,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public int Spikiness { get { return (int)spikiness.Value; } set { blockevents = true; spikiness.Value = value; blockevents = false; } }
public int Subdivisions { get { return (int)subdivs.Value; } set { blockevents = true; subdivs.Value = value; blockevents = false; } }
public int Angle { get { return (int)angle.Value; } set { blockevents = true; angle.Value = value; blockevents = false; } }
public int MaxSubdivisions { get { return (int)subdivs.Maximum; } set { subdivs.Maximum = value; } }
public int MinSubdivisions { get { return (int)subdivs.Minimum; } set { subdivs.Minimum = value; } }
public int MaxSpikiness { get { return (int)spikiness.Maximum; } set { spikiness.Maximum = value; } }
@ -26,6 +27,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
spikiness.ValueChanged += ValueChanged;
subdivs.ValueChanged += ValueChanged;
angle.ValueChanged += ValueChanged;
General.Interface.AddButton(continuousdrawing);
General.Interface.AddButton(toolStripSeparator1);
@ -33,12 +35,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.AddButton(subdivs);
General.Interface.AddButton(spikinesslabel);
General.Interface.AddButton(spikiness);
General.Interface.AddButton(anglelabel);
General.Interface.AddButton(angle);
General.Interface.AddButton(reset);
}
public void Unregister()
{
General.Interface.RemoveButton(reset);
General.Interface.RemoveButton(angle);
General.Interface.RemoveButton(anglelabel);
General.Interface.RemoveButton(spikiness);
General.Interface.RemoveButton(spikinesslabel);
General.Interface.RemoveButton(subdivs);
@ -56,8 +62,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
blockevents = true;
spikiness.Value = 0;
angle.Value = 0;
blockevents = false;
subdivs.Value = subdivs.Minimum;
subdivs.Value = 6;
}
private void continuousdrawing_CheckedChanged(object sender, EventArgs e)