Remove all messages to user related to assertions. We'll just use

a basic message which is defined in lassert.cpp now.
This commit is contained in:
Richard Heck 2013-04-27 17:52:55 -04:00
parent 06d72d6ca0
commit d79225ae98
33 changed files with 156 additions and 154 deletions

View File

@ -607,7 +607,7 @@ void Buffer::changed(bool update_metrics) const
frontend::WorkAreaManager & Buffer::workAreaManager() const frontend::WorkAreaManager & Buffer::workAreaManager() const
{ {
LBUFERR(d->wa_, _("Unable to find WorkArea for Buffer!")); LBUFERR(d->wa_);
return *d->wa_; return *d->wa_;
} }
@ -4256,7 +4256,7 @@ void Buffer::setBuffersForInsets() const
void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const void Buffer::updateBuffer(UpdateScope scope, UpdateType utype) const
{ {
LBUFERR(!text().paragraphs().empty(), _("Buffer error")); LBUFERR(!text().paragraphs().empty());
// Use the master text class also for child documents // Use the master text class also for child documents
Buffer const * const master = masterBuffer(); Buffer const * const master = masterBuffer();

View File

@ -335,7 +335,7 @@ BufferParams::Impl::Impl()
BufferParams::Impl * BufferParams::Impl *
BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr) BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr)
{ {
LBUFERR(ptr, _("Attempting to clone non-existent BufferParams!")); LBUFERR(ptr);
return new BufferParams::Impl(*ptr); return new BufferParams::Impl(*ptr);
} }

View File

