A Simple X Image Viewer
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

116 wiersze
5.4 KiB

  1. #ifdef _WINDOW_CONFIG
  2. /* default window dimensions (overwritten via -g option): */
  3. enum { WIN_WIDTH = 800, WIN_HEIGHT = 600 };
  4. /* default color for window background: *
  5. * (see X(7) "COLOR NAMES" section for valid values) */
  6. static const char * const BG_COLOR = "#777777";
  7. /* default color for thumbnail selection: */
  8. static const char * const SEL_COLOR = "#DDDDDD";
  9. #endif
  10. #ifdef _IMAGE_CONFIG
  11. /* how should images be scaled when they are loaded?: *
  12. * (also controllable via -d/-s/-Z/-z options) *
  13. * SCALE_DOWN: 100%, but fit large images into window, *
  14. * SCALE_FIT: fit all images into window, *
  15. * SCALE_ZOOM: use current zoom level, 100% at startup */
  16. static const scalemode_t SCALE_MODE = SCALE_DOWN;
  17. /* levels (percent) to use when zooming via '-' and '+': */
  18. static const float zoom_levels[] = {
  19. 12.5, 25.0, 50.0, 75.0,
  20. 100.0, 150.0, 200.0, 400.0, 800.0
  21. };
  22. #endif
  23. #ifdef _THUMBS_CONFIG
  24. /* default dimension of thumbnails (width == height): */
  25. enum { THUMB_SIZE = 60 };
  26. #endif
  27. #ifdef _MAPPINGS_CONFIG
  28. /* keyboard mappings for image and thumbnail mode: */
  29. static const keymap_t keys[] = {
  30. /* ctrl key function argument */
  31. { False, XK_q, quit, (arg_t) None },
  32. { False, XK_r, reload, (arg_t) None },
  33. { False, XK_f, toggle_fullscreen, (arg_t) None },
  34. { False, XK_a, toggle_antialias, (arg_t) None },
  35. { False, XK_A, toggle_alpha, (arg_t) None },
  36. { False, XK_Return, switch_mode, (arg_t) None },
  37. { False, XK_g, first, (arg_t) None },
  38. { False, XK_G, last, (arg_t) None },
  39. { False, XK_n, navigate, (arg_t) +1 },
  40. { False, XK_space, navigate, (arg_t) +1 },
  41. { False, XK_p, navigate, (arg_t) -1 },
  42. { False, XK_BackSpace, navigate, (arg_t) -1 },
  43. { False, XK_bracketright, navigate, (arg_t) +10 },
  44. { False, XK_bracketleft, navigate, (arg_t) -10 },
  45. { False, XK_D, remove_image, (arg_t) None },
  46. { False, XK_h, move, (arg_t) DIR_LEFT },
  47. { False, XK_Left, move, (arg_t) DIR_LEFT },
  48. { False, XK_j, move, (arg_t) DIR_DOWN },
  49. { False, XK_Down, move, (arg_t) DIR_DOWN },
  50. { False, XK_k, move, (arg_t) DIR_UP },
  51. { False, XK_Up, move, (arg_t) DIR_UP },
  52. { False, XK_l, move, (arg_t) DIR_RIGHT },
  53. { False, XK_Right, move, (arg_t) DIR_RIGHT },
  54. { False, XK_braceleft, pan_screen, (arg_t) DIR_LEFT },
  55. { False, XK_Next, pan_screen, (arg_t) DIR_DOWN },
  56. { False, XK_Prior, pan_screen, (arg_t) DIR_UP },
  57. { False, XK_braceright, pan_screen, (arg_t) DIR_RIGHT },
  58. { False, XK_H, pan_edge, (arg_t) DIR_LEFT },
  59. { False, XK_J, pan_edge, (arg_t) DIR_DOWN },
  60. { False, XK_K, pan_edge, (arg_t) DIR_UP },
  61. { False, XK_L, pan_edge, (arg_t) DIR_RIGHT },
  62. { False, XK_plus, zoom, (arg_t) +1 },
  63. { False, XK_equal, zoom, (arg_t) +1 },
  64. { False, XK_KP_Add, zoom, (arg_t) +1 },
  65. { False, XK_minus, zoom, (arg_t) -1 },
  66. { False, XK_KP_Subtract, zoom, (arg_t) -1 },
  67. { False, XK_0, zoom, (arg_t) None },
  68. { False, XK_KP_0, zoom, (arg_t) None },
  69. { False, XK_w, fit_to_win, (arg_t) None },
  70. { False, XK_W, fit_to_img, (arg_t) None },
  71. { False, XK_less, rotate, (arg_t) DIR_LEFT },
  72. { False, XK_greater, rotate, (arg_t) DIR_RIGHT },
  73. /* open the current image with given program: */
  74. { True, XK_g, open_with, (arg_t) "gimp" },
  75. /* run shell command line on the current file,
  76. * '#' is replaced by filename: */
  77. { True, XK_less, run_command, (arg_t) "mogrify -rotate -90 #" },
  78. { True, XK_greater, run_command, (arg_t) "mogrify -rotate +90 #" },
  79. { True, XK_comma, run_command, (arg_t) "jpegtran -rotate 270 -copy all -outfile # #" },
  80. { True, XK_period, run_command, (arg_t) "jpegtran -rotate 90 -copy all -outfile # #" },
  81. };
  82. /* mouse button mappings for image mode: */
  83. static const button_t buttons[] = {
  84. /* ctrl shift button function argument */
  85. { False, False, Button1, navigate, (arg_t) +1 },
  86. { False, False, Button3, navigate, (arg_t) -1 },
  87. { False, False, Button2, drag, (arg_t) None },
  88. { False, False, Button4, move, (arg_t) DIR_UP },
  89. { False, False, Button5, move, (arg_t) DIR_DOWN },
  90. { False, True, Button4, move, (arg_t) DIR_LEFT },
  91. { False, True, Button5, move, (arg_t) DIR_RIGHT },
  92. { True, False, Button4, zoom, (arg_t) +1 },
  93. { True, False, Button5, zoom, (arg_t) -1 },
  94. };
  95. #endif