lyx_mirror/src/frontends/controllers
Edwin Leuven b8008acbf1 apply Juergen Spitzmueller's changes to qt document dialog. save doc defaults and buffer update on apply now work.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5596 a592a061-630c-0410-9148-cb99ea01b6c8
2002-11-07 15:48:38 +00:00
..
.cvsignore
biblio.C * Add RegEx to the compiled boost files. 2002-11-07 15:24:06 +00:00
biblio.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ButtonController.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ButtonController.tmpl Rob's patch, part 1: the checked widget stuff. 2002-10-22 12:39:05 +00:00
ButtonControllerBase.C Rob's patch, part 1: the checked widget stuff. 2002-10-22 12:39:05 +00:00
ButtonControllerBase.h Rob's patch, part 1: the checked widget stuff. 2002-10-22 12:39:05 +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 apply Juergen Spitzmueller's changes to qt document dialog. save doc defaults and buffer update on apply now work. 2002-11-07 15:48:38 +00:00
character.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
character.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlAboutlyx.C STRCONV 2002-11-04 02:12:42 +00:00
ControlAboutlyx.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlBibitem.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlBibitem.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlBibtex.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlBibtex.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlButtons.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlButtons.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlCharacter.C the qtclean-2 patch with some very small changes 2002-10-20 01:48:28 +00:00
ControlCharacter.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlCitation.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlCitation.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlCommand.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlCommand.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlCommandBuffer.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlCommandBuffer.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlConnections.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlConnections.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +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 ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlDialog.tmpl Rob's patch, part 1: the checked widget stuff. 2002-10-22 12:39:05 +00:00
ControlDocument.C apply Juergen Spitzmueller's changes to qt document dialog. save doc defaults and buffer update on apply now work. 2002-11-07 15:48:38 +00:00
ControlDocument.h the qtclean-2 patch with some very small changes 2002-10-20 01:48:28 +00:00
ControlError.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlError.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlERT.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlERT.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlExternal.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlExternal.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlFloat.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlFloat.h Add insetwrap. 2002-09-10 10:18:58 +00:00
ControlForks.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlForks.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlGraphics.C QGraphics fixes 2002-11-07 00:21:28 +00:00
ControlGraphics.h Use getBBUnits in both frontends. 2002-11-04 14:53:03 +00:00
ControlInclude.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlInclude.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlIndex.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlIndex.h This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlInset.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlInset.tmpl Rob's patch, part 1: the checked widget stuff. 2002-10-22 12:39:05 +00:00
ControlLog.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlLog.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlMath.C small changes 2002-11-04 00:15:56 +00:00
ControlMath.h add latex_deco 2002-09-09 15:53:20 +00:00
ControlMinipage.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlMinipage.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlParagraph.C (Rob Lahaye): changes to the xforms paragraph dialog. 2002-10-30 13:57:01 +00:00
ControlParagraph.h (Rob Lahaye): changes to the xforms paragraph dialog. 2002-10-30 13:57:01 +00:00
ControlPreamble.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlPreamble.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlPrint.C using std::endl 2002-10-25 17:52:54 +00:00
ControlPrint.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlRef.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlRef.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlSearch.C (Rob Lahaye): minor xforms nits 'n' bobs. 2002-10-24 12:56:44 +00:00
ControlSearch.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlSendto.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlSendto.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlShowFile.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlShowFile.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlSpellchecker.C (Rob Lahaye): updates to the xforms print, spellchecker, texinfo and wrap 2002-10-25 09:16:22 +00:00
ControlSpellchecker.h (Rob Lahaye): updates to the xforms print, spellchecker, texinfo and wrap 2002-10-25 09:16:22 +00:00
ControlTabularCreate.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlTabularCreate.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlTexinfo.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlTexinfo.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlThesaurus.C the qtclean-2 patch with some very small changes 2002-10-20 01:48:28 +00:00
ControlThesaurus.h This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlToc.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlToc.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlUrl.C This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlUrl.h This file is part of LyX, the document processor. 2002-09-05 15:14:23 +00:00
ControlVCLog.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlVCLog.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlWrap.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ControlWrap.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
frnt_lang.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
frnt_lang.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
GUI.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
helper_funcs.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
helper_funcs.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
Makefile.am Rob's patch, part 1: the checked widget stuff. 2002-10-22 12:39:05 +00:00
README Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
tex_helpers.C ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
tex_helpers.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +00:00
ViewBase.h ws fixes, formatting and some other small changes 2002-10-21 17:38:09 +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.