]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbibitem.C
insetcharstyle drawing cosmetics
[lyx.git] / src / insets / insetbibitem.C
index 6a732d716e1f574ed7db234d577aaaf49668c582..2e74ad680349874207d70066b11cfc98ce041f06 100644 (file)
 #include "lyxfont.h"
 #include "lyxlex.h"
 #include "paragraph.h"
+#include "ParagraphList_fwd.h"
 
 #include "frontends/font_metrics.h"
 
 #include "support/lstrings.h"
+#include "support/std_ostream.h"
 #include "support/tostr.h"
 
 using lyx::support::prefixIs;
@@ -31,7 +33,7 @@ using lyx::support::strToInt;
 using std::max;
 using std::string;
 using std::auto_ptr;
-
+using std::ostream;
 
 int InsetBibitem::key_counter = 0;
 string const key_prefix = "key-";
@@ -53,8 +55,7 @@ auto_ptr<InsetBase> InsetBibitem::clone() const
 }
 
 
-DispatchResult
-InsetBibitem::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
+void InsetBibitem::priv_dispatch(LCursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action) {
 
@@ -62,15 +63,16 @@ InsetBibitem::priv_dispatch(BufferView & bv, FuncRequest const & cmd)
                InsetCommandParams p;
                InsetCommandMailer::string2params("bibitem", cmd.argument, p);
                if (p.getCmdName().empty())
-                       return DispatchResult(true, true);
+                       break;
                setParams(p);
-               bv.update();
-               bv.fitCursor();
-               return DispatchResult(true, true);
+               cur.bv().update();
+               cur.bv().fitCursor();
+               break;
        }
 
        default:
-               return InsetCommand::priv_dispatch(bv, cmd);
+               InsetCommand::priv_dispatch(cur, cmd);
+               break;
        }
 }
 
@@ -122,6 +124,12 @@ string const InsetBibitem::getScreenLabel(Buffer const &) const
        return getContents() + " [" + getBibLabel() + ']';
 }
 
+int InsetBibitem::plaintext(Buffer const &, ostream & os,
+                           OutputParams const &) const
+{
+       os << '[' << getCounter() << "] ";
+       return 0;
+}
 
 // ale070405 This function maybe shouldn't be here. We'll fix this at 0.13.
 int bibitemMaxWidth(BufferView * bv, LyXFont const &)
@@ -133,7 +141,9 @@ int bibitemMaxWidth(BufferView * bv, LyXFont const &)
        ParagraphList::iterator end = bv->buffer()->paragraphs().end();
        for (; it != end; ++it) {
                if (it->bibitem()) {
+#ifdef WITH_WARNINGS
 #warning metrics broken!
+#endif
                        int const wx = it->bibitem()->width();
                        if (wx > w)
                                w = wx;