Refactoring patches

Yuriy Skalko yuriy.skalko at gmail.com
Mon Oct 19 09:04:24 UTC 2020


>> Yes. We'll deal with the rest later. 
>> Pavel
> 
> The .cpp changing part (for future applying) is in attached patch.
> Yuriy

Updated patch for cleaning header includes in .cpp files. Is it OK to
apply it now?

Yuriy
-------------- next part --------------
From 5dc7e176cf02481f0765149cd81693dd8291341d Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Mon, 12 Oct 2020 15:30:07 +0300
Subject: [PATCH] Remove duplicate and unused header includes in .cpp files

---
 src/Paragraph.cpp                     |  5 -----
 src/frontends/qt/Dialog.cpp           |  7 -------
 src/frontends/qt/GuiApplication.cpp   |  2 --
 src/frontends/qt/GuiCharacter.cpp     |  1 -
 src/frontends/qt/GuiCitation.cpp      |  4 ----
 src/frontends/qt/GuiCounter.cpp       |  2 --
 src/frontends/qt/GuiDocument.cpp      |  3 ---
 src/frontends/qt/GuiExternal.cpp      |  1 -
 src/frontends/qt/GuiIndex.cpp         |  2 --
 src/frontends/qt/GuiLog.cpp           |  1 -
 src/frontends/qt/GuiNote.cpp          |  2 --
 src/frontends/qt/GuiPhantom.cpp       |  2 --
 src/frontends/qt/GuiPrefs.cpp         |  2 --
 src/frontends/qt/GuiTabular.cpp       |  2 --
 src/frontends/qt/GuiToc.cpp           |  1 -
 src/frontends/qt/GuiView.cpp          | 12 ------------
 src/frontends/qt/Menus.cpp            |  1 -
 src/insets/InsetLayout.cpp            |  1 -
 src/insets/InsetPhantom.cpp           |  1 -
 src/lyxfind.cpp                       |  2 --
 src/mathed/InsetMathEnv.cpp           |  1 -
 src/mathed/InsetMathExInt.cpp         |  1 -
 src/mathed/InsetMathHull.cpp          |  1 -
 src/mathed/InsetMathMacroTemplate.cpp |  1 -
 src/mathed/InsetMathNest.cpp          |  1 -
 src/mathed/InsetMathNumber.cpp        |  1 -
 src/mathed/InsetMathTabular.cpp       |  1 -
 src/mathed/InsetMathXArrow.cpp        |  1 -
 src/mathed/MacroTable.cpp             |  1 -
 src/mathed/MathParser.cpp             |  1 -
 src/mathed/MathRow.cpp                |  2 --
 src/support/lassert.cpp               |  5 +++--
 32 files changed, 3 insertions(+), 68 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index d69fa55bb5..f3dc50feb6 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -39,9 +39,7 @@
 #include "output_docbook.h"
 #include "ParagraphParameters.h"
 #include "SpellChecker.h"
-#include "xml.h"
 #include "texstream.h"
-#include "TextClass.h"
 #include "TexRow.h"
 #include "Text.h"
 #include "WordLangTuple.h"
@@ -58,13 +56,10 @@
 
 #include "support/debug.h"
 #include "support/docstring_list.h"
-#include "support/ExceptionMessage.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
-#include "support/Length.h"
 #include "support/lstrings.h"
 #include "support/textutils.h"
-#include "output_docbook.h"
 
 #include <algorithm>
 #include <atomic>
diff --git a/src/frontends/qt/Dialog.cpp b/src/frontends/qt/Dialog.cpp
index b09163b25a..7590a54ae6 100644
--- a/src/frontends/qt/Dialog.cpp
+++ b/src/frontends/qt/Dialog.cpp
@@ -23,18 +23,11 @@
 #include "FuncStatus.h"
 #include "LyX.h"
 
-#include "insets/Inset.h"
-
 #include "support/debug.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
 
-#include <QLabel>
-#include <QLineEdit>
-#include <QList>
 #include <QSettings>
-#include <QString>
-#include <QValidator>
 
 #include <string>
 
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 4d88135f75..2c87ad10a2 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -16,9 +16,7 @@
 
 #include "ToolTipFormatter.h"
 #include "ColorCache.h"
-#include "ColorSet.h"
 #include "GuiClipboard.h"
-#include "GuiKeySymbol.h"
 #include "GuiSelection.h"
 #include "GuiView.h"
 #include "Menus.h"
diff --git a/src/frontends/qt/GuiCharacter.cpp b/src/frontends/qt/GuiCharacter.cpp
index 3de8338231..96e8d736ff 100644
--- a/src/frontends/qt/GuiCharacter.cpp
+++ b/src/frontends/qt/GuiCharacter.cpp
@@ -18,7 +18,6 @@
 #include "GuiApplication.h"
 #include "qt_helpers.h"
 
