]> git.lyx.org Git - lyx.git/blob - src/frontends/Dialogs.h
Yesterday's character dialog patch
[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
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 showDocument();
77         /// show the contents of a file.
78         void showFile(string const &);
79         /// show all forked child processes
80         void showForks();
81         /// show the LaTeX log or build file
82         void showLogFile();
83         /// display the top-level maths panel
84         void showMathPanel();
85         ///
86         void showParagraph();
87         ///
88         void updateParagraph();
89         ///
90         void showPreamble();
91         ///
92         void showPreferences();
93         ///
94         void showPrint();
95         ///
96         void showSearch();
97         ///
98         void showSendto();
99         /// bring up the spellchecker
100         void showSpellchecker();
101         /// show the TexInfo
102         void showTexinfo();
103         /// show the thesaurus dialog
104         void showThesaurus(string const &);
105         /// show the version control log
106         void showVCLogFile();
107         //@}
108
109         /** \param name == "about" etc; an identifier used to
110             launch a particular dialog.
111             \param data is a string encoding of the data used to populate
112             the dialog. Several of these dialogs do not need any data,
113             so it defaults to string().
114         */
115         void show(string const & name, string const & data = string());
116
117         /** \param name == "bibtex", "citation" etc; an identifier used to
118             launch a particular dialog.
119             \param data is a string representation of the Inset contents.
120             It is often little more than the output from Inset::write.
121             It is passed to, and parsed by, the frontend dialog.
122             \param inset is _not_ passed to the frontend dialog.
123             It is stored internally and used by the kernel to ascertain
124             what to do with the FuncRequest dispatched from the frontend
125             dialog on 'Apply'; should it be used to create a new inset at
126             the current cursor position or modify an existing, 'open' inset?
127         */
128         void show(string const & name, string const & data, InsetBase * inset);
129
130         /** \param name == "citation", "bibtex" etc; an identifier used
131             to update the contents of a particular dialog with \param data .
132             See the comments to 'show', above.
133         */
134         void update(string const & name, string const & data);
135
136         /** All Dialogs of the given \param name will be closed if they are
137             connected to the given \param inset.
138         */
139         static void hide(string const & name, InsetBase * inset);
140         ///
141         void disconnect(string const & name);
142         ///
143         InsetBase * getOpenInset(string const & name) const;
144 private:
145         ///
146         void hideSlot(string const & name, InsetBase * inset);
147         ///
148         void redraw() const;
149         ///
150         bool isValidName(string const & name) const;
151         ///
152         Dialog * find(string const & name);
153         ///
154         Dialog * build(string const & name);
155
156         ///
157         LyXView & lyxview_;
158         ///
159         std::map<string, InsetBase *> open_insets_;
160
161         ///
162         typedef boost::shared_ptr<Dialog> DialogPtr;
163         ///
164         std::map<string, DialogPtr> dialogs_;
165
166         /// the stuff below is slated to go...
167         void init_pimpl();
168         ///
169         class Impl;
170         ///
171         Impl * pimpl_;
172 };
173
174 #endif