mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
Correct enabling of the "Navigate->Bookmarks->Clear Bookmarks" menu item.
* LyXFunc.cpp: Note that getStatus() always returned true for LFUN_BOOKMARK_CLEAR. This is because bookmarks().size() is hardcoded in the code to be 9 which is always larger than zero, obviously git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28014 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6cf5e092ea
commit
c51ae2651c
@ -519,7 +519,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
}
|
||||
|
||||
case LFUN_BOOKMARK_CLEAR:
|
||||
enable = theSession().bookmarks().size() > 0;
|
||||
enable = theSession().bookmarks().hasValid();
|
||||
break;
|
||||
|
||||
// this one is difficult to get right. As a half-baked
|
||||
|
@ -285,6 +285,16 @@ bool BookmarksSection::isValid(unsigned int i) const
|
||||
}
|
||||
|
||||
|
||||
bool BookmarksSection::hasValid() const
|
||||
{
|
||||
for (size_t i = 1; i <= size(); ++i) {
|
||||
if (isValid(i))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
BookmarksSection::Bookmark const & BookmarksSection::bookmark(unsigned int i) const
|
||||
{
|
||||
return bookmarks[i];
|
||||
|
@ -233,6 +233,9 @@ public:
|
||||
/// does the given bookmark have a saved position ?
|
||||
bool isValid(unsigned int i) const;
|
||||
|
||||
/// is there at least one bookmark that has a saved position ?
|
||||
bool hasValid() const;
|
||||
|
||||
///
|
||||
unsigned int size() const { return max_bookmarks; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user