2014-09-30 07:56:16 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2013-08-26 11:29:56 -07:00
|
|
|
#include "config.h"
|
2014-09-30 07:56:16 -07:00
|
|
|
#endif
|
|
|
|
|
2015-05-12 03:51:52 -07:00
|
|
|
#include <Ecore_Getopt.h>
|
2014-09-30 07:56:16 -07:00
|
|
|
#include <Eio.h>
|
2013-07-20 01:51:56 -07:00
|
|
|
#include "common.h"
|
|
|
|
|
2014-02-04 04:48:06 -08:00
|
|
|
typedef struct app_s
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-09-30 07:56:16 -07:00
|
|
|
Evas_Object *enventor;
|
2015-06-30 09:25:04 -07:00
|
|
|
Eina_Bool on_saving : 1;
|
|
|
|
Eina_Bool lazy_save : 1;
|
2014-02-04 04:48:06 -08:00
|
|
|
} app_data;
|
2013-07-20 01:51:56 -07:00
|
|
|
|
2013-09-23 10:29:46 -07:00
|
|
|
int main(int argc, char **argv);
|
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
void
|
|
|
|
auto_comp_toggle(app_data *ad)
|
|
|
|
{
|
|
|
|
Eina_Bool toggle = !config_auto_complete_get();
|
|
|
|
enventor_object_auto_complete_set(ad->enventor, toggle);
|
|
|
|
if (toggle) stats_info_msg_update("Auto Completion Enabled.");
|
|
|
|
else stats_info_msg_update("Auto Completion Disabled.");
|
|
|
|
config_auto_complete_set(toggle);
|
|
|
|
}
|
|
|
|
|
2013-08-28 05:55:39 -07:00
|
|
|
static void
|
2014-09-30 07:56:16 -07:00
|
|
|
auto_indent_toggle(app_data *ad)
|
2013-08-28 05:55:39 -07:00
|
|
|
{
|
2014-01-29 09:45:10 -08:00
|
|
|
Eina_Bool toggle = !config_auto_indent_get();
|
2014-09-30 07:56:16 -07:00
|
|
|
enventor_object_auto_indent_set(ad->enventor, toggle);
|
2014-02-04 05:45:41 -08:00
|
|
|
if (toggle) stats_info_msg_update("Auto Indentation Enabled.");
|
|
|
|
else stats_info_msg_update("Auto Indentation Disabled.");
|
2014-01-29 09:45:10 -08:00
|
|
|
config_auto_indent_set(toggle);
|
2013-08-28 05:55:39 -07:00
|
|
|
}
|
|
|
|
|
2015-06-22 06:45:40 -07:00
|
|
|
static void
|
|
|
|
enventor_tools_update(Evas_Object *enventor)
|
|
|
|
{
|
|
|
|
tools_lines_update(enventor, EINA_FALSE);
|
|
|
|
tools_highlight_update(enventor, EINA_FALSE);
|
|
|
|
tools_swallow_update(enventor, EINA_FALSE);
|
|
|
|
tools_status_update(enventor, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2015-02-28 19:30:10 -08:00
|
|
|
static void
|
|
|
|
enventor_common_setup(Evas_Object *enventor)
|
|
|
|
{
|
2015-02-26 03:40:58 -08:00
|
|
|
const char *font_name;
|
|
|
|
const char *font_style;
|
|
|
|
config_font_get(&font_name, &font_style);
|
|
|
|
enventor_object_font_set(enventor, font_name, font_style);
|
2015-02-28 19:30:10 -08:00
|
|
|
enventor_object_font_scale_set(enventor, config_font_scale_get());
|
|
|
|
enventor_object_live_view_scale_set(enventor, config_view_scale_get());
|
|
|
|
enventor_object_auto_indent_set(enventor, config_auto_indent_get());
|
|
|
|
enventor_object_auto_complete_set(enventor, config_auto_complete_get());
|
|
|
|
|
2015-07-03 09:18:27 -07:00
|
|
|
Eina_List *list = eina_list_append(NULL, config_output_path_get());
|
2015-06-30 20:04:48 -07:00
|
|
|
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_EDJ, list);
|
2015-02-28 19:30:10 -08:00
|
|
|
eina_list_free(list);
|
|
|
|
|
2015-06-30 20:04:48 -07:00
|
|
|
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_IMAGE,
|
2015-07-03 09:18:27 -07:00
|
|
|
config_img_path_list_get());
|
2015-06-30 20:04:48 -07:00
|
|
|
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_SOUND,
|
2015-07-03 09:18:27 -07:00
|
|
|
config_snd_path_list_get());
|
2015-06-30 20:04:48 -07:00
|
|
|
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_FONT,
|
2015-07-03 09:18:27 -07:00
|
|
|
config_fnt_path_list_get());
|
2015-06-30 20:04:48 -07:00
|
|
|
enventor_object_path_set(enventor, ENVENTOR_PATH_TYPE_DATA,
|
2015-07-03 09:18:27 -07:00
|
|
|
config_dat_path_list_get());
|
2015-02-28 19:30:10 -08:00
|
|
|
}
|
|
|
|
|
2015-02-02 22:21:01 -08:00
|
|
|
static void
|
|
|
|
syntax_color_update(Evas_Object *enventor)
|
|
|
|
{
|
|
|
|
const char *config_color;
|
|
|
|
const char *enventor_color;
|
|
|
|
Eina_Bool color_changed = EINA_FALSE;
|
|
|
|
Enventor_Syntax_Color_Type color_type;
|
|
|
|
|
|
|
|
color_type = ENVENTOR_SYNTAX_COLOR_STRING;
|
|
|
|
for (; color_type < ENVENTOR_SYNTAX_COLOR_LAST; color_type++)
|
|
|
|
{
|
|
|
|
config_color = config_syntax_color_get(color_type);
|
|
|
|
if (config_color)
|
|
|
|
{
|
|
|
|
enventor_color = enventor_object_syntax_color_get(enventor,
|
|
|
|
color_type);
|
|
|
|
if (strcmp(config_color, enventor_color))
|
|
|
|
{
|
|
|
|
enventor_object_syntax_color_set(enventor, color_type,
|
|
|
|
config_color);
|
|
|
|
color_changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (color_changed)
|
|
|
|
enventor_object_syntax_color_full_apply(enventor, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
syntax_color_init(Evas_Object *enventor)
|
|
|
|
{
|
|
|
|
const char *config_color;
|
|
|
|
const char *enventor_color;
|
|
|
|
Enventor_Syntax_Color_Type color_type;
|
|
|
|
|
|
|
|
color_type = ENVENTOR_SYNTAX_COLOR_STRING;
|
|
|
|
for (; color_type < ENVENTOR_SYNTAX_COLOR_LAST; color_type++)
|
|
|
|
{
|
|
|
|
config_color = config_syntax_color_get(color_type);
|
|
|
|
if (!config_color)
|
|
|
|
{
|
|
|
|
enventor_color = enventor_object_syntax_color_get(enventor,
|
|
|
|
color_type);
|
|
|
|
config_syntax_color_set(color_type, enventor_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
static void
|
|
|
|
config_update_cb(void *data)
|
|
|
|
{
|
|
|
|
app_data *ad = data;
|
|
|
|
Evas_Object *enventor = ad->enventor;
|
|
|
|
|
2015-02-28 19:30:10 -08:00
|
|
|
enventor_common_setup(enventor);
|
2015-06-22 06:45:40 -07:00
|
|
|
enventor_tools_update(enventor);
|
2014-09-30 07:56:16 -07:00
|
|
|
|
2015-02-02 22:21:01 -08:00
|
|
|
syntax_color_update(enventor);
|
|
|
|
|
2015-02-28 19:30:10 -08:00
|
|
|
//Live View Size
|
2014-11-25 04:08:29 -08:00
|
|
|
Evas_Coord w, h;
|
|
|
|
if (config_view_size_configurable_get())
|
|
|
|
config_view_size_get(&w, &h);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
w = 0;
|
|
|
|
h = 0;
|
|
|
|
}
|
|
|
|
enventor_object_live_view_size_set(enventor, w, h);
|
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
base_tools_toggle(EINA_FALSE);
|
2015-02-14 01:36:00 -08:00
|
|
|
base_console_auto_hide();
|
2014-09-30 07:56:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
main_mouse_wheel_cb(void *data, int type EINA_UNUSED, void *ev)
|
|
|
|
{
|
|
|
|
Ecore_Event_Mouse_Wheel *event = ev;
|
|
|
|
app_data *ad = data;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
|
2015-06-25 21:49:43 -07:00
|
|
|
if (!EVENT_KEY_MODIFIER_CHECK(CTRL, event->modifiers))
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2014-09-30 07:56:16 -07:00
|
|
|
|
|
|
|
//View Scale
|
|
|
|
Evas_Object *view = enventor_object_live_view_get(ad->enventor);
|
|
|
|
evas_object_geometry_get(view, &x, &y, &w, &h);
|
|
|
|
|
|
|
|
if ((event->x >= x) && (event->x <= (x + w)) &&
|
|
|
|
(event->y >= y) && (event->y <= (y + h)))
|
|
|
|
{
|
|
|
|
double scale = config_view_scale_get();
|
|
|
|
|
|
|
|
if (event->z < 0) scale += 0.1;
|
|
|
|
else scale -= 0.1;
|
|
|
|
|
|
|
|
config_view_scale_set(scale);
|
|
|
|
scale = config_view_scale_get();
|
|
|
|
enventor_object_live_view_scale_set(ad->enventor, scale);
|
|
|
|
|
2015-06-23 05:18:25 -07:00
|
|
|
//Just in live edit mode case.
|
2015-06-22 21:14:11 -07:00
|
|
|
live_edit_update();
|
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
char buf[256];
|
2015-06-23 21:37:31 -07:00
|
|
|
snprintf(buf, sizeof(buf), "Live View Scale: %2.2fx", scale);
|
2014-09-30 07:56:16 -07:00
|
|
|
stats_info_msg_update(buf);
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Font Size
|
|
|
|
evas_object_geometry_get(ad->enventor, &x, &y, &w, &h);
|
|
|
|
|
|
|
|
if ((event->x >= x) && (event->x <= (x + w)) &&
|
|
|
|
(event->y >= y) && (event->y <= (y + h)))
|
|
|
|
{
|
|
|
|
if (event->z < 0)
|
|
|
|
{
|
|
|
|
config_font_scale_set(config_font_scale_get() + 0.1f);
|
|
|
|
enventor_object_font_scale_set(ad->enventor,
|
|
|
|
config_font_scale_get());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
config_font_scale_set(config_font_scale_get() - 0.1f);
|
|
|
|
enventor_object_font_scale_set(ad->enventor,
|
|
|
|
config_font_scale_get());
|
|
|
|
}
|
|
|
|
|
|
|
|
char buf[128];
|
|
|
|
snprintf(buf, sizeof(buf), "Font Size: %1.1fx",
|
|
|
|
config_font_scale_get());
|
|
|
|
stats_info_msg_update(buf);
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:54:25 -08:00
|
|
|
static Evas_Object *
|
2014-09-30 07:56:16 -07:00
|
|
|
tools_set(Evas_Object *enventor)
|
|
|
|
{
|
2015-06-22 06:45:40 -07:00
|
|
|
Evas_Object *tools = tools_init(base_layout_get(), enventor);
|
2014-09-30 07:56:16 -07:00
|
|
|
base_tools_set(tools);
|
2015-06-22 06:45:40 -07:00
|
|
|
enventor_tools_update(enventor);
|
|
|
|
|
2015-02-20 04:54:25 -08:00
|
|
|
return tools;
|
2014-09-30 07:56:16 -07:00
|
|
|
}
|
|
|
|
|
2015-07-03 07:01:22 -07:00
|
|
|
static void
|
2015-06-01 07:33:10 -07:00
|
|
|
args_dispatch(int argc, char **argv, char *edc_path, char *edj_path,
|
|
|
|
Eina_List **img_path, Eina_List **snd_path,
|
|
|
|
Eina_List **fnt_path, Eina_List **dat_path,
|
2015-07-03 07:01:22 -07:00
|
|
|
Eina_Bool *default_edc, Eina_Bool *template)
|
2014-09-30 07:56:16 -07:00
|
|
|
{
|
2015-05-12 03:51:52 -07:00
|
|
|
|
|
|
|
Eina_List *id = NULL;
|
|
|
|
Eina_List *fd = NULL;
|
|
|
|
Eina_List *sd = NULL;
|
|
|
|
Eina_List *dd = NULL;
|
|
|
|
|
|
|
|
Eina_Bool quit = EINA_FALSE;
|
|
|
|
Eina_Bool help = EINA_FALSE;
|
2014-09-30 07:56:16 -07:00
|
|
|
|
|
|
|
//No arguments. set defaults
|
|
|
|
if (argc == 1) goto defaults;
|
|
|
|
|
2015-05-12 03:51:52 -07:00
|
|
|
static const Ecore_Getopt optdesc = {
|
2015-05-12 04:07:35 -07:00
|
|
|
PACKAGE_NAME,
|
|
|
|
ENVENTOR_USAGE,
|
|
|
|
VERSION,
|
|
|
|
ENVENTOR_COPYRIGHT,
|
|
|
|
ENVENTOR_LICENSE,
|
|
|
|
ENVENTOR_INFO,
|
2015-05-12 03:51:52 -07:00
|
|
|
EINA_TRUE,
|
|
|
|
{
|
|
|
|
ECORE_GETOPT_STORE_TRUE('t', "to", "Open template menu"),
|
|
|
|
ECORE_GETOPT_APPEND_METAVAR('i', "id", "Images path",
|
|
|
|
"path", ECORE_GETOPT_TYPE_STR),
|
|
|
|
ECORE_GETOPT_APPEND_METAVAR('s', "sd", "Sounds path",
|
|
|
|
"path", ECORE_GETOPT_TYPE_STR),
|
|
|
|
ECORE_GETOPT_APPEND_METAVAR('f', "fd", "Fonts path",
|
|
|
|
"path", ECORE_GETOPT_TYPE_STR),
|
|
|
|
ECORE_GETOPT_APPEND_METAVAR('d', "dd", "Data path",
|
|
|
|
"path", ECORE_GETOPT_TYPE_STR),
|
|
|
|
ECORE_GETOPT_VERSION('v', "version"),
|
|
|
|
ECORE_GETOPT_COPYRIGHT('c', "copyright"),
|
|
|
|
ECORE_GETOPT_LICENSE('l', "license"),
|
|
|
|
ECORE_GETOPT_HELP('h', "help"),
|
|
|
|
ECORE_GETOPT_SENTINEL
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Ecore_Getopt_Value values[] = {
|
2015-07-03 07:01:22 -07:00
|
|
|
ECORE_GETOPT_VALUE_BOOL(*template),
|
2015-05-12 03:51:52 -07:00
|
|
|
ECORE_GETOPT_VALUE_LIST(id),
|
|
|
|
ECORE_GETOPT_VALUE_LIST(sd),
|
|
|
|
ECORE_GETOPT_VALUE_LIST(fd),
|
|
|
|
ECORE_GETOPT_VALUE_LIST(dd),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(quit),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(quit),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(quit),
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(help),
|
|
|
|
ECORE_GETOPT_VALUE_NONE
|
|
|
|
};
|
2014-09-30 07:56:16 -07:00
|
|
|
|
|
|
|
//edc path
|
2015-06-01 07:33:10 -07:00
|
|
|
int i = 0;
|
|
|
|
for (; i < argc; i++)
|
2014-09-30 07:56:16 -07:00
|
|
|
{
|
2015-06-01 07:33:10 -07:00
|
|
|
if (strstr(argv[i], ".edc"))
|
|
|
|
{
|
|
|
|
sprintf(edc_path, "%s", argv[i]);
|
2015-07-03 07:01:22 -07:00
|
|
|
*default_edc = EINA_FALSE;
|
2015-06-01 07:33:10 -07:00
|
|
|
}
|
|
|
|
else if (strstr(argv[i], ".edj"))
|
|
|
|
{
|
|
|
|
sprintf(edj_path, "%s", argv[i]);
|
|
|
|
}
|
2014-09-30 07:56:16 -07:00
|
|
|
}
|
2015-05-12 03:51:52 -07:00
|
|
|
|
|
|
|
if ((ecore_getopt_parse(&optdesc, values, argc, argv) < 0) || quit)
|
|
|
|
exit(0);
|
|
|
|
if (help)
|
2014-10-13 23:26:42 -07:00
|
|
|
{
|
2015-05-12 04:07:35 -07:00
|
|
|
fprintf(stderr, ENVENTOR_HELP_EXAMPLES);
|
2015-05-12 03:51:52 -07:00
|
|
|
exit(0);
|
2014-10-13 23:26:42 -07:00
|
|
|
}
|
2014-09-30 07:56:16 -07:00
|
|
|
|
2015-05-12 03:51:52 -07:00
|
|
|
defaults:
|
2015-07-03 07:01:22 -07:00
|
|
|
if (*default_edc)
|
2014-09-30 07:56:16 -07:00
|
|
|
{
|
2015-05-12 03:51:52 -07:00
|
|
|
Eina_Tmpstr *tmp_path;
|
|
|
|
eina_file_mkstemp(DEFAULT_EDC_FORMAT, &tmp_path);
|
|
|
|
sprintf(edc_path, "%s", (const char *)tmp_path);
|
|
|
|
eina_tmpstr_del(tmp_path);
|
|
|
|
}
|
2015-06-01 06:24:21 -07:00
|
|
|
|
|
|
|
char *s = NULL;
|
|
|
|
EINA_LIST_FREE(id, s)
|
|
|
|
{
|
|
|
|
*img_path = eina_list_append(*img_path, eina_stringshare_add(s));
|
|
|
|
free(s);
|
|
|
|
}
|
|
|
|
id = NULL;
|
|
|
|
EINA_LIST_FREE(sd, s)
|
|
|
|
{
|
|
|
|
*snd_path = eina_list_append(*snd_path, eina_stringshare_add(s));
|
|
|
|
free(s);
|
|
|
|
}
|
|
|
|
sd = NULL;
|
|
|
|
EINA_LIST_FREE(fd, s)
|
|
|
|
{
|
|
|
|
*fnt_path = eina_list_append(*fnt_path, eina_stringshare_add(s));
|
|
|
|
free(s);
|
|
|
|
}
|
|
|
|
fd = NULL;
|
|
|
|
EINA_LIST_FREE(dd, s)
|
|
|
|
{
|
|
|
|
*dat_path = eina_list_append(*dat_path, eina_stringshare_add(s));
|
|
|
|
free(s);
|
|
|
|
}
|
2014-09-30 07:56:16 -07:00
|
|
|
|
2015-05-12 03:51:52 -07:00
|
|
|
ecore_getopt_list_free(id);
|
|
|
|
ecore_getopt_list_free(fd);
|
|
|
|
ecore_getopt_list_free(sd);
|
|
|
|
ecore_getopt_list_free(dd);
|
2014-09-30 07:56:16 -07:00
|
|
|
}
|
|
|
|
|
2015-07-03 07:01:22 -07:00
|
|
|
static void
|
|
|
|
config_data_set(app_data *ad, int argc, char **argv, Eina_Bool *default_edc,
|
|
|
|
Eina_Bool *template)
|
2014-09-30 07:56:16 -07:00
|
|
|
{
|
|
|
|
char edc_path[PATH_MAX] = { 0, };
|
2015-06-01 07:33:10 -07:00
|
|
|
char edj_path[PATH_MAX] = { 0, };
|
2015-05-12 03:51:52 -07:00
|
|
|
Eina_List *img_path = NULL;
|
|
|
|
Eina_List *snd_path = NULL;
|
|
|
|
Eina_List *fnt_path = NULL;
|
|
|
|
Eina_List *dat_path = NULL;
|
2014-09-30 07:56:16 -07:00
|
|
|
|
2015-07-03 07:01:22 -07:00
|
|
|
args_dispatch(argc, argv, edc_path, edj_path, &img_path, &snd_path,
|
|
|
|
&fnt_path, &dat_path, default_edc, template);
|
2015-06-01 07:33:10 -07:00
|
|
|
config_init(edc_path, edj_path, img_path, snd_path, fnt_path, dat_path);
|
2014-09-30 07:56:16 -07:00
|
|
|
config_update_cb_set(config_update_cb, ad);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
elm_setup()
|
|
|
|
{
|
|
|
|
elm_need_efreet();
|
|
|
|
elm_config_profile_set("standard");
|
|
|
|
|
|
|
|
/* Recover the scale since it will be reset by
|
|
|
|
elm_config_profile_set() */
|
|
|
|
char *scale = getenv("ELM_SCALE");
|
|
|
|
if (scale) elm_config_scale_set(atof(scale));
|
|
|
|
|
|
|
|
/* Recover the current engine since it will be reset by
|
|
|
|
elm_config_profiel_set() */
|
|
|
|
char *engine = getenv("ELM_ENGINE");
|
|
|
|
if (engine && !strncmp(engine, "gl", strlen("gl")))
|
2015-02-12 21:50:46 -08:00
|
|
|
elm_config_accel_preference_set("3d");
|
2014-09-30 07:56:16 -07:00
|
|
|
|
|
|
|
elm_config_focus_highlight_clip_disabled_set(EINA_FALSE);
|
|
|
|
elm_config_scroll_bounce_enabled_set(EINA_FALSE);
|
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
|
|
|
elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
|
|
|
|
elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
|
|
|
|
elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR);
|
|
|
|
elm_app_info_set(main, "enventor", "images/logo.png");
|
|
|
|
|
|
|
|
snprintf(EDJE_PATH, sizeof(EDJE_PATH), "%s/themes/enventor.edj",
|
|
|
|
elm_app_data_dir_get());
|
|
|
|
elm_theme_extension_add(NULL, EDJE_PATH);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
enventor_cursor_line_changed_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
|
|
|
void *event_info)
|
|
|
|
{
|
2014-11-14 00:31:18 -08:00
|
|
|
Enventor_Cursor_Line *cur_line = (Enventor_Cursor_Line *)event_info;
|
|
|
|
stats_line_num_update(cur_line->line, enventor_object_max_line_get(obj));
|
2014-09-30 07:56:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
enventor_cursor_group_changed_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
const char *group_name = event_info;
|
|
|
|
stats_edc_group_update(group_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
enventor_compile_error_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
const char *msg = event_info;
|
|
|
|
base_error_msg_set(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
enventor_live_view_resized_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
if (!config_stats_bar_get()) return;
|
|
|
|
Enventor_Live_View_Size *size = event_info;
|
|
|
|
stats_view_size_update(size->w, size->h);
|
2014-12-12 02:49:50 -08:00
|
|
|
|
|
|
|
if (!config_view_size_configurable_get())
|
|
|
|
config_view_size_set(size->w, size->h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
enventor_live_view_loaded_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
2015-02-27 00:25:45 -08:00
|
|
|
void *event_info EINA_UNUSED)
|
2014-12-12 02:49:50 -08:00
|
|
|
{
|
|
|
|
if (!config_view_size_configurable_get()) return;
|
|
|
|
|
|
|
|
Evas_Coord w, h;
|
|
|
|
config_view_size_get(&w, &h);
|
|
|
|
enventor_object_live_view_size_set(obj, w, h);
|
2014-09-30 07:56:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
enventor_live_view_cursor_moved_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
if (!config_stats_bar_get()) return;
|
|
|
|
Enventor_Live_View_Cursor *cursor = event_info;
|
|
|
|
stats_cursor_pos_update(cursor->x, cursor->y, cursor->relx, cursor->rely);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
enventor_program_run_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
if (!config_stats_bar_get()) return;
|
|
|
|
const char *program = event_info;
|
|
|
|
char buf[256];
|
|
|
|
snprintf(buf, sizeof(buf), "Program Run: \"%s\"", program);
|
|
|
|
stats_info_msg_update(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-06-30 09:25:04 -07:00
|
|
|
enventor_ctxpopup_changed_cb(void *data, Evas_Object *obj,
|
|
|
|
void *event_info EINA_UNUSED)
|
2014-09-30 07:56:16 -07:00
|
|
|
{
|
2015-06-30 09:25:04 -07:00
|
|
|
app_data *ad = data;
|
|
|
|
if (!enventor_object_modified_get(obj)) return;
|
|
|
|
if (ad->on_saving)
|
|
|
|
{
|
|
|
|
ad->lazy_save = EINA_TRUE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ad->on_saving = EINA_TRUE;
|
2015-07-03 09:18:27 -07:00
|
|
|
enventor_object_save(obj, config_input_path_get());
|
2014-09-30 07:56:16 -07:00
|
|
|
}
|
|
|
|
|
2015-06-30 09:25:04 -07:00
|
|
|
static void
|
|
|
|
enventor_live_view_updated_cb(void *data, Evas_Object *obj,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
app_data *ad = data;
|
|
|
|
|
|
|
|
if (ad->lazy_save && enventor_object_modified_get(obj))
|
|
|
|
{
|
2015-07-03 09:18:27 -07:00
|
|
|
enventor_object_save(obj, config_input_path_get());
|
2015-06-30 09:25:04 -07:00
|
|
|
ad->lazy_save = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ad->lazy_save = EINA_FALSE;
|
|
|
|
ad->on_saving = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-02 19:19:33 -08:00
|
|
|
static void
|
|
|
|
enventor_ctxpopup_dismissed_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
2014-11-02 20:43:13 -08:00
|
|
|
if (menu_activated_get() > 0)
|
2014-11-02 19:19:33 -08:00
|
|
|
enventor_object_focus_set(obj, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2014-11-01 02:21:13 -07:00
|
|
|
static void
|
|
|
|
enventor_focused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
if (file_mgr_edc_modified_get()) file_mgr_warning_open();
|
|
|
|
}
|
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
static void
|
|
|
|
enventor_setup(app_data *ad)
|
|
|
|
{
|
|
|
|
Evas_Object *enventor = enventor_object_add(base_layout_get());
|
|
|
|
evas_object_smart_callback_add(enventor, "cursor,line,changed",
|
|
|
|
enventor_cursor_line_changed_cb, ad);
|
|
|
|
evas_object_smart_callback_add(enventor, "cursor,group,changed",
|
|
|
|
enventor_cursor_group_changed_cb, ad);
|
|
|
|
evas_object_smart_callback_add(enventor, "compile,error",
|
|
|
|
enventor_compile_error_cb, ad);
|
2014-12-12 02:49:50 -08:00
|
|
|
evas_object_smart_callback_add(enventor, "live_view,loaded",
|
|
|
|
enventor_live_view_loaded_cb, ad);
|
2014-09-30 07:56:16 -07:00
|
|
|
evas_object_smart_callback_add(enventor, "live_view,cursor,moved",
|
|
|
|
enventor_live_view_cursor_moved_cb, ad);
|
|
|
|
evas_object_smart_callback_add(enventor, "live_view,resized",
|
|
|
|
enventor_live_view_resized_cb, ad);
|
2015-06-30 09:25:04 -07:00
|
|
|
evas_object_smart_callback_add(enventor, "live_view,updated",
|
|
|
|
enventor_live_view_updated_cb, ad);
|
2014-09-30 07:56:16 -07:00
|
|
|
evas_object_smart_callback_add(enventor, "program,run",
|
|
|
|
enventor_program_run_cb, ad);
|
2015-06-30 09:25:04 -07:00
|
|
|
evas_object_smart_callback_add(enventor, "ctxpopup,changed",
|
|
|
|
enventor_ctxpopup_changed_cb, ad);
|
2014-11-02 19:19:33 -08:00
|
|
|
evas_object_smart_callback_add(enventor, "ctxpopup,dismissed",
|
|
|
|
enventor_ctxpopup_dismissed_cb, ad);
|
2014-11-01 02:21:13 -07:00
|
|
|
evas_object_smart_callback_add(enventor, "focused",
|
|
|
|
enventor_focused_cb, ad);
|
2015-02-26 03:40:58 -08:00
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
evas_object_size_hint_expand_set(enventor, EVAS_HINT_EXPAND,
|
|
|
|
EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_fill_set(enventor, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
|
2015-02-28 19:30:10 -08:00
|
|
|
enventor_common_setup(enventor);
|
|
|
|
|
2015-07-03 09:18:27 -07:00
|
|
|
enventor_object_file_set(enventor, config_input_path_get());
|
2015-02-28 19:34:15 -08:00
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
base_enventor_set(enventor);
|
2015-07-03 09:18:27 -07:00
|
|
|
base_title_set(config_input_path_get());
|
2014-09-30 07:56:16 -07:00
|
|
|
base_live_view_set(enventor_object_live_view_get(enventor));
|
|
|
|
|
|
|
|
ad->enventor = enventor;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
default_template_insert(app_data *ad)
|
|
|
|
{
|
2015-02-15 23:27:42 -08:00
|
|
|
if (live_edit_get())
|
2014-09-30 07:56:16 -07:00
|
|
|
{
|
|
|
|
stats_info_msg_update("Insertion of template code is disabled "
|
|
|
|
"while in Live Edit mode");
|
|
|
|
return;
|
|
|
|
}
|
2014-11-11 23:44:19 -08:00
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
char syntax[12];
|
2014-11-11 23:44:19 -08:00
|
|
|
if (enventor_object_template_insert(ad->enventor, ENVENTOR_TEMPLATE_INSERT_DEFAULT, syntax, sizeof(syntax)))
|
2014-09-30 07:56:16 -07:00
|
|
|
{
|
|
|
|
char msg[64];
|
|
|
|
snprintf(msg, sizeof(msg), "Template code inserted, (%s)", syntax);
|
|
|
|
stats_info_msg_update(msg);
|
2015-07-03 09:18:27 -07:00
|
|
|
enventor_object_save(ad->enventor, config_input_path_get());
|
2014-09-30 07:56:16 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stats_info_msg_update("Can't insert template code here. Move the "
|
|
|
|
"cursor inside the \"Collections,Images,Parts,"
|
|
|
|
"Part,Programs\" scope.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-11 01:19:52 -07:00
|
|
|
static Eina_Bool
|
2015-06-21 23:44:22 -07:00
|
|
|
alt_func(Ecore_Event_Key *event)
|
2015-06-11 01:19:52 -07:00
|
|
|
{
|
2015-06-25 21:49:43 -07:00
|
|
|
if (!EVENT_KEY_MODIFIER_CHECK(ALT, event->modifiers))
|
|
|
|
return EINA_FALSE;
|
2015-06-12 01:03:45 -07:00
|
|
|
|
2015-06-11 01:19:52 -07:00
|
|
|
//Full Edit View
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "Left"))
|
2015-06-11 01:19:52 -07:00
|
|
|
{
|
|
|
|
base_live_view_full_view();
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2015-06-11 01:19:52 -07:00
|
|
|
}
|
|
|
|
//Full Live View
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "Right"))
|
2015-06-11 01:19:52 -07:00
|
|
|
{
|
|
|
|
base_enventor_full_view();
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2015-06-11 01:19:52 -07:00
|
|
|
}
|
|
|
|
//Full Console View
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "Up"))
|
2015-06-11 01:19:52 -07:00
|
|
|
{
|
|
|
|
base_console_full_view();
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2015-06-11 01:19:52 -07:00
|
|
|
}
|
|
|
|
//Full Editors View
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "Down"))
|
2015-06-11 01:19:52 -07:00
|
|
|
{
|
|
|
|
base_editors_full_view();
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2015-06-11 01:19:52 -07:00
|
|
|
}
|
2015-06-12 01:03:45 -07:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
2015-06-11 01:19:52 -07:00
|
|
|
}
|
|
|
|
|
2013-08-25 09:53:19 -07:00
|
|
|
static Eina_Bool
|
2015-06-12 01:03:45 -07:00
|
|
|
ctrl_func(app_data *ad, Ecore_Event_Key *event)
|
2013-08-25 09:53:19 -07:00
|
|
|
{
|
2015-06-25 21:49:43 -07:00
|
|
|
if (!EVENT_KEY_MODIFIER_CHECK(CTRL, event->modifiers))
|
|
|
|
return EINA_FALSE;
|
2013-08-25 09:53:19 -07:00
|
|
|
//Save
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "s") || !strcmp(event->key, "S"))
|
2013-08-25 09:53:19 -07:00
|
|
|
{
|
2015-02-25 21:22:30 -08:00
|
|
|
file_mgr_edc_save();
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2013-08-25 09:53:19 -07:00
|
|
|
}
|
2014-05-12 08:08:54 -07:00
|
|
|
//Delete Line
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "d") || !strcmp(event->key, "D"))
|
2014-03-09 10:15:31 -07:00
|
|
|
{
|
2014-09-30 07:56:16 -07:00
|
|
|
enventor_object_line_delete(ad->enventor);
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2014-03-09 10:15:31 -07:00
|
|
|
}
|
2014-02-21 22:24:53 -08:00
|
|
|
//Find/Replace
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "f") || !strcmp(event->key, "F"))
|
2014-02-21 22:24:53 -08:00
|
|
|
{
|
2015-02-18 20:01:47 -08:00
|
|
|
live_edit_cancel();
|
2014-09-30 07:56:16 -07:00
|
|
|
search_open(ad->enventor);
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2014-02-21 22:24:53 -08:00
|
|
|
}
|
2014-05-31 23:35:54 -07:00
|
|
|
//Goto Line
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "l") || !strcmp(event->key, "L"))
|
2014-05-31 23:35:54 -07:00
|
|
|
{
|
2015-02-18 20:01:47 -08:00
|
|
|
live_edit_cancel();
|
2014-09-30 07:56:16 -07:00
|
|
|
goto_open(ad->enventor);
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2014-05-31 23:35:54 -07:00
|
|
|
}
|
2013-08-25 09:53:19 -07:00
|
|
|
//Part Highlight
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "h") || !strcmp(event->key, "H"))
|
2013-08-25 09:53:19 -07:00
|
|
|
{
|
2015-06-22 02:25:48 -07:00
|
|
|
tools_highlight_update(ad->enventor, EINA_TRUE);
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2013-08-25 09:53:19 -07:00
|
|
|
}
|
2013-08-28 05:55:39 -07:00
|
|
|
//Swallow Dummy Object
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "w") || !strcmp(event->key, "W"))
|
2013-08-25 09:53:19 -07:00
|
|
|
{
|
2015-06-22 02:25:48 -07:00
|
|
|
tools_swallow_update(ad->enventor, EINA_TRUE);
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2013-08-25 09:53:19 -07:00
|
|
|
}
|
2014-03-08 05:55:48 -08:00
|
|
|
//Template Code
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "t") || !strcmp(event->key, "T"))
|
2014-03-08 05:55:48 -08:00
|
|
|
{
|
2014-09-30 07:56:16 -07:00
|
|
|
default_template_insert(ad);
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2014-03-08 05:55:48 -08:00
|
|
|
}
|
2013-08-28 05:55:39 -07:00
|
|
|
//Auto Indentation
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "i") || !strcmp(event->key, "I"))
|
2013-08-28 05:55:39 -07:00
|
|
|
{
|
2014-09-30 07:56:16 -07:00
|
|
|
auto_indent_toggle(ad);
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2013-08-28 05:55:39 -07:00
|
|
|
}
|
2014-07-18 21:31:08 -07:00
|
|
|
//Auto Completion
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "o") || !strcmp(event->key, "O"))
|
2014-07-18 21:31:08 -07:00
|
|
|
{
|
2014-09-30 07:56:16 -07:00
|
|
|
auto_comp_toggle(ad);
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2014-07-18 21:31:08 -07:00
|
|
|
}
|
2015-06-21 22:34:52 -07:00
|
|
|
|
|
|
|
if (!strcmp(event->key, "space"))
|
|
|
|
{
|
|
|
|
enventor_object_auto_complete_list_show(ad->enventor);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2014-08-10 21:48:01 -07:00
|
|
|
//Live Edit
|
2015-06-12 01:03:45 -07:00
|
|
|
if (!strcmp(event->key, "e") || !strcmp(event->key, "E"))
|
2014-08-10 21:48:01 -07:00
|
|
|
{
|
2014-08-11 00:32:35 -07:00
|
|
|
live_edit_toggle();
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_TRUE;
|
2014-08-10 21:48:01 -07:00
|
|
|
}
|
2014-08-01 21:45:47 -07:00
|
|
|
|
2015-06-12 01:03:45 -07:00
|
|
|
return EINA_FALSE;
|
2013-08-25 09:53:19 -07:00
|
|
|
}
|
|
|
|
|
2013-07-20 01:51:56 -07:00
|
|
|
static Eina_Bool
|
|
|
|
main_key_down_cb(void *data, int type EINA_UNUSED, void *ev)
|
|
|
|
{
|
|
|
|
Ecore_Event_Key *event = ev;
|
|
|
|
app_data *ad = data;
|
|
|
|
|
|
|
|
//Main Menu
|
2014-01-31 23:22:00 -08:00
|
|
|
if (!strcmp(event->key, "Escape"))
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2015-02-18 19:29:33 -08:00
|
|
|
if (goto_is_opened())
|
2014-03-01 20:34:22 -08:00
|
|
|
{
|
2014-05-31 23:35:54 -07:00
|
|
|
goto_close();
|
2015-02-18 19:29:33 -08:00
|
|
|
enventor_object_focus_set(ad->enventor, EINA_TRUE);
|
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
|
|
|
if (search_is_opened())
|
|
|
|
{
|
2014-03-01 20:34:22 -08:00
|
|
|
search_close();
|
2014-09-30 07:56:16 -07:00
|
|
|
enventor_object_focus_set(ad->enventor, EINA_TRUE);
|
2014-03-01 20:34:22 -08:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2015-02-18 19:34:03 -08:00
|
|
|
if (live_edit_get())
|
|
|
|
{
|
|
|
|
live_edit_cancel();
|
|
|
|
enventor_object_focus_set(ad->enventor, EINA_TRUE);
|
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2014-10-31 08:56:56 -07:00
|
|
|
if (file_mgr_warning_is_opened())
|
|
|
|
{
|
|
|
|
file_mgr_warning_close();
|
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2014-11-02 19:19:33 -08:00
|
|
|
if (enventor_object_ctxpopup_visible_get(ad->enventor))
|
|
|
|
{
|
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2014-10-31 08:56:56 -07:00
|
|
|
|
2014-01-29 04:56:29 -08:00
|
|
|
menu_toggle();
|
2013-07-20 01:51:56 -07:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
|
|
|
|
2014-07-30 02:08:57 -07:00
|
|
|
if (menu_activated_get() > 0) return ECORE_CALLBACK_PASS_ON;
|
2014-11-01 01:13:37 -07:00
|
|
|
if (file_mgr_warning_is_opened()) return ECORE_CALLBACK_PASS_ON;
|
2013-07-20 01:51:56 -07:00
|
|
|
|
2015-06-12 01:03:45 -07:00
|
|
|
if (ctrl_func(ad, event)) return ECORE_CALLBACK_DONE;
|
2015-06-21 23:44:22 -07:00
|
|
|
if (alt_func(event)) return ECORE_CALLBACK_DONE;
|
2014-11-01 01:20:33 -07:00
|
|
|
|
2013-07-20 01:51:56 -07:00
|
|
|
//Control Key
|
2014-01-31 23:22:00 -08:00
|
|
|
if (!strcmp("Control_L", event->key))
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2013-09-07 23:34:44 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2013-07-20 01:51:56 -07:00
|
|
|
}
|
2014-09-30 07:56:16 -07:00
|
|
|
|
2015-06-11 01:19:52 -07:00
|
|
|
//Alt Key
|
|
|
|
if (!strcmp("Alt_L", event->key))
|
|
|
|
{
|
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2013-07-21 00:10:00 -07:00
|
|
|
//README
|
2014-01-31 23:22:00 -08:00
|
|
|
if (!strcmp(event->key, "F1"))
|
2013-07-21 00:10:00 -07:00
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2015-06-23 23:26:00 -07:00
|
|
|
live_edit_cancel();
|
2014-01-29 08:15:33 -08:00
|
|
|
menu_about();
|
2013-07-21 00:10:00 -07:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2013-08-25 10:17:57 -07:00
|
|
|
//New
|
2014-01-31 23:22:00 -08:00
|
|
|
if (!strcmp(event->key, "F2"))
|
2013-08-25 10:17:57 -07:00
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2015-02-24 18:10:54 -08:00
|
|
|
live_edit_cancel();
|
2014-10-13 23:26:42 -07:00
|
|
|
menu_edc_new(EINA_FALSE);
|
2013-08-25 10:17:57 -07:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
|
|
|
//Save
|
2014-01-31 23:22:00 -08:00
|
|
|
if (!strcmp(event->key, "F3"))
|
2013-08-25 10:17:57 -07:00
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2015-02-24 18:10:54 -08:00
|
|
|
live_edit_cancel();
|
2014-01-29 08:15:33 -08:00
|
|
|
menu_edc_save();
|
2013-08-25 10:17:57 -07:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2013-08-24 22:47:46 -07:00
|
|
|
//Load
|
2014-01-31 23:22:00 -08:00
|
|
|
if (!strcmp(event->key, "F4"))
|
2013-08-24 22:47:46 -07:00
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2015-02-24 18:10:54 -08:00
|
|
|
live_edit_cancel();
|
2014-01-29 08:15:33 -08:00
|
|
|
menu_edc_load();
|
2013-08-24 22:47:46 -07:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2013-07-20 01:51:56 -07:00
|
|
|
//Line Number
|
2014-01-31 23:22:00 -08:00
|
|
|
if (!strcmp(event->key, "F5"))
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2015-06-22 02:25:48 -07:00
|
|
|
tools_lines_update(ad->enventor, EINA_TRUE);
|
2013-07-20 01:51:56 -07:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2014-08-10 01:46:14 -07:00
|
|
|
//Tools
|
|
|
|
if (!strcmp(event->key, "F9"))
|
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2014-08-10 01:46:14 -07:00
|
|
|
base_tools_toggle(EINA_TRUE);
|
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
|
|
|
//Console
|
2014-03-08 08:12:28 -08:00
|
|
|
if (!strcmp(event->key, "F10"))
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2014-08-14 02:29:53 -07:00
|
|
|
base_console_toggle();
|
2013-07-20 01:51:56 -07:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2014-08-10 01:46:14 -07:00
|
|
|
//Statusbar
|
2014-03-08 08:05:26 -08:00
|
|
|
if (!strcmp(event->key, "F11"))
|
|
|
|
{
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2015-06-22 02:25:48 -07:00
|
|
|
tools_status_update(NULL, EINA_TRUE);
|
2014-03-08 08:05:26 -08:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2013-08-25 10:17:57 -07:00
|
|
|
//Setting
|
2014-01-31 23:22:00 -08:00
|
|
|
if (!strcmp(event->key, "F12"))
|
2013-08-25 10:17:57 -07:00
|
|
|
{
|
2015-02-24 18:10:54 -08:00
|
|
|
live_edit_cancel();
|
2014-12-08 18:19:55 -08:00
|
|
|
enventor_object_ctxpopup_dismiss(ad->enventor);
|
2014-01-29 08:15:33 -08:00
|
|
|
menu_setting();
|
2013-08-25 10:17:57 -07:00
|
|
|
return ECORE_CALLBACK_DONE;
|
|
|
|
}
|
2013-07-20 01:51:56 -07:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-05 03:27:03 -08:00
|
|
|
statusbar_set()
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-02-04 05:45:41 -08:00
|
|
|
Evas_Object *obj = stats_init(base_layout_get());
|
2014-09-30 07:56:16 -07:00
|
|
|
elm_object_part_content_set(base_layout_get(), "elm.swallow.statusbar", obj);
|
2015-06-22 02:25:48 -07:00
|
|
|
tools_status_update(NULL, EINA_FALSE);
|
2013-07-20 01:51:56 -07:00
|
|
|
}
|
|
|
|
|
2015-02-20 04:54:25 -08:00
|
|
|
static void
|
|
|
|
live_edit_set(Evas_Object *enventor, Evas_Object *tools)
|
|
|
|
{
|
|
|
|
Evas_Object *trigger = tools_live_edit_get(tools);
|
|
|
|
live_edit_init(enventor, trigger);
|
|
|
|
}
|
|
|
|
|
2013-07-25 09:31:49 -07:00
|
|
|
static Eina_Bool
|
2013-07-20 01:51:56 -07:00
|
|
|
init(app_data *ad, int argc, char **argv)
|
|
|
|
{
|
|
|
|
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, main_key_down_cb, ad);
|
2014-01-26 08:21:02 -08:00
|
|
|
ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, main_mouse_wheel_cb, ad);
|
2013-07-20 01:51:56 -07:00
|
|
|
|
|
|
|
elm_setup();
|
2014-05-12 08:08:54 -07:00
|
|
|
|
2015-02-12 21:41:54 -08:00
|
|
|
enventor_init(argc, argv);
|
|
|
|
|
2015-07-03 07:01:22 -07:00
|
|
|
Eina_Bool template = EINA_FALSE;
|
|
|
|
Eina_Bool default_edc = EINA_TRUE;
|
|
|
|
config_data_set(ad, argc, argv, &default_edc, &template);
|
2015-02-11 05:20:34 -08:00
|
|
|
newfile_default_set(default_edc);
|
2014-09-30 07:56:16 -07:00
|
|
|
base_gui_init();
|
2014-02-04 16:55:35 -08:00
|
|
|
statusbar_set();
|
2014-09-30 07:56:16 -07:00
|
|
|
enventor_setup(ad);
|
2014-10-23 21:21:10 -07:00
|
|
|
file_mgr_init(ad->enventor);
|
2015-02-20 04:54:25 -08:00
|
|
|
Evas_Object *tools = tools_set(ad->enventor);
|
|
|
|
live_edit_set(ad->enventor, tools);
|
2014-01-29 05:28:02 -08:00
|
|
|
|
2014-05-12 02:04:22 -07:00
|
|
|
base_gui_show();
|
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
//Guarantee Enventor editor has focus.
|
|
|
|
enventor_object_focus_set(ad->enventor, EINA_TRUE);
|
2014-07-12 00:01:50 -07:00
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
menu_init(ad->enventor);
|
2013-07-25 09:31:49 -07:00
|
|
|
|
2015-07-03 07:01:22 -07:00
|
|
|
if (template) menu_edc_new(EINA_TRUE);
|
2014-10-13 23:26:42 -07:00
|
|
|
|
2015-02-02 22:21:01 -08:00
|
|
|
//Initialize syntax color.
|
|
|
|
syntax_color_init(ad->enventor);
|
|
|
|
syntax_color_update(ad->enventor);
|
|
|
|
|
2013-07-25 09:31:49 -07:00
|
|
|
return EINA_TRUE;
|
2013-07-20 01:51:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-30 07:56:16 -07:00
|
|
|
term(app_data *ad EINA_UNUSED)
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-01-29 08:15:33 -08:00
|
|
|
menu_term();
|
2014-08-11 00:32:35 -07:00
|
|
|
live_edit_term();
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_term();
|
2015-06-22 06:45:40 -07:00
|
|
|
tools_term();
|
2014-02-04 00:17:43 -08:00
|
|
|
base_gui_term();
|
2014-10-23 21:21:10 -07:00
|
|
|
file_mgr_term();
|
2014-01-29 09:45:10 -08:00
|
|
|
config_term();
|
2014-09-30 07:56:16 -07:00
|
|
|
enventor_shutdown();
|
2013-07-20 01:51:56 -07:00
|
|
|
}
|
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
EAPI_MAIN
|
|
|
|
int elm_main(int argc, char **argv)
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-10-31 09:15:58 -07:00
|
|
|
app_data ad;
|
|
|
|
memset(&ad, 0x00, sizeof(ad));
|
2013-07-20 01:51:56 -07:00
|
|
|
|
2013-07-25 09:31:49 -07:00
|
|
|
if (!init(&ad, argc, argv))
|
|
|
|
{
|
|
|
|
term(&ad);
|
|
|
|
return 0;
|
|
|
|
}
|
2013-07-20 01:51:56 -07:00
|
|
|
|
|
|
|
elm_run();
|
|
|
|
|
|
|
|
term(&ad);
|
|
|
|
|
2014-09-30 07:56:16 -07:00
|
|
|
elm_shutdown();
|
|
|
|
|
2013-07-20 01:51:56 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2014-09-30 07:56:16 -07:00
|
|
|
ELM_MAIN()
|