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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-174-gacb9623)



The branch, master has been updated
       via  acb96234eed1e51ab22b17cd718d5f627d292a96 (commit)
       via  45efb32383b15576cc98a95e1d93d44793e6f2e8 (commit)
      from  806065ae428b105340fc6380918514bfe9746d86 (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/src/g_hook.c           |    3 +-
 gschem/src/o_complex.c        |   22 ++++-
 gschem/src/o_misc.c           |    3 +-
 gschem/src/o_net.c            |   23 +++--
 gschem/src/x_event.c          |    8 ++
 libgeda/include/prototype.h   |    5 +-
 libgeda/src/o_complex_basic.c |  221 ++++++++++++++++++++++++++++-------------
 7 files changed, 196 insertions(+), 89 deletions(-)


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

commit acb96234eed1e51ab22b17cd718d5f627d292a96
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Sep 22 02:05:14 2008 +0100

    gschem: Fix left/right scroll events to move the schematic left/right.
    
    Commit which broke this was 048bd6f8e2fc1c5f5b01ff3f1cad3a7c9bf43f3e.
    
    Looks like I broke the behaviour when I refactored the x_event_scroll()
    to support a more "gtk" style modifier binding as well as the classic
    gschem behaviour. The refactored code inadvertently lumped up/down and
    left/right scroll events together as if they were up/down events.
    
    Up/down scroll events retain their existing behaviour and act according
    to the (scroll-wheel "{gtk|classic}") configuration setting. Left/right
    scroll events now always scroll the schematic left and right,
    irrespective of modifier key.

:100644 100644 ae62d8f... d35597f... M	gschem/src/x_event.c

commit 45efb32383b15576cc98a95e1d93d44793e6f2e8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Sep 22 01:54:24 2008 +0100

    Move calls to attribute promotion code from inside o_complex_add()
    
    Previously o_complex_add() would perform attribute promotion or delete /
    hide eligible attributes depending on the "attribute_promotion" argument
    passed to o_complex_add(). Break these into separate operations:
    
    1. Get / add to OBJECT list, a single complex object with o_complex_add().
       This object has its prim_objs exactly as the symbol exists on disk.
    2. EITHER:
         Promote the eligible attribtues with o_complex_promote_attribs().
         (For GList based processing use o_complex_get_promotable(), attach
          the returned objects as attribs and place in the appropriate GList.)
       OR:
         Delete / hide eligible attributes with
         o_complex_remove_promotable_attribs()
    
    All behaviour relating to attribute promotion should be identical after
    this commit. If not, it is a bug should be reported. (This includes the
    insertion order of the OBJECT and it's attributes into the object list).

:100644 100644 b724230... 4f367d6... M	gschem/src/g_hook.c
:100644 100644 8779d73... 0406cfe... M	gschem/src/o_complex.c
:100644 100644 7349910... e434968... M	gschem/src/o_misc.c
:100644 100644 8fcec34... 3ea9943... M	gschem/src/o_net.c
:100644 100644 12c9130... 76cd6aa... M	libgeda/include/prototype.h
:100644 100644 fd10ee7... 5a7a7ff... M	libgeda/src/o_complex_basic.c

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

commit acb96234eed1e51ab22b17cd718d5f627d292a96
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Sep 22 02:05:14 2008 +0100

    gschem: Fix left/right scroll events to move the schematic left/right.
    
    Commit which broke this was 048bd6f8e2fc1c5f5b01ff3f1cad3a7c9bf43f3e.
    
    Looks like I broke the behaviour when I refactored the x_event_scroll()
    to support a more "gtk" style modifier binding as well as the classic
    gschem behaviour. The refactored code inadvertently lumped up/down and
    left/right scroll events together as if they were up/down events.
    
    Up/down scroll events retain their existing behaviour and act according
    to the (scroll-wheel "{gtk|classic}") configuration setting. Left/right
    scroll events now always scroll the schematic left and right,
    irrespective of modifier key.

diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index ae62d8f..d35597f 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -1198,6 +1198,14 @@ gint x_event_scroll (GtkWidget *widget, GdkEventScroll *event,
     pan_xaxis = !w_current->CONTROLKEY &&  w_current->SHIFTKEY;
   }
 
+  /* If the user has a left/right scroll wheel, always scroll the y-axis */
+  if (event->direction == GDK_SCROLL_LEFT ||
+      event->direction == GDK_SCROLL_RIGHT) {
+    zoom = FALSE;
+    pan_yaxis = FALSE;
+    pan_xaxis = TRUE;
+  }
+
   /* You must have scrollbars enabled if you want to use the scroll wheel to pan */
   if (!w_current->scrollbars_flag) {
     pan_xaxis = FALSE;

commit 45efb32383b15576cc98a95e1d93d44793e6f2e8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Sep 22 01:54:24 2008 +0100

    Move calls to attribute promotion code from inside o_complex_add()
    
    Previously o_complex_add() would perform attribute promotion or delete /
    hide eligible attributes depending on the "attribute_promotion" argument
    passed to o_complex_add(). Break these into separate operations:
    
    1. Get / add to OBJECT list, a single complex object with o_complex_add().
       This object has its prim_objs exactly as the symbol exists on disk.
    2. EITHER:
         Promote the eligible attribtues with o_complex_promote_attribs().
         (For GList based processing use o_complex_get_promotable(), attach
          the returned objects as attribs and place in the appropriate GList.)
       OR:
         Delete / hide eligible attributes with
         o_complex_remove_promotable_attribs()
    
    All behaviour relating to attribute promotion should be identical after
    this commit. If not, it is a bug should be reported. (This includes the
    insertion order of the OBJECT and it's attributes into the object list).

diff --git a/gschem/src/g_hook.c b/gschem/src/g_hook.c
index b724230..4f367d6 100644
--- a/gschem/src/g_hook.c
+++ b/gschem/src/g_hook.c
@@ -716,7 +716,8 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
                     x, y, 
                     angle, mirror,
                     clib, comp_name, 
-                    selectable, TRUE);
+                    selectable);
+  o_complex_promote_attribs (toplevel, new_object);
   
   /* 
    * For now, do not redraw the newly added complex, since this might cause
diff --git a/gschem/src/o_complex.c b/gschem/src/o_complex.c
index 8779d73..0406cfe 100644
--- a/gschem/src/o_complex.c
+++ b/gschem/src/o_complex.c
@@ -117,13 +117,27 @@ void o_complex_prepare_place(GSCHEM_TOPLEVEL *w_current, const char *sym_name)
       g_list_reverse (toplevel->page_current->place_list);
 
   } else { /* if (w_current->include_complex) {..} else { */
+    OBJECT *new_object;
+    GList *promoted;
 
     toplevel->ADDING_SEL = 1; /* reuse this flag, rename later hack */
     sym = s_clib_get_symbol_by_name (sym_name);
-    o_complex_add(toplevel, NULL,
-                  &(toplevel->page_current->place_list),
-                  OBJ_COMPLEX, WHITE, 0, 0, 0, 0,
-                  sym, sym_name, 1, TRUE);
+    new_object = o_complex_add (toplevel, NULL, NULL,
+                                OBJ_COMPLEX, WHITE, 0, 0, 0, 0,
+                                sym, sym_name, 1);
+    promoted = o_complex_get_promotable (toplevel, new_object, TRUE);
+
+    /* Attach promoted attributes to the original complex object */
+    o_attrib_attach_list (toplevel, promoted, new_object);
+
+    toplevel->page_current->place_list =
+      g_list_concat (toplevel->page_current->place_list, promoted);
+    toplevel->page_current->place_list =
+      g_list_append (toplevel->page_current->place_list, new_object);
+
+    /* Link the place list OBJECTs together for good measure */
+    o_glist_relink_objects (toplevel->page_current->place_list);
+
     toplevel->ADDING_SEL = 0;
 
     /* Flag the symbol as embedded if necessary */
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 7349910..e434968 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -777,7 +777,8 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
                                o_current->complex->angle,
                                o_current->complex->mirror,
                                clib, o_current->complex_basename,
-                               1, TRUE);
+                               1);
+  o_complex_promote_attribs (toplevel, new_complex);
 
   /* updating the old complex with data from the new one */
   /* first process the prim_objs: */
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index 8fcec34..3ea9943 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -1080,6 +1080,7 @@ int o_net_add_busrippers(GSCHEM_TOPLEVEL *w_current, OBJECT *net_obj,
 
 {
   TOPLEVEL *toplevel = w_current->toplevel;
+  OBJECT *new_obj;
   int color;
   GList *cl_current = NULL;
   OBJECT *bus_object = NULL;
@@ -1387,17 +1388,17 @@ int o_net_add_busrippers(GSCHEM_TOPLEVEL *w_current, OBJECT *net_obj,
 
         if (rippersym != NULL) {
           toplevel->page_current->object_tail =
-          (OBJECT *) o_complex_add(
-                                   toplevel,
-                                   toplevel->page_current->object_tail,
-				   NULL,
-                                   OBJ_COMPLEX, WHITE,
-                                   rippers[i].x[0], rippers[i].y[0],
-                                   complex_angle, 0,
-                                   rippersym,
-                                   toplevel->bus_ripper_symname, 1, TRUE);
-          
-          o_complex_draw(w_current,toplevel->page_current->object_tail);
+            new_obj = o_complex_add (toplevel,
+                                     toplevel->page_current->object_tail,
+                                     NULL,
+                                     OBJ_COMPLEX, WHITE,
+                                     rippers[i].x[0], rippers[i].y[0],
+                                     complex_angle, 0,
+                                     rippersym,
+                                     toplevel->bus_ripper_symname, 1);
+          o_complex_promote_attribs (toplevel, new_obj);
+
+          o_complex_draw (w_current, new_obj);
         } else {
           s_log_message(_("Bus ripper symbol [%s] was not found in any component library\n"),
                         toplevel->bus_ripper_symname);
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 12c9130..76cd6aa 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -180,11 +180,14 @@ int world_get_object_glist_bounds(TOPLEVEL *toplevel, GList *o_list,
 			     int *right, int *bottom);
 OBJECT *add_head(void);
 int o_complex_is_embedded(OBJECT *o_current);
+GList *o_complex_get_promotable (TOPLEVEL *toplevel, OBJECT *object, int detach);
+void o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object);
+void o_complex_remove_promotable_attribs (TOPLEVEL *toplevel, OBJECT *object);
 OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
 		      GList **object_glist, char type, int color, 
 		      int x, int y, int angle, int mirror, 
 		      const CLibSymbol *clib_sym, const gchar *basename,
-		      int selectable, int attribute_promotion);
+		      int selectable);
 OBJECT *o_complex_add_embedded(TOPLEVEL *toplevel, OBJECT *object_list, char type, int color, int x, int y, int angle, int mirror, const gchar *basename, int selectable);
 void o_complex_set_filename(TOPLEVEL *toplevel, const char *basename);
 void o_complex_translate_world(TOPLEVEL *toplevel, int dx, int dy, OBJECT *object);
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index fd10ee7..5a7a7ff 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -291,6 +291,132 @@ int o_complex_is_embedded(OBJECT *o_current)
 
 }
 
+
+/*! \brief Get attributes eligible for promotion from inside a complex
+ *
+ *  \par Function Description
+ *  Returns a GList of OBJECTs which are eligible for promotion from
+ *  within the passed complex OBJECT.
+ *
+ *  If detach is TRUE, the function removes these attribute objects from
+ *  the prim_objs of the complex. It detached, the returned OBJECTs are
+ *  isolated from each other, having their next and prev pointers set to NULL.
+ *
+ *  If detach is FALSE, the OBJECTs are left in place. Their next and prev
+ *  pointers form part of the complex's prim_objs linked list.
+ *
+ *  \param [in]  toplevel The toplevel environment.
+ *  \param [in]  object   The complex object being modified.
+ *  \param [in]  detach   Should the attributes be detached?
+ *  \returns              A linked list of OBJECTs to promote.
+ */
+GList *o_complex_get_promotable (TOPLEVEL *toplevel, OBJECT *object, int detach)
+{
+  GList *promoted = NULL;
+  OBJECT *tmp, *next;
+
+  if (!toplevel->attribute_promotion) /* controlled through rc file */
+    return NULL;
+
+  for (tmp = object->complex->prim_objs->next; tmp != NULL; tmp = next) {
+    next = tmp->next;
+
+    /* valid floating attrib? */
+    if (!o_complex_is_eligible_attribute(toplevel, tmp))
+      continue;
+
+    if (detach) {
+      /* Remove and isolate tmp from the complex list */
+      if (tmp->next)
+        tmp->next->prev = tmp->prev;
+      if (tmp->prev)
+        tmp->prev->next = tmp->next;
+      tmp->next = tmp->prev = NULL;
+    }
+
+    promoted = g_list_prepend (promoted, tmp);
+  }
+
+  promoted = g_list_reverse (promoted);
+  return promoted;
+}
+
+
+/*! \brief Promote attributes from the passed OBJECT
+ *
+ *  \par Function Description
+ *  Promotes attributes from the passed OBJECT, linking them into the
+ *  OBJECT linked list immediately prior to the passed OBJECT.
+ *
+ *  \param [in]  toplevel The toplevel environment.
+ *  \param [in]  object   The complex object who's attributes are being promtoed.
+ */
+void o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object)
+{
+  GList *promoted;
+  OBJECT *first_promoted, *last_promoted;
+
+  promoted = o_complex_get_promotable (toplevel, object, TRUE);
+
+  if (promoted == NULL)
+    return;
+
+  /* Link the promoted OBJECTs together */
+  o_glist_relink_objects (promoted);
+
+  first_promoted = promoted->data;
+  last_promoted = g_list_last (promoted)->data;
+
+  /* Insert promoted attributes before the complex in the object list */
+  first_promoted->prev = object->prev;
+  object->prev->next = first_promoted;
+  last_promoted->next = object;
+  object->prev = last_promoted;
+
+  /* Attach promoted attributes to the original complex object */
+  o_attrib_attach_list (toplevel, promoted, object);
+
+  g_list_free (promoted);
+}
+
+
+/*! \brief Delete or hide promotable from the passed OBJECT
+ *
+ *  \par Function Description
+ *  Deletes or hides promotable attributes from the passed OBJECT.
+ *  This is used when loading symbols during the load of a schematic from
+ *  disk. The schematic will already contain local copies of symbol's
+ *  promotable objects, so we delete or hide the symbol's copies.
+ *
+ *  Deletion / hiding is dependant on the setting of
+ *  toplevel->keep_invisible. If true, attributes eligible for
+ *  promotion are kept in memory but flagged as invisible.
+ *
+ *  \param [in]  toplevel The toplevel environment.
+ *  \param [in]  object   The complex object being altered.
+ */
+void o_complex_remove_promotable_attribs (TOPLEVEL *toplevel, OBJECT *object)
+{
+  GList *promotable, *iter;
+
+  promotable = o_complex_get_promotable (toplevel, object, FALSE);
+
+  if (promotable == NULL)
+    return;
+
+  for (iter = promotable; iter != NULL; iter = g_list_next (iter)) {
+    OBJECT *a_object = iter->data;
+    if (toplevel->keep_invisible == TRUE) {
+      a_object->visibility = INVISIBLE; /* Hide promotable attributes */
+    } else {
+      s_delete (toplevel, a_object);    /* Delete promotable attributes */
+    }
+  }
+
+  g_list_free (promotable);
+}
+
+
 /* Done */
 /*! \brief
  *  \par Function Description
@@ -301,8 +427,7 @@ OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
 		      int color, int x, int y, int angle,
 		      int mirror, const CLibSymbol *clib,
 		      const gchar *basename,
-		      int selectable,
-		      int attribute_promotion)
+		      int selectable)
 {
   OBJECT *new_node=NULL;
   OBJECT *prim_objs=NULL;
@@ -451,68 +576,6 @@ OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
   }
   toplevel->ADDING_SEL = save_adding_sel;
 
-  if (toplevel->attribute_promotion) { /* controlled through rc file */
-
-    OBJECT *tmp,*next;
-
-    for (tmp=prim_objs->next;tmp;tmp=next) {
-
-      next=tmp->next;
-
-      /* valid floating attrib? */
-      if (o_complex_is_eligible_attribute(toplevel, tmp)) {
-        /* Is attribute promotion called for? (passed in parameter) */
-        if (attribute_promotion)
-        {
-          /* remove tmp from the complex list */
-          if (tmp->next)
-            tmp->next->prev=tmp->prev;
-          if (tmp->prev)
-            tmp->prev->next=tmp->next;
-
-          /* Isolate tmp completely, now that it's removed from list */
-          tmp->next=tmp->prev=NULL;
-          if (use_object_list) {
-            object_list = (OBJECT *) s_basic_link_object(tmp, object_list);
-          } else if (object_glist) {
-            *object_glist = g_list_append (*object_glist, tmp);
-            o_glist_relink_objects (*object_glist);
-          }
-          o_attrib_attach (toplevel, tmp, new_node);
-          o_text_translate_world(toplevel, x, y, tmp);
-
-        } else { /* not promoting, hide or delete promotable attribs */
-
-          if (toplevel->keep_invisible == TRUE) {
-            /* if we want to keep promotable attributes around, but hidden */
-            tmp->visibility = INVISIBLE;
-          } else {
-            /* else delete the promotable attribute objects */
-            s_delete(toplevel, tmp);
-          }
-
-        }
-      }
-    }
-  }
-
-  if (use_object_list) {
-    object_list = (OBJECT *) s_basic_link_object(new_node, object_list);
-    object_list->complex->prim_objs = prim_objs;
-  }
-  else {
-    new_node->complex->prim_objs = prim_objs;
-    if (object_glist) {
-      *object_glist = g_list_append (*object_glist, new_node);
-      o_glist_relink_objects (*object_glist);
-
-      object_list = (OBJECT *) (g_list_last(*object_glist)->data);
-    } else {
-      object_list = new_node;
-    }
-    
-  }
-
   /* do not mirror/rotate/translate/connect the primitive objects if the
    * component was not loaded via o_read 
    */
