From fc72066ed2d156a607f1a89bf2175c66dd8d5efd Mon Sep 17 00:00:00 2001 From: Caleb Anderson Date: Wed, 20 Oct 2010 23:56:36 -0500 Subject: [PATCH] Fixing last mouse position commit :( --- OpenRA.Editor/Form1.Designer.cs | 17 ++++++++--------- OpenRA.Editor/Surface.cs | 12 ++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/OpenRA.Editor/Form1.Designer.cs b/OpenRA.Editor/Form1.Designer.cs index ae763c0496..3bd5dad085 100755 --- a/OpenRA.Editor/Form1.Designer.cs +++ b/OpenRA.Editor/Form1.Designer.cs @@ -66,9 +66,9 @@ this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.splitContainer3 = new System.Windows.Forms.SplitContainer(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabelFiller = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelMousePosition = new System.Windows.Forms.ToolStripStatusLabel(); this.surface1 = new OpenRA.Editor.Surface(); - this.toolStripStatusLabelFiller = new System.Windows.Forms.ToolStripStatusLabel(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); @@ -432,12 +432,18 @@ this.statusStrip1.TabIndex = 7; this.statusStrip1.Text = "statusStrip1"; // + // toolStripStatusLabelFiller + // + this.toolStripStatusLabelFiller.Name = "toolStripStatusLabelFiller"; + this.toolStripStatusLabelFiller.Size = new System.Drawing.Size(948, 17); + this.toolStripStatusLabelFiller.Spring = true; + // // toolStripStatusLabelMousePosition // this.toolStripStatusLabelMousePosition.Name = "toolStripStatusLabelMousePosition"; this.toolStripStatusLabelMousePosition.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.toolStripStatusLabelMousePosition.Size = new System.Drawing.Size(22, 17); - this.toolStripStatusLabelMousePosition.Text = "0:0"; + this.toolStripStatusLabelMousePosition.Text = "0,0"; // // surface1 // @@ -449,13 +455,6 @@ this.surface1.TabIndex = 5; 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 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/OpenRA.Editor/Surface.cs b/OpenRA.Editor/Surface.cs index 6126a6f580..2d43bde908 100755 --- a/OpenRA.Editor/Surface.cs +++ b/OpenRA.Editor/Surface.cs @@ -35,6 +35,8 @@ namespace OpenRA.Editor public bool IsPanning; public event Action AfterChange = () => { }; + private ToolStripStatusLabel MousePositionLabel = null; + Dictionary ActorTemplates = new Dictionary(); Dictionary ResourceTemplates = new Dictionary(); @@ -83,6 +85,11 @@ namespace OpenRA.Editor Invalidate(); } + public void SetMousePositionLabel(ToolStripStatusLabel mouseLabel) + { + MousePositionLabel = mouseLabel; + } + protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); @@ -121,6 +128,11 @@ namespace OpenRA.Editor var oldMousePos = MousePos; MousePos = new int2(e.Location); + if (MousePositionLabel != null) + { + MousePositionLabel.Text = GetBrushLocation().ToString(); + } + if (e.Button == MouseButtons.Middle || (e.Button != MouseButtons.None && IsPanning)) Scroll(oldMousePos - MousePos); else