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