ihyoyoung,
can you please add some comments on elm_cnp documentation?
I have no knowledge about copy and paste, and it's hard to understand with
current description.
Thanks in advance.

Daniel Juyung Seo (SeoZ)

On Thu, Feb 16, 2012 at 4:06 PM, Enlightenment SVN <
[email protected]> wrote:

> Log:
> elm cnp: Reviewed cnp APIs. Many things need to be changed.
>
>  Signed-off-by: Daniel Juyung Seo <[email protected]>
>
> Author:       seoz
> Date:         2012-02-15 23:06:13 -0800 (Wed, 15 Feb 2012)
> New Revision: 68007
> Trac:         http://trac.enlightenment.org/e/changeset/68007
>
> Modified:
>  trunk/elementary/src/lib/Elementary.h.intrunk/elementary/src/lib/elm_cnp.h 
> trunk/elementary/src/lib/elm_cnp_helper.c
>
> Modified: trunk/elementary/src/lib/Elementary.h.in
> ===================================================================
> --- trunk/elementary/src/lib/Elementary.h.in    2012-02-16 07:06:09 UTC
> (rev 68006)
> +++ trunk/elementary/src/lib/Elementary.h.in    2012-02-16 07:06:13 UTC
> (rev 68007)
> @@ -184,7 +184,7 @@
>  #include <elm_calendar.h>
>  #include <elm_check.h>
>  #include <elm_clock.h>
> -#include <elm_cnp.h>
> +#include <elm_cnp.h> // comments in elm_cnp.h
>  #include <elm_colorselector.h>
>  #include <elm_config.h>
>  #include <elm_conform.h>
>
> Modified: trunk/elementary/src/lib/elm_cnp.h
> ===================================================================
> --- trunk/elementary/src/lib/elm_cnp.h  2012-02-16 07:06:09 UTC (rev 68006)
> +++ trunk/elementary/src/lib/elm_cnp.h  2012-02-16 07:06:13 UTC (rev 68007)
> @@ -45,13 +45,13 @@
>  };
>
>  /**
> - * @brief Set a data of a widget to copy and paste.
> + * @brief Set copy and paste data to a widget.
>  *
> - * Append the given callback to the list. This functions will be called
> - * called.
> + * XXX: need to be rewritten.
> + * Append the given callback to the list. This functions will be called.
>  *
> - * @param selection selection type for copying and pasting
> - * @param widget The source widget pointer
> + * @param selection Selection type for copying and pasting
> + * @param obj The source widget pointer
>  * @param format Type of selection format
>  * @param buf The pointer of data source
>  * @return If EINA_TRUE, setting data is success.
> @@ -59,20 +59,24 @@
>  * @ingroup CopyPaste
>  *
>  */
> +// XXX: EAPI void elm_object_cnp_selection_set(Evas_Object *obj,
> Elm_Sel_Type selection,
> +//                                             Elm_Sel_Format format,
> const void *buf,
> +//                                             size_t buflen);
> +EAPI Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object
> *obj,
> +                                     Elm_Sel_Format format, const void
> *buf,
> +                                     size_t buflen);
>
> -EAPI Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object
> *widget, Elm_Sel_Format format, const void *buf, size_t buflen);
> -
>  /**
> - * @brief Retrieve the data from the widget which is set for copying and
> pasting.
> + * @brief Retrieve the copy and paste data from the widget.
>  *
> - * Getting the data from the widget which is set for copying and pasting.
> - * Mainly the widget is elm_entry. If then @p datacb and @p udata are
> - * can be NULL. If not, @p datacb and @p udata are used for retrieving
> data.
> + * Gets the data from the widget which is set for copying and pasting.
> + * Mainly the widget is elm_entry. If then @p datacb and @p udata can be
> NULL.
> + * If not, @p datacb and @p udata are used for retrieving data.
>  *
>  * @see also elm_cnp_selection_set()
>  *
> - * @param selection selection type for copying and pasting
> - * @param widget The source widget pointer
> + * @param selection Selection type for copying and pasting
> + * @param obj The source widget pointer
>  * @param datacb The user data callback if the target widget isn't
> elm_entry
>  * @param udata The user data pointer for @p datacb
>  * @return If EINA_TRUE, getting data is success.
> @@ -80,26 +84,38 @@
>  * @ingroup CopyPaste
>  *
>  */
> +// XXX: This api needs to be refined by cnp experts.
> +//      I suggest:
> +//         1. return copy and paste data.
> +//         2. call cnp callback regardless of widget type.
> +//         3. apps insert text data into entry manually.
> +// XXX: EAPI void *elm_object_cnp_selection_get(Evas_Object *obj,
> +//                                              Elm_Sel_Type selection,
> +//                                              Elm_Sel_Format format,
> +//                                              Elm_Cnp_Cb datacb);
> +EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection,
> +                                     Elm_Sel_Format format, Evas_Object
> *obj,
> +                                     Elm_Drop_Cb datacb, void *udata);
>
> -EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection,
> Elm_Sel_Format format, Evas_Object *widget, Elm_Drop_Cb datacb, void
> *udata);
> -
>  /**
> - * @brief Clear the data in the widget which is set for copying and
> pasting.
> + * @brief Clear the copy and paste data in the widget.
>  *
>  * Clear the data in the widget. Normally this function isn't need to call.
>  *
>  * @see also elm_cnp_selection_set()
>  *
> - * @param selection selection type for copying and pasting
> + * @param selection Selection type for copying and pasting
>  * @param widget The source widget pointer
>  * @return If EINA_TRUE, clearing data is success.
>  *
>  * @ingroup CopyPaste
>  *
>  */
> +// XXX: EAPI void elm_object_cnp_selection_clear(Evas_Object *obj,
> +//                                               Elm_Sel_Type selection);
> +EAPI Eina_Bool elm_cnp_selection_clear(Elm_Sel_Type selection,
> +                                       Evas_Object *obj);
>
> -EAPI Eina_Bool elm_cnp_selection_clear(Elm_Sel_Type selection,
> Evas_Object *widget);
> -
>  /**
>  * @}
>  */
>
> Modified: trunk/elementary/src/lib/elm_cnp_helper.c
> ===================================================================
> --- trunk/elementary/src/lib/elm_cnp_helper.c   2012-02-16 07:06:09 UTC
> (rev 68006)
> +++ trunk/elementary/src/lib/elm_cnp_helper.c   2012-02-16 07:06:13 UTC
> (rev 68007)
> @@ -389,27 +389,27 @@
>  #endif
>  }
>
> -Eina_Bool
> -elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *widget,
> +EAPI Eina_Bool
> +elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
>                       Elm_Sel_Format format, const void *selbuf, size_t
> buflen)
>  {
>  #ifdef HAVE_ELEMENTARY_X
> -   Evas_Object *top = elm_widget_top_get(widget);
> +   Evas_Object *top = elm_widget_top_get(obj);
>    Ecore_X_Window xwin;
>    Cnp_Selection *sel;
>
>    if (top) xwin = elm_win_xwindow_get(top);
> -   else xwin = elm_win_xwindow_get(widget);
> +   else xwin = elm_win_xwindow_get(obj);
>    if ((!xwin) || (selection >= ELM_SEL_TYPE_MAX))
>      return EINA_FALSE;
>    if (!_elm_cnp_init_count) _elm_cnp_init();
>    if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE))
> -     return elm_cnp_selection_clear(selection, widget);
> +     return elm_cnp_selection_clear(selection, obj);
>
>    sel = selections + selection;
>
>    sel->active = EINA_TRUE;
> -   sel->widget = widget;
> +   sel->widget = obj;
>    sel->set(xwin, &selection, sizeof(Elm_Sel_Type));
>    sel->format = format;
>
> @@ -432,8 +432,8 @@
>  #endif
>  }
>
> -Eina_Bool
> -elm_cnp_selection_clear(Elm_Sel_Type selection, Evas_Object *widget)
> +EAPI Eina_Bool
> +elm_cnp_selection_clear(Elm_Sel_Type selection, Evas_Object *obj)
>  {
>  #ifdef HAVE_ELEMENTARY_X
>    Cnp_Selection *sel;
> @@ -445,7 +445,7 @@
>    sel = selections + selection;
>
>    /* No longer this selection: Consider it gone! */
> -   if ((!sel->active) || (sel->widget != widget)) return EINA_TRUE;
> +   if ((!sel->active) || (sel->widget != obj)) return EINA_TRUE;
>
>    sel->active = EINA_FALSE;
>    sel->widget = NULL;
> @@ -462,9 +462,9 @@
>  #endif
>  }
>
> -Eina_Bool
> +EAPI Eina_Bool
>  elm_cnp_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format,
> -                      Evas_Object *widget, Elm_Drop_Cb datacb, void
> *udata)
> +                      Evas_Object *obj, Elm_Drop_Cb datacb, void *udata)
>  {
>  #ifdef HAVE_ELEMENTARY_X
>    Evas_Object *top;
> @@ -475,11 +475,11 @@
>    if (!_elm_cnp_init_count) _elm_cnp_init();
>
>    sel = selections + selection;
> -   top = elm_widget_top_get(widget);
> +   top = elm_widget_top_get(obj);
>    if (!top) return EINA_FALSE;
>
>    sel->requestformat = format;
> -   sel->requestwidget = widget;
> +   sel->requestwidget = obj;
>    sel->request(elm_win_xwindow_get(top),
> ECORE_X_SELECTION_TARGET_TARGETS);
>    sel->datacb = datacb;
>    sel->udata = udata;
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> enlightenment-svn mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to