Control Surface
main
MIDI Control Surface library for Arduino
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Display
SelectorDisplay.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
Banks/Bank.hpp
>
4
#include <
Display/DisplayElement.hpp
>
5
#include <
Selectors/Selector.hpp
>
6
7
BEGIN_CS_NAMESPACE
8
13
class
SelectorDisplay
:
public
DisplayElement
{
14
public
:
15
SelectorDisplay
(
DisplayInterface
&
display
,
SelectorBase
&
selector
,
16
int16_t
offset
, int16_t
multiplier
,
PixelLocation
loc,
17
uint8_t
size
, uint16_t
color
)
18
:
DisplayElement
(
display
),
selector
(
selector
),
offset
(
offset
),
19
multiplier
(
multiplier
),
x
(loc.
x
),
y
(loc.
y
),
size
(
size
),
color
(
color
) {
20
}
21
void
draw
()
override
{
22
display
.setTextColor(
color
);
23
display
.setTextSize(
size
);
24
display
.setCursor(
x
,
y
);
25
setting_t
selection =
selector
.get();
26
display
.print(selection *
multiplier
+
offset
);
27
previous
= selection;
28
}
29
30
bool
getDirty
()
const override
{
return
previous
!=
selector
.get(); }
31
32
private
:
33
SelectorBase
&
selector
;
34
setting_t
previous
=
NoSetting
;
35
int16_t
offset
,
multiplier
,
x
,
y
;
36
uint8_t
size
;
37
uint16_t
color
;
38
};
39
43
class
BankDisplay
:
public
DisplayElement
{
44
public
:
45
BankDisplay
(
DisplayInterface
&
display
,
OutputBank
&
bank
, int16_t
offset
,
46
PixelLocation
loc, uint8_t
size
, uint16_t
color
)
47
:
DisplayElement
(
display
),
bank
(
bank
),
offset
(
offset
),
x
(loc.
x
),
48
y
(loc.
y
),
size
(
size
),
color
(
color
) {}
49
50
void
draw
()
override
{
51
display
.setTextColor(
color
);
52
display
.setTextSize(
size
);
53
display
.setCursor(
x
,
y
);
54
uint8_t bankoffset =
bank
.getOffset();
55
display
.print(bankoffset +
offset
);
56
previous
= bankoffset;
57
}
58
59
bool
getDirty
()
const override
{
return
previous
!=
bank
.getOffset(); }
60
61
private
:
62
OutputBank
&
bank
;
63
uint8_t
previous
= 0xFF;
64
int16_t
offset
,
x
,
y
;
65
uint8_t
size
;
66
uint16_t
color
;
67
};
68
69
END_CS_NAMESPACE
Bank.hpp
NoSetting
constexpr setting_t NoSetting
A special setting that indicates an unused or invalid setting.
Definition
Def.hpp:55
setting_t
uint8_t setting_t
The type used for Selectors.
Definition
Def.hpp:53
DisplayElement.hpp
Selector.hpp
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:14
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition
Settings/NamespaceSettings.hpp:11
BankDisplay::getDirty
bool getDirty() const override
Check if this DisplayElement has to be re-drawn.
Definition
SelectorDisplay.hpp:59
BankDisplay::color
uint16_t color
Definition
SelectorDisplay.hpp:66
BankDisplay::bank
OutputBank & bank
Definition
SelectorDisplay.hpp:62
BankDisplay::BankDisplay
BankDisplay(DisplayInterface &display, OutputBank &bank, int16_t offset, PixelLocation loc, uint8_t size, uint16_t color)
Definition
SelectorDisplay.hpp:45
BankDisplay::offset
int16_t offset
Definition
SelectorDisplay.hpp:64
BankDisplay::previous
uint8_t previous
Definition
SelectorDisplay.hpp:63
BankDisplay::x
int16_t x
Definition
SelectorDisplay.hpp:64
BankDisplay::size
uint8_t size
Definition
SelectorDisplay.hpp:65
BankDisplay::y
int16_t y
Definition
SelectorDisplay.hpp:64
BankDisplay::draw
void draw() override
Draw this DisplayElement to the display buffer.
Definition
SelectorDisplay.hpp:50
DisplayElement::DisplayElement
DisplayElement(DisplayInterface &display)
Create a new DisplayElement.
Definition
DisplayElement.hpp:18
DisplayElement::display
DisplayInterface & display
Definition
DisplayElement.hpp:103
DisplayInterface
An interface for displays.
Definition
DisplayInterface.hpp:16
OutputBank
A class for changing the address of BankableMIDIOutputs.
Definition
Bank.hpp:16
SelectorBase
Base class for all Selectors exposing the get method, so it can be used by display elements etc,...
Definition
Selector.hpp:39
SelectorDisplay::getDirty
bool getDirty() const override
Check if this DisplayElement has to be re-drawn.
Definition
SelectorDisplay.hpp:30
SelectorDisplay::color
uint16_t color
Definition
SelectorDisplay.hpp:37
SelectorDisplay::multiplier
int16_t multiplier
Definition
SelectorDisplay.hpp:35
SelectorDisplay::offset
int16_t offset
Definition
SelectorDisplay.hpp:35
SelectorDisplay::SelectorDisplay
SelectorDisplay(DisplayInterface &display, SelectorBase &selector, int16_t offset, int16_t multiplier, PixelLocation loc, uint8_t size, uint16_t color)
Definition
SelectorDisplay.hpp:15
SelectorDisplay::previous
setting_t previous
Definition
SelectorDisplay.hpp:34
SelectorDisplay::selector
SelectorBase & selector
Definition
SelectorDisplay.hpp:33
SelectorDisplay::x
int16_t x
Definition
SelectorDisplay.hpp:35
SelectorDisplay::size
uint8_t size
Definition
SelectorDisplay.hpp:36
SelectorDisplay::y
int16_t y
Definition
SelectorDisplay.hpp:35
SelectorDisplay::draw
void draw() override
Draw this DisplayElement to the display buffer.
Definition
SelectorDisplay.hpp:21
PixelLocation
A simple struct representing a pixel with integer coordinates.
Definition
Def.hpp:64
Generated by
1.17.0