2014-02-15 15:17:40 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <libgen.h>
|
|
|
|
|
|
|
|
#include <Eina.h>
|
2014-02-15 16:29:00 -08:00
|
|
|
#include <Eio.h>
|
2016-11-06 08:24:55 -08:00
|
|
|
#include <Elementary.h>
|
2014-02-15 15:17:40 -08:00
|
|
|
|
2014-09-13 08:48:16 -07:00
|
|
|
#include "mainview/edi_mainview_item.h"
|
|
|
|
#include "mainview/edi_mainview.h"
|
2014-02-15 15:17:40 -08:00
|
|
|
|
2014-05-15 14:40:19 -07:00
|
|
|
#include "editor/edi_editor.h"
|
2014-11-28 15:34:36 -08:00
|
|
|
#include "edi_content_provider.h"
|
2017-03-30 15:03:19 -07:00
|
|
|
#include "../edi_searchpanel.h"
|
2014-05-15 14:40:19 -07:00
|
|
|
|
2014-02-15 15:17:40 -08:00
|
|
|
#include "edi_private.h"
|
2015-02-07 00:13:40 -08:00
|
|
|
#include "edi_config.h"
|
2014-02-15 15:17:40 -08:00
|
|
|
|
2017-01-31 10:32:59 -08:00
|
|
|
static Evas_Object *_content_frame, *_current_view, *tb, *_main_win, *_welcome_panel, *_tab_scroller;
|
2017-05-14 12:58:50 -07:00
|
|
|
static Evas_Object *_edi_mainview_goto_popup;
|
2017-03-30 15:03:19 -07:00
|
|
|
static Evas_Object *_edi_mainview_search_project_popup;
|
|
|
|
|
2014-03-13 11:31:24 -07:00
|
|
|
static Eina_List *_edi_mainview_items = NULL;
|
|
|
|
|
2014-02-15 16:29:00 -08:00
|
|
|
static void
|
|
|
|
dummy()
|
|
|
|
{}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
Edi_Mainview_Item *
|
2014-09-13 08:48:16 -07:00
|
|
|
edi_mainview_item_current_get()
|
|
|
|
{
|
|
|
|
Eina_List *item;
|
|
|
|
Edi_Mainview_Item *it;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(_edi_mainview_items, item, it)
|
|
|
|
{
|
2016-09-10 14:28:31 -07:00
|
|
|
if (it && it->view == _current_view)
|
2014-09-13 08:48:16 -07:00
|
|
|
{
|
|
|
|
return it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-09-10 14:28:31 -07:00
|
|
|
static void
|
|
|
|
_edi_mainview_view_show(Evas_Object *view)
|
|
|
|
{
|
|
|
|
elm_box_unpack(_content_frame, _current_view);
|
|
|
|
evas_object_hide(_current_view);
|
|
|
|
|
|
|
|
_current_view = view;
|
|
|
|
elm_box_pack_end(_content_frame, view);
|
|
|
|
evas_object_show(view);
|
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-05-15 14:40:19 -07:00
|
|
|
edi_mainview_item_prev()
|
2014-03-26 09:48:21 -07:00
|
|
|
{
|
|
|
|
Eina_List *item;
|
2015-02-08 13:38:46 -08:00
|
|
|
Edi_Mainview_Item *it, *first, *prev = NULL;
|
2014-03-26 09:48:21 -07:00
|
|
|
|
2015-02-08 13:38:46 -08:00
|
|
|
first = (Edi_Mainview_Item *)eina_list_nth(_edi_mainview_items, 0);
|
2016-09-10 14:28:31 -07:00
|
|
|
if (first->view == _current_view)
|
2016-02-15 16:16:34 -08:00
|
|
|
{
|
|
|
|
prev = eina_list_nth(_edi_mainview_items, eina_list_count(_edi_mainview_items)-1);
|
|
|
|
edi_mainview_item_select(prev);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-26 09:48:21 -07:00
|
|
|
EINA_LIST_FOREACH(_edi_mainview_items, item, it)
|
|
|
|
{
|
2016-09-10 14:28:31 -07:00
|
|
|
if (it && it->view == _current_view)
|
2014-03-26 09:48:21 -07:00
|
|
|
{
|
2014-11-29 12:00:45 -08:00
|
|
|
if (prev)
|
|
|
|
edi_mainview_item_select(prev);
|
2014-03-26 09:48:21 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
prev = it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-05-15 14:40:19 -07:00
|
|
|
edi_mainview_item_next()
|
2014-03-26 09:48:21 -07:00
|
|
|
{
|
|
|
|
Eina_List *item;
|
2015-02-08 13:38:46 -08:00
|
|
|
Edi_Mainview_Item *it, *last, *next;
|
2014-03-26 09:48:21 -07:00
|
|
|
Eina_Bool open_next = EINA_FALSE;
|
|
|
|
|
2015-02-08 13:38:46 -08:00
|
|
|
last = eina_list_nth(_edi_mainview_items, eina_list_count(_edi_mainview_items)-1);
|
2014-03-26 09:48:21 -07:00
|
|
|
|
2016-09-10 14:28:31 -07:00
|
|
|
if (last->view == _current_view)
|
2016-02-15 16:16:34 -08:00
|
|
|
{
|
|
|
|
next = eina_list_nth(_edi_mainview_items, 0);
|
|
|
|
edi_mainview_item_select(next);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-26 09:48:21 -07:00
|
|
|
EINA_LIST_FOREACH(_edi_mainview_items, item, it)
|
|
|
|
{
|
2016-02-15 16:16:34 -08:00
|
|
|
|
2014-03-26 09:48:21 -07:00
|
|
|
if (it && open_next)
|
|
|
|
{
|
|
|
|
edi_mainview_item_select(it);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-10 14:28:31 -07:00
|
|
|
if (it && it->view == _current_view)
|
2014-03-26 09:48:21 -07:00
|
|
|
open_next = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-03-26 09:48:21 -07:00
|
|
|
edi_mainview_item_select(Edi_Mainview_Item *item)
|
|
|
|
{
|
2016-11-06 08:24:55 -08:00
|
|
|
Eina_List *list;
|
|
|
|
Edi_Mainview_Item *it;
|
2017-01-31 10:32:59 -08:00
|
|
|
Evas_Coord tabw, region_x = 0, w, total_w = 0;
|
2016-11-06 08:24:55 -08:00
|
|
|
|
2014-03-26 09:48:21 -07:00
|
|
|
if (item->win)
|
|
|
|
{
|
|
|
|
elm_win_raise(item->win);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-11-06 08:24:55 -08:00
|
|
|
EINA_LIST_FOREACH(_edi_mainview_items, list, it)
|
|
|
|
{
|
|
|
|
elm_object_signal_emit(it->tab, "mouse,up,1", "base");
|
2017-01-31 10:32:59 -08:00
|
|
|
evas_object_geometry_get(it->tab, NULL, NULL, &w, NULL);
|
|
|
|
if (item == it) region_x = total_w;
|
|
|
|
total_w += w;
|
2016-11-06 08:24:55 -08:00
|
|
|
}
|
|
|
|
|
2016-09-10 14:28:31 -07:00
|
|
|
_edi_mainview_view_show(item->view);
|
2016-11-06 08:24:55 -08:00
|
|
|
elm_object_signal_emit(item->tab, "mouse,down,1", "base");
|
2017-01-31 10:32:59 -08:00
|
|
|
|
|
|
|
evas_object_geometry_get(item->tab, NULL, NULL, &tabw, NULL);
|
|
|
|
elm_scroller_region_bring_in(_tab_scroller, region_x, 0, tabw, 0);
|
2014-03-26 09:48:21 -07:00
|
|
|
}
|
2017-04-07 15:39:44 -07:00
|
|
|
|
|
|
|
ecore_event_add(EDI_EVENT_TAB_CHANGED, NULL, NULL, NULL);
|
2014-03-26 09:48:21 -07:00
|
|
|
}
|
|
|
|
|
2014-02-15 15:17:40 -08:00
|
|
|
static void
|
2016-09-11 08:50:53 -07:00
|
|
|
_edi_mainview_item_close(Edi_Mainview_Item *item)
|
|
|
|
{
|
|
|
|
if (!item)
|
|
|
|
return;
|
|
|
|
|
|
|
|
edi_mainview_item_prev();
|
|
|
|
evas_object_del(item->view);
|
|
|
|
elm_box_unpack(tb, item->tab);
|
|
|
|
evas_object_del(item->tab);
|
|
|
|
_edi_mainview_items = eina_list_remove(_edi_mainview_items, item);
|
|
|
|
|
|
|
|
_edi_project_config_tab_remove(item->path);
|
|
|
|
eina_stringshare_del(item->path);
|
|
|
|
free(item);
|
|
|
|
|
|
|
|
if (eina_list_count(_edi_mainview_items) == 0)
|
|
|
|
_edi_mainview_view_show(_welcome_panel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_promote(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
2014-02-15 15:17:40 -08:00
|
|
|
{
|
2016-11-06 08:24:55 -08:00
|
|
|
edi_mainview_item_select((Edi_Mainview_Item *)data);
|
2014-02-15 15:17:40 -08:00
|
|
|
}
|
|
|
|
|
2016-09-11 08:50:53 -07:00
|
|
|
static void
|
|
|
|
_closetab(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_edi_mainview_item_close(data);
|
|
|
|
}
|
|
|
|
|
2014-02-26 01:13:28 -08:00
|
|
|
static Edi_Mainview_Item *
|
2014-02-15 16:29:00 -08:00
|
|
|
_get_item_for_path(const char *path)
|
|
|
|
{
|
2014-03-13 11:31:24 -07:00
|
|
|
Eina_List *item;
|
|
|
|
Edi_Mainview_Item *it;
|
2014-02-15 16:31:10 -08:00
|
|
|
|
2014-03-13 11:31:24 -07:00
|
|
|
EINA_LIST_FOREACH(_edi_mainview_items, item, it)
|
2014-02-15 16:29:00 -08:00
|
|
|
{
|
2014-03-13 11:31:24 -07:00
|
|
|
if (it && !strcmp(it->path, path))
|
|
|
|
return it;
|
2014-02-15 16:29:00 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-26 01:13:28 -08:00
|
|
|
static Edi_Mainview_Item *
|
2014-09-13 08:48:16 -07:00
|
|
|
_edi_mainview_item_add(Edi_Path_Options *path, const char *mime, Elm_Object_Item *tab, Elm_Object_Item *view,
|
2014-03-13 11:31:24 -07:00
|
|
|
Evas_Object *win)
|
2014-02-26 01:13:28 -08:00
|
|
|
{
|
|
|
|
Edi_Mainview_Item *item;
|
|
|
|
|
|
|
|
item = malloc(sizeof(Edi_Mainview_Item));
|
2015-05-18 07:45:28 -07:00
|
|
|
item->path = eina_stringshare_add(path->path);
|
2014-09-13 08:48:16 -07:00
|
|
|
item->editortype = path->type;
|
|
|
|
item->mimetype = mime;
|
2014-02-26 01:13:28 -08:00
|
|
|
item->tab = tab;
|
|
|
|
item->view = view;
|
2014-03-13 11:31:24 -07:00
|
|
|
item->win = win;
|
|
|
|
|
|
|
|
_edi_mainview_items = eina_list_append(_edi_mainview_items, item);
|
2014-02-26 01:13:28 -08:00
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2014-03-13 11:31:24 -07:00
|
|
|
static Evas_Object *
|
2014-09-13 08:48:16 -07:00
|
|
|
_edi_mainview_content_create(Edi_Mainview_Item *item, Evas_Object *parent)
|
2014-03-13 11:31:24 -07:00
|
|
|
{
|
2014-11-28 15:34:36 -08:00
|
|
|
Edi_Content_Provider *provider;
|
2014-03-13 11:31:24 -07:00
|
|
|
|
2014-11-28 15:34:36 -08:00
|
|
|
provider = edi_content_provider_for_id_get(item->editortype);
|
|
|
|
if (!provider)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return provider->content_ui_add(parent, item);
|
2014-03-13 11:31:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-13 08:48:16 -07:00
|
|
|
_edi_mainview_item_tab_add(Edi_Path_Options *options, const char *mime)
|
2014-03-13 11:31:24 -07:00
|
|
|
{
|
2016-09-11 09:05:14 -07:00
|
|
|
Evas_Object *content, *tab;//, *icon;
|
2014-03-13 11:31:24 -07:00
|
|
|
Edi_Mainview_Item *item;
|
2015-01-30 07:39:54 -08:00
|
|
|
Edi_Editor *editor;
|
2016-09-11 08:50:53 -07:00
|
|
|
// Edi_Content_Provider *provider;
|
2014-03-13 11:31:24 -07:00
|
|
|
|
2014-09-13 08:48:16 -07:00
|
|
|
item = _edi_mainview_item_add(options, mime, NULL, NULL, NULL);
|
2016-09-11 09:05:14 -07:00
|
|
|
// provider = edi_content_provider_for_id_get(item->editortype);
|
2016-09-10 14:28:31 -07:00
|
|
|
content = _edi_mainview_content_create(item, _content_frame);
|
2014-03-16 09:01:35 -07:00
|
|
|
|
2016-09-10 14:28:31 -07:00
|
|
|
_edi_mainview_view_show(content);
|
|
|
|
item->view = content;
|
2015-03-23 15:36:29 -07:00
|
|
|
|
2016-09-11 06:00:31 -07:00
|
|
|
tab = elm_button_add(tb);
|
|
|
|
evas_object_size_hint_weight_set(tab, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(tab, 0.0, EVAS_HINT_FILL);
|
|
|
|
|
2016-09-11 08:50:53 -07:00
|
|
|
elm_layout_theme_set(tab, "multibuttonentry", "btn", "default");
|
|
|
|
elm_object_part_text_set(tab, "elm.btn.text", basename((char*)options->path));
|
|
|
|
/*
|
2016-09-11 06:00:31 -07:00
|
|
|
icon = elm_icon_add(tab);
|
|
|
|
elm_icon_standard_set(icon, provider->icon);
|
|
|
|
elm_object_part_content_set(tab, "icon", icon);
|
2016-09-11 08:50:53 -07:00
|
|
|
*/
|
2016-11-06 08:24:55 -08:00
|
|
|
elm_layout_signal_callback_add(tab, "mouse,clicked,1", "*", _promote, item);
|
2016-09-11 08:50:53 -07:00
|
|
|
elm_layout_signal_callback_add(tab, "elm,deleted", "elm", _closetab, item);
|
2016-09-11 06:00:31 -07:00
|
|
|
|
|
|
|
elm_box_pack_end(tb, tab);
|
|
|
|
evas_object_show(tab);
|
2017-01-31 10:32:59 -08:00
|
|
|
elm_box_recalculate(tb);
|
2014-09-13 08:48:16 -07:00
|
|
|
item->tab = tab;
|
2016-11-06 08:24:55 -08:00
|
|
|
edi_mainview_item_select(item);
|
2014-02-26 01:13:28 -08:00
|
|
|
|
2015-01-30 07:39:54 -08:00
|
|
|
// Set focus on the newly opening window so that one can just start typing
|
|
|
|
editor = (Edi_Editor *)evas_object_data_get(content, "editor");
|
|
|
|
if (editor)
|
|
|
|
elm_object_focus_set(editor->entry, EINA_TRUE);
|
|
|
|
|
2015-03-23 15:36:29 -07:00
|
|
|
if (options->line)
|
|
|
|
edi_mainview_goto(options->line);
|
2015-09-16 02:21:21 -07:00
|
|
|
|
|
|
|
_edi_project_config_tab_add(options->path, EINA_FALSE);
|
2014-02-21 16:16:56 -08:00
|
|
|
}
|
|
|
|
|
2014-03-13 11:31:24 -07:00
|
|
|
static void
|
|
|
|
_edi_mainview_win_exit(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Edi_Mainview_Item *it;
|
|
|
|
|
|
|
|
evas_object_hide(obj);
|
|
|
|
|
|
|
|
it = evas_object_data_get(obj, "edi_mainview_item");
|
|
|
|
_edi_mainview_items = eina_list_remove(_edi_mainview_items, it);
|
2015-05-18 08:32:46 -07:00
|
|
|
|
|
|
|
_edi_project_config_tab_remove(it->path);
|
2014-03-31 14:24:56 -07:00
|
|
|
eina_stringshare_del(it->path);
|
2016-07-03 13:06:22 -07:00
|
|
|
|
|
|
|
if (edi_noproject())
|
|
|
|
edi_close();
|
2014-03-13 11:31:24 -07:00
|
|
|
free(it);
|
|
|
|
}
|
|
|
|
|
2014-03-13 11:48:28 -07:00
|
|
|
static char *
|
|
|
|
_edi_mainview_win_title_get(const char *path)
|
|
|
|
{
|
|
|
|
char *winname, *filename;
|
|
|
|
|
2014-10-22 12:08:57 -07:00
|
|
|
filename = basename((char*)path);
|
2014-03-13 11:48:28 -07:00
|
|
|
winname = malloc((8 + strlen(filename)) * sizeof(char));
|
|
|
|
snprintf(winname, 8 + strlen(filename), "Edi :: %s", filename);
|
|
|
|
|
|
|
|
return winname;
|
|
|
|
}
|
|
|
|
|
2014-03-13 11:31:24 -07:00
|
|
|
static void
|
2014-09-13 08:48:16 -07:00
|
|
|
_edi_mainview_item_win_add(Edi_Path_Options *options, const char *mime)
|
2014-03-13 11:31:24 -07:00
|
|
|
{
|
|
|
|
Evas_Object *win, *content;
|
|
|
|
Edi_Mainview_Item *item;
|
2015-01-30 07:39:54 -08:00
|
|
|
Edi_Editor *editor;
|
2014-03-13 11:31:24 -07:00
|
|
|
|
2014-03-16 09:01:35 -07:00
|
|
|
win = elm_win_util_standard_add("mainview", _edi_mainview_win_title_get(options->path));
|
2014-03-13 11:31:24 -07:00
|
|
|
if (!win) return;
|
|
|
|
|
|
|
|
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
|
|
|
|
evas_object_smart_callback_add(win, "delete,request", _edi_mainview_win_exit, NULL);
|
2014-09-13 08:48:16 -07:00
|
|
|
item = _edi_mainview_item_add(options, mime, NULL, NULL, win);
|
2014-03-13 11:31:24 -07:00
|
|
|
evas_object_data_set(win, "edi_mainview_item", item);
|
|
|
|
|
2014-09-13 08:48:16 -07:00
|
|
|
content = _edi_mainview_content_create(item, win);
|
2014-03-13 11:31:24 -07:00
|
|
|
elm_win_resize_object_add(win, content);
|
|
|
|
|
2015-01-30 07:39:54 -08:00
|
|
|
// Set focus on the newly opening window so that one can just start typing
|
|
|
|
editor = (Edi_Editor *)evas_object_data_get(content, "editor");
|
|
|
|
if (editor)
|
|
|
|
elm_object_focus_set(editor->entry, EINA_TRUE);
|
|
|
|
|
2014-05-19 15:52:50 -07:00
|
|
|
evas_object_resize(win, 380 * elm_config_scale_get(), 260 * elm_config_scale_get());
|
2014-03-13 11:31:24 -07:00
|
|
|
evas_object_show(win);
|
2015-09-16 02:21:21 -07:00
|
|
|
|
|
|
|
_edi_project_config_tab_add(options->path, EINA_TRUE);
|
2014-03-13 11:31:24 -07:00
|
|
|
}
|
|
|
|
|
2014-03-14 03:30:36 -07:00
|
|
|
static void
|
2017-05-14 12:58:50 -07:00
|
|
|
_edi_popup_cancel_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2014-03-14 03:30:36 -07:00
|
|
|
{
|
2017-05-14 12:58:50 -07:00
|
|
|
evas_object_del((Evas_Object *) data);
|
2014-03-14 03:30:36 -07:00
|
|
|
}
|
|
|
|
|
2015-02-22 06:17:51 -08:00
|
|
|
static void
|
2017-05-14 12:58:50 -07:00
|
|
|
_edi_mainview_mime_content_safe_popup(void)
|
2015-02-22 06:17:51 -08:00
|
|
|
{
|
2017-05-14 12:58:50 -07:00
|
|
|
Evas_Object *popup, *button;
|
2014-03-14 03:30:36 -07:00
|
|
|
|
2014-03-14 06:44:09 -07:00
|
|
|
popup = elm_popup_add(_main_win);
|
2014-03-14 03:30:36 -07:00
|
|
|
elm_object_part_text_set(popup, "title,text",
|
2017-05-14 12:58:50 -07:00
|
|
|
"Unrecognised file type");
|
|
|
|
elm_object_text_set(popup, "To force open, select this file in the file browser, and use \"open as\" menu options.");
|
2014-03-14 03:30:36 -07:00
|
|
|
|
2017-05-14 12:58:50 -07:00
|
|
|
button = elm_button_add(popup);
|
|
|
|
elm_object_text_set(button, "OK");
|
|
|
|
elm_object_part_content_set(popup, "button1", button);
|
|
|
|
evas_object_smart_callback_add(button, "clicked", _edi_popup_cancel_cb, popup);
|
2014-03-14 03:30:36 -07:00
|
|
|
|
|
|
|
evas_object_show(popup);
|
|
|
|
}
|
|
|
|
|
2014-03-13 11:31:24 -07:00
|
|
|
static void
|
|
|
|
_edi_mainview_tab_stat_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *stat)
|
|
|
|
{
|
2014-03-16 09:01:35 -07:00
|
|
|
Edi_Path_Options *options;
|
2014-11-28 15:34:36 -08:00
|
|
|
Edi_Content_Provider *provider;
|
2014-03-16 09:01:35 -07:00
|
|
|
const char *mime;
|
2014-03-13 11:31:24 -07:00
|
|
|
|
2014-03-16 09:01:35 -07:00
|
|
|
options = data;
|
2030-07-09 16:04:01 -07:00
|
|
|
if (!S_ISREG(stat->mode))
|
|
|
|
return;
|
|
|
|
|
|
|
|
mime = efreet_mime_type_get(options->path);
|
2014-11-28 15:34:36 -08:00
|
|
|
provider = edi_content_provider_for_mime_get(mime);
|
|
|
|
if (!provider)
|
2014-03-13 11:31:24 -07:00
|
|
|
{
|
2017-05-14 12:58:50 -07:00
|
|
|
_edi_mainview_mime_content_safe_popup();
|
2030-07-09 16:04:01 -07:00
|
|
|
return;
|
2014-03-13 11:31:24 -07:00
|
|
|
}
|
|
|
|
|
2014-11-28 15:34:36 -08:00
|
|
|
options->type = provider->id;
|
2014-09-13 08:48:16 -07:00
|
|
|
_edi_mainview_item_tab_add(options, mime);
|
2014-03-13 11:31:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edi_mainview_win_stat_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *stat)
|
2014-02-15 16:29:00 -08:00
|
|
|
{
|
2014-03-16 09:01:35 -07:00
|
|
|
Edi_Path_Options *options;
|
2014-11-28 15:34:36 -08:00
|
|
|
Edi_Content_Provider *provider;
|
2014-03-16 09:01:35 -07:00
|
|
|
const char *mime;
|
2014-02-15 16:31:10 -08:00
|
|
|
|
2014-03-16 09:01:35 -07:00
|
|
|
options = data;
|
2030-07-09 16:04:01 -07:00
|
|
|
if (!S_ISREG(stat->mode))
|
|
|
|
return;
|
|
|
|
|
|
|
|
mime = efreet_mime_type_get(options->path);
|
2014-11-28 15:34:36 -08:00
|
|
|
provider = edi_content_provider_for_mime_get(mime);
|
|
|
|
if (!provider)
|
2014-02-15 16:29:00 -08:00
|
|
|
{
|
2017-05-14 12:58:50 -07:00
|
|
|
_edi_mainview_mime_content_safe_popup();
|
2030-07-09 16:04:01 -07:00
|
|
|
return;
|
2014-02-15 16:29:00 -08:00
|
|
|
}
|
2014-02-15 16:31:10 -08:00
|
|
|
|
2014-11-28 15:34:36 -08:00
|
|
|
options->type = provider->id;
|
2014-09-13 08:48:16 -07:00
|
|
|
_edi_mainview_item_win_add(options, mime);
|
2014-02-15 16:29:00 -08:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-03-16 09:01:35 -07:00
|
|
|
edi_mainview_open_path(const char *path)
|
2014-02-25 23:28:24 -08:00
|
|
|
{
|
2014-03-16 09:01:35 -07:00
|
|
|
Edi_Path_Options *options;
|
2014-02-25 23:28:24 -08:00
|
|
|
|
2014-03-16 09:01:35 -07:00
|
|
|
options = edi_path_options_create(path);
|
2015-06-09 14:31:33 -07:00
|
|
|
edi_mainview_open(options);
|
2014-03-16 09:01:35 -07:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-03-16 09:01:35 -07:00
|
|
|
edi_mainview_open(Edi_Path_Options *options)
|
|
|
|
{
|
|
|
|
Edi_Mainview_Item *it;
|
|
|
|
|
|
|
|
it = _get_item_for_path(options->path);
|
|
|
|
if (it)
|
2014-02-26 00:17:44 -08:00
|
|
|
{
|
2014-03-16 09:01:35 -07:00
|
|
|
edi_mainview_item_select(it);
|
|
|
|
if (options->line)
|
|
|
|
edi_mainview_goto(options->line);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options->type == NULL)
|
|
|
|
{
|
|
|
|
eio_file_direct_stat(options->path, _edi_mainview_tab_stat_done, dummy, options);
|
2014-02-26 00:17:44 -08:00
|
|
|
}
|
2014-03-13 11:31:24 -07:00
|
|
|
else
|
2014-02-25 23:28:24 -08:00
|
|
|
{
|
2014-09-13 08:48:16 -07:00
|
|
|
_edi_mainview_item_tab_add(options, NULL);
|
2014-02-25 23:28:24 -08:00
|
|
|
}
|
2014-03-13 11:31:24 -07:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-03-16 09:01:35 -07:00
|
|
|
edi_mainview_open_window_path(const char *path)
|
2014-03-13 11:31:24 -07:00
|
|
|
{
|
2014-03-16 09:01:35 -07:00
|
|
|
Edi_Path_Options *options;
|
2014-03-13 11:31:24 -07:00
|
|
|
|
2014-03-16 09:01:35 -07:00
|
|
|
options = edi_path_options_create(path);
|
|
|
|
|
2015-06-09 14:31:33 -07:00
|
|
|
edi_mainview_open_window(options);
|
2014-03-16 09:01:35 -07:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-03-16 09:01:35 -07:00
|
|
|
edi_mainview_open_window(Edi_Path_Options *options)
|
|
|
|
{
|
|
|
|
Edi_Mainview_Item *it;
|
|
|
|
|
|
|
|
it = _get_item_for_path(options->path);
|
|
|
|
if (it)
|
|
|
|
{
|
|
|
|
edi_mainview_item_select(it);
|
2016-09-10 14:28:31 -07:00
|
|
|
_edi_mainview_item_close(it);
|
2014-03-16 09:01:35 -07:00
|
|
|
_edi_mainview_items = eina_list_remove(_edi_mainview_items, it);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options->type == NULL)
|
2014-02-25 23:28:24 -08:00
|
|
|
{
|
2014-03-16 09:01:35 -07:00
|
|
|
eio_file_direct_stat(options->path, _edi_mainview_win_stat_done, dummy, options);
|
2014-03-13 11:31:24 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-09-13 08:48:16 -07:00
|
|
|
_edi_mainview_item_win_add(options, NULL);
|
2014-02-25 23:28:24 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-06 17:45:44 -07:00
|
|
|
void
|
|
|
|
edi_mainview_close_all(void)
|
|
|
|
{
|
|
|
|
Eina_List *item;
|
|
|
|
Edi_Mainview_Item *it;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(_edi_mainview_items, item, it)
|
|
|
|
{
|
|
|
|
if (it)
|
|
|
|
_edi_mainview_item_close(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
edi_mainview_refresh_all(void)
|
|
|
|
{
|
|
|
|
Eina_List *item;
|
|
|
|
Edi_Mainview_Item *it;
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(_edi_mainview_items, item, it)
|
|
|
|
{
|
|
|
|
if (it)
|
|
|
|
{
|
|
|
|
path = strdup(it->path);
|
|
|
|
_edi_mainview_item_close(it);
|
|
|
|
if (ecore_file_exists(path))
|
|
|
|
edi_mainview_open_path(path);
|
|
|
|
free(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-24 15:24:33 -07:00
|
|
|
void
|
|
|
|
edi_mainview_item_close_path(const char *path)
|
|
|
|
{
|
|
|
|
Eina_List *item;
|
|
|
|
Edi_Mainview_Item *it;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(_edi_mainview_items, item, it)
|
2017-06-06 17:45:44 -07:00
|
|
|
{
|
|
|
|
if (it && !strcmp(it->path, path))
|
|
|
|
{
|
2017-03-24 15:24:33 -07:00
|
|
|
_edi_mainview_item_close(it);
|
|
|
|
return;
|
2017-06-06 17:45:44 -07:00
|
|
|
}
|
|
|
|
}
|
2017-03-24 15:24:33 -07:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-02-16 09:09:55 -08:00
|
|
|
edi_mainview_save()
|
|
|
|
{
|
2014-06-07 13:50:14 -07:00
|
|
|
Edi_Editor *editor;
|
2015-03-21 12:53:21 -07:00
|
|
|
Elm_Code *code;
|
2014-02-16 09:09:55 -08:00
|
|
|
|
2016-09-10 15:41:14 -07:00
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
2014-06-07 13:50:14 -07:00
|
|
|
|
2015-03-21 12:53:21 -07:00
|
|
|
if (!editor)
|
|
|
|
return;
|
|
|
|
|
2017-04-22 14:23:32 -07:00
|
|
|
editor->modified = EINA_FALSE;
|
|
|
|
|
2015-06-02 00:22:36 -07:00
|
|
|
code = elm_code_widget_code_get(editor->entry);
|
2015-03-21 12:53:21 -07:00
|
|
|
elm_code_file_save(code->file);
|
2017-04-22 14:23:32 -07:00
|
|
|
ecore_event_add(EDI_EVENT_FILE_SAVED, NULL, NULL, NULL);
|
2014-02-16 09:09:55 -08:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-03-13 11:31:24 -07:00
|
|
|
edi_mainview_new_window()
|
|
|
|
{
|
|
|
|
Edi_Mainview_Item *item;
|
|
|
|
|
2014-09-13 08:48:16 -07:00
|
|
|
item = edi_mainview_item_current_get();
|
2014-03-13 11:31:24 -07:00
|
|
|
if (!item)
|
|
|
|
return;
|
|
|
|
|
2014-03-16 09:01:35 -07:00
|
|
|
edi_mainview_open_window_path(item->path);
|
2014-03-13 11:31:24 -07:00
|
|
|
}
|
|
|
|
|
2016-02-15 16:15:52 -08:00
|
|
|
void
|
|
|
|
edi_mainview_close()
|
|
|
|
{
|
|
|
|
Edi_Mainview_Item *item;
|
|
|
|
|
|
|
|
item = edi_mainview_item_current_get();
|
|
|
|
|
2016-09-10 14:28:31 -07:00
|
|
|
_edi_mainview_item_close(item);
|
2016-02-15 16:15:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
edi_mainview_closeall()
|
|
|
|
{
|
|
|
|
Eina_List *list, *next;
|
|
|
|
Edi_Mainview_Item *item;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH_SAFE(_edi_mainview_items, list, next, item)
|
|
|
|
{
|
2016-09-10 14:28:31 -07:00
|
|
|
_edi_mainview_item_close(item);
|
2016-02-15 16:15:52 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-21 15:46:44 -08:00
|
|
|
void
|
|
|
|
edi_mainview_undo()
|
|
|
|
{
|
|
|
|
Edi_Editor *editor;
|
|
|
|
|
2016-09-10 15:41:14 -07:00
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
2016-02-21 15:46:44 -08:00
|
|
|
|
|
|
|
if (editor)
|
|
|
|
elm_code_widget_undo(editor->entry);
|
|
|
|
}
|
|
|
|
|
2017-04-07 15:39:44 -07:00
|
|
|
Eina_Bool
|
|
|
|
edi_mainview_can_undo()
|
|
|
|
{
|
|
|
|
Edi_Editor *editor;
|
|
|
|
|
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
|
|
|
|
|
|
|
if (!editor)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
return elm_code_widget_can_undo_get(editor->entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
edi_mainview_redo()
|
|
|
|
{
|
|
|
|
Edi_Editor *editor;
|
|
|
|
|
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
|
|
|
|
|
|
|
if (editor)
|
|
|
|
elm_code_widget_redo(editor->entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
edi_mainview_can_redo()
|
|
|
|
{
|
|
|
|
Edi_Editor *editor;
|
|
|
|
|
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
|
|
|
|
|
|
|
if (!editor)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
return elm_code_widget_can_redo_get(editor->entry);
|
|
|
|
}
|
|
|
|
|
2017-04-22 14:23:32 -07:00
|
|
|
Eina_Bool
|
|
|
|
edi_mainview_modified()
|
|
|
|
{
|
|
|
|
Edi_Editor *editor;
|
|
|
|
|
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
|
|
|
if (!editor)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
return editor->modified;
|
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-02-16 09:09:55 -08:00
|
|
|
edi_mainview_cut()
|
|
|
|
{
|
2014-06-07 13:50:14 -07:00
|
|
|
Edi_Editor *editor;
|
2014-02-16 09:09:55 -08:00
|
|
|
|
2016-09-10 15:41:14 -07:00
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
2014-06-07 13:50:14 -07:00
|
|
|
|
|
|
|
if (editor)
|
2015-03-28 10:57:47 -07:00
|
|
|
elm_code_widget_selection_cut(editor->entry);
|
2014-02-16 09:09:55 -08:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-02-16 09:09:55 -08:00
|
|
|
edi_mainview_copy()
|
|
|
|
{
|
2014-06-07 13:50:14 -07:00
|
|
|
Edi_Editor *editor;
|
2014-02-16 09:09:55 -08:00
|
|
|
|
2016-09-10 15:41:14 -07:00
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
2014-06-07 13:50:14 -07:00
|
|
|
|
|
|
|
if (editor)
|
2015-03-28 10:57:47 -07:00
|
|
|
elm_code_widget_selection_copy(editor->entry);
|
2014-02-16 09:09:55 -08:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-02-16 09:09:55 -08:00
|
|
|
edi_mainview_paste()
|
|
|
|
{
|
2014-06-07 13:50:14 -07:00
|
|
|
Edi_Editor *editor;
|
2014-02-16 09:09:55 -08:00
|
|
|
|
2016-09-10 15:41:14 -07:00
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
2014-06-07 13:50:14 -07:00
|
|
|
|
|
|
|
if (editor)
|
2015-03-28 10:57:47 -07:00
|
|
|
elm_code_widget_selection_paste(editor->entry);
|
2014-02-16 09:09:55 -08:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-04-30 15:06:16 -07:00
|
|
|
edi_mainview_search()
|
|
|
|
{
|
2014-06-07 13:50:14 -07:00
|
|
|
Edi_Editor *editor;
|
2014-04-30 15:06:16 -07:00
|
|
|
|
2016-09-10 15:41:14 -07:00
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
2014-06-07 13:50:14 -07:00
|
|
|
|
|
|
|
if (editor)
|
2015-02-08 15:21:27 -08:00
|
|
|
edi_editor_search(editor);
|
2014-04-30 15:06:16 -07:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2017-03-25 15:08:55 -07:00
|
|
|
edi_mainview_goto(int number)
|
2014-03-15 06:12:34 -07:00
|
|
|
{
|
2014-06-07 13:50:14 -07:00
|
|
|
Edi_Editor *editor;
|
2017-03-25 15:08:55 -07:00
|
|
|
Elm_Code *code;
|
|
|
|
Elm_Code_Line *line;
|
2014-03-15 06:12:34 -07:00
|
|
|
|
2016-09-10 15:41:14 -07:00
|
|
|
editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor");
|
2017-03-25 15:08:55 -07:00
|
|
|
if (!editor || number <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
code = elm_code_widget_code_get(editor->entry);
|
|
|
|
|
|
|
|
line = elm_code_file_line_get(code->file, number);
|
|
|
|
if (!line)
|
2014-03-15 06:12:34 -07:00
|
|
|
return;
|
|
|
|
|
2017-03-25 15:08:55 -07:00
|
|
|
elm_code_widget_cursor_position_set(editor->entry, number, 1);
|
2014-06-07 13:50:14 -07:00
|
|
|
elm_object_focus_set(editor->entry, EINA_TRUE);
|
2014-03-15 06:12:34 -07:00
|
|
|
}
|
|
|
|
|
2015-07-16 14:36:15 -07:00
|
|
|
static void
|
|
|
|
_edi_mainview_goto_popup_go_cb(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int number;
|
|
|
|
|
|
|
|
number = atoi(elm_entry_entry_get((Evas_Object *) data));
|
|
|
|
edi_mainview_goto(number);
|
|
|
|
|
|
|
|
evas_object_del(_edi_mainview_goto_popup);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edi_mainview_goto_popup_cancel_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
evas_object_del(_edi_mainview_goto_popup);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edi_mainview_goto_popup_key_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *)event_info;
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
str = elm_object_text_get(obj);
|
|
|
|
|
|
|
|
if (strlen(str) && (!strcmp(ev->key, "KP_Enter") || !strcmp(ev->key, "Return")))
|
|
|
|
_edi_mainview_goto_popup_go_cb(obj, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
edi_mainview_goto_popup_show()
|
|
|
|
{
|
2016-01-21 12:06:49 -08:00
|
|
|
Evas_Object *popup, *box, *input, *button;
|
2015-07-16 14:36:15 -07:00
|
|
|
|
|
|
|
popup = elm_popup_add(_main_win);
|
|
|
|
_edi_mainview_goto_popup = popup;
|
|
|
|
elm_object_part_text_set(popup, "title,text",
|
|
|
|
"Enter line number");
|
|
|
|
|
2016-01-21 12:06:49 -08:00
|
|
|
box = elm_box_add(popup);
|
|
|
|
elm_box_horizontal_set(box, EINA_FALSE);
|
|
|
|
elm_object_content_set(popup, box);
|
|
|
|
|
|
|
|
input = elm_entry_add(box);
|
2015-07-16 14:36:15 -07:00
|
|
|
elm_entry_single_line_set(input, EINA_TRUE);
|
|
|
|
evas_object_event_callback_add(input, EVAS_CALLBACK_KEY_UP, _edi_mainview_goto_popup_key_up_cb, NULL);
|
2016-01-21 12:06:49 -08:00
|
|
|
evas_object_size_hint_weight_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_align_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(input);
|
|
|
|
elm_box_pack_end(box, input);
|
2015-07-16 14:36:15 -07:00
|
|
|
|
|
|
|
button = elm_button_add(popup);
|
|
|
|
elm_object_text_set(button, "cancel");
|
|
|
|
elm_object_part_content_set(popup, "button1", button);
|
|
|
|
evas_object_smart_callback_add(button, "clicked",
|
|
|
|
_edi_mainview_goto_popup_cancel_cb, NULL);
|
|
|
|
|
|
|
|
button = elm_button_add(popup);
|
|
|
|
elm_object_text_set(button, "go");
|
|
|
|
elm_object_part_content_set(popup, "button2", button);
|
|
|
|
evas_object_smart_callback_add(button, "clicked",
|
|
|
|
_edi_mainview_goto_popup_go_cb, input);
|
|
|
|
|
|
|
|
evas_object_show(popup);
|
|
|
|
elm_object_focus_set(input, EINA_TRUE);
|
2017-03-30 15:03:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edi_mainview_project_search_popup_cancel_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
evas_object_del(_edi_mainview_search_project_popup);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edi_mainview_project_search_cb(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
const char *text;
|
|
|
|
|
|
|
|
text = elm_entry_entry_get((Evas_Object *) data);
|
|
|
|
if (!text || strlen(text) == 0) return;
|
|
|
|
|
2017-04-05 11:15:47 -07:00
|
|
|
edi_searchpanel_show();
|
2017-03-30 15:03:19 -07:00
|
|
|
edi_searchpanel_find(text);
|
|
|
|
evas_object_del(_edi_mainview_search_project_popup);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
edi_mainview_project_search_popup_show(void)
|
|
|
|
{
|
|
|
|
Evas_Object *popup, *box, *input, *button;
|
|
|
|
|
|
|
|
popup = elm_popup_add(_main_win);
|
|
|
|
_edi_mainview_search_project_popup = popup;
|
|
|
|
elm_object_part_text_set(popup, "title,text",
|
|
|
|
"Search for");
|
|
|
|
|
|
|
|
box = elm_box_add(popup);
|
|
|
|
elm_box_horizontal_set(box, EINA_FALSE);
|
|
|
|
elm_object_content_set(popup, box);
|
|
|
|
|
|
|
|
input = elm_entry_add(box);
|
|
|
|
elm_entry_single_line_set(input, EINA_TRUE);
|
|
|
|
evas_object_event_callback_add(input, EVAS_CALLBACK_KEY_UP, _edi_mainview_goto_popup_key_up_cb, NULL);
|
|
|
|
evas_object_size_hint_weight_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_align_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(input);
|
|
|
|
elm_box_pack_end(box, input);
|
|
|
|
|
|
|
|
button = elm_button_add(popup);
|
|
|
|
elm_object_text_set(button, "cancel");
|
|
|
|
elm_object_part_content_set(popup, "button1", button);
|
|
|
|
evas_object_smart_callback_add(button, "clicked",
|
|
|
|
_edi_mainview_project_search_popup_cancel_cb, NULL);
|
|
|
|
|
|
|
|
button = elm_button_add(popup);
|
|
|
|
elm_object_text_set(button, "search");
|
|
|
|
elm_object_part_content_set(popup, "button2", button);
|
|
|
|
evas_object_smart_callback_add(button, "clicked",
|
|
|
|
_edi_mainview_project_search_cb, input);
|
|
|
|
|
|
|
|
evas_object_show(popup);
|
|
|
|
elm_object_focus_set(input, EINA_TRUE);
|
2015-07-16 14:36:15 -07:00
|
|
|
}
|
|
|
|
|
2017-04-05 11:04:16 -07:00
|
|
|
static void
|
|
|
|
_edi_mainview_next_clicked_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
|
|
|
Evas_Object *scroller = _tab_scroller;
|
|
|
|
|
|
|
|
elm_scroller_region_get(scroller, &x, &y, &w, &h);
|
|
|
|
x += w * 0.8;
|
|
|
|
elm_scroller_region_bring_in(scroller, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edi_mainview_prev_clicked_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
|
|
|
Evas_Object *scroller = _tab_scroller;
|
|
|
|
|
|
|
|
elm_scroller_region_get(scroller, &x, &y, &w, &h);
|
|
|
|
x -= w * 0.8;
|
|
|
|
elm_scroller_region_bring_in(scroller, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void
|
2014-03-14 06:44:09 -07:00
|
|
|
edi_mainview_add(Evas_Object *parent, Evas_Object *win)
|
2014-02-15 15:17:40 -08:00
|
|
|
{
|
2017-03-25 15:42:29 -07:00
|
|
|
Evas_Object *box, *scroll, *txt, *nf, *tabs, *tab, *bg, *pad, *scr;
|
2017-04-05 11:04:16 -07:00
|
|
|
Evas_Object *next, *prev, *ico_next, *ico_prev;
|
2014-03-14 06:44:09 -07:00
|
|
|
_main_win = win;
|
|
|
|
|
2014-02-15 15:17:40 -08:00
|
|
|
box = elm_box_add(parent);
|
|
|
|
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(box);
|
2015-09-16 02:21:21 -07:00
|
|
|
elm_box_pack_end(parent, box);
|
|
|
|
|
2016-11-06 08:24:55 -08:00
|
|
|
tabs = elm_table_add(box);
|
|
|
|
elm_box_pack_end(box, tabs);
|
|
|
|
evas_object_size_hint_weight_set(tabs, EVAS_HINT_EXPAND, 0);
|
|
|
|
evas_object_size_hint_align_set(tabs, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(tabs);
|
|
|
|
|
|
|
|
bg = elm_box_add(tabs);
|
|
|
|
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(bg, 0.0, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(bg);
|
|
|
|
elm_table_pack(tabs, bg, 0, 0, 1, 1);
|
|
|
|
|
2017-04-05 11:04:16 -07:00
|
|
|
next = elm_button_add(tabs);
|
|
|
|
evas_object_size_hint_weight_set(next, 0, 0);
|
|
|
|
evas_object_size_hint_align_set(next, 0, EVAS_HINT_FILL);
|
|
|
|
elm_table_pack(tabs, next, 2, 0, 1, 1);
|
|
|
|
evas_object_smart_callback_add(next, "clicked",
|
|
|
|
_edi_mainview_next_clicked_cb, NULL);
|
|
|
|
|
|
|
|
ico_next = elm_icon_add(next);
|
|
|
|
elm_icon_standard_set(ico_next, "go-next");
|
|
|
|
elm_object_part_content_set(next, "icon", ico_next);
|
|
|
|
evas_object_show(next);
|
|
|
|
|
|
|
|
prev = elm_button_add(tabs);
|
|
|
|
evas_object_size_hint_weight_set(prev, 0, 0);
|
|
|
|
evas_object_size_hint_align_set(prev, 0, EVAS_HINT_FILL);
|
|
|
|
elm_table_pack(tabs, prev, 1, 0, 1, 1);
|
|
|
|
evas_object_smart_callback_add(prev, "clicked",
|
|
|
|
_edi_mainview_prev_clicked_cb, NULL);
|
|
|
|
ico_prev = elm_icon_add(prev);
|
|
|
|
elm_icon_standard_set(ico_prev, "go-previous");
|
|
|
|
elm_object_part_content_set(prev, "icon", ico_prev);
|
|
|
|
evas_object_show(prev);
|
|
|
|
|
2016-11-06 08:24:55 -08:00
|
|
|
tab = elm_button_add(tabs);
|
|
|
|
evas_object_size_hint_weight_set(tab, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(tab, 0.0, EVAS_HINT_FILL);
|
|
|
|
elm_layout_theme_set(tab, "multibuttonentry", "btn", "default");
|
|
|
|
elm_object_part_text_set(tab, "elm.btn.text", "hg");
|
|
|
|
elm_box_pack_end(bg, tab);
|
|
|
|
|
|
|
|
pad = elm_box_add(tabs);
|
|
|
|
evas_object_size_hint_weight_set(pad, 0.0, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(pad, 0.0, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_min_set(pad, 0, 1.5 * elm_config_scale_get());
|
|
|
|
elm_box_pack_end(bg, pad);
|
|
|
|
|
|
|
|
scr = elm_scroller_add(parent);
|
|
|
|
evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, 0.04);
|
|
|
|
evas_object_size_hint_align_set(scr, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_size_hint_min_set(scr, 0, 100 * elm_config_scale_get());
|
|
|
|
elm_scroller_bounce_set(scr, EINA_FALSE, EINA_FALSE);
|
|
|
|
elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
|
|
|
elm_table_pack(tabs, scr, 0, 0, 1, 1);
|
|
|
|
evas_object_show(scr);
|
2017-01-31 10:32:59 -08:00
|
|
|
_tab_scroller = scr;
|
2016-11-06 08:24:55 -08:00
|
|
|
|
|
|
|
tb = elm_box_add(scr);
|
|
|
|
evas_object_size_hint_weight_set(tb, 0.0, 0.0);
|
2016-09-11 06:00:31 -07:00
|
|
|
evas_object_size_hint_align_set(tb, 0.0, EVAS_HINT_FILL);
|
|
|
|
elm_box_horizontal_set(tb, EINA_TRUE);
|
2016-11-06 08:24:55 -08:00
|
|
|
elm_object_content_set(scr, tb);
|
2014-02-15 15:17:40 -08:00
|
|
|
evas_object_show(tb);
|
|
|
|
|
2016-09-10 14:28:31 -07:00
|
|
|
nf = elm_box_add(parent);
|
2014-02-15 15:17:40 -08:00
|
|
|
evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(nf, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_box_pack_end(box, nf);
|
|
|
|
evas_object_show(nf);
|
2016-09-10 14:28:31 -07:00
|
|
|
_content_frame = nf;
|
2014-02-15 15:17:40 -08:00
|
|
|
|
2017-03-25 15:42:29 -07:00
|
|
|
scroll = elm_scroller_add(parent);
|
|
|
|
evas_object_size_hint_weight_set(scroll, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(scroll, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(scroll);
|
|
|
|
|
|
|
|
txt = elm_label_add(scroll);
|
|
|
|
elm_object_text_set(txt, "<hilight>Welcome</hilight><br><br>Click on any file to edit.");
|
2014-02-15 15:17:40 -08:00
|
|
|
evas_object_size_hint_weight_set(txt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(txt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(txt);
|
2017-03-25 15:42:29 -07:00
|
|
|
elm_object_content_set(scroll, txt);
|
2014-02-15 15:17:40 -08:00
|
|
|
|
2017-03-25 16:03:06 -07:00
|
|
|
_welcome_panel = scroll;
|
2017-03-25 15:42:29 -07:00
|
|
|
_edi_mainview_view_show(scroll);
|
2014-02-15 15:17:40 -08:00
|
|
|
}
|