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