2000-06-12 11:55:12 +00:00
|
|
|
// -*- C++ -*-
|
2002-08-14 19:19:47 +00:00
|
|
|
/**
|
|
|
|
* \file Dialogs.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Allan Rae
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2000-06-12 11:55:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DIALOGS_H
|
|
|
|
#define DIALOGS_H
|
|
|
|
|
2002-08-14 19:19:47 +00:00
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
#include "LString.h"
|
2002-05-22 01:16:37 +00:00
|
|
|
|
2000-10-02 00:55:02 +00:00
|
|
|
#include <boost/utility.hpp>
|
2002-08-15 17:48:53 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <boost/signals/signal0.hpp>
|
|
|
|
#include <boost/signals/signal1.hpp>
|
2003-03-12 22:17:50 +00:00
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
class Dialog;
|
|
|
|
class InsetBase;
|
2000-06-12 11:55:12 +00:00
|
|
|
class LyXView;
|
2003-02-25 14:51:38 +00:00
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
/** Container of all dialogs and signals a LyXView needs or uses to access them
|
|
|
|
The list of dialog signals isn't comprehensive but should be a good guide
|
|
|
|
for any future additions. Remember don't go overboard -- think minimal.
|
|
|
|
*/
|
2001-04-17 14:02:45 +00:00
|
|
|
class Dialogs : boost::noncopyable
|
2000-06-12 11:55:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2001-03-15 13:37:04 +00:00
|
|
|
///
|
2002-08-15 17:48:53 +00:00
|
|
|
Dialogs(LyXView &);
|
|
|
|
/// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
|
|
|
|
~Dialogs();
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2001-04-03 14:30:58 +00:00
|
|
|
/** Redraw all visible dialogs because, for example, the GUI colours
|
2002-08-15 17:48:53 +00:00
|
|
|
* have been re-mapped.
|
|
|
|
*
|
|
|
|
* Note that static boost signals break some compilers, so we return a
|
|
|
|
* reference to some hidden magic ;-)
|
|
|
|
*/
|
|
|
|
static boost::signal0<void> & redrawGUI();
|
2000-11-10 17:29:47 +00:00
|
|
|
|
2002-03-11 09:54:42 +00:00
|
|
|
/// Toggle tooltips on/off in all dialogs.
|
2002-08-15 17:48:53 +00:00
|
|
|
static void toggleTooltips();
|
2002-03-11 09:54:42 +00:00
|
|
|
|
|
|
|
/// Are the tooltips on or off?
|
|
|
|
static bool tooltipsEnabled();
|
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
/// Signals slated to go
|
2000-06-12 11:55:12 +00:00
|
|
|
//@{
|
2003-02-25 14:51:38 +00:00
|
|
|
boost::signal0<void> hideAllSignal;
|
|
|
|
boost::signal0<void> hideBufferDependentSignal;
|
|
|
|
boost::signal1<void, bool> updateBufferDependentSignal;
|
|
|
|
//@}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
/// Hide all visible dialogs
|
|
|
|
void hideAll() const;
|
2000-10-13 05:57:05 +00:00
|
|
|
/// Hide any dialogs that require a buffer for them to operate
|
2003-02-25 14:51:38 +00:00
|
|
|
void hideBufferDependent() const;
|
2000-10-13 05:57:05 +00:00
|
|
|
/** Update visible, buffer-dependent dialogs
|
|
|
|
If the bool is true then a buffer change has occurred
|
|
|
|
else its still the same buffer.
|
|
|
|
*/
|
2003-02-25 14:51:38 +00:00
|
|
|
void updateBufferDependent(bool) const ;
|
2000-06-12 11:55:12 +00:00
|
|
|
|
2000-09-22 15:09:51 +00:00
|
|
|
/**@name Dialog Access Signals.
|
|
|
|
Put into some sort of alphabetical order */
|
2000-06-12 11:55:12 +00:00
|
|
|
//@{
|
2001-07-13 14:03:48 +00:00
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
void showDocument();
|
2002-02-18 19:13:48 +00:00
|
|
|
/// show all forked child processes
|
2002-06-18 15:44:30 +00:00
|
|
|
void showForks();
|
2000-09-22 15:09:51 +00:00
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
void showPreamble();
|
2000-09-22 15:09:51 +00:00
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
void showPreferences();
|
2000-09-22 15:09:51 +00:00
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
void showPrint();
|
2000-07-07 07:46:37 +00:00
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
void showSearch();
|
2002-03-07 15:06:57 +00:00
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
void showSendto();
|
2001-07-13 11:50:39 +00:00
|
|
|
/// bring up the spellchecker
|
2002-06-18 15:44:30 +00:00
|
|
|
void showSpellchecker();
|
2000-06-12 11:55:12 +00:00
|
|
|
//@}
|
2002-08-15 17:48:53 +00:00
|
|
|
|
2003-03-12 22:17:50 +00:00
|
|
|
/** \param name == "about" etc; an identifier used to
|
|
|
|
launch a particular dialog.
|
|
|
|
\param data is a string encoding of the data used to populate
|
|
|
|
the dialog. Several of these dialogs do not need any data,
|
|
|
|
so it defaults to string().
|
|
|
|
*/
|
|
|
|
void show(string const & name, string const & data = string());
|
|
|
|
|
|
|
|
/** \param name == "bibtex", "citation" etc; an identifier used to
|
|
|
|
launch a particular dialog.
|
|
|
|
\param data is a string representation of the Inset contents.
|
|
|
|
It is often little more than the output from Inset::write.
|
|
|
|
It is passed to, and parsed by, the frontend dialog.
|
|
|
|
\param inset is _not_ passed to the frontend dialog.
|
|
|
|
It is stored internally and used by the kernel to ascertain
|
|
|
|
what to do with the FuncRequest dispatched from the frontend
|
|
|
|
dialog on 'Apply'; should it be used to create a new inset at
|
|
|
|
the current cursor position or modify an existing, 'open' inset?
|
|
|
|
*/
|
2003-02-25 14:51:38 +00:00
|
|
|
void show(string const & name, string const & data, InsetBase * inset);
|
2003-03-12 22:17:50 +00:00
|
|
|
|
|
|
|
/** \param name == "citation", "bibtex" etc; an identifier used
|
|
|
|
to update the contents of a particular dialog with \param data .
|
|
|
|
See the comments to 'show', above.
|
|
|
|
*/
|
2003-02-25 14:51:38 +00:00
|
|
|
void update(string const & name, string const & data);
|
2003-03-12 22:17:50 +00:00
|
|
|
|
2003-06-06 08:06:24 +00:00
|
|
|
/// is the dialog currently visible?
|
|
|
|
bool visible(string const & name) const;
|
|
|
|
|
2003-03-12 22:17:50 +00:00
|
|
|
/** All Dialogs of the given \param name will be closed if they are
|
|
|
|
connected to the given \param inset.
|
|
|
|
*/
|
|
|
|
static void hide(string const & name, InsetBase * inset);
|
2003-02-25 14:51:38 +00:00
|
|
|
///
|
|
|
|
void disconnect(string const & name);
|
|
|
|
///
|
|
|
|
InsetBase * getOpenInset(string const & name) const;
|
2002-08-15 17:48:53 +00:00
|
|
|
private:
|
2003-03-10 22:12:07 +00:00
|
|
|
///
|
|
|
|
void hideSlot(string const & name, InsetBase * inset);
|
2003-02-25 14:51:38 +00:00
|
|
|
///
|
|
|
|
void redraw() const;
|
|
|
|
///
|
|
|
|
bool isValidName(string const & name) const;
|
|
|
|
///
|
|
|
|
Dialog * find(string const & name);
|
|
|
|
///
|
|
|
|
Dialog * build(string const & name);
|
|
|
|
|
|
|
|
///
|
|
|
|
LyXView & lyxview_;
|
|
|
|
///
|
|
|
|
std::map<string, InsetBase *> open_insets_;
|
|
|
|
|
|
|
|
///
|
|
|
|
typedef boost::shared_ptr<Dialog> DialogPtr;
|
|
|
|
///
|
|
|
|
std::map<string, DialogPtr> dialogs_;
|
|
|
|
|
|
|
|
/// the stuff below is slated to go...
|
|
|
|
void init_pimpl();
|
|
|
|
///
|
2002-08-20 19:41:13 +00:00
|
|
|
class Impl;
|
2003-02-25 14:51:38 +00:00
|
|
|
///
|
|
|
|
Impl * pimpl_;
|
2000-06-12 11:55:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|