Skip to content

Commit 7ae22c3

Browse files
committed
Note App V2 UI
1 parent 58103e8 commit 7ae22c3

2 files changed

Lines changed: 57 additions & 15 deletions

File tree

Applications/Note/Note.cpp

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ void Note::Setup(const vector<string>& args) {
7373
}
7474
actionMenu.AddUIComponent(forceSensitiveToggle, Point(7, 5));
7575

76-
OctaveShifter octaveShifter(8, notePadConfigs, &activeConfig.value);
77-
actionMenu.AddUIComponent(octaveShifter, Point(0, 0));
78-
7976
// Split View
8077
UIButton splitViewToggle;
8178
splitViewToggle.SetName("Split View");
@@ -97,16 +94,18 @@ void Note::Setup(const vector<string>& args) {
9794
case HORIZ_SPLIT: MatrixOS::UIUtility::TextScroll("Horizontal Split", Color(0xFF00FF)); break;
9895
}
9996
});
100-
actionMenu.AddUIComponent(splitViewToggle, Point(1, 0));
97+
actionMenu.AddUIComponent(splitViewToggle, Point(0, 0));
10198

10299
UIButton notepad1SelectBtn;
103100
notepad1SelectBtn.SetName("Note Pad 1");
101+
notepad1SelectBtn.SetSize(Dimension(2, 1));
104102
notepad1SelectBtn.SetColorFunc([&]() -> Color { return notePadConfigs[0].color.DimIfNot(activeConfig.Get() == 0); });
105103
notepad1SelectBtn.OnPress([&]() -> void { activeConfig = 0; });
106-
actionMenu.AddUIComponent(notepad1SelectBtn, Point(3, 0));
104+
actionMenu.AddUIComponent(notepad1SelectBtn, Point(2, 0));
107105

