Merge branch 'release/v0.7.0'

This commit is contained in:
Andy Williams 2018-09-13 22:17:12 +01:00
commit 51f46305ba
42 changed files with 1787 additions and 312 deletions

16
NEWS
View File

@ -1,3 +1,19 @@
=======
Edi 0.7
=======
Features:
* Added theme support and new themes.
* Added editor translucency option.
* Added option to show hidden files
Bug fixes:
* Fix issues where panels would change size or not fully shrink
* Improvements to the UI and flow
* General stability fixes with Edi and Edi SCM
---------
Edi 0.6.1
---------

View File

@ -5,7 +5,7 @@ collections {
data {
item: "title" "C EFL Beta Hello World";
item: "path" "tutorials/c/hellogui/";
item: "path" "tutorial/c/hello-gui/";
item: "description"
"Hello World using the EFL Beta APIs";
}

View File

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

23
data/themes/meson.build Normal file
View File

@ -0,0 +1,23 @@
edje_cc = find_program('edje_cc')
cmd = [ edje_cc,
'-id', join_paths(meson.source_root(), 'data' , 'themes'),
'@INPUT@', '@OUTPUT@'
]
theme_names = ['white', 'solarized', 'solarized_dark']
foreach theme_name : theme_names
custom_target('theme ' + theme_name,
input : theme_name + '.edc',
output : theme_name + '.edj',
command: cmd,
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'themes'),
install: true,
)
out = join_paths(get_option('prefix'), get_option('datadir'), 'edi', 'themes', theme_name + '.edj')
meson.add_install_script('../../scripts/world_read.sh', out)
endforeach

64
data/themes/solarized.edc Normal file
View File

@ -0,0 +1,64 @@
data {
item: "title" "Solarized";
}
collections {
/* simple layout to pack our scrolling content into an elm_layout */
group { name: "elm/code/layout/default";
data {
item: "font.name" "Mono";
item: "font.size" "10";
}
parts {
part { name: "elm.swallow.content"; type: SWALLOW;
description { state: "default" 0.0;
align: 0.5 0.0;
fixed: 0 1;
rel2 {
relative: 1.0 1.0;
offset: 0 0;
}
}
}
}
}
color_classes {
color_class { name: "elm/code/status/default"; color: 253 246 227 255; }
color_class { name: "elm/code/status/current"; color: 238 232 213 255; }
color_class { name: "elm/code/status/ignored"; color: 36 36 36 255; }
color_class { name: "elm/code/status/note"; color: 221 119 17 255; }
color_class { name: "elm/code/status/warning"; color: 221 119 17 255; }
color_class { name: "elm/code/status/error"; color: 204 17 17 255; }
color_class { name: "elm/code/status/fatal"; color: 204 17 17 255; }
color_class { name: "elm/code/status/added"; color: 36 96 36 255; }
color_class { name: "elm/code/status/removed"; color: 96 36 36 255; }
color_class { name: "elm/code/status/changed"; color: 36 36 96 255; }
color_class { name: "elm/code/status/passed"; color: 54 96 54 255; }
color_class { name: "elm/code/status/failed"; color: 96 54 54 255; }
color_class { name: "elm/code/status/todo"; color: 211 54 130 255; }
color_class { name: "elm/code/token/default"; color: 88 110 117 255; }
color_class { name: "elm/code/token/comment"; color: 147 161 161 255; }
color_class { name: "elm/code/token/string"; color: 42 161 152 255; }
color_class { name: "elm/code/token/number"; color: 42 161 152 255; }
color_class { name: "elm/code/token/brace"; color: 101 123 131 255; }
color_class { name: "elm/code/token/type"; color: 181 137 0 255; }
color_class { name: "elm/code/token/class"; color: 255 255 255 255; }
color_class { name: "elm/code/token/function"; color: 255 255 255 255; }
color_class { name: "elm/code/token/param"; color: 133 153 0 255; }
color_class { name: "elm/code/token/keyword"; color: 133 153 0 255; }
color_class { name: "elm/code/token/preprocessor"; color: 203 75 22 255; }
color_class { name: "elm/code/token/added"; color: 54 255 54 255; }
color_class { name: "elm/code/token/removed"; color: 255 54 54 255; }
color_class { name: "elm/code/token/changed"; color: 54 54 255 255; }
color_class { name: "elm/code/token/match"; color: 187 187 51 255; }
color_class { name: "elm/code/widget/color/selection"; color: 133 153 0 255; }
color_class { name: "elm/code/widget/color/gutter/bg"; color: 238 232 213 255; }
color_class { name: "elm/code/widget/color/gutter/fg"; color: 147 161 161 255; }
color_class { name: "elm/code/widget/color/gutter/scope/bg"; color: 54 54 54 255; }
color_class { name: "elm/code/widget/color/whitespace"; color: 50 50 50 127; }
}
}

View File

@ -0,0 +1,65 @@
data {
item: "title" "Solarized Dark";
}
collections {
/* simple layout to pack our scrolling content into an elm_layout */
group { name: "elm/code/layout/default";
data {
item: "font.name" "Mono";
item: "font.size" "10";
}
parts {
part { name: "elm.swallow.content"; type: SWALLOW;
description { state: "default" 0.0;
align: 0.5 0.0;
fixed: 0 1;
rel2 {
relative: 1.0 1.0;
offset: 0 0;
}
}
}
}
}
color_classes {
color_class { name: "elm/code/status/default"; color: 0 43 54 255; }
color_class { name: "elm/code/status/current"; color: 7 54 66 255; }
color_class { name: "elm/code/status/ignored"; color: 36 36 36 255; }
color_class { name: "elm/code/status/note"; color: 221 119 17 255; }
color_class { name: "elm/code/status/warning"; color: 221 119 17 255; }
color_class { name: "elm/code/status/error"; color: 204 17 17 255; }
color_class { name: "elm/code/status/fatal"; color: 204 17 17 255; }
color_class { name: "elm/code/status/added"; color: 36 96 36 255; }
color_class { name: "elm/code/status/removed"; color: 96 36 36 255; }
color_class { name: "elm/code/status/changed"; color: 36 36 96 255; }
color_class { name: "elm/code/status/passed"; color: 54 96 54 255; }
color_class { name: "elm/code/status/failed"; color: 96 54 54 255; }
color_class { name: "elm/code/status/todo"; color: 211 54 130 255; }
color_class { name: "elm/code/token/default"; color: 147 161 161 255; }
color_class { name: "elm/code/token/comment"; color: 88 110 117 255; }
color_class { name: "elm/code/token/string"; color: 42 161 152 255; }
color_class { name: "elm/code/token/number"; color: 42 161 152 255; }
color_class { name: "elm/code/token/brace"; color: 131 148 150 255; }
color_class { name: "elm/code/token/type"; color: 181 137 0 255; }
color_class { name: "elm/code/token/class"; color: 255 255 255 255; }
color_class { name: "elm/code/token/function"; color: 255 255 255 255; }
color_class { name: "elm/code/token/param"; color: 181 137 0 255; }
color_class { name: "elm/code/token/keyword"; color: 181 137 0 255; }
color_class { name: "elm/code/token/preprocessor"; color: 203 75 22 255; }
color_class { name: "elm/code/token/added"; color: 54 255 54 255; }
color_class { name: "elm/code/token/removed"; color: 255 54 54 255; }
color_class { name: "elm/code/token/changed"; color: 54 54 255 255; }
color_class { name: "elm/code/token/match"; color: 187 187 51 255; }
color_class { name: "elm/code/widget/color/selection"; color: 38 139 210 255; }
color_class { name: "elm/code/widget/color/gutter/bg"; color: 7 54 66 255; }
color_class { name: "elm/code/widget/color/gutter/fg"; color: 88 110 117 255; }
color_class { name: "elm/code/widget/color/gutter/scope/bg"; color: 54 54 54 255; }
color_class { name: "elm/code/widget/color/whitespace"; color: 50 50 50 127; }
}
}

64
data/themes/white.edc Normal file
View File

@ -0,0 +1,64 @@
data {
item: "title" "Black on White";
}
collections {
/* simple layout to pack our scrolling content into an elm_layout */
group { name: "elm/code/layout/default";
data {
item: "font.name" "Mono";
item: "font.size" "10";
}
parts {
part { name: "elm.swallow.content"; type: SWALLOW;
description { state: "default" 0.0;
align: 0.5 0.0;
fixed: 0 1;
rel2 {
relative: 1.0 1.0;
offset: 0 0;
}
}
}
}
}
color_classes {
color_class { name: "elm/code/status/default"; color: 255 255 255 255; }
color_class { name: "elm/code/status/current"; color: 211 211 211 255; }
color_class { name: "elm/code/status/ignored"; color: 0 0 0 255; }
color_class { name: "elm/code/status/note"; color: 0 0 0 255; }
color_class { name: "elm/code/status/warning"; color: 0 0 0 255; }
color_class { name: "elm/code/status/error"; color: 0 0 0 255; }
color_class { name: "elm/code/status/fatal"; color: 0 0 0 255; }
color_class { name: "elm/code/status/added"; color: 0 0 0 255; }
color_class { name: "elm/code/status/removed"; color: 0 0 0 255; }
color_class { name: "elm/code/status/changed"; color: 0 0 0 255; }
color_class { name: "elm/code/status/passed"; color: 0 0 0 255; }
color_class { name: "elm/code/status/failed"; color: 0 0 0 255; }
color_class { name: "elm/code/status/todo"; color: 0 0 0 255; }
color_class { name: "elm/code/token/default"; color: 0 0 0 255; }
color_class { name: "elm/code/token/comment"; color: 0 0 0 255; }
color_class { name: "elm/code/token/string"; color: 0 0 0 255; }
color_class { name: "elm/code/token/number"; color: 0 0 0 255; }
color_class { name: "elm/code/token/brace"; color: 0 0 0 255; }
color_class { name: "elm/code/token/type"; color: 0 0 0 255; }
color_class { name: "elm/code/token/class"; color: 0 0 0 255; }
color_class { name: "elm/code/token/function"; color: 0 0 0 255; }
color_class { name: "elm/code/token/param"; color: 0 0 0 255; }
color_class { name: "elm/code/token/keyword"; color: 0 0 0 255; }
color_class { name: "elm/code/token/preprocessor"; color: 0 0 0 255; }
color_class { name: "elm/code/token/added"; color: 0 0 0 255; }
color_class { name: "elm/code/token/removed"; color: 0 0 0 255; }
color_class { name: "elm/code/token/changed"; color: 0 0 0 255; }
color_class { name: "elm/code/token/match"; color: 0 0 0 255; }
color_class { name: "elm/code/widget/color/selection"; color: 169 169 169 255; }
color_class { name: "elm/code/widget/color/gutter/bg"; color: 211 211 211 255; }
color_class { name: "elm/code/widget/color/gutter/fg"; color: 21 21 21 255; }
color_class { name: "elm/code/widget/color/gutter/scope/bg"; color: 255 255 255 255; }
color_class { name: "elm/code/widget/color/whitespace"; color: 255 255 255 255; }
}
}

View File

