]> git.lyx.org Git - features.git/commitdiff
Add "Senseless!!! " label to non supported caption.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 31 Jan 2007 13:35:12 +0000 (13:35 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 31 Jan 2007 13:35:12 +0000 (13:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16968 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insetcaption.C

index ed0a121a57132b3f00dc16e124f5acbb604250cd..8f2991a862d4b5927ed653e0cc5a8d3c9165239f 100644 (file)
@@ -49,7 +49,7 @@ using std::ostream;
 
 
 InsetCaption::InsetCaption(BufferParams const & bp)
-       : InsetText(bp), textclass_(bp.getLyXTextClass())
+       : InsetText(bp), textclass_(bp.getLyXTextClass()), counter_(-1)
 {
        setAutoBreakRows(true);
        setDrawFrame(true);
@@ -102,8 +102,12 @@ void InsetCaption::setLabel(docstring const & label)
 bool InsetCaption::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        mi.base.textwidth -= 2 * TEXT_TO_INSET_OFFSET;
-       docstring const number = convert<docstring>(counter_);
-       full_label_ = bformat(from_ascii("%1$s %2$s:"), label_, number);
+       if (counter_ < 0)
+               full_label_ = _("Senseless!!! ");
+       else {
+               docstring const number = convert<docstring>(counter_);
+               full_label_ = bformat(from_ascii("%1$s %2$s:"), label_, number);
+       }
        labelwidth_ = theFontMetrics(mi.base.font).width(full_label_);
        dim.wid = labelwidth_;
        Dimension textdim;