mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
The graph range used to be reset to default whenever all functions were modified. As we no longer want to reset the range without the user's input, we do not need to track whether the functions changed at all. /!\ As of this commit, there is no longer a way to restore the default zoom, until a new automatic zoom button is added. Change-Id: Ie74e8fd61e13055fa6ce2b2d1e883182d4ecffce
33 lines
1015 B
C++
33 lines
1015 B
C++
#ifndef SHARED_FUNCTION_STORE_H
|
|
#define SHARED_FUNCTION_STORE_H
|
|
|
|
#include "function.h"
|
|
#include "expression_model_store.h"
|
|
#include <stdint.h>
|
|
|
|
namespace Shared {
|
|
|
|
// FunctionStore stores functions and gives them a color.
|
|
|
|
class FunctionStore : public ExpressionModelStore {
|
|
public:
|
|
FunctionStore() : ExpressionModelStore() {}
|
|
uint32_t storeChecksum();
|
|
int numberOfActiveFunctions() const {
|
|
return numberOfModelsSatisfyingTest(&isFunctionActive, nullptr);
|
|
}
|
|
Ion::Storage::Record activeRecordAtIndex(int i) const {
|
|
return recordSatisfyingTestAtIndex(i, &isFunctionActive, nullptr);
|
|
}
|
|
ExpiringPointer<Function> modelForRecord(Ion::Storage::Record record) const { return ExpiringPointer<Function>(static_cast<Function *>(privateModelForRecord(record))); }
|
|
protected:
|
|
static bool isFunctionActive(ExpressionModelHandle * model, void * context) {
|
|
// An active function must be defined
|
|
return isModelDefined(model, context) && static_cast<Function *>(model)->isActive();
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|