mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
508 lines
13 KiB
Plaintext
508 lines
13 KiB
Plaintext
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
|
|
<UIX xmlns="http://schemas.microsoft.com/2007/uix"
|
|
xmlns:iris="assembly://UIX/Microsoft.Iris"
|
|
xmlns:zune="assembly://ZuneShell/ZuneUI"
|
|
xmlns:sys="assembly://mscorlib/System"
|
|
xmlns:styles="res://ZuneShellResources!Styles.uix"
|
|
xmlns:animations="res://ZuneShellResources!Animations.uix"
|
|
xmlns:me="Me">
|
|
|
|
|
|
|
|
|
|
<Class Name="Positions">
|
|
<Properties>
|
|
|
|
|
|
|
|
<List Name="DefaultPositions"/>
|
|
|
|
|
|
<String Name="SaveKeyPrefix" String=""/>
|
|
|
|
|
|
|
|
<List Name="ActualPositions"/>
|
|
|
|
|
|
<Command Name="PositionsChanged"/>
|
|
</Properties>
|
|
|
|
<Scripts>
|
|
|
|
<Script>
|
|
List positions;
|
|
|
|
if (!String.IsNullOrEmpty(SaveKeyPrefix))
|
|
{
|
|
positions = zune:Shell.GetPositionList(SaveKeyPrefix + "Positions", DefaultPositions.Count);
|
|
}
|
|
if (positions == null)
|
|
{
|
|
|
|
positions = DefaultPositions;
|
|
}
|
|
|
|
foreach(float position in positions)
|
|
{
|
|
iris:RangedValue positionRangeValue = new iris:RangedValue();
|
|
positionRangeValue.Value = position;
|
|
ActualPositions.Add(positionRangeValue);
|
|
}
|
|
</Script>
|
|
|
|
|
|
<Script>
|
|
[DeclareTrigger(PositionsChanged.Invoked)]
|
|
|
|
if (!String.IsNullOrEmpty(SaveKeyPrefix))
|
|
{
|
|
zune:Shell.SaveRangedValueList(SaveKeyPrefix + "Positions", ActualPositions);
|
|
}
|
|
</Script>
|
|
</Scripts>
|
|
</Class>
|
|
|
|
|
|
|
|
|
|
|
|
<UI Name="SplitPanel">
|
|
<Properties>
|
|
<zune:LibraryPanel Name="Model" LibraryPanel="$Required"/>
|
|
<zune:ZunePage Name="Page" ZunePage="$Required"/>
|
|
<Command Name="PositionsChanged" Command="$Required"/>
|
|
</Properties>
|
|
<Scripts>
|
|
<Script> Self.RequestSource([Model.UI], "Model", Model, "Page", Page); </Script>
|
|
|
|
<Script>
|
|
[InitialEvaluate(true)]
|
|
[DeclareTrigger(Model.MinimumWidth)]
|
|
[DeclareTrigger(Model.MinimumPercent)]
|
|
PositionsChanged.Invoke();
|
|
</Script>
|
|
</Scripts>
|
|
<Content>
|
|
<Host Name="Self" FocusOrder="0">
|
|
<Animations>
|
|
<Animation Animation="{animations:Animations.ListFadeIn}"/>
|
|
<Animation Animation="{animations:Animations.ListContentChange}"/>
|
|
</Animations>
|
|
</Host>
|
|
</Content>
|
|
</UI>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<UI Name="Splitter">
|
|
<Properties>
|
|
<zune:ZunePage Name="Page" ZunePage="$Required"/>
|
|
|
|
|
|
<iris:ArrayListDataSet Name="Panels" ArrayListDataSet="{null}"/>
|
|
|
|
<me:Positions Name="Positions" Positions="{null}"/>
|
|
|
|
|
|
<Int32 Name="GripperWidth" Int32="10"/>
|
|
|
|
<Int32 Name="PreviewWidth" Int32="4"/>
|
|
<Boolean Name="ShowPreview" Boolean="false"/>
|
|
</Properties>
|
|
|
|
<Locals>
|
|
<Command Name="PositionsChanged"/>
|
|
</Locals>
|
|
|
|
<Scripts>
|
|
<Script> Repeater.Source = [Panels]; </Script>
|
|
|
|
<Script>
|
|
if ([Positions] != null)
|
|
Grippers.Source = Positions.ActualPositions;
|
|
else
|
|
Grippers.Source = null;
|
|
|
|
|
|
|
|
|
|
|
|
PositionsChanged.Invoke();
|
|
</Script>
|
|
|
|
<Script>
|
|
[DeclareTrigger(PositionsChanged.Invoked)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int minimumWidth = 0;
|
|
|
|
|
|
|
|
int i = 0;
|
|
foreach (zune:LibraryPanel panel in (List)Panels)
|
|
{
|
|
AnchorLayoutInput input = (AnchorLayoutInput)panel.get_Item("LayoutInput");
|
|
|
|
if (input != null)
|
|
{
|
|
float leftPercent = 0.0;
|
|
|
|
if (i != 0)
|
|
{
|
|
leftPercent = ((iris:RangedValue)Positions.ActualPositions.GetItem(i - 1)).Value;
|
|
}
|
|
|
|
input.Left = new AnchorEdge("Parent", leftPercent, minimumWidth);
|
|
|
|
|
|
|
|
|
|
|
|
minimumWidth = minimumWidth + panel.MinimumWidth;
|
|
|
|
float rightPercent = 1.0;
|
|
|
|
if (i != Panels.Count - 1)
|
|
{
|
|
rightPercent = ((iris:RangedValue)Positions.ActualPositions.GetItem(i)).Value;
|
|
}
|
|
|
|
input.Right = new AnchorEdge("Parent", rightPercent, minimumWidth);
|
|
|
|
|
|
|
|
|
|
minimumWidth = minimumWidth + GripperWidth;
|
|
}
|
|
|
|
i = i + 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Inset margins = new Inset(0, 0, minimumWidth, 0);
|
|
|
|
Grippers.Margins = margins;
|
|
Repeater.Margins = margins;
|
|
|
|
|
|
|
|
|
|
Layout temp = Repeater.Layout;
|
|
Repeater.Layout = null;
|
|
Repeater.Layout = temp;
|
|
</Script>
|
|
</Scripts>
|
|
|
|
<Content>
|
|
<Panel>
|
|
<Children>
|
|
|
|
|
|
<Repeater Name="Grippers" Layout="Form">
|
|
<Content>
|
|
|
|
<me:Gripper Position="{(iris:RangedValue)RepeatedItem}"
|
|
Panels="{Panels}" Positions="{Positions}" Index="{RepeatedItemIndex}"
|
|
GripperWidth="{GripperWidth}"
|
|
PreviewWidth="{PreviewWidth}" ShowPreview="{ShowPreview}"
|
|
PositionsChanged="{PositionsChanged}" />
|
|
|
|
</Content>
|
|
</Repeater>
|
|
|
|
|
|
<Repeater Name="Repeater" Layout="Form">
|
|
<Content>
|
|
|
|
<me:SplitPanel Model="{(zune:LibraryPanel)RepeatedItem}"
|
|
Page="{Page}"
|
|
PositionsChanged="{PositionsChanged}" >
|
|
<LayoutInput>
|
|
<Script>
|
|
|
|
AnchorLayoutInput input = new AnchorLayoutInput();
|
|
input.Top = new AnchorEdge("Parent", 0.0);
|
|
input.Bottom = new AnchorEdge("Parent", 1.0);
|
|
|
|
|
|
zune:LibraryPanel panel = (zune:LibraryPanel)RepeatedItem;
|
|
panel.set_Item("LayoutInput", input);
|
|
|
|
return input;
|
|
</Script>
|
|
</LayoutInput>
|
|
</me:SplitPanel>
|
|
|
|
</Content>
|
|
</Repeater>
|
|
|
|
</Children>
|
|
</Panel>
|
|
</Content>
|
|
</UI>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<UI Name="Gripper">
|
|
<Properties>
|
|
<iris:RangedValue Name="Position" RangedValue="$Required"/>
|
|
|
|
<List Name="Panels" List="$Required"/>
|
|
<me:Positions Name="Positions" Positions="$Required"/>
|
|
|
|
<Int32 Name="GripperWidth" Int32="$Required"/>
|
|
|
|
<Index Name="Index" Index="$Required"/>
|
|
|
|
<Int32 Name="PreviewWidth" Int32="4"/>
|
|
<Boolean Name="ShowPreview" Boolean="$Required"/>
|
|
|
|
|
|
<Command Name="PositionsChanged" Command="$Required"/>
|
|
</Properties>
|
|
|
|
<Locals>
|
|
|
|
<AnchorLayoutInput Name="LayoutInput" Top="Parent,0" Bottom="Parent,1"/>
|
|
|
|
|
|
<AnchorLayoutInput Name="PreviewInput" Top="Parent,0" Bottom="Parent,1"/>
|
|
|
|
|
|
<Single Name="InitialPosition"/>
|
|
|
|
|
|
<Single Name="CurrentPosition"/>
|
|
</Locals>
|
|
|
|
<Input>
|
|
|
|
<DragHandler Name="Dragger" CancelOnEscape="true"/>
|
|
</Input>
|
|
|
|
<Scripts>
|
|
<Script>
|
|
UI.Cursor = Cursor.SizeWE;
|
|
LayoutInput.Left = new AnchorEdge("Parent", 0.0);
|
|
LayoutInput.Right = new AnchorEdge("Parent", 0.0, GripperWidth);
|
|
</Script>
|
|
|
|
<Script>
|
|
[DeclareTrigger(Position.Value)]
|
|
|
|
|
|
PositionsChanged.Invoke();
|
|
</Script>
|
|
|
|
<Script>
|
|
[InitialEvaluate(true)]
|
|
[DeclareTrigger(PositionsChanged.Invoked)]
|
|
LayoutInput.Left.Percent = Position.Value;
|
|
LayoutInput.Right.Percent = Position.Value;
|
|
|
|
|
|
|
|
int minimumWidth = 0;
|
|
|
|
int i = 0;
|
|
foreach (zune:LibraryPanel panel in (List)Panels)
|
|
{
|
|
minimumWidth = minimumWidth + panel.MinimumWidth + GripperWidth;
|
|
|
|
if (i == Index.Value)
|
|
{
|
|
LayoutInput.Left.Offset = minimumWidth - GripperWidth;
|
|
LayoutInput.Right.Offset = minimumWidth;
|
|
|
|
}
|
|
|
|
i = i + 1;
|
|
}
|
|
|
|
|
|
|
|
Layout temp = Root.Layout;
|
|
Root.Layout = null;
|
|
Root.Layout = temp;
|
|
</Script>
|
|
|
|
<Script>
|
|
[DeclareTrigger(Dragger.Cancelled)]
|
|
|
|
CurrentPosition = InitialPosition;
|
|
</Script>
|
|
|
|
<Script>
|
|
[DeclareTrigger(Dragger.Started)]
|
|
|
|
|
|
InitialPosition = ((iris:RangedValue)Positions.ActualPositions.GetItem(Index.Value)).Value;
|
|
CurrentPosition = InitialPosition;
|
|
if (ShowPreview)
|
|
{
|
|
PreviewInput.Left = new AnchorEdge("Parent", 0.0);
|
|
PreviewInput.Right = new AnchorEdge("Parent", 0.0);
|
|
|
|
Preview.Visible = true;
|
|
}
|
|
</Script>
|
|
|
|
<Script>
|
|
[DeclareTrigger(Dragger.Ended)]
|
|
|
|
if (ShowPreview)
|
|
{
|
|
Position.Value = CurrentPosition;
|
|
}
|
|
Preview.Visible = false;
|
|
|
|
|
|
Positions.PositionsChanged.Invoke();
|
|
</Script>
|
|
|
|
<Script>
|
|
|
|
|
|
[DeclareTrigger(Dragger.RelativeDragSize)]
|
|
|
|
|
|
if (Dragger.Dragging)
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zune:LibraryPanel leftPanel = (zune:LibraryPanel)Panels.GetItem(Index.Value);
|
|
zune:LibraryPanel rightPanel = (zune:LibraryPanel)Panels.GetItem(Index.Value + 1);
|
|
|
|
float previousPosition = 0.0;
|
|
if (Index.Value > 0)
|
|
previousPosition = ((iris:RangedValue)Positions.ActualPositions.GetItem(Index.Value - 1)).Value;
|
|
|
|
float nextPosition = 1.0;
|
|
if (Index.Value < Positions.ActualPositions.Count - 1)
|
|
nextPosition = ((iris:RangedValue)Positions.ActualPositions.GetItem(Index.Value + 1)).Value;
|
|
|
|
|
|
|
|
|
|
float min = previousPosition + leftPanel.MinimumPercent;
|
|
float max = nextPosition - rightPanel.MinimumPercent;
|
|
|
|
float currentPosition = InitialPosition + Dragger.RelativeDragSize.X;
|
|
|
|
currentPosition = sys:Math.Max(min, sys:Math.Min(currentPosition, max));
|
|
|
|
|
|
|
|
|
|
CurrentPosition = currentPosition;
|
|
|
|
}
|
|
</Script>
|
|
|
|
<Script>
|
|
[DeclareTrigger(CurrentPosition)]
|
|
|
|
|
|
if (ShowPreview)
|
|
{
|
|
|
|
PreviewInput.Left.Percent = CurrentPosition;
|
|
PreviewInput.Right.Percent = CurrentPosition;
|
|
|
|
|
|
|
|
int minimumWidth = 0;
|
|
|
|
int i = 0;
|
|
foreach (zune:LibraryPanel panel in (List)Panels)
|
|
{
|
|
minimumWidth = minimumWidth + panel.MinimumWidth + GripperWidth;
|
|
|
|
if (i == Index.Value)
|
|
{
|
|
int diff = (GripperWidth - PreviewWidth) / 2;
|
|
PreviewInput.Left.Offset = minimumWidth - GripperWidth + diff;
|
|
PreviewInput.Right.Offset = minimumWidth - diff;
|
|
|
|
}
|
|
|
|
i = i + 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Layout temp = Root.Layout;
|
|
Root.Layout = null;
|
|
Root.Layout = temp;
|
|
}
|
|
else
|
|
{
|
|
Position.Value = CurrentPosition;
|
|
}
|
|
</Script>
|
|
</Scripts>
|
|
|
|
<Content>
|
|
<Panel Name="Root" Layout="Form" MouseInteractive="false">
|
|
<Animations>
|
|
<Animation Animation="{animations:Animations.ListFadeIn}"/>
|
|
<Animation Animation="{animations:Animations.ListContentChange}"/>
|
|
</Animations>
|
|
<Children>
|
|
|
|
|
|
<Panel Name="Gripper" LayoutInput="{LayoutInput}" MouseInteractive="true"
|
|
Margins="0,38,0,0" Layout="Anchor">
|
|
<Children>
|
|
|
|
|
|
<Graphic Content="{styles:Styles.DividerVertical}">
|
|
<LayoutInput>
|
|
<AnchorLayoutInput Left="Parent,0" Top="Parent,0" Bottom="Parent,1"/>
|
|
</LayoutInput>
|
|
</Graphic>
|
|
|
|
</Children>
|
|
</Panel>
|
|
|
|
<ColorFill Name="Preview" Content="100,0,0,0" LayoutInput="{PreviewInput}" Visible="false"/>
|
|
|
|
</Children>
|
|
</Panel>
|
|
</Content>
|
|
</UI>
|
|
|
|
</UIX> |