Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions Src/Lib/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <Uxtheme.h>
#include <VSStyle.h>
#include <propkey.h>
#include <propvarutil.h>
#include <htmlhelp.h>
#include <vector>
#include <map>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1108,7 +1109,7 @@ class CSettingsDlg: public CResizeableDlg<CSettingsDlg>
{
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 )
Expand Down Expand Up @@ -1182,6 +1183,7 @@ class CSettingsDlg: public CResizeableDlg<CSettingsDlg>
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 );
Expand Down Expand Up @@ -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
Expand All @@ -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<IPropertyStore> 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<IPropertyStore> 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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Src/Lib/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
67 changes: 20 additions & 47 deletions Src/StartMenu/StartMenuDLL/MenuContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*> CMenuContainer::s_Menus;
volatile HWND CMenuContainer::s_FirstMenu, CMenuContainer::s_SearchMenu;
CSearchManager::SearchResults CMenuContainer::s_SearchResults;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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...");
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion Src/StartMenu/StartMenuDLL/MenuContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Src/StartMenu/StartMenuDLL/SettingsUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down