2 * Copyright (C) 2014-2016 Paul Davis <paul@linuxaudiosystems.com>
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 along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "pbd/gstdio_compat.h"
22 #include "pbd/error.h"
23 #include "pbd/compose.h"
25 #include "gtkmm2ext/cursors.h"
29 using namespace Gtkmm2ext;
31 CursorInfo::Infos CursorInfo::infos;
33 CursorInfo::CursorInfo (const std::string& n, int hotspot_x, int hotspot_y)
41 CursorInfo::load_cursor_info (const std::string& path)
44 if (!g_file_get_contents (path.c_str(), &buf, NULL, NULL)) {
47 std::stringstream infofile (buf);
60 /* failing here is OK ... EOF */
76 infos[name] = new CursorInfo (name, x, y);
81 PBD::error << string_compose (_("cursor hotspots info file %1 has an error on line %2"), path, line_number) << endmsg;
90 CursorInfo::drop_cursor_info ()
96 CursorInfo::lookup_cursor_info (const std::string& name)
98 Infos::iterator i = infos.find (name);
100 if (i == infos.end()) {