Tommaso Cucinotta wrote:
Hi all,

I'd like to know if, in the BufferView/TextMetrics classes,
there is any method that is always called every time there
is a change in the "paragraphs structure", i.e.:
-) after creating a new document
-) after opening a document
-) after breaking a paragraph in two or adding a new paragraph
  (i.e. hitting enter)
-) as a result of multi-paragraph cut or paste operations

One such method that I identified would seem to be updateMetrics(false),
but I'm not sure it captures all the cases.

'updateMetrics(false)' will rebreak all visible paragraph of the main Text. 'updateMetrics(true)' will try to rebreak only the currently edited paragraph.

void BufferView::updateMetrics(bool singlepar)
{
        if (singlepar && singleParUpdate())
                // No need to update the full screen metrics.
                return;


For example, what is the
TextMetrics::metrics() method used for ?

This will rebreak *all* paragraph of a given Text. This is only for Text object within an InsetText, but not for the main one. My ultimate goal is that it is used also for the Main text.


On a related note, is there any method always called in response to
a change in the window width ?

void BufferView::resize(int width, int height)
{
        // Update from work area
        width_ = width;
        height_ = height;

        updateMetrics(false);
}

Feel free to provide patch to document all this directly in the source code Tommaso.

Abdel.

Reply via email to