Vincent van Ravesteijn wrote:
> > would you find it a good idea to enhance branch insets in the following
> > way ?
> >
> > 1. add possibility to define pre-post latex commands for a branch
> >   which would be inserted just before/after each branch inset?
> >
> 
> No.

pity. what would be your solution to the problem of having mutliple
type of (foot)notes when different audiences need different type
of notes?

the already possible solutions i see -
1. nesting branch & custom inset.
2. some tag in custom layout which simulates branch via
   commenting out the output.

i'm not much happy about either way.

> > 2. different collapsed branches can't be visually distinguished.
> >   what about using the color scheme defined for the branch even on
> >   the branch insets in collapsed state?
> >
> 
> Yes.

the following patch would add branch color into the inset button label.
second possibility would be to define background and foreground in
the same way as inside the inset, but it stops to look as inset...

pavel
diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp
index b43fda3..405f6b9 100644
--- a/src/insets/InsetBranch.cpp
+++ b/src/insets/InsetBranch.cpp
@@ -100,6 +100,17 @@ docstring const InsetBranch::buttonLabel(BufferView const 
& bv) const
 }
 
 
+ColorCode InsetBranch::labelColor() const
+{
+       ColorCode c = Color_branchlabel;
+       if (!params_.branch.empty())
+               c = lcolor.getFromLyXName(to_utf8(params_.branch));
+       if (c == Color_none)
+               c = Color_branchlabel;
+       return c;
+}
+
+
 ColorCode InsetBranch::backgroundColor(PainterInfo const & pi) const
 {
        if (params_.branch.empty())
diff --git a/src/insets/InsetBranch.h b/src/insets/InsetBranch.h
index 4100a63..53a2a17 100644
--- a/src/insets/InsetBranch.h
+++ b/src/insets/InsetBranch.h
@@ -52,7 +52,8 @@ public:
        docstring branch() const { return params_.branch; }
        ///
        void rename(docstring const & newname) { params_.branch = newname; }
-
+       ///
+       ColorCode labelColor() const;
 private:
        ///
        InsetCode lyxCode() const { return BRANCH_CODE; }
diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h
index 3bdac33..e08429b 100644
--- a/src/insets/InsetCollapsable.h
+++ b/src/insets/InsetCollapsable.h
@@ -132,7 +132,7 @@ public:
        ColorCode backgroundColor(PainterInfo const &) const
                { return getLayout().bgcolor(); }
        ///
-       ColorCode labelColor() const { return getLayout().labelfont().color(); }
+       virtual ColorCode labelColor() const { return 
getLayout().labelfont().color(); }
        ///
        InsetCode lyxCode() const { return COLLAPSABLE_CODE; }
 

Reply via email to