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

gEDA-cvs: gaf.git: branch: master updated (1.7.0-20110116-44-g7cc025d)



The branch, master has been updated
       via  7cc025db90267d5cb5b038e2cc39cb15544e0367 (commit)
      from  1eb06387f70cef7e46f37d6be70ea4429a29c894 (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
=========

 gattrib/include/prototype.h      |    1 -
 gattrib/src/gattrib.c            |    4 ----
 gattrib/src/s_toplevel.c         |   18 ------------------
 gschem/src/gschem.c              |    1 -
 gschem/src/o_find.c              |    5 ++---
 gschem/src/o_misc.c              |    8 ++++----
 gschem/src/o_select.c            |    6 +++---
 libgeda/include/libgeda/funcs.h  |    1 -
 libgeda/include/libgeda/struct.h |    2 +-
 libgeda/src/o_arc_basic.c        |    1 -
 libgeda/src/o_basic.c            |    3 ---
 libgeda/src/o_box_basic.c        |    1 -
 libgeda/src/o_bus_basic.c        |    1 -
 libgeda/src/o_circle_basic.c     |    1 -
 libgeda/src/o_complex_basic.c    |   22 ++++------------------
 libgeda/src/o_line_basic.c       |    1 -
 libgeda/src/o_net_basic.c        |    1 -
 libgeda/src/o_path_basic.c       |    1 -
 libgeda/src/o_picture.c          |    2 --
 libgeda/src/o_pin_basic.c        |    1 -
 libgeda/src/o_text_basic.c       |    1 -
 libgeda/src/s_basic.c            |    4 ++--
 utils/gschlas/globals.c          |    9 ---------
 utils/gschlas/gschlas.c          |    4 ----
 utils/include/prototype.h        |    1 -
 25 files changed, 16 insertions(+), 84 deletions(-)


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

commit 7cc025db90267d5cb5b038e2cc39cb15544e0367
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Remove OBJECT->sel_func in favour of an OBJECT->selectable flag
    
    Only gschem called OBJECT->sel_func anyway, so lets avoid passing vfunc
    pointers everywhere as a flag. This has the added benefit of removing
    some dummy functions from gattrib and gschlas which were only present
    so the status of locked objects could be preserved across load/save.

:100644 100644 1152af4... 2f13d5a... M	gattrib/include/prototype.h
:100644 100644 6c6c34c... 3ba793f... M	gattrib/src/gattrib.c
:100644 100644 f054017... 3b64fcc... M	gattrib/src/s_toplevel.c
:100644 100644 36b1d84... cdf0280... M	gschem/src/gschem.c
:100644 100644 bdfa6f7... 5df0a24... M	gschem/src/o_find.c
:100644 100644 340a054... 330e39a... M	gschem/src/o_misc.c
:100644 100644 baefa4e... 50bcfdb... M	gschem/src/o_select.c
:100644 100644 48af7e0... 220c7ab... M	libgeda/include/libgeda/funcs.h
:100644 100644 06faf2b... 7ce5213... M	libgeda/include/libgeda/struct.h
:100644 100644 d5612b8... cb1c3fc... M	libgeda/src/o_arc_basic.c
:100644 100644 37b941e... 020e549... M	libgeda/src/o_basic.c
:100644 100644 65be37b... e857a6a... M	libgeda/src/o_box_basic.c
:100644 100644 2a923e1... d400502... M	libgeda/src/o_bus_basic.c
:100644 100644 465a5d2... 088dea8... M	libgeda/src/o_circle_basic.c
:100644 100644 c2496a6... 722801b... M	libgeda/src/o_complex_basic.c
:100644 100644 6cd4a4b... 4805940... M	libgeda/src/o_line_basic.c
:100644 100644 7187db7... ca4c1e4... M	libgeda/src/o_net_basic.c
:100644 100644 b36a704... de424e8... M	libgeda/src/o_path_basic.c
:100644 100644 289f46c... 1312106... M	libgeda/src/o_picture.c
:100644 100644 05f4014... 02c7a97... M	libgeda/src/o_pin_basic.c
:100644 100644 0db8c2a... 0c91581... M	libgeda/src/o_text_basic.c
:100644 100644 a95230f... 3c82657... M	libgeda/src/s_basic.c
:100644 100644 0b65381... 457f5c9... M	utils/gschlas/globals.c
:100644 100644 506dccb... eb6ac4c... M	utils/gschlas/gschlas.c
:100644 100644 b480a2c... 2948e9e... M	utils/include/prototype.h

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

commit 7cc025db90267d5cb5b038e2cc39cb15544e0367
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Remove OBJECT->sel_func in favour of an OBJECT->selectable flag
    
    Only gschem called OBJECT->sel_func anyway, so lets avoid passing vfunc
    pointers everywhere as a flag. This has the added benefit of removing
    some dummy functions from gattrib and gschlas which were only present
    so the status of locked objects could be preserved across load/save.

diff --git a/gattrib/include/prototype.h b/gattrib/include/prototype.h
index 1152af4..2f13d5a 100644
--- a/gattrib/include/prototype.h
+++ b/gattrib/include/prototype.h
@@ -88,7 +88,6 @@ void s_toplevel_verify_design(TOPLEVEL *toplevel);
 void s_toplevel_gtksheet_to_toplevel(TOPLEVEL *toplevel);
 void s_toplevel_add_new_attrib(gchar *new_attrib_name);
 void s_toplevel_delete_attrib_col();
-void s_toplevel_select_object();
 void s_toplevel_sheetdata_to_toplevel(TOPLEVEL *toplevel, PAGE *page);
 
 STRING_LIST *s_toplevel_get_component_attribs_in_sheet(char *refdes);
diff --git a/gattrib/src/gattrib.c b/gattrib/src/gattrib.c
index 6c6c34c..3ba793f 100644
--- a/gattrib/src/gattrib.c
+++ b/gattrib/src/gattrib.c
@@ -222,10 +222,6 @@ void gattrib_main(void *closure, int argc, char *argv[])
   /* Initialize gEDA stuff */
   libgeda_init();
 
-  /* Ensure object->sel_func can be used to correctly determine object
-   * locking when the project is saved out */
-  select_func = s_toplevel_select_object;
-
   /* Note that argv_index holds index to first non-flag command line option 
    * (that is, to the first file name) */
   argv_index = parse_commandline(argc, argv);
diff --git a/gattrib/src/s_toplevel.c b/gattrib/src/s_toplevel.c
index f054017..3b64fcc 100644
--- a/gattrib/src/s_toplevel.c
+++ b/gattrib/src/s_toplevel.c
@@ -365,24 +365,6 @@ void s_toplevel_delete_attrib_col() {
 }
 
 
-/*------------------------------------------------------------------*/
-/*! \brief Select object in the top level.
- *
- * This function is a hack.  It gives a non-NULL value to the select_func
- * defined in globals.c for libgeda.  A non-NULL value for this function
- * makes sure that object->sel_func = 1 when the project is saved out,
- * which keeps the objects selectable in gschem.
- * Perhaps I should just set the variable myself when saving the 
- * project out . . . . .
- * \todo Function is a NOP - candidate for removal?
- */
-void s_toplevel_select_object()
-{
-  /* I don't know if I should do anything in here to prevent
-   * the function from being optimized away by gcc.  */
-}
-
-
 /* =======================  Private functions  ====================== */
 
 /*------------------------------------------------------------------*/
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index 36b1d84..cdf0280 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -179,7 +179,6 @@ void main_prog(void *closure, int argc, char *argv[])
   path_draw_func = o_path_draw;
   pin_draw_func = o_pin_draw;
   text_draw_func = o_text_draw;
-  select_func = o_select_object;
 
   /* create log file right away even if logging is enabled */
   s_log_init ("gschem");
diff --git a/gschem/src/o_find.c b/gschem/src/o_find.c
index bdfa6f7..5df0a24 100644
--- a/gschem/src/o_find.c
+++ b/gschem/src/o_find.c
@@ -48,8 +48,7 @@ static gboolean
 is_object_hit (GSCHEM_TOPLEVEL *w_current, OBJECT *object,
                int w_x, int w_y, int w_slack)
 {
-  /* Objects without sel_func set are not selectable */
-  if (object->sel_func == NULL)
+  if (!object->selectable)
     return FALSE;
 
   /* We can't hit invisible (text) objects unless show_hidden_text is active.
@@ -99,7 +98,7 @@ find_single_object (GSCHEM_TOPLEVEL *w_current, OBJECT *object,
     if (object->type == OBJ_NET && w_current->net_selection_mode)
       o_select_connected_nets (w_current, object);
     else
-      (*object->sel_func) (w_current, object, SINGLE, 0); /* 0 is count */
+      o_select_object (w_current, object, SINGLE, 0); /* 0 is count */
   }
 
   w_current->toplevel->page_current->object_lastplace = object;
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index 340a054..330e39a 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -117,7 +117,7 @@ void o_lock(GSCHEM_TOPLEVEL *w_current)
     if (object) {
       /* check to see if locked_color is already being used */
       if (object->locked_color == -1) {
-        object->sel_func = NULL;
+        object->selectable = FALSE;
         object->locked_color = object->color;
         object->color = LOCK_COLOR;
         w_current->toplevel->page_current->CHANGED=1;
@@ -153,9 +153,9 @@ void o_unlock(GSCHEM_TOPLEVEL *w_current)
   while(s_current != NULL) {
     object = (OBJECT *) s_current->data;
     if (object) {
-      /* only unlock if sel_func is not set to something */
-      if (object->sel_func == NULL) {
-        object->sel_func = select_func;
+      /* only unlock if the object is locked */
+      if (object->selectable == FALSE) {
+        object->selectable = TRUE;
         object->color = object->locked_color;
         object->locked_color = -1;
         w_current->toplevel->page_current->CHANGED = 1;
diff --git a/gschem/src/o_select.c b/gschem/src/o_select.c
index baefa4e..50bcfdb 100644
--- a/gschem/src/o_select.c
+++ b/gschem/src/o_select.c
@@ -422,7 +422,7 @@ void o_select_connected_nets(GSCHEM_TOPLEVEL *w_current, OBJECT* o_net)
       o_current = iter1->data;
       if (o_current->type == OBJ_NET && 
 	  (!o_current->selected || count == 0)) {
-	(*o_current->sel_func)(w_current, o_current, SINGLE, count);
+	o_select_object (w_current, o_current, SINGLE, count);
 	if (w_current->net_selection_state > 1) {
 	  /* collect nets */
 	  netstack = g_list_concat(s_conn_return_others(NULL, o_current), netstack);
@@ -560,10 +560,10 @@ o_select_visible_unlocked (GSCHEM_TOPLEVEL *w_current)
       continue;
 
     /* Skip locked objects. */
-    if (obj->sel_func == NULL) continue;
+    if (!obj->selectable) continue;
 
     /* Run selection hooks & add object to selection. */
-    /*! \bug We can't call obj->sel_func, because o_select_object()
+    /*! \bug We can't call o_select_object() because it
      * behaves differently depending on the state of
      * w_current->SHIFTKEY and w_current->CONTROLKEY, which may well
      * be set if this function is called via a keystroke
diff --git a/libgeda/include/libgeda/funcs.h b/libgeda/include/libgeda/funcs.h
index 48af7e0..220c7ab 100644
--- a/libgeda/include/libgeda/funcs.h
+++ b/libgeda/include/libgeda/funcs.h
@@ -9,6 +9,5 @@ extern void (*bus_draw_func)();
 extern void (*text_draw_func)();
 extern void (*pin_draw_func)();
 extern void (*path_draw_func)();
-extern void (*select_func)();
 extern void (*x_log_update_func)();
 
diff --git a/libgeda/include/libgeda/struct.h b/libgeda/include/libgeda/struct.h
index 06faf2b..7ce5213 100644
--- a/libgeda/include/libgeda/struct.h
+++ b/libgeda/include/libgeda/struct.h
@@ -258,11 +258,11 @@ struct st_object {
   /* unused for now */
   void (*action_func)();			/* Execute function */
 
-  void (*sel_func)();			/* Selected function */
   void (*draw_func)();			/* Draw function */
 
   int color; 				/* Which color */
   int dont_redraw;			/* Flag to skip redrawing */
+  int selectable;			/* object selectable flag */
   int selected;				/* object selected flag */
   int locked_color; 			/* Locked color (used to save */
   /* the object's real color */
diff --git a/libgeda/src/o_arc_basic.c b/libgeda/src/o_arc_basic.c
index d5612b8..cb1c3fc 100644
--- a/libgeda/src/o_arc_basic.c
+++ b/libgeda/src/o_arc_basic.c
@@ -112,7 +112,6 @@ OBJECT *o_arc_new(TOPLEVEL *toplevel,
   /* new_node->graphical = arc; eventually */
 	
   new_node->draw_func = arc_draw_func;  
-  new_node->sel_func = select_func;
 
   return new_node;
 }
diff --git a/libgeda/src/o_basic.c b/libgeda/src/o_basic.c
index 37b941e..020e549 100644
--- a/libgeda/src/o_basic.c
+++ b/libgeda/src/o_basic.c
@@ -58,9 +58,6 @@
 #include <dmalloc.h>
 #endif
 
-/*! Default setting for object selection function. */
-void (*select_func)() = NULL;
-
 
 /*! \brief Check if point is inside a region
  *  \par Function Description
diff --git a/libgeda/src/o_box_basic.c b/libgeda/src/o_box_basic.c
index 65be37b..e857a6a 100644
--- a/libgeda/src/o_box_basic.c
+++ b/libgeda/src/o_box_basic.c
@@ -87,7 +87,6 @@ OBJECT *o_box_new(TOPLEVEL *toplevel,
 		     FILLING_HOLLOW, -1, -1, -1, -1, -1);
 
   new_node->draw_func = box_draw_func; 
-  new_node->sel_func  = select_func;  
 
   /* compute the bounding box */
   o_box_recalc(toplevel, new_node);
diff --git a/libgeda/src/o_bus_basic.c b/libgeda/src/o_bus_basic.c
index 2a923e1..d400502 100644
--- a/libgeda/src/o_bus_basic.c
+++ b/libgeda/src/o_bus_basic.c
@@ -106,7 +106,6 @@ OBJECT *o_bus_new(TOPLEVEL *toplevel,
   o_bus_recalc (toplevel, new_node);
 
   new_node->draw_func = bus_draw_func;  
-  new_node->sel_func = select_func;  
 
   return new_node;
 }
diff --git a/libgeda/src/o_circle_basic.c b/libgeda/src/o_circle_basic.c
index 465a5d2..088dea8 100644
--- a/libgeda/src/o_circle_basic.c
+++ b/libgeda/src/o_circle_basic.c
@@ -101,7 +101,6 @@ OBJECT *o_circle_new(TOPLEVEL *toplevel,
 		     FILLING_HOLLOW, -1, -1, -1, -1, -1);
   
   new_node->draw_func = circle_draw_func;  
-  new_node->sel_func = select_func;  
   
   /* compute the bounding box coords */
   o_circle_recalc(toplevel, new_node);
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index c2496a6..722801b 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -430,6 +430,7 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
 
   new_node->complex_embedded = FALSE;
   new_node->color = color;
+  new_node->selectable = selectable;
 
   new_node->complex = (COMPLEX *) g_malloc(sizeof(COMPLEX));
   new_node->complex->angle = angle;
@@ -439,12 +440,6 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
 
   new_node->draw_func = complex_draw_func;
 
-  if (selectable) {
-    new_node->sel_func = select_func;
-  } else {
-    new_node->sel_func = NULL;
-  }
-
   prim_objs = NULL;
 
   /* get the symbol data */
@@ -602,16 +597,10 @@ OBJECT *o_complex_new_embedded(TOPLEVEL *toplevel,
   new_node->complex_embedded = TRUE;
 
   new_node->color = color;
+  new_node->selectable = selectable;
 
   new_node->draw_func = complex_draw_func;  
 
-  /* (for a title block) an object that isn't selectable */
-  if (selectable) { 
-    new_node->sel_func = select_func;
-  } else {
-    new_node->sel_func = NULL;
-  }
-
   new_node->complex->prim_objs = NULL;
 
   /* don't have to translate/rotate/mirror here at all since the */
@@ -739,10 +728,7 @@ char *o_complex_save(TOPLEVEL *toplevel, OBJECT *object)
 
   g_return_val_if_fail (object != NULL, NULL);
 
-  if (object->sel_func != NULL) 
-  selectable = 1;
-  else 
-  selectable = 0;
+  selectable = (object->selectable) ? 1 : 0;
 
   if ((object->type == OBJ_COMPLEX) || (object->type == OBJ_PLACEHOLDER)) {
     basename = g_strdup_printf ("%s%s",
@@ -801,9 +787,9 @@ OBJECT *o_complex_copy(TOPLEVEL *toplevel, OBJECT *o_current)
 
   o_new = s_basic_new_object(o_current->type, "complex");
   o_new->color = o_current->color;
+  o_new->selectable = o_current->selectable;
   o_new->complex_basename = g_strdup(o_current->complex_basename);
   o_new->complex_embedded = o_current->complex_embedded;
-  o_new->sel_func = o_current->sel_func;
   o_new->draw_func = o_current->draw_func;
 
   o_new->complex = g_malloc0(sizeof(COMPLEX));
diff --git a/libgeda/src/o_line_basic.c b/libgeda/src/o_line_basic.c
index 6cd4a4b..4805940 100644
--- a/libgeda/src/o_line_basic.c
+++ b/libgeda/src/o_line_basic.c
@@ -89,7 +89,6 @@ OBJECT *o_line_new(TOPLEVEL *toplevel,
 		     FILLING_HOLLOW, -1, -1, -1, -1, -1);
   
   new_node->draw_func = line_draw_func;
-  new_node->sel_func = select_func;  
   
   /* compute bounding box */
   o_line_recalc(toplevel, new_node);
diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index 7187db7..ca4c1e4 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -101,7 +101,6 @@ OBJECT *o_net_new(TOPLEVEL *toplevel, char type,
   o_net_recalc (toplevel, new_node);
 
   new_node->draw_func = net_draw_func;
-  new_node->sel_func = select_func;
 
   return new_node;
 }
diff --git a/libgeda/src/o_path_basic.c b/libgeda/src/o_path_basic.c
index b36a704..de424e8 100644
--- a/libgeda/src/o_path_basic.c
+++ b/libgeda/src/o_path_basic.c
@@ -92,7 +92,6 @@ OBJECT *o_path_new (TOPLEVEL *toplevel,
                       FILLING_HOLLOW, -1, -1, -1, -1, -1);
 
   new_node->draw_func = path_draw_func;
-  new_node->sel_func = select_func;
 
   /* compute bounding box */
   o_path_recalc (toplevel, new_node);
diff --git a/libgeda/src/o_picture.c b/libgeda/src/o_picture.c
index 289f46c..1312106 100644
--- a/libgeda/src/o_picture.c
+++ b/libgeda/src/o_picture.c
@@ -347,7 +347,6 @@ OBJECT *o_picture_new(TOPLEVEL *toplevel, GdkPixbuf *pixbuf,
   picture->embedded = embedded;
 
   new_node->draw_func = picture_draw_func;
-  new_node->sel_func  = select_func;
 
   /* compute the bounding picture */
   o_picture_recalc(toplevel, new_node);
@@ -707,7 +706,6 @@ OBJECT *o_picture_copy(TOPLEVEL *toplevel, OBJECT *object)
   picture->pixbuf = gdk_pixbuf_copy (object->picture->pixbuf);
 
   new_node->draw_func = object->draw_func;
-  new_node->sel_func  = object->sel_func;
 
   /* compute the bounding picture */
   o_picture_recalc(toplevel, new_node);
diff --git a/libgeda/src/o_pin_basic.c b/libgeda/src/o_pin_basic.c
index 05f4014..02c7a97 100644
--- a/libgeda/src/o_pin_basic.c
+++ b/libgeda/src/o_pin_basic.c
@@ -106,7 +106,6 @@ OBJECT *o_pin_new(TOPLEVEL *toplevel,
   o_pin_recalc (toplevel, new_node);
 
   new_node->draw_func = pin_draw_func;  
-  new_node->sel_func = select_func;  
 
   new_node->whichend = whichend;
 
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index 0db8c2a..0c91581 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -278,7 +278,6 @@ OBJECT *o_text_new(TOPLEVEL *toplevel,
   new_node->text = text;
 
   new_node->draw_func = text_draw_func;  
-  new_node->sel_func = select_func;  
 
   new_node->color = color;
   o_set_visibility (toplevel, new_node, visibility);
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index a95230f..3c82657 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -110,14 +110,14 @@ OBJECT *s_basic_init_object(OBJECT *new_node, int type, char const *name)
 		
   /* Setup the color */
   new_node->color = DEFAULT_COLOR;
-  new_node->selected = FALSE;
   new_node->dont_redraw = FALSE;
+  new_node->selectable = TRUE;
+  new_node->selected = FALSE;
   new_node->locked_color = -1;
 
   new_node->bus_ripper_direction = 0;
 
   new_node->action_func = error_if_called; 
-  new_node->sel_func = error_if_called; 
   new_node->draw_func = error_if_called; 
 
   new_node->line_end = END_NONE;
diff --git a/utils/gschlas/globals.c b/utils/gschlas/globals.c
index 0b65381..457f5c9 100644
--- a/utils/gschlas/globals.c
+++ b/utils/gschlas/globals.c
@@ -36,15 +36,6 @@ char *rc_filename = NULL;
 int logfile_fd=-1;
 int logging_dest=LOG_WINDOW;
 
-/* this is just a dummy function, so that compoments are saved properly */
-void
-o_select_dummy(TOPLEVEL * w_current, OBJECT * o_current,
-		int type, int count)
-{
-	// nop
-}
-
-
 /* command line arguments */
 int verbose_mode=FALSE;
 int interactive_mode=FALSE;
diff --git a/utils/gschlas/gschlas.c b/utils/gschlas/gschlas.c
index 506dccb..eb6ac4c 100644
--- a/utils/gschlas/gschlas.c
+++ b/utils/gschlas/gschlas.c
@@ -61,10 +61,6 @@ main_prog(void *closure, int argc, char *argv[])
 
   libgeda_init();
 
-  /* Ensure object->sel_func can be used to correctly determine object
-   * locking when the project is saved out */
-  select_func = o_select_dummy;
-
   /* create log file right away */
   /* even if logging is enabled */
   s_log_init ("gschlas");
diff --git a/utils/include/prototype.h b/utils/include/prototype.h
index b480a2c..2948e9e 100644
--- a/utils/include/prototype.h
+++ b/utils/include/prototype.h
@@ -5,7 +5,6 @@ SCM g_rc_force_boundingbox(SCM mode);
 void g_register_funcs(void);
 SCM g_quit(void);
 /* globals.c */
-void o_select_dummy(TOPLEVEL *w_current, OBJECT *o_current, int type, int count);
 /* gschlas.c */
 void gschlas_quit(void);
 void main_prog(void *closure, int argc, char *argv[]);




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