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

gEDA-cvs: gaf.git: branch: master updated (1.7.0-20110116-43-g1eb0638)



The branch, master has been updated
       via  1eb06387f70cef7e46f37d6be70ea4429a29c894 (commit)
       via  497241f260a728e485cf68dfbf3eea8ce9433a29 (commit)
      from  06925a44059c630ed99aa25ebebce8146cc56e47 (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/gschem_struct.h |    1 -
 gschem/include/i_vars.h        |    1 -
 gschem/include/prototype.h     |    1 -
 gschem/lib/system-gschemrc.scm |    6 --
 gschem/src/g_rc.c              |   17 ------
 gschem/src/g_register.c        |    2 -
 gschem/src/gschem_toplevel.c   |    1 -
 gschem/src/i_vars.c            |    4 --
 gschem/src/o_find.c            |  116 +++++++++++++++++++++++-----------------
 gschem/src/x_event.c           |    6 +--
 10 files changed, 69 insertions(+), 86 deletions(-)


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

commit 1eb06387f70cef7e46f37d6be70ea4429a29c894
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Make dragging selected objects obey the same hit test as selecting
    
    This makes dragging a group of selected objects more consistent with the
    action required to select the objects in the first place, most notably
    when dealing objects whos bounding boxes don't fit tightly to the
    selectable geometry - e.g. lines and curves.
    
    In order to start a drag, the user must hit within some distance of some
    selected geometry. This makes it easier to change selection to another
    object with overlapping bounding box if the user did not intend to initiate
    a drag.

:100644 100644 df28894... bdfa6f7... M	gschem/src/o_find.c

commit 497241f260a728e485cf68dfbf3eea8ce9433a29
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Remove (drag-can-move ...) option from system-gschemrc.
    
    Make this non-configurable to reduce the number of options I would bet
    money on no-one using. On a more practical note, I am trying to reduce
    the number of combinations we need to test when altering mouse bindings.

:100644 100644 c945f60... 40c91be... M	gschem/include/gschem_struct.h
:100644 100644 cd5829e... 3dbc8f4... M	gschem/include/i_vars.h
:100644 100644 43e7c43... 5f7ceaf... M	gschem/include/prototype.h
:100644 100644 539f389... f005b60... M	gschem/lib/system-gschemrc.scm
:100644 100644 8806627... 0bcfbe9... M	gschem/src/g_rc.c
:100644 100644 4a9fd39... 55f6af5... M	gschem/src/g_register.c
:100644 100644 bf7d723... 100839d... M	gschem/src/gschem_toplevel.c
:100644 100644 9709aad... c4dca9e... M	gschem/src/i_vars.c
:100644 100644 2ceb961... 67989a1... M	gschem/src/x_event.c

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

commit 1eb06387f70cef7e46f37d6be70ea4429a29c894
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Make dragging selected objects obey the same hit test as selecting
    
    This makes dragging a group of selected objects more consistent with the
    action required to select the objects in the first place, most notably
    when dealing objects whos bounding boxes don't fit tightly to the
    selectable geometry - e.g. lines and curves.
    
    In order to start a drag, the user must hit within some distance of some
    selected geometry. This makes it easier to change selection to another
    object with overlapping bounding box if the user did not intend to initiate
    a drag.

diff --git a/gschem/src/o_find.c b/gschem/src/o_find.c
index df28894..bdfa6f7 100644
--- a/gschem/src/o_find.c
+++ b/gschem/src/o_find.c
@@ -32,6 +32,47 @@
 /*! \brief Tests a if a given OBJECT was hit at a given set of coordinates
  *
  *  \par Function Description
+ *  Tests a if a given OBJECT was hit at a given set of coordinates. If an
+ *  object is not selectable (e.g. it is locked), or it is invisible and
+ *  not being rendered, this function will return FALSE.
+ *
+ *  \param [in] w_current         The GSCHEM_TOPLEVEL object.
+ *  \param [in] object            The OBJECT being hit-tested.
+ *  \param [in] w_x               The X coordinate to test (in world coords).
+ *  \param [in] w_y               The Y coordinate to test (in world coords).
+ *  \param [in] w_slack           The slack applied to the hit-test.
+ *
+ *  \returns TRUE if the OBJECT was hit, otherwise FALSE.
+ */
+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)
+    return FALSE;
+
+  /* We can't hit invisible (text) objects unless show_hidden_text is active.
+   */
+  if (!o_is_visible (w_current->toplevel, object) &&
+      !w_current->toplevel->show_hidden_text)
+    return FALSE;
+
+  /* Do a coarse test first to avoid computing distances for objects ouside
+   * of the hit range.
+   */
+  if (!inside_region (object->w_left  - w_slack, object->w_top    - w_slack,
+                      object->w_right + w_slack, object->w_bottom + w_slack,
+                      w_x, w_y))
+    return FALSE;
+
+  return (o_shortest_distance (object, w_x, w_y) < w_slack);
+}
+
+
+/*! \brief Tests a if a given OBJECT was hit at a given set of coordinates
+ *
+ *  \par Function Description
  *  Tests a if a given OBJECT was hit at a given set of coordinates. If so,
  *  processes selection changes as appropriate for the object and passed
  *  flag. Saves a pointer to the found object so future find operations
@@ -45,30 +86,25 @@
  *  \param [in] change_selection  Whether to select the found object or not.
  *  \returns TRUE if the OBJECT was hit, otherwise FALSE.
  */
