lyx_mirror/src/frontends/controllers
Angus Leeming 9a3737148b Re-add the RasterImage template.
Several small clean-ups of the InsetExternal code.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7823 a592a061-630c-0410-9148-cb99ea01b6c8
2003-09-25 10:49:13 +00:00
..
.cvsignore
BCView.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
BCView.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
BCView.tmpl
biblio.C Get rid of lyxstring, remove usage of STRCONV. 2003-09-15 11:00:00 +00:00
biblio.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
ButtonController.C Change Assert to BOOST_ASSERT. 2003-09-09 17:25:35 +00:00
ButtonController.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
ButtonPolicies.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ButtonPolicies.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
ChangeLog Re-add the RasterImage template. 2003-09-25 10:49:13 +00:00
character.C lyxfont.h no longer #includes LColor.h. 2003-09-16 09:01:15 +00:00
character.h Rename EnumLColor as LColor_color. 2003-09-18 11:48:11 +00:00
ControlAboutlyx.C Get rid of lyxstring, remove usage of STRCONV. 2003-09-15 11:00:00 +00:00
ControlAboutlyx.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlBibtex.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlBibtex.h Revert, revert, revert. Sorry about that, y'all. 2003-09-03 17:40:58 +00:00
ControlBranch.C Get rid of trailing whitespace 'noise' in future patches for the 2003-09-09 18:27:24 +00:00
ControlBranch.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
ControlButtons.C Change Assert to BOOST_ASSERT. 2003-09-09 17:25:35 +00:00
ControlButtons.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlChanges.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlChanges.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlCharacter.C Rename EnumLColor as LColor_color. 2003-09-18 11:48:11 +00:00
ControlCharacter.h Rename EnumLColor as LColor_color. 2003-09-18 11:48:11 +00:00
ControlCitation.C Pimpl Buffer. 2003-09-09 11:24:33 +00:00
ControlCitation.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlCommand.C Small clean-up. 2003-09-18 22:26:46 +00:00
ControlCommand.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlCommandBuffer.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlCommandBuffer.h Remove all unnecessary #includes from header files. 2003-09-07 01:45:40 +00:00
ControlConnections.C Use Buffer const reference in most placees possible. 2003-08-28 07:41:31 +00:00
ControlConnections.h Use Buffer const reference in most placees possible. 2003-08-28 07:41:31 +00:00
ControlDialog_impl.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlDialog_impl.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlDialog.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlDialog.tmpl make lyx compile with gcc 3.4. remove some warnings. 2003-07-18 08:46:00 +00:00
ControlDocument.C some configure output changes, fix a new bug 2003-09-21 16:02:54 +00:00
ControlDocument.h Pimpl Buffer. 2003-09-09 11:24:33 +00:00
ControlErrorList.C Move depth_type to support/types.h. 2003-09-06 17:23:08 +00:00
ControlErrorList.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
ControlERT.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlERT.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlExternal.C Re-add the RasterImage template. 2003-09-25 10:49:13 +00:00
ControlExternal.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlFloat.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlFloat.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlForks.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlForks.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
ControlGraphics.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlGraphics.h Remove all unnecessary #includes from header files. 2003-09-07 01:45:40 +00:00
ControlInclude.C Fix InsetInclude properly. Data is now stored in an InsetCommandParams 2003-09-19 10:16:33 +00:00
ControlInclude.h Fix InsetInclude properly. Data is now stored in an InsetCommandParams 2003-09-19 10:16:33 +00:00
ControlLog.C Use Buffer const reference in most placees possible. 2003-08-28 07:41:31 +00:00
ControlLog.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlMath.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlMath.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlMinipage.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlMinipage.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlNote.C Get rid of trailing whitespace 'noise' in future patches for the 2003-09-09 18:27:24 +00:00
ControlNote.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
ControlParagraph.C Get rid of lyxstring, remove usage of STRCONV. 2003-09-15 11:00:00 +00:00
ControlParagraph.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlPreamble.C Pimpl Buffer. 2003-09-09 11:24:33 +00:00
ControlPreamble.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
ControlPrefs.C Rename EnumLColor as LColor_color. 2003-09-18 11:48:11 +00:00
ControlPrefs.h Rename EnumLColor as LColor_color. 2003-09-18 11:48:11 +00:00
ControlPrint.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlPrint.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
ControlRef.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlRef.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlSearch.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlSearch.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
ControlSendto.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlSendto.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
ControlShowFile.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlShowFile.h Remove all unnecessary #includes from header files. 2003-09-07 01:45:40 +00:00
ControlSpellchecker.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlSpellchecker.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
ControlTabular.C Change Assert to BOOST_ASSERT. 2003-09-09 17:25:35 +00:00
ControlTabular.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlTabularCreate.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlTabularCreate.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlTexinfo.C Remove all unnecessary #includes from header files. 2003-09-07 01:45:40 +00:00
ControlTexinfo.h Remove all unnecessary #includes from header files. 2003-09-07 01:45:40 +00:00
ControlThesaurus.C If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlThesaurus.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
ControlToc.C Another 49 #includes bite the dust. 2003-09-05 15:31:19 +00:00
ControlToc.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlVCLog.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
ControlVCLog.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
ControlWrap.C Another 49 #includes bite the dust. 2003-09-05 15:31:19 +00:00
ControlWrap.h If I ever see another licence blurb again, it'll be too soon... 2003-08-23 00:17:00 +00:00
Dialog.C Change Assert to BOOST_ASSERT. 2003-09-09 17:25:35 +00:00
Dialog.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
frnt_lang.C Add missing headers. With thanks to Martin... 2003-09-05 22:17:02 +00:00
frnt_lang.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
GUI.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
helper_funcs.C Replace 'using namespace abc;' with 'using abc::xyz;' 2003-09-09 22:13:45 +00:00
helper_funcs.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
Kernel.C Change Assert to BOOST_ASSERT. 2003-09-09 17:25:35 +00:00
Kernel.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +00:00
Makefile.am The 'Branches' mega-patch. 2003-08-17 11:28:23 +00:00
README Get rid of trailing whitespace 'noise' in future patches for the 2003-09-09 18:27:24 +00:00
tex_helpers.C Get rid of lyxstring, remove usage of STRCONV. 2003-09-15 11:00:00 +00:00
tex_helpers.h Finish the task of removing all cruft from the header files. 2003-09-07 21:25:37 +00:00
ViewBase.C Change Assert to BOOST_ASSERT. 2003-09-09 17:25:35 +00:00
ViewBase.h Replace LString.h with support/std_string.h, 2003-09-05 17:23:11 +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.