2006-09-22 17:50:33 +00:00
|
|
|
/**
|
2007-04-26 04:02:55 +00:00
|
|
|
* \file frontend/Application.cpp
|
2006-09-22 17:50:33 +00:00
|
|
|
* 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
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "FuncRequest.h"
|
2006-10-11 17:24:46 +00:00
|
|
|
#include "FuncStatus.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "LyX.h" // for lyx::use_gui
|
|
|
|
#include "LyXFont.h"
|
|
|
|
#include "LyXFunc.h"
|
|
|
|
#include "LyXRC.h"
|
2006-09-22 17:50:33 +00:00
|
|
|
|
|
|
|
#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-12-18 15:21:43 +00:00
|
|
|
: current_view_(0)
|
2006-09-22 17:50:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-29 23:10:17 +00:00
|
|
|
LyXView & Application::createView(unsigned int width,
|
2006-12-18 15:21:43 +00:00
|
|
|
unsigned int height,
|
|
|
|
int posx, int posy,
|
2007-03-17 12:28:26 +00:00
|
|
|
int maximized,
|
2006-12-18 15:21:43 +00:00
|
|
|
unsigned int iconSizeXY,
|
|
|
|
const std::string & geometryArg)
|
2006-09-29 23:10:17 +00:00
|
|
|
{
|
2006-12-02 17:39:31 +00:00
|
|
|
LyXView & view = gui().createRegisteredView();
|
|
|
|
int view_id = 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();
|
2007-03-17 12:28:26 +00:00
|
|
|
view.setGeometry(width, height, posx, posy, maximized, iconSizeXY, geometryArg);
|
2006-12-24 17:11:32 +00:00
|
|
|
view.setFocus();
|
2006-09-29 23:10:17 +00:00
|
|
|
|
2006-11-07 17:19:33 +00:00
|
|
|
setCurrentView(view);
|
|
|
|
|
2006-09-29 23:10:17 +00:00
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-04 13:52:02 +00:00
|
|
|
LyXView const * Application::currentView() const
|
2006-11-07 17:19:33 +00:00
|
|
|
{
|
2006-12-04 13:52:02 +00:00
|
|
|
return current_view_;
|
2006-11-07 17:19:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-04 13:52:02 +00:00
|
|
|
LyXView * Application::currentView()
|
2006-11-07 17:19:33 +00:00
|
|
|
{
|
2006-12-04 13:52:02 +00:00
|
|
|
return current_view_;
|
2006-11-07 17:19:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Application::setCurrentView(LyXView & current_view)
|
|
|
|
{
|
|
|
|
current_view_ = ¤t_view;
|
|
|
|
}
|
|
|
|
|
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-11-30 00:04:51 +00:00
|
|
|
BOOST_ASSERT(theApp());
|
|
|
|
return theApp()->fontLoader();
|
2006-10-11 17:24:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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-11-30 00:04:51 +00:00
|
|
|
BOOST_ASSERT(theApp());
|
|
|
|
return theApp()->fontLoader().metrics(f);
|
2006-10-11 17:24:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
frontend::Clipboard & theClipboard()
|
2006-10-11 17:24:46 +00:00
|
|
|
{
|
2006-11-30 00:04:51 +00:00
|
|
|
BOOST_ASSERT(theApp());
|
|
|
|
return theApp()->clipboard();
|
2006-10-11 17:24:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
frontend::Selection & theSelection()
|
2006-10-11 17:24:46 +00:00
|
|
|
{
|
2006-11-30 00:04:51 +00:00
|
|
|
BOOST_ASSERT(theApp());
|
|
|
|
return theApp()->selection();
|
2006-10-11 17:24:46 +00:00
|
|
|
}
|
2006-10-12 14:10:13 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|