Skip to content

Commit

Permalink
New HighRes icons for tree, for HiDPI displays.
Browse files Browse the repository at this point in the history
  • Loading branch information
jovibor committed Nov 18, 2021
1 parent 58f1a29 commit 73bbad4
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 17 deletions.
5 changes: 3 additions & 2 deletions Pepper/Pepper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="res\TreeMain_Dirs.ico" />
<Image Include="res\TreeMain_Header.ico" />
<Image Include="res\IDI_TREE_PEDIRS.ico" />
<Image Include="res\IDI_TREE_PEHEADER.ico" />
<Image Include="res\IDI_TREE_PERESOURCE.ico" />
<Image Include="res\Pepper.ico" />
<Image Include="res\Toolbar256.bmp" />
</ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions Pepper/Pepper.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@
<Image Include="res\Toolbar256.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\TreeMain_Dirs.ico">
<Image Include="res\IDI_TREE_PEDIRS.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\TreeMain_Header.ico">
<Image Include="res\IDI_TREE_PEHEADER.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\IDI_TREE_PERESOURCE.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
Expand Down
14 changes: 10 additions & 4 deletions Pepper/ViewLeft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ void CViewLeft::OnInitialUpdate()
if (m_pLibpe->GetImageInfo(dwFileInfo) != S_OK)
return;

m_ImgListRootTree.Create(16, 16, ILC_COLORDDB, 0, 2);
const int iconHdr = m_ImgListRootTree.Add(AfxGetApp()->LoadIconW(IDI_TREE_MAIN_HEADER_ICON));
const int iconDirs = m_ImgListRootTree.Add(AfxGetApp()->LoadIconW(IDI_TREE_MAIN_DIR_ICON));
//Scaling factor for HighDPI displays.
auto pDC = GetDC();
const auto fScale = GetDeviceCaps(pDC->m_hDC, LOGPIXELSY) / 96.0f;
ReleaseDC(pDC);
const auto iImgSize = static_cast<int>(16 * fScale);

m_ImgListRootTree.Create(iImgSize, iImgSize, ILC_COLOR32, 0, 2);
const int iconHdr = m_ImgListRootTree.Add(AfxGetApp()->LoadIconW(IDI_TREE_PEHEADER));
const int iconDirs = m_ImgListRootTree.Add(AfxGetApp()->LoadIconW(IDI_TREE_PEDIRS));

CRect rect;
GetClientRect(&rect);
Expand Down Expand Up @@ -185,7 +191,7 @@ BOOL CViewLeft::OnEraseBkgnd(CDC* /*pDC*/)
void CViewLeft::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);

if (m_fCreated)
m_stTreeMain.SetWindowPos(this, 0, 0, cx, cy, SWP_NOACTIVATE | SWP_NOZORDER);
}
10 changes: 8 additions & 2 deletions Pepper/ViewRightBL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,14 @@ int CViewRightBL::CreateTreeResources()

WCHAR wstr[MAX_PATH];

m_imglTreeRes.Create(16, 16, ILC_COLOR32, 0, 4);
const int iconDirs = m_imglTreeRes.Add(AfxGetApp()->LoadIconW(IDI_TREE_MAIN_DIR_ICON));
//Scaling factor for HighDPI displays.
auto pDC = GetDC();
const auto fScale = GetDeviceCaps(pDC->m_hDC, LOGPIXELSY) / 96.0f;
ReleaseDC(pDC);
const auto iImgSize = static_cast<int>(16 * fScale);

m_imglTreeRes.Create(iImgSize, iImgSize, ILC_COLOR32, 0, 4);
const auto iconDirs = m_imglTreeRes.Add(AfxGetApp()->LoadIconW(IDI_TREE_PERESOURCE));
m_treeResBottom.SetImageList(&m_imglTreeRes, TVSIL_NORMAL);
long ilvlRoot = 0;

Expand Down
4 changes: 2 additions & 2 deletions Pepper/include/Utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define PRODUCT_DESC L"PE files viewer, github.com/jovibor/Pepper"
#define COPYRIGHT_NAME L"(C) Jovibor 2019-2021"
#define MAJOR_VERSION 1
#define MINOR_VERSION 2
#define MAINTENANCE_VERSION 6
#define MINOR_VERSION 3
#define MAINTENANCE_VERSION 0

#define TO_WSTR_HELPER(x) L## #x
#define TO_WSTR(x) TO_WSTR_HELPER(x)
Expand Down
Binary file added Pepper/res/IDI_TREE_PEDIRS.ico
Binary file not shown.
Binary file added Pepper/res/IDI_TREE_PEHEADER.ico
Binary file not shown.
Binary file added Pepper/res/IDI_TREE_PERESOURCE.ico
Binary file not shown.
6 changes: 4 additions & 2 deletions Pepper/res/Pepper.rc
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ END
// remains consistent on all systems.
IDR_MAINFRAME ICON "Pepper.ico"

IDI_TREE_MAIN_HEADER_ICON ICON "TreeMain_Header.ico"
IDI_TREE_PEHEADER ICON "IDI_TREE_PEHEADER.ico"

IDI_TREE_MAIN_DIR_ICON ICON "TreeMain_Dirs.ico"
IDI_TREE_PEDIRS ICON "IDI_TREE_PEDIRS.ico"

IDI_TREE_PERESOURCE ICON "IDI_TREE_PERESOURCE.ico"


/////////////////////////////////////////////////////////////////////////////
Expand Down
Binary file removed Pepper/res/TreeMain_Dirs.ico
Binary file not shown.
Binary file removed Pepper/res/TreeMain_Header.ico
Binary file not shown.
7 changes: 4 additions & 3 deletions Pepper/res/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
#define IDR_PepperTYPE 130
#define ID_WINDOW_MANAGER 131
#define IDS_EDIT_MENU 306
#define IDI_TREE_MAIN_HEADER_ICON 314
#define IDI_TREE_MAIN_DIR_ICON 315
#define IDI_TREE_PEHEADER 314
#define IDI_TREE_PEDIRS 315
#define IDI_TREE_PERESOURCE 318
#define IDC_LINK_PEPPER 1006
#define IDC_LINK_LIBPE 1007
#define IDC_LINK_HEXCTRL 1008
Expand All @@ -35,7 +36,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 318
#define _APS_NEXT_RESOURCE_VALUE 319
#define _APS_NEXT_COMMAND_VALUE 32798
#define _APS_NEXT_CONTROL_VALUE 1010
#define _APS_NEXT_SYMED_VALUE 310
Expand Down

0 comments on commit 73bbad4

Please sign in to comment.