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

gEDA-cvs: CVS update: g_register.c



  User: sdb     
  Date: 06/09/16 07:37:03

  Modified:    .        g_register.c gattrib.c x_dialog.c x_gtksheet.c
                        x_window.c
  Log:
  Made gattrib throw up GUI window warning user of no
  
  components or attributes per request of Peter Clifton.
  
  Then program exits with non-zero return code.
  
  
  
  
  Revision  Changes    Path
  1.4       +2 -2      eda/geda/gaf/gattrib/src/g_register.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_register.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/g_register.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- g_register.c	8 Feb 2005 12:33:11 -0000	1.3
  +++ g_register.c	16 Sep 2006 11:37:03 -0000	1.4
  @@ -69,7 +69,7 @@
     printf("In g_quit, calling exit(0)\n");
   #endif
   
  -  gattrib_quit(); 
  -  exit(0);
  +  gattrib_quit(0); 
  +  /*  exit(0);  */  /* Necessary? */
   }
   
  
  
  
  1.19      +6 -6      eda/geda/gaf/gattrib/src/gattrib.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: gattrib.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/gattrib.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -b -r1.18 -r1.19
  --- gattrib.c	7 Sep 2006 02:41:28 -0000	1.18
  +++ gattrib.c	16 Sep 2006 11:37:03 -0000	1.19
  @@ -75,7 +75,7 @@
       printf("User is quitting without saving last changes.\n");
       x_dialog_unsaved_data();
     } else {
  -    gattrib_quit();
  +    gattrib_quit(0);
     }
   }
   
  @@ -83,7 +83,7 @@
   /*------------------------------------------------------------------
    * gattrib_quit -- wrap up and quit fcn.
    *------------------------------------------------------------------*/
  -void gattrib_quit(void)
  +gint gattrib_quit(gint return_code)
   {
     /*   s_clib_cache_free(); */
     s_clib_free();
  @@ -95,7 +95,7 @@
     printf("In gattrib_quit, calling gtk_main_quit()\n");
   #endif
     gtk_main_quit();
  -  return;
  +  exit(return_code);
   }
   
   
  @@ -358,7 +358,7 @@
     printf("In gattrib_main, we have exited gtk_main. \n");
   #endif  
   
  -  return;
  +  exit(0);
   }
   
   /*------------------------------------------------------------------
  @@ -369,6 +369,7 @@
    *------------------------------------------------------------------*/
   int main(int argc, char *argv[])
   {
  +  gint return_code;
   
     /* This is i18n stuff */
   #if ENABLE_NLS
  @@ -388,6 +389,5 @@
   #ifdef DEBUG
     printf("Now exiting main . . . Bye!\n");
   #endif
  -  /* return 0 */
  -  exit(0);
  +  exit(0);   /* This is not real exit point.  Real exit is in gattrib_quit. */
   }
  
  
  
  1.23      +64 -9     eda/geda/gaf/gattrib/src/x_dialog.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_dialog.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_dialog.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -b -r1.22 -r1.23
  --- x_dialog.c	7 Sep 2006 02:41:28 -0000	1.22
  +++ x_dialog.c	16 Sep 2006 11:37:03 -0000	1.23
  @@ -1,4 +1,4 @@
  -/* $Id: x_dialog.c,v 1.22 2006/09/07 02:41:28 ahvezda Exp $ */
  +/* $Id: x_dialog.c,v 1.23 2006/09/16 11:37:03 sdb Exp $ */
   
   /* gEDA - GPL Electronic Design Automation
    * gattrib -- gEDA component and net attribute manipulation using spreadsheet.
  @@ -489,7 +489,7 @@
   #ifdef DEBUG
     printf("In x_dialog_missing_sym_abort_callback, closing program\n");
   #endif
  -  gattrib_quit();
  +  gattrib_quit(0);
   }
   
   
  @@ -610,7 +610,7 @@
     printf("In x_dialog_unsaved_data_continue_callback, continuing to quit\n");
   #endif
     x_dialog_close_window(window);
  -  gattrib_quit();
  +  gattrib_quit(0);
     return;
   }
   
  @@ -637,7 +637,8 @@
   
   /* --------------------------------------------------------- *
    * This fcn informs the user that he has chosen an 
  - * unimplemented feature.
  + * unimplemented feature.  It presents only an "OK" button
  + * to leave.
    * --------------------------------------------------------- */
   void x_dialog_unimplemented_feature()
   {
  @@ -705,11 +706,6 @@
   		     GTK_SIGNAL_FUNC(x_dialog_about_close_callback),  /* stealing "about" fcn */
   		     GTK_WIDGET(unimplemented_feature_window) );
   
  -/* Remove bad size for widget */
  -#if 0
  -  gtk_widget_set_size_request (GTK_WIDGET (buttonclose), 50, 30);
  -#endif 
  -
     gtk_widget_show(buttonclose);
   
     if (!GTK_WIDGET_VISIBLE(unimplemented_feature_window)) {
  @@ -720,6 +716,65 @@
   
   
   /* ========================================================= *
  + * Exit announcment callback
  + * ========================================================= */
  +
  +/* --------------------------------------------------------- *
  + * This fcn accepts a string and displays it.  It presents
  + * only an "OK" button to close the box and exit gattrib.
  + * --------------------------------------------------------- */
  +void x_dialog_exit_announcement(gchar *string, gint return_code)
  +{
  +  GtkWidget *exit_announcement_window;
  +  GtkWidget *label = NULL;
  +  GtkWidget *buttonok = NULL;
  +  GtkWidget *vbox, *action_area;
  +
  +  exit_announcement_window = x_dialog_create_dialog_box(&vbox, &action_area);
  +
  +  gtk_window_position(GTK_WINDOW(exit_announcement_window),
  +		      GTK_WIN_POS_MOUSE);
  +  
  +  gtk_window_set_title(GTK_WINDOW(exit_announcement_window), 
  +		       "Attention!");
  +
  +  gtk_container_border_width(GTK_CONTAINER(exit_announcement_window), 5);
  +  
  +  /* Stick calling string into label widget */
  +  label = gtk_label_new(string);
  +  gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 5);
  +  gtk_widget_show(label);
  +  
  +  /* Now create OK button to stick in action area */
  +  buttonok = gtk_button_new_from_stock (GTK_STOCK_OK);
  +  GTK_WIDGET_SET_FLAGS(buttonok, GTK_CAN_DEFAULT);
  +  gtk_box_pack_start(GTK_BOX(action_area), buttonok, FALSE, FALSE, 0);
  +  gtk_signal_connect(GTK_OBJECT(buttonok), "clicked",
  +		     GTK_SIGNAL_FUNC(x_dialog_exit_announcement_close_callback),
  +		     return_code );
  +  gtk_widget_show(buttonok);
  +
  +  /* set this to grab ability to override other windows */
  +  gtk_window_set_modal(exit_announcement_window, TRUE);
  +
  + /* show window */
  +  if (!GTK_WIDGET_VISIBLE(exit_announcement_window)) {
  +    gtk_widget_show(exit_announcement_window);
  +  }
  +}
  +
  +/* --------------------------------------------------------- *
  + * OK button pressed -- 
  + * --------------------------------------------------------- */
  +void x_dialog_exit_announcement_close_callback(GtkWidget *buttonok, 
  +				    gint return_code)
  +{
  +  gattrib_quit(return_code);
  +}
  +
  +
  +
  +/* ========================================================= *
    * help/about dialog widgets
    * ========================================================= */
   
  
  
  
  1.12      +2 -1      eda/geda/gaf/gattrib/src/x_gtksheet.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_gtksheet.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_gtksheet.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- x_gtksheet.c	12 Aug 2006 18:58:48 -0000	1.11
  +++ x_gtksheet.c	16 Sep 2006 11:37:03 -0000	1.12
  @@ -91,8 +91,9 @@
       fflush(stderr);
       fflush(stdout);
       printf("In x_gtksheet_init, no components in comp sheet.\n");
  -    exit(-1);
   #endif
  +    x_dialog_exit_announcement("No components found in design.  Please check your schematic and try again!\n", -1);
  +    gtk_main();  /* Run gtk loop here since the next thing we do is quit. */ 
     }
     
   
  
  
  
  1.12      +29 -18    eda/geda/gaf/gattrib/src/x_window.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_window.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_window.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- x_window.c	13 Sep 2006 18:37:02 -0000	1.11
  +++ x_window.c	16 Sep 2006 11:37:03 -0000	1.12
  @@ -108,9 +108,9 @@
     printf("In x_window_init, about to connect delete and destroy signals to window.\n");
   #endif
     gtk_signal_connect (GTK_OBJECT (window), "delete_event",
  -		      GTK_SIGNAL_FUNC (gattrib_quit), NULL);
  +		      GTK_SIGNAL_FUNC (gattrib_quit), 0);
     gtk_signal_connect (GTK_OBJECT (window), "destroy",
  -		      GTK_SIGNAL_FUNC (gattrib_quit), NULL);
  +		      GTK_SIGNAL_FUNC (gattrib_quit), 0);
     
   
     /* -----  Now create main_vbox.  This is a container which organizes child  ----- */  
  @@ -233,7 +233,7 @@
   {
     gint i, j;
     gint num_rows, num_cols;
  -  char *text;
  +  gchar *text, *error_string;
     gint visibility, show_name_value;
     
   #ifdef DEBUG
  @@ -242,32 +242,43 @@
     printf("Entered x_window_add_items . . . . . ..\n");
   #endif
   
  -
     /* Do these sanity check to prevent later segfaults */
     if (sheet_head->comp_count == 0) {
  -    fprintf(stderr, "\n\nNo components found in entire design!\n");
  -    fprintf(stderr, "Do you have refdeses on your components?  \n");
  -    fprintf(stderr, "Exiting. . . .\n");
  -    exit(-1);
  +    error_string = g_strdup("\n\nNo components found in entire design!  ");
  +    error_string = g_strconcat(error_string, 
  +                            "Do you have refdeses on your components?  \n", NULL);
  +    error_string = g_strconcat(error_string, 
  +			    "Exiting. . . .\n");
  +    fprintf(stderr, "%s", error_string);
  +    x_dialog_exit_announcement(error_string, -1);
  +    g_free(error_string);
  +    gtk_main();
     }
   
     if (sheet_head->comp_attrib_count == 0) {
  -    fprintf(stderr, "\n\nNo configurable component attributes found in entire design!");
  -    fprintf(stderr, "Please attach at least some attributes before running gattrib.\n");
  -    fprintf(stderr, "Exiting. . . .\n");
  -    exit(-2);
  +    error_string = g_strdup("\n\nNo configurable component attributes found in entire design!  ");
  +    error_string = g_strconcat(error_string, 
  +                            "Please attach at least some attributes before running gattrib.\n", NULL);
  +    error_string = g_strconcat(error_string, "Exiting. . . .\n");
  +    fprintf(stderr, "%s", error_string);
  +    x_dialog_exit_announcement(error_string, -2);
  +    g_free(error_string);
  +    gtk_main();
     }
   
  +
     if (sheet_head->pin_count == 0) {
  -    fprintf(stderr, "\n\nNo pins found on any components!\n");
  -    fprintf(stderr, "Please check your design.\n");
  -    fprintf(stderr, "Exiting. . . .\n");
  -    exit(-3);
  +    error_string = g_strdup("\n\nNo pins found on any components!  ");
  +    error_string = g_strconcat(error_string, "Please check your design.\n", NULL);
  +    error_string = g_strconcat(error_string, "Exiting. . . .\n");
  +    fprintf(stderr, "%s", error_string);
  +    x_dialog_exit_announcement(error_string, -3);
  +    g_free(error_string);
  +    gtk_main();
     }
   
   
  -
  -  /* Since we have passed the sanity checking, initialize the gtksheet. */
  +  /*  initialize the gtksheet. */
   #ifdef DEBUG
     printf("In x_window_add_items, about to call x_gtksheet_init.\n");
   #endif
  
  
  


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