Skip to content

Commit 7626b93

Browse files
authored
Merge 19d5ab2 into d2985ba
2 parents d2985ba + 19d5ab2 commit 7626b93

5 files changed

Lines changed: 42 additions & 64 deletions

File tree

Src/Lib/Settings.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <Uxtheme.h>
1414
#include <VSStyle.h>
1515
#include <propkey.h>
16+
#include <propvarutil.h>
1617
#include <htmlhelp.h>
1718
#include <vector>
1819
#include <map>
@@ -978,7 +979,7 @@ void CSettingsManager::ResetSettings( void )
978979
HIMAGELIST CSettingsManager::GetImageList( HWND tree )
979980
{
980981
if (m_ImageList) return m_ImageList;
981-
HTHEME theme=OpenThemeData(tree,L"button");
982+
HTHEME theme=OpenThemeData(GetParent(tree),L"button");
982983
HDC hdc=CreateCompatibleDC(NULL);
983984
int iconSize=(TreeView_GetItemHeight(tree)<32)?16:32;
984985
int checkSize=16;
@@ -1108,7 +1109,7 @@ class CSettingsDlg: public CResizeableDlg<CSettingsDlg>
11081109
{
11091110
public:
11101111
CSettingsDlg( void );
1111-
void Init( CSetting *pSettings, ICustomSettings *pCustom, int tab );
1112+
void Init( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t* appId );
11121113

11131114
BEGIN_MSG_MAP( CSettingsDlg )
11141115
MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog )
@@ -1182,6 +1183,7 @@ class CSettingsDlg: public CResizeableDlg<CSettingsDlg>
11821183
bool m_bIgnoreEdit;
11831184
bool m_bDirty;
11841185
CString m_FilterText;
1186+
const wchar_t* m_AppId;
11851187

11861188
void AddTabs( int name, const CSetting *pSelect=NULL );
11871189
void SetCurTab( int index, bool bReset, const CSetting *pSelect=NULL );
@@ -1214,15 +1216,17 @@ CSettingsDlg::CSettingsDlg( void )
12141216
m_bOnTop=false;
12151217
m_bIgnoreEdit=false;
12161218
m_bDirty=false;
1219+
m_AppId=NULL;
12171220
}
12181221

1219-
void CSettingsDlg::Init( CSetting *pSettings, ICustomSettings *pCustom, int tab )
1222+
void CSettingsDlg::Init( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t* appId )
12201223
{
12211224
m_pSettings=pSettings;
12221225
m_pCustom=pCustom;
12231226
m_InitialTab=tab;
12241227
m_FilterText.Empty();
12251228
m_bDirty=false;
1229+
m_AppId=appId;
12261230
}
12271231

12281232
// Subclass the tooltip to delay the tip when the mouse moves from one tree item to the next
@@ -1246,17 +1250,19 @@ LRESULT CSettingsDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
12461250
#ifdef _DEBUG
12471251
g_bUIThread=true;
12481252
#endif
1249-
/*
1250-
// attempt to make the dialog have its own icon. doesn't work though. the icon changes, but to the default folder icon
1251-
CComPtr<IPropertyStore> pStore;
1252-
if (SUCCEEDED(SHGetPropertyStoreForWindow(m_hWnd,IID_IPropertyStore,(void**)&pStore)))
1253+
1254+
if (m_AppId)
12531255
{
1254-
PROPVARIANT val;
1255-
val.vt=VT_LPWSTR;
1256-
val.pwszVal=L"OpenShell.Settings.Dialog";
1257-
pStore->SetValue(PKEY_AppUserModel_ID,val);
1256+
// attempt to make the dialog have its own icon
1257+
CComPtr<IPropertyStore> pStore;
1258+
if (SUCCEEDED(SHGetPropertyStoreForWindow(m_hWnd,IID_IPropertyStore,(void**)&pStore)))
1259+
{
1260+
PROPVARIANT val;
1261+
InitPropVariantFromString(m_AppId,&val);
1262+
pStore->SetValue(PKEY_AppUserModel_ID,val);
1263+
}
12581264
}
1259-
*/
1265+
12601266
InitResize(MOVE_MODAL);
12611267
HMENU menu=GetSystemMenu(FALSE);
12621268
bool bAdded=false;
@@ -1840,7 +1846,7 @@ bool CSettingsDlg::IsTabValid( void )
18401846

18411847
static CSettingsDlg g_SettingsDlg;
18421848

