Added drawing of ZIP icon on corner of thumbnails

This commit is contained in:
Invertex 2018-06-14 20:01:43 -07:00
commit 3e0586140a
9 changed files with 45 additions and 9 deletions

View file

@ -44,7 +44,7 @@ FONT 8, "Ms Shell Dlg"
AUTOCHECKBOX "Sort images alphabetically", IDC_CB_SORT, 20, 115, 155, 8
LTEXT "Uncheck to sort images by archive order.\nRequired to display custom thumbnail.", IDC_SORT_DESC, 30, 130, 145, 18, SS_LEFT, WS_EX_TRANSPARENT
AUTOCHECKBOX "Show archive indicator", IDC_CB_SHOWICON, 20, 150, 150, 10
LTEXT "Display a small icon at bottom right of thumbnail letting you know it's an archive.", IDC_CB_SHOWICON_DESC, 30, 165, 145, 18, SS_LEFT, WS_EX_TRANSPARENT
LTEXT "Display a ZIP icon top-left of thumbnail to let you know it's an archive.", IDC_CB_SHOWICON_DESC, 30, 165, 145, 18, SS_LEFT, WS_EX_TRANSPARENT
}

View file

@ -15,15 +15,19 @@ BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_CBXShell, CCBXShell)
END_OBJECT_MAP()
HICON zipIcon;
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
zipIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_CBXSHELLLib);
DisableThreadLibraryCalls(hInstance);
}
else
if (dwReason == DLL_PROCESS_DETACH)

View file

@ -4,7 +4,7 @@
/* File created by MIDL compiler version 7.00.0555 */
/* at Thu Jun 14 13:12:30 2018
/* at Thu Jun 14 19:57:45 2018
*/
/* Compiler settings for CBXShell.idl:
Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0555

View file

@ -2,7 +2,10 @@
// Copyright (C) 2006-2009
// http://www.resedit.net
#include <windows.h>
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#include "prsht.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include <commctrl.h>
#include <richedit.h>
#include <atlres.h>
@ -18,6 +21,17 @@ IDR_CBXShell REGISTRY "CBXShell.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "Resources\\zip.ico"
//
// String Table resources
//
@ -27,8 +41,6 @@ STRINGTABLE
IDS_CBXSHELL_DESC "CBXShell Class"
}
//
// Version Information resources
//

View file

@ -301,6 +301,10 @@
<InterfaceIdentifierFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CBXShell_i.c</InterfaceIdentifierFileName>
</Midl>
</ItemGroup>
<ItemGroup>
<Image Include="Resources\zip.ico">
</Image>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\wtl.9.1.1\build\native\wtl.targets" Condition="Exists('packages\wtl.9.1.1\build\native\wtl.targets')" />

View file

@ -72,4 +72,9 @@
<Filter>COM</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<Image Include="Resources\zip.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

BIN
CBXShell/Resources/zip.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

View file

@ -255,9 +255,9 @@ public:
}
};
class CCBXArchive
{
public:
CCBXArchive()
{
@ -536,6 +536,7 @@ private:
CBXTYPE m_cbxType;
IStream* m_pIs;
BOOL m_bSort;
BOOL m_showIcon;
private:
@ -662,8 +663,10 @@ private:
//check size
int tw=ci.GetWidth();
int th=ci.GetHeight();
float rx=(float)pThumbSize->cx/(float)tw;
float ry=(float)pThumbSize->cy/(float)th;
float cx = (float)pThumbSize->cx;
float cy = (float)pThumbSize->cy;
float rx = cx/(float)tw;
float ry = cy/(float)th;
//if bigger size
if ((rx<1) || (ry<1))
@ -684,8 +687,11 @@ private:
HBITMAP hbmpOld=hdcNew.SelectBitmap(hbmpNew);
hdcNew.FillSolidRect(0,0, tw,th, RGB(255,255,255));//white background
RECT rect = { 0,0, ci.GetWidth(),ci.GetHeight() };
Draw(ci, hdcNew, 0, 0, tw, th, 0, 0, ci.GetWidth(), ci.GetHeight(), Gdiplus::InterpolationMode::InterpolationModeHighQualityBicubic);//too late for error checks
if(m_showIcon)
DrawIcon(hdcNew, 0, 0, zipIcon);
hdcNew.SelectBitmap(hbmpOld);
return hbmpNew.Detach();
@ -767,6 +773,8 @@ public:
{
if (ERROR_SUCCESS==_rk.QueryDWORDValue(_T("NoSort"), _d))
m_bSort=(_d==FALSE);
if (ERROR_SUCCESS == _rk.QueryDWORDValue(_T("ShowIcon"), _d))
m_showIcon = (_d == TRUE);
}
}

View file

@ -2,6 +2,9 @@
#define IDC_STATIC (-1)
#endif
#define IDI_ICON1 101
#define IDR_CBXShell 102
#define IDS_PROJNAME 40000
#define IDS_CBXSHELL_DESC 40001
extern HICON zipIcon;