K1Guitar/UI/UI_global.h

301 lines
14 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);
extern void (*MenuPage_Language_Proc)(void);
extern void (*MenuPage_UsbConfirm_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);
void CallUI_Language(void);
void CallUI_UsbConfirm(void);
#define UI_STATUS_BAR_H 26
/* 0902-01/02 需求稿:分割线 y=36,居中于顶栏图标底与移调/速度控件顶之间 */
#define UI0902_STATUS_SEP_Y 36
/* 顶/底共用:暗灰蓝,1px;暗底上可辨但不抢眼 */
#define UI0902_SEP_LINE_COLOR 0x31C9 /* RGB(48,56,72) */
#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 列表行背景 */
/* K1_UI_0923-04(240×320):
* 状态栏底约 y29,移调/速度 y39–94;TAB y98;曲目行 y120–151;
* 音色行 y172–203;段落钮 y224–258;底栏图标 y264。 */
#define UI0902_MARGIN_X 12
#define UI0902_CONTENT_W 216
#define UI0902_CARD_GAP_TOP 13
/* K1_UI_0923-05:移调卡 x11–115 y39–93;速度卡紧随其后,三角色块中线 y74 */
#define UI0902_CARD_X 11
#define UI0902_CARD_Y 39
#define UI0902_CARD_H 55
#define UI0902_CARD_W 105
#define UI0902_CARD_GAP 7
#define UI0902_CARD_CTRL_CY 74
#define UI0902_MODE_Y 98 /* 节奏类型 / 本地曲目 顶 */
#define UI0902_MODE_H 54 /* TAB18 + 间隙4 + 曲目行32(顶 y120) */
#define UI0902_TIMBRE_Y 172
#define UI0902_TIMBRE_H 32
#define UI0902_SECTION_Y 224
#define UI0902_SECTION_H 35
#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))
#define UI0902_CARD_TEXT_CX_L (UI0902_CARD_X + UI0902_CARD_W / 2)
#define UI0902_CARD_TEXT_CX_R (UI0902_CARD_X + UI0902_CARD_W + UI0902_CARD_GAP + UI0902_CARD_W / 2)
#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 46
#define UI0902_CARD_VALUE_SIZE UI0902_FONT_HERO /* 16 */
#define UI0902_CARD_VALUE_LH 16
#define UI0902_CARD_VALUE_W 42 /* 3×13:101/Cb 完整 */
#define UI0902_CARD_VALUE_H 17
/* 主值顶 = CTRL_CY - 字高/2,与左右三角、± 同一水平中线 */
#define UI0902_CARD_VALUE_Y (UI0902_CARD_CTRL_CY - UI0902_CARD_VALUE_SIZE / 2)
#define UI0902_CARD_VALUE_OX 0
#define UI0902_CARD_VALUE_OY 0
#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 80
/* 段落钮与底栏分隔线(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 35
#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
/* 0923:开 13x20 / 关 19x20;擦除区取最大宽度并居中 */
#define UI0902_BT_ON_W 13
#define UI0902_BT_ON_H 20
#define UI0902_BT_OFF_W 19
#define UI0902_BT_OFF_H 20
#define UI0902_BT_W UI0902_BT_OFF_W
#define UI0902_BT_H UI0902_BT_OFF_H
#define UI0902_BT_X ((240 - UI0902_BT_W) / 2) /* 居中 */
#define UI0902_BT_Y 5
/* 状态栏蓝牙点击热区:略大于图标,便于点按 */
#define UI0902_BT_HIT_PAD_X 14
#define UI0902_BT_HIT_X0 ((UI0902_BT_X > UI0902_BT_HIT_PAD_X) \
? (uint16_t)(UI0902_BT_X - UI0902_BT_HIT_PAD_X) : 0)
#define UI0902_BT_HIT_X1 (uint16_t)(UI0902_BT_X + UI0902_BT_W + UI0902_BT_HIT_PAD_X - 1)
#define UI0902_BT_HIT_Y0 0
#define UI0902_BT_HIT_Y1 (uint16_t)(UI_STATUS_BAR_H + 2)
#define UI0902_BATTERY_W 29
#define UI0902_BATTERY_H 12
/* 0924 充电态:闪电电池图 40x13。外壳左壁在图内 x=11,内腔 x=14 起、宽 21 */
#define UI0902_BATTERY_CHG_W 40
#define UI0902_BATTERY_CHG_H 13
#define UI0902_BATTERY_CHG_FILL_DX 14
#define UI0902_BATTERY_CHG_FILL_DY 3
#define UI0902_BATTERY_CHG_FILL_MAX 21
#define UI0902_BATTERY_CHG_FILL_H 6
#define UI0902_BATTERY_CHG_FILL 0xDF04 /* 与闪电同色 RGB(217,224,33) */
/* 与音量/蓝牙大致居中后再下移 2px:12px 高 → 顶 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 8
#define UI0902_HUB_CARD_W 223
#define UI0902_HUB_CARD_H 66
#define UI0902_HUB_CARD_Y0 48
#define UI0902_HUB_CARD_GAP 8
#define UI0902_HUB_CARD_Y1 (UI0902_HUB_CARD_Y0 + UI0902_HUB_CARD_H + UI0902_HUB_CARD_GAP) /* 122 */
#define UI0902_HUB_CARD_Y2 (UI0902_HUB_CARD_Y1 + UI0902_HUB_CARD_H + UI0902_HUB_CARD_GAP) /* 196 */
#define UI0902_HUB_FONT UI0902_FONT_HERO /* 16,与标题级统一 */
/* 0924 系统语言:两档大按钮 223x82 */
#define UI0902_LANG_BTN_X 8
#define UI0902_LANG_BTN_W 223
#define UI0902_LANG_BTN_H 82
#define UI0902_LANG_BTN_Y0 58
#define UI0902_LANG_BTN_GAP 10
#define UI0902_LANG_BTN_Y1 (UI0902_LANG_BTN_Y0 + UI0902_LANG_BTN_H + UI0902_LANG_BTN_GAP)
/* 0924 USB 确认:底部横排取消(灰)/确认(蓝) */
#define UI0902_USB_BTN_W 103
#define UI0902_USB_BTN_H 64
#define UI0902_USB_BTN_Y 236
#define UI0902_USB_BTN_XL 13
#define UI0902_USB_BTN_XR 124
/* 0904 / 0902-06·07·08 子页顶栏:返回用 调音台控件-1.png(30×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) */
/* 与设置入口卡片同一套:x=8、宽 223、圆角 12、间距 8。四行排不下 66 高,改为 62。 */
#define UI0902_SET_ROW_X 8
#define UI0902_SET_ROW_W 223
#define UI0902_SET_ROW_H 62
#define UI0902_SET_ROW_Y0 42
#define UI0902_SET_ROW_PITCH 70
#define UI0902_SET_ROW_FONT UI0902_FONT_HERO
/* 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
/* 底栏触区:段落钮底(y264)之下四等分全宽,各 60×55 */
#define UI0902_NAV_Y0 265
#define UI0902_NAV_Y1 319
#define UI0902_NAV_W 60
#define UI0902_NAV_X0(i) ((uint16_t)((i) * UI0902_NAV_W))
#define UI0902_NAV_X1(i) ((uint16_t)((i) * UI0902_NAV_W + UI0902_NAV_W - 1))
/* 兼容旧名(已废弃三键:设置|调音台|模式) */
#define UI0902_NAV_MIXER UI0902_NAV_NORMAL
#define UI0902_NAV_MODE UI0902_NAV_EXPERT
/* 0924 底栏:从图 K1_UI_0924-03/04/05 切出的放大图标+两字(万能/普通/专业/设置) */
#define gImage_Nav_Universal_Sel gImage_Nav0924_Universal_Sel_33x46
#define gImage_Nav_Universal_Not gImage_Nav0924_Universal_Not_33x46
#define gImage_Nav_Normal_Sel gImage_Nav0924_Normal_Sel_34x46
#define gImage_Nav_Normal_Not gImage_Nav0924_Normal_Not_34x46
#define gImage_Nav_Expert_Sel gImage_Nav0924_Expert_Sel_33x46
#define gImage_Nav_Expert_Not gImage_Nav0924_Expert_Not_33x46
#define gImage_Nav_Setting_Sel gImage_Nav0924_Setting_Sel_34x46
#define gImage_Nav_Setting_Not gImage_Nav0924_Setting_Not_34x46
#define UI0902_NAV_ICON_Y 264
#define UI0902_NAV_ICON_H 46
/* 旧几何电池(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);
/* 状态栏蓝牙图标点击:开关电源、同步设置项与 NVM、刷新图标 */
void UI_StatusBar_ToggleBluetooth(void);
void Draw_Tab_Section_Menu(const LEBEL_UI *UI, TAB_SECTION_INDEX select_tab);
void UI_NavBar_Action(uint8_t value);
/* 设置入口及其子页:播放与物理键仍按进入前的模式,不点设置项 */
uint8_t UI_IsSettingsPage(void);
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 Show_home_UI_Diff(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);
/* 系统设置顶栏:MiSans 标题 + 需求图返回箭头 */
extern void UI_DrawSystemSetHeader(void);
/* 节奏类型→1.bin / 本地曲目→2.bin / 万能→3.bin */
extern void UI_ApplyToneAddress(void);
extern void UI_ReloadTonePreset(void);
/* 开机/切曲目:万能与节奏套默认 BPM;本地曲目不改速度。键未变则不覆盖手调 */
void TrackBpm_Invalidate(void);
uint8_t TrackBpm_SyncGui(void);
uint16_t TrackBpm_Peek(void);
void TrackBpm_OnPresetLoaded(void);
/* 每次开机:蓝牙开、节奏/曲目/走向/段落回默认,并套当前曲目 BPM */
void Session_ApplyPowerOnDefaults(void);
#endif