Skip to content

Commit ce1fd4a

Browse files
committed
Release 1.0.20
* Added possibility to control the value set to RangeFloat and Float properties. * Fixed illegal memory access when destroying Box, Grid and Menu widgets. * Updated build scripts. * Updated module versions in dependencies.
2 parents 55d344b + 2c89686 commit ce1fd4a

File tree

16 files changed

+118
-55
lines changed

16 files changed

+118
-55
lines changed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
* RECENT CHANGES
33
*******************************************************************************
44

5+
=== 1.0.20 ===
6+
* Added possibility to control the value set to RangeFloat and Float properties.
7+
* Fixed illegal memory access when destroying Box, Grid and Menu widgets.
8+
* Updated build scripts.
9+
* Updated module versions in dependencies.
10+
511
=== 1.0.19 ===
612
* Optimized work with atoms.
713
* Many code updates that could cause potential problems related to using another

include/lsp-plug.in/tk/prop/multi/RangeFloat.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ namespace lsp
3535
*/
3636
class RangeFloat: public MultiProperty
3737
{
38-
private:
39-
RangeFloat & operator = (const RangeFloat &);
40-
RangeFloat(const RangeFloat &);
41-
4238
protected:
4339
enum property_t
4440
{
@@ -65,18 +61,30 @@ namespace lsp
6561
float fMin;
6662
float fMax;
6763
size_t nFlags;
64+
float_transform_t pTransform;
65+
mutable void *pTransformArg;
6866

6967
protected:
70-
virtual void push();
71-
virtual void commit(atom_t property);
68+
virtual void push() override;
69+
virtual void commit(atom_t property) override;
7270

7371
float climited(float v) const;
7472
float change(float k, float step);
7573
float do_limit(float v) const;
74+
float transform(float v) const;
7675

7776
protected:
7877
explicit RangeFloat(prop::Listener *listener = NULL);
79-
virtual ~RangeFloat();
78+
RangeFloat(const RangeFloat &) = delete;
79+
RangeFloat(RangeFloat &&) = delete;
80+
virtual ~RangeFloat() override;
81+
82+
RangeFloat & operator = (const RangeFloat &) = delete;
83+
RangeFloat & operator = (RangeFloat &&) = delete;
84+
85+
public:
86+
inline void set_transform(float_transform_t func, void *arg = NULL) { pTransform = func; pTransformArg = arg; }
87+
inline void clear_transform() { set_transform(NULL, NULL); }
8088

8189
public:
8290
inline float get() const { return do_limit(fValue); }

include/lsp-plug.in/tk/prop/simple/Float.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@ namespace lsp
3737
{
3838
protected:
3939
float fValue;
40+
float_transform_t pTransform;
41+
mutable void *pTransformArg;
4042

4143
protected:
42-
virtual void commit(atom_t property);
43-
virtual void push();
44+
virtual void commit(atom_t property) override;
45+
virtual void push() override;
46+
47+
protected:
48+
float transform(float v) const;
4449

4550
protected:
4651
explicit Float(prop::Listener *listener = NULL);
@@ -51,6 +56,10 @@ namespace lsp
5156
Float & operator = (const Float &) = delete;
5257
Float & operator = (Float &&) = delete;
5358

59+
public:
60+
inline void set_transform(float_transform_t func, void *arg = NULL) { pTransform = func; pTransformArg = arg; }
61+
inline void clear_transform() { set_transform(NULL, NULL); }
62+
5463
public:
5564
/**
5665
* Get value of the float property

include/lsp-plug.in/tk/prop/types.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ namespace lsp
5252
PT_UNKNOWN = -1
5353
};
5454

55+
// Forward class declaration
56+
class Atoms;
57+
class Widget;
58+
class Style;
59+
class IStyleListener;
60+
class Widget;
61+
62+
// Value transformation functions
63+
typedef float (* float_transform_t)(float value, void *arg);
64+
typedef ssize_t (* int_transform_t)(ssize_t value, void *arg);
65+
5566
namespace prop
5667
{
5768
typedef struct desc_t
@@ -65,15 +76,8 @@ namespace lsp
6576
const char *name;
6677
ssize_t value;
6778
} enum_t;
68-
}
69-
70-
// Forward class declaration
71-
class Atoms;
72-
class Widget;
73-
class Style;
74-
class IStyleListener;
75-
class Widget;
76-
}
77-
}
79+
} /* namespace prop */
80+
} /* namespace tk */
81+
} /* namespace lsp */
7882

7983
#endif /* LSP_PLUG_IN_TK_PROP_TYPES_H_ */

include/lsp-plug.in/tk/types.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3-
* (C) 2020 Vladimir Sadovnikov <[email protected]>
2+
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2023 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 5 мая 2020 г.
@@ -206,7 +206,8 @@ namespace lsp
206206
* Atom identifier
207207
*/
208208
typedef ssize_t atom_t;
209-
}
210-
}
209+
210+
} /* namespace tk */
211+
} /* namespace lsp */
211212

