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