Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_text.c ewl_text.h ewl_text_fmt.c ewl_text_trigger.c 
        ewl_text_trigger.h 


Log Message:
some work on selections and triggers, improves the most things, but 
re-introduce the entry selection delete bug, still need to figure out what that 
causes

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -3 -r1.176 -r1.177
--- ewl_text.c  17 Aug 2007 15:03:47 -0000      1.176
+++ ewl_text.c  18 Aug 2007 00:26:47 -0000      1.177
@@ -55,7 +55,6 @@
 static void ewl_text_trigger_position(Ewl_Text *t, Ewl_Text_Trigger *trig);
 
 static void ewl_text_trigger_add(Ewl_Text *t, Ewl_Text_Trigger *trigger);
-static void ewl_text_trigger_del(Ewl_Text *t, Ewl_Text_Trigger *trigger);
 
 static void ewl_text_selection_select_to(Ewl_Text_Trigger *s, 
                                                unsigned int char_idx);
@@ -130,7 +129,7 @@
        ewl_container_add_notify_set(EWL_CONTAINER(t), 
                                        ewl_text_cb_child_add);
        ewl_container_remove_notify_set(EWL_CONTAINER(t), 
-                                       ewl_text_cb_child_del);
+                                       ewl_text_cb_child_remove);
 
        t->dirty = TRUE;
 
@@ -2987,6 +2986,8 @@
                        /* if this would move us past our index, find the
                         * difference between our desired index and the
                         * current index and set that */
