summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-07-18 08:36:28 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-07-18 08:36:28 +0000
commit48f47fad260535b75f0fd12d3d661a517edfb949 (patch)
treefce82bbe3443d73e4dade59bfa1b377b0f16a83b /src/bin
parentef79bfe671e1d27aa8ba99d387772f3024d437d7 (diff)
terminology: resize an existing selection.
SVN revision: 74051
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/termio.c134
1 files changed, 108 insertions, 26 deletions
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 4b1317b..94e77bd 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -70,6 +70,8 @@ struct _Termio
70 Eina_Bool noreqsize : 1; 70 Eina_Bool noreqsize : 1;
71 Eina_Bool composing : 1; 71 Eina_Bool composing : 1;
72 Eina_Bool didclick : 1; 72 Eina_Bool didclick : 1;
73 Eina_Bool bottom_right : 1;
74 Eina_Bool top_left : 1;
73}; 75};
74 76
75static Evas_Smart *_smart = NULL; 77static Evas_Smart *_smart = NULL;
@@ -1401,6 +1403,42 @@ _smart_cb_mouse_move_job(void *data)
1401} 1403}
1402 1404
1403static void 1405static void
1406_edje_cb_bottom_right_in(void *data, Evas_Object *obj __UNUSED__,
1407 const char *emission __UNUSED__, const char *source __UNUSED__)
1408{
1409 Termio *sd = data;
1410
1411 sd->bottom_right = EINA_TRUE;
1412}
1413
1414static void
1415_edje_cb_top_left_in(void *data, Evas_Object *obj __UNUSED__,
1416 const char *emission __UNUSED__, const char *source __UNUSED__)
1417{
1418 Termio *sd = data;
1419
1420 sd->top_left = EINA_TRUE;
1421}
1422
1423static void
1424_edje_cb_bottom_right_out(void *data, Evas_Object *obj __UNUSED__,
1425 const char *emission __UNUSED__, const char *source __UNUSED__)
1426{
1427 Termio *sd = data;
1428
1429 sd->bottom_right = EINA_FALSE;
1430}
1431
1432static void
1433_edje_cb_top_left_out(void *data, Evas_Object *obj __UNUSED__,
1434 const char *emission __UNUSED__, const char *source __UNUSED__)
1435{
1436 Termio *sd = data;
1437
1438 sd->top_left = EINA_FALSE;
1439}
1440
1441static void
1404_smart_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event) 1442_smart_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event)
1405{ 1443{
1406 Evas_Event_Mouse_Down *ev = event; 1444 Evas_Event_Mouse_Down *ev = event;
@@ -1441,22 +1479,41 @@ _smart_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__
1441 } 1479 }
1442 else 1480 else
1443 { 1481 {
1444 sd->backup.sel = sd->cur.sel; 1482 if (sd->top_left || sd->bottom_right)
1445 sd->backup.sel1.x = sd->cur.sel1.x;
1446 sd->backup.sel1.y = sd->cur.sel1.y;
1447 sd->backup.sel2.x = sd->cur.sel2.x;
1448 sd->backup.sel2.y = sd->cur.sel2.y;
1449 if (sd->cur.sel)
1450 { 1483 {
1451 sd->cur.sel = 0; 1484 sd->cur.makesel = 1;
1452 sd->didclick = EINA_TRUE; 1485 sd->cur.sel = 1;
1486 if (sd->top_left)
1487 {
1488 sd->cur.sel1.x = cx;
1489 sd->cur.sel1.y = cy - sd->scroll;
1490 }
1491 else
1492 {
1493 sd->cur.sel2.x = cx;
1494 sd->cur.sel2.y = cy - sd->scroll;
1495 }
1496 _selection_dbl_fix(data);
1497 }
1498 else
1499 {
1500 sd->backup.sel = sd->cur.sel;
1501 sd->backup.sel1.x = sd->cur.sel1.x;
1502 sd->backup.sel1.y = sd->cur.sel1.y;
1503 sd->backup.sel2.x = sd->cur.sel2.x;
1504 sd->backup.sel2.y = sd->cur.sel2.y;
1505 if (sd->cur.sel)
1506 {
1507 sd->cur.sel = 0;
1508 sd->didclick = EINA_TRUE;
1509 }
1510 sd->cur.makesel = 1;
1511 sd->cur.sel1.x = cx;
1512 sd->cur.sel1.y = cy - sd->scroll;
1513 sd->cur.sel2.x = cx;
1514 sd->cur.sel2.y = cy - sd->scroll;
1515 _selection_dbl_fix(data);
1453 } 1516 }
1454 sd->cur.makesel = 1;
1455 sd->cur.sel1.x = cx;
1456 sd->cur.sel1.y = cy - sd->scroll;
1457 sd->cur.sel2.x = cx;
1458 sd->cur.sel2.y = cy - sd->scroll;
1459 _selection_dbl_fix(data);
1460 } 1517 }
1461 _smart_update_queue(data, sd); 1518 _smart_update_queue(data, sd);
1462 } 1519 }
@@ -1483,8 +1540,16 @@ _smart_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
1483 if (sd->cur.sel) 1540 if (sd->cur.sel)
1484 { 1541 {
1485 sd->didclick = EINA_TRUE; 1542 sd->didclick = EINA_TRUE;
1486 sd->cur.sel2.x = cx; 1543 if (sd->top_left)
1487 sd->cur.sel2.y = cy - sd->scroll; 1544 {
1545 sd->cur.sel1.x = cx;
1546 sd->cur.sel1.y = cy - sd->scroll;
1547 }
1548 else
1549 {
1550 sd->cur.sel2.x = cx;
1551 sd->cur.sel2.y = cy - sd->scroll;
1552 }
1488 _selection_dbl_fix(data); 1553 _selection_dbl_fix(data);
1489 _smart_update_queue(data, sd); 1554 _smart_update_queue(data, sd);
1490 _take_selection(data, ELM_SEL_TYPE_PRIMARY); 1555 _take_selection(data, ELM_SEL_TYPE_PRIMARY);
@@ -1515,8 +1580,16 @@ _smart_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__
1515 ((cy - sd->scroll) != sd->cur.sel1.y)) 1580 ((cy - sd->scroll) != sd->cur.sel1.y))
1516 sd->cur.sel = 1; 1581 sd->cur.sel = 1;
1517 } 1582 }
1518 sd->cur.sel2.x = cx; 1583 if (sd->top_left)
1519 sd->cur.sel2.y = cy - sd->scroll; 1584 {
1585 sd->cur.sel1.x = cx;
1586 sd->cur.sel1.y = cy - sd->scroll;
1587 }
1588 else
1589 {
1590 sd->cur.sel2.x = cx;
1591 sd->cur.sel2.y = cy - sd->scroll;
1592 }
1520 _selection_dbl_fix(data); 1593 _selection_dbl_fix(data);
1521 _smart_update_queue(data, sd); 1594 _smart_update_queue(data, sd);
1522 } 1595 }
@@ -1732,6 +1805,7 @@ _smart_add(Evas_Object *obj)
1732 free(cd); 1805 free(cd);
1733 evas_object_smart_data_set(obj, sd); 1806 evas_object_smart_data_set(obj, sd);
1734 1807
1808 /* Terminal output widget */
1735 o = evas_object_textgrid_add(evas_object_evas_get(obj)); 1809 o = evas_object_textgrid_add(evas_object_evas_get(obj));
1736 evas_object_pass_events_set(o, EINA_TRUE); 1810 evas_object_pass_events_set(o, EINA_TRUE);
1737 evas_object_propagate_events_set(o, EINA_FALSE); 1811 evas_object_propagate_events_set(o, EINA_FALSE);
@@ -1762,6 +1836,17 @@ _smart_add(Evas_Object *obj)
1762 colors256[n].r, colors256[n].g, 1836 colors256[n].r, colors256[n].g,
1763 colors256[n].b, colors256[n].a); 1837 colors256[n].b, colors256[n].a);
1764 } 1838 }
1839
1840 /* Setup cursor */
1841 o = edje_object_add(evas_object_evas_get(obj));
1842 evas_object_pass_events_set(o, EINA_TRUE);
1843 evas_object_propagate_events_set(o, EINA_FALSE);
1844 evas_object_smart_member_add(o, obj);
1845 sd->cur.obj = o;
1846
1847 evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _cursor_cb_move, obj);
1848
1849 /* Setup the selection widget */
1765 o = evas_object_rectangle_add(evas_object_evas_get(obj)); 1850 o = evas_object_rectangle_add(evas_object_evas_get(obj));
1766 evas_object_pass_events_set(o, EINA_TRUE); 1851 evas_object_pass_events_set(o, EINA_TRUE);
1767 evas_object_propagate_events_set(o, EINA_FALSE); 1852 evas_object_propagate_events_set(o, EINA_FALSE);
@@ -1773,15 +1858,12 @@ _smart_add(Evas_Object *obj)
1773 o = edje_object_add(evas_object_evas_get(obj)); 1858 o = edje_object_add(evas_object_evas_get(obj));
1774 evas_object_smart_member_add(o, obj); 1859 evas_object_smart_member_add(o, obj);
1775 sd->cur.selo_theme = o; 1860 sd->cur.selo_theme = o;
1776 1861 edje_object_signal_callback_add(o, "mouse,in", "zone.bottom_right", _edje_cb_bottom_right_in, sd);
1777 o = edje_object_add(evas_object_evas_get(obj)); 1862 edje_object_signal_callback_add(o, "mouse,in", "zone.top_left", _edje_cb_top_left_in, sd);
1778 evas_object_pass_events_set(o, EINA_TRUE); 1863 edje_object_signal_callback_add(o, "mouse,out", "zone.bottom_right", _edje_cb_bottom_right_out, sd);
1779 evas_object_propagate_events_set(o, EINA_FALSE); 1864 edje_object_signal_callback_add(o, "mouse,out", "zone.top_left", _edje_cb_top_left_out, sd);
1780 evas_object_smart_member_add(o, obj);
1781 sd->cur.obj = o;
1782 1865
1783 evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _cursor_cb_move, obj); 1866 /* Setup event catcher */
1784
1785 o = evas_object_rectangle_add(evas_object_evas_get(obj)); 1867 o = evas_object_rectangle_add(evas_object_evas_get(obj));
1786 evas_object_repeat_events_set(o, EINA_TRUE); 1868 evas_object_repeat_events_set(o, EINA_TRUE);
1787 evas_object_smart_member_add(o, obj); 1869 evas_object_smart_member_add(o, obj);