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