mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-25 02:58:02 +02:00
Initial package management support
This commit is contained in:
parent
78138f5c5a
commit
4870c6fdd8
19 changed files with 2520 additions and 205 deletions
|
@ -10,6 +10,87 @@ namespace IDE.ui
|
|||
|
||||
class BuildPropertiesDialog : TargetedPropertiesDialog
|
||||
{
|
||||
protected class DependencyEntry : IEquatable, IMultiValued
|
||||
{
|
||||
public bool mUse;
|
||||
public String mURL ~ delete _;
|
||||
public String mVersion ~ delete _;
|
||||
|
||||
public this()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ~this()
|
||||
{
|
||||
}
|
||||
|
||||
public this(DependencyEntry val)
|
||||
{
|
||||
mUse = val.mUse;
|
||||
if (val.mURL != null)
|
||||
mURL = new .(val.mURL);
|
||||
if (val.mVersion != null)
|
||||
mVersion = new .(val.mVersion);
|
||||
}
|
||||
|
||||
public bool Equals(Object val)
|
||||
{
|
||||
if (var rhsDE = val as DependencyEntry)
|
||||
{
|
||||
return
|
||||
(mUse == rhsDE.mUse) &&
|
||||
(mURL == rhsDE.mURL) &&
|
||||
(mVersion == rhsDE.mVersion);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void GetValue(int idx, String outValue)
|
||||
{
|
||||
if ((idx == 1) && (mURL != null))
|
||||
outValue.Set(mURL);
|
||||
if ((idx == 2) && (mVersion != null))
|
||||
outValue.Set(mVersion);
|
||||
}
|
||||
|
||||
public bool SetValue(int idx, StringView value)
|
||||
{
|
||||
if (idx == 1)
|
||||
{
|
||||
if (value.IsEmpty)
|
||||
{
|
||||
DeleteAndNullify!(mURL);
|
||||
}
|
||||
else
|
||||
{
|
||||
String.NewOrSet!(mURL, value);
|
||||
mURL.Trim();
|
||||
}
|
||||
}
|
||||
if (idx == 2)
|
||||
{
|
||||
if (value.IsEmpty)
|
||||
{
|
||||
DeleteAndNullify!(mVersion);
|
||||
}
|
||||
else
|
||||
{
|
||||
String.NewOrSet!(mVersion, value);
|
||||
mVersion.Trim();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Set(DependencyEntry value)
|
||||
{
|
||||
mUse = value.mUse;
|
||||
SetValue(1, value.mURL);
|
||||
SetValue(2, value.mVersion);
|
||||
}
|
||||
}
|
||||
|
||||
protected class DistinctOptionBuilder
|
||||
{
|
||||
BuildPropertiesDialog mDialog;
|
||||
|
|
|
@ -145,6 +145,7 @@ namespace IDE.ui
|
|||
bool mImportFolderDeferred;
|
||||
bool mImportProjectDeferred;
|
||||
bool mImportInstalledDeferred;
|
||||
bool mImportRemoteDeferred;
|
||||
public Dictionary<ListViewItem, ProjectItem> mListViewToProjectMap = new .() ~ delete _;
|
||||
public Dictionary<ProjectItem, ProjectListViewItem> mProjectToListViewMap = new .() ~ delete _;
|
||||
public Dictionary<ListViewItem, WorkspaceFolder> mListViewToWorkspaceFolderMap = new .() ~ delete _;
|
||||
|
@ -2904,6 +2905,15 @@ namespace IDE.ui
|
|||
#endif
|
||||
}
|
||||
|
||||
void ImportRemoteProject()
|
||||
{
|
||||
#if !CLI
|
||||
RemoteProjectDialog dialog = new .();
|
||||
dialog.Init();
|
||||
dialog.PopupWindow(gApp.mMainWindow);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void ShowProjectProperties(Project project)
|
||||
{
|
||||
var projectProperties = new ProjectProperties(project);
|
||||
|
@ -3081,6 +3091,14 @@ namespace IDE.ui
|
|||
});
|
||||
if (gApp.IsCompiling)
|
||||
anItem.SetDisabled(true);
|
||||
|
||||
anItem = menu.AddItem("Add From Remote...");
|
||||
anItem.mOnMenuItemSelected.Add(new (item) => {
|
||||
mImportRemoteDeferred = true;
|
||||
});
|
||||
if (gApp.IsCompiling)
|
||||
anItem.SetDisabled(true);
|
||||
|
||||
anItem = menu.AddItem("New Folder");
|
||||
anItem.mOnMenuItemSelected.Add(new (item) => {
|
||||
var workspaceFolder = GetSelectedWorkspaceFolder();
|
||||
|
@ -3110,7 +3128,18 @@ namespace IDE.ui
|
|||
}
|
||||
else if (gApp.mWorkspace.IsInitialized)
|
||||
{
|
||||
var item = menu.AddItem("Update Version Locks");
|
||||
item.mDisabled = gApp.mWorkspace.mProjectLockMap.IsEmpty;
|
||||
item.mOnMenuItemSelected.Add(new (item) =>
|
||||
{
|
||||
List<StringView> projectNames = scope .();
|
||||
for (var projectName in gApp.mWorkspace.mProjectLockMap.Keys)
|
||||
projectNames.Add(projectName);
|
||||
gApp.UpdateProjectVersionLocks(params (Span<StringView>)projectNames);
|
||||
});
|
||||
|
||||
AddOpenContainingFolder();
|
||||
|
||||
menu.AddItem();
|
||||
|
||||
AddWorkspaceMenuItems();
|
||||
|
@ -3140,7 +3169,7 @@ namespace IDE.ui
|
|||
{
|
||||
var projectItem = GetSelectedProjectItem();
|
||||
if (projectItem != null)
|
||||
gApp.RetryProjectLoad(projectItem.mProject);
|
||||
gApp.RetryProjectLoad(projectItem.mProject, true);
|
||||
});
|
||||
menu.AddItem();
|
||||
//handled = true;
|
||||
|
@ -3168,6 +3197,18 @@ namespace IDE.ui
|
|||
SetAsStartupProject(projectItem.mProject);
|
||||
});
|
||||
|
||||
item = menu.AddItem("Update Version Lock");
|
||||
item.mDisabled = (projectItem == null) || (!gApp.mWorkspace.mProjectLockMap.ContainsKey(projectItem.mProject.mProjectName));
|
||||
item.mOnMenuItemSelected.Add(new (item) =>
|
||||
{
|
||||
var projectItem = GetSelectedProjectItem();
|
||||
if (projectItem != null)
|
||||
{
|
||||
let project = projectItem.mProject;
|
||||
gApp.UpdateProjectVersionLocks(project.mProjectName);
|
||||
}
|
||||
});
|
||||
|
||||
item = menu.AddItem("Lock Project");
|
||||
if (projectItem.mProject.mLocked)
|
||||
item.mIconImage = DarkTheme.sDarkTheme.GetImage(.Check);
|
||||
|
@ -3570,6 +3611,12 @@ namespace IDE.ui
|
|||
ImportInstalledProject();
|
||||
}
|
||||
|
||||
if (mImportRemoteDeferred)
|
||||
{
|
||||
mImportRemoteDeferred= false;
|
||||
ImportRemoteProject();
|
||||
}
|
||||
|
||||
ValidateCutClipboard();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,12 @@ using Beefy.events;
|
|||
using Beefy.theme.dark;
|
||||
using Beefy.gfx;
|
||||
using Beefy.geom;
|
||||
using IDE.Util;
|
||||
|
||||
namespace IDE.ui
|
||||
{
|
||||
public class ProjectProperties : BuildPropertiesDialog
|
||||
{
|
||||
ValueContainer<String> mVC;
|
||||
|
||||
enum CategoryType
|
||||
{
|
||||
General, ///
|
||||
|
@ -27,6 +26,7 @@ namespace IDE.ui
|
|||
Dependencies,
|
||||
Beef_Global,
|
||||
Platform,
|
||||
Managed,
|
||||
|
||||
Targeted, ///
|
||||
Beef_Targeted,
|
||||
|
@ -36,10 +36,11 @@ namespace IDE.ui
|
|||
|
||||
COUNT
|
||||
}
|
||||
|
||||
|
||||
public Project mProject;
|
||||
Dictionary<String, ValueContainer<bool>> mDependencyValuesMap ~ DeleteDictionaryAndKeysAndValues!(_);
|
||||
Dictionary<String, DependencyEntry> mDependencyValuesMap ~ DeleteDictionaryAndKeysAndValues!(_);
|
||||
Project.Options[] mCurProjectOptions ~ delete _;
|
||||
List<String> mUpdateProjectLocks = new .() ~ DeleteContainerAndItems!(_);
|
||||
float mLockFlashPct;
|
||||
public int32 mNewDebugSessionCountdown;
|
||||
|
||||
|
@ -96,6 +97,7 @@ namespace IDE.ui
|
|||
AddCategoryItem(globalItem, "Dependencies");
|
||||
AddCategoryItem(globalItem, "Beef");
|
||||
AddCategoryItem(globalItem, "Platform");
|
||||
AddCategoryItem(globalItem, "Managed");
|
||||
globalItem.Open(true, true);
|
||||
|
||||
var targetedItem = AddCategoryItem(root, "Targeted");
|
||||
|
@ -149,7 +151,8 @@ namespace IDE.ui
|
|||
case .General,
|
||||
.Project,
|
||||
.Dependencies,
|
||||
.Beef_Global:
|
||||
.Beef_Global,
|
||||
.Managed:
|
||||
return .None;
|
||||
case .Platform:
|
||||
return .Platform;
|
||||
|
@ -432,6 +435,7 @@ namespace IDE.ui
|
|||
default:
|
||||
}
|
||||
}
|
||||
case .Managed:
|
||||
case .Build, .Debugging, .Beef_Targeted:
|
||||
DeleteDistinctBuildOptions();
|
||||
DistinctBuildOptions defaultTypeOptions = scope:: .();
|
||||
|
@ -530,7 +534,9 @@ namespace IDE.ui
|
|||
else
|
||||
{
|
||||
mCurPropertiesTargets = new Object[1];
|
||||
if (categoryType == .Project)
|
||||
if (categoryType == .Managed)
|
||||
mCurPropertiesTargets[0] = mProject.mManagedInfo;
|
||||
else if (categoryType == .Project)
|
||||
mCurPropertiesTargets[0] = mProject.mGeneralOptions;
|
||||
else if (categoryType == .Beef_Global)
|
||||
mCurPropertiesTargets[0] = mProject.mBeefGlobalOptions;
|
||||
|
@ -600,6 +606,8 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (categoryType == CategoryType.Managed)
|
||||
PopulateManagedOptions();
|
||||
else if (categoryType == CategoryType.Build)
|
||||
PopulateBuildOptions();
|
||||
else if (categoryType == CategoryType.Beef_Global )
|
||||
|
@ -619,6 +627,8 @@ namespace IDE.ui
|
|||
void PopulateGeneralOptions()
|
||||
{
|
||||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (listViewItem, propEntry) = AddPropertiesItem(root, "Project Name", "mProjectNameDecl");
|
||||
AddPropertiesItem(root, "Project Name Aliases", "mAliases");
|
||||
AddPropertiesItem(root, "Target Type", "mTargetType", scope String[]
|
||||
(
|
||||
"Console Application",
|
||||
|
@ -627,9 +637,21 @@ namespace IDE.ui
|
|||
"Custom Build",
|
||||
"Test"
|
||||
));
|
||||
AddPropertiesItem(root, "Project Name Aliases", "mAliases");
|
||||
AddPropertiesItem(root, "Version", "mVersion.mVersion");
|
||||
}
|
||||
|
||||
void PopulateManagedOptions()
|
||||
{
|
||||
if (mCurPropertiesTargets[0] == null)
|
||||
return;
|
||||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var (listViewItem, propEntry) = AddPropertiesItem(root, "Version", "mVersion.mVersion");
|
||||
propEntry.mReadOnly = true;
|
||||
(listViewItem, propEntry) = AddPropertiesItem(root, "Info", "mInfo");
|
||||
propEntry.mAllowMultiline = true;
|
||||
propEntry.mReadOnly = true;
|
||||
}
|
||||
|
||||
void PopulateWindowsOptions()
|
||||
{
|
||||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
|
@ -696,7 +718,21 @@ namespace IDE.ui
|
|||
|
||||
void PopulateDependencyOptions()
|
||||
{
|
||||
mDependencyValuesMap = new Dictionary<String, ValueContainer<bool>>();
|
||||
mPropPage.mPropertiesListView.mColumns[0].Label = "Project";
|
||||
mPropPage.mPropertiesListView.mColumns[0].mMinWidth = GS!(100);
|
||||
mPropPage.mPropertiesListView.mColumns[0].mWidth = GS!(180);
|
||||
|
||||
mPropPage.mPropertiesListView.mColumns[1].Label = "";
|
||||
mPropPage.mPropertiesListView.mColumns[1].mMinWidth = GS!(20);
|
||||
mPropPage.mPropertiesListView.mColumns[1].mWidth = GS!(20);
|
||||
|
||||
mPropPage.mPropertiesListView.AddColumn(180, "Remote URL");
|
||||
mPropPage.mPropertiesListView.mColumns[2].mMinWidth = GS!(100);
|
||||
|
||||
mPropPage.mPropertiesListView.AddColumn(180, "Ver Constraint");
|
||||
mPropPage.mPropertiesListView.mColumns[3].mMinWidth = GS!(100);
|
||||
|
||||
mDependencyValuesMap = new .();
|
||||
|
||||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var category = root;
|
||||
|
@ -719,63 +755,184 @@ namespace IDE.ui
|
|||
projectNames.Sort(scope (a, b) => String.Compare(a, b, true));
|
||||
|
||||
for (var projectName in projectNames)
|
||||
{
|
||||
var dependencyContainer = new ValueContainer<bool>();
|
||||
dependencyContainer.mValue = mProject.HasDependency(projectName, false);
|
||||
mDependencyValuesMap[new String(projectName)] = dependencyContainer;
|
||||
{
|
||||
var project = gApp.mWorkspace.FindProject(projectName);
|
||||
|
||||
var dependencyEntry = new DependencyEntry();
|
||||
var verSpec = mProject.GetDependency(projectName, false);
|
||||
if (verSpec != null)
|
||||
{
|
||||
dependencyEntry.mUse = true;
|
||||
if (verSpec case .Git(let url, let ver))
|
||||
{
|
||||
dependencyEntry.mURL = new .(url);
|
||||
if (ver != null)
|
||||
dependencyEntry.mVersion = new .(ver.mVersion);
|
||||
}
|
||||
}
|
||||
mDependencyValuesMap[new String(projectName)] = dependencyEntry;
|
||||
|
||||
var (listViewItem, propItem) = AddPropertiesItem(category, projectName);
|
||||
if (IDEApp.sApp.mWorkspace.FindProject(projectName) == null)
|
||||
listViewItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFFF6060);
|
||||
|
||||
var subItem = listViewItem.CreateSubItem(1);
|
||||
var subItem = (DarkListViewItem)listViewItem.CreateSubItem(1);
|
||||
|
||||
var checkbox = new DarkCheckBox();
|
||||
checkbox.Checked = dependencyContainer.mValue;
|
||||
checkbox.Checked = dependencyEntry.mUse;
|
||||
checkbox.Resize(0, 0, DarkTheme.sUnitSize, DarkTheme.sUnitSize);
|
||||
subItem.AddWidget(checkbox);
|
||||
|
||||
PropEntry[] propEntries = new PropEntry[1];
|
||||
|
||||
PropEntry propEntry = new PropEntry();
|
||||
propEntry.mTarget = dependencyContainer;
|
||||
//propEntry.mFieldInfo = dependencyContainer.GetType().GetField("mValue").Value;
|
||||
propEntry.mOrigValue = Variant.Create(dependencyContainer.mValue);
|
||||
propEntry.mCurValue = propEntry.mOrigValue;
|
||||
propEntry.mTarget = dependencyEntry;
|
||||
propEntry.mOrigValue = Variant.Create(dependencyEntry);
|
||||
propEntry.mCurValue = Variant.Create(new DependencyEntry(dependencyEntry), true);
|
||||
|
||||
propEntry.mListViewItem = listViewItem;
|
||||
propEntry.mCheckBox = checkbox;
|
||||
propEntry.mApplyAction = new () =>
|
||||
{
|
||||
if (propEntry.mCurValue.Get<bool>())
|
||||
bool updateProjectLock = false;
|
||||
|
||||
var dependencyEntry = propEntry.mCurValue.Get<DependencyEntry>();
|
||||
if (dependencyEntry.mUse)
|
||||
{
|
||||
if (!mProject.HasDependency(listViewItem.mLabel))
|
||||
VerSpec verSpec = default;
|
||||
if (dependencyEntry.mURL != null)
|
||||
verSpec = .Git(new .(dependencyEntry.mURL), (dependencyEntry.mVersion != null) ? new .(dependencyEntry.mVersion) : null);
|
||||
else if (dependencyEntry.mVersion != null)
|
||||
verSpec = .SemVer(new .(dependencyEntry.mVersion));
|
||||
else
|
||||
verSpec = .SemVer(new .("*"));
|
||||
|
||||
var verSpecPtr = mProject.GetDependency(listViewItem.mLabel);
|
||||
if (verSpecPtr == null)
|
||||
{
|
||||
if (verSpec case .Git(let url, let ver))
|
||||
updateProjectLock = true;
|
||||
|
||||
var dep = new Project.Dependency();
|
||||
dep.mProjectName = new String(listViewItem.mLabel);
|
||||
dep.mVerSpec = .SemVer(new .("*"));
|
||||
dep.mVerSpec = verSpec;
|
||||
mProject.mDependencies.Add(dep);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*verSpecPtr != verSpec)
|
||||
{
|
||||
if ((*verSpecPtr case .Git) ||
|
||||
(verSpecPtr case .Git))
|
||||
updateProjectLock = true;
|
||||
verSpecPtr.Dispose();
|
||||
*verSpecPtr = verSpec;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = mProject.mDependencies.FindIndex(scope (dep) => dep.mProjectName == listViewItem.mLabel);
|
||||
if (idx != -1)
|
||||
{
|
||||
var dep = mProject.mDependencies[idx];
|
||||
if (dep.mVerSpec case .Git)
|
||||
updateProjectLock = true;
|
||||
delete mProject.mDependencies[idx];
|
||||
mProject.mDependencies.RemoveAt(idx);
|
||||
}
|
||||
}
|
||||
propEntry.mOrigValue = propEntry.mCurValue;
|
||||
|
||||
var origDependencyEntry = propEntry.mOrigValue.Get<DependencyEntry>();
|
||||
origDependencyEntry.Set(dependencyEntry);
|
||||
|
||||
if (updateProjectLock)
|
||||
mUpdateProjectLocks.Add(new .(listViewItem.Label));
|
||||
};
|
||||
|
||||
checkbox.mOnMouseUp.Add(new (evt) => { PropEntry.DisposeVariant(ref propEntry.mCurValue); propEntry.mCurValue = Variant.Create(checkbox.Checked); });
|
||||
checkbox.mOnMouseUp.Add(new (evt) =>
|
||||
{
|
||||
var dependencyEntry = propEntry.mCurValue.Get<DependencyEntry>();
|
||||
dependencyEntry.mUse = !dependencyEntry.mUse;
|
||||
if (dependencyEntry.mUse)
|
||||
{
|
||||
var projectName = listViewItem.Label;
|
||||
|
||||
for (var projectSpec in gApp.mWorkspace.mProjectSpecs)
|
||||
{
|
||||
if (projectSpec.mProjectName == projectName)
|
||||
{
|
||||
if (projectSpec.mVerSpec case .Git(let url, let ver))
|
||||
{
|
||||
dependencyEntry.SetValue(1, url);
|
||||
dependencyEntry.SetValue(2, ver.mVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
var propEntries = mPropPage.mPropEntries[listViewItem];
|
||||
UpdatePropertyValue(propEntries);
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteAndNullify!(dependencyEntry.mURL);
|
||||
DeleteAndNullify!(dependencyEntry.mVersion);
|
||||
var propEntries = mPropPage.mPropEntries[listViewItem];
|
||||
UpdatePropertyValue(propEntries);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
subItem = (.)listViewItem.GetOrCreateSubItem(2);
|
||||
if (dependencyEntry.mURL != null)
|
||||
subItem.Label = dependencyEntry.mURL;
|
||||
subItem.mOnMouseDown.Add(new => DepPropValueClicked);
|
||||
|
||||
subItem = (.)listViewItem.GetOrCreateSubItem(3);
|
||||
if (dependencyEntry.mVersion != null)
|
||||
{
|
||||
subItem.Label = dependencyEntry.mVersion;
|
||||
if (project != null)
|
||||
{
|
||||
var version = project.Version;
|
||||
if (!version.IsEmpty)
|
||||
{
|
||||
if (!SemVer.IsVersionMatch(version.mVersion, dependencyEntry.mVersion))
|
||||
subItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFFFFF60);
|
||||
}
|
||||
}
|
||||
}
|
||||
subItem.mOnMouseDown.Add(new => DepPropValueClicked);
|
||||
|
||||
propEntries[0] = propEntry;
|
||||
mPropPage.mPropEntries[listViewItem] = propEntries;
|
||||
}
|
||||
}
|
||||
|
||||
protected void DepPropValueClicked(MouseEvent theEvent)
|
||||
{
|
||||
DarkListViewItem clickedItem = (DarkListViewItem)theEvent.mSender;
|
||||
if (clickedItem.mColumnIdx == 0)
|
||||
{
|
||||
clickedItem.mListView.SetFocus();
|
||||
clickedItem.mListView.GetRoot().SelectItemExclusively(clickedItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (theEvent.mX != -1)
|
||||
{
|
||||
clickedItem.mListView.GetRoot().SelectItemExclusively(null);
|
||||
}
|
||||
|
||||
DarkListViewItem item = (DarkListViewItem)clickedItem;
|
||||
DarkListViewItem rootItem = (DarkListViewItem)clickedItem.GetSubItem(0);
|
||||
|
||||
PropEntry[] propertyEntries = mPropPage.mPropEntries[rootItem];
|
||||
if (propertyEntries[0].mDisabled)
|
||||
return;
|
||||
EditValue(item, propertyEntries, clickedItem.mColumnIdx - 1);
|
||||
}
|
||||
|
||||
protected override Object[] PhysAddNewDistinctBuildOptions()
|
||||
{
|
||||
if (mCurProjectOptions == null)
|
||||
|
@ -985,6 +1142,8 @@ namespace IDE.ui
|
|||
/*if (!AssertNotCompilingOrRunning())
|
||||
return false;*/
|
||||
|
||||
String newProjectName = scope .();
|
||||
|
||||
using (mProject.mMonitor.Enter())
|
||||
{
|
||||
for (var targetedConfigData in mConfigDatas)
|
||||
|
@ -1000,9 +1159,18 @@ namespace IDE.ui
|
|||
for (var propEntry in propEntries)
|
||||
{
|
||||
if (propEntry.HasChanged())
|
||||
{
|
||||
configDataHadChange = true;
|
||||
propEntry.ApplyValue();
|
||||
{
|
||||
if ((propEntry.mFieldInfo != default) && (propEntry.mFieldInfo.Name == "mProjectNameDecl"))
|
||||
{
|
||||
var newName = propEntry.mCurValue.Get<String>();
|
||||
newProjectName.Append(newName);
|
||||
newProjectName.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
configDataHadChange = true;
|
||||
propEntry.ApplyValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (propPage == mPropPage)
|
||||
|
@ -1060,6 +1228,9 @@ namespace IDE.ui
|
|||
ClearTargetedData();
|
||||
}
|
||||
|
||||
if (!newProjectName.IsEmpty)
|
||||
gApp.RenameProject(mProject, newProjectName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1081,6 +1252,7 @@ namespace IDE.ui
|
|||
{
|
||||
base.Close();
|
||||
SetWorkspaceData(false);
|
||||
gApp.NotifyProjectVersionLocks(mUpdateProjectLocks);
|
||||
}
|
||||
|
||||
public override void PopupWindow(WidgetWindow parentWindow, float offsetX = 0, float offsetY = 0)
|
||||
|
|
|
@ -114,6 +114,12 @@ namespace IDE.ui
|
|||
|
||||
public class PropertiesDialog : IDEDialog
|
||||
{
|
||||
public interface IMultiValued
|
||||
{
|
||||
void GetValue(int idx, String outValue);
|
||||
bool SetValue(int idx, StringView value);
|
||||
}
|
||||
|
||||
class OwnedStringList : List<String>
|
||||
{
|
||||
|
||||
|
@ -215,6 +221,7 @@ namespace IDE.ui
|
|||
public String mRelPath ~ delete _;
|
||||
public bool mIsTypeWildcard;
|
||||
public bool mAllowMultiline;
|
||||
public bool mReadOnly;
|
||||
public Insets mEditInsets ~ delete _;
|
||||
|
||||
public ~this()
|
||||
|
@ -305,6 +312,18 @@ namespace IDE.ui
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else if (type.IsObject)
|
||||
{
|
||||
var lhsObj = lhs.Get<Object>();
|
||||
var rhsObj = rhs.Get<Object>();
|
||||
|
||||
if ((var lhsEq = lhsObj as IEquatable) && (var rhsEq = rhsObj as IEquatable))
|
||||
{
|
||||
return lhsEq.Equals(rhsEq);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else // Could be an int or enum
|
||||
return Variant.Equals!<int32>(lhs, rhs);
|
||||
}
|
||||
|
@ -815,7 +834,7 @@ namespace IDE.ui
|
|||
|
||||
if (mPropEditWidget != null)
|
||||
{
|
||||
DarkListViewItem editItem = (DarkListViewItem)mEditingListViewItem.GetSubItem(1);
|
||||
DarkListViewItem editItem = (DarkListViewItem)mEditingListViewItem;
|
||||
let propEntry = mEditingProps[0];
|
||||
|
||||
float xPos;
|
||||
|
@ -871,7 +890,7 @@ namespace IDE.ui
|
|||
editWidget.GetText(newValue);
|
||||
newValue.Trim();
|
||||
|
||||
DarkListViewItem item = (DarkListViewItem)mEditingListViewItem;
|
||||
DarkListViewItem rootItem = (DarkListViewItem)mEditingListViewItem.GetSubItem(0);
|
||||
//DarkListViewItem valueItem = (DarkListViewItem)item.GetSubItem(1);
|
||||
|
||||
if (!editWidget.mEditWidgetContent.HasUndoData())
|
||||
|
@ -920,14 +939,14 @@ namespace IDE.ui
|
|||
{
|
||||
//
|
||||
}
|
||||
else if (editingProp.mListViewItem != item)
|
||||
else if (editingProp.mListViewItem != rootItem)
|
||||
{
|
||||
List<String> curEntries = editingProp.mCurValue.Get<List<String>>();
|
||||
List<String> entries = new List<String>(curEntries.GetEnumerator());
|
||||
|
||||
for (int32 childIdx = 0; childIdx < editingProp.mListViewItem.GetChildCount(); childIdx++)
|
||||
{
|
||||
if (item == editingProp.mListViewItem.GetChildAtIndex(childIdx))
|
||||
if (rootItem == editingProp.mListViewItem.GetChildAtIndex(childIdx))
|
||||
{
|
||||
if (childIdx >= entries.Count)
|
||||
entries.Add(new String(newValue));
|
||||
|
@ -1027,6 +1046,11 @@ namespace IDE.ui
|
|||
setValue = false;
|
||||
}
|
||||
}
|
||||
else if ((curVariantType.IsObject) && (var multiValue = prevValue.Get<Object>() as IMultiValued))
|
||||
{
|
||||
multiValue.SetValue(mEditingListViewItem.mColumnIdx - 1, newValue);
|
||||
setValue = false;
|
||||
}
|
||||
else
|
||||
editingProp.mCurValue = Variant.Create(new String(newValue), true);
|
||||
|
||||
|
@ -1247,37 +1271,49 @@ namespace IDE.ui
|
|||
if (ewc.mIsMultiline)
|
||||
editWidget.InitScrollbars(false, true);
|
||||
|
||||
if (propEntry.mReadOnly)
|
||||
editWidget.mEditWidgetContent.mIsReadOnly = true;
|
||||
|
||||
editWidget.mScrollContentInsets.Set(GS!(3), GS!(3), GS!(1), GS!(3));
|
||||
editWidget.Content.mTextInsets.Set(GS!(-3), GS!(2), 0, GS!(2));
|
||||
//editWidget.RehupSize();
|
||||
if (subValueIdx != -1)
|
||||
{
|
||||
List<String> stringList = propEntry.mCurValue.Get<List<String>>();
|
||||
if (subValueIdx < stringList.Count)
|
||||
editWidget.SetText(stringList[subValueIdx]);
|
||||
var obj = propEntry.mCurValue.Get<Object>();
|
||||
if (var multiValued = obj as IMultiValued)
|
||||
{
|
||||
var label = multiValued.GetValue(subValueIdx, .. scope .());
|
||||
editWidget.SetText(label);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<String> stringList = obj as List<String>;
|
||||
if (subValueIdx < stringList.Count)
|
||||
editWidget.SetText(stringList[subValueIdx]);
|
||||
|
||||
MoveItemWidget moveItemWidget;
|
||||
if (subValueIdx > 0)
|
||||
{
|
||||
moveItemWidget = new MoveItemWidget();
|
||||
editWidget.AddWidget(moveItemWidget);
|
||||
moveItemWidget.Resize(6, editWidget.mY - GS!(16), GS!(20), GS!(20));
|
||||
moveItemWidget.mArrowDir = -1;
|
||||
moveItemWidget.mOnMouseDown.Add(new (evt) => { MoveEditingItem(subValueIdx, -1); });
|
||||
if (!ewc.mIsMultiline)
|
||||
editWidget.mOnKeyDown.Add(new (evt) => { if (evt.mKeyCode == KeyCode.Up) MoveEditingItem(subValueIdx, -1); });
|
||||
}
|
||||
MoveItemWidget moveItemWidget;
|
||||
if (subValueIdx > 0)
|
||||
{
|
||||
moveItemWidget = new MoveItemWidget();
|
||||
editWidget.AddWidget(moveItemWidget);
|
||||
moveItemWidget.Resize(6, editWidget.mY - GS!(16), GS!(20), GS!(20));
|
||||
moveItemWidget.mArrowDir = -1;
|
||||
moveItemWidget.mOnMouseDown.Add(new (evt) => { MoveEditingItem(subValueIdx, -1); });
|
||||
if (!ewc.mIsMultiline)
|
||||
editWidget.mOnKeyDown.Add(new (evt) => { if (evt.mKeyCode == KeyCode.Up) MoveEditingItem(subValueIdx, -1); });
|
||||
}
|
||||
|
||||
if (subValueIdx < stringList.Count - 1)
|
||||
{
|
||||
moveItemWidget = new MoveItemWidget();
|
||||
editWidget.AddWidget(moveItemWidget);
|
||||
moveItemWidget.Resize(6, editWidget.mY + GS!(16), GS!(20), GS!(20));
|
||||
moveItemWidget.mArrowDir = 1;
|
||||
moveItemWidget.mOnMouseDown.Add(new (evt) => { MoveEditingItem(subValueIdx, 1); });
|
||||
if (!ewc.mIsMultiline)
|
||||
editWidget.mOnKeyDown.Add(new (evt) => { if (evt.mKeyCode == KeyCode.Down) MoveEditingItem(subValueIdx, 1); });
|
||||
}
|
||||
if (subValueIdx < stringList.Count - 1)
|
||||
{
|
||||
moveItemWidget = new MoveItemWidget();
|
||||
editWidget.AddWidget(moveItemWidget);
|
||||
moveItemWidget.Resize(6, editWidget.mY + GS!(16), GS!(20), GS!(20));
|
||||
moveItemWidget.mArrowDir = 1;
|
||||
moveItemWidget.mOnMouseDown.Add(new (evt) => { MoveEditingItem(subValueIdx, 1); });
|
||||
if (!ewc.mIsMultiline)
|
||||
editWidget.mOnKeyDown.Add(new (evt) => { if (evt.mKeyCode == KeyCode.Down) MoveEditingItem(subValueIdx, 1); });
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1363,8 +1399,8 @@ namespace IDE.ui
|
|||
hasChanged = true;
|
||||
}
|
||||
|
||||
if (propEntry.mFieldInfo == default(FieldInfo))
|
||||
return;
|
||||
/*if (propEntry.mFieldInfo == default(FieldInfo))
|
||||
return;*/
|
||||
|
||||
var curVariantType = propEntry.mCurValue.VariantType;
|
||||
|
||||
|
@ -1516,6 +1552,15 @@ namespace IDE.ui
|
|||
valueItem.Label = allValues;
|
||||
FixLabel(valueItem);
|
||||
}
|
||||
else if ((curVariantType.IsObject) && (var multiValue = propEntry.mCurValue.Get<Object>() as IMultiValued))
|
||||
{
|
||||
for (int columnIdx in 1..<propEntry.mListViewItem.mSubItems.Count)
|
||||
{
|
||||
var subItem = propEntry.mListViewItem.GetSubItem(columnIdx);
|
||||
var label = multiValue.GetValue(columnIdx - 1, .. scope .());
|
||||
subItem.Label = label;
|
||||
}
|
||||
}
|
||||
else if (propEntry.mCheckBox != null)
|
||||
{
|
||||
propEntry.mCheckBox.Checked = propEntry.mCurValue.Get<bool>();
|
||||
|
@ -2026,9 +2071,10 @@ namespace IDE.ui
|
|||
clickedItem.mListView.GetRoot().SelectItemExclusively(null);
|
||||
}
|
||||
|
||||
DarkListViewItem item = (DarkListViewItem)clickedItem.GetSubItem(0);
|
||||
DarkListViewItem item = (DarkListViewItem)clickedItem;
|
||||
DarkListViewItem rootItem = (DarkListViewItem)item.GetSubItem(0);
|
||||
|
||||
PropEntry[] propertyEntries = mPropPage.mPropEntries[item];
|
||||
PropEntry[] propertyEntries = mPropPage.mPropEntries[rootItem];
|
||||
if (propertyEntries[0].mDisabled)
|
||||
return;
|
||||
EditValue(item, propertyEntries);
|
||||
|
@ -2039,7 +2085,7 @@ namespace IDE.ui
|
|||
var propEntry = propEntries[0];
|
||||
DarkListViewItem parentItem = propEntry.mListViewItem;
|
||||
DarkListViewItem clickedItem = (DarkListViewItem)parentItem.GetChildAtIndex(idx);
|
||||
DarkListViewItem item = (DarkListViewItem)clickedItem.GetSubItem(0);
|
||||
DarkListViewItem item = (DarkListViewItem)clickedItem.GetSubItem(1);
|
||||
EditValue(item, propEntries, idx);
|
||||
}
|
||||
|
||||
|
|
179
IDE/src/ui/RemoteProjectDialog.bf
Normal file
179
IDE/src/ui/RemoteProjectDialog.bf
Normal file
|
@ -0,0 +1,179 @@
|
|||
#pragma warning disable 168
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Beefy;
|
||||
using Beefy.gfx;
|
||||
using Beefy.theme.dark;
|
||||
using Beefy.widgets;
|
||||
using Beefy.theme;
|
||||
using IDE.Util;
|
||||
|
||||
namespace IDE.ui
|
||||
{
|
||||
public class RemoteProjectDialog : IDEDialog
|
||||
{
|
||||
public EditWidget mURLEdit;
|
||||
public EditWidget mVersionEdit;
|
||||
public DarkComboBox mTargetComboBox;
|
||||
static String[1] sApplicationTypeNames =
|
||||
.("Git");
|
||||
public bool mNameChanged;
|
||||
public String mDirBase ~ delete _;
|
||||
|
||||
public this()
|
||||
{
|
||||
mTitle = new String("Add Remote Project");
|
||||
}
|
||||
|
||||
public override void CalcSize()
|
||||
{
|
||||
mWidth = GS!(320);
|
||||
mHeight = GS!(200);
|
||||
}
|
||||
|
||||
enum CreateFlags
|
||||
{
|
||||
None,
|
||||
NonEmptyDirOkay = 1,
|
||||
}
|
||||
|
||||
bool CreateProject(CreateFlags createFlags = .None)
|
||||
{
|
||||
var app = IDEApp.sApp;
|
||||
String url = scope String();
|
||||
mURLEdit.GetText(url);
|
||||
url.Trim();
|
||||
|
||||
if (url.IsEmpty)
|
||||
{
|
||||
mURLEdit.SetFocus();
|
||||
app.Fail("Invalid URL");
|
||||
return false;
|
||||
}
|
||||
|
||||
var projName = Path.GetFileName(url, .. scope .());
|
||||
|
||||
var version = mVersionEdit.GetText(.. scope .())..Trim();
|
||||
|
||||
var otherProject = app.mWorkspace.FindProject(projName);
|
||||
if (otherProject != null)
|
||||
{
|
||||
mURLEdit.SetFocus();
|
||||
app.Fail("A project with this name already exists in the workspace.");
|
||||
return false;
|
||||
}
|
||||
|
||||
VerSpec verSpec = .Git(url, scope .(version));
|
||||
if (var project = gApp.AddProject(projName, verSpec))
|
||||
{
|
||||
//gApp.ProjectCreated(project);
|
||||
app.mWorkspace.SetChanged();
|
||||
|
||||
gApp.[Friend]FlushDeferredLoadProjects(true);
|
||||
//gApp.RetryProjectLoad(project, false);
|
||||
//gApp.AddProjectToWorkspace(project);
|
||||
|
||||
var projectSpec = new Workspace.ProjectSpec();
|
||||
projectSpec.mProjectName = new .(project.mProjectName);
|
||||
projectSpec.mVerSpec = .Git(new .(url), new .(version));
|
||||
gApp.mWorkspace.mProjectSpecs.Add(projectSpec);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void UpdateProjectName()
|
||||
{
|
||||
if (!mNameChanged)
|
||||
{
|
||||
String path = scope .();
|
||||
mURLEdit.GetText(path);
|
||||
path.Trim();
|
||||
if ((path.EndsWith('\\')) || (path.EndsWith('/')))
|
||||
path.RemoveFromEnd(1);
|
||||
|
||||
String projName = scope .();
|
||||
Path.GetFileName(path, projName);
|
||||
mVersionEdit.SetText(projName);
|
||||
}
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
mDefaultButton = AddButton("Create", new (evt) =>
|
||||
{
|
||||
if (!CreateProject()) evt.mCloseDialog = false;
|
||||
});
|
||||
mEscButton = AddButton("Cancel", new (evt) => Close());
|
||||
|
||||
if (gApp.mWorkspace.IsInitialized)
|
||||
mDirBase = new String(gApp.mWorkspace.mDir);
|
||||
else
|
||||
mDirBase = new String();
|
||||
mURLEdit = new DarkEditWidget();
|
||||
|
||||
AddEdit(mURLEdit);
|
||||
mURLEdit.mOnContentChanged.Add(new (dlg) =>
|
||||
{
|
||||
|
||||
});
|
||||
|
||||
mVersionEdit = AddEdit("");
|
||||
mVersionEdit.mOnContentChanged.Add(new (dlg) =>
|
||||
{
|
||||
if (mVersionEdit.mHasFocus)
|
||||
mNameChanged = true;
|
||||
});
|
||||
|
||||
mTargetComboBox = new DarkComboBox();
|
||||
mTargetComboBox.Label = sApplicationTypeNames[0];
|
||||
mTargetComboBox.mPopulateMenuAction.Add(new (dlg) =>
|
||||
{
|
||||
for (var applicationTypeName in sApplicationTypeNames)
|
||||
{
|
||||
var item = dlg.AddItem(applicationTypeName);
|
||||
item.mOnMenuItemSelected.Add(new (item) =>
|
||||
{
|
||||
mTargetComboBox.Label = item.mLabel;
|
||||
MarkDirty();
|
||||
});
|
||||
}
|
||||
});
|
||||
AddWidget(mTargetComboBox);
|
||||
mTabWidgets.Add(mTargetComboBox);
|
||||
}
|
||||
|
||||
public override void PopupWindow(WidgetWindow parentWindow, float offsetX = 0, float offsetY = 0)
|
||||
{
|
||||
base.PopupWindow(parentWindow, offsetX, offsetY);
|
||||
mURLEdit.SetFocus();
|
||||
}
|
||||
|
||||
public override void ResizeComponents()
|
||||
{
|
||||
base.ResizeComponents();
|
||||
|
||||
float curY = mHeight - GS!(30) - mButtonBottomMargin;
|
||||
mVersionEdit.Resize(GS!(16), curY - GS!(36), mWidth - GS!(16) * 2, GS!(24));
|
||||
|
||||
curY -= GS!(50);
|
||||
mURLEdit.Resize(GS!(16), curY - GS!(36), mWidth - GS!(16) * 2, GS!(24));
|
||||
|
||||
curY -= GS!(60);
|
||||
mTargetComboBox.Resize(GS!(16), curY - GS!(36), mWidth - GS!(16) * 2, GS!(28));
|
||||
}
|
||||
|
||||
public override void Draw(Graphics g)
|
||||
{
|
||||
base.Draw(g);
|
||||
|
||||
g.DrawString("Remote Project URL", mURLEdit.mX, mURLEdit.mY - GS!(20));
|
||||
g.DrawString("Version Constraint (Blank for HEAD)", mVersionEdit.mX, mVersionEdit.mY - GS!(20));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -414,7 +414,8 @@ namespace IDE.ui
|
|||
|
||||
if (mGettingSymbolInfo)
|
||||
{
|
||||
gApp.Fail("Cannot rename symbols here");
|
||||
if (gApp.mWorkspace.mProjectLoadState == .Loaded)
|
||||
gApp.Fail("Cannot rename symbols here");
|
||||
mGettingSymbolInfo = false;
|
||||
return;
|
||||
}
|
||||
|
@ -430,6 +431,12 @@ namespace IDE.ui
|
|||
if ((mKind == Kind.ShowFileReferences) || (mResolveParams.mLocalId != -1))
|
||||
{
|
||||
mParser = IDEApp.sApp.mBfResolveSystem.FindParser(mSourceViewPanel.mProjectSource);
|
||||
if (mParser == null)
|
||||
{
|
||||
mGettingSymbolInfo = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((mResolveParams != null) && (mResolveParams.mLocalId != -1))
|
||||
mParser.SetAutocomplete(mCursorPos);
|
||||
else
|
||||
|
|
|
@ -1932,7 +1932,7 @@ namespace IDE.ui
|
|||
}
|
||||
else if (resolveType == ResolveType.GetCurrentLocation)
|
||||
{
|
||||
PrimaryNavigationBar.SetLocation(autocompleteInfo);
|
||||
PrimaryNavigationBar.SetLocation(autocompleteInfo ?? "");
|
||||
}
|
||||
else if ((resolveType == .Autocomplete) || (resolveType == .GetFixits))
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace IDE.ui
|
|||
public DarkButton mSafeModeButton;
|
||||
public bool mWasCompiling;
|
||||
public int mEvalCount;
|
||||
public ImageWidget mCancelSymSrvButton;
|
||||
public ImageWidget mCancelButton;
|
||||
public int mDirtyDelay;
|
||||
public int mStatusBoxUpdateCnt = -1;
|
||||
|
||||
|
@ -117,8 +117,8 @@ namespace IDE.ui
|
|||
mConfigComboBox.Resize(mWidth - btnLeft, GS!(0), GS!(120), GS!(24));
|
||||
mPlatformComboBox.Resize(mWidth - btnLeft - GS!(120), GS!(0), GS!(120), GS!(24));
|
||||
|
||||
if (mCancelSymSrvButton != null)
|
||||
mCancelSymSrvButton.Resize(GS!(546), 0, GS!(20), GS!(20));
|
||||
if (mCancelButton != null)
|
||||
mCancelButton.Resize(GS!(546), 0, GS!(20), GS!(20));
|
||||
|
||||
if (mSafeModeButton != null)
|
||||
{
|
||||
|
@ -182,19 +182,31 @@ namespace IDE.ui
|
|||
else
|
||||
mEvalCount = 0;
|
||||
|
||||
void ShowCancelButton()
|
||||
{
|
||||
if (mCancelButton == null)
|
||||
{
|
||||
mCancelButton = new ImageWidget();
|
||||
mCancelButton.mImage = DarkTheme.sDarkTheme.GetImage(.Close);
|
||||
mCancelButton.mOverImage = DarkTheme.sDarkTheme.GetImage(.CloseOver);
|
||||
mCancelButton.mOnMouseClick.Add(new (evt) =>
|
||||
{
|
||||
if (gApp.mWorkspace.mProjectLoadState == .Preparing)
|
||||
{
|
||||
gApp.CancelWorkspaceLoading();
|
||||
}
|
||||
else
|
||||
gApp.mDebugger.CancelSymSrv();
|
||||
});
|
||||
AddWidget(mCancelButton);
|
||||
ResizeComponents();
|
||||
}
|
||||
}
|
||||
|
||||
if (debugState == .SearchingSymSrv)
|
||||
{
|
||||
MarkDirtyEx();
|
||||
|
||||
if (mCancelSymSrvButton == null)
|
||||
{
|
||||
mCancelSymSrvButton = new ImageWidget();
|
||||
mCancelSymSrvButton.mImage = DarkTheme.sDarkTheme.GetImage(.Close);
|
||||
mCancelSymSrvButton.mOverImage = DarkTheme.sDarkTheme.GetImage(.CloseOver);
|
||||
mCancelSymSrvButton.mOnMouseClick.Add(new (evt) => { gApp.mDebugger.CancelSymSrv(); });
|
||||
AddWidget(mCancelSymSrvButton);
|
||||
ResizeComponents();
|
||||
}
|
||||
ShowCancelButton();
|
||||
|
||||
float len = GS!(200);
|
||||
float x = GS!(350);
|
||||
|
@ -209,15 +221,45 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (gApp.mWorkspace.mProjectLoadState == .Preparing)
|
||||
{
|
||||
MarkDirtyEx();
|
||||
ShowCancelButton();
|
||||
|
||||
float len = GS!(200);
|
||||
float x = GS!(350);
|
||||
Rect completionRect = Rect(x, GS!(1), len, GS!(17));
|
||||
|
||||
String status = scope .();
|
||||
|
||||
for (var workItem in gApp.mPackMan.mWorkItems)
|
||||
{
|
||||
if (workItem.mGitInstance == null)
|
||||
break;
|
||||
|
||||
//DrawCompletion(workItem.mGitInstance.mProgress);
|
||||
status.AppendF($"Retrieving {workItem.mProjectName}: {(int)(workItem.mGitInstance.mProgress * 100)}%");
|
||||
}
|
||||
|
||||
Point mousePos;
|
||||
if (DarkTooltipManager.CheckMouseover(this, 25, out mousePos, true))
|
||||
{
|
||||
if (completionRect.Contains(mousePos.x, mousePos.y))
|
||||
{
|
||||
if (!status.IsEmpty)
|
||||
DarkTooltipManager.ShowTooltip(status, this, mousePos.x, mousePos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((DarkTooltipManager.sTooltip != null) && (DarkTooltipManager.sTooltip.mRelWidget == this))
|
||||
DarkTooltipManager.sTooltip.Close();
|
||||
|
||||
if (mCancelSymSrvButton != null)
|
||||
if (mCancelButton != null)
|
||||
{
|
||||
RemoveAndDelete(mCancelSymSrvButton);
|
||||
mCancelSymSrvButton = null;
|
||||
RemoveAndDelete(mCancelButton);
|
||||
mCancelButton = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,6 +409,16 @@ namespace IDE.ui
|
|||
|
||||
float statusLabelPos = (int)GS!(-1.3f);
|
||||
|
||||
void DrawCompletion(float pct)
|
||||
{
|
||||
Rect completionRect = Rect(GS!(200), GS!(2), GS!(120), GS!(15));
|
||||
using (g.PushColor(0xFF000000))
|
||||
g.FillRect(completionRect.mX, completionRect.mY, completionRect.mWidth, completionRect.mHeight);
|
||||
completionRect.Inflate(GS!(-1), GS!(-1));
|
||||
using (g.PushColor(0xFF00FF00))
|
||||
g.FillRect(completionRect.mX, completionRect.mY, completionRect.mWidth * pct, completionRect.mHeight);
|
||||
}
|
||||
|
||||
//completionPct = 0.4f;
|
||||
if ((gApp.mDebugger?.mIsComptimeDebug == true) &&
|
||||
((gApp.mDebugger.IsPaused()) || (debugState == .DebugEval)))
|
||||
|
@ -375,12 +427,7 @@ namespace IDE.ui
|
|||
}
|
||||
else if (completionPct.HasValue)
|
||||
{
|
||||
Rect completionRect = Rect(GS!(200), GS!(2), GS!(120), GS!(15));
|
||||
using (g.PushColor(0xFF000000))
|
||||
g.FillRect(completionRect.mX, completionRect.mY, completionRect.mWidth, completionRect.mHeight);
|
||||
completionRect.Inflate(GS!(-1), GS!(-1));
|
||||
using (g.PushColor(0xFF00FF00))
|
||||
g.FillRect(completionRect.mX, completionRect.mY, completionRect.mWidth * completionPct.Value, completionRect.mHeight);
|
||||
DrawCompletion(completionPct.Value);
|
||||
}
|
||||
else if ((gApp.mDebugger.mIsRunning) && (gApp.HaveSourcesChanged()))
|
||||
{
|
||||
|
@ -394,7 +441,7 @@ namespace IDE.ui
|
|||
g.DrawString("Source Changed", GS!(200), statusLabelPos, FontAlign.Centered, GS!(120));
|
||||
}
|
||||
|
||||
void DrawStatusBox(StringView str, int32 updateCnt = -1)
|
||||
void DrawStatusBox(StringView str, int32 updateCnt = -1, bool showCancelButton = false)
|
||||
{
|
||||
if (mStatusBoxUpdateCnt == -1)
|
||||
mStatusBoxUpdateCnt = 0;
|
||||
|
@ -415,8 +462,18 @@ namespace IDE.ui
|
|||
using (g.PushColor(Color.FromHSV(0.1f, 0.5f, (float)Math.Max(pulsePct * 0.15f + 0.3f, 0.3f))))
|
||||
g.FillRect(completionRect.mX, completionRect.mY, completionRect.mWidth, completionRect.mHeight);
|
||||
|
||||
if (mCancelSymSrvButton != null)
|
||||
mCancelSymSrvButton.mX = completionRect.Right - GS!(16);
|
||||
if (mCancelButton != null)
|
||||
{
|
||||
if (showCancelButton)
|
||||
{
|
||||
mCancelButton.SetVisible(true);
|
||||
mCancelButton.mX = completionRect.Right - GS!(16);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCancelButton.SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
using (g.PushColor(DarkTheme.COLOR_TEXT))
|
||||
g.DrawString(str, x, statusLabelPos, FontAlign.Centered, len);
|
||||
|
@ -429,10 +486,6 @@ namespace IDE.ui
|
|||
chordState.Append(", <Awaiting Key>...");
|
||||
DrawStatusBox(chordState);
|
||||
}
|
||||
else if (mCancelSymSrvButton != null)
|
||||
{
|
||||
DrawStatusBox("Retrieving Debug Symbols... ");
|
||||
}
|
||||
else if (mEvalCount > 20)
|
||||
{
|
||||
DrawStatusBox("Evaluating Expression");
|
||||
|
@ -451,10 +504,16 @@ namespace IDE.ui
|
|||
}
|
||||
else if (gApp.mWorkspace.mProjectLoadState == .Preparing)
|
||||
{
|
||||
DrawStatusBox("Loading Projects");
|
||||
DrawStatusBox("Loading Projects", -1, true);
|
||||
}
|
||||
else if (mCancelButton != null)
|
||||
{
|
||||
DrawStatusBox("Retrieving Debug Symbols... ", -1, true);
|
||||
}
|
||||
else if (gApp.mDeferredShowSource != null)
|
||||
{
|
||||
DrawStatusBox("Queued Showing Source");
|
||||
}
|
||||
else
|
||||
mStatusBoxUpdateCnt = -1;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ using Beefy.theme.dark;
|
|||
using Beefy.theme;
|
||||
using Beefy.events;
|
||||
using System.Diagnostics;
|
||||
using IDE.Util;
|
||||
|
||||
//#define A
|
||||
//#define B
|
||||
|
@ -40,6 +41,7 @@ namespace IDE.ui
|
|||
enum CategoryType
|
||||
{
|
||||
General,
|
||||
Dependencies,
|
||||
Beef_Global,
|
||||
|
||||
Targeted,
|
||||
|
@ -53,6 +55,7 @@ namespace IDE.ui
|
|||
|
||||
ConfigDataGroup mCurConfigDataGroup;
|
||||
Workspace.Options[] mCurWorkspaceOptions ~ delete _;
|
||||
List<String> mUpdateProjectLocks = new .() ~ DeleteContainerAndItems!(_);
|
||||
|
||||
public this()
|
||||
{
|
||||
|
@ -62,8 +65,9 @@ namespace IDE.ui
|
|||
|
||||
var root = (DarkListViewItem)mCategorySelector.GetRoot();
|
||||
var globalItem = AddCategoryItem(root, "General");
|
||||
var item = AddCategoryItem(globalItem, "Beef");
|
||||
var item = AddCategoryItem(globalItem, "Dependencies");
|
||||
item.Focused = true;
|
||||
AddCategoryItem(globalItem, "Beef");
|
||||
globalItem.Open(true, true);
|
||||
|
||||
var targetedItem = AddCategoryItem(root, "Targeted");
|
||||
|
@ -124,6 +128,7 @@ namespace IDE.ui
|
|||
{
|
||||
case .General,
|
||||
//.Targeted,
|
||||
.Dependencies,
|
||||
.Beef_Global:
|
||||
return .None;
|
||||
default:
|
||||
|
@ -454,7 +459,9 @@ namespace IDE.ui
|
|||
mPropPage.mPropertiesListView.mShowColumnGrid = true;
|
||||
mPropPage.mPropertiesListView.mShowGridLines = true;
|
||||
|
||||
if (categoryType == CategoryType.Beef_Global)
|
||||
if (categoryType == CategoryType.Dependencies)
|
||||
PopulateDependencyOptions();
|
||||
else if (categoryType == CategoryType.Beef_Global)
|
||||
PopulateBeefGlobalOptions();
|
||||
else if (categoryType == CategoryType.Build)
|
||||
PopulateBuildOptions();
|
||||
|
@ -705,6 +712,230 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
void PopulateDependencyOptions()
|
||||
{
|
||||
mPropPage.mPropertiesListView.mColumns[0].Label = "Project";
|
||||
mPropPage.mPropertiesListView.mColumns[0].mMinWidth = GS!(100);
|
||||
mPropPage.mPropertiesListView.mColumns[0].mWidth = GS!(180);
|
||||
|
||||
mPropPage.mPropertiesListView.mColumns[1].Label = "";
|
||||
mPropPage.mPropertiesListView.mColumns[1].mMinWidth = GS!(20);
|
||||
mPropPage.mPropertiesListView.mColumns[1].mWidth = GS!(20);
|
||||
|
||||
mPropPage.mPropertiesListView.AddColumn(180, "Remote URL");
|
||||
mPropPage.mPropertiesListView.mColumns[2].mMinWidth = GS!(100);
|
||||
|
||||
mPropPage.mPropertiesListView.AddColumn(180, "Ver Constraint");
|
||||
mPropPage.mPropertiesListView.mColumns[3].mMinWidth = GS!(100);
|
||||
|
||||
//mDependencyValuesMap = new .();
|
||||
|
||||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
var category = root;
|
||||
|
||||
List<String> projectNames = scope List<String>();
|
||||
for (int32 projectIdx = 0; projectIdx < IDEApp.sApp.mWorkspace.mProjects.Count; projectIdx++)
|
||||
{
|
||||
var project = IDEApp.sApp.mWorkspace.mProjects[projectIdx];
|
||||
/*if (project == mProject)
|
||||
continue;*/
|
||||
projectNames.Add(project.mProjectName);
|
||||
}
|
||||
|
||||
/*for (var dep in mProject.mDependencies)
|
||||
{
|
||||
if (!projectNames.Contains(dep.mProjectName))
|
||||
projectNames.Add(dep.mProjectName);
|
||||
}*/
|
||||
|
||||
|
||||
projectNames.Sort(scope (a, b) => String.Compare(a, b, true));
|
||||
|
||||
for (var projectName in projectNames)
|
||||
{
|
||||
var dependencyEntry = new DependencyEntry();
|
||||
|
||||
for (var projectSpec in gApp.mWorkspace.mProjectSpecs)
|
||||
{
|
||||
if (projectSpec.mProjectName == projectName)
|
||||
{
|
||||
dependencyEntry.mUse = true;
|
||||
if (projectSpec.mVerSpec case .Git(let url, let ver))
|
||||
{
|
||||
dependencyEntry.mURL = new .(url);
|
||||
if (ver != null)
|
||||
dependencyEntry.mVersion = new .(ver.mVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*var verSpec = mProject.GetDependency(projectName, false);
|
||||
if (verSpec != null)
|
||||
{
|
||||
dependencyEntry.mUse = true;
|
||||
if (verSpec case .Git(let url, let ver))
|
||||
{
|
||||
dependencyEntry.mURL = new .(url);
|
||||
if (ver != null)
|
||||
dependencyEntry.mVersion = new .(ver.mVersion);
|
||||
}
|
||||
}
|
||||
mDependencyValuesMap[new String(projectName)] = dependencyEntry;*/
|
||||
|
||||
var (listViewItem, propItem) = AddPropertiesItem(category, projectName);
|
||||
if (IDEApp.sApp.mWorkspace.FindProject(projectName) == null)
|
||||
listViewItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFFF6060);
|
||||
|
||||
var subItem = (DarkListViewItem)listViewItem.CreateSubItem(1);
|
||||
|
||||
var checkbox = new DarkCheckBox();
|
||||
checkbox.Checked = dependencyEntry.mUse;
|
||||
checkbox.Resize(0, 0, DarkTheme.sUnitSize, DarkTheme.sUnitSize);
|
||||
subItem.AddWidget(checkbox);
|
||||
|
||||
PropEntry[] propEntries = new PropEntry[1];
|
||||
|
||||
PropEntry propEntry = new PropEntry();
|
||||
propEntry.mTarget = dependencyEntry;
|
||||
propEntry.mOrigValue = Variant.Create(dependencyEntry, true);
|
||||
propEntry.mCurValue = Variant.Create(new DependencyEntry(dependencyEntry), true);
|
||||
|
||||
propEntry.mListViewItem = listViewItem;
|
||||
propEntry.mCheckBox = checkbox;
|
||||
propEntry.mApplyAction = new () =>
|
||||
{
|
||||
bool updateProjectLock = false;
|
||||
|
||||
var dependencyEntry = propEntry.mCurValue.Get<DependencyEntry>();
|
||||
|
||||
VerSpec verSpec = default;
|
||||
if (dependencyEntry.mUse)
|
||||
{
|
||||
if (dependencyEntry.mURL != null)
|
||||
verSpec = .Git(new .(dependencyEntry.mURL), (dependencyEntry.mVersion != null) ? new .(dependencyEntry.mVersion) : null);
|
||||
else if (dependencyEntry.mVersion != null)
|
||||
verSpec = .SemVer(new .(dependencyEntry.mVersion));
|
||||
else
|
||||
verSpec = .SemVer(new .("*"));
|
||||
}
|
||||
|
||||
FindBlock: do
|
||||
{
|
||||
for (var projectSpec in gApp.mWorkspace.mProjectSpecs)
|
||||
{
|
||||
if (projectSpec.mProjectName == projectName)
|
||||
{
|
||||
if (!dependencyEntry.mUse)
|
||||
{
|
||||
if (projectSpec.mVerSpec case .Git)
|
||||
updateProjectLock = true;
|
||||
@projectSpec.Remove();
|
||||
delete projectSpec;
|
||||
break FindBlock;
|
||||
}
|
||||
|
||||
if (projectSpec.mVerSpec != verSpec)
|
||||
{
|
||||
if ((projectSpec.mVerSpec case .Git) ||
|
||||
(verSpec case .Git))
|
||||
updateProjectLock = true;
|
||||
}
|
||||
|
||||
projectSpec.mVerSpec.Dispose();
|
||||
projectSpec.mVerSpec = verSpec;
|
||||
break FindBlock;
|
||||
}
|
||||
}
|
||||
|
||||
if (dependencyEntry.mUse)
|
||||
{
|
||||
Workspace.ProjectSpec projectSpec = new .();
|
||||
projectSpec.mProjectName = new .(projectName);
|
||||
projectSpec.mVerSpec = verSpec;
|
||||
gApp.mWorkspace.mProjectSpecs.Add(projectSpec);
|
||||
if (verSpec case .Git)
|
||||
updateProjectLock = true;
|
||||
var origDependencyEntry = propEntry.mOrigValue.Get<DependencyEntry>();
|
||||
origDependencyEntry.Set(dependencyEntry);
|
||||
}
|
||||
}
|
||||
|
||||
if (updateProjectLock)
|
||||
mUpdateProjectLocks.Add(new .(listViewItem.Label));
|
||||
};
|
||||
|
||||
checkbox.mOnMouseUp.Add(new (evt) =>
|
||||
{
|
||||
var dependencyEntry = propEntry.mCurValue.Get<DependencyEntry>();
|
||||
dependencyEntry.mUse = !dependencyEntry.mUse;
|
||||
if (dependencyEntry.mUse)
|
||||
{
|
||||
var projectName = listViewItem.Label;
|
||||
|
||||
for (var projectSpec in gApp.mWorkspace.mProjectSpecs)
|
||||
{
|
||||
if (projectSpec.mProjectName == projectName)
|
||||
{
|
||||
if (projectSpec.mVerSpec case .Git(let url, let ver))
|
||||
{
|
||||
dependencyEntry.SetValue(1, url);
|
||||
dependencyEntry.SetValue(2, ver.mVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
var propEntries = mPropPage.mPropEntries[listViewItem];
|
||||
UpdatePropertyValue(propEntries);
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteAndNullify!(dependencyEntry.mURL);
|
||||
DeleteAndNullify!(dependencyEntry.mVersion);
|
||||
var propEntries = mPropPage.mPropEntries[listViewItem];
|
||||
UpdatePropertyValue(propEntries);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
subItem = (.)listViewItem.GetOrCreateSubItem(2);
|
||||
if (dependencyEntry.mURL != null)
|
||||
subItem.Label = dependencyEntry.mURL;
|
||||
subItem.mOnMouseDown.Add(new => DepPropValueClicked);
|
||||
|
||||
subItem = (.)listViewItem.GetOrCreateSubItem(3);
|
||||
if (dependencyEntry.mVersion != null)
|
||||
subItem.Label = dependencyEntry.mVersion;
|
||||
subItem.mOnMouseDown.Add(new => DepPropValueClicked);
|
||||
|
||||
propEntries[0] = propEntry;
|
||||
mPropPage.mPropEntries[listViewItem] = propEntries;
|
||||
}
|
||||
}
|
||||
|
||||
protected void DepPropValueClicked(MouseEvent theEvent)
|
||||
{
|
||||
DarkListViewItem clickedItem = (DarkListViewItem)theEvent.mSender;
|
||||
if (clickedItem.mColumnIdx == 0)
|
||||
{
|
||||
clickedItem.mListView.SetFocus();
|
||||
clickedItem.mListView.GetRoot().SelectItemExclusively(clickedItem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (theEvent.mX != -1)
|
||||
{
|
||||
clickedItem.mListView.GetRoot().SelectItemExclusively(null);
|
||||
}
|
||||
|
||||
DarkListViewItem item = (DarkListViewItem)clickedItem;
|
||||
DarkListViewItem rootItem = (DarkListViewItem)clickedItem.GetSubItem(0);
|
||||
|
||||
PropEntry[] propertyEntries = mPropPage.mPropEntries[rootItem];
|
||||
if (propertyEntries[0].mDisabled)
|
||||
return;
|
||||
EditValue(item, propertyEntries, clickedItem.mColumnIdx - 1);
|
||||
}
|
||||
|
||||
void PopulateBeefGlobalOptions()
|
||||
{
|
||||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||
|
@ -939,6 +1170,7 @@ namespace IDE.ui
|
|||
{
|
||||
base.Close();
|
||||
SetWorkspaceData(false);
|
||||
gApp.NotifyProjectVersionLocks(mUpdateProjectLocks);
|
||||
}
|
||||
|
||||
public override void CalcSize()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue