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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-187-g0f93a4b)



The branch, master has been updated
       via  0f93a4b4d52da6c7c34c6420cdb93263d5b5bbdc (commit)
       via  04774120c0ab1701e10fcc2709cd3a9963d0a54f (commit)
      from  46b923ea26b1732c757267e77c514d15912a1514 (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
=========

 gschem/include/prototype.h |    4 ++
 gschem/src/o_basic.c       |  125 ++++++++++++++++++++++++++++++++------------
 gschem/src/x_basic.c       |    3 +-
 3 files changed, 96 insertions(+), 36 deletions(-)


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

commit 0f93a4b4d52da6c7c34c6420cdb93263d5b5bbdc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Sep 27 02:03:13 2008 +0100

    Make use of new object invalidating API to avoid duplicated code.

:100644 100644 27cd57f... fd83859... M	gschem/src/o_basic.c
:100644 100644 77f2d4c... 608e46c... M	gschem/src/x_basic.c

commit 04774120c0ab1701e10fcc2709cd3a9963d0a54f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Sep 27 02:00:47 2008 +0100

    Add API for invalidating drawing of a given object or list of objects.
    
    Avoids needing to lookup and pass bounds of an object being invalidated.
    
    Adds:
      void o_invalidate_all (GSCHEM_TOPLEVEL *w_current);
      void o_invalidate (GSCHEM_TOPLEVEL *w_current, OBJECT *object);
      void o_invalidate_list (GSCHEM_TOPLEVEL *w_current, OBJECT *list);
      void o_invalidate_glist (GSCHEM_TOPLEVEL *w_current, GList *list);

:100644 100644 9fa556c... 96b6ed6... M	gschem/include/prototype.h
:100644 100644 4246189... 27cd57f... M	gschem/src/o_basic.c

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

commit 0f93a4b4d52da6c7c34c6420cdb93263d5b5bbdc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Sep 27 02:03:13 2008 +0100

    Make use of new object invalidating API to avoid duplicated code.

diff --git a/gschem/src/o_basic.c b/gschem/src/o_basic.c
index 27cd57f..fd83859 100644
--- a/gschem/src/o_basic.c
+++ b/gschem/src/o_basic.c
@@ -90,8 +90,6 @@ void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *list, gboolean draw_selected)
   TOPLEVEL *toplevel = w_current->toplevel;
   OBJECT *o_current = list;
   int redraw_state = toplevel->DONT_REDRAW;
-  int left, top, bottom, right;
-  int s_left, s_top, s_bottom, s_right;
 
   w_current->inside_redraw = 1;
   while (o_current != NULL) {
@@ -108,12 +106,7 @@ void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *list, gboolean draw_selected)
   w_current->inside_redraw = 0;
   toplevel->DONT_REDRAW = redraw_state;
 