@ -1,6 +1,6 @@
project(
'edi', 'c',
version : '0.6.1',
version : '0.7.0',
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', version : '>=1.20.7')
elm = dependency('elementary', version : '>=1.21.1')
top_inc = include_directories('.')
cc = meson.get_compiler('c')

View File

@ -1,4 +1,4 @@
option('libclang', type : 'boolean', value : true, description : 'Weather to have libclang support')
option('bear', type : 'boolean', value : true, description : 'Weather to have bear support')
option('libclang', type : 'boolean', value : true, description : 'Whether to have libclang support for autocomplete and inline errors')
option('bear', type : 'boolean', value : true, description : 'Whether to enable build command caching with bear')
option('libclang-libdir', type : 'string', value : '', description : 'Specify a none default location for your clang installation')
option('libclang-headerdir', type : 'string', value : '', description : 'Specify a none default location for your clang installation')

View File

@ -1,13 +1,13 @@
# Maintainer: Enlightenment Developers <enlightenment-devel@enlightenment.org>
pkgname='edi-git'
pkgver=0.6.99.0001
pkgver=0.7.0.0001
pkgrel=1
pkgdesc="Efl based IDE - GIT development snapshot"
arch=('i686' 'x86_64' 'arm')
url="https://www.enlightenment.org/about-edi"
license=('GPLv2')
makedepends=('git' 'meson')
depends=('efl-git' 'clang' 'check')
depends=('efl' 'clang' 'check')
options=('!libtool' 'debug' '!strip')
provides=('edi')
source=("edi-git::git+https://github.com/Enlightenment/edi.git#branch=develop")

View File

@ -242,6 +242,7 @@ _edi_config_init(void)
EDI_CONFIG_VAL(D, T, version, EET_T_INT);
EDI_CONFIG_VAL(D, T, autosave, EET_T_UCHAR);
EDI_CONFIG_VAL(D, T, trim_whitespace, EET_T_UCHAR);
EDI_CONFIG_VAL(D, T, show_hidden, EET_T_UCHAR);
EDI_CONFIG_LIST(D, T, projects, _edi_cfg_proj_edd);
EDI_CONFIG_LIST(D, T, mime_assocs, _edi_cfg_mime_edd);
@ -361,6 +362,7 @@ _edi_config_load(void)
_edi_config->autosave = EINA_TRUE;
_edi_config->trim_whitespace = EINA_TRUE;
_edi_config->show_hidden = EINA_FALSE;
_edi_config->projects = NULL;
_edi_config->mime_assocs = NULL;
IFCFGEND;

View File

@ -41,6 +41,7 @@ struct _Edi_Config
Eina_Bool autosave;
Eina_Bool trim_whitespace;
Eina_Bool show_hidden;
Eina_List *projects;
Eina_List *mime_assocs;

View File

@ -16,6 +16,7 @@
#include "edi_consolepanel.h"
#include "mainview/edi_mainview.h"
#include "edi_theme.h"
#include "edi_config.h"
#include "edi_private.h"
@ -349,11 +350,15 @@ _edi_consolepanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, v
EINA_LIST_FOREACH(_edi_console_code->widgets, item, widget)
{
elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
edi_theme_elm_code_alpha_set(widget);
}
EINA_LIST_FOREACH(_edi_test_code->widgets, item, widget)
{
elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
edi_theme_elm_code_alpha_set(widget);
}
return ECORE_CALLBACK_RENEW;
@ -361,14 +366,22 @@ _edi_consolepanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, v
void edi_consolepanel_add(Evas_Object *parent)
{
Evas_Object *frame;
Elm_Code *code;
Elm_Code_Widget *widget;
code = elm_code_create();
_edi_console_code = code;
frame = elm_frame_add(parent);
elm_object_text_set(frame, _("Console"));
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);
widget = elm_code_widget_add(parent, code);
elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
elm_obj_code_widget_gravity_set(widget, 0.0, 1.0);
efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_consolepanel_line_cb, NULL);
efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _edi_consolepanel_clicked_cb, code);
@ -377,7 +390,8 @@ void edi_consolepanel_add(Evas_Object *parent)
evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(widget);
elm_box_pack_end(parent, widget);
elm_object_content_set(frame, widget);
elm_box_pack_end(parent, frame);
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _exe_data, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _exe_error, NULL);
@ -387,14 +401,22 @@ void edi_consolepanel_add(Evas_Object *parent)
void edi_testpanel_add(Evas_Object *parent)
{
Evas_Object *frame;
Elm_Code *code;
Elm_Code_Widget *widget;
code = elm_code_create();
_edi_test_code = code;
frame = elm_frame_add(parent);
elm_object_text_set(frame, _("Tests"));
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);
widget = elm_code_widget_add(parent, code);
elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
elm_obj_code_widget_gravity_set(widget, 0.0, 1.0);
efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_testpanel_line_cb, NULL);
efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _edi_consolepanel_clicked_cb, code);
@ -403,6 +425,7 @@ void edi_testpanel_add(Evas_Object *parent)
evas_object_size_hint_align_set(widget, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(widget);
elm_box_pack_end(parent, widget);
elm_object_content_set(frame, widget);
elm_box_pack_end(parent, frame);
}

195
src/bin/edi_content.c Normal file
View File

@ -0,0 +1,195 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "language/edi_language_provider.h"
#include "editor/edi_editor.h"
#include "edi_content.h"
#include "mainview/edi_mainview.h"
#include "edi_config.h"
#include "edi_private.h"
static Eina_Bool
_edi_content_diff_config_changed(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Evas_Object *diff;
diff = (Evas_Object*) data;
elm_code_diff_widget_font_set(diff, _edi_project_config->font.name, _edi_project_config->font.size);
return ECORE_CALLBACK_RENEW;
}
Evas_Object *
edi_content_diff_add(Evas_Object *parent, Edi_Mainview_Item *item)
{
Elm_Code *code;
Evas_Object *diff;
code = elm_code_create();
elm_code_file_open(code, item->path);
diff = elm_code_diff_widget_add(parent, code);
elm_code_diff_widget_font_set(diff, _edi_project_config->font.name, _edi_project_config->font.size);
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_content_diff_config_changed, diff);
return diff;
}
Evas_Object *
edi_content_image_add(Evas_Object *parent, Edi_Mainview_Item *item)
{
Evas_Object *vbox, *box, *searchbar, *statusbar, *scroll, *img;
vbox = elm_box_add(parent);
evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(vbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(vbox);
searchbar = elm_box_add(vbox);
evas_object_size_hint_weight_set(searchbar, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(searchbar, EVAS_HINT_FILL, 0.0);
elm_box_pack_end(vbox, searchbar);
box = elm_box_add(vbox);
elm_box_horizontal_set(box, EINA_TRUE);
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_box_pack_end(vbox, box);
evas_object_show(box);
statusbar = elm_box_add(vbox);
evas_object_size_hint_weight_set(statusbar, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(statusbar, EVAS_HINT_FILL, 0.0);
elm_box_pack_end(vbox, statusbar);
evas_object_show(statusbar);
scroll = elm_scroller_add(parent);
evas_object_size_hint_weight_set(scroll, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(scroll, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(scroll);
img = elm_image_add(vbox);
elm_image_file_set(img, item->path, NULL);
elm_image_no_scale_set(img, EINA_TRUE);
elm_object_content_set(scroll, img);
evas_object_show(img);
elm_box_pack_end(box, scroll);
edi_content_statusbar_add(statusbar, item);
edi_content_statusbar_position_set(item->pos, 0, 0);
return vbox;
}
void
edi_content_statusbar_position_set(Evas_Object *position, unsigned int line, unsigned int pos)
{
char buf[64];
char text[128];
int i;
if (!position) return;
if (line && pos)
{
snprintf(buf, sizeof(buf), _("Line: %d, Position: %d"), line, pos);
}
else
{
buf[0] = 0x00;
}
text[0] = 0x00;
for (i = strlen(buf); i < 24; i++)
{
strcat(text, " ");
}
strcat(text, buf);
elm_object_text_set(position, text);
}
void
edi_content_statusbar_add(Evas_Object *panel, Edi_Mainview_Item *item)
{
Edi_Language_Provider *provider;
Evas_Object *table, *rect, *tb, *position, *mime;
Elm_Code *code;
char text[256];
const char *format = "", *spaces = " ";
const char *mimename = NULL;
elm_box_horizontal_set(panel, EINA_TRUE);
table = elm_table_add(panel);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(table);
elm_box_pack_end(panel, table);
if (!strcmp(item->editortype, "code"))
{
code = elm_code_create();
code->file = elm_code_file_open(code, item->path);
if (elm_code_file_line_ending_get(code->file) == ELM_CODE_FILE_LINE_ENDING_WINDOWS)
format = "WIN";
else
format = "UNIX";
elm_code_free(code);
}
mime = elm_entry_add(panel);
elm_entry_editable_set(mime, EINA_FALSE);
elm_entry_scrollable_set(mime, EINA_FALSE);
elm_entry_single_line_set(mime, EINA_TRUE);
if (item->mimetype)
{
provider = edi_language_provider_for_mime_get(item->mimetype);
if (provider)
mimename = provider->mime_name(item->mimetype);
if (mimename)
snprintf(text, sizeof(text), "%s (%s)%s%s", mimename, item->mimetype, spaces, format);
else
snprintf(text, sizeof(text), "%s%s%s", item->mimetype, spaces, format);
}
else
{
snprintf(text, sizeof(text), "%s%s%s", item->editortype, spaces, format);
}
elm_object_text_set(mime, text);
rect = evas_object_rectangle_add(panel);
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_move(rect, 0, 0);
evas_object_resize(rect, 220, 1);
evas_object_color_set(rect, 0, 0, 0, 0);
evas_object_show(rect);
tb = elm_entry_textblock_get(mime);
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_resize(tb, 220, 1);
evas_object_show(tb);
elm_table_pack(table, tb, 0, 0, 1, 1);
elm_table_pack(table, rect, 0, 0, 1, 1);
item->pos = position = elm_entry_add(panel);
elm_entry_single_line_set(position, EINA_TRUE);
elm_entry_text_style_user_push(position, "DEFAULT='font=Mono')");
elm_entry_editable_set(position, EINA_FALSE);
evas_object_size_hint_align_set(position, 1.0, 0.5);
evas_object_size_hint_weight_set(position, EVAS_HINT_EXPAND, 0.0);
elm_table_pack(table, position, 1, 0, 1, 1);
evas_object_show(position);
}

79
src/bin/edi_content.h Normal file
View File

@ -0,0 +1,79 @@
#ifndef EDI_CONTENT_H_
# define EDI_CONTENT_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "editor/edi_editor.h"
#include "mainview/edi_mainview_item.h"
/**
* @file
* @brief These routines are used for managing various content.
*/
/**
* @brief Managing the creation of alternative content within EDI.
* @defgroup Content
*
* @{
*
* Adding alternative editor types, for example images or diff widgets.
*
*/
/**
* Create an object for displaying image content.
*
* @param parent the panel into which the image widget will be loaded.
* @param item the item describing the image file to be loaded in the canvas.
*
* @return an Evas_Object containing the image.
*
* @ingroup Content
*/
Evas_Object *edi_content_image_add(Evas_Object *parent, Edi_Mainview_Item *item);
/**
* Create an object for diff content.
*
* @param parent the panel into which the diff widget will be loaded.
* @param item the item describing the diff file to be loaded.
*
* @return an Evas_Object containing diff widget.
*
* @ingroup Content
*/
Evas_Object *edi_content_diff_add(Evas_Object *parent, Edi_Mainview_Item *item);
/**
* Add a statusbar to the panel for displaying statistics about loaded content.
*
* @param panel the panel in which the content resides and into which the statusbar is shown.
* @param item the item containing information about the file's content.
*
* @ingroup Content
*/
void edi_content_statusbar_add(Evas_Object *panel, Edi_Mainview_Item *item);
/**
* Set the statusbar line information.
*
* @param position the object to render the statistics within the statusbar.
* @param line the line number to displsy.
* @param col the column position to display.
*
* @ingroup Content
*/
void edi_content_statusbar_position_set(Evas_Object *position, unsigned int line, unsigned int col);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* EDI_CONTENT_H_ */

View File

@ -2,9 +2,7 @@
# include "config.h"
#endif
#include <Evas.h>
#include <Elementary.h>
#include "edi_content.h"
#include "edi_content_provider.h"
#include "editor/edi_editor.h"
@ -14,59 +12,12 @@
#include "edi_private.h"
// TODO move out to edi_content.c or similar just like the editor type
// (and the Evas include)
static Evas_Object *
_edi_content_provider_image_add(Evas_Object *parent, Edi_Mainview_Item *item)
{
Evas_Object *img, *scroll;
scroll = elm_scroller_add(parent);
evas_object_size_hint_weight_set(scroll, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(scroll, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(scroll);
img = elm_image_add(scroll);
elm_image_file_set(img, item->path, NULL);
elm_image_no_scale_set(img, EINA_TRUE);
elm_object_content_set(scroll, img);
evas_object_show(img);
return scroll;
}
static Eina_Bool
_edi_content_provider_diff_config_changed(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
{
Evas_Object *diff;
diff = (Evas_Object*) data;
elm_code_diff_widget_font_set(diff, _edi_project_config->font.name, _edi_project_config->font.size);
return ECORE_CALLBACK_RENEW;
}
static Evas_Object *
_edi_content_provider_diff_add(Evas_Object *parent, Edi_Mainview_Item *item)
{
Elm_Code *code;
Evas_Object *diff;
code = elm_code_create();
elm_code_file_open(code, item->path);
diff = elm_code_diff_widget_add(parent, code);
elm_code_diff_widget_font_set(diff, _edi_project_config->font.name, _edi_project_config->font.size);
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_content_provider_diff_config_changed, diff);
return diff;
}
static Edi_Content_Provider _edi_content_provider_registry[] =
{
{"text", "text-x-generic", EINA_TRUE, EINA_TRUE, edi_editor_add},
{"code", "text-x-csrc", EINA_TRUE, EINA_TRUE, edi_editor_add},
{"image", "image-x-generic", EINA_FALSE, EINA_FALSE, _edi_content_provider_image_add},
{"diff", "text-x-source", EINA_TRUE, EINA_FALSE, _edi_content_provider_diff_add},
{"image", "image-x-generic", EINA_FALSE, EINA_FALSE, edi_content_image_add},
{"diff", "text-x-source", EINA_TRUE, EINA_FALSE, edi_content_diff_add},
{NULL, NULL, EINA_FALSE, EINA_FALSE, NULL}
};

View File

@ -7,6 +7,7 @@
#include <Elementary.h>
#include "edi_debug.h"
#include "edi_theme.h"
#include "edi_debugpanel.h"
#include "edi_config.h"
@ -36,6 +37,8 @@ static Eina_Bool
_edi_debugpanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme);
edi_theme_elm_code_alpha_set(_info_widget);
return ECORE_CALLBACK_RENEW;
}
@ -209,6 +212,7 @@ _edi_debug_active_check_cb(void *data EINA_UNUSED)
elm_object_disabled_set(_button_start, EINA_FALSE);
elm_object_disabled_set(_button_int, EINA_TRUE);
elm_object_disabled_set(_button_term, EINA_TRUE);
return ECORE_CALLBACK_RENEW;
}
if (!debug)
@ -313,16 +317,26 @@ void edi_debugpanel_start(const char *name)
void edi_debugpanel_add(Evas_Object *parent)
{
Evas_Object *table, *entry, *bt_term, *bt_int, *bt_start, *bt_quit;
Evas_Object *table, *frame, *box, *entry, *bt_term, *bt_int, *bt_start, *bt_quit;
Evas_Object *separator;
Evas_Object *ico_start, *ico_quit, *ico_int, *ico_term;
Elm_Code_Widget *widget;
Elm_Code *code;
Ecore_Timer *timer;
frame = elm_frame_add(parent);
elm_object_text_set(frame, _("Debug"));
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);
box = elm_box_add(parent);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
code = elm_code_create();
widget = elm_code_widget_add(parent, code);
elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme);
elm_obj_code_widget_gravity_set(widget, 0.0, 1.0);
efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_debugpanel_line_cb, NULL);
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -398,8 +412,13 @@ void edi_debugpanel_add(Evas_Object *parent)
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);
elm_box_pack_end(box, widget);
elm_box_pack_end(box, table);
evas_object_show(box);
elm_object_content_set(frame, box);
evas_object_show(frame);
elm_box_pack_end(parent, frame);
ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _debugpanel_stdout_handler, NULL);
ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _debugpanel_stdout_handler, NULL);

