forked from enlightenment/edi
Merge in master
This commit is contained in:
commit
1b1242a430
|
@ -12,6 +12,9 @@ MAINTAINERCLEANFILES = \
|
||||||
install-sh \
|
install-sh \
|
||||||
ltmain.sh \
|
ltmain.sh \
|
||||||
missing \
|
missing \
|
||||||
|
m4/intl.m4 \
|
||||||
|
m4/intldir.m4 \
|
||||||
|
m4/intlmacosx.m4 \
|
||||||
m4/libtool.m4 \
|
m4/libtool.m4 \
|
||||||
m4/ltoptions.m4 \
|
m4/ltoptions.m4 \
|
||||||
m4/ltsugar.m4 \
|
m4/ltsugar.m4 \
|
||||||
|
|
|
@ -71,6 +71,12 @@ fi
|
||||||
|
|
||||||
AC_SUBST(HAVE_LIBCLANG)
|
AC_SUBST(HAVE_LIBCLANG)
|
||||||
|
|
||||||
|
# if cross compiling, disable NLS support.
|
||||||
|
# It's not worth the trouble, at least for now.
|
||||||
|
if test "x$cross_compiling" = xyes; then
|
||||||
|
enable_nls=no
|
||||||
|
fi
|
||||||
|
|
||||||
EFL_TESTS([${build_tests}])
|
EFL_TESTS([${build_tests}])
|
||||||
|
|
||||||
# doxygen program for documentation building
|
# doxygen program for documentation building
|
||||||
|
|
Binary file not shown.
|
@ -2,19 +2,17 @@ MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
bin_PROGRAMS = elm_code_test
|
bin_PROGRAMS = elm_code_test
|
||||||
|
|
||||||
AM_CPPFLAGS = -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
AM_CPPFLAGS = \
|
||||||
-I$(top_builddir)/elm_code/bin/ \
|
|
||||||
-I$(top_srcdir)/elm_code/bin/ \
|
|
||||||
-I$(top_builddir)/elm_code/lib/ \
|
|
||||||
-I$(top_srcdir)/elm_code/lib/ \
|
-I$(top_srcdir)/elm_code/lib/ \
|
||||||
|
-DLOCALEDIR=\"$(datadir)/locale\" \
|
||||||
-DEFL_BETA_API_SUPPORT \
|
-DEFL_BETA_API_SUPPORT \
|
||||||
@EFL_CFLAGS@
|
@EFL_CFLAGS@
|
||||||
|
|
||||||
elm_code_test_SOURCES = elm_code_test_main.c
|
elm_code_test_SOURCES = \
|
||||||
|
elm_code_test_main.c \
|
||||||
|
elm_code_test_private.h
|
||||||
|
|
||||||
elm_code_test_LDADD = @EFL_LIBS@ $(top_builddir)/elm_code/lib/libelm_code.la
|
elm_code_test_LDADD = @EFL_LIBS@ $(top_builddir)/elm_code/lib/libelm_code.la
|
||||||
|
|
||||||
localedir = $(datadir)/locale
|
elm_code_test_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||||
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
|
||||||
|
|
||||||
EXTRA_DIST = elm_code_test_private.h
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,18 @@ static void _append_line(Elm_Code_File *file, const char *line)
|
||||||
elm_code_file_line_append(file, line, length);
|
elm_code_file_line_append(file, line, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_elm_code_test_line_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED,
|
||||||
|
const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
|
||||||
|
{
|
||||||
|
Elm_Code_Line *line;
|
||||||
|
|
||||||
|
line = (Elm_Code_Line *)event_info;
|
||||||
|
|
||||||
|
printf("CLICKED line %d\n", line->number);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_elm_code_test_welcome_setup(Evas_Object *parent)
|
_elm_code_test_welcome_setup(Evas_Object *parent)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +53,7 @@ _elm_code_test_welcome_setup(Evas_Object *parent)
|
||||||
widget = elm_code_widget_add(parent, code);
|
widget = elm_code_widget_add(parent, code);
|
||||||
elm_code_widget_font_size_set(widget, 14);
|
elm_code_widget_font_size_set(widget, 14);
|
||||||
elm_code_widget_editable_set(widget, EINA_TRUE);
|
elm_code_widget_editable_set(widget, EINA_TRUE);
|
||||||
|
eo_do(widget,eo_event_callback_add(&ELM_CODE_WIDGET_EVENT_LINE_CLICKED, _elm_code_test_line_cb, code));
|
||||||
|
|
||||||
_append_line(code->file, "Hello World, Elm Code!");
|
_append_line(code->file, "Hello World, Elm Code!");
|
||||||
elm_code_file_line_token_add(code->file, 1, 14, 21, ELM_CODE_TOKEN_TYPE_COMMENT);
|
elm_code_file_line_token_add(code->file, 1, 14, 21, ELM_CODE_TOKEN_TYPE_COMMENT);
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
#ifndef ELM_CODE_H_
|
#ifndef ELM_CODE_H_
|
||||||
# define ELM_CODE_H_
|
# define ELM_CODE_H_
|
||||||
|
|
||||||
#include <Elementary.h>
|
|
||||||
#include <Eo.h>
|
|
||||||
#include <Eina.h>
|
#include <Eina.h>
|
||||||
|
#include <Eo.h>
|
||||||
#include <elm_code_common.h>
|
#include <Elementary.h>
|
||||||
#include <elm_code_file.h>
|
|
||||||
#include <elm_code_parse.h>
|
|
||||||
#include <elm_code_widget.h>
|
|
||||||
#include <elm_code_diff_widget.h>
|
|
||||||
|
|
||||||
#ifdef EAPI
|
#ifdef EAPI
|
||||||
# undef EAPI
|
# undef EAPI
|
||||||
|
@ -37,6 +31,12 @@
|
||||||
# endif
|
# endif
|
||||||
#endif /* ! _WIN32 */
|
#endif /* ! _WIN32 */
|
||||||
|
|
||||||
|
#include "elm_code_common.h"
|
||||||
|
#include "elm_code_file.h"
|
||||||
|
#include "elm_code_parse.h"
|
||||||
|
#include "elm_code_widget.h"
|
||||||
|
#include "elm_code_diff_widget.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,9 +2,6 @@ MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
-I$(top_srcdir)/elm_code/lib \
|
-I$(top_srcdir)/elm_code/lib \
|
||||||
-I$(top_builddir)/elm_code/lib \
|
|
||||||
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
|
||||||
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
|
||||||
-DEFL_BETA_API_SUPPORT \
|
-DEFL_BETA_API_SUPPORT \
|
||||||
@EFL_CFLAGS@ \
|
@EFL_CFLAGS@ \
|
||||||
-DEFL_ELM_CODE_BUILD
|
-DEFL_ELM_CODE_BUILD
|
||||||
|
@ -24,6 +21,7 @@ elm_code_file.c \
|
||||||
elm_code_parse.c \
|
elm_code_parse.c \
|
||||||
elm_code_widget.c \
|
elm_code_widget.c \
|
||||||
elm_code_diff_widget.c \
|
elm_code_diff_widget.c \
|
||||||
elm_code.c
|
elm_code.c \
|
||||||
|
elm_code_private.h
|
||||||
libelm_code_la_LIBADD = @EFL_LIBS@ -lm
|
libelm_code_la_LIBADD = @EFL_LIBS@ -lm
|
||||||
libelm_code_la_LDFLAGS = -no-undefined @EFL_LTLIBRARY_FLAGS@
|
libelm_code_la_LDFLAGS = -no-undefined @EFL_LTLIBRARY_FLAGS@
|
||||||
|
|
|
@ -3,20 +3,21 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Eo.h>
|
#include <Eo.h>
|
||||||
|
#include <Evas.h>
|
||||||
|
|
||||||
#include "Elm_Code.h"
|
#include "Elm_Code.h"
|
||||||
#include "elm_code_parse.h"
|
|
||||||
|
|
||||||
#include "elm_code_private.h"
|
#include "elm_code_private.h"
|
||||||
|
|
||||||
static int _elm_code_init = 0;
|
static int _elm_code_init = 0;
|
||||||
int _elm_code_lib_log_dom = -1;
|
int _elm_code_lib_log_dom = -1;
|
||||||
|
|
||||||
const Eo_Event_Description ELM_CODE_EVENT_LINE_SET_DONE =
|
EAPI const Eo_Event_Description ELM_CODE_EVENT_LINE_SET_DONE =
|
||||||
EO_EVENT_DESCRIPTION("line,set,done", "");
|
EO_EVENT_DESCRIPTION("line,set,done", "");
|
||||||
const Eo_Event_Description ELM_CODE_EVENT_FILE_LOAD_DONE =
|
EAPI const Eo_Event_Description ELM_CODE_EVENT_FILE_LOAD_DONE =
|
||||||
EO_EVENT_DESCRIPTION("file,load,done", "");
|
EO_EVENT_DESCRIPTION("file,load,done", "");
|
||||||
|
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
elm_code_init(void)
|
elm_code_init(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
#ifndef ELM_CODE_COMMON_H_
|
#ifndef ELM_CODE_COMMON_H_
|
||||||
# define ELM_CODE_COMMON_H_
|
# define ELM_CODE_COMMON_H_
|
||||||
|
|
||||||
#include <Eo.h>
|
|
||||||
#include <Eina.h>
|
|
||||||
|
|
||||||
typedef struct _Elm_Code Elm_Code;
|
typedef struct _Elm_Code Elm_Code;
|
||||||
|
typedef struct _Elm_Code_File Elm_Code_File;
|
||||||
|
|
||||||
EAPI extern const Eo_Event_Description ELM_CODE_EVENT_LINE_SET_DONE;
|
EAPI extern const Eo_Event_Description ELM_CODE_EVENT_LINE_SET_DONE;
|
||||||
EAPI extern const Eo_Event_Description ELM_CODE_EVENT_FILE_LOAD_DONE;
|
EAPI extern const Eo_Event_Description ELM_CODE_EVENT_FILE_LOAD_DONE;
|
||||||
|
@ -37,8 +35,6 @@ typedef enum {
|
||||||
ELM_CODE_TOKEN_TYPE_COUNT
|
ELM_CODE_TOKEN_TYPE_COUNT
|
||||||
} Elm_Code_Token_Type;
|
} Elm_Code_Token_Type;
|
||||||
|
|
||||||
#include "elm_code_file.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,11 +2,7 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Eo.h>
|
|
||||||
#include <Elementary.h>
|
|
||||||
|
|
||||||
#include "Elm_Code.h"
|
#include "Elm_Code.h"
|
||||||
#include "elm_code_diff_widget.h"
|
|
||||||
|
|
||||||
#include "elm_code_private.h"
|
#include "elm_code_private.h"
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#ifndef ELM_CODE_DIFF_WIDGET_H_
|
#ifndef ELM_CODE_DIFF_WIDGET_H_
|
||||||
# define ELM_CODE_DIFF_WIDGET_H_
|
# define ELM_CODE_DIFF_WIDGET_H_
|
||||||
|
|
||||||
#include <Evas.h>
|
|
||||||
#include "elm_code_common.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Elm_Code.h"
|
#include "Elm_Code.h"
|
||||||
#include "elm_code_file.h"
|
|
||||||
#include "elm_code_parse.h"
|
|
||||||
|
|
||||||
#include "elm_code_private.h"
|
#include "elm_code_private.h"
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#ifndef ELM_CODE_FILE_H_
|
#ifndef ELM_CODE_FILE_H_
|
||||||
# define ELM_CODE_FILE_H_
|
# define ELM_CODE_FILE_H_
|
||||||
|
|
||||||
#include <Eina.h>
|
|
||||||
|
|
||||||
#include "elm_code_common.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,7 +31,7 @@ typedef struct _Elm_Code_Line
|
||||||
|
|
||||||
} Elm_Code_Line;
|
} Elm_Code_Line;
|
||||||
|
|
||||||
typedef struct _Elm_Code_File
|
struct _Elm_Code_File
|
||||||
{
|
{
|
||||||
void *parent;
|
void *parent;
|
||||||
|
|
||||||
|
@ -43,7 +39,7 @@ typedef struct _Elm_Code_File
|
||||||
Eina_File *file;
|
Eina_File *file;
|
||||||
void *map;
|
void *map;
|
||||||
|
|
||||||
} Elm_Code_File;
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief File handling functions.
|
* @brief File handling functions.
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Elm_Code.h"
|
#include "Elm_Code.h"
|
||||||
#include "elm_code_parse.h"
|
|
||||||
|
|
||||||
#include "elm_code_private.h"
|
#include "elm_code_private.h"
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
#ifndef ELM_CODE_PARSE_H_
|
#ifndef ELM_CODE_PARSE_H_
|
||||||
# define ELM_CODE_PARSE_H_
|
# define ELM_CODE_PARSE_H_
|
||||||
|
|
||||||
#include <Eina.h>
|
|
||||||
|
|
||||||
#include "elm_code_common.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Eo.h>
|
#include "Elm_Code.h"
|
||||||
#include <Elementary.h>
|
|
||||||
|
|
||||||
#include "elm_code_widget.h"
|
|
||||||
|
|
||||||
#include "elm_code_private.h"
|
#include "elm_code_private.h"
|
||||||
|
|
||||||
|
EAPI const Eo_Event_Description ELM_CODE_WIDGET_EVENT_LINE_CLICKED =
|
||||||
|
EO_EVENT_DESCRIPTION("line,clicked", "");
|
||||||
|
|
||||||
Eina_Unicode status_icons[] = {
|
Eina_Unicode status_icons[] = {
|
||||||
' ',
|
' ',
|
||||||
'!',
|
'!',
|
||||||
|
@ -188,8 +188,30 @@ _elm_code_widget_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
|
||||||
_elm_code_widget_fill(obj, code);
|
_elm_code_widget_fill(obj, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Object *
|
static void
|
||||||
elm_code_widget_add(Evas_Object *parent, Elm_Code *code)
|
_elm_code_widget_clicked_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
|
||||||
|
void *event_info)
|
||||||
|
{
|
||||||
|
Elm_Code *code;
|
||||||
|
Elm_Code_Line *line;
|
||||||
|
Evas_Event_Mouse_Up *event;
|
||||||
|
Evas_Coord y;
|
||||||
|
int ch;
|
||||||
|
unsigned int row;
|
||||||
|
|
||||||
|
code = (Elm_Code *)data;
|
||||||
|
event = (Evas_Event_Mouse_Up *)event_info;
|
||||||
|
y = event->canvas.y;
|
||||||
|
|
||||||
|
evas_object_textgrid_cell_size_get(obj, NULL, &ch);
|
||||||
|
row = ((double) y / ch) + 1;
|
||||||
|
|
||||||
|
line = elm_code_file_line_get(code->file, row);
|
||||||
|
if (line)
|
||||||
|
elm_code_callback_fire(code, &ELM_CODE_WIDGET_EVENT_LINE_CLICKED, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Evas_Object *elm_code_widget_add(Evas_Object *parent, Elm_Code *code)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Elm_Code_Widget *widget;
|
Elm_Code_Widget *widget;
|
||||||
|
@ -231,6 +253,7 @@ elm_code_widget_add(Evas_Object *parent, Elm_Code *code)
|
||||||
evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_CURSOR,
|
evas_object_textgrid_palette_set(o, EVAS_TEXTGRID_PALETTE_STANDARD, ELM_CODE_TOKEN_TYPE_CURSOR,
|
||||||
205, 205, 54, 255);
|
205, 205, 54, 255);
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, code);
|
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, code);
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _elm_code_widget_clicked_cb, code);
|
||||||
|
|
||||||
eo_do(o,eo_event_callback_add(&ELM_CODE_EVENT_LINE_SET_DONE, _elm_code_widget_line_cb, code));
|
eo_do(o,eo_event_callback_add(&ELM_CODE_EVENT_LINE_SET_DONE, _elm_code_widget_line_cb, code));
|
||||||
eo_do(o,eo_event_callback_add(&ELM_CODE_EVENT_FILE_LOAD_DONE, _elm_code_widget_file_cb, code));
|
eo_do(o,eo_event_callback_add(&ELM_CODE_EVENT_FILE_LOAD_DONE, _elm_code_widget_file_cb, code));
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#ifndef ELM_CODE_WIDGET_H_
|
#ifndef ELM_CODE_WIDGET_H_
|
||||||
# define ELM_CODE_WIDGET_H_
|
# define ELM_CODE_WIDGET_H_
|
||||||
|
|
||||||
#include <Evas.h>
|
EAPI extern const Eo_Event_Description ELM_CODE_WIDGET_EVENT_LINE_CLICKED;
|
||||||
#include "elm_code_common.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -216,7 +216,7 @@ _edi_config_load(void)
|
||||||
|
|
||||||
if (!_edi_cfg)
|
if (!_edi_cfg)
|
||||||
{
|
{
|
||||||
_edi_cfg = malloc(sizeof(Edi_Config));
|
_edi_cfg = calloc(1, sizeof(Edi_Config));
|
||||||
save = EINA_TRUE;
|
save = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,3 +279,21 @@ _edi_config_project_add(const char *path)
|
||||||
_edi_cfg->projects = eina_list_prepend(_edi_cfg->projects, project);
|
_edi_cfg->projects = eina_list_prepend(_edi_cfg->projects, project);
|
||||||
_edi_config_save();
|
_edi_config_save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_edi_config_project_remove(const char *path)
|
||||||
|
{
|
||||||
|
Edi_Config_Project *project;
|
||||||
|
Eina_List *list, *next;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH_SAFE(_edi_cfg->projects, list, next, project)
|
||||||
|
{
|
||||||
|
if (!strncmp(project->path, path, strlen(project->path)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_edi_cfg->projects = eina_list_remove(_edi_cfg->projects, project);
|
||||||
|
_edi_config_save();
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ void _edi_config_load(void);
|
||||||
void _edi_config_save(void);
|
void _edi_config_save(void);
|
||||||
|
|
||||||
void _edi_config_project_add(const char *path);
|
void _edi_config_project_add(const char *path);
|
||||||
|
void _edi_config_project_remove(const char *path);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
static Evas_Object *_console_box;
|
static Evas_Object *_console_box;
|
||||||
static const char *_current_dir = NULL;
|
static const char *_current_dir = NULL;
|
||||||
|
|
||||||
|
static unsigned int _edi_strlen_current_dir;
|
||||||
static int _edi_test_count;
|
static int _edi_test_count;
|
||||||
static int _edi_test_pass;
|
static int _edi_test_pass;
|
||||||
static int _edi_test_fail;
|
static int _edi_test_fail;
|
||||||
|
@ -73,7 +74,8 @@ static void _edi_consolepanel_parse_directory(const char *line)
|
||||||
if (_current_dir)
|
if (_current_dir)
|
||||||
eina_stringshare_del(_current_dir);
|
eina_stringshare_del(_current_dir);
|
||||||
|
|
||||||
_current_dir = eina_stringshare_add_length(pos + 20, strlen(pos) - 21);
|
_edi_strlen_current_dir = strlen(pos) - 21;
|
||||||
|
_current_dir = eina_stringshare_add_length(pos + 20, _edi_strlen_current_dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +117,7 @@ static void _edi_consolepanel_append_line_type(const char *line, Eina_Bool err)
|
||||||
snprintf(buf, strlen(line) + 8, "<b>%s</b>%s/n", file, pos);
|
snprintf(buf, strlen(line) + 8, "<b>%s</b>%s/n", file, pos);
|
||||||
elm_object_text_set(txt, buf);
|
elm_object_text_set(txt, buf);
|
||||||
|
|
||||||
length = strlen(_current_dir) + strlen(file) + 2;
|
length = _edi_strlen_current_dir + strlen(file) + 2;
|
||||||
path = malloc(sizeof(char) * length);
|
path = malloc(sizeof(char) * length);
|
||||||
snprintf(path, length, "%s/%s\n", _current_dir, file);
|
snprintf(path, length, "%s/%s\n", _current_dir, file);
|
||||||
|
|
||||||
|
@ -166,17 +168,17 @@ static void _edi_consolepanel_append_line_type(const char *line, Eina_Bool err)
|
||||||
_edi_test_line_callback(line);
|
_edi_test_line_callback(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
void edi_consolepanel_append_line(const char *line)
|
EAPI void edi_consolepanel_append_line(const char *line)
|
||||||
{
|
{
|
||||||
_edi_consolepanel_append_line_type(line, EINA_FALSE);
|
_edi_consolepanel_append_line_type(line, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void edi_consolepanel_append_error_line(const char *line)
|
EAPI void edi_consolepanel_append_error_line(const char *line)
|
||||||
{
|
{
|
||||||
_edi_consolepanel_append_line_type(line, EINA_TRUE);
|
_edi_consolepanel_append_line_type(line, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void edi_consolepanel_clear()
|
EAPI void edi_consolepanel_clear()
|
||||||
{
|
{
|
||||||
elm_box_clear(_console_box);
|
elm_box_clear(_console_box);
|
||||||
|
|
||||||
|
@ -309,7 +311,7 @@ static void _edi_test_line_callback(const char *content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void edi_consolepanel_add(Evas_Object *parent)
|
EAPI void edi_consolepanel_add(Evas_Object *parent)
|
||||||
{
|
{
|
||||||
Evas_Object *scroll, *vbx;
|
Evas_Object *scroll, *vbx;
|
||||||
|
|
||||||
|
@ -331,7 +333,7 @@ void edi_consolepanel_add(Evas_Object *parent)
|
||||||
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _exe_error, NULL);
|
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _exe_error, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void edi_testpanel_add(Evas_Object *parent)
|
EAPI void edi_testpanel_add(Evas_Object *parent)
|
||||||
{
|
{
|
||||||
Elm_Code *code;
|
Elm_Code *code;
|
||||||
Evas_Object *widget;
|
Evas_Object *widget;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
static Evas_Object *_info_widget;
|
static Evas_Object *_info_widget;
|
||||||
static Elm_Code *_elm_code;
|
static Elm_Code *_elm_code;
|
||||||
|
|
||||||
void print_cb(const Eina_Log_Domain *domain,
|
static void _print_cb(const Eina_Log_Domain *domain,
|
||||||
Eina_Log_Level level,
|
Eina_Log_Level level,
|
||||||
const char *file,
|
const char *file,
|
||||||
const char *fnc,
|
const char *fnc,
|
||||||
|
@ -38,7 +38,7 @@ void print_cb(const Eina_Log_Domain *domain,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void edi_logpanel_add(Evas_Object *parent)
|
EAPI void edi_logpanel_add(Evas_Object *parent)
|
||||||
{
|
{
|
||||||
Evas_Object *widget;
|
Evas_Object *widget;
|
||||||
Elm_Code *code;
|
Elm_Code *code;
|
||||||
|
@ -53,7 +53,7 @@ void edi_logpanel_add(Evas_Object *parent)
|
||||||
_elm_code = code;
|
_elm_code = code;
|
||||||
_info_widget = widget;
|
_info_widget = widget;
|
||||||
|
|
||||||
eina_log_print_cb_set(print_cb, NULL);
|
eina_log_print_cb_set(_print_cb, NULL);
|
||||||
eina_log_color_disable_set(EINA_TRUE);
|
eina_log_color_disable_set(EINA_TRUE);
|
||||||
|
|
||||||
elm_box_pack_end(parent, widget);
|
elm_box_pack_end(parent, widget);
|
||||||
|
|
|
@ -39,13 +39,48 @@ static Elm_Object_Item *_edi_logpanel_item, *_edi_consolepanel_item, *_edi_testp
|
||||||
static Elm_Object_Item *_edi_selected_bottompanel;
|
static Elm_Object_Item *_edi_selected_bottompanel;
|
||||||
static Evas_Object *_edi_filepanel, *_edi_filepanel_icon;
|
static Evas_Object *_edi_filepanel, *_edi_filepanel_icon;
|
||||||
|
|
||||||
static Evas_Object *_edi_main_win, *_edi_new_popup, *_edi_goto_popup;
|
static Evas_Object *_edi_main_win, *_edi_new_popup, *_edi_goto_popup,*_edi_message_popup;
|
||||||
|
int _edi_log_dom = -1;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edi_on_close_message(void *data,
|
||||||
|
Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
evas_object_del(data);
|
||||||
|
evas_object_del(_edi_message_popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edi_message_open(const char *message)
|
||||||
|
{
|
||||||
|
Evas_Object *popup, *button;
|
||||||
|
|
||||||
|
popup = elm_popup_add(_edi_main_win);
|
||||||
|
_edi_message_popup = popup;
|
||||||
|
elm_object_part_text_set(popup, "title,text",
|
||||||
|
message);
|
||||||
|
|
||||||
|
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_on_close_message, NULL);
|
||||||
|
|
||||||
|
evas_object_show(popup);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edi_file_open_cb(const char *path, const char *type, Eina_Bool newwin)
|
_edi_file_open_cb(const char *path, const char *type, Eina_Bool newwin)
|
||||||
{
|
{
|
||||||
Edi_Path_Options *options;
|
Edi_Path_Options *options;
|
||||||
|
|
||||||
|
if (path == NULL)
|
||||||
|
{
|
||||||
|
_edi_message_open("Please choose a file from the list");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
options = edi_path_options_create(path);
|
options = edi_path_options_create(path);
|
||||||
options->type = type;
|
options->type = type;
|
||||||
|
|
||||||
|
@ -247,14 +282,14 @@ _edi_panel_dragged_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
_edi_panel_size_save(data == _edi_filepanel);
|
_edi_panel_size_save(data == _edi_filepanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
EAPI void
|
||||||
edi_consolepanel_show()
|
edi_consolepanel_show()
|
||||||
{
|
{
|
||||||
if (_edi_selected_bottompanel != _edi_consolepanel_item)
|
if (_edi_selected_bottompanel != _edi_consolepanel_item)
|
||||||
elm_toolbar_item_selected_set(_edi_consolepanel_item, EINA_TRUE);
|
elm_toolbar_item_selected_set(_edi_consolepanel_item, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
EAPI void
|
||||||
edi_testpanel_show()
|
edi_testpanel_show()
|
||||||
{
|
{
|
||||||
if (_edi_selected_bottompanel != _edi_testpanel_item)
|
if (_edi_selected_bottompanel != _edi_testpanel_item)
|
||||||
|
@ -374,20 +409,20 @@ edi_content_setup(Evas_Object *win, const char *path)
|
||||||
{
|
{
|
||||||
elm_panes_content_right_size_set(logpane, _edi_cfg->gui.bottomsize);
|
elm_panes_content_right_size_set(logpane, _edi_cfg->gui.bottomsize);
|
||||||
if (_edi_cfg->gui.bottomtab == 1)
|
if (_edi_cfg->gui.bottomtab == 1)
|
||||||
{
|
{
|
||||||
elm_toolbar_item_icon_set(_edi_consolepanel_item, "stock_down");
|
elm_toolbar_item_icon_set(_edi_consolepanel_item, "stock_down");
|
||||||
_edi_selected_bottompanel = _edi_consolepanel_item;
|
_edi_selected_bottompanel = _edi_consolepanel_item;
|
||||||
}
|
}
|
||||||
else if (_edi_cfg->gui.bottomtab == 2)
|
else if (_edi_cfg->gui.bottomtab == 2)
|
||||||
{
|
{
|
||||||
elm_toolbar_item_icon_set(_edi_testpanel_item, "stock_down");
|
elm_toolbar_item_icon_set(_edi_testpanel_item, "stock_down");
|
||||||
_edi_selected_bottompanel = _edi_testpanel_item;
|
_edi_selected_bottompanel = _edi_testpanel_item;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
elm_toolbar_item_icon_set(_edi_logpanel_item, "stock_down");
|
elm_toolbar_item_icon_set(_edi_logpanel_item, "stock_down");
|
||||||
_edi_selected_bottompanel = _edi_logpanel_item;
|
_edi_selected_bottompanel = _edi_logpanel_item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
elm_panes_content_right_size_set(logpane, 0.0);
|
elm_panes_content_right_size_set(logpane, 0.0);
|
||||||
|
@ -740,6 +775,26 @@ edi_close()
|
||||||
elm_exit();
|
elm_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_edi_log_init()
|
||||||
|
{
|
||||||
|
_edi_log_dom = eina_log_domain_register("edi", EINA_COLOR_GREEN);
|
||||||
|
if (_edi_log_dom < 0)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Edi can not create its log domain.");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edi_log_shutdown()
|
||||||
|
{
|
||||||
|
eina_log_domain_unregister(_edi_log_dom);
|
||||||
|
_edi_log_dom = -1;
|
||||||
|
}
|
||||||
|
|
||||||
static const Ecore_Getopt optdesc = {
|
static const Ecore_Getopt optdesc = {
|
||||||
"edi",
|
"edi",
|
||||||
"%prog [options] [project-dir]",
|
"%prog [options] [project-dir]",
|
||||||
|
@ -784,6 +839,8 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||||
goto config_error;
|
goto config_error;
|
||||||
|
|
||||||
edi_init();
|
edi_init();
|
||||||
|
if (!_edi_log_init())
|
||||||
|
goto end;
|
||||||
|
|
||||||
args = ecore_getopt_parse(&optdesc, values, argc, argv);
|
args = ecore_getopt_parse(&optdesc, values, argc, argv);
|
||||||
if (args < 0)
|
if (args < 0)
|
||||||
|
@ -814,6 +871,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
||||||
elm_run();
|
elm_run();
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
_edi_log_shutdown();
|
||||||
elm_shutdown();
|
elm_shutdown();
|
||||||
edi_shutdown();
|
edi_shutdown();
|
||||||
|
|
||||||
|
|
|
@ -3,28 +3,28 @@
|
||||||
|
|
||||||
#include <Evas.h>
|
#include <Evas.h>
|
||||||
|
|
||||||
extern int _edi_lib_log_dom;
|
extern int _edi_log_dom;
|
||||||
|
|
||||||
#ifdef CRIT
|
#ifdef CRIT
|
||||||
# undef CRIT
|
# undef CRIT
|
||||||
#endif
|
#endif
|
||||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_edi_lib_log_dom, __VA_ARGS__)
|
#define CRIT(...) EINA_LOG_DOM_CRIT(_edi_log_dom, __VA_ARGS__)
|
||||||
#ifdef ERR
|
#ifdef ERR
|
||||||
# undef ERR
|
# undef ERR
|
||||||
#endif
|
#endif
|
||||||
#define ERR(...) EINA_LOG_DOM_ERR(_edi_lib_log_dom, __VA_ARGS__)
|
#define ERR(...) EINA_LOG_DOM_ERR(_edi_log_dom, __VA_ARGS__)
|
||||||
#ifdef WRN
|
#ifdef WRN
|
||||||
# undef WRN
|
# undef WRN
|
||||||
#endif
|
#endif
|
||||||
#define WRN(...) EINA_LOG_DOM_WARN(_edi_lib_log_dom, __VA_ARGS__)
|
#define WRN(...) EINA_LOG_DOM_WARN(_edi_log_dom, __VA_ARGS__)
|
||||||
#ifdef INF
|
#ifdef INF
|
||||||
# undef INF
|
# undef INF
|
||||||
#endif
|
#endif
|
||||||
#define INF(...) EINA_LOG_DOM_INFO(_edi_lib_log_dom, __VA_ARGS__)
|
#define INF(...) EINA_LOG_DOM_INFO(_edi_log_dom, __VA_ARGS__)
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
# undef DBG
|
# undef DBG
|
||||||
#endif
|
#endif
|
||||||
#define DBG(...) EINA_LOG_DOM_DBG(_edi_lib_log_dom, __VA_ARGS__)
|
#define DBG(...) EINA_LOG_DOM_DBG(_edi_log_dom, __VA_ARGS__)
|
||||||
|
|
||||||
#define EDI_CONTENT_AUTOSAVE EINA_TRUE
|
#define EDI_CONTENT_AUTOSAVE EINA_TRUE
|
||||||
|
|
||||||
|
|
|
@ -316,7 +316,7 @@ _edi_editor_statusbar_add(Evas_Object *panel, Edi_Editor *editor, Edi_Mainview_I
|
||||||
#if HAVE_LIBCLANG
|
#if HAVE_LIBCLANG
|
||||||
// TODO on any refresh heck mtime - then re-run clang if changed - it should be fast enough now...
|
// TODO on any refresh heck mtime - then re-run clang if changed - it should be fast enough now...
|
||||||
static void
|
static void
|
||||||
_clang_remove_highlighting(Edi_Editor *editor)
|
_edi_line_color_remove(Edi_Editor *editor, unsigned int line)
|
||||||
{
|
{
|
||||||
Eina_List *formats;
|
Eina_List *formats;
|
||||||
Evas_Object *textblock;
|
Evas_Object *textblock;
|
||||||
|
@ -324,12 +324,13 @@ _clang_remove_highlighting(Edi_Editor *editor)
|
||||||
Evas_Object_Textblock_Node_Format *format;
|
Evas_Object_Textblock_Node_Format *format;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
ecore_thread_main_loop_begin();
|
|
||||||
textblock = elm_entry_textblock_get(editor->entry);
|
textblock = elm_entry_textblock_get(editor->entry);
|
||||||
start = evas_object_textblock_cursor_new(textblock);
|
start = evas_object_textblock_cursor_new(textblock);
|
||||||
|
evas_textblock_cursor_line_set(start, line);
|
||||||
|
evas_textblock_cursor_pos_set(start, evas_textblock_cursor_pos_get(start));
|
||||||
end = evas_object_textblock_cursor_new(textblock);
|
end = evas_object_textblock_cursor_new(textblock);
|
||||||
|
evas_textblock_cursor_line_set(end, line);
|
||||||
evas_textblock_cursor_visible_range_get(start, end);
|
evas_textblock_cursor_pos_set(end, evas_textblock_cursor_pos_get(end) - 1);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
formats = evas_textblock_cursor_range_formats_get(start, end);
|
formats = evas_textblock_cursor_range_formats_get(start, end);
|
||||||
|
@ -344,9 +345,9 @@ _clang_remove_highlighting(Edi_Editor *editor)
|
||||||
|
|
||||||
formats = evas_textblock_cursor_range_formats_get(start, end);
|
formats = evas_textblock_cursor_range_formats_get(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
evas_textblock_cursor_free(start);
|
evas_textblock_cursor_free(start);
|
||||||
evas_textblock_cursor_free(end);
|
evas_textblock_cursor_free(end);
|
||||||
ecore_thread_main_loop_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -360,6 +361,14 @@ _edi_range_color_set(Edi_Editor *editor, Edi_Range range, Edi_Color color)
|
||||||
if (!((Evas_Coord)range.start.line > editor->format_end || (Evas_Coord)range.end.line < editor->format_start))
|
if (!((Evas_Coord)range.start.line > editor->format_end || (Evas_Coord)range.end.line < editor->format_start))
|
||||||
{
|
{
|
||||||
textblock = elm_entry_textblock_get(editor->entry);
|
textblock = elm_entry_textblock_get(editor->entry);
|
||||||
|
|
||||||
|
if (editor->format_line == -1)
|
||||||
|
editor->format_line = range.start.line - 1;
|
||||||
|
while (editor->format_line < (int) range.end.line)
|
||||||
|
{
|
||||||
|
_edi_line_color_remove(editor, ++editor->format_line);
|
||||||
|
}
|
||||||
|
|
||||||
cursor = evas_object_textblock_cursor_new(textblock);
|
cursor = evas_object_textblock_cursor_new(textblock);
|
||||||
evas_textblock_cursor_line_set(cursor, range.start.line - 1);
|
evas_textblock_cursor_line_set(cursor, range.start.line - 1);
|
||||||
evas_textblock_cursor_pos_set(cursor, evas_textblock_cursor_pos_get(cursor) + range.start.col - 1);
|
evas_textblock_cursor_pos_set(cursor, evas_textblock_cursor_pos_get(cursor) + range.start.col - 1);
|
||||||
|
@ -367,7 +376,7 @@ _edi_range_color_set(Edi_Editor *editor, Edi_Range range, Edi_Color color)
|
||||||
|
|
||||||
evas_textblock_cursor_line_set(cursor, range.end.line - 1);
|
evas_textblock_cursor_line_set(cursor, range.end.line - 1);
|
||||||
evas_textblock_cursor_pos_set(cursor, evas_textblock_cursor_pos_get(cursor) + range.end.col - 1);
|
evas_textblock_cursor_pos_set(cursor, evas_textblock_cursor_pos_get(cursor) + range.end.col - 1);
|
||||||
evas_textblock_cursor_format_append(cursor, "</color>");
|
evas_textblock_cursor_format_prepend(cursor, "</color>");
|
||||||
|
|
||||||
evas_textblock_cursor_free(cursor);
|
evas_textblock_cursor_free(cursor);
|
||||||
}
|
}
|
||||||
|
@ -397,7 +406,7 @@ _clang_show_highlighting(void *data)
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
editor = (Edi_Editor *)data;
|
editor = (Edi_Editor *)data;
|
||||||
_clang_remove_highlighting(editor);
|
editor->format_line = -1;
|
||||||
for (i = 0 ; i < editor->token_count ; i++)
|
for (i = 0 ; i < editor->token_count ; i++)
|
||||||
{
|
{
|
||||||
Edi_Range range;
|
Edi_Range range;
|
||||||
|
@ -611,7 +620,6 @@ _edi_clang_setup(void *data)
|
||||||
/* FIXME: Possibly activate more options? */
|
/* FIXME: Possibly activate more options? */
|
||||||
editor->tx_unit = clang_parseTranslationUnit(editor->idx, path, clang_argv, clang_argc, NULL, 0, clang_defaultEditingTranslationUnitOptions() | CXTranslationUnit_DetailedPreprocessingRecord);
|
editor->tx_unit = clang_parseTranslationUnit(editor->idx, path, clang_argv, clang_argc, NULL, 0, clang_defaultEditingTranslationUnitOptions() | CXTranslationUnit_DetailedPreprocessingRecord);
|
||||||
|
|
||||||
_clang_remove_highlighting(editor);
|
|
||||||
_clang_load_errors(path, editor);
|
_clang_load_errors(path, editor);
|
||||||
_clang_load_highlighting(path, editor);
|
_clang_load_highlighting(path, editor);
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct _Edi_Editor
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Ecore_Timer *delay_highlight;
|
Ecore_Timer *delay_highlight;
|
||||||
int format_start, format_end;
|
int format_start, format_end, format_line;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,21 +9,79 @@
|
||||||
|
|
||||||
#include "edi_private.h"
|
#include "edi_private.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
|
|
||||||
#define _EDI_WELCOME_PROJECT_NEW_TABLE_WIDTH 4
|
#define _EDI_WELCOME_PROJECT_NEW_TABLE_WIDTH 4
|
||||||
|
|
||||||
static Evas_Object *_welcome_window;
|
static Evas_Object *_welcome_window;
|
||||||
|
static Evas_Object *_edi_new_popup;
|
||||||
|
static Evas_Object *_edi_welcome_list;
|
||||||
|
static Evas_Object *_edi_project_box;
|
||||||
static Evas_Object *_create_inputs[5];
|
static Evas_Object *_create_inputs[5];
|
||||||
|
|
||||||
static void
|
static Evas_Object *_edi_create_button, *_edi_open_button;
|
||||||
_edi_welcome_project_open(const char *path)
|
|
||||||
{
|
|
||||||
evas_object_del(_welcome_window);
|
|
||||||
|
|
||||||
|
static const char *_edi_message_path;
|
||||||
|
|
||||||
|
static void _edi_welcome_add_recent_projects(Evas_Object *);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edi_on_close_message(void *data,
|
||||||
|
Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
evas_object_del(data);
|
||||||
|
evas_object_del(_edi_new_popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edi_on_delete_message(void *data,
|
||||||
|
Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
_edi_config_project_remove(_edi_message_path);
|
||||||
|
|
||||||
|
evas_object_del(_edi_welcome_list);
|
||||||
|
_edi_welcome_add_recent_projects(_edi_project_box);
|
||||||
|
evas_object_del(data);
|
||||||
|
evas_object_del(_edi_new_popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edi_message_open(const char *message)
|
||||||
|
{
|
||||||
|
Evas_Object *popup, *button;
|
||||||
|
|
||||||
|
popup = elm_popup_add(_welcome_window);
|
||||||
|
_edi_new_popup = popup;
|
||||||
|
elm_object_part_text_set(popup, "title,text",
|
||||||
|
message);
|
||||||
|
|
||||||
|
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_on_close_message, NULL);
|
||||||
|
|
||||||
|
button = elm_button_add(popup);
|
||||||
|
elm_object_text_set(button, "Delete");
|
||||||
|
elm_object_part_content_set(popup, "button2", button);
|
||||||
|
evas_object_smart_callback_add(button, "clicked",
|
||||||
|
_edi_on_delete_message, NULL);
|
||||||
|
|
||||||
|
evas_object_show(popup);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edi_welcome_project_open(const char *path, const unsigned int _edi_creating)
|
||||||
|
{
|
||||||
edi_project_set(path);
|
edi_project_set(path);
|
||||||
edi_open(edi_project_get());
|
|
||||||
|
if ((edi_open(edi_project_get()) == NULL) && !_edi_creating)
|
||||||
|
{
|
||||||
|
_edi_message_path = path;
|
||||||
|
_edi_message_open("Apparently that project directory doesn't exist");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
evas_object_del(_welcome_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -35,7 +93,7 @@ _edi_welcome_project_chosen_cb(void *data,
|
||||||
|
|
||||||
if (event_info)
|
if (event_info)
|
||||||
{
|
{
|
||||||
_edi_welcome_project_open((const char*)event_info);
|
_edi_welcome_project_open((const char*)event_info, EINA_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +101,8 @@ static void
|
||||||
_edi_welcome_choose_exit(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_edi_welcome_choose_exit(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
evas_object_del(data);
|
evas_object_del(data);
|
||||||
|
elm_object_disabled_set(_edi_open_button, EINA_FALSE);
|
||||||
|
elm_object_disabled_set(_edi_create_button, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -50,6 +110,9 @@ _edi_welcome_project_choose_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
|
||||||
{
|
{
|
||||||
Evas_Object *win, *fs;
|
Evas_Object *win, *fs;
|
||||||
|
|
||||||
|
elm_object_disabled_set(_edi_open_button, EINA_TRUE);
|
||||||
|
elm_object_disabled_set(_edi_create_button, EINA_TRUE);
|
||||||
|
|
||||||
elm_need_ethumb();
|
elm_need_ethumb();
|
||||||
elm_need_efreet();
|
elm_need_efreet();
|
||||||
|
|
||||||
|
@ -131,11 +194,23 @@ _edi_welcome_project_new_input_row_add(const char *text, const char *placeholder
|
||||||
_create_inputs[row] = input;
|
_create_inputs[row] = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_edi_welcome_project_new_create_done_cb(const char *path, Eina_Bool success)
|
||||||
|
{
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
ERR("Unable to create project at path %s", path);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_edi_welcome_project_open(path, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edi_welcome_project_new_create_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
_edi_welcome_project_new_create_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
const char *path, *name, *user, *email, *url;
|
const char *path, *name, *user, *email, *url;
|
||||||
char script[PATH_MAX], fullpath[PATH_MAX];
|
|
||||||
|
|
||||||
path = elm_fileselector_path_get(_create_inputs[0]);
|
path = elm_fileselector_path_get(_create_inputs[0]);
|
||||||
name = elm_object_text_get(_create_inputs[1]);
|
name = elm_object_text_get(_create_inputs[1]);
|
||||||
|
@ -143,19 +218,7 @@ _edi_welcome_project_new_create_cb(void *data EINA_UNUSED, Evas_Object *obj EINA
|
||||||
user = elm_object_text_get(_create_inputs[3]);
|
user = elm_object_text_get(_create_inputs[3]);
|
||||||
email = elm_object_text_get(_create_inputs[4]);
|
email = elm_object_text_get(_create_inputs[4]);
|
||||||
|
|
||||||
snprintf(script, sizeof(script), "%s/skeleton/eflprj", elm_app_data_dir_get());
|
edi_create_project(path, name, url, user, email, _edi_welcome_project_new_create_done_cb);
|
||||||
snprintf(fullpath, sizeof(fullpath), "%s/%s", path, name);
|
|
||||||
int pid = fork();
|
|
||||||
|
|
||||||
if (pid == 0)
|
|
||||||
{
|
|
||||||
printf("Creating project \"%s\" at path %s for %s<%s>\n", name, fullpath, user, email);
|
|
||||||
|
|
||||||
execlp(script, script, fullpath, name, user, email, url, NULL);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
waitpid(pid, NULL, 0);
|
|
||||||
_edi_welcome_project_open(fullpath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -206,7 +269,7 @@ static void
|
||||||
_project_list_clicked(void *data, Evas_Object *li EINA_UNUSED,
|
_project_list_clicked(void *data, Evas_Object *li EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
_edi_welcome_project_open((const char *)data);
|
_edi_welcome_project_open((const char *)data, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -219,6 +282,7 @@ _edi_welcome_add_recent_projects(Evas_Object *box)
|
||||||
int displen;
|
int displen;
|
||||||
|
|
||||||
list = elm_list_add(box);
|
list = elm_list_add(box);
|
||||||
|
_edi_welcome_list = list;
|
||||||
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
|
@ -243,7 +307,7 @@ _edi_welcome_add_recent_projects(Evas_Object *box)
|
||||||
evas_object_show(list);
|
evas_object_show(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
Evas_Object *edi_welcome_show()
|
EAPI Evas_Object *edi_welcome_show()
|
||||||
{
|
{
|
||||||
Evas_Object *win, *hbx, *box, *button, *label, *image, *naviframe;
|
Evas_Object *win, *hbx, *box, *button, *label, *image, *naviframe;
|
||||||
Elm_Object_Item *item;
|
Elm_Object_Item *item;
|
||||||
|
@ -280,15 +344,9 @@ Evas_Object *edi_welcome_show()
|
||||||
elm_box_pack_end(box, label);
|
elm_box_pack_end(box, label);
|
||||||
evas_object_show(label);
|
evas_object_show(label);
|
||||||
|
|
||||||
|
_edi_project_box = box;
|
||||||
_edi_welcome_add_recent_projects(box);
|
_edi_welcome_add_recent_projects(box);
|
||||||
|
|
||||||
button = elm_button_add(box);
|
|
||||||
elm_object_text_set(button, "Open Existing Project");
|
|
||||||
evas_object_smart_callback_add(button, "clicked",
|
|
||||||
_edi_welcome_project_choose_cb, NULL);
|
|
||||||
elm_box_pack_end(box, button);
|
|
||||||
evas_object_show(button);
|
|
||||||
|
|
||||||
/* New project area */
|
/* New project area */
|
||||||
box = elm_box_add(hbx);
|
box = elm_box_add(hbx);
|
||||||
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
@ -303,7 +361,17 @@ Evas_Object *edi_welcome_show()
|
||||||
evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_box_pack_end(box, image);
|
elm_box_pack_end(box, image);
|
||||||
evas_object_show(image);
|
evas_object_show(image);
|
||||||
|
|
||||||
button = elm_button_add(box);
|
button = elm_button_add(box);
|
||||||
|
_edi_open_button = button;
|
||||||
|
elm_object_text_set(button, "Open Existing Project");
|
||||||
|
evas_object_smart_callback_add(button, "clicked",
|
||||||
|
_edi_welcome_project_choose_cb, NULL);
|
||||||
|
elm_box_pack_end(box, button);
|
||||||
|
evas_object_show(button);
|
||||||
|
|
||||||
|
button = elm_button_add(box);
|
||||||
|
_edi_create_button = button;
|
||||||
elm_object_text_set(button, "Create New Project");
|
elm_object_text_set(button, "Create New Project");
|
||||||
evas_object_smart_callback_add(button, "clicked",
|
evas_object_smart_callback_add(button, "clicked",
|
||||||
_edi_welcome_project_new_cb, naviframe);
|
_edi_welcome_project_new_cb, naviframe);
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <edi_create.h>
|
||||||
#include <edi_builder.h>
|
#include <edi_builder.h>
|
||||||
#include <edi_path.h>
|
#include <edi_path.h>
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,15 @@ lib_LTLIBRARIES = libedi.la
|
||||||
|
|
||||||
includes_HEADERS = \
|
includes_HEADERS = \
|
||||||
edi_builder.h \
|
edi_builder.h \
|
||||||
|
edi_create.h \
|
||||||
edi_path.h \
|
edi_path.h \
|
||||||
Edi.h
|
Edi.h
|
||||||
includesdir = $(includedir)/edi-@VMAJ@
|
includesdir = $(includedir)/edi-@VMAJ@
|
||||||
|
|
||||||
libedi_la_SOURCES = \
|
libedi_la_SOURCES = \
|
||||||
edi_path.c \
|
|
||||||
edi_builder.c \
|
edi_builder.c \
|
||||||
|
edi_create.c \
|
||||||
|
edi_path.c \
|
||||||
edi.c
|
edi.c
|
||||||
libedi_la_LIBADD = @EFL_LIBS@ -lm
|
libedi_la_LIBADD = @EFL_LIBS@ -lm
|
||||||
libedi_la_LDFLAGS = -no-undefined @EFL_LTLIBRARY_FLAGS@
|
libedi_la_LDFLAGS = -no-undefined @EFL_LTLIBRARY_FLAGS@
|
||||||
|
|
|
@ -22,12 +22,13 @@ edi_init(void)
|
||||||
|
|
||||||
eina_init();
|
eina_init();
|
||||||
|
|
||||||
_edi_lib_log_dom = eina_log_domain_register("edi", EINA_COLOR_CYAN);
|
_edi_lib_log_dom = eina_log_domain_register("edi-lib", EINA_COLOR_CYAN);
|
||||||
if (_edi_lib_log_dom < 0)
|
if (_edi_lib_log_dom < 0)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Edi can not create its log domain.");
|
EINA_LOG_ERR("Edi lib cannot create its log domain.");
|
||||||
goto shutdown_eina;
|
goto shutdown_eina;
|
||||||
}
|
}
|
||||||
|
INF("Edi library loaded");
|
||||||
|
|
||||||
// Put here your initialization logic of your library
|
// Put here your initialization logic of your library
|
||||||
|
|
||||||
|
@ -52,6 +53,8 @@ edi_shutdown(void)
|
||||||
EINA_LOG_STATE_START,
|
EINA_LOG_STATE_START,
|
||||||
EINA_LOG_STATE_SHUTDOWN);
|
EINA_LOG_STATE_SHUTDOWN);
|
||||||
|
|
||||||
|
INF("Edi library shut down");
|
||||||
|
|
||||||
// Put here your shutdown logic
|
// Put here your shutdown logic
|
||||||
|
|
||||||
eina_log_domain_unregister(_edi_lib_log_dom);
|
eina_log_domain_unregister(_edi_lib_log_dom);
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Edi.h"
|
#include "Edi.h"
|
||||||
#include "edi_builder.h"
|
|
||||||
|
|
||||||
#include "edi_private.h"
|
#include "edi_private.h"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
#ifdef HAVE_CONFIG
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "Edi.h"
|
||||||
|
|
||||||
|
#include "edi_private.h"
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_edi_create_project_done(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Edi_Create *create;
|
||||||
|
|
||||||
|
create = (Edi_Create *)data;
|
||||||
|
|
||||||
|
ecore_event_handler_del(create->handler);
|
||||||
|
create->callback(create->path, EINA_TRUE);
|
||||||
|
free(create->path);
|
||||||
|
free(data);
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_DONE; // or ECORE_CALLBACK_PASS_ON
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
edi_create_project(const char *path, const char *name, const char *url,
|
||||||
|
const char *user, const char *email, Edi_Create_Cb func)
|
||||||
|
{
|
||||||
|
char script[PATH_MAX], fullpath[PATH_MAX];
|
||||||
|
char *cmd;
|
||||||
|
int cmdlen;
|
||||||
|
Edi_Create *data;
|
||||||
|
Ecore_Event_Handler *handler;
|
||||||
|
|
||||||
|
data = calloc(1, sizeof(Edi_Create));
|
||||||
|
handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _edi_create_project_done, data);
|
||||||
|
snprintf(script, sizeof(script), "%s/skeleton/eflprj", elm_app_data_dir_get()
|
||||||
|
);
|
||||||
|
snprintf(fullpath, sizeof(fullpath), "%s/%s", path, name);
|
||||||
|
|
||||||
|
data->path = strdup(fullpath);
|
||||||
|
data->callback = func;
|
||||||
|
data->handler = handler;
|
||||||
|
|
||||||
|
cmdlen = strlen(script) + 19 + strlen(path) + strlen(name) + strlen(url) + strlen(user) + strlen(email);
|
||||||
|
cmd = malloc(sizeof(char) * cmdlen);
|
||||||
|
snprintf(cmd, cmdlen, "%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
|
||||||
|
script, fullpath, name, user, email, url);
|
||||||
|
|
||||||
|
INF("Creating project \"%s\" at path %s for %s<%s>\n", name, fullpath, user, email);
|
||||||
|
ecore_exe_run(cmd, data);
|
||||||
|
free(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
#ifndef EDI_CREATE_H_
|
||||||
|
# define EDI_CREATE_H_
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief These routines are used for creating new projects.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef void (*Edi_Create_Cb)(const char *path, Eina_Bool success);
|
||||||
|
|
||||||
|
typedef struct _Edi_Create
|
||||||
|
{
|
||||||
|
char *path;
|
||||||
|
|
||||||
|
Edi_Create_Cb callback;
|
||||||
|
Ecore_Event_Handler *handler;
|
||||||
|
} Edi_Create;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Main builder management
|
||||||
|
* @defgroup Creation
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* Functions of project creation from skeletons.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new standard EFL project.
|
||||||
|
*
|
||||||
|
* @ingroup Creation
|
||||||
|
*/
|
||||||
|
EAPI void
|
||||||
|
edi_create_project(const char *path, const char *name, const char *url,
|
||||||
|
const char *user, const char *email, Edi_Create_Cb func);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* EDI_CREATE_H_ */
|
Loading…
Reference in New Issue