mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed some auto-include/ignore project item issues
This commit is contained in:
parent
b42c84b4bd
commit
5d9a5f183d
3 changed files with 64 additions and 35 deletions
|
@ -8225,8 +8225,16 @@ namespace IDE
|
||||||
|
|
||||||
public bool IsProjectSourceEnabled(ProjectSource projectSource)
|
public bool IsProjectSourceEnabled(ProjectSource projectSource)
|
||||||
{
|
{
|
||||||
if (projectSource.mIncludeKind == .Ignore)
|
ProjectItem checkItem = projectSource;
|
||||||
return false;
|
while (checkItem != null)
|
||||||
|
{
|
||||||
|
if (checkItem.mIncludeKind == .Manual)
|
||||||
|
break;
|
||||||
|
if (checkItem.mIncludeKind == .Ignore)
|
||||||
|
return false;
|
||||||
|
checkItem = checkItem.mParentFolder;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsProjectEnabled(projectSource.mProject))
|
if (!IsProjectEnabled(projectSource.mProject))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -12204,7 +12212,7 @@ namespace IDE
|
||||||
{
|
{
|
||||||
if (projectItem.mIncludeKind == .Auto)
|
if (projectItem.mIncludeKind == .Auto)
|
||||||
{
|
{
|
||||||
mProjectPanel?.DoDeleteItem(listViewItem, null, true);
|
mProjectPanel?.DoDeleteItem(listViewItem, null, .ForceRemove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (changeType == .FileCreated)
|
else if (changeType == .FileCreated)
|
||||||
|
|
|
@ -38,11 +38,11 @@ namespace IDE
|
||||||
public String mName = new String() ~ delete _;
|
public String mName = new String() ~ delete _;
|
||||||
public String mComment = new String() ~ delete _;
|
public String mComment = new String() ~ delete _;
|
||||||
|
|
||||||
public bool IncludeInMap
|
public virtual bool IncludeInMap
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return mIncludeKind != .Manual;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +114,18 @@ namespace IDE
|
||||||
public String mPath ~ delete _;
|
public String mPath ~ delete _;
|
||||||
public bool mIsWatching;
|
public bool mIsWatching;
|
||||||
|
|
||||||
|
public override bool IncludeInMap
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((mPath == null) || (mParentFolder.mPath == null))
|
||||||
|
return true;
|
||||||
|
String dirPath = scope .();
|
||||||
|
Path.GetDirectoryPath(mPath, dirPath);
|
||||||
|
return Path.Equals(dirPath, mParentFolder.mPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public this()
|
public this()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -2010,10 +2022,12 @@ namespace IDE
|
||||||
if (!IsSingleFile)
|
if (!IsSingleFile)
|
||||||
{
|
{
|
||||||
mRootFolder.mPath = new String("src");
|
mRootFolder.mPath = new String("src");
|
||||||
if (Directory.Exists(scope String(mProjectDir, "/src")))
|
using (data.Open("ProjectFolder"))
|
||||||
|
mRootFolder.Deserialize(data);
|
||||||
|
/*if (Directory.Exists(scope String(mProjectDir, "/src")))
|
||||||
{
|
{
|
||||||
mRootFolder.Populate("src");
|
mRootFolder.Populate("src");
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2028,10 +2042,11 @@ namespace IDE
|
||||||
srcFile.mPath = new String(CompositeFile.sMainFileName);
|
srcFile.mPath = new String(CompositeFile.sMainFileName);
|
||||||
srcFile.mName.Set(CompositeFile.sMainFileName);
|
srcFile.mName.Set(CompositeFile.sMainFileName);
|
||||||
mRootFolder.AddChild(srcFile);
|
mRootFolder.AddChild(srcFile);
|
||||||
|
|
||||||
|
using (data.Open("ProjectFolder"))
|
||||||
|
mRootFolder.Deserialize(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (data.Open("ProjectFolder"))
|
|
||||||
mRootFolder.Deserialize(data);
|
|
||||||
mRootFolder.StartWatching();
|
mRootFolder.StartWatching();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -354,6 +354,7 @@ namespace IDE.ui
|
||||||
public ProjectListViewItem AddProjectItem(ProjectItem projectItem, ProjectListViewItem existingListViewItem = null)
|
public ProjectListViewItem AddProjectItem(ProjectItem projectItem, ProjectListViewItem existingListViewItem = null)
|
||||||
{
|
{
|
||||||
var projectSource = projectItem as ProjectSource;
|
var projectSource = projectItem as ProjectSource;
|
||||||
|
|
||||||
ProjectListViewItem listViewItem = null;
|
ProjectListViewItem listViewItem = null;
|
||||||
if ((projectSource != null) && (gApp.IsProjectSourceEnabled(projectSource)))
|
if ((projectSource != null) && (gApp.IsProjectSourceEnabled(projectSource)))
|
||||||
{
|
{
|
||||||
|
@ -474,10 +475,14 @@ namespace IDE.ui
|
||||||
projectSource.mProject = projectFolder.mProject;
|
projectSource.mProject = projectFolder.mProject;
|
||||||
projectSource.mName.Set(fileName);
|
projectSource.mName.Set(fileName);
|
||||||
|
|
||||||
projectSource.mPath = new String();
|
//if (projectFolder.mPath != null)
|
||||||
projectSource.mPath.Append(projectFolder.mPath);
|
{
|
||||||
projectSource.mPath.Append("/");
|
projectSource.mPath = new String();
|
||||||
projectSource.mPath.Append(fileName);
|
projectSource.mPath.Append(projectFolder.mPath);
|
||||||
|
projectSource.mPath.Append("/");
|
||||||
|
projectSource.mPath.Append(fileName);
|
||||||
|
}
|
||||||
|
projectSource.mIncludeKind = .Auto;
|
||||||
projectFolder.AddChild(projectSource);
|
projectFolder.AddChild(projectSource);
|
||||||
|
|
||||||
AddProjectItem(projectSource);
|
AddProjectItem(projectSource);
|
||||||
|
@ -521,6 +526,7 @@ namespace IDE.ui
|
||||||
childProjectFolder.mPath.Append("/");
|
childProjectFolder.mPath.Append("/");
|
||||||
childProjectFolder.mPath.Append(dirName);
|
childProjectFolder.mPath.Append(dirName);
|
||||||
childProjectFolder.mAutoInclude = true;
|
childProjectFolder.mAutoInclude = true;
|
||||||
|
childProjectFolder.mIncludeKind = .Auto;
|
||||||
projectFolder.AddChild(childProjectFolder);
|
projectFolder.AddChild(childProjectFolder);
|
||||||
|
|
||||||
if (clearAutoItems)
|
if (clearAutoItems)
|
||||||
|
@ -549,7 +555,7 @@ namespace IDE.ui
|
||||||
((clearAutoItems) && (child.mIncludeKind == .Auto) && (!foundAutoItems.Contains(child))))
|
((clearAutoItems) && (child.mIncludeKind == .Auto) && (!foundAutoItems.Contains(child))))
|
||||||
{
|
{
|
||||||
var listItem = mProjectToListViewMap[child];
|
var listItem = mProjectToListViewMap[child];
|
||||||
DoDeleteItem(listItem, null, true);
|
DoDeleteItem(listItem, null, .ForceRemove);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1144,13 +1150,13 @@ namespace IDE.ui
|
||||||
var projectSource = projectItem as ProjectSource;
|
var projectSource = projectItem as ProjectSource;
|
||||||
if (projectSource != null)
|
if (projectSource != null)
|
||||||
{
|
{
|
||||||
bool isProjectEnabled = gApp.IsProjectSourceEnabled(projectSource);
|
bool isProjectSourceEnabled = gApp.IsProjectSourceEnabled(projectSource);
|
||||||
|
|
||||||
String fullPath = scope String();
|
String fullPath = scope String();
|
||||||
projectSource.GetFullImportPath(fullPath);
|
projectSource.GetFullImportPath(fullPath);
|
||||||
gApp.mWorkspace.mForceNextCompile = true;
|
gApp.mWorkspace.mForceNextCompile = true;
|
||||||
|
|
||||||
if ((IDEApp.IsBeefFile(fullPath)) && (isProjectEnabled))
|
if ((IDEApp.IsBeefFile(fullPath)) && (isProjectSourceEnabled))
|
||||||
{
|
{
|
||||||
var compilers = scope List<BfCompiler>();
|
var compilers = scope List<BfCompiler>();
|
||||||
IDEApp.sApp.GetBfCompilers(compilers);
|
IDEApp.sApp.GetBfCompilers(compilers);
|
||||||
|
@ -1179,7 +1185,7 @@ namespace IDE.ui
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isProjectEnabled)
|
if (isProjectSourceEnabled)
|
||||||
{
|
{
|
||||||
if (isRemovingProjectSource)
|
if (isRemovingProjectSource)
|
||||||
{
|
{
|
||||||
|
@ -1196,7 +1202,14 @@ namespace IDE.ui
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoDeleteItem(ListViewItem listItem, delegate bool(String path) deletePathFunc, bool forceRemove = false)
|
enum DeleteItemKind
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
ForceRemove,
|
||||||
|
Ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoDeleteItem(ListViewItem listItem, delegate bool(String path) deletePathFunc, DeleteItemKind deleteKind = .Normal)
|
||||||
{
|
{
|
||||||
var projectItemRoot = mListViewToProjectMap[listItem];
|
var projectItemRoot = mListViewToProjectMap[listItem];
|
||||||
var projectItem = projectItemRoot;
|
var projectItem = projectItemRoot;
|
||||||
|
@ -1228,7 +1241,12 @@ namespace IDE.ui
|
||||||
if (listItem.mChildItems != null)
|
if (listItem.mChildItems != null)
|
||||||
{
|
{
|
||||||
for (int childIdx = listItem.mChildItems.Count - 1; childIdx >= 0; childIdx--)
|
for (int childIdx = listItem.mChildItems.Count - 1; childIdx >= 0; childIdx--)
|
||||||
DoDeleteItem(listItem.mChildItems[childIdx], deletePathFunc, true);
|
{
|
||||||
|
var childDeleteKind = deleteKind;
|
||||||
|
if (childDeleteKind == .Normal)
|
||||||
|
childDeleteKind = .ForceRemove;
|
||||||
|
DoDeleteItem(listItem.mChildItems[childIdx], deletePathFunc, childDeleteKind);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projectItem == null)
|
if (projectItem == null)
|
||||||
|
@ -1236,7 +1254,7 @@ namespace IDE.ui
|
||||||
|
|
||||||
bool doReleaseRef = false;
|
bool doReleaseRef = false;
|
||||||
bool didRemove = false;
|
bool didRemove = false;
|
||||||
if ((forceRemove) || (projectItem.mParentFolder == null) || (projectItem.mParentFolder.mIncludeKind == .Manual) || (projectItem.mIncludeKind == .Manual) || (deletePathFunc != null))
|
if ((deleteKind == .ForceRemove) || (projectItem.mParentFolder == null) || (projectItem.mParentFolder.mIncludeKind == .Manual) || (projectItem.mIncludeKind == .Manual) || (deletePathFunc != null))
|
||||||
{
|
{
|
||||||
bool doRemove = true;
|
bool doRemove = true;
|
||||||
|
|
||||||
|
@ -1267,17 +1285,6 @@ namespace IDE.ui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Mark item as ignored - note, this was removed at some point. Why? Did this trigger some bug?
|
|
||||||
ProjectItem.IncludeKind includeKind = .Ignore;
|
|
||||||
if (projectItem.mParentFolder.mIncludeKind == .Ignore)
|
|
||||||
includeKind = .Auto;
|
|
||||||
|
|
||||||
if (projectItem.mIncludeKind != includeKind)
|
|
||||||
{
|
|
||||||
projectItem.mIncludeKind = includeKind;
|
|
||||||
projectItem.mProject.SetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (let projectSource = projectItem as ProjectSource)
|
if (let projectSource = projectItem as ProjectSource)
|
||||||
{
|
{
|
||||||
String path = scope .();
|
String path = scope .();
|
||||||
|
@ -2124,11 +2131,10 @@ namespace IDE.ui
|
||||||
{
|
{
|
||||||
ProjectItem projectItem;
|
ProjectItem projectItem;
|
||||||
mListViewToProjectMap.TryGetValue(selectedItem, out projectItem);
|
mListViewToProjectMap.TryGetValue(selectedItem, out projectItem);
|
||||||
DoDeleteItem(selectedItem, null);
|
DoDeleteItem(selectedItem, null, .Ignore);
|
||||||
if (projectItem != null)
|
if (projectItem != null)
|
||||||
{
|
{
|
||||||
//ProjectItemUnregister(projectItem);
|
projectItem.mIncludeKind = .Ignore;
|
||||||
projectItem.mIncludeKind = .Ignore;
|
|
||||||
projectItem.mProject.SetChanged();
|
projectItem.mProject.SetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2214,7 +2220,7 @@ namespace IDE.ui
|
||||||
if (childItem.mIncludeKind == .Auto)
|
if (childItem.mIncludeKind == .Auto)
|
||||||
{
|
{
|
||||||
let listViewItem = (ProjectListViewItem)mProjectToListViewMap[childItem];
|
let listViewItem = (ProjectListViewItem)mProjectToListViewMap[childItem];
|
||||||
DoDeleteItem(listViewItem, null, true);
|
DoDeleteItem(listViewItem, null, .ForceRemove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue