2006-06-20 08:39:16 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file qt3/Gui.h
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GUI_IMPLEMENTATION_H
|
|
|
|
#define GUI_IMPLEMENTATION_H
|
|
|
|
|
|
|
|
#include "frontends/Gui.h"
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
#include "QtView.h"
|
2006-06-20 08:39:16 +00:00
|
|
|
#include "qscreen.h"
|
|
|
|
#include "QWorkArea.h"
|
|
|
|
|
|
|
|
#include "GuiClipboard.h"
|
|
|
|
#include "GuiWorkArea.h"
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
#include "BufferView.h"
|
|
|
|
|
2006-06-20 08:39:16 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
typedef QtView FView;
|
2006-06-20 08:39:16 +00:00
|
|
|
typedef QScreen FScreen;
|
|
|
|
typedef QWorkArea FWorkArea;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Gui class is the interface to all Qt3 components.
|
|
|
|
*/
|
|
|
|
class GuiImplementation: public lyx::frontend::Gui
|
|
|
|
{
|
|
|
|
public:
|
2006-06-26 16:55:35 +00:00
|
|
|
GuiImplementation()
|
2006-06-20 08:39:16 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~GuiImplementation()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
lyx::frontend::Clipboard& clipboard()
|
|
|
|
{
|
|
|
|
return *clipboard_;
|
|
|
|
}
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
int newView(unsigned int /*w*/, unsigned int /*h*/)
|
|
|
|
{
|
|
|
|
view_.reset(new FView(*this));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyXView& view(int /*id*/)
|
|
|
|
{
|
|
|
|
return *view_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void destroyView(int /*id*/)
|
|
|
|
{
|
|
|
|
view_.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
int newWorkArea(unsigned int w, unsigned int h, int /*view_id*/)
|
2006-06-20 08:39:16 +00:00
|
|
|
{
|
2006-06-26 16:55:35 +00:00
|
|
|
old_work_area_.reset(new FWorkArea(*view_.get(), w, h));
|
2006-06-20 08:39:16 +00:00
|
|
|
old_screen_.reset(new FScreen(*old_work_area_.get()));
|
2006-06-26 16:55:35 +00:00
|
|
|
work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
|
2006-06-20 08:39:16 +00:00
|
|
|
clipboard_.reset(new GuiClipboard(old_work_area_.get()));
|
|
|
|
guiCursor().connect(work_area_.get());
|
2006-06-26 16:55:35 +00:00
|
|
|
|
|
|
|
// FIXME BufferView creation should be independant of WorkArea creation
|
|
|
|
buffer_views_[0].reset(new BufferView(view_.get(), work_area_.get()));
|
|
|
|
work_area_->setBufferView(buffer_views_[0].get());
|
|
|
|
view_->setBufferView(buffer_views_[0].get());
|
2006-06-20 09:17:19 +00:00
|
|
|
return 0;
|
2006-06-20 08:39:16 +00:00
|
|
|
}
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
lyx::frontend::WorkArea& workArea(int /*id*/)
|
2006-06-20 08:39:16 +00:00
|
|
|
{
|
|
|
|
return *work_area_;
|
|
|
|
}
|
|
|
|
|
2006-06-26 16:55:35 +00:00
|
|
|
void destroyWorkArea(int /*id*/)
|
2006-06-20 08:39:16 +00:00
|
|
|
{
|
|
|
|
clipboard_.reset();
|
|
|
|
work_area_.reset();
|
|
|
|
old_work_area_.reset();
|
|
|
|
old_screen_.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
boost::shared_ptr<GuiClipboard> clipboard_;
|
|
|
|
///
|
|
|
|
boost::shared_ptr<GuiWorkArea> work_area_;
|
|
|
|
///
|
2006-06-26 16:55:35 +00:00
|
|
|
boost::shared_ptr<FView> view_;
|
|
|
|
///
|
2006-06-20 08:39:16 +00:00
|
|
|
boost::shared_ptr<FWorkArea> old_work_area_;
|
|
|
|
///
|
|
|
|
boost::shared_ptr<FScreen> old_screen_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif // GUI_IMPLEMENTATION_H
|