Merge branch 'release/edi-0.7'

This commit is contained in:
Andy Williams 2018-05-15 15:44:10 +01:00
commit 1b6cf6f4fc
63 changed files with 2649 additions and 1343 deletions

View File

@ -1,5 +1,5 @@
ajwillia.ms (Andy Williams) <andy@andywilliams.me>
netstar (Al Poole) <netstar@gmail.com>
netstar (Alastair Poole) <netstar@gmail.com>
okra (Stephen Houston) <smhouston88@gmail.com>
wilsonk (Kelly Wilson) <wilsonk@cpsc.ucalgary.ca>
YOhoho (YeongJong Lee) <cleanlyj@naver.com>

19
NEWS
View File

@ -1,3 +1,22 @@
---------
Edi 0.6.1
---------
Features:
* Added notification support.
* Added split-view option for editors.
* Updated project wizard and added new project templates.
* Include EFL examples in project wizard.
* Add support for Go projects.
* Improved debugging support.
* Added edi_scm helper command.
* Replace all in project.
Bug fixes:
* overall stability of the SCM git integration
=======
Edi 0.6
=======

View File

@ -1,17 +1,17 @@
EDI - The Enlightened IDE
Edi - The Enlightened IDE
===
This is a project to create a complete IDE using the EFL.
It aims to lower the barrier to getting involved in Enlightenment development
and in creating apps based on the EFL suite.
![EDI Logo](data/desktop/edi.png?raw=true)
![Edi Logo](data/desktop/edi.png?raw=true)
## Requirements
meson
ninja
EFL from git master (>= 1.20.99)
EFL latest release (>= 1.20.7)
libclang-dev (or llvm-clang-devel)
## Installation

2
TODO
View File

@ -1,9 +1,7 @@
This project is in heavy development, we are currenty working towards the
"Code aware editor" phase, the following work is still to be done:
* Replace text (project-wide)
* Code folding
* Split pane view (split a tab to multiple views on a file)
* Automatic code indenting / formatting
* notepad, emacs and vim and editing modes (key bindings)
* LLVM parsing

View File

