Commit 7f477ebb authored by Tristan Van Berkom's avatar Tristan Van Berkom

Added new GladeFixedManager code to handle GtkFixed and GtkLayout in a


	* src/Makefile.am, src/glade-accumulators.[ch], glade-fixed-manager.[ch]:
	  Added new GladeFixedManager code to handle GtkFixed and GtkLayout in a
	  sexier fashion (and in a way that allows any GtkContainer to subscribe
	  to this service through the plugin).

	* src/glade-builtins.c: Fixed date typo

	* src/glade-command.[ch]:
	    - glade_command_set_properties () added to set multiple properties at
	      the same time plus allowing to specify the old value that it changed
	      from (this is usefull for drag & resize undo events).

	    - Added a g_object_ref to the properties in set property commands

	    - Create/Delete/Cut/Paste code to now use GladeFixedManager where appropriate

	    - Now when we "Cut" a widget, we save a copy of its packing properties for
	      future undo's (if it was pasted in another container and "undo" a couple
	      times, this becomes nescisary).

	* src/glade-cursor.[ch]: Added all the new cursor types needed
	  for drag/resize events.

	* src/glade-editor.[ch]: Handle property signals better, added
	  signal handler for "value-changed" & "notify::enabled" signals to reload
	  & update property values, removed alot of redundant property reloading code.

	* src/glade-gtk.c: Remove the old clunky GtkFixed handling code and replaced
	  it with a call to glade_fixed_manager_new () (also implemented fixed manager
	  for GtkLayout).

	* src/glade-marshallers.list: Added new marshallers

	* src/glade-project-window.c, main.c: Removed all those includes and
	  replaced with #include "glade.h".

	* src/glade-property.[ch]: Fixed broken types from when I played with headers,
	  now the forward declarations are back. (also changed CINFO for the more popular
	  alternative; KLASS).

	* src/glade-utils.c: glade_util_paste_clipboard () now is GladeFixedManager aware.

	* src/glade-widget.[ch]:
	    - use glade-fixed-manager to add children when loading glade files
	    - notify manager of handled mouse events (this is a hack that should
	      go, once we handle the streamlining of button-press-events on GladeWidget's
	      properly).
	    - fixed broken types.
	    - Added glade_widget[_pack]_property_set_enabled()
	    - Added some doc.
	    - Made glade_widget_retrieve_from_position() public.

	* src/glade.h: Added headers.

	* widgets/gtk+.xml: GladeFixedManager on GtkFixed & GtkLayout.
