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