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.
|
2004-04-27 12:40:33 +00:00
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Allan Rae
|
2004-04-27 12:40:33 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-05 14:10:50 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-06-12 11:55:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DIALOGS_H
|
|
|
|
#define DIALOGS_H
|
|
|
|
|
2004-09-26 14:19:47 +00:00
|
|
|
#include <boost/signal.hpp>
|
2000-10-02 00:55:02 +00:00
|
|
|
#include <boost/utility.hpp>
|
2003-03-12 22:17:50 +00:00
|
|
|
|
2004-11-20 09:35:17 +00:00
|
|
|
#include <map>
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
class Inset;
|
2003-02-25 14:51:38 +00:00
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
class Dialog;
|
|
|
|
class LyXView;
|
2004-05-19 15:11:37 +00:00
|
|
|
|
2004-04-05 18:17:47 +00:00
|
|
|
/** Container of all dialogs.
|
2000-06-12 11:55:12 +00:00
|
|
|
*/
|
2004-09-26 14:19:47 +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 &);
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2005-04-13 09:43:58 +00:00
|
|
|
/** Check the status of all visible dialogs and disable or reenable
|
|
|
|
* them as appropriate.
|
|
|
|
*
|
|
|
|
* Disabling is needed for example when a dialog is open and the
|
|
|
|
* cursor moves to a position where the corresponding inset is not
|
|
|
|
* allowed.
|
|
|
|
*/
|
|
|
|
void checkStatus();
|
|
|
|
|
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
|
|
|
/// 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
|
|
|
|
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().
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
void show(std::string const & name, std::string const & data = std::string());
|
2003-03-12 22:17:50 +00:00
|
|
|
|
|
|
|
/** \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?
|
|
|
|
*/
|
2007-04-29 13:39:47 +00:00
|
|
|
void show(std::string const & name, std::string const & data, Inset * inset);
|
2003-03-12 22:17:50 +00:00
|
|
|
|
|
|
|
/** \param name == "citation", "bibtex" etc; an identifier used
|
2004-04-05 18:17:47 +00:00
|
|
|
to update the contents of a particular dialog with \param data.
|
2003-03-12 22:17:50 +00:00
|
|
|
See the comments to 'show', above.
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
void update(std::string const & name, std::string const & data);
|
2003-03-12 22:17:50 +00:00
|
|
|
|
2004-04-05 18:17:47 +00:00
|
|
|
/// Is the dialog currently visible?
|
2003-10-06 15:43:21 +00:00
|
|
|
bool visible(std::string const & name) const;
|
2003-06-06 08:06:24 +00:00
|
|
|
|
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.
|
|
|
|
*/
|
2007-07-17 09:20:39 +00:00
|
|
|
void hide(std::string const & name, Inset * inset);
|
2003-02-25 14:51:38 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
void disconnect(std::string const & name);
|
2003-02-25 14:51:38 +00:00
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
Inset * getOpenInset(std::string const & name) const;
|
2002-08-15 17:48:53 +00:00
|
|
|
private:
|
2003-02-25 14:51:38 +00:00
|
|
|
///
|
|
|
|
void redraw() const;
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
bool isValidName(std::string const & name) const;
|
2003-02-25 14:51:38 +00:00
|
|
|
///
|
2007-08-14 09:54:59 +00:00
|
|
|
Dialog * find_or_build(std::string const & name);
|
2003-02-25 14:51:38 +00:00
|
|
|
///
|
2007-08-14 09:54:59 +00:00
|
|
|
typedef boost::shared_ptr<Dialog> DialogPtr;
|
2004-03-31 20:55:59 +00:00
|
|
|
///
|
|
|
|
DialogPtr build(std::string const & name);
|
2003-02-25 14:51:38 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
LyXView & lyxview_;
|
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
std::map<std::string, Inset *> open_insets_;
|
2003-02-25 14:51:38 +00:00
|
|
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::map<std::string, DialogPtr> dialogs_;
|
2005-02-22 10:25:42 +00:00
|
|
|
|
|
|
|
/// flag against a race condition due to multiclicks in Qt frontend, see bug #1119
|
|
|
|
bool in_show_;
|
2007-06-05 19:02:06 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
boost::signals::connection connection_;
|
2000-06-12 11:55:12 +00:00
|
|
|
};
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
} // namespace frontend
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2000-06-12 11:55:12 +00:00
|
|
|
#endif
|