-#include "Font.h"
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index 951bad8612..d7e5ae0199 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -22,7 +22,6 @@
 
 #include "Buffer.h"
 #include "BufferView.h"
-#include "BiblioInfo.h"
 #include "BufferParams.h"
 #include "TextClass.h"
 #include "FuncRequest.h"
@@ -42,9 +41,6 @@
 #include <QStandardItemModel>
 #include <QVariant>
 
-#include <vector>
-#include <string>
-
 #undef KeyPress
 
 #include "support/regex.h"
diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp
index db081a46c5..d7685bc7bb 100644
--- a/src/frontends/qt/GuiCounter.cpp
+++ b/src/frontends/qt/GuiCounter.cpp
@@ -25,8 +25,6 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
-#include "qt_helpers.h"
-
 #include <map>
 //#include <vector>
 
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 9d3643de7e..883b283629 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -19,15 +19,12 @@
 #include "GuiIndices.h"
 #include "GuiSelectionManager.h"
 #include "LaTeXHighlighter.h"
-#include "LengthCombo.h"
-#include "PanelStack.h"
 #include "Validator.h"
 
 #include "LayoutFile.h"
 #include "BranchList.h"
 #include "buffer_funcs.h"
 #include "Buffer.h"
-#include "BufferParams.h"
 #include "BufferView.h"
 #include "CiteEnginesList.h"
 #include "Color.h"
diff --git a/src/frontends/qt/GuiExternal.cpp b/src/frontends/qt/GuiExternal.cpp
index eb71aad4d1..3a4ab2c91e 100644
--- a/src/frontends/qt/GuiExternal.cpp
+++ b/src/frontends/qt/GuiExternal.cpp
@@ -21,7 +21,6 @@
 
 #include "insets/ExternalSupport.h"
 #include "insets/ExternalTemplate.h"
-#include "insets/InsetExternal.h"
 
 #include "graphics/epstools.h"
 #include "graphics/GraphicsCache.h"
diff --git a/src/frontends/qt/GuiIndex.cpp b/src/frontends/qt/GuiIndex.cpp
index 7800bad2d4..a59ac3953f 100644
--- a/src/frontends/qt/GuiIndex.cpp
+++ b/src/frontends/qt/GuiIndex.cpp
@@ -21,8 +21,6 @@
 #include "FuncRequest.h"
 #include "IndicesList.h"
 
-#include "insets/InsetIndex.h"
-
 #include <QPushButton>
 
 using namespace std;
diff --git a/src/frontends/qt/GuiLog.cpp b/src/frontends/qt/GuiLog.cpp
index 6851994701..16979138d8 100644
--- a/src/frontends/qt/GuiLog.cpp
+++ b/src/frontends/qt/GuiLog.cpp
@@ -21,7 +21,6 @@
 #include "frontends/Clipboard.h"
 
 #include "support/docstring.h"
-#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
diff --git a/src/frontends/qt/GuiNote.cpp b/src/frontends/qt/GuiNote.cpp
index 6c87850d40..a70a809dfa 100644
--- a/src/frontends/qt/GuiNote.cpp
+++ b/src/frontends/qt/GuiNote.cpp
@@ -15,8 +15,6 @@
 #include "FuncRequest.h"
 #include "support/gettext.h"
 
