mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
srcdoc fixes + a little tidy or two
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4288 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
20fd7f4bf6
commit
50a25e9a76
@ -1,3 +1,20 @@
|
||||
2002-05-30 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* LaTeX.C:
|
||||
* importer.h:
|
||||
* importer.C:
|
||||
* lyx_sty.h:
|
||||
* lyx_sty.C:
|
||||
* lyxlex.C:
|
||||
* lyxrow.h:
|
||||
* lyxtext.h:
|
||||
* paragraph.h:
|
||||
* paragraph.C:
|
||||
* texrow.h:
|
||||
* texrow.C:
|
||||
* text.C:
|
||||
* trans_mgr.h: srcdocs, and some minor cleanups
|
||||
|
||||
2002-05-29 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* paragraph_pimpl.C (isTextAt): rewrite to be much faster (do not
|
||||
|
@ -376,7 +376,7 @@ bool LaTeX::runMakeIndex(string const & f)
|
||||
// It should be possible to set the switches for makeindex
|
||||
// sorting style and such. It would also be very convenient
|
||||
// to be able to make style files from within LyX. This has
|
||||
// to come for a later time. (0.13 perhaps?)
|
||||
// to come for a later time.
|
||||
string tmp = "makeindex -c -q ";
|
||||
tmp += f;
|
||||
Systemcall one;
|
||||
|
@ -87,19 +87,6 @@ bool Importer::Import(LyXView * lv, string const & filename,
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
bool Importer::IsImportable(string const & format)
|
||||
{
|
||||
vector<string> loaders = Loaders();
|
||||
for (vector<string>::const_iterator it = loaders.begin();
|
||||
it != loaders.end(); ++it)
|
||||
if (converters.IsReachable(format, *it))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
vector<Format const *> const Importer::GetImportableFormats()
|
||||
{
|
||||
vector<string> loaders = Loaders();
|
||||
|
@ -1,13 +1,11 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file importer.h
|
||||
* Copyright 1995-2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author unknown
|
||||
*/
|
||||
|
||||
#ifndef IMPORTER_H
|
||||
#define IMPORTER_H
|
||||
@ -28,11 +26,7 @@ public:
|
||||
static
|
||||
bool Import(LyXView * lv, string const & filename,
|
||||
string const & format);
|
||||
#if 0
|
||||
///
|
||||
static
|
||||
bool IsImportable(string const & format);
|
||||
#endif
|
||||
|
||||
///
|
||||
static
|
||||
std::vector<Format const *> const GetImportableFormats();
|
||||
|
@ -1,26 +1,19 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file lyx_sty.C
|
||||
* Copyright 1995-2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Lars Gullik Bjornes <larsbj@lyx.org>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "lyx_sty.h"
|
||||
|
||||
//\NeedsTeXFormat{LaTeX2e}
|
||||
//\ProvidesPackage{lyx}[1996/01/11 LLE v0.2 (LyX LaTeX Extensions)]
|
||||
//\message{LyX LaTeX Extensions (LLE v0.2) of 11-Jan-1996.}
|
||||
|
||||
// include this always
|
||||
string const lyx_def =
|
||||
"\\providecommand{\\LyX}{L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}";
|
||||
|
||||
@ -37,8 +30,6 @@ string const lyxarrow_def =
|
||||
// for quotes without babel. This does not give perfect results, but
|
||||
// anybody serious about non-english quotes should use babel (JMarc).
|
||||
|
||||
|
||||
|
||||
string const quotedblbase_def =
|
||||
"\\ProvideTextCommandDefault{\\quotedblbase}{%\n"
|
||||
" \\raisebox{-1.4ex}[1ex][.5ex]{\\textquotedblright}%\n"
|
||||
@ -81,6 +72,8 @@ string const paragraphleftindent_def =
|
||||
" \\begin{list}{}{%\n"
|
||||
" \\setlength\\topsep{0pt}%\n"
|
||||
" \\addtolength{\\leftmargin}{#1}\n"
|
||||
// ho hum, yet more things commented out with no hint as to why they
|
||||
// weren't just removed
|
||||
// "%% \\addtolength{\\leftmargin}{#1\\textwidth}\n"
|
||||
// "%% \\setlength{\\textwidth}{#2\\textwidth}\n"
|
||||
// "%% \\setlength\\listparindent\\parindent%\n"
|
||||
|
@ -1,37 +1,22 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file lyx_sty.h
|
||||
* Copyright 1995-2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team.
|
||||
* A number of LaTeX command definitions for various
|
||||
* things. The name of this file is a holdover from the
|
||||
* days of yore.
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Lars Gullik Bjornes <larsbj@lyx.org>
|
||||
*/
|
||||
|
||||
#ifndef LYX_STY_H
|
||||
#define LYX_STY_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
// This seems to be fixed now (JMarc)
|
||||
//#ifdef WITH_WARNINGS
|
||||
//#warning README!!
|
||||
//#endif
|
||||
// I suddenly began to get segfaults in guilsinglleft_def and had no clue
|
||||
// on why this happened, then I tried a rewrite and added lyx_sty.C. Now
|
||||
// the segfault has moved to bibcombox... It seems that we(or gcc) have a
|
||||
// problem with static (non-pointer) objects , if someone knows why please
|
||||
// tell me. I am using gcc 2.7.2.1 (Linux) and when I get this segfault it
|
||||
// always has to do with a static object of some kind... I tried to rewrite
|
||||
// the objects causing the segfault, but the segfault then just moves to
|
||||
// another object. I'll let some others have a look now... (Lgb)
|
||||
|
||||
// include this always
|
||||
///
|
||||
extern string const lyx_def;
|
||||
///
|
||||
@ -65,4 +50,4 @@ extern string const binom_def;
|
||||
///
|
||||
extern string const mathcircumflex_def;
|
||||
|
||||
#endif
|
||||
#endif // LYX_STY_H
|
||||
|
29
src/lyxlex.C
29
src/lyxlex.C
@ -236,21 +236,22 @@ void LyXLex::pushToken(string const & pt)
|
||||
|
||||
int LyXLex::findToken(char const * str[])
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (next()) {
|
||||
if (compare(pimpl_->buff, "default")) {
|
||||
while (str[i][0] && compare(str[i], pimpl_->buff)) {
|
||||
++i;
|
||||
}
|
||||
if (!str[i][0]) {
|
||||
pimpl_->printError("Unknown argument `$$Token'");
|
||||
i = -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!next()) {
|
||||
pimpl_->printError("file ended while scanning string token");
|
||||
i = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (compare(pimpl_->buff, "default")) {
|
||||
while (str[i][0] && compare(str[i], pimpl_->buff)) {
|
||||
++i;
|
||||
}
|
||||
if (!str[i][0]) {
|
||||
pimpl_->printError("Unknown argument `$$Token'");
|
||||
i = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ class Row {
|
||||
public:
|
||||
///
|
||||
Row();
|
||||
|
||||
///
|
||||
void par(Paragraph * p);
|
||||
///
|
||||
|
@ -666,11 +666,12 @@ private:
|
||||
///
|
||||
lyx::pos_type beginningOfMainBody(Buffer const *, Paragraph const * par) const;
|
||||
|
||||
/** Returns the left beginning of the text.
|
||||
This information cannot be taken from the layouts-objekt, because
|
||||
in LaTeX the beginning of the text fits in some cases
|
||||
(for example sections) exactly the label-width.
|
||||
*/
|
||||
/**
|
||||
* Returns the left beginning of the text.
|
||||
* This information cannot be taken from the layout object, because
|
||||
* in LaTeX the beginning of the text fits in some cases
|
||||
* (for example sections) exactly the label-width.
|
||||
*/
|
||||
int leftMargin(BufferView *, Row const * row) const;
|
||||
///
|
||||
int rightMargin(Buffer const *, Row const * row) const;
|
||||
|
@ -1704,6 +1704,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
|
||||
}
|
||||
if (moving_arg)
|
||||
os << "\\protect ";
|
||||
|
||||
os << "\\\\\n";
|
||||
}
|
||||
texrow.newline();
|
||||
|
@ -261,7 +261,7 @@ public:
|
||||
value_type getUChar(BufferParams const &, lyx::pos_type pos) const;
|
||||
/// The position must already exist.
|
||||
void setChar(lyx::pos_type pos, value_type c);
|
||||
///
|
||||
/// pos <= size() (there is a dummy font change at the end of each par)
|
||||
void setFont(lyx::pos_type pos, LyXFont const & font);
|
||||
/// Returns the height of the highest font in range
|
||||
LyXFont::FONT_SIZE highestFontInRange(lyx::pos_type startpos,
|
||||
|
123
src/texrow.C
123
src/texrow.C
@ -1,12 +1,10 @@
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file texrow.C
|
||||
* Copyright 1995-2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Matthias Ettrich
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@ -21,9 +19,57 @@
|
||||
#include "debug.h"
|
||||
|
||||
using std::find_if;
|
||||
using std::for_each;
|
||||
using std::endl;
|
||||
|
||||
// Delete linked list
|
||||
namespace {
|
||||
|
||||
/// function object returning true when row number is found
|
||||
class same_rownumber {
|
||||
public:
|
||||
same_rownumber(int row) : row_(row) {}
|
||||
bool operator()(TexRow::RowList::value_type const & vt) const {
|
||||
return vt.rownumber() == row_;
|
||||
}
|
||||
|
||||
private:
|
||||
int row_;
|
||||
};
|
||||
|
||||
|
||||
/// increment the pos value of the argument if the par id
|
||||
/// is the same, and the pos parameter is larger
|
||||
class increase_pos {
|
||||
public:
|
||||
increase_pos(int id, int pos)
|
||||
: id_(id), pos_(pos) {}
|
||||
|
||||
void operator()(TexRow::RowList::value_type & vt) const {
|
||||
if (vt.id() != id_ || vt.pos() >= pos_)
|
||||
return;
|
||||
vt.pos(vt.pos() + 1);
|
||||
|
||||
lyxerr[Debug::INFO]
|
||||
<< "TeXRow::increasePos: ideally this "
|
||||
"should never happen..." << endl;
|
||||
|
||||
// FIXME: When verified to work this clause should be deleted.
|
||||
if (id_ == vt.id() && pos_ == vt.pos()) {
|
||||
lyxerr[Debug::INFO]
|
||||
<< "TexRow::increasePos: this should happen "
|
||||
"maximum one time for each run of "
|
||||
"increasePos!" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int id_;
|
||||
int pos_;
|
||||
};
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
void TexRow::reset()
|
||||
{
|
||||
rowlist.clear();
|
||||
@ -33,7 +79,6 @@ void TexRow::reset()
|
||||
}
|
||||
|
||||
|
||||
// Defines paragraph and position for the beginning of this row
|
||||
void TexRow::start(Paragraph * par, int pos)
|
||||
{
|
||||
lastpar = par;
|
||||
@ -41,39 +86,20 @@ void TexRow::start(Paragraph * par, int pos)
|
||||
}
|
||||
|
||||
|
||||
// Insert node when line is completed
|
||||
void TexRow::newline()
|
||||
{
|
||||
RowItem tmp;
|
||||
tmp.pos(lastpos);
|
||||
if (lastpar)
|
||||
tmp.id(lastpar->id());
|
||||
else
|
||||
tmp.id(-1);
|
||||
tmp.rownumber(++count);
|
||||
int const id = lastpar ? lastpar->id() : -1;
|
||||
RowList::value_type tmp(id, lastpos, ++count);
|
||||
rowlist.push_back(tmp);
|
||||
}
|
||||
|
||||
|
||||
class same_rownumber {
|
||||
public:
|
||||
same_rownumber(TexRow::RowList::value_type const & v):vt(v) {}
|
||||
bool operator()(TexRow::RowList::value_type const & vt1) const {
|
||||
return vt.rownumber() == vt1.rownumber();
|
||||
}
|
||||
private:
|
||||
TexRow::RowList::value_type const & vt;
|
||||
};
|
||||
|
||||
|
||||
|
||||
bool TexRow::getIdFromRow(int row, int & id, int & pos) const
|
||||
{
|
||||
RowList::value_type vt;
|
||||
vt.rownumber(row);
|
||||
RowList::const_iterator cit =
|
||||
find_if(rowlist.begin(), rowlist.end(), same_rownumber(vt));
|
||||
|
||||
find_if(rowlist.begin(), rowlist.end(),
|
||||
same_rownumber(row));
|
||||
|
||||
if (cit != rowlist.end()) {
|
||||
id = cit->id();
|
||||
pos = cit->pos();
|
||||
@ -85,36 +111,15 @@ bool TexRow::getIdFromRow(int row, int & id, int & pos) const
|
||||
}
|
||||
|
||||
|
||||
// should perhaps have a better name...
|
||||
// Increase the pos of all rows with the
|
||||
// same id (and where the pos is larger)
|
||||
// to avoid putting errorinsets at the
|
||||
// same pos.
|
||||
void TexRow::increasePos(int id, int pos) const
|
||||
void TexRow::increasePos(int id, int pos)
|
||||
{
|
||||
RowList::iterator kit = rowlist.begin();
|
||||
RowList::iterator it = rowlist.begin();
|
||||
RowList::iterator end = rowlist.end();
|
||||
for (; kit != end; ++kit) {
|
||||
if (id == kit->id()
|
||||
&& pos < kit->pos()) {
|
||||
kit->pos(kit->pos() + 1);
|
||||
lyxerr[Debug::INFO]
|
||||
<< "TeXRow::increasePos: ideally this "
|
||||
"should never happen..." << endl;
|
||||
}
|
||||
// When verified to work this clause should be deleted.
|
||||
if (id == kit->id()
|
||||
&& pos == kit->pos()) {
|
||||
lyxerr[Debug::INFO]
|
||||
<< "TexRow::increasePos: this should happen "
|
||||
"maximum one time for each run of "
|
||||
"increasePos!" << endl;
|
||||
}
|
||||
}
|
||||
for_each(it, end, increase_pos(id, pos));
|
||||
}
|
||||
|
||||
|
||||
TexRow & TexRow::operator+= (TexRow const & tr)
|
||||
TexRow & TexRow::operator+=(TexRow const & tr)
|
||||
{
|
||||
rowlist.insert(rowlist.end(), tr.rowlist.begin(), tr.rowlist.end());
|
||||
return *this;
|
||||
|
77
src/texrow.h
77
src/texrow.h
@ -1,13 +1,12 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
/**
|
||||
* \file texrow.h
|
||||
* Copyright 1995-2002 the LyX Team
|
||||
* Read the file COPYING
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2001 The LyX Team
|
||||
*
|
||||
* ====================================================== */
|
||||
* \author Matthias Ettrich
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TEXROW_H
|
||||
#define TEXROW_H
|
||||
@ -20,7 +19,7 @@
|
||||
|
||||
class Paragraph;
|
||||
|
||||
// Controls correspondance between paragraphs and the generated LaTeX file
|
||||
/// Represents the correspondence between paragraphs and the generated LaTeX file
|
||||
class TexRow {
|
||||
public:
|
||||
///
|
||||
@ -35,65 +34,69 @@ public:
|
||||
/// Insert node when line is completed
|
||||
void newline();
|
||||
|
||||
/// Returns paragraph id and position from a row number
|
||||
/**
|
||||
* getIdFromRow - find pid and position for a given row
|
||||
* @param row row number to find
|
||||
* @param id set to id if found
|
||||
* @param pos set to paragraph position if found
|
||||
* @return true if found, false otherwise
|
||||
*
|
||||
* If the row could not be found, pos is set to zero and
|
||||
* id is set to -1
|
||||
*/
|
||||
bool getIdFromRow(int row, int & id, int & pos) const;
|
||||
|
||||
/// Appends another TexRow
|
||||
TexRow & operator+= (TexRow const &);
|
||||
|
||||
/// Returns the number of rows in this texrow
|
||||
/// Returns the number of rows contained
|
||||
int rows() const { return count; }
|
||||
|
||||
/// Linked list of items
|
||||
/// an individual id/pos <=> row mapping
|
||||
class RowItem {
|
||||
public:
|
||||
///
|
||||
RowItem() : id_(-1), pos_(-1), rownumber_(0) {}
|
||||
///
|
||||
void id(int i) {
|
||||
id_ = i;
|
||||
}
|
||||
///
|
||||
RowItem(int id, int pos, int row)
|
||||
: id_(id), pos_(pos), rownumber_(row)
|
||||
{}
|
||||
|
||||
/// paragraph id
|
||||
int id() const {
|
||||
return id_;
|
||||
}
|
||||
///
|
||||
|
||||
/// set paragraph position
|
||||
void pos(int p) {
|
||||
pos_ = p;
|
||||
}
|
||||
///
|
||||
|
||||
/// paragraph position
|
||||
int pos() const {
|
||||
return pos_;
|
||||
}
|
||||
///
|
||||
void rownumber(int r) {
|
||||
rownumber_ = r;
|
||||
}
|
||||
///
|
||||
|
||||
/// row number
|
||||
int rownumber() const {
|
||||
return rownumber_;
|
||||
}
|
||||
private:
|
||||
///
|
||||
int id_;
|
||||
///
|
||||
int pos_;
|
||||
///
|
||||
int rownumber_;
|
||||
};
|
||||
///
|
||||
typedef std::list<RowItem> RowList;
|
||||
///
|
||||
void increasePos(int id, int pos) const;
|
||||
/// increment position of all other RowItems
|
||||
/// with same par id, to avoid placing error insets
|
||||
/// at the same position
|
||||
void increasePos(int id, int pos);
|
||||
private:
|
||||
///
|
||||
/// number of lines
|
||||
unsigned int count;
|
||||
///
|
||||
mutable RowList rowlist;
|
||||
/// container of id/pos <=> row mapping
|
||||
RowList rowlist;
|
||||
/// Last paragraph
|
||||
Paragraph * lastpar;
|
||||
/// Last position
|
||||
int lastpos;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // TEXROW_H
|
||||
|
@ -697,10 +697,6 @@ bool LyXText::draw(DrawRowParams & p, pos_type & vpos)
|
||||
}
|
||||
|
||||
|
||||
// Returns the left beginning of the text.
|
||||
// This information cannot be taken from the layouts-objekt, because in
|
||||
// LaTeX the beginning of the text fits in some cases (for example sections)
|
||||
// exactly the label-width.
|
||||
int LyXText::leftMargin(BufferView * bview, Row const * row) const
|
||||
{
|
||||
Inset * ins;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef Trans_Manager_h
|
||||
#define Trans_Manager_h
|
||||
#ifndef TRANS_MANAGER_H
|
||||
#define TRANS_MANAGER_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
@ -14,7 +14,7 @@
|
||||
class LyXText;
|
||||
class Trans;
|
||||
|
||||
/// Translation State
|
||||
/// Translation state
|
||||
class TransState {
|
||||
public:
|
||||
///
|
||||
@ -187,4 +187,4 @@ string const TransManager::deadkey(char c, KmodInfo t)
|
||||
return trans_fsm_.currentState->deadkey(c, t);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // TRANS_MANAGER_H
|
||||
|
Loading…
Reference in New Issue
Block a user