Skip to content

Commit

Permalink
Merge remote-tracking branch 'FxmlesXD/master' into DEV
Browse files Browse the repository at this point in the history
  • Loading branch information
lrisora committed Sep 10, 2023
2 parents ce9cccd + 5846d02 commit 7074b8b
Show file tree
Hide file tree
Showing 11 changed files with 266 additions and 39 deletions.
15 changes: 15 additions & 0 deletions MusicPlayer2/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,21 @@ bool CCommon::CharIsNumber(wchar_t ch)
return (ch >= L'0' && ch <= L'9');
}

bool CCommon::CharIsCJKCharacter(wchar_t ch)
{
https://zh.wikipedia.org/wiki/Unicode%E5%8D%80%E6%AE%B5
return (ch >= 0x4E00 && ch <= 0x9FFF) || // 中日韩统一表意文字 (基本区)
(ch >= 0x20000 && ch <= 0x2A6DF) || // 中日韩统一表意文字扩展区B
(ch >= 0x2A700 && ch <= 0x2B73F) || // 中日韩统一表意文字扩展区C
(ch >= 0x2B740 && ch <= 0x2B81F) || // 中日韩统一表意文字扩展区D
(ch >= 0x2B820 && ch <= 0x2CEAF) || // 中日韩统一表意文字扩展区E
(ch >= 0x2CEB0 && ch <= 0x2EBEF) || // 中日韩统一表意文字扩展区F
(ch >= 0x3040 && ch <= 0x309F) || // 平假名
(ch >= 0x30A0 && ch <= 0x30FF) || // 片假名
(ch >= 0xAC00 && ch <= 0xD7AF) || // 谚文音节
(ch >= 0xD7B0 && ch <= 0xD7FF); // 谚文字母扩展-B
}

void CCommon::StringSplit(const wstring& str, wchar_t div_ch, vector<wstring>& results, bool skip_empty, bool trim)
{
results.clear();
Expand Down
3 changes: 3 additions & 0 deletions MusicPlayer2/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ class CCommon

static bool CharIsNumber(wchar_t ch);

//判断一个字符是否是CJK字符
static bool CharIsCJKCharacter(wchar_t ch);

//将一个字符串分割成若干个字符串
//str: 原始字符串
//div_ch: 用于分割的字符
Expand Down
1 change: 1 addition & 0 deletions MusicPlayer2/CommonData.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ struct DesktopLyricSettingData //桌面歌词设置
bool lyric_background_penetrate{ false };
bool show_unlock_when_locked{ true }; //桌面歌词锁定时显示解锁图标
Alignment lyric_align{ Alignment::AUTO }; //歌词的对齐方式
bool lyric_column_mode{ true }; //是否开启竖排模式
};

struct LyricSettingData
Expand Down
1 change: 1 addition & 0 deletions MusicPlayer2/DesktopLyric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void CDesktopLyric::ShowLyric()
return;

