Re: porting gdk - cairo

2010-08-11 Thread jcupitt
On 11 August 2010 02:14, Allin Cottrell cottr...@wfu.edu wrote:
 rid of GdkGC.  I'd imagine that the effect I'm after is something
 that many GTP apps have need of, and it's trivial to achieve with
 the GDK API.

I've found that XOR rubber banding is quite hard to do reliably in
gdk.  The problem I think is that you are using the screen pixels to
store part of the state, and that gets hard to coordinate between the
various things that can affect the display.

I had mouse movements triggering rect moves, mouse moves with a button
held down causing background scrolling of the canvas, and mouse moves
over other screen objects triggering highlight effects. With all these
things going on at once it became very difficult to get XOR rubber
bands to not leave annoying trails as they moved.

I switched to an update-model / invalidate-widget / redraw-on-idle
scheme as Dov suggests and I got prettier updates with less
complication. Since input and output are decoupled, it'll scale more
gracefully between slower and faster machines as well, which is nice.

Anyway, my 2p.

John
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: porting gdk - cairo

2010-08-11 Thread Jean-Philippe Chancelier

Allin (in response to my query about drawing a resizable outline rectangle
Allin on top of an image displayed in a GTK window, using cairo instead of
Allin the GDK drawing API)

I have a naive question about the port  gdk - cairo. 
Is the cairo port drawing supposed to be as fast as the 
gdk cairo drawing ? I have an application which can perform
graphics (graphs, surfaces) through cairo or gdk or gtkglext and 
I have experienced that using cairo is really slower compared 
to gdk. I would have liked to know is this is only a side effect of 
my implementation or a general fact. 
jpc











___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GtkIconView remove item

2010-08-11 Thread Alexander Kuleshov
Hello,

I have GtkIconView in my C/gtk+ application. How to remove selected
item of this GktIconView. I can select item, how can i delete this
row?

Thank you
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GtkIconView remove item

2010-08-11 Thread Tadej Borovšak
Hi.

You need to remove the data from underlying model and your icon view
will get updated automatically.

Sample code that is capable of removing multiple items at a time would
look like this:
--
GtkIconView  *icon_view;
GtkListStore *store;
GList*elements,
 *iter;

/* Initialize icon_view here */

elements = gtk_icon_view_get_selected_items (icon_view);

/* Convert to row references for safe removal */
for (iter = elements; iter; iter = g_list_next (iter))
{
  GtkTreeRowReference *ref;
  GtkTreePath *path = (GtkTreePath *)iter-data;

  ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (store), path);
  gtk_tree_path_free (path);
  iter-data = ref;
}

/* Remove now */
for (iter = elements; iter; iter = g_list_next (iter))
{
  GtkTreeRowReference *ref = (GtkTreeRowReference *)iter-data;
  GtkTreePath *path;
  GtkTreeIter  remove_me;

  path = gtk_tree_row_reference_get_path (ref);
  gtk_tree_model_get_iter (GTK_TREE_MODEL (store), remove_me, path);
  gtk_tree_path_free (path);

  gtk_list_store_remove (store, remove_me);
  gtk_tree_row_reference_free (ref);
}

g_list_free (elements);
-

Tadej

-- 
Tadej Borovšak
tadeboro.blogspot.com
tadeb...@gmail.com
tadej.borov...@gmail.com
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: porting gdk - cairo

2010-08-11 Thread Allin Cottrell
On Wed, 11 Aug 2010 jcup...@gmail.com wrote:


 On 11 August 2010 02:14, Allin Cottrell cottr...@wfu.edu wrote:
  rid of GdkGC.  I'd imagine that the effect I'm after is something
  that many GTP apps have need of, and it's trivial to achieve with
  the GDK API.

 I've found that XOR rubber banding is quite hard to do reliably in
 gdk.  The problem I think is that you are using the screen pixels to
 store part of the state, and that gets hard to coordinate between the
 various things that can affect the display.

 I had mouse movements triggering rect moves, mouse moves with a button
 held down causing background scrolling of the canvas, and mouse moves
 over other screen objects triggering highlight effects. With all these
 things going on at once it became very difficult to get XOR rubber
 bands to not leave annoying trails as they moved.

 I switched to an update-model / invalidate-widget / redraw-on-idle
 scheme as Dov suggests and I got prettier updates with less
 complication. Since input and output are decoupled, it'll scale more
 gracefully between slower and faster machines as well, which is nice.

My drawing case may be simpler than yours -- there's nothing
scrollable in the vicinity -- but I've found that rubber-banding
using GDK_INVERT to undraw the last box works flawlessly at
low programming cost.

But can you suggest a good example to look at for the alternative
approach? Thanks.

Allin Cottrell
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list