/[pspp]/psppire/src/data_sheet.c
ViewVC logotype

Diff of /psppire/src/data_sheet.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by jmd, Wed Nov 2 09:44:02 2005 UTC revision 1.10 by jmd, Wed Nov 2 13:17:29 2005 UTC
# Line 28  Line 28 
28  #include "pspp-dict.h"  #include "pspp-dict.h"
29  #include "sfm-write.h"  #include "sfm-write.h"
30  #include "case.h"  #include "case.h"
31    #include "file-handle-def.h"
32    
33  #define _(A) A  #define _(A) A
34  #define N_(A) A  #define N_(A) A
# Line 184  remove_variable(GObject *obj, gint colum Line 185  remove_variable(GObject *obj, gint colum
185  }  }
186    
187    
188    static int
189    adjust_column_width(GtkSheet *sheet, gint col, gint width)
190    {
191      struct variable *var = pspp_dict_get_var(pspp_dictionary, col);
192    
193      if ( ! var)
194        return;
195    
196      const gint unit_width = M_width(sheet, 0, col);
197    
198    
199      if ( var->display_width != width / unit_width )
200        {
201          var->display_width = width / unit_width  ;
202          pspp_dict_var_changed(pspp_dictionary, col);
203        }
204    
205      return FALSE;
206    }
207    
208  /* Clear the entire sheet */  /* Clear the entire sheet */
209  void  void
# Line 195  psppire_data_sheet_clear(GtkSheet *sheet Line 215  psppire_data_sheet_clear(GtkSheet *sheet
215    repopulate_columns(sheet, pspp_dictionary, 0,    repopulate_columns(sheet, pspp_dictionary, 0,
216                       gtk_sheet_get_columns_count(sheet) - 1);                       gtk_sheet_get_columns_count(sheet) - 1);
217    
   
218  }  }
219    
220    
# Line 243  psppire_data_sheet_create (gchar *widget Line 262  psppire_data_sheet_create (gchar *widget
262    
263    psppire_data_sheet_col_set_enable(GTK_SHEET(sheet),0,columns -1,FALSE);    psppire_data_sheet_col_set_enable(GTK_SHEET(sheet),0,columns -1,FALSE);
264    
265      g_signal_connect(sheet, "new_column_width",
266                       G_CALLBACK(adjust_column_width), 0);
267    
268    for (i = 0 ; i < columns ; ++i )    for (i = 0 ; i < columns ; ++i )
269      {      {
# Line 260  void Line 281  void
281  psppire_create_system_file(GtkSheet *sheet, PSPP_Dict *d, struct file_handle *handle)  psppire_create_system_file(GtkSheet *sheet, PSPP_Dict *d, struct file_handle *handle)
282  {  {
283    gint r;    gint r;
284    g_print("Saving system file\n");  
285      g_assert(handle);
286    
287    const struct sfm_write_options wo = {true, false, 3};    const struct sfm_write_options wo = {true, false, 3};
288    
289      g_print("Writing system file %s\n",handle_get_filename(handle));
290        
291    struct sfm_writer *writer = sfm_open_writer(handle, d->dict, wo);    struct sfm_writer *writer = sfm_open_writer(handle, d->dict, wo);
292    
# Line 288  psppire_create_system_file(GtkSheet *she Line 312  psppire_create_system_file(GtkSheet *she
312    
313            if ( v->type == ALPHA)            if ( v->type == ALPHA)
314              {              {
315                memset (value->s, ' ', MAX_SHORT_STRING);                memset (value->s, ' ', v->width);
316    
317                if ( text)                if ( text)
318                  {                  {
# Line 297  psppire_create_system_file(GtkSheet *she Line 321  psppire_create_system_file(GtkSheet *she
321              }              }
322            else            else
323              {              {
324                  g_assert(v->width == 0);
325                if (text)                if (text)
326                  value->f = atoi(text);                  value->f = atoi(text);
327                else                else

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26