gschem

x_attribedit.c

Go to the documentation of this file.
00001 /* gEDA - GPL Electronic Design Automation
00002  * gschem - gEDA Schematic Capture
00003  * Copyright (C) 1998-2010 Ales Hvezda
00004  * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00022 #include <config.h>
00023 
00024 #include <stdio.h>
00025 #ifdef HAVE_STDLIB_H
00026 #include <stdlib.h>
00027 #endif
00028 #ifdef HAVE_STRING_H
00029 #include <string.h>
00030 #endif
00031 
00032 #include "gschem.h"
00033 
00034 #ifdef HAVE_LIBDMALLOC
00035 #include <dmalloc.h>
00036 #endif
00037 
00038 /***************** Start of Attrib Edit dialog box ********************/
00046 gint option_menu_get_history (GtkOptionMenu *option_menu) 
00047 { 
00048   GtkWidget *active_widget; 
00049          
00050   g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), -1); 
00051          
00052   active_widget = gtk_menu_get_active (GTK_MENU (option_menu->menu)); 
00053 
00054   if (active_widget) 
00055     return g_list_index (GTK_MENU_SHELL (option_menu->menu)->children, 
00056              active_widget); 
00057   else 
00058     return -1; 
00059 } 
00060 
00066 void attrib_edit_dialog_ok(GtkWidget * w, GSCHEM_TOPLEVEL *w_current)
00067 {
00068   TOPLEVEL *toplevel = w_current->toplevel;
00069   const char *value, *label;
00070   char *newtext;
00071   GtkEntry *value_entry, *name_entry;
00072   GtkWidget *visbutton, *show_options;
00073   GtkWidget *addtocompsbutton, *addtonetsbutton, *addtoallbutton;
00074   GtkWidget *overwritebutton;
00075   OBJECT *attribptr;
00076   OBJECT *object;
00077   GList *s_current = NULL;
00078   OBJECT *a_current;
00079   GList *a_iter;
00080   int vis, show;
00081   int invocation_flag;
00082   int nsel=0, addto=0, replace=0, addmask=0;
00083   int option_index;
00084   gint wx, wy;
00085 
00086   i_set_state(w_current, SELECT);
00087 
00088   value_entry =
00089   gtk_object_get_data(GTK_OBJECT(w_current->aewindow), "value_entry");
00090   name_entry =
00091   gtk_object_get_data(GTK_OBJECT(w_current->aewindow), "attrib_combo_entry");
00092   visbutton =
00093   gtk_object_get_data(GTK_OBJECT(w_current->aewindow), "visbutton");
00094   show_options =
00095   gtk_object_get_data(GTK_OBJECT(w_current->aewindow), "show_options");
00096 
00097   value = gtk_entry_get_text(value_entry);
00098   label = gtk_entry_get_text(name_entry);
00099   newtext = g_strconcat (label, "=", value, NULL);
00100 
00101   if (!x_dialog_validate_attribute(GTK_WINDOW(w_current->aewindow), newtext))
00102   {
00103     g_free(newtext);
00104     return;
00105   }
00106   
00107   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(visbutton)))
00108   vis = VISIBLE;
00109   else
00110   vis = INVISIBLE;
00111 
00112   option_index = option_menu_get_history(GTK_OPTION_MENU (show_options));
00113   switch(option_index) {
00114     case(0):
00115       show = SHOW_VALUE;
00116       break;
00117 
00118     case(1):
00119       show = SHOW_NAME;
00120       break;
00121 
00122     case(2):
00123       show = SHOW_NAME_VALUE;
00124       break;
00125 
00126     default:
00127       fprintf(stderr, _("Got invalid show option; defaulting to show both\n"));
00128       show = SHOW_NAME_VALUE;
00129       break;
00130   }
00131 
00132   attribptr =
00133   gtk_object_get_data(GTK_OBJECT(w_current->aewindow), "attrib");
00134   if (!attribptr) {
00135     OBJECT *new = NULL;
00136 
00137     s_current = geda_list_get_glist( toplevel->page_current->selection_list );
00138     while (s_current != NULL) {
00139       object = (OBJECT *)s_current->data;
00140       if (object == NULL) {
00141     fprintf(stderr, _("ERROR: NULL object!\n"));
00142     exit(-1);
00143       }
00144       if (!object->attached_to) {
00145     nsel++;
00146       }
00147       s_current = g_list_next(s_current);
00148     }
00149     s_current = geda_list_get_glist( toplevel->page_current->selection_list );
00150     if (nsel > 1) {
00151 
00152       addtoallbutton =
00153         gtk_object_get_data(GTK_OBJECT(w_current->aewindow),
00154                             "addtoallbutton");
00155 
00156       addtocompsbutton =
00157         gtk_object_get_data(GTK_OBJECT(w_current->aewindow),
00158                             "addtocompsbutton");
00159 
00160       addtonetsbutton =
00161         gtk_object_get_data(GTK_OBJECT(w_current->aewindow),
00162                             "addtonetsbutton");
00163 
00164       overwritebutton =
00165         gtk_object_get_data(GTK_OBJECT(w_current->aewindow),
00166                             "overwritebutton");
00167 
00168       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(overwritebutton))) {
00169     replace = 1;
00170       } else {
00171     replace = 0;
00172       }
00173 
00174       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(addtoallbutton))) {
00175     addto = 7;
00176       }
00177       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(addtocompsbutton))) {
00178     addto = 2;
00179       }
00180       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(addtonetsbutton))) {
00181     addto = 1;
00182       }
00183 
00184       while (s_current != NULL) {
00185         gboolean replaced;
00186 
00187         object = (OBJECT *) s_current->data;
00188         if (object && !object->attached_to && object->type != OBJ_TEXT ) {
00189           addmask = 4;
00190           if (object->type == OBJ_COMPLEX || object->type == OBJ_PLACEHOLDER) {
00191             addmask = 2;
00192           }
00193           if (object->type == OBJ_NET) {
00194             addmask = 1;
00195           }
00196           replaced = FALSE;
00197           if (addmask & addto) {
00198             a_iter = object->attribs;
00199             if (replace) {
00200               while (a_iter != NULL) {
00201                 a_current = a_iter->data;
00202                 const gchar *str = o_text_get_string (toplevel, a_current);
00203                 if (str) {
00204                   if (!strncmp (str, newtext, strchr (newtext, '=') - newtext)) {
00205                     o_text_change(w_current, a_current, newtext, vis, show);
00206                     replaced = TRUE;
00207                     toplevel->page_current->CHANGED = 1;
00208                   }
00209                 }
00210                 a_iter = g_list_next (a_iter);
00211               }
00212             }
00213             if (!replaced) {
00214               (void) o_attrib_add_attrib(w_current, newtext, vis, show, object);
00215             }
00216           }
00217         }
00218         s_current = g_list_next (s_current);
00219       }
00220       o_undo_savestate(w_current, UNDO_ALL);
00221     } else {
00222       object = o_select_return_first_object(w_current);
00223       new = o_attrib_add_attrib(w_current, newtext, vis, show, object);
00224 
00225       invocation_flag =
00226     GPOINTER_TO_INT( gtk_object_get_data(GTK_OBJECT(w_current->aewindow),
00227                   "invocation_flag") );
00228       wx = GPOINTER_TO_INT( gtk_object_get_data(GTK_OBJECT(w_current->aewindow),
00229                         "position_wx"));
00230       wy = GPOINTER_TO_INT( gtk_object_get_data(GTK_OBJECT(w_current->aewindow),
00231                         "position_wy"));
00232       
00233 #if DEBUG
00234       printf("invocation flag: %d\n", invocation_flag);
00235 #endif
00236       if (invocation_flag == FROM_HOTKEY
00237       && wx != -1 && wy != -1) {
00238     o_invalidate (w_current, new);
00239     new->text->x = wx;
00240     new->text->y = wy;
00241     o_text_recreate(toplevel, new);
00242     toplevel->page_current->CHANGED = 1;
00243     o_undo_savestate(w_current, UNDO_ALL);
00244       }
00245     }
00246   } else {
00247     o_text_change(w_current, attribptr, newtext, vis, show);
00248     toplevel->page_current->CHANGED = 1;
00249     o_undo_savestate(w_current, UNDO_ALL);
00250   }
00251   gtk_grab_remove(w_current->aewindow);
00252   gtk_widget_destroy(w_current->aewindow);
00253   w_current->aewindow = NULL;
00254   g_free(newtext);
00255 }
00256 
00262 void attribute_edit_dialog_response(GtkWidget *w, gint response, 
00263                  GSCHEM_TOPLEVEL *w_current)
00264 {
00265   switch(response) {
00266   case GTK_RESPONSE_APPLY:
00267     attrib_edit_dialog_ok(NULL, w_current);
00268     break;
00269   case GTK_RESPONSE_REJECT:
00270   case GTK_RESPONSE_DELETE_EVENT:
00271     i_set_state(w_current, SELECT);
00272     gtk_grab_remove(w_current->aewindow);
00273     gtk_widget_destroy(w_current->aewindow);
00274     w_current->aewindow = NULL;
00275     break;
00276   default:
00277     printf("attrib_edit_dialog_response(): strange signal %d\n", response);
00278   }
00279   /* clean up */
00280 }
00281 
00282 
00283 
00288 void attrib_edit_dialog (GSCHEM_TOPLEVEL *w_current, OBJECT *attr_obj, int flag)
00289 {
00290   TOPLEVEL *toplevel = w_current->toplevel;
00291   GtkWidget *aewindow;
00292   GtkWidget *vbox, *label, *table, *alignment;
00293   GtkWidget *show_options;
00294   GtkWidget *show_options_menu;
00295   GtkWidget *glade_menuitem;
00296   GtkWidget *attrib_combo_box_entry;
00297   GtkWidget *attrib_combo_entry;
00298   GtkWidget *value_entry;
00299   GtkWidget *visbutton;
00300   GSList *hbox2_group = NULL;
00301   GtkWidget *addtoallbutton;
00302   GtkWidget *addtocompsbutton;
00303   GtkWidget *addtonetsbutton;
00304   GtkWidget *overwritebutton;
00305   GtkEntryCompletion *attrib_combo_entry_completion;
00306 
00307   /* gschem specific */
00308   GList *s_current = NULL;
00309   char* string = NULL;
00310   int nsel=0, i, len;
00311   char *name = NULL;
00312   char *val = NULL;
00313   OBJECT *attrib = NULL;
00314   gint wx, wy;
00315   
00316   /* gschem specific */
00317   if (w_current->aewindow)
00318     return;
00319 
00320   /* gschem specific: What do we count here? (Werner)  */
00321   for (s_current = geda_list_get_glist( toplevel->page_current->selection_list );
00322        s_current != NULL;
00323        s_current = g_list_next(s_current)) {
00324     if (!((OBJECT *) s_current->data)->attached_to) {
00325       nsel++;
00326     }
00327   }
00328 
00329   aewindow = gschem_dialog_new_with_buttons(_("Single Attribute Editor"),
00330                                             GTK_WINDOW(w_current->main_window),
00331                                             GTK_DIALOG_MODAL,
00332                                             "singleattrib", w_current,
00333                                             GTK_STOCK_CANCEL,
00334                                             GTK_RESPONSE_REJECT,
00335                                             GTK_STOCK_OK,
00336                                             GTK_RESPONSE_APPLY,
00337                                             NULL);
00338   /* Set the alternative button order (ok, cancel, help) for other systems */
00339   gtk_dialog_set_alternative_button_order(GTK_DIALOG(aewindow),
00340                       GTK_RESPONSE_APPLY,
00341                       GTK_RESPONSE_REJECT,
00342                       -1);
00343                      
00344   g_signal_connect (G_OBJECT (aewindow), "response",
00345                     G_CALLBACK (attribute_edit_dialog_response),
00346                     w_current);
00347 
00348   gtk_window_set_position (GTK_WINDOW (aewindow), GTK_WIN_POS_MOUSE);
00349 
00350   gtk_dialog_set_default_response(GTK_DIALOG(aewindow),
00351                                   GTK_RESPONSE_APPLY);
00352 
00353   vbox = GTK_DIALOG(aewindow)->vbox;
00354   gtk_container_set_border_width(GTK_CONTAINER(aewindow), 
00355                  DIALOG_BORDER_SPACING);
00356   gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
00357 
00358   if (attr_obj)
00359     label = gtk_label_new(_("<b>Edit Attribute</b>"));
00360   else
00361     label = gtk_label_new(_("<b>Add Attribute</b>"));
00362   gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
00363   gtk_misc_set_alignment(GTK_MISC(label),0,0);
00364   gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);  
00365   
00366   alignment = gtk_alignment_new(0,0,1,1);
00367   gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 
00368                 DIALOG_INDENTATION, 0);
00369   gtk_box_pack_start(GTK_BOX(vbox), alignment, TRUE, TRUE, 0);
00370 
00371   table = gtk_table_new (3, 2, FALSE);
00372   gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_V_SPACING);
00373   gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_H_SPACING);
00374   gtk_container_add (GTK_CONTAINER (alignment), table);
00375 
00376   /* Name selection */
00377   label = gtk_label_new (_("Name:"));
00378   gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
00379   gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
00380                     (GtkAttachOptions) (GTK_FILL),
00381                     (GtkAttachOptions) (GTK_FILL), 0, 0);
00382 
00383   attrib_combo_box_entry = gtk_combo_box_entry_new_text ();
00384   attrib_combo_entry = gtk_bin_get_child(GTK_BIN(attrib_combo_box_entry));
00385   gtk_table_attach (GTK_TABLE (table), attrib_combo_box_entry, 1, 2, 0, 1,
00386                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
00387                     (GtkAttachOptions) (0), 0, 0);
00388   g_object_ref (attrib_combo_entry);
00389   g_object_set_data_full (G_OBJECT (aewindow),
00390                          "attrib_combo_entry", attrib_combo_entry,
00391                             (GtkDestroyNotify) gtk_widget_unref);
00392 
00393   /* Value entry */
00394   label = gtk_label_new (_("Value:"));
00395   gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
00396   gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
00397                     (GtkAttachOptions) (GTK_FILL),
00398                     (GtkAttachOptions) (0), 0, 0);
00399 
00400   value_entry = gtk_entry_new ();
00401   gtk_widget_ref (value_entry);
00402   gtk_object_set_data_full (GTK_OBJECT (aewindow), "value_entry", value_entry,
00403                             (GtkDestroyNotify) gtk_widget_unref);
00404   gtk_table_attach (GTK_TABLE (table), value_entry, 1, 2, 1, 2,
00405                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
00406                     (GtkAttachOptions) (0), 0, 0);
00407   gtk_entry_set_activates_default(GTK_ENTRY(value_entry), TRUE);
00408 
00409   /* Visibility */
00410   visbutton = gtk_check_button_new_with_label (_("Visible"));
00411   gtk_widget_ref (visbutton);
00412   gtk_object_set_data_full (GTK_OBJECT (aewindow), "visbutton", visbutton,
00413                             (GtkDestroyNotify) gtk_widget_unref);
00414 
00415   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (visbutton), TRUE);
00416   gtk_table_attach (GTK_TABLE (table), visbutton, 0, 1, 2, 3,
00417                     (GtkAttachOptions) (GTK_FILL),
00418                     (GtkAttachOptions) (0), 0, 0);
00419 
00420   show_options = gtk_option_menu_new ();
00421   gtk_widget_ref (show_options);
00422   gtk_object_set_data_full (GTK_OBJECT (aewindow), "show_options",
00423                             show_options,
00424                             (GtkDestroyNotify) gtk_widget_unref);
00425   gtk_widget_show (show_options);
00426   gtk_table_attach (GTK_TABLE (table), show_options, 1, 2, 2, 3,
00427                     (GtkAttachOptions) (GTK_FILL | GTK_EXPAND),
00428                     (GtkAttachOptions) (0), 0, 0);
00429   show_options_menu = gtk_menu_new ();
00430   glade_menuitem = gtk_menu_item_new_with_label (_("Show Value Only"));
00431   gtk_menu_append (GTK_MENU (show_options_menu), glade_menuitem);
00432   glade_menuitem = gtk_menu_item_new_with_label (_("Show Name Only"));
00433   gtk_menu_append (GTK_MENU (show_options_menu), glade_menuitem);
00434   glade_menuitem = gtk_menu_item_new_with_label (_("Show Name & Value"));
00435   gtk_menu_append (GTK_MENU (show_options_menu), glade_menuitem);
00436   gtk_option_menu_set_menu (GTK_OPTION_MENU (show_options), show_options_menu);
00437   gtk_option_menu_set_history (GTK_OPTION_MENU (show_options), 0);
00438   
00439   if (nsel > 1) { /* gschem specific */
00440     
00441     label = gtk_label_new(_("<b>Attach Options</b>"));
00442     gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
00443     gtk_misc_set_alignment(GTK_MISC(label),0,0);
00444     gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);  
00445     
00446     alignment = gtk_alignment_new(0,0,1,1);
00447     gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 
00448                 DIALOG_INDENTATION, 0);
00449     gtk_box_pack_start(GTK_BOX(vbox), alignment, TRUE, TRUE, 0);
00450 
00451     table = gtk_table_new (2, 3, FALSE);
00452     gtk_table_set_row_spacings(GTK_TABLE(table), DIALOG_V_SPACING);
00453     gtk_table_set_col_spacings(GTK_TABLE(table), DIALOG_H_SPACING);
00454     gtk_container_add (GTK_CONTAINER (alignment), table);
00455 
00456     addtoallbutton = gtk_radio_button_new_with_label (hbox2_group, _("All"));
00457     hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (addtoallbutton));
00458     gtk_widget_ref (addtoallbutton);
00459     gtk_object_set_data_full (GTK_OBJECT (aewindow), "addtoallbutton", addtoallbutton,
00460                               (GtkDestroyNotify) gtk_widget_unref);
00461     gtk_table_attach(GTK_TABLE(table), addtoallbutton, 0, 1, 0, 1,
00462              (GtkAttachOptions) (GTK_FILL), 0, 0, 0);
00463              
00464     addtocompsbutton = gtk_radio_button_new_with_label (hbox2_group, _("Components"));
00465     hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (addtocompsbutton));
00466     gtk_widget_ref (addtocompsbutton);
00467     gtk_object_set_data_full (GTK_OBJECT (aewindow), "addtocompsbutton", addtocompsbutton,
00468                               (GtkDestroyNotify) gtk_widget_unref);
00469     gtk_table_attach(GTK_TABLE(table), addtocompsbutton, 1, 2, 0, 1,
00470              (GtkAttachOptions) (GTK_FILL), 0, 0, 0);
00471 
00472     addtonetsbutton = gtk_radio_button_new_with_label (hbox2_group, _("Nets"));
00473     hbox2_group = gtk_radio_button_group (GTK_RADIO_BUTTON (addtonetsbutton));
00474     gtk_widget_ref (addtonetsbutton);
00475     gtk_object_set_data_full (GTK_OBJECT (aewindow), "addtonetsbutton", addtonetsbutton,
00476                               (GtkDestroyNotify) gtk_widget_unref);
00477     gtk_table_attach(GTK_TABLE(table), addtonetsbutton, 2, 3, 0, 1,
00478              (GtkAttachOptions) (GTK_FILL), 0, 0, 0);
00479 
00480     overwritebutton = gtk_check_button_new_with_label (_("Replace existing attributes"));
00481     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(overwritebutton), TRUE);
00482     gtk_widget_ref (overwritebutton);
00483     gtk_object_set_data_full (GTK_OBJECT (aewindow), "overwritebutton", overwritebutton,
00484                               (GtkDestroyNotify) gtk_widget_unref);
00485     gtk_table_attach(GTK_TABLE(table), overwritebutton, 0, 3, 1, 2,
00486              (GtkAttachOptions) (GTK_FILL), 0, 0, 0);
00487   }
00488 
00489   /* gschem specific */
00490   if (attr_obj) {
00491     o_attrib_get_name_value (attr_obj, &name, &val);
00492     attrib = attr_obj;
00493     if (o_is_visible (toplevel, attrib)) {
00494       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(visbutton), TRUE);
00495     } else {
00496       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(visbutton), FALSE);
00497     }
00498 
00499     if (attrib->show_name_value == SHOW_VALUE) {
00500       gtk_option_menu_set_history (GTK_OPTION_MENU (show_options), 0);
00501     } else if (attrib->show_name_value == SHOW_NAME) {
00502       gtk_option_menu_set_history (GTK_OPTION_MENU (show_options), 1);
00503     } else {
00504       gtk_option_menu_set_history (GTK_OPTION_MENU (show_options), 2);
00505     }
00506   } else {
00507     OBJECT *object;
00508 
00509     attrib = NULL;
00510 
00511     if ((object = o_select_return_first_object(w_current))) {
00512       if (object->type == OBJ_NET)
00513     name = g_strdup("netname");
00514     }
00515 
00516     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(visbutton), TRUE);
00517     /* show value only */
00518     gtk_option_menu_set_history (GTK_OPTION_MENU (show_options), 0);
00519   }
00520   gtk_object_set_data(GTK_OBJECT(aewindow), "attrib", attrib);
00521   if (name) {
00522     gtk_entry_set_text(GTK_ENTRY(attrib_combo_entry), name);
00523   }
00524   if (val) {
00525     gtk_entry_set_text(GTK_ENTRY(value_entry), val);
00526     len = strlen(val);
00527     gtk_entry_select_region(GTK_ENTRY(value_entry), 0, len);
00528   }
00529   gtk_object_set_data(GTK_OBJECT(aewindow), "invocation_flag",
00530                       GINT_TO_POINTER(flag));
00531 
00532   if (!x_event_get_pointer_position(w_current, TRUE, &wx, &wy)) {
00533     wx = wy = -1;
00534   }
00535   gtk_object_set_data(GTK_OBJECT(aewindow), "position_wx",
00536                       GINT_TO_POINTER(wx));
00537   gtk_object_set_data(GTK_OBJECT(aewindow), "position_wy",
00538                       GINT_TO_POINTER(wy));
00539   
00540   /* gschem specific */
00541   i = 0;
00542   string = (char *) s_attrib_get(i);
00543   while (string != NULL) {
00544     gtk_combo_box_append_text(GTK_COMBO_BOX(attrib_combo_box_entry), string);
00545     i++;
00546     string = (char *) s_attrib_get(i);
00547   }
00548 
00549   /* Add completion to attribute combo box entry */
00550   attrib_combo_entry_completion = gtk_entry_completion_new();
00551   gtk_entry_completion_set_model(attrib_combo_entry_completion,
00552           gtk_combo_box_get_model(GTK_COMBO_BOX(attrib_combo_box_entry)));
00553   gtk_entry_completion_set_text_column(attrib_combo_entry_completion, 0);
00554   gtk_entry_completion_set_inline_completion(attrib_combo_entry_completion, TRUE);
00555   gtk_entry_completion_set_popup_single_match(attrib_combo_entry_completion, FALSE);
00556   gtk_entry_set_completion(GTK_ENTRY(attrib_combo_entry), attrib_combo_entry_completion);
00557   
00558   /* gschem specific */
00559   gtk_widget_show_all(aewindow);
00560   w_current->aewindow = aewindow;
00561 
00562   gtk_grab_add(w_current->aewindow);
00563 
00564   if (attrib || (name && strcmp(name, "netname") == 0)) { 
00565     gtk_widget_grab_focus(value_entry);
00566   } else {  
00567     gtk_widget_grab_focus(attrib_combo_entry);
00568   }
00569 
00570   g_free(name);
00571   g_free(val);
00572 
00573 }
00574 /***************** End of Attrib Edit dialog box **********************/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines