1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Fixed some tooltips, added Link Dependencies, more int-ness

This commit is contained in:
Brian Fiete 2019-12-21 05:48:44 -08:00
parent 939c818581
commit d0e8332150
30 changed files with 180 additions and 432 deletions

View file

@ -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"

View file

@ -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)

View file

@ -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));

View file

@ -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;

View file

@ -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);

View file

@ -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);
}

View file

@ -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);

View file

@ -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];

View file

@ -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);
}
}

View file

@ -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();
}
}
}

View file

@ -418,36 +418,36 @@ namespace System.Collections.Generic
return Enumerator(this);
}
public int_cosize FindIndex(Predicate<T> match)
public int FindIndex(Predicate<T> 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);

View file

@ -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<T>))
{
var list = (List<T>)data;
return list.Count == 0;
}
return false;
}
}
public int Count
{
get
{
@ -39,7 +58,7 @@ namespace System
if (type == typeof(List<T>))
{
var list = (List<T>)data;
return (int32)list.Count;
return list.Count;
}
return 1;
}

View file

@ -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

View file

@ -110,6 +110,14 @@ namespace System
}
}
public T Value
{
get
{
return Unwrap();
}
}
public static implicit operator Result<T, TErr>(T value)
{
return .Ok(value);

View file

@ -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
}
}

View file

@ -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]