2014-02-25 20:32:12 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Eina.h>
|
2014-11-04 14:21:49 -08:00
|
|
|
#include <Elm_Code.h>
|
2014-02-25 20:32:12 -08:00
|
|
|
|
|
|
|
#include "edi_logpanel.h"
|
2014-12-01 14:54:17 -08:00
|
|
|
#include "edi_config.h"
|
2014-02-25 20:32:12 -08:00
|
|
|
|
|
|
|
#include "edi_private.h"
|
|
|
|
|
2014-11-04 14:21:49 -08:00
|
|
|
static Evas_Object *_info_widget;
|
|
|
|
static Elm_Code *_elm_code;
|
2014-02-25 20:32:12 -08:00
|
|
|
|
2015-01-10 09:12:52 -08:00
|
|
|
static void _print_cb(const Eina_Log_Domain *domain,
|
2014-02-25 20:32:12 -08:00
|
|
|
Eina_Log_Level level,
|
|
|
|
const char *file,
|
|
|
|
const char *fnc,
|
|
|
|
int line,
|
|
|
|
const char *fmt,
|
2014-04-27 13:01:42 -07:00
|
|
|
EINA_UNUSED void *data,
|
2014-02-25 20:32:12 -08:00
|
|
|
va_list args)
|
|
|
|
{
|
2014-11-04 16:01:28 -08:00
|
|
|
unsigned int printed, line_count, buffer_len = 512;
|
2014-02-25 20:32:12 -08:00
|
|
|
char buffer [buffer_len];
|
|
|
|
|
|
|
|
printed = snprintf(buffer, buffer_len, "%s:%s:%s (%d): ",
|
|
|
|
domain->domain_str, file, fnc, line);
|
|
|
|
vsnprintf(buffer + printed, buffer_len - printed, fmt, args);
|
|
|
|
|
2014-11-19 14:39:00 -08:00
|
|
|
elm_code_file_line_append(_elm_code->file, buffer, strlen(buffer));
|
2014-02-25 20:32:12 -08:00
|
|
|
if (level <= EINA_LOG_LEVEL_ERR)
|
2014-11-04 16:01:28 -08:00
|
|
|
{
|
|
|
|
line_count = elm_code_file_lines_get(_elm_code->file);
|
|
|
|
|
2014-11-06 15:43:56 -08:00
|
|
|
elm_code_file_line_status_set(_elm_code->file, line_count, ELM_CODE_STATUS_TYPE_ERROR);
|
2014-11-04 16:01:28 -08:00
|
|
|
}
|
2014-02-25 20:32:12 -08:00
|
|
|
}
|
|
|
|
|
2015-01-10 09:43:12 -08:00
|
|
|
void edi_logpanel_add(Evas_Object *parent)
|
2014-02-25 20:32:12 -08:00
|
|
|
{
|
2015-01-26 11:05:34 -08:00
|
|
|
Elm_Code_Widget *widget;
|
2014-11-04 14:21:49 -08:00
|
|
|
Elm_Code *code;
|
2014-02-25 20:32:12 -08:00
|
|
|
|
2014-11-16 15:52:41 -08:00
|
|
|
code = elm_code_create();
|
2015-01-26 11:05:34 -08:00
|
|
|
widget = eo_add(ELM_CODE_WIDGET_CLASS, parent);
|
2015-01-26 06:00:37 -08:00
|
|
|
eo_do(widget,
|
2015-01-28 06:16:46 -08:00
|
|
|
elm_code_widget_code_set(code),
|
|
|
|
elm_code_widget_font_size_set(_edi_cfg->font.size),
|
|
|
|
elm_code_widget_gravity_set(0.0, 1.0));
|
2014-11-04 14:21:49 -08:00
|
|
|
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);
|
2014-02-25 20:32:12 -08:00
|
|
|
|
2014-11-04 14:21:49 -08:00
|
|
|
_elm_code = code;
|
|
|
|
_info_widget = widget;
|
2014-02-25 20:32:12 -08:00
|
|
|
|
2015-01-10 09:12:52 -08:00
|
|
|
eina_log_print_cb_set(_print_cb, NULL);
|
2014-02-25 20:32:12 -08:00
|
|
|
eina_log_color_disable_set(EINA_TRUE);
|
|
|
|
|
2014-11-22 07:56:16 -08:00
|
|
|
elm_box_pack_end(parent, widget);
|
2014-02-25 20:32:12 -08:00
|
|
|
}
|