From 9c87bee68db8babf05a6f801b72e2b39c33fd797 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Mon, 14 Jul 2008 23:47:54 +0000 Subject: [PATCH] Introduce Debug::SELECTION mainly for copy/paste primary-selection debugging. Up to now it was hell to debug it, since the selection messages was under different debug classes and the messages also get completely lost from mouse action events. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25624 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/CutAndPaste.cpp | 2 +- src/frontends/qt4/GuiApplication.cpp | 4 ++-- src/frontends/qt4/GuiSelection.cpp | 6 +++--- src/support/debug.cpp | 1 + src/support/debug.h | 4 +++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index 79f81f29fb..ee639f3c6c 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -757,7 +757,7 @@ void saveSelection(Cursor & cur) if (cur.selection() && cur.selBegin() == cur.bv().cursor().selBegin() && cur.selEnd() == cur.bv().cursor().selEnd()) { - LYXERR(Debug::ACTION, "'" << cur.selectionAsString(true) << "'"); + LYXERR(Debug::SELECTION, "saveSelection: '" << cur.selectionAsString(true) << "'"); copySelectionToStack(cur, selectionBuffer); } } diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index e13b3159c7..9494aab98d 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -1443,7 +1443,7 @@ bool GuiApplication::x11EventFilter(XEvent * xev) case SelectionRequest: { if (xev->xselectionrequest.selection != XA_PRIMARY) break; - LYXERR(Debug::GUI, "X requested selection."); + LYXERR(Debug::SELECTION, "X requested selection."); BufferView * bv = current_view_->view(); if (bv) { docstring const sel = bv->requestSelection(); @@ -1455,7 +1455,7 @@ bool GuiApplication::x11EventFilter(XEvent * xev) case SelectionClear: { if (xev->xselectionclear.selection != XA_PRIMARY) break; - LYXERR(Debug::GUI, "Lost selection."); + LYXERR(Debug::SELECTION, "Lost selection."); BufferView * bv = current_view_->view(); if (bv) bv->clearSelection(); diff --git a/src/frontends/qt4/GuiSelection.cpp b/src/frontends/qt4/GuiSelection.cpp index e6ee835521..7f5d4368c2 100644 --- a/src/frontends/qt4/GuiSelection.cpp +++ b/src/frontends/qt4/GuiSelection.cpp @@ -71,7 +71,7 @@ docstring const GuiSelection::get() const { QString const str = qApp->clipboard()->text(QClipboard::Selection) .normalized(QString::NormalizationForm_C); - LYXERR(Debug::ACTION, "GuiSelection::get: " << str); + LYXERR(Debug::SELECTION, "GuiSelection::get: " << str); if (str.isNull()) return docstring(); @@ -81,7 +81,7 @@ docstring const GuiSelection::get() const void GuiSelection::put(docstring const & str) { - LYXERR(Debug::ACTION, "GuiSelection::put: " << to_utf8(str)); + LYXERR(Debug::SELECTION, "GuiSelection::put: " << to_utf8(str)); qApp->clipboard()->setText(toqstr(externalLineEnding(str)), QClipboard::Selection); @@ -100,7 +100,7 @@ bool GuiSelection::empty() const if (!selection_supported_) return true; - LYXERR(Debug::ACTION, "GuiSelection::empty: " << text_selection_empty_); + LYXERR(Debug::SELECTION, "GuiSelection::empty: " << text_selection_empty_); return text_selection_empty_; } diff --git a/src/support/debug.cpp b/src/support/debug.cpp index aebc0c44a0..44ef69f406 100644 --- a/src/support/debug.cpp +++ b/src/support/debug.cpp @@ -65,6 +65,7 @@ ErrorItem errorTags[] = { { Debug::MACROS, "macros", N_("Math macros")}, { Debug::RTL, "rtl", N_("RTL/Bidi")}, { Debug::LOCALE, "locale", N_("Locale/Internationalisation")}, + { Debug::SELECTION, "selection", N_("Selection copy/paste mechanism")}, { Debug::DEBUG, "debug", N_("Developers' general debug messages")}, { Debug::ANY, "any", N_("All debugging messages")} }; diff --git a/src/support/debug.h b/src/support/debug.h index a3045bcf88..a126cb81e5 100644 --- a/src/support/debug.h +++ b/src/support/debug.h @@ -96,7 +96,9 @@ namespace Debug { /// rtl-related RTL = (1 << 27), /// locale related - LOCALE = (1 << 28), + LOCALE = (1 << 28), + /// selection + SELECTION = (1 << 29), /// DEBUG = (1 << 31), /// -- 2.39.5