SF.net SVN: geany:[3773] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Fri May 8 17:00:37 UTC 2009


Revision: 3773
          http://geany.svn.sourceforge.net/geany/?rev=3773&view=rev
Author:   eht16
Date:     2009-05-08 17:00:28 +0000 (Fri, 08 May 2009)

Log Message:
-----------
Add utils_color_invert() and use it in highlighting.c and printing.c.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/highlighting.c
    trunk/src/printing.c
    trunk/src/utils.c
    trunk/src/utils.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-05-08 16:13:29 UTC (rev 3772)
+++ trunk/ChangeLog	2009-05-08 17:00:28 UTC (rev 3773)
@@ -4,6 +4,8 @@
    When a filter is set, apply it only to files, not directories and
    apply the filter to the UTF-8 name of the file as the filter string
    itself is also UTF-8.
+ * src/utils.c, src/utils.h, src/highlighting.c, src/printing.c:
+   Add utils_color_invert() and use it in highlighting.c and printing.c.
 
 
 2009-05-03  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2009-05-08 16:13:29 UTC (rev 3772)
+++ trunk/src/highlighting.c	2009-05-08 17:00:28 UTC (rev 3773)
@@ -291,14 +291,8 @@
 static guint invert(guint icolour)
 {
 	if (common_style_set.invert_all)
-	{
-		guint r, g, b;
+		return utils_invert_color(icolour);
 
-		r = 0xffffff - icolour;
-		g = 0xffffff - (icolour >> 8);
-		b = 0xffffff - (icolour >> 16);
-		return (r | (g << 8) | (b << 16));
-	}
 	return icolour;
 }
 

Modified: trunk/src/printing.c
===================================================================
--- trunk/src/printing.c	2009-05-08 16:13:29 UTC (rev 3772)
+++ trunk/src/printing.c	2009-05-08 17:00:28 UTC (rev 3773)
@@ -117,26 +117,13 @@
 }
 
 
-/* FIXME use the invert function in highlighting.c */
-static guint invert(guint icolour)
-{
-	if (interface_prefs.highlighting_invert_all)
-	{
-		guint r, g, b;
-
-		r = 0xffffff - icolour;
-		g = 0xffffff - (icolour >> 8);
-		b = 0xffffff - (icolour >> 16);
-		return (r | (g << 8) | (b << 16));
-	}
-	return icolour;
-}
-
-
 /* split a RGB colour into the three colour components */
 static void get_rgb_values(gint c, gint *r, gint *g, gint *b)
 {
-	c = invert(ROTATE_RGB(c));
+	c = ROTATE_RGB(c);
+	if (interface_prefs.highlighting_invert_all)
+		c = utils_invert_color(c);
+
 	*r = c % 256;
 	*g = (c & - 16711936) / 256;
 	*b = (c & 0xff0000) / 65536;

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2009-05-08 16:13:29 UTC (rev 3772)
+++ trunk/src/utils.c	2009-05-08 17:00:28 UTC (rev 3773)
@@ -807,6 +807,18 @@
 }
 
 
+guint utils_invert_color(guint color)
+{
+	guint r, g, b;
+
+	r = 0xffffff - color;
+	g = 0xffffff - (color >> 8);
+	b = 0xffffff - (color >> 16);
+
+	return (r | (g << 8) | (b << 16));
+}
+
+
 /* Get directory from current file in the notebook.
  * Returns dir string that should be freed or NULL, depending on whether current file is valid.
  * Returned string is in UTF-8 encoding */

Modified: trunk/src/utils.h
===================================================================
--- trunk/src/utils.h	2009-05-08 16:13:29 UTC (rev 3772)
+++ trunk/src/utils.h	2009-05-08 17:00:28 UTC (rev 3773)
@@ -118,6 +118,8 @@
 
 gchar *utils_get_hex_from_color(GdkColor *color);
 
+guint utils_invert_color(guint color);
+
 const gchar *utils_get_default_dir_utf8(void);
 
 gchar *utils_get_current_file_dir_utf8(void);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list