From d0e83321500c3cbf1207c09142203a3731af6f40 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 21 Dec 2019 05:48:44 -0800 Subject: [PATCH] Fixed some tooltips, added Link Dependencies, more int-ness --- Beef.sln | 8 +- BeefLibs/Beefy2D/BeefProj.toml | 5 +- BeefLibs/Beefy2D/src/BFWindow.bf | 11 +- BeefLibs/Beefy2D/src/Utils.bf | 2 +- .../Beefy2D/src/theme/dark/DarkTabbedView.bf | 4 +- BeefLibs/Beefy2D/src/utils/StructuredData.bf | 13 +- BeefLibs/Beefy2D/src/widgets/Composition.bf | 8 +- BeefLibs/Beefy2D/src/widgets/DockingFrame.bf | 2 +- BeefLibs/Beefy2D/src/widgets/ListView.bf | 8 +- BeefLibs/Beefy2D/src/widgets/Widget.bf | 4 + BeefLibs/Beefy2D/src/widgets/WidgetWindow.bf | 95 ++--- .../corlib/src/Collections/Generic/List.bf | 18 +- BeefLibs/corlib/src/Event.bf | 23 +- BeefLibs/corlib/src/Reflection/MethodInfo.bf | 6 +- BeefLibs/corlib/src/Result.bf | 8 + BeefLibs/corlib/src/Type.bf | 1 + BeefLibs/corlib/src/Windows.bf | 2 +- BeefySysLib/BeefySysLib.vcxproj | 7 +- BeefySysLib/BeefySysLib_static.vcxproj | 8 +- IDE/BeefProj.toml | 4 +- IDE/mintest/mintest2/src/main4.bf | 2 +- IDE/mintest/src/main.bf | 2 +- IDE/mintest/src/main3.bf | 332 +----------------- IDE/src/BuildContext.bf | 13 +- IDE/src/IDEApp.bf | 4 +- IDE/src/Project.bf | 5 + IDE/src/ui/DisassemblyPanel.bf | 1 + IDE/src/ui/ProjectProperties.bf | 3 +- IDE/src/ui/ThreadPanel.bf | 9 +- IDE/src/ui/WatchPanel.bf | 4 +- 30 files changed, 180 insertions(+), 432 deletions(-) diff --git a/Beef.sln b/Beef.sln index ffa78f90..b010e854 100644 --- a/Beef.sln +++ b/Beef.sln @@ -99,7 +99,6 @@ Global {F8D29C38-D37C-4AF2-8540-2F6E543264F1}.Debug|x64.ActiveCfg = Debug|x64 {F8D29C38-D37C-4AF2-8540-2F6E543264F1}.Debug|x64.Build.0 = Debug|x64 {F8D29C38-D37C-4AF2-8540-2F6E543264F1}.Debug|x86.ActiveCfg = Debug|Win32 - {F8D29C38-D37C-4AF2-8540-2F6E543264F1}.Debug|x86.Build.0 = Debug|Win32 {F8D29C38-D37C-4AF2-8540-2F6E543264F1}.Release Static CStatic|x64.ActiveCfg = Release_NoDbgInfo|x64 {F8D29C38-D37C-4AF2-8540-2F6E543264F1}.Release Static CStatic|x86.ActiveCfg = Release_NoDbgInfo|Win32 {F8D29C38-D37C-4AF2-8540-2F6E543264F1}.Release Static CStatic|x86.Build.0 = Release_NoDbgInfo|Win32 @@ -198,7 +197,6 @@ Global {53609BB3-D874-465C-AF7B-DF626DB0D89B}.Debug|x64.ActiveCfg = Debug|x64 {53609BB3-D874-465C-AF7B-DF626DB0D89B}.Debug|x64.Build.0 = Debug|x64 {53609BB3-D874-465C-AF7B-DF626DB0D89B}.Debug|x86.ActiveCfg = Debug|Win32 - {53609BB3-D874-465C-AF7B-DF626DB0D89B}.Debug|x86.Build.0 = Debug|Win32 {53609BB3-D874-465C-AF7B-DF626DB0D89B}.Release Static CStatic|x64.ActiveCfg = Release_dll|x64 {53609BB3-D874-465C-AF7B-DF626DB0D89B}.Release Static CStatic|x86.ActiveCfg = Release_dll|Win32 {53609BB3-D874-465C-AF7B-DF626DB0D89B}.Release Static CStatic|x86.Build.0 = Release_dll|Win32 @@ -231,7 +229,6 @@ Global {29025CF2-07CC-4C25-A672-6324C95AA28E}.Debug|x64.ActiveCfg = Debug|x64 {29025CF2-07CC-4C25-A672-6324C95AA28E}.Debug|x64.Build.0 = Debug|x64 {29025CF2-07CC-4C25-A672-6324C95AA28E}.Debug|x86.ActiveCfg = Debug|Win32 - {29025CF2-07CC-4C25-A672-6324C95AA28E}.Debug|x86.Build.0 = Debug|Win32 {29025CF2-07CC-4C25-A672-6324C95AA28E}.Release Static CStatic|x64.ActiveCfg = Release|x64 {29025CF2-07CC-4C25-A672-6324C95AA28E}.Release Static CStatic|x86.ActiveCfg = Release|Win32 {29025CF2-07CC-4C25-A672-6324C95AA28E}.Release Static CStatic|x86.Build.0 = Release|Win32 @@ -266,7 +263,6 @@ Global {29025CF2-07CC-4C25-A672-6324C95AA28F}.Debug|x64.ActiveCfg = Debug|x64 {29025CF2-07CC-4C25-A672-6324C95AA28F}.Debug|x64.Build.0 = Debug|x64 {29025CF2-07CC-4C25-A672-6324C95AA28F}.Debug|x86.ActiveCfg = Debug|Win32 - {29025CF2-07CC-4C25-A672-6324C95AA28F}.Debug|x86.Build.0 = Debug|Win32 {29025CF2-07CC-4C25-A672-6324C95AA28F}.Release Static CStatic|x64.ActiveCfg = Release|x64 {29025CF2-07CC-4C25-A672-6324C95AA28F}.Release Static CStatic|x86.ActiveCfg = Release|Win32 {29025CF2-07CC-4C25-A672-6324C95AA28F}.Release Static CStatic|x86.Build.0 = Release|Win32 @@ -301,7 +297,6 @@ Global {78BE2825-EF6A-4C57-B22D-FF69EB925359}.Debug|x64.ActiveCfg = Debug|x64 {78BE2825-EF6A-4C57-B22D-FF69EB925359}.Debug|x64.Build.0 = Debug|x64 {78BE2825-EF6A-4C57-B22D-FF69EB925359}.Debug|x86.ActiveCfg = Debug|Win32 - {78BE2825-EF6A-4C57-B22D-FF69EB925359}.Debug|x86.Build.0 = Debug|Win32 {78BE2825-EF6A-4C57-B22D-FF69EB925359}.Release Static CStatic|x64.ActiveCfg = Release|x64 {78BE2825-EF6A-4C57-B22D-FF69EB925359}.Release Static CStatic|x86.ActiveCfg = Release|Win32 {78BE2825-EF6A-4C57-B22D-FF69EB925359}.Release Static CStatic|x86.Build.0 = Release|Win32 @@ -336,7 +331,6 @@ Global {755663F3-7C3F-4321-ABFF-CB036C0F2C9F}.Debug|x64.ActiveCfg = Debug|x64 {755663F3-7C3F-4321-ABFF-CB036C0F2C9F}.Debug|x64.Build.0 = Debug|x64 {755663F3-7C3F-4321-ABFF-CB036C0F2C9F}.Debug|x86.ActiveCfg = Debug|Win32 - {755663F3-7C3F-4321-ABFF-CB036C0F2C9F}.Debug|x86.Build.0 = Debug|Win32 {755663F3-7C3F-4321-ABFF-CB036C0F2C9F}.Release Static CStatic|x64.ActiveCfg = Release|x64 {755663F3-7C3F-4321-ABFF-CB036C0F2C9F}.Release Static CStatic|x86.ActiveCfg = Release|Win32 {755663F3-7C3F-4321-ABFF-CB036C0F2C9F}.Release Static CStatic|x86.Build.0 = Release|Win32 @@ -396,7 +390,7 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - VD_Solution = |§r|§n|§r|§n |§r|§n X86|§r|§n |§r|§n SolutionGuid = {460361DC-9F40-4AE7-B647-82D5D69B70DC} + VD_Solution = |§r|§n|§r|§n |§r|§n X86|§r|§n |§r|§n EndGlobalSection EndGlobal diff --git a/BeefLibs/Beefy2D/BeefProj.toml b/BeefLibs/Beefy2D/BeefProj.toml index f72b6a41..cb191cbf 100644 --- a/BeefLibs/Beefy2D/BeefProj.toml +++ b/BeefLibs/Beefy2D/BeefProj.toml @@ -5,9 +5,9 @@ Name = "Beefy2D" DefaultNamespace = "" [Configs.Debug.Win32] -OtherLinkFlags = "" +OtherLinkFlags = "$(LinkFlags) \"$(ProjectDir)/dist/BeefySysLib32_d.lib\"" +PostBuildCmds = ["CopyToDependents(\"$(ProjectDir)/dist/BeefySysLib32_d.dll\")", "CopyToDependents(\"$(ProjectDir)/dist/BeefySysLib32_d.pdb\")"] PreprocessorMacros = ["DEBUG", "BF32"] -OptimizationLevel = "O0" [Configs.Debug.Win64] OtherLinkFlags = "$(LinkFlags) \"$(ProjectDir)/dist/BeefySysLib64_d.lib\"" @@ -18,7 +18,6 @@ PostBuildCmds = ["CopyToDependents(\"$(ProjectDir)/dist/BeefySysLib64_d.dll\")", [Configs.Release.Win32] OtherLinkFlags = "" PreprocessorMacros = ["RELEASE", "BF32"] -OptimizationLevel = "O0" [Configs.Release.Win64] OtherLinkFlags = "$(LinkFlags) $(ProjectDir)/dist/BeefySysLib64.lib" diff --git a/BeefLibs/Beefy2D/src/BFWindow.bf b/BeefLibs/Beefy2D/src/BFWindow.bf index 3e9d9d42..02778bc1 100644 --- a/BeefLibs/Beefy2D/src/BFWindow.bf +++ b/BeefLibs/Beefy2D/src/BFWindow.bf @@ -490,15 +490,20 @@ namespace Beefy BFWindow_SetMinimumSize(mNativeWindow, minWidth, minHeight, clientSized); } - public virtual void Moved() - { - BFWindow_GetPosition(mNativeWindow, out mX, out mY, out mWindowWidth, out mWindowHeight, out mClientX, out mClientY, out mClientWidth, out mClientHeight); + public virtual void RehupSize() + { + BFWindow_GetPosition(mNativeWindow, out mX, out mY, out mWindowWidth, out mWindowHeight, out mClientX, out mClientY, out mClientWidth, out mClientHeight); int32 showKind = 0; BFWindow_GetPlacement(mNativeWindow, out mNormX, out mNormY, out mNormWidth, out mNormHeight, out showKind); mShowKind = (.)showKind; mIsDirty = true; + } + + public virtual void Moved() + { + RehupSize(); } public virtual void SetClientPosition(float x, float y) diff --git a/BeefLibs/Beefy2D/src/Utils.bf b/BeefLibs/Beefy2D/src/Utils.bf index 6319db24..87c322d8 100644 --- a/BeefLibs/Beefy2D/src/Utils.bf +++ b/BeefLibs/Beefy2D/src/Utils.bf @@ -181,7 +181,7 @@ namespace Beefy Thread.Sleep(20); } - int fileLen = sr.Length; + int fileLen = (.)sr.Length; if (sr.TryRead(.((.)outBuffer.PrepareBuffer(fileLen), fileLen)) case .Err(let readErr)) return .Err(.FileReadError(readErr)); diff --git a/BeefLibs/Beefy2D/src/theme/dark/DarkTabbedView.bf b/BeefLibs/Beefy2D/src/theme/dark/DarkTabbedView.bf index 0dc2b056..91ef6d4c 100644 --- a/BeefLibs/Beefy2D/src/theme/dark/DarkTabbedView.bf +++ b/BeefLibs/Beefy2D/src/theme/dark/DarkTabbedView.bf @@ -721,10 +721,10 @@ namespace Beefy.theme.dark TabButton foundTab = FindWidgetByCoords(x, y) as TabButton; if ((foundTab != null) && (foundTab != dockable)) { - int32 foundIndex = mTabs.IndexOf(foundTab); + int foundIndex = mTabs.IndexOf(foundTab); if (foundIndex != -1) { - int32 dragIndex = mTabs.IndexOf((TabButton)dockable); + int dragIndex = mTabs.IndexOf((TabButton)dockable); mTabs[dragIndex] = mTabs[foundIndex]; mTabs[foundIndex] = (TabButton)dockable; diff --git a/BeefLibs/Beefy2D/src/utils/StructuredData.bf b/BeefLibs/Beefy2D/src/utils/StructuredData.bf index 0417c93a..b776dbe7 100644 --- a/BeefLibs/Beefy2D/src/utils/StructuredData.bf +++ b/BeefLibs/Beefy2D/src/utils/StructuredData.bf @@ -1409,8 +1409,7 @@ namespace Beefy.utils { bool forceAllInline = namedValues is InlineNamedValues; - //bool needsHeader = false; - if ((!outStr.IsEmpty) || (nameStack.Count > 0)) + /*if ((!outStr.IsEmpty) || (nameStack.Count > 0)) { int valueIdx = namedValues.mValueIdx; @@ -1432,7 +1431,9 @@ namespace Beefy.utils if (needsHeader) EncodeHeader(); - } + }*/ + + bool needsHeader = ((!outStr.IsEmpty) || (nameStack.Count > 0)); for (int pass = 0; pass < 2; pass++) { @@ -1484,6 +1485,12 @@ namespace Beefy.utils if (doValuesInline && isInlinePass) { + if (needsHeader) + { + EncodeHeader(); + needsHeader = false; + } + EncodeName(key); outStr.Append(" = "); EncodeObject(value); diff --git a/BeefLibs/Beefy2D/src/widgets/Composition.bf b/BeefLibs/Beefy2D/src/widgets/Composition.bf index 6ee1c20a..64a61ca7 100644 --- a/BeefLibs/Beefy2D/src/widgets/Composition.bf +++ b/BeefLibs/Beefy2D/src/widgets/Composition.bf @@ -59,7 +59,7 @@ namespace Beefy.widgets entry.mFrame = frame; entry.mValue = value; - int32 index = mEntries.BinarySearch(entry, sEntryComparer); + int index = mEntries.BinarySearch(entry, sEntryComparer); if (index >= 0) { isNewKeyframe = false; @@ -80,7 +80,7 @@ namespace Beefy.widgets entry.mFrame = frame; entry.mValue = default(T); - int32 index = mEntries.BinarySearch(entry, sEntryComparer); + int index = mEntries.BinarySearch(entry, sEntryComparer); mEntries.RemoveAt(index); } @@ -112,7 +112,7 @@ namespace Beefy.widgets Entry find; find.mValue = default(T); find.mFrame = frame; - int32 index = mEntries.BinarySearch(find, sEntryComparer); + int index = mEntries.BinarySearch(find, sEntryComparer); if (index >= 0) return mEntries[index].mValue; @@ -589,7 +589,7 @@ namespace Beefy.widgets if (childInst.mItemDef.mFollowingItemDef != null) { - int32 followingIdx = mItemDef.mChildItemDefs.IndexOf(childInst.mItemDef.mFollowingItemDef); + int followingIdx = mItemDef.mChildItemDefs.IndexOf(childInst.mItemDef.mFollowingItemDef); data.Add("Follow", followingIdx); } diff --git a/BeefLibs/Beefy2D/src/widgets/DockingFrame.bf b/BeefLibs/Beefy2D/src/widgets/DockingFrame.bf index 8581c431..c970b308 100644 --- a/BeefLibs/Beefy2D/src/widgets/DockingFrame.bf +++ b/BeefLibs/Beefy2D/src/widgets/DockingFrame.bf @@ -266,7 +266,7 @@ namespace Beefy.widgets // Used when an embedded docking frame gets down to just a single widget public virtual void ReplaceDockedWidget(DockedWidget dockedWidget, DockedWidget replaceWidget) { - int32 index = mDockedWidgets.IndexOf(dockedWidget); + int index = mDockedWidgets.IndexOf(dockedWidget); RemoveWidget(dockedWidget); mDockedWidgets[index] = replaceWidget; AddWidget(replaceWidget); diff --git a/BeefLibs/Beefy2D/src/widgets/ListView.bf b/BeefLibs/Beefy2D/src/widgets/ListView.bf index 1aa4e570..0728eefe 100644 --- a/BeefLibs/Beefy2D/src/widgets/ListView.bf +++ b/BeefLibs/Beefy2D/src/widgets/ListView.bf @@ -487,7 +487,7 @@ namespace Beefy.widgets return CreateChildItemAtIndex((mChildItems != null) ? mChildItems.Count : 0); } - public int32 GetIndexOfChild(ListViewItem item) + public int GetIndexOfChild(ListViewItem item) { return mChildItems.IndexOf(item); } @@ -508,7 +508,7 @@ namespace Beefy.widgets public virtual void RemoveChildItem(ListViewItem item, bool deleteItem = true) { - int32 idx = mChildItems.IndexOf(item); + int idx = mChildItems.IndexOf(item); RemoveChildItemAt(idx, deleteItem); } @@ -899,7 +899,7 @@ namespace Beefy.widgets for (int32 i = 0; i < numIterations; i++) KeyDown(KeyCode.Down, false); case KeyCode.Up: - int32 idx = selectedItem.mParentItem.mChildItems.IndexOf(selectedItem); + int idx = selectedItem.mParentItem.mChildItems.IndexOf(selectedItem); if (idx > 0) { newSelection = selectedItem.mParentItem.mChildItems[idx - 1]; @@ -919,7 +919,7 @@ namespace Beefy.widgets while (selectedItem != mRoot) { var childItems = selectedItem.mParentItem.mChildItems; - int32 idx = childItems.IndexOf(selectedItem); + int idx = childItems.IndexOf(selectedItem); if (idx < childItems.Count - 1) { newSelection = childItems[idx + 1]; diff --git a/BeefLibs/Beefy2D/src/widgets/Widget.bf b/BeefLibs/Beefy2D/src/widgets/Widget.bf index a4a96a59..b1128e9b 100644 --- a/BeefLibs/Beefy2D/src/widgets/Widget.bf +++ b/BeefLibs/Beefy2D/src/widgets/Widget.bf @@ -424,6 +424,8 @@ namespace Beefy.widgets Widget child = mChildWidgets[anIdx]; Debug.Assert(child.mParent == this); + int startDepth = g.mMatrixStackIdx; + if (child.mTransformData != null) { Matrix m = child.Transform; @@ -437,6 +439,8 @@ namespace Beefy.widgets child.DrawAll(g); g.PopMatrix(); + + Debug.Assert(startDepth == g.mMatrixStackIdx); } } diff --git a/BeefLibs/Beefy2D/src/widgets/WidgetWindow.bf b/BeefLibs/Beefy2D/src/widgets/WidgetWindow.bf index 4b1bf79e..5604300a 100644 --- a/BeefLibs/Beefy2D/src/widgets/WidgetWindow.bf +++ b/BeefLibs/Beefy2D/src/widgets/WidgetWindow.bf @@ -108,7 +108,7 @@ namespace Beefy.widgets mRootWidget.mWidgetWindow = this; mRootWidget.InitChildren(); mRootWidget.AddedToParent(); - Moved(); // Rehup size + RehupSize(); } } @@ -192,52 +192,58 @@ namespace Beefy.widgets { base.PreDraw(g); - g.mMatrix.Set(mScaleMatrix); + g.mMatrix.Set(mScaleMatrix); + g.mMatrixStack[g.mMatrixStackIdx] = g.mMatrix; } + public override void RehupSize() + { + base.RehupSize(); + + if (mWindowFlags.HasFlag(Flags.ScaleContent)) + { + float scaleX = mClientWidth / (float)mContentClientWidth; + float scaleY = mClientHeight / (float)mContentClientHeight; + + if (scaleX > scaleY) + { + float scale = scaleY; + mScaleMatrix.a = scale; + mScaleMatrix.b = 0; + mScaleMatrix.c = 0; + mScaleMatrix.d = scale; + mScaleMatrix.tx = (int32)(mClientWidth - (scale * mContentClientWidth)) / 2; + mScaleMatrix.ty = 0; + } + else + { + float scale = scaleX; + mScaleMatrix.a = scale; + mScaleMatrix.b = 0; + mScaleMatrix.c = 0; + mScaleMatrix.d = scale; + mScaleMatrix.tx = 0; + mScaleMatrix.ty = (int32)(mClientHeight - (scale * mContentClientHeight)) / 2; + } + + mInvScaleMatrix.Set(mScaleMatrix); + mInvScaleMatrix.Invert(); + mRootWidget.Resize(0, 0, mContentClientWidth, mContentClientHeight); + } + else + { + mInvScaleMatrix = Matrix.IdentityMatrix; + mScaleMatrix = Matrix.IdentityMatrix; + mContentClientWidth = mClientWidth; + mContentClientHeight = mClientHeight; + mRootWidget.Resize(0, 0, mClientWidth, mClientHeight); + } + } + public override void Moved() { base.Moved(); - if (mWindowFlags.HasFlag(Flags.ScaleContent)) - { - float scaleX = mClientWidth / (float)mContentClientWidth; - float scaleY = mClientHeight / (float)mContentClientHeight; - - if (scaleX > scaleY) - { - float scale = scaleY; - mScaleMatrix.a = scale; - mScaleMatrix.b = 0; - mScaleMatrix.c = 0; - mScaleMatrix.d = scale; - mScaleMatrix.tx = (int32)(mClientWidth - (scale * mContentClientWidth)) / 2; - mScaleMatrix.ty = 0; - } - else - { - float scale = scaleX; - mScaleMatrix.a = scale; - mScaleMatrix.b = 0; - mScaleMatrix.c = 0; - mScaleMatrix.d = scale; - mScaleMatrix.tx = 0; - mScaleMatrix.ty = (int32)(mClientHeight - (scale * mContentClientHeight)) / 2; - } - - mInvScaleMatrix.Set(mScaleMatrix); - mInvScaleMatrix.Invert(); - mRootWidget.Resize(0, 0, mContentClientWidth, mContentClientHeight); - } - else - { - mInvScaleMatrix = Matrix.IdentityMatrix; - mScaleMatrix = Matrix.IdentityMatrix; - mContentClientWidth = mClientWidth; - mContentClientHeight = mClientHeight; - mRootWidget.Resize(0, 0, mClientWidth, mClientHeight); - } - mOnWindowMoved(this); sOnWindowMoved(this); } @@ -755,5 +761,12 @@ namespace Beefy.widgets newMouseWindow.CaptureMouse(); mMouseFlags = default; } + + public void SetContentSize(int width, int height) + { + mContentClientWidth = (.)width; + mContentClientHeight = (.)height; + RehupSize(); + } } } diff --git a/BeefLibs/corlib/src/Collections/Generic/List.bf b/BeefLibs/corlib/src/Collections/Generic/List.bf index d5b32f60..ebf364de 100644 --- a/BeefLibs/corlib/src/Collections/Generic/List.bf +++ b/BeefLibs/corlib/src/Collections/Generic/List.bf @@ -418,36 +418,36 @@ namespace System.Collections.Generic return Enumerator(this); } - public int_cosize FindIndex(Predicate match) + public int FindIndex(Predicate match) { - for (int_cosize i = 0; i < mSize; i++) + for (int i = 0; i < mSize; i++) if (match(mItems[i])) return i; return -1; } - public int_cosize IndexOf(T item) + public int IndexOf(T item) { //return Array.IndexOf(mItems, item, 0, mSize); for (int i = 0; i < mSize; i++) if (mItems[i] == item) - return (int_cosize)i; + return i; return -1; } - public int_cosize IndexOf(T item, int index) + public int IndexOf(T item, int index) { for (int i = index; i < mSize; i++) if (mItems[i] == item) - return (int_cosize)i; + return i; return -1; } - public int_cosize IndexOf(T item, int index, int count) + public int IndexOf(T item, int index, int count) { for (int i = index; i < index + count; i++) if (mItems[i] == item) - return (int_cosize)i; + return i; return -1; } @@ -571,7 +571,7 @@ namespace System.Collections.Generic public bool Remove(T item) { - int_cosize index = IndexOf(item); + int index = IndexOf(item); if (index >= 0) { RemoveAt(index); diff --git a/BeefLibs/corlib/src/Event.bf b/BeefLibs/corlib/src/Event.bf index 0e5941dc..b319629d 100644 --- a/BeefLibs/corlib/src/Event.bf +++ b/BeefLibs/corlib/src/Event.bf @@ -26,7 +26,26 @@ namespace System } } - public int32 Count + public bool IsEmpty + { + get + { + Object data = Internal.UnsafeCastToObject((void*)(mData & sDataMask)); + + if (data == null) + return true; + + var type = data.GetType(); + if (type == typeof(List)) + { + var list = (List)data; + return list.Count == 0; + } + return false; + } + } + + public int Count { get { @@ -39,7 +58,7 @@ namespace System if (type == typeof(List)) { var list = (List)data; - return (int32)list.Count; + return list.Count; } return 1; } diff --git a/BeefLibs/corlib/src/Reflection/MethodInfo.bf b/BeefLibs/corlib/src/Reflection/MethodInfo.bf index 83e69cac..3ed71c68 100644 --- a/BeefLibs/corlib/src/Reflection/MethodInfo.bf +++ b/BeefLibs/corlib/src/Reflection/MethodInfo.bf @@ -80,8 +80,10 @@ namespace System.Reflection var retType = Type.GetType(mMethodData.mReturnType); FFIABI abi = .Default; -#if BF_PLATFORM_WINDOWS - if (mMethodData.mFlags.HasFlag(.StdCall)) +#if BF_PLATFORM_WINDOWS && BF_32_BIT + if (mMethodData.mFlags.HasFlag(.ThisCall)) + abi = .ThisCall; + else if (!mMethodData.mFlags.HasFlag(.Static)) abi = .StdCall; #endif diff --git a/BeefLibs/corlib/src/Result.bf b/BeefLibs/corlib/src/Result.bf index 15725a3c..cbcac80f 100644 --- a/BeefLibs/corlib/src/Result.bf +++ b/BeefLibs/corlib/src/Result.bf @@ -110,6 +110,14 @@ namespace System } } + public T Value + { + get + { + return Unwrap(); + } + } + public static implicit operator Result(T value) { return .Ok(value); diff --git a/BeefLibs/corlib/src/Type.bf b/BeefLibs/corlib/src/Type.bf index ff103f96..1340df33 100644 --- a/BeefLibs/corlib/src/Type.bf +++ b/BeefLibs/corlib/src/Type.bf @@ -902,6 +902,7 @@ namespace System.Reflection SpecialName = 0x0800, // Method is special. Name describes how. StdCall = 0x1000, FastCall = 0x2000, + ThisCall = 0x3000, // Purposely resuing StdCall|FastCall Mutating = 0x4000 } } diff --git a/BeefLibs/corlib/src/Windows.bf b/BeefLibs/corlib/src/Windows.bf index 5cb91449..4bf8d024 100644 --- a/BeefLibs/corlib/src/Windows.bf +++ b/BeefLibs/corlib/src/Windows.bf @@ -1373,7 +1373,7 @@ namespace System [CLink, StdCall] public static extern HWnd GetActiveWindow(); - [CLink, StdCall] + [Import("user32.lib"), CLink, StdCall] public static extern HWnd SetActiveWindow(HWnd wnd); [CLink, StdCall] diff --git a/BeefySysLib/BeefySysLib.vcxproj b/BeefySysLib/BeefySysLib.vcxproj index c5c09bac..9af09ff5 100644 --- a/BeefySysLib/BeefySysLib.vcxproj +++ b/BeefySysLib/BeefySysLib.vcxproj @@ -184,13 +184,14 @@ Level3 Disabled - BFP_NOEXPORT;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;BFSYSLIB_DYNAMIC;BF_NO_FBX;%(PreprocessorDefinitions) - ./;./platform/win/;./platform/sdl/;third_party/agg-2.4/include;third_party/agg-2.4/include/platform/win32;third_party/;third_party/libffi/i686-pc-cygwin;third_party/libffi/i686-pc-cygwin/include;third_party/libffi/include;third_party/SDL2-2.0.1/include;../extern/fbxsdk/include + BP_DYNAMIC;BFP_NOEXPORT;WIN32;_DEBUG;_WINDOWS;_USRDLL;BFSYSLIB_DYNAMIC;BF_NO_FBX;FT2_BUILD_LIBRARY;%(PreprocessorDefinitions) + ./;./platform/win/;./platform/sdl/;third_party/agg-2.4/include;third_party/agg-2.4/include/platform/win32;third_party/;third_party/libffi/i686-pc-cygwin;third_party/libffi/i686-pc-cygwin/include;third_party/libffi/include;third_party/SDL2-2.0.1/include;../extern/fbxsdk/include;third_party/freetype/include MultiThreadedDebugDLL + false Windows - true + DebugFull $(OutDir)$(TargetName)$(TargetExt) ../extern/fbxsdk/lib/vs2012/x86/debug imm32.lib;version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) diff --git a/BeefySysLib/BeefySysLib_static.vcxproj b/BeefySysLib/BeefySysLib_static.vcxproj index 139ba673..dbc310a0 100644 --- a/BeefySysLib/BeefySysLib_static.vcxproj +++ b/BeefySysLib/BeefySysLib_static.vcxproj @@ -99,9 +99,9 @@ Level3 Disabled - _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;BFSYSLIB_DYNAMIC;%(PreprocessorDefinitions) - ./;./platform/win/;./platform/sdl/;third_party/agg-2.4/include;third_party/agg-2.4/include/platform/win32;third_party/;third_party/libffi/i686-pc-cygwin;third_party/libffi/i686-pc-cygwin/include;third_party/libffi/include;third_party/SDL2-2.0.1/include;../extern/fbxsdk/include - MultiThreadedDebugDLL + BFP_INTERNAL;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;BF_NO_FBX;%(PreprocessorDefinitions) + ./;./platform/win/;./platform/sdl/;third_party/agg-2.4/include;third_party/agg-2.4/include/platform/win32;third_party/;third_party/libffi/i686-pc-cygwin;third_party/libffi/i686-pc-cygwin/include;third_party/libffi/include;third_party/SDL2-2.0.1/include;../extern/fbxsdk/include;third_party/freetype/include + MultiThreadedDebug Windows @@ -141,7 +141,7 @@ true true _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;BFSYSLIB_DYNAMIC;%(PreprocessorDefinitions) - MultiThreadedDLL + MultiThreaded ./; ./platform/win/; ./platform/sdl/; third_party/agg-2.4/include; third_party/agg-2.4/include/platform/win32; third_party/; third_party/libffi/i686-pc-cygwin; third_party/libffi/i686-pc-cygwin/include; third_party/libffi/include; third_party/SDL2-2.0.1/include;;../extern/fbxsdk/include diff --git a/IDE/BeefProj.toml b/IDE/BeefProj.toml index c45095ed..37677892 100644 --- a/IDE/BeefProj.toml +++ b/IDE/BeefProj.toml @@ -25,7 +25,7 @@ OtherLinkFlags = "" TargetDirectory = "$(WorkspaceDir)/dist" TargetName = "BeefIDE_d" OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib" -DebugCommandArguments = "-workspace=C:\\Beef\\IDEHelper\\Tests" +DebugCommandArguments = "-workspace=C:\\Proj\\CycloBuddy" DebugWorkingDirectory = "c:\\Beef\\IDE\\Tests\\EmptyTest" EnvironmentVars = ["_NO_DEBUG_HEAP=1"] @@ -49,7 +49,7 @@ OtherLinkFlags = "" TargetDirectory = "$(WorkspaceDir)/dist" TargetName = "BeefIDE_d2" OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib BeefySysLib64_d.lib wsock32.lib" -DebugCommandArguments = "-proddir=C:\\Beef\\IDE\\mintest" +DebugCommandArguments = "-proddir=C:\\Beef\\IDEHelper\\Tests" DebugWorkingDirectory = "$(ProjectDir)\\dist" EnvironmentVars = ["_NO_DEBUG_HEAP=1"] diff --git a/IDE/mintest/mintest2/src/main4.bf b/IDE/mintest/mintest2/src/main4.bf index 417caab0..61e758b5 100644 --- a/IDE/mintest/mintest2/src/main4.bf +++ b/IDE/mintest/mintest2/src/main4.bf @@ -1,2 +1,2 @@ using System; - +using System.Diagnostics; diff --git a/IDE/mintest/src/main.bf b/IDE/mintest/src/main.bf index 6adfc2b1..9dde9452 100644 --- a/IDE/mintest/src/main.bf +++ b/IDE/mintest/src/main.bf @@ -229,7 +229,7 @@ namespace Hey.Dude.Bro PrintF("Hey\n"); - Test2(1, 2, 3, 4); + //Test2(1, 2, 3, 4); /*IHashable ih = (int32)TypeCode.Boolean; let hashCode = ih.GetHashCode();*/ diff --git a/IDE/mintest/src/main3.bf b/IDE/mintest/src/main3.bf index f560f57d..c4d99ccc 100644 --- a/IDE/mintest/src/main3.bf +++ b/IDE/mintest/src/main3.bf @@ -6,342 +6,12 @@ using System.Collections.Generic; using System.Diagnostics; using System.Threading; -//#define A -//#define B - -struct StructA -{ - public int mA; - - public static StructA operator+(StructA lhs, float rhs) - { - StructA newVal = .(); - newVal.mA = lhs.mA + (int)rhs; - return newVal; - } -} - -struct StructB -{ - public int mA; - - public static bool operator==(StructA lhs, StructB rhs) - { - return lhs.mA == rhs.mA; - } -} - - -struct StructC -{ - public int mA; - - public static operator StructD(StructC val) - { - StructD conv; - conv.mA = val.mA; - return conv; - } -} - -struct StructD -{ - public int mA; - - public static operator StructD(StructC val) - { - StructC conv; - conv.mA = val.mA; - return conv; - } -} - -struct StructE -{ - public int mA; - - public static operator StructD(StructE val) - { - StructC conv; - conv.mA = val.mA; - return conv; - } -} - -class ClassA -{ - public int mA; -} - -struct StructK -{ - -} - -struct StructL : StructK -{ - public int mA; -} - -struct Checker -{ - public static int CheckIt(int* iPtr, int len) - { - int acc = 0; - for (int i < len) - { - acc += iPtr[i]; - } - return acc; - } - - public static int CheckItSpan(int* iPtr, int len) - { - Span span = .(iPtr, len); - - int acc = 0; - for (int i < len) - { - acc += span[i]; - } - return acc; - } - - public static int CheckItSpanOpt(int* iPtr, int len) - { - OptSpan span = .(iPtr, len); - - int acc = 0; - for (int i < len) - { - acc += span[i]; - } - return acc; - } -} - struct Blurg { - static int GetHash(T val) where T : IHashable - { - return val.GetHashCode(); - } - - public static int32 LongCall( - int abcdefghijklmnopqrstuvwxyz0, - int abcdefghijklmnopqrstuvwxyz1, - int abcdefghijklmnopqrstuvwxyz2, - int abcdefghijklmnopqrstuvwxyz3, - int abcdefghijklmnopqrstuvwxyz4, - int abcdefghijklmnopqrstuvwxyz5, - int abcdefghijklmnopqrstuvwxyz6, - int abcdefghijklmnopqrstuvwxyz7, - int abcdefghijklmnopqrstuvwxyz8, - int abcdefghijklmnopqrstuvwxyz9 - ) - { - return 0; - } - - static mixin ScopedAlloc(int size, int align) - { - //(void*)scope:mixin [Align(align)] uint8[size]* { ? } - } - - public static void TestAlloc() - { - int i = 1; - if (i == 1) - { - int size = 128; - scope:: int[size]*; - } - } - - struct StructA - { - public int[10] mA; - - public this() - { - mA = default; - void* v = &this; - } - } - - enum EnumA - { - case None; - case A(StructA sa); - } - - enum EnumB - { - case A; - case B(int a, int b); - } - - /*[DisableChecks] - public static float GetSum(float[TCount] vals) where TCount : const int - { - float total = 0; - for (int i < vals.Count) - total += vals[i]; - return total; - } - - public static void Max(T lhs, T rhs, TFunc func) where TFunc : delegate int(T lhs, T rhs) - { - - }*/ - - public struct Base - { - int32 mA; - int64 mB; - } - - public struct Derived : Base - { - int8 mC; - - public int GetC() - { - return mC + 10000; - } - } - - //static int[] gArr = new .(1, 2, 3, 4, 5, ); - - [Checked] - public static int32 GetVal() - { - return 1; - } - - [Unchecked] - public static int32 GetVal() - { - return 2; - } - - public static int32 GetVal2() - { - return 3; - } - - - public static void Test() - { - //Test_Start - Derived dr = .(); - dr.GetC(); - Int iVal = (.)123; - - int q = 999; - - //Test_End - } - - public static void Test2(int aa, int bb, int cc) - { - //Test_Start - Derived dr2 = .(); - Int iVal2 = (.)123; - - int q2 = 999; - - String str = scope .(); - - //Test_End - } - - public static void Recurse(int a) - { - int b = 234; - //Recurse_C - int c = 345; - - if (a == 10) - return; - - Recurse(a + 1); - int d = 100 + a; - } - - public static void Test3() - { - //BreakpointTester_Test - int a = 0; - int b = 0; - - while (a < 20) - { - //BreakpointTester_LoopA - a++; - } - - //BreakpointTester_Recurse - Recurse(0); - } - - public static void Test4() - { - //Test_Start - Derived dr = .(); - Int iVal = (.)123; - - int q = 999; - - //Test_End - } - - //[DisableObjectAccessChecks] - public static void Hey2() - { - String str = "Hey"; - //int len = str.[Friend, DisableObjectAccessChecks]PrivateLength; - int len = str.[DisableObjectAccessChecks]Length; - //int len = str.[Friend]GetLength(); - } - - public static mixin Florf(int a, int b) - { - - } - - class Zangles - { - public static int GetMe() - { - return 99; - } - } - - public static int sA = 123; - - /*public static void Test(T val) - { - - }*/ - - public static void Test(T val) where T : Span - { - - } - public static int32 Hey() { - Span valSpan = .(); - StringView sv = "Hey"; - - Span span = sv; - - Test(sv); - + return (int32)123; } - } - diff --git a/IDE/src/BuildContext.bf b/IDE/src/BuildContext.bf index 02fd8f28..d8f103e2 100644 --- a/IDE/src/BuildContext.bf +++ b/IDE/src/BuildContext.bf @@ -764,8 +764,17 @@ namespace IDE String cacheStr = scope String(); - void AddBuildFileDependency(StringView filePath) + void AddBuildFileDependency(StringView filePath, bool resolveString = false) { + var filePath; + + if ((resolveString) && (filePath.Contains('$'))) + { + String resolvedFilePath = scope:: String(); + gApp.ResolveConfigString(gApp.mPlatformName, workspaceOptions, project, options, filePath, "link flags", resolvedFilePath); + filePath = resolvedFilePath; + } + int64 fileTime = 0; if (!filePath.IsEmpty) fileTime = File.GetLastWriteTime(filePath).GetValueOrDefault().ToFileTime(); @@ -783,6 +792,8 @@ namespace IDE cacheStr.AppendF("Copyright\t{}\n", project.mWindowsOptions.mCopyright); cacheStr.AppendF("FileVersion\t{}\n", project.mWindowsOptions.mFileVersion); cacheStr.AppendF("ProductVersion\t{}\n", project.mWindowsOptions.mProductVersion); + for (var linkDep in options.mBuildOptions.mLinkDependencies) + AddBuildFileDependency(linkDep, true); String prevCacheStr = scope .(); gApp.mBfBuildCompiler.GetBuildValue(projectBuildDir, "Link", prevCacheStr); diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index 32b7deca..d209ec16 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -5798,7 +5798,7 @@ namespace IDE return sourceViewPanel; } - int32 GetRecentFilesIdx(String filePath) + int GetRecentFilesIdx(String filePath) { return mRecentlyDisplayedFiles.FindIndex(scope (item) => Path.Equals(item, filePath)); } @@ -6006,7 +6006,7 @@ namespace IDE if (tabbedView == null) return; - int32 recentFileIdx = -1; + int recentFileIdx = -1; if (sourceViewPanel != null) { sourceViewPanel.Dispose(); diff --git a/IDE/src/Project.bf b/IDE/src/Project.bf index 46368e15..c77172aa 100644 --- a/IDE/src/Project.bf +++ b/IDE/src/Project.bf @@ -1012,6 +1012,8 @@ namespace IDE [Reflect] public BuildCommandTrigger mBuildCommandsOnRun = .Always; [Reflect] + public List mLinkDependencies = new List() ~ DeleteContainerAndItems!(_); + [Reflect] public List mPreBuildCmds = new List() ~ DeleteContainerAndItems!(_); [Reflect] public List mPostBuildCmds = new List() ~ DeleteContainerAndItems!(_); @@ -1130,6 +1132,7 @@ namespace IDE Set!(newOptions.mBuildOptions.mTargetName, mBuildOptions.mTargetName); Set!(newOptions.mBuildOptions.mOtherLinkFlags, mBuildOptions.mOtherLinkFlags); Set!(newOptions.mBuildOptions.mCLibType, mBuildOptions.mCLibType); + Set!(newOptions.mBuildOptions.mLinkDependencies, mBuildOptions.mLinkDependencies); Set!(newOptions.mBuildOptions.mPreBuildCmds, mBuildOptions.mPreBuildCmds); Set!(newOptions.mBuildOptions.mPostBuildCmds, mBuildOptions.mPostBuildCmds); @@ -1518,6 +1521,7 @@ namespace IDE data.ConditionalAdd("StackSize", options.mBuildOptions.mStackSize, 0); data.ConditionalAdd("BuildCommandsOnCompile", options.mBuildOptions.mBuildCommandsOnCompile, .Always); data.ConditionalAdd("BuildCommandsOnRun", options.mBuildOptions.mBuildCommandsOnRun, .Always); + WriteStrings("LinkDependencies", options.mBuildOptions.mLinkDependencies); WriteStrings("PreBuildCmds", options.mBuildOptions.mPreBuildCmds); WriteStrings("PostBuildCmds", options.mBuildOptions.mPostBuildCmds); @@ -1839,6 +1843,7 @@ namespace IDE options.mBuildOptions.mStackSize = data.GetInt("StackSize"); options.mBuildOptions.mBuildCommandsOnCompile = data.GetEnum("BuildCommandsOnCompile", .Always); options.mBuildOptions.mBuildCommandsOnRun = data.GetEnum("BuildCommandsOnRun", .Always); + ReadStrings("LinkDependencies", options.mBuildOptions.mLinkDependencies); ReadStrings("PreBuildCmds", options.mBuildOptions.mPreBuildCmds); ReadStrings("PostBuildCmds", options.mBuildOptions.mPostBuildCmds); diff --git a/IDE/src/ui/DisassemblyPanel.bf b/IDE/src/ui/DisassemblyPanel.bf index 5deb4b1e..e60e8909 100644 --- a/IDE/src/ui/DisassemblyPanel.bf +++ b/IDE/src/ui/DisassemblyPanel.bf @@ -585,6 +585,7 @@ namespace IDE.ui case 'H': { mSourceHash = SourceHash.Create(.(line, 2)); + addLineData = false; } case 'T': { diff --git a/IDE/src/ui/ProjectProperties.bf b/IDE/src/ui/ProjectProperties.bf index a47a65ab..9c7c248a 100644 --- a/IDE/src/ui/ProjectProperties.bf +++ b/IDE/src/ui/ProjectProperties.bf @@ -680,6 +680,7 @@ namespace IDE.ui (listViewItem, propEntry) = AddPropertiesItem(root, "C Library", "mBuildOptions.mCLibType"); (listViewItem, propEntry) = AddPropertiesItem(root, "Beef Library", "mBuildOptions.mBeefLibType"); (listViewItem, propEntry) = AddPropertiesItem(root, "Stack Size", "mBuildOptions.mStackSize"); + (listViewItem, propEntry) = AddPropertiesItem(root, "Link Dependencies", "mBuildOptions.mLinkDependencies"); (listViewItem, propEntry) = AddPropertiesItem(root, "Prebuild Commands", "mBuildOptions.mPreBuildCmds"); (listViewItem, propEntry) = AddPropertiesItem(root, "Postbuild Commands", "mBuildOptions.mPostBuildCmds"); (listViewItem, propEntry) = AddPropertiesItem(root, "Build Commands on Compile", "mBuildOptions.mBuildCommandsOnCompile"); @@ -752,7 +753,7 @@ namespace IDE.ui } else { - int32 idx = mProject.mDependencies.FindIndex(scope (dep) => dep.mProjectName == listViewItem.mLabel); + int idx = mProject.mDependencies.FindIndex(scope (dep) => dep.mProjectName == listViewItem.mLabel); if (idx != -1) { delete mProject.mDependencies[idx]; diff --git a/IDE/src/ui/ThreadPanel.bf b/IDE/src/ui/ThreadPanel.bf index 04cf1adc..8046eef0 100644 --- a/IDE/src/ui/ThreadPanel.bf +++ b/IDE/src/ui/ThreadPanel.bf @@ -133,6 +133,13 @@ namespace IDE.ui PopupCallStackPanel(); } } + + public override bool WantsTooltip(float mouseX, float mouseY) + { + if ((mColumnIdx == 2) && (mouseX >= mListView.mParent.mWidth - LabelX - GS!(34))) + return false; + return base.WantsTooltip(mouseX, mouseY); + } } public class ThreadListView : DarkListView @@ -357,7 +364,7 @@ namespace IDE.ui } #unwarn - int32 selectedIdx = mListView.GetRoot().GetIndexOfChild(item); + int selectedIdx = mListView.GetRoot().GetIndexOfChild(item); int32 threadId = int32.Parse(item.mLabel); gApp.mDebugger.SetActiveThread(threadId); diff --git a/IDE/src/ui/WatchPanel.bf b/IDE/src/ui/WatchPanel.bf index 0defcce7..92cec606 100644 --- a/IDE/src/ui/WatchPanel.bf +++ b/IDE/src/ui/WatchPanel.bf @@ -1718,7 +1718,7 @@ namespace IDE.ui CompactChildExpression(source, compactEvalStr); var rootItem = mListView.GetRoot(); - int32 idx = rootItem.mChildItems.IndexOf(target); + int idx = rootItem.mChildItems.IndexOf(target); if (theEvent.mDragTargetDir > 0) idx += theEvent.mDragTargetDir; var listViewItem = (WatchListViewItem)rootItem.CreateChildItemAtIndex(idx); @@ -2864,7 +2864,7 @@ namespace IDE.ui var selectedItem = selectedItems[itemIdx]; if ((selectedItem != null) && (selectedItem.mLabel.Length > 0) && (selectedItem.mParentItem == root)) { - int32 idx = root.mChildItems.IndexOf(selectedItem); + int idx = root.mChildItems.IndexOf(selectedItem); root.RemoveChildItem(selectedItem); if (idx < root.mChildItems.Count) root.SelectItemExclusively(root.mChildItems[idx]);