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
17 #include <boost/utility.hpp>
18 #include <boost/scoped_ptr.hpp>
19 #include <boost/signals/signal0.hpp>
20 #include <boost/signals/signal1.hpp>
29 /** Container of all dialogs and signals a LyXView needs or uses to access them
30 The list of dialog signals isn't comprehensive but should be a good guide
31 for any future additions. Remember don't go overboard -- think minimal.
33 class Dialogs : boost::noncopyable
38 /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
41 /** Redraw all visible dialogs because, for example, the GUI colours
42 * have been re-mapped.
44 * Note that static boost signals break some compilers, so we return a
45 * reference to some hidden magic ;-)
47 static boost::signal0<void> & redrawGUI();
49 /// Toggle tooltips on/off in all dialogs.
50 static void toggleTooltips();
52 /// Are the tooltips on or off?
53 static bool tooltipsEnabled();
55 /// Signals slated to go
57 boost::signal0<void> hideAllSignal;
58 boost::signal0<void> hideBufferDependentSignal;
59 boost::signal1<void, bool> updateBufferDependentSignal;
62 /// Hide all visible dialogs
64 /// Hide any dialogs that require a buffer for them to operate
65 void hideBufferDependent() const;
66 /** Update visible, buffer-dependent dialogs
67 If the bool is true then a buffer change has occurred
68 else its still the same buffer.
70 void updateBufferDependent(bool) const ;
72 /**@name Dialog Access Signals.
73 Put into some sort of alphabetical order */
77 /// show the contents of a file.
78 void showFile(string const &);
79 /// show all forked child processes
81 /// show the LaTeX log or build file
83 /// display the top-level maths panel
88 void updateParagraph();
92 void showPreferences();
99 /// bring up the spellchecker
100 void showSpellchecker();
103 /// show the thesaurus dialog
104 void showThesaurus(string const &);
105 /// show the version control log
106 void showVCLogFile();
109 /** \param name == "about" etc; an identifier used to
110 launch a particular dialog.
111 \param data is a string encoding of the data used to populate
112 the dialog. Several of these dialogs do not need any data,
113 so it defaults to string().
115 void show(string const & name, string const & data = string());
117 /** \param name == "bibtex", "citation" etc; an identifier used to
118 launch a particular dialog.
119 \param data is a string representation of the Inset contents.
120 It is often little more than the output from Inset::write.
121 It is passed to, and parsed by, the frontend dialog.
122 \param inset is _not_ passed to the frontend dialog.
123 It is stored internally and used by the kernel to ascertain
124 what to do with the FuncRequest dispatched from the frontend
125 dialog on 'Apply'; should it be used to create a new inset at
126 the current cursor position or modify an existing, 'open' inset?
128 void show(string const & name, string const & data, InsetBase * inset);
130 /** \param name == "citation", "bibtex" etc; an identifier used
131 to update the contents of a particular dialog with \param data .
132 See the comments to 'show', above.
134 void update(string const & name, string const & data);
136 /** All Dialogs of the given \param name will be closed if they are
137 connected to the given \param inset.
139 static void hide(string const & name, InsetBase * inset);
141 void disconnect(string const & name);
143 InsetBase * getOpenInset(string const & name) const;
146 void hideSlot(string const & name, InsetBase * inset);
150 bool isValidName(string const & name) const;
152 Dialog * find(string const & name);
154 Dialog * build(string const & name);
159 std::map<string, InsetBase *> open_insets_;
162 typedef boost::shared_ptr<Dialog> DialogPtr;
164 std::map<string, DialogPtr> dialogs_;
166 /// the stuff below is slated to go...