From: Lars Gullik Bjønnes Date: Wed, 27 Jun 2001 15:33:55 +0000 (+0000) Subject: gcc 3.0 fixes X-Git-Tag: 1.6.10~21166 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b1c4f8070feac7b2cc6d0054cc305dc3a6e918b8;p=features.git gcc 3.0 fixes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2146 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index a1d1778f5a..ce555ac05e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2001-06-27 Lars Gullik Bjønnes + + * LaTeXFeatures.C (getFloatDefinitions): std:: qualify ostream + 2001-06-27 Juergen Vigna * text.C (cursorLeftOneWord): changed to return the cursor and added diff --git a/src/LaTeXFeatures.C b/src/LaTeXFeatures.C index 324ff4ccce..b291666dc2 100644 --- a/src/LaTeXFeatures.C +++ b/src/LaTeXFeatures.C @@ -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. diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 595e40e97a..89c71ae003 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2001-06-27 Lars Gullik Bjønnes + + * insetfloatlist.C (Write): std:: qualify ostream + (Latex): ditto + 2001-06-26 The LyX Project * figinset.C: diff --git a/src/insets/insetfloatlist.C b/src/insets/insetfloatlist.C index 1fd96558ba..56be31185c 100644 --- a/src/insets/insetfloatlist.C +++ b/src/insets/insetfloatlist.C @@ -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]; diff --git a/src/lyxtext.h b/src/lyxtext.h index 5d55c9ddff..5b91dd1389 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -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 diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 5e5591bd91..80b9490e86 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,29 @@ +2001-06-27 Lars Gullik Bjønnes + + * 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 * math_scriptinset.C: Fix for entering with cursor up/down. diff --git a/src/mathed/array.C b/src/mathed/array.C index 4ceaa578b0..3a8f83e9d5 100644 --- a/src/mathed/array.C +++ b/src/mathed/array.C @@ -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; } diff --git a/src/mathed/math_bigopinset.C b/src/mathed/math_bigopinset.C index 9758426b94..094cdcb5e4 100644 --- a/src/mathed/math_bigopinset.C +++ b/src/mathed/math_bigopinset.C @@ -1,5 +1,7 @@ #include +#include + #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; } diff --git a/src/mathed/math_fracinset.C b/src/mathed/math_fracinset.C index 09429072fb..8957725685 100644 --- a/src/mathed/math_fracinset.C +++ b/src/mathed/math_fracinset.C @@ -4,6 +4,8 @@ #pragma implementation #endif +#include + #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; } diff --git a/src/mathed/math_macrotemplate.C b/src/mathed/math_macrotemplate.C index 24895f6211..89012bdad2 100644 --- a/src/mathed/math_macrotemplate.C +++ b/src/mathed/math_macrotemplate.C @@ -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); } - diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index 96a4c0db74..4d9024ed7b 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -4,6 +4,9 @@ #pragma implementation #endif +#include +#include + #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 const MathMatrixInset::getLabelList() const +std::vector const MathMatrixInset::getLabelList() const { std::vector 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(); diff --git a/src/mathed/math_matrixinset.h b/src/mathed/math_matrixinset.h index 07856b18db..d19fa76474 100644 --- a/src/mathed/math_matrixinset.h +++ b/src/mathed/math_matrixinset.h @@ -2,6 +2,8 @@ #ifndef MATH_MATRIXINSET_H #define MATH_MATRIXINSET_H +#include + #include "math_grid.h" #ifdef __GNUG__ @@ -47,7 +49,7 @@ public: /// bool ams() const; /// - vector const getLabelList() const; + std::vector const getLabelList() const; /// void Validate(LaTeXFeatures & features); diff --git a/src/mathed/math_root.C b/src/mathed/math_root.C index 6777f16cb4..6dcfbc0e03 100644 --- a/src/mathed/math_root.C +++ b/src/mathed/math_root.C @@ -17,6 +17,8 @@ #pragma implementation #endif +#include + #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); diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 7be748d1e2..26d58f5f6d 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -4,6 +4,8 @@ #pragma implementation #endif +#include + #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()); } diff --git a/src/mathed/math_sizeinset.C b/src/mathed/math_sizeinset.C index 38f3a7ede4..f46065ade0 100644 --- a/src/mathed/math_sizeinset.C +++ b/src/mathed/math_sizeinset.C @@ -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); diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 2d9891074c..2c941a762a 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -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; } diff --git a/src/text.C b/src/text.C index 55c8669e27..06d534a349 100644 --- a/src/text.C +++ b/src/text.C @@ -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; + } }