A Simple X Image Viewer
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

config.h 4.5 KiB

hace 13 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifdef _GENERAL_CONFIG
  2. /* enable external commands (defined below)? 0 = off, 1 = on: */
  3. enum { EXT_COMMANDS = 0 };
  4. #endif
  5. #ifdef _WINDOW_CONFIG
  6. /* default window dimensions (overwritten via -g option): */
  7. enum { WIN_WIDTH = 800, WIN_HEIGHT = 600 };
  8. /* default color for window background: *
  9. * (see X(7) "COLOR NAMES" section for valid values) */
  10. static const char * const BG_COLOR = "#999999";
  11. /* default color for thumbnail selection: */
  12. static const char * const SEL_COLOR = "#0066FF";
  13. #endif
  14. #ifdef _IMAGE_CONFIG
  15. /* how should images be scaled when they are loaded?: *
  16. * (also controllable via -d/-s/-Z/-z options) *
  17. * SCALE_DOWN: 100%, but fit large images into window, *
  18. * SCALE_FIT: fit all images into window, *
  19. * SCALE_ZOOM: use current zoom level, 100% at startup */
  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. #endif
  27. #ifdef _THUMBS_CONFIG
  28. /* default dimension of thumbnails (width == height): */
  29. enum { THUMB_SIZE = 60 };
  30. #endif
  31. #ifdef _MAPPINGS_CONFIG
  32. /* keyboard mappings for image and thumbnail mode: */
  33. static const keymap_t keys[] = {
  34. /* key function argument */
  35. { XK_q, quit, None },
  36. { XK_r, reload, None },
  37. { XK_f, toggle_fullscreen, None },
  38. { XK_a, toggle_antialias, None },
  39. { XK_A, toggle_alpha, None },
  40. { XK_Return, switch_mode, None },
  41. { XK_g, first, None },
  42. { XK_G, last, None },
  43. { XK_n, navigate, +1 },
  44. { XK_space, navigate, +1 },
  45. { XK_p, navigate, -1 },
  46. { XK_BackSpace, navigate, -1 },
  47. { XK_bracketright, navigate, +10 },
  48. { XK_bracketleft, navigate, -10 },
  49. { XK_D, remove_image, None },
  50. { XK_h, move, DIR_LEFT },
  51. { XK_Left, move, DIR_LEFT },
  52. { XK_j, move, DIR_DOWN },
  53. { XK_Down, move, DIR_DOWN },
  54. { XK_k, move, DIR_UP },
  55. { XK_Up, move, DIR_UP },
  56. { XK_l, move, DIR_RIGHT },
  57. { XK_Right, move, DIR_RIGHT },
  58. { XK_braceleft, scroll, DIR_LEFT },
  59. { XK_Next, scroll, DIR_DOWN },
  60. { XK_Prior, scroll, DIR_UP },
  61. { XK_braceright, scroll, DIR_RIGHT },
  62. { XK_H, pan_edge, DIR_LEFT },
  63. { XK_J, pan_edge, DIR_DOWN },
  64. { XK_K, pan_edge, DIR_UP },
  65. { XK_L, pan_edge, DIR_RIGHT },
  66. { XK_plus, zoom, +1 },
  67. { XK_equal, zoom, +1 },
  68. { XK_KP_Add, zoom, +1 },
  69. { XK_minus, zoom, -1 },
  70. { XK_KP_Subtract, zoom, -1 },
  71. { XK_0, zoom, 0 },
  72. { XK_KP_0, zoom, 0 },
  73. { XK_w, fit_to_win, None },
  74. { XK_W, fit_to_img, None },
  75. { XK_less, rotate, DIR_LEFT },
  76. { XK_greater, rotate, DIR_RIGHT },
  77. };
  78. /* external commands and corresponding key mappings: */
  79. static const command_t commands[] = {
  80. /* ctrl-... reload? command, '#' is replaced by filename */
  81. { XK_comma, True, "jpegtran -rotate 270 -copy all -outfile # #" },
  82. { XK_period, True, "jpegtran -rotate 90 -copy all -outfile # #" },
  83. { XK_less, True, "mogrify -rotate -90 #" },
  84. { XK_greater, True, "mogrify -rotate +90 #" }
  85. };
  86. /* mouse button mappings for image mode: */
  87. static const button_t buttons[] = {
  88. /* modifier button function argument */
  89. { None, Button1, navigate, +1 },
  90. { None, Button3, navigate, -1 },
  91. { None, Button2, drag, None },
  92. { None, Button4, move, DIR_UP },
  93. { None, Button5, move, DIR_DOWN },
  94. { ShiftMask, Button4, move, DIR_LEFT },
  95. { ShiftMask, Button5, move, DIR_RIGHT },
  96. { ControlMask, Button4, zoom, +1 },
  97. { ControlMask, Button5, zoom, -1 },
  98. };
  99. #endif