Added, Textures Browser: redesigned textures list. Textures preview size can now be changed from the Textures Browser window. Folders are now shown in the textures list.

Fixed, Script Editor: Find and Replace window now sets keyboard focus to the input textbox when opening the window/switching between tabs.
Fixed, Nodes Viewer mode: SEGS overflows were not handled, causing a crash. Also extended SEGS limit is now used.
Updated ZDoom_DECORATE.cfg (A_SetSize).
This commit is contained in:
MaxED 2016-12-22 15:04:40 +00:00
parent d73ea867a4
commit 447851e457
46 changed files with 1632 additions and 980 deletions

View file

@ -252,6 +252,7 @@ keywords
A_SetScale = "A_SetScale(float scaleX[, float scaleY = scaleX[, int pointer = AAPTR_DEFAULT[, bool usezero = false]]])"; A_SetScale = "A_SetScale(float scaleX[, float scaleY = scaleX[, int pointer = AAPTR_DEFAULT[, bool usezero = false]]])";
A_SetShadow = "A_SetShadow"; A_SetShadow = "A_SetShadow";
A_SetShootable = "A_SetShootable"; A_SetShootable = "A_SetShootable";
A_SetSize = "bool A_SetSize(float newradius[, float newheight = -1[, bool testpos = false]])";
A_SetSolid = "A_SetSolid"; A_SetSolid = "A_SetSolid";
A_SetSpecial = "A_SetSpecial(int special, int arg0, int arg1, int arg2, int arg3, int arg4)"; A_SetSpecial = "A_SetSpecial(int special, int arg0, int arg1, int arg2, int arg3, int arg4)";
A_SetSpecies = "A_SetSpecies(str species[, int pointer = AAPTR_DEFAULT])"; A_SetSpecies = "A_SetSpecies(str species[, int pointer = AAPTR_DEFAULT])";

View file

@ -65,7 +65,6 @@
<li>&quot;<strong>Circle</strong>&quot;. The argument value is used as circle radius.</li> <li>&quot;<strong>Circle</strong>&quot;. The argument value is used as circle radius.</li>
</ul> </ul>
Rendering shapes can be toggled using &quot;<strong><a href="gzdb/features/general/rendering_toolbar.html">Toggle Event Lines</a></strong>&quot; action/menu button.<br /> Rendering shapes can be toggled using &quot;<strong><a href="gzdb/features/general/rendering_toolbar.html">Toggle Event Lines</a></strong>&quot; action/menu button.<br />
Currently rendering shapes are shown only in Classic modes.<br />
This property must be used in conjunction with the &quot;<strong>//$ArgN</strong>&quot; property.<br /> This property must be used in conjunction with the &quot;<strong>//$ArgN</strong>&quot; property.<br />
<br /> <br />
<strong><a name="argrendercolor" id="argrendercolor"></a>//$ArgNRenderColor &lt;integer&gt;</strong> - <span class="red">GZDB only</span>.<br /> <strong><a name="argrendercolor" id="argrendercolor"></a>//$ArgNRenderColor &lt;integer&gt;</strong> - <span class="red">GZDB only</span>.<br />

View file

@ -715,12 +715,19 @@
<Compile Include="Actions\HintsManager.cs" /> <Compile Include="Actions\HintsManager.cs" />
<Compile Include="Config\AllTexturesSet.cs" /> <Compile Include="Config\AllTexturesSet.cs" />
<Compile Include="Config\FlagTranslation.cs" /> <Compile Include="Config\FlagTranslation.cs" />
<Compile Include="Controls\ImageBrowserCategoryItem.cs" />
<Compile Include="Controls\ImageSelectorPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\Scripting\FindUsagesControl.cs"> <Compile Include="Controls\Scripting\FindUsagesControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
<Compile Include="Controls\Scripting\FindUsagesControl.Designer.cs"> <Compile Include="Controls\Scripting\FindUsagesControl.Designer.cs">
<DependentUpon>FindUsagesControl.cs</DependentUpon> <DependentUpon>FindUsagesControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Controls\TransparentLabel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Data\Scripting\FindUsagesResult.cs" /> <Compile Include="Data\Scripting\FindUsagesResult.cs" />
<Compile Include="Controls\Scripting\ScriptIconsManager.cs" /> <Compile Include="Controls\Scripting\ScriptIconsManager.cs" />
<Compile Include="Controls\Scripting\ScriptResourceDocumentTab.cs"> <Compile Include="Controls\Scripting\ScriptResourceDocumentTab.cs">
@ -1206,6 +1213,8 @@
<None Include="Resources\FixedThingsScale.png" /> <None Include="Resources\FixedThingsScale.png" />
<None Include="Resources\ErrorLargeMapObject.png" /> <None Include="Resources\ErrorLargeMapObject.png" />
<None Include="Resources\ErrorLargeText.png" /> <None Include="Resources\ErrorLargeText.png" />
<EmbeddedResource Include="Resources\Folder96.png" />
<EmbeddedResource Include="Resources\Folder96Up.png" />
<Content Include="Resources\Light.png" /> <Content Include="Resources\Light.png" />
<None Include="Resources\Lightbulb.png" /> <None Include="Resources\Lightbulb.png" />
<None Include="Resources\LightDisabled.png" /> <None Include="Resources\LightDisabled.png" />

View file

@ -27,7 +27,6 @@ namespace CodeImp.DoomBuilder.Config
{ {
// Properties // Properties
string Name { get; } string Name { get; }
int Level { get; } //mxd
ICollection<ImageData> Textures { get; } ICollection<ImageData> Textures { get; }
ICollection<ImageData> Flats { get; } ICollection<ImageData> Flats { get; }
} }

View file

@ -44,7 +44,6 @@ namespace CodeImp.DoomBuilder.Config
// Cached variables // Cached variables
private bool blackbrowsers; private bool blackbrowsers;
private bool capitalizetexturenames; //mxd
private int visualfov; private int visualfov;
private float visualmousesensx; private float visualmousesensx;
private float visualmousesensy; private float visualmousesensy;
@ -65,7 +64,6 @@ namespace CodeImp.DoomBuilder.Config
private float viewdistance; private float viewdistance;
private bool invertyaxis; private bool invertyaxis;
private string screenshotspath; //mxd private string screenshotspath; //mxd
private int previewimagesize;
private int autoscrollspeed; private int autoscrollspeed;
private int zoomfactor; private int zoomfactor;
private bool showerrorswindow; private bool showerrorswindow;
@ -88,7 +86,6 @@ namespace CodeImp.DoomBuilder.Config
private int antialiasingsamples; //mxd private int antialiasingsamples; //mxd
private bool showtexturesizes; private bool showtexturesizes;
private bool locatetexturegroup; //mxd private bool locatetexturegroup; //mxd
private bool keeptexturefilterfocused; //mxd
private SplitLineBehavior splitlinebehavior; //mxd private SplitLineBehavior splitlinebehavior; //mxd
private MergeGeometryMode mergegeomode; //mxd private MergeGeometryMode mergegeomode; //mxd
private bool splitjoinedsectors; //mxd private bool splitjoinedsectors; //mxd
@ -156,7 +153,6 @@ namespace CodeImp.DoomBuilder.Config
internal Configuration Config { get { return cfg; } } internal Configuration Config { get { return cfg; } }
public bool BlackBrowsers { get { return blackbrowsers; } internal set { blackbrowsers = value; } } public bool BlackBrowsers { get { return blackbrowsers; } internal set { blackbrowsers = value; } }
public bool CapitalizeTextureNames { get { return capitalizetexturenames; } internal set { capitalizetexturenames = value; } } //mxd
public int VisualFOV { get { return visualfov; } internal set { visualfov = value; } } public int VisualFOV { get { return visualfov; } internal set { visualfov = value; } }
public int ImageBrightness { get { return imagebrightness; } internal set { imagebrightness = value; } } public int ImageBrightness { get { return imagebrightness; } internal set { imagebrightness = value; } }
public float DoubleSidedAlpha { get { return doublesidedalpha; } internal set { doublesidedalpha = value; doublesidedalphabyte = (byte)(doublesidedalpha * 255f); } } public float DoubleSidedAlpha { get { return doublesidedalpha; } internal set { doublesidedalpha = value; doublesidedalphabyte = (byte)(doublesidedalpha * 255f); } }
@ -176,7 +172,6 @@ namespace CodeImp.DoomBuilder.Config
public int MoveSpeed { get { return movespeed; } internal set { movespeed = value; } } public int MoveSpeed { get { return movespeed; } internal set { movespeed = value; } }
public float ViewDistance { get { return viewdistance; } internal set { viewdistance = value; } } public float ViewDistance { get { return viewdistance; } internal set { viewdistance = value; } }
public bool InvertYAxis { get { return invertyaxis; } internal set { invertyaxis = value; } } public bool InvertYAxis { get { return invertyaxis; } internal set { invertyaxis = value; } }
public int PreviewImageSize { get { return previewimagesize; } internal set { previewimagesize = value; } }
public int AutoScrollSpeed { get { return autoscrollspeed; } internal set { autoscrollspeed = value; } } public int AutoScrollSpeed { get { return autoscrollspeed; } internal set { autoscrollspeed = value; } }
public int ZoomFactor { get { return zoomfactor; } internal set { zoomfactor = value; } } public int ZoomFactor { get { return zoomfactor; } internal set { zoomfactor = value; } }
public bool ShowErrorsWindow { get { return showerrorswindow; } internal set { showerrorswindow = value; } } public bool ShowErrorsWindow { get { return showerrorswindow; } internal set { showerrorswindow = value; } }
@ -200,7 +195,6 @@ namespace CodeImp.DoomBuilder.Config
public int AntiAliasingSamples { get { return antialiasingsamples; } internal set { antialiasingsamples = value; } } //mxd public int AntiAliasingSamples { get { return antialiasingsamples; } internal set { antialiasingsamples = value; } } //mxd
public bool ShowTextureSizes { get { return showtexturesizes; } internal set { showtexturesizes = value; } } public bool ShowTextureSizes { get { return showtexturesizes; } internal set { showtexturesizes = value; } }
public bool LocateTextureGroup { get { return locatetexturegroup; } internal set { locatetexturegroup = value; } } //mxd public bool LocateTextureGroup { get { return locatetexturegroup; } internal set { locatetexturegroup = value; } } //mxd
public bool KeepTextureFilterFocused { get { return keeptexturefilterfocused; } internal set { keeptexturefilterfocused = value; } } //mxd
public SplitLineBehavior SplitLineBehavior { get { return splitlinebehavior; } set { splitlinebehavior = value; } } //mxd public SplitLineBehavior SplitLineBehavior { get { return splitlinebehavior; } set { splitlinebehavior = value; } } //mxd
public MergeGeometryMode MergeGeometryMode { get { return mergegeomode; } internal set { mergegeomode = value; } } //mxd public MergeGeometryMode MergeGeometryMode { get { return mergegeomode; } internal set { mergegeomode = value; } } //mxd
public bool SplitJoinedSectors { get { return splitjoinedsectors; } internal set { splitjoinedsectors = value; } } //mxd public bool SplitJoinedSectors { get { return splitjoinedsectors; } internal set { splitjoinedsectors = value; } } //mxd
@ -302,8 +296,6 @@ namespace CodeImp.DoomBuilder.Config
{ {
// Read the cache variables // Read the cache variables
blackbrowsers = cfg.ReadSetting("blackbrowsers", false); blackbrowsers = cfg.ReadSetting("blackbrowsers", false);
capitalizetexturenames = cfg.ReadSetting("capitalizetexturenames", true); //mxd
//undolevels = cfg.ReadSetting("undolevels", 20);
visualfov = cfg.ReadSetting("visualfov", 80); visualfov = cfg.ReadSetting("visualfov", 80);
visualmousesensx = cfg.ReadSetting("visualmousesensx", 40f); visualmousesensx = cfg.ReadSetting("visualmousesensx", 40f);
visualmousesensy = cfg.ReadSetting("visualmousesensy", 40f); visualmousesensy = cfg.ReadSetting("visualmousesensy", 40f);
@ -324,7 +316,6 @@ namespace CodeImp.DoomBuilder.Config
viewdistance = cfg.ReadSetting("viewdistance", 3000.0f); viewdistance = cfg.ReadSetting("viewdistance", 3000.0f);
invertyaxis = cfg.ReadSetting("invertyaxis", false); invertyaxis = cfg.ReadSetting("invertyaxis", false);
screenshotspath = cfg.ReadSetting("screenshotspath", General.DefaultScreenshotsPath); //mxd screenshotspath = cfg.ReadSetting("screenshotspath", General.DefaultScreenshotsPath); //mxd
previewimagesize = cfg.ReadSetting("previewimagesize", 1);
autoscrollspeed = cfg.ReadSetting("autoscrollspeed", 0); autoscrollspeed = cfg.ReadSetting("autoscrollspeed", 0);
zoomfactor = cfg.ReadSetting("zoomfactor", 3); zoomfactor = cfg.ReadSetting("zoomfactor", 3);
showerrorswindow = cfg.ReadSetting("showerrorswindow", true); showerrorswindow = cfg.ReadSetting("showerrorswindow", true);
@ -347,7 +338,6 @@ namespace CodeImp.DoomBuilder.Config
antialiasingsamples = General.Clamp(cfg.ReadSetting("antialiasingsamples", 4), 0, 8) / 2 * 2; //mxd antialiasingsamples = General.Clamp(cfg.ReadSetting("antialiasingsamples", 4), 0, 8) / 2 * 2; //mxd
showtexturesizes = cfg.ReadSetting("showtexturesizes", true); showtexturesizes = cfg.ReadSetting("showtexturesizes", true);
locatetexturegroup = cfg.ReadSetting("locatetexturegroup", true); //mxd locatetexturegroup = cfg.ReadSetting("locatetexturegroup", true); //mxd
keeptexturefilterfocused = cfg.ReadSetting("keeptexturefilterfocused", true); //mxd
splitlinebehavior = (SplitLineBehavior)General.Clamp(cfg.ReadSetting("splitlinebehavior", 0), 0, Enum.GetValues(typeof(SplitLineBehavior)).Length - 1); //mxd splitlinebehavior = (SplitLineBehavior)General.Clamp(cfg.ReadSetting("splitlinebehavior", 0), 0, Enum.GetValues(typeof(SplitLineBehavior)).Length - 1); //mxd
mergegeomode = (MergeGeometryMode)General.Clamp(cfg.ReadSetting("mergegeometrymode", (int)MergeGeometryMode.REPLACE), 0, Enum.GetValues(typeof(MergeGeometryMode)).Length - 1); //mxd mergegeomode = (MergeGeometryMode)General.Clamp(cfg.ReadSetting("mergegeometrymode", (int)MergeGeometryMode.REPLACE), 0, Enum.GetValues(typeof(MergeGeometryMode)).Length - 1); //mxd
splitjoinedsectors = cfg.ReadSetting("splitjoinedsectors", true); //mxd splitjoinedsectors = cfg.ReadSetting("splitjoinedsectors", true); //mxd
@ -419,8 +409,6 @@ namespace CodeImp.DoomBuilder.Config
// Write the cache variables // Write the cache variables
cfg.WriteSetting("blackbrowsers", blackbrowsers); cfg.WriteSetting("blackbrowsers", blackbrowsers);
cfg.WriteSetting("capitalizetexturenames", capitalizetexturenames); //mxd
//cfg.WriteSetting("undolevels", undolevels);
cfg.WriteSetting("visualfov", visualfov); cfg.WriteSetting("visualfov", visualfov);
cfg.WriteSetting("visualmousesensx", visualmousesensx); cfg.WriteSetting("visualmousesensx", visualmousesensx);
cfg.WriteSetting("visualmousesensy", visualmousesensy); cfg.WriteSetting("visualmousesensy", visualmousesensy);
@ -440,7 +428,6 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("viewdistance", viewdistance); cfg.WriteSetting("viewdistance", viewdistance);
cfg.WriteSetting("invertyaxis", invertyaxis); cfg.WriteSetting("invertyaxis", invertyaxis);
cfg.WriteSetting("screenshotspath", screenshotspath); //mxd cfg.WriteSetting("screenshotspath", screenshotspath); //mxd
cfg.WriteSetting("previewimagesize", previewimagesize);
cfg.WriteSetting("autoscrollspeed", autoscrollspeed); cfg.WriteSetting("autoscrollspeed", autoscrollspeed);
cfg.WriteSetting("zoomfactor", zoomfactor); cfg.WriteSetting("zoomfactor", zoomfactor);
cfg.WriteSetting("showerrorswindow", showerrorswindow); cfg.WriteSetting("showerrorswindow", showerrorswindow);
@ -463,7 +450,6 @@ namespace CodeImp.DoomBuilder.Config
cfg.WriteSetting("antialiasingsamples", antialiasingsamples); //mxd cfg.WriteSetting("antialiasingsamples", antialiasingsamples); //mxd
cfg.WriteSetting("showtexturesizes", showtexturesizes); cfg.WriteSetting("showtexturesizes", showtexturesizes);
cfg.WriteSetting("locatetexturegroup", locatetexturegroup); //mxd cfg.WriteSetting("locatetexturegroup", locatetexturegroup); //mxd
cfg.WriteSetting("keeptexturefilterfocused", keeptexturefilterfocused); //mxd
cfg.WriteSetting("splitlinebehavior", (int)splitlinebehavior); //mxd cfg.WriteSetting("splitlinebehavior", (int)splitlinebehavior); //mxd
cfg.WriteSetting("mergegeometrymode", (int)mergegeomode); //mxd cfg.WriteSetting("mergegeometrymode", (int)mergegeomode); //mxd
cfg.WriteSetting("splitjoinedsectors", splitjoinedsectors); //mxd cfg.WriteSetting("splitjoinedsectors", splitjoinedsectors); //mxd

View file

@ -28,7 +28,6 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Variables #region ================== Variables
protected string name; protected string name;
private int level; //mxd. Folder depth of this item
protected List<string> filters; protected List<string> filters;
#endregion #endregion
@ -36,7 +35,6 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Properties #region ================== Properties
public string Name { get { return name; } set { name = value; } } public string Name { get { return name; } set { name = value; } }
public int Level { get { return level; } set { level = value; } }
internal List<string> Filters { get { return filters; } } internal List<string> Filters { get { return filters; } }
#endregion #endregion

View file

@ -16,6 +16,7 @@
#region ================== Namespaces #region ================== Namespaces
using System;
using System.Drawing; using System.Drawing;
using CodeImp.DoomBuilder.Windows; using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
@ -64,14 +65,19 @@ namespace CodeImp.DoomBuilder.Controls
if(string.IsNullOrEmpty(texture.FilePathName) || texture is UnknownImage) DisplayImageSize(0, 0); //mxd if(string.IsNullOrEmpty(texture.FilePathName) || texture is UnknownImage) DisplayImageSize(0, 0); //mxd
else DisplayImageSize(texture.ScaledWidth, texture.ScaledHeight); //mxd else DisplayImageSize(texture.ScaledWidth, texture.ScaledHeight); //mxd
if(usepreviews ? !texture.IsPreviewLoaded : !texture.IsImageLoaded) timer.Start(); //mxd if(!texture.IsPreviewLoaded) timer.Start(); //mxd
// Set the image // Set the image
// mxd. GetPreview() returns a copy of preview, GetBitmap() returns actual bitmap return texture.GetPreview();
return (usepreviews ? texture.GetPreview() : new Bitmap(texture.GetBitmap()));
} }
} }
//mxd. This gets ImageData by name...
protected override ImageData GetImageData(string imagename)
{
return General.Map.Data.GetFlatImage(imagename);
}
// This browses for a flat // This browses for a flat
protected override string BrowseImage(string imagename) protected override string BrowseImage(string imagename)
{ {

View file

@ -0,0 +1,50 @@
#region ================== Namespaces
using System;
using CodeImp.DoomBuilder.Data;
#endregion
namespace CodeImp.DoomBuilder.Controls
{
internal class ImageBrowserCategoryItem : ImageBrowserItem
{
#region ================== Variables
private string groupname;
#endregion
#region ================== Properties
public override bool IsPreviewLoaded { get { return true; } }
public override string TextureName { get { return groupname; } }
#endregion
#region ================== Constructors
private ImageBrowserCategoryItem(ImageData icon, string tooltip, bool showfullname) : base(icon, tooltip, showfullname) { }
public ImageBrowserCategoryItem(ImageBrowserItemType itemtype, string groupname)
{
this.groupname = groupname;
this.itemtype = itemtype;
switch(itemtype)
{
case ImageBrowserItemType.FOLDER:
icon = General.Map.Data.FolderTexture;
break;
case ImageBrowserItemType.FOLDER_UP:
icon = General.Map.Data.FolderUpTexture;
break;
default:
throw new NotImplementedException("Unsupported ItemType");
}
}
#endregion
}
}

View file

@ -33,16 +33,19 @@ namespace CodeImp.DoomBuilder.Controls
this.labelMixMode = new System.Windows.Forms.Label(); this.labelMixMode = new System.Windows.Forms.Label();
this.label = new System.Windows.Forms.Label(); this.label = new System.Windows.Forms.Label();
this.splitter = new System.Windows.Forms.SplitContainer(); this.splitter = new System.Windows.Forms.SplitContainer();
this.list = new CodeImp.DoomBuilder.Controls.OptimizedListView(); this.objectclear = new System.Windows.Forms.Button();
this.showsubdirtextures = new System.Windows.Forms.CheckBox(); this.sizecombo = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.usedtexturesonly = new System.Windows.Forms.CheckBox();
this.longtexturenames = new System.Windows.Forms.CheckBox(); this.longtexturenames = new System.Windows.Forms.CheckBox();
this.filterheightlabel = new System.Windows.Forms.Label(); this.filterheightlabel = new System.Windows.Forms.Label();
this.filterHeight = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.filterwidthlabel = new System.Windows.Forms.Label(); this.filterwidthlabel = new System.Windows.Forms.Label();
this.filterWidth = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.texturetypecombo = new System.Windows.Forms.ComboBox();
this.cbMixMode = new System.Windows.Forms.ComboBox();
this.objectname = new System.Windows.Forms.TextBox(); this.objectname = new System.Windows.Forms.TextBox();
this.refreshtimer = new System.Windows.Forms.Timer(this.components); this.refreshtimer = new System.Windows.Forms.Timer(this.components);
this.list = new CodeImp.DoomBuilder.Controls.ImageSelectorPanel();
this.filterHeight = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.filterWidth = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.splitter.Panel1.SuspendLayout(); this.splitter.Panel1.SuspendLayout();
this.splitter.Panel2.SuspendLayout(); this.splitter.Panel2.SuspendLayout();
this.splitter.SuspendLayout(); this.splitter.SuspendLayout();
@ -51,7 +54,7 @@ namespace CodeImp.DoomBuilder.Controls
// labelMixMode // labelMixMode
// //
this.labelMixMode.AutoSize = true; this.labelMixMode.AutoSize = true;
this.labelMixMode.Location = new System.Drawing.Point(3, 9); this.labelMixMode.Location = new System.Drawing.Point(3, 8);
this.labelMixMode.Name = "labelMixMode"; this.labelMixMode.Name = "labelMixMode";
this.labelMixMode.Size = new System.Drawing.Size(37, 13); this.labelMixMode.Size = new System.Drawing.Size(37, 13);
this.labelMixMode.TabIndex = 0; this.labelMixMode.TabIndex = 0;
@ -60,7 +63,7 @@ namespace CodeImp.DoomBuilder.Controls
// label // label
// //
this.label.AutoSize = true; this.label.AutoSize = true;
this.label.Location = new System.Drawing.Point(131, 9); this.label.Location = new System.Drawing.Point(164, 9);
this.label.Name = "label"; this.label.Name = "label";
this.label.Size = new System.Drawing.Size(32, 13); this.label.Size = new System.Drawing.Size(32, 13);
this.label.TabIndex = 0; this.label.TabIndex = 0;
@ -81,59 +84,79 @@ namespace CodeImp.DoomBuilder.Controls
// //
// splitter.Panel2 // splitter.Panel2
// //
this.splitter.Panel2.Controls.Add(this.showsubdirtextures); this.splitter.Panel2.Controls.Add(this.objectclear);
this.splitter.Panel2.Controls.Add(this.sizecombo);
this.splitter.Panel2.Controls.Add(this.label1);
this.splitter.Panel2.Controls.Add(this.usedtexturesonly);
this.splitter.Panel2.Controls.Add(this.longtexturenames); this.splitter.Panel2.Controls.Add(this.longtexturenames);
this.splitter.Panel2.Controls.Add(this.filterheightlabel); this.splitter.Panel2.Controls.Add(this.filterheightlabel);
this.splitter.Panel2.Controls.Add(this.filterHeight); this.splitter.Panel2.Controls.Add(this.filterHeight);
this.splitter.Panel2.Controls.Add(this.filterwidthlabel); this.splitter.Panel2.Controls.Add(this.filterwidthlabel);
this.splitter.Panel2.Controls.Add(this.filterWidth); this.splitter.Panel2.Controls.Add(this.filterWidth);
this.splitter.Panel2.Controls.Add(this.cbMixMode); this.splitter.Panel2.Controls.Add(this.texturetypecombo);
this.splitter.Panel2.Controls.Add(this.labelMixMode); this.splitter.Panel2.Controls.Add(this.labelMixMode);
this.splitter.Panel2.Controls.Add(this.objectname); this.splitter.Panel2.Controls.Add(this.objectname);
this.splitter.Panel2.Controls.Add(this.label); this.splitter.Panel2.Controls.Add(this.label);
this.splitter.Size = new System.Drawing.Size(840, 346); this.splitter.Size = new System.Drawing.Size(840, 346);
this.splitter.SplitterDistance = 312; this.splitter.SplitterDistance = 284;
this.splitter.TabIndex = 0; this.splitter.TabIndex = 0;
this.splitter.TabStop = false; this.splitter.TabStop = false;
// //
// list // objectclear
// //
this.list.Dock = System.Windows.Forms.DockStyle.Fill; this.objectclear.Image = global::CodeImp.DoomBuilder.Properties.Resources.Close;
this.list.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.objectclear.Location = new System.Drawing.Point(330, 4);
this.list.HideSelection = false; this.objectclear.Name = "objectclear";
this.list.Location = new System.Drawing.Point(0, 0); this.objectclear.Size = new System.Drawing.Size(26, 23);
this.list.MultiSelect = false; this.objectclear.TabIndex = 3;
this.list.Name = "list"; this.objectclear.TabStop = false;
this.list.OwnerDraw = true; this.objectclear.UseVisualStyleBackColor = true;
this.list.ShowItemToolTips = true; this.objectclear.Click += new System.EventHandler(this.objectclear_Click);
this.list.Size = new System.Drawing.Size(840, 312);
this.list.TabIndex = 1;
this.list.TabStop = false;
this.list.TileSize = new System.Drawing.Size(90, 90);
this.list.UseCompatibleStateImageBehavior = false;
this.list.View = System.Windows.Forms.View.Tile;
this.list.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.list_DrawItem);
this.list.DoubleClick += new System.EventHandler(this.list_DoubleClick);
this.list.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.list_ItemSelectionChanged);
this.list.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.list_KeyPress);
this.list.KeyDown += new System.Windows.Forms.KeyEventHandler(this.list_KeyDown);
// //
// showsubdirtextures // sizecombo
// //
this.showsubdirtextures.AutoSize = true; this.sizecombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.showsubdirtextures.Location = new System.Drawing.Point(595, 8); this.sizecombo.FormattingEnabled = true;
this.showsubdirtextures.Name = "showsubdirtextures"; this.sizecombo.Items.AddRange(new object[] {
this.showsubdirtextures.Size = new System.Drawing.Size(172, 17); "1:1",
this.showsubdirtextures.TabIndex = 0; "64",
this.showsubdirtextures.TabStop = false; "96",
this.showsubdirtextures.Text = "Show textures in subdirectories"; "128",
this.showsubdirtextures.UseVisualStyleBackColor = true; "192",
this.showsubdirtextures.CheckedChanged += new System.EventHandler(this.showsubdirtextures_CheckedChanged); "256"});
this.sizecombo.Location = new System.Drawing.Point(43, 32);
this.sizecombo.Margin = new System.Windows.Forms.Padding(3, 3, 6, 3);
this.sizecombo.Name = "sizecombo";
this.sizecombo.Size = new System.Drawing.Size(107, 21);
this.sizecombo.TabIndex = 2;
this.sizecombo.TabStop = false;
this.sizecombo.SelectedIndexChanged += new System.EventHandler(this.sizecombo_SelectedIndexChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(10, 35);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(30, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Size:";
//
// usedtexturesonly
//
this.usedtexturesonly.AutoSize = true;
this.usedtexturesonly.Location = new System.Drawing.Point(365, 8);
this.usedtexturesonly.Name = "usedtexturesonly";
this.usedtexturesonly.Size = new System.Drawing.Size(113, 17);
this.usedtexturesonly.TabIndex = 0;
this.usedtexturesonly.TabStop = false;
this.usedtexturesonly.Text = "Used textures only";
this.usedtexturesonly.UseVisualStyleBackColor = true;
this.usedtexturesonly.CheckedChanged += new System.EventHandler(this.usedtexturesonly_CheckedChanged);
// //
// longtexturenames // longtexturenames
// //
this.longtexturenames.AutoSize = true; this.longtexturenames.AutoSize = true;
this.longtexturenames.Location = new System.Drawing.Point(470, 8); this.longtexturenames.Location = new System.Drawing.Point(365, 34);
this.longtexturenames.Name = "longtexturenames"; this.longtexturenames.Name = "longtexturenames";
this.longtexturenames.Size = new System.Drawing.Size(119, 17); this.longtexturenames.Size = new System.Drawing.Size(119, 17);
this.longtexturenames.TabIndex = 0; this.longtexturenames.TabIndex = 0;
@ -145,83 +168,46 @@ namespace CodeImp.DoomBuilder.Controls
// filterheightlabel // filterheightlabel
// //
this.filterheightlabel.AutoSize = true; this.filterheightlabel.AutoSize = true;
this.filterheightlabel.Location = new System.Drawing.Point(367, 9); this.filterheightlabel.Location = new System.Drawing.Point(258, 35);
this.filterheightlabel.Name = "filterheightlabel"; this.filterheightlabel.Name = "filterheightlabel";
this.filterheightlabel.Size = new System.Drawing.Size(41, 13); this.filterheightlabel.Size = new System.Drawing.Size(41, 13);
this.filterheightlabel.TabIndex = 0; this.filterheightlabel.TabIndex = 0;
this.filterheightlabel.Text = "Height:"; this.filterheightlabel.Text = "Height:";
// //
// filterHeight
//
this.filterHeight.AllowDecimal = false;
this.filterHeight.AllowNegative = false;
this.filterHeight.AllowRelative = false;
this.filterHeight.ButtonStep = 1;
this.filterHeight.ButtonStepBig = 10F;
this.filterHeight.ButtonStepFloat = 1F;
this.filterHeight.ButtonStepSmall = 0.1F;
this.filterHeight.ButtonStepsUseModifierKeys = false;
this.filterHeight.ButtonStepsWrapAround = false;
this.filterHeight.Location = new System.Drawing.Point(410, 4);
this.filterHeight.Name = "filterHeight";
this.filterHeight.Size = new System.Drawing.Size(54, 24);
this.filterHeight.StepValues = null;
this.filterHeight.TabIndex = 0;
this.filterHeight.TabStop = false;
this.filterHeight.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
//
// filterwidthlabel // filterwidthlabel
// //
this.filterwidthlabel.AutoSize = true; this.filterwidthlabel.AutoSize = true;
this.filterwidthlabel.Location = new System.Drawing.Point(268, 9); this.filterwidthlabel.Location = new System.Drawing.Point(159, 35);
this.filterwidthlabel.Name = "filterwidthlabel"; this.filterwidthlabel.Name = "filterwidthlabel";
this.filterwidthlabel.Size = new System.Drawing.Size(38, 13); this.filterwidthlabel.Size = new System.Drawing.Size(38, 13);
this.filterwidthlabel.TabIndex = 0; this.filterwidthlabel.TabIndex = 0;
this.filterwidthlabel.Text = "Width:"; this.filterwidthlabel.Text = "Width:";
// //
// filterWidth // texturetypecombo
// //
this.filterWidth.AllowDecimal = false; this.texturetypecombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.filterWidth.AllowNegative = false; this.texturetypecombo.FormattingEnabled = true;
this.filterWidth.AllowRelative = false; this.texturetypecombo.Items.AddRange(new object[] {
this.filterWidth.ButtonStep = 1;
this.filterWidth.ButtonStepBig = 10F;
this.filterWidth.ButtonStepFloat = 1F;
this.filterWidth.ButtonStepSmall = 0.1F;
this.filterWidth.ButtonStepsUseModifierKeys = false;
this.filterWidth.ButtonStepsWrapAround = false;
this.filterWidth.Location = new System.Drawing.Point(308, 4);
this.filterWidth.Name = "filterWidth";
this.filterWidth.Size = new System.Drawing.Size(54, 24);
this.filterWidth.StepValues = null;
this.filterWidth.TabIndex = 0;
this.filterWidth.TabStop = false;
this.filterWidth.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
//
// cbMixMode
//
this.cbMixMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbMixMode.FormattingEnabled = true;
this.cbMixMode.Items.AddRange(new object[] {
"All", "All",
"Textures", "Textures",
"Flats", "Flats",
"By sel. type"}); "By selection type"});
this.cbMixMode.Location = new System.Drawing.Point(43, 5); this.texturetypecombo.Location = new System.Drawing.Point(43, 5);
this.cbMixMode.Margin = new System.Windows.Forms.Padding(3, 3, 6, 3); this.texturetypecombo.Margin = new System.Windows.Forms.Padding(3, 3, 6, 3);
this.cbMixMode.Name = "cbMixMode"; this.texturetypecombo.Name = "texturetypecombo";
this.cbMixMode.Size = new System.Drawing.Size(80, 21); this.texturetypecombo.Size = new System.Drawing.Size(107, 21);
this.cbMixMode.TabIndex = 0; this.texturetypecombo.TabIndex = 0;
this.cbMixMode.TabStop = false; this.texturetypecombo.TabStop = false;
this.cbMixMode.SelectedIndexChanged += new System.EventHandler(this.cbMixMode_SelectedIndexChanged); this.texturetypecombo.SelectedIndexChanged += new System.EventHandler(this.texturetypecombo_SelectedIndexChanged);
// //
// objectname // objectname
// //
this.objectname.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.objectname.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.objectname.Location = new System.Drawing.Point(166, 6); this.objectname.HideSelection = false;
this.objectname.Location = new System.Drawing.Point(199, 6);
this.objectname.Margin = new System.Windows.Forms.Padding(3, 3, 6, 3); this.objectname.Margin = new System.Windows.Forms.Padding(3, 3, 6, 3);
this.objectname.Name = "objectname"; this.objectname.Name = "objectname";
this.objectname.Size = new System.Drawing.Size(94, 20); this.objectname.Size = new System.Drawing.Size(128, 20);
this.objectname.TabIndex = 0; this.objectname.TabIndex = 0;
this.objectname.TabStop = false; this.objectname.TabStop = false;
this.objectname.TextChanged += new System.EventHandler(this.objectname_TextChanged); this.objectname.TextChanged += new System.EventHandler(this.objectname_TextChanged);
@ -232,6 +218,63 @@ namespace CodeImp.DoomBuilder.Controls
this.refreshtimer.Interval = 500; this.refreshtimer.Interval = 500;
this.refreshtimer.Tick += new System.EventHandler(this.refreshtimer_Tick); this.refreshtimer.Tick += new System.EventHandler(this.refreshtimer_Tick);
// //
// list
//
this.list.AutoScroll = true;
this.list.BackColor = System.Drawing.Color.White;
this.list.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.list.Dock = System.Windows.Forms.DockStyle.Fill;
this.list.HideSelection = false;
this.list.ImageSize = 128;
this.list.Location = new System.Drawing.Point(0, 0);
this.list.MultiSelect = false;
this.list.Name = "list";
this.list.Size = new System.Drawing.Size(840, 284);
this.list.TabIndex = 1;
this.list.Title = "Default group";
this.list.ItemDoubleClicked += new CodeImp.DoomBuilder.Controls.ImageSelectorPanel.ItemSelectedEventHandler(this.list_ItemDoubleClicked);
this.list.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.list_KeyPress);
//
// filterHeight
//
this.filterHeight.AllowDecimal = false;
this.filterHeight.AllowExpressions = false;
this.filterHeight.AllowNegative = false;
this.filterHeight.AllowRelative = false;
this.filterHeight.ButtonStep = 1;
this.filterHeight.ButtonStepBig = 10F;
this.filterHeight.ButtonStepFloat = 1F;
this.filterHeight.ButtonStepSmall = 0.1F;
this.filterHeight.ButtonStepsUseModifierKeys = false;
this.filterHeight.ButtonStepsWrapAround = false;
this.filterHeight.Location = new System.Drawing.Point(301, 30);
this.filterHeight.Name = "filterHeight";
this.filterHeight.Size = new System.Drawing.Size(54, 24);
this.filterHeight.StepValues = null;
this.filterHeight.TabIndex = 0;
this.filterHeight.TabStop = false;
this.filterHeight.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
//
// filterWidth
//
this.filterWidth.AllowDecimal = false;
this.filterWidth.AllowExpressions = false;
this.filterWidth.AllowNegative = false;
this.filterWidth.AllowRelative = false;
this.filterWidth.ButtonStep = 1;
this.filterWidth.ButtonStepBig = 10F;
this.filterWidth.ButtonStepFloat = 1F;
this.filterWidth.ButtonStepSmall = 0.1F;
this.filterWidth.ButtonStepsUseModifierKeys = false;
this.filterWidth.ButtonStepsWrapAround = false;
this.filterWidth.Location = new System.Drawing.Point(199, 30);
this.filterWidth.Name = "filterWidth";
this.filterWidth.Size = new System.Drawing.Size(54, 24);
this.filterWidth.StepValues = null;
this.filterWidth.TabIndex = 0;
this.filterWidth.TabStop = false;
this.filterWidth.WhenTextChanged += new System.EventHandler(this.filterSize_WhenTextChanged);
//
// ImageBrowserControl // ImageBrowserControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -250,18 +293,21 @@ namespace CodeImp.DoomBuilder.Controls
#endregion #endregion
private System.Windows.Forms.SplitContainer splitter; private System.Windows.Forms.SplitContainer splitter;
private OptimizedListView list; private CodeImp.DoomBuilder.Controls.ImageSelectorPanel list;
private System.Windows.Forms.Timer refreshtimer; private System.Windows.Forms.Timer refreshtimer;
private System.Windows.Forms.TextBox objectname; private System.Windows.Forms.TextBox objectname;
private System.Windows.Forms.ComboBox cbMixMode; private System.Windows.Forms.ComboBox texturetypecombo;
private System.Windows.Forms.Label label; private System.Windows.Forms.Label label;
private System.Windows.Forms.Label labelMixMode; private System.Windows.Forms.Label labelMixMode;
private ButtonsNumericTextbox filterWidth; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox filterWidth;
private System.Windows.Forms.Label filterheightlabel; private System.Windows.Forms.Label filterheightlabel;
private ButtonsNumericTextbox filterHeight; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox filterHeight;
private System.Windows.Forms.Label filterwidthlabel; private System.Windows.Forms.Label filterwidthlabel;
private System.Windows.Forms.CheckBox longtexturenames; private System.Windows.Forms.CheckBox longtexturenames;
private System.Windows.Forms.CheckBox showsubdirtextures; private System.Windows.Forms.CheckBox usedtexturesonly;
private System.Windows.Forms.ComboBox sizecombo;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button objectclear;
} }
} }

