From 663a5d01b1931b97370ed8feff3ae229a9cc7ea4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 2 Jan 2021 14:02:44 +0100 Subject: Format all code with clang-format --- src/CanvasPort.hpp | 126 ++++++++++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'src/CanvasPort.hpp') diff --git a/src/CanvasPort.hpp b/src/CanvasPort.hpp index e8e809f..3376e15 100644 --- a/src/CanvasPort.hpp +++ b/src/CanvasPort.hpp @@ -48,71 +48,71 @@ namespace patchage { class CanvasPort : public Ganv::Port { public: - CanvasPort(Ganv::Module& module, - PortType type, - PortID id, - const std::string& name, - const std::string& human_name, - bool is_input, - uint32_t color, - bool show_human_name, - boost::optional order = boost::optional()) - : Port(module, - (show_human_name && !human_name.empty()) ? human_name : name, - is_input, - color) - , _type(type) - , _id(std::move(id)) - , _name(name) - , _human_name(human_name) - , _order(order) - { - signal_event().connect(sigc::mem_fun(this, &CanvasPort::on_event)); - } - - CanvasPort(const CanvasPort&) = delete; - CanvasPort& operator=(const CanvasPort&) = delete; - - CanvasPort(CanvasPort&&) = delete; - CanvasPort& operator=(CanvasPort&&) = delete; - - ~CanvasPort() override = default; - - void show_human_name(bool human) - { - if (human && !_human_name.empty()) { - set_label(_human_name.c_str()); - } else { - set_label(_name.c_str()); - } - } - - bool on_event(GdkEvent* ev) override - { - if (ev->type != GDK_BUTTON_PRESS || ev->button.button != 3) { - return false; - } - - Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); - menu->items().push_back(Gtk::Menu_Helpers::MenuElem( - "Disconnect", sigc::mem_fun(this, &Port::disconnect))); - - menu->popup(ev->button.button, ev->button.time); - return true; - } - - PortType type() const { return _type; } - PortID id() const { return _id; } - const std::string& name() const { return _name; } - const std::string& human_name() const { return _human_name; } - const boost::optional& order() const { return _order; } + CanvasPort(Ganv::Module& module, + PortType type, + PortID id, + const std::string& name, + const std::string& human_name, + bool is_input, + uint32_t color, + bool show_human_name, + boost::optional order = boost::optional()) + : Port(module, + (show_human_name && !human_name.empty()) ? human_name : name, + is_input, + color) + , _type(type) + , _id(std::move(id)) + , _name(name) + , _human_name(human_name) + , _order(order) + { + signal_event().connect(sigc::mem_fun(this, &CanvasPort::on_event)); + } + + CanvasPort(const CanvasPort&) = delete; + CanvasPort& operator=(const CanvasPort&) = delete; + + CanvasPort(CanvasPort&&) = delete; + CanvasPort& operator=(CanvasPort&&) = delete; + + ~CanvasPort() override = default; + + void show_human_name(bool human) + { + if (human && !_human_name.empty()) { + set_label(_human_name.c_str()); + } else { + set_label(_name.c_str()); + } + } + + bool on_event(GdkEvent* ev) override + { + if (ev->type != GDK_BUTTON_PRESS || ev->button.button != 3) { + return false; + } + + Gtk::Menu* menu = Gtk::manage(new Gtk::Menu()); + menu->items().push_back(Gtk::Menu_Helpers::MenuElem( + "Disconnect", sigc::mem_fun(this, &Port::disconnect))); + + menu->popup(ev->button.button, ev->button.time); + return true; + } + + PortType type() const { return _type; } + PortID id() const { return _id; } + const std::string& name() const { return _name; } + const std::string& human_name() const { return _human_name; } + const boost::optional& order() const { return _order; } private: - PortType _type; - PortID _id; - std::string _name; - std::string _human_name; - boost::optional _order; + PortType _type; + PortID _id; + std::string _name; + std::string _human_name; + boost::optional _order; }; } // namespace patchage -- cgit v1.2.1