summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2013-11-14 22:51:03 +0900
committerChunEon Park <hermet@hermet.pe.kr>2013-11-14 22:53:21 +0900
commit2a1d3f7decaf36bf6bbb32d04a32141ec84dd70b (patch)
tree45f486801a7a150cf323e22736a9c258ae646229 /src
parentd4cee0d9cf00c0d7ea9da2e3102f3e771d8433fb (diff)
elementary/entry - internal change of the magnifier.
use the fill_set instead of the clipper. soon after 1.8, proxy just created the filled area buffer, then magnifier surface size will be fixed regardless of the entry source.
Diffstat (limited to 'src')
-rw-r--r--src/lib/elm_entry.c86
1 files changed, 54 insertions, 32 deletions
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index d509981e6..0203bd2d9 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -1388,6 +1388,15 @@ _menu_call(Evas_Object *obj)
1388 } 1388 }
1389} 1389}
1390 1390
1391static void _magnifier_move(void *data, Evas_Coord cx, Evas_Coord cy);
1392
1393static void
1394_magnifier_proxy_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1395{
1396 ELM_ENTRY_DATA_GET(data, sd);
1397 _magnifier_move(data, sd->downx, sd->downy);
1398}
1399
1391static void 1400static void
1392_magnifier_create(void *data) 1401_magnifier_create(void *data)
1393{ 1402{
@@ -1403,62 +1412,73 @@ _magnifier_create(void *data)
1403 1412
1404 e = evas_object_evas_get(data); 1413 e = evas_object_evas_get(data);
1405 1414
1415 //Bg
1406 sd->mgf_bg = edje_object_add(e); 1416 sd->mgf_bg = edje_object_add(e);
1407 _elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier", "default"); 1417 _elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier", "default");
1408 evas_object_show(sd->mgf_bg); 1418 evas_object_show(sd->mgf_bg);
1409 1419
1420 //Proxy
1421 sd->mgf_proxy = evas_object_image_add(e);
1422 evas_object_event_callback_add(sd->mgf_proxy, EVAS_CALLBACK_RESIZE,
1423 _magnifier_proxy_update, data);
1424 evas_object_event_callback_add(sd->mgf_proxy, EVAS_CALLBACK_MOVE,
1425 _magnifier_proxy_update, data);
1426 edje_object_part_swallow(sd->mgf_bg, "elm.swallow.content", sd->mgf_proxy);
1427 evas_object_image_source_set(sd->mgf_proxy, data);
1428 evas_object_geometry_get(data, NULL, NULL, &w, &h);
1429
1430 //Clipper
1410 sd->mgf_clip = evas_object_rectangle_add(e); 1431 sd->mgf_clip = evas_object_rectangle_add(e);
1411 edje_object_part_swallow(sd->mgf_bg, "elm.swallow.content", sd->mgf_clip); 1432 evas_object_show(sd->mgf_clip);
1412 1433 evas_object_clip_set(sd->mgf_proxy, sd->mgf_clip);
1413 sd->mgf_proxy = evas_object_image_filled_add(e);
1414
1415 if (sd->scroll)
1416 {
1417 evas_object_image_source_set(sd->mgf_proxy, sd->scr_edje);
1418 evas_object_geometry_get(sd->scr_edje, NULL, NULL, &w, &h);
1419 }
1420 else
1421 {
1422 evas_object_image_source_set(sd->mgf_proxy, data);
1423 evas_object_geometry_get(data, NULL, NULL, &w, &h);
1424 }
1425 1434
1426 mw = (Evas_Coord)(scale * (float) w); 1435 mw = (Evas_Coord)(scale * (float) w);
1427 mh = (Evas_Coord)(scale * (float) h); 1436 mh = (Evas_Coord)(scale * (float) h);
1428 if ((mw <= 0) || (mh <= 0)) return; 1437 if ((mw <= 0) || (mh <= 0)) return;
1429 1438
1430 evas_object_resize(sd->mgf_proxy, mw, mh);
1431 evas_object_pass_events_set(sd->mgf_proxy, EINA_TRUE);
1432 evas_object_show(sd->mgf_proxy);
1433 evas_object_clip_set(sd->mgf_proxy, sd->mgf_clip);
1434
1435 evas_object_layer_set(sd->mgf_bg, EVAS_LAYER_MAX); 1439 evas_object_layer_set(sd->mgf_bg, EVAS_LAYER_MAX);
1436 evas_object_layer_set(sd->mgf_proxy, EVAS_LAYER_MAX); 1440 evas_object_layer_set(sd->mgf_proxy, EVAS_LAYER_MAX);
1437} 1441}
1438 1442
1439static void 1443static void
1440_magnifier_move(void *data, Evas_Coord px, Evas_Coord py) 1444_magnifier_move(void *data, Evas_Coord cx, Evas_Coord cy)
1441{ 1445{
1442 ELM_ENTRY_DATA_GET(data, sd); 1446 ELM_ENTRY_DATA_GET(data, sd);
1443 1447
1444 Evas_Coord x, y, w, h; 1448 Evas_Coord x, y, w, h;
1445 Evas_Coord ex, ey; 1449 Evas_Coord px, py, pw, ph;
1446 Evas_Coord sx, sy; 1450 double fx, fy, fw, fh;
1447 const Evas_Object *obj_content; 1451 double dw, dh;
1448 double scale = _elm_config->magnifier_scale; 1452 double scale = _elm_config->magnifier_scale;
1449 1453
1454 //Move the Magnifier
1450 edje_object_parts_extends_calc(sd->mgf_bg, &x, &y, &w, &h); 1455 edje_object_parts_extends_calc(sd->mgf_bg, &x, &y, &w, &h);
1451 evas_object_move(sd->mgf_bg, px - x - (w / 2), py - y - h); 1456 evas_object_move(sd->mgf_bg, cx - x - (w / 2), cy - y - h);
1457
1458 //Set the Proxy Render Area
1459 evas_object_geometry_get(data, &x, &y, &w, &h);
1460 evas_object_geometry_get(sd->mgf_proxy, &px, &py, &pw, &ph);
1461
1462 dw = w;
1463 dh = h;
1452 1464
1453 obj_content = edje_object_part_object_get(sd->mgf_bg, "elm.swallow.content"); 1465 fx = -(((double) (cx - x) / dw) * (scale * dw)) + ((double) pw * 0.5);
1454 evas_object_geometry_get(obj_content, &x, &y, &w, &h); 1466 fy = -(((double) (cy - y) / dh) * (scale * dh)) + ((double) ph * 0.5);
1455 sx = px - (x + (w / 2)); 1467 fw = dw * scale;
1456 sy = py - (y + (h / 2)); 1468 fh = dh * scale;
1469 evas_object_image_fill_set(sd->mgf_proxy, fx, fy, fw, fh);
1457 1470
1458 if (sd->scroll) evas_object_geometry_get(sd->scr_edje, &ex, &ey, NULL, NULL); 1471 //Update Clipper Area
1459 else evas_object_geometry_get(data, &ex, &ey, NULL, NULL); 1472 int tx = fx;
1460 evas_object_move(sd->mgf_proxy, (ex * scale) - ((px * scale) - px) - sx, 1473 int ty = fy;
1461 (ey * scale) - ((py * scale) - py) - sy); 1474 int tw = fw;
1475 int th = fh;
1476 if (tx > 0) px += tx;
1477 if (ty > 0) py += ty;
1478 if (-(tx - pw) > tw) pw -= (-((tx - pw) + tw));
1479 if (-(ty - ph) > th) ph -= (-((ty - ph) + th));
1480 evas_object_move(sd->mgf_clip, px, py);
1481 evas_object_resize(sd->mgf_clip, pw, ph);
1462} 1482}
1463 1483
1464static void 1484static void
@@ -1467,6 +1487,7 @@ _magnifier_hide(void *data)
1467 ELM_ENTRY_DATA_GET(data, sd); 1487 ELM_ENTRY_DATA_GET(data, sd);
1468 edje_object_signal_emit(sd->mgf_bg, "elm,action,hide,magnifier", "elm"); 1488 edje_object_signal_emit(sd->mgf_bg, "elm,action,hide,magnifier", "elm");
1469 elm_widget_scroll_freeze_pop(data); 1489 elm_widget_scroll_freeze_pop(data);
1490 evas_object_hide(sd->mgf_clip);
1470} 1491}
1471 1492
1472static void 1493static void
@@ -1475,6 +1496,7 @@ _magnifier_show(void *data)
1475 ELM_ENTRY_DATA_GET(data, sd); 1496 ELM_ENTRY_DATA_GET(data, sd);
1476 edje_object_signal_emit(sd->mgf_bg, "elm,action,show,magnifier", "elm"); 1497 edje_object_signal_emit(sd->mgf_bg, "elm,action,show,magnifier", "elm");
1477 elm_widget_scroll_freeze_push(data); 1498 elm_widget_scroll_freeze_push(data);
1499 evas_object_show(sd->mgf_clip);
1478} 1500}
1479 1501
1480static Eina_Bool 1502static Eina_Bool