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

gEDA-cvs: gaf.git: branch: master updated (1.7.0-20110116-53-gc24bbf8)



The branch, master has been updated
       via  c24bbf855cd3d5f5840ce33d6ad06195008dc141 (commit)
      from  980e933a85d180019152424023b879c39d7e4aff (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/i_basic.c     |   27 +++++++++++++++++++++++----
 gschem/src/i_callbacks.c |   12 ++++++++----
 2 files changed, 31 insertions(+), 8 deletions(-)


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

commit c24bbf855cd3d5f5840ce33d6ad06195008dc141
Author: Ivan Stankovic <pokemon@xxxxxxxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>

    gschem: disable menu items operating on text objects if no text is selected
    
    And ignore non-text objects while iterating the list of selected objects.
    
    This patch fixes the following warning:
    
     ** (gschem:31478): CRITICAL **: o_attrib_toggle_show_name_value: assertion
       `object != NULL && object->type == OBJ_TEXT' failed
    
    which can be trivially reproduced by (for example) selecting a net and then
    choosing the "Attributes/Show Value" menu item.
    
    Reviewed-by: Peter Clifton <pcjc2@xxxxxxxxx>
    Reviewed-by: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>

:100644 100644 dc3da98... e6a3add... M	gschem/src/i_basic.c
:100644 100644 18135b8... 27bc527... M	gschem/src/i_callbacks.c

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

commit c24bbf855cd3d5f5840ce33d6ad06195008dc141
Author: Ivan Stankovic <pokemon@xxxxxxxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>

    gschem: disable menu items operating on text objects if no text is selected
    
    And ignore non-text objects while iterating the list of selected objects.
    
    This patch fixes the following warning:
    
     ** (gschem:31478): CRITICAL **: o_attrib_toggle_show_name_value: assertion
       `object != NULL && object->type == OBJ_TEXT' failed
    
    which can be trivially reproduced by (for example) selecting a net and then
    choosing the "Attributes/Show Value" menu item.
    
    Reviewed-by: Peter Clifton <pcjc2@xxxxxxxxx>
    Reviewed-by: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>

diff --git a/gschem/src/i_basic.c b/gschem/src/i_basic.c
index dc3da98..e6a3add 100644
--- a/gschem/src/i_basic.c
+++ b/gschem/src/i_basic.c
@@ -367,6 +367,22 @@ static void clipboard_usable_cb (int usable, void *userdata)
   x_menus_sensitivity (w_current, "_Edit/_Paste", usable);
 }
 
+static gboolean
+selected_at_least_one_text_object(GSCHEM_TOPLEVEL *w_current)
+{
+  OBJECT *obj;
+  TOPLEVEL *toplevel = w_current->toplevel;
+  GList *list = geda_list_get_glist(toplevel->page_current->selection_list);
+
+  while(list != NULL) {
+    obj = (OBJECT *) list->data;
+    if (obj->type == OBJ_TEXT)
+      return TRUE;
+    list = g_list_next(list);
+  }
+  return FALSE;
+}
+
 
 /*! \brief Update sensitivity of relevant menu items
  *
@@ -377,6 +393,7 @@ static void clipboard_usable_cb (int usable, void *userdata)
  */
 void i_update_menus(GSCHEM_TOPLEVEL *w_current)
 {
+  gboolean have_text_selected;
   TOPLEVEL *toplevel = w_current->toplevel;
   /* 
    * This is very simplistic.  Right now it just disables all menu
@@ -391,6 +408,8 @@ void i_update_menus(GSCHEM_TOPLEVEL *w_current)
   x_clipboard_query_usable (w_current, clipboard_usable_cb, w_current);
 
   if (o_select_selected (w_current)) {
+    have_text_selected = selected_at_least_one_text_object(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/Cu_t", TRUE);
@@ -427,10 +446,10 @@ void i_update_menus(GSCHEM_TOPLEVEL *w_current)
     x_menus_sensitivity(w_current, "Hie_rarchy/D_ocumentation...", TRUE);
     x_menus_sensitivity(w_current, "A_ttributes/_Attach", TRUE);
     x_menus_sensitivity(w_current, "A_ttributes/_Detach", TRUE);
-    x_menus_sensitivity(w_current, "A_ttributes/Show _Value", TRUE);
-    x_menus_sensitivity(w_current, "A_ttributes/Show _Name", TRUE);
-    x_menus_sensitivity(w_current, "A_ttributes/Show _Both", TRUE);
-    x_menus_sensitivity(w_current, "A_ttributes/_Toggle Visibility", TRUE);
+    x_menus_sensitivity(w_current, "A_ttributes/Show _Value", have_text_selected);
+    x_menus_sensitivity(w_current, "A_ttributes/Show _Name", have_text_selected);
+    x_menus_sensitivity(w_current, "A_ttributes/Show _Both", have_text_selected);
+    x_menus_sensitivity(w_current, "A_ttributes/_Toggle Visibility", have_text_selected);
 
     /*  Menu items for hierarchy added by SDB 1.9.2005.  */
     x_menus_popup_sensitivity(w_current, "/Down Schematic", TRUE);
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 18135b8..27bc527 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -3173,7 +3173,8 @@ DEFINE_I_CALLBACK(attributes_show_name)
          s_current != NULL;
          s_current = g_list_next (s_current)) {
       OBJECT *object = (OBJECT*)s_current->data;
-      o_attrib_toggle_show_name_value (w_current, object, SHOW_NAME);
+      if (object->type == OBJ_TEXT)
+        o_attrib_toggle_show_name_value (w_current, object, SHOW_NAME);
     }
 
     o_undo_savestate (w_current, UNDO_ALL);
@@ -3209,7 +3210,8 @@ DEFINE_I_CALLBACK(attributes_show_value)
          s_current != NULL;
          s_current = g_list_next (s_current)) {
       OBJECT *object = (OBJECT*)s_current->data;
-      o_attrib_toggle_show_name_value (w_current, object, SHOW_VALUE);
+      if (object->type == OBJ_TEXT)
+        o_attrib_toggle_show_name_value (w_current, object, SHOW_VALUE);
     }
 
     o_undo_savestate (w_current, UNDO_ALL);
@@ -3245,7 +3247,8 @@ DEFINE_I_CALLBACK(attributes_show_both)
          s_current != NULL;
          s_current = g_list_next (s_current)) {
       OBJECT *object = (OBJECT*)s_current->data;
-      o_attrib_toggle_show_name_value (w_current, object, SHOW_NAME_VALUE);
+      if (object->type == OBJ_TEXT)
+        o_attrib_toggle_show_name_value (w_current, object, SHOW_NAME_VALUE);
     }
 
     o_undo_savestate (w_current, UNDO_ALL);
@@ -3282,7 +3285,8 @@ DEFINE_I_CALLBACK(attributes_visibility_toggle)
          s_current != NULL;
          s_current = g_list_next (s_current)) {
       OBJECT *object = (OBJECT*)s_current->data;
-      o_attrib_toggle_visibility (w_current, object);
+      if (object->type == OBJ_TEXT)
+        o_attrib_toggle_visibility (w_current, object);
     }
 
     o_undo_savestate (w_current, UNDO_ALL);



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