View file

@ -19,7 +19,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Globalization;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Windows; using CodeImp.DoomBuilder.Windows;
@ -32,12 +31,14 @@ namespace CodeImp.DoomBuilder.Controls
{ {
#region ================== Constants #region ================== Constants
private static readonly HashSet<char> AllowedSpecialChars = new HashSet<char>("!@#$%^&*()-_=+<>,.?/'\"\\;:[]{}`~".ToCharArray()); //mxd
#endregion #endregion
#region ================== Delegates / Events #region ================== Delegates / Events
public delegate void SelectedItemChangedDelegate(); public delegate void SelectedItemChangedDelegate(ImageBrowserItem item);
public delegate void SelectedItemDoubleClickDelegate(); public delegate void SelectedItemDoubleClickDelegate(ImageBrowserItem item);
public event SelectedItemChangedDelegate SelectedItemChanged; public event SelectedItemChangedDelegate SelectedItemChanged;
public event SelectedItemDoubleClickDelegate SelectedItemDoubleClicked; public event SelectedItemDoubleClickDelegate SelectedItemDoubleClicked;
@ -50,21 +51,21 @@ namespace CodeImp.DoomBuilder.Controls
private bool preventselection; private bool preventselection;
// States // States
private bool updating;
private int keepselected; private int keepselected;
private bool browseFlats; //mxd private bool browseflats; //mxd
private static bool uselongtexturenames; //mxd private bool uselongtexturenames; //mxd
private static bool showtexturesfromsubdirs; //mxd private bool blockupdate; //mxd
private int currentlevel; //mxd
// All items //mxd. All items
private readonly List<ImageBrowserItem> items; private Dictionary<string, List<ImageBrowserItem>> items; // <group, <items>>
private List<string> groups;
private string selectedgroup;
// Items visible in the list // Filtered items
private List<ImageBrowserItem> visibleitems; private List<ImageBrowserItem> visibleitems;
//mxd //mxd
private static int mixMode; private int texturetype;
#endregion #endregion
@ -72,10 +73,9 @@ namespace CodeImp.DoomBuilder.Controls
public bool PreventSelection { get { return preventselection; } set { preventselection = value; } } public bool PreventSelection { get { return preventselection; } set { preventselection = value; } }
public bool HideInputBox { get { return splitter.Panel2Collapsed; } set { splitter.Panel2Collapsed = value; } } public bool HideInputBox { get { return splitter.Panel2Collapsed; } set { splitter.Panel2Collapsed = value; } }
public bool BrowseFlats { get { return browseFlats; } set { browseFlats = value; } } //mxd public List<ImageBrowserItem> SelectedItems { get { return list.SelectedItems; } } //mxd
public static bool ShowTexturesFromSubDirectories { get { return showtexturesfromsubdirs; } internal set { showtexturesfromsubdirs = value; } } //mxd public ImageBrowserItem SelectedItem { get { return (list.SelectedItems.Count > 0 ? list.SelectedItems[0] : null); } }
public static bool UseLongTextureNames { get { return uselongtexturenames; } internal set { uselongtexturenames = value; } } //mxd public string SelectedGroup { get { return selectedgroup; } } //mxd
public ListViewItem SelectedItem { get { if(list.SelectedItems.Count > 0) return list.SelectedItems[0]; else return null; } }
#endregion #endregion
@ -86,7 +86,8 @@ namespace CodeImp.DoomBuilder.Controls
{ {
// Initialize // Initialize
InitializeComponent(); InitializeComponent();
items = new List<ImageBrowserItem>(); items = new Dictionary<string, List<ImageBrowserItem>>();
groups = new List<string>();
//mxd //mxd
StepsList sizes = new StepsList { 4, 8, 16, 32, 48, 64, 96, 128, 196, 256, 512, 1024 }; StepsList sizes = new StepsList { 4, 8, 16, 32, 48, 64, 96, 128, 196, 256, 512, 1024 };
@ -98,6 +99,36 @@ namespace CodeImp.DoomBuilder.Controls
{ {
splitter.SplitterDistance = splitter.Height - splitter.Panel2.Height - (int)Math.Round(splitter.SplitterWidth * MainForm.DPIScaler.Height); splitter.SplitterDistance = splitter.Height - splitter.Panel2.Height - (int)Math.Round(splitter.SplitterWidth * MainForm.DPIScaler.Height);
} }
//mxd
list.SelectionChanged += list_SelectionChanged;
}
// This applies the application settings
public void ApplySettings(string settingpath, bool browseflats)
{
blockupdate = true;
//TODO: group handling doesn't couple well with usedtexturesonly checkbox...
this.browseflats = browseflats;
uselongtexturenames = General.Map.Options.UseLongTextureNames;
selectedgroup = General.Settings.ReadSetting(settingpath + ".selectedgroup", string.Empty);
if(string.IsNullOrEmpty(selectedgroup) || (groups.Count > 0 && !groups.Contains(selectedgroup)))
{
selectedgroup = groups[0];
}
texturetype = General.Settings.ReadSetting(settingpath + ".texturetype", 0);
usedtexturesonly.Checked = (groups.IndexOf(selectedgroup) == 1);
int imagesize = General.Settings.ReadSetting(settingpath + ".imagesize", 128);
sizecombo.Text = (imagesize == 0 ? sizecombo.Items[0].ToString() : imagesize.ToString());
list.ImageSize = imagesize;
ApplySettings();
blockupdate = false;
} }
// This applies the application settings // This applies the application settings
@ -113,52 +144,40 @@ namespace CodeImp.DoomBuilder.Controls
// Set the size of preview images // Set the size of preview images
if(General.Map != null) if(General.Map != null)
{ {
int itemwidth = General.Map.Data.Previews.MaxImageWidth + 26;
int itemheight = General.Map.Data.Previews.MaxImageHeight + 26;
list.TileSize = new Size(itemwidth, itemheight);
//mxd //mxd
if(General.Map.Config.MixTexturesFlats) if(General.Map.Config.MixTexturesFlats)
{ {
cbMixMode.SelectedIndex = mixMode; texturetypecombo.SelectedIndex = texturetype;
} }
else else
{ {
labelMixMode.Visible = false; labelMixMode.Enabled = false;
cbMixMode.Visible = false; texturetypecombo.Enabled = false;
texturetype = 0;
int offset = label.Left - labelMixMode.Left;
label.Left -= offset;
objectname.Left -= offset;
filterWidth.Left -= offset;
filterwidthlabel.Left -= offset;
filterHeight.Left -= offset;
filterheightlabel.Left -= offset;
showsubdirtextures.Left -= offset;
longtexturenames.Left -= offset;
mixMode = 0;
} }
//mxd. Use long texture names? //mxd. Use long texture names?
longtexturenames.Checked = (uselongtexturenames && General.Map.Config.UseLongTextureNames); longtexturenames.Checked = (uselongtexturenames && General.Map.Config.UseLongTextureNames);
longtexturenames.Visible = General.Map.Config.UseLongTextureNames; longtexturenames.Enabled = General.Map.Config.UseLongTextureNames;
if(!General.Map.Config.UseLongTextureNames)
showsubdirtextures.Left = longtexturenames.Left; //mxd
} }
else else
{ {
longtexturenames.Visible = false; //mxd longtexturenames.Enabled = false; //mxd
uselongtexturenames = false; //mxd uselongtexturenames = false; //mxd
showsubdirtextures.Left = longtexturenames.Left; //mxd
} }
//mxd //mxd
if(!General.Settings.CapitalizeTextureNames) objectname.CharacterCasing = (longtexturenames.Checked ? CharacterCasing.Normal : CharacterCasing.Upper);
objectname.CharacterCasing = CharacterCasing.Normal; }
//mxd. Show textures in subfolders? //mxd. Save settings
showsubdirtextures.Checked = showtexturesfromsubdirs; public virtual void OnClose(string settingpath)
{
General.Settings.WriteSetting(settingpath + ".selectedgroup", selectedgroup);
General.Settings.WriteSetting(settingpath + ".imagesize", list.ImageSize);
if(General.Map.Config.UseLongTextureNames) General.Map.Options.UseLongTextureNames = uselongtexturenames;
CleanUp();
} }
// This cleans everything up // This cleans everything up
@ -172,16 +191,11 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Rendering #region ================== Rendering
// Draw item
private void list_DrawItem(object sender, DrawListViewItemEventArgs e)
{
if(!updating) (e.Item as ImageBrowserItem).Draw(e.Graphics, e.Bounds);
}
// Refresher // Refresher
private void refreshtimer_Tick(object sender, EventArgs e) private void refreshtimer_Tick(object sender, EventArgs e)
{ {
bool allpreviewsloaded = true; bool allpreviewsloaded = true;
bool redrawneeded = false; //mxd
// Go for all items // Go for all items
foreach(ImageBrowserItem i in list.Items) foreach(ImageBrowserItem i in list.Items)
@ -189,17 +203,15 @@ namespace CodeImp.DoomBuilder.Controls
// Check if there are still previews that are not loaded // Check if there are still previews that are not loaded
allpreviewsloaded &= i.IsPreviewLoaded; allpreviewsloaded &= i.IsPreviewLoaded;
// Items needs to be redrawn? //mxd. Item needs to be redrawn?
if(i.CheckRedrawNeeded()) redrawneeded |= i.CheckRedrawNeeded();
{
// Refresh item in list
//list.RedrawItems(i.Index, i.Index, false);
list.Invalidate();
}
} }
// If all previews were loaded, stop this timer // If all previews were loaded, stop this timer
if(allpreviewsloaded) refreshtimer.Stop(); if(allpreviewsloaded) refreshtimer.Stop();
// Redraw the list if needed
if(redrawneeded) list.Invalidate();
} }
#endregion #endregion
@ -223,32 +235,24 @@ namespace CodeImp.DoomBuilder.Controls
// Key pressed in textbox // Key pressed in textbox
private void objectname_KeyDown(object sender, KeyEventArgs e) private void objectname_KeyDown(object sender, KeyEventArgs e)
{ {
// Check what key is pressed // Let the list handle arrow keys and such
switch(e.KeyData) if(list.ProcessKeyDown(e))
{ {
// Cursor keys e.SuppressKeyPress = true;
case Keys.Left: SelectNextItem(SearchDirectionHint.Left); e.SuppressKeyPress = true; break; }
case Keys.Right: SelectNextItem(SearchDirectionHint.Right); e.SuppressKeyPress = true; break; // Toggle groups
case Keys.Up: SelectNextItem(SearchDirectionHint.Up); e.SuppressKeyPress = true; break; else if(e.KeyData == Keys.Tab)
case Keys.Down: SelectNextItem(SearchDirectionHint.Down); e.SuppressKeyPress = true; break; {
ShowNextGroup();
// Tab e.SuppressKeyPress = true;
case Keys.Tab: GoToNextSameTexture(); e.SuppressKeyPress = true; break;
} }
} }
//mxd. Handle keyboard navigation the same way regardless of list being focused... //mxd
private void list_KeyDown(object sender, KeyEventArgs e) private void objectclear_Click(object sender, EventArgs e)
{ {
// Check what key is pressed objectname.Clear();
switch(e.KeyData) list.Focus();
{
// Cursor keys
case Keys.Left: SelectNextItem(SearchDirectionHint.Left); e.SuppressKeyPress = true; break;
case Keys.Right: SelectNextItem(SearchDirectionHint.Right); e.SuppressKeyPress = true; break;
case Keys.Up: SelectNextItem(SearchDirectionHint.Up); e.SuppressKeyPress = true; break;
case Keys.Down: SelectNextItem(SearchDirectionHint.Down); e.SuppressKeyPress = true; break;
}
} }
//mxd //mxd
@ -260,40 +264,36 @@ namespace CodeImp.DoomBuilder.Controls
//mxd //mxd
protected override bool ProcessTabKey(bool forward) protected override bool ProcessTabKey(bool forward)
{ {
GoToNextSameTexture(); usedtexturesonly.Checked = !usedtexturesonly.Checked;
return false; return false;
} }
// Selection changed // Selection changed
private void list_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) private void list_SelectionChanged(object sender, List<ImageBrowserItem> selection)
{ {
if(!e.IsSelected) return; //mxd. Don't want to trigger this twice
// Prevent selecting? // Prevent selecting?
if(preventselection) if(preventselection)
{ {
foreach(ListViewItem i in list.SelectedItems) i.Selected = false; if(selection.Count > 0) list.ClearSelection(); //mxd
} }
else else
{ {
// Raise event // Raise event
if(SelectedItemChanged != null) SelectedItemChanged(); if(SelectedItemChanged != null)
SelectedItemChanged(list.SelectedItems.Count > 0 ? list.SelectedItems[0] : null);
} }
} }
// Doublelicking an item // Doublelicking an item
private void list_DoubleClick(object sender, EventArgs e) private void list_ItemDoubleClicked(object sender, ImageBrowserItem item)
{ {
if(!preventselection && (list.SelectedItems.Count > 0)) if(!preventselection && (list.SelectedItems.Count > 0))
if(SelectedItemDoubleClicked != null) SelectedItemDoubleClicked(); if(SelectedItemDoubleClicked != null) SelectedItemDoubleClicked(item);
} }
//mxd. Transfer focus to Filter textbox //mxd. Transfer input to Filter textbox
private void list_KeyPress(object sender, KeyPressEventArgs e) private void list_KeyPress(object sender, KeyPressEventArgs e)
{ {
if(!General.Settings.KeepTextureFilterFocused) return;
objectname.Focus();
if(e.KeyChar == '\b') // Any better way to check for Backspace?.. if(e.KeyChar == '\b') // Any better way to check for Backspace?..
{ {
if(!string.IsNullOrEmpty(objectname.Text) && objectname.SelectionStart > 0 && objectname.SelectionLength == 0) if(!string.IsNullOrEmpty(objectname.Text) && objectname.SelectionStart > 0 && objectname.SelectionLength == 0)
@ -303,216 +303,111 @@ namespace CodeImp.DoomBuilder.Controls
objectname.SelectionStart = s; objectname.SelectionStart = s;
} }
} }
else if(e.KeyChar == 8 && objectname.Text.Length > 0)
{ {
objectname.AppendText(e.KeyChar.ToString(CultureInfo.InvariantCulture)); if(objectname.SelectionLength > 0)
{
objectname.Text = objectname.Text.Substring(0, objectname.SelectionStart) +
objectname.Text.Substring(objectname.SelectionStart + objectname.SelectionLength);
}
else
{
objectname.Text = objectname.Text.Substring(0, objectname.Text.Length - 1);
}
}
else if((e.KeyChar >= 'a' && e.KeyChar <= 'z') || (e.KeyChar >= '0' && e.KeyChar <= '9') || AllowedSpecialChars.Contains(e.KeyChar))
{
if(objectname.SelectionLength > 0)
{
objectname.Text = objectname.Text.Substring(0, objectname.SelectionStart) +
e.KeyChar +
objectname.Text.Substring(objectname.SelectionStart + objectname.SelectionLength);
}
else
{
objectname.Text += e.KeyChar;
}
} }
} }
//mxd //mxd
private void cbMixMode_SelectedIndexChanged(object sender, EventArgs e) private void texturetypecombo_SelectedIndexChanged(object sender, EventArgs e)
{ {
mixMode = cbMixMode.SelectedIndex; texturetype = texturetypecombo.SelectedIndex;
RefillList(false); RefillList(false);
} }
//mxd
private void sizecombo_SelectedIndexChanged(object sender, EventArgs e)
{
if(blockupdate) return;
list.ImageSize = (sizecombo.SelectedIndex == 0 ? 0 : Convert.ToInt32(sizecombo.SelectedItem));
list.Focus();
}
//mxd //mxd
private void longtexturenames_CheckedChanged(object sender, EventArgs e) private void longtexturenames_CheckedChanged(object sender, EventArgs e)
{ {
if(blockupdate) return;
uselongtexturenames = longtexturenames.Checked; uselongtexturenames = longtexturenames.Checked;
objectname.CharacterCasing = (uselongtexturenames ? CharacterCasing.Normal : CharacterCasing.Upper);
RefillList(false); RefillList(false);
} }
//mxd //mxd
private void showsubdirtextures_CheckedChanged(object sender, EventArgs e) private void usedtexturesonly_CheckedChanged(object sender, EventArgs e)
{ {
showtexturesfromsubdirs = showsubdirtextures.Checked; if(blockupdate) return;
RefillList(false); ShowNextGroup();
} }
#endregion #endregion
#region ================== Methods #region ================== Methods
// This selects the next texture with the same name as the selected texture
public void GoToNextSameTexture()
{
if(list.SelectedItems.Count > 0)
{
list.Focus(); //mxd
ListViewItem selected = list.SelectedItems[0];
//mxd
foreach(ImageBrowserItem n in visibleitems)
{
if(n == selected) continue;
if(n.Text == selected.Text)
{
if(list.IsGroupCollapsed(n.Group)) list.SetGroupCollapsed(n.Group, false);
n.Selected = true;
n.Focused = true;
n.EnsureVisible();
return;
}
}
}
}
// This selects an item by longname (mxd - changed from name to longname) // This selects an item by longname (mxd - changed from name to longname)
public void SelectItem(long longname, ListViewGroup preferredgroup) public void SelectItem(long longname, string preferredgroup)
{
ImageBrowserItem lvi = null; //mxd
// Not when selecting is prevented
if(preventselection) return;
// Search in preferred group first
if(preferredgroup != null)
{
foreach(ListViewItem item in list.Items)
{
ImageBrowserItem curitem = item as ImageBrowserItem;
if(curitem != null && longname == curitem.Icon.LongName) //mxd
{
lvi = curitem;
if(item.Group == preferredgroup) break;
}
}
}
// Select the item
if(lvi != null)
{
// Select this item
list.SelectedItems.Clear();
lvi.Selected = true;
lvi.EnsureVisible();
}
}
// This performs item sleection by keys
private void SelectNextItem(SearchDirectionHint dir)
{ {
// Not when selecting is prevented // Not when selecting is prevented
if(preventselection) return; if(preventselection) return;
// Nothing selected? // Assemble group order
if(list.SelectedItems.Count == 0) List<string> searchorder;
if(string.IsNullOrEmpty(preferredgroup) || !groups.Contains(preferredgroup))
{ {
// Select first searchorder = new List<string>(groups);
SelectFirstItem();
} }
else else
{ {
//mxd searchorder = new List<string> { preferredgroup };
int index = list.SelectedItems[0].Index; List<string> othergroups = new List<string>(groups);
int targetindex = -1; othergroups.Remove(preferredgroup);
ListViewGroup startgroup = list.SelectedItems[0].Group; searchorder.AddRange(othergroups);
Rectangle startrect = list.SelectedItems[0].GetBounds(ItemBoundsPortion.Entire); }
switch(dir) // Search for item
ImageBrowserItem target = null; //mxd
string targetgroup = string.Empty;
foreach(string group in searchorder)
{
foreach(ImageBrowserItem item in items[group])
{ {
// Check previous items untill groups match... if(item.Icon.LongName == longname) //mxd
case SearchDirectionHint.Left:
if(list.SelectedIndices[0] > 0)
{
while(--index > -1)
{
if(list.Items[index].Group == startgroup)
{
targetindex = index;
break;
}
}
}
break;
// Same thing, other direction...
case SearchDirectionHint.Right:
if(list.SelectedIndices[0] < list.Items.Count - 1)
{
while(++index < list.Items.Count)
{
if(list.Items[index].Group == startgroup)
{
targetindex = index;
break;
}
}
}
break;
// Check previous items untill X coordinate match and Y coordinate is less than the start ones...
case SearchDirectionHint.Up:
while(--index > -1)
{
ListViewItem item = list.Items[index];
if(item != null && item.Group == startgroup)
{
Rectangle rect = item.GetBounds(ItemBoundsPortion.Entire);
if(rect.X == startrect.X && rect.Y < startrect.Y)
{
targetindex = index;
break;
}
}
}
break;
// Same thing, other direction...
case SearchDirectionHint.Down:
if(list.SelectedIndices[0] < list.Items.Count - 1)
{
while(++index < list.Items.Count)
{
ListViewItem item = list.Items[index];
if(item != null && item.Group == startgroup)
{
Rectangle rect = item.GetBounds(ItemBoundsPortion.Entire);
if(rect.X == startrect.X && rect.Y > startrect.Y)
{
targetindex = index;
break;
}
}
}
}
break;
}
//mxd. Use the old method for Up/Down keys, becaue it can jump between Groups...
if(targetindex == -1 && (dir == SearchDirectionHint.Up || dir == SearchDirectionHint.Down))
{
Point spos = new Point(startrect.Location.X + startrect.Width / 2, startrect.Y + startrect.Height / 2);
// Try finding 5 times in the given direction
for(int i = 0; i < 5; i++)
{ {
// Move point in given direction target = item;
switch(dir) targetgroup = group;
{ break;
case SearchDirectionHint.Up: spos.Y -= list.TileSize.Height / 2; break;
case SearchDirectionHint.Down: spos.Y += list.TileSize.Height / 2; break;
}
// Test position
ListViewItem lvi = list.GetItemAt(spos.X, spos.Y);
if(lvi != null)
{
targetindex = lvi.Index;
break;
}
} }
} }
}
//mxd. Found something?.. if(target != null)
if(targetindex != -1) {
{ // Group switching required?
// Select item SelectGroup(targetgroup);
list.SelectedItems.Clear();
list.Items[targetindex].Selected = true; // Select the item
list.SelectedItems[0].EnsureVisible(); list.SetSelectedItem(target);
}
} }
} }
@ -523,54 +418,55 @@ namespace CodeImp.DoomBuilder.Controls
if(preventselection) return; if(preventselection) return;
// Select first // Select first
if(list.Items.Count > 0) if(list.Items.Count > 0) list.SetSelectedItem(list.Items[0]);
{
list.SelectedItems.Clear();
ListViewItem lvi = list.GetItemAt(list.TileSize.Width / 2, list.TileSize.Height / 2);
if(lvi != null)
{
lvi.Selected = true;
lvi.EnsureVisible();
}
}
} }
// This adds a group // This adds a group
public ListViewGroup AddGroup(string name) public void AddGroup(string name)
{ {
ListViewGroup grp = new ListViewGroup(name); if(groups.Contains(name)) return;
list.Groups.Add(grp); groups.Add(name);
return grp; items.Add(name, new List<ImageBrowserItem>());
} }
//mxd // This selects a group
public bool IsGroupCollapsed(ListViewGroup group) public void SelectGroup(string groupname)
{ {
if(!list.Groups.Contains(group)) return false; if(string.IsNullOrEmpty(groupname) || groupname == selectedgroup || !groups.Contains(groupname)) return;
return list.IsGroupCollapsed(group); selectedgroup = groupname;
list.SetItems(items[groupname]);
blockupdate = true;
usedtexturesonly.Checked = (groups.IndexOf(selectedgroup) == 1);
blockupdate = false;
RefillList(false);
} }
//mxd. This enables group collapsability and optionally collapses it // This toggles between groups
public void SetGroupCollapsed(ListViewGroup group, bool collapse) private void ShowNextGroup()
{ {
if(!list.Groups.Contains(group)) return; if(groups.Count < 2) return;
list.SetGroupCollapsed(group, collapse); int nextgroupindex = groups.IndexOf(selectedgroup) + 1;
if(nextgroupindex >= items.Count) nextgroupindex = 0;
SelectGroup(groups[nextgroupindex]);
} }
// This begins adding items // This begins adding items
public void BeginAdding(bool keepselectedindex) { BeginAdding(0, keepselectedindex); } //mxd public void BeginAdding(bool keepselectedindex)
public void BeginAdding(int selectedlevel, bool keepselectedindex)
{ {
if(keepselectedindex && (list.SelectedItems.Count > 0)) if(keepselectedindex && (list.SelectedItems.Count > 0))
keepselected = list.SelectedIndices[0]; keepselected = list.Items.IndexOf(list.SelectedItems[0]);
else else
keepselected = -1; keepselected = -1;
currentlevel = selectedlevel;
// Clean list // Clean list
items.Clear(); items.Clear();
// Re-add groups...
foreach(string s in groups)
items.Add(s, new List<ImageBrowserItem>());
// Stop updating // Stop updating
refreshtimer.Enabled = false; refreshtimer.Enabled = false;
} }
@ -585,48 +481,66 @@ namespace CodeImp.DoomBuilder.Controls
refreshtimer.Enabled = true; refreshtimer.Enabled = true;
} }
// This adds an item //mxd. This adds a category item
public void Add(ImageData image, object tag, ListViewGroup group) public void AddFolder(ImageBrowserItemType itemtype, string group, string categoryname)
{ {
ImageBrowserItem i = new ImageBrowserItem(image, tag, uselongtexturenames); //mxd if(string.IsNullOrEmpty(group)) group = ImageSelectorPanel.DEFAULT_GROUP;
i.ListGroup = group; if(!items.ContainsKey(group))
i.Group = group; {
i.ToolTipText = image.Name; //mxd items.Add(group, new List<ImageBrowserItem>());
items.Add(i); groups.Add(group);
}
switch(itemtype)
{
case ImageBrowserItemType.FOLDER: case ImageBrowserItemType.FOLDER_UP:
items[group].Add(new ImageBrowserCategoryItem(itemtype, categoryname));
break;
default: throw new Exception("Unsupported ImageBrowserItemType");
}
} }
// This adds an item // This adds an item
public void Add(ImageData image, object tag, ListViewGroup group, string tooltiptext) public void AddItem(ImageData image, string group, string tooltip)
{ {
ImageBrowserItem i = new ImageBrowserItem(image, tag, uselongtexturenames); //mxd if(string.IsNullOrEmpty(group)) group = ImageSelectorPanel.DEFAULT_GROUP;
i.ListGroup = group; if(!items.ContainsKey(group))
i.Group = group; {
i.ToolTipText = tooltiptext; items.Add(group, new List<ImageBrowserItem>());
items.Add(i); groups.Add(group);
}
items[group].Add(new ImageBrowserItem(image, tooltip, uselongtexturenames));
}
public void AddItem(ImageData image, string group)
{
AddItem(image, group, string.Empty);
} }
// This fills the list based on the objectname filter // This fills the list based on the objectname filter
private void RefillList(bool selectfirst) private void RefillList(bool selectfirst)
{ {
if(groups.Count == 0) return;
visibleitems = new List<ImageBrowserItem>(); visibleitems = new List<ImageBrowserItem>();
//mxd. Check group name...
if(string.IsNullOrEmpty(selectedgroup))
{
if(groups.Count == 0) throw new Exception("No groups defined...");
selectedgroup = groups[0];
}
//mxd. Store info about currently selected item //mxd. Store info about currently selected item
string selectedname = string.Empty; string selectedname = string.Empty;
ListViewGroup selecteditemgroup = null; if(!selectfirst && keepselected == -1 && list.SelectedItems.Count > 0)
if(!selectfirst && keepselected == -1 && list.SelectedIndices.Count > 0)
{ {
selectedname = list.Items[list.SelectedIndices[0]].Text; selectedname = list.SelectedItems[0].Icon.Name;
selecteditemgroup = list.Items[list.SelectedIndices[0]].Group;
} }
// Begin updating list
updating = true;
//list.SuspendLayout();
list.BeginUpdate();
// Clear list first // Clear list first
// Group property of items will be set to null, we will restore it later list.Clear();
list.Items.Clear(); list.Title = selectedgroup;
//mxd. Filtering by texture size? //mxd. Filtering by texture size?
int w = filterWidth.GetResult(-1); int w = filterWidth.GetResult(-1);
@ -634,39 +548,28 @@ namespace CodeImp.DoomBuilder.Controls
// Go for all items // Go for all items
ImageBrowserItem previtem = null; //mxd ImageBrowserItem previtem = null; //mxd
for(int i = items.Count - 1; i > -1; i--) for(int i = items[selectedgroup].Count - 1; i > -1; i--)
{ {
// Add item if valid // Add item if valid
items[i].ShowFullName = uselongtexturenames; //mxd items[selectedgroup][i].ShowFullName = uselongtexturenames; //mxd
if(ValidateItem(items[i], previtem) && ValidateItemSize(items[i], w, h)) if(ValidateItem(items[selectedgroup][i], previtem) && ValidateItemSize(items[selectedgroup][i], w, h))
{ {
items[i].Group = items[i].ListGroup; visibleitems.Add(items[selectedgroup][i]);
items[i].Selected = false; previtem = items[selectedgroup][i];
visibleitems.Add(items[i]);
previtem = items[i];
} }
} }
// Fill list // Fill list
visibleitems.Sort(); visibleitems.Sort();
ListViewItem[] array = new ListViewItem[visibleitems.Count]; list.SetItems(visibleitems);
for(int i = 0; i < visibleitems.Count; i++) array[i] = visibleitems[i];
list.Items.AddRange(array);
// Done updating list
updating = false;
list.EndUpdate();
list.Invalidate();
//list.ResumeLayout();
// Make selection? // Make selection?
if(!preventselection && (list.Items.Count > 0)) if(!preventselection && list.Items.Count > 0)
{ {
// Select specific item? // Select specific item?
if(keepselected > -1) if(keepselected > -1)
{ {
list.Items[keepselected].Selected = true; list.SetSelectedItem(list.Items[keepselected]);
list.Items[keepselected].EnsureVisible();
} }
// Select first item? // Select first item?
else if(selectfirst) else if(selectfirst)
@ -674,23 +577,23 @@ namespace CodeImp.DoomBuilder.Controls
SelectFirstItem(); SelectFirstItem();
} }
//mxd. Try reselecting the same/next closest item //mxd. Try reselecting the same/next closest item
else if(selecteditemgroup != null && !string.IsNullOrEmpty(selectedname)) else if(!string.IsNullOrEmpty(selectedname))
{ {
ListViewItem bestmatch = null; ImageBrowserItem bestmatch = null;
int charsmatched = 1; int charsmatched = 1;
foreach(ListViewItem item in list.Items) foreach(ImageBrowserItem item in list.Items)
{ {
if(item.Group == selecteditemgroup && item.Text[0] == selectedname[0]) if(item.ItemType == ImageBrowserItemType.IMAGE && item.Icon.Name[0] == selectedname[0])
{ {
if(item.Text == selectedname) if(item.Icon.Name == selectedname)
{ {
bestmatch = item; bestmatch = item;
break; break;
} }
for(int i = 1; i < Math.Min(item.Text.Length, selectedname.Length); i++) for(int i = 1; i < Math.Min(item.Icon.Name.Length, selectedname.Length); i++)
{ {
if(item.Text[i] != selectedname[i]) if(item.Icon.Name[i] != selectedname[i])
{ {
if(i > charsmatched) if(i > charsmatched)
{ {
@ -703,48 +606,38 @@ namespace CodeImp.DoomBuilder.Controls
} }
} }
// Select the first item from the same group...
if(bestmatch == null)
{
foreach(ListViewItem item in list.Items)
{
if(item.Group == selecteditemgroup)
{
bestmatch = item;
break;
}
}
}
// Select found item // Select found item
if(bestmatch != null) if(bestmatch != null)
{ {
bestmatch.Selected = true; list.SetSelectedItem(bestmatch);
bestmatch.EnsureVisible(); }
else
{
SelectFirstItem();
} }
} }
} }
// Raise event // Raise event
if((SelectedItemChanged != null) && !preventselection) SelectedItemChanged(); if((SelectedItemChanged != null) && !preventselection)
SelectedItemChanged(list.SelectedItems.Count > 0 ? list.SelectedItems[0] : null);
} }
// This validates an item // This validates an item
private bool ValidateItem(ImageBrowserItem item, ImageBrowserItem previtem) private bool ValidateItem(ImageBrowserItem item, ImageBrowserItem previtem)
{ {
//mxd. Don't show duplicate items //mxd. Don't show duplicate items
if(previtem != null && item.TextureName == previtem.TextureName && item.Group == previtem.Group) return false; //mxd if(previtem != null && item.TextureName == previtem.TextureName) return false; //mxd
//mxd. mixMode: 0 = All, 1 = Textures, 2 = Flats, 3 = Based on BrowseFlats //mxd. mixMode: 0 = All, 1 = Textures, 2 = Flats, 3 = Based on BrowseFlats
if(!splitter.Panel2Collapsed) if(!splitter.Panel2Collapsed)
{ {
if(mixMode == 1 && item.Icon.IsFlat) return false; if(texturetype == 1 && item.Icon.IsFlat) return false;
if(mixMode == 2 && !item.Icon.IsFlat) return false; if(texturetype == 2 && !item.Icon.IsFlat) return false;
if(mixMode == 3 && (browseFlats != item.Icon.IsFlat)) return false; if(texturetype == 3 && (browseflats != item.Icon.IsFlat)) return false;
if(!showtexturesfromsubdirs && item.Icon.Level > currentlevel) return false;
} }
return item.Text.ToUpperInvariant().Contains(objectname.Text.ToUpperInvariant()); return item.TextureName.ToUpperInvariant().Contains(objectname.Text.ToUpperInvariant());
} }
//mxd. This validates an item's texture size //mxd. This validates an item's texture size
@ -756,13 +649,10 @@ namespace CodeImp.DoomBuilder.Controls
return true; return true;
} }
// This sends the focus to the textbox //mxd. This sends the focus to the textures list
public void FocusTextbox() public void FocusList()
{ {
if(General.Settings.KeepTextureFilterFocused) //mxd list.Focus();
objectname.Focus();
else
list.Focus();
} }
#endregion #endregion

View file

@ -120,9 +120,6 @@
<metadata name="splitter.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="splitter.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="list.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="refreshtimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="refreshtimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>103, 17</value> <value>103, 17</value>
</metadata> </metadata>

View file

@ -1,190 +1,167 @@
#region ================== Namespaces
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
using System.Drawing.Drawing2D;
using SlimDX;
#endregion #endregion
namespace CodeImp.DoomBuilder.Controls namespace CodeImp.DoomBuilder.Controls
{ {
internal class ImageBrowserItem : ListViewItem, IComparable<ImageBrowserItem> #region ================== mxd. ImageBrowserItemType
internal enum ImageBrowserItemType
{ {
#region ================== Constants // Values order is used when sorting ImageBrowserItems!
FOLDER_UP,
FOLDER,
IMAGE,
}
internal const int MAX_NAME_LENGTH = 14; //mxd #endregion
#endregion
internal class ImageBrowserItem : IComparable<ImageBrowserItem>
{
#region ================== Variables #region ================== Variables
// Display image and text protected ImageData icon;
public readonly ImageData Icon;
private string imagesize; //mxd
private bool showfullname; //mxd
private static readonly StringFormat format = new StringFormat { Alignment = StringAlignment.Center }; //mxd
// Group
private ListViewGroup listgroup;
// Image cache
private bool imageloaded; private bool imageloaded;
private bool showfullname;
protected ImageBrowserItemType itemtype;
private string tooltip;
#endregion #endregion
#region ================== Properties #region ================== Properties
public ListViewGroup ListGroup { get { return listgroup; } set { listgroup = value; } } public ImageData Icon { get { return icon; } }
public bool IsPreviewLoaded { get { return imageloaded; } } public ImageBrowserItemType ItemType { get { return itemtype; } }
public bool ShowFullName { set { showfullname = value; UpdateName(); } } public virtual bool IsPreviewLoaded { get { return imageloaded; } }
public string TextureName { get { return showfullname ? Icon.Name : Icon.ShortName; } } public bool ShowFullName { set { showfullname = value; } }
public virtual string TextureName { get { return (showfullname ? icon.Name : icon.ShortName); } }
public string ToolTip { get { return tooltip; } }
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor
// Constructors // Constructors
public ImageBrowserItem(ImageData icon, object tag, bool showfullname) protected ImageBrowserItem() { } //mxd. Needed for inheritance...
public ImageBrowserItem(ImageData icon, string tooltip, bool showfullname)
{ {
// Initialize // Initialize
this.Icon = icon; this.icon = icon;
this.Tag = tag; this.itemtype = ImageBrowserItemType.IMAGE; //mxd
this.showfullname = showfullname; //mxd this.showfullname = showfullname; //mxd
UpdateName(); //mxd this.imageloaded = icon.IsPreviewLoaded; //mxd
this.tooltip = tooltip; //mxd
} }
#endregion #endregion
#region ================== Methods #region ================== Methods
// This checks if a redraw is needed internal bool CheckRedrawNeeded()
public bool CheckRedrawNeeded()
{ {
UpdateName(); //mxd. Update texture size if needed if(icon.IsPreviewLoaded != imageloaded)
return (Icon.IsPreviewLoaded != imageloaded); {
imageloaded = icon.IsPreviewLoaded;
return true;
}
return false;
} }
// This draws the images internal void Draw(Graphics g, Image bmp, int x, int y, int w, int h, bool selected)
public void Draw(Graphics g, Rectangle bounds)
{ {
Brush forecolor; if(bmp == null) return;
Brush backcolor;
// Remember if the preview is loaded var iw = bmp.Width;
imageloaded = Icon.IsPreviewLoaded; var ih = bmp.Height;
// Drawing settings if(iw > w && iw >= ih)
g.CompositingQuality = CompositingQuality.HighSpeed;
g.InterpolationMode = InterpolationMode.NearestNeighbor;
g.SmoothingMode = SmoothingMode.HighSpeed;
g.PixelOffsetMode = PixelOffsetMode.None;
// Determine coordinates
SizeF textsize = g.MeasureString(Text, this.ListView.Font, bounds.Width * 2);
Rectangle imagerect = new Rectangle(bounds.Left + ((bounds.Width - General.Map.Data.Previews.MaxImageWidth) >> 1),
bounds.Top + ((bounds.Height - General.Map.Data.Previews.MaxImageHeight - (int)textsize.Height) >> 1),
General.Map.Data.Previews.MaxImageWidth, General.Map.Data.Previews.MaxImageHeight);
PointF textpos = new PointF(bounds.Left + (bounds.Width * 0.5f), bounds.Bottom - textsize.Height - 2);
// Determine colors
if(this.Selected)
{ {
// Highlighted ih = (int)Math.Floor(h * (ih / (float)iw));
backcolor = new LinearGradientBrush(new Point(0, bounds.Top - 1), new Point(0, bounds.Bottom + 1), iw = w;
AdjustedColor(SystemColors.Highlight, 0.2f), }
AdjustedColor(SystemColors.Highlight, -0.1f)); else if(ih > h)
forecolor = new SolidBrush(SystemColors.HighlightText); {
iw = (int)Math.Floor(w * (iw / (float)ih));
ih = h;
}
int ix = (iw < w ? x + (w - iw) / 2 : x + 1);
int iy = (ih < h ? y + (h - ih) / 2 : y + 1);
// Pick colors and brushes
Brush bgbrush, fgbrush, selectedbgbrush, selectionbrush;
Color bgcolor;
Pen selection;
if(General.Settings.BlackBrowsers)
{
bgcolor = Color.Black;
bgbrush = Brushes.Black;
fgbrush = Brushes.White;
selectedbgbrush = Brushes.Gray;
selection = Pens.Red;
selectionbrush = Brushes.Red;
} }
else else
{ {
// Normal bgcolor = SystemColors.Window;
backcolor = new SolidBrush(base.ListView.BackColor); bgbrush = SystemBrushes.Window;
forecolor = new SolidBrush(base.ListView.ForeColor); fgbrush = SystemBrushes.ControlText;
selectedbgbrush = SystemBrushes.ActiveCaption;
selection = SystemPens.HotTrack;
selectionbrush = SystemBrushes.HotTrack;
} }
// Draw! // Item bg
g.FillRectangle(backcolor, bounds); g.FillRectangle(bgbrush, x - 3, y - 3, w + 6, h + 10 + SystemFonts.MessageBoxFont.Height);
Icon.DrawPreview(g, imagerect.Location);
g.DrawString(Text, this.ListView.Font, forecolor, textpos, format);
//mxd. Dispose brushes // Selected image bg
backcolor.Dispose(); if(selected) g.FillRectangle(selectedbgbrush, x - 1, y - 1, w + 2, h + 2);
forecolor.Dispose();
//mxd. Draw size label? // Image
if(General.Settings.ShowTextureSizes && !string.IsNullOrEmpty(imagesize)) g.DrawImage(bmp, ix, iy, iw, ih);
// Frame
if(selected)
{ {
// Setup g.DrawRectangle(selection, x - 1, y - 1, w + 1, h + 1);
using(Font sizefont = new Font(this.ListView.Font.FontFamily, this.ListView.Font.SizeInPoints - 1)) g.DrawRectangle(selection, x - 2, y - 2, w + 3, h + 3);
{ }
textsize = g.MeasureString(imagesize, sizefont, bounds.Width * 2); else
textpos = new PointF(bounds.Left + textsize.Width / 2, bounds.Top + 1); {
imagerect = new Rectangle(bounds.Left + 1, bounds.Top + 1, (int)textsize.Width, (int)textsize.Height); g.DrawRectangle(Pens.Gray, x - 2, y - 2, w + 3, h + 3);
// Draw
using(SolidBrush labelbg = new SolidBrush(Color.FromArgb(196, base.ListView.ForeColor)))
{
g.FillRectangle(labelbg, imagerect);
}
using(SolidBrush labelcolor = new SolidBrush(base.ListView.BackColor))
{
g.DrawString(imagesize, sizefont, labelcolor, textpos, format);
}
}
} }
}
// This brightens or darkens a color // Image name
private static Color AdjustedColor(Color c, float amount) g.DrawString(TextureName, SystemFonts.MessageBoxFont, (selected ? selectionbrush : fgbrush), x - 2, y + h + 3);
{
Color4 cc = new Color4(c);
// Adjust color // Image size
cc.Red = Saturate((cc.Red * (1f + amount)) + (amount * 0.5f)); if(General.Settings.ShowTextureSizes && icon.IsPreviewLoaded && itemtype == ImageBrowserItemType.IMAGE)
cc.Green = Saturate((cc.Green * (1f + amount)) + (amount * 0.5f)); {
cc.Blue = Saturate((cc.Blue * (1f + amount)) + (amount * 0.5f)); string imagesize = Math.Abs(icon.ScaledWidth) + "x" + Math.Abs(icon.ScaledHeight);
SizeF textsize = g.MeasureString(imagesize, SystemFonts.MessageBoxFont);
textsize.Width += 2;
textsize.Height -= 2;
// Return result // Draw bg
return Color.FromArgb(cc.ToArgb()); using(Brush bg = new SolidBrush(Color.FromArgb(192, bgcolor)))
} {
g.FillRectangle(bg, x, y, textsize.Width, textsize.Height);
}
// This clamps a value between 0 and 1 // Draw text
private static float Saturate(float v) g.DrawString(imagesize, SystemFonts.MessageBoxFont, (selected ? selectionbrush : fgbrush), x, y - 1);
{ }
if(v < 0f) return 0f; else if(v > 1f) return 1f; else return v;
}
//mxd
private void UpdateName()
{
Text = (showfullname ? Icon.DisplayName : Icon.ShortName);
if(General.Settings.ShowTextureSizes && Icon.IsPreviewLoaded)
imagesize = Math.Abs(Icon.ScaledWidth) + "x" + Math.Abs(Icon.ScaledHeight);
} }
// Comparer // Comparer
public int CompareTo(ImageBrowserItem other) public int CompareTo(ImageBrowserItem other)
{ {
return this.Text.ToUpperInvariant().CompareTo(other.Text.ToUpperInvariant()); if(itemtype != other.itemtype) return ((int)itemtype).CompareTo((int)other.itemtype);
return this.TextureName.ToUpperInvariant().CompareTo(other.TextureName.ToUpperInvariant());
} }
#endregion #endregion

View file

@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.preview = new System.Windows.Forms.Panel(); this.preview = new System.Windows.Forms.Panel();
this.labelSize = new System.Windows.Forms.Label(); this.labelSize = new CodeImp.DoomBuilder.Controls.TransparentLabel();
this.timer = new System.Windows.Forms.Timer(this.components); this.timer = new System.Windows.Forms.Timer(this.components);
this.tooltip = new System.Windows.Forms.ToolTip(this.components); this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.togglefullname = new System.Windows.Forms.Button(); this.togglefullname = new System.Windows.Forms.Button();
@ -137,7 +137,7 @@ namespace CodeImp.DoomBuilder.Controls
protected System.Windows.Forms.Panel preview; protected System.Windows.Forms.Panel preview;
protected CodeImp.DoomBuilder.Controls.AutoSelectTextbox name; protected CodeImp.DoomBuilder.Controls.AutoSelectTextbox name;
private System.Windows.Forms.Label labelSize; private CodeImp.DoomBuilder.Controls.TransparentLabel labelSize;
protected System.Windows.Forms.Timer timer; protected System.Windows.Forms.Timer timer;
private System.Windows.Forms.ToolTip tooltip; private System.Windows.Forms.ToolTip tooltip;
private ConfigurablePictureBox imagebox; private ConfigurablePictureBox imagebox;

View file

@ -40,14 +40,12 @@ namespace CodeImp.DoomBuilder.Controls
private ImageData image; //mxd private ImageData image; //mxd
private string previousimagename; //mxd private string previousimagename; //mxd
protected bool multipletextures; //mxd protected bool multipletextures; //mxd
protected bool usepreviews = true; //mxd
#endregion #endregion
#region ================== Properties #region ================== Properties
public string TextureName { get { return name.Text; } set { name.Text = value; } } public string TextureName { get { return name.Text; } set { name.Text = value; } }
public bool UsePreviews { get { return usepreviews; } set { usepreviews = value; } } //mxd
[Browsable(false)] [Browsable(false)]
public bool MultipleTextures { get { return multipletextures; } set { multipletextures = value; } } public bool MultipleTextures { get { return multipletextures; } set { multipletextures = value; } }
@ -68,7 +66,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
// set the max length of texture names // set the max length of texture names
name.MaxLength = General.Map.Config.MaxTextureNameLength; name.MaxLength = General.Map.Config.MaxTextureNameLength;
if(General.Settings.CapitalizeTextureNames) this.name.CharacterCasing = CharacterCasing.Upper; //mxd if(!General.Map.Options.UseLongTextureNames) this.name.CharacterCasing = CharacterCasing.Upper; //mxd
labelSize.BackColor = Color.FromArgb(196, labelSize.BackColor); labelSize.BackColor = Color.FromArgb(196, labelSize.BackColor);
} }
@ -101,7 +99,12 @@ namespace CodeImp.DoomBuilder.Controls
switch(button) switch(button)
{ {
case MouseButtons.Right: name.Text = "-"; break; case MouseButtons.Right: name.Text = "-"; break;
case MouseButtons.Left: name.Text = BrowseImage(name.Text); break; case MouseButtons.Left:
// We need to change CharacterCasing before applying the text, so let's hack around a bit...
string newname = BrowseImage(name.Text);
name.CharacterCasing = (IsLongTextureName(newname) ? CharacterCasing.Normal : CharacterCasing.Upper);
name.Text = newname;
break;
} }
} }
@ -155,7 +158,16 @@ namespace CodeImp.DoomBuilder.Controls
private void togglefullname_Click(object sender, EventArgs e) private void togglefullname_Click(object sender, EventArgs e)
{ {
// Toggle between short and full name // Toggle between short and full name
name.Text = (name.Text == image.ShortName ? image.Name : image.ShortName); if(string.Compare(name.Text, image.ShortName, StringComparison.OrdinalIgnoreCase) == 0)
{
name.CharacterCasing = CharacterCasing.Normal;
name.Text = image.Name;
}
else
{
name.CharacterCasing = CharacterCasing.Upper;
name.Text = image.ShortName;
}
// Update icon and tooltip // Update icon and tooltip
UpdateToggleImageNameButton(image); UpdateToggleImageNameButton(image);
@ -209,9 +221,25 @@ namespace CodeImp.DoomBuilder.Controls
ImageSelectorControl_EnabledChanged(this, EventArgs.Empty); ImageSelectorControl_EnabledChanged(this, EventArgs.Empty);
} }
//mxd
private bool IsLongTextureName(string imagename)
{
if(!General.Map.Config.UseLongTextureNames || string.IsNullOrEmpty(imagename) || imagename == "-")
return false;
ImageData texture = GetImageData(imagename);
if(texture == null || !texture.HasLongName) return false;
return string.Compare(imagename, texture.ShortName, StringComparison.OrdinalIgnoreCase) != 0;
}
// This must determine and return the image to show // This must determine and return the image to show
protected abstract Image FindImage(string imagename); protected abstract Image FindImage(string imagename);
//mxd. This gets ImageData by name...
protected abstract ImageData GetImageData(string imagename);
// This must show the image browser and return the selected texture name // This must show the image browser and return the selected texture name
protected abstract string BrowseImage(string imagename); protected abstract string BrowseImage(string imagename);
@ -228,7 +256,7 @@ namespace CodeImp.DoomBuilder.Controls
// Update icon and tooltip // Update icon and tooltip
togglefullname.Visible = true; togglefullname.Visible = true;
if(image.ShortName == name.Text) if(string.Compare(image.ShortName, name.Text, StringComparison.OrdinalIgnoreCase) == 0)
{ {
togglefullname.Image = Properties.Resources.Expand; togglefullname.Image = Properties.Resources.Expand;
tooltip.SetToolTip(togglefullname, "Switch to full name"); tooltip.SetToolTip(togglefullname, "Switch to full name");

View file

@ -0,0 +1,645 @@
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Linq;
using System.Windows.Forms;
#endregion
namespace CodeImp.DoomBuilder.Controls
{
//mxd. Based on (but heavily reworked since) TextureListPanel from Sledge (https://github.com/LogicAndTrick/sledge)
internal class ImageSelectorPanel : Panel
{
#region ================== Constants
internal const string DEFAULT_GROUP = "[DEFAULT_GROUP]";
#endregion
#region ================== Variables
private VScrollBar scrollbar;
private List<ImageBrowserItem> items;
private List<ImageBrowserItem> selection;
private List<Rectangle> rectangles;
private ImageBrowserItem lastselecteditem;
private int imagesize = 128;
private string title;
private int titleheight = SystemFonts.MessageBoxFont.Height + 6;
//mxd. Tooltips
private ToolTip tooltip;
private Point lasttooltippos;
private const int tooltipreshowdistance = 48;
//mxd. Textures cache
private static Dictionary<int, Dictionary<long, Image>> texturecache = new Dictionary<int, Dictionary<long, Image>>(); // <imagesize, < texture longname, preview image>>
// Selection
private bool allowselection;
private bool allowmultipleselection;
#endregion
#region ================== Event handlers
public delegate void ItemSelectedEventHandler(object sender, ImageBrowserItem item);
public delegate void SelectionChangedEventHandler(object sender, List<ImageBrowserItem> selection);
/*public event ItemSelectedEventHandler ItemSelected;
private void OnItemSelected(ImageBrowserItem item)
{
if(ItemSelected != null) ItemSelected(this, item);
}*/
public event SelectionChangedEventHandler SelectionChanged;
private void OnSelectionChanged(List<ImageBrowserItem> selection)
{
if(SelectionChanged != null) SelectionChanged(this, selection);
}
public event ItemSelectedEventHandler ItemDoubleClicked;
private void OnItemDoubleClicked(ImageBrowserItem item)
{
if(ItemDoubleClicked != null) ItemDoubleClicked(this, item);
}
#endregion
#region ================== Properties
public bool HideSelection
{
get { return !allowselection; }
set
{
allowselection = !value;
if(!allowselection && selection.Count > 0)
{
selection.Clear();
Refresh();
}
}
}
public bool MultiSelect
{
get { return allowmultipleselection; }
set
{
allowmultipleselection = value;
if(!allowmultipleselection && selection.Count > 0)
{
var first = selection[0];
selection.Clear();
selection.Add(first);
Refresh();
}
}
}
public int ImageSize
{
get { return imagesize; }
set
{
imagesize = value;
UpdateRectangles();
if(selection.Count > 0) ScrollToItem(selection[0]);
}
}
public List<ImageBrowserItem> Items { get { return items; } }
public List<ImageBrowserItem> SelectedItems { get { return selection; } }
public string Title { get { return title; } set { title = value; } }
#endregion
#region ================== Constructor / Disposer
public ImageSelectorPanel()
{
VScroll = true;
AutoScroll = true;
DoubleBuffered = true;
scrollbar = new VScrollBar { Dock = DockStyle.Right };
scrollbar.ValueChanged += (sender, e) => Refresh();
tooltip = new ToolTip(); //mxd
items = new List<ImageBrowserItem>();
selection = new List<ImageBrowserItem>();
imagesize = 128;
rectangles = new List<Rectangle>();
title = "Default group";
Controls.Add(scrollbar);
}
protected override void Dispose(bool disposing)
{
if(disposing) Clear();
base.Dispose(disposing);
}
#endregion
#region ================== Add/Remove/Get Textures
//mxd
public void Clear()
{
selection.Clear();
items.Clear();
lastselecteditem = null;
rectangles.Clear();
OnSelectionChanged(selection);
Refresh();
}
//mxd
public void ClearSelection()
{
selection.Clear();
lastselecteditem = null;
OnSelectionChanged(selection);
Refresh();
}
public void SetItems(IEnumerable<ImageBrowserItem> items)
{
this.items.Clear();
lastselecteditem = null;
selection.Clear();
this.items.AddRange(items);
OnSelectionChanged(selection);
UpdateRectangles();
}
public void SetSelectedItem(ImageBrowserItem item)
{
SetSelectedItems(new List<ImageBrowserItem> { item } );
}
public void SetSelectedItems(List<ImageBrowserItem> items)
{
selection.Clear();
if(items.Count > 0)
{
selection.AddRange(items);
ScrollToItem(items[0]); //mxd
Refresh(); //mxd
}
OnSelectionChanged(selection);
}
public void ScrollToItem(ImageBrowserItem item)
{
int index = items.IndexOf(item);
if(index < 0) return;
Rectangle rec = rectangles[index];
//mxd. Already visible?
int ymin = scrollbar.Value - titleheight;
int ymax = ymin + this.ClientRectangle.Height + titleheight;
if(rec.Top - 3 >= ymin && rec.Bottom + 3 <= ymax) return;
int yscroll = Math.Max(0, Math.Min(rec.Top - titleheight - 3, scrollbar.Maximum - ClientRectangle.Height));
scrollbar.Value = yscroll;
Refresh();
}
public void SelectNextItem(SearchDirectionHint dir)
{
if(!allowselection) return;
if(selection.Count == 0)
{
if(items.Count > 0) SetSelectedItem(items[0]);
return;
}
int targetindex = items.IndexOf(selection[0]);
Rectangle rect = rectangles[targetindex];
int index, newindex, tx, cx, cy;
switch(dir)
{
case SearchDirectionHint.Right:
// Just select the next item
if(targetindex < items.Count - 1) SetSelectedItem(items[targetindex + 1]);
break;
case SearchDirectionHint.Left:
// Just select the previous item
if(targetindex > 0) SetSelectedItem(items[targetindex - 1]);
break;
case SearchDirectionHint.Up:
// Skip current row...
index = targetindex - 1;
if(index < 0) break;
while(index > 0)
{
if(rectangles[index].Y != rect.Y) break;
index--;
}
// Check upper row for best match
tx = rect.X + rect.Width / 2;
cx = int.MaxValue;
cy = rectangles[index].Y;
newindex = int.MaxValue;
while(index > 0 && rectangles[index].Y == cy)
{
int ccx = Math.Abs(rectangles[index].X + rectangles[index].Width / 2 - tx);
if(ccx < cx)
{
cx = ccx;
newindex = index;
}
index--;
}
// Select item
if(newindex != int.MaxValue) SetSelectedItem(items[newindex]);
break;
case SearchDirectionHint.Down:
// Skip current row...
index = targetindex + 1;
if(index > rectangles.Count - 1) break;
while(index < rectangles.Count - 1)
{
if(rectangles[index].Y != rect.Y) break;
index++;
}
// Check upper row for best match
tx = rect.X + rect.Width / 2;
cx = int.MaxValue;
cy = rectangles[index].Y;
newindex = int.MaxValue;
while(index < rectangles.Count - 1 && rectangles[index].Y == cy)
{
int ccx = Math.Abs(rectangles[index].X + rectangles[index].Width / 2 - tx);
if(ccx < cx)
{
cx = ccx;
newindex = index;
}
index++;
}
// Select item
if(newindex != int.MaxValue) SetSelectedItem(items[newindex]);
break;
}
}
protected override void OnMouseDoubleClick(MouseEventArgs e)
{
base.OnMouseDoubleClick(e);
if(General.Interface.CtrlState || General.Interface.ShiftState || selection.Count != 1)
return;
int index = GetIndexAt(e.X, scrollbar.Value + e.Y);
if(index == -1) return;
OnItemDoubleClicked(items[index]);
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
this.Focus();
if(!allowselection) return;
if(!allowmultipleselection || !General.Interface.CtrlState)
selection.Clear();
int x = e.X;
int y = scrollbar.Value + e.Y;
int clickedIndex = GetIndexAt(x, y);
var item = (clickedIndex >= 0 && clickedIndex < items.Count ? items[clickedIndex] : null);
if(item == null)
{
selection.Clear();
}
else if(allowmultipleselection && General.Interface.CtrlState && selection.Contains(item))
{
selection.Remove(item);
lastselecteditem = null;
}
else if(allowmultipleselection && General.Interface.ShiftState && lastselecteditem != null)
{
int bef = items.IndexOf(lastselecteditem);
var start = Math.Min(bef, clickedIndex);
var count = Math.Abs(clickedIndex - bef) + 1;
selection.AddRange(items.GetRange(start, count).Where(i => !selection.Contains(i)));
}
else
{
selection.Add(item);
lastselecteditem = item;
}
OnSelectionChanged(selection);
Refresh();
}
protected override void OnMouseEnter(EventArgs e)
{
Focus();
base.OnMouseEnter(e);
}
//mxd
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
int index = GetIndexAt(e.X, scrollbar.Value + e.Y);
if(index == -1 || items[index].ItemType != ImageBrowserItemType.IMAGE || string.IsNullOrEmpty(items[index].ToolTip))
{
if(tooltip.Active) tooltip.Hide(this);
}
else if(!tooltip.Active || tooltip.GetToolTip(this) != items[index].ToolTip
|| Math.Abs(lasttooltippos.X - e.Location.X) > tooltipreshowdistance
|| Math.Abs(lasttooltippos.Y - e.Location.Y) > tooltipreshowdistance)
{
Point pos = new Point(e.Location.X, e.Location.Y + Cursor.Size.Height + 4);
tooltip.Show(items[index].ToolTip, this, pos, 999999);
lasttooltippos = e.Location;
}
}
public int GetIndexAt(int x, int y)
{
const int pad = 3;
int font = 4 + SystemFonts.MessageBoxFont.Height;
for(var i = 0; i < rectangles.Count; i++)
{
var rec = rectangles[i];
if(rec.Left - pad <= x
&& rec.Right + pad >= x
&& rec.Top - pad <= y
&& rec.Bottom + pad + font >= y)
{
return i;
}
}
return -1;
}
#endregion
#region ================== Scrolling
private void ScrollByAmount(int value)
{
int newvalue = Math.Max(0, scrollbar.Value + value);
scrollbar.Value = Math.Min(newvalue, Math.Max(0, scrollbar.Maximum - ClientRectangle.Height));
}
protected override void OnMouseWheel(MouseEventArgs e)
{
base.OnMouseWheel(e);
ScrollByAmount(scrollbar.SmallChange * (e.Delta / -120));
}
//mxd. Otherwise arrow keys won't be handled by OnKeyDown
protected override bool IsInputKey(Keys keyData)
{
switch(keyData)
{
case Keys.Right: case Keys.Left:
case Keys.Up: case Keys.Down:
case Keys.Return: return true;
}
return base.IsInputKey(keyData);
}
protected override void OnKeyDown(KeyEventArgs e)
{
ProcessKeyDown(e);
base.OnKeyDown(e);
}
internal bool ProcessKeyDown(KeyEventArgs e)
{
switch(e.KeyCode)
{
//mxd. Cursor keys
case Keys.Left: SelectNextItem(SearchDirectionHint.Left); return true;
case Keys.Right: SelectNextItem(SearchDirectionHint.Right); return true;
case Keys.Up: SelectNextItem(SearchDirectionHint.Up); return true;
case Keys.Down: SelectNextItem(SearchDirectionHint.Down); return true;
case Keys.PageDown: ScrollByAmount(scrollbar.LargeChange); return true;
case Keys.PageUp: ScrollByAmount(-scrollbar.LargeChange); return true;
case Keys.End: ScrollByAmount(int.MaxValue); return true;
case Keys.Home: ScrollByAmount(-int.MaxValue); return true;
case Keys.Enter:
if(selection.Count > 0)
{
OnItemDoubleClicked(selection[0]);
return true;
}
break;
}
return false;
}
/*protected override void OnMouseEnter(EventArgs e)
{
Focus();
base.OnMouseEnter(e);
}*/
#endregion
#region ================== Updating Rectangles & Dimensions
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
UpdateRectangles();
//mxd
if(selection.Count > 0) ScrollToItem(selection[0]);
}
private void UpdateRectangles()
{
int w = ClientRectangle.Width - scrollbar.Width;
const int pad = 3;
int font = 4 + SystemFonts.MessageBoxFont.Height;
int cx = 0;
int cy = titleheight;
int my = 0;
rectangles.Clear();
foreach(var ti in items)
{
Image preview = GetPreview(ti, imagesize);
int rw = w - cx;
int wid = (imagesize > 0 ? imagesize : preview.Width) + pad + pad;
int hei = (imagesize > 0 ? imagesize : preview.Height) + pad + pad + font;
if(rw < wid)
{
// New row
cx = 0;
cy += my;
my = 0;
}
my = Math.Max(my, hei);
var rect = new Rectangle(cx + pad, cy + pad, wid - pad - pad, hei - pad - pad - font);
rectangles.Add(rect);
cx += wid;
}
if(rectangles.Count > 0)
{
scrollbar.Maximum = cy + my;
scrollbar.SmallChange = (imagesize > 0 ? imagesize : 128) + pad + pad + font;
scrollbar.LargeChange = ClientRectangle.Height;
scrollbar.Visible = (scrollbar.Maximum > ClientRectangle.Height);
if(scrollbar.Value > scrollbar.Maximum - ClientRectangle.Height)
{
scrollbar.Value = Math.Max(0, scrollbar.Maximum - ClientRectangle.Height);
}
}
else
{
scrollbar.Visible = false;
}
Refresh();
}
#endregion
#region ================== Rendering
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
DrawTextures(e.Graphics);
}
private void DrawTextures(Graphics g)
{
// Draw items
if(items.Count > 0)
{
int y = scrollbar.Value;
int height = ClientRectangle.Height - titleheight;
for(var i = 0; i < items.Count; i++)
{
Rectangle rec = rectangles[i];
if(rec.Bottom < y) continue;
if(rec.Top > y + height) break;
Image bmp = GetPreview(items[i], imagesize);
items[i].Draw(g, bmp, rec.X, rec.Y - y, rec.Width, rec.Height, selection.Contains(items[i]));
}
}
// Draw title on top of items
if(title != DEFAULT_GROUP)
{
// Draw group name bg
bool blackbrowsers = (General.Settings != null && General.Settings.BlackBrowsers);
Color bgcolor = (blackbrowsers ? Color.Gray : SystemColors.Control);
using(Brush bg = new SolidBrush(Color.FromArgb(192, bgcolor)))
{
int scrollwidth = (scrollbar.Visible ? scrollbar.Width : 0);
g.FillRectangle(bg, 2, 2, ClientRectangle.Width - scrollwidth - 4, SystemFonts.MessageBoxFont.Height);
}
// Draw group name
Brush fgbrush = (blackbrowsers ? Brushes.White : SystemBrushes.ControlText);
g.DrawString(title, SystemFonts.MessageBoxFont, fgbrush, 2, 2);
}
}
#endregion
#region ================== Image Caching
private static Image GetPreview(ImageBrowserItem item, int imagesize)
{
if(!item.IsPreviewLoaded) return item.Icon.GetPreview();
if(!texturecache.ContainsKey(imagesize)) texturecache.Add(imagesize, new Dictionary<long, Image>());
// Generate preview?
if(!texturecache[imagesize].ContainsKey(item.Icon.LongName))
{
Image img = item.Icon.GetPreview();
// Determine preview size
float scalex, scaley;
if(item.ItemType == ImageBrowserItemType.IMAGE)
{
scalex = (imagesize == 0 ? 1.0f : (imagesize / (float)img.Width));
scaley = (imagesize == 0 ? 1.0f :(imagesize / (float)img.Height));
}
else
{
// Don't upscale folder icons
scalex = (imagesize == 0 ? 1.0f : ((img.Width > imagesize) ? (imagesize / (float)img.Width) : 1.0f));
scaley = (imagesize == 0 ? 1.0f : ((img.Height > imagesize) ? (imagesize / (float)img.Height) : 1.0f));
}
float scale = Math.Min(scalex, scaley);
int previewwidth = (int)(img.Width * scale);
int previewheight = (int)(img.Height * scale);
if(previewwidth < 1) previewwidth = 1;
if(previewheight < 1) previewheight = 1;
// Make new image
Bitmap preview = new Bitmap(previewwidth, previewheight, PixelFormat.Format32bppArgb);
using(Graphics g = Graphics.FromImage(preview))
{
g.PageUnit = GraphicsUnit.Pixel;
g.InterpolationMode = InterpolationMode.NearestNeighbor;
g.PixelOffsetMode = PixelOffsetMode.None;
g.DrawImage(img, new Rectangle(0, 0, previewwidth, previewheight));
}
texturecache[imagesize][item.Icon.LongName] = preview;
}
// Get preview
return texturecache[imagesize][item.Icon.LongName];
}
#endregion
}
}

View file

@ -591,7 +591,7 @@ namespace CodeImp.DoomBuilder.Controls
private static void UpdateTexturePanel(Panel panel, string texturename, Label texturenamelabel, Label sizelabel, int maxlabelright, Panel image, int sizeref, bool extendedinfoshown, bool required) private static void UpdateTexturePanel(Panel panel, string texturename, Label texturenamelabel, Label sizelabel, int maxlabelright, Panel image, int sizeref, bool extendedinfoshown, bool required)
{ {
// Set texture name // Set texture name
texturenamelabel.Text = texturename; texturenamelabel.Text = (texturename.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH ? texturename : texturename.ToUpperInvariant());
// And image // And image
DisplayTextureImage(image, sizelabel, texturename, required); DisplayTextureImage(image, sizelabel, texturename, required);

View file

@ -20,6 +20,7 @@ using System;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Rendering;
@ -67,8 +68,8 @@ namespace CodeImp.DoomBuilder.Controls
floor.Text = s.FloorHeight.ToString(); floor.Text = s.FloorHeight.ToString();
height.Text = sheight.ToString(); height.Text = sheight.ToString();
brightness.Text = s.Brightness.ToString(); brightness.Text = s.Brightness.ToString();
floorname.Text = s.FloorTexture; floorname.Text = (s.FloorTexture.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH ? s.FloorTexture : s.FloorTexture.ToUpperInvariant());
ceilingname.Text = s.CeilTexture; ceilingname.Text = (s.CeilTexture.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH ? s.CeilTexture : s.CeilTexture.ToUpperInvariant());
//mxd. Set tags //mxd. Set tags
if(s.Tags.Count > 1) if(s.Tags.Count > 1)

View file

@ -75,15 +75,19 @@ namespace CodeImp.DoomBuilder.Controls
if(string.IsNullOrEmpty(texture.FilePathName) || texture is UnknownImage) DisplayImageSize(0, 0); //mxd if(string.IsNullOrEmpty(texture.FilePathName) || texture is UnknownImage) DisplayImageSize(0, 0); //mxd
else DisplayImageSize(texture.ScaledWidth, texture.ScaledHeight); //mxd else DisplayImageSize(texture.ScaledWidth, texture.ScaledHeight); //mxd
if(usepreviews && !texture.IsPreviewLoaded) timer.Start(); //mxd if(!texture.IsPreviewLoaded) timer.Start(); //mxd
else if(!texture.IsImageLoaded) texture.LoadImage(); //mxd. In some cases the image may never me loaded by the DataManager
// Set the image // Set the image
// mxd. GetPreview() returns a copy of preview, GetBitmap() returns actual bitmap return texture.GetPreview();
return (usepreviews ? texture.GetPreview() : new Bitmap(texture.GetBitmap()));
} }
} }
//mxd. This gets ImageData by name...
protected override ImageData GetImageData(string imagename)
{
return General.Map.Data.GetTextureImage(imagename);
}
// This browses for a texture // This browses for a texture
protected override string BrowseImage(string imagename) protected override string BrowseImage(string imagename)
{ {

View file

@ -0,0 +1,28 @@
using System;
using System.Windows.Forms;
namespace CodeImp.DoomBuilder.Controls
{
//mxd. Label, which ignores mouse events
internal class TransparentLabel : Label
{
private const int WM_NCHITTEST = 0x0084;
private const int WM_MOUSEHOVER = 0x02A1;
private const int HTTRANSPARENT = -1;
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case WM_NCHITTEST:
case WM_MOUSEHOVER:
m.Result = (IntPtr)HTTRANSPARENT;
break;
default:
base.WndProc(ref m);
break;
}
}
}
}

