//mxd private void ValidateFilter(ListViewItem item, ThingsFilter f) { int imageindex = (f.IsValid() ? -1 : 0); if (item.ImageIndex != imageindex) { item.ImageIndex = imageindex; listfilters.Invalidate(); } }
// Constructor public ThingsFiltersForm() { settingup = true; // Initialize InitializeComponent(); // Fill types list List <ThingTypeInfo> thingtypes = new List <ThingTypeInfo>(General.Map.Data.ThingTypes); INumberedTitle[] typeitems = new INumberedTitle[thingtypes.Count]; for (int i = 0; i < thingtypes.Count; i++) { typeitems[i] = thingtypes[i]; } filtertype.AddInfo(typeitems); // Fill the categories combobox filtercategory.Items.Add("(any category)"); //mxd. Add ThingCategories with subcategories AddThingFilterCategories(General.Map.Data.ThingCategories, string.Empty); // Fill actions list filteraction.GeneralizedCategories = General.Map.Config.GenActionCategories; filteraction.AddInfo(General.Map.Config.SortedLinedefActions.ToArray()); // Initialize custom fields editor if (General.Map.FormatInterface.HasCustomFields) //mxd { fieldslist.ListNoFixedFields(); fieldslist.Setup("thing"); } // Fill checkboxes list foreach (KeyValuePair <string, string> flag in General.Map.Config.ThingFlags) { CheckBox box = filterfields.Add(flag.Value, flag.Key); box.ThreeState = true; box.CheckStateChanged += filterfield_Check; } // Fill list of filters foreach (ThingsFilter f in General.Map.ConfigSettings.ThingsFilters) { // Make a copy (we don't want to modify the filters until OK is clicked) ThingsFilter nf = new ThingsFilter(f); // Make item in list ListViewItem item = new ListViewItem(nf.Name); item.Tag = nf; item.ImageIndex = (nf.IsValid() ? -1 : 0); //mxd listfilters.Items.Add(item); // Select item if this is the current filter if (General.Map.ThingsFilter == f) { item.Selected = true; } } // Sort the list listfilters.Sort(); // Map format specific fields filterzheight.Visible = General.Map.FormatInterface.HasThingHeight; labelzheight.Visible = General.Map.FormatInterface.HasThingHeight; argumentspanel.Visible = General.Map.FormatInterface.HasActionArgs; labeltag.Visible = General.Map.FormatInterface.HasThingTag; filtertag.Visible = General.Map.FormatInterface.HasThingTag; if (!General.Map.FormatInterface.HasCustomFields) { tabs.TabPages.Remove(tabcustom); } if (!General.Map.FormatInterface.HasThingAction && !General.Map.FormatInterface.HasThingTag) { tabs.TabPages.Remove(tabaction); } // Done settingup = false; }