Skip to content

Commit da73edf

Browse files
authored
Added setting to horizontally offset start button (#2524)
1 parent f66d5ce commit da73edf

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

Src/StartMenu/StartMenuDLL/SettingsUI.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4456,6 +4456,7 @@ CSetting g_Settings[]={
44564456
{L"CustomButton",CSetting::TYPE_RADIO,IDS_CUSTOM_BUTTON,IDS_CUSTOM_BUTTON_TIP},
44574457
{L"StartButtonPath",CSetting::TYPE_BITMAP,IDS_BUTTON_IMAGE,IDS_BUTTON_IMAGE_TIP,L"",0,L"#StartButtonType=2",L"CustomButton"},
44584458
{L"StartButtonSize",CSetting::TYPE_INT,IDS_BUTTON_SIZE,IDS_BUTTON_SIZE_TIP2,0,0,L"#StartButtonType=2",L"CustomButton"},
4459+
{L"StartButtonOffset",CSetting::TYPE_INT,IDS_BUTTON_OFFSET,IDS_BUTTON_OFFSET_TIP,0,0,L"#StartButtonType=2",L"CustomButton"},
44594460
{L"StartButtonAlign",CSetting::TYPE_BOOL,IDS_BUTTON_ALIGN,IDS_BUTTON_ALIGN_TIP,0,0,L"#StartButtonType=2",L"CustomButton"},
44604461
{L"StartButtonIcon",CSetting::TYPE_ICON,IDS_BUTTON_ICON,IDS_BUTTON_ICON_TIP,L",1",0,L"#StartButtonType=1",L"ClasicButton"},
44614462
{L"StartButtonIconSize",CSetting::TYPE_INT,IDS_BUTTON_ICON_SIZE,IDS_BUTTON_ICON_SIZE_TIP,0,0,L"#StartButtonType=1",L"ClasicButton"},
@@ -5157,7 +5158,7 @@ void InitSettings( void )
51575158
InitSettings(g_Settings,COMPONENT_MENU,&g_CustomSettings);
51585159
}
51595160

5160-
static int g_ButtonPath, g_ButtonSize, g_ButtonIcon, g_ButtonIconSize, g_ButtonText, g_ButtonTip;
5161+
static int g_ButtonPath, g_ButtonSize, g_ButtonIcon, g_ButtonOffset, g_ButtonIconSize, g_ButtonText, g_ButtonTip;
51615162
static bool g_bButtonEnable, g_bTaskbarsChanged, g_bTaskbarsUpdated;
51625163

51635164
static void StoreButtonSettings( void )
@@ -5175,6 +5176,7 @@ static void StoreButtonSettings( void )
51755176
if (g_ButtonPath==START_BUTTON_CUSTOM)
51765177
g_ButtonPath=CalcFNVHash(GetSettingString(L"StartButtonPath"));
51775178
g_ButtonSize=GetSettingInt(L"StartButtonSize");
5179+
g_ButtonOffset=GetSettingInt(L"StartButtonOffset");
51785180
g_ButtonIconSize=GetSettingInt(L"StartButtonIconSize");
51795181
}
51805182

@@ -5191,7 +5193,7 @@ static void UpdateButtons( bool bForce )
51915193
}
51925194
if (path==START_BUTTON_CUSTOM)
51935195
path=CalcFNVHash(GetSettingString(L"StartButtonPath"));
5194-
bool bRecreate=(g_bButtonEnable!=GetSettingBool(L"EnableStartButton") || path!=g_ButtonPath || g_ButtonSize!=GetSettingInt(L"StartButtonSize")
5196+
bool bRecreate=(g_bButtonEnable!=GetSettingBool(L"EnableStartButton") || path!=g_ButtonPath || g_ButtonSize!=GetSettingInt(L"StartButtonSize") || g_ButtonOffset!=GetSettingInt(L"StartButtonOffset")
51955197
|| g_ButtonIcon!=icon || g_ButtonIconSize!=GetSettingInt(L"StartButtonIconSize") || g_ButtonText!=text || g_ButtonTip!=tip);
51965198
if ((g_bTaskbarsChanged && !g_bTaskbarsUpdated) || bForce || bRecreate)
51975199
{

Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,6 +1347,9 @@ static void UpdateStartButtonPosition(const TaskbarInfo* taskBar, const WINDOWPO
13471347
// We will shift our Aero button to cover original button
13481348
if (IsWin11() && (x == info.rcMonitor.left) && (GetStartButtonType() == START_BUTTON_AERO) && !g_epTaskbar)
13491349
x += ScaleForDpi(taskBar->taskBar, 6);
1350+
1351+
if (GetStartButtonType() == START_BUTTON_CUSTOM)
1352+
x += ScaleForDpi(taskBar->taskBar, GetSettingInt(L"StartButtonOffset"));
13501353
}
13511354

13521355
RECT rcButton = { x, y, x + taskBar->startButtonSize.cx, y + taskBar->startButtonSize.cy };

Src/StartMenu/StartMenuDLL/StartMenuDLL.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,8 @@ BEGIN
10731073
IDS_MENU_GLASS "Enable Aero Glass (requires Aero Glass mod)"
10741074
IDS_MENU_GLASS_TIP "Check this to use glass transparency (requires the Aero Glass mod to be installed)"
10751075
IDS_MAIN_MENU_SETTINGS "Main Menu"
1076+
IDS_BUTTON_OFFSET "Button offset"
1077+
IDS_BUTTON_OFFSET_TIP "Offset the start button horizontally by the amount of pixels specified"
10761078
END
10771079

10781080
STRINGTABLE

Src/StartMenu/StartMenuDLL/resource.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,8 @@
786786
#define IDS_ENABLE_ACCELERATORS_TIP 3687
787787
#define IDS_ALT_ACCELERATORS 3688
788788
#define IDS_ALT_ACCELERATORS_TIP 3689
789+
#define IDS_BUTTON_OFFSET 3690
790+
#define IDS_BUTTON_OFFSET_TIP 3691
789791
#define IDS_STRING7001 7001
790792
#define IDS_STRING7002 7002
791793
#define IDS_STRING7003 7003

0 commit comments

Comments
 (0)