Skip to content

Commit be8568c

Browse files
thisismy-githubIbuprophen
authored andcommitted
Added option to hide "see more results" in search
Hides the item in both start menu styles and adjusts search height to ensure the empty space is used. Partially fixes #660, but currently does not honor group policy settings.
1 parent 5399e3a commit be8568c

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

Src/StartMenu/StartMenuDLL/MenuContainer.cpp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ bool CMenuContainer::s_bDragMovable;
335335
bool CMenuContainer::s_bRightDrag;
336336
bool CMenuContainer::s_bLockWorkArea;
337337
bool CMenuContainer::s_bPendingSearchEnter;
338+
bool CMenuContainer::s_bMoreResults;
338339
std::vector<CMenuContainer*> CMenuContainer::s_Menus;
339340
volatile HWND CMenuContainer::s_FirstMenu, CMenuContainer::s_SearchMenu;
340341
CSearchManager::SearchResults CMenuContainer::s_SearchResults;
@@ -2745,9 +2746,9 @@ bool CMenuContainer::InitSearchItems( void )
27452746
{
27462747
sepHeight=s_Skin.ItemSettings[s_Skin.More_bitmap_Size.cx?MenuSkin::LIST_SEPARATOR_SPLIT:MenuSkin::LIST_SEPARATOR].itemHeight;
27472748
itemHeight=s_Skin.ItemSettings[MenuSkin::LIST_ITEM].itemHeight;
2748-
// total height minus the search box and the "more results"/"search internet"
2749+
// total height minus the search box and the "more results"/"search internet", if present
27492750
maxHeight=m_Items[m_SearchIndex].itemRect.top-s_Skin.Main_search_padding.top-s_Skin.Search_padding.top;
2750-
maxHeight-=itemHeight*(m_SearchItemCount-1);
2751+
maxHeight-=itemHeight*(m_SearchItemCount-(s_bMoreResults?1:2));
27512752
if (!s_SearchResults.bSearching && !HasMoreResults())
27522753
maxHeight+=itemHeight;
27532754
}
@@ -2941,25 +2942,28 @@ bool CMenuContainer::InitSearchItems( void )
29412942
if (s_bWin7Style)
29422943
{
29432944
UpdateAccelerators(m_OriginalCount,(int)m_Items.size());
2944-
MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1];
2945-
if (s_SearchResults.bSearching)
2945+
if (s_bMoreResults)
29462946
{
2947-
item.id=MENU_SEARCH_EMPTY;
2948-
item.name=FindTranslation(L"Menu.Searching",L"Searching...");
2949-
item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,8",CItemManager::ICON_SIZE_TYPE_SMALL);
2950-
}
2951-
else
2952-
{
2953-
item.id=MENU_MORE_RESULTS;
2954-
item.name=FindTranslation(L"Menu.MoreResults",L"See more results");
2955-
item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,177",CItemManager::ICON_SIZE_TYPE_SMALL);
2947+
MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1];
2948+
if (s_SearchResults.bSearching)
2949+
{
2950+
item.id=MENU_SEARCH_EMPTY;
2951+
item.name=FindTranslation(L"Menu.Searching",L"Searching...");
2952+
item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,8",CItemManager::ICON_SIZE_TYPE_SMALL);
2953+
}
2954+
else
2955+
{
2956+
item.id=MENU_MORE_RESULTS;
2957+
item.name=FindTranslation(L"Menu.MoreResults",L"See more results");
2958+
item.pItemInfo=g_ItemManager.GetCustomIcon(L"imageres.dll,177",CItemManager::ICON_SIZE_TYPE_SMALL);
2959+
}
29562960
}
29572961
}
29582962
else
29592963
{
29602964
m_ScrollCount=(int)m_Items.size();
2961-
bool bInternet=GetSettingBool(L"SearchInternet");
2962-
if (s_SearchResults.bSearching)
2965+
bool bInternet=GetSettingBool(L"SearchInternet");
2966+
if (s_bMoreResults && s_SearchResults.bSearching)
29632967
{
29642968
MenuItem item(MENU_SEARCH_EMPTY);
29652969
item.name=FindTranslation(L"Menu.Searching",L"Searching...");
@@ -2974,7 +2978,7 @@ bool CMenuContainer::InitSearchItems( void )
29742978
item.name=FindTranslation(L"Menu.NoMatch",L"No items match your search.");
29752979
m_Items.push_back(item);
29762980
}
2977-
if (HasMoreResults())
2981+
if (s_bMoreResults && HasMoreResults())
29782982
{
29792983
{
29802984
MenuItem item(MENU_SEPARATOR);
@@ -5062,7 +5066,7 @@ void CMenuContainer::UpdateSearchResults( bool bForceShowAll )
50625066
g_SearchManager.BeginSearch(s_SearchResults.currentString);
50635067
s_SearchResults.bSearching=true;
50645068
s_bPendingSearchEnter=false;
5065-
if (s_bWin7Style)
5069+
if (s_bWin7Style && s_bMoreResults)
50665070
{
50675071
MenuItem &item=m_Items[m_SearchIndex-m_SearchItemCount+1];
50685072
item.id=MENU_SEARCH_EMPTY;
@@ -7694,6 +7698,7 @@ HWND CMenuContainer::ToggleStartMenu( int taskbarId, bool bKeyboard, bool bAllPr
76947698
s_bDisableHover=false;
76957699
s_bDragClosed=false;
76967700
s_bPendingSearchEnter=false;
7701+
s_bMoreResults=GetSettingBool(L"MoreResults");
76977702
InitTouchHelper();
76987703

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

Src/StartMenu/StartMenuDLL/MenuContainer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ 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
899900
static RECT s_MenuLimits; // area of the main monitor accessible to all menus
900901
static RECT s_MainMenuLimits; // area of the main monitor accessible by the main menu
901902
static DWORD s_TaskbarState; // the state of the taskbar (ABS_AUTOHIDE and ABS_ALWAYSONTOP)

Src/StartMenu/StartMenuDLL/SettingsUI.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4359,6 +4359,7 @@ CSetting g_Settings[]={
43594359
{L"SearchContents",CSetting::TYPE_BOOL,IDS_SEARCH_CONTENTS,IDS_SEARCH_CONTENTS_TIP,1,0,L"#SearchFiles",L"SearchFiles"},
43604360
{L"SearchCategories",CSetting::TYPE_BOOL,IDS_SEARCH_CATEGORIES,IDS_SEARCH_CATEGORIES_TIP,1,0,L"#SearchFiles",L"SearchFiles"},
43614361
{L"SearchInternet",CSetting::TYPE_BOOL,IDS_SEARCH_INTERNET,IDS_SEARCH_INTERNET_TIP,1,0,L"SearchBox"},
4362+
{L"MoreResults",CSetting::TYPE_BOOL,IDS_MORE_RESULTS,IDS_MORE_RESULTS_TIP,1,0,L"SearchBox"},
43624363

43634364
{L"Look",CSetting::TYPE_GROUP,IDS_LOOK_SETTINGS},
43644365
{L"SmallIconSize",CSetting::TYPE_INT,IDS_SMALL_SIZE_SM,IDS_SMALL_SIZE_SM_TIP,-1,CSetting::FLAG_COLD}, // 16 for DPI<=96, 20 for DPI<=120, 24 otherwise

Src/StartMenu/StartMenuDLL/StartMenuDLL.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,8 @@ BEGIN
13051305
IDS_SEARCH_HINT_TIP "When this is checked, the hint text in the search box will be replaced"
13061306
IDS_NEW_SEARCH_HINT "Custom search hint text"
13071307
IDS_NEW_SEARCH_HINT_TIP "The text to replace the search hint with. Empty text is a valid option"
1308+
IDS_MORE_RESULTS "Enable ""See more results"" option"
1309+
IDS_MORE_RESULTS_TIP "When this is checked, the search results will include an option to do a more advanced search"
13081310
END
13091311

13101312
#endif // English (U.S.) resources

Src/StartMenu/StartMenuDLL/resource.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,8 @@
768768
#define IDS_SEARCH_HINT_TIP 3671
769769
#define IDS_NEW_SEARCH_HINT 3672
770770
#define IDS_NEW_SEARCH_HINT_TIP 3673
771+
#define IDS_MORE_RESULTS 3674
772+
#define IDS_MORE_RESULTS_TIP 3675
771773
#define IDS_STRING7001 7001
772774
#define IDS_STRING7002 7002
773775
#define IDS_STRING7003 7003

0 commit comments

Comments
 (0)