> I'm wondering if we should remove all those "virtual"s I added in the
> classes derived from FormBase since they are declared private in the
> derived classes whereas they are protected in FormBase. We don't want to
> derive from the derived classes (apart from perhaps FormCommand) so we
> shouldn't need the "virtual" unless the picky compiler complains. But the
> picky compiler is more likely to complain about taking a protected
> function private I think. I only added the virtual tags in the first place
> so I could keep track of which stuff I had cleaned up.
The rule with virtual is, once declared virtual, always virtual. Subsequent
use of the "virtual" keyword is for human benefit only.
My compiler is sufficiently smart to work this out.
If I were you, I'd make the FormBase methods ok(), apply(), cancel() and
restore() non-virtual. That way they become clean interfaces with those
static CB functions and do exactly what is expected. The functions that they
themselves call should be the virtual methods --- as indeed they are.
Further clean ups:
1. Some of the classes in frontends/xforms are "noncopyable", some are not. I
think that they all should be, but you had a comment about compiler
complains?? What's the story?
2. I'll store a Dialogs * and a BufferDependency variable in FormBase, rather
than those two Signals.
3. We could lose all of those extra CB functions in FormDocument by making
use of the "long" variable that is returned. We'd end up with
void FormBase::InputCB(FL_OBJECT * ob, long data )
{
FormBase * pre = static_cast<FormBase*>(ob->form->u_vdata);
pre->bc_.valid( pre->input( data ) );
}
bool FormDocument::input( long data )
{
switch( data ) {
case 1:
...
case 2:
...
case 3:
...
}
}
We could even declare an enum to make the meaning of 1, 2, 3 transparent.
4. I do like your button controller! Shame that lyx is segfaulting on me, so
that I can't try it out.
5. Shall I have a go at porting the remaining dialogs, FormGraphics,
FormParagraph and FormTabular, to the FormBase way?
6. Anything else?
Comments solicited.
Angus