[glom] Update GimpRuler from the Gimp source code.



commit 09ec80cdc398e440a67cec8c94354740b3e22de6
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Mar 16 10:01:52 2012 +0100

    Update GimpRuler from the Gimp source code.
    
    	With the same changes to make it build in Glom.

 ChangeLog                                          |    6 ++++
 glom/utility_widgets/gimpruler/gimpruler.c         |    5 ++-
 .../gimpruler/libgimpbase/gimpbase.h               |   25 +++++++++-------
 .../gimpruler/libgimpbase/gimpbaseenums.h          |    2 +-
 .../gimpruler/libgimpbase/gimpbasetypes.h          |    7 +++--
 .../gimpruler/libgimpbase/gimpunit.c               |   29 +++++++++++++++++++-
 .../gimpruler/libgimpbase/gimpunit.h               |   12 +++++++-
 .../gimpruler/libgimpmath/gimpmath.h               |   16 ++++++++---
 8 files changed, 78 insertions(+), 24 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 22a5eec..b0028a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-16  Murray Cumming  <murrayc murrayc com>
+
+	Update GimpRuler from the Gimp source code.
+
+	With the same changes to make it build in Glom.
+
 1.21.7:
 
 2012-03-14  Murray Cumming  <murrayc murrayc com>
diff --git a/glom/utility_widgets/gimpruler/gimpruler.c b/glom/utility_widgets/gimpruler/gimpruler.c
index 02bf872..d59ccd2 100644
--- a/glom/utility_widgets/gimpruler/gimpruler.c
+++ b/glom/utility_widgets/gimpruler/gimpruler.c
@@ -25,8 +25,9 @@
 #include "libgimpbase/gimpbase.h"
 #include "libgimpmath/gimpmath.h"
 
-/* A change for Glom: */
-/* #include "libgimpwidgets/gimpwidgetstypes.h" */
+/* A change for Glom:
+#include "gimpwidgetstypes.h"
+*/
 
 #include "gimpruler.h"
 
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpbase.h b/glom/utility_widgets/gimpruler/libgimpbase/gimpbase.h
index aa9e193..3f31516 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpbase.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpbase.h
@@ -19,25 +19,28 @@
 #ifndef __GIMP_BASE_H__
 #define __GIMP_BASE_H__
 
+#define __GIMP_BASE_H_INSIDE__
 
 #include <libgimpbase/gimpbasetypes.h>
 
-/* #include <libgimpbase/gimpchecks.h> */
-/* #include <libgimpbase/gimpcpuaccel.h> */
-/* #include <libgimpbase/gimpdatafiles.h> */
-/* #include <libgimpbase/gimpenv.h> */
-/* #include <libgimpbase/gimplimits.h> */
-/* #include <libgimpbase/gimpmemsize.h> */
-/* #include <libgimpbase/gimpparasite.h> */
-/* #include <libgimpbase/gimprectangle.h> */
+/* A change for Glom:
+#include <libgimpbase/gimpchecks.h>
+#include <libgimpbase/gimpcpuaccel.h>
+#include <libgimpbase/gimpdatafiles.h>
+#include <libgimpbase/gimpenv.h>
+#include <libgimpbase/gimplimits.h>
+#include <libgimpbase/gimpmemsize.h>
+#include <libgimpbase/gimpparasite.h>
+#include <libgimpbase/gimprectangle.h>
 #include <libgimpbase/gimpunit.h>
-/* #include <libgimpbase/gimputils.h> */
-/* #include <libgimpbase/gimpversion.h> */
+#include <libgimpbase/gimputils.h>
+#include <libgimpbase/gimpversion.h>
 
-/*
 #ifndef G_OS_WIN32
 #include <libgimpbase/gimpsignal.h>
 #endif
 */
 
+#undef __GIMP_BASE_H_INSIDE__
+
 #endif  /* __GIMP_BASE_H__ */
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpbaseenums.h b/glom/utility_widgets/gimpruler/libgimpbase/gimpbaseenums.h
index b7e82fc..10bb510 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpbaseenums.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpbaseenums.h
@@ -268,7 +268,7 @@ typedef enum
 {
   GIMP_PAINT_CONSTANT,    /*< desc="Constant"    >*/
   GIMP_PAINT_INCREMENTAL  /*< desc="Incremental" >*/
-} GimpPaintAppWindowMode;
+} GimpPaintApplicationMode;
 
 
 #define GIMP_TYPE_REPEAT_MODE (gimp_repeat_mode_get_type ())
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpbasetypes.h b/glom/utility_widgets/gimpruler/libgimpbase/gimpbasetypes.h
index 856b751..2730eeb 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpbasetypes.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpbasetypes.h
@@ -19,9 +19,10 @@
 #ifndef __GIMP_BASE_TYPES_H__
 #define __GIMP_BASE_TYPES_H__
 
