2007-02-07 07:57:53 +02:00
|
|
|
/* This file is part of Patchage.
|
|
|
|
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
|
2006-06-09 05:18:57 +03:00
|
|
|
*
|
2006-10-02 23:56:28 +03:00
|
|
|
* Patchage is free software; you can redistribute it and/or modify it under the
|
2006-06-09 05:18:57 +03:00
|
|
|
* terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
2006-10-02 23:56:28 +03:00
|
|
|
* Patchage is distributed in the hope that it will be useful, but WITHOUT ANY
|
2006-06-09 05:18:57 +03:00
|
|
|
* 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 this program; if not, write to the Free Software Foundation, Inc.,
|
2007-04-06 07:29:27 +03:00
|
|
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-06-09 05:18:57 +03:00
|
|
|
*/
|
|
|
|
|
2008-03-16 19:08:02 +02:00
|
|
|
#ifndef PATCHAGE_STATEMANAGER_HPP
|
|
|
|
#define PATCHAGE_STATEMANAGER_HPP
|
2006-06-09 05:18:57 +03:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <list>
|
|
|
|
#include <map>
|
|
|
|
#include <iostream>
|
2008-08-02 23:42:23 +03:00
|
|
|
#include <boost/optional.hpp>
|
2007-07-24 22:26:47 +03:00
|
|
|
#include "PatchagePort.hpp"
|
2006-06-09 05:18:57 +03:00
|
|
|
|
|
|
|
enum ModuleType { Input, Output, InputOutput };
|
2008-08-02 23:12:58 +03:00
|
|
|
|
2008-08-02 23:42:23 +03:00
|
|
|
struct Coord {
|
|
|
|
Coord(double x_=0, double y_=0) : x(x_), y(y_) {}
|
2008-08-02 23:12:58 +03:00
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
};
|
2006-06-09 05:18:57 +03:00
|
|
|
|
|
|
|
class StateManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StateManager();
|
|
|
|
|
2008-01-02 06:14:26 +02:00
|
|
|
void load(const std::string& filename);
|
|
|
|
void save(const std::string& filename);
|
2006-06-09 05:18:57 +03:00
|
|
|
|
2008-08-02 23:12:58 +03:00
|
|
|
bool get_module_location(const std::string& name, ModuleType type, Coord& loc);
|
2008-01-02 06:14:26 +02:00
|
|
|
void set_module_location(const std::string& name, ModuleType type, Coord loc);
|
2006-06-09 05:18:57 +03:00
|
|
|
|
2008-01-02 06:14:26 +02:00
|
|
|
void set_module_split(const std::string& name, bool split);
|
|
|
|
bool get_module_split(const std::string& name, bool default_val) const;
|
2006-06-09 05:18:57 +03:00
|
|
|
|
|
|
|
float get_zoom();
|
|
|
|
void set_zoom(float zoom);
|
|
|
|
|
|
|
|
int get_port_color(PortType type);
|
|
|
|
|
2008-01-02 19:10:26 +02:00
|
|
|
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; }
|
|
|
|
|
2006-06-09 05:18:57 +03:00
|
|
|
private:
|
2008-08-02 23:12:58 +03:00
|
|
|
struct ModuleSettings {
|
2008-08-02 23:42:23 +03:00
|
|
|
ModuleSettings() : split(false) {}
|
2008-08-02 23:12:58 +03:00
|
|
|
bool split;
|
2008-08-02 23:42:23 +03:00
|
|
|
boost::optional<Coord> input_location;
|
|
|
|
boost::optional<Coord> output_location;
|
|
|
|
boost::optional<Coord> inout_location;
|
2008-01-02 06:14:26 +02:00
|
|
|
};
|
|
|
|
|
2008-08-02 23:12:58 +03:00
|
|
|
std::map<std::string,ModuleSettings> _module_settings;
|
2008-08-02 23:42:23 +03:00
|
|
|
Coord _window_location;
|
|
|
|
Coord _window_size;
|
|
|
|
float _zoom;
|
2006-06-09 05:18:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-16 19:08:02 +02:00
|
|
|
#endif // PATCHAGE_STATEMANAGER_HPP
|