parent
a92a9fd7c7
commit
01a088f994
|
@ -1899,55 +1899,6 @@ bool NppParameters::isInFontList(const std::wstring& fontName2Search) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGFONT NppParameters::getDefaultGUIFont(DefaultFontType type)
|
|
||||||
{
|
|
||||||
LOGFONT lf{};
|
|
||||||
NONCLIENTMETRICS ncm{};
|
|
||||||
ncm.cbSize = sizeof(NONCLIENTMETRICS);
|
|
||||||
if (::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0) != FALSE)
|
|
||||||
{
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case DefaultFontType::menu:
|
|
||||||
{
|
|
||||||
lf = ncm.lfMenuFont;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case DefaultFontType::status:
|
|
||||||
{
|
|
||||||
lf = ncm.lfStatusFont;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case DefaultFontType::caption:
|
|
||||||
{
|
|
||||||
lf = ncm.lfCaptionFont;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case DefaultFontType::smcaption:
|
|
||||||
{
|
|
||||||
lf = ncm.lfSmCaptionFont;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// case DefaultFontType::message:
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
lf = ncm.lfMessageFont;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // should not happen, fallback
|
|
||||||
{
|
|
||||||
auto hf = static_cast<HFONT>(::GetStockObject(DEFAULT_GUI_FONT));
|
|
||||||
::GetObject(hf, sizeof(LOGFONT), &lf);
|
|
||||||
}
|
|
||||||
return lf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NppParameters::getLangKeywordsFromXmlTree()
|
void NppParameters::getLangKeywordsFromXmlTree()
|
||||||
{
|
{
|
||||||
TiXmlNode *root =
|
TiXmlNode *root =
|
||||||
|
|
|
@ -1546,9 +1546,6 @@ public:
|
||||||
bool isInFontList(const std::wstring& fontName2Search) const;
|
bool isInFontList(const std::wstring& fontName2Search) const;
|
||||||
const std::vector<std::wstring>& getFontList() const { return _fontlist; }
|
const std::vector<std::wstring>& getFontList() const { return _fontlist; }
|
||||||
|
|
||||||
enum class DefaultFontType { menu, status, message, caption, smcaption };
|
|
||||||
static LOGFONT getDefaultGUIFont(DefaultFontType type = DefaultFontType::message);
|
|
||||||
|
|
||||||
int getNbUserLang() const {return _nbUserLang;}
|
int getNbUserLang() const {return _nbUserLang;}
|
||||||
UserLangContainer & getULCFromIndex(size_t i) {return *_userLangArray[i];};
|
UserLangContainer & getULCFromIndex(size_t i) {return *_userLangArray[i];};
|
||||||
UserLangContainer * getULCFromName(const TCHAR *userLangName);
|
UserLangContainer * getULCFromName(const TCHAR *userLangName);
|
||||||
|
|
|
@ -300,8 +300,6 @@ void FindReplaceDlg::create(int dialogID, bool isRTL, bool msgDestParent, bool t
|
||||||
getClientRect(rect);
|
getClientRect(rect);
|
||||||
_tab.init(_hInst, _hSelf, false, true);
|
_tab.init(_hInst, _hSelf, false, true);
|
||||||
NppDarkMode::subclassTabControl(_tab.getHSelf());
|
NppDarkMode::subclassTabControl(_tab.getHSelf());
|
||||||
int tabDpiDynamicalHeight = dpiManager.scaleY(13);
|
|
||||||
_tab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight);
|
|
||||||
|
|
||||||
const TCHAR *find = TEXT("Find");
|
const TCHAR *find = TEXT("Find");
|
||||||
const TCHAR *replace = TEXT("Replace");
|
const TCHAR *replace = TEXT("Replace");
|
||||||
|
|
|
@ -1005,9 +1005,6 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
_ctrlTab.init(_hInst, _hSelf, false);
|
_ctrlTab.init(_hInst, _hSelf, false);
|
||||||
NppDarkMode::subclassTabControl(_ctrlTab.getHSelf());
|
NppDarkMode::subclassTabControl(_ctrlTab.getHSelf());
|
||||||
|
|
||||||
int tabDpiDynamicalHeight = nppParam._dpiManager.scaleY(13);
|
|
||||||
_ctrlTab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight);
|
|
||||||
|
|
||||||
_folderStyleDlg.init(_hInst, _hSelf);
|
_folderStyleDlg.init(_hInst, _hSelf);
|
||||||
_folderStyleDlg.create(IDD_FOLDER_STYLE_DLG);
|
_folderStyleDlg.create(IDD_FOLDER_STYLE_DLG);
|
||||||
_folderStyleDlg.display();
|
_folderStyleDlg.display();
|
||||||
|
|
|
@ -123,11 +123,11 @@ void DockingCont::doDialog(bool willBeShown, bool isFloating)
|
||||||
::ShowWindow(_hCaption, SW_SHOW);
|
::ShowWindow(_hCaption, SW_SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
//If you want defualt GUI font
|
//If you want default GUI font
|
||||||
LOGFONT lfTab{ NppParameters::getDefaultGUIFont() };
|
LOGFONT lfTab{ DPIManagerV2::getDefaultGUIFontForDpi(_hParent) };
|
||||||
_hFont = ::CreateFontIndirect(&lfTab);
|
_hFont = ::CreateFontIndirect(&lfTab);
|
||||||
|
|
||||||
LOGFONT lfCaption{ NppParameters::getDefaultGUIFont(NppParameters::DefaultFontType::smcaption) };
|
LOGFONT lfCaption{ DPIManagerV2::getDefaultGUIFontForDpi(_hParent, DPIManagerV2::FontType::smcaption) };
|
||||||
_hFontCaption = ::CreateFontIndirect(&lfCaption);
|
_hFontCaption = ::CreateFontIndirect(&lfCaption);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||||
rc.right = rc.bottom - rc.top;
|
rc.right = rc.bottom - rc.top;
|
||||||
rc.bottom += 14;
|
rc.bottom += 14;
|
||||||
|
|
||||||
LOGFONT lf{ NppParameters::getDefaultGUIFont(NppParameters::DefaultFontType::smcaption) };
|
LOGFONT lf{ DPIManagerV2::getDefaultGUIFontForDpi(_hParent, DPIManagerV2::FontType::smcaption) };
|
||||||
lf.lfEscapement = 900;
|
lf.lfEscapement = 900;
|
||||||
hFont = ::CreateFontIndirect(&lf);
|
hFont = ::CreateFontIndirect(&lf);
|
||||||
if (hFont == nullptr)
|
if (hFont == nullptr)
|
||||||
|
@ -612,7 +612,7 @@ void DockingCont::drawCaptionItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||||
{
|
{
|
||||||
if (_hFont == nullptr)
|
if (_hFont == nullptr)
|
||||||
{
|
{
|
||||||
LOGFONT lf{ NppParameters::getDefaultGUIFont() };
|
LOGFONT lf{ DPIManagerV2::getDefaultGUIFontForDpi(_hParent) };
|
||||||
_hFont = ::CreateFontIndirect(&lf);
|
_hFont = ::CreateFontIndirect(&lf);
|
||||||
}
|
}
|
||||||
auto hOld = static_cast<HFONT>(::SelectObject(hDc, _hFont));
|
auto hOld = static_cast<HFONT>(::SelectObject(hDc, _hFont));
|
||||||
|
|
|
@ -898,7 +898,7 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
||||||
|
|
||||||
if (_hFontSearchEdit == nullptr)
|
if (_hFontSearchEdit == nullptr)
|
||||||
{
|
{
|
||||||
LOGFONT lf{ NppParameters::getDefaultGUIFont() };
|
LOGFONT lf{ DPIManagerV2::getDefaultGUIFontForDpi(_hParent) };
|
||||||
_hFontSearchEdit = ::CreateFontIndirect(&lf);
|
_hFontSearchEdit = ::CreateFontIndirect(&lf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,6 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
|
||||||
NppDarkMode::subclassTabControl(_tab.getHSelf());
|
NppDarkMode::subclassTabControl(_tab.getHSelf());
|
||||||
DPIManager& dpiManager = NppParameters::getInstance()._dpiManager;
|
DPIManager& dpiManager = NppParameters::getInstance()._dpiManager;
|
||||||
|
|
||||||
int tabDpiDynamicalHeight = dpiManager.scaleY(13);
|
|
||||||
_tab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight);
|
|
||||||
|
|
||||||
const TCHAR *available = TEXT("Available");
|
const TCHAR *available = TEXT("Available");
|
||||||
const TCHAR *updates = TEXT("Updates");
|
const TCHAR *updates = TEXT("Updates");
|
||||||
const TCHAR *installed = TEXT("Installed");
|
const TCHAR *installed = TEXT("Installed");
|
||||||
|
@ -150,7 +147,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
|
||||||
getMappedChildRect(IDC_PLUGINADM_EDIT, rcDesc);
|
getMappedChildRect(IDC_PLUGINADM_EDIT, rcDesc);
|
||||||
|
|
||||||
const long margeX = ::GetSystemMetrics(SM_CXEDGE);
|
const long margeX = ::GetSystemMetrics(SM_CXEDGE);
|
||||||
const long margeY = tabDpiDynamicalHeight;
|
const long margeY = dpiManager.scaleY(13);
|
||||||
|
|
||||||
rect.bottom = rcDesc.bottom + margeY;
|
rect.bottom = rcDesc.bottom + margeY;
|
||||||
_tab.reSizeTo(rect);
|
_tab.reSizeTo(rect);
|
||||||
|
|
|
@ -73,6 +73,16 @@ void TabBar::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isMultiLin
|
||||||
{
|
{
|
||||||
throw std::runtime_error("TabBar::init : CreateWindowEx() function return null");
|
throw std::runtime_error("TabBar::init : CreateWindowEx() function return null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_hFont == nullptr)
|
||||||
|
{
|
||||||
|
const UINT dpi = DPIManagerV2::getDpiForWindow(_hParent);
|
||||||
|
LOGFONT lf{ DPIManagerV2::getDefaultGUIFontForDpi(dpi) };
|
||||||
|
lf.lfHeight = DPIManagerV2::scaleFont(8, dpi);
|
||||||
|
_hFont = ::CreateFontIndirect(&lf);
|
||||||
|
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,13 +347,17 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isMult
|
||||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||||
_tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(TabBarPlus_Proc)));
|
_tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(TabBarPlus_Proc)));
|
||||||
|
|
||||||
auto& dpiManager = NppParameters::getInstance()._dpiManager;
|
const UINT dpi = DPIManagerV2::getDpiForWindow(_hParent);
|
||||||
|
LOGFONT lf{ DPIManagerV2::getDefaultGUIFontForDpi(dpi) };
|
||||||
LOGFONT lf{ NppParameters::getDefaultGUIFont() };
|
|
||||||
LOGFONT lfVer{ lf };
|
LOGFONT lfVer{ lf };
|
||||||
|
if (_hFont != nullptr)
|
||||||
|
{
|
||||||
|
::DeleteObject(_hFont);
|
||||||
|
_hFont = nullptr;
|
||||||
|
}
|
||||||
_hFont = ::CreateFontIndirect(&lf);
|
_hFont = ::CreateFontIndirect(&lf);
|
||||||
lf.lfWeight = FW_HEAVY;
|
lf.lfWeight = FW_HEAVY;
|
||||||
lf.lfHeight = -(dpiManager.pointsToPixels(10));
|
lf.lfHeight = DPIManagerV2::scaleFont(10, dpi);
|
||||||
_hLargeFont = ::CreateFontIndirect(&lf);
|
_hLargeFont = ::CreateFontIndirect(&lf);
|
||||||
|
|
||||||
lfVer.lfEscapement = 900;
|
lfVer.lfEscapement = 900;
|
||||||
|
|
Loading…
Reference in New Issue