public override void DrawEditorMenu()
 {
     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, _activeParam != null && _activeRow != null))
         {
             if (_activeParam != null && _activeRow != null)
             {
                 var act = new DeleteParamsAction(ParamBank.Params[_activeParam], new List <PARAM.Row>()
                 {
                     _activeRow
                 });
                 EditorActionManager.ExecuteAction(act);
                 _activeRow = null;
             }
         }
         if (ImGui.MenuItem("Duplicate", "Ctrl+D", false, _activeParam != null && _activeRow != null))
         {
             if (_activeParam != null && _activeRow != null)
             {
                 var act = new CloneParamsAction(ParamBank.Params[_activeParam], _activeParam, new List <PARAM.Row>()
                 {
                     _activeRow
                 }, true);
                 EditorActionManager.ExecuteAction(act);
             }
         }
         ImGui.EndMenu();
     }
 }
        public void OnGUI(string[] initcmd)
        {
            // Keyboard shortcuts
            if (EditorActionManager.CanUndo() && InputTracker.GetControlShortcut(Key.Z))
            {
                EditorActionManager.UndoAction();
            }
            if (EditorActionManager.CanRedo() && InputTracker.GetControlShortcut(Key.Y))
            {
                EditorActionManager.RedoAction();
            }
            if (InputTracker.GetControlShortcut(Key.D))
            {
                if (_activeParam != null && _activeRow != null)
                {
                    var act = new CloneParamsAction(ParamBank.Params[_activeParam], _activeParam, new List <PARAM.Row>()
                    {
                        _activeRow
                    }, true);
                    EditorActionManager.ExecuteAction(act);
                }
            }
            if (InputTracker.GetKeyDown(Key.Delete))
            {
                if (_activeParam != null && _activeRow != null)
                {
                    var act = new DeleteParamsAction(ParamBank.Params[_activeParam], new List <PARAM.Row>()
                    {
                        _activeRow
                    });
                    EditorActionManager.ExecuteAction(act);
                    _activeRow = null;
                }
            }

            if (ParamBank.Params == null)
            {
                return;
            }

            bool doFocus = false;

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

            ImGui.Columns(3);
            ImGui.BeginChild("params");
            foreach (var param in ParamBank.Params)
            {
                if (ImGui.Selectable(param.Key, param.Key == _activeParam))
                {
                    _activeParam = param.Key;
                    _activeRow   = null;
                }
                if (doFocus && param.Key == _activeParam)
                {
                    ImGui.SetScrollHereY();
                }
            }
            ImGui.EndChild();
            ImGui.NextColumn();
            ImGui.BeginChild("rows");
            if (_activeParam == null)
            {
                ImGui.Text("Select a param to see rows");
            }
            else
            {
                IParamDecorator decorator = null;
                if (_decorators.ContainsKey(_activeParam))
                {
                    decorator = _decorators[_activeParam];
                }
                var p = ParamBank.Params[_activeParam];
                foreach (var r in p.Rows)
                {
                    if (ImGui.Selectable($@"{r.ID} {r.Name}", _activeRow == r))
                    {
                        _activeRow = r;
                    }
                    if (decorator != null)
                    {
                        decorator.DecorateContextMenu(r);
                        decorator.DecorateParam(r);
                    }
                    if (doFocus && _activeRow == r)
                    {
                        ImGui.SetScrollHereY();
                    }
                }
            }
            ImGui.EndChild();
            ImGui.NextColumn();
            ImGui.BeginChild("columns");
            if (_activeRow == null)
            {
                ImGui.Text("Select a row to see properties");
            }
            else
            {
                _propEditor.PropEditorParamRow(_activeRow);
            }
            ImGui.EndChild();
        }