xref: /MusicPlayer2/MusicPlayer2/CommonData.cpp (revision 37b47f93469b61b1b5c7e0d173cf38f878fdfc9f)
1 #include "stdafx.h"
2 #include "CommonData.h"
3 #include "MusicPlayer2.h"
4 
ShowWindowMenuBar() const5 bool UIData::ShowWindowMenuBar() const
6 {
7     return show_menu_bar && theApp.m_app_setting_data.show_window_frame && !full_screen;
8 }
9 
ShowUiMenuBar() const10 bool UIData::ShowUiMenuBar() const
11 {
12     return show_menu_bar && !theApp.m_app_setting_data.show_window_frame && !full_screen;
13 }
14 
TitleDisplayItem() const15 int ApperanceSettingData::TitleDisplayItem() const
16 {
17     int value{};
18     if (show_minimize_btn_in_titlebar)
19         value |= (1 << 0);
20     if (show_maximize_btn_in_titlebar)
21         value |= (1 << 1);
22     if (show_minimode_btn_in_titlebar)
23         value |= (1 << 2);
24     if (show_fullscreen_btn_in_titlebar)
25         value |= (1 << 3);
26     if (show_skin_btn_in_titlebar)
27         value |= (1 << 4);
28     if (show_settings_btn_in_titlebar)
29         value |= (1 << 5);
30     return value;
31 }
32 
Init(LPCTSTR font_name)33 void FontSet::Init(LPCTSTR font_name)
34 {
35     for (int font_size{ FONT_SIZE_MIN }; font_size <= FONT_SIZE_MAX; font_size++)
36     {
37         fonts[font_size].SetFont(font_size, font_name);
38     }
39     dlg.SetFont(9, font_name);
40 }
41 
GetFontBySize(int font_size)42 UIFont& FontSet::GetFontBySize(int font_size)
43 {
44     if (font_size < FONT_SIZE_MIN)
45         font_size = FONT_SIZE_MIN;
46     if (font_size > FONT_SIZE_MAX)
47         font_size = FONT_SIZE_MAX;
48     auto iter = fonts.find(font_size);
49     if (iter != fonts.end())
50         return iter->second;
51     return dlg;
52 }
53