forked from enlightenment/enventor
library support.
current enventor apis are under beta apis. im notice you these apis could be changed soon.
This commit is contained in:
parent
1b76667733
commit
e5927b37eb
|
@ -5,6 +5,9 @@
|
||||||
*.swp
|
*.swp
|
||||||
*.eet
|
*.eet
|
||||||
*~
|
*~
|
||||||
|
.*
|
||||||
|
*.eo.*
|
||||||
|
|
||||||
enventor
|
enventor
|
||||||
enventorql
|
enventorql
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
|
24
Makefile.am
24
Makefile.am
|
@ -1,12 +1,28 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
|
MAINTAINERCLEANFILES = \
|
||||||
config.h.in config.sub configure install-sh \
|
Makefile.in \
|
||||||
depcomp libtool missing
|
aclocal.m4 \
|
||||||
|
config.guess \
|
||||||
|
config.h.in \
|
||||||
|
config.sub \
|
||||||
|
configure \
|
||||||
|
install-sh \
|
||||||
|
depcomp \
|
||||||
|
libtool \
|
||||||
|
missing
|
||||||
|
|
||||||
filesdir = $(datadir)/$(PACKAGE)/docs
|
filesdir = $(datadir)/$(PACKAGE)/docs
|
||||||
files_DATA = README
|
files_DATA = README
|
||||||
|
|
||||||
EXTRA_DIST = README AUTHORS COPYING autogen.sh
|
EXTRA_DIST = \
|
||||||
|
README \
|
||||||
|
AUTHORS \
|
||||||
|
COPYING \
|
||||||
|
autogen.sh
|
||||||
|
|
||||||
SUBDIRS = src data
|
SUBDIRS = src data
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
|
||||||
|
pkgconfig_DATA = pc/enventor.pc
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
if HAVE_EOLIAN_CXX
|
||||||
|
EOLIAN_CXX = @eolian_cxx@
|
||||||
|
_EOLIAN_CXX_DEP = @eolian_cxx@
|
||||||
|
else
|
||||||
|
EOLIAN_CXX = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/eolian_cxx/eolian_cxx${EXEEXT}
|
||||||
|
_EOLIAN_CXX_DEP = bin/eolian_cxx/eolian_cxx${EXEEXT}
|
||||||
|
endif
|
||||||
|
|
||||||
|
AM_V_EOLCXX = $(am__v_EOLCXX_@AM_V@)
|
||||||
|
am__v_EOLCXX_ = $(am__v_EOLCXX_@AM_DEFAULT_V@)
|
||||||
|
am__v_EOLCXX_0 = @echo " EOLCXX " $@;
|
||||||
|
|
||||||
|
SUFFIXES += .eo.hh
|
||||||
|
|
||||||
|
%.eo.hh: %.eo $(_EOLIAN_CXX_DEP)
|
||||||
|
$(AM_V_EOLCXX)$(EOLIAN_CXX) $(EOLIAN_FLAGS) -o $@ $<
|
||||||
|
|
||||||
|
CLEANFILES += $(BUILT_SOURCES)
|
|
@ -0,0 +1,24 @@
|
||||||
|
if HAVE_EOLIAN_GEN
|
||||||
|
EOLIAN_GEN = @eolian_gen@
|
||||||
|
_EOLIAN_GEN_DEP = @eolian_gen@
|
||||||
|
else
|
||||||
|
EOLIAN_GEN = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/eolian/eolian_gen${EXEEXT}
|
||||||
|
_EOLIAN_GEN_DEP = bin/eolian/eolian_gen${EXEEXT}
|
||||||
|
endif
|
||||||
|
|
||||||
|
AM_V_EOL = $(am__v_EOL_@AM_V@)
|
||||||
|
am__v_EOL_ = $(am__v_EOL_@AM_DEFAULT_V@)
|
||||||
|
am__v_EOL_0 = @echo " EOLIAN " $@;
|
||||||
|
|
||||||
|
SUFFIXES = .eo .eo.c .eo.h .eo.legacy.h
|
||||||
|
|
||||||
|
%.eo.c: %.eo ${_EOLIAN_GEN_DEP}
|
||||||
|
$(AM_V_EOL)$(EOLIAN_GEN) --eo --legacy $(EOLIAN_FLAGS) --gc -o $@ $<
|
||||||
|
|
||||||
|
%.eo.h: %.eo ${_EOLIAN_GEN_DEP}
|
||||||
|
$(AM_V_EOL)$(EOLIAN_GEN) --eo $(EOLIAN_FLAGS) --gh -o $@ $<
|
||||||
|
|
||||||
|
%.eo.legacy.h: %.eo ${_EOLIAN_GEN_DEP}
|
||||||
|
$(AM_V_EOL)$(EOLIAN_GEN) --legacy $(EOLIAN_FLAGS) --gh -o $@ $<
|
||||||
|
|
||||||
|
CLEANFILES += $(BUILT_SOURCES)
|
45
configure.ac
45
configure.ac
|
@ -49,22 +49,32 @@ AC_SUBST(version_info)
|
||||||
AC_SUBST(release_info)
|
AC_SUBST(release_info)
|
||||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||||
VMAJ=v_maj
|
ENVENTOR_VERSION_MAJOR=v_maj
|
||||||
AC_SUBST(VMAJ)
|
ENVENTOR_VERSION_MINOR=v_min
|
||||||
|
AC_SUBST(ENVENTOR_VERSION_MAJOR)
|
||||||
|
AC_SUBST(ENVENTOR_VERSION_MINOR)
|
||||||
|
|
||||||
|
EFL_ENABLE_EO_API_SUPPORT
|
||||||
|
EFL_ENABLE_BETA_API_SUPPORT
|
||||||
|
|
||||||
efl_version="1.9.0"
|
efl_version="1.9.0"
|
||||||
|
requirement_enventor=" \
|
||||||
|
eo >= ${efl_version} \
|
||||||
|
eina >= ${efl_version} \
|
||||||
|
eet >= ${efl_version} \
|
||||||
|
elementary >= ${efl_version} \
|
||||||
|
evas >= ${efl_version} \
|
||||||
|
ecore >= ${efl_version} \
|
||||||
|
ecore-file >= ${efl_version} \
|
||||||
|
edje >= ${efl_version} \
|
||||||
|
eio >= ${efl_version} \
|
||||||
|
efreet >= ${efl_version}"
|
||||||
|
|
||||||
|
AC_SUBST(requirement_enventor)
|
||||||
|
|
||||||
PKG_CHECK_MODULES([ENVENTOR],
|
PKG_CHECK_MODULES([ENVENTOR],
|
||||||
[
|
[
|
||||||
eina >= ${efl_version}
|
${requirement_enventor}
|
||||||
eet >= ${efl_version}
|
|
||||||
elementary >= ${efl_version}
|
|
||||||
evas >= ${efl_version}
|
|
||||||
ecore >= ${efl_version}
|
|
||||||
ecore-file >= ${efl_version}
|
|
||||||
edje >= ${efl_version}
|
|
||||||
eio >= ${efl_version}
|
|
||||||
efreet >= ${efl_version}
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -82,16 +92,28 @@ case "$host_vendor" in
|
||||||
esac
|
esac
|
||||||
AC_SUBST([lt_enable_auto_import])
|
AC_SUBST([lt_enable_auto_import])
|
||||||
|
|
||||||
|
# Needs to be moved into a macro, and also, needs a way to automatically fetch from all the dependencies using the Requires.
|
||||||
|
DEPS_EOLIAN_FLAGS=`${PKG_CONFIG} --variable=eolian_flags eo evas edje ecore elementary efl`
|
||||||
|
AC_SUBST([DEPS_EOLIAN_FLAGS])
|
||||||
|
|
||||||
EFL_ATTRIBUTE_UNUSED
|
EFL_ATTRIBUTE_UNUSED
|
||||||
|
|
||||||
# Check edje_cc
|
# Check edje_cc
|
||||||
EFL_WITH_BIN([eet], [eet-eet], [eet])
|
EFL_WITH_BIN([eet], [eet-eet], [eet])
|
||||||
EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
|
EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
|
||||||
|
EFL_WITH_BIN([eolian], [eolian-gen], [eolian_gen])
|
||||||
|
EFL_WITH_BIN([eolian-cxx], [eolian-cxx], [eolian_cxx])
|
||||||
|
|
||||||
|
# Force the helper to try external eolian generator
|
||||||
|
AM_CONDITIONAL([HAVE_EOLIAN_GEN], [true])
|
||||||
|
AM_CONDITIONAL([HAVE_EOLIAN_CXX], [true])
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/include/Makefile
|
src/include/Makefile
|
||||||
|
src/lib/Makefile
|
||||||
|
src/lib/Enventor.h
|
||||||
src/bin/Makefile
|
src/bin/Makefile
|
||||||
data/Makefile
|
data/Makefile
|
||||||
data/desktop/Makefile
|
data/desktop/Makefile
|
||||||
|
@ -104,6 +126,7 @@ data/templates/Makefile
|
||||||
data/color/Makefile
|
data/color/Makefile
|
||||||
data/sounds/Makefile
|
data/sounds/Makefile
|
||||||
data/about/Makefile
|
data/about/Makefile
|
||||||
|
pc/enventor.pc
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
|
@ -135,7 +135,7 @@ group { name: "setting_layout";
|
||||||
fixed: 0 1;
|
fixed: 0 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "data_path_frame";
|
part { name: "dat_path_frame";
|
||||||
type: SPACER;
|
type: SPACER;
|
||||||
scale: 1;
|
scale: 1;
|
||||||
description {
|
description {
|
||||||
|
@ -150,8 +150,8 @@ group { name: "setting_layout";
|
||||||
type: SPACER;
|
type: SPACER;
|
||||||
scale: 1;
|
scale: 1;
|
||||||
description {
|
description {
|
||||||
rel1 {to: "data_path_frame"; relative: 0 1; offset: 0 5;}
|
rel1 {to: "dat_path_frame"; relative: 0 1; offset: 0 5;}
|
||||||
rel2 {to: "data_path_frame"; relative: 1 1;}
|
rel2 {to: "dat_path_frame"; relative: 1 1;}
|
||||||
align: 0.5 0;
|
align: 0.5 0;
|
||||||
min: 0 140;
|
min: 0 140;
|
||||||
fixed: 0 1;
|
fixed: 0 1;
|
||||||
|
@ -301,7 +301,7 @@ group { name: "setting_layout";
|
||||||
rel2.to: "fnt_path_frame";
|
rel2.to: "fnt_path_frame";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "data_path_icon";
|
part { name: "dat_path_icon";
|
||||||
type: IMAGE;
|
type: IMAGE;
|
||||||
scale: 1;
|
scale: 1;
|
||||||
clip_to: "clipper";
|
clip_to: "clipper";
|
||||||
|
@ -310,19 +310,19 @@ group { name: "setting_layout";
|
||||||
min: 20 20;
|
min: 20 20;
|
||||||
max: 20 20;
|
max: 20 20;
|
||||||
fixed: 1 1;
|
fixed: 1 1;
|
||||||
rel1.to: "data_path_frame";
|
rel1.to: "dat_path_frame";
|
||||||
rel2.to: "data_path_frame";
|
rel2.to: "dat_path_frame";
|
||||||
image.normal: "folder.png";
|
image.normal: "folder.png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "data_path_guide";
|
part { name: "dat_path_guide";
|
||||||
type: TEXT;
|
type: TEXT;
|
||||||
effect: SHADOW BOTTOM;
|
effect: SHADOW BOTTOM;
|
||||||
scale: 1;
|
scale: 1;
|
||||||
clip_to: "clipper";
|
clip_to: "clipper";
|
||||||
description {
|
description {
|
||||||
rel1 {to: "data_path_icon"; relative: 1 0; offset: 5 1;}
|
rel1 {to: "dat_path_icon"; relative: 1 0; offset: 5 1;}
|
||||||
rel2 {to: "data_path_icon"; relative: 1 1;}
|
rel2 {to: "dat_path_icon"; relative: 1 1;}
|
||||||
color: COL_NM;
|
color: COL_NM;
|
||||||
align: 0 0.5;
|
align: 0 0.5;
|
||||||
fixed: 1 1;
|
fixed: 1 1;
|
||||||
|
@ -335,18 +335,18 @@ group { name: "setting_layout";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "elm.swallow.data_path_entry";
|
part { name: "elm.swallow.dat_path_entry";
|
||||||
type: SWALLOW;
|
type: SWALLOW;
|
||||||
scale: 1;
|
scale: 1;
|
||||||
clip_to: "clipper";
|
clip_to: "clipper";
|
||||||
description {
|
description {
|
||||||
align: 0 0;
|
align: 0 0;
|
||||||
fixed: 1 1;
|
fixed: 1 1;
|
||||||
rel1.to_x: "data_path_guide";
|
rel1.to_x: "dat_path_guide";
|
||||||
rel1.to_y: "data_path_guide";
|
rel1.to_y: "dat_path_guide";
|
||||||
rel1.offset: 14 0;
|
rel1.offset: 14 0;
|
||||||
rel1.relative: 1 0;
|
rel1.relative: 1 0;
|
||||||
rel2.to: "data_path_frame";
|
rel2.to: "dat_path_frame";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
part { name: "preference_icon";
|
part { name: "preference_icon";
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
dnl use: EFL_ENABLE_BETA_API_SUPPORT
|
||||||
|
AC_DEFUN([EFL_ENABLE_BETA_API_SUPPORT],
|
||||||
|
[
|
||||||
|
AC_DEFINE([EFL_BETA_API_SUPPORT], [1], [Enable access to unstable EFL API that are still in beta])
|
||||||
|
])
|
|
@ -0,0 +1,6 @@
|
||||||
|
dnl use: EFL_ENABLE_EO_API_SUPPORT
|
||||||
|
AC_DEFUN([EFL_ENABLE_EO_API_SUPPORT],
|
||||||
|
[
|
||||||
|
AC_DEFINE([EFL_EO_API_SUPPORT], [1], [Enable access to unstable EFL Eo API])
|
||||||
|
])
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: enventor
|
||||||
|
Description: dynamic edc editor to write your layout fast and easy.
|
||||||
|
Requires.private:@requirement_enventor@
|
||||||
|
Version: @VERSION@
|
||||||
|
Libs: -L${libdir} -lenventor
|
||||||
|
Cflags: -I${includedir}/enventor-@ENVENTOR_VERSION_MAJOR@
|
|
@ -1,3 +1,3 @@
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
SUBDIRS = bin include
|
SUBDIRS = lib bin include
|
||||||
|
|
|
@ -12,33 +12,26 @@ AM_CPPFLAGS = -DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" \
|
||||||
enventor_SOURCES = \
|
enventor_SOURCES = \
|
||||||
base_gui.c \
|
base_gui.c \
|
||||||
config_data.c \
|
config_data.c \
|
||||||
dummy_obj.c \
|
|
||||||
edc_editor.c \
|
|
||||||
edc_parser.c \
|
|
||||||
edj_viewer.c \
|
|
||||||
main.c \
|
main.c \
|
||||||
menu.c \
|
menu.c \
|
||||||
panes.c \
|
panes.c \
|
||||||
statusbar.c \
|
statusbar.c \
|
||||||
syntax_color.c \
|
|
||||||
ctxpopup.c \
|
|
||||||
syntax_helper.c \
|
|
||||||
indent.c \
|
|
||||||
edj_mgr.c \
|
|
||||||
build.c \
|
|
||||||
tools.c \
|
tools.c \
|
||||||
search.c \
|
search.c \
|
||||||
goto.c \
|
goto.c \
|
||||||
newfile.c \
|
newfile.c \
|
||||||
auto_comp.c \
|
|
||||||
setting.c \
|
setting.c \
|
||||||
globals.c \
|
globals.c \
|
||||||
redoundo.c \
|
|
||||||
template.c \
|
|
||||||
live_edit.c \
|
live_edit.c \
|
||||||
console.c
|
console.c
|
||||||
|
|
||||||
enventor_LDADD = @ENVENTOR_LIBS@
|
enventor_LDADD = \
|
||||||
|
$(top_builddir)/src/lib/libenventor.la \
|
||||||
|
@ENVENTOR_LIBS@
|
||||||
enventor_LDFLAGS = $(LTLIBINTL)
|
enventor_LDFLAGS = $(LTLIBINTL)
|
||||||
|
|
||||||
|
enventor_CFLAGS = \
|
||||||
|
-I$(top_builddir)/src/lib \
|
||||||
|
@ENVENTOR_CFLAGS@
|
||||||
|
|
||||||
EXTRA_DIST =
|
EXTRA_DIST =
|
||||||
|
|
|
@ -10,6 +10,10 @@ typedef struct base_s
|
||||||
|
|
||||||
static base_data *g_bd = NULL;
|
static base_data *g_bd = NULL;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
win_delete_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
win_delete_request_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
|
@ -24,6 +28,19 @@ win_focused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
goto_close();
|
goto_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
base_error_msg_set(const char *msg)
|
||||||
|
{
|
||||||
|
base_data *bd = g_bd;
|
||||||
|
if (panes_editors_full_view_get()) base_editors_full_view();
|
||||||
|
elm_object_signal_emit(bd->layout, "elm,state,alert,show", "");
|
||||||
|
console_text_set(bd->console, msg);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
base_title_set(const char *path)
|
base_title_set(const char *path)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +115,7 @@ base_live_view_full_view(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
base_text_editor_full_view(void)
|
base_enventor_full_view(void)
|
||||||
{
|
{
|
||||||
panes_text_editor_full_view();
|
panes_text_editor_full_view();
|
||||||
}
|
}
|
||||||
|
@ -115,12 +132,6 @@ base_console_full_view(void)
|
||||||
panes_console_full_view();
|
panes_console_full_view();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
base_text_editor_set(Evas_Object *text_editor)
|
|
||||||
{
|
|
||||||
panes_text_editor_set(text_editor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
base_live_view_set(Evas_Object *live_view)
|
base_live_view_set(Evas_Object *live_view)
|
||||||
{
|
{
|
||||||
|
@ -142,15 +153,6 @@ base_gui_term(void)
|
||||||
free(bd);
|
free(bd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
err_noti_cb(void *data, const char *msg)
|
|
||||||
{
|
|
||||||
base_data *bd = data;
|
|
||||||
if (panes_editors_full_view_get()) base_editors_full_view();
|
|
||||||
elm_object_signal_emit(bd->layout, "elm,state,alert,show", "");
|
|
||||||
console_text_set(bd->console, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
base_console_reset(void)
|
base_console_reset(void)
|
||||||
{
|
{
|
||||||
|
@ -200,8 +202,6 @@ base_gui_init(void)
|
||||||
Evas_Object *console = console_create(panes);
|
Evas_Object *console = console_create(panes);
|
||||||
panes_console_set(console);
|
panes_console_set(console);
|
||||||
|
|
||||||
build_err_noti_cb_set(err_noti_cb, bd);
|
|
||||||
|
|
||||||
bd->win = win;
|
bd->win = win;
|
||||||
bd->layout = layout;
|
bd->layout = layout;
|
||||||
bd->console = console;
|
bd->console = console;
|
||||||
|
@ -214,3 +214,9 @@ base_gui_show(void)
|
||||||
{
|
{
|
||||||
evas_object_show(g_bd->win);
|
evas_object_show(g_bd->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
base_enventor_set(Evas_Object *enventor)
|
||||||
|
{
|
||||||
|
panes_text_editor_set(enventor);
|
||||||
|
}
|
||||||
|
|
130
src/bin/build.c
130
src/bin/build.c
|
@ -1,130 +0,0 @@
|
||||||
#include <Elementary.h>
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
typedef struct builder_s
|
|
||||||
{
|
|
||||||
Eina_Strbuf *strbuf;
|
|
||||||
char *build_cmd;
|
|
||||||
void (*noti_cb)(void *data, const char *msg);
|
|
||||||
void *noti_data;
|
|
||||||
Ecore_Event_Handler *event_data_handler;
|
|
||||||
Ecore_Event_Handler *event_err_handler;
|
|
||||||
|
|
||||||
} build_data;
|
|
||||||
|
|
||||||
static build_data *g_bd = NULL;
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
exe_event_error_cb(void *data, int type EINA_UNUSED, void *event_info)
|
|
||||||
{
|
|
||||||
build_data *bd = data;
|
|
||||||
Ecore_Exe_Event_Data *ev = event_info;
|
|
||||||
Ecore_Exe_Event_Data_Line *el;
|
|
||||||
|
|
||||||
eina_strbuf_reset(bd->strbuf);
|
|
||||||
|
|
||||||
for (el = ev->lines; el && el->line; el++)
|
|
||||||
{
|
|
||||||
eina_strbuf_append(bd->strbuf, el->line);
|
|
||||||
eina_strbuf_append_char(bd->strbuf, '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
bd->noti_cb(bd->noti_data, eina_strbuf_string_get(bd->strbuf));
|
|
||||||
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
build_cmd_set(void)
|
|
||||||
{
|
|
||||||
build_data *bd = g_bd;
|
|
||||||
|
|
||||||
free(bd->build_cmd);
|
|
||||||
bd->build_cmd = NULL;
|
|
||||||
|
|
||||||
Eina_Strbuf *strbuf = eina_strbuf_new();
|
|
||||||
if (!strbuf)
|
|
||||||
{
|
|
||||||
EINA_LOG_ERR("Failed to new strbuf");
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
eina_strbuf_append_printf(strbuf,
|
|
||||||
"edje_cc -fastcomp %s %s -id %s/images -sd %s/sounds -fd %s/fonts -dd %s/data %s %s %s %s",
|
|
||||||
config_edc_path_get(),
|
|
||||||
config_edj_path_get(),
|
|
||||||
elm_app_data_dir_get(),
|
|
||||||
elm_app_data_dir_get(),
|
|
||||||
elm_app_data_dir_get(),
|
|
||||||
elm_app_data_dir_get(),
|
|
||||||
config_edc_img_path_get(),
|
|
||||||
config_edc_snd_path_get(),
|
|
||||||
config_edc_fnt_path_get(),
|
|
||||||
config_edc_data_path_get());
|
|
||||||
|
|
||||||
bd->build_cmd = eina_strbuf_string_steal(strbuf);
|
|
||||||
eina_strbuf_free(strbuf);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
build_edc(void)
|
|
||||||
{
|
|
||||||
build_data *bd = g_bd;
|
|
||||||
if (!bd->build_cmd)
|
|
||||||
{
|
|
||||||
EINA_LOG_ERR("Build Command is not set!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Ecore_Exe_Flags flags =
|
|
||||||
(ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ |
|
|
||||||
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR);
|
|
||||||
ecore_exe_pipe_run(bd->build_cmd, flags, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
build_init(void)
|
|
||||||
{
|
|
||||||
build_data *bd = g_bd;
|
|
||||||
if (bd) return EINA_TRUE;
|
|
||||||
|
|
||||||
bd = calloc(1, sizeof(build_data));
|
|
||||||
if (!bd)
|
|
||||||
{
|
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
g_bd = bd;
|
|
||||||
|
|
||||||
Eina_Bool ret = build_cmd_set();
|
|
||||||
|
|
||||||
bd->event_data_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DATA,
|
|
||||||
exe_event_error_cb, bd);
|
|
||||||
bd->event_err_handler = ecore_event_handler_add(ECORE_EXE_EVENT_ERROR,
|
|
||||||
exe_event_error_cb, bd);
|
|
||||||
|
|
||||||
bd->strbuf = eina_strbuf_new();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
build_term(void)
|
|
||||||
{
|
|
||||||
build_data *bd = g_bd;
|
|
||||||
ecore_event_handler_del(bd->event_data_handler);
|
|
||||||
ecore_event_handler_del(bd->event_err_handler);
|
|
||||||
eina_strbuf_free(bd->strbuf);
|
|
||||||
free(bd->build_cmd);
|
|
||||||
free(bd);
|
|
||||||
g_bd = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
build_err_noti_cb_set(void (*cb)(void *data, const char *msg), void *data)
|
|
||||||
{
|
|
||||||
build_data *bd = g_bd;
|
|
||||||
bd->noti_cb = cb;
|
|
||||||
bd->noti_data = data;
|
|
||||||
}
|
|
|
@ -9,13 +9,13 @@ typedef struct config_s
|
||||||
Eina_List *edc_img_path_list;
|
Eina_List *edc_img_path_list;
|
||||||
Eina_List *edc_snd_path_list;
|
Eina_List *edc_snd_path_list;
|
||||||
Eina_List *edc_fnt_path_list;
|
Eina_List *edc_fnt_path_list;
|
||||||
Eina_List *edc_data_path_list;
|
Eina_List *edc_dat_path_list;
|
||||||
Eina_Strbuf *edc_img_path_buf; //pre-stored image paths for edc compile.
|
Eina_Strbuf *edc_img_path_buf; //pre-stored image paths for edc compile.
|
||||||
Eina_Strbuf *edc_snd_path_buf; //pre-stored sound paths for edc compile.
|
Eina_Strbuf *edc_snd_path_buf; //pre-stored sound paths for edc compile.
|
||||||
Eina_Strbuf *edc_fnt_path_buf; //pre-stored font paths for edc compile.
|
Eina_Strbuf *edc_fnt_path_buf; //pre-stored font paths for edc compile.
|
||||||
Eina_Strbuf *edc_data_path_buf; //pre-stored data paths for edc compile.
|
Eina_Strbuf *edc_dat_path_buf; //pre-stored data paths for edc compile.
|
||||||
|
|
||||||
float font_size;
|
float font_scale;
|
||||||
double view_scale;
|
double view_scale;
|
||||||
double console_size;
|
double console_size;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ config_load(void)
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cd->font_size = 1.0f;
|
cd->font_scale = 1.0f;
|
||||||
cd->view_scale = 1;
|
cd->view_scale = 1;
|
||||||
cd->console_size = 0.175;
|
cd->console_size = 0.175;
|
||||||
cd->stats_bar = EINA_TRUE;
|
cd->stats_bar = EINA_TRUE;
|
||||||
|
@ -166,13 +166,13 @@ config_load(void)
|
||||||
else cd->edc_fnt_path_buf =
|
else cd->edc_fnt_path_buf =
|
||||||
config_paths_buf_set(cd->edc_fnt_path_list, " -fd ");
|
config_paths_buf_set(cd->edc_fnt_path_list, " -fd ");
|
||||||
|
|
||||||
if (!cd->edc_data_path_list)
|
if (!cd->edc_dat_path_list)
|
||||||
{
|
{
|
||||||
sprintf(buf, "%s/data", elm_app_data_dir_get());
|
sprintf(buf, "%s/data", elm_app_data_dir_get());
|
||||||
config_edc_data_path_set(buf);
|
config_edc_dat_path_set(buf);
|
||||||
}
|
}
|
||||||
else cd->edc_data_path_buf =
|
else cd->edc_dat_path_buf =
|
||||||
config_paths_buf_set(cd->edc_data_path_list, " -dd ");
|
config_paths_buf_set(cd->edc_dat_path_list, " -dd ");
|
||||||
|
|
||||||
return cd;
|
return cd;
|
||||||
}
|
}
|
||||||
|
@ -192,9 +192,8 @@ eddc_init(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
|
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
|
||||||
"edc_fnt_path_list", edc_fnt_path_list);
|
"edc_fnt_path_list", edc_fnt_path_list);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
|
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(edd_base, config_data,
|
||||||
"edc_data_path_list",
|
"edc_dat_path_list", edc_dat_path_list);
|
||||||
edc_data_path_list);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "font_scale", font_scale,
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "font_size", font_size,
|
|
||||||
EET_T_FLOAT);
|
EET_T_FLOAT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "view_scale",
|
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_base, config_data, "view_scale",
|
||||||
view_scale, EET_T_DOUBLE);
|
view_scale, EET_T_DOUBLE);
|
||||||
|
@ -227,7 +226,7 @@ config_edc_path_set(const char *edc_path)
|
||||||
void
|
void
|
||||||
config_init(const char *edc_path, const char *edc_img_path,
|
config_init(const char *edc_path, const char *edc_img_path,
|
||||||
const char *edc_snd_path, const char *edc_fnt_path,
|
const char *edc_snd_path, const char *edc_fnt_path,
|
||||||
const char *edc_data_path)
|
const char *edc_dat_path)
|
||||||
{
|
{
|
||||||
eddc_init();
|
eddc_init();
|
||||||
|
|
||||||
|
@ -238,7 +237,7 @@ config_init(const char *edc_path, const char *edc_img_path,
|
||||||
if (edc_img_path[0]) config_edc_img_path_set(edc_img_path);
|
if (edc_img_path[0]) config_edc_img_path_set(edc_img_path);
|
||||||
if (edc_snd_path[0]) config_edc_snd_path_set(edc_snd_path);
|
if (edc_snd_path[0]) config_edc_snd_path_set(edc_snd_path);
|
||||||
if (edc_fnt_path[0]) config_edc_fnt_path_set(edc_fnt_path);
|
if (edc_fnt_path[0]) config_edc_fnt_path_set(edc_fnt_path);
|
||||||
if (edc_data_path[0]) config_edc_data_path_set(edc_data_path);
|
if (edc_dat_path[0]) config_edc_dat_path_set(edc_dat_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -255,12 +254,12 @@ config_term(void)
|
||||||
EINA_LIST_FREE(cd->edc_img_path_list, str) eina_stringshare_del(str);
|
EINA_LIST_FREE(cd->edc_img_path_list, str) eina_stringshare_del(str);
|
||||||
EINA_LIST_FREE(cd->edc_snd_path_list, str) eina_stringshare_del(str);
|
EINA_LIST_FREE(cd->edc_snd_path_list, str) eina_stringshare_del(str);
|
||||||
EINA_LIST_FREE(cd->edc_fnt_path_list, str) eina_stringshare_del(str);
|
EINA_LIST_FREE(cd->edc_fnt_path_list, str) eina_stringshare_del(str);
|
||||||
EINA_LIST_FREE(cd->edc_data_path_list, str) eina_stringshare_del(str);
|
EINA_LIST_FREE(cd->edc_dat_path_list, str) eina_stringshare_del(str);
|
||||||
|
|
||||||
if (cd->edc_img_path_buf) eina_strbuf_free(cd->edc_img_path_buf);
|
if (cd->edc_img_path_buf) eina_strbuf_free(cd->edc_img_path_buf);
|
||||||
if (cd->edc_snd_path_buf) eina_strbuf_free(cd->edc_snd_path_buf);
|
if (cd->edc_snd_path_buf) eina_strbuf_free(cd->edc_snd_path_buf);
|
||||||
if (cd->edc_fnt_path_buf) eina_strbuf_free(cd->edc_fnt_path_buf);
|
if (cd->edc_fnt_path_buf) eina_strbuf_free(cd->edc_fnt_path_buf);
|
||||||
if (cd->edc_data_path_buf) eina_strbuf_free(cd->edc_data_path_buf);
|
if (cd->edc_dat_path_buf) eina_strbuf_free(cd->edc_dat_path_buf);
|
||||||
|
|
||||||
eet_data_descriptor_free(edd_base);
|
eet_data_descriptor_free(edd_base);
|
||||||
free(cd);
|
free(cd);
|
||||||
|
@ -309,44 +308,44 @@ config_edc_snd_path_set(const char *edc_snd_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
config_edc_data_path_set(const char *edc_data_path)
|
config_edc_dat_path_set(const char *edc_dat_path)
|
||||||
{
|
{
|
||||||
config_data *cd = g_cd;
|
config_data *cd = g_cd;
|
||||||
|
|
||||||
//Free the existing paths
|
//Free the existing paths
|
||||||
const char *s;
|
const char *s;
|
||||||
EINA_LIST_FREE(cd->edc_data_path_list, s) eina_stringshare_del(s);
|
EINA_LIST_FREE(cd->edc_dat_path_list, s) eina_stringshare_del(s);
|
||||||
|
|
||||||
if (cd->edc_data_path_buf) eina_strbuf_free(cd->edc_data_path_buf);
|
if (cd->edc_dat_path_buf) eina_strbuf_free(cd->edc_dat_path_buf);
|
||||||
cd->edc_data_path_buf = eina_strbuf_new();
|
cd->edc_dat_path_buf = eina_strbuf_new();
|
||||||
|
|
||||||
//parse paths by ';'
|
//parse paths by ';'
|
||||||
const char *lex;
|
const char *lex;
|
||||||
Eina_Stringshare *append;
|
Eina_Stringshare *append;
|
||||||
|
|
||||||
while(edc_data_path && (strlen(edc_data_path) > 0))
|
while(edc_dat_path && (strlen(edc_dat_path) > 0))
|
||||||
{
|
{
|
||||||
lex = strstr(edc_data_path, ";");
|
lex = strstr(edc_dat_path, ";");
|
||||||
if (lex)
|
if (lex)
|
||||||
{
|
{
|
||||||
append = eina_stringshare_add_length(edc_data_path,
|
append = eina_stringshare_add_length(edc_dat_path,
|
||||||
(lex - edc_data_path));
|
(lex - edc_dat_path));
|
||||||
cd->edc_data_path_list = eina_list_append(cd->edc_data_path_list,
|
cd->edc_dat_path_list = eina_list_append(cd->edc_dat_path_list,
|
||||||
append);
|
append);
|
||||||
eina_strbuf_append(cd->edc_data_path_buf, " -fd ");
|
eina_strbuf_append(cd->edc_dat_path_buf, " -dd ");
|
||||||
eina_strbuf_append(cd->edc_data_path_buf, append);
|
eina_strbuf_append(cd->edc_dat_path_buf, append);
|
||||||
lex++;
|
lex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
append = eina_stringshare_add(edc_data_path);
|
append = eina_stringshare_add(edc_dat_path);
|
||||||
cd->edc_data_path_list = eina_list_append(cd->edc_data_path_list,
|
cd->edc_dat_path_list = eina_list_append(cd->edc_dat_path_list,
|
||||||
append);
|
append);
|
||||||
eina_strbuf_append(cd->edc_data_path_buf, " -fd ");
|
eina_strbuf_append(cd->edc_dat_path_buf, " -dd ");
|
||||||
eina_strbuf_append(cd->edc_data_path_buf, append);
|
eina_strbuf_append(cd->edc_dat_path_buf, append);
|
||||||
}
|
}
|
||||||
|
|
||||||
edc_data_path = lex;
|
edc_dat_path = lex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,10 +455,10 @@ config_edc_snd_path_list_get(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_List *
|
Eina_List *
|
||||||
config_edc_data_path_list_get(void)
|
config_edc_dat_path_list_get(void)
|
||||||
{
|
{
|
||||||
config_data *cd = g_cd;
|
config_data *cd = g_cd;
|
||||||
return cd->edc_data_path_list;
|
return cd->edc_dat_path_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_List *
|
Eina_List *
|
||||||
|
@ -486,11 +485,11 @@ config_edc_snd_path_get(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
config_edc_data_path_get(void)
|
config_edc_dat_path_get(void)
|
||||||
{
|
{
|
||||||
config_data *cd = g_cd;
|
config_data *cd = g_cd;
|
||||||
if (!cd->edc_data_path_buf) return NULL;
|
if (!cd->edc_dat_path_buf) return NULL;
|
||||||
return eina_strbuf_string_get(cd->edc_data_path_buf);
|
return eina_strbuf_string_get(cd->edc_dat_path_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@ -594,23 +593,23 @@ config_auto_complete_get(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
config_font_size_set(float font_size)
|
config_font_scale_set(float font_scale)
|
||||||
{
|
{
|
||||||
config_data *cd = g_cd;
|
config_data *cd = g_cd;
|
||||||
|
|
||||||
if (font_size > MAX_FONT_SIZE)
|
if (font_scale > MAX_FONT_SCALE)
|
||||||
font_size = MAX_FONT_SIZE;
|
font_scale = MAX_FONT_SCALE;
|
||||||
else if (font_size < MIN_FONT_SIZE)
|
else if (font_scale < MIN_FONT_SCALE)
|
||||||
font_size = MIN_FONT_SIZE;
|
font_scale = MIN_FONT_SCALE;
|
||||||
|
|
||||||
cd->font_size = font_size;
|
cd->font_scale = font_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
config_font_size_get(void)
|
config_font_scale_get(void)
|
||||||
{
|
{
|
||||||
config_data *cd = g_cd;
|
config_data *cd = g_cd;
|
||||||
return cd->font_size;
|
return cd->font_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
typedef struct goto_s
|
typedef struct goto_s
|
||||||
|
@ -7,7 +13,7 @@ typedef struct goto_s
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
Evas_Object *entry;
|
Evas_Object *entry;
|
||||||
Evas_Object *btn;
|
Evas_Object *btn;
|
||||||
edit_data *ed;
|
Evas_Object *enventor;
|
||||||
} goto_data;
|
} goto_data;
|
||||||
|
|
||||||
static goto_data *g_gd = NULL;
|
static goto_data *g_gd = NULL;
|
||||||
|
@ -38,7 +44,7 @@ goto_line(goto_data *gd)
|
||||||
{
|
{
|
||||||
const char *txt = elm_entry_entry_get(gd->entry);
|
const char *txt = elm_entry_entry_get(gd->entry);
|
||||||
int line = atoi(txt);
|
int line = atoi(txt);
|
||||||
edit_goto(gd->ed, line);
|
enventor_object_line_goto(gd->enventor, line);
|
||||||
goto_close();
|
goto_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +66,7 @@ entry_changed_cb(void *data, Evas_Object *obj, void* event_info EINA_UNUSED)
|
||||||
|
|
||||||
int line = atoi(txt);
|
int line = atoi(txt);
|
||||||
|
|
||||||
if ((line < 1) || (line > edit_max_line_get(gd->ed)))
|
if ((line < 1) || (line > enventor_object_max_line_get(gd->enventor)))
|
||||||
{
|
{
|
||||||
elm_object_part_text_set(gd->layout, "elm.text.msg",
|
elm_object_part_text_set(gd->layout, "elm.text.msg",
|
||||||
"Invalid line number");
|
"Invalid line number");
|
||||||
|
@ -82,7 +88,7 @@ btn_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
goto_open(edit_data *ed)
|
goto_open(Evas_Object *enventor)
|
||||||
{
|
{
|
||||||
static Elm_Entry_Filter_Accept_Set digits_filter_data;
|
static Elm_Entry_Filter_Accept_Set digits_filter_data;
|
||||||
goto_data *gd = g_gd;
|
goto_data *gd = g_gd;
|
||||||
|
@ -130,7 +136,7 @@ goto_open(edit_data *ed)
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
snprintf(buf, sizeof(buf), "Enter line number [1..%d]:",
|
snprintf(buf, sizeof(buf), "Enter line number [1..%d]:",
|
||||||
edit_max_line_get(ed));
|
enventor_object_max_line_get(enventor));
|
||||||
elm_object_part_text_set(layout, "elm.text.goto", buf);
|
elm_object_part_text_set(layout, "elm.text.goto", buf);
|
||||||
|
|
||||||
//Entry (line)
|
//Entry (line)
|
||||||
|
@ -157,14 +163,13 @@ goto_open(edit_data *ed)
|
||||||
evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb, gd);
|
evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb, gd);
|
||||||
elm_object_part_content_set(layout, "elm.swallow.btn",
|
elm_object_part_content_set(layout, "elm.swallow.btn",
|
||||||
btn);
|
btn);
|
||||||
|
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
|
|
||||||
gd->win = win;
|
gd->win = win;
|
||||||
gd->layout = layout;
|
gd->layout = layout;
|
||||||
gd->entry = entry;
|
gd->entry = entry;
|
||||||
gd->btn = btn;
|
gd->btn = btn;
|
||||||
gd->ed = ed;
|
gd->enventor = enventor;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
#include <Elementary_Cursor.h>
|
#include <Elementary_Cursor.h>
|
||||||
#include <Elementary.h>
|
#include <Enventor.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
typedef struct menu_data_s
|
typedef struct menu_data_s
|
||||||
|
@ -19,7 +25,7 @@ typedef struct live_editor_s
|
||||||
{
|
{
|
||||||
Evas_Object *menu;
|
Evas_Object *menu;
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
edit_data *ed;
|
Evas_Object *enventor;
|
||||||
cur_part_data *cur_part_data;
|
cur_part_data *cur_part_data;
|
||||||
|
|
||||||
Ecore_Event_Handler *key_down_handler;
|
Ecore_Event_Handler *key_down_handler;
|
||||||
|
@ -193,6 +199,7 @@ key_down_cb(void *data, int type EINA_UNUSED, void *ev)
|
||||||
|
|
||||||
if (!strcmp(event->key, "Return"))
|
if (!strcmp(event->key, "Return"))
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
template_part_insert(ld->ed,
|
template_part_insert(ld->ed,
|
||||||
MENU_ITEMS[ld->cur_part_data->type].type,
|
MENU_ITEMS[ld->cur_part_data->type].type,
|
||||||
TEMPLATE_INSERT_LIVE_EDIT,
|
TEMPLATE_INSERT_LIVE_EDIT,
|
||||||
|
@ -201,6 +208,7 @@ key_down_cb(void *data, int type EINA_UNUSED, void *ev)
|
||||||
ld->cur_part_data->rel2_x,
|
ld->cur_part_data->rel2_x,
|
||||||
ld->cur_part_data->rel2_y,
|
ld->cur_part_data->rel2_y,
|
||||||
view_group_name_get(VIEW_DATA));
|
view_group_name_get(VIEW_DATA));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (strcmp(event->key, "Delete")) return EINA_TRUE;
|
else if (strcmp(event->key, "Delete")) return EINA_TRUE;
|
||||||
|
|
||||||
|
@ -300,7 +308,7 @@ live_edit_toggle(void)
|
||||||
{
|
{
|
||||||
live_data *ld = g_ld;
|
live_data *ld = g_ld;
|
||||||
Eina_Bool on = !config_live_edit_get();
|
Eina_Bool on = !config_live_edit_get();
|
||||||
|
#if 0
|
||||||
Evas_Object *event_obj = view_obj_get(VIEW_DATA);
|
Evas_Object *event_obj = view_obj_get(VIEW_DATA);
|
||||||
if (!event_obj) return;
|
if (!event_obj) return;
|
||||||
|
|
||||||
|
@ -315,8 +323,10 @@ live_edit_toggle(void)
|
||||||
layout_mouse_up_cb);
|
layout_mouse_up_cb);
|
||||||
live_edit_reset(ld);
|
live_edit_reset(ld);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
edit_disabled_set(ld->ed, on);
|
#if 0
|
||||||
|
enventor_object_disabled_set(ld->enventor, on);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (on) stats_info_msg_update("Live View Edit Mode Enabled.");
|
if (on) stats_info_msg_update("Live View Edit Mode Enabled.");
|
||||||
else stats_info_msg_update("Live View Edit Mode Disabled.");
|
else stats_info_msg_update("Live View Edit Mode Disabled.");
|
||||||
|
@ -332,7 +342,7 @@ live_edit_cancel(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
live_edit_init(edit_data *ed)
|
live_edit_init(Evas_Object *enventor)
|
||||||
{
|
{
|
||||||
live_data *ld = calloc(1, sizeof(live_data));
|
live_data *ld = calloc(1, sizeof(live_data));
|
||||||
if (!ld)
|
if (!ld)
|
||||||
|
@ -349,7 +359,7 @@ live_edit_init(edit_data *ed)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ld->ed = ed;
|
ld->enventor = enventor;
|
||||||
|
|
||||||
ld->menu = NULL;
|
ld->menu = NULL;
|
||||||
ld->layout = NULL;
|
ld->layout = NULL;
|
||||||
|
|
858
src/bin/main.c
858
src/bin/main.c
File diff suppressed because it is too large
Load Diff
|
@ -10,12 +10,12 @@ struct menu_s
|
||||||
Evas_Object *about_layout;
|
Evas_Object *about_layout;
|
||||||
|
|
||||||
Evas_Object *ctxpopup;
|
Evas_Object *ctxpopup;
|
||||||
|
Evas_Object *enventor;
|
||||||
|
|
||||||
const char *last_accessed_path;
|
const char *last_accessed_path;
|
||||||
|
|
||||||
int active_request;
|
int active_request;
|
||||||
|
|
||||||
edit_data *ed;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct menu_s menu_data;
|
typedef struct menu_s menu_data;
|
||||||
|
@ -121,7 +121,7 @@ newfile_ok_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
menu_data *md = data;
|
menu_data *md = data;
|
||||||
newfile_set(md->ed);
|
newfile_set(md->enventor);
|
||||||
newfile_close(md);
|
newfile_close(md);
|
||||||
menu_close(md);
|
menu_close(md);
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ exit_save_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
menu_data *md = data;
|
menu_data *md = data;
|
||||||
edit_save(md->ed);
|
enventor_object_save(md->enventor, config_edc_path_get());
|
||||||
elm_exit();
|
elm_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ prev_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
menu_data *md = data;
|
menu_data *md = data;
|
||||||
edit_focus_set(md->ed);
|
enventor_object_focus_set(md->enventor, EINA_TRUE);
|
||||||
menu_toggle();
|
menu_toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,8 +356,7 @@ new_save_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
menu_data *md = data;
|
menu_data *md = data;
|
||||||
|
enventor_object_save(md->enventor, config_edc_path_get());
|
||||||
edit_save(md->ed);
|
|
||||||
newfile_open(md);
|
newfile_open(md);
|
||||||
warning_close(md);
|
warning_close(md);
|
||||||
menu_close(md);
|
menu_close(md);
|
||||||
|
@ -417,22 +416,22 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
|
||||||
//Update the edc file and try to save.
|
//Update the edc file and try to save.
|
||||||
if (strcmp(config_edc_path_get(), selected))
|
if (strcmp(config_edc_path_get(), selected))
|
||||||
edit_changed_set(md->ed, EINA_TRUE);
|
enventor_object_modified_set(md->enventor, EINA_TRUE);
|
||||||
|
|
||||||
config_edc_path_set(selected);
|
config_edc_path_set(selected);
|
||||||
|
|
||||||
if (!edit_save(md->ed))
|
if (!enventor_object_save(md->enventor, selected))
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
snprintf(buf, sizeof(buf), "Failed to load: %s.", selected);
|
snprintf(buf, sizeof(buf), "Failed to save: %s.", selected);
|
||||||
elm_object_part_text_set(md->fileselector_layout,
|
elm_object_part_text_set(md->fileselector_layout,
|
||||||
"elm.text.msg", buf);
|
"elm.text.msg", buf);
|
||||||
elm_object_signal_emit(md->fileselector_layout,
|
elm_object_signal_emit(md->fileselector_layout,
|
||||||
"elm,action,msg,show", "");
|
"elm,action,msg,show", "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
edj_mgr_reload_need_set(EINA_TRUE);
|
edj_mgr_reload_need_set(EINA_TRUE);
|
||||||
|
#endif
|
||||||
config_apply();
|
config_apply();
|
||||||
|
|
||||||
base_title_set(selected);
|
base_title_set(selected);
|
||||||
|
@ -495,7 +494,8 @@ fileselector_load_done_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
"elm,action,msg,show", "");
|
"elm,action,msg,show", "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
edit_edc_reload(md->ed, selected);
|
enventor_object_file_set(md->enventor, selected);
|
||||||
|
base_title_set(selected);
|
||||||
fileselector_close(md);
|
fileselector_close(md);
|
||||||
menu_close(md);
|
menu_close(md);
|
||||||
}
|
}
|
||||||
|
@ -586,7 +586,7 @@ load_save_btn_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
menu_data *md = data;
|
menu_data *md = data;
|
||||||
edit_save(md->ed);
|
enventor_object_save(md->enventor);
|
||||||
edc_file_load(md);
|
edc_file_load(md);
|
||||||
warning_close(md);
|
warning_close(md);
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ ctxpopup_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
menu_init(edit_data *ed)
|
menu_init(Evas_Object *enventor)
|
||||||
{
|
{
|
||||||
menu_data *md = calloc(1, sizeof(menu_data));
|
menu_data *md = calloc(1, sizeof(menu_data));
|
||||||
if (!md)
|
if (!md)
|
||||||
|
@ -668,7 +668,7 @@ menu_init(edit_data *ed)
|
||||||
}
|
}
|
||||||
g_md = md;
|
g_md = md;
|
||||||
|
|
||||||
md->ed = ed;
|
md->enventor = enventor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -695,7 +695,7 @@ void
|
||||||
menu_edc_new(void)
|
menu_edc_new(void)
|
||||||
{
|
{
|
||||||
menu_data *md = g_md;
|
menu_data *md = g_md;
|
||||||
if (edit_changed_get(md->ed))
|
if (enventor_object_modified_get(md->enventor))
|
||||||
warning_open(md, new_yes_btn_cb, new_save_btn_cb);
|
warning_open(md, new_yes_btn_cb, new_save_btn_cb);
|
||||||
else
|
else
|
||||||
newfile_open(md);
|
newfile_open(md);
|
||||||
|
@ -712,7 +712,7 @@ void
|
||||||
menu_edc_load(void)
|
menu_edc_load(void)
|
||||||
{
|
{
|
||||||
menu_data *md = g_md;
|
menu_data *md = g_md;
|
||||||
if (edit_changed_get(md->ed))
|
if (enventor_object_modified_get(md->enventor))
|
||||||
warning_open(md, load_yes_btn_cb, load_save_btn_cb);
|
warning_open(md, load_yes_btn_cb, load_save_btn_cb);
|
||||||
else
|
else
|
||||||
edc_file_load(md);
|
edc_file_load(md);
|
||||||
|
@ -792,7 +792,7 @@ void
|
||||||
menu_exit(void)
|
menu_exit(void)
|
||||||
{
|
{
|
||||||
menu_data *md = g_md;
|
menu_data *md = g_md;
|
||||||
if (edit_changed_get(md->ed))
|
if (enventor_object_modified_get(md->enventor))
|
||||||
{
|
{
|
||||||
search_close();
|
search_close();
|
||||||
warning_open(md, exit_yes_btn_cb, exit_save_btn_cb);
|
warning_open(md, exit_yes_btn_cb, exit_save_btn_cb);
|
||||||
|
@ -806,7 +806,9 @@ menu_deactivate_request(void)
|
||||||
{
|
{
|
||||||
menu_data *md = g_md;
|
menu_data *md = g_md;
|
||||||
md->active_request--;
|
md->active_request--;
|
||||||
if (md->active_request == 0) edit_focus_set(md->ed);
|
|
||||||
|
if (md->active_request == 0)
|
||||||
|
enventor_object_focus_set(md->enventor, EINA_TRUE);
|
||||||
if (!md->menu_layout) return;
|
if (!md->menu_layout) return;
|
||||||
elm_object_disabled_set(md->menu_layout, EINA_FALSE);
|
elm_object_disabled_set(md->menu_layout, EINA_FALSE);
|
||||||
elm_object_focus_set(md->menu_layout, EINA_TRUE);
|
elm_object_focus_set(md->menu_layout, EINA_TRUE);
|
||||||
|
|
|
@ -18,7 +18,7 @@ list_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
newfile_set(edit_data *ed)
|
newfile_set(Evas_Object *enventor)
|
||||||
{
|
{
|
||||||
new_data *nd = g_nd;
|
new_data *nd = g_nd;
|
||||||
if (!nd) return;
|
if (!nd) return;
|
||||||
|
@ -40,7 +40,8 @@ newfile_set(edit_data *ed)
|
||||||
EINA_LOG_ERR("Cannot find file! \"%s\"", buf);
|
EINA_LOG_ERR("Cannot find file! \"%s\"", buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
edit_edc_reload(ed, default_path);
|
enventor_object_file_set(enventor, default_path);
|
||||||
|
base_title_set(default_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
typedef struct search_s
|
typedef struct search_s
|
||||||
|
@ -7,8 +13,7 @@ typedef struct search_s
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
Evas_Object *en_find;
|
Evas_Object *en_find;
|
||||||
Evas_Object *en_replace;
|
Evas_Object *en_replace;
|
||||||
Evas_Object *entry;
|
Evas_Object *enventor;
|
||||||
edit_data *ed;
|
|
||||||
int pos;
|
int pos;
|
||||||
int len;
|
int len;
|
||||||
int syntax_color;
|
int syntax_color;
|
||||||
|
@ -59,7 +64,7 @@ replace_all_proc(search_data *sd)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
int replace_cnt = 0;
|
int replace_cnt = 0;
|
||||||
|
|
||||||
const char *text = elm_entry_entry_get(sd->entry);
|
const char *text = (const char *) enventor_object_text_get(sd->enventor);
|
||||||
char *utf8 = elm_entry_markup_to_utf8(text);
|
char *utf8 = elm_entry_markup_to_utf8(text);
|
||||||
|
|
||||||
char *s = utf8;
|
char *s = utf8;
|
||||||
|
@ -69,9 +74,9 @@ replace_all_proc(search_data *sd)
|
||||||
while ((s = strstr(s, find)))
|
while ((s = strstr(s, find)))
|
||||||
{
|
{
|
||||||
pos = s + (delta * replace_cnt) - utf8;
|
pos = s + (delta * replace_cnt) - utf8;
|
||||||
elm_entry_select_region_set(sd->entry, pos, pos + find_len);
|
enventor_object_select_region_set(sd->enventor, pos, (pos + find_len));
|
||||||
elm_entry_entry_insert(sd->entry, replace);
|
enventor_object_text_insert(sd->enventor, replace);
|
||||||
elm_entry_select_none(sd->entry);
|
enventor_object_select_none(sd->enventor);
|
||||||
replace_cnt++;
|
replace_cnt++;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +93,8 @@ static Eina_Bool
|
||||||
selection_region_anim_cb(void *data)
|
selection_region_anim_cb(void *data)
|
||||||
{
|
{
|
||||||
search_data *sd = data;
|
search_data *sd = data;
|
||||||
elm_entry_select_region_set(sd->entry, sd->pos, sd->pos + sd->len);
|
enventor_object_select_region_set(sd->enventor, sd->pos,
|
||||||
|
(sd->pos + sd->len));
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,12 +107,12 @@ find_forward_proc(search_data *sd)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
Eina_Bool need_iterate = EINA_TRUE;
|
Eina_Bool need_iterate = EINA_TRUE;
|
||||||
|
|
||||||
const char *text = elm_entry_entry_get(sd->entry);
|
const char *text = (const char *) enventor_object_text_get(sd->enventor);
|
||||||
if (!text) return;
|
if (!text) return;
|
||||||
char *utf8 = elm_entry_markup_to_utf8(text);
|
char *utf8 = elm_entry_markup_to_utf8(text);
|
||||||
|
|
||||||
//get the character position begun with searching.
|
//get the character position begun with searching.
|
||||||
if (sd->pos == -1) sd->pos = elm_entry_cursor_pos_get(sd->entry);
|
if (sd->pos == -1) sd->pos = enventor_object_cursor_pos_get(sd->enventor);
|
||||||
else if (sd->pos == 0) need_iterate = EINA_FALSE;
|
else if (sd->pos == 0) need_iterate = EINA_FALSE;
|
||||||
else sd->pos++;
|
else sd->pos++;
|
||||||
|
|
||||||
|
@ -149,14 +155,14 @@ find_backward_proc(search_data *sd)
|
||||||
Eina_Bool need_iterate = EINA_TRUE;
|
Eina_Bool need_iterate = EINA_TRUE;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
const char *text = elm_entry_entry_get(sd->entry);
|
const char *text = (const char *) enventor_object_text_get(sd->enventor);
|
||||||
if (!text) return;
|
if (!text) return;
|
||||||
char *utf8 = elm_entry_markup_to_utf8(text);
|
char *utf8 = elm_entry_markup_to_utf8(text);
|
||||||
|
|
||||||
//get the character position begun with searching.
|
//get the character position begun with searching.
|
||||||
if (sd->pos == -1)
|
if (sd->pos == -1)
|
||||||
{
|
{
|
||||||
sd->pos = elm_entry_cursor_pos_get(sd->entry);
|
sd->pos = enventor_object_cursor_pos_get(sd->enventor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -204,12 +210,13 @@ static Eina_Bool
|
||||||
replace_proc(search_data *sd)
|
replace_proc(search_data *sd)
|
||||||
{
|
{
|
||||||
const char *find = elm_entry_entry_get(sd->en_find);
|
const char *find = elm_entry_entry_get(sd->en_find);
|
||||||
const char *selection = elm_entry_selection_get(sd->entry);
|
const char *selection =
|
||||||
|
(const char * ) enventor_object_selection_get(sd->enventor);
|
||||||
if (!find || !selection) return EINA_FALSE;
|
if (!find || !selection) return EINA_FALSE;
|
||||||
char *utf8 = elm_entry_markup_to_utf8(selection);
|
char *utf8 = elm_entry_markup_to_utf8(selection);
|
||||||
if (strcmp(find, utf8)) return EINA_FALSE;
|
if (strcmp(find, utf8)) return EINA_FALSE;
|
||||||
const char *replace = elm_entry_entry_get(sd->en_replace);
|
const char *replace = elm_entry_entry_get(sd->en_replace);
|
||||||
elm_entry_entry_insert(sd->entry, replace);
|
enventor_object_text_insert(sd->enventor, replace);
|
||||||
free(utf8);
|
free(utf8);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -231,7 +238,7 @@ replace_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
search_data *sd = data;
|
search_data *sd = data;
|
||||||
Eina_Bool next;
|
Eina_Bool next;
|
||||||
next = replace_proc(sd);
|
next = replace_proc(sd);
|
||||||
edit_syntax_color_full_apply(sd->ed, EINA_TRUE);
|
enventor_object_syntax_color_full_apply(sd->enventor, EINA_TRUE);
|
||||||
if (!next) return;
|
if (!next) return;
|
||||||
if (sd->forward) find_forward_proc(sd);
|
if (sd->forward) find_forward_proc(sd);
|
||||||
else find_backward_proc(sd);
|
else find_backward_proc(sd);
|
||||||
|
@ -243,7 +250,7 @@ replace_all_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
{
|
{
|
||||||
search_data *sd = data;
|
search_data *sd = data;
|
||||||
replace_all_proc(sd);
|
replace_all_proc(sd);
|
||||||
edit_syntax_color_full_apply(sd->ed, EINA_TRUE);
|
enventor_object_syntax_color_full_apply(sd->enventor, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -272,7 +279,7 @@ replace_activated_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
search_data *sd = data;
|
search_data *sd = data;
|
||||||
Eina_Bool next;
|
Eina_Bool next;
|
||||||
next = replace_proc(sd);
|
next = replace_proc(sd);
|
||||||
edit_syntax_color_full_apply(sd->ed, EINA_TRUE);
|
enventor_object_syntax_color_full_apply(sd->enventor, EINA_TRUE);
|
||||||
if (!next) return;
|
if (!next) return;
|
||||||
if (sd->forward) find_forward_proc(sd);
|
if (sd->forward) find_forward_proc(sd);
|
||||||
else find_backward_proc(sd);
|
else find_backward_proc(sd);
|
||||||
|
@ -283,7 +290,7 @@ win_focused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
search_data *sd = g_sd;
|
search_data *sd = g_sd;
|
||||||
edit_syntax_color_full_apply(sd->ed, EINA_FALSE);
|
enventor_object_syntax_color_full_apply(sd->enventor, EINA_FALSE);
|
||||||
sd->syntax_color++;
|
sd->syntax_color++;
|
||||||
/* FIXME: reset position because search requests syntax color partial apply
|
/* FIXME: reset position because search requests syntax color partial apply
|
||||||
when it's window is unfocused. the selection region would be dismissed.
|
when it's window is unfocused. the selection region would be dismissed.
|
||||||
|
@ -297,12 +304,12 @@ win_unfocused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
search_data *sd = g_sd;
|
search_data *sd = g_sd;
|
||||||
edit_syntax_color_partial_apply(sd->ed, -1);
|
enventor_object_syntax_color_partial_apply(sd->enventor, -1);
|
||||||
sd->syntax_color--;
|
sd->syntax_color--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
search_open(edit_data *ed)
|
search_open(Evas_Object *enventor)
|
||||||
{
|
{
|
||||||
search_data *sd = g_sd;
|
search_data *sd = g_sd;
|
||||||
|
|
||||||
|
@ -402,11 +409,10 @@ search_open(edit_data *ed)
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
|
|
||||||
sd->win = win;
|
sd->win = win;
|
||||||
sd->ed = ed;
|
sd->enventor = enventor;
|
||||||
sd->layout = layout;
|
sd->layout = layout;
|
||||||
sd->en_find = entry_find;
|
sd->en_find = entry_find;
|
||||||
sd->en_replace = entry_replace;
|
sd->en_replace = entry_replace;
|
||||||
sd->entry = edit_entry_get(ed);
|
|
||||||
sd->pos = -1;
|
sd->pos = -1;
|
||||||
sd->forward = EINA_TRUE;
|
sd->forward = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -426,7 +432,7 @@ search_close(void)
|
||||||
|
|
||||||
while (sd->syntax_color > 0)
|
while (sd->syntax_color > 0)
|
||||||
{
|
{
|
||||||
edit_syntax_color_partial_apply(sd->ed, -1);
|
enventor_object_syntax_color_partial_apply(sd->enventor, -1);
|
||||||
sd->syntax_color--;
|
sd->syntax_color--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ struct setting_s
|
||||||
Evas_Object *img_path_entry;
|
Evas_Object *img_path_entry;
|
||||||
Evas_Object *snd_path_entry;
|
Evas_Object *snd_path_entry;
|
||||||
Evas_Object *fnt_path_entry;
|
Evas_Object *fnt_path_entry;
|
||||||
Evas_Object *data_path_entry;
|
Evas_Object *dat_path_entry;
|
||||||
|
|
||||||
Evas_Object *slider_font;
|
Evas_Object *slider_font;
|
||||||
Evas_Object *slider_view;
|
Evas_Object *slider_view;
|
||||||
|
@ -53,15 +53,15 @@ fnt_path_entry_update(Evas_Object *entry, Eina_List *edc_fnt_paths)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
data_path_entry_update(Evas_Object *entry, Eina_List *edc_data_paths)
|
dat_path_entry_update(Evas_Object *entry, Eina_List *edc_dat_paths)
|
||||||
{
|
{
|
||||||
elm_entry_entry_set(entry, NULL);
|
elm_entry_entry_set(entry, NULL);
|
||||||
|
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *edc_data_path;
|
char *edc_dat_path;
|
||||||
EINA_LIST_FOREACH(edc_data_paths, l, edc_data_path)
|
EINA_LIST_FOREACH(edc_dat_paths, l, edc_dat_path)
|
||||||
{
|
{
|
||||||
elm_entry_entry_append(entry, edc_data_path);
|
elm_entry_entry_append(entry, edc_dat_path);
|
||||||
elm_entry_entry_append(entry, ";");
|
elm_entry_entry_append(entry, ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,8 +103,8 @@ setting_apply_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
config_edc_img_path_set(elm_object_text_get(sd->img_path_entry));
|
config_edc_img_path_set(elm_object_text_get(sd->img_path_entry));
|
||||||
config_edc_snd_path_set(elm_object_text_get(sd->snd_path_entry));
|
config_edc_snd_path_set(elm_object_text_get(sd->snd_path_entry));
|
||||||
config_edc_fnt_path_set(elm_object_text_get(sd->fnt_path_entry));
|
config_edc_fnt_path_set(elm_object_text_get(sd->fnt_path_entry));
|
||||||
config_edc_data_path_set(elm_object_text_get(sd->data_path_entry));
|
config_edc_dat_path_set(elm_object_text_get(sd->dat_path_entry));
|
||||||
config_font_size_set((float) elm_slider_value_get(sd->slider_font));
|
config_font_scale_set((float) elm_slider_value_get(sd->slider_font));
|
||||||
config_view_scale_set(elm_slider_value_get(sd->slider_view));
|
config_view_scale_set(elm_slider_value_get(sd->slider_view));
|
||||||
config_tools_set(elm_check_state_get(sd->toggle_tools));
|
config_tools_set(elm_check_state_get(sd->toggle_tools));
|
||||||
config_stats_bar_set(elm_check_state_get(sd->toggle_stats));
|
config_stats_bar_set(elm_check_state_get(sd->toggle_stats));
|
||||||
|
@ -138,10 +138,10 @@ setting_reset_btn_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
(Eina_List *)config_edc_snd_path_list_get());
|
(Eina_List *)config_edc_snd_path_list_get());
|
||||||
fnt_path_entry_update(sd->fnt_path_entry,
|
fnt_path_entry_update(sd->fnt_path_entry,
|
||||||
(Eina_List *)config_edc_fnt_path_list_get());
|
(Eina_List *)config_edc_fnt_path_list_get());
|
||||||
data_path_entry_update(sd->data_path_entry,
|
dat_path_entry_update(sd->dat_path_entry,
|
||||||
(Eina_List *)config_edc_data_path_list_get());
|
(Eina_List *)config_edc_dat_path_list_get());
|
||||||
|
|
||||||
elm_slider_value_set(sd->slider_font, (double) config_font_size_get());
|
elm_slider_value_set(sd->slider_font, (double) config_font_scale_get());
|
||||||
elm_slider_value_set(sd->slider_view, (double) config_view_scale_get());
|
elm_slider_value_set(sd->slider_view, (double) config_view_scale_get());
|
||||||
|
|
||||||
elm_check_state_set(sd->toggle_tools, config_tools_get());
|
elm_check_state_set(sd->toggle_tools, config_tools_get());
|
||||||
|
@ -226,11 +226,11 @@ setting_open(void)
|
||||||
fnt_path_entry);
|
fnt_path_entry);
|
||||||
|
|
||||||
//Data Path Entry
|
//Data Path Entry
|
||||||
Evas_Object *data_path_entry = entry_create(layout);
|
Evas_Object *dat_path_entry = entry_create(layout);
|
||||||
data_path_entry_update(data_path_entry,
|
dat_path_entry_update(dat_path_entry,
|
||||||
(Eina_List *)config_edc_data_path_list_get());
|
(Eina_List *)config_edc_dat_path_list_get());
|
||||||
elm_object_part_content_set(layout, "elm.swallow.data_path_entry",
|
elm_object_part_content_set(layout, "elm.swallow.dat_path_entry",
|
||||||
data_path_entry);
|
dat_path_entry);
|
||||||
|
|
||||||
//Preference
|
//Preference
|
||||||
Evas_Object *scroller = elm_scroller_add(layout);
|
Evas_Object *scroller = elm_scroller_add(layout);
|
||||||
|
@ -266,13 +266,13 @@ setting_open(void)
|
||||||
|
|
||||||
//Font Size (Slider)
|
//Font Size (Slider)
|
||||||
Evas_Object *slider_font = elm_slider_add(box3);
|
Evas_Object *slider_font = elm_slider_add(box3);
|
||||||
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0);
|
evas_object_size_hint_weight_set(slider_font, EVAS_HINT_EXPAND, 0);
|
||||||
evas_object_size_hint_align_set(slider_font, 0, 0);
|
evas_object_size_hint_align_set(slider_font, 0, 0);
|
||||||
elm_slider_span_size_set(slider_font, 190);
|
elm_slider_span_size_set(slider_font, 190);
|
||||||
elm_slider_indicator_show_set(slider_font, EINA_FALSE);
|
elm_slider_indicator_show_set(slider_font, EINA_FALSE);
|
||||||
elm_slider_unit_format_set(slider_font, "%1.1fx");
|
elm_slider_unit_format_set(slider_font, "%1.1fx");
|
||||||
elm_slider_min_max_set(slider_font, MIN_FONT_SIZE, MAX_FONT_SIZE);
|
elm_slider_min_max_set(slider_font, MIN_FONT_SCALE, MAX_FONT_SCALE);
|
||||||
elm_slider_value_set(slider_font, (double) config_font_size_get());
|
elm_slider_value_set(slider_font, (double) config_font_scale_get());
|
||||||
elm_object_text_set(slider_font, "Font Size");
|
elm_object_text_set(slider_font, "Font Size");
|
||||||
evas_object_show(slider_font);
|
evas_object_show(slider_font);
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ setting_open(void)
|
||||||
|
|
||||||
//View Scale (Slider)
|
//View Scale (Slider)
|
||||||
Evas_Object *slider_view = elm_slider_add(box2);
|
Evas_Object *slider_view = elm_slider_add(box2);
|
||||||
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0);
|
evas_object_size_hint_weight_set(slider_view, EVAS_HINT_EXPAND, 0);
|
||||||
evas_object_size_hint_align_set(slider_view, 0, 0);
|
evas_object_size_hint_align_set(slider_view, 0, 0);
|
||||||
elm_slider_span_size_set(slider_view, 190);
|
elm_slider_span_size_set(slider_view, 190);
|
||||||
elm_slider_indicator_show_set(slider_view, EINA_FALSE);
|
elm_slider_indicator_show_set(slider_view, EINA_FALSE);
|
||||||
|
@ -377,7 +377,7 @@ setting_open(void)
|
||||||
sd->img_path_entry = img_path_entry;
|
sd->img_path_entry = img_path_entry;
|
||||||
sd->snd_path_entry = snd_path_entry;
|
sd->snd_path_entry = snd_path_entry;
|
||||||
sd->fnt_path_entry = fnt_path_entry;
|
sd->fnt_path_entry = fnt_path_entry;
|
||||||
sd->data_path_entry = data_path_entry;
|
sd->dat_path_entry = dat_path_entry;
|
||||||
sd->slider_font = slider_font;
|
sd->slider_font = slider_font;
|
||||||
sd->slider_view = slider_view;
|
sd->slider_view = slider_view;
|
||||||
sd->toggle_tools = toggle_tools;
|
sd->toggle_tools = toggle_tools;
|
||||||
|
|
|
@ -81,13 +81,10 @@ stats_info_msg_update(const char *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
stats_view_size_update(void)
|
stats_view_size_update(Evas_Coord w, Evas_Coord h)
|
||||||
{
|
{
|
||||||
stats_data *sd = g_sd;
|
stats_data *sd = g_sd;
|
||||||
|
|
||||||
Evas_Coord w, h;
|
|
||||||
config_view_size_get(&w, &h);
|
|
||||||
|
|
||||||
char buf[10];
|
char buf[10];
|
||||||
snprintf(buf, sizeof(buf), "%d", w);
|
snprintf(buf, sizeof(buf), "%d", w);
|
||||||
elm_object_part_text_set(sd->layout, "elm.text.size_w", buf);
|
elm_object_part_text_set(sd->layout, "elm.text.size_w", buf);
|
||||||
|
|
|
@ -4,55 +4,52 @@
|
||||||
#define TOOLBAR_ICON_SIZE 16
|
#define TOOLBAR_ICON_SIZE 16
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
menu_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
edit_data *ed = data;
|
Evas_Object *enventor = data;
|
||||||
|
|
||||||
if (search_is_opened() || goto_is_opened())
|
if (search_is_opened() || goto_is_opened())
|
||||||
{
|
{
|
||||||
goto_close();
|
goto_close();
|
||||||
search_close();
|
search_close();
|
||||||
edit_focus_set(ed);
|
enventor_object_focus_set(enventor, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_toggle();
|
menu_toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
highlight_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
menu_edc_save();
|
Evas_Object *enventor = data;
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
load_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|
||||||
{
|
|
||||||
menu_edc_load();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
highlight_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|
||||||
void *event_info)
|
|
||||||
{
|
|
||||||
edit_data *ed = data;
|
|
||||||
config_part_highlight_set(!config_part_highlight_get());
|
config_part_highlight_set(!config_part_highlight_get());
|
||||||
edit_part_highlight_toggle(ed, EINA_TRUE);
|
enventor_object_part_highlight_set(enventor, config_part_highlight_get());
|
||||||
|
if (config_part_highlight_get())
|
||||||
|
stats_info_msg_update("Part Highlighting Enabled.");
|
||||||
|
else
|
||||||
|
stats_info_msg_update("Part Highlighting Disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
swallow_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
swallow_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
Evas_Object *enventor = data;
|
||||||
config_dummy_swallow_set(!config_dummy_swallow_get());
|
config_dummy_swallow_set(!config_dummy_swallow_get());
|
||||||
view_dummy_toggle(VIEW_DATA, EINA_TRUE);
|
enventor_object_dummy_swallow_set(enventor, config_dummy_swallow_get());
|
||||||
|
|
||||||
|
if (config_dummy_swallow_get())
|
||||||
|
stats_info_msg_update("Dummy Swallow Enabled.");
|
||||||
|
else
|
||||||
|
stats_info_msg_update("Dummy Swallow Disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lines_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
lines_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
edit_data *ed = data;
|
Evas_Object *enventor = data;
|
||||||
config_linenumber_set(!config_linenumber_get());
|
config_linenumber_set(!config_linenumber_get());
|
||||||
edit_line_number_toggle(ed);
|
enventor_object_linenumber_set(enventor, config_linenumber_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -65,17 +62,17 @@ status_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
static void
|
static void
|
||||||
find_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
find_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
{
|
{
|
||||||
edit_data *ed = data;
|
Evas_Object *enventor = data;
|
||||||
if (search_is_opened()) search_close();
|
if (search_is_opened()) search_close();
|
||||||
else search_open(ed);
|
else search_open(enventor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
goto_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
goto_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
{
|
{
|
||||||
edit_data *ed = data;
|
Evas_Object *enventor = data;
|
||||||
if (goto_is_opened()) goto_close();
|
if (goto_is_opened()) goto_close();
|
||||||
else goto_open(ed);
|
else goto_open(enventor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -111,7 +108,7 @@ tools_btn_create(Evas_Object *parent, const char *icon, const char *label,
|
||||||
}
|
}
|
||||||
|
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
tools_create(Evas_Object *parent, edit_data *ed)
|
tools_create(Evas_Object *parent, Evas_Object *enventor)
|
||||||
{
|
{
|
||||||
Evas_Object *box = elm_box_add(parent);
|
Evas_Object *box = elm_box_add(parent);
|
||||||
elm_box_horizontal_set(box, EINA_TRUE);
|
elm_box_horizontal_set(box, EINA_TRUE);
|
||||||
|
@ -121,7 +118,7 @@ tools_create(Evas_Object *parent, edit_data *ed)
|
||||||
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
Evas_Object *btn;
|
Evas_Object *btn;
|
||||||
btn = tools_btn_create(box, "menu", "Menu", menu_cb, ed);
|
btn = tools_btn_create(box, "menu", "Menu", menu_cb, enventor);
|
||||||
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
||||||
elm_box_pack_end(box, btn);
|
elm_box_pack_end(box, btn);
|
||||||
|
@ -131,7 +128,8 @@ tools_create(Evas_Object *parent, edit_data *ed)
|
||||||
evas_object_show(sp);
|
evas_object_show(sp);
|
||||||
elm_box_pack_end(box, sp);
|
elm_box_pack_end(box, sp);
|
||||||
|
|
||||||
btn = tools_btn_create(box, "highlight", "Highlight", highlight_cb, ed);
|
btn = tools_btn_create(box, "highlight", "Highlight", highlight_cb,
|
||||||
|
enventor);
|
||||||
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
||||||
elm_box_pack_end(box, btn);
|
elm_box_pack_end(box, btn);
|
||||||
|
@ -151,17 +149,17 @@ tools_create(Evas_Object *parent, edit_data *ed)
|
||||||
evas_object_show(sp);
|
evas_object_show(sp);
|
||||||
elm_box_pack_end(box, sp);
|
elm_box_pack_end(box, sp);
|
||||||
|
|
||||||
btn = tools_btn_create(box, "lines", "Lines", lines_cb, ed);
|
btn = tools_btn_create(box, "lines", "Lines", lines_cb, enventor);
|
||||||
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
||||||
elm_box_pack_end(box, btn);
|
elm_box_pack_end(box, btn);
|
||||||
|
|
||||||
btn = tools_btn_create(box, "find", "Find", find_cb, ed);
|
btn = tools_btn_create(box, "find", "Find", find_cb, enventor);
|
||||||
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
||||||
elm_box_pack_end(box, btn);
|
elm_box_pack_end(box, btn);
|
||||||
|
|
||||||
btn = tools_btn_create(box, "line", "Goto", goto_cb, ed);
|
btn = tools_btn_create(box, "line", "Goto", goto_cb, enventor);
|
||||||
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
|
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND,
|
||||||
EVAS_HINT_EXPAND);
|
EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL);
|
||||||
|
|
|
@ -4,28 +4,15 @@ EXTRA_DIST = common.h \
|
||||||
base_gui.h \
|
base_gui.h \
|
||||||
config_data.h \
|
config_data.h \
|
||||||
dummy_obj.h \
|
dummy_obj.h \
|
||||||
edc_editor.h \
|
|
||||||
edc_parser.h \
|
|
||||||
edj_viewer.h \
|
edj_viewer.h \
|
||||||
menu.h \
|
menu.h \
|
||||||
panes.h \
|
panes.h \
|
||||||
statusbar.h \
|
statusbar.h \
|
||||||
edj_mgr.h \
|
|
||||||
syntax_color.h \
|
|
||||||
build.h \
|
|
||||||
ctxpopup.h \
|
|
||||||
globals.h \
|
globals.h \
|
||||||
indent.h \
|
|
||||||
syntax_helper.h \
|
|
||||||
template_code.h \
|
|
||||||
tools.h \
|
tools.h \
|
||||||
newfile.h \
|
newfile.h \
|
||||||
auto_comp.h \
|
|
||||||
auto_comp_code.h \
|
|
||||||
goto.h \
|
goto.h \
|
||||||
setting.h \
|
setting.h \
|
||||||
search.h \
|
search.h \
|
||||||
redoundo.h \
|
|
||||||
template.h \
|
|
||||||
live_edit.h \
|
live_edit.h \
|
||||||
console.h
|
console.h
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
void autocomp_init(Evas_Object *parent);
|
|
||||||
void autocomp_term(void);
|
|
||||||
void autocomp_target_set(edit_data *ed);
|
|
||||||
void autocomp_toggle(void);
|
|
||||||
Eina_Bool autocomp_key_event_hook(const char *key);
|
|
|
@ -9,11 +9,13 @@ void base_title_set(const char *path);
|
||||||
void base_statusbar_toggle(Eina_Bool config);
|
void base_statusbar_toggle(Eina_Bool config);
|
||||||
void base_tools_toggle(Eina_Bool config);
|
void base_tools_toggle(Eina_Bool config);
|
||||||
void base_tools_set(Evas_Object *tools);
|
void base_tools_set(Evas_Object *tools);
|
||||||
void base_text_editor_full_view(void);
|
void base_enventor_full_view(void);
|
||||||
void base_live_view_full_view(void);
|
void base_live_view_full_view(void);
|
||||||
void base_editors_full_view(void);
|
void base_editors_full_view(void);
|
||||||
void base_console_full_view(void);
|
void base_console_full_view(void);
|
||||||
|
void base_console_toggle(void);
|
||||||
void base_live_view_set(Evas_Object *live_view);
|
void base_live_view_set(Evas_Object *live_view);
|
||||||
void base_text_editor_set(Evas_Object *text_editor);
|
void base_enventor_set(Evas_Object *enventor);
|
||||||
void base_gui_term(void);
|
void base_gui_term(void);
|
||||||
void base_console_reset(void);
|
void base_console_reset(void);
|
||||||
|
void base_error_msg_set(const char *msg);
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
void build_edc(void);
|
|
||||||
Eina_Bool build_init(void);
|
|
||||||
void build_term(void);
|
|
||||||
Eina_Bool build_cmd_set(void);
|
|
||||||
void build_err_noti_cb_set(void (*cb)(void *data, const char *msg), void *data);
|
|
|
@ -1,39 +1,25 @@
|
||||||
#ifndef __COMMON_H__
|
#ifndef __COMMON_H__
|
||||||
#define __COMMON_H__
|
#define __COMMON_H__
|
||||||
|
|
||||||
typedef struct viewer_s view_data;
|
|
||||||
typedef struct statusbar_s stats_data;
|
typedef struct statusbar_s stats_data;
|
||||||
typedef struct editor_s edit_data;
|
|
||||||
typedef struct syntax_color_s color_data;
|
|
||||||
typedef struct parser_s parser_data;
|
|
||||||
typedef struct attr_value_s attr_value;
|
|
||||||
typedef struct syntax_helper_s syntax_helper;
|
|
||||||
typedef struct indent_s indent_data;
|
|
||||||
typedef struct redoundo_s redoundo_data;
|
|
||||||
|
|
||||||
#include "edc_editor.h"
|
#define EOL "<br/>"
|
||||||
|
#define EOL_LEN 5
|
||||||
|
#define REL1_X 0.25f
|
||||||
|
#define REL1_Y 0.25f
|
||||||
|
#define REL2_X 0.75f
|
||||||
|
#define REL2_Y 0.75f
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "edj_viewer.h"
|
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "syntax_helper.h"
|
|
||||||
#include "syntax_color.h"
|
|
||||||
#include "config_data.h"
|
#include "config_data.h"
|
||||||
#include "edc_parser.h"
|
|
||||||
#include "dummy_obj.h"
|
|
||||||
#include "ctxpopup.h"
|
|
||||||
#include "indent.h"
|
|
||||||
#include "edj_mgr.h"
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "build.h"
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "base_gui.h"
|
#include "base_gui.h"
|
||||||
#include "search.h"
|
#include "search.h"
|
||||||
#include "goto.h"
|
#include "goto.h"
|
||||||
#include "newfile.h"
|
#include "newfile.h"
|
||||||
#include "auto_comp.h"
|
|
||||||
#include "setting.h"
|
#include "setting.h"
|
||||||
#include "redoundo.h"
|
|
||||||
#include "template.h"
|
|
||||||
#include "live_edit.h"
|
#include "live_edit.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
#define MAX_FONT_SIZE 5.0
|
#define MAX_FONT_SCALE 5.0
|
||||||
#define MIN_FONT_SIZE 0.5
|
#define MIN_FONT_SCALE 0.5
|
||||||
#define MAX_VIEW_SCALE 5.0
|
#define MAX_VIEW_SCALE 5.0
|
||||||
#define MIN_VIEW_SCALE 0.5
|
#define MIN_VIEW_SCALE 0.5
|
||||||
|
|
||||||
void config_init(const char *edc_path, const char *edc_img_path, const char *edc_snd_path, const char *edc_fnt_path, const char *edc_data_path);
|
void config_init(const char *edc_path, const char *edc_img_path, const char *edc_snd_path, const char *edc_fnt_path, const char *edc_dat_path);
|
||||||
void config_term(void);
|
void config_term(void);
|
||||||
const char *config_edc_path_get(void);
|
const char *config_edc_path_get(void);
|
||||||
const char *config_edj_path_get(void);
|
const char *config_edj_path_get(void);
|
||||||
const char *config_edc_img_path_get(void);
|
const char *config_edc_img_path_get(void);
|
||||||
const char *config_edc_snd_path_get(void);
|
const char *config_edc_snd_path_get(void);
|
||||||
const char *config_edc_fnt_path_get(void);
|
const char *config_edc_fnt_path_get(void);
|
||||||
const char *config_edc_data_path_get(void);
|
const char *config_edc_dat_path_get(void);
|
||||||
void config_edc_img_path_set(const char *edc_img_path);
|
void config_edc_img_path_set(const char *edc_img_path);
|
||||||
void config_edc_snd_path_set(const char *edc_snd_path);
|
void config_edc_snd_path_set(const char *edc_snd_path);
|
||||||
void config_edc_fnt_path_set(const char *edc_fnt_path);
|
void config_edc_fnt_path_set(const char *edc_fnt_path);
|
||||||
void config_edc_data_path_set(const char *edc_fnt_path);
|
void config_edc_dat_path_set(const char *edc_fnt_path);
|
||||||
Eina_List *config_edc_img_path_list_get(void);
|
Eina_List *config_edc_img_path_list_get(void);
|
||||||
Eina_List *config_edc_snd_path_list_get(void);
|
Eina_List *config_edc_snd_path_list_get(void);
|
||||||
Eina_List *config_edc_fnt_path_list_get(void);
|
Eina_List *config_edc_fnt_path_list_get(void);
|
||||||
Eina_List *config_edc_data_path_list_get(void);
|
Eina_List *config_edc_dat_path_list_get(void);
|
||||||
void config_update_cb_set(void (*cb)(void *data), void *data);
|
void config_update_cb_set(void (*cb)(void *data), void *data);
|
||||||
void config_stats_bar_set(Eina_Bool enabled);
|
void config_stats_bar_set(Eina_Bool enabled);
|
||||||
void config_linenumber_set(Eina_Bool enabled);
|
void config_linenumber_set(Eina_Bool enabled);
|
||||||
|
@ -38,8 +38,8 @@ void config_auto_complete_set(Eina_Bool auto_complete);
|
||||||
Eina_Bool config_auto_complete_get(void);
|
Eina_Bool config_auto_complete_get(void);
|
||||||
Eina_Bool config_live_edit_get(void);
|
Eina_Bool config_live_edit_get(void);
|
||||||
void config_live_edit_set(Eina_Bool live_edit);
|
void config_live_edit_set(Eina_Bool live_edit);
|
||||||
void config_font_size_set(float font_size);
|
void config_font_scale_set(float font_scale);
|
||||||
float config_font_size_get(void);
|
float config_font_scale_get(void);
|
||||||
void config_view_scale_set(double view_scale);
|
void config_view_scale_set(double view_scale);
|
||||||
double config_view_scale_get(void);
|
double config_view_scale_get(void);
|
||||||
Eina_Bool config_tools_get(void);
|
Eina_Bool config_tools_get(void);
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
typedef enum attr_value_type
|
|
||||||
{
|
|
||||||
ATTR_VALUE_INTEGER = 1,
|
|
||||||
ATTR_VALUE_FLOAT = 2,
|
|
||||||
ATTR_VALUE_CONSTANT = 4,
|
|
||||||
ATTR_VALUE_PART = 8,
|
|
||||||
ATTR_VALUE_STATE = 16,
|
|
||||||
ATTR_VALUE_IMAGE = 32,
|
|
||||||
ATTR_VALUE_PROGRAM = 64
|
|
||||||
} attr_value_type;
|
|
||||||
|
|
||||||
struct attr_value_s
|
|
||||||
{
|
|
||||||
Eina_Array *strs;
|
|
||||||
float min;
|
|
||||||
float max;
|
|
||||||
attr_value_type type;
|
|
||||||
Eina_Bool program : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
Evas_Object * ctxpopup_candidate_list_create(edit_data *ed, attr_value *attr, double slider_val, Evas_Smart_Cb ctxpopup_dismiss_cb, Evas_Smart_Cb ctxpopup_selected_cb);
|
|
||||||
Evas_Object * ctxpopup_img_preview_create(edit_data *ed, const char *imgpath, Evas_Smart_Cb ctxpopup_dismiss_cb, Evas_Smart_Cb ctxpopup_relay_cb);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
void dummy_obj_new(Evas_Object *layout);
|
|
||||||
void dummy_obj_del(Evas_Object *layout);
|
|
||||||
void dummy_obj_update(Evas_Object *layout);
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
edit_data *edit_init(Evas_Object *win);
|
|
||||||
void edit_term(edit_data *ed);
|
|
||||||
void edit_edc_read(edit_data *ed, const char *file_path);
|
|
||||||
void edit_focus_set(edit_data *ed);
|
|
||||||
Evas_Object *edit_obj_get(edit_data *ed);
|
|
||||||
Eina_Bool edit_changed_get(edit_data *ed);
|
|
||||||
void edit_changed_set(edit_data *ed, Eina_Bool changed);
|
|
||||||
void edit_line_number_toggle(edit_data *ed);
|
|
||||||
void edit_editable_set(edit_data *ed, Eina_Bool editable);
|
|
||||||
Eina_Bool edit_save(edit_data *ed);
|
|
||||||
void edit_new(edit_data* ed);
|
|
||||||
void edit_view_sync_cb_set(edit_data *ed, void (*cb)(void *data, Eina_Stringshare *part_name, Eina_Stringshare *group_name), void *data);
|
|
||||||
void edit_view_sync(edit_data *ed);
|
|
||||||
void edit_font_size_update(edit_data *ed, Eina_Bool msg, Eina_Bool update);
|
|
||||||
void edit_part_highlight_toggle(edit_data *ed, Eina_Bool msg);
|
|
||||||
void edit_line_delete(edit_data *ed);
|
|
||||||
void edit_edc_reload(edit_data *ed, const char *edc_path);
|
|
||||||
Eina_Stringshare *edit_cur_prog_name_get(edit_data *ed);
|
|
||||||
Eina_Stringshare *edit_cur_part_name_get(edit_data *ed);
|
|
||||||
Eina_Stringshare *edit_cur_paragh_get(edit_data *ed);
|
|
||||||
int edit_max_line_get(edit_data *ed);
|
|
||||||
void edit_goto(edit_data *ed, int line);
|
|
||||||
void edit_syntax_color_full_apply(edit_data *ed, Eina_Bool force);
|
|
||||||
void edit_syntax_color_partial_apply(edit_data *ed, double interval);
|
|
||||||
Evas_Object * edit_entry_get(edit_data *ed);
|
|
||||||
void edit_line_increase(edit_data *ed, int cnt);
|
|
||||||
void edit_line_decrease(edit_data *ed, int cnt);
|
|
||||||
int edit_cur_indent_depth_get(edit_data *ed);
|
|
||||||
void edit_redoundo_region_push(edit_data *ed, int cursor_pos1, int cursor_pos2);
|
|
||||||
void edit_disabled_set(edit_data *ed, Eina_Bool disable);
|
|
|
@ -1,26 +0,0 @@
|
||||||
#define QUOT "\""
|
|
||||||
#define QUOT_C '\"'
|
|
||||||
#define QUOT_LEN 1
|
|
||||||
#define EOL "<br/>"
|
|
||||||
#define EOL_LEN 5
|
|
||||||
#define TAB "<tab/>"
|
|
||||||
#define TAB_LEN 6
|
|
||||||
|
|
||||||
parser_data *parser_init(void);
|
|
||||||
void parser_term(parser_data *pd);
|
|
||||||
Eina_Stringshare *parser_first_group_name_get(parser_data *pd, Evas_Object *entry);
|
|
||||||
void parser_cur_name_get(parser_data *pd, Evas_Object *entry, void (*cb)(void *data, Eina_Stringshare *part_name, Eina_Stringshare *group_name), void *data);
|
|
||||||
void parser_cur_group_name_get(parser_data *pd, Evas_Object *entry, void (*cb)(void *data, Eina_Stringshare *part_name, Eina_Stringshare *group_name), void *data);
|
|
||||||
Eina_Stringshare *parser_cur_name_fast_get(Evas_Object *entry, const char *scope);
|
|
||||||
Eina_Bool parser_type_name_compare(parser_data *pd, const char *str);
|
|
||||||
attr_value *parser_attribute_get(parser_data *pd, const char *text, const char *cur);
|
|
||||||
Eina_Stringshare *parser_paragh_name_get(parser_data *pd, Evas_Object *entry);
|
|
||||||
char *parser_name_get(parser_data *pd, const char *cur);
|
|
||||||
void parser_cancel(parser_data *pd);
|
|
||||||
int parser_line_cnt_get(parser_data *pd EINA_UNUSED, const char *src);
|
|
||||||
Eina_List *parser_states_filtered_name_get(Eina_List *states);
|
|
||||||
int parser_end_of_parts_block_pos_get(const Evas_Object *entry, const char *group_name);
|
|
||||||
Eina_Bool parser_images_pos_get(const Evas_Object *entry, int *ret);
|
|
||||||
Eina_Bool parser_styles_pos_get(const Evas_Object *entry, int *ret);
|
|
||||||
const char * parser_colon_pos_get(parser_data *pd EINA_UNUSED, const char *cur);
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
#define VIEW_DATA edj_mgr_view_get(NULL)
|
|
||||||
|
|
||||||
void edj_mgr_init(Evas_Object *parent);
|
|
||||||
void edj_mgr_term(void);
|
|
||||||
view_data * edj_mgr_view_new(const char *group);
|
|
||||||
view_data *edj_mgr_view_get(Eina_Stringshare *group);
|
|
||||||
Evas_Object * edj_mgr_obj_get(void);
|
|
||||||
view_data *edj_mgr_view_switch_to(view_data *vd);
|
|
||||||
void edj_mgr_view_del(view_data *vd);
|
|
||||||
void edj_mgr_reload_need_set(Eina_Bool reload);
|
|
||||||
Eina_Bool edj_mgr_reload_need_get(void);
|
|
||||||
void edj_mgr_clear(void);
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
view_data * view_init(Evas_Object *parent, const char *group,
|
|
||||||
void (*del_cb)(void *data), void *data);
|
|
||||||
void view_term(view_data *vd);
|
|
||||||
Evas_Object *view_obj_get(view_data *vd);
|
|
||||||
void view_new(view_data *vd, const char *group);
|
|
||||||
void view_part_highlight_set(view_data *vd, const char *part_name);
|
|
||||||
void view_dummy_toggle(view_data *vd, Eina_Bool msg);
|
|
||||||
void view_program_run(view_data *vd, const char *program);
|
|
||||||
Eina_Stringshare *view_group_name_get(view_data *vd);
|
|
||||||
void *view_data_get(view_data *vd);
|
|
||||||
void view_scale_set(view_data *vd, double scale);
|
|
||||||
Eina_List *view_parts_list_get(view_data *vd);
|
|
||||||
Eina_List *view_images_list_get(view_data *vd);
|
|
||||||
Eina_List *view_programs_list_get(view_data *vd);
|
|
||||||
Eina_List *view_part_states_list_get(view_data *vd, const char *part);
|
|
||||||
Eina_List *view_program_targets_get(view_data *vd, const char *prog);
|
|
||||||
void view_string_list_free(Eina_List *list);
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define DEFAULT_GOTO_WIN_W 330
|
#define DEFAULT_GOTO_WIN_W 330
|
||||||
#define DEFAULT_GOTO_WIN_H 77
|
#define DEFAULT_GOTO_WIN_H 77
|
||||||
void goto_open(edit_data *ed);
|
void goto_open(Evas_Object *enventor);
|
||||||
void goto_close(void);
|
void goto_close(void);
|
||||||
Eina_Bool goto_is_opened(void);
|
Eina_Bool goto_is_opened(void);
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#define TAB_SPACE 3
|
|
||||||
|
|
||||||
indent_data *indent_init(Eina_Strbuf *strbuf);
|
|
||||||
void indent_term(indent_data *id);
|
|
||||||
indent_data * syntax_indent_data_get(syntax_helper *sh);
|
|
||||||
int indent_space_get(indent_data *id, Evas_Object *entry);
|
|
||||||
void indent_insert_apply(indent_data *id, Evas_Object *entry, const char *insert, int cur_line);
|
|
||||||
Eina_Bool indent_delete_apply(indent_data *id, Evas_Object *entry, const char *del, int cur_line);
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
void live_edit_init(edit_data *ed);
|
void live_edit_init(Evas_Object *enventor);
|
||||||
void live_edit_term(void);
|
void live_edit_term(void);
|
||||||
void live_edit_toggle(void);
|
void live_edit_toggle(void);
|
||||||
void live_edit_cancel(void);
|
void live_edit_cancel(void);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
void menu_init(edit_data *ed);
|
void menu_init(Evas_Object *enventor);
|
||||||
void menu_term(void);
|
void menu_term(void);
|
||||||
void menu_toggle(void);
|
void menu_toggle(void);
|
||||||
void menu_ctxpopup_register(Evas_Object *ctxpopup);
|
void menu_ctxpopup_register(Evas_Object *ctxpopup);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
void newfile_default_set(void);
|
void newfile_default_set(void);
|
||||||
void newfile_set(edit_data *ed);
|
void newfile_set(Evas_Object *enventor);
|
||||||
Evas_Object * newfile_create(Evas_Object *parent, Evas_Smart_Cb selected_cb, void *data);
|
Evas_Object * newfile_create(Evas_Object *parent, Evas_Smart_Cb selected_cb, void *data);
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
redoundo_data *redoundo_init(Evas_Object *entry);
|
|
||||||
void redoundo_term(redoundo_data *rd);
|
|
||||||
void redoundo_clear(redoundo_data *rd);
|
|
||||||
void redoundo_text_push(redoundo_data *rd, const char *text, int pos, int length, Eina_Bool insert);
|
|
||||||
void redoundo_text_relative_push(redoundo_data *rd, const char *text);
|
|
||||||
void redoundo_entry_region_push(redoundo_data *rd, int cursor_pos, int cursor_pos2);
|
|
||||||
int redoundo_undo(redoundo_data *rd, Eina_Bool *changed);
|
|
||||||
int redoundo_redo(redoundo_data *rd, Eina_Bool *changed);
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define DEFAULT_SEARCH_WIN_W 330
|
#define DEFAULT_SEARCH_WIN_W 330
|
||||||
#define DEFAULT_SEARCH_WIN_H 90
|
#define DEFAULT_SEARCH_WIN_H 90
|
||||||
void search_open(edit_data *ed);
|
void search_open(Evas_Object *enventor);
|
||||||
void search_close(void);
|
void search_close(void);
|
||||||
Eina_Bool search_is_opened(void);
|
Eina_Bool search_is_opened(void);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Evas_Object *stats_init(Evas_Object *parent);
|
Evas_Object *stats_init(Evas_Object *parent);
|
||||||
void stats_term(void);
|
void stats_term(void);
|
||||||
void stats_view_size_update(void);
|
void stats_view_size_update(Evas_Coord w, Evas_Coord h);
|
||||||
void stats_cursor_pos_update(Evas_Coord x, Evas_Coord y, float rel_x, float rel_y);
|
void stats_cursor_pos_update(Evas_Coord x, Evas_Coord y, float rel_x, float rel_y);
|
||||||
void stats_info_msg_update(const char *msg);
|
void stats_info_msg_update(const char *msg);
|
||||||
void stats_line_num_update(int cur_line, int max_line);
|
void stats_line_num_update(int cur_line, int max_line);
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
color_data *color_init(Eina_Strbuf *strbuf);
|
|
||||||
void color_term(color_data *cd);
|
|
||||||
const char *color_cancel(color_data *cd, const char *str, int length, int from_pos, int to_pos, char **from, char **to);
|
|
||||||
const char *color_apply(color_data *cd, const char *str, int length, char *from, char *to);
|
|
||||||
Eina_Bool color_ready(color_data *cd);
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
syntax_helper *syntax_init(void);
|
|
||||||
void syntax_term(syntax_helper *sh);
|
|
||||||
color_data *syntax_color_data_get(syntax_helper *sh);
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#define REL1_X 0.25f
|
|
||||||
#define REL1_Y 0.25f
|
|
||||||
#define REL2_X 0.75f
|
|
||||||
#define REL2_Y 0.75f
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
TEMPLATE_INSERT_DEFAULT,
|
|
||||||
TEMPLATE_INSERT_LIVE_EDIT
|
|
||||||
} Template_Insert_Type;
|
|
||||||
|
|
||||||
void template_part_insert(edit_data *ed, Edje_Part_Type part_type, Template_Insert_Type insert_type, float rel1_x, float rel1_y, float rel2_x, float rel2_y, const Eina_Stringshare *group_name);
|
|
||||||
void template_insert(edit_data *ed, Template_Insert_Type insert_type);
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
Evas_Object *tools_create(Evas_Object *parent, edit_data *ed);
|
Evas_Object *tools_create(Evas_Object *parent, Evas_Object *enventor);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef ENVENTOR_H
|
||||||
|
#define ENVENTOR_H
|
||||||
|
|
||||||
|
#ifndef ENVENTOR_BETA_API_SUPPORT
|
||||||
|
#error "Enventor APIs still unstable. It's under BETA and changeable!! If you really want to use the APIs, Please define ENVENTOR_BETA_API_SUPPORT"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Efl_Config.h>
|
||||||
|
#include <Elementary.h>
|
||||||
|
|
||||||
|
#ifndef EFL_NOLEGACY_API_SUPPORT
|
||||||
|
#include "Enventor_Legacy.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EFL_EO_API_SUPPORT
|
||||||
|
#include "Enventor_Eo.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EAPI int enventor_init(int argc, char **argv);
|
||||||
|
EAPI int enventor_shutdown(void);
|
||||||
|
EAPI Evas_Object *enventor_object_add(Evas_Object *parent);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef ENVENTOR_H
|
||||||
|
#define ENVENTOR_H
|
||||||
|
|
||||||
|
#ifndef ENVENTOR_BETA_API_SUPPORT
|
||||||
|
#error "Enventor APIs still unstable. It's under BETA and changeable!! If you really want to use the APIs, Please define ENVENTOR_BETA_API_SUPPORT"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Efl_Config.h>
|
||||||
|
#include <Elementary.h>
|
||||||
|
|
||||||
|
#ifndef EFL_NOLEGACY_API_SUPPORT
|
||||||
|
#include "Enventor_Legacy.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EFL_EO_API_SUPPORT
|
||||||
|
#include "Enventor_Eo.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
EAPI int enventor_init(int argc, char **argv);
|
||||||
|
EAPI int enventor_shutdown(void);
|
||||||
|
EAPI Evas_Object *enventor_object_add(Evas_Object *parent);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1 @@
|
||||||
|
#include "enventor_object.eo.h"
|
|
@ -0,0 +1,30 @@
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
ENVENTOR_OUT_EDJ = 0,
|
||||||
|
ENVENTOR_RES_IMAGE,
|
||||||
|
ENVENTOR_RES_SOUND,
|
||||||
|
ENVENTOR_RES_FONT,
|
||||||
|
ENVENTOR_RES_DATA,
|
||||||
|
ENVENTOR_PATH_TYPE_LAST
|
||||||
|
} Enventor_Path_Type;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Evas_Coord x;
|
||||||
|
Evas_Coord y;
|
||||||
|
float relx;
|
||||||
|
float rely;
|
||||||
|
} Enventor_Live_View_Cursor;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Evas_Coord w;
|
||||||
|
Evas_Coord h;
|
||||||
|
} Enventor_Live_View_Size;
|
||||||
|
|
||||||
|
EAPI int enventor_init(int argc, char **argv);
|
||||||
|
EAPI int enventor_shutdown(void);
|
||||||
|
EAPI Evas_Object *enventor_object_add(Evas_Object *parent);
|
||||||
|
EAPI Eina_Bool enventor_object_file_set(Evas_Object *obj, const char *file);
|
||||||
|
|
||||||
|
#include "enventor_object.eo.legacy.h"
|
|
@ -0,0 +1,56 @@
|
||||||
|
AUTOMAKE_OPTIONS = 1.4 foreign
|
||||||
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
|
CLEANFILES =
|
||||||
|
|
||||||
|
EOLIAN_FLAGS = @DEPS_EOLIAN_FLAGS@ \
|
||||||
|
-I$(top_srcdir)/src/lib
|
||||||
|
|
||||||
|
include $(top_srcdir)/Makefile_Eolian_Helper.am
|
||||||
|
include $(top_srcdir)/Makefile_Eolian_Cxx_Helper.am
|
||||||
|
|
||||||
|
AM_CPPFLAGS = -DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" \
|
||||||
|
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||||
|
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||||
|
-I$(top_srcdir)/src/bin \
|
||||||
|
-I$(top_srcdir)/src/include \
|
||||||
|
@ENVENTOR_CFLAGS@
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libenventor.la
|
||||||
|
|
||||||
|
includes_HEADERS = \
|
||||||
|
Enventor.h \
|
||||||
|
Enventor_Legacy.h \
|
||||||
|
Enventor_Eo.h
|
||||||
|
includesdir = $(includedir)/enventor-@ENVENTOR_VERSION_MAJOR@
|
||||||
|
|
||||||
|
libenventor_la_SOURCES = \
|
||||||
|
enventor_main.c \
|
||||||
|
enventor_smart.c \
|
||||||
|
edc_parser.c \
|
||||||
|
indent.c \
|
||||||
|
redoundo.c \
|
||||||
|
syntax_helper.c \
|
||||||
|
syntax_color.c \
|
||||||
|
ctxpopup.c \
|
||||||
|
edc_editor.c \
|
||||||
|
auto_comp.c \
|
||||||
|
build.c \
|
||||||
|
template.c \
|
||||||
|
edj_mgr.c \
|
||||||
|
edj_viewer.c \
|
||||||
|
dummy_obj.c
|
||||||
|
|
||||||
|
libenventor_la_CFLAGS = @ENVENTOR_CFLAGS@
|
||||||
|
libenventor_la_LIBADD = @ENVENTOR_LIBS@
|
||||||
|
|
||||||
|
libenventor_la_LDFLAGS = $(LTLIBINTL) -version-info @version_info@
|
||||||
|
|
||||||
|
BUILT_SOURCES = \
|
||||||
|
enventor_object.eo.c \
|
||||||
|
enventor_object.eo.h \
|
||||||
|
enventor_object.eo.legacy.h
|
||||||
|
|
||||||
|
enventoreolianfilesdir = $(datadir)/eolian/include/enventor-@ENVENTOR_VERSION_MAJOR@
|
||||||
|
enventoreolianfiles_DATA = enventor_object.eo
|
||||||
|
EXTRA_DIST = ${enventoreolianfiles_DATA}
|
|
@ -1,6 +1,12 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
#include "auto_comp_code.h"
|
#include "auto_comp_code.h"
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
#define QUEUE_SIZE 20
|
#define QUEUE_SIZE 20
|
||||||
#define COMPSET_PAIR_MINIMUM 1
|
#define COMPSET_PAIR_MINIMUM 1
|
||||||
|
@ -26,6 +32,7 @@ typedef struct autocomp_s
|
||||||
Ecore_Thread *init_thread;
|
Ecore_Thread *init_thread;
|
||||||
Eina_Bool anchor_visible : 1;
|
Eina_Bool anchor_visible : 1;
|
||||||
Eina_Bool initialized : 1;
|
Eina_Bool initialized : 1;
|
||||||
|
Eina_Bool enabled : 1;
|
||||||
} autocomp_data;
|
} autocomp_data;
|
||||||
|
|
||||||
static autocomp_data *g_ad = NULL;
|
static autocomp_data *g_ad = NULL;
|
||||||
|
@ -33,6 +40,10 @@ static autocomp_data *g_ad = NULL;
|
||||||
#define COMPDATA_SET(ad, key, txt, cursor_offset, line_back) \
|
#define COMPDATA_SET(ad, key, txt, cursor_offset, line_back) \
|
||||||
compdata_set(ad, idx++, key, (char **)(&txt), cursor_offset, line_back, txt##_LINE_CNT)
|
compdata_set(ad, idx++, key, (char **)(&txt), cursor_offset, line_back, txt##_LINE_CNT)
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compdata_set(autocomp_data *ad, int idx, char *key, char **txt, int cursor_offset, int line_back, int line_cnt)
|
compdata_set(autocomp_data *ad, int idx, char *key, char **txt, int cursor_offset, int line_back, int line_cnt)
|
||||||
{
|
{
|
||||||
|
@ -151,7 +162,7 @@ queue_reset(autocomp_data *ad)
|
||||||
static void
|
static void
|
||||||
compset_list_update(autocomp_data *ad)
|
compset_list_update(autocomp_data *ad)
|
||||||
{
|
{
|
||||||
if (!config_auto_complete_get() || !ad->initialized) return;
|
if (!ad->enabled || !ad->initialized) return;
|
||||||
if (ad->queue_pos < COMPSET_PAIR_MINIMUM) return;
|
if (ad->queue_pos < COMPSET_PAIR_MINIMUM) return;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -351,8 +362,7 @@ candidate_list_show(autocomp_data *ad)
|
||||||
{
|
{
|
||||||
//Decide the Tooltip direction
|
//Decide the Tooltip direction
|
||||||
Elm_Tooltip_Orient tooltip_orient = ELM_TOOLTIP_ORIENT_BOTTOM;
|
Elm_Tooltip_Orient tooltip_orient = ELM_TOOLTIP_ORIENT_BOTTOM;
|
||||||
Evas_Object *layout = base_layout_get();
|
evas_object_geometry_get(edit_obj_get(ad->ed), NULL, NULL, NULL, &h);
|
||||||
evas_object_geometry_get(layout, NULL, NULL, NULL, &h);
|
|
||||||
if ((cy + y) > (h / 2)) tooltip_orient = ELM_TOOLTIP_ORIENT_TOP;
|
if ((cy + y) > (h / 2)) tooltip_orient = ELM_TOOLTIP_ORIENT_TOP;
|
||||||
|
|
||||||
//Tooltip set
|
//Tooltip set
|
||||||
|
@ -450,6 +460,10 @@ list_item_move(autocomp_data *ad, Eina_Bool up)
|
||||||
evas_object_smart_callback_add(entry, "unfocused", anchor_unfocused_cb, ad);
|
evas_object_smart_callback_add(entry, "unfocused", anchor_unfocused_cb, ad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
autocomp_target_set(edit_data *ed)
|
autocomp_target_set(edit_data *ed)
|
||||||
{
|
{
|
||||||
|
@ -471,6 +485,8 @@ autocomp_target_set(edit_data *ed)
|
||||||
evas_object_smart_callback_del(entry, "press", entry_press_cb);
|
evas_object_smart_callback_del(entry, "press", entry_press_cb);
|
||||||
evas_object_event_callback_del(entry, EVAS_CALLBACK_MOVE,
|
evas_object_event_callback_del(entry, EVAS_CALLBACK_MOVE,
|
||||||
entry_move_cb);
|
entry_move_cb);
|
||||||
|
evas_object_del(ad->anchor);
|
||||||
|
ad->anchor = NULL;
|
||||||
ad->ed = NULL;
|
ad->ed = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,12 +502,47 @@ autocomp_target_set(edit_data *ed)
|
||||||
evas_object_smart_callback_add(entry, "press", entry_press_cb, ad);
|
evas_object_smart_callback_add(entry, "press", entry_press_cb, ad);
|
||||||
evas_object_event_callback_add(entry, EVAS_CALLBACK_MOVE,
|
evas_object_event_callback_add(entry, EVAS_CALLBACK_MOVE,
|
||||||
entry_move_cb, ad);
|
entry_move_cb, ad);
|
||||||
|
|
||||||
|
ad->anchor = elm_button_add(edit_obj_get(ed));
|
||||||
ad->ed = ed;
|
ad->ed = ed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
autocomp_event_dispatch(const char *key)
|
||||||
|
{
|
||||||
|
autocomp_data *ad = g_ad;
|
||||||
|
if (!ad || !ad->anchor_visible) return EINA_FALSE;
|
||||||
|
|
||||||
|
//Cancel the auto complete.
|
||||||
|
if (!strcmp(key, "BackSpace"))
|
||||||
|
{
|
||||||
|
queue_reset(ad);
|
||||||
|
entry_anchor_off(ad);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (!strcmp(key, "Return"))
|
||||||
|
{
|
||||||
|
insert_completed_text(ad);
|
||||||
|
queue_reset(ad);
|
||||||
|
edit_syntax_color_partial_apply(ad->ed, -1);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (!strcmp(key, "Up"))
|
||||||
|
{
|
||||||
|
list_item_move(ad, EINA_TRUE);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
if (!strcmp(key, "Down"))
|
||||||
|
{
|
||||||
|
list_item_move(ad, EINA_FALSE);
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
autocomp_init(Evas_Object *parent)
|
autocomp_init(void)
|
||||||
{
|
{
|
||||||
autocomp_data *ad = calloc(1, sizeof(autocomp_data));
|
autocomp_data *ad = calloc(1, sizeof(autocomp_data));
|
||||||
if (!ad)
|
if (!ad)
|
||||||
|
@ -499,9 +550,9 @@ autocomp_init(Evas_Object *parent)
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ad->init_thread = ecore_thread_run(init_thread_cb, init_thread_end_cb,
|
ad->init_thread = ecore_thread_run(init_thread_cb, init_thread_end_cb,
|
||||||
init_thread_cancel_cb, ad);
|
init_thread_cancel_cb, ad);
|
||||||
ad->anchor = elm_button_add(parent);
|
|
||||||
ad->queue_pos = -1;
|
ad->queue_pos = -1;
|
||||||
g_ad = ad;
|
g_ad = ad;
|
||||||
}
|
}
|
||||||
|
@ -522,47 +573,16 @@ autocomp_term(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
autocomp_toggle(void)
|
autocomp_enabled_set(Eina_Bool enabled)
|
||||||
{
|
{
|
||||||
Eina_Bool toggle = !config_auto_complete_get();
|
autocomp_data *ad = g_ad;
|
||||||
if (toggle) stats_info_msg_update("Auto Completion Enabled.");
|
enabled = !!enabled;
|
||||||
else stats_info_msg_update("Auto Completion Disabled.");
|
ad->enabled = enabled;
|
||||||
config_auto_complete_set(toggle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
autocomp_key_event_hook(const char *key)
|
autocomp_enabled_get(void)
|
||||||
{
|
{
|
||||||
autocomp_data *ad = g_ad;
|
autocomp_data *ad = g_ad;
|
||||||
if (!ad || !ad->anchor_visible) return EINA_FALSE;
|
return ad->enabled;
|
||||||
|
|
||||||
//Cancel the auto complete.
|
|
||||||
if (!strcmp(key, "BackSpace"))
|
|
||||||
{
|
|
||||||
queue_reset(ad);
|
|
||||||
entry_anchor_off(ad);
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(key, "Return"))
|
|
||||||
{
|
|
||||||
insert_completed_text(ad);
|
|
||||||
queue_reset(ad);
|
|
||||||
edit_syntax_color_partial_apply(ad->ed, -1);
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(key, "Up"))
|
|
||||||
{
|
|
||||||
list_item_move(ad, EINA_TRUE);
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(key, "Down"))
|
|
||||||
{
|
|
||||||
list_item_move(ad, EINA_FALSE);
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
}
|
|
@ -0,0 +1,251 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
|
typedef struct builder_s
|
||||||
|
{
|
||||||
|
Eina_Strbuf *strbuf;
|
||||||
|
char *build_cmd;
|
||||||
|
void (*noti_cb)(void *data, const char *msg);
|
||||||
|
void *noti_data;
|
||||||
|
Eina_Stringshare *edc_path;
|
||||||
|
Eina_List *pathes_list[5];
|
||||||
|
Ecore_Event_Handler *event_data_handler;
|
||||||
|
Ecore_Event_Handler *event_err_handler;
|
||||||
|
|
||||||
|
Eina_Bool build_cmd_changed : 1;
|
||||||
|
|
||||||
|
} build_data;
|
||||||
|
|
||||||
|
static build_data *g_bd = NULL;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
exe_event_error_cb(void *data, int type EINA_UNUSED, void *event_info)
|
||||||
|
{
|
||||||
|
build_data *bd = data;
|
||||||
|
Ecore_Exe_Event_Data *ev = event_info;
|
||||||
|
Ecore_Exe_Event_Data_Line *el;
|
||||||
|
|
||||||
|
eina_strbuf_reset(bd->strbuf);
|
||||||
|
|
||||||
|
for (el = ev->lines; el && el->line; el++)
|
||||||
|
{
|
||||||
|
eina_strbuf_append(bd->strbuf, el->line);
|
||||||
|
eina_strbuf_append_char(bd->strbuf, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
bd->noti_cb(bd->noti_data, eina_strbuf_string_get(bd->strbuf));
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Strbuf *
|
||||||
|
strbuf_path_get(build_data *bd, Enventor_Path_Type type, const char *syntax)
|
||||||
|
{
|
||||||
|
Eina_Strbuf *strbuf = eina_strbuf_new();
|
||||||
|
if (!strbuf)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to new strbuf");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_List *l;
|
||||||
|
Eina_Stringshare *path;
|
||||||
|
EINA_LIST_FOREACH(bd->pathes_list[type], l, path)
|
||||||
|
{
|
||||||
|
eina_strbuf_append(strbuf, syntax);
|
||||||
|
eina_strbuf_append(strbuf, path);
|
||||||
|
}
|
||||||
|
return strbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
build_cmd_set(build_data *bd)
|
||||||
|
{
|
||||||
|
if (!bd->build_cmd_changed) return;
|
||||||
|
free(bd->build_cmd);
|
||||||
|
bd->build_cmd = NULL;
|
||||||
|
|
||||||
|
Eina_Strbuf *strbuf_img = NULL;
|
||||||
|
Eina_Strbuf *strbuf_snd = NULL;
|
||||||
|
Eina_Strbuf *strbuf_fnt = NULL;
|
||||||
|
Eina_Strbuf *strbuf_dat = NULL;
|
||||||
|
|
||||||
|
//Image
|
||||||
|
strbuf_img = strbuf_path_get(bd, ENVENTOR_RES_IMAGE, " -id ");
|
||||||
|
if (!strbuf_img) goto err;
|
||||||
|
|
||||||
|
strbuf_snd = strbuf_path_get(bd, ENVENTOR_RES_SOUND, " -sd ");
|
||||||
|
if (!strbuf_snd) goto err;
|
||||||
|
|
||||||
|
strbuf_fnt = strbuf_path_get(bd, ENVENTOR_RES_FONT, " -fd ");
|
||||||
|
if (!strbuf_fnt) goto err;
|
||||||
|
|
||||||
|
strbuf_dat = strbuf_path_get(bd, ENVENTOR_RES_DATA, " -dd ");
|
||||||
|
if (!strbuf_dat) goto err;
|
||||||
|
|
||||||
|
Eina_Strbuf *strbuf = eina_strbuf_new();
|
||||||
|
if (!strbuf)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to new strbuf");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
eina_strbuf_append_printf(strbuf,
|
||||||
|
"edje_cc -fastcomp %s %s -id %s/images -sd %s/sounds -fd %s/fonts -dd %s/data %s %s %s %s",
|
||||||
|
bd->edc_path,
|
||||||
|
(char *) eina_list_data_get(bd->pathes_list[ENVENTOR_OUT_EDJ]),
|
||||||
|
elm_app_data_dir_get(),
|
||||||
|
elm_app_data_dir_get(),
|
||||||
|
elm_app_data_dir_get(),
|
||||||
|
elm_app_data_dir_get(),
|
||||||
|
eina_strbuf_string_get(strbuf_img),
|
||||||
|
eina_strbuf_string_get(strbuf_snd),
|
||||||
|
eina_strbuf_string_get(strbuf_fnt),
|
||||||
|
eina_strbuf_string_get(strbuf_dat));
|
||||||
|
bd->build_cmd = eina_strbuf_string_steal(strbuf);
|
||||||
|
bd->build_cmd_changed = EINA_FALSE;
|
||||||
|
|
||||||
|
err:
|
||||||
|
eina_strbuf_free(strbuf);
|
||||||
|
eina_strbuf_free(strbuf_img);
|
||||||
|
eina_strbuf_free(strbuf_snd);
|
||||||
|
eina_strbuf_free(strbuf_fnt);
|
||||||
|
eina_strbuf_free(strbuf_dat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
build_edc(void)
|
||||||
|
{
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
|
||||||
|
build_cmd_set(bd);
|
||||||
|
|
||||||
|
if (!bd->build_cmd)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Build Command is not set!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Ecore_Exe_Flags flags =
|
||||||
|
(ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ |
|
||||||
|
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR);
|
||||||
|
ecore_exe_pipe_run(bd->build_cmd, flags, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
build_init(void)
|
||||||
|
{
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
if (bd) return;
|
||||||
|
|
||||||
|
bd = calloc(1, sizeof(build_data));
|
||||||
|
if (!bd)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g_bd = bd;
|
||||||
|
|
||||||
|
bd->event_data_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DATA,
|
||||||
|
exe_event_error_cb, bd);
|
||||||
|
bd->event_err_handler = ecore_event_handler_add(ECORE_EXE_EVENT_ERROR,
|
||||||
|
exe_event_error_cb, bd);
|
||||||
|
bd->strbuf = eina_strbuf_new();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
build_term(void)
|
||||||
|
{
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
eina_stringshare_del(bd->edc_path);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < (sizeof(bd->pathes_list) / sizeof(Eina_List *)); i++)
|
||||||
|
{
|
||||||
|
Eina_Stringshare *path;
|
||||||
|
EINA_LIST_FREE(bd->pathes_list[i], path)
|
||||||
|
eina_stringshare_del(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
ecore_event_handler_del(bd->event_data_handler);
|
||||||
|
ecore_event_handler_del(bd->event_err_handler);
|
||||||
|
eina_strbuf_free(bd->strbuf);
|
||||||
|
free(bd->build_cmd);
|
||||||
|
free(bd);
|
||||||
|
g_bd = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
build_err_noti_cb_set(void (*cb)(void *data, const char *msg), void *data)
|
||||||
|
{
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
bd->noti_cb = cb;
|
||||||
|
bd->noti_data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_List *
|
||||||
|
build_path_get(Enventor_Path_Type type)
|
||||||
|
{
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
return bd->pathes_list[type];
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
build_path_set(Enventor_Path_Type type, const Eina_List *pathes)
|
||||||
|
{
|
||||||
|
if ((type < ENVENTOR_OUT_EDJ) || (type >= ENVENTOR_PATH_TYPE_LAST))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
Eina_Stringshare *path;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
|
//don't allow null edj path
|
||||||
|
if (!pathes && (type == ENVENTOR_OUT_EDJ)) return EINA_FALSE;
|
||||||
|
|
||||||
|
EINA_LIST_FREE(bd->pathes_list[type], path)
|
||||||
|
eina_stringshare_del(path);
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH((Eina_List *)pathes, l, path)
|
||||||
|
bd->pathes_list[type] = eina_list_append(bd->pathes_list[type],
|
||||||
|
eina_stringshare_add(path));
|
||||||
|
bd->build_cmd_changed = EINA_TRUE;
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
build_edj_path_get(void)
|
||||||
|
{
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
return eina_list_data_get(bd->pathes_list[ENVENTOR_OUT_EDJ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
build_edc_path_get(void)
|
||||||
|
{
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
return bd->edc_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
build_edc_path_set(const char *edc_path)
|
||||||
|
{
|
||||||
|
build_data *bd = g_bd;
|
||||||
|
if (bd->edc_path == edc_path) return;
|
||||||
|
eina_stringshare_del(bd->edc_path);
|
||||||
|
bd->edc_path = eina_stringshare_add(edc_path);
|
||||||
|
}
|
|
@ -1,5 +1,11 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
typedef struct ctxpopup_data_s {
|
typedef struct ctxpopup_data_s {
|
||||||
Evas_Smart_Cb selected_cb;
|
Evas_Smart_Cb selected_cb;
|
||||||
|
@ -8,6 +14,10 @@ typedef struct ctxpopup_data_s {
|
||||||
void *data;
|
void *data;
|
||||||
} ctxpopup_data;
|
} ctxpopup_data;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
btn_plus_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
btn_plus_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
|
@ -231,6 +241,94 @@ end:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
image_relay(ctxpopup_data *ctxdata, Eina_Bool up)
|
||||||
|
{
|
||||||
|
if (up)
|
||||||
|
ctxdata->relay_cb(ctxdata->data, ctxdata->ctxpopup, (void *) 0);
|
||||||
|
else
|
||||||
|
ctxdata->relay_cb(ctxdata->data, ctxdata->ctxpopup, (void *) 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ctxpopup_mouse_wheel_cb(void *data, Evas *e EINA_UNUSED,
|
||||||
|
Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
|
{
|
||||||
|
Evas_Event_Mouse_Wheel *ev = event_info;
|
||||||
|
ctxpopup_data *ctxdata = data;
|
||||||
|
|
||||||
|
if (ev->z > 0) image_relay(ctxdata, EINA_FALSE);
|
||||||
|
else if (ev->z < 0) image_relay(ctxdata, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ctxpopup_key_down_cb(void *data, Evas *e EINA_UNUSED,
|
||||||
|
Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
|
{
|
||||||
|
Evas_Event_Key_Down *ev = event_info;
|
||||||
|
ctxpopup_data *ctxdata = data;
|
||||||
|
|
||||||
|
if (!strcmp(ev->key, "Down")) image_relay(ctxdata, EINA_FALSE);
|
||||||
|
else if (!strcmp(ev->key, "Up")) image_relay(ctxdata, EINA_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
ctxpopup_img_preview_create(edit_data *ed,
|
||||||
|
const char *imgpath,
|
||||||
|
Evas_Smart_Cb ctxpopup_dismiss_cb,
|
||||||
|
Evas_Smart_Cb ctxpopup_relay_cb)
|
||||||
|
{
|
||||||
|
//create ctxpopup
|
||||||
|
Evas_Object *ctxpopup = elm_ctxpopup_add(edit_obj_get(ed));
|
||||||
|
if (!ctxpopup) return NULL;
|
||||||
|
|
||||||
|
elm_object_style_set(ctxpopup, "enventor");
|
||||||
|
elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_LEFT,
|
||||||
|
ELM_CTXPOPUP_DIRECTION_UP,
|
||||||
|
ELM_CTXPOPUP_DIRECTION_DOWN,
|
||||||
|
ELM_CTXPOPUP_DIRECTION_RIGHT);
|
||||||
|
//ctxpopup data
|
||||||
|
ctxpopup_data *ctxdata = malloc(sizeof(ctxpopup_data));
|
||||||
|
if (!ctxdata)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ctxdata->relay_cb = ctxpopup_relay_cb;
|
||||||
|
ctxdata->data = ed;
|
||||||
|
ctxdata->ctxpopup = ctxpopup;
|
||||||
|
evas_object_data_set(ctxpopup, "ctxpopup_data", ctxdata);
|
||||||
|
|
||||||
|
//Layout
|
||||||
|
Evas_Object *layout = elm_layout_add(ctxpopup);
|
||||||
|
elm_layout_file_set(layout, EDJE_PATH, "preview_layout");
|
||||||
|
elm_object_content_set(ctxpopup, layout);
|
||||||
|
|
||||||
|
Evas *e = evas_object_evas_get(ctxpopup);
|
||||||
|
Evas_Object *img = evas_object_image_filled_add(e);
|
||||||
|
evas_object_image_file_set(img, imgpath, NULL);
|
||||||
|
Evas_Coord w, h;
|
||||||
|
evas_object_image_size_get(img, &w, &h);
|
||||||
|
evas_object_size_hint_aspect_set(img, EVAS_ASPECT_CONTROL_BOTH, w, h);
|
||||||
|
elm_object_part_content_set(layout, "elm.swallow.img", img);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismiss_cb,
|
||||||
|
ed);
|
||||||
|
evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, ctxpopup_del_cb,
|
||||||
|
ctxdata);
|
||||||
|
evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_KEY_DOWN,
|
||||||
|
ctxpopup_key_down_cb, ctxdata);
|
||||||
|
evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_MOUSE_WHEEL,
|
||||||
|
ctxpopup_mouse_wheel_cb, ctxdata);
|
||||||
|
evas_object_focus_set(ctxpopup, EINA_TRUE);
|
||||||
|
|
||||||
|
return ctxpopup;
|
||||||
|
}
|
||||||
|
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
ctxpopup_candidate_list_create(edit_data *ed, attr_value *attr,
|
ctxpopup_candidate_list_create(edit_data *ed, attr_value *attr,
|
||||||
double slider_val,
|
double slider_val,
|
||||||
|
@ -238,10 +336,10 @@ ctxpopup_candidate_list_create(edit_data *ed, attr_value *attr,
|
||||||
Evas_Smart_Cb ctxpopup_selected_cb)
|
Evas_Smart_Cb ctxpopup_selected_cb)
|
||||||
{
|
{
|
||||||
//create ctxpopup
|
//create ctxpopup
|
||||||
Evas_Object *ctxpopup = elm_ctxpopup_add(base_layout_get());
|
Evas_Object *ctxpopup = elm_ctxpopup_add(edit_obj_get(ed));
|
||||||
if (!ctxpopup) return NULL;
|
if (!ctxpopup) return NULL;
|
||||||
|
|
||||||
elm_object_style_set(ctxpopup, elm_app_name_get());
|
elm_object_style_set(ctxpopup, "enventor");
|
||||||
|
|
||||||
//ctxpopup data
|
//ctxpopup data
|
||||||
ctxpopup_data *ctxdata = malloc(sizeof(ctxpopup_data));
|
ctxpopup_data *ctxdata = malloc(sizeof(ctxpopup_data));
|
||||||
|
@ -305,85 +403,3 @@ err:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
image_relay(ctxpopup_data *ctxdata, Eina_Bool up)
|
|
||||||
{
|
|
||||||
if (up)
|
|
||||||
ctxdata->relay_cb(ctxdata->data, ctxdata->ctxpopup, (void *) 0);
|
|
||||||
else
|
|
||||||
ctxdata->relay_cb(ctxdata->data, ctxdata->ctxpopup, (void *) 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ctxpopup_mouse_wheel_cb(void *data, Evas *e EINA_UNUSED,
|
|
||||||
Evas_Object *obj EINA_UNUSED, void *event_info)
|
|
||||||
{
|
|
||||||
Evas_Event_Mouse_Wheel *ev = event_info;
|
|
||||||
ctxpopup_data *ctxdata = data;
|
|
||||||
|
|
||||||
if (ev->z > 0) image_relay(ctxdata, EINA_FALSE);
|
|
||||||
else if (ev->z < 0) image_relay(ctxdata, EINA_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ctxpopup_key_down_cb(void *data, Evas *e EINA_UNUSED,
|
|
||||||
Evas_Object *obj EINA_UNUSED, void *event_info)
|
|
||||||
{
|
|
||||||
Evas_Event_Key_Down *ev = event_info;
|
|
||||||
ctxpopup_data *ctxdata = data;
|
|
||||||
|
|
||||||
if (!strcmp(ev->key, "Down")) image_relay(ctxdata, EINA_FALSE);
|
|
||||||
else if (!strcmp(ev->key, "Up")) image_relay(ctxdata, EINA_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Evas_Object *
|
|
||||||
ctxpopup_img_preview_create(edit_data *ed,
|
|
||||||
const char *imgpath,
|
|
||||||
Evas_Smart_Cb ctxpopup_dismiss_cb,
|
|
||||||
Evas_Smart_Cb ctxpopup_relay_cb)
|
|
||||||
{
|
|
||||||
//create ctxpopup
|
|
||||||
Evas_Object *ctxpopup = elm_ctxpopup_add(base_layout_get());
|
|
||||||
if (!ctxpopup) return NULL;
|
|
||||||
|
|
||||||
elm_object_style_set(ctxpopup, elm_app_name_get());
|
|
||||||
elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_LEFT,
|
|
||||||
ELM_CTXPOPUP_DIRECTION_UP,
|
|
||||||
ELM_CTXPOPUP_DIRECTION_DOWN,
|
|
||||||
ELM_CTXPOPUP_DIRECTION_RIGHT);
|
|
||||||
//ctxpopup data
|
|
||||||
ctxpopup_data *ctxdata = malloc(sizeof(ctxpopup_data));
|
|
||||||
if (!ctxdata)
|
|
||||||
{
|
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
ctxdata->relay_cb = ctxpopup_relay_cb;
|
|
||||||
ctxdata->data = ed;
|
|
||||||
ctxdata->ctxpopup = ctxpopup;
|
|
||||||
evas_object_data_set(ctxpopup, "ctxpopup_data", ctxdata);
|
|
||||||
|
|
||||||
//Layout
|
|
||||||
Evas_Object *layout = elm_layout_add(ctxpopup);
|
|
||||||
elm_layout_file_set(layout, EDJE_PATH, "preview_layout");
|
|
||||||
elm_object_content_set(ctxpopup, layout);
|
|
||||||
|
|
||||||
Evas *e = evas_object_evas_get(ctxpopup);
|
|
||||||
Evas_Object *img = evas_object_image_filled_add(e);
|
|
||||||
evas_object_image_file_set(img, imgpath, NULL);
|
|
||||||
Evas_Coord w, h;
|
|
||||||
evas_object_image_size_get(img, &w, &h);
|
|
||||||
evas_object_size_hint_aspect_set(img, EVAS_ASPECT_CONTROL_BOTH, w, h);
|
|
||||||
elm_object_part_content_set(layout, "elm.swallow.img", img);
|
|
||||||
|
|
||||||
evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismiss_cb,
|
|
||||||
ed);
|
|
||||||
evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, ctxpopup_del_cb,
|
|
||||||
ctxdata);
|
|
||||||
evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_KEY_DOWN,
|
|
||||||
ctxpopup_key_down_cb, ctxdata);
|
|
||||||
evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_MOUSE_WHEEL,
|
|
||||||
ctxpopup_mouse_wheel_cb, ctxdata);
|
|
||||||
evas_object_focus_set(ctxpopup, EINA_TRUE);
|
|
||||||
return ctxpopup;
|
|
||||||
}
|
|
|
@ -1,8 +1,13 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT 1
|
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT 1
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Enventor.h>
|
||||||
#include <Edje_Edit.h>
|
#include <Edje_Edit.h>
|
||||||
#include "common.h"
|
#include "enventor_private.h"
|
||||||
|
|
||||||
typedef struct part_obj_s
|
typedef struct part_obj_s
|
||||||
{
|
{
|
||||||
|
@ -19,7 +24,11 @@ typedef struct dummy_obj_s
|
||||||
|
|
||||||
const char *DUMMYOBJ = "dummy_obj";
|
const char *DUMMYOBJ = "dummy_obj";
|
||||||
|
|
||||||
void
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
dummy_objs_update(dummy_obj *dummy)
|
dummy_objs_update(dummy_obj *dummy)
|
||||||
{
|
{
|
||||||
Eina_List *parts = edje_edit_parts_list_get(dummy->layout);
|
Eina_List *parts = edje_edit_parts_list_get(dummy->layout);
|
||||||
|
@ -104,6 +113,10 @@ layout_del_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj,
|
||||||
dummy_obj_del(obj);
|
dummy_obj_del(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
dummy_obj_update(Evas_Object *layout)
|
dummy_obj_update(Evas_Object *layout)
|
||||||
{
|
{
|
||||||
|
@ -135,7 +148,8 @@ dummy_obj_new(Evas_Object *layout)
|
||||||
dummy->animator = animator;
|
dummy->animator = animator;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dummy_obj_del(Evas_Object *layout)
|
void
|
||||||
|
dummy_obj_del(Evas_Object *layout)
|
||||||
{
|
{
|
||||||
dummy_obj *dummy = evas_object_data_get(layout, DUMMYOBJ);
|
dummy_obj *dummy = evas_object_data_get(layout, DUMMYOBJ);
|
||||||
if (!dummy) return;
|
if (!dummy) return;
|
|
@ -1,5 +1,12 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include <Eio.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
//FIXME: Make flexible
|
//FIXME: Make flexible
|
||||||
const int MAX_LINE_DIGIT_CNT = 10;
|
const int MAX_LINE_DIGIT_CNT = 10;
|
||||||
|
@ -20,7 +27,7 @@ struct editor_s
|
||||||
Evas_Object *en_line;
|
Evas_Object *en_line;
|
||||||
Evas_Object *scroller;
|
Evas_Object *scroller;
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
Evas_Object *parent;
|
Evas_Object *enventor;
|
||||||
|
|
||||||
syntax_helper *sh;
|
syntax_helper *sh;
|
||||||
parser_data *pd;
|
parser_data *pd;
|
||||||
|
@ -38,13 +45,21 @@ struct editor_s
|
||||||
Eina_Stringshare *group_name);
|
Eina_Stringshare *group_name);
|
||||||
void *view_sync_cb_data;
|
void *view_sync_cb_data;
|
||||||
int select_pos;
|
int select_pos;
|
||||||
|
double font_scale;
|
||||||
|
|
||||||
Eina_Bool edit_changed : 1;
|
Eina_Bool edit_changed : 1;
|
||||||
Eina_Bool linenumber : 1;
|
Eina_Bool linenumber : 1;
|
||||||
Eina_Bool ctrl_pressed : 1;
|
Eina_Bool ctrl_pressed : 1;
|
||||||
Eina_Bool on_select_recover : 1;
|
Eina_Bool on_select_recover : 1;
|
||||||
|
Eina_Bool auto_indent : 1;
|
||||||
|
Eina_Bool part_highlight : 1;
|
||||||
|
Eina_Bool ctxpopup: 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
image_preview_show(edit_data *ed, char *cur, Evas_Coord x, Evas_Coord y);
|
image_preview_show(edit_data *ed, char *cur, Evas_Coord x, Evas_Coord y);
|
||||||
|
|
||||||
|
@ -193,37 +208,6 @@ syntax_color_thread_cancel_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
free(td);
|
free(td);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
syntax_color_full_update(edit_data *ed, Eina_Bool thread)
|
|
||||||
{
|
|
||||||
if (ed->syntax_color_lock > 0) return;
|
|
||||||
|
|
||||||
ecore_timer_del(ed->syntax_color_timer);
|
|
||||||
ed->syntax_color_timer = NULL;
|
|
||||||
|
|
||||||
if (thread)
|
|
||||||
{
|
|
||||||
syntax_color_td *td = calloc(1, sizeof(syntax_color_td));
|
|
||||||
if (!td)
|
|
||||||
{
|
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
td->ed = ed;
|
|
||||||
Evas_Object *tb = elm_entry_textblock_get(ed->en_edit);
|
|
||||||
td->text = (char *) evas_object_textblock_text_markup_get(tb);
|
|
||||||
ed->syntax_color_thread =
|
|
||||||
ecore_thread_run(syntax_color_thread_cb,
|
|
||||||
syntax_color_thread_end_cb,
|
|
||||||
syntax_color_thread_cancel_cb,
|
|
||||||
td);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
syntax_color_apply(ed, EINA_FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
{
|
{
|
||||||
|
@ -250,7 +234,7 @@ edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
edit_line_increase(ed, increase);
|
edit_line_increase(ed, increase);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_auto_indent_get())
|
if (ed->auto_indent)
|
||||||
indent_insert_apply(syntax_indent_data_get(ed->sh), ed->en_edit,
|
indent_insert_apply(syntax_indent_data_get(ed->sh), ed->en_edit,
|
||||||
info->change.insert.content, ed->cur_line);
|
info->change.insert.content, ed->cur_line);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +242,7 @@ edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
{
|
{
|
||||||
int decrease = parser_line_cnt_get(ed->pd, info->change.del.content);
|
int decrease = parser_line_cnt_get(ed->pd, info->change.del.content);
|
||||||
|
|
||||||
if (config_auto_indent_get())
|
if (ed->auto_indent)
|
||||||
{
|
{
|
||||||
if (indent_delete_apply(syntax_indent_data_get(ed->sh),
|
if (indent_delete_apply(syntax_indent_data_get(ed->sh),
|
||||||
ed->en_edit, info->change.del.content,
|
ed->en_edit, info->change.del.content,
|
||||||
|
@ -274,50 +258,6 @@ edit_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
syntax_color_partial_update(ed, SYNTAX_COLOR_DEFAULT_TIME);
|
syntax_color_partial_update(ed, SYNTAX_COLOR_DEFAULT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
save_msg_show(edit_data *ed)
|
|
||||||
{
|
|
||||||
if (!config_stats_bar_get()) return;
|
|
||||||
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
if (ed->edit_changed)
|
|
||||||
snprintf(buf, sizeof(buf), "File saved. \"%s\"", config_edc_path_get());
|
|
||||||
else
|
|
||||||
snprintf(buf, sizeof(buf), "Already saved. \"%s\"", config_edc_path_get());
|
|
||||||
|
|
||||||
stats_info_msg_update(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
|
||||||
edit_save(edit_data *ed)
|
|
||||||
{
|
|
||||||
if (!ed->edit_changed)
|
|
||||||
{
|
|
||||||
save_msg_show(ed);
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *text = elm_entry_entry_get(ed->en_edit);
|
|
||||||
char *utf8 = elm_entry_markup_to_utf8(text);
|
|
||||||
|
|
||||||
FILE *fp = fopen(config_edc_path_get(), "w");
|
|
||||||
if (!fp) return EINA_FALSE;
|
|
||||||
|
|
||||||
fputs(utf8, fp);
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
free(utf8);
|
|
||||||
|
|
||||||
save_msg_show(ed);
|
|
||||||
//FIXME: If compile edc here? we can edit_changed FALSE;
|
|
||||||
//edit_changed_set(ed, EINA_FALSE);
|
|
||||||
|
|
||||||
edit_view_sync(ed);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ctxpopup_candidate_dismiss_cb(void *data, Evas_Object *obj,
|
ctxpopup_candidate_dismiss_cb(void *data, Evas_Object *obj,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
|
@ -326,6 +266,7 @@ ctxpopup_candidate_dismiss_cb(void *data, Evas_Object *obj,
|
||||||
evas_object_del(obj);
|
evas_object_del(obj);
|
||||||
elm_object_disabled_set(ed->layout, EINA_FALSE);
|
elm_object_disabled_set(ed->layout, EINA_FALSE);
|
||||||
elm_object_focus_set(ed->en_edit, EINA_TRUE);
|
elm_object_focus_set(ed->en_edit, EINA_TRUE);
|
||||||
|
evas_object_smart_callback_call(ed->enventor, SIG_CTXPOPUP_DISMISSED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -337,7 +278,8 @@ ctxpopup_candidate_selected_cb(void *data, Evas_Object *obj, void *event_info)
|
||||||
elm_entry_entry_insert(ed->en_edit, text);
|
elm_entry_entry_insert(ed->en_edit, text);
|
||||||
elm_ctxpopup_dismiss(obj);
|
elm_ctxpopup_dismiss(obj);
|
||||||
edit_changed_set(ed, EINA_TRUE);
|
edit_changed_set(ed, EINA_TRUE);
|
||||||
edit_save(ed);
|
evas_object_smart_callback_call(ed->enventor, SIG_CTXPOPUP_SELECTED,
|
||||||
|
(void *)text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -354,57 +296,6 @@ ctxpopup_preview_dismiss_cb(void *data, Evas_Object *obj,
|
||||||
elm_object_focus_set(ed->en_edit, EINA_TRUE);
|
elm_object_focus_set(ed->en_edit, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
edit_syntax_color_full_apply(edit_data *ed, Eina_Bool force)
|
|
||||||
{
|
|
||||||
int lock;
|
|
||||||
|
|
||||||
if (force)
|
|
||||||
{
|
|
||||||
lock = ed->syntax_color_lock;
|
|
||||||
ed->syntax_color_lock = -1;
|
|
||||||
}
|
|
||||||
syntax_color_full_update(ed, EINA_FALSE);
|
|
||||||
|
|
||||||
if (force) ed->syntax_color_lock = lock;
|
|
||||||
else ed->syntax_color_lock++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
edit_syntax_color_partial_apply(edit_data *ed, double interval)
|
|
||||||
{
|
|
||||||
if (ed->syntax_color_lock > 0) ed->syntax_color_lock = 0;
|
|
||||||
if (interval < 0) syntax_color_partial_update(ed, SYNTAX_COLOR_DEFAULT_TIME);
|
|
||||||
else syntax_color_partial_update(ed, interval);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cur_line_pos_set(edit_data *ed, Eina_Bool force)
|
|
||||||
{
|
|
||||||
Evas_Coord y, h;
|
|
||||||
elm_entry_cursor_geometry_get(ed->en_edit, NULL, &y, NULL, &h);
|
|
||||||
int line = (y / h) + 1;
|
|
||||||
|
|
||||||
if (line < 0) line = 1;
|
|
||||||
if (!force && (ed->cur_line == line)) return;
|
|
||||||
ed->cur_line = line;
|
|
||||||
|
|
||||||
if (!config_stats_bar_get()) return;
|
|
||||||
stats_line_num_update(ed->cur_line, ed->line_max);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
program_run(edit_data *ed, char *cur)
|
|
||||||
{
|
|
||||||
char *program = parser_name_get(ed->pd, cur);
|
|
||||||
if (program)
|
|
||||||
{
|
|
||||||
view_data *vd = edj_mgr_view_get(NULL);
|
|
||||||
view_program_run(vd, program);
|
|
||||||
free(program);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//This function is called when user press up/down key or mouse wheel up/down
|
//This function is called when user press up/down key or mouse wheel up/down
|
||||||
static void
|
static void
|
||||||
preview_img_relay_show(edit_data *ed, Evas_Object *ctxpopup, Eina_Bool next)
|
preview_img_relay_show(edit_data *ed, Evas_Object *ctxpopup, Eina_Bool next)
|
||||||
|
@ -457,7 +348,9 @@ preview_img_relay_show(edit_data *ed, Evas_Object *ctxpopup, Eina_Bool next)
|
||||||
cursor_pos);
|
cursor_pos);
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
|
#if 0
|
||||||
menu_ctxpopup_unregister(ctxpopup);
|
menu_ctxpopup_unregister(ctxpopup);
|
||||||
|
#endif
|
||||||
elm_ctxpopup_dismiss(ctxpopup);
|
elm_ctxpopup_dismiss(ctxpopup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +371,7 @@ image_preview_show(edit_data *ed, char *cur, Evas_Coord x, Evas_Coord y)
|
||||||
char fullpath[PATH_MAX];
|
char fullpath[PATH_MAX];
|
||||||
|
|
||||||
//1.Find the image path.
|
//1.Find the image path.
|
||||||
Eina_List *list = config_edc_img_path_list_get();
|
Eina_List *list = build_path_get(ENVENTOR_RES_IMAGE);
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
char *path;
|
char *path;
|
||||||
Eina_Bool found = EINA_FALSE;
|
Eina_Bool found = EINA_FALSE;
|
||||||
|
@ -516,16 +409,14 @@ image_preview_show(edit_data *ed, char *cur, Evas_Coord x, Evas_Coord y)
|
||||||
|
|
||||||
evas_object_move(ctxpopup, x, y);
|
evas_object_move(ctxpopup, x, y);
|
||||||
evas_object_show(ctxpopup);
|
evas_object_show(ctxpopup);
|
||||||
|
#if 0
|
||||||
menu_ctxpopup_register(ctxpopup);
|
menu_ctxpopup_register(ctxpopup);
|
||||||
|
#endif
|
||||||
elm_object_disabled_set(ed->layout, EINA_TRUE);
|
elm_object_disabled_set(ed->layout, EINA_TRUE);
|
||||||
succeed = EINA_TRUE;
|
succeed = EINA_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
|
||||||
snprintf(buf, sizeof(buf), "Failed to load the image. \"%s\"",
|
|
||||||
filename);
|
|
||||||
stats_info_msg_update(buf);
|
|
||||||
succeed = EINA_FALSE;
|
succeed = EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,10 +442,24 @@ candidate_list_show(edit_data *ed, char *text, char *cur, char *selected)
|
||||||
evas_pointer_output_xy_get(evas_object_evas_get(ed->en_edit), &x, &y);
|
evas_pointer_output_xy_get(evas_object_evas_get(ed->en_edit), &x, &y);
|
||||||
evas_object_move(ctxpopup, x, y);
|
evas_object_move(ctxpopup, x, y);
|
||||||
evas_object_show(ctxpopup);
|
evas_object_show(ctxpopup);
|
||||||
|
#if 0
|
||||||
menu_ctxpopup_register(ctxpopup);
|
menu_ctxpopup_register(ctxpopup);
|
||||||
|
#endif
|
||||||
elm_object_disabled_set(ed->layout, EINA_TRUE);
|
elm_object_disabled_set(ed->layout, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
program_run(edit_data *ed, char *cur)
|
||||||
|
{
|
||||||
|
char *program = parser_name_get(ed->pd, cur);
|
||||||
|
if (program)
|
||||||
|
{
|
||||||
|
view_data *vd = edj_mgr_view_get(NULL);
|
||||||
|
view_program_run(vd, program);
|
||||||
|
free(program);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
edit_cursor_double_clicked_cb(void *data, Evas_Object *obj,
|
edit_cursor_double_clicked_cb(void *data, Evas_Object *obj,
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
|
@ -562,9 +467,11 @@ edit_cursor_double_clicked_cb(void *data, Evas_Object *obj,
|
||||||
edit_data *ed = data;
|
edit_data *ed = data;
|
||||||
|
|
||||||
if (ed->ctrl_pressed) return;
|
if (ed->ctrl_pressed) return;
|
||||||
|
if (!ed->ctxpopup) return;
|
||||||
|
|
||||||
char *selected = (char *) elm_entry_selection_get(obj);
|
char *selected = (char *) elm_entry_selection_get(obj);
|
||||||
if (!selected) return;
|
if (!selected) return;
|
||||||
|
|
||||||
selected = elm_entry_markup_to_utf8(selected);
|
selected = elm_entry_markup_to_utf8(selected);
|
||||||
if (selected[0] == '\"')
|
if (selected[0] == '\"')
|
||||||
{
|
{
|
||||||
|
@ -599,7 +506,7 @@ edit_cursor_double_clicked_cb(void *data, Evas_Object *obj,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cur_name_get_cb(void *data, Eina_Stringshare *part_name,
|
cur_name_get_cb(void *data, Eina_Stringshare *part_name,
|
||||||
Eina_Stringshare *group_name)
|
Eina_Stringshare *group_name)
|
||||||
{
|
{
|
||||||
edit_data *ed = data;
|
edit_data *ed = data;
|
||||||
|
|
||||||
|
@ -607,13 +514,19 @@ cur_name_get_cb(void *data, Eina_Stringshare *part_name,
|
||||||
ed->view_sync_cb(ed->view_sync_cb_data, part_name, group_name);
|
ed->view_sync_cb(ed->view_sync_cb_data, part_name, group_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
edit_view_sync(edit_data *ed)
|
cur_line_pos_set(edit_data *ed, Eina_Bool force)
|
||||||
{
|
{
|
||||||
if (!config_part_highlight_get())
|
Evas_Coord y, h;
|
||||||
parser_cur_group_name_get(ed->pd, ed->en_edit, cur_name_get_cb, ed);
|
elm_entry_cursor_geometry_get(ed->en_edit, NULL, &y, NULL, &h);
|
||||||
else
|
int line = (y / h) + 1;
|
||||||
parser_cur_name_get(ed->pd, ed->en_edit, cur_name_get_cb, ed);
|
|
||||||
|
if (line < 0) line = 1;
|
||||||
|
if (!force && (ed->cur_line == line)) return;
|
||||||
|
ed->cur_line = line;
|
||||||
|
|
||||||
|
evas_object_smart_callback_call(ed->enventor, SIG_CURSOR_LINE_CHANGED,
|
||||||
|
(void *)line);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -651,84 +564,35 @@ edit_cursor_changed_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
cur_line_pos_set(ed, EINA_FALSE);
|
cur_line_pos_set(ed, EINA_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
edit_view_sync_cb_set(edit_data *ed,
|
syntax_color_full_update(edit_data *ed, Eina_Bool thread)
|
||||||
void (*cb)(void *data, Eina_Stringshare *part_name,
|
|
||||||
Eina_Stringshare *group_name), void *data)
|
|
||||||
{
|
{
|
||||||
ed->view_sync_cb = cb;
|
if (ed->syntax_color_lock > 0) return;
|
||||||
ed->view_sync_cb_data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
ecore_timer_del(ed->syntax_color_timer);
|
||||||
edit_line_delete(edit_data *ed)
|
ed->syntax_color_timer = NULL;
|
||||||
{
|
|
||||||
if (!elm_object_focus_get(ed->en_edit)) return;
|
|
||||||
|
|
||||||
Evas_Object *textblock = elm_entry_textblock_get(ed->en_edit);
|
if (thread)
|
||||||
|
|
||||||
int line1 = ed->cur_line - 1;
|
|
||||||
int line2 = ed->cur_line;
|
|
||||||
|
|
||||||
//min position case
|
|
||||||
if (line1 < 0)
|
|
||||||
{
|
{
|
||||||
line1 = 0;
|
syntax_color_td *td = calloc(1, sizeof(syntax_color_td));
|
||||||
line2 = 1;
|
if (!td)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
td->ed = ed;
|
||||||
|
Evas_Object *tb = elm_entry_textblock_get(ed->en_edit);
|
||||||
|
td->text = (char *) evas_object_textblock_text_markup_get(tb);
|
||||||
|
ed->syntax_color_thread =
|
||||||
|
ecore_thread_run(syntax_color_thread_cb,
|
||||||
|
syntax_color_thread_end_cb,
|
||||||
|
syntax_color_thread_cancel_cb,
|
||||||
|
td);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//Max position case
|
|
||||||
Eina_Bool max = EINA_FALSE;
|
|
||||||
if (line2 >= ed->line_max)
|
|
||||||
{
|
{
|
||||||
line1 = (ed->line_max - 2);
|
syntax_color_apply(ed, EINA_FALSE);
|
||||||
line2 = (ed->line_max - 1);
|
|
||||||
max = EINA_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//only one line remain. clear it.
|
|
||||||
if (ed->line_max == 1)
|
|
||||||
{
|
|
||||||
redoundo_text_push(ed->rd, elm_entry_entry_get(ed->en_edit), 0, 0,
|
|
||||||
EINA_FALSE);
|
|
||||||
elm_entry_entry_set(ed->en_edit, "");
|
|
||||||
line_init(ed);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Evas_Textblock_Cursor *cur1 = evas_object_textblock_cursor_new(textblock);
|
|
||||||
evas_textblock_cursor_line_set(cur1, line1);
|
|
||||||
if (max) evas_textblock_cursor_line_char_last(cur1);
|
|
||||||
|
|
||||||
Evas_Textblock_Cursor *cur2 = evas_object_textblock_cursor_new(textblock);
|
|
||||||
evas_textblock_cursor_line_set(cur2, line2);
|
|
||||||
if (max) evas_textblock_cursor_line_char_last(cur2);
|
|
||||||
int cur1_pos, cur2_pos;
|
|
||||||
|
|
||||||
cur1_pos = evas_textblock_cursor_pos_get(cur1);
|
|
||||||
cur2_pos = evas_textblock_cursor_pos_get(cur2);
|
|
||||||
const char *content = evas_textblock_cursor_range_text_get(cur1, cur2,
|
|
||||||
EVAS_TEXTBLOCK_TEXT_MARKUP);
|
|
||||||
|
|
||||||
evas_textblock_cursor_range_delete(cur1, cur2);
|
|
||||||
evas_textblock_cursor_free(cur1);
|
|
||||||
evas_textblock_cursor_free(cur2);
|
|
||||||
redoundo_text_push(ed->rd, content, cur1_pos, abs(cur2_pos - cur1_pos),
|
|
||||||
EINA_FALSE);
|
|
||||||
elm_entry_calc_force(ed->en_edit);
|
|
||||||
|
|
||||||
edit_line_decrease(ed, 1);
|
|
||||||
|
|
||||||
cur_line_pos_set(ed, EINA_TRUE);
|
|
||||||
edit_changed_set(ed, EINA_TRUE);
|
|
||||||
|
|
||||||
syntax_color_partial_update(ed, SYNTAX_COLOR_DEFAULT_TIME);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
edit_cur_indent_depth_get(edit_data *ed)
|
|
||||||
{
|
|
||||||
return indent_space_get(syntax_indent_data_get(ed->sh), ed->en_edit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -741,13 +605,17 @@ edit_redoundo(edit_data *ed, Eina_Bool undo)
|
||||||
else lines = redoundo_redo(ed->rd, &changed);
|
else lines = redoundo_redo(ed->rd, &changed);
|
||||||
if (!changed)
|
if (!changed)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if (undo) stats_info_msg_update("No text to be undo.");
|
if (undo) stats_info_msg_update("No text to be undo.");
|
||||||
else stats_info_msg_update("No text to be redo.");
|
else stats_info_msg_update("No text to be redo.");
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (undo) stats_info_msg_update("Undo text.");
|
if (undo) stats_info_msg_update("Undo text.");
|
||||||
else stats_info_msg_update("Redo text.");
|
else stats_info_msg_update("Redo text.");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (lines > 0) edit_line_increase(ed, lines);
|
if (lines > 0) edit_line_increase(ed, lines);
|
||||||
else edit_line_decrease(ed, abs(lines));
|
else edit_line_decrease(ed, abs(lines));
|
||||||
|
@ -840,8 +708,219 @@ scroller_vbar_unpress_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||||
syntax_color_partial_update(ed, SYNTAX_COLOR_SHORT_TIME);
|
syntax_color_partial_update(ed, SYNTAX_COLOR_SHORT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
edit_edc_load(edit_data *ed, const char *file_path)
|
||||||
|
{
|
||||||
|
char buf[MAX_LINE_DIGIT_CNT];
|
||||||
|
|
||||||
|
Eina_File *file = NULL;
|
||||||
|
Eina_Strbuf *strbuf_line = NULL;
|
||||||
|
char *utf8_edit = NULL;
|
||||||
|
char *markup_edit = NULL;
|
||||||
|
char *markup_line = NULL;
|
||||||
|
int line_num = 1;
|
||||||
|
Eina_Bool ret = EINA_FALSE;
|
||||||
|
|
||||||
|
ed->line_max = 0;
|
||||||
|
|
||||||
|
file = eina_file_open(file_path, EINA_FALSE);
|
||||||
|
if (!file) goto err;
|
||||||
|
|
||||||
|
strbuf_line = eina_strbuf_new();
|
||||||
|
if (!strbuf_line) goto err;
|
||||||
|
|
||||||
|
utf8_edit = eina_file_map_all(file, EINA_FILE_POPULATE);
|
||||||
|
if (!utf8_edit) goto err;
|
||||||
|
|
||||||
|
//Append line numbers
|
||||||
|
if (!eina_strbuf_append_char(strbuf_line, '1')) goto err;
|
||||||
|
char *p = utf8_edit;
|
||||||
|
int len = strlen(p);
|
||||||
|
while ((p = strchr(p, '\n')) && p < (utf8_edit + len))
|
||||||
|
{
|
||||||
|
line_num++;
|
||||||
|
++p;
|
||||||
|
sprintf(buf, "\n%d", line_num);
|
||||||
|
if (!eina_strbuf_append(strbuf_line, buf)) goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
markup_line = elm_entry_utf8_to_markup(eina_strbuf_string_get(strbuf_line));
|
||||||
|
if (!markup_line) goto err;
|
||||||
|
elm_entry_entry_append(ed->en_line, markup_line);
|
||||||
|
free(markup_line);
|
||||||
|
|
||||||
|
markup_edit = elm_entry_utf8_to_markup(utf8_edit);
|
||||||
|
if (!markup_edit) goto err;
|
||||||
|
elm_entry_entry_set(ed->en_edit, markup_edit);
|
||||||
|
free(markup_edit);
|
||||||
|
|
||||||
|
ed->line_max = line_num;
|
||||||
|
|
||||||
|
Eina_Stringshare *group_name =
|
||||||
|
parser_first_group_name_get(ed->pd, ed->en_edit);
|
||||||
|
|
||||||
|
ecore_animator_add(syntax_color_timer_cb, ed);
|
||||||
|
|
||||||
|
ret = EINA_TRUE;
|
||||||
|
|
||||||
|
err:
|
||||||
|
//Even any text is not inserted, line number should start with 1
|
||||||
|
if (ed->line_max == 0) line_init(ed);
|
||||||
|
if (strbuf_line) eina_strbuf_free(strbuf_line);
|
||||||
|
if (utf8_edit) eina_file_map_free(file, utf8_edit);
|
||||||
|
if (file) eina_file_close(file);
|
||||||
|
|
||||||
|
evas_object_smart_callback_call(ed->enventor, SIG_MAX_LINE_CHANGED,
|
||||||
|
(void *)ed->line_max);
|
||||||
|
|
||||||
|
if (ed->view_sync_cb)
|
||||||
|
ed->view_sync_cb(ed->view_sync_cb_data, NULL, group_name);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_view_sync_cb_set(edit_data *ed,
|
||||||
|
void (*cb)(void *data, Eina_Stringshare *part_name,
|
||||||
|
Eina_Stringshare *group_name), void *data)
|
||||||
|
{
|
||||||
|
ed->view_sync_cb = cb;
|
||||||
|
ed->view_sync_cb_data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
edit_save(edit_data *ed, const char *file)
|
||||||
|
{
|
||||||
|
if (!ed->edit_changed) return EINA_FALSE;
|
||||||
|
|
||||||
|
const char *text = elm_entry_entry_get(ed->en_edit);
|
||||||
|
char *utf8 = elm_entry_markup_to_utf8(text);
|
||||||
|
FILE *fp = fopen(file, "w");
|
||||||
|
if (!fp)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to open file \"%s\"", file);
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
fputs(utf8, fp);
|
||||||
|
fclose(fp);
|
||||||
|
free(utf8);
|
||||||
|
|
||||||
|
edit_view_sync(ed);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_syntax_color_full_apply(edit_data *ed, Eina_Bool force)
|
||||||
|
{
|
||||||
|
int lock;
|
||||||
|
|
||||||
|
if (force)
|
||||||
|
{
|
||||||
|
lock = ed->syntax_color_lock;
|
||||||
|
ed->syntax_color_lock = -1;
|
||||||
|
}
|
||||||
|
syntax_color_full_update(ed, EINA_FALSE);
|
||||||
|
|
||||||
|
if (force) ed->syntax_color_lock = lock;
|
||||||
|
else ed->syntax_color_lock++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_syntax_color_partial_apply(edit_data *ed, double interval)
|
||||||
|
{
|
||||||
|
if (ed->syntax_color_lock > 0) ed->syntax_color_lock = 0;
|
||||||
|
if (interval < 0) syntax_color_partial_update(ed, SYNTAX_COLOR_DEFAULT_TIME);
|
||||||
|
else syntax_color_partial_update(ed, interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_view_sync(edit_data *ed)
|
||||||
|
{
|
||||||
|
if (!ed->part_highlight)
|
||||||
|
parser_cur_group_name_get(ed->pd, ed->en_edit, cur_name_get_cb, ed);
|
||||||
|
else
|
||||||
|
parser_cur_name_get(ed->pd, ed->en_edit, cur_name_get_cb, ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_line_delete(edit_data *ed)
|
||||||
|
{
|
||||||
|
if (!elm_object_focus_get(ed->en_edit)) return;
|
||||||
|
|
||||||
|
Evas_Object *textblock = elm_entry_textblock_get(ed->en_edit);
|
||||||
|
|
||||||
|
int line1 = ed->cur_line - 1;
|
||||||
|
int line2 = ed->cur_line;
|
||||||
|
|
||||||
|
//min position case
|
||||||
|
if (line1 < 0)
|
||||||
|
{
|
||||||
|
line1 = 0;
|
||||||
|
line2 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Max position case
|
||||||
|
Eina_Bool max = EINA_FALSE;
|
||||||
|
if (line2 >= ed->line_max)
|
||||||
|
{
|
||||||
|
line1 = (ed->line_max - 2);
|
||||||
|
line2 = (ed->line_max - 1);
|
||||||
|
max = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//only one line remain. clear it.
|
||||||
|
if (ed->line_max == 1)
|
||||||
|
{
|
||||||
|
redoundo_text_push(ed->rd, elm_entry_entry_get(ed->en_edit), 0, 0,
|
||||||
|
EINA_FALSE);
|
||||||
|
elm_entry_entry_set(ed->en_edit, "");
|
||||||
|
line_init(ed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Evas_Textblock_Cursor *cur1 = evas_object_textblock_cursor_new(textblock);
|
||||||
|
evas_textblock_cursor_line_set(cur1, line1);
|
||||||
|
if (max) evas_textblock_cursor_line_char_last(cur1);
|
||||||
|
|
||||||
|
Evas_Textblock_Cursor *cur2 = evas_object_textblock_cursor_new(textblock);
|
||||||
|
evas_textblock_cursor_line_set(cur2, line2);
|
||||||
|
if (max) evas_textblock_cursor_line_char_last(cur2);
|
||||||
|
int cur1_pos, cur2_pos;
|
||||||
|
|
||||||
|
cur1_pos = evas_textblock_cursor_pos_get(cur1);
|
||||||
|
cur2_pos = evas_textblock_cursor_pos_get(cur2);
|
||||||
|
const char *content = evas_textblock_cursor_range_text_get(cur1, cur2,
|
||||||
|
EVAS_TEXTBLOCK_TEXT_MARKUP);
|
||||||
|
|
||||||
|
evas_textblock_cursor_range_delete(cur1, cur2);
|
||||||
|
evas_textblock_cursor_free(cur1);
|
||||||
|
evas_textblock_cursor_free(cur2);
|
||||||
|
redoundo_text_push(ed->rd, content, cur1_pos, abs(cur2_pos - cur1_pos),
|
||||||
|
EINA_FALSE);
|
||||||
|
elm_entry_calc_force(ed->en_edit);
|
||||||
|
|
||||||
|
edit_line_decrease(ed, 1);
|
||||||
|
|
||||||
|
cur_line_pos_set(ed, EINA_TRUE);
|
||||||
|
edit_changed_set(ed, EINA_TRUE);
|
||||||
|
|
||||||
|
syntax_color_partial_update(ed, SYNTAX_COLOR_DEFAULT_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
edit_cur_indent_depth_get(edit_data *ed)
|
||||||
|
{
|
||||||
|
return indent_space_get(syntax_indent_data_get(ed->sh), ed->en_edit);
|
||||||
|
}
|
||||||
|
|
||||||
edit_data *
|
edit_data *
|
||||||
edit_init(Evas_Object *parent)
|
edit_init(Evas_Object *enventor)
|
||||||
{
|
{
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
parser_data *pd = parser_init();
|
parser_data *pd = parser_init();
|
||||||
|
@ -860,7 +939,7 @@ edit_init(Evas_Object *parent)
|
||||||
ecore_event_handler_add(ECORE_EVENT_KEY_UP, key_up_cb, ed);
|
ecore_event_handler_add(ECORE_EVENT_KEY_UP, key_up_cb, ed);
|
||||||
|
|
||||||
//Scroller
|
//Scroller
|
||||||
Evas_Object *scroller = elm_scroller_add(parent);
|
Evas_Object *scroller = elm_scroller_add(enventor);
|
||||||
elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO,
|
elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO,
|
||||||
ELM_SCROLLER_POLICY_AUTO);
|
ELM_SCROLLER_POLICY_AUTO);
|
||||||
elm_object_focus_allow_set(scroller, EINA_FALSE);
|
elm_object_focus_allow_set(scroller, EINA_FALSE);
|
||||||
|
@ -878,6 +957,9 @@ edit_init(Evas_Object *parent)
|
||||||
EVAS_HINT_EXPAND);
|
EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
|
//This is hackish call to not change scroller color by widget.
|
||||||
|
evas_object_data_set(scroller, "_elm_leaveme", (void *)1);
|
||||||
|
|
||||||
//Layout
|
//Layout
|
||||||
Evas_Object *layout = elm_layout_add(scroller);
|
Evas_Object *layout = elm_layout_add(scroller);
|
||||||
elm_layout_file_set(layout, EDJE_PATH, "edit_layout");
|
elm_layout_file_set(layout, EDJE_PATH, "edit_layout");
|
||||||
|
@ -920,13 +1002,14 @@ edit_init(Evas_Object *parent)
|
||||||
ed->en_line = en_line;
|
ed->en_line = en_line;
|
||||||
ed->en_edit = en_edit;
|
ed->en_edit = en_edit;
|
||||||
ed->layout = layout;
|
ed->layout = layout;
|
||||||
ed->parent = parent;
|
ed->enventor = enventor;
|
||||||
ed->linenumber = EINA_TRUE;
|
ed->linenumber = EINA_TRUE;
|
||||||
|
ed->auto_indent = EINA_TRUE;
|
||||||
|
ed->part_highlight = EINA_TRUE;
|
||||||
|
ed->ctxpopup = EINA_TRUE;
|
||||||
ed->cur_line = -1;
|
ed->cur_line = -1;
|
||||||
ed->select_pos = -1;
|
ed->select_pos = -1;
|
||||||
|
ed->font_scale = 1;
|
||||||
edit_line_number_toggle(ed);
|
|
||||||
edit_font_size_update(ed, EINA_FALSE, EINA_FALSE);
|
|
||||||
|
|
||||||
ed->rd = redoundo_init(en_edit);
|
ed->rd = redoundo_init(en_edit);
|
||||||
evas_object_data_set(ed->en_edit, "redoundo", ed->rd);
|
evas_object_data_set(ed->en_edit, "redoundo", ed->rd);
|
||||||
|
@ -934,12 +1017,6 @@ edit_init(Evas_Object *parent)
|
||||||
return ed;
|
return ed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
edit_editable_set(edit_data *ed, Eina_Bool editable)
|
|
||||||
{
|
|
||||||
elm_entry_editable_set(ed->en_edit, editable);
|
|
||||||
}
|
|
||||||
|
|
||||||
Evas_Object *
|
Evas_Object *
|
||||||
edit_obj_get(edit_data *ed)
|
edit_obj_get(edit_data *ed)
|
||||||
{
|
{
|
||||||
|
@ -963,80 +1040,6 @@ edit_term(edit_data *ed)
|
||||||
parser_term(pd);
|
parser_term(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
edit_edc_read(edit_data *ed, const char *file_path)
|
|
||||||
{
|
|
||||||
char buf[MAX_LINE_DIGIT_CNT];
|
|
||||||
|
|
||||||
Eina_File *file = NULL;
|
|
||||||
Eina_Strbuf *strbuf_line = NULL;
|
|
||||||
char *utf8_edit = NULL;
|
|
||||||
char *markup_edit = NULL;
|
|
||||||
char *markup_line = NULL;
|
|
||||||
int line_num = 1;
|
|
||||||
|
|
||||||
ed->line_max = 0;
|
|
||||||
|
|
||||||
autocomp_target_set(NULL);
|
|
||||||
|
|
||||||
file = eina_file_open(file_path, EINA_FALSE);
|
|
||||||
if (!file) goto err;
|
|
||||||
|
|
||||||
strbuf_line = eina_strbuf_new();
|
|
||||||
if (!strbuf_line) goto err;
|
|
||||||
|
|
||||||
base_title_set(file_path);
|
|
||||||
|
|
||||||
utf8_edit = eina_file_map_all(file, EINA_FILE_POPULATE);
|
|
||||||
if (!utf8_edit) goto err;
|
|
||||||
|
|
||||||
//Append line numbers
|
|
||||||
if (!eina_strbuf_append_char(strbuf_line, '1')) goto err;
|
|
||||||
char *p = utf8_edit;
|
|
||||||
int len = strlen(p);
|
|
||||||
while ((p = strchr(p, '\n')) && p < (utf8_edit + len))
|
|
||||||
{
|
|
||||||
line_num++;
|
|
||||||
++p;
|
|
||||||
sprintf(buf, "\n%d", line_num);
|
|
||||||
if (!eina_strbuf_append(strbuf_line, buf)) goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
markup_line = elm_entry_utf8_to_markup(eina_strbuf_string_get(strbuf_line));
|
|
||||||
if (!markup_line) goto err;
|
|
||||||
elm_entry_entry_append(ed->en_line, markup_line);
|
|
||||||
free(markup_line);
|
|
||||||
|
|
||||||
markup_edit = elm_entry_utf8_to_markup(utf8_edit);
|
|
||||||
if (!markup_edit) goto err;
|
|
||||||
elm_entry_entry_set(ed->en_edit, markup_edit);
|
|
||||||
free(markup_edit);
|
|
||||||
|
|
||||||
ed->line_max = line_num;
|
|
||||||
|
|
||||||
Eina_Stringshare *group_name =
|
|
||||||
parser_first_group_name_get(ed->pd, ed->en_edit);
|
|
||||||
|
|
||||||
stats_edc_group_update(group_name);
|
|
||||||
|
|
||||||
ecore_animator_add(syntax_color_timer_cb, ed);
|
|
||||||
|
|
||||||
err:
|
|
||||||
//Even any text is not inserted, line number should start with 1
|
|
||||||
if (ed->line_max == 0) line_init(ed);
|
|
||||||
if (strbuf_line) eina_strbuf_free(strbuf_line);
|
|
||||||
if (utf8_edit) eina_file_map_free(file, utf8_edit);
|
|
||||||
if (file) eina_file_close(file);
|
|
||||||
autocomp_target_set(ed);
|
|
||||||
stats_line_num_update(1, ed->line_max);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
edit_focus_set(edit_data *ed)
|
|
||||||
{
|
|
||||||
elm_object_focus_set(ed->en_edit, EINA_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
edit_changed_get(edit_data *ed)
|
edit_changed_get(edit_data *ed)
|
||||||
{
|
{
|
||||||
|
@ -1049,13 +1052,17 @@ edit_changed_set(edit_data *ed, Eina_Bool changed)
|
||||||
ed->edit_changed = changed;
|
ed->edit_changed = changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
Eina_Bool
|
||||||
edit_line_number_toggle(edit_data *ed)
|
edit_linenumber_get(edit_data *ed)
|
||||||
|
{
|
||||||
|
return ed->linenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_linenumber_set(edit_data *ed, Eina_Bool linenumber)
|
||||||
{
|
{
|
||||||
//FIXME: edit & config toggle should be handled in one place.
|
|
||||||
Eina_Bool linenumber = config_linenumber_get();
|
|
||||||
if (ed->linenumber == linenumber) return;
|
if (ed->linenumber == linenumber) return;
|
||||||
ed->linenumber = linenumber;
|
ed->linenumber = !!linenumber;
|
||||||
|
|
||||||
if (linenumber)
|
if (linenumber)
|
||||||
elm_object_signal_emit(ed->layout, "elm,state,linenumber,show", "");
|
elm_object_signal_emit(ed->layout, "elm,state,linenumber,show", "");
|
||||||
|
@ -1064,57 +1071,54 @@ edit_line_number_toggle(edit_data *ed)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
edit_new(edit_data *ed)
|
edit_font_scale_set(edit_data *ed, double font_scale)
|
||||||
{
|
{
|
||||||
|
if (ed->font_scale == font_scale) return;
|
||||||
|
elm_object_scale_set(ed->layout, font_scale);
|
||||||
|
syntax_color_partial_update(ed, 0);
|
||||||
|
ed->font_scale = font_scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
edit_font_scale_get(edit_data *ed)
|
||||||
|
{
|
||||||
|
return ed->font_scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_part_highlight_set(edit_data *ed, Eina_Bool part_highlight)
|
||||||
|
{
|
||||||
|
part_highlight = !!part_highlight;
|
||||||
|
|
||||||
|
if (ed->part_highlight == part_highlight) return;
|
||||||
|
|
||||||
|
ed->part_highlight = part_highlight;
|
||||||
|
|
||||||
|
if (part_highlight) edit_view_sync(ed);
|
||||||
|
else view_part_highlight_set(VIEW_DATA, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
edit_part_highlight_get(edit_data *ed)
|
||||||
|
{
|
||||||
|
return ed->part_highlight;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
edit_load(edit_data *ed, const char *edc_path)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
live_edit_cancel();
|
||||||
|
#endif
|
||||||
parser_cancel(ed->pd);
|
parser_cancel(ed->pd);
|
||||||
elm_entry_entry_set(ed->en_edit, "");
|
elm_entry_entry_set(ed->en_edit, "");
|
||||||
elm_entry_entry_set(ed->en_line, "");
|
elm_entry_entry_set(ed->en_line, "");
|
||||||
edit_edc_read(ed, config_edc_path_get());
|
Eina_Bool ret = edit_edc_load(ed, edc_path);
|
||||||
edit_changed_set(ed, EINA_TRUE);
|
edit_changed_set(ed, EINA_TRUE);
|
||||||
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
snprintf(buf, sizeof(buf), "File Path: \"%s\"", config_edc_path_get());
|
|
||||||
stats_info_msg_update(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
edit_font_size_update(edit_data *ed, Eina_Bool msg, Eina_Bool update)
|
|
||||||
{
|
|
||||||
elm_object_scale_set(ed->layout, config_font_size_get());
|
|
||||||
|
|
||||||
if (!msg) return;
|
|
||||||
|
|
||||||
char buf[128];
|
|
||||||
snprintf(buf, sizeof(buf), "Font Size: %1.1fx", config_font_size_get());
|
|
||||||
stats_info_msg_update(buf);
|
|
||||||
|
|
||||||
if (update) syntax_color_partial_update(ed, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
edit_part_highlight_toggle(edit_data *ed, Eina_Bool msg)
|
|
||||||
{
|
|
||||||
Eina_Bool highlight = config_part_highlight_get();
|
|
||||||
if (highlight) edit_view_sync(ed);
|
|
||||||
else view_part_highlight_set(VIEW_DATA, NULL);
|
|
||||||
|
|
||||||
if (!msg) return;
|
|
||||||
|
|
||||||
if (highlight)
|
|
||||||
stats_info_msg_update("Part Highlighting Enabled.");
|
|
||||||
else
|
|
||||||
stats_info_msg_update("Part Highlighting Disabled.");
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
edit_edc_reload(edit_data *ed, const char *edc_path)
|
|
||||||
{
|
|
||||||
live_edit_cancel();
|
|
||||||
config_edc_path_set(edc_path);
|
|
||||||
edit_new(ed);
|
|
||||||
edj_mgr_reload_need_set(EINA_TRUE);
|
edj_mgr_reload_need_set(EINA_TRUE);
|
||||||
config_apply();
|
|
||||||
redoundo_clear(ed->rd);
|
redoundo_clear(ed->rd);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Stringshare *
|
Eina_Stringshare *
|
||||||
|
@ -1172,7 +1176,8 @@ edit_line_increase(edit_data *ed, int cnt)
|
||||||
}
|
}
|
||||||
elm_entry_calc_force(ed->en_line);
|
elm_entry_calc_force(ed->en_line);
|
||||||
|
|
||||||
stats_line_num_update(ed->cur_line, ed->line_max);
|
evas_object_smart_callback_call(ed->enventor, SIG_MAX_LINE_CHANGED,
|
||||||
|
(void *)ed->line_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1202,7 +1207,9 @@ edit_line_decrease(edit_data *ed, int cnt)
|
||||||
ed->line_max -= cnt;
|
ed->line_max -= cnt;
|
||||||
|
|
||||||
if (ed->line_max < 1) line_init(ed);
|
if (ed->line_max < 1) line_init(ed);
|
||||||
stats_line_num_update(ed->cur_line, ed->line_max);
|
|
||||||
|
evas_object_smart_callback_call(ed->enventor, SIG_MAX_LINE_CHANGED,
|
||||||
|
(void *)ed->line_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1225,3 +1232,29 @@ edit_disabled_set(edit_data *ed, Eina_Bool disabled)
|
||||||
else
|
else
|
||||||
elm_object_signal_emit(ed->layout, "elm,state,enabled", "");
|
elm_object_signal_emit(ed->layout, "elm,state,enabled", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_auto_indent_set(edit_data *ed, Eina_Bool auto_indent)
|
||||||
|
{
|
||||||
|
auto_indent = !!auto_indent;
|
||||||
|
ed->auto_indent = auto_indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
edit_auto_indent_get(edit_data *ed)
|
||||||
|
{
|
||||||
|
return ed->auto_indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
edit_ctxpopup_get(edit_data *ed)
|
||||||
|
{
|
||||||
|
return ed->ctxpopup;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edit_ctxpopup_set(edit_data *ed, Eina_Bool ctxpopup)
|
||||||
|
{
|
||||||
|
ctxpopup = !!ctxpopup;
|
||||||
|
ed->ctxpopup = ctxpopup;
|
||||||
|
}
|
|
@ -1,5 +1,11 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
struct parser_s
|
struct parser_s
|
||||||
{
|
{
|
||||||
|
@ -33,75 +39,9 @@ typedef struct type_init_thread_data_s
|
||||||
parser_data *pd;
|
parser_data *pd;
|
||||||
} type_init_td;
|
} type_init_td;
|
||||||
|
|
||||||
void
|
/*****************************************************************************/
|
||||||
parser_cancel(parser_data *pd)
|
/* Internal method implementation */
|
||||||
{
|
/*****************************************************************************/
|
||||||
if (pd->thread) ecore_thread_cancel(pd->thread);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
parser_name_get(parser_data *pd EINA_UNUSED, const char *cur)
|
|
||||||
{
|
|
||||||
if (!cur) return NULL;
|
|
||||||
|
|
||||||
char *p = (char *) cur;
|
|
||||||
char *end;
|
|
||||||
p = strstr(p, "\"");
|
|
||||||
if (!p) return NULL;
|
|
||||||
p++;
|
|
||||||
end = strstr(p, "\"");
|
|
||||||
if (!end) return NULL;
|
|
||||||
return strndup(p, (end - p));
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
parser_colon_pos_get(parser_data *pd EINA_UNUSED, const char *cur)
|
|
||||||
{
|
|
||||||
if (!cur) return NULL;
|
|
||||||
return strstr(cur, ":");
|
|
||||||
}
|
|
||||||
|
|
||||||
attr_value *
|
|
||||||
parser_attribute_get(parser_data *pd, const char *text, const char *cur)
|
|
||||||
{
|
|
||||||
if (!text || !cur) return NULL;
|
|
||||||
if ((*cur == ';') || (*cur == ':')) return NULL;
|
|
||||||
|
|
||||||
parser_attr *attr;
|
|
||||||
Eina_Bool instring = EINA_FALSE;
|
|
||||||
Eina_Bool necessary = EINA_FALSE;
|
|
||||||
|
|
||||||
char *p = (char *) cur;
|
|
||||||
|
|
||||||
while (p >= text)
|
|
||||||
{
|
|
||||||
if (*p == ':')
|
|
||||||
{
|
|
||||||
necessary = EINA_TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (*p == '\"') instring = !instring;
|
|
||||||
p--;
|
|
||||||
}
|
|
||||||
if (!p || !necessary) return NULL;
|
|
||||||
|
|
||||||
while (p > text)
|
|
||||||
{
|
|
||||||
if ((*p == ';') || (*p == '.') || (*p == ' ')) break;
|
|
||||||
p--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!p) return NULL;
|
|
||||||
if (p != text) p++;
|
|
||||||
|
|
||||||
EINA_INARRAY_FOREACH(pd->attrs, attr)
|
|
||||||
{
|
|
||||||
if ((instring == attr->instring) && strstr(p, attr->keyword))
|
|
||||||
return &attr->value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
group_name_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
group_name_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
|
@ -577,6 +517,162 @@ type_init_thread_cancel(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
free(td);
|
free(td);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
end_of_parts_block_find(const char *pos)
|
||||||
|
{
|
||||||
|
//TODO: Process comments and quotes.
|
||||||
|
pos = strstr(pos, "parts");
|
||||||
|
if (!pos) return NULL;
|
||||||
|
pos = strstr(pos, "{");
|
||||||
|
if (!pos) return NULL;
|
||||||
|
pos++;
|
||||||
|
char level = 1;
|
||||||
|
|
||||||
|
while (*pos)
|
||||||
|
{
|
||||||
|
if (*pos == '{') level++;
|
||||||
|
else if (*pos == '}') level--;
|
||||||
|
|
||||||
|
if (!level) return --pos;
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
group_beginning_pos_get(const char* source, const char *group_name)
|
||||||
|
{
|
||||||
|
const char* GROUP_SYNTAX_NAME = "group";
|
||||||
|
const char *quot = QUOT;
|
||||||
|
|
||||||
|
const char *pos = strstr(source, GROUP_SYNTAX_NAME);
|
||||||
|
|
||||||
|
//TODO: Process comments and quotes.
|
||||||
|
while (pos)
|
||||||
|
{
|
||||||
|
const char *name = strstr(pos, quot);
|
||||||
|
if (!name) return NULL;
|
||||||
|
pos = strstr(++name, quot);
|
||||||
|
if (!pos) return NULL;
|
||||||
|
if (!strncmp(name, group_name, strlen(group_name)))
|
||||||
|
return pos;
|
||||||
|
pos = strstr(++pos, GROUP_SYNTAX_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
parser_collections_block_pos_get(const Evas_Object *entry,
|
||||||
|
const char *block_name, int *ret)
|
||||||
|
{
|
||||||
|
const char* GROUP_SYNTAX_NAME = "group";
|
||||||
|
const int BLOCK_NAME_LEN = strlen(block_name);
|
||||||
|
*ret = -1;
|
||||||
|
|
||||||
|
const char *text = elm_entry_entry_get(entry);
|
||||||
|
if (!text) return EINA_FALSE;
|
||||||
|
|
||||||
|
char *utf8 = elm_entry_markup_to_utf8(text);
|
||||||
|
if (!utf8) return EINA_FALSE;
|
||||||
|
|
||||||
|
const char *pos = strstr(utf8, block_name);
|
||||||
|
if (pos)
|
||||||
|
{
|
||||||
|
/* TODO: Remove this check and process lines of the form
|
||||||
|
"images.image: "logo.png" COMP;" */
|
||||||
|
if (*(pos + BLOCK_NAME_LEN + 1) == '.')
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
pos = strstr(pos, "{\n");
|
||||||
|
if (!pos) return EINA_FALSE;
|
||||||
|
|
||||||
|
*ret = pos - utf8 + 2;
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
pos = strstr(utf8, GROUP_SYNTAX_NAME);
|
||||||
|
if (pos)
|
||||||
|
{
|
||||||
|
*ret = pos - utf8;
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
parser_cancel(parser_data *pd)
|
||||||
|
{
|
||||||
|
if (pd->thread) ecore_thread_cancel(pd->thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
parser_name_get(parser_data *pd EINA_UNUSED, const char *cur)
|
||||||
|
{
|
||||||
|
if (!cur) return NULL;
|
||||||
|
|
||||||
|
char *p = (char *) cur;
|
||||||
|
char *end;
|
||||||
|
p = strstr(p, "\"");
|
||||||
|
if (!p) return NULL;
|
||||||
|
p++;
|
||||||
|
end = strstr(p, "\"");
|
||||||
|
if (!end) return NULL;
|
||||||
|
return strndup(p, (end - p));
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
parser_colon_pos_get(parser_data *pd EINA_UNUSED, const char *cur)
|
||||||
|
{
|
||||||
|
if (!cur) return NULL;
|
||||||
|
return strstr(cur, ":");
|
||||||
|
}
|
||||||
|
|
||||||
|
attr_value *
|
||||||
|
parser_attribute_get(parser_data *pd, const char *text, const char *cur)
|
||||||
|
{
|
||||||
|
if (!text || !cur) return NULL;
|
||||||
|
if ((*cur == ';') || (*cur == ':')) return NULL;
|
||||||
|
|
||||||
|
parser_attr *attr;
|
||||||
|
Eina_Bool instring = EINA_FALSE;
|
||||||
|
Eina_Bool necessary = EINA_FALSE;
|
||||||
|
|
||||||
|
char *p = (char *) cur;
|
||||||
|
|
||||||
|
while (p >= text)
|
||||||
|
{
|
||||||
|
if (*p == ':')
|
||||||
|
{
|
||||||
|
necessary = EINA_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*p == '\"') instring = !instring;
|
||||||
|
p--;
|
||||||
|
}
|
||||||
|
if (!p || !necessary) return NULL;
|
||||||
|
|
||||||
|
while (p > text)
|
||||||
|
{
|
||||||
|
if ((*p == ';') || (*p == '.') || (*p == ' ')) break;
|
||||||
|
p--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!p) return NULL;
|
||||||
|
if (p != text) p++;
|
||||||
|
|
||||||
|
EINA_INARRAY_FOREACH(pd->attrs, attr)
|
||||||
|
{
|
||||||
|
if ((instring == attr->instring) && strstr(p, attr->keyword))
|
||||||
|
return &attr->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Eina_Stringshare *
|
Eina_Stringshare *
|
||||||
parser_paragh_name_get(parser_data *pd EINA_UNUSED, Evas_Object *entry)
|
parser_paragh_name_get(parser_data *pd EINA_UNUSED, Evas_Object *entry)
|
||||||
{
|
{
|
||||||
|
@ -931,52 +1027,6 @@ parser_term(parser_data *pd)
|
||||||
free(pd);
|
free(pd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
|
||||||
end_of_parts_block_find(const char *pos)
|
|
||||||
{
|
|
||||||
//TODO: Process comments and quotes.
|
|
||||||
pos = strstr(pos, "parts");
|
|
||||||
if (!pos) return NULL;
|
|
||||||
pos = strstr(pos, "{");
|
|
||||||
if (!pos) return NULL;
|
|
||||||
pos++;
|
|
||||||
char level = 1;
|
|
||||||
|
|
||||||
while (*pos)
|
|
||||||
{
|
|
||||||
if (*pos == '{') level++;
|
|
||||||
else if (*pos == '}') level--;
|
|
||||||
|
|
||||||
if (!level) return --pos;
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
group_beginning_pos_get(const char* source, const char *group_name)
|
|
||||||
{
|
|
||||||
const char* GROUP_SYNTAX_NAME = "group";
|
|
||||||
const int quot_len = QUOT_LEN;
|
|
||||||
const char *quot = QUOT;
|
|
||||||
|
|
||||||
const char *pos = strstr(source, GROUP_SYNTAX_NAME);
|
|
||||||
|
|
||||||
//TODO: Process comments and quotes.
|
|
||||||
while (pos)
|
|
||||||
{
|
|
||||||
const char *name = strstr(pos, quot);
|
|
||||||
if (!name) return NULL;
|
|
||||||
pos = strstr(++name, quot);
|
|
||||||
if (!pos) return NULL;
|
|
||||||
if (!strncmp(name, group_name, strlen(group_name)))
|
|
||||||
return pos;
|
|
||||||
pos = strstr(++pos, GROUP_SYNTAX_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
parser_end_of_parts_block_pos_get(const Evas_Object *entry,
|
parser_end_of_parts_block_pos_get(const Evas_Object *entry,
|
||||||
const char *group_name)
|
const char *group_name)
|
||||||
|
@ -1010,43 +1060,6 @@ parser_end_of_parts_block_pos_get(const Evas_Object *entry,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
parser_collections_block_pos_get(const Evas_Object *entry,
|
|
||||||
const char *block_name, int *ret)
|
|
||||||
{
|
|
||||||
const char* GROUP_SYNTAX_NAME = "group";
|
|
||||||
const int BLOCK_NAME_LEN = strlen(block_name);
|
|
||||||
*ret = -1;
|
|
||||||
|
|
||||||
const char *text = elm_entry_entry_get(entry);
|
|
||||||
if (!text) return EINA_FALSE;
|
|
||||||
|
|
||||||
char *utf8 = elm_entry_markup_to_utf8(text);
|
|
||||||
if (!utf8) return EINA_FALSE;
|
|
||||||
|
|
||||||
const char *pos = strstr(utf8, block_name);
|
|
||||||
if (pos)
|
|
||||||
{
|
|
||||||
/* TODO: Remove this check and process lines of the form
|
|
||||||
"images.image: "logo.png" COMP;" */
|
|
||||||
if (*(pos + BLOCK_NAME_LEN + 1) == '.')
|
|
||||||
return EINA_FALSE;
|
|
||||||
|
|
||||||
pos = strstr(pos, "{\n");
|
|
||||||
if (!pos) return EINA_FALSE;
|
|
||||||
|
|
||||||
*ret = pos - utf8 + 2;
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
pos = strstr(utf8, GROUP_SYNTAX_NAME);
|
|
||||||
if (pos)
|
|
||||||
{
|
|
||||||
*ret = pos - utf8;
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
parser_images_pos_get(const Evas_Object *entry, int *ret)
|
parser_images_pos_get(const Evas_Object *entry, int *ret)
|
||||||
{
|
{
|
|
@ -1,5 +1,11 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
const double VIEW_CACHING_TIME = 60 * 30;
|
const double VIEW_CACHING_TIME = 60 * 30;
|
||||||
|
|
||||||
|
@ -13,13 +19,19 @@ typedef struct edj_mgr_s
|
||||||
{
|
{
|
||||||
Eina_List *edjs;
|
Eina_List *edjs;
|
||||||
edj_data *edj;
|
edj_data *edj;
|
||||||
|
Evas_Object *enventor;
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
|
double view_scale;
|
||||||
|
|
||||||
Eina_Bool reload_need : 1;
|
Eina_Bool reload_need : 1;
|
||||||
} edj_mgr;
|
} edj_mgr;
|
||||||
|
|
||||||
static edj_mgr *g_em = NULL;
|
static edj_mgr *g_em = NULL;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
view_del_cb(void *data)
|
view_del_cb(void *data)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +53,10 @@ view_del_timer_cb(void *data)
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
edj_mgr_clear(void)
|
edj_mgr_clear(void)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +75,7 @@ edj_mgr_clear(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
edj_mgr_init(Evas_Object *parent)
|
edj_mgr_init(Evas_Object *enventor)
|
||||||
{
|
{
|
||||||
edj_mgr *em = calloc(1, sizeof(edj_mgr));
|
edj_mgr *em = calloc(1, sizeof(edj_mgr));
|
||||||
if (!em)
|
if (!em)
|
||||||
|
@ -69,9 +85,11 @@ edj_mgr_init(Evas_Object *parent)
|
||||||
}
|
}
|
||||||
g_em = em;
|
g_em = em;
|
||||||
|
|
||||||
Evas_Object *layout = elm_layout_add(parent);
|
Evas_Object *layout = elm_layout_add(enventor);
|
||||||
elm_layout_file_set(layout, EDJE_PATH, "viewer_layout");
|
elm_layout_file_set(layout, EDJE_PATH, "viewer_layout");
|
||||||
|
em->enventor = enventor;
|
||||||
em->layout = layout;
|
em->layout = layout;
|
||||||
|
em->view_scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -125,7 +143,7 @@ edj_mgr_view_new(const char *group)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
view_data *vd = view_init(em->layout, group, view_del_cb, edj);
|
view_data *vd = view_init(em->enventor, group, view_del_cb, edj);
|
||||||
if (!vd)
|
if (!vd)
|
||||||
{
|
{
|
||||||
free(edj);
|
free(edj);
|
||||||
|
@ -153,7 +171,7 @@ edj_mgr_view_switch_to(view_data *vd)
|
||||||
elm_object_part_content_set(em->layout, "elm.swallow.content",
|
elm_object_part_content_set(em->layout, "elm.swallow.content",
|
||||||
view_obj_get(vd));
|
view_obj_get(vd));
|
||||||
|
|
||||||
view_scale_set(vd, config_view_scale_get());
|
view_scale_set(vd, em->view_scale);
|
||||||
|
|
||||||
//Switching effect
|
//Switching effect
|
||||||
if (prev && (prev != view_obj_get(vd)))
|
if (prev && (prev != view_obj_get(vd)))
|
||||||
|
@ -206,3 +224,19 @@ edj_mgr_reload_need_get(void)
|
||||||
edj_mgr *em = g_em;
|
edj_mgr *em = g_em;
|
||||||
return em->reload_need;
|
return em->reload_need;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
edj_mgr_view_scale_set(double view_scale)
|
||||||
|
{
|
||||||
|
edj_mgr *em = g_em;
|
||||||
|
em->view_scale = view_scale;
|
||||||
|
view_scale_set(VIEW_DATA, view_scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
edj_mgr_view_scale_get(void)
|
||||||
|
{
|
||||||
|
edj_mgr *em = g_em;
|
||||||
|
return em->view_scale;
|
||||||
|
}
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT 1
|
#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT 1
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Enventor.h>
|
||||||
#include <Edje_Edit.h>
|
#include <Edje_Edit.h>
|
||||||
#include <Eio.h>
|
#include <Eio.h>
|
||||||
#include "common.h"
|
#include "enventor_private.h"
|
||||||
|
|
||||||
struct viewer_s
|
struct viewer_s
|
||||||
{
|
{
|
||||||
Evas_Object *parent;
|
|
||||||
Evas_Object *layout;
|
Evas_Object *layout;
|
||||||
Evas_Object *scroller;
|
Evas_Object *scroller;
|
||||||
Evas_Object *event_rect;
|
Evas_Object *event_rect;
|
||||||
|
Evas_Object *enventor;
|
||||||
|
|
||||||
Evas_Object *part_obj;
|
Evas_Object *part_obj;
|
||||||
Evas_Object *part_highlight;
|
Evas_Object *part_highlight;
|
||||||
|
@ -23,7 +28,6 @@ struct viewer_s
|
||||||
Eio_Monitor *edj_monitor;
|
Eio_Monitor *edj_monitor;
|
||||||
Ecore_Event_Handler *monitor_event;
|
Ecore_Event_Handler *monitor_event;
|
||||||
Ecore_Event_Handler *exe_del_event;
|
Ecore_Event_Handler *exe_del_event;
|
||||||
|
|
||||||
void (*del_cb)(void *data);
|
void (*del_cb)(void *data);
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
@ -31,12 +35,16 @@ struct viewer_s
|
||||||
Eina_Bool edj_reload_need : 1;
|
Eina_Bool edj_reload_need : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
view_obj_min_update(Evas_Object *obj)
|
view_obj_min_update(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
Evas_Coord w, h;
|
Evas_Coord w, h;
|
||||||
|
double scale = edj_mgr_view_scale_get();
|
||||||
edje_object_size_min_calc(obj, &w, &h);
|
edje_object_size_min_calc(obj, &w, &h);
|
||||||
double scale = edje_object_scale_get(obj);
|
|
||||||
evas_object_size_hint_min_set(obj, ((double)w * scale), ((double)h * scale));
|
evas_object_size_hint_min_set(obj, ((double)w * scale), ((double)h * scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +58,10 @@ file_set_timer_cb(void *data)
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (edje_object_file_set(vd->layout, config_edj_path_get(),
|
if (edje_object_file_set(vd->layout, build_edj_path_get(), vd->group_name))
|
||||||
vd->group_name))
|
|
||||||
{
|
{
|
||||||
eio_monitor_del(vd->edj_monitor);
|
eio_monitor_del(vd->edj_monitor);
|
||||||
vd->edj_monitor = eio_monitor_add(config_edj_path_get());
|
vd->edj_monitor = eio_monitor_add(build_edj_path_get());
|
||||||
if (!vd->edj_monitor) EINA_LOG_ERR("Failed to add Eio_Monitor");
|
if (!vd->edj_monitor) EINA_LOG_ERR("Failed to add Eio_Monitor");
|
||||||
vd->timer = NULL;
|
vd->timer = NULL;
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
@ -93,6 +100,7 @@ part_obj_geom_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
part_obj_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
part_obj_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
|
|
||||||
void *event_info EINA_UNUSED)
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
view_data *vd = data;
|
view_data *vd = data;
|
||||||
|
@ -100,30 +108,23 @@ part_obj_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
layout_resize_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
|
rect_mouse_move_cb(void *data, Evas *e EINA_UNUSED,
|
||||||
Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
||||||
{
|
|
||||||
if (!config_stats_bar_get()) return;
|
|
||||||
|
|
||||||
Evas_Coord w, h;
|
|
||||||
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
|
||||||
config_view_size_set(w, h);
|
|
||||||
stats_view_size_update();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
rect_mouse_move_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
|
|
||||||
Evas_Object *obj EINA_UNUSED, void *event_info)
|
Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||||
{
|
{
|
||||||
if (!config_stats_bar_get()) return;
|
static Enventor_Live_View_Cursor cursor;
|
||||||
|
view_data *vd = data;
|
||||||
Evas_Event_Mouse_Move *ev = event_info;
|
Evas_Event_Mouse_Move *ev = event_info;
|
||||||
|
|
||||||
Evas_Coord x, y, w, h;
|
Evas_Coord x, y, w, h;
|
||||||
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
||||||
stats_cursor_pos_update(ev->cur.canvas.x - x, ev->cur.canvas.y - y,
|
|
||||||
(float) (ev->cur.canvas.x - x) / (float) w,
|
cursor.x = ev->cur.canvas.x;
|
||||||
(float) (ev->cur.canvas.y - y) / (float) h);
|
cursor.y = ev->cur.canvas.y;
|
||||||
|
cursor.relx = (float) ((ev->cur.canvas.x - x) / (float) w);
|
||||||
|
cursor.rely = (float) ((ev->cur.canvas.y - y) / (float) h);
|
||||||
|
|
||||||
|
evas_object_smart_callback_call(vd->enventor, SIG_LIVE_VIEW_CURSOR_MOVED,
|
||||||
|
&cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -139,26 +140,26 @@ view_scroller_create(Evas_Object *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
exe_del_event_cb(void *data, int type EINA_UNUSED, void *event)
|
exe_del_event_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||||
{
|
{
|
||||||
view_data *vd = data;
|
view_data *vd = data;
|
||||||
Eio_Monitor_Event *ev = event;
|
|
||||||
|
|
||||||
if (!vd->edj_reload_need) return ECORE_CALLBACK_PASS_ON;
|
if (!vd->edj_reload_need) return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
||||||
if (!edje_object_file_set(vd->layout, config_edj_path_get(),
|
if (!edje_object_file_set(vd->layout, build_edj_path_get(), vd->group_name))
|
||||||
vd->group_name))
|
|
||||||
{
|
{
|
||||||
vd->del_cb(vd->data);
|
vd->del_cb(vd->data);
|
||||||
view_term(vd);
|
view_term(vd);
|
||||||
EINA_LOG_ERR("Failed to load edj file \"%s\"", config_edj_path_get());
|
EINA_LOG_ERR("Failed to load edj file \"%s\"", build_edj_path_get());
|
||||||
return ECORE_CALLBACK_DONE;
|
return ECORE_CALLBACK_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
view_obj_min_update(vd->layout);
|
view_obj_min_update(vd->layout);
|
||||||
view_part_highlight_set(vd, vd->part_name);
|
view_part_highlight_set(vd, vd->part_name);
|
||||||
dummy_obj_update(vd->layout);
|
dummy_obj_update(vd->layout);
|
||||||
|
#if 0
|
||||||
base_console_reset();
|
base_console_reset();
|
||||||
|
#endif
|
||||||
|
|
||||||
vd->edj_reload_need = EINA_FALSE;
|
vd->edj_reload_need = EINA_FALSE;
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ edj_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
||||||
if (vd->edj_monitor != ev->monitor) return ECORE_CALLBACK_PASS_ON;
|
if (vd->edj_monitor != ev->monitor) return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
||||||
//FIXME: why it need to add monitor again??
|
//FIXME: why it need to add monitor again??
|
||||||
vd->edj_monitor = eio_monitor_add(config_edj_path_get());
|
vd->edj_monitor = eio_monitor_add(build_edj_path_get());
|
||||||
if (!vd->edj_monitor) EINA_LOG_ERR("Failed to add Eio_Monitor!");
|
if (!vd->edj_monitor) EINA_LOG_ERR("Failed to add Eio_Monitor!");
|
||||||
|
|
||||||
vd->edj_reload_need = EINA_TRUE;
|
vd->edj_reload_need = EINA_TRUE;
|
||||||
|
@ -200,25 +201,15 @@ layout_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
Evas_Object *rect = data;
|
Evas_Object *rect = data;
|
||||||
evas_object_del(rect);
|
evas_object_del(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_layer_set(view_data *vd)
|
layout_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas *e = evas_object_evas_get(vd->layout);
|
static Enventor_Live_View_Size size;
|
||||||
Evas_Object *rect = evas_object_rectangle_add(e);
|
view_data *vd = data;
|
||||||
evas_object_repeat_events_set(rect, EINA_TRUE);
|
evas_object_geometry_get(obj, NULL, NULL, &size.w, &size.h);
|
||||||
evas_object_color_set(rect, 0, 0, 0, 0);
|
evas_object_smart_callback_call(vd->enventor, SIG_LIVE_VIEW_RESIZED, &size);
|
||||||
evas_object_show(rect);
|
|
||||||
|
|
||||||
evas_object_event_callback_add(vd->layout, EVAS_CALLBACK_RESIZE,
|
|
||||||
layout_geom_cb, rect);
|
|
||||||
evas_object_event_callback_add(vd->layout, EVAS_CALLBACK_MOVE,
|
|
||||||
layout_geom_cb, rect);
|
|
||||||
evas_object_event_callback_add(vd->layout, EVAS_CALLBACK_DEL,
|
|
||||||
layout_del_cb, rect);
|
|
||||||
evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_MOVE,
|
|
||||||
rect_mouse_move_cb, vd);
|
|
||||||
|
|
||||||
vd->event_rect = rect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -247,13 +238,33 @@ view_obj_create(view_data *vd, const char *file_path, const char *group)
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_layer_set(view_data *vd)
|
||||||
|
{
|
||||||
|
Evas *e = evas_object_evas_get(vd->layout);
|
||||||
|
Evas_Object *rect = evas_object_rectangle_add(e);
|
||||||
|
evas_object_repeat_events_set(rect, EINA_TRUE);
|
||||||
|
evas_object_color_set(rect, 0, 0, 0, 0);
|
||||||
|
evas_object_show(rect);
|
||||||
|
|
||||||
|
evas_object_event_callback_add(vd->layout, EVAS_CALLBACK_RESIZE,
|
||||||
|
layout_geom_cb, rect);
|
||||||
|
evas_object_event_callback_add(vd->layout, EVAS_CALLBACK_MOVE,
|
||||||
|
layout_geom_cb, rect);
|
||||||
|
evas_object_event_callback_add(vd->layout, EVAS_CALLBACK_DEL,
|
||||||
|
layout_del_cb, rect);
|
||||||
|
evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_MOVE,
|
||||||
|
rect_mouse_move_cb, vd);
|
||||||
|
vd->event_rect = rect;
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
view_obj_idler_cb(void *data)
|
view_obj_idler_cb(void *data)
|
||||||
{
|
{
|
||||||
view_data *vd = data;
|
view_data *vd = data;
|
||||||
|
|
||||||
vd->layout = view_obj_create(vd, config_edj_path_get(), vd->group_name);
|
vd->layout = view_obj_create(vd, build_edj_path_get(), vd->group_name);
|
||||||
view_scale_set(vd, config_view_scale_get());
|
view_scale_set(vd, edj_mgr_view_scale_get());
|
||||||
|
|
||||||
event_layer_set(vd);
|
event_layer_set(vd);
|
||||||
elm_object_content_set(vd->scroller, vd->layout);
|
elm_object_content_set(vd->scroller, vd->layout);
|
||||||
|
@ -267,27 +278,30 @@ view_obj_idler_cb(void *data)
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
view_dummy_toggle(view_data *vd, Eina_Bool msg)
|
view_dummy_set(view_data *vd, Eina_Bool dummy_on)
|
||||||
{
|
{
|
||||||
Eina_Bool dummy_on = config_dummy_swallow_get();
|
dummy_on = !!dummy_on;
|
||||||
|
|
||||||
if (dummy_on == vd->dummy_on) return;
|
if (dummy_on == vd->dummy_on) return;
|
||||||
if (dummy_on)
|
if (dummy_on) dummy_obj_new(vd->layout);
|
||||||
{
|
else dummy_obj_del(vd->layout);
|
||||||
if (msg) stats_info_msg_update("Dummy Swallow Enabled.");
|
|
||||||
dummy_obj_new(vd->layout);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (msg) stats_info_msg_update("Dummy Swallow Disabled.");
|
|
||||||
dummy_obj_del(vd->layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
vd->dummy_on = dummy_on;
|
vd->dummy_on = dummy_on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
view_dummy_get(view_data *vd)
|
||||||
|
{
|
||||||
|
return vd->dummy_on;
|
||||||
|
}
|
||||||
|
|
||||||
view_data *
|
view_data *
|
||||||
view_init(Evas_Object *parent, const char *group,
|
view_init(Evas_Object *enventor, const char *group,
|
||||||
void (*del_cb)(void *data), void *data)
|
void (*del_cb)(void *data), void *data)
|
||||||
{
|
{
|
||||||
view_data *vd = calloc(1, sizeof(view_data));
|
view_data *vd = calloc(1, sizeof(view_data));
|
||||||
|
@ -296,9 +310,9 @@ view_init(Evas_Object *parent, const char *group,
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
vd->parent = parent;
|
vd->enventor = enventor;
|
||||||
vd->scroller = view_scroller_create(parent);
|
vd->scroller = view_scroller_create(enventor);
|
||||||
vd->dummy_on = config_dummy_swallow_get();
|
vd->dummy_on = EINA_TRUE;
|
||||||
|
|
||||||
vd->group_name = eina_stringshare_add(group);
|
vd->group_name = eina_stringshare_add(group);
|
||||||
vd->idler = ecore_idler_add(view_obj_idler_cb, vd);
|
vd->idler = ecore_idler_add(view_obj_idler_cb, vd);
|
||||||
|
@ -352,9 +366,8 @@ view_program_run(view_data *vd, const char *program)
|
||||||
if (!vd) return;
|
if (!vd) return;
|
||||||
if (!program || !vd->layout) return;
|
if (!program || !vd->layout) return;
|
||||||
edje_edit_program_run(vd->layout, program);
|
edje_edit_program_run(vd->layout, program);
|
||||||
char buf[256];
|
evas_object_smart_callback_call(vd->enventor, SIG_PROGRAM_RUN,
|
||||||
snprintf(buf, sizeof(buf), "Program Run: \"%s\"", program);
|
(void*)program);
|
||||||
stats_info_msg_update(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -425,7 +438,7 @@ view_data_get(view_data *vd)
|
||||||
void
|
void
|
||||||
view_scale_set(view_data *vd, double scale)
|
view_scale_set(view_data *vd, double scale)
|
||||||
{
|
{
|
||||||
if (!vd->layout) return;
|
if (!vd || !vd->layout) return;
|
||||||
if (scale == edje_object_scale_get(vd->layout)) return;
|
if (scale == edje_object_scale_get(vd->layout)) return;
|
||||||
|
|
||||||
int pminw, pminh;
|
int pminw, pminh;
|
|
@ -0,0 +1,135 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include <Eio.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
|
char EDJE_PATH[PATH_MAX];
|
||||||
|
const char SIG_CURSOR_LINE_CHANGED[] = "cursor,line,changed";
|
||||||
|
const char SIG_CURSOR_GROUP_CHANGED[]= "cursor,group,changed";
|
||||||
|
const char SIG_LIVE_VIEW_CURSOR_MOVED[] = "live_view,cursor,moved";
|
||||||
|
const char SIG_LIVE_VIEW_RESIZED[] = "live_view,resized";
|
||||||
|
const char SIG_MAX_LINE_CHANGED[] = "max_line,changed";
|
||||||
|
const char SIG_COMPILE_ERROR[] = "compile,error";
|
||||||
|
const char SIG_PROGRAM_RUN[] = "program,run";
|
||||||
|
const char SIG_CTXPOPUP_SELECTED[] = "ctxpopup,selected";
|
||||||
|
const char SIG_CTXPOPUP_DISMISSED[] = "ctxpopup,dismissed";
|
||||||
|
|
||||||
|
static int _enventor_init_count = 0;
|
||||||
|
static int _enventor_log_dom = -1;
|
||||||
|
static Ecore_Event_Handler *_key_down_handler = NULL;
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
key_down_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev)
|
||||||
|
{
|
||||||
|
Ecore_Event_Key *event = ev;
|
||||||
|
if (autocomp_event_dispatch(event->key)) return ECORE_CALLBACK_DONE;
|
||||||
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
enventor_init(int argc, char **argv)
|
||||||
|
{
|
||||||
|
_enventor_init_count++;
|
||||||
|
|
||||||
|
if (_enventor_init_count > 1) return _enventor_init_count;
|
||||||
|
|
||||||
|
if (!eina_init())
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to initialize Eina");
|
||||||
|
return _enventor_init_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!eet_init())
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to initialize Eet");
|
||||||
|
return _enventor_init_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!evas_init())
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to initialize Eet");
|
||||||
|
return _enventor_init_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ecore_init())
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to initialize Ecore");
|
||||||
|
return _enventor_init_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ecore_file_init())
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to initialize Ecore_File");
|
||||||
|
return _enventor_init_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!edje_init())
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to initialize Edje");
|
||||||
|
return _enventor_init_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!eio_init())
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to initialize Eio");
|
||||||
|
return _enventor_init_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!elm_init(argc, argv))
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to initialize Elementary");
|
||||||
|
return _enventor_init_count--;
|
||||||
|
}
|
||||||
|
|
||||||
|
_enventor_log_dom = eina_log_domain_register("enventor", EINA_COLOR_CYAN);
|
||||||
|
if (!_enventor_log_dom)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Could not register enventor log domain");
|
||||||
|
_enventor_log_dom = EINA_LOG_DOMAIN_GLOBAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(EDJE_PATH, sizeof(EDJE_PATH), "%s/themes/enventor.edj",
|
||||||
|
PACKAGE_DATA_DIR);
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
|
|
||||||
|
_key_down_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
|
||||||
|
key_down_cb, NULL);
|
||||||
|
return _enventor_init_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
enventor_shutdown(void)
|
||||||
|
{
|
||||||
|
if (_enventor_init_count <= 0)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Init count not greater than 0 in shutdown.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ecore_event_handler_del(_key_down_handler);
|
||||||
|
_key_down_handler = NULL;
|
||||||
|
|
||||||
|
if ((_enventor_log_dom != -1) &&
|
||||||
|
(_enventor_log_dom != EINA_LOG_DOMAIN_GLOBAL))
|
||||||
|
{
|
||||||
|
eina_log_domain_unregister(_enventor_log_dom);
|
||||||
|
_enventor_log_dom = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_shutdown();
|
||||||
|
eio_shutdown();
|
||||||
|
ecore_file_shutdown();
|
||||||
|
ecore_shutdown();
|
||||||
|
edje_shutdown();
|
||||||
|
evas_shutdown();
|
||||||
|
eet_shutdown();
|
||||||
|
eina_shutdown();
|
||||||
|
|
||||||
|
return _enventor_init_count;
|
||||||
|
}
|
|
@ -0,0 +1,408 @@
|
||||||
|
class Enventor.Object (Elm_Widget, Efl.File) {
|
||||||
|
eo_prefix: enventor_obj;
|
||||||
|
properties {
|
||||||
|
part_highlight {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
Eina_Bool part_highlight; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
live_view_scale {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
double scale; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dummy_swallow {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
Eina_Bool dummy_swallow; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto_complete {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
Eina_Bool auto_complete; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto_indent {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
Eina_Bool auto_indent; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctxpopup {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
Eina_Bool ctxpopup; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
focus {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
Eina_Bool focus; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
modified {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
Eina_Bool modified; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
font_scale {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
double font_scale; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
linenumber {
|
||||||
|
set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
bool linenumber; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
methods {
|
||||||
|
path_set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: Eina_Bool;
|
||||||
|
params {
|
||||||
|
@in Enventor_Path_Type type; /*@ ... */
|
||||||
|
@in const(Eina_List) *pathes; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
path_get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: const(Eina_List) *;
|
||||||
|
params {
|
||||||
|
@in Enventor_Path_Type type; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
max_line_get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: int;
|
||||||
|
}
|
||||||
|
text_get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: const(char) *;
|
||||||
|
}
|
||||||
|
text_insert {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
params {
|
||||||
|
@in const(char) *text; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
selection_get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: const(char) *;
|
||||||
|
}
|
||||||
|
cursor_pos_get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: int;
|
||||||
|
}
|
||||||
|
select_none {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
select_region_set {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
params {
|
||||||
|
@in int start; /*@ ... */
|
||||||
|
@in int end; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
line_delete {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
}
|
||||||
|
save {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: Eina_Bool;
|
||||||
|
params {
|
||||||
|
@in const(char) *file; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
live_view_get {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: Eo *;
|
||||||
|
}
|
||||||
|
line_goto {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
params {
|
||||||
|
@in int line; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
syntax_color_full_apply {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
params {
|
||||||
|
@in Eina_Bool force; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
syntax_color_partial_apply {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
params {
|
||||||
|
@in double interval; /*@ ... */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template_insert {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: Eina_Bool;
|
||||||
|
params {
|
||||||
|
@in char *syntax; /*@ ... */
|
||||||
|
@in size_t n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template_part_insert {
|
||||||
|
/*@
|
||||||
|
@brief
|
||||||
|
@return
|
||||||
|
@warning
|
||||||
|
@see
|
||||||
|
@ingroup Enventor */
|
||||||
|
return: Eina_Bool;
|
||||||
|
params {
|
||||||
|
@in Edje_Part_Type type; /*@ ... */
|
||||||
|
@in float rel1_x; /*@ ... */
|
||||||
|
@in float rel1_y; /*@ ... */
|
||||||
|
@in float rel2_x; /*@ ... */
|
||||||
|
@in float rel2_y; /*@ ... */
|
||||||
|
@in char *syntax; /*@ ... */
|
||||||
|
@in size_t n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
implements {
|
||||||
|
Eo.Base.constructor;
|
||||||
|
Evas.Object_Smart.add;
|
||||||
|
Evas.Object_Smart.del;
|
||||||
|
Evas.Object_Smart.move;
|
||||||
|
Evas.Object_Smart.resize;
|
||||||
|
Evas.Object_Smart.show;
|
||||||
|
Evas.Object_Smart.hide;
|
||||||
|
Evas.Object_Smart.color.set;
|
||||||
|
Evas.Object_Smart.clip.set;
|
||||||
|
Evas.Object_Smart.clip_unset;
|
||||||
|
Efl.File.file.set;
|
||||||
|
}
|
||||||
|
events {
|
||||||
|
cursor,line,changed;
|
||||||
|
cursor,group,changed;
|
||||||
|
live_view,cursor,moved;
|
||||||
|
live_view,resized;
|
||||||
|
max_line,changed;
|
||||||
|
compile,error;
|
||||||
|
program,run;
|
||||||
|
ctxpopup,selected;
|
||||||
|
ctxpopup,dismissed;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,225 @@
|
||||||
|
#ifndef __ENVENTOR_PRIVATE_H__
|
||||||
|
#define __ENVENTOR_PRIVATE_H__
|
||||||
|
|
||||||
|
#define QUOT "\""
|
||||||
|
#define QUOT_C '\"'
|
||||||
|
#define QUOT_LEN 1
|
||||||
|
#define EOL "<br/>"
|
||||||
|
#define EOL_LEN 5
|
||||||
|
#define TAB "<tab/>"
|
||||||
|
#define TAB_LEN 6
|
||||||
|
#define TAB_SPACE 3
|
||||||
|
#define REL1_X 0.25f
|
||||||
|
#define REL1_Y 0.25f
|
||||||
|
#define REL2_X 0.75f
|
||||||
|
#define REL2_Y 0.75f
|
||||||
|
#define VIEW_DATA edj_mgr_view_get(NULL)
|
||||||
|
|
||||||
|
extern char EDJE_PATH[PATH_MAX];
|
||||||
|
extern const char SIG_CURSOR_LINE_CHANGED[];
|
||||||
|
extern const char SIG_CURSOR_GROUP_CHANGED[];
|
||||||
|
extern const char SIG_MAX_LINE_CHANGED[];
|
||||||
|
extern const char SIG_COMPILE_ERROR[];
|
||||||
|
extern const char SIG_LIVE_VIEW_CURSOR_MOVED[];
|
||||||
|
extern const char SIG_LIVE_VIEW_RESIZED[];
|
||||||
|
extern const char SIG_PROGRAM_RUN[];
|
||||||
|
extern const char SIG_CTXPOPUP_SELECTED[];
|
||||||
|
extern const char SIG_CTXPOPUP_DISMISSED[];
|
||||||
|
|
||||||
|
typedef struct viewer_s view_data;
|
||||||
|
typedef struct syntax_color_s color_data;
|
||||||
|
typedef struct parser_s parser_data;
|
||||||
|
typedef struct attr_value_s attr_value;
|
||||||
|
typedef struct syntax_helper_s syntax_helper;
|
||||||
|
typedef struct indent_s indent_data;
|
||||||
|
typedef struct redoundo_s redoundo_data;
|
||||||
|
typedef struct editor_s edit_data;
|
||||||
|
|
||||||
|
typedef enum attr_value_type
|
||||||
|
{
|
||||||
|
ATTR_VALUE_INTEGER = 1,
|
||||||
|
ATTR_VALUE_FLOAT = 2,
|
||||||
|
ATTR_VALUE_CONSTANT = 4,
|
||||||
|
ATTR_VALUE_PART = 8,
|
||||||
|
ATTR_VALUE_STATE = 16,
|
||||||
|
ATTR_VALUE_IMAGE = 32,
|
||||||
|
ATTR_VALUE_PROGRAM = 64
|
||||||
|
} attr_value_type;
|
||||||
|
|
||||||
|
struct attr_value_s
|
||||||
|
{
|
||||||
|
Eina_Array *strs;
|
||||||
|
float min;
|
||||||
|
float max;
|
||||||
|
attr_value_type type;
|
||||||
|
Eina_Bool program : 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TEMPLATE_INSERT_DEFAULT,
|
||||||
|
TEMPLATE_INSERT_LIVE_EDIT
|
||||||
|
} Template_Insert_Type;
|
||||||
|
|
||||||
|
|
||||||
|
/* auto_comp */
|
||||||
|
void autocomp_init(void);
|
||||||
|
void autocomp_term(void);
|
||||||
|
void autocomp_target_set(edit_data *ed);
|
||||||
|
void autocomp_enabled_set(Eina_Bool enabled);
|
||||||
|
Eina_Bool autocomp_enabled_get(void);
|
||||||
|
Eina_Bool autocomp_event_dispatch(const char *key);
|
||||||
|
|
||||||
|
|
||||||
|
/* syntax color */
|
||||||
|
color_data *color_init(Eina_Strbuf *strbuf);
|
||||||
|
void color_term(color_data *cd);
|
||||||
|
const char *color_cancel(color_data *cd, const char *str, int length, int from_pos, int to_pos, char **from, char **to);
|
||||||
|
const char *color_apply(color_data *cd, const char *str, int length, char *from, char *to);
|
||||||
|
Eina_Bool color_ready(color_data *cd);
|
||||||
|
|
||||||
|
|
||||||
|
/*parser */
|
||||||
|
parser_data *parser_init(void);
|
||||||
|
void parser_term(parser_data *pd);
|
||||||
|
Eina_Stringshare *parser_first_group_name_get(parser_data *pd, Evas_Object *entry);
|
||||||
|
void parser_cur_name_get(parser_data *pd, Evas_Object *entry, void (*cb)(void *data, Eina_Stringshare *part_name, Eina_Stringshare *group_name), void *data);
|
||||||
|
void parser_cur_group_name_get(parser_data *pd, Evas_Object *entry, void (*cb)(void *data, Eina_Stringshare *part_name, Eina_Stringshare *group_name), void *data);
|
||||||
|
Eina_Stringshare *parser_cur_name_fast_get(Evas_Object *entry, const char *scope);
|
||||||
|
Eina_Bool parser_type_name_compare(parser_data *pd, const char *str);
|
||||||
|
attr_value *parser_attribute_get(parser_data *pd, const char *text, const char *cur);
|
||||||
|
Eina_Stringshare *parser_paragh_name_get(parser_data *pd, Evas_Object *entry);
|
||||||
|
char *parser_name_get(parser_data *pd, const char *cur);
|
||||||
|
void parser_cancel(parser_data *pd);
|
||||||
|
int parser_line_cnt_get(parser_data *pd EINA_UNUSED, const char *src);
|
||||||
|
Eina_List *parser_states_filtered_name_get(Eina_List *states);
|
||||||
|
int parser_end_of_parts_block_pos_get(const Evas_Object *entry, const char *group_name);
|
||||||
|
Eina_Bool parser_images_pos_get(const Evas_Object *entry, int *ret);
|
||||||
|
Eina_Bool parser_styles_pos_get(const Evas_Object *entry, int *ret);
|
||||||
|
const char *parser_colon_pos_get(parser_data *pd EINA_UNUSED, const char *cur);
|
||||||
|
|
||||||
|
|
||||||
|
/* syntax helper */
|
||||||
|
syntax_helper *syntax_init(void);
|
||||||
|
void syntax_term(syntax_helper *sh);
|
||||||
|
color_data *syntax_color_data_get(syntax_helper *sh);
|
||||||
|
indent_data *syntax_indent_data_get(syntax_helper *sh);
|
||||||
|
|
||||||
|
|
||||||
|
/* indent */
|
||||||
|
indent_data *indent_init(Eina_Strbuf *strbuf);
|
||||||
|
void indent_term(indent_data *id);
|
||||||
|
int indent_space_get(indent_data *id, Evas_Object *entry);
|
||||||
|
void indent_insert_apply(indent_data *id, Evas_Object *entry, const char *insert, int cur_line);
|
||||||
|
Eina_Bool indent_delete_apply(indent_data *id, Evas_Object *entry, const char *del, int cur_line);
|
||||||
|
|
||||||
|
|
||||||
|
/* build */
|
||||||
|
void build_edc(void);
|
||||||
|
void build_init(void);
|
||||||
|
void build_term(void);
|
||||||
|
Eina_Bool build_path_set(Enventor_Path_Type type, const Eina_List *pathes);
|
||||||
|
Eina_List *build_path_get(Enventor_Path_Type type);
|
||||||
|
void build_edc_path_set(const char *edc_path);
|
||||||
|
const char *build_edc_path_get(void);
|
||||||
|
const char *build_edj_path_get(void);
|
||||||
|
void build_err_noti_cb_set(void (*cb)(void *data, const char *msg), void *data);
|
||||||
|
|
||||||
|
/* dummy_obj */
|
||||||
|
void dummy_obj_new(Evas_Object *layout);
|
||||||
|
void dummy_obj_del(Evas_Object *layout);
|
||||||
|
void dummy_obj_update(Evas_Object *layout);
|
||||||
|
|
||||||
|
|
||||||
|
/* edj_mgr */
|
||||||
|
void edj_mgr_init(Evas_Object *enventor);
|
||||||
|
void edj_mgr_term(void);
|
||||||
|
view_data * edj_mgr_view_new(const char *group);
|
||||||
|
view_data *edj_mgr_view_get(Eina_Stringshare *group);
|
||||||
|
Evas_Object * edj_mgr_obj_get(void);
|
||||||
|
view_data *edj_mgr_view_switch_to(view_data *vd);
|
||||||
|
void edj_mgr_view_del(view_data *vd);
|
||||||
|
void edj_mgr_reload_need_set(Eina_Bool reload);
|
||||||
|
Eina_Bool edj_mgr_reload_need_get(void);
|
||||||
|
void edj_mgr_clear(void);
|
||||||
|
void edj_mgr_view_scale_set(double scale);
|
||||||
|
double edj_mgr_view_scale_get(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* redoundo */
|
||||||
|
redoundo_data *redoundo_init(Evas_Object *entry);
|
||||||
|
void redoundo_term(redoundo_data *rd);
|
||||||
|
void redoundo_clear(redoundo_data *rd);
|
||||||
|
void redoundo_text_push(redoundo_data *rd, const char *text, int pos, int length, Eina_Bool insert);
|
||||||
|
void redoundo_text_relative_push(redoundo_data *rd, const char *text);
|
||||||
|
void redoundo_entry_region_push(redoundo_data *rd, int cursor_pos, int cursor_pos2);
|
||||||
|
int redoundo_undo(redoundo_data *rd, Eina_Bool *changed);
|
||||||
|
int redoundo_redo(redoundo_data *rd, Eina_Bool *changed);
|
||||||
|
|
||||||
|
|
||||||
|
/* edj_viewer */
|
||||||
|
view_data * view_init(Evas_Object *enventor, const char *group, void (*del_cb)(void *data), void *data);
|
||||||
|
void view_term(view_data *vd);
|
||||||
|
Evas_Object *view_obj_get(view_data *vd);
|
||||||
|
void view_new(view_data *vd, const char *group);
|
||||||
|
void view_part_highlight_set(view_data *vd, const char *part_name);
|
||||||
|
void view_dummy_set(view_data *vd, Eina_Bool dummy_on);
|
||||||
|
Eina_Bool view_dummy_get(view_data *vd);
|
||||||
|
void view_program_run(view_data *vd, const char *program);
|
||||||
|
Eina_Stringshare *view_group_name_get(view_data *vd);
|
||||||
|
void *view_data_get(view_data *vd);
|
||||||
|
void view_scale_set(view_data *vd, double scale);
|
||||||
|
Eina_List *view_parts_list_get(view_data *vd);
|
||||||
|
Eina_List *view_images_list_get(view_data *vd);
|
||||||
|
Eina_List *view_programs_list_get(view_data *vd);
|
||||||
|
Eina_List *view_part_states_list_get(view_data *vd, const char *part);
|
||||||
|
Eina_List *view_program_targets_get(view_data *vd, const char *prog);
|
||||||
|
void view_string_list_free(Eina_List *list);
|
||||||
|
|
||||||
|
|
||||||
|
/* template */
|
||||||
|
Eina_Bool template_part_insert(edit_data *ed, Edje_Part_Type part_type, Template_Insert_Type insert_type, float rel1_x, float rel1_y, float rel2_x, float rel2_y, const Eina_Stringshare *group_name, char *syntax, size_t n);
|
||||||
|
Eina_Bool template_insert(edit_data *ed, Template_Insert_Type insert_type, char *syntax, size_t n);
|
||||||
|
|
||||||
|
|
||||||
|
/* ctxpopup */
|
||||||
|
Evas_Object *ctxpopup_candidate_list_create(edit_data *ed, attr_value *attr, double slider_val, Evas_Smart_Cb ctxpopup_dismiss_cb, Evas_Smart_Cb ctxpopup_selected_cb);
|
||||||
|
Evas_Object *ctxpopup_img_preview_create(edit_data*ed, const char *imgpath, Evas_Smart_Cb ctxpopup_dismiss_cb, Evas_Smart_Cb ctxpopup_relay_cb);
|
||||||
|
|
||||||
|
|
||||||
|
/* edc_editor */
|
||||||
|
edit_data *edit_init(Evas_Object *enventor);
|
||||||
|
void edit_term(edit_data *ed);
|
||||||
|
Evas_Object *edit_obj_get(edit_data *ed);
|
||||||
|
Eina_Bool edit_changed_get(edit_data *ed);
|
||||||
|
void edit_changed_set(edit_data *ed, Eina_Bool changed);
|
||||||
|
void edit_linenumber_set(edit_data *ed, Eina_Bool linenumber);
|
||||||
|
Eina_Bool edit_linenumber_get(edit_data *ed);
|
||||||
|
Eina_Bool edit_save(edit_data *ed, const char *file);
|
||||||
|
void edit_new(edit_data* ed);
|
||||||
|
void edit_view_sync_cb_set(edit_data *ed, void (*cb)(void *data, Eina_Stringshare *part_name, Eina_Stringshare *group_name), void *data);
|
||||||
|
void edit_view_sync(edit_data *ed);
|
||||||
|
void edit_font_scale_set(edit_data *ed, double font_scale);
|
||||||
|
double edit_font_scale_get(edit_data *ed);
|
||||||
|
void edit_part_highlight_toggle(edit_data *ed, Eina_Bool msg);
|
||||||
|
void edit_line_delete(edit_data *ed);
|
||||||
|
Eina_Stringshare *edit_cur_prog_name_get(edit_data *ed);
|
||||||
|
Eina_Stringshare *edit_cur_part_name_get(edit_data *ed);
|
||||||
|
Eina_Stringshare *edit_cur_paragh_get(edit_data *ed);
|
||||||
|
int edit_max_line_get(edit_data *ed);
|
||||||
|
void edit_goto(edit_data *ed, int line);
|
||||||
|
void edit_syntax_color_full_apply(edit_data *ed, Eina_Bool force);
|
||||||
|
void edit_syntax_color_partial_apply(edit_data *ed, double interval);
|
||||||
|
Evas_Object *edit_entry_get(edit_data *ed);
|
||||||
|
void edit_line_increase(edit_data *ed, int cnt);
|
||||||
|
void edit_line_decrease(edit_data *ed, int cnt);
|
||||||
|
int edit_cur_indent_depth_get(edit_data *ed);
|
||||||
|
void edit_redoundo_region_push(edit_data *ed, int cursor_pos1, int cursor_pos2);
|
||||||
|
void edit_auto_indent_set(edit_data *ed, Eina_Bool auto_indent);
|
||||||
|
Eina_Bool edit_auto_indent_get(edit_data *ed);
|
||||||
|
void edit_part_highlight_set(edit_data *ed, Eina_Bool part_highlight);
|
||||||
|
Eina_Bool edit_part_highlight_get(edit_data *ed);
|
||||||
|
void edit_ctxpopup_set(edit_data *ed, Eina_Bool ctxpopup);
|
||||||
|
Eina_Bool edit_ctxpopup_get(edit_data *ed);
|
||||||
|
Eina_Bool edit_load(edit_data *ed, const char *edc_path);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,502 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ELM_INTERNAL_API_ARGESFSDFEFC 1
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include <Eio.h>
|
||||||
|
#include <elm_widget.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
|
#define MY_CLASS_NAME_LEGACY "enventor_object"
|
||||||
|
|
||||||
|
#ifdef MY_CLASS
|
||||||
|
#undef MY_CLASS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MY_CLASS ENVENTOR_OBJECT_CLASS
|
||||||
|
|
||||||
|
typedef struct _Enventor_Object_Data
|
||||||
|
{
|
||||||
|
EINA_REFCOUNT;
|
||||||
|
Evas_Object *obj;
|
||||||
|
|
||||||
|
edit_data *ed;
|
||||||
|
Eio_Monitor *edc_monitor;
|
||||||
|
Eina_Stringshare *group_name;
|
||||||
|
|
||||||
|
} Enventor_Object_Data;
|
||||||
|
|
||||||
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||||
|
{SIG_CURSOR_LINE_CHANGED, ""},
|
||||||
|
{SIG_CURSOR_GROUP_CHANGED, ""},
|
||||||
|
{SIG_LIVE_VIEW_CURSOR_MOVED, ""},
|
||||||
|
{SIG_LIVE_VIEW_RESIZED, ""},
|
||||||
|
{SIG_MAX_LINE_CHANGED, ""},
|
||||||
|
{SIG_COMPILE_ERROR, ""},
|
||||||
|
{SIG_PROGRAM_RUN, ""},
|
||||||
|
{SIG_CTXPOPUP_SELECTED, ""},
|
||||||
|
{SIG_CTXPOPUP_DISMISSED, ""},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static Eina_Bool
|
||||||
|
file_modified_cb(void *data, int type EINA_UNUSED, void *event)
|
||||||
|
{
|
||||||
|
Eio_Monitor_Event *ev = event;
|
||||||
|
Enventor_Object_Data *pd = data;
|
||||||
|
|
||||||
|
if (ev->monitor != pd->edc_monitor) return ECORE_CALLBACK_PASS_ON;
|
||||||
|
if (!edit_changed_get(pd->ed)) return ECORE_CALLBACK_DONE;
|
||||||
|
if (strcmp(ev->filename, build_edc_path_get())) return ECORE_CALLBACK_DONE;
|
||||||
|
|
||||||
|
build_edc();
|
||||||
|
edit_changed_set(pd->ed, EINA_FALSE);
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_DONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
edit_view_sync_cb(void *data, Eina_Stringshare *part_name,
|
||||||
|
Eina_Stringshare *group_name)
|
||||||
|
{
|
||||||
|
Enventor_Object_Data *pd = data;
|
||||||
|
if (pd->group_name != group_name)
|
||||||
|
{
|
||||||
|
view_data *vd = edj_mgr_view_get(group_name);
|
||||||
|
if (vd) edj_mgr_view_switch_to(vd);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vd = edj_mgr_view_new(group_name);
|
||||||
|
if (!vd) return;
|
||||||
|
}
|
||||||
|
if (group_name)
|
||||||
|
{
|
||||||
|
eina_stringshare_del(pd->group_name);
|
||||||
|
pd->group_name = eina_stringshare_add(group_name);
|
||||||
|
evas_object_smart_callback_call(pd->obj, SIG_CURSOR_GROUP_CHANGED,
|
||||||
|
(void *) group_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
view_part_highlight_set(VIEW_DATA, part_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
build_err_noti_cb(void *data, const char *msg)
|
||||||
|
{
|
||||||
|
Evas_Object *enventor = data;
|
||||||
|
evas_object_smart_callback_call(enventor, SIG_COMPILE_ERROR, (char *)msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal Eo object required routines */
|
||||||
|
/*****************************************************************************/
|
||||||
|
static void
|
||||||
|
_enventor_object_class_constructor(Eo_Class *klass)
|
||||||
|
{
|
||||||
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_add(Eo *obj, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
EINA_REFCOUNT_INIT(pd);
|
||||||
|
pd->obj = obj;
|
||||||
|
|
||||||
|
elm_widget_sub_object_parent_add(obj);
|
||||||
|
eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
|
||||||
|
|
||||||
|
build_init();
|
||||||
|
autocomp_init();
|
||||||
|
edj_mgr_init(obj);
|
||||||
|
pd->ed = edit_init(obj);
|
||||||
|
edit_view_sync_cb_set(pd->ed, edit_view_sync_cb, pd);
|
||||||
|
build_err_noti_cb_set(build_err_noti_cb, obj);
|
||||||
|
|
||||||
|
evas_object_smart_member_add(edit_obj_get(pd->ed), obj);
|
||||||
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||||
|
|
||||||
|
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, file_modified_cb, pd);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_del(Evas_Object *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
EINA_REFCOUNT_UNREF(pd)
|
||||||
|
{
|
||||||
|
eio_monitor_del(pd->edc_monitor);
|
||||||
|
eina_stringshare_del(pd->group_name);
|
||||||
|
edit_term(pd->ed);
|
||||||
|
edj_mgr_term();
|
||||||
|
autocomp_term();
|
||||||
|
build_term();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_move(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd, Evas_Coord x, Evas_Coord y)
|
||||||
|
{
|
||||||
|
Evas_Object *o = edit_obj_get(pd->ed);
|
||||||
|
evas_object_move(o, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_resize(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd, Evas_Coord w, Evas_Coord h)
|
||||||
|
{
|
||||||
|
Evas_Object *o = edit_obj_get(pd->ed);
|
||||||
|
evas_object_resize(o, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_show(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
Evas_Object *o = edit_obj_get(pd->ed);
|
||||||
|
evas_object_show(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_hide(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
Evas_Object *o = edit_obj_get(pd->ed);
|
||||||
|
evas_object_hide(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_color_set(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd, int r, int g, int b, int a)
|
||||||
|
{
|
||||||
|
Evas_Object *o = edit_obj_get(pd->ed);
|
||||||
|
evas_object_color_set(o, r, g, b, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_clip_set(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd, Evas_Object *clip)
|
||||||
|
{
|
||||||
|
Evas_Object *o = edit_obj_get(pd->ed);
|
||||||
|
evas_object_clip_set(o, clip);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_evas_object_smart_clip_unset(Evas_Object *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
Evas_Object *o = edit_obj_get(pd->ed);
|
||||||
|
evas_object_clip_unset(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_eo_base_constructor(Eo *obj,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
||||||
|
eo_do(obj,
|
||||||
|
evas_obj_type_set(MY_CLASS_NAME_LEGACY),
|
||||||
|
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_efl_file_file_set(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd,
|
||||||
|
const char *file,
|
||||||
|
const char *group EINA_UNUSED)
|
||||||
|
{
|
||||||
|
eio_monitor_del(pd->edc_monitor);
|
||||||
|
build_edc_path_set(file);
|
||||||
|
if (!edit_load(pd->ed, file)) goto err;
|
||||||
|
autocomp_target_set(pd->ed);
|
||||||
|
pd->edc_monitor = eio_monitor_add(file);
|
||||||
|
build_edc();
|
||||||
|
edit_changed_set(pd->ed, EINA_FALSE);
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
|
||||||
|
err:
|
||||||
|
build_edc_path_set(NULL);
|
||||||
|
pd->edc_monitor = NULL;
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_linenumber_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
Eina_Bool linenumber)
|
||||||
|
{
|
||||||
|
edit_linenumber_set(pd->ed, linenumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_linenumber_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return edit_linenumber_get(pd->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_auto_indent_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
Eina_Bool auto_indent)
|
||||||
|
{
|
||||||
|
edit_auto_indent_set(pd->ed, auto_indent);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_auto_indent_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return edit_auto_indent_get(pd->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_auto_complete_set(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED,
|
||||||
|
Eina_Bool auto_complete)
|
||||||
|
{
|
||||||
|
autocomp_enabled_set(auto_complete);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_auto_complete_get(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
return autocomp_enabled_get();
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_modified_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
Eina_Bool modified)
|
||||||
|
{
|
||||||
|
edit_changed_set(pd->ed, modified);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_modified_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return edit_changed_get(pd->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_path_set(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED,
|
||||||
|
Enventor_Path_Type type, const Eina_List *pathes)
|
||||||
|
{
|
||||||
|
return build_path_set(type, pathes);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static const Eina_List *
|
||||||
|
_enventor_object_path_get(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED,
|
||||||
|
Enventor_Path_Type type)
|
||||||
|
{
|
||||||
|
return build_path_get(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_live_view_scale_set(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED,
|
||||||
|
double scale)
|
||||||
|
{
|
||||||
|
edj_mgr_view_scale_set(scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static double
|
||||||
|
_enventor_object_live_view_scale_get(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
return edj_mgr_view_scale_get();
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_dummy_swallow_set(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED,
|
||||||
|
Eina_Bool dummy_swallow)
|
||||||
|
{
|
||||||
|
view_dummy_set(VIEW_DATA, dummy_swallow);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_ctxpopup_get(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return edit_ctxpopup_get(pd->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_ctxpopup_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
Eina_Bool ctxpopup)
|
||||||
|
{
|
||||||
|
edit_ctxpopup_set(pd->ed, ctxpopup);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_dummy_swallow_get(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
return view_dummy_get(VIEW_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_part_highlight_set(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd,
|
||||||
|
Eina_Bool part_highlight)
|
||||||
|
{
|
||||||
|
edit_part_highlight_set(pd->ed, part_highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_part_highlight_get(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return edit_part_highlight_get(pd->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_focus_set(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED,
|
||||||
|
Eina_Bool focus)
|
||||||
|
{
|
||||||
|
elm_object_focus_set(edit_entry_get(pd->ed), focus);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_focus_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return elm_object_focus_get(edit_entry_get(pd->ed));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static const char *
|
||||||
|
_enventor_object_text_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return elm_entry_entry_get(edit_entry_get(pd->ed));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static int
|
||||||
|
_enventor_object_cursor_pos_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return elm_entry_cursor_pos_get(edit_entry_get(pd->ed));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static const char *
|
||||||
|
_enventor_object_selection_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return elm_entry_selection_get(edit_entry_get(pd->ed));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_select_none(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
elm_entry_select_none(edit_entry_get(pd->ed));
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_text_insert(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
const char *text)
|
||||||
|
{
|
||||||
|
elm_entry_entry_insert(edit_entry_get(pd->ed), text);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_select_region_set(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd, int start, int end)
|
||||||
|
{
|
||||||
|
elm_entry_select_region_set(edit_entry_get(pd->ed), start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_font_scale_set(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
double font_scale)
|
||||||
|
{
|
||||||
|
edit_font_scale_set(pd->ed, font_scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static double
|
||||||
|
_enventor_object_font_scale_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return edit_font_scale_get(pd->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static int
|
||||||
|
_enventor_object_max_line_get(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
return edit_max_line_get(pd->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_line_goto(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
int line)
|
||||||
|
{
|
||||||
|
edit_goto(pd->ed, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_syntax_color_full_apply(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd,
|
||||||
|
Eina_Bool force)
|
||||||
|
{
|
||||||
|
edit_syntax_color_full_apply(pd->ed, force);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_syntax_color_partial_apply(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd,
|
||||||
|
double interval)
|
||||||
|
{
|
||||||
|
edit_syntax_color_partial_apply(pd->ed, interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_save(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
const char *file)
|
||||||
|
{
|
||||||
|
return edit_save(pd->ed, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_enventor_object_line_delete(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd)
|
||||||
|
{
|
||||||
|
edit_line_delete(pd->ed);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eo *
|
||||||
|
_enventor_object_live_view_get(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
return edj_mgr_obj_get();
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_template_insert(Eo *obj EINA_UNUSED, Enventor_Object_Data *pd,
|
||||||
|
char *syntax, size_t n)
|
||||||
|
{
|
||||||
|
return template_insert(pd->ed, TEMPLATE_INSERT_DEFAULT, syntax, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_enventor_object_template_part_insert(Eo *obj EINA_UNUSED,
|
||||||
|
Enventor_Object_Data *pd,
|
||||||
|
Edje_Part_Type part, float rel1_x,
|
||||||
|
float rel1_y, float rel2_x, float rel2_y,
|
||||||
|
char *syntax, size_t n)
|
||||||
|
{
|
||||||
|
return template_part_insert(pd->ed, part, TEMPLATE_INSERT_DEFAULT, rel1_x,
|
||||||
|
rel1_y, rel2_x, rel2_y, NULL, syntax, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
EAPI Evas_Object *
|
||||||
|
enventor_object_add(Evas_Object *parent)
|
||||||
|
{
|
||||||
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||||
|
Evas_Object *obj = eo_add(MY_CLASS, parent);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
enventor_object_file_set(Evas_Object *obj, const char *file)
|
||||||
|
{
|
||||||
|
return eo_do(obj, efl_file_set(file, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "enventor_object.eo.c"
|
|
@ -1,30 +1,20 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
struct indent_s
|
struct indent_s
|
||||||
{
|
{
|
||||||
Eina_Strbuf *strbuf;
|
Eina_Strbuf *strbuf;
|
||||||
};
|
};
|
||||||
|
|
||||||
indent_data *
|
/*****************************************************************************/
|
||||||
indent_init(Eina_Strbuf *strbuf)
|
/* Internal method implementation */
|
||||||
{
|
/*****************************************************************************/
|
||||||
indent_data *id = malloc(sizeof(indent_data));
|
|
||||||
if (!id)
|
|
||||||
{
|
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
id->strbuf = strbuf;
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
indent_term(indent_data *id)
|
|
||||||
{
|
|
||||||
free(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
indent_depth_get(indent_data *id EINA_UNUSED, char *src, int pos)
|
indent_depth_get(indent_data *id EINA_UNUSED, char *src, int pos)
|
||||||
|
@ -56,19 +46,6 @@ indent_depth_get(indent_data *id EINA_UNUSED, char *src, int pos)
|
||||||
return depth;
|
return depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
indent_space_get(indent_data *id, Evas_Object *entry)
|
|
||||||
{
|
|
||||||
//Get the indentation depth
|
|
||||||
int pos = elm_entry_cursor_pos_get(entry);
|
|
||||||
char *src = elm_entry_markup_to_utf8(elm_entry_entry_get(entry));
|
|
||||||
int space = indent_depth_get(id, src, pos);
|
|
||||||
space *= TAB_SPACE;
|
|
||||||
free(src);
|
|
||||||
|
|
||||||
return space;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
indent_insert_br_case(indent_data *id, Evas_Object *entry)
|
indent_insert_br_case(indent_data *id, Evas_Object *entry)
|
||||||
{
|
{
|
||||||
|
@ -169,6 +146,42 @@ indent_insert_bracket_case(indent_data *id, Evas_Object *entry, int cur_line)
|
||||||
free(utf8);
|
free(utf8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
indent_data *
|
||||||
|
indent_init(Eina_Strbuf *strbuf)
|
||||||
|
{
|
||||||
|
indent_data *id = malloc(sizeof(indent_data));
|
||||||
|
if (!id)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
id->strbuf = strbuf;
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
indent_term(indent_data *id)
|
||||||
|
{
|
||||||
|
free(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
indent_space_get(indent_data *id, Evas_Object *entry)
|
||||||
|
{
|
||||||
|
//Get the indentation depth
|
||||||
|
int pos = elm_entry_cursor_pos_get(entry);
|
||||||
|
char *src = elm_entry_markup_to_utf8(elm_entry_entry_get(entry));
|
||||||
|
int space = indent_depth_get(id, src, pos);
|
||||||
|
space *= TAB_SPACE;
|
||||||
|
free(src);
|
||||||
|
|
||||||
|
return space;
|
||||||
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
indent_delete_apply(indent_data *id EINA_UNUSED, Evas_Object *entry,
|
indent_delete_apply(indent_data *id EINA_UNUSED, Evas_Object *entry,
|
||||||
const char *del, int cur_line)
|
const char *del, int cur_line)
|
|
@ -1,5 +1,11 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
#define DEFAULT_QUEUE_SIZE 200
|
#define DEFAULT_QUEUE_SIZE 200
|
||||||
|
|
||||||
|
@ -24,6 +30,10 @@ struct redoundo_s
|
||||||
Eina_Bool internal_change : 1; //Entry change by redoundo
|
Eina_Bool internal_change : 1; //Entry change by redoundo
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
untracked_diff_free(redoundo_data *rd)
|
untracked_diff_free(redoundo_data *rd)
|
||||||
{
|
{
|
||||||
|
@ -109,6 +119,10 @@ nochange:
|
||||||
free(diff);
|
free(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
redoundo_undo(redoundo_data *rd, Eina_Bool *changed)
|
redoundo_undo(redoundo_data *rd, Eina_Bool *changed)
|
||||||
{
|
{
|
|
@ -1,5 +1,11 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
#define COL_NUM 6
|
#define COL_NUM 6
|
||||||
|
|
||||||
|
@ -42,6 +48,10 @@ static Eet_Data_Descriptor *edd_scg = NULL;
|
||||||
static Eet_Data_Descriptor *edd_color = NULL;
|
static Eet_Data_Descriptor *edd_color = NULL;
|
||||||
static syntax_color_group *scg = NULL;
|
static syntax_color_group *scg = NULL;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hash_free_cb(void *data)
|
hash_free_cb(void *data)
|
||||||
{
|
{
|
||||||
|
@ -208,45 +218,6 @@ init_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||||
cd->ready = EINA_TRUE;
|
cd->ready = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
color_data *
|
|
||||||
color_init(Eina_Strbuf *strbuf)
|
|
||||||
{
|
|
||||||
color_data *cd = malloc(sizeof(color_data));
|
|
||||||
if (!cd)
|
|
||||||
{
|
|
||||||
EINA_LOG_ERR("Failed to allocate Memory!");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
cd->strbuf = strbuf;
|
|
||||||
cd->cachebuf = eina_strbuf_new();
|
|
||||||
cd->thread = ecore_thread_run(init_thread_blocking, NULL, NULL, cd);
|
|
||||||
cd->macros = NULL;
|
|
||||||
|
|
||||||
return cd;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
color_term(color_data *cd)
|
|
||||||
{
|
|
||||||
ecore_thread_cancel(cd->thread);
|
|
||||||
|
|
||||||
eina_hash_free(cd->color_hash);
|
|
||||||
eina_strbuf_free(cd->cachebuf);
|
|
||||||
|
|
||||||
eina_stringshare_del(cd->col_string);
|
|
||||||
eina_stringshare_del(cd->col_comment);
|
|
||||||
eina_stringshare_del(cd->col_macro);
|
|
||||||
|
|
||||||
Eina_Stringshare *macro;
|
|
||||||
EINA_LIST_FREE(cd->macros, macro) eina_stringshare_del(macro);
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for(i = 0; i < COL_NUM; i++)
|
|
||||||
eina_stringshare_del(cd->cols[i]);
|
|
||||||
|
|
||||||
free(cd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
color_markup_insert_internal(Eina_Strbuf *strbuf, const char **src, int length,
|
color_markup_insert_internal(Eina_Strbuf *strbuf, const char **src, int length,
|
||||||
char **cur, char **prev, const char *cmp,
|
char **cur, char **prev, const char *cmp,
|
||||||
|
@ -679,6 +650,49 @@ color_markup_insert(Eina_Strbuf *strbuf, const char **src, int length, char **cu
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
color_data *
|
||||||
|
color_init(Eina_Strbuf *strbuf)
|
||||||
|
{
|
||||||
|
color_data *cd = malloc(sizeof(color_data));
|
||||||
|
if (!cd)
|
||||||
|
{
|
||||||
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
cd->strbuf = strbuf;
|
||||||
|
cd->cachebuf = eina_strbuf_new();
|
||||||
|
cd->thread = ecore_thread_run(init_thread_blocking, NULL, NULL, cd);
|
||||||
|
cd->macros = NULL;
|
||||||
|
|
||||||
|
return cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
color_term(color_data *cd)
|
||||||
|
{
|
||||||
|
ecore_thread_cancel(cd->thread);
|
||||||
|
|
||||||
|
eina_hash_free(cd->color_hash);
|
||||||
|
eina_strbuf_free(cd->cachebuf);
|
||||||
|
|
||||||
|
eina_stringshare_del(cd->col_string);
|
||||||
|
eina_stringshare_del(cd->col_comment);
|
||||||
|
eina_stringshare_del(cd->col_macro);
|
||||||
|
|
||||||
|
Eina_Stringshare *macro;
|
||||||
|
EINA_LIST_FREE(cd->macros, macro) eina_stringshare_del(macro);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < COL_NUM; i++)
|
||||||
|
eina_stringshare_del(cd->cols[i]);
|
||||||
|
|
||||||
|
free(cd);
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
color_apply(color_data *cd, const char *src, int length, char *from, char *to)
|
color_apply(color_data *cd, const char *src, int length, char *from, char *to)
|
||||||
{
|
{
|
|
@ -1,6 +1,11 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
|
|
||||||
struct syntax_helper_s
|
struct syntax_helper_s
|
||||||
{
|
{
|
||||||
|
@ -10,6 +15,10 @@ struct syntax_helper_s
|
||||||
Ecore_Timer *buf_flush_timer;
|
Ecore_Timer *buf_flush_timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
buf_flush_timer_cb(void *data)
|
buf_flush_timer_cb(void *data)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +32,10 @@ buf_flush_timer_cb(void *data)
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
syntax_helper *
|
syntax_helper *
|
||||||
syntax_init(void)
|
syntax_init(void)
|
||||||
{
|
{
|
|
@ -1,10 +1,20 @@
|
||||||
#include <Elementary.h>
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "common.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ENVENTOR_BETA_API_SUPPORT 1
|
||||||
|
|
||||||
|
#include <Enventor.h>
|
||||||
|
#include "enventor_private.h"
|
||||||
#include "template_code.h"
|
#include "template_code.h"
|
||||||
|
|
||||||
const char *NAME_SEED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
const char *NAME_SEED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
const int NAME_SEED_LEN = 52;
|
const int NAME_SEED_LEN = 52;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Internal method implementation */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
template_random_string_create(char *buf, int size)
|
template_random_string_create(char *buf, int size)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +37,7 @@ image_description_add(edit_data *ed)
|
||||||
if (images_block)
|
if (images_block)
|
||||||
{
|
{
|
||||||
elm_entry_cursor_pos_set(edit_entry, cursor_pos);
|
elm_entry_cursor_pos_set(edit_entry, cursor_pos);
|
||||||
template_insert(ed, TEMPLATE_INSERT_LIVE_EDIT);
|
template_insert(ed, TEMPLATE_INSERT_LIVE_EDIT, NULL, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -98,16 +108,21 @@ template_part_insert_cursor_pos_set(edit_data *ed,
|
||||||
return cursor_pos;
|
return cursor_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/*****************************************************************************/
|
||||||
|
/* Externally accessible calls */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
template_part_insert(edit_data *ed, Edje_Part_Type part_type,
|
template_part_insert(edit_data *ed, Edje_Part_Type part_type,
|
||||||
Template_Insert_Type insert_type, float rel1_x,
|
Template_Insert_Type insert_type, float rel1_x,
|
||||||
float rel1_y, float rel2_x, float rel2_y,
|
float rel1_y, float rel2_x, float rel2_y,
|
||||||
const Eina_Stringshare *group_name)
|
const Eina_Stringshare *group_name, char *syntax, size_t n)
|
||||||
{
|
{
|
||||||
Evas_Object *edit_entry = edit_entry_get(ed);
|
Evas_Object *edit_entry = edit_entry_get(ed);
|
||||||
int cursor_pos = template_part_insert_cursor_pos_set(ed, insert_type,
|
int cursor_pos = template_part_insert_cursor_pos_set(ed, insert_type,
|
||||||
group_name);
|
group_name);
|
||||||
if (cursor_pos == -1) return;
|
if (cursor_pos == -1) return EINA_FALSE;
|
||||||
|
|
||||||
int cursor_pos1 = elm_entry_cursor_pos_get(edit_entry);
|
int cursor_pos1 = elm_entry_cursor_pos_get(edit_entry);
|
||||||
int space = edit_cur_indent_depth_get(ed);
|
int space = edit_cur_indent_depth_get(ed);
|
||||||
|
|
||||||
|
@ -119,34 +134,33 @@ template_part_insert(edit_data *ed, Edje_Part_Type part_type,
|
||||||
int line_cnt;
|
int line_cnt;
|
||||||
char **t;
|
char **t;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
char part[20];
|
|
||||||
|
|
||||||
switch(part_type)
|
switch(part_type)
|
||||||
{
|
{
|
||||||
case EDJE_PART_TYPE_RECTANGLE:
|
case EDJE_PART_TYPE_RECTANGLE:
|
||||||
line_cnt = TEMPLATE_PART_RECT_LINE_CNT;
|
line_cnt = TEMPLATE_PART_RECT_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_PART_RECT;
|
t = (char **) &TEMPLATE_PART_RECT;
|
||||||
strcpy(part, "Rect");
|
strncpy(syntax, "Rect", n);
|
||||||
break;
|
break;
|
||||||
case EDJE_PART_TYPE_TEXT:
|
case EDJE_PART_TYPE_TEXT:
|
||||||
line_cnt = TEMPLATE_PART_TEXT_LINE_CNT;
|
line_cnt = TEMPLATE_PART_TEXT_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_PART_TEXT;
|
t = (char **) &TEMPLATE_PART_TEXT;
|
||||||
strcpy(part, "Text");
|
strncpy(syntax, "Text", n);
|
||||||
break;
|
break;
|
||||||
case EDJE_PART_TYPE_SWALLOW:
|
case EDJE_PART_TYPE_SWALLOW:
|
||||||
line_cnt = TEMPLATE_PART_SWALLOW_LINE_CNT;
|
line_cnt = TEMPLATE_PART_SWALLOW_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_PART_SWALLOW;
|
t = (char **) &TEMPLATE_PART_SWALLOW;
|
||||||
strcpy(part, "Swallow");
|
strncpy(syntax, "Swallow", n);
|
||||||
break;
|
break;
|
||||||
case EDJE_PART_TYPE_TEXTBLOCK:
|
case EDJE_PART_TYPE_TEXTBLOCK:
|
||||||
line_cnt = TEMPLATE_PART_TEXTBLOCK_LINE_CNT;
|
line_cnt = TEMPLATE_PART_TEXTBLOCK_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_PART_TEXTBLOCK;
|
t = (char **) &TEMPLATE_PART_TEXTBLOCK;
|
||||||
strcpy(part, "Textblock");
|
strncpy(syntax, "Textblock", n);
|
||||||
break;
|
break;
|
||||||
case EDJE_PART_TYPE_SPACER:
|
case EDJE_PART_TYPE_SPACER:
|
||||||
line_cnt = TEMPLATE_PART_SPACER_LINE_CNT;
|
line_cnt = TEMPLATE_PART_SPACER_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_PART_SPACER;
|
t = (char **) &TEMPLATE_PART_SPACER;
|
||||||
strcpy(part, "Spacer");
|
strncpy(syntax, "Spacer", n);
|
||||||
break;
|
break;
|
||||||
case EDJE_PART_TYPE_IMAGE:
|
case EDJE_PART_TYPE_IMAGE:
|
||||||
case EDJE_PART_TYPE_NONE:
|
case EDJE_PART_TYPE_NONE:
|
||||||
|
@ -159,7 +173,7 @@ template_part_insert(edit_data *ed, Edje_Part_Type part_type,
|
||||||
case EDJE_PART_TYPE_LAST:
|
case EDJE_PART_TYPE_LAST:
|
||||||
line_cnt = TEMPLATE_PART_IMAGE_LINE_CNT;
|
line_cnt = TEMPLATE_PART_IMAGE_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_PART_IMAGE;
|
t = (char **) &TEMPLATE_PART_IMAGE;
|
||||||
strcpy(part, "Image");
|
strncpy(syntax, "Image", n);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,71 +243,59 @@ template_part_insert(edit_data *ed, Edje_Part_Type part_type,
|
||||||
else if (part_type == EDJE_PART_TYPE_TEXTBLOCK)
|
else if (part_type == EDJE_PART_TYPE_TEXTBLOCK)
|
||||||
textblock_style_add(ed, random_name);
|
textblock_style_add(ed, random_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "Template code inserted. (%s Part)", part);
|
|
||||||
stats_info_msg_update(buf);
|
|
||||||
edit_syntax_color_partial_apply(ed, 0);
|
edit_syntax_color_partial_apply(ed, 0);
|
||||||
edit_changed_set(ed, EINA_TRUE);
|
edit_changed_set(ed, EINA_TRUE);
|
||||||
edit_save(ed);
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
Eina_Bool
|
||||||
template_insert(edit_data *ed, Template_Insert_Type insert_type)
|
template_insert(edit_data *ed, Template_Insert_Type insert_type, char *syntax, size_t n)
|
||||||
{
|
{
|
||||||
const char *EXCEPT_MSG = "Can't insert template code here. Move the cursor"
|
|
||||||
"inside the \"Collections,Images,Parts,Part,"
|
|
||||||
"Programs\" scope.";
|
|
||||||
|
|
||||||
Evas_Object *entry = edit_entry_get(ed);
|
Evas_Object *entry = edit_entry_get(ed);
|
||||||
Eina_Stringshare *paragh = edit_cur_paragh_get(ed);
|
Eina_Stringshare *paragh = edit_cur_paragh_get(ed);
|
||||||
if (!paragh)
|
Eina_Bool ret = EINA_FALSE;
|
||||||
{
|
if (!paragh) return EINA_FALSE;
|
||||||
stats_info_msg_update(EXCEPT_MSG);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(paragh, "parts"))
|
if (!strcmp(paragh, "parts"))
|
||||||
{
|
{
|
||||||
template_part_insert(ed, EDJE_PART_TYPE_IMAGE, TEMPLATE_INSERT_DEFAULT,
|
ret = template_part_insert(ed, EDJE_PART_TYPE_IMAGE,
|
||||||
REL1_X, REL1_Y, REL2_X, REL2_Y, NULL);
|
TEMPLATE_INSERT_DEFAULT,
|
||||||
|
REL1_X, REL1_Y, REL2_X, REL2_Y, NULL, syntax,
|
||||||
|
n);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
int line_cnt;
|
int line_cnt;
|
||||||
char **t = NULL;
|
char **t = NULL;
|
||||||
char buf[64];
|
|
||||||
char buf2[12];
|
|
||||||
|
|
||||||
if (!strcmp(paragh, "part"))
|
if (!strcmp(paragh, "part"))
|
||||||
{
|
{
|
||||||
line_cnt = TEMPLATE_DESC_LINE_CNT;
|
line_cnt = TEMPLATE_DESC_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_DESC;
|
t = (char **) &TEMPLATE_DESC;
|
||||||
strcpy(buf2, "Description");
|
strncpy(syntax, "Description", n);
|
||||||
}
|
}
|
||||||
else if (!strcmp(paragh, "programs"))
|
else if (!strcmp(paragh, "programs"))
|
||||||
{
|
{
|
||||||
line_cnt = TEMPLATE_PROG_LINE_CNT;
|
line_cnt = TEMPLATE_PROG_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_PROG;
|
t = (char **) &TEMPLATE_PROG;
|
||||||
strcpy(buf2, "Program");
|
strncpy(syntax, "Program", n);
|
||||||
}
|
}
|
||||||
else if (!strcmp(paragh, "images"))
|
else if (!strcmp(paragh, "images"))
|
||||||
{
|
{
|
||||||
line_cnt = TEMPLATE_IMG_LINE_CNT;
|
line_cnt = TEMPLATE_IMG_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_IMG;
|
t = (char **) &TEMPLATE_IMG;
|
||||||
strcpy(buf2, "Image File");
|
strncpy(syntax, "Image File", n);
|
||||||
}
|
}
|
||||||
else if (!strcmp(paragh, "collections"))
|
else if (!strcmp(paragh, "collections"))
|
||||||
{
|
{
|
||||||
line_cnt = TEMPLATE_GROUP_LINE_CNT;
|
line_cnt = TEMPLATE_GROUP_LINE_CNT;
|
||||||
t = (char **) &TEMPLATE_GROUP;
|
t = (char **) &TEMPLATE_GROUP;
|
||||||
strcpy(buf2, "Group");
|
strncpy(syntax, "Group", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!t)
|
if (!t) goto end;
|
||||||
{
|
|
||||||
stats_info_msg_update(EXCEPT_MSG);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
int cursor_pos = elm_entry_cursor_pos_get(entry);
|
int cursor_pos = elm_entry_cursor_pos_get(entry);
|
||||||
elm_entry_cursor_line_begin_set(entry);
|
elm_entry_cursor_line_begin_set(entry);
|
||||||
int cursor_pos1 = elm_entry_cursor_pos_get(entry);
|
int cursor_pos1 = elm_entry_cursor_pos_get(entry);
|
||||||
|
@ -324,9 +326,11 @@ template_insert(edit_data *ed, Template_Insert_Type insert_type)
|
||||||
elm_entry_cursor_pos_set(entry, cursor_pos);
|
elm_entry_cursor_pos_set(entry, cursor_pos);
|
||||||
|
|
||||||
edit_syntax_color_partial_apply(ed, 0);
|
edit_syntax_color_partial_apply(ed, 0);
|
||||||
snprintf(buf, sizeof(buf), "Template code inserted. (%s)", buf2);
|
|
||||||
stats_info_msg_update(buf);
|
ret = EINA_TRUE;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
eina_stringshare_del(paragh);
|
eina_stringshare_del(paragh);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
Loading…
Reference in New Issue