summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-02 04:14:26 +0000
committerDavid Robillard <d@drobilla.net>2008-01-02 04:14:26 +0000
commit119af67b5139e40eb3f21dde42882765e917efcb (patch)
treec538c7a53d6a32f89dec27663e202666139f1197
parent1c2a70154bc1f9070c1a2b9b3cf98f8d398ca215 (diff)
downloadpatchage-119af67b5139e40eb3f21dde42882765e917efcb.tar.gz
patchage-119af67b5139e40eb3f21dde42882765e917efcb.tar.bz2
patchage-119af67b5139e40eb3f21dde42882765e917efcb.zip
Minor Patchage code cleanups.
git-svn-id: http://svn.drobilla.net/lad/patchage@1001 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/AlsaDriver.hpp21
-rw-r--r--src/GladeFile.hpp6
-rw-r--r--src/JackSettingsDialog.hpp5
-rw-r--r--src/LashDriver.hpp3
-rw-r--r--src/Patchage.hpp4
-rw-r--r--src/PatchageCanvas.hpp3
-rw-r--r--src/PatchageModule.hpp30
-rw-r--r--src/PatchagePort.hpp15
-rw-r--r--src/StateManager.hpp36
9 files changed, 41 insertions, 82 deletions
diff --git a/src/AlsaDriver.hpp b/src/AlsaDriver.hpp
index 11adac7..9e9f2ea 100644
--- a/src/AlsaDriver.hpp
+++ b/src/AlsaDriver.hpp
@@ -21,14 +21,10 @@
#include <iostream>
#include <alsa/asoundlib.h>
#include <pthread.h>
-#include <queue>
#include <string>
#include "Driver.hpp"
class Patchage;
class PatchagePort;
-class PatchageFlowCanvas;
-
-using std::queue; using std::string;
/** Handles all externally driven functionality, registering ports etc.
@@ -60,18 +56,19 @@ private:
void add_connections(boost::shared_ptr<PatchagePort> port);
- bool create_refresh_port();
+ bool create_refresh_port();
static void* refresh_main(void* me);
- void _refresh_main();
+ void _refresh_main();
- boost::shared_ptr<PatchagePort> create_port(boost::shared_ptr<PatchageModule> parent,
- const string& name, bool is_input, snd_seq_addr_t addr);
+ boost::shared_ptr<PatchagePort> create_port(
+ boost::shared_ptr<PatchageModule> parent,
+ const std::string& name,
+ bool is_input,
+ snd_seq_addr_t addr);
- Patchage* _app;
-
+ Patchage* _app;
snd_seq_t* _seq;
-
- pthread_t _refresh_thread;
+ pthread_t _refresh_thread;
};
#endif // ALSADRIVER_H
diff --git a/src/GladeFile.hpp b/src/GladeFile.hpp
index fb4c474..cc0954c 100644
--- a/src/GladeFile.hpp
+++ b/src/GladeFile.hpp
@@ -24,9 +24,7 @@
#include <stdexcept>
#include <libglademm/xml.h>
-
-class GladeFile
-{
+class GladeFile {
public:
static Glib::RefPtr<Gnome::Glade::Xml> open(const std::string& base_name) {
Glib::RefPtr<Gnome::Glade::Xml> xml;
@@ -52,4 +50,4 @@ public:
}
};
-#endif //GLADEFILE_HPP
+#endif // GLADEFILE_HPP
diff --git a/src/JackSettingsDialog.hpp b/src/JackSettingsDialog.hpp
index 1acb191..b419d89 100644
--- a/src/JackSettingsDialog.hpp
+++ b/src/JackSettingsDialog.hpp
@@ -45,7 +45,7 @@ public:
private:
void on_cancel() { hide(); }
- string current_jack_command() {
+ std::string current_jack_command() {
std::string result;
const char* const home = getenv("HOME");
@@ -65,7 +65,7 @@ private:
hide();
const char* const home = getenv("HOME");
if (home) {
- string jackdrc_path(home);
+ std::string jackdrc_path(home);
jackdrc_path += "/.jackdrc";
std::ofstream jackdrc(jackdrc_path.c_str());
@@ -74,7 +74,6 @@ private:
}
}
-
Gtk::Entry* _command_entry;
Gtk::Button* _cancel_but;
Gtk::Button* _ok_but;
diff --git a/src/LashDriver.hpp b/src/LashDriver.hpp
index 225c72f..4cca58d 100644
--- a/src/LashDriver.hpp
+++ b/src/LashDriver.hpp
@@ -24,8 +24,7 @@
class Patchage;
-class LashDriver : public Driver
-{
+class LashDriver : public Driver {
public:
LashDriver(Patchage* app, int argc, char** argv);
~LashDriver();
diff --git a/src/Patchage.hpp b/src/Patchage.hpp
index 752510b..bbf6854 100644
--- a/src/Patchage.hpp
+++ b/src/Patchage.hpp
@@ -32,9 +32,7 @@ class LashDriver;
class StateManager;
class JackSettingsDialog;
-
-class Patchage
-{
+class Patchage {
public:
Patchage(int argc, char** argv);
~Patchage();
diff --git a/src/PatchageCanvas.hpp b/src/PatchageCanvas.hpp
index 9661666..d904581 100644
--- a/src/PatchageCanvas.hpp
+++ b/src/PatchageCanvas.hpp
@@ -33,8 +33,7 @@ class PatchagePort;
using std::string;
using namespace FlowCanvas;
-class PatchageCanvas : public Canvas
-{
+class PatchageCanvas : public Canvas {
public:
PatchageCanvas(Patchage* _app, int width, int height);
diff --git a/src/PatchageModule.hpp b/src/PatchageModule.hpp
index fc314c1..f046267 100644
--- a/src/PatchageModule.hpp
+++ b/src/PatchageModule.hpp
@@ -29,17 +29,15 @@
#include "StateManager.hpp"
#include "PatchagePort.hpp"
-using std::string; using std::list;
-
using namespace FlowCanvas;
class PatchageModule : public Module
{
public:
- PatchageModule(Patchage* app, const string& title, ModuleType type, double x=0, double y=0)
- : Module(app->canvas(), title, x, y),
- _app(app),
- _type(type)
+ PatchageModule(Patchage* app, const std::string& title, ModuleType type, double x=0, double y=0)
+ : Module(app->canvas(), title, x, y)
+ , _app(app)
+ , _type(type)
{
_menu = new Gtk::Menu();
Gtk::Menu::MenuList& items = _menu->items();
@@ -56,24 +54,6 @@ public:
virtual ~PatchageModule() { delete _menu; }
- /*virtual void add_patchage_port(const string& port_name, bool is_input, PortType type)
- {
- new PatchagePort(this, type, port_name, is_input, _app->state_manager()->get_port_color(type));
-
- resize();
- }
-
- virtual void add_patchage_port(const string& port_name, bool is_input, PortType type, const snd_seq_addr_t addr)
- {
- PatchagePort* port = new PatchagePort(this, type, port_name, is_input,
- _app->state_manager()->get_port_color(type));
-
- port->alsa_addr(addr);
-
- resize();
- }*/
-
-
virtual void load_location() {
boost::shared_ptr<Canvas> canvas = _canvas.lock();
if (!canvas)
@@ -81,8 +61,6 @@ public:
Coord loc = _app->state_manager()->get_module_location(_name, _type);
- //cerr << "******" << _name << " MOVING TO (" << loc.x << "," << loc.y << ")" << endl;
-
if (loc.x != -1)
move_to(loc.x, loc.y);
else
diff --git a/src/PatchagePort.hpp b/src/PatchagePort.hpp
index 1fabe65..82efe3e 100644
--- a/src/PatchagePort.hpp
+++ b/src/PatchagePort.hpp
@@ -20,18 +20,15 @@
#include CONFIG_H_PATH
#include <string>
-#include <list>
#include <boost/shared_ptr.hpp>
#include <flowcanvas/Port.hpp>
#include <flowcanvas/Module.hpp>
-
#ifdef HAVE_ALSA
#include <alsa/asoundlib.h>
#endif
using namespace FlowCanvas;
-using std::string; using std::list;
enum PortType { JACK_AUDIO, JACK_MIDI, ALSA_MIDI };
@@ -43,9 +40,9 @@ enum PortType { JACK_AUDIO, JACK_MIDI, ALSA_MIDI };
class PatchagePort : public FlowCanvas::Port
{
public:
- PatchagePort(boost::shared_ptr<Module> module, PortType type, const string& name, bool is_input, int color)
- : Port(module, name, is_input, color),
- _type(type)
+ PatchagePort(boost::shared_ptr<Module> module, PortType type, const std::string& name, bool is_input, int color)
+ : Port(module, name, is_input, color)
+ , _type(type)
{
#ifdef HAVE_ALSA
_alsa_addr.client = '\0';
@@ -58,11 +55,11 @@ public:
#ifdef HAVE_ALSA
// FIXME: This driver specific crap really needs to go
void alsa_addr(const snd_seq_addr_t addr) { _alsa_addr = addr; }
- const snd_seq_addr_t* alsa_addr() const
- { return (_type == ALSA_MIDI) ? &_alsa_addr : NULL; }
+ const snd_seq_addr_t* alsa_addr() const { return (_type == ALSA_MIDI) ? &_alsa_addr : NULL; }
#endif
+
/** Returns the full name of this port, as "modulename:portname" */
- string full_name() const { return _module.lock()->name() + ":" + _name; }
+ std::string full_name() const { return _module.lock()->name() + ":" + _name; }
PortType type() const { return _type; }
diff --git a/src/StateManager.hpp b/src/StateManager.hpp
index 71d6bdd..63b47ec 100644
--- a/src/StateManager.hpp
+++ b/src/StateManager.hpp
@@ -24,34 +24,22 @@
#include <iostream>
#include "PatchagePort.hpp"
-using std::string; using std::list; using std::map;
-
-
enum ModuleType { Input, Output, InputOutput };
struct Coord { double x; double y; };
-// This should probably be moved out in to a seperate class/file....
-typedef struct ModuleLocation
-{
- string name;
- ModuleType type; // for distinguishing terminal modules (input or output)
- Coord loc;
-};
-
-
class StateManager
{
public:
StateManager();
- void load(const string& filename);
- void save(const string& filename);
+ void load(const std::string& filename);
+ void save(const std::string& filename);
- Coord get_module_location(const string& name, ModuleType type);
- void set_module_location(const string& name, ModuleType type, Coord loc);
+ Coord get_module_location(const std::string& name, ModuleType type);
+ void set_module_location(const std::string& name, ModuleType type, Coord loc);
- void set_module_split(const string& name, bool split);
- bool get_module_split(const string& name, bool default_val) const;
+ void set_module_split(const std::string& name, bool split);
+ bool get_module_split(const std::string& name, bool default_val) const;
float get_zoom();
void set_zoom(float zoom);
@@ -59,9 +47,15 @@ public:
int get_port_color(PortType type);
private:
- list<ModuleLocation> _module_locations;
- map<string,bool> _module_splits;
- float _zoom;
+ struct ModuleLocation {
+ std::string name;
+ ModuleType type; // for distinguishing terminal modules (input or output)
+ Coord loc;
+ };
+
+ std::list<ModuleLocation> _module_locations;
+ std::map<std::string,bool> _module_splits;
+ float _zoom;
};