Commit 226cbacc authored by Lutz Müller's avatar Lutz Müller Committed by Lutz Müller

Add the view as parameter to the virtual method set_active. New. Overrides

2001-07-20  Lutz Mller  <urc8@rz.uni-karlsruhe.de>

        * src/sheet-object-impl.h: Add the view as parameter to the virtual
        method set_active.
        * src/sheet-object-container.c:
        (sheet_object_container_set_active): New. Overrides above virtual and
        handles (de)activation of view frames.
        * src/sheet-control-gui-priv.h: Do not let the SheetControlGUI know
        about an active_object_frame - remove this variable.
        * src/sheet-control-gui.[c,h]:
        (scg_activate_view_frame),
        (scg_deactivate_view_frame): Removed. Now handled by the objects
        themselves through set_active virtual method.
        (scg_object_stop_editing),
        (scg_mode_edit_object): Adjust parameters for virtual method set_active.
parent b00236d0
2001-07-20 Lutz Mller <urc8@rz.uni-karlsruhe.de>
* src/sheet-object-impl.h: Add the view as parameter to the virtual
method set_active.
* src/sheet-object-container.c:
(sheet_object_container_set_active): New. Overrides above virtual and
handles (de)activation of view frames.
* src/sheet-control-gui-priv.h: Do not let the SheetControlGUI know
about an active_object_frame - remove this variable.
* src/sheet-control-gui.[c,h]:
(scg_activate_view_frame),
(scg_deactivate_view_frame): Removed. Now handled by the objects
themselves through set_active virtual method.
(scg_object_stop_editing),
(scg_mode_edit_object): Adjust parameters for virtual method set_active.
2001-07-18 Zbigniew Chyla <cyba@gnome.pl>
* src/dialogs/dialog-function-wizard.c (formula_guru_init_args): Use
......
2001-07-20 Lutz Mller <urc8@rz.uni-karlsruhe.de>
* src/sheet-object-impl.h: Add the view as parameter to the virtual
method set_active.
* src/sheet-object-container.c:
(sheet_object_container_set_active): New. Overrides above virtual and
handles (de)activation of view frames.
* src/sheet-control-gui-priv.h: Do not let the SheetControlGUI know
about an active_object_frame - remove this variable.
* src/sheet-control-gui.[c,h]:
(scg_activate_view_frame),
(scg_deactivate_view_frame): Removed. Now handled by the objects
themselves through set_active virtual method.
(scg_object_stop_editing),
(scg_mode_edit_object): Adjust parameters for virtual method set_active.
2001-07-18 Zbigniew Chyla <cyba@gnome.pl>
* src/dialogs/dialog-function-wizard.c (formula_guru_init_args): Use
......
2001-07-20 Lutz Mller <urc8@rz.uni-karlsruhe.de>
* src/sheet-object-impl.h: Add the view as parameter to the virtual
method set_active.
* src/sheet-object-container.c:
(sheet_object_container_set_active): New. Overrides above virtual and
handles (de)activation of view frames.
* src/sheet-control-gui-priv.h: Do not let the SheetControlGUI know
about an active_object_frame - remove this variable.
* src/sheet-control-gui.[c,h]:
(scg_activate_view_frame),
(scg_deactivate_view_frame): Removed. Now handled by the objects
themselves through set_active virtual method.
(scg_object_stop_editing),
(scg_mode_edit_object): Adjust parameters for virtual method set_active.
2001-07-18 Zbigniew Chyla <cyba@gnome.pl>
* src/dialogs/dialog-function-wizard.c (formula_guru_init_args): Use
......
2001-07-20 Lutz Mller <urc8@rz.uni-karlsruhe.de>
* src/sheet-object-impl.h: Add the view as parameter to the virtual
method set_active.
* src/sheet-object-container.c:
(sheet_object_container_set_active): New. Overrides above virtual and
handles (de)activation of view frames.
* src/sheet-control-gui-priv.h: Do not let the SheetControlGUI know
about an active_object_frame - remove this variable.
* src/sheet-control-gui.[c,h]:
(scg_activate_view_frame),
(scg_deactivate_view_frame): Removed. Now handled by the objects
themselves through set_active virtual method.
(scg_object_stop_editing),
(scg_mode_edit_object): Adjust parameters for virtual method set_active.
2001-07-18 Zbigniew Chyla <cyba@gnome.pl>
* src/dialogs/dialog-function-wizard.c (formula_guru_init_args): Use
......
......@@ -25,7 +25,6 @@ struct _SheetControlGUI {
SheetObject *drag_object;
double object_coords [4];
double last_x, last_y;
void *active_object_frame; /* FIXME remove this */
GnomeCanvasItem *control_points [9]; /* Control points for the current item */
/* Keep track of a rangeselector state */
......
......@@ -41,10 +41,6 @@
#include "sheet-merge.h"
#include "ranges.h"
#ifdef ENABLE_BONOBO
#include <bonobo/bonobo-view-frame.h>
#endif
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#include <gal/util/e-util.h>
......@@ -576,7 +572,6 @@ scg_init (SheetControlGUI *scg)
scg->new_object = NULL;
scg->current_object = NULL;
scg->active_object_frame = NULL;
scg->drag_object = NULL;
}
......@@ -1457,15 +1452,15 @@ scg_object_destroy_control_points (SheetControlGUI *scg)
static void
scg_object_stop_editing (SheetControlGUI *scg, SheetObject *so)
{
GtkObject *view;
if (so != NULL) {
if (so == scg->current_object) {
view = sheet_object_get_view (so, scg);
scg_object_destroy_control_points (scg);
scg->current_object = NULL;
if (SO_CLASS (so)->set_active != NULL)
SO_CLASS (so)->set_active (so, FALSE);
#ifdef ENABLE_BONOBO
scg_deactivate_view_frame (scg);
#endif
SO_CLASS (so)->set_active (so, view, FALSE);
}
}
}
......@@ -1517,14 +1512,15 @@ scg_mode_edit (SheetControl *sc)
void
scg_mode_edit_object (SheetControlGUI *scg, SheetObject *so)
{
GtkObject *view = sheet_object_get_view (so, scg);
GtkObject *view;
g_return_if_fail (IS_SHEET_OBJECT (so));
if (scg_mode_clear (scg)) {
view = sheet_object_get_view (so, scg);
scg->current_object = so;
if (SO_CLASS (so)->set_active != NULL)
SO_CLASS (so)->set_active (so, TRUE);
SO_CLASS (so)->set_active (so, view, TRUE);
scg_cursor_visible (scg, FALSE);
scg_object_update_bbox (scg, so, GNOME_CANVAS_ITEM(view), NULL);
}
......@@ -2678,34 +2674,6 @@ scg_colrow_resize_move (SheetControlGUI *scg,
gnumeric_pane_colrow_resize_move (scg->pane + i, is_cols, pos);
}
#ifdef ENABLE_BONOBO
void
scg_activate_view_frame (SheetControlGUI *scg, BonoboViewFrame *view_frame)
{
g_return_if_fail (IS_SHEET_CONTROL_GUI (scg));
/* Deactivate activated frame (if any) */
scg_deactivate_view_frame (scg);
/* Activate given frame */
bonobo_view_frame_view_activate (view_frame);
bonobo_view_frame_set_covered (view_frame, FALSE);
scg->active_object_frame = view_frame;
}
void
scg_deactivate_view_frame (SheetControlGUI *scg)
{
g_return_if_fail (IS_SHEET_CONTROL_GUI (scg));
if (scg->active_object_frame) {
bonobo_view_frame_view_deactivate (scg->active_object_frame);
bonobo_view_frame_set_covered (scg->active_object_frame, TRUE);
scg->active_object_frame = NULL;
}
}
#endif
static void
scg_class_init (GtkObjectClass *object_class)
{
......
......@@ -3,9 +3,6 @@
#include "gui-gnumeric.h"
#include "sheet-control.h"
#ifdef ENABLE_BONOBO
#include <bonobo/bonobo-view-frame.h>
#endif
#define SHEET_CONTROL_GUI_TYPE (sheet_control_gui_get_type ())
#define SHEET_CONTROL_GUI(obj) (GTK_CHECK_CAST((obj), SHEET_CONTROL_GUI_TYPE, SheetControlGUI))
......@@ -72,11 +69,6 @@ void scg_colrow_resize_start (SheetControlGUI *scg,
gboolean is_cols, int resize_first);
void scg_colrow_resize_move (SheetControlGUI *scg,
gboolean is_cols, int resize_last);
#ifdef ENABLE_BONOBO
void scg_activate_view_frame (SheetControlGUI *scg,
BonoboViewFrame *view_frame);
void scg_deactivate_view_frame (SheetControlGUI *scg);
#endif
/* DO NOT USE THIS WITHOUT ALOT OF THOUGHT */
GnumericSheet *scg_pane (SheetControlGUI *scg, int pane);
......
......@@ -36,7 +36,6 @@ cb_user_activation_request (BonoboViewFrame *view_frame, GtkObject *so_view)
SheetControlGUI *scg = sheet_object_view_control (so_view);
SheetObject *so = sheet_object_view_obj (so_view);
scg_activate_view_frame (scg, view_frame);
scg_mode_edit_object (scg, so);
return FALSE;
......@@ -107,6 +106,33 @@ sheet_object_container_update_bounds (SheetObject *so, GtkObject *view,
NULL);
}
static void
sheet_object_container_set_active (SheetObject *so, GtkObject *view,
gboolean active)
{
BonoboViewFrame *view_frame;
g_return_if_fail (IS_SHEET_OBJECT_CONTAINER (so));
/*
* We need to ref the view_frame on activation because the view
* can get destroyed. Sure, we will be called during destruction, but
* at this point, the view_frame will already be gone and we won't
* be able to correcly deactivate.
*/
view_frame = gtk_object_get_data (GTK_OBJECT (view), "view_frame");
if (active) {
bonobo_object_ref (BONOBO_OBJECT (view_frame));
bonobo_view_frame_view_activate (view_frame);
bonobo_view_frame_set_covered (view_frame, FALSE);
} else {
bonobo_view_frame_view_deactivate (view_frame);
bonobo_view_frame_set_covered (view_frame, TRUE);
bonobo_object_unref (BONOBO_OBJECT (view_frame));
}
}
static void
sheet_object_container_class_init (GtkObjectClass *object_class)
{
......@@ -121,6 +147,7 @@ sheet_object_container_class_init (GtkObjectClass *object_class)
so_class = SHEET_OBJECT_CLASS (object_class);
so_class->new_view = sheet_object_container_new_view;
so_class->update_bounds = sheet_object_container_update_bounds;
so_class->set_active = sheet_object_container_set_active;
}
SheetObject *
......
......@@ -54,6 +54,7 @@ typedef struct {
GtkObject *obj_view,
SheetControlGUI *s_control);
void (*set_active) (SheetObject *so,
GtkObject *obj_view,
gboolean val);
gboolean (*read_xml) (SheetObject *so,
XmlParseContext const *ctxt,
......
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