Commit c4f8f07d authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Remove.

2005-05-03  Morten Welinder  <terra@gnome.org>

	* src/workbook-view.c (wb_view_prefs_update): Remove.

	* src/workbook-control-priv.h: Remove prefs_update member.

	* src/sheet-control-priv.h: Remove adjust_preferences and
	direction_changed members.

	* src/sheet-control-gui.c (sheet_control_gui_new): Also hook up to
	sheet:text-is-rtl.

	* src/workbook-control-gui-priv.h: Remove rtl property.  All users
	changed to use sheet's text_is_rtl (and some already were).

	* src/sheet-control-gui-priv.h: Remove text_is_rtl property.  All
	users changed to use sheet's text_is_rtl (and some already were).
parent 77776746
2005-05-03 Morten Welinder <terra@gnome.org>
* src/workbook-view.c (wb_view_prefs_update): Remove.
* src/workbook-control-priv.h: Remove prefs_update member.
* src/sheet-control-priv.h: Remove adjust_preferences and
direction_changed members.
* src/sheet-control-gui.c (sheet_control_gui_new): Also hook up to
sheet:text-is-rtl.
* src/workbook-control-gui-priv.h: Remove rtl property. All users
changed to use sheet's text_is_rtl (and some already were).
* src/sheet-control-gui-priv.h: Remove text_is_rtl property. All
users changed to use sheet's text_is_rtl (and some already were).
* src/xml-sax-read.c (xml_sax_sheet_name): Use g_object_set to set
sheet properties.
......
2005-05-03 Morten Welinder <terra@gnome.org>
* src/workbook-view.c (wb_view_prefs_update): Remove.
* src/workbook-control-priv.h: Remove prefs_update member.
* src/sheet-control-priv.h: Remove adjust_preferences and
direction_changed members.
* src/sheet-control-gui.c (sheet_control_gui_new): Also hook up to
sheet:text-is-rtl.
* src/workbook-control-gui-priv.h: Remove rtl property. All users
changed to use sheet's text_is_rtl (and some already were).
* src/sheet-control-gui-priv.h: Remove text_is_rtl property. All
users changed to use sheet's text_is_rtl (and some already were).
* src/xml-sax-read.c (xml_sax_sheet_name): Use g_object_set to set
sheet properties.
......
......@@ -2101,7 +2101,6 @@ cb_fmt_dialog_dialog_buttons (GtkWidget *btn, FormatState *state)
if (state->protection.sheet_protected_changed) {
WorkbookView *wbv = wb_control_view (WORKBOOK_CONTROL (state->wbcg));
wbv->is_protected = state->protection.sheet_protected_value;
wb_view_prefs_update (wbv);
state->protection.sheet_protected_changed = FALSE;
}
......
......@@ -157,7 +157,6 @@ cb_attr_dialog_dialog_apply (G_GNUC_UNUSED GtkWidget *button,
workbook_iteration_max_number (state->wb, state->old.max_iterations);
workbook_iteration_tolerance (state->wb, state->old.iteration_tolerance);
wb_view_prefs_update (state->wbv);
cb_widget_changed (NULL, state);
}
......
......@@ -105,7 +105,7 @@ gnm_canvas_key_mode_sheet (GnmCanvas *gcanvas, GdkEventKey *event)
-(gcanvas->last_visible.col-gcanvas->first.col),
FALSE, TRUE);
} else
(*movefn) (gcanvas->simple.scg, scg->rtl ? 1 : -1, jump_to_bounds || end_mode, TRUE);
(*movefn) (gcanvas->simple.scg, sheet->text_is_rtl ? 1 : -1, jump_to_bounds || end_mode, TRUE);
break;
case GDK_KP_Right:
......@@ -118,7 +118,7 @@ gnm_canvas_key_mode_sheet (GnmCanvas *gcanvas, GdkEventKey *event)
gcanvas->last_visible.col-gcanvas->first.col,
FALSE, TRUE);
} else
(*movefn) (gcanvas->simple.scg, scg->rtl ? -1 : 1, jump_to_bounds || end_mode, TRUE);
(*movefn) (gcanvas->simple.scg, sheet->text_is_rtl ? -1 : 1, jump_to_bounds || end_mode, TRUE);
break;
case GDK_KP_Up:
......@@ -867,7 +867,7 @@ gnm_canvas_compute_visible_region (GnmCanvas *gcanvas,
if (full_recompute) {
int col_offset = gcanvas->first_offset.col = scg_colrow_distance_get (scg,
TRUE, 0, gcanvas->first.col);
if (scg->rtl)
if (sheet->text_is_rtl)
col_offset = gnm_simple_canvas_x_w2c (&gcanvas->simple.canvas,
gcanvas->first_offset.col + GTK_WIDGET (gcanvas)->allocation.width);
if (NULL != gcanvas->pane->col.canvas)
......@@ -962,10 +962,14 @@ gnm_canvas_redraw_range (GnmCanvas *gcanvas, GnmRange const *r)
SheetControlGUI *scg;
int x1, y1, x2, y2;
GnmRange tmp;
SheetControl *sc;
Sheet *sheet;
g_return_if_fail (IS_GNM_CANVAS (gcanvas));
scg = gcanvas->simple.scg;
sc = (SheetControl *) scg;
sheet = sc->sheet;
if ((r->end.col < gcanvas->first.col) ||
(r->end.row < gcanvas->first.row) ||
......@@ -1000,7 +1004,7 @@ gnm_canvas_redraw_range (GnmCanvas *gcanvas, GnmRange const *r)
fprintf (stderr, "%s%s\n", col_name (max_col), row_name (last_row));
#endif
if (scg->rtl) {
if (sheet->text_is_rtl) {
int tmp = gnm_simple_canvas_x_w2c (&gcanvas->simple.canvas, x1);
x1 = gnm_simple_canvas_x_w2c (&gcanvas->simple.canvas, x2);
x2 = tmp;
......@@ -1056,6 +1060,7 @@ gcanvas_sliding_callback (gpointer data)
GnmCanvas *gcanvas3 = scg_pane (gcanvas->simple.scg, 3);
gboolean slide_x = FALSE, slide_y = FALSE;
int col = -1, row = -1;
gboolean text_is_rtl = gcanvas->simple.scg->sheet_control.sheet->text_is_rtl;
#if 0
g_warning ("slide: %d, %d", gcanvas->sliding_dx, gcanvas->sliding_dy);
......@@ -1070,7 +1075,7 @@ gcanvas_sliding_callback (gpointer data)
int x = gcanvas->first_offset.col + width + gcanvas->sliding_dx;
/* in case pane is narrow */
col = gnm_canvas_find_col (gcanvas, (gcanvas->simple.scg->rtl)
col = gnm_canvas_find_col (gcanvas, text_is_rtl
? -(x + gcanvas->simple.canvas.scroll_x1 * gcanvas->simple.canvas.pixels_per_unit) : x, NULL);
if (col > gcanvas0->last_full.col) {
gcanvas->sliding_adjacent_h = TRUE;
......@@ -1100,7 +1105,7 @@ gcanvas_sliding_callback (gpointer data)
if (gcanvas->sliding_dx > (-width) &&
col <= gcanvas1->last_visible.col) {
int x = gcanvas1->first_offset.col + width + gcanvas->sliding_dx;
col = gnm_canvas_find_col (gcanvas, (gcanvas->simple.scg->rtl)
col = gnm_canvas_find_col (gcanvas, text_is_rtl
? -(x + gcanvas->simple.canvas.scroll_x1 * gcanvas->simple.canvas.pixels_per_unit) : x, NULL);
slide_x = FALSE;
}
......@@ -1176,7 +1181,7 @@ gcanvas_sliding_callback (gpointer data)
}
if (col < 0) {
col = gnm_canvas_find_col (gcanvas, (gcanvas->simple.scg->rtl)
col = gnm_canvas_find_col (gcanvas, text_is_rtl
? -(gcanvas->sliding_x + gcanvas->simple.canvas.scroll_x1 * gcanvas->simple.canvas.pixels_per_unit)
: gcanvas->sliding_x, NULL);
} else if (row < 0)
......@@ -1220,12 +1225,15 @@ gnm_canvas_handle_motion (GnmCanvas *gcanvas,
GnmCanvas *gcanvas0, *gcanvas1, *gcanvas3;
int pane, left, top, x, y, width, height;
int dx = 0, dy = 0;
gboolean text_is_rtl;
g_return_val_if_fail (IS_GNM_CANVAS (gcanvas), FALSE);
g_return_val_if_fail (FOO_IS_CANVAS (canvas), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (slide_handler != NULL, FALSE);
text_is_rtl = gcanvas->simple.scg->sheet_control.sheet->text_is_rtl;
/* NOTE : work around a bug in gtk's use of X.
* When dragging past the right edge of the sheet in rtl mode
* we are operating at the edge of a 32k wide window and the event
......@@ -1239,7 +1247,7 @@ gnm_canvas_handle_motion (GnmCanvas *gcanvas,
* unlikely. So we put in a kludge here to catch the screw up and
* remap it. This is not pretty, at large zooms this is not far
* fetched.*/
if (gcanvas->simple.scg->rtl &&
if (text_is_rtl &&
event->x < (-64000 / gcanvas->simple.canvas.pixels_per_unit)) {
#if SHEET_MAX_COLS > 700 /* a guestimate */
#error We need a better solution to the rtl event kludge with SHEET_MAX_COLS so large
......@@ -1247,7 +1255,7 @@ gnm_canvas_handle_motion (GnmCanvas *gcanvas,
foo_canvas_w2c (canvas, event->x + 65536, event->y, &x, &y);
} else
foo_canvas_w2c (canvas, event->x, event->y, &x, &y);
if (gcanvas->simple.scg->rtl)
if (text_is_rtl)
x = -(x + gcanvas->simple.canvas.scroll_x1 * gcanvas->simple.canvas.pixels_per_unit);
pane = gcanvas->pane->index;
......@@ -1328,7 +1336,7 @@ gnm_canvas_handle_motion (GnmCanvas *gcanvas,
if (dx == 0 && dy == 0) {
if (!(slide_flags & GNM_CANVAS_SLIDE_EXTERIOR_ONLY)) {
int const row = gnm_canvas_find_row (gcanvas, y, NULL);
int const col = gnm_canvas_find_col (gcanvas, (gcanvas->simple.scg->rtl)
int const col = gnm_canvas_find_col (gcanvas, text_is_rtl
? -(x + gcanvas->simple.canvas.scroll_x1 * gcanvas->simple.canvas.pixels_per_unit) : x, NULL);
(*slide_handler) (gcanvas, col, row, user_data);
......
......@@ -457,6 +457,7 @@ gnm_pane_colrow_resize_start (GnmPane *pane,
FooCanvasPoints *points;
FooCanvasItem *item;
double zoom;
gboolean text_is_rtl;
g_return_if_fail (pane != NULL);
g_return_if_fail (pane->colrow_resize.guide == NULL);
......@@ -465,13 +466,14 @@ gnm_pane_colrow_resize_start (GnmPane *pane,
gcanvas = pane->gcanvas;
scg = gcanvas->simple.scg;
text_is_rtl = scg->sheet_control.sheet->text_is_rtl;
zoom = FOO_CANVAS (gcanvas)->pixels_per_unit;
points = pane->colrow_resize.points = foo_canvas_points_new (2);
if (is_cols) {
double x = scg_colrow_distance_get (scg, TRUE,
0, resize_pos) / zoom;
if (scg->rtl)
if (text_is_rtl)
x = -x;
points->coords [0] = x;
points->coords [1] = scg_colrow_distance_get (scg, FALSE,
......@@ -489,7 +491,7 @@ gnm_pane_colrow_resize_start (GnmPane *pane,
0, gcanvas->last_visible.col+1) / zoom;
points->coords [3] = y;
if (scg->rtl) {
if (text_is_rtl) {
points->coords [0] *= -1.;
points->coords [2] *= -1.;
}
......@@ -538,10 +540,11 @@ gnm_pane_colrow_resize_move (GnmPane *pane, gboolean is_cols, int resize_pos)
FooCanvasPoints *points = pane->colrow_resize.points;
double const scale = 1. / resize_guide->canvas->pixels_per_unit;
if (is_cols)
if (is_cols) {
gboolean text_is_rtl = pane->gcanvas->simple.scg->sheet_control.sheet->text_is_rtl;
points->coords [0] = points->coords [2] = scale *
(pane->gcanvas->simple.scg->rtl ? -resize_pos : resize_pos);
else
(text_is_rtl ? -resize_pos : resize_pos);
} else
points->coords [1] = points->coords [3] = scale * resize_pos;
foo_canvas_item_set (resize_guide, "points", points, NULL);
......@@ -770,7 +773,7 @@ cb_slide_handler (GnmCanvas *gcanvas, int col, int row, gpointer ctrl_pt)
y = scg_colrow_distance_get (scg, FALSE, gcanvas->first.row, row);
y += gcanvas->first_offset.row;
if (scg->rtl)
if (scg->sheet_control.sheet->text_is_rtl)
x *= -1;
gnm_pane_object_move (gcanvas->pane, ctrl_pt, x * scale, y * scale, FALSE, FALSE);
......
......@@ -328,7 +328,7 @@ item_bar_draw (FooCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expos
GdkRectangle rect;
GdkPoint points[3];
gboolean const has_object = scg->new_object != NULL || scg->selected_objects != NULL;
gboolean const rtl = scg->rtl != FALSE;
gboolean const rtl = sheet->text_is_rtl != FALSE;
int shadow;
int first_line_offset = 1;
......@@ -714,11 +714,11 @@ is_pointer_on_division (ItemBar const *ib, double x, double y,
minor = y;
} else {
major = y;
minor = ib->gcanvas->simple.scg->rtl ? (ib->cell_width + ib->indent - x) : x;
minor = sheet->text_is_rtl ? (ib->cell_width + ib->indent - x) : x;
}
if (NULL != minor_pos)
*minor_pos = minor;
if (ib->is_col_header && ib->gcanvas->simple.scg->rtl)
if (ib->is_col_header && sheet->text_is_rtl)
major = -major;
if (NULL != the_element)
*the_element = -1;
......@@ -883,10 +883,10 @@ item_bar_event (FooCanvasItem *item, GdkEvent *e)
cri = sheet_colrow_get_info (sheet,
ib->colrow_being_resized, is_cols);
pos = is_cols ? (scg->rtl ? -e->motion.x : e->motion.x) : e->motion.y;
pos = is_cols ? (sheet->text_is_rtl ? -e->motion.x : e->motion.x) : e->motion.y;
pos *= ib->base.canvas->pixels_per_unit;
new_size = pos - ib->resize_start_pos;
if (is_cols && scg->rtl)
if (is_cols && sheet->text_is_rtl)
new_size += cri->size_pixels;
/* Ensure we always have enough room for the margins */
......@@ -958,7 +958,7 @@ item_bar_event (FooCanvasItem *item, GdkEvent *e)
* other event handlers).
*/
ib->colrow_being_resized = element;
ib->resize_start_pos = (is_cols && scg->rtl)
ib->resize_start_pos = (is_cols && sheet->text_is_rtl)
? start : (start - cri->size_pixels);
ib->colrow_resize_size = cri->size_pixels;
......
......@@ -201,7 +201,7 @@ item_cursor_update (FooCanvasItem *item, double i2w_dx, double i2w_dy, int flags
ic->outline.y2 = ic->outline.y1 +
scg_colrow_distance_get (scg, FALSE,top, bottom+1);
if (scg->rtl) {
if (scg->sheet_control.sheet->text_is_rtl) {
tmp = ic->outline.x1;
ic->outline.x1 = gnm_simple_canvas_x_w2c (item->canvas, ic->outline.x2);
ic->outline.x2 = gnm_simple_canvas_x_w2c (item->canvas, tmp);
......
......@@ -310,7 +310,7 @@ ie_layout (FooCanvasItem *item)
/* Start after the grid line and the left margin */
col_size = cri->size_pixels - cri->margin_a - 1;
if (ie->scg->rtl)
if (sheet->text_is_rtl)
while (col_size < width &&
end_col > gcanvas->first.col &&
end_col > 0) {
......@@ -342,7 +342,7 @@ ie_layout (FooCanvasItem *item)
/* The lower right is based on the span size excluding the grid lines
* Recall that the bound excludes the far point */
if (ie->scg->rtl) {
if (sheet->text_is_rtl) {
tmp = gnm_simple_canvas_x_w2c (item->canvas, gcanvas->first_offset.col);
item->x2 = 1 + item->x1 +
scg_colrow_distance_get (ie->scg, TRUE, end_col, ie->pos.col+1) - 2;
......@@ -392,7 +392,7 @@ item_edit_realize (FooCanvasItem *item)
ie->layout = gtk_widget_create_pango_layout (GTK_WIDGET (item->canvas), NULL);
pango_layout_set_alignment (ie->layout,
ie->scg->rtl ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT);
ie->scg->sheet_control.sheet->text_is_rtl ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT);
}
static void
......@@ -583,7 +583,8 @@ item_edit_set_property (GObject *gobject, guint param_id,
item->x1 = 1 + gcanvas->first_offset.col +
scg_colrow_distance_get (ie->scg, TRUE,
gcanvas->first.col, ie->pos.col);
if (ie->scg->rtl) /* -1 to remove the above, then 2 more to move from next cell back */
if (ie->scg->sheet_control.sheet->text_is_rtl)
/* -1 to remove the above, then 2 more to move from next cell back */
item->x1 = 2 + gnm_simple_canvas_x_w2c (item->canvas, item->x1 +
scg_colrow_distance_get (ie->scg, TRUE,
ie->pos.col, ie->pos.col + 1) - 1);
......
......@@ -356,7 +356,7 @@ item_grid_draw (FooCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expo
GnmCell const * const edit_cell = gcanvas->simple.scg->wbcg->wb_control.editing_cell;
ItemGrid *ig = ITEM_GRID (item);
ColRowInfo const *ri = NULL, *next_ri = NULL;
int const dir = gcanvas->simple.scg->rtl ? -1 : 1;
int const dir = sheet->text_is_rtl ? -1 : 1;
/* To ensure that far and near borders get drawn we pretend to draw +-2
* pixels around the target area which would include the surrounding
......
......@@ -57,7 +57,6 @@ struct _SheetControlGUI {
gboolean jump, horiz;
SCGUIMoveFunc handler;
} delayedMovement;
gboolean rtl;
};
typedef SheetControlClass SheetControlGUIClass;
......
......@@ -309,7 +309,7 @@ scg_resize (SheetControl *sc, gboolean force_scroll)
/* no need to resize panes that are about to go away while unfreezing */
if (scg->active_panes == 1 || !sv_is_frozen (sc->view)) {
if (scg->rtl)
if (sheet->text_is_rtl)
foo_canvas_set_scroll_region (scg->pane[0].col.canvas,
-GNUMERIC_CANVAS_FACTOR_X * scale, 0, 0, h * scale);
else
......@@ -351,7 +351,7 @@ scg_resize (SheetControl *sc, gboolean force_scroll)
*/
h = item_bar_calc_size (scg->pane[1].col.item);
gtk_widget_set_size_request (GTK_WIDGET (scg->pane[1].col.canvas), r - l, h+1);
if (scg->rtl)
if (sheet->text_is_rtl)
foo_canvas_set_scroll_region (scg->pane[1].col.canvas,
-GNUMERIC_CANVAS_FACTOR_X * scale, 0, 0, h * scale);
else
......@@ -371,7 +371,7 @@ scg_resize (SheetControl *sc, gboolean force_scroll)
if (scg->pane[2].is_active)
gtk_widget_set_size_request (GTK_WIDGET (scg->pane[2].gcanvas), r - l, b - t);
if (scg->rtl)
if (sheet->text_is_rtl)
foo_canvas_set_scroll_region (scg->pane[0].col.canvas,
-GNUMERIC_CANVAS_FACTOR_X * scale, 0, 0, h * scale);
else
......@@ -382,7 +382,7 @@ scg_resize (SheetControl *sc, gboolean force_scroll)
}
SCG_FOREACH_PANE (scg, pane, {
if (scg->rtl)
if (sheet->text_is_rtl)
foo_canvas_set_scroll_region (FOO_CANVAS (pane->gcanvas),
-GNUMERIC_CANVAS_FACTOR_X * scale, 0., 0., GNUMERIC_CANVAS_FACTOR_Y * scale);
else
......@@ -660,7 +660,7 @@ bar_set_left_col (GnmCanvas *gcanvas, int new_first_col)
col_offset = gcanvas->first_offset.col +=
scg_colrow_distance_get (gcanvas->simple.scg, TRUE, gcanvas->first.col, new_first_col);
gcanvas->first.col = new_first_col;
if (gcanvas->simple.scg->rtl)
if (gcanvas->simple.scg->sheet_control.sheet->text_is_rtl)
col_offset = gnm_simple_canvas_x_w2c (&gcanvas->simple.canvas,
col_offset + GTK_WIDGET (gcanvas)->allocation.width);
......@@ -744,7 +744,7 @@ gnm_canvas_set_top_row (GnmCanvas *gcanvas, int new_first_row)
int col_offset = gcanvas->first_offset.col;
gnm_canvas_compute_visible_region (gcanvas, FALSE);
if (gcanvas->simple.scg->rtl)
if (gcanvas->simple.scg->sheet_control.sheet->text_is_rtl)
col_offset = gnm_simple_canvas_x_w2c (canvas,
col_offset + GTK_WIDGET (gcanvas)->allocation.width);
foo_canvas_scroll_to (canvas, col_offset, row_offset);
......@@ -792,7 +792,7 @@ gnm_canvas_set_top_left (GnmCanvas *gcanvas,
}
col_offset = bar_set_left_col (gcanvas, col);
changed = TRUE;
} else if (gcanvas->simple.scg->rtl)
} else if (gcanvas->simple.scg->sheet_control.sheet->text_is_rtl)
col_offset = gnm_simple_canvas_x_w2c (&gcanvas->simple.canvas,
gcanvas->first_offset.col + GTK_WIDGET (gcanvas)->allocation.width);
else
......@@ -1133,15 +1133,27 @@ cb_scg_redraw_resize (Sheet *sheet,
scg_resize (scg, FALSE);
}
static void
cb_scg_direction_changed (Sheet *sheet,
GParamSpec *pspec,
SheetControlGUI *scg)
{
scg_resize (SHEET_CONTROL (scg), TRUE);
if (NULL != scg->wbcg && scg == wbcg_cur_scg (scg->wbcg))
wbcg_set_direction (scg->wbcg);
}
SheetControlGUI *
sheet_control_gui_new (SheetView *sv, WorkbookControlGUI *wbcg)
{
SheetControlGUI *scg;
GtkUpdateType scroll_update_policy;
Sheet *sheet;
g_return_val_if_fail (IS_SHEET_VIEW (sv), NULL);
sheet = sv_sheet (sv);
scg = g_object_new (SHEET_CONTROL_GUI_TYPE, NULL);
scg->wbcg = wbcg;
scg->sheet_control.wbc = WORKBOOK_CONTROL (wbcg);
......@@ -1263,7 +1275,8 @@ sheet_control_gui_new (SheetView *sv, WorkbookControlGUI *wbcg)
sv_attach_control (sv, SHEET_CONTROL (scg));
g_object_connect
(G_OBJECT (sv_sheet (sv)),
(G_OBJECT (sheet),
"signal::notify::text-is-rtl", cb_scg_direction_changed, scg,
"signal::notify::display-formulas", cb_scg_redraw, scg,
"signal::notify::display-zeros", cb_scg_redraw, scg,
"signal::notify::display-grid", cb_scg_redraw, scg,
......@@ -1314,12 +1327,10 @@ scg_finalize (GObject *object)
if (sc->view) {
Sheet *sheet = sv_sheet (sc->view);
g_signal_handlers_disconnect_by_func
(sheet, cb_scg_prefs, scg);
g_signal_handlers_disconnect_by_func
(sheet, cb_scg_redraw, scg);
g_signal_handlers_disconnect_by_func
(sheet, cb_scg_redraw_resize, scg);
g_signal_handlers_disconnect_by_func (sheet, cb_scg_prefs, scg);
g_signal_handlers_disconnect_by_func (sheet, cb_scg_redraw, scg);
g_signal_handlers_disconnect_by_func (sheet, cb_scg_redraw_resize, scg);
g_signal_handlers_disconnect_by_func (sheet, cb_scg_direction_changed, scg);
sv_detach_control (sc);
}
......@@ -1962,12 +1973,12 @@ snap_to_grid (ObjDragInfo *info,
g_return_if_fail (info->gcanvas != NULL);
foo_canvas_w2c (FOO_CANVAS (info->gcanvas), *x, *y, &x_int, &y_int);
if (info->scg->rtl) x_int = GNUMERIC_CANVAS_FACTOR_X - x_int;
if (info->scg->sheet_control.sheet->text_is_rtl) x_int = GNUMERIC_CANVAS_FACTOR_X - x_int;
if (snap_x) snap_pos_to_grid (info, TRUE, &x_int, to_left);
if (snap_y) snap_pos_to_grid (info, FALSE, &y_int, to_top);
if (info->scg->rtl) x_int = GNUMERIC_CANVAS_FACTOR_X - x_int;
if (info->scg->sheet_control.sheet->text_is_rtl) x_int = GNUMERIC_CANVAS_FACTOR_X - x_int;
foo_canvas_c2w (FOO_CANVAS (info->gcanvas), x_int, y_int, x, y);
}
......@@ -1983,7 +1994,7 @@ apply_move (SheetObject *so, int x_idx, int y_idx, double *coords, ObjDragInfo *
if (snap) {
snap_to_grid (info, move_x, move_y, &x, &y,
info->scg->rtl ? info->dx > 0. : info->dx < 0.,
info->scg->sheet_control.sheet->text_is_rtl ? info->dx > 0. : info->dx < 0.,
info->dy < 0.);
if (info->primary_object == so || NULL == info->primary_object) {
if (move_x) info->dx = x - coords[x_idx];
......@@ -2151,7 +2162,7 @@ scg_object_coords_to_anchor (SheetControlGUI const *scg,
g_return_if_fail (IS_SHEET_CONTROL_GUI (scg));
g_return_if_fail (coords != NULL);
if ((coords [0] > coords [2]) == (!scg->rtl)) {
if ((coords [0] > coords [2]) == (!scg->sheet_control.sheet->text_is_rtl)) {
tmp [0] = coords [2];
tmp [2] = coords [0];
} else {
......@@ -2232,7 +2243,7 @@ scg_object_anchor_to_coords (SheetControlGUI const *scg,
coords [1] = pixels [direction & SO_DIR_V_MASK ? 1 : 3] * scale;
coords [2] = pixels [direction & SO_DIR_H_MASK ? 2 : 0] * scale;
coords [3] = pixels [direction & SO_DIR_V_MASK ? 3 : 1] * scale;
if (scg->rtl) {
if (sheet->text_is_rtl) {
double tmp = -coords [0];
coords [0] = - coords [2];
coords [2] = tmp;
......@@ -2839,17 +2850,6 @@ scg_object_create_view (SheetControl *sc, SheetObject *so)
sheet_object_new_view (so, (SheetObjectViewContainer *)pane););
}
static void
scg_direction_changed (SheetControl *sc)
{
SheetControlGUI *scg = SHEET_CONTROL_GUI (sc);
scg->rtl = sc->view->text_is_rtl;
scg_resize (sc, TRUE);
if (NULL != scg->wbcg && scg == wbcg_cur_scg (scg->wbcg))
wbcg_set_direction (scg->wbcg);
}
static void
scg_scale_changed (SheetControl *sc)
{
......@@ -2888,7 +2888,6 @@ scg_class_init (GObjectClass *object_class)
sc_class->redraw_headers = scg_redraw_headers;
sc_class->ant = scg_ant;
sc_class->unant = scg_unant;
sc_class->adjust_preferences = scg_adjust_preferences;
sc_class->scrollbar_config = scg_scrollbar_config;
sc_class->set_top_left = scg_set_top_left;
sc_class->compute_visible_region = scg_compute_visible_region;
......@@ -2896,7 +2895,6 @@ scg_class_init (GObjectClass *object_class)
sc_class->cursor_bound = scg_cursor_bound;
sc_class->set_panes = scg_set_panes;
sc_class->object_create_view = scg_object_create_view;
sc_class->direction_changed = scg_direction_changed;
sc_class->scale_changed = scg_scale_changed;
}
......
......@@ -24,7 +24,6 @@ typedef struct {
GnmRange const * r);
void (*ant) (SheetControl *sc);
void (*unant) (SheetControl *sc);
void (*adjust_preferences) (SheetControl *sc);
void (*scrollbar_config) (SheetControl const *sc);
void (*mode_edit) (SheetControl *sc);
void (*set_top_left) (SheetControl *sc, int col, int row);
......@@ -37,7 +36,6 @@ typedef struct {
float (*colrow_distance_get) (SheetControl const *sc, gboolean is_col,
int start, int end);
void (*object_create_view) (SheetControl *sc, SheetObject *so);
void (*direction_changed) (SheetControl *sc);
void (*scale_changed) (SheetControl *sc);
} SheetControlClass;
......
......@@ -97,8 +97,6 @@ SC_VIRTUAL (redraw_headers,
SC_VIRTUAL (ant, (SheetControl *sc), (sc))
SC_VIRTUAL (unant, (SheetControl *sc), (sc))
SC_VIRTUAL (adjust_preferences, (SheetControl *sc), (sc))
SC_VIRTUAL (scrollbar_config, (SheetControl const *sc), (sc));
SC_VIRTUAL (mode_edit, (SheetControl *sc), (sc));
......@@ -117,6 +115,5 @@ SC_VIRTUAL (cursor_bound, (SheetControl *sc, GnmRange const *r), (sc, r))
SC_VIRTUAL (set_panes, (SheetControl *sc), (sc))
SC_VIRTUAL (object_create_view, (SheetControl *sc, SheetObject *so), (sc, so));
SC_VIRTUAL (direction_changed, (SheetControl *sc),(sc));
SC_VIRTUAL (scale_changed, (SheetControl *sc), (sc))
......@@ -29,7 +29,6 @@ void sc_redraw_headers (SheetControl *sc,
void sc_ant (SheetControl *sc);
void sc_unant (SheetControl *sc);
void sc_adjust_preferences (SheetControl *sc);
void sc_scrollbar_config (SheetControl const *sc);
void sc_mode_edit (SheetControl *sc);
......@@ -42,7 +41,6 @@ void sc_make_cell_visible (SheetControl *sc, int col, int row,
void sc_cursor_bound (SheetControl *sc, GnmRange const *r);
void sc_set_panes (SheetControl *sc);
void sc_object_create_view (SheetControl *sc, SheetObject *so);
void sc_direction_changed (SheetControl *sc);
void sc_scale_changed (SheetControl *sc);
#endif /* GNUMERIC_SHEET_CONTROL_H */
......@@ -89,7 +89,7 @@ comment_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean vi
points->coords [1] = scale * y;
points->coords [3] = scale * y;
points->coords [5] = scale * (y + TRIANGLE_WIDTH);
if (scg->rtl)
if (so->sheet->text_is_rtl)
scale *= -1;
points->coords [0] = scale * (x - TRIANGLE_WIDTH);
points->coords [2] = scale * x;
......
......@@ -68,15 +68,6 @@ cb_update_auto_expr (gpointer data)
/*************************************************************************/
static void
sv_sheet_direction_changed (Sheet *sheet,
G_GNUC_UNUSED GParamSpec *pspec,
SheetView *sv)
{
sv->text_is_rtl = sheet->text_is_rtl;
SHEET_VIEW_FOREACH_CONTROL (sv, sc, sc_direction_changed (sc););
}
static void
sv_sheet_name_changed (G_GNUC_UNUSED Sheet *sheet,
G_GNUC_UNUSED GParamSpec *pspec,
......@@ -115,7 +106,6 @@ sv_init_sc (SheetView const *sv, SheetControl *sc)
/* Set the visible bound, not the logical bound */
sc_cursor_bound (sc, selection_first_range (sv, NULL, NULL));
sc_ant (sc);
sc_direction_changed (sc);
}
void
......@@ -200,7 +190,6 @@ sv_real_dispose (GObject *object)
Sheet *sheet = sv->sheet;
sv->sheet = NULL;
g_ptr_array_remove (sheet->sheet_views, sv);
g_signal_handlers_disconnect_by_func (sheet, sv_sheet_direction_changed, sv);
g_signal_handlers_disconnect_by_func (sheet, sv_sheet_name_changed, sv);
g_object_unref (sheet);
}
......@@ -239,7 +228,6 @@ sheet_view_init (GObject *object)
sv->selection_content_changed = TRUE;
sv->reposition_selection = TRUE;
sv->auto_expr_timer = 0;
sv->text_is_rtl = FALSE;
sv->frozen_top_left.col = sv->frozen_top_left.row =
sv->unfrozen_top_left.col = sv->unfrozen_top_left.row = -1;
......@@ -261,14 +249,9 @@ sheet_view_new (Sheet *sheet, WorkbookView *wbv)
sv = g_object_new (SHEET_VIEW_TYPE, NULL);
sv->sheet = g_object_ref (sheet);
sv->text_is_rtl = sheet->text_is_rtl;
sv->wbv = wbv;
g_ptr_array_add (sheet->sheet_views, sv);
g_signal_connect (G_OBJECT (sheet),
"notify::text-is-rtl",
G_CALLBACK (sv_sheet_direction_changed),
sv);
g_signal_connect (G_OBJECT (sheet),
"notify::name",
G_CALLBACK (sv_sheet_name_changed),
......
......@@ -47,7 +47,6 @@ struct _SheetView {
unsigned char format;
} edit_pos_changed;
guint auto_expr_timer;
gboolean text_is_rtl;
};
typedef GObjectClass SheetViewClass;
......
......@@ -4271,20 +4271,6 @@ sheet_scrollbar_config (Sheet const *sheet)
sc_scrollbar_config (control););
}
void
sheet_adjust_preferences (Sheet const *sheet, gboolean redraw, gboolean resize)
{
g_return_if_fail (IS_SHEET (sheet));
SHEET_FOREACH_CONTROL (sheet, view, control, {
sc_adjust_preferences (control);
if (resize)
sc_resize (control, FALSE);
if (redraw)
sc_redraw_all (control, TRUE);
});
}
/*****************************************************************************/
typedef struct
{
......
......@@ -230,8 +230,6 @@ void sheet_flag_recompute_spans (Sheet const *s);
void sheet_update_only_grid (Sheet const *s);
void sheet_update (Sheet const *s);
void sheet_scrollbar_config (Sheet const *s);
void sheet_adjust_preferences (Sheet const *s,
gboolean redraw, gboolean resize);
void sheet_set_dirty (Sheet *sheet, gboolean is_dirty);
gboolean sheet_is_pristine (Sheet const *sheet);
......
......@@ -342,25 +342,6 @@ wbcg_set_title (WorkbookControl *wbc, char const *title)
g_free (full_title);
}
static void
cb_prefs_update (gpointer key, gpointer value, gpointer user_data)
{
Sheet *sheet = value;
sheet_adjust_preferences (sheet, FALSE, FALSE);
}
static void
wbcg_prefs_update (WorkbookControl *wbc)
{
WorkbookControlGUI *wbcg = (WorkbookControlGUI *)wbc;
Workbook *wb = wb_control_workbook (wbc);
WorkbookView *wbv = wb_control_view (wbc);
g_hash_table_foreach (wb->sheet_hash_private, cb_prefs_update, NULL);
gtk_notebook_set_show_tabs (wbcg->notebook,
wbv->show_notebook_tabs);
}
static void