]> git.lyx.org Git - lyx.git/blob - src/frontends/WorkAreaManager.cpp
Amend 207eaeee9071cb
[lyx.git] / src / frontends / WorkAreaManager.cpp
1 // -*- C++ -*-
2 /**
3  * \file WorkAreaManager.cpp
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "WorkAreaManager.h"
15
16 #include "BufferView.h"
17 #include "Cursor.h"
18
19 #include "Application.h"
20 #include "WorkArea.h"
21
22
23 namespace lyx {
24 namespace frontend {
25
26 void WorkAreaManager::add(WorkArea * wa)
27 {
28         work_areas_.push_back(wa);
29 }
30
31
32 void WorkAreaManager::remove(WorkArea * wa)
33 {
34         work_areas_.remove(wa);
35 }
36
37
38 void WorkAreaManager::redrawAll(bool update_metrics)
39 {
40         for (WorkArea * wa : work_areas_)
41                 wa->scheduleRedraw(update_metrics);
42 }
43
44
45 void WorkAreaManager::closeAll()
46 {
47         while (!work_areas_.empty())
48                 // WorkArea is de-registering itself.
49                 (*work_areas_.begin())->close();
50 }
51
52
53 bool WorkAreaManager::unhide(Buffer * buf) const
54 {
55         if (!work_areas_.empty())
56                 return true;
57         return theApp()->unhide(buf);
58 }
59
60
61 void WorkAreaManager::updateTitles()
62 {
63         for (WorkArea * wa : work_areas_)
64                 wa->updateWindowTitle();
65 }
66
67
68 void WorkAreaManager::scheduleRedraw()
69 {
70         for (WorkArea * wa : work_areas_)
71                 wa->scheduleRedraw(true);
72 }
73
74
75 void WorkAreaManager::sanitizeCursors()
76 {
77         for (WorkArea * wa : work_areas_) {
78                 wa->bufferView().cursor().sanitize();
79                 wa->bufferView().resetInlineCompletionPos();
80         }
81 }
82
83
84 } // namespace frontend
85 } // namespace lyx
86