Skip to content

Commit e088776

Browse files
committed
improve FumenSoflanGroupListViewerView
1 parent ea96d7e commit e088776

2 files changed

Lines changed: 225 additions & 144 deletions

File tree

OngekiFumenEditor/Modules/FumenSoflanGroupListViewer/ViewModels/FumenSoflanGroupListViewerViewModel.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
using System.Windows.Controls;
1818
using System.Collections.Specialized;
1919
using System.Linq;
20+
using static OngekiFumenEditor.Base.Collections.SoflanList;
21+
using OngekiFumenEditor.Modules.FumenObjectPropertyBrowser;
2022

2123
namespace OngekiFumenEditor.Modules.FumenSoflanGroupListViewer.ViewModels
2224
{
@@ -47,11 +49,34 @@ private void OnEditorPropertyChanged(object sender, PropertyChangedEventArgs e)
4749

4850
public override PaneLocation PreferredLocation => PaneLocation.Bottom;
4951

52+
private bool isShowPreviewModeSoflanPositionList = true;
53+
public bool IsShowPreviewModeSoflanPositionList
54+
{
55+
get => isShowPreviewModeSoflanPositionList;
56+
set => Set(ref isShowPreviewModeSoflanPositionList, value);
57+
}
58+
5059
private FumenVisualEditorViewModel editor;
5160
private ListViewDragDropManager<SoflanGroupDisplayItemListViewBase> listDragManager;
5261

5362
private SoflanGroupWrapItemGroup displaySoflanGroupItemGroupRoot;
5463

64+
public IEnumerable<SoflanPoint> DisplaySoflanPointList
65+
{
66+
get
67+
{
68+
if (CurrentSelectedSoflanGroupWrapItem is null)
69+
return Enumerable.Empty<SoflanPoint>();
70+
if (Editor?.Fumen is not OngekiFumen fumen)
71+
return Enumerable.Empty<SoflanPoint>();
72+
73+
var soflanList = fumen.SoflansMap[CurrentSelectedSoflanGroupWrapItem.SoflanGroupId];
74+
var points = IsShowPreviewModeSoflanPositionList ? soflanList.GetCachedSoflanPositionList_PreviewMode(fumen.BpmList) : soflanList.GetCachedSoflanPositionList_DesignMode(fumen.BpmList);
75+
76+
return points;
77+
}
78+
}
79+
5580
private string createNewGroupName;
5681
public string CreateNewGroupName
5782
{
@@ -85,7 +110,11 @@ public void CreateNewGroup()
85110
public SoflanGroupWrapItem CurrentSelectedSoflanGroupWrapItem
86111
{
87112
get => currentSelectedSoflanGroupWrapItem;
88-
set => Set(ref currentSelectedSoflanGroupWrapItem, value);
113+
set
114+
{
115+
Set(ref currentSelectedSoflanGroupWrapItem, value);
116+
NotifyOfPropertyChange(() => DisplaySoflanPointList);
117+
}
89118
}
90119

91120
public SoflanGroupWrapItemGroup DisplaySoflanGroupItemGroupRoot
@@ -156,6 +185,14 @@ IEnumerable<SoflanGroupDisplayItemListViewBase> visit(SoflanGroupDisplayItemList
156185
CurrentSelectedSoflanGroupWrapItem = visit(DisplaySoflanGroupItemGroupRoot).OfType<SoflanGroupWrapItem>().FirstOrDefault(x => x.IsSelected);
157186
}
158187

188+
public void OnItemDoubleClick(SoflanPoint item)
189+
{
190+
if (Editor is null)
191+
return;
192+
193+
Editor.ScrollTo(item.TGrid);
194+
}
195+
159196
private void ListDragManager_ProcessDrop(object sender, ProcessDropEventArgs<SoflanGroupDisplayItemListViewBase> e)
160197
{
161198
var placeTo = e.ItemsSource.ElementAtOrDefault(e.NewIndex);

0 commit comments

Comments
 (0)