Refactoring patches

Yuriy Skalko yuriy.skalko at gmail.com
Mon Oct 19 14:30:28 UTC 2020


>> Updated patch for cleaning header includes in .cpp files. Is it OK to
>> apply it now?
> 
> Does it mean that you're done with the headers :) ?
> Pavel

Not yet :) I've done with headers after this last patch. If it is OK,
I'll commit the patch for .cpp after this one.

Yuriy
-------------- next part --------------
From 18e6e2802acd501aea4ae525159894632cff5248 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Mon, 19 Oct 2020 17:15:45 +0300
Subject: [PATCH] Reduce includes in header files

---
 src/BiblioInfo.cpp                | 1 +
 src/frontends/Application.h       | 2 --
 src/frontends/qt/ColorCache.cpp   | 4 +++-
 src/frontends/qt/ColorCache.h     | 4 ++--
 src/frontends/qt/FindAndReplace.h | 5 +++--
 src/frontends/qt/GuiApplication.h | 2 ++
 src/frontends/qt/GuiBibtex.cpp    | 1 +
 src/frontends/qt/GuiBibtex.h      | 3 ++-
 src/frontends/qt/GuiCitation.cpp  | 2 ++
 src/frontends/qt/GuiCitation.h    | 5 +++--
 src/frontends/qt/GuiDocument.cpp  | 2 ++
 src/frontends/qt/GuiDocument.h    | 3 ++-
 src/frontends/qt/GuiLyXFiles.cpp  | 3 ---
 src/frontends/qt/GuiPrefs.cpp     | 1 +
 src/frontends/qt/GuiPrefs.h       | 2 +-
 src/frontends/qt/GuiRef.cpp       | 1 +
 src/frontends/qt/GuiRef.h         | 3 ++-
 src/frontends/qt/GuiView.cpp      | 1 +
 src/frontends/qt/GuiViewSource.h  | 1 +
 src/frontends/qt/GuiWorkArea.h    | 2 +-
 src/frontends/qt/Menus.cpp        | 1 +
 src/frontends/qt/Menus.h          | 2 +-
 src/frontends/qt/PanelStack.cpp   | 2 ++
 src/frontends/qt/PanelStack.h     | 3 +--
 src/frontends/qt/TocWidget.h      | 3 ++-
 src/frontends/qt/Toolbars.h       | 3 ++-
 src/insets/Inset.h                | 2 +-
 src/insets/InsetCitation.cpp      | 1 +
 src/insets/InsetCitation.h        | 3 ++-
 src/insets/InsetCollapsible.cpp   | 1 +
 30 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index 15705ce144..486bd5c1e5 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -30,6 +30,7 @@
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
+#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
diff --git a/src/frontends/Application.h b/src/frontends/Application.h
index 5e3b37a7f1..59806c0428 100644
--- a/src/frontends/Application.h
+++ b/src/frontends/Application.h
@@ -14,8 +14,6 @@
 #include "ColorCode.h"
 #include "FuncCode.h"
 
-#include "KeyModifier.h"
-
 #include "support/strfwd.h"
 
 #include <functional>
diff --git a/src/frontends/qt/ColorCache.cpp b/src/frontends/qt/ColorCache.cpp
index 81ac1387e5..1b876410a8 100644
--- a/src/frontends/qt/ColorCache.cpp
+++ b/src/frontends/qt/ColorCache.cpp
@@ -10,9 +10,11 @@
 
 #include <config.h>
 
+#include "ColorCache.h"
+
 #include "LyXRC.h"
 
