Re: [gedit-list] Plugins: How to get the boundaries of a view within a buffer?



Hi Gonzalo,

Il giorno mer, 10/06/2009 alle 21.22 -0300, Gonzalo Sainz Trápaga ha
scritto:
> Note: I sent this mail yesterday but it's queued for moderator
> approval. I just subscribed to the list so I am sending it again.
> 

Yeah, we inspect the moderation queue from time to time, but subscribing
is better. My anser below.

> What I can't figure out is how to know which lines of the buffer are
> being displayed in a view, or how to get a GtkTextIter pointing to the
> boundaries of the view. Something like GtkTextBuffer.get_bounds() but
> for a view instead of a buffer. Is there such a thing in
> GtkSourceView? I haven't been able to find anything on the web. For
> example:
> 
> Line1
> Line2
> ---------- view begins here
> Line3
> Line4
> ---------- view ends here
> Line5
> 
> I need to get the line numbers for the beginning and end of the view,
> and if possible keep this information updated when scrolling or
> insertion/deletion occurs. I can bind to the corresponding signals for
> this, I guess.
> 

You can use gtk_text_view_get_visible_rect to obtain the visible
rectangle and then gtk_text_view_get_line_at_y to obtain the
corresponding iters.


Ciao,

	Paolo


> Links or hack suggestions to obtain these numbers are very much welcome.
> 
> Thanks!
> 
> Gonzalo
> _______________________________________________
> gedit-list mailing list
> gedit-list gnome org
> http://mail.gnome.org/mailman/listinfo/gedit-list
> 



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