mild: add cursor_bar/cursor_underline

This commit is contained in:
Boris Faure 2020-02-24 22:00:13 +01:00
parent 65b38a8967
commit 9431dda41e
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
1 changed files with 328 additions and 0 deletions

View File

@ -2048,6 +2048,334 @@ collections {
}
}
//////////////////////////////////////////////////////////////////////////////
//// the cursor as an underline to show where text is typed
group { name: "terminology/cursor_underline";
images {
image: "cr_key.png" COMP;
image: "cr_underline_out.png" COMP;
}
sounds {
sample { name: "key-tap1" LOSSY 64;
source: "kbd-tap.wav";
}
sample { name: "key-tap2" LOSSY 64;
source: "kbd-tap2.wav";
}
sample { name: "key-tap3" LOSSY 64;
source: "kbd-tap3.wav";
}
sample { name: "key-tap4" LOSSY 64;
source: "kbd-tap4.wav";
}
sample { name: "key-tap5" LOSSY 64;
source: "kbd-tap5.wav";
}
}
parts {
part { name: "pulsclip"; type: RECT;
description { state: "default" 0.0;
}
description { state: "pulse" 0.0;
color: 255 255 255 80;
}
}
part { name: "key";
mouse_events: 0;
description { state: "default" 0.0;
rel1 {
to: "outline";
offset: -5 -5;
}
rel2 {
to: "outline";
offset: 4 4;
}
image {
normal: "cr_key.png";
border: 4 4 4 4;
}
color: 255 255 255 0;
}
description { state: "on" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
description { state: "out" 0.0;
inherit: "default" 0.0;
color: 160 100 255 0;
}
}
part { name: "outline";
mouse_events: 0;
clip_to: "pulsclip";
description { state: "default" 0.0;
image {
normal: "cr_underline_out.png";
border: 3 3 3 3;
}
color: 255 255 255 64;
}
description { state: "focused" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
programs {
program { name: "focus_in_noblink";
signal: "focus,in,noblink";
source: "terminology";
action: STATE_SET "focused" 0.0;
target: "outline";
}
program { name: "focus_in";
signal: "focus,in";
source: "terminology";
action: STATE_SET "focused" 0.0;
target: "outline";
after: "pulse-prepare";
}
program { name: "pulse-prepare";
action: STATE_SET "default" 0.0;
target: "pulsclip";
after: "pulse";
}
program { name: "pulse";
action: STATE_SET "pulse" 0.0;
transition: DECELERATE 0.5;
target: "pulsclip";
after: "pulse2";
}
program { name: "pulse2";
action: STATE_SET "default" 0.0;
in: 1.5 0.0;
transition: DECELERATE 0.5;
target: "pulsclip";
after: "pulse";
}
program { name: "focus_out";
signal: "focus,out";
source: "terminology";
action: ACTION_STOP;
target: "focus_in";
target: "pulse";
target: "pulse2";
after: "focus_out2";
}
program { name: "focus_out2";
action: STATE_SET "default" 0.0;
target: "outline";
target: "pulsclip";
}
program {
signal: "key,down"; source: "terminology";
script {
new buf[32];
snprintf(buf, 31, "key-down%i", (rand() % 5) + 1);
run_program(get_program_id(buf));
}
}
program { name: "key-down1";
action: PLAY_SAMPLE "key-tap1" 1.0;
}
program { name: "key-down2";
action: PLAY_SAMPLE "key-tap2" 1.0;
}
program { name: "key-down3";
action: PLAY_SAMPLE "key-tap3" 1.0;
}
program { name: "key-down4";
action: PLAY_SAMPLE "key-tap4" 1.0;
}
program { name: "key-down5";
action: PLAY_SAMPLE "key-tap5" 1.0;
}
program { name: "key";
signal: "key,down";
source: "terminology";
action: STATE_SET "default" 0.0;
target: "key";
after: "key2";
}
program { name: "key2";
action: STATE_SET "on" 0.0;
target: "key";
after: "key3";
}
program { name: "key3";
action: STATE_SET "out" 0.0;
transition: DECELERATE 0.3;
target: "key";
}
}
}
}
//////////////////////////////////////////////////////////////////////////////
//// the cursor as a bar to show where text is typed
group { name: "terminology/cursor_bar";
images {
image: "cr_key.png" COMP;
image: "cr_bar_out.png" COMP;
}
sounds {
sample { name: "key-tap1" LOSSY 64;
source: "kbd-tap.wav";
}
sample { name: "key-tap2" LOSSY 64;
source: "kbd-tap2.wav";
}
sample { name: "key-tap3" LOSSY 64;
source: "kbd-tap3.wav";
}
sample { name: "key-tap4" LOSSY 64;
source: "kbd-tap4.wav";
}
sample { name: "key-tap5" LOSSY 64;
source: "kbd-tap5.wav";
}
}
parts {
part { name: "pulsclip"; type: RECT;
description { state: "default" 0.0;
}
description { state: "pulse" 0.0;
color: 255 255 255 80;
}
}
part { name: "key";
mouse_events: 0;
description { state: "default" 0.0;
rel1 {
to: "outline";
offset: -5 -5;
}
rel2 {
to: "outline";
offset: 4 4;
}
image {
normal: "cr_key.png";
border: 4 4 4 4;
}
color: 255 255 255 0;
}
description { state: "on" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
description { state: "out" 0.0;
inherit: "default" 0.0;
color: 160 100 255 0;
}
}
part { name: "outline";
mouse_events: 0;
clip_to: "pulsclip";
description { state: "default" 0.0;
image {
normal: "cr_bar_out.png";
border: 3 3 3 3;
}
color: 255 255 255 64;
}
description { state: "focused" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
programs {
program { name: "focus_in_noblink";
signal: "focus,in,noblink";
source: "terminology";
action: STATE_SET "focused" 0.0;
target: "outline";
}
program { name: "focus_in";
signal: "focus,in";
source: "terminology";
action: STATE_SET "focused" 0.0;
target: "outline";
after: "pulse-prepare";
}
program { name: "pulse-prepare";
action: STATE_SET "default" 0.0;
target: "pulsclip";
after: "pulse";
}
program { name: "pulse";
action: STATE_SET "pulse" 0.0;
transition: DECELERATE 0.5;
target: "pulsclip";
after: "pulse2";
}
program { name: "pulse2";
action: STATE_SET "default" 0.0;
in: 1.5 0.0;
transition: DECELERATE 0.5;
target: "pulsclip";
after: "pulse";
}
program { name: "focus_out";
signal: "focus,out";
source: "terminology";
action: ACTION_STOP;
target: "focus_in";
target: "pulse";
target: "pulse2";
after: "focus_out2";
}
program { name: "focus_out2";
action: STATE_SET "default" 0.0;
target: "outline";
target: "pulsclip";
}
program {
signal: "key,down"; source: "terminology";
script {
new buf[32];
snprintf(buf, 31, "key-down%i", (rand() % 5) + 1);
run_program(get_program_id(buf));
}
}
program { name: "key-down1";
action: PLAY_SAMPLE "key-tap1" 1.0;
}
program { name: "key-down2";
action: PLAY_SAMPLE "key-tap2" 1.0;
}
program { name: "key-down3";
action: PLAY_SAMPLE "key-tap3" 1.0;
}
program { name: "key-down4";
action: PLAY_SAMPLE "key-tap4" 1.0;
}
program { name: "key-down5";
action: PLAY_SAMPLE "key-tap5" 1.0;
}
program { name: "key";
signal: "key,down";
source: "terminology";
action: STATE_SET "default" 0.0;
target: "key";
after: "key2";
}
program { name: "key2";
action: STATE_SET "on" 0.0;
target: "key";
after: "key3";
}
program { name: "key3";
action: STATE_SET "out" 0.0;
transition: DECELERATE 0.3;
target: "key";
}
}
}
}
//////////////////////////////////////////////////////////////////////////////
//// an object to contain the selection tool used for selecting tabs (with
//// a glow grid of terms