mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 15:24:10 +02:00
Improved settings reloading recent file menu item updating
This commit is contained in:
parent
c1f4466dd1
commit
ed444416f0
4 changed files with 27 additions and 9 deletions
|
@ -3,6 +3,7 @@ using System.Collections;
|
|||
using System.Text;
|
||||
using Beefy.widgets;
|
||||
using Beefy;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Beefy.sys
|
||||
{
|
||||
|
@ -22,10 +23,6 @@ namespace Beefy.sys
|
|||
public Event<MenuItemUpdateHandler> mOnMenuItemUpdate ~ _.Dispose();
|
||||
public List<SysMenu> mChildren ~ DeleteContainerAndItems!(_);
|
||||
|
||||
public this()
|
||||
{
|
||||
}
|
||||
|
||||
public int ChildCount
|
||||
{
|
||||
get
|
||||
|
@ -135,6 +132,8 @@ namespace Beefy.sys
|
|||
{
|
||||
mWindow.mSysMenuMap.Remove((int)mNativeBFMenu);
|
||||
mWindow.DeleteMenuItem(mNativeBFMenu);
|
||||
if (mParent != null)
|
||||
mParent.mChildren.Remove(this);
|
||||
}
|
||||
|
||||
public void UpdateChildItems()
|
||||
|
|
|
@ -2131,8 +2131,9 @@ void WinBFWindow::RemoveMenuItem(BFMenu* item)
|
|||
WinBFMenu* aMenu = (WinBFMenu*) item;
|
||||
WinBFMenu* parentMenu = (WinBFMenu*) item->mParent;
|
||||
|
||||
//auto itr = mMenuIDMap.find(aMenu->mMenuId);
|
||||
//mMenuIDMap.erase(itr);
|
||||
if (parentMenu != NULL)
|
||||
parentMenu->mBFMenuList.Remove(item);
|
||||
|
||||
mMenuIDMap.Remove(aMenu->mMenuId);
|
||||
|
||||
::RemoveMenu(parentMenu->mMenu, aMenu->mMenuId, MF_BYCOMMAND);
|
||||
|
|
|
@ -5189,13 +5189,16 @@ namespace IDE
|
|||
[IDECommand]
|
||||
public void ReloadSettings()
|
||||
{
|
||||
delete mSettings;
|
||||
mSettings = new .();
|
||||
var prevSettings = mSettings;
|
||||
defer delete prevSettings;
|
||||
mSettings = new .(prevSettings);
|
||||
|
||||
DeleteAndNullify!(mKeyChordState);
|
||||
|
||||
mSettings.Load();
|
||||
mSettings.Apply();
|
||||
UpdateRecentFileMenuItems();
|
||||
UpdateRecentDisplayedFilesMenuItems();
|
||||
}
|
||||
|
||||
public void CheckReloadSettings()
|
||||
|
|
|
@ -1106,12 +1106,24 @@ namespace IDE
|
|||
public bool mEnableDevMode;
|
||||
public TutorialsFinished mTutorialsFinished = .();
|
||||
|
||||
|
||||
public this()
|
||||
{
|
||||
SetDefaults();
|
||||
}
|
||||
|
||||
public this(Settings prevSettings)
|
||||
{
|
||||
Swap!(mRecentFiles, prevSettings.mRecentFiles);
|
||||
|
||||
for (var recent in mRecentFiles.mRecents)
|
||||
{
|
||||
recent.mList.ClearAndDeleteItems();
|
||||
for (var item in recent.mMenuItems)
|
||||
item.Dispose();
|
||||
recent.mMenuItems.ClearAndDeleteItems();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDefaults()
|
||||
{
|
||||
mVSSettings.SetDefaults();
|
||||
|
@ -1192,6 +1204,9 @@ namespace IDE
|
|||
|
||||
public bool WantsReload()
|
||||
{
|
||||
if (mSettingFileDateTime == default)
|
||||
return false;
|
||||
|
||||
String path = scope .();
|
||||
GetSettingsPath(path);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue