2023-09-09 08:03:56 +01:00
|
|
|
/* Copyright 2023 Dual Tachyon
|
|
|
|
* https://github.com/DualTachyon
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "app/dtmf.h"
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
|
|
|
#include "app/fm.h"
|
|
|
|
#endif
|
2023-10-14 14:07:05 +01:00
|
|
|
#include "app/search.h"
|
2023-09-09 08:03:56 +01:00
|
|
|
#include "driver/keyboard.h"
|
|
|
|
#include "misc.h"
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_AIRCOPY
|
2023-09-09 08:03:56 +01:00
|
|
|
#include "ui/aircopy.h"
|
|
|
|
#endif
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
|
|
|
#include "ui/fmradio.h"
|
|
|
|
#endif
|
2023-09-09 08:03:56 +01:00
|
|
|
#include "ui/inputbox.h"
|
|
|
|
#include "ui/main.h"
|
|
|
|
#include "ui/menu.h"
|
2023-10-14 14:07:05 +01:00
|
|
|
#include "ui/search.h"
|
2023-09-09 08:03:56 +01:00
|
|
|
#include "ui/ui.h"
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
gui_display_type_t g_screen_to_display;
|
|
|
|
gui_display_type_t g_request_display_screen = DISPLAY_INVALID;
|
|
|
|
uint8_t g_ask_for_confirmation;
|
|
|
|
bool g_ask_to_save;
|
|
|
|
bool g_ask_to_delete;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
|
|
|
void GUI_DisplayScreen(void)
|
|
|
|
{
|
2023-10-09 22:49:29 +01:00
|
|
|
g_update_display = false;
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
switch (g_screen_to_display)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
|
|
|
case DISPLAY_MAIN:
|
|
|
|
UI_DisplayMain();
|
|
|
|
break;
|
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
|
|
|
case DISPLAY_FM:
|
|
|
|
UI_DisplayFM();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2023-09-09 08:03:56 +01:00
|
|
|
case DISPLAY_MENU:
|
|
|
|
UI_DisplayMenu();
|
|
|
|
break;
|
|
|
|
|
2023-10-13 15:12:32 +01:00
|
|
|
case DISPLAY_SEARCH:
|
|
|
|
UI_DisplaySearch();
|
2023-09-09 08:03:56 +01:00
|
|
|
break;
|
|
|
|
|
2023-09-14 09:56:30 +01:00
|
|
|
#ifdef ENABLE_AIRCOPY
|
2023-09-09 08:03:56 +01:00
|
|
|
case DISPLAY_AIRCOPY:
|
|
|
|
UI_DisplayAircopy();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
void GUI_SelectNextDisplay(gui_display_type_t Display)
|
2023-09-09 08:03:56 +01:00
|
|
|
{
|
2023-10-06 19:31:29 +01:00
|
|
|
if (Display == DISPLAY_INVALID)
|
|
|
|
return;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
if (g_screen_to_display != Display)
|
2023-10-06 19:31:29 +01:00
|
|
|
{
|
|
|
|
DTMF_clear_input_box();
|
2023-09-18 11:29:28 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_input_box_index = 0;
|
|
|
|
g_is_in_sub_menu = false;
|
|
|
|
g_css_scan_mode = CSS_SCAN_MODE_OFF;
|
2023-10-13 15:12:32 +01:00
|
|
|
g_scan_state_dir = SCAN_STATE_DIR_OFF;
|
2023-10-06 19:31:29 +01:00
|
|
|
#ifdef ENABLE_FMRADIO
|
2023-10-08 20:23:37 +01:00
|
|
|
g_fm_scan_state = FM_SCAN_OFF;
|
2023-10-06 19:31:29 +01:00
|
|
|
#endif
|
2023-10-08 20:23:37 +01:00
|
|
|
g_ask_for_confirmation = 0;
|
|
|
|
g_ask_to_save = false;
|
|
|
|
g_ask_to_delete = false;
|
2023-10-09 22:49:29 +01:00
|
|
|
g_fkey_pressed = false;
|
2023-09-09 08:03:56 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_update_status = true;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|
2023-10-06 19:31:29 +01:00
|
|
|
|
2023-10-08 20:23:37 +01:00
|
|
|
g_screen_to_display = Display;
|
|
|
|
g_update_display = true;
|
2023-09-09 08:03:56 +01:00
|
|
|
}
|