small internal stuff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3497 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-02-07 08:19:47 +00:00
parent 98385a16b8
commit 00e2f3f631
8 changed files with 30 additions and 24 deletions

View File

@ -36,6 +36,7 @@
#include "LyXView.h" #include "LyXView.h"
#include "Painter.h" #include "Painter.h"
#include "font.h" #include "font.h"
#include "Lsstream.h"
#include "math_arrayinset.h" #include "math_arrayinset.h"
#include "math_cursor.h" #include "math_cursor.h"
#include "math_factory.h" #include "math_factory.h"
@ -46,6 +47,7 @@
#include "math_pos.h" #include "math_pos.h"
#include "math_spaceinset.h" #include "math_spaceinset.h"
#include "undo_funcs.h" #include "undo_funcs.h"
#include "intl.h"
using std::endl; using std::endl;
using std::ostream; using std::ostream;
@ -99,6 +101,28 @@ InsetFormulaBase::InsetFormulaBase()
} }
// simply scrap this function if you want
void InsetFormulaBase::mutateToText()
{
#if 0
// translate to latex
ostringstream os;
latex(NULL, os, false, false);
string str = os.str();
// insert this text
LyXText * lt = view_->getLyXText();
string::const_iterator cit = str.begin();
string::const_iterator end = str.end();
for (; cit != end; ++cit)
view_->owner()->getIntl()->getTrans().TranslateAndInsert(*cit, lt);
// remove ourselves
//view_->owner()->getLyXFunc()->dispatch(LFUN_ESCAPE);
#endif
}
// Check if uses AMS macros // Check if uses AMS macros
void InsetFormulaBase::validate(LaTeXFeatures &) const void InsetFormulaBase::validate(LaTeXFeatures &) const
{} {}

View File

@ -110,6 +110,8 @@ public:
bool = true, bool = false); bool = true, bool = false);
/// ///
virtual bool isTextInset() const { return true; } virtual bool isTextInset() const { return true; }
///
virtual void mutateToText();
private: private:

View File

@ -912,6 +912,8 @@ void MathCursor::pullArg(bool goright)
array().insert(pos(), a); array().insert(pos(), a);
if (goright) if (goright)
pos() += a.size(); pos() += a.size();
} else {
formula()->mutateToText();
} }
} }

View File

@ -637,22 +637,6 @@ void MathGridInset::idxDelete(idx_type & idx, bool & popit, bool & deleteit)
} }
void MathGridInset::idxDeleteRange(idx_type /*from*/, idx_type /*to*/)
{
// leave this unimplemented unless someone wants to have it.
/*
int n = (to - from) / ncols();
int r = from / ncols();
if (n >= 1) {
cells_type::iterator it = cells_.begin() + from;
cells_.erase(it, it + n * ncols());
rowinfo_.erase(rowinfo_.begin() + r, rowinfo_.begin() + r + n);
}
*/
}
MathGridInset::RowInfo const & MathGridInset::rowinfo(row_type row) const MathGridInset::RowInfo const & MathGridInset::rowinfo(row_type row) const
{ {
return rowinfo_[row]; return rowinfo_[row];

View File

@ -129,8 +129,6 @@ public:
bool idxEnd(idx_type &, pos_type &) const; bool idxEnd(idx_type &, pos_type &) const;
/// ///
void idxDelete(idx_type &, bool &, bool &); void idxDelete(idx_type &, bool &, bool &);
///
void idxDeleteRange(idx_type, idx_type);
/// ///
virtual void addRow(row_type); virtual void addRow(row_type);

View File

@ -158,10 +158,6 @@ void MathInset::idxDelete(idx_type &, bool & popit, bool & deleteit)
} }
void MathInset::idxDeleteRange(idx_type, idx_type)
{}
void MathInset::normalize(NormalStream & os) const void MathInset::normalize(NormalStream & os) const
{ {
os << "[unknown "; os << "[unknown ";

View File

@ -143,8 +143,6 @@ public:
// the return value indicates whether the cursor should leave the inset // the return value indicates whether the cursor should leave the inset
// and/or the whole inset should be deleted // and/or the whole inset should be deleted
virtual void idxDelete(idx_type & idx, bool & popit, bool & deleteit); virtual void idxDelete(idx_type & idx, bool & popit, bool & deleteit);
// deletes a cell range and moves the cursor
virtual void idxDeleteRange(idx_type from, idx_type to);
// returns list of cell indices that are "between" from and to for // returns list of cell indices that are "between" from and to for
// selection purposes // selection purposes
virtual std::vector<idx_type> idxBetween(idx_type from, idx_type to) const; virtual std::vector<idx_type> idxBetween(idx_type from, idx_type to) const;

View File

@ -269,6 +269,8 @@ bool math_font_available(MathTextCodes type)
if (!font_available_initialized[type]) { if (!font_available_initialized[type]) {
font_available_initialized[type] = true; font_available_initialized[type] = true;
font_available[type] = fontloader.available(whichFontBaseIntern(type)); font_available[type] = fontloader.available(whichFontBaseIntern(type));
if (!font_available[type])
lyxerr[Debug::FONT] << "Math font " << type << " not available.\n";
} }
return font_available[type]; return font_available[type];
} }