View file

@ -120,6 +120,10 @@ namespace CodeImp.DoomBuilder.Data
private ImageData blacktexture; //mxd private ImageData blacktexture; //mxd
private ImageData thingtexture; //mxd private ImageData thingtexture; //mxd
//mxd. Texture Browser images
private ImageData foldertexture;
private ImageData folderuptexture;
//mxd. Sky textures //mxd. Sky textures
private CubeTexture skybox; // GZDoom skybox private CubeTexture skybox; // GZDoom skybox
@ -180,6 +184,8 @@ namespace CodeImp.DoomBuilder.Data
public ImageData WhiteTexture { get { return whitetexture; } } public ImageData WhiteTexture { get { return whitetexture; } }
public ImageData BlackTexture { get { return blacktexture; } } //mxd public ImageData BlackTexture { get { return blacktexture; } } //mxd
public ImageData ThingTexture { get { return thingtexture; } } //mxd public ImageData ThingTexture { get { return thingtexture; } } //mxd
internal ImageData FolderTexture { get { return foldertexture; } } //mxd
internal ImageData FolderUpTexture { get { return folderuptexture; } } //mxd
public ImageData[] CommentTextures { get { return commenttextures; } } //mxd public ImageData[] CommentTextures { get { return commenttextures; } } //mxd
internal CubeTexture SkyBox { get { return skybox; } } //mxd internal CubeTexture SkyBox { get { return skybox; } } //mxd
public List<ThingCategory> ThingCategories { get { return thingcategories; } } public List<ThingCategory> ThingCategories { get { return thingcategories; } }
@ -218,14 +224,20 @@ namespace CodeImp.DoomBuilder.Data
blacktexture.CreateTexture(); //mxd blacktexture.CreateTexture(); //mxd
unknownimage = new UnknownImage(Properties.Resources.UnknownImage); //mxd. There should be only one! unknownimage = new UnknownImage(Properties.Resources.UnknownImage); //mxd. There should be only one!
//mxd. Textures browser images
foldertexture = new ResourceImage("CodeImp.DoomBuilder.Resources.Folder96.png") { UseColorCorrection = false };
foldertexture.LoadImage();
folderuptexture = new ResourceImage("CodeImp.DoomBuilder.Resources.Folder96Up.png") { UseColorCorrection = false };
folderuptexture.LoadImage();
//mxd. Create comment icons //mxd. Create comment icons
commenttextures = new ImageData[] commenttextures = new ImageData[]
{ {
new ResourceImage("CodeImp.DoomBuilder.Resources.CommentRegular.png"), new ResourceImage("CodeImp.DoomBuilder.Resources.CommentRegular.png") { UseColorCorrection = false },
new ResourceImage("CodeImp.DoomBuilder.Resources.CommentInfo.png"), new ResourceImage("CodeImp.DoomBuilder.Resources.CommentInfo.png") { UseColorCorrection = false },
new ResourceImage("CodeImp.DoomBuilder.Resources.CommentQuestion.png"), new ResourceImage("CodeImp.DoomBuilder.Resources.CommentQuestion.png") { UseColorCorrection = false },
new ResourceImage("CodeImp.DoomBuilder.Resources.CommentProblem.png"), new ResourceImage("CodeImp.DoomBuilder.Resources.CommentProblem.png") { UseColorCorrection = false },
new ResourceImage("CodeImp.DoomBuilder.Resources.CommentSmile.png"), new ResourceImage("CodeImp.DoomBuilder.Resources.CommentSmile.png") { UseColorCorrection = false },
}; };
//mxd. Load comment icons //mxd. Load comment icons
@ -262,6 +274,10 @@ namespace CodeImp.DoomBuilder.Data
thingtexture = null; //mxd thingtexture = null; //mxd
unknownimage.Dispose(); //mxd unknownimage.Dispose(); //mxd
unknownimage = null; //mxd unknownimage = null; //mxd
foldertexture.Dispose(); //mxd
foldertexture = null; //mxd
folderuptexture.Dispose(); //mxd
folderuptexture = null; //mxd
for(int i = 0; i < commenttextures.Length; i++) //mxd for(int i = 0; i < commenttextures.Length; i++) //mxd
{ {
commenttextures[i].Dispose(); commenttextures[i].Dispose();

View file

@ -129,17 +129,6 @@ namespace CodeImp.DoomBuilder.Data
this.longname = Lump.MakeLongName(this.name, uselongtexturenames); this.longname = Lump.MakeLongName(this.name, uselongtexturenames);
this.filepathname = filepathname; this.filepathname = filepathname;
this.level = virtualname.Split(new[] { Path.AltDirectorySeparatorChar }).Length - 1;
if(General.Settings.CapitalizeTextureNames && !string.IsNullOrEmpty(this.displayname))
{
this.displayname = this.displayname.ToUpperInvariant();
}
if(this.displayname.Length > ImageBrowserItem.MAX_NAME_LENGTH)
{
this.displayname = this.displayname.Substring(0, ImageBrowserItem.MAX_NAME_LENGTH);
}
} }
// This loads the image // This loads the image

