struct gnumeric_reader *gr = (struct gnumeric_reader *) s;
assert (n < s->n_sheets);
- return gr->sheets[n].name;
+ return gr->sheets[n].name; // Kludge: Assumes the encoding is utf8
}
static void
gnm_file_casereader_destroy (struct casereader *reader UNUSED, void *r_)
{
- int i;
struct gnumeric_reader *r = r_;
if ( r == NULL)
return ;
void
gnumeric_destroy (struct spreadsheet *s)
{
- struct gnumeric_reader *r = (struct gnumeric *) s;
gnm_file_casereader_destroy (NULL, s);
}
#include "spreadsheet-reader.h"
+#include "gnumeric-reader.h"
+
#include <libpspp/str.h>
#include <stdio.h>
#include <string.h>
-
+#include <gl/xalloc.h>
+#include <gl/c-xvasprintf.h>
+#include <stdlib.h>
struct spreadsheet *
spreadsheet_open (const char *filename)
}
void
-spreadsheet_close (struct spreadsheet *spreadsheet)
+spreadsheet_close (UNUSED struct spreadsheet *spreadsheet)
{
}
i -= lower;
i += base;
- ret = malloc (exp);
+ ret = xmalloc (exp);
exp = 0;
do
cs0 = int_to_ps26 (col0);
csi = int_to_ps26 (coli);
- s = c_xasprintf ("%s%d:%s%ld",
+ s = c_xasprintf ("%s%d:%s%d",
cs0, row0 + 1,
csi, rowi + 1);
free (cs0);
struct spreadsheet
{
- char *file_name;
+ const char *file_name;
enum spreadsheet_type type;
static void
-destroy_spreadsheet_read_info (struct spreadsheet_read_info *sri,
+destroy_spreadsheet_read_info (UNUSED struct spreadsheet_read_info *sri,
struct spreadsheet_read_options *opts)
{
free (opts->sheet_name);
src/ui/gui/split-file-dialog.h \
src/ui/gui/page-assistant.c \
src/ui/gui/page-intro.c \
+ src/ui/gui/page-intro.h \
src/ui/gui/page-file.c \
src/ui/gui/page-first-line.c \
+ src/ui/gui/page-first-line.h \
src/ui/gui/page-formats.c \
+ src/ui/gui/page-formats.h \
src/ui/gui/page-separators.c \
+ src/ui/gui/page-separators.h \
src/ui/gui/page-sheet-spec.c \
+ src/ui/gui/page-sheet-spec.h \
src/ui/gui/text-data-import-dialog.c \
src/ui/gui/text-data-import-dialog.h \
src/ui/gui/transpose-dialog.c \
on_prepare (GtkAssistant *assistant, GtkWidget *page,
struct import_assistant *ia)
{
- struct sheet_spec_page *ssp = ia->sheet_spec;
-
int pn = gtk_assistant_get_current_page (assistant);
- g_print ("%s:%d Page %d %p\n", __FILE__, __LINE__, pn, page);
if ( ia->spreadsheet)
{
{
enum { MAX_LINE_LEN = 16384 }; /* Max length of an acceptable line. */
struct file *file = &ia->file;
- struct sheet_spec_page *ssp = ia->sheet_spec;
struct spreadsheet_read_info sri;
struct spreadsheet_read_options opts;
#include <config.h>
+#include "page-first-line.h"
+
#include "ui/gui/text-data-import-dialog.h"
#include <errno.h>
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 Free Software Foundation
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
+#ifndef PAGE_FIRST_LINE_H
+#define PAGE_FIRST_LINE_H
+
+struct first_line_page ;
+struct import_assistant;
+
+struct first_line_page *first_line_page_create (struct import_assistant *ia);
+
+#endif
GtkBin *vars_scroller;
GtkWidget *old_var_sheet;
PsppireVarSheet *var_sheet;
- struct separators_page *seps = ia->separators;
struct formats_page *p = ia->formats;
struct fmt_guesser *fg;
unsigned long int number = 0;
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 Free Software Foundation
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef PAGE_FORMATS_H
+#define PAGE_FORMATS_H
+
+struct formats_page;
+struct import_assistant;
+
+struct formats_page *formats_page_create (struct import_assistant *ia);
+
+
+#endif
#include <config.h>
+#include "page-intro.h"
+
#include "ui/gui/text-data-import-dialog.h"
#include <errno.h>
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 Free Software Foundation
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef PAGE_INTRO_H
+#define PAGE_INTRO_H
+
+struct intro_page;
+struct import_assistant;
+
+struct intro_page *intro_page_create (struct import_assistant *ia);
+
+
+#endif
#include <config.h>
+#include "page-separators.h"
+
#include "ui/gui/text-data-import-dialog.h"
#include <errno.h>
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 Free Software Foundation
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PAGE_SEPARATORS
+#define PAGE_SEPARATORS
+
+struct separators_page;
+struct import_assistant;
+
+struct separators_page *separators_page_create (struct import_assistant *ia);
+
+#endif
#include <config.h>
+#include "page-sheet-spec.h"
+
#include "ui/gui/text-data-import-dialog.h"
#include <errno.h>
{
GtkBuilder *builder = ia->asst.builder;
GtkWidget *sheet_entry = get_widget_assert (builder, "sheet-entry");
- printf ("%s:%d %p\n", __FILE__, __LINE__, ia->spreadsheet);
+
gtk_combo_box_set_model (GTK_COMBO_BOX (sheet_entry),
psppire_spreadsheet_model_new (ia->spreadsheet));
- gtk_combo_box_set_active (sheet_entry, 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (sheet_entry), 0);
}
struct casereader *creader = NULL;
struct dictionary *dict = NULL;
- GtkWidget *sheet_entry = get_widget_assert (builder, "sheet-entry");
GtkWidget *range_entry = get_widget_assert (builder, "cell-range-entry");
GtkWidget *readnames_checkbox = get_widget_assert (builder, "readnames-checkbox");
--- /dev/null
+/* PSPPIRE - a graphical user interface for PSPP.
+ Copyright (C) 2013 Free Software Foundation
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef PAGE_SHEET_SPEC
+#define PAGE_SHEET_SPEC 1
+
+
+struct sheet_spec_page ;
+struct import_assistant;
+
+/* Initializes IA's sheet_spec substructure. */
+struct sheet_spec_page *sheet_spec_page_create (struct import_assistant *ia);
+
+char *sheet_spec_gen_syntax (const struct import_assistant *ia);
+
+
+#endif
#define N 10
+#if 0
static GtkListStore *
make_store ()
{
}
return list_store;
}
-
+#endif
struct spreadsheet *sp = NULL;
GtkWidget *combo_box;
#include "ui/gui/text-data-import-dialog.h"
+#include "page-intro.h"
+#include "page-sheet-spec.h"
+#include "page-first-line.h"
+#include "page-separators.h"
+#include "page-formats.h"
+
#include <errno.h>
#include <fcntl.h>
#include <gtk-contrib/psppire-sheet.h>
{
GtkWindow *parent_window = GTK_WINDOW (dw);
struct import_assistant *ia = init_assistant (parent_window);
- GtkBuilder *builder = ia->asst.builder;
struct sheet_spec_page *ssp ;
if (!init_file (ia, parent_window))
if (ia->spreadsheet == NULL)
{
- size_t var_cnt;
- size_t i;
syntax_gen_pspp (&s,
"GET DATA"
"\n /TYPE=TXT"
if (ia->file.encoding && strcmp (ia->file.encoding, "Auto"))
syntax_gen_pspp (&s, " /ENCODING=%sq\n", ia->file.encoding);
+#if 0
intro_append_syntax (ia->intro, &s);
ds_put_cstr (&s,
" /ARRANGEMENT=DELIMITED\n"
" /DELCASE=LINE\n");
-#if 0
+
if (ia->first_line->skip_lines > 0)
ds_put_format (&s, " /FIRSTCASE=%d\n", ia->first_line->skip_lines + 1);
ds_put_cstr (&s, " /DELIMITERS=\"");