Add touchevents to menu items

This commit is contained in:
Sjef Verhoeven PE5PVB
2024-12-24 12:22:50 +01:00
parent 6cde51226a
commit 33777f62ee
3 changed files with 28 additions and 4 deletions

View File

@@ -1575,12 +1575,12 @@ void BuildBWSelector() {
drawButton(BWButtonLabelsFM[x], x, (BWset == x + 1 ? true : false));
}
drawButton(BWButtonLabelsFM[16], 16, (BWset == 0 ? true : false));
drawButton("OK", 19, false);
if (hardwaremodel == PORTABLE_TOUCH_ILI9341) drawButton("OK", 19, false);
} else {
for (int x = 0; x < 4; x++) {
drawButton(BWButtonLabelsAM[x], x, (BWset == x + 1 ? true : false));
}
drawButton("OK", 19, false);
if (hardwaremodel == PORTABLE_TOUCH_ILI9341) drawButton("OK", 19, false);
}
}
@@ -3762,6 +3762,17 @@ void DoMenu() {
case 7: tft.pushImage (13, 30, 292, 170, popupbackground_wo); break;
default: tft.pushImage (13, 30, 292, 170, popupbackground); break;
}
if (hardwaremodel == PORTABLE_TOUCH_ILI9341) {
tft.fillRoundRect(18, 150, 60, 40, 6, FrameColor);
tft.drawRoundRect(18, 150, 60, 40, 6, ActiveColor);
tft.fillRoundRect(240, 150, 60, 40, 6, FrameColor);
tft.drawRoundRect(240, 150, 60, 40, 6, ActiveColor);
tft.fillRoundRect(240, 40, 60, 40, 6, FrameColor);
tft.drawRoundRect(240, 40, 60, 40, 6, ActiveColor);
tftPrint(0, "-", 48, 156, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, "+", 270, 160, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, "OK", 270, 48, ActiveColor, ActiveColorSmooth, 28);
}
}
switch (CurrentTheme) {
@@ -4337,12 +4348,12 @@ void DoMenu() {
OneBigLineSprite.setTextDatum(TL_DATUM);
OneBigLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
OneBigLineSprite.drawString("dBμV", 155, 0);
OneBigLineSprite.drawString("dB", 155, 0);
OneBigLineSprite.setTextDatum(TR_DATUM);
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
OneBigLineSprite.drawString((LevelOffset > 0 ? "+" : "") + String(LevelOffset, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
tftPrint(-1, "dBμV", 190, 165, ActiveColor, ActiveColorSmooth, 28);
tftPrint(-1, "dBμV", 179, 165, ActiveColor, ActiveColorSmooth, 28);
SStatusold = 2000;
change = true;
break;

View File

@@ -9,6 +9,15 @@ void doTouchEvent(uint16_t x, uint16_t y) {
if (scandxmode) {
cancelDXScan();
} else {
if (menu) {
if (menuopen) {
if (x > 18 && x < 78 && y > 150 && y < 190) KeyDown();
if (x > 240 && x < 300 && y > 150 && y < 190) KeyUp();
if (x > 240 && x < 300 && y > 40 && y < 80) ButtonPress();
return;
}
}
if (!menu && !BWtune) { // All pages except menu
if (x > 50 && x < 90 && y > 0 && y < 30 && band < BAND_GAP) { // ---------------------
doStereoToggle(); // Stereo toggle

View File

@@ -13,6 +13,7 @@ extern bool afscreen;
extern bool BWtune;
extern bool leave;
extern bool menu;
extern bool menuopen;
extern bool scandxmode;
extern bool seek;
extern byte band;
@@ -31,4 +32,7 @@ extern void doStereoToggle();
extern void cancelDXScan();
extern void doBW();
extern void drawButton(const char* text, byte button_number, bool active);
extern void KeyDown();
extern void KeyUp();
extern void ButtonPress();
#endif