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.
13 // This include must be declared before everything else because
14 // of boost/Qt/LyX clash...
17 #include "GuiImplementation.h"
18 #include "GuiWorkArea.h"
20 #include "BufferView.h"
22 using boost::shared_ptr;
27 GuiImplementation::GuiImplementation(): max_view_id_(0), max_wa_id_(0)
32 Clipboard& GuiImplementation::clipboard()
38 int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
40 size_t const id = max_view_id_;
43 views_[id].reset(new GuiView(*this));
49 LyXView& GuiImplementation::view(int id)
51 BOOST_ASSERT(views_.find(id) != views_.end());
53 return *views_[id].get();
57 void GuiImplementation::destroyView(int id)
63 int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id)
65 size_t const id = max_wa_id_;
68 GuiView * view = views_[view_id].get();
70 work_areas_[id].reset(new GuiWorkArea(w, h, view));
72 // FIXME BufferView creation should be independant of WorkArea creation
73 buffer_views_[id].reset(new BufferView(view, work_areas_[id].get()));
74 work_areas_[id]->setBufferView(buffer_views_[id].get());
75 view->setBufferView(buffer_views_[id].get());
77 view->mainWidget()->setCentralWidget(work_areas_[id].get());
79 guiCursor().connect(work_areas_[id].get());
85 WorkArea& GuiImplementation::workArea(int id)
87 BOOST_ASSERT(work_areas_.find(id) != work_areas_.end());
89 return *work_areas_[id].get();
93 void GuiImplementation::destroyWorkArea(int id)
95 work_areas_.erase(id);
98 } // namespace frontend