GtkTextView and GtkSourceView



Hi

I'm working on MonoDevelop (specifically code completion) where we use
GtkSourceView.

I want to extend MonoDevelop's source editor with various features and I
will add them either through Mono or help you adding them to GtkTextView
(or. GtkSourceView) directly (if you plan to extend either of those
widgets with the features we desire).

I would be extremely thankful if you help me with the following
questions:

The obvious:

1. Are you planning to add code folding to either GtkTextView or
GtkSourceView? If so, how can I help - whom do I have to contact (those
involved in TextView, SourceView or both)?

  If you don't plan to add the folding feature, I have some other
questions about TextView:

  1.1. If you look at the attached image (borders.png), you can see that
the folded text is not displayed. I suppose I can achieve this with
merely marking the range of text with appropriate tags and force the
TextView to do whatever is needed to fold it into one line.

  The harder part is obviously to tell TextView to actually not draw the
whole text but only a part of it (and not into multiple lines but into
one line only). If you have any ideas of how this could be achieved, I'd
be extremely happy if you'd share them with me - only some hints could
suffice.

  1.2. Line numbering - if you look at the attached image (borders.png),
you'll see that the natural order of line numbers has changed. I've been
investigating how GtkSourceView discovers the line numbers, and have
found out that in the end it is a TextIter that tells SourceView which
line number we are currently in. Thus, it seems that such a thing is
possible, but TextEditor (or better, the internal TextLayout) would have
to figure out correctly that, beyond the line in which that fold is,
there is different text than expected.

  The question is whether such page number jumps are possible, and how
would you go about and implement them in, say, TextView or SourceView?
In fact I'm still not sure how TextLayout knows which part of a
TextBuffer belongs to which line, so I'd be thankful if any of you'd
give me some hints.

  1.3. Borders around text: I've been playing with TextTags in TextView
and I haven't found a way to box the text with a border. I guess this is
not supported in Pango? Is there an easy way to implement it?

  1.4. Would it be possible to implement the above in a child widget
(that inherits TextView or SourceView)? I ask this because I'm not sure
whether one can influence the way lines are numbered in TextView from a
child. What is more, I have the fear that leaving out text (i.e. not
drawing ALL the text from the TextBuffer) is also very hard to achieve
from a child.


2. Suppose we have folds implemented (see image folds.png). How could we
catch mouse clicks on that little expand/collapse box (in the left
margin)? And how could we discover that the mouse was clicked on the
bordered text (or any text for that matter)? Is this already implemented
in TextView?


I would be extremely happy if you shared you knowledge with me. Thank
you in advance.


Best regards,
---
Matej

Attachment: borders.png
Description: PNG image

Attachment: folds.png
Description: PNG image



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