Commit 22587963 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Split sanity check into new function. (range_check_sanity) : here.


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

	* src/ranges.c (range_translate) : Split sanity check into new function.
	(range_check_sanity) : here.

	* src/xml-io.c (xml_read_range) : Use it.

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

	* src/sheet.c (sheet_new) : Be mroe fine grained about the changes to
	  the edit position.
	(sheet_flag_status_update_cell) : Only content and format have changed.
	(sheet_flag_status_update_range) : handle the new flags.
	(sheet_flag_format_update_range) : new function.
	(sheet_update_editpos) : delete and split up.
	(sheet_update) : Do each update seperately. NOTE : this is broken.
	  All of these flags should be at the View level.

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

	* src/selection.c (sheet_selection_copy) : pass a workbookcontrol.
	(sheet_selection_cut) : Ditto.

	* src/commands.c (cmd_format_undo) : flag the format change.
	(cmd_format_redo) : Ditto.

	* src/workbook-control.h (wb_control_claim_selection) : new virtual.
	* src/application.c (application_set_selected_sheet) : Used here.
	(application_clipboard_copy) : Take a WorkbookControl.
	(application_clipboard_cut) : Ditto.

	* src/workbook-control-gui.c (wbcg_paste_from_selection) : new
	  function.
	(workbook_control_gui_ctor_class) : register it.

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

	* src/print-cell.c (print_cell_range) : We are only outputing
	  something in the case of a blank cell if the format is visible.
