summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-03-30 23:41:21 +0000
committerDavid Robillard <d@drobilla.net>2014-03-30 23:41:21 +0000
commit59780bd8f9abf376a79ee192325ae868df7d1b5a (patch)
tree5959bf08a7eea9461659b2714053dd0daead04f6 /src
parent77448bc7507c26b964a9159fa1e4035487ccc326 (diff)
downloadpatchage-59780bd8f9abf376a79ee192325ae868df7d1b5a.tar.gz
patchage-59780bd8f9abf376a79ee192325ae868df7d1b5a.tar.bz2
patchage-59780bd8f9abf376a79ee192325ae868df7d1b5a.zip
StateManager => Configuration.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@5348 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/AlsaDriver.cpp8
-rw-r--r--src/Configuration.cpp (renamed from src/StateManager.cpp)22
-rw-r--r--src/Configuration.hpp (renamed from src/StateManager.hpp)10
-rw-r--r--src/JackDriver.cpp9
-rw-r--r--src/Patchage.cpp28
-rw-r--r--src/Patchage.hpp12
-rw-r--r--src/PatchageCanvas.hpp1
-rw-r--r--src/PatchageModule.cpp8
-rw-r--r--src/PatchageModule.hpp2
-rw-r--r--src/PatchagePort.hpp4
10 files changed, 51 insertions, 53 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index d894883..b4b43d7 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -268,11 +268,11 @@ AlsaDriver::create_port_view_internal(
bool split = false;
if (is_duplex) {
split = true;
- if (!_app->state_manager()->get_module_split(client_name, !is_application)) {
- _app->state_manager()->set_module_split(client_name, true);
+ if (!_app->configuration()->get_module_split(client_name, !is_application)) {
+ _app->configuration()->set_module_split(client_name, true);
}
} else {
- split = _app->state_manager()->get_module_split(client_name, !is_application);
+ split = _app->configuration()->get_module_split(client_name, !is_application);
}
/*cout << "ALSA PORT: " << client_name << " : " << port_name
@@ -312,7 +312,7 @@ AlsaDriver::create_port(PatchageModule& parent,
{
PatchagePort* ret = new PatchagePort(
parent, ALSA_MIDI, name, is_input,
- _app->state_manager()->get_port_color(ALSA_MIDI));
+ _app->configuration()->get_port_color(ALSA_MIDI));
dynamic_cast<PatchageCanvas*>(parent.canvas())->index_port(
PortID(addr, is_input), ret);
diff --git a/src/StateManager.cpp b/src/Configuration.cpp
index 62d9ea7..ae621cb 100644
--- a/src/StateManager.cpp
+++ b/src/Configuration.cpp
@@ -23,10 +23,10 @@
#include <stdexcept>
#include <vector>
-#include "StateManager.hpp"
+#include "Configuration.hpp"
#include "Patchage.hpp"
-StateManager::StateManager()
+Configuration::Configuration()
: _window_location(0, 0)
, _window_size(640, 480)
, _zoom(1.0)
@@ -34,7 +34,7 @@ StateManager::StateManager()
}
bool
-StateManager::get_module_location(const std::string& name, ModuleType type, Coord& loc)
+Configuration::get_module_location(const std::string& name, ModuleType type, Coord& loc)
{
std::map<std::string, ModuleSettings>::const_iterator i = _module_settings.find(name);
if (i == _module_settings.end()) {
@@ -56,7 +56,7 @@ StateManager::get_module_location(const std::string& name, ModuleType type, Coor
}
void
-StateManager::set_module_location(const std::string& name, ModuleType type, Coord loc)
+Configuration::set_module_location(const std::string& name, ModuleType type, Coord loc)
{
std::map<std::string, ModuleSettings>::iterator i = _module_settings.find(name);
if (i == _module_settings.end()) {
@@ -86,7 +86,7 @@ StateManager::set_module_location(const std::string& name, ModuleType type, Coor
* to allow driver's to request terminal ports get split by default).
*/
bool
-StateManager::get_module_split(const std::string& name, bool default_val) const
+Configuration::get_module_split(const std::string& name, bool default_val) const
{
std::map<std::string, ModuleSettings>::const_iterator i = _module_settings.find(name);
if (i == _module_settings.end()) {
@@ -97,7 +97,7 @@ StateManager::get_module_split(const std::string& name, bool default_val) const
}
void
-StateManager::set_module_split(const std::string& name, bool split)
+Configuration::set_module_split(const std::string& name, bool split)
{
_module_settings[name].split = split;
}
@@ -131,7 +131,7 @@ get_filenames()
}
void
-StateManager::load()
+Configuration::load()
{
// Try to find a readable configuration file
const std::vector<std::string> filenames = get_filenames();
@@ -219,7 +219,7 @@ write_module_position(std::ofstream& os,
}
void
-StateManager::save()
+Configuration::save()
{
// Try to find a writable configuration file
const std::vector<std::string> filenames = get_filenames();
@@ -262,19 +262,19 @@ StateManager::save()
}
float
-StateManager::get_zoom()
+Configuration::get_zoom()
{
return _zoom;
}
void
-StateManager::set_zoom(float zoom)
+Configuration::set_zoom(float zoom)
{
_zoom = zoom;
}
int
-StateManager::get_port_color(PortType type)
+Configuration::get_port_color(PortType type)
{
// Darkest tango palette colour, with S -= 6, V -= 6, w/ transparency
diff --git a/src/StateManager.hpp b/src/Configuration.hpp
index d8c1b4b..b169c34 100644
--- a/src/StateManager.hpp
+++ b/src/Configuration.hpp
@@ -14,8 +14,8 @@
* along with Patchage. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef PATCHAGE_STATEMANAGER_HPP
-#define PATCHAGE_STATEMANAGER_HPP
+#ifndef PATCHAGE_CONFIGURATION_HPP
+#define PATCHAGE_CONFIGURATION_HPP
#include <string>
#include <list>
@@ -33,10 +33,10 @@ struct Coord {
double y;
};
-class StateManager
+class Configuration
{
public:
- StateManager();
+ Configuration();
void load();
void save();
@@ -73,4 +73,4 @@ private:
float _zoom;
};
-#endif // PATCHAGE_STATEMANAGER_HPP
+#endif // PATCHAGE_CONFIGURATION_HPP
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp
index b8ea2a4..9638ace 100644
--- a/src/JackDriver.cpp
+++ b/src/JackDriver.cpp
@@ -147,7 +147,7 @@ JackDriver::create_port_view(Patchage* patchage,
port_names(id, module_name, port_name);
ModuleType type = InputOutput;
- if (_app->state_manager()->get_module_split(
+ if (_app->configuration()->get_module_split(
module_name, (jack_flags & JackPortIsTerminal))) {
if (jack_flags & JackPortIsInput) {
type = Input;
@@ -194,7 +194,7 @@ JackDriver::create_port(PatchageModule& parent, jack_port_t* port, PortID id)
PatchagePort* ret(
new PatchagePort(parent, port_type, jack_port_short_name(port),
(jack_port_flags(port) & JackPortIsInput),
- _app->state_manager()->get_port_color(port_type)));
+ _app->configuration()->get_port_color(port_type)));
if (id.type != PortID::NULL_PORT_ID) {
dynamic_cast<PatchageCanvas*>(parent.canvas())->index_port(id, ret);
@@ -248,8 +248,9 @@ JackDriver::refresh()
client1_name = client1_name.substr(0, client1_name.find(":"));
ModuleType type = InputOutput;
- if (_app->state_manager()->get_module_split(client1_name,
- (jack_port_flags(port) & JackPortIsTerminal))) {
+ if (_app->configuration()->get_module_split(
+ client1_name,
+ (jack_port_flags(port) & JackPortIsTerminal))) {
if (jack_port_flags(port) & JackPortIsInput) {
type = Input;
} else {
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 4531cad..cb2bbda 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -39,7 +39,7 @@
#include "Patchage.hpp"
#include "PatchageCanvas.hpp"
#include "PatchageEvent.hpp"
-#include "StateManager.hpp"
+#include "Configuration.hpp"
#if defined(HAVE_JACK_DBUS)
#include "JackDbusDriver.hpp"
@@ -82,7 +82,7 @@ Patchage::Patchage(int argc, char** argv)
, _alsa_driver(NULL)
#endif
, _jack_driver(NULL)
- , _state_manager(NULL)
+ , _configuration(NULL)
, INIT_WIDGET(_about_win)
, INIT_WIDGET(_main_scrolledwin)
, INIT_WIDGET(_main_win)
@@ -119,7 +119,7 @@ Patchage::Patchage(int argc, char** argv)
, _alsa_driver_autoattach(true)
#endif
{
- _state_manager = new StateManager();
+ _configuration = new Configuration();
_canvas = boost::shared_ptr<PatchageCanvas>(new PatchageCanvas(this, 1600*2, 1200*2));
while (argc > 0) {
@@ -220,15 +220,15 @@ Patchage::Patchage(int argc, char** argv)
_canvas->widget().show();
_main_win->present();
- _state_manager->load();
+ _configuration->load();
_main_win->resize(
- static_cast<int>(_state_manager->get_window_size().x),
- static_cast<int>(_state_manager->get_window_size().y));
+ static_cast<int>(_configuration->get_window_size().x),
+ static_cast<int>(_configuration->get_window_size().y));
_main_win->move(
- static_cast<int>(_state_manager->get_window_location().x),
- static_cast<int>(_state_manager->get_window_location().y));
+ static_cast<int>(_configuration->get_window_location().x),
+ static_cast<int>(_configuration->get_window_location().y));
_about_win->set_transient_for(*_main_win);
@@ -272,7 +272,7 @@ Patchage::Patchage(int argc, char** argv)
Patchage::~Patchage()
{
store_window_location();
- _state_manager->save();
+ _configuration->save();
#if defined(PATCHAGE_LIBJACK) || defined(HAVE_JACK_DBUS)
delete _jack_driver;
@@ -281,7 +281,7 @@ Patchage::~Patchage()
delete _alsa_driver;
#endif
- delete _state_manager;
+ delete _configuration;
_about_win.destroy();
_messages_win.destroy();
@@ -355,7 +355,7 @@ Patchage::idle_callback()
void
Patchage::zoom(double z)
{
- _state_manager->set_zoom(z);
+ _configuration->set_zoom(z);
_canvas->set_zoom(z);
}
@@ -377,8 +377,6 @@ Patchage::refresh()
}
}
-/** Update the stored window location and size in the StateManager (in memory).
- */
void
Patchage::store_window_location()
{
@@ -391,8 +389,8 @@ Patchage::store_window_location()
Coord window_size;
window_size.x = size_x;
window_size.y = size_y;
- _state_manager->set_window_location(window_location);
- _state_manager->set_window_size(window_size);
+ _configuration->set_window_location(window_location);
+ _configuration->set_window_size(window_size);
}
void
diff --git a/src/Patchage.hpp b/src/Patchage.hpp
index ece59b0..e78c511 100644
--- a/src/Patchage.hpp
+++ b/src/Patchage.hpp
@@ -44,7 +44,7 @@
class AlsaDriver;
class JackDriver;
class PatchageCanvas;
-class StateManager;
+class Configuration;
namespace Ganv { class Module; }
@@ -57,10 +57,10 @@ public:
Gtk::Window* window() { return _main_win.get(); }
- StateManager* state_manager() const { return _state_manager; }
- JackDriver* jack_driver() const { return _jack_driver; }
+ Configuration* configuration() const { return _configuration; }
+ JackDriver* jack_driver() const { return _jack_driver; }
#ifdef HAVE_ALSA
- AlsaDriver* alsa_driver() const { return _alsa_driver; }
+ AlsaDriver* alsa_driver() const { return _alsa_driver; }
#endif
#ifdef PATCHAGE_JACK_SESSION
void show_open_session_dialog();
@@ -124,8 +124,8 @@ protected:
boost::shared_ptr<PatchageCanvas> _canvas;
- JackDriver* _jack_driver;
- StateManager* _state_manager;
+ JackDriver* _jack_driver;
+ Configuration* _configuration;
Gtk::Main* _gtk_main;
diff --git a/src/PatchageCanvas.hpp b/src/PatchageCanvas.hpp
index 6f1a88b..078bc63 100644
--- a/src/PatchageCanvas.hpp
+++ b/src/PatchageCanvas.hpp
@@ -31,7 +31,6 @@
#include "PatchageEvent.hpp"
#include "PatchageModule.hpp"
#include "PortID.hpp"
-#include "StateManager.hpp"
class Patchage;
class PatchageModule;
diff --git a/src/PatchageModule.cpp b/src/PatchageModule.cpp
index 3c16352..0d2d77b 100644
--- a/src/PatchageModule.cpp
+++ b/src/PatchageModule.cpp
@@ -106,7 +106,7 @@ PatchageModule::load_location()
{
Coord loc;
- if (_app->state_manager()->get_module_location(_name, _type, loc))
+ if (_app->configuration()->get_module_location(_name, _type, loc))
move_to(loc.x, loc.y);
else
move_to(20 + rand() % 640,
@@ -117,14 +117,14 @@ void
PatchageModule::store_location(double x, double y)
{
Coord loc(get_x(), get_y());
- _app->state_manager()->set_module_location(_name, _type, loc);
+ _app->configuration()->set_module_location(_name, _type, loc);
}
void
PatchageModule::split()
{
assert(_type == InputOutput);
- _app->state_manager()->set_module_split(_name, true);
+ _app->configuration()->set_module_split(_name, true);
_app->refresh();
}
@@ -132,7 +132,7 @@ void
PatchageModule::join()
{
assert(_type != InputOutput);
- _app->state_manager()->set_module_split(_name, false);
+ _app->configuration()->set_module_split(_name, false);
_app->refresh();
}
diff --git a/src/PatchageModule.hpp b/src/PatchageModule.hpp
index c46cc2c..67e80d1 100644
--- a/src/PatchageModule.hpp
+++ b/src/PatchageModule.hpp
@@ -24,7 +24,7 @@
#include "ganv/Module.hpp"
#include "ganv/Port.hpp"
-#include "StateManager.hpp"
+#include "Configuration.hpp"
class Patchage;
class PatchagePort;
diff --git a/src/PatchagePort.hpp b/src/PatchagePort.hpp
index 24617f9..0ddbc6e 100644
--- a/src/PatchagePort.hpp
+++ b/src/PatchagePort.hpp
@@ -27,10 +27,10 @@
#include "ganv/Port.hpp"
#include "ganv/Module.hpp"
-#include "patchage_config.h"
+#include "Configuration.hpp"
#include "PatchageCanvas.hpp"
#include "PortID.hpp"
-#include "StateManager.hpp"
+#include "patchage_config.h"
/** A Port on a PatchageModule
*/