View File

@ -14,6 +14,7 @@
#include "edi_filepanel.h"
#include "edi_file.h"
#include "edi_config.h"
#include "edi_content_provider.h"
#include "mainview/edi_mainview.h"
#include "screens/edi_file_screens.h"
@ -47,6 +48,9 @@ _file_path_hidden(const char *path, Eina_Bool filter)
{
const char *relative;
if (_edi_config->show_hidden)
return EINA_FALSE;
if (edi_file_path_hidden(path))
return EINA_TRUE;
@ -783,6 +787,9 @@ static Eina_Bool
_ls_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED,
const Eina_File_Direct_Info *info)
{
if (_edi_config->show_hidden)
return EINA_TRUE;
return info->path[info->name_start] != '.';
}
@ -983,7 +990,7 @@ _file_listing_fill(Edi_Dir_Data *dir, Elm_Object_Item *parent_it)
_ls_done_cb, _ls_error_cb, lreq);
}
static void
static Eina_Bool
_file_listing_updated(void *data EINA_UNUSED, int type EINA_UNUSED,
void *event EINA_UNUSED)
{
@ -995,7 +1002,7 @@ _file_listing_updated(void *data EINA_UNUSED, int type EINA_UNUSED,
if (strncmp(edi_project_get(), dir, strlen(edi_project_get())) ||
ev->filename[strlen(edi_project_get()) + 1] == '.' ||
_file_path_hidden(ev->filename, EINA_FALSE))
return;
return EINA_TRUE;
parent_it = _file_listing_item_find(dir);
@ -1010,10 +1017,12 @@ _file_listing_updated(void *data EINA_UNUSED, int type EINA_UNUSED,
else
DBG("Ignoring file update event for %s", ev->filename);
if (ecore_file_file_get(ev->filename)[0] == '.') return;
if (ecore_file_file_get(ev->filename)[0] == '.') return EINA_TRUE;
edi_filepanel_scm_status_update();
edi_filepanel_item_update(ev->filename);
return EINA_TRUE;
}
/* Panel filtering */
@ -1067,21 +1076,50 @@ _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)
static void
_edi_filepanel_select_next_best_path(const char *path)
{
Edi_Mainview_Panel *current;
Edi_Mainview_Item *item;
Elm_Object_Item *item;
char *end, *try = strdup(path);
current = edi_mainview_panel_current_get();
if (!current) return ECORE_CALLBACK_RENEW;
while (1)
{
if (!strcmp(try, edi_project_get()))
break;
item = edi_mainview_item_current_get(current);
if (!item) return ECORE_CALLBACK_RENEW;
end = strrchr(try, '/');
if (!end)
break;
else
*end = '\0';
edi_filepanel_select_path(item->path);
item = _file_listing_item_find(try);
if (item)
{
elm_genlist_item_selected_set(item, EINA_TRUE);
elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
break;
}
}
return ECORE_CALLBACK_RENEW;
free(try);
}
void
edi_filepanel_refresh_all(void)
{
elm_genlist_clear(_list);
eina_hash_free_buckets(_list_items);
eina_hash_free_buckets(_list_statuses);
_file_listing_empty(_root_dir, NULL);
free(_root_dir);
_root_dir = calloc(1, sizeof(Edi_Dir_Data));
_root_dir->path = edi_project_get();
_file_listing_fill(_root_dir, NULL);
elm_genlist_realized_items_update(_list);
}
void
@ -1091,12 +1129,16 @@ edi_filepanel_select_path(const char *path)
item = _file_listing_item_find(path);
if (!item)
return;
{
_edi_filepanel_select_next_best_path(path);
return;
}
if (elm_genlist_item_selected_get(item))
return;
elm_genlist_item_selected_set(item, EINA_TRUE);
elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
}
void
@ -1168,7 +1210,6 @@ edi_filepanel_add(Evas_Object *parent, Evas_Object *win,
elm_genlist_homogeneous_set(list, EINA_TRUE);
elm_genlist_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);
elm_genlist_filter_set(list, "");
evas_object_size_hint_min_set(list, 100, -1);
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);
@ -1210,8 +1251,6 @@ 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

@ -95,6 +95,12 @@ void edi_filepanel_item_update(const char *path);
*/
void edi_filepanel_item_update_all(void);
/**
* Clear all filepanel items and do a full refresh.
*
* @ingroup UI
*/
void edi_filepanel_refresh_all(void);
/**
* @}
*/

View File

@ -7,6 +7,7 @@
#include <Elementary.h>
#include "edi_logpanel.h"
#include "edi_theme.h"
#include "edi_config.h"
#include "edi_private.h"
@ -72,17 +73,27 @@ static Eina_Bool
_edi_logpanel_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme);
edi_theme_elm_code_alpha_set(_info_widget);
return ECORE_CALLBACK_RENEW;
}
void edi_logpanel_add(Evas_Object *parent)
{
Evas_Object *frame;
Elm_Code_Widget *widget;
Elm_Code *code;
frame = elm_frame_add(parent);
elm_object_text_set(frame, _("Logs"));
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);
code = elm_code_create();
widget = elm_code_widget_add(parent, code);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
elm_obj_code_widget_gravity_set(widget, 0.0, 1.0);
efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_logpanel_line_cb, NULL);
@ -96,6 +107,7 @@ void edi_logpanel_add(Evas_Object *parent)
eina_log_print_cb_set(_edi_logpanel_print_cb, NULL);
eina_log_color_disable_set(EINA_TRUE);
elm_box_pack_end(parent, widget);
elm_object_content_set(frame, widget);
elm_box_pack_end(parent, frame);
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_logpanel_config_changed, NULL);
}

View File

