| 91 | } |
| 92 | |
| 93 | void AddLocation(const PluginPath& path, bool setFocus = false) |
| 94 | { |
| 95 | const auto baseId = BaseRowIdForIndex(mPathCtrls.size()); |
| 96 | |
| 97 | auto rowSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL); |
| 98 | wxTextCtrl* text; |
| 99 | wxButton* remove; |
| 100 | wxButton* browse; |
| 101 | rowSizer->Add( |
| 102 | text = safenew wxTextCtrl(this, baseId, path), |
| 103 | 1, wxEXPAND | wxALL, 3 |
| 104 | ); |
| 105 | rowSizer->Add( |
| 106 | browse = safenew wxButton(this, baseId + 1, _("Browse...")), |
| 107 | 0, wxALL, 3 |
| 108 | ); |
| 109 | rowSizer->Add( |
| 110 | remove = safenew wxButton(this, baseId + 2, _("Remove")), |
| 111 | 0, wxALL, 3 |
| 112 | ); |
| 113 | text->Bind(wxEVT_TEXT, [this](wxCommandEvent& evt) |
| 114 | { |
| 115 | const auto index = IndexForId(evt.GetId()); |
| 116 | mPaths[index] = evt.GetString(); |
| 117 | evt.Skip(); |
| 118 | }); |
| 119 | |
| 120 | browse->Bind(wxEVT_BUTTON, &EffectsLocationPanel::OnBrowseClicked, this); |
| 121 | remove->Bind(wxEVT_BUTTON, &EffectsLocationPanel::OnRemoveClicked, this); |
| 122 | mPathCtrls.push_back(text); |
| 123 | mPaths.push_back(path); |
| 124 | |
| 125 | mRows->Add(rowSizer.release(), 0, wxEXPAND); |
| 126 | |
| 127 | mAddNewLocation->MoveAfterInTabOrder(remove); |
| 128 | |
| 129 | if(setFocus) |
| 130 | text->SetFocus(); |
| 131 | |
| 132 | wxPostEvent(this, wxCommandEvent(EVT_PLUGIN_LOCATIONS_CHANGED)); |
| 133 | } |
| 134 | |
| 135 | void AddLocations(const PluginPaths& paths) |
| 136 | { |
nothing calls this directly
no test coverage detected