]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBox.cpp
Box fixes from Vincent and me.
[lyx.git] / src / insets / InsetBox.cpp
index 09d7a49797d772b6b57785e9f5b1d98c7a27d25c..2f31dcc71986ab3b63433298d1f0077c016d14c2 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "support/debug.h"
 #include "support/gettext.h"
+#include "support/lstrings.h"
 #include "support/Translator.h"
 
 #include "frontends/Application.h"
@@ -35,6 +36,7 @@
 #include <sstream>
 
 using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
@@ -139,21 +141,34 @@ void InsetBox::read(Lexer & lex)
 
 void InsetBox::setButtonLabel()
 {
-       BoxType btype = boxtranslator().find(params_.type);
+       BoxType const btype = boxtranslator().find(params_.type);
 
-       docstring label;
-       label += _("Box");
-       label += " (";
-       if (btype == Frameless) {
+       docstring const type = _("Box");
+
+       docstring inner;
+       if (params_.inner_box) {
                if (params_.use_parbox)
-                       label += _("Parbox");
+                       inner = _("Parbox");
                else
-                       label += _("Minipage");
-       } else {
-               label += boxtranslator_loc().find(btype);
+                       inner = _("Minipage");
        }
-       label += ")";
 
+       docstring frame;
+       if (btype != Frameless)
+               frame = boxtranslator_loc().find(btype);
+
+       docstring label;
+       if (inner.empty() && frame.empty())
+               label = type;
+       else if (inner.empty())
+               label = bformat(_("%1$s (%2$s)"),
+                       type, frame);
+       else if (frame.empty())
+               label = bformat(_("%1$s (%2$s)"),
+                       type, inner);
+       else
+               label = bformat(_("%1$s (%2$s, %3$s)"),
+                       type, inner, frame);
        setLabel(label);
 }