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