DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit f626ea0f7ea1ef09a5fa912825dcc1a16eb751df
parent 058cab051567ebb93c55878816eb0b731486cdd6
Author: falkTX <falktx@falktx.com>
Date:   Mon, 17 May 2021 22:06:03 +0100

Define DISTRHO_DEPRECATED_BY and use it in a few places

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdgl/Base.hpp | 6+++---
Mdgl/Geometry.hpp | 20++++++++++----------
Mdgl/Image.hpp | 2+-
Mdgl/OpenGL.hpp | 11++++++-----
Mdgl/TopLevelWidget.hpp | 4+++-
Mdgl/Widget.hpp | 4+++-
Mdgl/Window.hpp | 8++++++--
Mdistrho/src/DistrhoDefines.h | 9+++++++++
8 files changed, 41 insertions(+), 23 deletions(-)

diff --git a/dgl/Base.hpp b/dgl/Base.hpp @@ -67,9 +67,9 @@ enum Key { kKeyDelete = 0x7F, // Backwards compatibility with old DPF - kCharBackspace = kKeyBackspace, - kCharEscape = kKeyEscape, - kCharDelete = kKeyDelete, + kCharBackspace DISTRHO_DEPRECATED_BY("kKeyBackspace") = kKeyBackspace, + kCharEscape DISTRHO_DEPRECATED_BY("kKeyEscape") = kKeyEscape, + kCharDelete DISTRHO_DEPRECATED_BY("kKeyDelete") = kKeyDelete, // Unicode Private Use Area kKeyF1 = 0xE000, diff --git a/dgl/Geometry.hpp b/dgl/Geometry.hpp @@ -374,7 +374,7 @@ public: Draw this line using the current OpenGL state. DEPRECATED please use draw(const GraphicsContext&) instead. */ - // TODO mark deprecated + DISTRHO_DEPRECATED_BY("draw(const GraphicsContext&)") void draw(); #endif @@ -492,14 +492,14 @@ public: Draw this circle using the current OpenGL state. DEPRECATED please use draw(const GraphicsContext&) instead. */ - // TODO mark deprecated + DISTRHO_DEPRECATED_BY("draw(const GraphicsContext&)") void draw(); /** Draw lines (outline of this circle) using the current OpenGL state. - DEPRECATED please use draw(const GraphicsContext&) instead. + DEPRECATED please use draw(const GraphicsContext&,T) instead. */ - // TODO mark deprecated + DISTRHO_DEPRECATED_BY("drawOutline(const GraphicsContext&)") void drawOutline(); #endif @@ -585,14 +585,14 @@ public: Draw this triangle using the current OpenGL state. DEPRECATED please use draw(const GraphicsContext&) instead. */ - // TODO mark deprecated + DISTRHO_DEPRECATED_BY("draw(const GraphicsContext&)") void draw(); /** Draw lines (outline of this triangle) using the current OpenGL state. - DEPRECATED please use draw(const GraphicsContext&) instead. + DEPRECATED please use draw(const GraphicsContext&,T) instead. */ - // TODO mark deprecated + DISTRHO_DEPRECATED_BY("drawOutline(const GraphicsContext&)") void drawOutline(); #endif @@ -804,14 +804,14 @@ public: Draw this rectangle using the current OpenGL state. DEPRECATED please use draw(const GraphicsContext&) instead. */ - // TODO mark deprecated + DISTRHO_DEPRECATED_BY("draw(const GraphicsContext&)") void draw(); /** DEPRECATED Draw lines (outline of this rectangle) using the current OpenGL state. - DEPRECATED please use drawOutline(const GraphicsContext&) instead. + DEPRECATED please use drawOutline(const GraphicsContext&,T) instead. */ - // TODO mark deprecated + DISTRHO_DEPRECATED_BY("drawOutline(const GraphicsContext&)") void drawOutline(); private: diff --git a/dgl/Image.hpp b/dgl/Image.hpp @@ -22,7 +22,7 @@ START_NAMESPACE_DGL -// TODO mark as deprecated +DISTRHO_DEPRECATED_BY("OpenGLImage") typedef OpenGLImage Image; END_NAMESPACE_DGL diff --git a/dgl/OpenGL.hpp b/dgl/OpenGL.hpp @@ -180,19 +180,19 @@ public: /** Draw this image at (0, 0) point using the current OpenGL context. */ - // TODO mark as deprecated + DISTRHO_DEPRECATED_BY("draw(const GraphicsContext&)") void draw(); /** Draw this image at (x, y) point using the current OpenGL context. */ - // TODO mark as deprecated + DISTRHO_DEPRECATED_BY("drawAt(const GraphicsContext&,int,int)") void drawAt(const int x, const int y); /** Draw this image at position @a pos using the current OpenGL context. */ - // TODO mark as deprecated + DISTRHO_DEPRECATED_BY("drawAt(const GraphicsContext&,const Point<int>&)") void drawAt(const Point<int>& pos); // FIXME this should not be needed @@ -203,8 +203,9 @@ public: /** Get the image type. + DEPRECATED Type is always assumed to be GL_UNSIGNED_BYTE. */ - // TODO mark as deprecated + DISTRHO_DEPRECATED GLenum getType() const noexcept { return GL_UNSIGNED_BYTE; } private: @@ -216,7 +217,7 @@ private: typedef ImageBaseAboutWindow<OpenGLImage> OpenGLImageAboutWindow; -// TODO deprecated +DISTRHO_DEPRECATED_BY("OpenGLImageAboutWindow") typedef OpenGLImageAboutWindow ImageAboutWindow; // ----------------------------------------------------------------------- diff --git a/dgl/TopLevelWidget.hpp b/dgl/TopLevelWidget.hpp @@ -77,8 +77,10 @@ public: bool keepAspectRatio = false, bool automaticallyScale = false); - // TODO deprecated + DISTRHO_DEPRECATED_BY("getApp()") Application& getParentApp() const noexcept { return getApp(); } + + DISTRHO_DEPRECATED_BY("getWindow()") Window& getParentWindow() const noexcept { return getWindow(); } private: diff --git a/dgl/Widget.hpp b/dgl/Widget.hpp @@ -172,8 +172,10 @@ public: */ virtual void repaint() noexcept; - // TODO deprecated + DISTRHO_DEPRECATED_BY("getApp()") Application& getParentApp() const noexcept { return getApp(); } + + DISTRHO_DEPRECATED_BY("getWindow()") Window& getParentWindow() const noexcept { return getWindow(); } protected: diff --git a/dgl/Window.hpp b/dgl/Window.hpp @@ -276,9 +276,13 @@ public: void setTransientWinId(uintptr_t winId); */ - // TODO deprecated + DISTRHO_DEPRECATED_BY("isIgnoringKeyRepeat()") inline bool getIgnoringKeyRepeat() const noexcept { return isIgnoringKeyRepeat(); } - inline double getScaling() const noexcept { return getScaling(); } + + DISTRHO_DEPRECATED_BY("getScaleFactor()") + inline double getScaling() const noexcept { return getScaleFactor(); } + + DISTRHO_DEPRECATED_BY("runAsModal(bool)") inline void exec(bool blockWait = false) { runAsModal(blockWait); } protected: diff --git a/distrho/src/DistrhoDefines.h b/distrho/src/DistrhoDefines.h @@ -75,6 +75,15 @@ # define DISTRHO_DEPRECATED #endif +/* Define DISTRHO_DEPRECATED_BY */ +#if defined(__clang__) +# define DISTRHO_DEPRECATED_BY(other) __attribute__((deprecated("", other))) +#elif defined(__GNUC__) +# define DISTRHO_DEPRECATED_BY(other) __attribute__((deprecated("Use " other))) +#else +# define DISTRHO_DEPRECATED_BY(other) DISTRHO_DEPRECATED +#endif + /* Define DISTRHO_SAFE_ASSERT* */ #define DISTRHO_SAFE_ASSERT(cond) if (! (cond)) d_safe_assert(#cond, __FILE__, __LINE__); #define DISTRHO_SAFE_ASSERT_BREAK(cond) if (! (cond)) { d_safe_assert(#cond, __FILE__, __LINE__); break; }