+                       /* XXX I thought evas uses for all things byte indices
+                        * shouldn't we transform thos char_idx to byte_idx? */
                        if ((cur_char_idx + pos) > char_idx)
                        {
                                evas_textblock_cursor_pos_set(cursor, 
@@ -3079,8 +3080,7 @@
 
                if (t->dirty) ewl_text_display(t);
 
-               /* XXX ewl_text_triggers_realize here? */
-               ewl_text_triggers_configure(t);
+               ewl_text_triggers_areas_place(t);
 
                /* re-configure the selection to make sure it resizes
                 * if needed */
@@ -3158,7 +3158,7 @@
                evas_object_show(t->textblock);
        }
 
-       ewl_text_triggers_realize(t);
+       ewl_text_triggers_areas_place(t);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -3269,10 +3269,10 @@
        t = EWL_TEXT(w);
 
        /* Note, we don't explictly destroy the triggers or the selection
-        * because they will be cleared as children of the text widget
-        * itself */
+        * because they will be cleared, because they are children of the 
+        * text widget itself */
        IF_FREE_LIST(t->triggers);
-       t->selection = NULL;
+       t->selection = t->selection = NULL;
 
        ewl_text_fmt_destroy(t->formatting.nodes);
        t->formatting.nodes = NULL;
@@ -3320,7 +3320,6 @@
 
                t->selection = tmp;
                sel = EWL_TEXT_TRIGGER(tmp);
-               sel->text_parent = t;
 
                ewl_text_trigger_start_pos_set(sel, 0);
                ewl_text_trigger_length_set(sel, 0);
@@ -3477,25 +3476,16 @@
 void
 ewl_text_cb_child_add(Ewl_Container *c, Ewl_Widget *w)
 {
-       char *appearance;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("c", c);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_TYPE("c", c, EWL_TEXT_TYPE);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
-       if (!(appearance = ewl_widget_appearance_get(w)))
-               DRETURN(DLEVEL_STABLE);
-
-       /* if this is a trigger then add it as such
-        * Note: we cannot do a simple type check here, because a text selection
-        * is also of the type EWL_TEXT_TRIGGER */
-       if (!strcmp(appearance, EWL_TEXT_TRIGGER_TYPE))
+       /* if this is a trigger then add it as such */
+       if (EWL_TEXT_TRIGGER_IS(w))
                ewl_text_trigger_add(EWL_TEXT(c), EWL_TEXT_TRIGGER(w));
 
-       FREE(appearance);
-
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
@@ -3505,29 +3495,37 @@
  * @param w: The widget to work with
  * @param idx: UNUSED
  * @return Returns no value
- * @brief The child del callback
+ * @brief The child remove callback
  */
 void
-ewl_text_cb_child_del(Ewl_Container *c, Ewl_Widget *w, int idx __UNUSED__)
+ewl_text_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx __UNUSED__)
 {
-       char *appearance;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("c", c);
        DCHECK_PARAM_PTR("w", w);
        DCHECK_TYPE("c", c, EWL_TEXT_TYPE);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
-       if (!(appearance = ewl_widget_appearance_get(w)))
-               DRETURN(DLEVEL_STABLE);
-
-       /* if this is a trigger, remove it as such
-        * Note: we cannot do a simple type check here, because a text selection
-        * is also of the type EWL_TEXT_TRIGGER */
-       if (!strcmp(appearance, EWL_TEXT_TRIGGER_TYPE))
-               ewl_text_trigger_del(EWL_TEXT(c), EWL_TEXT_TRIGGER(w));
-
-       FREE(appearance);
+       /* if it is a trigger, we need to treat it special */
+       if (EWL_TEXT_TRIGGER_IS(w)) {
+               Ewl_Text_Trigger *trigger;
+
+               trigger = EWL_TEXT_TRIGGER(w);
+               ewl_text_trigger_areas_cleanup(trigger);
+               trigger->text_parent = NULL;
+
+               if (trigger->type == EWL_TEXT_TRIGGER_TYPE_TRIGGER) {
+                       ecore_list_goto(EWL_TEXT(c)->triggers, trigger);
+                       ecore_list_remove(EWL_TEXT(c)->triggers);
+               }
+               else {
+                       /* for debug */
+                       if (EWL_TEXT(c)->selection != w)
+                               DWARNING("we are removing a selection, that"
+                                        "isn't our own. WTF is happened\n");
+                       EWL_TEXT(c)->selection = NULL;
+               }
+       }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -3630,7 +3628,6 @@
 
        while ((trig = ecore_list_first_remove(t->triggers))) 
        {
-               trig->text_parent = NULL;
                ewl_widget_destroy(EWL_WIDGET(trig));
        }
 
@@ -3737,7 +3734,7 @@
  * @brief Sets all of the triggers in the text @a t as realized
  */
 void
-ewl_text_triggers_realize(Ewl_Text *t)
+ewl_text_triggers_areas_place(Ewl_Text *t)
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("t", t);
@@ -3772,7 +3769,7 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("t", t);
        DCHECK_TYPE("t", t, EWL_TEXT_TYPE);
-
+       
        if (t->triggers)
        {
                ecore_list_first_goto(t->triggers);
@@ -3880,43 +3877,45 @@
        DCHECK_TYPE("t", t, EWL_TEXT_TYPE);
        DCHECK_TYPE("trigger", trigger, EWL_TEXT_TRIGGER_TYPE);
 
+       /* this code there is for both triggers and selections */
+       trigger->text_parent = t;
+       
+       /* the rest will be for real triggers only */
+       if (trigger->type == EWL_TEXT_TRIGGER_TYPE_SELECTION)
+               DRETURN(DLEVEL_STABLE);
+
        /* create the trigger list if needed */
        if (!t->triggers)
                t->triggers = ecore_list_new();
 
        /* if we have no length, we start past the end of the text, or we
         * extend past the end of the text then return an error */
-       if ((trigger->char_len == 0) || (trigger->char_pos > t->length.chars)
-                       || ((trigger->char_pos + trigger->char_len) > 
t->length.chars))
+       if ((trigger->char_len == 0) 
+               || ((trigger->char_pos + trigger->char_len) > t->length.chars))
                DRETURN(DLEVEL_STABLE);
 
-       trigger->text_parent = t;
 
-       /* only need to check for overlappign if this is a trigger (not a
-        * selection) */
-       if (trigger->type == EWL_TEXT_TRIGGER_TYPE_TRIGGER)
+       /* check now for overlapping */
+       ecore_list_first_goto(t->triggers);
+       while ((cur = ecore_list_next(t->triggers)))
        {
-               ecore_list_first_goto(t->triggers);
-               while ((cur = ecore_list_next(t->triggers)))
+               if (trigger->char_pos < cur->char_pos)
                {
-                       if (trigger->char_pos < cur->char_pos)
-                       {
-                               if ((trigger->char_pos + trigger->char_len) < 
cur->char_pos)
-                                       break;
+                       if ((trigger->char_pos + trigger->char_len) < 
cur->char_pos)
+                               break;
 
-                               DWARNING("Overlapping triggers are not 
allowed.");
-                               DRETURN(DLEVEL_STABLE);
-                       }
+                       DWARNING("Overlapping triggers are not allowed.");
+                       DRETURN(DLEVEL_STABLE);
+               }
 
-                       if ((trigger->char_pos > (cur->char_pos + 
cur->char_len)))
-                               continue;
+               if ((trigger->char_pos > (cur->char_pos + cur->char_len)))
+                       continue;
 
-                       if ((trigger->char_pos >= cur->char_pos) 
-                                               && (trigger->char_pos <= 
(cur->char_pos + cur->char_len)))
-                       {
-                               DWARNING("Overlapping triggers are not 
allowed.");
-                               DRETURN(DLEVEL_STABLE);
-                       }
+               if ((trigger->char_pos >= cur->char_pos) 
+                               && (trigger->char_pos <= (cur->char_pos + 
cur->char_len)))
+               {
+                       DWARNING("Overlapping triggers are not allowed.");
+                       DRETURN(DLEVEL_STABLE);
                }
        }
 
@@ -3933,26 +3932,5 @@
                ecore_list_append(t->triggers, trigger);
 
        DRETURN(DLEVEL_STABLE);
-}
-
-static void
-ewl_text_trigger_del(Ewl_Text *t, Ewl_Text_Trigger *trigger)
-{
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("t", t);
-       DCHECK_PARAM_PTR("trigger", trigger);
-       DCHECK_TYPE("t", t, EWL_TEXT_TYPE);
-       DCHECK_TYPE("trigger", trigger, EWL_TEXT_TRIGGER_TYPE);
-
-       /* nothign to do if we have no triggers */
-       if (!t->triggers)
-               DRETURN(DLEVEL_STABLE);
-
-       ecore_list_goto(t->triggers, trigger);
-       ecore_list_remove(t->triggers);
-
-       trigger->text_parent = NULL;
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- ewl_text.h  2 Aug 2007 22:56:47 -0000       1.57
+++ ewl_text.h  18 Aug 2007 00:26:47 -0000      1.58
@@ -87,6 +87,7 @@
        } formatting;           /**< Holds the formatting information */
 
        Ecore_List *triggers;     /**< The list of triggers */
+       Ecore_List *areas_cache;  /**< unused areas */
        Ewl_Widget *selection;    /**< The current selection */
 
        struct
@@ -297,7 +298,7 @@
 void ewl_text_cb_mouse_move(Ewl_Widget *w, void *ev, void *data);
 
 void ewl_text_cb_child_add(Ewl_Container *c, Ewl_Widget *w);
-void ewl_text_cb_child_del(Ewl_Container *c, Ewl_Widget *w, int idx);
+void ewl_text_cb_child_remove(Ewl_Container *c, Ewl_Widget *w, int idx);
 
 void ewl_text_trigger_cb_destroy(Ewl_Widget *w, void *ev, void *data);
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text_fmt.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_text_fmt.c      25 Jul 2007 17:01:00 -0000      1.4
+++ ewl_text_fmt.c      18 Aug 2007 00:26:47 -0000      1.5
@@ -438,7 +438,7 @@
        fmt->current_node.char_idx = 0;
        fmt->current_node.byte_idx = 0;
 
-       while ((fmt->current_node.char_idx + node->char_len) < idx)
+       while ((fmt->current_node.char_idx + node->char_len) <= idx)
        {
                fmt->current_node.char_idx += node->char_len;
                fmt->current_node.byte_idx += node->byte_len;
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text_trigger.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_text_trigger.c  17 Aug 2007 15:16:28 -0000      1.9
+++ ewl_text_trigger.c  18 Aug 2007 00:26:47 -0000      1.10
@@ -36,13 +36,23 @@
 struct Ewl_Text_Trigger_Area
 {
        Ewl_Widget widget;              /**< Inherits from Ewl_Widget */
-       unsigned int deleted;   /**< Is this area deleted */
+       Ewl_Text_Trigger *trigger;      /**< The parent trigger */
 };
 
 static Ewl_Widget *ewl_text_trigger_area_new();
 static int ewl_text_trigger_area_init(Ewl_Text_Trigger_Area *area);
+static Ewl_Widget *ewl_text_trigger_area_cached_get(Ewl_Text *t);
+static void ewl_text_trigger_area_cache(Ewl_Text *t, Ewl_Text_Trigger_Area *a);
 static void ewl_text_trigger_area_type_set(Ewl_Text_Trigger_Area *area,
                                        Ewl_Text_Trigger_Type type);
+static void ewl_text_trigger_area_cb_mouse_in(Ewl_Widget *w, void *ev,
+                                               void *data);
+static void ewl_text_trigger_area_cb_mouse_out(Ewl_Widget *w, void *ev,
+                                               void *data);
+static void ewl_text_trigger_area_cb_mouse_up(Ewl_Widget *w, void *ev,
+                                               void *data);
+static void ewl_text_trigger_area_cb_mouse_down(Ewl_Widget *w, void *ev,
+                                               void *data);
 
 /**
  * @param type: The type of trigger to create
@@ -136,22 +146,9 @@
 
        t = EWL_TEXT_TRIGGER(w);
 
-       if (t->areas)
-       {
-               Ewl_Text_Trigger_Area *area;
-
-               while ((area = ecore_list_first_remove(t->areas)))
-                       ewl_widget_destroy(EWL_WIDGET(area));
-
-               IF_FREE_LIST(t->areas);
-       }
-
-       /* remove ourself from the parents trigger list, if needed */
-       if ((t->text_parent) && (t->text_parent->triggers)
-                       && (ecore_list_goto(t->text_parent->triggers, t)))
-               ecore_list_remove(t->text_parent->triggers);
-
-       t->text_parent = NULL;
+       /* note we don't clean up the the list of areas, because it is
+        * up to the text widget to remove them on the child remove callback */
+       IF_FREE_LIST(t->areas);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -221,14 +218,7 @@
 
        /* if the length is set to 0 remove the areas */
        if (char_len == 0)
-       {
-               if (t->areas)
-               {
-                       Ewl_Text_Trigger_Area *area;
-                       while ((area = ecore_list_first_remove(t->areas)))
-                               ewl_widget_destroy(EWL_WIDGET(area));
-               }
-       }
+               ewl_text_trigger_areas_cleanup(t);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -303,20 +293,11 @@
        DCHECK_TYPE("t", t, EWL_TEXT_TYPE);
        DCHECK_TYPE("cur", cur, EWL_TEXT_TRIGGER_TYPE);
 
-       area = ewl_text_trigger_area_new();
+       area = ewl_text_trigger_area_cached_get(t);
        ewl_text_trigger_area_type_set(EWL_TEXT_TRIGGER_AREA(area), cur->type);
-       ewl_container_child_append(EWL_CONTAINER(t), area);
-       ewl_widget_internal_set(area, TRUE);
        ewl_object_geometry_request(EWL_OBJECT(area), x, y, w, h);
+       EWL_TEXT_TRIGGER_AREA(area)->trigger = cur;
 
-       ewl_callback_append(area, EWL_CALLBACK_MOUSE_IN, 
-                       ewl_text_trigger_cb_mouse_in, cur);
-       ewl_callback_append(area, EWL_CALLBACK_MOUSE_OUT,
-                       ewl_text_trigger_cb_mouse_out, cur);
-       ewl_callback_append(area, EWL_CALLBACK_MOUSE_DOWN,
-                       ewl_text_trigger_cb_mouse_down, cur);
-       ewl_callback_append(area, EWL_CALLBACK_MOUSE_UP,
-                       ewl_text_trigger_cb_mouse_up, cur);
        ewl_widget_show(area);
 
        if (!cur->areas) cur->areas = ecore_list_new();
@@ -343,7 +324,7 @@
                Ewl_Text_Trigger_Area *area;
 
                while ((area = ecore_list_first_remove(trig->areas)))
-                       ewl_widget_destroy(EWL_WIDGET(area));
+                       ewl_text_trigger_area_cache(trig->text_parent, area);
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -379,102 +360,6 @@
 }
 
 /**
- * @internal
- * @param w: UNUSED
- * @param ev: The event data
- * @param data: The Ewl_Text_Trigger
- * @return Returns no value
- * @brief The trigger mouse in callback
- */
-void
-ewl_text_trigger_cb_mouse_in(Ewl_Widget *w __UNUSED__, void *ev, void *data)
-{
-       Ewl_Text_Trigger *trigger;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("data", data);
-       DCHECK_TYPE("data", data, EWL_TEXT_TRIGGER_TYPE);
-
-       trigger = data;
-       ewl_callback_call_with_event_data(EWL_WIDGET(trigger), 
-                                               EWL_CALLBACK_MOUSE_IN, ev);
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: UNUSED
- * @param ev: The event data
- * @param data: The Ewl_Text_Trigger
- * @return Returns no value
- * @brief The trigger mouse out callback
- */
-void
-ewl_text_trigger_cb_mouse_out(Ewl_Widget *w __UNUSED__, void *ev, void *data)
-{
-       Ewl_Text_Trigger *trigger;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("data", data);
-       DCHECK_TYPE("data", data, EWL_TEXT_TRIGGER_TYPE);
-
-       trigger = data;
-       ewl_callback_call_with_event_data(EWL_WIDGET(trigger), 
-                                               EWL_CALLBACK_MOUSE_OUT, ev);
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: UNUSED
- * @param ev: The event data
- * @param data: The Ewl_Text_Trigger
- * @return Returns no value
- * @brief The trigger mouse up callback
- */
-void
-ewl_text_trigger_cb_mouse_up(Ewl_Widget *w __UNUSED__, void *ev, void *data)
-{
-       Ewl_Text_Trigger *trigger;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("data", data);
-       DCHECK_TYPE("data", data, EWL_TEXT_TRIGGER_TYPE);
-
-       trigger = data;
-       ewl_callback_call_with_event_data(EWL_WIDGET(trigger),
-                                               EWL_CALLBACK_MOUSE_UP, ev);
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
- * @internal
- * @param w: UNUSED
- * @param ev: The event data
- * @param data: The Ewl_Text_Trigger
- * @return Returns no value
- * @brief The trigger mouse down callback
- */
-void
-ewl_text_trigger_cb_mouse_down(Ewl_Widget *w __UNUSED__, void *ev, void *data)
-{
-       Ewl_Text_Trigger *trigger;
-
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR("data", data);
-       DCHECK_TYPE("data", data, EWL_TEXT_TRIGGER_TYPE);
-
-       trigger = data;
-       ewl_callback_call_with_event_data(EWL_WIDGET(trigger), 
-                                               EWL_CALLBACK_MOUSE_DOWN, ev);
-
-       DLEAVE_FUNCTION(DLEVEL_STABLE);
-}
-
-/**
  * @param w: The trigger to work with
  * @param ev: UNUSED
  * @param data: UNUSED
@@ -589,16 +474,28 @@
 static int
 ewl_text_trigger_area_init(Ewl_Text_Trigger_Area *area)
 {
+       Ewl_Widget *w;
+
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("area", area, FALSE);
 
-       if (!ewl_widget_init(EWL_WIDGET(area)))
+       w = EWL_WIDGET(area);
+
+       if (!ewl_widget_init(w))
                DRETURN_INT(FALSE, DLEVEL_STABLE);
 
-       ewl_widget_inherit(EWL_WIDGET(area), EWL_TEXT_TRIGGER_AREA_TYPE);
+       ewl_widget_inherit(w, EWL_TEXT_TRIGGER_AREA_TYPE);
 
-       ewl_widget_focusable_set(EWL_WIDGET(area), FALSE);
-       ewl_widget_internal_set(EWL_WIDGET(area), TRUE);
+       ewl_widget_focusable_set(w, FALSE);
+       ewl_widget_internal_set(w, TRUE);
+       ewl_callback_append(w, EWL_CALLBACK_MOUSE_IN, 
+                       ewl_text_trigger_area_cb_mouse_in, NULL);
+       ewl_callback_append(w, EWL_CALLBACK_MOUSE_OUT,
+                       ewl_text_trigger_area_cb_mouse_out, NULL);
+       ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
+                       ewl_text_trigger_area_cb_mouse_down, NULL);
+       ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
+                       ewl_text_trigger_area_cb_mouse_up, NULL);
 
        DRETURN_INT(TRUE, DLEVEL_STABLE);
 }
@@ -628,5 +525,156 @@
                ewl_widget_color_set(EWL_WIDGET(area), 255, 255, 255, 255);
 
        DRETURN(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param t: The Ewl_Text parent
+ * @return Returns no value
+ */
+static Ewl_Widget *
+ewl_text_trigger_area_cached_get(Ewl_Text *t)
+{
+       Ewl_Widget *area;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR_RET("t", t, NULL);
+       DCHECK_TYPE_RET("t", t, EWL_TEXT_TYPE, NULL);
+
+       if (t->areas_cache && !ecore_list_empty_is(t->areas_cache))
+               area = ecore_list_first_remove(t->areas_cache);
+       else {
+               area = ewl_text_trigger_area_new();
+               ewl_container_child_append(EWL_CONTAINER(t), area);
+       }
+
+       DRETURN_PTR(area, DLEVEL_STABLE);
+}
+
+static void
+ewl_text_trigger_area_cache(Ewl_Text *t, Ewl_Text_Trigger_Area *area)
+{
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("t", t);
+       DCHECK_PARAM_PTR("area", area);
+       DCHECK_TYPE("t", t, EWL_TEXT_TYPE);
+       DCHECK_TYPE("area", area, EWL_TEXT_TRIGGER_AREA_TYPE);
+
+       area->trigger = NULL;
+       ewl_widget_hide(EWL_WIDGET(area));
+
+       if (DESTROYED(t) || DESTROYED(area))
+               DRETURN(DLEVEL_STABLE);
+
+       if (!t->areas_cache)
+               t->areas_cache = ecore_list_new();
+
+       ecore_list_append(t->areas_cache, area);        
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: The trigger area
+ * @param ev: The event data
+ * @param data: UNUSED
+ * @return Returns no value
+ * @brief The trigger area mouse in callback
+ */
+void
+ewl_text_trigger_area_cb_mouse_in(Ewl_Widget *w, void *ev, 
+                                       void *data __UNUSED__)
+{
+       Ewl_Text_Trigger_Area *a;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, EWL_TEXT_TRIGGER_AREA_TYPE);
+
+       a = EWL_TEXT_TRIGGER_AREA(w);
+       if (a->trigger)
+               ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger), 
+                                               EWL_CALLBACK_MOUSE_IN, ev);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: The trigger area
+ * @param ev: The event data
+ * @param data: UNUSED
+ * @return Returns no value
+ * @brief The trigger area mouse out callback
+ */
+void
+ewl_text_trigger_area_cb_mouse_out(Ewl_Widget *w, void *ev, 
+                                               void *data __UNUSED__)
+{
+       Ewl_Text_Trigger_Area *a;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, EWL_TEXT_TRIGGER_AREA_TYPE);
+
+       a = EWL_TEXT_TRIGGER_AREA(w);
+       if (a->trigger)
+               ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger), 
+                                               EWL_CALLBACK_MOUSE_OUT, ev);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: the trigger area
+ * @param ev: The event data
+ * @param data: The Ewl_Text_Trigger
+ * @return Returns no value
+ * @brief The trigger area mouse up callback
+ */
+void
+ewl_text_trigger_area_cb_mouse_up(Ewl_Widget *w, void *ev, 
+                                       void *data __UNUSED__)
+{
+       Ewl_Text_Trigger_Area *a;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, EWL_TEXT_TRIGGER_AREA_TYPE);
+
+       a = EWL_TEXT_TRIGGER_AREA(w);
+       if (a->trigger)
+               ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger), 
+                                               EWL_CALLBACK_MOUSE_UP, ev);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
+}
+
+/**
+ * @internal
+ * @param w: the area
+ * @param ev: The event data
+ * @param data: UNUSED
+ * @return Returns no value
+ * @brief The trigger mouse down callback
+ */
+void
+ewl_text_trigger_area_cb_mouse_down(Ewl_Widget *w, void *ev, 
+                                       void *data __UNUSED__)
+{
+       Ewl_Text_Trigger_Area *a;
+
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
+       DCHECK_TYPE("w", w, EWL_TEXT_TRIGGER_AREA_TYPE);
+
+       a = EWL_TEXT_TRIGGER_AREA(w);
+       if (a->trigger)
+               ewl_callback_call_with_event_data(EWL_WIDGET(a->trigger), 
+                                               EWL_CALLBACK_MOUSE_DOWN, ev);
+
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text_trigger.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_text_trigger.h  18 Jul 2007 14:43:32 -0000      1.3
+++ ewl_text_trigger.h  18 Aug 2007 00:26:47 -0000      1.4
@@ -77,22 +77,19 @@
 void            ewl_text_trigger_areas_cleanup(Ewl_Text_Trigger *trig);
 
 /*
- * Internal stuff
+ * Internal stuff  
  */
-void ewl_text_triggers_configure(Ewl_Text *t);
-void ewl_text_triggers_realize(Ewl_Text *t);
-void ewl_text_triggers_unrealize(Ewl_Text *t);
-void ewl_text_triggers_show(Ewl_Text *t);
-void ewl_text_triggers_hide(Ewl_Text *t);
-
 void ewl_text_trigger_cb_show(Ewl_Widget *w, void *ev, void *data);
 void ewl_text_trigger_cb_hide(Ewl_Widget *w, void *ev, void *data);
 void ewl_text_trigger_cb_configure(Ewl_Widget *w, void *ev, void *data);
 void ewl_text_trigger_cb_unrealize(Ewl_Widget *w, void *ev, void *data);
-void ewl_text_trigger_cb_mouse_in(Ewl_Widget *w, void *ev, void *data);
-void ewl_text_trigger_cb_mouse_out(Ewl_Widget *w, void *ev, void *data);
-void ewl_text_trigger_cb_mouse_up(Ewl_Widget *w, void *ev, void *data);
-void ewl_text_trigger_cb_mouse_down(Ewl_Widget *w, void *ev, void *data);
+
+/* you find these functions in ewl_text.c */
+void ewl_text_triggers_configure(Ewl_Text *t);
+void ewl_text_triggers_areas_place(Ewl_Text *t);
+void ewl_text_triggers_unrealize(Ewl_Text *t);
+void ewl_text_triggers_show(Ewl_Text *t);
+void ewl_text_triggers_hide(Ewl_Text *t);
 
 /**
  * @}



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to