diff --git a/CHANGELOG b/CHANGELOG index db926183..21c994a3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,13 @@ * RECENT CHANGES ******************************************************************************* +=== 1.0.14 === +* Improved code base by using PVS Studio static code analyzer. +* Fixed several issues reported by PVS Studio static analyzer. +* Added tk::Menu::showmp method to show menu at current mouse cursor's position + as a window transient for specified widget. +* Updated module versions in dependencies. + === 1.0.13 === * Several fixes and optimizations related to tk::LedMeterChannel and tk::LedMeter. * Fixed bug in tk::TabControl widget destruction. diff --git a/README.md b/README.md index 142bd62d..f5cea2db 100644 --- a/README.md +++ b/README.md @@ -329,4 +329,7 @@ The result of this example: ![Indicator widget](res/doc/example-msg.png) +## SAST Tools + +* [PVS-Studio](https://pvs-studio.com/en/pvs-studio/?utm_source=website&utm_medium=github&utm_campaign=open_source) - static analyzer for C, C++, C#, and Java code. diff --git a/include/lsp-plug.in/tk/prop/base/Flags.h b/include/lsp-plug.in/tk/prop/base/Flags.h index eec4a75b..f7522a67 100644 --- a/include/lsp-plug.in/tk/prop/base/Flags.h +++ b/include/lsp-plug.in/tk/prop/base/Flags.h @@ -33,19 +33,12 @@ namespace lsp class Flags: public Property { - private: - Flags & operator = (const Flags &); - Flags(const Flags &); - protected: size_t nFlags; // Bit field of flags const char * const *pFlags; // Flag description atom_t *vAtoms; // List of associated atoms protected: - virtual void push(); - virtual void commit(atom_t property); - status_t unbind(); status_t bind(atom_t id, Style *style); status_t bind(const char *id, Style *style); @@ -59,9 +52,18 @@ namespace lsp bool unset(size_t ordinal); bool toggle(size_t ordinal); + protected: + virtual void push() override; + virtual void commit(atom_t property) override; + protected: explicit Flags(const char * const *flags, atom_t *atoms, prop::Listener *listener = NULL); - virtual ~Flags(); + Flags(const Flags &) = delete; + Flags(Flags &&) = delete; + virtual ~Flags() override; + + Flags & operator = (const Flags &) = delete; + Flags & operator = (Flags &&) = delete; }; } /* namespace tk */ diff --git a/include/lsp-plug.in/tk/prop/flags/Allocation.h b/include/lsp-plug.in/tk/prop/flags/Allocation.h index 81e2ff17..a4eb74e5 100644 --- a/include/lsp-plug.in/tk/prop/flags/Allocation.h +++ b/include/lsp-plug.in/tk/prop/flags/Allocation.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 16 мая 2020 г. @@ -39,10 +39,6 @@ namespace lsp */ class Allocation: public Flags { - private: - Allocation & operator = (const Allocation &); - Allocation(const Allocation &); - protected: static const char * const FLAGS[]; @@ -62,7 +58,12 @@ namespace lsp atom_t vAtoms[F_TOTAL]; protected: - inline Allocation(prop::Listener *listener = NULL): Flags(FLAGS, vAtoms, listener) {} + Allocation(prop::Listener *listener = NULL); + Allocation(const Allocation &) = delete; + Allocation(Allocation &&) = delete; + + Allocation & operator = (const Allocation &) = delete; + Allocation & operator = (Allocation &&) = delete; public: inline bool hfill() const { return Flags::get(F_HFILL); } @@ -119,7 +120,7 @@ namespace lsp */ inline status_t unbind() { return tk::Allocation::unbind(); }; }; - } + } /* namespace prop */ } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/prop/flags/WindowActions.h b/include/lsp-plug.in/tk/prop/flags/WindowActions.h index 8cc38b1f..01c132d0 100644 --- a/include/lsp-plug.in/tk/prop/flags/WindowActions.h +++ b/include/lsp-plug.in/tk/prop/flags/WindowActions.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 8 мая 2020 г. @@ -35,15 +35,16 @@ namespace lsp class WindowActions: public BitEnum { - private: - WindowActions & operator = (const WindowActions &); - WindowActions(const WindowActions &); - protected: static const prop::enum_t ENUM[]; protected: explicit WindowActions(prop::Listener *listener = NULL): BitEnum(ENUM, listener) {}; + WindowActions(const WindowActions &) = delete; + WindowActions(WindowActions &&) = delete; + + WindowActions & operator = (const WindowActions &) = delete; + WindowActions & operator = (WindowActions &&) = delete; public: inline bool allowed(ws::window_action_t wa) const { return nValue & wa; } @@ -128,9 +129,9 @@ namespace lsp */ inline status_t unbind() { return tk::WindowActions::unbind(); }; }; - } - } -} + } /* namespace prop */ + } /* namespace tk */ +} /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/prop/multi/Font.h b/include/lsp-plug.in/tk/prop/multi/Font.h index e6b20a73..f982d116 100644 --- a/include/lsp-plug.in/tk/prop/multi/Font.h +++ b/include/lsp-plug.in/tk/prop/multi/Font.h @@ -82,12 +82,12 @@ namespace lsp protected: void push_masked(size_t mask); - virtual void push(); - virtual void commit(atom_t property); + virtual void push() override; + virtual void commit(atom_t property) override; protected: explicit Font(prop::Listener *listener = NULL); - virtual ~Font(); + virtual ~Font() override; public: inline void set_default() { MultiProperty::set_default(vAtoms, DESC); } @@ -123,7 +123,7 @@ namespace lsp void set(const ws::Font *f); public: - virtual void override(); + virtual void override() override; bool get_parameters(ws::ISurface *s, float scaling, ws::font_parameters_t *fp) const; bool get_parameters(Display *dpy, float scaling, ws::font_parameters_t *fp) const; diff --git a/include/lsp-plug.in/tk/prop/multi/Vector2D.h b/include/lsp-plug.in/tk/prop/multi/Vector2D.h index 39783d4c..b41cb1e1 100644 --- a/include/lsp-plug.in/tk/prop/multi/Vector2D.h +++ b/include/lsp-plug.in/tk/prop/multi/Vector2D.h @@ -37,10 +37,6 @@ namespace lsp */ class Vector2D: public MultiProperty { - private: - Vector2D & operator = (const Vector2D &); - Vector2D(const Vector2D &); - protected: enum property_t { @@ -66,8 +62,8 @@ namespace lsp float fPhi; // Angle protected: - virtual void push(); - virtual void commit(atom_t property); + virtual void push() override; + virtual void commit(atom_t property) override; static void calc_cart (float *dx, float *dy, float rho, float phi); static void calc_polar (float *rho, float *phi, float dx, float dy); @@ -75,7 +71,12 @@ namespace lsp protected: explicit Vector2D(prop::Listener *listener = NULL); - virtual ~Vector2D(); + Vector2D(const Vector2D &) = delete; + Vector2D(Vector2D &&) = delete; + virtual ~Vector2D() override; + + Vector2D & operator = (const Vector2D &) = delete; + Vector2D & operator = (Vector2D &&) = delete; public: inline float dx() const { return fDX; } @@ -136,7 +137,7 @@ namespace lsp */ inline status_t unbind() { return tk::Vector2D::unbind(vAtoms, DESC, &sListener); }; }; - } + } /* namespace prop */ } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/prop/simple/Boolean.h b/include/lsp-plug.in/tk/prop/simple/Boolean.h index 36b18aaf..e2684c47 100644 --- a/include/lsp-plug.in/tk/prop/simple/Boolean.h +++ b/include/lsp-plug.in/tk/prop/simple/Boolean.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 7 мая 2020 г. @@ -35,10 +35,6 @@ namespace lsp */ class Boolean: public SimpleProperty { - private: - Boolean & operator = (const Boolean &); - Boolean(const Boolean &); - protected: bool bValue; @@ -48,8 +44,13 @@ namespace lsp protected: explicit Boolean(prop::Listener *listener = NULL); + Boolean(const Boolean &) = delete; + Boolean(Boolean &&) = delete; virtual ~Boolean(); + Boolean & operator = (const Boolean &) = delete; + Boolean & operator = (Boolean &&) = delete; + public: /** * Get value of the boolean property @@ -127,7 +128,7 @@ namespace lsp inline void listener(prop::Listener *listener) { pListener = listener; } }; - } + } /* namespace prop */ } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/prop/simple/Float.h b/include/lsp-plug.in/tk/prop/simple/Float.h index d19aaf1c..e0d82e50 100644 --- a/include/lsp-plug.in/tk/prop/simple/Float.h +++ b/include/lsp-plug.in/tk/prop/simple/Float.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 9 окт. 2019 г. @@ -35,10 +35,6 @@ namespace lsp */ class Float: public SimpleProperty { - private: - Float & operator = (const Float &); - Float(const Float &); - protected: float fValue; @@ -48,8 +44,13 @@ namespace lsp protected: explicit Float(prop::Listener *listener = NULL); + Float(const Float &) = delete; + Float(Float &&) = delete; virtual ~Float(); + Float & operator = (const Float &) = delete; + Float & operator = (Float &&) = delete; + public: /** * Get value of the float property @@ -109,7 +110,7 @@ namespace lsp inline void listener(prop::Listener *listener) { pListener = listener; } }; - } + } /* namespace prop */ } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/prop/simple/Integer.h b/include/lsp-plug.in/tk/prop/simple/Integer.h index e0635526..588204ce 100644 --- a/include/lsp-plug.in/tk/prop/simple/Integer.h +++ b/include/lsp-plug.in/tk/prop/simple/Integer.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 6 мая 2020 г. @@ -31,17 +31,12 @@ namespace lsp namespace tk { /** - * Integering property interface + * Integer property interface */ class Integer: public SimpleProperty { - private: - Integer & operator = (const Integer &); - Integer(const Integer &); - protected: ssize_t nValue; - Listener sListener; protected: virtual void commit(atom_t property); @@ -49,8 +44,13 @@ namespace lsp protected: explicit Integer(prop::Listener *listener = NULL); + Integer(const Integer &) = delete; + Integer(Integer &&) = delete; virtual ~Integer(); + Integer & operator = (const Integer &) = delete; + Integer & operator = (Integer &&) = delete; + public: /** * Get value of the float property @@ -107,7 +107,7 @@ namespace lsp inline void listener(prop::Listener *listener) { pListener = listener; } }; - } + } /* namespace prop */ } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/prop/simple/PathPattern.h b/include/lsp-plug.in/tk/prop/simple/PathPattern.h index a2070535..4ea6d85b 100644 --- a/include/lsp-plug.in/tk/prop/simple/PathPattern.h +++ b/include/lsp-plug.in/tk/prop/simple/PathPattern.h @@ -37,17 +37,18 @@ namespace lsp */ class PathPattern: public Property { - private: - PathPattern & operator = (const PathPattern &); - PathPattern(const PathPattern &); - protected: io::PathPattern sPattern; protected: explicit PathPattern(prop::Listener *listener = NULL); + PathPattern(const PathPattern &) = delete; + PathPattern(PathPattern &&) = delete; virtual ~PathPattern(); + PathPattern & operator = (const PathPattern &) = delete; + PathPattern & operator = (PathPattern &&); + public: const io::PathPattern *pattern() const { return &sPattern; } const LSPString *get() const { return sPattern.get(); } @@ -85,8 +86,8 @@ namespace lsp public: explicit PathPattern(prop::Listener *listener = NULL): tk::PathPattern(listener) {}; }; - } - } -} + } /* namespace prop */ + } /* namespace tk */ +} /* namespace lsp */ #endif /* LSP_PLUG_IN_TK_PROP_SIMPLE_PATHPATTERN_H_ */ diff --git a/include/lsp-plug.in/tk/prop/simple/String.h b/include/lsp-plug.in/tk/prop/simple/String.h index f9f5bb65..d5667815 100644 --- a/include/lsp-plug.in/tk/prop/simple/String.h +++ b/include/lsp-plug.in/tk/prop/simple/String.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 2 мар. 2020 г. @@ -40,10 +40,6 @@ namespace lsp */ class String: public SimpleProperty { - private: - String & operator = (const String &); - String(const String &); - protected: enum flags_t { @@ -94,8 +90,13 @@ namespace lsp protected: explicit String(prop::Listener *listener = NULL); + String(const String &) = delete; + String(String &&) = delete; virtual ~String(); + String & operator = (const String &) = delete; + String & operator = (String &&) = delete; + public: /** * Check wheter the string is localized @@ -240,11 +241,15 @@ namespace lsp class String: public tk::String { private: - String & operator = (const String &); - String(const String &); + public: explicit String(prop::Listener *listener = NULL): tk::String(listener) {}; + String(const String &)= delete; + String(String &&)= delete; + + String & operator = (const String &) = delete; + String & operator = (String &&) = delete; public: using tk::String::format; @@ -273,7 +278,7 @@ namespace lsp inline void listener(prop::Listener *listener) { pListener = listener; } }; - } + } /* namespace prop */ } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/prop/specific/GraphFrameData.h b/include/lsp-plug.in/tk/prop/specific/GraphFrameData.h index d324a1f4..a43bbbe0 100644 --- a/include/lsp-plug.in/tk/prop/specific/GraphFrameData.h +++ b/include/lsp-plug.in/tk/prop/specific/GraphFrameData.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 2 сент. 2020 г. @@ -32,10 +32,6 @@ namespace lsp { class GraphFrameData: public MultiProperty { - private: - GraphFrameData & operator = (const GraphFrameData &); - GraphFrameData(const GraphFrameData &); - protected: static const prop::desc_t DESC[]; @@ -60,7 +56,7 @@ namespace lsp inline Listener(GraphFrameData *data) { pValue = data; }; public: - virtual void notify(atom_t property); + virtual void notify(atom_t property) override; }; protected: @@ -87,8 +83,13 @@ namespace lsp public: explicit GraphFrameData(prop::Listener *listener); + GraphFrameData(const GraphFrameData &) = delete; + GraphFrameData(GraphFrameData &&) = delete; virtual ~GraphFrameData(); + GraphFrameData & operator = (const GraphFrameData &) = delete; + GraphFrameData & operator = (GraphFrameData &&) = delete; + public: size_t rows() const { return nRows; } size_t columns() const { return nCols; } @@ -138,10 +139,9 @@ namespace lsp inline status_t bind(const LSPString *property, Style *style) { return tk::GraphFrameData::bind(property, style, vAtoms, DESC, &sListener); } }; - }; - } -} - + } /* namespace prop */ + } /*namespace tk */ +} /* namespace lsp */ #endif /* LSP_PLUG_IN_TK_PROP_SPECIFIC_GRAPHFRAMEDATA_H_ */ diff --git a/include/lsp-plug.in/tk/prop/specific/GraphMeshData.h b/include/lsp-plug.in/tk/prop/specific/GraphMeshData.h index 243a4863..812b84cb 100644 --- a/include/lsp-plug.in/tk/prop/specific/GraphMeshData.h +++ b/include/lsp-plug.in/tk/prop/specific/GraphMeshData.h @@ -32,10 +32,6 @@ namespace lsp { class GraphMeshData: public MultiProperty { - private: - GraphMeshData &operator = (const GraphMeshData &); - GraphMeshData(const GraphMeshData &); - protected: static const prop::desc_t DESC[]; @@ -56,7 +52,7 @@ namespace lsp inline Listener(GraphMeshData *color) { pValue = color; }; public: - virtual void notify(atom_t property); + virtual void notify(atom_t property) override; }; protected: @@ -72,12 +68,17 @@ namespace lsp protected: void copy_data(float *dst, const float *src, size_t n); void sync(); - void commit(atom_t property); + void commit(atom_t property) override; bool resize_buffer(size_t size, bool strobe); public: explicit GraphMeshData(prop::Listener *listener); - virtual ~GraphMeshData(); + GraphMeshData(const GraphMeshData &) = delete; + GraphMeshData(GraphMeshData &&) = delete; + virtual ~GraphMeshData() override; + + GraphMeshData &operator = (const GraphMeshData &) = delete; + GraphMeshData &operator = (GraphMeshData &&) = delete; public: inline size_t size() const { return nSize; } @@ -110,20 +111,21 @@ namespace lsp { class GraphMeshData: public tk::GraphMeshData { - private: - GraphMeshData &operator = (const GraphMeshData &); - GraphMeshData(const GraphMeshData &); - public: explicit inline GraphMeshData(prop::Listener *listener = NULL): tk::GraphMeshData(listener) {} + GraphMeshData(const GraphMeshData &) = delete; + GraphMeshData(GraphMeshData &&) = delete; + + GraphMeshData &operator = (const GraphMeshData &) = delete; + GraphMeshData &operator = (GraphMeshData &&) = delete; public: inline status_t bind(atom_t property, Style *style) { return tk::GraphMeshData::bind(property, style, vAtoms, DESC, &sListener); } inline status_t bind(const char *property, Style *style) { return tk::GraphMeshData::bind(property, style, vAtoms, DESC, &sListener); } inline status_t bind(const LSPString *property, Style *style) { return tk::GraphMeshData::bind(property, style, vAtoms, DESC, &sListener); } }; - }; - } -} + } /* namespace prop */ + } /*namespace tk */ +} /* namespace lsp */ #endif /* LSP_PLUG_IN_TK_PROP_SPECIFIC_GRAPHMESHDATA_H_ */ diff --git a/include/lsp-plug.in/tk/style/Style.h b/include/lsp-plug.in/tk/style/Style.h index 5bf4c383..79877b96 100644 --- a/include/lsp-plug.in/tk/style/Style.h +++ b/include/lsp-plug.in/tk/style/Style.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 1 окт. 2019 г. @@ -43,9 +43,6 @@ namespace lsp class Style { private: - Style & operator = (const Style &); - Style(const Style &); - friend class IStyleFactory; friend class Schema; friend class Property; @@ -123,8 +120,13 @@ namespace lsp public: explicit Style(Schema *schema, const char *name, const char *parents); + Style(const Style &) = delete; + Style(Style &&) = delete; virtual ~Style(); + Style & operator = (const Style &) = delete; + Style & operator = (Style &&) = delete; + virtual status_t init(); void destroy(); diff --git a/include/lsp-plug.in/tk/util/KeyboardHandler.h b/include/lsp-plug.in/tk/util/KeyboardHandler.h index 255c10fa..948f567d 100644 --- a/include/lsp-plug.in/tk/util/KeyboardHandler.h +++ b/include/lsp-plug.in/tk/util/KeyboardHandler.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 11 сент. 2017 г. @@ -32,9 +32,6 @@ namespace lsp { class KeyboardHandler: public ws::IEventHandler { - private: - KeyboardHandler & operator = (const KeyboardHandler &); - protected: enum constants_t { @@ -57,7 +54,12 @@ namespace lsp public: explicit KeyboardHandler(); - virtual ~KeyboardHandler(); + KeyboardHandler(const KeyboardHandler &) = delete; + KeyboardHandler(KeyboardHandler &&) = delete; + virtual ~KeyboardHandler() override; + + KeyboardHandler & operator = (KeyboardHandler &&) = delete; + KeyboardHandler & operator = (const KeyboardHandler &) = delete; status_t init(Display *dpy); @@ -74,7 +76,7 @@ namespace lsp public: // Event handling callbacks - virtual status_t handle_event(const ws::event_t *e); + virtual status_t handle_event(const ws::event_t *e) override; // Event handling callbacks virtual status_t on_key_down(const ws::event_t *e); diff --git a/include/lsp-plug.in/tk/version.h b/include/lsp-plug.in/tk/version.h index 308013bd..e6091da0 100644 --- a/include/lsp-plug.in/tk/version.h +++ b/include/lsp-plug.in/tk/version.h @@ -24,7 +24,7 @@ #define LSP_TK_LIB_MAJOR 1 #define LSP_TK_LIB_MINOR 0 -#define LSP_TK_LIB_MICRO 13 +#define LSP_TK_LIB_MICRO 14 #if defined(LSP_TK_LIB_PUBLISHER) #define LSP_TK_LIB_PUBLIC LSP_EXPORT_MODIFIER diff --git a/include/lsp-plug.in/tk/widgets/compound/ComboBox.h b/include/lsp-plug.in/tk/widgets/compound/ComboBox.h index 7309d7ad..829b7ec6 100644 --- a/include/lsp-plug.in/tk/widgets/compound/ComboBox.h +++ b/include/lsp-plug.in/tk/widgets/compound/ComboBox.h @@ -60,10 +60,6 @@ namespace lsp class ComboBox: public WidgetContainer { - private: - ComboBox & operator = (const ComboBox &); - ComboBox(const ComboBox &); - public: static const w_class_t metadata; @@ -94,9 +90,8 @@ namespace lsp public: explicit Window(Display *dpy, ComboBox *cbox); - virtual status_t on_hide(); - - virtual status_t on_show(); + virtual status_t on_hide() override; + virtual status_t on_show() override; }; class List: public ListBox @@ -111,12 +106,11 @@ namespace lsp explicit List(Display *dpy, ComboBox *cbox); protected: - virtual void property_changed(Property *prop); + virtual void property_changed(Property *prop) override; public: - virtual status_t on_submit(); - - virtual status_t on_change(); + virtual status_t on_submit() override; + virtual status_t on_change() override; }; protected: @@ -158,16 +152,21 @@ namespace lsp static status_t slot_on_submit(Widget *sender, void *ptr, void *data); protected: - virtual void property_changed(Property *prop); - virtual void size_request(ws::size_limit_t *r); - virtual void realize(const ws::rectangle_t *r); + virtual void property_changed(Property *prop) override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; public: explicit ComboBox(Display *dpy); - virtual ~ComboBox(); + ComboBox(const ComboBox &) = delete; + ComboBox(ComboBox &&) = delete; + virtual ~ComboBox() override; - virtual status_t init(); - virtual void destroy(); + ComboBox & operator = (const ComboBox &) = delete; + ComboBox & operator = (ComboBox &&) = delete; + + virtual status_t init() override; + virtual void destroy() override; public: LSP_TK_PROPERTY(Integer, border_size, &sBorderSize) @@ -195,26 +194,19 @@ namespace lsp LSP_TK_PROPERTY(WidgetList, items, sLBox.items()) public: - virtual status_t add(Widget *child); - - virtual status_t remove(Widget *child); - - virtual status_t remove_all(); + virtual status_t add(Widget *child) override; + virtual status_t remove(Widget *child) override; + virtual status_t remove_all() override; + virtual void draw(ws::ISurface *s) override; - virtual void draw(ws::ISurface *s); - - virtual status_t on_mouse_down(const ws::event_t *e); - - virtual status_t on_mouse_up(const ws::event_t *e); - - virtual status_t on_mouse_move(const ws::event_t *e); - - virtual status_t on_mouse_scroll(const ws::event_t *e); - - virtual status_t on_key_down(const ws::event_t *e); + virtual status_t on_mouse_down(const ws::event_t *e) override; + virtual status_t on_mouse_up(const ws::event_t *e) override; + virtual status_t on_mouse_move(const ws::event_t *e) override; + virtual status_t on_mouse_scroll(const ws::event_t *e) override; + virtual status_t on_key_down(const ws::event_t *e) override; + public: virtual status_t on_change(); - virtual status_t on_submit(); }; } /* namespace tk */ diff --git a/include/lsp-plug.in/tk/widgets/compound/ComboGroup.h b/include/lsp-plug.in/tk/widgets/compound/ComboGroup.h index 5b76c4a7..257e29d2 100644 --- a/include/lsp-plug.in/tk/widgets/compound/ComboGroup.h +++ b/include/lsp-plug.in/tk/widgets/compound/ComboGroup.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 14 авг. 2020 г. @@ -62,10 +62,6 @@ namespace lsp */ class ComboGroup: public WidgetContainer { - private: - ComboGroup & operator = (const ComboGroup &); - ComboGroup(const ComboGroup &); - public: static const w_class_t metadata; @@ -92,9 +88,8 @@ namespace lsp public: explicit Window(Display *dpy, ComboGroup *cbox); - virtual status_t on_hide(); - - virtual status_t on_show(); + virtual status_t on_hide() override; + virtual status_t on_show() override; }; class List: public ListBox @@ -109,10 +104,10 @@ namespace lsp explicit List(Display *dpy, ComboGroup *cbox); protected: - virtual void property_changed(Property *prop); + virtual void property_changed(Property *prop) override; public: - virtual status_t on_submit(); + virtual status_t on_submit() override; }; protected: @@ -161,16 +156,21 @@ namespace lsp static status_t slot_on_submit(Widget *sender, void *ptr, void *data); protected: - virtual Widget *find_widget(ssize_t x, ssize_t y); - virtual void property_changed(Property *prop); - virtual void size_request(ws::size_limit_t *r); - virtual void realize(const ws::rectangle_t *r); + virtual Widget *find_widget(ssize_t x, ssize_t y) override; + virtual void property_changed(Property *prop) override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; public: explicit ComboGroup(Display *dpy); - virtual ~ComboGroup(); + ComboGroup(const ComboGroup &) = delete; + ComboGroup(ComboGroup &&) = delete; + virtual ~ComboGroup() override; + + ComboGroup & operator = (const ComboGroup &) = delete; + ComboGroup & operator = (ComboGroup &&) = delete; - virtual status_t init(); + virtual status_t init() override; public: LSP_TK_PROPERTY(Font, font, &sFont) @@ -200,33 +200,25 @@ namespace lsp LSP_TK_PROPERTY(WidgetList, widgets, &vWidgets) public: - virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force); + virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; + virtual status_t add(Widget *child) override; + virtual status_t remove(Widget *child) override; + virtual status_t remove_all() override; - virtual status_t add(Widget *child); - - virtual status_t remove(Widget *child); - - virtual status_t remove_all(); + virtual status_t on_mouse_down(const ws::event_t *e) override; + virtual status_t on_mouse_up(const ws::event_t *e) override; + virtual status_t on_mouse_move(const ws::event_t *e) override; + virtual status_t on_mouse_scroll(const ws::event_t *e) override; + virtual status_t on_key_down(const ws::event_t *e) override; + public: virtual status_t add_item(ListBoxItem *child); - virtual status_t remove_item(ListBoxItem *child); - virtual status_t remove_all_items(); virtual status_t on_change(); - virtual status_t on_submit(); - virtual status_t on_mouse_down(const ws::event_t *e); - - virtual status_t on_mouse_up(const ws::event_t *e); - - virtual status_t on_mouse_move(const ws::event_t *e); - - virtual status_t on_mouse_scroll(const ws::event_t *e); - - virtual status_t on_key_down(const ws::event_t *e); }; } /* namespace tk */ diff --git a/include/lsp-plug.in/tk/widgets/compound/ListBox.h b/include/lsp-plug.in/tk/widgets/compound/ListBox.h index 2bfabbe9..c23fd968 100644 --- a/include/lsp-plug.in/tk/widgets/compound/ListBox.h +++ b/include/lsp-plug.in/tk/widgets/compound/ListBox.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 30 июл. 2020 г. @@ -56,10 +56,6 @@ namespace lsp class ListBox: public WidgetContainer { - private: - ListBox & operator = (const ListBox &); - ListBox(const ListBox &); - public: static const w_class_t metadata; @@ -171,24 +167,28 @@ namespace lsp static status_t slot_on_scroll_change(Widget *sender, void *ptr, void *data); static status_t slot_on_change(Widget *sender, void *ptr, void *data); static status_t slot_on_submit(Widget *sender, void *ptr, void *data); - static status_t slot_on_scroll_key_down(Widget *sender, void *ptr, void *data); - static status_t slot_on_scroll_key_up(Widget *sender, void *ptr, void *data); + static status_t slot_on_scroll_key_event(Widget *sender, void *ptr, void *data); static void on_add_item(void *obj, Property *prop, void *w); static void on_remove_item(void *obj, Property *prop, void *w); static status_t key_scroll_handler(ws::timestamp_t sched, ws::timestamp_t time, void *arg); protected: - virtual void property_changed(Property *prop); - virtual void size_request(ws::size_limit_t *r); - virtual void realize(const ws::rectangle_t *r); + virtual void property_changed(Property *prop) override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; public: explicit ListBox(Display *dpy); - virtual ~ListBox(); + ListBox(const ListBox &) = delete; + ListBox(ListBox &&) = delete; + virtual ~ListBox() override; + + ListBox & operator = (const ListBox &) = delete; + ListBox & operator = (ListBox &&) = delete; - virtual status_t init(); - virtual void destroy(); + virtual status_t init() override; + virtual void destroy() override; public: LSP_TK_PROPERTY(SizeConstraints, constraints, &sSizeConstraints) @@ -218,29 +218,26 @@ namespace lsp LSP_TK_PROPERTY(Integer, vscroll_spacing, &sVScrollSpacing) public: - virtual Widget *find_widget(ssize_t x, ssize_t y); - - virtual status_t add(Widget *child); + virtual Widget *find_widget(ssize_t x, ssize_t y) override; + virtual status_t add(Widget *child) override; + virtual status_t remove(Widget *child) override; + virtual status_t remove_all() override; + virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; - virtual status_t remove(Widget *child); + virtual status_t on_mouse_down(const ws::event_t *e) override; + virtual status_t on_mouse_up(const ws::event_t *e) override; + virtual status_t on_mouse_out(const ws::event_t *e) override; + virtual status_t on_mouse_move(const ws::event_t *e) override; + virtual status_t on_mouse_scroll(const ws::event_t *e) override; - virtual status_t remove_all(); - - virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force); - - virtual void scroll_to_current(); - - virtual status_t on_mouse_down(const ws::event_t *e); - virtual status_t on_mouse_up(const ws::event_t *e); - virtual status_t on_mouse_out(const ws::event_t *e); - virtual status_t on_mouse_move(const ws::event_t *e); - virtual status_t on_mouse_scroll(const ws::event_t *e); - - virtual status_t on_key_down(const ws::event_t *e); - virtual status_t on_key_up(const ws::event_t *e); + virtual status_t on_key_down(const ws::event_t *e) override; + virtual status_t on_key_up(const ws::event_t *e) override; + public: virtual status_t on_change(); virtual status_t on_submit(); + + virtual void scroll_to_current(); }; } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/widgets/compound/Menu.h b/include/lsp-plug.in/tk/widgets/compound/Menu.h index 0b1034d8..c6d4931c 100644 --- a/include/lsp-plug.in/tk/widgets/compound/Menu.h +++ b/include/lsp-plug.in/tk/widgets/compound/Menu.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 18 сент. 2017 г. @@ -59,10 +59,6 @@ namespace lsp class Menu: public WidgetContainer { - private: - Menu & operator = (const Menu &); - Menu(const Menu &); - public: static const w_class_t metadata; @@ -124,14 +120,13 @@ namespace lsp explicit Window(Display *dpy, Menu *menu); protected: - virtual Widget *sync_mouse_handler(const ws::event_t *e, bool lookup); - virtual Widget *acquire_mouse_handler(const ws::event_t *e); - virtual Widget *release_mouse_handler(const ws::event_t *e, bool lookup); + virtual Widget *sync_mouse_handler(const ws::event_t *e, bool lookup) override; + virtual Widget *acquire_mouse_handler(const ws::event_t *e) override; + virtual Widget *release_mouse_handler(const ws::event_t *e, bool lookup) override; public: - virtual status_t handle_event(const ws::event_t *e); - - virtual bool take_focus(); + virtual status_t handle_event(const ws::event_t *e) override; + virtual bool take_focus() override; }; class MenuScroll: public Widget @@ -148,9 +143,9 @@ namespace lsp explicit MenuScroll(Display *dpy, Menu *menu, ssize_t dir); public: - virtual status_t on_mouse_in(const ws::event_t *e); - virtual status_t on_mouse_out(const ws::event_t *e); - virtual status_t on_focus_out(const ws::event_t *e); + virtual status_t on_mouse_in(const ws::event_t *e) override; + virtual status_t on_mouse_out(const ws::event_t *e) override; + virtual status_t on_focus_out(const ws::event_t *e) override; bool active() const; }; @@ -211,36 +206,32 @@ namespace lsp bool check_rtl_direction(); protected: - virtual void property_changed(Property *prop); - - virtual void size_request(ws::size_limit_t *r); - - virtual void realize(const ws::rectangle_t *r); - - virtual void show_widget(); - - virtual void hide_widget(); + virtual void property_changed(Property *prop) override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; + virtual void show_widget() override; + virtual void hide_widget() override; virtual void select_menu_item(MenuItem *item, bool popup); - virtual void select_menu_item(ssize_t index, bool popup); - virtual void select_first_item(bool popup); - virtual void submit_menu_item(MenuItem *item, bool focus); - virtual void sync_scroll(MenuItem *item); - virtual status_t handle_key_scroll(ssize_t dir); - virtual status_t handle_mouse_scroll(ssize_t dir); public: explicit Menu(Display *dpy); - virtual ~Menu(); + Menu(const Menu &) = delete; + Menu(Menu &&) = delete; + virtual ~Menu() override; + + Menu & operator = (const Menu &) = delete; + Menu & operator = (Menu &&) = delete; - virtual status_t init(); - virtual void destroy(); + + virtual status_t init() override; + virtual void destroy() override; public: LSP_TK_PROPERTY(Font, font, &sFont) @@ -272,28 +263,25 @@ namespace lsp bool add_tether(size_t pos, float halign=1.0f, float valign=1.0f); public: - virtual Widget *find_widget(ssize_t x, ssize_t y); + virtual Widget *find_widget(ssize_t x, ssize_t y) override; + virtual status_t add(Widget *child) override; + virtual status_t remove(Widget *child) override; + virtual void show() override; - virtual status_t add(Widget *child); + virtual void draw(ws::ISurface *s) override; + virtual status_t on_key_down(const ws::event_t *e) override; + virtual status_t on_key_up(const ws::event_t *e) override; + public: virtual status_t insert(Widget *child, size_t index); - - virtual status_t remove(Widget *child); - virtual Widget *get(size_t index); - virtual void show(); virtual void show(Widget *w); virtual void showxy(Widget *w); + virtual void showmp(Widget *w); virtual void show(Widget *w, ssize_t x, ssize_t y); virtual void show(Widget *w, ssize_t x, ssize_t y, ssize_t xw, ssize_t xh); virtual void show(Widget *w, const ws::rectangle_t *r); - - virtual void draw(ws::ISurface *s); - - virtual status_t on_key_down(const ws::event_t *e); - - virtual status_t on_key_up(const ws::event_t *e); }; } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/widgets/containers/Align.h b/include/lsp-plug.in/tk/widgets/containers/Align.h index 9c57cc82..38c46896 100644 --- a/include/lsp-plug.in/tk/widgets/containers/Align.h +++ b/include/lsp-plug.in/tk/widgets/containers/Align.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 17 июл. 2017 г. @@ -46,10 +46,6 @@ namespace lsp */ class Align: public WidgetContainer { - private: - Align & operator = (const Align &); - Align(const Align &); - public: static const w_class_t metadata; @@ -62,28 +58,31 @@ namespace lsp void do_destroy(); protected: - virtual Widget *find_widget(ssize_t x, ssize_t y); - virtual void property_changed(Property *prop); - virtual void size_request(ws::size_limit_t *r); - virtual void realize(const ws::rectangle_t *r); + virtual Widget *find_widget(ssize_t x, ssize_t y) override; + virtual void property_changed(Property *prop) override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; public: explicit Align(Display *dpy); - virtual ~Align(); + Align(const Align &) = delete; + Align(Align &&) = delete; + virtual ~Align() override; + + Align & operator = (const Align &) = delete; + Align & operator = (Align &&) = delete; - virtual status_t init(); - virtual void destroy(); + virtual status_t init() override; + virtual void destroy() override; public: LSP_TK_PROPERTY(Layout, layout, &sLayout) LSP_TK_PROPERTY(SizeConstraints, constraints, &sConstraints) public: - virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force); - - virtual status_t add(Widget *widget); - - virtual status_t remove(Widget *widget); + virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; + virtual status_t add(Widget *widget) override; + virtual status_t remove(Widget *widget) override; }; } /* namespace tk */ diff --git a/include/lsp-plug.in/tk/widgets/containers/Box.h b/include/lsp-plug.in/tk/widgets/containers/Box.h index 6df0469e..e0f0e775 100644 --- a/include/lsp-plug.in/tk/widgets/containers/Box.h +++ b/include/lsp-plug.in/tk/widgets/containers/Box.h @@ -50,10 +50,6 @@ namespace lsp */ class Box: public WidgetContainer { - private: - Box & operator = (const Box &); - Box(const Box &); - public: static const w_class_t metadata; @@ -104,16 +100,21 @@ namespace lsp static status_t slot_on_submit(Widget *sender, void *ptr, void *data); protected: - virtual void size_request(ws::size_limit_t *r); - virtual void property_changed(Property *prop); - virtual void realize(const ws::rectangle_t *r); + virtual void size_request(ws::size_limit_t *r) override; + virtual void property_changed(Property *prop) override; + virtual void realize(const ws::rectangle_t *r) override; public: explicit Box(Display *dpy); + Box(const Box &) = delete; + Box(Box &&) = delete; virtual ~Box(); - virtual status_t init(); - virtual void destroy(); + Box & operator = (const Box &) = delete; + Box & operator = (Box &&) = delete; + + virtual status_t init() override; + virtual void destroy() override; //--------------------------------------------------------------------------------- // Properties @@ -168,25 +169,19 @@ namespace lsp //--------------------------------------------------------------------------------- // Manipulation public: - virtual Widget *find_widget(ssize_t x, ssize_t y); - - virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force); - - virtual status_t add(Widget *widget); - - virtual status_t remove(Widget *child); - - virtual status_t remove_all(); - - virtual status_t on_mouse_in(const ws::event_t *e); - - virtual status_t on_mouse_out(const ws::event_t *e); + virtual Widget *find_widget(ssize_t x, ssize_t y) override; - virtual status_t on_mouse_move(const ws::event_t *e); + virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; - virtual status_t on_mouse_down(const ws::event_t *e); + virtual status_t add(Widget *widget) override; + virtual status_t remove(Widget *child) override; + virtual status_t remove_all() override; - virtual status_t on_mouse_up(const ws::event_t *e); + virtual status_t on_mouse_in(const ws::event_t *e) override; + virtual status_t on_mouse_out(const ws::event_t *e) override; + virtual status_t on_mouse_move(const ws::event_t *e) override; + virtual status_t on_mouse_down(const ws::event_t *e) override; + virtual status_t on_mouse_up(const ws::event_t *e) override; virtual status_t on_submit(); diff --git a/include/lsp-plug.in/tk/widgets/containers/Grid.h b/include/lsp-plug.in/tk/widgets/containers/Grid.h index c07836c5..05cc114d 100644 --- a/include/lsp-plug.in/tk/widgets/containers/Grid.h +++ b/include/lsp-plug.in/tk/widgets/containers/Grid.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 20 июн. 2017 г. @@ -48,10 +48,6 @@ namespace lsp */ class Grid: public WidgetContainer { - private: - Grid & operator = (const Grid &); - Grid(const Grid &); - public: static const w_class_t metadata; @@ -144,8 +140,13 @@ namespace lsp public: explicit Grid(Display *dpy); + Grid(const Grid &) = delete; + Grid(Grid &&) = delete; virtual ~Grid() override; + Grid & operator = (const Grid &) = delete; + Grid & operator = (Grid &&) = delete; + virtual status_t init() override; virtual void destroy() override; diff --git a/include/lsp-plug.in/tk/widgets/containers/Group.h b/include/lsp-plug.in/tk/widgets/containers/Group.h index 6447c5bf..a2e0124b 100644 --- a/include/lsp-plug.in/tk/widgets/containers/Group.h +++ b/include/lsp-plug.in/tk/widgets/containers/Group.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 26 июн. 2020 г. @@ -60,10 +60,6 @@ namespace lsp */ class Group: public Align { - private: - Group & operator = (const Group &); - Group(const Group &); - public: static const w_class_t metadata; @@ -101,18 +97,23 @@ namespace lsp void allocate(alloc_t *alloc); protected: - virtual void property_changed(Property *prop); - virtual void size_request(ws::size_limit_t *r); - virtual void realize(const ws::rectangle_t *r); + virtual void property_changed(Property *prop) override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; - virtual void get_child_bg_color(lsp::Color *color) const; - virtual void get_child_bg_color(lsp::Color &color) const; + virtual void get_child_bg_color(lsp::Color *color) const override; + virtual void get_child_bg_color(lsp::Color &color) const override; public: explicit Group(Display *dpy); - virtual ~Group(); + Group(const Group &) = delete; + Group(Group &&) = delete; + virtual ~Group() override; + + Group & operator = (const Group &) = delete; + Group & operator = (Group &&) = delete; - virtual status_t init(); + virtual status_t init() override; public: LSP_TK_PROPERTY(Font, font, &sFont) @@ -133,7 +134,7 @@ namespace lsp LSP_TK_PROPERTY(Float, ibg_brightness, &sIBGBrightness) public: - virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force); + virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; }; } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/widgets/containers/MultiLabel.h b/include/lsp-plug.in/tk/widgets/containers/MultiLabel.h index 60b4668a..530b0137 100644 --- a/include/lsp-plug.in/tk/widgets/containers/MultiLabel.h +++ b/include/lsp-plug.in/tk/widgets/containers/MultiLabel.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2021 Linux Studio Plugins Project - * (C) 2021 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 16 июн. 2021 г. @@ -47,10 +47,6 @@ namespace lsp */ class MultiLabel: public WidgetContainer { - private: - MultiLabel & operator = (const MultiLabel &); - MultiLabel(const MultiLabel &); - public: static const w_class_t metadata; @@ -78,9 +74,9 @@ namespace lsp void do_destroy(); protected: - virtual void property_changed(Property *prop); - virtual void size_request(ws::size_limit_t *r); - virtual void realize(const ws::rectangle_t *r); + virtual void property_changed(Property *prop) override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; protected: static status_t slot_on_submit(Widget *sender, void *ptr, void *data); @@ -93,10 +89,15 @@ namespace lsp public: explicit MultiLabel(Display *dpy); - virtual ~MultiLabel(); + MultiLabel(const MultiLabel &) = delete; + MultiLabel(MultiLabel &&) = delete; + virtual ~MultiLabel() override; + + MultiLabel & operator = (const MultiLabel &) = delete; + MultiLabel & operator = (MultiLabel &&) = delete; - virtual status_t init(); - virtual void destroy(); + virtual status_t init() override; + virtual void destroy() override; public: LSP_TK_PROPERTY(SizeConstraints, constraints, &sConstraints) @@ -106,24 +107,19 @@ namespace lsp LSP_TK_PROPERTY(WidgetPtr, popup, &sPopup) public: - virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force); - - virtual status_t add(Widget *widget); - - virtual status_t remove(Widget *widget); - - virtual status_t on_mouse_in(const ws::event_t *e); + virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; - virtual status_t on_mouse_out(const ws::event_t *e); + virtual status_t add(Widget *widget) override; + virtual status_t remove(Widget *widget) override; - virtual status_t on_mouse_move(const ws::event_t *e); - - virtual status_t on_mouse_down(const ws::event_t *e); - - virtual status_t on_mouse_up(const ws::event_t *e); + virtual status_t on_mouse_in(const ws::event_t *e) override; + virtual status_t on_mouse_out(const ws::event_t *e) override; + virtual status_t on_mouse_move(const ws::event_t *e) override; + virtual status_t on_mouse_down(const ws::event_t *e) override; + virtual status_t on_mouse_up(const ws::event_t *e) override; + public: virtual status_t on_before_popup(Menu *menu); - virtual status_t on_popup(Menu *menu); virtual status_t on_submit(); diff --git a/include/lsp-plug.in/tk/widgets/containers/PopupWindow.h b/include/lsp-plug.in/tk/widgets/containers/PopupWindow.h index 1293fc1d..6ef69c25 100644 --- a/include/lsp-plug.in/tk/widgets/containers/PopupWindow.h +++ b/include/lsp-plug.in/tk/widgets/containers/PopupWindow.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 16 июн. 2020 г. @@ -46,10 +46,6 @@ namespace lsp */ class PopupWindow: public Window { - private: - PopupWindow & operator = (const PopupWindow &); - PopupWindow(const PopupWindow &); - public: static const w_class_t metadata; @@ -63,19 +59,26 @@ namespace lsp bool bInitialized; // Initalization flag protected: - virtual void hide_widget(); - virtual void show_widget(); + virtual void hide_widget() override; + virtual void show_widget() override; + virtual status_t sync_size() override; + virtual void size_request(ws::size_limit_t *r) override; + virtual status_t post_init(); - virtual status_t sync_size(); - virtual void size_request(ws::size_limit_t *r); + bool init_window(); void arrange_window_geometry(); public: explicit PopupWindow(Display *dpy); - virtual ~PopupWindow(); + PopupWindow(const PopupWindow &) = delete; + PopupWindow(PopupWindow &&) = delete; + virtual ~PopupWindow() override; - virtual status_t init(); + PopupWindow & operator = (const PopupWindow &) = delete; + PopupWindow & operator = (PopupWindow &&) = delete; + + virtual status_t init() override; public: LSP_TK_PROPERTY(Rectangle, trigger_area, &sTrgArea) @@ -90,10 +93,11 @@ namespace lsp bool add_tether(size_t flags, float halign=1.0f, float valign=1.0f); public: - virtual status_t handle_event(const ws::event_t *e); + virtual status_t handle_event(const ws::event_t *e) override; }; - } -} + + } /* namespace tk */ +} /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/widgets/containers/ScrollArea.h b/include/lsp-plug.in/tk/widgets/containers/ScrollArea.h index 19bd82a6..1569adaf 100644 --- a/include/lsp-plug.in/tk/widgets/containers/ScrollArea.h +++ b/include/lsp-plug.in/tk/widgets/containers/ScrollArea.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 17 июл. 2020 г. @@ -49,10 +49,6 @@ namespace lsp */ class ScrollArea: public WidgetContainer { - private: - ScrollArea & operator = (const ScrollArea &); - ScrollArea(const ScrollArea &); - public: static const w_class_t metadata; @@ -90,16 +86,21 @@ namespace lsp static status_t slot_on_scroll_change(Widget *sender, void *ptr, void *data); protected: - virtual void property_changed(Property *prop); - virtual void size_request(ws::size_limit_t *r); - virtual void realize(const ws::rectangle_t *r); + virtual void property_changed(Property *prop) override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; public: explicit ScrollArea(Display *dpy); - virtual ~ScrollArea(); + ScrollArea(const ScrollArea &) = delete; + ScrollArea(ScrollArea &&) = delete; + virtual ~ScrollArea() override; + + ScrollArea & operator = (const ScrollArea &) = delete; + ScrollArea & operator = (ScrollArea &&) = delete; - virtual status_t init(); - virtual void destroy(); + virtual status_t init() override; + virtual void destroy() override; public: inline void get_area(ws::rectangle_t *area) { *area = sArea; } @@ -118,15 +119,14 @@ namespace lsp LSP_TK_PROPERTY(StepFloat, vaccel_step, sVBar.accel_step()) public: - virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force); - - virtual status_t add(Widget *widget); + virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; - virtual status_t remove(Widget *widget); + virtual status_t add(Widget *widget) override; + virtual status_t remove(Widget *widget) override; - virtual Widget *find_widget(ssize_t x, ssize_t y); + virtual Widget *find_widget(ssize_t x, ssize_t y) override; - virtual status_t on_mouse_scroll(const ws::event_t *e); + virtual status_t on_mouse_scroll(const ws::event_t *e) override; }; } /* namespace tk */ } /* namespace lsp */ diff --git a/include/lsp-plug.in/tk/widgets/containers/Tab.h b/include/lsp-plug.in/tk/widgets/containers/Tab.h index 10b43f9e..2d6ca2ef 100644 --- a/include/lsp-plug.in/tk/widgets/containers/Tab.h +++ b/include/lsp-plug.in/tk/widgets/containers/Tab.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2022 Linux Studio Plugins Project - * (C) 2022 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 9 нояб. 2022 г. @@ -59,10 +59,6 @@ namespace lsp public: static const w_class_t metadata; - private: - Tab & operator = (const Tab &); - Tab(const Tab &); - protected: Widget *pWidget; @@ -94,7 +90,12 @@ namespace lsp public: explicit Tab(Display *dpy); - virtual ~Tab(); + Tab(const Tab &) = delete; + Tab(Tab &&) = delete; + virtual ~Tab() override; + + Tab & operator = (const Tab &) = delete; + Tab & operator = (Tab &&) = delete; virtual status_t init() override; virtual void destroy() override; @@ -124,7 +125,6 @@ namespace lsp virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; virtual status_t add(Widget *widget) override; - virtual status_t remove(Widget *widget) override; }; diff --git a/include/lsp-plug.in/tk/widgets/containers/TabControl.h b/include/lsp-plug.in/tk/widgets/containers/TabControl.h index 3a7b5d45..0389f257 100644 --- a/include/lsp-plug.in/tk/widgets/containers/TabControl.h +++ b/include/lsp-plug.in/tk/widgets/containers/TabControl.h @@ -60,10 +60,6 @@ namespace lsp */ class TabControl: public WidgetContainer { - private: - TabControl & operator = (const TabControl &); - TabControl(const TabControl &); - public: static const w_class_t metadata; @@ -138,8 +134,13 @@ namespace lsp public: explicit TabControl(Display *dpy); + TabControl(const TabControl &) = delete; + TabControl(TabControl &&) = delete; virtual ~TabControl() override; + TabControl & operator = (const TabControl &) = delete; + TabControl & operator = (TabControl &&) = delete; + virtual status_t init() override; virtual void destroy() override; @@ -169,26 +170,18 @@ namespace lsp virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; virtual status_t add(Widget *child) override; - virtual status_t remove(Widget *child) override; - virtual status_t remove_all() override; virtual status_t on_mouse_down(const ws::event_t *e) override; - virtual status_t on_mouse_up(const ws::event_t *e) override; - virtual status_t on_mouse_move(const ws::event_t *e) override; - virtual status_t on_mouse_scroll(const ws::event_t *e) override; - virtual status_t on_mouse_out(const ws::event_t *e) override; - virtual status_t on_key_down(const ws::event_t *e) override; public: virtual status_t on_change(); - virtual status_t on_submit(); }; diff --git a/include/lsp-plug.in/tk/widgets/containers/Window.h b/include/lsp-plug.in/tk/widgets/containers/Window.h index 82fb5bab..207c9214 100644 --- a/include/lsp-plug.in/tk/widgets/containers/Window.h +++ b/include/lsp-plug.in/tk/widgets/containers/Window.h @@ -53,10 +53,6 @@ namespace lsp class Window: public WidgetContainer { - private: - Window & operator = (const Window &); - Window(const Window &); - protected: friend class Display; friend class Widget; @@ -131,12 +127,12 @@ namespace lsp status_t init_internal(bool create_handle); protected: - virtual Widget *find_widget(ssize_t x, ssize_t y); - virtual void property_changed(Property *prop); - virtual void hide_widget(); - virtual void show_widget(); - virtual void size_request(ws::size_limit_t *r); - virtual void realize(const ws::rectangle_t *r); + virtual Widget *find_widget(ssize_t x, ssize_t y) override; + virtual void property_changed(Property *prop) override; + virtual void hide_widget() override; + virtual void show_widget() override; + virtual void size_request(ws::size_limit_t *r) override; + virtual void realize(const ws::rectangle_t *r) override; /** * Discard widget: notify window that widget has been removed from the widget tree @@ -148,11 +144,16 @@ namespace lsp // Construction and destruction public: explicit Window(Display *dpy, void *handle = NULL, ssize_t screen = -1); + Window(const Window &) = delete; + Window(Window &&) = delete; virtual ~Window(); - virtual status_t init(); + Window & operator = (const Window &) = delete; + Window & operator = (Window &&) = delete; + + virtual status_t init() override; - virtual void destroy(); + virtual void destroy() override; //--------------------------------------------------------------------------------- // Properties @@ -176,10 +177,10 @@ namespace lsp inline ssize_t screen() { return (pWindow != NULL) ? pWindow->screen() : -1; }; - virtual status_t get_screen_rectangle(ws::rectangle_t *r, const ws::rectangle_t *sr); - virtual status_t get_screen_rectangle(ws::rectangle_t *r); - virtual status_t get_padded_screen_rectangle(ws::rectangle_t *r, const ws::rectangle_t *sr); - virtual status_t get_padded_screen_rectangle(ws::rectangle_t *r); + virtual status_t get_screen_rectangle(ws::rectangle_t *r, const ws::rectangle_t *sr) override; + virtual status_t get_screen_rectangle(ws::rectangle_t *r) override; + virtual status_t get_padded_screen_rectangle(ws::rectangle_t *r, const ws::rectangle_t *sr) override; + virtual status_t get_padded_screen_rectangle(ws::rectangle_t *r) override; /** * Resize the underlying window to the specified geometry @@ -208,14 +209,14 @@ namespace lsp //--------------------------------------------------------------------------------- // Manipulation public: - virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force); + virtual void render(ws::ISurface *s, const ws::rectangle_t *area, bool force) override; virtual status_t override_pointer(bool override = true); /** Show window * */ - virtual void show(); + virtual void show() override; /** Show window over window of actor * @@ -225,15 +226,13 @@ namespace lsp virtual void show(tk::Widget *actor); virtual void show(ws::IWindow *actor); - virtual status_t add(Widget *widget); - - virtual status_t remove(Widget *widget); - - virtual status_t remove_all(); + virtual status_t add(Widget *widget) override; + virtual status_t remove(Widget *widget) override; + virtual status_t remove_all() override; - virtual status_t handle_event(const ws::event_t *e); + virtual status_t handle_event(const ws::event_t *e) override; - virtual bool take_focus(); + virtual bool take_focus() override; virtual bool has_parent() const; diff --git a/include/lsp-plug.in/tk/widgets/dialogs/FileDialog.h b/include/lsp-plug.in/tk/widgets/dialogs/FileDialog.h index 85c297b5..401b162b 100644 --- a/include/lsp-plug.in/tk/widgets/dialogs/FileDialog.h +++ b/include/lsp-plug.in/tk/widgets/dialogs/FileDialog.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 23 окт. 2020 г. @@ -57,10 +57,6 @@ namespace lsp public: static const w_class_t metadata; - private: - FileDialog & operator = (const FileDialog &); - FileDialog(const FileDialog &); - protected: enum { @@ -85,7 +81,10 @@ namespace lsp io::Path sPath; bookmarks::bookmark_t sBookmark; - inline bm_entry_t(Display *dpy): sHlink(dpy) {} + inline bm_entry_t(Display *dpy): sHlink(dpy) + { + sBookmark.origin = 0; + } } bm_entry_t; protected: @@ -246,14 +245,19 @@ namespace lsp status_t apply_filters(); protected: - virtual void property_changed(Property *prop); + virtual void property_changed(Property *prop) override; public: explicit FileDialog(Display *dpy); - virtual ~FileDialog(); + FileDialog(const FileDialog &) = delete; + FileDialog(FileDialog &&) = delete; + virtual ~FileDialog() override; + + FileDialog & operator = (const FileDialog &) = delete; + FileDialog & operator = (FileDialog &&) = delete; - virtual status_t init(); - virtual void destroy(); + virtual status_t init() override; + virtual void destroy() override; public: LSP_TK_PROPERTY(FileDialogMode, mode, &sMode); @@ -278,18 +282,16 @@ namespace lsp LSP_TK_PROPERTY(Color, bookmark_selected_text_color, &sBMSelTextColor); public: - virtual status_t on_show(); - - virtual status_t on_close(const ws::event_t *e); + virtual status_t on_show() override; + virtual status_t on_close(const ws::event_t *e) override; + public: virtual status_t on_submit(); - virtual status_t on_cancel(); - virtual status_t on_change(); }; - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/modules.mk b/modules.mk index 06cc4630..dec1a2bc 100644 --- a/modules.mk +++ b/modules.mk @@ -19,7 +19,7 @@ # # Variables that describe dependencies -LSP_COMMON_LIB_VERSION := 1.0.30 +LSP_COMMON_LIB_VERSION := 1.0.31 LSP_COMMON_LIB_NAME := lsp-common-lib LSP_COMMON_LIB_TYPE := src LSP_COMMON_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_COMMON_LIB_NAME).git @@ -31,49 +31,49 @@ LSP_TEST_FW_TYPE := src LSP_TEST_FW_URL_RO := https://github.com/lsp-plugins/$(LSP_TEST_FW_NAME).git LSP_TEST_FW_URL_RW := git@github.com:lsp-plugins/$(LSP_TEST_FW_NAME).git -LSP_LLTL_LIB_VERSION := 1.0.13 +LSP_LLTL_LIB_VERSION := 1.0.14 LSP_LLTL_LIB_NAME := lsp-lltl-lib LSP_LLTL_LIB_TYPE := src LSP_LLTL_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_LLTL_LIB_NAME).git LSP_LLTL_LIB_URL_RW := git@github.com:lsp-plugins/$(LSP_LLTL_LIB_NAME).git -LSP_RUNTIME_LIB_VERSION := 1.0.16 +LSP_RUNTIME_LIB_VERSION := 1.0.17 LSP_RUNTIME_LIB_NAME := lsp-runtime-lib LSP_RUNTIME_LIB_TYPE := src LSP_RUNTIME_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_RUNTIME_LIB_NAME).git LSP_RUNTIME_LIB_URL_RW := git@github.com:lsp-plugins/$(LSP_RUNTIME_LIB_NAME).git -LSP_R3D_IFACE_VERSION := 1.0.13 +LSP_R3D_IFACE_VERSION := 1.0.14 LSP_R3D_IFACE_NAME := lsp-r3d-iface LSP_R3D_IFACE_TYPE := src LSP_R3D_IFACE_URL_RO := https://github.com/lsp-plugins/$(LSP_R3D_IFACE_NAME).git LSP_R3D_IFACE_URL_RW := git@github.com:lsp-plugins/$(LSP_R3D_IFACE_NAME).git -LSP_R3D_BASE_LIB_VERSION := 1.0.13 +LSP_R3D_BASE_LIB_VERSION := 1.0.14 LSP_R3D_BASE_LIB_NAME := lsp-r3d-base-lib LSP_R3D_BASE_LIB_TYPE := src LSP_R3D_BASE_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_R3D_BASE_LIB_NAME).git LSP_R3D_BASE_LIB_URL_RW := git@github.com:lsp-plugins/$(LSP_R3D_BASE_LIB_NAME).git -LSP_R3D_GLX_LIB_VERSION := 1.0.13 +LSP_R3D_GLX_LIB_VERSION := 1.0.14 LSP_R3D_GLX_LIB_NAME := lsp-r3d-glx-lib LSP_R3D_GLX_LIB_TYPE := src LSP_R3D_GLX_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_R3D_GLX_LIB_NAME).git LSP_R3D_GLX_LIB_URL_RW := git@github.com:lsp-plugins/$(LSP_R3D_GLX_LIB_NAME).git -LSP_R3D_WGL_LIB_VERSION := 1.0.8 +LSP_R3D_WGL_LIB_VERSION := 1.0.9 LSP_R3D_WGL_LIB_NAME := lsp-r3d-wgl-lib LSP_R3D_WGL_LIB_TYPE := src LSP_R3D_WGL_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_R3D_WGL_LIB_NAME).git LSP_R3D_WGL_LIB_URL_RW := git@github.com:lsp-plugins/$(LSP_R3D_WGL_LIB_NAME).git -LSP_WS_LIB_VERSION := 1.0.13 +LSP_WS_LIB_VERSION := 1.0.14 LSP_WS_LIB_NAME := lsp-ws-lib LSP_WS_LIB_TYPE := src LSP_WS_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_WS_LIB_NAME).git LSP_WS_LIB_URL_RW := git@github.com:lsp-plugins/$(LSP_WS_LIB_NAME).git -LSP_DSP_LIB_VERSION := 1.0.14 +LSP_DSP_LIB_VERSION := 1.0.15 LSP_DSP_LIB_NAME := lsp-dsp-lib LSP_DSP_LIB_TYPE := src LSP_DSP_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_DSP_LIB_NAME).git diff --git a/project.mk b/project.mk index 861097dd..867583fd 100644 --- a/project.mk +++ b/project.mk @@ -23,5 +23,5 @@ ARTIFACT_ID = LSP_TK_LIB ARTIFACT_NAME = lsp-tk-lib ARTIFACT_DESC = Graphical toolkit library for Linux Studio Plugins Project ARTIFACT_HEADERS = lsp-plug.in -ARTIFACT_VERSION = 1.0.13 +ARTIFACT_VERSION = 1.0.14 ARTIFACT_EXPORT_ALL = 1 diff --git a/src/main/helpers/mime.cpp b/src/main/helpers/mime.cpp index ecf363f1..e612107a 100644 --- a/src/main/helpers/mime.cpp +++ b/src/main/helpers/mime.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 27 авг. 2019 г. @@ -162,8 +162,7 @@ namespace lsp status_t fetch_text_x_moz_url_item(LSPString *dst, const char *protocol, io::IInSequence *is) { LSPString line; - size_t index = 0; - while (true) + for (size_t index=0; ; ++index) { status_t res = is->read_line(&line, true); if (res == STATUS_EOF) @@ -294,7 +293,7 @@ namespace lsp line.swap(dst); return STATUS_OK; } - } -} + } /* namespace lsp */ +} /* namespace tk */ diff --git a/src/main/prop/base/Property.cpp b/src/main/prop/base/Property.cpp index 115f3185..7f7f11dc 100644 --- a/src/main/prop/base/Property.cpp +++ b/src/main/prop/base/Property.cpp @@ -344,7 +344,6 @@ namespace lsp size_t Property::parse_unique_enums(lltl::darray *dst, const LSPString *s, const prop::enum_t *xenum) { // Parse values - size_t n = 0; bool semicolon = false; io::InStringSequence is(s); expr::Tokenizer tok(&is); @@ -368,12 +367,14 @@ namespace lsp return 0; // Add unique value - for (size_t i=0; isize(); iuget(i)) == xe->value) { xe = NULL; break; } + } if (xe) { if (!dst->add(&xe->value)) diff --git a/src/main/prop/collection/ColorRanges.cpp b/src/main/prop/collection/ColorRanges.cpp index 71889bb6..d1aaac33 100644 --- a/src/main/prop/collection/ColorRanges.cpp +++ b/src/main/prop/collection/ColorRanges.cpp @@ -301,7 +301,7 @@ namespace lsp return STATUS_NOT_FOUND; ColorRange *si2 = vItems.get(i2); - if (si1 == NULL) + if (si2 == NULL) return STATUS_NOT_FOUND; // Prevent from multiple sync() @@ -341,5 +341,5 @@ namespace lsp return res; } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/prop/collection/StringList.cpp b/src/main/prop/collection/StringList.cpp index 2d5a9a6c..81b40fee 100644 --- a/src/main/prop/collection/StringList.cpp +++ b/src/main/prop/collection/StringList.cpp @@ -266,7 +266,7 @@ namespace lsp return STATUS_NOT_FOUND; StringItem *si2 = vItems.get(i2); - if (si1 == NULL) + if (si2 == NULL) return STATUS_NOT_FOUND; // Prevent from multiple sync() @@ -279,7 +279,7 @@ namespace lsp return STATUS_OK; } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/prop/flags/Allocation.cpp b/src/main/prop/flags/Allocation.cpp index b4d0c171..275ca4d1 100644 --- a/src/main/prop/flags/Allocation.cpp +++ b/src/main/prop/flags/Allocation.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 16 мая 2020 г. @@ -35,6 +35,13 @@ namespace lsp ".vreduce", NULL }; + + Allocation::Allocation(prop::Listener *listener): + Flags(FLAGS, vAtoms, listener) + { + for (size_t i=0; i - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 21 сент. 2020 г. @@ -194,11 +194,11 @@ namespace lsp float ColorRange::set_max(float v) { - float old = fMin; + float old = fMax; if (v == old) return old; - fMin = v; + fMax = v; sync(); return old; } @@ -541,6 +541,6 @@ namespace lsp sync(); src->sync(); } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/prop/multi/Font.cpp b/src/main/prop/multi/Font.cpp index 203093db..e0b110b6 100644 --- a/src/main/prop/multi/Font.cpp +++ b/src/main/prop/multi/Font.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 27 мая 2020 г. @@ -61,6 +61,9 @@ namespace lsp MultiProperty(vAtoms, P_COUNT, listener) { nOverride = 0; + sFP.Ascent = 0.0f; + sFP.Descent = 0.0f; + sFP.Height = 0.0f; } Font::~Font() @@ -346,7 +349,7 @@ namespace lsp ws::Font f(&sValue); f.set_size(sValue.size() * lsp_max(0.0f, scaling)); - ssize_t prev = 0, curr = 0, tail = 0; + ssize_t prev = 0, curr = first, tail = 0; ws::font_parameters_t fp; ws::text_parameters_t xp, rp; @@ -412,7 +415,7 @@ namespace lsp ws::Font f(&sValue); f.set_size(sValue.size() * lsp_max(0.0f, scaling)); - ssize_t prev = 0, curr = 0, tail = 0; + ssize_t prev = 0, curr = first, tail = 0; ws::font_parameters_t fp; ws::text_parameters_t xp, rp; @@ -570,7 +573,7 @@ namespace lsp f.set_size(sValue.size() * lsp_max(0.0f, scaling)); // Update the font size s->out_text(f, c, x, y, text, first, last); } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/prop/multi/Point2D.cpp b/src/main/prop/multi/Point2D.cpp index 8cfaf737..4ded6b60 100644 --- a/src/main/prop/multi/Point2D.cpp +++ b/src/main/prop/multi/Point2D.cpp @@ -92,9 +92,7 @@ namespace lsp brace = expr::TT_RCBRACE; else if (t == expr::TT_LBRACE) // Decart form, second option brace = expr::TT_RBRACE; - else if ((t == expr::TT_IVALUE) || (t == expr::TT_FVALUE)) // Number, consider to be decart form - brace = -1; - else + else if ((t != expr::TT_IVALUE) && (t != expr::TT_FVALUE)) // Number, consider to be decart form return false; // Get next token if required @@ -113,7 +111,7 @@ namespace lsp t = tok.get_token(expr::TF_GET); // Semicolon/comma required? - if (brace) + if (brace >= 0) { if ((t != expr::TT_COMMA) && (t != expr::TT_SEMICOLON)) return false; diff --git a/src/main/prop/multi/SizeRange.cpp b/src/main/prop/multi/SizeRange.cpp index 4ccae56a..b5694c97 100644 --- a/src/main/prop/multi/SizeRange.cpp +++ b/src/main/prop/multi/SizeRange.cpp @@ -156,7 +156,7 @@ namespace lsp r->nMaxWidth = r->nMinWidth; r->nMinHeight = r->nMinWidth; - r->nMinHeight = r->nMinWidth; + r->nMaxHeight = r->nMaxWidth; } } /* namespace tk */ diff --git a/src/main/prop/multi/Vector2D.cpp b/src/main/prop/multi/Vector2D.cpp index 2fa31f32..338cb907 100644 --- a/src/main/prop/multi/Vector2D.cpp +++ b/src/main/prop/multi/Vector2D.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 25 авг. 2020 г. @@ -167,9 +167,7 @@ namespace lsp brace = expr::TT_RCBRACE; else if (t == expr::TT_LQBRACE) // Polar form, degrees brace = expr::TT_RQBRACE; - else if ((t == expr::TT_IVALUE) || (t == expr::TT_FVALUE)) // Number, consider to be decart form - brace = -1; - else + else if ((t != expr::TT_IVALUE) && (t != expr::TT_FVALUE)) // Number, consider to be decart form return false; // Get next token if required @@ -188,7 +186,7 @@ namespace lsp t = tok.get_token(expr::TF_GET); // Semicolon/comma required? - if (brace) + if (brace >= 0) { if ((t != expr::TT_COMMA) && (t != expr::TT_SEMICOLON)) return false; diff --git a/src/main/prop/simple/Integer.cpp b/src/main/prop/simple/Integer.cpp index 28e28f61..338015f4 100644 --- a/src/main/prop/simple/Integer.cpp +++ b/src/main/prop/simple/Integer.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 6 мая 2020 г. @@ -26,8 +26,7 @@ namespace lsp namespace tk { Integer::Integer(prop::Listener *listener): - SimpleProperty(listener), - sListener(this) + SimpleProperty(listener) { nAtom = -1; nValue = 0.0f; @@ -35,7 +34,7 @@ namespace lsp Integer::~Integer() { - unbind(&sListener); + SimpleProperty::unbind(&sListener); } void Integer::commit(atom_t property) @@ -72,9 +71,9 @@ namespace lsp ssize_t Integer::commit_value(ssize_t value) { ssize_t old = nValue; - value = nValue; + nValue = value; return old; } - } + } /* namespace prop */ } /* namespace tk */ } /* namespace lsp */ diff --git a/src/main/prop/simple/String.cpp b/src/main/prop/simple/String.cpp index b6819a53..fdef1535 100644 --- a/src/main/prop/simple/String.cpp +++ b/src/main/prop/simple/String.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 2 мар. 2020 г. @@ -359,7 +359,7 @@ namespace lsp } // Check that value has been cached - const char *xlang; + const char *xlang = NULL; if (pStyle != NULL) pStyle->get_string(nAtom, &xlang); @@ -514,7 +514,7 @@ namespace lsp sync(); return true; } - } + } /* namespace prop */ } /* namespace tk */ } /* namespace lsp */ diff --git a/src/main/prop/specific/GraphFrameData.cpp b/src/main/prop/specific/GraphFrameData.cpp index c7fb9411..098b4d6e 100644 --- a/src/main/prop/specific/GraphFrameData.cpp +++ b/src/main/prop/specific/GraphFrameData.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 2 сент. 2020 г. @@ -83,7 +83,6 @@ namespace lsp pPtr = NULL; } - void GraphFrameData::commit(atom_t property) { if ((pStyle == NULL) || (property < 0)) @@ -381,7 +380,7 @@ namespace lsp { nChanges = 0; } - } -} + } /*namespace tk */ +} /* namespace lsp */ diff --git a/src/main/prop/specific/GraphMeshData.cpp b/src/main/prop/specific/GraphMeshData.cpp index 3b754336..993ce70f 100644 --- a/src/main/prop/specific/GraphMeshData.cpp +++ b/src/main/prop/specific/GraphMeshData.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 1 сент. 2020 г. @@ -263,6 +263,6 @@ namespace lsp return true; } - } -} + } /*namespace tk */ +} /* namespace lsp */ diff --git a/src/main/style/Style.cpp b/src/main/style/Style.cpp index 3104285a..9cd69593 100644 --- a/src/main/style/Style.cpp +++ b/src/main/style/Style.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 1 окт. 2019 г. @@ -1055,7 +1055,8 @@ namespace lsp const property_t *prop = get_property_recursive(id); if (prop == NULL) { - *dst = 0; + if (dst != NULL) + *dst = 0; return STATUS_OK; } else if (prop->type != PT_INT) @@ -1082,7 +1083,8 @@ namespace lsp const property_t *prop = get_property_recursive(id); if (prop == NULL) { - *dst = 0.0f; + if (dst != NULL) + *dst = 0.0f; return STATUS_OK; } else if (prop->type != PT_FLOAT) @@ -1109,7 +1111,8 @@ namespace lsp const property_t *prop = get_property_recursive(id); if (prop == NULL) { - *dst = false; + if (dst != NULL) + *dst = false; return STATUS_OK; } else if (prop->type != PT_BOOL) diff --git a/src/main/style/StyleSheet.cpp b/src/main/style/StyleSheet.cpp index c26f52cd..5ef93e3b 100644 --- a/src/main/style/StyleSheet.cpp +++ b/src/main/style/StyleSheet.cpp @@ -398,11 +398,15 @@ namespace lsp // Create color object lsp::Color *c = new lsp::Color(); + if (c == NULL) + return STATUS_NO_MEM; + LSPString color_name; if (!color_name.set(p->name())) + { + delete c; return STATUS_NO_MEM; - if (c == NULL) - return STATUS_NO_MEM; + } // Try to parse color if ((res = parse_color(p, &color_name, c)) == STATUS_OK) @@ -572,7 +576,10 @@ namespace lsp while (true) { if ((item = p->read_next()) < 0) + { + delete style; return -item; + } switch (item) { @@ -596,14 +603,20 @@ namespace lsp if (p->name()->equals_ascii("class")) { if ((root) || (bClass)) + { res = STATUS_BAD_FORMAT; + break; + } bClass = true; res = parse_style_class(&sClass, p->value()); } else if (p->name()->equals_ascii("parents")) { if ((root) || (bParents)) + { res = STATUS_BAD_FORMAT; + break; + } bParents = true; res = parse_style_parents(style, p->value()); } @@ -782,7 +795,7 @@ namespace lsp status_t StyleSheet::parse_font(xml::PullParser *p, font_t *font) { - status_t item, res = STATUS_OK; + status_t item; enum { LC_FLAG_SRC = 1 << 0, LC_FLAG_ALIAS = 1 << 1 @@ -845,9 +858,6 @@ namespace lsp sError.set_ascii("parse_font: Unsupported XML element"); return STATUS_CORRUPTED; } - - if (res != STATUS_OK) - return res; } } @@ -1387,23 +1397,16 @@ namespace lsp { // Obtain the parent style LSPString *name = s->parents.uget(i++); - style_t *ps = name->equals_ascii("root") ? pRoot : vStyles.get(name); + style_t *ps = ((name == NULL) || (name->equals_ascii("root"))) ? pRoot : vStyles.get(name); // lsp_trace(" testing: %p (%s), i=%d, n=%d", ps, (ps != NULL) ? ps->name.get_utf8() : "???", int(i), int(n)); - if (ps == NULL) + if ((ps == NULL) || (p->visited.contains(ps))) { sError.fmt_utf8("Unexisting style found in tree: '%s'", (name != NULL) ? name->get_utf8() : "root"); delete p; drop_paths(&stack); return STATUS_BAD_HIERARCHY; } - else if (p->visited.contains(ps)) - { - sError.fmt_utf8("Found inheritance loop at style '%s'", (name != NULL) ? name->get_utf8() : "root"); - delete p; - drop_paths(&stack); - return STATUS_BAD_HIERARCHY; - } // Check next step path_t *np = p; diff --git a/src/main/util/KeyboardHandler.cpp b/src/main/util/KeyboardHandler.cpp index 66a4b29d..13a1af15 100644 --- a/src/main/util/KeyboardHandler.cpp +++ b/src/main/util/KeyboardHandler.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 11 сент. 2017 г. @@ -31,6 +31,10 @@ namespace lsp nPause = 1000; nRepeat = 250; nRepeatSize = 0; + + ws::init_event(&sLast); + for (size_t i=0; i - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 10 июн. 2020 г. @@ -62,7 +62,7 @@ namespace lsp for (const char *const *p = mimes; (*p != NULL) && (found < 0); ++p, ++self_idx) { ssize_t src_idx = 0; - for (const char *const *v = mime_types; (*v != NULL) && (found < 0); ++v, ++src_idx) + for (const char *const *v = mime_types; (*v != NULL); ++v, ++src_idx) { if (!::strcasecmp(*p, *v)) { @@ -160,7 +160,7 @@ namespace lsp { return STATUS_OK; } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/util/URLSink.cpp b/src/main/util/URLSink.cpp index 3a6b7f53..66e0823e 100644 --- a/src/main/util/URLSink.cpp +++ b/src/main/util/URLSink.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 23 окт. 2020 г. @@ -139,14 +139,12 @@ namespace lsp switch (nCtype) { case TEXT_URI_LIST: + case APPLICATION_X_KDE4_URILIST: res = fetch_text_uri_list_item(&data, sProtocol, raw_data, raw_size, "UTF-8"); break; case TEXT_X_MOZ_URL: res = fetch_text_uri_list_item(&data, sProtocol, raw_data, raw_size, __IF_LEBE("UTF-16LE", "UTF-16BE")); break; - case APPLICATION_X_KDE4_URILIST: - res = fetch_text_uri_list_item(&data, sProtocol, raw_data, raw_size, "UTF-8"); - break; case TEXT_PLAIN: if (data.set_native(reinterpret_cast(raw_data), raw_size)) res = STATUS_OK; diff --git a/src/main/widgets/3d/Area3D.cpp b/src/main/widgets/3d/Area3D.cpp index 6b9182b7..ec7b3429 100644 --- a/src/main/widgets/3d/Area3D.cpp +++ b/src/main/widgets/3d/Area3D.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 9 окт. 2020 г. @@ -366,5 +366,6 @@ namespace lsp { return STATUS_OK; } - } -} + + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/widgets/compound/ComboBox.cpp b/src/main/widgets/compound/ComboBox.cpp index 736ca8c8..b8118ab5 100644 --- a/src/main/widgets/compound/ComboBox.cpp +++ b/src/main/widgets/compound/ComboBox.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 8 авг. 2020 г. @@ -773,7 +773,8 @@ namespace lsp { return STATUS_OK; } - } -} + + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/widgets/compound/ComboGroup.cpp b/src/main/widgets/compound/ComboGroup.cpp index 2105decb..23d8445f 100644 --- a/src/main/widgets/compound/ComboGroup.cpp +++ b/src/main/widgets/compound/ComboGroup.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 14 авг. 2020 г. diff --git a/src/main/widgets/compound/ListBox.cpp b/src/main/widgets/compound/ListBox.cpp index ccee3374..664dbfd6 100644 --- a/src/main/widgets/compound/ListBox.cpp +++ b/src/main/widgets/compound/ListBox.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 30 июл. 2020 г. @@ -173,16 +173,16 @@ namespace lsp sHBar.accel_step()->set(1.0f, 8.0f, 0.5f); sHBar.set_parent(this); sHBar.slots()->bind(SLOT_CHANGE, slot_on_scroll_change, self()); - sHBar.slots()->bind(SLOT_KEY_DOWN, slot_on_scroll_key_down, self()); - sHBar.slots()->bind(SLOT_KEY_UP, slot_on_scroll_key_up, self()); + sHBar.slots()->bind(SLOT_KEY_DOWN, slot_on_scroll_key_event, self()); + sHBar.slots()->bind(SLOT_KEY_UP, slot_on_scroll_key_event, self()); sVBar.orientation()->set(O_VERTICAL); sVBar.step()->set(1.0f, 8.0f, 0.5f); sVBar.accel_step()->set(1.0f, 8.0f, 0.5f); sVBar.set_parent(this); sVBar.slots()->bind(SLOT_CHANGE, slot_on_scroll_change, self()); - sVBar.slots()->bind(SLOT_KEY_DOWN, slot_on_scroll_key_down, self()); - sVBar.slots()->bind(SLOT_KEY_UP, slot_on_scroll_key_up, self()); + sVBar.slots()->bind(SLOT_KEY_DOWN, slot_on_scroll_key_event, self()); + sVBar.slots()->bind(SLOT_KEY_UP, slot_on_scroll_key_event, self()); // Init style sSizeConstraints.bind("size.constraints", &sStyle); @@ -571,7 +571,6 @@ namespace lsp if (force) { s->clip_begin(area); - s->fill_rect(col, SURFMASK_NONE, 0.0f, h.nLeft + h.nWidth, v.nTop + v.nHeight, v.nWidth, h.nHeight); s->fill_rect(col, SURFMASK_NONE, 0.0f, h.nLeft, h.nTop - hsspacing, h.nWidth, hsspacing); s->clip_end(); } @@ -748,14 +747,7 @@ namespace lsp return STATUS_OK; } - status_t ListBox::slot_on_scroll_key_down(Widget *sender, void *ptr, void *data) - { - ListBox *_this = widget_ptrcast(ptr); - const ws::event_t *e = static_cast(data); - return (_this != NULL) ? _this->handle_event(e) : STATUS_OK; - } - - status_t ListBox::slot_on_scroll_key_up(Widget *sender, void *ptr, void *data) + status_t ListBox::slot_on_scroll_key_event(Widget *sender, void *ptr, void *data) { ListBox *_this = widget_ptrcast(ptr); const ws::event_t *e = static_cast(data); @@ -825,7 +817,7 @@ namespace lsp nXFlags = lsp_setflag(nXFlags, F_SEL_ACTIVE, Position::inside(&sList, e->nLeft, e->nTop)); } } - nBMask |= 1 << e->nCode; + nBMask |= size_t(1) << e->nCode; nXFlags = lsp_setflag(nXFlags, F_SUBMIT, nBMask == ws::MCF_LEFT); ws::event_t xe = *e; @@ -836,7 +828,7 @@ namespace lsp status_t ListBox::on_mouse_up(const ws::event_t *e) { - nBMask &= ~(1 << e->nCode); + nBMask &= ~(size_t(1) << e->nCode); if (nBMask == 0) { if ((nXFlags & (F_SUBMIT | F_CHANGED)) == (F_SUBMIT | F_CHANGED)) diff --git a/src/main/widgets/compound/Menu.cpp b/src/main/widgets/compound/Menu.cpp index fec6f3bc..2f77b43f 100644 --- a/src/main/widgets/compound/Menu.cpp +++ b/src/main/widgets/compound/Menu.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 18 сент. 2017 г. @@ -745,9 +745,9 @@ namespace lsp sUp.visibility()->set(scroll > 0); sUp.realize_widget(&xr); - xr.nWidth = rr.nWidth; + // xr.nWidth = rr.nWidth; xr.nHeight = lsp_max(4, st.item_h >> 1) + border_w; - xr.nLeft = rr.nLeft; + // xr.nLeft = rr.nLeft; xr.nTop = rr.nTop + rr.nHeight - xr.nHeight + border_w; sDown.visibility()->set(scroll < st.max_scroll); sDown.realize_widget(&xr); @@ -852,7 +852,8 @@ namespace lsp LSPString text; sFont.get_parameters(pDisplay, fscaling, &fp); - float aa = s->set_antialiasing(true); + bool aa = s->set_antialiasing(true); + lsp_finally { s->set_antialiasing(aa); }; for (ssize_t i=0, n=vVisible.size(); iset_antialiasing(aa); } status_t Menu::add(Widget *child) { - if (child == NULL) - return STATUS_BAD_ARGUMENTS; - MenuItem *item = widget_cast(child); - if (child == NULL) + if (item == NULL) return STATUS_BAD_TYPE; if (!vItems.add(item)) @@ -1085,11 +1082,11 @@ namespace lsp status_t Menu::insert(Widget *child, size_t index) { - if ((child == NULL) || (index > vItems.size())) + if (index > vItems.size()) return STATUS_BAD_ARGUMENTS; MenuItem *item = widget_cast(child); - if (child == NULL) + if (item == NULL) return STATUS_BAD_TYPE; if (!vItems.insert(index, item)) @@ -1164,6 +1161,20 @@ namespace lsp Widget::show(); } + void Menu::showmp(Widget *w) + { + size_t screen; + ssize_t x, y; + + if (pDisplay->get_pointer_location(&screen, &x, &y) != STATUS_OK) + return; + + sWindow.trigger_screen()->set(screen); + sWindow.trigger_widget()->set(w); + sWindow.trigger_area()->set(x, y, 0, 0); + Widget::show(); + } + void Menu::show(Widget *w, ssize_t x, ssize_t y) { sWindow.trigger_widget()->set(w); diff --git a/src/main/widgets/containers/Align.cpp b/src/main/widgets/containers/Align.cpp index b6131ed9..91303da4 100644 --- a/src/main/widgets/containers/Align.cpp +++ b/src/main/widgets/containers/Align.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 17 июл. 2017 г. diff --git a/src/main/widgets/containers/Box.cpp b/src/main/widgets/containers/Box.cpp index e101e3e2..948a7832 100644 --- a/src/main/widgets/containers/Box.cpp +++ b/src/main/widgets/containers/Box.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 20 июн. 2017 г. @@ -718,7 +718,7 @@ namespace lsp return; // Allocate space for child widgets - if ((res == STATUS_OK) && (visible.size() > 0)) + if (visible.size() > 0) { res = (sHomogeneous.get()) ? allocate_homogeneous(&xr, visible) : @@ -874,7 +874,7 @@ namespace lsp nState |= F_MOUSE_IGN; } - nMFlags |= 1 << e->nCode; + nMFlags |= size_t(1) << e->nCode; nState = lsp_setflag(nState, F_MOUSE_IN, inside(e->nLeft, e->nTop)); if (flags != nState) @@ -888,7 +888,7 @@ namespace lsp return STATUS_OK; size_t flags = nMFlags; - nMFlags &= ~ (1 << e->nCode); + nMFlags &= ~ (size_t(1) << e->nCode); if (nMFlags == 0) nState = 0; @@ -900,7 +900,7 @@ namespace lsp // Trigger submit action if (xinside) { - if ((flags == (1 << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) + if ((flags == (size_t(1) << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) sSlots.execute(SLOT_SUBMIT, this); } diff --git a/src/main/widgets/containers/Grid.cpp b/src/main/widgets/containers/Grid.cpp index 70b2b762..eebfc8df 100644 --- a/src/main/widgets/containers/Grid.cpp +++ b/src/main/widgets/containers/Grid.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 20 июн. 2017 г. @@ -1024,15 +1024,10 @@ namespace lsp w->pWidget->get_padded_size_limits(&sr); if ((w->nRows > 1) && (sr.nMinHeight > 0)) - { - if (sr.nMinHeight > 0) - distribute_size(&a->vRows, w->nTop, w->nRows, sr.nMinHeight); - } + distribute_size(&a->vRows, w->nTop, w->nRows, sr.nMinHeight); + if ((w->nCols > 1) && (sr.nMinWidth > 0)) - { - if (sr.nMinWidth > 0) - distribute_size(&a->vCols, w->nLeft, w->nCols, sr.nMinWidth); - } + distribute_size(&a->vCols, w->nLeft, w->nCols, sr.nMinWidth); } return STATUS_OK; diff --git a/src/main/widgets/containers/Group.cpp b/src/main/widgets/containers/Group.cpp index 768d7f18..6b604709 100644 --- a/src/main/widgets/containers/Group.cpp +++ b/src/main/widgets/containers/Group.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 26 июн. 2020 г. diff --git a/src/main/widgets/containers/MultiLabel.cpp b/src/main/widgets/containers/MultiLabel.cpp index 37018d93..272382df 100644 --- a/src/main/widgets/containers/MultiLabel.cpp +++ b/src/main/widgets/containers/MultiLabel.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2021 Linux Studio Plugins Project - * (C) 2021 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 16 июн. 2021 г. @@ -403,7 +403,7 @@ namespace lsp nState |= F_MOUSE_IGN; } - nMFlags |= 1 << e->nCode; + nMFlags |= size_t(1) << e->nCode; nState = lsp_setflag(nState, F_MOUSE_IN, inside(e->nLeft, e->nTop)); if (flags != nState) @@ -414,7 +414,7 @@ namespace lsp status_t MultiLabel::on_mouse_up(const ws::event_t *e) { size_t flags = nMFlags; - nMFlags &= ~ (1 << e->nCode); + nMFlags &= ~ (size_t(1) << e->nCode); if (nMFlags == 0) nState = 0; @@ -426,9 +426,9 @@ namespace lsp // Trigger submit action if (xinside) { - if ((flags == (1 << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) + if ((flags == (size_t(1) << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) sSlots.execute(SLOT_SUBMIT, this); - else if ((flags == (1 << ws::MCB_RIGHT)) && (e->nCode == ws::MCB_RIGHT) && (sPopup.is_set())) + else if ((flags == (size_t(1) << ws::MCB_RIGHT)) && (e->nCode == ws::MCB_RIGHT) && (sPopup.is_set())) { Menu *popup = sPopup.get(); sSlots.execute(SLOT_BEFORE_POPUP, popup, self()); @@ -515,7 +515,9 @@ namespace lsp Menu *_menu = widget_ptrcast(sender); return (_this != NULL) ? _this->on_popup(_menu) : STATUS_BAD_ARGUMENTS; } - } -} + + } /* namespace tk */ +} /* namespace lsp */ + diff --git a/src/main/widgets/containers/PopupWindow.cpp b/src/main/widgets/containers/PopupWindow.cpp index 929a40c2..577dd88e 100644 --- a/src/main/widgets/containers/PopupWindow.cpp +++ b/src/main/widgets/containers/PopupWindow.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 16 июн. 2020 г. @@ -351,7 +351,7 @@ namespace lsp return Window::handle_event(e); } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/widgets/containers/ScrollArea.cpp b/src/main/widgets/containers/ScrollArea.cpp index 296be82c..8507ebaa 100644 --- a/src/main/widgets/containers/ScrollArea.cpp +++ b/src/main/widgets/containers/ScrollArea.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 17 июл. 2020 г. diff --git a/src/main/widgets/containers/Tab.cpp b/src/main/widgets/containers/Tab.cpp index 26e99338..45b33d2b 100644 --- a/src/main/widgets/containers/Tab.cpp +++ b/src/main/widgets/containers/Tab.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2022 Linux Studio Plugins Project - * (C) 2022 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 9 нояб. 2022 г. diff --git a/src/main/widgets/containers/TabControl.cpp b/src/main/widgets/containers/TabControl.cpp index 5d63a970..2370beb5 100644 --- a/src/main/widgets/containers/TabControl.cpp +++ b/src/main/widgets/containers/TabControl.cpp @@ -106,6 +106,11 @@ namespace lsp sBounds.nWidth = 0; sBounds.nHeight = 0; + sTabArea.nLeft = 0; + sTabArea.nTop = 0; + sTabArea.nWidth = 0; + sTabArea.nHeight = 0; + for (size_t i=0; i<2; ++i) { sHead[i].nLeft = 0; diff --git a/src/main/widgets/containers/Window.cpp b/src/main/widgets/containers/Window.cpp index 987bc10d..5e8ca6c1 100644 --- a/src/main/widgets/containers/Window.cpp +++ b/src/main/widgets/containers/Window.cpp @@ -328,7 +328,7 @@ namespace lsp // #ifdef LSP_TRACE // time = system::get_time_millis() - time; -// lsp_trace("Render time: %ld ms", long(time)); +// lsp_trace("Window %p render time: %ld ms", this, long(time)); // #endif /* LSP_TRACE */ // And also update pointer @@ -790,7 +790,7 @@ namespace lsp { Widget *h = acquire_mouse_handler(e); // int old_state = hMouse.nState; - hMouse.nState &= ~(1 << e->nCode); + hMouse.nState &= ~(size_t(1) << e->nCode); hMouse.nLeft = e->nLeft; hMouse.nTop = e->nTop; @@ -810,7 +810,7 @@ namespace lsp { Widget *h = acquire_mouse_handler(e); // int old_state = hMouse.nState; - hMouse.nState |= (1 << e->nCode); + hMouse.nState |= (size_t(1) << e->nCode); hMouse.nLeft = e->nLeft; hMouse.nTop = e->nTop; diff --git a/src/main/widgets/dialogs/FileDialog.cpp b/src/main/widgets/dialogs/FileDialog.cpp index fdb0128f..569a95d2 100644 --- a/src/main/widgets/dialogs/FileDialog.cpp +++ b/src/main/widgets/dialogs/FileDialog.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 23 окт. 2020 г. @@ -765,7 +765,7 @@ namespace lsp handler_id_t id = 0; // Self-defined events - if (id >= 0) id = sSlots.add(SLOT_SUBMIT, slot_on_submit, self()); + id = sSlots.add(SLOT_SUBMIT, slot_on_submit, self()); if (id >= 0) id = sSlots.add(SLOT_CANCEL, slot_on_cancel, self()); if (id >= 0) id = sSlots.add(SLOT_CHANGE, slot_on_change, self()); @@ -1220,32 +1220,40 @@ namespace lsp status_t FileDialog::slot_on_bm_menu_open(Widget *sender, void *ptr, void *data) { FileDialog *_this = widget_ptrcast(ptr); + if (_this == NULL) + return STATUS_OK; bm_entry_t *bm = _this->pPopupBookmark; - return ((_this != NULL) && (bm != NULL)) ? _this->on_bm_submit(&bm->sHlink) : STATUS_OK; + return (bm != NULL) ? _this->on_bm_submit(&bm->sHlink) : STATUS_OK; } status_t FileDialog::slot_on_bm_menu_follow(Widget *sender, void *ptr, void *data) { FileDialog *_this = widget_ptrcast(ptr); + if (_this == NULL) + return STATUS_OK; bm_entry_t *bm = _this->pPopupBookmark; - return ((_this != NULL) && (bm != NULL)) ? bm->sHlink.follow_url() : STATUS_OK; + return (bm != NULL) ? bm->sHlink.follow_url() : STATUS_OK; } status_t FileDialog::slot_on_bm_menu_copy(Widget *sender, void *ptr, void *data) { FileDialog *_this = widget_ptrcast(ptr); + if (_this == NULL) + return STATUS_OK; bm_entry_t *bm = _this->pPopupBookmark; - return ((_this != NULL) && (bm != NULL)) ? bm->sHlink.copy_url(ws::CBUF_CLIPBOARD) : STATUS_OK; + return (bm != NULL) ? bm->sHlink.copy_url(ws::CBUF_CLIPBOARD) : STATUS_OK; } status_t FileDialog::slot_on_bm_menu_delete(Widget *sender, void *ptr, void *data) { FileDialog *_this = widget_ptrcast(ptr); + if (_this == NULL) + return STATUS_OK; bm_entry_t *bm = _this->pPopupBookmark; - return ((_this != NULL) && (bm != NULL)) ? _this->remove_bookmark(bm) : STATUS_OK; + return (bm != NULL) ? _this->remove_bookmark(bm) : STATUS_OK; } status_t FileDialog::slot_on_bm_menu_up(Widget *sender, void *ptr, void *data) @@ -2331,13 +2339,15 @@ namespace lsp ListBoxItem *item = new ListBoxItem(pDisplay); if (item == NULL) return STATUS_NO_MEM; + res = item->init(); if (res == STATUS_OK) res = item->text()->set(fm->title()); if (res == STATUS_OK) + { item->tag()->set(i); - if (res == STATUS_OK) res = sWFilter.items()->madd(item); // Add in managed mode + } if (res != STATUS_OK) { item->destroy(); @@ -2359,6 +2369,7 @@ namespace lsp LSPString tmp, xfname, *psrc = NULL; io::PathPattern *psmask = NULL, smask; FileMask *fmask = NULL; + status_t res; // Initialize masks if (sMode.get() == FDM_OPEN_FILE) // Additional filtering is available only when opening file @@ -2442,10 +2453,19 @@ namespace lsp ListBoxItem *item = new ListBoxItem(pDisplay); if (item == NULL) return STATUS_NO_MEM; - LSP_STATUS_ASSERT(item->init()); + + if ((res = item->init()) != STATUS_OK) + { + delete item; + return res; + } item->text()->set_raw(psrc); item->tag()->set(i); - LSP_STATUS_ASSERT(lst->madd(item)); + if ((res = lst->madd(item)) != STATUS_OK) + { + delete item; + return res; + } // Check if is equal if ((!(ent->nFlags & (F_ISDIR | F_DOTDOT))) && (xfname.length() > 0)) @@ -2500,7 +2520,7 @@ namespace lsp pWMessage->show(this); return STATUS_OK; } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/widgets/graph/GraphDot.cpp b/src/main/widgets/graph/GraphDot.cpp index e5172999..8cdbea78 100644 --- a/src/main/widgets/graph/GraphDot.cpp +++ b/src/main/widgets/graph/GraphDot.cpp @@ -512,7 +512,7 @@ namespace lsp status_t GraphDot::on_mouse_down(const ws::event_t *e) { size_t state = nMBState; - nMBState |= 1 << e->nCode; + nMBState |= size_t(1) << e->nCode; if (state == 0) { @@ -540,7 +540,7 @@ namespace lsp apply_motion(e->nLeft, e->nTop, e->nState); - nMBState &= ~(1 << e->nCode); + nMBState &= ~(size_t(1) << e->nCode); if (nMBState == 0) { nXFlags &= ~(F_FINE_TUNE | F_EDITING); diff --git a/src/main/widgets/graph/GraphLineSegment.cpp b/src/main/widgets/graph/GraphLineSegment.cpp index 20f3bdd4..eb32d530 100644 --- a/src/main/widgets/graph/GraphLineSegment.cpp +++ b/src/main/widgets/graph/GraphLineSegment.cpp @@ -503,7 +503,7 @@ namespace lsp status_t GraphLineSegment::on_mouse_down(const ws::event_t *e) { size_t state = nMBState; - nMBState |= 1 << e->nCode; + nMBState |= size_t(1) << e->nCode; if (state == 0) { @@ -531,7 +531,7 @@ namespace lsp apply_motion(e->nLeft, e->nTop, e->nState); - nMBState &= ~(1 << e->nCode); + nMBState &= ~(size_t(1) << e->nCode); if (nMBState == 0) { nXFlags &= ~(F_FINE_TUNE | F_EDITING); diff --git a/src/main/widgets/graph/GraphMarker.cpp b/src/main/widgets/graph/GraphMarker.cpp index 2e7668e4..51d1eec1 100644 --- a/src/main/widgets/graph/GraphMarker.cpp +++ b/src/main/widgets/graph/GraphMarker.cpp @@ -434,7 +434,7 @@ namespace lsp status_t GraphMarker::on_mouse_down(const ws::event_t *e) { size_t state = nMBState; - nMBState |= 1 << e->nCode; + nMBState |= size_t(1) << e->nCode; if (state == 0) { @@ -461,7 +461,7 @@ namespace lsp apply_motion(e->nLeft, e->nTop, e->nState); - nMBState &= ~(1 << e->nCode); + nMBState &= ~(size_t(1) << e->nCode); if (nMBState == 0) { nXFlags &= ~(F_FINE_TUNE | F_EDITING); diff --git a/src/main/widgets/simple/Button.cpp b/src/main/widgets/simple/Button.cpp index 40646453..e19f93b1 100644 --- a/src/main/widgets/simple/Button.cpp +++ b/src/main/widgets/simple/Button.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 21 июн. 2017 г. @@ -684,7 +684,7 @@ namespace lsp bool m_over = Position::inside(&sButton, e->nLeft, e->nTop); size_t mask = nBMask; - nBMask |= (1 << e->nCode); + nBMask |= (size_t(1) << e->nCode); if (!mask) { @@ -703,7 +703,7 @@ namespace lsp // Update state according to mouse position and mouse button state size_t state = nState; nState = lsp_setflag(nState, S_HOVER, m_over); - nState = lsp_setflag(nState, S_PRESSED, (nBMask == (1 << ws::MCB_LEFT)) && (m_over)); + nState = lsp_setflag(nState, S_PRESSED, (nBMask == (size_t(1) << ws::MCB_LEFT)) && (m_over)); // Special case for trigger button if ((nState & S_TRIGGER) && (state != nState)) @@ -737,7 +737,7 @@ namespace lsp return STATUS_OK; size_t mask = nBMask; - nBMask &= ~(1 << e->nCode); + nBMask &= ~(size_t(1) << e->nCode); // Mouse button was initially pressed out of the button area, ignore this case if ((nBMask == 0) && (nState & S_OUT)) @@ -754,7 +754,7 @@ namespace lsp { // Update state according to mouse position and mouse button state size_t state = nState; - nState = lsp_setflag(nState, S_PRESSED, (nBMask == (1 << ws::MCB_LEFT)) && (m_over)); + nState = lsp_setflag(nState, S_PRESSED, (nBMask == (size_t(1) << ws::MCB_LEFT)) && (m_over)); if (state != nState) { @@ -776,7 +776,7 @@ namespace lsp } else if (nState & S_TOGGLE) { - if ((mask == (1 << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT) && (m_over)) + if ((mask == (size_t(1) << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT) && (m_over)) nState ^= S_TOGGLED; if (state != nState) @@ -800,7 +800,7 @@ namespace lsp else { // Released left mouse button over the button widget? - if ((mask == (1 << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) + if ((mask == (size_t(1) << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) { nState &= ~(S_PRESSED | S_TOGGLED | S_DOWN); sDown.commit_value(nState & S_DOWN); @@ -812,8 +812,8 @@ namespace lsp } } - nState = lsp_setflag(nState, S_PRESSED, (nBMask == (1 << ws::MCB_LEFT)) && (m_over)); - if ((mask == size_t(1 << e->nCode)) && (nChanges > 0)) + nState = lsp_setflag(nState, S_PRESSED, (nBMask == (size_t(1) << ws::MCB_LEFT)) && (m_over)); + if ((mask == (size_t(1) << e->nCode)) && (nChanges > 0)) { sSlots.execute(SLOT_SUBMIT, this); nChanges = 0; @@ -839,7 +839,7 @@ namespace lsp // Update state according to mouse position and mouse button state bool m_over = Position::inside(&sButton, e->nLeft, e->nTop); nState = lsp_setflag(nState, S_HOVER, m_over); - nState = lsp_setflag(nState, S_PRESSED, (nBMask == (1 << ws::MCB_LEFT)) && (m_over)); + nState = lsp_setflag(nState, S_PRESSED, (nBMask == (size_t(1) << ws::MCB_LEFT)) && (m_over)); // Special case for trigger button if ((nState & S_TRIGGER) && (state != nState)) diff --git a/src/main/widgets/simple/CheckBox.cpp b/src/main/widgets/simple/CheckBox.cpp index 6558d4cc..83621694 100644 --- a/src/main/widgets/simple/CheckBox.cpp +++ b/src/main/widgets/simple/CheckBox.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 10 нояб. 2020 г. @@ -310,7 +310,7 @@ namespace lsp nState |= XF_OUT; } - nBMask |= (1 << e->nCode); + nBMask |= (size_t(1) << e->nCode); return on_mouse_move(e); } @@ -320,7 +320,7 @@ namespace lsp on_mouse_move(e); size_t state = nState; - nBMask &= ~(1 << e->nCode); + nBMask &= ~(size_t(1) << e->nCode); if (nBMask == 0) { bool checked = state & XF_CHECKED; @@ -398,7 +398,7 @@ namespace lsp { return STATUS_OK; } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/widgets/simple/Edit.cpp b/src/main/widgets/simple/Edit.cpp index c7a676f3..541fea83 100644 --- a/src/main/widgets/simple/Edit.cpp +++ b/src/main/widgets/simple/Edit.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 29 авг. 2017 г. @@ -482,8 +482,9 @@ namespace lsp float lightness = sBrightness.get(); ssize_t radius = (sBorderRadius.get() > 0) ? lsp_max(1.0f, sBorderRadius.get() * scaling) : 0; ssize_t border = (sBorderSize.get() > 0) ? lsp_max(1.0f, sBorderSize.get() * scaling) : 0; - float aa = s->set_antialiasing(true); size_t cursize = lsp_max(1.0f, scaling); + bool aa = s->set_antialiasing(true); + lsp_finally { s->set_antialiasing(aa); }; // Draw border if (border > 0) @@ -649,7 +650,6 @@ namespace lsp } s->clip_end(); - s->set_antialiasing(aa); } status_t Edit::on_change() @@ -666,7 +666,7 @@ namespace lsp status_t Edit::on_mouse_down(const ws::event_t *e) { size_t state = nMBState; - nMBState |= (1 << e->nCode); + nMBState |= (size_t(1) << e->nCode); if (state == 0) take_focus(); @@ -683,7 +683,7 @@ namespace lsp return STATUS_OK; } - ssize_t Edit::mouse_to_cursor_pos(ssize_t x, ssize_t y, bool range) + ssize_t Edit::mouse_to_cursor_pos(ssize_t x, ssize_t /* y */, bool range) { x -= sTextArea.nLeft; if ((range) && ((x < 0) || (x >= sTextArea.nWidth))) @@ -792,7 +792,7 @@ namespace lsp status_t Edit::on_mouse_up(const ws::event_t *e) { lsp_trace("mouse up"); - if ((nMBState == (1 << ws::MCB_RIGHT)) && (e->nCode == ws::MCB_RIGHT)) + if ((nMBState == (size_t(1) << ws::MCB_RIGHT)) && (e->nCode == ws::MCB_RIGHT)) { Menu *popup = sPopup.get(); if (popup != NULL) @@ -802,13 +802,13 @@ namespace lsp sSlots.execute(SLOT_POPUP, popup, self()); } } - else if ((nMBState == (1 << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) + else if ((nMBState == (size_t(1) << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) { update_clipboard(ws::CBUF_PRIMARY); if (sSelection.length() <= 0) sSelection.clear(); } - else if ((nMBState == (1 << ws::MCB_MIDDLE)) && (e->nCode == ws::MCB_MIDDLE)) + else if ((nMBState == (size_t(1) << ws::MCB_MIDDLE)) && (e->nCode == ws::MCB_MIDDLE)) { ssize_t first = mouse_to_cursor_pos(e->nLeft, e->nTop); sSelection.set(first); @@ -816,13 +816,13 @@ namespace lsp request_clipboard(ws::CBUF_PRIMARY); } - nMBState &= ~(1 << e->nCode); + nMBState &= ~(size_t(1) << e->nCode); return STATUS_OK; } status_t Edit::on_mouse_move(const ws::event_t *e) { - if (nMBState == (1 << ws::MCB_LEFT)) + if (nMBState == (size_t(1) << ws::MCB_LEFT)) { if (e->nLeft < sSize.nLeft) run_scroll(-1); diff --git a/src/main/widgets/simple/Fader.cpp b/src/main/widgets/simple/Fader.cpp index 6a7748ff..69a58aad 100644 --- a/src/main/widgets/simple/Fader.cpp +++ b/src/main/widgets/simple/Fader.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 19 нояб. 2017 г. @@ -396,14 +396,14 @@ namespace lsp } } - nButtons |= (1 << e->nCode); + nButtons |= (size_t(1) << e->nCode); if (nXFlags & F_IGNORE) return STATUS_OK; size_t key = (nXFlags & F_PRECISION) ? ws::MCB_RIGHT : ws::MCB_LEFT; // Update value - float value = (nButtons == size_t(1 << key)) ? fCurrValue : fLastValue; + float value = (nButtons == size_t(size_t(1) << key)) ? fCurrValue : fLastValue; update_value(value); return STATUS_OK; @@ -411,7 +411,7 @@ namespace lsp status_t Fader::on_mouse_up(const ws::event_t *e) { - nButtons &= ~(1 << e->nCode); + nButtons &= ~(size_t(1) << e->nCode); if (nXFlags & F_IGNORE) { if (nButtons == 0) @@ -432,7 +432,7 @@ namespace lsp nXFlags = 0; value = (e->nCode == key) ? fCurrValue : fLastValue; } - else if (nButtons == size_t(1 << key)) // Currently pressed initially selected button + else if (nButtons == (size_t(1) << key)) // Currently pressed initially selected button value = fCurrValue; else value = fLastValue; @@ -452,7 +452,7 @@ namespace lsp return STATUS_OK; size_t key = (nXFlags & F_PRECISION) ? ws::MCB_RIGHT : ws::MCB_LEFT; - if (nButtons != size_t(1 << key)) + if (nButtons != (size_t(1) << key)) { if ((nButtons == 0) && (Position::inside(&sButton, e->nLeft, e->nTop))) nXFlags |= F_MOVER; @@ -578,11 +578,7 @@ namespace lsp sborder.lightness(l); sborder.scale_lch_luminance(bright); - if (angle & 1) // vertical - g = s->radial_gradient(0, sSize.nHeight, scaling, sSize.nHeight, delta); - else // horizontal - g = s->radial_gradient(0, sSize.nHeight, scaling, sSize.nHeight, delta); - + g = s->radial_gradient(0, sSize.nHeight, scaling, sSize.nHeight, delta); g->add_color(0.0, sborder); g->add_color(1.0, 0.5 * sborder.red(), 0.5 * sborder.green(), 0.5 * sborder.blue()); s->fill_rect(g, SURFMASK_ALL_CORNER, sradius, &h); @@ -620,25 +616,14 @@ namespace lsp switch (angle & 3) { - case 0: // + - boff = sHole.nLeft - sSize.nLeft + sHole.nWidth * balance; - bval = sHole.nLeft - sSize.nLeft + sHole.nWidth * value; - c.nLeft = lsp_min(boff, bval); - c.nWidth = lsp_max(boff, bval) - c.nLeft; - break; - case 1: - boff = sHole.nTop - sSize.nTop + sHole.nHeight * (1.0f - balance); - bval = sHole.nTop - sSize.nTop + sHole.nHeight * (1.0f - value); - c.nTop = lsp_min(boff, bval); - c.nHeight = lsp_max(boff, bval) - c.nTop; - break; - case 2: + case 0: case 2: boff = sHole.nLeft - sSize.nLeft + sHole.nWidth * balance; bval = sHole.nLeft - sSize.nLeft + sHole.nWidth * value; c.nLeft = lsp_min(boff, bval); c.nWidth = lsp_max(boff, bval) - c.nLeft; break; - default: // + + case 1: case 3: + default: boff = sHole.nTop - sSize.nTop + sHole.nHeight * (1.0f - balance); bval = sHole.nTop - sSize.nTop + sHole.nHeight * (1.0f - value); c.nTop = lsp_min(boff, bval); diff --git a/src/main/widgets/simple/Hyperlink.cpp b/src/main/widgets/simple/Hyperlink.cpp index 1d72b2c3..e7ccba27 100644 --- a/src/main/widgets/simple/Hyperlink.cpp +++ b/src/main/widgets/simple/Hyperlink.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 23 окт. 2017 г. @@ -383,7 +383,7 @@ namespace lsp if (nState & F_MOUSE_IGN) return STATUS_OK; size_t flags = nState; - if ((nState & F_MOUSE_DOWN) && (nMFlags == (1 << ws::MCB_LEFT))) + if ((nState & F_MOUSE_DOWN) && (nMFlags == (size_t(1) << ws::MCB_LEFT))) nState |= F_MOUSE_IN; else if (nMFlags == 0) nState |= F_MOUSE_IN; @@ -401,7 +401,7 @@ namespace lsp if (nState & F_MOUSE_IGN) return STATUS_OK; size_t flags = nState; - if ((nState & F_MOUSE_DOWN) && (nMFlags == (1 << ws::MCB_LEFT))) + if ((nState & F_MOUSE_DOWN) && (nMFlags == (size_t(1) << ws::MCB_LEFT))) nState |= F_MOUSE_IN; else nState &= ~F_MOUSE_IN; @@ -415,7 +415,7 @@ namespace lsp if (nState & F_MOUSE_IGN) return STATUS_OK; size_t flags = nState; - if ((nState & F_MOUSE_DOWN) && (nMFlags == (1 << ws::MCB_LEFT)) && (inside(e->nLeft, e->nTop))) + if ((nState & F_MOUSE_DOWN) && (nMFlags == (size_t(1) << ws::MCB_LEFT)) && (inside(e->nLeft, e->nTop))) nState |= F_MOUSE_IN; else if (nMFlags == 0) nState |= F_MOUSE_IN; @@ -438,9 +438,9 @@ namespace lsp nState |= F_MOUSE_IGN; } - nMFlags |= 1 << e->nCode; + nMFlags |= size_t(1) << e->nCode; - if ((nState & F_MOUSE_DOWN) && (nMFlags == (1 << ws::MCB_LEFT)) && (inside(e->nLeft, e->nTop))) + if ((nState & F_MOUSE_DOWN) && (nMFlags == (size_t(1) << ws::MCB_LEFT)) && (inside(e->nLeft, e->nTop))) nState |= F_MOUSE_IN; else if (nMFlags == 0) nState |= F_MOUSE_IN; @@ -455,11 +455,11 @@ namespace lsp status_t Hyperlink::on_mouse_up(const ws::event_t *e) { size_t flags = nMFlags; - nMFlags &= ~ (1 << e->nCode); + nMFlags &= ~ (size_t(1) << e->nCode); if (nMFlags == 0) nState = 0; - if ((nState & F_MOUSE_DOWN) && (nMFlags == (1 << ws::MCB_LEFT)) && (inside(e->nLeft, e->nTop))) + if ((nState & F_MOUSE_DOWN) && (nMFlags == (size_t(1) << ws::MCB_LEFT)) && (inside(e->nLeft, e->nTop))) nState |= F_MOUSE_IN; else if (nMFlags == 0) nState |= F_MOUSE_IN; @@ -472,9 +472,9 @@ namespace lsp // Trigger submit action if (inside(e->nLeft, e->nTop)) { - if ((flags == (1 << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) + if ((flags == (size_t(1) << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) sSlots.execute(SLOT_SUBMIT, this); - else if ((flags == (1 << ws::MCB_RIGHT)) && (e->nCode == ws::MCB_RIGHT) && (sPopup.is_set())) + else if ((flags == (size_t(1) << ws::MCB_RIGHT)) && (e->nCode == ws::MCB_RIGHT) && (sPopup.is_set())) { Menu *popup = sPopup.get(); sSlots.execute(SLOT_BEFORE_POPUP, popup, self()); diff --git a/src/main/widgets/simple/Knob.cpp b/src/main/widgets/simple/Knob.cpp index f22ca71c..8c3cf334 100644 --- a/src/main/widgets/simple/Knob.cpp +++ b/src/main/widgets/simple/Knob.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 10 июл. 2017 г. @@ -349,7 +349,7 @@ namespace lsp } } - nButtons |= (1 << e->nCode); + nButtons |= (size_t(1) << e->nCode); nLastY = e->nTop; return STATUS_OK; @@ -358,7 +358,7 @@ namespace lsp status_t Knob::on_mouse_up(const ws::event_t *e) { // lsp_trace("x=%d, y=%d, state=%x, code=%x", int(e->nLeft), int(e->nTop), int(e->nState), int(e->nCode)); - nButtons &= ~(1 << e->nCode); + nButtons &= ~(size_t(1) << e->nCode); nLastY = e->nTop; if (nButtons == 0) { diff --git a/src/main/widgets/simple/Label.cpp b/src/main/widgets/simple/Label.cpp index eabcc0f9..8e1e4bd5 100644 --- a/src/main/widgets/simple/Label.cpp +++ b/src/main/widgets/simple/Label.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 6 июл. 2017 г. @@ -292,7 +292,7 @@ namespace lsp nState |= F_MOUSE_IGN; } - nMFlags |= 1 << e->nCode; + nMFlags |= size_t(1) << e->nCode; nState = lsp_setflag(nState, F_MOUSE_IN, inside(e->nLeft, e->nTop)); if (flags != nState) @@ -303,7 +303,7 @@ namespace lsp status_t Label::on_mouse_up(const ws::event_t *e) { size_t flags = nMFlags; - nMFlags &= ~ (1 << e->nCode); + nMFlags &= ~ (size_t(1) << e->nCode); if (nMFlags == 0) nState = 0; @@ -315,9 +315,9 @@ namespace lsp // Trigger submit action if (xinside) { - if ((flags == (1 << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) + if ((flags == (size_t(1) << ws::MCB_LEFT)) && (e->nCode == ws::MCB_LEFT)) sSlots.execute(SLOT_SUBMIT, this); - else if ((flags == (1 << ws::MCB_RIGHT)) && (e->nCode == ws::MCB_RIGHT) && (sPopup.is_set())) + else if ((flags == (size_t(1) << ws::MCB_RIGHT)) && (e->nCode == ws::MCB_RIGHT) && (sPopup.is_set())) { Menu *popup = sPopup.get(); sSlots.execute(SLOT_BEFORE_POPUP, popup, self()); diff --git a/src/main/widgets/simple/RadioButton.cpp b/src/main/widgets/simple/RadioButton.cpp index d85bd359..390fbece 100644 --- a/src/main/widgets/simple/RadioButton.cpp +++ b/src/main/widgets/simple/RadioButton.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 10 нояб. 2020 г. @@ -281,7 +281,7 @@ namespace lsp nState |= XF_OUT; } - nBMask |= (1 << e->nCode); + nBMask |= (size_t(1) << e->nCode); return on_mouse_move(e); } @@ -291,7 +291,7 @@ namespace lsp on_mouse_move(e); size_t state = nState; - nBMask &= ~(1 << e->nCode); + nBMask &= ~(size_t(1) << e->nCode); if (nBMask == 0) { bool checked = state & XF_CHECKED; @@ -369,7 +369,7 @@ namespace lsp { return STATUS_OK; } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/widgets/simple/ScrollBar.cpp b/src/main/widgets/simple/ScrollBar.cpp index 3c047367..abf039e4 100644 --- a/src/main/widgets/simple/ScrollBar.cpp +++ b/src/main/widgets/simple/ScrollBar.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 3 авг. 2017 г. @@ -475,7 +475,7 @@ namespace lsp if (nButtons == 0) { // Update state of buttons - nButtons |= (1 << e->nCode); + nButtons |= (size_t(1) << e->nCode); // Check that we first hit inside the bar size_t flags = check_mouse_over(e->nLeft, e->nTop); @@ -522,7 +522,7 @@ namespace lsp } else { - nButtons |= (1 << e->nCode); + nButtons |= (size_t(1) << e->nCode); if (nXFlags & F_OUTSIDE) return STATUS_OK; @@ -641,7 +641,7 @@ namespace lsp status_t ScrollBar::on_mouse_up(const ws::event_t *e) { // lsp_trace("nButtons = %d, code = %d", int(nButtons), int(e->nCode)); - nButtons &= ~(1 << e->nCode); + nButtons &= ~(size_t(1) << e->nCode); nKeys = e->nState; if (nXFlags & F_OUTSIDE) { @@ -662,7 +662,7 @@ namespace lsp nXFlags &= ~(F_ALL_ACTIVITY_MASK | F_PRECISION); value = (e->nCode == key) ? fCurrValue : fLastValue; } - else if (nButtons == size_t(1 << key)) // Currently pressed initially selected button + else if (nButtons == (size_t(1) << key)) // Currently pressed initially selected button { nXFlags = (nXFlags & (~F_ACTIVITY_MASK)) | ((nXFlags >> F_ACTIVITY_BITS) & F_ACTIVITY_MASK); // Restore activity state value = fCurrValue; @@ -735,7 +735,7 @@ namespace lsp if (nXFlags & F_TRG_SLIDER_ACTIVE) { size_t key = (nXFlags & F_PRECISION) ? ws::MCB_RIGHT : ws::MCB_LEFT; - if (nButtons != size_t(1 << key)) + if (nButtons != (size_t(1) << key)) return STATUS_OK; // Different behaviour for slider diff --git a/src/main/widgets/simple/Switch.cpp b/src/main/widgets/simple/Switch.cpp index 59f55760..f47fd701 100644 --- a/src/main/widgets/simple/Switch.cpp +++ b/src/main/widgets/simple/Switch.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 1 июл. 2017 г. @@ -454,10 +454,10 @@ namespace lsp status_t Switch::on_mouse_down(const ws::event_t *e) { - nBMask |= (1 << e->nCode); + nBMask |= (size_t(1) << e->nCode); bool mover = check_mouse_over(e->nLeft, e->nTop); - bool pressed = (nBMask == (1 << ws::MCB_LEFT)) && (mover); + bool pressed = (nBMask == (size_t(1) << ws::MCB_LEFT)) && (mover); bool is_pressed = nState & S_PRESSED; if (pressed != is_pressed) @@ -476,8 +476,8 @@ namespace lsp status_t Switch::on_mouse_up(const ws::event_t *e) { bool mover = check_mouse_over(e->nLeft, e->nTop); - nBMask &= ~(1 << e->nCode); - bool pressed = ((e->nCode == ws::MCB_LEFT) && (nBMask == 0)) || ((e->nCode != ws::MCB_LEFT) && (nBMask == (1 << ws::MCB_LEFT))); + nBMask &= ~(size_t(1) << e->nCode); + bool pressed = ((e->nCode == ws::MCB_LEFT) && (nBMask == 0)) || ((e->nCode != ws::MCB_LEFT) && (nBMask == (size_t(1) << ws::MCB_LEFT))); if (pressed) pressed = mover; if (nBMask == 0) @@ -509,7 +509,7 @@ namespace lsp status_t Switch::on_mouse_move(const ws::event_t *e) { bool mover = check_mouse_over(e->nLeft, e->nTop); - bool pressed = (nBMask == (1 << ws::MCB_LEFT)) && (mover); + bool pressed = (nBMask == (size_t(1) << ws::MCB_LEFT)) && (mover); bool is_pressed = nState & S_PRESSED; if (pressed != is_pressed) @@ -539,5 +539,5 @@ namespace lsp nState = (down) ? nState | S_TOGGLED : nState & ~S_TOGGLED; query_draw(); } - } /* namespace ctl */ + } /* namespace tk */ } /* namespace lsp */ diff --git a/src/main/widgets/specific/AudioChannel.cpp b/src/main/widgets/specific/AudioChannel.cpp index e53e42bb..3223a150 100644 --- a/src/main/widgets/specific/AudioChannel.cpp +++ b/src/main/widgets/specific/AudioChannel.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 28 сент. 2020 г. @@ -412,7 +412,7 @@ namespace lsp if ((position < 0) || (pborder < 0)) return; - float x = r->nLeft + (position * r->nWidth) / samples; + float x = float(r->nLeft + (position * r->nWidth) / samples); float border = lsp_max(1.0f, pborder * scaling); lsp::Color wire(sPlayColor); @@ -483,7 +483,7 @@ namespace lsp } s->clip_end(); } - } -} + } /* namespace tk */ +} /* namespace lsp */ diff --git a/src/main/widgets/specific/AudioSample.cpp b/src/main/widgets/specific/AudioSample.cpp index 8d83ffcf..ed6469a9 100644 --- a/src/main/widgets/specific/AudioSample.cpp +++ b/src/main/widgets/specific/AudioSample.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 28 сент. 2020 г. @@ -317,8 +317,7 @@ namespace lsp } // Add slots - handler_id_t id = 0; - if (id >= 0) id = sSlots.add(SLOT_SUBMIT, slot_on_submit, self()); + handler_id_t id = sSlots.add(SLOT_SUBMIT, slot_on_submit, self()); return (id >= 0) ? STATUS_OK : -id; } @@ -667,7 +666,7 @@ namespace lsp float scaling = lsp_max(0.0f, sScaling.get()); float bright = sBrightness.get(); - float x = r->nLeft + (position * r->nWidth) / samples; + float x = float(r->nLeft + (position * r->nWidth) / samples); float border = lsp_max(1.0f, pborder * scaling); lsp::Color wire(sPlayColor); @@ -1282,7 +1281,7 @@ namespace lsp } } - nBMask |= 1 << e->nCode; + nBMask |= size_t(1) << e->nCode; return handle_mouse_move(e); } @@ -1290,9 +1289,9 @@ namespace lsp status_t AudioSample::on_mouse_up(const ws::event_t *e) { size_t mask = nBMask; - nBMask &= ~(1 << e->nCode); + nBMask &= ~(size_t(1) << e->nCode); - if (mask != (1U << e->nCode)) + if (mask != (size_t(1) << e->nCode)) return handle_mouse_move(e); // Last button released, process the vent diff --git a/src/main/widgets/specific/FileButton.cpp b/src/main/widgets/specific/FileButton.cpp index dd2f37c9..c8f50475 100644 --- a/src/main/widgets/specific/FileButton.cpp +++ b/src/main/widgets/specific/FileButton.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 7 сент. 2020 г. @@ -337,8 +337,9 @@ namespace lsp b.nLeft -= sSize.nLeft; b.nTop -= sSize.nTop; - float aa = s->set_antialiasing(true); bool gradient = sGradient.get(); + bool aa = s->set_antialiasing(true); + lsp_finally { s->set_antialiasing(aa); }; if (gradient) { @@ -444,9 +445,6 @@ namespace lsp sFont.draw(s, text, x, y, fscaling, &stext, last, tail); last = curr + 1; } - - // Restore antialiasing - s->set_antialiasing(aa); } status_t FileButton::on_mouse_down(const ws::event_t *e) @@ -462,7 +460,7 @@ namespace lsp } } - nBMask |= 1 << e->nCode; + nBMask |= size_t(1) << e->nCode; return handle_mouse_move(e); } @@ -470,9 +468,9 @@ namespace lsp status_t FileButton::on_mouse_up(const ws::event_t *e) { size_t mask = nBMask; - nBMask &= ~(1 << e->nCode); + nBMask &= ~(size_t(1) << e->nCode); - if (mask != (1U << e->nCode)) + if (mask != (size_t(1) << e->nCode)) return handle_mouse_move(e); // Last button released diff --git a/src/main/widgets/specific/LedMeter.cpp b/src/main/widgets/specific/LedMeter.cpp index d2e95d98..79eced15 100644 --- a/src/main/widgets/specific/LedMeter.cpp +++ b/src/main/widgets/specific/LedMeter.cpp @@ -331,6 +331,8 @@ namespace lsp led_size -= (border + xtext.nWidth); } } + else + tp.Height = 0; // Compute overall areas ssize_t segments = led_size / seg_size; diff --git a/src/main/widgets/specific/LedMeterChannel.cpp b/src/main/widgets/specific/LedMeterChannel.cpp index c92d0ae9..e931cd93 100644 --- a/src/main/widgets/specific/LedMeterChannel.cpp +++ b/src/main/widgets/specific/LedMeterChannel.cpp @@ -453,7 +453,7 @@ namespace lsp float first = sValue.min(); float vmin = first - 0.5f * step; - float aa = s->set_antialiasing(true); + bool aa = s->set_antialiasing(true); lsp_finally { s->set_antialiasing(aa); }; s->clip_begin(&sAMeter); @@ -482,7 +482,7 @@ namespace lsp ((vmax > balance) && (vmin <= value)) : ((vmax > value) && (vmin <= balance)); - if ((has_balance) && (vmin <= balance) && (balance < vmax)) + if ((vmin <= balance) && (balance < vmax)) matched = !reversive; else if ((!matched) && (has_peak)) matched = (peak >= vmin) && (peak < vmax); diff --git a/src/main/widgets/specific/RackEars.cpp b/src/main/widgets/specific/RackEars.cpp index e7962006..03dcdf52 100644 --- a/src/main/widgets/specific/RackEars.cpp +++ b/src/main/widgets/specific/RackEars.cpp @@ -436,7 +436,7 @@ namespace lsp } } - nBMask |= 1 << e->nCode; + nBMask |= size_t(1) << e->nCode; return handle_mouse_move(e); } @@ -444,9 +444,9 @@ namespace lsp status_t RackEars::on_mouse_up(const ws::event_t *e) { size_t mask = nBMask; - nBMask &= ~(1 << e->nCode); + nBMask &= ~(size_t(1) << e->nCode); - if (mask != (1U << e->nCode)) + if (mask != (size_t(1) << e->nCode)) return handle_mouse_move(e); // Last button released, process the vent diff --git a/src/test/mtest/widgets/compound/menu.cpp b/src/test/mtest/widgets/compound/menu.cpp index 32643361..a88db040 100644 --- a/src/test/mtest/widgets/compound/menu.cpp +++ b/src/test/mtest/widgets/compound/menu.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2020 Linux Studio Plugins Project - * (C) 2020 Vladimir Sadovnikov + * Copyright (C) 2023 Linux Studio Plugins Project + * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-tk-lib * Created on: 20 июн. 2020 г. @@ -98,7 +98,7 @@ MTEST_BEGIN("tk.widgets.compound", menu) if (h->menu->visibility()->get()) h->menu->hide(); else - h->menu->show(); + h->menu->showmp(sender); return STATUS_OK; }