1 /* This file is part of*
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2000-2001 The LyX Team.
8 * ====================================================== */
13 #pragma implementation
16 #include "insetcite.h"
17 #include "BufferView.h"
19 #include "frontends/Dialogs.h"
20 #include "support/lstrings.h"
22 InsetCitation::InsetCitation(InsetCommandParams const & p)
26 string const InsetCitation::getScreenLabel() const
28 string keys(getContents());
30 // If keys is "too long" then only print out the first few tokens
32 if (contains(keys, ",")) {
33 // Final comma allows while loop to cover all keys
34 keys = frontStrip(split(keys, label, ',')) + ",";
36 string::size_type const maxSize = 40;
37 while (contains( keys, "," )) {
39 keys = frontStrip(split(keys, key, ','));
41 string::size_type size = label.size() + 2 + key.size();
42 if (size >= maxSize) {
52 if (!getOptions().empty())
53 label += ", " + getOptions();
55 return "[" + label + "]";
59 void InsetCitation::edit(BufferView * bv, int, int, unsigned int)
61 bv->owner()->getDialogs()->showCitation(this);
65 int InsetCitation::ascii(Buffer const *, std::ostream & os, int) const
67 os << "[" << getContents() << "]";