#
# 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
btn_back = 0x8
btn_forward = 0x10

# 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, "Windows" key on a pc keyboard:
mod_win = ['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', 'softlock'}
# msg is a string to be shown in the display or None for no indicator
# Mode 'meta' is special: it is an intermediate mode that
# is used primarily to launch other modes
# If the mode initiation character is preceeded by a double
# underscore, then the mode must be initiated from the "meta"
# mode.
dmod_meta = ['space', None, None]
dmod_draw = ['__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, 'pan']
dmod_zoom = ['__w', None, 'pan']
dmod_camera = ['__c', None, 'pan']
dmod_naxis = ['__n', None, None]

default_mode_type = 'locked'
default_lock_mode_type = 'softlock'

# 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', 'pan+backquote', 'zoom+backquote']
kp_autozoom_toggle = ['doublequote', 'pan+doublequote']
kp_autozoom_override = ['singlequote', 'pan+singlequote']
kp_dist_reset = ['D', 'dist+D']
kp_dist_prev = ['dist+up', 'dist+b']
kp_dist_next = ['dist+down', 'dist+n']
kp_pan_set = ['p', 'pan+p', 'zoom+p']
kp_pan_zoom_set = ['pan+1', 'zoom+1']
kp_pan_zoom_save = ['pan+z', 'zoom+z']
kp_pan_left = ['pan+*+left', 'zoom+*+left']
kp_pan_right = ['pan+*+right', 'zoom+*+right']
kp_pan_up = ['pan+*+up', 'zoom+*+up']
kp_pan_down = ['pan+*+down', 'zoom+*+down']
kp_pan_home = ['pan+*+home', 'zoom+*+home']
kp_pan_end = ['pan+*+end', 'zoom+*+end']
kp_pan_page_up = ['pan+*+page_up', 'zoom+*+page_up']
kp_pan_page_down = ['pan+*+page_down', 'zoom+*+page_down']
kp_pan_px_xminus = ['shift+left']
kp_pan_px_xplus = ['shift+right']
kp_pan_px_yminus = ['shift+down']
kp_pan_px_yplus = ['shift+up']
kp_pan_px_center = ['shift+home']
kp_center = ['c', 'pan+c', 'zoom+c']
kp_cut_255 = ['cuts+A']
kp_cut_minmax = ['cuts+S']
kp_cut_lo = ['cuts+l']
kp_cut_hi = ['cuts+h']
kp_cut_auto = ['a', 'cuts+a']
kp_autocuts_alg_prev = ['cuts+up', 'cuts+b']
kp_autocuts_alg_next = ['cuts+down', 'cuts+n']
kp_autocuts_toggle = [':', 'cuts+:']
kp_autocuts_override = [';', 'cuts+;']
kp_autocenter_toggle = ['?', 'pan+?']
kp_autocenter_override = ['/', 'pan+/']
kp_contrast_restore = ['T', 'contrast+T']
kp_cmap_reset = ['Y', 'cmap+Y']
kp_cmap_restore = ['cmap+r']
kp_cmap_invert = ['I', 'cmap+I']
kp_cmap_prev = ['cmap+up', 'cmap+b']
kp_cmap_next = ['cmap+down', 'cmap+n']
kp_toggle_cbar = ['cmap+c']
kp_imap_reset = ['cmap+i']
kp_imap_prev = ['cmap+left', 'cmap+j']
kp_imap_next = ['cmap+right', 'cmap+k']
kp_flip_x = ['[', '{', 'rotate+[', 'rotate+{']
kp_flip_y = [']', '}', 'rotate+]', 'rotate+}']
kp_swap_xy = ['backslash', '|', 'rotate+backslash', 'rotate+|']
kp_rotate_reset = ['R', 'rotate+R']
kp_save_profile = ['S']
kp_rotate_inc90 = ['.', 'rotate+.']
kp_rotate_dec90 = [',', 'rotate+,']
kp_orient_lh = ['o', 'rotate+o']
kp_orient_rh = ['O', 'rotate+O']
kp_poly_add = ['v', 'draw+v']
kp_poly_del = ['z', 'draw+z']
kp_edit_del = ['draw+x']
kp_reset = ['escape']
kp_lock = ['L', 'meta+L']
kp_softlock = ['l', 'meta+l']
kp_camera_save = ['camera+s']
kp_camera_reset = ['camera+r']
kp_camera_toggle3d = ['camera+3']

# pct of a window of data to move with pan key commands
key_pan_pct = 0.666667
# amount to move (in pixels) when using key pan arrow
key_pan_px_delta = 1.0

# SCROLLING/WHEEL commands
sc_pan = ['ctrl+scroll']
sc_pan_fine = ['pan+shift+scroll']
sc_pan_coarse = ['pan+ctrl+scroll']
sc_zoom = ['scroll', 'zoom+scroll']
sc_zoom_fine = []
sc_zoom_coarse = []
sc_zoom_origin = ['shift+scroll', 'zoom+shift+scroll']
sc_cuts_fine = ['cuts+ctrl+scroll']
sc_cuts_coarse = ['cuts+scroll']
sc_cuts_alg = []
sc_dist = ['dist+scroll']
sc_cmap = ['cmap+scroll']
sc_imap = ['cmap+ctrl+scroll']
sc_camera_track = ['camera+scroll']
sc_naxis = ['naxis+scroll']

# This controls how fast panning occurs with the sc_pan* functions.
# Increase to speed up panning
scroll_pan_acceleration = 1.0
# Lock X or Y pan scrolling
scroll_pan_lock_x = False
scroll_pan_lock_y = False
# For trackpads you can adjust this down if it seems too sensitive.
# 1.0 is appropriate for a mouse, 0.1 for most trackpads
scroll_zoom_acceleration = 1.0
# If set to True, then don't zoom by "zoom steps", but by a more direct
# scaling call that uses scroll_zoom_acceleration
scroll_zoom_direct_scale = False

# 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', 'win+left', 'right']

# 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 = ['zoom+middle']
ms_zoom_in = ['zoom+left']
ms_zoom_out = ['zoom+right', 'zoom+ctrl+left']
ms_cutlo = ['cuts+shift+left']
ms_cuthi = ['cuts+ctrl+left']
ms_cutall = ['cuts+left']
ms_cut_auto = ['cuts+right']
ms_panset = ['pan+middle', 'shift+left', 'middle']
ms_cmap_rotate = ['cmap+left']
ms_cmap_restore = ['cmap+right']
ms_camera_orbit = ['camera+left']
ms_camera_pan_delta = ['camera+right']
ms_naxis = ['naxis+left']

mouse_zoom_acceleration = 1.085
mouse_rotate_acceleration = 0.75

# GESTURES (some back ends only)
# NOTE: if using Qt4 back end, it is *highly* recommended to disable any
# "scroll zoom" (sc_zoom*) features above because the two kinds don't play
# well together.
pi_zoom = ['pinch']
pi_zoom_origin = ['shift+pinch']
pa_pan = ['pan']
pa_zoom = ['zoom+pan']
pa_zoom_origin = ['zoom+shift+pan']
pa_naxis = ['naxis+pan']

# This controls what operations the pinch gesture controls.  Possibilities are
# (empty list or) some combination of 'zoom' and 'rotate'.
pinch_actions = ['zoom']
pinch_zoom_acceleration = 1.0
pinch_rotate_acceleration = 1.0
pan_pan_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

pan_min_scroll_thumb_pct = 0.0
pan_max_scroll_thumb_pct = 0.9

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


#END
