Re: [gtkmm] Persistant Markup Tags from Gtk::TextBuffer...



On Sun, 2004-03-14 at 17:06, Dennis Craven wrote:
> Hello,
> 
> This is sort of a gtkmm/libxml++ post. I hope it is not out of place on
> this list.
> 
> My program is intended to create simple text documents with simple
> formatting (bold, italics, etc). It saves these documents in an XML file
> so that they will be read in on program startup with formatting intact.
> 
> At the moment, I have the formatting partially in place as far as the
> Gtk::TextBuffer/TextView are concerned. I can see the bolded text in the
> TextView. But when I export the file to XML, and read it back into the
> program, the formatting is lost.
> 
> Do I need to manually detect the formatting when I save the document to
> disk and insert the appropriate XML tags or is there a better way?

Yes.
1. I don't think TextView has any way to save its formatting.
2. If it did, it would not understand your XML format.
3. If it did, you'd probably then have 2 sets of saved text.

>  Same
> for reading, do I need to scan the XML file on disk for markup tags and
> manually apply the tag in the TextBuffer as it is loaded? I guess I
> don't really understand the format of the "tags" that GTK uses to markup
> text.

I don't think there is any format - it's data in memory.

> As I'm sure this has been done many times before, maybe there is a
> library that I should be using to read/write the XML data while
> preserving the TextBuffer tags, or maybe I'm using the proper libraries
> already, just not correctly.
> 
> Anyone here had much experience with such a task?

-- 
Murray Cumming
www.murrayc.com
murrayc murrayc com




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