🔧 Unify trex settings keys

This commit is contained in:
Simon Schneegans
2023-02-08 16:33:00 +01:00
parent 8c163f3a38
commit 8d7144b6e4
4 changed files with 30 additions and 30 deletions
+9 -9
View File
@@ -53,7 +53,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="claw-scratch-scale">
<object class="GtkAdjustment" id="trex-scratch-scale">
<property name="upper">10</property>
<property name="lower">0.1</property>
<property name="step-increment">0.1</property>
@@ -63,7 +63,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkButton" id="reset-claw-scratch-scale">
<object class="GtkButton" id="reset-trex-scratch-scale">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
@@ -86,7 +86,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="claw-scratch-count">
<object class="GtkAdjustment" id="trex-scratch-count">
<property name="upper">50</property>
<property name="lower">1</property>
<property name="step-increment">1</property>
@@ -96,7 +96,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkButton" id="reset-claw-scratch-count">
<object class="GtkButton" id="reset-trex-scratch-count">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
@@ -119,7 +119,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="claw-scratch-warp">
<object class="GtkAdjustment" id="trex-scratch-warp">
<property name="upper">1</property>
<property name="lower">0</property>
<property name="step-increment">0.01</property>
@@ -129,7 +129,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkButton" id="reset-claw-scratch-warp">
<object class="GtkButton" id="reset-trex-scratch-warp">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
@@ -144,9 +144,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Flash Color</property>
<property name="activatable-widget">claw-scratch-color</property>
<property name="activatable-widget">trex-scratch-color</property>
<child>
<object class="GtkColorButton" id="claw-scratch-color">
<object class="GtkColorButton" id="trex-scratch-color">
<property name="use_alpha">1</property>
<property name="show_editor">1</property>
<property name="width-request">250</property>
@@ -154,7 +154,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkButton" id="reset-claw-scratch-color">
<object class="GtkButton" id="reset-trex-scratch-color">
<property name="icon-name">edit-clear-symbolic</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
+8 -8
View File
@@ -82,7 +82,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="claw-scratch-scale">
<object class="GtkAdjustment" id="trex-scratch-scale">
<property name="upper">10</property>
<property name="lower">0.1</property>
<property name="step-increment">0.1</property>
@@ -92,7 +92,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkButton" id="reset-claw-scratch-scale">
<object class="GtkButton" id="reset-trex-scratch-scale">
<property name="icon-name">edit-clear-symbolic</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
@@ -128,7 +128,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="claw-scratch-count">
<object class="GtkAdjustment" id="trex-scratch-count">
<property name="upper">50</property>
<property name="lower">1</property>
<property name="step-increment">1</property>
@@ -138,7 +138,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkButton" id="reset-claw-scratch-count">
<object class="GtkButton" id="reset-trex-scratch-count">
<property name="icon-name">edit-clear-symbolic</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
@@ -174,7 +174,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
<property name="value-pos">left</property>
<property name="width-request">300</property>
<property name="adjustment">
<object class="GtkAdjustment" id="claw-scratch-warp">
<object class="GtkAdjustment" id="trex-scratch-warp">
<property name="upper">1</property>
<property name="lower">0</property>
<property name="step-increment">0.01</property>
@@ -184,7 +184,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkButton" id="reset-claw-scratch-warp">
<object class="GtkButton" id="reset-trex-scratch-warp">
<property name="icon-name">edit-clear-symbolic</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
@@ -212,7 +212,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkColorButton" id="claw-scratch-color">
<object class="GtkColorButton" id="trex-scratch-color">
<property name="use_alpha">1</property>
<property name="show_editor">1</property>
<property name="margin-start">8</property>
@@ -221,7 +221,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</object>
</child>
<child>
<object class="GtkButton" id="reset-claw-scratch-color">
<object class="GtkButton" id="reset-trex-scratch-color">
<property name="icon-name">edit-clear-symbolic</property>
<property name="tooltip-text" translatable="yes">Reset to Default Value</property>
<style>
@@ -402,25 +402,25 @@ SPDX-License-Identifier: CC0-1.0
<description>The time the trex effect takes.</description>
</key>
<key name="claw-scratch-color" type="s">
<key name="trex-scratch-color" type="s">
<default>"rgb(170, 0, 0)"</default>
<summary>Claw Scratch Color</summary>
<description>The color of the claw scratches.</description>
</key>
<key name="claw-scratch-scale" type="d">
<key name="trex-scratch-scale" type="d">
<default>1.0</default>
<summary>Claw Scratch Scale</summary>
<description>Size of the claw scratches.</description>
</key>
<key name="claw-scratch-warp" type="d">
<key name="trex-scratch-warp" type="d">
<default>0.15</default>
<summary>Claw Scratch Warp</summary>
<description>Intensity of the claw scratch warp effect.</description>
</key>
<key name="claw-scratch-count" type="i">
<key name="trex-scratch-count" type="i">
<default>5</default>
<summary>Claw Scratch Count</summary>
<description>Number of claw scratches drawn on top of each other.</description>
+9 -9
View File
@@ -62,14 +62,14 @@ var TRexAttack = class {
// Write all uniform values at the start of each animation.
shader.connect('begin-animation', (shader, settings, forOpening, testMode) => {
const c = Clutter.Color.from_string(settings.get_string('claw-scratch-color'))[1];
const c = Clutter.Color.from_string(settings.get_string('trex-scratch-color'))[1];
// clang-format off
shader.set_uniform_float(shader._uFlashColor, 4, [c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255]);
shader.set_uniform_float(shader._uSeed, 2, [testMode ? 0 : Math.random(), testMode ? 0 : Math.random()]);
shader.set_uniform_float(shader._uClawSize, 1, [settings.get_double('claw-scratch-scale')]);
shader.set_uniform_float(shader._uNumClaws, 1, [settings.get_int('claw-scratch-count')]);
shader.set_uniform_float(shader._uWarpIntensity, 1, [settings.get_double('claw-scratch-warp')]);
shader.set_uniform_float(shader._uClawSize, 1, [settings.get_double('trex-scratch-scale')]);
shader.set_uniform_float(shader._uNumClaws, 1, [settings.get_int('trex-scratch-count')]);
shader.set_uniform_float(shader._uWarpIntensity, 1, [settings.get_double('trex-scratch-warp')]);
// clang-format on
});
@@ -118,10 +118,10 @@ var TRexAttack = class {
// binds all user interface elements to the respective settings keys of the profile.
bindPreferences(dialog) {
dialog.bindAdjustment('trex-animation-time');
dialog.bindColorButton('claw-scratch-color');
dialog.bindAdjustment('claw-scratch-scale');
dialog.bindAdjustment('claw-scratch-count');
dialog.bindAdjustment('claw-scratch-warp');
dialog.bindColorButton('trex-scratch-color');
dialog.bindAdjustment('trex-scratch-scale');
dialog.bindAdjustment('trex-scratch-count');
dialog.bindAdjustment('trex-scratch-warp');
}
// ---------------------------------------------------------------- API for extension.js
@@ -130,7 +130,7 @@ var TRexAttack = class {
// animation. This is useful if the effect requires drawing something beyond the usual
// bounds of the actor. This only works for GNOME 3.38+.
getActorScale(settings) {
const scale = 1.0 + 0.5 * settings.get_double('claw-scratch-warp');
const scale = 1.0 + 0.5 * settings.get_double('trex-scratch-warp');
return {x: scale, y: scale};
}
}