diff options
-rw-r--r-- | ChangeLog | 51 | ||||
-rw-r--r-- | configure.in | 61 | ||||
-rw-r--r-- | src/boards/canvas.c | 1556 | ||||
-rw-r--r-- | src/boards/click_on_letter.c | 4 | ||||
-rw-r--r-- | src/boards/colors.c | 4 | ||||
-rw-r--r-- | src/boards/memory.c | 4 | ||||
-rw-r--r-- | src/boards/py-mod-sound.c | 4 | ||||
-rw-r--r-- | src/gcompris/Makefile.am | 6 | ||||
-rw-r--r-- | src/gcompris/bonus.c | 4 | ||||
-rw-r--r-- | src/gcompris/config.c | 9 | ||||
-rw-r--r-- | src/gcompris/sdlplayer.c | 218 | ||||
-rw-r--r-- | src/gcompris/soundutil.c | 367 | ||||
-rw-r--r-- | src/gcompris/soundutil.h | 29 |
13 files changed, 1203 insertions, 1114 deletions
@@ -1,3 +1,54 @@ +2007-05-16 Bruno coudoin <bruno.coudoin@free.fr> + + Based on the work of Terje Bergström <terje on terje point fi> + replaced sdl_mixer by gstreamer. + initial commit. at least, the synchrone mode with callback is not implemented + regular feature is in place, there is no more threads in this code. + there is a need for cleanup. + + * configure.in: + * src/boards/canvas.c: (pygdk_rectangle_from_pyobject), + (_wrap_gnome_canvas_root), + (_wrap_gnome_canvas_set_pixels_per_unit), + (_wrap_gnome_canvas_set_scroll_region), + (_wrap_gnome_canvas_get_center_scroll_region), + (_wrap_gnome_canvas_set_center_scroll_region), + (_wrap_gnome_canvas_scroll_to), (_wrap_gnome_canvas_update_now), + (_wrap_gnome_canvas_get_item_at), (_wrap_gnome_canvas_get_color), + (_wrap_gnome_canvas_get_color_pixel), + (_wrap_gnome_canvas_set_dither), (_wrap_gnome_canvas_get_dither), + (_wrap_gnome_canvas_item_move), (_wrap_gnome_canvas_item_raise), + (_wrap_gnome_canvas_item_lower), + (_wrap_gnome_canvas_item_raise_to_top), + (_wrap_gnome_canvas_item_lower_to_bottom), + (_wrap_gnome_canvas_item_show), (_wrap_gnome_canvas_item_hide), + (_wrap_gnome_canvas_item_reparent), + (_wrap_gnome_canvas_item_grab_focus), + (_wrap_gnome_canvas_rich_text_cut_clipboard), + (_wrap_gnome_canvas_rich_text_copy_clipboard), + (_wrap_gnome_canvas_rich_text_paste_clipboard), + (_wrap_gnome_canvas_rich_text_set_buffer), + (_wrap_gnome_canvas_rich_text_get_buffer), + (_wrap_gnome_canvas_rich_text_get_iter_location), + (_wrap_gnome_canvas_rich_text_get_iter_at_location), + (pycanvas_register_classes): + * src/boards/click_on_letter.c: (start_board), (end_board): + * src/boards/colors.c: (start_board), (end_board): + * src/boards/memory.c: (start_board), (end_board): + * src/boards/py-mod-sound.c: (py_gc_sound_pause), + (py_gc_sound_resume): + * src/gcompris/Makefile.am: + * src/gcompris/bonus.c: (end_gc_bonus_end_display), (end_bonus): + * src/gcompris/config.c: (item_event_ok): + * src/gcompris/soundutil.c: (gc_sound_init), (fx_bus), (bg_bus), + (gc_sound_close), (gc_sound_bg_close), (gc_sound_fx_close), + (gc_sound_bg_reopen), (gc_sound_fx_reopen), (gc_sound_reopen), + (gc_sound_bg_pause), (gc_sound_bg_resume), (gc_sound_fx_pause), + (gc_sound_fx_resume), (bg_build_music_list), (bg_play), (fx_play), + (get_next_sound_to_play), (gc_sound_play_ogg_list): + * src/gcompris/soundutil.h: + * src/gcompris/sdlplayer.c: removed. + 2007-05-13 Bruno coudoin <bruno.coudoin@free.fr> * boards/sounds/HOWTO_ENCODE: added a howto reformat to 44100Hz and normalize-ogg diff --git a/configure.in b/configure.in index cc7e1c1..7b0864c 100644 --- a/configure.in +++ b/configure.in @@ -14,7 +14,18 @@ GTK_REQUIRED=2.4.0 GDK_PIXBUF_REQUIRED=2.4.0 LIBGNOMECANVAS_REQUIRED=2.3.6 -PKG_CHECK_MODULES(GCOMPRIS, gtk+-2.0 >= $GTK_REQUIRED gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED gthread-2.0) +dnl +dnl Start of pkg-config checks +dnl + +PKG_PROG_PKG_CONFIG() + +PKG_CHECK_MODULES(GCOMPRIS, dnl + [gtk+-2.0 >= $GTK_REQUIRED dnl + gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED dnl + libgnomecanvas-2.0 >= $LIBGNOMECANVAS_REQUIRED dnl + gthread-2.0 + gstreamer-0.10]) AC_SUBST(GCOMPRIS_CFLAGS) AC_SUBST(GCOMPRIS_LIBS) @@ -128,46 +139,6 @@ fi AM_BINRELOC -sdl_mixer_framework="no" -sdl_framework="no" - -if test "x$native_osx" = "xyes"; then - AC_CHECK_HEADER(SDL/SDL.h, sdl_framework="yes" , sdl_framework="no") - if test "$sdl_framework" = "yes"; then - AC_CHECK_HEADER(SDL_mixer/SDL_mixer.h, sdl_mixer_framework="yes" , sdl_mixer_framework="no") - fi -fi - -if test "x$sdl_mixer_framework" = "xno"; then - AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,, AC_MSG_ERROR([*** SDL_mixer not found. Visit http://www.libsdl.org and get it])) - - dnl Check for SDL - SDL_VERSION=1.2.3 - - cflags_previous=$CFLAGS - libs_previous=$LIBS - - if test "x$SDL_CFLAGS" = "x" -o "x$SDL_LIBS" = "x" ; then - AM_PATH_SDL($SDL_VERSION, - :, - AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) - ) - else - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - echo "*** Not checking SDL. Using existing SDL_FLAGS and SDL_LIBS ***" - fi -dnl check n -else - SDL_CFLAGS= - SDL_LIBS="-Xlinker -framework -Xlinker SDL -Xlinker -framework -Xlinker SDL_mixer" - AC_MSG_CHECKING([flags for SDL and SDL_mixer frameworks]) - AC_MSG_RESULT($SDL_LIBS) - AC_DEFINE_UNQUOTED(SDL_FRAMEWORKS, 1, [ Define to 1 if compile for OSX with SDL and SDL_mixer frameworks ]) -fi - - - dnl RESTAURE PREVIOUSLY SET VALUES CFLAGS=$cflags_previous LIBS=$libs_previous @@ -378,7 +349,7 @@ else fi dnl Test for gnuchess -AC_PATH_PROG(GNUCHESS, gnuchess,no,[/usr/bin:/usr/games:/usr/local/bin:$PATH]) +AC_PATH_PROGS(GNUCHESS, gnuchess, gnome-gnuchess,[/usr/bin:/usr/games:/usr/local/bin:$PATH]) if test x$GNUCHESS = xno; then AC_MSG_ERROR(Couldn't find gnuchess, please install the gnuchess package version 5 or above) @@ -628,12 +599,6 @@ echo with options: echo "Force python (--enable-py-build-only) = $py_build_only" echo "Python plugin = $build_python_plugin" -if test -x "${SDL_LIBS}"; then -echo "SDL LIBS (--with-sdl-prefix) = NOT DETECTED (install sdl-devel)" -else -echo "SDL LIBS = found" -fi - echo "XF86VM option (--enable-xf86vidmode) = $found_xf86vidmode" echo "SQLITE database (--enable-sqlite) = $with_sqlite (profiles depend on this)" diff --git a/src/boards/canvas.c b/src/boards/canvas.c index 9ec8e92..2ebf04f 100644 --- a/src/boards/canvas.c +++ b/src/boards/canvas.c @@ -1,12 +1,21 @@ /* -- THIS FILE IS GENERATED - DO NOT EDIT *//* -*- Mode: C; c-basic-offset: 4 -*- */ +#define PY_SSIZE_T_CLEAN #include <Python.h> + + + #if PY_VERSION_HEX < 0x02050000 -/* use int based index for python 2.4 and below */ typedef int Py_ssize_t; +#define PY_SSIZE_T_MAX INT_MAX +#define PY_SSIZE_T_MIN INT_MIN +typedef inquiry lenfunc; +typedef intargfunc ssizeargfunc; +typedef intobjargproc ssizeobjargproc; #endif + #line 4 "canvas.override" #include <Python.h> @@ -19,7 +28,7 @@ static int gnomecanvasaffine_to_value(PyObject *py_affine, double affine[6]) { int i; - + if (PySequence_Length(py_affine) != 6) { PyErr_SetString(PyExc_TypeError, "argument must be a 6 tuple of floats."); return -1; @@ -31,7 +40,7 @@ gnomecanvasaffine_to_value(PyObject *py_affine, double affine[6]) if (sitem) affine[i] = PyFloat_AsDouble(sitem); else { - PyErr_Clear(); + PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "sequence item not a float"); return -1; } @@ -53,7 +62,7 @@ static GType gnome_canvas_path_def_get_type(void) { static GType type = 0; - + if (type == 0) type = g_boxed_type_register_static ("GnomeCanvasPathDef", @@ -66,7 +75,26 @@ gnome_canvas_path_def_get_type(void) #endif -#line 67 "canvas.c" +gboolean +static pygdk_rectangle_from_pyobject(PyObject *object, GdkRectangle *rectangle) +{ + g_return_val_if_fail(rectangle != NULL, FALSE); + + if (pyg_boxed_check(object, GDK_TYPE_RECTANGLE)) { + *rectangle = *pyg_boxed_get(object, GdkRectangle); + return TRUE; + } + if (PyArg_ParseTuple(object, "iiii", &rectangle->x, &rectangle->y, + &rectangle->width, &rectangle->height)) { + return TRUE; + } + PyErr_Clear(); + PyErr_SetString(PyExc_TypeError, "could not convert to GdkRectangle"); + return FALSE; +} + + +#line 98 "canvas.c" /* ---------- types from other modules ---------- */ @@ -76,25 +104,30 @@ static PyTypeObject *_PyGtkLayout_Type; #define PyGtkLayout_Type (*_PyGtkLayout_Type) static PyTypeObject *_PyGtkObject_Type; #define PyGtkObject_Type (*_PyGtkObject_Type) +static PyTypeObject *_PyGtkTextBuffer_Type; +#define PyGtkTextBuffer_Type (*_PyGtkTextBuffer_Type) /* ---------- forward type declarations ---------- */ -PyTypeObject PyGnomeCanvasPathDef_Type; -PyTypeObject PyGnomeCanvas_Type; -PyTypeObject PyGnomeCanvasItem_Type; -PyTypeObject PyGnomeCanvasGroup_Type; -PyTypeObject PyGnomeCanvasClipgroup_Type; -PyTypeObject PyGnomeCanvasLine_Type; -PyTypeObject PyGnomeCanvasPixbuf_Type; -PyTypeObject PyGnomeCanvasRichText_Type; -PyTypeObject PyGnomeCanvasShape_Type; -PyTypeObject PyGnomeCanvasRE_Type; -PyTypeObject PyGnomeCanvasRect_Type; -PyTypeObject PyGnomeCanvasEllipse_Type; -PyTypeObject PyGnomeCanvasPolygon_Type; -PyTypeObject PyGnomeCanvasBpath_Type; -PyTypeObject PyGnomeCanvasText_Type; -PyTypeObject PyGnomeCanvasWidget_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasPathDef_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvas_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasItem_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasGroup_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasClipgroup_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasLine_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasPixbuf_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasRichText_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasShape_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasRE_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasRect_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasEllipse_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasPolygon_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasBpath_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasText_Type; +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasWidget_Type; + +#line 130 "canvas.c" + /* ----------- GnomeCanvasPathDef ----------- */ @@ -109,45 +142,45 @@ pygobject_no_constructor(PyObject *self, PyObject *args, PyObject *kwargs) return -1; } -PyTypeObject PyGnomeCanvasPathDef_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasPathDef_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasPathDef", /* tp_name */ - sizeof(PyGBoxed), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasPathDef", /* tp_name */ + sizeof(PyGBoxed), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)pygobject_no_constructor, /* tp_init */ + (initproc)pygobject_no_constructor, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -158,7 +191,7 @@ PyTypeObject PyGnomeCanvasPathDef_Type = { /* ----------- GnomeCanvas ----------- */ -#line 262 "canvas.override" +#line 282 "canvas.override" static int _wrap_gnome_canvas_new(PyGObject *self, PyObject *args, PyObject *kwargs) { @@ -171,7 +204,7 @@ _wrap_gnome_canvas_new(PyGObject *self, PyObject *args, PyObject *kwargs) return -1; self->obj = g_object_new(obj_type, "aa", aa, NULL); - + if (!self->obj) { PyErr_SetString(PyExc_RuntimeError, "could not create GnomeCanvas object"); return -1; @@ -181,7 +214,7 @@ _wrap_gnome_canvas_new(PyGObject *self, PyObject *args, PyObject *kwargs) pygobject_register_wrapper((PyObject *)self); return 0; } -#line 182 "canvas.c" +#line 218 "canvas.c" static PyObject * @@ -189,7 +222,9 @@ _wrap_gnome_canvas_root(PyGObject *self) { GnomeCanvasGroup *ret; + ret = gnome_canvas_root(GNOME_CANVAS(self->obj)); + /* pygobject_new handles NULL checking */ return pygobject_new((GObject *)ret); } @@ -200,9 +235,11 @@ _wrap_gnome_canvas_set_pixels_per_unit(PyGObject *self, PyObject *args, PyObject static char *kwlist[] = { "n", NULL }; double n; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "d:GnomeCanvas.set_pixels_per_unit", kwlist, &n)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"d:GnomeCanvas.set_pixels_per_unit", kwlist, &n)) return NULL; + gnome_canvas_set_pixels_per_unit(GNOME_CANVAS(self->obj), n); + Py_INCREF(Py_None); return Py_None; } @@ -213,25 +250,27 @@ _wrap_gnome_canvas_set_scroll_region(PyGObject *self, PyObject *args, PyObject * static char *kwlist[] = { "x1", "y1", "x2", "y2", NULL }; double x1, y1, x2, y2; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dddd:GnomeCanvas.set_scroll_region", kwlist, &x1, &y1, &x2, &y2)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"dddd:GnomeCanvas.set_scroll_region", kwlist, &x1, &y1, &x2, &y2)) return NULL; + gnome_canvas_set_scroll_region(GNOME_CANVAS(self->obj), x1, y1, x2, y2); + Py_INCREF(Py_None); return Py_None; } -#line 237 "canvas.override" +#line 257 "canvas.override" static PyObject * _wrap_gnome_canvas_get_scroll_region(PyGObject *self, PyObject *args) { double x1, y1, x2, y2; - + gnome_canvas_get_scroll_region(GNOME_CANVAS(self->obj), &x1, &y1, &x2, &y2); - + return Py_BuildValue("(dddd)", x1, y1, x2, y2); } -#line 232 "canvas.c" +#line 274 "canvas.c" static PyObject * @@ -239,7 +278,9 @@ _wrap_gnome_canvas_get_center_scroll_region(PyGObject *self) { int ret; + ret = gnome_canvas_get_center_scroll_region(GNOME_CANVAS(self->obj)); + return PyBool_FromLong(ret); } @@ -250,9 +291,11 @@ _wrap_gnome_canvas_set_center_scroll_region(PyGObject *self, PyObject *args, PyO static char *kwlist[] = { "center_scroll_region", NULL }; int center_scroll_region; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GnomeCanvas.set_center_scroll_region", kwlist, ¢er_scroll_region)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:GnomeCanvas.set_center_scroll_region", kwlist, ¢er_scroll_region)) return NULL; + gnome_canvas_set_center_scroll_region(GNOME_CANVAS(self->obj), center_scroll_region); + Py_INCREF(Py_None); return Py_None; } @@ -263,14 +306,16 @@ _wrap_gnome_canvas_scroll_to(PyGObject *self, PyObject *args, PyObject *kwargs) static char *kwlist[] = { "cx", "cy", NULL }; int cx, cy; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:GnomeCanvas.scroll_to", kwlist, &cx, &cy)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"ii:GnomeCanvas.scroll_to", kwlist, &cx, &cy)) return NULL; + gnome_canvas_scroll_to(GNOME_CANVAS(self->obj), cx, cy); + Py_INCREF(Py_None); return Py_None; } -#line 249 "canvas.override" +#line 269 "canvas.override" static PyObject * _wrap_gnome_canvas_get_scroll_offsets(PyGObject *self, PyObject *args) { @@ -280,13 +325,15 @@ _wrap_gnome_canvas_get_scroll_offsets(PyGObject *self, PyObject *args) return Py_BuildValue("(ii)", cx, cy); } -#line 281 "canvas.c" +#line 329 "canvas.c" static PyObject * _wrap_gnome_canvas_update_now(PyGObject *self) { + gnome_canvas_update_now(GNOME_CANVAS(self->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -298,14 +345,16 @@ _wrap_gnome_canvas_get_item_at(PyGObject *self, PyObject *args, PyObject *kwargs double x, y; GnomeCanvasItem *ret; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:GnomeCanvas.get_item_at", kwlist, &x, &y)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"dd:GnomeCanvas.get_item_at", kwlist, &x, &y)) return NULL; + ret = gnome_canvas_get_item_at(GNOME_CANVAS(self->obj), x, y); + /* pygobject_new handles NULL checking */ return pygobject_new((GObject *)ret); } -#line 440 "canvas.override" +#line 460 "canvas.override" static PyObject * _wrap_gnome_canvas_w2c_affine(PyGObject *self, PyObject *args) { PyObject *py_affine; @@ -320,10 +369,10 @@ _wrap_gnome_canvas_w2c_affine(PyGObject *self, PyObject *args) { return gnomecanvasaffine_from_value(affine); } -#line 321 "canvas.c" +#line 373 "canvas.c" -#line 286 "canvas.override" +#line 306 "canvas.override" static PyObject * _wrap_gnome_canvas_w2c(PyGObject *self, PyObject *args, PyObject *kwargs) { @@ -338,10 +387,10 @@ _wrap_gnome_canvas_w2c(PyGObject *self, PyObject *args, PyObject *kwargs) return Py_BuildValue("(ii)", cx, cy); } -#line 339 "canvas.c" +#line 391 "canvas.c" -#line 302 "canvas.override" +#line 322 "canvas.override" static PyObject * _wrap_gnome_canvas_w2c_d(PyGObject *self, PyObject *args, PyObject *kwargs) { @@ -356,10 +405,10 @@ _wrap_gnome_canvas_w2c_d(PyGObject *self, PyObject *args, PyObject *kwargs) return Py_BuildValue("(dd)", cx, cy); } -#line 357 "canvas.c" +#line 409 "canvas.c" -#line 318 "canvas.override" +#line 338 "canvas.override" static PyObject * _wrap_gnome_canvas_c2w(PyGObject *self, PyObject *args, PyObject *kwargs) { @@ -374,10 +423,10 @@ _wrap_gnome_canvas_c2w(PyGObject *self, PyObject *args, PyObject *kwargs) return Py_BuildValue("(dd)", wx, wy); } -#line 375 "canvas.c" +#line 427 "canvas.c" -#line 334 "canvas.override" +#line 354 "canvas.override" static PyObject * _wrap_gnome_canvas_window_to_world(PyGObject *self, PyObject *args, PyObject *kwargs) @@ -394,10 +443,10 @@ _wrap_gnome_canvas_window_to_world(PyGObject *self, PyObject *args, return Py_BuildValue("(dd)", worldx, worldy); } -#line 395 "canvas.c" +#line 447 "canvas.c" -#line 352 "canvas.override" +#line 372 "canvas.override" static PyObject * _wrap_gnome_canvas_world_to_window(PyGObject *self, PyObject *args, PyObject *kwargs) @@ -414,7 +463,7 @@ _wrap_gnome_canvas_world_to_window(PyGObject *self, PyObject *args, return Py_BuildValue("(dd)", winx, winy); } -#line 415 "canvas.c" +#line 467 "canvas.c" static PyObject * @@ -426,7 +475,7 @@ _wrap_gnome_canvas_get_color(PyGObject *self, PyObject *args, PyObject *kwargs) int ret; GdkColor *color = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sO:GnomeCanvas.get_color", kwlist, &spec, &py_color)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sO:GnomeCanvas.get_color", kwlist, &spec, &py_color)) return NULL; if (pyg_boxed_check(py_color, GDK_TYPE_COLOR)) color = pyg_boxed_get(py_color, GdkColor); @@ -434,7 +483,9 @@ _wrap_gnome_canvas_get_color(PyGObject *self, PyObject *args, PyObject *kwargs) PyErr_SetString(PyExc_TypeError, "color should be a GdkColor"); return NULL; } + ret = gnome_canvas_get_color(GNOME_CANVAS(self->obj), spec, color); + return PyInt_FromLong(ret); } @@ -442,13 +493,27 @@ static PyObject * _wrap_gnome_canvas_get_color_pixel(PyGObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "rgba", NULL }; + PyObject *py_rgba = NULL; gulong ret; - guint rgba; + guint rgba = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "I:GnomeCanvas.get_color_pixel", kwlist, &rgba)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GnomeCanvas.get_color_pixel", kwlist, &py_rgba)) return NULL; + if (py_rgba) { + if (PyLong_Check(py_rgba)) + rgba = PyLong_AsUnsignedLong(py_rgba); + else if (PyInt_Check(py_rgba)) + rgba = PyInt_AsLong(py_rgba); + else + PyErr_SetString(PyExc_TypeError, "Parameter 'rgba' must be an int or a long"); + if (PyErr_Occurred()) + return NULL; + } + ret = gnome_canvas_get_color_pixel(GNOME_CANVAS(self->obj), rgba); + return PyLong_FromUnsignedLong(ret); + } static PyObject * @@ -458,11 +523,13 @@ _wrap_gnome_canvas_set_dither(PyGObject *self, PyObject *args, PyObject *kwargs) PyObject *py_dither = NULL; GdkRgbDither dither; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:GnomeCanvas.set_dither", kwlist, &py_dither)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GnomeCanvas.set_dither", kwlist, &py_dither)) return NULL; - if (pyg_enum_get_value(GDK_TYPE_RGB_DITHER, py_dither, (gint *)&dither)) + if (pyg_enum_get_value(GDK_TYPE_RGB_DITHER, py_dither, (gpointer)&dither)) return NULL; + gnome_canvas_set_dither(GNOME_CANVAS(self->obj), dither); + Py_INCREF(Py_None); return Py_None; } @@ -472,73 +539,95 @@ _wrap_gnome_canvas_get_dither(PyGObject *self) { gint ret; + ret = gnome_canvas_get_dither(GNOME_CANVAS(self->obj)); + return pyg_enum_from_gtype(GDK_TYPE_RGB_DITHER, ret); } -static PyMethodDef _PyGnomeCanvas_methods[] = { - { "root", (PyCFunction)_wrap_gnome_canvas_root, METH_NOARGS }, - { "set_pixels_per_unit", (PyCFunction)_wrap_gnome_canvas_set_pixels_per_unit, METH_VARARGS|METH_KEYWORDS }, - { "set_scroll_region", (PyCFunction)_wrap_gnome_canvas_set_scroll_region, METH_VARARGS|METH_KEYWORDS }, - { "get_scroll_region", (PyCFunction)_wrap_gnome_canvas_get_scroll_region, METH_NOARGS }, - { "get_center_scroll_region", (PyCFunction)_wrap_gnome_canvas_get_center_scroll_region, METH_NOARGS }, - { "set_center_scroll_region", (PyCFunction)_wrap_gnome_canvas_set_center_scroll_region, METH_VARARGS|METH_KEYWORDS }, - { "scroll_to", (PyCFunction)_wrap_gnome_canvas_scroll_to, METH_VARARGS|METH_KEYWORDS }, - { "get_scroll_offsets", (PyCFunction)_wrap_gnome_canvas_get_scroll_offsets, METH_NOARGS }, - { "update_now", (PyCFunction)_wrap_gnome_canvas_update_now, METH_NOARGS }, - { "get_item_at", (PyCFunction)_wrap_gnome_canvas_get_item_at, METH_VARARGS|METH_KEYWORDS }, - { "w2c_affine", (PyCFunction)_wrap_gnome_canvas_w2c_affine, METH_VARARGS }, - { "w2c", (PyCFunction)_wrap_gnome_canvas_w2c, METH_VARARGS|METH_KEYWORDS }, - { "w2c_d", (PyCFunction)_wrap_gnome_canvas_w2c_d, METH_VARARGS|METH_KEYWORDS }, - { "c2w", (PyCFunction)_wrap_gnome_canvas_c2w, METH_VARARGS|METH_KEYWORDS }, - { "window_to_world", (PyCFunction)_wrap_gnome_canvas_window_to_world, METH_VARARGS|METH_KEYWORDS }, - { "world_to_window", (PyCFunction)_wrap_gnome_canvas_world_to_window, METH_VARARGS|METH_KEYWORDS }, - { "get_color", (PyCFunction)_wrap_gnome_canvas_get_color, METH_VARARGS|METH_KEYWORDS }, - { "get_color_pixel", (PyCFunction)_wrap_gnome_canvas_get_color_pixel, METH_VARARGS|METH_KEYWORDS }, - { "set_dither", (PyCFunction)_wrap_gnome_canvas_set_dither, METH_VARARGS|METH_KEYWORDS }, - { "get_dither", (PyCFunction)_wrap_gnome_canvas_get_dither, METH_NOARGS }, - { NULL, NULL, 0 } +static const PyMethodDef _PyGnomeCanvas_methods[] = { + { "root", (PyCFunction)_wrap_gnome_canvas_root, METH_NOARGS, + NULL }, + { "set_pixels_per_unit", (PyCFunction)_wrap_gnome_canvas_set_pixels_per_unit, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_scroll_region", (PyCFunction)_wrap_gnome_canvas_set_scroll_region, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_scroll_region", (PyCFunction)_wrap_gnome_canvas_get_scroll_region, METH_NOARGS, + NULL }, + { "get_center_scroll_region", (PyCFunction)_wrap_gnome_canvas_get_center_scroll_region, METH_NOARGS, + NULL }, + { "set_center_scroll_region", (PyCFunction)_wrap_gnome_canvas_set_center_scroll_region, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "scroll_to", (PyCFunction)_wrap_gnome_canvas_scroll_to, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_scroll_offsets", (PyCFunction)_wrap_gnome_canvas_get_scroll_offsets, METH_NOARGS, + NULL }, + { "update_now", (PyCFunction)_wrap_gnome_canvas_update_now, METH_NOARGS, + NULL }, + { "get_item_at", (PyCFunction)_wrap_gnome_canvas_get_item_at, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "w2c_affine", (PyCFunction)_wrap_gnome_canvas_w2c_affine, METH_VARARGS, + NULL }, + { "w2c", (PyCFunction)_wrap_gnome_canvas_w2c, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "w2c_d", (PyCFunction)_wrap_gnome_canvas_w2c_d, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "c2w", (PyCFunction)_wrap_gnome_canvas_c2w, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "window_to_world", (PyCFunction)_wrap_gnome_canvas_window_to_world, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "world_to_window", (PyCFunction)_wrap_gnome_canvas_world_to_window, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_color", (PyCFunction)_wrap_gnome_canvas_get_color, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_color_pixel", (PyCFunction)_wrap_gnome_canvas_get_color_pixel, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "set_dither", (PyCFunction)_wrap_gnome_canvas_set_dither, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_dither", (PyCFunction)_wrap_gnome_canvas_get_dither, METH_NOARGS, + NULL }, + { NULL, NULL, 0, NULL } }; -PyTypeObject PyGnomeCanvas_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvas_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.Canvas", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.Canvas", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - _PyGnomeCanvas_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)_PyGnomeCanvas_methods, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)_wrap_gnome_canvas_new, /* tp_init */ + (initproc)_wrap_gnome_canvas_new, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -549,7 +638,7 @@ PyTypeObject PyGnomeCanvas_Type = { /* ----------- GnomeCanvasItem ----------- */ -#line 140 "canvas.override" +#line 160 "canvas.override" static PyObject * _wrap_gnome_canvas_item_set (PyGObject *self, PyObject *args, PyObject *kwargs) @@ -564,7 +653,7 @@ _wrap_gnome_canvas_item_set (PyGObject *self, PyObject *args, item = GNOME_CANVAS_ITEM(self->obj); type = G_OBJECT_TYPE(item); class = G_OBJECT_GET_CLASS(item); - + g_object_freeze_notify (G_OBJECT(item)); while (kwargs && PyDict_Next (kwargs, &pos, &key, &value)) { @@ -603,7 +692,7 @@ _wrap_gnome_canvas_item_set (PyGObject *self, PyObject *args, Py_INCREF(Py_None); return Py_None; } -#line 604 "canvas.c" +#line 696 "canvas.c" static PyObject * @@ -612,14 +701,16 @@ _wrap_gnome_canvas_item_move(PyGObject *self, PyObject *args, PyObject *kwargs) static char *kwlist[] = { "dx", "dy", NULL }; double dx, dy; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:GnomeCanvasItem.move", kwlist, &dx, &dy)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"dd:GnomeCanvasItem.move", kwlist, &dx, &dy)) return NULL; + gnome_canvas_item_move(GNOME_CANVAS_ITEM(self->obj), dx, dy); + Py_INCREF(Py_None); return Py_None; } -#line 389 "canvas.override" +#line 409 "canvas.override" static PyObject * _wrap_gnome_canvas_item_affine_relative(PyGObject *self, PyObject *args) { PyObject *py_affine; @@ -631,16 +722,16 @@ _wrap_gnome_canvas_item_affine_relative(PyGObject *self, PyObject *args) { if ((gnomecanvasaffine_to_value(py_affine, affine)) == -1) return NULL; - + gnome_canvas_item_affine_relative(GNOME_CANVAS_ITEM(self->obj), affine); Py_INCREF(Py_None); return Py_None; } -#line 638 "canvas.c" +#line 732 "canvas.c" -#line 370 "canvas.override" +#line 390 "canvas.override" static PyObject * _wrap_gnome_canvas_item_affine_absolute(PyGObject *self, PyObject *args) { PyObject *py_affine; @@ -658,7 +749,7 @@ _wrap_gnome_canvas_item_affine_absolute(PyGObject *self, PyObject *args) { Py_INCREF(Py_None); return Py_None; } -#line 659 "canvas.c" +#line 753 "canvas.c" static PyObject * @@ -667,9 +758,11 @@ _wrap_gnome_canvas_item_raise(PyGObject *self, PyObject *args, PyObject *kwargs) static char *kwlist[] = { "positions", NULL }; int positions; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GnomeCanvasItem.raise", kwlist, &positions)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:GnomeCanvasItem.raise", kwlist, &positions)) return NULL; + gnome_canvas_item_raise(GNOME_CANVAS_ITEM(self->obj), positions); + Py_INCREF(Py_None); return Py_None; } @@ -680,9 +773,11 @@ _wrap_gnome_canvas_item_lower(PyGObject *self, PyObject *args, PyObject *kwargs) static char *kwlist[] = { "positions", NULL }; int positions; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:GnomeCanvasItem.lower", kwlist, &positions)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"i:GnomeCanvasItem.lower", kwlist, &positions)) return NULL; + gnome_canvas_item_lower(GNOME_CANVAS_ITEM(self->obj), positions); + Py_INCREF(Py_None); return Py_None; } @@ -690,7 +785,9 @@ _wrap_gnome_canvas_item_lower(PyGObject *self, PyObject *args, PyObject *kwargs) static PyObject * _wrap_gnome_canvas_item_raise_to_top(PyGObject *self) { + gnome_canvas_item_raise_to_top(GNOME_CANVAS_ITEM(self->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -698,7 +795,9 @@ _wrap_gnome_canvas_item_raise_to_top(PyGObject *self) static PyObject * _wrap_gnome_canvas_item_lower_to_bottom(PyGObject *self) { + gnome_canvas_item_lower_to_bottom(GNOME_CANVAS_ITEM(self->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -706,7 +805,9 @@ _wrap_gnome_canvas_item_lower_to_bottom(PyGObject *self) static PyObject * _wrap_gnome_canvas_item_show(PyGObject *self) { + gnome_canvas_item_show(GNOME_CANVAS_ITEM(self->obj)); + Py_INCREF(Py_None); return Py_None; } @@ -714,12 +815,14 @@ _wrap_gnome_canvas_item_show(PyGObject *self) static PyObject * _wrap_gnome_canvas_item_hide(PyGObject *self) { + gnome_canvas_item_hide(GNOME_CANVAS_ITEM(self->obj)); + Py_INCREF(Py_None); return Py_None; } -#line 195 "canvas.override" +#line 215 "canvas.override" static PyObject * _wrap_gnome_canvas_item_w2i(PyGObject *self, PyObject *args, PyObject *kwargs) @@ -733,10 +836,10 @@ _wrap_gnome_canvas_item_w2i(PyGObject *self, PyObject *args, return Py_BuildValue("(dd)", x, y); } -#line 734 "canvas.c" +#line 840 "canvas.c" -#line 210 "canvas.override" +#line 230 "canvas.override" static PyObject * _wrap_gnome_canvas_item_i2w(PyGObject *self, PyObject *args, PyObject *kwargs) @@ -750,10 +853,10 @@ _wrap_gnome_canvas_item_i2w(PyGObject *self, PyObject *args, return Py_BuildValue("(dd)", x, y); } -#line 751 "canvas.c" +#line 857 "canvas.c" -#line 424 "canvas.override" +#line 444 "canvas.override" static PyObject * _wrap_gnome_canvas_item_i2w_affine(PyGObject *self, PyObject *args) { PyObject *py_affine; @@ -768,10 +871,10 @@ _wrap_gnome_canvas_item_i2w_affine(PyGObject *self, PyObject *args) { return gnomecanvasaffine_from_value(affine); } -#line 769 "canvas.c" +#line 875 "canvas.c" -#line 408 "canvas.override" +#line 428 "canvas.override" static PyObject * _wrap_gnome_canvas_item_i2c_affine(PyGObject *self, PyObject *args) { PyObject *py_affine; @@ -786,7 +889,7 @@ _wrap_gnome_canvas_item_i2c_affine(PyGObject *self, PyObject *args) { return gnomecanvasaffine_from_value(affine); } -#line 787 "canvas.c" +#line 893 "canvas.c" static PyObject * @@ -795,14 +898,16 @@ _wrap_gnome_canvas_item_reparent(PyGObject *self, PyObject *args, PyObject *kwar static char *kwlist[] = { "new_group", NULL }; PyGObject *new_group; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!:GnomeCanvasItem.reparent", kwlist, &PyGnomeCanvasGroup_Type, &new_group)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:GnomeCanvasItem.reparent", kwlist, &PyGnomeCanvasGroup_Type, &new_group)) return NULL; + gnome_canvas_item_reparent(GNOME_CANVAS_ITEM(self->obj), GNOME_CANVAS_GROUP(new_group->obj)); + Py_INCREF(Py_None); return Py_None; } -#line 581 "canvas.override" +#line 601 "canvas.override" static PyObject * _wrap_gnome_canvas_item_grab(PyGObject *self, PyObject *args, PyObject *kwargs) @@ -813,7 +918,7 @@ _wrap_gnome_canvas_item_grab(PyGObject *self, PyObject *args, unsigned int event_mask = 0; guint32 etime = GDK_CURRENT_TIME; int retval; - + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO!:GnomeCanvasItem.grab", kwlist, &py_event_mask, @@ -832,7 +937,7 @@ _wrap_gnome_canvas_item_grab(PyGObject *self, PyObject *args, PyErr_SetString(PyExc_TypeError, "cursor should be a GdkCursor or None"); return NULL; } - + if (py_time) etime = PyLong_AsUnsignedLong(py_time); @@ -841,18 +946,20 @@ _wrap_gnome_canvas_item_grab(PyGObject *self, PyObject *args, return PyInt_FromLong(retval); } -#line 842 "canvas.c" +#line 950 "canvas.c" static PyObject * _wrap_gnome_canvas_item_grab_focus(PyGObject *self) { + gnome_canvas_item_grab_focus(GNOME_CANVAS_ITEM(self->obj)); + Py_INCREF(Py_None); return Py_None; } -#line 225 "canvas.override" +#line 245 "canvas.override" static PyObject * _wrap_gnome_canvas_item_get_bounds(PyGObject *self, PyObject *args) { @@ -863,70 +970,88 @@ _wrap_gnome_canvas_item_get_bounds(PyGObject *self, PyObject *args) return Py_BuildValue("(dddd)", x1, y1, x2, y2); } -#line 864 "canvas.c" - - -static PyMethodDef _PyGnomeCanvasItem_methods[] = { - { "set", (PyCFunction)_wrap_gnome_canvas_item_set, METH_VARARGS|METH_KEYWORDS }, - { "move", (PyCFunction)_wrap_gnome_canvas_item_move, METH_VARARGS|METH_KEYWORDS }, - { "affine_relative", (PyCFunction)_wrap_gnome_canvas_item_affine_relative, METH_VARARGS }, - { "affine_absolute", (PyCFunction)_wrap_gnome_canvas_item_affine_absolute, METH_VARARGS }, - { "raise_", (PyCFunction)_wrap_gnome_canvas_item_raise, METH_VARARGS|METH_KEYWORDS }, - { "lower", (PyCFunction)_wrap_gnome_canvas_item_lower, METH_VARARGS|METH_KEYWORDS }, - { "raise_to_top", (PyCFunction)_wrap_gnome_canvas_item_raise_to_top, METH_NOARGS }, - { "lower_to_bottom", (PyCFunction)_wrap_gnome_canvas_item_lower_to_bottom, METH_NOARGS }, - { "show", (PyCFunction)_wrap_gnome_canvas_item_show, METH_NOARGS }, - { "hide", (PyCFunction)_wrap_gnome_canvas_item_hide, METH_NOARGS }, - { "w2i", (PyCFunction)_wrap_gnome_canvas_item_w2i, METH_VARARGS|METH_KEYWORDS }, - { "i2w", (PyCFunction)_wrap_gnome_canvas_item_i2w, METH_VARARGS|METH_KEYWORDS }, - { "i2w_affine", (PyCFunction)_wrap_gnome_canvas_item_i2w_affine, METH_VARARGS }, - { "i2c_affine", (PyCFunction)_wrap_gnome_canvas_item_i2c_affine, METH_VARARGS }, - { "reparent", (PyCFunction)_wrap_gnome_canvas_item_reparent, METH_VARARGS|METH_KEYWORDS }, - { "grab", (PyCFunction)_wrap_gnome_canvas_item_grab, METH_VARARGS|METH_KEYWORDS }, - { "grab_focus", (PyCFunction)_wrap_gnome_canvas_item_grab_focus, METH_NOARGS }, - { "get_bounds", (PyCFunction)_wrap_gnome_canvas_item_get_bounds, METH_NOARGS }, - { NULL, NULL, 0 } +#line 974 "canvas.c" + + +static const PyMethodDef _PyGnomeCanvasItem_methods[] = { + { "set", (PyCFunction)_wrap_gnome_canvas_item_set, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "move", (PyCFunction)_wrap_gnome_canvas_item_move, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "affine_relative", (PyCFunction)_wrap_gnome_canvas_item_affine_relative, METH_VARARGS, + NULL }, + { "affine_absolute", (PyCFunction)_wrap_gnome_canvas_item_affine_absolute, METH_VARARGS, + NULL }, + { "raise_", (PyCFunction)_wrap_gnome_canvas_item_raise, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "lower", (PyCFunction)_wrap_gnome_canvas_item_lower, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "raise_to_top", (PyCFunction)_wrap_gnome_canvas_item_raise_to_top, METH_NOARGS, + NULL }, + { "lower_to_bottom", (PyCFunction)_wrap_gnome_canvas_item_lower_to_bottom, METH_NOARGS, + NULL }, + { "show", (PyCFunction)_wrap_gnome_canvas_item_show, METH_NOARGS, + NULL }, + { "hide", (PyCFunction)_wrap_gnome_canvas_item_hide, METH_NOARGS, + NULL }, + { "w2i", (PyCFunction)_wrap_gnome_canvas_item_w2i, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "i2w", (PyCFunction)_wrap_gnome_canvas_item_i2w, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "i2w_affine", (PyCFunction)_wrap_gnome_canvas_item_i2w_affine, METH_VARARGS, + NULL }, + { "i2c_affine", (PyCFunction)_wrap_gnome_canvas_item_i2c_affine, METH_VARARGS, + NULL }, + { "reparent", (PyCFunction)_wrap_gnome_canvas_item_reparent, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "grab", (PyCFunction)_wrap_gnome_canvas_item_grab, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "grab_focus", (PyCFunction)_wrap_gnome_canvas_item_grab_focus, METH_NOARGS, + NULL }, + { "get_bounds", (PyCFunction)_wrap_gnome_canvas_item_get_bounds, METH_NOARGS, + NULL }, + { NULL, NULL, 0, NULL } }; -PyTypeObject PyGnomeCanvasItem_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasItem_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasItem", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasItem", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - _PyGnomeCanvasItem_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)_PyGnomeCanvasItem_methods, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -937,7 +1062,7 @@ PyTypeObject PyGnomeCanvasItem_Type = { /* ----------- GnomeCanvasGroup ----------- */ -#line 73 "canvas.override" +#line 93 "canvas.override" static PyObject * _wrap_gnome_canvas_item_new (PyGObject *self, PyObject *args, PyObject *kwargs) @@ -955,7 +1080,7 @@ _wrap_gnome_canvas_item_new (PyGObject *self, PyObject *args, &pytype)) { return NULL; } - + type = pyg_type_from_object (pytype); item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (self->obj), type, NULL); if (!item) { @@ -1003,15 +1128,16 @@ _wrap_gnome_canvas_item_new (PyGObject *self, PyObject *args, return pygobject_new ((GObject *)item); } -#line 1004 "canvas.c" +#line 1132 "canvas.c" -static PyMethodDef _PyGnomeCanvasGroup_methods[] = { - { "add", (PyCFunction)_wrap_gnome_canvas_item_new, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +static const PyMethodDef _PyGnomeCanvasGroup_methods[] = { + { "add", (PyCFunction)_wrap_gnome_canvas_item_new, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; -#line 456 "canvas.override" +#line 476 "canvas.override" static PyObject * _wrap_gnome_canvas_group__get_item_list(PyGObject *self, void *closure) { @@ -1028,53 +1154,53 @@ _wrap_gnome_canvas_group__get_item_list(PyGObject *self, void *closure) return list; } -#line 1029 "canvas.c" +#line 1158 "canvas.c" -static PyGetSetDef gnome_canvas_group_getsets[] = { +static const PyGetSetDef gnome_canvas_group_getsets[] = { { "item_list", (getter)_wrap_gnome_canvas_group__get_item_list, (setter)0 }, { NULL, (getter)0, (setter)0 }, }; -PyTypeObject PyGnomeCanvasGroup_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasGroup_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasGroup", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasGroup", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - _PyGnomeCanvasGroup_methods, /* tp_methods */ - 0, /* tp_members */ - gnome_canvas_group_getsets, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)_PyGnomeCanvasGroup_methods, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)gnome_canvas_group_getsets, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1085,45 +1211,45 @@ PyTypeObject PyGnomeCanvasGroup_Type = { /* ----------- GnomeCanvasClipgroup ----------- */ -PyTypeObject PyGnomeCanvasClipgroup_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasClipgroup_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasClipgroup", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasClipgroup", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1134,45 +1260,45 @@ PyTypeObject PyGnomeCanvasClipgroup_Type = { /* ----------- GnomeCanvasLine ----------- */ -PyTypeObject PyGnomeCanvasLine_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasLine_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasLine", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasLine", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1183,45 +1309,45 @@ PyTypeObject PyGnomeCanvasLine_Type = { /* ----------- GnomeCanvasPixbuf ----------- */ -PyTypeObject PyGnomeCanvasPixbuf_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasPixbuf_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasPixbuf", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasPixbuf", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1232,45 +1358,165 @@ PyTypeObject PyGnomeCanvasPixbuf_Type = { /* ----------- GnomeCanvasRichText ----------- */ -PyTypeObject PyGnomeCanvasRichText_Type = { +static PyObject * +_wrap_gnome_canvas_rich_text_cut_clipboard(PyGObject *self) +{ + + gnome_canvas_rich_text_cut_clipboard(GNOME_CANVAS_RICH_TEXT(self->obj)); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +_wrap_gnome_canvas_rich_text_copy_clipboard(PyGObject *self) +{ + + gnome_canvas_rich_text_copy_clipboard(GNOME_CANVAS_RICH_TEXT(self->obj)); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +_wrap_gnome_canvas_rich_text_paste_clipboard(PyGObject *self) +{ + + gnome_canvas_rich_text_paste_clipboard(GNOME_CANVAS_RICH_TEXT(self->obj)); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +_wrap_gnome_canvas_rich_text_set_buffer(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "buffer", NULL }; + PyGObject *buffer; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:GnomeCanvasRichText.set_buffer", kwlist, &PyGtkTextBuffer_Type, &buffer)) + return NULL; + + gnome_canvas_rich_text_set_buffer(GNOME_CANVAS_RICH_TEXT(self->obj), GTK_TEXT_BUFFER(buffer->obj)); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +_wrap_gnome_canvas_rich_text_get_buffer(PyGObject *self) +{ + GtkTextBuffer *ret; + + + ret = gnome_canvas_rich_text_get_buffer(GNOME_CANVAS_RICH_TEXT(self->obj)); + + /* pygobject_new handles NULL checking */ + return pygobject_new((GObject *)ret); +} + +static PyObject * +_wrap_gnome_canvas_rich_text_get_iter_location(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "iter", "location", NULL }; + PyObject *py_iter, *py_location; + GdkRectangle location = { 0, 0, 0, 0 }; + GtkTextIter *iter = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"OO:GnomeCanvasRichText.get_iter_location", kwlist, &py_iter, &py_location)) + return NULL; + if (pyg_boxed_check(py_iter, GTK_TYPE_TEXT_ITER)) + iter = pyg_boxed_get(py_iter, GtkTextIter); + else { + PyErr_SetString(PyExc_TypeError, "iter should be a GtkTextIter"); + return NULL; + } + if (!pygdk_rectangle_from_pyobject(py_location, &location)) + return NULL; + + gnome_canvas_rich_text_get_iter_location(GNOME_CANVAS_RICH_TEXT(self->obj), iter, &location); + + Py_INCREF(Py_None); + return Py_None; +} + +#line 641 "canvas.override" +static PyObject * +_wrap_gnome_canvas_rich_text_get_iter_at_location(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "x", "y", NULL }; + PyObject *py_iter; + int x, y; + GtkTextIter iter = {0,}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Oii:GnomeCanvasRichText.get_iter_at_location", kwlist, &x, &y)) + return NULL; + gnome_canvas_rich_text_get_iter_at_location(GNOME_CANVAS_RICH_TEXT(self->obj), &iter, x, y); + + py_iter = pyg_boxed_new(GTK_TYPE_TEXT_ITER, &iter, TRUE, TRUE); + return py_iter; +} + +#line 1461 "canvas.c" + + +static const PyMethodDef _PyGnomeCanvasRichText_methods[] = { + { "cut_clipboard", (PyCFunction)_wrap_gnome_canvas_rich_text_cut_clipboard, METH_NOARGS, + NULL }, + { "copy_clipboard", (PyCFunction)_wrap_gnome_canvas_rich_text_copy_clipboard, METH_NOARGS, + NULL }, + { "paste_clipboard", (PyCFunction)_wrap_gnome_canvas_rich_text_paste_clipboard, METH_NOARGS, + NULL }, + { "set_buffer", (PyCFunction)_wrap_gnome_canvas_rich_text_set_buffer, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_buffer", (PyCFunction)_wrap_gnome_canvas_rich_text_get_buffer, METH_NOARGS, + NULL }, + { "get_iter_location", (PyCFunction)_wrap_gnome_canvas_rich_text_get_iter_location, METH_VARARGS|METH_KEYWORDS, + NULL }, + { "get_iter_at_location", (PyCFunction)_wrap_gnome_canvas_rich_text_get_iter_at_location, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } +}; + +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasRichText_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasRichText", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasRichText", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)_PyGnomeCanvasRichText_methods, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1281,45 +1527,45 @@ PyTypeObject PyGnomeCanvasRichText_Type = { /* ----------- GnomeCanvasShape ----------- */ -PyTypeObject PyGnomeCanvasShape_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasShape_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasShape", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasShape", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1330,45 +1576,45 @@ PyTypeObject PyGnomeCanvasShape_Type = { /* ----------- GnomeCanvasRE ----------- */ -PyTypeObject PyGnomeCanvasRE_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasRE_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasRE", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasRE", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1379,45 +1625,45 @@ PyTypeObject PyGnomeCanvasRE_Type = { /* ----------- GnomeCanvasRect ----------- */ -PyTypeObject PyGnomeCanvasRect_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasRect_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasRect", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasRect", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1428,45 +1674,45 @@ PyTypeObject PyGnomeCanvasRect_Type = { /* ----------- GnomeCanvasEllipse ----------- */ -PyTypeObject PyGnomeCanvasEllipse_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasEllipse_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasEllipse", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasEllipse", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1477,45 +1723,45 @@ PyTypeObject PyGnomeCanvasEllipse_Type = { /* ----------- GnomeCanvasPolygon ----------- */ -PyTypeObject PyGnomeCanvasPolygon_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasPolygon_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasPolygon", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasPolygon", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1526,7 +1772,7 @@ PyTypeObject PyGnomeCanvasPolygon_Type = { /* ----------- GnomeCanvasBpath ----------- */ -#line 560 "canvas.override" +#line 580 "canvas.override" static PyObject * _wrap_gnome_canvas_bpath_set_bpath(PyGObject *self, PyObject *args, PyObject *kwargs) { @@ -1546,53 +1792,54 @@ _wrap_gnome_canvas_bpath_set_bpath(PyGObject *self, PyObject *args, PyObject *kw Py_INCREF(Py_None); return Py_None; } -#line 1547 "canvas.c" +#line 1796 "canvas.c" -static PyMethodDef _PyGnomeCanvasBpath_methods[] = { - { "set_bpath", (PyCFunction)_wrap_gnome_canvas_bpath_set_bpath, METH_VARARGS|METH_KEYWORDS }, - { NULL, NULL, 0 } +static const PyMethodDef _PyGnomeCanvasBpath_methods[] = { + { "set_bpath", (PyCFunction)_wrap_gnome_canvas_bpath_set_bpath, METH_VARARGS|METH_KEYWORDS, + NULL }, + { NULL, NULL, 0, NULL } }; -PyTypeObject PyGnomeCanvasBpath_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasBpath_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasBpath", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasBpath", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - _PyGnomeCanvasBpath_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)_PyGnomeCanvasBpath_methods, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1603,45 +1850,45 @@ PyTypeObject PyGnomeCanvasBpath_Type = { /* ----------- GnomeCanvasText ----------- */ -PyTypeObject PyGnomeCanvasText_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasText_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasText", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasText", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1652,45 +1899,45 @@ PyTypeObject PyGnomeCanvasText_Type = { /* ----------- GnomeCanvasWidget ----------- */ -PyTypeObject PyGnomeCanvasWidget_Type = { +PyTypeObject G_GNUC_INTERNAL PyGnomeCanvasWidget_Type = { PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "gnome.canvas.CanvasWidget", /* tp_name */ - sizeof(PyGObject), /* tp_basicsize */ - 0, /* tp_itemsize */ + 0, /* ob_size */ + "gnome.canvas.CanvasWidget", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ /* methods */ - (destructor)0, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ (PyNumberMethods*)0, /* tp_as_number */ (PySequenceMethods*)0, /* tp_as_sequence */ (PyMappingMethods*)0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - (getattrofunc)0, /* tp_getattro */ - (setattrofunc)0, /* tp_setattro */ - (PyBufferProcs*)0, /* tp_as_buffer */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NULL, /* Documentation string */ - (traverseproc)0, /* tp_traverse */ - (inquiry)0, /* tp_clear */ - (richcmpfunc)0, /* tp_richcompare */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)0, /* tp_iter */ - (iternextfunc)0, /* tp_iternext */ - NULL, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - NULL, /* tp_base */ - NULL, /* tp_dict */ - (descrgetfunc)0, /* tp_descr_get */ - (descrsetfunc)0, /* tp_descr_set */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ offsetof(PyGObject, inst_dict), /* tp_dictoffset */ - (initproc)0, /* tp_init */ + (initproc)0, /* tp_init */ (allocfunc)0, /* tp_alloc */ (newfunc)0, /* tp_new */ (freefunc)0, /* tp_free */ @@ -1701,7 +1948,7 @@ PyTypeObject PyGnomeCanvasWidget_Type = { /* ----------- functions ----------- */ -#line 474 "canvas.override" +#line 494 "canvas.override" static PyObject * _wrap_gnome_canvas_path_def_new(PyObject *self, PyObject *args) { @@ -1786,12 +2033,13 @@ _wrap_gnome_canvas_path_def_new(PyObject *self, PyObject *args) return pyg_boxed_new(GNOME_TYPE_CANVAS_PATH_DEF, path, TRUE, TRUE); } -#line 1787 "canvas.c" +#line 2037 "canvas.c" -PyMethodDef pycanvas_functions[] = { - { "path_def_new", (PyCFunction)_wrap_gnome_canvas_path_def_new, METH_VARARGS }, - { NULL, NULL, 0 } +const PyMethodDef pycanvas_functions[] = { + { "path_def_new", (PyCFunction)_wrap_gnome_canvas_path_def_new, METH_VARARGS, + NULL }, + { NULL, NULL, 0, NULL } }; /* initialise stuff extension classes */ @@ -1801,42 +2049,50 @@ pycanvas_register_classes(PyObject *d) PyObject *module; if ((module = PyImport_ImportModule("gobject")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); - - _PyGObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "GObject"); + _PyGObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "GObject"); if (_PyGObject_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name GObject from gobject"); - return; + return ; } } else { PyErr_SetString(PyExc_ImportError, "could not import gobject"); - return; + return ; + } + if ((module = PyImport_ImportModule("gtk")) != NULL) { + _PyGtkTextBuffer_Type = (PyTypeObject *)PyObject_GetAttrString(module, "TextBuffer"); + if (_PyGtkTextBuffer_Type == NULL) { + PyErr_SetString(PyExc_ImportError, + "cannot import name TextBuffer from gtk"); + return ; + } + } else { + PyErr_SetString(PyExc_ImportError, + "could not import gtk"); + return ; } if ((module = PyImport_ImportModule("gtk._gtk")) != NULL) { - PyObject *moddict = PyModule_GetDict(module); - - _PyGtkLayout_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Layout"); + _PyGtkLayout_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Layout"); if (_PyGtkLayout_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name Layout from gtk._gtk"); - return; + return ; } - _PyGtkObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "Object"); + _PyGtkObject_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Object"); if (_PyGtkObject_Type == NULL) { PyErr_SetString(PyExc_ImportError, "cannot import name Object from gtk._gtk"); - return; + return ; } } else { PyErr_SetString(PyExc_ImportError, "could not import gtk._gtk"); - return; + return ; } -#line 1837 "canvas.c" +#line 2096 "canvas.c" pyg_register_boxed(d, "CanvasPathDef", GNOME_TYPE_CANVAS_PATH_DEF, &PyGnomeCanvasPathDef_Type); pygobject_register_class(d, "GnomeCanvas", GNOME_TYPE_CANVAS, &PyGnomeCanvas_Type, Py_BuildValue("(O)", &PyGtkLayout_Type)); pygobject_register_class(d, "GnomeCanvasItem", GNOME_TYPE_CANVAS_ITEM, &PyGnomeCanvasItem_Type, Py_BuildValue("(O)", &PyGtkObject_Type)); diff --git a/src/boards/click_on_letter.c b/src/boards/click_on_letter.c index c5a8a3a..1610cbf 100644 --- a/src/boards/click_on_letter.c +++ b/src/boards/click_on_letter.c @@ -154,7 +154,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) ready = sounds_are_fine(); - gc_sound_pause(); + gc_sound_bg_pause(); if (agcomprisBoard!=NULL) { @@ -197,7 +197,7 @@ static void end_board () } gc_locale_reset(); gcomprisBoard = NULL; - gc_sound_resume(); + gc_sound_bg_resume(); } /* ======================================= */ diff --git a/src/boards/colors.c b/src/boards/colors.c index 1018dcb..9f43195 100644 --- a/src/boards/colors.c +++ b/src/boards/colors.c @@ -221,7 +221,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) { g_hash_table_destroy(config); - gc_sound_pause(); + gc_sound_bg_pause(); if(agcomprisBoard!=NULL) { gcomprisBoard=agcomprisBoard; @@ -284,7 +284,7 @@ static void end_board () { } gc_locale_reset(); gcomprisBoard = NULL; - gc_sound_resume(); + gc_sound_bg_resume(); } /* ===================================================================== diff --git a/src/boards/memory.c b/src/boards/memory.c index c529139..0626573 100644 --- a/src/boards/memory.c +++ b/src/boards/memory.c @@ -794,7 +794,7 @@ static void start_board (GcomprisBoard *agcomprisBoard) { GcomprisProperties *properties = gc_prop_get(); - gc_sound_pause(); + gc_sound_bg_pause(); /* initial state to restore */ sound_policy = gc_sound_policy_get(); @@ -886,7 +886,7 @@ end_board () { if (currentUiMode == UIMODE_SOUND) { gc_sound_policy_set(sound_policy); - gc_sound_resume(); + gc_sound_bg_resume(); } if(gcomprisBoard!=NULL) diff --git a/src/boards/py-mod-sound.c b/src/boards/py-mod-sound.c index 6cac5cd..3b4c3b8 100644 --- a/src/boards/py-mod-sound.c +++ b/src/boards/py-mod-sound.c @@ -102,7 +102,7 @@ py_gc_sound_pause(PyObject* self, PyObject* args) return NULL; /* Call the corresponding C function */ - gc_sound_pause(); + gc_sound_bg_pause(); /* Create and return the result */ Py_INCREF(Py_None); @@ -117,7 +117,7 @@ py_gc_sound_resume(PyObject* self, PyObject* args) return NULL; /* Call the corresponding C function */ - gc_sound_resume(); + gc_sound_bg_resume(); /* Create and return the result */ Py_INCREF(Py_None); diff --git a/src/gcompris/Makefile.am b/src/gcompris/Makefile.am index 363d15a..2db5ae0 100644 --- a/src/gcompris/Makefile.am +++ b/src/gcompris/Makefile.am @@ -51,7 +51,6 @@ INCLUDES = \ $(GCOMPRIS_CFLAGS) \ $(GNOME_INCLUDEDIR) \ $(XML_CFLAGS) \ - $(SDL_CFLAGS) \ -DGNOME_DISABLE_DEPRECATED \ $(sqlite_cflags) \ $(GNET_CFLAGS) \ @@ -110,7 +109,6 @@ gcompris_SOURCES = \ properties.h \ score.c \ score.h \ - sdlplayer.c \ skin.c \ skin.h \ soundutil.c \ @@ -125,10 +123,10 @@ gcompris_LDFLAGS = \ gcompris_LDADD = \ - $(GCOMPRIS_LIBS) $(sqlite_ldadd) $(XML_LIBS) $(GNET_LIBS) $(SDL_LIBS) \ + $(GCOMPRIS_LIBS) $(sqlite_ldadd) $(XML_LIBS) $(GNET_LIBS) \ $(INTLLIBS) $(NSBUNDLE_LDFLAGS) -# $(LIBICONV) +# $(LIBICONV) EXTRA_DIST = \ diff --git a/src/gcompris/bonus.c b/src/gcompris/bonus.c index 7e4b2ee..983e44f 100644 --- a/src/gcompris/bonus.c +++ b/src/gcompris/bonus.c @@ -84,7 +84,7 @@ end_gc_bonus_end_display() { } if (gc_bonus_end_display_id) { - gtk_timeout_remove(gc_bonus_end_display_id); + g_source_remove(gc_bonus_end_display_id); gc_bonus_end_display_id = 0; } @@ -390,7 +390,7 @@ static void end_bonus() { if (end_bonus_id) { - gtk_timeout_remove (end_bonus_id); + g_source_remove (end_bonus_id); end_bonus_id = 0; } diff --git a/src/gcompris/config.c b/src/gcompris/config.c index 7e4fdc9..d528436 100644 --- a/src/gcompris/config.c +++ b/src/gcompris/config.c @@ -751,10 +751,10 @@ item_event_ok(GnomeCanvasItem *item, GdkEvent *event, gpointer data) else { if(!properties->music) - sdlplayer_halt_music(); + gc_sound_bg_close(); if(!properties->fx) - sdlplayer_halt_fx(); + gc_sound_fx_close(); } gc_prop_save(properties); } @@ -786,12 +786,11 @@ item_event_ok(GnomeCanvasItem *item, GdkEvent *event, gpointer data) NULL); if(!properties->music) { - sdlplayer_halt_music(); + gc_sound_bg_close(); } else { - gc_sound_init(); - sdlplayer_resume_music(); + gc_sound_bg_reopen(); } } else if(!strcmp((char *)data, "effect")) diff --git a/src/gcompris/sdlplayer.c b/src/gcompris/sdlplayer.c deleted file mode 100644 index 588323e..0000000 --- a/src/gcompris/sdlplayer.c +++ /dev/null @@ -1,218 +0,0 @@ -/* sdlplayer - sdlplayer.c - * - * Time-stamp: <2004/05/04 01:33:46 bcoudoin> - * - * Copyright (C) 2004 Bruno Coudoin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#include "soundutil.h" - -#ifndef SDL_FRAMEWORKS -#include "SDL.h" -#include "SDL_thread.h" -#include "SDL_mixer.h" -#include "SDL_audio.h" -#else -/* we use SDL and SDL_mixer framework */ -#include <SDL/SDL.h> -#include <SDL/SDL_thread.h> -#include <SDL_mixer/SDL_mixer.h> -#include <SDL/SDL_audio.h> -#endif - -#include <stdarg.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -#include <glib.h> - -Sint16 stream[2][4096]; -int len=4096, bits=0, which=0; - -// set this to any of 512,1024,2048,4096 -// the higher it is, the more FPS shown and CPU needed -#define AUDIO_BUFFERS 2048 - -static gboolean sound_closed = FALSE; - -/******************************************************************************/ -/* some simple exit and error routines */ - -void errorv(char *str, va_list ap) -{ - //vfprintf(stderr,str,ap); - - if(strcmp(Mix_GetError(), "Unrecognized file type (not VOC)")==0) { - g_warning("*** You need a version of \"SDL_mixer\" with OGG Vorbis supported ***\n"); - exit(EXIT_FAILURE); - } - - g_warning(": %s.\n", Mix_GetError()); - g_warning(": %s.\n", SDL_GetError()); - -} - -int cleanExit(char *str,...) -{ - va_list ap; - va_start(ap, str); - errorv(str,ap); - va_end(ap); - Mix_CloseAudio(); - SDL_Quit(); - return(1); -} - -/******************************************************************************/ - -int sdlplayer_init() -{ - int audio_rate,audio_channels; - Uint16 audio_format; - - // initialize SDL for audio - if(SDL_Init(SDL_INIT_AUDIO)<0) - return(cleanExit("SDL_Init")); - - // initialize sdl mixer, open up the audio device - if(Mix_OpenAudio(44100,MIX_DEFAULT_FORMAT,2,AUDIO_BUFFERS)<0) - return(cleanExit("Mix_OpenAudio")); - - // print out some info on the audio device and stream - Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); - bits=audio_format&0xFF; - g_warning("Opened audio at %d Hz %d bit %s, %d bytes audio buffer\n", audio_rate, - bits, audio_channels>1?"stereo":"mono", AUDIO_BUFFERS ); - return(0); -} - -int sdlplayer_quit(Mix_Music *music) -{ - // free & close - Mix_FreeMusic(music); - Mix_CloseAudio(); - g_warning("SDL PLAYER SDL_Quit\n"); - SDL_Quit(); - - return 0; -} - -int sdlplayer_music(char *filename, int volume) -{ - Mix_Music *music; - - g_warning("sdlplayer_bg %s\n", filename); - - // load the song - if(!(music=Mix_LoadMUS(filename))) - return(cleanExit("Mix_LoadMUS(\"%s\")",filename)); - - if(Mix_PlayMusic(music, 1)==-1) { - return(cleanExit("Mix_LoadMUS(0x%p,1)",music)); - } - - Mix_VolumeMusic(volume); - - // wait for the music to complete - while(Mix_PlayingMusic() || Mix_PausedMusic()) - { - SDL_Delay(50); - } - - return(0); -} - -int sdlplayer_fx(char *filename, int volume) -{ - Mix_Chunk *sample; - static int channel; - - g_warning("sdlplayer %s\n", filename); - - sample=Mix_LoadWAV_RW(SDL_RWFromFile(filename, "rb"), 1); - if(!sample) { - return(cleanExit("Mix_LoadWAV_RW")); - // handle error - } - - Mix_VolumeChunk(sample, MIX_MAX_VOLUME); - - if((channel=Mix_PlayChannel(-1, sample, 0))==-1) { - return(cleanExit("Mix_LoadChannel(0x%p,1)",channel)); - } - - while(Mix_Playing(channel)) - { - SDL_Delay(50); - } - - // free the sample - // Mix_Chunk *sample; - Mix_FreeChunk(sample); - - g_warning("sdlplayer complete playing of %s\n", filename); - - return(0); -} - -void sdlplayer_pause_music() -{ - if(!sound_closed && Mix_PlayingMusic()) - Mix_PauseMusic(); -} - -void sdlplayer_halt_music() -{ - if(!sound_closed) - Mix_HaltMusic(); -} - -void sdlplayer_halt_fx() -{ - if(!sound_closed) - Mix_HaltChannel(-1); -} - -void sdlplayer_resume_music() -{ - if(!sound_closed) - Mix_ResumeMusic(); -} - -void sdlplayer_resume_fx() -{ - if(!sound_closed) - Mix_Resume(-1); -} - -void sdlplayer_close() -{ - sound_closed = TRUE; - Mix_HaltMusic(); - Mix_HaltChannel(-1); - Mix_CloseAudio(); -} - -void sdlplayer_reopen() -{ - Mix_OpenAudio(44100,MIX_DEFAULT_FORMAT,2,AUDIO_BUFFERS); - sound_closed = FALSE; - //Mix_ResumeMusic(); - //Mix_Resume(-1); - -} diff --git a/src/gcompris/soundutil.c b/src/gcompris/soundutil.c index 3260ce1..9c7d97f 100644 --- a/src/gcompris/soundutil.c +++ b/src/gcompris/soundutil.c @@ -25,29 +25,30 @@ #include "gcompris.h" #include <signal.h> #include <glib.h> +#include <gst/gst.h> static GList *pending_queue = NULL; static int sound_policy; -static gboolean music_paused = FALSE; -static gboolean sound_closed = FALSE; +static gboolean fx_paused = FALSE; +static gboolean bg_paused = FALSE; -/* mutex */ -GMutex *lock = NULL; -GMutex *lock_music = NULL; -GMutex *lock_fx = NULL; -GCond *cond = NULL; +static GstElement *bg_pipeline = NULL; +static GstElement *fx_pipeline = NULL; + +static guint bg_music_index; +static gint gc_bg_timer_id = 0; + +GSList *music_list; /* Singleton */ static guint sound_init = 0; /* Forward function declarations */ -GThread *thread_scheduler_fx, *thread_scheduler_music; - -static void *thread_play_ogg (gchar *file); +static void fx_play (); static char *get_next_sound_to_play( ); -static gpointer scheduler_fx (gpointer user_data); -static gpointer scheduler_music (gpointer user_data); +static gpointer bg_play (gpointer dummy); +static GSList *bg_build_music_list(); /* sound control */ GObject *gc_sound_controller = NULL; @@ -61,97 +62,144 @@ void gc_sound_init() { - /* Check to run the init once only */ + /* Check to run the init only once */ if(sound_init == 1) - { - if(sound_closed == TRUE) - gc_sound_reopen(); + return; - return; - } sound_init = 1; - gc_sound_controller = g_object_new (GCOMPRIS_SOUND_TYPE, NULL); - - g_signal_connect( gc_sound_controller, - "sound-played", - (GCallback) gc_sound_callback, - NULL); + /* gstreamer init */ + gst_init(NULL, NULL); - g_assert( gc_sound_controller != NULL ); - - /* Initialize the thread system */ - if (!g_thread_supported ()) g_thread_init (NULL); + sound_policy = PLAY_AFTER_CURRENT; - lock = g_mutex_new (); - lock_music = g_mutex_new (); - lock_fx = g_mutex_new (); - cond = g_cond_new (); + /* Delay to let gcompris intialisatiobg_build_music_list()n and intro music to complete */ + music_list = bg_build_music_list(); + gc_bg_timer_id = gtk_timeout_add(25000, + (GtkFunction)bg_play, + NULL); +} - sound_policy = PLAY_AFTER_CURRENT; +static gboolean +fx_bus(GstBus* bus, GstMessage* msg, gpointer data) +{ + switch( GST_MESSAGE_TYPE( msg ) ) + { + case GST_MESSAGE_EOS: + gc_sound_fx_close(); + fx_play(); + g_warning("fx_bus: EOS"); + break; + default: + break; + } + return TRUE; +} - if(sdlplayer_init()!=0) { - /* Sound init failed. Desactivate the sound */ - gc_prop_get()->music = 0; - gc_prop_get()->fx = 0; - return; +static gboolean +bg_bus(GstBus* bus, GstMessage* msg, gpointer data) +{ + switch( GST_MESSAGE_TYPE( msg ) ) { + case GST_MESSAGE_EOS: + g_warning("bg_bus: EOS"); + gc_sound_bg_close(); + bg_play(NULL); + break; + default: + break; } + return TRUE; +} - thread_scheduler_fx = g_thread_create((GThreadFunc)scheduler_fx, NULL, FALSE, NULL); - if (thread_scheduler_fx == NULL) - perror("create failed for fx scheduler"); - - thread_scheduler_music = g_thread_create((GThreadFunc)scheduler_music, NULL, FALSE, NULL); - if (thread_scheduler_music == NULL) - perror("create failed for music scheduler"); +void +gc_sound_close() +{ + gc_sound_bg_close(); + gc_sound_fx_close(); +} +void +gc_sound_bg_close() +{ + if (bg_pipeline) + { + gst_element_set_state(bg_pipeline, GST_STATE_NULL); + gst_element_get_state(bg_pipeline, NULL, NULL, 1000*GST_MSECOND); + gst_object_unref(GST_OBJECT(bg_pipeline)); + bg_pipeline = NULL; + } } void -gc_sound_close() +gc_sound_fx_close() { - if ( !sound_closed ) + if (fx_pipeline) { - sound_closed = TRUE; - if ( music_paused ) { - music_paused = FALSE; - gc_sound_resume(); - } - g_mutex_lock(lock_fx); - sdlplayer_halt_music(); - sdlplayer_halt_fx(); - g_mutex_lock(lock_music); - sdlplayer_close(); + gst_element_set_state(fx_pipeline, GST_STATE_NULL); + gst_element_get_state(fx_pipeline, NULL, NULL, 1000*GST_MSECOND); + gst_object_unref(GST_OBJECT(fx_pipeline)); + fx_pipeline = NULL; } } void +gc_sound_bg_reopen() +{ + bg_play(NULL); +} + +void +gc_sound_fx_reopen() +{ +} + +void gc_sound_reopen() { - if (gc_prop_get()->fx || gc_prop_get()->music) { - if (sound_closed) - { - sdlplayer_reopen(); - g_mutex_unlock(lock_fx); - g_mutex_unlock(lock_music); - sound_closed = FALSE; - music_paused = FALSE; - } + gc_sound_bg_reopen(); + gc_sound_fx_reopen(); +} + +void +gc_sound_bg_pause() +{ + if (bg_pipeline) + { + gst_element_set_state(bg_pipeline, GST_STATE_PAUSED); } + bg_paused = TRUE; } void -gc_sound_pause() +gc_sound_bg_resume() { - sdlplayer_pause_music(); - music_paused = TRUE; + if(bg_pipeline) + { + gst_element_set_state(bg_pipeline, GST_STATE_PLAYING); + gst_element_get_state(bg_pipeline, NULL, NULL, 1000*GST_MSECOND); + } + bg_paused = FALSE; } void -gc_sound_resume() +gc_sound_fx_pause() { - sdlplayer_resume_music(); - music_paused = FALSE; + if (fx_pipeline) + { + gst_element_set_state(fx_pipeline, GST_STATE_PAUSED); + } + fx_paused = TRUE; +} + +void +gc_sound_fx_resume() +{ + if(fx_pipeline) + { + gst_element_set_state(fx_pipeline, GST_STATE_PLAYING); + gst_element_get_state(fx_pipeline, NULL, NULL, 1000*GST_MSECOND); + } + fx_paused = FALSE; } /* ===================================================================== @@ -177,24 +225,17 @@ gc_sound_policy_get() return sound_policy; } -/* ===================================================================== - * Thread scheduler background : - * - launches a single thread for playing and play any file found - * in the gcompris music directory - ======================================================================*/ -static gpointer -scheduler_music (gpointer user_data) +static GSList * +bg_build_music_list() { GcomprisProperties *properties = gc_prop_get(); - gint i; gchar *str; gchar *music_dir; GSList *musiclist = NULL; GDir *dir; const gchar *one_dirent; - /* Sleep to let gcompris intialisation and intro music to complete */ - g_usleep(25000000); + bg_music_index = 0; /* Load the Music directory file names */ music_dir = g_strconcat(properties->package_data_dir, "/music/background", NULL); @@ -213,7 +254,8 @@ scheduler_music (gpointer user_data) if (g_str_has_suffix(one_dirent, ".ogg")) { str = g_strdup_printf("%s/%s", music_dir, one_dirent); - musiclist = g_slist_insert (musiclist, str, RAND(0, g_slist_length(musiclist))); + musiclist = g_slist_insert (musiclist, str, + RAND(0, g_slist_length(musiclist))); } } g_dir_close(dir); @@ -225,92 +267,108 @@ scheduler_music (gpointer user_data) return NULL; } - /* Now loop over all our music files */ - while (TRUE) - { - for(i=0; i<g_slist_length(musiclist); i++) - { - /* Music can be disabled at any time */ - while(!gc_prop_get()->music || music_paused || sound_closed) - g_usleep(1000000); - - /* WARNING Displaying stuff in a thread seems to make gcompris unstable */ - /* display_ogg_file_credits((char *)g_list_nth_data(musiclist, i)); */ - // if(decode_ogg_file((char *)g_list_nth_data(musiclist, i))!=0) - g_mutex_lock(lock_music); - if(sdlplayer_music((char *)g_slist_nth_data(musiclist, i), 128)!=0){ - g_warning("sdlplayer_music failed, try again in 5 seconds"); - g_usleep(5000000); - } - g_mutex_unlock(lock_music); - - } - } - - /* Never happen */ - g_slist_free(musiclist); - g_warning( "The background thread music is stopped now. "\ - "The files in %s are not ogg vorbis OR the sound output failed", - music_dir); - g_free(music_dir); - return NULL; + return(musiclist); } + /* ===================================================================== - * Thread scheduler : - * - launches a single thread for playing a file - * - joins the previous thread at its end - * - then launches another thread if some sounds are pending - * - the thread never ends + * Thread scheduler background : + * - launches a single thread for playing and play any file found + * in the gcompris music directory ======================================================================*/ static gpointer -scheduler_fx (gpointer user_data) +bg_play(gpointer dummy) { - char *sound = NULL; + gchar *absolute_file; + + /* Music wrapping */ + if(bg_music_index >= g_slist_length(music_list)) + bg_music_index = 0; - while (TRUE) + absolute_file = gc_file_find_absolute(g_slist_nth_data(music_list, bg_music_index)); + + if (!absolute_file) + return NULL; + + bg_pipeline = gst_element_factory_make ("playbin", "play"); + + if(!bg_pipeline) { - if ( ( sound = get_next_sound_to_play( ) ) != NULL ) - { - thread_play_ogg(sound); - g_free(sound); - } - else - { - g_mutex_lock (lock); - g_cond_wait (cond, lock); - g_mutex_unlock (lock); - } + g_warning("Failed to build the gstreamer pipeline (for background music)"); + gc_prop_get()->music = 0; + return NULL; } - return NULL; + + gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (bg_pipeline)), + bg_bus, bg_pipeline); + + + gchar *uri = g_strconcat("file://", absolute_file, NULL); + g_free(absolute_file); + g_warning(" bg_play %s", uri); + + g_object_set (G_OBJECT (bg_pipeline), "uri", uri, NULL); + + GstStateChangeReturn statechanged = gst_element_set_state (bg_pipeline, + GST_STATE_PLAYING); + gst_element_get_state(bg_pipeline, NULL, NULL, 1000*GST_MSECOND); + if( statechanged == GST_STATE_CHANGE_SUCCESS) { + g_warning("%s : bg_playing\n",__FUNCTION__); + } + + g_free(uri); + + return(NULL); } + /* ===================================================================== * Thread function for playing a single file ======================================================================*/ -static void* -thread_play_ogg (gchar *file) +static void +fx_play() { + gchar *file = get_next_sound_to_play(); gchar *absolute_file; + GcomprisProperties *properties = gc_prop_get(); + + if(!file) + return; - g_warning(" Thread_play_ogg %s", file); + g_warning(" fx_play %s", file); absolute_file = gc_file_find_absolute(file); + g_free(file); - if (!absolute_file) - return NULL; + if (!absolute_file || + !properties->fx) + return; + + fx_pipeline = gst_element_factory_make ("playbin", "play"); - g_warning(" Calling gcompris internal sdlplayer_file (%s)", absolute_file); - g_mutex_lock(lock_fx); - sdlplayer_fx(absolute_file, 128); - g_mutex_unlock(lock_fx); - g_signal_emit (gc_sound_controller, - GCOMPRIS_SOUND_GET_CLASS (gc_sound_controller)->sound_played_signal_id, - 0 /* details */, - g_strdup(file)); - g_warning(" sdlplayer_fx(%s) ended.", absolute_file); + if (!fx_pipeline) + { + g_warning("Failed to build the gstreamer pipeline"); + gc_prop_get()->fx = 0; + return; + } + gchar *uri = g_strconcat("file://", absolute_file, NULL); g_free(absolute_file); + g_warning(" uri '%s'", uri); + + g_object_set (G_OBJECT (fx_pipeline), "uri", uri, NULL); + gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (fx_pipeline)), + fx_bus, fx_pipeline); + + GstStateChangeReturn statechanged = gst_element_set_state (fx_pipeline, + GST_STATE_PLAYING); + gst_element_get_state(fx_pipeline, NULL, NULL, 1000*GST_MSECOND); + if( statechanged == GST_STATE_CHANGE_SUCCESS) { + g_warning("%s : fx_playing\n",__FUNCTION__); + } - return NULL; + g_free(uri); + + return; } /* ===================================================================== @@ -321,8 +379,6 @@ get_next_sound_to_play( ) { char* tmpSound = NULL; - g_mutex_lock (lock); - if ( g_list_length(pending_queue) > 0 ) { tmpSound = g_list_nth_data( pending_queue, 0 ); @@ -330,8 +386,6 @@ get_next_sound_to_play( ) g_warning( "... get_next_sound_to_play : %s\n", tmpSound ); } - g_mutex_unlock (lock); - return tmpSound; } @@ -424,11 +478,9 @@ gc_sound_play_ogg_list( GList* files ) pending_queue = g_list_remove( pending_queue, tmpSound ); g_free(tmpSound); } - sdlplayer_halt_fx(); + // sdlplayer_halt_fx(); } - g_mutex_lock (lock); - list = g_list_first( files ); while( list!=NULL ) { @@ -439,12 +491,7 @@ gc_sound_play_ogg_list( GList* files ) list = g_list_next(list); } - g_mutex_unlock (lock); - - // Tell the scheduler to check for new sounds to play - g_warning("Tell the scheduler to check for new sounds to play\n"); - g_cond_signal (cond); - + fx_play(); } /** return a string representing a letter or number audio file diff --git a/src/gcompris/soundutil.h b/src/gcompris/soundutil.h index 13a5c89..1e3bf8b 100644 --- a/src/gcompris/soundutil.h +++ b/src/gcompris/soundutil.h @@ -43,28 +43,19 @@ void gc_sound_policy_set(int); int gc_sound_policy_get(void); void gc_sound_init(void); void gc_sound_reopen(void); +void gc_sound_bg_reopen(void); +void gc_sound_fx_reopen(void); void gc_sound_close(void); -void gc_sound_pause(void); -void gc_sound_resume(void); +void gc_sound_bg_close(void); +void gc_sound_fx_close(void); +void gc_sound_bg_pause(void); +void gc_sound_fx_pause(void); +void gc_sound_bg_pause(void); +void gc_sound_fx_pause(void); +void gc_sound_bg_resume(void); +void gc_sound_fx_resume(void); int decode_ogg_file(char *infile); -void display_ao_devices(); - -/* - * SDL PLAYER - */ -int sdlplayer_init(); -void sdlplayer_close(); -void sdlplayer_reopen(); - -int sdlplayer_music(char *filename, int volume); -void sdlplayer_halt_music(); -void sdlplayer_pause_music(); -void sdlplayer_resume_music(); - -void sdlplayer_halt_fx(); -void sdlplayer_resume_fx(); -int sdlplayer_fx(char *filename, int volume); gchar *gc_sound_alphabet(gchar *chars); |