-static gboolean find_single_object (GSCHEM_TOPLEVEL *w_current, OBJECT *object,
-                                    int w_x, int w_y, int w_slack,
-                                    int change_selection)
+static gboolean
+find_single_object (GSCHEM_TOPLEVEL *w_current, OBJECT *object,
+                    int w_x, int w_y, int w_slack,
+                    int change_selection)
 {
-  TOPLEVEL *toplevel = w_current->toplevel;
-  if (object->sel_func != NULL &&
-      (o_is_visible (toplevel, object) || toplevel->show_hidden_text) &&
-      inside_region (object->w_left  - w_slack, object->w_top    - w_slack,
-                     object->w_right + w_slack, object->w_bottom + w_slack,
-                     w_x, w_y) &&
-      o_shortest_distance (object, w_x, w_y) < w_slack) {
-    if (change_selection) {
-      /* FIXME: should this be moved to o_select_object()? (Werner) */
-      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 */
-      }
-    }
-    toplevel->page_current->object_lastplace = object;
-    i_update_menus (w_current);
-    return TRUE;
+  if (!is_object_hit (w_current, object, w_x, w_y, w_slack))
+    return FALSE;
+
+  if (change_selection) {
+    /* FIXME: should this be moved to o_select_object()? (Werner) */
+    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 */
   }
-  return FALSE;
+
+  w_current->toplevel->page_current->object_lastplace = object;
+  i_update_menus (w_current);
+  return TRUE;
 }
 
 
@@ -151,38 +187,20 @@ gboolean o_find_object (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
  *  \par Function Description
  *
  */
-gboolean o_find_selected_object(GSCHEM_TOPLEVEL *w_current,
-				int w_x, int w_y)
+gboolean
+o_find_selected_object (GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  OBJECT *o_current=NULL;
+  int w_slack = WORLDabs (w_current, w_current->select_slack_pixels);
   GList *s_current;
-  int w_slack;
 
-  w_slack = WORLDabs (w_current, w_current->select_slack_pixels);
-
-  s_current = geda_list_get_glist( toplevel->page_current->selection_list );
-  /* do first search */
-  while (s_current != NULL) {
-    o_current = (OBJECT *) s_current->data;
-    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)) {
-
-#if DEBUG
-      printf("o_find_selected_object:\n");
-      printf("Object bounds:\n\tL: %i\tR: %i\n\tT: %i\tB: %i.\n",
-             o_current->w_left, o_current->w_right, o_current->w_top, o_current->w_bottom);
-      printf("Screen pointer at: (%i,%i)\n", screen_x, screen_y);
-#endif
-      if (o_current->sel_func != NULL &&
-          (o_is_visible (toplevel, o_current) || toplevel->show_hidden_text)) {
-        return TRUE;
-      }
-    }
+  for (s_current = geda_list_get_glist (toplevel->page_current->selection_list);
+       s_current != NULL; s_current = g_list_next (s_current)) {
+    OBJECT *o_current = s_current->data;
 
-    s_current = g_list_next(s_current);
+    if (is_object_hit (w_current, o_current, w_x, w_y, w_slack))
+      return TRUE;
   }
 
-  return (FALSE);
+  return FALSE;
 }

commit 497241f260a728e485cf68dfbf3eea8ce9433a29
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Remove (drag-can-move ...) option from system-gschemrc.
    
    Make this non-configurable to reduce the number of options I would bet
    money on no-one using. On a more practical note, I am trying to reduce
    the number of combinations we need to test when altering mouse bindings.

diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
index c945f60..40c91be 100644
--- a/gschem/include/gschem_struct.h
+++ b/gschem/include/gschem_struct.h
@@ -201,7 +201,6 @@ struct st_gschem_toplevel {
   /* attributes when they are attached to vertical or horizontal nets */
   int add_attribute_offset;
 
-  int drag_can_move;      /* Controls if drag can move objects or not */
   int mousepan_gain;      /* Controls the gain of the mouse pan */
   int keyboardpan_gain;   /* Controls the gain of the keyboard pan */
   int select_slack_pixels; /* Number of pixels around an object we can still select it with */
diff --git a/gschem/include/i_vars.h b/gschem/include/i_vars.h
index cd5829e..3dbc8f4 100644
--- a/gschem/include/i_vars.h
+++ b/gschem/include/i_vars.h
@@ -77,7 +77,6 @@ extern int default_dots_grid_fixed_threshold;
 extern int default_mesh_grid_display_threshold;
 extern int default_add_attribute_offset;
 extern int default_auto_save_interval;
-extern int default_drag_can_move;
 extern int default_mousepan_gain;
 extern int default_keyboardpan_gain;
 extern int default_select_slack_pixels;
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 43e7c43..5f7ceaf 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -267,7 +267,6 @@ SCM g_rc_dots_grid_fixed_threshold(SCM spacing);
 SCM g_rc_mesh_grid_display_threshold(SCM spacing);
 SCM g_rc_add_attribute_offset(SCM offset);
 SCM g_rc_auto_save_interval(SCM seconds);
-SCM g_rc_drag_can_move(SCM mode);
 SCM g_rc_mousepan_gain(SCM mode);
 SCM g_rc_keyboardpan_gain(SCM mode);
 SCM g_rc_print_command(SCM mode);
diff --git a/gschem/lib/system-gschemrc.scm b/gschem/lib/system-gschemrc.scm
index 539f389..f005b60 100644
--- a/gschem/lib/system-gschemrc.scm
+++ b/gschem/lib/system-gschemrc.scm
@@ -664,12 +664,6 @@
 (image-color "enabled")
 ;(image-color "disabled")
 
-; drag-can-move string
-;
-; If enabled, the drag movement over selected objects can move the objects.
-(drag-can-move "enabled")
-;(drag-can-move "disabled")
-
 ; middle-button string
 ;
 ; Controls if the middle mouse button draws strokes, repeats the last 
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index 8806627..0bcfbe9 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -1397,23 +1397,6 @@ SCM g_rc_auto_save_interval(SCM seconds)
  *  \par Function Description
  *
  */
-SCM g_rc_drag_can_move(SCM mode)
-{
-  static const vstbl_entry mode_table[] = {
-    {TRUE,  "enabled" },
-    {FALSE, "disabled"  }
-  };
-
-  RETURN_G_RC_MODE("drag-can-move",
-		   default_drag_can_move,
-		   2);
-}
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
 SCM g_rc_mousepan_gain(SCM gain)
 {
   int val;
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index 4a9fd39..55f6af5 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -106,8 +106,6 @@ static struct gsubr_t gschem_funcs[] = {
   { "undo-type",                 1, 0, 0, g_rc_undo_type },
   { "undo-panzoom",              1, 0, 0, g_rc_undo_panzoom },
 
-  { "drag-can-move",             1, 0, 0, g_rc_drag_can_move },
-
   { "draw-grips",                1, 0, 0, g_rc_draw_grips },
   { "netconn-rubberband",        1, 0, 0, g_rc_netconn_rubberband },
   { "magnetic-net-mode",         1, 0, 0, g_rc_magnetic_net_mode },
diff --git a/gschem/src/gschem_toplevel.c b/gschem/src/gschem_toplevel.c
index bf7d723..100839d 100644
--- a/gschem/src/gschem_toplevel.c
+++ b/gschem/src/gschem_toplevel.c
@@ -192,7 +192,6 @@ GSCHEM_TOPLEVEL *gschem_toplevel_new ()
   w_current->dots_grid_mode = DOTS_GRID_VARIABLE_MODE;
   w_current->mesh_grid_display_threshold = 3;
   w_current->add_attribute_offset = 50;
-  w_current->drag_can_move = TRUE;
   w_current->mousepan_gain = 5;
   w_current->keyboardpan_gain = 10;
   w_current->select_slack_pixels = 4;
diff --git a/gschem/src/i_vars.c b/gschem/src/i_vars.c
index 9709aad..c4dca9e 100644
--- a/gschem/src/i_vars.c
+++ b/gschem/src/i_vars.c
@@ -117,8 +117,6 @@ int   default_add_attribute_offset = 50;
 
 int   default_auto_save_interval = 120;
 
-int   default_drag_can_move = TRUE;
-
 int   default_width = 800;  /* these variables are used in x_window.c */
 int   default_height = 600;
 
@@ -236,8 +234,6 @@ void i_vars_set(GSCHEM_TOPLEVEL *w_current)
 
   w_current->add_attribute_offset  = default_add_attribute_offset;
 
-  w_current->drag_can_move = default_drag_can_move;
-
   w_current->mousepan_gain = default_mousepan_gain;
   w_current->keyboardpan_gain = default_keyboardpan_gain;
 
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index 2ceb961..67989a1 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -791,10 +791,8 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event,
     break;
 
     case(STARTSELECT):
-    if ( (!w_current->drag_can_move) ||
-         (w_current->drag_can_move &&
-          (! o_find_selected_object(w_current,
-                                    w_current->first_wx, w_current->first_wy)))) {
+    if (!o_find_selected_object (w_current,
+                                 w_current->first_wx, w_current->first_wy)) {
       if (o_select_box_start(w_current, unsnapped_wx, unsnapped_wy)) {
         w_current->event_state = SBOX;
         w_current->inside_action = 1;




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