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 |
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 |
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 |
|
|
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 |
{ |
{ |
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 |
|
|
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 |
{ |
{ |
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 |