-#include "insets/InsetNote.h"
-
 using namespace std;
 
 namespace lyx {
diff --git a/src/frontends/qt/GuiPhantom.cpp b/src/frontends/qt/GuiPhantom.cpp
index 973ec823c0..1aff3afd3c 100644
--- a/src/frontends/qt/GuiPhantom.cpp
+++ b/src/frontends/qt/GuiPhantom.cpp
@@ -14,8 +14,6 @@
 #include "FuncRequest.h"
 #include "support/gettext.h"
 
-#include "insets/InsetPhantom.h"
-
 using namespace std;
 
 namespace lyx {
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 093efe0e55..50760ed13a 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -19,7 +19,6 @@
 #include "GuiFontExample.h"
 #include "GuiFontLoader.h"
 #include "GuiKeySymbol.h"
-#include "GuiLyXFiles.h"
 #include "GuiView.h"
 #include "qt_helpers.h"
 #include "Validator.h"
@@ -31,7 +30,6 @@
 #include "ConverterCache.h"
 #include "FontEnums.h"
 #include "FuncRequest.h"
-#include "KeyMap.h"
 #include "KeySequence.h"
 #include "Language.h"
 #include "LyXAction.h"
diff --git a/src/frontends/qt/GuiTabular.cpp b/src/frontends/qt/GuiTabular.cpp
index 1df93d86ab..ce28491b34 100644
--- a/src/frontends/qt/GuiTabular.cpp
+++ b/src/frontends/qt/GuiTabular.cpp
@@ -31,8 +31,6 @@
 #include "LyX.h"
 #include "LyXRC.h"
 
-#include "insets/InsetTabular.h"
-
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/lstrings.h"
diff --git a/src/frontends/qt/GuiToc.cpp b/src/frontends/qt/GuiToc.cpp
index 793ee1efd2..e9ee840fd8 100644
--- a/src/frontends/qt/GuiToc.cpp
+++ b/src/frontends/qt/GuiToc.cpp
@@ -14,7 +14,6 @@
 
 #include "GuiToc.h"
 #include "GuiView.h"
-#include "DockView.h"
 #include "TocWidget.h"
 #include "qt_helpers.h"
 
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 919c9e1bc7..d417ffecd9 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -20,7 +20,6 @@
 #include "FontLoader.h"
 #include "GuiApplication.h"
 #include "GuiClickableLabel.h"
-#include "GuiCommandBuffer.h"
 #include "GuiCompleter.h"
 #include "GuiKeySymbol.h"
 #include "GuiToc.h"
@@ -51,9 +50,7 @@
 #include "Format.h"
 #include "FuncStatus.h"
 #include "FuncRequest.h"
-#include "Intl.h"
 #include "Language.h"
-#include "Layout.h"
 #include "LayoutFile.h"
 #include "Lexer.h"
 #include "LyXAction.h"
@@ -64,7 +61,6 @@
 #include "SpellChecker.h"
 #include "Session.h"
 #include "TexRow.h"
-#include "TextClass.h"
 #include "Text.h"
 #include "Toolbars.h"
 #include "version.h"
@@ -73,9 +69,7 @@
 #include "support/debug.h"
 #include "support/ExceptionMessage.h"
 #include "support/FileName.h"
-#include "support/filetools.h"
 #include "support/gettext.h"
-#include "support/filetools.h"
 #include "support/ForkedCalls.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
@@ -89,8 +83,6 @@
 #include <QAction>
 #include <QApplication>
 #include <QCloseEvent>
-#include <QDebug>
-#include <QDesktopWidget>
 #include <QDragEnterEvent>
 #include <QDropEvent>
 #include <QFuture>
@@ -105,8 +97,6 @@
 #include <QPainter>
 #include <QPixmap>
 #include <QPoint>
-#include <QPushButton>
-#include <QScrollBar>
 #include <QSettings>
 #include <QShowEvent>
 #include <QSplitter>
@@ -114,9 +104,7 @@
 #include <QStatusBar>
 #include <QSvgRenderer>
 #include <QtConcurrentRun>
-#include <QTime>
 #include <QTimer>
-#include <QToolBar>
 #include <QUrl>
 #include <QWindowStateChangeEvent>
 
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index afe43c70f1..b433773ad5 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -29,7 +29,6 @@
 #include "Buffer.h"
 #include "BufferList.h"
 #include "BufferParams.h"
-#include "BufferView.h"
 #include "Converter.h"
 #include "Cursor.h"
 #include "CutAndPaste.h"
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index 19e4aa68c3..a675cb5e50 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -15,7 +15,6 @@
 #include "InsetLayout.h"
 
 #include "ColorSet.h"
-#include "Layout.h"
 #include "Lexer.h"
 #include "TextClass.h"
 
diff --git a/src/insets/InsetPhantom.cpp b/src/insets/InsetPhantom.cpp
index 37367add2c..24ad8e9118 100644
--- a/src/insets/InsetPhantom.cpp
+++ b/src/insets/InsetPhantom.cpp
@@ -15,7 +15,6 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
-#include "BufferParams.h"
 #include "Cursor.h"
 #include "Dimension.h"
 #include "DispatchResult.h"
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index 5b4bd3a15d..e12d4d239a 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -38,13 +38,11 @@
 #include "frontends/alert.h"
 
 #include "mathed/InsetMath.h"
-#include "mathed/InsetMathGrid.h"
 #include "mathed/InsetMathHull.h"
 #include "mathed/MathData.h"
 #include "mathed/MathStream.h"
 #include "mathed/MathSupport.h"
 
-#include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
 #include "support/FileName.h"
diff --git a/src/mathed/InsetMathEnv.cpp b/src/mathed/InsetMathEnv.cpp
index 2eea5ac418..dd2c391681 100644
--- a/src/mathed/InsetMathEnv.cpp
+++ b/src/mathed/InsetMathEnv.cpp
@@ -14,7 +14,6 @@
 
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 
 #include "MetricsInfo.h"
 
diff --git a/src/mathed/InsetMathExInt.cpp b/src/mathed/InsetMathExInt.cpp
index 537870fd91..f0242c0bdb 100644
--- a/src/mathed/InsetMathExInt.cpp
+++ b/src/mathed/InsetMathExInt.cpp
@@ -15,7 +15,6 @@
 #include "LaTeXFeatures.h"
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 #include "InsetMathSymbol.h"
 
 #include "support/debug.h"
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 70d057cd10..4125bf6ee5 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -39,7 +39,6 @@
 #include "InsetMathMacro.h"
 #include "InsetMathMacroTemplate.h"
 #include "MetricsInfo.h"
-#include "xml.h"
 #include "Paragraph.h"
 #include "ParIterator.h"
 #include "xml.h"
diff --git a/src/mathed/InsetMathMacroTemplate.cpp b/src/mathed/InsetMathMacroTemplate.cpp
index a152222cb6..294e24b073 100644
--- a/src/mathed/InsetMathMacroTemplate.cpp
+++ b/src/mathed/InsetMathMacroTemplate.cpp
@@ -22,7 +22,6 @@
 #include "MathStream.h"
 #include "MathParser.h"
 #include "MathSupport.h"
-#include "InsetMathMacroArgument.h"
 
 #include "Buffer.h"
 #include "BufferView.h"
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 9d88b1337b..ada0400f18 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -30,7 +30,6 @@
 #include "InsetMathUnknown.h"
 #include "MathAutoCorrect.h"
 #include "MathCompletionList.h"
-#include "MathData.h"
 #include "MathFactory.h"
 #include "InsetMathMacro.h"
 #include "InsetMathMacroArgument.h"
diff --git a/src/mathed/InsetMathNumber.cpp b/src/mathed/InsetMathNumber.cpp
index 5a35415786..593da68d97 100644
--- a/src/mathed/InsetMathNumber.cpp
+++ b/src/mathed/InsetMathNumber.cpp
@@ -12,7 +12,6 @@
 
 #include "InsetMathNumber.h"
 #include "MathStream.h"
-#include "MathStream.h"
 #include "MathSupport.h"
 
 #include "MetricsInfo.h"
diff --git a/src/mathed/InsetMathTabular.cpp b/src/mathed/InsetMathTabular.cpp
index e4123a5655..565a71fb18 100644
--- a/src/mathed/InsetMathTabular.cpp
+++ b/src/mathed/InsetMathTabular.cpp
@@ -14,7 +14,6 @@
 
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 
 #include "MetricsInfo.h"
 
diff --git a/src/mathed/InsetMathXArrow.cpp b/src/mathed/InsetMathXArrow.cpp
index 2ea3b71b50..37445da1d8 100644
--- a/src/mathed/InsetMathXArrow.cpp
+++ b/src/mathed/InsetMathXArrow.cpp
@@ -16,7 +16,6 @@
 
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 #include "MathSupport.h"
 
 #include "LaTeXFeatures.h"
diff --git a/src/mathed/MacroTable.cpp b/src/mathed/MacroTable.cpp
index 2a4899a258..19d45d2069 100644
--- a/src/mathed/MacroTable.cpp
+++ b/src/mathed/MacroTable.cpp
@@ -20,7 +20,6 @@
 #include "InsetMathNest.h"
 
 #include "Buffer.h"
-#include "DocIterator.h"
 #include "InsetList.h"
 #include "Text.h"
 
diff --git a/src/mathed/MathParser.cpp b/src/mathed/MathParser.cpp
index 89c742aed9..f07b2e6409 100644
--- a/src/mathed/MathParser.cpp
+++ b/src/mathed/MathParser.cpp
@@ -77,7 +77,6 @@ following hack as starting point to write some macros:
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
-#include "support/unique_ptr.h"
 
 #include <sstream>
 
diff --git a/src/mathed/MathRow.cpp b/src/mathed/MathRow.cpp
index be61c8a39c..16b64c6b7f 100644
--- a/src/mathed/MathRow.cpp
+++ b/src/mathed/MathRow.cpp
@@ -12,8 +12,6 @@
 
 #include "MathRow.h"
 
-#include "InsetMath.h"
-#include "MathClass.h"
 #include "MathData.h"
 #include "MathSupport.h"
 
diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
index dcf8acd011..3e594153cb 100644
--- a/src/support/lassert.cpp
+++ b/src/support/lassert.cpp
@@ -10,7 +10,8 @@
  */
 
 #include <config.h>
-#include <lassert.h>
+
+#include "support/lassert.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
@@ -21,13 +22,13 @@
 
 #include <boost/assert.hpp>
 
-#include <QString>
 
 #ifdef LYX_CALLSTACK_PRINTING
 #include <cstdio>
 #include <cstdlib>
 #include <execinfo.h>
 #include <cxxabi.h>
+#include <QString>
 #endif
 
 
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list