lyx_mirror/src/frontends/controllers
John Levon d08db91ed0 Rob's changes patch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6500 a592a061-630c-0410-9148-cb99ea01b6c8
2003-03-14 11:31:07 +00:00
..
.cvsignore
BCView.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
BCView.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
BCView.tmpl * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
biblio.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
biblio.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ButtonController.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ButtonController.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ButtonPolicies.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ButtonPolicies.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ChangeLog Rob's changes patch 2003-03-14 11:31:07 +00:00
character.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
character.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlAboutlyx.C Port the About LyX dialog to the Dialog scheme. 2003-03-09 20:29:58 +00:00
ControlAboutlyx.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlBibtex.C Collapse all those LFUN_XYZ_APPLY to a single LFUN_INSET_APPLY. 2003-02-27 13:26:07 +00:00
ControlBibtex.h Hold on to your hats. 2003-02-25 14:51:38 +00:00
ControlButtons.C Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ControlButtons.h Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ControlChanges.C Rob's changes patch 2003-03-14 11:31:07 +00:00
ControlChanges.h Rob's changes patch 2003-03-14 11:31:07 +00:00
ControlCharacter.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlCharacter.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlCitation.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlCitation.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlCommand.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlCommand.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlCommandBuffer.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlCommandBuffer.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlConnections.C Hold on to your hats. 2003-02-25 14:51:38 +00:00
ControlConnections.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlDialog_impl.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlDialog_impl.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlDialog.h * A controller-view split of the math panel and its daughter dialogs. 2002-11-25 18:58:15 +00:00
ControlDialog.tmpl Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ControlDocument.C Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ControlDocument.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlError.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlError.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlERT.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlERT.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlExternal.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlExternal.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlFloat.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlFloat.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlForks.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlForks.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlGraphics.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlGraphics.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlInclude.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlInclude.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlLog.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlLog.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlMath.C Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ControlMath.h Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ControlMinipage.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlMinipage.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlParagraph.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlParagraph.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlPreamble.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlPreamble.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlPrefs.C Alfredo's patch 2003-02-28 09:49:49 +00:00
ControlPrefs.h Whitespace only 2003-02-21 15:36:29 +00:00
ControlPrint.C Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ControlPrint.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlRef.C Collapse all those LFUN_XYZ_APPLY to a single LFUN_INSET_APPLY. 2003-02-27 13:26:07 +00:00
ControlRef.h Hold on to your hats. 2003-02-25 14:51:38 +00:00
ControlSearch.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlSearch.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlSendto.C Alfredo's patch 2003-02-28 09:49:49 +00:00
ControlSendto.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlShowFile.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlShowFile.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlSpellchecker.C Whitespace only 2003-02-21 15:36:29 +00:00
ControlSpellchecker.h spell rework. revert fix 2003-02-17 18:40:04 +00:00
ControlTabular.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlTabular.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlTabularCreate.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlTabularCreate.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlTexinfo.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlTexinfo.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlThesaurus.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlThesaurus.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlToc.C Collapse all those LFUN_XYZ_APPLY to a single LFUN_INSET_APPLY. 2003-02-27 13:26:07 +00:00
ControlToc.h Hold on to your hats. 2003-02-25 14:51:38 +00:00
ControlVCLog.C Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ControlVCLog.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ControlWrap.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlWrap.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
Dialog.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
Dialog.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
frnt_lang.C dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
frnt_lang.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
GUI.h Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
helper_funcs.C The file dialog browser doesn't need a LyXView... 2003-02-21 12:22:25 +00:00
helper_funcs.h The file dialog browser doesn't need a LyXView... 2003-02-21 12:22:25 +00:00
Kernel.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
Kernel.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
Makefile.am Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
README
tex_helpers.C Whitespace only 2003-02-21 15:36:29 +00:00
tex_helpers.h dont use pragma impementation and interface anymore 2003-02-13 16:53:15 +00:00
ViewBase.C Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
ViewBase.h Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00

This directory provides the controllers that act as an interface between the
LyX kernel and the GUI-specific implementations of each dialog. It also
provides abstract base classes from which GUI-specific implemetations of the
ButtonController and each separate dialog should be derived (see
ButtonControlBase.[Ch] and ViewBase.h respectively).

The Controller connects the GUI-specific dialog to any appropriate signals and
dispatches any changes in the data to the kernel. It has no knowledge of the
actual instantiation of the GUI-dependent View and ButtonController, which
should therefore be created elsewhere. Once created, the Controller will take
care of their initialisation, management and, ultimately, destruction.

This leaves the GUI-specific dialog (and its author!) to worry only about the
data that it has been created to input/modify.

This concept has been instatiated for the Citation dialog only at the moment.
See xforms-new/FormCitation.[Ch] for an xforms-specific View of the dialog.

How the code works.
===================

I'll describe Inset-type dialogs (eg, the Citation dialog). Non-inset-type
(eg the Document dialog) have similar  flow, but the important controller 
functions are to be found in ControlDialogs.h, not ControlInset.h.

Let's use the citation dialog as an example.

The dialog is launched by :
	a) clicking on an existing inset, emitting the showCitation()
(Dialogs.h) signal, connected to the showInset() slot
(controllers/ControlInset.h) in theControlCitation c-tor.
	b) request a new inset (eg from the menubar), emitting a
createCitation() signal (Dialogs.h) connected to the createInset()
slot (controllers/ControlInset.h) in theControlCitation c-tor. 

The user presses the Ok, Apply, Cancel or Restore buttons. In xforms
these are connected to the button controller (xforms/FormCitation.C:
build) so: 
	bc().setOK(dialog_->button_ok);
	bc().setApply(dialog_->button_apply);
	bc().setCancel(dialog_->button_cancel);
	bc().setRestore(dialog_->button_restore);
The button controller alters the state of the buttons (active/inactive). 
xforms works by callbacks, so clicking on say the button_ok button
causes a callback event to (see FormBase.C) 

extern "C" void C_FormBaseOKCB(FL_OBJECT * ob, long)
{
	GetForm(ob)->OKButton();
}

GetForm() extracts the actual instance of FormCitation that caused the
event and calls OKButton() (see controllers/ViewBase.h) which in turn
calls the controller's OKButton method. (The ViewBase method exists
only because : 
	/** These shortcuts allow (e.g. xform's) global callback functions
	    access to the buttons without making the whole controller_
	    public. */

So, ultimately, pressing button_ok on the Citation dialog calls
ControlBase::OKButton(). 

void ControlBase::OKButton()
{
	apply();
	hide();
	bc().ok();
}


apply() and hide() are pure virtual methods, instantiated in
ControlInset.h because the Citation dialog is an inset dialog and all
insets are functionally identical. 

template <class Inset, class Params>
void ControlInset<Inset, Params>::apply()
{
	if (lv_.buffer()->isReadonly())
		return;

	view().apply();

	if (inset_ && params() != getParams(*inset_))
		applyParamsToInset();
	else
		applyParamsNoInset();
}

applyParamsToInset() and applyParamsNoInset(); are to be found in
FormCommand.[Ch] because the citation inset is derived from
InsetCommand and this subset of insets have identical internal
structure and so the params can be applied in the same way.