Merge remote branch 'origin/master' into import-gui
[pspp] / src / ui / gui / page-formats.c
index 16438eeaee9d52542ac914fd75e351e952f37e98..6a2109d44af9f1ddc7382447eaa1382e2f791c43 100644 (file)
@@ -48,7 +48,6 @@
 #include "ui/gui/psppire-var-sheet.h"
 #include "ui/gui/psppire-var-store.h"
 #include "ui/gui/psppire-scanf.h"
-#include "ui/syntax-gen.h"
 
 #include "gl/error.h"
 #include "gl/intprops.h"
@@ -199,6 +198,8 @@ prepare_formats_page (struct import_assistant *ia)
     GTK_CONTAINER (get_widget_assert (ia->asst.builder, "data-scroller")),
     ia);
 
+  gtk_widget_show (ia->asst.paste_button);
+
   pop_watch_cursor (ia);
 }
 
@@ -269,3 +270,23 @@ on_variable_change (PsppireDict *dict, int dict_idx,
 }
 
 
+
+
+void
+formats_append_syntax (const struct import_assistant *ia, struct string *s)
+{
+  int i;
+  int var_cnt;
+  ds_put_cstr (s, "  /VARIABLES=\n");
+  
+  var_cnt = dict_get_var_cnt (ia->dict);
+  for (i = 0; i < var_cnt; i++)
+    {
+      struct variable *var = dict_get_var (ia->dict, i);
+      char format_string[FMT_STRING_LEN_MAX + 1];
+      fmt_to_string (var_get_print_format (var), format_string);
+      ds_put_format (s, "    %s %s%s\n",
+                    var_get_name (var), format_string,
+                    i == var_cnt - 1 ? "." : "");
+    }
+}