parent dd15ac79
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/ranges.c (range_translate) : Split sanity check into new function.
(range_check_sanity) : here.
* src/xml-io.c (xml_read_range) : Use it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_new) : Be mroe fine grained about the changes to
the edit position.
(sheet_flag_status_update_cell) : Only content and format have changed.
(sheet_flag_status_update_range) : handle the new flags.
(sheet_flag_format_update_range) : new function.
(sheet_update_editpos) : delete and split up.
(sheet_update) : Do each update seperately. NOTE : this is broken.
All of these flags should be at the View level.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_copy) : pass a workbookcontrol.
(sheet_selection_cut) : Ditto.
* src/commands.c (cmd_format_undo) : flag the format change.
(cmd_format_redo) : Ditto.
* src/workbook-control.h (wb_control_claim_selection) : new virtual.
* src/application.c (application_set_selected_sheet) : Used here.
(application_clipboard_copy) : Take a WorkbookControl.
(application_clipboard_cut) : Ditto.
* src/workbook-control-gui.c (wbcg_paste_from_selection) : new
function.
(workbook_control_gui_ctor_class) : register it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/print-cell.c (print_cell_range) : We are only outputing
something in the case of a blank cell if the format is visible.
2000-11-01 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.glade:
......
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/ranges.c (range_translate) : Split sanity check into new function.
(range_check_sanity) : here.
* src/xml-io.c (xml_read_range) : Use it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_new) : Be mroe fine grained about the changes to
the edit position.
(sheet_flag_status_update_cell) : Only content and format have changed.
(sheet_flag_status_update_range) : handle the new flags.
(sheet_flag_format_update_range) : new function.
(sheet_update_editpos) : delete and split up.
(sheet_update) : Do each update seperately. NOTE : this is broken.
All of these flags should be at the View level.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_copy) : pass a workbookcontrol.
(sheet_selection_cut) : Ditto.
* src/commands.c (cmd_format_undo) : flag the format change.
(cmd_format_redo) : Ditto.
* src/workbook-control.h (wb_control_claim_selection) : new virtual.
* src/application.c (application_set_selected_sheet) : Used here.
(application_clipboard_copy) : Take a WorkbookControl.
(application_clipboard_cut) : Ditto.
* src/workbook-control-gui.c (wbcg_paste_from_selection) : new
function.
(workbook_control_gui_ctor_class) : register it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/print-cell.c (print_cell_range) : We are only outputing
something in the case of a blank cell if the format is visible.
2000-11-01 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.glade:
......
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/ranges.c (range_translate) : Split sanity check into new function.
(range_check_sanity) : here.
* src/xml-io.c (xml_read_range) : Use it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_new) : Be mroe fine grained about the changes to
the edit position.
(sheet_flag_status_update_cell) : Only content and format have changed.
(sheet_flag_status_update_range) : handle the new flags.
(sheet_flag_format_update_range) : new function.
(sheet_update_editpos) : delete and split up.
(sheet_update) : Do each update seperately. NOTE : this is broken.
All of these flags should be at the View level.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_copy) : pass a workbookcontrol.
(sheet_selection_cut) : Ditto.
* src/commands.c (cmd_format_undo) : flag the format change.
(cmd_format_redo) : Ditto.
* src/workbook-control.h (wb_control_claim_selection) : new virtual.
* src/application.c (application_set_selected_sheet) : Used here.
(application_clipboard_copy) : Take a WorkbookControl.
(application_clipboard_cut) : Ditto.
* src/workbook-control-gui.c (wbcg_paste_from_selection) : new
function.
(workbook_control_gui_ctor_class) : register it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/print-cell.c (print_cell_range) : We are only outputing
something in the case of a blank cell if the format is visible.
2000-11-01 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.glade:
......
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/ranges.c (range_translate) : Split sanity check into new function.
(range_check_sanity) : here.
* src/xml-io.c (xml_read_range) : Use it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_new) : Be mroe fine grained about the changes to
the edit position.
(sheet_flag_status_update_cell) : Only content and format have changed.
(sheet_flag_status_update_range) : handle the new flags.
(sheet_flag_format_update_range) : new function.
(sheet_update_editpos) : delete and split up.
(sheet_update) : Do each update seperately. NOTE : this is broken.
All of these flags should be at the View level.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_copy) : pass a workbookcontrol.
(sheet_selection_cut) : Ditto.
* src/commands.c (cmd_format_undo) : flag the format change.
(cmd_format_redo) : Ditto.
* src/workbook-control.h (wb_control_claim_selection) : new virtual.
* src/application.c (application_set_selected_sheet) : Used here.
(application_clipboard_copy) : Take a WorkbookControl.
(application_clipboard_cut) : Ditto.
* src/workbook-control-gui.c (wbcg_paste_from_selection) : new
function.
(workbook_control_gui_ctor_class) : register it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/print-cell.c (print_cell_range) : We are only outputing
something in the case of a blank cell if the format is visible.
2000-11-01 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.glade:
......
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/ranges.c (range_translate) : Split sanity check into new function.
(range_check_sanity) : here.
* src/xml-io.c (xml_read_range) : Use it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_new) : Be mroe fine grained about the changes to
the edit position.
(sheet_flag_status_update_cell) : Only content and format have changed.
(sheet_flag_status_update_range) : handle the new flags.
(sheet_flag_format_update_range) : new function.
(sheet_update_editpos) : delete and split up.
(sheet_update) : Do each update seperately. NOTE : this is broken.
All of these flags should be at the View level.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/selection.c (sheet_selection_copy) : pass a workbookcontrol.
(sheet_selection_cut) : Ditto.
* src/commands.c (cmd_format_undo) : flag the format change.
(cmd_format_redo) : Ditto.
* src/workbook-control.h (wb_control_claim_selection) : new virtual.
* src/application.c (application_set_selected_sheet) : Used here.
(application_clipboard_copy) : Take a WorkbookControl.
(application_clipboard_cut) : Ditto.
* src/workbook-control-gui.c (wbcg_paste_from_selection) : new
function.
(workbook_control_gui_ctor_class) : register it.
2000-11-01 Jody Goldberg <jgoldberg@home.com>
* src/print-cell.c (print_cell_range) : We are only outputing
something in the case of a blank cell if the format is visible.
2000-11-01 Almer S. Tigelaar <almer1@dds.nl>
* src/dialogs/dialog-stf.glade:
......
......@@ -200,23 +200,19 @@ application_clipboard_unant (void)
}
static gboolean
application_set_selected_sheet (Sheet *sheet)
application_set_selected_sheet (WorkbookControl *wbc, Sheet *sheet)
{
g_return_val_if_fail (sheet != NULL, FALSE);
application_clipboard_clear (FALSE);
#if 0
if (gtk_selection_owner_set (workbook_get_toplevel (sheet->workbook),
GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME)) {
#warning how to do this on a per display basis ?
if (wb_control_claim_selection (wbc)) {
app.clipboard_sheet = sheet;
return TRUE;
}
g_warning ("Unable to set selection ?");
#endif
#warning how to do this on a per display basis ?
return FALSE;
}
......@@ -224,6 +220,7 @@ application_set_selected_sheet (Sheet *sheet)
/**
* application_clipboard_copy:
*
* @wbc : the workbook control that requested the operation.
* @sheet : The source sheet for the copy.
* @area : A single rectangular range to be copied.
*
......@@ -231,12 +228,13 @@ application_set_selected_sheet (Sheet *sheet)
* into the clipboard.
*/
void
application_clipboard_copy (Sheet *sheet, Range const *area)
application_clipboard_copy (WorkbookControl *wbc,
Sheet *sheet, Range const *area)
{
g_return_if_fail (sheet != NULL);
g_return_if_fail (area != NULL);
if (application_set_selected_sheet (sheet) ) {
if (application_set_selected_sheet (wbc, sheet) ) {
app.clipboard_cut_range = *area;
app.clipboard_copied_contents =
clipboard_copy_range (sheet, area);
......@@ -251,6 +249,7 @@ application_clipboard_copy (Sheet *sheet, Range const *area)
/**
* application_clipboard_cut:
*
* @wbc : the workbook control that requested the operation.
* @sheet : The source sheet for the copy.
* @area : A single rectangular range to be cut.
*
......@@ -259,12 +258,13 @@ application_clipboard_copy (Sheet *sheet, Range const *area)
* cut operation.
*/
void
application_clipboard_cut (Sheet *sheet, Range const *area)
application_clipboard_cut (WorkbookControl *wbc,
Sheet *sheet, Range const *area)
{
g_return_if_fail (sheet != NULL);
g_return_if_fail (area != NULL);
if (application_set_selected_sheet (sheet) ) {
if (application_set_selected_sheet (wbc, sheet) ) {
app.clipboard_cut_range = *area;
/* No paste special for copies */
......
......@@ -17,8 +17,10 @@ gboolean application_workbook_foreach (WorkbookCallback cback,
void application_clipboard_clear (gboolean drop_selection);
void application_clipboard_copy (Sheet *sheet, Range const *area);
void application_clipboard_cut (Sheet *sheet, Range const *area);
void application_clipboard_copy (WorkbookControl *wbc,
Sheet *sheet, Range const *area);
void application_clipboard_cut (WorkbookControl *wbc,
Sheet *sheet, Range const *area);
void application_clipboard_unant (void);
gboolean application_clipboard_is_empty (void);
Sheet * application_clipboard_sheet_get (void);
......
......@@ -1052,7 +1052,7 @@ cmd_format_undo (GnumericCommand *cmd, WorkbookControl *wbc)
GSList *l2 = me->selection;
for (; l1; l1 = l1->next, l2 = l2->next) {
Range *r;
Range const *r;
CmdFormatOldStyle *os = l1->data;
SpanCalcFlags flags =
sheet_style_attach_list (me->sheet, os->styles,
......@@ -1064,6 +1064,7 @@ cmd_format_undo (GnumericCommand *cmd, WorkbookControl *wbc)
sheet_range_calc_spans (me->sheet, *r, flags);
if (flags != SPANCALC_SIMPLE)
rows_height_update (me->sheet, r);
sheet_flag_format_update_range (me->sheet, r);
}
}
......@@ -1091,6 +1092,7 @@ cmd_format_redo (GnumericCommand *cmd, WorkbookControl *wbc)
sheet_range_apply_style (me->sheet, l->data,
me->new_style);
}
sheet_flag_format_update_range (me->sheet, l->data);
}
sheet_set_dirty (me->sheet, TRUE);
......@@ -1753,7 +1755,7 @@ cmd_paste_cut_undo (GnumericCommand *cmd, WorkbookControl *wbc)
me->reloc_storage = NULL;
/* Force update of the status area */
sheet_flag_status_update_range (me->info.target_sheet, NULL /* force update */);
sheet_flag_status_update_range (me->info.target_sheet, NULL);
/* Select the original region */
if (me->move_selection)
......
......@@ -108,7 +108,7 @@ g_unichar_to_utf8 (gint c, gchar *outbuf)
*
* NOTE: This function got introduced when gnome-print switched to UTF-8,
* and will disappear again once Gnumeric makes the switch. Deprecated at
* birth!
* birth!
*/
int
print_show_iso8859_1 (GnomePrintContext *pc, char const *text)
......@@ -357,12 +357,12 @@ print_cell (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninf
*/
text_base = y1 - font_ascent - ri->margin_a;
break;
case VALIGN_CENTER:
text_base = y1 - font_ascent - ri->margin_a -
(height - font_height) / 2;
break;
case VALIGN_BOTTOM:
/*
* y1 + row->size_pts == bottom grid line.
......@@ -372,7 +372,7 @@ print_cell (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninf
text_base = y1 - ri->size_pts + font_descent + ri->margin_b;
break;
}
halign = value_get_default_halign (cell->value, mstyle);
is_single_line = (halign != HALIGN_JUSTIFY &&
......@@ -472,11 +472,11 @@ print_cell (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninf
break;
case HALIGN_CENTER:
x1 += 1 + ci->margin_a + (width - cell_width_pts) / 2;
x1 += 1 + ci->margin_a + (width - cell_width_pts) / 2;
break;
case HALIGN_CENTER_ACROSS_SELECTION:
x1 = clip_x + (clip_width - cell_width_pts) / 2;
x1 = clip_x + (clip_width - cell_width_pts) / 2;
break;
default:
......@@ -700,7 +700,7 @@ print_cell_background (GnomePrintContext *context, Sheet *sheet,
*
* Return value: returns TRUE if at least one cell was printed
*/
gboolean
gboolean
print_cell_range (GnomePrintContext *context,
Sheet *sheet,
int start_col, int start_row,
......@@ -711,7 +711,7 @@ print_cell_range (GnomePrintContext *context,
int row, col;
double x, y;
gboolean printed = FALSE;
g_return_val_if_fail (context != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_PRINT_CONTEXT (context), FALSE);
g_return_val_if_fail (sheet != NULL, FALSE);
......@@ -745,25 +745,21 @@ print_cell_range (GnomePrintContext *context,
* there is a span descriptor.
*/
if (ri->pos == -1 || NULL == (span = row_span_get (ri, col))){
Cell *cell = sheet_cell_get (sheet, col, row);
MStyle *mstyle = NULL;
if (output) {
mstyle = print_cell_background (
Cell *cell = sheet_cell_get (sheet, col, row);
MStyle *mstyle = (output)
? print_cell_background (
context, sheet, ci, ri,
col, row, x, y, FALSE);
}
if (!cell_is_blank (cell)){
if (output)
print_cell (cell, mstyle, NULL,
context, x, y);
}
col, row, x, y, FALSE)
: sheet_style_compute (sheet, col, row);
printed = TRUE;
if (mstyle)
mstyle_unref (mstyle);
if (cell_is_blank (cell)) {
if (!output)
printed |= mstyle_visible_in_blank (mstyle);
} else if (output)
print_cell (cell, mstyle, NULL,
context, x, y);
mstyle_unref (mstyle);
/* Increment the column
* DO NOT move this outside the if, spanning
......@@ -793,7 +789,7 @@ print_cell_range (GnomePrintContext *context,
context, sheet, ci, ri,
col, row, x, y,
col != start_span_col && is_visible);
if (col == real_col) {
real_style = mstyle;
real_x = x;
......
......@@ -1068,6 +1068,21 @@ range_translate (Range *range, int col_offset, int row_offset)
range->start.row >= SHEET_MAX_ROWS || range->end.row < 0)
return TRUE;
range_check_sanity (range);
return FALSE;
}
/**
* range_check_sanity :
* @range : the range to check
*
* Silently clip a range to ensure that it does not contain areas
* outside the valid bounds
*/
void
range_check_sanity (Range *range)
{
if (range->start.col < 0)
range->start.col = 0;
if (range->end.col >= SHEET_MAX_COLS)
......@@ -1076,8 +1091,6 @@ range_translate (Range *range, int col_offset, int row_offset)
range->start.row = 0;
if (range->end.row >= SHEET_MAX_ROWS)
range->end.row = SHEET_MAX_ROWS-1;
return FALSE;
}
/**
......
......@@ -91,6 +91,7 @@ gboolean range_intersection (Range *r,
const Range *b);
void range_normalize (Range *src);
Range range_union (const Range *a, const Range *b);
void range_check_sanity (Range *range);
gboolean range_translate (Range *range, int col_offset, int row_offset);
gboolean range_transpose (Range *range, const CellPos *origin);
gboolean range_expand (Range *range,
......
......@@ -577,7 +577,7 @@ sheet_selection_copy (WorkbookControl *wbc, Sheet *sheet)
ss = sheet->selections->data;
application_clipboard_copy (sheet, &ss->user);
application_clipboard_copy (wbc, sheet, &ss->user);
return TRUE;
}
......@@ -612,7 +612,7 @@ sheet_selection_cut (WorkbookControl *wbc, Sheet *sheet)
return FALSE;
}
application_clipboard_cut (sheet, &ss->user);
application_clipboard_cut (wbc, sheet, &ss->user);
return TRUE;
}
......
......@@ -8,7 +8,12 @@ struct _SheetPrivate {
GSList *sheet_vectors;
#endif
/* TODO Add span recomputation here too. */
gboolean edit_pos_changed; /* either location or content */
struct {
gboolean location_changed;
gboolean content_changed; /* entered content NOT value */
gboolean format_changed;
} edit_pos;
gboolean selection_content_changed;
gboolean recompute_visibility;
gboolean recompute_spans;
......
......@@ -165,7 +165,10 @@ sheet_new (Workbook *wb, const char *name)
#endif
/* Init, focus, and load handle setting these if/when necessary */
sheet->priv->edit_pos_changed = FALSE;
sheet->priv->edit_pos.location_changed = FALSE;
sheet->priv->edit_pos.content_changed = FALSE;
sheet->priv->edit_pos.format_changed = FALSE;
sheet->priv->selection_content_changed = FALSE;
sheet->priv->recompute_visibility = FALSE;
sheet->priv->recompute_spans = FALSE;
......@@ -628,8 +631,10 @@ sheet_flag_status_update_cell (Cell const *cell)
* and the format toolbar
*/
if (pos->col == sheet->cursor.edit_pos.col &&
pos->row == sheet->cursor.edit_pos.row)
sheet->priv->edit_pos_changed = TRUE;
pos->row == sheet->cursor.edit_pos.row) {
sheet->priv->edit_pos.content_changed =
sheet->priv->edit_pos.format_changed = TRUE;
}
}
/**
......@@ -645,13 +650,14 @@ sheet_flag_status_update_cell (Cell const *cell)
* updated if appropriate.
*/
void
sheet_flag_status_update_range (Sheet const *sheet,
Range const *range)
sheet_flag_status_update_range (Sheet const *sheet, Range const *range)
{
/* Force an update */
if (range == NULL) {
sheet->priv->selection_content_changed = TRUE;
sheet->priv->edit_pos_changed = TRUE;
sheet->priv->edit_pos.location_changed =
sheet->priv->edit_pos.content_changed =
sheet->priv->edit_pos.format_changed = TRUE;
return;
}
......@@ -664,8 +670,24 @@ sheet_flag_status_update_range (Sheet const *sheet,
/* If the edit cell changes value update the edit area
* and the format toolbar
*/
if (range_contains(range, sheet->cursor.edit_pos.col, sheet->cursor.edit_pos.row)) {
sheet->priv->edit_pos.content_changed =
sheet->priv->edit_pos.format_changed = TRUE;
}
}
/**
* sheet_flag_format_update_range :
* @sheet : The sheet being changed
* @range : the range that is changing.
*
* Flag format changes that will require updating the format indicators.
*/
void
sheet_flag_format_update_range (Sheet const *sheet, Range const *range)
{
if (range_contains(range, sheet->cursor.edit_pos.col, sheet->cursor.edit_pos.row))
sheet->priv->edit_pos_changed = TRUE;
sheet->priv->edit_pos.format_changed = TRUE;
}
/**
......@@ -682,26 +704,6 @@ sheet_flag_selection_change (Sheet const *sheet)
sheet->priv->selection_content_changed = TRUE;
}
/**
* sheet_update_editpos:
*
* This routine is run every time the selection has changed. It checks
* what the status of various toolbar feedback controls should be
*/
static void
sheet_update_editpos (WorkbookControl *wbc, Sheet const *sheet, MStyle *mstyle)
{
#warning disable during editing
#if 0
if (sheet->workbook->editing)
return;
#endif
wb_control_format_feedback (wbc, mstyle);
wb_control_selection_descr_set (wbc,
cell_pos_name (&sheet->cursor.edit_pos));
workbook_edit_load_value (wbc, sheet);
}
/*
* sheet_update : Should be called after a logical command has finished processing
* to request redraws for any pending events
......@@ -765,10 +767,22 @@ sheet_update (Sheet const *sheet)
p->resize_scrollbar = FALSE;
}
if (sheet->priv->edit_pos_changed) {
if (sheet->priv->edit_pos.content_changed) {
sheet->priv->edit_pos.content_changed = FALSE;
WORKBOOK_FOREACH_VIEW (sheet->workbook, view,
{
if (wb_view_cur_sheet (view) == sheet) {
WORKBOOK_VIEW_FOREACH_CONTROL(view, control,
workbook_edit_load_value (control, sheet););
}
});
}
if (sheet->priv->edit_pos.format_changed) {
MStyle *mstyle;
sheet->priv->edit_pos_changed = FALSE;
sheet->priv->edit_pos.format_changed = FALSE;
mstyle = sheet_style_compute (sheet,
sheet->cursor.edit_pos.col,
sheet->cursor.edit_pos.row);
......@@ -777,13 +791,30 @@ sheet_update (Sheet const *sheet)
{
if (wb_view_cur_sheet (view) == sheet) {
WORKBOOK_VIEW_FOREACH_CONTROL(view, control,
sheet_update_editpos (control, sheet, mstyle););
wb_control_format_feedback (control, mstyle););
}
});
mstyle_unref (mstyle);
}
if (sheet->priv->edit_pos.location_changed) {
char const *new_pos = cell_pos_name (&sheet->cursor.edit_pos);
sheet->priv->edit_pos.location_changed = FALSE;
#warning disable during editing
#if 0
if (!sheet->workbook->editing) { }
#endif
WORKBOOK_FOREACH_VIEW (sheet->workbook, view,
{
if (wb_view_cur_sheet (view) == sheet) {
WORKBOOK_VIEW_FOREACH_CONTROL(view, control,
wb_control_selection_descr_set (control, new_pos););
}
});
}
if (sheet->priv->selection_content_changed) {
sheet->priv->selection_content_changed = FALSE;
WORKBOOK_FOREACH_VIEW (sheet->workbook, view,
......@@ -2386,7 +2417,9 @@ sheet_set_edit_pos (Sheet *sheet, int col, int row)
old_row = sheet->cursor.edit_pos.row;
if (old_col != col || old_row != row) {
sheet->priv->edit_pos_changed = TRUE;
sheet->priv->edit_pos.location_changed =
sheet->priv->edit_pos.content_changed =
sheet->priv->edit_pos.format_changed = TRUE;
/* Redraw before change */
sheet_redraw_cell_region (sheet,
......
......@@ -265,6 +265,7 @@ void sheet_redraw_headers (Sheet const *sheet,
void sheet_flag_status_update_cell (Cell const *cell);
void sheet_flag_status_update_range(Sheet const *sheet, Range const *range);
void sheet_flag_format_update_range(Sheet const *sheet, Range const *range);
void sheet_flag_selection_change (Sheet const *sheet);
void sheet_update (Sheet const *sheet);
void sheet_compute_visible_ranges (Sheet const *sheet);
......
......@@ -61,19 +61,22 @@
#include "pixmaps/equal-sign.xpm"
/* The locations within the main table in the workbook */
#define WB_EA_LINE 0
#define WB_EA_SHEETS 1
#define WB_EA_STATUS 2
#define WB_COLS 1
GtkWindow *
wb_control_gui_toplevel (WorkbookControlGUI *wbcg)
{
return wbcg->toplevel;
}
/**
* wb_control_gui_focus_cur_sheet :
* @wbcg : The workbook control to operate on.
*
* A utility routine to safely ensure that the keyboard focus
* is attached to the item-grid. This is required when a user
* edits a combo-box or and entry-line which grab focus.
*
* It is called for zoom, font name/size, and accept/cancel for the editline.
*/
Sheet *
wb_control_gui_focus_cur_sheet (WorkbookControlGUI *wbcg)
{
......@@ -708,6 +711,15 @@ wbcg_paste_from_selection (WorkbookControl *wbc, PasteTarget const *pt, guint32
x_request_clipboard ((WorkbookControlGUI *)wbc, pt, time);
}
static gboolean
wbcg_claim_selection (WorkbookControl *wbc)
{
WorkbookControlGUI *wbcg = (WorkbookControlGUI *)wbc;
return gtk_selection_owner_set (GTK_WIDGET (wbcg->toplevel),
GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME);
}
static void
wbcg_error_system (CommandContext *cc, char const *msg)
{
......@@ -2618,7 +2630,8 @@ wbcg_destroy (GtkObject *obj)
}
static gboolean
cb_scroll_wheel_support (GtkWidget *w, GdkEventButton *event, Workbook *wb)
cb_scroll_wheel_support (GtkWidget *w, GdkEventButton *event,
WorkbookControlGUI *wb)
{
/* FIXME : now that we have made the split this is no longer true. */
/* This is a stub routine to handle scroll wheel events
......@@ -2647,7 +2660,7 @@ workbook_setup_sheets (WorkbookControlGUI *wbcg)
gtk_notebook_set_tab_border (GTK_NOTEBOOK (wbcg->notebook), 0);
gtk_table_attach (GTK_TABLE (wbcg->table), GTK_WIDGET (wbcg->notebook),
0, WB_COLS, WB_EA_SHEETS, WB_EA_SHEETS+1,
0, 1, 1, 2,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
0, 0);
gtk_widget_show (w);
......@@ -2989,6 +3002,7 @@ workbook_control_gui_ctor_class (GtkObjectClass *object_class)