#include "ControlDocument.h"
#include "ViewBase.h"
+#include "BranchList.h"
#include "buffer.h"
#include "buffer_funcs.h"
#include "bufferparams.h"
#include "gettext.h"
#include "iterators.h"
#include "language.h"
+#include "LColor.h"
#include "lyxtextclasslist.h"
#include "paragraph.h"
#include "funcrequest.h"
#include "lfuns.h"
-#include "LColor.h"
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
lv_.message(_("Document settings applied"));
+ // branches
+ BranchList & branchlist = params().branchlist();
+ BranchList::const_iterator it = branchlist.begin();
+ BranchList::const_iterator const end = branchlist.end();
+ for (; it != end; ++it) {
+ string const & current_branch = it->getBranch();
+ Branch const * branch = branchlist.find(current_branch);
+ string x11hexname = branch->getColor();
+ // check that we have a valid color!
+ if (x11hexname.empty() || x11hexname[0] != '#')
+ x11hexname = lcolor.getX11Name(LColor::background);
+ // display the new color
+ string const str = current_branch + ' ' + x11hexname;
+ lv_.dispatch(FuncRequest(LFUN_SET_COLOR, str));
+ }
+
// Open insets of selected branches, close deselected ones
// Currently only top-level insets in buffer handled (bug).
ParIterator pit = buffer()->par_iterator_begin();
}
-void ControlDocument::setBranchColor(string const & branch, string const & hex)
-{
- lcolor.setColor(branch, hex);
- string const s = branch + ' ' + hex;
- lv_.dispatch(FuncRequest(LFUN_SET_COLOR, s));
-}
-
-
void ControlDocument::classApply()
{
BufferParams & params = buffer()->params();