Commit 6555281d authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Take a 'selectable' argument to enable/disable the view selection


2004-10-16  Jody Goldberg <jody@gnome.org>

	* src/gnumeric-pane.c (gnm_pane_object_register) : Take a 'selectable'
	  argument to enable/disable the view selection mechanism.  This
	  routine is still useful for setting up bounds handlers.
parent 0cdbd233
2004-10-16 Jody Goldberg <jody@gnome.org>
* src/gnumeric-pane.c (gnm_pane_object_register) : Take a 'selectable'
argument to enable/disable the view selection mechanism. This
routine is still useful for setting up bounds handlers.
2004-10-16 Jody Goldberg <jody@gnome.org>
* src/print-info.c : delay the creation of a GnomePrintConfig until it
......
2004-10-16 Jody Goldberg <jody@gnome.org>
* src/gnumeric-pane.c (gnm_pane_object_register) : Take a 'selectable'
argument to enable/disable the view selection mechanism. This
routine is still useful for setting up bounds handlers.
2004-10-16 Jody Goldberg <jody@gnome.org>
* src/print-info.c : delay the creation of a GnomePrintConfig until it
......
......@@ -22,14 +22,18 @@
Author: Ettore Perazzoli <ettore@comm2000.it>
*/
#include <goffice/goffice-config.h>
#include <gnumeric-config.h>
#include <glib/gi18n.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <goffice/gui-utils/go-dock.h>
#include <goffice/gui-utils/go-dock-band.h>
#include <goffice/gui-utils/go-dock-item.h>
#include <libgnome/gnome-macros.h>
#include "go-dock.h"
#include "go-dock-band.h"
#include "go-dock-item.h"
GNOME_CLASS_BOILERPLATE (GoDockBand, go_dock_band,
GtkContainer, GTK_TYPE_CONTAINER);
#define noBONOBO_DOCK_BAND_DEBUG
......@@ -126,8 +130,6 @@ static gboolean check_guint_arg (GObject *object,
const gchar *name,
guint *value_return);
G_DEFINE_TYPE (GoDockBand, go_dock_band, GTK_TYPE_CONTAINER)
static void
go_dock_band_class_init (GoDockBandClass *klass)
{
......@@ -152,7 +154,7 @@ go_dock_band_class_init (GoDockBandClass *klass)
}
static void
go_dock_band_init (GoDockBand *band)
go_dock_band_instance_init (GoDockBand *band)
{
GtkWidget *widget = GTK_WIDGET (band);
......@@ -541,7 +543,7 @@ go_dock_band_map (GtkWidget *widget)
g_return_if_fail(widget != NULL);
g_return_if_fail(GO_IS_DOCK_BAND(widget));
GTK_WIDGET_CLASS (go_dock_band_parent_class)->map (widget);
GNOME_CALL_PARENT (GTK_WIDGET_CLASS, map, (widget));
for (lp = band->children; lp != NULL; lp = lp->next)
{
......@@ -562,7 +564,7 @@ go_dock_band_unmap (GtkWidget *widget)
g_return_if_fail(widget != NULL);
g_return_if_fail(GO_IS_DOCK_BAND(widget));
GTK_WIDGET_CLASS (go_dock_band_parent_class)->unmap (widget);
GNOME_CALL_PARENT (GTK_WIDGET_CLASS, unmap, (widget));
for (lp = band->children; lp != NULL; lp = lp->next)
{
......@@ -659,7 +661,7 @@ go_dock_band_finalize (GObject *object)
g_free (self->_priv);
self->_priv = NULL;
G_OBJECT_CLASS (go_dock_band_parent_class)->finalize (object);
GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
......@@ -1412,6 +1414,8 @@ check_guint_arg (GObject *object,
{
GParamSpec *pspec;
g_return_val_if_fail (object != NULL, FALSE);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), name);
if (pspec != NULL) {
GValue value = { 0, };
......@@ -1980,4 +1984,3 @@ _bonobo_dock_band_handle_key_nav (GoDockBand *band,
return handled;
}
......@@ -10,17 +10,17 @@
* Copyright (C) 2002 Sun Microsystems, Inc.
*/
#include "goffice/goffice-config.h"
#include "gnumeric-config.h"
#include <glib/gi18n.h>
#include <string.h>
#include <goffice/gui-utils/go-dock-item-grip.h>
#include <goffice/gui-utils/go-dock-band.h>
/* #include <goffice/gui-utils/go-a11y.h> */
#include "go-a11y.h"
#include "go-dock-band.h"
#include "go-dock-item-grip.h"
#include <glib-object.h>
#include <atk/atkstateset.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkaccessible.h>
#include <gtk/gtkbindings.h>
#include <libgnome/gnome-macros.h>
#include <glib/gi18n.h>
#include <string.h>
......@@ -34,7 +34,8 @@ static guint signals [LAST_SIGNAL];
static AtkObjectClass *a11y_parent_class = NULL;
G_DEFINE_TYPE (GoDockItemGrip, go_dock_item_grip, GTK_TYPE_WIDGET)
GNOME_CLASS_BOILERPLATE (GoDockItemGrip, go_dock_item_grip,
GtkWidget, GTK_TYPE_WIDGET)
static gint
go_dock_item_grip_expose (GtkWidget *widget,
......@@ -129,6 +130,7 @@ static void
go_dock_item_grip_dock (GoDockItemGrip *grip)
{
GoDock *dock;
int placement;
g_return_if_fail (GO_IS_DOCK_ITEM_GRIP (grip));
......@@ -145,9 +147,15 @@ go_dock_item_grip_dock (GoDockItemGrip *grip)
GTK_CONTAINER (
GTK_WIDGET (grip->item)->parent),
GTK_WIDGET (grip->item));
if (grip->item->orientation == GTK_ORIENTATION_HORIZONTAL)
placement = GO_DOCK_TOP;
else
placement = GO_DOCK_LEFT;
go_dock_add_item (
dock, grip->item,
GO_DOCK_TOP, 2, 0, 0, TRUE);
placement, 2, 0, 0, TRUE);
g_object_unref (G_OBJECT (grip->item));
}
......@@ -274,9 +282,9 @@ go_dock_item_grip_activate (GoDockItemGrip *grip)
}
static void
go_dock_item_grip_init (GoDockItemGrip *grip)
go_dock_item_grip_instance_init (GoDockItemGrip *grip)
{
/* GTK_WIDGET_SET_FLAGS (grip, GTK_CAN_FOCUS); */
GTK_WIDGET_SET_FLAGS (grip, GTK_CAN_FOCUS);
GTK_WIDGET_SET_FLAGS (grip, GTK_NO_WINDOW);
}
......@@ -305,7 +313,7 @@ go_dock_item_grip_key_press_event (GtkWidget *widget,
return TRUE;
}
return GTK_WIDGET_CLASS (go_dock_item_grip_parent_class)->key_press_event (widget, event);
return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
}
static void
......@@ -314,6 +322,8 @@ go_dock_item_grip_class_init (GoDockItemGripClass *klass)
GtkBindingSet *binding_set;
GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
parent_class = g_type_class_peek_parent (klass);
widget_class->expose_event = go_dock_item_grip_expose;
#if 0
widget_class->get_accessible = go_dock_item_grip_get_accessible;
......
......@@ -31,9 +31,7 @@
#ifndef _GO_DOCK_ITEM_H
#define _GO_DOCK_ITEM_H
#include <gdk/gdk.h>
#include <gtk/gtkbin.h>
#include <gtk/gtkenums.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
......@@ -71,8 +69,9 @@ struct _GoDockItem
gchar *name;
/* <private> */
GdkWindow *bin_window; /* parent window for children */
GdkWindow *float_window;
GdkWindow *float_window; /* always NULL */
GtkShadowType shadow_type;
/* Start drag position (wrt widget->window). */
......
......@@ -27,13 +27,13 @@
@NOTATION@
*/
#include <goffice/goffice-config.h>
#include <gnumeric-config.h>
#include <glib/gi18n.h>
#include <string.h>
#include <gtk/gtk.h>
#include <stdio.h>
#include <goffice/gui-utils/go-dock-layout.h>
#include "go-dock-layout.h"
/* TODO: handle incorrect GO_DOCK_ITEM_BEH_EXCLUSIVE situations. */
......
......@@ -25,7 +25,7 @@
@NOTATION@
*/
#include "goffice/goffice-config.h"
#include "gnumeric-config.h"
#include <glib/gi18n.h>
#include <string.h>
#include <gtk/gtk.h>
......@@ -33,6 +33,10 @@
#include "go-dock.h"
#include "go-dock-band.h"
#include "go-dock-item.h"
#include <libgnome/gnome-macros.h>
GNOME_CLASS_BOILERPLATE (GoDock, go_dock,
GtkContainer, GTK_TYPE_CONTAINER);
#define noBONOBO_DOCK_DEBUG
......@@ -154,8 +158,6 @@ static guint dock_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GoDock, go_dock, GTK_TYPE_CONTAINER);
static void
go_dock_class_init (GoDockClass *class)
{
......@@ -193,7 +195,7 @@ go_dock_class_init (GoDockClass *class)
}
static void
go_dock_init (GoDock *dock)
go_dock_instance_init (GoDock *dock)
{
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (dock), GTK_NO_WINDOW);
......@@ -485,7 +487,7 @@ go_dock_map (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GO_IS_DOCK(widget));
GTK_WIDGET_CLASS (go_dock_parent_class)-> map (widget);
GNOME_CALL_PARENT (GTK_WIDGET_CLASS, map, (widget));
dock = GO_DOCK (widget);
......@@ -518,7 +520,7 @@ go_dock_unmap (GtkWidget *widget)
g_list_foreach (dock->floating_children, unmap_widget_foreach, NULL);
GTK_WIDGET_CLASS (go_dock_parent_class)-> unmap (widget);
GNOME_CALL_PARENT (GTK_WIDGET_CLASS, unmap, (widget));
}
......@@ -668,7 +670,8 @@ go_dock_finalize (GObject *object)
g_free (self->_priv);
self->_priv = NULL;
G_OBJECT_CLASS (go_dock_parent_class)->finalize (object);
if (G_OBJECT_CLASS (parent_class)->finalize)
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
......@@ -804,7 +807,7 @@ drag_floating (GoDock *dock,
item_widget = GTK_WIDGET (item);
dock_widget = GTK_WIDGET (dock);
if (item_widget->parent != dock_widget)
if (!item->is_floating && item_widget->parent != dock_widget)
{
GtkAllocation *dock_allocation, *client_allocation;
......@@ -1811,4 +1814,3 @@ _bonobo_dock_handle_key_nav (GoDock *dock,
return TRUE;
}
......@@ -54,8 +54,8 @@ typedef struct _GoDock GoDock;
typedef struct _GoDockPrivate GoDockPrivate;
typedef struct _GoDockClass GoDockClass;
#include "go-dock-band.h"
#include "go-dock-layout.h"
#include <goffice/gui-utils/go-dock-band.h>
#include <goffice/gui-utils/go-dock-layout.h>
struct _GoDock
{
......
......@@ -232,7 +232,7 @@ gnm_so_filled_new_view (SheetObject *so, SheetObjectViewContainer *container)
g_signal_connect_object (sof,
"notify", G_CALLBACK (cb_gnm_so_filled_changed),
group, 0);
return gnm_pane_object_register (so, FOO_CANVAS_ITEM (group));
return gnm_pane_object_register (so, FOO_CANVAS_ITEM (group), TRUE);
}
static void
......@@ -656,7 +656,7 @@ gnm_so_polygon_new_view (SheetObject *so, SheetObjectViewContainer *container)
"notify", G_CALLBACK (cb_gnm_so_filled_style_changed),
item, 0);
#endif
return gnm_pane_object_register (so, item);
return gnm_pane_object_register (so, item, TRUE);
}
static void
......
......@@ -189,7 +189,7 @@ gnm_so_line_new_view (SheetObject *so, SheetObjectViewContainer *container)
g_signal_connect_object (G_OBJECT (sol),
"notify", G_CALLBACK (cb_gnm_so_line_changed),
item, 0);
return gnm_pane_object_register (so, item);
return gnm_pane_object_register (so, item, TRUE);
}
static void
......
......@@ -1154,16 +1154,19 @@ cb_bounds_changed (SheetObject *so, FooCanvasItem *sov)
* gnm_pane_object_register :
* @so : A sheet object
* @view : A canvas item acting as a view for @so
* @selectable : Add handlers for selecting and editing the object
*
* Setup some standard callbacks for manipulating a view of a sheet object.
**/
SheetObjectView *
gnm_pane_object_register (SheetObject *so, FooCanvasItem *view)
gnm_pane_object_register (SheetObject *so, FooCanvasItem *view, gboolean selectable)
{
g_signal_connect (view, "event",
G_CALLBACK (cb_sheet_object_canvas_event), so);
g_signal_connect (view, "destroy",
G_CALLBACK (cb_sheet_object_view_destroyed), so);
if (selectable) {
g_signal_connect (view, "event",
G_CALLBACK (cb_sheet_object_canvas_event), so);
g_signal_connect (view, "destroy",
G_CALLBACK (cb_sheet_object_view_destroyed), so);
}
g_signal_connect_object (so, "bounds-changed",
G_CALLBACK (cb_bounds_changed), view, 0);
return SHEET_OBJECT_VIEW (view);
......@@ -1185,5 +1188,5 @@ gnm_pane_widget_register (SheetObject *so, GtkWidget *w, FooCanvasItem *view)
g_signal_connect (G_OBJECT (w),
"event",
G_CALLBACK (cb_sheet_object_widget_canvas_event), view);
return gnm_pane_object_register (so, view);
return gnm_pane_object_register (so, view, TRUE);
}
......@@ -74,7 +74,7 @@ void gnm_pane_object_start_resize (GnmPane *pane, GdkEventButton *event,
SheetObject *so, int drag_type);
/* A convenience api */
SheetObjectView *gnm_pane_object_register (SheetObject *so, FooCanvasItem *view);
SheetObjectView *gnm_pane_object_register (SheetObject *so, FooCanvasItem *view, gboolean selectable);
SheetObjectView *gnm_pane_widget_register (SheetObject *so, GtkWidget *w, FooCanvasItem *view);
#endif /* GNUMERIC_PANE_H */
......@@ -544,8 +544,8 @@ filter_view_set_bounds (SheetObjectView *sov, double const *coords, gboolean vis
/* NOTE : far point is EXCLUDED so we add 1 */
foo_canvas_item_set (view,
"x", x,
"y", coords [1],
"width", coords [3] - x,
"y", coords [3] - h,
"width", coords [2] - x,
"height", h + 1.,
NULL);
......@@ -590,12 +590,9 @@ filter_field_new_view (SheetObject *so, SheetObjectViewContainer *container)
g_signal_connect (view_widget,
"pressed",
G_CALLBACK (cb_filter_button_pressed), view_item);
/* Do not use the standard handler the combo is not editable */
/* gnm_pane_widget_register (so, view_widget, view_item); */
gtk_widget_show_all (view_widget);
return SHEET_OBJECT_VIEW (view_item);
return gnm_pane_object_register (so, view_item, FALSE);
}
static void
......
......@@ -252,15 +252,6 @@ cell_comment_event (FooCanvasItem *view, GdkEvent *event, GnmPane *pane)
return TRUE;
}
static void
cb_bounds_changed (SheetObject *so, FooCanvasItem *sov)
{
double coords[4];
SheetControlGUI *scg = GNM_SIMPLE_CANVAS (sov->canvas)->scg;
scg_object_anchor_to_coords (scg, sheet_object_get_anchor (so), coords);
sheet_object_view_set_bounds (SHEET_OBJECT_VIEW (sov),
coords, so->flags & SHEET_OBJECT_IS_VISIBLE);
}
static SheetObjectView *
cell_comment_new_view (SheetObject *so, SheetObjectViewContainer *container)
{
......@@ -273,9 +264,7 @@ cell_comment_new_view (SheetObject *so, SheetObjectViewContainer *container)
g_signal_connect (view,
"event",
G_CALLBACK (cell_comment_event), container);
g_signal_connect_object (so, "bounds-changed",
G_CALLBACK (cb_bounds_changed), view, 0);
return SHEET_OBJECT_VIEW (view);
return gnm_pane_object_register (so, view, FALSE);
}
static gboolean
......
......@@ -164,7 +164,7 @@ sheet_object_graph_new_view (SheetObject *so, SheetObjectViewContainer *containe
so_graph_foo_view_get_type (),
"renderer", sog->renderer,
NULL);
return gnm_pane_object_register (so, view);
return gnm_pane_object_register (so, view, TRUE);
}
static gboolean
......
......@@ -316,7 +316,7 @@ sheet_object_image_new_view (SheetObject *so, SheetObjectViewContainer *containe
if (placeholder)
g_object_set_data (G_OBJECT (item), "tile", placeholder);
return gnm_pane_object_register (so, item);
return gnm_pane_object_register (so, item, TRUE);
}
static gboolean
......
......@@ -32,18 +32,15 @@ cb_item_update_bounds (SheetObject *so, FooCanvasItem *view)
foo_canvas_item_hide (view);
}
static GObject *
sheet_object_item_new_view (SheetObject *so, SheetControl *sc, gpointer key)
static SheetObjectView *
sheet_object_item_new_view (SheetObject *so, SheetObjectViewContainer *container)
{
GnmCanvas *gcanvas = ((GnmPane *)key)->gcanvas;
GnmCanvas *gcanvas = ((GnmPane *)container)->gcanvas;
FooCanvasItem *view = bonobo_client_site_new_item (
SHEET_OBJECT_BONOBO (so)->control_frame,
bonobo_ui_component_get_container (scg->wbcg->uic),
gcanvas->object_views);
scg_object_register (so, view);
gnm_pane_object_register (so, item, &cb_item_update_bounds);
return G_OBJECT (view);
return gnm_pane_object_register (so, item, &cb_item_update_bounds, TRUE);
}
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