[glom] GimpRuler: Update from the Gimp gtk3port branch
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] GimpRuler: Update from the Gimp gtk3port branch
- Date: Thu, 26 Sep 2013 08:27:56 +0000 (UTC)
commit a9a636fc398a3bbce2b5bfbdb0bdda8b32fb67c2
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Sep 26 10:20:34 2013 +0200
GimpRuler: Update from the Gimp gtk3port branch
glom/utility_widgets/gimpruler/gimpruler.c | 16 +++++++++++-----
glom/utility_widgets/gimpruler/gimpruler.h | 10 ++++++----
.../gimpruler/libgimpbase/gimpbase-private.c | 1 +
.../gimpruler/libgimpbase/gimpbase-private.h | 1 +
.../gimpruler/libgimpbase/gimpbase.h | 1 +
.../gimpruler/libgimpbase/gimpbaseenums.h | 14 +++++++++-----
.../gimpruler/libgimpbase/gimpbasetypes.h | 15 +++++++++++++++
.../gimpruler/libgimpbase/gimpparam.h | 1 +
.../gimpruler/libgimpbase/gimpunit.c | 19 +++++++++++++------
.../gimpruler/libgimpbase/gimpunit.h | 9 +++++----
.../gimpruler/libgimpmath/gimpmath.h | 11 ++++++++++-
11 files changed, 73 insertions(+), 25 deletions(-)
---
diff --git a/glom/utility_widgets/gimpruler/gimpruler.c b/glom/utility_widgets/gimpruler/gimpruler.c
index d59ccd2..b21bc1d 100644
--- a/glom/utility_widgets/gimpruler/gimpruler.c
+++ b/glom/utility_widgets/gimpruler/gimpruler.c
@@ -22,7 +22,10 @@
#include <gtk/gtk.h>
+/* A change for Glom:
#include "libgimpbase/gimpbase.h"
+*/
+
#include "libgimpmath/gimpmath.h"
/* A change for Glom:
@@ -31,6 +34,11 @@
#include "gimpruler.h"
+/* A change for Glom: */
+#include "libgimpbase/gimpparam.h"
+#include "libgimpbase/gimpunit.h"
+#include "libgimpbase/gimpbaseenums.h"
+
/**
* SECTION: gimpruler
@@ -741,8 +749,7 @@ gimp_ruler_realize (GtkWidget *widget)
attributes.wclass = GDK_INPUT_ONLY;
attributes.event_mask = (gtk_widget_get_events (widget) |
GDK_EXPOSURE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
+ GDK_POINTER_MOTION_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y;
@@ -910,8 +917,6 @@ gimp_ruler_motion_notify (GtkWidget *widget,
{
GimpRuler *ruler = GIMP_RULER (widget);
- gdk_event_request_motions (event);
-
gimp_ruler_update_position (ruler, event->x, event->y);
return FALSE;
@@ -1031,7 +1036,7 @@ gimp_ruler_draw_ticks (GimpRuler *ruler)
g_snprintf (unit_str, sizeof (unit_str), "%d", scale);
text_size = strlen (unit_str) * digit_height + 1;
- for (scale = 0; scale < (gint)G_N_ELEMENTS (ruler_metric.ruler_scale); scale++)
+ for (scale = 0; scale < G_N_ELEMENTS (ruler_metric.ruler_scale); scale++)
if (ruler_metric.ruler_scale[scale] * fabs (increment) > 2 * text_size)
break;
@@ -1299,3 +1304,4 @@ gimp_ruler_get_layout (GtkWidget *widget,
return priv->layout;
}
+
diff --git a/glom/utility_widgets/gimpruler/gimpruler.h b/glom/utility_widgets/gimpruler/gimpruler.h
index 97e3b72..bf99fbe 100644
--- a/glom/utility_widgets/gimpruler/gimpruler.h
+++ b/glom/utility_widgets/gimpruler/gimpruler.h
@@ -16,6 +16,9 @@
* <http://www.gnu.org/licenses/>.
*/
+/* A change for Glom: */
+#include "libgimpbase/gimpunit.h"
+
/* We disable this so we can use it in Glom without the other files.
#if !defined (__GIMP_WIDGETS_H_INSIDE__) && !defined (GIMP_WIDGETS_COMPILATION)
#error "Only <libgimpwidgets/gimpwidgets.h> can be included directly."
@@ -27,9 +30,6 @@
G_BEGIN_DECLS
-/* This is not in the original gimp source code. */
-#include <libgimpbase/gimpunit.h>
-
#define GIMP_TYPE_RULER (gimp_ruler_get_type ())
#define GIMP_RULER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RULER, GimpRuler))
#define GIMP_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RULER, GimpRulerClass))
@@ -37,8 +37,9 @@ G_BEGIN_DECLS
#define GIMP_IS_RULER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RULER))
#define GIMP_RULER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RULER, GimpRulerClass))
+/* A change for Glom: */
/* In the original gimp source code, this is in libgimpwidgets/gimpwidgetstypes.h */
-typedef struct _GimpRuler GimpRuler;
+typedef struct _GimpRuler GimpRuler;
typedef struct _GimpRulerClass GimpRulerClass;
@@ -86,3 +87,4 @@ void gimp_ruler_get_range (GimpRuler *ruler,
G_END_DECLS
#endif /* __GIMP_RULER_H__ */
+
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpbase-private.c
b/glom/utility_widgets/gimpruler/libgimpbase/gimpbase-private.c
index 60feabf..a47f70f 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpbase-private.c
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpbase-private.c
@@ -47,3 +47,4 @@ gimp_base_init (GimpUnitVtable *vtable)
gimp_base_initialized = TRUE;
}
+
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpbase-private.h
b/glom/utility_widgets/gimpruler/libgimpbase/gimpbase-private.h
index 9caf7fb..a44c78a 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpbase-private.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpbase-private.h
@@ -66,3 +66,4 @@ void gimp_base_init (GimpUnitVtable *vtable);
G_END_DECLS
#endif /* __GIMP_BASE_PRIVATE_H__ */
+
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpbase.h
b/glom/utility_widgets/gimpruler/libgimpbase/gimpbase.h
index 3f31516..c238f33 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpbase.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpbase.h
@@ -35,6 +35,7 @@
#include <libgimpbase/gimpunit.h>
#include <libgimpbase/gimputils.h>
#include <libgimpbase/gimpversion.h>
+#include <libgimpbase/gimpvaluearray.h>
#ifndef G_OS_WIN32
#include <libgimpbase/gimpsignal.h>
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpbaseenums.h
b/glom/utility_widgets/gimpruler/libgimpbase/gimpbaseenums.h
index 10bb510..3d499a4 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpbaseenums.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpbaseenums.h
@@ -170,7 +170,8 @@ GType gimp_foreground_extract_mode_get_type (void) G_GNUC_CONST;
typedef enum
{
- GIMP_FOREGROUND_EXTRACT_SIOX
+ GIMP_FOREGROUND_EXTRACT_SIOX,
+ GIMP_FOREGROUND_EXTRACT_MATTING
} GimpForegroundExtractMode;
@@ -253,10 +254,12 @@ GType gimp_interpolation_type_get_type (void) G_GNUC_CONST;
typedef enum
{
- GIMP_INTERPOLATION_NONE, /*< desc="None" >*/
- GIMP_INTERPOLATION_LINEAR, /*< desc="Linear" >*/
- GIMP_INTERPOLATION_CUBIC, /*< desc="Cubic" >*/
- GIMP_INTERPOLATION_LANCZOS /*< desc="Sinc (Lanczos3)" >*/
+ GIMP_INTERPOLATION_NONE, /*< desc="None" >*/
+ GIMP_INTERPOLATION_LINEAR, /*< desc="Linear" >*/
+ GIMP_INTERPOLATION_CUBIC, /*< desc="Cubic" >*/
+ GIMP_INTERPOLATION_NOHALO, /*< desc="NoHalo" >*/
+ GIMP_INTERPOLATION_LOHALO, /*< desc="LoHalo" >*/
+ GIMP_INTERPOLATION_LANCZOS = GIMP_INTERPOLATION_NOHALO /*< skip */
} GimpInterpolationType;
@@ -539,3 +542,4 @@ typedef enum
G_END_DECLS
#endif /* __GIMP_BASE_ENUMS_H__ */
+
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpbasetypes.h
b/glom/utility_widgets/gimpruler/libgimpbase/gimpbasetypes.h
index 2730eeb..5605537 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpbasetypes.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpbasetypes.h
@@ -33,10 +33,24 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
+/* XXX FIXME move these to a separate file */
+
+#ifdef GIMP_DISABLE_DEPRECATION_WARNINGS
+#define GIMP_DEPRECATED
+#define GIMP_DEPRECATED_FOR(f)
+#define GIMP_UNAVAILABLE(maj,min)
+#else
+#define GIMP_DEPRECATED G_DEPRECATED
+#define GIMP_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
+#define GIMP_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min)
+#endif
+
+
typedef struct _GimpParasite GimpParasite;
typedef struct _GimpDatafileData GimpDatafileData;
typedef struct _GimpEnumDesc GimpEnumDesc;
typedef struct _GimpFlagsDesc GimpFlagsDesc;
+typedef struct _GimpValueArray GimpValueArray;
typedef void (* GimpDatafileLoaderFunc) (const GimpDatafileData *file_data,
@@ -96,3 +110,4 @@ const GimpFlagsDesc * gimp_flags_get_value_descriptions (GType fl
G_END_DECLS
#endif /* __GIMP_BASE_TYPES_H__ */
+
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpparam.h
b/glom/utility_widgets/gimpruler/libgimpbase/gimpparam.h
index 6b5054b..e79d8f5 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpparam.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpparam.h
@@ -64,3 +64,4 @@
#endif /* __GIMP_PARAM_H__ */
+
diff --git a/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.c
b/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.c
index 5129909..d8311ac 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.c
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.c
@@ -109,7 +109,7 @@ string_to_unit (const GValue *src_value,
return;
error:
- g_warning ("Can't convert string to GimpUnit.");
+ g_warning ("Can't convert string '%s' to GimpUnit.", str);
}
@@ -345,6 +345,12 @@ gimp_unit_get_plural (GimpUnit unit)
return _gimp_unit_vtable.unit_get_plural (unit);
}
+static gint print (gchar *buf,
+ gint len,
+ gint start,
+ const gchar *fmt,
+ ...) G_GNUC_PRINTF (4, 5);
+
static gint
print (gchar *buf,
gint len,
@@ -418,11 +424,11 @@ gimp_unit_format_string (const gchar *format,
gint i = 0;
g_return_val_if_fail (format != NULL, NULL);
- g_return_val_if_fail ((gint)unit == GIMP_UNIT_PERCENT ||
- ( /* A change for Glom: This is unsigned, so always true: unit >= GIMP_UNIT_PIXEL &&
*/
- (gint)unit < gimp_unit_get_number_of_units ()), NULL);
+ g_return_val_if_fail (unit == GIMP_UNIT_PERCENT ||
+ (unit >= GIMP_UNIT_PIXEL &&
+ unit < gimp_unit_get_number_of_units ()), NULL);
- while (i < ((gint)sizeof (buffer) - 1) && *format)
+ while (i < (sizeof (buffer) - 1) && *format)
{
switch (*format)
{
@@ -479,7 +485,7 @@ gimp_unit_format_string (const gchar *format,
format++;
}
- buffer[MIN (i, (gint)sizeof (buffer) - 1)] = 0;
+ buffer[MIN (i, sizeof (buffer) - 1)] = 0;
return g_strdup (buffer);
}
@@ -681,3 +687,4 @@ gimp_units_to_points (gdouble value,
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 3c88f53..c73aba9 100644
--- a/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.h
+++ b/glom/utility_widgets/gimpruler/libgimpbase/gimpunit.h
@@ -19,18 +19,18 @@
* <http://www.gnu.org/licenses/>.
*/
-/* We disable this so we can use gimpruler.h in Glom without the other files.
+/* A change for Glom:
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
*/
+/* A change for Glom: */
+#include "libgimpbase/gimpbaseenums.h"
+
#ifndef __GIMP_UNIT_H__
#define __GIMP_UNIT_H__
-/* A change for Glom: */
-#include <libgimpbase/gimpbaseenums.h>
-
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
@@ -109,3 +109,4 @@ gdouble gimp_units_to_points (gdouble value,
G_END_DECLS
#endif /* __GIMP_UNIT_H__ */
+
diff --git a/glom/utility_widgets/gimpruler/libgimpmath/gimpmath.h
b/glom/utility_widgets/gimpruler/libgimpmath/gimpmath.h
index 20abf82..243d0de 100644
--- a/glom/utility_widgets/gimpruler/libgimpmath/gimpmath.h
+++ b/glom/utility_widgets/gimpruler/libgimpmath/gimpmath.h
@@ -76,11 +76,19 @@ G_BEGIN_DECLS
* ROUND:
* @x: the value to be rounded.
*
- * This macro rounds its argument @x to the nearest integer.
+ * This macro rounds its positive argument @x to the nearest integer.
**/
#define ROUND(x) ((int) ((x) + 0.5))
/**
+ * SIGNED_ROUND:
+ * @x: the value to be rounded.
+ *
+ * This macro rounds its argument @x to the nearest integer.
+ **/
+#define SIGNED_ROUND(x) ((int) ((((x) < 0) ? (x) - 0.5 : (x) + 0.5)))
+
+/**
* SQR:
* @x: the value to be squared.
*
@@ -125,3 +133,4 @@ G_BEGIN_DECLS
G_END_DECLS
#endif /* __GIMP_MATH_H__ */
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]