]> git.lyx.org Git - lyx.git/blobdiff - src/bufferparams.C
Move #includes out of header files.
[lyx.git] / src / bufferparams.C
index 02b6b677edc319ff20ced88d3e661e2c09770215..ac250f11a2731e8ffb74f05dd34c5eb7d7f4f910 100644 (file)
@@ -1,36 +1,44 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file bufferparams.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Alfredo Braunstein
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ * \author John Levon
+ * \author André Pönitz
+ * \author Martin Vermeer
  *
- *          Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
+#include "author.h"
 #include "bufferparams.h"
-#include "tex-strings.h"
+#include "debug.h"
 #include "encoding.h"
+#include "gettext.h"
 #include "layout.h"
-#include "vspace.h"
-#include "debug.h"
-#include "lyxrc.h"
 #include "language.h"
-#include "lyxtextclasslist.h"
-#include "lyxlex.h"
+#include "LaTeXFeatures.h"
+#include "LColor.h"
 #include "Lsstream.h"
-#include "author.h"
-#include "gettext.h"
+#include "lyxrc.h"
+#include "lyxlex.h"
+#include "lyxtextclasslist.h"
+#include "tex-strings.h"
+#include "texrow.h"
+#include "vspace.h"
+
+#include "frontends/Alert.h"
 
 #include "support/lyxalgo.h" // for lyx::count
 #include "support/lyxlib.h"
 #include "support/lstrings.h"
 #include "support/types.h"
 
-#include "frontends/Alert.h"
-
 #include <cstdlib>
 #include <algorithm>
 
@@ -192,6 +200,31 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
        } else if (token == "\\tracking_changes") {
                lex.nextToken();
                tracking_changes = lex.getInteger();
+       } else if (token == "\\branch") {
+               lex.nextToken();
+               string branch = lex.getString();
+               branchlist.add(branch);
+               while (true) {
+                       lex.nextToken();
+                       string const tok = lex.getString();
+                       if (tok == "\\end_branch")
+                               break;
+                       if (tok == "\\selected") {
+                               lex.nextToken();
+                               branchlist.setSelected(branch, lex.getInteger());
+                       }
+                       // not yet operational
+                       if (tok == "\\color") {
+                               lex.nextToken();
+                               string color = lex.getString();
+                               branchlist.setColor(branch, color);
+                               // Update also the LColor table:
+                               if (color == "none") 
+                                       color = lcolor.getX11Name(LColor::background);
+                               lcolor.fill(static_cast<LColor::color>(lcolor.size()), 
+                                               branch, color);
+                       }
+               }
        } else if (token == "\\author") {
                lex.nextToken();
                istringstream ss(STRCONV(lex.getString()));
@@ -380,6 +413,17 @@ void BufferParams::writeFile(ostream & os) const
           << "\n\\use_numerical_citations " << use_numerical_citations
           << "\n\\paperorientation " << string_orientation[orientation]
           << '\n';
+
+       std::list<Branch>::const_iterator it = branchlist.begin();
+       std::list<Branch>::const_iterator end = branchlist.end();
+       for (; it != end; ++it) {
+               os << "\\branch " << it->getBranch()
+                  << "\n\\selected " << it->getSelected()      
+                  << "\n\\color " << it->getColor()    
+                  << "\n\\end_branch" 
+                  << "\n";
+       }
+
        if (!paperwidth.empty())
                os << "\\paperwidth "
                   << VSpace(paperwidth).asLyXCommand() << '\n';