reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit d4f3671b2cd82b31e784f2a00229ce7deadbcf70
parent 83013e326241985a12b4c150b6afbaf2098969d5
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu, 17 Mar 2016 23:31:34 -0400

don't toggle actions applied to the whole selection

Diffstat:
Msrc/browser.cpp | 22+++++++++++-----------
Msrc/browser.hpp | 8++++----
2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/browser.cpp b/src/browser.cpp @@ -124,19 +124,19 @@ void Browser::onCommand(const int id) installLatest(m_currentIndex); break; case ACTION_LATEST_ALL: - selectionDo(bind(&Browser::installLatest, this, arg::_1)); + selectionDo(bind(&Browser::installLatest, this, arg::_1, false)); break; case ACTION_REINSTALL: reinstall(m_currentIndex); break; case ACTION_REINSTALL_ALL: - selectionDo(bind(&Browser::reinstall, this, arg::_1)); + selectionDo(bind(&Browser::reinstall, this, arg::_1, false)); break; case ACTION_UNINSTALL: uninstall(m_currentIndex); break; case ACTION_UNINSTALL_ALL: - selectionDo(bind(&Browser::uninstall, this, arg::_1)); + selectionDo(bind(&Browser::uninstall, this, arg::_1, false)); break; case ACTION_HISTORY: history(m_currentIndex); @@ -512,20 +512,20 @@ void Browser::about(const int index) const m_reapack->about(getValue(RemoteColumn, *entry), handle()); } -void Browser::installLatest(const int index) +void Browser::installLatest(const int index, const bool toggle) { const Entry *entry = getEntry(index); if(entry && entry->latest && entry->latest != entry->current) - setAction(index, entry->latest); + setAction(index, entry->latest, toggle); } -void Browser::reinstall(const int index) +void Browser::reinstall(const int index, const bool toggle) { const Entry *entry = getEntry(index); if(entry && entry->current) - setAction(index, entry->current); + setAction(index, entry->current, toggle); } void Browser::installVersion(const int index, const size_t verIndex) @@ -544,12 +544,12 @@ void Browser::installVersion(const int index, const size_t verIndex) setAction(index, target); } -void Browser::uninstall(const int index) +void Browser::uninstall(const int index, const bool toggle) { const Entry *entry = getEntry(index); if(entry && entry->test(InstalledFlag)) - setAction(index, nullptr); + setAction(index, nullptr, toggle); } void Browser::resetAction(const int index) @@ -581,11 +581,11 @@ bool Browser::isTarget(const Entry *entry, const Version *target) const return it->second == target; } -void Browser::setAction(const int index, const Version *target) +void Browser::setAction(const int index, const Version *target, const bool toggle) { const Entry *entry = getEntry(index); - if(isTarget(entry, target)) + if(toggle && isTarget(entry, target)) resetAction(index); else if(entry) { m_actions[entry] = target; diff --git a/src/browser.hpp b/src/browser.hpp @@ -95,16 +95,16 @@ private: void selectionMenu(); bool hasAction(const Entry *e) const { return m_actions.count(e) > 0; } bool isTarget(const Entry *, const Version *) const; - void setAction(const int index, const Version *); + void setAction(const int index, const Version *, bool toggle = true); void selectionDo(const std::function<void (int)> &); Display getDisplay() const; bool confirm() const; void apply(); - void installLatest(int index); - void reinstall(int index); + void installLatest(int index, bool toggle = true); + void reinstall(int index, bool toggle = true); void installVersion(int index, size_t verIndex); - void uninstall(int index); + void uninstall(int index, bool toggle = true); void resetAction(int index); void history(int index) const; void about(int index) const;