diff options
author | David Robillard <d@drobilla.net> | 2007-12-20 00:52:10 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-12-20 00:52:10 +0000 |
commit | 46452c287cdc4b12c30589a8f877f3ab7359265b (patch) | |
tree | 4c8a51dccba7ecdefd1a2fc17fea17119612b3a7 /src/StateManager.cpp | |
parent | 5ac95692d1b48aabdac324e57378e7a7da9becd9 (diff) | |
download | patchage-46452c287cdc4b12c30589a8f877f3ab7359265b.tar.gz patchage-46452c287cdc4b12c30589a8f877f3ab7359265b.tar.bz2 patchage-46452c287cdc4b12c30589a8f877f3ab7359265b.zip |
Use fancy GladeFile class.
Remove silly Patchage-as-window-manager crap.
Less LOC.
git-svn-id: http://svn.drobilla.net/lad/patchage@988 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/StateManager.cpp')
-rw-r--r-- | src/StateManager.cpp | 61 |
1 files changed, 13 insertions, 48 deletions
diff --git a/src/StateManager.cpp b/src/StateManager.cpp index 22fdb9a..86fe07c 100644 --- a/src/StateManager.cpp +++ b/src/StateManager.cpp @@ -27,10 +27,6 @@ using namespace std; StateManager::StateManager() { - _window_location.x = 0; - _window_location.y = 0; - _window_size.x = 640; - _window_size.y = 480; _zoom = 1.0; } @@ -104,23 +100,22 @@ StateManager::load(const string& filename) } string s; - - is >> s; - if (s != "window_location") throw std::runtime_error("Corrupt settings file."); is >> s; - _window_location.x = atoi(s.c_str()); - is >> s; - _window_location.y = atoi(s.c_str()); - is >> s; - if (s != "window_size") throw std::runtime_error("Corrupt settings file."); - is >> s; - _window_size.x = atoi(s.c_str()); - is >> s; - _window_size.y = atoi(s.c_str()); + if (s == "window_location") { + is >> s; is >> s; is >> s;// skip + } + + if (s == "window_size") { + is >> s; is >> s; is >> s;// skip + } - is >> s; - if (s != "zoom_level") throw std::runtime_error("Corrupt settings file."); + if (s != "zoom_level") { + std::string msg = "Corrupt settings file: expected \"zoom_level\", found \""; + msg.append(s).append("\""); + throw std::runtime_error(msg); + } + is >> s; _zoom = atof(s.c_str()); @@ -170,8 +165,6 @@ StateManager::save(const string& filename) std::ofstream os; os.open(filename.c_str(), std::ios::out); - os << "window_location " << _window_location.x << " " << _window_location.y << std::endl; - os << "window_size " << _window_size.x << " " << _window_size.y << std::endl; os << "zoom_level " << _zoom << std::endl; ModuleLocation ml; @@ -191,34 +184,6 @@ StateManager::save(const string& filename) } -Coord -StateManager::get_window_location() -{ - return _window_location; -} - - -void -StateManager::set_window_location(Coord loc) -{ - _window_location = loc; -} - - -Coord -StateManager::get_window_size() -{ - return _window_size; -} - - -void -StateManager::set_window_size(Coord size) -{ - _window_size = size; -} - - float StateManager::get_zoom() { |