Skip to content
Permalink
Browse files

modernize

  • Loading branch information...
scheffle committed Jan 21, 2016
1 parent f954172 commit 809652687223b80e7d01a542cfc4d535cea524f8
@@ -103,12 +103,13 @@ struct CNinePartTiledDescription
kPartCount
};

CCoord left;
CCoord top;
CCoord right;
CCoord bottom;

CNinePartTiledDescription (CCoord left = 0, CCoord top = 0, CCoord right = 0, CCoord bottom = 0)
CCoord left {0.};
CCoord top {0.};
CCoord right {0.};
CCoord bottom {0.};

CNinePartTiledDescription () = default;
CNinePartTiledDescription (CCoord left, CCoord top, CCoord right, CCoord bottom)
: left (left), top (top), right (right), bottom (bottom) {}

//-----------------------------------------------------------------------------
@@ -44,7 +44,8 @@ namespace VSTGUI {
//-----------------------------------------------------------------------------
struct CColor
{
CColor (uint8_t red = 255, uint8_t green = 255, uint8_t blue = 255, uint8_t alpha = 255)
CColor () = default;
CColor (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 255)
: red (red), green (green), blue (blue), alpha (alpha)
{}

@@ -74,16 +75,6 @@ struct CColor
return *this;
}

VSTGUI_DEPRECATED (CColor operator~ ()
{
CColor c;
c.red = ~red;
c.green = ~green;
c.blue = ~blue;
c.alpha = ~alpha;
return c;
})

bool operator!= (const CColor &other) const
{ return (red != other.red || green != other.green || blue != other.blue || alpha != other.alpha); }

@@ -131,10 +122,10 @@ struct CColor
uint8_t getLightness () const;
//@}

uint8_t red; ///< red component [0..255]
uint8_t green; ///< green component [0..255]
uint8_t blue; ///< blue component [0..255]
uint8_t alpha; ///< alpha component [0..255]
uint8_t red {255}; ///< red component [0..255]
uint8_t green {255}; ///< green component [0..255]
uint8_t blue {255}; ///< blue component [0..255]
uint8_t alpha {255}; ///< alpha component [0..255]
};

inline CColor MakeCColor (uint8_t red = 0, uint8_t green = 0, uint8_t blue = 0, uint8_t alpha = 255)
@@ -148,10 +148,11 @@ class CDataBrowser : public CScrollView

/// @brief CDataBrowser Cell position description
struct Cell {
int32_t row;
int32_t column;
int32_t row {-1};
int32_t column {-1};

Cell (int32_t row = -1, int32_t column = -1) : row (row), column (column) {}
Cell () = default;
Cell (int32_t row, int32_t column) : row (row), column (column) {}
bool isValid () const { return row > -1 && column > -1; }
};

@@ -41,14 +41,6 @@ namespace VSTGUI {
//-----------------------------------------------------------------------------
CGradientView::CGradientView (const CRect& size)
: CView (size)
, gradientStyle (kLinearGradient)
, frameColor (kBlackCColor)
, gradientAngle (0.)
, roundRectRadius (5.)
, frameWidth (1.)
, drawAntialiased (true)
, radialRadius (1.)
, radialCenter (CPoint (0.5, 0.5))
{
}

@@ -87,14 +87,14 @@ class CGradientView : public CView
virtual void setViewSize (const CRect& rect, bool invalid = true) override;
void draw (CDrawContext* context) override;
protected:
GradientStyle gradientStyle;
CColor frameColor;
double gradientAngle;
CCoord roundRectRadius;
CCoord frameWidth;
CCoord radialRadius;
CPoint radialCenter;
bool drawAntialiased;
GradientStyle gradientStyle {kLinearGradient};
CColor frameColor {kBlackCColor};
double gradientAngle {0.};
CCoord roundRectRadius {5.};
CCoord frameWidth {1.};
CCoord radialRadius {1.};
CPoint radialCenter {0.5, 0.5};
bool drawAntialiased {true};

SharedPointer<CGraphicsPath> path;
SharedPointer<CGradient> gradient;
@@ -52,14 +52,15 @@ static inline double radians (double degrees) { return degrees * M_PI / 180; }
//-----------------------------------------------------------------------------
struct CGraphicsTransform
{
double m11;
double m12;
double m21;
double m22;
double dx;
double dy;
double m11 {1.};
double m12 {0.};
double m21 {0.};
double m22 {1.};
double dx {0.};
double dy {0.};

CGraphicsTransform (double _m11 = 1., double _m12 = 0., double _m21 = 0., double _m22 = 1., double _dx = 0., double _dy = 0.)
CGraphicsTransform () = default;
CGraphicsTransform (double _m11, double _m12, double _m21, double _m22, double _dx, double _dy)
: m11 (_m11), m12 (_m12), m21 (_m21), m22 (_m22), dx (_dx), dy (_dy)
{}

@@ -41,8 +41,6 @@ namespace VSTGUI {
//-----------------------------------------------------------------------------
CLayeredViewContainer::CLayeredViewContainer (const CRect& r)
: CViewContainer (r)
, parentLayerView (0)
, zIndex (0)
{
}

@@ -77,8 +77,8 @@ class CLayeredViewContainer : public CViewContainer, public IPlatformViewLayerDe
void registerListeners (bool state);

SharedPointer<IPlatformViewLayer>layer;
CLayeredViewContainer* parentLayerView;
uint32_t zIndex;
CLayeredViewContainer* parentLayerView {nullptr};
uint32_t zIndex {0};
};

} // namespace
@@ -120,7 +120,7 @@ CLineStyle& CLineStyle::operator= (const CLineStyle& cls)

//-----------------------------------------------------------------------------
static const CCoord kDefaultOnOffDashLength[] = {1, 1};
const CLineStyle kLineSolid;
const CLineStyle kLineSolid {};
const CLineStyle kLineOnOffDash (CLineStyle::kLineCapButt, CLineStyle::kLineJoinMiter, 0, 2, kDefaultOnOffDashLength);

}
@@ -62,7 +62,8 @@ class CLineStyle
kLineJoinBevel
};