@ -8,10 +8,12 @@
#include <Ecore_Getopt.h>
#include <Elementary.h>
#include <Efl_Ui.h>
#include <Eio.h>
#include "Edi.h"
#include "edi_config.h"
#include "edi_theme.h"
#include "edi_filepanel.h"
#include "edi_file.h"
#include "edi_logpanel.h"
@ -325,7 +327,7 @@ _edi_toolbar_separator_add(Evas_Object *tb)
static Evas_Object *
edi_content_setup(Evas_Object *win, const char *path)
{
Evas_Object *filepane, *logpane, *logpanels, *content_out, *content_in, *tb;
Evas_Object *filepane, *logpane, *logpanels, *scroller, *content_out, *content_in, *tb;
Evas_Object *icon, *button, *mainview;
filepane = elm_panes_add(win);
@ -380,11 +382,16 @@ edi_content_setup(Evas_Object *win, const char *path)
edi_mainview_add(mainview, win);
elm_object_part_content_set(filepane, "right", content_in);
elm_box_pack_end(content_out, filepane);
elm_object_part_content_set(logpane, "top", content_out);
evas_object_show(filepane);
_edi_leftpanes = filepane;
elm_box_pack_end(content_out, filepane);
scroller = elm_scroller_add(win);
evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(scroller);
elm_object_content_set(scroller, content_out);
elm_object_part_content_set(logpane, "top", scroller);
// add file list
evas_object_size_hint_weight_set(_edi_filepanel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -405,7 +412,7 @@ edi_content_setup(Evas_Object *win, const char *path)
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_toolbar_homogeneous_set(tb, EINA_FALSE);
elm_toolbar_align_set(tb, 1.0);
elm_toolbar_icon_size_set(tb, 16);
elm_toolbar_icon_size_set(tb, 24);
elm_object_style_set(tb, "item_horizontal");
elm_object_focus_allow_set(tb, EINA_FALSE);
elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_SCROLL);
@ -1338,6 +1345,14 @@ _edi_exit(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info
edi_close();
}
static void
_edi_focused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Evas_Object *win = edi_settings_win_get();
if (win)
elm_win_raise(win);
}
static void
_edi_resize_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj,
void *event_info EINA_UNUSED)
@ -1370,6 +1385,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);
edi_theme_window_alpha_set();
return ECORE_CALLBACK_RENEW;
}
@ -1485,7 +1501,7 @@ Evas_Object *edi_main_win_get(void)
Eina_Bool
edi_open(const char *inputpath)
{
Evas_Object *win, *hbx, *vbx, *tb, *content;
Evas_Object *table, *win, *bg, *hbx, *vbx, *tb, *content;
char *winname;
char *path;
@ -1509,15 +1525,33 @@ edi_open(const char *inputpath)
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
evas_object_smart_callback_add(win, "delete,request", _edi_exit, NULL);
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _edi_resize_cb, NULL);
evas_object_smart_callback_add(win, "focused", _edi_focused_cb, NULL);
table = elm_table_add(win);
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);
evas_object_show(table);
hbx = elm_box_add(win);
_edi_main_box = hbx;
elm_box_horizontal_set(hbx, EINA_TRUE);
evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_win_resize_object_add(win, hbx);
evas_object_show(hbx);
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(bg);
elm_win_resize_object_add(win, table);
elm_table_pack(table, bg, 0, 0, 1, 1);
elm_table_pack(table, hbx, 0, 0, 1, 1);
evas_object_data_set(win, "background", bg);
evas_object_data_set(win, "mainbox", hbx);
edi_theme_window_alpha_set();
tb = edi_toolbar_setup(hbx);
elm_box_pack_start(hbx, tb);
_edi_toolbar = tb;

View File

