X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-import-assistant.h;h=881fc5bad04427dd74aef0f96cc59d25a2e31913;hb=a711865c16cf867db4782d6db2b1491c6bf7b983;hp=9d48d893bf2d5e6068f31494ea2c8e077974f8d8;hpb=83239cbb53294662025d5ee957d7e24e5feb66a9;p=pspp diff --git a/src/ui/gui/psppire-import-assistant.h b/src/ui/gui/psppire-import-assistant.h index 9d48d893bf..881fc5bad0 100644 --- a/src/ui/gui/psppire-import-assistant.h +++ b/src/ui/gui/psppire-import-assistant.h @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2015 Free Software Foundation + Copyright (C) 2015, 2017, 2020 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 @@ -23,9 +23,12 @@ #include -#include "libpspp/str.h" #include "psppire-dict.h" #include "data/spreadsheet-reader.h" +#include "psppire-text-file.h" +#include "psppire-delimited-text.h" + +#include G_BEGIN_DECLS @@ -57,27 +60,35 @@ struct spreadsheet; typedef struct _PsppireImportAssistant PsppireImportAssistant; typedef struct _PsppireImportAssistantClass PsppireImportAssistantClass; - -struct first_line_page; - -typedef void page_func (PsppireImportAssistant *, GtkWidget *page); - -enum { MAX_PREVIEW_LINES = 1000 }; /* Max number of lines to read. */ +enum IMPORT_ASSISTANT_DIRECTION {IMPORT_ASSISTANT_FORWARDS, IMPORT_ASSISTANT_BACKWARDS}; struct _PsppireImportAssistant { GtkAssistant parent; - GtkBuilder *builder; + gint previous_page; + gchar *file_name; + GMainLoop *main_loop; + GtkWidget *paste_button; + GtkWidget *reset_button; + int response; + + struct dictionary *dict; + struct dictionary *casereader_dict; + + GtkWidget *var_sheet; + GtkWidget *data_sheet; - gint current_page; /* START The chooser page of the assistant. */ GtkWidget *encoding_selector; GtkFileFilter *default_filter; /* END The chooser page of the assistant. */ - + + GtkBuilder *text_builder; + + /* START The introduction page of the assistant. */ GtkWidget *all_cases_button; GtkWidget *n_cases_button; @@ -87,71 +98,35 @@ struct _PsppireImportAssistant /* END The introduction page of the assistant. */ -/* START Page where the user chooses field separators. */ + /* START Page where the user chooses field separators. */ /* How to break lines into columns. */ - struct string separators; /* Field separators. */ struct string quotes; /* Quote characters. */ GtkWidget *custom_cb; GtkWidget *custom_entry; GtkWidget *quote_cb; GtkWidget *quote_combo; - GtkEntry *quote_entry; + GtkWidget *fields_tree_view; /* END Page where the user chooses field separators. */ -/* START Page where the user verifies and adjusts input formats. */ - GtkWidget *data_tree_view; - PsppireDict *psppire_dict; - struct variable **modified_vars; - size_t modified_var_cnt; -/* END Page where the user verifies and adjusts input formats. */ - - /* START first line page */ - GtkWidget *tree_view; + GtkWidget *first_line_tree_view; GtkWidget *variable_names_cb; /* END first line page */ - GMainLoop *main_loop; - GtkWidget *paste_button; - GtkWidget *reset_button; - int response; - int watch_cursor; - - GtkCellRenderer *prop_renderer; - GtkCellRenderer *fixed_renderer; - - // START struct file file; - char *file_name; /* File name. */ - - /* Relevant only for text files */ - - gchar *encoding; /* Encoding. */ - unsigned long int total_lines; /* Number of lines in file. */ - gboolean total_is_exact; /* Is total_lines exact (or an estimate)? */ - - /* The first several lines of the file. */ - struct string lines[MAX_PREVIEW_LINES]; - size_t line_cnt; - - // END struct file file; - - struct sheet_spec_page *sheet_spec; - struct first_line_page *first_line; - - /* The columns produced. */ - struct column *columns; /* Information about each column. */ - size_t column_cnt; /* Number of columns. */ - - int skip_lines; /* Number of initial lines to skip? */ - gboolean variable_names; /* Variable names above first line of data? */ - struct dictionary *dict; + PsppireTextFile *text_file; + PsppireDelimitedText *delimiters_model; + /* START spreadsheet related things */ + GtkBuilder *spread_builder; + GtkWidget *preview_sheet; struct spreadsheet *spreadsheet; + SswRange selection; + bool updating_selection; }; struct _PsppireImportAssistantClass @@ -166,6 +141,11 @@ GtkWidget *psppire_import_assistant_new (GtkWindow *toplevel); gchar *psppire_import_assistant_generate_syntax (PsppireImportAssistant *); +int psppire_import_assistant_run (PsppireImportAssistant *asst); + +GtkWidget *add_page_to_assistant (PsppireImportAssistant *ia, + GtkWidget *page, GtkAssistantPageType type, const gchar *title); + G_END_DECLS #endif /* __PSPPIRE_IMPORT_ASSISTANT_H__ */