Skip to content

Commit 45eacd7

Browse files
committed
Release 1.0.26
* Removed internal key auto-repeat simulation for tk::ListBox. * Updated text clipping algorithm for tk::Button. * Fixed bun in tk::ListBox widget which didn'\''t allow to scroll the list box when using keyboard keys. * Implemented TabGroup widget. * Implemented shortcut handling mechancs by tk::Window. * Small bugfix in LedMeterChannel related to header display. * Added maximum amplitude property to AudioChannel and AudioSample. * Added possibility to draw background around tk::GraphText widget. * Fixed stylesheets: keeping the order of properties same to the order in the XML document when stylesheet is applied to styles. * Updated build scripts. * Updated module versions in dependencies.
2 parents 393ea9b + 0a9b964 commit 45eacd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3588
-340
lines changed

CHANGELOG

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

5+
=== 1.0.26 ===
6+
* Removed internal key auto-repeat simulation for tk::ListBox.
7+
* Updated text clipping algorithm for tk::Button.
8+
* Fixed bun in tk::ListBox widget which didn't allow to scroll the list box
9+
when using keyboard keys.
10+
* Implemented TabGroup widget.
11+
* Implemented shortcut handling mechancs by tk::Window.
12+
* Small bugfix in LedMeterChannel related to header display.
13+
* Added maximum amplitude property to AudioChannel and AudioSample.
14+
* Added possibility to draw background around tk::GraphText widget.
15+
* Fixed stylesheets: keeping the order of properties same to the order in the XML
16+
document when stylesheet is applied to styles.
17+
* Updated build scripts.
18+
* Updated module versions in dependencies.
19+
520
=== 1.0.25 ===
621
* Updated build scripts.
722
* Updated module versions in dependencies.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The full list of provided widgets:
4545
* MultiLabel - widget that allows to implement overlay of multiple labels on the same area.
4646
* ScrollArea - container that allows to package widget into limited rectangular space.
4747
* TabControl - container that allows to organize widgets as a set of tabs.
48+
* TabGroup - container that behaves similar to ComboGroup but uses tabs insetad of combo box.
4849
* Window - window widget.
4950
* Dialogs:
5051
* FileDialog - widget for selecting files for load/save operations.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2024 Vladimir Sadovnikov <[email protected]>
4+
*
5+
* This file is part of lsp-tk-lib
6+
* Created on: 9 дек. 2024 г.
7+
*
8+
* lsp-tk-lib is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Lesser General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* any later version.
12+
*
13+
* lsp-tk-lib is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Lesser General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Lesser General Public License
19+
* along with lsp-tk-lib. If not, see <https://www.gnu.org/licenses/>.
20+
*/
21+
22+
#ifndef LSP_PLUG_IN_TK_HELPERS_KEYBOARD_H_
23+
#define LSP_PLUG_IN_TK_HELPERS_KEYBOARD_H_
24+
25+
#include <lsp-plug.in/tk/tk.h>
26+
27+
namespace lsp
28+
{
29+
namespace tk
30+
{
31+
/**
32+
* Translate key code to key modifier
33+
* @param code code to translate
34+
* @return key modifier or KM_NONE
35+
*/
36+
LSP_TK_LIB_PUBLIC
37+
key_modifier_t key_code_to_modifier(ws::code_t code);
38+
39+
} /* namespace tk */
40+
} /* namespace lsp */
41+
42+
#endif /* LSP_PLUG_IN_TK_HELPERS_KEYBOARD_H_ */

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

