diff options
-rw-r--r-- | src/common.h | 6 | ||||
-rw-r--r-- | src/dls.cpp | 2 | ||||
-rw-r--r-- | src/dls.h | 1 | ||||
-rw-r--r-- | src/sls.cpp | 12 |
4 files changed, 14 insertions, 7 deletions
diff --git a/src/common.h b/src/common.h index a2981c4..699e7c3 100644 --- a/src/common.h +++ b/src/common.h @@ -33,6 +33,12 @@ #endif +// ANSI colors +#define ODR_COLOR_DL "\x1B[36m" // DL text +#define ODR_COLOR_SLS "\x1B[33m" // SLS image +#define ODR_COLOR_RST "\x1B[0m" // reset + + #include <string> #include <vector> #include <sstream> diff --git a/src/dls.cpp b/src/dls.cpp index cec806a..5cf694a 100644 --- a/src/dls.cpp +++ b/src/dls.cpp @@ -246,7 +246,7 @@ void DLSManager::writeDLS(const std::string& dls_file, const DL_PARAMS& dl_param // toggle the toggle bit only on new DL state bool dl_state_is_new = dl_state != dl_state_prev; if (verbose) { - fprintf(stderr, "ODR-PadEnc writing %s DLS text \"" "\x1B[36m" "%s" "\x1B[0m" "\"\n", dl_state_is_new ? "new" : "old", dl_state.dl_text.c_str()); + fprintf(stderr, "ODR-PadEnc writing %s DLS text \"" ODR_COLOR_DL "%s" ODR_COLOR_RST "\"\n", dl_state_is_new ? "new" : "old", dl_state.dl_text.c_str()); if (dl_state.dl_plus_enabled) { fprintf( stderr, "ODR-PadEnc writing %s DL Plus tags (IT/IR: %d/%d): ", @@ -33,6 +33,7 @@ #include <fstream> #include <iostream> +#include "common.h" #include "pad_common.h" #include "charset.h" diff --git a/src/sls.cpp b/src/sls.cpp index 6312b0d..9df7824 100644 --- a/src/sls.cpp +++ b/src/sls.cpp @@ -334,7 +334,7 @@ bool SLSManager::encodeFile(const std::string& fname, int fidx, bool raw_slides) native_support = true; if (verbose) { - fprintf(stderr, "ODR-PadEnc image: '" "\x1B[33m" "%s" "\x1B[0m" "' (id=%d)." + fprintf(stderr, "ODR-PadEnc image: '" ODR_COLOR_SLS "%s" ODR_COLOR_RST "' (id=%d)." " Original size: %zu x %zu. (%s, q=%zu, progr=%s)\n", fname.c_str(), fidx, width, height, orig_format, orig_quality, jpeg_progr ? "y" : "n"); } @@ -344,13 +344,13 @@ bool SLSManager::encodeFile(const std::string& fname, int fidx, bool raw_slides) jfif_not_png = false; if (verbose) { - fprintf(stderr, "ODR-PadEnc image: '" "\x1B[33m" "%s" "\x1B[0m" "' (id=%d)." + fprintf(stderr, "ODR-PadEnc image: '" ODR_COLOR_SLS "%s" ODR_COLOR_RST "' (id=%d)." " Original size: %zu x %zu. (%s)\n", fname.c_str(), fidx, width, height, orig_format); } } else if (verbose) { - fprintf(stderr, "ODR-PadEnc image: '" "\x1B[33m" "%s" "\x1B[0m" "' (id=%d)." + fprintf(stderr, "ODR-PadEnc image: '" ODR_COLOR_SLS "%s" ODR_COLOR_RST "' (id=%d)." " Original size: %zu x %zu. (%s)\n", fname.c_str(), fidx, width, height, orig_format); } @@ -361,7 +361,7 @@ bool SLSManager::encodeFile(const std::string& fname, int fidx, bool raw_slides) fprintf(stderr, "ODR-PadEnc Warning: Unable to detect image format of '%s'\n", fname.c_str()); - fprintf(stderr, "ODR-PadEnc image: '" "\x1B[33m" "%s" "\x1B[0m" "' (id=%d). Original size: %zu x %zu.\n", + fprintf(stderr, "ODR-PadEnc image: '" ODR_COLOR_SLS "%s" ODR_COLOR_RST "' (id=%d). Original size: %zu x %zu.\n", fname.c_str(), fidx, width, height); } @@ -371,7 +371,7 @@ bool SLSManager::encodeFile(const std::string& fname, int fidx, bool raw_slides) if (blobsize <= MAXSLIDESIZE) { if (verbose) { - fprintf(stderr, "ODR-PadEnc image: '" "\x1B[33m" "%s" "\x1B[0m" "' (id=%d). No resize needed: %zu Bytes\n", + fprintf(stderr, "ODR-PadEnc image: '" ODR_COLOR_SLS "%s" ODR_COLOR_RST "' (id=%d). No resize needed: %zu Bytes\n", fname.c_str(), fidx, blobsize); } resize_required = false; @@ -408,7 +408,7 @@ bool SLSManager::encodeFile(const std::string& fname, int fidx, bool raw_slides) rewind(pFile); if (verbose) { - fprintf(stderr, "ODR-PadEnc image: '" "\x1B[33m" "%s" "\x1B[0m" "' (id=%d). Raw file: %zu Bytes\n", + fprintf(stderr, "ODR-PadEnc image: '" ODR_COLOR_SLS "%s" ODR_COLOR_RST "' (id=%d). Raw file: %zu Bytes\n", fname.c_str(), fidx, blobsize); } |