parent
89aaf43722
commit
c823ca8150
|
@ -3514,6 +3514,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
case WM_DPICHANGED:
|
case WM_DPICHANGED:
|
||||||
{
|
{
|
||||||
const UINT dpi = LOWORD(wParam);
|
const UINT dpi = LOWORD(wParam);
|
||||||
|
_toolBar.resizeIconsDpi(dpi);
|
||||||
|
|
||||||
_statusBar.setPartWidth(STATUSBAR_DOC_SIZE, DPIManagerV2::scale(220, dpi));
|
_statusBar.setPartWidth(STATUSBAR_DOC_SIZE, DPIManagerV2::scale(220, dpi));
|
||||||
_statusBar.setPartWidth(STATUSBAR_CUR_POS, DPIManagerV2::scale(260, dpi));
|
_statusBar.setPartWidth(STATUSBAR_CUR_POS, DPIManagerV2::scale(260, dpi));
|
||||||
|
|
|
@ -125,7 +125,10 @@ bool ToolBar::init( HINSTANCE hInst, HWND hPere, toolBarStatusType type, ToolBar
|
||||||
Window::init(hInst, hPere);
|
Window::init(hInst, hPere);
|
||||||
|
|
||||||
_state = type;
|
_state = type;
|
||||||
int iconSize = NppParameters::getInstance()._dpiManager.scaleX(_state == TB_LARGE || _state == TB_LARGE2 ? 32 : 16);
|
|
||||||
|
_dpiManager.setDpi(hPere);
|
||||||
|
|
||||||
|
int iconSize = _dpiManager.scale(_state == TB_LARGE || _state == TB_LARGE2 ? 32 : 16);
|
||||||
|
|
||||||
_toolBarIcons.init(buttonUnitArray, arraySize, _vDynBtnReg);
|
_toolBarIcons.init(buttonUnitArray, arraySize, _vDynBtnReg);
|
||||||
_toolBarIcons.create(_hInst, iconSize);
|
_toolBarIcons.create(_hInst, iconSize);
|
||||||
|
@ -231,7 +234,7 @@ int ToolBar::getHeight() const
|
||||||
|
|
||||||
void ToolBar::reduce()
|
void ToolBar::reduce()
|
||||||
{
|
{
|
||||||
int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleX(16);
|
int iconDpiDynamicalSize = _dpiManager.scale(16);
|
||||||
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
||||||
setState(TB_SMALL);
|
setState(TB_SMALL);
|
||||||
reset(true); //recreate toolbar if previous state was Std icons or Big icons
|
reset(true); //recreate toolbar if previous state was Std icons or Big icons
|
||||||
|
@ -240,7 +243,7 @@ void ToolBar::reduce()
|
||||||
|
|
||||||
void ToolBar::enlarge()
|
void ToolBar::enlarge()
|
||||||
{
|
{
|
||||||
int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleX(32);
|
int iconDpiDynamicalSize = _dpiManager.scale(32);
|
||||||
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
||||||
setState(TB_LARGE);
|
setState(TB_LARGE);
|
||||||
reset(true); //recreate toolbar if previous state was Std icons or Small icons
|
reset(true); //recreate toolbar if previous state was Std icons or Small icons
|
||||||
|
@ -249,7 +252,7 @@ void ToolBar::enlarge()
|
||||||
|
|
||||||
void ToolBar::reduceToSet2()
|
void ToolBar::reduceToSet2()
|
||||||
{
|
{
|
||||||
int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleX(16);
|
int iconDpiDynamicalSize = _dpiManager.scale(16);
|
||||||
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
||||||
|
|
||||||
setState(TB_SMALL2);
|
setState(TB_SMALL2);
|
||||||
|
@ -259,7 +262,7 @@ void ToolBar::reduceToSet2()
|
||||||
|
|
||||||
void ToolBar::enlargeToSet2()
|
void ToolBar::enlargeToSet2()
|
||||||
{
|
{
|
||||||
int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleX(32);
|
int iconDpiDynamicalSize = _dpiManager.scale(32);
|
||||||
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
||||||
setState(TB_LARGE2);
|
setState(TB_LARGE2);
|
||||||
reset(true); //recreate toolbar if previous state was Std icons or Small icons
|
reset(true); //recreate toolbar if previous state was Std icons or Small icons
|
||||||
|
@ -373,7 +376,7 @@ void ToolBar::reset(bool create)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Else set the internal imagelist with standard bitmaps
|
//Else set the internal imagelist with standard bitmaps
|
||||||
int iconDpiDynamicalSize = NppParameters::getInstance()._dpiManager.scaleX(16);
|
int iconDpiDynamicalSize = _dpiManager.scale(16);
|
||||||
::SendMessage(_hSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(iconDpiDynamicalSize, iconDpiDynamicalSize));
|
::SendMessage(_hSelf, TB_SETBITMAPSIZE, 0, MAKELPARAM(iconDpiDynamicalSize, iconDpiDynamicalSize));
|
||||||
|
|
||||||
TBADDBITMAP addbmp = { 0, 0 };
|
TBADDBITMAP addbmp = { 0, 0 };
|
||||||
|
@ -398,7 +401,7 @@ void ToolBar::reset(bool create)
|
||||||
if (create)
|
if (create)
|
||||||
{ //if the toolbar has been recreated, readd the buttons
|
{ //if the toolbar has been recreated, readd the buttons
|
||||||
_nbCurrentButtons = _nbTotalButtons;
|
_nbCurrentButtons = _nbTotalButtons;
|
||||||
WORD btnSize = (_state == TB_LARGE ? 32 : 16);
|
WORD btnSize = static_cast<WORD>(_dpiManager.scale((_state == TB_LARGE || _state == TB_LARGE2) ? 32 : 16));
|
||||||
::SendMessage(_hSelf, TB_SETBUTTONSIZE , 0, MAKELONG(btnSize, btnSize));
|
::SendMessage(_hSelf, TB_SETBUTTONSIZE , 0, MAKELONG(btnSize, btnSize));
|
||||||
::SendMessage(_hSelf, TB_ADDBUTTONS, _nbTotalButtons, reinterpret_cast<LPARAM>(_pTBB));
|
::SendMessage(_hSelf, TB_ADDBUTTONS, _nbTotalButtons, reinterpret_cast<LPARAM>(_pTBB));
|
||||||
}
|
}
|
||||||
|
@ -510,6 +513,14 @@ void ToolBar::doPopop(POINT chevPoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolBar::resizeIconsDpi(UINT dpi)
|
||||||
|
{
|
||||||
|
_dpiManager.setDpi(dpi);
|
||||||
|
const int iconDpiDynamicalSize = _dpiManager.scale((_state == TB_LARGE || _state == TB_LARGE2) ? 32 : 16);
|
||||||
|
_toolBarIcons.resizeIcon(iconDpiDynamicalSize);
|
||||||
|
reset(true);
|
||||||
|
}
|
||||||
|
|
||||||
void ToolBar::addToRebar(ReBar * rebar)
|
void ToolBar::addToRebar(ReBar * rebar)
|
||||||
{
|
{
|
||||||
if (_pRebar)
|
if (_pRebar)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
#include "Notepad_plus_msgs.h"
|
#include "Notepad_plus_msgs.h"
|
||||||
#include "ImageListSet.h"
|
#include "ImageListSet.h"
|
||||||
|
#include "dpiManagerV2.h"
|
||||||
|
|
||||||
#define REBAR_BAR_TOOLBAR 0
|
#define REBAR_BAR_TOOLBAR 0
|
||||||
#define REBAR_BAR_SEARCH 1
|
#define REBAR_BAR_SEARCH 1
|
||||||
|
@ -101,6 +102,8 @@ public :
|
||||||
|
|
||||||
void addToRebar(ReBar * rebar);
|
void addToRebar(ReBar * rebar);
|
||||||
|
|
||||||
|
void resizeIconsDpi(UINT dpi);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
TBBUTTON *_pTBB = nullptr;
|
TBBUTTON *_pTBB = nullptr;
|
||||||
ToolBarIcons _toolBarIcons;
|
ToolBarIcons _toolBarIcons;
|
||||||
|
@ -116,6 +119,8 @@ private :
|
||||||
|
|
||||||
TiXmlNode *_toolIcons = nullptr;
|
TiXmlNode *_toolIcons = nullptr;
|
||||||
|
|
||||||
|
DPIManagerV2 _dpiManager;
|
||||||
|
|
||||||
void setDefaultImageList() {
|
void setDefaultImageList() {
|
||||||
::SendMessage(_hSelf, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_toolBarIcons.getDefaultLst()));
|
::SendMessage(_hSelf, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_toolBarIcons.getDefaultLst()));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue