implement buffer-next/previous (bug 515)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9103 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2004-10-22 10:24:55 +00:00
parent d49b60b258
commit 8b7da465d8
11 changed files with 82 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2004-10-19 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* bind/xemacs.bind:
* bind/emacs.bind:
* bind/mac.bind:
* bind/cua.bind: add bindings for buffer-previous/next
2004-10-18 Andreas Vox <vox@isp.uni-luebeck.de>
* layouts/db_stdstarsections.inc: fix definition, no title.

View File

@ -49,6 +49,8 @@
\bind "C-S-D" "buffer-update dvi" # 'd' for dvi
\bind "C-S-T" "buffer-update ps"
\bind "C-q" "lyx-quit"
\bind "C-Next" "buffer-next"
\bind "C-Prior" "buffer-previous"
\bind "C-b" "font-bold"
\bind "C-e" "font-emph"
@ -85,8 +87,10 @@
\bind "F2" "buffer-write"
\bind "F3" "file-open"
\bind "C-F4" "buffer-close"
\bind "F5" "screen-recenter"
\bind "M-F4" "lyx-quit"
\bind "F5" "screen-recenter"
\bind "C-F6" "buffer-next"
\bind "C-S-F6" "buffer-previous"
\bind "F7" "dialog-show spellchecker"
\bind "S-F7" "thesaurus-entry"

View File

@ -101,6 +101,8 @@
#\bind "C-x C-r" "buffer-update dvi"
\bind "C-x C-s" "buffer-write"
\bind "C-x C-t" "buffer-update dvi"
\bind "C-Next" "buffer-next"
\bind "C-Prior" "buffer-previous"
# this is "upcase-region" in emacs

View File

@ -40,6 +40,8 @@
\bind "C-S-D" "buffer-update dvi" # 'd' for dvi
\bind "C-S-T" "buffer-update pdf" # (pdflatex; was "ps")
\bind "C-q" "lyx-quit"
\bind "C-grave" "buffer-next"
\bind "C-asciitilde" "buffer-previous"
\bind "C-b" "font-bold"
\bind "C-e" "font-emph"

View File

@ -111,6 +111,8 @@
\bind "C-x C-t" "buffer-update dvi"
\bind "C-x C-u" "word-upcase" # upcase-region!
\bind "C-x C-w" "buffer-write-as"
\bind "C-Next" "buffer-next"
\bind "C-Prior" "buffer-previous"
#bind "C-1" "------"
#bind "C-2" "------"

View File

@ -1,3 +1,12 @@
2004-10-18 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxfunc.C (getStatus,dispatch): handle LFUN_(PREVIOUS|NEXT)BUFFER
* bufferlist.C (previous, next): new methods
* lfuns.h:
* LyXAction.C (init): add LFUN_NEXTBUFFER and LFUN_PREVIOUSBUFFER
2004-10-18 Andreas Vox <vox@isp.uni-luebeck.de>
* buffer.C (makeDocBookFile): add dsssl stylesheet control

View File

@ -337,6 +337,8 @@ void LyXAction::init()
{ LFUN_BUFFERPARAMS_APPLY, "buffer-params-apply", Noop },
{ LFUN_LYXRC_APPLY, "lyxrc-apply", NoBuffer },
{ LFUN_INSET_REFRESH, "", Noop },
{ LFUN_NEXTBUFFER, "buffer-next", ReadOnly },
{ LFUN_PREVIOUSBUFFER, "buffer-previous", ReadOnly },
{ LFUN_NOACTION, "", Noop }
};

View File

@ -217,6 +217,35 @@ Buffer * BufferList::getBuffer(unsigned int choice)
}
Buffer * BufferList::next(Buffer const * buf) const
{
if (bstore.empty())
return 0;
BufferStorage::const_iterator it = find(bstore.begin(),
bstore.end(), buf);
BOOST_ASSERT(it != bstore.end());
++it;
if (it == bstore.end())
return bstore.front();
else
return *it;
}
Buffer * BufferList::previous(Buffer const * buf) const
{
if (bstore.empty())
return 0;
BufferStorage::const_iterator it = find(bstore.begin(),
bstore.end(), buf);
BOOST_ASSERT(it != bstore.end());
if (it == bstore.begin())
return bstore.back();
else
return *(it - 1);
}
void BufferList::updateIncludedTeXfiles(string const & mastertmpdir,
OutputParams const & runparams)
{

View File

@ -71,6 +71,18 @@ public:
/// returns a pointer to the buffer whose temppath matches the string
Buffer * BufferList::getBufferFromTmp(std::string const &);
/** returns a pointer to the buffer that follows argument in
* buffer list. The buffer following the last in list is the
* first one.
*/
Buffer * next(Buffer const *) const;
/** returns a pointer to the buffer that precedes argument in
* buffer list. The buffer preceding the first in list is the
* last one.
*/
Buffer * previous(Buffer const *) const;
/// reset current author for all buffers
void setCurrentAuthor(std::string const & name, std::string const & email);

View File

@ -350,6 +350,8 @@ enum kb_action {
LFUN_LYXRC_APPLY,
LFUN_GRAPHICS_EDIT,
LFUN_INSET_REFRESH,
LFUN_NEXTBUFFER,
LFUN_PREVIOUSBUFFER,
LFUN_LASTACTION // end of the table
};

View File

@ -503,6 +503,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
case LFUN_SAVE_AS_DEFAULT:
case LFUN_BUFFERPARAMS_APPLY:
case LFUN_LYXRC_APPLY:
case LFUN_NEXTBUFFER:
case LFUN_PREVIOUSBUFFER:
// these are handled in our dispatch()
break;
@ -958,6 +960,14 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
view()->setBuffer(bufferlist.getBuffer(argument));
break;
case LFUN_NEXTBUFFER:
view()->setBuffer(bufferlist.next(view()->buffer()));
break;
case LFUN_PREVIOUSBUFFER:
view()->setBuffer(bufferlist.previous(view()->buffer()));
break;
case LFUN_FILE_NEW:
NewFile(view(), argument);
break;