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

View file

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

View file

@ -29,9 +29,11 @@ namespace CodeImp.DoomBuilder.Windows
{ {
// Variables // Variables
private DataLocation res; private DataLocation res;
private string startPath;
// Properties private Controls.FolderSelectDialog dirdialog;
public DataLocation ResourceLocation { get { return res; } }
// Properties
public DataLocation ResourceLocation { get { return res; } }
// Constructor // Constructor
public ResourceOptionsForm(DataLocation settings, string caption, string startPath) //mxd. added startPath public ResourceOptionsForm(DataLocation settings, string caption, string startPath) //mxd. added startPath
@ -71,12 +73,7 @@ namespace CodeImp.DoomBuilder.Windows
// Checkbox // Checkbox
notfortesting.Checked = res.notfortesting; notfortesting.Checked = res.notfortesting;
//mxd this.startPath = startPath;
if(!string.IsNullOrEmpty(startPath))
{
string startDir = Path.GetDirectoryName(startPath);
if(Directory.Exists(startDir)) dirdialog.SelectedPath = startDir;
}
} }
// OK clicked // OK clicked
@ -184,11 +181,29 @@ namespace CodeImp.DoomBuilder.Windows
// Browse Directory clicked // Browse Directory clicked
private void browsedir_Click(object sender, EventArgs e) private void browsedir_Click(object sender, EventArgs e)
{ {
// Browse for Directory // Browse for Directory
if(dirdialog.ShowDialog(this) == DialogResult.OK) 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 // Use this directory
dirlocation.Text = dirdialog.SelectedPath; 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"> <metadata name="wadfiledialog.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="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"> <metadata name="pk3filedialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>227, 17</value> <value>227, 17</value>
</metadata> </metadata>