clang-tidy: modernize-macro-to-enum
authorColin Clark <colin.clark@cclark.uk>
Wed, 7 Feb 2024 12:26:09 +0000 (12:26 +0000)
committerColin Clark <colin.clark@cclark.uk>
Wed, 7 Feb 2024 12:26:09 +0000 (12:26 +0000)
- Fix warnings identified by this flag
- Remove the exclude from .clang-tidy file

Clang-tidy fix resulted in indentation dissimilar to that used so far.

This awk script was run on the .diff file:
/^+[A-Z]/  {
sub (/\+/,"+\t",$0)
print
next
}

$0 !~ /^+[A-Z]/  {
print
next
}

The following files were hand-edited:
thumb-standard.cc
ui-bookmark.cc

39 files changed:
src/advanced-exif.cc
src/bar-exif.cc
src/cache-maint.cc
src/cache.cc
src/cellrenderericon.cc
src/collect-io.cc
src/collect-table.cc
src/collect.cc
src/desktop-file.cc
src/dupe.cc
src/editors.cc
src/histogram.cc
src/image-load-dds.cc
src/image-load-psd.cc
src/image-load.cc
src/image-overlay.cc
src/jpeg-parser.cc
src/layout-config.cc
src/layout-image.cc
src/layout-util.cc
src/layout.cc
src/misc.cc
src/pan-view/pan-calendar.cc
src/pan-view/pan-view.cc
src/pixbuf-renderer.cc
src/pixbuf-util.cc
src/preferences.cc
src/print.cc
src/remote.cc
src/renderer-tiles.cc
src/search.cc
src/thumb-standard.cc
src/ui-bookmark.cc
src/ui-help.cc
src/ui-pathsel.cc
src/ui-tree-edit.cc
src/utilops.cc
src/view-file/view-file-icon.cc
src/view-file/view-file-list.cc

index bcc1c25..dba400d 100644 (file)
@@ -31,7 +31,9 @@
 #include "window.h"
 #include "dnd.h"
 
-#define ADVANCED_EXIF_DATA_COLUMN_WIDTH 200
+enum {
+       ADVANCED_EXIF_DATA_COLUMN_WIDTH = 200
+};
 
 /*
  *-------------------------------------------------------------------
index 0eaf5f7..82b7b79 100644 (file)
@@ -34,7 +34,9 @@
 #include "ui-misc.h"
 #include "ui-utildlg.h"
 
-#define MIN_HEIGHT 25
+enum {
+       MIN_HEIGHT = 25
+};
 /*
  *-------------------------------------------------------------------
  * EXIF widget
index f7cf7c4..d7dff19 100644 (file)
@@ -51,7 +51,9 @@ struct CMData
        gboolean remote;
 };
 
-#define PURGE_DIALOG_WIDTH 400
+enum {
+       PURGE_DIALOG_WIDTH = 400
+};
 
 /*
  *-----------------------------------------------------------------------------
index 118123b..3d1cf22 100644 (file)
@@ -393,7 +393,9 @@ static gboolean cache_sim_read_similarity(FILE *f, gchar *buf, gint s, CacheData
        return FALSE;
 }
 
-#define CACHE_LOAD_LINE_NOISE 8
+enum {
+       CACHE_LOAD_LINE_NOISE = 8
+};
 
 CacheData *cache_sim_data_load(const gchar *path)
 {
index 322f5ef..75449f5 100644 (file)
@@ -20,7 +20,9 @@
 #include "main.h"
 #include "cellrenderericon.h"
 
-#define FIXED_ICON_SIZE_MAX 512
+enum {
+       FIXED_ICON_SIZE_MAX = 512
+};
 
 
 static void gqv_cell_renderer_icon_get_property(GObject                *object,
index 4093734..a60938a 100644 (file)
 
 #define GQ_COLLECTION_MARKER "#" GQ_APPNAME
 
-#define GQ_COLLECTION_FAIL_MIN     300
-#define GQ_COLLECTION_FAIL_PERCENT 98
-#define GQ_COLLECTION_READ_BUFSIZE 4096
+enum {
+       GQ_COLLECTION_FAIL_MIN =     300,
+       GQ_COLLECTION_FAIL_PERCENT = 98,
+       GQ_COLLECTION_READ_BUFSIZE = 4096
+};
 
 struct CollectManagerEntry;
 
@@ -475,8 +477,10 @@ gboolean collection_load_only_geometry(CollectionData *cd, const gchar *path)
  *-------------------------------------------------------------------
  */
 
