Last used map folder path is now stored in program configuration. It is used in "Open Map" dialog.

This commit is contained in:
MaxED 2014-05-05 09:59:20 +00:00
parent bb368b56ca
commit 40bba55599
2 changed files with 9 additions and 0 deletions

View file

@ -108,6 +108,7 @@ namespace CodeImp.DoomBuilder.Config
private bool gzShowVisualVertices;
private int gzVisualVertexSize;
private string lastUsedConfigName;
private string lastUsedMapFolder;
private bool gzMarkExtraFloors;
private int maxRecentFiles;
private bool autoClearSideTextures;
@ -190,6 +191,7 @@ namespace CodeImp.DoomBuilder.Config
public bool GZShowVisualVertices { get { return gzShowVisualVertices; } internal set { gzShowVisualVertices = value; } }
public int GZVisualVertexSize { get { return gzVisualVertexSize; } internal set { gzVisualVertexSize = value; } }
public string LastUsedConfigName { get { return lastUsedConfigName; } internal set { lastUsedConfigName = value; } }
public string LastUsedMapFolder { get { return lastUsedMapFolder; } internal set { lastUsedMapFolder = value; } }
public bool GZMarkExtraFloors { get { return gzMarkExtraFloors; } internal set { gzMarkExtraFloors = value; } }
public int MaxRecentFiles { get { return maxRecentFiles; } internal set { maxRecentFiles = General.Clamp(value, 8, 25); } }
public bool AutoClearSidedefTextures { get { return autoClearSideTextures; } internal set { autoClearSideTextures = value; } }
@ -295,6 +297,7 @@ namespace CodeImp.DoomBuilder.Config
gzShowVisualVertices = cfg.ReadSetting("gzshowvisualvertices", true);
gzVisualVertexSize = cfg.ReadSetting("gzvisualvertexsize", 6);
lastUsedConfigName = cfg.ReadSetting("lastusedconfigname", "");
lastUsedMapFolder = cfg.ReadSetting("lastusedmapfolder", "");
gzMarkExtraFloors = cfg.ReadSetting("gzmarkextrafloors", true);
maxRecentFiles = cfg.ReadSetting("maxrecentfiles", 8);
autoClearSideTextures = cfg.ReadSetting("autoclearsidetextures", true);
@ -384,6 +387,8 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("gzmarkextrafloors", gzMarkExtraFloors);
if(!string.IsNullOrEmpty(lastUsedConfigName))
cfg.WriteSetting("lastusedconfigname", lastUsedConfigName);
if(!string.IsNullOrEmpty(lastUsedMapFolder))
cfg.WriteSetting("lastusedmapfolder", lastUsedMapFolder);
cfg.WriteSetting("maxrecentfiles", maxRecentFiles);
cfg.WriteSetting("autoclearsidetextures", autoClearSideTextures);

View file

@ -1135,6 +1135,8 @@ namespace CodeImp.DoomBuilder
OpenFileDialog openfile = new OpenFileDialog();
openfile.Filter = "Doom WAD Files (*.wad)|*.wad";
openfile.Title = "Open Map";
if(!string.IsNullOrEmpty(settings.LastUsedMapFolder) && Directory.Exists(settings.LastUsedMapFolder)) //mxd
openfile.InitialDirectory = settings.LastUsedMapFolder; //mxd
openfile.AddExtension = false;
openfile.CheckFileExists = true;
openfile.Multiselect = false;
@ -1272,6 +1274,7 @@ namespace CodeImp.DoomBuilder
//mxd
mainwindow.UpdateGZDoomPanel();
settings.LastUsedMapFolder = Path.GetDirectoryName(filename);
}
else
{
@ -1424,6 +1427,7 @@ namespace CodeImp.DoomBuilder
{
// Add recent file
mainwindow.AddRecentFile(map.FilePathName);
settings.LastUsedMapFolder = Path.GetDirectoryName(map.FilePathName); //mxd
result = true;
}
General.Plugins.OnMapSaveEnd(SavePurpose.AsNewFile);