Quit when requested from the menu
[ladish.git] / gui / StateManager.hpp
blobbc9edb859950dcee10c47e56173a739c0ab96a7d
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
7 **************************************************************************
8 * This file contains interface of the StateManager class
9 **************************************************************************
11 * LADI Session Handler is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * LADI Session Handler is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
23 * or write to the Free Software Foundation, Inc.,
24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
27 #ifndef PATCHAGE_STATEMANAGER_HPP
28 #define PATCHAGE_STATEMANAGER_HPP
30 #include "common.h"
31 #include "PatchagePort.hpp"
32 #include <map>
34 struct Coord {
35 Coord(double x_=0, double y_=0) : x(x_), y(y_) {}
36 double x;
37 double y;
40 class StateManager
42 public:
43 StateManager();
45 void load(const std::string& filename);
46 void save(const std::string& filename);
48 bool get_module_location(const std::string& name, ModuleType type, Coord& loc);
49 void set_module_location(const std::string& name, ModuleType type, Coord loc);
51 void set_module_split(const std::string& name, bool split);
52 bool get_module_split(const std::string& name, bool default_val) const;
54 float get_zoom();
55 void set_zoom(float zoom);
57 int get_port_color(PortType type);
59 Coord get_window_location() { return _window_location; }
60 void set_window_location(Coord loc) { _window_location = loc; }
61 Coord get_window_size() { return _window_size; }
62 void set_window_size(Coord size) { _window_size = size; }
64 private:
65 struct ModuleSettings {
66 ModuleSettings() : split(false) {}
67 bool split;
68 boost::optional<Coord> input_location;
69 boost::optional<Coord> output_location;
70 boost::optional<Coord> inout_location;
73 std::map<std::string,ModuleSettings> _module_settings;
74 Coord _window_location;
75 Coord _window_size;
76 float _zoom;
80 #endif // PATCHAGE_STATEMANAGER_HPP