aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2017-04-07 23:54:53 +0200
committerStefan Pöschel <github@basicmaster.de>2017-04-07 23:55:20 +0200
commitd0f13d44c93862948664eae14584c5e31f8ba745 (patch)
treef754d4001a4bc86a1b52993f52e38d38f594853f /src
parent78ca13d1a7d837008ef5339746773b2abbf3ca2f (diff)
downloadODR-PadEnc-d0f13d44c93862948664eae14584c5e31f8ba745.tar.gz
ODR-PadEnc-d0f13d44c93862948664eae14584c5e31f8ba745.tar.bz2
ODR-PadEnc-d0f13d44c93862948664eae14584c5e31f8ba745.zip
Move ANSI color tokens to common part
Diffstat (limited to 'src')
-rw-r--r--src/common.h6
-rw-r--r--src/dls.cpp2
-rw-r--r--src/dls.h1
-rw-r--r--src/sls.cpp12
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): ",
diff --git a/src/dls.h b/src/dls.h
index 73cf376..ed6e2f6 100644
--- a/src/dls.h
+++ b/src/dls.h
@@ -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);
}