]> git.lyx.org Git - lyx.git/blob - src/frontends/Dialogs.h
Hold on to your hats.
[lyx.git] / src / frontends / Dialogs.h
1 // -*- C++ -*-
2 /**
3  * \file Dialogs.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  * \author Allan Rae
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #ifndef DIALOGS_H
12 #define DIALOGS_H
13
14
15 #include "LString.h"
16
17 #include <boost/utility.hpp>
18 #include <boost/scoped_ptr.hpp>
19 #include <boost/signals/signal0.hpp>
20 #include <boost/signals/signal1.hpp>
21
22 class Dialog;
23 class InsetBase;
24 class LyXView;
25
26 class InsetCommand;
27 class InsetError;
28 class InsetExternal;
29 class InsetFloat;
30 class InsetWrap;
31 class InsetGraphics;
32 class InsetInclude;
33 class InsetInfo;
34 class InsetMinipage;
35 class Paragraph;
36 class InsetTabular;
37
38 /** Container of all dialogs and signals a LyXView needs or uses to access them
39     The list of dialog signals isn't comprehensive but should be a good guide
40     for any future additions.  Remember don't go overboard -- think minimal.
41  */
42 class Dialogs : boost::noncopyable
43 {
44 public:
45         ///
46         Dialogs(LyXView &);
47         /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
48         ~Dialogs();
49
50         /** Redraw all visible dialogs because, for example, the GUI colours
51          *  have been re-mapped.
52          *
53          *  Note that static boost signals break some compilers, so we return a
54          *  reference to some hidden magic ;-)
55          */
56         static boost::signal0<void> & redrawGUI();
57
58         /// Toggle tooltips on/off in all dialogs.
59         static void toggleTooltips();
60
61         /// Are the tooltips on or off?
62         static bool tooltipsEnabled();
63
64         /// Signals slated to go
65         //@{
66         boost::signal0<void> hideAllSignal;
67         boost::signal0<void> hideBufferDependentSignal;
68         boost::signal1<void, bool> updateBufferDependentSignal;
69         //@}
70
71         /// Hide all visible dialogs
72         void hideAll() const;
73         /// Hide any dialogs that require a buffer for them to operate
74         void hideBufferDependent() const;
75         /** Update visible, buffer-dependent dialogs
76             If the bool is true then a buffer change has occurred
77             else its still the same buffer.
78          */
79         void updateBufferDependent(bool) const ;
80
81         /**@name Dialog Access Signals.
82            Put into some sort of alphabetical order */
83         //@{
84         ///
85         void showAboutlyx();
86         ///
87         void showCharacter();
88         /// connected to the character dialog also
89         void setUserFreeFont();
90         ///
91         void showDocument();
92         /// show the external inset dialog
93         void showExternal(InsetExternal *);
94         /// show the contents of a file.
95         void showFile(string const &);
96         ///
97         void showFloat(InsetFloat *);
98         ///
99         void showWrap(InsetWrap *);
100         /// show all forked child processes
101         void showForks();
102         ///
103         void showGraphics(InsetGraphics *);
104         /// show the details of a LyX file include inset
105         void showInclude(InsetInclude *);
106         /// show the LaTeX log or build file
107         void showLogFile();
108         /// display the top-level maths panel
109         void showMathPanel();
110         /// show the merge changes dialog
111         void showMergeChanges();
112         ///
113         void showMinipage(InsetMinipage *);
114         ///
115         void updateMinipage(InsetMinipage *);
116         ///
117         void showParagraph();
118         ///
119         void updateParagraph();
120         ///
121         void showPreamble();
122         ///
123         void showPreferences();
124         ///
125         void showPrint();
126         ///
127         void showSearch();
128         ///
129         void showSendto();
130         /// bring up the spellchecker
131         void showSpellchecker();
132         ///
133         void showTabular(InsetTabular *);
134         ///
135         void updateTabular(InsetTabular *);
136         ///
137         void showTabularCreate();
138         /// show the TexInfo
139         void showTexinfo();
140         /// show the thesaurus dialog
141         void showThesaurus(string const &);
142         /// show the version control log
143         void showVCLogFile();
144         //@}
145
146         /** name == "bibtex", "citation" etc
147             data is generated by the Inset::write method, to be read by the
148             Inset::read method in the frontends.
149             inset is stored. On a subsequent Apply from the frontends, the
150             stored inset will be modified. If no inset is stored, then a
151             new one will be created at the current cursor position.
152          */
153         void show(string const & name, string const & data, InsetBase * inset);
154         /** name == "citation", "bibtex" etc.
155             Update the contents of the dialog.
156          */
157         void update(string const & name, string const & data);
158         ///
159         void Dialogs::hide(string const & name);
160         ///
161         void disconnect(string const & name);
162         ///
163         InsetBase * getOpenInset(string const & name) const;
164 private:
165         ///
166         void redraw() const;
167         ///
168         bool isValidName(string const & name) const;
169         ///
170         Dialog * find(string const & name);
171         ///
172         Dialog * build(string const & name);
173
174         ///
175         LyXView & lyxview_;
176         ///
177         std::map<string, InsetBase *> open_insets_;
178
179         ///
180         typedef boost::shared_ptr<Dialog> DialogPtr;
181         ///
182         std::map<string, DialogPtr> dialogs_;
183
184         /// the stuff below is slated to go...
185         void init_pimpl();
186         ///
187         class Impl;
188         ///
189         Impl * pimpl_;
190 };
191
192 #endif