mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-04-22 01:10:57 +00:00
Added Insert Things Radially Mode
This commit is contained in:
parent
b85f90712c
commit
c9a0de7287
6 changed files with 756 additions and 2 deletions
|
@ -81,6 +81,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ClassicModes\BaseClassicMode.cs" />
|
||||
<Compile Include="ClassicModes\InsertThingsRadiallyMode.cs" />
|
||||
<Compile Include="ClassicModes\ErrorCheckMode.cs" />
|
||||
<Compile Include="ClassicModes\EditSelectionMode.cs" />
|
||||
<Compile Include="ClassicModes\CurveLinedefsMode.cs" />
|
||||
|
@ -119,6 +120,12 @@
|
|||
<Compile Include="Interface\CurveLinedefsForm.Designer.cs">
|
||||
<DependentUpon>CurveLinedefsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\InsertThingsRadiallyOptionsPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\InsertThingsRadiallyOptionsPanel.Designer.cs">
|
||||
<DependentUpon>InsertThingsRadiallyOptionsPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\ErrorCheckForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -164,6 +171,10 @@
|
|||
<Compile Include="ClassicModes\VerticesMode.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Interface\InsertThingsRadiallyOptionsPanel.resx">
|
||||
<DependentUpon>InsertThingsRadiallyOptionsPanel.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Actions.cfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -296,10 +307,10 @@
|
|||
<Compile Include="FindReplace\BaseFindThing.cs" />
|
||||
<Compile Include="FindReplace\FindLinedefFlags.cs" />
|
||||
<Compile Include="FindReplace\FindSectorBrightness.cs" />
|
||||
<Compile Include="FindReplace\FindSectorCeilingFlat.cs" />
|
||||
<Compile Include="FindReplace\FindSectorCeilingFlat.cs" />
|
||||
<Compile Include="FindReplace\FindSectorCeilingHeight.cs" />
|
||||
<Compile Include="FindReplace\FindSectorFlags.cs" />
|
||||
<Compile Include="FindReplace\FindSectorFloorFlat.cs" />
|
||||
<Compile Include="FindReplace\FindSectorFloorFlat.cs" />
|
||||
<Compile Include="FindReplace\FindSectorFloorHeight.cs" />
|
||||
<Compile Include="FindReplace\FindSidedefFlags.cs" />
|
||||
<Compile Include="FindReplace\FindThingAngle.cs" />
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
|
||||
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
||||
* This program is released under GNU General Public License
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Windows;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using CodeImp.DoomBuilder.Actions;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
[EditMode(DisplayName = "Insert Things Radially Mode",
|
||||
SwitchAction = "insertthingsradiallymode",
|
||||
ButtonImage = "ThingsMode.png",
|
||||
ButtonOrder = int.MinValue + 6,
|
||||
ButtonGroup = "000_drawing",
|
||||
AllowCopyPaste = false,
|
||||
Volatile = true,
|
||||
UseByDefault = true,
|
||||
Optional = false)]
|
||||
|
||||
public class InsertThingsRadiallyMode : BaseClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
protected List<Vector2D> things;
|
||||
|
||||
// Options
|
||||
protected int number;
|
||||
protected int radius;
|
||||
protected bool snaptogrid; // SHIFT to toggle
|
||||
protected int type;
|
||||
protected int parameter;
|
||||
|
||||
//interface
|
||||
private InsertThingsRadiallyOptionsPanel panel;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public InsertThingsRadiallyMode()
|
||||
{
|
||||
things = new List<Vector2D>();
|
||||
|
||||
// No selection in this mode
|
||||
General.Map.Map.ClearAllSelected();
|
||||
General.Map.Map.ClearAllMarks(false);
|
||||
|
||||
SetupInterface();
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Done
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// Update the thing markers
|
||||
protected virtual void Update()
|
||||
{
|
||||
snaptogrid = General.Interface.ShiftState ^ panel.SnapToGrid;
|
||||
|
||||
UpdateThings();
|
||||
|
||||
// Render things
|
||||
if(renderer.StartOverlay(true))
|
||||
{
|
||||
float vsize = (renderer.VertexSize + 1.0f) / renderer.Scale;
|
||||
|
||||
foreach (Vector2D t in things)
|
||||
renderer.RenderRectangleFilled(new RectangleF(t.x - vsize, t.y - vsize, vsize * 2.0f, vsize * 2.0f), General.Colors.Selection, true);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Done
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
// Update the positions of the thing markers
|
||||
public void UpdateThings()
|
||||
{
|
||||
things = new List<Vector2D>();
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
float fAngle = i * 2 * (float)Math.PI / number;
|
||||
Vector2D pos = mousemappos + new Vector2D(((float)Math.Cos(fAngle) * radius), ((float)Math.Sin(fAngle) * radius));
|
||||
if (snaptogrid) pos = General.Map.Grid.SnappedToGrid(pos);
|
||||
if (pos.x < General.Map.Config.LeftBoundary) pos.x = General.Map.Config.LeftBoundary;
|
||||
if (pos.x > General.Map.Config.RightBoundary) pos.x = General.Map.Config.RightBoundary;
|
||||
if (pos.y < General.Map.Config.BottomBoundary) pos.y = General.Map.Config.BottomBoundary;
|
||||
if (pos.y > General.Map.Config.TopBoundary) pos.y = General.Map.Config.TopBoundary;
|
||||
things.Add(pos);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
||||
// Engaging
|
||||
public override void OnEngage()
|
||||
{
|
||||
base.OnEngage();
|
||||
EnableAutoPanning();
|
||||
renderer.SetPresentation(Presentation.Standard);
|
||||
|
||||
// Set cursor
|
||||
General.Interface.SetCursor(Cursors.Cross);
|
||||
AddInterface();
|
||||
}
|
||||
|
||||
// Disengaging
|
||||
public override void OnDisengage()
|
||||
{
|
||||
base.OnDisengage();
|
||||
DisableAutoPanning();
|
||||
RemoveInterface();
|
||||
}
|
||||
|
||||
// Cancelled
|
||||
public override void OnCancel()
|
||||
{
|
||||
// Cancel base class
|
||||
base.OnCancel();
|
||||
|
||||
// Return to original mode
|
||||
General.Editing.ChangeMode(General.Editing.PreviousStableMode.Name);
|
||||
}
|
||||
|
||||
// Accepted
|
||||
public override void OnAccept()
|
||||
{
|
||||
Cursor.Current = Cursors.AppStarting;
|
||||
General.Settings.FindDefaultDrawSettings();
|
||||
|
||||
General.Map.UndoRedo.CreateUndo("Insert things");
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Inserted things radially.");
|
||||
foreach (Vector2D pos in things)
|
||||
{
|
||||
Thing t = General.Map.Map.CreateThing();
|
||||
if (t != null)
|
||||
{
|
||||
General.Settings.ApplyDefaultThingSettings(t);
|
||||
t.SRB2Type = type;
|
||||
t.Parameter = parameter;
|
||||
t.Move(pos);
|
||||
t.UpdateConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
//Update Things filter
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
// Snap to map format accuracy
|
||||
General.Map.Map.SnapAllToAccuracy();
|
||||
|
||||
// Update cached values
|
||||
General.Map.Map.Update();
|
||||
|
||||
// Map is changed
|
||||
General.Map.IsChanged = true;
|
||||
|
||||
// Done
|
||||
Cursor.Current = Cursors.Default;
|
||||
|
||||
// Return to original mode
|
||||
General.Editing.ChangeMode(General.Editing.PreviousStableMode.Name);
|
||||
}
|
||||
|
||||
// This redraws the display
|
||||
public override void OnRedrawDisplay()
|
||||
{
|
||||
renderer.RedrawSurface();
|
||||
|
||||
// Render lines
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
renderer.PlotLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.PlotVerticesSet(General.Map.Map.Vertices);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.RenderThingSet(General.Map.Map.Things, Presentation.THINGS_ALPHA);
|
||||
renderer.RenderNiGHTSPath();
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Normal update
|
||||
Update();
|
||||
}
|
||||
|
||||
// Mouse moving
|
||||
public override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if(panning) return; //mxd. Skip all this jazz while panning
|
||||
Update();
|
||||
}
|
||||
|
||||
// When a key is released
|
||||
public override void OnKeyUp(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyUp(e);
|
||||
if(snaptogrid != (General.Interface.ShiftState ^ panel.SnapToGrid)) Update();
|
||||
}
|
||||
|
||||
// When a key is pressed
|
||||
public override void OnKeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.OnKeyDown(e);
|
||||
if(snaptogrid != (General.Interface.ShiftState ^ panel.SnapToGrid)) Update();
|
||||
}
|
||||
|
||||
public override void OnMouseClick(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseClick(e);
|
||||
// Mouse inside window?
|
||||
if (General.Interface.MouseInDisplay)
|
||||
{
|
||||
Update();
|
||||
General.Editing.AcceptMode();
|
||||
}
|
||||
}
|
||||
|
||||
private void OptionsPanelOnValueChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
number = panel.Number;
|
||||
radius = panel.Radius;
|
||||
snaptogrid = panel.SnapToGrid;
|
||||
type = panel.Type;
|
||||
parameter = panel.Parameter;
|
||||
Update();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Settings panel
|
||||
|
||||
protected virtual void SetupInterface()
|
||||
{
|
||||
//Add options docker
|
||||
panel = new InsertThingsRadiallyOptionsPanel();
|
||||
panel.OnValueChanged += OptionsPanelOnValueChanged;
|
||||
}
|
||||
|
||||
protected virtual void AddInterface()
|
||||
{
|
||||
panel.Register();
|
||||
number = panel.Number;
|
||||
radius = panel.Radius;
|
||||
snaptogrid = panel.SnapToGrid;
|
||||
type = panel.Type;
|
||||
parameter = panel.Parameter;
|
||||
}
|
||||
|
||||
protected virtual void RemoveInterface()
|
||||
{
|
||||
panel.Unregister();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
224
Source/Plugins/BuilderModes/Interface/InsertThingsRadiallyOptionsPanel.Designer.cs
generated
Normal file
224
Source/Plugins/BuilderModes/Interface/InsertThingsRadiallyOptionsPanel.Designer.cs
generated
Normal file
|
@ -0,0 +1,224 @@
|
|||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
partial class InsertThingsRadiallyOptionsPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.numberlabel = new System.Windows.Forms.ToolStripLabel();
|
||||
this.number = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
|
||||
this.radiuslabel = new System.Windows.Forms.ToolStripLabel();
|
||||
this.radius = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
|
||||
this.reset = new System.Windows.Forms.ToolStripButton();
|
||||
this.snaptogrid = new CodeImp.DoomBuilder.Controls.ToolStripCheckBox();
|
||||
this.typelabel = new System.Windows.Forms.ToolStripLabel();
|
||||
this.type = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
|
||||
this.parameterlabel = new System.Windows.Forms.ToolStripLabel();
|
||||
this.parameter = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.numberlabel,
|
||||
this.number,
|
||||
this.radiuslabel,
|
||||
this.radius,
|
||||
this.reset,
|
||||
this.snaptogrid,
|
||||
this.typelabel,
|
||||
this.type,
|
||||
this.parameterlabel,
|
||||
this.parameter});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(560, 26);
|
||||
this.toolStrip1.TabIndex = 7;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// numberlabel
|
||||
//
|
||||
this.numberlabel.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Gear;
|
||||
this.numberlabel.Name = "numberlabel";
|
||||
this.numberlabel.Size = new System.Drawing.Size(70, 23);
|
||||
this.numberlabel.Text = "Number:";
|
||||
//
|
||||
// number
|
||||
//
|
||||
this.number.AutoSize = false;
|
||||
this.number.Margin = new System.Windows.Forms.Padding(3, 0, 6, 0);
|
||||
this.number.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.number.Minimum = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.number.Name = "number";
|
||||
this.number.Size = new System.Drawing.Size(56, 20);
|
||||
this.number.Text = "4";
|
||||
this.number.Value = new decimal(new int[] {
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.number.ValueChanged += new System.EventHandler(this.ValueChanged);
|
||||
//
|
||||
// radiuslabel
|
||||
//
|
||||
this.radiuslabel.Name = "radiuslabel";
|
||||
this.radiuslabel.Size = new System.Drawing.Size(45, 23);
|
||||
this.radiuslabel.Text = "Radius:";
|
||||
//
|
||||
// radius
|
||||
//
|
||||
this.radius.AutoSize = false;
|
||||
this.radius.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.radius.Maximum = new decimal(new int[] {
|
||||
16384,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.radius.Minimum = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.radius.Name = "radius";
|
||||
this.radius.Size = new System.Drawing.Size(56, 20);
|
||||
this.radius.Text = "32";
|
||||
this.radius.Value = new decimal(new int[] {
|
||||
32,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.radius.ValueChanged += new System.EventHandler(this.ValueChanged);
|
||||
//
|
||||
// reset
|
||||
//
|
||||
this.reset.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
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, 23);
|
||||
this.reset.Text = "Reset";
|
||||
this.reset.Click += new System.EventHandler(this.reset_Click);
|
||||
//
|
||||
// snaptogrid
|
||||
//
|
||||
this.snaptogrid.Checked = false;
|
||||
this.snaptogrid.Name = "snaptogrid";
|
||||
this.snaptogrid.Size = new System.Drawing.Size(90, 23);
|
||||
this.snaptogrid.Text = "Snap to grid";
|
||||
//
|
||||
// typelabel
|
||||
//
|
||||
this.typelabel.Name = "typelabel";
|
||||
this.typelabel.Size = new System.Drawing.Size(35, 23);
|
||||
this.typelabel.Text = "Type:";
|
||||
//
|
||||
// type
|
||||
//
|
||||
this.type.Maximum = new decimal(new int[] {
|
||||
4095,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.type.Minimum = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.type.Name = "type";
|
||||
this.type.Size = new System.Drawing.Size(53, 23);
|
||||
this.type.Text = "1";
|
||||
this.type.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// parameterlabel
|
||||
//
|
||||
this.parameterlabel.Name = "parameterlabel";
|
||||
this.parameterlabel.Size = new System.Drawing.Size(64, 23);
|
||||
this.parameterlabel.Text = "Parameter:";
|
||||
//
|
||||
// parameter
|
||||
//
|
||||
this.parameter.Maximum = new decimal(new int[] {
|
||||
15,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.parameter.Minimum = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.parameter.Name = "parameter";
|
||||
this.parameter.Size = new System.Drawing.Size(35, 23);
|
||||
this.parameter.Text = "0";
|
||||
this.parameter.Value = new decimal(new int[] {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// InsertThingsRadiallyOptionsPanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Controls.Add(this.toolStrip1);
|
||||
this.Name = "InsertThingsRadiallyOptionsPanel";
|
||||
this.Size = new System.Drawing.Size(560, 60);
|
||||
this.toolStrip1.ResumeLayout(false);
|
||||
this.toolStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripLabel numberlabel;
|
||||
private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown number;
|
||||
private System.Windows.Forms.ToolStripLabel radiuslabel;
|
||||
private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown radius;
|
||||
private System.Windows.Forms.ToolStripButton reset;
|
||||
private Controls.ToolStripCheckBox snaptogrid;
|
||||
private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown type;
|
||||
private System.Windows.Forms.ToolStripLabel typelabel;
|
||||
private System.Windows.Forms.ToolStripLabel parameterlabel;
|
||||
private Controls.ToolStripNumericUpDown parameter;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
internal partial class InsertThingsRadiallyOptionsPanel : UserControl
|
||||
{
|
||||
public event EventHandler OnValueChanged;
|
||||
private bool blockEvents;
|
||||
|
||||
public int Number { get { return (int)number.Value; } set { blockEvents = true; number.Value = value; blockEvents = false; } }
|
||||
public int MaxNumber { get { return (int)number.Maximum; } set { number.Maximum = value; } }
|
||||
public int MinNumber { get { return (int)number.Minimum; } set { number.Minimum = value; } }
|
||||
public int Radius { get { return (int)radius.Value; } set { blockEvents = true; radius.Value = value; blockEvents = false; } }
|
||||
public int MaxRadius { get { return (int)radius.Maximum; } set { radius.Maximum = value; } }
|
||||
public int MinRadius { get { return (int)radius.Minimum; } set { radius.Minimum = value; } }
|
||||
public bool SnapToGrid { get { return snaptogrid.Checked; } set { snaptogrid.Checked = value; } }
|
||||
public int Type { get { return (int)type.Value; } set { type.Value = value; } }
|
||||
public int Parameter { get { return (int)parameter.Value; } set { parameter.Value = value; } }
|
||||
|
||||
public InsertThingsRadiallyOptionsPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Register()
|
||||
{
|
||||
number.ValueChanged += ValueChanged;
|
||||
radius.ValueChanged += ValueChanged;
|
||||
snaptogrid.CheckedChanged += ValueChanged;
|
||||
type.ValueChanged += ValueChanged;
|
||||
parameter.ValueChanged += ValueChanged;
|
||||
|
||||
General.Interface.AddButton(numberlabel);
|
||||
General.Interface.AddButton(number);
|
||||
General.Interface.AddButton(radiuslabel);
|
||||
General.Interface.AddButton(radius);
|
||||
General.Interface.AddButton(snaptogrid);
|
||||
General.Interface.AddButton(typelabel);
|
||||
General.Interface.AddButton(type);
|
||||
General.Interface.AddButton(parameterlabel);
|
||||
General.Interface.AddButton(parameter);
|
||||
General.Interface.AddButton(reset);
|
||||
}
|
||||
|
||||
public void Unregister()
|
||||
{
|
||||
General.Interface.RemoveButton(reset);
|
||||
General.Interface.RemoveButton(parameter);
|
||||
General.Interface.RemoveButton(parameterlabel);
|
||||
General.Interface.RemoveButton(type);
|
||||
General.Interface.RemoveButton(typelabel);
|
||||
General.Interface.RemoveButton(snaptogrid);
|
||||
General.Interface.RemoveButton(radius);
|
||||
General.Interface.RemoveButton(radiuslabel);
|
||||
General.Interface.RemoveButton(number);
|
||||
General.Interface.RemoveButton(numberlabel);
|
||||
}
|
||||
|
||||
private void ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(!blockEvents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void reset_Click(object sender, EventArgs e)
|
||||
{
|
||||
blockEvents = true;
|
||||
parameter.Value = 0;
|
||||
type.Value = 1;
|
||||
snaptogrid.Checked = false;
|
||||
radius.Value = 32;
|
||||
blockEvents = false;
|
||||
number.Value = 4;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>83, 33</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -126,6 +126,16 @@ drawgridmode
|
|||
allowscroll = true;
|
||||
}
|
||||
|
||||
insertthingsradiallymode
|
||||
{
|
||||
title = "Insert Things Radially";
|
||||
category = "drawing";
|
||||
description = "Inserts Things radially.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
//mxd
|
||||
increasesubdivlevel
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue