ibar/ibox icon label positioning rewrite
authorMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 6 Mar 2015 23:56:58 +0000 (18:56 -0500)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 6 Mar 2015 23:59:31 +0000 (18:59 -0500)
the original code for handling label positioning was not robust enough to handle
cases such as ibar scrolling or gadget moving. this greatly simplifies the code
as well as handling all cases and providing small animations for moving the label
when necessary

legacy/elementary/data/themes/edc/ibar-ibox.edc

index fbd13c3..02664ae 100644 (file)
@@ -431,31 +431,6 @@ group { name: "e/modules/ibox/icon_overlay";
    images.image: "darken_rounded_square.png" COMP;
    script {
       public urgent;
-      public origin;
-
-      public refresh_origin(){
-         new partid;
-
-         partid = get_part_id("e.text.label");
-         custom_state(partid, "default", 0.0);
-
-         if (get_int(origin) == 2){
-           //top
-           set_state_val(partid, STATE_ALIGNMENT, 0.5, 0.5);
-         }else if (get_int(origin) == 3){
-           //right
-           set_state_val(partid, STATE_ALIGNMENT, 0.0, 0.5);
-         }else if (get_int(origin) == 4){
-           //left
-           set_state_val(partid, STATE_ALIGNMENT, 1.0, 0.5);
-         }else{
-           //bottom
-           set_state_val(partid, STATE_ALIGNMENT, 0.5, 0.5);
-         }
-
-         /* apply the custom state */
-         set_state(partid, "custom", 0.0);
-      }
    }
    parts {
       part { name: "item_clip"; type: RECT;
@@ -520,19 +495,7 @@ group { name: "e/modules/ibox/icon_overlay";
             rel2.to: "background";
          }
       }
-      part { name: "clipper"; type: RECT;
-         description{ state: "default" 0.0;
-            rel1.to: "bevel";
-            rel2.to: "bevel";
-            color: 255 255 255 0;
-         }
-         description{ state: "visible" 0.0;
-            inherit: "default" 0.0;
-            color: 255 255 255 255;
-         }
-      }
       part { name: "bevel"; mouse_events: 0;
-         clip_to: "clipper";
          description { state: "default" 0.0;
             rel1.offset: -10 -6;
             rel1.to: "e.text.label";
@@ -542,29 +505,47 @@ group { name: "e/modules/ibox/icon_overlay";
             image.border: 15 15 15 15;
             fill.smooth: 0;
             fixed: 1 1;
+            color: 255 255 255 0;
+            visible: 0;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            color: 255 255 255 255;
+            visible: 1;
          }
       }
-      part { name: "spacer"; type: SPACER;
-         description { state: "default" 0.0;
-            rel1.relative: 0.0 1.0;
-            rel2.relative: 1.0 1.0;
+      text { name: "spacer";
+         effect: SHADOW BOTTOM;
+         scale: 1;
+         desc { color: 0 0 0 0;
+            rel1.relative: 1 0;
+            rel2.relative: 0 1;
+            text {
+               source: "e.text.label";
+               text_source: "e.text.label";
+            }
+            link.base: "e,origin,center" "e";
+            link.transition: SINUSOIDAL 0.1 CURRENT;
          }
-         description { state:  "visible" 0.0;
-            rel1.relative: 0.0 0.5;
-            rel2.relative: 1.0 0.5;
+         desc { "left"; inherit: "default";
+            align: 0.0 0.5;
+            link.base: "e,origin,left" "e";
+            link.transition: SINUSOIDAL 0.1 CURRENT;
+         }
+         desc { "right"; inherit: "default";
+            align: 1.0 0.5;
+            link.base: "e,origin,right" "e";
+            link.transition: SINUSOIDAL 0.1 CURRENT;
          }
-
       }
       part { name: "e.text.label"; type: TEXT; mouse_events: 0;
          effect: SHADOW BOTTOM;
          scale: 1;
-         clip_to: "clipper";
          description { state: "default" 0.0;
-            rel1.to: "spacer";
-            rel1.relative: 0.0 0.0;
-            rel2.to: "spacer";
-            rel2.relative: 1.0 1.0;
-            color_class: "module_label";
+            rel1.to_x: "spacer";
+            rel2.to_x: "spacer";
+            rel1.relative: 0 1;
+            color_class: "module_label_invisible";
             color3: 255 255 255 255;
             text { font: FN; size: 10;
                min: 1 1;
@@ -572,7 +553,13 @@ group { name: "e/modules/ibox/icon_overlay";
                align: 0.5 0.5;
                text_class: "module_normal";
             }
-            align: 0.5 0.5;
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            rel1.relative: 0.0 0.5;
+            rel2.relative: 1.0 0.5;
+            color_class: "module_label";
+            color3: 255 255 255 255;
          }
       }
    }
@@ -612,31 +599,16 @@ group { name: "e/modules/ibox/icon_overlay";
          signal: "e,action,show,label"; source: "e";
          action: STATE_SET "visible" 0.0;
          transition: SINUSOIDAL 0.5;
-         target: "spacer";
-         target: "clipper";
+         target: "e.text.label";
+         target: "bevel";
       }
       program {
          signal: "e,action,hide,label"; source: "e";
          action: STATE_SET "default" 0.0;
          transition: SINUSOIDAL 1.0;
-         target: "spacer";
-         target: "clipper";
-      }
-#define ORIGIN_PRO(_NAME,_ID) \
-      program { \
-         signal: "e,origin,"_NAME; source: "e"; \
-         script { \
-            set_int(origin, _ID); \
-            refresh_origin(); \
-         } \
+         target: "e.text.label";
+         target: "bevel";
       }
-
-      ORIGIN_PRO("bottom", 1)
-      ORIGIN_PRO("top", 2);
-      ORIGIN_PRO("right", 3);
-      ORIGIN_PRO("left", 4);
-
-#undef ORIGIN_PRO
       program { name: "show_bevel";
          action: STATE_SET visible 0.0;
          transition: SINUSOIDAL 1.0;