Re: GooCanvas & Gtk3



On Tue, 2013-05-14 at 11:00 +0200, Sven Anders wrote:

Hello!

I want to implement a small special-purpose graphical editor (similar to Dia or MS-Visio).
Currently I'm trying to decide which Canvas I should use.

The GooCanvas is currently the most promising option, but in this mail you mentioned "Clutter".

Now I'm not sure, if this may be an option too. Do you know Clutter? And may this be the better
option (because it's not really actively maintained)? I need a canvas which I can place my
"item" on and want to have a simple interface to get select items via a mouse-click and to
manipulate them (i.e. moving around, resizing, grouping).

I haven't been keeping up with Clutter development recently, so I can't
say for sure. Though it has close links with Gnome now since it is used
in the Gnome Shell.



This leads me to another question:

I'm trying to implement a "GooCanvasEditor" class. I want to connect the mouse event signals
to each item I add to the Canvas, but I cannot figure out, what is the best method to do
this...

I tried to override and connect to the "add" signal of the Gtk.Container class, but this does
not work. The "item-created" signal is only available in the Model/View variant, but this may
be deprecated?!

Any ideas?

In the demo (demo/demo.c) it calls a function after adding each item
like this:

  item = goo_canvas_rect_new (root, 20, 30, 50, 30,
                              "stroke-color", "red",
                              "line-width", 8.0,
                              "tooltip", "Red stroked rectangle",
                              NULL);
  setup_item_signals (item);



static void
setup_item_signals (GooCanvasItem *item)
{
  g_signal_connect (item, "motion_notify_event",
                    G_CALLBACK (on_motion_notify), NULL);
  g_signal_connect (item, "button_press_event",
                    G_CALLBACK (on_button_press), NULL);
  g_signal_connect (item, "button_release_event",
                    G_CALLBACK (on_button_release), NULL);
}

That's probably the easiest thing to do.

Damon





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]