mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Move class definitions inside main class
Prepare for following commits. This prevent's forward-declaration, but including the TexRow header should be inexpensive.
This commit is contained in:
parent
2e45bade7a
commit
148b3ae773
@ -4472,7 +4472,7 @@ Buffer::ReadStatus Buffer::loadThisLyXFile(FileName const & fn)
|
||||
void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const
|
||||
{
|
||||
for (auto const & err : terr) {
|
||||
TextEntry start, end = TexRow::text_none;
|
||||
TexRow::TextEntry start, end = TexRow::text_none;
|
||||
int errorRow = err.error_in_line;
|
||||
Buffer const * buf = 0;
|
||||
Impl const * p = d;
|
||||
|
@ -2345,7 +2345,7 @@ int BufferView::scrollUp(int offset)
|
||||
|
||||
bool BufferView::setCursorFromRow(int row)
|
||||
{
|
||||
TextEntry start, end;
|
||||
TexRow::TextEntry start, end;
|
||||
tie(start,end) = buffer_.texrow().getEntriesFromRow(row);
|
||||
LYXERR(Debug::LATEX,
|
||||
"setCursorFromRow: for row " << row << ", TexRow has found "
|
||||
@ -2355,7 +2355,8 @@ bool BufferView::setCursorFromRow(int row)
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::setCursorFromEntries(TextEntry start, TextEntry end)
|
||||
bool BufferView::setCursorFromEntries(TexRow::TextEntry start,
|
||||
TexRow::TextEntry end)
|
||||
{
|
||||
DocIterator dit_start, dit_end;
|
||||
tie(dit_start,dit_end) =
|
||||
|
@ -16,6 +16,7 @@
|
||||
#define BUFFER_VIEW_H
|
||||
|
||||
#include "DocumentClassPtr.h"
|
||||
#include "TexRow.h"
|
||||
#include "update_flags.h"
|
||||
|
||||
#include "support/strfwd.h"
|
||||
@ -46,7 +47,6 @@ class ParagraphMetrics;
|
||||
class Point;
|
||||
class TexRow;
|
||||
class Text;
|
||||
struct TextEntry;
|
||||
class TextMetrics;
|
||||
|
||||
enum CursorStatus {
|
||||
@ -165,7 +165,7 @@ public:
|
||||
/// set the cursor based on the given TeX source row.
|
||||
bool setCursorFromRow(int row);
|
||||
/// set the cursor based on the given start and end TextEntries.
|
||||
bool setCursorFromEntries(TextEntry start, TextEntry end);
|
||||
bool setCursorFromEntries(TexRow::TextEntry start, TexRow::TextEntry end);
|
||||
|
||||
/// set cursor to the given inset. Return true if found.
|
||||
bool setCursorFromInset(Inset const *);
|
||||
|
@ -27,6 +27,7 @@ class Buffer;
|
||||
/// A class to hold an error item
|
||||
class ErrorItem {
|
||||
public:
|
||||
typedef TexRow::TextEntry TextEntry;
|
||||
docstring error;
|
||||
docstring description;
|
||||
// To generalise into RowEntries
|
||||
@ -35,8 +36,7 @@ public:
|
||||
Buffer const * buffer;
|
||||
// With a start position and an end position
|
||||
ErrorItem(docstring const & error, docstring const & description,
|
||||
TextEntry start, TextEntry end,
|
||||
Buffer const * buf = 0);
|
||||
TextEntry start, TextEntry end, Buffer const * buf = 0);
|
||||
// Error outside the document body
|
||||
ErrorItem(docstring const & error, docstring const & description,
|
||||
Buffer const * buf = 0);
|
||||
|
@ -84,7 +84,7 @@ void TexRow::RowEntryList::forceAddEntry(RowEntry entry)
|
||||
}
|
||||
|
||||
|
||||
TextEntry TexRow::RowEntryList::getTextEntry() const
|
||||
TexRow::TextEntry TexRow::RowEntryList::getTextEntry() const
|
||||
{
|
||||
if (!isNone(text_entry_))
|
||||
return text_entry_;
|
||||
@ -106,8 +106,8 @@ TexRow::TexRow()
|
||||
}
|
||||
|
||||
|
||||
TextEntry const TexRow::text_none = { -1, 0 };
|
||||
RowEntry const TexRow::row_none = { false, { TexRow::text_none } };
|
||||
TexRow::TextEntry const TexRow::text_none = { -1, 0 };
|
||||
TexRow::RowEntry const TexRow::row_none = { false, { TexRow::text_none } };
|
||||
|
||||
|
||||
//static
|
||||
@ -138,7 +138,7 @@ TexRow::RowEntryList & TexRow::currentRow()
|
||||
|
||||
|
||||
//static
|
||||
RowEntry TexRow::textEntry(int id, pos_type pos)
|
||||
TexRow::RowEntry TexRow::textEntry(int id, pos_type pos)
|
||||
{
|
||||
RowEntry entry;
|
||||
entry.is_math = false;
|
||||
@ -149,7 +149,7 @@ RowEntry TexRow::textEntry(int id, pos_type pos)
|
||||
|
||||
|
||||
//static
|
||||
RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
|
||||
TexRow::RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
|
||||
{
|
||||
RowEntry entry;
|
||||
entry.is_math = true;
|
||||
@ -159,7 +159,7 @@ RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
|
||||
}
|
||||
|
||||
|
||||
bool operator==(RowEntry entry1, RowEntry entry2)
|
||||
bool operator==(TexRow::RowEntry entry1, TexRow::RowEntry entry2)
|
||||
{
|
||||
return entry1.is_math == entry2.is_math
|
||||
&& (entry1.is_math
|
||||
@ -217,7 +217,8 @@ void TexRow::append(TexRow other)
|
||||
}
|
||||
|
||||
|
||||
pair<TextEntry, TextEntry> TexRow::getEntriesFromRow(int const row) const
|
||||
pair<TexRow::TextEntry, TexRow::TextEntry>
|
||||
TexRow::getEntriesFromRow(int const row) const
|
||||
{
|
||||
LYXERR(Debug::LATEX, "getEntriesFromRow: row " << row << " requested");
|
||||
// check bounds for row - 1, our target index
|
||||
@ -312,7 +313,7 @@ FuncRequest TexRow::goToFuncFromRow(int const row) const
|
||||
|
||||
|
||||
//static
|
||||
RowEntry TexRow::rowEntryFromCursorSlice(CursorSlice const & slice)
|
||||
TexRow::RowEntry TexRow::rowEntryFromCursorSlice(CursorSlice const & slice)
|
||||
{
|
||||
RowEntry entry;
|
||||
InsetMath * insetMath = slice.asInsetMath();
|
||||
|
13
src/TexRow.h
13
src/TexRow.h
@ -47,6 +47,11 @@ typedef void const * uid_type;
|
||||
typedef size_t idx_type;
|
||||
|
||||
|
||||
/// Represents the correspondence between paragraphs and the generated
|
||||
/// LaTeX file
|
||||
|
||||
class TexRow {
|
||||
public:
|
||||
/// an individual par id/pos <=> row mapping
|
||||
struct TextEntry { int id; pos_type pos; };
|
||||
|
||||
@ -62,11 +67,7 @@ struct RowEntry {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/// Represents the correspondence between paragraphs and the generated
|
||||
/// LaTeX file
|
||||
|
||||
class TexRow {
|
||||
private:
|
||||
/// id/pos correspondence for a single row
|
||||
class RowEntryList;
|
||||
|
||||
@ -286,7 +287,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
bool operator==(RowEntry entry1, RowEntry entry2);
|
||||
bool operator==(TexRow::RowEntry entry1, TexRow::RowEntry entry2);
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -2708,7 +2708,7 @@ void Tabular::TeXRow(otexstream & os, row_type row,
|
||||
void Tabular::latex(otexstream & os, OutputParams const & runparams) const
|
||||
{
|
||||
bool const is_tabular_star = !tabular_width.zero();
|
||||
RowEntry pos = TexRow::textEntry(runparams.lastid, runparams.lastpos);
|
||||
TexRow::RowEntry pos = TexRow::textEntry(runparams.lastid, runparams.lastpos);
|
||||
|
||||
//+---------------------------------------------------------------------
|
||||
//+ first the opening preamble +
|
||||
|
@ -1276,7 +1276,7 @@ void InsetMathGrid::write(WriteStream & os,
|
||||
for (col_type col = beg_col; col < end_col;) {
|
||||
int nccols = 1;
|
||||
idx_type const idx = index(row, col);
|
||||
RowEntry entry = TexRow::mathEntry(id(),idx);
|
||||
TexRow::RowEntry entry = TexRow::mathEntry(id(),idx);
|
||||
os.texrow().start(entry);
|
||||
if (col >= lastcol) {
|
||||
++col;
|
||||
|
@ -131,7 +131,7 @@ WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
|
||||
output_(output), pendingspace_(false), pendingbrace_(false),
|
||||
textmode_(false), locked_(0), ascii_(0), canbreakline_(true),
|
||||
mathsout_(false), ulemcmd_(NONE), line_(0), encoding_(encoding),
|
||||
row_entry_(make_unique<RowEntry>(TexRow::row_none))
|
||||
row_entry_(TexRow::row_none)
|
||||
{}
|
||||
|
||||
|
||||
@ -180,17 +180,17 @@ void WriteStream::asciiOnly(bool ascii)
|
||||
}
|
||||
|
||||
|
||||
Changer WriteStream::changeRowEntry(RowEntry entry)
|
||||
Changer WriteStream::changeRowEntry(TexRow::RowEntry entry)
|
||||
{
|
||||
return make_change(*row_entry_, entry);
|
||||
return make_change(row_entry_, entry);
|
||||
}
|
||||
|
||||
|
||||
bool WriteStream::startOuterRow()
|
||||
{
|
||||
if (TexRow::isNone(*row_entry_))
|
||||
if (TexRow::isNone(row_entry_))
|
||||
return false;
|
||||
return texrow().start(*row_entry_);
|
||||
return texrow().start(row_entry_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
#define MATH_MATHMLSTREAM_H
|
||||
|
||||
#include "InsetMath.h"
|
||||
|
||||
#include "TexRow.h"
|
||||
#include "texstream.h"
|
||||
|
||||
#include "support/Changer.h"
|
||||
@ -26,7 +28,6 @@ class Encoding;
|
||||
class InsetMath;
|
||||
class MathAtom;
|
||||
class MathData;
|
||||
struct RowEntry;
|
||||
|
||||
//
|
||||
// LaTeX/LyX
|
||||
@ -104,7 +105,7 @@ public:
|
||||
Encoding const * encoding() const { return encoding_; }
|
||||
|
||||
/// Temporarily change the TexRow information about the outer row entry.
|
||||
Changer changeRowEntry(RowEntry entry);
|
||||
Changer changeRowEntry(TexRow::RowEntry entry);
|
||||
/// TexRow::starts the innermost outer math inset
|
||||
/// returns true if the outer row entry will appear at this line
|
||||
bool startOuterRow();
|
||||
@ -140,8 +141,7 @@ private:
|
||||
///
|
||||
Encoding const * encoding_;
|
||||
/// Row entry we are in
|
||||
/// (it is a pointer to allow forward-declaration)
|
||||
unique_ptr<RowEntry> row_entry_;
|
||||
TexRow::RowEntry row_entry_;
|
||||
};
|
||||
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user