K1Guitar/UI/UI_global.h

233 lines
10 KiB
C
Raw 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.

#ifndef __UI_GLOBAL_H__
#define __UI_GLOBAL_H__
extern void (*MenuPage_Idle_Proc)(void);
extern void (*MenuPage_SongMode_Proc)(void);
extern void (*MenuPage_ExpertMode_Proc)(void);
extern void (*MenuPage_FreeMode_Proc)(void);
extern void (*MenuPage_Setting_Proc)(void);
extern void (*MenuPage_SystemSetting_Proc)(void);
extern void (*MenuPage_Mixer_Proc)(void);
extern void (*MenuPage_Restore_Proc)(void);;
// ==============================================
// <20><><EFBFBD><EFBFBD> UI <20><><EFBFBD>ú<EFBFBD><C3BA><EFBFBD>
// ==============================================
extern void InitMenuUI(void);
void CallUI_Idle(void);
void CallUI_SongMode(void);
void CallUI_ExpertMode(void);
void CallUI_FreeMode(void);
void CallUI_Setting(void);
void CallUI_Mixer(void);
void CallUI_SystemSetting(void);
void CallUI_RestoreSelect(void);
#define UI_STATUS_BAR_H 26
/* 0902-01/02 需求稿:分割线 y=36居中于顶栏图标底与移调/速度控件顶之间 */
#define UI0902_STATUS_SEP_Y 36
/* 顶/底共用偏亮灰蓝2px 厚,保证暗底上可辨 */
#define UI0902_SEP_LINE_COLOR 0x94D5 /* RGB(144,152,168) */
#define UI0902_SEP_LINE_THICK 1
#define UI0902_STATUS_SEP_COLOR UI0902_SEP_LINE_COLOR
/* 0902 设计稿配色与底栏导航 */
#define UI0902_BG_COLOR 0x0042 /* #000813 页面背景 */
#define UI0902_ROW_BG 0x2147 /* #242B3A 列表行背景 */
/* 0902-04 普通模式实测240×320
* 双卡 y48 h55 w105 gap8和弦行 y130 h31音色 y180 h30段落钮 y229 h34 */
#define UI0902_MARGIN_X 12
#define UI0902_CONTENT_W 216
#define UI0902_CARD_GAP_TOP 22
#define UI0902_CARD_Y (UI_STATUS_BAR_H + UI0902_CARD_GAP_TOP) /* 48 */
#define UI0902_CARD_H 55
#define UI0902_CARD_W 105
#define UI0902_CARD_GAP 8
#define UI0902_MODE_Y (UI0902_CARD_Y + UI0902_CARD_H + 5) /* 108TAB 顶 */
#define UI0902_MODE_H 53 /* TAB18 + 间隙4 + 曲目行31 */
#define UI0902_TIMBRE_Y 180
#define UI0902_TIMBRE_H 30
#define UI0902_SECTION_Y 231 /* 0904段落钮顶 ≈231 */
#define UI0902_SECTION_H 34
#define UI0902_FONT_LABEL 11 /* 标注:移调/速度 Medium 11 */
#define UI0902_FONT_BODY 13 /* 曲目/音色正文、演奏段落 */
#define UI0902_FONT_HERO 16 /* 主值 C/88 与稿面大号一致 */
#define UI0902_FONT_SUB 9 /* KEY/BPM */
#define UI0902_FONT_NAV 9
/* ASCII 字宽(须与 Drv LCD_GetAsciiMetrics 一致) */
#define UI0902_ASCII_W(sz) \
((sz) == 8 ? 6 : \
(sz) == 9 ? 8 : \
(sz) == 11 ? 7 : \
(sz) == 12 ? 8 : \
(sz) == 13 || (sz) == 15 ? 11 : \
(sz) == 16 ? 13 : ((sz) / 2 + 1))
/* 移调卡文字(主值加宽+下移 KEY防 Cb/101 底/右裁切) */
#define UI0902_CARD_TEXT_CX_L (UI0902_MARGIN_X + UI0902_CARD_W / 2) /* 64 */
#define UI0902_CARD_TEXT_CX_R (UI0902_MARGIN_X + UI0902_CARD_W + UI0902_CARD_GAP + UI0902_CARD_W / 2) /* 176 */
#define UI0902_CARD_LABEL_SIZE UI0902_FONT_LABEL /* 11 */
#define UI0902_CARD_LABEL_LH 13
#define UI0902_CARD_LABEL_W 22
#define UI0902_CARD_LABEL_H 11
#define UI0902_CARD_LABEL_Y 54
#define UI0902_CARD_VALUE_SIZE UI0902_FONT_HERO /* 16 */
#define UI0902_CARD_VALUE_LH 16
#define UI0902_CARD_VALUE_W 42 /* 3×13101/Cb 完整 */
#define UI0902_CARD_VALUE_H 17
/* mode.png主值≈y7185KEY/BPM≈y89加大与「移调/速度」间距、收紧与 KEY/BPM */
#define UI0902_CARD_VALUE_Y 73
#define UI0902_CARD_SUB_SIZE UI0902_FONT_SUB /* 9 */
#define UI0902_CARD_SUB_LH 9
#define UI0902_CARD_SUB_W 32
#define UI0902_CARD_SUB_H 9
#define UI0902_CARD_SUB_Y 89
/* 段落钮与底栏分隔线mode.png ≈ y274颜色与顶栏共用 UI0902_SEP_LINE_COLOR */
#define UI0902_SEP_LINE_Y 274
/* 兼容旧相对偏移宏(= 绝对Y - CARD_Y */
#define UI0902_CARD_LABEL_DY (UI0902_CARD_LABEL_Y - UI0902_CARD_Y)
#define UI0902_CARD_VALUE_DY (UI0902_CARD_VALUE_Y - UI0902_CARD_Y)
#define UI0902_CARD_SUB_DY (UI0902_CARD_SUB_Y - UI0902_CARD_Y)
#define UI0902_TAB_H 18
#define UI0902_TAB_W 55
#define UI0902_TAB_GAP 6
#define UI0902_ROW_H 31
#define UI0902_SECTION_BTN_H 34
#define UI0902_SECTION_BTN_W 47
#define UI0902_SECTION_PITCH 57
#define UI0902_RADIUS_CARD 10
#define UI0902_RADIUS_TAB 6
#define UI0902_RADIUS_BTN 6
#define UI0902_BTN_MINUS_W 23
#define UI0902_BTN_MINUS_H 22
#define UI0902_BTN_PLUS_W 23
#define UI0902_BTN_PLUS_H 22
#define UI0902_TRI_L_W 22 /* 0902 控件-11 左三角 */
#define UI0902_TRI_L_H 22
#define UI0902_TRI_R_W 23 /* 0902 控件-12 右三角 */
#define UI0902_TRI_R_H 22
#define UI0902_TAB_BACK_W 30
#define UI0902_TAB_BACK_H 24
/* 0902 状态栏:左音量条 / 中蓝牙 / 右电池+百分比(对齐屏幕参考 0902-01 */
#define UI0902_VOL_X 8
#define UI0902_VOL_Y 3
#define UI0902_BT_W 11
#define UI0902_BT_H 17
#define UI0902_BT_X ((240 - UI0902_BT_W) / 2) /* 居中 */
#define UI0902_BT_Y 5
#define UI0902_BATTERY_W 29
#define UI0902_BATTERY_H 12
/* 与音量/蓝牙大致居中后再下移 2px12px 高 → 顶 y9 */
#define UI0902_BATTERY_Y 9
#define UI0902_BATTERY_RIGHT_MARGIN 6
#define UI0902_BATTERY_TEXT_GAP 2
#define UI0902_BATTERY_TEXT_SIZE 9 /* mode.png 百分比字号 ≈9完整显示 % */
/* 0904 / 0902-11 设置入口:两大卡片 + 底栏「设置」高亮 */
#define UI0902_HUB_CARD_X 10
#define UI0902_HUB_CARD_W 220
#define UI0902_HUB_CARD_H 85
#define UI0902_HUB_CARD_Y0 67
#define UI0902_HUB_CARD_GAP 5
#define UI0902_HUB_CARD_Y1 (UI0902_HUB_CARD_Y0 + UI0902_HUB_CARD_H + UI0902_HUB_CARD_GAP) /* 157 */
#define UI0902_HUB_FONT UI0902_FONT_HERO /* 16与标题级统一 */
/* 0904 / 0902-06·07·08 子页顶栏:返回用 调音台控件-1.png30×24 */
#define UI0902_SUB_BACK_X 8
#define UI0902_SUB_BACK_Y 7
#define UI0902_SUB_BACK_W 30
#define UI0902_SUB_BACK_H 24
#define UI0902_SUB_TITLE_Y 12
#define UI0902_SUB_TITLE_SIZE UI0902_FONT_HERO
#define UI0902_SUB_SEP_Y 38
/* 0904 / 0902-07 系统设置四行(稿面行框 ≈x16 w207 */
#define UI0902_SET_ROW_X 16
#define UI0902_SET_ROW_W 207
#define UI0902_SET_ROW_H 58
#define UI0902_SET_ROW_Y0 51
#define UI0902_SET_ROW_PITCH 63
#define UI0902_SET_ROW_FONT UI0902_FONT_BODY /* 13 */
/* 0904 / 0902-08 恢复出厂:竖排确认(灰)/取消(蓝) */
#define UI0902_RESTORE_BTN_X 10
#define UI0902_RESTORE_BTN_W 220
#define UI0902_RESTORE_BTN_H 68
#define UI0902_RESTORE_BTN_Y0 104
#define UI0902_RESTORE_BTN_Y1 183
#define UI0902_RESTORE_BTN_FONT UI0902_FONT_HERO
#define UI0902_NAV_UNIVERSAL 0 /* 底栏:万能模式 */
#define UI0902_NAV_NORMAL 1 /* 底栏:普通模式 */
#define UI0902_NAV_EXPERT 2 /* 底栏:专业模式 */
#define UI0902_NAV_SETTING 3 /* 底栏:设置 */
#define UI0902_NAV_NONE 0xFF
/* 兼容旧名(已废弃三键:设置|调音台|模式) */
#define UI0902_NAV_MIXER UI0902_NAV_NORMAL
#define UI0902_NAV_MODE UI0902_NAV_EXPERT
/* 底部图标实际内容(生成脚本曾把 万能/普通/专业/设置 误命名为 Setting/Mixer/Mode */
#define gImage_Nav_Universal_Not gImage_UI0902_TabSetting_Sel_36x28 /* 底部-10 白 */
#define gImage_Nav_Universal_Sel gImage_UI0902_TabMode_Sel_36x28 /* 底部-14 蓝 */
#define gImage_Nav_Normal_Not gImage_UI0902_TabSetting_Not_35x28 /* 底部-11 白 */
#define gImage_Nav_Normal_Sel gImage_UI0902_TabMode_Not_35x29 /* 底部-15 蓝 */
#define gImage_Nav_Expert_Not gImage_UI0902_TabMixer_Sel_35x27 /* 底部-12 白 */
#define gImage_Nav_Expert_Sel gImage_UI0902_TabBack_Sel_35x27 /* 底部-16 蓝 */
#define gImage_Nav_Setting_Not gImage_UI0902_TabMixer_Not_18x28 /* 底部-13 白 */
#define gImage_Nav_Setting_Sel gImage_UI0902_TabBack_Not_18x28 /* 底部-17 蓝 */
/* 旧几何电池Draw_Battery_Icon最左起点0902 图电池用 Draw_Status_Battery_Icon */
#define UI_STATUS_BATTERY_X 150
#define UI_STATUS_BATTERY_H 11
#define UI_STATUS_BATTERY_Y ((UI_STATUS_BAR_H - UI_STATUS_BATTERY_H) / 2)
#define UI_STATUS_BATTERY_RIGHT_MARGIN 8
#define UI_FOCUS_NONE 0xFF
void UI_ClearFocus(void);
uint8_t UI_IsFocused(uint8_t widget_id);
uint8_t UI_SetFocus(uint8_t widget_id);
void UI_GetFocusGrad(uint8_t widget_id, uint16_t *c_top, uint16_t *c_bot);
void Draw_Status_Battery_Icon(uint8_t battery_percent);
void Show_Battery_Icon(uint8_t flag);
void UI_DrawStatusSepLine(void);
void Show_BL_Icon(uint8_t value);
void Draw_Tab_Section_Menu(const LEBEL_UI *UI, TAB_SECTION_INDEX select_tab);
void UI_NavBar_Action(uint8_t value);
void Draw_Bottom_Bar(uint8_t sel, uint8_t first_back);
void UI_GotoCurrentModePage(void);
void GET_Num_Str(int16_t NUM, uint8_t ValidLen, char* Str, uint8_t hasSign);
void show_Param(const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void Show_home_UI(void);
extern void Touch_Action(int8_t FLAG, uint8_t ID, uint8_t areaIndex, uint8_t value);
//extern void Refresh_Transpose(uint8_t last_data, const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void Refresh_Transpose(const LEBEL_UI *UI, GUI_SWITCH * Group);
extern void Refresh_StringTimbre(uint8_t last_data, const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void label_top(void);
extern void label_Tranzpose_ui(const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void label_Speed_ui(const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void label_ModeSelece_ui(const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void label_TimbreSelece_ui(const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void label_PlaySection_ui(const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void label_Tab_Select_ui(const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void Refresh_SectionSelect(uint16_t last_value, const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void Refresh_TabSelect_ui(const LEBEL_UI *UI, GUI_SWITCH *Group);
extern void RefreshSystemSetting(uint8_t last_data,const LEBEL_UI *UI,GUI_SWITCH * Group);
extern void RestoreSetting(void);
extern void Draw_System_Item_List(const LEBEL_UI *UI, GUI_SWITCH *Group);
/* 子页顶栏:左返回 + 居中标题(调音台/系统设置) */
extern void UI_DrawSubPageHeader(const uint8_t *title_gbk);
/* 节奏类型→1.bin / 本地曲目→2.bin / 万能→3.bin */
extern void UI_ApplyToneAddress(void);
extern void UI_ReloadTonePreset(void);
#endif