forked from enlightenment/edi
[editor] move tooltips to inline error meessages
Not perfect on refresh times but much easier to read than before
This commit is contained in:
parent
bec0d3085c
commit
7a9241458a
|
@ -41,7 +41,6 @@ elm_code_line.c \
|
||||||
elm_code_text.c \
|
elm_code_text.c \
|
||||||
elm_code_file.c \
|
elm_code_file.c \
|
||||||
elm_code_parse.c \
|
elm_code_parse.c \
|
||||||
widget/elm_code_widget_tooltip.c \
|
|
||||||
widget/elm_code_widget_selection.c \
|
widget/elm_code_widget_selection.c \
|
||||||
widget/elm_code_widget.c \
|
widget/elm_code_widget.c \
|
||||||
elm_code_diff_widget.c \
|
elm_code_diff_widget.c \
|
||||||
|
|
|
@ -313,7 +313,7 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Line *line)
|
||||||
Eina_Unicode unichr;
|
Eina_Unicode unichr;
|
||||||
unsigned int length, x, charwidth, i, w;
|
unsigned int length, x, charwidth, i, w;
|
||||||
int chrpos, gutter;
|
int chrpos, gutter;
|
||||||
Evas_Object *grid;
|
Evas_Object *grid, *status;
|
||||||
Evas_Textgrid_Cell *cells;
|
Evas_Textgrid_Cell *cells;
|
||||||
Elm_Code_Widget_Data *pd;
|
Elm_Code_Widget_Data *pd;
|
||||||
|
|
||||||
|
@ -363,6 +363,29 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Line *line)
|
||||||
_elm_code_widget_fill_whitespace(widget, '\n', &cells[length + gutter]);
|
_elm_code_widget_fill_whitespace(widget, '\n', &cells[length + gutter]);
|
||||||
|
|
||||||
evas_object_textgrid_update_add(grid, 0, 0, w, 1);
|
evas_object_textgrid_update_add(grid, 0, 0, w, 1);
|
||||||
|
|
||||||
|
// add a status below the line if needed (and remove those no longer needed)
|
||||||
|
status = evas_object_data_get(grid, "status");
|
||||||
|
if (line->status_text)
|
||||||
|
{
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
status = elm_label_add(pd->gridbox);
|
||||||
|
evas_object_size_hint_weight_set(status, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(status, 0.05, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(status);
|
||||||
|
|
||||||
|
elm_box_pack_after(pd->gridbox, status, grid);
|
||||||
|
evas_object_data_set(grid, "status", status);
|
||||||
|
}
|
||||||
|
elm_object_text_set(status, line->status_text);
|
||||||
|
}
|
||||||
|
else if (status)
|
||||||
|
{
|
||||||
|
elm_box_unpack(pd->gridbox, status);
|
||||||
|
evas_object_hide(status);
|
||||||
|
evas_object_data_set(grid, "status", NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -713,24 +736,15 @@ _elm_code_widget_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj
|
||||||
{
|
{
|
||||||
Elm_Code_Widget *widget;
|
Elm_Code_Widget *widget;
|
||||||
Elm_Code_Widget_Data *pd;
|
Elm_Code_Widget_Data *pd;
|
||||||
Elm_Code_Line *line;
|
|
||||||
Evas_Event_Mouse_Move *event;
|
Evas_Event_Mouse_Move *event;
|
||||||
unsigned int row;
|
unsigned int row;
|
||||||
int col;
|
int col;
|
||||||
Eina_Bool hasline;
|
|
||||||
|
|
||||||
widget = (Elm_Code_Widget *)data;
|
widget = (Elm_Code_Widget *)data;
|
||||||
pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
|
pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
|
||||||
event = (Evas_Event_Mouse_Move *)event_info;
|
event = (Evas_Event_Mouse_Move *)event_info;
|
||||||
|
|
||||||
hasline = _elm_code_widget_position_at_coordinates_get(widget, pd, event->cur.canvas.x, event->cur.canvas.y, &row, &col);
|
_elm_code_widget_position_at_coordinates_get(widget, pd, event->cur.canvas.x, event->cur.canvas.y, &row, &col);
|
||||||
if (!hasline)
|
|
||||||
_elm_code_widget_tooltip_text_set(widget, NULL);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
line = elm_code_file_line_get(pd->code->file, row);
|
|
||||||
_elm_code_widget_tooltip_text_set(widget, line->status_text);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pd->editable || !event->buttons)
|
if (!pd->editable || !event->buttons)
|
||||||
return;
|
return;
|
||||||
|
@ -1771,8 +1785,6 @@ _elm_code_widget_evas_object_smart_add(Eo *obj, Elm_Code_Widget_Data *pd)
|
||||||
elm_object_content_set(scroller, gridrows);
|
elm_object_content_set(scroller, gridrows);
|
||||||
pd->gridbox = gridrows;
|
pd->gridbox = gridrows;
|
||||||
|
|
||||||
_elm_code_widget_tooltip_add(obj);
|
|
||||||
|
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj);
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj);
|
||||||
evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj);
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ typedef struct
|
||||||
Eina_Bool show_whitespace, tab_inserts_spaces;
|
Eina_Bool show_whitespace, tab_inserts_spaces;
|
||||||
|
|
||||||
Elm_Code_Widget_Selection_Data *selection;
|
Elm_Code_Widget_Selection_Data *selection;
|
||||||
Evas_Object *tooltip;
|
|
||||||
|
|
||||||
/* Undo stack */
|
/* Undo stack */
|
||||||
Eina_List *undo_stack;
|
Eina_List *undo_stack;
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
#ifdef HAVE_CONFIG
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Elm_Code.h"
|
|
||||||
|
|
||||||
#include "elm_code_widget_private.h"
|
|
||||||
|
|
||||||
void
|
|
||||||
_elm_code_widget_tooltip_text_set(Evas_Object *widget, const char *text)
|
|
||||||
{
|
|
||||||
Elm_Code_Widget_Data *pd;
|
|
||||||
|
|
||||||
pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
|
|
||||||
|
|
||||||
if (!text)
|
|
||||||
{
|
|
||||||
elm_object_tooltip_hide(widget);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
elm_object_tooltip_show(widget);
|
|
||||||
|
|
||||||
if (pd->tooltip) // will have been created by the callback below...
|
|
||||||
elm_object_text_set(pd->tooltip, text);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_elm_code_widget_tooltip_cb(void *data EINA_UNUSED, Evas_Object *obj, Evas_Object *tooltip)
|
|
||||||
{
|
|
||||||
Elm_Code_Widget_Data *pd;
|
|
||||||
Evas_Object *label;
|
|
||||||
|
|
||||||
pd = eo_data_scope_get(obj, ELM_CODE_WIDGET_CLASS);
|
|
||||||
|
|
||||||
label = elm_label_add(tooltip);
|
|
||||||
pd->tooltip = label;
|
|
||||||
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_elm_code_widget_tooltip_add(Evas_Object *widget)
|
|
||||||
{
|
|
||||||
elm_object_tooltip_content_cb_set(widget, _elm_code_widget_tooltip_cb, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "elm_code_suite.h"
|
#include "elm_code_suite.h"
|
||||||
|
|
||||||
#include "widget/elm_code_widget.c"
|
#include "widget/elm_code_widget.c"
|
||||||
#include "widget/elm_code_widget_tooltip.c"
|
|
||||||
|
|
||||||
static void _assert_cell_type(Evas_Textgrid_Cell cell, Elm_Code_Token_Type type, int id)
|
static void _assert_cell_type(Evas_Textgrid_Cell cell, Elm_Code_Token_Type type, int id)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue