26 |
#include "gtksheet.h" |
#include "gtksheet.h" |
27 |
#include "pspp-dict.h" |
#include "pspp-dict.h" |
28 |
#include "sfm-write.h" |
#include "sfm-write.h" |
29 |
|
#include "value-labels.h" |
30 |
#include "case.h" |
#include "case.h" |
31 |
#include "file-handle-def.h" |
#include "file-handle-def.h" |
32 |
#include "data-in.h" |
#include "data-in.h" |
33 |
|
|
34 |
|
#include "callbacks.h" |
35 |
#include "data_sheet.h" |
#include "data_sheet.h" |
36 |
|
|
37 |
#define _(A) A |
#define _(A) A |
51 |
gint from, gint to); |
gint from, gint to); |
52 |
|
|
53 |
|
|
54 |
|
/* True if values should be displayed as labels */ |
55 |
|
static gboolean display_labels = FALSE; |
56 |
|
|
57 |
|
/* Repair any damage that may have been done to the data sheet */ |
58 |
|
void |
59 |
|
psppire_data_sheet_redisplay(const GtkSheet *sheet) |
60 |
|
{ |
61 |
|
repopulate_columns(sheet, pspp_dictionary, 0, |
62 |
|
gtk_sheet_get_columns_count(sheet) - 1); |
63 |
|
} |
64 |
|
|
65 |
/* Return the width that an 'M' character would occupy when typeset at |
/* Return the width that an 'M' character would occupy when typeset at |
66 |
row, col */ |
row, col */ |
94 |
} |
} |
95 |
|
|
96 |
|
|
97 |
|
/* Callback which occurs when the column title is double clicked */ |
98 |
|
static gboolean |
99 |
|
click2column(GtkWidget *w, gint col, gpointer data) |
100 |
|
{ |
101 |
|
gint current_row, current_column; |
102 |
|
select_sheet(PAGE_VAR_SHEET); |
103 |
|
GtkWidget *var_sheet = glade_xml_get_widget(xml, "variable_sheet"); |
104 |
|
|
105 |
|
gtk_sheet_get_active_cell(GTK_SHEET(var_sheet), |
106 |
|
¤t_row, ¤t_column); |
107 |
|
|
108 |
|
gtk_sheet_set_active_cell(GTK_SHEET(var_sheet), col, current_column); |
109 |
|
|
110 |
|
return FALSE; |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
/* Update the data_ref_entry with the reference of the active cell */ |
/* Update the data_ref_entry with the reference of the active cell */ |
115 |
static gint |
static gint |
116 |
update_data_ref_entry(GtkSheet *sheet, gint row, gint col) |
update_data_ref_entry(GtkSheet *sheet, gint row, gint col) |
501 |
|
|
502 |
const struct fmt_spec *fp = &v->write; |
const struct fmt_spec *fp = &v->write; |
503 |
|
|
504 |
gchar *s = malloc(sizeof(gchar) * (fp->w + 1)); |
gchar *s; |
505 |
|
if ( ! display_labels || 0 == (s = val_labs_find (v->val_labs, *val))) |
506 |
|
{ |
507 |
|
s = malloc(sizeof(gchar) * (fp->w + 1)); |
508 |
|
|
509 |
/* Converts binary value V into printable form in the exactly |
/* Converts binary value V into printable form in the exactly |
510 |
FP->W character in buffer S according to format specification |
FP->W character in buffer S according to format specification |
511 |
FP. No null terminator is appended to the buffer. */ |
FP. No null terminator is appended to the buffer. */ |
512 |
data_out (s, fp, val); |
data_out (s, fp, val); |
513 |
s[fp->w] = '\0'; |
s[fp->w] = '\0'; |
514 |
|
} |
515 |
|
|
516 |
case_destroy(&mycase); |
case_destroy(&mycase); |
517 |
|
|
630 |
0); |
0); |
631 |
|
|
632 |
|
|
633 |
|
g_signal_connect (GTK_OBJECT (sheet), "double-click-column", |
634 |
|
GTK_SIGNAL_FUNC (click2column), |
635 |
|
0); |
636 |
|
|
637 |
gtk_widget_show(sheet); |
gtk_widget_show(sheet); |
638 |
|
|
639 |
return sheet; |
return sheet; |
720 |
if (row > last_populated_row) |
if (row > last_populated_row) |
721 |
last_populated_row = row; |
last_populated_row = row; |
722 |
} |
} |
723 |
|
|
724 |
|
|
725 |
|
void |
726 |
|
psppire_data_sheet_set_show_labels(GtkSheet *sheet, gboolean show_labels) |
727 |
|
{ |
728 |
|
display_labels = show_labels; |
729 |
|
} |
730 |
|
|