Angus Leeming wrote:

Helge Hafting <[EMAIL PROTECTED]> writes:
Todays stupid question - what is a controller?

;-)

In LyX all our dialogs are represented by lyx::frontend::Dialog in
src/frontends/controllers/Dialog.[Ch]. This class uses two base classes,
lyx::frontend::Dialog::Controller and lyx::frontend::Dialog::View to control all
interaction between the LyX core and the GUI view of the dialog.
lyx::frontend::Dialog::Controller handles all sorts of stuff like
* serialization of data from the GUI into a string for dispatch back to the 
core,
* deserialization of a string into data to be diaplayed by the GUI,
* activation and deactivation of the Ok and Apply buttons,
* whether to hide the dialog when the LyX document is closed or changed.

All classes in the frontends/qt folder derive from lyx::frontend::Dialog::View
(ie, implement particular views of the data).
Thank you for the information. I was planning on doing something like this:
1. Create a working solution - that'd be both controller and dialog,
   so the horizontal spacing feature can be used in the GUI,
correct latex will be generated, the new stuff will be saved to the .lyx file
   and also understood when that file is opened by lyx later.
2. Submit a patch for all of this, and keep fixing it until it gets merged.
3. Try to make lyx->latex->lyx roundtrips work with the new features.
4. Try to make lyx->older lyx work, so a "spacing inset" will appear as
   ERT:\hspace{5cm}  when opened with older lyx.
5. If it turns out to be real easy, convert ERT in old files to new insets when opening an old file which implemented spacing with ERT. Not something I'll
   spend much time on though.

Reply via email to