1843-
void EditSettings( const wchar_t *title, bool bModal, int tab )
1849+
void EditSettings( const wchar_t *title, bool bModal, int tab, const wchar_t* appId )
18441850
{
18451851
if (g_SettingsDlg.m_hWnd)
18461852
{
@@ -1858,7 +1864,7 @@ void EditSettings( const wchar_t *title, bool bModal, int tab )
18581864
}
18591865
DLGTEMPLATE *pTemplate=LoadDialogEx(IDD_SETTINGS);
18601866
g_SettingsManager.ResetImageList();
1861-
g_SettingsDlg.Init(g_SettingsManager.GetSettings(),g_SettingsManager.GetCustom(),tab);
1867+
g_SettingsDlg.Init(g_SettingsManager.GetSettings(),g_SettingsManager.GetCustom(),tab,appId);
18621868
g_SettingsDlg.Create(NULL,pTemplate);
18631869
g_SettingsDlg.SetWindowText(title);
18641870
g_SettingsDlg.SetWindowPos(HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|(g_SettingsDlg.GetOnTop()?0:SWP_NOZORDER)|SWP_SHOWWINDOW);

Src/Lib/Settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void InitSettings( CSetting *pSettings, TSettingsComponent component, ICustomSet
129129
void LoadSettings( void );
130130
void SaveSettings( void );
131131
void UpdateDefaultSettings( void );
132-
void EditSettings( const wchar_t *title, bool bModal, int tab );
132+
void EditSettings( const wchar_t *title, bool bModal, int tab, const wchar_t *appId = nullptr );
133133
void CloseSettings( void );
134134
void SetSettingsDirty( void );
135135
void SelectSettingsTab( int tab, bool bAdvanced, const CSetting *pSelect );

Src/StartMenu/StartMenuDLL/MenuContainer.cpp

Lines changed: 20 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ bool CMenuContainer::s_bDragMovable;
335335
bool CMenuContainer::s_bRightDrag;
336336
bool CMenuContainer::s_bLockWorkArea;
337337
bool CMenuContainer::s_bPendingSearchEnter;
338-
bool CMenuContainer::s_bMoreResults;
339338
std::vector<CMenuContainer*> CMenuContainer::s_Menus;
340339
volatile HWND CMenuContainer::s_FirstMenu, CMenuContainer::s_SearchMenu;
341340
CSearchManager::SearchResults CMenuContainer::s_SearchResults;
@@ -2769,7 +2768,7 @@ bool CMenuContainer::InitSearchItems( void )
27692768
itemHeight=s_Skin.ItemSettings[MenuSkin::LIST_ITEM].itemHeight;
27702769
// total height minus the search box and the "more results"/"search internet", if present
27712770
maxHeight=m_Items[m_SearchIndex].itemRect.top-s_Skin.Main_search_padding.top-s_Skin.Search_padding.top;
2772-
maxHeight-=itemHeight*(m_SearchItemCount-(s_bMoreResults?1:2));
2771+
maxHeight-=itemHeight*(m_SearchItemCount-1);
27732772
if (!s_SearchResults.bSearching && !HasMoreResults())
27742773
maxHeight+=itemHeight;
27752774
}
@@ -2963,28 +2962,25 @@ bool CMenuContainer::InitSearchItems( void )
29632962
if (s_bWin7Style)
29642963
{
29652964
UpdateAccelerators(m_OriginalCount,(int)m_Items.size());
2966-
if (s_bMoreResults)
2965+
MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1];
2966+
if (s_SearchResults.bSearching)
29672967
{
2968-
MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1];
2969-
if (s_SearchResults.bSearching)
2970-
{
2971-
item.id=MENU_SEARCH_EMPTY;
2972-
item.name=FindTranslation(L"Menu.Searching",L"Searching...");
2973-
item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,8",CItemManager::ICON_SIZE_TYPE_SMALL);
2974-
}
2975-
else
2976-
{
2977-
item.id=MENU_MORE_RESULTS;
2978-
item.name=FindTranslation(L"Menu.MoreResults",L"See more results");
2979-
item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,177",CItemManager::ICON_SIZE_TYPE_SMALL);
2980-
}
2968+
item.id=MENU_SEARCH_EMPTY;
2969+
item.name=FindTranslation(L"Menu.Searching",L"Searching...");
2970+
item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,8",CItemManager::ICON_SIZE_TYPE_SMALL);
2971+
}
2972+
else
2973+
{
2974+
item.id=MENU_MORE_RESULTS;
2975+
item.name=FindTranslation(L"Menu.MoreResults",L"See more results");
2976+
item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,177",CItemManager::ICON_SIZE_TYPE_SMALL);
29812977
}
29822978
}
29832979
else
29842980
{
29852981
m_ScrollCount=(int)m_Items.size();
2986-
bool bInternet=GetSettingBool(L"SearchInternet");
2987-
if (s_bMoreResults && s_SearchResults.bSearching)
2982+
bool bInternet=GetSettingBool(L"SearchInternet");
2983+
if (s_SearchResults.bSearching)
29882984
{
29892985
MenuItem item(MENU_SEARCH_EMPTY);
29902986
item.name=FindTranslation(L"Menu.Searching",L"Searching...");
@@ -2999,7 +2995,7 @@ bool CMenuContainer::InitSearchItems( void )
29992995
item.name=FindTranslation(L"Menu.NoMatch",L"No items match your search.");
30002996
m_Items.push_back(item);
30012997
}
3002-
if (s_bMoreResults && HasMoreResults())
2998+
if (HasMoreResults())
30032999
{
30043000
{
30053001
MenuItem item(MENU_SEPARATOR);
@@ -5087,7 +5083,7 @@ void CMenuContainer::UpdateSearchResults( bool bForceShowAll )
50875083
g_SearchManager.BeginSearch(s_SearchResults.currentString);
50885084
s_SearchResults.bSearching=true;
50895085
s_bPendingSearchEnter=false;
5090-
if (s_bWin7Style && s_bMoreResults)
5086+
if (s_bWin7Style)
50915087
{
50925088
MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1];
50935089
item.id=MENU_SEARCH_EMPTY;
@@ -7437,7 +7433,7 @@ static void CreateStartScreenFile( const wchar_t *fname )
74377433
bool CMenuContainer::HasMoreResults( void )
74387434
{
74397435
if (s_HasMoreResults==-1)
7440-
s_HasMoreResults=(GetSettingBool(L"SearchFiles") && HasSearchService())?1:0;
7436+
s_HasMoreResults=(GetSettingBool(L"MoreResults") && GetSettingBool(L"SearchFiles") && HasSearchService())?1:0;
74417437
return s_HasMoreResults!=0;
74427438
}
74437439

@@ -7509,31 +7505,6 @@ RECT CMenuContainer::CalculateWorkArea( const RECT &taskbarRect )
75097505
}
75107506
}
75117507

7512-
//calculate offsets
7513-
int xOff = GetSettingInt(L"HorizontalMenuOffset");
7514-
int yOff = GetSettingInt(L"VerticalMenuOffset");
7515-
if (s_TaskBarEdge == ABE_BOTTOM)
7516-
{
7517-
if (xOff != 0)
7518-
rc.left += xOff;
7519-
if (yOff != 0)
7520-
rc.bottom += yOff;
7521-
}
7522-
else if (s_TaskBarEdge == ABE_TOP || s_TaskBarEdge == ABE_LEFT)
7523-
{
7524-
if (xOff != 0)
7525-
rc.left += xOff;
7526-
if (yOff != 0)
7527-
rc.top += yOff;
7528-
}
7529-
else
7530-
{
7531-
if (xOff != 0)
7532-
rc.right += xOff;
7533-
if (yOff != 0)
7534-
rc.top += yOff;
7535-
}
7536-
75377508
return rc;
75387509
}
75397510

