mild: update theme to support tab drag'n'drop

This commit is contained in:
Boris Faure 2020-02-15 21:49:44 +01:00
parent 82aa688f97
commit cba6868045
Signed by untrusted user who does not match committer: borisfaure
GPG Key ID: 35C0410516166BE8
1 changed files with 95 additions and 0 deletions

View File

@ -914,6 +914,19 @@ collections {
rel2.to_x: "terminology.tab_btn";
fixed: 1 1;
}
description { state: "hdrag,off" 0.0;
inherit: "default" 0.0;
}
}
program {
signal: "hdrag,on"; source: "terminology";
action: STATE_SET "default" 0.0;
target: "tabdrag";
}
program {
signal: "hdrag,off"; source: "terminology";
action: STATE_SET "hdrag,off" 0.0;
target: "tabdrag";
}
// left boundary of the active tab (dragable 0.0 -> 1.0)
part { name: "terminology.tabl"; type: SPACER;
@ -1106,6 +1119,62 @@ collections {
target: "cmdclip";
}
program {
signal: "mouse,up,1"; source: "tabmiddle";
action: SIGNAL_EMIT "tab,drag,stop" "terminology";
}
program {
signal: "mouse,move"; source: "tabmiddle";
script {
new y, h, drag_x, drag_w;
new state[31]; \
new Float:vl;
if (!get_mouse_buttons())
return;
get_state(PART:"tabdrag", state, 30, vl);
if (!strcmp(state, "hdrag,off")) {
emit("tab,drag,move", "terminology");
return
}
get_geometry(PART:"tabdrag", drag_x, y, drag_w, h);
if (drag_w > 0) {
new m_x, m_y;
new Float:mid;
new Float:d;
new Float:v1;
new Float:v2;
new Float:n;
get_mouse(m_x, m_y);
mid = m_x - drag_x;
mid = mid / drag_w;
get_drag(PART:"terminology.tabl", v1, n);
get_drag(PART:"terminology.tabr", v2, n);
d = (v2 - v1) / 2;
set_drag(PART:"terminology.tabl", mid - d, 0.0);
set_drag(PART:"terminology.tabr", mid + d, 0.0);
emit("tab,hdrag", "terminology");
}
}
}
program {
signal: "mouse,down,1,double"; source: "tabmiddle";
action: SIGNAL_EMIT "tab,title" "terminology";
}
program {
signal: "mouse,down,1"; source: "tabmiddle";
action: SIGNAL_EMIT "tab,mouse,down" "terminology";
}
program {
signal: "mouse,up,1"; source: "tabmiddle";
action: SIGNAL_EMIT "tab,mouse,up" "terminology";
}
////////////////////////////////////////////////////////////////////
// visual bell - spinning red siren light
part { name: "bell_base";
@ -1771,6 +1840,17 @@ collections {
rel1.to: "tab_base_top2";
rel2.to: "tab_base_top2";
}
description { state: "bell" 0.0;
inherit: "default" 0.0;
color: 255 219 0 96;
color2: 255 51 0 48;
color3: 255 51 0 8;
}
description { state: "active" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
color3: 0 0 0 18;
}
}
part { name: "clip"; type: RECT;
description { state: "default" 0.0;
@ -1786,6 +1866,21 @@ collections {
signal: "mouse,clicked,1"; source: "event";
action: SIGNAL_EMIT "tab,activate" "terminology";
}
program { name: "bell";
signal: "bell"; source: "terminology";
action: STATE_SET "bell" 0.0;
target: "terminology.title";
}
program { name: "bell,off";
signal: "bell,off"; source: "terminology";
action: STATE_SET "default" 0.0;
target: "terminology.title";
}
program { name: "style,active";
signal: "style,active"; source: "terminology";
action: STATE_SET "active" 0.0;
target: "terminology.title";
}
}
}