2000-06-26 18:48:45 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1998 The LyX Team.
|
|
|
|
*
|
2000-06-28 16:03:01 +00:00
|
|
|
* ======================================================
|
|
|
|
*/
|
2000-06-26 18:48:45 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "insetmarginal.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include "lyxfont.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "lyxtext.h"
|
2000-07-04 11:30:07 +00:00
|
|
|
#include "insets/insettext.h"
|
2000-06-26 18:48:45 +00:00
|
|
|
#include "support/LOstream.h"
|
2000-07-04 19:16:35 +00:00
|
|
|
#include "debug.h"
|
2000-06-26 18:48:45 +00:00
|
|
|
|
|
|
|
using std::ostream;
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
|
2000-07-04 19:16:35 +00:00
|
|
|
InsetMarginal::InsetMarginal()
|
|
|
|
: InsetFootlike()
|
2000-06-28 13:35:52 +00:00
|
|
|
{
|
2000-07-04 19:16:35 +00:00
|
|
|
setLabel(_("margin"));
|
|
|
|
setInsetName("Marginal");
|
2000-06-28 13:35:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-26 18:48:45 +00:00
|
|
|
Inset * InsetMarginal::Clone() const
|
|
|
|
{
|
2000-06-28 15:12:29 +00:00
|
|
|
InsetMarginal * result = new InsetMarginal;
|
2000-07-04 11:30:07 +00:00
|
|
|
result->inset->init(inset);
|
2000-06-28 15:12:29 +00:00
|
|
|
|
|
|
|
result->collapsed = collapsed;
|
|
|
|
return result;
|
2000-06-26 18:48:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char const * InsetMarginal::EditMessage() const
|
|
|
|
{
|
2000-07-04 19:16:35 +00:00
|
|
|
return _("Opened Marginal Note Inset");
|
2000-06-26 18:48:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int InsetMarginal::Latex(Buffer const * buf,
|
|
|
|
ostream & os, bool fragile, bool fp) const
|
|
|
|
{
|
2000-06-28 13:35:52 +00:00
|
|
|
os << "\\marginpar{%\n";
|
2000-06-26 18:48:45 +00:00
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
int i = inset->Latex(buf, os, fragile, fp);
|
2000-06-28 13:35:52 +00:00
|
|
|
os << "}%\n";
|
2000-06-26 18:48:45 +00:00
|
|
|
|
|
|
|
return i + 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
bool InsetMarginal::InsertInsetAllowed(Inset * in) const
|
2000-06-26 18:48:45 +00:00
|
|
|
{
|
2000-07-04 11:30:07 +00:00
|
|
|
if ((in->LyxCode() == Inset::FOOT_CODE) ||
|
|
|
|
(in->LyxCode() == Inset::MARGIN_CODE)) {
|
2000-06-26 18:48:45 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-07-04 19:16:35 +00:00
|
|
|
|
2000-07-04 11:30:07 +00:00
|
|
|
#if 0
|
2000-06-26 18:48:45 +00:00
|
|
|
LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
|
|
|
|
LyXParagraph * p, int pos) const
|
|
|
|
{
|
|
|
|
LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
|
|
|
|
fn.decSize().decSize();
|
|
|
|
return fn;
|
|
|
|
}
|
2000-07-04 11:30:07 +00:00
|
|
|
#endif
|