gcc 3.0 fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2146 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-06-27 15:33:55 +00:00
parent 76ef051b1c
commit b1c4f8070f
17 changed files with 138 additions and 33 deletions

View File

@ -1,3 +1,7 @@
2001-06-27 Lars Gullik Bjønnes <larsbj@birdstep.com>
* LaTeXFeatures.C (getFloatDefinitions): std:: qualify ostream
2001-06-27 Juergen Vigna <jug@sad.it> 2001-06-27 Juergen Vigna <jug@sad.it>
* text.C (cursorLeftOneWord): changed to return the cursor and added * text.C (cursorLeftOneWord): changed to return the cursor and added

View File

@ -390,7 +390,7 @@ BufferParams const & LaTeXFeatures::bufferParams() const
} }
void LaTeXFeatures::getFloatDefinitions(ostream & os) const void LaTeXFeatures::getFloatDefinitions(std::ostream & os) const
{ {
// Here we will output the code to create the needed float styles. // Here we will output the code to create the needed float styles.
// We will try to do this as minimal as possible. // We will try to do this as minimal as possible.

View File

@ -1,3 +1,8 @@
2001-06-27 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insetfloatlist.C (Write): std:: qualify ostream
(Latex): ditto
2001-06-26 The LyX Project <lyx@violet.home.sad.it> 2001-06-26 The LyX Project <lyx@violet.home.sad.it>
* figinset.C: * figinset.C:

View File

@ -29,7 +29,7 @@ Inset::Code InsetFloatList::LyxCode() const
} }
void InsetFloatList::Write(Buffer const *, ostream & os) const void InsetFloatList::Write(Buffer const *, std::ostream & os) const
{ {
os << "FloatList " << float_type << "\n"; os << "FloatList " << float_type << "\n";
} }
@ -68,7 +68,7 @@ void InsetFloatList::Edit(BufferView *, int, int, unsigned int)
} }
int InsetFloatList::Latex(Buffer const *, ostream & os, bool, bool) const int InsetFloatList::Latex(Buffer const *, std::ostream & os, bool, bool) const
{ {
FloatList::const_iterator cit = floatList[float_type]; FloatList::const_iterator cit = floatList[float_type];

View File

@ -354,6 +354,11 @@ public:
/// Change the case of the word at cursor position. /// Change the case of the word at cursor position.
void changeCase(BufferView *, TextCase action); void changeCase(BufferView *, TextCase action);
/// ///
void LyXText::changeRegionCase(BufferView * bview,
LyXCursor const & from,
LyXCursor const & to,
LyXText::TextCase action);
///
void transposeChars(BufferView const &); void transposeChars(BufferView const &);
/** returns a printed row in a pixmap. The y value is needed to /** returns a printed row in a pixmap. The y value is needed to

View File

@ -1,3 +1,29 @@
2001-06-27 Lars Gullik Bjønnes <larsbj@birdstep.com>
* math_sizeinset.C: include support/LOstream.h
* math_scriptinset.C (Metrics): std:: qualify max
* math_root.C (Metrics): std:: qualify max
(Write): std:: qualify ostream
(WriteNormal): ditto
* math_matrixinset.C (getLabelList): std:: qualify vector
include vector
(Metrics): std:: qualify max
(header_write): std:: qualify ostream
(footer_write): ditto
* math_macrotemplate.C (Write): std:: qualify ostream
* math_bigopinset.C (Metrics): std:: qualify max, and include
functional
* math_matrixinset.h: include vector and std:: qualify it.
* array.C (GetInset): get a pointer to the first element of bf_
not an iterator.
2001-06-25 The LyX Project <Asger> 2001-06-25 The LyX Project <Asger>
* math_scriptinset.C: Fix for entering with cursor up/down. * math_scriptinset.C: Fix for entering with cursor up/down.

View File

@ -96,7 +96,7 @@ MathInset * MathArray::GetInset(int pos) const
if (!isInset(pos)) if (!isInset(pos))
return 0; return 0;
MathInset * p; MathInset * p;
memcpy(&p, bf_.begin() + pos + 1, sizeof(p)); memcpy(&p, &bf_[0] + pos + 1, sizeof(p));
return p; return p;
} }

View File

@ -1,5 +1,7 @@
#include <config.h> #include <config.h>
#include <functional>
#include "math_bigopinset.h" #include "math_bigopinset.h"
#include "LColor.h" #include "LColor.h"
#include "Painter.h" #include "Painter.h"
@ -73,10 +75,10 @@ void MathBigopInset::Metrics(MathStyles st)
if (hasLimits()) { if (hasLimits()) {
ascent_ = asc + xcell(0).height() + 2; ascent_ = asc + xcell(0).height() + 2;
descent_ = des + xcell(1).height() + 2; descent_ = des + xcell(1).height() + 2;
width_ = max(width_, wid); width_ = std::max(width_, wid);
} else { } else {
ascent_ = max(ascent_, asc); ascent_ = std::max(ascent_, asc);
descent_ = max(descent_, des); descent_ = std::max(descent_, des);
width_ += wid; width_ += wid;
} }

View File

@ -4,6 +4,8 @@
#pragma implementation #pragma implementation
#endif #endif
#include <functional>
#include "math_fracinset.h" #include "math_fracinset.h"
#include "LColor.h" #include "LColor.h"
#include "Painter.h" #include "Painter.h"
@ -30,7 +32,7 @@ void MathFracInset::Metrics(MathStyles st)
xcell(0).Metrics(st); xcell(0).Metrics(st);
xcell(1).Metrics(st); xcell(1).Metrics(st);
size_ = st; size_ = st;
width_ = max(xcell(0).width(), xcell(1).width()) + 4; width_ = std::max(xcell(0).width(), xcell(1).width()) + 4;
ascent_ = xcell(0).height() + 4 + 5; ascent_ = xcell(0).height() + 4 + 5;
descent_ = xcell(1).height() + 4 - 5; descent_ = xcell(1).height() + 4 - 5;
} }

View File

@ -25,18 +25,20 @@ MathMacroTemplate * MathMacroTemplate::Clone() const
return new MathMacroTemplate(*this); return new MathMacroTemplate(*this);
} }
int MathMacroTemplate::numargs() const int MathMacroTemplate::numargs() const
{ {
return numargs_; return numargs_;
} }
void MathMacroTemplate::numargs(int numargs) void MathMacroTemplate::numargs(int numargs)
{ {
numargs_ = numargs; numargs_ = numargs;
} }
void MathMacroTemplate::Write(ostream & os, bool fragile) const void MathMacroTemplate::Write(std::ostream & os, bool fragile) const
{ {
os << "\n\\newcommand{\\" << name_ << "}"; os << "\n\\newcommand{\\" << name_ << "}";
@ -66,4 +68,3 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y)
xcell(0).draw(pain, x + 2, y + 1); xcell(0).draw(pain, x + 2, y + 1);
pain.rectangle(x, y - ascent(), width(), height(), LColor::blue); pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);
} }

View File

@ -4,6 +4,9 @@
#pragma implementation #pragma implementation
#endif #endif
#include <vector>
#include <functional>
#include "math_matrixinset.h" #include "math_matrixinset.h"
#include "debug.h" #include "debug.h"
#include "support/LOstream.h" #include "support/LOstream.h"
@ -15,7 +18,7 @@ LyXFont WhichFont(short type, int size);
namespace { namespace {
string getAlign(short int type, int cols) string const getAlign(short int type, int cols)
{ {
string align; string align;
switch (type) { switch (type) {
@ -41,11 +44,12 @@ string getAlign(short int type, int cols)
} }
string star(bool n) string const star(bool n)
{ {
return n ? "" : "*"; return n ? "" : "*";
} }
int getCols(short int type) int getCols(short int type)
{ {
int col; int col;
@ -99,7 +103,7 @@ void MathMatrixInset::Metrics(MathStyles st)
if (numberedType()) { if (numberedType()) {
int l = 0; int l = 0;
for (int row = 0; row < nrows(); ++row) for (int row = 0; row < nrows(); ++row)
l = max(l, mathed_string_width(LM_TC_TEXTRM, size(), nicelabel(row))); l = std::max(l, mathed_string_width(LM_TC_TEXTRM, size(), nicelabel(row)));
if (l) if (l)
width_ += 30 + l; width_ += 30 + l;
@ -187,7 +191,7 @@ bool MathMatrixInset::display() const
} }
vector<string> const MathMatrixInset::getLabelList() const std::vector<string> const MathMatrixInset::getLabelList() const
{ {
std::vector<string> res; std::vector<string> res;
for (int row = 0; row < nrows(); ++row) for (int row = 0; row < nrows(); ++row)
@ -253,7 +257,7 @@ void MathMatrixInset::Validate1(LaTeXFeatures & features)
*/ */
void MathMatrixInset::header_write(ostream & os) const void MathMatrixInset::header_write(std::ostream & os) const
{ {
bool n = numberedType(); bool n = numberedType();
@ -285,7 +289,7 @@ void MathMatrixInset::header_write(ostream & os) const
} }
void MathMatrixInset::footer_write(ostream & os) const void MathMatrixInset::footer_write(std::ostream & os) const
{ {
bool n = numberedType(); bool n = numberedType();

View File

@ -2,6 +2,8 @@
#ifndef MATH_MATRIXINSET_H #ifndef MATH_MATRIXINSET_H
#define MATH_MATRIXINSET_H #define MATH_MATRIXINSET_H
#include <vector>
#include "math_grid.h" #include "math_grid.h"
#ifdef __GNUG__ #ifdef __GNUG__
@ -47,7 +49,7 @@ public:
/// ///
bool ams() const; bool ams() const;
/// ///
vector<string> const getLabelList() const; std::vector<string> const getLabelList() const;
/// ///
void Validate(LaTeXFeatures & features); void Validate(LaTeXFeatures & features);

View File

@ -17,6 +17,8 @@
#pragma implementation #pragma implementation
#endif #endif
#include <functional>
#include "math_root.h" #include "math_root.h"
#include "support/LOstream.h" #include "support/LOstream.h"
#include "Painter.h" #include "Painter.h"
@ -36,8 +38,8 @@ void MathRootInset::Metrics(MathStyles st)
{ {
MathInset::Metrics(st); MathInset::Metrics(st);
size_ = st; size_ = st;
ascent_ = max(xcell(0).ascent() + 5, xcell(1).ascent()) + 2; ascent_ = std::max(xcell(0).ascent() + 5, xcell(1).ascent()) + 2;
descent_ = max(xcell(1).descent() + 5, xcell(0).descent()) + 2; descent_ = std::max(xcell(1).descent() + 5, xcell(0).descent()) + 2;
width_ = xcell(0).width() + xcell(1).width() + 10; width_ = xcell(0).width() + xcell(1).width() + 10;
} }
@ -62,7 +64,7 @@ void MathRootInset::draw(Painter & pain, int x, int y)
} }
void MathRootInset::Write(ostream & os, bool fragile) const void MathRootInset::Write(std::ostream & os, bool fragile) const
{ {
os << "\\sqrt["; os << "\\sqrt[";
cell(0).Write(os, fragile); cell(0).Write(os, fragile);
@ -72,7 +74,7 @@ void MathRootInset::Write(ostream & os, bool fragile) const
} }
void MathRootInset::WriteNormal(ostream & os) const void MathRootInset::WriteNormal(std::ostream & os) const
{ {
os << "[root "; os << "[root ";
cell(1).WriteNormal(os); cell(1).WriteNormal(os);

View File

@ -4,6 +4,8 @@
#pragma implementation #pragma implementation
#endif #endif
#include <functional>
#include "math_scriptinset.h" #include "math_scriptinset.h"
#include "LColor.h" #include "LColor.h"
#include "Painter.h" #include "Painter.h"
@ -31,11 +33,11 @@ void MathScriptInset::Metrics(MathStyles st)
{ {
MathInset::Metrics(st); MathInset::Metrics(st);
size_ = st; size_ = st;
width_ = max(xcell(0).width(), xcell(1).width()) + 2; width_ = std::max(xcell(0).width(), xcell(1).width()) + 2;
if (up()) if (up())
ascent_ = max(ascent_, xcell(0).height() + 9); ascent_ = std::max(ascent_, xcell(0).height() + 9);
if (down()) if (down())
descent_ = max(descent_, xcell(1).height()); descent_ = std::max(descent_, xcell(1).height());
} }

View File

@ -5,6 +5,7 @@
#endif #endif
#include "math_sizeinset.h" #include "math_sizeinset.h"
#include "support/LOstream.h"
MathSizeInset::MathSizeInset(MathStyles st) MathSizeInset::MathSizeInset(MathStyles st)
@ -13,6 +14,7 @@ MathSizeInset::MathSizeInset(MathStyles st)
name_ = verbose(); name_ = verbose();
} }
char const * MathSizeInset::verbose() const char const * MathSizeInset::verbose() const
{ {
switch (style_) { switch (style_) {
@ -28,6 +30,7 @@ char const * MathSizeInset::verbose() const
return "unknownstyle"; return "unknownstyle";
} }
MathInset * MathSizeInset::Clone() const MathInset * MathSizeInset::Clone() const
{ {
return new MathSizeInset(*this); return new MathSizeInset(*this);

View File

@ -127,7 +127,7 @@ void Paragraph::Pimpl::insertInset(Paragraph::size_type pos,
search_inset, matchIT()); search_inset, matchIT());
if (it != owner_->insetlist.end() && (*it).pos == pos) { if (it != owner_->insetlist.end() && (*it).pos == pos) {
lyxerr << "ERROR (Paragraph::InsertInset): " lyxerr << "ERROR (Paragraph::InsertInset): "
"there is an inset in position: " << pos << endl; "there is an inset in position: " << pos << std::endl;
} else { } else {
owner_->insetlist.insert(it, InsetTable(pos, inset)); owner_->insetlist.insert(it, InsetTable(pos, inset));
} }
@ -198,10 +198,10 @@ void Paragraph::Pimpl::erase(Paragraph::size_type pos)
} }
void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow, void Paragraph::Pimpl::simpleTeXBlanks(std::ostream & os, TexRow & texrow,
Paragraph::size_type const i, Paragraph::size_type const i,
int & column, LyXFont const & font, int & column, LyXFont const & font,
LyXLayout const & style) LyXLayout const & style)
{ {
if (column > tex_code_break_column if (column > tex_code_break_column
&& i && i
@ -249,7 +249,8 @@ void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow,
void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
BufferParams const & bparams, BufferParams const & bparams,
ostream & os, TexRow & texrow, std::ostream & os,
TexRow & texrow,
bool moving_arg, bool moving_arg,
LyXFont & font, LyXFont & font,
LyXFont & running_font, LyXFont & running_font,
@ -517,9 +518,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
Paragraph * Paragraph::Pimpl::TeXDeeper(Buffer const * buf, Paragraph * Paragraph::Pimpl::TeXDeeper(Buffer const * buf,
BufferParams const & bparams, BufferParams const & bparams,
ostream & os, TexRow & texrow) std::ostream & os, TexRow & texrow)
{ {
lyxerr[Debug::LATEX] << "TeXDeeper... " << this << endl; lyxerr[Debug::LATEX] << "TeXDeeper... " << this << std::endl;
Paragraph * par = owner_; Paragraph * par = owner_;
while (par && par->params().depth() == owner_->params().depth()) { while (par && par->params().depth() == owner_->params().depth()) {
@ -532,7 +533,7 @@ Paragraph * Paragraph::Pimpl::TeXDeeper(Buffer const * buf,
os, texrow, false); os, texrow, false);
} }
} }
lyxerr[Debug::LATEX] << "TeXDeeper...done " << par << endl; lyxerr[Debug::LATEX] << "TeXDeeper...done " << par << std::endl;
return par; return par;
} }

View File

@ -2406,6 +2406,9 @@ void LyXText::changeCase(BufferView * bview, LyXText::TextCase action)
setUndo(bview->buffer(), Undo::FINISH, setUndo(bview->buffer(), Undo::FINISH,
from.par()->previous(), to.par()->next()); from.par()->previous(), to.par()->next());
#if 1
changeRegionCase(bview, to, from, action);
#else
while(from != to) { while(from != to) {
unsigned char c = from.par()->getChar(from.pos()); unsigned char c = from.par()->getChar(from.pos());
if (!IsInsetChar(c) && !IsHfillChar(c)) { if (!IsInsetChar(c) && !IsHfillChar(c)) {
@ -2435,6 +2438,49 @@ void LyXText::changeCase(BufferView * bview, LyXText::TextCase action)
refresh_row = from.row(); refresh_row = from.row();
status = LyXText::NEED_MORE_REFRESH; status = LyXText::NEED_MORE_REFRESH;
} }
#endif
}
void LyXText::changeRegionCase(BufferView * bview,
LyXCursor const & from,
LyXCursor const & to,
LyXText::TextCase action)
{
setUndo(bview->buffer(), Undo::FINISH,
from.par()->previous(), to.par()->next());
LyXCursor tmp(from);
while(tmp != to) {
unsigned char c = tmp.par()->getChar(tmp.pos());
if (!IsInsetChar(c) && !IsHfillChar(c)) {
switch (action) {
case text_lowercase:
c = tolower(c);
break;
case text_capitalization:
c = toupper(c);
action = text_lowercase;
break;
case text_uppercase:
c = toupper(c);
break;
}
}
tmp.par()->setChar(tmp.pos(), c);
checkParagraph(bview, tmp.par(), tmp.pos());
tmp.pos(tmp.pos() + 1);
if (tmp.pos() >= tmp.par()->size()) {
tmp.par(tmp.par()->next());
tmp.pos(0);
}
}
if (to.row() != tmp.row()) {
refresh_y = tmp.y() - tmp.row()->baseline();
refresh_row = tmp.row();
status = LyXText::NEED_MORE_REFRESH;
}
} }