private void PropEditorPropRow(object oldval, object vanillaval, ref int id, string internalName, FieldMetaData cellMeta, Type propType, PropertyInfo proprow, PARAM.Cell nullableCell, PARAM.Row nullableRow, Regex propSearchRx)
        {
            List <string> RefTypes   = cellMeta == null ? null : cellMeta.RefTypes;
            string        VirtualRef = cellMeta == null ? null : cellMeta.VirtualRef;
            ParamEnum     Enum       = cellMeta == null ? null : cellMeta.EnumType;
            string        Wiki       = cellMeta == null ? null : cellMeta.Wiki;
            bool          IsBool     = cellMeta == null ? false : cellMeta.IsBool;
            string        AltName    = cellMeta == null ? null : cellMeta.AltName;

            if (propSearchRx != null)
            {
                if (!propSearchRx.IsMatch(internalName.ToLower()) && !(AltName != null && propSearchRx.IsMatch(AltName.ToLower())))
                {
                    return;
                }
            }

            object newval = null;

            ImGui.PushID(id);
            ImGui.AlignTextToFramePadding();
            PropertyRowName(ref internalName, cellMeta);
            PropertyRowNameContextMenu(internalName, cellMeta);
            if (Wiki != null)
            {
                if (UIHints.AddImGuiHintButton(internalName, ref Wiki))
                {
                    cellMeta.Wiki = Wiki;
                }
            }

            ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1.0f, 1.0f, 0.0f, 1.0f));
            if (ParamEditorScreen.HideReferenceRowsPreference == false && RefTypes != null)
            {
                ImGui.TextUnformatted($@"  <{String.Join(',', RefTypes)}>");
            }
            if (ParamEditorScreen.HideEnumsPreference == false && Enum != null)
            {
                ImGui.TextUnformatted($@"  {Enum.name}");
            }
            ImGui.PopStyleColor();

            //PropertyRowMetaDefContextMenu();
            ImGui.NextColumn();
            ImGui.SetNextItemWidth(-1);
            bool changed = false;

            if (vanillaval != null && !oldval.Equals(vanillaval))
            {
                ImGui.PushStyleColor(ImGuiCol.FrameBg, new Vector4(0.2f, 0.22f, 0.2f, 1f));
            }

            bool matchDefault = nullableCell != null && nullableCell.Def.Default.Equals(oldval);

            if (matchDefault)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0.75f, 0.75f, 0.75f, 1.0f));
            }
            else if ((ParamEditorScreen.HideReferenceRowsPreference == false && RefTypes != null) || (ParamEditorScreen.HideEnumsPreference == false && Enum != null) || VirtualRef != null)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1.0f, 0.5f, 1.0f, 1.0f));
            }

            changed = PropertyRow(propType, oldval, out newval, IsBool);
            bool committed = ImGui.IsItemDeactivatedAfterEdit();

            if ((ParamEditorScreen.HideReferenceRowsPreference == false && RefTypes != null) || (ParamEditorScreen.HideEnumsPreference == false && Enum != null) || VirtualRef != null || matchDefault)
            {
                ImGui.PopStyleColor();
            }
            PropertyRowValueContextMenu(internalName, VirtualRef, oldval);

            if (ParamEditorScreen.HideReferenceRowsPreference == false && RefTypes != null)
            {
                PropertyRowRefs(RefTypes, oldval);
            }
            if (ParamEditorScreen.HideEnumsPreference == false && Enum != null)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1.0f, 0.5f, 0.5f, 1.0f));
                ImGui.TextUnformatted(Enum.values.GetValueOrDefault(oldval.ToString(), "Not Enumerated"));
                ImGui.PopStyleColor();
            }
            if ((ParamEditorScreen.HideReferenceRowsPreference == false || ParamEditorScreen.HideEnumsPreference == false) && PropertyRowMetaValueContextMenu(oldval, ref newval, RefTypes, Enum))
            {
                changed   = true;
                committed = true;
            }

            UpdateProperty(proprow, nullableCell != null ? (object)nullableCell : nullableRow, newval, changed, committed);
            if (vanillaval != null && !oldval.Equals(vanillaval))
            {
                ImGui.PopStyleColor();
            }
            ImGui.NextColumn();
            ImGui.PopID();
            id++;
        }
 private void PropertyRowNameContextMenu(string originalName, FieldMetaData cellMeta)
 {
     if (ImGui.BeginPopupContextItem("rowName"))
     {
         if (ParamEditorScreen.ShowAltNamesPreference == true && ParamEditorScreen.AlwaysShowOriginalNamePreference == false)
         {
             ImGui.Text(originalName);
         }
         if (ImGui.Selectable("Search..."))
         {
             EditorCommandQueue.AddCommand($@"param/search/prop {originalName.Replace(" ", "\\s")} ");
         }
         if (ParamEditorScreen.EditorMode && cellMeta != null)
         {
             if (ImGui.BeginMenu("Add Reference"))
             {
                 foreach (string p in ParamBank.Params.Keys)
                 {
                     if (ImGui.Selectable(p))
                     {
                         if (cellMeta.RefTypes == null)
                         {
                             cellMeta.RefTypes = new List <string>();
                         }
                         cellMeta.RefTypes.Add(p);
                     }
                 }
                 ImGui.EndMenu();
             }
             if (cellMeta.RefTypes != null && ImGui.BeginMenu("Remove Reference"))
             {
                 foreach (string p in cellMeta.RefTypes)
                 {
                     if (ImGui.Selectable(p))
                     {
                         cellMeta.RefTypes.Remove(p);
                         if (cellMeta.RefTypes.Count == 0)
                         {
                             cellMeta.RefTypes = null;
                         }
                         break;
                     }
                 }
                 ImGui.EndMenu();
             }
             if (ImGui.Selectable(cellMeta.IsBool ? "Remove bool toggle" : "Add bool toggle"))
             {
                 cellMeta.IsBool = !cellMeta.IsBool;
             }
             if (cellMeta.Wiki == null && ImGui.Selectable("Add wiki..."))
             {
                 cellMeta.Wiki = "Empty wiki...";
             }
             if (cellMeta.Wiki != null && ImGui.Selectable("Remove wiki"))
             {
                 cellMeta.Wiki = null;
             }
         }
         ImGui.EndPopup();
     }
 }
 private void PropEditorPropCellRow(PARAM.Cell cell, PARAM.Cell vcell, ref int id, Regex propSearchRx)
 {
     PropEditorPropRow(cell.Value, vcell == null?null:vcell.Value, ref id, cell.Def.InternalName, FieldMetaData.Get(cell.Def), cell.Value.GetType(), cell.GetType().GetProperty("Value"), cell, null, propSearchRx);
 }