mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 15:26:00 +02:00
Fixed some tooltips, added Link Dependencies, more int-ness
This commit is contained in:
parent
939c818581
commit
d0e8332150
30 changed files with 180 additions and 432 deletions
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue