Commit b76b60b0 authored by Morten Welinder's avatar Morten Welinder

Name space butchering.

parent f754884b
......@@ -42,7 +42,8 @@ static void
csv_page_global_change (G_GNUC_UNUSED GtkWidget *widget,
DruidPageData_t *data)
{
StfParseOptions_t *parseoptions = data->csv.csv_run_parseoptions;
StfParseOptions_t *parseoptions = data->csv.parseoptions;
RenderData_t *renderdata = data->csv.renderdata;
GSList *sepstr;
GString *sepc = g_string_new (NULL);
......@@ -89,10 +90,9 @@ csv_page_global_change (G_GNUC_UNUSED GtkWidget *widget,
stf_parse_options_csv_set_duplicates (parseoptions,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->csv.csv_duplicates)));
stf_parse_general_free (data->lines);
data->lines = stf_parse_general (parseoptions, data->cur);
stf_preview_render (data->csv.csv_run_renderdata);
stf_preview_set_lines (renderdata,
stf_parse_general (parseoptions, data->cur));
stf_preview_render (renderdata);
}
/**
......@@ -137,7 +137,7 @@ csv_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
G_GNUC_UNUSED GnomeDruid *druid,
DruidPageData_t *pagedata)
{
stf_parse_options_set_trim_spaces (pagedata->csv.csv_run_parseoptions, pagedata->trim);
stf_parse_options_set_trim_spaces (pagedata->csv.parseoptions, pagedata->trim);
if (format_get_arg_sep () == ',')
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pagedata->csv.csv_comma), TRUE);
......@@ -145,7 +145,7 @@ csv_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pagedata->csv.csv_semicolon), TRUE);
#if 0
stf_preview_set_startrow (pagedata->csv.csv_run_renderdata, GTK_RANGE (pagedata->csv.csv_scroll)->adjustment->value);
stf_preview_set_startrow (pagedata->csv.renderdata, GTK_RANGE (pagedata->csv.csv_scroll)->adjustment->value);
#endif
/* Calling this routine will also automatically call global change which updates the preview too */
......@@ -167,13 +167,13 @@ csv_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
void
stf_dialog_csv_page_cleanup (DruidPageData_t *pagedata)
{
if (pagedata->csv.csv_run_parseoptions) {
stf_parse_options_free (pagedata->csv.csv_run_parseoptions);
pagedata->csv.csv_run_parseoptions = NULL;
if (pagedata->csv.parseoptions) {
stf_parse_options_free (pagedata->csv.parseoptions);
pagedata->csv.parseoptions = NULL;
}
stf_preview_free (pagedata->csv.csv_run_renderdata);
pagedata->csv.csv_run_renderdata = NULL;
stf_preview_free (pagedata->csv.renderdata);
pagedata->csv.renderdata = NULL;
}
/**
......@@ -209,13 +209,12 @@ stf_dialog_csv_page_init (GladeXML *gui, DruidPageData_t *pagedata)
pagedata->csv.csv_data_container = glade_xml_get_widget (gui, "csv_data_container");
/* Set properties */
pagedata->csv.csv_run_renderdata =
pagedata->csv.renderdata =
stf_preview_new (pagedata->csv.csv_data_container,
&pagedata->lines,
NULL);
pagedata->csv.csv_run_parseoptions = stf_parse_options_new ();
pagedata->csv.parseoptions = stf_parse_options_new ();
stf_parse_options_set_type (pagedata->csv.csv_run_parseoptions, PARSE_TYPE_CSV);
stf_parse_options_set_type (pagedata->csv.parseoptions, PARSE_TYPE_CSV);
/* Connect signals */
g_signal_connect (G_OBJECT (pagedata->csv.csv_tab),
......
......@@ -44,12 +44,12 @@ fixed_page_autodiscover (DruidPageData_t *pagedata)
guint i = 1;
char *tset[2];
stf_parse_options_fixed_autodiscover (pagedata->fixed.fixed_run_parseoptions, pagedata->importlines, (char *) pagedata->cur);
stf_parse_options_fixed_autodiscover (pagedata->fixed.parseoptions, pagedata->importlines, (char *) pagedata->cur);
gtk_clist_clear (pagedata->fixed.fixed_collist);
while (i < pagedata->fixed.fixed_run_parseoptions->splitpositions->len) {
while (i < pagedata->fixed.parseoptions->splitpositions->len) {
tset[0] = g_strdup_printf ("%d", i - 1);
tset[1] = g_strdup_printf ("%d", g_array_index (pagedata->fixed.fixed_run_parseoptions->splitpositions,
tset[1] = g_strdup_printf ("%d", g_array_index (pagedata->fixed.parseoptions->splitpositions,
int,
i));
gtk_clist_append (pagedata->fixed.fixed_collist, tset);
......@@ -73,7 +73,7 @@ fixed_page_autodiscover (DruidPageData_t *pagedata)
* no columns where found
*/
if (pagedata->fixed.fixed_run_parseoptions->splitpositions->len < 1) {
if (pagedata->fixed.parseoptions->splitpositions->len < 1) {
GtkWidget *dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
......@@ -100,7 +100,7 @@ cb_col_event (GtkWidget *button,
if (bevent->button == 1) {
/* Split column. */
GtkCellRenderer *cell = stf_preview_get_cell_renderer
(data->fixed.fixed_run_renderdata, col);
(data->fixed.renderdata, col);
char *row[2];
int i, charindex, colstart, colend;
PangoLayout *layout;
......@@ -180,8 +180,8 @@ cb_col_event (GtkWidget *button,
static void
fixed_page_update_preview (DruidPageData_t *pagedata)
{
StfParseOptions_t *parseoptions = pagedata->fixed.fixed_run_parseoptions;
RenderData_t *renderdata = pagedata->fixed.fixed_run_renderdata;
StfParseOptions_t *parseoptions = pagedata->fixed.parseoptions;
RenderData_t *renderdata = pagedata->fixed.renderdata;
char *t[2];
int i, temp;
......@@ -192,8 +192,8 @@ fixed_page_update_preview (DruidPageData_t *pagedata)
stf_parse_options_fixed_splitpositions_add (parseoptions, temp);
}
stf_parse_general_free (pagedata->lines);
pagedata->lines = stf_parse_general (parseoptions, pagedata->cur);
stf_preview_set_lines (renderdata,
stf_parse_general (parseoptions, pagedata->cur));
stf_preview_render (renderdata);
for (i = 0; i < renderdata->colcount; i++) {
......@@ -239,12 +239,12 @@ fixed_page_collist_select_row (GtkCList *clist, int row,
{
char *t[2];
if (data->fixed.fixed_run_manual) {
data->fixed.fixed_run_manual = FALSE;
if (data->fixed.manual) {
data->fixed.manual = FALSE;
return;
}
data->fixed.fixed_run_index = row;
data->fixed.index = row;
gtk_clist_get_text (clist, row, 1, t);
gtk_spin_button_set_value (data->fixed.fixed_colend, atoi (t[0]));
......@@ -267,11 +267,11 @@ fixed_page_colend_changed (GtkSpinButton *button, DruidPageData_t *data)
{
char *text;
if (data->fixed.fixed_run_index < 0 || (data->fixed.fixed_run_index == GTK_CLIST (data->fixed.fixed_collist)->rows - 1))
if (data->fixed.index < 0 || (data->fixed.index == GTK_CLIST (data->fixed.fixed_collist)->rows - 1))
return;
text = gtk_editable_get_chars (GTK_EDITABLE (button), 0, -1);
gtk_clist_set_text (data->fixed.fixed_collist, data->fixed.fixed_run_index, 1, text);
gtk_clist_set_text (data->fixed.fixed_collist, data->fixed.index, 1, text);
g_free (text);
fixed_page_update_preview (data);
......@@ -331,20 +331,20 @@ fixed_page_remove_clicked (G_GNUC_UNUSED GtkButton *button,
{
int i;
if (data->fixed.fixed_run_index < 0 || (data->fixed.fixed_run_index == GTK_CLIST (data->fixed.fixed_collist)->rows - 1))
data->fixed.fixed_run_index--;
if (data->fixed.index < 0 || (data->fixed.index == GTK_CLIST (data->fixed.fixed_collist)->rows - 1))
data->fixed.index--;
gtk_clist_remove (data->fixed.fixed_collist, data->fixed.fixed_run_index);
gtk_clist_remove (data->fixed.fixed_collist, data->fixed.index);
for (i = data->fixed.fixed_run_index; i < GTK_CLIST (data->fixed.fixed_collist)->rows; i++) {
for (i = data->fixed.index; i < GTK_CLIST (data->fixed.fixed_collist)->rows; i++) {
char *text = g_strdup_printf ("%d", i);
gtk_clist_set_text (data->fixed.fixed_collist, i, 0, text);
g_free (text);
}
gtk_clist_select_row (data->fixed.fixed_collist, data->fixed.fixed_run_index, 0);
gnumeric_clist_moveto (data->fixed.fixed_collist, data->fixed.fixed_run_index);
gtk_clist_select_row (data->fixed.fixed_collist, data->fixed.index, 0);
gnumeric_clist_moveto (data->fixed.fixed_collist, data->fixed.index);
fixed_page_update_preview (data);
}
......@@ -409,15 +409,15 @@ fixed_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
{
GtkAdjustment *spinadjust;
stf_parse_options_set_trim_spaces (pagedata->fixed.fixed_run_parseoptions, TRIM_TYPE_NEVER);
stf_parse_options_set_trim_spaces (pagedata->fixed.parseoptions, TRIM_TYPE_NEVER);
#if 0
stf_preview_set_startrow (pagedata->fixed.fixed_run_renderdata, GTK_RANGE (pagedata->fixed.fixed_scroll)->adjustment->value);
stf_preview_set_startrow (pagedata->fixed.renderdata, GTK_RANGE (pagedata->fixed.fixed_scroll)->adjustment->value);
#endif
spinadjust = gtk_spin_button_get_adjustment (pagedata->fixed.fixed_colend);
spinadjust->lower = 1;
spinadjust->upper = stf_parse_get_longest_row_width (pagedata->fixed.fixed_run_parseoptions, pagedata->cur);
spinadjust->upper = stf_parse_get_longest_row_width (pagedata->fixed.parseoptions, pagedata->cur);
gtk_spin_button_set_adjustment (pagedata->fixed.fixed_colend, spinadjust);
fixed_page_update_preview (pagedata);
......@@ -438,11 +438,11 @@ fixed_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
void
stf_dialog_fixed_page_cleanup (DruidPageData_t *pagedata)
{
stf_preview_free (pagedata->fixed.fixed_run_renderdata);
stf_preview_free (pagedata->fixed.renderdata);
if (pagedata->fixed.fixed_run_parseoptions) {
stf_parse_options_free (pagedata->fixed.fixed_run_parseoptions);
pagedata->fixed.fixed_run_parseoptions = NULL;
if (pagedata->fixed.parseoptions) {
stf_parse_options_free (pagedata->fixed.parseoptions);
pagedata->fixed.parseoptions = NULL;
}
}
......@@ -474,17 +474,16 @@ stf_dialog_fixed_page_init (GladeXML *gui, DruidPageData_t *pagedata)
pagedata->fixed.fixed_data_container = (glade_xml_get_widget (gui, "fixed_data_container"));
/* Set properties */
pagedata->fixed.fixed_run_renderdata =
pagedata->fixed.renderdata =
stf_preview_new (pagedata->fixed.fixed_data_container,
&pagedata->lines,
NULL);
pagedata->fixed.fixed_run_parseoptions = stf_parse_options_new ();
pagedata->fixed.fixed_run_manual = FALSE;
pagedata->fixed.fixed_run_index = -1;
pagedata->fixed.fixed_run_mousedown = FALSE;
pagedata->fixed.fixed_run_xorigin = 0;
pagedata->fixed.parseoptions = stf_parse_options_new ();
pagedata->fixed.manual = FALSE;
pagedata->fixed.index = -1;
pagedata->fixed.mousedown = FALSE;
pagedata->fixed.xorigin = 0;
stf_parse_options_set_type (pagedata->fixed.fixed_run_parseoptions, PARSE_TYPE_FIXED);
stf_parse_options_set_type (pagedata->fixed.parseoptions, PARSE_TYPE_FIXED);
gtk_clist_column_titles_passive (pagedata->fixed.fixed_collist);
......
......@@ -81,18 +81,19 @@ cb_col_clicked (GtkTreeViewColumn *column, gpointer _i)
static void
format_page_update_preview (DruidPageData_t *pagedata)
{
RenderData_t *renderdata = pagedata->format.format_run_renderdata;
RenderData_t *renderdata = pagedata->format.renderdata;
unsigned int ui;
int i;
stf_preview_colformats_clear (renderdata);
for (ui = 0; ui < pagedata->format.format_run_list->len; ui++) {
StyleFormat *sf = g_ptr_array_index (pagedata->format.format_run_list, ui);
for (ui = 0; ui < pagedata->format.formats->len; ui++) {
StyleFormat *sf = g_ptr_array_index (pagedata->format.formats, ui);
stf_preview_colformats_add (renderdata, sf);
}
stf_parse_general_free (pagedata->lines);
pagedata->lines = stf_parse_general (pagedata->format.format_run_parseoptions, pagedata->cur);
stf_preview_set_lines (renderdata,
stf_parse_general (pagedata->format.parseoptions,
pagedata->cur));
stf_preview_render (renderdata);
for (i = 0; i < renderdata->colcount; i++) {
......@@ -132,7 +133,7 @@ format_page_collist_select_row (G_GNUC_UNUSED GtkCList *clist,
G_GNUC_UNUSED GdkEventButton *event,
DruidPageData_t *data)
{
StyleFormat const *colformat = g_ptr_array_index (data->format.format_run_list, row);
StyleFormat const *colformat = g_ptr_array_index (data->format.formats, row);
char *fmt;
if (!colformat)
......@@ -140,12 +141,12 @@ format_page_collist_select_row (G_GNUC_UNUSED GtkCList *clist,
gnumeric_clist_moveto (data->format.format_collist, row);
if (data->format.format_run_manual_change) {
data->format.format_run_manual_change = FALSE;
if (data->format.manual_change) {
data->format.manual_change = FALSE;
return;
}
data->format.format_run_index = row;
data->format.index = row;
fmt = style_format_as_XL (colformat, TRUE);
gtk_entry_set_text (data->format.format_format, fmt);
g_free (fmt);
......@@ -172,8 +173,8 @@ format_page_sublist_select_row (GtkCList *clist, int row, int column,
char *t[1];
/* User did not select, it was done in the code with gtk_clist_select_row */
if (data->format.format_run_manual_change) {
data->format.format_run_manual_change = FALSE;
if (data->format.manual_change) {
data->format.manual_change = FALSE;
return;
}
......@@ -183,10 +184,10 @@ format_page_sublist_select_row (GtkCList *clist, int row, int column,
gtk_clist_get_text (clist, row, column, t);
data->format.format_run_sublist_select = FALSE;
data->format.sublist_select = FALSE;
if (strcmp (t[0], _("Custom")) != 0)
gtk_entry_set_text (data->format.format_format, t[0]);
data->format.format_run_sublist_select = TRUE;
data->format.sublist_select = TRUE;
}
/**
......@@ -202,25 +203,25 @@ format_page_sublist_select_row (GtkCList *clist, int row, int column,
static void
format_page_format_changed (GtkEntry *entry, DruidPageData_t *data)
{
if (data->format.format_run_index >= 0) {
if (data->format.index >= 0) {
int i, found;
char *t[1];
char *new_fmt = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
StyleFormat *sf;
sf = g_ptr_array_index (data->format.format_run_list, data->format.format_run_index);
sf = g_ptr_array_index (data->format.formats, data->format.index);
style_format_unref (sf);
g_ptr_array_index (data->format.format_run_list, data->format.format_run_index) =
g_ptr_array_index (data->format.formats, data->format.index) =
style_format_new_XL (new_fmt, TRUE);
gtk_clist_set_text (data->format.format_collist, data->format.format_run_index, 1, new_fmt);
gtk_clist_set_text (data->format.format_collist, data->format.index, 1, new_fmt);
gtk_clist_set_column_width (data->format.format_collist,
1,
gtk_clist_optimal_column_width (data->format.format_collist, 1));
if (data->format.format_run_sublist_select) {
if (data->format.sublist_select) {
found = 0;
for (i = 0; i < GTK_CLIST (data->format.format_sublist)->rows; i++) {
gtk_clist_get_text (data->format.format_sublist, i, 0, t);
......@@ -230,7 +231,7 @@ format_page_format_changed (GtkEntry *entry, DruidPageData_t *data)
}
}
data->format.format_run_manual_change = TRUE;
data->format.manual_change = TRUE;
gtk_clist_select_row (data->format.format_sublist, found, 0);
gnumeric_clist_moveto (data->format.format_sublist, found);
}
......@@ -262,15 +263,15 @@ format_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
format_page_update_preview (data);
/* If necessary add new items (non-visual) */
while ((int)data->format.format_run_list->len < data->format.format_run_renderdata->colcount) {
g_ptr_array_add (data->format.format_run_list,
while ((int)data->format.formats->len < data->format.renderdata->colcount) {
g_ptr_array_add (data->format.formats,
style_format_new_XL (cell_formats[0][0], FALSE));
}
/* Add new items visual */
gtk_clist_clear (data->format.format_collist);
for (i = 0; i < data->format.format_run_renderdata->colcount; i++) {
StyleFormat *sf = g_ptr_array_index (data->format.format_run_list, i);
for (i = 0; i < data->format.renderdata->colcount; i++) {
StyleFormat *sf = g_ptr_array_index (data->format.formats, i);
char *t[2];
t[0] = g_strdup_printf (_(COLUMN_CAPTION), i + 1);
......@@ -281,14 +282,14 @@ format_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
}
gtk_clist_columns_autosize (data->format.format_collist);
data->format.format_run_manual_change = TRUE;
data->format.manual_change = TRUE;
gtk_clist_select_row (data->format.format_collist, 0, 0);
gnumeric_clist_moveto (data->format.format_collist, 0);
data->format.format_run_index = 0;
data->format.index = 0;
{
StyleFormat const *sf = g_ptr_array_index (data->format.format_run_list, 0);
StyleFormat const *sf = g_ptr_array_index (data->format.formats, 0);
char *fmt;
fmt = style_format_as_XL (sf, TRUE);
......@@ -306,7 +307,7 @@ format_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
* @pagedata : mother struct
*
* This should be called when the druid has finished to clean up resources
* used. In this case the format_run_list data pointers and the format_run_list
* used. In this case the formats data pointers and the formats
* itself will be freed
*
* returns : nothing
......@@ -314,7 +315,7 @@ format_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
void
stf_dialog_format_page_cleanup (DruidPageData_t *pagedata)
{
GPtrArray *formats = pagedata->format.format_run_list;
GPtrArray *formats = pagedata->format.formats;
if (formats) {
unsigned int ui;
for (ui = 0; ui < formats->len; ui++) {
......@@ -324,7 +325,7 @@ stf_dialog_format_page_cleanup (DruidPageData_t *pagedata)
g_ptr_array_free (formats, TRUE);
}
stf_preview_free (pagedata->format.format_run_renderdata);
stf_preview_free (pagedata->format.renderdata);
}
/**
......@@ -359,15 +360,14 @@ stf_dialog_format_page_init (GladeXML *gui, DruidPageData_t *pagedata)
pagedata->format.format_trim = GTK_OPTION_MENU (glade_xml_get_widget (gui, "format_trim"));
/* Set properties */
pagedata->format.format_run_renderdata =
pagedata->format.renderdata =
stf_preview_new (pagedata->format.format_data_container,
&pagedata->lines,
workbook_date_conv (wb_control_workbook (WORKBOOK_CONTROL (pagedata->wbcg))));
pagedata->format.format_run_list = g_ptr_array_new ();
pagedata->format.format_run_index = -1;
pagedata->format.format_run_manual_change = FALSE;
pagedata->format.format_run_sublist_select = TRUE;
pagedata->format.format_run_parseoptions = NULL; /* stf_parse_options_new (); */
pagedata->format.formats = g_ptr_array_new ();
pagedata->format.index = -1;
pagedata->format.manual_change = FALSE;
pagedata->format.sublist_select = TRUE;
pagedata->format.parseoptions = NULL; /* stf_parse_options_new (); */
gtk_clist_column_titles_passive (pagedata->format.format_sublist);
......
......@@ -33,10 +33,10 @@
static void
main_page_update_preview (DruidPageData_t *pagedata)
{
RenderData_t *renderdata = pagedata->main.main_run_renderdata;
RenderData_t *renderdata = pagedata->main.renderdata;
stf_parse_general_free (pagedata->lines);
pagedata->lines = stf_parse_lines (pagedata->data, TRUE);
stf_preview_set_lines (renderdata,
stf_parse_lines (pagedata->data, TRUE));
stf_preview_render (renderdata);
}
......@@ -71,14 +71,15 @@ main_page_set_spin_button_adjustment (GtkSpinButton* spinbutton, int min, int ma
static void
main_page_import_range_changed (DruidPageData_t *data)
{
RenderData_t *renderdata = data->main.renderdata;
int startrow, stoprow;
char *linescaption;
startrow = gtk_spin_button_get_value_as_int (data->main.main_startrow);
stoprow = gtk_spin_button_get_value_as_int (data->main.main_stoprow);
if (stoprow > (int)data->lines->len) {
stoprow = data->lines->len;
if (stoprow > (int)renderdata->lines->len) {
stoprow = renderdata->lines->len;
gtk_spin_button_set_value (data->main.main_stoprow, stoprow);
}
......@@ -88,10 +89,12 @@ main_page_import_range_changed (DruidPageData_t *data)
}
main_page_set_spin_button_adjustment (data->main.main_startrow, 1, stoprow);
main_page_set_spin_button_adjustment (data->main.main_stoprow, startrow, data->lines->len);
main_page_set_spin_button_adjustment (data->main.main_stoprow, startrow, renderdata->lines->len);
data->importlines = (stoprow - startrow) + 1;
linescaption = g_strdup_printf (_("%d of %d lines to import"), data->importlines, data->lines->len);
linescaption = g_strdup_printf (_("%d of %d lines to import"),
data->importlines,
renderdata->lines->len);
gtk_label_set_text (data->main.main_lines, linescaption);
g_free (linescaption);
}
......@@ -147,7 +150,7 @@ static void
main_page_stringindicator_change (G_GNUC_UNUSED GtkWidget *widget,
DruidPageData_t *data)
{
StfParseOptions_t *parseoptions = data->csv.csv_run_parseoptions;
StfParseOptions_t *parseoptions = data->csv.parseoptions;
char *textfieldtext;
gunichar str_ind;
......@@ -214,7 +217,7 @@ main_page_prepare (G_GNUC_UNUSED GnomeDruidPage *page,
void
stf_dialog_main_page_cleanup (DruidPageData_t *pagedata)
{
stf_preview_free (pagedata->main.main_run_renderdata);
stf_preview_free (pagedata->main.renderdata);
}
/**
......@@ -244,9 +247,8 @@ stf_dialog_main_page_init (GladeXML *gui, DruidPageData_t *pagedata)
pagedata->main.main_textindicator = GTK_COMBO (glade_xml_get_widget (gui, "main_textindicator"));
pagedata->main.main_textfield = GTK_ENTRY (glade_xml_get_widget (gui, "main_textfield"));
renderdata = pagedata->main.main_run_renderdata = stf_preview_new
renderdata = pagedata->main.renderdata = stf_preview_new
(pagedata->main.main_data_container,
&pagedata->lines,
NULL);
renderdata->ignore_formats = TRUE;
......@@ -269,9 +271,9 @@ stf_dialog_main_page_init (GladeXML *gui, DruidPageData_t *pagedata)
NULL);
/* Set properties */
main_page_set_spin_button_adjustment (pagedata->main.main_startrow, 1, pagedata->lines->len);
main_page_set_spin_button_adjustment (pagedata->main.main_stoprow, 1, pagedata->lines->len);
gtk_spin_button_set_value (pagedata->main.main_stoprow, pagedata->lines->len);
main_page_set_spin_button_adjustment (pagedata->main.main_startrow, 1, renderdata->lines->len);
main_page_set_spin_button_adjustment (pagedata->main.main_stoprow, 1, renderdata->lines->len);
gtk_spin_button_set_value (pagedata->main.main_stoprow, renderdata->lines->len);
{
GtkFrame *main_frame = GTK_FRAME (glade_xml_get_widget (gui, "main_frame"));
......
......@@ -96,7 +96,7 @@ render_get_value (gint row, gint column, gpointer _rd, GValue *value)
{
RenderData_t *rd = (RenderData_t *)_rd;
GnumericLazyList *ll = rd->ll;
GPtrArray *lines = *rd->plines;
GPtrArray *lines = rd->lines;
GPtrArray *line = (row < (int)lines->len)
? g_ptr_array_index (lines, row)
: NULL;
......@@ -135,7 +135,7 @@ stf_preview_render (RenderData_t *renderdata)
g_return_if_fail (renderdata != NULL);
g_return_if_fail (renderdata->data_container != NULL);
lines = *(renderdata->plines);
lines = renderdata->lines;
for (i = 0; i < lines->len; i++) {
GPtrArray *line = g_ptr_array_index (lines, i);
colcount = MAX (colcount, (int)line->len);
......@@ -190,7 +190,6 @@ stf_preview_render (RenderData_t *renderdata)
**/
RenderData_t*
stf_preview_new (GtkWidget *data_container,
GPtrArray **plines,
GnmDateConventions const *date_conv)
{
RenderData_t* renderdata;
......@@ -203,7 +202,7 @@ stf_preview_new (GtkWidget *data_container,
renderdata->startrow = 1;
renderdata->colformats = g_ptr_array_new ();
renderdata->ignore_formats = FALSE;
renderdata->plines = plines;
renderdata->lines = NULL;
renderdata->date_conv = date_conv;
......@@ -241,9 +240,24 @@ stf_preview_free (RenderData_t *renderdata)
stf_preview_colformats_clear (renderdata);
g_ptr_array_free (renderdata->colformats, TRUE);
stf_preview_set_lines (renderdata, NULL);
g_free (renderdata);
}
void
stf_preview_set_lines (RenderData_t *renderdata, GPtrArray *lines)
{
g_return_if_fail (renderdata != NULL);
if (renderdata->lines == lines)
return;
if (renderdata->lines)
stf_parse_general_free (renderdata->lines);
renderdata->lines = lines;
}
/**
* stf_preview_set_startrow
* @renderdata : struct containing rendering information
......
......@@ -30,11 +30,11 @@
typedef struct {
GtkWidget *data_container;
GPtrArray **plines;
GPtrArray *lines;
GnumericLazyList *ll;
GtkTreeView *tree_view;
int colcount;
int colcount;
int startrow; /* Row at which to start rendering */
GPtrArray *colformats; /* Array containing the desired column formats */
......@@ -48,11 +48,11 @@ void stf_preview_render (RenderData_t *renderda
/* These are for creation/deletion */
RenderData_t* stf_preview_new (GtkWidget *data_container,
GPtrArray **plines,
GnmDateConventions const *date_conv);
void stf_preview_free (RenderData_t *data);
/* These are for manipulation */
void stf_preview_set_lines (RenderData_t *data, GPtrArray *lines);
void stf_preview_set_startrow (RenderData_t *data, int startrow);
void stf_preview_colformats_clear (RenderData_t *renderdata);
......
/*
* dialog-stf.c : implementation of the STF import dialog
* dialog-stf.c: implementation of the STF import dialog
*
* Copyright 2001 Almer S. Tigelaar <almer@gnome.org>
* Copyright 2003 Morten Welinder <terra@gnome.org>
......@@ -35,13 +35,13 @@
/**
* stf_dialog_druid_page_cancel
* @page : Active druid page
* @druid : The parent Druid widget
* @data : mother struct
* @page: Active druid page
* @druid: The parent Druid widget
* @data: mother struct
*
* Presents the user with a nice cancel y/n dialog.
*
* returns : TRUE if the user actually wants to cancel, FALSE otherwise.
* returns: TRUE if the user actually wants to cancel, FALSE otherwise.
**/
static gboolean
stf_dialog_druid_page_cancel (G_GNUC_UNUSED GnomeDruidPage *page,
......@@ -54,12 +54,12 @@ stf_dialog_druid_page_cancel (G_GNUC_UNUSED GnomeDruidPage *page,
/**
* stf_dialog_druid_position_to_page
* @pagedata : mother struct
* @pos : Position in the druid
* @pagedata: mother struct
* @pos: Position in the druid
*
* Will translate a DPG_* position into a pointer to the page.
*
* returns : A pointer to the GnomeDruidPage indicated by @pos
* returns: A pointer to the GnomeDruidPage indicated by @pos
**/
static GnomeDruidPage*
stf_dialog_druid_position_to_page (DruidPageData_t *pagedata, DruidPosition_t pos)
......@@ -69,7 +69,7 @@ stf_dialog_druid_position_to_page (DruidPageData_t *pagedata, DruidPosition_t po
case DPG_CSV : return pagedata->csv_page;
case DPG_FIXED : return pagedata->fixed_page;
case DPG_FORMAT : return pagedata->format_page;
default :
default:
g_warning ("Unknown druid position");
return NULL;
}
......@@ -77,11 +77,11 @@ stf_dialog_druid_position_to_page (DruidPageData_t *pagedata, DruidPosition_t po
/**
* stf_dialog_set_initial_keyboard_focus
* @pagedata : mother struct
* @pagedata: mother struct
*
* Sets keyboard focus to the an appropriate widget on the page.
*
* returns : nothing
* returns: nothing
**/
static void
stf_dialog_set_initial_keyboard_focus (DruidPageData_t *pagedata)
......@@ -89,23 +89,23 @@ stf_dialog_set_initial_keyboard_focus (DruidPageData_t *pagedata)
GtkWidget *focus_widget = NULL;
switch (pagedata->position) {
case DPG_MAIN :
case DPG_MAIN:
focus_widget =
GTK_WIDGET (pagedata->main.main_separated);
break;
case DPG_CSV :
case DPG_CSV:
focus_widget =
GTK_WIDGET (pagedata->csv.csv_space);
break;
case DPG_FIXED :
case DPG_FIXED:
focus_widget = GTK_WIDGET
(&pagedata->fixed.fixed_colend->entry);
break; /* ?? */
case DPG_FORMAT :
case DPG_FORMAT:
focus_widget =
GTK_WIDGET (pagedata->format.format_format);
break;
default :
default:
g_warning ("Unknown druid position");
}
......@@ -115,14 +115,14 @@ stf_dialog_set_initial_keyboard_focus (DruidPageData_t *pagedata)
/**
* stf_dialog_druid_page_next
* @page : A druid page
* @druid : The druid itself
* @data : mother struct
* @page: A druid page
* @druid: The druid itself
* @data: mother struct
*
* This function will determine and set the next page depending on choices
* made in previous pages
*
* returns : always TRUE, because it always sets the new page manually
* returns: always TRUE, because it always sets the new page manually
**/