upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -29,9 +29,7 @@ namespace juce
|
||||
|
||||
struct UndoManager::ActionSet
|
||||
{
|
||||
ActionSet (const String& transactionName)
|
||||
: name (transactionName),
|
||||
time (Time::getCurrentTime())
|
||||
ActionSet (const String& transactionName) : name (transactionName)
|
||||
{}
|
||||
|
||||
bool perform() const
|
||||
@ -64,7 +62,7 @@ struct UndoManager::ActionSet
|
||||
|
||||
OwnedArray<UndoableAction> actions;
|
||||
String name;
|
||||
Time time;
|
||||
Time time { Time::getCurrentTime() };
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
@ -117,9 +115,9 @@ bool UndoManager::perform (UndoableAction* newAction)
|
||||
{
|
||||
std::unique_ptr<UndoableAction> action (newAction);
|
||||
|
||||
if (reentrancyCheck)
|
||||
if (isPerformingUndoRedo())
|
||||
{
|
||||
jassertfalse; // don't call perform() recursively from the UndoableAction::perform()
|
||||
jassertfalse; // Don't call perform() recursively from the UndoableAction::perform()
|
||||
// or undo() methods, or else these actions will be discarded!
|
||||
return false;
|
||||
}
|
||||
@ -209,18 +207,18 @@ void UndoManager::dropOldTransactionsIfTooLarge()
|
||||
}
|
||||
}
|
||||
|
||||
void UndoManager::beginNewTransaction() noexcept
|
||||
void UndoManager::beginNewTransaction()
|
||||
{
|
||||
beginNewTransaction ({});
|
||||
}
|
||||
|
||||
void UndoManager::beginNewTransaction (const String& actionName) noexcept
|
||||
void UndoManager::beginNewTransaction (const String& actionName)
|
||||
{
|
||||
newTransaction = true;
|
||||
newTransactionName = actionName;
|
||||
}
|
||||
|
||||
void UndoManager::setCurrentTransactionName (const String& newName) noexcept
|
||||
void UndoManager::setCurrentTransactionName (const String& newName)
|
||||
{
|
||||
if (newTransaction)
|
||||
newTransactionName = newName;
|
||||
@ -228,7 +226,7 @@ void UndoManager::setCurrentTransactionName (const String& newName) noexcept
|
||||
action->name = newName;
|
||||
}
|
||||
|
||||
String UndoManager::getCurrentTransactionName() const noexcept
|
||||
String UndoManager::getCurrentTransactionName() const
|
||||
{
|
||||
if (auto* action = getCurrentSet())
|
||||
return action->name;
|
||||
@ -237,17 +235,19 @@ String UndoManager::getCurrentTransactionName() const noexcept
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
UndoManager::ActionSet* UndoManager::getCurrentSet() const noexcept { return transactions[nextIndex - 1]; }
|
||||
UndoManager::ActionSet* UndoManager::getNextSet() const noexcept { return transactions[nextIndex]; }
|
||||
UndoManager::ActionSet* UndoManager::getCurrentSet() const { return transactions[nextIndex - 1]; }
|
||||
UndoManager::ActionSet* UndoManager::getNextSet() const { return transactions[nextIndex]; }
|
||||
|
||||
bool UndoManager::canUndo() const noexcept { return getCurrentSet() != nullptr; }
|
||||
bool UndoManager::canRedo() const noexcept { return getNextSet() != nullptr; }
|
||||
bool UndoManager::isPerformingUndoRedo() const { return isInsideUndoRedoCall; }
|
||||
|
||||
bool UndoManager::canUndo() const { return getCurrentSet() != nullptr; }
|
||||
bool UndoManager::canRedo() const { return getNextSet() != nullptr; }
|
||||
|
||||
bool UndoManager::undo()
|
||||
{
|
||||
if (auto* s = getCurrentSet())
|
||||
{
|
||||
const ScopedValueSetter<bool> setter (reentrancyCheck, true);
|
||||
const ScopedValueSetter<bool> setter (isInsideUndoRedoCall, true);
|
||||
|
||||
if (s->undo())
|
||||
--nextIndex;
|
||||
@ -266,7 +266,7 @@ bool UndoManager::redo()
|
||||
{
|
||||
if (auto* s = getNextSet())
|
||||
{
|
||||
const ScopedValueSetter<bool> setter (reentrancyCheck, true);
|
||||
const ScopedValueSetter<bool> setter (isInsideUndoRedoCall, true);
|
||||
|
||||
if (s->perform())
|
||||
++nextIndex;
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
int minimumTransactionsToKeep = 30);
|
||||
|
||||
/** Destructor. */
|
||||
~UndoManager();
|
||||
~UndoManager() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Deletes all stored actions in the list. */
|
||||
@ -126,7 +126,7 @@ public:
|
||||
method are grouped together and undone/redone together by a single call to
|
||||
undo() or redo().
|
||||
*/
|
||||
void beginNewTransaction() noexcept;
|
||||
void beginNewTransaction();
|
||||
|
||||
/** Starts a new group of actions that together will be treated as a single transaction.
|
||||
|
||||
@ -137,7 +137,7 @@ public:
|
||||
@param actionName a description of the transaction that is about to be
|
||||
performed
|
||||
*/
|
||||
void beginNewTransaction (const String& actionName) noexcept;
|
||||
void beginNewTransaction (const String& actionName);
|
||||
|
||||
/** Changes the name stored for the current transaction.
|
||||
|
||||
@ -145,18 +145,18 @@ public:
|
||||
called, but this can be used to change that name without starting a new
|
||||
transaction.
|
||||
*/
|
||||
void setCurrentTransactionName (const String& newName) noexcept;
|
||||
void setCurrentTransactionName (const String& newName);
|
||||
|
||||
/** Returns the name of the current transaction.
|
||||
@see setCurrentTransactionName
|
||||
*/
|
||||
String getCurrentTransactionName() const noexcept;
|
||||
String getCurrentTransactionName() const;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns true if there's at least one action in the list to undo.
|
||||
@see getUndoDescription, undo, canRedo
|
||||
*/
|
||||
bool canUndo() const noexcept;
|
||||
bool canUndo() const;
|
||||
|
||||
/** Tries to roll-back the last transaction.
|
||||
@returns true if the transaction can be undone, and false if it fails, or
|
||||
@ -217,7 +217,7 @@ public:
|
||||
/** Returns true if there's at least one action in the list to redo.
|
||||
@see getRedoDescription, redo, canUndo
|
||||
*/
|
||||
bool canRedo() const noexcept;
|
||||
bool canRedo() const;
|
||||
|
||||
/** Tries to redo the last transaction that was undone.
|
||||
@returns true if the transaction can be redone, and false if it fails, or
|
||||
@ -243,16 +243,18 @@ public:
|
||||
*/
|
||||
Time getTimeOfRedoTransaction() const;
|
||||
|
||||
/** Returns true if the caller code is in the middle of an undo or redo action. */
|
||||
bool isPerformingUndoRedo() const;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
struct ActionSet;
|
||||
friend struct ContainerDeletePolicy<ActionSet>;
|
||||
OwnedArray<ActionSet> transactions, stashedFutureTransactions;
|
||||
String newTransactionName;
|
||||
int totalUnitsStored = 0, maxNumUnitsToKeep = 0, minimumTransactionsToKeep = 0, nextIndex = 0;
|
||||
bool newTransaction = true, reentrancyCheck = false;
|
||||
ActionSet* getCurrentSet() const noexcept;
|
||||
ActionSet* getNextSet() const noexcept;
|
||||
bool newTransaction = true, isInsideUndoRedoCall = false;
|
||||
ActionSet* getCurrentSet() const;
|
||||
ActionSet* getNextSet() const;
|
||||
void moveFutureTransactionsToStash();
|
||||
void restoreStashedFutureTransactions();
|
||||
void dropOldTransactionsIfTooLarge();
|
||||
|
@ -40,11 +40,11 @@ class JUCE_API UndoableAction
|
||||
{
|
||||
protected:
|
||||
/** Creates an action. */
|
||||
UndoableAction() noexcept {}
|
||||
UndoableAction() = default;
|
||||
|
||||
public:
|
||||
/** Destructor. */
|
||||
virtual ~UndoableAction() {}
|
||||
virtual ~UndoableAction() = default;
|
||||
|
||||
//==============================================================================
|
||||
/** Overridden by a subclass to perform the action.
|
||||
|
Reference in New Issue
Block a user