lyx_mirror/src/frontends/controllers
Angus Leeming 4e2d777c51 Fixed bugs in getStringFromVector, getVectorFromString
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1907 a592a061-630c-0410-9148-cb99ea01b6c8
2001-04-09 10:47:20 +00:00
..
.cvsignore Merging BRANCH_MVC back into HEAD. 2001-03-15 13:37:04 +00:00
biblio.C * Baruch's GuiBC template. 2001-03-30 09:51:46 +00:00
biblio.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ButtonController.h Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ButtonControllerBase.C Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ButtonControllerBase.h Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ButtonPolicies.C Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ButtonPolicies.h Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ChangeLog Fixed bugs in getStringFromVector, getVectorFromString 2001-04-09 10:47:20 +00:00
character.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
character.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlBibitem.C controller-view split for Url popup. 2001-03-23 18:46:11 +00:00
ControlBibitem.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlBibtex.C Implemented controller-view split for FormError and FormInclude. 2001-03-23 17:09:34 +00:00
ControlBibtex.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlButtons.C Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ControlButtons.h Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ControlCharacter.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlCharacter.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlCitation.C Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ControlCitation.h Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ControlCommand.C Fixed "can't create new inset" bug. Described dialogs' control loop in 2001-03-26 08:14:39 +00:00
ControlCommand.h Implemented controller-view split for FormError and FormInclude. 2001-03-23 17:09:34 +00:00
ControlConnections.C Controller-view split for Ref popup. 2001-03-26 13:16:57 +00:00
ControlConnections.h Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ControlCopyright.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlCopyright.h small fixes. 2001-03-29 11:24:08 +00:00
ControlCredits.C ControlCredits::getCredits returns a stringstream not a vector<string>. 2001-03-23 16:10:15 +00:00
ControlCredits.h add Lsstream.h 2001-03-23 21:34:24 +00:00
ControlDialogs.h Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ControlError.C Implemented controller-view split for minipage and preamble popups. 2001-03-27 16:03:28 +00:00
ControlError.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlExternal.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlExternal.h Squashed bugs in Citation and (I hope) External Material popups. Could 2001-03-30 13:47:39 +00:00
ControlGraphics.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlGraphics.h * Baruch's GuiBC template. 2001-03-30 09:51:46 +00:00
ControlInclude.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlInclude.h * Baruch's GuiBC template. 2001-03-30 09:51:46 +00:00
ControlIndex.C Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlIndex.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlInset.h move include files 2001-04-04 21:51:08 +00:00
ControlLog.C Reorganised, cleaned-up and improved documentation of controllers. 2001-03-22 11:24:36 +00:00
ControlLog.h Implemented controller-view split for FormError and FormInclude. 2001-03-23 17:09:34 +00:00
ControlMinipage.C Added %x support in vspace.C (LyXLenght) and use it for the minipages. 2001-03-29 15:00:20 +00:00
ControlMinipage.h Added %x support in vspace.C (LyXLenght) and use it for the minipages. 2001-03-29 15:00:20 +00:00
ControlPreamble.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlPreamble.h Implemented controller-view split for minipage and preamble popups. 2001-03-27 16:03:28 +00:00
ControlPrint.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlPrint.h * Baruch's GuiBC template. 2001-03-30 09:51:46 +00:00
ControlRef.C Controller-view split for Ref popup. 2001-03-26 13:16:57 +00:00
ControlRef.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlSearch.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlSearch.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlSplash.C Implemented controller-view split for Splash screen. 2001-03-27 13:00:41 +00:00
ControlSplash.h Implemented controller-view split for Splash screen. 2001-03-27 13:00:41 +00:00
ControlTabularCreate.C Implemented controller-view split for TabularCreate popup. 2001-03-26 14:33:58 +00:00
ControlTabularCreate.h Implemented controller-view split for TabularCreate popup. 2001-03-26 14:33:58 +00:00
ControlToc.C do not include language.h and gettext.h in lyxfont.h and lyxparagraph.h 2001-04-05 12:26:41 +00:00
ControlToc.h controller-view split for TOC popup. 2001-03-30 19:24:28 +00:00
ControlUrl.C Implemented controller-view split for Search popup. 2001-03-26 15:25:37 +00:00
ControlUrl.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlVCLog.C Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ControlVCLog.h Implemented controller-view split for FormError and FormInclude. 2001-03-23 17:09:34 +00:00
GUI.h controller-view split for TOC popup. 2001-03-30 19:24:28 +00:00
helper_funcs.C Fixed bugs in getStringFromVector, getVectorFromString 2001-04-09 10:47:20 +00:00
helper_funcs.h * Baruch's GuiBC template. 2001-03-30 09:51:46 +00:00
Makefile.am Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
README Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ViewBase.h Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +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.