2006-09-22 17:50:33 +00:00
|
|
|
/**
|
|
|
|
* \file frontend/Application.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2006-10-11 17:24:46 +00:00
|
|
|
#include "frontends/Application.h"
|
2006-09-22 17:50:33 +00:00
|
|
|
|
2006-10-15 21:47:29 +00:00
|
|
|
#include "frontends/NoGuiFontLoader.h"
|
|
|
|
#include "frontends/NoGuiFontMetrics.h"
|
2006-10-11 17:24:46 +00:00
|
|
|
#include "frontends/FontLoader.h"
|
|
|
|
#include "frontends/FontMetrics.h"
|
|
|
|
#include "frontends/Gui.h"
|
|
|
|
#include "frontends/LyXView.h"
|
|
|
|
#include "frontends/WorkArea.h"
|
2006-09-29 22:06:28 +00:00
|
|
|
|
2006-10-03 08:43:32 +00:00
|
|
|
#include "funcrequest.h"
|
2006-10-11 17:24:46 +00:00
|
|
|
#include "FuncStatus.h"
|
2006-10-15 21:47:29 +00:00
|
|
|
#include "lyx_main.h"
|
2006-10-11 17:24:46 +00:00
|
|
|
#include "lyxfont.h"
|
2006-09-29 22:06:28 +00:00
|
|
|
#include "lyxfunc.h"
|
2006-09-22 17:50:33 +00:00
|
|
|
#include "lyxrc.h"
|
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "support/os.h"
|
|
|
|
|
2006-10-12 14:10:13 +00:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
#include <boost/shared_ptr.hpp>
|
2006-09-22 17:50:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2006-10-03 08:43:32 +00:00
|
|
|
|
2006-09-22 19:17:29 +00:00
|
|
|
Application::Application(int &, char **)
|
2006-09-22 17:50:33 +00:00
|
|
|
{
|
2006-10-19 10:32:38 +00:00
|
|
|
// FIXME: please confirm: with unicode, I think initEncoding()
|
|
|
|
// is not needed anymore!
|
|
|
|
|
|
|
|
// this can't be done before because it needs the Languages object
|
|
|
|
//initEncodings();
|
2006-09-22 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Application::setBufferView(BufferView * buffer_view)
|
|
|
|
{
|
|
|
|
buffer_view_ = buffer_view;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-29 23:10:17 +00:00
|
|
|
LyXView & Application::createView(unsigned int width,
|
|
|
|
unsigned int height,
|
|
|
|
int posx, int posy,
|
|
|
|
bool maximize)
|
|
|
|
{
|
2006-10-12 22:30:42 +00:00
|
|
|
int view_id = gui().newView();
|
2006-09-29 23:10:17 +00:00
|
|
|
LyXView & view = gui().view(view_id);
|
|
|
|
|
2006-10-19 07:20:32 +00:00
|
|
|
theLyXFunc().setLyXView(&view);
|
2006-09-29 23:10:17 +00:00
|
|
|
|
2006-10-19 10:32:38 +00:00
|
|
|
/*int workArea_id_ =*/ gui().newWorkArea(width, height, view_id);
|
2006-09-29 23:10:17 +00:00
|
|
|
|
|
|
|
view.init();
|
|
|
|
view.setGeometry(width, height, posx, posy, maximize);
|
|
|
|
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-19 21:00:33 +00:00
|
|
|
int Application::start(std::string const & /*batch*/)
|
2006-09-22 17:50:33 +00:00
|
|
|
{
|
|
|
|
return exec();
|
|
|
|
}
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2006-09-22 17:50:33 +00:00
|
|
|
} // namespace frontend
|
2006-10-11 17:24:46 +00:00
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
frontend::FontLoader & theFontLoader()
|
2006-10-11 17:24:46 +00:00
|
|
|
{
|
2006-10-21 00:16:43 +00:00
|
|
|
static frontend::NoGuiFontLoader no_gui_font_loader;
|
2006-10-15 21:47:29 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
if (!use_gui)
|
2006-10-15 21:47:29 +00:00
|
|
|
return no_gui_font_loader;
|
|
|
|
|
2006-10-14 13:15:46 +00:00
|
|
|
BOOST_ASSERT(theApp);
|
2006-10-11 17:24:46 +00:00
|
|
|
return theApp->fontLoader();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
frontend::FontMetrics const & theFontMetrics(LyXFont const & f)
|
2006-10-11 17:24:46 +00:00
|
|
|
{
|
2006-10-21 00:16:43 +00:00
|
|
|
static frontend::NoGuiFontMetrics no_gui_font_metrics;
|
2006-10-15 21:47:29 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
if (!use_gui)
|
2006-10-15 21:47:29 +00:00
|
|
|
return no_gui_font_metrics;
|
|
|
|
|
2006-10-14 13:15:46 +00:00
|
|
|
BOOST_ASSERT(theApp);
|
2006-10-11 17:24:46 +00:00
|
|
|
return theApp->fontLoader().metrics(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
frontend::Clipboard & theClipboard()
|
2006-10-11 17:24:46 +00:00
|
|
|
{
|
2006-10-14 13:15:46 +00:00
|
|
|
BOOST_ASSERT(theApp);
|
2006-10-11 17:24:46 +00:00
|
|
|
return theApp->clipboard();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
frontend::Selection & theSelection()
|
2006-10-11 17:24:46 +00:00
|
|
|
{
|
2006-10-14 13:15:46 +00:00
|
|
|
BOOST_ASSERT(theApp);
|
2006-10-11 17:24:46 +00:00
|
|
|
return theApp->selection();
|
|
|
|
}
|
2006-10-12 14:10:13 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|