2 * \file frontend/Application.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Abdelrazak Younes
8 * Full author contact details are available in file CREDITS.
13 #include "frontends/Application.h"
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 #include "frontends/WorkArea.h"
23 #include "funcrequest.h"
24 #include "FuncStatus.h"
30 #include "support/lstrings.h"
31 #include "support/os.h"
33 #include <boost/scoped_ptr.hpp>
34 #include <boost/shared_ptr.hpp>
41 Application::Application(int &, char **)
43 // FIXME: please confirm: with unicode, I think initEncoding()
44 // is not needed anymore!
46 // this can't be done before because it needs the Languages object
51 void Application::setBufferView(BufferView * buffer_view)
53 buffer_view_ = buffer_view;
57 LyXView & Application::createView(unsigned int width,
62 int view_id = gui().newView();
63 LyXView & view = gui().view(view_id);
65 theLyXFunc().setLyXView(&view);
67 /*int workArea_id_ =*/ gui().newWorkArea(width, height, view_id);
70 view.setGeometry(width, height, posx, posy, maximize);
76 int Application::start(std::string const & /*batch*/)
82 } // namespace frontend
86 frontend::FontLoader & theFontLoader()
88 static frontend::NoGuiFontLoader no_gui_font_loader;
91 return no_gui_font_loader;
94 return theApp->fontLoader();
98 frontend::FontMetrics const & theFontMetrics(LyXFont const & f)
100 static frontend::NoGuiFontMetrics no_gui_font_metrics;
103 return no_gui_font_metrics;
105 BOOST_ASSERT(theApp);
106 return theApp->fontLoader().metrics(f);
110 frontend::Clipboard & theClipboard()
112 BOOST_ASSERT(theApp);
113 return theApp->clipboard();
117 frontend::Selection & theSelection()
119 BOOST_ASSERT(theApp);
120 return theApp->selection();