projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'origin/stable'
[pspp-builds.git]
/
src
/
ui
/
gui
/
text-data-import-dialog.c
diff --git
a/src/ui/gui/text-data-import-dialog.c
b/src/ui/gui/text-data-import-dialog.c
index 2cecd548756879c8c45cbf4963439a893626cd3d..6f33ff6d8bb8b6547a76a91bc06d35260a3a1881 100644
(file)
--- a/
src/ui/gui/text-data-import-dialog.c
+++ b/
src/ui/gui/text-data-import-dialog.c
@@
-45,7
+45,7
@@
#include <ui/gui/psppire-dialog.h>
#include <ui/gui/psppire-var-sheet.h>
#include <ui/gui/psppire-var-store.h>
#include <ui/gui/psppire-dialog.h>
#include <ui/gui/psppire-var-sheet.h>
#include <ui/gui/psppire-var-store.h>
-#include
<ui/gui/helper.h>
+#include
"executor.h"
#include "error.h"
#include "xalloc.h"
#include "error.h"
#include "xalloc.h"
@@
-310,11
+310,9
@@
apply_dict (const struct dictionary *dict, struct string *s)
syntax_gen_pspp (s, "MISSING VALUES %ss (", name);
for (j = 0; j < mv_n_values (mv); j++)
{
syntax_gen_pspp (s, "MISSING VALUES %ss (", name);
for (j = 0; j < mv_n_values (mv); j++)
{
- union value value;
if (j)
ds_put_cstr (s, ", ");
if (j)
ds_put_cstr (s, ", ");
- mv_get_value (mv, &value, j);
- syntax_gen_value (s, &value, width, format);
+ syntax_gen_value (s, mv_get_value (mv, j), width, format);
}
if (mv_has_range (mv))
}
if (mv_has_range (mv))
@@
-330,18
+328,20
@@
apply_dict (const struct dictionary *dict, struct string *s)
if (var_has_value_labels (var))
{
const struct val_labs *vls = var_get_value_labels (var);
if (var_has_value_labels (var))
{
const struct val_labs *vls = var_get_value_labels (var);
- struct val_labs_iterator *iter;
- struct val_lab *vl;
+ const struct val_lab **labels = val_labs_sorted (vls);
+ size_t n_labels = val_labs_count (vls);
+ size_t i;
syntax_gen_pspp (s, "VALUE LABELS %ss", name);
syntax_gen_pspp (s, "VALUE LABELS %ss", name);
- for (vl = val_labs_first_sorted (vls, &iter); vl != NULL;
- vl = val_labs_next (vls, &iter))
+ for (i = 0; i < n_labels; i++)
{
{
+ const struct val_lab *vl = labels[i];
ds_put_cstr (s, "\n ");
syntax_gen_value (s, &vl->value, width, format);
ds_put_char (s, ' ');
ds_put_cstr (s, "\n ");
syntax_gen_value (s, &vl->value, width, format);
ds_put_char (s, ' ');
- syntax_gen_string (s, ss_cstr (v
l->label
));
+ syntax_gen_string (s, ss_cstr (v
al_lab_get_label (vl)
));
}
}
+ free (labels);
ds_put_cstr (s, ".\n");
}
if (var_has_label (var))
ds_put_cstr (s, ".\n");
}
if (var_has_label (var))
@@
-649,6
+649,13
@@
static void
on_prepare (GtkAssistant *assistant, GtkWidget *page,
struct import_assistant *ia)
{
on_prepare (GtkAssistant *assistant, GtkWidget *page,
struct import_assistant *ia)
{
+
+ if (gtk_assistant_get_page_type (assistant, page)
+ == GTK_ASSISTANT_PAGE_CONFIRM)
+ gtk_widget_grab_focus (assistant->apply);
+ else
+ gtk_widget_grab_focus (assistant->forward);
+
if (page == ia->separators.page)
prepare_separators_page (ia);
else if (page == ia->formats.page)
if (page == ia->separators.page)
prepare_separators_page (ia);
else if (page == ia->formats.page)
@@
-1536,6
+1543,7
@@
init_formats_page (struct import_assistant *ia)
p->data_tree_view = GTK_TREE_VIEW (get_widget_assert (builder, "data"));
p->modified_vars = NULL;
p->modified_var_cnt = 0;
p->data_tree_view = GTK_TREE_VIEW (get_widget_assert (builder, "data"));
p->modified_vars = NULL;
p->modified_var_cnt = 0;
+ p->dict = NULL;
}
/* Frees IA's formats substructure. */
}
/* Frees IA's formats substructure. */
@@
-1725,7
+1733,7
@@
parse_field (struct import_assistant *ia,
char **outputp, char **tooltipp)
{
struct substring field;
char **outputp, char **tooltipp)
{
struct substring field;
- union value
*
val;
+ union value val;
struct variable *var;
const struct fmt_spec *in;
struct fmt_spec out;
struct variable *var;
const struct fmt_spec *in;
struct fmt_spec out;
@@
-1734,15
+1742,17
@@
parse_field (struct import_assistant *ia,
field = ia->separators.columns[column].contents[row];
var = dict_get_var (ia->formats.dict, column);
field = ia->separators.columns[column].contents[row];
var = dict_get_var (ia->formats.dict, column);
- val
= value_create (
var_get_width (var));
+ val
ue_init (&val,
var_get_width (var));
in = var_get_print_format (var);
out = fmt_for_output_from_input (in);
tooltip = NULL;
if (field.string != NULL)
{
msg_disable ();
in = var_get_print_format (var);
out = fmt_for_output_from_input (in);
tooltip = NULL;
if (field.string != NULL)
{
msg_disable ();
+
if (!data_in (field, LEGACY_NATIVE, in->type, 0, 0, 0,
if (!data_in (field, LEGACY_NATIVE, in->type, 0, 0, 0,
- val, var_get_width (var)))
+ ia->formats.dict,
+ &val, var_get_width (var)))
{
char fmt_string[FMT_STRING_LEN_MAX + 1];
fmt_to_string (in, fmt_string);
{
char fmt_string[FMT_STRING_LEN_MAX + 1];
fmt_to_string (in, fmt_string);
@@
-1757,16
+1767,13
@@
parse_field (struct import_assistant *ia,
{
tooltip = xstrdup (_("This input line has too few separators "
"to fill in this field."));
{
tooltip = xstrdup (_("This input line has too few separators "
"to fill in this field."));
- value_set_missing (val, var_get_width (var));
+ value_set_missing (
&
val, var_get_width (var));
}
if (outputp != NULL)
{
}
if (outputp != NULL)
{
- char *output = xmalloc (out.w + 1);
- data_out (val, &out, output);
- output[out.w] = '\0';
- *outputp = output;
+ *outputp = data_out (&val, dict_get_encoding (ia->formats.dict), &out);
}
}
-
free (val
);
+
value_destroy (&val, var_get_width (var)
);
ok = tooltip == NULL;
if (tooltipp != NULL)
ok = tooltip == NULL;
if (tooltipp != NULL)