A Simple X Image Viewer
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

14 лет назад
14 лет назад
14 лет назад
14 лет назад
11 лет назад
11 лет назад
11 лет назад
11 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. #ifdef _WINDOW_CONFIG
  2. /* default window dimensions (overwritten via -g option): */
  3. enum {
  4. WIN_WIDTH = 800,
  5. WIN_HEIGHT = 600
  6. };
  7. /* bar font:
  8. * (see X(7) section "FONT NAMES" for valid values)
  9. */
  10. static const char * const BAR_FONT = "-*-fixed-medium-r-*-*-13-*-*-*-*-60-*-*";
  11. /* colors:
  12. * (see X(7) section "COLOR NAMES" for valid values)
  13. */
  14. static const char * const WIN_BG_COLOR = "#777777";
  15. static const char * const WIN_FS_COLOR = "#000000";
  16. static const char * const SEL_COLOR = "#DDDDDD";
  17. static const char * const BAR_BG_COLOR = "#222222";
  18. static const char * const BAR_FG_COLOR = "#EEEEEE";
  19. #endif
  20. #ifdef _IMAGE_CONFIG
  21. /* how should images be scaled when they are loaded?
  22. * (also controllable via -d/-s/-Z/-z options)
  23. * SCALE_DOWN: 100%, but fit large images into window,
  24. * SCALE_FIT: fit all images into window,
  25. * SCALE_ZOOM: use current zoom level, 100% at startup
  26. */
  27. static const scalemode_t SCALE_MODE = SCALE_DOWN;
  28. /* levels (in percent) to use when zooming via '-' and '+':
  29. * (first/last value is used as min/max zoom level)
  30. */
  31. static const float zoom_levels[] = {
  32. 12.5, 25.0, 50.0, 75.0,
  33. 100.0, 150.0, 200.0, 400.0, 800.0
  34. };
  35. /* default slideshow delay (in sec, overwritten via -S option): */
  36. enum { SLIDESHOW_DELAY = 5 };
  37. /* default settings for multi-frame gif images: */
  38. enum {
  39. GIF_DELAY = 100, /* delay time (in ms) */
  40. GIF_AUTOPLAY = 1, /* autoplay when loaded [0/1] */
  41. GIF_LOOP = 0 /* loop? [0: no, 1: endless, -1: as specified in file] */
  42. };
  43. /* gamma correction: the user-visible ranges [-GAMMA_RANGE, 0] and
  44. * (0, GAMMA_RANGE] are mapped to the ranges [0, 1], and (1, GAMMA_MAX].
  45. * */
  46. static const double GAMMA_MAX = 10.0;
  47. static const int GAMMA_RANGE = 32;
  48. #endif
  49. #ifdef _THUMBS_CONFIG
  50. /* default dimension of thumbnails (width == height): */
  51. enum { THUMB_SIZE = 60 };
  52. #endif
  53. #ifdef _RENDER_CONFIG
  54. /* if false, pixelate images at zoom level != 100%,
  55. * toggled with 'a' key binding
  56. */
  57. static const bool RENDER_ANTI_ALIAS = true;
  58. /* if true, use white background for alpha layer,
  59. * toggled with 'A' key binding
  60. */
  61. static const bool RENDER_WHITE_ALPHA = false;
  62. #endif
  63. #ifdef _MAPPINGS_CONFIG
  64. /* keyboard mappings for image and thumbnail mode: */
  65. static const keymap_t keys[] = {
  66. /* modifiers key function argument */
  67. { 0, XK_q, it_quit, (arg_t) None },
  68. { 0, XK_Return, it_switch_mode, (arg_t) None },
  69. { 0, XK_f, it_toggle_fullscreen, (arg_t) None },
  70. { 0, XK_b, it_toggle_bar, (arg_t) None },
  71. { ControlMask, XK_x, it_prefix_external, (arg_t) None },
  72. { 0, XK_r, it_reload_image, (arg_t) None },
  73. { 0, XK_R, t_reload_all, (arg_t) None },
  74. { 0, XK_D, it_remove_image, (arg_t) None },
  75. { 0, XK_n, i_navigate, (arg_t) +1 },
  76. { 0, XK_space, i_navigate, (arg_t) +1 },
  77. { 0, XK_p, i_navigate, (arg_t) -1 },
  78. { 0, XK_BackSpace, i_navigate, (arg_t) -1 },
  79. { 0, XK_bracketright, i_navigate, (arg_t) +10 },
  80. { 0, XK_bracketleft, i_navigate, (arg_t) -10 },
  81. { ControlMask, XK_6, i_alternate, (arg_t) None },
  82. { 0, XK_g, it_first, (arg_t) None },
  83. { 0, XK_G, it_n_or_last, (arg_t) None },
  84. { ControlMask, XK_n, i_navigate_frame, (arg_t) +1 },
  85. { ControlMask, XK_p, i_navigate_frame, (arg_t) -1 },
  86. { ControlMask, XK_space, i_toggle_animation, (arg_t) None },
  87. { 0, XK_m, it_toggle_image_mark, (arg_t) None },
  88. { 0, XK_M, it_reverse_marks, (arg_t) None },
  89. { 0, XK_N, it_navigate_marked, (arg_t) +1 },
  90. { 0, XK_P, it_navigate_marked, (arg_t) -1 },
  91. { 0, XK_h, it_scroll_move, (arg_t) DIR_LEFT },
  92. { 0, XK_Left, it_scroll_move, (arg_t) DIR_LEFT },
  93. { 0, XK_j, it_scroll_move, (arg_t) DIR_DOWN },
  94. { 0, XK_Down, it_scroll_move, (arg_t) DIR_DOWN },
  95. { 0, XK_k, it_scroll_move, (arg_t) DIR_UP },
  96. { 0, XK_Up, it_scroll_move, (arg_t) DIR_UP },
  97. { 0, XK_l, it_scroll_move, (arg_t) DIR_RIGHT },
  98. { 0, XK_Right, it_scroll_move, (arg_t) DIR_RIGHT },
  99. { ControlMask, XK_h, it_scroll_screen, (arg_t) DIR_LEFT },
  100. { ControlMask, XK_Left, it_scroll_screen, (arg_t) DIR_LEFT },
  101. { ControlMask, XK_j, it_scroll_screen, (arg_t) DIR_DOWN },
  102. { ControlMask, XK_Down, it_scroll_screen, (arg_t) DIR_DOWN },
  103. { ControlMask, XK_k, it_scroll_screen, (arg_t) DIR_UP },
  104. { ControlMask, XK_Up, it_scroll_screen, (arg_t) DIR_UP },
  105. { ControlMask, XK_l, it_scroll_screen, (arg_t) DIR_RIGHT },
  106. { ControlMask, XK_Right, it_scroll_screen, (arg_t) DIR_RIGHT },
  107. { 0, XK_H, i_scroll_to_edge, (arg_t) DIR_LEFT },
  108. { 0, XK_J, i_scroll_to_edge, (arg_t) DIR_DOWN },
  109. { 0, XK_K, i_scroll_to_edge, (arg_t) DIR_UP },
  110. { 0, XK_L, i_scroll_to_edge, (arg_t) DIR_RIGHT },
  111. { 0, XK_plus, i_zoom, (arg_t) +1 },
  112. { 0, XK_KP_Add, i_zoom, (arg_t) +1 },
  113. { 0, XK_minus, i_zoom, (arg_t) -1 },
  114. { 0, XK_KP_Subtract, i_zoom, (arg_t) -1 },
  115. { 0, XK_equal, i_set_zoom, (arg_t) 100 },
  116. { 0, XK_w, i_fit_to_win, (arg_t) SCALE_FIT },
  117. { 0, XK_e, i_fit_to_win, (arg_t) SCALE_WIDTH },
  118. { 0, XK_E, i_fit_to_win, (arg_t) SCALE_HEIGHT },
  119. { 0, XK_less, i_rotate, (arg_t) DEGREE_270 },
  120. { 0, XK_greater, i_rotate, (arg_t) DEGREE_90 },
  121. { 0, XK_question, i_rotate, (arg_t) DEGREE_180 },
  122. { 0, XK_bar, i_flip, (arg_t) FLIP_HORIZONTAL },
  123. { 0, XK_underscore, i_flip, (arg_t) FLIP_VERTICAL },
  124. { 0, XK_s, i_slideshow, (arg_t) None },
  125. { 0, XK_a, i_toggle_antialias, (arg_t) None },
  126. { 0, XK_A, it_toggle_alpha, (arg_t) None },
  127. { 0, XK_braceleft, i_change_gamma, (arg_t) -1 },
  128. { 0, XK_braceright, i_change_gamma, (arg_t) +1 },
  129. { ControlMask, XK_g, i_change_gamma, (arg_t) 0 },
  130. };
  131. /* mouse button mappings for image mode: */
  132. static const button_t buttons[] = {
  133. /* modifiers button function argument */
  134. { 0, Button1, i_navigate, (arg_t) +1 },
  135. { 0, Button3, i_navigate, (arg_t) -1 },
  136. { 0, Button2, i_drag, (arg_t) None },
  137. { 0, Button4, it_scroll_move, (arg_t) DIR_UP },
  138. { 0, Button5, it_scroll_move, (arg_t) DIR_DOWN },
  139. { ShiftMask, Button4, it_scroll_move, (arg_t) DIR_LEFT },
  140. { ShiftMask, Button5, it_scroll_move, (arg_t) DIR_RIGHT },
  141. { ControlMask, Button4, i_zoom, (arg_t) +1 },
  142. { ControlMask, Button5, i_zoom, (arg_t) -1 },
  143. };
  144. #endif