public void OnGUI(string[] initcmd)
        {
            if (!_isMEditPopupOpen && !_isShortcutPopupOpen && !_isSearchBarActive)// Are shortcuts active? Presently just checks for massEdit popup.
            {
                // Keyboard shortcuts
                if (EditorActionManager.CanUndo() && InputTracker.GetControlShortcut(Key.Z))
                {
                    EditorActionManager.UndoAction();
                }
                if (EditorActionManager.CanRedo() && InputTracker.GetControlShortcut(Key.Y))
                {
                    EditorActionManager.RedoAction();
                }
                if (InputTracker.GetControlShortcut(Key.C))
                {
                    _clipboardParam = _selection.getActiveParam();
                    _clipboardRows.Clear();
                    foreach (PARAM.Row r in _selection.getSelectedRows())
                    {
                        _clipboardRows.Add(new PARAM.Row(r));// make a clone
                    }
                }
                if (_selection.paramSelectionExists() && _clipboardParam == _selection.getActiveParam() && InputTracker.GetControlShortcut(Key.V))
                {
                    ImGui.OpenPopup("ctrlVPopup");
                }
                if (InputTracker.GetControlShortcut(Key.D))
                {
                    if (_selection.rowSelectionExists())
                    {
                        var act = new AddParamsAction(ParamBank.Params[_selection.getActiveParam()], _selection.getActiveParam(), new List <PARAM.Row>()
                        {
                            _selection.getActiveRow()
                        }, true);
                        EditorActionManager.ExecuteAction(act);
                    }
                }
                if (InputTracker.GetKeyDown(Key.Delete))
                {
                    if (_selection.rowSelectionExists())
                    {
                        var act = new DeleteParamsAction(ParamBank.Params[_selection.getActiveParam()], new List <PARAM.Row>()
                        {
                            _selection.getActiveRow()
                        });
                        EditorActionManager.ExecuteAction(act);
                        _selection.SetActiveRow(null);
                    }
                }
            }

            ShortcutPopups();

            if (ParamBank.Params == null)
            {
                if (ParamBank.IsLoading)
                {
                    ImGui.Text("Loading...");
                }
                return;
            }

            bool doFocus = false;

            // Parse select commands
            if (initcmd != null && initcmd[0] == "select")
            {
                if (initcmd.Length > 1 && ParamBank.Params.ContainsKey(initcmd[1]))
                {
                    doFocus = true;
                    _selection.setActiveParam(initcmd[1]);
                    if (initcmd.Length > 2)
                    {
                        _selection.SetActiveRow(null);
                        var p = ParamBank.Params[_selection.getActiveParam()];
                        int id;
                        var parsed = int.TryParse(initcmd[2], out id);
                        if (parsed)
                        {
                            var r = p.Rows.FirstOrDefault(r => r.ID == id);
                            if (r != null)
                            {
                                _selection.SetActiveRow(r);
                            }
                        }
                    }
                }
            }

            ImGui.Columns(3);
            ImGui.BeginChild("params");
            foreach (var param in ParamBank.Params)
            {
                if (ImGui.Selectable(param.Key, param.Key == _selection.getActiveParam()))
                {
                    _selection.setActiveParam(param.Key);
                    //_selection.SetActiveRow(null);
                }
                if (doFocus && param.Key == _selection.getActiveParam())
                {
                    ImGui.SetScrollHereY();
                }
            }
            ImGui.EndChild();
            ImGui.NextColumn();
            if (!_selection.paramSelectionExists())
            {
                ImGui.BeginChild("rowsNONE");
                ImGui.Text("Select a param to see rows");
            }
            else
            {
                if (FeatureFlags.EnableEnhancedParamEditor)
                {
                    ImGui.Text("id VALUE | name ROW | prop FIELD VALUE | propref FIELD ROW");
                    ImGui.InputText("Search rows...", ref _selection.getCurrentSearchString(), 256);
                    if (ImGui.IsItemActive())
                    {
                        _isSearchBarActive = true;
                    }
                    else
                    {
                        _isSearchBarActive = false;
                    }
                }
                ImGui.BeginChild("rows" + _selection.getActiveParam());
                IParamDecorator decorator = null;
                if (_decorators.ContainsKey(_selection.getActiveParam()))
                {
                    decorator = _decorators[_selection.getActiveParam()];
                }

                PARAM            para = ParamBank.Params[_selection.getActiveParam()];
                List <PARAM.Row> p;
                if (FeatureFlags.EnableEnhancedParamEditor)
                {
                    Match m = new Regex(MassParamEditRegex.rowfilterRx).Match(_selection.getCurrentSearchString());
                    if (!m.Success)
                    {
                        p = para.Rows;
                    }
                    else
                    {
                        p = MassParamEditRegex.GetMatchingParamRows(para, m, true, true);
                    }
                }
                else
                {
                    p = para.Rows;
                }

                foreach (var r in p)
                {
                    if (ImGui.Selectable($@"{r.ID} {r.Name}", _selection.getSelectedRows().Contains(r)))
                    {
                        if (InputTracker.GetKey(Key.LControl))
                        {
                            _selection.toggleRowInSelection(r);
                        }
                        else
                        {
                            if (InputTracker.GetKey(Key.LShift))
                            {
                                _selection.cleanSelectedRows();
                                int start = p.IndexOf(_selection.getActiveRow());
                                int end   = p.IndexOf(r);
                                if (start != end)
                                {
                                    foreach (var r2 in p.GetRange(start < end ? start : end, Math.Abs(end - start)))
                                    {
                                        _selection.addRowToSelection(r2);
                                    }
                                }
                                _selection.addRowToSelection(r);
                            }
                            else
                            {
                                _selection.SetActiveRow(r);
                            }
                        }
                    }
                    if (decorator != null)
                    {
                        decorator.DecorateContextMenu(r);
                        decorator.DecorateParam(r);
                    }
                    if (doFocus && _selection.getActiveRow() == r)
                    {
                        ImGui.SetScrollHereY();
                    }
                }
            }
            ImGui.EndChild();
            ImGui.NextColumn();
            if (!_selection.rowSelectionExists())
            {
                ImGui.BeginChild("columnsNONE");
                ImGui.Text("Select a row to see properties");
            }
            else
            {
                ImGui.BeginChild("columns" + _selection.getActiveParam());
                _propEditor.PropEditorParamRow(_selection.getActiveRow());
            }
            ImGui.EndChild();
        }
        public override void DrawEditorMenu()
        {
            bool openMEditRegex     = false;
            bool openMEditCSVExport = false;
            bool openMEditCSVImport = false;

            // Menu Options
            if (ImGui.BeginMenu("Edit"))
            {
                if (ImGui.MenuItem("Undo", "CTRL+Z", false, EditorActionManager.CanUndo()))
                {
                    EditorActionManager.UndoAction();
                }
                if (ImGui.MenuItem("Redo", "Ctrl+Y", false, EditorActionManager.CanRedo()))
                {
                    EditorActionManager.RedoAction();
                }
                if (ImGui.MenuItem("Delete", "Delete", false, _selection.rowSelectionExists()))
                {
                    if (_selection.rowSelectionExists())
                    {
                        var act = new DeleteParamsAction(ParamBank.Params[_selection.getActiveParam()], new List <PARAM.Row>()
                        {
                            _selection.getActiveRow()
                        });
                        EditorActionManager.ExecuteAction(act);
                        _selection.SetActiveRow(null);
                    }
                }
                if (ImGui.MenuItem("Duplicate", "Ctrl+D", false, _selection.rowSelectionExists()))
                {
                    if (_selection.rowSelectionExists())
                    {
                        var act = new AddParamsAction(ParamBank.Params[_selection.getActiveParam()], _selection.getActiveParam(), new List <PARAM.Row>()
                        {
                            _selection.getActiveRow()
                        }, true);
                        EditorActionManager.ExecuteAction(act);
                    }
                }
                if (FeatureFlags.EnableEnhancedParamEditor)
                {
                    if (ImGui.MenuItem("Mass Edit", null, false, true))
                    {
                        openMEditRegex = true;
                    }
                    if (ImGui.MenuItem("Export CSV (Slow!)", null, false, _selection.paramSelectionExists()))
                    {
                        openMEditCSVExport = true;
                    }
                    if (ImGui.MenuItem("Import CSV", null, false, _selection.paramSelectionExists()))
                    {
                        openMEditCSVImport = true;
                    }
                }
                ImGui.EndMenu();
            }
            // Menu Popups -- imgui scoping
            if (openMEditRegex)
            {
                ImGui.OpenPopup("massEditMenuRegex");
                _isMEditPopupOpen = true;
            }
            if (openMEditCSVExport)
            {
                if (_selection.paramSelectionExists())
                {
                    _currentMEditCSVOutput = MassParamEditCSV.GenerateCSV(ParamBank.Params[_selection.getActiveParam()]);
                }
                ImGui.OpenPopup("massEditMenuCSVExport");
                _isMEditPopupOpen = true;
            }
            if (openMEditCSVImport)
            {
                ImGui.OpenPopup("massEditMenuCSVImport");
                _isMEditPopupOpen = true;
            }
            MassEditPopups();
        }