summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-10-03 12:00:28 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-10-03 12:01:19 +0200
commit3427abd7f651a78e775a3e1ec9d83d37e024f98c (patch)
tree83eef84dcfe64af1c09367478905f19963036fda
parent636b640d4e1fa24fac402133f3edc716abf6b04e (diff)
elm_file_selector: update to eina_rect
-rw-r--r--src/widgets/file/elm_file_selector.c42
-rw-r--r--src/widgets/file/elm_file_view.eo6
-rw-r--r--src/widgets/file/views/elm_file_display_view_grid.c17
-rw-r--r--src/widgets/file/views/elm_file_display_view_list.c16
4 files changed, 41 insertions, 40 deletions
diff --git a/src/widgets/file/elm_file_selector.c b/src/widgets/file/elm_file_selector.c
index 8e6a826..048379b 100644
--- a/src/widgets/file/elm_file_selector.c
+++ b/src/widgets/file/elm_file_selector.c
@@ -12,7 +12,7 @@ typedef struct
12{ 12{
13 struct { 13 struct {
14 Evas_Object *selection; 14 Evas_Object *selection;
15 Evas_Point startpoint; 15 Eina_Position2D startpoint;
16 }event; 16 }event;
17 17
18 struct { 18 struct {
@@ -310,8 +310,8 @@ _event_rect_mouse_move(void *data, const Efl_Event *event)
310{ 310{
311 PRIV_DATA(data) 311 PRIV_DATA(data)
312 Efl_Input_Pointer *ev = event->info; 312 Efl_Input_Pointer *ev = event->info;
313 Eina_Rectangle view, selection; 313 Eina_Rect view, selection;
314 int move_x, move_y; 314 Eina_Position2D move;
315 315
316 if (!pd->event.selection) 316 if (!pd->event.selection)
317 { 317 {
@@ -321,15 +321,14 @@ _event_rect_mouse_move(void *data, const Efl_Event *event)
321 evas_object_show(pd->event.selection); 321 evas_object_show(pd->event.selection);
322 } 322 }
323 323
324 selection.x = pd->event.startpoint.x; 324 selection.pos = pd->event.startpoint;
325 selection.y = pd->event.startpoint.y;
326 325
327 efl_input_pointer_position_get(ev, &move_x, &move_y); 326 move = efl_input_pointer_position_get(ev);
328 327
329 selection.w = move_x - pd->event.startpoint.x; 328 selection.w = move.x - pd->event.startpoint.x;
330 selection.h = move_y - pd->event.startpoint.y; 329 selection.h = move.y - pd->event.startpoint.y;
331 330
332 elm_file_view_size_get(pd->view.obj, &view); 331 view = elm_file_view_size_get(pd->view.obj);
333 332
334 if (selection.w < 0) 333 if (selection.w < 0)
335 { 334 {
@@ -373,14 +372,14 @@ _event_rect_mouse_up(void *data, const Efl_Event *event)
373{ 372{
374 PRIV_DATA(data); 373 PRIV_DATA(data);
375 Eina_List *sel; 374 Eina_List *sel;
376 Eina_Rectangle selection; 375 Eina_Rect selection;
377 376
378 evas_object_geometry_get(pd->event.selection, &selection.x, &selection.y, &selection.w, &selection.h); 377 evas_object_geometry_get(pd->event.selection, &selection.x, &selection.y, &selection.w, &selection.h);
379 evas_object_del(pd->event.selection); 378 evas_object_del(pd->event.selection);
380 pd->event.selection = NULL; 379 pd->event.selection = NULL;
381 380
382 /* call for selection*/ 381 /* call for selection*/
383 sel = elm_file_view_search_items(pd->view.obj, &selection); 382 sel = elm_file_view_search_items(pd->view.obj, selection);
384 elm_file_view_selection_set(pd->view.obj, sel); 383 elm_file_view_selection_set(pd->view.obj, sel);
385 384
386 efl_event_callback_del(event->object, EFL_EVENT_POINTER_MOVE, _event_rect_mouse_move, data); 385 efl_event_callback_del(event->object, EFL_EVENT_POINTER_MOVE, _event_rect_mouse_move, data);
@@ -393,21 +392,20 @@ _event_rect_mouse_down(void *data, const Efl_Event *event)
393 PRIV_DATA(data) 392 PRIV_DATA(data)
394 Eina_List *icons; 393 Eina_List *icons;
395 Efl_Input_Pointer *ev = event->info; 394 Efl_Input_Pointer *ev = event->info;
396 Eina_Rectangle view, search; 395 Eina_Rect view, search;
397 396
398 EINA_RECTANGLE_SET(&search, 0, 0, 1, 1); 397 search.pos = efl_input_pointer_position_get(ev);
399 efl_input_pointer_position_get(ev, &search.x, &search.y); 398 search.size.h = search.size.w = 1;
400 399
401 icons = elm_file_view_search_items(pd->view.obj, &search); 400 icons = elm_file_view_search_items(pd->view.obj, search);
402 elm_file_view_size_get(pd->view.obj, &view); 401 view = elm_file_view_size_get(pd->view.obj);
403 402
404 if (!eina_rectangle_coords_inside(&view, search.x, search.y)) 403 if (!eina_rectangle_coords_inside(&view.rect, search.pos.x, search.pos.y))
405 return; 404 return;
406 405
407 if (efl_input_pointer_button_get(ev) == 1 && !icons) 406 if (efl_input_pointer_button_get(ev) == 1 && !icons)
408 { 407 {
409 pd->event.startpoint.x = search.x; 408 pd->event.startpoint = search.pos;
410 pd->event.startpoint.y = search.y;
411 efl_event_callback_add(event->object, EFL_EVENT_POINTER_MOVE, _event_rect_mouse_move, data); 409 efl_event_callback_add(event->object, EFL_EVENT_POINTER_MOVE, _event_rect_mouse_move, data);
412 efl_event_callback_add(event->object, EFL_EVENT_POINTER_UP, _event_rect_mouse_up, data); 410 efl_event_callback_add(event->object, EFL_EVENT_POINTER_UP, _event_rect_mouse_up, data);
413 } 411 }
@@ -429,10 +427,10 @@ _dnd_item_get_cb(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, int
429 Eina_List *icons; 427 Eina_List *icons;
430 Elm_File_Icon *icon; 428 Elm_File_Icon *icon;
431 int xx,yy; 429 int xx,yy;
432 Eina_Rectangle search; 430 Eina_Rect search;
433 431
434 EINA_RECTANGLE_SET(&search, x, y, 1, 1); 432 EINA_RECTANGLE_SET(&search.rect, x, y, 1, 1);
435 icons = elm_file_view_search_items(obj, &search); 433 icons = elm_file_view_search_items(obj, search);
436 434
437 if (!icons) 435 if (!icons)
438 return NULL; 436 return NULL;
diff --git a/src/widgets/file/elm_file_view.eo b/src/widgets/file/elm_file_view.eo
index b672c71..a472783 100644
--- a/src/widgets/file/elm_file_view.eo
+++ b/src/widgets/file/elm_file_view.eo
@@ -14,7 +14,7 @@ interface Elm.File.View {
14 } 14 }
15 search_items { 15 search_items {
16 params { 16 params {
17 select : ptr(Eina.Rectangle); 17 select : Eina.Rect;
18 } 18 }
19 return : list<Elm.File.Icon>; 19 return : list<Elm.File.Icon>;
20 } 20 }
@@ -38,9 +38,7 @@ interface Elm.File.View {
38 } 38 }
39 size_get { 39 size_get {
40 [[Give back the actual size where dnd and rect selection should work]] 40 [[Give back the actual size where dnd and rect selection should work]]
41 params { 41 return : Eina.Rect;
42 size : ptr(Eina.Rectangle);
43 }
44 } 42 }
45 count { 43 count {
46 [[get the numbers of displayed items]] 44 [[get the numbers of displayed items]]
diff --git a/src/widgets/file/views/elm_file_display_view_grid.c b/src/widgets/file/views/elm_file_display_view_grid.c
index e720284..e240154 100644
--- a/src/widgets/file/views/elm_file_display_view_grid.c
+++ b/src/widgets/file/views/elm_file_display_view_grid.c
@@ -24,7 +24,7 @@ _elm_file_display_view_grid_elm_file_view_name_get(Eo *obj EINA_UNUSED, void *pd
24} 24}
25 25
26EOLIAN static Eina_List* 26EOLIAN static Eina_List*
27_elm_file_display_view_grid_elm_file_view_search_items(Eo *obj EINA_UNUSED, Elm_File_Display_View_Grid_Data *pd EINA_UNUSED, Eina_Rectangle *view) 27_elm_file_display_view_grid_elm_file_view_search_items(Eo *obj EINA_UNUSED, Elm_File_Display_View_Grid_Data *pd EINA_UNUSED, Eina_Rect view)
28{ 28{
29 int x1 = 0, y1 = 0; 29 int x1 = 0, y1 = 0;
30 Elm_Object_Item *it; 30 Elm_Object_Item *it;
@@ -33,9 +33,9 @@ _elm_file_display_view_grid_elm_file_view_search_items(Eo *obj EINA_UNUSED, Elm_
33 33
34 size = _calc_icon_size(pd->config.icon_size); 34 size = _calc_icon_size(pd->config.icon_size);
35 35
36 for (x1 = view->x; x1 < view->x+view->w; x1 += size) 36 for (x1 = view.x; x1 < view.x+view.w; x1 += size)
37 { 37 {
38 for (y1 = view->y; y1 < view->y+view->h; y1 += size) 38 for (y1 = view.y; y1 < view.y+view.h; y1 += size)
39 { 39 {
40 Evas_Object *content; 40 Evas_Object *content;
41 41
@@ -134,10 +134,13 @@ _elm_file_display_view_grid_elm_file_view_iconsize_set(Eo *obj, Elm_File_Display
134 elm_gengrid_item_size_set(obj, size, size); 134 elm_gengrid_item_size_set(obj, size, size);
135} 135}
136 136
137EOLIAN static void 137EOLIAN static Eina_Rect
138_elm_file_display_view_grid_elm_file_view_size_get(Eo *obj, Elm_File_Display_View_Grid_Data *pd EINA_UNUSED, Eina_Rectangle *size) 138_elm_file_display_view_grid_elm_file_view_size_get(Eo *obj, Elm_File_Display_View_Grid_Data *pd EINA_UNUSED)
139{ 139{
140 elm_interface_scrollable_content_viewport_geometry_get(obj, &size->x, &size->y, &size->w, &size->h); 140 Eina_Rect size;
141 elm_interface_scrollable_content_viewport_geometry_get(obj, &size.x, &size.y, &size.w, &size.h);
142
143 return size;
141} 144}
142 145
143static Evas_Object * 146static Evas_Object *
@@ -261,4 +264,4 @@ _elm_file_display_view_grid_elm_file_view_filter_set(Eo *obj EINA_UNUSED, Elm_Fi
261 view_filter_set(&pd->common, filter); 264 view_filter_set(&pd->common, filter);
262} 265}
263 266
264#include "elm_file_display_view_grid.eo.x" \ No newline at end of file 267#include "elm_file_display_view_grid.eo.x"
diff --git a/src/widgets/file/views/elm_file_display_view_list.c b/src/widgets/file/views/elm_file_display_view_list.c
index 5a2a098..23227d2 100644
--- a/src/widgets/file/views/elm_file_display_view_list.c
+++ b/src/widgets/file/views/elm_file_display_view_list.c
@@ -15,14 +15,14 @@ _elm_file_display_view_list_elm_file_view_name_get(Eo *obj EINA_UNUSED, void *pd
15} 15}
16 16
17EOLIAN static Eina_List* 17EOLIAN static Eina_List*
18_elm_file_display_view_list_elm_file_view_search_items(Eo *obj, Elm_File_Display_View_List_Data *pd EINA_UNUSED, Eina_Rectangle *search) 18_elm_file_display_view_list_elm_file_view_search_items(Eo *obj, Elm_File_Display_View_List_Data *pd EINA_UNUSED, Eina_Rect search)
19{ 19{
20 Elm_Object_Item *item; 20 Elm_Object_Item *item;
21 Eina_List *result = NULL; 21 Eina_List *result = NULL;
22 22
23 for (int x = search->x; x < search->x+search->w; x += 100) 23 for (int x = search.x; x < search.x+search.w; x += 100)
24 { 24 {
25 for (int y = search->y; y < search->y+search->h; y += 100) 25 for (int y = search.y; y < search.y+search.h; y += 100)
26 { 26 {
27 Evas_Object *icon; 27 Evas_Object *icon;
28 item = elm_genlist_at_xy_item_get(obj, x, y, 0); 28 item = elm_genlist_at_xy_item_get(obj, x, y, 0);
@@ -112,10 +112,12 @@ _elm_file_display_view_list_elm_file_view_file_set(Eo *obj, Elm_File_Display_Vie
112 elm_genlist_clear(obj); 112 elm_genlist_clear(obj);
113} 113}
114 114
115EOLIAN static void 115EOLIAN static Eina_Rect
116_elm_file_display_view_list_elm_file_view_size_get(Eo *obj EINA_UNUSED, Elm_File_Display_View_List_Data *pd EINA_UNUSED, Eina_Rectangle *size) 116_elm_file_display_view_list_elm_file_view_size_get(Eo *obj EINA_UNUSED, Elm_File_Display_View_List_Data *pd EINA_UNUSED)
117{ 117{
118 elm_interface_scrollable_content_viewport_geometry_get(obj, &size->x, &size->y, &size->w, &size->h); 118 Eina_Rect size;
119 elm_interface_scrollable_content_viewport_geometry_get(obj, &size.x, &size.y, &size.w, &size.h);
120 return size;
119} 121}
120 122
121EOLIAN static void 123EOLIAN static void
@@ -245,4 +247,4 @@ _elm_file_display_view_list_elm_file_view_filter_set(Eo *obj EINA_UNUSED, Elm_Fi
245} 247}
246 248
247 249
248#include "elm_file_display_view_list.eo.x" \ No newline at end of file 250#include "elm_file_display_view_list.eo.x"