billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=cba686804552f0d1064dbd568f3008fb92501c37

commit cba686804552f0d1064dbd568f3008fb92501c37
Author: Boris Faure <[email protected]>
Date:   Sat Feb 15 21:49:44 2020 +0100

    mild: update theme to support tab drag'n'drop
---
 data/themes/mild.edc | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)

diff --git a/data/themes/mild.edc b/data/themes/mild.edc
index 9ad839f..c6ef088 100644
--- a/data/themes/mild.edc
+++ b/data/themes/mild.edc
@@ -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";
+         }
       }
    }
 

-- 


Reply via email to