@ -5,10 +5,12 @@
#include <Eo.h>
#include <Eina.h>
#include <Elementary.h>
#include <Efreet_Mime.h>
#include <string.h>
#include "edi_file.h"
#include "edi_searchpanel.h"
#include "edi_theme.h"
#include "edi_config.h"
#include "mainview/edi_mainview.h"
@ -25,6 +27,8 @@ static Eina_Bool
_edi_searchpanel_config_changed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
elm_code_widget_font_set(_info_widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(_info_widget, _edi_project_config->gui.theme);
edi_theme_elm_code_alpha_set(_info_widget);
return ECORE_CALLBACK_RENEW;
}
@ -69,61 +73,381 @@ _edi_searchpanel_line_clicked_cb(void *data EINA_UNUSED, const Efl_Event *event)
free(numstr);
}
char *
_edi_searchpanel_line_render(Elm_Code_Line *line, const char *path)
static char *
edi_searchpanel_line_render(const Eina_File_Line *line, const char *path, size_t *length)
{
unsigned int len, trim = 0;
const char *text;
static char buf[1024];
static char str[1016];
Eina_Strbuf *buf = eina_strbuf_new();
char *r;
const char *text = line->start;
const char *end = line->end;
text = elm_code_line_text_get(line, &len);
if (!text)
return NULL;
while (trim < len)
while (text < end)
{
if (text[trim] != ' ' && text[trim] != '\t')
if (*text != ' ' && *text != '\t')
break;
trim++;
text++;
}
text += trim;
len -= trim;
if (len > sizeof(str) - 1)
len = sizeof(str) - 1;
snprintf(str, len + 1, "%s", text);
snprintf(buf, sizeof(buf), "%s:%d ->\t%s", ecore_file_file_get(path), line->number, str);
eina_strbuf_append_printf(buf, "%s:%d ->\t", ecore_file_file_get(path), line->index);
eina_strbuf_append_length(buf, text, end - text - 1);
return strdup(buf);
*length = eina_strbuf_length_get(buf);
r = eina_strbuf_string_steal(buf);
eina_strbuf_free(buf);
return r;
}
typedef struct _Eina_Iterator_Search Eina_Iterator_Search;
struct _Eina_Iterator_Search
{
Eina_Iterator iterator;
Eina_File *fp;
const char *map;
const char *end;
Eina_Stringshare *term;
Eina_File_Line current;
int boundary;
};
// Return the starting of the last line found and update the count
static inline const char *
edi_count_line(const char *start, unsigned int length, const char *line, unsigned int *count)
{
const char *cr;
const char *lf;
const char *end;
if (!length) return line;
lf = memchr(start, '\r', length);
cr = memchr(start, '\n', length);
if (!cr && !lf) return start;
end = lf + 1;
(*count)++;
// \r\n
if (lf && cr == lf + 1)
{
end = cr;
}
// \n
else if (cr)
{
end = cr;
}
// \r
else if (lf)
{
end = lf;
}
length = length - (end - start);
if (length == 0) return start;
return edi_count_line(end + 1, length - 1, end, count);
}
static inline const char *
edi_end_of_line(const char *start, int boundary, const char *end)
{
const char *cr;
const char *lf;
unsigned long long chunk;
while (start < end)
{
chunk = start + boundary < end ? boundary : end - start;
lf = memchr(start, '\r', chunk);
cr = memchr(start, '\n', chunk);
// \r\n
if (lf && cr == lf + 1)
return cr + 1;
// \n
if (cr)
return cr + 1;
// \r
if (lf)
return lf + 1;
start += chunk;
boundary = 4096;
}
return end;
}
static inline const char *
edi_search_term(const char *start, const char *end, int boundary,
Eina_Stringshare *term, Eina_File_Line *line)
{
char end_of_block = 0;
while (start < end)
{
const char *lookup;
const char *count;
unsigned long long chunk, cchunk;
const char *search = start;
cchunk = chunk = start + boundary < end ? boundary : end - start;
do
{
lookup = memchr(search, *term, cchunk);
// Did we found the right word or not ?
if (!lookup)
break;
else if (!memcmp(lookup, term, eina_stringshare_strlen(term)))
break;
// We didn't, start looking from where we are at
cchunk -= lookup - search;
search = lookup + 1;
}
while (cchunk > 0);
// If not found, we want to count starting from the end all the
// line in this chunk.
count = lookup ? lookup : start + chunk;
line->start = edi_count_line(start, count - start, line->start, &line->index);
// Here we post adjust the counter as we may have double counted a line
// if \r\n is exactly at the boundary of a chunk. This also only happen
// when we haven't found what we are looking for yet.
if (end_of_block == '\r' && *start == '\n')
line->index--;
if (lookup) return lookup;
end_of_block = *(start + chunk - 1);
start += chunk;
boundary = 4096;
}
return end;
}
static Eina_Bool
edi_search_file_iterator_next(Eina_Iterator_Search *it, void **data)
{
const char *lookup;
int line_boundary;
if (it->end == it->current.end) return EINA_FALSE;
// We are starting counting at the end of the line, so we will forget
// to account for the line where we found the term we were looking for,
// manually adjust for it.
// This also work to adjust for the first line as we start at zero
it->current.index++;
// Account for first iteration when end == NULL
lookup = edi_search_term(it->current.end ? it->current.end : it->current.start,
it->end, it->boundary, it->term, &it->current);
if (lookup == it->end) return EINA_FALSE;
line_boundary = (uintptr_t) lookup & 0x3FF;
if (!line_boundary) line_boundary = 4096;
it->current.end = edi_end_of_line(lookup, line_boundary, it->end);
// We need to adjust the end position of the line for '\r\n',
// in case it is on a cluster boundary.
if (*it->current.end == '\r')
{
if (it->current.end + 1 < it->end &&
*(it->current.end + 1) == '\n')
it->current.end += 1;
}
it->current.length = it->current.end - it->current.start;
it->boundary = (uintptr_t) it->current.end & 0x3FF;
if (!it->boundary) it->boundary = 4096;
*data = &it->current;
return EINA_TRUE;
}
static Eina_File *
edi_search_file_iterator_container(Eina_Iterator_Search *it)
{
return it->fp;
}
static void
edi_search_file_iterator_free(Eina_Iterator_Search *it)
{
eina_file_map_free(it->fp, (void*) it->map);
eina_file_close(it->fp);
EINA_MAGIC_SET(&it->iterator, 0);
free(it);
}
static Eina_Iterator *
edi_search_file(Eina_File *file, const char *term)
{
Eina_Iterator_Search *it;
size_t length;
const char elf_header[4] = {0x7f, 'E', 'L', 'F'};
if (!file || !term || strlen(term) == 0) return NULL;
length = eina_file_size_get(file);
if (!length) return NULL;
it = calloc(1, sizeof (Eina_Iterator_Search));
if (!it) return NULL;
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
it->map = eina_file_map_all(file, EINA_FILE_SEQUENTIAL);
if (!it->map)
{
free(it);
return NULL;
}
if (length >= 4 && !memcmp(it->map, elf_header, sizeof(elf_header)))
{
free(it);
return NULL;
}
it->fp = eina_file_dup(it->fp);
it->current.start = it->map;
it->current.end = NULL;
it->current.index = 0;
it->end = it->map + length;
it->term = eina_stringshare_add(term);
it->boundary = 4096;
it->iterator.version = EINA_ITERATOR_VERSION;
it->iterator.next = FUNC_ITERATOR_NEXT(edi_search_file_iterator_next);
it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(edi_search_file_iterator_container);
it->iterator.free = FUNC_ITERATOR_FREE(edi_search_file_iterator_free);
return &it->iterator;
}
typedef struct {
char *text;
size_t length;
} Async_Item;
typedef struct {
Elm_Code *logger;
Eina_File *f;
Eina_Inarray texts;
} Async_Log;
static Eina_Spinlock logs_lock;
static unsigned int logs_count = 0;
static Eina_Trash *logs = NULL;
static void
main_loop_line_append_async(void *data)
{
Async_Log *log = data;
Async_Item *item;
while ((item = eina_inarray_pop(&log->texts)))
{
elm_code_file_line_append(log->logger->file, item->text, item->length,
strdup(eina_file_filename_get(log->f)));
free(item->text);
item->text = NULL;
}
eina_file_close(log->f);
log->f = NULL;
log->logger = NULL;
// We are keeping the texts array as it won't be touched by Eina_Trash
eina_spinlock_take(&logs_lock);
if (logs_count < 8)
{
logs_count++;
eina_trash_push(&logs, log);
log = NULL;
}
eina_spinlock_release(&logs_lock);
if (log)
{
eina_inarray_flush(&log->texts);
free(log);
}
}
void
_edi_searchpanel_search_project_file(const char *path, const char *search_term, Elm_Code *logger)
{
Elm_Code *code;
Elm_Code_File *code_file;
Eina_List *item;
Elm_Code_Line *line;
char *text;
Eina_Iterator *it;
Eina_File_Line *l;
Async_Log *log;
Eina_File *f;
code = elm_code_create();
code_file = elm_code_file_open(code, path);
f = eina_file_open(path, EINA_FALSE);
if (!f) return ;
EINA_LIST_FOREACH(code->file->lines, item, line)
// If the file looks big, check if it is a text file first.
if (eina_file_size_get(f) > 1 * 1024 * 1024 &&
strncmp(efreet_mime_type_get(path), "text/", 5))
{
int found = elm_code_line_text_strpos(line, search_term, 0);
if (found != ELM_CODE_TEXT_NOT_FOUND)
{
text = _edi_searchpanel_line_render(line, path);
ecore_thread_main_loop_begin();
elm_code_file_line_append(logger->file, text, strlen(text), strdup(path));
ecore_thread_main_loop_end();
free(text);
}
eina_file_close(f);
return ;
}
elm_code_file_close(code_file);
eina_spinlock_take(&logs_lock);
log = eina_trash_pop(&logs);
if (log) logs_count--;
eina_spinlock_release(&logs_lock);
if (!log)
{
log = calloc(1, sizeof (Async_Log));
eina_inarray_step_set(&log->texts, sizeof (log->texts),
sizeof (Async_Item), 4);
}
log->f = eina_file_dup(f);
log->logger = logger;
it = edi_search_file(f, search_term);
EINA_ITERATOR_FOREACH(it, l)
{
Async_Item *item = eina_inarray_grow(&log->texts, 1);
item->text = edi_searchpanel_line_render(l, path, &item->length);
}
eina_iterator_free(it);
if (eina_inarray_count(&log->texts) == 0)
{
eina_inarray_flush(&log->texts);
eina_file_close(log->f);
free(log);
log = NULL;
}
if (log) ecore_main_loop_thread_safe_call_async(main_loop_line_append_async, log);
eina_file_close(f);
}
Eina_Bool
@ -155,28 +479,53 @@ _file_ignore(const char *filename)
void
_edi_searchpanel_search_project(const char *directory, const char *search_term, Elm_Code *logger)
{
Eina_List *files, *item;
char *file;
char *path;
Eina_List *dirs;
char *dir;
files = ecore_file_ls(directory);
dirs = eina_list_append(NULL, strdup(directory));
EINA_LIST_FOREACH(files, item, file)
EINA_LIST_FREE(dirs, dir)
{
if (_file_ignore(file)) continue;
Eina_File_Direct_Info *info;
Eina_Iterator *it;
path = edi_path_append(directory, file);
if (!edi_file_path_hidden(path))
it = eina_file_stat_ls(dir);
EINA_ITERATOR_FOREACH(it, info)
{
if (ecore_file_is_dir(path))
_edi_searchpanel_search_project(path, search_term, logger);
else
_edi_searchpanel_search_project_file(path, search_term, logger);
}
if (_file_ignore(info->path + info->name_start))
continue ;
free (path);
if (ecore_thread_check(_search_thread)) return;
if (edi_file_path_hidden(info->path))
continue ;
switch (info->type)
{
case EINA_FILE_REG:
{
_edi_searchpanel_search_project_file(info->path, search_term, logger);
break;
}
case EINA_FILE_DIR:
{
dirs = eina_list_append(dirs, strdup(info->path));
break;
}
default:
// Ignore all other type
break;
}
if (ecore_thread_check(_search_thread)) break;
}
eina_iterator_free(it);
if (ecore_thread_check(_search_thread)) break;
free(dir);
}
// Cleanup in case of interuption
EINA_LIST_FREE(dirs, dir)
free(dir);
}
static void
@ -186,23 +535,12 @@ _search_end_cb(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
_searching = EINA_FALSE;
}
static void
_search_cancel_cb(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
{
while ((ecore_thread_wait(_search_thread, 0.1)) != EINA_TRUE);
_searching = EINA_FALSE;
}
static void
_search_begin_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
{
const char *path = data;
_searching = EINA_TRUE;
_edi_searchpanel_search_project(path, _search_text, _elm_code);
if (ecore_thread_check(_search_thread)) return;
}
void
@ -212,7 +550,11 @@ edi_searchpanel_find(const char *text)
if (!text || strlen(text) == 0) return;
if (_searching) _search_cancel_cb(NULL, _search_thread);
if (_searching)
{
ecore_thread_cancel(_search_thread);
while ((ecore_thread_wait(_search_thread, 0.1)) != EINA_TRUE);
}
if (_search_text) free(_search_text);
_search_text = strdup(text);
@ -221,18 +563,28 @@ edi_searchpanel_find(const char *text)
elm_code_file_clear(_elm_code->file);
_searching = EINA_TRUE;
_search_thread = ecore_thread_feedback_run(_search_begin_cb, NULL,
_search_end_cb, _search_cancel_cb,
path, EINA_FALSE);
_search_end_cb, _search_end_cb,
path, EINA_FALSE);
}
void
edi_searchpanel_add(Evas_Object *parent)
{
Evas_Object *frame;
Elm_Code_Widget *widget;
Elm_Code *code;
frame = elm_frame_add(parent);
elm_object_text_set(frame, _("Search"));
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);
code = elm_code_create();
widget = elm_code_widget_add(parent, code);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
elm_obj_code_widget_gravity_set(widget, 0.0, 1.0);
efl_event_callback_add(widget, ELM_OBJ_CODE_WIDGET_EVENT_LINE_CLICKED, _edi_searchpanel_line_clicked_cb, NULL);
@ -242,8 +594,11 @@ edi_searchpanel_add(Evas_Object *parent)
_elm_code = code;
_info_widget = widget;
eina_spinlock_new(&logs_lock);
elm_object_content_set(frame, widget);
elm_box_pack_end(parent, frame);
elm_box_pack_end(parent, widget);
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_searchpanel_config_changed_cb, NULL);
}
@ -261,6 +616,8 @@ static Eina_Bool
_edi_taskspanel_config_changed_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
{
elm_code_widget_font_set(_tasks_widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_set(_tasks_widget, _edi_project_config->gui.theme);
edi_theme_elm_code_alpha_set(_tasks_widget);
return ECORE_CALLBACK_RENEW;
}
@ -288,18 +645,33 @@ edi_taskspanel_find(void)
path = edi_project_get();
if (_searching)
{
ecore_thread_cancel(_search_thread);
while ((ecore_thread_wait(_search_thread, 0.1)) != EINA_TRUE);
}
_search_thread = ecore_thread_feedback_run(_tasks_begin_cb, NULL,
_search_end_cb, _search_cancel_cb,
_search_end_cb, _search_end_cb,
path, EINA_FALSE);
}
void
edi_taskspanel_add(Evas_Object *parent)
{
Evas_Object *frame;
Elm_Code_Widget *widget;
Elm_Code *code;
frame = elm_frame_add(parent);
elm_object_text_set(frame, _("Tasks"));
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);
code = elm_code_create();
widget = elm_code_widget_add(parent, code);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
elm_obj_code_widget_gravity_set(widget, 0.0, 1.0);
efl_event_callback_add(widget, &ELM_CODE_EVENT_LINE_LOAD_DONE, _edi_taskspanel_line_cb, NULL);
@ -311,7 +683,9 @@ edi_taskspanel_add(Evas_Object *parent)
_tasks_code = code;
_tasks_widget = widget;
elm_box_pack_end(parent, widget);
elm_object_content_set(frame, widget);
elm_box_pack_end(parent, frame);
ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_taskspanel_config_changed_cb, NULL);
edi_taskspanel_find();

151
src/bin/edi_theme.c Normal file
View File

@ -0,0 +1,151 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <Elementary.h>
#include <Evas.h>
#include <Efl_Ui.h>
#include "Edi.h"
#include "edi_theme.h"
#include "edi_config.h"
#include "edi_private.h"
static Eina_List *_edi_themes = NULL;
// we are hooking into Efl for now...
Efl_Ui_Theme_Apply efl_ui_widget_theme_apply(Eo *obj);
void
edi_theme_window_alpha_set(void)
{
Evas_Object *win, *bg, *mainbox;
int r, g, b, a;
double fade;
Eina_Bool enabled = _edi_project_config->gui.translucent;
win = edi_main_win_get();
elm_win_alpha_set(win, enabled);
mainbox = evas_object_data_get(win, "mainbox");
if (enabled)
efl_gfx_color_set(mainbox, 255, 255, 255, _edi_project_config->gui.alpha);
else
efl_gfx_color_set(mainbox, 255, 255, 255, 255);
bg = evas_object_data_get(win, "background");
fade = _edi_project_config->gui.alpha / 255.0;
efl_gfx_color_get(efl_part(win, "background"), &r, &g, &b, &a);
if (enabled)
efl_gfx_color_set(bg, r * fade, g * fade, b * fade, fade * _edi_project_config->gui.alpha);
else
efl_gfx_color_set(bg, r, g, b, 128);
}
void edi_theme_elm_code_alpha_set(Evas_Object *obj)
{
if (_edi_project_config->gui.translucent)
elm_code_widget_alpha_set(obj, _edi_project_config->gui.alpha);
else
elm_code_widget_alpha_set(obj, 255);
}
void
edi_theme_elm_code_set(Evas_Object *obj, const char *name)
{
Eina_List *l;
Edi_Theme *theme;
if (!obj || !name)
return;
edi_theme_themes_get();
EINA_LIST_FOREACH(_edi_themes, l, theme)
{
if (strcmp(theme->name, name))
continue;
elm_layout_file_set(obj, theme->path, "elm/code/layout/default");
elm_code_widget_theme_refresh(obj);
}
}
Edi_Theme *
edi_theme_theme_by_name(const char *name)
{
Eina_List *l;
Edi_Theme *theme;
if (!name) return NULL;
edi_theme_themes_get();
EINA_LIST_FOREACH(_edi_themes, l, theme)
{
if (!strcmp(theme->name, name))
return theme;
}
return NULL;
}
static int
_theme_sort_cb(const void *t1, const void *t2)
{
const Edi_Theme *theme1 = t1;
const Edi_Theme *theme2 = t2;
if (!theme1) return 1;
if (!theme2) return -1;
return strcmp(theme1->title, theme2->title);
}
Eina_List *
edi_theme_themes_get(void)
{
Eina_List *files;
char *directory, *file, *name;
Edi_Theme *theme;
if (_edi_themes) return _edi_themes;
directory = PACKAGE_DATA_DIR "/themes";
theme = malloc(sizeof(Edi_Theme));
theme->name = strdup("default");
theme->path = edi_path_append(elm_theme_system_dir_get(), "default.edj");
theme->title = strdup("Default EFL");
_edi_themes = eina_list_append(_edi_themes, theme);
files = ecore_file_ls(directory);
EINA_LIST_FREE(files, file)
{
if (eina_str_has_extension(file, ".edj") && strcmp(file, "default.edj"))
{
theme = malloc(sizeof(Edi_Theme));
name = strdup(file);
name[strlen(name) - 4] = '\0';
theme->name = name;
theme->path = edi_path_append(directory, file);
theme->title = edje_file_data_get(theme->path, "title");
_edi_themes = eina_list_append(_edi_themes, theme);
}
free(file);
}
if (files)
eina_list_free(files);
_edi_themes = eina_list_sort(_edi_themes, eina_list_count(_edi_themes), _theme_sort_cb);
return _edi_themes;
}