parent 603141f5
2005-08-09 Tristan Van Berkom <tvb@gnome.org>
* src/Makefile.am, src/glade-accumulators.[ch], glade-fixed-manager.[ch]:
Added new GladeFixedManager code to handle GtkFixed and GtkLayout in a
sexier fashion (and in a way that allows any GtkContainer to subscribe
to this service through the plugin).
* src/glade-builtins.c: Fixed date typo
* src/glade-command.[ch]:
- glade_command_set_properties () added to set multiple properties at
the same time plus allowing to specify the old value that it changed
from (this is usefull for drag & resize undo events).
- Added a g_object_ref to the properties in set property commands
- Create/Delete/Cut/Paste code to now use GladeFixedManager where appropriate
- Now when we "Cut" a widget, we save a copy of its packing properties for
future undo's (if it was pasted in another container and "undo" a couple
times, this becomes nescisary).
* src/glade-cursor.[ch]: Added all the new cursor types needed
for drag/resize events.
* src/glade-editor.[ch]: Handle property signals better, added
signal handler for "value-changed" & "notify::enabled" signals to reload
& update property values, removed alot of redundant property reloading code.
* src/glade-gtk.c: Remove the old clunky GtkFixed handling code and replaced
it with a call to glade_fixed_manager_new () (also implemented fixed manager
for GtkLayout).
* src/glade-marshallers.list: Added new marshallers
* src/glade-project-window.c, main.c: Removed all those includes and
replaced with #include "glade.h".
* src/glade-property.[ch]: Fixed broken types from when I played with headers,
now the forward declarations are back. (also changed CINFO for the more popular
alternative; KLASS).
* src/glade-utils.c: glade_util_paste_clipboard () now is GladeFixedManager aware.
* src/glade-widget.[ch]:
- use glade-fixed-manager to add children when loading glade files
- notify manager of handled mouse events (this is a hack that should
go, once we handle the streamlining of button-press-events on GladeWidget's
properly).
- fixed broken types.
- Added glade_widget[_pack]_property_set_enabled()
- Added some doc.
- Made glade_widget_retrieve_from_position() public.
* src/glade.h: Added headers.
* widgets/gtk+.xml: GladeFixedManager on GtkFixed & GtkLayout.
2005-08-01 Naba Kumar <naba@gnome.org>
* src/Makefile.am: Fixed a typo where it should be glade-builtins.h instead
......
......@@ -57,8 +57,10 @@ libgladeui_1_la_SOURCES = \
glade-keys-dialog.c \
glade-id-allocator.c \
glade-marshallers.c \
glade-accumulators.c \
glade-parser.c \
glade-builtins.c \
glade-fixed-manager.c \
glade-app.c
libgladeui_1_la_CFLAGS = -DINSIDE_LIBGLADEUI $(AM_CFLAGS)
......@@ -93,9 +95,11 @@ libgladeuiinclude_HEADERS = \
glade-keys-dialog.h \
glade-id-allocator.h \
glade-marshallers.h \
glade-accumulators.h \
glade-parser.h \
glade-app.h \
glade-builtins.h \
glade-fixed-manager.h \
fixed_bg.xpm
pkgconfigdir = $(libdir)/pkgconfig
......
......@@ -2,7 +2,7 @@
/*
* glade-clipboard.c - An object for handling Cut/Copy/Paste.
*
* Copyright (C) 2001 The GNOME Foundation.
* Copyright (C) 2005 The GNOME Foundation.
*
* Author(s):
* Tristan Van Berkom <tvb@gnome.org>
......
......@@ -41,11 +41,13 @@
#include "glade-clipboard.h"
#include "glade-signal.h"
#include "glade-app.h"
#include "glade-fixed-manager.h"
typedef struct {
GladeWidget *widget;
GladeWidget *parent;
GladePlaceholder *placeholder;
GList *pack_props;
} CommandData;
static GObjectClass* parent_class = NULL;
......@@ -283,10 +285,14 @@ glade_command_push_undo (GladeProject *project, GladeCommand *cmd)
/* create a new GladeCommandSetProperty class. Objects of this class will
* encapsulate a "set property" operation */
typedef struct {
GladeCommand parent;
GladeProperty *property;
GValue *arg_value;
GValue *new_value;
GValue *old_value;
} SetPropData;
typedef struct {
GladeCommand parent;
GList *sdata;
} GladeCommandSetProperty;
/* standard macros */
......@@ -312,20 +318,33 @@ static gboolean
glade_command_set_property_execute (GladeCommand *cmd)
{
GladeCommandSetProperty* me = (GladeCommandSetProperty*) cmd;
GValue new_value = { 0, };
GList *l;
g_return_val_if_fail (me != NULL, FALSE);
g_value_init (&new_value, G_VALUE_TYPE (me->arg_value));
g_value_copy (me->arg_value, &new_value);
for (l = me->sdata; l; l = l->next)
{
GValue new_value = { 0, };
SetPropData *sdata = l->data;
/* store the current value for undo */
g_value_copy (me->property->value, me->arg_value);
g_value_init (&new_value, G_VALUE_TYPE (sdata->new_value));
g_value_copy (sdata->new_value, &new_value);
/* store the current value for undo */
if (sdata->old_value)
{
g_value_copy (sdata->old_value, sdata->new_value);
g_value_unset (sdata->old_value);
sdata->old_value = (g_free (sdata->old_value), NULL);
}
else
g_value_copy (sdata->property->value, sdata->new_value);
glade_property_set_value (me->property, &new_value);
glade_property_set_value (sdata->property, &new_value);
g_value_unset (&new_value);
g_value_unset (&new_value);
}
return TRUE;
}
......@@ -333,13 +352,28 @@ static void
glade_command_set_property_finalize (GObject *obj)
{
GladeCommandSetProperty *me;
GList *l;
me = GLADE_COMMAND_SET_PROPERTY (obj);
if (G_VALUE_TYPE (me->arg_value) != 0)
g_value_unset (me->arg_value);
g_free (me->arg_value);
for (l = me->sdata; l; l = l->next)
{
SetPropData *sdata = l->data;
if (sdata->property)
g_object_unref (G_OBJECT (sdata->property));
if (sdata->old_value)
{
if (G_VALUE_TYPE (sdata->old_value) != 0)
g_value_unset (sdata->old_value);
g_free (sdata->old_value);
}
if (G_VALUE_TYPE (sdata->new_value) != 0)
g_value_unset (sdata->new_value);
g_free (sdata->new_value);
}
glade_command_finalize (obj);
}
......@@ -354,9 +388,11 @@ glade_command_set_property_unifies (GladeCommand *this, GladeCommand *other)
cmd1 = (GladeCommandSetProperty*) this;
cmd2 = (GladeCommandSetProperty*) other;
return (cmd1->property == cmd2->property);
return (g_list_length (cmd1->sdata) == 1 &&
g_list_length (cmd2->sdata) == 1 &&
((SetPropData *)cmd1->sdata->data)->property ==
((SetPropData *)cmd2->sdata->data)->property);
}
return FALSE;
}
......@@ -375,53 +411,108 @@ glade_command_set_property_collapse (GladeCommand *this, GladeCommand *other)
#define MAX_UNDO_MENU_ITEM_VALUE_LEN 10
static gchar *
glade_command_set_property_description (GladeCommandSetProperty *me)
{
SetPropData *sdata;
gchar *description = NULL;
gchar *value_name;
g_assert (me->sdata);
if (g_list_length (me->sdata) > 1)
description = g_strdup_printf (_("Setting multiple properties"));
else
{
sdata = me->sdata->data;
value_name = glade_property_class_make_string_from_gvalue (sdata->property->class,
sdata->new_value);
if (!value_name || strlen (value_name) > MAX_UNDO_MENU_ITEM_VALUE_LEN
|| strchr (value_name, '_')) {
description = g_strdup_printf (_("Setting %s of %s"),
sdata->property->class->name,
sdata->property->widget->name);
} else {
description = g_strdup_printf (_("Setting %s of %s to %s"),
sdata->property->class->name,
sdata->property->widget->name, value_name);
}
g_free (value_name);
}
return description;
}
void
glade_command_set_property (GladeProperty *property, const GValue* pvalue)
glade_command_set_properties (GladeProperty *property, const GValue *old_value, const GValue *new_value, ...)
{
GladeCommandSetProperty *me;
GladeCommand *cmd;
GladeWidget *gwidget;
gchar *value_name;
GladeCommand *cmd;
SetPropData *sdata;
GladeProperty *prop;
GValue *ovalue, *nvalue;
va_list vl;
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (G_IS_VALUE (pvalue));
g_return_if_fail (G_IS_VALUE (old_value));
g_return_if_fail (G_IS_VALUE (new_value));
g_return_if_fail (G_VALUE_TYPE (new_value) == G_VALUE_TYPE (old_value));
me = (GladeCommandSetProperty*) g_object_new (GLADE_COMMAND_SET_PROPERTY_TYPE, NULL);
cmd = (GladeCommand*) me;
gwidget = GLADE_WIDGET (property->widget);
g_return_if_fail (GLADE_IS_WIDGET (gwidget));
me->property = property;
me->arg_value = g_new0 (GValue, 1);
g_value_init (me->arg_value, G_VALUE_TYPE (pvalue));
g_value_copy (pvalue, me->arg_value);
value_name = glade_property_class_make_string_from_gvalue (property->class, pvalue);
if (!value_name || strlen (value_name) > MAX_UNDO_MENU_ITEM_VALUE_LEN
|| strchr (value_name, '_')) {
cmd->description = g_strdup_printf (_("Setting %s of %s"),
property->class->name,
gwidget->name);
} else {
cmd->description = g_strdup_printf (_("Setting %s of %s to %s"),
property->class->name,
gwidget->name, value_name);
}
cmd = GLADE_COMMAND (me);
/* Add first set */
sdata = g_new (SetPropData, 1);
sdata->property = g_object_ref (G_OBJECT (property));
sdata->old_value = g_new0 (GValue, 1);
sdata->new_value = g_new0 (GValue, 1);
g_value_init (sdata->old_value, G_VALUE_TYPE (old_value));
g_value_init (sdata->new_value, G_VALUE_TYPE (new_value));
g_value_copy (old_value, sdata->old_value);
g_value_copy (new_value, sdata->new_value);
me->sdata = g_list_prepend (me->sdata, sdata);
va_start (vl, new_value);
while ((prop = va_arg (vl, GladeProperty *)) != NULL)
{
ovalue = va_arg (vl, GValue *);
nvalue = va_arg (vl, GValue *);
g_assert (GLADE_IS_PROPERTY (prop));
g_assert (G_IS_VALUE (ovalue));
g_assert (G_IS_VALUE (nvalue));
sdata = g_new (SetPropData, 1);
sdata->property = g_object_ref (G_OBJECT (prop));
sdata->old_value = g_new0 (GValue, 1);
sdata->new_value = g_new0 (GValue, 1);
g_value_init (sdata->old_value, G_VALUE_TYPE (ovalue));
g_value_init (sdata->new_value, G_VALUE_TYPE (nvalue));
g_value_copy (ovalue, sdata->old_value);
g_value_copy (nvalue, sdata->new_value);
me->sdata = g_list_prepend (me->sdata, sdata);
}
va_end (vl);
cmd->description = glade_command_set_property_description (me);
g_assert (cmd->description);
g_free (value_name);
/* Push onto undo stack only if it executes successfully. */
if (glade_command_set_property_execute (GLADE_COMMAND (me)))
glade_command_push_undo (GLADE_PROJECT (gwidget->project), GLADE_COMMAND (me));
glade_command_push_undo (GLADE_PROJECT (property->widget->project),
GLADE_COMMAND (me));
else
/* No leaks on my shift! */
g_object_unref (G_OBJECT (me));
}
void
glade_command_set_property (GladeProperty *property, const GValue* pvalue)
{
glade_command_set_properties (property, property->value, pvalue, NULL);
}
/**************************************************/
/******* GLADE_COMMAND_SET_NAME *******/
/**************************************************/
......@@ -580,7 +671,7 @@ static gboolean
glade_command_create_execute (GladeCommandCreateDelete *me)
{
GladeClipboard *clipboard = glade_default_app_get_clipboard();
CommandData *cdata;
CommandData *cdata = NULL;
GList *list, *wlist = NULL;
glade_util_clear_selection ();
......@@ -598,6 +689,11 @@ glade_command_create_execute (GladeCommandCreateDelete *me)
G_OBJECT (cdata->placeholder),
cdata->widget->object);
}
else if (cdata->parent->manager != NULL)
{
glade_fixed_manager_add_child
(cdata->parent->manager, cdata->widget, FALSE);
}
else
{
glade_widget_class_container_add
......@@ -628,7 +724,7 @@ glade_command_create_execute (GladeCommandCreateDelete *me)
g_list_free (wlist);
}
if (GTK_IS_WIDGET (cdata->widget->object))
if (cdata && GTK_IS_WIDGET (cdata->widget->object))
gtk_widget_show_all (GTK_WIDGET (cdata->widget->object));
return TRUE;
......@@ -653,6 +749,9 @@ glade_command_delete_execute (GladeCommandCreateDelete *me)
(cdata->parent, cdata->widget->object,
G_OBJECT (cdata->placeholder));
}
else if (cdata->parent->manager != NULL)
glade_fixed_manager_remove_child
(cdata->parent->manager, cdata->widget);
else
glade_widget_class_container_remove (cdata->parent->widget_class,
cdata->parent->object,
......@@ -752,7 +851,7 @@ glade_command_delete (GList *widgets)
{
GladeClipboard *clipboard = glade_default_app_get_clipboard();
GladeCommandCreateDelete *me;
GladeWidget *widget;
GladeWidget *widget = NULL;
CommandData *cdata;
GList *list;
......@@ -784,7 +883,9 @@ glade_command_delete (GList *widgets)
cdata->widget = g_object_ref (G_OBJECT (widget));
cdata->parent = glade_widget_get_parent (widget);
/* !manager here */
if (cdata->parent != NULL &&
cdata->parent->manager == NULL &&
glade_util_gtkcontainer_relation
(cdata->parent, cdata->widget))
{
......@@ -804,6 +905,7 @@ glade_command_delete (GList *widgets)
GLADE_COMMAND (me)->description =
g_strdup_printf (_("Delete multiple"));
g_assert (widget);
if (glade_command_create_delete_execute (GLADE_COMMAND (me)))
glade_command_push_undo (GLADE_PROJECT (widget->project),
GLADE_COMMAND (me));
......@@ -831,7 +933,7 @@ glade_command_create (GladeWidgetClass *class,
GladeCommandCreateDelete *me;
CommandData *cdata;
GladeWidget *widget;
g_return_val_if_fail (class != NULL, NULL);
g_return_val_if_fail (GLADE_IS_PROJECT (project), NULL);
if (g_type_is_a (class->type, GTK_TYPE_WINDOW) == FALSE)
......@@ -847,13 +949,17 @@ glade_command_create (GladeWidgetClass *class,
me->widgets = g_list_append (me->widgets, cdata);
if (parent && parent->manager != NULL)
widget = glade_fixed_manager_create_child (parent->manager, class);
else
widget = glade_widget_new (parent, class, project);
/* widget may be null, e.g. the user clicked cancel on a query */
if ((widget = glade_widget_new (parent, class, (gpointer)project)) == NULL)
if ((cdata->widget = widget) == NULL)
{
g_object_unref (G_OBJECT (me));
return NULL;
}
cdata->widget = widget;
GLADE_COMMAND (me)->description =
g_strdup_printf (_("Create %s"),
......@@ -885,6 +991,7 @@ typedef struct {
GList *widgets;
GladeCutCopyPasteType type;
gboolean from_clipboard;
gboolean initial_paste;
} GladeCommandCutCopyPaste;
......@@ -900,7 +1007,7 @@ glade_command_paste_execute (GladeCommandCutCopyPaste *me)
{
GladeProject *project = glade_default_app_get_active_project ();
CommandData *cdata;
GList *list, *remove = NULL;
GList *list, *remove = NULL, *l;
if (project && me->widgets)
{
......@@ -922,6 +1029,13 @@ glade_command_paste_execute (GladeCommandCutCopyPaste *me)
(cdata->parent,
G_OBJECT (cdata->placeholder),
cdata->widget->object);
else if (cdata->parent->manager != NULL)
{
/* Paste at mouse position only once */
glade_fixed_manager_add_child (cdata->parent->manager, cdata->widget,
me->initial_paste == FALSE);
me->initial_paste = TRUE;
}
else
{
glade_widget_class_container_add
......@@ -931,6 +1045,20 @@ glade_command_paste_execute (GladeCommandCutCopyPaste *me)
glade_widget_set_parent (cdata->widget,
cdata->parent);
}
/* Now that we've added, apply any packing props if nescisary. */
for (l = cdata->pack_props; l; l = l->next)
{
GValue value = { 0, };
GladeProperty *saved_prop = l->data;
GladeProperty *widget_prop =
glade_widget_get_pack_property (cdata->widget,
saved_prop->class->id);
glade_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
g_value_unset (&value);
}
}
/* Toplevels get pasted to the active project */
......@@ -979,6 +1107,9 @@ glade_command_cut_execute (GladeCommandCutCopyPaste *me)
(cdata->parent,
cdata->widget->object,
G_OBJECT (cdata->placeholder));
else if (cdata->parent->manager != NULL)
glade_fixed_manager_remove_child
(cdata->parent->manager, cdata->widget);
else
glade_widget_class_container_remove
(cdata->parent->widget_class,
......@@ -1095,7 +1226,11 @@ glade_command_cut_copy_paste_finalize (GObject *obj)
g_object_unref (cdata->widget);
if (cdata->placeholder)
g_object_unref (cdata->placeholder);
if (cdata->pack_props)
{
g_list_foreach (cdata->pack_props, (GFunc)g_object_unref, NULL);
g_list_free (cdata->pack_props);
}
g_free (cdata);
}
g_list_free (me->widgets);
......@@ -1124,7 +1259,7 @@ glade_command_cut_copy_paste_common (GList *widgets,
CommandData *cdata;
GladeWidget *widget = NULL, *child;
GList *l, *list, *children, *placeholders = NULL;
gchar *fmt;
gchar *fmt = NULL;
g_return_if_fail (widgets && widgets->data);
......@@ -1177,7 +1312,8 @@ glade_command_cut_copy_paste_common (GList *widgets,
fmt = _("Paste %s");
break;
}
g_assert (fmt);
widget = GLADE_WIDGET (widgets->data);
/* And now we feel safe enough to go on and create */
......@@ -1213,7 +1349,7 @@ glade_command_cut_copy_paste_common (GList *widgets,
/* Placeholder */
if (type == GLADE_CUT)
{
if (cdata->parent &&
if (cdata->parent && cdata->parent->manager == NULL &&
glade_util_gtkcontainer_relation
(cdata->parent, cdata->widget))
{
......@@ -1230,7 +1366,8 @@ glade_command_cut_copy_paste_common (GList *widgets,
{
cdata->placeholder = g_object_ref (placeholder);
}
else if (type == GLADE_PASTE &&
else if (type == GLADE_PASTE && cdata->parent &&
cdata->parent->manager == NULL &&
glade_util_gtkcontainer_relation (cdata->parent, widget))
{
if ((children = glade_widget_class_container_get_children
......@@ -1253,9 +1390,26 @@ glade_command_cut_copy_paste_common (GList *widgets,
}
}
/* Save a copy of packing properties on cut so we can
* re-apply them at undo time.
*/
if (type == GLADE_CUT)
{
for (l = cdata->widget->packing_properties; l; l = l->next)
cdata->pack_props =
g_list_prepend (cdata->pack_props,
glade_property_dup (GLADE_PROPERTY (l->data),
cdata->widget));
}
me->widgets = g_list_prepend (me->widgets, cdata);
}
if (type == GLADE_CUT)
me->initial_paste = TRUE;
else
me->initial_paste = FALSE;
/*
* Push it onto the undo stack only on success
*/
......
......@@ -3,6 +3,11 @@
#define __GLADE_COMMAND_H__
#include <glib-object.h>
#include "glade-placeholder.h"
#include "glade-widget.h"
#include "glade-signal.h"
#include "glade-property.h"
#include "glade-project.h"
G_BEGIN_DECLS
......@@ -44,6 +49,10 @@ LIBGLADEUI_API void glade_command_undo (GladeProject *proj
LIBGLADEUI_API void glade_command_redo (GladeProject *project);
LIBGLADEUI_API void glade_command_set_property (GladeProperty *property, const GValue *value);
LIBGLADEUI_API void glade_command_set_properties(GladeProperty *property,
const GValue *old_value,
const GValue *new_value, ...);
LIBGLADEUI_API void glade_command_set_name (GladeWidget *glade_widget, const gchar *name);
LIBGLADEUI_API void glade_command_delete (GList *widgets);
......
......@@ -42,6 +42,33 @@ glade_cursor_set (GdkWindow *window, GladeCursorType type)
case GLADE_CURSOR_ADD_WIDGET:
gdk_window_set_cursor (window, cursor->add_widget);
break;
case GLADE_CURSOR_RESIZE_TOP_LEFT:
gdk_window_set_cursor (window, cursor->resize_top_left);
break;
case GLADE_CURSOR_RESIZE_TOP_RIGHT:
gdk_window_set_cursor (window, cursor->resize_top_right);
break;
case GLADE_CURSOR_RESIZE_BOTTOM_LEFT:
gdk_window_set_cursor (window, cursor->resize_bottom_left);
break;
case GLADE_CURSOR_RESIZE_BOTTOM_RIGHT:
gdk_window_set_cursor (window, cursor->resize_bottom_right);
break;
case GLADE_CURSOR_RESIZE_LEFT:
gdk_window_set_cursor (window, cursor->resize_left);
break;
case GLADE_CURSOR_RESIZE_RIGHT:
gdk_window_set_cursor (window, cursor->resize_right);
break;
case GLADE_CURSOR_RESIZE_TOP:
gdk_window_set_cursor (window, cursor->resize_top);
break;
case GLADE_CURSOR_RESIZE_BOTTOM:
gdk_window_set_cursor (window, cursor->resize_bottom);
break;
case GLADE_CURSOR_DRAG:
gdk_window_set_cursor (window, cursor->drag);
break;
default:
break;
}
......@@ -58,6 +85,16 @@ glade_cursor_init (void)
{
cursor = g_new0 (GladeCursor, 1);
cursor->selector = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
cursor->add_widget = gdk_cursor_new (GDK_PLUS);
cursor->selector = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
cursor->add_widget = gdk_cursor_new (GDK_PLUS);
cursor->resize_top_left = gdk_cursor_new (GDK_TOP_LEFT_CORNER);
cursor->resize_top_right = gdk_cursor_new (GDK_TOP_RIGHT_CORNER);
cursor->resize_bottom_left = gdk_cursor_new (GDK_BOTTOM_LEFT_CORNER);
cursor->resize_bottom_right = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER);
cursor->resize_left = gdk_cursor_new (GDK_LEFT_SIDE);
cursor->resize_right = gdk_cursor_new (GDK_RIGHT_SIDE);
cursor->resize_top = gdk_cursor_new (GDK_TOP_SIDE);
cursor->resize_bottom = gdk_cursor_new (GDK_BOTTOM_SIDE);
cursor->drag = gdk_cursor_new (GDK_FLEUR);
}
......@@ -10,22 +10,38 @@ G_BEGIN_DECLS
* with it's enumed value to set the window cursor.
*/
/* Has a pointer to the loaded GdkCursors. It is loaded when _init
* is called
*/
typedef struct _GladeCursor {
GdkCursor *selector;
GdkCursor *add_widget;
GdkCursor *resize_top_left;
GdkCursor *resize_top_right;
GdkCursor *resize_bottom_left;
GdkCursor *resize_bottom_right;
GdkCursor *resize_left;
GdkCursor *resize_right;
GdkCursor *resize_top;
GdkCursor *resize_bottom;
GdkCursor *drag;
} GladeCursor;
/* Enumed values for each of the cursors for GladeCursor. For every
* GdkCursor above there should be a enum here
*/
typedef enum {
GLADE_CURSOR_SELECTOR,
GLADE_CURSOR_ADD_WIDGET,
GLADE_CURSOR_RESIZE_TOP_LEFT,
GLADE_CURSOR_RESIZE_TOP_RIGHT,
GLADE_CURSOR_RESIZE_BOTTOM_LEFT,
GLADE_CURSOR_RESIZE_BOTTOM_RIGHT,
GLADE_CURSOR_RESIZE_LEFT,
GLADE_CURSOR_RESIZE_RIGHT,
GLADE_CURSOR_RESIZE_TOP,
GLADE_CURSOR_RESIZE_BOTTOM,
GLADE_CURSOR_DRAG
} GladeCursorType;
void glade_cursor_init (void);
......
......@@ -216,8 +216,6 @@ glade_editor_property_changed_text (GtkWidget *entry,
property->from_query_dialog);
g_free (text);
glade_editor_property_load (property, GLADE_WIDGET (property->property->widget));
}
static gboolean
......@@ -255,8 +253,6 @@ glade_editor_text_view_focus_out (GtkTextView *view,
property->from_query_dialog);
g_free (text);
glade_editor_property_load (property, GLADE_WIDGET (property->property->widget));
return FALSE;
}
......@@ -287,8 +283,6 @@ glade_editor_property_changed_enum (GtkWidget *menu_item,
glade_command_set_property (gproperty, &val);
g_value_unset (&val);
glade_editor_property_load (property, GLADE_WIDGET (property->property->widget));
}
static void
......@@ -377,8 +371,6 @@ glade_editor_property_changed_numeric (GtkWidget *spin,
glade_command_set_property (property->property, &val);
g_value_unset (&val);
glade_editor_property_load (property, GLADE_WIDGET (property->property->widget));
}
static void
......@@ -408,8 +400,6 @@ glade_editor_property_changed_boolean (GtkWidget *button,
glade_command_set_property (property->property, &val);
g_value_unset (&val);
glade_editor_property_load (property, GLADE_WIDGET (property->property->widget));
}
static void
......@@ -442,7 +432,6 @@ glade_editor_property_changed_unichar (GtkWidget *entry,
glade_command_set_property (property->property, &val);