---
 gschem/src/i_basic.c     |    2 +-
 gschem/src/i_callbacks.c |   20 ++++++++++----------
 gschem/src/o_copy.c      |    3 +--
 gschem/src/o_move.c      |    2 +-
 gschem/src/x_dialog.c    |   14 ++------------
 gschem/src/x_event.c     |    2 +-
 6 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/gschem/src/i_basic.c b/gschem/src/i_basic.c
index 3381aa4..232dd61 100644
--- a/gschem/src/i_basic.c
+++ b/gschem/src/i_basic.c
@@ -382,7 +382,7 @@ void i_update_menus(GSCHEM_TOPLEVEL *w_current)
   g_assert(w_current != NULL);
   g_assert(toplevel->page_current != NULL);
 
-  if ( geda_list_get_glist( toplevel->page_current->selection_list ) != NULL ) 
{
+  if (o_select_selected (w_current)) {
     /* since one or more things are selected, we set these TRUE */
     /* These strings should NOT be internationalized */
     x_menus_sensitivity(w_current, "Edit/Cut Buffer", TRUE);
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 4b5f2c9..a0e66c6 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -1859,7 +1859,7 @@ DEFINE_I_CALLBACK(buffer_copy1)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_copy1, _("Copy 1"));
@@ -1878,7 +1878,7 @@ DEFINE_I_CALLBACK(buffer_copy2)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_copy2, _("Copy 2"));
@@ -1897,7 +1897,7 @@ DEFINE_I_CALLBACK(buffer_copy3)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_copy3, _("Copy 3"));
@@ -1916,7 +1916,7 @@ DEFINE_I_CALLBACK(buffer_copy4)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_copy4, _("Copy 4"));
@@ -1935,7 +1935,7 @@ DEFINE_I_CALLBACK(buffer_copy5)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_copy5, _("Copy 5"));
@@ -1954,7 +1954,7 @@ DEFINE_I_CALLBACK(buffer_cut1)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_cut1, _("Cut 1"));
@@ -1973,7 +1973,7 @@ DEFINE_I_CALLBACK(buffer_cut2)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_cut2, _("Cut 2"));
@@ -1992,7 +1992,7 @@ DEFINE_I_CALLBACK(buffer_cut3)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_cut3, _("Cut 3"));
@@ -2011,7 +2011,7 @@ DEFINE_I_CALLBACK(buffer_cut4)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_cut4, _("Cut 4"));
@@ -2030,7 +2030,7 @@ DEFINE_I_CALLBACK(buffer_cut5)
 
   exit_if_null(w_current);
 
-  if ( geda_list_get_glist( w_current->toplevel->page_current->selection_list 
) == NULL )
+  if (!o_select_selected (w_current))
     return;
 
   i_update_middle_button(w_current, i_callback_buffer_cut5, _("Cut 5"));
diff --git a/gschem/src/o_copy.c b/gschem/src/o_copy.c
index 72b7710..c423734 100644
--- a/gschem/src/o_copy.c
+++ b/gschem/src/o_copy.c
@@ -39,8 +39,7 @@
  */
 void o_copy_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 {
-  TOPLEVEL *toplevel = w_current->toplevel;
-  if (geda_list_get_glist( toplevel->page_current->selection_list ) != NULL) {
+  if (o_select_selected (w_current)) {
 
   /* This is commented out since it breaks the copy of objects.  See below. */
 #if 0
diff --git a/gschem/src/o_move.c b/gschem/src/o_move.c
index 93da77d..13470d7 100644
--- a/gschem/src/o_move.c
+++ b/gschem/src/o_move.c
@@ -39,7 +39,7 @@
 void o_move_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  if ( geda_list_get_glist( toplevel->page_current->selection_list ) != NULL) {
+  if (o_select_selected (w_current)) {
 
     /* Save the current state. When rotating the selection when moving,
        we have to come back to here */
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 0d0db44..fa580b5 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2272,23 +2272,13 @@ static GtkWidget *create_color_menu (GSCHEM_TOPLEVEL * 
w_current, int * select_i
   /* first lets see if we have a selected object, if so select its color */
   int select_col = -1;
   int item_index = 0;
-  GList *s_current = NULL;
   OBJECT *object = NULL;
 
   menu = gtk_menu_new ();
   group = NULL;
 
-  s_current = geda_list_get_glist( 
w_current->toplevel->page_current->selection_list );
-
-  if (s_current != NULL) {
-
-    object = (OBJECT *) s_current->data;
-    if (object == NULL) {
-      fprintf(stderr, "no object selected - WHEE!\n");
-    }else{
-      select_col = object->saved_color;
-      /* fprintf(stderr, "setting object color %d\n", select_col); */
-    }
+  if ((object = o_select_return_first_object (w_current)) != NULL) {
+    select_col = object->saved_color;
   }else /*fprintf(stderr, "no object selected\n")*/;
 
   for (index=0; index < MAX_COLORS;index++) {
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index a1015c7..34816ae 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -110,7 +110,7 @@ gint x_event_button_pressed(GtkWidget *widget, 
GdkEventButton *event,
       (w_current->event_state == STARTSELECT ||
        w_current->event_state == SELECT)) {
     o_find_object(w_current, w_x, w_y, TRUE);
-    if ( geda_list_get_glist( toplevel->page_current->selection_list )) {
+    if (o_select_selected (w_current)) {
        o_edit(w_current, geda_list_get_glist( 
toplevel->page_current->selection_list ));
        return(0);
     }
-- 
1.5.6




_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to