added an eraser toolbar button

to erase with left-click as in image editing programs
This commit is contained in:
Matthias Mailänder
2013-04-02 11:48:19 +02:00
parent 58bdfb90e3
commit 7a143d94f9
4 changed files with 33 additions and 3 deletions

View File

@@ -74,6 +74,7 @@ namespace OpenRA.Editor
this.toolStripMenuItemFixOpenAreas = new System.Windows.Forms.ToolStripButton();
this.toolStripMenuItemSetupDefaultPlayers = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.eraserToolStripButton = new System.Windows.Forms.ToolStripButton();
this.toolStripMenuItemCopySelection = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.QuickhelpToolStripButton = new System.Windows.Forms.ToolStripButton();
@@ -352,6 +353,7 @@ namespace OpenRA.Editor
this.toolStripMenuItemFixOpenAreas,
this.toolStripMenuItemSetupDefaultPlayers,
this.toolStripSeparator11,
this.eraserToolStripButton,
this.toolStripMenuItemCopySelection,
this.toolStripSeparator7,
this.QuickhelpToolStripButton});
@@ -520,6 +522,16 @@ namespace OpenRA.Editor
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(6, 25);
//
// eraserToolStripButton
//
this.eraserToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.eraserToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("eraserToolStripButton.Image")));
this.eraserToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.eraserToolStripButton.Name = "eraserToolStripButton";
this.eraserToolStripButton.Size = new System.Drawing.Size(23, 22);
this.eraserToolStripButton.Text = "Erase actors and resources.";
this.eraserToolStripButton.Click += new System.EventHandler(this.EraserToolStripButtonClick);
//
// toolStripMenuItemCopySelection
//
this.toolStripMenuItemCopySelection.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@@ -1059,6 +1071,7 @@ namespace OpenRA.Editor
private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
private System.Windows.Forms.ToolStripButton showRulerToolStripItem;
private System.Windows.Forms.ToolStripMenuItem showRulerToolStripMenuItem;
private System.Windows.Forms.ToolStripButton eraserToolStripButton;
#endregion

View File

@@ -750,5 +750,11 @@ namespace OpenRA.Editor
{
showRulerToolStripMenuItemClick(sender, e);
}
void EraserToolStripButtonClick(object sender, System.EventArgs e)
{
eraserToolStripButton.Checked ^= true;
surface1.IsErasing = eraserToolStripButton.Checked;
}
}
}

View File

@@ -296,6 +296,16 @@
/z3G8q/AKohxAcjPIGeDbAZpXmch9mteYfb/Gct2EhWQ/0EBBvIzyNkgm8t8A/9X10/6DwLEGoICXCKK
/vfP2fr/2p1nJBkCUwSmHUMLwIZcv/ucJENQAMyQG3coMMQprBBsyO17T8k3xNgj+b9rZBF1DAFhqBDp
AGQIlEkNwMAAAP7JtzLCVbRNAAAAAElFTkSuQmCC
</value>
</data>
<data name="eraserToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAD2SURBVDhPY6ApmLlqNz+Irmqd/H/aqpP/S3s2/W+etuM/
SKy8YxVYDidA1gwDv37/+X/i4sP/xR1rwYbgBNg0//z15/+9px/+3370HmxI7cQN2A3Bpfn1+29wA0Ag
o2YmpgHEam6buvm/V1wVqgGkaMYwgCLNMECqZpe0crClYACKYxggWTMIzFx7+v/zN1/+P3z+8f+7j99J
0wwCzTN2/992+Ob/tXuv/j9w5j5Q8zu45saJy/FrhoGs+nn/SzsW/58FdM3s9Wf+L9l8/P+MZTuxBxg6
SCufCTc5Jq/tf0r5hP9xhZ0gjcRgBAhN68DtRNoABgYAAoqNFseCkuMAAAAASUVORK5CYII=
</value>
</data>
<data name="toolStripMenuItemCopySelection.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

View File

@@ -36,6 +36,7 @@ namespace OpenRA.Editor
ITool Tool;
public bool IsPanning;
public bool IsErasing;
public bool ShowActorNames;
public bool ShowGrid;
public bool ShowRuler;
@@ -158,10 +159,10 @@ namespace OpenRA.Editor
Scroll(oldMousePos - MousePos);
else
{
if (e.Button == MouseButtons.Right)
if (e.Button == MouseButtons.Right || (IsErasing && e.Button == MouseButtons.Left))
Erase();
if (e.Button == MouseButtons.Left)
if (e.Button == MouseButtons.Left && !IsErasing)
Draw();
Invalidate();
@@ -221,7 +222,7 @@ namespace OpenRA.Editor
if (!IsPanning)
{
if (e.Button == MouseButtons.Right) Erase();
if (e.Button == MouseButtons.Left)
if (e.Button == MouseButtons.Left && !IsErasing)
{
Draw();
if (!IsPaste)