View file

@ -58,7 +58,6 @@ namespace CodeImp.DoomBuilder.Data
protected bool ismasked; //mxd. If true, has pixels with zero alpha protected bool ismasked; //mxd. If true, has pixels with zero alpha
protected bool hasLongName; //mxd. Texture name is longer than DataManager.CLASIC_IMAGE_NAME_LENGTH protected bool hasLongName; //mxd. Texture name is longer than DataManager.CLASIC_IMAGE_NAME_LENGTH
protected bool hasPatchWithSameName; //mxd protected bool hasPatchWithSameName; //mxd
protected int level; //mxd. Folder depth of this item
//mxd. Hashing //mxd. Hashing
private static int hashcounter; private static int hashcounter;
@ -121,7 +120,6 @@ namespace CodeImp.DoomBuilder.Data
public virtual float ScaledHeight { get { return (float)Math.Round(height * scale.y); } } public virtual float ScaledHeight { get { return (float)Math.Round(height * scale.y); } }
public virtual Vector2D Scale { get { return scale; } } public virtual Vector2D Scale { get { return scale; } }
public bool WorldPanning { get { return worldpanning; } } public bool WorldPanning { get { return worldpanning; } }
public int Level { get { return level; } } //mxd
#endregion #endregion
@ -534,15 +532,15 @@ namespace CodeImp.DoomBuilder.Data
else if(loadfailed) else if(loadfailed)
{ {
// Draw error bitmap // Draw error bitmap
targetpos = new Point(targetpos.X + ((General.Map.Data.Previews.MaxImageWidth - Properties.Resources.Hourglass.Width) >> 1), targetpos = new Point(targetpos.X + ((PreviewManager.MAX_PREVIEW_SIZE - Properties.Resources.Hourglass.Width) >> 1),
targetpos.Y + ((General.Map.Data.Previews.MaxImageHeight - Properties.Resources.Hourglass.Height) >> 1)); targetpos.Y + ((PreviewManager.MAX_PREVIEW_SIZE - Properties.Resources.Hourglass.Height) >> 1));
target.DrawImageUnscaled(Properties.Resources.Failed, targetpos); target.DrawImageUnscaled(Properties.Resources.Failed, targetpos);
} }
else else
{ {
// Draw loading bitmap // Draw loading bitmap
targetpos = new Point(targetpos.X + ((General.Map.Data.Previews.MaxImageWidth - Properties.Resources.Hourglass.Width) >> 1), targetpos = new Point(targetpos.X + ((PreviewManager.MAX_PREVIEW_SIZE - Properties.Resources.Hourglass.Width) >> 1),
targetpos.Y + ((General.Map.Data.Previews.MaxImageHeight - Properties.Resources.Hourglass.Height) >> 1)); targetpos.Y + ((PreviewManager.MAX_PREVIEW_SIZE - Properties.Resources.Hourglass.Height) >> 1));
target.DrawImageUnscaled(Properties.Resources.Hourglass, targetpos); target.DrawImageUnscaled(Properties.Resources.Hourglass, targetpos);
} }
} }