@ -876,7 +876,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool recenter)
if (tm.contains(bot_pit)) { if (tm.contains(bot_pit)) {
ParagraphMetrics const & pm = tm.parMetrics(bot_pit); ParagraphMetrics const & pm = tm.parMetrics(bot_pit);
LBUFERR(!pm.rows().empty(), from_ascii("")); LBUFERR(!pm.rows().empty());
// FIXME: smooth scrolling doesn't work in mathed. // FIXME: smooth scrolling doesn't work in mathed.
CursorSlice const & cs = dit.innerTextSlice(); CursorSlice const & cs = dit.innerTextSlice();
int offset = coordOffset(dit).y_; int offset = coordOffset(dit).y_;
@ -2401,7 +2401,7 @@ TextMetrics const & BufferView::textMetrics(Text const * t) const
TextMetrics & BufferView::textMetrics(Text const * t) TextMetrics & BufferView::textMetrics(Text const * t)
{ {
LBUFERR(t, from_ascii("")); LBUFERR(t);
TextMetricsCache::iterator tmc_it = d->text_metrics_.find(t); TextMetricsCache::iterator tmc_it = d->text_metrics_.find(t);
if (tmc_it == d->text_metrics_.end()) { if (tmc_it == d->text_metrics_.end()) {
tmc_it = d->text_metrics_.insert( tmc_it = d->text_metrics_.insert(
@ -2792,7 +2792,7 @@ Point BufferView::coordOffset(DocIterator const & dit) const
TextMetrics const & tm = textMetrics(sl.text()); TextMetrics const & tm = textMetrics(sl.text());
ParagraphMetrics const & pm = tm.parMetrics(sl.pit()); ParagraphMetrics const & pm = tm.parMetrics(sl.pit());
LBUFERR(!pm.rows().empty(), from_ascii("")); LBUFERR(!pm.rows().empty());
y -= pm.rows()[0].ascent(); y -= pm.rows()[0].ascent();
#if 1 #if 1
// FIXME: document this mess // FIXME: document this mess

View File

@ -261,7 +261,7 @@ void Counters::step(docstring const & ctr, UpdateType utype)
it->second.step(); it->second.step();
if (utype == OutputUpdate) { if (utype == OutputUpdate) {
LBUFERR(!counter_stack_.empty(), _("Empty counter stack!")); LBUFERR(!counter_stack_.empty());
counter_stack_.pop_back(); counter_stack_.pop_back();
counter_stack_.push_back(ctr); counter_stack_.push_back(ctr);
} }
@ -597,7 +597,7 @@ docstring Counters::prettyCounter(docstring const & name,
docstring Counters::currentCounter() const docstring Counters::currentCounter() const
{ {
LBUFERR(!counter_stack_.empty(), _("Empty counter stack!")); LBUFERR(!counter_stack_.empty());
return counter_stack_.back(); return counter_stack_.back();
} }

View File

@ -460,14 +460,14 @@ DispatchResult const & Cursor::result() const
BufferView & Cursor::bv() const BufferView & Cursor::bv() const
{ {
LBUFERR(bv_, _("Cursor has no BufferView!")); LBUFERR(bv_);
return *bv_; return *bv_;
} }
void Cursor::pop() void Cursor::pop()
{ {
LBUFERR(depth() >= 1, _("Attempt to pop empty cursor!")); LBUFERR(depth() >= 1);
pop_back(); pop_back();
} }

View File

@ -44,7 +44,7 @@ CursorSlice::CursorSlice()
CursorSlice::CursorSlice(Inset & p) CursorSlice::CursorSlice(Inset & p)
: inset_(&p), idx_(0), pit_(0), pos_(0) : inset_(&p), idx_(0), pit_(0), pos_(0)
{ {
LBUFERR(inset_, _("Invalid initialization of CursorSlice!")); LBUFERR(inset_);
} }
@ -62,7 +62,7 @@ Paragraph & CursorSlice::paragraph() const
pos_type CursorSlice::lastpos() const pos_type CursorSlice::lastpos() const
{ {
LBUFERR(inset_, _("Cursor slice not properly initialized!")); LBUFERR(inset_);
InsetMath const * math = inset_->asInsetMath(); InsetMath const * math = inset_->asInsetMath();
bool paramless_macro = math && math->asMacro() && !math->asMacro()->nargs(); bool paramless_macro = math && math->asMacro() && !math->asMacro()->nargs();
return math ? (paramless_macro ? 0 : cell().size()) return math ? (paramless_macro ? 0 : cell().size())

View File

@ -685,7 +685,7 @@ void switchBetweenClasses(DocumentClassConstPtr oldone,
{ {
errorlist.clear(); errorlist.clear();
LBUFERR(!in.paragraphs().empty(), from_ascii("")); LBUFERR(!in.paragraphs().empty());
if (oldone == newone) if (oldone == newone)
return; return;
@ -803,7 +803,7 @@ void cutSelection(Cursor & cur, bool doclear, bool realcut)
if (cur.inTexted()) { if (cur.inTexted()) {
Text * text = cur.text(); Text * text = cur.text();
LBUFERR(text, _("Invalid cursor!")); LBUFERR(text);
saveSelection(cur); saveSelection(cur);
@ -912,7 +912,7 @@ void copySelectionToStack(Cursor const & cur, CutStack & cutstack)
if (cur.inTexted()) { if (cur.inTexted()) {
Text * text = cur.text(); Text * text = cur.text();
LBUFERR(text, _("Invalid cursor!")); LBUFERR(text);
// ok we have a selection. This is always between cur.selBegin() // ok we have a selection. This is always between cur.selBegin()
// and sel_end cursor // and sel_end cursor
@ -1026,7 +1026,7 @@ void pasteParagraphList(Cursor & cur, ParagraphList const & parlist,
{ {
if (cur.inTexted()) { if (cur.inTexted()) {
Text * text = cur.text(); Text * text = cur.text();
LBUFERR(text, _("Invalid cursor!")); LBUFERR(text);
PasteReturnValue prv = PasteReturnValue prv =
pasteSelectionHelper(cur, parlist, docclass, errorList); pasteSelectionHelper(cur, parlist, docclass, errorList);

View File

@ -82,7 +82,7 @@ DocIterator DocIterator::clone(Buffer * buffer) const
DocIterator dit(buffer); DocIterator dit(buffer);
size_t const n = slices_.size(); size_t const n = slices_.size();
for (size_t i = 0 ; i != n; ++i) { for (size_t i = 0 ; i != n; ++i) {
LBUFERR(inset, _("Iterator slice not properly initialized!")); LBUFERR(inset);
dit.push_back(slices_[i]); dit.push_back(slices_[i]);
dit.top().inset_ = inset; dit.top().inset_ = inset;
if (i + 1 != n) if (i + 1 != n)
@ -183,7 +183,7 @@ Paragraph & DocIterator::paragraph() const
{ {
if (!inTexted()) { if (!inTexted()) {
LYXERR0(*this); LYXERR0(*this);
LBUFERR(false, _("DocIterator::paragraph() called outside Text.")); LBUFERR(false);
} }
return top().paragraph(); return top().paragraph();
} }
@ -191,7 +191,7 @@ Paragraph & DocIterator::paragraph() const
Paragraph & DocIterator::innerParagraph() const Paragraph & DocIterator::innerParagraph() const
{ {
LBUFERR(!empty(), _("Empty DocIterator.")); LBUFERR(!empty());
return innerTextSlice().paragraph(); return innerTextSlice().paragraph();
} }
@ -210,7 +210,7 @@ FontSpan DocIterator::locateWord(word_location const loc) const
CursorSlice const & DocIterator::innerTextSlice() const CursorSlice const & DocIterator::innerTextSlice() const
{ {
LBUFERR(!empty(), from_ascii("")); LBUFERR(!empty());
// go up until first non-0 text is hit // go up until first non-0 text is hit
// (innermost text is 0 in mathed) // (innermost text is 0 in mathed)
for (int i = depth() - 1; i >= 0; --i) for (int i = depth() - 1; i >= 0; --i)
@ -219,7 +219,7 @@ CursorSlice const & DocIterator::innerTextSlice() const
// This case is in principe not possible. We _must_ // This case is in principe not possible. We _must_
// be inside a Text. // be inside a Text.
LBUFERR(false, from_ascii("")); LBUFERR(false);
// Squash warning // Squash warning
static const CursorSlice c; static const CursorSlice c;
return c; return c;
@ -468,7 +468,7 @@ void DocIterator::updateInsets(Inset * inset)
size_t const n = slices_.size(); size_t const n = slices_.size();
slices_.resize(0); slices_.resize(0);
for (size_t i = 0 ; i < n; ++i) { for (size_t i = 0 ; i < n; ++i) {
LBUFERR(inset, _("Improperly initialized DocIterator.")); LBUFERR(inset);
push_back(dit[i]); push_back(dit[i]);
top().inset_ = inset; top().inset_ = inset;
if (i + 1 != n) if (i + 1 != n)

View File

@ -520,7 +520,7 @@ bool LyX::loadFiles()
void execBatchCommands() void execBatchCommands()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
singleton_->execCommands(); singleton_->execCommands();
} }
@ -1268,35 +1268,35 @@ void LyX::easyParse(int & argc, char * argv[])
FuncStatus getStatus(FuncRequest const & action) FuncStatus getStatus(FuncRequest const & action)
{ {
LAPPERR(theApp(), _("Appplication not initialized.")); LAPPERR(theApp());
return theApp()->getStatus(action); return theApp()->getStatus(action);
} }
void dispatch(FuncRequest const & action) void dispatch(FuncRequest const & action)
{ {
LAPPERR(theApp(), _("Appplication not initialized.")); LAPPERR(theApp());
return theApp()->dispatch(action); return theApp()->dispatch(action);
} }
void dispatch(FuncRequest const & action, DispatchResult & dr) void dispatch(FuncRequest const & action, DispatchResult & dr)
{ {
LAPPERR(theApp(), _("Appplication not initialized.")); LAPPERR(theApp());
return theApp()->dispatch(action, dr); return theApp()->dispatch(action, dr);
} }
vector<string> & theFilesToLoad() vector<string> & theFilesToLoad()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->files_to_load_; return singleton_->pimpl_->files_to_load_;
} }
BufferList & theBufferList() BufferList & theBufferList()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->buffer_list_; return singleton_->pimpl_->buffer_list_;
} }
@ -1304,8 +1304,8 @@ BufferList & theBufferList()
Server & theServer() Server & theServer()
{ {
// FIXME: this should not be use_gui dependent // FIXME: this should not be use_gui dependent
LWARNIF(use_gui, _("LyX server can only be used with GUI.")); LWARNIF(use_gui);
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return *singleton_->pimpl_->lyx_server_.get(); return *singleton_->pimpl_->lyx_server_.get();
} }
@ -1313,71 +1313,71 @@ Server & theServer()
ServerSocket & theServerSocket() ServerSocket & theServerSocket()
{ {
// FIXME: this should not be use_gui dependent // FIXME: this should not be use_gui dependent
LWARNIF(use_gui, _("LyX server can only be used with GUI.")); LWARNIF(use_gui);
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return *singleton_->pimpl_->lyx_socket_.get(); return *singleton_->pimpl_->lyx_socket_.get();
} }
KeyMap & theTopLevelKeymap() KeyMap & theTopLevelKeymap()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->toplevel_keymap_; return singleton_->pimpl_->toplevel_keymap_;
} }
Converters & theConverters() Converters & theConverters()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->converters_; return singleton_->pimpl_->converters_;
} }
Converters & theSystemConverters() Converters & theSystemConverters()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->system_converters_; return singleton_->pimpl_->system_converters_;
} }
Movers & theMovers() Movers & theMovers()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->movers_; return singleton_->pimpl_->movers_;
} }
Mover const & getMover(string const & fmt) Mover const & getMover(string const & fmt)
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->movers_(fmt); return singleton_->pimpl_->movers_(fmt);
} }
void setMover(string const & fmt, string const & command) void setMover(string const & fmt, string const & command)
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
singleton_->pimpl_->movers_.set(fmt, command); singleton_->pimpl_->movers_.set(fmt, command);
} }
Movers & theSystemMovers() Movers & theSystemMovers()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->system_movers_; return singleton_->pimpl_->system_movers_;
} }
Messages const & getMessages(string const & language) Messages const & getMessages(string const & language)
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->messages(language); return singleton_->messages(language);
} }
Messages const & getGuiMessages() Messages const & getGuiMessages()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
// A cache to translate full language name to language code // A cache to translate full language name to language code
static string last_language = "auto"; static string last_language = "auto";
static string code; static string code;
@ -1396,14 +1396,14 @@ Messages const & getGuiMessages()
Session & theSession() Session & theSession()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return *singleton_->pimpl_->session_.get(); return *singleton_->pimpl_->session_.get();
} }
LaTeXFonts & theLaTeXFonts() LaTeXFonts & theLaTeXFonts()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
if (!singleton_->pimpl_->latexfonts_) if (!singleton_->pimpl_->latexfonts_)
singleton_->pimpl_->latexfonts_ = new LaTeXFonts; singleton_->pimpl_->latexfonts_ = new LaTeXFonts;
return *singleton_->pimpl_->latexfonts_; return *singleton_->pimpl_->latexfonts_;
@ -1412,7 +1412,7 @@ LaTeXFonts & theLaTeXFonts()
CmdDef & theTopLevelCmdDef() CmdDef & theTopLevelCmdDef()
{ {
LAPPERR(singleton_, _("Appplication not initialized.")); LAPPERR(singleton_);
return singleton_->pimpl_->toplevel_cmddef_; return singleton_->pimpl_->toplevel_cmddef_;
} }

View File

@ -660,8 +660,7 @@ void Paragraph::setChange(pos_type pos, Change const & change)
Change const & Paragraph::lookupChange(pos_type pos) const Change const & Paragraph::lookupChange(pos_type pos) const
{ {
LBUFERR(pos >= 0 && pos <= size(), LBUFERR(pos >= 0 && pos <= size());
_("Invalid position given to lookupChange()"));
return d->changes_.lookup(pos); return d->changes_.lookup(pos);
} }
@ -1044,7 +1043,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
unsigned int & column) unsigned int & column)
{ {
Inset * inset = owner_->getInset(i); Inset * inset = owner_->getInset(i);
LBUFERR(inset, from_ascii("")); LBUFERR(inset);
if (style.pass_thru) { if (style.pass_thru) {
odocstringstream ods; odocstringstream ods;
@ -1806,7 +1805,7 @@ Font const & Paragraph::getFontSettings(BufferParams const & bparams,
{ {
if (pos > size()) { if (pos > size()) {
LYXERR0("pos: " << pos << " size: " << size()); LYXERR0("pos: " << pos << " size: " << size());
LBUFERR(false, _("Invalid position.")); LBUFERR(false);
} }
FontList::const_iterator cit = d->fontlist_.fontIterator(pos); FontList::const_iterator cit = d->fontlist_.fontIterator(pos);
@ -1831,7 +1830,7 @@ Font const & Paragraph::getFontSettings(BufferParams const & bparams,
FontSpan Paragraph::fontSpan(pos_type pos) const FontSpan Paragraph::fontSpan(pos_type pos) const
{ {
LBUFERR(pos <= size(), _("Invalid position")); LBUFERR(pos <= size());
// Last position is a special case. I suspect that it would // Last position is a special case. I suspect that it would
// actually make sense to extend the last font span to cover // actually make sense to extend the last font span to cover
@ -1888,7 +1887,7 @@ Font const & Paragraph::getFirstFontSettings(BufferParams const & bparams) const
Font const Paragraph::getFont(BufferParams const & bparams, pos_type pos, Font const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
Font const & outerfont) const Font const & outerfont) const
{ {
LBUFERR(pos >= 0, _("Invalid position.")); LBUFERR(pos >= 0);
Font font = getFontSettings(bparams, pos); Font font = getFontSettings(bparams, pos);
@ -3263,7 +3262,7 @@ void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tclass)
Inset const & Paragraph::inInset() const Inset const & Paragraph::inInset() const
{ {
LBUFERR(d->inset_owner_, _("Paragraph not properly initialized")); LBUFERR(d->inset_owner_);
return *d->inset_owner_; return *d->inset_owner_;
} }

View File

@ -136,7 +136,7 @@ void ParagraphMetrics::setInsetDimension(Inset const * inset,
Row & ParagraphMetrics::getRow(pos_type pos, bool boundary) Row & ParagraphMetrics::getRow(pos_type pos, bool boundary)
{ {
LBUFERR(!rows().empty(), _("ParagraphMetrics has no rows!")); LBUFERR(!rows().empty());
// If boundary is set we should return the row on which // If boundary is set we should return the row on which
// the character before is inside. // the character before is inside.
@ -155,7 +155,7 @@ Row & ParagraphMetrics::getRow(pos_type pos, bool boundary)
Row const & ParagraphMetrics::getRow(pos_type pos, bool boundary) const Row const & ParagraphMetrics::getRow(pos_type pos, bool boundary) const
{ {
LBUFERR(!rows().empty(), _("ParagraphMetrics has no rows!")); LBUFERR(!rows().empty());
// If boundary is set we should return the row on which // If boundary is set we should return the row on which
// the character before is inside. // the character before is inside.
@ -174,7 +174,7 @@ Row const & ParagraphMetrics::getRow(pos_type pos, bool boundary) const
size_t ParagraphMetrics::pos2row(pos_type pos) const size_t ParagraphMetrics::pos2row(pos_type pos) const
{ {
LBUFERR(!rows().empty(), _("ParagraphMetrics has no rows!")); LBUFERR(!rows().empty());
RowList::const_iterator rit = rows_.end(); RowList::const_iterator rit = rows_.end();
RowList::const_iterator const begin = rows_.begin(); RowList::const_iterator const begin = rows_.begin();

View File

@ -726,7 +726,7 @@ static void breakParagraph(Text & text, pit_type par_offset, pos_type pos,
void Text::breakParagraph(Cursor & cur, bool inverse_logic) void Text::breakParagraph(Cursor & cur, bool inverse_logic)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
Paragraph & cpar = cur.paragraph(); Paragraph & cpar = cur.paragraph();
pit_type cpit = cur.pit(); pit_type cpit = cur.pit();
@ -883,7 +883,7 @@ void Text::insertStringAsParagraphs(Cursor & cur, docstring const & str,
// same Paragraph one to the right and make a rebreak // same Paragraph one to the right and make a rebreak
void Text::insertChar(Cursor & cur, char_type c) void Text::insertChar(Cursor & cur, char_type c)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
cur.recordUndo(INSERT_UNDO); cur.recordUndo(INSERT_UNDO);
@ -1033,7 +1033,7 @@ void Text::charInserted(Cursor & cur)
&& !par.isWordSeparator(cur.pos() - 2) && !par.isWordSeparator(cur.pos() - 2)
&& par.isWordSeparator(cur.pos() - 1)) { && par.isWordSeparator(cur.pos() - 1)) {
// get the word in front of cursor // get the word in front of cursor
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
cur.paragraph().updateWords(); cur.paragraph().updateWords();
} }
} }
@ -1044,7 +1044,7 @@ void Text::charInserted(Cursor & cur)
bool Text::cursorForwardOneWord(Cursor & cur) bool Text::cursorForwardOneWord(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
pos_type const lastpos = cur.lastpos(); pos_type const lastpos = cur.lastpos();
pit_type pit = cur.pit(); pit_type pit = cur.pit();
@ -1091,7 +1091,7 @@ bool Text::cursorForwardOneWord(Cursor & cur)
bool Text::cursorBackwardOneWord(Cursor & cur) bool Text::cursorBackwardOneWord(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
pit_type pit = cur.pit(); pit_type pit = cur.pit();
pos_type pos = cur.pos(); pos_type pos = cur.pos();
@ -1132,7 +1132,7 @@ bool Text::cursorBackwardOneWord(Cursor & cur)
bool Text::cursorVisLeftOneWord(Cursor & cur) bool Text::cursorVisLeftOneWord(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
pos_type left_pos, right_pos; pos_type left_pos, right_pos;
bool left_is_letter, right_is_letter; bool left_is_letter, right_is_letter;
@ -1169,7 +1169,7 @@ bool Text::cursorVisLeftOneWord(Cursor & cur)
bool Text::cursorVisRightOneWord(Cursor & cur) bool Text::cursorVisRightOneWord(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
pos_type left_pos, right_pos; pos_type left_pos, right_pos;
bool left_is_letter, right_is_letter; bool left_is_letter, right_is_letter;
@ -1208,7 +1208,7 @@ bool Text::cursorVisRightOneWord(Cursor & cur)
void Text::selectWord(Cursor & cur, word_location loc) void Text::selectWord(Cursor & cur, word_location loc)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
CursorSlice from = cur.top(); CursorSlice from = cur.top();
CursorSlice to = cur.top(); CursorSlice to = cur.top();
getWord(from, to, loc); getWord(from, to, loc);
@ -1226,7 +1226,7 @@ void Text::selectWord(Cursor & cur, word_location loc)
void Text::selectAll(Cursor & cur) void Text::selectAll(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
if (cur.lastpos() == 0 && cur.lastpit() == 0) if (cur.lastpos() == 0 && cur.lastpit() == 0)
return; return;
// If the cursor is at the beginning, make sure the cursor ends there // If the cursor is at the beginning, make sure the cursor ends there
@ -1247,7 +1247,7 @@ void Text::selectAll(Cursor & cur)
// selection is currently set // selection is currently set
bool Text::selectWordWhenUnderCursor(Cursor & cur, word_location loc) bool Text::selectWordWhenUnderCursor(Cursor & cur, word_location loc)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
if (cur.selection()) if (cur.selection())
return false; return false;
selectWord(cur, loc); selectWord(cur, loc);
@ -1257,7 +1257,7 @@ bool Text::selectWordWhenUnderCursor(Cursor & cur, word_location loc)
void Text::acceptOrRejectChanges(Cursor & cur, ChangeOp op) void Text::acceptOrRejectChanges(Cursor & cur, ChangeOp op)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
if (!cur.selection()) { if (!cur.selection()) {
bool const changed = cur.paragraph().isChanged(cur.pos()); bool const changed = cur.paragraph().isChanged(cur.pos());
@ -1412,7 +1412,7 @@ void Text::rejectChanges()
void Text::deleteWordForward(Cursor & cur) void Text::deleteWordForward(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
if (cur.lastpos() == 0) if (cur.lastpos() == 0)
cursorForward(cur); cursorForward(cur);
else { else {
@ -1428,7 +1428,7 @@ void Text::deleteWordForward(Cursor & cur)
void Text::deleteWordBackward(Cursor & cur) void Text::deleteWordBackward(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
if (cur.lastpos() == 0) if (cur.lastpos() == 0)
cursorBackward(cur); cursorBackward(cur);
else { else {
@ -1445,7 +1445,7 @@ void Text::deleteWordBackward(Cursor & cur)
// Kill to end of line. // Kill to end of line.
void Text::changeCase(Cursor & cur, TextCase action) void Text::changeCase(Cursor & cur, TextCase action)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
CursorSlice from; CursorSlice from;
CursorSlice to; CursorSlice to;
@ -1574,7 +1574,7 @@ bool Text::erase(Cursor & cur)
bool Text::backspacePos0(Cursor & cur) bool Text::backspacePos0(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
if (cur.pit() == 0) if (cur.pit() == 0)
return false; return false;
@ -1627,7 +1627,7 @@ bool Text::backspacePos0(Cursor & cur)
bool Text::backspace(Cursor & cur) bool Text::backspace(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
bool needsUpdate = false; bool needsUpdate = false;
if (cur.pos() == 0) { if (cur.pos() == 0) {
if (cur.pit() == 0) if (cur.pit() == 0)
@ -1829,7 +1829,7 @@ bool Text::read(Lexer & lex,
// Returns the current font and depth as a message. // Returns the current font and depth as a message.
docstring Text::currentState(Cursor const & cur) const docstring Text::currentState(Cursor const & cur) const
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
Buffer & buf = *cur.buffer(); Buffer & buf = *cur.buffer();
Paragraph const & par = cur.paragraph(); Paragraph const & par = cur.paragraph();
odocstringstream os; odocstringstream os;
@ -2015,7 +2015,7 @@ void Text::forToc(docstring & os, size_t maxlen, bool shorten) const
void Text::charsTranspose(Cursor & cur) void Text::charsTranspose(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
pos_type pos = cur.pos(); pos_type pos = cur.pos();
@ -2115,7 +2115,7 @@ CompletionList const * Text::createCompletionList(Cursor const & cur) const
bool Text::insertCompletion(Cursor & cur, docstring const & s, bool /*finished*/) bool Text::insertCompletion(Cursor & cur, docstring const & s, bool /*finished*/)
{ {
LBUFERR(cur.bv().cursor() == cur, _("Invalid cursor.")); LBUFERR(cur.bv().cursor() == cur);
cur.insert(s); cur.insert(s);
cur.bv().cursor() = cur; cur.bv().cursor() = cur;
if (!(cur.result().screenUpdate() & Update::Force)) if (!(cur.result().screenUpdate() & Update::Force))

View File

@ -194,7 +194,7 @@ void Text::setLayout(pit_type start, pit_type end,
// set layout over selection and make a total rebreak of those paragraphs // set layout over selection and make a total rebreak of those paragraphs
void Text::setLayout(Cursor & cur, docstring const & layout) void Text::setLayout(Cursor & cur, docstring const & layout)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
pit_type start = cur.selBegin().pit(); pit_type start = cur.selBegin().pit();
pit_type end = cur.selEnd().pit() + 1; pit_type end = cur.selEnd().pit() + 1;
@ -218,7 +218,7 @@ static bool changeDepthAllowed(Text::DEPTH_CHANGE type,
bool Text::changeDepthAllowed(Cursor & cur, DEPTH_CHANGE type) const bool Text::changeDepthAllowed(Cursor & cur, DEPTH_CHANGE type) const
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
// this happens when selecting several cells in tabular (bug 2630) // this happens when selecting several cells in tabular (bug 2630)
if (cur.selBegin().idx() != cur.selEnd().idx()) if (cur.selBegin().idx() != cur.selEnd().idx())
return false; return false;
@ -238,7 +238,7 @@ bool Text::changeDepthAllowed(Cursor & cur, DEPTH_CHANGE type) const
void Text::changeDepth(Cursor & cur, DEPTH_CHANGE type) void Text::changeDepth(Cursor & cur, DEPTH_CHANGE type)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
pit_type const beg = cur.selBegin().pit(); pit_type const beg = cur.selBegin().pit();
pit_type const end = cur.selEnd().pit() + 1; pit_type const end = cur.selEnd().pit() + 1;
cur.recordUndoSelection(); cur.recordUndoSelection();
@ -383,21 +383,21 @@ void Text::setFont(BufferView const & bv, CursorSlice const & begin,
bool Text::cursorTop(Cursor & cur) bool Text::cursorTop(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
return setCursor(cur, 0, 0); return setCursor(cur, 0, 0);
} }
bool Text::cursorBottom(Cursor & cur) bool Text::cursorBottom(Cursor & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
return setCursor(cur, cur.lastpit(), boost::prior(paragraphs().end())->size()); return setCursor(cur, cur.lastpit(), boost::prior(paragraphs().end())->size());
} }
void Text::toggleFree(Cursor & cur, Font const & font, bool toggleall) void Text::toggleFree(Cursor & cur, Font const & font, bool toggleall)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
// If the mask is completely neutral, tell user // If the mask is completely neutral, tell user
if (font.fontInfo() == ignore_font && font.language() == ignore_language) { if (font.fontInfo() == ignore_font && font.language() == ignore_language) {
// Could only happen with user style // Could only happen with user style
@ -429,7 +429,7 @@ void Text::toggleFree(Cursor & cur, Font const & font, bool toggleall)
docstring Text::getStringToIndex(Cursor const & cur) docstring Text::getStringToIndex(Cursor const & cur)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
if (cur.selection()) if (cur.selection())
return cur.selectionAsString(false); return cur.selectionAsString(false);
@ -482,7 +482,7 @@ void Text::setLabelWidthStringToSequence(Cursor const & cur,
void Text::setParagraphs(Cursor & cur, docstring arg, bool merge) void Text::setParagraphs(Cursor & cur, docstring arg, bool merge)
{ {
LBUFERR(cur.text(), _("Uninitalized cursor.")); LBUFERR(cur.text());
//FIXME UNICODE //FIXME UNICODE
string const argument = to_utf8(arg); string const argument = to_utf8(arg);
@ -510,7 +510,7 @@ void Text::setParagraphs(Cursor & cur, docstring arg, bool merge)
void Text::setParagraphs(Cursor & cur, ParagraphParameters const & p) void Text::setParagraphs(Cursor & cur, ParagraphParameters const & p)
{ {
LBUFERR(cur.text(), _("Uninitalized cursor.")); LBUFERR(cur.text());
depth_type priordepth = -1; depth_type priordepth = -1;
Layout priorlayout; Layout priorlayout;
@ -536,8 +536,8 @@ void Text::setParagraphs(Cursor & cur, ParagraphParameters const & p)
// this really should just insert the inset and not move the cursor. // this really should just insert the inset and not move the cursor.
void Text::insertInset(Cursor & cur, Inset * inset) void Text::insertInset(Cursor & cur, Inset * inset)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
LBUFERR(inset, _("Uninitialized Text.")); LBUFERR(inset);
cur.paragraph().insertInset(cur.pos(), inset, cur.current_font, cur.paragraph().insertInset(cur.pos(), inset, cur.current_font,
Change(cur.buffer()->params().trackChanges Change(cur.buffer()->params().trackChanges
? Change::INSERTED : Change::UNCHANGED)); ? Change::INSERTED : Change::UNCHANGED));
@ -585,7 +585,7 @@ void Text::setCursor(CursorSlice & cur, pit_type par, pos_type pos)
void Text::setCursorIntern(Cursor & cur, void Text::setCursorIntern(Cursor & cur,
pit_type par, pos_type pos, bool setfont, bool boundary) pit_type par, pos_type pos, bool setfont, bool boundary)
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
cur.boundary(boundary); cur.boundary(boundary);
setCursor(cur.top(), par, pos); setCursor(cur.top(), par, pos);
if (setfont) if (setfont)

View File

@ -488,7 +488,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// at the end? // at the end?
cur.noScreenUpdate(); cur.noScreenUpdate();
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
CursorSlice const oldTopSlice = cur.top(); CursorSlice const oldTopSlice = cur.top();
bool const oldBoundary = cur.boundary(); bool const oldBoundary = cur.boundary();
bool const oldSelection = cur.selection(); bool const oldSelection = cur.selection();
@ -2377,7 +2377,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const FuncStatus & flag) const
{ {
LBUFERR(this == cur.text(), _("Invalid cursor.")); LBUFERR(this == cur.text());
FontInfo const & fontinfo = cur.real_current_font.fontInfo(); FontInfo const & fontinfo = cur.real_current_font.fontInfo();
bool enable = true; bool enable = true;

View File

@ -129,7 +129,7 @@ static int numberOfHfills(Paragraph const & par, Row const & row)
TextMetrics::TextMetrics(BufferView * bv, Text * text) TextMetrics::TextMetrics(BufferView * bv, Text * text)
: bv_(bv), text_(text) : bv_(bv), text_(text)
{ {
LBUFERR(bv_, _("Text metrics error.")); LBUFERR(bv_);
max_width_ = bv_->workWidth(); max_width_ = bv_->workWidth();
dim_.wid = max_width_; dim_.wid = max_width_;
dim_.asc = 10; dim_.asc = 10;
@ -159,7 +159,7 @@ pair<pit_type, ParagraphMetrics const *> TextMetrics::first() const
pair<pit_type, ParagraphMetrics const *> TextMetrics::last() const pair<pit_type, ParagraphMetrics const *> TextMetrics::last() const
{ {
LBUFERR(!par_metrics_.empty(), _("Text metrics error.")); LBUFERR(!par_metrics_.empty());
ParMetricsCache::const_reverse_iterator it = par_metrics_.rbegin(); ParMetricsCache::const_reverse_iterator it = par_metrics_.rbegin();
return make_pair(it->first, &it->second); return make_pair(it->first, &it->second);
} }
@ -180,7 +180,7 @@ ParagraphMetrics & TextMetrics::parMetrics(pit_type pit, bool redo)
bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width) bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width)
{ {
LBUFERR(mi.base.textwidth > 0, _("Text metrics error.")); LBUFERR(mi.base.textwidth > 0);
max_width_ = mi.base.textwidth; max_width_ = mi.base.textwidth;
// backup old dimension. // backup old dimension.
Dimension const old_dim = dim_; Dimension const old_dim = dim_;
@ -417,7 +417,7 @@ bool TextMetrics::redoParagraph(pit_type const pit)
// should be. // should be.
bv_->buffer().updateBuffer(); bv_->buffer().updateBuffer();
parPos = text_->macrocontextPosition(); parPos = text_->macrocontextPosition();
LBUFERR(!parPos.empty(), _("Text metrics error.")); LBUFERR(!parPos.empty());
parPos.pit() = pit; parPos.pit() = pit;
} }
@ -693,7 +693,7 @@ int TextMetrics::labelFill(pit_type const pit, Row const & row) const
Paragraph const & par = text_->getPar(pit); Paragraph const & par = text_->getPar(pit);
pos_type last = par.beginOfBody(); pos_type last = par.beginOfBody();
LBUFERR(last > 0, _("Text metrics error.")); LBUFERR(last > 0);
// -1 because a label ends with a space that is in the label // -1 because a label ends with a space that is in the label
--last; --last;
@ -1343,7 +1343,7 @@ pos_type TextMetrics::x2pos(pit_type pit, int row, int x) const
// upDownInText() while in selection mode. // upDownInText() while in selection mode.
ParagraphMetrics const & pm = parMetrics(pit); ParagraphMetrics const & pm = parMetrics(pit);
LBUFERR(row < int(pm.rows().size()), _("Text metrics error.")); LBUFERR(row < int(pm.rows().size()));
bool bound = false; bool bound = false;
Row const & r = pm.rows()[row]; Row const & r = pm.rows()[row];
return r.pos() + getColumnNearX(pit, r, x, bound); return r.pos() + getColumnNearX(pit, r, x, bound);
@ -1446,7 +1446,7 @@ Row const & TextMetrics::getPitAndRowNearY(int & y, pit_type & pit,
ParagraphMetrics const & pm = par_metrics_[pit]; ParagraphMetrics const & pm = par_metrics_[pit];
int yy = pm.position() - pm.ascent(); int yy = pm.position() - pm.ascent();
LBUFERR(!pm.rows().empty(), _("Text metrics error.")); LBUFERR(!pm.rows().empty());
RowList::const_iterator rit = pm.rows().begin(); RowList::const_iterator rit = pm.rows().begin();
RowList::const_iterator rlast = pm.rows().end(); RowList::const_iterator rlast = pm.rows().end();
--rlast; --rlast;
@ -1557,7 +1557,7 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const
" pit: " << pit << " yy: " << yy); " pit: " << pit << " yy: " << yy);
int r = 0; int r = 0;
LBUFERR(pm.rows().size(), _("Text metrics error.")); LBUFERR(pm.rows().size());
for (; r < int(pm.rows().size()) - 1; ++r) { for (; r < int(pm.rows().size()) - 1; ++r) {
Row const & row = pm.rows()[r]; Row const & row = pm.rows()[r];
if (int(yy + row.height()) > y) if (int(yy + row.height()) > y)

View File

@ -341,7 +341,7 @@ void Undo::Private::doRecordUndo(UndoKind kind,
// main Text _is_ the whole document. // main Text _is_ the whole document.
// record the relevant paragraphs // record the relevant paragraphs
Text const * text = cell.text(); Text const * text = cell.text();
LBUFERR(text, _("Uninitialized cell.")); LBUFERR(text);
ParagraphList const & plist = text->paragraphs(); ParagraphList const & plist = text->paragraphs();
ParagraphList::const_iterator first = plist.begin(); ParagraphList::const_iterator first = plist.begin();
advance(first, first_pit); advance(first, first_pit);
@ -401,7 +401,7 @@ void Undo::Private::doTextUndoOrRedo(CursorData & cur, UndoElementStack & stack,
//LYXERR0("undo, performing: " << undo); //LYXERR0("undo, performing: " << undo);
DocIterator dit = undo.cell.asDocIterator(&buffer_); DocIterator dit = undo.cell.asDocIterator(&buffer_);
if (undo.isFullBuffer) { if (undo.isFullBuffer) {
LBUFERR(undo.pars, _("Undo stack is corrupt!")); LBUFERR(undo.pars);
// This is a full document // This is a full document
delete otherstack.top().bparams; delete otherstack.top().bparams;
otherstack.top().bparams = new BufferParams(buffer_.params()); otherstack.top().bparams = new BufferParams(buffer_.params());
@ -414,15 +414,15 @@ void Undo::Private::doTextUndoOrRedo(CursorData & cur, UndoElementStack & stack,
// gained by storing just 'a few' paragraphs (most if not // gained by storing just 'a few' paragraphs (most if not
// all math inset cells have just one paragraph!) // all math inset cells have just one paragraph!)
//LYXERR0("undo.array: " << *undo.array); //LYXERR0("undo.array: " << *undo.array);
LBUFERR(undo.array, _("Undo stack is corrupt!")); LBUFERR(undo.array);
dit.cell().swap(*undo.array); dit.cell().swap(*undo.array);
delete undo.array; delete undo.array;
undo.array = 0; undo.array = 0;
} else { } else {
// Some finer machinery is needed here. // Some finer machinery is needed here.
Text * text = dit.text(); Text * text = dit.text();
LBUFERR(text, _("Invalid cursor.")); LBUFERR(text);
LBUFERR(undo.pars, _("Undo stack is corrupt!")); LBUFERR(undo.pars);
ParagraphList & plist = text->paragraphs(); ParagraphList & plist = text->paragraphs();
// remove new stuff between first and last // remove new stuff between first and last

View File

@ -118,16 +118,14 @@ BufferView const * Dialog::bufferview() const
Buffer const & Dialog::buffer() const Buffer const & Dialog::buffer() const
{ {
LAPPERR(lyxview_->currentBufferView(), LAPPERR(lyxview_->currentBufferView());
_("Dialog has no associated Buffer!"));
return lyxview_->currentBufferView()->buffer(); return lyxview_->currentBufferView()->buffer();
} }
Buffer const & Dialog::documentBuffer() const Buffer const & Dialog::documentBuffer() const
{ {
LAPPERR(lyxview_->currentBufferView(), LAPPERR(lyxview_->currentBufferView());
_("Dialog has no associated Buffer!"));
return lyxview_->documentBufferView()->buffer(); return lyxview_->documentBufferView()->buffer();
} }

View File

@ -2480,7 +2480,7 @@ void GuiApplication::commitData(QSessionManager & sm)
void GuiApplication::unregisterView(GuiView * gv) void GuiApplication::unregisterView(GuiView * gv)
{ {
LAPPERR(d->views_[gv->id()] == gv, _("Application error.")); LAPPERR(d->views_[gv->id()] == gv);
d->views_.remove(gv->id()); d->views_.remove(gv->id());
if (current_view_ == gv) if (current_view_ == gv)
current_view_ = 0; current_view_ = 0;
@ -2509,7 +2509,7 @@ bool GuiApplication::closeAllViews()
GuiView & GuiApplication::view(int id) const GuiView & GuiApplication::view(int id) const
{ {
LAPPERR(d->views_.contains(id), _("Application error.") /**/); LAPPERR(d->views_.contains(id));
return *d->views_.value(id); return *d->views_.value(id);
} }
@ -2824,7 +2824,7 @@ void hideDialogs(std::string const & name, Inset * inset)
frontend::FontLoader & theFontLoader() frontend::FontLoader & theFontLoader()
{ {
LAPPERR(frontend::guiApp, _("No Gui Application.")); LAPPERR(frontend::guiApp);
return frontend::guiApp->fontLoader(); return frontend::guiApp->fontLoader();
} }
@ -2837,7 +2837,7 @@ frontend::FontMetrics const & theFontMetrics(Font const & f)
frontend::FontMetrics const & theFontMetrics(FontInfo const & f) frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
{ {
LAPPERR(frontend::guiApp, _("No Gui Application.")); LAPPERR(frontend::guiApp);
return frontend::guiApp->fontLoader().metrics(f); return frontend::guiApp->fontLoader().metrics(f);
} }
@ -2850,14 +2850,14 @@ frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
frontend::Clipboard & theClipboard() frontend::Clipboard & theClipboard()
{ {
LAPPERR(frontend::guiApp, _("No Gui Application.")); LAPPERR(frontend::guiApp);
return frontend::guiApp->clipboard(); return frontend::guiApp->clipboard();
} }
frontend::Selection & theSelection() frontend::Selection & theSelection()
{ {
LAPPERR(frontend::guiApp, _("No Gui Application.")); LAPPERR(frontend::guiApp);
return frontend::guiApp->selection(); return frontend::guiApp->selection();
} }

View File

@ -96,10 +96,10 @@ static GuiFontInfo * fontinfo_[NUM_FAMILIES][NUM_SERIES][NUM_SHAPE][NUM_SIZE];
GuiFontInfo & fontinfo(FontInfo const & f) GuiFontInfo & fontinfo(FontInfo const & f)
{ {
// LASSERT: Is there anything we might do here besides crash? // LASSERT: Is there anything we might do here besides crash?
LBUFERR(f.family() < NUM_FAMILIES, _("Font lookup error.")); LBUFERR(f.family() < NUM_FAMILIES);
LBUFERR(f.series() < NUM_SERIES, _("Font lookup error.")); LBUFERR(f.series() < NUM_SERIES);
LBUFERR(f.realShape() < NUM_SHAPE, _("Font lookup error.")); LBUFERR(f.realShape() < NUM_SHAPE);
LBUFERR(f.size() < NUM_SIZE, _("Font lookup error.")); LBUFERR(f.size() < NUM_SIZE);
// fi is a reference to the pointer type (GuiFontInfo *) in the // fi is a reference to the pointer type (GuiFontInfo *) in the
// fontinfo_ table. // fontinfo_ table.
GuiFontInfo * & fi = GuiFontInfo * & fi =

View File

@ -966,7 +966,7 @@ void InsetInclude::collectBibKeys(InsetIterator const & /*di*/) const
void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
LBUFERR(mi.base.bv, _("Text metrics error.")); LBUFERR(mi.base.bv);
bool use_preview = false; bool use_preview = false;
if (RenderPreview::status() != LyXRC::PREVIEW_OFF) { if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
@ -992,7 +992,7 @@ void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetInclude::draw(PainterInfo & pi, int x, int y) const void InsetInclude::draw(PainterInfo & pi, int x, int y) const
{ {
LBUFERR(pi.base.bv, _("Painter has no BufferView!")); LBUFERR(pi.base.bv);
bool use_preview = false; bool use_preview = false;
if (RenderPreview::status() != LyXRC::PREVIEW_OFF) { if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {

View File

@ -3555,7 +3555,7 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
//lyxerr << "InsetTabular::metrics: " << mi.base.bv << " width: " << //lyxerr << "InsetTabular::metrics: " << mi.base.bv << " width: " <<
// mi.base.textwidth << "\n"; // mi.base.textwidth << "\n";
LBUFERR(mi.base.bv, _("Text metrics error.")); LBUFERR(mi.base.bv);
for (row_type r = 0; r < tabular.nrows(); ++r) { for (row_type r = 0; r < tabular.nrows(); ++r) {
int maxasc = 0; int maxasc = 0;

View File

@ -125,7 +125,7 @@ void InsetText::setMacrocontextPositionRecursive(DocIterator const & pos)
void InsetText::clear() void InsetText::clear()
{ {
ParagraphList & pars = paragraphs(); ParagraphList & pars = paragraphs();
LBUFERR(!pars.empty(), _("Buffer corrupt!")); LBUFERR(!pars.empty());
// This is a gross hack... // This is a gross hack...
Layout const & old_layout = pars.begin()->layout(); Layout const & old_layout = pars.begin()->layout();

View File

@ -113,7 +113,7 @@ RenderPreview::getPreviewImage(Buffer const & buffer) const
void RenderPreview::metrics(MetricsInfo & mi, Dimension & dim) const void RenderPreview::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
LBUFERR(mi.base.bv, _("Text metrics error.")); LBUFERR(mi.base.bv);
graphics::PreviewImage const * const pimage = graphics::PreviewImage const * const pimage =
getPreviewImage(mi.base.bv->buffer()); getPreviewImage(mi.base.bv->buffer());
@ -139,7 +139,7 @@ void RenderPreview::metrics(MetricsInfo & mi, Dimension & dim) const
void RenderPreview::draw(PainterInfo & pi, int x, int y) const void RenderPreview::draw(PainterInfo & pi, int x, int y) const
{ {
LBUFERR(pi.base.bv, _("Painter has no BufferView!")); LBUFERR(pi.base.bv);
graphics::PreviewImage const * const pimage = graphics::PreviewImage const * const pimage =
getPreviewImage(pi.base.bv->buffer()); getPreviewImage(pi.base.bv->buffer());

View File

@ -1058,7 +1058,7 @@ docstring latexifyFromCursor(DocIterator const & cur, int len)
LYXERR(Debug::FIND, " with cur.lastpost=" << cur.lastpos() << ", cur.lastrow=" LYXERR(Debug::FIND, " with cur.lastpost=" << cur.lastpos() << ", cur.lastrow="
<< cur.lastrow() << ", cur.lastcol=" << cur.lastcol()); << cur.lastrow() << ", cur.lastcol=" << cur.lastcol());
Buffer const & buf = *cur.buffer(); Buffer const & buf = *cur.buffer();
LBUFERR(buf.params().isLatex(), _("Buffer type mismatch.")); LBUFERR(buf.params().isLatex());
TexRow texrow; TexRow texrow;
odocstringstream ods; odocstringstream ods;

View File

@ -90,7 +90,7 @@ MathData const & InsetMathScript::down() const
{ {
if (nargs() == 3) if (nargs() == 3)
return cell(2); return cell(2);
LBUFERR(nargs() > 1, _("Invalid number of math cells.")); LBUFERR(nargs() > 1);
return cell(1); return cell(1);
} }
@ -99,21 +99,21 @@ MathData & InsetMathScript::down()
{ {
if (nargs() == 3) if (nargs() == 3)
return cell(2); return cell(2);
LBUFERR(nargs() > 1, _("Invalid number of math cells.")); LBUFERR(nargs() > 1);
return cell(1); return cell(1);
} }
MathData const & InsetMathScript::up() const MathData const & InsetMathScript::up() const
{ {
LBUFERR(nargs() > 1, _("Invalid number of math cells.")); LBUFERR(nargs() > 1);
return cell(1); return cell(1);
} }
MathData & InsetMathScript::up() MathData & InsetMathScript::up()
{ {
LBUFERR(nargs() > 1, _("Invalid number of math cells.")); LBUFERR(nargs() > 1);
return cell(1); return cell(1);
} }

View File

@ -136,7 +136,7 @@ void MacroData::updateData() const
if (queried_) if (queried_)
return; return;
LBUFERR(buffer_, _("Corrupt macro data!")); LBUFERR(buffer_);
// Try to fix position DocIterator. Should not do anything in theory. // Try to fix position DocIterator. Should not do anything in theory.
pos_.fixIfBroken(); pos_.fixIfBroken();

View File

@ -54,14 +54,14 @@ MathData::MathData(Buffer * buf, const_iterator from, const_iterator to)
MathAtom & MathData::operator[](pos_type pos) MathAtom & MathData::operator[](pos_type pos)
{ {
LBUFERR(pos < size(), _("Invalid MathData.")); LBUFERR(pos < size());
return base_type::operator[](pos); return base_type::operator[](pos);
} }
MathAtom const & MathData::operator[](pos_type pos) const MathAtom const & MathData::operator[](pos_type pos) const
{ {
LBUFERR(pos < size(), _("Invalid MathData.")); LBUFERR(pos < size());
return base_type::operator[](pos); return base_type::operator[](pos);
} }
@ -74,7 +74,7 @@ void MathData::insert(size_type pos, MathAtom const & t)
void MathData::insert(size_type pos, MathData const & ar) void MathData::insert(size_type pos, MathData const & ar)
{ {
LBUFERR(pos <= size(), _("Invalid MathData.")); LBUFERR(pos <= size());
base_type::insert(begin() + pos, ar.begin(), ar.end()); base_type::insert(begin() + pos, ar.begin(), ar.end());
} }

View File

@ -216,7 +216,7 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
&& editing_[mi.base.bv]) { && editing_[mi.base.bv]) {
// Macro will be edited in a old-style list mode here: // Macro will be edited in a old-style list mode here:
LBUFERR(macro_, _("Text metrics error.")); LBUFERR(macro_);
Dimension fontDim; Dimension fontDim;
FontInfo labelFont = sane_font; FontInfo labelFont = sane_font;
math_font_max_dim(labelFont, fontDim.asc, fontDim.des); math_font_max_dim(labelFont, fontDim.asc, fontDim.des);
@ -253,7 +253,7 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
dim.wid += 2; dim.wid += 2;
metricsMarkers2(dim); metricsMarkers2(dim);
} else { } else {
LBUFERR(macro_, _("Text metrics error.")); LBUFERR(macro_);
// calculate metrics, hoping that all cells are seen // calculate metrics, hoping that all cells are seen
macro_->lock(); macro_->lock();

View File

@ -846,7 +846,7 @@ void fixMacroInstances(Cursor & cur, DocIterator const & inset_pos,
for (; sit != end; ++sit) { for (; sit != end; ++sit) {
InsetMathHull * inset_hull = InsetMathHull * inset_hull =
sit->nextInset()->asInsetMath()->asHullInset(); sit->nextInset()->asInsetMath()->asHullInset();
LBUFERR(inset_hull, _("Error loading macro previews.")); LBUFERR(inset_hull);
inset_hull->reloadPreview(*sit); inset_hull->reloadPreview(*sit);
} }
cur.screenUpdateFlags(Update::Force); cur.screenUpdateFlags(Update::Force);

View File

@ -91,9 +91,8 @@ RowPainter::RowPainter(PainterInfo & pi,
//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl; //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
//row_.dump(); //row_.dump();
LBUFERR(pit >= 0, _("Unable to initialize row painter!")); LBUFERR(pit >= 0);
LBUFERR(pit < int(text.paragraphs().size()), LBUFERR(pit < int(text.paragraphs().size()));
_("Unable to initialize row painter!"));
} }

View File

@ -67,7 +67,7 @@ void init_package(string const & command_line_arg0,
Package const & package() Package const & package()
{ {
LAPPERR(initialised_, _("Package not initialized.")); LAPPERR(initialised_);
return package_; return package_;
} }

View File

@ -57,33 +57,39 @@ docstring formatHelper(docstring const & msg,
} }
void doWarnIf(char const * expr, docstring const & msg, char const * file, long line) void doWarnIf(char const * expr, char const * file, long line)
{ {
static const docstring d =
from_ascii(N_("It should be safe to continue, but you may wish to save your work and restart LyX."));
LYXERR0("ASSERTION " << expr << " VIOLATED IN " << file << ":" << line); LYXERR0("ASSERTION " << expr << " VIOLATED IN " << file << ":" << line);
// comment this out if not needed // comment this out if not needed
BOOST_ASSERT(false); BOOST_ASSERT(false);
throw ExceptionMessage(WarningException, _("Warning!"), throw ExceptionMessage(WarningException, _("Warning!"),
formatHelper(msg, expr, file, line)); formatHelper(d, expr, file, line));
} }
void doBufErr(char const * expr, docstring const & msg, char const * file, long line) void doBufErr(char const * expr, char const * file, long line)
{ {
static const docstring d =
from_ascii(N_("There has been an error with this document. LyX will attempt to close it safely."));
LYXERR0("ASSERTION " << expr << " VIOLATED IN " << file << ":" << line); LYXERR0("ASSERTION " << expr << " VIOLATED IN " << file << ":" << line);
// comment this out if not needed // comment this out if not needed
BOOST_ASSERT(false); BOOST_ASSERT(false);
throw ExceptionMessage(BufferException, _("Buffer Error!"), throw ExceptionMessage(BufferException, _("Buffer Error!"),
formatHelper(msg, expr, file, line)); formatHelper(d, expr, file, line));
} }
void doAppErr(char const * expr, docstring const & msg, char const * file, long line) void doAppErr(char const * expr, char const * file, long line)
{ {
static const docstring d =
from_ascii(N_("LyX has encountered an application error and will now shut down."));
LYXERR0("ASSERTION " << expr << " VIOLATED IN " << file << ":" << line); LYXERR0("ASSERTION " << expr << " VIOLATED IN " << file << ":" << line);
// comment this out if not needed // comment this out if not needed
BOOST_ASSERT(false); BOOST_ASSERT(false);
throw ExceptionMessage(ErrorException, _("Fatal Exception!"), throw ExceptionMessage(ErrorException, _("Fatal Exception!"),
formatHelper(msg, expr, file, line)); formatHelper(d, expr, file, line));
} }

View File

@ -41,19 +41,19 @@ LASSERT(expr, escape)
mean resetting some variables to values known to be sane; it might mean mean resetting some variables to values known to be sane; it might mean
taking some other corrective action. taking some other corrective action.
LWARNIF(expr, msg) LWARNIF(expr)
This macro should be used when a failure of expr indicates that the current This macro should be used when a failure of expr indicates that the current
operation cannot safely be completed. In release mode, it will abort that operation cannot safely be completed. In release mode, it will abort that
operation and print a warning message to the user. operation and print a warning message to the user.
LBUFERR(expr, msg) LBUFERR(expr)
This macro should be used when a failure of expr indicates a problem with a This macro should be used when a failure of expr indicates a problem with a
Buffer or its related objects, e.g., a Cursor. In release mode, it throws a Buffer or its related objects, e.g., a Cursor. In release mode, it throws a
BufferException, which will typically result in an emergency save of that BufferException, which will typically result in an emergency save of that
particular Buffer. The msg will be displayed to the user and so should be particular Buffer. The msg will be displayed to the user and so should be
internationalized. internationalized.
LAPPERR(expr, msg) LAPPERR(expr)
This macro should be used if a failure of expr is incompatible with LyX This macro should be used if a failure of expr is incompatible with LyX
continuing to operate at all. In release mode, this issues an ErrorException, continuing to operate at all. In release mode, this issues an ErrorException,
which typically results in an emergency shutdown. The msg will be displayed which typically results in an emergency shutdown. The msg will be displayed
@ -63,9 +63,9 @@ LAPPERR(expr, msg)
void doAssert(char const * expr, char const * file, long line); void doAssert(char const * expr, char const * file, long line);
void doWarnIf(char const * expr, docstring const & msg, char const * file, long line); void doWarnIf(char const * expr, char const * file, long line);
void doBufErr(char const * expr, docstring const & msg, char const * file, long line); void doBufErr(char const * expr, char const * file, long line);
void doAppErr(char const * expr, docstring const & msg, char const * file, long line); void doAppErr(char const * expr, char const * file, long line);
/// Print demangled callstack to stderr /// Print demangled callstack to stderr
void printCallStack(); void printCallStack();
@ -79,14 +79,14 @@ void printCallStack();
#define LASSERT(expr, escape) \ #define LASSERT(expr, escape) \
if (expr) {} else { lyx::doAssert(#expr, __FILE__, __LINE__); escape; } if (expr) {} else { lyx::doAssert(#expr, __FILE__, __LINE__); escape; }
#define LWARNIF(expr, msg) \ #define LWARNIF(expr) \
if (expr) {} else { lyx::doWarnIf(#expr, msg, __FILE__, __LINE__); } if (expr) {} else { lyx::doWarnIf(#expr, __FILE__, __LINE__); }
#define LBUFERR(expr, msg) \ #define LBUFERR(expr) \
if (expr) {} else { lyx::doBufErr(#expr, msg, __FILE__, __LINE__); } if (expr) {} else { lyx::doBufErr(#expr, __FILE__, __LINE__); }
#define LAPPERR(expr, msg) \ #define LAPPERR(expr) \
if (expr) {} else { lyx::doAppErr(#expr, msg, __FILE__, __LINE__); } if (expr) {} else { lyx::doAppErr(#expr, __FILE__, __LINE__); }
#endif #endif
#endif // LASSERT #endif // LASSERT