mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Few fixes for inserERT/insetNote
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2548 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3a0fbd0a90
commit
ea37831cfb
@ -1,3 +1,16 @@
|
||||
2001-08-18 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* insetert.C (latex): Fix output for multiple paragraphs.
|
||||
(write): New code for writing paragraph data.
|
||||
(read): Set font after reading the inset.
|
||||
(localDispatch): Call set_latex_font() for more cases.
|
||||
|
||||
* insetnote.h: Add empty validate method.
|
||||
* insetert.h: Ditto
|
||||
|
||||
* insetnote.C (InsetNote): Set language to the language of the
|
||||
document.
|
||||
|
||||
2001-08-16 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettext.C: implemented the new FINISHED states.
|
||||
|
@ -137,6 +137,24 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
|
||||
}
|
||||
}
|
||||
inset.read(buf, lex);
|
||||
|
||||
#ifndef INHERIT_LANG
|
||||
LyXFont font(LyXFont::ALL_INHERIT, latex_language);
|
||||
#else
|
||||
LyXFont font(LyXFont::ALL_INHERIT);
|
||||
#endif
|
||||
|
||||
font.setFamily(LyXFont::TYPEWRITER_FAMILY);
|
||||
font.setColor(LColor::latex);
|
||||
Paragraph * par = inset.paragraph();
|
||||
while (par) {
|
||||
Paragraph::size_type siz = par->size();
|
||||
for (Paragraph::size_type i = 0; i < siz; ++i) {
|
||||
par->setFont(i, font);
|
||||
}
|
||||
par = par->next();
|
||||
}
|
||||
|
||||
if (!token_found) {
|
||||
if (collapsed_) {
|
||||
status(0, Collapsed);
|
||||
@ -167,7 +185,33 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
|
||||
os << getInsetName() << "\n"
|
||||
<< "status "<< st << "\n";
|
||||
|
||||
inset.writeParagraphData(buf, os);
|
||||
//inset.writeParagraphData(buf, os);
|
||||
string const layout =
|
||||
textclasslist.NameOfLayout(buf->params.textclass, 0);
|
||||
Paragraph * par = inset.paragraph();
|
||||
while (par) {
|
||||
os << "\n\\layout " << layout << "\n";
|
||||
Paragraph::size_type siz = par->size();
|
||||
for (Paragraph::size_type i = 0; i < siz; ++i) {
|
||||
Paragraph::value_type c = par->getChar(i);
|
||||
switch (c) {
|
||||
case Paragraph::META_INSET:
|
||||
case Paragraph::META_HFILL:
|
||||
lyxerr << "Element is not allowed in insertERT"
|
||||
<< std::endl;
|
||||
case Paragraph::META_NEWLINE:
|
||||
os << "\n\\newline \n";
|
||||
break;
|
||||
case '\\':
|
||||
os << "\n\\backslash \n";
|
||||
break;
|
||||
default:
|
||||
os << c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
par = par->next();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -272,9 +316,9 @@ int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/,
|
||||
{
|
||||
Paragraph * par = inset.paragraph();
|
||||
while (par) {
|
||||
Paragraph::size_type siz = inset.paragraph()->size();
|
||||
for (Paragraph::size_type i = 0; i != siz; ++i) {
|
||||
char c = inset.paragraph()->getChar(i);
|
||||
Paragraph::size_type siz = par->size();
|
||||
for (Paragraph::size_type i = 0; i < siz; ++i) {
|
||||
Paragraph::value_type c = par->getChar(i);
|
||||
switch (c) {
|
||||
case Paragraph::META_NEWLINE:
|
||||
os << '\n';
|
||||
@ -285,6 +329,8 @@ int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/,
|
||||
}
|
||||
}
|
||||
par = par->next();
|
||||
if (par)
|
||||
os << "\n\n";
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -329,6 +375,12 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
|
||||
switch(action) {
|
||||
case LFUN_BREAKPARAGRAPH:
|
||||
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
|
||||
case LFUN_BACKSPACE:
|
||||
case LFUN_BACKSPACE_SKIP:
|
||||
case LFUN_DELETE:
|
||||
case LFUN_DELETE_SKIP:
|
||||
case LFUN_DELETE_LINE_FORWARD:
|
||||
case LFUN_CUT:
|
||||
set_latex_font(bv);
|
||||
break;
|
||||
|
||||
|
@ -80,6 +80,8 @@ public:
|
||||
///
|
||||
int docBook(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const {}
|
||||
///
|
||||
UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
|
||||
string const &);
|
||||
///
|
||||
|
@ -59,6 +59,7 @@ Inset * InsetNote::clone(Buffer const &, bool same_id) const
|
||||
}
|
||||
|
||||
|
||||
// This constructor is used for reading old InsetInfo
|
||||
InsetNote::InsetNote(Buffer const * buf, string const & contents,
|
||||
bool collapsed)
|
||||
: InsetCollapsable(collapsed)
|
||||
@ -67,8 +68,14 @@ InsetNote::InsetNote(Buffer const * buf, string const & contents,
|
||||
|
||||
Paragraph * par = inset.paragraph();
|
||||
Paragraph::size_type pos = 0;
|
||||
buf->insertStringAsLines(par, pos, LyXFont(LyXFont::ALL_INHERIT),
|
||||
strip(contents, '\n'));
|
||||
LyXFont font(LyXFont::ALL_INHERIT, buf->params.language);
|
||||
|
||||
// Since XForms doesn't support RTL, we can assume that old notes
|
||||
// in RTL documents are written in English.
|
||||
if (font.language()->RightToLeft())
|
||||
font.setLanguage(default_language);
|
||||
|
||||
buf->insertStringAsLines(par, pos, font, strip(contents, '\n'));
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,14 +32,16 @@ public:
|
||||
/// constructor with initial contents
|
||||
InsetNote(Buffer const *, string const & contents, bool collapsed);
|
||||
///
|
||||
virtual string const editMessage() const;
|
||||
string const editMessage() const;
|
||||
///
|
||||
virtual Inset::Code lyxCode() const { return Inset::IGNORE_CODE; }
|
||||
Inset::Code lyxCode() const { return Inset::IGNORE_CODE; }
|
||||
///
|
||||
virtual void write(Buffer const *, std::ostream &) const;
|
||||
void write(Buffer const *, std::ostream &) const;
|
||||
///
|
||||
virtual int latex(Buffer const *, std::ostream &, bool, bool) const
|
||||
int latex(Buffer const *, std::ostream &, bool, bool) const
|
||||
{ return 0; }
|
||||
///
|
||||
void validate(LaTeXFeatures &) const {}
|
||||
private:
|
||||
/// used by the constructors
|
||||
void init();
|
||||
|
Loading…
Reference in New Issue
Block a user