]> git.lyx.org Git - lyx.git/blob - src/frontends/Dialogs.h
Port the tabular dialog to the new scheme based on class Dialog.
[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 showAboutlyx();
76         ///
77         void showCharacter();
78         /// connected to the character dialog also
79         void setUserFreeFont();
80         ///
81         void showDocument();
82         /// show the contents of a file.
83         void showFile(string const &);
84         /// show all forked child processes
85         void showForks();
86         /// show the LaTeX log or build file
87         void showLogFile();
88         /// display the top-level maths panel
89         void showMathPanel();
90         /// show the merge changes dialog
91         void showMergeChanges();
92         ///
93         void showParagraph();
94         ///
95         void updateParagraph();
96         ///
97         void showPreamble();
98         ///
99         void showPreferences();
100         ///
101         void showPrint();
102         ///
103         void showSearch();
104         ///
105         void showSendto();
106         /// bring up the spellchecker
107         void showSpellchecker();
108         ///
109         void showTabularCreate();
110         /// show the TexInfo
111         void showTexinfo();
112         /// show the thesaurus dialog
113         void showThesaurus(string const &);
114         /// show the version control log
115         void showVCLogFile();
116         //@}
117
118         /** name == "bibtex", "citation" etc
119             data is generated by the Inset::write method, to be read by the
120             Inset::read method in the frontends.
121             inset is stored. On a subsequent Apply from the frontends, the
122             stored inset will be modified. If no inset is stored, then a
123             new one will be created at the current cursor position.
124          */
125         void show(string const & name, string const & data, InsetBase * inset);
126         /** name == "citation", "bibtex" etc.
127             Update the contents of the dialog.
128          */
129         void update(string const & name, string const & data);
130         ///
131         void hide(string const & name);
132         ///
133         void disconnect(string const & name);
134         ///
135         InsetBase * getOpenInset(string const & name) const;
136 private:
137         ///
138         void redraw() const;
139         ///
140         bool isValidName(string const & name) const;
141         ///
142         Dialog * find(string const & name);
143         ///
144         Dialog * build(string const & name);
145
146         ///
147         LyXView & lyxview_;
148         ///
149         std::map<string, InsetBase *> open_insets_;
150
151         ///
152         typedef boost::shared_ptr<Dialog> DialogPtr;
153         ///
154         std::map<string, DialogPtr> dialogs_;
155
156         /// the stuff below is slated to go...
157         void init_pimpl();
158         ///
159         class Impl;
160         ///
161         Impl * pimpl_;
162 };
163
164 #endif