@ -0,0 +1,67 @@
collections {
group {
name: "hellogui";
max: 128 128;
data {
item: "title" "C EFL Beta Hello World";
item: "path" "tutorials/c/hellogui/";
item: "description"
"Hello World using the EFL Beta APIs";
}
parts {
part { name: "icon";
description { state: "default" 0.0;
max: 128 128;
images.image: "hellogui.png" COMP;
image.normal: "hellogui.png";
}
}
}
}
group {
name: "life";
max: 128 128;
data {
item: "title" "C EFL Beta Game of Life";
item: "path" "apps/c/life/";
item: "description"
"Game of Life using the EFL Beta APIs";
}
parts {
part { name: "icon";
description { state: "default" 0.0;
max: 128 128;
images.image: "life.png" COMP;
image.normal: "life.png";
}
}
}
}
group {
name: "texteditor";
max: 128 128;
data {
item: "title" "C EFL Beta Basic Text Editor";
item: "path" "apps/c/texteditor/";
item: "description"
"A basic text editor app using the EFL Beta APIs";
}
parts {
part { name: "icon";
description { state: "default" 0.0;
max: 128 128;
images.image: "texteditor.png" COMP;
image.normal: "texteditor.png";
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,20 @@
tar = find_program('tar')
edje_cc = find_program('edje_cc')
cmd = [ edje_cc,
'-id', join_paths(meson.source_root(), 'data' , 'extra', 'examples', 'images'),
'@INPUT@', '@OUTPUT@'
]
examples_dir = join_paths(get_option('datadir'), 'edi', 'examples')
custom_target('examples_meta',
input : 'examples.edc',
output : 'examples.edj',
command : cmd,
install_dir: examples_dir,
install: true,
)
out = join_paths(get_option('prefix'), examples_dir, 'examples.edj')
meson.add_install_script('../../../scripts/world_read.sh', out)

View File

@ -1,23 +0,0 @@
data {
item: "title" "C EFL Project";
item: "file" "skeletons/eflproject.tar.gz";
item: "description"
"Begin your C programming EFL project. All content is freely modifiable and distributable and licensed in the public-domain.<br><br>Happy hacking!";
}
collections {
group {
name: "logo";
max: 128 128;
parts {
part { name: "icon";
description { state: "default" 0.0;
max: 128 128;
image.image: "c.png" COMP;
image.normal: "c.png";
}
}
}
}
}

View File

@ -1,23 +0,0 @@
data {
item: "title" "Python EFL Project";
item: "file" "skeletons/eflproject_python.tar.gz";
item: "description"
"Start your new EFL Python programming project. All code is in the public-domain, you are free to modify and distribute as you wish.";
}
collections {
group {
name: "logo";
max: 128 128;
parts {
part { name: "icon";
description { state: "default" 0.0;
max: 128 128;
image.image: "python.png" COMP;
image.normal: "python.png";
}
}
}
}
}

View File

@ -6,11 +6,13 @@ skeleton_names = ['eflproject', 'eflproject_python']
foreach skeleton_name : skeleton_names
custom_target('skeleton ' + skeleton_name,
command : [tar, 'zcf', '@OUTPUT@', '-C', '../data/extra/templates/skeletons', skeleton_name],
input : 'skeletons' + '/' + skeleton_name,
output : skeleton_name + '.tar.gz',
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'templates', 'skeletons'),
install : true,
command : [tar, 'zcf', '@OUTPUT@', '-C',
join_paths(meson.source_root(), 'data', 'extra', 'templates', 'skeletons'),
skeleton_name],
input : join_paths('skeletons', skeleton_name),
output : skeleton_name + '.tar.gz',
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'templates'),
install : true,
)
endforeach
@ -20,17 +22,14 @@ cmd = [ edje_cc,
'@INPUT@', '@OUTPUT@'
]
skeleton_meta = ['eflproject', 'eflproject_python']
foreach meta : skeleton_meta
custom_target('meta ' + meta,
input : meta + '.edc',
output : meta + '.edj',
command : cmd,
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'templates'),
install: true,
)
out = join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'templates') + '/' + meta + '.edj'
meson.add_install_script('chmod', 'a+r', out)
endforeach
template_dir = join_paths(get_option('datadir'), 'edi', 'templates')
custom_target('templates_meta',
input : 'templates.edc',
output : 'templates.edj',
command : cmd,
install_dir: template_dir,
install: true,
)
out = join_paths(get_option('prefix'), template_dir, 'templates.edj')
meson.add_install_script('../../../scripts/world_read.sh', out)

View File

@ -0,0 +1,45 @@
collections {
group {
name: "eflproject";
max: 128 128;
data {
item: "title" "C EFL Project";
item: "path" "eflproject";
item: "description"
"Begin your C programming EFL project. All content is freely modifiable and distributable and licensed in the public-domain.<br><br>Happy hacking!";
}
parts {
part { name: "icon";
description { state: "default" 0.0;
max: 128 128;
images.image: "c.png" COMP;
image.normal: "c.png";
}
}
}
}
group {
name: "eflproject_python";
max: 128 128;
data {
item: "title" "Python EFL Project";
item: "path" "eflproject_python";
item: "description"
"Start your new EFL Python programming project. All code is in the public-domain, you are free to modify and distribute as you wish.";
}
parts {
part { name: "icon";
description { state: "default" 0.0;
max: 128 128;
images.image: "python.png" COMP;
image.normal: "python.png";
}
}
}
}
}

View File

@ -1,3 +1,4 @@
subdir('desktop')
subdir('images')
subdir('extra/templates')
subdir('extra/examples')

View File

@ -1,21 +0,0 @@
images.image: "enlightenment.png" COMP;
collections {
sounds {
sample {
name: "bell" LOSSY 64;
source: "bell.wav";
}
}
group {
name: "test";
parts {
part { name: "main"; type: IMAGE;
description {
image.normal: "enlightenment.png";
}
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

View File

@ -1,6 +1,6 @@
project(
'edi', 'c',
version : '0.6.99',
version : '0.6.1',
default_options: [ 'c_std=gnu99', 'warning_level=2' ],
meson_version : '>= 0.39.0')
@ -22,7 +22,7 @@ config_h.set_quoted('PACKAGE_DOC_DIR', join_paths(get_option('prefix'), get_opti
config_h.set_quoted('EFL_BETA_API_SUPPORT' , '1')
elm = dependency('elementary')
elm = dependency('elementary', version : '>=1.20.7')
top_inc = include_directories('.')
cc = meson.get_compiler('c')

View File

@ -1,59 +1,38 @@
# Maintainer: Enlightenment Developers <enlightenment-devel@enlightenment.org>
pkgname=('edi-git' 'edi_doc-git')
pkgver=0.4.99.0001
pkgname='edi-git'
pkgver=0.6.99.0001
pkgrel=1
pkgdesc="Enlightenment toolkit edi - GIT development snapshot"
pkgdesc="Efl based IDE - GIT development snapshot"
arch=('i686' 'x86_64' 'arm')
url="http://andywilliams.me"
url="https://www.enlightenment.org/about-edi"
license=('GPLv2')
makedepends=('doxygen' 'imagemagick' 'git')
depends=('efl-git')
options=('!libtool' 'debug')
makedepends=('git' 'meson')
depends=('efl-git' 'clang' 'check')
options=('!libtool' 'debug' '!strip')
provides=('edi')
source=("edi-git::git+https://github.com/Enlightenment/edi.git#branch=develop")
sha256sums=('SKIP')
pkgver() {
cd "../.."
for _i in v_maj v_min v_mic; do
local v_ver=$v_ver.$(grep -m 1 $_i configure.ac | sed 's/m4//' | grep -o "[[:digit:]]*")
done
v_ver=$(awk -F , -v v_ver=${v_ver#.} '/^AC_INIT/ {gsub(/v_ver/, v_ver); gsub(/[\[\] -]/, ""); print $2}' configure.ac)
printf "$v_ver.$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
cd "$pkgname"
(set -o pipefail
git describe --tags 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' ||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
)
}
build() {
cd "../.."
export CFLAGS="$CFLAGS -fvisibility=hidden -fomit-frame-pointer"
[[ -e Makefile ]] && make clean distclean
./configure --prefix=/usr \
--disable-static
make
make doc
cd "$pkgname"
meson --buildtype=release --prefix=/usr build/
ninja -C build/
}
package_edi-git() {
cd "../.."
make -j1 DESTDIR="$pkgdir/" install
install -Dm644 README "$pkgdir/usr/share/$pkgname/README"
install -Dm644 NEWS "$pkgdir/usr/share/$pkgname/NEWS"
install -Dm644 ChangeLog "$pkgdir/usr/share/$pkgname/ChangeLog"
install -Dm644 AUTHORS "$pkgdir/usr/share/$pkgname/AUTHORS"
install -Dm644 COMPLIANCE "$pkgdir/usr/share/$pkgname/COMPLIANCE"
install -Dm644 COPYING.images "$pkgdir/usr/share/licenses/$pkgname/COPYING.images"
sed -n '1,/details./p' COPYING > "$pkgdir/usr/share/licenses/$pkgname/COPYING"
ln -s "../licenses/$pkgname/COPYING" "$pkgdir/usr/share/$pkgname/COPYING"
ln -s "../licenses/$pkgname/COPYING.images" "$pkgdir/usr/share/$pkgname/COPYING.images"
check() {
cd "$pkgname"
ninja -C build/ test
}
package_edi_doc-git() {
pkgdesc="Documentation for Edi"
arch=('any')
unset depends optdepends
cd "../.."
mkdir -p "$pkgdir/usr/share/doc/$pkgname"
cp -a doc/html "$pkgdir/usr/share/doc/$pkgname/html"
cp -a doc/latex "$pkgdir/usr/share/doc/$pkgname/latex"
package() {
cd "$pkgname"
DESTDIR="$pkgdir/" ninja -C build/ install
}

File diff suppressed because it is too large Load Diff

5
scripts/world_read.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
for file in "$@" ; do
chmod a+r "$DESTDIR/$file"
done

View File

@ -41,7 +41,7 @@ _exe_del(void *d EINA_UNUSED, int t EINA_UNUSED, void *event_info EINA_UNUSED)
static const Ecore_Getopt optdesc = {
"edi_build",
"%prog [options] [build|clean|create|test]",
"%prog [options] [build|clean|test|create|example]",
PACKAGE_VERSION,
COPYRIGHT,
"BSD with advertisement clause",
@ -107,9 +107,17 @@ static void
_edi_build_create_start(int argc, int arg0, char **argv)
{
elm_init(argc, argv);
edi_create_efl_project(argv[arg0 + 1], argv[arg0 + 2], argv[arg0 + 3],
argv[arg0 + 4], argv[arg0 + 5], argv[arg0 + 6],
_edi_build_create_done_cb);
edi_create_project(argv[arg0 + 1], argv[arg0 + 2], argv[arg0 + 3],
argv[arg0 + 4], argv[arg0 + 5], argv[arg0 + 6],
_edi_build_create_done_cb);
}
static void
_edi_build_example_start(int argc, int arg0, char **argv)
{
elm_init(argc, argv);
edi_create_example(argv[arg0 + 1], argv[arg0 + 2], argv[arg0 + 3],
_edi_build_create_done_cb);
}
EAPI_MAIN int
@ -165,13 +173,27 @@ main(int argc, char **argv)
if (argc - args != 7)
{
fprintf(stderr, _("create requires 6 additional parameters:\n"));
fprintf(stderr, " skeleton, parent_path, project_name, "
fprintf(stderr, " template_name, parent_path, project_name, "
"project_url, creator_name, creator_email\n");
goto end;
}
_edi_build_create_start(argc, args, argv);
ecore_main_loop_begin();
goto end;
}
if (!strncmp("example", build_type, 7))
{
if (argc - args != 4)
{
fprintf(stderr, _("example requires 3 additional parameters:\n"));
fprintf(stderr, " example_name, parent_path, project_name\n");
goto end;
}
_edi_build_example_start(argc, args, argv);
ecore_main_loop_begin();
goto end;
}

View File

@ -42,7 +42,7 @@
((EDI_CONFIG_FILE_EPOCH << 16) | EDI_CONFIG_FILE_GENERATION)
# define EDI_PROJECT_CONFIG_FILE_EPOCH 0x0002
# define EDI_PROJECT_CONFIG_FILE_GENERATION 0x0004
# define EDI_PROJECT_CONFIG_FILE_GENERATION 0x0005
# define EDI_PROJECT_CONFIG_FILE_VERSION \
((EDI_PROJECT_CONFIG_FILE_EPOCH << 16) | EDI_PROJECT_CONFIG_FILE_GENERATION)
@ -85,6 +85,12 @@ _edi_project_config_dir_get(void)
return dir;
}
const char *
_edi_project_config_debug_command_get(void)
{
return _edi_project_config->debug_command;
}
/* local functions */
static Edi_Config_DD *
_edi_config_descriptor_new(const char *name, int size)
@ -136,6 +142,7 @@ _edi_project_config_cb_free(void)
EINA_LIST_FREE(panel->tabs, tab)
{
if (tab->path) eina_stringshare_del(tab->path);
if (tab->fullpath) eina_stringshare_del(tab->fullpath);
if (tab->type) eina_stringshare_del(tab->type);
free(tab);
}
@ -144,6 +151,7 @@ _edi_project_config_cb_free(void)
EINA_LIST_FREE(_edi_project_config->windows, tab)
{
if (tab->path) eina_stringshare_del(tab->path);
if (tab->fullpath) eina_stringshare_del(tab->fullpath);
if (tab->type) eina_stringshare_del(tab->type);
free(tab);
}
@ -244,7 +252,9 @@ _edi_config_init(void)
#define T Edi_Project_Config_Tab
#define D _edi_proj_cfg_tab_edd
EDI_CONFIG_VAL(D, T, path, EET_T_STRING);
EDI_CONFIG_VAL(D, T, fullpath, EET_T_STRING);
EDI_CONFIG_VAL(D, T, type, EET_T_STRING);
EDI_CONFIG_VAL(D, T, split_views, EET_T_INT);
_edi_proj_cfg_panel_edd = EDI_CONFIG_DD_NEW("Project_Config_Panel", Edi_Project_Config_Panel);
#undef T
@ -263,6 +273,8 @@ _edi_config_init(void)
EDI_CONFIG_VAL(D, T, font.name, EET_T_STRING);
EDI_CONFIG_VAL(D, T, font.size, EET_T_INT);
EDI_CONFIG_VAL(D, T, gui.translucent, EET_T_UCHAR);
EDI_CONFIG_VAL(D, T, gui.alpha, EET_T_INT);
EDI_CONFIG_VAL(D, T, gui.theme, EET_T_STRING);
EDI_CONFIG_VAL(D, T, gui.width, EET_T_INT);
EDI_CONFIG_VAL(D, T, gui.height, EET_T_INT);
EDI_CONFIG_VAL(D, T, gui.leftsize, EET_T_DOUBLE);
@ -278,6 +290,7 @@ _edi_config_init(void)
EDI_CONFIG_VAL(D, T, launch.path, EET_T_STRING);
EDI_CONFIG_VAL(D, T, launch.args, EET_T_STRING);
EDI_CONFIG_VAL(D, T, debug_command, EET_T_STRING);
EDI_CONFIG_VAL(D, T, user_fullname, EET_T_STRING);
EDI_CONFIG_VAL(D, T, user_email, EET_T_STRING);
@ -379,7 +392,7 @@ _edi_config_project_add(const char *path)
project = malloc(sizeof(*project));
project->path = eina_stringshare_add(path);
project->name = eina_stringshare_add(basename((char*) path));
project->name = eina_stringshare_add(ecore_file_file_get(path));
_edi_config->projects = eina_list_prepend(_edi_config->projects, project);
_edi_config_save();
}
@ -460,6 +473,7 @@ void
_edi_project_config_load()
{
Eina_Bool save = EINA_FALSE;
Edi_Build_Provider *provider;
_edi_project_config = _edi_config_domain_load(_edi_project_config_dir_get(), EDI_PROJECT_CONFIG_NAME, _edi_proj_cfg_edd);
if (_edi_project_config)
@ -494,7 +508,6 @@ _edi_project_config_load()
/* setup defaults */
IFPCFG(0x0001);
_edi_project_config->gui.translucent = EINA_TRUE;
_edi_project_config->gui.width = 640;
_edi_project_config->gui.height = 480;
_edi_project_config->gui.leftsize = 0.25;
@ -514,7 +527,22 @@ _edi_project_config_load()
IFPCFGEND;
IFPCFG(0x0003);
_edi_project_config->gui.tab_inserts_spaces = EINA_TRUE;
provider = edi_build_provider_for_project_get();
if (provider && !strcmp("go", provider->id))
_edi_project_config->gui.tab_inserts_spaces = EINA_FALSE;
else
_edi_project_config->gui.tab_inserts_spaces = EINA_TRUE;
IFPCFGEND;
IFPCFG(0x0004);
_edi_project_config->panels = NULL;
_panel_add();
_edi_project_config->windows = NULL;
IFPCFGEND;
IFPCFG(0x0005);
_edi_project_config->gui.translucent = EINA_FALSE;
_edi_project_config->gui.alpha = 255;
IFPCFGEND;
/* limit config values so they are sane */
@ -527,12 +555,6 @@ _edi_project_config_load()
_edi_project_config->version = EDI_PROJECT_CONFIG_FILE_VERSION;
IFPCFG(0x0004);
_edi_project_config->panels = NULL;
_panel_add();
_edi_project_config->windows = NULL;
IFPCFGEND;
if (save) _edi_project_config_save_no_notify();
}
@ -576,13 +598,16 @@ _edi_project_config_tab_add(const char *path, const char *type,
Edi_Project_Config_Tab *tab;
Eina_List **tabs;
tab = malloc(sizeof(*tab));
tab = calloc(1, sizeof(*tab));
// let's keep paths relative
if (!strncmp(path, edi_project_get(), strlen(edi_project_get())))
tab->path = eina_stringshare_add(path + strlen(edi_project_get()) + 1);
else
tab->path = eina_stringshare_add(path);
tab->fullpath = eina_stringshare_add(ecore_file_realpath(path));
tab->type = eina_stringshare_add(type);
tabs = _tablist_get(windowed, panel_id);
@ -611,6 +636,7 @@ _edi_project_config_tab_remove(const char *path, Eina_Bool windowed, int panel_i
_edi_project_config_save_no_notify();
eina_stringshare_del(tab->path);
eina_stringshare_del(tab->fullpath);
if (tab->type)
eina_stringshare_del(tab->type);
free(tab);
@ -631,6 +657,8 @@ _edi_project_config_panel_remove(int panel_id)
{
if (tab->path)
eina_stringshare_del(tab->path);
if (tab->fullpath)
eina_stringshare_del(tab->fullpath);
if (tab->type)
eina_stringshare_del(tab->type);
free(tab);
@ -640,3 +668,24 @@ _edi_project_config_panel_remove(int panel_id)
_edi_project_config_save_no_notify();
}
void
_edi_project_config_tab_split_view_count_set(const char *path, int panel_id, int count)
{
Edi_Project_Config_Tab *tab;
Eina_List *list, *next;
Edi_Project_Config_Panel *panel = eina_list_nth(_edi_project_config->panels, panel_id);
if (!panel)
return;
EINA_LIST_FOREACH_SAFE(panel->tabs, list, next, tab)
{
if (!strcmp(tab->fullpath, path))
{
tab->split_views = count;
_edi_project_config_save_no_notify();
return;
}
}
}

View File

@ -55,7 +55,9 @@ struct _Edi_Project_Config_Panel
struct _Edi_Project_Config_Tab
{
const char *path;
const char *fullpath;
const char *type;
int split_views;
};
struct _Edi_Project_Config_Launch
@ -77,6 +79,8 @@ struct _Edi_Project_Config
struct
{
Eina_Bool translucent;
int alpha;
const char *theme;
int width, height, bottomtab;
double leftsize, bottomsize;
Eina_Bool leftopen, bottomopen;
@ -88,6 +92,7 @@ struct _Edi_Project_Config
} gui;
Edi_Project_Config_Launch launch;
Eina_Stringshare *debug_command;
Eina_Stringshare *user_fullname;
Eina_Stringshare *user_email;
@ -103,6 +108,7 @@ extern Edi_Project_Config *_edi_project_config;
Eina_Bool _edi_config_init(void);
Eina_Bool _edi_config_shutdown(void);
const char *_edi_config_dir_get(void);
const char *_edi_project_config_debug_command_get(void);
// Global configuration handling
@ -125,6 +131,8 @@ void _edi_project_config_tab_add(const char *path, const char *type,
void _edi_project_config_tab_remove(const char *path, Eina_Bool windowed, int panel_id);
void _edi_project_config_tab_current_set(int panel_id, int tab_id);
void _edi_project_config_panel_remove(int panel_id);
void _edi_project_config_tab_split_view_count_set(const char *path, int panel_id, int count);
#ifdef __cplusplus
}

View File

@ -152,6 +152,25 @@ void edi_consolepanel_clear()
_edi_test_count = _edi_test_pass = _edi_test_fail = 0;
}
static void
_edi_test_output_suite(int count, int pass, int fail)
{
char *line;
const char *format = _("Total pass %d (%d%%), fail %d)");
int linemax, percent;
linemax = strlen(format) - 6 + 30;
line = malloc(sizeof(char) * linemax);
percent = 0;
if (count > 0)
percent = (int) ((pass / (double) count) * 100);
snprintf(line, linemax, format, pass, percent, fail);
elm_code_file_line_append(_edi_test_code->file, line, strlen(line), (fail > 0) ? _EDI_SUITE_FAILED : _EDI_SUITE_PASSED);
free(line);
}
static Eina_Bool
_exe_data(void *d EINA_UNUSED, int t EINA_UNUSED, void *event_info)
{
@ -178,23 +197,15 @@ _exe_error(void *d EINA_UNUSED, int t EINA_UNUSED, void *event_info)
return ECORE_CALLBACK_RENEW;
}
static void
_edi_test_output_suite(int count, int pass, int fail)
static Eina_Bool
_exe_done(void *d EINA_UNUSED, int t EINA_UNUSED, void *event_info EINA_UNUSED)
{
char *line;
const char *format = _("Total pass %d (%d%%), fail %d)");
int linemax, percent;
if (_edi_test_count == 0)
return ECORE_CALLBACK_RENEW;
linemax = strlen(format) - 6 + 30;
line = malloc(sizeof(char) * linemax);
percent = 0;
if (count > 0)
percent = (int) ((pass / (double) count) * 100);
snprintf(line, linemax, format, pass, percent, fail);
elm_code_file_line_append(_edi_test_code->file, line, strlen(line), (fail > 0) ? _EDI_SUITE_FAILED : _EDI_SUITE_PASSED);
free(line);
_edi_test_output_suite(_edi_test_count, _edi_test_pass, _edi_test_fail);
_edi_test_count = 0;
return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
@ -310,6 +321,23 @@ static void _edi_test_line_callback(const char *content)
{
_edi_test_line_parse_suite(content + 6);
}
else if (!strncmp(content, "=== RUN", 7))
{
edi_testpanel_show();
_edi_test_count++;
}
else if (!strncmp(content, "--- PASS:", 9))
{
_edi_test_pass++;
elm_code_file_line_append(_edi_test_code->file, content + 10, strlen(content) - 10, _EDI_SUITE_PASSED);
}
else if (!strncmp(content, "--- FAIL:", 9))
{
_edi_test_fail++;
elm_code_file_line_append(_edi_test_code->file, content + 10, strlen(content) - 10, _EDI_SUITE_FAILED);
}
}
static Eina_Bool
@ -353,6 +381,7 @@ void edi_consolepanel_add(Evas_Object *parent)
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _exe_data, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _exe_error, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _exe_done, NULL);
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_consolepanel_config_changed, NULL);
}

226
src/bin/edi_debug.c Normal file
View File

@ -0,0 +1,226 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined (__APPLE__) || defined(__OpenBSD__)
#include <unistd.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#endif
#if defined(__OpenBSD__)
#include <sys/proc.h>
#endif
#include <Eo.h>
#include <Eina.h>
#include <Elementary.h>
#include "edi_debug.h"
#include "edi_config.h"
#include "edi_private.h"
Edi_Debug_Tool _debugger_tools[] = {
{ "gdb", "gdb", NULL, "run\n", "c\n", "set args %s" },
{ "lldb", "lldb", NULL, "run\n", "c\n", "settings set target.run-args %s" },
{ "pdb", "pdb", NULL, NULL, "c\n", "run %s" },
{ "memcheck", "valgrind", "--tool=memcheck", NULL, NULL, NULL },
{ "massif", "valgrind", "--tool=massif", NULL, NULL, NULL },
{ "callgrind", "valgrind", "--tool=callgrind", NULL, NULL, NULL },
{ NULL, NULL, NULL, NULL, NULL, NULL },
};
Edi_Debug *_debugger = NULL;
Edi_Debug *edi_debug_new(void)
{
_debugger = calloc(1, sizeof(Edi_Debug));
return _debugger;
}
Edi_Debug *edi_debug_get(void)
{
return _debugger;
}
Edi_Debug_Tool *edi_debug_tools_get(void)
{
return _debugger_tools;
}
Edi_Debug_Tool *edi_debug_tool_get(const char *name)
{
int i;
for (i = 0; _debugger_tools[i].name && name; i++)
{
if (!strcmp(_debugger_tools[i].name, name) &&
ecore_file_app_installed(_debugger_tools[i].exec))
return &_debugger_tools[i];
}
// Fallback, but not installed.
if (name || !ecore_file_app_installed(_debugger_tools[0].exec))
return NULL;
// Fallback to first.
return &_debugger_tools[0];
}
#if defined(__FreeBSD__) || defined(__DragonFly__)
static long int
_sysctlfromname(const char *name, void *mib, int depth, size_t *len)
{
long int result;
if (sysctlnametomib(name, mib, len) < 0) return -1;
*len = sizeof(result);
if (sysctl(mib, depth, &result, len, NULL, 0) < 0) return -1;
return result;
}
#endif
/* Get the process ID of the child process being debugged in *our* session */
int edi_debug_process_id(Edi_Debug *debugger)
{
int my_pid, child_pid = -1;
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined (__APPLE__) || defined(__OpenBSD__)
struct kinfo_proc kp;
int mib[6];
size_t len;
int max_pid, i;
if (!debugger->program_name) return -1;
if (!debugger->exe) return -1;
#if defined(__FreeBSD__) || defined(__DragonFly__)
len = sizeof(max_pid);
max_pid = _sysctlfromname("kern.lastpid", mib, 2, &len);
#elif defined(PID_MAX)
max_pid = PID_MAX;
#else
max_pid = 99999;
#endif
my_pid = ecore_exe_pid_get(debugger->exe);
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
if (sysctlnametomib("kern.proc.pid", mib, &len) < 0) return -1;
#elif defined(__OpenBSD__)
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[4] = sizeof(struct kinfo_proc);
mib[5] = 1;
#endif
for (i = my_pid; i <= max_pid; i++)
{
mib[3] = i;
len = sizeof(kp);
#if defined(__OpenBSD__)
if (sysctl(mib, 6, &kp, &len, NULL, 0) == -1) continue;
#else
if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) continue;
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
if (kp.ki_ppid != my_pid) continue;
if (strcmp(debugger->program_name, kp.ki_comm)) continue;
child_pid = kp.ki_pid;
if (kp.ki_stat == SRUN || kp.ki_stat == SSLEEP)
debugger->state = EDI_DEBUG_PROCESS_ACTIVE;
else
debugger->state = EDI_DEBUG_PROCESS_SLEEPING;
#elif defined(__OpenBSD__)
if (kp.p_ppid != my_pid) continue;
if (strcmp(debugger->program_name, kp.p_comm)) continue;
child_pid = kp.p_pid;
if (kp.p_stat == SRUN || kp.p_stat == SSLEEP)
debugger->state = EDI_DEBUG_PROCESS_ACTIVE;
else
debugger->state = EDI_DEBUG_PROCESS_SLEEPING;
#else /* APPLE */
if (kp.kp_proc.p_oppid != my_pid) continue;
if (strcmp(debugger->program_name, kp.kp_proc.p_comm)) continue;
child_pid = kp.kp_proc.p_pid;
if (kp.kp_proc.p_stat == SRUN || kp.kp_proc.p_stat == SSLEEP)
debugger->state = EDI_DEBUG_PROCESS_ACTIVE;
else
debugger->state = EDI_DEBUG_PROCESS_SLEEPING;
#endif
break;
}
#else
Eina_List *files, *l;
const char *temp_name;
char path[PATH_MAX];
char buf[4096];
char *p, *name, *end;
FILE *f;
int count, parent_pid, pid;
if (!debugger->program_name)
return -1;
if (!debugger->exe) return -1;
my_pid = ecore_exe_pid_get(debugger->exe);
files = ecore_file_ls("/proc");
EINA_LIST_FOREACH(files, l, name)
{
pid = atoi(name);
if (!pid) continue;
snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
f = fopen(path, "r");
if (!f) continue;
p = fgets(buf, sizeof(buf), f);
fclose(f);
if (!p) continue;
temp_name = ecore_file_file_get(buf);
if (!strcmp(temp_name, debugger->program_name))
{
parent_pid = 0;
// Match success - program name with pid.
child_pid = pid;
snprintf(path, sizeof(path), "/proc/%d/stat", pid);
f = fopen(path, "r");
if (f)
{
count = 0;
p = fgets(buf, sizeof(buf), f);
while (*p++ != '\0')
{
if (p[0] == ' ') { count++; p++; }
if (count == 2)
{
if (p[0] == 'S' || p[0] == 'R')
debugger->state = EDI_DEBUG_PROCESS_ACTIVE;
else
debugger->state = EDI_DEBUG_PROCESS_SLEEPING;
}
if (count == 3) break;
}
end = strchr(p, ' ');
if (end)
{
*end = '\0';
// parent pid matches - right process.
parent_pid = atoi(p);
}
fclose(f);
}
if (parent_pid == my_pid)
break;
}
}
if (files)
eina_list_free(files);
#endif
return child_pid;
}

103
src/bin/edi_debug.h Normal file
View File

@ -0,0 +1,103 @@
#ifndef EDI_DEBUG_H_
# define EDI_DEBUG_H_
#include <Elementary.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file
* @brief These routines are used for managing debugging features.
*/
typedef enum {
EDI_DEBUG_PROCESS_SLEEPING = 0,
EDI_DEBUG_PROCESS_ACTIVE
} Edi_Debug_Process_State;
typedef struct _Edi_Debug_Tool {
const char *name;
const char *exec;
const char *arguments;
const char *command_start;
const char *command_continue;
const char *command_arguments;
} Edi_Debug_Tool;
typedef struct _Edi_Debug {
Edi_Debug_Tool *tool;
const char *program_name;
Ecore_Exe *exe;
char cmd[1024];
Edi_Debug_Process_State state;
} Edi_Debug;
/**
* @brief Debug management functions.
* @defgroup Debug
*
* @{
*
* Initialisation and management of debugging features.
*
*/
/**
* Initialise debugger internals.
*
* @return pointer to initialized debug instance.
*
* @ingroup Debug
*/
Edi_Debug *edi_debug_new(void);
/**
* Obtain pointer to initialized debug instance.
*
* @ingroup Debug
*/
Edi_Debug *edi_debug_get(void);
/**
* Obtain process information of debugged process.
*
* @param debugger Edi_Debug instance.
*
* @return process id of debugged process that is child of running debugger.
*
* @ingroup Debug
*/
int edi_debug_process_id(Edi_Debug *debugger);
/**
* Obtain debugging info for given program name.
*
* @param name The name of the tool used to obtain helper data for given program.
*
* @return Pointer to debugging information instance associated with its name.
*
* @ingroup Debug
*/
Edi_Debug_Tool *edi_debug_tool_get(const char *name);
/**
* Return a pointer to the list of available debugging tools.
*
* @return Pointer to debugging information for all available tools.
*
* @ingroup Debug
*/
Edi_Debug_Tool *edi_debug_tools_get(void);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* EDI_DEBUG_H_ */

View File

@ -2,20 +2,11 @@
# include "config.h"
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined (__APPLE__) || defined(__OpenBSD__)
#include <unistd.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#endif
#if defined(__OpenBSD__)
#include <sys/proc.h>
#endif
#include <Eo.h>
#include <Eina.h>
#include <Elementary.h>
#include "edi_debug.h"
#include "edi_debugpanel.h"
#include "edi_config.h"
@ -27,21 +18,16 @@
#define LIBTOOL_COMMAND "libtool"
#endif
static Ecore_Exe *_debug_exe = NULL;
static Evas_Object *_info_widget, *_entry_widget, *_button_start, *_button_quit;
static Evas_Object *_button_int, *_button_term;
static Elm_Code *_debug_output;
#define DEBUG_PROCESS_SLEEPING 0
#define DEBUG_PROCESS_ACTIVE 1
static void
_edi_debugpanel_line_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
Elm_Code_Line *line;
line = (Elm_Code_Line *)event->info;
if (line->data)
line->status = ELM_CODE_STATUS_TYPE_ERROR;
}
@ -58,10 +44,17 @@ static Eina_Bool
_debugpanel_stdout_handler(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Exe_Event_Data *ev;
Edi_Debug *debug;
int idx;
char *start, *end = NULL;
ev = event;
debug = edi_debug_get();
if (ev->exe != debug->exe)
return ECORE_CALLBACK_RENEW;
if (ev && ev->size)
{
if (!ev->data) return ECORE_CALLBACK_DONE;
@ -102,6 +95,7 @@ _edi_debugpanel_keypress_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Ob
const char *text_markup;
char *command, *text;
Eina_Bool res;
Edi_Debug *debug = edi_debug_get();
event = event_info;
@ -111,7 +105,7 @@ _edi_debugpanel_keypress_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Ob
if (!strcmp(event->key, "Return"))
{
if (!_debug_exe) return;
if (!debug->exe) return;
text_markup = elm_object_part_text_get(_entry_widget, NULL);
text = elm_entry_markup_to_utf8(text_markup);
@ -119,7 +113,7 @@ _edi_debugpanel_keypress_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Ob
{
command = malloc(strlen(text) + 2);
snprintf(command, strlen(text) + 2, "%s\n", text);
res = ecore_exe_send(_debug_exe, command, strlen(command));
res = ecore_exe_send(debug->exe, command, strlen(command));
if (res)
elm_code_file_line_append(_debug_output->file, command, strlen(command) - 1, NULL);
@ -130,180 +124,19 @@ _edi_debugpanel_keypress_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Ob
}
}
#if defined(__FreeBSD__) || defined(__DragonFly__)
static long int
_sysctlfromname(const char *name, void *mib, int depth, size_t *len)
static void
_edi_debugpanel_icons_update(Edi_Debug_Process_State state)
{
long int result;
Evas_Object *ico_int;
if (sysctlnametomib(name, mib, len) < 0) return -1;
*len = sizeof(result);
if (sysctl(mib, depth, &result, len, NULL, 0) < 0) return -1;
ico_int = elm_icon_add(_button_int);
return result;
}
#endif
if (state == EDI_DEBUG_PROCESS_ACTIVE)
elm_icon_standard_set(ico_int, "media-playback-pause");
else
elm_icon_standard_set(ico_int, "media-playback-start");
/* Get the process ID of the child process being debugged in *our* session */
static int
_edi_debug_process_id(int *state)
{
const char *program_name;
int my_pid, child_pid = -1;
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined (__APPLE__) || defined(__OpenBSD__)
struct kinfo_proc kp;
int mib[6];
size_t len;
int max_pid, i;
if (!_edi_project_config->launch.path) return -1;
if (!_debug_exe) return -1;
#if defined(__FreeBSD__) || defined(__DragonFly__)
len = sizeof(max_pid);
max_pid = _sysctlfromname("kern.lastpid", mib, 2, &len);
#elif defined(PID_MAX)
max_pid = PID_MAX;
#else
max_pid = 99999;
#endif
my_pid = ecore_exe_pid_get(_debug_exe);
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
if (sysctlnametomib("kern.proc.pid", mib, &len) < 0) return -1;
#elif defined(__OpenBSD__)
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[4] = sizeof(struct kinfo_proc);
mib[5] = 1;
#endif
program_name = ecore_file_file_get(_edi_project_config->launch.path);
for (i = my_pid; i <= max_pid; i++)
{
mib[3] = i;
len = sizeof(kp);
#if defined(__OpenBSD__)
if (sysctl(mib, 6, &kp, &len, NULL, 0) == -1) continue;
#else
if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) continue;
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
if (kp.ki_ppid != my_pid) continue;
if (strcmp(program_name, kp.ki_comm)) continue;
child_pid = kp.ki_pid;
if (state)
{
if (kp.ki_stat == SRUN || kp.ki_stat == SSLEEP)
*state = DEBUG_PROCESS_ACTIVE;
else
*state = DEBUG_PROCESS_SLEEPING;
}
#elif defined(__OpenBSD__)
if (kp.p_ppid != my_pid) continue;
if (strcmp(program_name, kp.p_comm)) continue;
child_pid = kp.p_pid;
if (state)
{
if (kp.p_stat == SRUN || kp.p_stat == SSLEEP)
*state = DEBUG_PROCESS_ACTIVE;
else
*state = DEBUG_PROCESS_SLEEPING;
}
#else /* APPLE */
if (kp.kp_proc.p_oppid != my_pid) continue;
if (strcmp(program_name, kp.kp_proc.p_comm)) continue;
child_pid = kp.kp_proc.p_pid;
if (state)
{
if (kp.kp_proc.p_stat == SRUN || kp.kp_proc.p_stat == SSLEEP)
*state = DEBUG_PROCESS_ACTIVE;
else
*state = DEBUG_PROCESS_SLEEPING;
}
#endif
break;
}
#else
Eina_List *files, *l;
const char *temp_name;
char path[PATH_MAX];
char buf[4096];
char *p, *name, *end;
FILE *f;
int count, parent_pid, pid;
if (!_edi_project_config->launch.path)
return -1;
if (!_debug_exe) return -1;
my_pid = ecore_exe_pid_get(_debug_exe);
program_name = ecore_file_file_get(_edi_project_config->launch.path);
files = ecore_file_ls("/proc");
EINA_LIST_FOREACH(files, l, name)
{
pid = atoi(name);
if (!pid) continue;
snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
f = fopen(path, "r");
if (!f) continue;
p = fgets(buf, sizeof(buf), f);
fclose(f);
if (!p) continue;
temp_name = ecore_file_file_get(buf);
if (!strcmp(temp_name, program_name))
{
parent_pid = 0;
// Match success - program name with pid.
child_pid = pid;
snprintf(path, sizeof(path), "/proc/%d/stat", pid);
f = fopen(path, "r");
if (f)
{
count = 0;
p = fgets(buf, sizeof(buf), f);
while (*p++ != '\0')
{
if (p[0] == ' ') { count++; p++; }
if (count == 2)
{
if (state)
{
if (p[0] == 'S' || p[0] == 'R')
*state = DEBUG_PROCESS_ACTIVE;
else
*state = DEBUG_PROCESS_SLEEPING;
}
}
if (count == 3) break;
}
end = strchr(p, ' ');
if (end)
{
*end = '\0';
// parent pid matches - right process.
parent_pid = atoi(p);
}
fclose(f);
}
if (parent_pid == my_pid)
break;
}
}
if (files)
eina_list_free(files);
#endif
return child_pid;
elm_object_part_content_set(_button_int, "icon", ico_int);
}
static void
@ -311,8 +144,12 @@ _edi_debugpanel_bt_sigterm_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
{
pid_t pid;
Evas_Object *ico_int;
Edi_Debug *debug;
pid = _edi_debug_process_id(NULL);
debug = edi_debug_get();
if (!debug) return;
pid = edi_debug_process_id(debug);
if (pid <= 0) return;
ico_int = elm_icon_add(_button_int);
@ -322,36 +159,27 @@ _edi_debugpanel_bt_sigterm_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
kill(pid, SIGTERM);
}
static void
_edi_debugpanel_icons_update(int state)
{
Evas_Object *ico_int;
ico_int = elm_icon_add(_button_int);
if (state == DEBUG_PROCESS_ACTIVE)
elm_icon_standard_set(ico_int, "media-playback-pause");
else
elm_icon_standard_set(ico_int, "media-playback-start");
elm_object_part_content_set(_button_int, "icon", ico_int);
}
static void
_edi_debugpanel_bt_sigint_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
pid_t pid;
int state;
Edi_Debug *debug;
pid = _edi_debug_process_id(&state);
if (pid <= 0) return;
debug = edi_debug_get();
if (!debug) return;
if (state == DEBUG_PROCESS_ACTIVE)
pid = edi_debug_process_id(debug);
if (pid <= 0)
{
if (debug->tool->command_start)
ecore_exe_send(debug->exe, debug->tool->command_start, strlen(debug->tool->command_start));
return;
}
if (debug->state == EDI_DEBUG_PROCESS_ACTIVE)
kill(pid, SIGINT);
else
ecore_exe_send(_debug_exe, "c\n", 2);
_edi_debugpanel_icons_update(state);
else if (debug->tool->command_continue)
ecore_exe_send(debug->exe, debug->tool->command_continue, strlen(debug->tool->command_continue));
}
static void
@ -363,56 +191,92 @@ _edi_debugpanel_button_quit_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
static void
_edi_debugpanel_button_start_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
{
edi_debugpanel_start();
edi_debugpanel_start(_edi_project_config_debug_command_get());
}
static Eina_Bool
_edi_debug_active_check_cb(void *data EINA_UNUSED)
{
int state, pid = ecore_exe_pid_get(_debug_exe);
int pid;
Edi_Debug *debug = edi_debug_get();
pid = ecore_exe_pid_get(debug->exe);
if (pid == -1)
{
if (_debug_exe) ecore_exe_quit(_debug_exe);
_debug_exe = NULL;
if (debug->exe) ecore_exe_quit(debug->exe);
debug->exe = NULL;
elm_object_disabled_set(_button_quit, EINA_TRUE);
elm_object_disabled_set(_button_start, EINA_FALSE);
elm_object_disabled_set(_button_int, EINA_TRUE);
elm_object_disabled_set(_button_term, EINA_TRUE);
}
else
{
if (_edi_debug_process_id(&state) > 0)
_edi_debugpanel_icons_update(state);
}
if (!debug)
return ECORE_CALLBACK_RENEW;
pid = edi_debug_process_id(debug);
_edi_debugpanel_icons_update(pid > 0 ? debug->state : 0);
return ECORE_CALLBACK_RENEW;
}
void edi_debugpanel_stop(void)
{
Edi_Debug *debug;
int pid;
if (_debug_exe)
ecore_exe_terminate(_debug_exe);
debug = edi_debug_get();
if (!debug)
return;
pid = ecore_exe_pid_get(_debug_exe);
if (debug->exe)
ecore_exe_terminate(debug->exe);
pid = ecore_exe_pid_get(debug->exe);
if (pid != -1)
ecore_exe_quit(_debug_exe);
ecore_exe_quit(debug->exe);
_debug_exe = NULL;
debug->exe = NULL;
elm_object_disabled_set(_button_quit, EINA_TRUE);
elm_object_disabled_set(_button_int, EINA_TRUE);
elm_object_disabled_set(_button_term, EINA_TRUE);
}
void edi_debugpanel_start(void)
static void
_edi_debugger_run(Edi_Debug *debug)
{
char cmd[1024];
const char *fmt;
char *args;
int len;
const char *warning, *mime, *fmt;
debug->exe = ecore_exe_pipe_run(debug->cmd, ECORE_EXE_PIPE_WRITE |
ECORE_EXE_PIPE_ERROR |
ECORE_EXE_PIPE_READ, NULL);
if (debug->tool->command_arguments && _edi_project_config->launch.args)
{
fmt = debug->tool->command_arguments;
len = strlen(fmt) + strlen(_edi_project_config->launch.args) + 1;
args = malloc(len);
snprintf(args, len, fmt, _edi_project_config->launch.args);
ecore_exe_send(debug->exe, args, strlen(args));
free(args);
}
if (debug->tool->command_start)
ecore_exe_send(debug->exe, debug->tool->command_start, strlen(debug->tool->command_start));
}
void edi_debugpanel_start(const char *name)
{
const char *mime;
Edi_Debug *debug;
debug = edi_debug_get();
if (!debug) return;
if (debug->exe) return;
if (!_edi_project_config->launch.path)
{
@ -420,44 +284,31 @@ void edi_debugpanel_start(void)
return;
}
if (_debug_exe) return;
debug->program_name = ecore_file_file_get(_edi_project_config->launch.path);
if (!ecore_file_exists(_edi_project_config->launch.path))
debug->tool = edi_debug_tool_get(name);
if (!debug->tool)
{
warning = _("Warning: executable does not exists (run make?)");
elm_code_file_line_append(_debug_output->file, warning, strlen(warning), NULL);
edi_debug_exe_missing();
return;
}
mime = efreet_mime_type_get(_edi_project_config->launch.path);
if (!strcmp(mime, "application/x-shellscript"))
snprintf(cmd, sizeof(cmd), LIBTOOL_COMMAND " --mode execute gdb %s", _edi_project_config->launch.path);
if (mime && !strcmp(mime, "application/x-shellscript"))
snprintf(debug->cmd, sizeof(debug->cmd), LIBTOOL_COMMAND " --mode execute %s %s", debug->tool->exec, _edi_project_config->launch.path);
else if (debug->tool->arguments)
snprintf(debug->cmd, sizeof(debug->cmd), "%s %s %s", debug->tool->exec, debug->tool->arguments, _edi_project_config->launch.path);
else
snprintf(cmd, sizeof(cmd), "gdb %s", _edi_project_config->launch.path);
_debug_exe = ecore_exe_pipe_run(cmd, ECORE_EXE_PIPE_WRITE |
ECORE_EXE_PIPE_ERROR |
ECORE_EXE_PIPE_READ, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _debugpanel_stdout_handler, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _debugpanel_stdout_handler, NULL);
snprintf(debug->cmd, sizeof(debug->cmd), "%s %s", debug->tool->exec, _edi_project_config->launch.path);
elm_object_disabled_set(_button_int, EINA_FALSE);
elm_object_disabled_set(_button_term, EINA_FALSE);
elm_object_disabled_set(_button_quit, EINA_FALSE);
if (_edi_project_config->launch.args)
{
fmt = "set args %s\n";
len = strlen(fmt) + strlen(_edi_project_config->launch.args) + 1;
args = malloc(len);
snprintf(args, len, fmt, _edi_project_config->launch.args);
ecore_exe_send(_debug_exe, args, strlen(args));
free(args);
}
ecore_exe_send(_debug_exe, "run\n", 4);
elm_object_disabled_set(_button_start, EINA_TRUE);
elm_code_file_clear(_debug_output->file);
_edi_debugger_run(debug);
}
void edi_debugpanel_add(Evas_Object *parent)
@ -542,11 +393,15 @@ void edi_debugpanel_add(Evas_Object *parent)
_info_widget = widget;
_entry_widget = entry;
edi_debug_new();
timer = ecore_timer_add(1.0, _edi_debug_active_check_cb, NULL);
(void) timer;
elm_box_pack_end(parent, widget);
elm_box_pack_end(parent, table);
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _debugpanel_stdout_handler, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _debugpanel_stdout_handler, NULL);
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_debugpanel_config_changed, NULL);
}

View File

@ -34,9 +34,11 @@ void edi_debugpanel_add(Evas_Object *parent);
/**
* Start a new debugging session
*
* @param The toolname to do debugging with.
*
* @ingroup UI
*/
void edi_debugpanel_start();
void edi_debugpanel_start(const char *toolname);
/**
* Stop existing debugging session

View File

@ -140,6 +140,30 @@ _file_status_item_add(const char *path, Edi_Scm_Status_Code status)
eina_hash_add(_list_statuses, path, code);
}
typedef enum {
EDI_FILE_STATUS_UNMODIFIED,
EDI_FILE_STATUS_STAGED,
EDI_FILE_STATUS_UNSTAGED,
} Edi_File_Status;
static Edi_File_Status
_edi_filepanel_file_scm_status(const char *path)
{
Edi_Scm_Status_Code *code;
char *escaped = ecore_file_escape_name(path);
code = _file_status_item_find(escaped);
free(escaped);
if (!code) return EDI_FILE_STATUS_UNMODIFIED;
if (*code == EDI_SCM_STATUS_RENAMED_STAGED || *code == EDI_SCM_STATUS_DELETED_STAGED ||
*code == EDI_SCM_STATUS_ADDED_STAGED || *code == EDI_SCM_STATUS_MODIFIED_STAGED)
return EDI_FILE_STATUS_STAGED;
return EDI_FILE_STATUS_UNSTAGED;
}
void edi_filepanel_item_update(const char *path)
{
Elm_Object_Item *item = _file_listing_item_find(path);
@ -349,14 +373,25 @@ _item_menu_del_cb(void *data, Evas_Object *obj EINA_UNUSED,
}
static void
_item_menu_scm_add_cb(void *data, Evas_Object *obj EINA_UNUSED,
_item_menu_scm_stage_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Edi_Dir_Data *sd;
sd = data;
edi_scm_add(sd->path);
edi_scm_stage(sd->path);
edi_filepanel_scm_status_update();
edi_filepanel_item_update(sd->path);
}
static void
_item_menu_scm_unstage_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Edi_Dir_Data *sd = data;
edi_scm_unstage(sd->path);
edi_filepanel_scm_status_update();
edi_filepanel_item_update(sd->path);
}
@ -415,12 +450,13 @@ _item_menu_filetype_create(Evas_Object *menu, Elm_Object_Item *parent, const cha
static void
_item_menu_create(Evas_Object *win, Edi_Dir_Data *sd)
{
Elm_Object_Item *menu_it;
Elm_Object_Item *menu_it, *menu_it2;
Edi_File_Status status;
menu = elm_menu_add(win);
evas_object_smart_callback_add(menu, "dismissed", _item_menu_dismissed_cb, NULL);
menu_it = elm_menu_item_add(menu, NULL, "document-properties", basename((char *)sd->path), NULL, NULL);
menu_it = elm_menu_item_add(menu, NULL, "document-properties", ecore_file_file_get(sd->path), NULL, NULL);
elm_object_item_disabled_set(menu_it, EINA_TRUE);
elm_menu_item_separator_add(menu, NULL);
@ -429,19 +465,30 @@ _item_menu_create(Evas_Object *win, Edi_Dir_Data *sd)
menu_it = elm_menu_item_add(menu, NULL, "object-flip-horizontal", _("Open in New Panel"), _item_menu_open_panel_cb, sd);
menu_it = elm_menu_item_add(menu, NULL, NULL, _("Open as ..."), NULL, NULL);
menu_it = elm_menu_item_add(menu, NULL, NULL, eina_slstr_printf("%s...", _("Open as")), NULL, NULL);
_item_menu_filetype_create(menu, menu_it, "text", _item_menu_open_as_text_cb, sd);
_item_menu_filetype_create(menu, menu_it, "code", _item_menu_open_as_code_cb, sd);
_item_menu_filetype_create(menu, menu_it, "image", _item_menu_open_as_image_cb, sd);
menu_it = elm_menu_item_add(menu, NULL, "gtk-execute", _("Open External"),
_item_menu_xdgopen_cb, sd);
elm_menu_item_separator_add(menu, NULL);
if (edi_scm_enabled())
{
menu_it = elm_menu_item_add(menu, NULL, NULL, _("Source Control ..."), NULL, NULL);
elm_menu_item_add(menu, menu_it, "document-save-as", _("Add Changes"), _item_menu_scm_add_cb, sd);
status = _edi_filepanel_file_scm_status(sd->path);
menu_it = elm_menu_item_add(menu, NULL, NULL, eina_slstr_printf("%s...", _("Source Control")), NULL, NULL);
menu_it2 = elm_menu_item_add(menu, menu_it, "document-save-as", _("Stage Changes"), _item_menu_scm_stage_cb, sd);
if (status == EDI_FILE_STATUS_UNMODIFIED || status == EDI_FILE_STATUS_STAGED)
elm_object_item_disabled_set(menu_it2, EINA_TRUE);
menu_it2 = elm_menu_item_add(menu, menu_it, "edit-undo", _("Unstage Changes"), _item_menu_scm_unstage_cb, sd);
if (status == EDI_FILE_STATUS_UNMODIFIED || status == EDI_FILE_STATUS_UNSTAGED)
elm_object_item_disabled_set(menu_it2, EINA_TRUE);
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_add(menu, menu_it, "document-save-as", _("Rename File"), _item_menu_rename_cb, sd);
elm_menu_item_add(menu, menu_it, "edit-delete", _("Delete File"), _item_menu_scm_del_cb, sd);
}
@ -537,7 +584,7 @@ _item_menu_dir_create(Evas_Object *win, Edi_Dir_Data *sd)
menu = elm_menu_add(win);
evas_object_smart_callback_add(menu, "dismissed", _item_menu_dismissed_cb, NULL);
menu_it = elm_menu_item_add(menu, NULL, "folder", basename((char *)sd->path), NULL, NULL);
menu_it = elm_menu_item_add(menu, NULL, "folder", ecore_file_file_get(sd->path), NULL, NULL);
elm_object_item_disabled_set(menu_it, EINA_TRUE);
elm_menu_item_separator_add(menu, NULL);
@ -599,7 +646,7 @@ _text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *source EINA_UNUS
{
Edi_Dir_Data *sd = data;
return strdup(basename((char *)sd->path));
return strdup(ecore_file_file_get(sd->path));
}
static Evas_Object *
@ -609,15 +656,14 @@ _content_get(void *data, Evas_Object *obj, const char *source)
Edi_Dir_Data *sd = data;
Evas_Object *box, *lbox, *mbox, *rbox, *label, *ic;
Edi_Scm_Status_Code *code;
char *text, *escaped;
char *escaped;
const char *icon_name, *icon_status;
Eina_Bool staged = EINA_FALSE;
if (strcmp(source, "elm.swallow.content"))
return NULL;
text = NULL; icon_name = icon_status = NULL;
icon_name = icon_status = NULL;
escaped = ecore_file_escape_name(sd->path);
code = _file_status_item_find(escaped);
if (code)
@ -625,8 +671,6 @@ _content_get(void *data, Evas_Object *obj, const char *source)
free(escaped);
text = strdup(basename((char *)sd->path));
provider = _get_provider_from_hashset(sd->path);
if (provider)
icon_name = provider->icon;
@ -649,7 +693,7 @@ _content_get(void *data, Evas_Object *obj, const char *source)
elm_box_pack_end(lbox, ic);
label = elm_label_add(lbox);
elm_object_text_set(label, text);
elm_object_text_set(label, ecore_file_file_get(sd->path));
evas_object_show(label);
elm_box_pack_end(lbox, label);
@ -696,8 +740,6 @@ _content_get(void *data, Evas_Object *obj, const char *source)
}
}
free(text);
elm_box_pack_end(box, lbox);
elm_box_pack_end(box, mbox);
elm_box_pack_end(box, rbox);
@ -1025,6 +1067,23 @@ _filter_key_down_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
elm_genlist_filter_set(tree, (void *)strdup(match));
}
Eina_Bool
_edi_filepanel_select_check(void *data EINA_UNUSED)
{
Edi_Mainview_Panel *current;
Edi_Mainview_Item *item;
current = edi_mainview_panel_current_get();
if (!current) return ECORE_CALLBACK_RENEW;
item = edi_mainview_item_current_get(current);
if (!item) return ECORE_CALLBACK_RENEW;
edi_filepanel_select_path(item->path);
return ECORE_CALLBACK_RENEW;
}
void
edi_filepanel_select_path(const char *path)
{
@ -1034,13 +1093,18 @@ edi_filepanel_select_path(const char *path)
if (!item)
return;
elm_genlist_item_selected_set(item, EINA_TRUE);
if (elm_genlist_item_selected_get(item))
return;
elm_genlist_item_selected_set(item, EINA_TRUE);
}
void
edi_filepanel_search()
{
elm_box_pack_start(_filepanel_box, _filter_box);
if (!evas_object_visible_get(_filter_box))
elm_box_pack_start(_filepanel_box, _filter_box);
evas_object_show(_filter_box);
elm_object_focus_set(_filter, EINA_TRUE);
}
@ -1100,6 +1164,7 @@ edi_filepanel_add(Evas_Object *parent, Evas_Object *win,
elm_object_part_content_set(cancel, "icon", icon);
_list = list = elm_genlist_add(parent);
elm_object_focus_allow_set(list, EINA_FALSE);
elm_genlist_homogeneous_set(list, EINA_TRUE);
elm_genlist_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
elm_genlist_filter_set(list, "");
@ -1145,6 +1210,8 @@ edi_filepanel_add(Evas_Object *parent, Evas_Object *win,
edi_filepanel_scm_status_update();
ecore_timer_add(0.1, _edi_filepanel_select_check, NULL);
_root_dir = calloc(1, sizeof(Edi_Dir_Data));
_root_dir->path = path;
_file_listing_fill(_root_dir, NULL);

View File

@ -17,13 +17,18 @@ static Evas_Object *_info_widget;
static Elm_Code *_elm_code;
static Eina_Bool
_edi_logpanel_ignore(Eina_Log_Level level, const char *fnc)
_edi_logpanel_ignore(Eina_Log_Level level, const char *domain, const char *fnc)
{
if (level <= EINA_LOG_LEVEL_DBG)
return !strncmp(fnc, "_eo_", 4) || !strncmp(fnc, "_evas_", 6) ||
{
if (!strncmp(domain, "eo", 2))
return EINA_TRUE;
if (!strncmp(fnc, "_eo_", 4) || !strncmp(fnc, "_evas_", 6) ||
!strncmp(fnc, "_ecore_", 7) || !strncmp(fnc, "_edje_", 6) ||
!strncmp(fnc, "_elm_", 5) || !strncmp(fnc, "_drm_", 5) ||
!strncmp(fnc, "_eina_", 6);
!strncmp(fnc, "_eina_", 6))
return EINA_TRUE;
}
return !strncmp(fnc, "_evas_object_smart_need_recalculate_set", strlen(fnc));
}
@ -36,17 +41,20 @@ _edi_logpanel_print_cb(const Eina_Log_Domain *domain, Eina_Log_Level level,
unsigned int printed, buffer_len = 512;
char buffer [buffer_len];
if (_edi_log_dom == -1) return;
if (_edi_log_dom == -1) return;
if (_edi_logpanel_ignore(level, fnc))
if (_edi_logpanel_ignore(level, domain->domain_str, fnc))
return;
printed = snprintf(buffer, buffer_len, "%s:%s:%s (%d): ",
domain->domain_str, file, fnc, line);
vsnprintf(buffer + printed, buffer_len - printed, fmt, args);
ecore_thread_main_loop_begin();
elm_code_file_line_append(_elm_code->file, buffer, strlen(buffer),
(level <= EINA_LOG_LEVEL_ERR) ? _EDI_LOG_ERROR : NULL);
ecore_thread_main_loop_end();
}
static void

View File

@ -26,6 +26,8 @@
#include "edi_private.h"
#define MENU_ELLIPSIS(S) eina_slstr_printf("%s...", S)
int EDI_EVENT_TAB_CHANGED;
int EDI_EVENT_FILE_CHANGED;
int EDI_EVENT_FILE_SAVED;
@ -560,7 +562,18 @@ edi_launcher_config_missing()
title = _("Unable to launch");
message = _("No launch binary found, please configure in Settings.");
edi_screens_message(_edi_main_win, title, message);
edi_screens_settings_message(_edi_main_win, title, message);
}
void
edi_debug_exe_missing(void)
{
const char *title, *message;
title = _("Unable to launch debugger");
message = _("No debug binary found, please check system configuration and Settings.");
edi_screens_settings_message(_edi_main_win, title, message);
}
static void
@ -572,16 +585,22 @@ _edi_project_credentials_missing()
title = _("Missing user information");
message = _("No user information found, please configure in Settings.");
edi_screens_message(_edi_main_win, title, message);
edi_screens_settings_message(_edi_main_win, title, message);
}
static Eina_Bool
_edi_project_credentials_check(void)
{
if (!_edi_project_config->user_fullname || strlen(_edi_project_config->user_fullname) == 0)
Edi_Scm_Engine *eng;
eng = edi_scm_engine_get();
if ((!_edi_project_config->user_fullname || !_edi_project_config->user_fullname[0]) &&
(!eng || !eng->remote_name_get()))
return EINA_FALSE;
if (!_edi_project_config->user_email || strlen(_edi_project_config->user_email) == 0)
if ((!_edi_project_config->user_email || !_edi_project_config->user_email[0]) &&
(!eng || !eng->remote_email_get()))
return EINA_FALSE;
return EINA_TRUE;
@ -729,6 +748,12 @@ _edi_build_display_status_cb(int status, void *data)
eina_strbuf_free(message);
}
static void
_edi_debug_project(void)
{
edi_debugpanel_start(_edi_project_config_debug_command_get());
}
static void
_edi_build_project(void)
{
@ -796,7 +821,7 @@ static void
_tb_debug_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
edi_debugpanel_show();
edi_debugpanel_start();
_edi_debug_project();
}
static void
@ -1012,12 +1037,21 @@ _edi_menu_clean_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
_edi_build_clean_project();
}
static void
_edi_menu_memcheck_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
edi_debugpanel_show();
edi_debugpanel_stop();
edi_debugpanel_start("memcheck");
}
static void
_edi_menu_debug_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
edi_debugpanel_show();
edi_debugpanel_start();
_edi_debug_project();
}
static void
@ -1063,13 +1097,11 @@ _edi_menu_scm_commit_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
return;
}
edi_scm_credentials_set(_edi_project_config->user_fullname, _edi_project_config->user_email);
chdir(edi_project_get());
/* when program terminates update the filepanel */
if (edi_exe_notify_handle("edi_scm_status", _edi_scm_program_exited_cb, NULL))
edi_exe_notify("edi_scm_status", "edi_scm");
edi_exe_notify("edi_scm_status", "edi_scm --commit");
chdir(workdir);
@ -1151,10 +1183,10 @@ _edi_menu_setup(Evas_Object *win)
menu = elm_win_main_menu_get(win);
menu_it = elm_menu_item_add(menu, NULL, NULL, _("File"), NULL, NULL);
elm_menu_item_add(menu, menu_it, "folder-new", _("New Project ..."), _edi_menu_project_new_cb, NULL);
elm_menu_item_add(menu, menu_it, "folder-new", MENU_ELLIPSIS(_("New Project")), _edi_menu_project_new_cb, NULL);
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_add(menu, menu_it, "document-new", _("New ..."), _edi_menu_new_cb, NULL);
elm_menu_item_add(menu, menu_it, "folder-new", _("New Directory ..."), _edi_menu_new_dir_cb, NULL);
elm_menu_item_add(menu, menu_it, "document-new", MENU_ELLIPSIS(_("New")), _edi_menu_new_cb, NULL);
elm_menu_item_add(menu, menu_it, "folder-new", MENU_ELLIPSIS(_("New Directory")), _edi_menu_new_dir_cb, NULL);
_edi_menu_save = elm_menu_item_add(menu, menu_it, "document-save", _("Save"), _edi_menu_save_cb, NULL);
elm_menu_item_add(menu, menu_it, "window-close", _("Close"), _edi_menu_close_cb, NULL);
elm_menu_item_add(menu, menu_it, "window-close", _("Close all"), _edi_menu_closeall_cb, NULL);
@ -1173,10 +1205,10 @@ _edi_menu_setup(Evas_Object *win)
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_add(menu, menu_it, "edit-find-replace", _("Find & Replace"), _edi_menu_find_cb, NULL);
elm_menu_item_add(menu, menu_it, "edit-find", _("Find file"), _edi_menu_findfile_cb, NULL);
elm_menu_item_add(menu, menu_it, "go-jump", _("Goto Line ..."), _edi_menu_goto_cb, NULL);
elm_menu_item_add(menu, menu_it, "go-jump", MENU_ELLIPSIS(_("Goto Line")), _edi_menu_goto_cb, NULL);
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_add(menu, menu_it, "edit-find", _("Find in project ..."), _edi_menu_find_project_cb, NULL);
elm_menu_item_add(menu, menu_it, "edit-find-replace", _("Replace in project ..."), _edi_menu_find_replace_project_cb, NULL);
elm_menu_item_add(menu, menu_it, "edit-find", MENU_ELLIPSIS(_("Find in project")), _edi_menu_find_project_cb, NULL);
elm_menu_item_add(menu, menu_it, "edit-find-replace", MENU_ELLIPSIS(_("Replace in project")), _edi_menu_find_replace_project_cb, NULL);
menu_it = elm_menu_item_add(menu, NULL, NULL, _("View"), NULL, NULL);
elm_menu_item_add(menu, menu_it, "window-new", _("New Window"), _edi_menu_view_open_window_cb, NULL);
@ -1189,8 +1221,10 @@ _edi_menu_setup(Evas_Object *win)
_edi_menu_build = elm_menu_item_add(menu, menu_it, "system-run", _("Build"), _edi_menu_build_cb, NULL);
_edi_menu_test = elm_menu_item_add(menu, menu_it, "media-record", _("Test"), _edi_menu_test_cb, NULL);
elm_menu_item_add(menu, menu_it, "media-playback-start", _("Run"), _edi_menu_run_cb, NULL);
elm_menu_item_add(menu, menu_it, "utilities-terminal", _("Debug"), _edi_menu_debug_cb, NULL);
_edi_menu_clean = elm_menu_item_add(menu, menu_it, "edit-clear", _("Clean"), _edi_menu_clean_cb, NULL);
elm_menu_item_separator_add(menu, menu_it);
elm_menu_item_add(menu, menu_it, "utilities-terminal", _("Debugger"), _edi_menu_debug_cb, NULL);
elm_menu_item_add(menu, menu_it, "applications-electronics", _("Memcheck"), _edi_menu_memcheck_cb, NULL);
menu_it = elm_menu_item_add(menu, NULL, NULL, _("Project"), NULL, NULL);
_edi_menu_init = elm_menu_item_add(menu, menu_it, "media-playback-start", _("Init"), _edi_menu_scm_init_cb, NULL);
@ -1255,7 +1289,7 @@ edi_toolbar_setup(Evas_Object *parent)
tb_it = elm_toolbar_item_append(tb, "separator", "", NULL, NULL);
elm_toolbar_item_separator_set(tb_it, EINA_TRUE);
_edi_toolbar_item_add(tb, "edit-find-replace", _("Find..."), _tb_search_cb);
_edi_toolbar_item_add(tb, "edit-find-replace", MENU_ELLIPSIS(_("Find")), _tb_search_cb);
_edi_toolbar_item_add(tb, "go-jump", _("Goto Line"), _tb_goto_cb);
tb_it = elm_toolbar_item_append(tb, "separator", "", NULL, NULL);
@ -1288,12 +1322,12 @@ _edi_win_title_get()
if (provider)
type = provider->id;
else
type = "unknown";
type = _("unknown");
name = edi_project_name_get();
len = 8 + 3 + strlen(name) + strlen(type);
winname = malloc(len * sizeof(char));
snprintf(winname, len, "Edi :: %s (%s)", name, type);
snprintf(winname, len, _("Edi :: %s (%s)"), name, type);
return winname;
}
@ -1336,6 +1370,7 @@ static Eina_Bool
_edi_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
_edi_toolbar_set_visible(!_edi_project_config->gui.toolbar_hidden);
return ECORE_CALLBACK_RENEW;
}
@ -1370,6 +1405,7 @@ _edi_open_tabs()
Eina_List *tabs, *panels, *list, *sublist;
Edi_Mainview_Panel *panel_obj;
char *path;
int i;
unsigned int tab_id = 0, panel_id = 0;
panels = _edi_project_config->panels;
@ -1380,7 +1416,7 @@ _edi_open_tabs()
/* Make sure we have enough panels */
edi_mainview_panel_append();
panel_obj = edi_mainview_panel_by_index(panel_id);
edi_mainview_panel_focus(panel_obj);
tabs = panel->tabs;
panel->tabs = NULL;
tab_id = 0;
@ -1395,9 +1431,13 @@ _edi_open_tabs()
options->type = eina_stringshare_add(tab->type);
options->background = tab_id != panel->current_tab;
edi_mainview_panel_open(panel_obj, options);
tab_id++;
edi_mainview_panel_open(panel_obj, options);
for (i = 0; i < tab->split_views; i++)
{
edi_mainview_panel_tab_select(panel_obj, tab_id);
edi_mainview_split_current();
}
free(path);
}
@ -1437,6 +1477,11 @@ _win_delete_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
edi_close();
}
Evas_Object *edi_main_win_get(void)
{
return _edi_main_win;
}
Eina_Bool
edi_open(const char *inputpath)
{

View File

@ -48,6 +48,8 @@ extern int EDI_EVENT_FILE_SAVED;
Eina_Bool edi_open(const char *path);
Evas_Object *edi_main_win_get(void);
void edi_close();
void edi_open_url();
@ -55,6 +57,8 @@ void edi_open_url();
Eina_Bool edi_noproject();
void edi_launcher_config_missing();
void edi_debug_exe_missing(void);
Eina_Bool _edi_project_config_save_no_notify(void);

View File

@ -1,8 +1,10 @@
#include <Edi.h>
#include "edi_scm_ui.h"
#define DEFAULT_WIDTH 480
#define DEFAULT_HEIGHT 240
#include "edi_scm_ui.h"
#include "edi_private.h"
#define DEFAULT_WIDTH 560
#define DEFAULT_HEIGHT 480
static void
_win_del_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
@ -12,25 +14,20 @@ _win_del_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUS
}
static void
_win_title_set(Evas_Object *win)
_win_title_set(Evas_Object *win, Edi_Scm_Engine *engine)
{
Eina_Strbuf *title;
char *workdir;
workdir = _edi_scm_ui_workdir_get();
if (!workdir)
workdir = getcwd(NULL, PATH_MAX);
title = eina_strbuf_new();
eina_strbuf_append_printf(title, "Edi Source Control :: %s", workdir);
eina_strbuf_append_printf(title, _("Edi Source Control :: %s (%s)"),
ecore_file_file_get((char *)engine->root_directory),
engine->name ?: _("unknown"));
elm_win_title_set(win, eina_strbuf_string_get(title));
eina_strbuf_free(title);
free(workdir);
}
static Evas_Object *
_win_add(void)
_win_add(Edi_Scm_Engine *engine)
{
Evas_Object *win, *icon;
@ -44,7 +41,7 @@ _win_add(void)
evas_object_resize(win, DEFAULT_WIDTH * elm_config_scale_get(), DEFAULT_HEIGHT * elm_config_scale_get());
evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL);
_win_title_set(win);
_win_title_set(win, engine);
return win;
}
@ -52,14 +49,56 @@ _win_add(void)
int main(int argc, char **argv)
{
Evas_Object *win;
Edi_Scm_Engine *engine;
const char *arg, *root;
ecore_init();
elm_init(argc, argv);
root = NULL;
if (!edi_scm_generic_init())
exit(1 << 0);
if (argc >= 2)
{
arg = argv[1];
if (!strcmp("-h", arg) || !strcmp("--help", arg))
{
printf("Usage: edi_scm [directory]\n\n");
printf("The Enlightened IDE Source Control\n\n");
win = _win_add();
printf("Options:\n");
printf(" -c, --commit\t\topen with the commit screen.\n");
printf(" -h, --help\t\tshow this message.\n");
return 0;
}
if (!strcmp("-c", arg) || !strcmp("--commit", arg))
{
if (argc >= 3)
root = argv[2];
}
else
{
root = arg;
}
}
if (root)
{
if (!ecore_file_is_dir(root))
{
fprintf(stderr, _("Root path must be a directory\n"));
exit(1 << 0);
}
engine = edi_scm_init_path(realpath(root, NULL));
}
else
{
engine = edi_scm_init();
}
if (!engine)
exit(1 << 2);
win = _win_add(engine);
edi_scm_ui_add(win);
elm_win_center(win, EINA_TRUE, EINA_TRUE);
evas_object_show(win);

View File

@ -9,24 +9,22 @@
#define DEFAULT_USER_ICON "applications-development"
typedef struct _Edi_Scm_Ui {
typedef struct _Edi_Scm_Ui_Data {
Ecore_Thread *thread;
Eio_Monitor *monitor;
Elm_Code *code;
const char *workdir;
void *data;
Eina_Bool results_max;
Eina_Bool is_configured;
Eina_Bool in_progress;
Evas_Object *parent;
Evas_Object *list;
Evas_Object *check;
Evas_Object *staged_list, *unstaged_list;
Evas_Object *commit_button;
Evas_Object *commit_entry;
} Edi_Scm_Ui;
} Edi_Scm_Ui_Data;
const char *
_edi_scm_ui_avatar_cache_path_get(const char *email)
@ -36,7 +34,7 @@ _edi_scm_ui_avatar_cache_path_get(const char *email)
}
void _edi_scm_ui_screens_avatar_download_complete(void *data, const char *file,
int status)
int status)
{
Evas_Object *image = data;
@ -46,7 +44,7 @@ void _edi_scm_ui_screens_avatar_download_complete(void *data, const char *file,
return;
}
elm_image_file_set(image, file, NULL);
elm_photo_file_set(image, file);
}
static void
@ -58,7 +56,7 @@ _edi_scm_ui_screens_avatar_load(Evas_Object *image, const char *email)
cache = _edi_scm_ui_avatar_cache_path_get(email);
if (ecore_file_exists(cache))
{
elm_image_file_set(image, cache, NULL);
elm_photo_file_set(image, cache);
return;
}
@ -84,8 +82,8 @@ _edi_scm_ui_screens_avatar_load(Evas_Object *image, const char *email)
static void
_edi_scm_ui_screens_message_close_cb(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Evas_Object *popup = data;
@ -112,32 +110,32 @@ _edi_scm_ui_screens_message_open(Evas_Object *parent, const char *message)
static void
_edi_scm_ui_screens_cancel_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
void *event_info EINA_UNUSED)
{
Edi_Scm_Ui *edi_scm = data;
Edi_Scm_Ui_Data *pd = data;
if (edi_scm->thread)
ecore_thread_cancel(edi_scm->thread);
if (pd->thread)
ecore_thread_cancel(pd->thread);
while ((ecore_thread_wait(edi_scm->thread, 0.1)) != EINA_TRUE);
while ((ecore_thread_wait(pd->thread, 0.1)) != EINA_TRUE);
evas_object_del(edi_scm->parent);
evas_object_del(pd->parent);
if (edi_scm->monitor)
eio_monitor_del(edi_scm->monitor);
if (pd->monitor)
eio_monitor_del(pd->monitor);
free(edi_scm);
free(pd);
elm_exit();
}
static void
_edi_scm_ui_screens_commit_cb(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Edi_Scm_Engine *engine;
Edi_Scm_Ui *edi_scm;
Edi_Scm_Ui_Data *pd;
const char *text;
char *message;
@ -145,11 +143,12 @@ _edi_scm_ui_screens_commit_cb(void *data,
if (!engine)
return;
edi_scm = data;
text = elm_object_text_get((Evas_Object *) edi_scm->commit_entry);
pd = data;
text = elm_object_text_get((Evas_Object *) pd->commit_entry);
if (!text || !text[0])
{
_edi_scm_ui_screens_message_open(edi_scm->parent, _("Please enter a valid commit message."));
_edi_scm_ui_screens_message_open(pd->parent, _("Please enter a valid commit message."));
return;
}
@ -158,17 +157,17 @@ _edi_scm_ui_screens_commit_cb(void *data,
free(message);
if (edi_scm->thread)
ecore_thread_cancel(edi_scm->thread);
if (pd->thread)
ecore_thread_cancel(pd->thread);
while ((ecore_thread_wait(edi_scm->thread, 0.1)) != EINA_TRUE);
while ((ecore_thread_wait(pd->thread, 0.1)) != EINA_TRUE);
evas_object_del(edi_scm->parent);
evas_object_del(pd->parent);
if (edi_scm->monitor)
eio_monitor_del(edi_scm->monitor);
if (pd->monitor)
eio_monitor_del(pd->monitor);
free(edi_scm);
free(pd);
elm_exit();
}
@ -316,17 +315,16 @@ _content_get(void *data, Evas_Object *obj, const char *source)
}
static Eina_Bool
_edi_scm_ui_status_list_fill(Edi_Scm_Ui *edi_scm)
_edi_scm_ui_status_list_fill(Edi_Scm_Ui_Data *pd)
{
Elm_Genlist_Item_Class *itc;
Edi_Scm_Status *status;
Edi_Scm_Engine *e;
Eina_List *l;
Eina_Bool staged = EINA_FALSE;
Evas_Object *list = edi_scm->list;
e = edi_scm_engine_get();
if (!e)
if (!e || !edi_scm_status_get())
return EINA_FALSE;
itc = elm_genlist_item_class_new();
@ -336,25 +334,14 @@ _edi_scm_ui_status_list_fill(Edi_Scm_Ui *edi_scm)
itc->func.state_get = NULL;
itc->func.del = _content_del;
if (!edi_scm_status_get())
goto done;
EINA_LIST_FOREACH(e->statuses, l, status)
{
if (status->staged)
staged = EINA_TRUE;
staged = staged || status->staged;
if (edi_scm->results_max)
{
elm_genlist_item_append(list, itc, status, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
if (status->staged)
elm_genlist_item_append(pd->staged_list, itc, status, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
else
{
if (status->staged)
elm_genlist_item_append(list, itc, status, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
else
_edi_scm_ui_status_free(status);
}
elm_genlist_item_append(pd->unstaged_list, itc, status, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
if (e->statuses)
@ -362,14 +349,13 @@ _edi_scm_ui_status_list_fill(Edi_Scm_Ui *edi_scm)
eina_list_free(e->statuses);
e->statuses = NULL;
}
done:
elm_genlist_item_class_free(itc);
return staged;
}
static void
_entry_lines_append(Ecore_Thread *thread, Elm_Code *code, char *text)
_diff_widget_lines_append(Ecore_Thread *thread, Elm_Code *code, char *text)
{
char *pos = text;
char *start, *end = NULL;
@ -407,156 +393,223 @@ _entry_lines_append(Ecore_Thread *thread, Elm_Code *code, char *text)
static void
_edi_scm_diff_thread_cancel_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
{
Edi_Scm_Ui *edi_scm = data;
Edi_Scm_Ui_Data *pd = data;
edi_scm->in_progress = EINA_FALSE;
edi_scm->thread = NULL;
pd->in_progress = EINA_FALSE;
pd->thread = NULL;
if (edi_scm->data)
if (pd->data)
{
free(edi_scm->data);
edi_scm->data = NULL;
free(pd->data);
pd->data = NULL;
}
}
static void
_edi_scm_diff_thread_end_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
{
Edi_Scm_Ui *edi_scm = data;
Edi_Scm_Ui_Data *pd = data;
edi_scm->in_progress = EINA_FALSE;
edi_scm->thread = NULL;
pd->in_progress = EINA_FALSE;
pd->thread = NULL;
}
static void
_edi_scm_diff_thread_cb(void *data, Ecore_Thread *thread)
{
Edi_Scm_Ui *edi_scm = data;
Edi_Scm_Ui_Data *pd = data;
if (edi_scm->in_progress) return;
if (pd->in_progress) return;
edi_scm->data = edi_scm_diff(!edi_scm->results_max);
pd->data = edi_scm_diff(EINA_TRUE);
edi_scm->in_progress = EINA_TRUE;
edi_scm->thread = thread;
pd->in_progress = EINA_TRUE;
pd->thread = thread;
_entry_lines_append(thread, edi_scm->code, edi_scm->data);
_diff_widget_lines_append(thread, pd->code, pd->data);
free(edi_scm->data);
edi_scm->data = NULL;
free(pd->data);
pd->data = NULL;
}
static void
_edi_scm_ui_refresh(Edi_Scm_Ui *edi_scm)
_edi_scm_diff_refresh(Edi_Scm_Ui_Data *pd)
{
ecore_thread_run(_edi_scm_diff_thread_cb, _edi_scm_diff_thread_end_cb,
_edi_scm_diff_thread_cancel_cb, pd);
}
static void
_edi_scm_ui_refresh(Edi_Scm_Ui_Data *pd)
{
Eina_Bool staged;
edi_scm->results_max = elm_check_state_get(edi_scm->check);
elm_genlist_clear(pd->staged_list);
elm_genlist_clear(pd->unstaged_list);
elm_genlist_clear(edi_scm->list);
elm_code_file_clear(pd->code->file);
elm_code_file_clear(edi_scm->code->file);
staged = _edi_scm_ui_status_list_fill(pd);
staged = _edi_scm_ui_status_list_fill(edi_scm);
if (!edi_scm->is_configured)
if (!pd->is_configured)
{
elm_object_disabled_set(edi_scm->commit_button, EINA_TRUE);
elm_entry_editable_set(edi_scm->commit_entry, EINA_FALSE);
elm_object_disabled_set(pd->commit_button, EINA_TRUE);
elm_entry_editable_set(pd->commit_entry, EINA_FALSE);
}
else
{
elm_object_disabled_set(edi_scm->commit_button, !staged);
elm_entry_editable_set(edi_scm->commit_entry, staged);
elm_object_disabled_set(pd->commit_button, !staged);
elm_entry_editable_set(pd->commit_entry, staged);
}
elm_genlist_realized_items_update(edi_scm->list);
elm_genlist_realized_items_update(pd->staged_list);
elm_genlist_realized_items_update(pd->unstaged_list);
ecore_thread_run(_edi_scm_diff_thread_cb, _edi_scm_diff_thread_end_cb, _edi_scm_diff_thread_cancel_cb, edi_scm);
}
static void
_edi_scm_ui_refresh_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Edi_Scm_Ui *edi_scm = data;
if (edi_scm->thread)
ecore_thread_cancel(edi_scm->thread);
while ((ecore_thread_wait(edi_scm->thread, 0.1)) != EINA_TRUE);
if (edi_scm->data)
{
free(edi_scm->data);
edi_scm->data = NULL;
}
_edi_scm_ui_refresh(edi_scm);
_edi_scm_diff_refresh(pd);
}
static Eina_Bool
_edi_scm_ui_file_changes_cb(void *data EINA_UNUSED, int type EINA_UNUSED,
void *event EINA_UNUSED)
void *event EINA_UNUSED)
{
Edi_Scm_Ui *edi_scm = data;
Edi_Scm_Ui_Data *pd = data;
_edi_scm_ui_refresh(edi_scm);
_edi_scm_ui_refresh(pd);
return ECORE_CALLBACK_DONE;
}
char *
_edi_scm_ui_workdir_get(void)
static void
_item_menu_dismissed_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *ev EINA_UNUSED)
{
Edi_Scm_Engine *engine;
char *directory, *workdir, *path, *tmp;
evas_object_del(obj);
}
engine = edi_scm_engine_get();
if (!engine)
exit(1 << 1);
static void
_item_menu_scm_stage_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Edi_Scm_Status *status;
Edi_Scm_Ui_Data *pd = evas_object_data_get(obj, "edi_scm_ui");
tmp = path = workdir = NULL;
status = data;
directory = strdup(engine->workdir);
edi_scm_stage(status->path);
while (directory)
_edi_scm_ui_refresh(pd);
}
static void
_item_menu_scm_unstage_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Edi_Scm_Status *status;
Edi_Scm_Ui_Data *pd = evas_object_data_get(obj, "edi_scm_ui");
status = data;
edi_scm_unstage(status->path);
_edi_scm_ui_refresh(pd);
}
static void
_item_menu_scm_staged_toggle(Edi_Scm_Status *status, Edi_Scm_Ui_Data *pd)
{
if (status->staged)
edi_scm_unstage(status->path);
else
edi_scm_stage(status->path);
_edi_scm_ui_refresh(pd);
}
static Evas_Object *
_item_menu_create(Edi_Scm_Ui_Data *pd, Edi_Scm_Status *status)
{
Evas_Object *menu, *parent;
Elm_Object_Item *menu_it;
parent = pd->parent;
menu = elm_menu_add(parent);
evas_object_data_set(menu, "edi_scm_ui", pd);
evas_object_smart_callback_add(menu, "dismissed", _item_menu_dismissed_cb, NULL);
menu_it = elm_menu_item_add(menu, NULL, "document-properties", ecore_file_file_get(status->path), NULL, NULL);
elm_object_item_disabled_set(menu_it, EINA_TRUE);
elm_menu_item_separator_add(menu, NULL);
menu_it = elm_menu_item_add(menu, NULL, "document-save-as", _("Stage Changes"), _item_menu_scm_stage_cb, status);
if (status->staged)
elm_object_item_disabled_set(menu_it, EINA_TRUE);
menu_it = elm_menu_item_add(menu, NULL, "edit-undo", _("Unstage Changes"), _item_menu_scm_unstage_cb, status);
if (!status->staged)
elm_object_item_disabled_set(menu_it, EINA_TRUE);
return menu;
}
static void
_list_item_clicked_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
void *event_info)
{
Evas_Object *menu;
Evas_Event_Mouse_Up *ev;
Elm_Object_Item *it;
Edi_Scm_Status *status;
Edi_Scm_Ui_Data *pd = data;
ev = event_info;
it = elm_genlist_at_xy_item_get(obj, ev->output.x, ev->output.y, NULL);
status = elm_object_item_data_get(it);
if (!status)
return;
if (ev->button != 3)
{
path = edi_path_append(directory, engine->directory);
if (ecore_file_exists(path) && ecore_file_is_dir(path))
{
if (!strcmp(directory, "/"))
workdir = strdup(directory);
else
workdir = strdup(ecore_file_file_get(directory));
break;
}
if (ev->button == 1 && ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
_item_menu_scm_staged_toggle(status, pd);
return;
}
tmp = ecore_file_dir_get(directory);
free(directory);
directory = tmp;
free(path);
path = NULL;
}
menu = _item_menu_create(pd, status);
elm_menu_move(menu, ev->canvas.x, ev->canvas.y);
evas_object_show(menu);
}
if (path)
free(path);
static void
_avatar_effect(Evas_Object *avatar)
{
Evas_Map *map;
int w, h;
if (directory)
free(directory);
evas_object_move(avatar, 8 * elm_config_scale_get(), 15 * elm_config_scale_get());
evas_object_resize(avatar, 72 * elm_config_scale_get(), 72 * elm_config_scale_get());
evas_object_geometry_get(avatar, NULL, NULL, &w, &h);
return workdir;
map = evas_map_new(4);
evas_map_smooth_set(map, EINA_TRUE);
evas_map_util_points_populate_from_object(map, avatar);
evas_map_util_rotate(map, 5, w/2, h/2);
evas_object_map_enable_set(avatar, EINA_TRUE);
evas_object_map_set(avatar, map);
evas_map_free(map);
}
void
edi_scm_ui_add(Evas_Object *parent)
{
Evas_Object *box, *frame, *hbox, *cbox, *label, *avatar, *input, *button;
Evas_Object *table, *rect, *list, *pbox, *check, *sep;
Evas_Object *layout, *frame, *hbox, *cbox, *label, *avatar, *input, *button;
Evas_Object *list, *pbox;
Elm_Code_Widget *entry;
Elm_Code *code;
Eina_Strbuf *string;
Edi_Scm_Engine *engine;
Edi_Scm_Ui *edi_scm;
Edi_Scm_Ui_Data *pd;
const char *remote_name, *remote_email;
Eina_Bool staged_changes;
@ -564,28 +617,28 @@ edi_scm_ui_add(Evas_Object *parent)
if (!engine)
exit(1 << 1);
edi_scm = calloc(1, sizeof(Edi_Scm_Ui));
edi_scm->workdir = engine->workdir;
edi_scm->monitor = eio_monitor_add(edi_scm->workdir);
edi_scm->parent = parent;
pd = calloc(1, sizeof(Edi_Scm_Ui_Data));
pd->workdir = engine->root_directory;
pd->monitor = eio_monitor_add(pd->workdir);
pd->parent = parent;
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, _edi_scm_ui_file_changes_cb, edi_scm);
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, _edi_scm_ui_file_changes_cb, edi_scm);
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, _edi_scm_ui_file_changes_cb, edi_scm);
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, _edi_scm_ui_file_changes_cb, edi_scm);
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, _edi_scm_ui_file_changes_cb, edi_scm);
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, _edi_scm_ui_file_changes_cb, edi_scm);
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, _edi_scm_ui_file_changes_cb, pd);
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, _edi_scm_ui_file_changes_cb, pd);
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, _edi_scm_ui_file_changes_cb, pd);
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, _edi_scm_ui_file_changes_cb, pd);
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, _edi_scm_ui_file_changes_cb, pd);
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, _edi_scm_ui_file_changes_cb, pd);
box = elm_box_add(parent);
elm_box_horizontal_set(box, EINA_FALSE);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_content_set(parent, box);
evas_object_show(box);
layout = elm_table_add(parent);
elm_table_homogeneous_set(layout, EINA_TRUE);
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_content_set(parent, layout);
evas_object_show(layout);
frame = elm_frame_add(parent);
elm_object_text_set(frame, _("User information"));
evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_weight_set(frame, 0.5, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(frame);
@ -595,15 +648,21 @@ edi_scm_ui_add(Evas_Object *parent)
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(hbox);
avatar = elm_icon_add(parent);
evas_object_size_hint_min_set(avatar, 48 * elm_config_scale_get(), 48 * elm_config_scale_get());
remote_name = engine->remote_name_get();
remote_email = engine->remote_email_get();
if (remote_name && remote_name[0] && remote_email && remote_email[0])
avatar = elm_photo_add(parent);
else
avatar = elm_icon_add(parent);
evas_object_size_hint_min_set(avatar, 72 * elm_config_scale_get(), 72 * elm_config_scale_get());
evas_object_size_hint_weight_set(avatar, 0.1, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(avatar, 1.0, EVAS_HINT_FILL);
evas_object_show(avatar);
elm_box_pack_end(hbox, avatar);
/* General information */
label = elm_label_add(hbox);
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 1.0);
evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -617,97 +676,74 @@ edi_scm_ui_add(Evas_Object *parent)
evas_object_show(pbox);
elm_box_pack_end(hbox, pbox);
remote_name = engine->remote_name_get();
remote_email = engine->remote_email_get();
string = eina_strbuf_new();
if (!remote_name[0] && !remote_email[0])
if ((!remote_name || !remote_name[0]) && (!remote_email || !remote_email[0]))
{
eina_strbuf_append(string, _("Unable to obtain user information."));
elm_icon_standard_set(avatar, DEFAULT_USER_ICON);
}
else
{
eina_strbuf_append_printf(string, "%s:<br><b>%s</b> &lt;%s&gt;", _("Author"),
engine->remote_name_get(), engine->remote_email_get());
_edi_scm_ui_screens_avatar_load(avatar, engine->remote_email_get());
edi_scm->is_configured = EINA_TRUE;
eina_strbuf_append_printf(string, "<b>%s</b><br>&lt;%s&gt;",
remote_name, remote_email);
_edi_scm_ui_screens_avatar_load(avatar, remote_email);
_avatar_effect(avatar);
pd->is_configured = EINA_TRUE;
}
elm_object_text_set(label, eina_strbuf_string_get(string));
eina_strbuf_free(string);
edi_scm->check = check = elm_check_add(parent);
elm_object_text_set(check, _("Show unstaged changes"));
elm_check_state_set(check, EINA_FALSE);
evas_object_show(check);
evas_object_smart_callback_add(check, "changed",
_edi_scm_ui_refresh_cb, edi_scm);
elm_box_pack_end(hbox, check);
elm_object_content_set(frame, hbox);
elm_box_pack_end(box, frame);
elm_table_pack(layout, frame, 0, 0, 1, 3);
/* File listing */
hbox = elm_box_add(parent);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(hbox);
edi_scm->list = list = elm_genlist_add(box);
pd->unstaged_list = list = elm_genlist_add(layout);
elm_genlist_mode_set(list, ELM_LIST_SCROLL);
elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_NONE);
elm_genlist_select_mode_set(list, ELM_OBJECT_SELECT_MODE_NONE);
elm_scroller_bounce_set(list, EINA_TRUE, EINA_TRUE);
elm_scroller_policy_set(list, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(list);
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
rect = evas_object_rectangle_add(table);
evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_min_set(rect, 300 * elm_config_scale_get(), 100 * elm_config_scale_get());
elm_table_pack(table, rect, 0, 0, 1, 1);
evas_object_show(table);
evas_object_event_callback_add(list, EVAS_CALLBACK_MOUSE_UP, _list_item_clicked_cb, pd);
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(frame, _("File changes"));
elm_object_text_set(frame, _("Unstaged Changes"));
evas_object_show(frame);
elm_object_content_set(frame, table);
elm_table_pack(table, list, 0, 0, 1, 1);
elm_object_content_set(frame, table);
elm_box_pack_end(hbox, frame);
elm_box_pack_end(box, hbox);
elm_object_content_set(frame, list);
elm_table_pack(layout, frame, 0, 3, 1, 5);
staged_changes = _edi_scm_ui_status_list_fill(edi_scm);
/* Commit entry */
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
rect = evas_object_rectangle_add(table);
evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_min_set(rect, 300 * elm_config_scale_get(), 100 * elm_config_scale_get());
elm_table_pack(table, rect, 0, 0, 1, 1);
evas_object_show(table);
pd->staged_list = list = elm_genlist_add(layout);
elm_genlist_mode_set(list, ELM_LIST_SCROLL);
elm_genlist_select_mode_set(list, ELM_OBJECT_SELECT_MODE_NONE);
elm_scroller_bounce_set(list, EINA_TRUE, EINA_TRUE);
elm_scroller_policy_set(list, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(list);
evas_object_event_callback_add(list, EVAS_CALLBACK_MOUSE_UP, _list_item_clicked_cb, pd);
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(frame, _("Staged Changes"));
evas_object_show(frame);
elm_object_content_set(frame, list);
elm_table_pack(layout, frame, 1, 3, 1, 5);
staged_changes = _edi_scm_ui_status_list_fill(pd);
/* Commit entry */
frame = elm_frame_add(parent);
evas_object_size_hint_weight_set(frame, 0.5, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(frame, _("Commit message"));
evas_object_show(frame);
elm_object_content_set(frame, table);
edi_scm->commit_entry = input = elm_entry_add(box);
pd->commit_entry = input = elm_entry_add(frame);
elm_object_text_set(input, _("Enter commit summary<br><br>And change details<br>"));
evas_object_size_hint_weight_set(input, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -715,13 +751,10 @@ edi_scm_ui_add(Evas_Object *parent)
elm_entry_scrollable_set(input, EINA_TRUE);
elm_entry_single_line_set(input, EINA_FALSE);
elm_entry_line_wrap_set(input, ELM_WRAP_WORD);
elm_table_pack(table, input, 0, 0, 1, 1);
elm_object_content_set(frame, input);
evas_object_show(input);
elm_object_content_set(frame, table);
elm_box_pack_end(hbox, frame);
elm_box_pack_end(box, hbox);
elm_table_pack(layout, frame, 1, 0, 1, 3);
/* Start of elm_code diff widget */
frame = elm_frame_add(parent);
@ -736,10 +769,10 @@ edi_scm_ui_add(Evas_Object *parent)
evas_object_size_hint_min_set(cbox, 350 * elm_config_scale_get(), 150 * elm_config_scale_get());
evas_object_show(cbox);
elm_object_content_set(frame, cbox);
elm_box_pack_end(box, frame);
elm_table_pack(layout, frame, 0, 8, 2, 7);
edi_scm->code = code = elm_code_create();
entry = elm_code_widget_add(box, code);
pd->code = code = elm_code_create();
entry = elm_code_widget_add(cbox, code);
elm_code_parser_standard_add(code, ELM_CODE_PARSER_STANDARD_DIFF);
elm_obj_code_widget_gravity_set(entry, 0.0, 0.0);
elm_obj_code_widget_editable_set(entry, EINA_FALSE);
@ -749,13 +782,6 @@ edi_scm_ui_add(Evas_Object *parent)
evas_object_show(entry);
elm_box_pack_end(cbox, entry);
ecore_thread_run(_edi_scm_diff_thread_cb, _edi_scm_diff_thread_end_cb, _edi_scm_diff_thread_cancel_cb, edi_scm);
sep = elm_separator_add(parent);
elm_separator_horizontal_set(sep, EINA_TRUE);
evas_object_show(sep);
elm_box_pack_end(box, sep);
/* Start of confirm and cancel buttons */
hbox = elm_box_add(parent);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
@ -769,10 +795,10 @@ edi_scm_ui_add(Evas_Object *parent)
evas_object_show(button);
elm_object_text_set(button, _("Cancel"));
evas_object_smart_callback_add(button, "clicked",
_edi_scm_ui_screens_cancel_cb, edi_scm);
_edi_scm_ui_screens_cancel_cb, pd);
elm_box_pack_end(hbox, button);
edi_scm->commit_button = button = elm_button_add(parent);
pd->commit_button = button = elm_button_add(parent);
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_data_set(button, "input", input);
@ -780,9 +806,11 @@ edi_scm_ui_add(Evas_Object *parent)
elm_object_text_set(button, _("Commit"));
elm_object_disabled_set(button, !staged_changes);
evas_object_smart_callback_add(button, "clicked",
_edi_scm_ui_screens_commit_cb, edi_scm);
_edi_scm_ui_screens_commit_cb, pd);
elm_box_pack_end(hbox, button);
elm_box_pack_end(box, hbox);
elm_table_pack(layout, hbox, 1, 15, 1, 1);
// render the current diff
_edi_scm_diff_refresh(pd);
}

View File

@ -29,8 +29,6 @@ extern "C" {
* @ingroup SCM
*/
void edi_scm_ui_add(Evas_Object *parent);
char *_edi_scm_ui_workdir_get(void);
/**
* @}
*/

View File

@ -639,8 +639,6 @@ _suggest_hint_popup_add(Edi_Editor *editor, const char *content, Evas_Smart_Cb f
unsigned int row, col;
Evas_Coord cx, cy, cw, ch;
elm_code_widget_cursor_position_get(editor->entry, &row, &col);
elm_code_widget_cursor_position_get(editor->entry, &row, &col);
elm_code_widget_geometry_for_position_get(editor->entry, row, col,
&cx, &cy, &cw, &ch);
@ -858,15 +856,21 @@ _smart_cb_key_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
static void
_edit_cursor_moved(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Elm_Code *code;
Elm_Code_Line *line;
Elm_Code_Widget *widget;
char buf[30];
unsigned int line;
unsigned int row;
unsigned int col;
widget = (Elm_Code_Widget *)obj;
elm_code_widget_cursor_position_get(widget, &line, &col);
elm_code_widget_cursor_position_get(widget, &row, &col);
snprintf(buf, sizeof(buf), _("Line:%d, Column:%d"), line, col);
code = elm_code_widget_code_get(widget);
line = elm_code_file_line_get(code->file, row);
snprintf(buf, sizeof(buf), _("Line:%d, Position:%d"), row,
elm_code_widget_line_text_position_for_column_get(widget, line, col) + 1);
elm_object_text_set((Evas_Object *)data, buf);
}
@ -1203,16 +1207,13 @@ _focused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
code = elm_code_widget_code_get(editor->entry);
filename = elm_code_file_path_get(code->file);
edi_filepanel_select_path(filename);
mtime = ecore_file_mod_time(filename);
if ((editor->save_time) && (editor->save_time < mtime))
{
ecore_timer_del(editor->save_timer);
editor->save_timer = NULL;
_edi_editor_file_change_popup(evas_object_smart_parent_get(obj), editor);
_edi_editor_file_change_popup(obj, editor);
editor->modified = EINA_FALSE;
return;
}

View File

@ -50,6 +50,7 @@ struct _Edi_Editor
Edi_Editor_Search *search;
Eina_Bool modified;
Ecore_Timer *save_timer;
Eina_List *split_views;
#if HAVE_LIBCLANG
/* Clang */

View File

@ -40,7 +40,7 @@ struct _Edi_Editor_Search
Evas_Object *widget; /**< The search UI panel we wish to show and hide */
Evas_Object *parent; /**< The parent panel we will insert into */
Evas_Object *checkbox; /**< The checkbox for wrapping search */
Evas_Object *wrapped; /**< A display that shows the user that the search wrapped */
Evas_Object *wrapped_text; /**< A display that shows the user that the search wrapped */
unsigned int current_search_line; /**< The current search cursor line for this session */
unsigned int current_search_col; /**< The current search cursor column for this session */
Eina_Bool term_found;
@ -49,6 +49,7 @@ struct _Edi_Editor_Search
Evas_Object *replace_btn; /**< The replace button for our search */
struct _Edi_Search_Result cache; /**< The first found search instance */
/* Add new members here. */
Eina_Bool wrapped;
};
static void
@ -225,17 +226,30 @@ _edi_search_in_entry(Evas_Object *entry, Edi_Editor_Search *search)
// EOF reached so go to search found before cursor (first inst).
if (search->wrap && !search->term_found && _edi_search_cache_exists(search))
{
evas_object_show(search->wrapped);
elm_code_widget_cursor_position_set(entry, 1, 1);
// RESET CURSOR TO BEGINNING OF WIDGET. VISIBLE WIDGET STARTS AT 1, 1.
elm_code_widget_cursor_position_set(entry, 0, 0);
elm_code_widget_selection_clear(entry);
line = elm_code_file_line_get(elm_code_widget_code_get(entry)->file, 1);
_edi_search_cache_reset(search);
_edi_search_cache_use(search, &text, &line, &found);
search->wrapped = EINA_TRUE;
_edi_search_in_entry(entry, search);
free(text);
return EINA_TRUE;
}
else
evas_object_hide(search->wrapped);
{
if (search->wrapped)
{
evas_object_show(search->wrapped_text);
search->wrapped = EINA_FALSE;
}
else
{
evas_object_hide(search->wrapped_text);
}
}
line = elm_code_file_line_get(elm_code_widget_code_get(entry)->file, search->current_search_line);
elm_code_widget_cursor_position_set(entry, search->current_search_line,
@ -420,7 +434,7 @@ _edi_search_key_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj,
void
edi_editor_search_add(Evas_Object *parent, Edi_Editor *editor)
{
Evas_Object *entry, *wrapped, *lbl, *btn, *box, *big_box, *table;
Evas_Object *entry, *wrapped_text, *lbl, *btn, *box, *big_box, *table;
Evas_Object *replace_entry, *replace_lbl, *replace_btn;
Evas_Object *checkbox;
Edi_Editor_Search *search;
@ -487,9 +501,9 @@ edi_editor_search_add(Evas_Object *parent, Edi_Editor *editor)
evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_UP, _edi_search_key_up_cb, editor);
wrapped = elm_label_add(parent);
elm_object_text_set(wrapped, _("Reached end of file, starting from beginning"));
elm_box_pack_end(box, wrapped);
wrapped_text = elm_label_add(parent);
elm_object_text_set(wrapped_text, _("Reached end of file, starting from beginning"));
elm_box_pack_end(box, wrapped_text);
checkbox = elm_check_add(parent);
elm_object_text_set(checkbox, _("Wrap search?"));
@ -523,7 +537,7 @@ edi_editor_search_add(Evas_Object *parent, Edi_Editor *editor)
search = calloc(1, sizeof(*search));
search->entry = entry;
search->wrapped = wrapped;
search->wrapped_text = wrapped_text;
search->replace_entry = replace_entry;
search->replace_btn = replace_btn;
search->parent = parent;

View File

@ -11,6 +11,7 @@
#include "edi_language_provider_c.c"
#include "edi_language_provider_python.c"
#include "edi_language_provider_rust.c"
#include "edi_language_provider_go.c"
static Edi_Language_Provider _edi_language_provider_registry[] =
{
@ -29,7 +30,11 @@ static Edi_Language_Provider _edi_language_provider_registry[] =
_edi_language_rust_mime_name, _edi_language_rust_snippet_get,
NULL, NULL
},
{
"go", _edi_language_go_add, _edi_language_go_refresh, _edi_language_go_del,
_edi_language_go_mime_name, _edi_language_go_snippet_get,
NULL, NULL
},
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
};
@ -55,6 +60,8 @@ Edi_Language_Provider *edi_language_provider_for_mime_get(const char *mime)
id = "rust";
if (!strcasecmp(mime, "text/x-python"))
id = "python";
if (!strcasecmp(mime, "text/x-go"))
id = "go";
if (!id)
return NULL;

View File

@ -286,12 +286,14 @@ _edi_language_c_lookup(Edi_Editor *editor, unsigned int row, unsigned int col)
}
if (name)
suggest_it->summary = strdup(name);
suggest_it->detail = _edi_suggest_c_detail_get(editor, name, ret?ret:"", param?param:"");
{
suggest_it->summary = strdup(name);
suggest_it->detail = _edi_suggest_c_detail_get(editor, name, ret?ret:"", param?param:"");
list = eina_list_append(list, suggest_it);
}
if (param)
free(param);
list = eina_list_append(list, suggest_it);
}
clang_disposeCodeCompleteResults(res);
#else