SetLyricDoubleLine(theApp.m_lyric_setting_data.desktop_lyric_data.lyric_double_line);
SetLyricColumnMode(theApp.m_lyric_setting_data.desktop_lyric_data.lyric_column_mode);
SetShowTranslate(theApp.m_lyric_setting_data.show_translate);
SetAlignment(theApp.m_lyric_setting_data.desktop_lyric_data.lyric_align);
SetLyricKaraokeDisplay(theApp.m_lyric_setting_data.lyric_karaoke_disp);
Expand Down
8 changes: 8 additions & 0 deletions MusicPlayer2/LyricSettingsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void CLyricSettingsDlg::DoDataExchange(CDataExchange* pDX)
//DDX_Control(pDX, IDC_SEARCH_BOX_OPAQUE_CHECK, m_search_box_opaque_chk);
DDX_Control(pDX, IDC_SHOW_DESKTOP_LYRIC, m_show_desktop_lyric_chk);
DDX_Control(pDX, IDC_LYRIC_DOUBLE_LINE_CHECK2, m_desktop_lyric_double_line_chk);
DDX_Control(pDX, IDC_LYRIC_COLUMN_MODE_CHECK, m_desktop_lyric_column_mode_chk);
DDX_Control(pDX, IDC_TEXT_COLOR1_STATIC, m_text_color1_static);
DDX_Control(pDX, IDC_TEXT_COLOR2_STATIC, m_text_color2_static);
DDX_Control(pDX, IDC_TEXT_GRADIENT_COMBO, m_text_gradient_combo);
Expand Down Expand Up @@ -87,6 +88,7 @@ BEGIN_MESSAGE_MAP(CLyricSettingsDlg, CTabDlg)
ON_BN_CLICKED(IDC_HIDE_LYRIC_WITHOUT_LYRIC_CHECK, &CLyricSettingsDlg::OnBnClickedHideLyricWithoutLyricCheck)
ON_BN_CLICKED(IDC_HIDE_LYRIC_PAUSE_CHECK, &CLyricSettingsDlg::OnBnClickedHideLyricPauseCheck)
ON_BN_CLICKED(IDC_LYRIC_DOUBLE_LINE_CHECK2, &CLyricSettingsDlg::OnBnClickedLyricDoubleLineCheck2)
ON_BN_CLICKED(IDC_LYRIC_COLUMN_MODE_CHECK, &CLyricSettingsDlg::OnBnClickedLyricColumnModeCheck)
ON_BN_CLICKED(IDC_DEFAULT_STYLE, &CLyricSettingsDlg::OnBnClickedDefaultStyle)
ON_COMMAND(ID_LYRIC_DEFAULT_STYLE1, &CLyricSettingsDlg::OnLyricDefaultStyle1)
ON_COMMAND(ID_LYRIC_DEFAULT_STYLE2, &CLyricSettingsDlg::OnLyricDefaultStyle2)
Expand Down Expand Up @@ -162,6 +164,7 @@ BOOL CLyricSettingsDlg::OnInitDialog()
m_highlight_color1_static.SetFillColor(m_data.desktop_lyric_data.highlight_color1);
m_highlight_color2_static.SetFillColor(m_data.desktop_lyric_data.highlight_color2);
m_desktop_lyric_double_line_chk.SetCheck(m_data.desktop_lyric_data.lyric_double_line);
m_desktop_lyric_column_mode_chk.SetCheck(m_data.desktop_lyric_data.lyric_column_mode);
m_lock_desktop_lyric_chk.SetCheck(m_data.desktop_lyric_data.lock_desktop_lyric);
m_hide_lyric_without_lyric_chk.SetCheck(m_data.desktop_lyric_data.hide_lyric_window_without_lyric);
m_hide_lyric_paused_chk.SetCheck(m_data.desktop_lyric_data.hide_lyric_window_when_paused);
Expand Down Expand Up @@ -594,6 +597,11 @@ void CLyricSettingsDlg::OnBnClickedLyricDoubleLineCheck2()
m_data.desktop_lyric_data.lyric_double_line = (m_desktop_lyric_double_line_chk.GetCheck() != 0);
}

void CLyricSettingsDlg::OnBnClickedLyricColumnModeCheck()
{
// TODO: 在此添加控件通知处理程序代码
m_data.desktop_lyric_data.lyric_column_mode = (m_desktop_lyric_column_mode_chk.GetCheck() != 0);
}

void CLyricSettingsDlg::OnBnClickedDefaultStyle()
{
Expand Down
2 changes: 2 additions & 0 deletions MusicPlayer2/LyricSettingsDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class CLyricSettingsDlg : public CTabDlg
//CButton m_search_box_opaque_chk;

CButton m_desktop_lyric_double_line_chk;
CButton m_desktop_lyric_column_mode_chk;
CColorStaticEx m_text_color1_static;
CColorStaticEx m_text_color2_static;
CMyComboBox m_text_gradient_combo;
Expand Down Expand Up @@ -117,6 +118,7 @@ class CLyricSettingsDlg : public CTabDlg
afx_msg void OnBnClickedHideLyricWithoutLyricCheck();
afx_msg void OnBnClickedHideLyricPauseCheck();
afx_msg void OnBnClickedLyricDoubleLineCheck2();
afx_msg void OnBnClickedLyricColumnModeCheck();
afx_msg void OnBnClickedDefaultStyle();
afx_msg void OnLyricDefaultStyle1();
afx_msg void OnLyricDefaultStyle2();
Expand Down
Loading

0 comments on commit 7074b8b

Please sign in to comment.