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 int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
42 size_t const id = max_view_id_;
45 views_[id].reset(new GuiView(*this));
51 LyXView& GuiImplementation::view(int id)
53 BOOST_ASSERT(views_.find(id) != views_.end());
55 return *views_[id].get();
59 void GuiImplementation::destroyView(int id)
65 int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id)
67 size_t const id = max_wa_id_;
70 GuiView * view = views_[view_id].get();
72 work_areas_[id].reset(new GuiWorkArea(w, h, view));
74 // FIXME BufferView creation should be independant of WorkArea creation
75 buffer_views_[id].reset(new BufferView(view));
76 work_areas_[id]->setBufferView(buffer_views_[id].get());
77 view->setWorkArea(work_areas_[id].get());
79 view->mainWidget()->setCentralWidget(work_areas_[id].get());
81 guiCursor().connect(work_areas_[id].get());
87 WorkArea& GuiImplementation::workArea(int id)
89 BOOST_ASSERT(work_areas_.find(id) != work_areas_.end());
91 return *work_areas_[id].get();
95 void GuiImplementation::destroyWorkArea(int id)
97 work_areas_.erase(id);
100 } // namespace frontend