View File

@ -0,0 +1,43 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Eina.h>
#include "edi_language_provider.h"
#include "edi_config.h"
#include "edi_private.h"
void
_edi_language_go_add(Edi_Editor *editor EINA_UNUSED)
{
}
void
_edi_language_go_refresh(Edi_Editor *editor EINA_UNUSED)
{
}
void
_edi_language_go_del(Edi_Editor *editor EINA_UNUSED)
{
}
const char *
_edi_language_go_mime_name(const char *mime)
{
if (!strcasecmp(mime, "text/x-go"))
return _("Go source");
return NULL;
}
const char *
_edi_language_go_snippet_get(const char *key)
{
(void) key;
return NULL;
}

View File

@ -175,16 +175,10 @@ _edi_mainview_win_exit(void *data EINA_UNUSED, Evas_Object *obj, void *event_inf
free(it);
}
static char *
static const char *
_edi_mainview_win_title_get(const char *path)
{
char *winname, *filename;
filename = basename((char*)path);
winname = malloc((8 + strlen(filename)) * sizeof(char));
snprintf(winname, 8 + strlen(filename), "Edi :: %s", filename);
return winname;
return eina_slstr_printf(_("Edi :: %s"), ecore_file_file_get(path));
}
static Evas_Object *
@ -280,21 +274,6 @@ edi_mainview_open_path(const char *path)
edi_mainview_panel_open_path(_current_panel, path);
}
static void
_focused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Elm_Code *code;
const char *path;
Edi_Mainview_Panel *panel;
Edi_Editor *editor = data;
code = elm_code_widget_code_get(editor->entry);
path = elm_code_file_path_get(code->file);
panel = edi_mainview_panel_for_path_get(path);
edi_mainview_panel_focus(panel);
}
static void
_changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -305,12 +284,23 @@ _changed_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
ecore_event_add(EDI_EVENT_FILE_CHANGED, NULL, NULL, NULL);
}
static Eina_Bool
_edi_mainview_split_config_changed_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Elm_Code_Widget *widget = data;
elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
return ECORE_CALLBACK_RENEW;
}
void edi_mainview_split_current(void)
{
Elm_Code *code;
Elm_Code_Widget *widget;
Edi_Editor *editor;
Edi_Mainview_Panel *panel;
const char *path;
if (edi_mainview_is_empty())
return;
@ -326,16 +316,22 @@ void edi_mainview_split_current(void)
code = elm_code_widget_code_get(editor->entry);
widget = elm_code_widget_add(panel->content, code);
elm_code_widget_editable_set(widget, EINA_TRUE);
elm_code_widget_line_numbers_set(widget, EINA_TRUE);
evas_object_smart_callback_add(widget, "changed,user", _changed_cb, editor);
evas_object_smart_callback_add(widget, "focused", _focused_cb, editor);
edi_editor_widget_config_get(widget);
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(widget);
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_mainview_split_config_changed_cb, widget);
elm_box_pack_start(panel->current->container, widget);
path = elm_code_file_path_get(code->file);
editor->split_views = eina_list_append(editor->split_views, widget);
_edi_project_config_tab_split_view_count_set(path, edi_mainview_panel_id(panel), eina_list_count(editor->split_views));
}
void

