lyx_mirror/src/frontends/controllers
Angus Leeming b155aa1ed5 Small clean-up.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2445 a592a061-630c-0410-9148-cb99ea01b6c8
2001-08-07 16:23:52 +00:00
..
.cvsignore Merging BRANCH_MVC back into HEAD. 2001-03-15 13:37:04 +00:00
biblio.C small things 2001-07-19 15:32:13 +00:00
biblio.h Merge natbib branch into head 2001-07-19 14:12:37 +00:00
ButtonController.h Clean-up of the button controller. 2001-06-16 14:48:12 +00:00
ButtonControllerBase.C Removed // -*- C++ -*- from all .C files! 2001-06-13 15:11:17 +00:00
ButtonControllerBase.h Modification to ButtonController, so that read-only list of widgets is 2001-06-02 14:53:35 +00:00
ButtonPolicies.C Removed // -*- C++ -*- from all .C files! 2001-06-13 15:11:17 +00:00
ButtonPolicies.h inherit privately from noncopyable, set c++ mode, swap init order 2001-04-17 14:06:11 +00:00
ChangeLog Small clean-up. 2001-08-07 16:23:52 +00:00
character.C Removed // -*- C++ -*- from all .C files! 2001-06-13 15:11:17 +00:00
character.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlAboutlyx.C Edwin's "about" patch + consistent use of Lsstream.h 2001-07-13 14:03:48 +00:00
ControlAboutlyx.h Edwin's "about" patch + consistent use of Lsstream.h 2001-07-13 14:03:48 +00:00
ControlBibitem.C Update/cursor and drawing fixes. 2001-08-02 14:55:06 +00:00
ControlBibitem.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlBibtex.C Update/cursor and drawing fixes. 2001-08-02 14:55:06 +00:00
ControlBibtex.h Controller-view split of Graphics and Index popups. 2001-03-28 12:59:29 +00:00
ControlButtons.C Removed // -*- C++ -*- from all .C files! 2001-06-13 15:11:17 +00:00
ControlButtons.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlCharacter.C get rid of NO_LATEX, split some methods, small cleanup 2001-08-03 18:28:11 +00:00
ControlCharacter.h Once again the user can use the Font button on the toolbar to get the current 2001-06-13 13:44:23 +00:00
ControlCitation.C Merge natbib branch into head 2001-07-19 14:12:37 +00:00
ControlCitation.h Merge natbib branch into head 2001-07-19 14:12:37 +00:00
ControlCommand.C Dispatch->dispatch, some trans work 2001-07-16 15:42:57 +00:00
ControlCommand.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlConnections.C Removed // -*- C++ -*- from all .C files! 2001-06-13 15:11:17 +00:00
ControlConnections.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlDialogs.h Reduced header file includes somewhat 2001-07-29 15:34:18 +00:00
ControlError.C insetfloat work + stuff 2001-07-30 11:56:00 +00:00
ControlError.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlERT.C Various update/redraw fixes. Cleaned up InsetERT and added a dialog for 2001-08-06 14:55:02 +00:00
ControlERT.h Various update/redraw fixes. Cleaned up InsetERT and added a dialog for 2001-08-06 14:55:02 +00:00
ControlExternal.C Reduced header file includes somewhat 2001-07-29 15:34:18 +00:00
ControlExternal.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlFloat.C insetfloat work + stuff 2001-07-30 11:56:00 +00:00
ControlFloat.h * John's maths patch, 2001-07-30 13:35:08 +00:00
ControlGraphics.C Baruch's graphics patch + some small tweaks to the buttoncontroller stuff 2001-07-28 12:24:16 +00:00
ControlGraphics.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlInclude.C math-space; fixes to include inset dialog; autoconfiguration of gfx converters 2001-07-25 12:37:43 +00:00
ControlInclude.h math-space; fixes to include inset dialog; autoconfiguration of gfx converters 2001-07-25 12:37:43 +00:00
ControlIndex.C Removed // -*- C++ -*- from all .C files! 2001-06-13 15:11:17 +00:00
ControlIndex.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlInset.h small fixes... 2001-08-01 15:22:01 +00:00
ControlLog.C LyX Drinkers Union: patch 1 2001-06-25 00:06:33 +00:00
ControlLog.h Implemented controller-view split for FormError and FormInclude. 2001-03-23 17:09:34 +00:00
ControlMinipage.C * John's maths patch, 2001-07-30 13:35:08 +00:00
ControlMinipage.h * John's maths patch, 2001-07-30 13:35:08 +00:00
ControlPreamble.C Reduced header file includes somewhat 2001-07-29 15:34:18 +00:00
ControlPreamble.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlPrint.C various fixes 2001-07-30 10:50:37 +00:00
ControlPrint.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlRef.C Dispatch->dispatch, some trans work 2001-07-16 15:42:57 +00:00
ControlRef.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlSearch.C More header file include dependency work 2001-07-29 17:39:01 +00:00
ControlSearch.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlSpellchecker.C Applied Edwins patch, fixes to free memory read in insettext, partial fix 2001-08-07 15:07:36 +00:00
ControlSpellchecker.h Edwin's spellchecker3 patch 2001-07-17 09:00:17 +00:00
ControlSplash.C Removed // -*- C++ -*- from all .C files! 2001-06-13 15:11:17 +00:00
ControlSplash.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlTabularCreate.C Dispatch->dispatch, some trans work 2001-07-16 15:42:57 +00:00
ControlTabularCreate.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlThesaurus.C more latex conversion cases fixed, patch from Andre, more more funcs to lowercase, some debug output to look at... 2001-08-02 18:46:53 +00:00
ControlThesaurus.h - Applied the thesaurus patch. 2001-07-29 10:42:11 +00:00
ControlToc.C Dispatch->dispatch, some trans work 2001-07-16 15:42:57 +00:00
ControlToc.h floatlist work + handle lyxfuncs with args. 2001-05-04 10:36:36 +00:00
ControlUrl.C Removed // -*- C++ -*- from all .C files! 2001-06-13 15:11:17 +00:00
ControlUrl.h Added // -*- C++ -*- to the top of all files in controllers/ and xforms/ 2001-06-13 14:33:31 +00:00
ControlVCLog.C Reduced header file includes somewhat 2001-07-29 15:34:18 +00:00
ControlVCLog.h Implemented spellchecking inside insets. Small fixes. Baruchs fix. 2001-07-17 15:39:12 +00:00
GUI.h Various update/redraw fixes. Cleaned up InsetERT and added a dialog for 2001-08-06 14:55:02 +00:00
helper_funcs.C Small clean-up. 2001-08-07 16:23:52 +00:00
helper_funcs.h Small clean-up. 2001-08-07 16:23:52 +00:00
Makefile.am Various update/redraw fixes. Cleaned up InsetERT and added a dialog for 2001-08-06 14:55:02 +00:00
README Remove some xforms cruft from BufferView.h BufferView_pimpl.h. 2001-04-03 14:30:58 +00:00
ViewBase.h Edwin's "about" patch + consistent use of Lsstream.h 2001-07-13 14:03:48 +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.