From 36d53457b6ad8965dfc1a0110d75f3f4a3552a3b Mon Sep 17 00:00:00 2001
From: Edward Hennessy <[EMAIL PROTECTED]>
Date: Sat, 19 Jul 2008 07:34:08 -0700
Subject: [PATCH] Optimized o_find()
---
gschem/src/o_find.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gschem/src/o_find.c b/gschem/src/o_find.c
index e18fb5a..b060df2 100644
--- a/gschem/src/o_find.c
+++ b/gschem/src/o_find.c
@@ -55,7 +55,10 @@ gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int w_x,
int w_y,
/* do first search */
while (o_current != NULL) {
- if ( o_shortest_distance( o_current, w_x, w_y ) < w_slack ) {
+ if (inside_region(o_current->w_left - w_slack, o_current->w_top - w_slack,
+ o_current->w_right + w_slack, o_current->w_bottom +
w_slack,
+ w_x, w_y) &&
+ o_shortest_distance( o_current, w_x, w_y ) < w_slack ) {
if (o_current->sel_func != NULL &&
o_current->type != OBJ_HEAD &&
(o_current->visibility == VISIBLE ||
@@ -85,7 +88,10 @@ gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int w_x,
int w_y,
o_current = toplevel->page_current->object_head;
while (o_current != NULL &&
o_current != toplevel->page_current->object_lastplace) {
- if ( o_shortest_distance( o_current, w_x, w_y ) < w_slack ) {
+ if (inside_region(o_current->w_left - w_slack, o_current->w_top - w_slack,
+ o_current->w_right + w_slack, o_current->w_bottom +
w_slack,
+ w_x, w_y) &&
+ o_shortest_distance( o_current, w_x, w_y ) < w_slack ) {
if (o_current->sel_func != NULL &&
o_current->type != OBJ_HEAD &&
--
1.5.6
_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev