Animation config rework

This commit is contained in:
vaxerski
2022-07-28 13:28:43 +02:00
parent 9dd17a4be6
commit 920fdd6bff
11 changed files with 193 additions and 48 deletions

View File

@@ -16,6 +16,9 @@
#define STRVAL_EMPTY "[[EMPTY]]"
#define INITANIMCFG(name) animationConfig[name] = {}
#define CREATEANIMCFG(name, parent) animationConfig[name] = {true, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]}
struct SConfigValue {
int64_t intValue = -1;
float floatValue = -1;
@@ -47,6 +50,18 @@ struct SWindowRule {
std::string szValue;
};
struct SAnimationPropertyConfig {
bool overriden = true;
std::string internalBezier = "";
std::string internalStyle = "";
float internalSpeed = 0.f;
int internalEnabled = -1;
SAnimationPropertyConfig* pValues = nullptr;
SAnimationPropertyConfig* pParentAnimation = nullptr;
};
class CConfigManager {
public:
CConfigManager();
@@ -84,6 +99,8 @@ public:
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);
SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&);
private:
std::deque<std::string> configPaths; // stores all the config paths
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
@@ -91,6 +108,8 @@ private:
std::unordered_map<std::string, SConfigValue> configValues;
std::unordered_map<std::string, std::unordered_map<std::string, SConfigValue>> deviceConfigs; // stores device configs
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values
std::string configCurrentPath;
std::string currentCategory = ""; // For storing the category of the current item
@@ -110,9 +129,12 @@ private:
// internal methods
void setDefaultVars();
void setDefaultAnimationVars();
void setDeviceDefaultVars(const std::string&);
void ensureDPMS();
void setAnimForChildren(SAnimationPropertyConfig *const);
void applyUserDefinedVars(std::string&, const size_t);
void loadConfigLoadVars();
SConfigValue getConfigValueSafe(const std::string&);