lyx_mirror/src/frontends/qt4/GuiImplementation.C
Abdelrazak Younes f475b7bde6 This commit transfers most of the LyXView use from BufferView to WorkArea, most notably:
LyXView::updateLayoutChoice();
LyXView::updateToolbars();
LyXView::getLyXFunc().processKeySym(key, state);
LyXView::dispatch(cmd);

* BufferView
  - workAreaKeyPress(): deleted

* BufferView::pimpl
  - gui(): deleted
  - workAreaKeyPress(): deleted
  - workAreaDispatch(): special FuncRequest transfered to WorkArea::dispatch()

* WorkArea
  - WorkArea(): now needs a LyXView
  - lyx_view: new member
  - scrollBufferView(): new method

* qt4/GuiWorkArea: adapted to above changes
* qt4/GuiImplementation: ditto
* qt3/GuiWorkArea: ditto
* qt3/QContentPane: ditto
* gtk/GuiWorkArea: ditto
* gtk/GWorkArea: ditto



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14695 a592a061-630c-0410-9148-cb99ea01b6c8
2006-08-15 21:57:23 +00:00

106 lines
1.9 KiB
C

// -*- C++ -*-
/**
* \file GuiImplementation.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
// This include must be declared before everything else because
// of boost/Qt/LyX clash...
#include "GuiView.h"
#include "GuiImplementation.h"
#include "GuiWorkArea.h"
#include "BufferView.h"
using boost::shared_ptr;
namespace lyx {
namespace frontend {
GuiImplementation::GuiImplementation(): max_view_id_(0), max_wa_id_(0)
{
}
Clipboard& GuiImplementation::clipboard()
{
return clipboard_;
}
Selection& GuiImplementation::selection()
{
return selection_;
}
int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
{
size_t const id = max_view_id_;
++max_view_id_;
views_[id].reset(new GuiView(*this));
return id;
}
LyXView& GuiImplementation::view(int id)
{
BOOST_ASSERT(views_.find(id) != views_.end());
return *views_[id].get();
}
void GuiImplementation::destroyView(int id)
{
views_.erase(id);
}
int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id)
{
size_t const id = max_wa_id_;
++max_wa_id_;
GuiView * view = views_[view_id].get();
work_areas_[id].reset(new GuiWorkArea(w, h, *view));
// FIXME BufferView creation should be independant of WorkArea creation
buffer_views_[id].reset(new BufferView(view));
work_areas_[id]->setBufferView(buffer_views_[id].get());
view->setWorkArea(work_areas_[id].get());
view->setCentralWidget(work_areas_[id].get());
return id;
}
WorkArea& GuiImplementation::workArea(int id)
{
BOOST_ASSERT(work_areas_.find(id) != work_areas_.end());
return *work_areas_[id].get();
}
void GuiImplementation::destroyWorkArea(int id)
{
work_areas_.erase(id);
}
} // namespace frontend
} // namespace lyx