-InsetCitation::InsetCitation(string const & key, string const & note)
- : InsetCommand("cite", key, note)
+#include "frontends/Dialogs.h"
+
+#include "support/lstrings.h"
+
+
+using std::ostream;
+
+
+InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
+ : InsetCommand(p)
+{}
+
+string const InsetCitation::getScreenLabel(Buffer const *) const
+{
+ string keys(getContents());
+
+ // If keys is "too long" then only print out the first few tokens
+ string label;
+ if (contains(keys, ",")) {
+ // Final comma allows while loop to cover all keys
+ keys = frontStrip(split(keys, label, ',')) + ",";
+
+ string::size_type const maxSize = 40;
+ while (contains(keys, ",")) {
+ string key;
+ keys = frontStrip(split(keys, key, ','));
+
+ string::size_type size = label.size() + 2 + key.size();
+ if (size >= maxSize) {
+ label += ", ...";
+ break;
+ }
+ label += ", " + key;
+ }
+ } else {
+ label = keys;
+ }
+
+ if (!getOptions().empty())
+ label += ", " + getOptions();
+
+ return "[" + label + "]";
+}
+
+
+void InsetCitation::edit(BufferView * bv, int, int, unsigned int)