K1Guitar/UI/UI_Restore.c

83 lines
2.6 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "includes.h"
/* 0904 / 0902-08<EFBC9A>?+ 标题「恢复出厂设置<E8AEBE>? 竖排 确认(<28>? / 取消(<28>?,无底栏 */
/* 确认/取消用预渲染位图避免字库码点错位显示为「缺哮<E7BCBA>?*/
extern const Touch_AreaTypeDef *pCurrentTouch_Area;
const Touch_AreaTypeDef Touch_Restore_Areas[] =
{
{ 0, 44, 0, 40, 0, 0, GUI_CANCEL, NULL },
{ UI0902_RESTORE_BTN_X,
(uint16_t)(UI0902_RESTORE_BTN_X + UI0902_RESTORE_BTN_W - 1),
UI0902_RESTORE_BTN_Y0,
(uint16_t)(UI0902_RESTORE_BTN_Y0 + UI0902_RESTORE_BTN_H - 1),
0, 0, GUI_CONFIRM, NULL },
{ UI0902_RESTORE_BTN_X,
(uint16_t)(UI0902_RESTORE_BTN_X + UI0902_RESTORE_BTN_W - 1),
UI0902_RESTORE_BTN_Y1,
(uint16_t)(UI0902_RESTORE_BTN_Y1 + UI0902_RESTORE_BTN_H - 1),
0, 0, GUI_CANCEL, NULL },
};
#define TOUCH_AREA_RESTORE_NUM (sizeof(Touch_Restore_Areas)/sizeof(Touch_AreaTypeDef))
#define RESTORE_TXT_W 50
#define RESTORE_TXT_H 24
static void UI_Restore_DrawButton(uint16_t y, uint16_t bg, const unsigned char *label)
{
uint16_t tx = (uint16_t)(UI0902_RESTORE_BTN_X + (UI0902_RESTORE_BTN_W - RESTORE_TXT_W) / 2);
uint16_t ty = (uint16_t)(y + (UI0902_RESTORE_BTN_H - RESTORE_TXT_H) / 2);
LCD_FillRoundRect(UI0902_RESTORE_BTN_X, y,
UI0902_RESTORE_BTN_W, UI0902_RESTORE_BTN_H,
UI0902_RADIUS_CARD, bg);
LCD_WR_PIC_Trans(tx, ty, RESTORE_TXT_W, RESTORE_TXT_H, label, BLACK);
}
void UI_Restore_Select_Init(void)
{
UI_ClearFocus();
LCD_FillByColor(0, 0, 240, 320, UI0902_BG_COLOR);
UI_DrawSubPageHeader((const uint8_t *)"\xBB\xD6\xB8\xB4\xB3\xF6\xB3\xA7\xC9\xE8\xD6\xC3");
UI_Restore_DrawButton(UI0902_RESTORE_BTN_Y0, UI0902_ROW_BG,
gImage_UI0902_Txt_Confirm_50x24);
UI_Restore_DrawButton(UI0902_RESTORE_BTN_Y1, COLOR_GRAD_MID,
gImage_UI0902_Txt_Cancel_50x24);
pCurrentTouch_Area = Touch_Restore_Areas;
}
void UI_Restore_Select_Process(DisplayTaskMessage_Type msg)
{
switch (msg.MessageType)
{
case MSG_ID_TOUCH:
for (uint8_t k = 0; k < TOUCH_AREA_RESTORE_NUM; k++)
{
if (msg.HiByte >= pCurrentTouch_Area[k].x_min &&
msg.HiByte <= pCurrentTouch_Area[k].x_max &&
msg.LoByte >= pCurrentTouch_Area[k].y_min &&
msg.LoByte <= pCurrentTouch_Area[k].y_max)
{
switch (pCurrentTouch_Area[k].ID)
{
case GUI_CANCEL:
MenuPage_Setting_Proc();
break;
case GUI_CONFIRM:
RestoreSetting();
MenuPage_Setting_Proc();
break;
default:
break;
}
ResetAutoPowerCount();
break;
}
}
break;
default:
break;
}
}