forked from enlightenment/enventor
live_edit: add fixed width and height interface in live edit view
Summary: update fixed width and height interface to choose easier Test Plan: 1. launch enventor 2. make live edit item by clicking live edit toolbar 3. click fixed width or fixed height check item on setting interface in live edit view 4. set relative_to property by dragging the edge of the part 5. insert the live edit item 6. check the result in text view Reviewers: Jaehyun_Cho, NikaWhite, Hermet Differential Revision: https://phab.enlightenment.org/D3962
This commit is contained in:
parent
ee41674954
commit
6fb471d8d4
|
@ -2730,6 +2730,24 @@ group { "tools_layout";
|
|||
relative: 0.0 1.0;
|
||||
to_y: "elm.swallow.tools";
|
||||
}
|
||||
rel2.to_y: "elm.swallow.fixed_bar";
|
||||
rel2.relative: 1.0 0.0;
|
||||
}
|
||||
}
|
||||
swallow { "elm.swallow.fixed_bar";
|
||||
desc { "default";
|
||||
min: 0 35;
|
||||
align: 0.5 0.0;
|
||||
fixed: 1 1;
|
||||
rel1.relative: 0.0 1.0;
|
||||
rel2.relative: 1.0 1.0;
|
||||
}
|
||||
desc { "visible";
|
||||
inherit: "default";
|
||||
align: 0.5 1.0;
|
||||
fixed: 1 1;
|
||||
rel1.relative: 0.0 1.0;
|
||||
rel2.relative: 1.0 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2746,6 +2764,18 @@ group { "tools_layout";
|
|||
target: "tools_base";
|
||||
transition: DECELERATE 0.25;
|
||||
}
|
||||
program { name: "fixed_bar_show";
|
||||
signal: "elm,state,fixed_bar,show";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "elm.swallow.fixed_bar";
|
||||
transition: DECELERATE 0.25 CURRENT;
|
||||
}
|
||||
program { name: "fixed_bar_hide";
|
||||
signal: "elm,state,fixed_bar,hide";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.swallow.fixed_bar";
|
||||
transition: DECELERATE 0.25 CURRENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,10 +157,12 @@ base_win_resize_object_add(Evas_Object *resize_obj)
|
|||
}
|
||||
|
||||
void base_tools_set(Evas_Object *live_view_tools,
|
||||
Evas_Object *text_editor_tools)
|
||||
Evas_Object *text_editor_tools,
|
||||
Evas_Object *live_view_fixed_bar)
|
||||
{
|
||||
panes_live_view_tools_set(live_view_tools);
|
||||
panes_text_editor_tools_set(text_editor_tools);
|
||||
panes_live_view_fixed_bar_set(live_view_fixed_bar);
|
||||
file_browser_tools_set();
|
||||
edc_navigator_tools_set();
|
||||
|
||||
|
|
|
@ -1970,12 +1970,25 @@ key_grab_add(Evas_Object *keygrabber, const char *key)
|
|||
EINA_LOG_ERR(_("Failed to grab key - %s"), key);
|
||||
}
|
||||
|
||||
static void
|
||||
rel_to_values_reset(live_data *ld)
|
||||
{
|
||||
//Reset state about relative_to
|
||||
ld->rel_to_info.align_x = 0.5;
|
||||
ld->rel_to_info.align_y = 0.5;
|
||||
ld->rel_to_info.rel1_x_to = NULL;
|
||||
ld->rel_to_info.rel1_y_to = NULL;
|
||||
ld->rel_to_info.rel2_x_to = NULL;
|
||||
ld->rel_to_info.rel2_y_to = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
fixed_w_check_changed_cb(void *data, Evas_Object *obj,
|
||||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
live_data *ld = data;
|
||||
ld->fixed_w = elm_check_state_get(obj);
|
||||
rel_to_values_reset(ld);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1983,56 +1996,7 @@ fixed_h_check_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNU
|
|||
{
|
||||
live_data *ld = data;
|
||||
ld->fixed_h = elm_check_state_get(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
show_fixed_check_list(live_data *ld)
|
||||
{
|
||||
if (ld->fixed_ctxpopup)
|
||||
return;
|
||||
|
||||
ld->fixed_ctxpopup = elm_ctxpopup_add(ld->live_view);
|
||||
//FIXME: because the focus highlighting is floated after ctxpopup is
|
||||
//dismissed, i disable the focus here
|
||||
elm_object_tree_focus_allow_set(ld->fixed_ctxpopup, EINA_FALSE);
|
||||
evas_object_smart_callback_add(ld->fixed_ctxpopup, "dismissed",
|
||||
fixed_ctxpopup_dismissed_cb, ld);
|
||||
|
||||
Evas_Object *view_obj = view_obj_get(ld);
|
||||
Evas_Coord vx, vy, vw, vh;
|
||||
evas_object_geometry_get(view_obj, &vx, &vy, &vw, &vh);
|
||||
|
||||
evas_object_move(ld->fixed_ctxpopup, vx + (vw / 2), vy + (vh / 2));
|
||||
elm_object_scale_set(ld->fixed_ctxpopup, 1.2);
|
||||
|
||||
Evas_Object *fixed_box = elm_box_add(ld->fixed_ctxpopup);
|
||||
elm_box_horizontal_set(fixed_box, EINA_TRUE);
|
||||
evas_object_show(fixed_box);
|
||||
|
||||
Evas_Object *label = elm_label_add(fixed_box);
|
||||
elm_object_text_set(label, "Set Fixed Properties: ");
|
||||
evas_object_show(label);
|
||||
elm_box_pack_end(fixed_box, label);
|
||||
|
||||
Evas_Object *fixed_w_check = elm_check_add(fixed_box);
|
||||
Evas_Object *fixed_h_check = elm_check_add(fixed_box);
|
||||
|
||||
elm_check_state_set(fixed_w_check, ld->fixed_w);
|
||||
elm_check_state_set(fixed_h_check, ld->fixed_h);
|
||||
elm_object_text_set(fixed_w_check, "width");
|
||||
elm_object_text_set(fixed_h_check, "height");
|
||||
elm_box_pack_end(fixed_box, fixed_w_check);
|
||||
elm_box_pack_end(fixed_box, fixed_h_check);
|
||||
evas_object_show(fixed_w_check);
|
||||
evas_object_show(fixed_h_check);
|
||||
|
||||
evas_object_smart_callback_add(fixed_w_check, "changed",
|
||||
fixed_w_check_changed_cb, ld);
|
||||
evas_object_smart_callback_add(fixed_h_check, "changed",
|
||||
fixed_h_check_changed_cb, ld);
|
||||
|
||||
elm_object_content_set(ld->fixed_ctxpopup, fixed_box);
|
||||
evas_object_show(ld->fixed_ctxpopup);
|
||||
rel_to_values_reset(ld);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2092,8 +2056,9 @@ live_edit_layer_set(live_data *ld)
|
|||
live_edit_update_internal(ld);
|
||||
info_text_init(ld);
|
||||
live_edit_auto_align_target_parts_init(ld, EINA_FALSE);
|
||||
show_fixed_check_list(ld);
|
||||
ld->last_cp = Ctrl_Pt_Cnt;
|
||||
|
||||
panes_live_view_fixed_bar_visible_set(EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2220,6 +2185,8 @@ live_edit_cancel(void)
|
|||
ld->align_top = EINA_FALSE;
|
||||
ld->align_bottom = EINA_FALSE;
|
||||
|
||||
panes_live_view_fixed_bar_visible_set(EINA_FALSE);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -2270,3 +2237,38 @@ live_edit_term(void)
|
|||
free(ld);
|
||||
g_ld = NULL;
|
||||
}
|
||||
|
||||
Evas_Object *
|
||||
live_edit_fixed_bar_get()
|
||||
{
|
||||
live_data *ld = g_ld;
|
||||
|
||||
if (!ld)
|
||||
{
|
||||
EINA_LOG_ERR(_("Failed to load live edit data!"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Create fixed bar for setting fixed option
|
||||
Evas_Object *fixed_box = elm_box_add(base_layout_get());
|
||||
elm_box_padding_set(fixed_box, 50, 0);
|
||||
elm_box_horizontal_set(fixed_box, EINA_TRUE);
|
||||
evas_object_show(fixed_box);
|
||||
|
||||
Evas_Object *fixed_w_check = elm_check_add(fixed_box);
|
||||
Evas_Object *fixed_h_check = elm_check_add(fixed_box);
|
||||
|
||||
elm_check_state_set(fixed_w_check, EINA_FALSE);
|
||||
elm_check_state_set(fixed_h_check, EINA_FALSE);
|
||||
elm_object_text_set(fixed_w_check, "Fixed Width");
|
||||
elm_object_text_set(fixed_h_check, "Fixed Height");
|
||||
elm_box_pack_end(fixed_box, fixed_w_check);
|
||||
elm_box_pack_end(fixed_box, fixed_h_check);
|
||||
evas_object_show(fixed_w_check);
|
||||
evas_object_show(fixed_h_check);
|
||||
|
||||
evas_object_smart_callback_add(fixed_w_check, "changed", fixed_w_check_changed_cb, ld);
|
||||
evas_object_smart_callback_add(fixed_h_check, "changed", fixed_h_check_changed_cb, ld);
|
||||
|
||||
return fixed_box;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,9 @@ static void
|
|||
tools_set(void)
|
||||
{
|
||||
tools_init(base_layout_get());
|
||||
base_tools_set(tools_live_view_get(), tools_text_editor_get());
|
||||
base_tools_set(tools_live_view_get(),
|
||||
tools_text_editor_get(),
|
||||
live_edit_fixed_bar_get());
|
||||
tools_update();
|
||||
}
|
||||
|
||||
|
@ -899,12 +901,12 @@ init(app_data *ad, int argc, char **argv)
|
|||
if (!config_data_set(argc, argv, &default_edc, &template))
|
||||
return EINA_FALSE;
|
||||
newfile_default_set(default_edc);
|
||||
live_edit_init();
|
||||
base_gui_init();
|
||||
statusbar_set();
|
||||
enventor_setup(ad);
|
||||
file_mgr_init();
|
||||
tools_set();
|
||||
live_edit_init();
|
||||
|
||||
base_gui_show();
|
||||
|
||||
|
|
|
@ -393,6 +393,17 @@ panes_live_view_tools_set(Evas_Object *tools)
|
|||
elm_object_part_content_set(live_view, "elm.swallow.tools", tools);
|
||||
}
|
||||
|
||||
void
|
||||
panes_live_view_fixed_bar_set(Evas_Object *live_view_fixed_bar)
|
||||
{
|
||||
panes_data *pd = g_pd;
|
||||
if (!pd) return;
|
||||
|
||||
Evas_Object *live_view = elm_object_part_content_get(pd->horiz.obj, "left");
|
||||
elm_object_part_content_set(live_view, "elm.swallow.fixed_bar", live_view_fixed_bar);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
panes_text_editor_tools_set(Evas_Object *tools)
|
||||
{
|
||||
|
@ -418,6 +429,21 @@ panes_live_view_tools_visible_set(Eina_Bool visible)
|
|||
elm_object_signal_emit(live_view, "elm,state,tools,hide", "");
|
||||
}
|
||||
|
||||
void
|
||||
panes_live_view_fixed_bar_visible_set(Eina_Bool visible)
|
||||
{
|
||||
panes_data *pd = g_pd;
|
||||
if (!pd) return;
|
||||
|
||||
Evas_Object *live_view = elm_object_part_content_get(pd->horiz.obj, "left");
|
||||
|
||||
if (visible)
|
||||
elm_object_signal_emit(live_view, "elm,state,fixed_bar,show", "");
|
||||
else
|
||||
elm_object_signal_emit(live_view, "elm,state,fixed_bar,hide", "");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
panes_text_editor_tools_visible_set(Eina_Bool visible)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ void base_win_resize_object_add(Evas_Object *resize_obj);
|
|||
void base_title_set(const char *path);
|
||||
void base_statusbar_toggle(Eina_Bool config);
|
||||
void base_tools_toggle(Eina_Bool config);
|
||||
void base_tools_set(Evas_Object *live_view_tools, Evas_Object *text_editor_tools);
|
||||
void base_tools_set(Evas_Object *live_view_tools, Evas_Object *text_editor_tools, Evas_Object *live_edit_fixed_bar);
|
||||
void base_enventor_full_view(void);
|
||||
void base_live_view_full_view(void);
|
||||
void base_editors_full_view(void);
|
||||
|
|
|
@ -11,3 +11,4 @@ Eina_Bool live_edit_cancel(void);
|
|||
Eina_Bool live_edit_get(void);
|
||||
void live_edit_update(void);
|
||||
Eina_List *live_edit_tools_create(Evas_Object *parent);
|
||||
Evas_Object *live_edit_fixed_bar_get();
|
||||
|
|
|
@ -11,6 +11,8 @@ void panes_text_editor_set(Evas_Object *text_editor);
|
|||
void panes_console_set(Evas_Object *console);
|
||||
Eina_Bool panes_editors_full_view_get(void);
|
||||
void panes_live_view_tools_set(Evas_Object *tools);
|
||||
void panes_live_view_fixed_bar_set(Evas_Object *live_view_fixed_bar);
|
||||
void panes_text_editor_tools_set(Evas_Object *tools);
|
||||
void panes_live_view_tools_visible_set(Eina_Bool visible);
|
||||
void panes_live_view_fixed_bar_visible_set(Eina_Bool visible);
|
||||
void panes_text_editor_tools_visible_set(Eina_Bool visible);
|
||||
|
|
Loading…
Reference in New Issue