summaryrefslogtreecommitdiffstats
path: root/src/Configuration.hpp
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/Configuration.hpp
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/Configuration.hpp')
-rw-r--r--src/Configuration.hpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/Configuration.hpp b/src/Configuration.hpp
new file mode 100644
index 0000000..b169c34
--- /dev/null
+++ b/src/Configuration.hpp
@@ -0,0 +1,76 @@
+/* This file is part of Patchage.
+ * Copyright 2007-2013 David Robillard <http://drobilla.net>
+ *
+ * Patchage is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Patchage. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PATCHAGE_CONFIGURATION_HPP
+#define PATCHAGE_CONFIGURATION_HPP
+
+#include <string>
+#include <list>
+#include <map>
+
+#include <boost/optional.hpp>
+
+enum ModuleType { Input, Output, InputOutput };
+
+enum PortType { JACK_AUDIO, JACK_MIDI, ALSA_MIDI };
+
+struct Coord {
+ Coord(double x_=0, double y_=0) : x(x_), y(y_) {}
+ double x;
+ double y;
+};
+
+class Configuration
+{
+public:
+ Configuration();
+
+ void load();
+ void save();
+
+ bool get_module_location(const std::string& name, ModuleType type, Coord& loc);
+ void set_module_location(const std::string& name, ModuleType type, Coord loc);
+
+ 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);
+
+ int get_port_color(PortType type);
+
+ Coord get_window_location() { return _window_location; }
+ void set_window_location(Coord loc) { _window_location = loc; }
+ Coord get_window_size() { return _window_size; }
+ void set_window_size(Coord size) { _window_size = size; }
+
+private:
+ struct ModuleSettings {
+ ModuleSettings(bool s=false) : split(s) {}
+ boost::optional<Coord> input_location;
+ boost::optional<Coord> output_location;
+ boost::optional<Coord> inout_location;
+ bool split;
+ };
+
+ std::map<std::string, ModuleSettings> _module_settings;
+
+ Coord _window_location;
+ Coord _window_size;
+ float _zoom;
+};
+
+#endif // PATCHAGE_CONFIGURATION_HPP