[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-376-g07c7ea8)



The branch, master has been updated
       via  07c7ea85f21c05b24513f1b087d839f098456408 (commit)
      from  a8ae46996fe78d138e83a99744e7ade0036399bc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 libgeda/include/prototype.h |    1 +
 libgeda/src/s_page.c        |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)


=================
 Commit Messages
=================

commit 07c7ea85f21c05b24513f1b087d839f098456408
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 13 17:56:36 2008 +0000

    libgeda: Add function s_page_objects_in_region()
    
    s_page_objects_in_region() returns a GList of OBJECTs which are inside,
    or which intersect with the given region.

:100644 100644 8e3a6ed... 092e87f... M	libgeda/include/prototype.h
:100644 100644 8909194... e889d27... M	libgeda/src/s_page.c

=========
 Changes
=========

commit 07c7ea85f21c05b24513f1b087d839f098456408
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 13 17:56:36 2008 +0000

    libgeda: Add function s_page_objects_in_region()
    
    s_page_objects_in_region() returns a GList of OBJECTs which are inside,
    or which intersect with the given region.

diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 8e3a6ed..092e87f 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -412,6 +412,7 @@ gint s_page_autosave (TOPLEVEL *toplevel);
 void s_page_append (PAGE *page, OBJECT *object);
 void s_page_remove (PAGE *page, OBJECT *object);
 void s_page_delete_objects (TOPLEVEL *toplevel, PAGE *page);
+GList *s_page_objects_in_region (PAGE *page, int min_x, int min_y, int max_x, int max_y);
 
 /* s_papersizes.c */
 int s_papersizes_add_entry(char *new_papersize, int width, int height);
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index 8909194..e889d27 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -550,3 +550,35 @@ void s_page_delete_objects (TOPLEVEL *toplevel, PAGE *page)
   s_delete_object_glist (toplevel, page->object_list);
   page->object_list = NULL;
 }
+
+/*! \brief Find the objects in a given region
+ *
+ *  \par Function Description
+ *  Finds the objects which are inside, or intersect
+ *  the passed box shaped region.
+ *
+ *  \param [in] page    The PAGE the object is on.
+ *  \param [in] min_x   The smaller X coordinate of the region.
+ *  \param [in] min_y   The smaller Y coordinate of the region.
+ *  \param [in] max_x   The larger  X coordinate of the region.
+ *  \param [in] max_y   The larger  Y coordinate of the region.
+ *  \return The GList of OBJECTs in the region.
+ */
+GList *s_page_objects_in_region (PAGE *page, int min_x, int min_y,
+                                             int max_x, int max_y)
+{
+  GList *iter;
+  GList *list = NULL;
+
+  for (iter = page->object_list; iter != NULL; iter = g_list_next (iter)) {
+    OBJECT *object = iter->data;
+
+    if (object->w_right >= min_x && object->w_left   <= max_x &&
+        object->w_top   <= max_y && object->w_bottom >= min_y) {
+      list = g_list_prepend (list, object);
+    }
+  }
+
+  list = g_list_reverse (list);
+  return list;
+}




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs