Changed Resource directory browser to use Win7 folder dialog, not Win9x one (reported by dpJudas)

This commit is contained in:
ZZYZX 2018-07-13 07:56:13 +03:00 committed by spherallic
parent e4f3f50545
commit ac1bb31b60
5 changed files with 30 additions and 22 deletions

Binary file not shown.

View file

@ -124,6 +124,7 @@
<Compile Include="Controls\ArgumentBox.Designer.cs">
<DependentUpon>ArgumentBox.cs</DependentUpon>
</Compile>
<Compile Include="Controls\FolderSelectDialog.cs" />
<Compile Include="Controls\ScriptDocumentTab.cs">
<SubType>Component</SubType>
</Compile>
@ -1399,6 +1400,7 @@
<DependentUpon>VertexEditForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>

View file

@ -51,7 +51,6 @@ namespace CodeImp.DoomBuilder.Windows
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
this.wadfiledialog = new System.Windows.Forms.OpenFileDialog();
this.dirdialog = new System.Windows.Forms.FolderBrowserDialog();
this.pk3filedialog = new System.Windows.Forms.OpenFileDialog();
this.notfortesting = new System.Windows.Forms.CheckBox();
label1 = new System.Windows.Forms.Label();
@ -306,10 +305,6 @@ namespace CodeImp.DoomBuilder.Windows
this.wadfiledialog.Filter = "WAD Files (*.wad;*.srb)|*.wad;*.srb|Kart files (*.kart)|*.kart|TopDown Files (*.td)|*.td|All Files|*";
this.wadfiledialog.Title = "Browse WAD File";
//
// dirdialog
//
this.dirdialog.Description = "Please select a directory from which to load images when editing your map...";
//
// pk3filedialog
//
this.pk3filedialog.Filter = "Doom PK3/PK7 Files (*.pk3;*.pk7)|*.pk3;*.pk7";
@ -373,7 +368,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.CheckBox dir_flats;
private System.Windows.Forms.CheckBox dir_textures;
private System.Windows.Forms.OpenFileDialog wadfiledialog;
private System.Windows.Forms.FolderBrowserDialog dirdialog;
private System.Windows.Forms.TabPage pk3filetab;
private System.Windows.Forms.Button browsepk3;
private System.Windows.Forms.TextBox pk3location;

View file

@ -29,9 +29,11 @@ namespace CodeImp.DoomBuilder.Windows
{
// Variables
private DataLocation res;
private string startPath;
private Controls.FolderSelectDialog dirdialog;
// Properties
public DataLocation ResourceLocation { get { return res; } }
// Properties
public DataLocation ResourceLocation { get { return res; } }
// Constructor
public ResourceOptionsForm(DataLocation settings, string caption, string startPath) //mxd. added startPath
@ -71,12 +73,7 @@ namespace CodeImp.DoomBuilder.Windows
// Checkbox
notfortesting.Checked = res.notfortesting;
//mxd
if(!string.IsNullOrEmpty(startPath))
{
string startDir = Path.GetDirectoryName(startPath);
if(Directory.Exists(startDir)) dirdialog.SelectedPath = startDir;
}
this.startPath = startPath;
}
// OK clicked
@ -184,11 +181,29 @@ namespace CodeImp.DoomBuilder.Windows
// Browse Directory clicked
private void browsedir_Click(object sender, EventArgs e)
{
// Browse for Directory
if(dirdialog.ShowDialog(this) == DialogResult.OK)
// Browse for Directory
dirdialog = new Controls.FolderSelectDialog();
dirdialog.Title = "Select Resource Folder";
if (string.IsNullOrEmpty(dirlocation.Text) || !Directory.Exists(dirlocation.Text))
{
//mxd
if (!string.IsNullOrEmpty(startPath))
{
string startDir = Path.GetDirectoryName(startPath);
if (Directory.Exists(startDir)) dirdialog.InitialDirectory = startDir + '\\';
}
}
else
{
dirdialog.InitialDirectory = dirlocation.Text;
}
if (dirdialog.ShowDialog(this.Handle))
{
// Use this directory
dirlocation.Text = dirdialog.SelectedPath;
// Use this directory
dirlocation.Text = dirdialog.FileName;
dirdialog = null;
}
}

View file

@ -171,9 +171,6 @@
<metadata name="wadfiledialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="dirdialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>133, 17</value>
</metadata>
<metadata name="pk3filedialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>227, 17</value>
</metadata>