@@ -529,6 +592,18 @@ OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
     }
   }
 
+  new_node->complex->prim_objs = prim_objs;
+
+  if (use_object_list) {
+    object_list = (OBJECT *) s_basic_link_object(new_node, object_list);
+  } else {
+    if (object_glist) {
+      *object_glist = g_list_append (*object_glist, new_node);
+      o_glist_relink_objects (*object_glist);
+    }
+    object_list = new_node;
+  }
+
   if (use_object_list)
     o_complex_recalc(toplevel, object_list);
   else
@@ -669,7 +744,9 @@ OBJECT *o_complex_read(TOPLEVEL *toplevel, OBJECT *object_list,
                                 WHITE, 
                                 x1, y1, 
                                 angle, mirror, clib,
-                                basename, selectable, FALSE);
+                                basename, selectable);
+    /* Delete or hide attributes eligible for promotion inside the complex */
+     o_complex_remove_promotable_attribs (toplevel, object_list);
   }
 
   return object_list;
@@ -755,12 +832,14 @@ OBJECT *o_complex_copy(TOPLEVEL *toplevel, OBJECT *list_tail,
 
   clib = s_clib_get_symbol_by_name (o_current->complex_basename);
 
-  new_obj = o_complex_add(toplevel, list_tail, NULL, o_current->type, color,
-                          o_current->complex->x, o_current->complex->y, 
-                          o_current->complex->angle, 
-			  o_current->complex->mirror,
-                          clib, o_current->complex_basename, 
-                          selectable, FALSE); 
+  new_obj = o_complex_add (toplevel, list_tail, NULL, o_current->type, color,
+                           o_current->complex->x, o_current->complex->y,
+                           o_current->complex->angle,
+                           o_current->complex->mirror,
+                           clib, o_current->complex_basename,
+                           selectable);
+  /* Delete or hide attributes eligible for promotion inside the complex */
+   o_complex_remove_promotable_attribs (toplevel, new_obj);
 
   o_attrib_slot_copy(toplevel, o_current, new_obj);
 




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