|
@@ -224,7 +224,7 @@ namespace IDE.ui
|
|
|
{
|
|
|
mTypeName = new .(emitEmbed.mTypeName);
|
|
|
mEmitEmbed = emitEmbed;
|
|
|
- mSourceViewPanel = new SourceViewPanel((emitEmbed.mEmitKind == .Method) ? .Method : .Type);
|
|
|
+ mSourceViewPanel = new SourceViewPanel((emitEmbed.mEmitKind == .Emit_Method) ? .Method : .Type);
|
|
|
mSourceViewPanel.mEmbedParent = mEmitEmbed.mEditWidgetContent.mSourceViewPanel;
|
|
|
var emitPath = scope $"$Emit${emitEmbed.mTypeName}";
|
|
|
|
|
@@ -382,7 +382,7 @@ namespace IDE.ui
|
|
|
}
|
|
|
|
|
|
mAwaitingLoad = false;
|
|
|
- if (!mEmitRemoved)
|
|
|
+ if ((!mEmitRemoved) && (gApp.mSettings.mEditorSettings.mEmitCompiler == .Resolve))
|
|
|
{
|
|
|
for (var explicitTypeName in mEmitEmbed.mEditWidgetContent.mSourceViewPanel.[Friend]mExplicitEmitTypes)
|
|
|
{
|
|
@@ -397,6 +397,9 @@ namespace IDE.ui
|
|
|
|
|
|
if ((mAwaitingLoad) && (gApp.mUpdateCnt % 4 == 0))
|
|
|
MarkDirty();
|
|
|
+
|
|
|
+ if (mSourceViewPanel.HasFocus())
|
|
|
+ mEmitEmbed.mEditWidgetContent.mEmbedSelected = mEmitEmbed;
|
|
|
}
|
|
|
|
|
|
public void GetGenericTypes()
|
|
@@ -516,6 +519,10 @@ namespace IDE.ui
|
|
|
public int32 mEndLine;
|
|
|
public View mView;
|
|
|
|
|
|
+ public this()
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
public ~this()
|
|
|
{
|
|
|
if (mView != null)
|
|
@@ -525,17 +532,29 @@ namespace IDE.ui
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public bool IsSelected => mEditWidgetContent.mEmbedSelected == this;
|
|
|
+ public float LabelWidth = GS!(42);
|
|
|
+
|
|
|
public override float GetWidth(bool hideLine)
|
|
|
{
|
|
|
- return GS!(42);
|
|
|
+ return IsSelected ? GS!(60) : LabelWidth;
|
|
|
}
|
|
|
|
|
|
public override void Draw(Graphics g, Rect rect, bool hideLine)
|
|
|
{
|
|
|
+ var rect;
|
|
|
+ rect.mWidth = LabelWidth;
|
|
|
+
|
|
|
if (rect.mHeight >= DarkTheme.sDarkTheme.mSmallBoldFont.GetLineSpacing())
|
|
|
g.SetFont(DarkTheme.sDarkTheme.mSmallBoldFont);
|
|
|
|
|
|
- using (g.PushColor(0x80707070))
|
|
|
+ uint32 fillColor = 0x80707070;
|
|
|
+ if (gApp.mSettings.mEditorSettings.mEmitCompiler == .Build)
|
|
|
+ {
|
|
|
+ fillColor = 0x805050E0;
|
|
|
+ }
|
|
|
+
|
|
|
+ using (g.PushColor(fillColor))
|
|
|
{
|
|
|
g.FillRect(rect.mX + 1, rect.mY + 1, rect.mWidth - 2, rect.mHeight - 2);
|
|
|
}
|
|
@@ -558,6 +577,40 @@ namespace IDE.ui
|
|
|
|
|
|
var summaryString = "Emit";
|
|
|
g.DrawString(summaryString, rect.mX, rect.mY + (int)((rect.mHeight - g.mFont.GetLineSpacing()) * 0.5f), .Centered, rect.mWidth);
|
|
|
+
|
|
|
+ if (IsSelected)
|
|
|
+ {
|
|
|
+ g.Draw(DarkTheme.sDarkTheme.GetImage(.DropMenuButton), rect.Right, rect.Top);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public override void MouseDown(Rect rect, float x, float y, int btn, int btnCount)
|
|
|
+ {
|
|
|
+ base.MouseDown(rect, x, y, btn, btnCount);
|
|
|
+ if (x >= rect.mX + LabelWidth)
|
|
|
+ ShowMenu(x, y);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ShowMenu(float x, float y)
|
|
|
+ {
|
|
|
+ Menu menuItem;
|
|
|
+
|
|
|
+ Menu menu = new Menu();
|
|
|
+ menuItem = menu.AddItem("Compiler");
|
|
|
+
|
|
|
+ var subItem = menuItem.AddItem("Resolve");
|
|
|
+ if (gApp.mSettings.mEditorSettings.mEmitCompiler == .Resolve)
|
|
|
+ subItem.mIconImage = DarkTheme.sDarkTheme.GetImage(.Check);
|
|
|
+ subItem.mOnMenuItemSelected.Add(new (menu) => { gApp.SetEmbedCompiler(.Resolve); });
|
|
|
+
|
|
|
+ subItem = menuItem.AddItem("Build");
|
|
|
+ if (gApp.mSettings.mEditorSettings.mEmitCompiler == .Build)
|
|
|
+ subItem.mIconImage = DarkTheme.sDarkTheme.GetImage(.Check);
|
|
|
+ subItem.mOnMenuItemSelected.Add(new (menu) => { gApp.SetEmbedCompiler(.Build); });
|
|
|
+
|
|
|
+ MenuWidget menuWidget = DarkTheme.sDarkTheme.CreateMenuWidget(menu);
|
|
|
+
|
|
|
+ menuWidget.Init(mEditWidgetContent, x, y);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -575,10 +628,11 @@ namespace IDE.ui
|
|
|
case UsingNamespaces = 'U';
|
|
|
case Unknown = '?';
|
|
|
case HasUncertainEmits = '~';
|
|
|
- case Emit = 'e';
|
|
|
+ case Emit_Type = 't';
|
|
|
+ case Emit_Method = 'm';
|
|
|
case EmitAddType = '+';
|
|
|
|
|
|
- public bool IsEmit => (this == .Emit);
|
|
|
+ public bool IsEmit => (this == .Emit_Type) || (this == .Emit_Method);
|
|
|
}
|
|
|
|
|
|
public Kind mKind;
|
|
@@ -614,6 +668,7 @@ namespace IDE.ui
|
|
|
public bool mOnlyInResolveAll;
|
|
|
public bool mIncludedInClassify;
|
|
|
public bool mIncludedInResolveAll;
|
|
|
+ public bool mIncludedInBuild;
|
|
|
|
|
|
public int32 mAnchorId;
|
|
|
}
|
|
@@ -4408,6 +4463,7 @@ namespace IDE.ui
|
|
|
public override void KeyDown(KeyCode keyCode, bool isRepeat)
|
|
|
{
|
|
|
mIgnoreKeyChar = false;
|
|
|
+ mEmbedSelected = null;
|
|
|
|
|
|
bool autoCompleteRequireControl = (gApp.mSettings.mEditorSettings.mAutoCompleteRequireControl) && (mIsMultiline);
|
|
|
|
|
@@ -4463,7 +4519,6 @@ namespace IDE.ui
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
|
|
|
if ((keyCode == KeyCode.Escape) && (mSelection != null) && (mSelection.Value.HasSelection))
|
|
|
{
|
|
@@ -4696,6 +4751,23 @@ namespace IDE.ui
|
|
|
{
|
|
|
base.MouseClicked(x, y, origX, origY, btn);
|
|
|
|
|
|
+ if (btn == 1)
|
|
|
+ {
|
|
|
+ int line = GetLineAt(y);
|
|
|
+ if (mEmbeds.GetValue((.)line) case .Ok(let embed))
|
|
|
+ {
|
|
|
+ Rect embedRect = GetEmbedRect(line, embed);
|
|
|
+ if (embedRect.Contains(x, y))
|
|
|
+ {
|
|
|
+ if (var emitEmbed = embed as EmitEmbed)
|
|
|
+ {
|
|
|
+ emitEmbed.ShowMenu(x, y);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var useX = x;
|
|
|
var useY = y;
|
|
|
|
|
@@ -5019,20 +5091,26 @@ namespace IDE.ui
|
|
|
Rect embedRect = GetEmbedRect(line, embed);
|
|
|
if (embedRect.Contains(x, y))
|
|
|
{
|
|
|
- if ((btn == 0) && (btnCount % 2 == 0))
|
|
|
+ mEmbedSelected = embed;
|
|
|
+ embed.MouseDown(GetEmbedRect(line, embed), x, y, btn, btnCount);
|
|
|
+ if (btn == 0)
|
|
|
{
|
|
|
- if (var collapseSummary = embed as SourceEditWidgetContent.CollapseSummary)
|
|
|
- SetCollapseOpen(collapseSummary.mCollapseIndex, true);
|
|
|
- else if (var emitEmbed = embed as EmitEmbed)
|
|
|
+ if (btnCount % 2 == 0)
|
|
|
{
|
|
|
- emitEmbed.mIsOpen = !emitEmbed.mIsOpen;
|
|
|
- mCollapseNeedsUpdate = true;
|
|
|
+ if (var collapseSummary = embed as SourceEditWidgetContent.CollapseSummary)
|
|
|
+ SetCollapseOpen(collapseSummary.mCollapseIndex, true);
|
|
|
+ else if (var emitEmbed = embed as EmitEmbed)
|
|
|
+ {
|
|
|
+ emitEmbed.mIsOpen = !emitEmbed.mIsOpen;
|
|
|
+ mCollapseNeedsUpdate = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ mEmbedSelected = null;
|
|
|
base.MouseDown(x, y, btn, btnCount);
|
|
|
}
|
|
|
|
|
@@ -5727,6 +5805,13 @@ namespace IDE.ui
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ void DeleteEmbed(Embed embed)
|
|
|
+ {
|
|
|
+ if (mEmbedSelected == embed)
|
|
|
+ mEmbedSelected = null;
|
|
|
+ delete embed;
|
|
|
+ }
|
|
|
+
|
|
|
public override void GetTextData()
|
|
|
{
|
|
|
var data = Data;
|
|
@@ -5755,8 +5840,14 @@ namespace IDE.ui
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ IdSpan.LookupContext lookupCtx = null;
|
|
|
+
|
|
|
for (var emitData in ref data.mEmitData)
|
|
|
{
|
|
|
+ if (lookupCtx == null)
|
|
|
+ lookupCtx = scope:: .(mData.mTextIdData);
|
|
|
+ emitData.mAnchorIdx = (.)lookupCtx.GetIndexFromId(emitData.mAnchorId);
|
|
|
+
|
|
|
GetLineCharAtIdx(emitData.mAnchorIdx, var line, var lineChar);
|
|
|
|
|
|
SourceEditWidgetContent.EmitEmbed emitEmbed = null;
|
|
@@ -5776,7 +5867,7 @@ namespace IDE.ui
|
|
|
else
|
|
|
{
|
|
|
//Debug.WriteLine($" Occupied- deleting {emitEmbed}");
|
|
|
- delete emitEmbed;
|
|
|
+ DeleteEmbed(emitEmbed);
|
|
|
emitEmbed = null;
|
|
|
}
|
|
|
}
|
|
@@ -5837,7 +5928,7 @@ namespace IDE.ui
|
|
|
{
|
|
|
mCollapseNeedsUpdate = true;
|
|
|
mEmbeds.Remove(emitEmbed.mLine);
|
|
|
- delete emitEmbed;
|
|
|
+ DeleteEmbed(emitEmbed);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5863,7 +5954,7 @@ namespace IDE.ui
|
|
|
if (!(value is EmitEmbed))
|
|
|
{
|
|
|
mEmbeds.Remove(entry.mAnchorLine);
|
|
|
- delete value;
|
|
|
+ DeleteEmbed(value);
|
|
|
}
|
|
|
}
|
|
|
@entry.Remove();
|
|
@@ -5888,7 +5979,7 @@ namespace IDE.ui
|
|
|
{
|
|
|
//Debug.WriteLine($" Removing {val.value}");
|
|
|
if (val.value is CollapseSummary)
|
|
|
- delete val.value;
|
|
|
+ DeleteEmbed(val.value);
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
@@ -5914,7 +6005,7 @@ namespace IDE.ui
|
|
|
else
|
|
|
{
|
|
|
//Debug.WriteLine($" Deleting(3) {val}");
|
|
|
- delete val;
|
|
|
+ DeleteEmbed(val);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -6241,7 +6332,7 @@ namespace IDE.ui
|
|
|
{
|
|
|
if ((embed.mKind == .HideLine) || (embed.mKind == .LineEnd))
|
|
|
{
|
|
|
- delete embed;
|
|
|
+ DeleteEmbed(embed);
|
|
|
mEmbeds.Remove(entry.mAnchorLine);
|
|
|
}
|
|
|
}
|
|
@@ -6283,7 +6374,7 @@ namespace IDE.ui
|
|
|
if (!(value is EmitEmbed))
|
|
|
{
|
|
|
mEmbeds.Remove(prevAnchorLine);
|
|
|
- delete value;
|
|
|
+ DeleteEmbed(value);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -6304,7 +6395,7 @@ namespace IDE.ui
|
|
|
else
|
|
|
{
|
|
|
//Debug.WriteLine($" Occupied- deleting {val}");
|
|
|
- delete val.value;
|
|
|
+ DeleteEmbed(val.value);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -6360,7 +6451,7 @@ namespace IDE.ui
|
|
|
if (entry.mDeleted)
|
|
|
{
|
|
|
if (mEmbeds.GetAndRemove(entry.mAnchorIdx) case .Ok(let val))
|
|
|
- delete val.value;
|
|
|
+ DeleteEmbed(val.value);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -6388,7 +6479,7 @@ namespace IDE.ui
|
|
|
*valuePtr = val.value;
|
|
|
}
|
|
|
else
|
|
|
- delete val.value;
|
|
|
+ DeleteEmbed(val.value);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -6401,7 +6492,7 @@ namespace IDE.ui
|
|
|
RehupLineCoords();
|
|
|
}
|
|
|
|
|
|
- public void ParseCollapseRegions(String collapseText, int32 textVersion, ref IdSpan idSpan, ResolveType resolveType)
|
|
|
+ public void ParseCollapseRegions(String collapseText, int32 textVersion, ref IdSpan idSpan, ResolveType? resolveType)
|
|
|
{
|
|
|
/*if (resolveType == .None)
|
|
|
return;*/
|
|
@@ -6415,6 +6506,8 @@ namespace IDE.ui
|
|
|
data.ClearCollapse();
|
|
|
}
|
|
|
|
|
|
+ bool wantsBuildEmits = gApp.mSettings.mEditorSettings.mEmitCompiler == .Build;
|
|
|
+
|
|
|
//Debug.WriteLine($"ParseCollapseRegions {resolveType} CollapseRevision:{data.mCollapseParseRevision+1} TextVersion:{textVersion} IdSpan:{idSpan:D}");
|
|
|
|
|
|
List<int32> typeNameIdxMap = scope .();
|
|
@@ -6429,7 +6522,7 @@ namespace IDE.ui
|
|
|
if (emitInitialized)
|
|
|
return;
|
|
|
emitInitialized = true;
|
|
|
- if ((hasUncertainEmits) || (resolveType == .None))
|
|
|
+ if ((hasUncertainEmits) || (wantsBuildEmits) || (resolveType == .None))
|
|
|
{
|
|
|
// Leave emits alone
|
|
|
for (var typeName in data.mTypeNames)
|
|
@@ -6437,7 +6530,11 @@ namespace IDE.ui
|
|
|
for (var emitData in ref data.mEmitData)
|
|
|
{
|
|
|
emitAnchorIds[emitData.mAnchorId] = (.)@emitData.Index;
|
|
|
- if (resolveType == .None)
|
|
|
+ if (resolveType == null)
|
|
|
+ {
|
|
|
+ // Do nothing
|
|
|
+ }
|
|
|
+ else if (resolveType == .None)
|
|
|
emitData.mIncludedInResolveAll = false;
|
|
|
else
|
|
|
emitData.mIncludedInClassify = false;
|
|
@@ -6491,6 +6588,7 @@ namespace IDE.ui
|
|
|
emitData.mOnlyInResolveAll = resolveType == .None;
|
|
|
emitData.mIncludedInClassify = resolveType != .None;
|
|
|
emitData.mIncludedInResolveAll = resolveType == .None;
|
|
|
+ emitData.mIncludedInBuild = resolveType == null;
|
|
|
|
|
|
if (emitData.mAnchorIdx == -1)
|
|
|
{
|
|
@@ -6508,8 +6606,14 @@ namespace IDE.ui
|
|
|
{
|
|
|
curEmitData.mIncludedInResolveAll = true;
|
|
|
}
|
|
|
+ else if ((wantsBuildEmits) && (resolveType != null))
|
|
|
+ {
|
|
|
+ curEmitData.mIncludedInBuild |= emitData.mIncludedInBuild;
|
|
|
+ curEmitData.mIncludedInClassify |= emitData.mIncludedInClassify;
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
+ emitData.mIncludedInBuild |= curEmitData.mIncludedInBuild;
|
|
|
emitData.mIncludedInClassify |= curEmitData.mIncludedInClassify;
|
|
|
curEmitData = emitData;
|
|
|
}
|
|
@@ -6517,12 +6621,19 @@ namespace IDE.ui
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
+ if ((wantsBuildEmits) && (resolveType != null))
|
|
|
+ {
|
|
|
+ // Not included in the build emit data - just show as a marker
|
|
|
+ emitData.mStartLine = 0;
|
|
|
+ emitData.mEndLine = 0;
|
|
|
+ }
|
|
|
+
|
|
|
//Debug.WriteLine($" New emit AnchorIdx:{emitData.mAnchorIdx} AnchorId:{emitData.mAnchorId} CurTextVersion:{textVersion} FoundTextVersion:{foundTextVersion}");
|
|
|
data.mEmitData.Add(emitData);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if (resolveType == .None)
|
|
|
+ if ((resolveType == null) || (resolveType == .None))
|
|
|
continue;
|
|
|
|
|
|
CollapseData collapseData;
|
|
@@ -6554,7 +6665,11 @@ namespace IDE.ui
|
|
|
|
|
|
for (var emitData in ref data.mEmitData)
|
|
|
{
|
|
|
- if (((emitData.mOnlyInResolveAll) && (!emitData.mIncludedInResolveAll)) ||
|
|
|
+ if ((emitData.mIncludedInBuild) && (gApp.mSettings.mEditorSettings.mEmitCompiler == .Build))
|
|
|
+ {
|
|
|
+ // Allow build-only markers to survive
|
|
|
+ }
|
|
|
+ else if (((emitData.mOnlyInResolveAll) && (!emitData.mIncludedInResolveAll)) ||
|
|
|
((!emitData.mOnlyInResolveAll) && (!emitData.mIncludedInClassify)))
|
|
|
{
|
|
|
@emitData.RemoveFast();
|