73
src/bin/edi_theme.h Normal file
View File

@ -0,0 +1,73 @@
#ifndef __EDI_THEME_H__
#define __EDI_THEME_H__
#include <Eina.h>
#include <Evas.h>
typedef struct _Edi_Theme {
char *name;
char *path;
char *title;
} Edi_Theme;
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file
* @brief These routines used for managing Edi theme actions.
*/
/**
* @brief Theme management functions.
* @defgroup Theme
*
* @{
*
* Management of theming actions.
*
*/
/**
* Set the Edi theme by name on an Elm_Code_Widget.
*
* @param obj The Elm_Code_Widget object to apply the theme to.
* @param name The name of the theme to apply.
*
* @ingroup Theme
*/
void edi_theme_elm_code_set(Evas_Object *obj, const char *name);
/**
* Get a list of all themes available.
*
* @return a list of all available themes as Edi_Theme instances.
*
* @ingroup Theme
*/
Eina_List *edi_theme_themes_get(void);
/**
* Get theme obj by its name.
*
* @return the theme obj matching the name.
*
* @ingroup Theme
*/
Edi_Theme *edi_theme_theme_by_name(const char *name);
void edi_theme_window_alpha_set(void);
void edi_theme_elm_code_alpha_set(Evas_Object *obj);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif

View File

