#
# bindings.cfg -- Ginga user interface bindings customization
#
# Put this in your $HOME/.ginga directory as "bindings.cfg"
#
# Troubleshooting:
# Run the examples/xyz/example2_xyz.py, where "xyz" is the toolkit you want
# to use.  Run it from a terminal like this:
#    ./examples/qt/example2_qt.py --loglevel=10 --stderr
# Further commentary in sections below.
#

# BUTTON SET UP
# You should rarely have to change these, but if you have a non-standard
# mouse or setup it might be useful.
# To find out what buttons are generating what codes, start up things as
# described in "Troubleshooting" above and look for messages like this as
# you click around in the window:
#  ... | D | Bindings.py:1260 (window_button_press) | x,y=70,-69 btncode=0x1
btn_nobtn = 0x0
btn_left  = 0x1
btn_middle= 0x2
btn_right = 0x4

# Set up our standard modifiers.
# These should not contain "normal" keys--they should be valid modifier
# keys for your platform.
# To find out what symbol is used for a keystroke on your platform,
# start up things as described above in "Troubleshooting" and look for
# messages like this as you press keys while focus is in the window:
#  ... | D | Bindings.py:1203 (window_key_press) | keyname=shift_l
mod_shift = ['shift_l', 'shift_r']
# same setting ends up as "Ctrl" on a pc and "Command" on a mac:
mod_ctrl = ['control_l', 'control_r']
# "Control" key on a mac:
mod_meta = ['meta_right']

# Define up our custom modifiers.
# These are typically "normal" keys.  The modifier is defined by a triplet:
# [ keyname, modtype, msg ], where
# keyname is a key whose press initiates the modifier,
# modtype is either None or a type in {'held', 'oneshot', 'locked'}
# msg is a string to be shown in the display or None for no indicator
dmod_draw = ['space', None, None]
dmod_edit = ['b', None, None]
dmod_cmap = ['y', None, None]
dmod_cuts = ['s', None, None]
dmod_dist = ['d', None, None]
dmod_contrast = ['t', None, None]
dmod_rotate = ['r', None, None]
dmod_pan = ['q', None, None]
dmod_freepan = ['w', None, None]

# KEYPRESS commands
kp_zoom_in = ['+', '=']
kp_zoom_out = ['-', '_']
kp_zoom = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
kp_zoom_inv = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')']
kp_zoom_fit = ['backquote']
kp_autozoom_toggle = ['doublequote']
kp_autozoom_override = ['singlequote']
kp_dist_reset = ['D']
kp_pan_set = ['p']
kp_center = ['c']
kp_cut_255 = ['A']
kp_cut_minmax = ['S']
kp_cut_auto = ['a']
kp_autocuts_toggle = [':']
kp_autocuts_override = [';']
kp_autocenter_toggle = ['?']
kp_autocenter_override = ['/']
kp_contrast_restore = ['T']
kp_cmap_reset = ['Y']
kp_imap_reset = []
kp_flip_x = ['[', '{']
kp_flip_y = [']', '}']
kp_swap_xy = ['backslash', '|']
kp_rotate_reset = ['R']
kp_rotate_inc90 = [',']
kp_rotate_dec90 = ['.']
kp_orient_lh = ['o']
kp_orient_rh = ['O']
kp_poly_add = ['v', 'draw+v']
kp_poly_del = ['z', 'draw+z']
kp_reset = ['escape']
kp_lock = ['l']

# SCROLLING/WHEEL commands
sc_pan = []
sc_pan_fine = []
sc_pan_coarse = []
sc_zoom = ['scroll']
sc_zoom_fine = ['shift+scroll']
sc_zoom_coarse = ['ctrl+scroll']
sc_cuts_fine = ['cuts+scroll']
sc_cuts_coarse = []
sc_dist = ['dist+scroll']
sc_cmap = ['cmap+scroll']
sc_imap = []

# This controls how fast panning occurs with the sc_pan* functions.
# Increase to speed up panning
scroll_pan_acceleration = 1.0
# For trackpads you can adjust this down if it seems too sensitive.
scroll_zoom_acceleration = 1.0


# MOUSE/BUTTON commands
# NOTE: most plugins in the reference viewer need "none", "cursor" and "draw"
# events to work!  If you want to use them you need to provide a valid
# non-conflicting binding
ms_none = ['nobtn']
ms_cursor = ['left']
ms_wheel = []
ms_draw = ['draw+left', 'meta+left', 'right']
ms_edit = ['edit+left']

# mouse commands initiated by a preceeding keystroke (see above)
ms_rotate = ['rotate+left']
ms_rotate_reset = ['rotate+right']
ms_contrast = ['contrast+left', 'ctrl+right']
ms_contrast_restore = ['contrast+right', 'ctrl+middle']
ms_pan = ['pan+left', 'ctrl+left']
ms_zoom = ['pan+right']
ms_freepan = ['freepan+left', 'middle']
ms_zoom_in = ['freepan+middle']
ms_zoom_out = ['freepan+right']
#ms_cutlo = ['cutlo+left']
#ms_cuthi = ['cuthi+left']
ms_cutall = ['cuts+left']
ms_cut_auto = ['cuts+right']
ms_panset = ['pan+middle', 'shift+left']

mouse_zoom_acceleration = 1.085
mouse_rotate_acceleration = 0.75

# GESTURES (Qt version only)
# Uncomment to enable pinch gesture on touchpads.
# NOTE: if you enable this, it is *highly* recommended to disable any
# "scroll zoom" (sc_zoom*) features above because the two kinds don't play
# well together.  A good combination for trackpads is enabling pinch with
# zoom and the sc_pan functions.
#gs_pinch = ['pinch']

# This controls what operations the pinch gesture controls.  Possibilities are
# (empty list or) some combination of 'zoom' and 'rotate'.
pinch_actions = []
pinch_zoom_acceleration = 1.0
pinch_rotate_acceleration = 1.0

# Use opposite sense of panning direction
pan_reverse = False
# 1.0 is a proportional drag pan. Increase to "accelerate" panning speed.
pan_multiplier = 1.0

# Use opposite sense of zooming scroll wheel
zoom_scroll_reverse = False

# No messages for color map warps or setting pan position
#msg_cmap = False
#msg_panset = False

#END
