From 47910a7a67b9d49ccf410cc9e8d52ab89458dd56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Tue, 24 Apr 2001 15:25:26 +0000 Subject: [PATCH] move more support functions into namespace lyx, small other changes git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1949 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 2 +- src/BufferView_pimpl.C | 4 +-- src/Bullet.h | 18 +++++----- src/ChangeLog | 28 +++++++++++++++ src/LColor.C | 2 +- src/MenuBackend.C | 15 ++++---- src/PrinterParams.h | 11 +++--- src/UpdateInset.h | 2 +- src/bufferlist.C | 20 ++++++++--- src/bufferlist.h | 2 +- src/converter.C | 10 +++--- src/frontends/Dialogs.h | 2 +- src/frontends/Liason.C | 2 +- src/frontends/controllers/ControlInset.h | 4 +-- src/frontends/controllers/ControlPreamble.C | 2 +- src/frontends/controllers/ControlPrint.C | 2 +- src/frontends/controllers/biblio.C | 2 +- src/frontends/support/LyXImage_X.C | 2 +- src/frontends/xforms/FormBase.C | 7 ++-- src/frontends/xforms/FormBaseDeprecated.C | 26 +++++++------- src/frontends/xforms/FormMathsBitmap.C | 2 +- src/frontends/xforms/FormMathsMatrix.C | 7 ++-- src/frontends/xforms/FormPreferences.C | 10 +++--- src/frontends/xforms/FormSplash.C | 10 +++--- src/frontends/xforms/Menubar_pimpl.C | 2 +- src/graphics/GraphicsCacheItem.C | 3 +- src/graphics/ImageLoaderXPM.C | 2 +- src/insets/ExternalTemplate.C | 2 +- src/insets/inset.C | 4 +-- src/insets/insetcollapsable.C | 8 +++-- src/insets/insetgraphicsParams.C | 14 ++++---- src/insets/insetminipage.C | 1 + src/insets/insettabular.C | 6 ++-- src/insets/insettext.C | 10 +++--- src/insets/lyxinset.h | 4 --- src/layout.C | 20 +++++------ src/lyxfunc.C | 4 +-- src/lyxparagraph.h | 38 ++++++++++----------- src/mathed/math_macrotable.C | 2 +- src/mathed/math_macrotemplate.C | 2 +- src/mathed/math_rowst.C | 14 ++++---- src/mathed/math_xiter.C | 2 +- src/paragraph.C | 26 +++++++------- src/support/ChangeLog | 7 ++++ src/support/LAssert.h | 9 ++--- src/support/lstrings.C | 20 +++++------ src/support/lyxfunctional.h | 5 ++- src/support/translator.h | 8 ++--- src/tabular.C | 8 ++--- src/tabular.h | 5 +-- src/text.C | 3 +- 51 files changed, 239 insertions(+), 182 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index 7263f0ac85..6db015c47c 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -985,7 +985,7 @@ bool BufferView::ChangeCitationsIfUnique(string const & from, string const & to) vector > keys = buffer()->getBibkeyList(); if (count_if(keys.begin(), keys.end(), - equal_1st_in_pair(from)) + lyx::equal_1st_in_pair(from)) > 1) return false; diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index d1c70ef4ae..fe77ae6227 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -252,7 +252,7 @@ void BufferView::Pimpl::redraw() bool BufferView::Pimpl::fitCursor(LyXText * text) { - Assert(screen_.get()); + lyx::Assert(screen_.get()); bool ret = screen_->FitCursor(text, bv_); if (ret) @@ -1432,7 +1432,7 @@ Inset * BufferView::Pimpl::getInsetByCode(Inset::Code code) find_if(Buffer::inset_iterator( cursor.par(), cursor.pos()), buffer_->inset_iterator_end(), - compare_memfun(&Inset::LyxCode, code) + lyx::compare_memfun(&Inset::LyxCode, code) ); return it != buffer_->inset_iterator_end() ? (*it) : 0; } diff --git a/src/Bullet.h b/src/Bullet.h index 38fc29e4cb..0e188c383b 100644 --- a/src/Bullet.h +++ b/src/Bullet.h @@ -56,17 +56,17 @@ protected: #ifdef ENABLE_ASSERTIONS /// void testInvariant() const { - Assert(font >= MIN); - Assert(font < FONTMAX); - Assert(character >= MIN); - Assert(character < CHARMAX); - Assert(size >= MIN); - Assert(size < SIZEMAX); - Assert(user_text >= -1); - Assert(user_text <= 1); + lyx::Assert(font >= MIN); + lyx::Assert(font < FONTMAX); + lyx::Assert(character >= MIN); + lyx::Assert(character < CHARMAX); + lyx::Assert(size >= MIN); + lyx::Assert(size < SIZEMAX); + lyx::Assert(user_text >= -1); + lyx::Assert(user_text <= 1); // now some relational/operational tests if (user_text == 1) { - Assert(font == -1 && (character == -1 && size == -1)); + lyx::Assert(font == -1 && (character == -1 && size == -1)); // Assert(!text.empty()); // this isn't necessarily an error } // else if (user_text == -1) { diff --git a/src/ChangeLog b/src/ChangeLog index ca93960911..28a2fa36b5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,31 @@ +2001-04-24 Lars Gullik Bjønnes + + * lyxparagraph.h (size): move up int file + (GetLayout): ditto + + * adjust all uses of Assert to lyx::Assert. + + * BufferView2.C (ChangeCitationsIfUnique): adjust for + lyxfunctional in namespace lyx + * layout.C (hasLayout): ditto + (GetLayout): ditto + (GetLayout): ditto + (delete_layout): ditto + (NumberOfClass): ditto + * converter.C (GetFormat): ditto + (GetNumber): ditto + (Add): ditto + (Delete): ditto + (SetViewer): ditto + * bufferlist.C (getFileNames): ditto + (emergencyWriteAll): ditto + (exists): ditto + (getBuffer): ditto + * MenuBackend.C (hasSubmenu): ditto + (hasMenu): ditto + (getMenu): ditto + * BufferView_pimpl.C (getInsetByCode): ditto + 2001-04-18 Juergen Vigna * vspace.C (asLatexString): fixed the 100% problem. diff --git a/src/LColor.C b/src/LColor.C index 0d3b77b698..3eb59460a4 100644 --- a/src/LColor.C +++ b/src/LColor.C @@ -169,7 +169,7 @@ void LColor::setColor(LColor::color col, string const & x11name) return; } lyxerr << "LyX internal error: color and such.\n"; - Assert(false); + lyx::Assert(false); } diff --git a/src/MenuBackend.C b/src/MenuBackend.C index d757f4a699..fb9409be0a 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -334,7 +334,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const bool Menu::hasSubmenu(string const & name) const { return find_if(begin(), end(), - compare_memfun(&MenuItem::submenu, name)) != end(); + lyx::compare_memfun(&MenuItem::submenu, name)) != end(); } @@ -469,23 +469,24 @@ void MenuBackend::add(Menu const & menu) bool MenuBackend::hasMenu(string const & name) const { return find_if(begin(), end(), - compare_memfun(&Menu::name, name)) != end(); + lyx::compare_memfun(&Menu::name, name)) != end(); } Menu const & MenuBackend::getMenu(string const & name) const { const_iterator cit = find_if(begin(), end(), - compare_memfun(&Menu::name, name)); - Assert(cit != end()); + lyx::compare_memfun(&Menu::name, name)); + lyx::Assert(cit != end()); return (*cit); } Menu & MenuBackend::getMenu(string const & name) { - MenuList::iterator it = find_if(menulist_.begin(), menulist_.end(), - compare_memfun(&Menu::name, name)); - Assert(it != menulist_.end()); + MenuList::iterator it = + find_if(menulist_.begin(), menulist_.end(), + lyx::compare_memfun(&Menu::name, name)); + lyx::Assert(it != menulist_.end()); return (*it); } diff --git a/src/PrinterParams.h b/src/PrinterParams.h index 61e96f6807..3cee570d55 100644 --- a/src/PrinterParams.h +++ b/src/PrinterParams.h @@ -94,22 +94,23 @@ struct PrinterParams { #ifdef ENABLE_ASSERTIONS if (!from_page.empty()) { // Assert(from_page == number or empty) - Assert(containsOnly(from_page, "1234567890")); + lyx::Assert(containsOnly(from_page, + "1234567890")); } if (to_page) { // Assert(to_page == empty // or number iff from_page set) - Assert(!from_page.empty()); + lyx::Assert(!from_page.empty()); } switch (target) { case PRINTER: // Assert(!printer_name.empty()); break; case FILE: - Assert(!file_name.empty()); + lyx::Assert(!file_name.empty()); break; default: - Assert(false); + lyx::Assert(false); break; } switch (which_pages) { @@ -118,7 +119,7 @@ struct PrinterParams { case EVEN: break; default: - Assert(false); + lyx::Assert(false); break; } #endif diff --git a/src/UpdateInset.h b/src/UpdateInset.h index 154e2dbcdf..eff495b7da 100644 --- a/src/UpdateInset.h +++ b/src/UpdateInset.h @@ -18,7 +18,7 @@ class UpdateInset { public: /// void push(Inset * inset) { - Assert(inset); + lyx::Assert(inset); insetqueue.push(inset); } /// diff --git a/src/bufferlist.C b/src/bufferlist.C index f00374aea4..5720356deb 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -54,6 +54,7 @@ extern BufferView * current_view; void BufferStorage::release(Buffer * buf) { + lyx::Assert(buf); Container::iterator it = find(container.begin(), container.end(), buf); if (it != container.end()) { // Make sure that we don't store a LyXText in @@ -168,6 +169,8 @@ void BufferList::resize() bool BufferList::close(Buffer * buf) { + lyx::Assert(buf); + // CHECK // Trace back why we need to use buf->getUser here. // Perhaps slight rewrite is in order? (Lgb) @@ -223,7 +226,7 @@ vector const BufferList::getFileNames() const { vector nvec; std::copy(bstore.begin(), bstore.end(), - back_inserter_fun(nvec, &Buffer::fileName)); + lyx::back_inserter_fun(nvec, &Buffer::fileName)); return nvec; } @@ -244,7 +247,9 @@ Buffer * BufferList::getBuffer(unsigned int choice) int BufferList::unlockInset(UpdatableInset * inset) { - if (!inset) return 1; + lyx::Assert(inset); + + //if (!inset) return 1; for (BufferStorage::iterator it = bstore.begin(); it != bstore.end(); ++it) { if ((*it)->getUser() @@ -276,12 +281,14 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir) void BufferList::emergencyWriteAll() { for_each(bstore.begin(), bstore.end(), - class_fun(*this, &BufferList::emergencyWrite)); + lyx::class_fun(*this, &BufferList::emergencyWrite)); } void BufferList::emergencyWrite(Buffer * buf) { + assert(buf); // use c assert to avoid a loop + // No need to save if the buffer has not changed. if (buf->isLyxClean()) return; @@ -405,12 +412,15 @@ Buffer * BufferList::readFile(string const & s, bool ronly) bool BufferList::exists(string const & s) const { return find_if(bstore.begin(), bstore.end(), - compare_memfun(&Buffer::fileName, s)) != bstore.end(); + lyx::compare_memfun(&Buffer::fileName, s)) + != bstore.end(); } bool BufferList::isLoaded(Buffer const * b) const { + lyx::Assert(b); + BufferStorage::const_iterator cit = find(bstore.begin(), bstore.end(), b); return cit != bstore.end(); @@ -421,7 +431,7 @@ Buffer * BufferList::getBuffer(string const & s) { BufferStorage::iterator it = find_if(bstore.begin(), bstore.end(), - compare_memfun(&Buffer::fileName, s)); + lyx::compare_memfun(&Buffer::fileName, s)); return it != bstore.end() ? (*it) : 0; } diff --git a/src/bufferlist.h b/src/bufferlist.h index 869a06e971..93bd63e5db 100644 --- a/src/bufferlist.h +++ b/src/bufferlist.h @@ -108,7 +108,7 @@ public: Buffer * readFile(string const &, bool ro); /// Make a new file (buffer) using a template - Buffer * newFile(string const &, string, bool isNamed=false); + Buffer * newFile(string const &, string, bool isNamed = false); /// returns a vector with all the buffers filenames std::vector const getFileNames() const; diff --git a/src/converter.C b/src/converter.C index fd1c4ca0fb..818c8eb81b 100644 --- a/src/converter.C +++ b/src/converter.C @@ -86,7 +86,7 @@ Format const * Formats::GetFormat(string const & name) const { FormatList::const_iterator cit = find_if(formatlist.begin(), formatlist.end(), - compare_memfun(&Format::name, name)); + lyx::compare_memfun(&Format::name, name)); if (cit != formatlist.end()) return &(*cit); else @@ -98,7 +98,7 @@ int Formats::GetNumber(string const & name) const { FormatList::const_iterator cit = find_if(formatlist.begin(), formatlist.end(), - compare_memfun(&Format::name, name)); + lyx::compare_memfun(&Format::name, name)); if (cit != formatlist.end()) return cit - formatlist.begin(); else @@ -118,7 +118,7 @@ void Formats::Add(string const & name, string const & extension, { FormatList::iterator it = find_if(formatlist.begin(), formatlist.end(), - compare_memfun(&Format::name, name)); + lyx::compare_memfun(&Format::name, name)); if (it == formatlist.end()) formatlist.push_back(Format(name, extension, prettyname, shortcut, "")); @@ -133,7 +133,7 @@ void Formats::Delete(string const & name) { FormatList::iterator it = find_if(formatlist.begin(), formatlist.end(), - compare_memfun(&Format::name, name)); + lyx::compare_memfun(&Format::name, name)); if (it != formatlist.end()) formatlist.erase(it); } @@ -150,7 +150,7 @@ void Formats::SetViewer(string const & name, string const & command) Add(name); FormatList::iterator it = find_if(formatlist.begin(), formatlist.end(), - compare_memfun(&Format::name, name)); + lyx::compare_memfun(&Format::name, name)); if (it != formatlist.end()) it->setViewer(command); } diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index f26139f23d..294306860a 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -175,7 +175,7 @@ private: inline void Dialogs::add(DialogBase * ptr) { - Assert(ptr); + lyx::Assert(ptr); dialogs_.push_back(db_ptr(ptr)); } diff --git a/src/frontends/Liason.C b/src/frontends/Liason.C index 85172e3cfe..fcc83da5b6 100644 --- a/src/frontends/Liason.C +++ b/src/frontends/Liason.C @@ -158,7 +158,7 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp) void setMinibuffer(LyXView * lv, string const & msg) { - Assert(lv); + lyx::Assert(lv); lv->message(msg); } diff --git a/src/frontends/controllers/ControlInset.h b/src/frontends/controllers/ControlInset.h index 870e20d6b8..9dfa3c8c36 100644 --- a/src/frontends/controllers/ControlInset.h +++ b/src/frontends/controllers/ControlInset.h @@ -189,7 +189,7 @@ void ControlInset::apply() template Params & ControlInset::params() const { - Assert(params_); + lyx::Assert(params_); return *params_; } @@ -197,7 +197,7 @@ Params & ControlInset::params() const template Inset * ControlInset::inset() const { - Assert(inset_); + lyx::Assert(inset_); return inset_; } diff --git a/src/frontends/controllers/ControlPreamble.C b/src/frontends/controllers/ControlPreamble.C index 52d863c754..c9720377ff 100644 --- a/src/frontends/controllers/ControlPreamble.C +++ b/src/frontends/controllers/ControlPreamble.C @@ -43,7 +43,7 @@ void ControlPreamble::apply() string & ControlPreamble::params() const { - Assert(params_); + lyx::Assert(params_); return *params_; } diff --git a/src/frontends/controllers/ControlPrint.C b/src/frontends/controllers/ControlPrint.C index f91d70d800..65c3c5af0a 100644 --- a/src/frontends/controllers/ControlPrint.C +++ b/src/frontends/controllers/ControlPrint.C @@ -57,7 +57,7 @@ void ControlPrint::apply() PrinterParams & ControlPrint::params() const { - Assert(params_); + lyx::Assert(params_); return *params_; } diff --git a/src/frontends/controllers/biblio.C b/src/frontends/controllers/biblio.C index 0dee0b0850..05b281b587 100644 --- a/src/frontends/controllers/biblio.C +++ b/src/frontends/controllers/biblio.C @@ -67,7 +67,7 @@ vector const getKeys(InfoMap const & map) string const getInfo(InfoMap const & map, string const & key) { - Assert(!map.empty()); + lyx::Assert(!map.empty()); string result; diff --git a/src/frontends/support/LyXImage_X.C b/src/frontends/support/LyXImage_X.C index 77a70db79c..b49ea2d945 100644 --- a/src/frontends/support/LyXImage_X.C +++ b/src/frontends/support/LyXImage_X.C @@ -33,7 +33,7 @@ LyXImage::~LyXImage() Pixmap LyXImage::getPixmap() const { - Assert(pixmapInitialized); + lyx::Assert(pixmapInitialized); return pixmap_; } diff --git a/src/frontends/xforms/FormBase.C b/src/frontends/xforms/FormBase.C index 470d0aa368..f39af6f3de 100644 --- a/src/frontends/xforms/FormBase.C +++ b/src/frontends/xforms/FormBase.C @@ -101,7 +101,7 @@ namespace { FormBase * GetForm(FL_OBJECT * ob) { - Assert(ob && ob->form && ob->form->u_vdata); + lyx::Assert(ob && ob->form && ob->form->u_vdata); FormBase * pre = static_cast(ob->form->u_vdata); return pre; } @@ -109,10 +109,11 @@ FormBase * GetForm(FL_OBJECT * ob) } // namespace anon -extern "C" int C_FormBaseWMHideCB(FL_FORM * form, void *) +extern "C" +int C_FormBaseWMHideCB(FL_FORM * form, void *) { // Close the dialog cleanly, even if the WM is used to do so. - Assert(form && form->u_vdata); + lyx::Assert(form && form->u_vdata); FormBase * pre = static_cast(form->u_vdata); pre->CancelButton(); return FL_CANCEL; diff --git a/src/frontends/xforms/FormBaseDeprecated.C b/src/frontends/xforms/FormBaseDeprecated.C index d6336b5706..f925f1c844 100644 --- a/src/frontends/xforms/FormBaseDeprecated.C +++ b/src/frontends/xforms/FormBaseDeprecated.C @@ -56,7 +56,7 @@ FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d, string const & t) : lv_(lv), d_(d), h_(0), r_(0), title_(t), minw_(0), minh_(0) { - Assert(lv && d); + lyx::Assert(lv && d); } @@ -133,12 +133,12 @@ void FormBaseDeprecated::hide() int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *) { - Assert(form); + lyx::Assert(form); // Ensure that the signals (u and h) are disconnected even if the // window manager is used to close the dialog. FormBaseDeprecated * pre = static_cast(form->u_vdata); - Assert(pre); + lyx::Assert(pre); pre->hide(); pre->bc().hide(); return FL_CANCEL; @@ -147,10 +147,10 @@ int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *) void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long) { - Assert(ob && ob->form); + lyx::Assert(ob && ob->form); FormBaseDeprecated * pre = static_cast(ob->form->u_vdata); - Assert(pre); + lyx::Assert(pre); pre->apply(); pre->bc().apply(); } @@ -158,10 +158,10 @@ void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long) void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long) { - Assert(ob && ob->form); + lyx::Assert(ob && ob->form); FormBaseDeprecated * pre = static_cast(ob->form->u_vdata); - Assert(pre); + lyx::Assert(pre); pre->ok(); pre->bc().ok(); } @@ -169,10 +169,10 @@ void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long) void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long) { - Assert(ob && ob->form); + lyx::Assert(ob && ob->form); FormBaseDeprecated * pre = static_cast(ob->form->u_vdata); - Assert(pre); + lyx::Assert(pre); pre->cancel(); pre->bc().cancel(); } @@ -180,20 +180,20 @@ void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long) void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data) { - Assert(ob && ob->form); + lyx::Assert(ob && ob->form); FormBaseDeprecated * pre = static_cast(ob->form->u_vdata); - Assert(pre); + lyx::Assert(pre); pre->bc().valid(pre->input(ob, data)); } void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long) { - Assert(ob && ob->form); + lyx::Assert(ob && ob->form); FormBaseDeprecated * pre = static_cast(ob->form->u_vdata); - Assert(pre); + lyx::Assert(pre); pre->bc().restore(); pre->restore(); } diff --git a/src/frontends/xforms/FormMathsBitmap.C b/src/frontends/xforms/FormMathsBitmap.C index 62c51987a4..d3011e0c37 100644 --- a/src/frontends/xforms/FormMathsBitmap.C +++ b/src/frontends/xforms/FormMathsBitmap.C @@ -55,7 +55,7 @@ FL_FORM * FormMathsBitmap::form() const void FormMathsBitmap::build() { - Assert(bitmaps_.size() > 0); + lyx::Assert(bitmaps_.size() > 0); h_+= 50; // Allow room for a Close button diff --git a/src/frontends/xforms/FormMathsMatrix.C b/src/frontends/xforms/FormMathsMatrix.C index f8e9509441..48a3547cd8 100644 --- a/src/frontends/xforms/FormMathsMatrix.C +++ b/src/frontends/xforms/FormMathsMatrix.C @@ -25,12 +25,13 @@ static char h_align_str[80] = "c"; static char v_align_c[] = "tcb"; -extern "C" int C_FormMathsMatrixAlignFilter(FL_OBJECT * ob, char const *, +extern "C" +int C_FormMathsMatrixAlignFilter(FL_OBJECT * ob, char const *, char const * cur, int c) { - Assert(ob); + lyx::Assert(ob); FormMathsMatrix * pre = static_cast(ob->u_vdata); - Assert(pre); + lyx::Assert(pre); return pre->AlignFilter(cur, c); } diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 80c9375a77..b7331fe47e 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -296,7 +296,7 @@ void FormPreferences::apply() void FormPreferences::feedback(FL_OBJECT * ob) { - Assert(ob); + lyx::Assert(ob); string str; @@ -335,7 +335,7 @@ void FormPreferences::feedback(FL_OBJECT * ob) bool FormPreferences::input(FL_OBJECT * ob, long) { - Assert(ob); + lyx::Assert(ob); // whatever checks you need to ensure the user hasn't entered // some totally ridiculous value somewhere. Change activate to suit. @@ -3000,7 +3000,7 @@ int FormPreferences::FeedbackCB(FL_OBJECT * ob, int event, // Note that the return value is important in the pre-emptive handler. // Don't return anything other than 0. - Assert(ob); + lyx::Assert(ob); // Don't Assert this one, as it can happen quite reasonably when things // are being deleted in the d-tor. //Assert(ob->form); @@ -3016,7 +3016,7 @@ int FormPreferences::FeedbackCB(FL_OBJECT * ob, int event, // preemptive handler for feedback messages void FormPreferences::Feedback(FL_OBJECT * ob, int event) { - Assert(ob); + lyx::Assert(ob); switch (event) { case FL_ENTER: @@ -3037,6 +3037,6 @@ void FormPreferences::Feedback(FL_OBJECT * ob, int event) void FormPreferences::setPreHandler(FL_OBJECT * ob) { - Assert(ob); + lyx::Assert(ob); fl_set_object_prehandler(ob, C_FormPreferencesFeedbackCB); } diff --git a/src/frontends/xforms/FormSplash.C b/src/frontends/xforms/FormSplash.C index e06bf4923b..7fac1a161e 100644 --- a/src/frontends/xforms/FormSplash.C +++ b/src/frontends/xforms/FormSplash.C @@ -21,18 +21,20 @@ #include "form_splash.h" #include "support/LAssert.h" -extern "C" int C_FormSplashCloseCB(FL_FORM * form, void *) +extern "C" +int C_FormSplashCloseCB(FL_FORM * form, void *) { - Assert(form && form->u_vdata); + lyx::Assert(form && form->u_vdata); FormSplash * pre = static_cast(form->u_vdata); pre->Hide(); return FL_CANCEL; } -extern "C" void C_FormSplashCB(FL_OBJECT * ob, long) +extern "C" +void C_FormSplashCB(FL_OBJECT * ob, long) { - Assert(ob && ob->form && ob->form->u_vdata); + lyx::Assert(ob && ob->form && ob->form->u_vdata); FormSplash * pre = static_cast(ob->form->u_vdata); pre->Hide(); } diff --git a/src/frontends/xforms/Menubar_pimpl.C b/src/frontends/xforms/Menubar_pimpl.C index f06aaaee92..f18d8cdf72 100644 --- a/src/frontends/xforms/Menubar_pimpl.C +++ b/src/frontends/xforms/Menubar_pimpl.C @@ -602,7 +602,7 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button) } // Paranoia check - Assert(item->kind() == MenuItem::Submenu); + lyx::Assert(item->kind() == MenuItem::Submenu); // set tabstop length fl_set_tabstop(menu_tabstop); diff --git a/src/graphics/GraphicsCacheItem.C b/src/graphics/GraphicsCacheItem.C index c3929c526a..e531a7cb2e 100644 --- a/src/graphics/GraphicsCacheItem.C +++ b/src/graphics/GraphicsCacheItem.C @@ -73,11 +73,12 @@ GraphicsCacheItem::imageConverted(int retval) namespace { + string const findTargetFormat(string const & from) { typedef ImageLoader::FormatList FormatList; FormatList formats = ImageLoaderXPM().loadableFormats(); - Assert(formats.size() > 0); // There must be a format to load from. + lyx::Assert(formats.size() > 0); // There must be a format to load from. FormatList::const_iterator iter = formats.begin(); FormatList::const_iterator end = formats.end(); diff --git a/src/graphics/ImageLoaderXPM.C b/src/graphics/ImageLoaderXPM.C index 1bef2d2a42..2e08b052e0 100644 --- a/src/graphics/ImageLoaderXPM.C +++ b/src/graphics/ImageLoaderXPM.C @@ -86,7 +86,7 @@ ImageLoaderXPM::runImageLoader(string const & filename) } // This should have been set by the XpmReadFileToPixmap call! - Assert(attrib.valuemask & XpmSize); + lyx::Assert(attrib.valuemask & XpmSize); setImage(new LyXImage(pixmap, attrib.width, attrib.height)); diff --git a/src/insets/ExternalTemplate.C b/src/insets/ExternalTemplate.C index 960a829260..124ab8ddde 100644 --- a/src/insets/ExternalTemplate.C +++ b/src/insets/ExternalTemplate.C @@ -256,7 +256,7 @@ void ExternalTemplate::readTemplate(LyXLex & lex) default: lex.printError("ExternalTemplate::readTemplate: " "Wrong tag: $$Token"); - Assert(false); + lyx::Assert(false); break; } } diff --git a/src/insets/inset.C b/src/insets/inset.C index 344921e620..5d74876107 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -180,8 +180,8 @@ void UpdatableInset::scroll(BufferView * bv, float s) const if ((tmp_top_x + scx + width(bv, font)) < (workW / 2)) { scx += (workW / 2) - (tmp_top_x + scx + width(bv, font)); } - -// bv->updateInset(const_cast(this), false); + + // bv->updateInset(const_cast(this), false); } void UpdatableInset::scroll(BufferView * bv, int offset) const diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 208a5fdf7b..9bc73fe456 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -196,6 +196,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f, if (!owner()) x += static_cast(scroll()); #endif + if (!cleared && (inset.need_update == InsetText::FULL || inset.need_update == InsetText::INIT || top_x != int(x) || @@ -208,11 +209,11 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f, bv->text->status = LyXText::CHANGED_IN_DRAW; return; #else - int w = owner() ? width(bv, f) : pain.paperWidth(); + int w = owner() ? width(bv, f) : pain.paperWidth(); int h = ascent(bv, f) + descent(bv, f); int const tx = (needFullRow() && !owner()) ? 0 : int(x); int const ty = max(0, baseline - ascent(bv, f)); - + if ((ty + h) > pain.paperHeight()) h = pain.paperHeight(); if ((top_x + w) > pain.paperWidth()) @@ -402,7 +403,7 @@ bool InsetCollapsable::UnlockInsetInInset(BufferView * bv, UpdatableInset * in, bv->unlockInset(this); return true; } - bool ret = inset.UnlockInsetInInset(bv, in, lr); + bool const ret = inset.UnlockInsetInInset(bv, in, lr); return ret; } @@ -500,6 +501,7 @@ bool InsetCollapsable::nodraw() const return inset.nodraw(); } + int InsetCollapsable::scroll(bool recursive) const { int sx = UpdatableInset::scroll(false); diff --git a/src/insets/insetgraphicsParams.C b/src/insets/insetgraphicsParams.C index 54a2a7a1d0..0b46482827 100644 --- a/src/insets/insetgraphicsParams.C +++ b/src/insets/insetgraphicsParams.C @@ -146,34 +146,34 @@ void InsetGraphicsParams::testInvariant() const // Filename might be empty (when the dialog is first created). // Assert(!filename.empty()); - Assert(display == COLOR || + lyx::Assert(display == COLOR || display == MONOCHROME || display == GRAYSCALE || display == NONE ); - Assert(widthResize == DEFAULT_SIZE || + lyx::Assert(widthResize == DEFAULT_SIZE || widthResize == CM || widthResize == INCH || widthResize == PERCENT_PAGE || widthResize == PERCENT_COLUMN ); - Assert(heightResize == DEFAULT_SIZE || + lyx::Assert(heightResize == DEFAULT_SIZE || heightResize == CM || heightResize == INCH || heightResize == PERCENT_PAGE ); - Assert(widthSize >= 0.0); - Assert(heightSize >= 0.0); + lyx::Assert(widthSize >= 0.0); + lyx::Assert(heightSize >= 0.0); // Angle is in degrees and ranges -360 < angle < 360 // The reason for this is that in latex there is a meaning for the // different angles and they are not necessarliy interchangeable, // it depends on the rotation origin. - Assert(rotateAngle < 360); - Assert(rotateAngle > -360); + lyx::Assert(rotateAngle < 360); + lyx::Assert(rotateAngle > -360); } diff --git a/src/insets/insetminipage.C b/src/insets/insetminipage.C index bb154b4251..d0d9ea1315 100644 --- a/src/insets/insetminipage.C +++ b/src/insets/insetminipage.C @@ -151,6 +151,7 @@ void InsetMinipage::Read(Buffer const * buf, LyXLex & lex) } #ifdef WITH_WARNINGS #warning Remove me before final 1.2.0 (Jug) +#warning Can we please remove this as soon as possible? (Lgb) #endif // this is only for compatibility to the intermediate format and should // vanish till the final 1.2.0! diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index c5521d3a27..9d82bafcc1 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -226,10 +226,10 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline, if (nodraw()) return; if (bv->text->status == LyXText::CHANGED_IN_DRAW) - return; + return; // lyxerr << "InsetTabular::draw(" << need_update << ")\n"; - + Painter & pain = bv->painter(); int i; int j; @@ -2315,6 +2315,7 @@ bool InsetTabular::nodraw() const return UpdatableInset::nodraw(); } + int InsetTabular::scroll(bool recursive) const { int sx = UpdatableInset::scroll(false); @@ -2325,6 +2326,7 @@ int InsetTabular::scroll(bool recursive) const return sx; } + bool InsetTabular::doClearArea() const { return !locked || (need_update & (FULL|INIT)); diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 2d19e5e4ea..6262480911 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -385,6 +385,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f, #ifdef WITH_WARNINGS #warning Jürgen, why is this a block of its own? (Lgb) #warning because you told me to define variables only in local context (Jug)! +#warning then make it a function/method of its own. (Lgb) #endif { int y = 0; @@ -1546,10 +1547,8 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool behind) bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y, int button) { - int dummyx, dummyy; - - dummyx = x = x - drawTextXOffset; - dummyy = y + insetAscent; + int dummyx = x = x - drawTextXOffset; + int dummyy = y + insetAscent; Inset * inset = bv->checkInsetHit(TEXT(bv), dummyx, dummyy, button); if (inset) { @@ -1864,6 +1863,7 @@ void InsetText::removeNewlines() } } + bool InsetText::nodraw() const { if (the_locking_inset) @@ -1871,6 +1871,7 @@ bool InsetText::nodraw() const return UpdatableInset::nodraw(); } + int InsetText::scroll(bool recursive) const { int sx = UpdatableInset::scroll(false); @@ -1881,6 +1882,7 @@ int InsetText::scroll(bool recursive) const return sx; } + bool InsetText::doClearArea() const { return !locked || (need_update & (FULL|INIT)); diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index daad04e8e4..74631128c9 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -239,7 +239,6 @@ public: return scx; return 0; } - protected: /// mutable int top_x; @@ -308,10 +307,8 @@ public: return b ? DISPATCHED : FINISHED; } - /// UpdatableInset() : cursor_visible_(false), block_drawing_(false) {} - /// virtual EDITABLE Editable() const; @@ -384,7 +381,6 @@ public: virtual bool nodraw() const { return block_drawing_; } - protected: /// void toggleCursorVisible() const { diff --git a/src/layout.C b/src/layout.C index 58fd7f1bb9..1c2069649f 100644 --- a/src/layout.C +++ b/src/layout.C @@ -1152,7 +1152,7 @@ void LyXTextClass::readClassOptions(LyXLex & lexrc) bool LyXTextClass::hasLayout(string const & name) const { return find_if(layoutlist.begin(), layoutlist.end(), - compare_memfun(&LyXLayout::name, name)) + lyx::compare_memfun(&LyXLayout::name, name)) != layoutlist.end(); } @@ -1162,8 +1162,8 @@ LyXLayout const & LyXTextClass::GetLayout (string const & name) const LayoutList::const_iterator cit = find_if(layoutlist.begin(), layoutlist.end(), - compare_memfun(&LyXLayout::name, name)); - Assert(cit != layoutlist.end()); // we require the name to exist + lyx::compare_memfun(&LyXLayout::name, name)); + lyx::Assert(cit != layoutlist.end()); // we require the name to exist return (*cit); } @@ -1173,8 +1173,8 @@ LyXLayout & LyXTextClass::GetLayout(string const & name) LayoutList::iterator it = find_if(layoutlist.begin(), layoutlist.end(), - compare_memfun(&LyXLayout::name, name)); - Assert(it != layoutlist.end()); // we require the name to exist + lyx::compare_memfun(&LyXLayout::name, name)); + lyx::Assert(it != layoutlist.end()); // we require the name to exist return (*it); } @@ -1183,7 +1183,7 @@ bool LyXTextClass::delete_layout(string const & name) { LayoutList::iterator it = remove_if(layoutlist.begin(), layoutlist.end(), - compare_memfun(&LyXLayout::name, name)); + lyx::compare_memfun(&LyXLayout::name, name)); LayoutList::iterator end = layoutlist.end(); bool const ret = (it != end); layoutlist.erase(it, end); @@ -1218,7 +1218,7 @@ LyXTextClassList::NumberOfClass(string const & textclass) const { ClassList::const_iterator cit = find_if(classlist.begin(), classlist.end(), - compare_memfun(&LyXTextClass::name, textclass)); + lyx::compare_memfun(&LyXTextClass::name, textclass)); return cit != classlist.end() ? make_pair(true, size_type(cit - classlist.begin())) : make_pair(false, size_type(0)); @@ -1274,7 +1274,7 @@ LyXTextClassList::NameOfClass(LyXTextClassList::size_type number) const if (classlist.size() == 0) { return dummy; } - Assert(number < classlist.size()); + lyx::Assert(number < classlist.size()); return classlist[number].name(); } @@ -1288,7 +1288,7 @@ LyXTextClassList::LatexnameOfClass(LyXTextClassList::size_type number) const if (classlist.size() == 0) { return dummy; } - Assert(number < classlist.size()); + lyx::Assert(number < classlist.size()); return classlist[number].latexname(); } @@ -1301,7 +1301,7 @@ LyXTextClassList::DescOfClass(LyXTextClassList::size_type number) const if (classlist.size() == 0) { return dummy; } - Assert(number < classlist.size()); + lyx::Assert(number < classlist.size()); return classlist[number].description(); } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 26cc837da1..222b805eef 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -747,7 +747,7 @@ string const LyXFunc::Dispatch(int ac, } } - Assert(action != LFUN_SELECT_FILE_SYNC); + lyx::Assert(action != LFUN_SELECT_FILE_SYNC); switch (action) { // --- Misc ------------------------------------------- @@ -813,7 +813,7 @@ string const LyXFunc::Dispatch(int ac, std::transform(lyxaction.func_begin(), lyxaction.func_end(), std::back_inserter(allCmds), lyx::firster()); static std::vector hist; - owner->getMiniBuffer()->getString(MiniBuffer::nospaces, + owner->getMiniBuffer()->getString(MiniBuffer::spaces, allCmds, hist); } break; diff --git a/src/lyxparagraph.h b/src/lyxparagraph.h index 1327116343..e8c42b1bd2 100644 --- a/src/lyxparagraph.h +++ b/src/lyxparagraph.h @@ -644,12 +644,19 @@ public: }; +inline +LyXParagraph::size_type LyXParagraph::size() const +{ + return text.size(); +} + + #ifdef NEW_INSETS inline LyXParagraph::value_type LyXParagraph::GetChar(LyXParagraph::size_type pos) const { - Assert(pos <= size()); + lyx::Assert(pos <= size()); // This is stronger, and I belive that this is the assertion // that we should really use. (Lgb) //Assert(pos < size()); @@ -675,6 +682,17 @@ void LyXParagraph::id(int id_arg) } +inline +LyXTextClass::size_type LyXParagraph::GetLayout() const +{ +#ifndef NEW_INSETS + return FirstPhysicalPar()->layout; +#else + return layout; +#endif +} + + inline bool LyXParagraph::IsFirstInSequence() const { @@ -692,13 +710,6 @@ Inset * LyXParagraph::InInset() } -inline -LyXParagraph::size_type LyXParagraph::size() const -{ - return text.size(); -} - - inline void LyXParagraph::clearContents() { @@ -734,17 +745,6 @@ void LyXParagraph::SetChar(size_type pos, value_type c) } -inline -LyXTextClass::size_type LyXParagraph::GetLayout() const -{ -#ifndef NEW_INSETS - return FirstPhysicalPar()->layout; -#else - return layout; -#endif -} - - inline LyXParagraph::inset_iterator LyXParagraph::inset_iterator_begin() { diff --git a/src/mathed/math_macrotable.C b/src/mathed/math_macrotable.C index 9312faa008..baaff99c75 100644 --- a/src/mathed/math_macrotable.C +++ b/src/mathed/math_macrotable.C @@ -42,7 +42,7 @@ MathMacroTable::getTemplate(string const & name) const void MathMacroTable::addTemplate(boost::shared_ptr const & m) { - Assert(m.get()); + lyx::Assert(m.get()); macro_table[m->GetName()] = m; } diff --git a/src/mathed/math_macrotemplate.C b/src/mathed/math_macrotemplate.C index 5276a16813..3a41679760 100644 --- a/src/mathed/math_macrotemplate.C +++ b/src/mathed/math_macrotemplate.C @@ -145,7 +145,7 @@ MathParInset * MathMacroTemplate::getMacroPar(int i) const if (i >= 0 && i < nargs_) { MathParInset * p = const_cast (static_cast(&args_[i])); - Assert(p); + lyx::Assert(p); return p; } else return 0; diff --git a/src/mathed/math_rowst.C b/src/mathed/math_rowst.C index 94a94c4da9..2a8d0439a9 100644 --- a/src/mathed/math_rowst.C +++ b/src/mathed/math_rowst.C @@ -100,19 +100,19 @@ bool MathedRowContainer::empty() const void MathedRowContainer::insert(iterator const & it) { - Assert(it.st_ == this); + lyx::Assert(it.st_ == this); data_.insert(data_.begin() + it.pos_, MathedRowStruct()); } void MathedRowContainer::erase(iterator & it) { - Assert(it.st_ == this); + lyx::Assert(it.st_ == this); data_.erase(data_.begin() + it.pos_); } MathedRowStruct & MathedRowContainer::back() { - Assert(data_.size()); + lyx::Assert(data_.size()); return data_.back(); } @@ -148,25 +148,25 @@ MathedRowContainer::iterator::operator void *() const MathedRowStruct * MathedRowContainer::iterator::operator->() { - Assert(st_); + lyx::Assert(st_); return &st_->data_[pos_]; } MathedRowStruct const * MathedRowContainer::iterator::operator->() const { - Assert(st_); + lyx::Assert(st_); return &st_->data_[pos_]; } void MathedRowContainer::iterator::operator++() { - Assert(st_); + lyx::Assert(st_); ++pos_; } bool MathedRowContainer::iterator::is_last() const { - Assert(st_); + lyx::Assert(st_); return pos_ == st_->size() - 1; } diff --git a/src/mathed/math_xiter.C b/src/mathed/math_xiter.C index 1569018de4..b21cd969bb 100644 --- a/src/mathed/math_xiter.C +++ b/src/mathed/math_xiter.C @@ -38,7 +38,7 @@ MathParInset * MathedXIter::getPar() const MathedRowContainer & MathedXIter::container() { - Assert(p_); + lyx::Assert(p_); return p_->getRowSt(); } diff --git a/src/paragraph.C b/src/paragraph.C index 5fe26c8dbf..f0c78a9611 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -524,7 +524,7 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos) return; } #else - Assert(pos < size()); + lyx::Assert(pos < size()); #endif #ifndef NEW_INSETS if (pos < size()) { // last is free for insertation, but should be empty @@ -618,7 +618,7 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos, return; } #else - Assert(pos <= size()); + lyx::Assert(pos <= size()); #endif text.insert(text.begin() + pos, c); @@ -653,7 +653,7 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos, void LyXParagraph::InsertInset(LyXParagraph::size_type pos, Inset * inset, LyXFont const & font) { - Assert(inset); + lyx::Assert(inset); #ifndef NEW_INSETS // > because last is the next unused position, and you can @@ -670,11 +670,11 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos, return; } #else - Assert(pos <= size()); + lyx::Assert(pos <= size()); #endif InsertChar(pos, META_INSET, font); - Assert(text[pos] == META_INSET); + lyx::Assert(text[pos] == META_INSET); // Add a new entry in the inset table. InsetTable search_inset(pos, 0); @@ -717,7 +717,7 @@ Inset * LyXParagraph::GetInset(LyXParagraph::size_type pos) return 0; } #else - Assert(pos < size()); + lyx::Assert(pos < size()); #endif // Find the inset. InsetTable search_inset(pos, 0); @@ -756,7 +756,7 @@ Inset const * LyXParagraph::GetInset(LyXParagraph::size_type pos) const return 0; } #else - Assert(pos < size()); + lyx::Assert(pos < size()); #endif // Find the inset. InsetTable search_inset(pos, 0); @@ -820,7 +820,7 @@ LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams, LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams, LyXParagraph::size_type pos) const { - Assert(pos <= size()); + lyx::Assert(pos <= size()); FontTable search_font(pos, LyXFont()); FontList::const_iterator cit = lower_bound(fontlist.begin(), fontlist.end(), @@ -941,7 +941,7 @@ LyXParagraph::HighestFontInRange(LyXParagraph::size_type startpos, LyXParagraph::value_type LyXParagraph::GetChar(LyXParagraph::size_type pos) const { - Assert(pos >= 0); + lyx::Assert(pos >= 0); if (pos < size()) { return text[pos]; @@ -958,7 +958,7 @@ LyXParagraph::GetChar(LyXParagraph::size_type pos) const "position does not exist." << pos << " (" << static_cast(pos) << ")\n"; - Assert(false); + lyx::Assert(false); } return '\0'; } else { @@ -991,7 +991,7 @@ LyXParagraph::GetChar(LyXParagraph::size_type pos) const //LyXParagraph::value_type //LyXParagraph::GetChar(LyXParagraph::size_type pos) const //{ -// Assert(pos <= size()); +// lyx::Assert(pos <= size()); // if (!size() || pos == size()) return '\0'; // // return text[pos]; @@ -1044,7 +1044,7 @@ LyXParagraph::GetUChar(BufferParams const & bparams, // return an string of the current word, and the end of the word in lastpos. string const LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const { - Assert(lastpos >= 0); + lyx::Assert(lastpos >= 0); // the current word is defined as starting at the first character // from the immediate left of lastpospos which meets the definition @@ -1160,7 +1160,7 @@ void LyXParagraph::SetFont(LyXParagraph::size_type pos, return; } #else - Assert(pos <= size()); + lyx::Assert(pos <= size()); #endif // First, reduce font against layout/label font diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 7c8c5dacca..392e5aff3c 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,10 @@ +2001-04-24 Lars Gullik Bjønnes + + * LAssert.h (Assert): put into namespace lyx + + * lyxfunctional.h: put into namespace lyx + * translator.h: adjust + 2001-04-17 Lars Gullik Bjønnes * lyxalgo.h: put into namespace lyx, add firster and copy_if diff --git a/src/support/LAssert.h b/src/support/LAssert.h index a62e16b343..d424d93063 100644 --- a/src/support/LAssert.h +++ b/src/support/LAssert.h @@ -4,12 +4,12 @@ #include "support/lyxlib.h" -//namespace LyX { +extern void emergencySave(); + +namespace lyx { #ifdef ENABLE_ASSERTIONS -extern void emergencySave(); - /** Live assertion. This is a debug tool to ensure that the assertion holds. If it don't hole we run #emergencySave()# and then #lyx::abort". @@ -36,5 +36,6 @@ void Assert(A /*assertion*/) {} #endif /* ENABLE_ASSERTIONS */ -//} // end of namespace LyX +} // end of namespace LyX + #endif /* LASSERT_H */ diff --git a/src/support/lstrings.C b/src/support/lstrings.C index b934e77e65..20c92ff16e 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -231,7 +231,7 @@ string const uppercase(string const & a) bool prefixIs(string const & a, char const * pre) { - Assert(pre); + lyx::Assert(pre); size_t const l = strlen(pre); string::size_type const alen = a.length(); @@ -279,7 +279,7 @@ bool suffixIs(string const & a, char c) bool suffixIs(string const & a, char const * suf) { - Assert(suf); + lyx::Assert(suf); size_t const suflen = strlen(suf); string::size_type const alen = a.length(); @@ -322,7 +322,7 @@ bool suffixIs(string const & a, string const & suf) bool contains(char const * a, string const & b) { - Assert(a); + lyx::Assert(a); string const at(a); return contains(at, b); } @@ -330,7 +330,7 @@ bool contains(char const * a, string const & b) bool contains(string const & a, char const * b) { - Assert(b); + lyx::Assert(b); string const bt(b); return contains(a, bt); } @@ -354,7 +354,7 @@ bool contains(string const & a, char b) bool contains(char const * a, char const * b) { - Assert(a && b); + lyx::Assert(a && b); string const at(a); string const bt(b); return contains(at, bt); @@ -363,7 +363,7 @@ bool contains(char const * a, char const * b) bool containsOnly(string const & s, char const * cset) { - Assert(cset); + lyx::Assert(cset); return s.find_first_not_of(cset) == string::npos; } @@ -377,7 +377,7 @@ bool containsOnly(string const & s, string const & cset) bool containsOnly(char const * s, char const * cset) { - Assert(s && cset); + lyx::Assert(s && cset); return string(s).find_first_not_of(cset) == string::npos; } @@ -385,7 +385,7 @@ bool containsOnly(char const * s, char const * cset) bool containsOnly(char const * s, string const & cset) { - Assert(s); + lyx::Assert(s); return string(s).find_first_not_of(cset) == string::npos; } @@ -475,7 +475,7 @@ string const subst(string const & a, char oldchar, char newchar) string const subst(string const & a, char const * oldstr, string const & newstr) { - Assert(oldstr); + lyx::Assert(oldstr); string lstr(a); string::size_type i = 0; @@ -527,7 +527,7 @@ string const strip(string const & a, char c) string const frontStrip(string const & a, char const * p) { - Assert(p); + lyx::Assert(p); if (a.empty() || !*p) return a; string tmp(a); diff --git a/src/support/lyxfunctional.h b/src/support/lyxfunctional.h index 55382cc081..94c8504418 100644 --- a/src/support/lyxfunctional.h +++ b/src/support/lyxfunctional.h @@ -12,7 +12,7 @@ #include -//namespace lyx { +namespace lyx { template @@ -251,6 +251,5 @@ private: T2 const & value_; }; - -// } // end of namespace lyx +} // end of namespace lyx #endif diff --git a/src/support/translator.h b/src/support/translator.h index ca9fe916e4..e6ed7cf00c 100644 --- a/src/support/translator.h +++ b/src/support/translator.h @@ -49,12 +49,12 @@ public: /// Find the mapping for the first argument T2 const & find(T1 const & first) const { - Assert(!map.empty()); + lyx::Assert(!map.empty()); // For explanation see the next find() function. Map::const_iterator it = std::find_if(map.begin(), map.end(), - equal_1st_in_pair(first) + lyx::equal_1st_in_pair(first) ); if (it != map.end()) { @@ -66,7 +66,7 @@ public: /// Find the mapping for the second argument T1 const & find(T2 const & second) const { - Assert(!map.empty()); + lyx::Assert(!map.empty()); // The idea is as follows: // find_if() will try to compare the data in the vector with @@ -81,7 +81,7 @@ public: // equal_to( select2nd(pair) , second) Map::const_iterator it = std::find_if(map.begin(), map.end(), - equal_2nd_in_pair(second) + lyx::equal_2nd_in_pair(second) ); if (it != map.end()) diff --git a/src/tabular.C b/src/tabular.C index bc3a9264a8..a3515f32a2 100644 --- a/src/tabular.C +++ b/src/tabular.C @@ -118,7 +118,7 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt) // If this and lt is not of the same size we have a serious bug // So then it is ok to throw an exception, or for now // call abort() - Assert(rows_ == lt.rows_ && columns_ == lt.columns_); + lyx::Assert(rows_ == lt.rows_ && columns_ == lt.columns_); cell_info = lt.cell_info; row_info = lt.row_info; @@ -156,7 +156,7 @@ LyXTabular * LyXTabular::Clone(InsetTabular * inset) } -/* activates all lines and sets all widths to 0 */ +/* activates all lines and sets all widths to 0 */ void LyXTabular::Init(int rows_arg, int columns_arg, LyXTabular const * lt) { rows_ = rows_arg; @@ -169,7 +169,7 @@ void LyXTabular::Init(int rows_arg, int columns_arg, LyXTabular const * lt) operator=(*lt); return; } - + int cellno = 0; for (int i = 0; i < rows_; ++i) { for (int j = 0; j < columns_; ++j) { @@ -480,7 +480,7 @@ int LyXTabular::GetAdditionalHeight(int row) const { if (!row || row >= rows_) return 0; - + bool top = true; bool bottom = true; diff --git a/src/tabular.h b/src/tabular.h index 8f4c08ec63..6abb179ce2 100644 --- a/src/tabular.h +++ b/src/tabular.h @@ -180,9 +180,10 @@ public: bool LeftAlreadyDrawed(int cell) const; /// bool IsLastRow(int cell) const; - + /// int GetAdditionalHeight(int row) const; + /// int GetAdditionalWidth(int cell) const; @@ -490,7 +491,7 @@ private: int endlastfoot; /// InsetTabular * owner_; - + /// void Init(int columns_arg, int rows_arg, LyXTabular const * lt = 0); /// diff --git a/src/text.C b/src/text.C index 0997ed241e..a62e653344 100644 --- a/src/text.C +++ b/src/text.C @@ -1665,7 +1665,8 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const row_ptr->baseline(maxasc + labeladdon); height += row_ptr->height(); - float x, dummy; + float x; + float dummy; PrepareToPrint(bview, row_ptr, x, dummy, dummy, dummy, false); row_ptr->width(int(maxwidth + x)); if (inset_owner) {