CLineStyle (LineCap cap = kLineCapButt, LineJoin join = kLineJoinMiter, CCoord dashPhase = 0., uint32_t dashCount = 0, const CCoord* dashLengths = 0);
CLineStyle () = default;
explicit CLineStyle (LineCap cap, LineJoin join = kLineJoinMiter, CCoord dashPhase = 0., uint32_t dashCount = 0, const CCoord* dashLengths = 0);
CLineStyle (LineCap cap, LineJoin join, CCoord dashPhase, const CoordVector& dashLengths);
CLineStyle (const CLineStyle& lineStyle);
~CLineStyle ();
@@ -87,9 +88,9 @@ class CLineStyle
CLineStyle& operator= (const CLineStyle& cls);

protected:
LineCap cap;
LineJoin join;
CCoord dashPhase;
LineCap cap {kLineCapButt};
LineJoin join {kLineJoinMiter};
CCoord dashPhase {0.};
CoordVector dashLengths;
};

@@ -43,23 +43,14 @@ COffscreenContext::COffscreenContext (CBitmap* bitmap)
: CDrawContext (CRect (0, 0, bitmap->getWidth (), bitmap->getHeight ()))
, bitmap (bitmap)
{
bitmap->remember ();
}

//-----------------------------------------------------------------------------
COffscreenContext::COffscreenContext (const CRect& surfaceRect)
: CDrawContext (surfaceRect)
, bitmap (0)
{
}

//-----------------------------------------------------------------------------
COffscreenContext::~COffscreenContext ()
{
if (bitmap)
bitmap->forget ();
}

