summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2016-06-12 21:46:05 +0000
committerIan C <ianc@noddybox.co.uk>2016-06-12 21:46:05 +0000
commit4e3b8b0981d4699b5571fed9d26107fde11c1025 (patch)
treeeb29cc006ad2a0892bfce0532cbed5f6e0a7b7c0
parent81d9f4ff835b4a4c7f48ce2c6dc5845a89a98c73 (diff)
Added copy/paste character buttons
-rw-r--r--neschr/MainForm.Designer.cs55
-rw-r--r--neschr/MainForm.cs21
2 files changed, 62 insertions, 14 deletions
diff --git a/neschr/MainForm.Designer.cs b/neschr/MainForm.Designer.cs
index 638ba73..f79b450 100644
--- a/neschr/MainForm.Designer.cs
+++ b/neschr/MainForm.Designer.cs
@@ -58,13 +58,15 @@
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.paletteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cHRROMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.paletteToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.cHRROMToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.pasteCharButton = new System.Windows.Forms.Button();
+ this.copyCharButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.tileNumber)).BeginInit();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@@ -343,37 +345,44 @@
// loadToolStripMenuItem
//
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
- this.loadToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.loadToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
this.loadToolStripMenuItem.Text = "Load...";
this.loadToolStripMenuItem.Click += new System.EventHandler(this.OnLoad);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
- this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.saveToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
this.saveToolStripMenuItem.Text = "Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.OnSave);
//
+ // saveAsToolStripMenuItem
+ //
+ this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
+ this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
+ this.saveAsToolStripMenuItem.Text = "Save as...";
+ this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.OnSaveAs);
+ //
// exportToolStripMenuItem
//
this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.paletteToolStripMenuItem,
this.cHRROMToolStripMenuItem});
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
- this.exportToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.exportToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
this.exportToolStripMenuItem.Text = "Export";
//
// paletteToolStripMenuItem
//
this.paletteToolStripMenuItem.Name = "paletteToolStripMenuItem";
- this.paletteToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.paletteToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.paletteToolStripMenuItem.Text = "Palette...";
this.paletteToolStripMenuItem.Click += new System.EventHandler(this.OnExportPalette);
//
// cHRROMToolStripMenuItem
//
this.cHRROMToolStripMenuItem.Name = "cHRROMToolStripMenuItem";
- this.cHRROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.cHRROMToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.cHRROMToolStripMenuItem.Text = "CHR ROM...";
this.cHRROMToolStripMenuItem.Click += new System.EventHandler(this.OnExportCHR);
//
@@ -383,29 +392,43 @@
this.paletteToolStripMenuItem1,
this.cHRROMToolStripMenuItem1});
this.importToolStripMenuItem.Name = "importToolStripMenuItem";
- this.importToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.importToolStripMenuItem.Size = new System.Drawing.Size(121, 22);
this.importToolStripMenuItem.Text = "Import";
//
// paletteToolStripMenuItem1
//
this.paletteToolStripMenuItem1.Name = "paletteToolStripMenuItem1";
- this.paletteToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
+ this.paletteToolStripMenuItem1.Size = new System.Drawing.Size(137, 22);
this.paletteToolStripMenuItem1.Text = "Palette...";
this.paletteToolStripMenuItem1.Click += new System.EventHandler(this.OnImportPalettte);
//
// cHRROMToolStripMenuItem1
//
this.cHRROMToolStripMenuItem1.Name = "cHRROMToolStripMenuItem1";
- this.cHRROMToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
+ this.cHRROMToolStripMenuItem1.Size = new System.Drawing.Size(137, 22);
this.cHRROMToolStripMenuItem1.Text = "CHR ROM...";
this.cHRROMToolStripMenuItem1.Click += new System.EventHandler(this.OnImportCHR);
//
- // saveAsToolStripMenuItem
+ // pasteCharButton
//
- this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
- this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
- this.saveAsToolStripMenuItem.Text = "Save as...";
- this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.OnSaveAs);
+ this.pasteCharButton.Enabled = false;
+ this.pasteCharButton.Location = new System.Drawing.Point(523, 178);
+ this.pasteCharButton.Name = "pasteCharButton";
+ this.pasteCharButton.Size = new System.Drawing.Size(75, 23);
+ this.pasteCharButton.TabIndex = 28;
+ this.pasteCharButton.Text = "Paste Char";
+ this.pasteCharButton.UseVisualStyleBackColor = true;
+ this.pasteCharButton.Click += new System.EventHandler(this.OnPasteChar);
+ //
+ // copyCharButton
+ //
+ this.copyCharButton.Location = new System.Drawing.Point(442, 178);
+ this.copyCharButton.Name = "copyCharButton";
+ this.copyCharButton.Size = new System.Drawing.Size(75, 23);
+ this.copyCharButton.TabIndex = 27;
+ this.copyCharButton.Text = "Copy Char";
+ this.copyCharButton.UseVisualStyleBackColor = true;
+ this.copyCharButton.Click += new System.EventHandler(this.OnCopyChar);
//
// MainForm
//
@@ -413,6 +436,8 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlDark;
this.ClientSize = new System.Drawing.Size(628, 356);
+ this.Controls.Add(this.pasteCharButton);
+ this.Controls.Add(this.copyCharButton);
this.Controls.Add(this.shiftRightButton);
this.Controls.Add(this.shiftDownButton);
this.Controls.Add(this.shiftLeftButton);
@@ -494,6 +519,8 @@
private System.Windows.Forms.ToolStripMenuItem paletteToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem cHRROMToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
+ private System.Windows.Forms.Button pasteCharButton;
+ private System.Windows.Forms.Button copyCharButton;
}
}
diff --git a/neschr/MainForm.cs b/neschr/MainForm.cs
index 317d2fd..31311db 100644
--- a/neschr/MainForm.cs
+++ b/neschr/MainForm.cs
@@ -21,6 +21,8 @@ namespace UCTest
int currentTile;
bool metaMode;
+ int[,] copyBuffer;
+
string filePath;
public MainForm()
@@ -95,6 +97,9 @@ namespace UCTest
editControl.SetGridSize(8, 8);
LoadCurrentTile();
}
+
+ copyBuffer = null;
+ SetPasteAvailable();
}
private void OnPaletteSelection(object sender, EventArgs e)
@@ -461,5 +466,21 @@ namespace UCTest
}
}
}
+
+ private void OnCopyChar(object sender, EventArgs e)
+ {
+ copyBuffer = editControl.GridData;
+ SetPasteAvailable();
+ }
+
+ private void SetPasteAvailable()
+ {
+ pasteCharButton.Enabled = copyBuffer != null;
+ }
+
+ private void OnPasteChar(object sender, EventArgs e)
+ {
+ editControl.GridData = copyBuffer;
+ }
}
}