diff --git a/Src/Lib/Settings.cpp b/Src/Lib/Settings.cpp index 54b3e273e..8937d4c39 100644 --- a/Src/Lib/Settings.cpp +++ b/Src/Lib/Settings.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -978,7 +979,7 @@ void CSettingsManager::ResetSettings( void ) HIMAGELIST CSettingsManager::GetImageList( HWND tree ) { if (m_ImageList) return m_ImageList; - HTHEME theme=OpenThemeData(tree,L"button"); + HTHEME theme=OpenThemeData(GetParent(tree),L"button"); HDC hdc=CreateCompatibleDC(NULL); int iconSize=(TreeView_GetItemHeight(tree)<32)?16:32; int checkSize=16; @@ -1108,7 +1109,7 @@ class CSettingsDlg: public CResizeableDlg { public: CSettingsDlg( void ); - void Init( CSetting *pSettings, ICustomSettings *pCustom, int tab ); + void Init( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t* appId ); BEGIN_MSG_MAP( CSettingsDlg ) MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog ) @@ -1182,6 +1183,7 @@ class CSettingsDlg: public CResizeableDlg bool m_bIgnoreEdit; bool m_bDirty; CString m_FilterText; + const wchar_t* m_AppId; void AddTabs( int name, const CSetting *pSelect=NULL ); void SetCurTab( int index, bool bReset, const CSetting *pSelect=NULL ); @@ -1214,15 +1216,17 @@ CSettingsDlg::CSettingsDlg( void ) m_bOnTop=false; m_bIgnoreEdit=false; m_bDirty=false; + m_AppId=NULL; } -void CSettingsDlg::Init( CSetting *pSettings, ICustomSettings *pCustom, int tab ) +void CSettingsDlg::Init( CSetting *pSettings, ICustomSettings *pCustom, int tab, const wchar_t* appId ) { m_pSettings=pSettings; m_pCustom=pCustom; m_InitialTab=tab; m_FilterText.Empty(); m_bDirty=false; + m_AppId=appId; } // 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 #ifdef _DEBUG g_bUIThread=true; #endif -/* - // attempt to make the dialog have its own icon. doesn't work though. the icon changes, but to the default folder icon - CComPtr pStore; - if (SUCCEEDED(SHGetPropertyStoreForWindow(m_hWnd,IID_IPropertyStore,(void**)&pStore))) + + if (m_AppId) { - PROPVARIANT val; - val.vt=VT_LPWSTR; - val.pwszVal=L"OpenShell.Settings.Dialog"; - pStore->SetValue(PKEY_AppUserModel_ID,val); + // attempt to make the dialog have its own icon + CComPtr pStore; + if (SUCCEEDED(SHGetPropertyStoreForWindow(m_hWnd,IID_IPropertyStore,(void**)&pStore))) + { + PROPVARIANT val; + InitPropVariantFromString(m_AppId,&val); + pStore->SetValue(PKEY_AppUserModel_ID,val); + } } -*/ + InitResize(MOVE_MODAL); HMENU menu=GetSystemMenu(FALSE); bool bAdded=false; @@ -1840,7 +1846,7 @@ bool CSettingsDlg::IsTabValid( void ) static CSettingsDlg g_SettingsDlg; -void EditSettings( const wchar_t *title, bool bModal, int tab ) +void EditSettings( const wchar_t *title, bool bModal, int tab, const wchar_t* appId ) { if (g_SettingsDlg.m_hWnd) { @@ -1858,7 +1864,7 @@ void EditSettings( const wchar_t *title, bool bModal, int tab ) } DLGTEMPLATE *pTemplate=LoadDialogEx(IDD_SETTINGS); g_SettingsManager.ResetImageList(); - g_SettingsDlg.Init(g_SettingsManager.GetSettings(),g_SettingsManager.GetCustom(),tab); + g_SettingsDlg.Init(g_SettingsManager.GetSettings(),g_SettingsManager.GetCustom(),tab,appId); g_SettingsDlg.Create(NULL,pTemplate); g_SettingsDlg.SetWindowText(title); g_SettingsDlg.SetWindowPos(HWND_TOPMOST,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|(g_SettingsDlg.GetOnTop()?0:SWP_NOZORDER)|SWP_SHOWWINDOW); diff --git a/Src/Lib/Settings.h b/Src/Lib/Settings.h index 01b8f42d8..92fa88f25 100644 --- a/Src/Lib/Settings.h +++ b/Src/Lib/Settings.h @@ -129,7 +129,7 @@ void InitSettings( CSetting *pSettings, TSettingsComponent component, ICustomSet void LoadSettings( void ); void SaveSettings( void ); void UpdateDefaultSettings( void ); -void EditSettings( const wchar_t *title, bool bModal, int tab ); +void EditSettings( const wchar_t *title, bool bModal, int tab, const wchar_t *appId = nullptr ); void CloseSettings( void ); void SetSettingsDirty( void ); void SelectSettingsTab( int tab, bool bAdvanced, const CSetting *pSelect ); diff --git a/Src/StartMenu/StartMenuDLL/MenuContainer.cpp b/Src/StartMenu/StartMenuDLL/MenuContainer.cpp index a56e77be4..52ed2c738 100644 --- a/Src/StartMenu/StartMenuDLL/MenuContainer.cpp +++ b/Src/StartMenu/StartMenuDLL/MenuContainer.cpp @@ -335,7 +335,6 @@ bool CMenuContainer::s_bDragMovable; bool CMenuContainer::s_bRightDrag; bool CMenuContainer::s_bLockWorkArea; bool CMenuContainer::s_bPendingSearchEnter; -bool CMenuContainer::s_bMoreResults; std::vector CMenuContainer::s_Menus; volatile HWND CMenuContainer::s_FirstMenu, CMenuContainer::s_SearchMenu; CSearchManager::SearchResults CMenuContainer::s_SearchResults; @@ -2769,7 +2768,7 @@ bool CMenuContainer::InitSearchItems( void ) itemHeight=s_Skin.ItemSettings[MenuSkin::LIST_ITEM].itemHeight; // total height minus the search box and the "more results"/"search internet", if present maxHeight=m_Items[m_SearchIndex].itemRect.top-s_Skin.Main_search_padding.top-s_Skin.Search_padding.top; - maxHeight-=itemHeight*(m_SearchItemCount-(s_bMoreResults?1:2)); + maxHeight-=itemHeight*(m_SearchItemCount-1); if (!s_SearchResults.bSearching && !HasMoreResults()) maxHeight+=itemHeight; } @@ -2963,28 +2962,25 @@ bool CMenuContainer::InitSearchItems( void ) if (s_bWin7Style) { UpdateAccelerators(m_OriginalCount,(int)m_Items.size()); - if (s_bMoreResults) + MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1]; + if (s_SearchResults.bSearching) { - MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1]; - if (s_SearchResults.bSearching) - { - item.id=MENU_SEARCH_EMPTY; - item.name=FindTranslation(L"Menu.Searching",L"Searching..."); - item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,8",CItemManager::ICON_SIZE_TYPE_SMALL); - } - else - { - item.id=MENU_MORE_RESULTS; - item.name=FindTranslation(L"Menu.MoreResults",L"See more results"); - item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,177",CItemManager::ICON_SIZE_TYPE_SMALL); - } + item.id=MENU_SEARCH_EMPTY; + item.name=FindTranslation(L"Menu.Searching",L"Searching..."); + item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,8",CItemManager::ICON_SIZE_TYPE_SMALL); + } + else + { + item.id=MENU_MORE_RESULTS; + item.name=FindTranslation(L"Menu.MoreResults",L"See more results"); + item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,177",CItemManager::ICON_SIZE_TYPE_SMALL); } } else { m_ScrollCount=(int)m_Items.size(); - bool bInternet=GetSettingBool(L"SearchInternet"); - if (s_bMoreResults && s_SearchResults.bSearching) + bool bInternet=GetSettingBool(L"SearchInternet"); + if (s_SearchResults.bSearching) { MenuItem item(MENU_SEARCH_EMPTY); item.name=FindTranslation(L"Menu.Searching",L"Searching..."); @@ -2999,7 +2995,7 @@ bool CMenuContainer::InitSearchItems( void ) item.name=FindTranslation(L"Menu.NoMatch",L"No items match your search."); m_Items.push_back(item); } - if (s_bMoreResults && HasMoreResults()) + if (HasMoreResults()) { { MenuItem item(MENU_SEPARATOR); @@ -5087,7 +5083,7 @@ void CMenuContainer::UpdateSearchResults( bool bForceShowAll ) g_SearchManager.BeginSearch(s_SearchResults.currentString); s_SearchResults.bSearching=true; s_bPendingSearchEnter=false; - if (s_bWin7Style && s_bMoreResults) + if (s_bWin7Style) { MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1]; item.id=MENU_SEARCH_EMPTY; @@ -7437,7 +7433,7 @@ static void CreateStartScreenFile( const wchar_t *fname ) bool CMenuContainer::HasMoreResults( void ) { if (s_HasMoreResults==-1) - s_HasMoreResults=(GetSettingBool(L"SearchFiles") && HasSearchService())?1:0; + s_HasMoreResults=(GetSettingBool(L"MoreResults") && GetSettingBool(L"SearchFiles") && HasSearchService())?1:0; return s_HasMoreResults!=0; } @@ -7509,31 +7505,6 @@ RECT CMenuContainer::CalculateWorkArea( const RECT &taskbarRect ) } } - //calculate offsets - int xOff = GetSettingInt(L"HorizontalMenuOffset"); - int yOff = GetSettingInt(L"VerticalMenuOffset"); - if (s_TaskBarEdge == ABE_BOTTOM) - { - if (xOff != 0) - rc.left += xOff; - if (yOff != 0) - rc.bottom += yOff; - } - else if (s_TaskBarEdge == ABE_TOP || s_TaskBarEdge == ABE_LEFT) - { - if (xOff != 0) - rc.left += xOff; - if (yOff != 0) - rc.top += yOff; - } - else - { - if (xOff != 0) - rc.right += xOff; - if (yOff != 0) - rc.top += yOff; - } - return rc; } @@ -7560,6 +7531,9 @@ POINT CMenuContainer::CalculateCorner( void ) else corner.y=s_MainMenuLimits.bottom+margin.bottom; + corner.x+=GetSettingInt(L"HorizontalMenuOffset"); + corner.y+=GetSettingInt(L"VerticalMenuOffset"); + return corner; } @@ -7735,7 +7709,6 @@ HWND CMenuContainer::ToggleStartMenu( int taskbarId, bool bKeyboard, bool bAllPr s_bDisableHover=false; s_bDragClosed=false; s_bPendingSearchEnter=false; - s_bMoreResults=GetSettingBool(L"MoreResults"); InitTouchHelper(); bool bRemote=GetSystemMetrics(SM_REMOTESESSION)!=0; diff --git a/Src/StartMenu/StartMenuDLL/MenuContainer.h b/Src/StartMenu/StartMenuDLL/MenuContainer.h index 9b0bfe588..057982104 100644 --- a/Src/StartMenu/StartMenuDLL/MenuContainer.h +++ b/Src/StartMenu/StartMenuDLL/MenuContainer.h @@ -896,7 +896,6 @@ class CMenuContainer: public IDropTarget, public IFrameworkInputPaneHandler, pub static bool s_bRightDrag; // dragging with the right mouse button static bool s_bLockWorkArea; // changes to the work area are ignored static bool s_bPendingSearchEnter; // Enter was pressed before the search results were ready - static bool s_bMoreResults; // shows the "Show More Results" item at the bottom of searches static RECT s_MenuLimits; // area of the main monitor accessible to all menus static RECT s_MainMenuLimits; // area of the main monitor accessible by the main menu static DWORD s_TaskbarState; // the state of the taskbar (ABS_AUTOHIDE and ABS_ALWAYSONTOP) diff --git a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp index eb3af0494..49383601b 100644 --- a/Src/StartMenu/StartMenuDLL/SettingsUI.cpp +++ b/Src/StartMenu/StartMenuDLL/SettingsUI.cpp @@ -5272,7 +5272,7 @@ void EditSettings( bool bModal, int tab ) Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE_VER),ver>>24,(ver>>16)&0xFF,ver&0xFFFF); else Sprintf(title,_countof(title),LoadStringEx(IDS_SETTINGS_TITLE)); - EditSettings(title,bModal,tab); + EditSettings(title,bModal,tab,L"OpenShell.StartMenu.Settings"); } bool DllImportSettingsXml( const wchar_t *fname )