On Thu, 19 Oct 2000, Angus Leeming wrote:
[...]
> Anyway, find attached a patch that fixes possible crashes when resizing
> xforms dialogs.
[...]
> I decided that the cleanest thing to do was to set the minsize of ALL dialogs
> by doing it in FormBase::connect(). See attachment.
good.
> NOTE to anyone writing xforms dialogs:
> ============================
> Reading the xforms documentation, I discovered that the correct place to call
> fl_set_form_minsize()/maxsize() is BEFORE a call to fl_show_form(). Moreover,
> it is in force only until the next call to fl_show_form().
Which version of the docs? I have docs for 0.88 and they make no mention
of when you should call in. I did try minsize() before show_form() on one
test I'm sure with 0.88 and it made no difference. I'll test your stuff
and see what happens.
> QUESTION:
> =========
> Can someone explain why we pass pointers to the Dialog constructors. Eg:
>
> FormCitation::FormCitation(LyXView * lv, Dialogs * d)
>
> lv and d both exist when the dialog is constructed. Why not pass
> (LyXView & lv), etc? In fact, since lv and d are never changed, they can be
> stored as references also.
You should take a look at all those lovely long comments in Dialogs.C.
I wrote them two or three years ago but that doesn't make them outdated.
It boils down to this:
The dialogs are constructed within the Dialogs constructor which is called
within the LyXView constructor. I found you get a segfault if you use
anything other than a pointer (variable this in the calls to building the
dialogs). Why? because you are still within the constructor of the thing
you want to use.
Anyway, read the comments in Dialogs.C they are more comprehensive and
probably more correct in the description that what I just wrote.
> Similarly with:
>
> void FormCommand::showInset( InsetCommand * inset )
> {
> if (inset == 0) return; // maybe we should Assert this?
> ...
> }
>
> I think I'm right in saying that showInset is called only with a valid inset.
> In which case we should pass (InsetCommand & inset) and have no need to worry
> about Assert()ing anything.
>
> Thoughts?
But... Hmmm... We keep a
Inset * inset_;
now. Can we use a
Inset & inset_;
instead? I didn't think we could do
void FormCommand::showInset( InsetCommand & inset )
{
inset_ = inset;
...
}
and if we can what happens in the constructor?
Or are you planning on still using
Inset * inset_;
and just having:
void FormCommand::showInset( InsetCommand & inset )
{
inset_ = &inset;
...
}
Maybe I should brush up on using reference variables.
Allan. (ARRae)