Lines changed: 7 additions & 6 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) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2024 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 5 нояб. 2017 г.
@@ -37,10 +37,6 @@ namespace lsp
3737
*/
3838
class Color: public MultiProperty
3939
{
40-
protected:
41-
Color & operator = (const Color &);
42-
Color(const Color &);
43-
4440
protected:
4541
enum property_t
4642
{
@@ -63,8 +59,13 @@ namespace lsp
6359

6460
protected:
6561
explicit Color(prop::Listener *listener = NULL);
62+
Color(const Color &) = delete;
63+
Color(Color &&) = delete;
6664
virtual ~Color();
6765

66+
Color & operator = (const Color &) = delete;
67+
Color & operator = (Color &&) = delete;
68+
6869
public:
6970
inline void set_default() { MultiProperty::set_default(vAtoms, DESC); };
7071

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

Lines changed: 53 additions & 16 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) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2024 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 13 июн. 2020 г.
@@ -22,6 +22,12 @@
2222
#ifndef LSP_PLUG_IN_TK_PROP_MULTI_SHORTCUT_H_
2323
#define LSP_PLUG_IN_TK_PROP_MULTI_SHORTCUT_H_
2424

25+
#ifndef LSP_PLUG_IN_TK_IMPL
26+
#error "use <lsp-plug.in/tk/tk.h>"
27+
#endif
28+
29+
#include <lsp-plug.in/tk/sys/Slot.h>
30+
2531
namespace lsp
2632
{
2733
namespace tk
@@ -32,10 +38,6 @@ namespace lsp
3238
*/
3339
class Shortcut: public MultiProperty
3440
{
35-
private:
36-
Shortcut & operator = (const Shortcut &);
37-
Shortcut(const Shortcut &);
38-
3941
protected:
4042
enum property_t
4143
{
@@ -54,6 +56,7 @@ namespace lsp
5456
atom_t vAtoms[P_COUNT]; // Atom bindings
5557
size_t nMod; // Modifiers
5658
ws::code_t nKey; // Key
59+
Slot sSlot; // Event handling
5760

5861
protected:
5962
static status_t append_modifier(LSPString *s, size_t mod, size_t index);
@@ -63,6 +66,9 @@ namespace lsp
6366
static status_t format_modifiers(LSPString *s, size_t mod);
6467
static status_t format_key(LSPString *s, ws::code_t key);
6568

69+
static bool check_modifier(size_t mod, size_t check);
70+
static bool check_modifiers(size_t mod, size_t check);
71+
6672
protected:
6773
virtual void push();
6874
virtual void commit(atom_t property);
@@ -74,6 +80,13 @@ namespace lsp
7480

7581
protected:
7682
explicit Shortcut(prop::Listener *listener = NULL);
83+
Shortcut(const Shortcut &) = delete;
84+
Shortcut(Shortcut &&) = delete;
85+
86+
Shortcut & operator = (const Shortcut &) = delete;
87+
Shortcut & operator = (Shortcut &&) = delete;
88+
89+
public:
7790
virtual ~Shortcut();
7891

7992
public:
@@ -116,15 +129,40 @@ namespace lsp
116129
inline size_t remove_modifiers(size_t mod) { return set_modifiers(nMod & (~mod)); }
117130
inline size_t toggle_modifiers(size_t mod) { return set_modifiers(nMod ^ mod); }
118131

119-
inline void clear() { set(ws::WSK_UNKNOWN, 0); }
132+
inline void clear() { set(ws::WSK_UNKNOWN, KM_NONE); }
133+
134+
inline Slot *slot() { return &sSlot; }
135+
136+
bool equals(const Shortcut *scut) const;
137+
bool equals(const Shortcut &scut) const;
138+
139+
/**
140+
* Set key and modifiers to be equal to the passed shortcut
141+
* @param scut passed shortcut
142+
*/
143+
void set(const Shortcut *scut);
144+
145+
/**
146+
* Set key and modifiers to be equal to the passed shortcut
147+
* @param scut passed shortcut
148+
*/
149+
void set(const Shortcut &scut);
120150

121151
/**
122152
* Check that shortcut must trigger
123153
* @param key key to check
124154
* @param mod modifier
125155
* @return true if shortcut must trigger
126156
*/
127-
bool check(ws::code_t key, size_t mod);
157+
bool match(ws::code_t key, size_t mod) const;
158+
159+
/**
160+
* Check if shortcut matches another shortcut
161+
* @param scut shotcut to check
162+
* @return true if shortcut matches the passed shortcut
163+
*/
164+
bool match(const Shortcut *scut) const;
165+
bool match(const Shortcut &scut) const;
128166

129167
/**
130168
* Format state to the string presentation
@@ -138,13 +176,13 @@ namespace lsp
138176
{
139177
class Shortcut: public tk::Shortcut
140178
{
141-
private:
142-
Shortcut & operator = (const Shortcut &);
143-
Shortcut(const Shortcut &);
144-
145179
public:
146180
inline Shortcut(prop::Listener *listener = NULL): tk::Shortcut(listener) {}
147-
inline ~Shortcut() {}
181+
Shortcut(const Shortcut &) = delete;
182+
Shortcut(Shortcut &&) = delete;
183+
184+
Shortcut & operator = (const Shortcut &) = delete;
185+
Shortcut & operator = (Shortcut &&) = delete;
148186

149187
public:
150188
/**
@@ -155,9 +193,8 @@ namespace lsp
155193
inline status_t bind(const LSPString *property, Style *style) { return tk::Shortcut::bind(property, style, vAtoms, DESC, &sListener); }
156194
};
157195
}
158-
}
159-
}
160-
196+
} /* namespace tk */
197+
} /* namespace lsp */
161198

162199

163200
#endif /* LSP_PLUG_IN_TK_PROP_MULTI_SHORTCUT_H_ */

include/lsp-plug.in/tk/style/Schema.h

Lines changed: 18 additions & 6 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) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2024 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 6 мая 2020 г.
@@ -63,17 +63,20 @@ namespace lsp
6363
*/
6464
class Schema
6565
{
66-
private:
67-
Schema & operator = (const Schema &);
68-
Schema(const Schema &);
69-
7066
protected:
7167
enum flags_t
7268
{
7369
S_CONFIGURING = 1 << 0, // Schema is in configuration state
7470
S_INITIALIZED = 1 << 1, // Schema is initialized
7571
};
7672

73+
typedef struct raw_property_t
74+
{
75+
const LSPString *name;
76+
const LSPString *value;
77+
ssize_t order;
78+
} raw_property_t;
79+
7780
typedef struct property_value_t
7881
{
7982
property_type_t type;
@@ -102,6 +105,10 @@ namespace lsp
102105
prop::Boolean sInvertMouseHScroll;
103106
prop::Boolean sInvertMouseVScroll;
104107

108+
protected:
109+
static ssize_t compare_properties_by_order(const raw_property_t *a, const raw_property_t *b);
110+
static bool make_raw_properties(StyleSheet::style_t *xs, lltl::darray<raw_property_t> *props);
111+
105112
protected:
106113
status_t create_builtin_style(IStyleFactory *init);
107114
status_t create_style(const LSPString *name);
@@ -125,8 +132,13 @@ namespace lsp
125132

126133
public:
127134
explicit Schema(Atoms *atoms, Display *dpy);
135+
Schema(const Schema &) = delete;
136+
Schema(Schema &&) = delete;
128137
virtual ~Schema();
129138

139+
Schema & operator = (const Schema &) = delete;
140+
Schema & operator = (Schema &&) = delete;
141+
130142
/**
131143
* Initialize schema with the specified list of styles
132144
* Can be run only once after the schema is instantiated. Otherwise

include/lsp-plug.in/tk/style/Style.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
3-
* (C) 2023 Vladimir Sadovnikov <[email protected]>
2+
* Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2024 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 1 окт. 2019 г.
@@ -571,12 +571,12 @@ namespace lsp
571571
#define LSP_TK_STYLE_DEF_BEGIN(Name, Parent) \
572572
class Name : public Parent \
573573
{ \
574-
private: \
575-
Name & operator = (Name &); \
576-
Name(const Name &); \
577-
\
578574
public: \
579575
explicit Name(::lsp::tk::Schema *schema, const char *name, const char *parents); \
576+
Name(const Name &) = delete; \
577+
Name(Name &&) = delete; \
578+
Name & operator = (const Name &) = delete; \
579+
Name & operator = (Name &&) = delete; \
580580
\
581581
public: \
582582
virtual ::lsp::status_t init(); \

include/lsp-plug.in/tk/style/StyleSheet.h

Lines changed: 18 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) 2024 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2024 Vladimir Sadovnikov <[email protected]>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 1 нояб. 2020 г.
@@ -46,17 +46,21 @@ namespace lsp
4646
class StyleSheet
4747
{
4848
private:
49-
StyleSheet & operator = (const StyleSheet &);
50-
StyleSheet(const StyleSheet &);
51-
5249
friend class Schema;
5350

5451
protected:
52+
typedef struct property_t
53+
{
54+
size_t order; // Property order
55+
LSPString value; // Property value
56+
} property_t;
57+
5558
typedef struct style_t
5659
{
60+
size_t order_gen; // Property order generator
5761
LSPString name; // Name of style
5862
lltl::parray<LSPString> parents; // List of parents
59-
lltl::pphash<LSPString, LSPString> properties; // properties
63+
lltl::pphash<LSPString, property_t> properties; // properties
6064

6165
style_t();
6266
~style_t();
@@ -86,8 +90,13 @@ namespace lsp
8690

8791
public:
8892
explicit StyleSheet();
93+
StyleSheet(const StyleSheet &) = delete;
94+
StyleSheet(StyleSheet &&) = delete;
8995
~StyleSheet();
9096

97+
StyleSheet & operator = (const StyleSheet &) = delete;
98+
StyleSheet & operator = (StyleSheet &&) = delete;
99+
91100
protected:
92101
status_t parse_document(xml::PullParser *p);
93102
status_t parse_schema(xml::PullParser *p);
@@ -145,8 +154,9 @@ namespace lsp
145154
public:
146155
const LSPString *error() const { return &sError; }
147156
};
148-
}
149-
}
157+
158+
} /* namespace tk */
159+
} /* namespace lsp */
150160

151161

152162

0 commit comments

Comments
 (0)