Merged in GZDB r2501.

This commit is contained in:
MascaraSnake 2016-04-08 20:15:23 +02:00
parent ea2d439b87
commit 907ed1c439
6 changed files with 117 additions and 67 deletions

View file

@ -61,25 +61,27 @@ namespace CodeImp.DoomBuilder.Controls
private string lasteditfieldname; private string lasteditfieldname;
private bool autoinsertuserprefix; private bool autoinsertuserprefix;
private Dictionary<string, UniversalType> uifields;//mxd private Dictionary<string, UniversalType> uifields;//mxd
private bool showfixedfields = true; //mxd
#endregion
#region ================== Properties #endregion
public bool AllowInsert { get { return fieldslist.AllowUserToAddRows; } set { fieldslist.AllowUserToAddRows = value; SetupNewRowStyle(); } } #region ================== Properties
public bool AllowInsert { get { return fieldslist.AllowUserToAddRows; } set { fieldslist.AllowUserToAddRows = value; SetupNewRowStyle(); } }
public bool AutoInsertUserPrefix { get { return autoinsertuserprefix; } set { autoinsertuserprefix = value; } } public bool AutoInsertUserPrefix { get { return autoinsertuserprefix; } set { autoinsertuserprefix = value; } }
public int PropertyColumnWidth { get { return fieldname.Width; } set { fieldname.Width = value; UpdateValueColumn(); UpdateBrowseButton(); } } public int PropertyColumnWidth { get { return fieldname.Width; } set { fieldname.Width = value; UpdateValueColumn(); UpdateBrowseButton(); } }
public int TypeColumnWidth { get { return fieldtype.Width; } set { fieldtype.Width = value; UpdateValueColumn(); UpdateBrowseButton(); } } public int TypeColumnWidth { get { return fieldtype.Width; } set { fieldtype.Width = value; UpdateValueColumn(); UpdateBrowseButton(); } }
public bool PropertyColumnVisible { get { return fieldname.Visible; } set { fieldname.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } } public bool PropertyColumnVisible { get { return fieldname.Visible; } set { fieldname.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } }
public bool TypeColumnVisible { get { return fieldtype.Visible; } set { fieldtype.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } } public bool TypeColumnVisible { get { return fieldtype.Visible; } set { fieldtype.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } }
public bool ValueColumnVisible { get { return fieldvalue.Visible; } set { fieldvalue.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } } public bool ValueColumnVisible { get { return fieldvalue.Visible; } set { fieldvalue.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } }
public bool ShowFixedFields { get { return showfixedfields; } set { showfixedfields = value; UpdateFixedFieldsVisibility(); } } //mxd
#endregion
#region ================== Constructor #endregion
// Constructor #region ================== Constructor
public FieldsEditorControl()
// Constructor
public FieldsEditorControl()
{ {
InitializeComponent(); InitializeComponent();
autoinsertuserprefix = true; autoinsertuserprefix = true;
@ -96,7 +98,7 @@ namespace CodeImp.DoomBuilder.Controls
// Keep element name // Keep element name
this.elementname = elementname; this.elementname = elementname;
//mxd. get proper UIFields //mxd. Get proper UIFields
uifields = General.Map.FormatInterface.UIFields[General.Map.FormatInterface.GetElementType(elementname)]; uifields = General.Map.FormatInterface.UIFields[General.Map.FormatInterface.GetElementType(elementname)];
// Make types list // Make types list
@ -639,11 +641,18 @@ namespace CodeImp.DoomBuilder.Controls
// Delete all rows that must be deleted // Delete all rows that must be deleted
for(int i = fieldslist.Rows.Count - 1; i >= 0; i--) for(int i = fieldslist.Rows.Count - 1; i >= 0; i--)
{ {
if(fieldslist.Rows[i].ReadOnly) if (fieldslist.Rows[i].ReadOnly)
try { fieldslist.Rows.RemoveAt(i); } catch(Exception) { } {
else try { fieldslist.Rows.RemoveAt(i); } catch { }
fieldslist.Rows[i].Visible = true; }
} else
{
//mxd. Preserve fixed fields visibility setting
FieldsEditorRow frow = (fieldslist.Rows[i] as FieldsEditorRow);
if (frow != null && frow.IsFixed) frow.Visible = showfixedfields;
else fieldslist.Rows[i].Visible = true;
}
}
// Update new row // Update new row
SetupNewRowStyle(); SetupNewRowStyle();
@ -831,7 +840,17 @@ namespace CodeImp.DoomBuilder.Controls
HideBrowseButton(); HideBrowseButton();
} }
} }
#endregion //mxd
} private void UpdateFixedFieldsVisibility()
{
foreach (var row in fieldslist.Rows)
{
FieldsEditorRow frow = (row as FieldsEditorRow);
if (frow != null && frow.IsFixed) frow.Visible = showfixedfields;
}
}
#endregion
}
} }

