UltimateZoneBuilder/Source/Core/Controls/Scripting/ScriptIconsManager.cs
MaxED 45c3cbaae3 Added, Script Editor: added script configurations / auto-detection support for GAMEINFO, FONTDEFS and KEYCONF text lumps.
Fixed, "Open Map Options" and "Change Map" windows: fixed incorrect size of the items in the maps list when using high-DPI scaling.
Updated ZDoom_DECORATE.cfg and ZDoom_MAPINFO.cfg.
2016-12-12 12:35:18 +00:00

51 lines
1.6 KiB
C#

using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Config;
namespace CodeImp.DoomBuilder.Controls.Scripting
{
internal class ScriptIconsManager
{
private int scripttypeiconsoffset;
private int scriptgroupiconsoffset;
private int scriptgroupopeniconsoffset;
private ImageList icons;
internal int ScriptTypeIconsOffset { get { return scripttypeiconsoffset; } }
internal int ScriptGroupIconsOffset { get { return scriptgroupiconsoffset; } }
internal int ScriptGroupOpenIconsOffset { get { return scriptgroupopeniconsoffset; } }
public ImageList Icons { get { return icons; } }
public ScriptIconsManager(ImageList icons)
{
this.icons = icons;
int numicons = Enum.GetNames(typeof(ScriptType)).Length;
scriptgroupopeniconsoffset = icons.Images.Count - numicons;
scriptgroupiconsoffset = scriptgroupopeniconsoffset - numicons;
scripttypeiconsoffset = scriptgroupiconsoffset - numicons;
}
public int GetResourceIcon(int datalocationtype)
{
return datalocationtype;
}
public int GetScriptIcon(ScriptType type)
{
int scripttype = (int)type + scripttypeiconsoffset;
if(scripttype >= scriptgroupiconsoffset) scripttype = scripttypeiconsoffset;
return scripttype;
}
public int GetScriptFolderIcon(ScriptType type, bool opened)
{
int scripttype = (int)type;
if(scripttype >= scriptgroupiconsoffset - scripttypeiconsoffset)
scripttype = scripttypeiconsoffset;
if(opened) return scriptgroupopeniconsoffset + scripttype;
return scriptgroupiconsoffset + scripttype;
}
}
}