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