Private
Public Access
Text_Editor now describes the code
This commit is contained in:
1 parent
2a3857d942
commit
b888088f0b
8 files changed
+95
-52
No files matched your search
+5
-5
@@ -80,11 +80,11 @@
|
||||
<Compile Include="DrawPreview.Designer.cs">
|
||||
<DependentUpon>DrawPreview.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ErrorDetailWindow.cs">
|
||||
<Compile Include="DetailsWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ErrorDetailWindow.Designer.cs">
|
||||
<DependentUpon>ErrorDetailWindow.cs</DependentUpon>
|
||||
<Compile Include="DetailsWindow.Designer.cs">
|
||||
<DependentUpon>DetailsWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ErrorWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -113,8 +113,8 @@
|
||||
<EmbeddedResource Include="DrawPreview.resx">
|
||||
<DependentUpon>DrawPreview.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ErrorDetailWindow.resx">
|
||||
<DependentUpon>ErrorDetailWindow.cs</DependentUpon>
|
||||
<EmbeddedResource Include="DetailsWindow.resx">
|
||||
<DependentUpon>DetailsWindow.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ErrorWindow.resx">
|
||||
<DependentUpon>ErrorWindow.cs</DependentUpon>
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
namespace Advanced_Software_Engineering {
|
||||
partial class ErrorDetailWindow {
|
||||
partial class DetailsWindow {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
@@ -38,7 +38,7 @@
|
||||
this.textBox1.Size = new System.Drawing.Size(365, 405);
|
||||
this.textBox1.TabIndex = 0;
|
||||
//
|
||||
// ErrorDetailWindow
|
||||
// DetailsWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -47,8 +47,8 @@
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ErrorDetailWindow";
|
||||
this.Text = "Error Details";
|
||||
this.Name = "DetailsWindow";
|
||||
this.Text = "Details";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
+9
-3
@@ -9,14 +9,20 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Advanced_Software_Engineering {
|
||||
public partial class ErrorDetailWindow : Form {
|
||||
public ErrorDetailWindow() {
|
||||
public partial class DetailsWindow : Form {
|
||||
public DetailsWindow() {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public ErrorDetailWindow(string errorText) {
|
||||
public DetailsWindow(string errorText) {
|
||||
InitializeComponent();
|
||||
textBox1.Text = errorText;
|
||||
}
|
||||
|
||||
public DetailsWindow(string errorText, string title) {
|
||||
InitializeComponent();
|
||||
textBox1.Text = errorText;
|
||||
Text = title;
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -78,5 +78,9 @@ namespace Advanced_Software_Engineering
|
||||
button1.Enabled = true;
|
||||
}
|
||||
|
||||
public string DescribeAllCommands() {
|
||||
return commander.ExplainCommands();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace Advanced_Software_Engineering {
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e) {
|
||||
new ErrorDetailWindow(desc).Show();
|
||||
new DetailsWindow(desc).Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
-16
@@ -100,57 +100,58 @@ namespace Advanced_Software_Engineering
|
||||
// newFileToolStripMenuItem
|
||||
//
|
||||
this.newFileToolStripMenuItem.Name = "newFileToolStripMenuItem";
|
||||
this.newFileToolStripMenuItem.Size = new System.Drawing.Size(119, 22);
|
||||
this.newFileToolStripMenuItem.Text = "New File";
|
||||
this.newFileToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.newFileToolStripMenuItem.Text = "New File (Ctrl + N)";
|
||||
this.newFileToolStripMenuItem.Click += new System.EventHandler(this.newFileToolStripMenuItem_Click);
|
||||
//
|
||||
// openToolStripMenuItem
|
||||
//
|
||||
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||
this.openToolStripMenuItem.Size = new System.Drawing.Size(119, 22);
|
||||
this.openToolStripMenuItem.Text = "Open";
|
||||
this.openToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.openToolStripMenuItem.Text = "Open (Ctrl + O)";
|
||||
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(119, 22);
|
||||
this.saveToolStripMenuItem.Text = "Save";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.saveToolStripMenuItem.Text = "Save (Ctrl + S)";
|
||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
|
||||
//
|
||||
// saveAsToolStripMenuItem
|
||||
//
|
||||
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
|
||||
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(119, 22);
|
||||
this.saveAsToolStripMenuItem.Text = "Save As";
|
||||
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.saveAsToolStripMenuItem.Text = "Save As (Ctrl + Shift + S)";
|
||||
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(119, 22);
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.exitToolStripMenuItem.Text = "Exit (Alt + F4)";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// runToolStripMenuItem
|
||||
//
|
||||
this.runToolStripMenuItem.Name = "runToolStripMenuItem";
|
||||
this.runToolStripMenuItem.Size = new System.Drawing.Size(40, 20);
|
||||
this.runToolStripMenuItem.Text = "Run";
|
||||
this.runToolStripMenuItem.Size = new System.Drawing.Size(63, 20);
|
||||
this.runToolStripMenuItem.Text = "Run (F5)";
|
||||
this.runToolStripMenuItem.Click += new System.EventHandler(this.runToolStripMenuItem_Click);
|
||||
//
|
||||
// checkSyntaxToolStripMenuItem
|
||||
//
|
||||
this.checkSyntaxToolStripMenuItem.Name = "checkSyntaxToolStripMenuItem";
|
||||
this.checkSyntaxToolStripMenuItem.Size = new System.Drawing.Size(90, 20);
|
||||
this.checkSyntaxToolStripMenuItem.Text = "Check Syntax";
|
||||
this.checkSyntaxToolStripMenuItem.Size = new System.Drawing.Size(151, 20);
|
||||
this.checkSyntaxToolStripMenuItem.Text = "Check Syntax (Shift + F5)";
|
||||
this.checkSyntaxToolStripMenuItem.Click += new System.EventHandler(this.checkSyntaxToolStripMenuItem_Click);
|
||||
//
|
||||
// describeToolStripMenuItem
|
||||
//
|
||||
this.describeToolStripMenuItem.Name = "describeToolStripMenuItem";
|
||||
this.describeToolStripMenuItem.Size = new System.Drawing.Size(64, 20);
|
||||
this.describeToolStripMenuItem.Text = "Describe";
|
||||
this.describeToolStripMenuItem.Size = new System.Drawing.Size(125, 20);
|
||||
this.describeToolStripMenuItem.Text = "Describe (Shift + F1)";
|
||||
this.describeToolStripMenuItem.Click += new System.EventHandler(this.describeToolStripMenuItem_Click);
|
||||
//
|
||||
// helpToolStripMenuItem
|
||||
//
|
||||
|
||||
@@ -134,20 +134,7 @@ namespace Advanced_Software_Engineering {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleExit(FormClosingEventArgs e) {
|
||||
if (unsavedChanges) {
|
||||
DialogResult dialogResult = MessageBox.Show("You have unsaved work. Would you like to discard your work?", "Unsaved work!", MessageBoxButtons.YesNo, MessageBoxIcon.None);
|
||||
if (e != null) e.Cancel = dialogResult != DialogResult.Yes;
|
||||
}
|
||||
}
|
||||
|
||||
private void Console_FormClosed(object sender, FormClosedEventArgs e) {
|
||||
if (DisplayForm != null && !DisplayForm.IsDisposed) DisplayForm.ReleaseCommandLock();
|
||||
SettingsAndHelperFunctions.WindowClosed();
|
||||
Dispose();
|
||||
}
|
||||
|
||||
private void runToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
private void RunCode() {
|
||||
if (DisplayForm == null || DisplayForm.IsDisposed) {
|
||||
DisplayForm = new Draw_Preview(textBox1.Text);
|
||||
} else {
|
||||
@@ -159,10 +146,48 @@ namespace Advanced_Software_Engineering {
|
||||
DisplayForm.Focus();
|
||||
}
|
||||
|
||||
private void createNewInstance() {
|
||||
new Text_Editor().Show();
|
||||
public void CheckCode() {
|
||||
Draw_Preview tmpDrawPreview = new Draw_Preview();
|
||||
tmpDrawPreview.Hide();
|
||||
tmpDrawPreview.SubmitCommands(textBox1.Text);
|
||||
tmpDrawPreview.Close();
|
||||
SettingsAndHelperFunctions.WindowClosed();
|
||||
tmpDrawPreview.Dispose();
|
||||
}
|
||||
|
||||
private void handleExit(FormClosingEventArgs e) {
|
||||
if (unsavedChanges) {
|
||||
DialogResult dialogResult = MessageBox.Show("You have unsaved work. Would you like to discard your work?", "Unsaved work!", MessageBoxButtons.YesNo, MessageBoxIcon.None);
|
||||
if (e != null) e.Cancel = dialogResult != DialogResult.Yes;
|
||||
}
|
||||
}
|
||||
|
||||
private void DescribeCode() {
|
||||
Draw_Preview tmpDrawPreview = new Draw_Preview();
|
||||
tmpDrawPreview.Hide();
|
||||
tmpDrawPreview.SubmitCommands(textBox1.Text);
|
||||
|
||||
string commandDesc = tmpDrawPreview.DescribeAllCommands();
|
||||
Console.WriteLine(commandDesc);
|
||||
|
||||
tmpDrawPreview.Close();
|
||||
SettingsAndHelperFunctions.WindowClosed();
|
||||
tmpDrawPreview.Dispose();
|
||||
|
||||
new DetailsWindow(commandDesc, "Command explanation").Show();
|
||||
}
|
||||
|
||||
private void Console_FormClosed(object sender, FormClosedEventArgs e) {
|
||||
if (DisplayForm != null && !DisplayForm.IsDisposed) DisplayForm.ReleaseCommandLock();
|
||||
SettingsAndHelperFunctions.WindowClosed();
|
||||
Dispose();
|
||||
}
|
||||
|
||||
private void runToolStripMenuItem_Click(object sender, EventArgs e) => RunCode();
|
||||
|
||||
|
||||
private void createNewInstance() => new Text_Editor().Show();
|
||||
|
||||
private void handleKeypress(object sender, EventArgs e) => handleKeypress();
|
||||
|
||||
private void textBox1_Click(object sender, EventArgs e) => updateRowCol();
|
||||
@@ -192,15 +217,22 @@ namespace Advanced_Software_Engineering {
|
||||
} else if (e.Control && e.KeyCode == Keys.O) {
|
||||
openFile();
|
||||
e.Handled = true;
|
||||
} else if(e.KeyCode == Keys.F5) {
|
||||
RunCode();
|
||||
e.Handled = true;
|
||||
} else if(e.KeyCode == Keys.F5 && e.Shift) {
|
||||
CheckCode();
|
||||
e.Handled = true;
|
||||
} else if(e.KeyCode == Keys.F1 && e.Shift) {
|
||||
DescribeCode();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSyntaxToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
Draw_Preview tmpDrawPreview = new Draw_Preview();
|
||||
tmpDrawPreview.Hide();
|
||||
tmpDrawPreview.SubmitCommands(textBox1.Text);
|
||||
tmpDrawPreview.Close();
|
||||
SettingsAndHelperFunctions.WindowClosed();
|
||||
}
|
||||
private void checkSyntaxToolStripMenuItem_Click(object sender, EventArgs e) => CheckCode();
|
||||
|
||||
private void describeToolStripMenuItem_Click(object sender, EventArgs e) => DescribeCode();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user