Browse Source

Define DISTRHO_DEPRECATED_BY and use it in a few places

Signed-off-by: falkTX <falktx@falktx.com>
pull/272/head
falkTX 4 years ago
parent
commit
f626ea0f7e
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
8 changed files with 41 additions and 23 deletions
  1. +3
    -3
      dgl/Base.hpp
  2. +10
    -10
      dgl/Geometry.hpp
  3. +1
    -1
      dgl/Image.hpp
  4. +6
    -5
      dgl/OpenGL.hpp
  5. +3
    -1
      dgl/TopLevelWidget.hpp
  6. +3
    -1
      dgl/Widget.hpp
  7. +6
    -2
      dgl/Window.hpp
  8. +9
    -0
      distrho/src/DistrhoDefines.h

+ 3
- 3
dgl/Base.hpp View File

@@ -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,


+ 10
- 10
dgl/Geometry.hpp View File

@@ -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:


+ 1
- 1
dgl/Image.hpp View File

@@ -22,7 +22,7 @@

START_NAMESPACE_DGL

// TODO mark as deprecated
DISTRHO_DEPRECATED_BY("OpenGLImage")
typedef OpenGLImage Image;

END_NAMESPACE_DGL


+ 6
- 5
dgl/OpenGL.hpp View File

@@ -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;

// -----------------------------------------------------------------------


+ 3
- 1
dgl/TopLevelWidget.hpp View File

@@ -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:


+ 3
- 1
dgl/Widget.hpp View File

@@ -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:


+ 6
- 2
dgl/Window.hpp View File

@@ -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:


+ 9
- 0
distrho/src/DistrhoDefines.h View File

@@ -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; }


Loading…
Cancel
Save