-  if (world_get_object_list_bounds(toplevel, list, &left,  &top,
-                                                   &right, &bottom)) {
-    WORLDtoSCREEN( toplevel, left, top, &s_left, &s_top );
-    WORLDtoSCREEN( toplevel, right, bottom, &s_right, &s_bottom );
-    o_invalidate_rect( w_current, s_left, s_top, s_right, s_bottom );
-  }
+  o_invalidate_list (w_current, list);
 }
 
 /*! \brief Redraw an object on the screen.
@@ -127,8 +120,6 @@ void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *list, gboolean draw_selected)
 void o_redraw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  int left, top, right, bottom;
-  int s_left, s_top, s_right, s_bottom;
 
   if (o_current == NULL)
   return;
@@ -142,12 +133,7 @@ void o_redraw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
     w_current->inside_redraw = 0;
   }
 
-  if (world_get_single_object_bounds(toplevel, o_current, &left,  &top,
-                                                          &right, &bottom)) {
-    WORLDtoSCREEN(toplevel, left, top, &s_left, &s_top);
-    WORLDtoSCREEN(toplevel, right, bottom, &s_right, &s_bottom);
-    o_invalidate_rect (w_current, s_left,  s_bottom, s_right, s_top);
-  }
+  o_invalidate (w_current, o_current);
 }
 
 /*! \todo Finish function documentation!!!
@@ -215,8 +201,6 @@ void o_erase_selected(GSCHEM_TOPLEVEL *w_current)
   GList *list;
   GList *iter;
   OBJECT* o_current;
-  int left, top, right, bottom;
-  int s_left, s_top, s_right, s_bottom;
 
   if (w_current->inside_redraw) {
     return;
@@ -234,12 +218,7 @@ void o_erase_selected(GSCHEM_TOPLEVEL *w_current)
     iter = g_list_next( iter );
   }
 
-  if (world_get_object_glist_bounds(toplevel, list, &left,  &top,
-                                                    &right, &bottom)) {
-    WORLDtoSCREEN(toplevel, left, top, &s_left, &s_top);
-    WORLDtoSCREEN(toplevel, right, bottom, &s_right, &s_bottom);
-    o_invalidate_rect (w_current, s_left,  s_bottom, s_right, s_top);
-  }
+  o_invalidate_glist (w_current, list);
 }
 
 /*! \brief Erase a given OBJECT
@@ -260,8 +239,6 @@ void o_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   OBJECT *o_current;
-  int left, top, right, bottom;
-  int s_left, s_top, s_right, s_bottom;
 
   if (w_current->inside_redraw) {
     return;
@@ -278,12 +255,7 @@ void o_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
   }
   toplevel->override_color = -1;
 
-  if (world_get_single_object_bounds(toplevel, o_current, &left,  &top,
-                                                          &right, &bottom)) {
-    WORLDtoSCREEN(toplevel, left, top, &s_left, &s_top);
-    WORLDtoSCREEN(toplevel, right, bottom, &s_right, &s_bottom);
-    o_invalidate_rect (w_current, s_left,  s_bottom, s_right, s_top);
-  }
+  o_invalidate (w_current, o_current);
 }
 
 /*! \todo Finish function documentation!!!
diff --git a/gschem/src/x_basic.c b/gschem/src/x_basic.c
index 77f2d4c..608e46c 100644
--- a/gschem/src/x_basic.c
+++ b/gschem/src/x_basic.c
@@ -49,8 +49,7 @@ void x_repaint_background(GSCHEM_TOPLEVEL *w_current)
                        w_current->gc, TRUE, 0, 0,
                        w_current->win_width,
                        w_current->win_height);
-    o_invalidate_rect(w_current,
-                      0, 0, w_current->win_width, w_current->win_height);
+    o_invalidate_all (w_current);
 
     x_grid_draw(w_current);
 

commit 04774120c0ab1701e10fcc2709cd3a9963d0a54f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Sep 27 02:00:47 2008 +0100

    Add API for invalidating drawing of a given object or list of objects.
    
    Avoids needing to lookup and pass bounds of an object being invalidated.
    
    Adds:
      void o_invalidate_all (GSCHEM_TOPLEVEL *w_current);
      void o_invalidate (GSCHEM_TOPLEVEL *w_current, OBJECT *object);
      void o_invalidate_list (GSCHEM_TOPLEVEL *w_current, OBJECT *list);
      void o_invalidate_glist (GSCHEM_TOPLEVEL *w_current, GList *list);

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 9fa556c..96b6ed6 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -493,6 +493,10 @@ void o_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *object);
 void o_list_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *list);
 void o_glist_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, GList *list);
 void o_invalidate_rect(GSCHEM_TOPLEVEL *w_current, int x1, int y1, int x2, int y2);
+void o_invalidate_all(GSCHEM_TOPLEVEL *w_current);
+void o_invalidate(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
+void o_invalidate_list(GSCHEM_TOPLEVEL *w_current, OBJECT *list);
+void o_invalidate_glist(GSCHEM_TOPLEVEL *w_current, GList *list);
 void o_erase_grips (GSCHEM_TOPLEVEL *w_current, OBJECT *object);
 /* o_box.c */
 void o_box_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
diff --git a/gschem/src/o_basic.c b/gschem/src/o_basic.c
index 4246189..27cd57f 100644
--- a/gschem/src/o_basic.c
+++ b/gschem/src/o_basic.c
@@ -669,8 +669,8 @@ void o_glist_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, GList *list)
  *  \param [in] x2         X coord for corner 2 (SCREEN units)
  *  \param [in] y2         Y coord for corner 2 (SCREEN units)
  */
