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 bool autoinsertuserprefix;
private Dictionary<string, UniversalType> uifields;//mxd
#endregion
private bool showfixedfields = true; //mxd
#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 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 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 ValueColumnVisible { get { return fieldvalue.Visible; } set { fieldvalue.Visible = value; UpdateValueColumn(); UpdateBrowseButton(); } }
#endregion
public bool ShowFixedFields { get { return showfixedfields; } set { showfixedfields = value; UpdateFixedFieldsVisibility(); } } //mxd
#region ================== Constructor
#endregion
// Constructor
public FieldsEditorControl()
#region ================== Constructor
// Constructor
public FieldsEditorControl()
{
InitializeComponent();
autoinsertuserprefix = true;
@ -96,7 +98,7 @@ namespace CodeImp.DoomBuilder.Controls
// Keep element name
this.elementname = elementname;
//mxd. get proper UIFields
//mxd. Get proper UIFields
uifields = General.Map.FormatInterface.UIFields[General.Map.FormatInterface.GetElementType(elementname)];
// Make types list
@ -639,11 +641,18 @@ namespace CodeImp.DoomBuilder.Controls
// Delete all rows that must be deleted
for(int i = fieldslist.Rows.Count - 1; i >= 0; i--)
{
if(fieldslist.Rows[i].ReadOnly)
try { fieldslist.Rows.RemoveAt(i); } catch(Exception) { }
else
fieldslist.Rows[i].Visible = true;
}
if (fieldslist.Rows[i].ReadOnly)
{
try { fieldslist.Rows.RemoveAt(i); } catch { }
}
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
SetupNewRowStyle();
@ -831,7 +840,17 @@ namespace CodeImp.DoomBuilder.Controls
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)
{
foreach(int tag in newtags) tags.Add(tag);
return;
tags.AddRange(newtags);
return;
}
for(int i = 0; i < newtags.Count; i++)
@ -137,7 +137,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
else if(i >= tags.Count)
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
@ -161,14 +168,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private IEnumerable<int> GetResultTags(int[] oldtags, int offset)
{
Dictionary<int, bool> newtags = new Dictionary<int, bool>();
for(int i = 0; i < tags.Count; i++)
HashSet<int> newtags = new HashSet<int>();
for (int i = 0; i < tags.Count; 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)
{
int tag;
@ -179,13 +186,13 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
else
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);
return newtags.Keys;
}
if (newtags.Count == 0) newtags.Add(0);
return newtags;
}
#endregion

View file

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

View file

@ -679,7 +679,6 @@ namespace CodeImp.DoomBuilder.Windows
// Effects
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
tagsselector.ApplyTo(s, tagoffset++);

View file

@ -91,7 +91,8 @@
this.tabcomment = new System.Windows.Forms.TabPage();
this.commenteditor = new CodeImp.DoomBuilder.Controls.CommentEditor();
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.apply = new System.Windows.Forms.Button();
this.hint = new System.Windows.Forms.PictureBox();
@ -878,10 +879,11 @@
this.commenteditor.Name = "commenteditor";
this.commenteditor.Size = new System.Drawing.Size(621, 396);
this.commenteditor.TabIndex = 0;
//
// tabcustom
//
this.tabcustom.Controls.Add(this.fieldslist);
//
// tabcustom
//
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.Location = new System.Drawing.Point(4, 22);
this.tabcustom.Name = "tabcustom";
@ -890,10 +892,21 @@
this.tabcustom.Text = "Custom";
this.tabcustom.UseVisualStyleBackColor = true;
this.tabcustom.MouseEnter += new System.EventHandler(this.tabcustom_MouseEnter);
//
// fieldslist
//
this.fieldslist.AllowInsert = true;
//
// hidefixedfields
//
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)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
@ -904,8 +917,9 @@
this.fieldslist.Name = "fieldslist";
this.fieldslist.PropertyColumnVisible = true;
this.fieldslist.PropertyColumnWidth = 150;
this.fieldslist.Size = new System.Drawing.Size(611, 389);
this.fieldslist.TabIndex = 1;
this.fieldslist.ShowFixedFields = true;
this.fieldslist.Size = new System.Drawing.Size(611, 368);
this.fieldslist.TabIndex = 1;
this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true;
@ -1006,7 +1020,8 @@
this.grouptag.ResumeLayout(false);
this.tabcomment.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.PerformLayout();
@ -1082,5 +1097,6 @@
private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floatbobphase;
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
fieldslist.ListFixedFields(General.Map.Config.ThingFields);
// Thing height?
posZ.Visible = General.Map.FormatInterface.HasThingHeight;
//mxd. Show fixed fields?
hidefixedfields.Checked = !General.Settings.ReadSetting("customfieldsshowfixed", true);
// Thing height?
posZ.Visible = General.Map.FormatInterface.HasThingHeight;
zlabel.Visible = General.Map.FormatInterface.HasThingHeight;
cbAbsoluteHeight.Visible = General.Map.FormatInterface.HasThingHeight; //mxd
@ -578,7 +581,8 @@ namespace CodeImp.DoomBuilder.Windows
{
location = this.Location;
activetab = tabs.SelectedIndex;
}
General.Settings.WriteSetting("customfieldsshowfixed", !hidefixedfields.Checked);
}
// Help
private void ThingEditForm_HelpRequested(object sender, HelpEventArgs hlpevent)
@ -867,7 +871,12 @@ namespace CodeImp.DoomBuilder.Windows
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
#endregion
private void hidefixedfields_CheckedChanged(object sender, EventArgs e)
{
fieldslist.ShowFixedFields = !hidefixedfields.Checked;
}
}
#endregion
}
}