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:
Vincent van Ravesteijn 2009-01-07 01:48:47 +00:00
parent 6cf5e092ea
commit c51ae2651c
3 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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];

View File

@ -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; }