summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksii Piskun <o.piskun@samsung.com>2017-12-29 11:01:36 +0200
committerMykyta Biliavskyi <m.biliavskyi@samsung.com>2017-12-29 11:01:36 +0200
commitbbc5456d9906bb9d8cf8ea75a34e001aac68e158 (patch)
treee2056d03dd31488946d5ca9ea5a6553e7372deb7
parentd5c3293cb76baacd767ae0514e6f1ee8b6ee76c6 (diff)
Remove find feature from ui module.
Summary: Remove code related to find from ui.c to find.c Remove dependence find from global_data struct. Use task registration mechanism for highlight tasks. Remove useless callbacks, because functions now placed in same module. Test Plan: find algorithm haven't changed. So it shoul work as before. Need to check, that all ui elements work good too. Reviewers: i.furs, NikaWhite Differential Revision: https://phab.enlightenment.org/D5713
-rw-r--r--src/lib/find.c745
-rw-r--r--src/lib/helper.h8
-rw-r--r--src/lib/tasks/tasks.h1
-rw-r--r--src/lib/ui.c779
-rw-r--r--src/lib/ui_private.h42
5 files changed, 754 insertions, 821 deletions
diff --git a/src/lib/find.c b/src/lib/find.c
index da7be29..e7b69fb 100644
--- a/src/lib/find.c
+++ b/src/lib/find.c
@@ -17,9 +17,44 @@
17 * along with this program; If not, see www.gnu.org/licenses/lgpl.html. 17 * along with this program; If not, see www.gnu.org/licenses/lgpl.html.
18 */ 18 */
19 19
20#define _GNU_SOURCE
21
20#include "helper.h" 22#include "helper.h"
23#include "tasks/tasks.h"
21#include "find.h" 24#include "find.h"
22 25
26enum _Seek_Mode {
27 SEEK_FIND = 0,
28 SEEK_GO
29};
30typedef enum _Seek_Mode Seek_Mode;
31
32enum _Seek_Range {
33 SEEK_REGION = 0,
34 SEEK_ALL
35};
36typedef enum _Seek_Range Seek_Range;
37
38typedef struct _Find_UI
39{
40 double stored_length;
41
42 Evas_Object *win;
43 Evas_Object *combobox;
44 Evas_Object *box;
45
46 Evas_Object *find_layout;
47 Evas_Object *go_layout;
48
49 Elm_Genlist_Item_Class *combobox_itc;
50
51 Seek_Range seek_range;
52 Seek_Mode seek_mode;
53
54 Eina_Array *highlighted_cache;
55 Eina_Array *highlighted_active_cache;
56} Find_UI;
57
23typedef struct _Find_Data 58typedef struct _Find_Data
24{ 59{
25 Evas_Object *content; 60 Evas_Object *content;
@@ -27,8 +62,13 @@ typedef struct _Find_Data
27 double time; 62 double time;
28 Find_Mode mode; 63 Find_Mode mode;
29 char *name; 64 char *name;
65
66 Find_UI ui;
30} Find_Data; 67} Find_Data;
31 68
69static void _found_array_tasks_fill(Find_Data *find_data, Eina_Array *events);
70static void _found_event_task_fill(Find_Data *find_data, Event_Offsets *event);
71
32static inline Eina_Bool 72static inline Eina_Bool
33_event_compare(Event_Offsets *event1, Event_Offsets *event2) 73_event_compare(Event_Offsets *event1, Event_Offsets *event2)
34{ 74{
@@ -143,13 +183,6 @@ _event_thread_type_name_find(Find_Data *find_data, Eina_Bool threads_single)
143 return event_optimal; 183 return event_optimal;
144} 184}
145 185
146static void
147_event_data_set_cb(void *data, Evas_Object *obj EINA_UNUSED, void *thd)
148{
149 Find_Data *find_data = data;
150 find_data->thd = (In_Thread_Data *)thd;
151}
152
153static Event_Offsets* 186static Event_Offsets*
154_next_event_find(Find_Data *find_data) 187_next_event_find(Find_Data *find_data)
155{ 188{
@@ -233,16 +266,15 @@ _active_events_list_search(Find_Data *find_data, Eina_List *active)
233 return event_optimal; 266 return event_optimal;
234} 267}
235 268
236static void 269static Event_Offsets *
237_event_find_retry_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) 270_event_find_retry(Find_Data *find_data)
238{ 271{
239 Find_Data *find_data = data;
240 Event_Offsets *event = NULL; 272 Event_Offsets *event = NULL;
241 Time_Range interval = find_data->thd->stored_data->interval; 273 Time_Range interval = find_data->thd->stored_data->interval;
242 if (find_data->mode == FIND_MODE_NEXT) 274 if (find_data->mode == FIND_MODE_NEXT)
243 { 275 {
244 while ((event = _next_event_find(find_data)) && 276 while ((event = _next_event_find(find_data)) &&
245 (event->offset_finish ? event->time_end : event->time_start) < interval.start) 277 (event->time_end < interval.start))
246 { 278 {
247 ; /* NULL */ 279 ; /* NULL */
248 } 280 }
@@ -265,16 +297,29 @@ _event_find_retry_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
265 } 297 }
266 } 298 }
267 299
268 Event_Offsets **event_return = event_info; 300 return event;
269 *event_return = event;
270} 301}
271 302
272static void 303static void
273_event_name_next_find_cb(void *data, Evas_Object *obj EINA_UNUSED, void *name) 304_event_name_not_found_cb(Find_Data *find_data)
305{
306 const char *name;
307 char failure[STRING_LENGTH];
308 name = elm_object_text_get(find_data->ui.combobox);
309 if (!name)
310 return;
311
312 if (eina_str_has_prefix(name, "<failure>"))
313 if (eina_str_has_suffix(name, "</failure>"))
314 return;
315
316 snprintf(failure, STRING_LENGTH, "<failure>%s</failure>", name);
317 elm_object_text_set(find_data->ui.combobox, failure);
318}
319
320static void
321_event_name_next_find_cb(Find_Data *find_data)
274{ 322{
275 Find_Data *find_data = data;
276 find_data->name = name;
277 find_data->mode = FIND_MODE_NEXT;
278 Time_Range interval = find_data->thd->stored_data->interval; 323 Time_Range interval = find_data->thd->stored_data->interval;
279 Event_Offsets *event = NULL; 324 Event_Offsets *event = NULL;
280 325
@@ -292,23 +337,20 @@ _event_name_next_find_cb(void *data, Evas_Object *obj EINA_UNUSED, void *name)
292 if (!event) event = _next_event_find(find_data); 337 if (!event) event = _next_event_find(find_data);
293 338
294 if (!event) 339 if (!event)
295 evas_object_smart_callback_call(find_data->content, "event,not,found", NULL); 340 _event_name_not_found_cb(find_data);
296 else 341 else
297 evas_object_smart_callback_call(find_data->content, "event,found,show", event); 342 _found_event_task_fill(find_data, event);
298} 343}
299 344
300static void 345static void
301_event_name_previous_find_cb(void *data, Evas_Object *obj EINA_UNUSED, void *name) 346_event_name_previous_find_cb(Find_Data *find_data)
302{ 347{
303 Find_Data *find_data = data;
304 find_data->name = name;
305 find_data->mode = FIND_MODE_PREVIOUS;
306 Event_Offsets *event = _prev_event_find(find_data); 348 Event_Offsets *event = _prev_event_find(find_data);
307 349
308 if (!event) 350 if (!event)
309 evas_object_smart_callback_call(find_data->content, "event,not,found", NULL); 351 _event_name_not_found_cb(find_data);
310 else 352 else
311 evas_object_smart_callback_call(find_data->content, "event,found,show", event); 353 _found_event_task_fill(find_data, event);
312} 354}
313 355
314/* Highlight all */ 356/* Highlight all */
@@ -324,9 +366,9 @@ _event_name_state_array_find(Find_Data *find_data)
324 if (ev_inf_st && !ev_inf_st->common.filtered) 366 if (ev_inf_st && !ev_inf_st->common.filtered)
325 { 367 {
326 eina_rwlock_take_read(&ev_inf_st->state_events.lock); 368 eina_rwlock_take_read(&ev_inf_st->state_events.lock);
327 evas_object_smart_callback_call(find_data->content, 369
328 "event,array,found,show", 370 _found_array_tasks_fill(find_data, ev_inf_st->state_events.data);
329 ev_inf_st->state_events.data); 371
330 eina_rwlock_release(&ev_inf_st->state_events.lock); 372 eina_rwlock_release(&ev_inf_st->state_events.lock);
331 } 373 }
332} 374}
@@ -371,9 +413,7 @@ _event_name_thread_type_array_find(Find_Data *find_data, Eina_Bool threads_singl
371 EINA_ARRAY_ITER_NEXT(data, index, te, it) 413 EINA_ARRAY_ITER_NEXT(data, index, te, it)
372 { 414 {
373 eina_rwlock_take_read(&te->thread_events.lock); 415 eina_rwlock_take_read(&te->thread_events.lock);
374 evas_object_smart_callback_call(find_data->content, 416 _found_array_tasks_fill(find_data, te->thread_events.data);
375 "event,array,found,show",
376 te->thread_events.data);
377 eina_rwlock_release(&te->thread_events.lock); 417 eina_rwlock_release(&te->thread_events.lock);
378 } 418 }
379 if (threads_single) 419 if (threads_single)
@@ -384,10 +424,8 @@ _event_name_thread_type_array_find(Find_Data *find_data, Eina_Bool threads_singl
384} 424}
385 425
386static void 426static void
387_event_name_array_find_cb(void *data, Evas_Object *obj EINA_UNUSED, void *name) 427_event_name_array_find_cb(Find_Data *find_data)
388{ 428{
389 Find_Data *find_data = data;
390 find_data->name = name;
391 _event_name_state_array_find(find_data); 429 _event_name_state_array_find(find_data);
392 _event_name_thread_type_array_find(find_data, EINA_FALSE); 430 _event_name_thread_type_array_find(find_data, EINA_FALSE);
393 _event_name_thread_type_array_find(find_data, EINA_TRUE); 431 _event_name_thread_type_array_find(find_data, EINA_TRUE);
@@ -402,23 +440,640 @@ _event_time_select_set_cb(void *data, Evas_Object *obj EINA_UNUSED, void *time)
402} 440}
403 441
404static void 442static void
405_event_data_free_cb(void *find_data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 443_event_data_free_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
406{ 444{
445 Find_Data *find_data = data;
446 if (find_data->ui.win)
447 {
448 evas_object_del(find_data->ui.win);
449 elm_genlist_item_class_free(find_data->ui.combobox_itc);
450 }
407 free(find_data); 451 free(find_data);
408} 452}
409 453
454/* UI */
455static void
456_find_win_del(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
457{
458 evas_object_hide(obj);
459}
460
461static int
462_list_str_cmp_cb(const void *d1, const void *d2)
463{
464 const char *txt = d1;
465 const char *txt2 = d2;
466
467 if (!txt) return(1);
468 if (!txt2) return(-1);
469
470 return strcmp(txt, txt2);
471}
472
473static char *
474_gl_text_get_cb(void *data,
475 Evas_Object *obj EINA_UNUSED,
476 const char *part EINA_UNUSED)
477{
478 if (!data)
479 return NULL;
480 return strdup(data);
481}
482
483static Eina_Bool
484_gl_filter_get_cb(void *data, Evas_Object *obj EINA_UNUSED, void *key)
485{
486 if (key && data && strcasestr(data, (char *)key))
487 return EINA_TRUE;
488 return EINA_FALSE;
489}
490
491static Eina_Bool
492_name_uniq_save_cb(const Eina_Hash *hash EINA_UNUSED,
493 const void *key,
494 void *data EINA_UNUSED,
495 void *fdata)
496{
497 Eina_List **names = fdata;
498 if (!eina_list_search_sorted(*names, _list_str_cmp_cb, key))
499 *names = eina_list_sorted_insert(*names ,_list_str_cmp_cb, key);
500
501 return EINA_TRUE;
502}
503
504static void
505_find_combobox_update_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
506{
507 Find_Data *find_data = data;
508 Find_UI *ui = &find_data->ui;
509
510 if (event_info)
511 find_data->thd = event_info;
512 if (!ui->combobox) return;
513
514 In_Thread_Data *thd = find_data->thd;
515 Eina_List *names_list = NULL;
516 char *key = NULL;
517 if (!ui->combobox_itc)
518 {
519 ui->combobox_itc = elm_genlist_item_class_new();
520 ui->combobox_itc->item_style = "default";
521 ui->combobox_itc->func.text_get = _gl_text_get_cb;
522 ui->combobox_itc->func.content_get = NULL;
523 ui->combobox_itc->func.state_get = NULL;
524 ui->combobox_itc->func.filter_get = _gl_filter_get_cb;
525 ui->combobox_itc->func.del = NULL;
526 }
527
528 eina_rwlock_take_read(&thd->thread_events.lock);
529 eina_hash_foreach(thd->thread_events.hash, _name_uniq_save_cb, &names_list);
530 eina_rwlock_release(&thd->thread_events.lock);
531 eina_rwlock_take_read(&thd->state_events.lock);
532 eina_hash_foreach(thd->state_events.hash, _name_uniq_save_cb, &names_list);
533 eina_rwlock_release(&thd->state_events.lock);
534 eina_rwlock_take_read(&thd->single_events.lock);
535 eina_hash_foreach(thd->single_events.hash, _name_uniq_save_cb, &names_list);
536 eina_rwlock_release(&thd->single_events.lock);
537 elm_combobox_hover_end(ui->combobox);
538 elm_genlist_clear(ui->combobox);
539
540 EINA_LIST_FREE(names_list, key)
541 {
542 elm_genlist_item_append(ui->combobox, ui->combobox_itc, key, NULL,
543 ELM_GENLIST_ITEM_NONE, NULL, key);
544 }
545}
546
547static void
548_event_name_find_reset_color_cb(void *data EINA_UNUSED,
549 Evas_Object *obj,
550 void *event_info EINA_UNUSED)
551{
552 char *name = elm_entry_markup_to_utf8(elm_object_text_get(obj));
553 elm_object_text_set(obj, name);
554 free(name);
555}
556
557static void
558_gl_filter_restart_cb(void *data EINA_UNUSED,
559 Evas_Object *obj,
560 void *event_info EINA_UNUSED)
561{
562 elm_genlist_filter_set(obj, (void *)elm_object_text_get(obj));
563}
564
565static void
566_combobox_item_pressed_cb(void *data EINA_UNUSED, Evas_Object *obj,
567 void *event_info)
568{
569 const char *txt = elm_object_item_text_get(event_info);
570 elm_object_text_set(obj, txt);
571 elm_combobox_hover_end(obj);
572 elm_entry_cursor_end_set(obj);
573}
574
575static Evas_Object *
576_find_combobox_create(Find_UI *ui)
577{
578 Evas_Object *combobox = NULL;
579
580 combobox = elm_combobox_add(ui->win);
581 evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
582 evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, EVAS_HINT_FILL);
583 elm_object_part_text_set(combobox, "guide", _("Enter event name"));
584 evas_object_show(combobox);
585
586 evas_object_smart_callback_add(combobox, "changed,user", _event_name_find_reset_color_cb, NULL);
587 evas_object_smart_callback_add(combobox, "changed", _gl_filter_restart_cb, NULL);
588 evas_object_smart_callback_add(combobox, "item,pressed", _combobox_item_pressed_cb, NULL);
589 return combobox;
590}
591
592static void
593_seek_current_range_mode_cb(void *data,
594 Evas_Object *obj EINA_UNUSED,
595 void *event_info EINA_UNUSED)
596{
597 Find_UI *ui = (Find_UI *) data;
598 ui->seek_range = SEEK_REGION;
599}
600
601static void
602_seek_all_data_mode_cb(void *data,
603 Evas_Object *obj EINA_UNUSED,
604 void *event_info EINA_UNUSED)
605{
606 Find_UI *ui = (Find_UI *) data;
607 ui->seek_range = SEEK_ALL;
608}
609
610static void
611_event_name_find_show(void *data, Find_Mode mode)
612{
613 Evas_Object *combobox;
614 Find_Data *find_data = data;
615 combobox = find_data->ui.combobox;
616 evas_object_smart_callback_call(combobox, "changed,user", NULL);
617 evas_object_smart_callback_call(find_data->content, "unfollow", NULL);
618
619 find_data->name = elm_entry_markup_to_utf8(elm_object_text_get(combobox));
620 evas_object_smart_callback_call(find_data->content, "event,unselect", NULL);
621
622 find_data->mode = mode;
623
624 if (mode == FIND_MODE_NEXT)
625 _event_name_next_find_cb(find_data);
626
627 if (mode == FIND_MODE_PREVIOUS)
628 _event_name_previous_find_cb(find_data);
629}
630
631static void
632_event_name_find_previous_cb(void *data,
633 Evas_Object *obj EINA_UNUSED,
634 void *event_info EINA_UNUSED)
635{
636 _event_name_find_show(data, FIND_MODE_PREVIOUS);
637}
638
639static void
640_event_name_find_next_cb(void *data,
641 Evas_Object *obj EINA_UNUSED,
642 void *event_info EINA_UNUSED)
643{
644 _event_name_find_show(data, FIND_MODE_NEXT);
645}
646
647static void
648_find_dialog_buttons_add(Evas_Object *layout, Find_Data *find_data)
649{
650 Evas_Object *button = NULL;
651
652 button = elm_button_add(layout);
653 elm_object_text_set(button, _("Previous"));
654 evas_object_smart_callback_add(button, "clicked", _event_name_find_previous_cb, find_data);
655 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
656 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
657 elm_object_part_content_set(layout, "find_prev_btn", button);
658 evas_object_show(button);
659
660 button = elm_button_add(layout);
661 elm_object_text_set(button, _("Next"));
662 evas_object_smart_callback_add(button, "clicked", _event_name_find_next_cb, find_data);
663 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
664 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
665 elm_object_part_content_set(layout, "find_next_btn", button);
666 evas_object_show(button);
667}
668
669static void
670_find_layout_update(Evas_Object *layout, Find_UI *ui)
671{
672 Evas_Object *hoversel = elm_object_part_content_get(layout,
673 "find_in_cmbbx");
674 switch (ui->seek_range)
675 {
676 case SEEK_REGION:
677 {
678 elm_object_text_set(hoversel, _("Current range"));
679 break;
680 }
681 case SEEK_ALL:
682 {
683 elm_object_text_set(hoversel, _("Full time"));
684 break;
685 }
686 }
687}
688
689static void
690_switch_find_ui_mode(Find_UI *ui)
691{
692 Evas_Object *active_layout = NULL;
693 Evas_Object *inactive_layout = NULL;
694
695 switch (ui->seek_mode)
696 {
697 case SEEK_FIND:
698 {
699 active_layout = ui->find_layout;
700 inactive_layout = ui->go_layout;
701 _find_layout_update(active_layout, ui);
702 break;
703 }
704 case SEEK_GO:
705 {
706 active_layout = ui->go_layout;
707 inactive_layout = ui->find_layout;
708 ui->seek_range = SEEK_ALL;
709 break;
710 }
711 }
712
713 elm_box_unpack(ui->box, inactive_layout);
714 evas_object_hide(inactive_layout);
715 elm_box_pack_end(ui->box, active_layout);
716 evas_object_show(active_layout);
717
718 elm_object_part_content_set(active_layout, "combobox", ui->combobox);
719}
720
721static void
722_event_name_find_all_cb(void *data, Evas_Object *obj EINA_UNUSED,
723 void *event_info EINA_UNUSED)
724{
725 char *name;
726 Find_Data *find_data = data;
727 Find_UI *ui = &find_data->ui;
728
729 evas_object_smart_callback_call(ui->combobox, "changed,user", NULL);
730 evas_object_smart_callback_call(find_data->content, "unfollow", NULL);
731 evas_object_smart_callback_call(find_data->content, "event,unselect", NULL);
732 name = elm_entry_markup_to_utf8(elm_object_text_get(ui->combobox));
733 find_data->name = name;
734 _event_name_array_find_cb(find_data);
735}
736
737static Evas_Object *
738_find_layout_create(Find_Data *find_data)
739{
740 Find_UI *ui = &find_data->ui;
741 Evas_Object *layout = NULL;
742 Evas_Object *hoversel = NULL;
743
744 if (!ui->combobox)
745 {
746 ERR("Failed create find layout: combobox isn't created");
747 return NULL;
748 }
749
750 layout = layout_create(ui->win, "efl_profiling_viewer", "find");
751 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
752 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
753 evas_object_show(layout);
754
755 elm_object_part_content_set(layout, "combobox", ui->combobox);
756
757 hoversel = elm_hoversel_add(layout);
758 elm_hoversel_auto_update_set(hoversel, EINA_TRUE);
759 evas_object_size_hint_weight_set(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
760 evas_object_size_hint_align_set(hoversel, EVAS_HINT_FILL, EVAS_HINT_FILL);
761 elm_hoversel_item_add(hoversel, _("Current range"), NULL, ELM_ICON_NONE,
762 _seek_current_range_mode_cb, ui);
763 elm_hoversel_item_add(hoversel, _("Full time"), NULL, ELM_ICON_NONE,
764 _seek_all_data_mode_cb, ui);
765 elm_object_part_content_set(layout, "find_in_cmbbx", hoversel);
766 evas_object_show(hoversel);
767
768 Evas_Object *button = elm_button_add(layout);
769 elm_object_text_set(button, _("Highlight all"));
770 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
771 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
772 elm_object_part_content_set(layout, "highlight", button);
773 evas_object_show(button);
774 evas_object_smart_callback_add(button, "clicked", _event_name_find_all_cb, find_data);
775
776 _find_layout_update(layout, ui);
777 _find_dialog_buttons_add(layout, find_data);
778
779 return layout;
780}
781
782static Evas_Object *
783_go_layout_create(Find_Data *find_data)
784{
785 Find_UI *ui = &find_data->ui;
786 Evas_Object *layout = NULL;
787
788 if (!ui->combobox)
789 {
790 ERR("Failed create go layout: combobox isn't created");
791 return NULL;
792 }
793
794 layout = layout_create(ui->win, "efl_profiling_viewer", "find");
795 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
796 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
797 evas_object_show(layout);
798 elm_object_part_content_set(layout, "combobox", ui->combobox);
799
800 _find_dialog_buttons_add(layout, find_data);
801 return layout;
802}
803
804static void
805_find_toolbar_item_clicked_cb(void *data,
806 Evas_Object *obj EINA_UNUSED,
807 void *event_info EINA_UNUSED)
808{
809 Find_Data *find_data = data;
810 Find_UI *ui = &find_data->ui;
811 ui->seek_mode = SEEK_FIND;
812 _switch_find_ui_mode(ui);
813}
814
815static void
816_go_toolbar_item_clicked_cb(void *data,
817 Evas_Object *obj EINA_UNUSED,
818 void *event_info EINA_UNUSED)
819{
820 Find_Data *find_data = data;
821 Find_UI *ui = &find_data->ui;
822 ui->seek_mode = SEEK_GO;
823 _switch_find_ui_mode(ui);
824}
825
826static void
827_menu_find_dialog_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
828{
829 Find_Data *find_data = data;
830 Evas_Object *box = NULL;
831 Evas_Object *toolbar = NULL;
832 Find_UI *ui = &find_data->ui;
833
834 if (ui->win)
835 {
836 evas_object_show(ui->win);
837 elm_win_activate(ui->win);
838 return;
839 }
840
841 ui->win = elm_win_util_dialog_add(obj, "find", _("Find event"));
842 elm_win_autodel_set(ui->win, EINA_FALSE);
843 evas_object_smart_callback_add(ui->win, "delete,request", _find_win_del, NULL);
844 evas_object_show(ui->win);
845
846 box = elm_box_add(ui->win);
847 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
848 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
849 elm_box_padding_set(box, 0, 10);
850 ui->box = box;
851 evas_object_show(box);
852 elm_win_resize_object_add(ui->win, box);
853
854 toolbar = elm_toolbar_add(ui->win);
855 elm_toolbar_homogeneous_set(toolbar, EINA_FALSE);
856 elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_SCROLL);
857 elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
858 elm_toolbar_align_set(toolbar, 0.0);
859 elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
860 evas_object_size_hint_weight_set(toolbar, 0.0, 0.0);
861 evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, 0.0);
862 evas_object_show(toolbar);
863 elm_box_pack_end(box, toolbar);
864
865 ui->seek_range = SEEK_ALL;
866 ui->seek_mode = SEEK_FIND;
867 ui->combobox = _find_combobox_create(ui);
868 evas_object_smart_callback_call(find_data->content, "find,combobox,update", NULL);
869
870 ui->find_layout = _find_layout_create(find_data);
871 ui->go_layout = _go_layout_create(find_data);
872 elm_toolbar_item_append(toolbar, NULL, _("Find"), _find_toolbar_item_clicked_cb, find_data);
873 elm_toolbar_item_append(toolbar, NULL, _("Go"), _go_toolbar_item_clicked_cb, find_data);
874 _switch_find_ui_mode(ui);
875}
876/* UI */
877
878/* Event draw */
879static Event_Offsets *
880_found_event_process(Find_Data *find_data, Event_Offsets *event)
881{
882 Time_Range interval = find_data->thd->stored_data->interval;
883 double time_start;
884 double time_end;
885 double length = find_data->ui.stored_length;
886 if (!length) length = interval.length;
887
888 time_start = event->time_start;
889
890 if (event->event_info->common.type != SINGLE_EVENT)
891 time_end = event->time_end;
892 else
893 time_end = time_start;
894
895 double delta = 0.0;
896 Eina_Bool redraw = EINA_FALSE;
897
898 switch (find_data->ui.seek_mode)
899 {
900 case SEEK_FIND:
901 if (find_data->ui.seek_range == SEEK_ALL)
902 {
903 if (!interval_cross(time_start, time_end, interval))
904 {
905 redraw = EINA_TRUE;
906 }
907 if (find_data->ui.stored_length)
908 interval.length = find_data->ui.stored_length;
909 interval.start = (time_end + time_start) / 2.0;
910 interval.start -= interval.length / 2.0;
911 }
912 else
913 {
914 while (!interval_cross(time_start, time_end, interval))
915 {
916 event = _event_find_retry(find_data);
917 if (!event)
918 {
919 _event_name_not_found_cb(find_data);
920 return NULL;
921 }
922 time_start = event->time_start;
923 if (event->event_info->common.type != SINGLE_EVENT)
924 time_end = event->time_end;
925 else
926 time_end = time_start;
927 }
928 }
929 break;
930 case SEEK_GO:
931 if (event->event_info->common.type != SINGLE_EVENT)
932 {
933 interval.length = (time_end - time_start) * 1.03;
934 delta = interval.length * 0.03;
935 }
936 else
937 {
938 interval.length = 0;
939 delta = 0.000001;
940 }
941 interval.start = time_start - delta;
942 interval.length += delta * 2.0;
943
944 if (!((interval.start == find_data->thd->stored_data->interval.start) &&
945 (interval.length == find_data->thd->stored_data->interval.length)))
946 redraw = EINA_TRUE;
947 break;
948 }
949
950 if (redraw)
951 {
952 find_data->thd->selected_start_offset = event->offset_start;
953 event = NULL;
954 evas_object_smart_callback_call(find_data->content,
955 "display,interval",
956 &interval);
957 if (find_data->ui.seek_mode == SEEK_GO)
958 find_data->ui.stored_length = length;
959
960 }
961 return event;
962}
963
964static inline void
965_highlight_task_coords_fill(Time_Range interval,
966 Event_Offsets *event,
967 Task_Highlight *task)
968{
969 double time_start, time_end;
970 time_start = event->time_start;
971 double interval_end = interval.start + interval.length;
972
973 time_end = (event->time_end > interval_end) ? interval_end : event->time_end;
974 task->common.grid.x = time_to_grid_interval_convert(time_start, interval);
975 if (task->common.grid.x < 0) task->common.grid.x = 0;
976 task->common.grid.w = time_to_grid_interval_convert(time_end, interval) - task->common.grid.x;
977 task->common.grid.y = event->grid_slot;
978 task->common.grid.h = 2;
979
980 if (task->common.grid.w <= 0) task->common.grid.w = 1;
981
982 DBG("Selected coords: \tx: %i\tw: %i\ty: %i\th:%i", task->common.grid.x,
983 task->common.grid.w, task->common.grid.y, task->common.grid.h);
984}
985
986static void
987_found_event_task_fill(Find_Data *find_data, Event_Offsets *event)
988{
989 Task_Highlight *task = NULL;
990
991 event = _found_event_process(find_data, event);
992 if (!event) return;
993
994 evas_object_smart_callback_call(find_data->content, "task,highlight,register", &task);
995 _highlight_task_coords_fill(find_data->thd->stored_data->interval, event, task);
996 task->type = event->event_info->common.type;
997 task->grid_num = event->thread_slot;
998 evas_object_smart_callback_call(find_data->content, "task,highlight,grid,set", task);
999 task->offset_start = event->offset_start;
1000 task->offset_finish = event->offset_finish;
1001 task->standalone = EINA_TRUE;
1002}
1003
1004static inline Eina_Bool
1005_highlight_filling_hash_check(Eina_Hash *hash, Task_Highlight *task)
1006{
1007 long long int key;
1008 key = ((long long int)task->common.grid.x << 48) |
1009 ((long long int)task->common.grid.y << 32) |
1010 ((long long int)task->common.grid.w << 16) |
1011 (long long int)task->common.grid.h;
1012
1013 if (eina_hash_find(hash, &key))
1014 return EINA_FALSE;
1015
1016 eina_hash_add(hash, &key, &key);
1017 return EINA_TRUE;
1018}
1019
1020static void
1021_found_array_tasks_fill(Find_Data *find_data, Eina_Array *events)
1022{
1023 //Evas_Object *grid = NULL;
1024 double time_start, time_end;
1025 Time_Range interval = find_data->thd->stored_data->interval;
1026 Eina_Hash *grid_position_unique_highlight = eina_hash_int64_new(NULL);
1027 Task_Highlight *task = NULL;
1028
1029 unsigned int index;
1030 Event_Offsets *event;
1031 Eina_Array_Iterator it;
1032 EINA_ARRAY_ITER_NEXT(events, index, event, it)
1033 {
1034 time_start = event->time_start;
1035 time_end = event->time_end;
1036
1037 if (!interval_cross(time_start, time_end, interval))
1038 continue;
1039 if (!task)
1040 evas_object_smart_callback_call(find_data->content, "task,highlight,register", &task);
1041 _highlight_task_coords_fill(find_data->thd->stored_data->interval, event, task);
1042
1043 if (!_highlight_filling_hash_check(grid_position_unique_highlight, task))
1044 continue;
1045
1046 task->type = event->event_info->common.type;
1047 task->grid_num = event->thread_slot;
1048 evas_object_smart_callback_call(find_data->content, "task,highlight,grid,set", task);
1049 task->offset_start = event->offset_start;
1050 task->offset_finish = event->offset_finish;
1051 task = NULL;
1052 }
1053 eina_hash_free(grid_position_unique_highlight);
1054}
1055/* Event draw */
1056
1057static void
1058_interval_display_cb(void *data,
1059 Evas_Object *obj EINA_UNUSED,
1060 void *event_info EINA_UNUSED)
1061{
1062 Find_Data *find_data = data;
1063 find_data->ui.stored_length = 0;
1064}
1065
410Eina_Bool 1066Eina_Bool
411find_init(Evas_Object* content) 1067find_init(Evas_Object* content)
412{ 1068{
413 Find_Data *find_data = (Find_Data *)calloc(1, sizeof(Find_Data)); 1069 Find_Data *find_data = (Find_Data *)calloc(1, sizeof(Find_Data));
414 find_data->content = content; 1070 find_data->content = content;
415 evas_object_smart_callback_add(content, "event,data,set", _event_data_set_cb, find_data); 1071 evas_object_smart_callback_add(content, "find,combobox,update", _find_combobox_update_cb, find_data);
416 evas_object_smart_callback_add(content, "event,name,array,find", _event_name_array_find_cb, find_data);
417 evas_object_smart_callback_add(content, "event,find,retry", _event_find_retry_cb, find_data);
418 evas_object_smart_callback_add(content, "event,name,next,find", _event_name_next_find_cb, find_data);
419 evas_object_smart_callback_add(content, "event,name,previous,find", _event_name_previous_find_cb, find_data);
420 evas_object_smart_callback_add(content, "event,time,current", _event_time_select_set_cb, find_data); 1072 evas_object_smart_callback_add(content, "event,time,current", _event_time_select_set_cb, find_data);
421 evas_object_smart_callback_add(content, "event,data,free", _event_data_free_cb, find_data); 1073 evas_object_smart_callback_add(content, "event,data,free", _event_data_free_cb, find_data);
1074 evas_object_smart_callback_add(content, "display,interval", _interval_display_cb, find_data);
1075
1076 evas_object_smart_callback_add(content, "find,show", _menu_find_dialog_cb, find_data);
422 1077
423 return EINA_TRUE; 1078 return EINA_TRUE;
424} 1079}
@@ -428,14 +1083,12 @@ find_shutdown(Evas_Object* content)
428{ 1083{
429 evas_object_smart_callback_call(content, "event,data,free", NULL); 1084 evas_object_smart_callback_call(content, "event,data,free", NULL);
430 1085
431 evas_object_smart_callback_del(content, "event,data,set", _event_data_set_cb); 1086 evas_object_smart_callback_del(content, "find,combobox,update", _find_combobox_update_cb);
432 evas_object_smart_callback_del(content, "event,name,array,find", _event_name_array_find_cb);
433 evas_object_smart_callback_del(content, "event,find,retry", _event_find_retry_cb);
434 evas_object_smart_callback_del(content, "event,name,next,find", _event_name_next_find_cb);
435 evas_object_smart_callback_del(content, "event,name,previous,find", _event_name_previous_find_cb);
436 evas_object_smart_callback_del(content, "event,time,current", _event_time_select_set_cb); 1087 evas_object_smart_callback_del(content, "event,time,current", _event_time_select_set_cb);
437 evas_object_smart_callback_del(content, "event,data,free", _event_data_free_cb); 1088 evas_object_smart_callback_del(content, "event,data,free", _event_data_free_cb);
1089 evas_object_smart_callback_del(content, "display,interval", _interval_display_cb);
1090
1091 evas_object_smart_callback_del(content, "find,show", _menu_find_dialog_cb);
438 1092
439 return EINA_TRUE; 1093 return EINA_TRUE;
440} 1094}
441
diff --git a/src/lib/helper.h b/src/lib/helper.h
index b08dabc..7938e97 100644
--- a/src/lib/helper.h
+++ b/src/lib/helper.h
@@ -537,4 +537,12 @@ Eina_Bool interval_cross(double start, double end, Time_Range interval);
537 */ 537 */
538unsigned int event_offsets_time_binary_search(Eina_Array *arr, double time); 538unsigned int event_offsets_time_binary_search(Eina_Array *arr, double time);
539 539
540/**
541 *
542 * This function convert point from time interval into point from grid interval.
543 * @return Grid interval in range 1..GRID_SCALE.
544 *
545 */
546int time_to_grid_interval_convert(double time, Time_Range interval);
547
540#endif 548#endif
diff --git a/src/lib/tasks/tasks.h b/src/lib/tasks/tasks.h
index 1e3d02b..fd58ffc 100644
--- a/src/lib/tasks/tasks.h
+++ b/src/lib/tasks/tasks.h
@@ -124,6 +124,7 @@ struct _Task_Highlight
124 long offset_start; 124 long offset_start;
125 long offset_finish; 125 long offset_finish;
126 Eina_Bool standalone; 126 Eina_Bool standalone;
127 int grid_num;
127 }; 128 };
128 129
129struct _Task_Queue 130struct _Task_Queue
diff --git a/src/lib/ui.c b/src/lib/ui.c
index 488b048..a816431 100644
--- a/src/lib/ui.c
+++ b/src/lib/ui.c
@@ -16,7 +16,6 @@
16 * You should have received a copy of the GNU Lesser General Public License 16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; If not, see www.gnu.org/licenses/lgpl.html. 17 * along with this program; If not, see www.gnu.org/licenses/lgpl.html.
18 */ 18 */
19#define _GNU_SOURCE
20 19
21#include "helper.h" 20#include "helper.h"
22#include "ui_private.h" 21#include "ui_private.h"
@@ -27,7 +26,6 @@
27#define MIN_LENGTH_BETWEEN_TIMEMARKS 140 26#define MIN_LENGTH_BETWEEN_TIMEMARKS 140
28 27
29static void timemarks_fill(Global_Data *gd); 28static void timemarks_fill(Global_Data *gd);
30static void _find_combobox_update(Find_UI *find, In_Thread_Data *thd);
31static void _menu_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); 29static void _menu_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
32 30
33#define ZERO_LOG_EVENT {NULL, NULL, 0.0} 31#define ZERO_LOG_EVENT {NULL, NULL, 0.0}
@@ -259,8 +257,8 @@ _event_unselected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info
259 257
260void 258void
261_event_selected_cb(void *data, Evas_Object *obj, 259_event_selected_cb(void *data, Evas_Object *obj,
262 const char *emission EINA_UNUSED, 260 const char *emission EINA_UNUSED,
263 const char *source EINA_UNUSED) 261 const char *source EINA_UNUSED)
264{ 262{
265 Global_Data *gd = data; 263 Global_Data *gd = data;
266 Evas_Object *selected_event = gd->thd->selected_event; 264 Evas_Object *selected_event = gd->thd->selected_event;
@@ -347,7 +345,6 @@ layout_event_set(Global_Data *gd)
347 Evas_Object *win = gd->ui->win; 345 Evas_Object *win = gd->ui->win;
348 Evas_Object *layout = layout_create(win, PROJECT_NAME, "events"); 346 Evas_Object *layout = layout_create(win, PROJECT_NAME, "events");
349 elm_layout_signal_callback_add(layout, "clicked", "*", _event_selected_cb, gd); 347 elm_layout_signal_callback_add(layout, "clicked", "*", _event_selected_cb, gd);
350 evas_object_smart_callback_add(layout, "event,unselect", _event_unselected_cb, gd);
351 evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_UP, 348 evas_object_event_callback_add(layout, EVAS_CALLBACK_MOUSE_UP,
352 _double_clicked_event_cb, gd); 349 _double_clicked_event_cb, gd);
353 return layout; 350 return layout;
@@ -852,10 +849,7 @@ _event_area_init_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
852 elm_object_part_content_set(info_panes, "bottom", info_layout); 849 elm_object_part_content_set(info_panes, "bottom", info_layout);
853 elm_panes_content_right_size_set(info_panes, 0.05); 850 elm_panes_content_right_size_set(info_panes, 0.05);
854 851
855 if (gd->ui->find.combobox) 852 evas_object_smart_callback_call(gd->ui->panes, "find,combobox,update", thd);
856 {
857 _find_combobox_update(&gd->ui->find, gd->thd);
858 }
859 853
860 elm_object_part_content_set(panes, "top", info_panes); 854 elm_object_part_content_set(panes, "top", info_panes);
861 855
@@ -1269,7 +1263,6 @@ _interval_display_cb(void *data,
1269 tasks_idler_exiter(gd); 1263 tasks_idler_exiter(gd);
1270 1264
1271 gd->thd->stored_data->interval = ret; 1265 gd->thd->stored_data->interval = ret;
1272 gd->ui->find.stored_length = 0;
1273 gd->thd->need_to_unselect = EINA_TRUE; 1266 gd->thd->need_to_unselect = EINA_TRUE;
1274 if (gd->thd->selected_event) 1267 if (gd->thd->selected_event)
1275 { 1268 {
@@ -1946,740 +1939,78 @@ _task_use_register_cb(void *data,
1946} 1939}
1947 1940
1948static void 1941static void
1949_enterer_add_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) 1942_task_highlight_register_cb(void *data,
1943 Evas_Object *obj EINA_UNUSED,
1944 void *event_info)
1950{ 1945{
1951 Global_Data *gd = data; 1946 Global_Data *gd = data;
1952 unsigned int mask; 1947 Task_Highlight **task = event_info;
1953 mask = *(unsigned int *)event_info; 1948
1954 gd->mask |= mask; 1949 *task = task_highlight_event_add(&(gd->tasks));
1955 if ((gd->mask == 0x1F) && (!gd->enterer)) 1950 if (!(*task))
1956 { 1951 {
1957 tasks_idler_exiter(gd); 1952 ERR("Failed to create new task object");
1958 grids_clear(gd); 1953 return;
1959 _timemarks_range_labels_add(gd);
1960 if (gd->thd->need_to_unselect)
1961 {
1962 _event_unselected_cb(gd, NULL, NULL);
1963 }
1964 gd->enterer = ecore_idle_enterer_add(tasks_idler_enterer, gd);
1965 malloc_trim(0);
1966 } 1954 }
1967}
1968
1969/*================Find START==================*/
1970static void
1971_find_menu_cb(void *data,
1972 Evas_Object *obj EINA_UNUSED,
1973 void *event_info EINA_UNUSED)
1974{
1975 Global_Data *gd = (Global_Data *) data;
1976 if (!gd) return;
1977 evas_object_smart_callback_call(gd->ui->panes, "find,show", NULL);
1978}
1979 1955
1980static void 1956 (*task)->common.gd = gd;
1981_find_win_del(void *data,
1982 Evas_Object *obj EINA_UNUSED,
1983 void *event_info EINA_UNUSED)
1984{
1985 Find_UI *find = data;
1986 evas_object_hide(find->win);
1987} 1957}
1988 1958
1989static void 1959static void
1990_event_name_not_found_cb(void *data, 1960_task_highlight_grid_set_cb(void *data,
1991 Evas_Object *obj EINA_UNUSED, 1961 Evas_Object *obj EINA_UNUSED,
1992 void *event_info EINA_UNUSED) 1962 void *event_info)
1993{ 1963{
1994 const char *name; 1964 Task_Highlight *task = event_info;
1995 Global_Data *gd = data; 1965 Global_Data *gd = data;
1996 char failure[STRING_LENGTH]; 1966 switch (task->type)
1997 name = elm_object_text_get(gd->ui->find.combobox);
1998 if (!name)
1999 return;
2000
2001 if (eina_str_has_prefix(name, "<failure>"))
2002 if (eina_str_has_suffix(name, "</failure>"))
2003 return;
2004
2005 snprintf(failure, STRING_LENGTH, "<failure>%s</failure>", name);
2006 elm_object_text_set(gd->ui->find.combobox, failure);
2007}
2008
2009static void
2010_event_name_find_reset_color_cb(void *data EINA_UNUSED,
2011 Evas_Object *obj,
2012 void *event_info EINA_UNUSED)
2013{
2014 char *name = elm_entry_markup_to_utf8(elm_object_text_get(obj));
2015 elm_object_text_set(obj, name);
2016 free(name);
2017}
2018
2019static inline Eina_Bool
2020_hash_unique_save(Eina_Hash *hash,
2021 void *data,
2022 Eina_Rectangle rect_highlight)
2023{
2024 long long int key;
2025 key = ((long long int)rect_highlight.x << 48) |
2026 ((long long int)rect_highlight.y << 32) |
2027 ((long long int)rect_highlight.w << 16) |
2028 (long long int)rect_highlight.h;
2029
2030 if (data == eina_hash_find(hash, &key))
2031 return EINA_FALSE;
2032
2033 eina_hash_add(hash, &key, data);
2034 return EINA_TRUE;
2035}
2036
2037static inline Eina_Bool
2038_grid_highlighted_coordinate_get(Global_Data *gd,
2039 Event_Offsets *event,
2040 Evas_Object **grid,
2041 Eina_Rectangle *rect_highlight)
2042{
2043 double time_start, time_end;
2044 Time_Range interval = gd->thd->stored_data->interval;
2045 time_start = event->time_start;
2046 double interval_end = interval.start + interval.length;
2047
2048 if (event->offset_finish)
2049 time_end = (event->time_end > interval_end) ? interval_end : event->time_end;
2050 else
2051 time_end = time_start;
2052 rect_highlight->x = time_to_grid_interval_convert(time_start, interval);
2053 if (rect_highlight->x < 0) rect_highlight->x = 0;
2054 rect_highlight->w = time_to_grid_interval_convert(time_end, interval) - rect_highlight->x;
2055 rect_highlight->y = event->grid_slot;
2056 rect_highlight->h = 2;
2057
2058 if (rect_highlight->w <= 0) rect_highlight->w = 1;
2059
2060 DBG("Selected coords: \tx: %i\tw: %i\ty: %i\th:%i", rect_highlight->x, rect_highlight->w, rect_highlight->y, rect_highlight->h);
2061 switch (event->event_info->common.type)
2062 { 1967 {
2063 case THREAD_EVENT: 1968 case THREAD_EVENT:
2064 *grid = gd->ui->grids->thread_grid[event->thread_slot]->grid; 1969 task->common.grid.grid = gd->ui->grids->thread_grid[task->grid_num]->grid;
2065 break; 1970 break;
2066 case STATE_EVENT: 1971 case STATE_EVENT:
2067 *grid = gd->ui->grids->states_grid; 1972 task->common.grid.grid = gd->ui->grids->states_grid;
2068 break; 1973 break;
2069 case SINGLE_EVENT: 1974 case SINGLE_EVENT:
2070 *grid = gd->ui->grids->thread_grid[event->thread_slot]->grid; 1975 task->common.grid.grid = gd->ui->grids->thread_grid[task->grid_num]->grid;
2071 elm_grid_size_get(*grid, NULL, &rect_highlight->y); 1976 elm_grid_size_get(task->common.grid.grid, NULL, &task->common.grid.y);
2072 rect_highlight->y = rect_highlight->y - 2; 1977 task->common.grid.y -= 2;
2073 break; 1978 break;
2074 default: 1979 default:
2075 return EINA_FALSE;
2076 }
2077 return EINA_TRUE;
2078}
2079
2080
2081static Event_Offsets *
2082_found_event_process(Global_Data *gd, Event_Offsets *event)
2083{
2084 Time_Range interval = gd->thd->stored_data->interval;
2085 double time_start;
2086 double time_end;
2087 double length = gd->ui->find.stored_length;
2088 if (!length) length = interval.length;
2089
2090 time_start = event->time_start;
2091
2092 if (event->event_info->common.type != SINGLE_EVENT)
2093 time_end = event->time_end;
2094 else
2095 time_end = time_start;
2096
2097 double delta = 0.0;
2098 Eina_Bool redraw = EINA_FALSE;
2099
2100 switch (gd->ui->find.seek_mode)
2101 {
2102 case SEEK_FIND:
2103 if (gd->ui->find.seek_range == SEEK_ALL)
2104 {
2105 if (!interval_cross(time_start, time_end, interval))
2106 {
2107 redraw = EINA_TRUE;
2108 }
2109 if (gd->ui->find.stored_length)
2110 interval.length = gd->ui->find.stored_length;
2111 interval.start = (time_end + time_start) / 2.0;
2112 interval.start -= interval.length / 2.0;
2113 }
2114 else
2115 {
2116 while (!interval_cross(time_start, time_end, interval))
2117 {
2118 evas_object_smart_callback_call(gd->ui->panes, "event,find,retry", &event);
2119 if (!event)
2120 {
2121 evas_object_smart_callback_call(gd->ui->panes, "event,not,found", NULL);
2122 return NULL;
2123 }
2124 time_start = event->time_start;
2125 if (event->event_info->common.type != SINGLE_EVENT)
2126 time_end = event->time_end;
2127 else
2128 time_end = time_start;
2129 }
2130 }
2131 break;
2132 case SEEK_GO:
2133 if (event->event_info->common.type != SINGLE_EVENT)
2134 {
2135 interval.length = (time_end - time_start) * 1.03;
2136 delta = interval.length * 0.03;
2137 }
2138 else
2139 {
2140 interval.length = 0;
2141 delta = 0.000001;
2142 }
2143 interval.start = time_start - delta;
2144 interval.length += delta * 2.0;
2145
2146 if (!((interval.start == gd->thd->stored_data->interval.start) &&
2147 (interval.length == gd->thd->stored_data->interval.length)))
2148 redraw = EINA_TRUE;
2149 break; 1980 break;
2150 } 1981 }
2151
2152 if (redraw)
2153 {
2154 gd->thd->selected_start_offset = event->offset_start;
2155 event = NULL;
2156 evas_object_smart_callback_call(gd->ui->panes,
2157 "display,interval",
2158 &interval);
2159 if (gd->ui->find.seek_mode == SEEK_GO)
2160 gd->ui->find.stored_length = length;
2161
2162 }
2163 return event;
2164} 1982}
2165 1983
2166static void 1984static void
2167_event_name_find_draw(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) 1985_enterer_add_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
2168{ 1986{
2169 Global_Data *gd = data; 1987 Global_Data *gd = data;
2170 Event_Offsets *event = event_info; 1988 unsigned int mask;
2171 Eina_Rectangle rect_highlight; 1989 mask = *(unsigned int *)event_info;
2172 Evas_Object *grid = NULL; 1990 gd->mask |= mask;
2173 Task_Highlight *task = NULL; 1991 if ((gd->mask == 0x1F) && (!gd->enterer))
2174
2175 event = _found_event_process(gd, event);
2176 if (!event) return;
2177
2178 if (!_grid_highlighted_coordinate_get(gd, event, &grid,
2179 &rect_highlight))
2180 { 1992 {
2181 ERR("The coordinate of the object is not correct"); 1993 tasks_idler_exiter(gd);
2182 return; 1994 grids_clear(gd);
2183 } 1995 _timemarks_range_labels_add(gd);
2184 1996 if (gd->thd->need_to_unselect)
2185 task = task_highlight_event_add(&gd->tasks);
2186 task->common.grid.grid = grid;
2187 task->common.grid.x = rect_highlight.x;
2188 task->common.grid.y = rect_highlight.y;
2189 task->common.grid.w = rect_highlight.w;
2190 task->common.grid.h = rect_highlight.h;
2191 task->common.gd = gd;
2192 task->type = event->event_info->common.type;
2193 task->offset_start = event->offset_start;
2194 task->offset_finish = event->offset_finish;
2195 task->standalone = EINA_TRUE;
2196}
2197
2198static void
2199_event_name_array_find_draw(Global_Data *gd, Eina_Array *events)
2200{
2201 Eina_Rectangle rect_highlight;
2202 Evas_Object *grid = NULL;
2203 double time_start, time_end;
2204 Time_Range interval_current = gd->thd->stored_data->interval;
2205 Eina_Hash *grid_position_unique_highlight = eina_hash_int64_new(NULL);
2206 Task_Highlight *task = NULL;
2207
2208 unsigned int index;
2209 Event_Offsets *event;
2210 Eina_Array_Iterator it;
2211 EINA_ARRAY_ITER_NEXT(events, index, event, it)
2212 {
2213 time_start = event->time_start;
2214
2215 if (event->offset_finish)
2216 time_end = event->time_end;
2217 else
2218 time_end = time_start;
2219
2220 if (!interval_cross(time_start, time_end, interval_current))
2221 continue;
2222
2223 if (!_grid_highlighted_coordinate_get(gd,
2224 event,
2225 &grid,
2226 &rect_highlight))
2227 {
2228 WRN("The coordinate of the object is not correct");
2229 continue;
2230 }
2231
2232 if (!_hash_unique_save(grid_position_unique_highlight,
2233 (void*)grid,
2234 rect_highlight))
2235 { 1997 {
2236 INF("Duplicate of rectangle. Object is drawn"); 1998 _event_unselected_cb(gd, NULL, NULL);
2237 continue;
2238 } 1999 }
2239 task = task_highlight_event_add(&gd->tasks); 2000 gd->enterer = ecore_idle_enterer_add(tasks_idler_enterer, gd);
2240 task->common.grid.grid = grid; 2001 malloc_trim(0);
2241 task->common.grid.x = rect_highlight.x;
2242 task->common.grid.y = rect_highlight.y;
2243 task->common.grid.w = rect_highlight.w;
2244 task->common.grid.h = rect_highlight.h;
2245 task->common.gd = gd;
2246 task->type = event->event_info->common.type;
2247 task->offset_start = event->offset_start;
2248 task->offset_finish = event->offset_finish;
2249 }
2250 eina_hash_free(grid_position_unique_highlight);
2251}
2252
2253static void
2254_event_name_array_find_show_cb(void *data,
2255 Evas_Object *obj EINA_UNUSED,
2256 void *events)
2257{
2258 _event_name_array_find_draw((Global_Data *)data, (Eina_Array *)events);
2259}
2260
2261static void
2262_event_name_find_show(void *data, Find_Mode mode)
2263{
2264 char *name;
2265 Evas_Object *combobox;
2266 Global_Data *gd = data;
2267 combobox = gd->ui->find.combobox;
2268 evas_object_smart_callback_call(combobox, "changed,user", NULL);
2269 evas_object_smart_callback_call(gd->ui->panes, "unfollow", NULL);
2270
2271 name = elm_entry_markup_to_utf8(elm_object_text_get(combobox));
2272 _event_unselected_cb(gd, NULL, NULL);
2273
2274 evas_object_smart_callback_call(gd->ui->panes, "event,data,set", gd->thd);
2275
2276 if (mode == FIND_MODE_NEXT)
2277 evas_object_smart_callback_call(gd->ui->panes,
2278 "event,name,next,find",
2279 name);
2280
2281 if (mode == FIND_MODE_PREVIOUS)
2282 evas_object_smart_callback_call(gd->ui->panes,
2283 "event,name,previous,find",
2284 name);
2285
2286 free(name);
2287}
2288
2289static void
2290_event_name_array_find_show(void *data)
2291{
2292 char *name;
2293 Global_Data *gd = data;
2294 Find_UI *find = &gd->ui->find;
2295
2296 evas_object_smart_callback_call(find->combobox, "changed,user", NULL);
2297 evas_object_smart_callback_call(gd->ui->panes, "event,data,set", gd->thd);
2298 evas_object_smart_callback_call(gd->ui->panes, "unfollow", NULL);
2299
2300 _event_unselected_cb(gd, NULL, NULL);
2301 name = elm_entry_markup_to_utf8(elm_object_text_get(find->combobox));
2302 evas_object_smart_callback_call(gd->ui->panes,
2303 "event,name,array,find",
2304 name);
2305}
2306
2307static void
2308_event_name_find_all_cb(void *data,
2309 Evas_Object *obj EINA_UNUSED,
2310 void *event_info EINA_UNUSED)
2311{
2312 _event_name_array_find_show(data);
2313}
2314
2315static void
2316_event_name_find_previous_cb(void *data,
2317 Evas_Object *obj EINA_UNUSED,
2318 void *event_info EINA_UNUSED)
2319{
2320 _event_name_find_show(data, FIND_MODE_PREVIOUS);
2321}
2322
2323static void
2324_event_name_find_next_cb(void *data,
2325 Evas_Object *obj EINA_UNUSED,
2326 void *event_info EINA_UNUSED)
2327{
2328 _event_name_find_show(data, FIND_MODE_NEXT);
2329}
2330
2331static char *
2332_gl_text_get_cb(void *data,
2333 Evas_Object *obj EINA_UNUSED,
2334 const char *part EINA_UNUSED)
2335{
2336 if (!data)
2337 return NULL;
2338 return strdup(data);
2339}
2340
2341static Eina_Bool
2342_gl_filter_get_cb(void *data, Evas_Object *obj EINA_UNUSED, void *key)
2343{
2344 if (key && data && strcasestr(data, (char *)key))
2345 return EINA_TRUE;
2346 return EINA_FALSE;
2347}
2348
2349static void
2350_combobox_item_pressed_cb(void *data EINA_UNUSED, Evas_Object *obj,
2351 void *event_info)
2352{
2353 const char *txt = elm_object_item_text_get(event_info);
2354 elm_object_text_set(obj, txt);
2355 elm_combobox_hover_end(obj);
2356 elm_entry_cursor_end_set(obj);
2357}
2358
2359static void
2360_gl_filter_restart_cb(void *data EINA_UNUSED,
2361 Evas_Object *obj,
2362 void *event_info EINA_UNUSED)
2363{
2364 elm_genlist_filter_set(obj, (void *)elm_object_text_get(obj));
2365}
2366
2367static int
2368_list_str_cmp_cb(const void *d1, const void *d2)
2369{
2370 const char *txt = d1;
2371 const char *txt2 = d2;
2372
2373 if (!txt) return(1);
2374 if (!txt2) return(-1);
2375
2376 return strcmp(txt, txt2);
2377}
2378
2379static Eina_Bool
2380_name_uniq_save_cb(const Eina_Hash *hash EINA_UNUSED,
2381 const void *key,
2382 void *data EINA_UNUSED,
2383 void *fdata)
2384{
2385 Eina_List **names = fdata;
2386 if (!eina_list_search_sorted(*names, _list_str_cmp_cb, key))
2387 *names = eina_list_sorted_insert(*names ,_list_str_cmp_cb, key);
2388
2389 return EINA_TRUE;
2390}
2391
2392static void
2393_seek_current_range_mode_cb(void *data,
2394 Evas_Object *obj EINA_UNUSED,
2395 void *event_info EINA_UNUSED)
2396{
2397 Find_UI *find = (Find_UI *) data;
2398 find->seek_range = SEEK_REGION;
2399}
2400
2401static void
2402_seek_current_all_data_mode_cb(void *data,
2403 Evas_Object *obj EINA_UNUSED,
2404 void *event_info EINA_UNUSED)
2405{
2406 Find_UI *find = (Find_UI *) data;
2407 find->seek_range = SEEK_ALL;
2408}
2409
2410static void
2411_find_dialog_buttons_add(Evas_Object *layout, Global_Data *gd)
2412{
2413 Evas_Object *button = NULL;
2414
2415 button = elm_button_add(layout);
2416 elm_object_text_set(button, _("Previous"));
2417 evas_object_smart_callback_add(button, "clicked", _event_name_find_previous_cb, gd);
2418 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2419 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
2420 elm_object_part_content_set(layout, "find_prev_btn", button);
2421 evas_object_show(button);
2422
2423 button = elm_button_add(layout);
2424 elm_object_text_set(button, _("Next"));
2425 evas_object_smart_callback_add(button, "clicked", _event_name_find_next_cb, gd);
2426 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2427 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
2428 elm_object_part_content_set(layout, "find_next_btn", button);
2429 evas_object_show(button);
2430}
2431
2432static Evas_Object *
2433_go_layout_create(Find_UI *find, Global_Data *gd)
2434{
2435 Evas_Object *layout = NULL;
2436
2437 if (!find->combobox)
2438 {
2439 ERR("Failed create go layout: combobox isn't created");
2440 return NULL;
2441 }
2442
2443 layout = layout_create(find->win, "efl_profiling_viewer", "find");
2444 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2445 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
2446 evas_object_show(layout);
2447 elm_object_part_content_set(layout, "combobox", find->combobox);
2448
2449 _find_dialog_buttons_add(layout, gd);
2450 return layout;
2451}
2452
2453static void
2454_find_layout_update(Evas_Object *layout, Find_UI *find)
2455{
2456 Evas_Object *hoversel = elm_object_part_content_get(layout,
2457 "find_in_cmbbx");
2458 switch (find->seek_range)
2459 {
2460 case SEEK_REGION:
2461 {
2462 elm_object_text_set(hoversel, _("Current range"));
2463 break;
2464 }
2465 case SEEK_ALL:
2466 {
2467 elm_object_text_set(hoversel, _("Full time"));
2468 break;
2469 }
2470 }
2471}
2472
2473static Evas_Object *
2474_find_layout_create(Find_UI *find, Global_Data *gd)
2475{
2476 Evas_Object *layout = NULL;
2477 Evas_Object *hoversel = NULL;
2478
2479 if (!find->combobox)
2480 {
2481 ERR("Failed create find layout: combobox isn't created");
2482 return NULL;
2483 } 2002 }
2484
2485 layout = layout_create(find->win, "efl_profiling_viewer", "find");
2486 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2487 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
2488 evas_object_show(layout);
2489
2490 elm_object_part_content_set(layout, "combobox", find->combobox);
2491
2492 hoversel = elm_hoversel_add(layout);
2493 elm_hoversel_auto_update_set(hoversel, EINA_TRUE);
2494 evas_object_size_hint_weight_set(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2495 evas_object_size_hint_align_set(hoversel, EVAS_HINT_FILL, EVAS_HINT_FILL);
2496 elm_hoversel_item_add(hoversel, _("Current range"), NULL, ELM_ICON_NONE,
2497 _seek_current_range_mode_cb, find);
2498 elm_hoversel_item_add(hoversel, _("Full time"), NULL, ELM_ICON_NONE,
2499 _seek_current_all_data_mode_cb, find);
2500 elm_object_part_content_set(layout, "find_in_cmbbx", hoversel);
2501 evas_object_show(hoversel);
2502
2503 Evas_Object *button = elm_button_add(layout);
2504 elm_object_text_set(button, _("Highlight all"));
2505 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2506 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
2507 elm_object_part_content_set(layout, "highlight", button);
2508 evas_object_show(button);
2509 evas_object_smart_callback_add(button,
2510 "clicked",
2511 _event_name_find_all_cb,
2512 gd);
2513
2514 _find_layout_update(layout, find);
2515 _find_dialog_buttons_add(layout, gd);
2516
2517 return layout;
2518}
2519
2520static void
2521_switch_find_ui_mode(Find_UI *find)
2522{
2523 Evas_Object *active_layout = NULL;
2524 Evas_Object *inactive_layout = NULL;
2525
2526 switch (find->seek_mode)
2527 {
2528 case SEEK_FIND:
2529 {
2530 active_layout = find->find_layout;
2531 inactive_layout = find->go_layout;
2532 _find_layout_update(active_layout, find);
2533 break;
2534 }
2535 case SEEK_GO:
2536 {
2537 active_layout = find->go_layout;
2538 inactive_layout = find->find_layout;
2539 find->seek_range = SEEK_ALL;
2540 break;
2541 }
2542 }
2543
2544 elm_box_unpack(find->box, inactive_layout);
2545 evas_object_hide(inactive_layout);
2546 elm_box_pack_end(find->box, active_layout);
2547 evas_object_show(active_layout);
2548
2549 elm_object_part_content_set(active_layout, "combobox", find->combobox);
2550} 2003}
2551 2004
2552static void 2005static void
2553_find_toolbar_item_clicked_cb(void *data, 2006_find_menu_cb(void *data,
2554 Evas_Object *obj EINA_UNUSED, 2007 Evas_Object *obj EINA_UNUSED,
2555 void *event_info EINA_UNUSED) 2008 void *event_info EINA_UNUSED)
2556{
2557 Global_Data *gd = (Global_Data *) data;
2558 Find_UI *find = &gd->ui->find;
2559 find->seek_mode = SEEK_FIND;
2560 _switch_find_ui_mode(find);
2561}
2562
2563static void
2564_go_toolbar_item_clicked_cb(void *data,
2565 Evas_Object *obj EINA_UNUSED,
2566 void *event_info EINA_UNUSED)
2567{ 2009{
2568 Global_Data *gd = (Global_Data *) data; 2010 Global_Data *gd = (Global_Data *) data;
2569 Find_UI *find = &gd->ui->find; 2011 if (!gd) return;
2570 find->seek_mode = SEEK_GO; 2012 evas_object_smart_callback_call(gd->ui->panes, "find,show", NULL);
2571 _switch_find_ui_mode(find);
2572}
2573
2574static void
2575_find_combobox_update(Find_UI *find, In_Thread_Data *thd)
2576{
2577 Eina_List *names_list = NULL, *l = NULL;
2578 char *key = NULL;
2579 if (!find->combobox_itc)
2580 {
2581 find->combobox_itc = elm_genlist_item_class_new();
2582 find->combobox_itc->item_style = "default";
2583 find->combobox_itc->func.text_get = _gl_text_get_cb;
2584 find->combobox_itc->func.content_get = NULL;
2585 find->combobox_itc->func.state_get = NULL;
2586 find->combobox_itc->func.filter_get = _gl_filter_get_cb;
2587 find->combobox_itc->func.del = NULL;
2588 }
2589
2590 eina_rwlock_take_read(&thd->thread_events.lock);
2591 eina_hash_foreach(thd->thread_events.hash, _name_uniq_save_cb, &names_list);
2592 eina_rwlock_release(&thd->thread_events.lock);
2593 eina_rwlock_take_read(&thd->state_events.lock);
2594 eina_hash_foreach(thd->state_events.hash, _name_uniq_save_cb, &names_list);
2595 eina_rwlock_release(&thd->state_events.lock);
2596 eina_rwlock_take_read(&thd->single_events.lock);
2597 eina_hash_foreach(thd->single_events.hash, _name_uniq_save_cb, &names_list);
2598 eina_rwlock_release(&thd->single_events.lock);
2599 elm_combobox_hover_end(find->combobox);
2600 elm_genlist_clear(find->combobox);
2601
2602 EINA_LIST_FOREACH(names_list, l, key)
2603 {
2604 elm_genlist_item_append(find->combobox,
2605 find->combobox_itc,
2606 key,
2607 NULL,
2608 ELM_GENLIST_ITEM_NONE,
2609 NULL,
2610 key);
2611 }
2612 eina_list_free(names_list);
2613}
2614
2615static Evas_Object *
2616_find_combobox_create(Find_UI *find)
2617{
2618 Evas_Object *combobox = NULL;
2619
2620 combobox = elm_combobox_add(find->win);
2621 evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2622 evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, EVAS_HINT_FILL);
2623 elm_object_part_text_set(combobox, "guide", _("Enter event name"));
2624 evas_object_show(combobox);
2625
2626 evas_object_smart_callback_add(combobox, "changed,user", _event_name_find_reset_color_cb, NULL);
2627 evas_object_smart_callback_add(combobox, "changed", _gl_filter_restart_cb, NULL);
2628 evas_object_smart_callback_add(combobox, "item,pressed", _combobox_item_pressed_cb, NULL);
2629 return combobox;
2630}
2631
2632static void
2633_menu_find_dialog_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
2634{
2635 Global_Data *gd = data;
2636 Evas_Object *win = gd->ui->win;
2637 Evas_Object *box = NULL;
2638 Evas_Object *toolbar = NULL;
2639 Find_UI *find = &gd->ui->find;
2640
2641 if (find->win)
2642 {
2643 evas_object_show(find->win);
2644 elm_win_activate(find->win);
2645 return;
2646 }
2647
2648 find->win = elm_win_util_dialog_add(win, "find", _("Find event"));
2649 elm_win_autodel_set(find->win, EINA_FALSE);
2650 evas_object_smart_callback_add(find->win, "delete,request", _find_win_del, find);
2651 evas_object_show(find->win);
2652
2653 box = elm_box_add(find->win);
2654 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2655 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
2656 elm_box_padding_set(box, 0, 10);
2657 gd->ui->find.box = box;
2658 evas_object_show(box);
2659 elm_win_resize_object_add(find->win, box);
2660
2661 toolbar = elm_toolbar_add(find->win);
2662 elm_toolbar_homogeneous_set(toolbar, EINA_FALSE);
2663 elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_SCROLL);
2664 elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
2665 elm_toolbar_align_set(toolbar, 0.0);
2666 elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
2667 evas_object_size_hint_weight_set(toolbar, 0.0, 0.0);
2668 evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, 0.0);
2669 evas_object_show(toolbar);
2670 elm_box_pack_end(box, toolbar);
2671
2672 find->seek_range = SEEK_ALL;
2673 find->seek_mode = SEEK_FIND;
2674 find->combobox = _find_combobox_create(find);
2675 _find_combobox_update(find, gd->thd);
2676 find->find_layout = _find_layout_create(find, gd);
2677 find->go_layout = _go_layout_create(find, gd);
2678 elm_toolbar_item_append(toolbar, NULL, _("Find"), _find_toolbar_item_clicked_cb, gd);
2679 elm_toolbar_item_append(toolbar, NULL, _("Go"), _go_toolbar_item_clicked_cb, gd);
2680 _switch_find_ui_mode(find);
2681} 2013}
2682/*================Find END====================*/
2683 2014
2684Evas_Object* 2015Evas_Object*
2685ui_init(Evas_Object *parent) 2016ui_init(Evas_Object *parent)
@@ -2733,6 +2064,8 @@ ui_init(Evas_Object *parent)
2733 evas_object_smart_callback_add(panes, "task,state,register", _task_state_register_cb, gd); 2064 evas_object_smart_callback_add(panes, "task,state,register", _task_state_register_cb, gd);
2734 evas_object_smart_callback_add(panes, "task,freq,register", _task_freq_register_cb, gd); 2065 evas_object_smart_callback_add(panes, "task,freq,register", _task_freq_register_cb, gd);
2735 evas_object_smart_callback_add(panes, "task,use,register", _task_use_register_cb, gd); 2066 evas_object_smart_callback_add(panes, "task,use,register", _task_use_register_cb, gd);
2067 evas_object_smart_callback_add(panes, "task,highlight,register", _task_highlight_register_cb, gd);
2068 evas_object_smart_callback_add(panes, "task,highlight,grid,set", _task_highlight_grid_set_cb, gd);
2736 2069
2737 evas_object_smart_callback_priority_add(panes, "display,interval", 2070 evas_object_smart_callback_priority_add(panes, "display,interval",
2738 EVAS_CALLBACK_PRIORITY_BEFORE, 2071 EVAS_CALLBACK_PRIORITY_BEFORE,
@@ -2748,16 +2081,7 @@ ui_init(Evas_Object *parent)
2748 evas_object_smart_callback_add(panes, "in,thread,data,request", _get_thd, gd); 2081 evas_object_smart_callback_add(panes, "in,thread,data,request", _get_thd, gd);
2749 evas_object_smart_callback_add(panes, "current,time,range", _time_range_get_cb, gd); 2082 evas_object_smart_callback_add(panes, "current,time,range", _time_range_get_cb, gd);
2750 evas_object_smart_callback_add(panes, "enterer,add", _enterer_add_cb, gd); 2083 evas_object_smart_callback_add(panes, "enterer,add", _enterer_add_cb, gd);
2751 evas_object_smart_callback_add(panes, 2084 evas_object_smart_callback_add(panes, "event,unselect", _event_unselected_cb, gd);
2752 "find,show",
2753 _menu_find_dialog_cb, gd);
2754 evas_object_smart_callback_add(panes, "event,found,show", _event_name_find_draw, gd);
2755 evas_object_smart_callback_add(panes,
2756 "event,not,found",
2757 _event_name_not_found_cb, gd);
2758 evas_object_smart_callback_add(panes,
2759 "event,array,found,show",
2760 _event_name_array_find_show_cb, gd);
2761 2085
2762 return panes; 2086 return panes;
2763} 2087}
@@ -2782,11 +2106,6 @@ ui_shutdown(Evas_Object* content)
2782 free(gd->ui->grids->thread_grid); 2106 free(gd->ui->grids->thread_grid);
2783 } 2107 }
2784 free(gd->ui->grids); 2108 free(gd->ui->grids);
2785 if (gd->ui->find.win)
2786 {
2787 evas_object_del(gd->ui->find.win);
2788 elm_genlist_item_class_free(gd->ui->find.combobox_itc);
2789 }
2790 free(gd->ui); 2109 free(gd->ui);
2791 free(gd); 2110 free(gd);
2792 } 2111 }
@@ -2796,6 +2115,8 @@ ui_shutdown(Evas_Object* content)
2796 evas_object_smart_callback_del(content, "task,state,register", _task_state_register_cb); 2115 evas_object_smart_callback_del(content, "task,state,register", _task_state_register_cb);
2797 evas_object_smart_callback_del(content, "task,freq,register", _task_freq_register_cb); 2116 evas_object_smart_callback_del(content, "task,freq,register", _task_freq_register_cb);
2798 evas_object_smart_callback_del(content, "task,use,register", _task_use_register_cb); 2117 evas_object_smart_callback_del(content, "task,use,register", _task_use_register_cb);
2118 evas_object_smart_callback_del(content, "task,highlight,register", _task_highlight_register_cb);
2119 evas_object_smart_callback_del(content, "task,highlight,grid,set", _task_highlight_grid_set_cb);
2799 2120
2800 evas_object_smart_callback_del(content, "display,interval", _background_update_cb); 2121 evas_object_smart_callback_del(content, "display,interval", _background_update_cb);
2801 evas_object_smart_callback_del(content, "graph,draw", _navi_timemarks_update); 2122 evas_object_smart_callback_del(content, "graph,draw", _navi_timemarks_update);
@@ -2810,15 +2131,7 @@ ui_shutdown(Evas_Object* content)
2810 evas_object_smart_callback_del(content, "graph,draw", _navigation_area_graph_draw_cb); 2131 evas_object_smart_callback_del(content, "graph,draw", _navigation_area_graph_draw_cb);
2811 evas_object_smart_callback_del(content, "current,time,range", _time_range_get_cb); 2132 evas_object_smart_callback_del(content, "current,time,range", _time_range_get_cb);
2812 evas_object_smart_callback_del(content, "enterer,add", _enterer_add_cb); 2133 evas_object_smart_callback_del(content, "enterer,add", _enterer_add_cb);
2813 2134 evas_object_smart_callback_del(content, "event,unselect", _event_unselected_cb);
2814 evas_object_smart_callback_del(content, "find,show", _menu_find_dialog_cb);
2815 evas_object_smart_callback_del(content,"event,found,show",_event_name_find_draw);
2816 evas_object_smart_callback_del(content,
2817 "event,not,found",
2818 _event_name_not_found_cb);
2819 evas_object_smart_callback_del(content,
2820 "event,array,found,show",
2821 _event_name_array_find_show_cb);
2822 2135
2823 return EINA_TRUE; 2136 return EINA_TRUE;
2824} 2137}
diff --git a/src/lib/ui_private.h b/src/lib/ui_private.h
index dab586d..79d062d 100644
--- a/src/lib/ui_private.h
+++ b/src/lib/ui_private.h
@@ -26,18 +26,6 @@
26typedef struct _Global_Data Global_Data; 26typedef struct _Global_Data Global_Data;
27typedef struct _UI_Elements UI_Elements; 27typedef struct _UI_Elements UI_Elements;
28 28
29enum _Seek_Mode {
30 SEEK_FIND = 0,
31 SEEK_GO
32};
33typedef enum _Seek_Mode Seek_Mode;
34
35enum _Seek_Range {
36 SEEK_REGION = 0,
37 SEEK_ALL
38};
39typedef enum _Seek_Range Seek_Range;
40
41struct _Thread_Grid_UI 29struct _Thread_Grid_UI
42{ 30{
43 Evas_Object *grid; 31 Evas_Object *grid;
@@ -87,27 +75,6 @@ typedef struct _Selected_Event_Info
87 Evas_Object *duration_label; 75 Evas_Object *duration_label;
88} Selected_Event_Info; 76} Selected_Event_Info;
89 77
90typedef struct _Find_UI
91{
92 double stored_length;
93 double time_current;
94
95 Evas_Object *win;
96 Evas_Object *combobox;
97 Evas_Object *box;
98
99 Evas_Object *find_layout;
100 Evas_Object *go_layout;
101
102 Elm_Genlist_Item_Class *combobox_itc;
103
104 Seek_Range seek_range;
105 Seek_Mode seek_mode;
106
107 Eina_Array *highlighted_cache;
108 Eina_Array *highlighted_active_cache;
109} Find_UI;
110
111typedef struct _UI_Elements 78typedef struct _UI_Elements
112{ 79{
113 Grids *grids; 80 Grids *grids;
@@ -145,10 +112,8 @@ typedef struct _UI_Elements
145 Eina_Bool status_val; 112 Eina_Bool status_val;
146 Evas_Object *menu; 113 Evas_Object *menu;
147 } ctx_menu; 114 } ctx_menu;
148 Find_UI find;
149} UI_Elements; 115} UI_Elements;
150 116
151
152typedef struct _Global_Data 117typedef struct _Global_Data
153{ 118{
154 UI_Elements *ui; 119 UI_Elements *ui;
@@ -160,13 +125,6 @@ typedef struct _Global_Data
160 unsigned int mask; 125 unsigned int mask;
161} Global_Data; 126} Global_Data;
162 127
163/**
164 *
165 * This function convert point from time interval into point from grid interval.
166 * @return Grid interval in range 1..GRID_SCALE.
167 *
168 */
169int time_to_grid_interval_convert(double time, Time_Range interval);
170void _event_selected_cb(void *data, Evas_Object *obj, const char *emission, const char *source); 128void _event_selected_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
171 129
172#endif 130#endif