108106
UIButton notepad2SelectBtn;
109107
notepad2SelectBtn.SetName("Note Pad 2");
108+
notepad2SelectBtn.SetSize(Dimension(2, 1));
110109
notepad2SelectBtn.SetColorFunc([&]() -> Color { return notePadConfigs[1].color.DimIfNot(activeConfig.Get() == 1); });
111110
notepad2SelectBtn.OnPress([&]() -> void { activeConfig = 1; });
112111
actionMenu.AddUIComponent(notepad2SelectBtn, Point(4, 0));
@@ -117,21 +116,64 @@ void Note::Setup(const vector<string>& args) {
117116
notepadColorBtn.OnPress([&]() -> void { ColorSelector(); });
118117
actionMenu.AddUIComponent(notepadColorBtn, Point(7, 0));
119118

120-
// Other Controls
119+
// Octave Control
120+
int32_t octaveAbs;
121+
actionMenu.SetLoopFunc([&]() -> void {
122+
octaveAbs = (int32_t)abs(notePadConfigs[activeConfig].octave);
123+
});
124+
125+
UI4pxNumber octaveDisplay;
126+
octaveDisplay.SetColor(notePadConfigs[activeConfig].color);
127+
octaveDisplay.SetDigits(2);
128+
octaveDisplay.SetValuePointer(&octaveAbs);
129+
octaveDisplay.SetAlternativeColor(notePadConfigs[activeConfig].rootColor);
130+
actionMenu.AddUIComponent(octaveDisplay, Point(0, 2));
131+
132+
UIButton octaveNegSign;
133+
octaveNegSign.SetColor(notePadConfigs[activeConfig].rootColor);
134+
octaveNegSign.SetSize(Dimension(2, 1));
135+
octaveNegSign.SetEnableFunc([&]() -> bool { return notePadConfigs[activeConfig].octave < 0; });
136+
actionMenu.AddUIComponent(octaveNegSign, Point(2, 4));
137+
138+
UIButton octavePlusBtn;
139+
octavePlusBtn.SetName("Octave +1");
140+
octavePlusBtn.SetSize(Dimension(2, 1));
141+
octavePlusBtn.SetColorFunc([&]() -> Color { return Color(0x80FF00).DimIfNot(notePadConfigs[activeConfig].octave <= 12); });
142+
octavePlusBtn.OnPress([&]() -> void {
143+
if(notePadConfigs[activeConfig].octave < 12)
144+
{
145+
notePadConfigs[activeConfig].octave++;
146+
}
147+
});
148+
actionMenu.AddUIComponent(octavePlusBtn, Point(4, 7));
149+
150+
UIButton octaveMinusBtn;
151+
octaveMinusBtn.SetName("Octave -1");
152+
octaveMinusBtn.SetSize(Dimension(2, 1));
153+
octaveMinusBtn.SetColorFunc([&]() -> Color { return Color(0xFF0060).DimIfNot(notePadConfigs[activeConfig].octave >= -2); });
154+
octaveMinusBtn.OnPress([&]() -> void {
155+
if(notePadConfigs[activeConfig].octave > -2)
156+
{
157+
notePadConfigs[activeConfig].octave--;
158+
}
159+
});
160+
actionMenu.AddUIComponent(octaveMinusBtn, Point(2, 7));
161+
162+
// Control Bar
121163
UIToggle controlBarToggle;
122164
controlBarToggle.SetName("Control Bar");
123165
controlBarToggle.SetColor(Color(0xFF8000));
124166
controlBarToggle.SetValuePointer(&controlBar);
125167
controlBarToggle.OnPress([&]() -> void {controlBar.Save();});
126-
actionMenu.AddUIComponent(controlBarToggle, Point(1, 7));
168+
actionMenu.AddUIComponent(controlBarToggle, Point(0, 7));
127169

128-
// Other Controls
129170
UIButton arpConfigBtn;
130171
arpConfigBtn.SetName("Arpeggiator Config");
172+
arpConfigBtn.SetSize(Dimension(1, 4));
131173
arpConfigBtn.SetColor(Color(0x80FF00));
132174
arpConfigBtn.OnPress([&]() -> void {ArpConfigMenu();});
133175
arpConfigBtn.SetEnableFunc([&]() -> bool {return controlBar;});
134-
actionMenu.AddUIComponent(arpConfigBtn, Point(3, 7));
176+
actionMenu.AddUIComponent(arpConfigBtn, Point(0, 2));
135177

136178
// Other Controls
137179
UIButton systemSettingBtn;
@@ -986,11 +1028,11 @@ void Note::ArpConfigMenu() {
9861028
int32_t stepOffsetValue = notePadConfigs[activeConfig].arpConfig.stepOffset;
9871029
int32_t stepOffsetDisplayValue = abs(stepOffsetValue);
9881030

989-
UIButton stepOffsetMinusSign;
990-
stepOffsetMinusSign.SetColor(arpConfigColor[ARP_STEP_OFFSET]);
991-
stepOffsetMinusSign.SetSize(Dimension(2, 1));
992-
stepOffsetMinusSign.SetEnableFunc([&]() -> bool { return (page == ARP_STEP_OFFSET) && !offsetTextDisplay.IsEnabled() && stepOffsetValue < 0; });
993-
arpConfigMenu.AddUIComponent(stepOffsetMinusSign, Point(0, 4));
1031+
UIButton stepOffsetNegSign;
1032+
stepOffsetNegSign.SetColor(arpConfigColor[ARP_STEP_OFFSET]);
1033+
stepOffsetNegSign.SetSize(Dimension(2, 1));
1034+
stepOffsetNegSign.SetEnableFunc([&]() -> bool { return (page == ARP_STEP_OFFSET) && !offsetTextDisplay.IsEnabled() && stepOffsetValue < 0; });
1035+
arpConfigMenu.AddUIComponent(stepOffsetNegSign, Point(0, 4));
9941036

9951037
UI4pxNumber stepOffsetDisplay;
9961038
stepOffsetDisplay.SetColor(arpConfigColor[ARP_STEP_OFFSET]);

Applications/Note/NoteControlBar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
223223
else if(keyInfo->State() == RELEASED) {
224224
if((MatrixOS::SYS::Millis() - shift[1] < hold_threshold) && shift_event[1] == false) {
225225
int8_t new_octave = notePad[0]->rt->config->octave + 1;
226-
notePad[0]->rt->config->octave = new_octave > 11 ? 11 : new_octave;
226+
notePad[0]->rt->config->octave = new_octave > 12 ? 12 : new_octave;
227227
notePad[0]->GenerateKeymap();
228228
}
229229
shift[1] = 0;

0 commit comments

Comments
 (0)