Avoid infinite recalculation loop.
This commit is contained in:
parent
acce34c9dc
commit
7f0f6159a8
@ -6,3 +6,4 @@
|
||||
-> more configuration options (speed and drive choice)
|
||||
-> fix combo theme
|
||||
-> vlagrind errors in evas_box--
|
||||
-> move callbacks to buttons instead of swallow
|
||||
|
@ -120,6 +120,50 @@ group {
|
||||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "ecdb/burn_image/drive";
|
||||
type: SWALLOW;
|
||||
repeat_events: 1;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
|
||||
rel1 {
|
||||
to: "ecdb/burn_image/file";
|
||||
relative: 0.0 1.0;
|
||||
offset: 0 5;
|
||||
}
|
||||
|
||||
rel2 {
|
||||
to: "ecdb/burn_image/file";
|
||||
relative: 1.0 1.0;
|
||||
offset: 0 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "ecdb/burn_image/speed";
|
||||
type: SWALLOW;
|
||||
repeat_events: 1;
|
||||
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
|
||||
rel1 {
|
||||
to: "ecdb/burn_image/drive";
|
||||
relative: 0.0 1.0;
|
||||
offset: 0 5;
|
||||
}
|
||||
|
||||
rel2 {
|
||||
to: "ecdb/burn_image/drive";
|
||||
relative: 1.0 1.0;
|
||||
offset: 0 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part {
|
||||
name: "progress_outline";
|
||||
type: IMAGE;
|
||||
|
@ -431,7 +431,7 @@ group {
|
||||
}
|
||||
|
||||
box {
|
||||
layout: "min_size";
|
||||
layout: "vertical";
|
||||
padding: 1 1;
|
||||
align: 0.0 0.5;
|
||||
}
|
||||
|
@ -806,8 +806,12 @@ ecdb_burn_image_page_show(void)
|
||||
|
||||
if (!swallow)
|
||||
{
|
||||
Evas_Object *b;
|
||||
Evas_Object *b, *c1, *c2;
|
||||
Eina_List *l;
|
||||
Ecdb_Drive_Info *drive;
|
||||
Evas_Coord x, y, w, h;
|
||||
char buf[1024];
|
||||
int i, write_speed_count;
|
||||
|
||||
swallow = edje_object_add(ecore_evas_get(em->main_win_ee));
|
||||
edje_object_file_set(swallow, em->theme_path, "ecdb/burn_image_page");
|
||||
@ -842,6 +846,37 @@ ecdb_burn_image_page_show(void)
|
||||
b = ecdb_entry_add(swallow, "ecdb/burn_image/file");
|
||||
ecdb_entry_text_set(b, "Burn File");
|
||||
evas_object_show(b);
|
||||
|
||||
c1 = ecdb_combo_add(swallow, "ecdb/burn_image/drive");
|
||||
ecdb_combo_header_set(c1, "Drive");
|
||||
evas_object_show(c1);
|
||||
|
||||
c2 = ecdb_combo_add(swallow, "ecdb/burn_image/speed");
|
||||
ecdb_combo_header_set(c2, "Speed");
|
||||
evas_object_show(c2);
|
||||
|
||||
EINA_LIST_FOREACH(em->drives, l, drive)
|
||||
{
|
||||
b = ecdb_button_add(c1, NULL);
|
||||
ecdb_button_label_set(b, drive->product);
|
||||
ecdb_combo_append(c1, b);
|
||||
evas_object_show(b);
|
||||
|
||||
// Need to set this
|
||||
write_speed_count = drive->write_speeds[0];
|
||||
for (i = 1; i < write_speed_count; i++)
|
||||
{
|
||||
if (drive->write_speeds[i] <= 0)
|
||||
break;
|
||||
|
||||
b = ecdb_button_add(c2, NULL);
|
||||
snprintf(buf, sizeof(buf), "%d", drive->write_speeds[i]);
|
||||
printf("speed: %d\n", drive->write_speeds[i]);
|
||||
ecdb_button_label_set(b, buf);
|
||||
ecdb_combo_append(c2, b);
|
||||
evas_object_show(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (edje_object_part_swallow_get(gui, "action_area") != swallow)
|
||||
|
@ -303,6 +303,7 @@ struct _Combo_Data
|
||||
Evas_Object *, int);
|
||||
};
|
||||
|
||||
/*
|
||||
static void
|
||||
_combo_min_size(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
|
||||
{
|
||||
@ -317,19 +318,18 @@ _combo_min_size(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
|
||||
|
||||
evas_object_geometry_get(o, &offset_x, &offset_y, &w, &h);
|
||||
y = offset_y + (h / 2);
|
||||
p->children = eina_list_nth_list(p->children, 0);
|
||||
opt = eina_list_nth(p->children, 0);
|
||||
h = 30;
|
||||
edje_object_size_min_get(opt->obj, NULL, &h);
|
||||
EINA_LIST_FOREACH(p->children, l, opt)
|
||||
{
|
||||
edje_object_size_min_get(eina_list_nth(p->children, 0), NULL, &h);
|
||||
evas_object_geometry_get(opt->obj, &xt, &yt, &wt, &ht);
|
||||
if ((wt != w) || (ht != h))
|
||||
evas_object_resize(opt->obj, w, h);
|
||||
|
||||
if ((xt != 0) || (yt != y))
|
||||
evas_object_move(opt->obj, offset_x, y);
|
||||
|
||||
evas_object_resize(opt->obj, w, h);
|
||||
evas_object_move(opt->obj, offset_x, y);
|
||||
y += h;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Axis preferential -- for now vertical
|
||||
const char *
|
||||
@ -404,11 +404,12 @@ _combo_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
eina_iterator_free(it);
|
||||
|
||||
// Should I send the part name? The the normal widget_add would handle
|
||||
// the swallowing
|
||||
cd->selected = i;
|
||||
header = cd->create_header(data, "ecdb.header.swallow", swallow, i);
|
||||
|
||||
if (cd->create_header)
|
||||
header = cd->create_header(data, "ecdb.header.swallow", swallow, i);
|
||||
edje_object_signal_emit(data, "ecdb,combo,header,swallow", "ecdb");
|
||||
ecdb_combo_collapse(data);
|
||||
}
|
||||
@ -468,9 +469,8 @@ ecdb_combo_add(Evas_Object *parent, const char *name)
|
||||
edje_object_file_set(cd->popup, em->theme_path, "ecdb/combo/popup");
|
||||
edje_object_signal_callback_add(cd->back, "ecdb,combo,back,dismiss", "ecdb",
|
||||
_combo_moveable_click_cb, c);
|
||||
edje_box_layout_register("min_size", _combo_min_size, NULL, NULL, NULL,
|
||||
NULL);
|
||||
|
||||
//edje_box_layout_register("min_size", _combo_min_size, NULL, NULL, NULL,
|
||||
// NULL);
|
||||
evas_object_pass_events_set(cd->popup, 1);
|
||||
evas_object_show(cd->popup);
|
||||
|
||||
@ -508,10 +508,12 @@ void
|
||||
ecdb_combo_expand(Evas_Object *c)
|
||||
{
|
||||
Combo_Data *cd;
|
||||
Eina_Iterator *it;
|
||||
Evas_Object *o;
|
||||
const Evas_Object *box;
|
||||
const char *location;
|
||||
char buf[1024];
|
||||
int x, y, w, h, h2;
|
||||
int box_height = 30;
|
||||
int x, y, w, h, h2, padding;
|
||||
|
||||
cd = evas_object_data_get(c, "cd");
|
||||
|
||||
@ -524,17 +526,33 @@ ecdb_combo_expand(Evas_Object *c)
|
||||
evas_object_layer_set(cd->back, evas_object_layer_get(c) + 1);
|
||||
edje_object_signal_emit(cd->back, "ecdb,combo,back,show", "ecdb");
|
||||
|
||||
|
||||
location = _combo_best_location(c);
|
||||
snprintf(buf, sizeof(buf), "ecdb,combo,popup,show,%s", location);
|
||||
evas_object_geometry_get(c, &x, &y, &w, &h);
|
||||
|
||||
h2 = box_height * cd->count;
|
||||
box = edje_object_part_object_get(cd->popup, "ecdb.box");
|
||||
evas_object_box_padding_get(box, NULL, &padding);
|
||||
h2 = -padding;
|
||||
|
||||
/* Now resize the attached object... There is code to do this in the
|
||||
* layout, which makes more sense. However, it goes into an infinite loop,
|
||||
* so resize here for now
|
||||
*/
|
||||
it = evas_object_box_iterator_new(edje_object_part_object_get(cd->popup,
|
||||
"ecdb.box"));
|
||||
while (eina_iterator_next(it, (void **)&o))
|
||||
{
|
||||
edje_object_size_min_get(o, NULL, &h);
|
||||
evas_object_resize(o, w, h);
|
||||
h2 += h + padding;
|
||||
}
|
||||
|
||||
if (!strcmp(location, "top"))
|
||||
evas_object_move(cd->popup, x, y - h2);
|
||||
else
|
||||
evas_object_move(cd->popup, x, y + h);
|
||||
|
||||
eina_iterator_free(it);
|
||||
evas_object_resize(cd->popup, w, h2);
|
||||
evas_object_pass_events_set(cd->popup, 0);
|
||||
evas_object_layer_set(cd->popup, evas_object_layer_get(cd->back) + 1);
|
||||
@ -579,6 +597,15 @@ ecdb_combo_header_create_set(Evas_Object *c, Evas_Object * (*func)
|
||||
cd->create_header = func;
|
||||
}
|
||||
|
||||
int
|
||||
ecdb_combo_selected_get(Evas_Object *c)
|
||||
{
|
||||
Combo_Data *cd;
|
||||
|
||||
cd = evas_object_data_get(c, "cd");
|
||||
|
||||
return cd->selected;
|
||||
}
|
||||
|
||||
/******************************* Label ***************************************/
|
||||
|
||||
|
@ -32,6 +32,7 @@ void ecdb_combo_header_create_set(Evas_Object *c, Evas_Object *
|
||||
const char *name,
|
||||
Evas_Object *clicked,
|
||||
int idx));
|
||||
int ecdb_combo_selected_get(Evas_Object *c);
|
||||
|
||||
Evas_Object *ecdb_label_add(Evas_Object *parent, const char *name);
|
||||
void ecdb_label_text_set(Evas_Object *l, const char *text);
|
||||
|
Loading…
Reference in New Issue
Block a user