//-----------------------------------------------------------------------------
void COffscreenContext::copyFrom (CDrawContext *pContext, CRect destRect, CPoint srcOffset)
{
@@ -109,9 +109,8 @@ class COffscreenContext : public CDrawContext
protected:
explicit COffscreenContext (CBitmap* bitmap);
explicit COffscreenContext (const CRect& surfaceRect);
~COffscreenContext ();

CBitmap* bitmap;
SharedPointer<CBitmap> bitmap;
};

} // namespace
@@ -44,14 +44,13 @@ namespace VSTGUI {
//-----------------------------------------------------------------------------
COpenGLView::COpenGLView (const CRect& size)
: CView (size)
, platformOpenGLView (0)
{
}

//-----------------------------------------------------------------------------
COpenGLView::~COpenGLView ()
{
vstgui_assert (platformOpenGLView == 0);
vstgui_assert (platformOpenGLView == nullptr);
}

//-----------------------------------------------------------------------------
@@ -73,7 +72,7 @@ bool COpenGLView::createPlatformOpenGLView ()
{
vstgui_assert (platformOpenGLView == 0);
IPlatformFrame* platformFrame = getFrame ()->getPlatformFrame ();
platformOpenGLView = platformFrame ? platformFrame->createPlatformOpenGLView () : 0;
platformOpenGLView = owned (platformFrame ? platformFrame->createPlatformOpenGLView () : 0);
if (platformOpenGLView)
{
if (platformOpenGLView->init (this, getPixelFormat ()))
@@ -84,8 +83,7 @@ bool COpenGLView::createPlatformOpenGLView ()
platformOpenGLViewSizeChanged ();
return true;
}
platformOpenGLView->forget ();
platformOpenGLView = 0;
platformOpenGLView = nullptr;
}
return false;
}
@@ -97,8 +95,7 @@ bool COpenGLView::destroyPlatformOpenGLView ()
{
platformOpenGLViewWillDestroy ();
platformOpenGLView->remove ();
platformOpenGLView->forget ();
platformOpenGLView = 0;
platformOpenGLView = nullptr;
return true;
}
return false;
@@ -170,11 +167,11 @@ void COpenGLView::setVisible (bool state)
CView::setVisible (state);
if (isAttached ())
{
if (state && platformOpenGLView == 0)
if (state && platformOpenGLView)
{
createPlatformOpenGLView ();
}
else if (state == false && platformOpenGLView != 0)
else if (state == false && platformOpenGLView != nullptr)
{
destroyPlatformOpenGLView ();
}
@@ -94,7 +94,7 @@ class COpenGLView : public CView, public IOpenGLView
bool createPlatformOpenGLView ();
bool destroyPlatformOpenGLView ();

IPlatformOpenGLView* platformOpenGLView;
SharedPointer<IPlatformOpenGLView> platformOpenGLView;
};

} // namespace
@@ -48,17 +48,17 @@ class CResourceDescription
public:
enum { kIntegerType, kStringType, kUnknownType };

CResourceDescription () : type (kUnknownType) { u.name = 0; }
CResourceDescription () = default;
CResourceDescription (UTF8StringPtr name) : type (kStringType) { u.name = name; }
explicit CResourceDescription (int32_t id) : type (kIntegerType) { u.id = id; }

CResourceDescription& operator= (int32_t id) { u.id = id; type = kIntegerType; return *this; }
CResourceDescription& operator= (const CResourceDescription& desc) { type = desc.type; u.id = desc.u.id; u.name = desc.u.name; return *this; }

int32_t type;
int32_t type {kUnknownType};
union {
int32_t id;
UTF8StringPtr name;
UTF8StringPtr name {nullptr};
} u;
};

@@ -884,9 +884,8 @@ void CView::unregisterViewListener (IViewListener* listener)
//-----------------------------------------------------------------------------
CDragContainerHelper::CDragContainerHelper (IDataPackage* drag)
: drag (drag)
, index (0)
{

vstgui_assert (drag, "drag cannot be nullptr");
}

//-----------------------------------------------------------------------------
@@ -333,6 +333,7 @@ class CDragContainerHelper
{
public:
explicit CDragContainerHelper (IDataPackage* drag);
CDragContainerHelper () = delete;

void* first (int32_t& size, int32_t& type);
void* next (int32_t& size, int32_t& type);
@@ -350,8 +351,8 @@ class CDragContainerHelper
};
protected:

IDataPackage* drag;
int32_t index;
IDataPackage* drag {nullptr};
int32_t index {0};
};

} // namespace
@@ -33,13 +33,12 @@ class DispatchList
Array entries;
Array toRemove;
Array toAdd;
bool inForEach;
bool inForEach {false};
};

//------------------------------------------------------------------------
template <typename T>
DispatchList<T>::DispatchList ()
: inForEach (false)
{
}

@@ -77,16 +77,17 @@ class IDependency

//----------------------------------------------------------------------------------------------------
protected:
IDependency ();
IDependency () = default;
virtual ~IDependency ();

static void rememberObject (CBaseObject* obj) { obj->remember (); }
static void forgetObject (CBaseObject* obj) { obj->forget (); }

int32_t deferChangeCount;
typedef std::set<IdStringPtr> DeferedChangesSet;
DeferedChangesSet deferedChanges;
typedef std::list<CBaseObject*> DependentList;

int32_t deferChangeCount {0};
DeferedChangesSet deferedChanges;
DependentList dependents;
};

@@ -138,12 +139,6 @@ inline void IDependency::deferChanges (bool state)
}
}

//----------------------------------------------------------------------------------------------------
inline IDependency::IDependency ()
: deferChangeCount (0)
{
}

//----------------------------------------------------------------------------------------------------
inline IDependency::~IDependency ()
{

0 comments on commit 8096526

Please sign in to comment.
You can’t perform that action at this time.