View file

@ -93,17 +93,6 @@ namespace CodeImp.DoomBuilder.Data
this.longname = Lump.MakeLongName(this.name); this.longname = Lump.MakeLongName(this.name);
this.virtualname = filepathname.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); this.virtualname = filepathname.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
this.filepathname = filepathname; this.filepathname = filepathname;
this.level = virtualname.Split(new[] { Path.AltDirectorySeparatorChar }).Length - 1;
if(General.Settings.CapitalizeTextureNames && !string.IsNullOrEmpty(this.displayname))
{
this.displayname = this.displayname.ToUpperInvariant();
}
if(this.displayname.Length > ImageBrowserItem.MAX_NAME_LENGTH)
{
this.displayname = this.displayname.Substring(0, ImageBrowserItem.MAX_NAME_LENGTH);
}
} }
// This loads the image // This loads the image

View file

@ -34,16 +34,12 @@ namespace CodeImp.DoomBuilder.Data
private const PixelFormat IMAGE_FORMAT = PixelFormat.Format32bppArgb; private const PixelFormat IMAGE_FORMAT = PixelFormat.Format32bppArgb;
// Dimensions of a single preview image // Dimensions of a single preview image
public static readonly int[] PREVIEW_SIZES = new[] { 48, 64, 80, 96, 112, 128 }; public const int MAX_PREVIEW_SIZE = 256; //mxd
#endregion #endregion
#region ================== Variables #region ================== Variables
// Dimensions of a single preview image
private readonly int maxpreviewwidth;
private readonly int maxpreviewheight;
// Images // Images
private List<Bitmap> images; private List<Bitmap> images;
@ -58,10 +54,6 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Properties #region ================== Properties
// Constants
public int MaxImageWidth { get { return maxpreviewwidth; } }
public int MaxImageHeight { get { return maxpreviewheight; } }
// Disposing // Disposing
internal bool IsDisposed { get { return isdisposed; } } internal bool IsDisposed { get { return isdisposed; } }
@ -84,8 +76,6 @@ namespace CodeImp.DoomBuilder.Data
// Initialize // Initialize
images = new List<Bitmap>(); images = new List<Bitmap>();
imageque = new Queue<ImageData>(); imageque = new Queue<ImageData>();
maxpreviewwidth = PREVIEW_SIZES[General.Settings.PreviewImageSize];
maxpreviewheight = PREVIEW_SIZES[General.Settings.PreviewImageSize];
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
@ -131,8 +121,8 @@ namespace CodeImp.DoomBuilder.Data
} }
// Determine preview size // Determine preview size
float scalex = (img.Width > maxpreviewwidth) ? (maxpreviewwidth / (float)imagewidth) : 1.0f; float scalex = (img.Width > MAX_PREVIEW_SIZE) ? (MAX_PREVIEW_SIZE / (float)imagewidth) : 1.0f;
float scaley = (img.Height > maxpreviewheight) ? (maxpreviewheight / (float)imageheight) : 1.0f; float scaley = (img.Height > MAX_PREVIEW_SIZE) ? (MAX_PREVIEW_SIZE / (float)imageheight) : 1.0f;
float scale = Math.Min(scalex, scaley); float scale = Math.Min(scalex, scaley);
int previewwidth = (int)(imagewidth * scale); int previewwidth = (int)(imagewidth * scale);
int previewheight = (int)(imageheight * scale); int previewheight = (int)(imageheight * scale);
@ -193,8 +183,8 @@ namespace CodeImp.DoomBuilder.Data
lock(images) { image = images[previewindex]; } lock(images) { image = images[previewindex]; }
// Adjust offset for the size of the preview image // Adjust offset for the size of the preview image
targetpos.X += (maxpreviewwidth - image.Width) >> 1; targetpos.X += (MAX_PREVIEW_SIZE - image.Width) >> 1;
targetpos.Y += (maxpreviewheight - image.Height) >> 1; targetpos.Y += (MAX_PREVIEW_SIZE - image.Height) >> 1;
// Draw from atlas to target // Draw from atlas to target
lock(syncroot) lock(syncroot)

View file

