From: mental Date: Thu, 6 Apr 2006 04:23:24 +0000 (+0000) Subject: share/keyboards -> share/keys; first shot at configurable keymaps X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=774e276493682c956dd97c376e07a270eb8b3d33;p=inkscape.git share/keyboards -> share/keys; first shot at configurable keymaps --- diff --git a/ChangeLog b/ChangeLog index c604ebde8..f57923f4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-04-05 MenTaLguY + + * configure.ac, share/keyboards/.cvsignore, share/keyboards/Makefile.am, + share/keyboards/README, share/keys/.cvsignore, share/keys/Makefile.am, + share/keys/Makefile.in, share/Makefile.am: + + share/keyboards -> share/keys + + * share/keys/Makefile.am, share/keys/default.xml, src/Makefile_insert, + src/shortcuts.cpp, src/shortcuts-default-xml.cpp: + + first shot at configurable keymaps + 2006-04-05 MenTaLguY * src/io/Makefile_insert, src/io/resource.cpp, src/io/resource.h: diff --git a/configure.ac b/configure.ac index 7a5802509..2160021ce 100644 --- a/configure.ac +++ b/configure.ac @@ -818,7 +818,7 @@ share/extensions/Makefile share/fonts/Makefile share/gradients/Makefile share/icons/Makefile -share/keyboards/Makefile +share/keys/Makefile share/markers/Makefile share/palettes/Makefile share/patterns/Makefile diff --git a/share/Makefile.am b/share/Makefile.am index c77be8161..f8f1dd53b 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = clipart \ fonts \ gradients \ icons \ - keyboards \ + keys \ markers \ palettes \ patterns \ diff --git a/share/keyboards/.cvsignore b/share/keyboards/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/share/keyboards/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/share/keyboards/Makefile.am b/share/keyboards/Makefile.am deleted file mode 100644 index bd4a760d1..000000000 --- a/share/keyboards/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ - -keyboardsdir = $(datadir)/inkscape/keyboards - -keyboards_DATA = \ - README - -EXTRA_DIST = $(keyboards_DATA) diff --git a/share/keyboards/README b/share/keyboards/README deleted file mode 100644 index 0dd74cf49..000000000 --- a/share/keyboards/README +++ /dev/null @@ -1,5 +0,0 @@ -This new folder is part of the Inkscape 0.38 directory reorganization. Please place the appropriate files into this folder. - -Thank You! - -Inkscape Developers diff --git a/share/keys/.cvsignore b/share/keys/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/share/keys/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/share/keys/Makefile.am b/share/keys/Makefile.am new file mode 100644 index 000000000..1c595550b --- /dev/null +++ b/share/keys/Makefile.am @@ -0,0 +1,7 @@ + +keysdir = $(datadir)/inkscape/keys + +keys_DATA = default.xml + +EXTRA_DIST = $(keys_DATA) + diff --git a/share/keys/Makefile.in b/share/keys/Makefile.in new file mode 100644 index 000000000..293ca47ef --- /dev/null +++ b/share/keys/Makefile.in @@ -0,0 +1,397 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_CONFIG = @FREETYPE_CONFIG@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GNOME_PRINT_CFLAGS = @GNOME_PRINT_CFLAGS@ +GNOME_PRINT_LIBS = @GNOME_PRINT_LIBS@ +GNOME_VFS_CFLAGS = @GNOME_VFS_CFLAGS@ +GNOME_VFS_LIBS = @GNOME_VFS_LIBS@ +INKJAR_FALSE = @INKJAR_FALSE@ +INKJAR_TRUE = @INKJAR_TRUE@ +INKSCAPE_CFLAGS = @INKSCAPE_CFLAGS@ +INKSCAPE_DATADIR = @INKSCAPE_DATADIR@ +INKSCAPE_LIBDIR = @INKSCAPE_LIBDIR@ +INKSCAPE_LIBS = @INKSCAPE_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_ICONV = @INTLTOOL_ICONV@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_MSGFMT = @INTLTOOL_MSGFMT@ +INTLTOOL_MSGMERGE = @INTLTOOL_MSGMERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XGETTEXT = @INTLTOOL_XGETTEXT@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ +LCMS_CFLAGS = @LCMS_CFLAGS@ +LCMS_LIBS = @LCMS_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBLOUDMOUTH_CFLAGS = @LIBLOUDMOUTH_CFLAGS@ +LIBLOUDMOUTH_LIBS = @LIBLOUDMOUTH_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +OS_WIN32_FALSE = @OS_WIN32_FALSE@ +OS_WIN32_TRUE = @OS_WIN32_TRUE@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_LOCALE_DIR = @PACKAGE_LOCALE_DIR@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@ +PANGOFT2_LIBS = @PANGOFT2_LIBS@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL_CFLAGS = @PERL_CFLAGS@ +PERL_LIBS = @PERL_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POW_LIB = @POW_LIB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_LIBS = @PYTHON_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_GNOME_PRINT_FALSE = @USE_GNOME_PRINT_FALSE@ +USE_GNOME_PRINT_TRUE = @USE_GNOME_PRINT_TRUE@ +USE_GNOME_VFS_FALSE = @USE_GNOME_VFS_FALSE@ +USE_GNOME_VFS_TRUE = @USE_GNOME_VFS_TRUE@ +USE_LCMS_FALSE = @USE_LCMS_FALSE@ +USE_LCMS_TRUE = @USE_LCMS_TRUE@ +USE_MMX_FALSE = @USE_MMX_FALSE@ +USE_MMX_TRUE = @USE_MMX_TRUE@ +USE_NLS = @USE_NLS@ +USE_XFT_FALSE = @USE_XFT_FALSE@ +USE_XFT_TRUE = @USE_XFT_TRUE@ +VERSION = @VERSION@ +WITH_INKBOARD_FALSE = @WITH_INKBOARD_FALSE@ +WITH_INKBOARD_TRUE = @WITH_INKBOARD_TRUE@ +WITH_PERL_FALSE = @WITH_PERL_FALSE@ +WITH_PERL_TRUE = @WITH_PERL_TRUE@ +WITH_PYTHON_FALSE = @WITH_PYTHON_FALSE@ +WITH_PYTHON_TRUE = @WITH_PYTHON_TRUE@ +XFT_CFLAGS = @XFT_CFLAGS@ +XFT_LIBS = @XFT_LIBS@ +XGETTEXT = @XGETTEXT@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +keysdir = $(datadir)/inkscape/keys + +keys_DATA = default.xml + +EXTRA_DIST = $(keys_DATA) +subdir = share/keys +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DATA = $(keys_DATA) + +DIST_COMMON = $(srcdir)/Makefile.in Makefile.am +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu share/keys/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +keysDATA_INSTALL = $(INSTALL_DATA) +install-keysDATA: $(keys_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(keysdir) + @list='$(keys_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(keysDATA_INSTALL) $$d$$p $(DESTDIR)$(keysdir)/$$f"; \ + $(keysDATA_INSTALL) $$d$$p $(DESTDIR)$(keysdir)/$$f; \ + done + +uninstall-keysDATA: + @$(NORMAL_UNINSTALL) + @list='$(keys_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(keysdir)/$$f"; \ + rm -f $(DESTDIR)$(keysdir)/$$f; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(keysdir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-keysDATA + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-keysDATA + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-keysDATA install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am uninstall-keysDATA + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/share/keys/default.xml b/share/keys/default.xml new file mode 100644 index 000000000..a273f8660 --- /dev/null +++ b/share/keys/default.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Makefile_insert b/src/Makefile_insert index 31f57f33b..e09b69ffc 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -120,7 +120,6 @@ libinkpre_a_SOURCES = \ selection.cpp selection.h \ seltrans-handles.cpp seltrans-handles.h \ seltrans.cpp seltrans.h \ - shortcuts-default-xml.cpp \ shortcuts.cpp shortcuts.h \ slideshow.cpp slideshow.h \ snap.cpp snap.h \ diff --git a/src/shortcuts-default-xml.cpp b/src/shortcuts-default-xml.cpp deleted file mode 100644 index 56b31ceb6..000000000 --- a/src/shortcuts-default-xml.cpp +++ /dev/null @@ -1,243 +0,0 @@ -extern char const shortcuts_default_xml[]= -"\n" -"\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -""; diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index 047928071..7061df77a 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -22,10 +22,14 @@ # include "config.h" #endif +#include + #include #include #include "helper/action.h" +#include "io/sys.h" +#include "io/resource.h" #include "shortcuts.h" #include "verbs.h" #include "xml/node-iterators.h" @@ -34,8 +38,8 @@ using namespace Inkscape; static void sp_shortcut_set(unsigned int const shortcut, Inkscape::Verb *const verb, bool const is_primary); - -static void set_shortcuts_xml(XML::Document const *doc); +static void try_shortcuts_file(char const *filename); +static void read_shortcuts_file(char const *filename); /* Returns true if action was performed */ @@ -56,24 +60,37 @@ sp_shortcut_invoke(unsigned int shortcut, Inkscape::UI::View::View *view) static GHashTable *verbs = NULL; static GHashTable *primary_shortcuts = NULL; -extern char const shortcuts_default_xml[]; - static void sp_shortcut_init() { + using Inkscape::IO::Resource::get_path; + using Inkscape::IO::Resource::SYSTEM; + using Inkscape::IO::Resource::USER; + using Inkscape::IO::Resource::KEYS; + verbs = g_hash_table_new(NULL, NULL); primary_shortcuts = g_hash_table_new(NULL, NULL); - XML::Document *shortcuts=sp_repr_read_mem(shortcuts_default_xml, strlen(shortcuts_default_xml), NULL); - if (shortcuts) { - set_shortcuts_xml(shortcuts); - GC::release(shortcuts); - } else { - g_error("Unable to parse default shortcuts"); + read_shortcuts_file(get_path(SYSTEM, KEYS, "default.xml")); + try_shortcuts_file(get_path(USER, KEYS, "default.xml")); +} + +static void try_shortcuts_file(char const *filename) { + using Inkscape::IO::file_test; + + /* ah, if only we had an exception to catch... (permission, forgiveness) */ + if (file_test(filename, G_FILE_TEST_EXISTS)) { + read_shortcuts_file(filename); } } -static void set_shortcuts_xml(XML::Document const *doc) { +static void read_shortcuts_file(char const *filename) { + XML::Document *doc=sp_repr_read_file(filename, NULL); + if (!doc) { + g_warning("Unable to read keys file %s", filename); + return; + } + XML::Node const *root=doc->root(); g_return_if_fail(!strcmp(root->name(), "keybindings")); XML::NodeConstSiblingIterator iter=root->firstChild(); @@ -133,6 +150,8 @@ static void set_shortcuts_xml(XML::Document const *doc) { Inkscape::Verb::getbyid(verb_name), is_primary); } + + GC::release(doc); } /**