mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 15:46:05 +02:00
Adding better support for platforms
This commit is contained in:
parent
85648cda63
commit
62346a53b0
9 changed files with 286 additions and 109 deletions
|
@ -16,16 +16,17 @@ namespace IDE.ui
|
|||
public class ProjectProperties : BuildPropertiesDialog
|
||||
{
|
||||
ValueContainer<String> mVC;
|
||||
|
||||
|
||||
enum CategoryType
|
||||
{
|
||||
General, ///
|
||||
Project,
|
||||
Platform,
|
||||
/*Platform,
|
||||
Platform_Windows,
|
||||
Platform_Linux,
|
||||
Platform_Linux,*/
|
||||
Dependencies,
|
||||
Beef_Global,
|
||||
Platform,
|
||||
|
||||
Targeted, ///
|
||||
Beef_Targeted,
|
||||
|
@ -92,11 +93,9 @@ namespace IDE.ui
|
|||
var item = AddCategoryItem(globalItem, "Project");
|
||||
if (!project.IsDebugSession)
|
||||
item.Focused = true;
|
||||
item = AddCategoryItem(globalItem, "Platform");
|
||||
AddCategoryItem(item, "Windows");
|
||||
AddCategoryItem(item, "Linux");
|
||||
AddCategoryItem(globalItem, "Dependencies");
|
||||
AddCategoryItem(globalItem, "Beef");
|
||||
AddCategoryItem(globalItem, "Platform");
|
||||
globalItem.Open(true, true);
|
||||
|
||||
var targetedItem = AddCategoryItem(root, "Targeted");
|
||||
|
@ -143,21 +142,19 @@ namespace IDE.ui
|
|||
return false;
|
||||
}
|
||||
|
||||
protected override bool IsCategoryTargeted(int32 categoryTypeInt)
|
||||
protected override TargetedKind GetCategoryTargetedKind(int32 categoryTypeInt)
|
||||
{
|
||||
switch ((CategoryType)categoryTypeInt)
|
||||
{
|
||||
case .General,
|
||||
.Targeted,
|
||||
.Platform,
|
||||
.Project,
|
||||
.Dependencies,
|
||||
.Platform_Linux,
|
||||
.Platform_Windows,
|
||||
.Beef_Global:
|
||||
return false;
|
||||
return .None;
|
||||
case .Platform:
|
||||
return .Platform;
|
||||
default:
|
||||
return true;
|
||||
return .Config;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -427,14 +424,23 @@ namespace IDE.ui
|
|||
mProject.SetupDefault(generalOptions);
|
||||
targetDict[mCurPropertiesTargets[0]] = generalOptions;
|
||||
UpdateFromTarget(targetDict);
|
||||
case .Platform_Windows:
|
||||
var windowsOptions = scope Project.WindowsOptions();
|
||||
targetDict[mCurPropertiesTargets[0]] = windowsOptions;
|
||||
UpdateFromTarget(targetDict);
|
||||
case .Platform_Linux:
|
||||
var linuxOptions = scope Project.LinuxOptions();
|
||||
targetDict[mCurPropertiesTargets[0]] = linuxOptions;
|
||||
UpdateFromTarget(targetDict);
|
||||
case .Platform:
|
||||
for (var platformName in mPlatformNames)
|
||||
{
|
||||
let platform = Workspace.PlatformType.GetFromName(platformName);
|
||||
switch (platform)
|
||||
{
|
||||
case .Windows:
|
||||
var windowsOptions = scope Project.WindowsOptions();
|
||||
targetDict[mCurPropertiesTargets[0]] = windowsOptions;
|
||||
UpdateFromTarget(targetDict);
|
||||
case .Linux:
|
||||
var linuxOptions = scope Project.LinuxOptions();
|
||||
targetDict[mCurPropertiesTargets[0]] = linuxOptions;
|
||||
UpdateFromTarget(targetDict);
|
||||
default:
|
||||
}
|
||||
}
|
||||
case .Build, .Debugging, .Beef_Targeted:
|
||||
DeleteDistinctBuildOptions();
|
||||
DistinctBuildOptions defaultTypeOptions = scope:: .();
|
||||
|
@ -488,7 +494,33 @@ namespace IDE.ui
|
|||
|
||||
DeleteAndNullify!(mCurProjectOptions);
|
||||
|
||||
if (IsCategoryTargeted(categoryTypeInt))
|
||||
let targetKind = GetCategoryTargetedKind(categoryTypeInt);
|
||||
|
||||
bool areSamePlatforms = true;
|
||||
|
||||
if (targetKind == .Platform)
|
||||
{
|
||||
let platformKind = Workspace.PlatformType.GetFromName(platformName);
|
||||
|
||||
for (var checkPlatformName in mPlatformNames)
|
||||
{
|
||||
let checkPlatformKind = Workspace.PlatformType.GetFromName(checkPlatformName);
|
||||
if (checkPlatformKind != platformKind)
|
||||
areSamePlatforms = false;
|
||||
}
|
||||
|
||||
if (areSamePlatforms)
|
||||
{
|
||||
mCurPropertiesTargets = new Object[1];
|
||||
switch (platformKind)
|
||||
{
|
||||
case .Windows: mCurPropertiesTargets[0] = mProject.mWindowsOptions;
|
||||
case .Linux: mCurPropertiesTargets[0] = mProject.mLinuxOptions;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (targetKind == .Config)
|
||||
{
|
||||
mCurPropertiesTargets = new Object[mConfigNames.Count * mPlatformNames.Count];
|
||||
mCurProjectOptions = new Project.Options[mConfigNames.Count * mPlatformNames.Count];
|
||||
|
@ -496,9 +528,6 @@ namespace IDE.ui
|
|||
{
|
||||
for (var checkPlatformName in mPlatformNames)
|
||||
{
|
||||
/*var projectConfig = mProject.mConfigs[checkConfigName];
|
||||
mCurProjectOptions[propIdx] = projectConfig.mPlatforms[checkPlatformName];
|
||||
mCurPropertiesTargets[propIdx] = mCurProjectOptions[propIdx];*/
|
||||
let projectOptions = mProject.GetOptions(checkConfigName, checkPlatformName, true);
|
||||
mCurProjectOptions[propIdx] = projectOptions;
|
||||
mCurPropertiesTargets[propIdx] = projectOptions;
|
||||
|
@ -513,14 +542,10 @@ namespace IDE.ui
|
|||
mCurPropertiesTargets[0] = mProject.mGeneralOptions;
|
||||
else if (categoryType == .Beef_Global)
|
||||
mCurPropertiesTargets[0] = mProject.mBeefGlobalOptions;
|
||||
else if (categoryType == .Platform_Windows)
|
||||
mCurPropertiesTargets[0] = mProject.mWindowsOptions;
|
||||
else if (categoryType == .Platform_Linux)
|
||||
mCurPropertiesTargets[0] = mProject.mLinuxOptions;
|
||||
}
|
||||
|
||||
ConfigDataGroup targetedConfigData;
|
||||
if ((IsCategoryTargeted(categoryTypeInt)) &&
|
||||
if ((GetCategoryTargetedKind(categoryTypeInt) == .Config) &&
|
||||
((mConfigNames.Count == 1) && (mPlatformNames.Count == 1)))
|
||||
{
|
||||
var key = Tuple<String, String>(configName, platformName);
|
||||
|
@ -531,25 +556,29 @@ namespace IDE.ui
|
|||
key.Item2 = new String(key.Item2);
|
||||
targetedConfigData = new ConfigDataGroup((int32)CategoryType.COUNT);
|
||||
targetedConfigData.mTarget = key;
|
||||
mConfigDatas.Add(targetedConfigData);
|
||||
mTargetedConfigDatas[key] = targetedConfigData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mUntargetedConfigData == null)
|
||||
if (mMultiTargetConfigData == null)
|
||||
{
|
||||
mUntargetedConfigData = new ConfigDataGroup((int32)CategoryType.COUNT);
|
||||
mConfigDatas.Add(mUntargetedConfigData);
|
||||
mMultiTargetConfigData = new ConfigDataGroup((int32)CategoryType.COUNT);
|
||||
mMultiTargetConfigData.mIsMultiTargeted = true;
|
||||
}
|
||||
targetedConfigData = mUntargetedConfigData;
|
||||
targetedConfigData = mMultiTargetConfigData;
|
||||
|
||||
if (IsCategoryTargeted(categoryTypeInt))
|
||||
if (GetCategoryTargetedKind(categoryTypeInt) != .None)
|
||||
{
|
||||
DeleteAndNullify!(targetedConfigData.mPropPages[categoryTypeInt]);
|
||||
}
|
||||
}
|
||||
|
||||
// Always add the current to the back so the most recently viewed one will apply changes last.
|
||||
// This matters when we have both project-specific and multiply-selected config data
|
||||
mConfigDatas.Remove(targetedConfigData);
|
||||
mConfigDatas.Add(targetedConfigData);
|
||||
|
||||
if (targetedConfigData.mPropPages[(int32)categoryType] == null)
|
||||
{
|
||||
CreatePropPage(categoryTypeInt, .AllowSearch | .AllowReset);
|
||||
|
@ -563,13 +592,22 @@ namespace IDE.ui
|
|||
|
||||
if (categoryType == CategoryType.Project)
|
||||
PopulateGeneralOptions();
|
||||
else if (categoryType == CategoryType.Platform_Windows)
|
||||
PopulateWindowsOptions();
|
||||
else if (categoryType == CategoryType.Platform_Linux)
|
||||
PopulateLinuxOptions();
|
||||
else if (categoryType == CategoryType.Dependencies)
|
||||
PopulateDependencyOptions();
|
||||
if (categoryType == CategoryType.Build)
|
||||
else if (categoryType == .Platform)
|
||||
{
|
||||
if (areSamePlatforms)
|
||||
{
|
||||
let platformKind = Workspace.PlatformType.GetFromName(platformName);
|
||||
switch (platformKind)
|
||||
{
|
||||
case .Windows: PopulateWindowsOptions();
|
||||
case .Linux: PopulateLinuxOptions();
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (categoryType == CategoryType.Build)
|
||||
PopulateBuildOptions();
|
||||
else if (categoryType == CategoryType.Beef_Global )
|
||||
PopulateBeefSharedOptions();
|
||||
|
@ -976,7 +1014,7 @@ namespace IDE.ui
|
|||
continue;
|
||||
if (projectProperties.mProject != mProject)
|
||||
continue;
|
||||
if (IsCategoryTargeted(propPage.mCategoryType))
|
||||
if (GetCategoryTargetedKind(propPage.mCategoryType) != .None)
|
||||
{
|
||||
if (mPropPage == propPage)
|
||||
{
|
||||
|
|
|
@ -259,6 +259,13 @@ namespace IDE.ui
|
|||
|
||||
public class TargetedPropertiesDialog : PropertiesDialog
|
||||
{
|
||||
public enum TargetedKind
|
||||
{
|
||||
None,
|
||||
Platform,
|
||||
Config
|
||||
}
|
||||
|
||||
protected const String sConfigLabel = "Configuration:";
|
||||
protected const String sPlatformLabel = "Platform:";
|
||||
|
||||
|
@ -273,6 +280,7 @@ namespace IDE.ui
|
|||
|
||||
protected class ConfigDataGroup
|
||||
{
|
||||
public bool mIsMultiTargeted;
|
||||
public Tuple<String, String> mTarget;
|
||||
public PropPage[] mPropPages ~ delete _;
|
||||
|
||||
|
@ -289,7 +297,7 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
protected Dictionary<Tuple<String, String>, ConfigDataGroup> mTargetedConfigDatas = new Dictionary<Tuple<String, String>, ConfigDataGroup>() ~ delete _;
|
||||
protected ConfigDataGroup mUntargetedConfigData;
|
||||
protected ConfigDataGroup mMultiTargetConfigData;
|
||||
protected List<ConfigDataGroup> mConfigDatas = new List<ConfigDataGroup>() ~ DeleteContainerAndItems!(_);
|
||||
|
||||
public this()
|
||||
|
@ -333,9 +341,9 @@ namespace IDE.ui
|
|||
return (mConfigNames.Count != 1) || (mPlatformNames.Count != 1);
|
||||
}
|
||||
|
||||
protected virtual bool IsCategoryTargeted(int32 categoryTypeInt)
|
||||
protected virtual TargetedKind GetCategoryTargetedKind(int32 categoryTypeInt)
|
||||
{
|
||||
return false;
|
||||
return .None;
|
||||
}
|
||||
|
||||
public virtual void GetConfigList(List<String> configNames)
|
||||
|
@ -583,26 +591,50 @@ namespace IDE.ui
|
|||
{
|
||||
base.ShowPropPage(categoryTypeInt);
|
||||
|
||||
if (IsCategoryTargeted(categoryTypeInt))
|
||||
if (GetCategoryTargetedKind(categoryTypeInt) == .Config)
|
||||
{
|
||||
if (mConfigNames.Count == 1)
|
||||
{
|
||||
String dispStr = ((mConfigNames.Count == 1) && (mActiveConfigName == mConfigNames[0])) ? StackStringFormat!("Active({0})", mConfigNames[0]) : mConfigNames[0];
|
||||
mConfigComboBox.Label = dispStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> configNames = scope .();
|
||||
GetConfigList(configNames);
|
||||
if (mConfigNames.Count == configNames.Count)
|
||||
mConfigComboBox.Label = "<All>";
|
||||
else
|
||||
mConfigComboBox.Label = "<Multiple>";
|
||||
}
|
||||
mConfigComboBox.mDisabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mConfigComboBox.Label = "N/A";
|
||||
mConfigComboBox.mDisabled = true;
|
||||
}
|
||||
|
||||
if (GetCategoryTargetedKind(categoryTypeInt) != .None)
|
||||
{
|
||||
if (mPlatformNames.Count == 1)
|
||||
{
|
||||
String dispStr = ((mPlatformNames.Count == 1) && (mActivePlatformName == mPlatformNames[0])) ? StackStringFormat!("Active({0})", mPlatformNames[0]) : mPlatformNames[0];
|
||||
mPlatformComboBox.Label = dispStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> platformNames = scope .();
|
||||
GetPlatformList(platformNames);
|
||||
if (mPlatformNames.Count == platformNames.Count)
|
||||
mPlatformComboBox.Label = "<All>";
|
||||
else
|
||||
mPlatformComboBox.Label = "<Multiple>";
|
||||
}
|
||||
mPlatformComboBox.mDisabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mConfigComboBox.Label = "N/A";
|
||||
mConfigComboBox.mDisabled = true;
|
||||
mPlatformComboBox.Label = "N/A";
|
||||
mPlatformComboBox.mDisabled = true;
|
||||
}
|
||||
|
@ -618,7 +650,7 @@ namespace IDE.ui
|
|||
{
|
||||
if ((mConfigNames.Contains(configName)) && (mPlatformNames.Contains(platformName)))
|
||||
{
|
||||
if (mPropPage == mUntargetedConfigData.mPropPages[categoryType])
|
||||
if (mPropPage == mMultiTargetConfigData.mPropPages[categoryType])
|
||||
{
|
||||
RemovePropPage();
|
||||
}
|
||||
|
@ -637,7 +669,7 @@ namespace IDE.ui
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!IsCategoryTargeted(categoryType))
|
||||
if (GetCategoryTargetedKind(categoryType) == .None)
|
||||
RemovePropPage();
|
||||
}
|
||||
|
||||
|
|
|
@ -831,13 +831,8 @@ namespace IDE.ui
|
|||
|
||||
public ~this()
|
||||
{
|
||||
//if (mOwnsWatchSeriesInfo)
|
||||
//delete mWatchSeriesInfo;
|
||||
if (mWatchSeriesInfo != null)
|
||||
{
|
||||
// Why were we setting these to null here? This caused the buttons to stay in the widget hierarchy when we scrolled a virtual listview around (since old items got deleted)
|
||||
//mWatchSeriesInfo.mLessButton = null;
|
||||
//mWatchSeriesInfo.mMoreButton = null;
|
||||
{
|
||||
mWatchSeriesInfo.ReleaseRef();
|
||||
}
|
||||
}
|
||||
|
@ -1210,7 +1205,8 @@ namespace IDE.ui
|
|||
lastValidListViewItem = watchListViewItem;
|
||||
}
|
||||
|
||||
if (mWatchSeriesInfo.mAddrs != null)
|
||||
// This caused 'closing' opened items with Dictionay elements when stepping
|
||||
/*if (mWatchSeriesInfo.mAddrs != null)
|
||||
{
|
||||
int32 checkIdx = mWatchSeriesInfo.mStartMemberIdx + 1;
|
||||
while (checkIdx < mParentItem.mChildItems.Count)
|
||||
|
@ -1220,7 +1216,7 @@ namespace IDE.ui
|
|||
break;
|
||||
mParentItem.RemoveChildItem(watchListViewItem);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
|
|
|
@ -118,16 +118,16 @@ namespace IDE.ui
|
|||
}
|
||||
#endif
|
||||
|
||||
protected override bool IsCategoryTargeted(int32 categoryTypeInt)
|
||||
protected override TargetedKind GetCategoryTargetedKind(int32 categoryTypeInt)
|
||||
{
|
||||
switch ((CategoryType)categoryTypeInt)
|
||||
{
|
||||
case .General,
|
||||
.Targeted,
|
||||
//.Targeted,
|
||||
.Beef_Global:
|
||||
return false;
|
||||
return .None;
|
||||
default:
|
||||
return true;
|
||||
return .Config;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,41 +351,49 @@ namespace IDE.ui
|
|||
|
||||
protected override void CreateNewPlatform(String name)
|
||||
{
|
||||
var workspace = IDEApp.sApp.mWorkspace;
|
||||
var workspace = gApp.mWorkspace;
|
||||
|
||||
using (workspace.mMonitor.Enter())
|
||||
{
|
||||
String useName = scope String(name);
|
||||
useName.Trim();
|
||||
if (!useName.IsEmpty)
|
||||
String platformName = scope String(name);
|
||||
platformName.Trim();
|
||||
if (!platformName.IsEmpty)
|
||||
{
|
||||
for (var workspaceConfig in workspace.mConfigs.Values)
|
||||
/*for (var workspaceConfig in workspace.mConfigs)
|
||||
{
|
||||
Workspace.Options workspaceOptions = new Workspace.Options();
|
||||
workspaceConfig.mPlatforms[new String(useName)] = workspaceOptions;
|
||||
if (!workspaceConfig.value.mPlatforms.ContainsKey(useName))
|
||||
{
|
||||
Workspace.Options workspaceOptions = new Workspace.Options();
|
||||
workspace.SetupDefault(workspaceOptions, workspaceConfig.key, useName);
|
||||
workspaceConfig.value.mPlatforms[new String(useName)] = workspaceOptions;
|
||||
}
|
||||
}
|
||||
|
||||
for (var project in workspace.mProjects)
|
||||
{
|
||||
for (var projectConfig in project.mConfigs.Values)
|
||||
for (var projectConfigKV in project.mConfigs)
|
||||
{
|
||||
let projectConfig = projectConfigKV.value;
|
||||
if (!projectConfig.mPlatforms.ContainsKey(useName))
|
||||
{
|
||||
Project.Options projectOptions = new Project.Options();
|
||||
projectConfig.mPlatforms[new String(useName)] = projectOptions;
|
||||
project.SetChanged();
|
||||
project.CreateConfig(projectConfigKV.key, useName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
IDEApp.sApp.mWorkspace.SetChanged();
|
||||
SelectPlatform(useName);
|
||||
//IDEApp.sApp.mWorkspace.SetChanged();
|
||||
gApp.mWorkspace.FixOptionsForPlatform(platformName);
|
||||
SelectPlatform(platformName);
|
||||
|
||||
gApp.mWorkspace.MarkPlatformNamesDirty();
|
||||
if (!gApp.mWorkspace.mUserPlatforms.Contains(platformName))
|
||||
gApp.mWorkspace.mUserPlatforms.Add(new String(platformName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ShowPropPage(int32 categoryTypeInt)
|
||||
{
|
||||
{
|
||||
base.ShowPropPage(categoryTypeInt);
|
||||
|
||||
var configName = mConfigNames[0];
|
||||
|
@ -414,7 +422,7 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
ConfigDataGroup targetedConfigData;
|
||||
if ((IsCategoryTargeted(categoryTypeInt)) &&
|
||||
if ((GetCategoryTargetedKind(categoryTypeInt) != .None) &&
|
||||
((mConfigNames.Count == 1) && (mPlatformNames.Count == 1)))
|
||||
{
|
||||
var key = Tuple<String, String>(configName, platformName);
|
||||
|
@ -431,15 +439,15 @@ namespace IDE.ui
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mUntargetedConfigData == null)
|
||||
if (mMultiTargetConfigData == null)
|
||||
{
|
||||
mUntargetedConfigData = new ConfigDataGroup((int32)CategoryType.COUNT);
|
||||
mConfigDatas.Add(mUntargetedConfigData);
|
||||
mMultiTargetConfigData = new ConfigDataGroup((int32)CategoryType.COUNT);
|
||||
mConfigDatas.Add(mMultiTargetConfigData);
|
||||
//Debug.WriteLine("Creating ConfigDataGroup {0} in {1}", mUntargetedConfigData, this);
|
||||
}
|
||||
targetedConfigData = mUntargetedConfigData;
|
||||
targetedConfigData = mMultiTargetConfigData;
|
||||
|
||||
if (IsCategoryTargeted(categoryTypeInt))
|
||||
if (GetCategoryTargetedKind(categoryTypeInt) != .None)
|
||||
{
|
||||
DeleteAndNullify!(targetedConfigData.mPropPages[categoryTypeInt]);
|
||||
}
|
||||
|
@ -877,7 +885,7 @@ namespace IDE.ui
|
|||
if (workspaceProperties == this)
|
||||
continue;
|
||||
|
||||
if (IsCategoryTargeted(propPage.mCategoryType))
|
||||
if (GetCategoryTargetedKind(propPage.mCategoryType) != .None)
|
||||
{
|
||||
if (mPropPage == propPage)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue