source: synfigstudio/trunk/fuentes/src/gui/keymapsettings.cpp @ 481

Last change on this file since 481 was 481, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 2.6 KB
Line 
1/* === S Y N F I G ========================================================= */
2/*!     \file keymapsettings.cpp
3**      \brief Contains Info for Key Map settings
4**
5**      $Id$
6**
7**      \legal
8**      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9**
10**      This package is free software; you can redistribute it and/or
11**      modify it under the terms of the GNU General Public License as
12**      published by the Free Software Foundation; either version 2 of
13**      the License, or (at your option) any later version.
14**
15**      This package is distributed in the hope that it will be useful,
16**      but WITHOUT ANY WARRANTY; without even the implied warranty of
17**      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18**      General Public License for more details.
19**      \endlegal
20*/
21/* ========================================================================= */
22
23/* === H E A D E R S ======================================================= */
24
25#ifdef USING_PCH
26#       include "pch.h"
27#else
28#ifdef HAVE_CONFIG_H
29#       include <config.h>
30#endif
31
32#include "keymapsettings.h"
33
34#include <gtkmm/accelkey.h>
35#include <gtkmm/accelmap.h>
36#include <gtk/gtk.h>
37
38#include "general.h"
39
40#endif
41
42/* === U S I N G =========================================================== */
43
44using namespace std;
45//using namespace etl;
46//using namespace synfig;
47using namespace studio;
48
49using namespace Gtk;
50//using namespace Gtk::Menu_Helpers;
51
52/* === M A C R O S ========================================================= */
53
54/* === G L O B A L S ======================================================= */
55
56/* === P R O C E D U R E S ================================================= */
57
58/* === M E T H O D S ======================================================= */
59
60/* === E N T R Y P O I N T ================================================= */
61
62// KeyMapSettings Definitions
63KeyMapSettings::KeyMapSettings():
64        unsaved()
65{ }
66
67KeyMapSettings::~KeyMapSettings()
68{ }
69
70bool KeyMapSettings::set_key(const char *path, guint key, Gdk::ModifierType mod, bool replace)
71{
72        if(gtk_accel_map_lookup_entry(path,NULL))
73        {
74                return AccelMap::change_entry(path,key,mod,replace);
75        }else
76        {
77                AccelMap::add_entry(path,key,mod);
78                return true;
79        }
80}
81
82bool KeyMapSettings::get_key(const char *path, Gtk::AccelKey *key)
83{
84        GtkAccelKey     ac;
85        if(gtk_accel_map_lookup_entry(path,&ac))
86        {
87                *key = AccelKey(ac.accel_key,(Gdk::ModifierType)ac.accel_mods,string(path));
88                return true;
89        }
90
91        return false;
92}
93
94bool KeyMapSettings::load(const char *filename)
95{
96        string n(filename);
97        n += ".skm";
98
99        AccelMap::load(filename);
100
101        return true;
102}
103
104bool KeyMapSettings::save(const char *filename)
105{
106        string n(filename);
107        n += ".skm";
108
109        AccelMap::save(filename);
110
111        return true;
112}
Note: See TracBrowser for help on using the repository browser.