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"
32 #include "support/package.h"
34 #include <boost/scoped_ptr.hpp>
35 #include <boost/shared_ptr.hpp>
37 using lyx::support::package;
43 Application::Application(int &, char **)
48 void Application::setBufferView(BufferView * buffer_view)
50 buffer_view_ = buffer_view;
54 LyXView & Application::createView(unsigned int width,
59 // FIXME: please confirm: with unicode, I think initEncoding()
60 // is not needed anymore!
62 // this can't be done before because it needs the Languages object
65 int view_id = gui().newView();
66 LyXView & view = gui().view(view_id);
68 theLyXFunc().setLyXView(&view);
70 // FIXME: for now we assume that there is only one LyXView with id = 0.
71 /*int workArea_id_ =*/ gui().newWorkArea(width, height, 0);
72 //WorkArea * workArea_ = & theApp->gui().workArea(workArea_id_);
75 view.setGeometry(width, height, posx, posy, maximize);
81 int Application::start(std::string const & batch)
86 } // namespace frontend
90 lyx::frontend::FontLoader & theFontLoader()
92 static lyx::frontend::NoGuiFontLoader no_gui_font_loader;
95 return no_gui_font_loader;
98 return theApp->fontLoader();
102 lyx::frontend::FontMetrics const & theFontMetrics(LyXFont const & f)
104 static lyx::frontend::NoGuiFontMetrics no_gui_font_metrics;
107 return no_gui_font_metrics;
109 BOOST_ASSERT(theApp);
110 return theApp->fontLoader().metrics(f);
114 lyx::frontend::Clipboard & theClipboard()
116 BOOST_ASSERT(theApp);
117 return theApp->clipboard();
121 lyx::frontend::Selection & theSelection()
123 BOOST_ASSERT(theApp);
124 return theApp->selection();