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"
19 #include "BufferView.h"
20 #include "frontends/Dialogs.h"
21 #include "support/lstrings.h"
23 InsetCitation::InsetCitation(string const & key, string const & note)
24 : InsetCommand("cite", key, note)
27 InsetCitation::~InsetCitation()
32 string InsetCitation::getScreenLabel() const
34 string keys(getContents());
36 // If keys is "too long" then only print out the first few tokens
38 if( contains( keys, "," ) ) {
39 // Final comma allows while loop to cover all keys
40 keys = frontStrip( split( keys, label, ',' ) ) + ",";
42 const int maxSize( 40 );
43 while( contains( keys, "," ) ) {
45 keys = frontStrip( split( keys, key, ',' ) );
47 int size = label.size() + 2 + key.size();
48 if( size >= maxSize ) {
58 if( !getOptions().empty() )
59 label += ", " + getOptions();
61 return '[' + label + ']';
64 void InsetCitation::Edit(BufferView * bv, int, int, unsigned int)
66 bv->owner()->getDialogs()->showCitation( this );