View file

@ -126,8 +126,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
{ {
if(first) if(first)
{ {
foreach(int tag in newtags) tags.Add(tag); tags.AddRange(newtags);
return; return;
} }
for(int i = 0; i < newtags.Count; i++) for(int i = 0; i < newtags.Count; i++)
@ -137,7 +137,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
else if(i >= tags.Count) else if(i >= tags.Count)
tags.Add(int.MinValue); tags.Add(int.MinValue);
} }
}
// If current tags list is shorter than out tags list, mark the rest of our list as mixed
if (newtags.Count < tags.Count)
{
for (int i = newtags.Count; i < tags.Count; i++)
tags[i] = int.MinValue;
}
}
#endregion #endregion
@ -161,14 +168,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private IEnumerable<int> GetResultTags(int[] oldtags, int offset) private IEnumerable<int> GetResultTags(int[] oldtags, int offset)
{ {
Dictionary<int, bool> newtags = new Dictionary<int, bool>(); HashSet<int> newtags = new HashSet<int>();
for(int i = 0; i < tags.Count; i++) for (int i = 0; i < tags.Count; i++)
{ {
if(tags[i] == int.MinValue && oldtags.Length > i) if(tags[i] == int.MinValue && oldtags.Length > i)
{ {
if(!newtags.ContainsKey(oldtags[i])) newtags.Add(oldtags[i], false); if (oldtags[i] != 0 && !newtags.Contains(oldtags[i])) newtags.Add(oldtags[i]);
} }
else if(tags[i] != 0 && tags[i] != int.MinValue) else if(tags[i] != 0 && tags[i] != int.MinValue)
{ {
int tag; int tag;
@ -179,13 +186,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
else else
tag = tags[i]; tag = tags[i];
if(!newtags.ContainsKey(tag)) newtags.Add(tag, false); if (!newtags.Contains(tag)) newtags.Add(tag);
} }
} }
if(newtags.Count == 0) newtags.Add(0, false); if (newtags.Count == 0) newtags.Add(0);
return newtags.Keys; return newtags;
} }
#endregion #endregion

View file

@ -741,19 +741,19 @@ namespace CodeImp.DoomBuilder.Geometry
} }
//mxd. This applies overrides to a sidedef //mxd. This applies overrides to a sidedef
private static void ApplyOverridesToSidedef(Sidedef sd) private static void ApplyOverridesToSidedef(Sidedef sd)
{ {
if(General.Map.Options.OverrideTopTexture) sd.SetTextureHigh(General.Map.Options.DefaultTopTexture); if (sd.HighRequired() && General.Map.Options.OverrideTopTexture) sd.SetTextureHigh(General.Map.Options.DefaultTopTexture);
if(sd.MiddleRequired() && General.Map.Options.OverrideMiddleTexture) sd.SetTextureMid(General.Map.Options.DefaultWallTexture); if (sd.MiddleRequired() && General.Map.Options.OverrideMiddleTexture) sd.SetTextureMid(General.Map.Options.DefaultWallTexture);
if(General.Map.Options.OverrideBottomTexture) sd.SetTextureLow(General.Map.Options.DefaultBottomTexture); if (sd.LowRequired() && General.Map.Options.OverrideBottomTexture) sd.SetTextureLow(General.Map.Options.DefaultBottomTexture);
} }
#endregion #endregion
#region ================== Sector Labels #region ================== Sector Labels
// This finds the ideal label positions for a sector // This finds the ideal label positions for a sector
public static List<LabelPositionInfo> FindLabelPositions(Sector s) public static List<LabelPositionInfo> FindLabelPositions(Sector s)
{ {
List<LabelPositionInfo> positions = new List<LabelPositionInfo>(2); List<LabelPositionInfo> positions = new List<LabelPositionInfo>(2);
int islandoffset = 0; int islandoffset = 0;
@ -1466,10 +1466,10 @@ namespace CodeImp.DoomBuilder.Geometry
newlines[i].Dispose(); newlines[i].Dispose();
} }
//mxd. Apply texture overrides //mxd. Apply texture overrides
if(useOverrides && !General.Settings.AutoClearSidedefTextures) if (useOverrides)
{ {
//if new sectors are created, apply overrides to the sides of these sectors, otherwise, apply overrides to all new lines //If new sectors are created, apply overrides to the sides of these sectors, otherwise, apply overrides to all new lines
if(insidesides.Count > 0) if(insidesides.Count > 0)
{ {
foreach(Sidedef side in insidesides) ApplyOverridesToSidedef(side); foreach(Sidedef side in insidesides) ApplyOverridesToSidedef(side);

View file

@ -679,7 +679,6 @@ namespace CodeImp.DoomBuilder.Windows
// Effects // Effects
if(!effect.Empty) s.Effect = effect.Value; if(!effect.Empty) s.Effect = effect.Value;
s.Brightness = General.Clamp(brightness.GetResult(s.Brightness), General.Map.FormatInterface.MinBrightness, General.Map.FormatInterface.MaxBrightness);
//mxd. Tag //mxd. Tag
tagsselector.ApplyTo(s, tagoffset++); tagsselector.ApplyTo(s, tagoffset++);

View file

@ -91,7 +91,8 @@
this.tabcomment = new System.Windows.Forms.TabPage(); this.tabcomment = new System.Windows.Forms.TabPage();
this.commenteditor = new CodeImp.DoomBuilder.Controls.CommentEditor(); this.commenteditor = new CodeImp.DoomBuilder.Controls.CommentEditor();
this.tabcustom = new System.Windows.Forms.TabPage(); this.tabcustom = new System.Windows.Forms.TabPage();
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl(); this.hidefixedfields = new System.Windows.Forms.CheckBox();
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl();
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.hint = new System.Windows.Forms.PictureBox(); this.hint = new System.Windows.Forms.PictureBox();
@ -878,10 +879,11 @@
this.commenteditor.Name = "commenteditor"; this.commenteditor.Name = "commenteditor";
this.commenteditor.Size = new System.Drawing.Size(621, 396); this.commenteditor.Size = new System.Drawing.Size(621, 396);
this.commenteditor.TabIndex = 0; this.commenteditor.TabIndex = 0;
// //
// tabcustom // tabcustom
// //
this.tabcustom.Controls.Add(this.fieldslist); this.tabcustom.Controls.Add(this.hidefixedfields);
this.tabcustom.Controls.Add(this.fieldslist);
this.tabcustom.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tabcustom.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabcustom.Location = new System.Drawing.Point(4, 22); this.tabcustom.Location = new System.Drawing.Point(4, 22);
this.tabcustom.Name = "tabcustom"; this.tabcustom.Name = "tabcustom";
@ -890,10 +892,21 @@
this.tabcustom.Text = "Custom"; this.tabcustom.Text = "Custom";
this.tabcustom.UseVisualStyleBackColor = true; this.tabcustom.UseVisualStyleBackColor = true;
this.tabcustom.MouseEnter += new System.EventHandler(this.tabcustom_MouseEnter); this.tabcustom.MouseEnter += new System.EventHandler(this.tabcustom_MouseEnter);
// //
// fieldslist // hidefixedfields
// //
this.fieldslist.AllowInsert = true; this.hidefixedfields.AutoSize = true;
this.hidefixedfields.Location = new System.Drawing.Point(10, 381);
this.hidefixedfields.Name = "hidefixedfields";
this.hidefixedfields.Size = new System.Drawing.Size(195, 17);
this.hidefixedfields.TabIndex = 2;
this.hidefixedfields.Text = "Show user-added custom fields only";
this.hidefixedfields.UseVisualStyleBackColor = true;
this.hidefixedfields.CheckedChanged += new System.EventHandler(this.hidefixedfields_CheckedChanged);
//
// fieldslist
//
this.fieldslist.AllowInsert = true;
this.fieldslist.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.fieldslist.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)));
@ -904,8 +917,9 @@
this.fieldslist.Name = "fieldslist"; this.fieldslist.Name = "fieldslist";
this.fieldslist.PropertyColumnVisible = true; this.fieldslist.PropertyColumnVisible = true;
this.fieldslist.PropertyColumnWidth = 150; this.fieldslist.PropertyColumnWidth = 150;
this.fieldslist.Size = new System.Drawing.Size(611, 389); this.fieldslist.ShowFixedFields = true;
this.fieldslist.TabIndex = 1; this.fieldslist.Size = new System.Drawing.Size(611, 368);
this.fieldslist.TabIndex = 1;
this.fieldslist.TypeColumnVisible = true; this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100; this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true; this.fieldslist.ValueColumnVisible = true;
@ -1006,7 +1020,8 @@
this.grouptag.ResumeLayout(false); this.grouptag.ResumeLayout(false);
this.tabcomment.ResumeLayout(false); this.tabcomment.ResumeLayout(false);
this.tabcustom.ResumeLayout(false); this.tabcustom.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit(); this.tabcustom.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -1082,5 +1097,6 @@
private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol; private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floatbobphase; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floatbobphase;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
} private System.Windows.Forms.CheckBox hidefixedfields;
}
} }

