Footnote callers
- From: Teus Benschop <teus teusbenschop nl>
- To: gtk-list gnome org
- Subject: Footnote callers
- Date: Sat, 11 Mar 2006 06:33:15 +0200
Hello,
Does anybody how to tackle the following matter?
Bibledit is an editor and can show footnotes etc. The footnote caller is
the character of sequence of characters that is put in the text in a
smaller font scale and a bit risen, as usually is done in editors. This
is done by applying a GtkTextTag. As long as the footnote caller is one
character, everything goes fine. But if the footnote caller becomes "10"
or "11" or higher, then the user can backspace or delete one character
of the two, so that the "10" becomes "1" after the "0" has been erased,
and the "11" becomes "1" too.
So my question is, is there any way to glue the two characters together,
so that backspace or delete deletes both of them, and not only one at at
time?
I tried to set the "editable" property to false, but then the footnote
caller cannot be deleted anymore.
Any ideas are welcome.
Thanks,
Teus.
PS. Some code that deals with this is pasted below.
// Get the line.
ustring line = gtk_text_buffer_get_text (mytextbuffer, &iterator,
&endofline, false);
// Handle the notes: footnote, endnote, xref.
editornote.extract (line);
for (unsigned int i2 = 0; i2 < editornote.texts.size(); i2++) {
// Format the caller as a hyperlink and make it smaller and
superscript.
// Attach some data to the tag, to make it recognizable.
// The rendered caller should not be editable, and this can be
done using the
// "editable" property, but the problem is that when there are two
or more
// callers in sequence, the whole area becomes non-editable, so
nothing
// can be inserted in between. Also cutting the caller no longer
works.
// I don't know how to solve that in Gtk.
// If the rendered caller is more than one character, it should stick
// together, but I don't know how to do that.
GtkTextTag *tag;
tag = gtk_text_buffer_create_tag (mytextbuffer, NULL,
"foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE,
"rise", 5 * PANGO_SCALE, "scale", PANGO_SCALE_SMALL, NULL);
g_object_set_data (G_OBJECT (tag), "id", GINT_TO_POINTER
(myeditorobjects->size()));
GtkTextIter startiter, enditer;
gtk_text_buffer_get_iter_at_line_offset (mytextbuffer, &startiter,
i, editornote.positions[i2]);
gtk_text_buffer_get_iter_at_line_offset (mytextbuffer, &enditer,
i, editornote.positions[i2] + editornote.lengths[i2]);
gtk_text_buffer_delete (mytextbuffer, &startiter, &enditer);
gtk_text_buffer_insert_with_tags (mytextbuffer, &startiter,
editornote.rendered_callers[i2].c_str(),
editornote.rendered_callers[i2].length(), tag, NULL);
EditorObject editorobject (editornote.types[i2]);
editorobject.note_set (editornote.openers[i2],
editornote.callers[i2], editornote.texts[i2], editornote.closers[i2]);
myeditorobjects->push_back (editorobject);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]