gnumeric r16969 - in trunk: . src src/widgets
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16969 - in trunk: . src src/widgets
- Date: Sat, 22 Nov 2008 20:37:04 +0000 (UTC)
Author: mortenw
Date: Sat Nov 22 20:37:03 2008
New Revision: 16969
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16969&view=rev
Log:
2008-11-22 Morten Welinder <terra gnome org>
* src/sheet-control-priv.h (struct _SheetControl): Remove sheet
member. All users changed to use view.
2008-11-22 Morten Welinder <terra gnome org>
* widget-editable-label.c (el_size_request): Simplify.
(cb_el_changed): Removed. Hook up gtk_widget_queue_resize
directly.
Modified:
trunk/ChangeLog
trunk/src/commands.c
trunk/src/gnm-pane.c
trunk/src/gnm-pane.h
trunk/src/sheet-control-gui.c
trunk/src/sheet-control-priv.h
trunk/src/sheet-control.c
trunk/src/sheet-view.c
trunk/src/wbc-gtk.c
trunk/src/widgets/ChangeLog
trunk/src/widgets/widget-editable-label.c
Modified: trunk/src/commands.c
==============================================================================
--- trunk/src/commands.c (original)
+++ trunk/src/commands.c Sat Nov 22 20:37:03 2008
@@ -393,8 +393,11 @@
if (sheet->workbook == wb_control_get_workbook (wbc))
WORKBOOK_VIEW_FOREACH_CONTROL (wb_control_view (wbc), control,
wb_control_sheet_focus (control, sheet););
- } else if (wbc != NULL)
- sheet_update (wb_control_cur_sheet (wbc));
+ } else if (wbc != NULL) {
+ Sheet *sheet = wb_control_cur_sheet (wbc);
+ if (sheet)
+ sheet_update (sheet);
+ }
}
Modified: trunk/src/gnm-pane.c
==============================================================================
--- trunk/src/gnm-pane.c (original)
+++ trunk/src/gnm-pane.c Sat Nov 22 20:37:03 2008
@@ -171,8 +171,8 @@
{
SheetControlGUI *scg = pane->simple.scg;
SheetControl *sc = (SheetControl *) scg;
- Sheet *sheet = sc->sheet;
SheetView *sv = sc->view;
+ Sheet *sheet = sv->sheet;
WBCGtk *wbcg = scg->wbcg;
gboolean delayed_movement = FALSE;
gboolean jump_to_bounds = event->state & GDK_CONTROL_MASK;
@@ -1415,14 +1415,12 @@
SheetControlGUI *scg;
int x1, y1, x2, y2;
GnmRange tmp;
- SheetControl *sc;
Sheet *sheet;
g_return_if_fail (IS_GNM_PANE (pane));
scg = pane->simple.scg;
- sc = (SheetControl *) scg;
- sheet = sc->sheet;
+ sheet = scg_sheet (scg);
if ((r->end.col < pane->first.col) ||
(r->end.row < pane->first.row) ||
@@ -1512,11 +1510,9 @@
GnmPane *pane3 = scg_pane (pane->simple.scg, 3);
gboolean slide_x = FALSE, slide_y = FALSE;
int col = -1, row = -1;
- gboolean text_is_rtl = pane->simple.scg->sheet_control.sheet->text_is_rtl;
+ Sheet *sheet = scg_sheet (pane->simple.scg);
+ gboolean text_is_rtl = sheet->text_is_rtl;
GnmPaneSlideInfo info;
- Sheet *sheet = ((SheetControl *) pane->simple.scg)->sheet;
-
-
#if 0
g_warning ("slide: %d, %d", pane->sliding_dx, pane->sliding_dy);
@@ -1690,7 +1686,7 @@
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (slide_handler != NULL, FALSE);
- text_is_rtl = pane->simple.scg->sheet_control.sheet->text_is_rtl;
+ text_is_rtl = scg_sheet (pane->simple.scg)->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
@@ -1860,7 +1856,7 @@
double const scale = 1. / FOO_CANVAS (pane)->pixels_per_unit;
y += pane->first_offset.row;
- if (pane->simple.scg->sheet_control.sheet->text_is_rtl)
+ if (scg_sheet (pane->simple.scg)->text_is_rtl)
x = x - GTK_WIDGET (pane)->allocation.width - 1 - pane->first_offset.col;
else
x += pane->first_offset.col;
@@ -2029,7 +2025,7 @@
g_return_if_fail (pane->size_guide.points == NULL);
scg = pane->simple.scg;
- text_is_rtl = scg->sheet_control.sheet->text_is_rtl;
+ text_is_rtl = scg_sheet (scg)->text_is_rtl;
zoom = FOO_CANVAS (pane)->pixels_per_unit;
points = pane->size_guide.points = foo_canvas_points_new (2);
@@ -2122,7 +2118,7 @@
double const scale = 1. / resize_guide->canvas->pixels_per_unit;
if (vert) {
- gboolean text_is_rtl = pane->simple.scg->sheet_control.sheet->text_is_rtl;
+ gboolean text_is_rtl = scg_sheet (pane->simple.scg)->text_is_rtl;
points->coords [0] = points->coords [2] = scale *
(text_is_rtl ? -guide_pos : guide_pos);
} else
@@ -2360,7 +2356,7 @@
y = scg_colrow_distance_get (scg, FALSE, pane->first.row, info->row);
y += pane->first_offset.row;
- if (scg->sheet_control.sheet->text_is_rtl)
+ if (scg_sheet (scg)->text_is_rtl)
x *= -1;
gnm_pane_object_move (pane, info->user_data,
Modified: trunk/src/gnm-pane.h
==============================================================================
--- trunk/src/gnm-pane.h (original)
+++ trunk/src/gnm-pane.h Sat Nov 22 20:37:03 2008
@@ -113,7 +113,7 @@
* Convert an x position from world coordinates to canvas coordinates,
* taking into account sheet right to left text setting.
*/
-#define gnm_pane_x_w2c(pane,x) ((pane)->simple.scg->sheet_control.sheet->text_is_rtl) ? \
+#define gnm_pane_x_w2c(pane,x) (scg_sheet ((pane)->simple.scg)->text_is_rtl) ? \
gnm_foo_canvas_x_w2c ((FooCanvas *) (pane), (x)) : (x)
G_END_DECLS
Modified: trunk/src/sheet-control-gui.c
==============================================================================
--- trunk/src/sheet-control-gui.c (original)
+++ trunk/src/sheet-control-gui.c Sat Nov 22 20:37:03 2008
@@ -100,7 +100,7 @@
Sheet *
scg_sheet (SheetControlGUI const *scg)
{
- return scg->sheet_control.sheet;
+ return sc_sheet ((SheetControl *)scg);
}
WorkbookControl *
@@ -451,8 +451,8 @@
GtkAdjustment *va = scg->va;
GtkAdjustment *ha = scg->ha;
GnmPane *pane = scg_pane (scg, 0);
- Sheet const *sheet = sc->sheet;
- SheetView const*sv = sc->view;
+ SheetView const *sv = sc->view;
+ Sheet const *sheet = sv->sheet;
int const last_col = pane->last_full.col;
int const last_row = pane->last_full.row;
int max_col = last_col;
@@ -680,8 +680,6 @@
static void
scg_init (SheetControlGUI *scg)
{
- scg->sheet_control.sheet = NULL;
-
scg->comment.selected = NULL;
scg->comment.item = NULL;
scg->comment.timer = -1;
@@ -745,7 +743,7 @@
{
Sheet *sheet;
g_return_if_fail (pane != NULL);
- sheet = ((SheetControl*) pane->simple.scg)->sheet;
+ sheet = scg_sheet (pane->simple.scg);
g_return_if_fail (0 <= new_first_col && new_first_col < gnm_sheet_get_max_cols (sheet));
if (pane->first.col != new_first_col) {
@@ -809,7 +807,7 @@
{
Sheet *sheet;
g_return_if_fail (pane != NULL);
- sheet = ((SheetControl*) pane->simple.scg)->sheet;
+ sheet = scg_sheet (pane->simple.scg);
g_return_if_fail (0 <= new_first_row && new_first_row < gnm_sheet_get_max_rows (sheet));
if (pane->first.row != new_first_row) {
@@ -918,7 +916,7 @@
if (!GTK_WIDGET_REALIZED (pane))
return;
- sheet = ((SheetControl *) pane->simple.scg)->sheet;
+ sheet = scg_sheet (pane->simple.scg);
g_return_if_fail (col >= 0);
g_return_if_fail (row >= 0);
g_return_if_fail (col < gnm_sheet_get_max_cols (sheet));
@@ -1693,7 +1691,7 @@
SheetControlGUI *scg = user_data;
SheetControl *sc = (SheetControl *) scg;
SheetView *sv = sc->view;
- Sheet *sheet = sc->sheet;
+ Sheet *sheet = sv->sheet;
WBCGtk *wbcg = scg->wbcg;
WorkbookControl *wbc = sc->wbc;
@@ -2551,7 +2549,7 @@
scg_colrow_distance_get (SheetControlGUI const *scg, gboolean is_cols,
int from, int to)
{
- SheetControl *sc = (SheetControl *) scg;
+ Sheet *sheet = scg_sheet (scg);
ColRowCollection const *collection;
int default_size;
int i, pixels = 0;
@@ -2570,10 +2568,10 @@
if (is_cols) {
g_return_val_if_fail (to <= gnm_sheet_get_max_cols (sc->sheet), 1);
- collection = &sc->sheet->cols;
+ collection = &sheet->cols;
} else {
g_return_val_if_fail (to <= gnm_sheet_get_max_rows (sc->sheet), 1);
- collection = &sc->sheet->rows;
+ collection = &sheet->rows;
}
/* Do not use col_row_foreach, it ignores empties.
@@ -3015,7 +3013,7 @@
g_return_if_fail (IS_SHEET_CONTROL_GUI (scg));
- z = sc->sheet->last_zoom_factor_used;
+ z = scg_sheet (scg)->last_zoom_factor_used;
SCG_FOREACH_PANE (scg, pane, {
if (pane->col.canvas != NULL)
@@ -3579,7 +3577,7 @@
scg_delete_sheet_if_possible (SheetControlGUI *scg)
{
SheetControl *sc = (SheetControl *) scg;
- Sheet *sheet = sc->sheet;
+ Sheet *sheet = scg_sheet (scg);
Workbook *wb = sheet->workbook;
/* If this is the last sheet left, ignore the request */
Modified: trunk/src/sheet-control-priv.h
==============================================================================
--- trunk/src/sheet-control-priv.h (original)
+++ trunk/src/sheet-control-priv.h Sat Nov 22 20:37:03 2008
@@ -9,7 +9,6 @@
struct _SheetControl {
GObject object;
- Sheet *sheet; /* not really needed, but convenient */
SheetView *view;
WorkbookControl *wbc;
};
Modified: trunk/src/sheet-control.c
==============================================================================
--- trunk/src/sheet-control.c (original)
+++ trunk/src/sheet-control.c Sat Nov 22 20:37:03 2008
@@ -23,6 +23,7 @@
#include <gnumeric-config.h>
#include "gnumeric.h"
#include "sheet-control-priv.h"
+#include "sheet-view.h"
#include <gsf/gsf-impl-utils.h>
@@ -73,7 +74,7 @@
sc_sheet (SheetControl const *sc)
{
g_return_val_if_fail (IS_SHEET_CONTROL (sc), NULL);
- return sc->sheet;
+ return sc->view ? sc->view->sheet : NULL;
}
SheetView *
Modified: trunk/src/sheet-view.c
==============================================================================
--- trunk/src/sheet-view.c (original)
+++ trunk/src/sheet-view.c Sat Nov 22 20:37:03 2008
@@ -142,7 +142,6 @@
sv->controls = g_ptr_array_new ();
g_ptr_array_add (sv->controls, sc);
sc->view = sv;
- sc->sheet = sv_sheet (sv); /* convenient */
sv_init_sc (sv, sc);
}
@@ -206,7 +205,7 @@
g_object_unref (G_OBJECT (control));
});
if (sv->controls != NULL)
- g_warning ("Unexpected left over controls");
+ g_warning ("Unexpected left-over controls");
}
if (sv->sheet) {
Modified: trunk/src/wbc-gtk.c
==============================================================================
--- trunk/src/wbc-gtk.c (original)
+++ trunk/src/wbc-gtk.c Sat Nov 22 20:37:03 2008
@@ -691,7 +691,7 @@
{
if (scg == wbcg_cur_scg (scg->wbcg)) {
GtkWidget *w = (GtkWidget *)scg->wbcg->notebook;
- gboolean text_is_rtl = scg->sheet_control.sheet->text_is_rtl;
+ gboolean text_is_rtl = scg_sheet (scg)->text_is_rtl;
GtkTextDirection dir = text_is_rtl
? GTK_TEXT_DIR_RTL
: GTK_TEXT_DIR_LTR;
@@ -1082,7 +1082,7 @@
for (i = 0 ; i < n; i++) {
SheetControlGUI *scg = scgs[i];
- Sheet *sheet = ((SheetControl *)scg)->sheet;
+ Sheet *sheet = scg_sheet (scg);
gtk_notebook_reorder_child (nb,
GTK_WIDGET (scg->table),
sheet->index_in_wb);
Modified: trunk/src/widgets/widget-editable-label.c
==============================================================================
--- trunk/src/widgets/widget-editable-label.c (original)
+++ trunk/src/widgets/widget-editable-label.c Sat Nov 22 20:37:03 2008
@@ -209,14 +209,12 @@
static void
el_size_request (GtkWidget *el, GtkRequisition *req)
{
- PangoRectangle logical_rect;
- PangoLayoutLine *line;
- PangoLayout *layout;
+ PangoRectangle logical_rect;
+ PangoLayout *layout;
parent_class->size_request (el, req);
layout = gtk_entry_get_layout (GTK_ENTRY (el));
- line = pango_layout_get_lines (layout)->data;
- pango_layout_line_get_extents (line, NULL, &logical_rect);
+ pango_layout_get_extents (layout, NULL, &logical_rect);
req->width = logical_rect.width / PANGO_SCALE + 2 * 2;
}
@@ -280,18 +278,13 @@
}
static void
-cb_el_changed (GtkWidget *w, G_GNUC_UNUSED gpointer ignored)
-{
- gtk_widget_queue_resize (w);
-}
-
-static void
el_init (GObject *obj)
{
EditableLabel *el = EDITABLE_LABEL (obj);
el->editable = TRUE;
el->set_cursor_after_motion = FALSE;
- g_signal_connect (obj, "changed", G_CALLBACK (cb_el_changed), NULL);
+ g_signal_connect (obj, "changed",
+ G_CALLBACK (gtk_widget_queue_resize), NULL);
}
GSF_CLASS (EditableLabel, editable_label,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]