mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-13 14:32:04 +00:00
1356543c45
* Buffer: - get rid of cursor_ and anchor_ - ~Buffer(): update the labels of its master buffer before closing - closing(): pass the Buffer address. * BufferView(): - BufferView(): needs a valid Buffer (should be const in the future. - most of the change is about removing all test of buffer_ nullity. - resize(): deleted. - setBuffer(): deleted. * Application: - newLyXView(): simplification - updated design description in Application.h * Gui/GuiImplementation: remove all WorkAreas and BufferView creation/Deletion. Workareas are directly handled by LyXView/GuiView and BufferView is created/delete by WorkArea. * LyXView/GuiView: implement the new design What is not working yet: - the close tab button: it is implemented but does not show up. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19686 a592a061-630c-0410-9148-cb99ea01b6c8
128 lines
2.2 KiB
C++
128 lines
2.2 KiB
C++
/**
|
|
* \file frontend/Application.cpp
|
|
* 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>
|
|
|
|
#include "frontends/Application.h"
|
|
|
|
#include "frontends/NoGuiFontLoader.h"
|
|
#include "frontends/NoGuiFontMetrics.h"
|
|
#include "frontends/FontLoader.h"
|
|
#include "frontends/FontMetrics.h"
|
|
#include "frontends/Gui.h"
|
|
#include "frontends/LyXView.h"
|
|
#include "frontends/WorkArea.h"
|
|
|
|
#include "FuncRequest.h"
|
|
#include "FuncStatus.h"
|
|
#include "LyX.h" // for lyx::use_gui
|
|
#include "Font.h"
|
|
#include "LyXFunc.h"
|
|
#include "LyXRC.h"
|
|
|
|
#include "support/lstrings.h"
|
|
#include "support/os.h"
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
|
|
Application::Application(int &, char **)
|
|
: current_view_(0)
|
|
{
|
|
}
|
|
|
|
|
|
LyXView & Application::createView(unsigned int width,
|
|
unsigned int height,
|
|
int posx, int posy,
|
|
int maximized,
|
|
unsigned int iconSizeXY,
|
|
const std::string & geometryArg)
|
|
{
|
|
LyXView & view = gui().createRegisteredView();
|
|
theLyXFunc().setLyXView(&view);
|
|
|
|
view.init();
|
|
view.setGeometry(width, height, posx, posy, maximized, iconSizeXY, geometryArg);
|
|
|
|
view.setFocus();
|
|
|
|
setCurrentView(view);
|
|
|
|
return view;
|
|
}
|
|
|
|
|
|
LyXView const * Application::currentView() const
|
|
{
|
|
return current_view_;
|
|
}
|
|
|
|
|
|
LyXView * Application::currentView()
|
|
{
|
|
return current_view_;
|
|
}
|
|
|
|
|
|
void Application::setCurrentView(LyXView & current_view)
|
|
{
|
|
current_view_ = ¤t_view;
|
|
}
|
|
|
|
} // namespace frontend
|
|
|
|
|
|
|
|
frontend::FontLoader & theFontLoader()
|
|
{
|
|
static frontend::NoGuiFontLoader no_gui_font_loader;
|
|
|
|
if (!use_gui)
|
|
return no_gui_font_loader;
|
|
|
|
BOOST_ASSERT(theApp());
|
|
return theApp()->fontLoader();
|
|
}
|
|
|
|
|
|
frontend::FontMetrics const & theFontMetrics(Font const & f)
|
|
{
|
|
static frontend::NoGuiFontMetrics no_gui_font_metrics;
|
|
|
|
if (!use_gui)
|
|
return no_gui_font_metrics;
|
|
|
|
BOOST_ASSERT(theApp());
|
|
return theApp()->fontLoader().metrics(f);
|
|
}
|
|
|
|
|
|
frontend::Clipboard & theClipboard()
|
|
{
|
|
BOOST_ASSERT(theApp());
|
|
return theApp()->clipboard();
|
|
}
|
|
|
|
|
|
frontend::Selection & theSelection()
|
|
{
|
|
BOOST_ASSERT(theApp());
|
|
return theApp()->selection();
|
|
}
|
|
|
|
|
|
} // namespace lyx
|