@@ -7560,6 +7531,9 @@ POINT CMenuContainer::CalculateCorner( void )
75607531
else
75617532
corner.y=s_MainMenuLimits.bottom+margin.bottom;
75627533

7534+
corner.x+=GetSettingInt(L"HorizontalMenuOffset");
7535+
corner.y+=GetSettingInt(L"VerticalMenuOffset");
7536+
75637537
return corner;
75647538
}
75657539

@@ -7735,7 +7709,6 @@ HWND CMenuContainer::ToggleStartMenu( int taskbarId, bool bKeyboard, bool bAllPr
77357709
s_bDisableHover=false;
77367710
s_bDragClosed=false;
77377711
s_bPendingSearchEnter=false;
7738-
s_bMoreResults=GetSettingBool(L"MoreResults");
77397712
InitTouchHelper();
77407713

77417714
bool bRemote=GetSystemMetrics(SM_REMOTESESSION)!=0;

Src/StartMenu/StartMenuDLL/MenuContainer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,6 @@ class CMenuContainer: public IDropTarget, public IFrameworkInputPaneHandler, pub
896896
static bool s_bRightDrag; // dragging with the right mouse button
897897
static bool s_bLockWorkArea; // changes to the work area are ignored
898898
static bool s_bPendingSearchEnter; // Enter was pressed before the search results were ready
899-
static bool s_bMoreResults; // shows the "Show More Results" item at the bottom of searches
900899
static RECT s_MenuLimits; // area of the main monitor accessible to all menus
901900
static RECT s_MainMenuLimits; // area of the main monitor accessible by the main menu
902901
static DWORD s_TaskbarState; // the state of the taskbar (ABS_AUTOHIDE and ABS_ALWAYSONTOP)

Src/StartMenu/StartMenuDLL/SettingsUI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5272,7 +5272,7 @@ void EditSettings( bool bModal, int tab )
52725272
Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE_VER),ver>>24,(ver>>16)&0xFF,ver&0xFFFF);
52735273
else
52745274
Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE));
5275-
EditSettings(title,bModal,tab);
5275+
EditSettings(title,bModal,tab,L"OpenShell.StartMenu.Settings");
52765276
}
52775277

52785278
bool DllImportSettingsXml( const wchar_t *fname )

0 commit comments

Comments
 (0)