mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 23:34: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 System.Text;
|
||||||
using Beefy.widgets;
|
using Beefy.widgets;
|
||||||
using Beefy;
|
using Beefy;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Beefy.sys
|
namespace Beefy.sys
|
||||||
{
|
{
|
||||||
|
@ -22,10 +23,6 @@ namespace Beefy.sys
|
||||||
public Event<MenuItemUpdateHandler> mOnMenuItemUpdate ~ _.Dispose();
|
public Event<MenuItemUpdateHandler> mOnMenuItemUpdate ~ _.Dispose();
|
||||||
public List<SysMenu> mChildren ~ DeleteContainerAndItems!(_);
|
public List<SysMenu> mChildren ~ DeleteContainerAndItems!(_);
|
||||||
|
|
||||||
public this()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ChildCount
|
public int ChildCount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -135,6 +132,8 @@ namespace Beefy.sys
|
||||||
{
|
{
|
||||||
mWindow.mSysMenuMap.Remove((int)mNativeBFMenu);
|
mWindow.mSysMenuMap.Remove((int)mNativeBFMenu);
|
||||||
mWindow.DeleteMenuItem(mNativeBFMenu);
|
mWindow.DeleteMenuItem(mNativeBFMenu);
|
||||||
|
if (mParent != null)
|
||||||
|
mParent.mChildren.Remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateChildItems()
|
public void UpdateChildItems()
|
||||||
|
|
|
@ -2131,8 +2131,9 @@ void WinBFWindow::RemoveMenuItem(BFMenu* item)
|
||||||
WinBFMenu* aMenu = (WinBFMenu*) item;
|
WinBFMenu* aMenu = (WinBFMenu*) item;
|
||||||
WinBFMenu* parentMenu = (WinBFMenu*) item->mParent;
|
WinBFMenu* parentMenu = (WinBFMenu*) item->mParent;
|
||||||
|
|
||||||
//auto itr = mMenuIDMap.find(aMenu->mMenuId);
|
if (parentMenu != NULL)
|
||||||
//mMenuIDMap.erase(itr);
|
parentMenu->mBFMenuList.Remove(item);
|
||||||
|
|
||||||
mMenuIDMap.Remove(aMenu->mMenuId);
|
mMenuIDMap.Remove(aMenu->mMenuId);
|
||||||
|
|
||||||
::RemoveMenu(parentMenu->mMenu, aMenu->mMenuId, MF_BYCOMMAND);
|
::RemoveMenu(parentMenu->mMenu, aMenu->mMenuId, MF_BYCOMMAND);
|
||||||
|
|
|
@ -5189,13 +5189,16 @@ namespace IDE
|
||||||
[IDECommand]
|
[IDECommand]
|
||||||
public void ReloadSettings()
|
public void ReloadSettings()
|
||||||
{
|
{
|
||||||
delete mSettings;
|
var prevSettings = mSettings;
|
||||||
mSettings = new .();
|
defer delete prevSettings;
|
||||||
|
mSettings = new .(prevSettings);
|
||||||
|
|
||||||
DeleteAndNullify!(mKeyChordState);
|
DeleteAndNullify!(mKeyChordState);
|
||||||
|
|
||||||
mSettings.Load();
|
mSettings.Load();
|
||||||
mSettings.Apply();
|
mSettings.Apply();
|
||||||
|
UpdateRecentFileMenuItems();
|
||||||
|
UpdateRecentDisplayedFilesMenuItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckReloadSettings()
|
public void CheckReloadSettings()
|
||||||
|
|
|
@ -1106,12 +1106,24 @@ namespace IDE
|
||||||
public bool mEnableDevMode;
|
public bool mEnableDevMode;
|
||||||
public TutorialsFinished mTutorialsFinished = .();
|
public TutorialsFinished mTutorialsFinished = .();
|
||||||
|
|
||||||
|
|
||||||
public this()
|
public this()
|
||||||
{
|
{
|
||||||
SetDefaults();
|
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()
|
public void SetDefaults()
|
||||||
{
|
{
|
||||||
mVSSettings.SetDefaults();
|
mVSSettings.SetDefaults();
|
||||||
|
@ -1192,6 +1204,9 @@ namespace IDE
|
||||||
|
|
||||||
public bool WantsReload()
|
public bool WantsReload()
|
||||||
{
|
{
|
||||||
|
if (mSettingFileDateTime == default)
|
||||||
|
return false;
|
||||||
|
|
||||||
String path = scope .();
|
String path = scope .();
|
||||||
GetSettingsPath(path);
|
GetSettingsPath(path);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue