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>
* 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.
// 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>
* 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";
}
@ -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];

View File

@ -354,6 +354,11 @@ public:
/// Change the case of the word at cursor position.
void changeCase(BufferView *, TextCase action);
///
void LyXText::changeRegionCase(BufferView * bview,
LyXCursor const & from,
LyXCursor const & to,
LyXText::TextCase action);
///
void transposeChars(BufferView const &);
/** 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>
* 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))
return 0;
MathInset * p;
memcpy(&p, bf_.begin() + pos + 1, sizeof(p));
memcpy(&p, &bf_[0] + pos + 1, sizeof(p));
return p;
}

View File

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

View File

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

View File

@ -25,18 +25,20 @@ MathMacroTemplate * MathMacroTemplate::Clone() const
return new MathMacroTemplate(*this);
}
int MathMacroTemplate::numargs() const
{
return numargs_;
}
void MathMacroTemplate::numargs(int numargs)
{
numargs_ = numargs;
}
void MathMacroTemplate::Write(ostream & os, bool fragile) const
void MathMacroTemplate::Write(std::ostream & os, bool fragile) const
{
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);
pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);
}

View File

@ -4,6 +4,9 @@
#pragma implementation
#endif
#include <vector>
#include <functional>
#include "math_matrixinset.h"
#include "debug.h"
#include "support/LOstream.h"
@ -15,7 +18,7 @@ LyXFont WhichFont(short type, int size);
namespace {
string getAlign(short int type, int cols)
string const getAlign(short int type, int cols)
{
string align;
switch (type) {
@ -41,11 +44,12 @@ string getAlign(short int type, int cols)
}
string star(bool n)
string const star(bool n)
{
return n ? "" : "*";
}
int getCols(short int type)
{
int col;
@ -99,7 +103,7 @@ void MathMatrixInset::Metrics(MathStyles st)
if (numberedType()) {
int l = 0;
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)
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;
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();
@ -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();

View File

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

View File

@ -17,6 +17,8 @@
#pragma implementation
#endif
#include <functional>
#include "math_root.h"
#include "support/LOstream.h"
#include "Painter.h"
@ -36,8 +38,8 @@ void MathRootInset::Metrics(MathStyles st)
{
MathInset::Metrics(st);
size_ = st;
ascent_ = max(xcell(0).ascent() + 5, xcell(1).ascent()) + 2;
descent_ = max(xcell(1).descent() + 5, xcell(0).descent()) + 2;
ascent_ = std::max(xcell(0).ascent() + 5, xcell(1).ascent()) + 2;
descent_ = std::max(xcell(1).descent() + 5, xcell(0).descent()) + 2;
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[";
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 ";
cell(1).WriteNormal(os);

View File

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

View File

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

View File

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

View File

@ -2406,6 +2406,9 @@ void LyXText::changeCase(BufferView * bview, LyXText::TextCase action)
setUndo(bview->buffer(), Undo::FINISH,
from.par()->previous(), to.par()->next());
#if 1
changeRegionCase(bview, to, from, action);
#else
while(from != to) {
unsigned char c = from.par()->getChar(from.pos());
if (!IsInsetChar(c) && !IsHfillChar(c)) {
@ -2435,6 +2438,49 @@ void LyXText::changeCase(BufferView * bview, LyXText::TextCase action)
refresh_row = from.row();
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;
}
}