A Simple X Image Viewer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

134 lines
5.9 KiB

  1. #ifdef _WINDOW_CONFIG
  2. /* default window dimensions (overwritten via -g option): */
  3. enum {
  4. WIN_WIDTH = 800,
  5. WIN_HEIGHT = 600
  6. };
  7. /* default color for window background: */
  8. static const char * const BG_COLOR = "#777777";
  9. /* default color for thumbnail selection: */
  10. static const char * const SEL_COLOR = "#DDDDDD";
  11. /* (see X(7) section "COLOR NAMES" for valid values) */
  12. #endif
  13. #ifdef _IMAGE_CONFIG
  14. /* how should images be scaled when they are loaded?
  15. * (also controllable via -d/-s/-Z/-z options)
  16. * SCALE_DOWN: 100%, but fit large images into window,
  17. * SCALE_FIT: fit all images into window,
  18. * SCALE_ZOOM: use current zoom level, 100% at startup
  19. */
  20. static const scalemode_t SCALE_MODE = SCALE_DOWN;
  21. /* levels (percent) to use when zooming via '-' and '+': */
  22. static const float zoom_levels[] = {
  23. 12.5, 25.0, 50.0, 75.0,
  24. 100.0, 150.0, 200.0, 400.0, 800.0
  25. };
  26. /* default settings for gif images: */
  27. enum {
  28. GIF_DELAY = 100, /* delay time (in ms) */
  29. GIF_AUTOPLAY = 1, /* autoplay when loaded [0/1] */
  30. GIF_LOOP = 0 /* endless loop [0/1] */
  31. };
  32. #endif
  33. #ifdef _THUMBS_CONFIG
  34. /* default dimension of thumbnails (width == height): */
  35. enum { THUMB_SIZE = 60 };
  36. #endif
  37. #ifdef _MAPPINGS_CONFIG
  38. /* keyboard mappings for image and thumbnail mode: */
  39. static const keymap_t keys[] = {
  40. /* ctrl key function argument */
  41. { False, XK_q, it_quit, (arg_t) None },
  42. { False, XK_Return, it_switch_mode, (arg_t) None },
  43. { False, XK_f, it_toggle_fullscreen, (arg_t) None },
  44. { False, XK_r, it_reload_image, (arg_t) None },
  45. { False, XK_D, it_remove_image, (arg_t) None },
  46. { False, XK_n, i_navigate, (arg_t) +1 },
  47. { False, XK_space, i_navigate, (arg_t) +1 },
  48. { False, XK_p, i_navigate, (arg_t) -1 },
  49. { False, XK_BackSpace, i_navigate, (arg_t) -1 },
  50. { False, XK_bracketright, i_navigate, (arg_t) +10 },
  51. { False, XK_bracketleft, i_navigate, (arg_t) -10 },
  52. { False, XK_g, it_first, (arg_t) None },
  53. { False, XK_G, it_last, (arg_t) None },
  54. { False, XK_N, i_navigate_frame, (arg_t) +1 },
  55. { False, XK_P, i_navigate_frame, (arg_t) -1 },
  56. { False, XK_h, it_move, (arg_t) DIR_LEFT },
  57. { False, XK_Left, it_move, (arg_t) DIR_LEFT },
  58. { False, XK_j, it_move, (arg_t) DIR_DOWN },
  59. { False, XK_Down, it_move, (arg_t) DIR_DOWN },
  60. { False, XK_k, it_move, (arg_t) DIR_UP },
  61. { False, XK_Up, it_move, (arg_t) DIR_UP },
  62. { False, XK_l, it_move, (arg_t) DIR_RIGHT },
  63. { False, XK_Right, it_move, (arg_t) DIR_RIGHT },
  64. { True, XK_h, i_pan_screen, (arg_t) DIR_LEFT },
  65. { True, XK_Left, i_pan_screen, (arg_t) DIR_LEFT },
  66. { True, XK_j, i_pan_screen, (arg_t) DIR_DOWN },
  67. { True, XK_Down, i_pan_screen, (arg_t) DIR_DOWN },
  68. { True, XK_k, i_pan_screen, (arg_t) DIR_UP },
  69. { True, XK_Up, i_pan_screen, (arg_t) DIR_UP },
  70. { True, XK_l, i_pan_screen, (arg_t) DIR_RIGHT },
  71. { True, XK_Right, i_pan_screen, (arg_t) DIR_RIGHT },
  72. { False, XK_H, i_pan_edge, (arg_t) DIR_LEFT },
  73. { False, XK_J, i_pan_edge, (arg_t) DIR_DOWN },
  74. { False, XK_K, i_pan_edge, (arg_t) DIR_UP },
  75. { False, XK_L, i_pan_edge, (arg_t) DIR_RIGHT },
  76. { False, XK_plus, i_zoom, (arg_t) +1 },
  77. { False, XK_equal, i_zoom, (arg_t) +1 },
  78. { False, XK_KP_Add, i_zoom, (arg_t) +1 },
  79. { False, XK_minus, i_zoom, (arg_t) -1 },
  80. { False, XK_KP_Subtract, i_zoom, (arg_t) -1 },
  81. { False, XK_0, i_zoom, (arg_t) None },
  82. { False, XK_KP_0, i_zoom, (arg_t) None },
  83. { False, XK_w, i_fit_to_win, (arg_t) None },
  84. { False, XK_W, i_fit_to_img, (arg_t) None },
  85. { False, XK_less, i_rotate, (arg_t) DIR_LEFT },
  86. { False, XK_greater, i_rotate, (arg_t) DIR_RIGHT },
  87. { False, XK_a, i_toggle_antialias, (arg_t) None },
  88. { False, XK_A, i_toggle_alpha, (arg_t) None },
  89. /* open current image with given program: */
  90. { True, XK_g, it_open_with, (arg_t) "gimp" },
  91. /* run shell command line on current file ('#' is replaced by file path: */
  92. { True, XK_less, it_shell_cmd, (arg_t) "mogrify -rotate -90 #" },
  93. { True, XK_greater, it_shell_cmd, (arg_t) "mogrify -rotate +90 #" },
  94. { True, XK_comma, it_shell_cmd, (arg_t) "jpegtran -rotate 270 -copy all -outfile # #" },
  95. { True, XK_period, it_shell_cmd, (arg_t) "jpegtran -rotate 90 -copy all -outfile # #" },
  96. };
  97. /* mouse button mappings for image mode: */
  98. static const button_t buttons[] = {
  99. /* ctrl shift button function argument */
  100. { False, False, Button1, i_navigate, (arg_t) +1 },
  101. { False, False, Button3, i_navigate, (arg_t) -1 },
  102. { False, False, Button2, i_drag, (arg_t) None },
  103. { False, False, Button4, it_move, (arg_t) DIR_UP },
  104. { False, False, Button5, it_move, (arg_t) DIR_DOWN },
  105. { False, True, Button4, it_move, (arg_t) DIR_LEFT },
  106. { False, True, Button5, it_move, (arg_t) DIR_RIGHT },
  107. { True, False, Button4, i_zoom, (arg_t) +1 },
  108. { True, False, Button5, i_zoom, (arg_t) -1 },
  109. };
  110. #endif