mirror of https://github.com/GNOME/gimp.git
libgimp: fix the non-generated API with the new class types.
This commit is contained in:
parent
8c95499e14
commit
5e6d4d8fbd
|
@ -836,12 +836,12 @@ gimp_check_type (void)
|
|||
*
|
||||
* This is a constant value given at plug-in configuration time.
|
||||
*
|
||||
* Returns: the default display ID
|
||||
* Returns: (transfer full): the default display ID
|
||||
**/
|
||||
gint32
|
||||
GimpDisplay *
|
||||
gimp_default_display (void)
|
||||
{
|
||||
return _gdisp_ID;
|
||||
return gimp_display_new_by_id (_gdisp_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -175,7 +175,7 @@ gboolean gimp_export_xmp (void) G_GNUC_CONST;
|
|||
gboolean gimp_export_iptc (void) G_GNUC_CONST;
|
||||
GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
|
||||
GimpCheckType gimp_check_type (void) G_GNUC_CONST;
|
||||
gint32 gimp_default_display (void) G_GNUC_CONST;
|
||||
GimpDisplay * gimp_default_display (void) G_GNUC_CONST;
|
||||
const gchar * gimp_wm_class (void) G_GNUC_CONST;
|
||||
const gchar * gimp_display_name (void) G_GNUC_CONST;
|
||||
gint gimp_monitor_number (void) G_GNUC_CONST;
|
||||
|
|
|
@ -312,22 +312,20 @@ gimp_aspect_preview_draw_buffer (GimpPreview *preview,
|
|||
}
|
||||
else
|
||||
{
|
||||
guchar *sel;
|
||||
guchar *src;
|
||||
GimpDrawable *selection;
|
||||
gint selection_ID;
|
||||
gint w, h;
|
||||
gint bpp;
|
||||
guchar *sel;
|
||||
guchar *src;
|
||||
GimpSelection *selection;
|
||||
gint w, h;
|
||||
gint bpp;
|
||||
|
||||
selection_ID = gimp_image_get_selection (image);
|
||||
selection = GIMP_DRAWABLE (gimp_item_new_by_id (selection_ID));
|
||||
selection = gimp_image_get_selection (image);
|
||||
|
||||
w = width;
|
||||
h = height;
|
||||
|
||||
src = gimp_drawable_get_thumbnail_data (priv->drawable,
|
||||
&w, &h, &bpp);
|
||||
sel = gimp_drawable_get_thumbnail_data (selection,
|
||||
sel = gimp_drawable_get_thumbnail_data (GIMP_DRAWABLE (selection),
|
||||
&w, &h, &bpp);
|
||||
g_object_unref (selection);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ gimp_channel_init (GimpChannel *channel)
|
|||
*
|
||||
* Returns: The newly created channel.
|
||||
*/
|
||||
gint32
|
||||
GimpChannel *
|
||||
gimp_channel_new (GimpImage *image,
|
||||
const gchar *name,
|
||||
guint width,
|
||||
|
@ -111,13 +111,16 @@ gimp_channel_new_deprecated (gint32 image_id,
|
|||
gdouble opacity,
|
||||
const GimpRGB *color)
|
||||
{
|
||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
||||
gint32 channel_id;
|
||||
GimpImage *image = gimp_image_new_by_id (image_id);
|
||||
GimpChannel *channel;
|
||||
gint32 channel_id;
|
||||
|
||||
channel_id = gimp_channel_new (image, name, width, height,
|
||||
opacity, color);
|
||||
channel = gimp_channel_new (image, name, width, height,
|
||||
opacity, color);
|
||||
channel_id = gimp_item_get_id (GIMP_ITEM (channel));
|
||||
|
||||
g_object_unref (image);
|
||||
g_object_unref (channel);
|
||||
|
||||
return channel_id;
|
||||
}
|
||||
|
|
|
@ -67,12 +67,12 @@ GType gimp_channel_get_type (void) G_GNUC_CONST;
|
|||
|
||||
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
|
||||
|
||||
gint32 gimp_channel_new (GimpImage *image,
|
||||
const gchar *name,
|
||||
guint width,
|
||||
guint height,
|
||||
gdouble opacity,
|
||||
const GimpRGB *color);
|
||||
GimpChannel * gimp_channel_new (GimpImage *image,
|
||||
const gchar *name,
|
||||
guint width,
|
||||
guint height,
|
||||
gdouble opacity,
|
||||
const GimpRGB *color);
|
||||
|
||||
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
|
||||
|
||||
|
|
|
@ -447,13 +447,12 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
|
|||
&draw_x, &draw_y,
|
||||
&draw_width, &draw_height))
|
||||
{
|
||||
GimpImageType type;
|
||||
GimpDrawable *selection;
|
||||
gint32 selection_ID;
|
||||
guchar *src;
|
||||
guchar *sel;
|
||||
gint d_w, d_h, d_bpp;
|
||||
gint s_w, s_h, s_bpp;
|
||||
GimpImageType type;
|
||||
GimpSelection *selection;
|
||||
guchar *src;
|
||||
guchar *sel;
|
||||
gint d_w, d_h, d_bpp;
|
||||
gint s_w, s_h, s_bpp;
|
||||
|
||||
d_w = draw_width;
|
||||
d_h = draw_height;
|
||||
|
@ -461,8 +460,7 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
|
|||
s_w = draw_width;
|
||||
s_h = draw_height;
|
||||
|
||||
selection_ID = gimp_image_get_selection (image);
|
||||
selection = GIMP_DRAWABLE (gimp_item_new_by_id (selection_ID));
|
||||
selection = gimp_image_get_selection (image);
|
||||
|
||||
src = gimp_drawable_get_sub_thumbnail_data (priv->drawable,
|
||||
draw_x, draw_y,
|
||||
|
@ -470,7 +468,7 @@ gimp_drawable_preview_draw_area (GimpDrawablePreview *preview,
|
|||
&d_w, &d_h,
|
||||
&d_bpp);
|
||||
|
||||
sel = gimp_drawable_get_sub_thumbnail_data (selection,
|
||||
sel = gimp_drawable_get_sub_thumbnail_data (GIMP_DRAWABLE (selection),
|
||||
draw_x + offset_x,
|
||||
draw_y + offset_y,
|
||||
draw_width, draw_height,
|
||||
|
|
|
@ -206,13 +206,16 @@ export_apply_masks (GimpImage *image,
|
|||
|
||||
for (i = 0; i < n_layers; i++)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
GimpLayer *layer;
|
||||
GimpLayerMask *mask;
|
||||
|
||||
layer = GIMP_LAYER (gimp_item_new_by_id (layers[i]));
|
||||
if (gimp_layer_get_mask (layer) != -1)
|
||||
mask = gimp_layer_get_mask (layer);
|
||||
if (mask)
|
||||
gimp_layer_remove_mask (layer, GIMP_MASK_APPLY);
|
||||
|
||||
g_object_unref (layer);
|
||||
g_clear_object (&mask);
|
||||
}
|
||||
|
||||
g_free (layers);
|
||||
|
@ -864,12 +867,15 @@ gimp_export_image (GimpImage **image,
|
|||
{
|
||||
for (i = 0; i < n_layers; i++)
|
||||
{
|
||||
GimpLayer *layer = GIMP_LAYER (gimp_item_new_by_id (layers[i]));
|
||||
GimpLayer *layer = GIMP_LAYER (gimp_item_new_by_id (layers[i]));
|
||||
GimpLayerMask *mask;
|
||||
|
||||
if (gimp_layer_get_mask (layer) != -1)
|
||||
mask = gimp_layer_get_mask (layer);
|
||||
if (mask)
|
||||
has_layer_masks = TRUE;
|
||||
|
||||
g_object_unref (layer);
|
||||
g_clear_object (&mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1291,7 +1291,7 @@ gimp_param_display_id_validate (GParamSpec *pspec,
|
|||
if (ispec->none_ok && (display_id == 0 || display_id == -1))
|
||||
return FALSE;
|
||||
|
||||
if (! gimp_display_is_valid (display_id))
|
||||
if (! _gimp_display_is_valid (display_id))
|
||||
{
|
||||
value->data[0].v_int = -1;
|
||||
return TRUE;
|
||||
|
|
|
@ -181,9 +181,15 @@ gimp_progress_uninstall (const gchar *progress_callback)
|
|||
gboolean
|
||||
gimp_progress_init (const gchar *message)
|
||||
{
|
||||
GimpDisplay *display = gimp_default_display ();
|
||||
gboolean success;
|
||||
|
||||
gimp_progress_current = 0.0;
|
||||
|
||||
return _gimp_progress_init (message, gimp_default_display ());
|
||||
success = _gimp_progress_init (message, display);
|
||||
g_clear_object (&display);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -195,7 +195,7 @@ gimp_ui_get_foreign_window (guint32 window)
|
|||
|
||||
/**
|
||||
* gimp_ui_get_display_window:
|
||||
* @gdisp_ID: a GimpDisplay ID.
|
||||
* @display: a #GimpDisplay.
|
||||
*
|
||||
* Returns the #GdkWindow of a display window. The purpose is to allow
|
||||
* to make plug-in dialogs transient to the image display as explained
|
||||
|
@ -211,13 +211,13 @@ gimp_ui_get_foreign_window (guint32 window)
|
|||
* Since: 2.4
|
||||
*/
|
||||
GdkWindow *
|
||||
gimp_ui_get_display_window (guint32 gdisp_ID)
|
||||
gimp_ui_get_display_window (GimpDisplay *display)
|
||||
{
|
||||
guint32 window;
|
||||
|
||||
g_return_val_if_fail (gimp_ui_initialized, NULL);
|
||||
|
||||
window = gimp_display_get_window_handle (gdisp_ID);
|
||||
window = gimp_display_get_window_handle (display);
|
||||
if (window)
|
||||
return gimp_ui_get_foreign_window (window);
|
||||
|
||||
|
@ -267,12 +267,12 @@ gimp_window_transient_show (GtkWidget *window)
|
|||
|
||||
/**
|
||||
* gimp_window_set_transient_for_display:
|
||||
* @window: the #GtkWindow that should become transient
|
||||
* @gdisp_ID: display ID of the image window that should become the parent
|
||||
* @window: the #GtkWindow that should become transient
|
||||
* @display: display of the image window that should become the parent
|
||||
*
|
||||
* Indicates to the window manager that @window is a transient dialog
|
||||
* associated with the GIMP image window that is identified by it's
|
||||
* display ID. See gdk_window_set_transient_for () for more information.
|
||||
* display ID. See gdk_window_set_transient_for () for more information.
|
||||
*
|
||||
* Most of the time you will want to use the convenience function
|
||||
* gimp_window_set_transient().
|
||||
|
@ -280,14 +280,14 @@ gimp_window_transient_show (GtkWidget *window)
|
|||
* Since: 2.4
|
||||
*/
|
||||
void
|
||||
gimp_window_set_transient_for_display (GtkWindow *window,
|
||||
guint32 gdisp_ID)
|
||||
gimp_window_set_transient_for_display (GtkWindow *window,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
g_return_if_fail (gimp_ui_initialized);
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
|
||||
if (! gimp_window_set_transient_for (window,
|
||||
gimp_ui_get_display_window (gdisp_ID)))
|
||||
gimp_ui_get_display_window (display)))
|
||||
{
|
||||
/* if setting the window transient failed, at least set
|
||||
* WIN_POS_CENTER, which will center the window on the screen
|
||||
|
@ -448,3 +448,60 @@ gimp_osx_focus_window (void)
|
|||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Deprecated API. */
|
||||
|
||||
|
||||
/**
|
||||
* gimp_ui_get_display_window_deprecated: (skip)
|
||||
* @gdisp_ID: a GimpDisplay ID.
|
||||
*
|
||||
* Returns the #GdkWindow of a display window. The purpose is to allow
|
||||
* to make plug-in dialogs transient to the image display as explained
|
||||
* with gdk_window_set_transient_for().
|
||||
*
|
||||
* You shouldn't have to call this function directly. Use
|
||||
* gimp_window_set_transient_for_display() instead.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): A reference to a #GdkWindow or %NULL.
|
||||
* You should unref the window using g_object_unref() as
|
||||
* soon as you don't need it any longer.
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
GdkWindow *
|
||||
gimp_ui_get_display_window_deprecated (guint32 gdisp_ID)
|
||||
{
|
||||
GimpDisplay *display = gimp_display_new_by_id (gdisp_ID);
|
||||
GdkWindow *window;
|
||||
|
||||
window = gimp_ui_get_display_window (display);
|
||||
g_object_unref (display);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_window_set_transient_for_display_deprecated: (skip)
|
||||
* @window: the #GtkWindow that should become transient
|
||||
* @gdisp_ID: display ID of the image window that should become the parent
|
||||
*
|
||||
* Indicates to the window manager that @window is a transient dialog
|
||||
* associated with the GIMP image window that is identified by it's
|
||||
* display ID. See gdk_window_set_transient_for () for more information.
|
||||
*
|
||||
* Most of the time you will want to use the convenience function
|
||||
* gimp_window_set_transient().
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
void
|
||||
gimp_window_set_transient_for_display_deprecated (GtkWindow *window,
|
||||
guint32 gdisp_ID)
|
||||
{
|
||||
GimpDisplay *display = gimp_display_new_by_id (gdisp_ID);
|
||||
|
||||
gimp_window_set_transient_for_display (window, display);
|
||||
g_object_unref (display);
|
||||
}
|
||||
|
|
|
@ -54,13 +54,30 @@ G_BEGIN_DECLS
|
|||
void gimp_ui_init (const gchar *prog_name,
|
||||
gboolean preview);
|
||||
|
||||
GdkWindow * gimp_ui_get_display_window (guint32 gdisp_ID);
|
||||
GdkWindow * gimp_ui_get_progress_window (void);
|
||||
|
||||
void gimp_window_set_transient_for_display (GtkWindow *window,
|
||||
guint32 gdisp_ID);
|
||||
void gimp_window_set_transient (GtkWindow *window);
|
||||
|
||||
|
||||
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
|
||||
|
||||
GdkWindow * gimp_ui_get_display_window (GimpDisplay *display);
|
||||
void gimp_window_set_transient_for_display (GtkWindow *window,
|
||||
GimpDisplay *display);
|
||||
|
||||
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
|
||||
|
||||
#define gimp_ui_get_display_window gimp_ui_get_display_window_deprecated
|
||||
#define gimp_window_set_transient_for_display gimp_window_set_transient_for_display_deprecated
|
||||
|
||||
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
|
||||
|
||||
|
||||
GdkWindow * gimp_ui_get_display_window_deprecated (guint32 gdisp_ID);
|
||||
void gimp_window_set_transient_for_display_deprecated (GtkWindow *window,
|
||||
guint32 gdisp_ID);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_UI_H__ */
|
||||
|
|
|
@ -517,21 +517,19 @@ gimp_zoom_preview_draw_buffer (GimpPreview *preview,
|
|||
}
|
||||
else
|
||||
{
|
||||
guchar *sel;
|
||||
guchar *src;
|
||||
GimpDrawable *selection;
|
||||
gint selection_ID;
|
||||
gint w, h;
|
||||
gint bpp;
|
||||
gint src_x;
|
||||
gint src_y;
|
||||
gint src_width;
|
||||
gint src_height;
|
||||
gint offsx = 0;
|
||||
gint offsy = 0;
|
||||
guchar *sel;
|
||||
guchar *src;
|
||||
GimpSelection *selection;
|
||||
gint w, h;
|
||||
gint bpp;
|
||||
gint src_x;
|
||||
gint src_y;
|
||||
gint src_width;
|
||||
gint src_height;
|
||||
gint offsx = 0;
|
||||
gint offsy = 0;
|
||||
|
||||
selection_ID = gimp_image_get_selection (image);
|
||||
selection = GIMP_DRAWABLE (gimp_item_new_by_id (selection_ID));
|
||||
selection = gimp_image_get_selection (image);
|
||||
|
||||
w = width;
|
||||
h = height;
|
||||
|
@ -545,7 +543,7 @@ gimp_zoom_preview_draw_buffer (GimpPreview *preview,
|
|||
src_width, src_height,
|
||||
&w, &h, &bpp);
|
||||
gimp_drawable_offsets (priv->drawable, &offsx, &offsy);
|
||||
sel = gimp_drawable_get_sub_thumbnail_data (selection,
|
||||
sel = gimp_drawable_get_sub_thumbnail_data (GIMP_DRAWABLE (selection),
|
||||
src_x + offsx, src_y + offsy,
|
||||
src_width, src_height,
|
||||
&width, &height, &bpp);
|
||||
|
|
Loading…
Reference in New Issue