2000-11-13 10:35:02 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-03-22 11:24:36 +00:00
|
|
|
* Copyright 1995-2001 The LyX Team.
|
2000-11-13 10:35:02 +00:00
|
|
|
*
|
|
|
|
* ======================================================
|
|
|
|
*/
|
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
#include <config.h>
|
2001-03-15 13:37:04 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
2000-06-12 11:55:12 +00:00
|
|
|
|
|
|
|
#include "Dialogs.h"
|
2001-07-29 15:34:18 +00:00
|
|
|
#include "BufferView.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2001-03-21 13:27:03 +00:00
|
|
|
#include "xformsBC.h"
|
|
|
|
|
2001-07-13 14:03:48 +00:00
|
|
|
#include "ControlAboutlyx.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
#include "ControlBibitem.h"
|
2001-03-19 16:37:01 +00:00
|
|
|
#include "ControlBibtex.h"
|
2001-03-21 13:27:03 +00:00
|
|
|
#include "ControlCharacter.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
#include "ControlCitation.h"
|
2001-03-23 17:09:34 +00:00
|
|
|
#include "ControlError.h"
|
2001-08-06 14:55:02 +00:00
|
|
|
#include "ControlERT.h"
|
2001-07-30 11:56:00 +00:00
|
|
|
#include "ControlExternal.h"
|
|
|
|
#include "ControlFloat.h"
|
2001-03-28 13:11:08 +00:00
|
|
|
#include "ControlGraphics.h"
|
2001-07-30 11:56:00 +00:00
|
|
|
#include "insets/insetgraphicsParams.h"
|
2001-03-23 17:09:34 +00:00
|
|
|
#include "ControlInclude.h"
|
2001-03-28 13:11:08 +00:00
|
|
|
#include "ControlIndex.h"
|
2001-03-20 10:14:03 +00:00
|
|
|
#include "ControlLog.h"
|
2001-03-27 16:03:28 +00:00
|
|
|
#include "ControlMinipage.h"
|
|
|
|
#include "ControlPreamble.h"
|
2001-03-27 10:43:10 +00:00
|
|
|
#include "ControlPrint.h"
|
2001-03-26 13:16:57 +00:00
|
|
|
#include "ControlRef.h"
|
2001-03-26 15:25:37 +00:00
|
|
|
#include "ControlSearch.h"
|
2001-07-13 11:50:39 +00:00
|
|
|
#include "ControlSpellchecker.h"
|
2001-03-27 13:00:41 +00:00
|
|
|
#include "ControlSplash.h"
|
2001-03-26 14:33:58 +00:00
|
|
|
#include "ControlTabularCreate.h"
|
2001-07-29 10:42:11 +00:00
|
|
|
#include "ControlThesaurus.h"
|
2001-03-30 19:24:28 +00:00
|
|
|
#include "ControlToc.h"
|
2001-03-27 10:43:10 +00:00
|
|
|
#include "ControlUrl.h"
|
2001-03-20 10:14:03 +00:00
|
|
|
#include "ControlVCLog.h"
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2001-03-22 11:24:36 +00:00
|
|
|
#include "GUI.h"
|
|
|
|
|
|
|
|
#include "combox.h" // needed for clean destruction of boost::scoped_ptr
|
2001-07-13 14:03:48 +00:00
|
|
|
#include "form_aboutlyx.h"
|
2001-03-21 13:27:03 +00:00
|
|
|
#include "form_bibitem.h"
|
2001-03-20 10:14:03 +00:00
|
|
|
#include "form_bibtex.h"
|
|
|
|
#include "form_browser.h"
|
2001-03-21 13:27:03 +00:00
|
|
|
#include "form_character.h"
|
2001-03-20 10:14:03 +00:00
|
|
|
#include "form_citation.h"
|
2001-03-23 17:09:34 +00:00
|
|
|
#include "form_error.h"
|
2001-08-06 14:55:02 +00:00
|
|
|
#include "form_ert.h"
|
2001-07-30 11:56:00 +00:00
|
|
|
#include "form_external.h"
|
|
|
|
#include "form_float.h"
|
2001-03-28 13:11:08 +00:00
|
|
|
#include "form_graphics.h"
|
2001-03-23 17:09:34 +00:00
|
|
|
#include "form_include.h"
|
2001-03-28 13:11:08 +00:00
|
|
|
#include "form_index.h"
|
2001-03-27 16:03:28 +00:00
|
|
|
#include "form_minipage.h"
|
|
|
|
#include "form_preamble.h"
|
2001-03-27 10:43:10 +00:00
|
|
|
#include "form_print.h"
|
2001-03-26 13:16:57 +00:00
|
|
|
#include "form_ref.h"
|
2001-03-26 15:25:37 +00:00
|
|
|
#include "form_search.h"
|
2001-07-13 11:50:39 +00:00
|
|
|
#include "form_spellchecker.h"
|
2001-03-27 13:00:41 +00:00
|
|
|
#include "form_splash.h"
|
2001-03-26 14:33:58 +00:00
|
|
|
#include "form_tabular_create.h"
|
2001-07-29 10:42:11 +00:00
|
|
|
#include "form_thesaurus.h"
|
2001-03-30 19:24:28 +00:00
|
|
|
#include "form_toc.h"
|
2001-03-23 18:46:11 +00:00
|
|
|
#include "form_url.h"
|
2001-03-20 10:14:03 +00:00
|
|
|
|
2001-07-13 14:03:48 +00:00
|
|
|
#include "FormAboutlyx.h"
|
2001-02-12 14:09:09 +00:00
|
|
|
#include "FormBibitem.h"
|
|
|
|
#include "FormBibtex.h"
|
2001-03-21 13:27:03 +00:00
|
|
|
#include "FormCharacter.h"
|
2000-08-03 12:56:25 +00:00
|
|
|
#include "FormCitation.h"
|
2001-03-23 17:09:34 +00:00
|
|
|
#include "FormError.h"
|
2001-08-06 14:55:02 +00:00
|
|
|
#include "FormERT.h"
|
2001-07-30 11:56:00 +00:00
|
|
|
#include "FormExternal.h"
|
|
|
|
#include "FormFloat.h"
|
2001-03-28 13:11:08 +00:00
|
|
|
#include "FormGraphics.h"
|
2001-03-23 17:09:34 +00:00
|
|
|
#include "FormInclude.h"
|
2001-03-28 13:11:08 +00:00
|
|
|
#include "FormIndex.h"
|
2001-03-20 10:14:03 +00:00
|
|
|
#include "FormLog.h"
|
2001-03-27 16:03:28 +00:00
|
|
|
#include "FormMinipage.h"
|
|
|
|
#include "FormPreamble.h"
|
2001-03-27 10:43:10 +00:00
|
|
|
#include "FormPrint.h"
|
2001-03-26 13:16:57 +00:00
|
|
|
#include "FormRef.h"
|
2001-03-26 15:25:37 +00:00
|
|
|
#include "FormSearch.h"
|
2001-07-13 11:50:39 +00:00
|
|
|
#include "FormSpellchecker.h"
|
2001-03-27 13:00:41 +00:00
|
|
|
#include "FormSplash.h"
|
2001-03-26 14:33:58 +00:00
|
|
|
#include "FormTabularCreate.h"
|
2001-07-29 10:42:11 +00:00
|
|
|
#include "FormThesaurus.h"
|
2001-03-30 19:24:28 +00:00
|
|
|
#include "FormToc.h"
|
2001-03-23 18:46:11 +00:00
|
|
|
#include "FormUrl.h"
|
2001-03-20 10:14:03 +00:00
|
|
|
#include "FormVCLog.h"
|
|
|
|
|
2000-08-11 14:42:20 +00:00
|
|
|
#include "FormDocument.h"
|
2001-03-19 15:38:22 +00:00
|
|
|
#include "FormMathsPanel.h"
|
2000-09-25 15:59:27 +00:00
|
|
|
#include "FormParagraph.h"
|
2000-08-03 12:56:25 +00:00
|
|
|
#include "FormPreferences.h"
|
2000-07-11 15:08:54 +00:00
|
|
|
#include "FormTabular.h"
|
2000-06-12 11:55:12 +00:00
|
|
|
|
2001-04-03 14:30:58 +00:00
|
|
|
// Signal enabling all visible dialogs to be redrawn if so desired.
|
2000-11-10 17:29:47 +00:00
|
|
|
// E.g., when the GUI colours have been remapped.
|
2001-03-15 18:21:56 +00:00
|
|
|
SigC::Signal0<void> Dialogs::redrawGUI;
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
Dialogs::Dialogs(LyXView * lv)
|
|
|
|
{
|
2001-03-27 13:00:41 +00:00
|
|
|
splash_.reset(new GUISplash<FormSplash>(*this));
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2001-07-13 14:03:48 +00:00
|
|
|
add(new GUIAboutlyx<FormAboutlyx, xformsBC>(*lv, *this));
|
2001-03-15 13:37:04 +00:00
|
|
|
add(new GUIBibitem<FormBibitem, xformsBC>(*lv, *this));
|
2001-03-19 16:37:01 +00:00
|
|
|
add(new GUIBibtex<FormBibtex, xformsBC>(*lv, *this));
|
2001-03-21 13:27:03 +00:00
|
|
|
add(new GUICharacter<FormCharacter, xformsBC>(*lv, *this));
|
|
|
|
add(new GUICitation<FormCitation, xformsBC>(*lv, *this));
|
2001-03-23 17:09:34 +00:00
|
|
|
add(new GUIError<FormError, xformsBC>(*lv, *this));
|
2001-08-06 14:55:02 +00:00
|
|
|
add(new GUIERT<FormERT, xformsBC>(*lv, *this));
|
2001-03-30 09:51:46 +00:00
|
|
|
add(new GUIExternal<FormExternal, xformsBC>(*lv, *this));
|
2001-03-28 13:11:08 +00:00
|
|
|
add(new GUIGraphics<FormGraphics, xformsBC>(*lv, *this));
|
2001-03-23 17:09:34 +00:00
|
|
|
add(new GUIInclude<FormInclude, xformsBC>(*lv, *this));
|
2001-03-28 13:11:08 +00:00
|
|
|
add(new GUIIndex<FormIndex, xformsBC>(*lv, *this));
|
2001-03-20 10:14:03 +00:00
|
|
|
add(new GUILog<FormLog, xformsBC>(*lv, *this));
|
2001-03-27 16:03:28 +00:00
|
|
|
add(new GUIMinipage<FormMinipage, xformsBC>(*lv, *this));
|
2001-07-30 11:56:00 +00:00
|
|
|
add(new GUIFloat<FormFloat, xformsBC>(*lv, *this));
|
2001-03-27 16:03:28 +00:00
|
|
|
add(new GUIPreamble<FormPreamble, xformsBC>(*lv, *this));
|
2001-03-27 10:43:10 +00:00
|
|
|
add(new GUIPrint<FormPrint, xformsBC>(*lv, *this));
|
2001-03-26 13:16:57 +00:00
|
|
|
add(new GUIRef<FormRef, xformsBC>(*lv, *this));
|
2001-03-26 15:25:37 +00:00
|
|
|
add(new GUISearch<FormSearch, xformsBC>(*lv, *this));
|
2001-07-13 11:50:39 +00:00
|
|
|
add(new GUISpellchecker<FormSpellchecker, xformsBC>(*lv, *this));
|
2001-03-26 15:25:37 +00:00
|
|
|
add(new GUITabularCreate<FormTabularCreate, xformsBC>(*lv, *this));
|
2001-07-29 10:42:11 +00:00
|
|
|
#ifdef HAVE_LIBAIKSAURUS
|
|
|
|
add(new GUIThesaurus<FormThesaurus, xformsBC>(*lv, *this));
|
|
|
|
#endif
|
2001-03-30 19:24:28 +00:00
|
|
|
add(new GUIToc<FormToc, xformsBC>(*lv, *this));
|
2001-03-23 18:46:11 +00:00
|
|
|
add(new GUIUrl<FormUrl, xformsBC>(*lv, *this));
|
2001-03-20 10:14:03 +00:00
|
|
|
add(new GUIVCLog<FormVCLog, xformsBC>(*lv, *this));
|
2000-06-12 11:55:12 +00:00
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
add(new FormDocument(lv, this));
|
2001-03-19 15:38:22 +00:00
|
|
|
add(new FormMathsPanel(lv, this));
|
2001-03-15 13:37:04 +00:00
|
|
|
add(new FormParagraph(lv, this));
|
|
|
|
add(new FormPreferences(lv, this));
|
|
|
|
add(new FormTabular(lv, this));
|
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
// reduce the number of connections needed in
|
|
|
|
// dialogs by a simple connection here.
|
|
|
|
hideAll.connect(hideBufferDependent.slot());
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
|
|
|
Q. WHY does Dialogs::Dialogs pass `this' to dialog constructors?
|
|
|
|
|
|
|
|
A. To avoid a segfault.
|
|
|
|
The dialog constructors need to connect to their
|
|
|
|
respective showSomeDialog signal(*) but in order to do
|
|
|
|
that they need to get the address of the Dialogs instance
|
|
|
|
from LyXView::getDialogs(). However, since the Dialogs
|
|
|
|
instance is still being constructed at that time
|
|
|
|
LyXView::getDialogs() will *not* return the correct
|
|
|
|
address because it hasn't finished being constructed.
|
|
|
|
A Catch-22 situation (or is that the chicken and the egg...).
|
|
|
|
So to get around the problem we pass the address of
|
|
|
|
the newly created Dialogs instance using `this'.
|
|
|
|
|
|
|
|
(*) -- I'm using signals exclusively to guarantee that the gui code
|
|
|
|
remains hidden from the rest of the system. In fact the only
|
|
|
|
header related to dialogs that anything in the non-gui-specific
|
|
|
|
code gets to see is Dialogs.h! Even Dialogs.h doesn't know what a
|
|
|
|
FormCopyright class looks like or that its even going to be used!
|
|
|
|
|
|
|
|
No other gui dialog headers are seen outside of the gui-specific
|
|
|
|
directories! This ensures that the gui is completely separate from
|
|
|
|
the rest of LyX. All this through the use of a few simple signals.
|
|
|
|
BUT, the price is that during construction we need to connect the
|
|
|
|
implementations show() method to the showSomeDialog signal and this
|
|
|
|
requires that we have an instance of Dialogs and the problem mentioned
|
|
|
|
above.
|
|
|
|
|
|
|
|
Almost all other dialogs should be able to operate using the same style
|
|
|
|
of signalling used for Copyright. Exceptions should be handled
|
|
|
|
by adding a specific show or update signal. For example, spellchecker
|
|
|
|
needs to set the next suspect word and its options/replacements so we
|
|
|
|
need a:
|
|
|
|
Signal0<void> updateSpellChecker;
|
|
|
|
|
|
|
|
Since we would have to have a
|
|
|
|
Signal0<void> showSpellChecker;
|
|
|
|
|
|
|
|
in order to just see the spellchecker and let the user push the [Start]
|
|
|
|
button then the updateSpellChecker signal will make the SpellChecker
|
|
|
|
dialog get the new word and replacements list from LyX. If you really,
|
|
|
|
really wanted to you could define a signal that would pass the new
|
|
|
|
word and replacements:
|
|
|
|
Signal2<void, string, vector<string> > updateSpellChecker;
|
|
|
|
|
|
|
|
(or something similar) but, why bother when the spellchecker can get
|
|
|
|
it anyway with a LyXFunc call or two. Besides if someone extends
|
|
|
|
what a dialog does then they also have to change code in the rest of
|
|
|
|
LyX to pass more parameters or get the extra info via a function
|
|
|
|
call anyway. Thus reducing the independence of the two code bases.
|
|
|
|
|
|
|
|
We don't need a separate update signal for each dialog because most of
|
|
|
|
them will be changed only when the buffer is changed (either by closing
|
|
|
|
the current open buffer or switching to another buffer in the current
|
|
|
|
LyXView -- different BufferView same LyXView or same BufferView same
|
|
|
|
LyXView).
|
|
|
|
|
|
|
|
So we minimise signals but maximise independence and programming
|
|
|
|
simplicity, understandability and maintainability. It's also
|
|
|
|
extremely easy to add support for Qt or gtk-- because they use
|
|
|
|
signals already. Guis that use callbacks, like xforms, must have their
|
|
|
|
code wrapped up like that in the form_copyright.[Ch] which is awkward
|
|
|
|
but will at least allow multiple instances of the same dialog.
|
|
|
|
|
|
|
|
Signals will also be a great help in controlling the splashscreen --
|
|
|
|
once signalled to hide it can disconnect from the signal and remove
|
|
|
|
itself from memory.
|
|
|
|
|
|
|
|
LyXFuncs will be used for requesting/setting LyX internal info. This
|
|
|
|
will ensure that scripts or LyXServer-connected applications can all
|
|
|
|
have access to the same calls as the internal user-interface.
|
|
|
|
|
|
|
|
******************************************************************************/
|