mirror of https://gitlab.com/nakst/essence
disabling animations, basic support
This commit is contained in:
parent
17eeb15938
commit
93c55a8145
|
@ -91,6 +91,7 @@ struct GlobalData {
|
||||||
volatile bool showCursorShadow;
|
volatile bool showCursorShadow;
|
||||||
volatile bool useSmartQuotes;
|
volatile bool useSmartQuotes;
|
||||||
volatile bool enableHoverState;
|
volatile bool enableHoverState;
|
||||||
|
volatile float animationTimeMultiplier;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ThreadLocalStorage {
|
struct ThreadLocalStorage {
|
||||||
|
|
|
@ -1288,7 +1288,7 @@ void UIDrawTransitionEffect(EsPainter *painter, EsPaintTarget *sourceSurface, Es
|
||||||
}
|
}
|
||||||
|
|
||||||
void EsElementStartTransition(EsElement *element, EsTransitionType transitionType, uint32_t flags, float timeMultiplier) {
|
void EsElementStartTransition(EsElement *element, EsTransitionType transitionType, uint32_t flags, float timeMultiplier) {
|
||||||
uint32_t durationMs = timeMultiplier * GetConstantNumber("transitionTime");
|
uint32_t durationMs = timeMultiplier * GetConstantNumber("transitionTime") * api.global->animationTimeMultiplier;
|
||||||
|
|
||||||
if (!durationMs) {
|
if (!durationMs) {
|
||||||
return;
|
return;
|
||||||
|
@ -1779,7 +1779,7 @@ void EsElement::RefreshStyle(UIStyleKey *_oldStyleKey, bool alreadyRefreshStyleS
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldStyle) {
|
if (oldStyle) {
|
||||||
if (oldStyle->style == currentStyle->style) {
|
if (oldStyle->style == currentStyle->style && api.global->animationTimeMultiplier > 0.01f) {
|
||||||
ThemeAnimationBuild(&animation, oldStyle, oldStyleKey.stateFlags, currentStyleKey.stateFlags);
|
ThemeAnimationBuild(&animation, oldStyle, oldStyleKey.stateFlags, currentStyleKey.stateFlags);
|
||||||
animate = !ThemeAnimationComplete(&animation);
|
animate = !ThemeAnimationComplete(&animation);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3462,7 +3462,7 @@ void EsPanelSwitchTo(EsPanel *panel, EsElement *targetChild, EsTransitionType tr
|
||||||
EsMessageMutexCheck();
|
EsMessageMutexCheck();
|
||||||
EsAssert(targetChild->parent == panel);
|
EsAssert(targetChild->parent == panel);
|
||||||
EsAssert(panel->flags & ES_PANEL_SWITCHER); // Cannot switch element for a non-switcher panel.
|
EsAssert(panel->flags & ES_PANEL_SWITCHER); // Cannot switch element for a non-switcher panel.
|
||||||
uint32_t timeMs = timeMultiplier * GetConstantNumber("transitionTime");
|
uint32_t timeMs = timeMultiplier * GetConstantNumber("transitionTime") * api.global->animationTimeMultiplier;
|
||||||
|
|
||||||
if (targetChild == panel->switchedTo) {
|
if (targetChild == panel->switchedTo) {
|
||||||
return;
|
return;
|
||||||
|
@ -3503,7 +3503,7 @@ void EsPanelSwitchTo(EsPanel *panel, EsElement *targetChild, EsTransitionType tr
|
||||||
void EsPanelStartMovementAnimation(EsPanel *panel, float timeMultiplier) {
|
void EsPanelStartMovementAnimation(EsPanel *panel, float timeMultiplier) {
|
||||||
// TODO Custom smoothing functions.
|
// TODO Custom smoothing functions.
|
||||||
|
|
||||||
uint32_t timeMs = timeMultiplier * GetConstantNumber("transitionTime");
|
uint32_t timeMs = timeMultiplier * GetConstantNumber("transitionTime") * api.global->animationTimeMultiplier;
|
||||||
if (!timeMs) return;
|
if (!timeMs) return;
|
||||||
EsMessageMutexCheck();
|
EsMessageMutexCheck();
|
||||||
EsAssert(~panel->flags & ES_PANEL_SWITCHER); // Use EsPanelSwitchTo!
|
EsAssert(~panel->flags & ES_PANEL_SWITCHER); // Use EsPanelSwitchTo!
|
||||||
|
|
|
@ -140,6 +140,7 @@ void SettingsUpdateGlobalAndWindowManager() {
|
||||||
api.global->showCursorShadow = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("show_cursor_shadow"));
|
api.global->showCursorShadow = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("show_cursor_shadow"));
|
||||||
api.global->useSmartQuotes = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("use_smart_quotes"));
|
api.global->useSmartQuotes = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("use_smart_quotes"));
|
||||||
api.global->enableHoverState = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("enable_hover_state"));
|
api.global->enableHoverState = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("enable_hover_state"));
|
||||||
|
api.global->animationTimeMultiplier = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("enable_animations")) ? 1.0f : 0.0f;
|
||||||
|
|
||||||
{
|
{
|
||||||
float newUIScale = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("ui_scale")) * 0.01f;
|
float newUIScale = EsSystemConfigurationReadInteger(EsLiteral("general"), EsLiteral("ui_scale")) * 0.01f;
|
||||||
|
@ -698,6 +699,7 @@ void SettingsPageTheme(EsElement *element, SettingsPage *page) {
|
||||||
|
|
||||||
table = EsPanelCreate(container, ES_CELL_H_FILL, &styleSettingsCheckboxGroup);
|
table = EsPanelCreate(container, ES_CELL_H_FILL, &styleSettingsCheckboxGroup);
|
||||||
SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsThemeEnableHoverState), 'H', "general", "enable_hover_state");
|
SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsThemeEnableHoverState), 'H', "general", "enable_hover_state");
|
||||||
|
SettingsAddCheckbox(table, INTERFACE_STRING(DesktopSettingsThemeEnableAnimations), 'M', "general", "enable_animations");
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage settingsPages[] = {
|
SettingsPage settingsPages[] = {
|
||||||
|
|
|
@ -6,6 +6,7 @@ ui_scale=100
|
||||||
window_color=6
|
window_color=6
|
||||||
use_smart_quotes=1
|
use_smart_quotes=1
|
||||||
enable_hover_state=1
|
enable_hover_state=1
|
||||||
|
enable_animations=1
|
||||||
|
|
||||||
[paths]
|
[paths]
|
||||||
fonts=0:/Essence/Fonts
|
fonts=0:/Essence/Fonts
|
||||||
|
|
|
@ -144,6 +144,7 @@ DEFINE_INTERFACE_STRING(DesktopSettingsDisplayUIScale, "Interface scale:");
|
||||||
|
|
||||||
DEFINE_INTERFACE_STRING(DesktopSettingsThemeWindowColor, "Window color:");
|
DEFINE_INTERFACE_STRING(DesktopSettingsThemeWindowColor, "Window color:");
|
||||||
DEFINE_INTERFACE_STRING(DesktopSettingsThemeEnableHoverState, "Highlight the item the cursor is over");
|
DEFINE_INTERFACE_STRING(DesktopSettingsThemeEnableHoverState, "Highlight the item the cursor is over");
|
||||||
|
DEFINE_INTERFACE_STRING(DesktopSettingsThemeEnableAnimations, "Animate the user interface");
|
||||||
DEFINE_INTERFACE_STRING(DesktopSettingsThemeWallpaper, "Wallpaper");
|
DEFINE_INTERFACE_STRING(DesktopSettingsThemeWallpaper, "Wallpaper");
|
||||||
|
|
||||||
// File operations.
|
// File operations.
|
||||||
|
|
Loading…
Reference in New Issue