[gnome-notes/136-implement-the-list-row-pattern-in-main-view: 24/25] utils: make INTENSITY global



commit 136087e2f931631787bab6719b166103d7f675c6
Author: Isaque Galdino <igaldino gmail com>
Date:   Mon Jun 15 00:39:44 2020 -0300

    utils: make INTENSITY global
    
    INTENSITY macro is now called BJB_UTILS_COLOR_INTENSITY and can be seen
    by all application.

 src/bjb-utils.h                         | 2 ++
 src/libbiji/editor/biji-webkit-editor.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/bjb-utils.h b/src/bjb-utils.h
index 9c73814..0ac4dbe 100644
--- a/src/bjb-utils.h
+++ b/src/bjb-utils.h
@@ -25,6 +25,8 @@
 
 #include <glib-object.h>
 
+#define BJB_UTILS_COLOR_INTENSITY(c) ((c->red) * 0.30 + (c->green) * 0.59 + (c->blue) * 0.11)
+
 G_BEGIN_DECLS
 
 gchar       *bjb_utils_get_human_time         (gint64      unix_time);
diff --git a/src/libbiji/editor/biji-webkit-editor.c b/src/libbiji/editor/biji-webkit-editor.c
index 1e67741..318f1a9 100644
--- a/src/libbiji/editor/biji-webkit-editor.c
+++ b/src/libbiji/editor/biji-webkit-editor.c
@@ -18,13 +18,13 @@
 #include <libxml/xmlwriter.h>
 
 #include "config.h"
+#include "../../bjb-utils.h"
 #include "../biji-string.h"
 #include "../biji-manager.h"
 #include "biji-webkit-editor.h"
 #include "biji-editor-selection.h"
 #include <jsc/jsc.h>
 
-#define INTENSITY(c) ((c->red) * 0.30 + (c->green) * 0.59 + (c->blue) * 0.11)
 #define ZOOM_LARGE  1.5f;
 #define ZOOM_MEDIUM 1.0f;
 #define ZOOM_SMALL  0.8f;
@@ -222,7 +222,7 @@ set_editor_color (WebKitWebView *w, GdkRGBA *col)
 
   webkit_web_view_set_background_color (w, col);
   script = g_strdup_printf ("document.getElementById('editable').style.color = '%s';",
-                            INTENSITY (col) < 0.5 ? "white" : "black");
+                            BJB_UTILS_COLOR_INTENSITY (col) < 0.5 ? "white" : "black");
   webkit_web_view_run_javascript (w, script, NULL, NULL, NULL);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]