live_edit: fix the logic to support fixed size.
previous logic was corrupted at some point.
This commit is contained in:
parent
d88a2121e1
commit
98d9cf4cb0
|
@ -355,40 +355,42 @@ live_edit_insert(live_data *ld)
|
|||
if (!ld->rel_to_info.rel2_y_to)
|
||||
ld->rel_to_info.rel2_to_y = ld->rel_info.rel2_y;
|
||||
|
||||
//For Calculating min size
|
||||
Evas_Coord vw, vh;
|
||||
config_view_size_get(&vw, &vh);
|
||||
|
||||
//Calculate relative_to values to fix its size
|
||||
//in case of width and height are fixed
|
||||
Eina_Bool fixed_w = elm_check_state_get(ld->fixed_w_check);
|
||||
Evas_Coord min_w = 0;
|
||||
|
||||
if (!ld->rel_to_info.rel1_x_to && !ld->rel_to_info.rel1_y_to &&
|
||||
if (!ld->rel_to_info.rel1_x_to && !ld->rel_to_info.rel2_x_to &&
|
||||
elm_check_state_get(ld->fixed_w_check))
|
||||
{
|
||||
float rel_x = (ld->rel_to_info.rel1_to_x +
|
||||
ld->rel_to_info.rel2_to_x) / 2;
|
||||
ld->rel_to_info.rel2_to_x) / 2;
|
||||
ld->rel_to_info.rel1_to_x = rel_x;
|
||||
ld->rel_to_info.rel2_to_x = rel_x;
|
||||
min_w = (Evas_Coord) (((double) vw) *
|
||||
(ld->rel_info.rel2_x - ld->rel_info.rel1_x));
|
||||
|
||||
}
|
||||
|
||||
Eina_Bool fixed_h = elm_check_state_get(ld->fixed_h_check);
|
||||
Evas_Coord min_h = 0;
|
||||
|
||||
if (ld->rel_to_info.rel2_x_to && !ld->rel_to_info.rel2_y_to &&
|
||||
if (!ld->rel_to_info.rel1_y_to && !ld->rel_to_info.rel2_y_to &&
|
||||
elm_check_state_get(ld->fixed_h_check))
|
||||
{
|
||||
float rel_y = (ld->rel_to_info.rel1_to_y +
|
||||
ld->rel_to_info.rel2_to_y) / 2;
|
||||
ld->rel_to_info.rel2_to_y) / 2;
|
||||
ld->rel_to_info.rel1_to_y = rel_y;
|
||||
ld->rel_to_info.rel2_to_y = rel_y;
|
||||
|
||||
min_h = (Evas_Coord) (((double) vh) *
|
||||
(ld->rel_info.rel2_y - ld->rel_info.rel1_y));
|
||||
}
|
||||
|
||||
//Calculate min size
|
||||
Evas_Coord vw, vh;
|
||||
config_view_size_get(&vw, &vh);
|
||||
|
||||
Evas_Coord min_w = (Evas_Coord) (((double) vw) *
|
||||
(ld->rel_info.rel2_x - ld->rel_info.rel1_x));
|
||||
Evas_Coord min_h = (Evas_Coord) (((double) vh) *
|
||||
(ld->rel_info.rel2_y - ld->rel_info.rel1_y));
|
||||
|
||||
enventor_object_template_part_insert(base_enventor_get(),
|
||||
type,
|
||||
ENVENTOR_TEMPLATE_INSERT_LIVE_EDIT,
|
||||
|
@ -409,14 +411,10 @@ live_edit_insert(live_data *ld)
|
|||
NULL, 0);
|
||||
enventor_object_save(base_enventor_get(), config_input_path_get());
|
||||
|
||||
if (ld->rel_to_info.rel1_x_to)
|
||||
free(ld->rel_to_info.rel1_x_to);
|
||||
if (ld->rel_to_info.rel1_y_to)
|
||||
free(ld->rel_to_info.rel1_y_to);
|
||||
if (ld->rel_to_info.rel2_x_to)
|
||||
free(ld->rel_to_info.rel2_x_to);
|
||||
if (ld->rel_to_info.rel2_y_to)
|
||||
free(ld->rel_to_info.rel2_y_to);
|
||||
free(ld->rel_to_info.rel1_x_to);
|
||||
free(ld->rel_to_info.rel1_y_to);
|
||||
free(ld->rel_to_info.rel2_x_to);
|
||||
free(ld->rel_to_info.rel2_y_to);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -295,34 +295,10 @@ template_part_insert(edit_data *ed, Edje_Part_Type part_type,
|
|||
line_cnt++;
|
||||
|
||||
//Width is fixed or Height is fixed
|
||||
if ((fixed_w && !fixed_h) || (!fixed_w && fixed_h))
|
||||
{
|
||||
if (align_x != 0.5)
|
||||
{
|
||||
elm_entry_entry_insert(edit_entry, p);
|
||||
snprintf(buf, sizeof(buf), " fixed: %d %d;<br/>", 1, 0);
|
||||
elm_entry_entry_insert(edit_entry, buf);
|
||||
elm_entry_entry_insert(edit_entry, p);
|
||||
snprintf(buf, sizeof(buf), " min: %d %d;<br/>", min_w, 0);
|
||||
elm_entry_entry_insert(edit_entry, buf);
|
||||
line_cnt += 2;
|
||||
}
|
||||
else if (align_y != 0.5)
|
||||
{
|
||||
elm_entry_entry_insert(edit_entry, p);
|
||||
snprintf(buf, sizeof(buf), " fixed: %d %d;<br/>", 0, 1);
|
||||
elm_entry_entry_insert(edit_entry, buf);
|
||||
elm_entry_entry_insert(edit_entry, p);
|
||||
snprintf(buf, sizeof(buf), " min: %d %d;<br/>", 0, min_h);
|
||||
elm_entry_entry_insert(edit_entry, buf);
|
||||
line_cnt += 2;
|
||||
}
|
||||
}
|
||||
//Width and Height are fixed
|
||||
else if(fixed_w && fixed_h)
|
||||
if (fixed_w || fixed_h)
|
||||
{
|
||||
elm_entry_entry_insert(edit_entry, p);
|
||||
snprintf(buf, sizeof(buf), " fixed: %d %d;<br/>", 1, 1);
|
||||
snprintf(buf, sizeof(buf), " fixed: %d %d;<br/>", fixed_w, fixed_h);
|
||||
elm_entry_entry_insert(edit_entry, buf);
|
||||
elm_entry_entry_insert(edit_entry, p);
|
||||
snprintf(buf, sizeof(buf), " min: %d %d;<br/>", min_w, min_h);
|
||||
|
|
Loading…
Reference in New Issue