-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaPatternChain.h
131 lines (110 loc) · 3.76 KB
/
maPatternChain.h
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//
// MultiArp - Another step in the Great Midi Adventure!
// Copyright (C) 2017, 2018 Barry Neilsen
//
// 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 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef PATTERNCHAIN_H
#define PATTERNCHAIN_H
#include <string>
#include <vector>
#include "maChainLink.h"
#include "maCursorKeys.h"
class PatternChain : public CursorKeys
{
public:
enum pattern_chain_mode_t
{
off,
natural,
quantum,
num_pattern_chain_modes
};
PatternChain();
virtual ~PatternChain();
ChainLink & at(std::vector<ChainLink>::size_type pos) { return m_Chain.at(pos); }
bool empty() { return m_Chain.empty(); }
std::vector<ChainLink>::size_type size() { return m_Chain.size(); }
void SetMode(pattern_chain_mode_t val) { m_PatternChainMode = val; }
pattern_chain_mode_t Mode() { return m_PatternChainMode; }
std::vector<ChainLink>::size_type PosPlay() { return m_PosPlay; }
void SetPosPlay( int val ) { m_PosPlay = static_cast<std::vector<ChainLink>::size_type>(val); }
void ResetPosPlay() { m_PosPlay = 0; }
std::string ToStringForDisplay(unsigned firstRow, unsigned rows);
std::string ToString();
void FromString(std::string s);
void FromSimpleString(std::string s);
void SetJumpOverride( int val )
{
m_JumpOverride = val;
}
int JumpOverride()
{
int t = m_JumpOverride;
m_JumpOverride = -1;
return t;
}
void Clear()
{
m_Chain.clear();
m_PosEdit = 0;
SetStatus();
}
void New();
void Delete();
// void New()
// {
// m_Chain.emplace_back();
// m_PosEdit = m_Chain.size() - 1;
// SetStatus();
// }
//
// void Delete()
// {
// m_Chain.pop_back();
// if ( m_PosEdit >= m_Chain.size() )
// {
// m_PosEdit = m_Chain.size() - 1;
// // Menu focus will also be at max, so reset it.
// m_MenuFocus = static_cast<pattern_chain_menu_focus_t>(m_MenuFocus - 1);
// }
// if ( m_PosPlay >= m_Chain.size() )
// m_PosPlay = m_Chain.size() - 1;
// SetStatus();
// }
//
virtual void SetStatus();
virtual void SetFocus()
{
CursorKeys::SetFocus();
// SetStatus();
}
protected:
enum pattern_chain_menu_focus_t
{
mode,
num_pc_menu_items
};
virtual bool HandleKey(key_type_t k);
void NextPatternChainMode( int dir );
pattern_chain_menu_focus_t m_MenuFocus = mode;
std::vector<ChainLink>::size_type m_PosEdit = 0;
std::vector<ChainLink>::size_type m_PosPlay = 0;
std::vector<ChainLink>::size_type m_JumpOverride = -1;
private:
std::vector<ChainLink> m_Chain;
pattern_chain_mode_t m_PatternChainMode = off;
};
#endif // PATTERNCHAIN_H