From 601277bddb0a4d871b8ab90e88b5d7dfde3ec2a3 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 15 Mar 2018 10:15:10 +1100 Subject: Use forward class definitions of XPM and RGBAImage so only code that uses them needs to #include "XPM.h". Move definition of standard methods on LineMarker from header to implementation to reduce included text and further isolate use of XPM and RGBAImage. --- src/EditModel.cxx | 1 - src/EditView.cxx | 1 - src/Editor.cxx | 1 - src/LineMarker.cxx | 39 +++++++++++++++++++++++++++++++++++++++ src/LineMarker.h | 42 +++++++----------------------------------- src/MarginView.cxx | 1 - src/PositionCache.cxx | 1 - src/ScintillaBase.cxx | 1 - 8 files changed, 46 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/EditModel.cxx b/src/EditModel.cxx index 08888ba38..2f4a6a6af 100644 --- a/src/EditModel.cxx +++ b/src/EditModel.cxx @@ -34,7 +34,6 @@ #include "CellBuffer.h" #include "KeyMap.h" #include "Indicator.h" -#include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" diff --git a/src/EditView.cxx b/src/EditView.cxx index 97d8a718c..35d1ee777 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -39,7 +39,6 @@ #include "PerLine.h" #include "KeyMap.h" #include "Indicator.h" -#include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" diff --git a/src/Editor.cxx b/src/Editor.cxx index 04138e844..277a53c19 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -38,7 +38,6 @@ #include "PerLine.h" #include "KeyMap.h" #include "Indicator.h" -#include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index 261916e11..820ab9fae 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -24,6 +24,45 @@ using namespace Scintilla; +LineMarker::~LineMarker() { +} + +LineMarker::LineMarker() { + markType = SC_MARK_CIRCLE; + fore = ColourDesired(0, 0, 0); + back = ColourDesired(0xff, 0xff, 0xff); + backSelected = ColourDesired(0xff, 0x00, 0x00); + alpha = SC_ALPHA_NOALPHA; + customDraw = nullptr; +} + +LineMarker::LineMarker(const LineMarker &) { + // Defined to avoid pxpm and image being blindly copied, not as a complete copy constructor. + markType = SC_MARK_CIRCLE; + fore = ColourDesired(0, 0, 0); + back = ColourDesired(0xff, 0xff, 0xff); + backSelected = ColourDesired(0xff, 0x00, 0x00); + alpha = SC_ALPHA_NOALPHA; + pxpm.reset(); + image.reset(); + customDraw = nullptr; +} + +LineMarker &LineMarker::operator=(const LineMarker &other) { + // Defined to avoid pxpm and image being blindly copied, not as a complete assignment operator. + if (this != &other) { + markType = SC_MARK_CIRCLE; + fore = ColourDesired(0, 0, 0); + back = ColourDesired(0xff, 0xff, 0xff); + backSelected = ColourDesired(0xff, 0x00, 0x00); + alpha = SC_ALPHA_NOALPHA; + pxpm.reset(); + image.reset(); + customDraw = nullptr; + } + return *this; +} + void LineMarker::SetXPM(const char *textForm) { pxpm = std::make_unique(textForm); markType = SC_MARK_PIXMAP; diff --git a/src/LineMarker.h b/src/LineMarker.h index 6b66e03e8..28a63cd3b 100644 --- a/src/LineMarker.h +++ b/src/LineMarker.h @@ -10,6 +10,9 @@ namespace Scintilla { +class XPM; +class RGBAImage; + typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker); /** @@ -30,41 +33,10 @@ public: * it instead of creating a new method(s) in the Surface class that existing * platforms must implement as empty. */ DrawLineMarkerFn customDraw; - LineMarker() { - markType = SC_MARK_CIRCLE; - fore = ColourDesired(0,0,0); - back = ColourDesired(0xff,0xff,0xff); - backSelected = ColourDesired(0xff,0x00,0x00); - alpha = SC_ALPHA_NOALPHA; - customDraw = nullptr; - } - LineMarker(const LineMarker &) { - // Defined to avoid pxpm and image being blindly copied, not as a complete copy constructor. - markType = SC_MARK_CIRCLE; - fore = ColourDesired(0,0,0); - back = ColourDesired(0xff,0xff,0xff); - backSelected = ColourDesired(0xff,0x00,0x00); - alpha = SC_ALPHA_NOALPHA; - pxpm.reset(); - image.reset(); - customDraw = nullptr; - } - ~LineMarker() { - } - LineMarker &operator=(const LineMarker &other) { - // Defined to avoid pxpm and image being blindly copied, not as a complete assignment operator. - if (this != &other) { - markType = SC_MARK_CIRCLE; - fore = ColourDesired(0,0,0); - back = ColourDesired(0xff,0xff,0xff); - backSelected = ColourDesired(0xff,0x00,0x00); - alpha = SC_ALPHA_NOALPHA; - pxpm.reset(); - image.reset(); - customDraw = nullptr; - } - return *this; - } + LineMarker(); + LineMarker(const LineMarker &); + virtual ~LineMarker(); + LineMarker &operator=(const LineMarker &other); void SetXPM(const char *textForm); void SetXPM(const char *const *linesForm); void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); diff --git a/src/MarginView.cxx b/src/MarginView.cxx index ff19840c4..5a56b28ad 100644 --- a/src/MarginView.cxx +++ b/src/MarginView.cxx @@ -36,7 +36,6 @@ #include "CellBuffer.h" #include "KeyMap.h" #include "Indicator.h" -#include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 3d0888c68..3bb0f7e28 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -32,7 +32,6 @@ #include "CellBuffer.h" #include "KeyMap.h" #include "Indicator.h" -#include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index b1d9fd081..febc4f11f 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -44,7 +44,6 @@ #include "CallTip.h" #include "KeyMap.h" #include "Indicator.h" -#include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" -- cgit v1.2.3