lyx_mirror/src/frontends/controllers
Angus Leeming 358c483572 Herbert's latest graphics patch.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3465 a592a061-630c-0410-9148-cb99ea01b6c8
2002-01-31 14:20:09 +00:00
..
.cvsignore
biblio.C fixes to biblio and insetgraphics from herbert; disable LAYOUT_PARAGRAPH when needed 2002-01-20 16:07:42 +00:00
biblio.h
ButtonController.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ButtonController.tmpl Add the missing template instatiations! 2002-01-16 19:24:23 +00:00
ButtonControllerBase.C
ButtonControllerBase.h
ButtonPolicies.C
ButtonPolicies.h
ChangeLog Herbert's latest graphics patch. 2002-01-31 14:20:09 +00:00
character.C
character.h
ControlAboutlyx.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlAboutlyx.h added #include "LString.h" where they belong. 2002-01-25 19:07:34 +00:00
ControlBibitem.C
ControlBibitem.h
ControlBibtex.C add shortcuts to filedialogs directory buttons; small gnome patch from Michael 2002-01-13 15:01:25 +00:00
ControlBibtex.h
ControlButtons.C * Define a new member variable to ControlButtons, emergency_exit_ 2001-09-25 14:34:24 +00:00
ControlButtons.h * Define a new member variable to ControlButtons, emergency_exit_ 2001-09-25 14:34:24 +00:00
ControlCharacter.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlCharacter.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlCitation.C remove redundant // -*- C++ -*- 2002-01-25 11:26:40 +00:00
ControlCitation.h
ControlCommand.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlCommand.h
ControlConnections.C
ControlConnections.h
ControlDialog_impl.C remove redundant // -*- C++ -*- 2002-01-25 11:26:40 +00:00
ControlDialog_impl.h fix bugs 200, 201, 196 2002-01-19 20:24:04 +00:00
ControlDialog.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlDialog.tmpl The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlError.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlError.h
ControlERT.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlERT.h
ControlExternal.C compilation fix 2002-01-17 21:00:58 +00:00
ControlExternal.h
ControlFloat.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlFloat.h table selection fix from John; Here & wide figures fix from Michael K. 2002-01-03 13:31:12 +00:00
ControlGraphics.C Herbert's latest graphics patch. 2002-01-31 14:20:09 +00:00
ControlGraphics.h Herbert's big graphics patch. 2002-01-29 09:26:24 +00:00
ControlInclude.C Remove const qualifier from bool return type. 2002-01-24 15:49:53 +00:00
ControlInclude.h Remove const qualifier from bool return type. 2002-01-24 15:49:53 +00:00
ControlIndex.C
ControlIndex.h
ControlInset.h #include "LString.h" in the right places. Must be doing something right 2002-01-16 16:00:14 +00:00
ControlInset.tmpl The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlLog.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlLog.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlMinipage.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlMinipage.h use real LyXLength for minipages; new method LyXLength::inPixels 2002-01-17 23:09:31 +00:00
ControlPreamble.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlPreamble.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlPrint.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlPrint.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlRef.C Prettify the names of the buffers displayed in the list of buffers. 2001-09-24 16:55:45 +00:00
ControlRef.h The reference dialog now disconnects from the inset on Apply. Its behaviour 2001-09-21 16:23:31 +00:00
ControlSearch.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlSearch.h #include "LString.h" in the right places. Must be doing something right 2002-01-16 16:00:14 +00:00
ControlShowFile.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlShowFile.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlSpellchecker.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlSpellchecker.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlTabularCreate.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlTabularCreate.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlTexinfo.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlTexinfo.h added #include "LString.h" where they belong. 2002-01-25 19:07:34 +00:00
ControlThesaurus.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlThesaurus.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlToc.C cleanups by john and andre 2001-11-27 10:56:14 +00:00
ControlToc.h
ControlUrl.C
ControlUrl.h
ControlVCLog.C The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
ControlVCLog.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
GUI.h The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
helper_funcs.C fix bug 175 (minipage in minipage); fix some warnings; apply external.diff from Herbert 2002-01-19 17:05:24 +00:00
helper_funcs.h fix starting up which binary is really a symlink; make sure insetinclude file browser returns a relative path when this makes sense; straightforward cleanup of the ways to get filename and filepath for a buffer (in preparation of future work) 2002-01-14 23:31:23 +00:00
Makefile.am The reducing file dependencies in the frontends patch. 2002-01-16 14:47:58 +00:00
README
ViewBase.h Remove old splash dialog(s). 2001-09-27 09:45:57 +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.