forked from enlightenment/edi
EDI -> Tasks -> TODO/FIXME -> Panel (NEW FEATURE)
Summary: Initial support for tasks. Reviewers: ajwillia.ms Reviewed By: ajwillia.ms Differential Revision: https://phab.enlightenment.org/D4764
This commit is contained in:
parent
d988b4045e
commit
4e1094b5f2
|
@ -38,8 +38,8 @@ typedef struct _Edi_Panel_Slide_Effect
|
|||
#define COPYRIGHT "Copyright © 2014-2015 Andy Williams <andy@andyilliams.me> and various contributors (see AUTHORS)."
|
||||
|
||||
static Evas_Object *_edi_toolbar, *_edi_leftpanes, *_edi_bottompanes;
|
||||
static Evas_Object *_edi_logpanel, *_edi_consolepanel, *_edi_testpanel, *_edi_searchpanel;
|
||||
static Elm_Object_Item *_edi_logpanel_item, *_edi_consolepanel_item, *_edi_testpanel_item, *_edi_searchpanel_item;
|
||||
static Evas_Object *_edi_logpanel, *_edi_consolepanel, *_edi_testpanel, *_edi_searchpanel, *_edi_taskspanel;
|
||||
static Elm_Object_Item *_edi_logpanel_item, *_edi_consolepanel_item, *_edi_testpanel_item, *_edi_searchpanel_item, *_edi_taskspanel_item;
|
||||
static Elm_Object_Item *_edi_selected_bottompanel;
|
||||
static Evas_Object *_edi_filepanel, *_edi_filepanel_icon;
|
||||
|
||||
|
@ -108,6 +108,8 @@ _edi_panel_tab_for_index(int index)
|
|||
return _edi_testpanel;
|
||||
if (index == 3)
|
||||
return _edi_searchpanel;
|
||||
if (index == 4)
|
||||
return _edi_taskspanel;
|
||||
|
||||
return _edi_logpanel;
|
||||
}
|
||||
|
@ -252,7 +254,7 @@ _edi_toggle_panel(void *data, Evas_Object *obj, void *event_info)
|
|||
if (obj)
|
||||
elm_object_focus_set(obj, EINA_FALSE);
|
||||
|
||||
for (c = 0; c <= 3; c++)
|
||||
for (c = 0; c <= 4; c++)
|
||||
if (c != index)
|
||||
evas_object_hide(_edi_panel_tab_for_index(c));
|
||||
|
||||
|
@ -309,6 +311,13 @@ edi_searchpanel_show()
|
|||
elm_toolbar_item_selected_set(_edi_searchpanel_item, EINA_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
edi_taskspanel_show()
|
||||
{
|
||||
if (_edi_selected_bottompanel != _edi_taskspanel_item)
|
||||
elm_toolbar_item_selected_set(_edi_taskspanel_item, EINA_TRUE);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
edi_content_setup(Evas_Object *win, const char *path)
|
||||
{
|
||||
|
@ -328,6 +337,7 @@ edi_content_setup(Evas_Object *win, const char *path)
|
|||
_edi_consolepanel = elm_box_add(win);
|
||||
_edi_testpanel = elm_box_add(win);
|
||||
_edi_searchpanel = elm_box_add(win);
|
||||
_edi_taskspanel = elm_box_add(win);
|
||||
|
||||
// add main content
|
||||
content_out = elm_box_add(win);
|
||||
|
@ -400,6 +410,8 @@ edi_content_setup(Evas_Object *win, const char *path)
|
|||
_edi_toggle_panel, "2");
|
||||
_edi_searchpanel_item = elm_toolbar_item_append(tb, "stock_up", "Search",
|
||||
_edi_toggle_panel, "3");
|
||||
_edi_taskspanel_item = elm_toolbar_item_append(tb, "stock_up", "Tasks",
|
||||
_edi_toggle_panel, "4");
|
||||
|
||||
// add lower panel panes
|
||||
logpanels = elm_table_add(logpane);
|
||||
|
@ -427,6 +439,12 @@ edi_content_setup(Evas_Object *win, const char *path)
|
|||
edi_searchpanel_add(_edi_searchpanel);
|
||||
elm_table_pack(logpanels, _edi_searchpanel, 0, 0, 1, 1);
|
||||
|
||||
evas_object_size_hint_weight_set(_edi_taskspanel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(_edi_taskspanel, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
|
||||
edi_taskspanel_add(_edi_taskspanel);
|
||||
elm_table_pack(logpanels, _edi_taskspanel, 0, 0, 1, 1);
|
||||
|
||||
elm_object_part_content_set(logpane, "bottom", logpanels);
|
||||
|
||||
if (_edi_project_config->gui.bottomopen)
|
||||
|
@ -447,6 +465,11 @@ edi_content_setup(Evas_Object *win, const char *path)
|
|||
elm_toolbar_item_icon_set(_edi_searchpanel_item, "stock_down");
|
||||
_edi_selected_bottompanel = _edi_searchpanel_item;
|
||||
}
|
||||
else if (_edi_project_config->gui.bottomtab == 4)
|
||||
{
|
||||
elm_toolbar_item_icon_set(_edi_taskspanel_item, "stock_down");
|
||||
_edi_selected_bottompanel = _edi_taskspanel_item;
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_toolbar_item_icon_set(_edi_logpanel_item, "stock_down");
|
||||
|
@ -773,6 +796,14 @@ _edi_menu_findfile_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
edi_filepanel_search();
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_menu_tasks_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
edi_taskspanel_show();
|
||||
edi_taskspanel_find();
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_menu_goto_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
|
@ -856,6 +887,7 @@ _edi_menu_setup(Evas_Object *win)
|
|||
elm_menu_item_add(menu, menu_it, "go-jump", "Goto Line ...", _edi_menu_goto_cb, NULL);
|
||||
elm_menu_item_separator_add(menu, menu_it);
|
||||
elm_menu_item_add(menu, menu_it, "edit-find", "Find in project ...", _edi_menu_find_project_cb, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "edit-find", "Open Tasks", _edi_menu_tasks_cb, NULL);
|
||||
|
||||
menu_it = elm_menu_item_add(menu, NULL, NULL, "Build", NULL, NULL);
|
||||
elm_menu_item_add(menu, menu_it, "system-run", "Build", _edi_menu_build_cb, NULL);
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
#include "edi_private.h"
|
||||
|
||||
static Evas_Object *_info_widget;
|
||||
static Elm_Code *_elm_code;
|
||||
static Evas_Object *_info_widget, *_tasks_widget;
|
||||
static Elm_Code *_elm_code, *_tasks_code;
|
||||
|
||||
static Ecore_Thread *_search_thread = NULL;
|
||||
static Eina_Bool _searching = EINA_FALSE;
|
||||
|
@ -81,7 +81,7 @@ _edi_searchpanel_line_clicked_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
|||
free(filename);
|
||||
}
|
||||
|
||||
void _edi_searchpanel_project_search_file(const char *filename)
|
||||
void _edi_searchpanel_search_project_file(const char *filename, const char *search_term)
|
||||
{
|
||||
Elm_Code *code;
|
||||
Elm_Code_File *code_file;
|
||||
|
@ -98,7 +98,7 @@ void _edi_searchpanel_project_search_file(const char *filename)
|
|||
|
||||
EINA_LIST_FOREACH(code->file->lines, item, line)
|
||||
{
|
||||
int found = elm_code_line_text_strpos(line, _search_text, 0);
|
||||
int found = elm_code_line_text_strpos(line, search_term, 0);
|
||||
if (found != ELM_CODE_TEXT_NOT_FOUND)
|
||||
{
|
||||
text = elm_code_line_text_get(line, &len);
|
||||
|
@ -129,6 +129,7 @@ _file_ignore(const char *filename)
|
|||
eina_str_has_extension(filename, ".JPG") ||
|
||||
eina_str_has_extension(filename, ".JPEG" ) ||
|
||||
eina_str_has_extension(filename, ".bmp") ||
|
||||
eina_str_has_extension(filename, ".tgv") ||
|
||||
eina_str_has_extension(filename, ".eet") ||
|
||||
eina_str_has_extension(filename, ".edj")
|
||||
))
|
||||
|
@ -138,7 +139,7 @@ _file_ignore(const char *filename)
|
|||
}
|
||||
|
||||
void
|
||||
_edi_searchpanel_project_search(const char *directory)
|
||||
_edi_searchpanel_search_project(const char *directory, const char *search_term)
|
||||
{
|
||||
Eina_List *files, *item;
|
||||
char *file;
|
||||
|
@ -154,9 +155,9 @@ _edi_searchpanel_project_search(const char *directory)
|
|||
if (!edi_file_path_hidden(path))
|
||||
{
|
||||
if (ecore_file_is_dir(path))
|
||||
_edi_searchpanel_project_search(path);
|
||||
_edi_searchpanel_search_project(path, search_term);
|
||||
else
|
||||
_edi_searchpanel_project_search_file(path);
|
||||
_edi_searchpanel_search_project_file(path, search_term);
|
||||
}
|
||||
|
||||
free (path);
|
||||
|
@ -194,7 +195,7 @@ _search_begin_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|||
|
||||
_searching = EINA_TRUE;
|
||||
|
||||
_edi_searchpanel_project_search(path);
|
||||
_edi_searchpanel_search_project(path, _search_text);
|
||||
|
||||
if (ecore_thread_check(_search_thread)) return;
|
||||
}
|
||||
|
@ -214,8 +215,6 @@ void edi_searchpanel_find(const char *text)
|
|||
|
||||
elm_code_file_clear(_elm_code->file);
|
||||
|
||||
edi_searchpanel_show();
|
||||
|
||||
_search_thread = ecore_thread_feedback_run(_search_begin_cb, _search_feedback_cb,
|
||||
_search_end_cb, _search_cancel_cb,
|
||||
path, EINA_FALSE);
|
||||
|
@ -242,3 +241,83 @@ void edi_searchpanel_add(Evas_Object *parent)
|
|||
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_searchpanel_config_changed_cb, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_taskspanel_line_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
Elm_Code_Line *line;
|
||||
|
||||
line = (Elm_Code_Line *)event->info;
|
||||
|
||||
if (line->data)
|
||||
line->status = ELM_CODE_STATUS_TYPE_ERROR;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_edi_taskspanel_config_changed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
elm_code_widget_font_set(_tasks_widget, _edi_project_config->font.name, _edi_project_config->font.size);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
#define _edi_taskspanel_line_clicked_cb _edi_searchpanel_line_clicked_cb
|
||||
|
||||
static void
|
||||
_tasks_feedback_cb(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
|
||||
{
|
||||
char *text = msg;
|
||||
|
||||
elm_code_file_line_append(_tasks_code->file, text, strlen(text), NULL);
|
||||
free(text);
|
||||
}
|
||||
|
||||
static void
|
||||
_tasks_begin_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||
{
|
||||
const char *path = data;
|
||||
|
||||
_edi_searchpanel_search_project(path, "TODO");
|
||||
if (ecore_thread_check(_search_thread)) return;
|
||||
_edi_searchpanel_search_project(path, "FIXME");
|
||||
if (ecore_thread_check(_search_thread)) return;
|
||||
_edi_searchpanel_search_project(path, "XXX");
|
||||
if (ecore_thread_check(_search_thread)) return;
|
||||
}
|
||||
|
||||
void edi_taskspanel_find(void)
|
||||
{
|
||||
const char *path;
|
||||
if (_searching) return;
|
||||
|
||||
elm_code_file_clear(_tasks_code->file);
|
||||
|
||||
path = edi_project_get();
|
||||
|
||||
_search_thread = ecore_thread_feedback_run(_tasks_begin_cb, _tasks_feedback_cb,
|
||||
_search_end_cb, _search_cancel_cb,
|
||||
path, EINA_FALSE);
|
||||
}
|
||||
|
||||
void edi_taskspanel_add(Evas_Object *parent)
|
||||
{
|
||||
Elm_Code_Widget *widget;
|
||||
Elm_Code *code;
|
||||
code = elm_code_create();
|
||||
widget = elm_code_widget_add(parent, code);
|
||||
elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
|
||||
elm_obj_code_widget_gravity_set(widget, 0.0, 1.0);
|
||||
efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_taskspanel_line_cb, NULL);
|
||||
efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _edi_taskspanel_line_clicked_cb, NULL);
|
||||
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(widget);
|
||||
|
||||
_tasks_code = code;
|
||||
_tasks_widget = widget;
|
||||
|
||||
elm_box_pack_end(parent, widget);
|
||||
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_taskspanel_config_changed_cb, NULL);
|
||||
|
||||
edi_taskspanel_find();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,12 +22,6 @@ extern "C" {
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Show the Edi searchpanel - animating on to screen if required.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
void edi_searchpanel_show();
|
||||
|
||||
/**
|
||||
* Initialize a new Edi searchpanel and add it to the parent panel.
|
||||
|
@ -38,6 +32,13 @@ void edi_searchpanel_show();
|
|||
*/
|
||||
void edi_searchpanel_add(Evas_Object *parent);
|
||||
|
||||
/**
|
||||
* Show the Edi searchpanel - animating on to screen if required.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
void edi_searchpanel_show();
|
||||
|
||||
/**
|
||||
* Search in project for text and print results to the panel.
|
||||
*
|
||||
|
@ -47,6 +48,28 @@ void edi_searchpanel_add(Evas_Object *parent);
|
|||
*/
|
||||
void edi_searchpanel_find(const char *text);
|
||||
|
||||
/**
|
||||
* Initialise a new Edi taskspanel and add it to the parent pane.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
void edi_taskspanel_add(Evas_Object *parent);
|
||||
|
||||
/**
|
||||
* Show the Edi taskspanel - animating on to the screen if require.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
void edi_taskspanel_show();
|
||||
|
||||
/**
|
||||
* Find known labels in the text e.g. FIXME/TODO and print result to
|
||||
* the panel.
|
||||
*
|
||||
* @ingroup UI
|
||||
*/
|
||||
void edi_taskspanel_find();
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -745,6 +745,7 @@ _edi_mainview_project_search_cb(void *data,
|
|||
text = elm_entry_entry_get((Evas_Object *) data);
|
||||
if (!text || strlen(text) == 0) return;
|
||||
|
||||
edi_searchpanel_show();
|
||||
edi_searchpanel_find(text);
|
||||
evas_object_del(_edi_mainview_search_project_popup);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue