> It is an admirable goal to pursuit, but my experience is that it is
> fairly difficult to design a truly generic Controller class across
> different toolkits.

Hi Asger,

Sure. However, I was going to start off by designing a class to control the 
interaction of the popup with the LyX kernel. This, at least, is common 
between all toolkits. Connecting, disconnecting signals, passing an instance 
of a Param class to the GUI-dependent Views (ie, a holder for the info to be 
changed/input) and finally retrieving this info and returning it to the LyX 
kernel.

This would mean that all the Views have to do is modify the Param instance.

Attached is a preliminary go for the Citation dialog. Note that it doesn't 
compile (not least because the View hasn't been created!), but it's complete 
and minimal and FEELS a lot better than what exists.

I've come to the conclusion that the ButtonController belongs in the View, 
rather than in my ControlCitation class (ie the class controlling the 
interaction with the kernel). It remains to be seen whether we can create a 
generic ButtonController (ie, put more functionality in the abstract 
ViewCitation abstract class).

Note also that I envisage xforms' callbacks and others' signals calling the 
Controller's apply() and hide() functions.

Ie, we'd go from:

void FormCitation::ApplyCB(FL_OBJECT * ob, long)
{
        FormCitation * pre = static_cast<FormCitation*>(ob->form->u_vdata);
        pre->apply();
        pre->bc_.apply();
}

to:

void FormCitation::ApplyCB(FL_OBJECT * ob, long)
{
        FormCitation * pre = static_cast<FormCitation*>(ob->form->u_vdata);
        pre->parent.apply(); // ControlCitation & parent;
        pre->bc_.apply();
}

Angus

MVC.tar.bz2

Reply via email to