Merge remote-tracking branch 'origin/upstream'
authorMike McCormack <mj.mccormack@samsung.com>
Thu, 6 Oct 2011 00:25:29 +0000 (09:25 +0900)
committerMike McCormack <mj.mccormack@samsung.com>
Thu, 6 Oct 2011 00:41:39 +0000 (09:41 +0900)
Conflicts:
src/bin/edje_cc_handlers.c
src/lib/Edje.h
src/lib/edje_entry.c
src/lib/edje_private.h

1  2 
src/bin/edje_cc.h
src/bin/edje_cc_handlers.c
src/bin/edje_cc_out.c
src/lib/Edje.h
src/lib/edje_calc.c
src/lib/edje_entry.c
src/lib/edje_private.h
src/lib/edje_util.c

Simple merge
@@@ -2767,17 -3199,11 +3198,12 @@@ st_collections_group_parts_part_entry_m
  static void
  st_collections_group_parts_part_select_mode(void)
  {
-    Edje_Part_Collection *pc;
-    Edje_Part *ep;
     check_arg_count(1);
  
-    pc = eina_list_data_get(eina_list_last(edje_collections));
-    ep = pc->parts[pc->parts_count - 1];
-    ep->select_mode = parse_enum(0,
+    current_part->select_mode = parse_enum(0,
                                  "DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT,
                                  "EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT,
 +                                "BLOCK_HANDLE", EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE,
                                  NULL);
  }
  
@@@ -7506,31 -7340,53 +7340,54 @@@ ob_collections_group_programs_program_s
     if (!is_verbatim()) track_verbatim(1);
     else
       {
-       char *s;
+         Eina_Bool empty = EINA_TRUE;
+         char *s;
+         int i, len;
  
-       s = get_verbatim();
-       if (s)
-         {
-            Code_Program *cp;
-            /* FIXME: Need to store the script somewhere to be restored when using edje_edit API */
-            cp = mem_alloc(SZ(Code_Program));
-            cp->l1 = get_verbatim_line1();
-            cp->l2 = get_verbatim_line2();
-            cp->script = s;
-            if (cd->shared && cd->is_lua)
-              {
-                 ERR("%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group",
-                     progname, file_in, line - 1);
-                 exit(-1);
-              }
-            cd->is_lua = 0;
+         s = get_verbatim();
+         if (s)
+           {
+              Code_Program *cp;
+              /* FIXME: Need to store the script somewhere to be restored when using edje_edit API */
+              cp = mem_alloc(SZ(Code_Program));
+              cp->l1 = get_verbatim_line1();
+              cp->l2 = get_verbatim_line2();
+              cp->script = s;
 -             cp->original = strdup(s);
+              if (cd->shared && cd->is_lua)
+                {
+                   ERR("%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group",
+                       progname, file_in, line - 1);
+                   exit(-1);
+                }
+              cd->is_lua = 0;
 +           cd->programs = eina_list_append(cd->programs, cp);
 +           data_queue_anonymous_lookup(pc, current_program, &(cp->id));
  
-            set_verbatim(NULL, 0, 0);
-            current_program->action = EDJE_ACTION_TYPE_SCRIPT;
-         }
+              len = strlen(cp->script);
+              for (i = 0; i < len; i++)
+                {
+                   if (((cp->script[i] > 'a') && (cp->script[i] < 'z')) ||
+                       ((cp->script[i] > 'A') && (cp->script[i] < 'Z')) ||
+                       ((cp->script[i] > '0') && (cp->script[i] < '9')))
+                     empty = EINA_FALSE;
+                }
+              if (!empty)
+                {
+                   cd->programs = eina_list_append(cd->programs, cp);
+                   data_queue_anonymous_lookup(pc, current_program, &(cp->id));
+                   current_program->action = EDJE_ACTION_TYPE_SCRIPT;
+                }
+              else
+                {
+                   data_queue_anonymous_lookup(pc, current_program, NULL);
+                   free(cp);
+                   cp = NULL;
+                }
+              set_verbatim(NULL, 0, 0);
+           }
       }
  }
  /**
Simple merge
diff --cc src/lib/Edje.h
@@@ -2799,85 -2790,34 +2847,109 @@@ EAPI void             edje_object_part_
  EAPI int              edje_object_part_text_cursor_pos_get              (const Evas_Object *obj, const char *part, Edje_Cursor cur);
  
  /**
 - * 
 + * @brief Retrieves the current position of the selection
 + *
 + * @param obj A valid Evas_Object handle
 + * @param part The part name
 + * @param x A pointer to a variable where to selection the part's x
 + * coordinate
 + * @param y A pointer to a variable where to selection the part's y
 + * coordinate
 + * @param w A pointer to a variable where to selection the part's width
 + * @param h A pointer to a variable where to selection the part's height
 + * @return EINA_TRUE if part has selection or EINA_FALSE otherwise
 + */
 +EAPI Eina_Bool        edje_object_part_text_selection_geometry_get     (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
 +/**
 + * @brief Enables autocapitalization.
 + *
 + * @param obj A valid Evas_Object handle
 + * @param part The part name
 + * @param autocap EINA_TRUE to enable, EINA_FALSE otherwise
 + */
 +EAPI void             edje_object_part_text_autocapitalization_set (const Evas_Object *obj, const char *part, Eina_Bool autocap);
 +
 +/**
 + * @brief Enables autoperiod.
 + * Autoperiod is the feature that period (.) will be automatically added when space bar is pressed twice in a short time.
 + *
 + * @param obj A valid Evas_Object handle
 + * @param part The part name
 + * @param autoperiod EINA_TRUE to enable, EINA_FALSE otherwise
 + */
 +EAPI void             edje_object_part_text_autoperiod_set (const Evas_Object *obj, const char *part, Eina_Bool autoperiod);
 +
 +/**
 + * @brief Get the input method context in entry.
 + *
 + * @param obj A valid Evas_Object handle
 + * @param part The part name
 + *
 + * @return The input method context in entry
 + */
 +#ifdef HAVE_ECORE_IMF
 +EAPI Ecore_IMF_Context *edje_object_part_text_imf_context_get (const Evas_Object *obj, const char *part);
 +#else
 +EAPI void              *edje_object_part_text_imf_context_get (const Evas_Object *obj, const char *part);
 +#endif
 +
 +/**
 + * @brief Set the edje's global input panel.
 + *
 + * @param obj A valid Evas_Object handle
 + * @param part The part name
 + *
 + * @see edje_object_part_text_input_panel_enabled_get
 + */
 +EAPI void             edje_object_part_text_input_panel_enabled_set (const Evas_Object *obj, const char *part, Eina_Bool enabled);
 +
++/*
+  * @brief Set the layout of the input panel.
 - *
 - * @param obj A valid Evas_Object handle
 - * @param part The part name
 - *
++ *
+  * The layout of the input panel or virtual keyboard can make it easier or
+  * harder to enter content. This allows you to hint what kind of input you
+  * are expecting to enter and thus have the input panel automatically
+  * come up with the right mode.
+  *
+  * @param obj A valid Evas_Object handle
+  * @param part The part name
+  * @param layout layout type
+  * @since 1.1
+  */
+ EAPI void             edje_object_part_text_input_panel_layout_set (const Evas_Object *obj, const char *part, Edje_Input_Panel_Layout layout);
+ /**
+  * @brief Get the layout of the input panel.
+  * @return Layout type of the input panel
+  *
+  * @see edje_object_part_text_input_panel_layout_set
+  * @since 1.1
+  */
+ EAPI Edje_Input_Panel_Layout edje_object_part_text_input_panel_layout_get (const Evas_Object *obj, const char *part);
  /**
 + * @brief Get whether the entry supports to show input panel automatically.
 + *
 + * @param obj A valid Evas_Object handle
 + * @param part The part name
 + *
 + * @return EINA_TRUE if it supports or EINA_FALSE otherwise
 + *
 + * @see edje_object_part_text_input_panel_enabled_set
 + */
 +EAPI Eina_Bool        edje_object_part_text_input_panel_enabled_get (const Evas_Object *obj, const char *part);
 +
 +/**
 + * @brief Set the viewport object of the text.
 + *
 + * @param obj A valid Evas_Object handle
 + * @param part The part name
 + *
 + * Viewport object is used for showing or hiding text selection handlers.
 + */
 +EAPI void             edje_object_part_text_viewport_object_set     (const Evas_Object *obj, const char *part, Evas_Object *viewport_obj);
 +
 +/**
   * Add a filter function for newly inserted text.
   *
   * Whenever text is inserted (not the same as set) into the given @p part,
Simple merge
@@@ -3327,57 -2762,30 +3425,81 @@@ _edje_entry_cursor_pos_get(Edje_Real_Pa
     return evas_textblock_cursor_pos_get(c);
  }
  
 +Eina_Bool
 +_edje_entry_selection_geometry_get(Edje_Real_Part *rp, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
 +{
 +   Entry *en = rp->entry_data;
 +   if (!en || !en->have_selection || !en->sel)
 +     return EINA_FALSE;
 +
 +   Sel *sel;
 +   Eina_List *l;
 +   Evas_Textblock_Rectangle rect;
 +   Evas_Coord tx, ty, tw, th;
 +
 +   l = en->sel;
 +   if (!l) return EINA_FALSE;
 +   sel = eina_list_data_get(l);
 +   if (!sel) return EINA_FALSE;
 +   rect = sel->rect;
 +   ty = rect.y;
 +   tw = rect.w;
 +
 +   l = eina_list_last(en->sel);
 +   if (!l) return EINA_FALSE;
 +   sel = eina_list_data_get(l);
 +   if (!sel) return EINA_FALSE;
 +   rect = sel->rect;
 +
 +   tx = rect.x;
 +   th = rect.y - ty + rect.h;
 +
 +   EINA_LIST_FOREACH(en->sel, l, sel)
 +     {
 +        if (sel)
 +          {
 +             if (tw < sel->rect.w) tw = sel->rect.w;
 +             if (sel->rect.x < tx) tx = sel->rect.x;
 +          }
 +     }
 +
 +   Evas_Coord vx, vy, vw, vh;
 +   evas_object_geometry_get(rp->object, &vx, &vy, NULL, NULL);
 +   tx += vx;
 +   ty += vy;
 +
 +   if (x) *x = tx;
 +   if (y) *y = ty;
 +   if (w) *w = tw;
 +   if (h) *h = th;
 +
 +   return EINA_TRUE;
 +}
 +
+ void
+ _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout)
+ {
+    Entry *en = rp->entry_data;
+    if (!en) return;
+ #ifdef HAVE_ECORE_IMF
+    if (en->imf_context)
+      ecore_imf_context_input_panel_layout_set(en->imf_context, layout);
+ #endif
+ }
+ Edje_Input_Panel_Layout
+ _edje_entry_input_panel_layout_get(Edje_Real_Part *rp)
+ {
+    Entry *en = rp->entry_data;
+    if ((!en) || (!en->imf_context)) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
+ #ifdef HAVE_ECORE_IMF
+    if (en->imf_context)
+      return ecore_imf_context_input_panel_layout_get(en->imf_context);
+ #endif
+    return EDJE_INPUT_PANEL_LAYOUT_INVALID;
+ }
  static void
  _edje_entry_imf_context_reset(Entry *en)
  {
@@@ -1829,8 -1844,9 +1856,10 @@@ Eina_Bool _edje_entry_cursor_is_visible
  const char *_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur);
  void _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos);
  int _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur);
-     
+ void _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout);
+ Edje_Input_Panel_Layout _edje_entry_input_panel_layout_get(Edje_Real_Part *rp);
 +Eina_Bool _edje_entry_selection_geometry_get(Edje_Real_Part *rp, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
  void _edje_external_init();
  void _edje_external_shutdown();
  Evas_Object *_edje_external_type_add(const char *type_name, Evas *evas, Evas_Object *parent, const Eina_List *params, const char *part_name);
@@@ -1900,21 -1725,40 +1902,54 @@@ edje_object_part_text_cursor_pos_get(co
     return 0;
  }
  
 +EAPI Eina_Bool
 +edje_object_part_text_selection_geometry_get(const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
 +{
 +   Edje *ed;
 +   Edje_Real_Part *rp;
 +
 +   ed = _edje_fetch(obj);
 +   if ((!ed) || (!part)) return 0;
 +   rp = _edje_real_part_recursive_get(ed, part);
 +   if (!rp) return 0;
 +
 +   return _edje_entry_selection_geometry_get(rp, x, y, w, h);
 +}
 +
  EAPI void
+ edje_object_part_text_input_panel_layout_set(const Evas_Object *obj, const char *part, Edje_Input_Panel_Layout layout)
+ {
+    Edje *ed;
+    Edje_Real_Part *rp;
+    ed = _edje_fetch(obj);
+    if ((!ed) || (!part)) return;
+    rp = _edje_real_part_recursive_get(ed, part);
+    if (!rp) return;
+    if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
+      {
+         return _edje_entry_input_panel_layout_set(rp, layout);
+      }
+ }
+ EAPI Edje_Input_Panel_Layout
+ edje_object_part_text_input_panel_layout_get(const Evas_Object *obj, const char *part)
+ {
+    Edje *ed;
+    Edje_Real_Part *rp;
+    ed = _edje_fetch(obj);
+    if ((!ed) || (!part)) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
+    rp = _edje_real_part_recursive_get(ed, part);
+    if (!rp) return EINA_FALSE;
+    if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
+      {
+         return _edje_entry_input_panel_layout_get(rp);
+      }
+    return EDJE_INPUT_PANEL_LAYOUT_INVALID;
+ }
+ EAPI void
  edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data)
  {
     Edje *ed;