Krolyxon
Commit c58307b

Branches

Refs →

nsxivc58307b

Merged commands.h into config.h

Author
Bert
Date
2011-04-14 12:00 +0200
Parent
75c79be
Commit
c58307ba38e568c9851749ee8e2c721ed4741ca1

+33 −29

3 files changed

  1. D commands.h +0 −13
  2. M config.h +24 −11
  3. M main.c +9 −5
D commands.h View
@@ -1,13 +0,0 @@
1−typedef struct {
2− KeySym ksym;
3− Bool reload;
4− const char *cmdline;
5−} command_t;
6−
7−static command_t commands[] = {
8− /* ctrl-... reload? command, '#' is replaced by filename */
9− { XK_comma, True, "jpegtran -rotate 270 -copy all -outfile # #" },
10− { XK_period, True, "jpegtran -rotate 90 -copy all -outfile # #" },
11− { XK_less, True, "mogrify -rotate -90 #" },
12− { XK_greater, True, "mogrify -rotate +90 #" }
13−};
M config.h View
@@ -2,27 +2,40 @@
22 #define WIN_WIDTH 800
33 #define WIN_HEIGHT 600
44
5−/* default color for window background: *
6− * (see X(7) "COLOR NAMES" section for valid values) */
5+/* default color for window background: *
6+ * (see X(7) "COLOR NAMES" section for valid values) */
77 #define BG_COLOR "#999999"
8−/* default color for thumbnail selection: */
8+/* default color for thumbnail selection: */
99 #define SEL_COLOR "#0040FF"
1010
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 */
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 */
1616 #define SCALE_MODE SCALE_DOWN
1717
18−/* levels (percent) to use when zooming via '-' and '+': */
18+/* levels (percent) to use when zooming via '-' and '+': */
1919 static const float zoom_levels[] = {
2020 12.5, 25.0, 50.0, 75.0,
2121 100.0, 150.0, 200.0, 400.0, 800.0
2222 };
2323
24−/* default dimension of thumbnails (width == height): */
24+/* default dimension of thumbnails (width == height): */
2525 #define THUMB_SIZE 60
2626
27−/* support for external commands (defined in commands.h): */
27+/* enable support for external commands (see below)?: */
2828 #define EXT_COMMANDS 0
29+
30+/* external commands and corresponding key mappings: */
31+#ifdef MAIN_C
32+#if EXT_COMMANDS
33+static const command_t commands[] = {
34+ /* ctrl-... reload? command, '#' is replaced by filename */
35+ { XK_comma, True, "jpegtran -rotate 270 -copy all -outfile # #" },
36+ { XK_period, True, "jpegtran -rotate 90 -copy all -outfile # #" },
37+ { XK_less, True, "mogrify -rotate -90 #" },
38+ { XK_greater, True, "mogrify -rotate +90 #" }
39+};
40+#endif
41+#endif
M main.c View
@@ -29,17 +29,12 @@
2929 #include <X11/Xutil.h>
3030 #include <X11/keysym.h>
3131
32−#include "config.h"
3332 #include "image.h"
3433 #include "options.h"
3534 #include "thumbs.h"
3635 #include "util.h"
3736 #include "window.h"
3837
39−#if EXT_COMMANDS
40−#include "commands.h"
41−#endif
42−
4338 #define FNAME_CNT 1024
4439 #define TITLE_LEN 256
4540
@@ -48,11 +43,20 @@
4843 #define TO_CURSOR_HIDE 1500000
4944 #define TO_THUMBS_LOAD 75000
5045
46+typedef struct {
47+ KeySym ksym;
48+ Bool reload;
49+ const char *cmdline;
50+} command_t;
51+
5152 typedef enum {
5253 MODE_NORMAL = 0,
5354 MODE_THUMBS
5455 } appmode_t;
5556
57+#define MAIN_C
58+#include "config.h"
59+
5660 void run();
5761
5862 appmode_t mode;