@ -58,7 +58,6 @@ namespace CodeImp.DoomBuilder.Data
//mxd //mxd
SetName(name); SetName(name);
this.virtualname = (!string.IsNullOrEmpty(virtualpath) ? virtualpath : "[TEXTURES]") + Path.AltDirectorySeparatorChar + this.name; this.virtualname = (!string.IsNullOrEmpty(virtualpath) ? virtualpath : "[TEXTURES]") + Path.AltDirectorySeparatorChar + this.name;
this.level = virtualname.Split(new[] { Path.AltDirectorySeparatorChar }).Length - 1;
this.isFlat = isflat; this.isFlat = isflat;
// We have no destructor // We have no destructor
@ -81,16 +80,6 @@ namespace CodeImp.DoomBuilder.Data
base.SetName(name); base.SetName(name);
if(General.Settings.CapitalizeTextureNames && !string.IsNullOrEmpty(this.displayname))
{
this.displayname = this.displayname.ToUpperInvariant();
}
if(this.displayname.Length > ImageBrowserItem.MAX_NAME_LENGTH)
{
this.displayname = this.displayname.Substring(0, ImageBrowserItem.MAX_NAME_LENGTH);
}
this.shortname = this.displayname.ToUpperInvariant(); this.shortname = this.displayname.ToUpperInvariant();
if(this.shortname.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH) if(this.shortname.Length > DataManager.CLASIC_IMAGE_NAME_LENGTH)
{ {

View file

@ -354,6 +354,20 @@ namespace CodeImp.DoomBuilder.Properties {
} }
} }
internal static System.Drawing.Bitmap Folder96 {
get {
object obj = ResourceManager.GetObject("Folder96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Folder96Up {
get {
object obj = ResourceManager.GetObject("Folder96Up", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap FolderExplore { internal static System.Drawing.Bitmap FolderExplore {
get { get {
object obj = ResourceManager.GetObject("FolderExplore", resourceCulture); object obj = ResourceManager.GetObject("FolderExplore", resourceCulture);

View file

@ -607,4 +607,10 @@
<data name="WarningLargeText" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="WarningLargeText" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WarningLargeText.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\WarningLargeText.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Folder96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Folder96.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Folder96Up" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Folder96Up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -407,7 +407,6 @@ namespace CodeImp.DoomBuilder.Windows
this.frontlow.Size = new System.Drawing.Size(83, 107); this.frontlow.Size = new System.Drawing.Size(83, 107);
this.frontlow.TabIndex = 6; this.frontlow.TabIndex = 6;
this.frontlow.TextureName = ""; this.frontlow.TextureName = "";
this.frontlow.UsePreviews = true;
this.frontlow.OnValueChanged += new System.EventHandler(this.frontlow_OnValueChanged); this.frontlow.OnValueChanged += new System.EventHandler(this.frontlow_OnValueChanged);
// //
// frontmid // frontmid
@ -419,7 +418,6 @@ namespace CodeImp.DoomBuilder.Windows
this.frontmid.Size = new System.Drawing.Size(83, 107); this.frontmid.Size = new System.Drawing.Size(83, 107);
this.frontmid.TabIndex = 5; this.frontmid.TabIndex = 5;
this.frontmid.TextureName = ""; this.frontmid.TextureName = "";
this.frontmid.UsePreviews = true;
this.frontmid.OnValueChanged += new System.EventHandler(this.frontmid_OnValueChanged); this.frontmid.OnValueChanged += new System.EventHandler(this.frontmid_OnValueChanged);
// //
// fronthigh // fronthigh
@ -431,7 +429,6 @@ namespace CodeImp.DoomBuilder.Windows
this.fronthigh.Size = new System.Drawing.Size(83, 107); this.fronthigh.Size = new System.Drawing.Size(83, 107);
this.fronthigh.TabIndex = 4; this.fronthigh.TabIndex = 4;
this.fronthigh.TextureName = ""; this.fronthigh.TextureName = "";
this.fronthigh.UsePreviews = true;
this.fronthigh.OnValueChanged += new System.EventHandler(this.fronthigh_OnValueChanged); this.fronthigh.OnValueChanged += new System.EventHandler(this.fronthigh_OnValueChanged);
// //
// frontTextureOffset // frontTextureOffset
@ -506,7 +503,6 @@ namespace CodeImp.DoomBuilder.Windows
this.backlow.Size = new System.Drawing.Size(83, 107); this.backlow.Size = new System.Drawing.Size(83, 107);
this.backlow.TabIndex = 6; this.backlow.TabIndex = 6;
this.backlow.TextureName = ""; this.backlow.TextureName = "";
this.backlow.UsePreviews = true;
this.backlow.OnValueChanged += new System.EventHandler(this.backlow_OnValueChanged); this.backlow.OnValueChanged += new System.EventHandler(this.backlow_OnValueChanged);
// //
// backmid // backmid
@ -518,7 +514,6 @@ namespace CodeImp.DoomBuilder.Windows
this.backmid.Size = new System.Drawing.Size(83, 107); this.backmid.Size = new System.Drawing.Size(83, 107);
this.backmid.TabIndex = 5; this.backmid.TabIndex = 5;
this.backmid.TextureName = ""; this.backmid.TextureName = "";
this.backmid.UsePreviews = true;
this.backmid.OnValueChanged += new System.EventHandler(this.backmid_OnValueChanged); this.backmid.OnValueChanged += new System.EventHandler(this.backmid_OnValueChanged);
// //
// backhigh // backhigh
@ -530,7 +525,6 @@ namespace CodeImp.DoomBuilder.Windows
this.backhigh.Size = new System.Drawing.Size(83, 107); this.backhigh.Size = new System.Drawing.Size(83, 107);
this.backhigh.TabIndex = 4; this.backhigh.TabIndex = 4;
this.backhigh.TextureName = ""; this.backhigh.TextureName = "";
this.backhigh.UsePreviews = true;
this.backhigh.OnValueChanged += new System.EventHandler(this.backhigh_OnValueChanged); this.backhigh.OnValueChanged += new System.EventHandler(this.backhigh_OnValueChanged);
// //
// backTextureOffset // backTextureOffset

View file

@ -857,7 +857,6 @@ namespace CodeImp.DoomBuilder.Windows
this.frontlow.Size = new System.Drawing.Size(220, 189); this.frontlow.Size = new System.Drawing.Size(220, 189);
this.frontlow.TabIndex = 6; this.frontlow.TabIndex = 6;
this.frontlow.TextureName = ""; this.frontlow.TextureName = "";
this.frontlow.UsePreviews = false;
this.frontlow.OnValueChanged += new System.EventHandler(this.frontlow_OnValueChanged); this.frontlow.OnValueChanged += new System.EventHandler(this.frontlow_OnValueChanged);
// //
// frontmid // frontmid
@ -869,7 +868,6 @@ namespace CodeImp.DoomBuilder.Windows
this.frontmid.Size = new System.Drawing.Size(220, 189); this.frontmid.Size = new System.Drawing.Size(220, 189);
this.frontmid.TabIndex = 5; this.frontmid.TabIndex = 5;
this.frontmid.TextureName = ""; this.frontmid.TextureName = "";
this.frontmid.UsePreviews = false;
this.frontmid.OnValueChanged += new System.EventHandler(this.frontmid_OnValueChanged); this.frontmid.OnValueChanged += new System.EventHandler(this.frontmid_OnValueChanged);
// //
// fronthigh // fronthigh
@ -881,7 +879,6 @@ namespace CodeImp.DoomBuilder.Windows
this.fronthigh.Size = new System.Drawing.Size(220, 189); this.fronthigh.Size = new System.Drawing.Size(220, 189);
this.fronthigh.TabIndex = 4; this.fronthigh.TabIndex = 4;
this.fronthigh.TextureName = ""; this.fronthigh.TextureName = "";
this.fronthigh.UsePreviews = false;
this.fronthigh.OnValueChanged += new System.EventHandler(this.fronthigh_OnValueChanged); this.fronthigh.OnValueChanged += new System.EventHandler(this.fronthigh_OnValueChanged);
// //
// tabback // tabback
@ -1285,7 +1282,6 @@ namespace CodeImp.DoomBuilder.Windows
this.backlow.Size = new System.Drawing.Size(220, 189); this.backlow.Size = new System.Drawing.Size(220, 189);
this.backlow.TabIndex = 6; this.backlow.TabIndex = 6;
this.backlow.TextureName = ""; this.backlow.TextureName = "";
this.backlow.UsePreviews = false;
this.backlow.OnValueChanged += new System.EventHandler(this.backlow_OnValueChanged); this.backlow.OnValueChanged += new System.EventHandler(this.backlow_OnValueChanged);
// //
// backmid // backmid
@ -1297,7 +1293,6 @@ namespace CodeImp.DoomBuilder.Windows
this.backmid.Size = new System.Drawing.Size(220, 189); this.backmid.Size = new System.Drawing.Size(220, 189);
this.backmid.TabIndex = 5; this.backmid.TabIndex = 5;
this.backmid.TextureName = ""; this.backmid.TextureName = "";
this.backmid.UsePreviews = false;
this.backmid.OnValueChanged += new System.EventHandler(this.backmid_OnValueChanged); this.backmid.OnValueChanged += new System.EventHandler(this.backmid_OnValueChanged);
// //
// backhigh // backhigh
@ -1309,7 +1304,6 @@ namespace CodeImp.DoomBuilder.Windows
this.backhigh.Size = new System.Drawing.Size(220, 189); this.backhigh.Size = new System.Drawing.Size(220, 189);
this.backhigh.TabIndex = 4; this.backhigh.TabIndex = 4;
this.backhigh.TextureName = ""; this.backhigh.TextureName = "";
this.backhigh.UsePreviews = false;
this.backhigh.OnValueChanged += new System.EventHandler(this.backhigh_OnValueChanged); this.backhigh.OnValueChanged += new System.EventHandler(this.backhigh_OnValueChanged);
// //
// tabcomment // tabcomment

View file

@ -38,9 +38,7 @@ namespace CodeImp.DoomBuilder.Windows
System.Windows.Forms.Label label27; System.Windows.Forms.Label label27;
System.Windows.Forms.Label label29; System.Windows.Forms.Label label29;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PreferencesForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PreferencesForm));
this.capitalizetexturenames = new System.Windows.Forms.CheckBox();
this.blackbrowsers = new System.Windows.Forms.CheckBox(); this.blackbrowsers = new System.Windows.Forms.CheckBox();
this.keepfilterfocused = new System.Windows.Forms.CheckBox();
this.checkforupdates = new System.Windows.Forms.CheckBox(); this.checkforupdates = new System.Windows.Forms.CheckBox();
this.cbStoreEditTab = new System.Windows.Forms.CheckBox(); this.cbStoreEditTab = new System.Windows.Forms.CheckBox();
this.locatetexturegroup = new System.Windows.Forms.CheckBox(); this.locatetexturegroup = new System.Windows.Forms.CheckBox();
@ -59,13 +57,11 @@ namespace CodeImp.DoomBuilder.Windows
this.autoscrollspeed = new System.Windows.Forms.TrackBar(); this.autoscrollspeed = new System.Windows.Forms.TrackBar();
this.autoscrollspeedlabel = new System.Windows.Forms.Label(); this.autoscrollspeedlabel = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label();
this.previewsize = new System.Windows.Forms.TrackBar();
this.previewsizelabel = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label();
this.defaultviewmode = new System.Windows.Forms.ComboBox(); this.defaultviewmode = new System.Windows.Forms.ComboBox();
this.keyusedlabel = new System.Windows.Forms.Label(); this.keyusedlabel = new System.Windows.Forms.Label();
this.colorsgroup1 = new System.Windows.Forms.GroupBox(); this.colorsgroup1 = new System.Windows.Forms.GroupBox();
this.colorguidelines = new CodeImp.DoomBuilder.Controls.ColorControl();
this.color3dFloors = new CodeImp.DoomBuilder.Controls.ColorControl(); this.color3dFloors = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorInfo = new CodeImp.DoomBuilder.Controls.ColorControl(); this.colorInfo = new CodeImp.DoomBuilder.Controls.ColorControl();
this.colorMD3 = new CodeImp.DoomBuilder.Controls.ColorControl(); this.colorMD3 = new CodeImp.DoomBuilder.Controls.ColorControl();
@ -213,7 +209,6 @@ namespace CodeImp.DoomBuilder.Windows
this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl(); this.pasteoptions = new CodeImp.DoomBuilder.Controls.PasteOptionsControl();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.browseScreenshotsFolderDialog = new System.Windows.Forms.FolderBrowserDialog(); this.browseScreenshotsFolderDialog = new System.Windows.Forms.FolderBrowserDialog();
this.colorguidelines = new CodeImp.DoomBuilder.Controls.ColorControl();
label7 = new System.Windows.Forms.Label(); label7 = new System.Windows.Forms.Label();
label5 = new System.Windows.Forms.Label(); label5 = new System.Windows.Forms.Label();
groupBox1 = new System.Windows.Forms.GroupBox(); groupBox1 = new System.Windows.Forms.GroupBox();
@ -226,7 +221,6 @@ namespace CodeImp.DoomBuilder.Windows
((System.ComponentModel.ISupportInitialize)(this.vertexScale)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.vertexScale)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.zoomfactor)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.zoomfactor)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.autoscrollspeed)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.autoscrollspeed)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.previewsize)).BeginInit();
this.colorsgroup1.SuspendLayout(); this.colorsgroup1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.doublesidedalpha)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.doublesidedalpha)).BeginInit();
this.tabs.SuspendLayout(); this.tabs.SuspendLayout();
@ -281,9 +275,7 @@ namespace CodeImp.DoomBuilder.Windows
// //
// groupBox1 // groupBox1
// //
groupBox1.Controls.Add(this.capitalizetexturenames);
groupBox1.Controls.Add(this.blackbrowsers); groupBox1.Controls.Add(this.blackbrowsers);
groupBox1.Controls.Add(this.keepfilterfocused);
groupBox1.Controls.Add(this.checkforupdates); groupBox1.Controls.Add(this.checkforupdates);
groupBox1.Controls.Add(this.cbStoreEditTab); groupBox1.Controls.Add(this.cbStoreEditTab);
groupBox1.Controls.Add(this.locatetexturegroup); groupBox1.Controls.Add(this.locatetexturegroup);
@ -302,9 +294,6 @@ namespace CodeImp.DoomBuilder.Windows
groupBox1.Controls.Add(this.autoscrollspeed); groupBox1.Controls.Add(this.autoscrollspeed);
groupBox1.Controls.Add(this.autoscrollspeedlabel); groupBox1.Controls.Add(this.autoscrollspeedlabel);
groupBox1.Controls.Add(this.label15); groupBox1.Controls.Add(this.label15);
groupBox1.Controls.Add(this.previewsize);
groupBox1.Controls.Add(this.previewsizelabel);
groupBox1.Controls.Add(this.label12);
groupBox1.Controls.Add(this.label14); groupBox1.Controls.Add(this.label14);
groupBox1.Controls.Add(this.defaultviewmode); groupBox1.Controls.Add(this.defaultviewmode);
groupBox1.Location = new System.Drawing.Point(8, 8); groupBox1.Location = new System.Drawing.Point(8, 8);
@ -314,44 +303,20 @@ namespace CodeImp.DoomBuilder.Windows
groupBox1.TabStop = false; groupBox1.TabStop = false;
groupBox1.Text = " Options "; groupBox1.Text = " Options ";
// //
// capitalizetexturenames
//
this.capitalizetexturenames.AutoSize = true;
this.capitalizetexturenames.Location = new System.Drawing.Point(16, 350);
this.capitalizetexturenames.Name = "capitalizetexturenames";
this.capitalizetexturenames.Size = new System.Drawing.Size(140, 17);
this.capitalizetexturenames.TabIndex = 11;
this.capitalizetexturenames.Text = "Capitalize texture names";
this.toolTip1.SetToolTip(this.capitalizetexturenames, "When enabled, texture names will be shown \r\nand saved as all caps\r\n(Doom Builder " +
"2 behaviour)");
this.capitalizetexturenames.UseVisualStyleBackColor = true;
//
// blackbrowsers // blackbrowsers
// //
this.blackbrowsers.AutoSize = true; this.blackbrowsers.AutoSize = true;
this.blackbrowsers.Location = new System.Drawing.Point(16, 329); this.blackbrowsers.Location = new System.Drawing.Point(16, 277);
this.blackbrowsers.Name = "blackbrowsers"; this.blackbrowsers.Name = "blackbrowsers";
this.blackbrowsers.Size = new System.Drawing.Size(195, 17); this.blackbrowsers.Size = new System.Drawing.Size(195, 17);
this.blackbrowsers.TabIndex = 10; this.blackbrowsers.TabIndex = 10;
this.blackbrowsers.Text = "Black background in image browser"; this.blackbrowsers.Text = "Black background in image browser";
this.blackbrowsers.UseVisualStyleBackColor = true; this.blackbrowsers.UseVisualStyleBackColor = true;
// //
// keepfilterfocused
//
this.keepfilterfocused.AutoSize = true;
this.keepfilterfocused.Location = new System.Drawing.Point(16, 308);
this.keepfilterfocused.Name = "keepfilterfocused";
this.keepfilterfocused.Size = new System.Drawing.Size(280, 17);
this.keepfilterfocused.TabIndex = 9;
this.keepfilterfocused.Text = "Keep Filter input focused when image browser is open";
this.toolTip1.SetToolTip(this.keepfilterfocused, "When enabled, all key presses in \r\nimage browsers will be redirected \r\nto the Fil" +
"ter textbox.");
this.keepfilterfocused.UseVisualStyleBackColor = true;
//
// checkforupdates // checkforupdates
// //
this.checkforupdates.AutoSize = true; this.checkforupdates.AutoSize = true;
this.checkforupdates.Location = new System.Drawing.Point(16, 413); this.checkforupdates.Location = new System.Drawing.Point(16, 346);
this.checkforupdates.Name = "checkforupdates"; this.checkforupdates.Name = "checkforupdates";
this.checkforupdates.Size = new System.Drawing.Size(160, 17); this.checkforupdates.Size = new System.Drawing.Size(160, 17);
this.checkforupdates.TabIndex = 14; this.checkforupdates.TabIndex = 14;
@ -361,7 +326,7 @@ namespace CodeImp.DoomBuilder.Windows
// cbStoreEditTab // cbStoreEditTab
// //
this.cbStoreEditTab.AutoSize = true; this.cbStoreEditTab.AutoSize = true;
this.cbStoreEditTab.Location = new System.Drawing.Point(16, 392); this.cbStoreEditTab.Location = new System.Drawing.Point(16, 323);
this.cbStoreEditTab.Name = "cbStoreEditTab"; this.cbStoreEditTab.Name = "cbStoreEditTab";
this.cbStoreEditTab.Size = new System.Drawing.Size(203, 17); this.cbStoreEditTab.Size = new System.Drawing.Size(203, 17);
this.cbStoreEditTab.TabIndex = 13; this.cbStoreEditTab.TabIndex = 13;
@ -371,7 +336,7 @@ namespace CodeImp.DoomBuilder.Windows
// locatetexturegroup // locatetexturegroup
// //
this.locatetexturegroup.AutoSize = true; this.locatetexturegroup.AutoSize = true;
this.locatetexturegroup.Location = new System.Drawing.Point(16, 287); this.locatetexturegroup.Location = new System.Drawing.Point(16, 254);
this.locatetexturegroup.Name = "locatetexturegroup"; this.locatetexturegroup.Name = "locatetexturegroup";
this.locatetexturegroup.Size = new System.Drawing.Size(267, 17); this.locatetexturegroup.Size = new System.Drawing.Size(267, 17);
this.locatetexturegroup.TabIndex = 8; this.locatetexturegroup.TabIndex = 8;
@ -384,7 +349,7 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.recentFiles.BackColor = System.Drawing.SystemColors.Window; this.recentFiles.BackColor = System.Drawing.SystemColors.Window;
this.recentFiles.LargeChange = 1; this.recentFiles.LargeChange = 1;
this.recentFiles.Location = new System.Drawing.Point(127, 193); this.recentFiles.Location = new System.Drawing.Point(127, 156);
this.recentFiles.Maximum = 25; this.recentFiles.Maximum = 25;
this.recentFiles.Minimum = 8; this.recentFiles.Minimum = 8;
this.recentFiles.Name = "recentFiles"; this.recentFiles.Name = "recentFiles";
@ -397,7 +362,7 @@ namespace CodeImp.DoomBuilder.Windows
// labelRecentFiles // labelRecentFiles
// //
this.labelRecentFiles.AutoSize = true; this.labelRecentFiles.AutoSize = true;
this.labelRecentFiles.Location = new System.Drawing.Point(249, 205); this.labelRecentFiles.Location = new System.Drawing.Point(249, 168);
this.labelRecentFiles.Name = "labelRecentFiles"; this.labelRecentFiles.Name = "labelRecentFiles";
this.labelRecentFiles.Size = new System.Drawing.Size(13, 13); this.labelRecentFiles.Size = new System.Drawing.Size(13, 13);
this.labelRecentFiles.TabIndex = 48; this.labelRecentFiles.TabIndex = 48;
@ -406,7 +371,7 @@ namespace CodeImp.DoomBuilder.Windows
// label25 // label25
// //
this.label25.AutoSize = true; this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(31, 206); this.label25.Location = new System.Drawing.Point(31, 169);
this.label25.Name = "label25"; this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(87, 13); this.label25.Size = new System.Drawing.Size(87, 13);
this.label25.TabIndex = 47; this.label25.TabIndex = 47;
@ -416,7 +381,7 @@ namespace CodeImp.DoomBuilder.Windows
// vertexScaleLabel // vertexScaleLabel
// //
this.vertexScaleLabel.AutoSize = true; this.vertexScaleLabel.AutoSize = true;
this.vertexScaleLabel.Location = new System.Drawing.Point(249, 168); this.vertexScaleLabel.Location = new System.Drawing.Point(249, 131);
this.vertexScaleLabel.Name = "vertexScaleLabel"; this.vertexScaleLabel.Name = "vertexScaleLabel";
this.vertexScaleLabel.Size = new System.Drawing.Size(74, 13); this.vertexScaleLabel.Size = new System.Drawing.Size(74, 13);
this.vertexScaleLabel.TabIndex = 45; this.vertexScaleLabel.TabIndex = 45;
@ -425,7 +390,7 @@ namespace CodeImp.DoomBuilder.Windows
// label22 // label22
// //
this.label22.AutoSize = true; this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(26, 168); this.label22.Location = new System.Drawing.Point(26, 131);
this.label22.Name = "label22"; this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(91, 13); this.label22.Size = new System.Drawing.Size(91, 13);
this.label22.TabIndex = 44; this.label22.TabIndex = 44;
@ -436,7 +401,7 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.vertexScale.BackColor = System.Drawing.SystemColors.Window; this.vertexScale.BackColor = System.Drawing.SystemColors.Window;
this.vertexScale.LargeChange = 1; this.vertexScale.LargeChange = 1;
this.vertexScale.Location = new System.Drawing.Point(127, 156); this.vertexScale.Location = new System.Drawing.Point(127, 119);
this.vertexScale.Minimum = 1; this.vertexScale.Minimum = 1;
this.vertexScale.Name = "vertexScale"; this.vertexScale.Name = "vertexScale";
this.vertexScale.Size = new System.Drawing.Size(116, 45); this.vertexScale.Size = new System.Drawing.Size(116, 45);
@ -448,7 +413,7 @@ namespace CodeImp.DoomBuilder.Windows
// cbSynchCameras // cbSynchCameras
// //
this.cbSynchCameras.AutoSize = true; this.cbSynchCameras.AutoSize = true;
this.cbSynchCameras.Location = new System.Drawing.Point(16, 371); this.cbSynchCameras.Location = new System.Drawing.Point(16, 300);
this.cbSynchCameras.Name = "cbSynchCameras"; this.cbSynchCameras.Name = "cbSynchCameras";
this.cbSynchCameras.Size = new System.Drawing.Size(294, 17); this.cbSynchCameras.Size = new System.Drawing.Size(294, 17);
this.cbSynchCameras.TabIndex = 12; this.cbSynchCameras.TabIndex = 12;
@ -458,7 +423,7 @@ namespace CodeImp.DoomBuilder.Windows
// showtexturesizes // showtexturesizes
// //
this.showtexturesizes.AutoSize = true; this.showtexturesizes.AutoSize = true;
this.showtexturesizes.Location = new System.Drawing.Point(16, 266); this.showtexturesizes.Location = new System.Drawing.Point(16, 231);
this.showtexturesizes.Name = "showtexturesizes"; this.showtexturesizes.Name = "showtexturesizes";
this.showtexturesizes.Size = new System.Drawing.Size(208, 17); this.showtexturesizes.Size = new System.Drawing.Size(208, 17);
this.showtexturesizes.TabIndex = 7; this.showtexturesizes.TabIndex = 7;
@ -468,7 +433,7 @@ namespace CodeImp.DoomBuilder.Windows
// scriptontop // scriptontop
// //
this.scriptontop.AutoSize = true; this.scriptontop.AutoSize = true;
this.scriptontop.Location = new System.Drawing.Point(16, 245); this.scriptontop.Location = new System.Drawing.Point(16, 208);
this.scriptontop.Name = "scriptontop"; this.scriptontop.Name = "scriptontop";
this.scriptontop.Size = new System.Drawing.Size(227, 17); this.scriptontop.Size = new System.Drawing.Size(227, 17);
this.scriptontop.TabIndex = 6; this.scriptontop.TabIndex = 6;
@ -479,7 +444,7 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.zoomfactor.BackColor = System.Drawing.SystemColors.Window; this.zoomfactor.BackColor = System.Drawing.SystemColors.Window;
this.zoomfactor.LargeChange = 1; this.zoomfactor.LargeChange = 1;
this.zoomfactor.Location = new System.Drawing.Point(127, 119); this.zoomfactor.Location = new System.Drawing.Point(127, 82);
this.zoomfactor.Minimum = 1; this.zoomfactor.Minimum = 1;
this.zoomfactor.Name = "zoomfactor"; this.zoomfactor.Name = "zoomfactor";
this.zoomfactor.Size = new System.Drawing.Size(116, 45); this.zoomfactor.Size = new System.Drawing.Size(116, 45);
@ -491,7 +456,7 @@ namespace CodeImp.DoomBuilder.Windows
// zoomfactorlabel // zoomfactorlabel
// //
this.zoomfactorlabel.AutoSize = true; this.zoomfactorlabel.AutoSize = true;
this.zoomfactorlabel.Location = new System.Drawing.Point(249, 131); this.zoomfactorlabel.Location = new System.Drawing.Point(249, 94);
this.zoomfactorlabel.Name = "zoomfactorlabel"; this.zoomfactorlabel.Name = "zoomfactorlabel";
this.zoomfactorlabel.Size = new System.Drawing.Size(27, 13); this.zoomfactorlabel.Size = new System.Drawing.Size(27, 13);
this.zoomfactorlabel.TabIndex = 39; this.zoomfactorlabel.TabIndex = 39;
@ -500,7 +465,7 @@ namespace CodeImp.DoomBuilder.Windows
// label19 // label19
// //
this.label19.AutoSize = true; this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(52, 131); this.label19.Location = new System.Drawing.Point(52, 94);
this.label19.Name = "label19"; this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(67, 13); this.label19.Size = new System.Drawing.Size(67, 13);
this.label19.TabIndex = 38; this.label19.TabIndex = 38;
@ -510,7 +475,7 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.autoscrollspeed.BackColor = System.Drawing.SystemColors.Window; this.autoscrollspeed.BackColor = System.Drawing.SystemColors.Window;
this.autoscrollspeed.LargeChange = 1; this.autoscrollspeed.LargeChange = 1;
this.autoscrollspeed.Location = new System.Drawing.Point(127, 82); this.autoscrollspeed.Location = new System.Drawing.Point(127, 45);
this.autoscrollspeed.Maximum = 5; this.autoscrollspeed.Maximum = 5;
this.autoscrollspeed.Name = "autoscrollspeed"; this.autoscrollspeed.Name = "autoscrollspeed";
this.autoscrollspeed.Size = new System.Drawing.Size(116, 45); this.autoscrollspeed.Size = new System.Drawing.Size(116, 45);
@ -521,7 +486,7 @@ namespace CodeImp.DoomBuilder.Windows
// autoscrollspeedlabel // autoscrollspeedlabel
// //
this.autoscrollspeedlabel.AutoSize = true; this.autoscrollspeedlabel.AutoSize = true;
this.autoscrollspeedlabel.Location = new System.Drawing.Point(249, 94); this.autoscrollspeedlabel.Location = new System.Drawing.Point(249, 57);
this.autoscrollspeedlabel.Name = "autoscrollspeedlabel"; this.autoscrollspeedlabel.Name = "autoscrollspeedlabel";
this.autoscrollspeedlabel.Size = new System.Drawing.Size(21, 13); this.autoscrollspeedlabel.Size = new System.Drawing.Size(21, 13);
this.autoscrollspeedlabel.TabIndex = 36; this.autoscrollspeedlabel.TabIndex = 36;
@ -530,43 +495,12 @@ namespace CodeImp.DoomBuilder.Windows
// label15 // label15
// //
this.label15.AutoSize = true; this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(26, 94); this.label15.Location = new System.Drawing.Point(26, 57);
this.label15.Name = "label15"; this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(91, 13); this.label15.Size = new System.Drawing.Size(91, 13);
this.label15.TabIndex = 35; this.label15.TabIndex = 35;
this.label15.Text = "Auto-scroll speed:"; this.label15.Text = "Auto-scroll speed:";
// //
// previewsize
//
this.previewsize.BackColor = System.Drawing.SystemColors.Window;
this.previewsize.LargeChange = 1;
this.previewsize.Location = new System.Drawing.Point(127, 45);
this.previewsize.Maximum = 5;
this.previewsize.Name = "previewsize";
this.previewsize.Size = new System.Drawing.Size(116, 45);
this.previewsize.TabIndex = 1;
this.previewsize.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
this.previewsize.Value = 5;
this.previewsize.ValueChanged += new System.EventHandler(this.previewsize_ValueChanged);
//
// previewsizelabel
//
this.previewsizelabel.AutoSize = true;
this.previewsizelabel.Location = new System.Drawing.Point(249, 57);
this.previewsizelabel.Name = "previewsizelabel";
this.previewsizelabel.Size = new System.Drawing.Size(54, 13);
this.previewsizelabel.TabIndex = 33;
this.previewsizelabel.Text = "128 x 128";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(17, 57);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(100, 13);
this.label12.TabIndex = 32;
this.label12.Text = "Preview image size:";
//
// label14 // label14
// //
this.label14.AutoSize = true; this.label14.AutoSize = true;
@ -666,6 +600,17 @@ namespace CodeImp.DoomBuilder.Windows
this.colorsgroup1.Text = " Colors "; this.colorsgroup1.Text = " Colors ";
this.colorsgroup1.Visible = false; this.colorsgroup1.Visible = false;
// //
// colorguidelines
//
this.colorguidelines.BackColor = System.Drawing.Color.Transparent;
this.colorguidelines.Label = "Guidelines:";
this.colorguidelines.Location = new System.Drawing.Point(15, 307);
this.colorguidelines.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorguidelines.MinimumSize = new System.Drawing.Size(100, 23);
this.colorguidelines.Name = "colorguidelines";
this.colorguidelines.Size = new System.Drawing.Size(168, 23);
this.colorguidelines.TabIndex = 11;
//
// color3dFloors // color3dFloors
// //
this.color3dFloors.BackColor = System.Drawing.Color.Transparent; this.color3dFloors.BackColor = System.Drawing.Color.Transparent;
@ -1978,6 +1923,7 @@ namespace CodeImp.DoomBuilder.Windows
// scripttabwidth // scripttabwidth
// //
this.scripttabwidth.AllowDecimal = false; this.scripttabwidth.AllowDecimal = false;
this.scripttabwidth.AllowExpressions = false;
this.scripttabwidth.AllowNegative = false; this.scripttabwidth.AllowNegative = false;
this.scripttabwidth.AllowRelative = false; this.scripttabwidth.AllowRelative = false;
this.scripttabwidth.ButtonStep = 2; this.scripttabwidth.ButtonStep = 2;
@ -2405,17 +2351,6 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.browseScreenshotsFolderDialog.Description = "Select a Folder to Save Screenshots Into"; this.browseScreenshotsFolderDialog.Description = "Select a Folder to Save Screenshots Into";
// //
// colorguidelines
//
this.colorguidelines.BackColor = System.Drawing.Color.Transparent;
this.colorguidelines.Label = "Guidelines:";
this.colorguidelines.Location = new System.Drawing.Point(15, 307);
this.colorguidelines.MaximumSize = new System.Drawing.Size(10000, 23);
this.colorguidelines.MinimumSize = new System.Drawing.Size(100, 23);
this.colorguidelines.Name = "colorguidelines";
this.colorguidelines.Size = new System.Drawing.Size(168, 23);
this.colorguidelines.TabIndex = 11;
//
// PreferencesForm // PreferencesForm
// //
this.AcceptButton = this.apply; this.AcceptButton = this.apply;
@ -2443,7 +2378,6 @@ namespace CodeImp.DoomBuilder.Windows
((System.ComponentModel.ISupportInitialize)(this.vertexScale)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.vertexScale)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.zoomfactor)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.zoomfactor)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.autoscrollspeed)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.autoscrollspeed)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.previewsize)).EndInit();
this.colorsgroup1.ResumeLayout(false); this.colorsgroup1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.doublesidedalpha)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.doublesidedalpha)).EndInit();
this.tabs.ResumeLayout(false); this.tabs.ResumeLayout(false);
@ -2544,9 +2478,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.CheckBox qualitydisplay; private System.Windows.Forms.CheckBox qualitydisplay;
private System.Windows.Forms.CheckBox visualbilinear; private System.Windows.Forms.CheckBox visualbilinear;
private System.Windows.Forms.CheckBox classicbilinear; private System.Windows.Forms.CheckBox classicbilinear;
private System.Windows.Forms.TrackBar previewsize;
private System.Windows.Forms.Label previewsizelabel;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TrackBar autoscrollspeed; private System.Windows.Forms.TrackBar autoscrollspeed;
private System.Windows.Forms.Label autoscrollspeedlabel; private System.Windows.Forms.Label autoscrollspeedlabel;
private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label15;
@ -2647,7 +2578,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ComboBox scriptcolorpresets; private System.Windows.Forms.ComboBox scriptcolorpresets;
private System.Windows.Forms.Label label23; private System.Windows.Forms.Label label23;
private CodeImp.DoomBuilder.Controls.ColorControl colorproperties; private CodeImp.DoomBuilder.Controls.ColorControl colorproperties;
private System.Windows.Forms.CheckBox keepfilterfocused;
private System.Windows.Forms.Label labelantialiasing; private System.Windows.Forms.Label labelantialiasing;
private System.Windows.Forms.TrackBar antialiasing; private System.Windows.Forms.TrackBar antialiasing;
private System.Windows.Forms.Label labelanisotropicfiltering; private System.Windows.Forms.Label labelanisotropicfiltering;
@ -2661,7 +2591,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label activethingsalphalabel; private System.Windows.Forms.Label activethingsalphalabel;
private System.Windows.Forms.Label label31; private System.Windows.Forms.Label label31;
private System.Windows.Forms.TrackBar activethingsalpha; private System.Windows.Forms.TrackBar activethingsalpha;
private System.Windows.Forms.CheckBox capitalizetexturenames;
private System.Windows.Forms.CheckBox blackbrowsers; private System.Windows.Forms.CheckBox blackbrowsers;
private System.Windows.Forms.GroupBox groupBox11; private System.Windows.Forms.GroupBox groupBox11;
private System.Windows.Forms.Label label28; private System.Windows.Forms.Label label28;