View file

@ -131,8 +131,11 @@ namespace CodeImp.DoomBuilder.Windows
// Fill universal fields list // Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.ThingFields); fieldslist.ListFixedFields(General.Map.Config.ThingFields);
// Thing height? //mxd. Show fixed fields?
posZ.Visible = General.Map.FormatInterface.HasThingHeight; hidefixedfields.Checked = !General.Settings.ReadSetting("customfieldsshowfixed", true);
// Thing height?
posZ.Visible = General.Map.FormatInterface.HasThingHeight;
zlabel.Visible = General.Map.FormatInterface.HasThingHeight; zlabel.Visible = General.Map.FormatInterface.HasThingHeight;
cbAbsoluteHeight.Visible = General.Map.FormatInterface.HasThingHeight; //mxd cbAbsoluteHeight.Visible = General.Map.FormatInterface.HasThingHeight; //mxd
@ -578,7 +581,8 @@ namespace CodeImp.DoomBuilder.Windows
{ {
location = this.Location; location = this.Location;
activetab = tabs.SelectedIndex; activetab = tabs.SelectedIndex;
} General.Settings.WriteSetting("customfieldsshowfixed", !hidefixedfields.Checked);
}
// Help // Help
private void ThingEditForm_HelpRequested(object sender, HelpEventArgs hlpevent) private void ThingEditForm_HelpRequested(object sender, HelpEventArgs hlpevent)
@ -867,7 +871,12 @@ namespace CodeImp.DoomBuilder.Windows
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
} }
#endregion private void hidefixedfields_CheckedChanged(object sender, EventArgs e)
{
fieldslist.ShowFixedFields = !hidefixedfields.Checked;
}
} #endregion
}
} }