This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository exclaim.

View the commit online.

commit b30cae39d2f6873b728cd6337794b32f30ba81a0
Author: Nekobit <m...@ow.nekobit.net>
AuthorDate: Wed Sep 20 23:11:20 2023 -0400

    Improve statuses
---
 src/explode.c   | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/main.c      |   5 ++
 src/meson.build |   1 +
 src/status.c    | 117 ++++++++++++++++++++++++-------
 4 files changed, 309 insertions(+), 23 deletions(-)

diff --git a/src/explode.c b/src/explode.c
new file mode 100644
index 0000000..0d034ba
--- /dev/null
+++ b/src/explode.c
@@ -0,0 +1,209 @@
+#include <Elementary.h>
+
+static Evas_Object *target = NULL;
+static Ecore_Animator *anim = NULL;
+
+static Eina_List *mirrors = NULL;
+
+static Eina_Bool
+_cb_anim(void *data EINA_UNUSED, double pos)
+{
+   Eina_List *l;
+   Evas_Object *o;
+   double v = ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0);
+   Evas_Coord x, y, w, h;
+   Evas_Coord vw, vh;
+   int tot;
+
+   evas_output_viewport_get(evas_object_evas_get(target), NULL, NULL, &vw, &vh);
+   evas_object_geometry_get(target, &x, &y, &w, &h);
+   tot = (eina_list_count(mirrors) + 2) / 2;
+   EINA_LIST_FOREACH(mirrors, l, o)
+     {
+        Evas_Map *m = evas_map_new(4);
+        int n = (int)((uintptr_t)evas_object_data_get(o, "stack"));
+        double ang = (((double)(n + 1) * 180.0) / (double)tot);
+        evas_map_util_points_populate_from_object(m, o);
+        //evas_map_util_3d_rotate(m, ang * v / 1.0, ang * v, 0,
+        //                        x + w + (w / 2), y + (h / 2), 315);
+		evas_map_util_3d_rotate(m, -10 * v, 20 * v, 0, x + (w/2), y + (h/2), ang * v);
+        //evas_map_util_3d_perspective(m, vw / 2, vh / 2, 0, vw + vh);
+        evas_object_map_set(o, m);
+        evas_map_free(m);
+        evas_object_map_enable_set(o, EINA_TRUE);
+     }
+   if (pos >= 1.0) anim = NULL;
+   return EINA_TRUE;
+}
+
+static int
+explode_obj(Evas_Object *obj, int n)
+{
+   Eina_List *children = NULL;
+   Evas_Object *o;
+   Evas *e;
+
+   e = evas_object_evas_get(obj);
+   children = evas_object_smart_members_get(obj);
+   if (!children)
+     {
+        Evas_Object *m;
+        Evas_Coord x, y, w, h;
+
+        evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+        m = evas_object_image_filled_add(e);
+        mirrors = eina_list_append(mirrors, m);
+        evas_object_anti_alias_set(m, EINA_TRUE);
+        evas_object_image_source_clip_set(m, EINA_FALSE);
+        evas_object_pass_events_set(m, EINA_TRUE);
+        evas_object_image_source_set(m, obj);
+        evas_object_image_source_visible_set(m, EINA_FALSE);
+        evas_object_layer_set(m, EVAS_LAYER_MAX - 10);
+        evas_object_move(m, x, y);
+        evas_object_resize(m, w, h);
+        evas_object_show(m);
+        evas_object_color_set(m, 0, 0, 0, 128);
+        evas_object_data_set(m, "stack", (void *)((uintptr_t)n));
+
+        n++;
+
+        m = evas_object_image_filled_add(e);
+        mirrors = eina_list_append(mirrors, m);
+        evas_object_anti_alias_set(m, EINA_TRUE);
+        evas_object_image_source_clip_set(m, EINA_FALSE);
+        evas_object_pass_events_set(m, EINA_TRUE);
+        evas_object_image_source_set(m, obj);
+        evas_object_image_source_visible_set(m, EINA_FALSE);
+        evas_object_layer_set(m, EVAS_LAYER_MAX - 10);
+        evas_object_move(m, x, y);
+        evas_object_resize(m, w, h);
+        evas_object_show(m);
+        evas_object_data_set(m, "stack", (void *)((uintptr_t)n));
+     }
+   else
+     {
+        EINA_LIST_FREE(children, o)
+          {
+             if (!evas_object_visible_get(o)) continue;
+             if (evas_object_clipees_has(o)) continue;
+
+             n = explode_obj(o, n);
+          }
+     }
+   return n;
+}
+
+static void
+explode(Evas_Object *obj)
+{
+   Evas_Object *o;
+
+   EINA_LIST_FREE(mirrors, o) evas_object_del(o);
+   if (!obj) return;
+
+   explode_obj(obj, 0);
+   if (!anim) anim = ecore_animator_timeline_add(1.0, _cb_anim, NULL);
+}
+
+static void
+_cb_target_del(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
+               Evas_Object *obj, void *info EINA_UNUSED)
+{
+   if (obj == target)
+     {
+        if (anim)
+          {
+             ecore_animator_del(anim);
+             anim = NULL;
+          }
+        explode(NULL);
+        target = NULL;
+     }
+}
+
+static void
+_cb_catcher_down(void *data, Evas *e,
+                 Evas_Object *obj EINA_UNUSED, void *info)
+{
+   Evas_Event_Mouse_Down *ev = info;
+
+   if (target)
+     {
+        evas_object_event_callback_del_full(target, EVAS_CALLBACK_DEL,
+                                            _cb_target_del, data);
+        if (anim)
+          {
+             ecore_animator_del(anim);
+             anim = NULL;
+          }
+        explode(NULL);
+        target = NULL;
+     }
+   if ((ev->button == 2) &&
+       (evas_key_modifier_is_set(ev->modifiers, "Control")))
+     {
+        Eina_List *objs;
+
+        objs = evas_tree_objects_at_xy_get(e, NULL, ev->canvas.x, ev->canvas.y);
+        if (objs)
+          {
+             Eina_List *l;
+             Evas_Object *lobj, *parent;
+
+             target = NULL;
+             EINA_LIST_FOREACH(objs, l, lobj)
+               {
+                  if (evas_object_data_get(lobj, "::catcher::")) continue;
+                  if (evas_object_repeat_events_get(lobj))
+                    {
+                       int r, g, b, a;
+                       evas_object_color_get(lobj, &r, &g, &b, &a);
+                       if ((r == 0) && (g == 0) && (b == 0) && (a == 0)) continue;
+                    }
+                  if (elm_object_widget_check(lobj))
+                    {
+                       target = lobj;
+                       break;
+                    }
+                  else
+                    {
+                       for (parent = lobj; parent != NULL;
+                            parent = elm_object_parent_widget_get(parent))
+                         {
+                            if (elm_object_widget_check(parent))
+                              {
+                                 target = parent;
+                                 break;
+                              }
+                         }
+                       if (target) break;
+                    }
+               }
+             if (target)
+               {
+                  evas_object_event_callback_add(target, EVAS_CALLBACK_DEL,
+                                                 _cb_target_del, data);
+                  eina_list_free(objs);
+                  explode(target);
+               }
+          }
+     }
+}
+
+void
+explode_win_enable(Evas_Object *win)
+{
+   Evas *e = evas_object_evas_get(win);
+
+   Evas_Object *catcher = evas_object_rectangle_add(e);
+   evas_object_layer_set(catcher, EVAS_LAYER_MAX);
+   evas_object_color_set(catcher, 0, 0, 0, 0);
+   evas_object_resize(catcher, 99999, 99999);
+   evas_object_repeat_events_set(catcher, EINA_TRUE);
+   evas_object_data_set(catcher, "::catcher::", catcher);
+   evas_object_show(catcher);
+
+   evas_object_event_callback_add(catcher, EVAS_CALLBACK_MOUSE_DOWN,
+                                  _cb_catcher_down, win);
+}
diff --git a/src/main.c b/src/main.c
index 46c3266..49673e2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,6 +4,9 @@
 #include "etc.h"
 #include "status.h"
 