-
-/* #include <libgimpcolor/gimpcolortypes.h> */
-/* #include <libgimpmath/gimpmathtypes.h> */
+/* A change for Glom:
+#include <libgimpcolor/gimpcolortypes.h>
+#include <libgimpmath/gimpmathtypes.h>
+*/
 
 #include <libgimpbase/gimpbaseenums.h>
 #include <libgimpbase/gimpparam.h>
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.c b/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.c
index bc8f378..5129909 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.c
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.c
@@ -419,7 +419,7 @@ gimp_unit_format_string (const gchar *format,
 
   g_return_val_if_fail (format != NULL, NULL);
   g_return_val_if_fail ((gint)unit == GIMP_UNIT_PERCENT ||
-                        ( /* unsigned, so always true: unit >= GIMP_UNIT_PIXEL && */
+                        ( /* A change for Glom: This is unsigned, so always true: unit >= GIMP_UNIT_PIXEL && */
                          (gint)unit < gimp_unit_get_number_of_units ()), NULL);
 
   while (i < ((gint)sizeof (buffer) - 1) && *format)
@@ -654,3 +654,30 @@ gimp_units_to_pixels (gdouble  value,
 
   return value * resolution / gimp_unit_get_factor (unit);
 }
+
+/**
+ * gimp_units_to_points:
+ * @value:      value in units
+ * @unit:       unit of @value
+ * @resolution: resloution in DPI
+ *
+ * Converts a @value specified in @unit to points.
+ *
+ * Returns: @value converted to points.
+ *
+ * Since: GIMP 2.8
+ **/
+gdouble
+gimp_units_to_points (gdouble  value,
+                      GimpUnit unit,
+                      gdouble  resolution)
+{
+  if (unit == GIMP_UNIT_POINT)
+    return value;
+
+  if (unit == GIMP_UNIT_PIXEL)
+    return (value * gimp_unit_get_factor (GIMP_UNIT_POINT) / resolution);
+
+  return (value *
+          gimp_unit_get_factor (GIMP_UNIT_POINT) / gimp_unit_get_factor (unit));
+}
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.h b/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.h
index 24e650e..3c88f53 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.h
@@ -19,15 +19,20 @@
  * <http://www.gnu.org/licenses/>.
  */
 
+/* We disable this so we can use gimpruler.h in Glom without the other files.
+#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
+#error "Only <libgimpbase/gimpbase.h> can be included directly."
+#endif
+*/
+
 #ifndef __GIMP_UNIT_H__
 #define __GIMP_UNIT_H__
 
-/* This is not in the original gimp source code. */
+/* A change for Glom: */
 #include <libgimpbase/gimpbaseenums.h>
 
 G_BEGIN_DECLS
 
-
 /* For information look into the C source or the html documentation */
 
 /**
@@ -96,6 +101,9 @@ gdouble       gimp_pixels_to_units          (gdouble      pixels,
 gdouble       gimp_units_to_pixels          (gdouble      value,
                                              GimpUnit     unit,
                                              gdouble      resolution);
+gdouble       gimp_units_to_points          (gdouble      value,
+                                             GimpUnit     unit,
+                                             gdouble      resolution);
 
 
 G_END_DECLS
diff --git a/glom/utility_widgets/gimpruler/libgimpmath/gimpmath.h b/glom/utility_widgets/gimpruler/libgimpmath/gimpmath.h
index 6743621..20abf82 100644
--- a/glom/utility_widgets/gimpruler/libgimpmath/gimpmath.h
+++ b/glom/utility_widgets/gimpruler/libgimpmath/gimpmath.h
@@ -21,6 +21,7 @@
 #ifndef __GIMP_MATH_H__
 #define __GIMP_MATH_H__
 
+
 #include <math.h>
 
 #ifdef HAVE_IEEEFP_H
@@ -31,11 +32,18 @@
 #include <float.h>
 #endif
 
-/* #include <libgimpmath/gimpmathtypes.h> */
+#define __GIMP_MATH_H_INSIDE__
+
+/* A change for Glom:
+#include <libgimpmath/gimpmathtypes.h>
+
+#include <libgimpmath/gimpmatrix.h>
+#include <libgimpmath/gimpmd5.h>
+#include <libgimpmath/gimpvector.h>
+*/
+
+#undef __GIMP_MATH_H_INSIDE__
 
-/* #include <libgimpmath/gimpmatrix.h> */
-/* #include <libgimpmath/gimpmd5.h> */
-/* #include <libgimpmath/gimpvector.h> */
 
 G_BEGIN_DECLS
 



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