# cua-key-theme-gtkrc - IBM CUA Keybindings for Gtk+
# Copyright (C) 2002  Gregory Merchan
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# IBM is probbably a trademark of IBM. CUA may be too.
# Please notify me if there is any legal requirement for a formal
# statement of that.


# This key theme adds some CUA keybindings to some widgets.
# There may be keybindings I've missed as well as widgets I've missed.
# While I was making this, I included some keybindings which are
#  supported by default - I wasn't aware they were. Since then I've
#  commented them out with "#AS".
# Some bindings can't be handled at this level, such as Undo and Redo.

# The absolute most important thing to make something like this work
#  everywhere is for programmers to write proper widgets. For example,
#  the nautilus icon view should have a bindable "select-all" function.
#  I don't know if it does or does not. Appropriate subclassing is also
#  a great boon to making users happy.

# Do not file bug reports asking authors to include these or other
#  keybindings, unless those others are listed in the HIG.
# Do file bug reports against widgets which should support the binding
#  mechanism but do not or those which do not support it as fully as they
#  should. (I'm not offering here any definitions of what should be
#  supported.)

# Note a possible example. Undo and redo cannot be supported by a general
#  widget (afaik). However, the general widget could be subclassed for a
#  particular program, and that subclass could add the binding.

# To make use of this, place this file in suitable location and include it
#  in your ~/.gtkrc-2.0 or whatever file controls your gtk theme.
# For example, if the file is '/home/username/.themes/cua-key-theme-gtkrc'
#  then the include line will be:
#
#    include "/home/username/.themes/cua-key-theme-gtkrc"
#

binding "cua-text-entry"
{
#AS bind "Insert" { "toggle-overwrite" () }
  bind "<shift>Insert" { "paste-clipboard" () }
  bind "<ctrl>Insert"  { "copy-clipboard" () }
  bind "<shift>Delete" { "cut-clipboard" () }

# this is "select-all" - it doesn't seem to work.
  bind "<ctrl>slash" { "move-cursor" (paragraph-ends, -1, 0)
                       "move-cursor" (paragraph-ends, 1, 1) }

#AS  bind "<ctrl>Left" { "move-cursor" (words, -1, 0) }
#AS  bind "<ctrl>Right" { "move-cursor" (words, 1, 0) }

# unsure about these wrt CUA
#AS  bind "<ctrl><shift>Left" { "move-cursor" (words, -1, 0) }
#AS  bind "<ctrl><shift>Right" { "move-cursor" (words, 1, 0) }

# maybe supported, not sure.
# This might be workable as the "select-all" binding above might.
#  bind "<ctrl>backslash" { "unselect-all" () }

# unsupported
#  bind "<alt>backspace" { "undo" () }
#  bind "<alt><shift>backspace" { "redo" () }
}

binding "cua-text-view"
{
}

binding "cua-tree-view"
{
#AS  bind "<ctrl>slash" { "select-all" () }
#AS  bind "<ctrl>backslash" { "unselect-all" () }
}

class "GtkEntry" binding "cua-text-entry"
class "GtkTextView" binding "cua-text-entry"
class "GtkTextView" binding "cua-text-view"
class "GtkTreeView" binding "cua-tree-view"
