billiob pushed a commit to branch master.

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

commit 5a2e394c36b535c8111d59a85fa49291d4f25809
Author: Boris Faure <[email protected]>
Date:   Sun Mar 22 10:53:30 2020 +0100

    tab drag: have a thumbnail of the tab
---
 data/themes/default.edc                |   1 +
 data/themes/default/tab_drag_thumb.edc | 287 +++++++++++++++++++++++++++++++++
 data/themes/meson.build                |   1 +
 src/bin/win.c                          |  54 +++++--
 4 files changed, 333 insertions(+), 10 deletions(-)

diff --git a/data/themes/default.edc b/data/themes/default.edc
index 45c740f..7b5b188 100644
--- a/data/themes/default.edc
+++ b/data/themes/default.edc
@@ -31,4 +31,5 @@ collections {
    #include "default/icon.edc"
    #include "default/about.edc"
    #include "default/fontpreview.edc"
+   #include "default/tab_drag_thumb.edc"
 }
diff --git a/data/themes/default/tab_drag_thumb.edc 
b/data/themes/default/tab_drag_thumb.edc
new file mode 100644
index 0000000..83dc0b5
--- /dev/null
+++ b/data/themes/default/tab_drag_thumb.edc
@@ -0,0 +1,287 @@
+group { name: "terminology/tab_drag_thumb";
+   images {
+      image: "bg_bevel.png" COMP;
+      image: "bg_glint.png" COMP;
+      image: "pm_shadow.png" COMP;
+      image: "cr_glow.png" COMP;
+      image: "bg_led_glow.png" COMP;
+      image: "bg_led_base.png" COMP;
+      image: "bg_led.png" COMP;
+      image: "bg_led_strobe.png" COMP;
+   }
+   set { name: "bg_shine";
+      image { image: "bg_shine5.png" COMP; size: 0 0 256 120; }
+      image { image: "bg_shine4.png" COMP; size: 256 120 512 240; }
+      image { image: "bg_shine3.png" COMP; size: 512 240 1024 480; }
+      image { image: "bg_shine2.png" COMP; size: 1024 480 2048 960; }
+      image { image: "bg_shine.png"  COMP; size: 2048 960 99999 99999; }
+   }
+   parts {
+        ////////////////////////////////////////////////////////////////////
+        // base background and selection image
+      part { name: "clip"; type: RECT;
+         description { state: "default" 0.0;
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+            color: 255 255 255 255;
+         }
+      }
+      part { name: "shadow";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+            rel1.offset: -40 -40;
+            rel2.offset: 39 39;
+            image.normal: "pm_shadow.png";
+            image.border: 64 64 64 64;
+            image.border_scale_by: 1.0;
+            color: 255 255 255 255;
+            fill.smooth: 0;
+         }
+      }
+      part { name: "glow";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+            rel1.offset: -4 -4;
+            rel2.offset: 3 3;
+            image {
+               normal: "cr_glow.png";
+               border: 9 9 9 9;
+            }
+            color: 51 153 255 255;
+         }
+      }
+
+      ////////////////////////////////////////////////////////////////////
+      // swallowed terminal content + bg inside it
+      part { name: "base"; type: RECT;
+         clip_to: "clip";
+         description { state: "default" 0.0;
+            color_class: "BG";
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+         }
+      }
+      part { name: "terminology.content"; type: SWALLOW;
+         clip_to: "clip";
+         description { state: "default" 0.0;
+            rel1.relative: 0.0 0.0;
+            rel2.relative: 1.0 1.0;
+         }
+      }
+
+      ////////////////////////////////////////////////////////////////////
+      // fancy stuff over the top of the terminal for shading and title
+      part { name: "overlay";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+            image.normal: "pm_overlay.png";
+            fill.smooth: 0;
+         }
+      }
+      part { name: "bevel";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+            image.normal: "bg_bevel.png";
+            image.border: 3 3 3 3;
+            image.middle: 0;
+            fill.smooth: 0;
+         }
+      }
+      part { name: "terminology.title"; type: TEXT; mouse_events: 0;
+         effect: GLOW;
+         scale: 1;
+         description { state: "default" 0.0;
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+            color: 255 255 255 255;
+            color2: 51 153 255 128;
+            color3: 51 153 255 20;
+            align: 0.5 1.0;
+            text { font: "Sans"; size: 10;
+               align: 0.5 1.0;
+               min: 0 1;
+            }
+         }
+      }
+
+      ////////////////////////////////////////////////////////////////////
+      // fancy stuff on top
+      part { name: "glint";
+         mouse_events: 0;
+         clip_to: "clip";
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            min: 79 5;
+            max: 79 5;
+            rel1 {
+               to: "terminology.content";
+               relative: 0.0 0.0;
+               offset: 0 0;
+            }
+            rel2 {
+               to: "terminology.content";
+               relative: 1.0 0.0;
+               offset: -1 0;
+            }
+            image.normal: "bg_glint.png";
+         }
+      }
+      part { name: "shine";
+         mouse_events: 0;
+         clip_to: "clip";
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+            image.normal: "bg_shine";
+            fill.smooth: 0;
+            align: 0.5 0.0;
+            aspect: (256/120) (256/120);
+            aspect_preference: HORIZONTAL;
+         }
+      }
+
+      ////////////////////////////////////////////////////////////////////
+      // visual bell - spinning red siren light
+      part { name: "bell_glow";
+         mouse_events: 0;
+         clip_to: "clip";
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            visible: 0;
+            color: 255 255 255 0;
+            rel1.to: "bell_base";
+            rel2.to: "bell_base";
+            min: 200 200;
+            fill.smooth: 0;
+            image.normal: "bg_led_glow.png";
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+            color: 255 255 255 255;
+         }
+      }
+      part { name: "bell_base";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            visible: 0;
+            color: 255 255 255 0;
+            min: 32 32;
+            max: 32 32;
+            rel1.to: "terminology.content";
+            rel2.to: "terminology.content";
+            align: 1.0 1.0;
+            image.normal: "bg_led_base.png";
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+            color: 255 255 255 255;
+         }
+      }
+      part { name: "bell";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            visible: 0;
+            color: 255 255 255 0;
+            rel1.to: "bell_base";
+            rel2.to: "bell_base";
+            image.normal: "bg_led.png";
+         }
+         description { state: "visible" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+            color: 255 255 255 255;
+         }
+      }
+      part { name: "bell_strobe";
+         mouse_events: 0;
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            visible: 0;
+            color: 255 255 255 0;
+            rel1.to: "bell";
+            rel2.to: "bell";
+            image.normal: "bg_led_strobe.png";
+            map {
+               on: 1;
+               smooth: 1;
+               rotation.center: "bell";
+            }
+         }
+         description { state: "spin" 0.0;
+            inherit: "default" 0.0;
+            visible: 1;
+            color: 255 255 255 255;
+            map.rotation.z: 36.0;
+         }
+         description { state: "spin_done" 0.0;
+            inherit: "spin" 0.0;
+            map.rotation.z: 720.0;
+         }
+         description { state: "spin_done2" 0.0;
+            inherit: "spin" 0.0;
+            map.rotation.z: 1440.0;
+         }
+      }
+      program {
+         signal: "bell"; source: "terminology";
+         action: STATE_SET "default" 0.0;
+         target: "bell_base";
+         target: "bell";
+         target: "bell_strobe";
+         target: "bell_glow";
+         after: "bell";
+      }
+      program { name: "bell";
+         action: STATE_SET "visible" 0.0;
+         target: "bell_base";
+         target: "bell_glow";
+         after: "bell2";
+      }
+      program { name: "bell2";
+         action: STATE_SET "visible" 0.0;
+         transition: DECELERATE 0.1;
+         target: "bell";
+         target: "bell_glow";
+         after: "bell3";
+      }
+      program { name: "bell3";
+         action: STATE_SET "spin" 0.0;
+         transition: LINEAR 0.1;
+         target: "bell_strobe";
+         after: "bell4.2";
+      }
+      program { name: "bell4.2";
+         action: STATE_SET "spin_done" 0.0;
+         transition: LINEAR 0.9;
+         target: "bell_strobe";
+         after: "bell4.3";
+      }
+      program { name: "bell4.3";
+         action: STATE_SET "spin_done2" 0.0;
+         transition: LINEAR 1.0;
+         target: "bell_strobe";
+         after: "bell4.4";
+      }
+      program { name: "bell4.4";
+         action: STATE_SET "spin_done" 0.0;
+         target: "bell_strobe";
+         after: "bell4.3";
+      }
+   }
+}
diff --git a/data/themes/meson.build b/data/themes/meson.build
index 7774d2b..9e849d2 100644
--- a/data/themes/meson.build
+++ b/data/themes/meson.build
@@ -23,6 +23,7 @@ default_deps = [
   'default/icon.edc',
   'default/about.edc',
   'default/fontpreview.edc',
+  'default/tab_drag_thumb.edc',
   ]
 mild_deps = ['mild.edc', 'default/colors.edc']
 edje_to_compile = [
diff --git a/src/bin/win.c b/src/bin/win.c
index 5b14b79..8965baa 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -82,6 +82,7 @@ struct _Tab_Drag
    Term *term_over;
    Term *term;
    Evas_Object *icon;
+   Evas_Object *img;
    Evas *e;
    Ecore_Timer *timer;
    /* To be able to restore */
@@ -650,6 +651,10 @@ _solo_bell(Term_Container *tc,
              elm_layout_signal_emit(term->bg, "bell,ring", "terminology");
              elm_layout_signal_emit(term->core, "bell,ring", "terminology");
           }
+        if ((_tab_drag != NULL) && (_tab_drag->term == term))
+          {
+             elm_layout_signal_emit(_tab_drag->icon, "bell", "terminology");
+          }
      }
    if ((term->missed_bell) && (term->config->show_tabs)
        && (tc->parent->type == TERM_CONTAINER_TYPE_SPLIT))