View File

@ -19,6 +19,13 @@
#include "edi_private.h"
#include "edi_config.h"
typedef struct _Edi_Mainview_State {
Edi_Mainview_Panel *panel;
char *path;
} Edi_Mainview_State;
static Edi_Mainview_State *_cached = NULL;
static Evas_Object *_main_win;
static Evas_Object *_edi_mainview_goto_popup;
@ -26,6 +33,51 @@ static void
dummy()
{}
static void
_edi_mainview_panel_cache_set(void)
{
Edi_Mainview_Item *item;
if (!_cached)
_cached = calloc(1, sizeof(Edi_Mainview_State));
if (_cached->path)
{
free(_cached->path);
_cached->path = NULL;
}
_cached->panel = edi_mainview_panel_current_get();
item = edi_mainview_item_current_get();
if (item)
_cached->path = strdup(item->path);
}
static Edi_Mainview_State *
_edi_mainview_panel_cache_get(void)
{
if (!_cached || !_cached->panel || !_cached->path)
return NULL;
return _cached;
}
static Edi_Mainview_Item *
_get_item_for_path(Edi_Mainview_Panel *panel, const char *path)
{
Eina_List *item;
Edi_Mainview_Item *it;
if (!panel || !path) return NULL;
EINA_LIST_FOREACH(panel->items, item, it)
{
if (it && !strcmp(it->path, path))
return it;
}
return NULL;
}
unsigned int
edi_mainview_panel_item_count(Edi_Mainview_Panel *panel)
{
@ -64,6 +116,9 @@ _edi_mainview_panel_current_tab_hide(Edi_Mainview_Panel *panel)
edi_mainview_panel_focus(panel);
if (!panel || !panel->current)
return;
editor = (Edi_Editor *)evas_object_data_get(panel->current->view, "editor");
if (editor)
{
@ -239,13 +294,14 @@ void
edi_mainview_panel_item_close(Edi_Mainview_Panel *panel, Edi_Mainview_Item *item)
{
int item_index;
Eina_Bool current;
if (!item)
return;
current = (item == panel->current);
item_index = eina_list_data_idx(panel->items, item);
edi_mainview_item_prev();
if (item->view)
evas_object_del(item->view);
elm_box_unpack(panel->tabs, item->tab);
@ -257,22 +313,22 @@ edi_mainview_panel_item_close(Edi_Mainview_Panel *panel, Edi_Mainview_Item *item
eina_stringshare_del(item->path);
free(item);
if (!current)
return;
if (eina_list_count(panel->items) == 0)
_edi_mainview_panel_show(panel, panel->welcome);
if (panel == edi_mainview_panel_current_get())
{
if (eina_list_count(panel->items))
{
if (item_index)
item = eina_list_nth(panel->items, item_index - 1);
else
item = eina_list_nth(panel->items, item_index);
edi_mainview_panel_item_select(panel, item);
_edi_mainview_panel_current_tab_show(panel);
}
_edi_mainview_panel_show(panel, panel->welcome);
return;
}
if (item_index)
item = eina_list_nth(panel->items, item_index - 1);
else
item = eina_list_nth(panel->items, item_index);
edi_mainview_panel_item_select(panel, item);
_edi_mainview_panel_current_tab_show(panel);
}
void
@ -303,7 +359,7 @@ edi_mainview_panel_item_select(Edi_Mainview_Panel *panel, Edi_Mainview_Item *ite
elm_object_signal_emit(item->tab, "mouse,down,1", "base");
evas_object_geometry_get(item->tab, NULL, NULL, &tabw, NULL);
elm_scroller_region_bring_in(panel->tabs, region_x, 0, tabw, 0);
elm_scroller_region_bring_in(efl_parent_get(panel->tabs), region_x, 0, tabw, 0);
_edi_project_config_tab_current_set(edi_mainview_panel_index_get(panel),
edi_mainview_panel_item_current_tab_get(panel));
@ -316,16 +372,22 @@ edi_mainview_panel_item_select(Edi_Mainview_Panel *panel, Edi_Mainview_Item *ite
static void
_promote(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
const char *emission EINA_UNUSED, const char *source)
{
Edi_Mainview_Panel *panel;
Edi_Mainview_Item *item = (Edi_Mainview_Item *) data;
// ignore if we clicked the delete part of the button
if (!strcmp(source, "del"))
return;
panel = edi_mainview_panel_for_item_get(item);
_edi_mainview_panel_cache_set();
_edi_mainview_panel_current_tab_hide(panel);
edi_mainview_panel_item_select(panel, (Edi_Mainview_Item *)data);
edi_mainview_panel_item_select(panel, item);
_edi_mainview_panel_current_tab_show(panel);
@ -337,10 +399,33 @@ _closetab(void *data, Evas_Object *obj EINA_UNUSED,
const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
{
Edi_Mainview_Panel *panel;
Edi_Mainview_Item *item;
Edi_Mainview_State *last;
Edi_Editor *editor;
int index;
panel = edi_mainview_panel_for_item_get((Edi_Mainview_Item *)data);
edi_mainview_panel_item_close(panel, data);
item = (Edi_Mainview_Item *) data;
panel = edi_mainview_panel_for_item_get(item);
editor = (Edi_Editor *) evas_object_data_get(panel->current->view, "editor");
if (editor && eina_list_count(editor->split_views))
{
Elm_Code *code;
const char *path;
Elm_Code_Widget *widget = eina_list_nth(editor->split_views, 0);
elm_box_unpack(panel->current->container, widget);
code = elm_code_widget_code_get(editor->entry);
path = elm_code_file_path_get(code->file);
editor->split_views = eina_list_remove(editor->split_views, widget);
_edi_project_config_tab_split_view_count_set(path, edi_mainview_panel_id(panel), eina_list_count(editor->split_views));
evas_object_del(widget);
return;
}
edi_mainview_panel_item_close(panel, item);
if (eina_list_count(panel->items)== 0 && edi_mainview_panel_count() > 1)
{
edi_mainview_panel_remove(panel);
@ -350,6 +435,18 @@ _closetab(void *data, Evas_Object *obj EINA_UNUSED,
edi_mainview_panel_focus(panel);
/* When closing tabs keep current tab */
last = _edi_mainview_panel_cache_get();
if (last && last->panel == panel && last->path)
{
item = _get_item_for_path(panel, last->path);
if (item)
{
_edi_mainview_panel_current_tab_hide(panel);
edi_mainview_panel_item_select(panel, item);
}
}
if (eina_list_count(panel->items))
_edi_mainview_panel_current_tab_show(panel);
}
@ -399,7 +496,7 @@ _edi_mainview_panel_item_tab_add(Edi_Mainview_Panel *panel, Edi_Path_Options *op
elm_object_focus_allow_set(tab, EINA_FALSE);
elm_layout_theme_set(tab, "multibuttonentry", "btn", "default");
elm_object_part_text_set(tab, "elm.btn.text", basename((char*)options->path));
elm_object_part_text_set(tab, "elm.btn.text", ecore_file_file_get(options->path));
/*
icon = elm_icon_add(tab);
elm_icon_standard_set(icon, provider->icon);
@ -438,22 +535,6 @@ _edi_mainview_panel_item_tab_add(Edi_Mainview_Panel *panel, Edi_Path_Options *op
_edi_project_config_tab_add(options->path, mime?mime:options->type, EINA_FALSE, id);
}
static Edi_Mainview_Item *
_get_item_for_path(Edi_Mainview_Panel *panel, const char *path)
{
Eina_List *item;
Edi_Mainview_Item *it;
if (!panel) return NULL;
EINA_LIST_FOREACH(panel->items, item, it)
{
if (it && !strcmp(it->path, path))
return it;
}
return NULL;
}
static void
_edi_popup_cancel_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
@ -504,6 +585,7 @@ _edi_mainview_panel_mime_content_safe_popup(void)
elm_object_part_content_set(popup, "button1", button);
evas_object_smart_callback_add(button, "clicked", _edi_popup_cancel_cb, popup);
_edi_mainview_panel_current_tab_show(edi_mainview_panel_current_get());
evas_object_show(popup);
}
@ -824,7 +906,6 @@ edi_mainview_panel_open(Edi_Mainview_Panel *panel, Edi_Path_Options *options)
current = panel;
for (i = 0; i < edi_mainview_panel_count(); i++)
{
panel = edi_mainview_panel_by_index(i);
@ -832,6 +913,7 @@ edi_mainview_panel_open(Edi_Mainview_Panel *panel, Edi_Path_Options *options)
it = _get_item_for_path(panel, options->path);
if (it)
{
_edi_mainview_panel_current_tab_hide(panel);
edi_mainview_panel_focus(panel);
editor = evas_object_data_get(panel->current->view, "editor");
@ -851,7 +933,6 @@ edi_mainview_panel_open(Edi_Mainview_Panel *panel, Edi_Path_Options *options)
}
return;
}
}
panel = current;

View File

@ -7,6 +7,8 @@ src = files([
'edi_consolepanel.h',
'edi_content_provider.c',
'edi_content_provider.h',
'edi_debug.c',
'edi_debug.h',
'edi_debugpanel.c',
'edi_debugpanel.h',
'edi_file.c',

View File

@ -139,7 +139,19 @@ edi_about_show(Evas_Object *mainwin)
button = elm_button_add(box);
elm_object_text_set(button, _("Report Issue"));
evas_object_smart_callback_add(button, "clicked", _edi_about_url_cb,
"https://phab.enlightenment.org/maniphest/task/edit/form/2/?projects=PHID-PROJ-geg2fyscqgjjxt3fider");
"https://github.com/Enlightenment/edi/issues/new");
elm_box_pack_end(buttonbox, button);
evas_object_show(button);
space = elm_box_add(box);
evas_object_size_hint_min_set(space, 20 * elm_config_scale_get(), 0);
elm_box_pack_end(buttonbox, space);
evas_object_show(space);
button = elm_button_add(box);
elm_object_text_set(button, _("Help Translate"));
evas_object_smart_callback_add(button, "clicked", _edi_about_url_cb,
"https://www.transifex.com/enlightenment/edi-ide/languages/");
elm_box_pack_end(buttonbox, button);
evas_object_show(button);

View File

@ -125,6 +125,66 @@ void edi_screens_message(Evas_Object *parent, const char *title, const char *mes
evas_object_show(popup);
}
static void
_edi_screens_settings_display_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Evas_Object *parent = evas_object_data_get(obj, "parent");
evas_object_del((Evas_Object *) data);
edi_settings_show(parent);
}
void edi_screens_settings_message(Evas_Object *parent, const char *title, const char *message)
{
Evas_Object *popup, *table, *box, *icon, *sep, *label, *button;
popup = elm_popup_add(parent);
elm_object_part_text_set(popup, "title,text", title);
table = elm_table_add(popup);
icon = elm_icon_add(table);
elm_icon_standard_set(icon, "dialog-information");
evas_object_size_hint_min_set(icon, 48 * elm_config_scale_get(), 48 * elm_config_scale_get());
evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(icon);
elm_table_pack(table, icon, 0, 0, 1, 1);
label = elm_label_add(popup);
elm_object_text_set(label, message);
evas_object_show(label);
elm_table_pack(table, label, 1, 0, 1, 1);
evas_object_show(table);
box = elm_box_add(popup);
sep = elm_separator_add(box);
elm_separator_horizontal_set(sep, EINA_TRUE);
evas_object_show(sep);
elm_box_pack_end(box, sep);
elm_box_pack_end(box, table);
sep = elm_separator_add(box);
elm_separator_horizontal_set(sep, EINA_TRUE);
evas_object_show(sep);
elm_box_pack_end(box, sep);
elm_object_content_set(popup, box);
button = elm_button_add(popup);
elm_object_text_set(button, _("OK"));
elm_object_part_content_set(popup, "button1", button);
evas_object_smart_callback_add(button, "clicked", _edi_screens_popup_cancel_cb, popup);
button = elm_button_add(popup);
elm_object_text_set(button, _("Settings"));
elm_object_part_content_set(popup, "button2", button);
evas_object_data_set(button, "parent", parent);
evas_object_smart_callback_add(button, "clicked", _edi_screens_settings_display_cb, popup);
evas_object_show(popup);
}
void edi_screens_desktop_notify(const char *title, const char *message)
{
Eina_Strbuf *command;

View File

@ -83,6 +83,18 @@ void edi_screens_message_confirm(Evas_Object *parent, const char *message, void
*/
void edi_screens_message(Evas_Object *parent, const char *title, const char *message);
/**
* Create an information dialogue with additional button to settings.
*
* @param parent The parent object to display the dialogue in.
* @param title The title for the popup.
* @param message The text to be displayed in the popup.
*
* @ingroup UI
*/
void edi_screens_settings_message(Evas_Object *parent, const char *title, const char *message);
/**
* Send a desktop notification message to the window manager.
*

View File

@ -8,12 +8,15 @@
#include "Edi.h"
#include "edi_screens.h"
#include "edi_config.h"
#include "edi_debug.h"
#include "edi_private.h"
static Elm_Object_Item *_edi_settings_display, *_edi_settings_builds,
*_edi_settings_behaviour, *_edi_settings_project;
#define EDI_SETTINGS_TABLE_PADDING 5
static void
_edi_settings_exit(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -43,8 +46,9 @@ _edi_settings_panel_create(Evas_Object *parent, const char *title)
frame = elm_frame_add(parent);
elm_object_text_set(frame, title);
elm_object_part_content_set(frame, "default", box);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(frame);
return frame;
}
@ -144,61 +148,93 @@ _edi_settings_font_preview_add(Evas_Object *parent, const char *font_name, int f
static Evas_Object *
_edi_settings_display_create(Evas_Object *parent)
{
Evas_Object *box, *hbox, *frame, *label, *spinner, *check, *button, *preview;
Evas_Object *container, *box, *frame, *label, *spinner, *check, *button, *preview;
Evas_Object *table;
container = elm_box_add(parent);
evas_object_size_hint_weight_set(container, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(container, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(container);
frame = _edi_settings_panel_create(parent, _("Display"));
box = elm_object_part_content_get(frame, "default");
elm_box_pack_end(container, frame);
hbox = elm_box_add(parent);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, 1.0);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_padding_set(table, EDI_SETTINGS_TABLE_PADDING, EDI_SETTINGS_TABLE_PADDING);
evas_object_show(table);
label = elm_label_add(hbox);
label = elm_label_add(table);
elm_object_text_set(label, _("Font"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_box_pack_end(hbox, label);
elm_table_pack(table, label, 0, 0, 1, 1);
evas_object_show(label);
button = elm_button_add(hbox);
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
button = elm_button_add(table);
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0); // EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(button);
preview = _edi_settings_font_preview_add(hbox, _edi_project_config->font.name,
preview = _edi_settings_font_preview_add(table, _edi_project_config->font.name,
_edi_project_config->font.size);
elm_layout_content_set(button, "elm.swallow.content", preview);
elm_box_pack_end(hbox, button);
elm_table_pack(table, button, 1, 0, 1, 1);
evas_object_smart_callback_add(button, "clicked",
_edi_settings_font_choose_cb, parent);
elm_object_focus_set(button, EINA_TRUE);
label = elm_label_add(table);
elm_object_text_set(label, _("Hide Toolbar"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_table_pack(table, label, 0, 4, 1, 1);
evas_object_show(label);
check = elm_check_add(box);
elm_check_state_set(check, _edi_project_config->gui.toolbar_hidden);
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
evas_object_smart_callback_add(check, "changed",
_edi_settings_toolbar_hidden_cb, NULL);
elm_table_pack(table, check, 1, 4, 1, 1);
evas_object_show(check);
elm_box_pack_end(box, table);
// END OF ALPHA SELECTOR
frame = _edi_settings_panel_create(parent, _("Editor"));
box = elm_object_part_content_get(frame, "default");
elm_box_pack_end(container, frame);
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_padding_set(table, EDI_SETTINGS_TABLE_PADDING, EDI_SETTINGS_TABLE_PADDING);
evas_object_show(table);
label = elm_label_add(table);
elm_object_text_set(label, _("Display whitespace"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_table_pack(table, label, 0, 0, 1, 1);
evas_object_show(label);
check = elm_check_add(box);
elm_object_text_set(check, _("Display whitespace"));
elm_check_state_set(check, _edi_project_config->gui.show_whitespace);
elm_box_pack_end(box, check);
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(check, 0.0, 0.5);
evas_object_smart_callback_add(check, "changed",
_edi_settings_display_whitespace_cb, NULL);
elm_table_pack(table, check, 1, 0, 1, 1);
evas_object_show(check);
hbox = elm_box_add(box);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, 0.5);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
label = elm_label_add(hbox);
label = elm_label_add(box);
elm_object_text_set(label, _("Line width marker"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_box_pack_end(hbox, label);
elm_table_pack(table, label, 0, 1, 1, 1);
evas_object_show(label);
spinner = elm_spinner_add(hbox);
spinner = elm_spinner_add(box);
elm_spinner_value_set(spinner, _edi_project_config->gui.width_marker);
elm_spinner_editable_set(spinner, EINA_TRUE);
elm_spinner_step_set(spinner, 1);
@ -208,23 +244,16 @@ _edi_settings_display_create(Evas_Object *parent)
evas_object_size_hint_align_set(spinner, 0.0, 0.95);
evas_object_smart_callback_add(spinner, "changed",
_edi_settings_display_widthmarker_cb, NULL);
elm_box_pack_end(hbox, spinner);
elm_table_pack(table, spinner, 1, 1, 1, 1);
evas_object_show(spinner);
hbox = elm_box_add(parent);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, 0.5);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
label = elm_label_add(hbox);
label = elm_label_add(box);
elm_object_text_set(label, _("Tabstop"));
evas_object_size_hint_align_set(label, 0.0, 0.5);
elm_box_pack_end(hbox, label);
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_table_pack(table, label, 0, 2, 1, 1);
evas_object_show(label);
spinner = elm_spinner_add(hbox);
spinner = elm_spinner_add(box);
elm_spinner_value_set(spinner, _edi_project_config->gui.tabstop);
elm_spinner_editable_set(spinner, EINA_TRUE);
elm_spinner_step_set(spinner, 1);
@ -234,30 +263,26 @@ _edi_settings_display_create(Evas_Object *parent)
evas_object_size_hint_align_set(spinner, 0.0, 0.95);
evas_object_smart_callback_add(spinner, "changed",
_edi_settings_display_tabstop_cb, NULL);
elm_box_pack_end(hbox, spinner);
elm_table_pack(table, spinner, 1, 2, 1, 1);
evas_object_show(spinner);
label = elm_label_add(box);
elm_object_text_set(label, ("Insert spaces when tab is pressed"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_table_pack(table, label, 0, 3, 1, 1);
evas_object_show(label);
check = elm_check_add(box);
elm_object_text_set(check, _("Insert spaces when tab is pressed"));
elm_check_state_set(check, _edi_project_config->gui.tab_inserts_spaces);
elm_box_pack_end(box, check);
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(check, 0.0, 0.5);
evas_object_smart_callback_add(check, "changed",
_edi_settings_display_tab_inserts_spaces_cb, NULL);
elm_table_pack(table, check, 1, 3, 1, 1);
evas_object_show(check);
elm_box_pack_end(box, table);
check = elm_check_add(box);
elm_object_text_set(check, _("Hide Toolbar"));
elm_check_state_set(check, _edi_project_config->gui.toolbar_hidden);
elm_box_pack_end(box, check);
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
evas_object_smart_callback_add(check, "changed",
_edi_settings_toolbar_hidden_cb, NULL);
evas_object_show(check);
return frame;
return container;
}
static void
@ -293,76 +318,139 @@ _edi_settings_builds_args_cb(void *data EINA_UNUSED, Evas_Object *obj,
_edi_project_config_save();
}
static char *
_edi_settings_builds_debug_tool_text_get_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
{
Edi_Debug_Tool *tool;
int i;
i = (int)(uintptr_t) data;
tool = &edi_debug_tools_get()[i];
return strdup(tool->name);
}
static void _edi_settings_builds_debug_pressed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
{
const char *text = elm_object_item_text_get(event_info);
if (_edi_project_config->debug_command)
eina_stringshare_del(_edi_project_config->debug_command);
_edi_project_config->debug_command = eina_stringshare_add(text);
_edi_project_config_save();
elm_object_text_set(obj, text);
elm_combobox_hover_end(obj);
}
static Evas_Object *
_edi_settings_builds_create(Evas_Object *parent)
{
Evas_Object *box, *frame, *hbox, *label, *ic, *selector, *file, *entry;
Evas_Object *box, *frame, *table, *label, *ic, *selector, *file, *entry;
Evas_Object *combobox;
Elm_Genlist_Item_Class *itc;
Edi_Debug_Tool *tools;
int i;
frame = _edi_settings_panel_create(parent, _("Builds"));
box = elm_object_part_content_get(frame, "default");
hbox = elm_box_add(parent);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_padding_set(table, EDI_SETTINGS_TABLE_PADDING, EDI_SETTINGS_TABLE_PADDING);
evas_object_show(table);
elm_box_pack_end(box, table);
label = elm_label_add(hbox);
label = elm_label_add(box);
elm_object_text_set(label, _("Runtime binary"));
evas_object_size_hint_weight_set(label, 0.0, 0.0);
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
elm_box_pack_end(hbox, label);
elm_table_pack(table, label, 0, 0, 1, 1);
evas_object_show(label);
ic = elm_icon_add(hbox);
ic = elm_icon_add(box);
elm_icon_standard_set(ic, "file");
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
evas_object_show(ic);
selector = elm_fileselector_button_add(box);
elm_object_text_set(selector, _("Select"));
elm_object_part_content_set(selector, "icon", ic);
elm_fileselector_path_set(selector, edi_project_get());
evas_object_size_hint_weight_set(selector, 0.25, 0.0);
evas_object_size_hint_align_set(selector, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(hbox, selector);
elm_table_pack(table, selector, 1, 0, 1, 1);
evas_object_show(selector);
elm_object_focus_set(selector, EINA_TRUE);
file = elm_label_add(hbox);
file = elm_entry_add(box);
elm_entry_editable_set(file, EINA_FALSE);
elm_entry_single_line_set(file, EINA_TRUE);
elm_entry_scrollable_set(file, EINA_TRUE);
elm_object_text_set(file, _edi_project_config->launch.path);
evas_object_size_hint_weight_set(file, 0.75, 0.0);
evas_object_size_hint_align_set(file, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(hbox, file);
elm_table_pack(table, file, 2, 0, 1, 1);
evas_object_show(file);
evas_object_smart_callback_add(selector, "file,chosen",
_edi_settings_builds_binary_chosen_cb, file);
hbox = elm_box_add(parent);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
label = elm_label_add(hbox);
label = elm_label_add(box);
elm_object_text_set(label, _("Runtime arguments"));
evas_object_size_hint_weight_set(label, 0.0, 0.0);
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
elm_box_pack_end(hbox, label);
elm_table_pack(table, label, 0, 1, 1, 1);
evas_object_show(label);
entry = elm_entry_add(hbox);
entry = elm_entry_add(box);
elm_object_text_set(entry, _edi_project_config->launch.args);
elm_entry_editable_set(entry, EINA_TRUE);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
evas_object_size_hint_weight_set(entry, 0.75, 0.0);
evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(hbox, entry);
elm_table_pack(table, entry, 1, 1, 2, 1);
evas_object_show(entry);
evas_object_smart_callback_add(entry, "changed",
_edi_settings_builds_args_cb, NULL);
label = elm_label_add(box);
elm_object_text_set(label, _("Default debugger"));
evas_object_size_hint_weight_set(label, 0.0, 0.0);
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
elm_table_pack(table, label, 0, 2, 1, 1);
evas_object_show(label);
combobox = elm_combobox_add(box);
if (_edi_project_config->debug_command)
elm_object_part_text_set(combobox, "guide", _edi_project_config->debug_command);
else
elm_object_part_text_set(combobox, "guide", edi_debug_tools_get()[0].name);
evas_object_size_hint_weight_set(combobox, 0.75, 0.0);
evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(combobox);
evas_object_smart_callback_add(combobox, "item,pressed",
_edi_settings_builds_debug_pressed_cb, NULL);
elm_table_pack(table, combobox, 1, 2, 2, 1);
itc = elm_genlist_item_class_new();
itc->item_style = "default";
itc->func.text_get = _edi_settings_builds_debug_tool_text_get_cb;
tools = edi_debug_tools_get();
for (i = 0; tools[i].name; i++)
{
if (ecore_file_app_installed(tools[i].exec))
elm_genlist_item_append(combobox, itc, (void *)(uintptr_t) i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t) i);
}
elm_genlist_realized_items_update(combobox);
elm_genlist_item_class_free(itc);
return frame;
}
@ -420,64 +508,66 @@ static Evas_Object *
_edi_settings_project_create(Evas_Object *parent)
{
Edi_Scm_Engine *engine = NULL;
Evas_Object *box, *frames, *frame, *hbox, *label, *entry_name, *entry_email;
Evas_Object *box, *frames, *frame, *table, *label, *entry_name, *entry_email;
Evas_Object *entry_remote;
Eina_Strbuf *text;
const char *remote_name, *remote_email;
engine = edi_scm_engine_get();
if (!engine)
{
remote_name = remote_email = "";
}
else
{
remote_name = engine->remote_name_get();
remote_email = engine->remote_email_get();
}
frames = elm_box_add(parent);
frame = _edi_settings_panel_create(frames, _("Project Settings"));
evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(frames, frame);
evas_object_show(frame);
box = elm_object_part_content_get(frame, "default");
hbox = elm_box_add(parent);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_padding_set(table, EDI_SETTINGS_TABLE_PADDING, EDI_SETTINGS_TABLE_PADDING);
elm_box_pack_end(box, table);
evas_object_show(table);
label = elm_label_add(hbox);
label = elm_label_add(table);
elm_object_text_set(label, _("Author Name"));
evas_object_size_hint_weight_set(label, 0.0, 0.0);
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
elm_box_pack_end(hbox, label);
elm_table_pack(table, label, 0, 0, 1, 1);
evas_object_show(label);
entry_name = elm_entry_add(hbox);
elm_object_text_set(entry_name, _edi_project_config->user_fullname);
entry_name = elm_entry_add(table);
elm_object_text_set(entry_name, _edi_project_config->user_fullname ?: remote_name);
elm_entry_single_line_set(entry_name, EINA_TRUE);
elm_entry_scrollable_set(entry_name, EINA_TRUE);
evas_object_size_hint_weight_set(entry_name, 0.75, 0.0);
evas_object_size_hint_align_set(entry_name, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(hbox, entry_name);
elm_table_pack(table, entry_name, 1, 0, 1, 1);
evas_object_show(entry_name);
evas_object_smart_callback_add(entry_name, "changed",
_edi_settings_project_name_cb, NULL);
hbox = elm_box_add(parent);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
label = elm_label_add(hbox);
label = elm_label_add(table);
elm_object_text_set(label, _("Author E-mail"));
evas_object_size_hint_weight_set(label, 0.0, 0.0);
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
elm_box_pack_end(hbox, label);
elm_table_pack(table, label, 0, 1, 1, 1);
evas_object_show(label);
entry_email = elm_entry_add(hbox);
elm_object_text_set(entry_email, _edi_project_config->user_email);
entry_email = elm_entry_add(table);
elm_object_text_set(entry_email, _edi_project_config->user_email ?: remote_email);
elm_entry_single_line_set(entry_email, EINA_TRUE);
elm_entry_scrollable_set(entry_email, EINA_TRUE);
evas_object_size_hint_weight_set(entry_email, 0.75, 0.0);
evas_object_size_hint_align_set(entry_email, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(hbox, entry_email);
elm_table_pack(table, entry_email, 1, 1, 1, 1);
evas_object_show(entry_email);
evas_object_smart_callback_add(entry_email, "changed",
_edi_settings_project_email_cb, NULL);
@ -485,41 +575,37 @@ _edi_settings_project_create(Evas_Object *parent)
if (!edi_scm_enabled())
return frames;
engine = edi_scm_engine_get();
text = eina_strbuf_new();
eina_strbuf_append(text, _("Source Control"));
eina_strbuf_append_printf(text, " (%s)", engine->name);
frame = _edi_settings_panel_create(frames, eina_strbuf_string_get(text));
eina_strbuf_free(text);
evas_object_size_hint_weight_set(frame, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(frames, frame);
evas_object_show(frame);
box = elm_object_part_content_get(frame, "default");
hbox = elm_box_add(parent);
elm_box_horizontal_set(hbox, EINA_TRUE);
evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(box, hbox);
evas_object_show(hbox);
table = elm_table_add(parent);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_padding_set(table, EDI_SETTINGS_TABLE_PADDING, EDI_SETTINGS_TABLE_PADDING);
elm_box_pack_end(box, table);
evas_object_show(table);
label = elm_label_add(hbox);
label = elm_label_add(table);
elm_object_text_set(label, _("Remote URL"));
evas_object_size_hint_weight_set(label, 0.0, 0.0);
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
elm_box_pack_end(hbox, label);
elm_table_pack(table, label, 0, 0, 1, 1);
evas_object_show(label);
entry_remote = elm_entry_add(hbox);
entry_remote = elm_entry_add(table);
elm_object_text_set(entry_remote, engine->remote_url_get());
elm_entry_single_line_set(entry_remote, EINA_TRUE);
elm_entry_scrollable_set(entry_remote, EINA_TRUE);
elm_object_disabled_set(entry_remote, edi_scm_remote_enabled());
evas_object_size_hint_weight_set(entry_remote, 0.75, 0.0);
evas_object_size_hint_align_set(entry_remote, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(hbox, entry_remote);
elm_table_pack(table, entry_remote, 1, 0, 1, 1);
evas_object_show(entry_remote);
evas_object_smart_callback_add(entry_remote, "changed",
_edi_settings_project_remote_cb, NULL);

View File

@ -52,7 +52,8 @@ static Eina_Bool
_font_monospaced_check(const char *name, Evas_Object *parent)
{
Evas_Object *textblock;
Evas_Coord w1, w2, h1, h2;
Evas_Coord w1, w2;
int diff;
textblock = evas_object_text_add(parent);
evas_object_size_hint_weight_set(textblock, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -62,17 +63,18 @@ _font_monospaced_check(const char *name, Evas_Object *parent)
evas_object_text_font_set(textblock, name, 14);
evas_object_text_text_set(textblock, "i");
// check width is consistent - i.e. monospaced
evas_object_geometry_get(textblock, NULL, NULL, &w1, &h1);
evas_object_geometry_get(textblock, NULL, NULL, &w1, NULL);
evas_object_text_text_set(textblock, "m");
evas_object_geometry_get(textblock, NULL, NULL, &w2, NULL);
// also check that height varies i.e. not fixed
evas_object_text_font_set(textblock, name, 4);
evas_object_geometry_get(textblock, NULL, NULL, NULL, &h2);
// check width difference is small or zero.
diff = (w2 >= w1) ? w2 - w1 : w1 - w2;
return w1 == w2 && h1 != h2;
if (diff > 3)
return EINA_FALSE;
return EINA_TRUE;
}
static void

View File

@ -16,10 +16,13 @@
typedef struct _Edi_Template
{
char *edje_path;
char *skeleton_path;
char *edje_id;
char *edje_path; // TODO fix
char *path; // file path for skeleton, directory for example
char *title;
char *desc;
Eina_Bool is_template;
} Edi_Template;
typedef struct _Edi_Welcome_Data {
@ -31,6 +34,7 @@ typedef struct _Edi_Welcome_Data {
} Edi_Welcome_Data;
static Eina_List *_available_templates = NULL;
static Eina_List *_available_examples = NULL;
static Evas_Object *_welcome_window, *_welcome_naviframe;
static Evas_Object *_edi_new_popup;
@ -164,7 +168,7 @@ _edi_welcome_project_choose_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
static void
_edi_welcome_project_new_directory_row_add(const char *text, int row,
Evas_Object *parent)
Evas_Object *parent)
{
Evas_Object *label, *input;
@ -186,9 +190,9 @@ _edi_welcome_project_new_directory_row_add(const char *text, int row,
_create_inputs[row] = input;
}
static void
_edi_welcome_project_new_input_row_add(const char *text, const char *placeholder, int row,
Evas_Object *parent)
static Evas_Object *
_edi_welcome_project_new_input_row_add(const char *text, const char *placeholder,
Eina_Bool show, int row, Evas_Object *parent)
{
Evas_Object *label, *input;
@ -197,7 +201,8 @@ _edi_welcome_project_new_input_row_add(const char *text, const char *placeholder
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(parent, label, 0, row, 1, 1);
evas_object_show(label);
if (show)
evas_object_show(label);
input = elm_entry_add(parent);
elm_entry_scrollable_set(input, EINA_TRUE);
@ -205,32 +210,106 @@ _edi_welcome_project_new_input_row_add(const char *text, const char *placeholder
evas_object_size_hint_weight_set(input, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(parent, input, 1, row, _EDI_WELCOME_PROJECT_NEW_TABLE_WIDTH - 1, 1);
evas_object_show(input);
if (show)
evas_object_show(input);
if (placeholder)
{
elm_object_text_set(input, placeholder);
}
_create_inputs[row] = input;
return input;
}
Edi_Template *
_edi_template_add(const char *templates, const char *groupname)
{
Edi_Template *t;
Evas_Object *group;
Ecore_Evas *evas; // TODO find a way to not need this!
t = malloc(sizeof(Edi_Template));
evas = ecore_evas_buffer_new(0, 0);
group = edje_object_add(ecore_evas_get(evas));
edje_object_file_set(group, templates, groupname);
t->title = strdup(edje_object_data_get(group, "title"));
t->desc = strdup(edje_object_data_get(group, "description"));
t->path = strdup(edje_object_data_get(group, "path"));
t->edje_path = strdup(templates);
t->edje_id = strdup(groupname);
return t;
}
static void
_edi_template_free(Edi_Template *t)
{
if (t)
if (!t)
return;
free(t->title);
free(t->desc);
free(t->edje_path);
free(t->edje_id);
free(t->path);
free(t);
}
static void
_edi_templates_discover(const char *directory)
{
Eina_List *collection, *list;
char path[PATH_MAX];
const char *groupname;
eina_file_path_join(path, sizeof(path), directory, "templates.edj");
if (!ecore_file_exists(path))
return;
collection = edje_file_collection_list(path);
EINA_LIST_FOREACH(collection, list, groupname)
{
free(t->title);
free(t->desc);
free(t->edje_path);
free(t->skeleton_path);
free(t);
Edi_Template *template = _edi_template_add(path, groupname);
if (!template)
continue;
template->is_template = EINA_TRUE;
_available_templates = eina_list_append(_available_templates, template);
}
edje_mmap_collection_list_free(collection);
}
static void
_edi_examples_discover(const char *directory)
{
Eina_List *collection, *list;
char path[PATH_MAX];
const char *groupname;
eina_file_path_join(path, sizeof(path), directory, "examples.edj");
if (!ecore_file_exists(path))
return;
collection = edje_file_collection_list(path);
EINA_LIST_FOREACH(collection, list, groupname)
{
Edi_Template *example = _edi_template_add(path, groupname);
if (!example)
continue;
example->is_template = EINA_FALSE;
_available_examples = eina_list_append(_available_examples, example);
}
edje_mmap_collection_list_free(collection);
}
static void
_edi_welcome_project_new_create_done_cb(const char *path, Eina_Bool success)
{
Edi_Template *template;
Edi_Template *template, *example;
if (!success)
{
@ -241,51 +320,12 @@ _edi_welcome_project_new_create_done_cb(const char *path, Eina_Bool success)
EINA_LIST_FREE(_available_templates, template)
_edi_template_free(template);
EINA_LIST_FREE(_available_examples, example)
_edi_template_free(example);
_edi_welcome_project_open(path, EINA_TRUE);
}
Edi_Template *
_edi_template_add(const char *directory, const char *file)
{
Edi_Template *t;
char *path = edi_path_append(directory, file);
if (!ecore_file_exists(path))
return NULL;
t = malloc(sizeof(Edi_Template));
t->title = edje_file_data_get(path, "title");
t->desc = edje_file_data_get(path, "description");
t->skeleton_path = edi_path_append(directory, edje_file_data_get(path, "file"));
t->edje_path = path;
return t;
}
static void
_edi_templates_discover(const char *directory)
{
Eina_List *files;
char *file;
files = ecore_file_ls(directory);
EINA_LIST_FREE(files, file)
{
if (eina_str_has_extension(file, ".edj"))
{
Edi_Template *template = _edi_template_add(directory, file);
if (template)
_available_templates = eina_list_append(_available_templates, template);
}
free(file);
}
if (files)
eina_list_free(files);
}
static void
_edi_welcome_project_new_create_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -300,16 +340,20 @@ _edi_welcome_project_new_create_cb(void *data EINA_UNUSED, Evas_Object *obj EINA
user = elm_object_text_get(_create_inputs[3]);
email = elm_object_text_get(_create_inputs[4]);
if (template && path && path[0] && name && name[0])
if (path && path[0] && name && name[0])
{
edi_create_efl_project(template->skeleton_path, path, name, url, user, email,
_edi_welcome_project_new_create_done_cb);
if (!template->is_template)
edi_create_example(template->path, path, name,
_edi_welcome_project_new_create_done_cb);
else
edi_create_project(template->path, path, name, url, user, email,
_edi_welcome_project_new_create_done_cb);
}
else
{
if (path && !path[0])
if (!path || !path[0])
elm_object_focus_set(_create_inputs[0], EINA_TRUE);
else if (name && !name[0])
else if (!name || !name[0])
elm_object_focus_set(_create_inputs[1], EINA_TRUE);
}
}
@ -348,7 +392,7 @@ _edi_welcome_user_fullname_get(const char *username, char *fullname, size_t max)
static void
_edi_welcome_project_details(Evas_Object *naviframe, Edi_Template *template)
{
Evas_Object *content, *button;
Evas_Object *content, *button, *input;
Elm_Object_Item *item;
int row = 0;
char fullname[1024];
@ -363,13 +407,16 @@ _edi_welcome_project_details(Evas_Object *naviframe, Edi_Template *template)
if (!username)
username = getenv("USERNAME");
_edi_welcome_project_new_directory_row_add(_("Parent Path"), row++, content);
_edi_welcome_project_new_input_row_add(_("Project Name"), NULL, row++, content);
_edi_welcome_project_new_input_row_add(_("Project URL"), NULL, row++, content);
input = _edi_welcome_project_new_input_row_add(_("Project Name"), NULL, EINA_TRUE, row++, content);
if (!template->is_template)
elm_object_text_set(input, template->edje_id);
_edi_welcome_project_new_input_row_add(_("Project URL"), NULL, template->is_template, row++, content);
if (_edi_welcome_user_fullname_get(username, fullname, sizeof(fullname)))
_edi_welcome_project_new_input_row_add(_("Creator Name"), fullname, row++, content);
_edi_welcome_project_new_input_row_add(_("Creator Name"), fullname, template->is_template, row++, content);
else
_edi_welcome_project_new_input_row_add(_("Creator Name"), username, row++, content);
_edi_welcome_project_new_input_row_add(_("Creator Email"), NULL, row++, content);
_edi_welcome_project_new_input_row_add(_("Creator Name"), username, template->is_template, row++, content);
_edi_welcome_project_new_input_row_add(_("Creator Email"), NULL, template->is_template, row++, content);
button = elm_button_add(content);
elm_object_text_set(button, _("Create"));
@ -429,7 +476,7 @@ _content_get(void *data, Evas_Object *obj, const char *source)
evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(image, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_min_set(image, 96 * elm_config_scale_get(), 96 * elm_config_scale_get());
elm_image_file_set(image, template->edje_path, "logo");
elm_image_file_set(image, template->edje_path, template->edje_id);
evas_object_show(image);
elm_table_pack(table, image, 0, 0, 1, 1);
@ -449,6 +496,12 @@ _content_get(void *data, Evas_Object *obj, const char *source)
return frame;
}
static char *
_header_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *source EINA_UNUSED)
{
return strdup((char *)data);
}
static void
_edi_welcome_project_new_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -456,19 +509,16 @@ _edi_welcome_project_new_cb(void *data, Evas_Object *obj EINA_UNUSED, void *even
Evas_Object *content, *button, *naviframe;
Evas_Object *table, *list, *rect, *hbox;
Elm_Object_Item *item;
Edi_Template *template;
Elm_Genlist_Item_Class *itc;
char path[PATH_MAX];
Edi_Template *template, *example;
Elm_Genlist_Item_Class *ith, *itc;
naviframe = (Evas_Object *) data;
EINA_LIST_FREE(_available_templates, template)
_edi_template_free(template);
snprintf(path, sizeof(path), "%s/templates", _edi_config_dir_get());
_edi_templates_discover(PACKAGE_DATA_DIR "/templates");
_edi_templates_discover(path);
_edi_examples_discover(PACKAGE_DATA_DIR "/examples");
content = elm_box_add(naviframe);
evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -503,6 +553,12 @@ _edi_welcome_project_new_cb(void *data, Evas_Object *obj EINA_UNUSED, void *even
elm_table_pack(table, list, 0, 0, 1, 1);
elm_box_pack_end(hbox, table);
ith = elm_genlist_item_class_new();
ith->item_style = "group_index";
ith->func.text_get = _header_text_get;
ith->func.del = NULL;
elm_genlist_item_append(list, ith, _("Templates"), NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
itc = elm_genlist_item_class_new();
itc->item_style = "full";
itc->func.text_get = NULL;
@ -513,6 +569,11 @@ _edi_welcome_project_new_cb(void *data, Evas_Object *obj EINA_UNUSED, void *even
EINA_LIST_FOREACH(_available_templates, l, template)
elm_genlist_item_append(list, itc, template, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_item_append(list, ith, _("Examples"), NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
EINA_LIST_FOREACH(_available_examples, l, example)
elm_genlist_item_append(list, itc, example, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
elm_genlist_realized_items_update(list);
elm_genlist_item_class_free(itc);
@ -543,7 +604,7 @@ _edi_welcome_clone_thread_end_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
elm_object_disabled_set(wd->button, EINA_FALSE);
if (wd->status)
_edi_message_open(_("Unable to clone project, please check URL or try again later"), EINA_TRUE);
_edi_message_open(_("Unable to clone project, please check URL or try again later"), EINA_FALSE);
else
_edi_welcome_project_open(wd->dir, EINA_FALSE);
@ -566,15 +627,34 @@ static void
_edi_welcome_project_clone_click_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Evas_Object *entry;
const char *parent, *name;
const char *parent, *name, *url;
Edi_Welcome_Data *wd = data;
url = elm_object_text_get(_create_inputs[0]);
entry = elm_layout_content_get(_create_inputs[1], "elm.swallow.entry");
parent = elm_object_text_get(entry);
name = elm_object_text_get(_create_inputs[2]);
if (!url || !url[0])
{
elm_object_focus_set(_create_inputs[0], EINA_TRUE);
return;
}
if (!parent || !parent[0])
{
elm_object_focus_set(_create_inputs[1], EINA_TRUE);
return;
}
if (!name || !name[0])
{
elm_object_focus_set(_create_inputs[2], EINA_TRUE);
return;
}
wd->dir = edi_path_append(parent, name);
wd->url = strdup(elm_object_text_get(_create_inputs[0]));
wd->url = strdup(url);
elm_object_disabled_set(wd->button, EINA_TRUE);
elm_progressbar_pulse(wd->pb, EINA_TRUE);
@ -596,9 +676,9 @@ _edi_welcome_project_clone_cb(void *data, Evas_Object *obj EINA_UNUSED, void *ev
evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(content);
_edi_welcome_project_new_input_row_add(_("Source Control URL"), NULL, row++, content);
_edi_welcome_project_new_input_row_add(_("Source Control URL"), NULL, EINA_TRUE, row++, content);
_edi_welcome_project_new_directory_row_add(_("Parent Path"), row++, content);
_edi_welcome_project_new_input_row_add(_("Project Name"), NULL, row++, content);
_edi_welcome_project_new_input_row_add(_("Project Name"), NULL, EINA_TRUE, row++, content);
pb = elm_progressbar_add(content);
evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5);

View File

@ -113,7 +113,7 @@ edi_project_get()
EAPI const char *
edi_project_name_get()
{
return basename((char*)edi_project_get());
return ecore_file_file_get(edi_project_get());
}
EAPI char *

View File

@ -12,6 +12,7 @@ extern Edi_Build_Provider _edi_build_provider_cmake;
extern Edi_Build_Provider _edi_build_provider_cargo;
extern Edi_Build_Provider _edi_build_provider_python;
extern Edi_Build_Provider _edi_build_provider_meson;
extern Edi_Build_Provider _edi_build_provider_go;
EAPI Edi_Build_Provider *edi_build_provider_for_project_get()
{
@ -31,6 +32,8 @@ EAPI Edi_Build_Provider *edi_build_provider_for_project_path_get(const char *pat
return &_edi_build_provider_python;
if (_edi_build_provider_meson.path_supported_is(path))
return &_edi_build_provider_meson;
if (_edi_build_provider_go.path_supported_is(path))
return &_edi_build_provider_go;
if (_edi_build_provider_make.path_supported_is(path))
return &_edi_build_provider_make;
@ -49,6 +52,8 @@ EAPI Edi_Build_Provider *edi_build_provider_for_id_get(const char *id)
return &_edi_build_provider_python;
if (!strcmp("meson", id))
return &_edi_build_provider_meson;
if (!strcmp("go", id))
return &_edi_build_provider_go;
return NULL;
}

View File

@ -0,0 +1,109 @@
#ifdef HAVE_CONFIG
# include "config.h"
#endif
#include <unistd.h>
#include <Ecore.h>
#include <Ecore_File.h>
#include "Edi.h"
#include "edi_private.h"
static Eina_Bool
_go_project_supported(const char *path)
{
Eina_List *files, *l;
const char *name;
files = ecore_file_ls(path);
EINA_LIST_FOREACH(files, l, name)
{
if (strlen(name) < 4)
continue;
if (strstr(name, ".go"))
return EINA_TRUE;
}
return EINA_FALSE;
}
static Eina_Bool
_go_file_hidden_is(const char *file)
{
if (!file || strlen(file) == 0)
return EINA_FALSE;
if (!strcmp(ecore_file_file_get(file), "_obj") || !strcmp(ecore_file_file_get(file), "target") ||
eina_str_has_extension(file, ".so"))
return EINA_TRUE;
return EINA_FALSE;
}
static Eina_Bool
_go_project_runnable_is(const char *path EINA_UNUSED)
{
if (!path || !path[0])
return EINA_FALSE;
return EINA_TRUE;
}
static void
_go_build(void)
{
if (chdir(edi_project_get()) == 0)
edi_exe_notify("edi_build", "go build");
}
static void
_go_test(void)
{
if (chdir(edi_project_get()) == 0)
edi_exe_notify("edi_test", "go test -v ./...");
}
static void
_go_run(const char *path EINA_UNUSED, const char *args EINA_UNUSED)
{
char *full_cmd;
int full_len;
if (!path) return;
if (chdir(edi_project_get()) !=0)
ERR("Could not chdir");
full_len = strlen(path) + 8;
if (args)
full_len += strlen(args);
full_cmd = malloc(sizeof(char) * (full_len + 1));
snprintf(full_cmd, full_len + 1, "go run %s %s", path, args?args:"");
ecore_exe_pipe_run(full_cmd, ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR |
ECORE_EXE_PIPE_WRITE | ECORE_EXE_USE_SH, NULL);
free(full_cmd);
}
static void
_go_clean(void)
{
if (chdir(edi_project_get()) == 0)
edi_exe_notify("edi_clean", "go clean");
}
Edi_Build_Provider _edi_build_provider_go =
{
"go",
_go_project_supported,
_go_file_hidden_is,
_go_project_runnable_is,
_go_build,
_go_test,
_go_run,
_go_clean
};

View File

@ -150,9 +150,9 @@ _make_run(const char *path, const char *args)
return;
}
full_len = strlen(path) + strlen(path);
full_len = strlen(path) + strlen(args) + 1;
full_cmd = malloc(sizeof(char) * (full_len + 1));
snprintf(full_cmd, full_len + 2, "%s %s", path, args);
snprintf(full_cmd, full_len + 1, "%s %s", path, args);
ecore_exe_pipe_run(full_cmd, ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR |

View File

@ -54,6 +54,8 @@ _meson_configured_check(const char *dir)
static Eina_Bool
_meson_file_hidden_is(const char *file)
{
size_t k;
if (!file || strlen(file) == 0)
return EINA_FALSE;
@ -66,7 +68,7 @@ _meson_file_hidden_is(const char *file)
if (ecore_file_is_dir(file) && _meson_configured_check(file))
return EINA_TRUE;
for (size_t k = 0; k < EINA_C_ARRAY_LENGTH(hidden_exts); k++)
for (k = 0; k < EINA_C_ARRAY_LENGTH(hidden_exts); k++)
if (eina_str_has_extension(file, hidden_exts[k]))
return EINA_TRUE;

View File

@ -10,6 +10,8 @@
#include "edi_private.h"
#define EXAMPLES_GIT_URL "https://git.enlightenment.org/tools/examples.git"
typedef struct _Edi_Create
{
char *path, *temp, *name, *skelfile;
@ -21,6 +23,15 @@ typedef struct _Edi_Create
int filters;
} Edi_Create;
typedef struct _Edi_Create_Example
{
char *path, *name;
Edi_Create_Cb callback;
} Edi_Create_Example;
static Edi_Create *_edi_create_data;
static const char *
@ -183,6 +194,7 @@ _edi_create_filter_file_done(void *data, int type EINA_UNUSED, void *event EINA_
Edi_Create *create;
Ecore_Event_Handler *handler;
Eina_Strbuf *command;
char *escaped;
create = (Edi_Create *)data;
@ -199,15 +211,23 @@ _edi_create_filter_file_done(void *data, int type EINA_UNUSED, void *event EINA_
command = eina_strbuf_new();
eina_strbuf_append(command, "sh -c 'git init && git add .");
eina_strbuf_append(command, "sh -c \"git init && git add .");
if (create->user && strlen(create->user))
eina_strbuf_append_printf(command, " && git config user.name \"%s\"", create->user);
{
escaped = ecore_file_escape_name(create->user);
eina_strbuf_append_printf(command, " && git config user.name %s", escaped);
free(escaped);
}
if (create->email && strlen(create->email))
eina_strbuf_append_printf(command, " && git config user.email \"%s\"", create->email);
{
escaped = ecore_file_escape_name(create->email);
eina_strbuf_append_printf(command, " && git config user.email %s", escaped);
free(escaped);
}
eina_strbuf_append(command, " ' ");
eina_strbuf_append(command, " \" ");
ecore_exe_run(eina_strbuf_string_get(command), data);
@ -298,12 +318,12 @@ _edi_create_extract_done(void *data, int type EINA_UNUSED, void *event EINA_UNUS
}
EAPI void
edi_create_efl_project(const char *skelpath, const char *parentdir,
const char *name, const char *url, const char *user,
const char *email, Edi_Create_Cb func)
edi_create_project(const char *template_name, const char *parentdir,
const char *name, const char *url, const char *user,
const char *email, Edi_Create_Cb func)
{
char *cmd, *extract;
char tmp[PATH_MAX], dest[PATH_MAX];
char tmp[PATH_MAX], dest[PATH_MAX], skelpath[PATH_MAX];
Edi_Create *data;
Ecore_Event_Handler *handler;
@ -311,6 +331,8 @@ edi_create_efl_project(const char *skelpath, const char *parentdir,
snprintf(tmp, sizeof(tmp), "%s/edi_%s", eina_environment_tmp_get(), name);
snprintf(dest, sizeof(dest), "%s/%s", parentdir, name);
snprintf(skelpath, sizeof(skelpath), PACKAGE_DATA_DIR "/templates/%s.tar.gz", template_name);
INF("Creating project \"%s\" at path %s for %s<%s>\n", name, dest, user, email);
DBG("Extracting project files from %s\n", skelpath);
@ -343,3 +365,61 @@ edi_create_efl_project(const char *skelpath, const char *parentdir,
free(cmd);
}
static void
_edi_create_example_done_cb(void *data, Eio_File *file EINA_UNUSED)
{
Edi_Create_Example *create = data;
if (create->callback)
create->callback(create->path, EINA_TRUE);
}
static void
_edi_create_example_extract_dir(char *examples_path, Edi_Create_Example *create)
{
char path[PATH_MAX];
eina_file_path_join(path, sizeof(path), examples_path, create->name);
eio_dir_copy(path, create->path, NULL, NULL, _edi_create_example_done_cb,
_edi_create_error_cb, create);
free(examples_path);
}
EAPI void
edi_create_example(const char *example_name, const char *parentdir,
const char *name, Edi_Create_Cb func)
{
char dest[PATH_MAX], examplepath[PATH_MAX];
int status = 0;
Edi_Create_Example *data;
snprintf(dest, sizeof(dest), "%s/%s", parentdir, name);
snprintf(examplepath, sizeof(examplepath), "%s/%s/examples.git",
efreet_cache_home_get(), PACKAGE_NAME);
data = calloc(1, sizeof(Edi_Create_Example));
data->path = strdup(dest);
data->name = strdup(example_name);
data->callback = func;
INF("Extracting example project \"%s\" at path %s\n", example_name, dest);
if (ecore_file_exists(examplepath))
ERR("TODO: UPDATE NOT IMPLEMENTED");
// status = edi_scm_git_update(examplepath);
else
status = edi_scm_git_clone(EXAMPLES_GIT_URL, examplepath);
if (status)
{
ERR("git error: [%d]\n", status);
if (func)
func(dest, EINA_FALSE);
}
else
_edi_create_example_extract_dir(strdup(examplepath), data);
}

View File

@ -23,14 +23,23 @@ typedef void (*Edi_Create_Cb)(const char *path, Eina_Bool success);
*/
/**
* Create a new standard EFL project.
* Create a new project from an Edi template.
*
* @ingroup Creation
*/
EAPI void
edi_create_efl_project(const char *skelpath, const char *parentdir,
const char *name, const char *url, const char *user,
const char *email, Edi_Create_Cb func);
edi_create_project(const char *template_name, const char *parentdir,
const char *name, const char *url, const char *user,
const char *email, Edi_Create_Cb func);
/**
* Create a new project from an example.
*
* @ingroup Creation
*/
EAPI void
edi_create_example(const char *example_name, const char *parentdir,
const char *name, Edi_Create_Cb func);
/**
* @}

View File

@ -60,12 +60,26 @@ edi_exe_notify_handle(const char *name, void ((*func)(int, void *)), void *data)
static Eina_Bool
_edi_exe_notify_server_data_cb(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Edi_Exe_Args *args;
char *path;
Ecore_Con_Event_Server_Data *ev = event;
Edi_Exe_Args *args = data;
path = ecore_con_local_path_new(ECORE_CON_LOCAL_USER, ecore_con_server_name_get(ev->server), 0);
args = data;
ecore_event_handler_del(args->handler);
ecore_con_server_del(ev->server);
// FIXME: workaround.
if (path)
{
if (ecore_file_exists(path))
unlink(path);
free(path);
}
free(args);
return ECORE_CALLBACK_DONE;

View File

@ -1,6 +1,9 @@
#ifndef EDI_PRIVATE_H
# define EDI_PRIVATE_H
#include <Eina.h>
#include <Efreet.h>
extern int _edi_lib_log_dom;
char *edi_create_escape_quotes(const char *in);

View File

@ -27,7 +27,7 @@ _edi_scm_exec(const char *command)
oldpwd = getcwd(NULL, PATH_MAX);
chdir(self->workdir);
chdir(self->root_directory);
code = edi_exe_wait(command);
chdir(oldpwd);
@ -46,7 +46,7 @@ _edi_scm_exec_response(const char *command)
oldpwd = getcwd(NULL, PATH_MAX);
chdir(self->workdir);
chdir(self->root_directory);
response = edi_exe_response(command);
chdir(oldpwd);
@ -86,7 +86,7 @@ edi_scm_git_clone(const char *url, const char *dir)
}
static int
_edi_scm_git_file_add(const char *path)
_edi_scm_git_file_stage(const char *path)
{
int code;
Eina_Strbuf *command = eina_strbuf_new();
@ -100,6 +100,30 @@ _edi_scm_git_file_add(const char *path)
return code;
}
static int
_edi_scm_git_file_unstage(const char *path)
{
int code;
Eina_Strbuf *command = eina_strbuf_new();
eina_strbuf_append_printf(command, "git remote get-url origin");
code = _edi_scm_exec(eina_strbuf_string_get(command));
eina_strbuf_reset(command);
if (code == 0)
eina_strbuf_append_printf(command, "git reset HEAD %s", path);
else
eina_strbuf_append_printf(command, "git rm --cached %s", path);
code = _edi_scm_exec(eina_strbuf_string_get(command));
eina_strbuf_free(command);
return code;
}
static int
_edi_scm_git_file_mod(const char *path)
{
@ -217,7 +241,7 @@ _parse_line(char *line)
esc_path = ecore_file_escape_name(path);
status->path = eina_stringshare_add(esc_path);
fullpath = edi_path_append(edi_scm_engine_get()->workdir, esc_path);
fullpath = edi_path_append(edi_scm_engine_get()->root_directory, esc_path);
status->fullpath = eina_stringshare_add(fullpath);
status->unescaped = eina_stringshare_add(path);
@ -514,11 +538,7 @@ edi_scm_enabled(void)
EAPI Edi_Scm_Engine *
edi_scm_engine_get(void)
{
Edi_Scm_Engine *engine = _edi_scm_global_object;
if (!engine)
return NULL;
return engine;
return _edi_scm_global_object;
}
EAPI void
@ -529,17 +549,15 @@ edi_scm_shutdown()
if (!engine)
return;
eina_stringshare_del(engine->name);
eina_stringshare_del(engine->directory);
eina_stringshare_del(engine->path);
free(engine->workdir);
free(engine->root_directory);
free(engine);
_edi_scm_global_object = NULL;
}
EAPI int
edi_scm_add(const char *path)
edi_scm_stage(const char *path)
{
char *escaped;
int result;
@ -547,7 +565,7 @@ edi_scm_add(const char *path)
escaped = ecore_file_escape_name(path);
result = e->file_add(escaped);
result = e->file_stage(escaped);
free(escaped);
@ -570,6 +588,22 @@ edi_scm_del(const char *path)
return result;
}
EAPI int
edi_scm_unstage(const char *path)
{
char *escaped;
int result;
Edi_Scm_Engine *e = edi_scm_engine_get();
escaped = ecore_file_escape_name(path);
result = e->file_unstage(escaped);
free(escaped);
return result;
}
EAPI int
edi_scm_move(const char *src, const char *dest)
{
@ -711,8 +745,16 @@ edi_scm_push(void)
ecore_thread_run(_edi_scm_push_thread_cb, NULL, NULL, e);
}
EAPI const char *
edi_scm_root_directory_get(void)
{
Edi_Scm_Engine *e = edi_scm_engine_get();
return e->root_directory;
}
static Edi_Scm_Engine *
_edi_scm_git_init()
_edi_scm_git_init(const char *rootdir)
{
Edi_Scm_Engine *engine;
@ -720,11 +762,12 @@ _edi_scm_git_init()
return NULL;
_edi_scm_global_object = engine = calloc(1, sizeof(Edi_Scm_Engine));
engine->name = eina_stringshare_add("git");
engine->directory = eina_stringshare_add(".git");
engine->file_add = _edi_scm_git_file_add;
engine->name = "git";
engine->directory = ".git";
engine->file_stage = _edi_scm_git_file_stage;
engine->file_mod = _edi_scm_git_file_mod;
engine->file_del = _edi_scm_git_file_del;
engine->file_unstage = _edi_scm_git_file_unstage;
engine->move = _edi_scm_git_file_move;
engine->status = _edi_scm_git_status;
engine->diff = _edi_scm_git_diff;
@ -741,32 +784,70 @@ _edi_scm_git_init()
engine->credentials_set = _edi_scm_git_credentials_set;
engine->status_get = _edi_scm_git_status_get;
if (edi_project_get())
engine->workdir = strdup(edi_project_get());
else
engine->workdir = getcwd(NULL, PATH_MAX);
engine->root_directory = strdup(rootdir);
engine->initialized = EINA_TRUE;
return engine;
}
EAPI Edi_Scm_Engine *
edi_scm_generic_init(void)
static char *
_edi_scm_root_find(const char *dir, const char *scmdir)
{
if (!edi_exe_wait("git status"))
return _edi_scm_git_init();
char *directory, *engine_root, *path, *tmp;
return NULL;
engine_root = NULL;
directory = strdup(dir);
while (directory && strlen(directory) > 1)
{
path = edi_path_append(directory, scmdir);
if (ecore_file_exists(path) && ecore_file_is_dir(path))
{
engine_root = strdup(directory);
free(directory);
free(path);
break;
}
tmp = ecore_file_dir_get(directory);
free(directory);
directory = tmp;
free(path);
}
return engine_root;
}
EAPI Edi_Scm_Engine *
edi_scm_init_path(const char *path)
{
char *location;
Edi_Scm_Engine *engine;
engine = NULL;
location = _edi_scm_root_find(path, ".git");
if (location)
{
engine = _edi_scm_git_init(location);
free(location);
}
return engine;
}
EAPI Edi_Scm_Engine *
edi_scm_init(void)
{
if (edi_project_file_exists(".git"))
return _edi_scm_git_init();
char *cwd;
Edi_Scm_Engine *engine;
return NULL;
if (edi_project_get())
return edi_scm_init_path(edi_project_get());
cwd = getcwd(NULL, PATH_MAX);
engine = edi_scm_init_path(cwd);
free(cwd);
return engine;
}
EAPI const char *

View File

@ -33,7 +33,8 @@ typedef struct _Edi_Scm_Status
Eina_Bool staged;
} Edi_Scm_Status;
typedef int (scm_fn_add)(const char *path);
typedef int (scm_fn_stage)(const char *path);
typedef int (scm_fn_unstage)(const char *path);
typedef int (scm_fn_mod)(const char *path);
typedef int (scm_fn_del)(const char *path);
typedef int (scm_fn_move)(const char *src, const char *dest);
@ -57,10 +58,11 @@ typedef struct _Edi_Scm_Engine
const char *name;
const char *directory;
const char *path;
char *workdir;
char *root_directory;
Eina_List *statuses;
scm_fn_add *file_add;
scm_fn_stage *file_stage;
scm_fn_unstage *file_unstage;
scm_fn_mod *file_mod;
scm_fn_del *file_del;
scm_fn_move *move;
@ -99,11 +101,13 @@ typedef struct _Edi_Scm_Engine
Edi_Scm_Engine *edi_scm_init();
/**
* Init the SCM system.
* Init the SCM system for the specified path.
*
* @param path The location to find the scm information.
*
* @ingroup Scm
*/
EAPI Edi_Scm_Engine *edi_scm_generic_init(void);
EAPI Edi_Scm_Engine *edi_scm_init_path(const char *path);
/**
* Shutdown and free memory in use by SCM system.
@ -142,14 +146,24 @@ EAPI int edi_scm_git_clone(const char *url, const char *dir);
Edi_Scm_Engine *edi_scm_engine_get(void);
/**
* Add file to be monitored by SCM.
* Stage file for commit with SCM.
*
* @param path The file path.
* @return The status code of command executed.
*
* @ingroup Scm
*/
int edi_scm_add(const char *path);
int edi_scm_stage(const char *path);
/**
* Unstage file from commit.
*
* @param path The file path.
* @return The status code of command executed.
*
* @ingroup Scm
*/
int edi_scm_unstage(const char *path);
/**
* Del file from those monitored by SCM.
@ -285,6 +299,16 @@ Eina_Bool edi_scm_remote_enabled(void);
*/
const char *edi_scm_avatar_url_get(const char *email);
/**
* Return the root directory of the SCM.
*
* @return The location of the SCM's root working directory.
*
* @ingroup Scm
*/
const char *edi_scm_root_directory_get(void);
/**
* @}
*/

View File

@ -8,6 +8,7 @@ src = files([
'edi_build_provider_make.c',
'edi_build_provider_meson.c',
'edi_build_provider_python.c',
'edi_build_provider_go.c',
'edi_builder.c',
'edi_builder.h',
'edi_create.c',