View file

@ -73,7 +73,6 @@ namespace CodeImp.DoomBuilder.Windows
vertexScale3D.Value = General.Clamp((int)(General.Settings.GZVertexScale3D * 10), vertexScale3D.Minimum, vertexScale3D.Maximum); //mxd vertexScale3D.Value = General.Clamp((int)(General.Settings.GZVertexScale3D * 10), vertexScale3D.Minimum, vertexScale3D.Maximum); //mxd
viewdistance.Value = General.Clamp((int)(General.Settings.ViewDistance / 200.0f), viewdistance.Minimum, viewdistance.Maximum); viewdistance.Value = General.Clamp((int)(General.Settings.ViewDistance / 200.0f), viewdistance.Minimum, viewdistance.Maximum);
invertyaxis.Checked = General.Settings.InvertYAxis; invertyaxis.Checked = General.Settings.InvertYAxis;
previewsize.Value = General.Clamp(General.Settings.PreviewImageSize, previewsize.Minimum, previewsize.Maximum);
autoscrollspeed.Value = General.Clamp(General.Settings.AutoScrollSpeed, autoscrollspeed.Minimum, autoscrollspeed.Maximum); autoscrollspeed.Value = General.Clamp(General.Settings.AutoScrollSpeed, autoscrollspeed.Minimum, autoscrollspeed.Maximum);
zoomfactor.Value = General.Clamp(General.Settings.ZoomFactor, zoomfactor.Minimum, zoomfactor.Maximum); zoomfactor.Value = General.Clamp(General.Settings.ZoomFactor, zoomfactor.Minimum, zoomfactor.Maximum);
animatevisualselection.Checked = General.Settings.AnimateVisualSelection; animatevisualselection.Checked = General.Settings.AnimateVisualSelection;
@ -92,7 +91,6 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
locatetexturegroup.Checked = General.Settings.LocateTextureGroup; locatetexturegroup.Checked = General.Settings.LocateTextureGroup;
keepfilterfocused.Checked = General.Settings.KeepTextureFilterFocused;
cbStoreEditTab.Checked = General.Settings.StoreSelectedEditTab; cbStoreEditTab.Checked = General.Settings.StoreSelectedEditTab;
checkforupdates.Checked = General.Settings.CheckForUpdates; checkforupdates.Checked = General.Settings.CheckForUpdates;
toolbar_gzdoom.Checked = General.Settings.GZToolbarGZDoom; toolbar_gzdoom.Checked = General.Settings.GZToolbarGZDoom;
@ -253,7 +251,6 @@ namespace CodeImp.DoomBuilder.Windows
scriptcolorpresets.SelectedIndex = 0; scriptcolorpresets.SelectedIndex = 0;
blackbrowsers.Checked = General.Settings.BlackBrowsers; blackbrowsers.Checked = General.Settings.BlackBrowsers;
capitalizetexturenames.Checked = General.Settings.CapitalizeTextureNames; //mxd
classicbilinear.Checked = General.Settings.ClassicBilinear; classicbilinear.Checked = General.Settings.ClassicBilinear;
visualbilinear.Checked = General.Settings.VisualBilinear; visualbilinear.Checked = General.Settings.VisualBilinear;
qualitydisplay.Checked = General.Settings.QualityDisplay; qualitydisplay.Checked = General.Settings.QualityDisplay;
@ -291,7 +288,6 @@ namespace CodeImp.DoomBuilder.Windows
// Check if we need to reload the resources // Check if we need to reload the resources
reloadresources |= (General.Settings.ImageBrightness != imagebrightness.Value); reloadresources |= (General.Settings.ImageBrightness != imagebrightness.Value);
reloadresources |= (General.Settings.PreviewImageSize != previewsize.Value);
// Apply interface // Apply interface
General.Settings.ImageBrightness = imagebrightness.Value; General.Settings.ImageBrightness = imagebrightness.Value;
@ -306,7 +302,6 @@ namespace CodeImp.DoomBuilder.Windows
General.Settings.GZVertexScale3D = vertexScale3D.Value * 0.1f; //mxd General.Settings.GZVertexScale3D = vertexScale3D.Value * 0.1f; //mxd
General.Settings.ViewDistance = viewdistance.Value * 200.0f; General.Settings.ViewDistance = viewdistance.Value * 200.0f;
General.Settings.InvertYAxis = invertyaxis.Checked; General.Settings.InvertYAxis = invertyaxis.Checked;
General.Settings.PreviewImageSize = previewsize.Value;
General.Settings.AutoScrollSpeed = autoscrollspeed.Value; General.Settings.AutoScrollSpeed = autoscrollspeed.Value;
General.Settings.ZoomFactor = zoomfactor.Value; General.Settings.ZoomFactor = zoomfactor.Value;
General.Settings.AnimateVisualSelection = animatevisualselection.Checked; General.Settings.AnimateVisualSelection = animatevisualselection.Checked;
@ -326,7 +321,6 @@ namespace CodeImp.DoomBuilder.Windows
General.Settings.StoreSelectedEditTab = cbStoreEditTab.Checked; //mxd General.Settings.StoreSelectedEditTab = cbStoreEditTab.Checked; //mxd
General.Settings.CheckForUpdates = checkforupdates.Checked; //mxd General.Settings.CheckForUpdates = checkforupdates.Checked; //mxd
General.Settings.LocateTextureGroup = locatetexturegroup.Checked; //mxd General.Settings.LocateTextureGroup = locatetexturegroup.Checked; //mxd
General.Settings.KeepTextureFilterFocused = keepfilterfocused.Checked; //mxd
General.Settings.MaxRecentFiles = recentFiles.Value; //mxd General.Settings.MaxRecentFiles = recentFiles.Value; //mxd
General.Settings.ScreenshotsPath = screenshotsfolderpath.Text.Trim(); //mxd General.Settings.ScreenshotsPath = screenshotsfolderpath.Text.Trim(); //mxd
@ -400,7 +394,6 @@ namespace CodeImp.DoomBuilder.Windows
General.Colors.CreateAssistColors(); General.Colors.CreateAssistColors();
General.Settings.BlackBrowsers = blackbrowsers.Checked; General.Settings.BlackBrowsers = blackbrowsers.Checked;
General.Settings.CapitalizeTextureNames = capitalizetexturenames.Checked; //mxd
General.Settings.ClassicBilinear = classicbilinear.Checked; General.Settings.ClassicBilinear = classicbilinear.Checked;
General.Settings.VisualBilinear = visualbilinear.Checked; General.Settings.VisualBilinear = visualbilinear.Checked;
General.Settings.QualityDisplay = qualitydisplay.Checked; General.Settings.QualityDisplay = qualitydisplay.Checked;
@ -479,12 +472,6 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Interface Panel #region ================== Interface Panel
private void previewsize_ValueChanged(object sender, EventArgs e)
{
int size = PreviewManager.PREVIEW_SIZES[previewsize.Value];
previewsizelabel.Text = size + " x " + size;
}
private void fieldofview_ValueChanged(object sender, EventArgs e) private void fieldofview_ValueChanged(object sender, EventArgs e)
{ {
int value = fieldofview.Value * 10; int value = fieldofview.Value * 10;

View file

@ -345,6 +345,7 @@ namespace CodeImp.DoomBuilder.Windows
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.Text = "Find and Replace"; this.Text = "Find and Replace";
this.Shown += new System.EventHandler(this.ScriptFindReplaceForm_Shown);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptFindReplaceForm_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptFindReplaceForm_FormClosing);
this.tabs.ResumeLayout(false); this.tabs.ResumeLayout(false);
this.tabfind.ResumeLayout(false); this.tabfind.ResumeLayout(false);

View file

@ -363,6 +363,7 @@ namespace CodeImp.DoomBuilder.Windows
findbox.Items.AddRange(items); findbox.Items.AddRange(items);
} }
findbox.SelectAll(); findbox.SelectAll();
findbox.Focus();
findinbox.SelectedIndex = replaceinbox.SelectedIndex; findinbox.SelectedIndex = replaceinbox.SelectedIndex;
@ -380,6 +381,7 @@ namespace CodeImp.DoomBuilder.Windows
replacefindbox.Items.AddRange(items); replacefindbox.Items.AddRange(items);
} }
replacefindbox.SelectAll(); replacefindbox.SelectAll();
replacefindbox.Focus();
replaceinbox.SelectedIndex = findinbox.SelectedIndex; replaceinbox.SelectedIndex = findinbox.SelectedIndex;
@ -392,6 +394,14 @@ namespace CodeImp.DoomBuilder.Windows
} }
} }
//mxd. Focus text input
private void ScriptFindReplaceForm_Shown(object sender, EventArgs e)
{
if(tabs.SelectedTab == tabfind) findbox.Focus();
else if(tabs.SelectedTab == tabreplace) replacefindbox.Focus();
else throw new NotImplementedException("Unsupported tab type");
}
#endregion #endregion
} }
} }

View file

@ -53,8 +53,6 @@ namespace CodeImp.DoomBuilder.Windows
this.ceilingtex = new CodeImp.DoomBuilder.Controls.FlatSelectorControl(); this.ceilingtex = new CodeImp.DoomBuilder.Controls.FlatSelectorControl();
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.flatSelectorControl2 = new CodeImp.DoomBuilder.Controls.FlatSelectorControl();
this.flatSelectorControl1 = new CodeImp.DoomBuilder.Controls.FlatSelectorControl();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.tooltip = new System.Windows.Forms.ToolTip(this.components); this.tooltip = new System.Windows.Forms.ToolTip(this.components);
label1 = new System.Windows.Forms.Label(); label1 = new System.Windows.Forms.Label();
@ -311,7 +309,6 @@ namespace CodeImp.DoomBuilder.Windows
this.floortex.Size = new System.Drawing.Size(114, 138); this.floortex.Size = new System.Drawing.Size(114, 138);
this.floortex.TabIndex = 2; this.floortex.TabIndex = 2;
this.floortex.TextureName = ""; this.floortex.TextureName = "";
this.floortex.UsePreviews = true;
this.floortex.OnValueChanged += new System.EventHandler(this.floortex_OnValueChanged); this.floortex.OnValueChanged += new System.EventHandler(this.floortex_OnValueChanged);
// //
// floorheight // floorheight
@ -341,7 +338,6 @@ namespace CodeImp.DoomBuilder.Windows
this.ceilingtex.Size = new System.Drawing.Size(114, 138); this.ceilingtex.Size = new System.Drawing.Size(114, 138);
this.ceilingtex.TabIndex = 3; this.ceilingtex.TabIndex = 3;
this.ceilingtex.TextureName = ""; this.ceilingtex.TextureName = "";
this.ceilingtex.UsePreviews = true;
this.ceilingtex.OnValueChanged += new System.EventHandler(this.ceilingtex_OnValueChanged); this.ceilingtex.OnValueChanged += new System.EventHandler(this.ceilingtex_OnValueChanged);
// //
// cancel // cancel
@ -367,26 +363,6 @@ namespace CodeImp.DoomBuilder.Windows
this.apply.UseVisualStyleBackColor = true; this.apply.UseVisualStyleBackColor = true;
this.apply.Click += new System.EventHandler(this.apply_Click); this.apply.Click += new System.EventHandler(this.apply_Click);
// //
// flatSelectorControl2
//
this.flatSelectorControl2.Location = new System.Drawing.Point(271, 37);
this.flatSelectorControl2.MultipleTextures = false;
this.flatSelectorControl2.Name = "flatSelectorControl2";
this.flatSelectorControl2.Size = new System.Drawing.Size(83, 105);
this.flatSelectorControl2.TabIndex = 13;
this.flatSelectorControl2.TextureName = "";
this.flatSelectorControl2.UsePreviews = true;
//
// flatSelectorControl1
//
this.flatSelectorControl1.Location = new System.Drawing.Point(363, 37);
this.flatSelectorControl1.MultipleTextures = false;
this.flatSelectorControl1.Name = "flatSelectorControl1";
this.flatSelectorControl1.Size = new System.Drawing.Size(83, 105);
this.flatSelectorControl1.TabIndex = 12;
this.flatSelectorControl1.TextureName = "";
this.flatSelectorControl1.UsePreviews = true;
//
// panel1 // panel1
// //
this.panel1.BackColor = System.Drawing.SystemColors.Window; this.panel1.BackColor = System.Drawing.SystemColors.Window;
@ -439,8 +415,6 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Button apply; private System.Windows.Forms.Button apply;
private CodeImp.DoomBuilder.Controls.FlatSelectorControl floortex; private CodeImp.DoomBuilder.Controls.FlatSelectorControl floortex;
private CodeImp.DoomBuilder.Controls.FlatSelectorControl ceilingtex; private CodeImp.DoomBuilder.Controls.FlatSelectorControl ceilingtex;
private CodeImp.DoomBuilder.Controls.FlatSelectorControl flatSelectorControl2;
private CodeImp.DoomBuilder.Controls.FlatSelectorControl flatSelectorControl1;
private System.Windows.Forms.Label sectorheight; private System.Windows.Forms.Label sectorheight;
private CodeImp.DoomBuilder.Controls.ActionSelectorControl effect; private CodeImp.DoomBuilder.Controls.ActionSelectorControl effect;
private System.Windows.Forms.Button browseeffect; private System.Windows.Forms.Button browseeffect;

View file

@ -159,10 +159,4 @@
<metadata name="label4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="label4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="flatSelectorControl2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="flatSelectorControl1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>

View file

@ -988,7 +988,6 @@
this.floortex.Size = new System.Drawing.Size(190, 204); this.floortex.Size = new System.Drawing.Size(190, 204);
this.floortex.TabIndex = 11; this.floortex.TabIndex = 11;
this.floortex.TextureName = ""; this.floortex.TextureName = "";
this.floortex.UsePreviews = false;
this.floortex.OnValueChanged += new System.EventHandler(this.floortex_OnValueChanged); this.floortex.OnValueChanged += new System.EventHandler(this.floortex_OnValueChanged);
// //
// groupBox1 // groupBox1
@ -1270,7 +1269,6 @@
this.ceilingtex.Size = new System.Drawing.Size(190, 204); this.ceilingtex.Size = new System.Drawing.Size(190, 204);
this.ceilingtex.TabIndex = 11; this.ceilingtex.TabIndex = 11;
this.ceilingtex.TextureName = ""; this.ceilingtex.TextureName = "";
this.ceilingtex.UsePreviews = false;
this.ceilingtex.OnValueChanged += new System.EventHandler(this.ceilingtex_OnValueChanged); this.ceilingtex.OnValueChanged += new System.EventHandler(this.ceilingtex_OnValueChanged);
// //
// tabslopes // tabslopes

View file

@ -48,7 +48,7 @@ namespace CodeImp.DoomBuilder.Windows
// //
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(683, 411); this.cancel.Location = new System.Drawing.Point(682, 413);
this.cancel.Name = "cancel"; this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(98, 25); this.cancel.Size = new System.Drawing.Size(98, 25);
this.cancel.TabIndex = 3; this.cancel.TabIndex = 3;
@ -60,9 +60,10 @@ namespace CodeImp.DoomBuilder.Windows
// apply // apply
// //
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.apply.Location = new System.Drawing.Point(581, 411); this.apply.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.apply.Location = new System.Drawing.Point(682, 381);
this.apply.Name = "apply"; this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(98, 25); this.apply.Size = new System.Drawing.Size(98, 30);
this.apply.TabIndex = 2; this.apply.TabIndex = 2;
this.apply.TabStop = false; this.apply.TabStop = false;
this.apply.Text = "OK"; this.apply.Text = "OK";
@ -97,7 +98,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tvTextureSets.SelectedImageIndex = 0; this.tvTextureSets.SelectedImageIndex = 0;
this.tvTextureSets.SelectionBackColor = System.Drawing.SystemColors.Highlight; this.tvTextureSets.SelectionBackColor = System.Drawing.SystemColors.Highlight;
this.tvTextureSets.SelectionMode = CodeImp.DoomBuilder.Controls.TreeViewSelectionMode.SingleSelect; this.tvTextureSets.SelectionMode = CodeImp.DoomBuilder.Controls.TreeViewSelectionMode.SingleSelect;
this.tvTextureSets.Size = new System.Drawing.Size(198, 402); this.tvTextureSets.Size = new System.Drawing.Size(198, 374);
this.tvTextureSets.TabIndex = 4; this.tvTextureSets.TabIndex = 4;
this.tvTextureSets.TabStop = false; this.tvTextureSets.TabStop = false;
this.tvTextureSets.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tvTextureSets_KeyUp); this.tvTextureSets.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tvTextureSets_KeyUp);
@ -105,7 +106,6 @@ namespace CodeImp.DoomBuilder.Windows
// //
// browser // browser
// //
this.browser.BrowseFlats = false;
this.browser.Dock = System.Windows.Forms.DockStyle.Fill; this.browser.Dock = System.Windows.Forms.DockStyle.Fill;
this.browser.HideInputBox = false; this.browser.HideInputBox = false;
this.browser.Location = new System.Drawing.Point(0, 0); this.browser.Location = new System.Drawing.Point(0, 0);

View file

