summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-29 19:33:18 +0100
committerDavid Robillard <d@drobilla.net>2020-11-29 19:39:48 +0100
commit9eaeb0bbca7d3f295664a3fc96660a8fe206483c (patch)
tree744a19d80c86b4149182b17e3757c9bdd8587d64 /src
parentdf55ba49276c8fa172979dbc497339ec81c97add (diff)
downloadpatchage-9eaeb0bbca7d3f295664a3fc96660a8fe206483c.tar.gz
patchage-9eaeb0bbca7d3f295664a3fc96660a8fe206483c.tar.bz2
patchage-9eaeb0bbca7d3f295664a3fc96660a8fe206483c.zip
Remove more dead code
Diffstat (limited to 'src')
-rw-r--r--src/CanvasModule.cpp9
-rw-r--r--src/CanvasModule.hpp16
-rw-r--r--src/CanvasPort.hpp14
-rw-r--r--src/Legend.hpp5
-rw-r--r--src/Patchage.cpp40
-rw-r--r--src/Patchage.hpp2
6 files changed, 31 insertions, 55 deletions
diff --git a/src/CanvasModule.cpp b/src/CanvasModule.cpp
index dc0af4e..c7b003f 100644
--- a/src/CanvasModule.cpp
+++ b/src/CanvasModule.cpp
@@ -16,6 +16,8 @@
#include "CanvasModule.hpp"
+#include <gtkmm/menu_elems.h>
+
#include "Canvas.hpp"
#include "CanvasPort.hpp"
#include "Patchage.hpp"
@@ -82,6 +84,7 @@ CanvasModule::show_menu(GdkEventButton* ev)
{
_menu = new Gtk::Menu();
Gtk::Menu::MenuList& items = _menu->items();
+
if (_type == SignalDirection::duplex) {
items.push_back(Gtk::Menu_Helpers::MenuElem(
"_Split", sigc::mem_fun(this, &CanvasModule::split)));
@@ -90,9 +93,9 @@ CanvasModule::show_menu(GdkEventButton* ev)
items.push_back(Gtk::Menu_Helpers::MenuElem(
"_Join", sigc::mem_fun(this, &CanvasModule::join)));
}
+
items.push_back(Gtk::Menu_Helpers::MenuElem(
- "_Disconnect All",
- sigc::mem_fun(this, &CanvasModule::menu_disconnect_all)));
+ "_Disconnect All", sigc::mem_fun(this, &CanvasModule::disconnect_all)));
_menu->popup(ev->button, ev->time);
return true;
@@ -147,7 +150,7 @@ CanvasModule::join()
}
void
-CanvasModule::menu_disconnect_all()
+CanvasModule::disconnect_all()
{
for (Ganv::Port* p : *this) {
p->disconnect();
diff --git a/src/CanvasModule.hpp b/src/CanvasModule.hpp
index c5ed699..3b65b67 100644
--- a/src/CanvasModule.hpp
+++ b/src/CanvasModule.hpp
@@ -26,8 +26,9 @@ PATCHAGE_DISABLE_GANV_WARNINGS
#include "ganv/Port.hpp"
PATCHAGE_RESTORE_WARNINGS
-#include <gtkmm/menu_elems.h>
+#include <gtkmm/menu.h>
+#include <memory>
#include <string>
namespace patchage {
@@ -44,8 +45,8 @@ public:
const std::string& name,
SignalDirection type,
ClientID id,
- double x = 0,
- double y = 0);
+ double x = 0.0,
+ double y = 0.0);
CanvasModule(const CanvasModule&) = delete;
CanvasModule& operator=(const CanvasModule&) = delete;
@@ -55,17 +56,16 @@ public:
~CanvasModule() override;
- void split();
- void join();
-
bool show_menu(GdkEventButton* ev);
void update_menu();
+ void split();
+ void join();
+ void disconnect_all();
+
CanvasPort* get_port(const PortID& id);
void load_location();
- void menu_disconnect_all();
- void show_dialog() {}
void store_location(double x, double y);
SignalDirection type() const { return _type; }
diff --git a/src/CanvasPort.hpp b/src/CanvasPort.hpp
index 5bd581c..5607f04 100644
--- a/src/CanvasPort.hpp
+++ b/src/CanvasPort.hpp
@@ -69,20 +69,6 @@ public:
~CanvasPort() override = default;
- /** Returns the name of the module/client this port is one */
- std::string module_name() const
- {
- auto* pmod = dynamic_cast<CanvasModule*>(get_module());
- return std::string(pmod->name());
- }
-
- /** Returns the full name of this port, as "modulename:portname" */
- std::string full_name() const
- {
- auto* pmod = dynamic_cast<CanvasModule*>(get_module());
- return std::string(pmod->name()) + ":" + _name;
- }
-
void show_human_name(bool human)
{
if (human && !_human_name.empty()) {
diff --git a/src/Legend.hpp b/src/Legend.hpp
index 6d5807b..3030756 100644
--- a/src/Legend.hpp
+++ b/src/Legend.hpp
@@ -32,13 +32,14 @@ class Legend : public Gtk::HBox
public:
explicit Legend(const Configuration& configuration);
+ sigc::signal<void, PortType, std::string, uint32_t> signal_color_changed;
+
+private:
void add_button(PortType id, const std::string& label, uint32_t rgba);
void on_color_set(PortType id,
const std::string& label,
const Gtk::ColorButton* but);
-
- sigc::signal<void, PortType, std::string, uint32_t> signal_color_changed;
};
} // namespace patchage
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 5cb0fa3..b6ce5da 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -112,6 +112,18 @@ port_order(const GanvPort* a, const GanvPort* b, void*)
return 0;
}
+static void
+load_module_location(GanvNode* node, void*)
+{
+ if (GANV_IS_MODULE(node)) {
+ Ganv::Module* gmod = Glib::wrap(GANV_MODULE(node));
+ auto* pmod = dynamic_cast<CanvasModule*>(gmod);
+ if (pmod) {
+ pmod->load_location();
+ }
+ }
+}
+
} // namespace
#define INIT_WIDGET(x) x(_xml, (#x) + 1)
@@ -305,7 +317,8 @@ Patchage::Patchage(Options options)
_menu_alsa_disconnect->set_sensitive(false);
}
- update_state();
+ _canvas->for_each_node(load_module_location, nullptr);
+
_menu_view_toolbar->set_active(_conf.get_show_toolbar());
_menu_view_sprung_layout->set_active(_conf.get_sprung_layout());
_menu_view_sort_ports->set_active(_conf.get_sort_ports());
@@ -437,13 +450,6 @@ Patchage::update_load()
}
void
-Patchage::zoom(double z)
-{
- _conf.set_zoom(z);
- _canvas->set_zoom(z);
-}
-
-void
Patchage::refresh()
{
auto sink = [this](const Event& event) {
@@ -548,24 +554,6 @@ Patchage::clear_load()
}
}
-static void
-load_module_location(GanvNode* node, void*)
-{
- if (GANV_IS_MODULE(node)) {
- Ganv::Module* gmod = Glib::wrap(GANV_MODULE(node));
- auto* pmod = dynamic_cast<CanvasModule*>(gmod);
- if (pmod) {
- pmod->load_location();
- }
- }
-}
-
-void
-Patchage::update_state()
-{
- _canvas->for_each_node(load_module_location, nullptr);
-}
-
void
Patchage::on_driver_event(const Event& event)
{
diff --git a/src/Patchage.hpp b/src/Patchage.hpp
index 51e6d99..746f32a 100644
--- a/src/Patchage.hpp
+++ b/src/Patchage.hpp
@@ -83,7 +83,6 @@ public:
void driver_attached(ClientType type);
void driver_detached(ClientType type);
- void update_state();
void store_window_location();
bool show_human_names() const
@@ -137,7 +136,6 @@ protected:
bool on_scroll(GdkEventScroll* ev);
- void zoom(double z);
bool idle_callback();
void clear_load();
bool update_load();