-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4001 from QiuFeng54321/editor-plugin-bookmark
Update bookmark support to plugins
- Loading branch information
Showing
15 changed files
with
250 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
Quaver.Shared/Screens/Edit/Actions/Bookmarks/Add/EditorActionAddBookmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Quaver.Shared/Screens/Edit/Actions/Bookmarks/AddBatch/EditorActionAddBookmarkBatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Collections.Generic; | ||
using Quaver.API.Maps; | ||
using Quaver.API.Maps.Structures; | ||
using MoonSharp.Interpreter; | ||
using MoonSharp.Interpreter.Interop; | ||
using Quaver.Shared.Screens.Edit.Actions.Bookmarks.RemoveBatch; | ||
|
||
namespace Quaver.Shared.Screens.Edit.Actions.Bookmarks.AddBatch | ||
{ | ||
[MoonSharpUserData] | ||
public class EditorActionAddBookmarkBatch : IEditorAction | ||
{ | ||
public EditorActionType Type { get; } = EditorActionType.AddBookmarkBatch; | ||
|
||
private EditorActionManager ActionManager { get; } | ||
|
||
private Qua WorkingMap { get; } | ||
|
||
private List<BookmarkInfo> Bookmarks { get; } | ||
|
||
[MoonSharpVisible(false)] | ||
public EditorActionAddBookmarkBatch(EditorActionManager manager, Qua workingMap, List<BookmarkInfo> bookmarks) | ||
{ | ||
ActionManager = manager; | ||
WorkingMap = workingMap; | ||
Bookmarks = bookmarks; | ||
} | ||
|
||
[MoonSharpVisible(false)] | ||
public void Perform() | ||
{ | ||
Bookmarks.ForEach(x => WorkingMap.Bookmarks.Add(x)); | ||
WorkingMap.Sort(); | ||
|
||
ActionManager.TriggerEvent(Type, new EditorActionBookmarkBatchAddedEventArgs(Bookmarks)); | ||
} | ||
|
||
[MoonSharpVisible(false)] | ||
public void Undo() => new EditorActionRemoveBookmarkBatch(ActionManager, WorkingMap, Bookmarks).Perform(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...Shared/Screens/Edit/Actions/Bookmarks/AddBatch/EditorActionBookmarkBatchAddedEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Quaver.API.Maps.Structures; | ||
|
||
namespace Quaver.Shared.Screens.Edit.Actions.Bookmarks.AddBatch | ||
{ | ||
public class EditorActionBookmarkBatchAddedEventArgs : EventArgs | ||
{ | ||
public List<BookmarkInfo> Bookmarks { get; } | ||
|
||
public EditorActionBookmarkBatchAddedEventArgs(List<BookmarkInfo> bookmarks) => Bookmarks = bookmarks; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...d/Screens/Edit/Actions/Bookmarks/RemoveBatch/EditorActionBookmarkBatchRemovedEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Collections.Generic; | ||
using Quaver.API.Maps.Structures; | ||
using Quaver.Shared.Screens.Edit.Actions.Bookmarks.AddBatch; | ||
|
||
namespace Quaver.Shared.Screens.Edit.Actions.Bookmarks.RemoveBatch | ||
{ | ||
public class EditorActionBookmarkBatchRemovedEventArgs : EditorActionBookmarkBatchAddedEventArgs | ||
{ | ||
public EditorActionBookmarkBatchRemovedEventArgs(List<BookmarkInfo> bookmarks) : base(bookmarks) | ||
{ | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Quaver.Shared/Screens/Edit/Actions/Bookmarks/RemoveBatch/EditorActionRemoveBookmarkBatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Collections.Generic; | ||
using Quaver.API.Maps; | ||
using Quaver.API.Maps.Structures; | ||
using MoonSharp.Interpreter; | ||
using MoonSharp.Interpreter.Interop; | ||
using Quaver.Shared.Screens.Edit.Actions.Bookmarks.AddBatch; | ||
|
||
namespace Quaver.Shared.Screens.Edit.Actions.Bookmarks.RemoveBatch | ||
{ | ||
[MoonSharpUserData] | ||
public class EditorActionRemoveBookmarkBatch : IEditorAction | ||
{ | ||
public EditorActionType Type { get; } = EditorActionType.RemoveBookmarkBatch; | ||
|
||
private EditorActionManager ActionManager { get; } | ||
|
||
private Qua WorkingMap { get; } | ||
|
||
private List<BookmarkInfo> Bookmarks { get; } | ||
|
||
[MoonSharpVisible(false)] | ||
public EditorActionRemoveBookmarkBatch(EditorActionManager manager, Qua workingMap, List<BookmarkInfo> bookmarks) | ||
{ | ||
ActionManager = manager; | ||
WorkingMap = workingMap; | ||
Bookmarks = bookmarks; | ||
} | ||
|
||
[MoonSharpVisible(false)] | ||
public void Perform() | ||
{ | ||
foreach (var sv in Bookmarks) | ||
WorkingMap.Bookmarks.Remove(sv); | ||
|
||
ActionManager.TriggerEvent(Type, new EditorActionBookmarkBatchRemovedEventArgs(Bookmarks)); | ||
} | ||
|
||
[MoonSharpVisible(false)] | ||
public void Undo() => new EditorActionAddBookmarkBatch(ActionManager, WorkingMap, Bookmarks).Perform(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.