4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
14 #include <boost/utility.hpp>
15 #include <boost/signals/signal0.hpp>
16 #include <boost/signals/signal1.hpp>
22 /** Container of all dialogs and signals a LyXView needs or uses to access them
23 The list of dialog signals isn't comprehensive but should be a good guide
24 for any future additions. Remember don't go overboard -- think minimal.
26 class Dialogs : boost::noncopyable
34 /** Redraw all visible dialogs because, for example, the GUI colours
35 * have been re-mapped.
37 * Note that static boost signals break some compilers, so we return a
38 * reference to some hidden magic ;-)
40 static boost::signal0<void> & redrawGUI();
42 /// Toggle tooltips on/off in all dialogs.
43 static void toggleTooltips();
45 /// Are the tooltips on or off?
46 static bool tooltipsEnabled();
48 /// Signals slated to go
50 boost::signal0<void> hideAllSignal;
51 boost::signal0<void> hideBufferDependentSignal;
52 boost::signal1<void, bool> updateBufferDependentSignal;
55 /// Hide all visible dialogs
57 /// Hide any dialogs that require a buffer for them to operate
58 void hideBufferDependent() const;
59 /** Update visible, buffer-dependent dialogs
60 If the bool is true then a buffer change has occurred
61 else its still the same buffer.
63 void updateBufferDependent(bool) const ;
65 /**@name Dialog Access Signals.
66 Put into some sort of alphabetical order */
70 /// show all forked child processes
75 void showPreferences();
82 /// bring up the spellchecker
83 void showSpellchecker();
86 /** \param name == "about" etc; an identifier used to
87 launch a particular dialog.
88 \param data is a string encoding of the data used to populate
89 the dialog. Several of these dialogs do not need any data,
90 so it defaults to string().
92 void show(std::string const & name, std::string const & data = std::string());
94 /** \param name == "bibtex", "citation" etc; an identifier used to
95 launch a particular dialog.
96 \param data is a string representation of the Inset contents.
97 It is often little more than the output from Inset::write.
98 It is passed to, and parsed by, the frontend dialog.
99 \param inset is _not_ passed to the frontend dialog.
100 It is stored internally and used by the kernel to ascertain
101 what to do with the FuncRequest dispatched from the frontend
102 dialog on 'Apply'; should it be used to create a new inset at
103 the current cursor position or modify an existing, 'open' inset?
105 void show(std::string const & name, std::string const & data, InsetBase * inset);
107 /** \param name == "citation", "bibtex" etc; an identifier used
108 to update the contents of a particular dialog with \param data .
109 See the comments to 'show', above.
111 void update(std::string const & name, std::string const & data);
113 /// is the dialog currently visible?
114 bool visible(std::string const & name) const;
116 /** All Dialogs of the given \param name will be closed if they are
117 connected to the given \param inset.
119 static void hide(std::string const & name, InsetBase * inset);
121 void disconnect(std::string const & name);
123 InsetBase * getOpenInset(std::string const & name) const;
126 void hideSlot(std::string const & name, InsetBase * inset);
130 bool isValidName(std::string const & name) const;
132 Dialog * find_or_build(std::string const & name);
134 Dialog * build(std::string const & name);
139 std::map<std::string, InsetBase *> open_insets_;
142 typedef boost::shared_ptr<Dialog> DialogPtr;
144 std::map<std::string, DialogPtr> dialogs_;
146 /// the stuff below is slated to go...