-#include "ColorCache.h"
+#include "Color.h"
 #include "ColorSet.h"
 
 namespace lyx {
diff --git a/src/frontends/qt/ColorCache.h b/src/frontends/qt/ColorCache.h
index e1ad6aed5e..beb680f7cd 100644
--- a/src/frontends/qt/ColorCache.h
+++ b/src/frontends/qt/ColorCache.h
@@ -12,14 +12,14 @@
 #ifndef COLORCACHE_H
 #define COLORCACHE_H
 
-#include "Color.h"
+#include "ColorCode.h"
 
 #include <QColor>
 #include <QPalette>
 
 namespace lyx {
 
-struct RGBColor;
+class Color;
 
 /**
  * Cache from Color to QColor.
diff --git a/src/frontends/qt/FindAndReplace.h b/src/frontends/qt/FindAndReplace.h
index 4456c653a9..169530a516 100644
--- a/src/frontends/qt/FindAndReplace.h
+++ b/src/frontends/qt/FindAndReplace.h
@@ -17,11 +17,12 @@
 #include "qt_helpers.h"
 #include "ui_FindAndReplaceUi.h"
 
-#include "lyxfind.h"
-
 #include <string>
 
 namespace lyx {
+
+class FindAndReplaceOptions;
+
 namespace frontend {
 
 class FindAndReplaceWidget : public QTabWidget, public Ui::FindAndReplaceUi
diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h
index a121b957a6..d1294e6798 100644
--- a/src/frontends/qt/GuiApplication.h
+++ b/src/frontends/qt/GuiApplication.h
@@ -13,6 +13,8 @@
 #ifndef GUIAPPLICATION_H
 #define GUIAPPLICATION_H
 
+#include "KeyModifier.h"
+
 #include "frontends/Application.h"
 #include "support/filetools.h"
 
diff --git a/src/frontends/qt/GuiBibtex.cpp b/src/frontends/qt/GuiBibtex.cpp
index c0c33a58a6..8c561ccf85 100644
--- a/src/frontends/qt/GuiBibtex.cpp
+++ b/src/frontends/qt/GuiBibtex.cpp
@@ -27,6 +27,7 @@
 #include "Validator.h"
 
 #include "ButtonPolicy.h"
+#include "FancyLineEdit.h"
 
 #include "frontends/alert.h"
 
diff --git a/src/frontends/qt/GuiBibtex.h b/src/frontends/qt/GuiBibtex.h
index cb17499080..2258ec9d16 100644
--- a/src/frontends/qt/GuiBibtex.h
+++ b/src/frontends/qt/GuiBibtex.h
@@ -16,7 +16,6 @@
 #include "GuiDialog.h"
 #include "GuiSelectionManager.h"
 #include "ButtonController.h"
-#include "FancyLineEdit.h"
 #include "ui_BibtexUi.h"
 
 #include "insets/InsetCommandParams.h"
@@ -27,6 +26,8 @@
 namespace lyx {
 namespace frontend {
 
+class FancyLineEdit;
+
 class GuiBibtex : public GuiDialog, public Ui::BibtexUi
 {
 	Q_OBJECT
diff --git a/src/frontends/qt/GuiCitation.cpp b/src/frontends/qt/GuiCitation.cpp
index d7e5ae0199..195b0d349b 100644
--- a/src/frontends/qt/GuiCitation.cpp
+++ b/src/frontends/qt/GuiCitation.cpp
@@ -16,6 +16,7 @@
 
 #include "GuiCitation.h"
 
+#include "FancyLineEdit.h"
 #include "GuiApplication.h"
 #include "GuiSelectionManager.h"
 #include "qt_helpers.h"
@@ -23,6 +24,7 @@
 #include "Buffer.h"
 #include "BufferView.h"
 #include "BufferParams.h"
+#include "Citation.h"
 #include "TextClass.h"
 #include "FuncRequest.h"
 
diff --git a/src/frontends/qt/GuiCitation.h b/src/frontends/qt/GuiCitation.h
index 7e65fe64cb..13a808763c 100644
--- a/src/frontends/qt/GuiCitation.h
+++ b/src/frontends/qt/GuiCitation.h
@@ -17,12 +17,10 @@
 
 #include "DialogView.h"
 #include "ui_CitationUi.h"
-#include "FancyLineEdit.h"
 
 #include "insets/InsetCommandParams.h"
 
 #include "BiblioInfo.h"
-#include "Citation.h"
 
 #include <QAbstractListModel>
 #include <QStandardItemModel>
@@ -31,8 +29,11 @@
 
 namespace lyx {
 
+class CitationStyle;
+
 namespace frontend {
 
+class FancyLineEdit;
 class GuiSelectionManager;
 
 
diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp
index 883b283629..d691cc7bd8 100644
--- a/src/frontends/qt/GuiDocument.cpp
+++ b/src/frontends/qt/GuiDocument.cpp
@@ -13,7 +13,9 @@
 
 #include "GuiDocument.h"
 
+#include "BulletsModule.h"
 #include "CategorizedCombo.h"
+#include "FancyLineEdit.h"
 #include "GuiApplication.h"
 #include "GuiBranches.h"
 #include "GuiIndices.h"
diff --git a/src/frontends/qt/GuiDocument.h b/src/frontends/qt/GuiDocument.h
index 73cc4d6b8b..52da41300e 100644
--- a/src/frontends/qt/GuiDocument.h
+++ b/src/frontends/qt/GuiDocument.h
@@ -14,7 +14,6 @@
 #define GUIDOCUMENT_H
 
 #include "BufferParams.h"
-#include "BulletsModule.h"
 #include "GuiDialog.h"
 #include "GuiIdListModel.h"
 
@@ -51,6 +50,8 @@ namespace support {
 
 namespace frontend {
 
+class BulletsModule;
+class FancyLineEdit;
 class FloatPlacement;
 class GuiBranches;
 class GuiIndices;
diff --git a/src/frontends/qt/GuiLyXFiles.cpp b/src/frontends/qt/GuiLyXFiles.cpp
index f54c56bc9a..5616ac0c2d 100644
--- a/src/frontends/qt/GuiLyXFiles.cpp
+++ b/src/frontends/qt/GuiLyXFiles.cpp
@@ -15,14 +15,11 @@
 #include "qt_helpers.h"
 
 #include "FileDialog.h"
-#include "Buffer.h"
-#include "BufferParams.h"
 #include "FuncRequest.h"
 #include "Language.h"
 #include "LyXRC.h"
 
 #include "support/environment.h"
-#include "support/filetools.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/Messages.h"
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 50760ed13a..faf88039bb 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -19,6 +19,7 @@
 #include "GuiFontExample.h"
 #include "GuiFontLoader.h"
 #include "GuiKeySymbol.h"
+#include "GuiLyXFiles.h"
 #include "GuiView.h"
 #include "qt_helpers.h"
 #include "Validator.h"
diff --git a/src/frontends/qt/GuiPrefs.h b/src/frontends/qt/GuiPrefs.h
index 90cf142185..11a511db2e 100644
--- a/src/frontends/qt/GuiPrefs.h
+++ b/src/frontends/qt/GuiPrefs.h
@@ -15,7 +15,6 @@
 #define GUIPREFS_H
 
 #include "GuiDialog.h"
-#include "GuiLyXFiles.h"
 
 #include "Converter.h"
 #include "Format.h"
@@ -52,6 +51,7 @@ namespace lyx {
 
 namespace frontend {
 
+class GuiLyXFiles;
 class PrefModule;
 
 class GuiPreferences : public GuiDialog, public Ui::PrefsUi
diff --git a/src/frontends/qt/GuiRef.cpp b/src/frontends/qt/GuiRef.cpp
index 83946c24d3..b0aaba6a87 100644
--- a/src/frontends/qt/GuiRef.cpp
+++ b/src/frontends/qt/GuiRef.cpp
@@ -20,6 +20,7 @@
 #include "BufferList.h"
 #include "BufferView.h"
 #include "Cursor.h"
+#include "FancyLineEdit.h"
 #include "FuncRequest.h"
 
 #include "qt_helpers.h"
diff --git a/src/frontends/qt/GuiRef.h b/src/frontends/qt/GuiRef.h
index 46e99ea96d..02ef307ac5 100644
--- a/src/frontends/qt/GuiRef.h
+++ b/src/frontends/qt/GuiRef.h
@@ -14,7 +14,6 @@
 
 #include "GuiDialog.h"
 #include "ui_RefUi.h"
-#include "FancyLineEdit.h"
 
 #include "insets/InsetCommandParams.h"
 
@@ -25,6 +24,8 @@ class QTreeWidgetItem;
 namespace lyx {
 namespace frontend {
 
+class FancyLineEdit;
+
 class GuiRef : public GuiDialog, public Ui::RefUi
 {
 	Q_OBJECT
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index d417ffecd9..4dca7bf531 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -50,6 +50,7 @@
 #include "Format.h"
 #include "FuncStatus.h"
 #include "FuncRequest.h"
+#include "KeySymbol.h"
 #include "Language.h"
 #include "LayoutFile.h"
 #include "Lexer.h"
diff --git a/src/frontends/qt/GuiViewSource.h b/src/frontends/qt/GuiViewSource.h
index 1ea1303756..8b2a005ba2 100644
--- a/src/frontends/qt/GuiViewSource.h
+++ b/src/frontends/qt/GuiViewSource.h
@@ -28,6 +28,7 @@ class QTextDocument;
 
 namespace lyx {
 
+class BufferView;
 class TexRow;
 
 
diff --git a/src/frontends/qt/GuiWorkArea.h b/src/frontends/qt/GuiWorkArea.h
index 2f155bf7c1..8e1790a2bb 100644
--- a/src/frontends/qt/GuiWorkArea.h
+++ b/src/frontends/qt/GuiWorkArea.h
@@ -16,7 +16,6 @@
 #include "ui_WorkAreaUi.h"
 
 #include "frontends/WorkArea.h"
-#include "frontends/KeySymbol.h"
 
 #include <QAbstractScrollArea>
 #include <QTabBar>
@@ -30,6 +29,7 @@ namespace lyx {
 class Buffer;
 class BufferView;
 class FuncRequest;
+class KeySymbol;
 
 namespace frontend {
 
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index b433773ad5..afe43c70f1 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -29,6 +29,7 @@
 #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/frontends/qt/Menus.h b/src/frontends/qt/Menus.h
index 5df59ddf5d..8166b45178 100644
--- a/src/frontends/qt/Menus.h
+++ b/src/frontends/qt/Menus.h
@@ -14,13 +14,13 @@
 #define MENUS_H
 
 #include <QMenu>
-#include "BufferView.h"
 
 class QString;
 class QMenuBar;
 
 namespace lyx {
 
+class BufferView;
 class docstring_list;
 class Lexer;
 class FuncRequest;
diff --git a/src/frontends/qt/PanelStack.cpp b/src/frontends/qt/PanelStack.cpp
index ef9c599a34..2614284a8d 100644
--- a/src/frontends/qt/PanelStack.cpp
+++ b/src/frontends/qt/PanelStack.cpp
@@ -15,6 +15,8 @@
 #include "GuiApplication.h"
 #include "qt_helpers.h"
 
+#include "FancyLineEdit.h"
+
 #include "support/debug.h"
 #include "support/lassert.h"
 
diff --git a/src/frontends/qt/PanelStack.h b/src/frontends/qt/PanelStack.h
index 220afeec79..7405954b96 100644
--- a/src/frontends/qt/PanelStack.h
+++ b/src/frontends/qt/PanelStack.h
@@ -13,8 +13,6 @@
 #ifndef PANELSTACK_H
 #define PANELSTACK_H
 
-#include "FancyLineEdit.h"
-
 #include <QHash>
 #include <QWidget>
 
@@ -27,6 +25,7 @@ class QTreeWidgetItem;
 namespace lyx {
 namespace frontend {
 
+class FancyLineEdit;
 
 class PanelStack : public QWidget
 {
diff --git a/src/frontends/qt/TocWidget.h b/src/frontends/qt/TocWidget.h
index c8fa08a6f1..3545a44e1c 100644
--- a/src/frontends/qt/TocWidget.h
+++ b/src/frontends/qt/TocWidget.h
@@ -15,7 +15,7 @@
 
 #include "ui_TocUi.h"
 
-#include "FuncRequest.h"
+#include "FuncCode.h"
 
 #include <QString>
 #include <QWidget>
@@ -28,6 +28,7 @@ namespace lyx {
 
 class Cursor;
 class DispatchResult;
+class FuncRequest;
 class FuncStatus;
 class Inset;
 
diff --git a/src/frontends/qt/Toolbars.h b/src/frontends/qt/Toolbars.h
index 0083658a64..2d9213986c 100644
--- a/src/frontends/qt/Toolbars.h
+++ b/src/frontends/qt/Toolbars.h
@@ -13,7 +13,7 @@
 #ifndef TOOLBAR_BACKEND_H
 #define TOOLBAR_BACKEND_H
 
-#include "FuncRequest.h"
+#include "support/docstring.h"
 
 #include <vector>
 #include <map>
@@ -22,6 +22,7 @@
 
 namespace lyx {
 
+class FuncRequest;
 class Lexer;
 
 namespace frontend {
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index d2be340195..2fec7023a6 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -24,7 +24,6 @@
 
 #include "support/strfwd.h"
 #include "support/types.h"
-#include "support/FileNameList.h"
 
 #include <climits>
 
@@ -66,6 +65,7 @@ class otexstream;
 
 namespace graphics { class PreviewLoader; }
 
+namespace support {class FileNameList; }
 
 /// returns the InsetCode corresponding to the \c name.
 /// Eg, insetCode("branch") == BRANCH_CODE
diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
index 6f52fe2735..ead9d3a8a0 100644
--- a/src/insets/InsetCitation.cpp
+++ b/src/insets/InsetCitation.cpp
@@ -18,6 +18,7 @@
 #include "buffer_funcs.h"
 #include "BufferParams.h"
 #include "BufferView.h"
+#include "Citation.h"
 #include "DispatchResult.h"
 #include "FuncCode.h"
 #include "FuncRequest.h"
diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h
index b085a2c942..3be20013cb 100644
--- a/src/insets/InsetCitation.h
+++ b/src/insets/InsetCitation.h
@@ -14,10 +14,11 @@
 #define INSET_CITATION_H
 
 #include "InsetCommand.h"
-#include "Citation.h"
 
 namespace lyx {
 
+class CitationStyle;
+
 /////////////////////////////////////////////////////////////////////////
 //
 // InsetCitation
diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp
index 20e595ff32..c118545002 100644
--- a/src/insets/InsetCollapsible.cpp
+++ b/src/insets/InsetCollapsible.cpp
@@ -35,6 +35,7 @@
 
 #include "support/debug.h"
 #include "support/docstream.h"
+#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list