mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-29 20:15:54 +02:00
eeshow/gui/aoi.c: make searches only consider AoIs supporting desired function
This commit is contained in:
parent
10c1d0ede0
commit
96fa1a2f62
@ -57,17 +57,6 @@ static bool in_aoi(const struct aoi *aoi, int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct aoi *find_aoi(const struct aoi *aois, int x, int y)
|
|
||||||
{
|
|
||||||
const struct aoi *aoi;
|
|
||||||
|
|
||||||
for (aoi = aois; aoi; aoi = aoi->next)
|
|
||||||
if (in_aoi(aoi, x, y))
|
|
||||||
break;
|
|
||||||
return aoi;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool aoi_hover(const struct aoi *aois, int x, int y)
|
bool aoi_hover(const struct aoi *aois, int x, int y)
|
||||||
{
|
{
|
||||||
const struct aoi *aoi;
|
const struct aoi *aoi;
|
||||||
@ -79,8 +68,9 @@ bool aoi_hover(const struct aoi *aois, int x, int y)
|
|||||||
hovering = NULL;
|
hovering = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
aoi = find_aoi(aois, x, y);
|
for (aoi = aois; aoi; aoi = aoi->next)
|
||||||
if (aoi && aoi->hover && aoi->hover(aoi->user, 1)) {
|
if (aoi->hover && in_aoi(aoi, x, y) &&
|
||||||
|
aoi->hover(aoi->user, 1)) {
|
||||||
hovering = aoi;
|
hovering = aoi;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -110,12 +100,13 @@ bool aoi_click(const struct aoi *aois, int x, int y)
|
|||||||
if (need_dehover(aois, x, y))
|
if (need_dehover(aois, x, y))
|
||||||
aoi_dehover();
|
aoi_dehover();
|
||||||
|
|
||||||
aoi = find_aoi(aois, x, y);
|
for (aoi = aois; aoi; aoi = aoi->next)
|
||||||
if (!aoi || !aoi->click)
|
if (aoi->click && in_aoi(aoi, x, y)) {
|
||||||
return 0;
|
|
||||||
aoi->click(aoi->user);
|
aoi->click(aoi->user);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void aoi_set_related(struct aoi *aoi, const struct aoi *related)
|
void aoi_set_related(struct aoi *aoi, const struct aoi *related)
|
||||||
|
Loading…
Reference in New Issue
Block a user