]> git.lyx.org Git - lyx.git/blob - src/frontends/Application.cpp
merge the two parts of the implementation of frontends::Dialogs
[lyx.git] / src / frontends / Application.cpp
1 /**
2  * \file frontend/Application.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Abdelrazak Younes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "frontends/Application.h"
14
15 #include "frontends/NoGuiFontLoader.h"
16 #include "frontends/NoGuiFontMetrics.h"
17 #include "frontends/FontLoader.h"
18 #include "frontends/FontMetrics.h"
19 #include "frontends/Gui.h"
20 #include "frontends/LyXView.h"
21
22 #include "FuncRequest.h"
23 #include "FuncStatus.h"
24 #include "LyX.h"  // for lyx::use_gui
25 #include "Font.h"
26 #include "LyXFunc.h"
27 #include "LyXRC.h"
28
29 #include "support/lstrings.h"
30 #include "support/os.h"
31
32
33 namespace lyx {
34
35
36 frontend::FontLoader & theFontLoader()
37 {
38         static frontend::NoGuiFontLoader no_gui_font_loader;
39
40         if (!use_gui)
41                 return no_gui_font_loader;
42
43         BOOST_ASSERT(theApp());
44         return theApp()->fontLoader();
45 }
46
47
48 frontend::FontMetrics const & theFontMetrics(Font const & f)
49 {
50         return theFontMetrics(f.fontInfo());
51 }
52
53
54 frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
55 {
56         static frontend::NoGuiFontMetrics no_gui_font_metrics;
57
58         if (!use_gui)
59                 return no_gui_font_metrics;
60
61         BOOST_ASSERT(theApp());
62         return theApp()->fontLoader().metrics(f);
63 }
64
65
66 frontend::Clipboard & theClipboard()
67 {
68         BOOST_ASSERT(theApp());
69         return theApp()->clipboard();
70 }
71
72
73 frontend::Selection & theSelection()
74 {
75         BOOST_ASSERT(theApp());
76         return theApp()->selection();
77 }
78
79
80 } // namespace lyx