blob: 4c39a1883169e2a02fcd6e6afbee739f948b067c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// -*- c-basic-offset: 4 -*-
/*
Rosegarden
A sequencer and musical notation editor.
This program is Copyright 2000-2008
Guillaume Laurent <[email protected]>,
Chris Cannam <[email protected]>,
Richard Bown <[email protected]>
The moral right of the authors to claim authorship of this work
has been asserted.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
#ifndef _REFRESH_STATUS_H_
#define _REFRESH_STATUS_H_
namespace Rosegarden
{
class RefreshStatus
{
public:
RefreshStatus() : m_needsRefresh(true) {}
bool needsRefresh() { return m_needsRefresh; }
void setNeedsRefresh(bool s) { m_needsRefresh = s; }
protected:
bool m_needsRefresh;
};
template<class RS>
class RefreshStatusArray
{
public:
unsigned int getNewRefreshStatusId();
size_t size() { return m_refreshStatuses.size(); }
RS& getRefreshStatus(unsigned int id) { return m_refreshStatuses[id]; }
void updateRefreshStatuses();
protected:
std::vector<RS> m_refreshStatuses;
};
template<class RS>
unsigned int RefreshStatusArray<RS>::getNewRefreshStatusId()
{
m_refreshStatuses.push_back(RS());
unsigned int res = m_refreshStatuses.size() - 1;
return res;
}
void breakpoint();
template<class RS>
void RefreshStatusArray<RS>::updateRefreshStatuses()
{
// breakpoint(); // for debug purposes, so one can set a breakpoint
// in this template code (set it in breakpoint() itself).
for(unsigned int i = 0; i < m_refreshStatuses.size(); ++i)
m_refreshStatuses[i].setNeedsRefresh(true);
}
}
#endif
|