lyx_mirror/src/frontends/controllers
Angus Leeming c52a93b038 Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7349 a592a061-630c-0410-9148-cb99ea01b6c8
2003-07-23 09:07:28 +00:00
..
.cvsignore
BCView.C * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
BCView.h the doxygen patch 2003-06-28 01:23:11 +00:00
BCView.tmpl * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
biblio.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
biblio.h
ButtonController.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ButtonController.h the doxygen patch 2003-06-28 01:23:11 +00:00
ButtonPolicies.C
ButtonPolicies.h
ChangeLog Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it. 2003-07-23 09:07:28 +00:00
character.C
character.h
ControlAboutlyx.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlAboutlyx.h the doxygen patch 2003-06-28 01:23:11 +00:00
ControlBibtex.C Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it. 2003-07-23 09:07:28 +00:00
ControlBibtex.h Fix the texinfo dialog and associated cleanup. 2003-06-20 14:03:49 +00:00
ControlButtons.C introduce namespace lyx::support 2003-06-30 23:56:22 +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 introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlChanges.h Doxygen fixes. 2003-07-17 15:35:42 +00:00
ControlCharacter.C merge decDepth(), killing some non-parlist code 2003-04-03 00:36:31 +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 introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlCommandBuffer.h A clean-up of the minibuffer code; see xforms/ChangeLog. Qt code seems Ok 2003-04-02 09:23:24 +00:00
ControlConnections.C Hold on to your hats. 2003-02-25 14:51:38 +00:00
ControlConnections.h
ControlDialog_impl.C
ControlDialog_impl.h
ControlDialog.h
ControlDialog.tmpl make lyx compile with gcc 3.4. remove some warnings. 2003-07-18 08:46:00 +00:00
ControlDocument.C Added new signals to Buffer, connect/disconnect to them in BufferView, added BufferView::newFile 2003-07-07 08:37:02 +00:00
ControlDocument.h
ControlErrorList.C return a Paragraph & from ParIterator::operator*() 2003-06-12 11:09:55 +00:00
ControlErrorList.h Doxygen fixes. 2003-07-17 15:35: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 Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it. 2003-07-23 09:07:28 +00:00
ControlExternal.h Enable the external inset to handle unknown templates gracefully. 2003-06-11 14:30:04 +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 introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlForks.h vector<string> -> vector<pid_t> 2003-05-15 15:38:05 +00:00
ControlGraphics.C Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it. 2003-07-23 09:07:28 +00:00
ControlGraphics.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlInclude.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlInclude.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlLog.C port the various dialogs to display the contents of an external file to the new Dialog-based scheme 2003-03-25 18:13:46 +00:00
ControlLog.h Doxygen fixes. 2003-07-17 15:35:42 +00:00
ControlMath.C Rewrite to use find_if rather than a big if block. 2003-07-16 22:34:31 +00:00
ControlMath.h Doxygen fixes. 2003-07-17 15:35:42 +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
ControlNote.C Extend Note inset to other forms of annotation like Comment 2003-07-08 14:19:25 +00:00
ControlNote.h Extend Note inset to other forms of annotation like Comment 2003-07-08 14:19:25 +00:00
ControlParagraph.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlParagraph.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlPreamble.C
ControlPreamble.h
ControlPrefs.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlPrefs.h Whitespace only 2003-02-21 15:36:29 +00:00
ControlPrint.C moved some converter/format functions to more appropriate places 2003-07-17 08:23:33 +00:00
ControlPrint.h
ControlRef.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlRef.h Hold on to your hats. 2003-02-25 14:51:38 +00:00
ControlSearch.C non-templated tostr in separate files 2003-05-13 14:36:24 +00:00
ControlSearch.h
ControlSendto.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlSendto.h
ControlShowFile.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlShowFile.h Doxygen fixes. 2003-07-17 15:35:42 +00:00
ControlSpellchecker.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlSpellchecker.h
ControlTabular.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlTabular.h move some stuff from the qt dialog into the controller. 2003-04-10 20:20:36 +00:00
ControlTabularCreate.C non-templated tostr in separate files 2003-05-13 14:36:24 +00:00
ControlTabularCreate.h * Give Dialog::Controller::initialiseParams a bool return type. 2003-03-14 00:20:42 +00:00
ControlTexinfo.C Fix the texinfo dialog and associated cleanup. 2003-06-20 14:03:49 +00:00
ControlTexinfo.h Doxygen fixes. 2003-07-17 15:35:42 +00:00
ControlThesaurus.C port the thesaurus dialog to the new scheme 2003-03-26 12:17:20 +00:00
ControlThesaurus.h port the thesaurus dialog to the new scheme 2003-03-26 12:17:20 +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 introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ControlVCLog.h Doxygen fixes. 2003-07-17 15:35:42 +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 Doxygen fixes. 2003-07-17 15:35:42 +00:00
Dialog.h Doxygen fixes. 2003-07-17 15:35:42 +00:00
frnt_lang.C
frnt_lang.h
GUI.h Flatten the ButtonController tree by splitting it into a Controller and 2003-03-10 03:13:28 +00:00
helper_funcs.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
helper_funcs.h
Kernel.C Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it. 2003-07-23 09:07:28 +00:00
Kernel.h Add Kernel::bufferFilepath() as a wrapper for Buffer::filePath() and use it. 2003-07-23 09:07:28 +00:00
Makefile.am Extend Note inset to other forms of annotation like Comment 2003-07-08 14:19:25 +00:00
README
tex_helpers.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
tex_helpers.h Fix the texinfo dialog and associated cleanup. 2003-06-20 14:03:49 +00:00
ViewBase.C introduce namespace lyx::support 2003-06-30 23:56:22 +00:00
ViewBase.h add warning make controllers compile and remove some alomost unused functions, comment out usage by undo 2003-05-22 16:10:34 +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.