On 09/14/2010 02:20 PM, Uwe Stöhr wrote:
Am 14.09.2010 08:21, schrieb Abdelrazak Younes:
I tried several approaches to achieve this but only the one via a
global variable does the job. Attached is the corresponding patch. It
fixes the problem exactly as it should, but I would like to get rid of
the global variable. Is there a better solution for that?
There must be. In any case the global variable is not acceptable, it is
doomed to fail.
Global variables are evil but only if you change them in several
routines. Here it is only changed in one routine and only accessed
once later on. So right now it is safe.
It is not safe. You have no idea in which text inset it will be updated
(think nested inset); you also have no idea in which work area it was
updated (think split view or multi windows). This global variable is
simply not acceptable.
But I fully agree that this is not the best solution.
I haven't looked at the code and don't understand the
problem right now
You would very much help me very much if you could look at the code.
As said my problem is that the value "w" (the text width) is
calculated in TextMetrics::redoParagraph. I need to have this value in
InsetLine::draw. I didn't find a better solution for this than to use
a global variable and are now looking for an alternative.
So you just need the inset width AFAIU which happens to be egal to the
text width of the enclosing text inset... I guess this is a simple
patch, I'll have a look.
, especially this:
// FIXME: text_metrics_.width() is only about 1.0857 * mi.base.textwidth
pi_.base.textwidth = text_metrics_.width();
You can ignore this, my patch reverts this.
I wanted to know where this value of 1.0857 came from...
Abdel.