Skip to content

Commit

Permalink
24.2.27 Some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tablacus committed Feb 27, 2024
1 parent 505c185 commit 81192f7
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 48 deletions.
Binary file modified Debug/lib/te32.dll
Binary file not shown.
Binary file modified Debug/lib/te64.dll
Binary file not shown.
1 change: 0 additions & 1 deletion Debug/script/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ document.addEventListener("webkitfullscreenchange", function () {
});

Init = async function () {
SetWindowAlpha(ui_.hwnd, 240);
te.Data.MainWindow = $;
te.Data.NoCssFont = ui_.NoCssFont;
await InitCode();
Expand Down
2 changes: 1 addition & 1 deletion Debug/script/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ g_.Notify = {};

AboutTE = function (n) {
if (n == 0) {
return te.Version < 20240222 ? te.Version : 20240225;
return te.Version < 20240227 ? te.Version : 20240227;
}
if (n == 1) {
const v = AboutTE(0);
Expand Down
7 changes: 6 additions & 1 deletion Debug/script/sync1.js
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,7 @@ te.OnBeforeNavigate = function (Ctrl, fs, wFlags, Prev) {
}
if (Ctrl.Data) {
Ctrl.Data.Setting = void 0;
Ctrl.Data.hwndBefore = api.GetFocus();
}
const res = /javascript:(.*)/im.exec(api.GetDisplayNameOf(Ctrl.FolderItem, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING));
if (res) {
Expand Down Expand Up @@ -1612,7 +1613,11 @@ te.OnNavigateComplete = function (Ctrl) {
Ctrl.NavigateComplete();
RunEvent1("NavigateComplete", Ctrl);
ChangeView(Ctrl);
FocusFV();
if (api.GetClassName(Ctrl.Data.hwndBefore) == WC_TREEVIEW) {
api.SetFocus(Ctrl.Data.hwndBefore);
} else {
FocusFV();
}
if (g_.focused) {
g_.focused.Focus();
if (--g_.fTCs <= 0) {
Expand Down
2 changes: 1 addition & 1 deletion TE/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//Version(DLL)
#define VER_Y 24
#define VER_M 2
#define VER_D 22
#define VER_D 27
#endif

//Icon
Expand Down
104 changes: 62 additions & 42 deletions TE/TE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ BSTR g_bsClipRoot = NULL;
BSTR g_bsDateTimeFormat = NULL;
BSTR g_bsHiddenFilter = NULL;
BSTR g_bsExplorerBrowserFilter = NULL;
BSTR g_bsTreeHiddenFilter = NULL;
HTREEITEM g_hItemDown = NULL;
SORTCOLUMN g_pSortColumnNull[3];
VARIANT g_vData;
Expand Down Expand Up @@ -242,6 +243,7 @@ TEmethod methodTE[] = {
// { 1150, "ThumbnailProvider" },//Deprecated
{ 1160, "DragIcon" },
{ 1180, "ExplorerBrowserFilter" },
{ 1190, "TreeHiddenFilter" },
{ TE_METHOD + 1133, "FolderItems" },
{ TE_METHOD + 1134, "Object" },
{ TE_METHOD + 1135, "Array" },
Expand Down Expand Up @@ -1356,6 +1358,17 @@ VOID CheckChangeTabTC(HWND hwnd)
}
}

VOID teSetGetString(int nArg, DISPPARAMS *pDispParams, VARIANT *pVarResult, BSTR *pbs)
{
if (nArg >= 0) {
teSysFreeString(pbs);
if (pDispParams->rgvarg[nArg].vt == VT_BSTR && ::SysStringLen(pDispParams->rgvarg[nArg].bstrVal)) {
*pbs = ::SysAllocString(pDispParams->rgvarg[nArg].bstrVal);
}
}
teSetSZ(pVarResult, *pbs);
}

#ifdef USE_APIHOOK

HTHEME WINAPI teOpenNcThemeData(HWND hWnd, LPCWSTR pszClassList)
Expand Down Expand Up @@ -10835,17 +10848,23 @@ VOID CteShellBrowser::GetGroupBy(BSTR* pbs)
#endif
}

BOOL IsUseExplorerBrowser(LPITEMIDLIST pidl, SHGDNF uFlags)
BOOL teIDListMatchSpec(LPITEMIDLIST pidl, SHGDNF uFlags, BSTR bs)
{
BOOL bResult = FALSE;
BSTR bsPath;
if SUCCEEDED(teGetDisplayNameFromIDList(&bsPath, pidl, uFlags)) {
bResult = tePathMatchSpec(bsPath, g_bsExplorerBrowserFilter);
bResult = tePathMatchSpec(bsPath, bs);
teSysFreeString(&bsPath);
}
return bResult;
}

BOOL teIDListMatchSpec2(LPITEMIDLIST pidl, BSTR bs)
{
return teIDListMatchSpec(pidl, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING, bs) ||
teIDListMatchSpec(pidl, SHGDN_FORPARSING, bs);
}

FOLDERVIEWOPTIONS CteShellBrowser::teGetFolderViewOptions(LPITEMIDLIST pidl, UINT uViewMode)
{
if (m_param[SB_FolderFlags] & FWF_CHECKSELECT) {
Expand All @@ -10864,9 +10883,8 @@ FOLDERVIEWOPTIONS CteShellBrowser::teGetFolderViewOptions(LPITEMIDLIST pidl, UIN
}
}
if (g_bsExplorerBrowserFilter) {
if (IsUseExplorerBrowser(pidl, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING) ||
IsUseExplorerBrowser(pidl, SHGDN_FORPARSING)) {
return FVO_DEFAULT;
if (teIDListMatchSpec2(pidl, g_bsExplorerBrowserFilter)) {
return FVO_DEFAULT;
}
}
return FVO_VISTALAYOUT;
Expand Down Expand Up @@ -11418,24 +11436,13 @@ STDMETHODIMP CTE::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlag
return S_OK;

case 1138://DateTimeFormat
if (nArg >= 0) {
teSysFreeString(&g_bsDateTimeFormat);
if (pDispParams->rgvarg[nArg].vt == VT_BSTR && ::SysStringLen(pDispParams->rgvarg[nArg].bstrVal)) {
g_bsDateTimeFormat = ::SysAllocString(pDispParams->rgvarg[nArg].bstrVal);
}
}
teSetSZ(pVarResult, g_bsDateTimeFormat);
teSetGetString(nArg, pDispParams, pVarResult, &g_bsDateTimeFormat);
return S_OK;

case 1139://HiddenFilter
if (nArg >= 0) {
teSysFreeString(&g_bsHiddenFilter);
if (pDispParams->rgvarg[nArg].vt == VT_BSTR && ::SysStringLen(pDispParams->rgvarg[nArg].bstrVal)) {
g_bsHiddenFilter = ::SysAllocString(pDispParams->rgvarg[nArg].bstrVal);
}
}
teSetSZ(pVarResult, g_bsHiddenFilter);
teSetGetString(nArg, pDispParams, pVarResult, &g_bsHiddenFilter);
return S_OK;

//ThumbnailProvider//Deprecated
/* case 1150:
teSetPtr(pVarResult, teThumbnailProvider);
Expand All @@ -11449,13 +11456,11 @@ STDMETHODIMP CTE::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlag
return S_OK;

case 1180://ExplorerBrowserFilter
if (nArg >= 0) {
teSysFreeString(&g_bsExplorerBrowserFilter);
if (pDispParams->rgvarg[nArg].vt == VT_BSTR && ::SysStringLen(pDispParams->rgvarg[nArg].bstrVal)) {
g_bsExplorerBrowserFilter = ::SysAllocString(pDispParams->rgvarg[nArg].bstrVal);
}
}
teSetSZ(pVarResult, g_bsExplorerBrowserFilter);
teSetGetString(nArg, pDispParams, pVarResult, &g_bsExplorerBrowserFilter);
return S_OK;

case 1190://TreeHiddenFilter
teSetGetString(nArg, pDispParams, pVarResult, &g_bsTreeHiddenFilter);
return S_OK;

#ifdef USE_TESTOBJECT
Expand Down Expand Up @@ -14098,6 +14103,10 @@ STDMETHODIMP CteTreeView::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WO
SafeRelease(&m_psiFocus);
_SHCreateItemFromIDList(pidl, IID_PPV_ARGS(&m_psiFocus));
teCoTaskMemFree(pidl);
if (CompareSelected() == 0) {
SafeRelease(&m_psiFocus);
return S_OK;
}
if (m_psiFocus) {
m_bExpand = TRUE;
SetTimer(m_hwndTV, TET_Expand, 100, teTimerProcForTree);
Expand Down Expand Up @@ -14384,6 +14393,16 @@ STDMETHODIMP CteTreeView::ItemPostPaint(HDC hdc, RECT *prc, NSTCCUSTOMDRAW *pnst

STDMETHODIMP CteTreeView::IncludeItem(IShellItem *psi)
{
if (g_bsTreeHiddenFilter) {
LPITEMIDLIST pidl = NULL;
if (teGetIDListFromObject(psi, &pidl)) {
if (teIDListMatchSpec2(pidl, g_bsTreeHiddenFilter)) {
teILFreeClear(&pidl);
return S_FALSE;
}
teILFreeClear(&pidl);
}
}
if (g_pOnFunc[TE_OnIncludeItem]) {
VARIANT v;
VariantInit(&v);
Expand Down Expand Up @@ -14638,27 +14657,13 @@ VOID CteTreeView::Show()
}
}

VOID CteTreeView::Expand()
VOID CteTreeView::Expand()
{
if (!m_psiFocus || m_bSetRoot) {
return;
}
if (m_pNameSpaceTreeControl) {
int iOrder = 1;
if (m_bExpand) {
IShellItemArray *psia;
if SUCCEEDED(m_pNameSpaceTreeControl->GetSelectedItems(&psia)) {
IShellItem *psi;
if SUCCEEDED(psia->GetItemAt(0, &psi)) {
psi->Compare(m_psiFocus, SICHINT_CANONICAL, &iOrder);
psi->Release();
}
psia->Release();
}
} else {
iOrder = 0;
}
if (iOrder) {
if (m_bExpand ? CompareSelected() : 0) {
m_pNameSpaceTreeControl->SetItemState(m_psiFocus, m_dwState, m_dwState);
SetTimer(m_hwndTV, TET_Expand, 500, teTimerProcForTree);
} else {
Expand All @@ -14682,6 +14687,21 @@ VOID CteTreeView::Expand()
}
}

int CteTreeView::CompareSelected()
{
int iOrder = 1;
IShellItemArray *psia;
if SUCCEEDED(m_pNameSpaceTreeControl->GetSelectedItems(&psia)) {
IShellItem *psi;
if SUCCEEDED(psia->GetItemAt(0, &psi)) {
psi->Compare(m_psiFocus, SICHINT_DISPLAY, &iOrder);
psi->Release();
}
psia->Release();
}
return iOrder;
}

#ifdef _2000XP
VOID CteTreeView::SetObjectRect()
{
Expand Down
1 change: 1 addition & 0 deletions TE/TE.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ class CteTreeView : public IDispatch,
VOID SetRoot();
VOID Show();
VOID Expand();
int CompareSelected();
#ifdef _2000XP
VOID SetObjectRect();
#endif
Expand Down
11 changes: 11 additions & 0 deletions TE/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ struct WINCOMPATTRDATA
};
#endif

#ifndef ACCENTPOLICY

struct ACCENTPOLICY
{
int nAccentState;
int nFlags;
int nColor;
int nAnimationId;
};
#endif

#ifndef D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT
#define D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT 0x00000004
#endif
Expand Down
30 changes: 28 additions & 2 deletions TE/darkmode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,35 @@ BOOL g_bDarkMode = FALSE;
BOOL teIsHighContrast()
{
HIGHCONTRAST highContrast = { sizeof(HIGHCONTRAST) };
return SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(highContrast), &highContrast, FALSE) && (highContrast.dwFlags & HCF_HIGHCONTRASTON);
return SystemParametersInfo(SPI_GETHIGHCONTRAST, sizeof(HIGHCONTRAST), &highContrast, FALSE) && (highContrast.dwFlags & HCF_HIGHCONTRASTON);
}

/*
VOID teSetAccentColor(HWND hwnd)
{
if (_SetWindowCompositionAttribute) {
HKEY hKey;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\DWM", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
DWORD clAccent;
DWORD dwSize = sizeof(DWORD);
if (RegQueryValueExA(hKey, "AccentColor", NULL, NULL, (LPBYTE)&clAccent, &dwSize) == ERROR_SUCCESS) {
ACCENTPOLICY accent = {
4, //ACCENT_ENABLE_ACRYLICBLURBEHIND
0x1e0, //DrawLeftBorder or DrawTopBorder or DrawRightBorder or DrawBottomBorder
clAccent,
0
};
WINCOMPATTRDATA wcpad = {
19, //WCA_ACCENT_POLICY
&accent,
sizeof(ACCENTPOLICY)
};
_SetWindowCompositionAttribute(hwnd, &wcpad);
}
RegCloseKey(hKey);
}
}
}
*/
VOID teSetDarkMode(HWND hwnd)
{
if (_AllowDarkModeForWindow) {
Expand Down

0 comments on commit 81192f7

Please sign in to comment.