mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Bookmark folders, Drag & Drop
This commit is contained in:
parent
b3787313be
commit
bd048e2fe6
5 changed files with 670 additions and 188 deletions
|
@ -52,38 +52,153 @@ namespace IDE
|
||||||
public String mTitle ~ delete _;
|
public String mTitle ~ delete _;
|
||||||
public String mNotes ~ delete _;
|
public String mNotes ~ delete _;
|
||||||
public bool mIsDisabled;
|
public bool mIsDisabled;
|
||||||
|
public BookmarkFolder mFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BookmarkManager
|
public class BookmarkFolder
|
||||||
{
|
{
|
||||||
|
/// The title of the bookmark-folder that will be visible in the bookmark-panel
|
||||||
|
public String mTitle ~ delete _;
|
||||||
|
|
||||||
public List<Bookmark> mBookmarkList = new List<Bookmark>() ~
|
public List<Bookmark> mBookmarkList = new List<Bookmark>() ~
|
||||||
{
|
{
|
||||||
for (var bookmark in mBookmarkList)
|
for (var bookmark in mBookmarkList)
|
||||||
bookmark.Kill();
|
bookmark.Kill();
|
||||||
|
|
||||||
|
gApp.mDebugger.mBreakpointsChangedDelegate();
|
||||||
|
|
||||||
delete _;
|
delete _;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Gets or Sets whether every bookmark in this folder is disabled or not.
|
||||||
|
public bool IsDisabled
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
for (var bookmark in mBookmarkList)
|
||||||
|
if (!bookmark.mIsDisabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
for (var bookmark in mBookmarkList)
|
||||||
|
bookmark.mIsDisabled = value;
|
||||||
|
|
||||||
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Adds the given bookmark to this folder. If needed, removes it from its old folder.
|
||||||
|
public void AddBookmark(Bookmark bookmark)
|
||||||
|
{
|
||||||
|
if (bookmark.mFolder != null)
|
||||||
|
{
|
||||||
|
bookmark.mFolder.mBookmarkList.Remove(bookmark);
|
||||||
|
}
|
||||||
|
mBookmarkList.Add(bookmark);
|
||||||
|
bookmark.mFolder = this;
|
||||||
|
|
||||||
|
//gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BookmarkManager
|
||||||
|
{
|
||||||
|
public BookmarkFolder mRootFolder = new .();
|
||||||
|
public List<BookmarkFolder> mBookmarkFolders = new .() {mRootFolder} ~ DeleteContainerAndItems!(_);
|
||||||
|
|
||||||
|
private int mBookmarkCount;
|
||||||
|
|
||||||
|
/// Index of the folder that was navigated to last
|
||||||
|
public int32 mFolderIdx;
|
||||||
|
/// Index of the bookmark (inside of its folder) that was navigated to last
|
||||||
public int32 mBookmarkIdx;
|
public int32 mBookmarkIdx;
|
||||||
|
|
||||||
|
/// Number of bookmarks created, used to generate the names.
|
||||||
private int32 _createdBookmarks;
|
private int32 _createdBookmarks;
|
||||||
|
/// Number of folders created, used to generate the names.
|
||||||
|
private int32 _createdFolders;
|
||||||
|
|
||||||
|
/// Gets or sets whether all bookmarks are disabled or not.
|
||||||
public bool AllBookmarksDisabled
|
public bool AllBookmarksDisabled
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
for (Bookmark b in mBookmarkList)
|
for (var folder in mBookmarkFolders)
|
||||||
{
|
{
|
||||||
if (!b.mIsDisabled)
|
if (!folder.IsDisabled)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
for (var folder in mBookmarkFolders)
|
||||||
|
{
|
||||||
|
folder.IsDisabled = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bookmark CreateBookmark(String fileName, int wantLineNum, int wantColumn, bool isDisabled = false, String title = null)
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new bookmark folder
|
||||||
|
* @param title The title of the bookmark
|
||||||
|
* @returns the newly created BookmarkFolder
|
||||||
|
*/
|
||||||
|
public BookmarkFolder CreateFolder(String title = null)
|
||||||
{
|
{
|
||||||
mBookmarkIdx = (int32)mBookmarkList.Count;
|
mBookmarkIdx = -1;
|
||||||
_createdBookmarks++;
|
|
||||||
|
BookmarkFolder folder = new .();
|
||||||
|
|
||||||
|
if (title == null)
|
||||||
|
folder.mTitle = new $"Folder {_createdFolders++}";
|
||||||
|
else
|
||||||
|
folder.mTitle = new String(title);
|
||||||
|
|
||||||
|
mBookmarkFolders.Add(folder);
|
||||||
|
|
||||||
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Deletes the given bookmark folder and all bookmarks inside it.
|
||||||
|
public void DeleteFolder(BookmarkFolder folder)
|
||||||
|
{
|
||||||
|
int folderIdx = mBookmarkFolders.IndexOf(folder);
|
||||||
|
|
||||||
|
mBookmarkFolders.Remove(folder);
|
||||||
|
|
||||||
|
delete folder;
|
||||||
|
|
||||||
|
// Select the previous folder
|
||||||
|
if (mFolderIdx == folderIdx)
|
||||||
|
folderIdx--;
|
||||||
|
if (mFolderIdx >= mBookmarkFolders.Count)
|
||||||
|
mFolderIdx = (int32)mBookmarkFolders.Count - 1;
|
||||||
|
|
||||||
|
// Select last bookmark inside the newly selected folder
|
||||||
|
if (mBookmarkIdx >= mBookmarkFolders[mFolderIdx].mBookmarkList.Count)
|
||||||
|
mBookmarkIdx = (int32)mBookmarkFolders[mFolderIdx].mBookmarkList.Count - 1;
|
||||||
|
|
||||||
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bookmark CreateBookmark(String fileName, int wantLineNum, int wantColumn, bool isDisabled = false, String title = null, BookmarkFolder folder = null)
|
||||||
|
{
|
||||||
|
var folder;
|
||||||
|
|
||||||
|
folder = folder ?? mRootFolder;
|
||||||
|
|
||||||
|
mFolderIdx = (int32)mBookmarkFolders.IndexOf(folder);
|
||||||
|
|
||||||
|
mBookmarkIdx = (int32)folder.mBookmarkList.Count;
|
||||||
|
|
||||||
Bookmark bookmark = new Bookmark();
|
Bookmark bookmark = new Bookmark();
|
||||||
bookmark.mFileName = new String(fileName);
|
bookmark.mFileName = new String(fileName);
|
||||||
|
@ -97,91 +212,222 @@ namespace IDE
|
||||||
|
|
||||||
bookmark.mIsDisabled = isDisabled;
|
bookmark.mIsDisabled = isDisabled;
|
||||||
|
|
||||||
mBookmarkList.Add(bookmark);
|
folder.AddBookmark(bookmark);
|
||||||
|
|
||||||
gApp.mDebugger.mBreakpointsChangedDelegate();
|
gApp.mDebugger.mBreakpointsChangedDelegate();
|
||||||
|
|
||||||
//gApp.mBookmarksPanel.UpdateBookmarks();
|
|
||||||
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
|
||||||
|
mBookmarkCount++;
|
||||||
|
|
||||||
return bookmark;
|
return bookmark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Moves the bookmark to the specified folder.
|
||||||
|
* @param bookmark The bookmark to move.
|
||||||
|
* @param folder The folder to which the bookmark will be moved.
|
||||||
|
* @param insertBefore If null the bookmark will be added at the end of the folder. Otherwise it will be inserted before the specified bookmark.
|
||||||
|
*/
|
||||||
|
public void MoveBookmarkToFolder(Bookmark bookmark, BookmarkFolder folder, Bookmark insertBefore = null)
|
||||||
|
{
|
||||||
|
if (bookmark.mFolder != null)
|
||||||
|
{
|
||||||
|
bookmark.mFolder.mBookmarkList.Remove(bookmark);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insertBefore == null)
|
||||||
|
folder.mBookmarkList.Add(bookmark);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Assert(folder == insertBefore.mFolder, "Insert before must be in folder.");
|
||||||
|
|
||||||
|
int index = folder.mBookmarkList.IndexOf(insertBefore);
|
||||||
|
|
||||||
|
folder.mBookmarkList.Insert(index, bookmark);
|
||||||
|
}
|
||||||
|
|
||||||
|
bookmark.mFolder = folder;
|
||||||
|
|
||||||
|
FixupIndices();
|
||||||
|
|
||||||
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Placement
|
||||||
|
{
|
||||||
|
Before,
|
||||||
|
After
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveFolder(BookmarkFolder folder, Placement place = .After, BookmarkFolder target = null)
|
||||||
|
{
|
||||||
|
if (folder == target)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mBookmarkFolders.Contains(folder))
|
||||||
|
mBookmarkFolders.Remove(folder);
|
||||||
|
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
mBookmarkFolders.Add(folder);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int index = mBookmarkFolders.IndexOf(target);
|
||||||
|
|
||||||
|
if (place == .After)
|
||||||
|
index++;
|
||||||
|
|
||||||
|
mBookmarkFolders.Insert(index, folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
FixupIndices();
|
||||||
|
|
||||||
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Make sure that the bookmark and folder indices are valid.
|
||||||
|
private void FixupIndices()
|
||||||
|
{
|
||||||
|
if (mBookmarkIdx <= 0 || mBookmarkIdx >= mBookmarkFolders[mFolderIdx].mBookmarkList.Count)
|
||||||
|
{
|
||||||
|
mBookmarkIdx = 0;
|
||||||
|
|
||||||
|
// Don't have an empty folder selected
|
||||||
|
if (mBookmarkFolders[mFolderIdx].mBookmarkList.Count == 0)
|
||||||
|
mFolderIdx = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void DeleteBookmark(Bookmark bookmark)
|
public void DeleteBookmark(Bookmark bookmark)
|
||||||
{
|
{
|
||||||
int idx = mBookmarkList.IndexOf(bookmark);
|
BookmarkFolder folder = bookmark.mFolder;
|
||||||
mBookmarkList.RemoveAt(idx);
|
|
||||||
if (mBookmarkIdx == idx)
|
folder.mBookmarkList.Remove(bookmark);
|
||||||
mBookmarkIdx--;
|
|
||||||
if (mBookmarkIdx >= mBookmarkList.Count)
|
FixupIndices();
|
||||||
mBookmarkIdx = (int32)mBookmarkList.Count - 1;
|
|
||||||
gApp.mDebugger.mBreakpointsChangedDelegate();
|
gApp.mDebugger.mBreakpointsChangedDelegate();
|
||||||
bookmark.Kill();
|
bookmark.Kill();
|
||||||
|
|
||||||
//gApp.mBookmarksPanel.UpdateBookmarks();
|
|
||||||
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
|
|
||||||
|
mBookmarkCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
for (var bookmark in mBookmarkList)
|
for (var folder in mBookmarkFolders)
|
||||||
|
{
|
||||||
|
for (var bookmark in folder.mBookmarkList)
|
||||||
bookmark.Kill();
|
bookmark.Kill();
|
||||||
mBookmarkList.Clear();
|
folder.mBookmarkList.Clear();
|
||||||
|
}
|
||||||
|
ClearAndDeleteItems!(mBookmarkFolders);
|
||||||
|
|
||||||
|
mRootFolder = new BookmarkFolder();
|
||||||
|
mBookmarkFolders.Add(mRootFolder);
|
||||||
|
|
||||||
|
mFolderIdx = 0;
|
||||||
mBookmarkIdx = 0;
|
mBookmarkIdx = 0;
|
||||||
gApp.mDebugger.mBreakpointsChangedDelegate();
|
gApp.mDebugger.mBreakpointsChangedDelegate();
|
||||||
|
|
||||||
//gApp.mBookmarksPanel.UpdateBookmarks();
|
|
||||||
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
gApp.mBookmarksPanel.mBookmarksDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PrevBookmark()
|
public void PrevBookmark(bool currentFolderOnly = false)
|
||||||
{
|
{
|
||||||
if (mBookmarkList.Count == 0)
|
if (mBookmarkCount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int32 currentIdx = mBookmarkIdx;
|
int32 currentFolderIdx = mFolderIdx;
|
||||||
|
int32 currentBookmarkIdx = mBookmarkIdx;
|
||||||
|
|
||||||
Bookmark prevBookmark;
|
Bookmark nextBookmark = null;
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
{
|
{
|
||||||
mBookmarkIdx++;
|
mBookmarkIdx++;
|
||||||
if (mBookmarkIdx >= mBookmarkList.Count)
|
|
||||||
mBookmarkIdx = 0;
|
|
||||||
|
|
||||||
prevBookmark = mBookmarkList[mBookmarkIdx];
|
if (mBookmarkIdx >= mBookmarkFolders[mFolderIdx].mBookmarkList.Count)
|
||||||
|
{
|
||||||
|
if (!currentFolderOnly)
|
||||||
|
{
|
||||||
|
mFolderIdx++;
|
||||||
|
|
||||||
|
if (mFolderIdx >= mBookmarkFolders.Count)
|
||||||
|
{
|
||||||
|
// wrap to first folder
|
||||||
|
mFolderIdx = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select first bookmark in current folder (or -1 if there is no bookmark)
|
||||||
|
mBookmarkIdx = mBookmarkFolders[mFolderIdx].mBookmarkList.IsEmpty ? -1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mBookmarkIdx >= 0)
|
||||||
|
nextBookmark = mBookmarkFolders[mFolderIdx].mBookmarkList[mBookmarkIdx];
|
||||||
|
else
|
||||||
|
nextBookmark = null;
|
||||||
}
|
}
|
||||||
// skip disabled bookmarks, stop when we reach starting point
|
// skip disabled bookmarks, stop when we reach starting point
|
||||||
while (prevBookmark.mIsDisabled && (currentIdx != mBookmarkIdx));
|
while ((nextBookmark == null || nextBookmark.mIsDisabled) && ((currentFolderIdx != mFolderIdx) || (currentBookmarkIdx != mBookmarkIdx) && mBookmarkIdx != -1));
|
||||||
|
|
||||||
GotoBookmark(prevBookmark);
|
// If nextBookmark is disabled no bookmark is enabled.
|
||||||
|
if (nextBookmark != null && !nextBookmark.mIsDisabled)
|
||||||
|
GotoBookmark(nextBookmark);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NextBookmark()
|
public void NextBookmark(bool currentFolderOnly = false)
|
||||||
{
|
{
|
||||||
if (mBookmarkList.Count == 0)
|
if (mBookmarkCount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int32 currentIdx = mBookmarkIdx;
|
int32 currentFolderIdx = mFolderIdx;
|
||||||
|
int32 currentBookmarkIdx = mBookmarkIdx;
|
||||||
|
|
||||||
Bookmark nextBookmark;
|
Bookmark nextBookmark = null;
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
{
|
{
|
||||||
mBookmarkIdx--;
|
mBookmarkIdx--;
|
||||||
if (mBookmarkIdx < 0)
|
|
||||||
mBookmarkIdx = (int32)mBookmarkList.Count - 1;
|
|
||||||
|
|
||||||
nextBookmark = mBookmarkList[mBookmarkIdx];
|
if (mBookmarkIdx < 0)
|
||||||
|
{
|
||||||
|
if (!currentFolderOnly)
|
||||||
|
{
|
||||||
|
mFolderIdx--;
|
||||||
|
|
||||||
|
if (mFolderIdx < 0)
|
||||||
|
{
|
||||||
|
// wrap to last folder
|
||||||
|
mFolderIdx = (int32)mBookmarkFolders.Count - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select last bookmark in current folder
|
||||||
|
mBookmarkIdx = (int32)mBookmarkFolders[mFolderIdx].mBookmarkList.Count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mBookmarkIdx >= 0)
|
||||||
|
nextBookmark = mBookmarkFolders[mFolderIdx].mBookmarkList[mBookmarkIdx];
|
||||||
|
else
|
||||||
|
nextBookmark = null;
|
||||||
}
|
}
|
||||||
// skip disabled bookmarks, stop when we reach starting point
|
// skip disabled bookmarks, stop when we reach starting point
|
||||||
while (nextBookmark.mIsDisabled && (currentIdx != mBookmarkIdx));
|
while ((nextBookmark == null || nextBookmark.mIsDisabled) && ((currentFolderIdx != mFolderIdx) || (currentBookmarkIdx != mBookmarkIdx) && mBookmarkIdx != -1));
|
||||||
|
|
||||||
|
// If nextBookmark is disabled no bookmark is enabled.
|
||||||
|
if (nextBookmark != null && !nextBookmark.mIsDisabled)
|
||||||
GotoBookmark(nextBookmark);
|
GotoBookmark(nextBookmark);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GotoBookmark(Bookmark bookmark)
|
public void GotoBookmark(Bookmark bookmark)
|
||||||
{
|
{
|
||||||
|
mFolderIdx = (int32)mBookmarkFolders.IndexOf(bookmark.mFolder);
|
||||||
|
mBookmarkIdx = (int32)bookmark.mFolder.mBookmarkList.IndexOf(bookmark);
|
||||||
|
|
||||||
gApp.ShowSourceFileLocation(bookmark.mFileName, -1, -1, bookmark.mLineNum, bookmark.mColumn, LocatorType.Smart);
|
gApp.ShowSourceFileLocation(bookmark.mFileName, -1, -1, bookmark.mLineNum, bookmark.mColumn, LocatorType.Smart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,6 +196,8 @@ namespace IDE
|
||||||
Add("Autocomplete", new => gApp.Cmd_ShowAutoComplete, .None);
|
Add("Autocomplete", new => gApp.Cmd_ShowAutoComplete, .None);
|
||||||
Add("Bookmark Next", new => gApp.Cmd_NextBookmark, .Editor);
|
Add("Bookmark Next", new => gApp.Cmd_NextBookmark, .Editor);
|
||||||
Add("Bookmark Prev", new => gApp.Cmd_PrevBookmark, .Editor);
|
Add("Bookmark Prev", new => gApp.Cmd_PrevBookmark, .Editor);
|
||||||
|
Add("Bookmark Next in Folder", new => gApp.Cmd_NextBookmarkInFolder, .Editor);
|
||||||
|
Add("Bookmark Prev in Folder", new => gApp.Cmd_PrevBookmarkInFolder, .Editor);
|
||||||
Add("Bookmark Toggle", new => gApp.Cmd_ToggleBookmark, .Editor);
|
Add("Bookmark Toggle", new => gApp.Cmd_ToggleBookmark, .Editor);
|
||||||
Add("Bookmark Clear", new => gApp.Cmd_ClearBookmarks, .Editor);
|
Add("Bookmark Clear", new => gApp.Cmd_ClearBookmarks, .Editor);
|
||||||
Add("Break All", new => gApp.[Friend]Cmd_Break);
|
Add("Break All", new => gApp.[Friend]Cmd_Break);
|
||||||
|
|
|
@ -1897,9 +1897,17 @@ namespace IDE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using (sd.CreateArray("BookmarkFolders"))
|
||||||
|
{
|
||||||
|
for (var folder in mBookmarkManager.mBookmarkFolders)
|
||||||
|
{
|
||||||
|
using (sd.CreateObject())
|
||||||
|
{
|
||||||
|
sd.Add("Title", folder.mTitle);
|
||||||
|
|
||||||
using (sd.CreateArray("Bookmarks"))
|
using (sd.CreateArray("Bookmarks"))
|
||||||
{
|
{
|
||||||
for (var bookmark in mBookmarkManager.mBookmarkList)
|
for (var bookmark in folder.mBookmarkList)
|
||||||
{
|
{
|
||||||
if (bookmark.mFileName != null)
|
if (bookmark.mFileName != null)
|
||||||
{
|
{
|
||||||
|
@ -1917,6 +1925,9 @@ namespace IDE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
using (sd.CreateObject("DebuggerDisplayTypes"))
|
using (sd.CreateObject("DebuggerDisplayTypes"))
|
||||||
{
|
{
|
||||||
|
@ -3309,6 +3320,16 @@ namespace IDE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var _bookmarkFolder in data.Enumerate("BookmarkFolders"))
|
||||||
|
{
|
||||||
|
String title = scope String();
|
||||||
|
data.GetString("Title", title);
|
||||||
|
|
||||||
|
BookmarkFolder folder = null;
|
||||||
|
|
||||||
|
if (!String.IsNullOrWhiteSpace(title))
|
||||||
|
folder = mBookmarkManager.CreateFolder(title);
|
||||||
|
|
||||||
for (var _bookmark in data.Enumerate("Bookmarks"))
|
for (var _bookmark in data.Enumerate("Bookmarks"))
|
||||||
{
|
{
|
||||||
String relPath = scope String();
|
String relPath = scope String();
|
||||||
|
@ -3318,12 +3339,13 @@ namespace IDE
|
||||||
mWorkspace.GetWorkspaceAbsPath(relPath, absPath);
|
mWorkspace.GetWorkspaceAbsPath(relPath, absPath);
|
||||||
int32 lineNum = data.GetInt("Line");
|
int32 lineNum = data.GetInt("Line");
|
||||||
int32 column = data.GetInt("Column");
|
int32 column = data.GetInt("Column");
|
||||||
String title = scope String();
|
String bookmarkTitle = scope String();
|
||||||
data.GetString("Title", title);
|
data.GetString("Title", bookmarkTitle);
|
||||||
|
|
||||||
bool isDisabled = data.GetBool("Disabled", false);
|
bool isDisabled = data.GetBool("Disabled", false);
|
||||||
|
|
||||||
mBookmarkManager.CreateBookmark(absPath, lineNum, column, isDisabled, title);
|
mBookmarkManager.CreateBookmark(absPath, lineNum, column, isDisabled, bookmarkTitle, folder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var referenceId in data.Enumerate("DebuggerDisplayTypes"))
|
for (var referenceId in data.Enumerate("DebuggerDisplayTypes"))
|
||||||
|
@ -3952,13 +3974,25 @@ namespace IDE
|
||||||
[IDECommand]
|
[IDECommand]
|
||||||
public void Cmd_PrevBookmark()
|
public void Cmd_PrevBookmark()
|
||||||
{
|
{
|
||||||
mBookmarkManager.PrevBookmark();
|
mBookmarkManager.PrevBookmark(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[IDECommand]
|
||||||
|
public void Cmd_PrevBookmarkInFolder()
|
||||||
|
{
|
||||||
|
mBookmarkManager.PrevBookmark(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[IDECommand]
|
[IDECommand]
|
||||||
public void Cmd_NextBookmark()
|
public void Cmd_NextBookmark()
|
||||||
{
|
{
|
||||||
mBookmarkManager.NextBookmark();
|
mBookmarkManager.NextBookmark(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[IDECommand]
|
||||||
|
public void Cmd_NextBookmarkInFolder()
|
||||||
|
{
|
||||||
|
mBookmarkManager.NextBookmark(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[IDECommand]
|
[IDECommand]
|
||||||
|
|
|
@ -5,10 +5,9 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Beefy.theme;
|
using Beefy.theme;
|
||||||
using Beefy.events;
|
using Beefy.events;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace IDE.ui
|
namespace IDE.ui
|
||||||
{
|
|
||||||
class BookmarksPanel : Panel
|
|
||||||
{
|
{
|
||||||
public class BookmarksListView : IDEListView
|
public class BookmarksListView : IDEListView
|
||||||
{
|
{
|
||||||
|
@ -16,23 +15,68 @@ namespace IDE.ui
|
||||||
{
|
{
|
||||||
return new BookmarksListViewItem();
|
return new BookmarksListViewItem();
|
||||||
}
|
}
|
||||||
|
protected override void SetScaleData()
|
||||||
|
{
|
||||||
|
base.SetScaleData();
|
||||||
|
mIconX = GS!(200);
|
||||||
|
mOpenButtonX = GS!(0);
|
||||||
|
mLabelX = GS!(0);
|
||||||
|
//mChildIndent = GS!(16);
|
||||||
|
mHiliteOffset = GS!(-2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BookmarksListViewItem : IDEListViewItem
|
public class BookmarksListViewItem : IDEListViewItem
|
||||||
{
|
{
|
||||||
public Bookmark Bookmark;
|
public Object RefObject;
|
||||||
public String BookmarkLine ~ delete _;
|
public String BookmarkLine ~ delete _;
|
||||||
|
|
||||||
|
public float mLabelOffsetFolder = GS!(16);
|
||||||
|
public float mLabelOffsetBookmark = GS!(0);
|
||||||
|
|
||||||
|
public override void RehupScale(float oldScale, float newScale)
|
||||||
|
{
|
||||||
|
base.RehupScale(oldScale, newScale);
|
||||||
|
|
||||||
|
mLabelOffsetFolder = GS!(16);
|
||||||
|
mLabelOffsetBookmark = GS!(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override float GetLabelOffset()
|
||||||
|
{
|
||||||
|
if (RefObject is BookmarkFolder)
|
||||||
|
{
|
||||||
|
return mLabelOffsetFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mLabelOffsetBookmark;
|
||||||
|
}
|
||||||
|
|
||||||
public void Goto()
|
public void Goto()
|
||||||
{
|
{
|
||||||
gApp.mBookmarkManager.GotoBookmark(Bookmark);
|
if (Bookmark bookmark = RefObject as Bookmark)
|
||||||
|
{
|
||||||
|
gApp.mBookmarkManager.GotoBookmark(bookmark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BookmarksPanel : Panel
|
||||||
|
{
|
||||||
|
public DarkButton mCreateBookmarkFolder;
|
||||||
|
|
||||||
public BookmarksListView mBookmarksLV;
|
public BookmarksListView mBookmarksLV;
|
||||||
|
|
||||||
public this()
|
public this()
|
||||||
{
|
{
|
||||||
|
mCreateBookmarkFolder = new DarkButton();
|
||||||
|
mCreateBookmarkFolder.Label = "New Folder";
|
||||||
|
mCreateBookmarkFolder.mOnMouseClick.Add(new (args) =>
|
||||||
|
{
|
||||||
|
gApp.mBookmarkManager.CreateFolder();
|
||||||
|
});
|
||||||
|
AddWidget(mCreateBookmarkFolder);
|
||||||
|
|
||||||
mBookmarksLV = new .();
|
mBookmarksLV = new .();
|
||||||
mBookmarksLV.mOnEditDone.Add(new => HandleEditDone);
|
mBookmarksLV.mOnEditDone.Add(new => HandleEditDone);
|
||||||
|
|
||||||
|
@ -44,6 +88,9 @@ namespace IDE.ui
|
||||||
mBookmarksLV.AddColumn(400, "File");
|
mBookmarksLV.AddColumn(400, "File");
|
||||||
mBookmarksLV.AddColumn(120, "Line");
|
mBookmarksLV.AddColumn(120, "Line");
|
||||||
|
|
||||||
|
mBookmarksLV.mOnDragEnd.Add(new => BookmarksLV_OnDragEnd);
|
||||||
|
mBookmarksLV.mOnDragUpdate.Add(new => BookmarksLV_OnDragUpdate);
|
||||||
|
|
||||||
mBookmarksLV.mOnItemMouseDown.Add(new (item, x, y, btnNum, btnCount) =>
|
mBookmarksLV.mOnItemMouseDown.Add(new (item, x, y, btnNum, btnCount) =>
|
||||||
{
|
{
|
||||||
if ((btnNum == 0) && (btnCount == 2))
|
if ((btnNum == 0) && (btnCount == 2))
|
||||||
|
@ -58,33 +105,135 @@ namespace IDE.ui
|
||||||
mBookmarksLV.mOnKeyDown.Add(new => BookmarksLV_OnKeyDown);
|
mBookmarksLV.mOnKeyDown.Add(new => BookmarksLV_OnKeyDown);
|
||||||
|
|
||||||
AddWidget(mBookmarksLV);
|
AddWidget(mBookmarksLV);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BookmarksLV_OnKeyDown(KeyDownEvent event)
|
private void BookmarksLV_OnKeyDown(KeyDownEvent event)
|
||||||
{
|
{
|
||||||
if (event.mKeyCode == KeyCode.Delete)
|
if (event.mKeyCode == KeyCode.Delete)
|
||||||
{
|
{
|
||||||
DeleteSelectedItem();
|
DeleteSelectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
ListViewKeyDown_ShowMenu(event);
|
ListViewKeyDown_ShowMenu(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void RehupScale(float oldScale, float newScale)
|
||||||
|
{
|
||||||
|
mBookmarksLV.mOpenButtonX = GS!(4);
|
||||||
|
base.RehupScale(oldScale, newScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BookmarksLV_OnDragUpdate(DragEvent evt)
|
||||||
|
{
|
||||||
|
var dragKind = evt.mDragKind;
|
||||||
|
evt.mDragKind = .None;
|
||||||
|
|
||||||
|
var dragSource = evt.mSender as BookmarksListViewItem;
|
||||||
|
var dragTarget = evt.mDragTarget as BookmarksListViewItem;
|
||||||
|
|
||||||
|
// Folders can only be dragged onto other folders
|
||||||
|
if (dragSource.RefObject is BookmarkFolder && (!dragTarget.RefObject is BookmarkFolder))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (dragSource == null)
|
||||||
|
return;
|
||||||
|
if (dragTarget == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
evt.mDragKind = .After;
|
||||||
|
|
||||||
|
if ((dragTarget.mLabel == "") && (dragKind == .After))
|
||||||
|
dragKind = .Before;
|
||||||
|
|
||||||
|
if (dragKind == .None)
|
||||||
|
return;
|
||||||
|
evt.mDragKind = dragKind;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BookmarksLV_OnDragEnd(DragEvent theEvent)
|
||||||
|
{
|
||||||
|
if (theEvent.mDragKind == .None)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (theEvent.mDragTarget is BookmarksListViewItem)
|
||||||
|
{
|
||||||
|
var source = (BookmarksListViewItem)theEvent.mSender;
|
||||||
|
var target = (BookmarksListViewItem)theEvent.mDragTarget;
|
||||||
|
|
||||||
|
if (source.mListView == target.mListView)
|
||||||
|
{
|
||||||
|
if (source == target)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<BookmarksListViewItem> selectedItems = scope .();
|
||||||
|
mBookmarksLV.GetRoot().WithSelectedItems(scope [&] (selectedItem) =>
|
||||||
|
{
|
||||||
|
selectedItems.Add((BookmarksListViewItem)selectedItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (BookmarksListViewItem item in selectedItems)
|
||||||
|
{
|
||||||
|
if (var sourceBookmark = item.RefObject as Bookmark)
|
||||||
|
{
|
||||||
|
if (var targetBookmark = target.RefObject as Bookmark)
|
||||||
|
{
|
||||||
|
if (theEvent.mDragKind == .After)
|
||||||
|
{
|
||||||
|
int index = targetBookmark.mFolder.mBookmarkList.IndexOf(targetBookmark);
|
||||||
|
index++;
|
||||||
|
|
||||||
|
Bookmark prevBookmark = null;
|
||||||
|
|
||||||
|
if (index < targetBookmark.mFolder.mBookmarkList.Count)
|
||||||
|
{
|
||||||
|
prevBookmark = targetBookmark.mFolder.mBookmarkList[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
gApp.mBookmarkManager.MoveBookmarkToFolder(sourceBookmark, targetBookmark.mFolder, prevBookmark);
|
||||||
|
}
|
||||||
|
else if (theEvent.mDragKind == .Before)
|
||||||
|
{
|
||||||
|
gApp.mBookmarkManager.MoveBookmarkToFolder(sourceBookmark, targetBookmark.mFolder, targetBookmark);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (var targetFolder = target.RefObject as BookmarkFolder)
|
||||||
|
{
|
||||||
|
if (theEvent.mDragKind == .Before)
|
||||||
|
{
|
||||||
|
// Drop before folder -> Drop to root
|
||||||
|
gApp.mBookmarkManager.MoveBookmarkToFolder(sourceBookmark, gApp.mBookmarkManager.mRootFolder);
|
||||||
|
}
|
||||||
|
else if (theEvent.mDragKind == .After || theEvent.mDragKind == .Inside)
|
||||||
|
{
|
||||||
|
gApp.mBookmarkManager.MoveBookmarkToFolder(sourceBookmark, targetFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (var sourceFolder = item.RefObject as BookmarkFolder)
|
||||||
|
{
|
||||||
|
if (var targetFolder = target.RefObject as BookmarkFolder)
|
||||||
|
{
|
||||||
|
if (theEvent.mDragKind == .Before)
|
||||||
|
{
|
||||||
|
gApp.mBookmarkManager.MoveFolder(sourceFolder, .Before, targetFolder);
|
||||||
|
}
|
||||||
|
else if (theEvent.mDragKind == .After)
|
||||||
|
{
|
||||||
|
gApp.mBookmarkManager.MoveFolder(sourceFolder, .After, targetFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Tries to rename the currently selected bookmark
|
/// Tries to rename the currently selected bookmark
|
||||||
public void TryRenameItem()
|
public void TryRenameItem()
|
||||||
{
|
{
|
||||||
ListViewItem selectedItem = mBookmarksLV.GetRoot().FindFirstSelectedItem();
|
ListViewItem selectedItem = mBookmarksLV.GetRoot().FindFirstSelectedItem();
|
||||||
RenameItem(selectedItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteSelectedItem()
|
RenameItem(selectedItem);
|
||||||
{
|
|
||||||
ListViewItem selectedItem = mBookmarksLV.GetRoot().FindFirstSelectedItem();
|
|
||||||
if (var bookmarkItem = selectedItem as BookmarksListViewItem)
|
|
||||||
{
|
|
||||||
gApp.mBookmarkManager.DeleteBookmark(bookmarkItem.Bookmark);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleEditDone(EditWidget editWidget, bool cancelled)
|
private void HandleEditDone(EditWidget editWidget, bool cancelled)
|
||||||
|
@ -97,16 +246,19 @@ namespace IDE.ui
|
||||||
|
|
||||||
if (var item = listViewItem as BookmarksListViewItem)
|
if (var item = listViewItem as BookmarksListViewItem)
|
||||||
{
|
{
|
||||||
item.Bookmark.mTitle.Clear();
|
if (var bookmark = item.RefObject as Bookmark)
|
||||||
item.Bookmark.mTitle.Append(newValue);
|
|
||||||
listViewItem.Label = item.Bookmark.mTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ~this()
|
|
||||||
{
|
{
|
||||||
|
bookmark.mTitle.Clear();
|
||||||
|
bookmark.mTitle.Append(newValue);
|
||||||
|
listViewItem.Label = bookmark.mTitle;
|
||||||
|
}
|
||||||
|
else if (var folder = item.RefObject as BookmarkFolder)
|
||||||
|
{
|
||||||
|
folder.mTitle.Clear();
|
||||||
|
folder.mTitle.Append(newValue);
|
||||||
|
listViewItem.Label = folder.mTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ShowRightClickMenu(Widget relWidget, float x, float y)
|
protected override void ShowRightClickMenu(Widget relWidget, float x, float y)
|
||||||
|
@ -126,10 +278,12 @@ namespace IDE.ui
|
||||||
{
|
{
|
||||||
if (var bookmarkItem = item as BookmarksListViewItem)
|
if (var bookmarkItem = item as BookmarksListViewItem)
|
||||||
{
|
{
|
||||||
gApp.mBookmarkManager.DeleteBookmark(bookmarkItem.Bookmark);
|
if (var bookmark = bookmarkItem.RefObject as Bookmark)
|
||||||
|
gApp.mBookmarkManager.DeleteBookmark(bookmark);
|
||||||
|
else if (var folder = bookmarkItem.RefObject as BookmarkFolder)
|
||||||
|
gApp.mBookmarkManager.DeleteFolder(folder);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
anItem = menu.AddItem("Rename");
|
anItem = menu.AddItem("Rename");
|
||||||
|
@ -147,11 +301,7 @@ namespace IDE.ui
|
||||||
anItem = menu.AddItem("Enable all Bookmarks");
|
anItem = menu.AddItem("Enable all Bookmarks");
|
||||||
anItem.mOnMenuItemSelected.Add(new (item) =>
|
anItem.mOnMenuItemSelected.Add(new (item) =>
|
||||||
{
|
{
|
||||||
for (Bookmark b in gApp.mBookmarkManager.mBookmarkList)
|
gApp.mBookmarkManager.AllBookmarksDisabled = false;
|
||||||
{
|
|
||||||
b.mIsDisabled = false;
|
|
||||||
}
|
|
||||||
mBookmarksDirty = true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -159,11 +309,7 @@ namespace IDE.ui
|
||||||
anItem = menu.AddItem("Disable all Bookmarks");
|
anItem = menu.AddItem("Disable all Bookmarks");
|
||||||
anItem.mOnMenuItemSelected.Add(new (item) =>
|
anItem.mOnMenuItemSelected.Add(new (item) =>
|
||||||
{
|
{
|
||||||
for (Bookmark b in gApp.mBookmarkManager.mBookmarkList)
|
gApp.mBookmarkManager.AllBookmarksDisabled = true;
|
||||||
{
|
|
||||||
b.mIsDisabled = true;
|
|
||||||
}
|
|
||||||
mBookmarksDirty = true;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +325,7 @@ namespace IDE.ui
|
||||||
|
|
||||||
void RenameItem(ListViewItem listViewItem)
|
void RenameItem(ListViewItem listViewItem)
|
||||||
{
|
{
|
||||||
|
if (listViewItem != null)
|
||||||
EditListViewItem(listViewItem);
|
EditListViewItem(listViewItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,12 +339,16 @@ namespace IDE.ui
|
||||||
public override void Resize(float x, float y, float width, float height)
|
public override void Resize(float x, float y, float width, float height)
|
||||||
{
|
{
|
||||||
base.Resize(x, y, width, height);
|
base.Resize(x, y, width, height);
|
||||||
mBookmarksLV.Resize(0, 0, width, height);
|
|
||||||
|
float buttonWidth = GS!(140);
|
||||||
|
float buttonHeight = GS!(22);
|
||||||
|
mCreateBookmarkFolder.Resize(0, 0, buttonWidth, buttonHeight);
|
||||||
|
|
||||||
|
mBookmarksLV.Resize(0, buttonHeight, width, Math.Max(mHeight - buttonHeight, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool mBookmarksDirty;
|
public bool mBookmarksDirty;
|
||||||
|
@ -217,25 +368,66 @@ namespace IDE.ui
|
||||||
|
|
||||||
root.Clear();
|
root.Clear();
|
||||||
|
|
||||||
for (Bookmark bookmark in gApp.mBookmarkManager.mBookmarkList)
|
for (BookmarkFolder folder in gApp.mBookmarkManager.mBookmarkFolders)
|
||||||
{
|
{
|
||||||
BookmarksListViewItem listViewItem = (.)root.CreateChildItem();
|
bool isRoot = (folder == IDEApp.sApp.mBookmarkManager.mRootFolder);
|
||||||
|
|
||||||
|
BookmarksListViewItem FolderItem = null;
|
||||||
|
|
||||||
|
if (!isRoot)
|
||||||
|
{
|
||||||
|
FolderItem = (BookmarksListViewItem)root.CreateChildItem();
|
||||||
|
SetupListViewItemFolder(FolderItem, folder);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FolderItem = (BookmarksListViewItem)root;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Bookmark bookmark in folder.mBookmarkList)
|
||||||
|
{
|
||||||
|
var listViewItem = (BookmarksListViewItem)(FolderItem.CreateChildItem());
|
||||||
SetupListViewItem(listViewItem, bookmark);
|
SetupListViewItem(listViewItem, bookmark);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mBookmarksDirty = false;
|
mBookmarksDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetupListViewItemFolder(BookmarksListViewItem listViewItem, BookmarkFolder folder)
|
||||||
|
{
|
||||||
|
listViewItem.AllowDragging = true;
|
||||||
|
|
||||||
|
listViewItem.RefObject = folder;
|
||||||
|
|
||||||
|
var subViewItem = (DarkListViewItem)listViewItem.GetOrCreateSubItem(0);
|
||||||
|
|
||||||
|
DarkCheckBox cb = new DarkCheckBox();
|
||||||
|
cb.Checked = !folder.IsDisabled;
|
||||||
|
cb.Resize(GS!(-16), 0, GS!(22), GS!(22));
|
||||||
|
cb.mOnValueChanged.Add(new () =>
|
||||||
|
{
|
||||||
|
folder.IsDisabled = !cb.Checked;
|
||||||
|
});
|
||||||
|
subViewItem.AddWidget(cb);
|
||||||
|
|
||||||
|
subViewItem.Label = folder.mTitle;
|
||||||
|
subViewItem.Resize(GS!(22), 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
private void SetupListViewItem(BookmarksListViewItem listViewItem, Bookmark bookmark)
|
private void SetupListViewItem(BookmarksListViewItem listViewItem, Bookmark bookmark)
|
||||||
{
|
{
|
||||||
listViewItem.Bookmark = bookmark;
|
listViewItem.AllowDragging = true;
|
||||||
|
|
||||||
|
listViewItem.RefObject = bookmark;
|
||||||
|
|
||||||
var subViewItem = (DarkListViewItem)listViewItem.GetOrCreateSubItem(0);
|
var subViewItem = (DarkListViewItem)listViewItem.GetOrCreateSubItem(0);
|
||||||
|
|
||||||
DarkCheckBox cb = new DarkCheckBox();
|
DarkCheckBox cb = new DarkCheckBox();
|
||||||
cb.Checked = !bookmark.mIsDisabled;
|
cb.Checked = !bookmark.mIsDisabled;
|
||||||
cb.Resize(GS!(-16), 0, GS!(22), GS!(22));
|
cb.Resize(GS!(-16), 0, GS!(22), GS!(22));
|
||||||
cb.mOnValueChanged.Add(new () => {
|
cb.mOnValueChanged.Add(new () =>
|
||||||
|
{
|
||||||
bookmark.mIsDisabled = !cb.Checked;
|
bookmark.mIsDisabled = !cb.Checked;
|
||||||
});
|
});
|
||||||
subViewItem.AddWidget(cb);
|
subViewItem.AddWidget(cb);
|
||||||
|
@ -274,8 +466,10 @@ namespace IDE.ui
|
||||||
{
|
{
|
||||||
BookmarksListViewItem item = (.)selectedItems[itemIdx];
|
BookmarksListViewItem item = (.)selectedItems[itemIdx];
|
||||||
|
|
||||||
if (item.Bookmark != null)
|
if (var bookmark = item.RefObject as Bookmark)
|
||||||
gApp.mBookmarkManager.DeleteBookmark(item.Bookmark);
|
gApp.mBookmarkManager.DeleteBookmark(bookmark);
|
||||||
|
else if (var folder = item.RefObject as BookmarkFolder)
|
||||||
|
gApp.mBookmarkManager.DeleteFolder(folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3172,7 +3172,9 @@ namespace IDE.ui
|
||||||
if (mFilePath == null)
|
if (mFilePath == null)
|
||||||
return mTrackedTextElementViewList;
|
return mTrackedTextElementViewList;
|
||||||
|
|
||||||
for (var bookmark in IDEApp.sApp.mBookmarkManager.mBookmarkList)
|
for (var folder in IDEApp.sApp.mBookmarkManager.mBookmarkFolders)
|
||||||
|
{
|
||||||
|
for (var bookmark in folder.mBookmarkList)
|
||||||
{
|
{
|
||||||
if (Path.Equals(bookmark.mFileName, findFileName))
|
if (Path.Equals(bookmark.mFileName, findFileName))
|
||||||
{
|
{
|
||||||
|
@ -3181,6 +3183,7 @@ namespace IDE.ui
|
||||||
mTrackedTextElementViewList.Add(bookmarkView);
|
mTrackedTextElementViewList.Add(bookmarkView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (var breakpoint in debugManager.mBreakpointList)
|
for (var breakpoint in debugManager.mBreakpointList)
|
||||||
{
|
{
|
||||||
|
@ -4393,11 +4396,14 @@ namespace IDE.ui
|
||||||
|
|
||||||
bool hadBookmark = false;
|
bool hadBookmark = false;
|
||||||
|
|
||||||
WithTrackedElementsAtCursor<Bookmark>(IDEApp.sApp.mBookmarkManager.mBookmarkList, scope [&] (bookmark) =>
|
for (var folder in IDEApp.sApp.mBookmarkManager.mBookmarkFolders)
|
||||||
|
{
|
||||||
|
WithTrackedElementsAtCursor<Bookmark>(folder.mBookmarkList, scope [&] (bookmark) =>
|
||||||
{
|
{
|
||||||
bookmarkManager.DeleteBookmark(bookmark);
|
bookmarkManager.DeleteBookmark(bookmark);
|
||||||
hadBookmark = true;
|
hadBookmark = true;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!hadBookmark)
|
if (!hadBookmark)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue