Commit 393e66d8 authored by Jean Bréfort's avatar Jean Bréfort

Use GocCanvas instead of FooCanvas

parent 6dc04c47
2009-08-25 Jean Brefort <jean.brefort@normalesup.org>
* src/cell-draw.c: use GocCanvas ibstead of FooCanvas
* src/cell-draw.h: ditto.
* src/gnm-pane-impl.h: ditto.
* src/gnm-pane.c: ditto.
* src/gnm-pane.h: ditto.
* src/gnm-sheet-slicer-combo.c: ditto.
* src/gnm-so-filled.c: ditto.
* src/gnm-so-line.c: ditto.
* src/gnm-so-polygon.c: ditto.
* src/gnumeric-simple-canvas.c: ditto.
* src/gnumeric-simple-canvas.h: ditto.
* src/gui-util.c: ditto.
* src/gui-util.h: ditto.
* src/item-bar.c: ditto.
* src/item-bar.h: ditto.
* src/item-cursor.c: ditto.
* src/item-cursor.h: ditto.
* src/item-edit.c: ditto.
* src/item-grid.c: ditto.
* src/item-grid.h: ditto.
* src/pattern.c: ditto.
* src/pattern.h: ditto.
* src/preview-grid-impl.h: ditto.
* src/preview-grid.c: ditto.
* src/sheet-control-gui.c: ditto.
* src/sheet-control-gui.h: ditto.
* src/sheet-filter.c: ditto.
* src/sheet-object-cell-comment.c: ditto.
* src/sheet-object-graph.c: ditto.
* src/sheet-object-image.c: ditto.
* src/sheet-object-impl.h: ditto.
* src/sheet-object-widget.c: ditto.
* src/sheet-object.c: ditto.
* src/sheet-object.h: ditto.
* src/style-border.c: ditto.
* src/style-border.h: ditto.
* src/style-color.c: ditto.
* src/validation.c: ditto.
* src/wbc-gtk-edit.c: ditto.
2009-08-21 Morten Welinder <terra@gnome.org>
* src/wbc-gtk-actions.c (insert_date_time_common): Rewrite to work
......
......@@ -4,6 +4,9 @@ Andreas:
* Add AVERAGEIF, MUNIT, RRI, SEARCHB, REPLACEB.
* Improve import of ODF functions
Jean:
* Use GocCanvas instead of FooCanvas.
Morten:
* Add GAMMA.
* Fix Insert-Date+Time. [#592545]
......
......@@ -330,9 +330,9 @@ src/value.c
src/wbc-gtk-actions.c
src/wbc-gtk-edit.c
src/wbc-gtk.c
src/widgets/gnm-cell-combo-foo-view.c
src/widgets/gnm-cell-combo-view.c
src/widgets/gnm-dao.c
src/widgets/gnm-filter-combo-foo-view.c
src/widgets/gnm-filter-combo-view.c
src/widgets/gnm-format-sel.c
src/widgets/gnm-validation-combo-foo-view.c
src/widgets/gnumeric-cell-renderer-expr-entry.c
......
......@@ -124,10 +124,8 @@ libspreadsheet_la_SOURCES = \
hlink.c \
history.c \
input-msg.c \
item-acetate.c \
item-bar.c \
item-cursor.c \
item-debug.c \
item-edit.c \
item-grid.c \
libgnumeric.c \
......@@ -248,10 +246,8 @@ libspreadsheet_include_HEADERS = \
hlink-impl.h \
history.h \
input-msg.h \
item-acetate.h \
item-bar.h \
item-cursor.h \
item-debug.h \
item-edit.h \
item-grid.h \
libgnumeric.h \
......
......@@ -276,8 +276,7 @@ cell_finish_layout (GnmCell *cell, GnmRenderedValue *rv,
/**
* cell_draw:
* @cell : #GnmCell const
* @gc : #GdkGC
* @drawable : #GdkDrawable
* @cr : #cairo_t
* @x1 :
* @y1 :
* @width : including margins and leading grid line
......@@ -285,7 +284,7 @@ cell_finish_layout (GnmCell *cell, GnmRenderedValue *rv,
* @h_center :
**/
void
cell_draw (GnmCell const *cell, GdkGC *gc, GdkDrawable *drawable,
cell_draw (GnmCell const *cell, cairo_t *cr,
int x1, int y1, int width, int height, int h_center)
{
GOColor fore_color;
......@@ -309,15 +308,13 @@ cell_draw (GnmCell const *cell, GdkGC *gc, GdkDrawable *drawable,
height * PANGO_SCALE,
h_center == -1 ? -1 : (h_center * PANGO_SCALE),
&fore_color, &x, &y)) {
GdkColor fore_gdk;
/* +1 to get past left grid-line. */
GdkRectangle rect;
rect.x = x1 + 1 + GNM_COL_MARGIN;
rect.y = y1 + 1 + GNM_ROW_MARGIN;
rect.width = width;
rect.height = height;
cairo_rectangle (cr, x1 + 1 + GNM_COL_MARGIN,
y1 + 1 + GNM_ROW_MARGIN,
width, height);
cairo_save (cr);
#if 0
gdk_gc_set_clip_rectangle (gc, &rect);
if (cell->pos.col == 3 && cell->pos.row == 10) {
......@@ -334,12 +331,11 @@ cell_draw (GnmCell const *cell, GdkGC *gc, GdkDrawable *drawable,
* approximation to the right effect. (The right way
* would be to create a proper cellspan type.)
*/
gdk_gc_set_clip_rectangle (gc,
rv->rotation ? NULL : &rect);
if (!rv->rotation)
cairo_clip (cr);
/* See http://bugzilla.gnome.org/show_bug.cgi?id=105322 */
go_color_to_gdk (fore_color, &fore_gdk);
gdk_gc_set_rgb_fg_color (gc, &fore_gdk);
cairo_set_source_rgba (cr, GO_COLOR_TO_CAIRO (fore_color));
if (rv->rotation) {
GnmRenderedRotatedValue *rrv = (GnmRenderedRotatedValue *)rv;
......@@ -352,17 +348,18 @@ cell_draw (GnmCell const *cell, GdkGC *gc, GdkDrawable *drawable,
for (lines = pango_layout_get_lines (rv->layout);
lines;
lines = lines->next, li++) {
gdk_draw_layout_line (drawable, gc,
x1 + PANGO_PIXELS (x + li->dx),
y1 + PANGO_PIXELS (y + li->dy),
lines->data);
cairo_save (cr);
cairo_translate (cr, x1 + PANGO_PIXELS (x + li->dx), y1 + PANGO_PIXELS (y + li->dy));
cairo_rotate (cr, -rv->rotation * M_PI / 180);
pango_cairo_show_layout_line (cr, lines->data);
cairo_restore (cr);
}
pango_context_set_matrix (context, NULL);
pango_layout_context_changed (rv->layout);
} else
gdk_draw_layout (drawable, gc,
x1 + PANGO_PIXELS (x),
y1 + PANGO_PIXELS (y),
rv->layout);
} else {
cairo_translate (cr, x1 + PANGO_PIXELS (x), y1 + PANGO_PIXELS (y));
pango_cairo_show_layout (cr, rv->layout);
}
cairo_restore (cr);
}
}
......@@ -15,7 +15,7 @@ void cell_finish_layout (GnmCell *cell, GnmRenderedValue *rv,
int col_width,
gboolean inhibit_overflow);
void cell_draw (GnmCell const *cell, GdkGC *gc, GdkDrawable *drawable,
void cell_draw (GnmCell const *cell, cairo_t* cr,
int x, int y, int height, int width, int h_center);
G_END_DECLS
......
......@@ -45,7 +45,7 @@
#include <selection.h>
#include <ranges.h>
#include <goffice/cut-n-paste/foocanvas/foo-canvas-rect-ellipse.h>
#include <goffice/goffice.h>
#include <glade/glade.h>
#include <gtk/gtk.h>
#include <gsf/gsf-impl-utils.h>
......@@ -80,10 +80,10 @@ typedef struct {
Workbook *wb; /* Workbook we are working on */
WBCGtk *wbcg;
GladeXML *gui;
FooCanvasItem *grid[NUM_PREVIEWS]; /* Previewgrid's */
FooCanvasItem *selrect; /* Selection rectangle */
GocItem *grid[NUM_PREVIEWS]; /* Previewgrid's */
GocItem *selrect; /* Selection rectangle */
GSList *templates; /* List of GnmFormatTemplate's */
GnmFormatTemplate *selected_template; /* The currently selected template */
GnmFormatTemplate *selected_template; /* The currently selected template */
GList *category_groups; /* List of groups of categories */
FormatTemplateCategoryGroup *current_category_group; /* Currently selected category group */
......@@ -100,7 +100,7 @@ typedef struct {
GtkComboBox *category;
FooCanvas *canvas[NUM_PREVIEWS];
GocCanvas *canvas[NUM_PREVIEWS];
GtkFrame *frame[NUM_PREVIEWS];
GtkVScrollbar *scroll;
GtkCheckMenuItem *gridlines;
......@@ -166,11 +166,11 @@ static GSF_CLASS (AutoFormatGrid, auto_format_grid,
auto_format_grid_class_init, NULL,
preview_grid_get_type())
static FooCanvasItem *
static GocItem *
auto_format_grid_new (AutoFormatState *state, int i, GnmFormatTemplate *ft)
{
FooCanvasItem *item = foo_canvas_item_new (
foo_canvas_root (state->canvas[i]),
GocItem *item = goc_item_new (
goc_canvas_get_root (state->canvas[i]),
auto_format_grid_get_type (),
"render-gridlines", state->gridlines->active,
"default-col-width", DEFAULT_COL_WIDTH,
......@@ -326,27 +326,26 @@ previews_load (AutoFormatState *state, int topindex)
/* Are we selected? Then draw a selection rectangle */
if (topindex + i == state->preview_index) {
GOStyle *style;
g_return_if_fail (state->selrect == NULL);
state->selrect = foo_canvas_item_new (foo_canvas_root (state->canvas[i]),
FOO_TYPE_CANVAS_RECT,
"x1", (double)(-INNER_BORDER),
"y1", (double)(-INNER_BORDER),
"x2", (double)(TOTAL_WIDTH + INNER_BORDER),
"y2", (double)(TOTAL_HEIGHT + INNER_BORDER),
"width-pixels", (int) 3,
"outline-color", "red",
"fill-color", NULL,
state->selrect = goc_item_new (goc_canvas_get_root (state->canvas[i]),
GOC_TYPE_RECTANGLE,
"x", (double)(-INNER_BORDER),
"y", (double)(-INNER_BORDER),
"width", (double)(TOTAL_WIDTH + 2 * INNER_BORDER),
"height", (double)(TOTAL_HEIGHT + 2 * INNER_BORDER),
NULL);
style = go_styled_object_get_style (GO_STYLED_OBJECT (state->selrect));
style->outline.width = 3.;
style->outline.color = RGBA_RED;
style->fill.pattern.back = 0;
gtk_frame_set_shadow_type (state->frame[i], GTK_SHADOW_IN);
} else
gtk_frame_set_shadow_type (state->frame[i], GTK_SHADOW_ETCHED_IN);
foo_canvas_set_scroll_region (state->canvas[i],
-BORDER, -BORDER,
TOTAL_WIDTH + BORDER,
TOTAL_HEIGHT + BORDER);
foo_canvas_scroll_to (state->canvas[i],
goc_canvas_scroll_to (state->canvas[i],
-BORDER, -BORDER);
go_widget_set_tooltip_text
......@@ -394,7 +393,7 @@ cb_scroll_value_changed (GtkAdjustment *adjustment, AutoFormatState *state)
}
static gboolean
cb_canvas_button_press (FooCanvas *canvas,
cb_canvas_button_press (GocCanvas *canvas,
G_GNUC_UNUSED GdkEventButton *event,
AutoFormatState *state)
{
......@@ -455,7 +454,7 @@ cb_check_item_toggled (G_GNUC_UNUSED GtkCheckMenuItem *item,
}
for (i = 0; i < NUM_PREVIEWS; i++)
foo_canvas_request_redraw (state->canvas [i],
goc_canvas_invalidate (state->canvas [i],
-2, -2, INT_MAX/2, INT_MAX/2);
}
......@@ -512,7 +511,7 @@ cb_canvas_focus (GtkWidget *canvas, GtkDirectionType direction,
{
if (!GTK_WIDGET_HAS_FOCUS (canvas)) {
gtk_widget_grab_focus (canvas);
cb_canvas_button_press (FOO_CANVAS (canvas), NULL, state);
cb_canvas_button_press (GOC_CANVAS (canvas), NULL, state);
return TRUE;
}
return FALSE;
......@@ -586,7 +585,7 @@ dialog_autoformat (WBCGtk *wbcg)
state->frame[i] = GTK_FRAME (glade_xml_get_widget (gui, name));
g_free (name);
state->canvas[i] = FOO_CANVAS (foo_canvas_new ());
state->canvas[i] = GOC_CANVAS (g_object_new (GOC_TYPE_CANVAS, NULL));
gtk_widget_set_size_request (GTK_WIDGET (state->canvas[i]),
TOTAL_WIDTH + (2 * BORDER),
TOTAL_HEIGHT + (2 * BORDER));
......
......@@ -56,8 +56,9 @@
#include <style-conditions.h>
#include <goffice/goffice.h>
#include <goffice/cut-n-paste/foocanvas/foo-canvas-util.h>
#include <goffice/cut-n-paste/foocanvas/foo-canvas-rect-ellipse.h>
#include <goffice/canvas/goc-canvas.h>
#include <goffice/canvas/goc-item.h>
#include <goffice/canvas/goc-rectangle.h>
#include <glade/glade.h>
#include <gtk/gtk.h>
......@@ -150,10 +151,10 @@ typedef struct _FormatState {
ColorPicker color;
} font;
struct {
FooCanvas *canvas;
GocCanvas *canvas;
GtkButton *preset[BORDER_PRESET_MAX];
FooCanvasItem *back;
FooCanvasItem *lines[20];
GocItem *back;
GocItem *lines[20];
BorderPicker edge[GNM_STYLE_BORDER_EDGE_MAX];
ColorPicker color;
......@@ -162,7 +163,7 @@ typedef struct _FormatState {
PatternPicker pattern;
} border;
struct {
FooCanvas *canvas;
GocCanvas *canvas;
PreviewGrid *grid;
GnmStyle *style;
......@@ -906,7 +907,7 @@ back_style_changed (FormatState *state)
gnm_style_merge_element (state->result, state->back.style, MSTYLE_PATTERN);
gnm_style_merge_element (state->result, state->back.style, MSTYLE_COLOR_BACK);
gnm_style_merge_element (state->result, state->back.style, MSTYLE_COLOR_PATTERN);
foo_canvas_item_set (FOO_CANVAS_ITEM (state->back.grid),
goc_item_set (GOC_ITEM (state->back.grid),
"default-style", state->back.style,
NULL);
}
......@@ -966,18 +967,17 @@ fmt_dialog_init_background_page (FormatState *state)
int w = 120;
int h = 60;
widget = foo_canvas_new ();
state->back.canvas = FOO_CANVAS (widget);
widget = g_object_new (GOC_TYPE_CANVAS, NULL);
state->back.canvas = GOC_CANVAS (widget);
gtk_widget_set_size_request (widget, w, h);
foo_canvas_set_scroll_region (state->back.canvas, -1, -1, w, h);
widget = glade_xml_get_widget (state->gui, "back_sample_frame");
gtk_container_add (GTK_CONTAINER (widget),
GTK_WIDGET (state->back.canvas));
gtk_widget_show_all (widget);
state->back.grid = PREVIEW_GRID (foo_canvas_item_new (
foo_canvas_root (state->back.canvas),
state->back.grid = PREVIEW_GRID (goc_item_new (
goc_canvas_get_root (state->back.canvas),
preview_grid_get_type (),
"render-gridlines", FALSE,
"default-col-width", w,
......@@ -1104,10 +1104,8 @@ border_format_has_changed (FormatState *state, BorderPicker *edge)
for (i = 0; line_info[i].states != 0 ; ++i ) {
if (line_info[i].location == edge->index &&
state->border.lines[i] != NULL)
foo_canvas_item_set (
FOO_CANVAS_ITEM (state->border.lines[i]),
"fill-color-rgba", edge->rgba,
NULL);
go_styled_object_get_style (
GO_STYLED_OBJECT (state->border.lines[i]))->line.color = edge->rgba;
}
}
if ((int)edge->pattern_index != state->border.pattern.cur_index) {
......@@ -1246,35 +1244,36 @@ draw_border_preview (FormatState *state)
{ R+1., H-5., R+1., H, R+5., H },
{ R+1., H+5., R+1., H, R+5., H }
};
int i, j;
int i, j, k;
/* The first time through lets initialize */
if (state->border.canvas == NULL) {
FooCanvasGroup *group;
FooCanvasPoints *points;
GocGroup *group;
GocPoints *points;
GOStyle *style;
state->border.canvas = FOO_CANVAS (foo_canvas_new ());
state->border.canvas = GOC_CANVAS (g_object_new (GOC_TYPE_CANVAS, NULL));
gtk_widget_show (GTK_WIDGET (state->border.canvas));
gtk_widget_set_size_request (GTK_WIDGET (state->border.canvas),
150, 100);
gtk_container_add (GTK_CONTAINER (glade_xml_get_widget (state->gui, "border_sample_container")),
GTK_WIDGET (state->border.canvas));
group = FOO_CANVAS_GROUP (foo_canvas_root (state->border.canvas));
group = GOC_GROUP (goc_canvas_get_root (state->border.canvas));
g_signal_connect (G_OBJECT (state->border.canvas),
"button-press-event",
G_CALLBACK (border_event), state);
state->border.back = foo_canvas_item_new (group,
FOO_TYPE_CANVAS_RECT,
"x1", L-10., "y1", T-10.,
"x2", R+10., "y2", B+10.,
"width-pixels", (int) 0,
"fill-color", "white",
state->border.back = goc_item_new (group,
GOC_TYPE_RECTANGLE,
"x", L-10., "y", T-10.,
"width", R-L+20., "height", B-T+20.,
NULL);
style = go_styled_object_get_style (GO_STYLED_OBJECT (state->border.back));
style->outline.dash_type = GO_LINE_NONE;
/* Draw the corners */
points = foo_canvas_points_new (3);
points = goc_points_new (3);
for (i = 0; i < 12 ; ++i) {
if (i >= 8) {
......@@ -1285,45 +1284,48 @@ draw_border_preview (FormatState *state)
continue;
}
for (j = 6 ; --j >= 0 ;)
points->coords[j] = corners[i][j];
for (j = 3, k = 5 ; --j >= 0 ;) {
points->points[j].y = corners[i][k--] + .5;
points->points[j].x = corners[i][k--] + .5;
}
foo_canvas_item_new (group,
foo_canvas_line_get_type (),
"width-pixels", (int) 0,
"fill-color", "gray63",
style = go_styled_object_get_style (GO_STYLED_OBJECT (
goc_item_new (group,
goc_polyline_get_type (),
"points", points,
NULL);
NULL)));
style->line.color = RGBA_TO_UINT (0xa1, 0xa1, 0xa1, 0xff); /* gray63 */
style->line.width = 0.;
}
foo_canvas_points_free (points);
goc_points_unref (points);
points = foo_canvas_points_new (2);
for (i = 0; line_info[i].states != 0 ; ++i ) {
for (j = 4; --j >= 0 ; )
points->coords[j] = line_info[i].points[j];
if (line_info[i].states & state->selection_mask) {
BorderPicker const *p =
& state->border.edge[line_info[i].location];
state->border.lines[i] =
foo_canvas_item_new (group,
gnumeric_dashed_canvas_line_get_type (),
"fill-color-rgba", p->rgba,
"points", points,
NULL);
goc_item_new (group,
gnumeric_dashed_canvas_line_get_type (),
"x0", line_info[i].points[0],
"y0", line_info[i].points[1],
"x1", line_info[i].points[2],
"y1", line_info[i].points[3],
NULL);
style = go_styled_object_get_style (GO_STYLED_OBJECT (state->border.lines[i]));
style->line.color = p->rgba;
gnumeric_dashed_canvas_line_set_dash_index (
GNUMERIC_DASHED_CANVAS_LINE (state->border.lines[i]),
p->pattern_index);
} else
state->border.lines[i] = NULL;
}
foo_canvas_points_free (points);
}
for (i = 0; i < GNM_STYLE_BORDER_EDGE_MAX; ++i) {
BorderPicker *border = &state->border.edge[i];
void (*func)(FooCanvasItem *item) = border->is_selected
? &foo_canvas_item_show : &foo_canvas_item_hide;
void (*func)(GocItem *item) = border->is_selected
? &goc_item_show : &goc_item_hide;
for (j = 0; line_info[j].states != 0 ; ++j) {
if ((int)line_info[j].location == i &&
......@@ -1331,7 +1333,7 @@ draw_border_preview (FormatState *state)
(*func) (state->border.lines[j]);
}
}
fmt_dialog_changed (state);
}
......@@ -1440,10 +1442,10 @@ init_border_button (FormatState *state, GnmStyleBorderLocation const i,
state->border.edge[i].is_selected = TRUE;
} else {
GnmColor const *c = border->color;
state->border.edge[i].rgba = FOO_CANVAS_COLOR (
state->border.edge[i].rgba = RGBA_TO_UINT(
c->gdk_color.red >> 8,
c->gdk_color.green >> 8,
c->gdk_color.blue >> 8);
c->gdk_color.blue >> 8, 0xff);
state->border.edge[i].is_auto_color = c->is_auto;
state->border.edge[i].pattern_index = border->line_type;
state->border.edge[i].is_selected = (border->line_type != GNM_STYLE_BORDER_NONE);
......@@ -2499,10 +2501,10 @@ fmt_dialog_impl (FormatState *state, FormatDialogPosition_t pageno)
state->border.pattern.draw_preview = NULL;
state->border.pattern.current_pattern = NULL;
state->border.pattern.state = state;
state->border.rgba = FOO_CANVAS_COLOR (
state->border.rgba = RGBA_TO_UINT (
default_border_color->red >> 8,
default_border_color->green >> 8,
default_border_color->blue >> 8);
default_border_color->blue >> 8, 0xff);
for (i = 0; (name = line_pattern_buttons[i].name) != NULL; ++i)
setup_pattern_button (gtk_widget_get_screen (GTK_WIDGET (state->dialog)),
state->gui, name, &state->border.pattern,
......
......@@ -680,9 +680,6 @@ do_setup_margin (PrinterSetupState *state)
g_return_if_fail (state && state->pi);
state->preview.canvas = GTK_WIDGET (g_object_new (GOC_TYPE_CANVAS, NULL));
goc_canvas_set_scroll_region ( /* is this useful? */
GOC_CANVAS (state->preview.canvas),
PREVIEW_X, PREVIEW_Y);
gtk_widget_set_size_request (state->preview.canvas, PREVIEW_X, PREVIEW_Y);
gtk_widget_show (state->preview.canvas);
......@@ -1871,8 +1868,6 @@ create_hf_preview_canvas (PrinterSetupState *state, gboolean header)
pi->canvas = GTK_WIDGET (g_object_new (GOC_TYPE_CANVAS, NULL));
goc_canvas_set_scroll_region (GOC_CANVAS (pi->canvas), width, width); /* ? */
gostyle = go_styled_object_get_style (
GO_STYLED_OBJECT (goc_item_new (goc_canvas_get_root (GOC_CANVAS (pi->canvas)),
GOC_TYPE_RECTANGLE,
......
......@@ -4,6 +4,7 @@
#include <src/gnm-pane.h>
#include <src/gnumeric-simple-canvas.h>
#include <goffice/canvas/goc-structs.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
......@@ -14,12 +15,15 @@ G_BEGIN_DECLS
struct _GnmPane {
GnmSimpleCanvas simple;
GnmCellPos first, last_full, last_visible, first_offset;
GnmCellPos first, last_full, last_visible;
struct {
gint64 x, y;
} first_offset;
/* In stacking order from lowest to highest */
FooCanvasGroup *grid_items; /* grid & cursors */
FooCanvasGroup *object_views; /* object views */
FooCanvasGroup *action_items; /* drag cursors, and object ctrl pts */
GocGroup *grid_items; /* grid & cursors */
GocGroup *object_views; /* object views */
GocGroup *action_items; /* drag cursors, and object ctrl pts */
/* Sliding scroll */
GnmPaneSlideHandler slide_handler;
......@@ -41,15 +45,15 @@ struct _GnmPane {
int index;
struct {
GtkWidget *alignment;
FooCanvas *canvas;
GocCanvas *canvas;
ItemBar *item;
} col, row;
/* Lines across the grid. Used for col/row resize and the creation of
* frozen panes */
struct {
FooCanvasItem *guide, *start;
FooCanvasPoints *points;
GocItem *guide, *start;
GocPoint *points;
} size_guide;
ItemGrid *grid;
......
This diff is collapsed.
......@@ -3,8 +3,7 @@
# define _GNM_PANE_H_
#include "gui-gnumeric.h"
#include <goffice/cut-n-paste/foocanvas/foo-canvas.h>
#include <goffice/cut-n-paste/foocanvas/foo-canvas-util.h>
#include <goffice/goffice.h>
#include "gui-util.h"
G_BEGIN_DECLS
......@@ -17,8 +16,8 @@ GType gnm_pane_get_type (void);
GnmPane *gnm_pane_new (SheetControlGUI *scg,
gboolean col_headers, gboolean row_headers, int index);
int gnm_pane_find_col (GnmPane const *pane, int x, int *col_origin);
int gnm_pane_find_row (GnmPane const *pane, int y, int *row_origin);
int gnm_pane_find_col (GnmPane const *pane, gint64 x, gint64 *col_origin);
int gnm_pane_find_row (GnmPane const *pane, gint64 y, gint64 *row_origin);
void gnm_pane_redraw_range (GnmPane *pane, GnmRange const *r);
void gnm_pane_compute_visible_region (GnmPane *pane, gboolean full_recompute);
void gnm_pane_bound_set (GnmPane *pane,
......@@ -31,7 +30,7 @@ void gnm_pane_edit_start (GnmPane *p);
void gnm_pane_edit_stop (GnmPane *p);
void gnm_pane_size_guide_start (GnmPane *p, gboolean vert, int colrow, int width);
void gnm_pane_size_guide_motion (GnmPane *p, gboolean vert, int guide_pos);
void gnm_pane_size_guide_motion (GnmPane *p, gboolean vert, gint64 guide_pos);
void gnm_pane_size_guide_stop (GnmPane *p);
void gnm_pane_reposition_cursors (GnmPane *pane);
......@@ -53,19 +52,22 @@ void gnm_pane_objects_drag (GnmPane *pane, SheetObject *so,
gboolean symmetric,gboolean snap_to_grid);
void gnm_pane_object_unselect (GnmPane *pane, SheetObject *so);
void gnm_pane_object_update_bbox (GnmPane *pane, SheetObject *so);
void gnm_pane_object_start_resize (GnmPane *pane, GdkEventButton *event,
void gnm_pane_object_start_resize (GnmPane *pane, int button,
guint64 x, gint64 y,
SheetObject *so, int drag_type,
gboolean is_creation);
void gnm_pane_object_autoscroll (GnmPane *pane, GdkDragContext *context,
gint x, gint y, guint time);
FooCanvasGroup *gnm_pane_object_group (GnmPane *pane);
GocGroup *gnm_pane_object_group (GnmPane *pane);
void gnm_pane_display_object_menu (GnmPane *pane, SheetObject *so,
GdkEvent *event);
/* A convenience api */
SheetObjectView *gnm_pane_object_register (SheetObject *so, FooCanvasItem *view,
SheetObjectView *gnm_pane_object_register (SheetObject *so, GocItem *view,
gboolean selectable);
void gnm_pane_widget_register (SheetObject *so, GtkWidget *w,
FooCanvasItem *view);
GocItem *view);
/************************************************************************/
......@@ -84,37 +86,15 @@ typedef gboolean (*GnmPaneSlideHandler) (GnmPane *pane, GnmPaneSlideInfo const *
void gnm_pane_slide_stop (GnmPane *pane);
void gnm_pane_slide_init (GnmPane *pane);
gboolean gnm_pane_handle_motion (GnmPane *pane,
FooCanvas *canvas,
GdkEventMotion *event,
GocCanvas *canvas,
gint64 x, gint64 y,
GnmPaneSlideFlags slide_flags,
GnmPaneSlideHandler handler,
gpointer user_data);
/************************************************************************/
void gnm_pane_window_to_coord (GnmPane *pane,
gint x, gint y,
double *wx, double *wy);
/*
* gnm_foo_canvas_x_w2c:
* @canvas: a #FooCanvas
* @x : a position in world coordinate
*
* Converts a x position from world coordinates to canvas coordinates.
*/
#define gnm_foo_canvas_x_w2c(canvas,x) -(int)((x) + ((canvas)->scroll_x1 * (canvas)->pixels_per_unit) - 0.5)
/*
* gnm_pane_x_w2c:
* @pane: a #GnmPane
* @x: position in world coordinates
*
* 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) (scg_sheet ((pane)->simple.scg)->text_is_rtl) ? \
gnm_foo_canvas_x_w2c ((FooCanvas *) (pane), (x)) : (x)
void gnm_pane_set_direction (GnmPane *pane, GocDirection direction);
G_END_DECLS
......
......@@ -23,7 +23,7 @@
#include "gnumeric.h"
#include "gnm-sheet-slicer-combo.h"
#include "go-data-slicer-field.h"
#include "widgets/gnm-cell-combo-foo-view.h"
#include "widgets/gnm-cell-combo-view.h"
#include "widgets/gnm-sheet-slicer-combo-foo-view.h"