Re: Split TextView



On 02/23/2017 01:55 PM, Tuur Dutoit wrote:
Ideally, every page would be a TextView, all backed by 1 TextBuffer, but
that doesn't seem to be possible (out of the box)...

How would you do this?

  Why wouldn't that be possible? Each text view allows you to test focus on
the text view directly do something similar to the following for each
text_view window:

gtk_text_view_get_visible_rect (GtkTextView *text_view,
                                GdkRectangle *visible_rect);

and from that get an iter:

gtk_text_view_get_iter_location (GtkTextView *text_view,
                                 const GtkTextIter *iter,
                                 GdkRectangle *location);

  Which you can check against the current "insert" mark and iter obtained from:

GtkTextMark *
gtk_text_buffer_get_insert (GtkTextBuffer *buffer);

void
gtk_text_buffer_get_iter_at_mark (GtkTextBuffer *buffer,
                                  GtkTextIter *iter,
                                  GtkTextMark *mark);

  The text view with the "insert" mark would scroll on its own as you advance
the cursor (just as using a single text view would). I don't see any problem
switching between the views to control the split-view you are trying to create.

-- 
David C. Rankin, J.D.,P.E.


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