add Debug::DEBUG and add some saver coversions to qt

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8816 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2004-06-18 13:31:55 +00:00
parent cb73d69ae4
commit fe87ad6b88
10 changed files with 63 additions and 22 deletions

View File

@ -361,7 +361,7 @@ void BufferView::Pimpl::setBuffer(Buffer * b)
bool BufferView::Pimpl::fitCursor()
{
// to get the correct y cursor info
lyxerr << "BufferView::fitCursor" << std::endl;
lyxerr[Debug::DEBUG] << "BufferView::fitCursor" << std::endl;
lyx::par_type const pit = bv_->cursor().bottom().par();
bv_->text()->redoParagraph(pit);
refreshPar(*bv_, *bv_->text(), pit);
@ -375,7 +375,7 @@ bool BufferView::Pimpl::fitCursor()
void BufferView::Pimpl::redoCurrentBuffer()
{
lyxerr[Debug::INFO] << "BufferView::redoCurrentBuffer" << endl;
lyxerr[Debug::DEBUG] << "BufferView::redoCurrentBuffer" << endl;
if (buffer_ && bv_->text()) {
resizeCurrentBuffer();
updateScrollbar();
@ -386,7 +386,7 @@ void BufferView::Pimpl::redoCurrentBuffer()
void BufferView::Pimpl::resizeCurrentBuffer()
{
lyxerr[Debug::INFO] << "resizeCurrentBuffer" << endl;
lyxerr[Debug::DEBUG] << "resizeCurrentBuffer" << endl;
owner_->busy(true);
owner_->message(_("Formatting document..."));
@ -411,8 +411,7 @@ void BufferView::Pimpl::resizeCurrentBuffer()
void BufferView::Pimpl::updateScrollbar()
{
if (!bv_->text()) {
lyxerr[Debug::GUI] << "no text in updateScrollbar" << endl;
lyxerr << "no text in updateScrollbar" << endl;
lyxerr[Debug::DEBUG] << "no text in updateScrollbar" << endl;
workarea().setScrollbarParams(0, 0, 0);
return;
}

View File

@ -1,3 +1,20 @@
2004-06-18 Lars Gullik Bjonnes <larsbj@gullik.net>
* debug.h: add DEBUG to enum and fix size of ANY.
* debug.C: add support for Debug::DEBUG
(showTags): cast errorTags.level to unsigned int
* BufferView_pimpl.C (fitCursor): use Debug::DEBUG
(redoCurrentBuffer): ditto
(updateScrollbar): ditto
* cursor.C (dispatch): ditto
* text2.C (setLayout): ditto
(setFont): ditto
(updateCounters): ditto
(editXY): ditto
(deleteEmptyParagraphMechanism): ditto
2004-06-09 Lars Gullik Bjonnes <larsbj@gullik.net>
* Makefile.am (dist_noinst_DATA): use the dist_ and noinst_

View File

@ -85,7 +85,7 @@ void LCursor::setCursor(DocIterator const & cur, bool sel)
DispatchResult LCursor::dispatch(FuncRequest const & cmd0)
{
lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
lyxerr[Debug::DEBUG] << "LCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
if (empty())
return DispatchResult();
@ -93,7 +93,7 @@ DispatchResult LCursor::dispatch(FuncRequest const & cmd0)
LCursor safe = *this;
for ( ; size(); pop()) {
//lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
//lyxerr << "LCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
BOOST_ASSERT(pos() <= lastpos());
BOOST_ASSERT(idx() <= lastidx());
BOOST_ASSERT(par() <= lastpar());
@ -110,7 +110,7 @@ DispatchResult LCursor::dispatch(FuncRequest const & cmd0)
// it completely to get a 'bomb early' behaviour in case this
// object will be used again.
if (!disp_.dispatched()) {
lyxerr << "RESTORING OLD CURSOR!" << endl;
lyxerr[Debug::DEBUG] << "RESTORING OLD CURSOR!" << endl;
operator=(safe);
disp_.dispatched(false);
}

View File

@ -63,6 +63,7 @@ error_item errorTags[] = {
{ Debug::GRAPHICS, "graphics", N_("Graphics conversion and loading")},
{ Debug::CHANGES, "changes", N_("Change tracking")},
{ Debug::EXTERNAL, "external", N_("External template/inset messages")},
{ Debug::DEBUG, "debug", N_("Developers general debug messages")},
{ Debug::ANY, "any", N_("All debugging messages")}
};
@ -119,7 +120,7 @@ void lyx_debug_trait::showLevel(ostream & os, lyx_debug_trait::type level)
void lyx_debug_trait::showTags(ostream & os)
{
for (int i = 0; i < numErrorTags ; ++i)
os << setw(7) << errorTags[i].level
os << setw(7) << static_cast<unsigned int>(errorTags[i].level)
<< setw(10) << errorTags[i].name
<< " " << _(errorTags[i].desc) << '\n';
os.flush();

View File

@ -73,7 +73,9 @@ struct lyx_debug_trait {
///
EXTERNAL = (1 << 23),
///
ANY = 0xffffff
DEBUG = (1 << 31),
///
ANY = 0xffffffff
};
static bool match(type a, type b) {

View File

@ -1,3 +1,8 @@
2004-06-18 Lars Gullik Bjonnes <larsbj@gullik.net>
* screen.C (fitCursor): Use Debug::DEBUG
(redraw): ditto
2004-05-25 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* Alert.C: make text output more readable

View File

@ -1,3 +1,10 @@
2004-06-18 Lars Gullik Bjonnes <larsbj@gullik.net>
* lyx_gui.C (roman_font_name): go through QString when converting
to std::string.
(sans_font_name): ditto
(typewriter_font_name): ditto
2004-06-08 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* QLMenubar.C (QLMenubar): use QLMenubar::menuBar().

View File

@ -326,7 +326,9 @@ string const roman_font_name()
QFont font;
font.setStyleHint(QFont::Serif);
font.setFamily("serif");
return QFontInfo(font).family().latin1();
QString name = QFontInfo(font).family().latin1();
return name;
}
@ -338,7 +340,9 @@ string const sans_font_name()
QFont font;
font.setStyleHint(QFont::SansSerif);
font.setFamily("sans");
return QFontInfo(font).family().latin1();
QString name = QFontInfo(font).family().latin1();
return name;
}
@ -350,7 +354,9 @@ string const typewriter_font_name()
QFont font;
font.setStyleHint(QFont::TypeWriter);
font.setFamily("monospace");
return QFontInfo(font).family().latin1();
QString name = QFontInfo(font).family().latin1();
return name;
}
}; // namespace lyx_gui

View File

@ -213,8 +213,10 @@ bool LyXScreen::fitCursor(BufferView * bv)
bv->cursor().getPos(x, y);
bv->cursor().getDim(asc, desc);
lyxerr << "LyXScreen::fitCursor: x: " << x << " y: " << y
<< " top_y: " << top_y << endl;
lyxerr[Debug::DEBUG] << "LyXScreen::fitCursor: x: " << x
<< " y: " << y
<< " top_y: " << top_y
<< endl;
bool const big_row = h / 4 < asc + desc && asc + desc < h;
@ -265,7 +267,7 @@ void LyXScreen::redraw(BufferView & bv)
LColor::bottomarea);
}
lyxerr << "Redraw screen" << endl;
lyxerr[Debug::DEBUG] << "Redraw screen" << endl;
expose(0, 0, workarea().workWidth(), workarea().workHeight());

View File

@ -285,7 +285,7 @@ void LyXText::setLayout(LCursor & cur, string const & layout)
LyXLayout_ptr const & lyxlayout = params.getLyXTextClass()[layout];
if (lyxlayout->is_environment) {
// move everything in a new environment inset
lyxerr << "setting layout " << layout << endl;
lyxerr[Debug::DEBUG] << "setting layout " << layout << endl;
bv.owner()->dispatch(FuncRequest(LFUN_HOME));
bv.owner()->dispatch(FuncRequest(LFUN_ENDSEL));
bv.owner()->dispatch(FuncRequest(LFUN_CUT));
@ -418,7 +418,8 @@ void LyXText::setFont(LCursor & cur, LyXFont const & font, bool toggleall)
DocIterator pos = cur.selectionBegin();
DocIterator posend = cur.selectionEnd();
lyxerr << "pos: " << pos << " posend: " << posend << endl;
lyxerr[Debug::DEBUG] << "pos: " << pos << " posend: " << posend
<< endl;
BufferParams const & params = cur.buffer().params();
@ -841,7 +842,7 @@ void LyXText::updateCounters()
setCounter(*bv()->buffer(), pit);
string const & newLabel = pars_[pit].params().labelString();
if (oldLabel != newLabel) {
//lyxerr << "changing labels: old: " << oldLabel << " new: "
//lyxerr[Debug::DEBUG] << "changing labels: old: " << oldLabel << " new: "
// << newLabel << endl;
redoParagraphInternal(pit);
update_pos = true;
@ -1125,7 +1126,8 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int x, int y)
y -= yo_;
par_type pit;
Row const & row = getRowNearY(y, pit);
lyxerr << "setCursorFromCoordinates:: hit row at: " << row.pos() << endl;
lyxerr[Debug::DEBUG] << "setCursorFromCoordinates:: hit row at: "
<< row.pos() << endl;
bool bound = false;
int xx = x + xo_; // getRowNearX get absolute x coords
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
@ -1148,7 +1150,7 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
// try to descend into nested insets
InsetBase * inset = checkInsetHit(x, y);
lyxerr << "inset " << inset << " hit at x: " << x << " y: " << y << endl;
lyxerr[Debug::DEBUG] << "inset " << inset << " hit at x: " << x << " y: " << y << endl;
if (!inset)
return 0;
@ -1295,7 +1297,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor const & old)
if (cur.selection())
return false;
//lyxerr << "DEPM: cur:\n" << cur << "old:\n" << old << endl;
//lyxerr[Debug::DEBUG] << "DEPM: cur:\n" << cur << "old:\n" << old << endl;
Paragraph const & oldpar = pars_[old.par()];
// We allow all kinds of "mumbo-jumbo" when freespacing.