Skip to content

Commit

Permalink
Rename/Delete Menu Items (Function no tthere yet) (surge-synthesizer#…
Browse files Browse the repository at this point in the history
…5234)

So I started doing rename delete (surge-synthesizer#4391) and then realized
I can't do it until I sort out the patch db add-remove stuff
properly. But that patch db add remove stuff is more hairy
but I didn't want to lose this bit of ground work I did
so just a checkpoint merge.
  • Loading branch information
baconpaul authored Oct 11, 2021
1 parent 99b1f0b commit 3dbaa1f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ void SurgeGUIEditor::idle()
patchSelector->setAuthor(synth->storage.getPatch().author);
patchSelector->setComment(synth->storage.getPatch().comment);
patchSelector->setIsFavorite(isPatchFavorite());
patchSelector->setIsUser(isPatchUser());
patchSelector->setTags(synth->storage.getPatch().tags);
patchSelector->repaint();
}
Expand Down Expand Up @@ -1483,6 +1484,7 @@ void SurgeGUIEditor::openOrRecreateEditor()
patchSelector->setSkin(currentSkin, bitmapStore);
patchSelector->setLabel(synth->storage.getPatch().name);
patchSelector->setIsFavorite(isPatchFavorite());
patchSelector->setIsUser(isPatchUser());
patchSelector->setCategory(synth->storage.getPatch().category);
patchSelector->setIDs(synth->current_category_id, synth->patchid);
patchSelector->setAuthor(synth->storage.getPatch().author);
Expand Down Expand Up @@ -5735,3 +5737,13 @@ bool SurgeGUIEditor::isPatchFavorite()
}
return false;
}

bool SurgeGUIEditor::isPatchUser()
{
if (synth->patchid >= 0 && synth->patchid < synth->storage.patch_list.size())
{
auto p = synth->storage.patch_list[synth->patchid];
return !synth->storage.patch_category[p.category].isFactory;
}
return false;
}
1 change: 1 addition & 0 deletions src/surge-xt/gui/SurgeGUIEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener,
*/
void setPatchAsFavorite(bool b);
bool isPatchFavorite();
bool isPatchUser();

/*
* Modulation Client API
Expand Down
10 changes: 10 additions & 0 deletions src/surge-xt/gui/widgets/PatchSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,16 @@ void PatchSelector::showClassicMenu(bool single_category)
storage->patch_category[current_category].isFactory ? "Factory" : "User");
});

if (isUser)
{
contextMenu.addItem("Rename Patch", [this]() {
storage->reportError("Coming Soon", "Function Not Implemented Yet");
});
contextMenu.addItem("Delete Patch", [this]() {
storage->reportError("Coming Soon", "Function Not Implemented Yet");
});
}

#if HIDE_PATCH_BROWSER == false
contextMenu.addSeparator();

Expand Down
8 changes: 8 additions & 0 deletions src/surge-xt/gui/widgets/PatchSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ struct PatchSelector : public juce::Component,
isFavorite = b;
repaint();
}

bool isUser{false};
void setIsUser(bool b)
{
isUser = b;
repaint();
}

void setLabel(const std::string &l) { pname = l; }
void setCategory(std::string l)
{
Expand Down

0 comments on commit 3dbaa1f

Please sign in to comment.