@ -17,7 +17,7 @@
#region ================== Namespaces #region ================== Namespaces
using System; using System;
using System.Drawing; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls; using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.IO; using CodeImp.DoomBuilder.IO;
@ -31,13 +31,19 @@ namespace CodeImp.DoomBuilder.Windows
{ {
internal partial class TextureBrowserForm : DelayedForm internal partial class TextureBrowserForm : DelayedForm
{ {
//mxd. Structs
private struct TreeNodeData
{
public IFilledTextureSet Set;
public string FolderName;
}
// Variables // Variables
private string selectedname; private string selectedname;
private readonly ListViewGroup usedgroup; private readonly string usedgroup;
private readonly ListViewGroup availgroup; private readonly string availgroup;
private TreeNode selectedset; //mxd private TreeNode selectedset; //mxd
private long selecttextureonfill; //mxd. Was string, which wasn't reliable whem dealing with long texture names private long selecttextureonfill; //mxd. Was string, which wasn't reliable whem dealing with long texture names
private readonly bool usedgroupcollapsed; //mxd
private readonly bool browseflats; //mxd private readonly bool browseflats; //mxd
// Properties // Properties
@ -63,11 +69,14 @@ namespace CodeImp.DoomBuilder.Windows
string imagetype = (browseflats ? "flats" : "textures"); string imagetype = (browseflats ? "flats" : "textures");
this.Text = "Browse " + imagetype; this.Text = "Browse " + imagetype;
// Make groups
usedgroup = "Used " + imagetype + ":";
availgroup = "Available " + imagetype + ":";
browser.AddGroup(availgroup);
browser.AddGroup(usedgroup);
// Setup texture browser // Setup texture browser
ImageBrowserControl.ShowTexturesFromSubDirectories = General.Settings.ReadSetting("windows." + configname + ".showtexturesfromsubdirs", true); browser.ApplySettings("windows." + configname, browseflats);
ImageBrowserControl.UseLongTextureNames = General.Map.Options.UseLongTextureNames;
browser.BrowseFlats = browseflats;
browser.ApplySettings();
// Update the used textures // Update the used textures
General.Map.Data.UpdateUsedTextures(); General.Map.Data.UpdateUsedTextures();
@ -77,14 +86,6 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Texture longname to select when list is filled //mxd. Texture longname to select when list is filled
selecttextureonfill = longname; selecttextureonfill = longname;
// Make groups
usedgroup = browser.AddGroup("Used " + imagetype + ":");
availgroup = browser.AddGroup("Available " + imagetype + ":");
//mxd. Make "Used" group collapsible
usedgroupcollapsed = General.Settings.ReadSetting("windows." + configname + ".usedgroupcollapsed", false);
browser.SetGroupCollapsed(usedgroup, usedgroupcollapsed);
//mxd. Fill texture sets list with normal texture sets //mxd. Fill texture sets list with normal texture sets
foreach(IFilledTextureSet ts in General.Map.Data.TextureSets) foreach(IFilledTextureSet ts in General.Map.Data.TextureSets)
{ {
@ -94,7 +95,7 @@ namespace CodeImp.DoomBuilder.Windows
item = tvTextureSets.Nodes.Add(ts.Name + " [" + count + "]"); item = tvTextureSets.Nodes.Add(ts.Name + " [" + count + "]");
item.Name = ts.Name; item.Name = ts.Name;
item.Tag = ts; item.Tag = new TreeNodeData { Set = ts, FolderName = ts.Name };
item.ImageIndex = 0; item.ImageIndex = 0;
} }
@ -105,9 +106,9 @@ namespace CodeImp.DoomBuilder.Windows
if((count == 0 && !General.Map.Config.MixTexturesFlats) || (ts.Flats.Count == 0 && ts.Textures.Count == 0)) if((count == 0 && !General.Map.Config.MixTexturesFlats) || (ts.Flats.Count == 0 && ts.Textures.Count == 0))
continue; continue;
item = tvTextureSets.Nodes.Add(ts.Name + " [" + count + "]"); item = tvTextureSets.Nodes.Add(ts.Name);
item.Name = ts.Name; item.Name = ts.Name;
item.Tag = ts; item.Tag = new TreeNodeData { Set = ts, FolderName = ts.Name };
item.ImageIndex = 2 + ts.Location.type; item.ImageIndex = 2 + ts.Location.type;
item.SelectedImageIndex = item.ImageIndex; item.SelectedImageIndex = item.ImageIndex;
@ -119,7 +120,7 @@ namespace CodeImp.DoomBuilder.Windows
count = (browseflats ? General.Map.Data.AllTextureSet.Flats.Count : General.Map.Data.AllTextureSet.Textures.Count); count = (browseflats ? General.Map.Data.AllTextureSet.Flats.Count : General.Map.Data.AllTextureSet.Textures.Count);
item = tvTextureSets.Nodes.Add(General.Map.Data.AllTextureSet.Name + " [" + count + "]"); item = tvTextureSets.Nodes.Add(General.Map.Data.AllTextureSet.Name + " [" + count + "]");
item.Name = General.Map.Data.AllTextureSet.Name; item.Name = General.Map.Data.AllTextureSet.Name;
item.Tag = General.Map.Data.AllTextureSet; item.Tag = new TreeNodeData { Set = General.Map.Data.AllTextureSet, FolderName = General.Map.Data.AllTextureSet.Name };
item.ImageIndex = 1; item.ImageIndex = 1;
item.SelectedImageIndex = item.ImageIndex; item.SelectedImageIndex = item.ImageIndex;
@ -142,7 +143,7 @@ namespace CodeImp.DoomBuilder.Windows
if(match != null) if(match != null)
{ {
IFilledTextureSet set = (match.Tag as IFilledTextureSet); IFilledTextureSet set = ((TreeNodeData)match.Tag).Set;
foreach(ImageData img in (browseflats ? set.Flats : set.Textures)) foreach(ImageData img in (browseflats ? set.Flats : set.Textures))
{ {
if(img.LongName == longname) if(img.LongName == longname)
@ -176,7 +177,7 @@ namespace CodeImp.DoomBuilder.Windows
selectedset.EnsureVisible(); selectedset.EnsureVisible();
} }
tvTextureSets.EndUpdate();//mxd tvTextureSets.EndUpdate(); //mxd
//mxd. Set splitter position and state (doesn't work when layout is suspended) //mxd. Set splitter position and state (doesn't work when layout is suspended)
if(General.Settings.ReadSetting("windows." + configname + ".splittercollapsed", false)) if(General.Settings.ReadSetting("windows." + configname + ".splittercollapsed", false))
@ -199,7 +200,13 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
private static int SortImageData(ImageData img1, ImageData img2) private static int SortImageData(ImageData img1, ImageData img2)
{ {
return String.Compare(img1.FilePathName, img2.FilePathName, StringComparison.Ordinal); return String.Compare(img1.Name, img2.Name, StringComparison.OrdinalIgnoreCase);
}
//mxd
private static int SortTreeNodes(TreeNode n1, TreeNode n2)
{
return String.Compare(n1.Text, n2.Text, StringComparison.OrdinalIgnoreCase);
} }
//mxd //mxd
@ -213,7 +220,7 @@ namespace CodeImp.DoomBuilder.Windows
} }
//then - in current node //then - in current node
IFilledTextureSet set = (node.Tag as IFilledTextureSet); IFilledTextureSet set = ((TreeNodeData)node.Tag).Set;
foreach(ImageData img in (browseflats ? set.Flats : set.Textures)) foreach(ImageData img in (browseflats ? set.Flats : set.Textures))
if(img.LongName == longname) return node; if(img.LongName == longname) return node;
@ -237,7 +244,8 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
private void CreateNodes(TreeNode root) private void CreateNodes(TreeNode root)
{ {
ResourceTextureSet set = root.Tag as ResourceTextureSet; TreeNodeData rootdata = (TreeNodeData)root.Tag;
ResourceTextureSet set = rootdata.Set as ResourceTextureSet;
if(set == null) if(set == null)
{ {
General.ErrorLogger.Add(ErrorType.Error, "Resource " + root.Name + " doesn't have TextureSet!"); General.ErrorLogger.Add(ErrorType.Error, "Resource " + root.Name + " doesn't have TextureSet!");
@ -260,14 +268,19 @@ namespace CodeImp.DoomBuilder.Windows
} }
Array.Sort(images, SortImageData); Array.Sort(images, SortImageData);
List<ImageData> rootimages = new List<ImageData>();
foreach(ImageData image in images) foreach(ImageData image in images)
{ {
string[] parts = image.VirtualName.Split(separator, StringSplitOptions.RemoveEmptyEntries); string[] parts = image.VirtualName.Split(separator, StringSplitOptions.RemoveEmptyEntries);
TreeNode curNode = root; TreeNode curNode = root;
if(parts.Length == 1) continue; if(parts.Length == 1)
int localindex = (parts[0] == "[TEXTURES]" ? 8 : imageIndex); {
rootimages.Add(image);
continue;
}
int localindex = ((parts[0] == "[TEXTURES]" || image is TEXTURESImage) ? 8 : imageIndex);
string category = set.Name; string category = set.Name;
for(int i = 0; i < parts.Length - 1; i++) for(int i = 0; i < parts.Length - 1; i++)
{ {
@ -281,77 +294,94 @@ namespace CodeImp.DoomBuilder.Windows
else //create a new one else //create a new one
{ {
TreeNode n = new TreeNode(parts[i]) { Name = category, ImageIndex = localindex, SelectedImageIndex = localindex }; TreeNode n = new TreeNode(parts[i]) { Name = category, ImageIndex = localindex, SelectedImageIndex = localindex };
curNode.Nodes.Add(n); curNode.Nodes.Add(n);
curNode = n; curNode = n;
curNode.Tag = new TreeNodeData { Set = new ResourceTextureSet(category, set.Location), FolderName = parts[i] };
ResourceTextureSet ts = new ResourceTextureSet(category, set.Location);
ts.Level = i + 1;
curNode.Tag = ts;
} }
//add to current and parent nodes // Add to current node
if(i == parts.Length - 2) if(i == parts.Length - 2)
{ {
TreeNode cn = curNode; ResourceTextureSet curTs = ((TreeNodeData)curNode.Tag).Set as ResourceTextureSet;
while(cn != root) if(image.IsFlat)
{ curTs.AddFlat(image);
ResourceTextureSet curTs = cn.Tag as ResourceTextureSet; else
if(image.IsFlat) curTs.AddTexture(image);
curTs.AddFlat(image);
else
curTs.AddTexture(image);
cn = cn.Parent;
}
} }
} }
} }
// Shift the tree up when only single child node was added
if(root.Nodes.Count == 1 && root.Nodes[0].Nodes.Count > 0) if(root.Nodes.Count == 1 && root.Nodes[0].Nodes.Count > 0)
{ {
TreeNode[] children = new TreeNode[root.Nodes[0].Nodes.Count]; TreeNode[] children = new TreeNode[root.Nodes[0].Nodes.Count];
root.Nodes[0].Nodes.CopyTo(children, 0); root.Nodes[0].Nodes.CopyTo(children, 0);
root.Nodes.Clear(); root.Nodes.Clear();
root.Nodes.AddRange(children); root.Nodes.AddRange(children);
((ResourceTextureSet)root.Tag).Level++;
} }
// Sort immediate child nodes...
TreeNode[] rootnodes = new TreeNode[root.Nodes.Count];
root.Nodes.CopyTo(rootnodes, 0);
Array.Sort(rootnodes, SortTreeNodes);
root.Nodes.Clear();
root.Nodes.AddRange(rootnodes);
// Re-add root images
ResourceTextureSet rootset = new ResourceTextureSet(set.Name, set.Location);
if(browseflats)
{
foreach(ImageData data in rootimages) rootset.AddFlat(data);
}
else
{
foreach(ImageData data in rootimages) rootset.AddTexture(data);
}
// Store root data
rootdata.Set = rootset;
root.Tag = rootdata;
// Set root images count
if(rootimages.Count > 0) root.Text += " [" + rootimages.Count + "]";
// Add image count to node titles
foreach(TreeNode n in root.Nodes) SetItemsCount(n); foreach(TreeNode n in root.Nodes) SetItemsCount(n);
} }
//mxd //mxd
private void SetItemsCount(TreeNode node) private void SetItemsCount(TreeNode node)
{ {
ResourceTextureSet ts = node.Tag as ResourceTextureSet; ResourceTextureSet ts = ((TreeNodeData)node.Tag).Set as ResourceTextureSet;
if(ts == null) throw new Exception("Expected IFilledTextureSet, but got null..."); if(ts == null) throw new Exception("Expected ResourceTextureSet, but got null...");
if(node.Parent != null && General.Map.Config.MixTexturesFlats) if(node.Parent != null && General.Map.Config.MixTexturesFlats)
{ {
ts.MixTexturesAndFlats(); ts.MixTexturesAndFlats();
node.Text += " [" + ts.Textures.Count + "]"; if(ts.Textures.Count > 0) node.Text += " [" + ts.Textures.Count + "]";
} }
else else
{ {
node.Text += " [" + (browseflats ? ts.Flats.Count : ts.Textures.Count) + "]"; int texcount = (browseflats ? ts.Flats.Count : ts.Textures.Count);
if(texcount > 0) node.Text += " [" + texcount + "]";
} }
foreach(TreeNode child in node.Nodes) SetItemsCount(child); foreach(TreeNode child in node.Nodes) SetItemsCount(child);
} }
// Selection changed // Selection changed
private void browser_SelectedItemChanged() private void browser_SelectedItemChanged(ImageBrowserItem item)
{ {
apply.Enabled = (browser.SelectedItem != null); apply.Enabled = (item != null && item.ItemType == ImageBrowserItemType.IMAGE);
} }
// OK clicked // OK clicked
private void apply_Click(object sender, EventArgs e) private void apply_Click(object sender, EventArgs e)
{ {
// Set selected name and close // Set selected name and close
if(browser.SelectedItem != null) if(browser.SelectedItem != null && browser.SelectedItem.ItemType == ImageBrowserItemType.IMAGE)
{ {
ImageBrowserItem item = browser.SelectedItem as ImageBrowserItem; selectedname = browser.SelectedItem.TextureName;
selectedname = item.TextureName;
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
else else
@ -384,65 +414,148 @@ namespace CodeImp.DoomBuilder.Windows
// Save window settings // Save window settings
General.Settings.WriteSetting("windows." + configname + ".splitterdistance", splitter.SplitPosition); //mxd General.Settings.WriteSetting("windows." + configname + ".splitterdistance", splitter.SplitPosition); //mxd
General.Settings.WriteSetting("windows." + configname + ".splittercollapsed", splitter.IsCollapsed); //mxd General.Settings.WriteSetting("windows." + configname + ".splittercollapsed", splitter.IsCollapsed); //mxd
General.Settings.WriteSetting("windows." + configname + ".usedgroupcollapsed", browser.IsGroupCollapsed(usedgroup)); //mxd
//mxd. Save last selected texture set //mxd. Save last selected texture set
if(this.DialogResult == DialogResult.OK && tvTextureSets.SelectedNodes.Count > 0) if(this.DialogResult == DialogResult.OK && tvTextureSets.SelectedNodes.Count > 0)
General.Settings.WriteSetting("windows." + configname + ".textureset", tvTextureSets.SelectedNodes[0].Name); General.Settings.WriteSetting("windows." + configname + ".textureset", tvTextureSets.SelectedNodes[0].Name);
//mxd. Save ImageBrowserControl settings
General.Settings.WriteSetting("windows." + configname + ".showtexturesfromsubdirs", ImageBrowserControl.ShowTexturesFromSubDirectories);
if(General.Map.Config.UseLongTextureNames) General.Map.Options.UseLongTextureNames = ImageBrowserControl.UseLongTextureNames;
// Clean up // Clean up
browser.CleanUp(); browser.OnClose("windows." + configname);
} }
// Static method to browse for texture or flat // Static method to browse for texture or flat.
// Returns null when cancelled. public static string Browse(IWin32Window parent, string select, bool browseflats)
public static string Browse(IWin32Window parent, string select, bool browseFlats)
{ {
TextureBrowserForm browser = new TextureBrowserForm(select, browseFlats); TextureBrowserForm browser = new TextureBrowserForm(select, browseflats);
if(browser.ShowDialog(parent) == DialogResult.OK) return browser.SelectedName; // Return result return (browser.ShowDialog(parent) == DialogResult.OK ? browser.SelectedName : select);
// Cancelled
return select;
} }
// Item double clicked // Item double clicked
private void browser_SelectedItemDoubleClicked() private void browser_SelectedItemDoubleClicked(ImageBrowserItem item)
{ {
if(apply.Enabled) apply_Click(this, EventArgs.Empty); if(item == null) return;
switch(item.ItemType)
{
case ImageBrowserItemType.IMAGE:
if(selectedset == null) throw new NotSupportedException("selectedset required!");
if(apply.Enabled) apply_Click(this, EventArgs.Empty);
break;
case ImageBrowserItemType.FOLDER_UP:
if(selectedset == null) throw new NotSupportedException("selectedset required!");
if(selectedset.Parent != null)
{
// Select the node
tvTextureSets.SelectedNodes.Clear();
tvTextureSets.SelectedNodes.Add(selectedset.Parent);
selectedset.Parent.EnsureVisible();
// Update textures list
selectedset = selectedset.Parent;
}
else
{
tvTextureSets.SelectedNodes.Clear();
selectedset = null;
}
FillImagesList();
break;
case ImageBrowserItemType.FOLDER:
// selectedset is null when at root level
TreeNodeCollection nodes = (selectedset == null ? tvTextureSets.Nodes : selectedset.Nodes);
foreach(TreeNode child in nodes)
{
TreeNodeData data = (TreeNodeData)child.Tag;
if(data.FolderName == item.TextureName)
{
// Select the node
tvTextureSets.SelectedNodes.Clear();
tvTextureSets.SelectedNodes.Add(child);
child.EnsureVisible();
// Update textures list
selectedset = child;
FillImagesList();
break;
}
}
break;
default: throw new NotImplementedException("Unsupported ImageBrowserItemType");
}
} }
// This fills the list of textures, depending on the selected texture set // This fills the list of textures, depending on the selected texture set
private void FillImagesList() private void FillImagesList()
{ {
//mxd. Show root items
if(selectedset == null)
{
FillCategoriesList();
return;
}
// Get the selected texture set // Get the selected texture set
IFilledTextureSet set = (selectedset.Tag as IFilledTextureSet); IFilledTextureSet set = ((TreeNodeData)selectedset.Tag).Set;
// Start adding // Start adding
browser.BeginAdding(set.Level, false); //mxd. Pass current folder level browser.BeginAdding(false);
//mxd. Add "Browse up" item
if(selectedset.Parent != null)
{
TreeNodeData data = (TreeNodeData)selectedset.Parent.Tag;
browser.AddFolder(ImageBrowserItemType.FOLDER_UP, availgroup, data.FolderName);
}
else
{
browser.AddFolder(ImageBrowserItemType.FOLDER_UP, availgroup, "All Texture Sets");
}
//mxd. Add folders
foreach(TreeNode child in selectedset.Nodes)
{
TreeNodeData data = (TreeNodeData)child.Tag;
browser.AddFolder(ImageBrowserItemType.FOLDER, availgroup, data.FolderName);
}
// Add textures
if(browseflats) if(browseflats)
{ {
// Add all available flats // Add all available flats
foreach(ImageData img in set.Flats) foreach(ImageData img in set.Flats)
browser.Add(img, img, availgroup); browser.AddItem(img, availgroup);
// Add all used flats // Add all used flats
foreach(ImageData img in set.Flats) foreach(ImageData img in set.Flats)
if(img.UsedInMap) browser.Add(img, img, usedgroup); if(img.UsedInMap) browser.AddItem(img, usedgroup);
} }
else else
{ {
// Add all available textures and mark the images for temporary loading // Add all available textures and mark the images for temporary loading
foreach(ImageData img in set.Textures) foreach(ImageData img in set.Textures)
browser.Add(img, img, availgroup); browser.AddItem(img, availgroup);
// Add all used textures and mark the images for permanent loading // Add all used textures and mark the images for permanent loading
foreach(ImageData img in set.Textures) foreach(ImageData img in set.Textures)
if(img.UsedInMap) browser.Add(img, img, usedgroup); if(img.UsedInMap) browser.AddItem(img, usedgroup);
}
// Done adding
browser.EndAdding();
}
private void FillCategoriesList()
{
// Start adding
browser.BeginAdding(false);
foreach(TreeNode node in tvTextureSets.Nodes)
{
TreeNodeData data = (TreeNodeData)node.Tag;
browser.AddFolder(ImageBrowserItemType.FOLDER, availgroup, data.FolderName);
browser.AddFolder(ImageBrowserItemType.FOLDER, usedgroup, data.FolderName);
} }
// Done adding // Done adding
@ -450,26 +563,26 @@ namespace CodeImp.DoomBuilder.Windows
} }
// Help // Help
private void TextureBrowserForm_HelpRequested(object sender, HelpEventArgs hlpevent) private void TextureBrowserForm_HelpRequested(object sender, HelpEventArgs e)
{ {
General.ShowHelp("w_imagesbrowser.html"); General.ShowHelp("w_imagesbrowser.html");
hlpevent.Handled = true; e.Handled = true;
} }
private void TextureBrowserForm_Shown(object sender, EventArgs e) private void TextureBrowserForm_Shown(object sender, EventArgs e)
{ {
if(selectedset != null) //mxd. Calling FillImagesList() from constructor leads to TERRIBLE load times. Why? I have no sodding idea... //mxd. Calling FillImagesList() from constructor results in TERRIBLE load times. Why? I have no sodding idea...
FillImagesList(); if(selectedset != null) FillImagesList();
// Select texture // Select texture
if(selecttextureonfill != 0) if(selecttextureonfill != 0)
{ {
browser.SelectItem(selecttextureonfill, (usedgroupcollapsed ? availgroup : usedgroup)); //mxd. availgroup/usedgroup switch. browser.SelectItem(selecttextureonfill, browser.SelectedGroup);
selecttextureonfill = 0; selecttextureonfill = 0;
} }
//mxd. Focus the textbox. Calling this from TextureBrowserForm_Activated (like it's done in DB2) fails when the form is maximized. Again, I've no idea why... //mxd. Focus the textures list. Calling this from TextureBrowserForm_Activated (like it's done in DB2) fails when the form is maximized. Again, I've no idea why...
browser.FocusTextbox(); browser.FocusList();
} }
//mxd //mxd

View file

@ -229,7 +229,6 @@ namespace CodeImp.DoomBuilder.Windows
this.matcheslist.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.matcheslist.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.matcheslist.BrowseFlats = false;
this.matcheslist.HideInputBox = true; this.matcheslist.HideInputBox = true;
this.matcheslist.Location = new System.Drawing.Point(18, 55); this.matcheslist.Location = new System.Drawing.Point(18, 55);
this.matcheslist.Name = "matcheslist"; this.matcheslist.Name = "matcheslist";

View file

@ -19,6 +19,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Data; using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Config; using CodeImp.DoomBuilder.Config;
@ -170,7 +171,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
bool ismatch = set.IsMatch(img); bool ismatch = set.IsMatch(img);
if((ismatch && matchesbutton.Checked) || (!ismatch && nomatchesbutton.Checked)) if((ismatch && matchesbutton.Checked) || (!ismatch && nomatchesbutton.Checked))
matcheslist.Add(img, img, null, tooltiptext); matcheslist.AddItem(img, null, tooltiptext);
} }
// If not already mixed, add flats as well // If not already mixed, add flats as well
@ -181,7 +182,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
bool ismatch = set.IsMatch(img); bool ismatch = set.IsMatch(img);
if((ismatch && matchesbutton.Checked) || (!ismatch && nomatchesbutton.Checked)) if((ismatch && matchesbutton.Checked) || (!ismatch && nomatchesbutton.Checked))
matcheslist.Add(img, img, null, tooltiptext); matcheslist.AddItem(img, null, tooltiptext);
} }
} }
@ -213,11 +214,10 @@ namespace CodeImp.DoomBuilder.Windows
} }
// Texture doubleclicked // Texture doubleclicked
private void matcheslist_SelectedItemDoubleClicked() private void matcheslist_SelectedItemDoubleClicked(ImageBrowserItem item)
{ {
// Add texture name to the list // Add texture name to the list
if(matcheslist.SelectedItem != null) if(item != null) filters.Items.Add(item.TextureName);
filters.Items.Add(matcheslist.SelectedItem.Text);
// Run the timer // Run the timer
filterstimer.Start(); filterstimer.Start();

View file

@ -133,7 +133,6 @@
this.textureUpper.Size = new System.Drawing.Size(83, 112); this.textureUpper.Size = new System.Drawing.Size(83, 112);
this.textureUpper.TabIndex = 2; this.textureUpper.TabIndex = 2;
this.textureUpper.TextureName = ""; this.textureUpper.TextureName = "";
this.textureUpper.UsePreviews = true;
this.textureUpper.OnValueChanged += new System.EventHandler(this.textureUpper_OnValueChanged); this.textureUpper.OnValueChanged += new System.EventHandler(this.textureUpper_OnValueChanged);
// //
// cbPegTop // cbPegTop
@ -156,7 +155,6 @@
this.textureLower.Size = new System.Drawing.Size(83, 112); this.textureLower.Size = new System.Drawing.Size(83, 112);
this.textureLower.TabIndex = 4; this.textureLower.TabIndex = 4;
this.textureLower.TextureName = ""; this.textureLower.TextureName = "";
this.textureLower.UsePreviews = true;
this.textureLower.OnValueChanged += new System.EventHandler(this.textureLower_OnValueChanged); this.textureLower.OnValueChanged += new System.EventHandler(this.textureLower_OnValueChanged);
// //
// cbPegBottom // cbPegBottom

View file

@ -50,7 +50,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
this.doortexture.Size = new System.Drawing.Size(83, 105); this.doortexture.Size = new System.Drawing.Size(83, 105);
this.doortexture.TabIndex = 0; this.doortexture.TabIndex = 0;
this.doortexture.TextureName = ""; this.doortexture.TextureName = "";
this.doortexture.UsePreviews = true;
// //
// label1 // label1
// //
@ -80,7 +79,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
this.ceilingtexture.Size = new System.Drawing.Size(83, 105); this.ceilingtexture.Size = new System.Drawing.Size(83, 105);
this.ceilingtexture.TabIndex = 1; this.ceilingtexture.TabIndex = 1;
this.ceilingtexture.TextureName = ""; this.ceilingtexture.TextureName = "";
this.ceilingtexture.UsePreviews = true;
// //
// floortexture // floortexture
// //
@ -90,7 +88,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
this.floortexture.Size = new System.Drawing.Size(83, 105); this.floortexture.Size = new System.Drawing.Size(83, 105);
this.floortexture.TabIndex = 2; this.floortexture.TabIndex = 2;
this.floortexture.TextureName = ""; this.floortexture.TextureName = "";
this.floortexture.UsePreviews = true;
// //
// label3 // label3
// //
@ -144,7 +141,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
this.tracktexture.Size = new System.Drawing.Size(83, 105); this.tracktexture.Size = new System.Drawing.Size(83, 105);
this.tracktexture.TabIndex = 6; this.tracktexture.TabIndex = 6;
this.tracktexture.TextureName = ""; this.tracktexture.TextureName = "";
this.tracktexture.UsePreviews = true;
// //
// label4 // label4
// //

View file

@ -99,7 +99,6 @@
this.ceiling.Size = new System.Drawing.Size(68, 90); this.ceiling.Size = new System.Drawing.Size(68, 90);
this.ceiling.TabIndex = 30; this.ceiling.TabIndex = 30;
this.ceiling.TextureName = ""; this.ceiling.TextureName = "";
this.ceiling.UsePreviews = true;
this.ceiling.OnValueChanged += new System.EventHandler(this.ceiling_OnValueChanged); this.ceiling.OnValueChanged += new System.EventHandler(this.ceiling_OnValueChanged);
// //
// floor // floor
@ -110,7 +109,6 @@
this.floor.Size = new System.Drawing.Size(68, 90); this.floor.Size = new System.Drawing.Size(68, 90);
this.floor.TabIndex = 29; this.floor.TabIndex = 29;
this.floor.TextureName = ""; this.floor.TextureName = "";
this.floor.UsePreviews = true;
this.floor.OnValueChanged += new System.EventHandler(this.floor_OnValueChanged); this.floor.OnValueChanged += new System.EventHandler(this.floor_OnValueChanged);
// //
// cbOverrideFloorTexture // cbOverrideFloorTexture
@ -282,7 +280,6 @@
this.bottom.Size = new System.Drawing.Size(68, 90); this.bottom.Size = new System.Drawing.Size(68, 90);
this.bottom.TabIndex = 25; this.bottom.TabIndex = 25;
this.bottom.TextureName = ""; this.bottom.TextureName = "";
this.bottom.UsePreviews = true;
this.bottom.OnValueChanged += new System.EventHandler(this.bottom_OnValueChanged); this.bottom.OnValueChanged += new System.EventHandler(this.bottom_OnValueChanged);
// //
// cbOverrideTopTexture // cbOverrideTopTexture
@ -305,7 +302,6 @@
this.middle.Size = new System.Drawing.Size(68, 90); this.middle.Size = new System.Drawing.Size(68, 90);
this.middle.TabIndex = 24; this.middle.TabIndex = 24;
this.middle.TextureName = ""; this.middle.TextureName = "";
this.middle.UsePreviews = true;
this.middle.OnValueChanged += new System.EventHandler(this.middle_OnValueChanged); this.middle.OnValueChanged += new System.EventHandler(this.middle_OnValueChanged);
// //
// top // top
@ -317,7 +313,6 @@
this.top.Size = new System.Drawing.Size(68, 90); this.top.Size = new System.Drawing.Size(68, 90);
this.top.TabIndex = 23; this.top.TabIndex = 23;
this.top.TextureName = ""; this.top.TextureName = "";
this.top.UsePreviews = true;
this.top.OnValueChanged += new System.EventHandler(this.top_OnValueChanged); this.top.OnValueChanged += new System.EventHandler(this.top_OnValueChanged);
// //
// groupBox3 // groupBox3

View file

@ -148,6 +148,21 @@ namespace CodeImp.DoomBuilder.Plugins.NodesViewer
return false; return false;
} }
//mxd. ZDoom SEGS overflow error
if(numsegs >= ushort.MaxValue)
{
// Cancel mode
MessageBox.Show("The map has too many SEGS (" + numsegs + "/" + ushort.MaxValue + ").\nIt won't load in most Doom source ports.", "THY SEGS ARETH WAAAY TOO PHAT!", MessageBoxButtons.OK, MessageBoxIcon.Error);
General.Editing.CancelMode();
return false;
}
//mxd. Vanilla SEGS overflow warning
if(numsegs >= short.MaxValue)
{
MessageBox.Show("The map has too many SEGS (" + numsegs + "/" + short.MaxValue + ").\nIt won't load in Vanilla-style source ports.", "THY SEGS ARETH TOO PHAT!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
segs = new Seg[numsegs]; segs = new Seg[numsegs];
for(int i = 0; i < segs.Length; i++) for(int i = 0; i < segs.Length; i++)
{ {
@ -199,8 +214,8 @@ namespace CodeImp.DoomBuilder.Plugins.NodesViewer
ssectors = new Subsector[numssec]; ssectors = new Subsector[numssec];
for(int i = 0; i < ssectors.Length; i++) for(int i = 0; i < ssectors.Length; i++)
{ {
ssectors[i].numsegs = ssecreader.ReadInt16(); ssectors[i].numsegs = ssecreader.ReadUInt16(); //TECH: these are short in Doom, ushort in ZDoom/PRBoom+
ssectors[i].firstseg = ssecreader.ReadInt16(); ssectors[i].firstseg = ssecreader.ReadUInt16();
} }
ssecreader.Close(); ssecreader.Close();
@ -344,7 +359,7 @@ namespace CodeImp.DoomBuilder.Plugins.NodesViewer
// Boilerplate... // Boilerplate...
if(nodescount < 1) if(nodescount < 1)
{ {
MessageBox.Show("The map has only one subsector.", "Why are you doing this, Stanley?..", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("The map has only one subsector.\nPlease add more sectors before using this mode.", "Why are you doing this, Stanley?..", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false; return false;
} }