Commit c20793a2 authored by Almer. S. Tigelaar's avatar Almer. S. Tigelaar Committed by Almer S. Tigelaar

New function. (stf_parse_csv_cell): Modified so it can trim spaces in

2000-05-27  Almer. S. Tigelaar.  <almer1@dds.nl>

	* src/dialogs/stf-parse.c:
	(stf_parse_options_set_trim_spaces): New function.
	(stf_parse_csv_cell): Modified so it can trim spaces in
	several ways
	(stf_parse_fixed_cell): Ditto.
	(stf_parse_get_longest_row_width) : Fixed small bug which
	caused incorrect width to be returned.

	* src/dialogs/dialog-stf.glade:
	Added trim spaces option and did some general polishing.

	* src/dialogs/dialog-stf.h:
	Added new member to DruidPageData_t which indicates weather
	the user wants to trim spaces and in which way.

	* src/dialogs/dialog-stf-main-page.c:
	(stf_dialog_main_page_init): Modified so it loads the trim optionmenu.
	(main_page_trim_menu_deactivate): New.

	* src/dialogs/dialog-stf-csv-page.c:
	(stf_dialog_csv_page_prepare): Now sets the trim member of the parse
	options struct.

	* src/dialogs/dialog-stf-fixed-page.c:
	(stf_dialog_fixed_page_prepare): Now sets the trim member of the
	parse options struct.
	(stf_dialog_fixed_page_prepare): Did not honor the from/to line
	settings.
	(fixed_page_remove_clicked): Added gnumeric_clist_moveto to make
	selection visible.
	(fixed_page_add_clicked): Ditto.

	* src/dialogs/dialog-stf-format-page.c:
	(format_page_canvas_button_press_event): Modified to use
	gnumeric_clist_moveto
	(format_page_collist_select_row): Ditto.
	(format_page_format_changed): Ditto.
	(stf_dialog_format_page_prepare): Ditto.

	* src/gnumeric-util.c, src/gnumeric-util.h:
	(gnumeric_option_menu_get_selected_index): New function, Returns
	the selected index of a GtkOptionMenu. (Originally from
	dialog-stf-export-format-page.c)

	* src/dialogs/dialog-stf-export-format-page.c:
	(stf_export_dialog_option_menu_index): Removed.
	(sheet_page_separator_menu_deactivate): Modified to use the new
	gnumeric_option_menu_get_selected_index.
	(stf_export_dialog_format_page_result): Ditto.

	* doc/stf-parser.txt:
	Update documentation.
