3 * \file GuiImplementation.C
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
15 // This include must be declared before everything else because
16 // of boost/Qt/LyX clash...
19 #include "GuiImplementation.h"
20 #include "GuiWorkArea.h"
22 #include "BufferView.h"
24 using boost::shared_ptr;
29 GuiImplementation::GuiImplementation(): max_view_id_(0), max_wa_id_(0)
34 int GuiImplementation::newView()
36 size_t const id = max_view_id_;
39 views_[id].reset(new GuiView());
45 LyXView& GuiImplementation::view(int id)
47 BOOST_ASSERT(views_.find(id) != views_.end());
49 return *views_[id].get();
53 void GuiImplementation::destroyView(int id)
59 int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id)
61 size_t const id = max_wa_id_;
64 GuiView * view = views_[view_id].get();
66 work_areas_[id].reset(new GuiWorkArea(w, h, *view));
68 // FIXME BufferView creation should be independant of WorkArea creation
69 buffer_views_[id].reset(new BufferView);
70 work_areas_[id]->setBufferView(buffer_views_[id].get());
71 view->setWorkArea(work_areas_[id].get());
73 view->setCentralWidget(work_areas_[id].get());
79 WorkArea& GuiImplementation::workArea(int id)
81 BOOST_ASSERT(work_areas_.find(id) != work_areas_.end());
83 return *work_areas_[id].get();
87 void GuiImplementation::destroyWorkArea(int id)
89 work_areas_.erase(id);
92 } // namespace frontend