From c58307ba38e568c9851749ee8e2c721ed4741ca1 Mon Sep 17 00:00:00 2001 From: Bert Date: Thu, 14 Apr 2011 12:00:35 +0200 Subject: [PATCH] Merged commands.h into config.h --- commands.h | 13 ------------- config.h | 35 ++++++++++++++++++++++++----------- main.c | 14 +++++++++----- 3 files changed, 33 insertions(+), 29 deletions(-) delete mode 100644 commands.h diff --git a/commands.h b/commands.h deleted file mode 100644 index ce00858..0000000 --- a/commands.h +++ /dev/null @@ -1,13 +0,0 @@ -typedef struct { - KeySym ksym; - Bool reload; - const char *cmdline; -} command_t; - -static command_t commands[] = { - /* ctrl-... reload? command, '#' is replaced by filename */ - { XK_comma, True, "jpegtran -rotate 270 -copy all -outfile # #" }, - { XK_period, True, "jpegtran -rotate 90 -copy all -outfile # #" }, - { XK_less, True, "mogrify -rotate -90 #" }, - { XK_greater, True, "mogrify -rotate +90 #" } -}; diff --git a/config.h b/config.h index 7a4d43b..31f40fd 100644 --- a/config.h +++ b/config.h @@ -2,27 +2,40 @@ #define WIN_WIDTH 800 #define WIN_HEIGHT 600 -/* default color for window background: * - * (see X(7) "COLOR NAMES" section for valid values) */ +/* default color for window background: * + * (see X(7) "COLOR NAMES" section for valid values) */ #define BG_COLOR "#999999" -/* default color for thumbnail selection: */ +/* default color for thumbnail selection: */ #define SEL_COLOR "#0040FF" -/* how should images be scaled when they are loaded?: * - * (also controllable via -d/-s/-Z/-z options) * - * SCALE_DOWN: 100%, but fit large images into window, * - * SCALE_FIT: fit all images into window, * - * SCALE_ZOOM: use current zoom level, 100% at startup */ +/* how should images be scaled when they are loaded?: * + * (also controllable via -d/-s/-Z/-z options) * + * SCALE_DOWN: 100%, but fit large images into window, * + * SCALE_FIT: fit all images into window, * + * SCALE_ZOOM: use current zoom level, 100% at startup */ #define SCALE_MODE SCALE_DOWN -/* levels (percent) to use when zooming via '-' and '+': */ +/* levels (percent) to use when zooming via '-' and '+': */ static const float zoom_levels[] = { 12.5, 25.0, 50.0, 75.0, 100.0, 150.0, 200.0, 400.0, 800.0 }; -/* default dimension of thumbnails (width == height): */ +/* default dimension of thumbnails (width == height): */ #define THUMB_SIZE 60 -/* support for external commands (defined in commands.h): */ +/* enable support for external commands (see below)?: */ #define EXT_COMMANDS 0 + +/* external commands and corresponding key mappings: */ +#ifdef MAIN_C +#if EXT_COMMANDS +static const command_t commands[] = { + /* ctrl-... reload? command, '#' is replaced by filename */ + { XK_comma, True, "jpegtran -rotate 270 -copy all -outfile # #" }, + { XK_period, True, "jpegtran -rotate 90 -copy all -outfile # #" }, + { XK_less, True, "mogrify -rotate -90 #" }, + { XK_greater, True, "mogrify -rotate +90 #" } +}; +#endif +#endif diff --git a/main.c b/main.c index e58db1c..b8b189d 100644 --- a/main.c +++ b/main.c @@ -29,17 +29,12 @@ #include #include -#include "config.h" #include "image.h" #include "options.h" #include "thumbs.h" #include "util.h" #include "window.h" -#if EXT_COMMANDS -#include "commands.h" -#endif - #define FNAME_CNT 1024 #define TITLE_LEN 256 @@ -48,11 +43,20 @@ #define TO_CURSOR_HIDE 1500000 #define TO_THUMBS_LOAD 75000 +typedef struct { + KeySym ksym; + Bool reload; + const char *cmdline; +} command_t; + typedef enum { MODE_NORMAL = 0, MODE_THUMBS } appmode_t; +#define MAIN_C +#include "config.h" + void run(); appmode_t mode;