2000-02-25 12:06:15 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2000-02-25 13:35:38 +00:00
|
|
|
* Copyright 1998 The LyX Team.
|
2000-02-25 12:06:15 +00:00
|
|
|
*
|
|
|
|
*======================================================*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "insetert.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include "lyxfont.h"
|
2000-03-08 13:52:57 +00:00
|
|
|
#include "buffer.h"
|
2000-07-04 11:30:07 +00:00
|
|
|
#include "insets/insettext.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
#include "support/LOstream.h"
|
|
|
|
#include "lyx_gui_misc.h"
|
2000-02-25 12:06:15 +00:00
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
using std::ostream;
|
2000-02-25 12:06:15 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
InsetERT::InsetERT() : InsetCollapsable()
|
2000-02-25 12:06:15 +00:00
|
|
|
{
|
2001-06-27 14:10:35 +00:00
|
|
|
setLabel(_("666"));
|
|
|
|
#ifndef NO_LATEX
|
2001-04-02 14:02:58 +00:00
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
|
|
|
font.setLatex (LyXFont::ON);
|
2001-06-27 14:10:35 +00:00
|
|
|
#endif
|
2001-04-02 14:02:58 +00:00
|
|
|
labelfont = LyXFont(LyXFont::ALL_SANE);
|
|
|
|
labelfont.decSize();
|
|
|
|
labelfont.decSize();
|
2001-06-05 17:05:51 +00:00
|
|
|
labelfont.setColor(LColor::latex);
|
2001-04-02 14:02:58 +00:00
|
|
|
setAutoCollapse(false);
|
|
|
|
setInsetName("ERT");
|
2000-02-25 12:06:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
void InsetERT::write(Buffer const * buf, ostream & os) const
|
2000-06-28 13:35:52 +00:00
|
|
|
{
|
2001-04-02 14:02:58 +00:00
|
|
|
os << getInsetName() << "\n";
|
2001-06-28 10:25:20 +00:00
|
|
|
InsetCollapsable::write(buf, os);
|
2000-06-28 13:35:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
Inset * InsetERT::clone(Buffer const &) const
|
2000-02-25 12:06:15 +00:00
|
|
|
{
|
2001-04-02 14:02:58 +00:00
|
|
|
InsetERT * result = new InsetERT;
|
|
|
|
result->inset.init(&inset);
|
|
|
|
|
|
|
|
result->collapsed = collapsed;
|
|
|
|
return result;
|
2000-02-25 12:06:15 +00:00
|
|
|
}
|
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
string const InsetERT::editMessage() const
|
2000-04-04 00:19:15 +00:00
|
|
|
{
|
2001-04-02 14:02:58 +00:00
|
|
|
return _("Opened ERT Inset");
|
2000-02-25 12:06:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
bool InsetERT::insertInset(BufferView *, Inset *)
|
2001-06-27 14:10:35 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
|
2000-02-25 12:06:15 +00:00
|
|
|
{
|
2001-05-28 15:11:24 +00:00
|
|
|
// if selectall is activated then the fontchange was an outside general
|
|
|
|
// fontchange and this messages is not needed
|
|
|
|
if (!selectall)
|
|
|
|
WriteAlert(_("Impossible Operation!"),
|
|
|
|
_("Not permitted to change font-types inside ERT-insets!"),
|
|
|
|
_("Sorry."));
|
2000-02-25 12:06:15 +00:00
|
|
|
}
|
2000-03-24 13:24:58 +00:00
|
|
|
|
2000-07-04 19:16:35 +00:00
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
|
2000-03-24 13:24:58 +00:00
|
|
|
{
|
2001-06-28 10:25:20 +00:00
|
|
|
InsetCollapsable::edit(bv, x, y, button);
|
2001-06-27 14:10:35 +00:00
|
|
|
#ifndef NO_LATEX
|
2001-04-02 14:02:58 +00:00
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
|
|
|
font.setLatex (LyXFont::ON);
|
2001-06-27 14:10:35 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/,
|
2001-06-27 14:10:35 +00:00
|
|
|
bool /*free_spc*/) const
|
|
|
|
{
|
|
|
|
Paragraph::size_type siz = inset.par->size();
|
|
|
|
for (Paragraph::size_type i = 0; i != siz; ++i) {
|
|
|
|
os << inset.par->getChar(i);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
int InsetERT::ascii(Buffer const *,
|
2001-06-27 14:10:35 +00:00
|
|
|
std::ostream &, int /*linelen*/) const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
int InsetERT::linuxdoc(Buffer const *, std::ostream &) const
|
2001-06-27 14:10:35 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
int InsetERT::docBook(Buffer const *, std::ostream &) const
|
2001-06-27 14:10:35 +00:00
|
|
|
{
|
|
|
|
return 0;
|
2000-03-24 13:24:58 +00:00
|
|
|
}
|