212213
#endif /* LSP_PLUG_IN_TK_TYPES_H_ */

include/lsp-plug.in/tk/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#define LSP_TK_LIB_MAJOR 1
2626
#define LSP_TK_LIB_MINOR 0
27-
#define LSP_TK_LIB_MICRO 19
27+
#define LSP_TK_LIB_MICRO 20
2828

2929
#if defined(LSP_TK_LIB_PUBLISHER)
3030
#define LSP_TK_LIB_PUBLIC LSP_EXPORT_MODIFIER

make/functions.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ vmajor = $(shell echo "$(strip $1)" | sed -E 's/([0-9]+)\.([0-9
6161
vminor = $(shell echo "$(strip $1)" | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)(-(.*))?/\2/')
6262
vmicro = $(shell echo "$(strip $1)" | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)(-(.*))?/\3/')
6363
vbranch = $(shell echo "$(strip $1)" | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)(-(.*))?/\5/')
64+
65+
ifeq ("$(MSYSTEM)","")
66+
pathconv = $1
67+
else
68+
pathconv = $(shell cygpath -w "$1")
69+
endif

modules.mk

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,61 +19,61 @@
1919
#
2020

2121
# Variables that describe dependencies
22-
LSP_COMMON_LIB_VERSION := 1.0.33
22+
LSP_COMMON_LIB_VERSION := 1.0.34
2323
LSP_COMMON_LIB_NAME := lsp-common-lib
2424
LSP_COMMON_LIB_TYPE := src
2525
LSP_COMMON_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_COMMON_LIB_NAME).git
2626
LSP_COMMON_LIB_URL_RW := [email protected]:lsp-plugins/$(LSP_COMMON_LIB_NAME).git
2727

28-
LSP_TEST_FW_VERSION := 1.0.23
28+
LSP_TEST_FW_VERSION := 1.0.24
2929
LSP_TEST_FW_NAME := lsp-test-fw
3030
LSP_TEST_FW_TYPE := src
3131
LSP_TEST_FW_URL_RO := https://github.com/lsp-plugins/$(LSP_TEST_FW_NAME).git
3232
LSP_TEST_FW_URL_RW := [email protected]:lsp-plugins/$(LSP_TEST_FW_NAME).git
3333

34-
LSP_LLTL_LIB_VERSION := 1.0.16
34+
LSP_LLTL_LIB_VERSION := 1.0.17
3535
LSP_LLTL_LIB_NAME := lsp-lltl-lib
3636
LSP_LLTL_LIB_TYPE := src
3737
LSP_LLTL_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_LLTL_LIB_NAME).git
3838
LSP_LLTL_LIB_URL_RW := [email protected]:lsp-plugins/$(LSP_LLTL_LIB_NAME).git
3939

40-
LSP_RUNTIME_LIB_VERSION := 1.0.19
40+
LSP_RUNTIME_LIB_VERSION := 1.0.20
4141
LSP_RUNTIME_LIB_NAME := lsp-runtime-lib
4242
LSP_RUNTIME_LIB_TYPE := src
4343
LSP_RUNTIME_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_RUNTIME_LIB_NAME).git
4444
LSP_RUNTIME_LIB_URL_RW := [email protected]:lsp-plugins/$(LSP_RUNTIME_LIB_NAME).git
4545

46-
LSP_R3D_IFACE_VERSION := 1.0.16
46+
LSP_R3D_IFACE_VERSION := 1.0.17
4747
LSP_R3D_IFACE_NAME := lsp-r3d-iface
4848
LSP_R3D_IFACE_TYPE := src
4949
LSP_R3D_IFACE_URL_RO := https://github.com/lsp-plugins/$(LSP_R3D_IFACE_NAME).git
5050
LSP_R3D_IFACE_URL_RW := [email protected]:lsp-plugins/$(LSP_R3D_IFACE_NAME).git
5151

52-
LSP_R3D_BASE_LIB_VERSION := 1.0.16
52+
LSP_R3D_BASE_LIB_VERSION := 1.0.17
5353
LSP_R3D_BASE_LIB_NAME := lsp-r3d-base-lib
5454
LSP_R3D_BASE_LIB_TYPE := src
5555
LSP_R3D_BASE_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_R3D_BASE_LIB_NAME).git
5656
LSP_R3D_BASE_LIB_URL_RW := [email protected]:lsp-plugins/$(LSP_R3D_BASE_LIB_NAME).git
5757

58-
LSP_R3D_GLX_LIB_VERSION := 1.0.16
58+
LSP_R3D_GLX_LIB_VERSION := 1.0.17
5959
LSP_R3D_GLX_LIB_NAME := lsp-r3d-glx-lib
6060
LSP_R3D_GLX_LIB_TYPE := src
6161
LSP_R3D_GLX_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_R3D_GLX_LIB_NAME).git
6262
LSP_R3D_GLX_LIB_URL_RW := [email protected]:lsp-plugins/$(LSP_R3D_GLX_LIB_NAME).git
6363

64-
LSP_R3D_WGL_LIB_VERSION := 1.0.11
64+
LSP_R3D_WGL_LIB_VERSION := 1.0.12
6565
LSP_R3D_WGL_LIB_NAME := lsp-r3d-wgl-lib
6666
LSP_R3D_WGL_LIB_TYPE := src
6767
LSP_R3D_WGL_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_R3D_WGL_LIB_NAME).git
6868
LSP_R3D_WGL_LIB_URL_RW := [email protected]:lsp-plugins/$(LSP_R3D_WGL_LIB_NAME).git
6969

70-
LSP_WS_LIB_VERSION := 1.0.19
70+
LSP_WS_LIB_VERSION := 1.0.20
7171
LSP_WS_LIB_NAME := lsp-ws-lib
7272
LSP_WS_LIB_TYPE := src
7373
LSP_WS_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_WS_LIB_NAME).git
7474
LSP_WS_LIB_URL_RW := [email protected]:lsp-plugins/$(LSP_WS_LIB_NAME).git
7575

76-
LSP_DSP_LIB_VERSION := 1.0.20
76+
LSP_DSP_LIB_VERSION := 1.0.21
7777
LSP_DSP_LIB_NAME := lsp-dsp-lib
7878
LSP_DSP_LIB_TYPE := src
7979
LSP_DSP_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_DSP_LIB_NAME).git

project.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ ARTIFACT_ID = LSP_TK_LIB
2323
ARTIFACT_NAME = lsp-tk-lib
2424
ARTIFACT_DESC = Graphical toolkit library for Linux Studio Plugins Project
2525
ARTIFACT_HEADERS = lsp-plug.in
26-
ARTIFACT_VERSION = 1.0.19
26+
ARTIFACT_VERSION = 1.0.20
2727
ARTIFACT_EXPORT_ALL = 1

src/main/prop/multi/RangeFloat.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3-
* (C) 2020 Vladimir Sadovnikov <[email protected]>
2+
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2023 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 23 мая 2023 г.
@@ -39,10 +39,12 @@ namespace lsp
3939
RangeFloat::RangeFloat(prop::Listener *listener):
4040
MultiProperty(vAtoms, P_COUNT, listener)
4141
{
42-
fMin = 0.0f;
43-
fMax = 1.0f;
44-
fValue = 0.0f;
45-
nFlags = F_AUTO_LIMIT;
42+
fMin = 0.0f;
43+
fMax = 1.0f;
44+
fValue = 0.0f;
45+
nFlags = F_AUTO_LIMIT;
46+
pTransform = NULL;
47+
pTransformArg = NULL;
4648
}
4749

4850
RangeFloat::~RangeFloat()
@@ -194,7 +196,7 @@ namespace lsp
194196
value = value - truncf(value);
195197
if (nFlags & F_AUTO_LIMIT)
196198
value = lsp_limit(value, 0.0f, 1.0f);
197-
value = fMin + (fMax - fMin) * value;
199+
value = transform(fMin + (fMax - fMin) * value);
198200
if (value == old)
199201
return old;
200202

@@ -203,8 +205,14 @@ namespace lsp
203205
return old;
204206
}
205207

208+
float RangeFloat::transform(float v) const
209+
{
210+
return (pTransform != NULL) ? pTransform(v, pTransformArg) : v;
211+
}
212+
206213
float RangeFloat::do_limit(float value) const
207214
{
215+
value = transform(value);
208216
return (nFlags & F_AUTO_LIMIT) ?
209217
Property::limit(value, fMin, fMax) :
210218
value;
@@ -231,7 +239,7 @@ namespace lsp
231239
value += delta;
232240
}
233241

234-
return value;
242+
return do_limit(value);
235243
}
236244

237245
float RangeFloat::change(float k, float step)

0 commit comments

Comments
 (0)