fixed #1263 - don't trash the current directory on exporting a minimap

This commit is contained in:
Chris Forbes
2011-11-04 19:28:19 +13:00
parent 4ad7af8a58
commit 718742be4a
2 changed files with 9 additions and 13 deletions

View File

@@ -54,7 +54,6 @@ namespace OpenRA.Editor
this.resourcePalette = new System.Windows.Forms.FlowLayoutPanel();
this.surface1 = new OpenRA.Editor.Surface();
this.tt = new System.Windows.Forms.ToolTip(this.components);
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -263,12 +262,6 @@ namespace OpenRA.Editor
//
this.tt.ShowAlways = true;
//
// saveFileDialog
//
this.saveFileDialog.DefaultExt = "*.png";
this.saveFileDialog.Filter = "PNG Image (*.png)|";
this.saveFileDialog.Title = "Export minimap to PNG";
//
// splitContainer3
//
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -568,7 +561,6 @@ namespace OpenRA.Editor
private Surface surface1;
private System.Windows.Forms.PictureBox pmMiniMap;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.SaveFileDialog saveFileDialog;
private System.Windows.Forms.SplitContainer splitContainer3;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelMousePosition;

View File

@@ -419,11 +419,15 @@ namespace OpenRA.Editor
void ExportMinimap(object sender, EventArgs e)
{
saveFileDialog.InitialDirectory = Path.Combine(Environment.CurrentDirectory, "maps");
saveFileDialog.FileName = Path.ChangeExtension(loadedMapName, ".png");
if (DialogResult.OK == saveFileDialog.ShowDialog())
pmMiniMap.Image.Save(saveFileDialog.FileName);
using( var sfd = new SaveFileDialog() {
InitialDirectory = Path.Combine(Environment.CurrentDirectory, "maps"),
DefaultExt = "*.png",
Filter = "PNG Image (*.png)|*.png",
Title = "Export Minimap to PNG",
FileName = Path.ChangeExtension(loadedMapName, ".png"),
RestoreDirectory = true } )
if (DialogResult.OK == sfd.ShowDialog())
pmMiniMap.Image.Save(sfd.FileName);
}
void ShowActorNamesClicked(object sender, EventArgs e)