Fixing Bug 28 - Alt+F4/File => Exit does not close unsaved files properly.
This commit is contained in:
parent
409aba35b3
commit
d0fdf8b9a9
4 changed files with 41 additions and 35 deletions
|
@ -480,7 +480,7 @@ namespace LSLEditor
|
||||||
{
|
{
|
||||||
DialogResult dialogResult = MessageBox.Show(this, @"Save """ + this.ScriptName + @"""?", "File has changed", MessageBoxButtons.YesNoCancel);
|
DialogResult dialogResult = MessageBox.Show(this, @"Save """ + this.ScriptName + @"""?", "File has changed", MessageBoxButtons.YesNoCancel);
|
||||||
if (dialogResult == DialogResult.Yes)
|
if (dialogResult == DialogResult.Yes)
|
||||||
e.Cancel = this.parent.SaveFile(this,false);
|
e.Cancel = !this.parent.SaveFile(this,false);
|
||||||
else
|
else
|
||||||
e.Cancel = (dialogResult == DialogResult.Cancel);
|
e.Cancel = (dialogResult == DialogResult.Cancel);
|
||||||
}
|
}
|
||||||
|
|
7
trunk/LSLEditorForm.Designer.cs
generated
7
trunk/LSLEditorForm.Designer.cs
generated
|
@ -438,6 +438,9 @@ namespace LSLEditor
|
||||||
// exitToolStripMenuItem
|
// exitToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||||
|
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "";
|
||||||
|
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
|
||||||
|
this.exitToolStripMenuItem.ShowShortcutKeys = false;
|
||||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
|
this.exitToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
|
||||||
this.exitToolStripMenuItem.Text = "Exit";
|
this.exitToolStripMenuItem.Text = "Exit";
|
||||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||||
|
@ -872,7 +875,7 @@ namespace LSLEditor
|
||||||
this.aboutToolStripMenuItem.Text = "About...";
|
this.aboutToolStripMenuItem.Text = "About...";
|
||||||
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
|
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// openFileDialog1
|
// openScriptFilesDialog
|
||||||
//
|
//
|
||||||
this.openScriptFilesDialog.FileName = "openFileDialog1";
|
this.openScriptFilesDialog.FileName = "openFileDialog1";
|
||||||
//
|
//
|
||||||
|
@ -905,7 +908,7 @@ namespace LSLEditor
|
||||||
this.closeTabToolStripMenuItem.Text = "Close";
|
this.closeTabToolStripMenuItem.Text = "Close";
|
||||||
this.closeTabToolStripMenuItem.Click += new System.EventHandler(this.closeTabToolStripMenuItem_Click);
|
this.closeTabToolStripMenuItem.Click += new System.EventHandler(this.closeTabToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// openFileDialog2
|
// openSolutionFilesDialog
|
||||||
//
|
//
|
||||||
this.openSolutionFilesDialog.FileName = "openFileDialog2";
|
this.openSolutionFilesDialog.FileName = "openFileDialog2";
|
||||||
//
|
//
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// ********
|
// ********
|
||||||
// * LSLEditor, a External editor for the LSL Language.
|
// * LSLEditor, a External editor for the LSL Language.
|
||||||
// * Copyright (C) 2010 The LSLEditor Group.
|
// * Copyright (C) 2010 The LSLEditor Group.
|
||||||
//
|
//
|
||||||
// * This program is free software; you can redistribute it and/or
|
// * This program is free software; you can redistribute it and/or
|
||||||
// * modify it under the terms of the GNU General Public License
|
// * modify it under the terms of the GNU General Public License
|
||||||
// * as published by the Free Software Foundation; either version 2
|
// * as published by the Free Software Foundation; either version 2
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
// * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// ********
|
// ********
|
||||||
// *
|
// *
|
||||||
// * The above copyright notice and this permission notice shall be included in all
|
// * The above copyright notice and this permission notice shall be included in all
|
||||||
// * copies or substantial portions of the Software.
|
// * copies or substantial portions of the Software.
|
||||||
// *
|
// *
|
||||||
// ********
|
// ********
|
||||||
|
@ -87,7 +87,7 @@ namespace LSLEditor
|
||||||
|
|
||||||
private Browser browser;
|
private Browser browser;
|
||||||
private SimulatorConsole SimulatorConsole;
|
private SimulatorConsole SimulatorConsole;
|
||||||
|
|
||||||
|
|
||||||
public bool CancelClosing = false;
|
public bool CancelClosing = false;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ namespace LSLEditor
|
||||||
// return null;
|
// return null;
|
||||||
// return this.tabControlExtended1.SelectedTab.Tag as Form;
|
// return this.tabControlExtended1.SelectedTab.Tag as Form;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivateMdiForm(Form form)
|
public void ActivateMdiForm(Form form)
|
||||||
|
@ -264,8 +264,8 @@ namespace LSLEditor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//form.Visible = false;
|
//form.Visible = false;
|
||||||
//form.MdiParent = null;
|
//form.MdiParent = null;
|
||||||
|
@ -276,8 +276,8 @@ namespace LSLEditor
|
||||||
//tabPage.Tag = form;
|
//tabPage.Tag = form;
|
||||||
//form.Tag = tabPage;
|
//form.Tag = tabPage;
|
||||||
// Was already commented out //tabPage.Controls.Add(form.Controls[0]);
|
// Was already commented out //tabPage.Controls.Add(form.Controls[0]);
|
||||||
|
|
||||||
|
|
||||||
//this.tabControlExtended1.TabPages.Add(tabPage);
|
//this.tabControlExtended1.TabPages.Add(tabPage);
|
||||||
//this.tabControlExtended1.SelectedTab = tabPage;
|
//this.tabControlExtended1.SelectedTab = tabPage;
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ namespace LSLEditor
|
||||||
this.openSolutionFilesDialog.InitialDirectory = Properties.Settings.Default.ProjectLocation;
|
this.openSolutionFilesDialog.InitialDirectory = Properties.Settings.Default.ProjectLocation;
|
||||||
this.openSolutionFilesDialog.Multiselect = false;
|
this.openSolutionFilesDialog.Multiselect = false;
|
||||||
|
|
||||||
|
|
||||||
Version version = Assembly.GetExecutingAssembly().GetName().Version;
|
Version version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
this.Text += " " + version.Major + "." + version.Minor;
|
this.Text += " " + version.Major + "." + version.Minor;
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ namespace LSLEditor
|
||||||
if (Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location).Contains("beta"))
|
if (Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location).Contains("beta"))
|
||||||
this.Text += " (BETA)";
|
this.Text += " (BETA)";
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Fix close buttons on tabs
|
//TODO: Fix close buttons on tabs
|
||||||
// enables close buttons on tab
|
// enables close buttons on tab
|
||||||
//this.tabControlExtended1.SetDrawMode();
|
//this.tabControlExtended1.SetDrawMode();
|
||||||
|
@ -618,6 +618,9 @@ namespace LSLEditor
|
||||||
browser.ShowWebBrowser("Import Examples", Properties.Settings.Default.Examples);
|
browser.ShowWebBrowser("Import Examples", Properties.Settings.Default.Examples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Return value indicate whether file was saved or not.
|
||||||
|
*/
|
||||||
public bool SaveFile(EditForm editForm, bool blnSaveAs)
|
public bool SaveFile(EditForm editForm, bool blnSaveAs)
|
||||||
{
|
{
|
||||||
DialogResult dialogresult = DialogResult.OK;
|
DialogResult dialogresult = DialogResult.OK;
|
||||||
|
@ -1039,7 +1042,7 @@ namespace LSLEditor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.browserInWindowToolStripMenuItem.Checked =
|
this.browserInWindowToolStripMenuItem.Checked =
|
||||||
Properties.Settings.Default.BrowserInWindow;
|
Properties.Settings.Default.BrowserInWindow;
|
||||||
|
|
||||||
this.WikiSepBrowserstoolStripMenuItem.Checked =
|
this.WikiSepBrowserstoolStripMenuItem.Checked =
|
||||||
|
@ -1350,12 +1353,12 @@ namespace LSLEditor
|
||||||
this.toolStripStatusLabel1.Text = "";
|
this.toolStripStatusLabel1.Text = "";
|
||||||
|
|
||||||
//int intTabToDelete = (int)this.contextMenuStrip1.Tag;
|
//int intTabToDelete = (int)this.contextMenuStrip1.Tag;
|
||||||
|
|
||||||
if (intTabToDelete >= this.tabControlExtended1.TabCount)
|
if (intTabToDelete >= this.tabControlExtended1.TabCount)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TabPage tabPage = this.tabControlExtended1.TabPages[intTabToDelete];
|
TabPage tabPage = this.tabControlExtended1.TabPages[intTabToDelete];
|
||||||
|
|
||||||
if (tabPage.Text.Contains("Browser"))
|
if (tabPage.Text.Contains("Browser"))
|
||||||
{
|
{
|
||||||
this.browser.Dispose();
|
this.browser.Dispose();
|
||||||
|
@ -1439,7 +1442,7 @@ namespace LSLEditor
|
||||||
int intTabToClose = this.tabControlExtended1.SelectedIndex;
|
int intTabToClose = this.tabControlExtended1.SelectedIndex;
|
||||||
if (intTabToClose >= 0)
|
if (intTabToClose >= 0)
|
||||||
CloseTab(intTabToClose);
|
CloseTab(intTabToClose);
|
||||||
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1905,7 +1908,7 @@ namespace LSLEditor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void toolStripMenuItem9_Click_1(object sender, EventArgs e)
|
private void toolStripMenuItem9_Click_1(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,34 +118,34 @@
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>293, 17</value>
|
<value>865, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="openFileDialog0.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="openNoteFilesDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>699, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveNoteFilesDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>371, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openScriptFilesDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="saveFileDialog0.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="saveScriptFilesDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>157, 17</value>
|
<value>533, 17</value>
|
||||||
</metadata>
|
|
||||||
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>563, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>703, 17</value>
|
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 56</value>
|
<value>324, 56</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>408, 17</value>
|
<value>17, 56</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="pageSetupDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="pageSetupDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>839, 17</value>
|
<value>172, 56</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="openFileDialog2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="openSolutionFilesDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>133, 56</value>
|
<value>187, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>273, 56</value>
|
<value>440, 56</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>53</value>
|
<value>53</value>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue