diff --git a/BeefLibs/Beefy2D/src/widgets/ListView.bf b/BeefLibs/Beefy2D/src/widgets/ListView.bf index 6a2f6900..3466b3e2 100644 --- a/BeefLibs/Beefy2D/src/widgets/ListView.bf +++ b/BeefLibs/Beefy2D/src/widgets/ListView.bf @@ -168,9 +168,12 @@ namespace Beefy.widgets { if ((!skipClosed) || (mParentItem == null) || (IsOpen)) { - for (ListViewItem child in mChildItems) + for (int i < mChildItems.Count) { - child.WithSelectedItems(func, skipSelectedChildrenOnSelectedItems, skipClosed); + var child = mChildItems[i]; + child.WithSelectedItems(func, skipSelectedChildrenOnSelectedItems, skipClosed); + if ((i < mChildItems.Count) && (mChildItems[i] != child)) + i--; } } } diff --git a/IDE/src/ui/TargetedPropertiesDialog.bf b/IDE/src/ui/TargetedPropertiesDialog.bf index d3d22c72..534b86b5 100644 --- a/IDE/src/ui/TargetedPropertiesDialog.bf +++ b/IDE/src/ui/TargetedPropertiesDialog.bf @@ -182,6 +182,9 @@ namespace IDE.ui ++itemCount; }); + if (itemCount == 0) + return; + String queryStr = scope String()..AppendF("Are you sure you want delete '{0}'", names); let dialog = ThemeFactory.mDefault.CreateDialog("Delete?", queryStr, DarkTheme.sDarkTheme.mIconWarning); dialog.AddYesNoButtons(new (dlg) => { DoDelete(); }, null, -1, 1); @@ -392,12 +395,32 @@ namespace IDE.ui { List allConfigs = scope List(); GetConfigList(allConfigs); + allConfigs.Remove(configName); allConfigs.Sort(scope (lhs, rhs) => lhs <=> rhs); mConfigNames.Add(new String(allConfigs[0])); } currentChanged = true; } + for (var configData in mConfigDatas) + { + if (configData.mTarget.mConfig == configName) + { + delete configData; + @configData.Remove(); + + for (var target in mTargetedConfigDatas) + { + if (target.value == configData) + { + delete target.key.mConfig; + delete target.key.mPlatform; + @target.Remove(); + } + } + } + } + if (currentChanged) SelectConfig(mConfigNames); } @@ -411,10 +434,17 @@ namespace IDE.ui SelectConfig(mConfigNames); } MarkDirty(); + + if (gApp.mConfigName == from) + gApp.mMainFrame.mStatusBar.SelectConfig(to); + if (mActiveConfigName == from) + mActiveConfigName.Set(to); } protected void PlatformDeleted(String platformName) { + gApp.mWorkspace.MarkPlatformNamesDirty(); + bool currentChanged = false; int idx = mPlatformNames.IndexOf(platformName); if (idx != -1) @@ -426,6 +456,7 @@ namespace IDE.ui { List allPlatforms = scope List(); GetPlatformList(allPlatforms); + allPlatforms.Remove(platformName); allPlatforms.Sort(scope (lhs, rhs) => lhs <=> rhs); mPlatformNames.Add(new String(allPlatforms[0])); } @@ -434,11 +465,42 @@ namespace IDE.ui if (currentChanged) SelectPlatform(mPlatformNames); - gApp.mWorkspace.MarkPlatformNamesDirty(); + + for (var configData in mConfigDatas) + { + if (configData.mTarget.mPlatform == platformName) + { + delete configData; + @configData.Remove(); + + for (var target in mTargetedConfigDatas) + { + if (target.value == configData) + { + delete target.key.mConfig; + delete target.key.mPlatform; + @target.Remove(); + } + } + } + } + + if (gApp.mPlatformName == platformName) + gApp.mMainFrame.mStatusBar.SelectPlatform(mPlatformNames[0]); + if (mActivePlatformName == platformName) + mActivePlatformName.Set(mPlatformNames[0]); } protected void PlatformRenamed(String from, String to) { + for (var configData in mConfigDatas) + { + if (configData.mTarget.mPlatform == from) + { + configData.mTarget.mPlatform.Set(to); + } + } + int idx = mPlatformNames.IndexOf(from); if (idx != -1) { @@ -447,6 +509,11 @@ namespace IDE.ui } MarkDirty(); gApp.mWorkspace.MarkPlatformNamesDirty(); + + if (gApp.mPlatformName == from) + gApp.mMainFrame.mStatusBar.SelectPlatform(to); + if (mActivePlatformName == from) + mActivePlatformName.Set(to); } public virtual void EditConfigs() @@ -711,7 +778,7 @@ namespace IDE.ui } } - protected void SelectPlatform(List platformNames) + protected void SelectPlatform(List platformNames, int32 category = -1) { if (platformNames != mPlatformNames) { @@ -724,7 +791,7 @@ namespace IDE.ui else { mConfigComboBox.Label = ""; - ShowPropPage(mPropPage.mCategoryType); + ShowPropPage((category != -1) ? category : mPropPage.mCategoryType); } } @@ -737,13 +804,14 @@ namespace IDE.ui ShowPropPage(mPropPage.mCategoryType); } - protected void SelectPlatform(String platformName) + protected void SelectPlatform(String platformName, int32 category = -1) { var newPlatformName = new String(platformName); ClearAndDeleteItems(mPlatformNames); mPlatformNames.Add(newPlatformName); mPlatformComboBox.Label = newPlatformName; - ShowPropPage(mPropPage.mCategoryType); + + ShowPropPage((category != -1) ? category : mPropPage.mCategoryType); } public override void ResizeComponents() diff --git a/IDE/src/ui/WorkspaceProperties.bf b/IDE/src/ui/WorkspaceProperties.bf index 83f55d99..1c9a3db8 100644 --- a/IDE/src/ui/WorkspaceProperties.bf +++ b/IDE/src/ui/WorkspaceProperties.bf @@ -320,6 +320,13 @@ namespace IDE.ui } } } + + if (gApp.mWorkspace.mExtraPlatforms.GetAndRemove(entry.mOrigName) case .Ok(let val)) + delete val; + if (!entry.mDelete) + gApp.mWorkspace.mExtraPlatforms.Add(new .(entry.mNewName)); + + gApp.mWorkspace.MarkPlatformNamesDirty(); } for (var window in gApp.mWindows)