public void MassEditPopups()
 {
     // Popup size relies on magic numbers. Multiline maxlength is also arbitrary.
     if (ImGui.BeginPopup("massEditMenuRegex"))
     {
         ImGui.Text("selection: FIELD: ((=|+|-|*|/) VALUE | ref ROW);");
         ImGui.Text("param PARAM: (id VALUE | name ROW | prop FIELD VALUE | propref FIELD ROW): FIELD: ((=|+|-|*|/) VALUE | ref ROW);");
         ImGui.InputTextMultiline("MEditRegexInput", ref _currentMEditRegexInput, 65536, new Vector2(1024, 256));
         if (ImGui.Selectable("Submit", false, ImGuiSelectableFlags.DontClosePopups))
         {
             MassEditResult r = MassParamEditRegex.PerformMassEdit(_currentMEditRegexInput, EditorActionManager, _selection.getActiveParam(), _selection.getSelectedRows());
             if (r.Type == MassEditResultType.SUCCESS)
             {
                 _lastMEditRegexInput    = _currentMEditRegexInput;
                 _currentMEditRegexInput = "";
             }
             _mEditRegexResult = r.Information;
         }
         ImGui.Text(_mEditRegexResult);
         ImGui.InputTextMultiline("MEditRegexOutput", ref _lastMEditRegexInput, 65536, new Vector2(1024, 256), ImGuiInputTextFlags.ReadOnly);
         ImGui.EndPopup();
     }
     else if (ImGui.BeginPopup("massEditMenuCSVExport"))
     {
         ImGui.InputTextMultiline("MEditOutput", ref _currentMEditCSVOutput, 65536, new Vector2(1024, 256), ImGuiInputTextFlags.ReadOnly);
         ImGui.EndPopup();
     }
     else if (ImGui.BeginPopup("massEditMenuCSVImport"))
     {
         ImGui.InputTextMultiline("MEditRegexInput", ref _currentMEditCSVInput, 256 * 65536, new Vector2(1024, 256));
         if (ImGui.Selectable("Submit", false, ImGuiSelectableFlags.DontClosePopups))
         {
             MassEditResult r = MassParamEditCSV.PerformMassEdit(_currentMEditCSVInput, EditorActionManager, _selection.getActiveParam());
             if (r.Type == MassEditResultType.SUCCESS)
             {
                 _lastMEditRegexInput    = _currentMEditRegexInput;
                 _currentMEditRegexInput = "";
             }
             _mEditCSVResult = r.Information;
         }
         ImGui.Text(_mEditCSVResult);
         ImGui.EndPopup();
     }
     else
     {
         _isMEditPopupOpen      = false;
         _currentMEditCSVOutput = "";
     }
 }
예제 #2
0
        public void MassEditPopups()
        {
            // Popup size relies on magic numbers. Multiline maxlength is also arbitrary.
            if (ImGui.BeginPopup("massEditMenuRegex"))
            {
                ImGui.Text("param PARAM: id VALUE: FIELD: = VALUE;");
                UIHints.AddImGuiHintButton("MassEditHint", ref UIHints.MassEditHint);
                ImGui.InputTextMultiline("MEditRegexInput", ref _currentMEditRegexInput, 65536, new Vector2(1024, ImGui.GetTextLineHeightWithSpacing() * 4));
                if (ImGui.BeginCombo("###", ""))
                {
                    string target = _currentMEditRegexInput.Split('\n').LastOrDefault();
                    foreach (string option in MassParamEditRegex.GetRegexAutocomplete(target, _activeView._selection.getActiveParam()))
                    {
                        if (ImGui.Selectable(target + option))
                        {
                            _currentMEditRegexInput = _currentMEditRegexInput + option;
                        }
                    }
                    ImGui.EndCombo();
                }

                if (ImGui.Selectable("Submit", false, ImGuiSelectableFlags.DontClosePopups))
                {
                    _activeView._selection.sortSelection();
                    MassEditResult r = MassParamEditRegex.PerformMassEdit(_currentMEditRegexInput, EditorActionManager, _activeView._selection.getActiveParam(), _activeView._selection.getSelectedRows());
                    if (r.Type == MassEditResultType.SUCCESS)
                    {
                        _lastMEditRegexInput    = _currentMEditRegexInput;
                        _currentMEditRegexInput = "";
                        TaskManager.Run("PB:RefreshDirtyCache", false, true, () => ParamBank.refreshParamDirtyCache());
                    }
                    _mEditRegexResult = r.Information;
                }
                ImGui.Text(_mEditRegexResult);
                ImGui.InputTextMultiline("MEditRegexOutput", ref _lastMEditRegexInput, 65536, new Vector2(1024, ImGui.GetTextLineHeightWithSpacing() * 4), ImGuiInputTextFlags.ReadOnly);
                ImGui.EndPopup();
            }
            else if (ImGui.BeginPopup("massEditMenuCSVExport"))
            {
                ImGui.InputTextMultiline("MEditOutput", ref _currentMEditCSVOutput, 65536, new Vector2(1024, ImGui.GetTextLineHeightWithSpacing() * 4), ImGuiInputTextFlags.ReadOnly);
                ImGui.EndPopup();
            }
            else if (ImGui.BeginPopup("massEditMenuSingleCSVExport"))
            {
                ImGui.Text(_currentMEditSingleCSVField);
                ImGui.InputTextMultiline("MEditOutput", ref _currentMEditCSVOutput, 65536, new Vector2(1024, ImGui.GetTextLineHeightWithSpacing() * 4), ImGuiInputTextFlags.ReadOnly);
                ImGui.EndPopup();
            }
            else if (ImGui.BeginPopup("massEditMenuCSVImport"))
            {
                ImGui.InputTextMultiline("MEditRegexInput", ref _currentMEditCSVInput, 256 * 65536, new Vector2(1024, ImGui.GetTextLineHeightWithSpacing() * 4));
                ImGui.Checkbox("Append new rows instead of ID based insertion (this will create out-of-order IDs)", ref _mEditCSVAppendOnly);
                if (_mEditCSVAppendOnly)
                {
                    ImGui.Checkbox("Replace existing rows instead of updating them (they will be moved to the end)", ref _mEditCSVReplaceRows);
                }
                if (ImGui.Selectable("Submit", false, ImGuiSelectableFlags.DontClosePopups))
                {
                    MassEditResult r = MassParamEditCSV.PerformMassEdit(_currentMEditCSVInput, EditorActionManager, _activeView._selection.getActiveParam(), _mEditCSVAppendOnly, _mEditCSVAppendOnly && _mEditCSVReplaceRows);
                    if (r.Type == MassEditResultType.SUCCESS)
                    {
                        TaskManager.Run("PB:RefreshDirtyCache", false, true, () => ParamBank.refreshParamDirtyCache());
                    }
                    _mEditCSVResult = r.Information;
                }
                ImGui.Text(_mEditCSVResult);
                ImGui.EndPopup();
            }
            else if (ImGui.BeginPopup("massEditMenuSingleCSVImport"))
            {
                ImGui.Text(_currentMEditSingleCSVField);
                ImGui.Checkbox("Space separator", ref _currentMEditSingleCSVSpaces);
                ImGui.InputTextMultiline("MEditRegexInput", ref _currentMEditCSVInput, 256 * 65536, new Vector2(1024, ImGui.GetTextLineHeightWithSpacing() * 4));
                if (ImGui.Selectable("Submit", false, ImGuiSelectableFlags.DontClosePopups))
                {
                    MassEditResult r = MassParamEditCSV.PerformSingleMassEdit(_currentMEditCSVInput, EditorActionManager, _activeView._selection.getActiveParam(), _currentMEditSingleCSVField, _currentMEditSingleCSVSpaces);
                    _mEditCSVResult = r.Information;
                }
                ImGui.Text(_mEditCSVResult);
                ImGui.EndPopup();
            }
            else
            {
                _isMEditPopupOpen      = false;
                _currentMEditCSVOutput = "";
            }
        }
 public void MassEditPopups()
 {
     // Popup size relies on magic numbers. Multiline maxlength is also arbitrary.
     if (ImGui.BeginPopup("massEditMenuRegex"))
     {
         ImGui.Text("param PARAM: id VALUE: FIELD: = VALUE;");
         UIHints.AddImGuiHintButton("MassEditHint", ref UIHints.MassEditHint);
         ImGui.InputTextMultiline("MEditRegexInput", ref _currentMEditRegexInput, 65536, new Vector2(1024, 256));
         if (ImGui.Selectable("Submit", false, ImGuiSelectableFlags.DontClosePopups))
         {
             MassEditResult r = MassParamEditRegex.PerformMassEdit(_currentMEditRegexInput, EditorActionManager, _activeView._selection.getActiveParam(), _activeView._selection.getSelectedRows());
             if (r.Type == MassEditResultType.SUCCESS)
             {
                 _lastMEditRegexInput    = _currentMEditRegexInput;
                 _currentMEditRegexInput = "";
             }
             _mEditRegexResult = r.Information;
         }
         ImGui.Text(_mEditRegexResult);
         ImGui.InputTextMultiline("MEditRegexOutput", ref _lastMEditRegexInput, 65536, new Vector2(1024, 256), ImGuiInputTextFlags.ReadOnly);
         ImGui.EndPopup();
     }
     else if (ImGui.BeginPopup("massEditMenuCSVExport"))
     {
         ImGui.InputTextMultiline("MEditOutput", ref _currentMEditCSVOutput, 65536, new Vector2(1024, 256), ImGuiInputTextFlags.ReadOnly);
         ImGui.EndPopup();
     }
     else if (ImGui.BeginPopup("massEditMenuSingleCSVExport"))
     {
         ImGui.Text(_currentMEditSingleCSVField);
         ImGui.InputTextMultiline("MEditOutput", ref _currentMEditCSVOutput, 65536, new Vector2(1024, 256), ImGuiInputTextFlags.ReadOnly);
         ImGui.EndPopup();
     }
     else if (ImGui.BeginPopup("massEditMenuCSVImport"))
     {
         ImGui.InputTextMultiline("MEditRegexInput", ref _currentMEditCSVInput, 256 * 65536, new Vector2(1024, 256));
         if (ImGui.Selectable("Submit", false, ImGuiSelectableFlags.DontClosePopups))
         {
             MassEditResult r = MassParamEditCSV.PerformMassEdit(_currentMEditCSVInput, EditorActionManager, _activeView._selection.getActiveParam());
             _mEditCSVResult = r.Information;
         }
         ImGui.Text(_mEditCSVResult);
         ImGui.EndPopup();
     }
     else if (ImGui.BeginPopup("massEditMenuSingleCSVImport"))
     {
         ImGui.Text(_currentMEditSingleCSVField);
         ImGui.InputTextMultiline("MEditRegexInput", ref _currentMEditCSVInput, 256 * 65536, new Vector2(1024, 256));
         if (ImGui.Selectable("Submit", false, ImGuiSelectableFlags.DontClosePopups))
         {
             MassEditResult r = MassParamEditCSV.PerformSingleMassEdit(_currentMEditCSVInput, EditorActionManager, _activeView._selection.getActiveParam(), _currentMEditSingleCSVField, false);
             _mEditCSVResult = r.Information;
         }
         ImGui.Text(_mEditCSVResult);
         ImGui.EndPopup();
     }
     else
     {
         _isMEditPopupOpen      = false;
         _currentMEditCSVOutput = "";
     }
 }