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