]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiImplementation.C
remove qPixmapFromMimeSource. This caused the inclusion of Qt3 support headers which...
[lyx.git] / src / frontends / qt4 / GuiImplementation.C
1 // -*- C++ -*-
2 /**
3  * \file GuiImplementation.C
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 // This include must be declared before everything else because
16 // of boost/Qt/LyX clash...
17 #include "GuiView.h"
18
19 #include "GuiImplementation.h"
20 #include "GuiWorkArea.h"
21
22 #include "BufferView.h"
23
24 using boost::shared_ptr;
25
26 namespace lyx {
27 namespace frontend {
28
29 GuiImplementation::GuiImplementation(): max_view_id_(0), max_wa_id_(0)
30 {
31 }
32
33
34 Clipboard& GuiImplementation::clipboard()
35 {
36         return clipboard_;
37 }
38
39
40 Selection& GuiImplementation::selection()
41 {
42         return selection_;
43 }
44
45
46 int GuiImplementation::newView(unsigned int /*w*/, unsigned int /*h*/)
47 {
48         size_t const id = max_view_id_;
49         ++max_view_id_;
50
51         views_[id].reset(new GuiView(*this));
52
53         return id;
54 }
55
56
57 LyXView& GuiImplementation::view(int id)
58 {
59         BOOST_ASSERT(views_.find(id) != views_.end());
60
61         return *views_[id].get();
62 }
63
64
65 void GuiImplementation::destroyView(int id)
66 {
67         views_.erase(id);
68 }
69
70
71 int GuiImplementation::newWorkArea(unsigned int w, unsigned int h, int view_id)
72 {
73         size_t const id = max_wa_id_;
74         ++max_wa_id_;
75
76         GuiView * view = views_[view_id].get();
77
78         work_areas_[id].reset(new GuiWorkArea(w, h, *view));
79
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());
84
85         view->setCentralWidget(work_areas_[id].get());
86
87         return id;
88 }
89
90
91 WorkArea& GuiImplementation::workArea(int id)
92 {
93         BOOST_ASSERT(work_areas_.find(id) != work_areas_.end());
94
95         return *work_areas_[id].get();
96 }
97
98
99 void GuiImplementation::destroyWorkArea(int id)
100 {
101         work_areas_.erase(id);
102 }
103
104 } // namespace frontend
105 } // namespace lyx