]> git.lyx.org Git - features.git/blob - src/frontends/Application.cpp
merge frontend::Gui and frontend::Application
[features.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/LyXView.h"
20
21 #include "FuncRequest.h"
22 #include "FuncStatus.h"
23 #include "LyX.h"  // for lyx::use_gui
24 #include "Font.h"
25 #include "LyXFunc.h"
26 #include "LyXRC.h"
27
28 #include "support/lstrings.h"
29 #include "support/os.h"
30
31
32 namespace lyx {
33
34
35 frontend::FontLoader & theFontLoader()
36 {
37         static frontend::NoGuiFontLoader no_gui_font_loader;
38
39         if (!use_gui)
40                 return no_gui_font_loader;
41
42         BOOST_ASSERT(theApp());
43         return theApp()->fontLoader();
44 }
45
46
47 frontend::FontMetrics const & theFontMetrics(Font const & f)
48 {
49         return theFontMetrics(f.fontInfo());
50 }
51
52
53 frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
54 {
55         static frontend::NoGuiFontMetrics no_gui_font_metrics;
56
57         if (!use_gui)
58                 return no_gui_font_metrics;
59
60         BOOST_ASSERT(theApp());
61         return theApp()->fontLoader().metrics(f);
62 }
63
64
65 frontend::Clipboard & theClipboard()
66 {
67         BOOST_ASSERT(theApp());
68         return theApp()->clipboard();
69 }
70
71
72 frontend::Selection & theSelection()
73 {
74         BOOST_ASSERT(theApp());
75         return theApp()->selection();
76 }
77
78
79 } // namespace lyx