From f4b8546ee598bff0c3dc09ea6858d30cd86be490 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 6 Aug 2007 16:15:00 +0000 Subject: [PATCH] Introduce LFUN to save all modified files, and add menu entries. Patch from Guillaume Pothier for 1.4.x adapted by me to current branch. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@19341 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/MenuBackend.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index 7865786ff3..0180e42271 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -456,24 +456,27 @@ void expandLastfiles(Menu & tomenu) void expandDocuments(Menu & tomenu) { - typedef vector Strings; - Strings const names = theBufferList().getFileNames(); - - if (names.empty()) { - tomenu.add(MenuItem(MenuItem::Command, _("No Document Open!"), - FuncRequest(LFUN_NOACTION))); + Buffer * first = theBufferList().first(); + if (first) { + Buffer * b = first; + int ii = 1; + + // We cannot use a for loop as the buffer list cycles. + do { + docstring label = makeDisplayPath(b->fileName(), 20); + if (!b->isClean()) label = label + "*"; + if (ii < 10) + label = convert(ii) + ". " + label + '|' + convert(ii); + tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BUFFER_SWITCH, b->fileName()))); + + b = theBufferList().next(b); + ++ii; + } while (b != first); + } else { + tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"), + FuncRequest(LFUN_NOACTION))); return; } - - int ii = 1; - Strings::const_iterator docit = names.begin(); - Strings::const_iterator end = names.end(); - for (; docit != end; ++docit, ++ii) { - docstring label = makeDisplayPath(*docit, 20); - if (ii < 10) - label = convert(ii) + ". " + label + char_type('|') + convert(ii); - tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BUFFER_SWITCH, *docit))); - } }