Commit 982d6c10 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Use a more conventional approach to path seperators. Adjust here.


2000-11-20  Jody Goldberg <jgoldberg@home.com>

	* configure.in : Use a more conventional approach to path seperators.
	* src/gutils.c (gnumeric_usr_dir) : Adjust here.
	(gnumeric_sys_data_dir) : and here.
	(gnumeric_sys_lib_dir) : and here.

2000-11-20  Jody Goldberg <jgoldberg@home.com>

	* src/sheet.c (sheet_clone_selection) : Fix.

	* src/item-grid.c (item_grid_draw_merged_range) : If the merged region
	  is fully selected paint it as such.

	* src/selection.c (sheet_is_full_range_selected) : new function.
	(sheet_selection_set) : support merged cells.
parent 808b9b09
......@@ -7,8 +7,7 @@ Release Critical
- new wb_controls do not display
: selection string
- we leak merged regions on exit
: comment markers
Long term breakage
------------------
......
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* configure.in : Use a more conventional approach to path seperators.
* src/gutils.c (gnumeric_usr_dir) : Adjust here.
(gnumeric_sys_data_dir) : and here.
(gnumeric_sys_lib_dir) : and here.
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_clone_selection) : Fix.
* src/item-grid.c (item_grid_draw_merged_range) : If the merged region
is fully selected paint it as such.
* src/selection.c (sheet_is_full_range_selected) : new function.
(sheet_selection_set) : support merged cells.
2000-11-20 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy_contents): Eliminate merged regions.
......
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* configure.in : Use a more conventional approach to path seperators.
* src/gutils.c (gnumeric_usr_dir) : Adjust here.
(gnumeric_sys_data_dir) : and here.
(gnumeric_sys_lib_dir) : and here.
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_clone_selection) : Fix.
* src/item-grid.c (item_grid_draw_merged_range) : If the merged region
is fully selected paint it as such.
* src/selection.c (sheet_is_full_range_selected) : new function.
(sheet_selection_set) : support merged cells.
2000-11-20 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy_contents): Eliminate merged regions.
......
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* configure.in : Use a more conventional approach to path seperators.
* src/gutils.c (gnumeric_usr_dir) : Adjust here.
(gnumeric_sys_data_dir) : and here.
(gnumeric_sys_lib_dir) : and here.
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_clone_selection) : Fix.
* src/item-grid.c (item_grid_draw_merged_range) : If the merged region
is fully selected paint it as such.
* src/selection.c (sheet_is_full_range_selected) : new function.
(sheet_selection_set) : support merged cells.
2000-11-20 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy_contents): Eliminate merged regions.
......
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* configure.in : Use a more conventional approach to path seperators.
* src/gutils.c (gnumeric_usr_dir) : Adjust here.
(gnumeric_sys_data_dir) : and here.
(gnumeric_sys_lib_dir) : and here.
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_clone_selection) : Fix.
* src/item-grid.c (item_grid_draw_merged_range) : If the merged region
is fully selected paint it as such.
* src/selection.c (sheet_is_full_range_selected) : new function.
(sheet_selection_set) : support merged cells.
2000-11-20 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy_contents): Eliminate merged regions.
......
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* configure.in : Use a more conventional approach to path seperators.
* src/gutils.c (gnumeric_usr_dir) : Adjust here.
(gnumeric_sys_data_dir) : and here.
(gnumeric_sys_lib_dir) : and here.
2000-11-20 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_clone_selection) : Fix.
* src/item-grid.c (item_grid_draw_merged_range) : If the merged region
is fully selected paint it as such.
* src/selection.c (sheet_is_full_range_selected) : new function.
(sheet_selection_set) : support merged cells.
2000-11-20 Morten Welinder <terra@diku.dk>
* src/sheet.c (sheet_destroy_contents): Eliminate merged regions.
......
......@@ -244,11 +244,11 @@ dnl **************************************************
gnumeric_prefix="${prefix}"
gnumeric_exec_prefix="${exec_prefix}"
gnumeric_version="${VERSION}${bonobo_suffix}"
gnumeric_datadir="${datadir}/gnumeric/${gnumeric_version}/"
gnumeric_libdir="${libdir}/gnumeric/${gnumeric_version}/"
gnumeric_plugindir="${gnumeric_libdir}plugins/"
gnumeric_gladedir="${gnumeric_datadir}glade/"
gnumeric_autoformatdir="${gnumeric_datadir}autoformat-templates/"
gnumeric_datadir="${datadir}/gnumeric/${gnumeric_version}"
gnumeric_libdir="${libdir}/gnumeric/${gnumeric_version}"
gnumeric_plugindir="${gnumeric_libdir}/plugins"
gnumeric_gladedir="${gnumeric_datadir}/glade"
gnumeric_autoformatdir="${gnumeric_datadir}/autoformat-templates"
dnl Export to config.h
AC_DEFINE_UNQUOTED(GNUMERIC_VERSION, "$gnumeric_version")
......
......@@ -104,7 +104,6 @@ move_cursor (GnumericSheet *gsheet, int col, int row, gboolean clear_selection)
void
gnumeric_sheet_move_cursor (GnumericSheet *gsheet, int col, int row)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
move_cursor (gsheet, col, row, TRUE);
......@@ -115,7 +114,6 @@ gnumeric_sheet_set_cursor_bounds (GnumericSheet *gsheet,
int start_col, int start_row,
int end_col, int end_row)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (start_row <= end_row);
g_return_if_fail (start_col <= end_col);
......@@ -201,7 +199,6 @@ gnumeric_sheet_can_select_expr_range (GnumericSheet *gsheet)
{
WorkbookControlGUI const *wbcg;
g_return_val_if_fail (gsheet != NULL, FALSE);
g_return_val_if_fail (GNUMERIC_IS_SHEET (gsheet), FALSE);
wbcg = gsheet->scg->wbcg;
......@@ -328,7 +325,6 @@ start_cell_selection (GnumericSheet *gsheet)
void
gnumeric_sheet_start_cell_selection (GnumericSheet *gsheet, int col, int row)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
if (gsheet->selecting_cell)
......@@ -340,7 +336,6 @@ gnumeric_sheet_start_cell_selection (GnumericSheet *gsheet, int col, int row)
void
gnumeric_sheet_stop_cell_selection (GnumericSheet *gsheet, gboolean const clear_string)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
if (!gsheet->selecting_cell)
......@@ -379,7 +374,6 @@ gnumeric_sheet_create_editing_cursor (GnumericSheet *gsheet)
void
gnumeric_sheet_stop_editing (GnumericSheet *gsheet)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
gnumeric_sheet_stop_cell_selection (gsheet, FALSE);
......@@ -398,7 +392,6 @@ gnumeric_sheet_selection_extend (GnumericSheet *gsheet, int col, int row)
{
ItemCursor *ic;
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (gsheet->selecting_cell);
g_return_if_fail (col < SHEET_MAX_COLS);
......@@ -424,7 +417,6 @@ gnumeric_sheet_selection_cursor_place (GnumericSheet *gsheet, int col, int row)
{
ItemCursor *ic;
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (gsheet->selecting_cell);
g_return_if_fail (col < SHEET_MAX_COLS);
......@@ -442,7 +434,6 @@ gnumeric_sheet_selection_cursor_base (GnumericSheet *gsheet, int col, int row)
{
ItemCursor *ic;
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (gsheet->selecting_cell);
g_return_if_fail (col < SHEET_MAX_COLS);
......@@ -1291,7 +1282,6 @@ gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet, int col, int row,
int new_first_col, new_first_row;
int col_distance, row_distance;
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (col >= 0);
g_return_if_fail (row >= 0);
......
......@@ -104,7 +104,6 @@ move_cursor (GnumericSheet *gsheet, int col, int row, gboolean clear_selection)
void
gnumeric_sheet_move_cursor (GnumericSheet *gsheet, int col, int row)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
move_cursor (gsheet, col, row, TRUE);
......@@ -115,7 +114,6 @@ gnumeric_sheet_set_cursor_bounds (GnumericSheet *gsheet,
int start_col, int start_row,
int end_col, int end_row)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (start_row <= end_row);
g_return_if_fail (start_col <= end_col);
......@@ -201,7 +199,6 @@ gnumeric_sheet_can_select_expr_range (GnumericSheet *gsheet)
{
WorkbookControlGUI const *wbcg;
g_return_val_if_fail (gsheet != NULL, FALSE);
g_return_val_if_fail (GNUMERIC_IS_SHEET (gsheet), FALSE);
wbcg = gsheet->scg->wbcg;
......@@ -328,7 +325,6 @@ start_cell_selection (GnumericSheet *gsheet)
void
gnumeric_sheet_start_cell_selection (GnumericSheet *gsheet, int col, int row)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
if (gsheet->selecting_cell)
......@@ -340,7 +336,6 @@ gnumeric_sheet_start_cell_selection (GnumericSheet *gsheet, int col, int row)
void
gnumeric_sheet_stop_cell_selection (GnumericSheet *gsheet, gboolean const clear_string)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
if (!gsheet->selecting_cell)
......@@ -379,7 +374,6 @@ gnumeric_sheet_create_editing_cursor (GnumericSheet *gsheet)
void
gnumeric_sheet_stop_editing (GnumericSheet *gsheet)
{
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
gnumeric_sheet_stop_cell_selection (gsheet, FALSE);
......@@ -398,7 +392,6 @@ gnumeric_sheet_selection_extend (GnumericSheet *gsheet, int col, int row)
{
ItemCursor *ic;
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (gsheet->selecting_cell);
g_return_if_fail (col < SHEET_MAX_COLS);
......@@ -424,7 +417,6 @@ gnumeric_sheet_selection_cursor_place (GnumericSheet *gsheet, int col, int row)
{
ItemCursor *ic;
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (gsheet->selecting_cell);
g_return_if_fail (col < SHEET_MAX_COLS);
......@@ -442,7 +434,6 @@ gnumeric_sheet_selection_cursor_base (GnumericSheet *gsheet, int col, int row)
{
ItemCursor *ic;
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (gsheet->selecting_cell);
g_return_if_fail (col < SHEET_MAX_COLS);
......@@ -1291,7 +1282,6 @@ gnumeric_sheet_make_cell_visible (GnumericSheet *gsheet, int col, int row,
int new_first_col, new_first_row;
int col_distance, row_distance;
g_return_if_fail (gsheet != NULL);
g_return_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (col >= 0);
g_return_if_fail (row >= 0);
......
......@@ -48,7 +48,8 @@ gnumeric_sys_data_dir (const char *subdir)
{
extern char *gnumeric_data_dir;
return g_strconcat (gnumeric_data_dir, subdir, "/", NULL);
return g_strconcat (gnumeric_data_dir, G_DIR_SEPARATOR_S,
subdir, G_DIR_SEPARATOR_S, NULL);
}
char *
......@@ -56,7 +57,8 @@ gnumeric_sys_lib_dir (const char *subdir)
{
extern char *gnumeric_lib_dir;
return g_strconcat (gnumeric_lib_dir, subdir, "/", NULL);
return g_strconcat (gnumeric_lib_dir, G_DIR_SEPARATOR_S,
subdir, G_DIR_SEPARATOR_S, NULL);
}
#define GLADE_SUFFIX "glade"
......@@ -81,8 +83,8 @@ gnumeric_usr_dir (const char *subdir)
if (home_dir != NULL)
return g_strconcat (
home_dir, "/.gnumeric/" GNUMERIC_VERSION "/",
subdir, "/", NULL);
home_dir, G_DIR_SEPARATOR_S ".gnumeric/" GNUMERIC_VERSION G_DIR_SEPARATOR_S,
subdir, G_DIR_SEPARATOR_S, NULL);
return NULL;
}
......
......@@ -694,7 +694,6 @@ item_bar_event (GnomeCanvasItem *item, GdkEvent *e)
gtk_widget_show_all (gtk_widget_get_toplevel (item_bar->tip));
}
} else {
item_bar->start_selection = element;
gnome_canvas_item_grab (item,
GDK_POINTER_MOTION_MASK |
......
......@@ -192,8 +192,11 @@ item_grid_draw_merged_range (GdkDrawable *drawable, ItemGrid *grid,
GdkGC * const gc = grid->empty_gc;
Cell const *cell = sheet_cell_get (sheet, range->start.col, range->start.row);
MStyle *mstyle = sheet_style_compute (sheet, range->start.col, range->start.row);
gboolean const is_selected = (sheet->cursor.edit_pos.col != range->start.col ||
sheet->cursor.edit_pos.row != range->start.row) &&
sheet_is_full_range_selected (sheet, range);
gboolean const no_background = !gnumeric_background_set_gc (mstyle, gc,
grid->canvas_item.canvas, FALSE);
grid->canvas_item.canvas, is_selected);
l = r = start_x;
if (view->start.col <= range->start.col) {
......@@ -226,10 +229,6 @@ item_grid_draw_merged_range (GdkDrawable *drawable, ItemGrid *grid,
/* Remember X excludes the far pixels */
gdk_draw_rectangle (drawable, gc, TRUE, l, t, r-l+1, b-t+1);
if (sheet->cursor.edit_pos.col != range->start.col ||
sheet->cursor.edit_pos.row != range->start.row) {
}
if (cell != NULL) {
ColRowInfo const * const ri = cell->row_info;
ColRowInfo const * const ci = cell->col_info;
......
......@@ -63,49 +63,6 @@ sheet_get_selection_name (Sheet const *sheet)
return buffer;
}
/**
* sheet_selection_add_range : prepends a new range to the selection list.
*
* @sheet : sheet whose selection to append to.
* @edit_{col,row} : cell to mark as the new edit cursor.
* @base_{col,row} : stationary corner of the newly selected range.
* @move_{col,row} : moving corner of the newly selected range.
*
* Prepends a range to the selection list and set the edit cursor.
*/
void
sheet_selection_add_range (Sheet *sheet,
int edit_col, int edit_row,
int base_col, int base_row,
int move_col, int move_row)
{
SheetSelection *ss;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
/* Create and prepend new selection */
ss = g_new0 (SheetSelection, 1);
ss->user.start.col = MIN (base_col, move_col);
ss->user.start.row = MIN (base_row, move_row);
ss->user.end.col = MAX (base_col, move_col);
ss->user.end.row = MAX (base_row, move_row);
sheet->selections = g_list_prepend (sheet->selections, ss);
/* Set the selection parameters, and redraw the old edit cursor */
sheet_cursor_set (sheet,
edit_col, edit_row,
base_col, base_row,
move_col, move_row);
/* Redraw the newly added range so that it get shown as selected */
sheet_redraw_range (sheet, &ss->user);
sheet_redraw_headers (sheet, TRUE, TRUE, &ss->user);
/* Force update of the status area */
sheet_flag_status_update_range (sheet, NULL /* force update */);
}
/**
* Return 1st range.
* Return NULL if there is more than 1 and @permit_complex is FALSE
......@@ -154,13 +111,55 @@ selection_is_simple (WorkbookControl *wbc, Sheet const *sheet,
return FALSE;
}
/**
* sheet_selection_add_range : prepends a new range to the selection list.
*
* @sheet : sheet whose selection to append to.
* @edit_{col,row} : cell to mark as the new edit cursor.
* @base_{col,row} : stationary corner of the newly selected range.
* @move_{col,row} : moving corner of the newly selected range.
*
* Prepends a range to the selection list and set the edit cursor.
*/
void
sheet_selection_add_range (Sheet *sheet,
int edit_col, int edit_row,
int base_col, int base_row,
int move_col, int move_row)
{
SheetSelection *ss;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
/* Create and prepend new selection */
ss = g_new0 (SheetSelection, 1);
ss->user.start.col = MIN (base_col, move_col);
ss->user.start.row = MIN (base_row, move_row);
ss->user.end.col = MAX (base_col, move_col);
ss->user.end.row = MAX (base_row, move_row);
sheet->selections = g_list_prepend (sheet->selections, ss);
/* Set the selection parameters, and redraw the old edit cursor */
sheet_cursor_set (sheet,
edit_col, edit_row,
base_col, base_row,
move_col, move_row);
/* Redraw the newly added range so that it get shown as selected */
sheet_redraw_range (sheet, &ss->user);
sheet_redraw_headers (sheet, TRUE, TRUE, &ss->user);
/* Force update of the status area */
sheet_flag_status_update_range (sheet, NULL /* force update */);
}
void
sheet_selection_add (Sheet *sheet, int col, int row)
{
sheet_selection_add_range (sheet, col, row, col, row, col, row);
}
/**
* sheet_selection_extend_to:
* @sheet: the sheet
......@@ -312,12 +311,31 @@ sheet_is_range_selected (Sheet const * const sheet, Range const *r)
return FALSE;
}
/*
* TRUE : If entire range is contained in the selection
*/
gboolean
sheet_is_full_range_selected (Sheet const * const sheet, Range const *r)
{
GList *list;
for (list = sheet->selections; list; list = list->next){
SheetSelection const *ss = list->data;
if (range_contained (r, &ss->user))
return TRUE;
}
return FALSE;
}
void
sheet_selection_set (Sheet *sheet,
int edit_col, int edit_row,
int base_col, int base_row,
int move_col, int move_row)
{
GSList *merged, *ptr;
gboolean changed, reset_positions = FALSE;
SheetSelection *ss;
Range old_sel, new_sel;
......@@ -332,6 +350,52 @@ sheet_selection_set (Sheet *sheet,
new_sel.end.col = MAX(base_col, move_col);
new_sel.end.row = MAX(base_row, move_row);
/* expand to include any merged regions */
looper :
changed = FALSE;
merged = sheet_region_get_merged (sheet, &new_sel);
for (ptr = merged ; ptr != NULL ; ptr = ptr->next) {
Range const *r = ptr->data;
if (new_sel.start.col > r->start.col) {
new_sel.start.col = r->start.col;
changed = TRUE;
}
if (new_sel.start.row > r->start.row) {
new_sel.start.row = r->start.row;
changed = TRUE;
}
if (new_sel.end.col < r->end.col) {
new_sel.end.col = r->end.col;
changed = TRUE;
}
if (new_sel.end.row < r->end.row) {
new_sel.end.row = r->end.row;
changed = TRUE;
}
}
g_slist_free (merged);
if (changed) {
reset_positions = TRUE;
goto looper;
}
if (reset_positions) {
if (base_col < move_col) {
base_col = new_sel.start.col;
move_col = new_sel.end.col;
} else {
base_col = new_sel.end.col;
move_col = new_sel.start.col;
}
if (base_row < move_row) {
base_row = new_sel.start.row;
move_row = new_sel.end.row;
} else {
base_row = new_sel.end.row;
move_row = new_sel.start.row;
}
}
if (range_equal (&ss->user, &new_sel))
return;
......
......@@ -7,6 +7,7 @@
gboolean sheet_is_all_selected (Sheet const * const sheet);
gboolean sheet_is_cell_selected (Sheet const * const sheet, int col, int row);
gboolean sheet_is_range_selected (Sheet const * const sheet, Range const *r);
gboolean sheet_is_full_range_selected (Sheet const * const sheet, Range const *r);
void sheet_selection_extend_to (Sheet *sheet, int col, int row);
void sheet_selection_extend (Sheet *sheet, int count, gboolean jump_to_boundaries,
gboolean const horizontal);
......
......@@ -3832,7 +3832,7 @@ sheet_clone_selection (Sheet const *src, Sheet *dst)
selections = g_list_copy (src->selections);
selections = g_list_reverse (selections);
for (ptr = selections ; ptr != NULL ; ptr = ptr->next) {
for (ptr = selections ; ptr != NULL && ptr->next != NULL ; ptr = ptr->next) {
Range const *range = ptr->data;
g_return_if_fail (range != NULL);
sheet_selection_add_range (dst,
......@@ -3841,15 +3841,13 @@ sheet_clone_selection (Sheet const *src, Sheet *dst)
range->end.col, range->end.row);
}
g_list_free (selections);
/* Set the cursor position */
sheet_cursor_set (dst,
src->cursor.edit_pos.col,
src->cursor.edit_pos.row,
src->cursor.base_corner.col,
src->cursor.base_corner.row,
src->cursor.move_corner.col,
src->cursor.move_corner.row);
sheet_selection_add_range (dst,
src->cursor.edit_pos.col,
src->cursor.edit_pos.row,
src->cursor.base_corner.col,
src->cursor.base_corner.row,
src->cursor.move_corner.col,
src->cursor.move_corner.row);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment