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

Improvements to Find in Watch

This commit is contained in:
Brian Fiete 2024-03-26 07:30:54 -04:00
parent f47e132921
commit bceca3e699
4 changed files with 670 additions and 108 deletions

View file

@ -54,7 +54,10 @@ namespace Beefy.theme.dark
return;
mIsOpen = open;
if (immediate)
{
mRot = mIsOpen ? (Math.PI_f / 2) : 0;
mItem.mListView.mListSizeDirty = true;
}
}
public override void UpdateF(float updatePct)
@ -319,7 +322,9 @@ namespace Beefy.theme.dark
IDisposable colorScope = null;
if (mIconImageColor != 0)
colorScope = g.PushColor(mIconImageColor);
g.Draw(mIconImage, listView.mIconX + labelOfs, 0);
float iconX = listView.mIconX + labelOfs;
if (labelX < mWidth)
g.Draw(mIconImage, iconX, 0);
if (colorScope != null)
colorScope.Dispose();
}
@ -345,6 +350,9 @@ namespace Beefy.theme.dark
overflowMode = .Wrap;
g.DrawString(mLabel, labelX, 0, .Left, wantWidth, overflowMode);
}
if (mOpenButton != null)
mOpenButton.SetVisible(wantWidth > GS!(-30));
}
}
@ -422,7 +430,11 @@ namespace Beefy.theme.dark
if ((mChildItems != null) && (mShowChildPct > 0))
{
for (ListViewItem listViewItem in mChildItems)
mChildAreaHeight += listViewItem.CalculatedDesiredHeight();
{
var childHeight = listViewItem.CalculatedDesiredHeight();
Debug.Assert(childHeight >= 0);
mChildAreaHeight += childHeight;
}
mChildAreaHeight *= mShowChildPct;
}
@ -518,12 +530,15 @@ namespace Beefy.theme.dark
}
}
float scrollX = (.)listView.mHorzPos.v;
float hiliteX = GS!(4) + listView.mHiliteOffset;
float checkLabelX = LabelX;
if (mListView.mColumns.Count > 0)
{
float adjust = LabelX - mListView.mColumns[0].mWidth;
float adjust = (checkLabelX + scrollX) - mListView.mColumns[0].mWidth - listView.mLabelX;
if (adjust > 0)
{
@ -531,6 +546,12 @@ namespace Beefy.theme.dark
}
}
/*float adjust = (checkLabelX + scrollX) - mListView.mColumns[0].mWidth;
if (adjust > 0)
{
//hiliteX -= adjust;
}*/
var darkListView = mListView as DarkListView;
float height = darkListView.mFont.GetLineSpacing();

View file

@ -814,6 +814,7 @@ namespace Beefy.widgets
mRoot.mWidth = Math.Max(listWidth, mScrollContentContainer.mWidth);
mRoot.mHeight = mRoot.CalculatedDesiredHeight() + mBottomInset;
Debug.Assert(mRoot.mHeight >= 0);
mRoot.ResizeComponents(0);
UpdateScrollbarData();
@ -953,13 +954,31 @@ namespace Beefy.widgets
KeyDown(KeyCode.Down, false);
case KeyCode.Up:
int idx = selectedItem.mParentItem.mChildItems.IndexOf(selectedItem);
if (idx > 0)
idx--;
while (idx >= 0)
{
newSelection = selectedItem.mParentItem.mChildItems[idx - 1];
var checkSelection = selectedItem.mParentItem.mChildItems[idx];
if (checkSelection.mSelfHeight <= 0)
{
idx--;
continue;
}
newSelection = checkSelection;
while (newSelection.mChildAreaHeight > 0)
newSelection = newSelection.mChildItems[newSelection.mChildItems.Count - 1];
{
for (int checkIdx in (0..<newSelection.mChildItems.Count).Reversed)
{
checkSelection = newSelection.mChildItems[checkIdx];
if (checkSelection.mSelfHeight > 0)
{
newSelection = checkSelection;
break;
}
}
}
break;
}
else if (selectedItem.mParentItem != mRoot)
if ((idx < 0) && (selectedItem.mParentItem != mRoot))
{
newSelection = selectedItem.mParentItem;
}
@ -967,18 +986,33 @@ namespace Beefy.widgets
case KeyCode.Down:
if ((selectedItem.IsOpen) && (!selectedItem.mChildItems.IsEmpty))
{
newSelection = selectedItem.mChildItems[0];
for (int i < selectedItem.mChildItems.Count)
{
var checkSelection = selectedItem.mChildItems[i];
if (checkSelection.mSelfHeight > 0)
{
newSelection = checkSelection;
break;
}
}
}
else
if (newSelection == null)
{
while (selectedItem != mRoot)
SelectLoop: while (selectedItem != mRoot)
{
var childItems = selectedItem.mParentItem.mChildItems;
int idx = childItems.IndexOf(selectedItem);
if (idx < childItems.Count - 1)
idx++;
while (idx < childItems.Count)
{
newSelection = childItems[idx + 1];
break;
var checkSelection = childItems[idx];
if (checkSelection.mSelfHeight > 0)
{
newSelection = checkSelection;
break SelectLoop;
}
idx++;
}
selectedItem = selectedItem.mParentItem;
@ -988,14 +1022,32 @@ namespace Beefy.widgets
case KeyCode.Left:
if (!selectedItem.Open(false))
{
if (selectedItem.mParentItem != GetRoot())
newSelection = selectedItem.mParentItem;
var checkSelection = selectedItem.mParentItem;
while (checkSelection != GetRoot())
{
if (checkSelection.mSelfHeight > 0)
{
newSelection = checkSelection;
break;
}
checkSelection = checkSelection.mParentItem;
}
}
case KeyCode.Right:
if (!selectedItem.Open(true))
{
if ((selectedItem.mChildItems != null) && (selectedItem.mChildItems.Count > 0))
newSelection = selectedItem.mChildItems[0];
if (selectedItem.mChildItems != null)
{
for (int i < selectedItem.mChildItems.Count)
{
var checkSelection = selectedItem.mChildItems[i];
if (checkSelection.mSelfHeight > 0)
{
newSelection = checkSelection;
break;
}
}
}
}
case KeyCode.Space:
if (!selectedItem.Open(false))