Texture Browser Form: some minor logic fixes (no texture groups were selected when initial texture was empty and no texture group was stored in the program configuration).

Texture Browser Form: don't save current texture group when the form was canceled.
Keyboard Shortcut Reference export: generated html will now be saved to program configuration folder if working folder is write-protected.
Internal: added SupportedMapFormats property to EditModeAttribute. A mode with this property specified will be available only in specified map formats.
Interface: Ceiling Align Mode and Floor Align Mode are now enabled by default.
Interface: Ceiling Align Mode and Floor Align Mode are now only available in UDMF map format.
Interface: Visplane Explorer Mode is now available only in Doom map format.
This commit is contained in:
MaxED 2014-09-08 13:09:14 +00:00
parent bfda0c99e7
commit 697069e27b
8 changed files with 64 additions and 27 deletions

View file

@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Editing
private bool allowcopypaste = true;
private bool usebydefault;
private bool safestartmode;
private string[] supportedmapformats; //mxd
#endregion
@ -108,7 +109,12 @@ namespace CodeImp.DoomBuilder.Editing
/// opening a map. The user can then select this as starting mode in the configuration.
/// </summary>
public bool SafeStartMode { get { return safestartmode; } set { safestartmode = value; } }
/// <summary>
/// List of map formats this mode can work with. Null means all map formats are supported (mxd)
/// </summary>
public string[] SupportedMapFormats { get { return supportedmapformats; } set { supportedmapformats = value; } }
#endregion
#region ================== Constructor / Disposer

View file

@ -247,10 +247,12 @@ namespace CodeImp.DoomBuilder.Editing
{
foreach(EditModeInfo emi in allmodes)
{
// Include the mode when it is listed and enabled
// Also include the mode when it is not optional
if( (General.Map.ConfigSettings.EditModes.ContainsKey(emi.Type.FullName) &&
General.Map.ConfigSettings.EditModes[emi.Type.FullName]) || !emi.IsOptional )
// Include the mode if it supports current map format (mxd)
// Also include the mode when it is listed and enabled or when it's not optional
if( (emi.Attributes.SupportedMapFormats == null || Array.IndexOf(emi.Attributes.SupportedMapFormats, General.Map.Config.FormatInterface) != -1) &&
((General.Map.ConfigSettings.EditModes.ContainsKey(emi.Type.FullName) &&
General.Map.ConfigSettings.EditModes[emi.Type.FullName] )
|| !emi.IsOptional) )
{
// Add the mode to be used and bind switch action
usedmodes.Add(emi);

View file

@ -90,6 +90,7 @@ namespace CodeImp.DoomBuilder.Windows
lvi = listmodes.Items.Add(emi.Attributes.DisplayName);
lvi.Tag = emi;
lvi.SubItems.Add(emi.Plugin.Plug.Name);
lvi.UseItemStyleForSubItems = true; //mxd
}
}
@ -194,8 +195,27 @@ namespace CodeImp.DoomBuilder.Windows
foreach(ListViewItem lvi in listmodes.Items)
{
EditModeInfo emi = (lvi.Tag as EditModeInfo);
lvi.Checked = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]);
//mxd. Disable item if the mode does not support current map format
if (emi.Attributes.SupportedMapFormats != null &&
Array.IndexOf(emi.Attributes.SupportedMapFormats, gameconfig.FormatInterface) == -1)
{
lvi.Text = emi.Attributes.DisplayName + " (map format not supported)";
lvi.ForeColor = SystemColors.GrayText;
lvi.BackColor = SystemColors.InactiveBorder;
lvi.Checked = false;
}
else
{
lvi.Text = emi.Attributes.DisplayName;
lvi.ForeColor = SystemColors.WindowText;
lvi.BackColor = SystemColors.Window;
lvi.Checked = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]);
}
}
// Update listmodes columns width (mxd)
listmodes.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
// Fill start modes
RefillStartModes();
@ -559,6 +579,9 @@ namespace CodeImp.DoomBuilder.Windows
// Leave when no configuration selected
if(configinfo == null) return;
// mxd. Not the best way to detect a disabled item, but we will go with that...
if(e.Item.ForeColor == SystemColors.GrayText) e.Item.Checked = false;
// Apply changes
EditModeInfo emi = (e.Item.Tag as EditModeInfo);

View file

@ -2758,12 +2758,21 @@ namespace CodeImp.DoomBuilder.Windows
html.AppendLine("</table></div></body></html>");
//write
using(StreamWriter writer = File.CreateText(fileName)) {
writer.Write(html.ToString());
string path;
try {
path = Path.Combine(General.AppPath, fileName);
using(StreamWriter writer = File.CreateText(path)) {
writer.Write(html.ToString());
}
} catch (Exception) {
//Configurtions path SHOULD be accessible and not read-only, right?
path = Path.Combine(General.SettingsPath, fileName);
using(StreamWriter writer = File.CreateText(path)) {
writer.Write(html.ToString());
}
}
//open file
string path = Path.Combine(General.AppPath, fileName);
DisplayStatus(StatusType.Info, "Shortcut reference saved to '" + path + "'");
System.Diagnostics.Process.Start(path);
}

View file

@ -92,8 +92,10 @@ namespace CodeImp.DoomBuilder.Windows
item.ImageIndex = 2 + ts.Location.type;
item.SelectedImageIndex = item.ImageIndex;
if (ts.Location.type != DataLocation.RESOURCE_WAD)
if (ts.Location.type != DataLocation.RESOURCE_WAD) {
createNodes(item);
item.Expand();
}
}
//mxd. Add All textures set
@ -124,11 +126,10 @@ namespace CodeImp.DoomBuilder.Windows
}
//mxd. If the selected texture was not found in the last-selected set, try finding it in the other sets
if (selectedset == null) {
if (selectedset == null && selecttexture != "-") {
foreach (TreeNode n in tvTextureSets.Nodes) {
selectedset = findTextureByLongName(n, longname);
if (selectedset != null)
break;
if (selectedset != null) break;
}
}
@ -136,13 +137,11 @@ namespace CodeImp.DoomBuilder.Windows
if (selectedset == null && match != null)
selectedset = match;
if(tvTextureSets.Nodes.Count > 0)
tvTextureSets.Nodes[0].Expand();//mxd
tvTextureSets.EndUpdate();//mxd
//mxd. Select found node or "All" node, if none were found
if (tvTextureSets.Nodes.Count > 0)
tvTextureSets.SelectedNode = (selectedset ?? tvTextureSets.Nodes[tvTextureSets.Nodes.Count - 1]);
if (selectedset != null) {//mxd
tvTextureSets.SelectedNode = selectedset;
}
tvTextureSets.EndUpdate();//mxd
// Keep last position and size
lastposition = this.Location;
@ -375,7 +374,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Settings.WriteSetting("browserwindow.windowstate", windowstate);
//mxd. Save last selected texture set
if(tvTextureSets.SelectedNode != null)
if(this.DialogResult == DialogResult.OK && tvTextureSets.SelectedNode != null)
General.Settings.WriteSetting("browserwindow.textureset", tvTextureSets.SelectedNode.Name);
// Clean up

View file

@ -30,6 +30,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
ButtonImage = "CeilingAlign.png",
ButtonOrder = int.MinValue + 311,
ButtonGroup = "000_editing",
UseByDefault = true, //mxd
SupportedMapFormats = new[] { "UniversalMapSetIO" }, //mxd
Volatile = true)]
public class CeilingAlignMode : FlatAlignMode

View file

@ -30,6 +30,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
ButtonImage = "FloorAlign.png",
ButtonOrder = int.MinValue + 310,
ButtonGroup = "000_editing",
UseByDefault = true, //mxd
SupportedMapFormats = new[] { "UniversalMapSetIO" }, //mxd
Volatile = true)]
public class FloorAlignMode : FlatAlignMode

View file

@ -25,6 +25,7 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
ButtonGroup = "002_tools",
Volatile = true,
UseByDefault = true,
SupportedMapFormats = new[] { "DoomMapSetIO" }, //mxd
AllowCopyPaste = false)]
public class VisplaneExplorerMode : ClassicMode
{
@ -248,13 +249,6 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
// Mode starts
public override void OnEngage()
{
//mxd. I think it only applies to maps in Doom format
if (General.Map.Config.FormatInterface != "DoomMapSetIO") {
General.Interface.DisplayStatus(StatusType.Warning, "Visplane Explorer requires map in Doom format!");
OnCancel(); //return to previous mode
return;
}
Cursor.Current = Cursors.WaitCursor;
base.OnEngage();
General.Interface.DisplayStatus(StatusType.Busy, "Setting up test environment...");