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 Clipboard& GuiImplementation::clipboard()
40 Selection& GuiImplementation::selection()
46 int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
48 size_t const id = max_view_id_;
51 views_[id].reset(new GuiView(*this));
57 LyXView& GuiImplementation::view(int id)
59 BOOST_ASSERT(views_.find(id) != views_.end());
61 return *views_[id].get();
65 void GuiImplementation::destroyView(int id)
71 int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id)
73 size_t const id = max_wa_id_;
76 GuiView * view = views_[view_id].get();
78 work_areas_[id].reset(new GuiWorkArea(w, h, *view));
80 // FIXME BufferView creation should be independant of WorkArea creation
81 buffer_views_[id].reset(new BufferView(view));
82 work_areas_[id]->setBufferView(buffer_views_[id].get());
83 view->setWorkArea(work_areas_[id].get());
85 view->setCentralWidget(work_areas_[id].get());
91 WorkArea& GuiImplementation::workArea(int id)
93 BOOST_ASSERT(work_areas_.find(id) != work_areas_.end());
95 return *work_areas_[id].get();
99 void GuiImplementation::destroyWorkArea(int id)
101 work_areas_.erase(id);
104 } // namespace frontend