Two small patches from Dekel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1315 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-01-11 14:55:36 +00:00
parent b86037626b
commit ba916a0f89
7 changed files with 71 additions and 23 deletions

View File

@ -1,3 +1,22 @@
2001-01-11 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/buffer.C (getTocList): make the method const, so that
InsetTOC::Ascii compiles.
* src/insets/insettoc.C (Ascii): return 0
2001-01-11 Dekel Tsur <dekelts@tau.ac.il>
* src/insets/insettoc.C (Ascii): New method.
* src/lyx_main.C (init) Set first_start to false when running
without a GUI.
2000-12-19 Dekel Tsur <dekelts@tau.ac.il>
* src/paragraph.C (TeXOnePar,SimpleTeXOnePar) Fix problem with
aligned paragraphs.
2001-01-11 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/buffer.C (writeFile): add missing ' ' after lyxformat.

View File

@ -3417,7 +3417,7 @@ vector<string> const Buffer::getLabelList()
}
vector<vector<Buffer::TocItem> > const Buffer::getTocList()
vector<vector<Buffer::TocItem> > const Buffer::getTocList() const
{
int figs = 0;
int tables = 0;

View File

@ -303,7 +303,7 @@ public:
TOC_LOA
};
///
std::vector<std::vector<TocItem> > const getTocList();
std::vector<std::vector<TocItem> > const getTocList() const;
///
std::vector<string> const getLabelList();

View File

@ -10,9 +10,10 @@
#include "LyXView.h"
#include "frontends/Dialogs.h"
#include "debug.h"
#include "buffer.h"
using std::ostream;
using std::endl;
string const InsetTOC::getScreenLabel() const
{
@ -47,6 +48,32 @@ void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
bv->owner()->getDialogs()->showTOC( this );
}
int InsetTOC::Ascii(Buffer const * buffer, ostream & os, int) const
{
os << getScreenLabel() << endl << endl;
Buffer::TocType type;
string cmdname = getCmdName();
if (cmdname == "tableofcontents" )
type = Buffer::TOC_TOC;
else if (cmdname == "listofalgorithms" )
type = Buffer::TOC_LOA;
else if (cmdname == "listoffigures" )
type = Buffer::TOC_LOF;
else
type = Buffer::TOC_LOT;
vector<vector<Buffer::TocItem> > const toc_list =
buffer->getTocList();
vector<Buffer::TocItem> const & toc = toc_list[type];
for (vector<Buffer::TocItem>::const_iterator it = toc.begin();
it != toc.end(); ++it)
os << string(4 * it->depth, ' ') << it->str << endl;
os << endl;
return 0;
}
int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
{

View File

@ -37,6 +37,8 @@ public:
///
Inset::Code LyxCode() const;
///
int Ascii(Buffer const *, std::ostream &, int linelen) const;
///
int Linuxdoc(Buffer const *, std::ostream &) const;
///
int DocBook(Buffer const *, std::ostream &) const;

View File

@ -368,6 +368,8 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
// running in batch mode.
if (gui)
queryUserLyXDir(explicit_userdir);
else
first_start = false;
//
// Shine up lyxrc defaults

View File

@ -2373,25 +2373,21 @@ LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf,
// This is necessary because LaTeX (and LyX on the screen)
// calculates the space between the baselines according
// to this font. (Matthias)
//
// Is this really needed ? (Dekel)
// We do not need to use to change the font for the last paragraph
// or for a command.
LyXFont font = getFont(bparams, Last() - 1);
if (need_par && next) {
if (style.resfont.size() != font.size()) {
os << '\\'
<< font.latexSize()
<< ' ';
}
bool is_command = textclasslist.Style(bparams.textclass,
GetLayout()).isCommand();
if (style.resfont.size() != font.size() && next && !is_command) {
if (!need_par)
os << "{";
os << "\\" << font.latexSize() << " \\par}";
} else if (need_par) {
os << "\\par}";
} else if (textclasslist.Style(bparams.textclass,
GetLayout()).isCommand()) {
if (style.resfont.size() != font.size()) {
os << '\\'
<< font.latexSize()
<< ' ';
}
os << '}';
} else if ((style.resfont.size() != font.size()) && next){
os << "{\\" << font.latexSize() << " \\par}";
}
} else if (is_command)
os << "}";
if (language->babel() != doc_language->babel() &&
(!par
@ -2548,9 +2544,11 @@ bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf,
if (style.isCommand()) {
os << '{';
++column;
} else if (align != LYX_ALIGN_LAYOUT) {
os << "{\\par";
column += 4;
} else if (align != LYX_ALIGN_LAYOUT && next) {
// We do not need \par here (Dekel)
// os << "{\\par";
os << "{";
++column;
return_value = true;
}