some inline fix + mathed16.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1496 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-02-13 15:27:03 +00:00
parent b906c06db6
commit ac7b713ef7
7 changed files with 145 additions and 151 deletions

View File

@ -1,5 +1,7 @@
2001-02-13 Lars Gullik Bjønnes <larsbj@lyx.org> 2001-02-13 Lars Gullik Bjønnes <larsbj@lyx.org>
* math_xiter.h: remove a couple of "inline"
* array.C (strange_copy): fix bug (hopefully) * array.C (strange_copy): fix bug (hopefully)
* many files: add a lot of new files and move methods to the class * many files: add a lot of new files and move methods to the class
files they belong to. Only first attempt at cleanup more will files they belong to. Only first attempt at cleanup more will

View File

@ -27,14 +27,20 @@
#include "symbol_def.h" #include "symbol_def.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "debug.h" #include "debug.h"
#include "mathed/support.h"
using std::endl; using std::endl;
const int SizeInset = sizeof(char*) + 2; const int SizeInset = sizeof(char*) + 2;
extern int mathed_char_width(short type, int style, byte c); //extern int mathed_char_width(short type, int style, byte c);
extern int mathed_string_width(short type, int style, string const & s); //extern int mathed_string_width(short type, int style, string const & s);
extern int mathed_char_height(short, int, byte, int &, int &); //extern int mathed_char_height(short, int, byte, int &, int &);
MathedIter::MathedIter()
: flags(0), fcode(0), pos(0), row(0), col(0), ncols(0), array(0)
{}
void MathedIter::SetData(MathedArray * a) void MathedIter::SetData(MathedArray * a)

View File

@ -43,13 +43,7 @@ enum mathIterFlags {
class MathedIter { class MathedIter {
public: public:
/// ///
MathedIter() { MathedIter();
pos = 0;
fcode = 0;
array = 0;
flags = 0;
ncols = row = col = 0;
}
/// ///
explicit explicit
MathedIter(MathedArray *); MathedIter(MathedArray *);
@ -131,7 +125,11 @@ protected:
/// ///
mutable int pos; mutable int pos;
/// ///
int row, col, ncols; int row;
///
int col;
///
int ncols;
/// ///
MathedArray * array; MathedArray * array;
// one element stack // one element stack
@ -139,9 +137,15 @@ protected:
/// ///
short fcode; short fcode;
/// ///
int x, y; int x;
/// ///
int pos, row, col; int y;
///
int pos;
///
int row;
///
int col;
}; };
/// ///
MIState stck; MIState stck;
@ -152,8 +156,8 @@ protected:
}; };
/// ///
#define MX_WAS_SUB 1 //#define MX_WAS_SUB 1
/// ///
#define MX_WAS_SUPER 2 //#define MX_WAS_SUPER 2
#endif #endif

View File

@ -406,23 +406,10 @@ void MathMacroTemplate::SetMacroFocus(int &idx, int x, int y)
/* -------------------------- MathMacroTable -----------------------*/ /* -------------------------- MathMacroTable -----------------------*/
MathMacroTable::MathMacroTable(int n) : max_macros(n)
{
macro_table = new MathMacroTemplateP[max_macros];
num_macros = 0;
}
MathMacroTable::~MathMacroTable()
{
delete[] macro_table;
}
// The search is currently linear but will be binary or hash, later. // The search is currently linear but will be binary or hash, later.
MathMacroTemplate * MathMacroTable::getTemplate(string const & name) const MathMacroTemplate * MathMacroTable::getTemplate(string const & name) const
{ {
for (int i = 0; i < num_macros; ++i) { for (size_type i = 0; i < macro_table.size(); ++i) {
if (name == macro_table[i]->GetName()) if (name == macro_table[i]->GetName())
return macro_table[i]; return macro_table[i];
} }
@ -432,11 +419,7 @@ MathMacroTemplate * MathMacroTable::getTemplate(string const & name) const
void MathMacroTable::addTemplate(MathMacroTemplate * m) void MathMacroTable::addTemplate(MathMacroTemplate * m)
{ {
if (num_macros < max_macros) macro_table.push_back(m);
macro_table[num_macros++] = m;
else
lyxerr << "Error (MathMacroTable::addTemplate): "
"Macro table exhausted!" << endl;
} }
@ -531,5 +514,5 @@ void MathMacroTable::builtinMacros()
} }
MathMacroTable MathMacroTable::mathMTable(255); MathMacroTable MathMacroTable::mathMTable;
bool MathMacroTable::built = false; bool MathMacroTable::built = false;

View File

@ -190,11 +190,6 @@ typedef MathMacroTemplate * MathMacroTemplateP;
/// ///
class MathMacroTable { class MathMacroTable {
public: public:
///
explicit
MathMacroTable(int);
///
~MathMacroTable();
/// ///
void addTemplate(MathMacroTemplate *); void addTemplate(MathMacroTemplate *);
/// ///
@ -210,11 +205,11 @@ public:
private: private:
/// ///
const int max_macros; typedef std::vector<MathMacroTemplateP> table_type;
/// ///
int num_macros; typedef table_type::size_type size_type;
/// ///
MathMacroTemplateP * macro_table; table_type macro_table;
}; };

View File

@ -16,6 +16,12 @@ MathedXIter::MathedXIter()
} }
MathParInset * MathedXIter::getPar() const
{
return p;
}
void MathedXIter::GetPos(int & xx, int & yy) const void MathedXIter::GetPos(int & xx, int & yy) const
{ {
if (p) if (p)

View File

@ -19,7 +19,7 @@ class MathedXIter: public MathedIter {
/// ///
void SetData(MathParInset *); void SetData(MathParInset *);
/// ///
MathParInset * getPar() const { return p; } MathParInset * getPar() const;
/// ///
bool Next(); bool Next();
/// ///
@ -37,10 +37,8 @@ class MathedXIter: public MathedIter {
/// ///
void Adjust(); void Adjust();
/// ///
inline
void GetPos(int &, int &) const; void GetPos(int &, int &) const;
/// ///
inline
void GetIncPos(int &, int &) const; void GetIncPos(int &, int &) const;
/// ///
string const GetString() const; string const GetString() const;
@ -77,7 +75,6 @@ class MathedXIter: public MathedIter {
void Clean(int pos2); void Clean(int pos2);
/// ///
MathedRowSt * adjustVerticalSt(); MathedRowSt * adjustVerticalSt();
private: private:
/// This function is not recursive, as MathPar::Metrics is /// This function is not recursive, as MathPar::Metrics is
void IMetrics(int, int &, int &, int &); void IMetrics(int, int &, int &, int &);
@ -92,7 +89,9 @@ private:
// Limits auxiliary variables // Limits auxiliary variables
/// Position and max width of a script /// Position and max width of a script
int sx, sw; int sx;
///
int sw;
/// true= center, false= left align (default) /// true= center, false= left align (default)
bool limits; bool limits;
/// Type of previous script /// Type of previous script
@ -101,7 +100,6 @@ private:
void ipush(); void ipush();
/// ///
void ipop(); void ipop();
protected: protected:
/// ///
MathedRowSt * crow; MathedRowSt * crow;