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