247 lines
8.6 KiB
C
247 lines
8.6 KiB
C
#include "includes.h"
|
||
|
||
// ==============================
|
||
// <20><>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
|
||
// ==============================
|
||
#define BTN_Y_START 275 // <20><>ť<EFBFBD><C5A5>ʼY
|
||
#define BTN_HEIGHT 40 // <20><>ť<EFBFBD>߶<EFBFBD>
|
||
#define BTN_WIDTH 105 // <20><>ť<EFBFBD><C5A5><EFBFBD>
|
||
#define BTN_GAP 5 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
|
||
#define BTN_RADIUS 6 // Բ<><D4B2>
|
||
|
||
// <20><>ɫ
|
||
#define BTN_COLOR_CANCEL 0x4A4A // <20><>ɫȡ<C9AB><C8A1>
|
||
#define BTN_COLOR_CONFIRM 0x03B7 // <20><>ɫȷ<C9AB><C8B7>
|
||
#define BTN_TEXT_COLOR 0xFFFF // <20><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
||
#define BTN_TEXT_SIZE 16
|
||
|
||
|
||
extern const Touch_AreaTypeDef *pCurrentTouch_Area;
|
||
|
||
const Touch_AreaTypeDef Touch_SystemSetting_Areas[] =
|
||
{
|
||
// Xmin, Xmax, Ymin, Ymax, flag, Value, ID, action
|
||
{ 115, 170, 110, 170, -1, 0, GUI_BLUETOOTH_SW, NULL },
|
||
{ 170, 225, 110, 170, 1, 0, GUI_BLUETOOTH_SW, NULL },
|
||
{ 115, 170, 175, 235, -1, 0, GUI_AUTOCLOSE, NULL },
|
||
{ 170, 225, 175, 235, 1, 0, GUI_AUTOCLOSE, NULL },
|
||
{ 115, 170, 240, 300, -1, 0, GUI_RESTORE, NULL },
|
||
{ 170, 225, 240, 300, 1, 0, GUI_RESTORE, NULL },
|
||
// { 15, 15+BTN_WIDTH, BTN_Y_START, BTN_Y_START+BTN_HEIGHT, 0, 0, GUI_CANCEL, NULL },
|
||
// { 15+BTN_WIDTH+BTN_GAP, 15+BTN_WIDTH*2+BTN_GAP, BTN_Y_START, BTN_Y_START+BTN_HEIGHT, 0, 1, GUI_CONFIRM, NULL },
|
||
{ 0, 50, 0, 50, 0, 0, 0, NULL },
|
||
};
|
||
|
||
#define TOUCH_AREA_SYSTEMSETTING_NUM (sizeof(Touch_SystemSetting_Areas)/sizeof(Touch_AreaTypeDef))
|
||
|
||
GUI_SWITCH mGuiData_SystemSETTING[] = {
|
||
{ 0, 0, 2, GUI_VERSION}, // 0
|
||
{ 0, 0, 1, GUI_BLUETOOTH_SW},
|
||
{ 0, 1, 3, GUI_AUTOCLOSE},
|
||
{ 0, 0, 1, GUI_RESTORE},
|
||
};
|
||
|
||
LEBEL_UI SystemSetting[] =
|
||
{
|
||
{15, 230,35+10,60, (const uint8_t*)"\xB9\xCC\xBC\xFE\xB0\xE6\xB1\xBE", LCD_ALIGN_LEFT, WHITE, BLACK, 13, LCD_ALIGN_CENTER, WHITE, BLACK, 11, GUI_VERSION},
|
||
{15, 230,95+10+5,60, (const uint8_t*)"\xC0\xB6\xD1\xC0\xC1\xB4\xBD\xD3", LCD_ALIGN_LEFT, WHITE, BLACK, 13, LCD_ALIGN_CENTER, WHITE, BLACK, 11, GUI_BLUETOOTH_SW},
|
||
{15, 230,160+10+5,60,(const uint8_t*)"\xD7\xD4\xB6\xAF\xB9\xD8\xBB\xFA", LCD_ALIGN_LEFT, WHITE, BLACK, 13, LCD_ALIGN_CENTER, WHITE, BLACK, 11, GUI_AUTOCLOSE},
|
||
{15, 230,225+10+5,60,(const uint8_t*)"\xBB\xD6\xB8\xB4\xB3\xF6\xB3\xA7\xC9\xE8\xD6\xC3", LCD_ALIGN_LEFT, WHITE, BLACK, 13, LCD_ALIGN_CENTER, WHITE, BLACK, 11, GUI_RESTORE},
|
||
};
|
||
|
||
// ==============================
|
||
// <20><><EFBFBD>Ƶײ<C6B5><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
||
// ==============================
|
||
void UI_Draw_Bottom_Buttons(void)
|
||
{
|
||
LCD_FillByColor(0, 270, 240, 320, BLACK);
|
||
// ȡ<><C8A1><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>
|
||
LCD_FillRoundRect(
|
||
15,
|
||
BTN_Y_START,
|
||
BTN_WIDTH,
|
||
BTN_HEIGHT,
|
||
BTN_RADIUS,
|
||
BTN_COLOR_CANCEL
|
||
);
|
||
LCD_ShowChinese_AutoAlign(
|
||
15, 15 + BTN_WIDTH,
|
||
BTN_Y_START + (BTN_HEIGHT - BTN_TEXT_SIZE)/2,
|
||
(uint8_t*)"\xC8\xB1\xCF\xF8\x00",
|
||
LCD_ALIGN_CENTER,
|
||
BTN_TEXT_COLOR,
|
||
BTN_COLOR_CANCEL,
|
||
0,
|
||
BTN_TEXT_SIZE
|
||
);
|
||
|
||
// ȷ<><C8B7><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD>ң<EFBFBD>
|
||
LCD_FillRoundRect(
|
||
15 + BTN_WIDTH + BTN_GAP,
|
||
BTN_Y_START,
|
||
BTN_WIDTH,
|
||
BTN_HEIGHT,
|
||
BTN_RADIUS,
|
||
BTN_COLOR_CONFIRM
|
||
);
|
||
LCD_ShowChinese_AutoAlign(
|
||
15 + BTN_WIDTH + BTN_GAP,
|
||
15 + BTN_WIDTH*2 + BTN_GAP,
|
||
BTN_Y_START + (BTN_HEIGHT - BTN_TEXT_SIZE)/2,
|
||
(uint8_t*)"\xC8\xB7\xB6\xA8\x00",
|
||
LCD_ALIGN_CENTER,
|
||
BTN_TEXT_COLOR,
|
||
BTN_COLOR_CONFIRM,
|
||
0,
|
||
BTN_TEXT_SIZE
|
||
);
|
||
}
|
||
|
||
// ==============================
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<F2A3A8B9><CCB6><EFBFBD>Χ<EFBFBD><CEA7>
|
||
// ==============================
|
||
#define TOP_TITLE_X1 0
|
||
#define TOP_TITLE_X2 240
|
||
#define TOP_TITLE_Y1 0
|
||
#define TOP_TITLE_Y2 35
|
||
#define TOP_TITLE_BG_COLOR BLACK // <20><><EFBFBD><EFBFBD>ɫ
|
||
#define TOP_TITLE_TEXT_COLOR WHITE // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
||
#define TOP_TITLE_FONT_SIZE 16 // <20><><EFBFBD><EFBFBD><EFBFBD>С
|
||
#define TOP_TITLE_ALIGN LCD_ALIGN_CENTER // <20><><EFBFBD><EFBFBD>
|
||
|
||
// ==============================
|
||
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣺<EFBFBD><E2A3BA><EFBFBD><EFBFBD>̨
|
||
// ==============================
|
||
void UI_DrawTop_TiaoYinTai(void)
|
||
{
|
||
LCD_FillByColor(0, 0, 240, 320, TOP_TITLE_BG_COLOR);
|
||
|
||
LCD_WR_PIC(10,0 ,40,31,gImage_Return);
|
||
|
||
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>16<31><36><EFBFBD>֣<EFBFBD>
|
||
LCD_ShowChinese_AutoAlign(
|
||
TOP_TITLE_X1, TOP_TITLE_X2, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
TOP_TITLE_Y1 + (TOP_TITLE_Y2 - TOP_TITLE_Y1 - TOP_TITLE_FONT_SIZE)/2, // <20><>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD>
|
||
(uint8_t*)"\xB5\xF7\xD2\xF4\xCC\xA8", // <20><><EFBFBD><EFBFBD>̨
|
||
TOP_TITLE_ALIGN,
|
||
TOP_TITLE_TEXT_COLOR,
|
||
TOP_TITLE_BG_COLOR,
|
||
0,
|
||
TOP_TITLE_FONT_SIZE
|
||
);
|
||
}
|
||
|
||
// ==============================
|
||
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣺ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>
|
||
// ==============================
|
||
void UI_DrawTop_SystemSetting(void)
|
||
{
|
||
LCD_FillByColor(0, 0, 240, 320, TOP_TITLE_BG_COLOR);
|
||
|
||
|
||
LCD_WR_PIC(10,0 ,40,31,gImage_Return);
|
||
// <20><>ʾ<EFBFBD><CABE>ϵͳ<CFB5><CDB3><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>С<EFBFBD>16<31><36><EFBFBD>֣<EFBFBD>
|
||
LCD_ShowChinese_AutoAlign(
|
||
TOP_TITLE_X1, TOP_TITLE_X2,
|
||
TOP_TITLE_Y1 + (TOP_TITLE_Y2 - TOP_TITLE_Y1 - TOP_TITLE_FONT_SIZE)/2,
|
||
(uint8_t*)"\xCF\xB5\xCD\xB3\xC9\xE8\xD6\xC3", // ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>
|
||
TOP_TITLE_ALIGN,
|
||
TOP_TITLE_TEXT_COLOR,
|
||
TOP_TITLE_BG_COLOR,
|
||
0,
|
||
TOP_TITLE_FONT_SIZE
|
||
);
|
||
}
|
||
|
||
|
||
|
||
void DrawSystemSetting(void)
|
||
{
|
||
Draw_System_Item_List(&SystemSetting[GUI_VERSION],&mGuiData_SystemSETTING[GUI_VERSION]);
|
||
Draw_System_Item_List(&SystemSetting[GUI_BLUETOOTH_SW],&mGuiData_SystemSETTING[GUI_BLUETOOTH_SW]);
|
||
Draw_System_Item_List(&SystemSetting[GUI_AUTOCLOSE],&mGuiData_SystemSETTING[GUI_AUTOCLOSE]);
|
||
Draw_System_Item_List(&SystemSetting[GUI_RESTORE],&mGuiData_SystemSETTING[GUI_RESTORE]);
|
||
}
|
||
|
||
// ==============================
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// ==============================
|
||
void Touch_SystemSettingAction(int8_t FLAG, uint8_t ID, uint8_t areaIndex, uint8_t value)
|
||
{
|
||
uint16_t last_value;
|
||
|
||
|
||
if(ID == 0)
|
||
{
|
||
MenuPage_SystemSetting_Proc();
|
||
}
|
||
|
||
// --------------------------
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
||
// --------------------------
|
||
last_value = mGuiData_SystemSETTING[ID].Current;
|
||
switch(ID)
|
||
{
|
||
case GUI_BLUETOOTH_SW:
|
||
GUI_Item_AjustValue(&mGuiData_SystemSETTING[ID], FLAG);
|
||
RefreshSystemSetting(last_value, &SystemSetting[ID], &mGuiData_SystemSETTING[ID]);
|
||
break;
|
||
|
||
case GUI_AUTOCLOSE:
|
||
GUI_Item_AjustLoopValue(&mGuiData_SystemSETTING[ID], FLAG);
|
||
RefreshSystemSetting(last_value, &SystemSetting[ID], &mGuiData_SystemSETTING[ID]);
|
||
break;
|
||
|
||
case GUI_RESTORE:
|
||
// GUI_Item_AjustValue(&mGuiData_SystemSETTING[ID], FLAG);
|
||
// RefreshSystemSetting(last_value, &SystemSetting[ID], &mGuiData_SystemSETTING[ID]);
|
||
MenuPage_Restore_Proc();
|
||
break;
|
||
}
|
||
}
|
||
|
||
void UI_Setting_Init(void)
|
||
{
|
||
// LCD_WR_REG(0x28); // Display OFF
|
||
UI_DrawTop_SystemSetting();
|
||
DrawSystemSetting();
|
||
pCurrentTouch_Area = Touch_SystemSetting_Areas;
|
||
// LCD_WR_REG(0x29); // Display ON
|
||
}
|
||
|
||
void UI_Setting_Process(DisplayTaskMessage_Type msg)
|
||
{
|
||
switch(msg.MessageType)
|
||
{
|
||
case MSG_ID_TOUCH :
|
||
for(uint8_t k=0; k<TOUCH_AREA_SYSTEMSETTING_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 )
|
||
{
|
||
Touch_SystemSettingAction(pCurrentTouch_Area[k].Flag,pCurrentTouch_Area[k].ID,k,0);
|
||
ResetAutoPowerCount();
|
||
}
|
||
}
|
||
break;
|
||
case MSG_ID_EC_VOL:
|
||
// //LCD_ShowString(200, 0, Num_To_String(msg.DataU16[1],buff,3), RED, WHITE, 16, 0);
|
||
// uint8_t vol = msg.DataU16[1];
|
||
// uint8_t level;
|
||
// if (vol <= 5) level = 0;
|
||
// else if (vol <= 35) level = 1;
|
||
// else if (vol <= 65) level = 2;
|
||
// else if (vol <= 95) level = 3;
|
||
// else if (vol <= 115) level = 4;
|
||
// else level = 5;
|
||
// //Draw_Volume_Bar(5, 5, level, 1, WHITE, GRAY);
|
||
// uint8_t mMasterSysExVolume[12] = { 0xF0, 0x41, 0x00, 0x42, 0x12, 0x40, 0x00, 0x04, 0x64, 0x00, 0x00,0xF7};
|
||
// memset(mMasterSysExVolume+8,msg.DataU16[1],1);
|
||
// SendMidiDataToDreamDSP(mMasterSysExVolume,12);
|
||
//
|
||
// ResetAutoPowerCount();
|
||
break;
|
||
}
|
||
|
||
}
|