forked from enlightenment/efl
elm_code_widget: resize cursor at time of font change.
Summary: This ensures the cursor changes to meet the font size change when a font change is made in an Elm_Code_Widget. @fix T6470 Test Plan: Run ecrire or Edi. Open a text file and change the font settings. Cursor should resize with the font when it is changed. Reviewers: #committers, ajwillia.ms Reviewed By: #committers, ajwillia.ms Subscribers: cedric, zmike Tags: #efl Maniphest Tasks: T6470 Differential Revision: https://phab.enlightenment.org/D6596
This commit is contained in:
parent
08d23ea582
commit
ab7d2ebb55
|
@ -312,18 +312,10 @@ _elm_code_widget_fill_whitespace(Elm_Code_Widget *widget, Eina_Unicode character
|
|||
}
|
||||
|
||||
static void
|
||||
_elm_code_widget_fill_cursor(Elm_Code_Widget *widget, unsigned int number, int gutter, int w)
|
||||
_elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd)
|
||||
{
|
||||
Elm_Code_Widget_Data *pd;
|
||||
Evas_Coord cx, cy, cw, ch;
|
||||
|
||||
pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
|
||||
|
||||
if (pd->visible && pd->editable && pd->focussed && pd->cursor_line == number)
|
||||
{
|
||||
if (pd->cursor_col + gutter - 1 >= (unsigned int) w)
|
||||
return;
|
||||
|
||||
elm_code_widget_geometry_for_position_get(widget, pd->cursor_line, pd->cursor_col, &cx, &cy, &cw, &ch);
|
||||
|
||||
if (!pd->cursor_rect)
|
||||
|
@ -333,13 +325,27 @@ _elm_code_widget_fill_cursor(Elm_Code_Widget *widget, unsigned int number, int g
|
|||
if (!elm_layout_theme_set(pd->cursor_rect, "entry", "cursor", elm_widget_style_get(widget)))
|
||||
CRI("Failed to set layout!");
|
||||
elm_layout_signal_emit(pd->cursor_rect, "elm,action,focus", "elm");
|
||||
|
||||
evas_object_resize(pd->cursor_rect, cw/8, ch);
|
||||
}
|
||||
|
||||
evas_object_resize(pd->cursor_rect, cw/8, ch);
|
||||
evas_object_move(pd->cursor_rect, cx, cy);
|
||||
evas_object_show(pd->cursor_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_code_widget_fill_cursor(Elm_Code_Widget *widget, unsigned int number, int gutter, int w)
|
||||
{
|
||||
Elm_Code_Widget_Data *pd;
|
||||
|
||||
pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
|
||||
|
||||
if (pd->visible && pd->editable && pd->focussed && pd->cursor_line == number)
|
||||
{
|
||||
if (pd->cursor_col + gutter - 1 >= (unsigned int) w)
|
||||
return;
|
||||
|
||||
_elm_code_widget_cursor_update(widget, pd);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2066,7 +2072,7 @@ _elm_code_widget_lines_visible_get(Eo *obj, Elm_Code_Widget_Data *pd)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_code_widget_font_set(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd,
|
||||
_elm_code_widget_font_set(Eo *obj, Elm_Code_Widget_Data *pd,
|
||||
const char *name, Evas_Font_Size size)
|
||||
{
|
||||
Eina_List *item;
|
||||
|
@ -2083,6 +2089,10 @@ _elm_code_widget_font_set(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd,
|
|||
{
|
||||
evas_object_textgrid_font_set(grid, face, size * elm_config_scale_get());
|
||||
}
|
||||
|
||||
if (pd->cursor_rect && (eina_list_count(pd->grids) >= pd->cursor_line))
|
||||
_elm_code_widget_cursor_update(obj, pd);
|
||||
|
||||
if (pd->font_name)
|
||||
eina_stringshare_del((char *)pd->font_name);
|
||||
pd->font_name = eina_stringshare_add(face);
|
||||
|
|
Loading…
Reference in New Issue