2 Copyright (C) 2014 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "pbd/gstdio_compat.h"
23 #include "pbd/error.h"
24 #include "pbd/compose.h"
26 #include "gtkmm2ext/cursors.h"
30 using namespace Gtkmm2ext;
32 CursorInfo::Infos CursorInfo::infos;
34 CursorInfo::CursorInfo (const std::string& n, int hotspot_x, int hotspot_y)
42 CursorInfo::load_cursor_info (const std::string& path)
45 if (!g_file_get_contents (path.c_str(), &buf, NULL, NULL)) {
48 std::stringstream infofile (buf);
61 /* failing here is OK ... EOF */
77 infos[name] = new CursorInfo (name, x, y);
82 PBD::error << string_compose (_("cursor hotspots info file %1 has an error on line %2"), path, line_number) << endmsg;
91 CursorInfo::drop_cursor_info ()
97 CursorInfo::lookup_cursor_info (const std::string& name)
99 Infos::iterator i = infos.find (name);
101 if (i == infos.end()) {