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

gEDA-cvs: CVS update: i_basic.c



  User: werner  
  Date: 06/11/19 13:08:43

  Modified:    .        i_basic.c x_grid.c x_window.c
  Log:
  	* src/i_basic.c, src/x_grid.c, src/x_window.c: moved the 
  
  	  filename from the status bar to the window title.
  
  	  Show grid settings in the status bar.
  
  
  
  
  
  
  Revision  Changes    Path
  1.14      +60 -40    eda/geda/gaf/gschem/src/i_basic.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: i_basic.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/i_basic.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- i_basic.c	15 Jul 2006 18:51:41 -0000	1.13
  +++ i_basic.c	19 Nov 2006 18:08:42 -0000	1.14
  @@ -639,52 +639,72 @@
   #endif
   }
   
  -/*! \todo Finish function documentation!!!
  - *  \brief
  +/*! \brief Set filename as gschem  window title
    *  \par Function Description
  - *
  + *  Set the window title using the gnome HID format style.
    */
  -void i_set_filename(TOPLEVEL *w_current, const char *string)
  +void i_set_filename(TOPLEVEL *w_current, const gchar *string)
   {
  -  char trunc_string[41];
  -  int len;
  -  int i;
  +  gchar *print_string=NULL;
  +  gchar *filename=NULL;
  +  int max_len = 70;
   
  -  if (!w_current->filename_label) {
  +  if (!w_current->main_window)
  +    return;
  +  if (string == NULL)
       return;
  -  }
   
  -  if (string) {
  -    len = strlen(string);
  -    w_current->DONT_RESIZE = 1;
  -
  -    if (w_current->filename_label) {
  -      if (len > 40) {
  -
  -        trunc_string[0] = '.';
  -        trunc_string[1] = '.';
  -        trunc_string[2] = '.';
  -
  -        trunc_string[40] = '\0';
  -        for (i = 39 ; i > 2; i--) {
  -          if (len >= 0) {
  -            trunc_string[i] = string[len];
  -          } else {
  -            break;
  -          }
  -          len--;
  -        }
  +  filename = g_path_get_basename(string);
   
  -        gtk_label_set(GTK_LABEL(w_current->
  -                                filename_label),
  -                      trunc_string);
  -
  -      } else {
  -
  -        gtk_label_set(GTK_LABEL(w_current->
  -                                filename_label),
  -                      (char *) string);
  +  print_string = g_strdup_printf("%s - gschem", filename);
  +  
  +  /* alternativ code with length limited pathname */
  +/*  if (strlen(string) > max_len) {
  +    print_string = g_strdup_printf("gschem: ...%s",
  +				   &(string[strlen(string)-max_len]));
         }
  +  else {
  +    print_string = g_strdup_printf("gschem: %s",string);
       }
  +*/
  +
  +  gtk_window_set_title(GTK_WINDOW(w_current->main_window),
  +		       print_string);
  +  
  +  g_free(print_string);
  +  g_free(filename);
  +}
  +
  +/*! \brief Write the grid settings to the gschem status bar
  + *  \par Function Description
  + *  The function takes the current grid paramters of gschem and
  + *  prints it to the status bar.
  + *  The format is "Grid([SnapGridSize],[CurrentGridSize])"
  + */
  +void i_set_grid(TOPLEVEL *w_current, int visible_grid) 
  +{
  +  gchar *print_string=NULL;
  +  gchar *snap=NULL;
  +  gchar *grid=NULL;
  +
  +  if (!w_current->grid_label) {
  +    return;
     }
  +  
  +  if (!w_current->snap)
  +    snap = g_strdup(_("OFF"));
  +  else
  +    snap = g_strdup_printf("%d", w_current->snap_size);
  +
  +  if (!w_current->grid)
  +    grid = g_strdup(_("OFF"));
  +  else
  +    grid = g_strdup_printf("%d", visible_grid);
  +
  +  print_string = g_strdup_printf(_("Grid(%s, %s)"), snap, grid);
  +  gtk_label_set(GTK_LABEL(w_current->grid_label), print_string);
  +  
  +  g_free(print_string);
  +  g_free(grid);
  +  g_free(snap);
   }
  
  
  
  1.16      +4 -0      eda/geda/gaf/gschem/src/x_grid.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: x_grid.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gschem/src/x_grid.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -b -r1.15 -r1.16
  --- x_grid.c	15 Jul 2006 18:51:41 -0000	1.15
  +++ x_grid.c	19 Nov 2006 18:08:43 -0000	1.16
  @@ -50,6 +50,7 @@
     int screen_incr = 0;
   
     if (!w_current->grid) {
  +    i_set_grid(w_current, -1);
       return;
     }
   
  @@ -80,6 +81,9 @@
       }
     }
   
  +  /* update status bar */
  +  i_set_grid(w_current, incr);
  +
   #if DEBUG 
     printf("---------x_grid_draw\n incr: %d\n",incr);
   
  
  
  
  1.50      +3 -3      eda/geda/gaf/gschem/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/gschem/src/x_window.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -b -r1.49 -r1.50
  --- x_window.c	8 Oct 2006 17:43:34 -0000	1.49
  +++ x_window.c	19 Nov 2006 18:08:43 -0000	1.50
  @@ -92,7 +92,7 @@
   
     toplevel->status_label = NULL;
     toplevel->middle_label = NULL;
  -  toplevel->filename_label = NULL;
  +  toplevel->grid_label = NULL;
     
     toplevel->cswindow = NULL;
     toplevel->aswindow = NULL;
  @@ -704,8 +704,8 @@
     label = gtk_label_new (" ");
     gtk_box_pack_start (GTK_BOX (bottom_box), label, FALSE, FALSE, 5);
   
  -  w_current->filename_label = gtk_label_new (" ");
  -  gtk_box_pack_start (GTK_BOX (bottom_box), w_current->filename_label,
  +  w_current->grid_label = gtk_label_new (" ");
  +  gtk_box_pack_start (GTK_BOX (bottom_box), w_current->grid_label,
                         FALSE, FALSE, 10);
   
     w_current->status_label = gtk_label_new (_("Select Mode"));
  
  
  


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