if (ia->spreadsheet)
spreadsheet_unref (ia->spreadsheet);
- ds_destroy (&ia->separators);
ds_destroy (&ia->quotes);
g_object_unref (ia->builder);
{
push_watch_cursor (ia);
- get_separators (ia);
+ // get_separators (ia);
// split_fields (ia);
choose_column_names (ia);
pop_watch_cursor (ia);
}
+
+#if SHEET_MERGE
+
/* Chooses the most common character among those in TARGETS,
based on the frequency data in HISTOGRAM, and stores it in
RESULT. If there is a tie for the most common character among
find_commonest_chars (histogram, ",;:/|!\t-", ",", &ia->separators);
}
+#endif
static void set_separators (PsppireImportAssistant *ia);
repopulate_delimiter_columns (ia);
revise_fields_preview (ia);
- choose_likely_separators (ia);
- set_separators (ia);
+ // choose_likely_separators (ia);
+ // set_separators (ia);
}
struct separator
#define SEPARATOR_CNT (sizeof separators / sizeof *separators)
+#if SHEET_MERGE
/* Sets the widgets to match IA's separators substructure. */
static void
gtk_widget_set_sensitive (ia->quote_combo, any_quotes);
}
+#endif
/* Resets IA's intro page to its initial state. */
static void
}
-
+#if SHEET_MERGE
/* Sets IA's separators substructure to match the widgets. */
static void
-#if SHEET_MERGE
+
/* Breaks the file data in IA into columns based on the
separators set in IA's separators substructure. */
separators_append_syntax (const PsppireImportAssistant *ia, struct string *s)
{
int i;
+
ds_put_cstr (s, " /DELIMITERS=\"");
- if (ds_find_byte (&ia->separators, '\t') != SIZE_MAX)
+
+ if (gtk_toggle_button_get_active (get_widget_assert (ia->builder, "tab")))
ds_put_cstr (s, "\\t");
- if (ds_find_byte (&ia->separators, '\\') != SIZE_MAX)
- ds_put_cstr (s, "\\\\");
- for (i = 0; i < ds_length (&ia->separators); i++)
+ for (i = 0; i < SEPARATOR_CNT; i++)
{
- char c = ds_at (&ia->separators, i);
- if (c == '"')
- ds_put_cstr (s, "\"\"");
- else if (c != '\t' && c != '\\')
- ds_put_byte (s, c);
+ const struct separator *seps = &separators[i];
+ GtkWidget *button = get_widget_assert (ia->builder, seps->name);
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+ {
+ if (seps->c == '\t')
+ continue;
+
+ ds_put_byte (s, seps->c);
+ }
}
ds_put_cstr (s, "\"\n");
if (!ds_is_empty (&ia->quotes))
syntax_gen_pspp (s, " /QUALIFIER=%sq\n", ds_cstr (&ia->quotes));
}
-
static void
formats_append_syntax (const PsppireImportAssistant *ia, struct string *s)
{