+void
+explode_win_enable(Evas_Object* win);
+
 EAPI_MAIN int
 elm_main(int argc, char** argv)
 {
@@ -18,6 +21,8 @@ elm_main(int argc, char** argv)
 	elm_win_icon_name_set(win, "email-unread");
 	elm_win_autodel_set(win, EINA_TRUE);
 	
+	explode_win_enable(win);
+
 	Evas_Object* status_scr = E_SHOW(elm_scroller_add(win));
 	E_BEGIN(status_scr);
 		evas_object_fullsize(status_scr);
diff --git a/src/meson.build b/src/meson.build
index 58f4db6..618c23d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -4,6 +4,7 @@ executable('exclaim', [
 		'main.c',
 		'status.c',
 		'etc.c',
+		'explode.c',
 	],
 	include_directories: inc,
 	dependencies: deps,
diff --git a/src/status.c b/src/status.c
index a3167ff..c5d9c81 100644
--- a/src/status.c
+++ b/src/status.c
@@ -3,78 +3,149 @@
 #include "etc.h"
 
 #define PFP_ICON_SIZE 48
+#define INTERACT_ICON_SIZE 18
 
 Evas_Object*
 exc_status_add(Evas_Object* parent, struct exc_status status)
 {
+	Evas_Object* o, *ico;
 	Evas_Object* root = elm_table_add(parent);
-	evas_object_size_hint_min_set(root, 300, 300);
-
-	Evas_Object* st_frame = E_SHOW(elm_frame_add(root));
+	E_BEGIN(root);
+		Evas_Object* root_evas = evas_object_rectangle_add(evas_object_evas_get(parent));
+		E_BEGIN(root_evas);
+			evas_object_size_hint_weight_set(root_evas, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+			evas_object_size_hint_min_set(root_evas, 400, 10);
+			elm_table_pack(root, root_evas, 0, 0, 1, 1);
+		E_END(root_evas);
+	E_END(root); // Returned and packed into later
+	
+	Evas_Object* st_frame = E_SHOW(elm_frame_add(parent));
 	E_BEGIN(st_frame);
-	elm_table_pack(root, st_frame, 0, 0, 1, 1);
+	elm_table_pack(root, st_frame, 0, 0, 1, 1); // Pad hack
 	evas_object_size_hint_padding_set(st_frame, 3, 3, 3, 3);
-	//evas_object_fullsize(st_frame);
-	evas_object_size_hint_weight_set(st_frame, 1, 0);
-	evas_object_size_hint_align_set (st_frame, -1, 0.0);
-	//evas_object_size_hint_min_set(st_frame, 300, 300);
-	
+	evas_object_fullsize(st_frame);
 
 	Evas_Object* st_box = E_SHOW(elm_box_add(st_frame));
 	E_BEGIN(st_box);
-		//evas_object_size_hint_min_set(st_box, 300, 300);
-		//evas_object_size_hint_weight_set(st_box, 300, 300);
+		elm_table_pack(root, st_box, 0, 0, 1, 1); // Pad hack
+		evas_object_fullsize(st_box);
 		elm_box_horizontal_set(st_box, EINA_TRUE);
 		
 		// Add pfp icon
 		Evas_Object* st_icon = E_SHOW(elm_icon_add(st_box));
 		E_BEGIN(st_icon);
-			evas_object_size_hint_align_set(st_icon, 0.5, 0.0);
+			evas_object_size_hint_align_set(st_icon, 0.0, 0.0);
 			evas_object_size_hint_min_set(st_icon, PFP_ICON_SIZE, PFP_ICON_SIZE);
 			evas_object_size_hint_max_set(st_icon, PFP_ICON_SIZE, PFP_ICON_SIZE);
-			evas_object_size_hint_padding_set(st_icon, 3, 5, 3, 3);
-			elm_icon_standard_set(st_icon, "minetest");
+			evas_object_size_hint_padding_set(st_icon, 12, 8, 3, 8);
+			elm_icon_standard_set(st_icon, "user-away");
 			elm_box_pack_end(st_box, st_icon);
 		E_END(st_icon);
 		
 		Evas_Object* st_box_rt = E_SHOW(elm_box_add(st_box));
 		E_BEGIN(st_box_rt);
-			evas_object_size_hint_align_set(st_box_rt, 0.5, 0.0);
+			evas_object_fullsize(st_box_rt);
+			//evas_object_size_hint_align_set(st_box_rt, 0.0, 0.0);
 			
 			Evas_Object* st_box_rt_info = E_SHOW(elm_box_add(st_box_rt));
 			E_BEGIN(st_box_rt_info);
+				evas_object_size_hint_align_set(st_box_rt_info, 0.0, 0.0);
 				elm_box_horizontal_set(st_box_rt_info, EINA_TRUE);
-				evas_object_size_hint_padding_set(st_box_rt_info, 3, 3, 3, 3);
+				evas_object_size_hint_padding_set(st_box_rt_info, 4,4,2,4);
+				
 				Evas_Object* st_username = E_SHOW(elm_label_add(st_box));
 				E_BEGIN(st_username);
-					elm_object_text_set(st_username, "Status");
+					elm_object_text_set(st_username, "Average poster");
 					
 					elm_box_pack_end(st_box_rt_info, st_username);
 				E_END(st_username);
 				
+				Evas_Object* st_acct = E_SHOW(elm_label_add(st_box));
+				E_BEGIN(st_acct);
+					Eina_Strbuf* acctstr = eina_strbuf_new();
+					eina_strbuf_append_printf(acctstr, "@<b>%s</b>@%s",
+					                          "user", "instance.com");
+					elm_object_text_set(st_acct, eina_strbuf_string_get(acctstr));
+					free(eina_strbuf_release(acctstr));
+					evas_object_size_hint_padding_set(st_acct, 8, 0, 0, 0);
+					
+					elm_box_pack_end(st_box_rt_info, st_acct);
+				E_END(st_acct);
+				
 				elm_box_pack_end(st_box_rt, st_box_rt_info);
 			E_END(st_box_rt_info);
 			
 			Evas_Object* st_content = E_SHOW(elm_entry_add(st_box));
 			E_BEGIN(st_content);
-				elm_object_text_set(st_username, "Status");
+				evas_object_fullsize(st_content);
 
-				//evas_object_size_hint_min_set(st_content, 300, 300);
-				
-				evas_object_size_hint_weight_set(st_content, 1, 1);
-				
 				elm_entry_editable_set(st_content, EINA_FALSE);
 				elm_entry_single_line_set(st_content, EINA_FALSE);
 				elm_object_text_set(st_content, "Lol, lmao. <b>LOL</> even");
 				elm_box_pack_end(st_box_rt, st_content);
 			E_END(st_content);
+			
+			Evas_Object* st_interact = E_SHOW(elm_box_add(st_box));
+			E_BEGIN(st_interact);
+				elm_box_horizontal_set(st_interact, EINA_TRUE);
+				evas_object_size_hint_align_set(st_interact, 0, 0);
+				
+				o = E_SHOW(elm_button_add(st_interact));
+				E_BEGIN(o) // Reply
+					//elm_object_text_set(o, "Reply");
+					ico = E_SHOW(elm_icon_add(st_interact));
+					elm_icon_standard_set(ico, "object-rotate-left");
+					evas_object_size_hint_min_set(ico, INTERACT_ICON_SIZE, INTERACT_ICON_SIZE);
+					elm_object_content_set(o, ico);
+					elm_object_style_set(o, "blank");
+					//elm_object_style_set(o, "anchor");
+					elm_box_pack_end(st_interact, o);
+				E_END(o)
+
+				o = E_SHOW(elm_button_add(st_interact));
+				E_BEGIN(o) // Repeat
+					//elm_object_text_set(o, "Repeat");
+					ico = E_SHOW(elm_icon_add(st_interact));
+					elm_icon_standard_set(ico, "media-playlist-repeat");
+					evas_object_size_hint_min_set(ico, INTERACT_ICON_SIZE, INTERACT_ICON_SIZE);
+					elm_object_content_set(o, ico);
+					elm_object_style_set(o, "blank");
+					//elm_object_style_set(o, "anchor");
+					elm_box_pack_end(st_interact, o);
+				E_END(o)
+				
+				o = E_SHOW(elm_button_add(st_interact));
+				E_BEGIN(o) // Like
+					//elm_object_text_set(o, "Like");
+					ico = E_SHOW(elm_icon_add(st_interact));
+					elm_icon_standard_set(ico, "starred");
+					evas_object_size_hint_min_set(ico, INTERACT_ICON_SIZE, INTERACT_ICON_SIZE);
+					elm_object_content_set(o, ico);
+					elm_object_style_set(o, "blank");
+					//elm_object_style_set(o, "anchor");
+					elm_box_pack_end(st_interact, o);
+				E_END(o)
+				
+				o = E_SHOW(elm_button_add(st_interact));
+				E_BEGIN(o) // React
+					//elm_object_text_set(o, "React");
+					ico = E_SHOW(elm_icon_add(st_interact));
+					elm_icon_standard_set(ico, "zoom-in");
+					evas_object_size_hint_min_set(ico, INTERACT_ICON_SIZE - 4, INTERACT_ICON_SIZE - 4);
+					elm_object_content_set(o, ico);
+					elm_object_style_set(o, "blank");
+					//elm_object_style_set(o, "anchor");
+					elm_box_pack_end(st_interact, o);
+				E_END(o)
+
+				elm_box_pack_end(st_box_rt, st_interact);
+			E_END(st_interact);
 
 			elm_box_pack_end(st_box, st_box_rt);
 		E_BEGIN(st_box_rt);
 
 		elm_object_content_set(st_frame, st_box);
 		elm_widget_style_set(st_frame, "outline");
-		//elm_widget_theme_object_set(st_frame, NULL, "focus_highlight", "top", "notify");
 	E_END(st_box);
 	
 	E_END(st_frame);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to