Fixing last mouse position commit :(

This commit is contained in:
Caleb Anderson
2010-10-20 23:56:36 -05:00
committed by Chris Forbes
parent 253ccd6d9b
commit fc72066ed2
2 changed files with 20 additions and 9 deletions

View File

@@ -66,9 +66,9 @@
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.splitContainer3 = new System.Windows.Forms.SplitContainer(); this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabelFiller = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelMousePosition = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelMousePosition = new System.Windows.Forms.ToolStripStatusLabel();
this.surface1 = new OpenRA.Editor.Surface(); this.surface1 = new OpenRA.Editor.Surface();
this.toolStripStatusLabelFiller = new System.Windows.Forms.ToolStripStatusLabel();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
@@ -432,12 +432,18 @@
this.statusStrip1.TabIndex = 7; this.statusStrip1.TabIndex = 7;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
// toolStripStatusLabelFiller
//
this.toolStripStatusLabelFiller.Name = "toolStripStatusLabelFiller";
this.toolStripStatusLabelFiller.Size = new System.Drawing.Size(948, 17);
this.toolStripStatusLabelFiller.Spring = true;
//
// toolStripStatusLabelMousePosition // toolStripStatusLabelMousePosition
// //
this.toolStripStatusLabelMousePosition.Name = "toolStripStatusLabelMousePosition"; this.toolStripStatusLabelMousePosition.Name = "toolStripStatusLabelMousePosition";
this.toolStripStatusLabelMousePosition.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.toolStripStatusLabelMousePosition.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.toolStripStatusLabelMousePosition.Size = new System.Drawing.Size(22, 17); this.toolStripStatusLabelMousePosition.Size = new System.Drawing.Size(22, 17);
this.toolStripStatusLabelMousePosition.Text = "0:0"; this.toolStripStatusLabelMousePosition.Text = "0,0";
// //
// surface1 // surface1
// //
@@ -449,13 +455,6 @@
this.surface1.TabIndex = 5; this.surface1.TabIndex = 5;
this.surface1.Text = "surface1"; this.surface1.Text = "surface1";
// //
// toolStripStatusLabelFiller
//
this.toolStripStatusLabelFiller.Name = "toolStripStatusLabelFiller";
this.toolStripStatusLabelFiller.Size = new System.Drawing.Size(821, 17);
this.toolStripStatusLabelFiller.Spring = true;
this.toolStripStatusLabelFiller.Text = "toolStripStatusLabel1";
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@@ -35,6 +35,8 @@ namespace OpenRA.Editor
public bool IsPanning; public bool IsPanning;
public event Action AfterChange = () => { }; public event Action AfterChange = () => { };
private ToolStripStatusLabel MousePositionLabel = null;
Dictionary<string, ActorTemplate> ActorTemplates = new Dictionary<string, ActorTemplate>(); Dictionary<string, ActorTemplate> ActorTemplates = new Dictionary<string, ActorTemplate>();
Dictionary<int, ResourceTemplate> ResourceTemplates = new Dictionary<int, ResourceTemplate>(); Dictionary<int, ResourceTemplate> ResourceTemplates = new Dictionary<int, ResourceTemplate>();
@@ -83,6 +85,11 @@ namespace OpenRA.Editor
Invalidate(); Invalidate();
} }
public void SetMousePositionLabel(ToolStripStatusLabel mouseLabel)
{
MousePositionLabel = mouseLabel;
}
protected override void OnMouseWheel(MouseEventArgs e) protected override void OnMouseWheel(MouseEventArgs e)
{ {
base.OnMouseWheel(e); base.OnMouseWheel(e);
@@ -121,6 +128,11 @@ namespace OpenRA.Editor
var oldMousePos = MousePos; var oldMousePos = MousePos;
MousePos = new int2(e.Location); MousePos = new int2(e.Location);
if (MousePositionLabel != null)
{
MousePositionLabel.Text = GetBrushLocation().ToString();
}
if (e.Button == MouseButtons.Middle || (e.Button != MouseButtons.None && IsPanning)) if (e.Button == MouseButtons.Middle || (e.Button != MouseButtons.None && IsPanning))
Scroll(oldMousePos - MousePos); Scroll(oldMousePos - MousePos);
else else