]> git.lyx.org Git - features.git/commitdiff
Patch to mark modified files in the view menu with a *.
authorRichard Heck <rgheck@comcast.net>
Mon, 6 Aug 2007 15:33:06 +0000 (15:33 +0000)
committerRichard Heck <rgheck@comcast.net>
Mon, 6 Aug 2007 15:33:06 +0000 (15:33 +0000)
Patch from Guillaume Pothier for 1.4.x adapted by me to
current trunk.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19337 a592a061-630c-0410-9148-cb99ea01b6c8

src/MenuBackend.cpp

index 7865786ff3ff326297b4c0c1e704c8a5aeead262..0180e42271ec6bad779be2e6bef346effdad627a 100644 (file)
@@ -456,24 +456,27 @@ void expandLastfiles(Menu & tomenu)
 
 void expandDocuments(Menu & tomenu)
 {
-       typedef vector<string> 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<docstring>(ii) + ". " + label + '|' + convert<docstring>(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<docstring>(ii) + ". " + label + char_type('|') + convert<docstring>(ii);
-               tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BUFFER_SWITCH, *docit)));
-       }
 }