2 /* This file is part of*
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2000 The LyX Team.
9 * ====================================================== */
14 #pragma implementation
17 #include "insetcite.h"
18 #include "BufferView.h"
20 #include "frontends/Dialogs.h"
21 #include "support/lstrings.h"
23 InsetCitation::InsetCitation(InsetCommandParams const & p)
27 string const InsetCitation::getScreenLabel() const
29 string keys(getContents());
31 // If keys is "too long" then only print out the first few tokens
33 if (contains(keys, ",")) {
34 // Final comma allows while loop to cover all keys
35 keys = frontStrip(split(keys, label, ',')) + ",";
37 size_t const maxSize = 40;
38 while (contains( keys, "," )) {
40 keys = frontStrip(split(keys, key, ','));
42 size_t size = label.size() + 2 + key.size();
43 if( size >= maxSize ) {
53 if (!getOptions().empty())
54 label += ", " + getOptions();
56 return "[" + label + "]";
60 void InsetCitation::Edit(BufferView * bv, int, int, unsigned int)
62 bv->owner()->getDialogs()->showCitation(this);