@@ -2916,6 +2921,7 @@ _split_detach(Term_Container *tc, Term_Container 
*solo_child)
 
    o = solo_child->get_evas_object(solo_child);
    evas_object_hide(o);
+   solo_child->parent = (Term_Container*) solo_child->wn;
 }
 
 static Term_Container *
@@ -3678,7 +3684,6 @@ _tab_drag_rollback_tabs(void)
 static void
 _tab_drag_rollback(void)
 {
-
    switch (_tab_drag->parent_type)
      {
       case TERM_CONTAINER_TYPE_TABS:
@@ -3756,6 +3761,9 @@ _tab_drag_free(void)
    _tab_drag->timer = NULL;
 
    evas_object_del(_tab_drag->icon);
+   _tab_drag->icon = NULL;
+   evas_object_del(_tab_drag->img);
+   _tab_drag->img = NULL;
 
    term_unref(_tab_drag->term);
    free(_tab_drag);
@@ -3842,6 +3850,12 @@ _tab_drag_stop(void)
    if (!term_at_coords)
      goto end;
 
+   evas_object_image_source_visible_set(_tab_drag->img, EINA_TRUE);
+   elm_layout_content_unset(_tab_drag->icon, "terminology.content");
+   elm_layout_content_set(term->bg, "terminology.content", term->core);
+   term->unswallowed = EINA_FALSE;
+   evas_object_show(term->core);
+
    if (term_at_coords == term)
      {
         Evas_Coord x = 0, y = 0, w = 0, h = 0, off_x = 0, off_y = 0;
@@ -4000,10 +4014,12 @@ static Eina_Bool
 _tab_drag_start(void *data EINA_UNUSED)
 {
    /* Start icons animation before actually drag-starts */
-   Evas_Coord x, y, w, h, off_x, off_y;
+   Evas_Coord x, y, w, h, off_x, off_y, ch_w, ch_h, core_w, core_h;
    Term *term = _tab_drag->term;
    Evas_Object *o = elm_layout_add(term->bg);
+   Evas_Object *img;
    Term_Container *tc = term->container;
+   float ratio;
 
    if (!term->container)
      {
@@ -4011,27 +4027,44 @@ _tab_drag_start(void *data EINA_UNUSED)
         return ECORE_CALLBACK_CANCEL;
      }
 
-   /* TODO: Have it's own group and put content inside */
-   theme_apply_elm(o, term->config, "terminology/tabbar_back");
+   for_each_term_do(_tab_drag->term->wn, &_term_hdrag_off, NULL);
+
+   _tab_drag->icon = o;
+   theme_apply_elm(o, term->config, "terminology/tab_drag_thumb");
    elm_layout_text_set(o, "terminology.title",
                        term->container->title);
-   elm_layout_signal_emit(o, "style,active", "terminology");
-
-   for_each_term_do(_tab_drag->term->wn, &_term_hdrag_off, NULL);
+   elm_layout_content_unset(term->bg, "terminology.content");
+   term->unswallowed = EINA_TRUE;
+   img = evas_object_image_filled_add(evas_object_evas_get(term->core));
+   evas_object_lower(term->core);
+   evas_object_move(term->core, -9999, -9999);
+   evas_object_show(term->core);
+   evas_object_clip_unset(term->core);
+   evas_object_image_source_set(img, term->core);
+   evas_object_geometry_get(term->core, NULL, NULL, &core_w, &core_h);
+   evas_object_resize(img, core_w, core_h);
+   _tab_drag->img = img;
+   elm_layout_content_set(o, "terminology.content", img);
+   evas_object_size_hint_min_get(term->core, &ch_w, &ch_h);
 
    edje_object_part_geometry_get(term->bg_edj, "tabmiddle",
-                                 &x, &y, &w, &h);
+                                 &x, &y, NULL, NULL);
    evas_object_geometry_get(term->bg_edj, &off_x, &off_y, NULL, NULL);
    evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
+   w = ch_w * 10;
+   h = ch_h * 5;
+   ratio = (float) core_w / (float) core_h;
+   if (h * ratio > w)
+     h = w / ratio;
+   else
+     w = h * ratio;
    evas_object_resize(o, w, h);
    evas_object_move(o, x + off_x, y + off_y);
    evas_object_raise(o);
    evas_object_show(o);
 
-   _tab_drag->icon = o;
-
    _tab_drag_save_state(tc);
    tc->parent->detach(tc->parent, tc);
    assert(term->tab_item == NULL);
@@ -5206,6 +5239,7 @@ _tabs_detach(Term_Container *tc, Term_Container 
*solo_child)
 
    o = solo_child->get_evas_object(solo_child);
    evas_object_hide(o);
+   solo_child->parent = (Term_Container*) solo_child->wn;
 }
 
 static Term_Container *

-- 


Reply via email to