Author: rgheck
Date: Sun Oct 30 21:02:14 2011
New Revision: 40101
URL: http://www.lyx.org/trac/changeset/40101

Log:
Fix the outstanding part of #7764, which involves sorting the file lists
under Document>Settings>Output.

It turns out that we always want this list to be sorted when we get it,
so we can sort it in BufferParams rather than in three different places.

Modified:
   lyx-devel/trunk/src/BufferParams.cpp
   lyx-devel/trunk/src/frontends/qt4/GuiSendto.cpp
   lyx-devel/trunk/src/frontends/qt4/Menus.cpp

Modified: lyx-devel/trunk/src/BufferParams.cpp
==============================================================================
--- lyx-devel/trunk/src/BufferParams.cpp        Sun Oct 30 20:52:33 2011        
(r40100)
+++ lyx-devel/trunk/src/BufferParams.cpp        Sun Oct 30 21:02:14 2011        
(r40101)
@@ -2038,6 +2038,13 @@
 }
 
 
+namespace {
+bool formatSorter(Format const * lhs, Format const * rhs) {
+       return _(lhs->prettyname()) < _(rhs->prettyname());
+}
+}
+
+
 vector<Format const *> BufferParams::exportableFormats(bool only_viewable) 
const
 {
        vector<string> const backs = backends();
@@ -2054,6 +2061,7 @@
                        theConverters().getReachable(*it, only_viewable, false, 
excludes);
                result.insert(result.end(), r.begin(), r.end());
        }
+       sort(result.begin(), result.end(), formatSorter);
        return result;
 }
 

Modified: lyx-devel/trunk/src/frontends/qt4/GuiSendto.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiSendto.cpp     Sun Oct 30 20:52:33 
2011        (r40100)
+++ lyx-devel/trunk/src/frontends/qt4/GuiSendto.cpp     Sun Oct 30 21:02:14 
2011        (r40101)
@@ -69,19 +69,10 @@
 }
 
 
-namespace {
-bool formatSorter(Format const * lhs, Format const * rhs) {
-       return _(lhs->prettyname()) < _(rhs->prettyname());
-}
-} // end namespace
-
-
 void GuiSendTo::updateContents()
 {
        all_formats_ = buffer().params().exportableFormats(false);
        
-       sort(all_formats_.begin(), all_formats_.end(), formatSorter);
-
        // Save the current selection if any
        Format const * current_format = 0;
        int const line = formatLW->currentRow();

Modified: lyx-devel/trunk/src/frontends/qt4/Menus.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/Menus.cpp Sun Oct 30 20:52:33 2011        
(r40100)
+++ lyx-devel/trunk/src/frontends/qt4/Menus.cpp Sun Oct 30 21:02:14 2011        
(r40101)
@@ -723,12 +723,6 @@
 }
 
 
-bool compareFormat(Format const * p1, Format const * p2)
-{
-       return *p1 < *p2;
-}
-
-
 QString limitStringLength(docstring const & str)
 {
        size_t const max_item_length = 45;
@@ -1023,8 +1017,6 @@
                return;
        }
        
-       sort(formats.begin(), formats.end(), &compareFormat);
-
        bool const view_update = (kind == MenuItem::ViewFormats
                        || kind == MenuItem::UpdateFormats);
 

Reply via email to