mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
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:
parent
06d72d6ca0
commit
d79225ae98
@ -607,7 +607,7 @@ void Buffer::changed(bool update_metrics) const
|
||||
|
||||
frontend::WorkAreaManager & Buffer::workAreaManager() const
|
||||
{
|
||||
LBUFERR(d->wa_, _("Unable to find WorkArea for Buffer!"));
|
||||
LBUFERR(d->wa_);
|
||||
return *d->wa_;
|
||||
}
|
||||
|
||||
@ -4256,7 +4256,7 @@ void Buffer::setBuffersForInsets() 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
|
||||
Buffer const * const master = masterBuffer();
|
||||
|
@ -335,7 +335,7 @@ BufferParams::Impl::Impl()
|
||||
BufferParams::Impl *
|
||||
BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr)
|
||||
{
|
||||
LBUFERR(ptr, _("Attempting to clone non-existent BufferParams!"));
|
||||
LBUFERR(ptr);
|
||||
return new BufferParams::Impl(*ptr);
|
||||
}
|
||||
|
||||
|
@ -876,7 +876,7 @@ bool BufferView::scrollToCursor(DocIterator const & dit, bool recenter)
|
||||
|
||||
if (tm.contains(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.
|
||||
CursorSlice const & cs = dit.innerTextSlice();
|
||||
int offset = coordOffset(dit).y_;
|
||||
@ -2401,7 +2401,7 @@ TextMetrics const & BufferView::textMetrics(Text const * t) const
|
||||
|
||||
TextMetrics & BufferView::textMetrics(Text const * t)
|
||||
{
|
||||
LBUFERR(t, from_ascii(""));
|
||||
LBUFERR(t);
|
||||
TextMetricsCache::iterator tmc_it = d->text_metrics_.find(t);
|
||||
if (tmc_it == d->text_metrics_.end()) {
|
||||
tmc_it = d->text_metrics_.insert(
|
||||
@ -2792,7 +2792,7 @@ Point BufferView::coordOffset(DocIterator const & dit) const
|
||||
TextMetrics const & tm = textMetrics(sl.text());
|
||||
ParagraphMetrics const & pm = tm.parMetrics(sl.pit());
|
||||
|
||||
LBUFERR(!pm.rows().empty(), from_ascii(""));
|
||||
LBUFERR(!pm.rows().empty());
|
||||
y -= pm.rows()[0].ascent();
|
||||
#if 1
|
||||
// FIXME: document this mess
|
||||
|
@ -261,7 +261,7 @@ void Counters::step(docstring const & ctr, UpdateType utype)
|
||||
|
||||
it->second.step();
|
||||
if (utype == OutputUpdate) {
|
||||
LBUFERR(!counter_stack_.empty(), _("Empty counter stack!"));
|
||||
LBUFERR(!counter_stack_.empty());
|
||||
counter_stack_.pop_back();
|
||||
counter_stack_.push_back(ctr);
|
||||
}
|
||||
@ -597,7 +597,7 @@ docstring Counters::prettyCounter(docstring const & name,
|
||||
|
||||
docstring Counters::currentCounter() const
|
||||
{
|
||||
LBUFERR(!counter_stack_.empty(), _("Empty counter stack!"));
|
||||
LBUFERR(!counter_stack_.empty());
|
||||
return counter_stack_.back();
|
||||
}
|
||||
|
||||
|
@ -460,14 +460,14 @@ DispatchResult const & Cursor::result() const
|
||||
|
||||
BufferView & Cursor::bv() const
|
||||
{
|
||||
LBUFERR(bv_, _("Cursor has no BufferView!"));
|
||||
LBUFERR(bv_);
|
||||
return *bv_;
|
||||
}
|
||||
|
||||
|
||||
void Cursor::pop()
|
||||
{
|
||||
LBUFERR(depth() >= 1, _("Attempt to pop empty cursor!"));
|
||||
LBUFERR(depth() >= 1);
|
||||
pop_back();
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ CursorSlice::CursorSlice()
|
||||
CursorSlice::CursorSlice(Inset & p)
|
||||
: 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
|
||||
{
|
||||
LBUFERR(inset_, _("Cursor slice not properly initialized!"));
|
||||
LBUFERR(inset_);
|
||||
InsetMath const * math = inset_->asInsetMath();
|
||||
bool paramless_macro = math && math->asMacro() && !math->asMacro()->nargs();
|
||||
return math ? (paramless_macro ? 0 : cell().size())
|
||||
|
@ -685,7 +685,7 @@ void switchBetweenClasses(DocumentClassConstPtr oldone,
|
||||
{
|
||||
errorlist.clear();
|
||||
|
||||
LBUFERR(!in.paragraphs().empty(), from_ascii(""));
|
||||
LBUFERR(!in.paragraphs().empty());
|
||||
if (oldone == newone)
|
||||
return;
|
||||
|
||||
@ -803,7 +803,7 @@ void cutSelection(Cursor & cur, bool doclear, bool realcut)
|
||||
|
||||
if (cur.inTexted()) {
|
||||
Text * text = cur.text();
|
||||
LBUFERR(text, _("Invalid cursor!"));
|
||||
LBUFERR(text);
|
||||
|
||||
saveSelection(cur);
|
||||
|
||||
@ -912,7 +912,7 @@ void copySelectionToStack(Cursor const & cur, CutStack & cutstack)
|
||||
|
||||
if (cur.inTexted()) {
|
||||
Text * text = cur.text();
|
||||
LBUFERR(text, _("Invalid cursor!"));
|
||||
LBUFERR(text);
|
||||
// ok we have a selection. This is always between cur.selBegin()
|
||||
// and sel_end cursor
|
||||
|
||||
@ -1026,7 +1026,7 @@ void pasteParagraphList(Cursor & cur, ParagraphList const & parlist,
|
||||
{
|
||||
if (cur.inTexted()) {
|
||||
Text * text = cur.text();
|
||||
LBUFERR(text, _("Invalid cursor!"));
|
||||
LBUFERR(text);
|
||||
|
||||
PasteReturnValue prv =
|
||||
pasteSelectionHelper(cur, parlist, docclass, errorList);
|
||||
|
@ -82,7 +82,7 @@ DocIterator DocIterator::clone(Buffer * buffer) const
|
||||
DocIterator dit(buffer);
|
||||
size_t const n = slices_.size();
|
||||
for (size_t i = 0 ; i != n; ++i) {
|
||||
LBUFERR(inset, _("Iterator slice not properly initialized!"));
|
||||
LBUFERR(inset);
|
||||
dit.push_back(slices_[i]);
|
||||
dit.top().inset_ = inset;
|
||||
if (i + 1 != n)
|
||||
@ -183,7 +183,7 @@ Paragraph & DocIterator::paragraph() const
|
||||
{
|
||||
if (!inTexted()) {
|
||||
LYXERR0(*this);
|
||||
LBUFERR(false, _("DocIterator::paragraph() called outside Text."));
|
||||
LBUFERR(false);
|
||||
}
|
||||
return top().paragraph();
|
||||
}
|
||||
@ -191,7 +191,7 @@ Paragraph & DocIterator::paragraph() const
|
||||
|
||||
Paragraph & DocIterator::innerParagraph() const
|
||||
{
|
||||
LBUFERR(!empty(), _("Empty DocIterator."));
|
||||
LBUFERR(!empty());
|
||||
return innerTextSlice().paragraph();
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ FontSpan DocIterator::locateWord(word_location const loc) const
|
||||
|
||||
CursorSlice const & DocIterator::innerTextSlice() const
|
||||
{
|
||||
LBUFERR(!empty(), from_ascii(""));
|
||||
LBUFERR(!empty());
|
||||
// go up until first non-0 text is hit
|
||||
// (innermost text is 0 in mathed)
|
||||
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_
|
||||
// be inside a Text.
|
||||
LBUFERR(false, from_ascii(""));
|
||||
LBUFERR(false);
|
||||
// Squash warning
|
||||
static const CursorSlice c;
|
||||
return c;
|
||||
@ -468,7 +468,7 @@ void DocIterator::updateInsets(Inset * inset)
|
||||
size_t const n = slices_.size();
|
||||
slices_.resize(0);
|
||||
for (size_t i = 0 ; i < n; ++i) {
|
||||
LBUFERR(inset, _("Improperly initialized DocIterator."));
|
||||
LBUFERR(inset);
|
||||
push_back(dit[i]);
|
||||
top().inset_ = inset;
|
||||
if (i + 1 != n)
|
||||
|
44
src/LyX.cpp
44
src/LyX.cpp
@ -520,7 +520,7 @@ bool LyX::loadFiles()
|
||||
|
||||
void execBatchCommands()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
singleton_->execCommands();
|
||||
}
|
||||
|
||||
@ -1268,35 +1268,35 @@ void LyX::easyParse(int & argc, char * argv[])
|
||||
|
||||
FuncStatus getStatus(FuncRequest const & action)
|
||||
{
|
||||
LAPPERR(theApp(), _("Appplication not initialized."));
|
||||
LAPPERR(theApp());
|
||||
return theApp()->getStatus(action);
|
||||
}
|
||||
|
||||
|
||||
void dispatch(FuncRequest const & action)
|
||||
{
|
||||
LAPPERR(theApp(), _("Appplication not initialized."));
|
||||
LAPPERR(theApp());
|
||||
return theApp()->dispatch(action);
|
||||
}
|
||||
|
||||
|
||||
void dispatch(FuncRequest const & action, DispatchResult & dr)
|
||||
{
|
||||
LAPPERR(theApp(), _("Appplication not initialized."));
|
||||
LAPPERR(theApp());
|
||||
return theApp()->dispatch(action, dr);
|
||||
}
|
||||
|
||||
|
||||
vector<string> & theFilesToLoad()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->files_to_load_;
|
||||
}
|
||||
|
||||
|
||||
BufferList & theBufferList()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->buffer_list_;
|
||||
}
|
||||
|
||||
@ -1304,8 +1304,8 @@ BufferList & theBufferList()
|
||||
Server & theServer()
|
||||
{
|
||||
// FIXME: this should not be use_gui dependent
|
||||
LWARNIF(use_gui, _("LyX server can only be used with GUI."));
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LWARNIF(use_gui);
|
||||
LAPPERR(singleton_);
|
||||
return *singleton_->pimpl_->lyx_server_.get();
|
||||
}
|
||||
|
||||
@ -1313,71 +1313,71 @@ Server & theServer()
|
||||
ServerSocket & theServerSocket()
|
||||
{
|
||||
// FIXME: this should not be use_gui dependent
|
||||
LWARNIF(use_gui, _("LyX server can only be used with GUI."));
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LWARNIF(use_gui);
|
||||
LAPPERR(singleton_);
|
||||
return *singleton_->pimpl_->lyx_socket_.get();
|
||||
}
|
||||
|
||||
|
||||
KeyMap & theTopLevelKeymap()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->toplevel_keymap_;
|
||||
}
|
||||
|
||||
|
||||
Converters & theConverters()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->converters_;
|
||||
}
|
||||
|
||||
|
||||
Converters & theSystemConverters()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->system_converters_;
|
||||
}
|
||||
|
||||
|
||||
Movers & theMovers()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->movers_;
|
||||
}
|
||||
|
||||
|
||||
Mover const & getMover(string const & fmt)
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->movers_(fmt);
|
||||
}
|
||||
|
||||
|
||||
void setMover(string const & fmt, string const & command)
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
singleton_->pimpl_->movers_.set(fmt, command);
|
||||
}
|
||||
|
||||
|
||||
Movers & theSystemMovers()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->system_movers_;
|
||||
}
|
||||
|
||||
|
||||
Messages const & getMessages(string const & language)
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->messages(language);
|
||||
}
|
||||
|
||||
|
||||
Messages const & getGuiMessages()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
// A cache to translate full language name to language code
|
||||
static string last_language = "auto";
|
||||
static string code;
|
||||
@ -1396,14 +1396,14 @@ Messages const & getGuiMessages()
|
||||
|
||||
Session & theSession()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return *singleton_->pimpl_->session_.get();
|
||||
}
|
||||
|
||||
|
||||
LaTeXFonts & theLaTeXFonts()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
if (!singleton_->pimpl_->latexfonts_)
|
||||
singleton_->pimpl_->latexfonts_ = new LaTeXFonts;
|
||||
return *singleton_->pimpl_->latexfonts_;
|
||||
@ -1412,7 +1412,7 @@ LaTeXFonts & theLaTeXFonts()
|
||||
|
||||
CmdDef & theTopLevelCmdDef()
|
||||
{
|
||||
LAPPERR(singleton_, _("Appplication not initialized."));
|
||||
LAPPERR(singleton_);
|
||||
return singleton_->pimpl_->toplevel_cmddef_;
|
||||
}
|
||||
|
||||
|
@ -660,8 +660,7 @@ void Paragraph::setChange(pos_type pos, Change const & change)
|
||||
|
||||
Change const & Paragraph::lookupChange(pos_type pos) const
|
||||
{
|
||||
LBUFERR(pos >= 0 && pos <= size(),
|
||||
_("Invalid position given to lookupChange()"));
|
||||
LBUFERR(pos >= 0 && pos <= size());
|
||||
return d->changes_.lookup(pos);
|
||||
}
|
||||
|
||||
@ -1044,7 +1043,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
|
||||
unsigned int & column)
|
||||
{
|
||||
Inset * inset = owner_->getInset(i);
|
||||
LBUFERR(inset, from_ascii(""));
|
||||
LBUFERR(inset);
|
||||
|
||||
if (style.pass_thru) {
|
||||
odocstringstream ods;
|
||||
@ -1806,7 +1805,7 @@ Font const & Paragraph::getFontSettings(BufferParams const & bparams,
|
||||
{
|
||||
if (pos > size()) {
|
||||
LYXERR0("pos: " << pos << " size: " << size());
|
||||
LBUFERR(false, _("Invalid position."));
|
||||
LBUFERR(false);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
LBUFERR(pos <= size(), _("Invalid position"));
|
||||
LBUFERR(pos <= size());
|
||||
|
||||
// Last position is a special case. I suspect that it would
|
||||
// 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 & outerfont) const
|
||||
{
|
||||
LBUFERR(pos >= 0, _("Invalid position."));
|
||||
LBUFERR(pos >= 0);
|
||||
|
||||
Font font = getFontSettings(bparams, pos);
|
||||
|
||||
@ -3263,7 +3262,7 @@ void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tclass)
|
||||
|
||||
Inset const & Paragraph::inInset() const
|
||||
{
|
||||
LBUFERR(d->inset_owner_, _("Paragraph not properly initialized"));
|
||||
LBUFERR(d->inset_owner_);
|
||||
return *d->inset_owner_;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ void ParagraphMetrics::setInsetDimension(Inset const * inset,
|
||||
|
||||
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
|
||||
// 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
|
||||
{
|
||||
LBUFERR(!rows().empty(), _("ParagraphMetrics has no rows!"));
|
||||
LBUFERR(!rows().empty());
|
||||
|
||||
// If boundary is set we should return the row on which
|
||||
// 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
|
||||
{
|
||||
LBUFERR(!rows().empty(), _("ParagraphMetrics has no rows!"));
|
||||
LBUFERR(!rows().empty());
|
||||
|
||||
RowList::const_iterator rit = rows_.end();
|
||||
RowList::const_iterator const begin = rows_.begin();
|
||||
|
38
src/Text.cpp
38
src/Text.cpp
@ -726,7 +726,7 @@ static void breakParagraph(Text & text, pit_type par_offset, pos_type pos,
|
||||
|
||||
void Text::breakParagraph(Cursor & cur, bool inverse_logic)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
Paragraph & cpar = cur.paragraph();
|
||||
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
|
||||
void Text::insertChar(Cursor & cur, char_type c)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
cur.recordUndo(INSERT_UNDO);
|
||||
|
||||
@ -1033,7 +1033,7 @@ void Text::charInserted(Cursor & cur)
|
||||
&& !par.isWordSeparator(cur.pos() - 2)
|
||||
&& par.isWordSeparator(cur.pos() - 1)) {
|
||||
// get the word in front of cursor
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
cur.paragraph().updateWords();
|
||||
}
|
||||
}
|
||||
@ -1044,7 +1044,7 @@ void Text::charInserted(Cursor & cur)
|
||||
|
||||
bool Text::cursorForwardOneWord(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
pos_type const lastpos = cur.lastpos();
|
||||
pit_type pit = cur.pit();
|
||||
@ -1091,7 +1091,7 @@ bool Text::cursorForwardOneWord(Cursor & cur)
|
||||
|
||||
bool Text::cursorBackwardOneWord(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
pit_type pit = cur.pit();
|
||||
pos_type pos = cur.pos();
|
||||
@ -1132,7 +1132,7 @@ bool Text::cursorBackwardOneWord(Cursor & cur)
|
||||
|
||||
bool Text::cursorVisLeftOneWord(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
pos_type left_pos, right_pos;
|
||||
bool left_is_letter, right_is_letter;
|
||||
@ -1169,7 +1169,7 @@ bool Text::cursorVisLeftOneWord(Cursor & cur)
|
||||
|
||||
bool Text::cursorVisRightOneWord(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
pos_type left_pos, right_pos;
|
||||
bool left_is_letter, right_is_letter;
|
||||
@ -1208,7 +1208,7 @@ bool Text::cursorVisRightOneWord(Cursor & cur)
|
||||
|
||||
void Text::selectWord(Cursor & cur, word_location loc)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
CursorSlice from = cur.top();
|
||||
CursorSlice to = cur.top();
|
||||
getWord(from, to, loc);
|
||||
@ -1226,7 +1226,7 @@ void Text::selectWord(Cursor & cur, word_location loc)
|
||||
|
||||
void Text::selectAll(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
if (cur.lastpos() == 0 && cur.lastpit() == 0)
|
||||
return;
|
||||
// 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
|
||||
bool Text::selectWordWhenUnderCursor(Cursor & cur, word_location loc)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
if (cur.selection())
|
||||
return false;
|
||||
selectWord(cur, loc);
|
||||
@ -1257,7 +1257,7 @@ bool Text::selectWordWhenUnderCursor(Cursor & cur, word_location loc)
|
||||
|
||||
void Text::acceptOrRejectChanges(Cursor & cur, ChangeOp op)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
if (!cur.selection()) {
|
||||
bool const changed = cur.paragraph().isChanged(cur.pos());
|
||||
@ -1412,7 +1412,7 @@ void Text::rejectChanges()
|
||||
|
||||
void Text::deleteWordForward(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
if (cur.lastpos() == 0)
|
||||
cursorForward(cur);
|
||||
else {
|
||||
@ -1428,7 +1428,7 @@ void Text::deleteWordForward(Cursor & cur)
|
||||
|
||||
void Text::deleteWordBackward(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
if (cur.lastpos() == 0)
|
||||
cursorBackward(cur);
|
||||
else {
|
||||
@ -1445,7 +1445,7 @@ void Text::deleteWordBackward(Cursor & cur)
|
||||
// Kill to end of line.
|
||||
void Text::changeCase(Cursor & cur, TextCase action)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
CursorSlice from;
|
||||
CursorSlice to;
|
||||
|
||||
@ -1574,7 +1574,7 @@ bool Text::erase(Cursor & cur)
|
||||
|
||||
bool Text::backspacePos0(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
if (cur.pit() == 0)
|
||||
return false;
|
||||
|
||||
@ -1627,7 +1627,7 @@ bool Text::backspacePos0(Cursor & cur)
|
||||
|
||||
bool Text::backspace(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
bool needsUpdate = false;
|
||||
if (cur.pos() == 0) {
|
||||
if (cur.pit() == 0)
|
||||
@ -1829,7 +1829,7 @@ bool Text::read(Lexer & lex,
|
||||
// Returns the current font and depth as a message.
|
||||
docstring Text::currentState(Cursor const & cur) const
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
Buffer & buf = *cur.buffer();
|
||||
Paragraph const & par = cur.paragraph();
|
||||
odocstringstream os;
|
||||
@ -2015,7 +2015,7 @@ void Text::forToc(docstring & os, size_t maxlen, bool shorten) const
|
||||
|
||||
void Text::charsTranspose(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
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*/)
|
||||
{
|
||||
LBUFERR(cur.bv().cursor() == cur, _("Invalid cursor."));
|
||||
LBUFERR(cur.bv().cursor() == cur);
|
||||
cur.insert(s);
|
||||
cur.bv().cursor() = cur;
|
||||
if (!(cur.result().screenUpdate() & Update::Force))
|
||||
|
@ -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
|
||||
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 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
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
// this happens when selecting several cells in tabular (bug 2630)
|
||||
if (cur.selBegin().idx() != cur.selEnd().idx())
|
||||
return false;
|
||||
@ -238,7 +238,7 @@ bool Text::changeDepthAllowed(Cursor & cur, DEPTH_CHANGE type) const
|
||||
|
||||
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 end = cur.selEnd().pit() + 1;
|
||||
cur.recordUndoSelection();
|
||||
@ -383,21 +383,21 @@ void Text::setFont(BufferView const & bv, CursorSlice const & begin,
|
||||
|
||||
bool Text::cursorTop(Cursor & cur)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
return setCursor(cur, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
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 (font.fontInfo() == ignore_font && font.language() == ignore_language) {
|
||||
// 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)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
if (cur.selection())
|
||||
return cur.selectionAsString(false);
|
||||
@ -482,7 +482,7 @@ void Text::setLabelWidthStringToSequence(Cursor const & cur,
|
||||
|
||||
void Text::setParagraphs(Cursor & cur, docstring arg, bool merge)
|
||||
{
|
||||
LBUFERR(cur.text(), _("Uninitalized cursor."));
|
||||
LBUFERR(cur.text());
|
||||
|
||||
//FIXME UNICODE
|
||||
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)
|
||||
{
|
||||
LBUFERR(cur.text(), _("Uninitalized cursor."));
|
||||
LBUFERR(cur.text());
|
||||
|
||||
depth_type priordepth = -1;
|
||||
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.
|
||||
void Text::insertInset(Cursor & cur, Inset * inset)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(inset, _("Uninitialized Text."));
|
||||
LBUFERR(this == cur.text());
|
||||
LBUFERR(inset);
|
||||
cur.paragraph().insertInset(cur.pos(), inset, cur.current_font,
|
||||
Change(cur.buffer()->params().trackChanges
|
||||
? Change::INSERTED : Change::UNCHANGED));
|
||||
@ -585,7 +585,7 @@ void Text::setCursor(CursorSlice & cur, pit_type par, pos_type pos)
|
||||
void Text::setCursorIntern(Cursor & cur,
|
||||
pit_type par, pos_type pos, bool setfont, bool boundary)
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
cur.boundary(boundary);
|
||||
setCursor(cur.top(), par, pos);
|
||||
if (setfont)
|
||||
|
@ -488,7 +488,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// at the end?
|
||||
cur.noScreenUpdate();
|
||||
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
CursorSlice const oldTopSlice = cur.top();
|
||||
bool const oldBoundary = cur.boundary();
|
||||
bool const oldSelection = cur.selection();
|
||||
@ -2377,7 +2377,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
FuncStatus & flag) const
|
||||
{
|
||||
LBUFERR(this == cur.text(), _("Invalid cursor."));
|
||||
LBUFERR(this == cur.text());
|
||||
|
||||
FontInfo const & fontinfo = cur.real_current_font.fontInfo();
|
||||
bool enable = true;
|
||||
|
@ -129,7 +129,7 @@ static int numberOfHfills(Paragraph const & par, Row const & row)
|
||||
TextMetrics::TextMetrics(BufferView * bv, Text * text)
|
||||
: bv_(bv), text_(text)
|
||||
{
|
||||
LBUFERR(bv_, _("Text metrics error."));
|
||||
LBUFERR(bv_);
|
||||
max_width_ = bv_->workWidth();
|
||||
dim_.wid = max_width_;
|
||||
dim_.asc = 10;
|
||||
@ -159,7 +159,7 @@ pair<pit_type, ParagraphMetrics const *> TextMetrics::first() 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();
|
||||
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)
|
||||
{
|
||||
LBUFERR(mi.base.textwidth > 0, _("Text metrics error."));
|
||||
LBUFERR(mi.base.textwidth > 0);
|
||||
max_width_ = mi.base.textwidth;
|
||||
// backup old dimension.
|
||||
Dimension const old_dim = dim_;
|
||||
@ -417,7 +417,7 @@ bool TextMetrics::redoParagraph(pit_type const pit)
|
||||
// should be.
|
||||
bv_->buffer().updateBuffer();
|
||||
parPos = text_->macrocontextPosition();
|
||||
LBUFERR(!parPos.empty(), _("Text metrics error."));
|
||||
LBUFERR(!parPos.empty());
|
||||
parPos.pit() = pit;
|
||||
}
|
||||
|
||||
@ -693,7 +693,7 @@ int TextMetrics::labelFill(pit_type const pit, Row const & row) const
|
||||
Paragraph const & par = text_->getPar(pit);
|
||||
|
||||
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
|
||||
--last;
|
||||
@ -1343,7 +1343,7 @@ pos_type TextMetrics::x2pos(pit_type pit, int row, int x) const
|
||||
// upDownInText() while in selection mode.
|
||||
ParagraphMetrics const & pm = parMetrics(pit);
|
||||
|
||||
LBUFERR(row < int(pm.rows().size()), _("Text metrics error."));
|
||||
LBUFERR(row < int(pm.rows().size()));
|
||||
bool bound = false;
|
||||
Row const & r = pm.rows()[row];
|
||||
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];
|
||||
|
||||
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 rlast = pm.rows().end();
|
||||
--rlast;
|
||||
@ -1557,7 +1557,7 @@ void TextMetrics::setCursorFromCoordinates(Cursor & cur, int const x, int const
|
||||
" pit: " << pit << " yy: " << yy);
|
||||
|
||||
int r = 0;
|
||||
LBUFERR(pm.rows().size(), _("Text metrics error."));
|
||||
LBUFERR(pm.rows().size());
|
||||
for (; r < int(pm.rows().size()) - 1; ++r) {
|
||||
Row const & row = pm.rows()[r];
|
||||
if (int(yy + row.height()) > y)
|
||||
|
10
src/Undo.cpp
10
src/Undo.cpp
@ -341,7 +341,7 @@ void Undo::Private::doRecordUndo(UndoKind kind,
|
||||
// main Text _is_ the whole document.
|
||||
// record the relevant paragraphs
|
||||
Text const * text = cell.text();
|
||||
LBUFERR(text, _("Uninitialized cell."));
|
||||
LBUFERR(text);
|
||||
ParagraphList const & plist = text->paragraphs();
|
||||
ParagraphList::const_iterator first = plist.begin();
|
||||
advance(first, first_pit);
|
||||
@ -401,7 +401,7 @@ void Undo::Private::doTextUndoOrRedo(CursorData & cur, UndoElementStack & stack,
|
||||
//LYXERR0("undo, performing: " << undo);
|
||||
DocIterator dit = undo.cell.asDocIterator(&buffer_);
|
||||
if (undo.isFullBuffer) {
|
||||
LBUFERR(undo.pars, _("Undo stack is corrupt!"));
|
||||
LBUFERR(undo.pars);
|
||||
// This is a full document
|
||||
delete otherstack.top().bparams;
|
||||
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
|
||||
// all math inset cells have just one paragraph!)
|
||||
//LYXERR0("undo.array: " << *undo.array);
|
||||
LBUFERR(undo.array, _("Undo stack is corrupt!"));
|
||||
LBUFERR(undo.array);
|
||||
dit.cell().swap(*undo.array);
|
||||
delete undo.array;
|
||||
undo.array = 0;
|
||||
} else {
|
||||
// Some finer machinery is needed here.
|
||||
Text * text = dit.text();
|
||||
LBUFERR(text, _("Invalid cursor."));
|
||||
LBUFERR(undo.pars, _("Undo stack is corrupt!"));
|
||||
LBUFERR(text);
|
||||
LBUFERR(undo.pars);
|
||||
ParagraphList & plist = text->paragraphs();
|
||||
|
||||
// remove new stuff between first and last
|
||||
|
@ -118,16 +118,14 @@ BufferView const * Dialog::bufferview() const
|
||||
|
||||
Buffer const & Dialog::buffer() const
|
||||
{
|
||||
LAPPERR(lyxview_->currentBufferView(),
|
||||
_("Dialog has no associated Buffer!"));
|
||||
LAPPERR(lyxview_->currentBufferView());
|
||||
return lyxview_->currentBufferView()->buffer();
|
||||
}
|
||||
|
||||
|
||||
Buffer const & Dialog::documentBuffer() const
|
||||
{
|
||||
LAPPERR(lyxview_->currentBufferView(),
|
||||
_("Dialog has no associated Buffer!"));
|
||||
LAPPERR(lyxview_->currentBufferView());
|
||||
return lyxview_->documentBufferView()->buffer();
|
||||
}
|
||||
|
||||
|
@ -2480,7 +2480,7 @@ void GuiApplication::commitData(QSessionManager & sm)
|
||||
|
||||
void GuiApplication::unregisterView(GuiView * gv)
|
||||
{
|
||||
LAPPERR(d->views_[gv->id()] == gv, _("Application error."));
|
||||
LAPPERR(d->views_[gv->id()] == gv);
|
||||
d->views_.remove(gv->id());
|
||||
if (current_view_ == gv)
|
||||
current_view_ = 0;
|
||||
@ -2509,7 +2509,7 @@ bool GuiApplication::closeAllViews()
|
||||
|
||||
GuiView & GuiApplication::view(int id) const
|
||||
{
|
||||
LAPPERR(d->views_.contains(id), _("Application error.") /**/);
|
||||
LAPPERR(d->views_.contains(id));
|
||||
return *d->views_.value(id);
|
||||
}
|
||||
|
||||
@ -2824,7 +2824,7 @@ void hideDialogs(std::string const & name, Inset * inset)
|
||||
|
||||
frontend::FontLoader & theFontLoader()
|
||||
{
|
||||
LAPPERR(frontend::guiApp, _("No Gui Application."));
|
||||
LAPPERR(frontend::guiApp);
|
||||
return frontend::guiApp->fontLoader();
|
||||
}
|
||||
|
||||
@ -2837,7 +2837,7 @@ frontend::FontMetrics const & theFontMetrics(Font const & f)
|
||||
|
||||
frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
|
||||
{
|
||||
LAPPERR(frontend::guiApp, _("No Gui Application."));
|
||||
LAPPERR(frontend::guiApp);
|
||||
return frontend::guiApp->fontLoader().metrics(f);
|
||||
}
|
||||
|
||||
@ -2850,14 +2850,14 @@ frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
|
||||
|
||||
frontend::Clipboard & theClipboard()
|
||||
{
|
||||
LAPPERR(frontend::guiApp, _("No Gui Application."));
|
||||
LAPPERR(frontend::guiApp);
|
||||
return frontend::guiApp->clipboard();
|
||||
}
|
||||
|
||||
|
||||
frontend::Selection & theSelection()
|
||||
{
|
||||
LAPPERR(frontend::guiApp, _("No Gui Application."));
|
||||
LAPPERR(frontend::guiApp);
|
||||
return frontend::guiApp->selection();
|
||||
}
|
||||
|
||||
|
@ -96,10 +96,10 @@ static GuiFontInfo * fontinfo_[NUM_FAMILIES][NUM_SERIES][NUM_SHAPE][NUM_SIZE];
|
||||
GuiFontInfo & fontinfo(FontInfo const & f)
|
||||
{
|
||||
// LASSERT: Is there anything we might do here besides crash?
|
||||
LBUFERR(f.family() < NUM_FAMILIES, _("Font lookup error."));
|
||||
LBUFERR(f.series() < NUM_SERIES, _("Font lookup error."));
|
||||
LBUFERR(f.realShape() < NUM_SHAPE, _("Font lookup error."));
|
||||
LBUFERR(f.size() < NUM_SIZE, _("Font lookup error."));
|
||||
LBUFERR(f.family() < NUM_FAMILIES);
|
||||
LBUFERR(f.series() < NUM_SERIES);
|
||||
LBUFERR(f.realShape() < NUM_SHAPE);
|
||||
LBUFERR(f.size() < NUM_SIZE);
|
||||
// fi is a reference to the pointer type (GuiFontInfo *) in the
|
||||
// fontinfo_ table.
|
||||
GuiFontInfo * & fi =
|
||||
|
@ -966,7 +966,7 @@ void InsetInclude::collectBibKeys(InsetIterator const & /*di*/) const
|
||||
|
||||
void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
LBUFERR(mi.base.bv, _("Text metrics error."));
|
||||
LBUFERR(mi.base.bv);
|
||||
|
||||
bool use_preview = false;
|
||||
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
|
||||
{
|
||||
LBUFERR(pi.base.bv, _("Painter has no BufferView!"));
|
||||
LBUFERR(pi.base.bv);
|
||||
|
||||
bool use_preview = false;
|
||||
if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
|
||||
|
@ -3555,7 +3555,7 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
//lyxerr << "InsetTabular::metrics: " << mi.base.bv << " width: " <<
|
||||
// mi.base.textwidth << "\n";
|
||||
LBUFERR(mi.base.bv, _("Text metrics error."));
|
||||
LBUFERR(mi.base.bv);
|
||||
|
||||
for (row_type r = 0; r < tabular.nrows(); ++r) {
|
||||
int maxasc = 0;
|
||||
|
@ -125,7 +125,7 @@ void InsetText::setMacrocontextPositionRecursive(DocIterator const & pos)
|
||||
void InsetText::clear()
|
||||
{
|
||||
ParagraphList & pars = paragraphs();
|
||||
LBUFERR(!pars.empty(), _("Buffer corrupt!"));
|
||||
LBUFERR(!pars.empty());
|
||||
|
||||
// This is a gross hack...
|
||||
Layout const & old_layout = pars.begin()->layout();
|
||||
|
@ -113,7 +113,7 @@ RenderPreview::getPreviewImage(Buffer const & buffer) 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 =
|
||||
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
|
||||
{
|
||||
LBUFERR(pi.base.bv, _("Painter has no BufferView!"));
|
||||
LBUFERR(pi.base.bv);
|
||||
|
||||
graphics::PreviewImage const * const pimage =
|
||||
getPreviewImage(pi.base.bv->buffer());
|
||||
|
@ -1058,7 +1058,7 @@ docstring latexifyFromCursor(DocIterator const & cur, int len)
|
||||
LYXERR(Debug::FIND, " with cur.lastpost=" << cur.lastpos() << ", cur.lastrow="
|
||||
<< cur.lastrow() << ", cur.lastcol=" << cur.lastcol());
|
||||
Buffer const & buf = *cur.buffer();
|
||||
LBUFERR(buf.params().isLatex(), _("Buffer type mismatch."));
|
||||
LBUFERR(buf.params().isLatex());
|
||||
|
||||
TexRow texrow;
|
||||
odocstringstream ods;
|
||||
|
@ -90,7 +90,7 @@ MathData const & InsetMathScript::down() const
|
||||
{
|
||||
if (nargs() == 3)
|
||||
return cell(2);
|
||||
LBUFERR(nargs() > 1, _("Invalid number of math cells."));
|
||||
LBUFERR(nargs() > 1);
|
||||
return cell(1);
|
||||
}
|
||||
|
||||
@ -99,21 +99,21 @@ MathData & InsetMathScript::down()
|
||||
{
|
||||
if (nargs() == 3)
|
||||
return cell(2);
|
||||
LBUFERR(nargs() > 1, _("Invalid number of math cells."));
|
||||
LBUFERR(nargs() > 1);
|
||||
return cell(1);
|
||||
}
|
||||
|
||||
|
||||
MathData const & InsetMathScript::up() const
|
||||
{
|
||||
LBUFERR(nargs() > 1, _("Invalid number of math cells."));
|
||||
LBUFERR(nargs() > 1);
|
||||
return cell(1);
|
||||
}
|
||||
|
||||
|
||||
MathData & InsetMathScript::up()
|
||||
{
|
||||
LBUFERR(nargs() > 1, _("Invalid number of math cells."));
|
||||
LBUFERR(nargs() > 1);
|
||||
return cell(1);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ void MacroData::updateData() const
|
||||
if (queried_)
|
||||
return;
|
||||
|
||||
LBUFERR(buffer_, _("Corrupt macro data!"));
|
||||
LBUFERR(buffer_);
|
||||
|
||||
// Try to fix position DocIterator. Should not do anything in theory.
|
||||
pos_.fixIfBroken();
|
||||
|
@ -54,14 +54,14 @@ MathData::MathData(Buffer * buf, const_iterator from, const_iterator to)
|
||||
|
||||
MathAtom & MathData::operator[](pos_type pos)
|
||||
{
|
||||
LBUFERR(pos < size(), _("Invalid MathData."));
|
||||
LBUFERR(pos < size());
|
||||
return base_type::operator[](pos);
|
||||
}
|
||||
|
||||
|
||||
MathAtom const & MathData::operator[](pos_type pos) const
|
||||
{
|
||||
LBUFERR(pos < size(), _("Invalid MathData."));
|
||||
LBUFERR(pos < size());
|
||||
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)
|
||||
{
|
||||
LBUFERR(pos <= size(), _("Invalid MathData."));
|
||||
LBUFERR(pos <= size());
|
||||
base_type::insert(begin() + pos, ar.begin(), ar.end());
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
&& editing_[mi.base.bv]) {
|
||||
// Macro will be edited in a old-style list mode here:
|
||||
|
||||
LBUFERR(macro_, _("Text metrics error."));
|
||||
LBUFERR(macro_);
|
||||
Dimension fontDim;
|
||||
FontInfo labelFont = sane_font;
|
||||
math_font_max_dim(labelFont, fontDim.asc, fontDim.des);
|
||||
@ -253,7 +253,7 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
dim.wid += 2;
|
||||
metricsMarkers2(dim);
|
||||
} else {
|
||||
LBUFERR(macro_, _("Text metrics error."));
|
||||
LBUFERR(macro_);
|
||||
|
||||
// calculate metrics, hoping that all cells are seen
|
||||
macro_->lock();
|
||||
|
@ -846,7 +846,7 @@ void fixMacroInstances(Cursor & cur, DocIterator const & inset_pos,
|
||||
for (; sit != end; ++sit) {
|
||||
InsetMathHull * inset_hull =
|
||||
sit->nextInset()->asInsetMath()->asHullInset();
|
||||
LBUFERR(inset_hull, _("Error loading macro previews."));
|
||||
LBUFERR(inset_hull);
|
||||
inset_hull->reloadPreview(*sit);
|
||||
}
|
||||
cur.screenUpdateFlags(Update::Force);
|
||||
|
@ -91,9 +91,8 @@ RowPainter::RowPainter(PainterInfo & pi,
|
||||
//lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
|
||||
//row_.dump();
|
||||
|
||||
LBUFERR(pit >= 0, _("Unable to initialize row painter!"));
|
||||
LBUFERR(pit < int(text.paragraphs().size()),
|
||||
_("Unable to initialize row painter!"));
|
||||
LBUFERR(pit >= 0);
|
||||
LBUFERR(pit < int(text.paragraphs().size()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ void init_package(string const & command_line_arg0,
|
||||
|
||||
Package const & package()
|
||||
{
|
||||
LAPPERR(initialised_, _("Package not initialized."));
|
||||
LAPPERR(initialised_);
|
||||
return package_;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
// comment this out if not needed
|
||||
BOOST_ASSERT(false);
|
||||
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);
|
||||
// comment this out if not needed
|
||||
BOOST_ASSERT(false);
|
||||
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);
|
||||
// comment this out if not needed
|
||||
BOOST_ASSERT(false);
|
||||
throw ExceptionMessage(ErrorException, _("Fatal Exception!"),
|
||||
formatHelper(msg, expr, file, line));
|
||||
formatHelper(d, expr, file, line));
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,19 +41,19 @@ LASSERT(expr, escape)
|
||||
mean resetting some variables to values known to be sane; it might mean
|
||||
taking some other corrective action.
|
||||
|
||||
LWARNIF(expr, msg)
|
||||
LWARNIF(expr)
|
||||
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 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
|
||||
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
|
||||
particular Buffer. The msg will be displayed to the user and so should be
|
||||
internationalized.
|
||||
|
||||
LAPPERR(expr, msg)
|
||||
LAPPERR(expr)
|
||||
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,
|
||||
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 doWarnIf(char const * expr, docstring const & msg, char const * file, long line);
|
||||
void doBufErr(char const * expr, docstring const & msg, char const * file, long line);
|
||||
void doAppErr(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, char const * file, long line);
|
||||
void doAppErr(char const * expr, char const * file, long line);
|
||||
|
||||
/// Print demangled callstack to stderr
|
||||
void printCallStack();
|
||||
@ -79,14 +79,14 @@ void printCallStack();
|
||||
#define LASSERT(expr, escape) \
|
||||
if (expr) {} else { lyx::doAssert(#expr, __FILE__, __LINE__); escape; }
|
||||
|
||||
#define LWARNIF(expr, msg) \
|
||||
if (expr) {} else { lyx::doWarnIf(#expr, msg, __FILE__, __LINE__); }
|
||||
#define LWARNIF(expr) \
|
||||
if (expr) {} else { lyx::doWarnIf(#expr, __FILE__, __LINE__); }
|
||||
|
||||
#define LBUFERR(expr, msg) \
|
||||
if (expr) {} else { lyx::doBufErr(#expr, msg, __FILE__, __LINE__); }
|
||||
#define LBUFERR(expr) \
|
||||
if (expr) {} else { lyx::doBufErr(#expr, __FILE__, __LINE__); }
|
||||
|
||||
#define LAPPERR(expr, msg) \
|
||||
if (expr) {} else { lyx::doAppErr(#expr, msg, __FILE__, __LINE__); }
|
||||
#define LAPPERR(expr) \
|
||||
if (expr) {} else { lyx::doAppErr(#expr, __FILE__, __LINE__); }
|
||||
|
||||
#endif
|
||||
#endif // LASSERT
|
||||
|
Loading…
Reference in New Issue
Block a user