parent e327f55a
2000-05-27 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/stf-parse.c:
(stf_parse_options_set_trim_spaces): New function.
(stf_parse_csv_cell): Modified so it can trim spaces in
several ways
(stf_parse_fixed_cell): Ditto.
(stf_parse_get_longest_row_width) : Fixed small bug which
caused incorrect width to be returned.
* src/dialogs/dialog-stf.glade:
Added trim spaces option and did some general polishing.
* src/dialogs/dialog-stf.h:
Added new member to DruidPageData_t which indicates weather
the user wants to trim spaces and in which way.
* src/dialogs/dialog-stf-main-page.c:
(stf_dialog_main_page_init): Modified so it loads the trim optionmenu.
(main_page_trim_menu_deactivate): New.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Now sets the trim member of the parse
options struct.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Now sets the trim member of the
parse options struct.
(stf_dialog_fixed_page_prepare): Did not honor the from/to line
settings.
(fixed_page_remove_clicked): Added gnumeric_clist_moveto to make
selection visible.
(fixed_page_add_clicked): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(format_page_canvas_button_press_event): Modified to use
gnumeric_clist_moveto
(format_page_collist_select_row): Ditto.
(format_page_format_changed): Ditto.
(stf_dialog_format_page_prepare): Ditto.
* src/gnumeric-util.c, src/gnumeric-util.h:
(gnumeric_option_menu_get_selected_index): New function, Returns
the selected index of a GtkOptionMenu. (Originally from
dialog-stf-export-format-page.c)
* src/dialogs/dialog-stf-export-format-page.c:
(stf_export_dialog_option_menu_index): Removed.
(sheet_page_separator_menu_deactivate): Modified to use the new
gnumeric_option_menu_get_selected_index.
(stf_export_dialog_format_page_result): Ditto.
* doc/stf-parser.txt:
Update documentation.
2000-05-26 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Fix typo, and thinko.
......
2000-05-27 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/stf-parse.c:
(stf_parse_options_set_trim_spaces): New function.
(stf_parse_csv_cell): Modified so it can trim spaces in
several ways
(stf_parse_fixed_cell): Ditto.
(stf_parse_get_longest_row_width) : Fixed small bug which
caused incorrect width to be returned.
* src/dialogs/dialog-stf.glade:
Added trim spaces option and did some general polishing.
* src/dialogs/dialog-stf.h:
Added new member to DruidPageData_t which indicates weather
the user wants to trim spaces and in which way.
* src/dialogs/dialog-stf-main-page.c:
(stf_dialog_main_page_init): Modified so it loads the trim optionmenu.
(main_page_trim_menu_deactivate): New.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Now sets the trim member of the parse
options struct.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Now sets the trim member of the
parse options struct.
(stf_dialog_fixed_page_prepare): Did not honor the from/to line
settings.
(fixed_page_remove_clicked): Added gnumeric_clist_moveto to make
selection visible.
(fixed_page_add_clicked): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(format_page_canvas_button_press_event): Modified to use
gnumeric_clist_moveto
(format_page_collist_select_row): Ditto.
(format_page_format_changed): Ditto.
(stf_dialog_format_page_prepare): Ditto.
* src/gnumeric-util.c, src/gnumeric-util.h:
(gnumeric_option_menu_get_selected_index): New function, Returns
the selected index of a GtkOptionMenu. (Originally from
dialog-stf-export-format-page.c)
* src/dialogs/dialog-stf-export-format-page.c:
(stf_export_dialog_option_menu_index): Removed.
(sheet_page_separator_menu_deactivate): Modified to use the new
gnumeric_option_menu_get_selected_index.
(stf_export_dialog_format_page_result): Ditto.
* doc/stf-parser.txt:
Update documentation.
2000-05-26 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Fix typo, and thinko.
......
......@@ -8,6 +8,9 @@ Morten:
of throwing strings around.
* Improved the optimization of styles.
Almer:
* Stf importer bug fixes and enhancements.
Translations:
* Updated: de (Karl), ja (Oka), no (Kjartan), and more.
* Updates not new, but not mentioned the last time: it (Leandro)
......
2000-05-27 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/stf-parse.c:
(stf_parse_options_set_trim_spaces): New function.
(stf_parse_csv_cell): Modified so it can trim spaces in
several ways
(stf_parse_fixed_cell): Ditto.
(stf_parse_get_longest_row_width) : Fixed small bug which
caused incorrect width to be returned.
* src/dialogs/dialog-stf.glade:
Added trim spaces option and did some general polishing.
* src/dialogs/dialog-stf.h:
Added new member to DruidPageData_t which indicates weather
the user wants to trim spaces and in which way.
* src/dialogs/dialog-stf-main-page.c:
(stf_dialog_main_page_init): Modified so it loads the trim optionmenu.
(main_page_trim_menu_deactivate): New.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Now sets the trim member of the parse
options struct.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Now sets the trim member of the
parse options struct.
(stf_dialog_fixed_page_prepare): Did not honor the from/to line
settings.
(fixed_page_remove_clicked): Added gnumeric_clist_moveto to make
selection visible.
(fixed_page_add_clicked): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(format_page_canvas_button_press_event): Modified to use
gnumeric_clist_moveto
(format_page_collist_select_row): Ditto.
(format_page_format_changed): Ditto.
(stf_dialog_format_page_prepare): Ditto.
* src/gnumeric-util.c, src/gnumeric-util.h:
(gnumeric_option_menu_get_selected_index): New function, Returns
the selected index of a GtkOptionMenu. (Originally from
dialog-stf-export-format-page.c)
* src/dialogs/dialog-stf-export-format-page.c:
(stf_export_dialog_option_menu_index): Removed.
(sheet_page_separator_menu_deactivate): Modified to use the new
gnumeric_option_menu_get_selected_index.
(stf_export_dialog_format_page_result): Ditto.
* doc/stf-parser.txt:
Update documentation.
2000-05-26 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Fix typo, and thinko.
......
2000-05-27 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/stf-parse.c:
(stf_parse_options_set_trim_spaces): New function.
(stf_parse_csv_cell): Modified so it can trim spaces in
several ways
(stf_parse_fixed_cell): Ditto.
(stf_parse_get_longest_row_width) : Fixed small bug which
caused incorrect width to be returned.
* src/dialogs/dialog-stf.glade:
Added trim spaces option and did some general polishing.
* src/dialogs/dialog-stf.h:
Added new member to DruidPageData_t which indicates weather
the user wants to trim spaces and in which way.
* src/dialogs/dialog-stf-main-page.c:
(stf_dialog_main_page_init): Modified so it loads the trim optionmenu.
(main_page_trim_menu_deactivate): New.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Now sets the trim member of the parse
options struct.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Now sets the trim member of the
parse options struct.
(stf_dialog_fixed_page_prepare): Did not honor the from/to line
settings.
(fixed_page_remove_clicked): Added gnumeric_clist_moveto to make
selection visible.
(fixed_page_add_clicked): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(format_page_canvas_button_press_event): Modified to use
gnumeric_clist_moveto
(format_page_collist_select_row): Ditto.
(format_page_format_changed): Ditto.
(stf_dialog_format_page_prepare): Ditto.
* src/gnumeric-util.c, src/gnumeric-util.h:
(gnumeric_option_menu_get_selected_index): New function, Returns
the selected index of a GtkOptionMenu. (Originally from
dialog-stf-export-format-page.c)
* src/dialogs/dialog-stf-export-format-page.c:
(stf_export_dialog_option_menu_index): Removed.
(sheet_page_separator_menu_deactivate): Modified to use the new
gnumeric_option_menu_get_selected_index.
(stf_export_dialog_format_page_result): Ditto.
* doc/stf-parser.txt:
Update documentation.
2000-05-26 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Fix typo, and thinko.
......
2000-05-27 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/stf-parse.c:
(stf_parse_options_set_trim_spaces): New function.
(stf_parse_csv_cell): Modified so it can trim spaces in
several ways
(stf_parse_fixed_cell): Ditto.
(stf_parse_get_longest_row_width) : Fixed small bug which
caused incorrect width to be returned.
* src/dialogs/dialog-stf.glade:
Added trim spaces option and did some general polishing.
* src/dialogs/dialog-stf.h:
Added new member to DruidPageData_t which indicates weather
the user wants to trim spaces and in which way.
* src/dialogs/dialog-stf-main-page.c:
(stf_dialog_main_page_init): Modified so it loads the trim optionmenu.
(main_page_trim_menu_deactivate): New.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Now sets the trim member of the parse
options struct.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Now sets the trim member of the
parse options struct.
(stf_dialog_fixed_page_prepare): Did not honor the from/to line
settings.
(fixed_page_remove_clicked): Added gnumeric_clist_moveto to make
selection visible.
(fixed_page_add_clicked): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(format_page_canvas_button_press_event): Modified to use
gnumeric_clist_moveto
(format_page_collist_select_row): Ditto.
(format_page_format_changed): Ditto.
(stf_dialog_format_page_prepare): Ditto.
* src/gnumeric-util.c, src/gnumeric-util.h:
(gnumeric_option_menu_get_selected_index): New function, Returns
the selected index of a GtkOptionMenu. (Originally from
dialog-stf-export-format-page.c)
* src/dialogs/dialog-stf-export-format-page.c:
(stf_export_dialog_option_menu_index): Removed.
(sheet_page_separator_menu_deactivate): Modified to use the new
gnumeric_option_menu_get_selected_index.
(stf_export_dialog_format_page_result): Ditto.
* doc/stf-parser.txt:
Update documentation.
2000-05-26 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Fix typo, and thinko.
......
2000-05-27 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/stf-parse.c:
(stf_parse_options_set_trim_spaces): New function.
(stf_parse_csv_cell): Modified so it can trim spaces in
several ways
(stf_parse_fixed_cell): Ditto.
(stf_parse_get_longest_row_width) : Fixed small bug which
caused incorrect width to be returned.
* src/dialogs/dialog-stf.glade:
Added trim spaces option and did some general polishing.
* src/dialogs/dialog-stf.h:
Added new member to DruidPageData_t which indicates weather
the user wants to trim spaces and in which way.
* src/dialogs/dialog-stf-main-page.c:
(stf_dialog_main_page_init): Modified so it loads the trim optionmenu.
(main_page_trim_menu_deactivate): New.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Now sets the trim member of the parse
options struct.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Now sets the trim member of the
parse options struct.
(stf_dialog_fixed_page_prepare): Did not honor the from/to line
settings.
(fixed_page_remove_clicked): Added gnumeric_clist_moveto to make
selection visible.
(fixed_page_add_clicked): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(format_page_canvas_button_press_event): Modified to use
gnumeric_clist_moveto
(format_page_collist_select_row): Ditto.
(format_page_format_changed): Ditto.
(stf_dialog_format_page_prepare): Ditto.
* src/gnumeric-util.c, src/gnumeric-util.h:
(gnumeric_option_menu_get_selected_index): New function, Returns
the selected index of a GtkOptionMenu. (Originally from
dialog-stf-export-format-page.c)
* src/dialogs/dialog-stf-export-format-page.c:
(stf_export_dialog_option_menu_index): Removed.
(sheet_page_separator_menu_deactivate): Modified to use the new
gnumeric_option_menu_get_selected_index.
(stf_export_dialog_format_page_result): Ditto.
* doc/stf-parser.txt:
Update documentation.
2000-05-26 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Fix typo, and thinko.
......
2000-05-27 Almer. S. Tigelaar. <almer1@dds.nl>
* src/dialogs/stf-parse.c:
(stf_parse_options_set_trim_spaces): New function.
(stf_parse_csv_cell): Modified so it can trim spaces in
several ways
(stf_parse_fixed_cell): Ditto.
(stf_parse_get_longest_row_width) : Fixed small bug which
caused incorrect width to be returned.
* src/dialogs/dialog-stf.glade:
Added trim spaces option and did some general polishing.
* src/dialogs/dialog-stf.h:
Added new member to DruidPageData_t which indicates weather
the user wants to trim spaces and in which way.
* src/dialogs/dialog-stf-main-page.c:
(stf_dialog_main_page_init): Modified so it loads the trim optionmenu.
(main_page_trim_menu_deactivate): New.
* src/dialogs/dialog-stf-csv-page.c:
(stf_dialog_csv_page_prepare): Now sets the trim member of the parse
options struct.
* src/dialogs/dialog-stf-fixed-page.c:
(stf_dialog_fixed_page_prepare): Now sets the trim member of the
parse options struct.
(stf_dialog_fixed_page_prepare): Did not honor the from/to line
settings.
(fixed_page_remove_clicked): Added gnumeric_clist_moveto to make
selection visible.
(fixed_page_add_clicked): Ditto.
* src/dialogs/dialog-stf-format-page.c:
(format_page_canvas_button_press_event): Modified to use
gnumeric_clist_moveto
(format_page_collist_select_row): Ditto.
(format_page_format_changed): Ditto.
(stf_dialog_format_page_prepare): Ditto.
* src/gnumeric-util.c, src/gnumeric-util.h:
(gnumeric_option_menu_get_selected_index): New function, Returns
the selected index of a GtkOptionMenu. (Originally from
dialog-stf-export-format-page.c)
* src/dialogs/dialog-stf-export-format-page.c:
(stf_export_dialog_option_menu_index): Removed.
(sheet_page_separator_menu_deactivate): Modified to use the new
gnumeric_option_menu_get_selected_index.
(stf_export_dialog_format_page_result): Ditto.
* doc/stf-parser.txt:
Update documentation.
2000-05-26 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Fix typo, and thinko.
......
......@@ -5,15 +5,16 @@ Almer. S. Tigelaar.
1. Creation/destruction
2. Row separators
3. Modification determination
4. CSV Parsing
4.1 General
4.2 What is the string indicator?
4.3 How are adjacent string indicators handled?
4.4 What is the custom separator?
4.5 What does "duplicates" mean?
5. Fixed width parsing
6. Cached parsing
3. Trimming
4. Modification determination
5. CSV Parsing
5.1 General
5.2 What is the string indicator?
5.3 How are adjacent string indicators handled?
5.4 What is the custom separator?
5.5 What does "duplicates" mean?
6. Fixed width parsing
7. Cached parsing
1. Creation/Destruction
=======================
......@@ -45,7 +46,27 @@ Almer. S. Tigelaar.
stf_parse_options_set_line_terminator (parseoptions, '\r');
3. Modification determination
3. Trimming
===========
An common problem is to get excess spaces on left and/or right sides
of parsed text, e.g :
" Example "
This is in most cases undesirable. Therefore the stf parser removes
these spaces on _both_ sides by default :
"Example"
You can turn this off or change this with :
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_NEVER);
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_LEFT);
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_RIGHT);
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_LEFT | TRIM_TYPE_RIGHT);
4. Modification determination
=============================
If you want to know, between several functions calls, if the actual contents of
......@@ -76,7 +97,7 @@ Almer. S. Tigelaar.
and re-added them the contents (5, 7 and 9) remain the same, so the parseoptions have not been
modified.
4.1 CSV Parsing -> General
5.1 CSV Parsing -> General
==========================
CSV parsing is parsing data like :
......@@ -105,7 +126,7 @@ Almer. S. Tigelaar.
mylist = stf_parse_general (parseoptions);
4.2 CSV Parsing -> What is the string indicator?
5.2 CSV Parsing -> What is the string indicator?
================================================
If you have data where the column separator(s) also appear within
......@@ -128,7 +149,7 @@ Almer. S. Tigelaar.
some
example;data
4.3 CSV Parsing -> How are adjacent string indicators handled?
5.3 CSV Parsing -> How are adjacent string indicators handled?
============================================================
When parsing fields which are bounded by string indicators the convention
......@@ -139,8 +160,12 @@ Almer. S. Tigelaar.
a"b
or
ab
To turn this off (it is turned on by default) you can use the following function :
stf_parse_options_csv_set_indicator_2x_is_single (parseoptions, FALSE);
4.4 CSV Parsing -> What is the custom separator?
5.4 CSV Parsing -> What is the custom separator?
================================================
Even though there are some default separators (namely tab, colon, comma and space)
......@@ -154,7 +179,7 @@ Almer. S. Tigelaar.
is also set in addition to the tab and colon. In this example the custom field separator is set to
the "x" character.
4.5 CSV Parsing -> What does duplicates mean?
5.5 CSV Parsing -> What does duplicates mean?
=============================================
This means that several column separators are seen as one.
......@@ -180,7 +205,7 @@ Almer. S. Tigelaar.
So the two colons between "some" and "data" are seen as one.
5. Fixed width parsing
6. Fixed width parsing
======================
Fixed width means that each column consists of a fixed number of characters.
......@@ -212,7 +237,7 @@ Almer. S. Tigelaar.
mylist = stf_parse_general (parseoptions);
6. Cached parsing
7. Cached parsing
=================
If you don't want to parse ALL the data you have in one swoop, you
......
......@@ -5,15 +5,16 @@ Almer. S. Tigelaar.
1. Creation/destruction
2. Row separators
3. Modification determination
4. CSV Parsing
4.1 General
4.2 What is the string indicator?
4.3 How are adjacent string indicators handled?
4.4 What is the custom separator?
4.5 What does "duplicates" mean?
5. Fixed width parsing
6. Cached parsing
3. Trimming
4. Modification determination
5. CSV Parsing
5.1 General
5.2 What is the string indicator?
5.3 How are adjacent string indicators handled?
5.4 What is the custom separator?
5.5 What does "duplicates" mean?
6. Fixed width parsing
7. Cached parsing
1. Creation/Destruction
=======================
......@@ -45,7 +46,27 @@ Almer. S. Tigelaar.
stf_parse_options_set_line_terminator (parseoptions, '\r');
3. Modification determination
3. Trimming
===========
An common problem is to get excess spaces on left and/or right sides
of parsed text, e.g :
" Example "
This is in most cases undesirable. Therefore the stf parser removes
these spaces on _both_ sides by default :
"Example"
You can turn this off or change this with :
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_NEVER);
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_LEFT);
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_RIGHT);
stf_parse_options_set_trim_spaces (parseoptions, TRIM_TYPE_LEFT | TRIM_TYPE_RIGHT);
4. Modification determination
=============================
If you want to know, between several functions calls, if the actual contents of
......@@ -76,7 +97,7 @@ Almer. S. Tigelaar.
and re-added them the contents (5, 7 and 9) remain the same, so the parseoptions have not been
modified.
4.1 CSV Parsing -> General
5.1 CSV Parsing -> General
==========================
CSV parsing is parsing data like :
......@@ -105,7 +126,7 @@ Almer. S. Tigelaar.
mylist = stf_parse_general (parseoptions);
4.2 CSV Parsing -> What is the string indicator?
5.2 CSV Parsing -> What is the string indicator?
================================================
If you have data where the column separator(s) also appear within
......@@ -128,7 +149,7 @@ Almer. S. Tigelaar.
some
example;data
4.3 CSV Parsing -> How are adjacent string indicators handled?
5.3 CSV Parsing -> How are adjacent string indicators handled?
============================================================
When parsing fields which are bounded by string indicators the convention
......@@ -139,8 +160,12 @@ Almer. S. Tigelaar.
a"b
or
ab
To turn this off (it is turned on by default) you can use the following function :
stf_parse_options_csv_set_indicator_2x_is_single (parseoptions, FALSE);
4.4 CSV Parsing -> What is the custom separator?
5.4 CSV Parsing -> What is the custom separator?
================================================
Even though there are some default separators (namely tab, colon, comma and space)
......@@ -154,7 +179,7 @@ Almer. S. Tigelaar.
is also set in addition to the tab and colon. In this example the custom field separator is set to
the "x" character.
4.5 CSV Parsing -> What does duplicates mean?
5.5 CSV Parsing -> What does duplicates mean?
=============================================
This means that several column separators are seen as one.
......@@ -180,7 +205,7 @@ Almer. S. Tigelaar.
So the two colons between "some" and "data" are seen as one.
5. Fixed width parsing
6. Fixed width parsing
======================
Fixed width means that each column consists of a fixed number of characters.
......@@ -212,7 +237,7 @@ Almer. S. Tigelaar.
mylist = stf_parse_general (parseoptions);
6. Cached parsing
7. Cached parsing
=================
If you don't want to parse ALL the data you have in one swoop, you
......
......@@ -165,11 +165,16 @@ stf_dialog_csv_page_prepare (GnomeDruidPage *page, GnomeDruid *druid, DruidPageD
{
CsvInfo_t *info = pagedata->csv_info;
if (pagedata->cur != info->csv_run_cacheoptions->data || pagedata->importlines != info->csv_run_parseoptions->parselines) {
if (pagedata->cur != info->csv_run_cacheoptions->data ||
pagedata->importlines != info->csv_run_parseoptions->parselines)
{
stf_parse_options_set_lines_to_parse (info->csv_run_parseoptions, pagedata->importlines);
stf_cache_options_set_data (info->csv_run_cacheoptions, info->csv_run_parseoptions, pagedata->cur);
}
stf_parse_options_set_trim_spaces (info->csv_run_parseoptions, pagedata->trim);
stf_cache_options_invalidate (info->csv_run_cacheoptions);
pagedata->colcount = stf_parse_get_colcount (info->csv_run_parseoptions, pagedata->cur);
......
......@@ -18,45 +18,6 @@
* MISC UTILITY FUNCTIONS
*************************************************************************************************/
/**
* stf_export_dialog_option_menu_index:
* @optionmenu: a gtkoptionmenu
*
* Tries to find out (in an ugly way) the selected
* item in @optionsmenu
*
* Return value: the selected index
**/
static int
stf_export_dialog_option_menu_index (GtkOptionMenu *optionmenu)
{
GtkMenu *menu;
GtkMenuItem *selected;
GList *iterator;
int index = -1;
int i = 0;
g_return_val_if_fail (optionmenu != NULL, -1);
menu = (GtkMenu *) gtk_option_menu_get_menu (optionmenu);
iterator = GTK_MENU_SHELL (menu)->children;
selected = (GtkMenuItem *) gtk_menu_get_active (menu);
while (iterator) {
if (iterator->data == selected) {
index = i;
break;
}
iterator = iterator->next;
i++;
}
return index;
}
/*************************************************************************************************
* SIGNAL HANDLERS
*************************************************************************************************/
......@@ -71,7 +32,7 @@ stf_export_dialog_option_menu_index (GtkOptionMenu *optionmenu)
static void
sheet_page_separator_menu_deactivate (GtkMenuShell *shell, StfE_FormatPageData_t *data)
{
if (stf_export_dialog_option_menu_index (data->format_separator) == CUSTOM_INDEX) {
if (gnumeric_option_menu_get_selected_index (data->format_separator) == CUSTOM_INDEX) {
gtk_widget_set_sensitive (GTK_WIDGET (data->format_custom), TRUE);
gtk_widget_grab_focus (GTK_WIDGET (data->format_custom));
......@@ -144,7 +105,7 @@ stf_export_dialog_format_page_result (StfE_FormatPageData_t *data, StfExportOpti
g_return_if_fail (data != NULL);
g_return_if_fail (export_options != NULL);
switch (stf_export_dialog_option_menu_index (data->format_termination)) {
switch (gnumeric_option_menu_get_selected_index (data->format_termination)) {
case 0 : terminator = TERMINATOR_TYPE_LINEFEED; break;
case 1 : terminator = TERMINATOR_TYPE_RETURN; break;
case 2 : terminator = TERMINATOR_TYPE_RETURN_LINEFEED; break;
......@@ -155,7 +116,7 @@ stf_export_dialog_format_page_result (StfE_FormatPageData_t *data, StfExportOpti
stf_export_options_set_terminator_type (export_options, terminator);
switch (stf_export_dialog_option_menu_index (data->format_quote)) {
switch (gnumeric_option_menu_get_selected_index (data->format_quote)) {
case 0 : quotingmode = QUOTING_MODE_AUTO; break;
case 1 : quotingmode = QUOTING_MODE_ALWAYS; break;
case 2 : quotingmode = QUOTING_MODE_NEVER; break;
......@@ -171,7 +132,7 @@ stf_export_dialog_format_page_result (StfE_FormatPageData_t *data, StfExportOpti
g_free (text);
separator = '\0';
switch (stf_export_dialog_option_menu_index (data->format_separator)) {
switch (gnumeric_option_menu_get_selected_index (data->format_separator)) {
case 0 : separator = ' '; break;
case 1 : separator = '\t'; break;
case 2 : separator = '!'; break;
......
......@@ -162,6 +162,8 @@ fixed_page_canvas_motion_notify_event (GnomeCanvas *canvas, GdkEventMotion *even
colend = max;
gtk_clist_select_row (info->fixed_collist, info->fixed_run_column, 0);
gnumeric_clist_moveto (info->fixed_collist, info->fixed_run_column);
gtk_spin_button_set_value (info->fixed_colend, colend);
fixed_page_update_preview (data);
......@@ -206,7 +208,7 @@ fixed_page_canvas_button_press_event (GnomeCanvas *canvas, GdkEventButton *event
if (column != -1) {