-void o_invalidate_rect( GSCHEM_TOPLEVEL *w_current,
-                        int x1, int y1, int x2, int y2 )
+void o_invalidate_rect (GSCHEM_TOPLEVEL *w_current,
+                        int x1, int y1, int x2, int y2)
 {
   GdkRectangle rect;
 
@@ -686,6 +686,91 @@ void o_invalidate_rect( GSCHEM_TOPLEVEL *w_current,
   gdk_window_invalidate_rect( w_current->window, &rect, FALSE );
 }
 
+
+/*! \brief Invalidate the whole on-screen area
+ *
+ *  \par Function Description
+ *  This function calls gdk_window_invalidate_rect() with a rect
+ *  of NULL, causing the entire drawing area to be invalidated.
+ *
+ *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
+ *  \param [in] object     The OBJECT invalidated on screen.
+ */
+void o_invalidate_all (GSCHEM_TOPLEVEL *w_current)
+{
+  gdk_window_invalidate_rect (w_current->window, NULL, FALSE);
+}
+
+
+/*! \brief Invalidate on-screen area for an object
+ *
+ *  \par Function Description
+ *  This function calls o_invalidate_rect() with the bounds of the
+ *  passed OBJECT, converted to screen coordinates.
+ *
+ *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
+ *  \param [in] object     The OBJECT invalidated on screen.
+ */
+void o_invalidate (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
+{
+  TOPLEVEL *toplevel = w_current->toplevel;
+  int left, top, bottom, right;
+  int s_left, s_top, s_bottom, s_right;
+  if (world_get_single_object_bounds(toplevel, object, &left,  &top,
+                                                       &right, &bottom)) {
+    WORLDtoSCREEN (toplevel, left, top, &s_left, &s_top);
+    WORLDtoSCREEN (toplevel, right, bottom, &s_right, &s_bottom);
+    o_invalidate_rect (w_current, s_left, s_top, s_right, s_bottom);
+  }
+}
+
+
+/*! \brief Invalidate on-screen area for a list of objects
+ *
+ *  \par Function Description
+ *  This function calls o_invalidate_rect() with the bounds of the
+ *  passed object list, converted to screen coordinates.
+ *
+ *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
+ *  \param [in] list       The list objects invalidated on screen.
+ */
+void o_invalidate_list (GSCHEM_TOPLEVEL *w_current, OBJECT *list)
+{
+  TOPLEVEL *toplevel = w_current->toplevel;
+  int left, top, bottom, right;
+  int s_left, s_top, s_bottom, s_right;
+  if (world_get_object_list_bounds (toplevel, list, &left,  &top,
+                                                    &right, &bottom)) {
+    WORLDtoSCREEN (toplevel, left, top, &s_left, &s_top);
+    WORLDtoSCREEN (toplevel, right, bottom, &s_right, &s_bottom);
+    o_invalidate_rect (w_current, s_left, s_top, s_right, s_bottom);
+  }
+}
+
+
+/*! \brief Invalidate on-screen area for a GList of objects
+ *
+ *  \par Function Description
+ *  This function calls o_invalidate_rect() with the bounds of the
+ *  passed GList, converted to screen coordinates.
+ *
+ *  \param [in] w_current  The GSCHEM_TOPLEVEL object.
+ *  \param [in] list       The glist objects invalidated on screen.
+ */
+void o_invalidate_glist (GSCHEM_TOPLEVEL *w_current, GList *list)
+{
+  TOPLEVEL *toplevel = w_current->toplevel;
+  int left, top, bottom, right;
+  int s_left, s_top, s_bottom, s_right;
+  if (world_get_object_glist_bounds (toplevel, list, &left,  &top,
+                                                     &right, &bottom)) {
+    WORLDtoSCREEN (toplevel, left, top, &s_left, &s_top);
+    WORLDtoSCREEN (toplevel, right, bottom, &s_right, &s_bottom);
+    o_invalidate_rect (w_current, s_left, s_top, s_right, s_bottom);
+  }
+}
+
+
 /*! \brief Erase grip marks on object.
  *  \par Function Description
  *  This function erases the grips on the object \a object.




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