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