Texture Browser Control: "Long texture names" and "Show image size" values are now stored in program configuration.

This commit is contained in:
MaxED 2014-12-03 23:30:58 +00:00
parent 15b2adfe30
commit b129e9b111
2 changed files with 12 additions and 5 deletions

View file

@ -51,8 +51,8 @@ namespace CodeImp.DoomBuilder.Controls
private bool updating;
private int keepselected;
private bool browseFlats; //mxd
private static bool uselongtexturenames = (General.Map != null && General.Map.Config.UseLongTextureNames); //mxd
private static bool showtexturesizes = (General.Settings != null && General.Settings.ShowTextureSizes); //mxd
private static bool uselongtexturenames; //mxd
private static bool showtexturesizes; //mxd
// All items
private readonly List<ImageBrowserItem> items;
@ -70,7 +70,8 @@ namespace CodeImp.DoomBuilder.Controls
public bool PreventSelection { get { return preventselection; } set { preventselection = value; } }
public bool HideInputBox { get { return splitter.Panel2Collapsed; } set { splitter.Panel2Collapsed = value; } }
public bool BrowseFlats { get { return browseFlats; } set { browseFlats = value; } } //mxd
public static bool ShowTextureSizes { get { return showtexturesizes; } } //mxd
public static bool ShowTextureSizes { get { return showtexturesizes; } internal set { showtexturesizes = value; } } //mxd
public static bool UseLongTextureNames { get { return uselongtexturenames; } internal set { uselongtexturenames = value; } } //mxd
public ListViewItem SelectedItem { get { if(list.SelectedItems.Count > 0) return list.SelectedItems[0]; else return null; } }
#endregion

View file

@ -62,6 +62,9 @@ namespace CodeImp.DoomBuilder.Windows
string imgType = (browseFlats ? "flats" : "textures");
this.Text = "Browse " + imgType;
// Setup texture browser
ImageBrowserControl.ShowTextureSizes = General.Settings.ReadSetting("browserwindow.showtexturesizes", General.Settings.ShowTextureSizes);
ImageBrowserControl.UseLongTextureNames = General.Map.Config.UseLongTextureNames && General.Settings.ReadSetting("browserwindow.uselongtexturenames", true);
browser.BrowseFlats = browseFlats;
browser.ApplySettings();
@ -441,6 +444,10 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Save last selected texture set
if(this.DialogResult == DialogResult.OK && tvTextureSets.SelectedNode != null)
General.Settings.WriteSetting("browserwindow.textureset", tvTextureSets.SelectedNode.Name);
//mxd. Save ImageBrowserControl settings
General.Settings.WriteSetting("browserwindow.showtexturesizes", ImageBrowserControl.ShowTextureSizes);
General.Settings.WriteSetting("browserwindow.uselongtexturenames", ImageBrowserControl.UseLongTextureNames);
// Clean up
browser.CleanUp();
@ -451,8 +458,7 @@ namespace CodeImp.DoomBuilder.Windows
public static string Browse(IWin32Window parent, string select, bool browseFlats)
{
TextureBrowserForm browser = new TextureBrowserForm(select, browseFlats);
if(browser.ShowDialog(parent) == DialogResult.OK)
return browser.SelectedName; // Return result
if(browser.ShowDialog(parent) == DialogResult.OK) return browser.SelectedName; // Return result
// Cancelled
return select;