Added options for moving the start menu and showing the start menu at the edge of working area instead of against the taskbar

This commit is contained in:
Anis Errais
2021-01-24 21:23:08 +01:00
committed by ge0rdi
parent 859afc63d3
commit 8e1b4e35a3
4 changed files with 75 additions and 23 deletions

View File

@@ -7401,35 +7401,46 @@ bool CMenuContainer::HasMoreResults( void )
RECT CMenuContainer::CalculateWorkArea( const RECT &taskbarRect )
{
RECT rc=s_MenuLimits;
if ((s_TaskBarEdge==ABE_LEFT || s_TaskBarEdge==ABE_RIGHT) && GetSettingBool(L"ShowNextToTaskbar"))
RECT rc;
if (!GetSettingBool(L"AlignToWorkArea"))
{
// when the taskbar is on the side and the menu is not on top of it
// the start button is assumed at the top
if (s_TaskBarEdge==ABE_LEFT)
rc.left=taskbarRect.right;
rc = s_MenuLimits;
if ((s_TaskBarEdge == ABE_LEFT || s_TaskBarEdge == ABE_RIGHT) && GetSettingBool(L"ShowNextToTaskbar"))
{
// when the taskbar is on the side and the menu is not on top of it
// the start button is assumed at the top
if (s_TaskBarEdge == ABE_LEFT)
rc.left = taskbarRect.right;
else
rc.right = taskbarRect.left;
}
else
rc.right=taskbarRect.left;
{
if (s_TaskBarEdge == ABE_BOTTOM)
{
// taskbar is at the bottom
rc.bottom = taskbarRect.top;
}
else if (s_TaskBarEdge == ABE_TOP)
{
// taskbar is at the top
rc.top = taskbarRect.bottom;
}
else
{
// taskbar is on the side, start button must be at the top
rc.top = s_StartRect.bottom;
}
}
}
else
{
if (s_TaskBarEdge==ABE_BOTTOM)
{
// taskbar is at the bottom
rc.bottom=taskbarRect.top;
}
else if (s_TaskBarEdge==ABE_TOP)
{
// taskbar is at the top
rc.top=taskbarRect.bottom;
}
else
{
// taskbar is on the side, start button must be at the top
rc.top=s_StartRect.bottom;
}
// Get working area of the monitor the specified taskbar is on
MONITORINFO info{ sizeof(MONITORINFO) };
HMONITOR mon = MonitorFromRect(&taskbarRect, 0);
GetMonitorInfo(mon, &info);
rc = info.rcWork;
}
if (!s_bLockWorkArea)
{
// exclude floating keyboard
@@ -7455,6 +7466,32 @@ 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;
}

View File

@@ -4348,6 +4348,9 @@ CSetting g_Settings[]={
{L"InvertMetroIcons",CSetting::TYPE_BOOL,IDS_INVERT_ICONS,IDS_INVERT_ICONS_TIP,0},
{L"MaxMainMenuWidth",CSetting::TYPE_INT,IDS_MENU_WIDTH,IDS_MENU_WIDTH_TIP,60,CSetting::FLAG_MENU_CLASSIC_BOTH},
{L"MaxMenuWidth",CSetting::TYPE_INT,IDS_SUBMENU_WIDTH,IDS_SUBMENU_WIDTH_TIP,60},
{L"AlignToWorkArea",CSetting::TYPE_BOOL,IDS_ALIGN_WORK_AREA,IDS_ALIGN_WORK_AREA_TIP,0},
{L"HorizontalMenuOffset",CSetting::TYPE_INT,IDS_HOR_OFFSET,IDS_HOR_OFFSET_TIP,0},
{L"VerticalMenuOffset",CSetting::TYPE_INT,IDS_VERT_OFFSET,IDS_VERT_OFFSET_TIP,0 },
{L"OverrideDPI",CSetting::TYPE_INT,IDS_DPI_OVERRIDE,IDS_DPI_OVERRIDE_TIP,0,CSetting::FLAG_COLD},
{L"MainMenuAnimate",CSetting::TYPE_BOOL,IDS_ANIMATION7,IDS_ANIMATION7_TIP,1,CSetting::FLAG_MENU_WIN7},
{L"MainMenuAnimation",CSetting::TYPE_INT,IDS_ANIMATION,IDS_ANIMATION_TIP,-1}, // system animation type

View File

@@ -644,6 +644,12 @@ BEGIN
IDS_PIC_COMMAND_TIP "Enter the command you want to run when you click on the user picture"
IDS_NAME_COMMAND "User name command"
IDS_NAME_COMMAND_TIP "Enter the command you want to run when you click on the user name"
IDS_ALIGN_WORK_AREA "Align start menu to working area"
IDS_ALIGN_WORK_AREA_TIP "Align the start menu to the working area instead of to the taskbar. Use with custom taskbars"
IDS_HOR_OFFSET "Horizontal position offset"
IDS_HOR_OFFSET_TIP "Offset the start menu horizontally by the amount of pixels specified"
IDS_VERT_OFFSET "Vertical position offset"
IDS_VERT_OFFSET_TIP "Offset the start menu vertically by the amount of pixels specified"
IDS_SMALL_SIZE_SM "Small icon size"
IDS_SMALL_SIZE_SM_TIP "Set the small icon size. The default is 16 for DPI<=96, 20 for 96<DPI<=120 and 24 for DPI>120"
IDS_LARGE_SIZE_SM "Large icon size"

View File

@@ -754,6 +754,12 @@
#define IDS_SELECT_LAST 3657
#define IDS_SELECT_LAST_TIP 3658
#define IDS_CLEAR_CACHE 3659
#define IDS_ALIGN_WORK_AREA 3660
#define IDS_ALIGN_WORK_AREA_TIP 3661
#define IDS_HOR_OFFSET 3662
#define IDS_HOR_OFFSET_TIP 3663
#define IDS_VERT_OFFSET 3664
#define IDS_VERT_OFFSET_TIP 3665
#define IDS_STRING7001 7001
#define IDS_STRING7002 7002
#define IDS_STRING7003 7003