-#define COLLECT_MANAGER_ACTIONS_PER_IDLE 1000
-#define COLLECT_MANAGER_FLUSH_DELAY      10000
+enum {
+       COLLECT_MANAGER_ACTIONS_PER_IDLE = 1000,
+       COLLECT_MANAGER_FLUSH_DELAY =      10000
+};
 
 struct CollectManagerEntry
 {
index 61944d6..8f1af77 100644 (file)
 #include "view-file.h"
 
 /* between these, the icon width is increased by thumb_max_width / 2 */
-#define THUMB_MIN_ICON_WIDTH 128
-#define THUMB_MAX_ICON_WIDTH 150
-
-#define COLLECT_TABLE_MAX_COLUMNS 32
-#define THUMB_BORDER_PADDING 2
+enum {
+       THUMB_MIN_ICON_WIDTH = 128,
+       THUMB_MAX_ICON_WIDTH = 150
+};
 
-#define COLLECT_TABLE_TIP_DELAY 500
-#define COLLECT_TABLE_TIP_DELAY_PATH (COLLECT_TABLE_TIP_DELAY * 1.7)
+enum {
+       COLLECT_TABLE_MAX_COLUMNS = 32,
+       THUMB_BORDER_PADDING = 2
+};
 
+enum {
+       COLLECT_TABLE_TIP_DELAY = 500,
+       COLLECT_TABLE_TIP_DELAY_PATH = 850
+};
 
 enum {
        CTABLE_COLUMN_POINTER = 0,
index e3fd820..8a73598 100644 (file)
 #include "utilops.h"
 #include "window.h"
 
-#define COLLECT_DEF_WIDTH 440
-#define COLLECT_DEF_HEIGHT 450
+enum {
+       COLLECT_DEF_WIDTH = 440,
+       COLLECT_DEF_HEIGHT = 450
+};
 
 /**
  *  list of paths to collections */
index bd97241..6879fa3 100644 (file)
 #include "utilops.h"
 #include "window.h"
 
-#define CONFIG_WINDOW_DEF_WIDTH                700
-#define CONFIG_WINDOW_DEF_HEIGHT       400
+enum {
+       CONFIG_WINDOW_DEF_WIDTH =               700,
+       CONFIG_WINDOW_DEF_HEIGHT =      400
+};
 
 
 
index 2e84522..c67fca8 100644 (file)
 #include <cmath>
 
 
-#define DUPE_DEF_WIDTH 800
-#define DUPE_DEF_HEIGHT 400
+enum {
+       DUPE_DEF_WIDTH = 800,
+       DUPE_DEF_HEIGHT = 400
+};
 #define DUPE_PROGRESS_PULSE_STEP 0.0001
 
 /** column assignment order (simply change them here)
@@ -3967,7 +3969,9 @@ static void dupe_menu_setup(DupeWindow *dw)
 
 /* this overrides the low default of a GtkCellRenderer from 100 to CELL_HEIGHT_OVERRIDE, something sane for our purposes */
 
-#define CELL_HEIGHT_OVERRIDE 512
+enum {
+       CELL_HEIGHT_OVERRIDE = 512
+};
 
 void cell_renderer_height_override(GtkCellRenderer *renderer)
 {
index 58a8e02..9bf3c3c 100644 (file)
 #include "ui-fileops.h"
 #include "utilops.h"
 
-#define EDITOR_WINDOW_WIDTH 500
-#define EDITOR_WINDOW_HEIGHT 300
+enum {
+       EDITOR_WINDOW_WIDTH = 500,
+       EDITOR_WINDOW_HEIGHT = 300
+};
 
 
 
index 3f858e8..019de2d 100644 (file)
@@ -32,7 +32,9 @@
  *----------------------------------------------------------------------------
  */
 
-#define HISTMAP_SIZE 256
+enum {
+       HISTMAP_SIZE = 256
+};
 
 struct HistMap {
        gulong r[HISTMAP_SIZE];
index 0cfe9e6..7842794 100644 (file)
@@ -89,21 +89,23 @@ uint ddsGetAlphaMask(unsigned const char * buffer) {
 }
 
 // Image Type
-#define DXT1 (0x44585431)
-#define DXT2 (0x44585432)
-#define DXT3 (0x44585433)
-#define DXT4 (0x44585434)
-#define DXT5 (0x44585435)
-#define A1R5G5B5 ((1 << 16) | 2)
-#define X1R5G5B5 ((2 << 16) | 2)
-#define A4R4G4B4 ((3 << 16) | 2)
-#define X4R4G4B4 ((4 << 16) | 2)
-#define R5G6B5 ((5 << 16) | 2)
-#define R8G8B8 ((1 << 16) | 3)
-#define A8B8G8R8 ((1 << 16) | 4)
-#define X8B8G8R8 ((2 << 16) | 4)
-#define A8R8G8B8 ((3 << 16) | 4)
-#define X8R8G8B8 ((4 << 16) | 4)
+enum {
+       DXT1 = (0x44585431),
+       DXT2 = (0x44585432),
+       DXT3 = (0x44585433),
+       DXT4 = (0x44585434),
+       DXT5 = (0x44585435),
+       A1R5G5B5 = ((1 << 16) | 2),
+       X1R5G5B5 = ((2 << 16) | 2),
+       A4R4G4B4 = ((3 << 16) | 2),
+       X4R4G4B4 = ((4 << 16) | 2),
+       R5G6B5 = ((5 << 16) | 2),
+       R8G8B8 = ((1 << 16) | 3),
+       A8B8G8R8 = ((1 << 16) | 4),
+       X8B8G8R8 = ((2 << 16) | 4),
+       A8R8G8B8 = ((3 << 16) | 4),
+       X8R8G8B8 = ((4 << 16) | 4)
+};
 
 // RGBA Masks
 static const uint A1R5G5B5_MASKS[] = { 0x7C00, 0x03E0, 0x001F, 0x8000 };
index 6fb9e5f..92f1239 100644 (file)
@@ -76,7 +76,9 @@ struct PsdHeader
        guint16 color_mode;    /* color mode as defined below */
 };
 
-#define PSD_HEADER_SIZE 26
+enum {
+       PSD_HEADER_SIZE = 26
+};
 
 enum PsdColorMode
 {
index da06b41..22bca7e 100644 (file)
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#define IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT  4096
-#define IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT      1
+enum {
+       IMAGE_LOADER_READ_BUFFER_SIZE_DEFAULT =         4096,
+       IMAGE_LOADER_IDLE_READ_LOOP_COUNT_DEFAULT =     1
+};
 
 /* image loader class */
 
index 1883637..abe1381 100644 (file)
@@ -86,10 +86,14 @@ static OSDIcon osd_icons[] = {
 
 #define OSD_DATA "overlay-data"
 
-#define IMAGE_OSD_DEFAULT_DURATION 30
+enum {
+       IMAGE_OSD_DEFAULT_DURATION = 30
+};
 
-#define HISTOGRAM_HEIGHT 140
-#define HISTOGRAM_WIDTH  256
+enum {
+       HISTOGRAM_HEIGHT = 140,
+       HISTOGRAM_WIDTH =  256
+};
 
 static void image_osd_timer_schedule(OverlayStateData *osd);
 
index 96e0b3d..09b998a 100644 (file)
@@ -65,11 +65,13 @@ enum TiffByteOrder {
        TIFF_BYTE_ORDER_MOTOROLA
 };
 
-#define TIFF_TIFD_OFFSET_TAG 0
-#define TIFF_TIFD_OFFSET_FORMAT 2
-#define TIFF_TIFD_OFFSET_COUNT 4
-#define TIFF_TIFD_OFFSET_DATA 8
-#define TIFF_TIFD_SIZE 12
+enum {
+       TIFF_TIFD_OFFSET_TAG = 0,
+       TIFF_TIFD_OFFSET_FORMAT = 2,
+       TIFF_TIFD_OFFSET_COUNT = 4,
+       TIFF_TIFD_OFFSET_DATA = 8,
+       TIFF_TIFD_SIZE = 12
+};
 
 
 
index 6dccf1f..51a56bd 100644 (file)
@@ -231,7 +231,9 @@ static void layout_config_table_button(GtkWidget *table, LayoutLocation l, const
        gtk_widget_show(button);
 }
 
-#define LAYOUT_STYLE_SIZE 48
+enum {
+       LAYOUT_STYLE_SIZE = 48
+};
 
 static GtkWidget *layout_config_widget(GtkWidget *group, GtkWidget *box, gint style, LayoutConfig *lc)
 {
index 49fea7f..0c98ab5 100644 (file)
@@ -45,7 +45,9 @@
 #include "utilops.h"
 #include "view-file.h"
 
-#define FILE_COLUMN_POINTER 0
+enum {
+       FILE_COLUMN_POINTER = 0
+};
 
 static GtkWidget *layout_image_pop_menu(LayoutWindow *lw);
 static void layout_image_set_buttons(LayoutWindow *lw);
index 5dc2ff5..1ebbb2e 100644 (file)
 #include <sys/wait.h>
 #include "keymap-template.h"
 
-#define MENU_EDIT_ACTION_OFFSET 16
-#define FILE_COLUMN_POINTER 0
+enum {
+       MENU_EDIT_ACTION_OFFSET = 16,
+       FILE_COLUMN_POINTER = 0
+};
 
 static gboolean layout_bar_enabled(LayoutWindow *lw);
 static gboolean layout_bar_sort_enabled(LayoutWindow *lw);
index 43c6bf5..a911a67 100644 (file)
 #include <gdk/gdkx.h>
 #endif
 
-#define MAINWINDOW_DEF_WIDTH 700
-#define MAINWINDOW_DEF_HEIGHT 500
+enum {
+       MAINWINDOW_DEF_WIDTH = 700,
+       MAINWINDOW_DEF_HEIGHT = 500
+};
 
 #define MAIN_WINDOW_DIV_HPOS (MAINWINDOW_DEF_WIDTH / 2)
 #define MAIN_WINDOW_DIV_VPOS (MAINWINDOW_DEF_HEIGHT / 2)
 
-#define TOOLWINDOW_DEF_WIDTH 260
-#define TOOLWINDOW_DEF_HEIGHT 450
+enum {
+       TOOLWINDOW_DEF_WIDTH = 260,
+       TOOLWINDOW_DEF_HEIGHT = 450
+};
 
-#define PROGRESS_WIDTH 150
-#define ZOOM_LABEL_WIDTH 120
+enum {
+       PROGRESS_WIDTH = 150,
+       ZOOM_LABEL_WIDTH = 120
+};
 
-#define PANE_DIVIDER_SIZE 10
+enum {
+       PANE_DIVIDER_SIZE = 10
+};
 
 
 GList *layout_window_list = nullptr;
@@ -2224,8 +2232,10 @@ void layout_info_pixel_set(LayoutWindow *lw, gboolean show)
  *-----------------------------------------------------------------------------
  */
 
-#define CONFIG_WINDOW_DEF_WIDTH                600
-#define CONFIG_WINDOW_DEF_HEIGHT       400
+enum {
+       CONFIG_WINDOW_DEF_WIDTH =               600,
+       CONFIG_WINDOW_DEF_HEIGHT =      400
+};
 
 struct LayoutConfig
 {
index 053efbf..ceba42e 100644 (file)
@@ -135,7 +135,9 @@ gchar *expand_tilde(const gchar *filename)
  */
 
 #define GEOCODE_NAME "geocode-parameters.awk"
-#define BUFSIZE 128
+enum {
+       BUFSIZE = 128
+};
 
 gchar *decode_geo_script(const gchar *path_dir, const gchar *input_text)
 {
index 54e70d0..668d91f 100644 (file)
 #include "pixbuf-util.h"
 
 #define PAN_CAL_POPUP_COLOR 220, 220, 220
-#define PAN_CAL_POPUP_ALPHA 255
-#define PAN_CAL_POPUP_BORDER 1
+enum {
+       PAN_CAL_POPUP_ALPHA = 255,
+       PAN_CAL_POPUP_BORDER = 1
+};
 #define PAN_CAL_POPUP_BORDER_COLOR 0, 0, 0
 #define PAN_CAL_POPUP_TEXT_COLOR 0, 0, 0
 
-#define PAN_CAL_DAY_WIDTH 100
-#define PAN_CAL_DAY_HEIGHT 80
+enum {
+       PAN_CAL_DAY_WIDTH = 100,
+       PAN_CAL_DAY_HEIGHT = 80
+};
 
 #define PAN_CAL_DAY_COLOR 255, 255, 255
-#define PAN_CAL_DAY_ALPHA 220
-#define PAN_CAL_DAY_BORDER 2
+enum {
+       PAN_CAL_DAY_ALPHA = 220,
+       PAN_CAL_DAY_BORDER = 2
+};
 #define PAN_CAL_DAY_BORDER_COLOR 0, 0, 0
 #define PAN_CAL_DAY_TEXT_COLOR 0, 0, 0
 
 #define PAN_CAL_MONTH_COLOR 255, 255, 255
-#define PAN_CAL_MONTH_ALPHA 200
-#define PAN_CAL_MONTH_BORDER 4
+enum {
+       PAN_CAL_MONTH_ALPHA = 200,
+       PAN_CAL_MONTH_BORDER = 4
+};
 #define PAN_CAL_MONTH_BORDER_COLOR 0, 0, 0
 #define PAN_CAL_MONTH_TEXT_COLOR 0, 0, 0
 
-#define PAN_CAL_DOT_SIZE 3
-#define PAN_CAL_DOT_GAP 2
+enum {
+       PAN_CAL_DOT_SIZE = 3,
+       PAN_CAL_DOT_GAP = 2
+};
 #define PAN_CAL_DOT_COLOR 128, 128, 128
-#define PAN_CAL_DOT_ALPHA 128
+enum {
+       PAN_CAL_DOT_ALPHA = 128
+};
 
 #define PAN_CAL_DAY_OF_WEEK_COLOR 128, 128, 128
 
index 0e2482f..d067aee 100644 (file)
 #include <cmath>
 
 
-#define PAN_WINDOW_DEFAULT_WIDTH 720
-#define PAN_WINDOW_DEFAULT_HEIGHT 500
+enum {
+       PAN_WINDOW_DEFAULT_WIDTH = 720,
+       PAN_WINDOW_DEFAULT_HEIGHT = 500
+};
 
-#define PAN_TILE_SIZE 512
+enum {
+       PAN_TILE_SIZE = 512
+};
 
 #define ZOOM_INCREMENT 1.0
-#define ZOOM_LABEL_WIDTH 64
+enum {
+       ZOOM_LABEL_WIDTH = 64
+};
 
 
 #define PAN_PREF_GROUP         "pan_view_options"
index 2e95b98..7e5d58e 100644 (file)
@@ -58,19 +58,27 @@ enum ExifOrientationType {
 #define PR_ZOOM_MAX 32.0
 
 /* distance to drag mouse to disable image flip */
-#define PR_DRAG_SCROLL_THRESHHOLD 4
+enum {
+       PR_DRAG_SCROLL_THRESHHOLD = 4
+};
 
 /* increase pan rate when holding down shift */
-#define PR_PAN_SHIFT_MULTIPLIER 6
+enum {
+       PR_PAN_SHIFT_MULTIPLIER = 6
+};
 
 /* scroller config */
-#define PR_SCROLLER_UPDATES_PER_SEC 30
-#define PR_SCROLLER_DEAD_ZONE 6
+enum {
+       PR_SCROLLER_UPDATES_PER_SEC = 30,
+       PR_SCROLLER_DEAD_ZONE = 6
+};
 
 /* when scaling image to below this size, use nearest pixel for scaling
  * (below about 4, the other scale types become slow generating their conversion tables)
  */
-#define PR_MIN_SCALE_SIZE 8
+//~ enum {
+//~ PR_MIN_SCALE_SIZE = 8
+//~ };
 
 enum {
        SIGNAL_ZOOM = 0,
@@ -2213,10 +2221,12 @@ static void pr_signals_connect(PixbufRenderer *pr)
  *-------------------------------------------------------------------
  */
 
-#define COLOR_BYTES 3   /* rgb */
-#define RC 0            /* Red-Cyan */
-#define GM 1            /* Green-Magenta */
-#define YB 2            /* Yellow-Blue */
+enum {
+       COLOR_BYTES = 3,   /* rgb */
+       RC = 0,            /* Red-Cyan */
+       GM = 1,            /* Green-Magenta */
+       YB = 2            /* Yellow-Blue */
+};
 
 static void pr_create_anaglyph_color(GdkPixbuf *pixbuf, GdkPixbuf *right, gint x, gint y, gint w, gint h, guint mode)
 {
index c2780e2..4a140c5 100644 (file)
@@ -452,8 +452,10 @@ static void pixbuf_copy_block(guchar *src, gint src_row_stride, gint w, gint h,
                }
 }
 
-#define ROTATE_BUFFER_WIDTH 48
-#define ROTATE_BUFFER_HEIGHT 48
+enum {
+       ROTATE_BUFFER_WIDTH = 48,
+       ROTATE_BUFFER_HEIGHT = 48
+};
 
 /*
  * Returns a copy of pixbuf src rotated 90 degrees clockwise or 90 counterclockwise
index 6470c6e..d7225ca 100644 (file)
 #include <gspell/gspell.h>
 #endif
 
-#define EDITOR_NAME_MAX_LENGTH 32
-#define EDITOR_COMMAND_MAX_LENGTH 1024
+enum {
+       EDITOR_NAME_MAX_LENGTH = 32,
+       EDITOR_COMMAND_MAX_LENGTH = 1024
+};
 
 static void image_overlay_set_text_colors();
 
@@ -155,8 +157,10 @@ static GtkWidget *help_search_engine_entry;
 static GtkWidget *log_window_f1_entry;
 
 
-#define CONFIG_WINDOW_DEF_WIDTH                700
-#define CONFIG_WINDOW_DEF_HEIGHT       600
+enum {
+       CONFIG_WINDOW_DEF_WIDTH =               700,
+       CONFIG_WINDOW_DEF_HEIGHT =      600
+};
 
 /*
  *-----------------------------------------------------------------------------
@@ -2460,7 +2464,9 @@ static void config_tab_windows(GtkWidget *notebook)
                              options->fullscreen.disable_saver, &c_options->fullscreen.disable_saver);
 }
 
-#define PRE_FORMATTED_COLUMNS 5
+enum {
+       PRE_FORMATTED_COLUMNS = 5
+};
 static void config_tab_osd(GtkWidget *notebook)
 {
        GtkWidget *hbox;
@@ -2998,7 +3004,9 @@ struct KeywordFindData
        guint idle_id; /* event source id */
 };
 
-#define KEYWORD_DIALOG_WIDTH 400
+enum {
+       KEYWORD_DIALOG_WIDTH = 400
+};
 
 static void keywords_find_folder(KeywordFindData *kfd, FileData *dir_fd)
 {
index 9073943..33ffa73 100644 (file)
@@ -343,7 +343,9 @@ static void image_text_template_view_changed_cb(GtkWidget *, gpointer data)
                                          gtk_text_buffer_get_text(pTextBuffer, &iStart, &iEnd, TRUE));
 }
 
-#define PRE_FORMATTED_COLUMNS 4
+enum {
+       PRE_FORMATTED_COLUMNS = 4
+};
 static void print_text_menu(GtkWidget *box, PrintWindow *pw)
 {
        GtkWidget *group;
index 451b5be..e13be4b 100644 (file)
 
 #include "glua.h"
 
-#define SERVER_MAX_CLIENTS 8
+enum {
+       SERVER_MAX_CLIENTS = 8
+};
 
-#define REMOTE_SERVER_BACKLOG 4
+enum {
+       REMOTE_SERVER_BACKLOG = 4
+};
 
 
 #ifndef UNIX_PATH_MAX
index 9a3fb81..e92e7c9 100644 (file)
@@ -852,7 +852,9 @@ static GdkPixbuf *rt_get_spare_tile(RendererTiles *rt)
        return rt->spare_tile;
 }
 
-#define COLOR_BYTES 3  /* rgb */
+enum {
+       COLOR_BYTES = 3 /* rgb */
+};
 
 static void rt_tile_rotate_90_clockwise(RendererTiles *rt, GdkPixbuf **tile, gint x, gint y, gint w, gint h)
 {
index f35cd43..08400f9 100644 (file)
 
 #include <cmath>
 
-#define DEF_SEARCH_WIDTH  700
-#define DEF_SEARCH_HEIGHT 650
+enum {
+       DEF_SEARCH_WIDTH =  700,
+       DEF_SEARCH_HEIGHT = 650
+};
 
-#define SEARCH_BUFFER_MATCH_LOAD 20
-#define SEARCH_BUFFER_MATCH_HIT  5
-#define SEARCH_BUFFER_MATCH_MISS 1
-#define SEARCH_BUFFER_FLUSH_SIZE 99
+enum {
+       SEARCH_BUFFER_MATCH_LOAD = 20,
+       SEARCH_BUFFER_MATCH_HIT =  5,
+       SEARCH_BUFFER_MATCH_MISS = 1,
+       SEARCH_BUFFER_FLUSH_SIZE = 99
+};
 
 #define FORMAT_CLASS_BROKEN static_cast<FileFormatClass>(FILE_FORMAT_CLASSES + 1)
 
index ef803d4..a78212e 100644 (file)
  */
 
 
-#define THUMB_SIZE_NORMAL 128
-#define THUMB_SIZE_LARGE  256
+enum {
+       THUMB_SIZE_NORMAL = 128,
+       THUMB_SIZE_LARGE =  256
+};
 
 #define THUMB_MARKER_URI    "tEXt::Thumb::URI"
 #define THUMB_MARKER_MTIME  "tEXt::Thumb::MTime"
 #define THUMB_MARKER_HEIGHT "tEXt::Thumb::Image::Height"
 #define THUMB_MARKER_APP    "tEXt::Software"
 
-#define THUMB_PERMS_FOLDER 0700
-#define THUMB_PERMS_THUMB  0600
-
-
-
 /*
  *-----------------------------------------------------------------------------
  * thumbnail loader
@@ -328,7 +325,7 @@ static void thumb_loader_std_save(ThumbLoaderStd *tl, GdkPixbuf *pixbuf)
                }
        else
                {
-               recursive_mkdir_if_not_exists(base_path, THUMB_PERMS_FOLDER);
+               recursive_mkdir_if_not_exists(base_path, S_IRWXU);
                }
        g_free(base_path);
 
@@ -357,7 +354,7 @@ static void thumb_loader_std_save(ThumbLoaderStd *tl, GdkPixbuf *pixbuf)
                                          NULL);
                if (success)
                        {
-                       chmod(pathl, (tl->cache_local) ? tl->source_mode : THUMB_PERMS_THUMB);
+                       chmod(pathl, (tl->cache_local) ? tl->source_mode : S_IRUSR & S_IWUSR);
                        success = rename_file(tmp_path, tl->thumb_path);
                        }
 
index 3bb0f54..1a89354 100644 (file)
@@ -96,13 +96,17 @@ static GtkTargetEntry bookmark_drop_types[] = {
        { const_cast<gchar *>("x-url/http"),    0, TARGET_X_URL },
        { const_cast<gchar *>("_NETSCAPE_URL"), 0, TARGET_X_URL }
 };
-#define bookmark_drop_types_n 3
+enum {
+       bookmark_drop_types_n = 3
+};
 
 static GtkTargetEntry bookmark_drag_types[] = {
        { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
        { const_cast<gchar *>("text/plain"),    0, TARGET_TEXT_PLAIN }
 };
-#define bookmark_drag_types_n 2
+enum {
+       bookmark_drag_types_n = 2
+};
 
 
 static GList *bookmark_widget_list = nullptr;
index 3e9832a..065264c 100644 (file)
 #include "window.h"
 
 
-#define HELP_WINDOW_WIDTH 650
-#define HELP_WINDOW_HEIGHT 350
+enum {
+       HELP_WINDOW_WIDTH = 650,
+       HELP_WINDOW_HEIGHT = 350
+};
 
 
 /*
index 1fdf999..79dfde4 100644 (file)
 #include "utilops.h"
 
 
-#define DEST_WIDTH 250
-#define DEST_HEIGHT 210
+enum {
+       DEST_WIDTH = 250,
+       DEST_HEIGHT = 210
+};
 
-#define RENAME_PRESS_DELAY 333 /* 1/3 second, to allow double clicks */
+enum {
+       RENAME_PRESS_DELAY = 333        /* 1/3 second, to allow double clicks */
+};
 
 #define PATH_SEL_USE_HEADINGS FALSE
 
@@ -319,7 +323,9 @@ static GtkTargetEntry dest_drag_types[] = {
        { const_cast<gchar *>("text/uri-list"), 0, TARGET_URI_LIST },
        { const_cast<gchar *>("text/plain"),    0, TARGET_TEXT_PLAIN }
 };
-#define dest_drag_types_n 2
+enum {
+       dest_drag_types_n = 2
+};
 
 
 static void dest_dnd_set_data(GtkWidget *view, GdkDragContext *,
index 2a53ce6..2921d0d 100644 (file)
@@ -519,8 +519,10 @@ void shift_color(GdkRGBA *src, gshort val, gint direction)
  *-------------------------------------------------------------------
  */
 
-#define AUTO_SCROLL_DEFAULT_SPEED 100
-#define AUTO_SCROLL_DEFAULT_REGION 20
+enum {
+       AUTO_SCROLL_DEFAULT_SPEED = 100,
+       AUTO_SCROLL_DEFAULT_REGION = 20
+};
 
 struct AutoScrollData
 {
index 63bfb0c..19a51b6 100644 (file)
@@ -81,7 +81,9 @@ GdkPixbuf *file_util_get_error_icon(FileData *fd, GList *list, GtkWidget *widget
 
 }
 
-#define DIALOG_WIDTH 750
+enum {
+       DIALOG_WIDTH = 750
+};
 
 enum ClipboardDestination {
        CLIPBOARD_TEXT_PLAIN    = 0,
@@ -111,8 +113,10 @@ struct ClipboardData
  *--------------------------------------------------------------------------
  */
 
-#define DIALOG_DEF_IMAGE_DIM_X 150
-#define DIALOG_DEF_IMAGE_DIM_Y 100
+enum {
+       DIALOG_DEF_IMAGE_DIM_X = 150,
+       DIALOG_DEF_IMAGE_DIM_Y = 100
+};
 
 static void generic_dialog_add_image(GenericDialog *gd, GtkWidget *box,
                                     FileData *fd1, const gchar *header1,
@@ -477,11 +481,15 @@ static void generic_dialog_image_set(UtilityData *ud, FileData *fd)
 
 static gboolean file_util_write_metadata_first(UtilityType type, UtilityPhase phase, GList *flist, const gchar *dest_path, const gchar *editor_key, GtkWidget *parent);
 
-#define UTILITY_LIST_MIN_WIDTH  250
-#define UTILITY_LIST_MIN_HEIGHT 150
+enum {
+       UTILITY_LIST_MIN_WIDTH =  250,
+       UTILITY_LIST_MIN_HEIGHT = 150
+};
 
 /* thumbnail spec has a max depth of 4 (.thumb??/fail/appname/??.png) */
-#define UTILITY_DELETE_MAX_DEPTH 5
+enum {
+       UTILITY_DELETE_MAX_DEPTH = 5
+};
 
 static UtilityData *file_util_data_new(UtilityType type)
 {
index 8fc272f..d376740 100644 (file)
 #include "view-file.h"
 
 /* between these, the icon width is increased by thumb_max_width / 2 */
-#define THUMB_MIN_ICON_WIDTH 128
-#define THUMB_MAX_ICON_WIDTH 160
+enum {
+       THUMB_MIN_ICON_WIDTH = 128,
+       THUMB_MAX_ICON_WIDTH = 160
+};
 #define THUMB_MIN_ICON_WIDTH_WITH_MARKS TOGGLE_SPACING * FILEDATA_MARKS_SIZE
 
-#define VFICON_MAX_COLUMNS 32
-#define THUMB_BORDER_PADDING 2
+enum {
+       VFICON_MAX_COLUMNS = 32,
+       THUMB_BORDER_PADDING = 2
+};
 
-#define VFICON_TIP_DELAY 500
+enum {
+       VFICON_TIP_DELAY = 500
+};
 
 enum {
        FILE_COLUMN_POINTER = 0,
index a65e3df..f41a4b3 100644 (file)
@@ -1936,7 +1936,9 @@ gboolean vflist_refresh(ViewFile *vf)
 
 /* this overrides the low default of a GtkCellRenderer from 100 to CELL_HEIGHT_OVERRIDE, something sane for our purposes */
 
-#define CELL_HEIGHT_OVERRIDE 512
+enum {
+       CELL_HEIGHT_OVERRIDE = 512
+};
 
 static void cell_renderer_height_override(GtkCellRenderer *renderer)
 {