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
This commit is contained in:
Lars Gullik Bjønnes 2001-04-24 15:25:26 +00:00
parent 2a3b89c6f1
commit 47910a7a67
51 changed files with 239 additions and 182 deletions

View File

@ -985,7 +985,7 @@ bool BufferView::ChangeCitationsIfUnique(string const & from, string const & to)
vector<pair<string,string> > keys = buffer()->getBibkeyList(); vector<pair<string,string> > keys = buffer()->getBibkeyList();
if (count_if(keys.begin(), keys.end(), if (count_if(keys.begin(), keys.end(),
equal_1st_in_pair<string,string>(from)) lyx::equal_1st_in_pair<string,string>(from))
> 1) > 1)
return false; return false;

View File

@ -252,7 +252,7 @@ void BufferView::Pimpl::redraw()
bool BufferView::Pimpl::fitCursor(LyXText * text) bool BufferView::Pimpl::fitCursor(LyXText * text)
{ {
Assert(screen_.get()); lyx::Assert(screen_.get());
bool ret = screen_->FitCursor(text, bv_); bool ret = screen_->FitCursor(text, bv_);
if (ret) if (ret)
@ -1432,7 +1432,7 @@ Inset * BufferView::Pimpl::getInsetByCode(Inset::Code code)
find_if(Buffer::inset_iterator( find_if(Buffer::inset_iterator(
cursor.par(), cursor.pos()), cursor.par(), cursor.pos()),
buffer_->inset_iterator_end(), buffer_->inset_iterator_end(),
compare_memfun(&Inset::LyxCode, code) lyx::compare_memfun(&Inset::LyxCode, code)
); );
return it != buffer_->inset_iterator_end() ? (*it) : 0; return it != buffer_->inset_iterator_end() ? (*it) : 0;
} }

View File

@ -56,17 +56,17 @@ protected:
#ifdef ENABLE_ASSERTIONS #ifdef ENABLE_ASSERTIONS
/// ///
void testInvariant() const { void testInvariant() const {
Assert(font >= MIN); lyx::Assert(font >= MIN);
Assert(font < FONTMAX); lyx::Assert(font < FONTMAX);
Assert(character >= MIN); lyx::Assert(character >= MIN);
Assert(character < CHARMAX); lyx::Assert(character < CHARMAX);
Assert(size >= MIN); lyx::Assert(size >= MIN);
Assert(size < SIZEMAX); lyx::Assert(size < SIZEMAX);
Assert(user_text >= -1); lyx::Assert(user_text >= -1);
Assert(user_text <= 1); lyx::Assert(user_text <= 1);
// now some relational/operational tests // now some relational/operational tests
if (user_text == 1) { 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 // Assert(!text.empty()); // this isn't necessarily an error
} }
// else if (user_text == -1) { // else if (user_text == -1) {

View File

@ -1,3 +1,31 @@
2001-04-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
* 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 <jug@sad.it> 2001-04-18 Juergen Vigna <jug@sad.it>
* vspace.C (asLatexString): fixed the 100% problem. * vspace.C (asLatexString): fixed the 100% problem.

View File

@ -169,7 +169,7 @@ void LColor::setColor(LColor::color col, string const & x11name)
return; return;
} }
lyxerr << "LyX internal error: color and such.\n"; lyxerr << "LyX internal error: color and such.\n";
Assert(false); lyx::Assert(false);
} }

View File

@ -334,7 +334,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
bool Menu::hasSubmenu(string const & name) const bool Menu::hasSubmenu(string const & name) const
{ {
return find_if(begin(), end(), 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 bool MenuBackend::hasMenu(string const & name) const
{ {
return find_if(begin(), end(), 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 Menu const & MenuBackend::getMenu(string const & name) const
{ {
const_iterator cit = find_if(begin(), end(), const_iterator cit = find_if(begin(), end(),
compare_memfun(&Menu::name, name)); lyx::compare_memfun(&Menu::name, name));
Assert(cit != end()); lyx::Assert(cit != end());
return (*cit); return (*cit);
} }
Menu & MenuBackend::getMenu(string const & name) Menu & MenuBackend::getMenu(string const & name)
{ {
MenuList::iterator it = find_if(menulist_.begin(), menulist_.end(), MenuList::iterator it =
compare_memfun(&Menu::name, name)); find_if(menulist_.begin(), menulist_.end(),
Assert(it != menulist_.end()); lyx::compare_memfun(&Menu::name, name));
lyx::Assert(it != menulist_.end());
return (*it); return (*it);
} }

View File

@ -94,22 +94,23 @@ struct PrinterParams {
#ifdef ENABLE_ASSERTIONS #ifdef ENABLE_ASSERTIONS
if (!from_page.empty()) { if (!from_page.empty()) {
// Assert(from_page == number or empty) // Assert(from_page == number or empty)
Assert(containsOnly(from_page, "1234567890")); lyx::Assert(containsOnly(from_page,
"1234567890"));
} }
if (to_page) { if (to_page) {
// Assert(to_page == empty // Assert(to_page == empty
// or number iff from_page set) // or number iff from_page set)
Assert(!from_page.empty()); lyx::Assert(!from_page.empty());
} }
switch (target) { switch (target) {
case PRINTER: case PRINTER:
// Assert(!printer_name.empty()); // Assert(!printer_name.empty());
break; break;
case FILE: case FILE:
Assert(!file_name.empty()); lyx::Assert(!file_name.empty());
break; break;
default: default:
Assert(false); lyx::Assert(false);
break; break;
} }
switch (which_pages) { switch (which_pages) {
@ -118,7 +119,7 @@ struct PrinterParams {
case EVEN: case EVEN:
break; break;
default: default:
Assert(false); lyx::Assert(false);
break; break;
} }
#endif #endif

View File

@ -18,7 +18,7 @@ class UpdateInset {
public: public:
/// ///
void push(Inset * inset) { void push(Inset * inset) {
Assert(inset); lyx::Assert(inset);
insetqueue.push(inset); insetqueue.push(inset);
} }
/// ///

View File

@ -54,6 +54,7 @@ extern BufferView * current_view;
void BufferStorage::release(Buffer * buf) void BufferStorage::release(Buffer * buf)
{ {
lyx::Assert(buf);
Container::iterator it = find(container.begin(), container.end(), buf); Container::iterator it = find(container.begin(), container.end(), buf);
if (it != container.end()) { if (it != container.end()) {
// Make sure that we don't store a LyXText in // Make sure that we don't store a LyXText in
@ -168,6 +169,8 @@ void BufferList::resize()
bool BufferList::close(Buffer * buf) bool BufferList::close(Buffer * buf)
{ {
lyx::Assert(buf);
// CHECK // CHECK
// Trace back why we need to use buf->getUser here. // Trace back why we need to use buf->getUser here.
// Perhaps slight rewrite is in order? (Lgb) // Perhaps slight rewrite is in order? (Lgb)
@ -223,7 +226,7 @@ vector<string> const BufferList::getFileNames() const
{ {
vector<string> nvec; vector<string> nvec;
std::copy(bstore.begin(), bstore.end(), std::copy(bstore.begin(), bstore.end(),
back_inserter_fun(nvec, &Buffer::fileName)); lyx::back_inserter_fun(nvec, &Buffer::fileName));
return nvec; return nvec;
} }
@ -244,7 +247,9 @@ Buffer * BufferList::getBuffer(unsigned int choice)
int BufferList::unlockInset(UpdatableInset * inset) int BufferList::unlockInset(UpdatableInset * inset)
{ {
if (!inset) return 1; lyx::Assert(inset);
//if (!inset) return 1;
for (BufferStorage::iterator it = bstore.begin(); for (BufferStorage::iterator it = bstore.begin();
it != bstore.end(); ++it) { it != bstore.end(); ++it) {
if ((*it)->getUser() if ((*it)->getUser()
@ -276,12 +281,14 @@ void BufferList::updateIncludedTeXfiles(string const & mastertmpdir)
void BufferList::emergencyWriteAll() void BufferList::emergencyWriteAll()
{ {
for_each(bstore.begin(), bstore.end(), for_each(bstore.begin(), bstore.end(),
class_fun(*this, &BufferList::emergencyWrite)); lyx::class_fun(*this, &BufferList::emergencyWrite));
} }
void BufferList::emergencyWrite(Buffer * buf) void BufferList::emergencyWrite(Buffer * buf)
{ {
assert(buf); // use c assert to avoid a loop
// No need to save if the buffer has not changed. // No need to save if the buffer has not changed.
if (buf->isLyxClean()) return; if (buf->isLyxClean()) return;
@ -405,12 +412,15 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
bool BufferList::exists(string const & s) const bool BufferList::exists(string const & s) const
{ {
return find_if(bstore.begin(), bstore.end(), 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 bool BufferList::isLoaded(Buffer const * b) const
{ {
lyx::Assert(b);
BufferStorage::const_iterator cit = BufferStorage::const_iterator cit =
find(bstore.begin(), bstore.end(), b); find(bstore.begin(), bstore.end(), b);
return cit != bstore.end(); return cit != bstore.end();
@ -421,7 +431,7 @@ Buffer * BufferList::getBuffer(string const & s)
{ {
BufferStorage::iterator it = BufferStorage::iterator it =
find_if(bstore.begin(), bstore.end(), find_if(bstore.begin(), bstore.end(),
compare_memfun(&Buffer::fileName, s)); lyx::compare_memfun(&Buffer::fileName, s));
return it != bstore.end() ? (*it) : 0; return it != bstore.end() ? (*it) : 0;
} }

View File

@ -108,7 +108,7 @@ public:
Buffer * readFile(string const &, bool ro); Buffer * readFile(string const &, bool ro);
/// Make a new file (buffer) using a template /// 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 /// returns a vector with all the buffers filenames
std::vector<string> const getFileNames() const; std::vector<string> const getFileNames() const;

View File

@ -86,7 +86,7 @@ Format const * Formats::GetFormat(string const & name) const
{ {
FormatList::const_iterator cit = FormatList::const_iterator cit =
find_if(formatlist.begin(), formatlist.end(), find_if(formatlist.begin(), formatlist.end(),
compare_memfun(&Format::name, name)); lyx::compare_memfun(&Format::name, name));
if (cit != formatlist.end()) if (cit != formatlist.end())
return &(*cit); return &(*cit);
else else
@ -98,7 +98,7 @@ int Formats::GetNumber(string const & name) const
{ {
FormatList::const_iterator cit = FormatList::const_iterator cit =
find_if(formatlist.begin(), formatlist.end(), find_if(formatlist.begin(), formatlist.end(),
compare_memfun(&Format::name, name)); lyx::compare_memfun(&Format::name, name));
if (cit != formatlist.end()) if (cit != formatlist.end())
return cit - formatlist.begin(); return cit - formatlist.begin();
else else
@ -118,7 +118,7 @@ void Formats::Add(string const & name, string const & extension,
{ {
FormatList::iterator it = FormatList::iterator it =
find_if(formatlist.begin(), formatlist.end(), find_if(formatlist.begin(), formatlist.end(),
compare_memfun(&Format::name, name)); lyx::compare_memfun(&Format::name, name));
if (it == formatlist.end()) if (it == formatlist.end())
formatlist.push_back(Format(name, extension, prettyname, formatlist.push_back(Format(name, extension, prettyname,
shortcut, "")); shortcut, ""));
@ -133,7 +133,7 @@ void Formats::Delete(string const & name)
{ {
FormatList::iterator it = FormatList::iterator it =
find_if(formatlist.begin(), formatlist.end(), find_if(formatlist.begin(), formatlist.end(),
compare_memfun(&Format::name, name)); lyx::compare_memfun(&Format::name, name));
if (it != formatlist.end()) if (it != formatlist.end())
formatlist.erase(it); formatlist.erase(it);
} }
@ -150,7 +150,7 @@ void Formats::SetViewer(string const & name, string const & command)
Add(name); Add(name);
FormatList::iterator it = FormatList::iterator it =
find_if(formatlist.begin(), formatlist.end(), find_if(formatlist.begin(), formatlist.end(),
compare_memfun(&Format::name, name)); lyx::compare_memfun(&Format::name, name));
if (it != formatlist.end()) if (it != formatlist.end())
it->setViewer(command); it->setViewer(command);
} }

View File

@ -175,7 +175,7 @@ private:
inline void Dialogs::add(DialogBase * ptr) inline void Dialogs::add(DialogBase * ptr)
{ {
Assert(ptr); lyx::Assert(ptr);
dialogs_.push_back(db_ptr(ptr)); dialogs_.push_back(db_ptr(ptr));
} }

View File

@ -158,7 +158,7 @@ bool printBuffer(Buffer * buffer, PrinterParams const & pp)
void setMinibuffer(LyXView * lv, string const & msg) void setMinibuffer(LyXView * lv, string const & msg)
{ {
Assert(lv); lyx::Assert(lv);
lv->message(msg); lv->message(msg);
} }

View File

@ -189,7 +189,7 @@ void ControlInset<Inset, Params>::apply()
template <class Inset, class Params> template <class Inset, class Params>
Params & ControlInset<Inset, Params>::params() const Params & ControlInset<Inset, Params>::params() const
{ {
Assert(params_); lyx::Assert(params_);
return *params_; return *params_;
} }
@ -197,7 +197,7 @@ Params & ControlInset<Inset, Params>::params() const
template <class Inset, class Params> template <class Inset, class Params>
Inset * ControlInset<Inset, Params>::inset() const Inset * ControlInset<Inset, Params>::inset() const
{ {
Assert(inset_); lyx::Assert(inset_);
return inset_; return inset_;
} }

View File

@ -43,7 +43,7 @@ void ControlPreamble::apply()
string & ControlPreamble::params() const string & ControlPreamble::params() const
{ {
Assert(params_); lyx::Assert(params_);
return *params_; return *params_;
} }

View File

@ -57,7 +57,7 @@ void ControlPrint::apply()
PrinterParams & ControlPrint::params() const PrinterParams & ControlPrint::params() const
{ {
Assert(params_); lyx::Assert(params_);
return *params_; return *params_;
} }

View File

@ -67,7 +67,7 @@ vector<string> const getKeys(InfoMap const & map)
string const getInfo(InfoMap const & map, string const & key) string const getInfo(InfoMap const & map, string const & key)
{ {
Assert(!map.empty()); lyx::Assert(!map.empty());
string result; string result;

View File

@ -33,7 +33,7 @@ LyXImage::~LyXImage()
Pixmap Pixmap
LyXImage::getPixmap() const LyXImage::getPixmap() const
{ {
Assert(pixmapInitialized); lyx::Assert(pixmapInitialized);
return pixmap_; return pixmap_;
} }

View File

@ -101,7 +101,7 @@ namespace {
FormBase * GetForm(FL_OBJECT * ob) 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<FormBase *>(ob->form->u_vdata); FormBase * pre = static_cast<FormBase *>(ob->form->u_vdata);
return pre; return pre;
} }
@ -109,10 +109,11 @@ FormBase * GetForm(FL_OBJECT * ob)
} // namespace anon } // 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. // 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<FormBase *>(form->u_vdata); FormBase * pre = static_cast<FormBase *>(form->u_vdata);
pre->CancelButton(); pre->CancelButton();
return FL_CANCEL; return FL_CANCEL;

View File

@ -56,7 +56,7 @@ FormBaseDeprecated::FormBaseDeprecated(LyXView * lv, Dialogs * d,
string const & t) string const & t)
: lv_(lv), d_(d), h_(0), r_(0), title_(t), minw_(0), minh_(0) : 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 *) int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
{ {
Assert(form); lyx::Assert(form);
// Ensure that the signals (u and h) are disconnected even if the // Ensure that the signals (u and h) are disconnected even if the
// window manager is used to close the dialog. // window manager is used to close the dialog.
FormBaseDeprecated * pre = FormBaseDeprecated * pre =
static_cast<FormBaseDeprecated*>(form->u_vdata); static_cast<FormBaseDeprecated*>(form->u_vdata);
Assert(pre); lyx::Assert(pre);
pre->hide(); pre->hide();
pre->bc().hide(); pre->bc().hide();
return FL_CANCEL; return FL_CANCEL;
@ -147,10 +147,10 @@ int FormBaseDeprecated::WMHideCB(FL_FORM * form, void *)
void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long) void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
{ {
Assert(ob && ob->form); lyx::Assert(ob && ob->form);
FormBaseDeprecated * pre = FormBaseDeprecated * pre =
static_cast<FormBaseDeprecated*>(ob->form->u_vdata); static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
Assert(pre); lyx::Assert(pre);
pre->apply(); pre->apply();
pre->bc().apply(); pre->bc().apply();
} }
@ -158,10 +158,10 @@ void FormBaseDeprecated::ApplyCB(FL_OBJECT * ob, long)
void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long) void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
{ {
Assert(ob && ob->form); lyx::Assert(ob && ob->form);
FormBaseDeprecated * pre = FormBaseDeprecated * pre =
static_cast<FormBaseDeprecated*>(ob->form->u_vdata); static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
Assert(pre); lyx::Assert(pre);
pre->ok(); pre->ok();
pre->bc().ok(); pre->bc().ok();
} }
@ -169,10 +169,10 @@ void FormBaseDeprecated::OKCB(FL_OBJECT * ob, long)
void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long) void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
{ {
Assert(ob && ob->form); lyx::Assert(ob && ob->form);
FormBaseDeprecated * pre = FormBaseDeprecated * pre =
static_cast<FormBaseDeprecated*>(ob->form->u_vdata); static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
Assert(pre); lyx::Assert(pre);
pre->cancel(); pre->cancel();
pre->bc().cancel(); pre->bc().cancel();
} }
@ -180,20 +180,20 @@ void FormBaseDeprecated::CancelCB(FL_OBJECT * ob, long)
void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data) void FormBaseDeprecated::InputCB(FL_OBJECT * ob, long data)
{ {
Assert(ob && ob->form); lyx::Assert(ob && ob->form);
FormBaseDeprecated * pre = FormBaseDeprecated * pre =
static_cast<FormBaseDeprecated*>(ob->form->u_vdata); static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
Assert(pre); lyx::Assert(pre);
pre->bc().valid(pre->input(ob, data)); pre->bc().valid(pre->input(ob, data));
} }
void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long) void FormBaseDeprecated::RestoreCB(FL_OBJECT * ob, long)
{ {
Assert(ob && ob->form); lyx::Assert(ob && ob->form);
FormBaseDeprecated * pre = FormBaseDeprecated * pre =
static_cast<FormBaseDeprecated*>(ob->form->u_vdata); static_cast<FormBaseDeprecated*>(ob->form->u_vdata);
Assert(pre); lyx::Assert(pre);
pre->bc().restore(); pre->bc().restore();
pre->restore(); pre->restore();
} }

View File

@ -55,7 +55,7 @@ FL_FORM * FormMathsBitmap::form() const
void FormMathsBitmap::build() void FormMathsBitmap::build()
{ {
Assert(bitmaps_.size() > 0); lyx::Assert(bitmaps_.size() > 0);
h_+= 50; // Allow room for a Close button h_+= 50; // Allow room for a Close button

View File

@ -25,12 +25,13 @@
static char h_align_str[80] = "c"; static char h_align_str[80] = "c";
static char v_align_c[] = "tcb"; 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) char const * cur, int c)
{ {
Assert(ob); lyx::Assert(ob);
FormMathsMatrix * pre = static_cast<FormMathsMatrix *>(ob->u_vdata); FormMathsMatrix * pre = static_cast<FormMathsMatrix *>(ob->u_vdata);
Assert(pre); lyx::Assert(pre);
return pre->AlignFilter(cur, c); return pre->AlignFilter(cur, c);
} }

View File

@ -296,7 +296,7 @@ void FormPreferences::apply()
void FormPreferences::feedback(FL_OBJECT * ob) void FormPreferences::feedback(FL_OBJECT * ob)
{ {
Assert(ob); lyx::Assert(ob);
string str; string str;
@ -335,7 +335,7 @@ void FormPreferences::feedback(FL_OBJECT * ob)
bool FormPreferences::input(FL_OBJECT * ob, long) bool FormPreferences::input(FL_OBJECT * ob, long)
{ {
Assert(ob); lyx::Assert(ob);
// whatever checks you need to ensure the user hasn't entered // whatever checks you need to ensure the user hasn't entered
// some totally ridiculous value somewhere. Change activate to suit. // 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. // Note that the return value is important in the pre-emptive handler.
// Don't return anything other than 0. // 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 // Don't Assert this one, as it can happen quite reasonably when things
// are being deleted in the d-tor. // are being deleted in the d-tor.
//Assert(ob->form); //Assert(ob->form);
@ -3016,7 +3016,7 @@ int FormPreferences::FeedbackCB(FL_OBJECT * ob, int event,
// preemptive handler for feedback messages // preemptive handler for feedback messages
void FormPreferences::Feedback(FL_OBJECT * ob, int event) void FormPreferences::Feedback(FL_OBJECT * ob, int event)
{ {
Assert(ob); lyx::Assert(ob);
switch (event) { switch (event) {
case FL_ENTER: case FL_ENTER:
@ -3037,6 +3037,6 @@ void FormPreferences::Feedback(FL_OBJECT * ob, int event)
void FormPreferences::setPreHandler(FL_OBJECT * ob) void FormPreferences::setPreHandler(FL_OBJECT * ob)
{ {
Assert(ob); lyx::Assert(ob);
fl_set_object_prehandler(ob, C_FormPreferencesFeedbackCB); fl_set_object_prehandler(ob, C_FormPreferencesFeedbackCB);
} }

View File

@ -21,18 +21,20 @@
#include "form_splash.h" #include "form_splash.h"
#include "support/LAssert.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<FormSplash *>(form->u_vdata); FormSplash * pre = static_cast<FormSplash *>(form->u_vdata);
pre->Hide(); pre->Hide();
return FL_CANCEL; 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<FormSplash*>(ob->form->u_vdata); FormSplash * pre = static_cast<FormSplash*>(ob->form->u_vdata);
pre->Hide(); pre->Hide();
} }

View File

@ -602,7 +602,7 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
} }
// Paranoia check // Paranoia check
Assert(item->kind() == MenuItem::Submenu); lyx::Assert(item->kind() == MenuItem::Submenu);
// set tabstop length // set tabstop length
fl_set_tabstop(menu_tabstop); fl_set_tabstop(menu_tabstop);

View File

@ -73,11 +73,12 @@ GraphicsCacheItem::imageConverted(int retval)
namespace { namespace {
string const findTargetFormat(string const & from) string const findTargetFormat(string const & from)
{ {
typedef ImageLoader::FormatList FormatList; typedef ImageLoader::FormatList FormatList;
FormatList formats = ImageLoaderXPM().loadableFormats(); 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 iter = formats.begin();
FormatList::const_iterator end = formats.end(); FormatList::const_iterator end = formats.end();

View File

@ -86,7 +86,7 @@ ImageLoaderXPM::runImageLoader(string const & filename)
} }
// This should have been set by the XpmReadFileToPixmap call! // 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)); setImage(new LyXImage(pixmap, attrib.width, attrib.height));

View File

@ -256,7 +256,7 @@ void ExternalTemplate::readTemplate(LyXLex & lex)
default: default:
lex.printError("ExternalTemplate::readTemplate: " lex.printError("ExternalTemplate::readTemplate: "
"Wrong tag: $$Token"); "Wrong tag: $$Token");
Assert(false); lyx::Assert(false);
break; break;
} }
} }

View File

@ -181,7 +181,7 @@ void UpdatableInset::scroll(BufferView * bv, float s) const
scx += (workW / 2) - (tmp_top_x + scx + width(bv, font)); scx += (workW / 2) - (tmp_top_x + scx + width(bv, font));
} }
// bv->updateInset(const_cast<UpdatableInset *>(this), false); // bv->updateInset(const_cast<UpdatableInset *>(this), false);
} }
void UpdatableInset::scroll(BufferView * bv, int offset) const void UpdatableInset::scroll(BufferView * bv, int offset) const

View File

@ -196,6 +196,7 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
if (!owner()) if (!owner())
x += static_cast<float>(scroll()); x += static_cast<float>(scroll());
#endif #endif
if (!cleared && (inset.need_update == InsetText::FULL || if (!cleared && (inset.need_update == InsetText::FULL ||
inset.need_update == InsetText::INIT || inset.need_update == InsetText::INIT ||
top_x != int(x) || top_x != int(x) ||
@ -402,7 +403,7 @@ bool InsetCollapsable::UnlockInsetInInset(BufferView * bv, UpdatableInset * in,
bv->unlockInset(this); bv->unlockInset(this);
return true; return true;
} }
bool ret = inset.UnlockInsetInInset(bv, in, lr); bool const ret = inset.UnlockInsetInInset(bv, in, lr);
return ret; return ret;
} }
@ -500,6 +501,7 @@ bool InsetCollapsable::nodraw() const
return inset.nodraw(); return inset.nodraw();
} }
int InsetCollapsable::scroll(bool recursive) const int InsetCollapsable::scroll(bool recursive) const
{ {
int sx = UpdatableInset::scroll(false); int sx = UpdatableInset::scroll(false);

View File

@ -146,34 +146,34 @@ void InsetGraphicsParams::testInvariant() const
// Filename might be empty (when the dialog is first created). // Filename might be empty (when the dialog is first created).
// Assert(!filename.empty()); // Assert(!filename.empty());
Assert(display == COLOR || lyx::Assert(display == COLOR ||
display == MONOCHROME || display == MONOCHROME ||
display == GRAYSCALE || display == GRAYSCALE ||
display == NONE display == NONE
); );
Assert(widthResize == DEFAULT_SIZE || lyx::Assert(widthResize == DEFAULT_SIZE ||
widthResize == CM || widthResize == CM ||
widthResize == INCH || widthResize == INCH ||
widthResize == PERCENT_PAGE || widthResize == PERCENT_PAGE ||
widthResize == PERCENT_COLUMN widthResize == PERCENT_COLUMN
); );
Assert(heightResize == DEFAULT_SIZE || lyx::Assert(heightResize == DEFAULT_SIZE ||
heightResize == CM || heightResize == CM ||
heightResize == INCH || heightResize == INCH ||
heightResize == PERCENT_PAGE heightResize == PERCENT_PAGE
); );
Assert(widthSize >= 0.0); lyx::Assert(widthSize >= 0.0);
Assert(heightSize >= 0.0); lyx::Assert(heightSize >= 0.0);
// Angle is in degrees and ranges -360 < angle < 360 // Angle is in degrees and ranges -360 < angle < 360
// The reason for this is that in latex there is a meaning for the // The reason for this is that in latex there is a meaning for the
// different angles and they are not necessarliy interchangeable, // different angles and they are not necessarliy interchangeable,
// it depends on the rotation origin. // it depends on the rotation origin.
Assert(rotateAngle < 360); lyx::Assert(rotateAngle < 360);
Assert(rotateAngle > -360); lyx::Assert(rotateAngle > -360);
} }

View File

@ -151,6 +151,7 @@ void InsetMinipage::Read(Buffer const * buf, LyXLex & lex)
} }
#ifdef WITH_WARNINGS #ifdef WITH_WARNINGS
#warning Remove me before final 1.2.0 (Jug) #warning Remove me before final 1.2.0 (Jug)
#warning Can we please remove this as soon as possible? (Lgb)
#endif #endif
// this is only for compatibility to the intermediate format and should // this is only for compatibility to the intermediate format and should
// vanish till the final 1.2.0! // vanish till the final 1.2.0!

View File

@ -2315,6 +2315,7 @@ bool InsetTabular::nodraw() const
return UpdatableInset::nodraw(); return UpdatableInset::nodraw();
} }
int InsetTabular::scroll(bool recursive) const int InsetTabular::scroll(bool recursive) const
{ {
int sx = UpdatableInset::scroll(false); int sx = UpdatableInset::scroll(false);
@ -2325,6 +2326,7 @@ int InsetTabular::scroll(bool recursive) const
return sx; return sx;
} }
bool InsetTabular::doClearArea() const bool InsetTabular::doClearArea() const
{ {
return !locked || (need_update & (FULL|INIT)); return !locked || (need_update & (FULL|INIT));

View File

@ -385,6 +385,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
#ifdef WITH_WARNINGS #ifdef WITH_WARNINGS
#warning Jürgen, why is this a block of its own? (Lgb) #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 because you told me to define variables only in local context (Jug)!
#warning then make it a function/method of its own. (Lgb)
#endif #endif
{ {
int y = 0; int y = 0;
@ -1546,10 +1547,8 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool behind)
bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y, bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
int button) int button)
{ {
int dummyx, dummyy; int dummyx = x = x - drawTextXOffset;
int dummyy = y + insetAscent;
dummyx = x = x - drawTextXOffset;
dummyy = y + insetAscent;
Inset * inset = bv->checkInsetHit(TEXT(bv), dummyx, dummyy, button); Inset * inset = bv->checkInsetHit(TEXT(bv), dummyx, dummyy, button);
if (inset) { if (inset) {
@ -1864,6 +1863,7 @@ void InsetText::removeNewlines()
} }
} }
bool InsetText::nodraw() const bool InsetText::nodraw() const
{ {
if (the_locking_inset) if (the_locking_inset)
@ -1871,6 +1871,7 @@ bool InsetText::nodraw() const
return UpdatableInset::nodraw(); return UpdatableInset::nodraw();
} }
int InsetText::scroll(bool recursive) const int InsetText::scroll(bool recursive) const
{ {
int sx = UpdatableInset::scroll(false); int sx = UpdatableInset::scroll(false);
@ -1881,6 +1882,7 @@ int InsetText::scroll(bool recursive) const
return sx; return sx;
} }
bool InsetText::doClearArea() const bool InsetText::doClearArea() const
{ {
return !locked || (need_update & (FULL|INIT)); return !locked || (need_update & (FULL|INIT));

View File

@ -239,7 +239,6 @@ public:
return scx; return scx;
return 0; return 0;
} }
protected: protected:
/// ///
mutable int top_x; mutable int top_x;
@ -308,10 +307,8 @@ public:
return b ? DISPATCHED : FINISHED; return b ? DISPATCHED : FINISHED;
} }
/// ///
UpdatableInset() : cursor_visible_(false), block_drawing_(false) {} UpdatableInset() : cursor_visible_(false), block_drawing_(false) {}
/// ///
virtual EDITABLE Editable() const; virtual EDITABLE Editable() const;
@ -384,7 +381,6 @@ public:
virtual bool nodraw() const { virtual bool nodraw() const {
return block_drawing_; return block_drawing_;
} }
protected: protected:
/// ///
void toggleCursorVisible() const { void toggleCursorVisible() const {

View File

@ -1152,7 +1152,7 @@ void LyXTextClass::readClassOptions(LyXLex & lexrc)
bool LyXTextClass::hasLayout(string const & name) const bool LyXTextClass::hasLayout(string const & name) const
{ {
return find_if(layoutlist.begin(), layoutlist.end(), return find_if(layoutlist.begin(), layoutlist.end(),
compare_memfun(&LyXLayout::name, name)) lyx::compare_memfun(&LyXLayout::name, name))
!= layoutlist.end(); != layoutlist.end();
} }
@ -1162,8 +1162,8 @@ LyXLayout const & LyXTextClass::GetLayout (string const & name) const
LayoutList::const_iterator cit = LayoutList::const_iterator cit =
find_if(layoutlist.begin(), find_if(layoutlist.begin(),
layoutlist.end(), layoutlist.end(),
compare_memfun(&LyXLayout::name, name)); lyx::compare_memfun(&LyXLayout::name, name));
Assert(cit != layoutlist.end()); // we require the name to exist lyx::Assert(cit != layoutlist.end()); // we require the name to exist
return (*cit); return (*cit);
} }
@ -1173,8 +1173,8 @@ LyXLayout & LyXTextClass::GetLayout(string const & name)
LayoutList::iterator it = LayoutList::iterator it =
find_if(layoutlist.begin(), find_if(layoutlist.begin(),
layoutlist.end(), layoutlist.end(),
compare_memfun(&LyXLayout::name, name)); lyx::compare_memfun(&LyXLayout::name, name));
Assert(it != layoutlist.end()); // we require the name to exist lyx::Assert(it != layoutlist.end()); // we require the name to exist
return (*it); return (*it);
} }
@ -1183,7 +1183,7 @@ bool LyXTextClass::delete_layout(string const & name)
{ {
LayoutList::iterator it = LayoutList::iterator it =
remove_if(layoutlist.begin(), layoutlist.end(), remove_if(layoutlist.begin(), layoutlist.end(),
compare_memfun(&LyXLayout::name, name)); lyx::compare_memfun(&LyXLayout::name, name));
LayoutList::iterator end = layoutlist.end(); LayoutList::iterator end = layoutlist.end();
bool const ret = (it != end); bool const ret = (it != end);
layoutlist.erase(it, end); layoutlist.erase(it, end);
@ -1218,7 +1218,7 @@ LyXTextClassList::NumberOfClass(string const & textclass) const
{ {
ClassList::const_iterator cit = ClassList::const_iterator cit =
find_if(classlist.begin(), classlist.end(), find_if(classlist.begin(), classlist.end(),
compare_memfun(&LyXTextClass::name, textclass)); lyx::compare_memfun(&LyXTextClass::name, textclass));
return cit != classlist.end() ? return cit != classlist.end() ?
make_pair(true, size_type(cit - classlist.begin())) : make_pair(true, size_type(cit - classlist.begin())) :
make_pair(false, size_type(0)); make_pair(false, size_type(0));
@ -1274,7 +1274,7 @@ LyXTextClassList::NameOfClass(LyXTextClassList::size_type number) const
if (classlist.size() == 0) { if (classlist.size() == 0) {
return dummy; return dummy;
} }
Assert(number < classlist.size()); lyx::Assert(number < classlist.size());
return classlist[number].name(); return classlist[number].name();
} }
@ -1288,7 +1288,7 @@ LyXTextClassList::LatexnameOfClass(LyXTextClassList::size_type number) const
if (classlist.size() == 0) { if (classlist.size() == 0) {
return dummy; return dummy;
} }
Assert(number < classlist.size()); lyx::Assert(number < classlist.size());
return classlist[number].latexname(); return classlist[number].latexname();
} }
@ -1301,7 +1301,7 @@ LyXTextClassList::DescOfClass(LyXTextClassList::size_type number) const
if (classlist.size() == 0) { if (classlist.size() == 0) {
return dummy; return dummy;
} }
Assert(number < classlist.size()); lyx::Assert(number < classlist.size());
return classlist[number].description(); return classlist[number].description();
} }

View File

@ -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) { switch (action) {
// --- Misc ------------------------------------------- // --- Misc -------------------------------------------
@ -813,7 +813,7 @@ string const LyXFunc::Dispatch(int ac,
std::transform(lyxaction.func_begin(), lyxaction.func_end(), std::transform(lyxaction.func_begin(), lyxaction.func_end(),
std::back_inserter(allCmds), lyx::firster()); std::back_inserter(allCmds), lyx::firster());
static std::vector<string> hist; static std::vector<string> hist;
owner->getMiniBuffer()->getString(MiniBuffer::nospaces, owner->getMiniBuffer()->getString(MiniBuffer::spaces,
allCmds, hist); allCmds, hist);
} }
break; break;

View File

@ -644,12 +644,19 @@ public:
}; };
inline
LyXParagraph::size_type LyXParagraph::size() const
{
return text.size();
}
#ifdef NEW_INSETS #ifdef NEW_INSETS
inline inline
LyXParagraph::value_type LyXParagraph::value_type
LyXParagraph::GetChar(LyXParagraph::size_type pos) const 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 // This is stronger, and I belive that this is the assertion
// that we should really use. (Lgb) // that we should really use. (Lgb)
//Assert(pos < size()); //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 inline
bool LyXParagraph::IsFirstInSequence() const bool LyXParagraph::IsFirstInSequence() const
{ {
@ -692,13 +710,6 @@ Inset * LyXParagraph::InInset()
} }
inline
LyXParagraph::size_type LyXParagraph::size() const
{
return text.size();
}
inline inline
void LyXParagraph::clearContents() 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 inline
LyXParagraph::inset_iterator LyXParagraph::inset_iterator_begin() LyXParagraph::inset_iterator LyXParagraph::inset_iterator_begin()
{ {

View File

@ -42,7 +42,7 @@ MathMacroTable::getTemplate(string const & name) const
void void
MathMacroTable::addTemplate(boost::shared_ptr<MathMacroTemplate> const & m) MathMacroTable::addTemplate(boost::shared_ptr<MathMacroTemplate> const & m)
{ {
Assert(m.get()); lyx::Assert(m.get());
macro_table[m->GetName()] = m; macro_table[m->GetName()] = m;
} }

View File

@ -145,7 +145,7 @@ MathParInset * MathMacroTemplate::getMacroPar(int i) const
if (i >= 0 && i < nargs_) { if (i >= 0 && i < nargs_) {
MathParInset * p = const_cast<MathParInset *> MathParInset * p = const_cast<MathParInset *>
(static_cast<MathParInset const *>(&args_[i])); (static_cast<MathParInset const *>(&args_[i]));
Assert(p); lyx::Assert(p);
return p; return p;
} else } else
return 0; return 0;

View File

@ -100,19 +100,19 @@ bool MathedRowContainer::empty() const
void MathedRowContainer::insert(iterator const & it) void MathedRowContainer::insert(iterator const & it)
{ {
Assert(it.st_ == this); lyx::Assert(it.st_ == this);
data_.insert(data_.begin() + it.pos_, MathedRowStruct()); data_.insert(data_.begin() + it.pos_, MathedRowStruct());
} }
void MathedRowContainer::erase(iterator & it) void MathedRowContainer::erase(iterator & it)
{ {
Assert(it.st_ == this); lyx::Assert(it.st_ == this);
data_.erase(data_.begin() + it.pos_); data_.erase(data_.begin() + it.pos_);
} }
MathedRowStruct & MathedRowContainer::back() MathedRowStruct & MathedRowContainer::back()
{ {
Assert(data_.size()); lyx::Assert(data_.size());
return data_.back(); return data_.back();
} }
@ -148,25 +148,25 @@ MathedRowContainer::iterator::operator void *() const
MathedRowStruct * MathedRowContainer::iterator::operator->() MathedRowStruct * MathedRowContainer::iterator::operator->()
{ {
Assert(st_); lyx::Assert(st_);
return &st_->data_[pos_]; return &st_->data_[pos_];
} }
MathedRowStruct const * MathedRowContainer::iterator::operator->() const MathedRowStruct const * MathedRowContainer::iterator::operator->() const
{ {
Assert(st_); lyx::Assert(st_);
return &st_->data_[pos_]; return &st_->data_[pos_];
} }
void MathedRowContainer::iterator::operator++() void MathedRowContainer::iterator::operator++()
{ {
Assert(st_); lyx::Assert(st_);
++pos_; ++pos_;
} }
bool MathedRowContainer::iterator::is_last() const bool MathedRowContainer::iterator::is_last() const
{ {
Assert(st_); lyx::Assert(st_);
return pos_ == st_->size() - 1; return pos_ == st_->size() - 1;
} }

View File

@ -38,7 +38,7 @@ MathParInset * MathedXIter::getPar() const
MathedRowContainer & MathedXIter::container() MathedRowContainer & MathedXIter::container()
{ {
Assert(p_); lyx::Assert(p_);
return p_->getRowSt(); return p_->getRowSt();
} }

View File

@ -524,7 +524,7 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
return; return;
} }
#else #else
Assert(pos < size()); lyx::Assert(pos < size());
#endif #endif
#ifndef NEW_INSETS #ifndef NEW_INSETS
if (pos < size()) { // last is free for insertation, but should be empty if (pos < size()) { // last is free for insertation, but should be empty
@ -618,7 +618,7 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos,
return; return;
} }
#else #else
Assert(pos <= size()); lyx::Assert(pos <= size());
#endif #endif
text.insert(text.begin() + pos, c); text.insert(text.begin() + pos, c);
@ -653,7 +653,7 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
void LyXParagraph::InsertInset(LyXParagraph::size_type pos, void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
Inset * inset, LyXFont const & font) Inset * inset, LyXFont const & font)
{ {
Assert(inset); lyx::Assert(inset);
#ifndef NEW_INSETS #ifndef NEW_INSETS
// > because last is the next unused position, and you can // > because last is the next unused position, and you can
@ -670,11 +670,11 @@ void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
return; return;
} }
#else #else
Assert(pos <= size()); lyx::Assert(pos <= size());
#endif #endif
InsertChar(pos, META_INSET, font); InsertChar(pos, META_INSET, font);
Assert(text[pos] == META_INSET); lyx::Assert(text[pos] == META_INSET);
// Add a new entry in the inset table. // Add a new entry in the inset table.
InsetTable search_inset(pos, 0); InsetTable search_inset(pos, 0);
@ -717,7 +717,7 @@ Inset * LyXParagraph::GetInset(LyXParagraph::size_type pos)
return 0; return 0;
} }
#else #else
Assert(pos < size()); lyx::Assert(pos < size());
#endif #endif
// Find the inset. // Find the inset.
InsetTable search_inset(pos, 0); InsetTable search_inset(pos, 0);
@ -756,7 +756,7 @@ Inset const * LyXParagraph::GetInset(LyXParagraph::size_type pos) const
return 0; return 0;
} }
#else #else
Assert(pos < size()); lyx::Assert(pos < size());
#endif #endif
// Find the inset. // Find the inset.
InsetTable search_inset(pos, 0); InsetTable search_inset(pos, 0);
@ -820,7 +820,7 @@ LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams,
LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams, LyXFont const LyXParagraph::GetFontSettings(BufferParams const & bparams,
LyXParagraph::size_type pos) const LyXParagraph::size_type pos) const
{ {
Assert(pos <= size()); lyx::Assert(pos <= size());
FontTable search_font(pos, LyXFont()); FontTable search_font(pos, LyXFont());
FontList::const_iterator cit = lower_bound(fontlist.begin(), FontList::const_iterator cit = lower_bound(fontlist.begin(),
fontlist.end(), fontlist.end(),
@ -941,7 +941,7 @@ LyXParagraph::HighestFontInRange(LyXParagraph::size_type startpos,
LyXParagraph::value_type LyXParagraph::value_type
LyXParagraph::GetChar(LyXParagraph::size_type pos) const LyXParagraph::GetChar(LyXParagraph::size_type pos) const
{ {
Assert(pos >= 0); lyx::Assert(pos >= 0);
if (pos < size()) { if (pos < size()) {
return text[pos]; return text[pos];
@ -958,7 +958,7 @@ LyXParagraph::GetChar(LyXParagraph::size_type pos) const
"position does not exist." "position does not exist."
<< pos << " (" << static_cast<int>(pos) << pos << " (" << static_cast<int>(pos)
<< ")\n"; << ")\n";
Assert(false); lyx::Assert(false);
} }
return '\0'; return '\0';
} else { } else {
@ -991,7 +991,7 @@ LyXParagraph::GetChar(LyXParagraph::size_type pos) const
//LyXParagraph::value_type //LyXParagraph::value_type
//LyXParagraph::GetChar(LyXParagraph::size_type pos) const //LyXParagraph::GetChar(LyXParagraph::size_type pos) const
//{ //{
// Assert(pos <= size()); // lyx::Assert(pos <= size());
// if (!size() || pos == size()) return '\0'; // if (!size() || pos == size()) return '\0';
// //
// return text[pos]; // 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. // return an string of the current word, and the end of the word in lastpos.
string const LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const 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 // the current word is defined as starting at the first character
// from the immediate left of lastpospos which meets the definition // from the immediate left of lastpospos which meets the definition
@ -1160,7 +1160,7 @@ void LyXParagraph::SetFont(LyXParagraph::size_type pos,
return; return;
} }
#else #else
Assert(pos <= size()); lyx::Assert(pos <= size());
#endif #endif
// First, reduce font against layout/label font // First, reduce font against layout/label font

View File

@ -1,3 +1,10 @@
2001-04-24 Lars Gullik Bjønnes <larsbj@birdstep.com>
* LAssert.h (Assert): put into namespace lyx
* lyxfunctional.h: put into namespace lyx
* translator.h: adjust
2001-04-17 Lars Gullik Bjønnes <larsbj@birdstep.com> 2001-04-17 Lars Gullik Bjønnes <larsbj@birdstep.com>
* lyxalgo.h: put into namespace lyx, add firster and copy_if * lyxalgo.h: put into namespace lyx, add firster and copy_if

View File

@ -4,12 +4,12 @@
#include "support/lyxlib.h" #include "support/lyxlib.h"
//namespace LyX { extern void emergencySave();
namespace lyx {
#ifdef ENABLE_ASSERTIONS #ifdef ENABLE_ASSERTIONS
extern void emergencySave();
/** Live assertion. /** Live assertion.
This is a debug tool to ensure that the assertion holds. If it don't hole This is a debug tool to ensure that the assertion holds. If it don't hole
we run #emergencySave()# and then #lyx::abort". we run #emergencySave()# and then #lyx::abort".
@ -36,5 +36,6 @@ void Assert(A /*assertion*/) {}
#endif /* ENABLE_ASSERTIONS */ #endif /* ENABLE_ASSERTIONS */
//} // end of namespace LyX } // end of namespace LyX
#endif /* LASSERT_H */ #endif /* LASSERT_H */

View File

@ -231,7 +231,7 @@ string const uppercase(string const & a)
bool prefixIs(string const & a, char const * pre) bool prefixIs(string const & a, char const * pre)
{ {
Assert(pre); lyx::Assert(pre);
size_t const l = strlen(pre); size_t const l = strlen(pre);
string::size_type const alen = a.length(); 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) bool suffixIs(string const & a, char const * suf)
{ {
Assert(suf); lyx::Assert(suf);
size_t const suflen = strlen(suf); size_t const suflen = strlen(suf);
string::size_type const alen = a.length(); 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) bool contains(char const * a, string const & b)
{ {
Assert(a); lyx::Assert(a);
string const at(a); string const at(a);
return contains(at, b); return contains(at, b);
} }
@ -330,7 +330,7 @@ bool contains(char const * a, string const & b)
bool contains(string const & a, char const * b) bool contains(string const & a, char const * b)
{ {
Assert(b); lyx::Assert(b);
string const bt(b); string const bt(b);
return contains(a, bt); return contains(a, bt);
} }
@ -354,7 +354,7 @@ bool contains(string const & a, char b)
bool contains(char const * a, char const * b) bool contains(char const * a, char const * b)
{ {
Assert(a && b); lyx::Assert(a && b);
string const at(a); string const at(a);
string const bt(b); string const bt(b);
return contains(at, bt); return contains(at, bt);
@ -363,7 +363,7 @@ bool contains(char const * a, char const * b)
bool containsOnly(string const & s, char const * cset) bool containsOnly(string const & s, char const * cset)
{ {
Assert(cset); lyx::Assert(cset);
return s.find_first_not_of(cset) == string::npos; 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) 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; 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) bool containsOnly(char const * s, string const & cset)
{ {
Assert(s); lyx::Assert(s);
return string(s).find_first_not_of(cset) == string::npos; 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, string const subst(string const & a,
char const * oldstr, string const & newstr) char const * oldstr, string const & newstr)
{ {
Assert(oldstr); lyx::Assert(oldstr);
string lstr(a); string lstr(a);
string::size_type i = 0; 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) string const frontStrip(string const & a, char const * p)
{ {
Assert(p); lyx::Assert(p);
if (a.empty() || !*p) return a; if (a.empty() || !*p) return a;
string tmp(a); string tmp(a);

View File

@ -12,7 +12,7 @@
#include <iterator> #include <iterator>
//namespace lyx { namespace lyx {
template<class R, class C, class A> template<class R, class C, class A>
@ -251,6 +251,5 @@ private:
T2 const & value_; T2 const & value_;
}; };
} // end of namespace lyx
// } // end of namespace lyx
#endif #endif

View File

@ -49,12 +49,12 @@ public:
/// Find the mapping for the first argument /// Find the mapping for the first argument
T2 const & find(T1 const & first) const { T2 const & find(T1 const & first) const {
Assert(!map.empty()); lyx::Assert(!map.empty());
// For explanation see the next find() function. // For explanation see the next find() function.
Map::const_iterator it = Map::const_iterator it =
std::find_if(map.begin(), map.end(), std::find_if(map.begin(), map.end(),
equal_1st_in_pair<T1, T2>(first) lyx::equal_1st_in_pair<T1, T2>(first)
); );
if (it != map.end()) { if (it != map.end()) {
@ -66,7 +66,7 @@ public:
/// Find the mapping for the second argument /// Find the mapping for the second argument
T1 const & find(T2 const & second) const { T1 const & find(T2 const & second) const {
Assert(!map.empty()); lyx::Assert(!map.empty());
// The idea is as follows: // The idea is as follows:
// find_if() will try to compare the data in the vector with // find_if() will try to compare the data in the vector with
@ -81,7 +81,7 @@ public:
// equal_to( select2nd(pair) , second) // equal_to( select2nd(pair) , second)
Map::const_iterator it = Map::const_iterator it =
std::find_if(map.begin(), map.end(), std::find_if(map.begin(), map.end(),
equal_2nd_in_pair<T1, T2>(second) lyx::equal_2nd_in_pair<T1, T2>(second)
); );
if (it != map.end()) if (it != map.end())

View File

@ -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 // 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 // So then it is ok to throw an exception, or for now
// call abort() // call abort()
Assert(rows_ == lt.rows_ && columns_ == lt.columns_); lyx::Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
cell_info = lt.cell_info; cell_info = lt.cell_info;
row_info = lt.row_info; row_info = lt.row_info;

View File

@ -183,6 +183,7 @@ public:
/// ///
int GetAdditionalHeight(int row) const; int GetAdditionalHeight(int row) const;
/// ///
int GetAdditionalWidth(int cell) const; int GetAdditionalWidth(int cell) const;

View File

@ -1665,7 +1665,8 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
row_ptr->baseline(maxasc + labeladdon); row_ptr->baseline(maxasc + labeladdon);
height += row_ptr->height(); height += row_ptr->height();
float x, dummy; float x;
float dummy;
PrepareToPrint(bview, row_ptr, x, dummy, dummy, dummy, false); PrepareToPrint(bview, row_ptr, x, dummy, dummy, dummy, false);
row_ptr->width(int(maxwidth + x)); row_ptr->width(int(maxwidth + x));
if (inset_owner) { if (inset_owner) {