@ -10,8 +10,10 @@
#include "edi_editor.h"
#include "mainview/edi_mainview.h"
#include "edi_content.h"
#include "edi_filepanel.h"
#include "edi_config.h"
#include "edi_theme.h"
#include "language/edi_language_provider.h"
@ -853,115 +855,6 @@ _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 row;
unsigned int col;
widget = (Elm_Code_Widget *)obj;
elm_code_widget_cursor_position_get(widget, &row, &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);
}
static void
_edit_file_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Edi_Editor *editor;
Edi_Language_Provider *provider;
char *word;
const char *snippet;
ecore_event_add(EDI_EVENT_FILE_CHANGED, NULL, NULL, NULL);
editor = (Edi_Editor *)data;
_suggest_hint_hide(editor);
if (evas_object_visible_get(editor->suggest_bg))
return;
provider = edi_language_provider_get(editor);
if (!provider)
return;
word = _edi_editor_current_word_get(editor);
if (word && strlen(word) > 1)
{
snippet = provider->snippet_get(word);
if (snippet)
_suggest_hint_show_snippet(editor, word);
else if (strlen(word) >= 3)
_suggest_hint_show_match(editor, word);
}
free(word);
}
static void
_edi_editor_statusbar_add(Evas_Object *panel, Edi_Editor *editor, Edi_Mainview_Item *item)
{
Edi_Language_Provider *provider;
Evas_Object *position, *mime, *lines;
Elm_Code *code;
elm_box_horizontal_set(panel, EINA_TRUE);
mime = elm_label_add(panel);
if (item->mimetype)
{
provider = edi_language_provider_get(editor);
if (provider && provider->mime_name(item->mimetype))
{
char summary[1024];
sprintf(summary, "%s (%s)", provider->mime_name(item->mimetype), item->mimetype);
elm_object_text_set(mime, summary);
}
else
elm_object_text_set(mime, item->mimetype);
}
else
elm_object_text_set(mime, item->editortype);
evas_object_size_hint_align_set(mime, 0.0, 0.5);
evas_object_size_hint_weight_set(mime, 0.1, 0.0);
elm_box_pack_end(panel, mime);
evas_object_show(mime);
elm_object_disabled_set(mime, EINA_TRUE);
lines = elm_label_add(panel);
code = elm_code_widget_code_get(editor->entry);
if (elm_code_file_line_ending_get(code->file) == ELM_CODE_FILE_LINE_ENDING_WINDOWS)
elm_object_text_set(lines, "WIN");
else
elm_object_text_set(lines, "UNIX");
evas_object_size_hint_align_set(lines, 0.0, 0.5);
evas_object_size_hint_weight_set(lines, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(panel, lines);
evas_object_show(lines);
elm_object_disabled_set(lines, EINA_TRUE);
position = elm_label_add(panel);
evas_object_size_hint_align_set(position, 1.0, 0.5);
evas_object_size_hint_weight_set(position, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(panel, position);
evas_object_show(position);
elm_object_disabled_set(position, EINA_TRUE);
_edit_cursor_moved(position, editor->entry, NULL);
evas_object_smart_callback_add(editor->entry, "cursor,changed", _edit_cursor_moved, position);
evas_object_smart_callback_add(editor->entry, "changed,user", _edit_file_changed, editor);
}
#if HAVE_LIBCLANG
static void
_edi_range_color_set(Edi_Editor *editor, Edi_Range range, Elm_Code_Token_Type type)
@ -1310,6 +1203,8 @@ _edi_editor_config_changed(void *data, int type EINA_UNUSED, void *event EINA_UN
code->config.trim_whitespace = _edi_config->trim_whitespace;
elm_obj_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_alpha_set(widget);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
elm_obj_code_widget_show_whitespace_set(widget, _edi_project_config->gui.show_whitespace);
elm_obj_code_widget_tab_inserts_spaces_set(widget, _edi_project_config->gui.tab_inserts_spaces);
elm_obj_code_widget_line_width_marker_set(widget, _edi_project_config->gui.width_marker);
@ -1361,6 +1256,69 @@ edi_editor_reload(Edi_Editor *editor)
ecore_thread_main_loop_end();
}
static void
_edit_cursor_moved(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Edi_Mainview_Item *item;
Elm_Code *code;
Elm_Code_Line *line;
Elm_Code_Widget *widget;
unsigned int row, col, pos;
widget = (Elm_Code_Widget *)obj;
if (widget)
{
elm_code_widget_cursor_position_get(widget, &row, &col);
code = elm_code_widget_code_get(widget);
line = elm_code_file_line_get(code->file, row);
pos = elm_code_widget_line_text_position_for_column_get(widget, line, col) + 1;
}
else
{
row = 0; pos = 0;
}
item = data;
edi_content_statusbar_position_set(item->pos, row, pos);
}
static void
_edit_file_changed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Edi_Editor *editor;
Edi_Language_Provider *provider;
char *word;
const char *snippet;
ecore_event_add(EDI_EVENT_FILE_CHANGED, NULL, NULL, NULL);
editor = (Edi_Editor *)data;
_suggest_hint_hide(editor);
if (evas_object_visible_get(editor->suggest_bg))
return;
provider = edi_language_provider_get(editor);
if (!provider)
return;
word = _edi_editor_current_word_get(editor);
if (word && strlen(word) > 1)
{
snippet = provider->snippet_get(word);
if (snippet)
_suggest_hint_show_snippet(editor, word);
else if (strlen(word) >= 3)
_suggest_hint_show_match(editor, word);
}
free(word);
}
Evas_Object *
edi_editor_add(Evas_Object *parent, Edi_Mainview_Item *item)
{
@ -1402,6 +1360,8 @@ edi_editor_add(Evas_Object *parent, Edi_Mainview_Item *item)
elm_code_widget_line_numbers_set(widget, EINA_TRUE);
_edi_editor_config_changed(widget, 0, NULL);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
editor = calloc(1, sizeof(*editor));
editor->entry = widget;
editor->mimetype = item->mimetype;
@ -1409,6 +1369,8 @@ edi_editor_add(Evas_Object *parent, Edi_Mainview_Item *item)
evas_object_event_callback_add(widget, EVAS_CALLBACK_KEY_DOWN,
_smart_cb_key_down, editor);
evas_object_smart_callback_add(widget, "changed,user", _changed_cb, editor);
evas_object_smart_callback_add(widget, "selection,cut", _changed_cb, editor);
evas_object_smart_callback_add(widget, "selection,paste", _changed_cb, editor);
evas_object_event_callback_add(widget, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, editor);
evas_object_smart_callback_add(widget, "focused", _focused_cb, item);
evas_object_smart_callback_add(widget, "unfocused", _unfocused_cb, editor);
@ -1434,8 +1396,8 @@ edi_editor_add(Evas_Object *parent, Edi_Mainview_Item *item)
evas_object_show(widget);
elm_box_pack_end(box, widget);
edi_content_statusbar_add(statusbar, item);
edi_editor_search_add(searchbar, editor);
_edi_editor_statusbar_add(statusbar, editor, item);
e = evas_object_evas_get(widget);
ctrl = evas_key_modifier_mask_get(e, "Control");
@ -1453,6 +1415,10 @@ edi_editor_add(Evas_Object *parent, Edi_Mainview_Item *item)
ev_handler = ecore_event_handler_add(EDI_EVENT_CONFIG_CHANGED, _edi_editor_config_changed, widget);
evas_object_event_callback_add(item->view, EVAS_CALLBACK_DEL, _editor_del_cb, ev_handler);
_edit_cursor_moved(item, editor->entry, NULL);
evas_object_smart_callback_add(editor->entry, "changed,user", _edit_file_changed, editor);
evas_object_smart_callback_add(editor->entry, "cursor,changed", _edit_cursor_moved, item);
if (edi_language_provider_has(editor))
{
edi_language_provider_get(editor)->add(editor);

View File

@ -155,7 +155,6 @@ void edi_editor_doc_open(Edi_Editor *editor);
*/
void edi_editor_widget_config_get(Elm_Code_Widget *widget);
/**
* @}
*/

View File

@ -58,7 +58,7 @@ Edi_Language_Provider *edi_language_provider_for_mime_get(const char *mime)
id = "c";
if (!strcasecmp(mime, "text/rust"))
id = "rust";
if (!strcasecmp(mime, "text/x-python"))
if (!strcasecmp(mime, "text/x-python") || !strcasecmp(mime, "text/x-python3"))
id = "python";
if (!strcasecmp(mime, "text/x-go"))
id = "go";

View File

@ -16,6 +16,7 @@
#include "edi_content_provider.h"
#include "edi_searchpanel.h"
#include "edi_file.h"
#include "edi_theme.h"
#include "edi_private.h"
#include "edi_config.h"
@ -290,6 +291,8 @@ _edi_mainview_split_config_changed_cb(void *data, int type EINA_UNUSED, void *ev
Elm_Code_Widget *widget = data;
elm_code_widget_font_set(widget, _edi_project_config->font.name, _edi_project_config->font.size);
edi_theme_elm_code_alpha_set(widget);
edi_theme_elm_code_set(widget, _edi_project_config->gui.theme);
return ECORE_CALLBACK_RENEW;
}
@ -589,7 +592,7 @@ _edi_mainview_project_search_cb(void *data,
text_markup = elm_object_text_get((Evas_Object *) data);
if (!text_markup || !text_markup[0])
{
_edi_mainview_popup_message_open(_("Please enter a valid search term."));
elm_object_focus_set((Evas_Object *)data, EINA_TRUE);
return;
}
@ -644,18 +647,16 @@ edi_mainview_project_search_popup_show(void)
elm_box_pack_end(box, input);
evas_object_show(box);
frame = elm_frame_add(box);
frame = elm_frame_add(popup);
evas_object_show(frame);
elm_object_content_set(frame, box);
elm_object_content_set(popup, frame);
button = elm_button_add(popup);
elm_object_text_set(button, _("Cancel"));
elm_object_part_content_set(popup, "button1", button);
evas_object_smart_callback_add(button, "clicked",
_edi_mainview_project_search_popup_cancel_cb, NULL);
button = elm_button_add(popup);
elm_object_text_set(button, _("Search"));
elm_object_part_content_set(popup, "button2", button);
@ -671,20 +672,23 @@ _edi_mainview_project_replace_cb(void *data,
Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Evas_Object *search_obj, *replace_obj;
const char *search_markup, *replace_markup;
char *search, *replace;
search_markup = elm_object_text_get(evas_object_data_get(obj, "search"));
search_obj = evas_object_data_get(obj, "search");
search_markup = elm_object_text_get(search_obj);
if (!search_markup || !search_markup[0])
{
_edi_mainview_popup_message_open(_("Please enter a valid search string."));
elm_object_focus_set(search_obj, EINA_TRUE);
return;
}
replace_markup = elm_object_text_get(data);
replace_obj = (Evas_Object *) data;
replace_markup = elm_object_text_get(replace_obj);
if (!replace_markup || !replace_markup[0])
{
_edi_mainview_popup_message_open(_("Please enter a valid replace string."));
elm_object_focus_set(replace_obj, EINA_TRUE);
return;
}

View File

@ -33,6 +33,7 @@ typedef struct _Edi_Mainview_Item
/* Private */
Evas_Object *container; /**< The visual container that the item will display within */
Evas_Object *pos; /**< The object pointing to the item's statusbar in the editor */
Eina_Bool loaded;
} Edi_Mainview_Item;

View File

@ -466,6 +466,29 @@ _edi_mainview_panel_content_create(Edi_Mainview_Item *item, Evas_Object *parent)
return container;
}
static int
_font_width_get(Evas_Object *parent, const char *text)
{
int w = 0;
Evas_Object *textblock = evas_object_text_add(parent);
evas_object_size_hint_weight_set(textblock, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(textblock, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(textblock);
evas_object_text_font_set(textblock, "sans", 12);
evas_object_text_text_set(textblock, text);
evas_object_geometry_get(textblock, NULL, NULL, &w, NULL);
evas_object_del(textblock);
if (w < 120)
w = 120;
return w;
}
static void
_edi_mainview_panel_item_tab_add(Edi_Mainview_Panel *panel, Edi_Path_Options *options, const char *mime)
{
@ -473,6 +496,8 @@ _edi_mainview_panel_item_tab_add(Edi_Mainview_Panel *panel, Edi_Path_Options *op
Edi_Mainview_Item *item;
Edi_Editor *editor;
Elm_Code *code;
int h, width;
const char *path;
if (!panel) return;
@ -490,20 +515,34 @@ _edi_mainview_panel_item_tab_add(Edi_Mainview_Panel *panel, Edi_Path_Options *op
panel->items = eina_list_append(panel->items, item);
_edi_mainview_panel_show(panel, content);
evas_object_geometry_get(panel->tabs, NULL, NULL, NULL, &h);
tab = elm_button_add(panel->tabs);
evas_object_size_hint_weight_set(tab, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tab, 0.0, EVAS_HINT_FILL);
elm_object_focus_allow_set(tab, EINA_FALSE);
path = strstr(item->path, edi_project_get());
if (path)
path += 1 + strlen(edi_project_get());
else
path = item->path;
elm_object_tooltip_text_set(tab, path);
elm_object_tooltip_window_mode_set(tab, EINA_TRUE);
elm_layout_theme_set(tab, "multibuttonentry", "btn", "default");
elm_object_part_text_set(tab, "elm.btn.text", ecore_file_file_get(options->path));
elm_object_part_text_set(tab, "elm.btn.text", eina_slstr_printf("<style align=left> %s</>", ecore_file_file_get(options->path)));
/*
icon = elm_icon_add(tab);
elm_icon_standard_set(icon, provider->icon);
elm_object_part_content_set(tab, "icon", icon);
*/
width = _font_width_get(tab, ecore_file_file_get(options->path));
elm_layout_signal_callback_add(tab, "mouse,clicked,1", "*", _promote, item);
elm_layout_signal_callback_add(tab, "elm,deleted", "elm", _closetab, item);
evas_object_size_hint_min_set(tab, width * elm_config_scale_get(), h);
elm_box_pack_end(panel->tabs, tab);
evas_object_show(tab);
@ -788,17 +827,16 @@ _edi_mainview_panel_goto_popup_go_cb(void *data,
}
static void
_edi_mainview_panel_goto_popup_key_up_cb(void *data, Evas *e EINA_UNUSED,
_edi_mainview_panel_goto_popup_key_up_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
Evas_Object *obj, void *event_info)
{
Edi_Mainview_Panel *panel = data;
Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *)event_info;
const char *str;
str = elm_object_text_get(obj);
if (strlen(str) && (!strcmp(ev->key, "KP_Enter") || !strcmp(ev->key, "Return")))
_edi_mainview_panel_goto_popup_go_cb(panel, obj, NULL);
_edi_mainview_panel_goto_popup_go_cb(obj, NULL, NULL);
}
void

View File

@ -5,6 +5,8 @@ src = files([
'edi_config.h',
'edi_consolepanel.c',
'edi_consolepanel.h',
'edi_content.c',
'edi_content.h',
'edi_content_provider.c',
'edi_content_provider.h',
'edi_debug.c',
@ -21,6 +23,8 @@ src = files([
'edi_private.h',
'edi_searchpanel.c',
'edi_searchpanel.h',
'edi_theme.c',
'edi_theme.h',
])
bin_dir = include_directories('.')

View File

@ -138,12 +138,13 @@ _edi_screens_settings_display_cb(void *data, Evas_Object *obj,
void edi_screens_settings_message(Evas_Object *parent, const char *title, const char *message)
{
Evas_Object *popup, *table, *box, *icon, *sep, *label, *button;
Evas_Object *popup, *frame, *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);
elm_table_padding_set(table, 10, 10);
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());
@ -152,24 +153,25 @@ void edi_screens_settings_message(Evas_Object *parent, const char *title, const
evas_object_show(icon);
elm_table_pack(table, icon, 0, 0, 1, 1);
frame = elm_frame_add(popup);
elm_object_content_set(frame, table);
evas_object_show(frame);
box = elm_box_add(popup);
label = elm_label_add(popup);
elm_object_text_set(label, message);
evas_object_show(label);
elm_table_pack(table, label, 1, 0, 1, 1);
elm_box_pack_end(box, label);
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);
evas_object_show(box);
elm_table_pack(table, box, 1, 0, 1, 1);
elm_object_content_set(popup, frame);
evas_object_show(table);
button = elm_button_add(popup);
elm_object_text_set(button, _("OK"));

View File

@ -58,6 +58,22 @@ Evas_Object *edi_about_show(Evas_Object *mainwin);
*/
Evas_Object *edi_settings_show(Evas_Object *mainwin);
/**
* Return a pointer to the settings window.
*
* @return The object if it exists or NULL if not.
*
* @ingroup UI
*/
Evas_Object *edi_settings_win_get(void);
/**
* Create the font selection settings widget.
*
* @param parent The parent object for the font selection widget.
*
* @ingroup UI
*/
void edi_settings_font_add(Evas_Object *parent);
/**

View File

@ -9,9 +9,12 @@
#include "edi_screens.h"
#include "edi_config.h"
#include "edi_debug.h"
#include "edi_filepanel.h"
#include "edi_theme.h"
#include "edi_private.h"
static Evas_Object *_edi_settings_win;
static Elm_Object_Item *_edi_settings_display, *_edi_settings_builds,
*_edi_settings_behaviour, *_edi_settings_project;
@ -20,6 +23,8 @@ static Elm_Object_Item *_edi_settings_display, *_edi_settings_builds,
static void
_edi_settings_exit(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
_edi_settings_win = NULL;
evas_object_del(data);
}
@ -145,11 +150,74 @@ _edi_settings_font_preview_add(Evas_Object *parent, const char *font_name, int f
return widget;
}
static void
_edi_settings_display_theme_pressed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
{
Edi_Theme *theme;
const char *text = elm_object_item_text_get(event_info);
theme = elm_object_item_data_get(event_info);
if (_edi_project_config->gui.theme)
eina_stringshare_del(_edi_project_config->gui.theme);
_edi_project_config->gui.theme = eina_stringshare_add(theme->name);
_edi_project_config_save();
elm_object_text_set(obj, text);
elm_combobox_hover_end(obj);
}
static char *
_edi_settings_display_theme_text_get_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
{
Edi_Theme *current;
current = data;
return strdup(current->title);
}
static void
_edi_settings_display_translucent_state_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *event EINA_UNUSED)
{
Evas_Object *slider, *check;
int state;
check = obj;
slider = data;
state = elm_check_state_get(check);
_edi_project_config->gui.translucent = state;
_edi_project_config_save();
elm_object_disabled_set(slider, !state);
}
static void
_edi_settings_display_alpha_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
_edi_project_config->gui.alpha = elm_slider_value_get(obj);
_edi_project_config_save();
}
static char *
_edi_settings_display_alpha_format(double value)
{
return (char*)eina_stringshare_printf("%1.0f%%", (value/255)*100);
}
static Evas_Object *
_edi_settings_display_create(Evas_Object *parent)
{
Evas_Object *container, *box, *frame, *label, *spinner, *check, *button, *preview;
Evas_Object *table;
Evas_Object *table, *combobox, *slider;
Elm_Genlist_Item_Class *itc;
Edi_Theme *theme;
Eina_List *themes, *l;
container = elm_box_add(parent);
evas_object_size_hint_weight_set(container, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@ -185,6 +253,82 @@ _edi_settings_display_create(Evas_Object *parent)
elm_object_focus_set(button, EINA_TRUE);
label = elm_label_add(table);
elm_object_text_set(label, _("Color theme"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
elm_table_pack(table, label, 0, 1, 1, 1);
evas_object_show(label);
// START OF THEME SELECTOR
combobox = elm_combobox_add(table);
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_display_theme_pressed_cb, NULL);
if (!_edi_project_config->gui.theme)
elm_object_text_set(combobox, edi_theme_theme_by_name("default")->title);
else
elm_object_text_set(combobox, edi_theme_theme_by_name(_edi_project_config->gui.theme)->title);
elm_table_pack(table, combobox, 1, 1, 1, 1);
itc = elm_genlist_item_class_new();
itc->item_style = "default";
itc->func.text_get = _edi_settings_display_theme_text_get_cb;
themes = edi_theme_themes_get();
EINA_LIST_FOREACH(themes, l, theme)
{
elm_genlist_item_append(combobox, itc, theme, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
}
elm_genlist_realized_items_update(combobox);
elm_genlist_item_class_free(itc);
// END OF THEME SELECTOR
// START OF ALPHA SELECTOR
label = elm_label_add(table);
elm_object_text_set(label, _("Translucent"));
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);
slider = elm_slider_add(table);
check = elm_check_add(box);
elm_check_state_set(check, _edi_project_config->gui.translucent);
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(table, check, 1, 2, 1, 1);
evas_object_show(check);
evas_object_smart_callback_add(check, "changed",
_edi_settings_display_translucent_state_cb, slider);
label = elm_label_add(table);
elm_object_text_set(label, _("Alpha"));
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);
elm_object_disabled_set(slider, !_edi_project_config->gui.translucent);
evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_slider_min_max_set(slider, 0, 255);
elm_slider_value_set(slider, _edi_project_config->gui.alpha);
elm_slider_span_size_set(slider, 255);
elm_slider_step_set(slider, 0.01);
elm_slider_units_format_function_set(slider, _edi_settings_display_alpha_format,
(void(*)(char*))eina_stringshare_del);
elm_slider_indicator_format_function_set(slider, _edi_settings_display_alpha_format,
(void(*)(char*))eina_stringshare_del);
elm_table_pack(table, slider, 1, 3, 1, 1);
evas_object_show(slider);
evas_object_smart_callback_add(slider, "slider,drag,stop", _edi_settings_display_alpha_changed_cb, NULL);
evas_object_smart_callback_add(slider, "delay,changed", _edi_settings_display_alpha_changed_cb, NULL);
label = elm_label_add(table);
elm_object_text_set(label, _("Hide Toolbar"));
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
@ -474,6 +618,15 @@ _edi_settings_project_remote_cb(void *data EINA_UNUSED, Evas_Object *obj,
elm_object_disabled_set(entry, EINA_TRUE);
}
static void _edi_settings_scm_credentials_set(const char *user_fullname, const char *user_email)
{
if (!edi_scm_enabled())
return;
if (user_fullname && user_fullname[0] && user_email && user_email[0])
edi_scm_credentials_set(user_fullname, user_email);
}
static void
_edi_settings_project_email_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *event EINA_UNUSED)
@ -487,6 +640,8 @@ _edi_settings_project_email_cb(void *data EINA_UNUSED, Evas_Object *obj,
_edi_project_config->user_email = eina_stringshare_add(elm_object_text_get(entry));
_edi_project_config_save();
_edi_settings_scm_credentials_set(_edi_project_config->user_fullname, _edi_project_config->user_email);
}
static void
@ -502,6 +657,8 @@ _edi_settings_project_name_cb(void *data EINA_UNUSED, Evas_Object *obj,
_edi_project_config->user_fullname = eina_stringshare_add(elm_object_text_get(entry));
_edi_project_config_save();
_edi_settings_scm_credentials_set(_edi_project_config->user_fullname, _edi_project_config->user_email);
}
static Evas_Object *
@ -613,6 +770,19 @@ _edi_settings_project_create(Evas_Object *parent)
return frames;
}
static void
_edi_settings_behaviour_show_hidden_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *event EINA_UNUSED)
{
Evas_Object *check;
check = (Evas_Object *) obj;
_edi_config->show_hidden = elm_check_state_get(check);
_edi_config_save();
edi_filepanel_refresh_all();
}
static void
_edi_settings_behaviour_autosave_cb(void *data EINA_UNUSED, Evas_Object *obj,
void *event EINA_UNUSED)
@ -663,20 +833,38 @@ _edi_settings_behaviour_create(Evas_Object *parent)
_edi_settings_behaviour_trim_whitespace_cb, NULL);
evas_object_show(check);
check = elm_check_add(box);
elm_object_text_set(check, _("Show hidden files"));
elm_check_state_set(check, _edi_config->show_hidden);
elm_box_pack_end(box, check);
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.5);
evas_object_smart_callback_add(check, "changed",
_edi_settings_behaviour_show_hidden_cb, NULL);
evas_object_show(check);
return frame;
}
Evas_Object *
edi_settings_win_get(void)
{
return _edi_settings_win;
}
Evas_Object *
edi_settings_show(Evas_Object *mainwin)
{
Evas_Object *win, *bg, *table, *naviframe, *tb;
Elm_Object_Item *tb_it, *default_it;
win = elm_win_add(mainwin, "settings", ELM_WIN_BASIC);
if (edi_settings_win_get())
return NULL;
_edi_settings_win = win = elm_win_add(mainwin, "settings", ELM_WIN_BASIC);
if (!win) return NULL;
elm_win_title_set(win, _("Edi Settings"));
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
elm_win_focus_highlight_enabled_set(win, EINA_FALSE);
evas_object_smart_callback_add(win, "delete,request", _edi_settings_exit, win);
bg = elm_bg_add(win);

View File

@ -67,6 +67,7 @@ _font_monospaced_check(const char *name, Evas_Object *parent)
evas_object_text_text_set(textblock, "m");
evas_object_geometry_get(textblock, NULL, NULL, &w2, NULL);
evas_object_del(textblock);
// check width difference is small or zero.
diff = (w2 >= w1) ? w2 - w1 : w1 - w2;

View File

@ -473,8 +473,6 @@ _content_get(void *data, Evas_Object *obj, const char *source)
elm_object_content_set(frame, table);
image = elm_image_add(table);
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, template->edje_id);
evas_object_show(image);
@ -535,7 +533,7 @@ _edi_welcome_project_new_cb(void *data, Evas_Object *obj EINA_UNUSED, void *even
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);
evas_object_show(table);
rect = evas_object_rectangle_add(table);
rect = evas_object_rectangle_add(evas_object_evas_get(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, 500 * elm_config_scale_get(), 300 * elm_config_scale_get());

View File

@ -153,6 +153,9 @@ _edi_create_free_data()
create = _edi_create_data;
_edi_create_data = NULL;
if (!create)
return;
if (create->temp && ecore_file_exists(create->temp))
ecore_file_recursive_rm(create->temp);
@ -288,7 +291,7 @@ _edi_create_error_cb(void *data, Eio_File *handler EINA_UNUSED, int error)
create = (Edi_Create *) data;
ERR("copy error: [%s]\n", strerror(error));
if (create->callback)
if (create && create->callback)
create->callback(create->path, EINA_FALSE);
_edi_create_free_data();
@ -407,8 +410,7 @@ edi_create_example(const char *example_name, const char *parentdir,
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);
status = edi_scm_git_update(examplepath);
else
status = edi_scm_git_clone(EXAMPLES_GIT_URL, examplepath);

View File

@ -85,6 +85,23 @@ edi_scm_git_clone(const char *url, const char *dir)
return code;
}
EAPI int
edi_scm_git_update(const char *dir)
{
char *oldpwd;
int code;
oldpwd = getcwd(NULL, PATH_MAX);
chdir(dir);
code = edi_exe_wait("git fetch origin && git reset --hard origin/master");
chdir(oldpwd);
free(oldpwd);
return code;
}
static int
_edi_scm_git_file_stage(const char *path)
{
@ -443,8 +460,16 @@ _edi_scm_git_remote_name_get(void)
if (!engine)
return NULL;
if (!_remote_name)
_remote_name = _edi_scm_exec_response("git config --get user.name");
if (_remote_name)
return _remote_name;
_remote_name = _edi_scm_exec_response("git config --get user.name");
if (_remote_name && !_remote_name[0])
{
free(_remote_name);
_remote_name = NULL;
}
return _remote_name;
}
@ -458,8 +483,16 @@ _edi_scm_git_remote_email_get(void)
if (!engine)
return NULL;
if (!_remote_email)
_remote_email = _edi_scm_exec_response("git config --get user.email");
if (_remote_email)
return _remote_email;
_remote_email = _edi_scm_exec_response("git config --get user.email");
if (_remote_email && !_remote_email[0])
{
free(_remote_email);
_remote_email = NULL;
}
return _remote_email;
}
@ -473,8 +506,16 @@ _edi_scm_git_remote_url_get(void)
if (!engine)
return NULL;
if (!_remote_url)
_remote_url = _edi_scm_exec_response("git remote get-url origin");
if (_remote_url)
return _remote_url;
_remote_url = _edi_scm_exec_response("git remote get-url origin");
if (_remote_url && !_remote_url[0])
{
free(_remote_url);
_remote_url = NULL;
}
return _remote_url;
}

View File

@ -128,14 +128,25 @@ EAPI int edi_scm_git_new(void);
/**
* Clone an existing git repository from the provided url.
*
* @param url the URL to clone from.
* @param dir the new directory that will be created to clone into
* @param url The URL to clone from.
* @param dir The new directory that will be created to clone into.
* @return The status code of the clone command.
*
* @ingroup Scm
*/
EAPI int edi_scm_git_clone(const char *url, const char *dir);
/**
* Update a local git repository from remote source.
*
* @param dir The directory to update.
*
* @return The status code of the update process.
*
* @ingroup Scm
*/
EAPI int edi_scm_git_update(const char *dir);
/**
* Get a pointer to the SCM engine in use.
*

View File

@ -14,6 +14,18 @@ edi_editor_add(Evas_Object *parent EINA_UNUSED, Edi_Mainview_Item *item EINA_UNU
return NULL;
}
EAPI Evas_Object *
edi_content_image_add(Evas_Object *parent EINA_UNUSED, Edi_Mainview_Item *item EINA_UNUSED)
{
return NULL;
}
EAPI Evas_Object *
edi_content_diff_add(Evas_Object *parent EINA_UNUSED, Edi_Mainview_Item *item EINA_UNUSED)
{
return NULL;
}
Edi_Config *_edi_config = NULL;
Edi_Project_Config *_edi_project_config = NULL;
int EDI_EVENT_CONFIG_CHANGED;

View File

@ -17,7 +17,7 @@ START_TEST (edi_test_language_provider_lookup)
}
END_TEST
*/
void edi_test_language_provider(TCase *tc)
void edi_test_language_provider(EINA_UNUSED TCase *tc)
{
// tcase_add_test(tc, edi_test_language_provider_lookup);
}

View File

@ -99,7 +99,7 @@ START_TEST (edi_test_language_provider_c_summary)
END_TEST
*/
void edi_test_language_provider_c(TCase *tc)
void edi_test_language_provider_c(EINA_UNUSED TCase *tc)
{
#if HAVE_LIBCLANG
// TODO fix issues caused in elm by this test