Merge "prevent issues are fixed.Id:47337,55238,56400,56431,50159,55300,55301,5623156263."
authorsumanth <sumanth.m@samsung.com>
Fri, 2 Dec 2011 08:44:40 +0000 (17:44 +0900)
committerGerrit Code Review <git@Maetan>
Fri, 2 Dec 2011 08:44:40 +0000 (17:44 +0900)
src/lib/Elementary.h.in
src/lib/elm_cnp_helper.c
src/lib/elm_entry.c
src/lib/elm_module_priv.h
src/modules/ctxpopup_copypasteUI/copypaste.c

index 1a9d0e3..e63f5b7 100644 (file)
@@ -11510,6 +11510,20 @@ extern "C" {
     */
    EAPI Eina_Bool    elm_entry_context_menu_disabled_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    /**
+    * This disables the entry's magnifer feature.
+    *
+    * @param obj The entry object
+    * @param disabled If true, the magnifier is not displayed
+    */
+   EAPI void         elm_entry_magnifier_disabled_set(Evas_Object *obj, Eina_Bool disabled) EINA_ARG_NONNULL(1);
+   /**
+    * This returns whether the entry's magnifier feature is disabled.
+    *
+    * @param obj The entry object
+    * @return If true, the feature is disabled
+    */
+   EAPI Eina_Bool    elm_entry_magnifier_disabled_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   /**
     * This appends a custom item provider to the list for that entry
     *
     * This appends the given callback. The list is walked from beginning to end
index 7948e99..45ee5fa 100644 (file)
@@ -1056,6 +1056,7 @@ _convert_to_html(Eina_List* nodes)
           eina_strbuf_append(html, trail->str);
      }
 
+   eina_strbuf_replace_all(html, "  ", " &nbsp;");
    char *ret = eina_strbuf_string_steal(html);
    eina_strbuf_free(html);
    return ret;
@@ -1174,6 +1175,7 @@ _convert_to_edje(Eina_List* nodes)
           eina_strbuf_append(html, trail->str);
      }
 
+   eina_strbuf_replace_all(html, "&nbsp;", " ");
    char *ret = eina_strbuf_string_steal(html);
    eina_strbuf_free(html);
    return ret;
@@ -1891,10 +1893,23 @@ text_converter(char *target __UNUSED__, void *data, int size __UNUSED__, void **
    sel = selections + *((int *)data);
    if (!sel->active) return EINA_TRUE;
 
-   if ((sel->format & ELM_SEL_FORMAT_MARKUP) ||
-       (sel->format & ELM_SEL_FORMAT_HTML))
+   if (sel->format & ELM_SEL_FORMAT_MARKUP)
+     *data_ret = remove_tags(sel->selbuf, size_ret);
+   else if (sel->format & ELM_SEL_FORMAT_HTML)
      {
-        *data_ret = remove_tags(sel->selbuf, size_ret);
+        char *text = NULL;
+        Eina_Strbuf *buf = eina_strbuf_new();
+        if (buf)
+          {
+             eina_strbuf_append(buf, sel->selbuf);
+             eina_strbuf_replace_all(buf, "&nbsp;", " ");
+             text = eina_strbuf_string_steal(buf);
+             eina_strbuf_free(buf);
+             *data_ret = remove_tags(text, size_ret);
+             free(text);
+          }
+        else
+          *data_ret = remove_tags(sel->selbuf, size_ret);
      }
    else if (sel->format & ELM_SEL_FORMAT_TEXT)
      {
index e338559..31fcf66 100644 (file)
@@ -77,6 +77,7 @@ struct _Widget_Data
    Eina_Bool double_clicked : 1;
    Eina_Bool long_pressed : 1;
    Eina_Bool context_menu : 1;
+   Eina_Bool magnifier_enabled : 1;
    Eina_Bool drag_selection_asked : 1;
    Eina_Bool bgcolor : 1;
    Eina_Bool can_write : 1;
@@ -1570,10 +1571,13 @@ _signal_long_pressed(void *data)
 
    _cancel(data, NULL, NULL);
 
-   _magnifier_create(data);
-   _magnifier_move(data);
-   _magnifier_show(data);
-   elm_object_scroll_freeze_push(data);
+   if (wd->magnifier_enabled)
+     {
+        _magnifier_create(data);
+        _magnifier_move(data);
+        _magnifier_show(data);
+        elm_object_scroll_freeze_push(data);
+     }
 
    evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
    return ECORE_CALLBACK_CANCEL;
@@ -1606,8 +1610,11 @@ _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *
              if ((wd->api) && (wd->api->obj_mouseup))
                wd->api->obj_mouseup(data);
           }
-        _magnifier_hide(data);
-        elm_object_scroll_freeze_pop(data);
+        if (wd->magnifier_enabled)
+          {
+             _magnifier_hide(data);
+             elm_object_scroll_freeze_pop(data);
+          }
 
         if (wd->long_pressed)
           _menu_press(data);
@@ -1629,7 +1636,7 @@ _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void
 
    if (ev->buttons == 1)
      {
-        if (wd->long_pressed)
+        if ((wd->long_pressed) && (wd->magnifier_enabled))
           {
              _magnifier_show(data);
              _magnifier_move(data);
@@ -1934,9 +1941,12 @@ _signal_handler_move_start(void *data, Evas_Object *obj __UNUSED__, const char *
    if ((wd->api) && (wd->api->obj_hidemenu))
      wd->api->obj_hidemenu(data);
 
-   _magnifier_create(data);
-   _magnifier_move(data);
-   _magnifier_show(data);
+   if (wd->magnifier_enabled)
+     {
+        _magnifier_create(data);
+        _magnifier_move(data);
+        _magnifier_show(data);
+     }
 }
 
 static void
@@ -1957,8 +1967,14 @@ _signal_handler_move_end(void *data, Evas_Object *obj __UNUSED__, const char *em
 static void
 _signal_handler_moving(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
 {
-   _magnifier_move(data);
-   _magnifier_show(data);
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   if (wd->magnifier_enabled)
+     {
+        _magnifier_move(data);
+        _magnifier_show(data);
+     }
 }
 
 static Evas_Coord_Rectangle
@@ -2015,7 +2031,7 @@ _viewport_region_get(Evas_Object *data)
             !strcmp(elm_widget_type_get(parent_obj), "genlist"))
           {
              evas_object_geometry_get(parent_obj, &geometry.x, &geometry.y, &geometry.w, &geometry.h);
-             if (ret_rect.w == -1 && ret_rect.h == -1) ret_rect = geometry;
+             if ((ret_rect.w == -1) && (ret_rect.h == -1)) ret_rect = geometry;
              ret_rect = _intersection_region_get(geometry, ret_rect);
           }
      }
@@ -2072,7 +2088,11 @@ _elm_win_region_get_job(void *data)
 static void
 _signal_selection_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
 {
-   _magnifier_hide(data);
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return;
+
+   if (wd->magnifier_enabled)
+     _magnifier_hide(data);
    _menu_press(data);
 }
 
@@ -2958,6 +2978,7 @@ elm_entry_add(Evas_Object *parent)
    wd->editable     = EINA_TRUE;
    wd->disabled     = EINA_FALSE;
    wd->context_menu = EINA_TRUE;
+   wd->magnifier_enabled = EINA_TRUE;
    wd->autosave     = EINA_TRUE;
    wd->cnp_mode     = ELM_CNP_MODE_MARKUP;
    wd->autoperiod   = EINA_TRUE;
@@ -3093,6 +3114,7 @@ EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extensi
    ext_mod->cnpinit = _cnpinit;
    ext_mod->context_menu = wd->context_menu;
    ext_mod->cnp_mode = wd->cnp_mode;
+   ext_mod->viewport_rect = _viewport_region_get(obj);
 }
 
 EAPI void
@@ -3603,6 +3625,25 @@ elm_entry_context_menu_disabled_get(const Evas_Object *obj)
 }
 
 EAPI void
+elm_entry_magnifier_disabled_set(Evas_Object *obj, Eina_Bool disabled)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   if (wd->magnifier_enabled == !disabled) return;
+   wd->magnifier_enabled = !disabled;
+}
+
+EAPI Eina_Bool
+elm_entry_magnifier_disabled_get(const Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return EINA_FALSE;
+   return !wd->magnifier_enabled;
+}
+
+EAPI void
 elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
 {
    ELM_CHECK_WIDTYPE(obj, widtype);
index 0af8b74..8693834 100644 (file)
@@ -8,7 +8,7 @@ struct _Elm_Entry_Extension_data
 {
        Evas_Object *popup;
        Evas_Object *ent;
-       Evas_Object *viewport_obj;
+       Evas_Coord_Rectangle viewport_rect;
        Eina_List *items;
        cpfunc select;
        cpfunc copy;
index 0831e37..9c587bb 100644 (file)
@@ -44,12 +44,17 @@ _ctxpopup_position(Evas_Object *obj)
      }
    else
      {
-        if (ext_mod->viewport_obj)
+        if (ext_mod->viewport_rect.x != -1 || ext_mod->viewport_rect.y != -1
+            || ext_mod->viewport_rect.w != -1 || ext_mod->viewport_rect.h != -1)
           {
              Evas_Coord vx, vy, vw, vh, x2, y2;
              x2 = x + w;
              y2 = y + h;
-             evas_object_geometry_get(ext_mod->viewport_obj, &vx, &vy, &vw, &vh);
+             vx = ext_mod->viewport_rect.x;
+             vy = ext_mod->viewport_rect.y;
+             vw = ext_mod->viewport_rect.w;
+             vh = ext_mod->viewport_rect.h;
+
              if (x < vx) x = vx;
              if (y < vy) y = vy;
              if (x2 > vx + vw) x2 = vx + vw;
@@ -57,6 +62,20 @@ _ctxpopup_position(Evas_Object *obj)
              w = x2 - x;
              h = y2 - y;
           }
+        else
+          {
+             Evas_Coord sw, sh, x2, y2;
+             x2 = x + w;
+             y2 = y + h;
+             ecore_x_window_size_get(ecore_x_window_root_first_get(), &sw, &sh);
+
+             if (x < 0) x = 0;
+             if (y < 0) y = 0;
+             if (x2 > sw) x2 = sw;
+             if (y2 > sh) y2 = sh;
+             w = x2 - x;
+             h = y2 - y;
+          }
         cx = x + (w / 2);
         cy = y + (h / 2);
         evas_object_move(ext_mod->popup, cx, cy);