app: split GimpDisplay in two classes: GimpDisplay and GimpDisplayImpl
GimpDisplay contains only the ID logic and the "gimp" and "config" pointers, and lives in the core. GimpDisplayImpl is a subclass and contains all the actual display stuff. The subclass is only an implementation detail and doesn't appear in any API. Remove all hacks which pass displays as gpointer, GObject or GimpObject through the core, or even lookup its type by name, just use GimpDisplay.
This commit is contained in:
parent
b3b3d8160c
commit
b92dd2c8e3
35 changed files with 496 additions and 407 deletions
|
|
@ -38,6 +38,7 @@
|
|||
#include "core/gimp-memsize.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdisplay.h"
|
||||
#include "core/gimpdrawable-operation.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
|
@ -45,8 +46,6 @@
|
|||
#include "core/gimpsettings.h"
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "tools/gimpoperationtool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
|
|
@ -80,7 +79,7 @@ static void gimp_gegl_procedure_execute_async (GimpProcedure *procedu
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpGeglProcedure, gimp_gegl_procedure,
|
||||
|
|
@ -269,7 +268,7 @@ gimp_gegl_procedure_execute_async (GimpProcedure *procedure,
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display)
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpGeglProcedure *gegl_procedure = GIMP_GEGL_PROCEDURE (procedure);
|
||||
GimpRunMode run_mode;
|
||||
|
|
@ -396,7 +395,7 @@ gimp_gegl_procedure_execute_async (GimpProcedure *procedure,
|
|||
gimp_procedure_get_help_id (procedure));
|
||||
}
|
||||
|
||||
tool_manager_initialize_active (gimp, GIMP_DISPLAY (display));
|
||||
tool_manager_initialize_active (gimp, display);
|
||||
|
||||
if (settings)
|
||||
gimp_filter_tool_set_config (GIMP_FILTER_TOOL (active_tool),
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ procedure_commands_run_procedure_async (GimpProcedure *procedure,
|
|||
gimp_procedure_execute_async (procedure, gimp,
|
||||
gimp_get_user_context (gimp),
|
||||
progress, args,
|
||||
GIMP_OBJECT (display), &error);
|
||||
display, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ vectors_selection_to_vectors_cmd_callback (GimpAction *action,
|
|||
gimp_procedure_execute_async (procedure, image->gimp,
|
||||
action_data_get_context (data),
|
||||
GIMP_PROGRESS (display), args,
|
||||
GIMP_OBJECT (display), &error);
|
||||
display, &error);
|
||||
|
||||
gimp_value_array_unref (args);
|
||||
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ libappcore_a_sources = \
|
|||
gimpdatafactory.h \
|
||||
gimpdataloaderfactory.c \
|
||||
gimpdataloaderfactory.h \
|
||||
gimpdisplay.c \
|
||||
gimpdisplay.h \
|
||||
gimpdocumentlist.c \
|
||||
gimpdocumentlist.h \
|
||||
gimpdrawable.c \
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ typedef struct _GimpAuxItem GimpAuxItem;
|
|||
typedef struct _Gimp Gimp;
|
||||
typedef struct _GimpImage GimpImage;
|
||||
|
||||
typedef struct _GimpDisplay GimpDisplay;
|
||||
|
||||
|
||||
/* containers */
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "gimp-gui.h"
|
||||
#include "gimpcontainer.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimpprogress.h"
|
||||
#include "gimpwaitable.h"
|
||||
|
|
@ -52,8 +53,6 @@ gimp_gui_init (Gimp *gimp)
|
|||
gimp->gui.get_user_time = NULL;
|
||||
gimp->gui.get_theme_dir = NULL;
|
||||
gimp->gui.get_icon_theme_dir = NULL;
|
||||
gimp->gui.display_get_by_id = NULL;
|
||||
gimp->gui.display_get_id = NULL;
|
||||
gimp->gui.display_get_window_id = NULL;
|
||||
gimp->gui.display_create = NULL;
|
||||
gimp->gui.display_delete = NULL;
|
||||
|
|
@ -310,7 +309,7 @@ gimp_get_window_strategy (Gimp *gimp)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
GimpObject *
|
||||
GimpDisplay *
|
||||
gimp_get_empty_display (Gimp *gimp)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
|
@ -321,37 +320,12 @@ gimp_get_empty_display (Gimp *gimp)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
GimpObject *
|
||||
gimp_get_display_by_id (Gimp *gimp,
|
||||
gint id)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
if (gimp->gui.display_get_by_id)
|
||||
return gimp->gui.display_get_by_id (gimp, id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_get_display_id (Gimp *gimp,
|
||||
GimpObject *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
|
||||
g_return_val_if_fail (GIMP_IS_OBJECT (display), -1);
|
||||
|
||||
if (gimp->gui.display_get_id)
|
||||
return gimp->gui.display_get_id (display);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
guint32
|
||||
gimp_get_display_window_id (Gimp *gimp,
|
||||
GimpObject *display)
|
||||
gimp_get_display_window_id (Gimp *gimp,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), -1);
|
||||
g_return_val_if_fail (GIMP_IS_OBJECT (display), -1);
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (display), -1);
|
||||
|
||||
if (gimp->gui.display_get_window_id)
|
||||
return gimp->gui.display_get_window_id (display);
|
||||
|
|
@ -359,7 +333,7 @@ gimp_get_display_window_id (Gimp *gimp,
|
|||
return -1;
|
||||
}
|
||||
|
||||
GimpObject *
|
||||
GimpDisplay *
|
||||
gimp_create_display (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
|
|
@ -377,11 +351,11 @@ gimp_create_display (Gimp *gimp,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_delete_display (Gimp *gimp,
|
||||
GimpObject *display)
|
||||
gimp_delete_display (Gimp *gimp,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GIMP_IS_OBJECT (display));
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
||||
|
||||
if (gimp->gui.display_delete)
|
||||
gimp->gui.display_delete (display);
|
||||
|
|
@ -401,11 +375,11 @@ gimp_reconnect_displays (Gimp *gimp,
|
|||
}
|
||||
|
||||
GimpProgress *
|
||||
gimp_new_progress (Gimp *gimp,
|
||||
GimpObject *display)
|
||||
gimp_new_progress (Gimp *gimp,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (display == NULL || GIMP_IS_OBJECT (display), NULL);
|
||||
g_return_val_if_fail (display == NULL || GIMP_IS_DISPLAY (display), NULL);
|
||||
|
||||
if (gimp->gui.progress_new)
|
||||
return gimp->gui.progress_new (gimp, display);
|
||||
|
|
|
|||
|
|
@ -53,23 +53,20 @@ struct _GimpGui
|
|||
GFile * (* get_icon_theme_dir) (Gimp *gimp);
|
||||
|
||||
GimpObject * (* get_window_strategy) (Gimp *gimp);
|
||||
GimpObject * (* get_empty_display) (Gimp *gimp);
|
||||
GimpObject * (* display_get_by_id) (Gimp *gimp,
|
||||
gint ID);
|
||||
gint (* display_get_id) (GimpObject *display);
|
||||
guint32 (* display_get_window_id) (GimpObject *display);
|
||||
GimpObject * (* display_create) (Gimp *gimp,
|
||||
GimpDisplay * (* get_empty_display) (Gimp *gimp);
|
||||
guint32 (* display_get_window_id) (GimpDisplay *display);
|
||||
GimpDisplay * (* display_create) (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
gdouble scale,
|
||||
GObject *monitor);
|
||||
void (* display_delete) (GimpObject *display);
|
||||
void (* display_delete) (GimpDisplay *display);
|
||||
void (* displays_reconnect) (Gimp *gimp,
|
||||
GimpImage *old_image,
|
||||
GimpImage *new_image);
|
||||
|
||||
GimpProgress * (* progress_new) (Gimp *gimp,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
void (* progress_free) (Gimp *gimp,
|
||||
GimpProgress *progress);
|
||||
|
||||
|
|
@ -114,20 +111,20 @@ void gimp_gui_init (Gimp *gimp);
|
|||
void gimp_gui_ungrab (Gimp *gimp);
|
||||
|
||||
GimpObject * gimp_get_window_strategy (Gimp *gimp);
|
||||
GimpObject * gimp_get_empty_display (Gimp *gimp);
|
||||
GimpObject * gimp_get_display_by_id (Gimp *gimp,
|
||||
GimpDisplay * gimp_get_empty_display (Gimp *gimp);
|
||||
GimpDisplay * gimp_get_display_by_id (Gimp *gimp,
|
||||
gint ID);
|
||||
gint gimp_get_display_id (Gimp *gimp,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
guint32 gimp_get_display_window_id (Gimp *gimp,
|
||||
GimpObject *display);
|
||||
GimpObject * gimp_create_display (Gimp *gimp,
|
||||
GimpDisplay *display);
|
||||
GimpDisplay * gimp_create_display (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
gdouble scale,
|
||||
GObject *monitor);
|
||||
void gimp_delete_display (Gimp *gimp,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
void gimp_reconnect_displays (Gimp *gimp,
|
||||
GimpImage *old_image,
|
||||
GimpImage *new_image);
|
||||
|
|
@ -152,7 +149,7 @@ void gimp_wait (Gimp *gimp,
|
|||
...) G_GNUC_PRINTF (3, 4);
|
||||
|
||||
GimpProgress * gimp_new_progress (Gimp *gimp,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
void gimp_free_progress (Gimp *gimp,
|
||||
GimpProgress *progress);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "gimpcontainer.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpdatafactory.h"
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdynamics.h"
|
||||
#include "gimpimagefile.h"
|
||||
#include "gimpgradient.h"
|
||||
|
|
@ -121,10 +122,10 @@ static void gimp_context_real_set_image (GimpContext *context,
|
|||
|
||||
/* display */
|
||||
static void gimp_context_display_removed (GimpContainer *container,
|
||||
gpointer display,
|
||||
GimpDisplay *display,
|
||||
GimpContext *context);
|
||||
static void gimp_context_real_set_display (GimpContext *context,
|
||||
gpointer display);
|
||||
GimpDisplay *display);
|
||||
|
||||
/* tool */
|
||||
static void gimp_context_tool_dirty (GimpToolInfo *tool_info,
|
||||
|
|
@ -420,7 +421,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
G_STRUCT_OFFSET (GimpContextClass, display_changed),
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GIMP_TYPE_OBJECT);
|
||||
GIMP_TYPE_DISPLAY);
|
||||
|
||||
gimp_context_signals[TOOL_CHANGED] =
|
||||
g_signal_new ("tool-changed",
|
||||
|
|
@ -644,7 +645,7 @@ gimp_context_class_init (GimpContextClass *klass)
|
|||
g_object_class_install_property (object_class, GIMP_CONTEXT_PROP_DISPLAY,
|
||||
g_param_spec_object (gimp_context_prop_names[GIMP_CONTEXT_PROP_DISPLAY],
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_OBJECT,
|
||||
GIMP_TYPE_DISPLAY,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
GIMP_CONFIG_PROP_OBJECT (object_class, GIMP_CONTEXT_PROP_TOOL,
|
||||
|
|
@ -1940,7 +1941,7 @@ gimp_context_real_set_image (GimpContext *context,
|
|||
/*****************************************************************************/
|
||||
/* display *****************************************************************/
|
||||
|
||||
gpointer
|
||||
GimpDisplay *
|
||||
gimp_context_get_display (GimpContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
|
|
@ -1950,10 +1951,10 @@ gimp_context_get_display (GimpContext *context)
|
|||
|
||||
void
|
||||
gimp_context_set_display (GimpContext *context,
|
||||
gpointer display)
|
||||
GimpDisplay *display)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display));
|
||||
g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display));
|
||||
|
||||
context_find_defined (context, GIMP_CONTEXT_PROP_DISPLAY);
|
||||
|
||||
|
|
@ -1972,7 +1973,7 @@ gimp_context_display_changed (GimpContext *context)
|
|||
|
||||
static void
|
||||
gimp_context_display_removed (GimpContainer *container,
|
||||
gpointer display,
|
||||
GimpDisplay *display,
|
||||
GimpContext *context)
|
||||
{
|
||||
if (context->display == display)
|
||||
|
|
@ -1981,9 +1982,9 @@ gimp_context_display_removed (GimpContainer *container,
|
|||
|
||||
static void
|
||||
gimp_context_real_set_display (GimpContext *context,
|
||||
gpointer display)
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpObject *old_display;
|
||||
GimpDisplay *old_display;
|
||||
|
||||
if (context->display == display)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ struct _GimpContext
|
|||
guint32 serialize_props;
|
||||
|
||||
GimpImage *image;
|
||||
gpointer display;
|
||||
GimpDisplay *display;
|
||||
|
||||
GimpToolInfo *tool_info;
|
||||
gchar *tool_name;
|
||||
|
|
@ -111,7 +111,7 @@ struct _GimpContextClass
|
|||
void (* image_changed) (GimpContext *context,
|
||||
GimpImage *image);
|
||||
void (* display_changed) (GimpContext *context,
|
||||
gpointer display);
|
||||
GimpDisplay *display);
|
||||
|
||||
void (* tool_changed) (GimpContext *context,
|
||||
GimpToolInfo *tool_info);
|
||||
|
|
@ -222,9 +222,9 @@ void gimp_context_image_changed (GimpContext *context);
|
|||
|
||||
|
||||
/* display */
|
||||
gpointer gimp_context_get_display (GimpContext *context);
|
||||
GimpDisplay * gimp_context_get_display (GimpContext *context);
|
||||
void gimp_context_set_display (GimpContext *context,
|
||||
gpointer display);
|
||||
GimpDisplay *display);
|
||||
void gimp_context_display_changed (GimpContext *context);
|
||||
|
||||
|
||||
|
|
|
|||
195
app/core/gimpdisplay.c
Normal file
195
app/core/gimpdisplay.c
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "config/gimpguiconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
|
||||
#include "gimpdisplay.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ID,
|
||||
PROP_GIMP
|
||||
};
|
||||
|
||||
|
||||
struct _GimpDisplayPrivate
|
||||
{
|
||||
gint id; /* unique identifier for this display */
|
||||
};
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_display_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_display_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GimpDisplay, gimp_display, GIMP_TYPE_OBJECT)
|
||||
|
||||
#define parent_class gimp_display_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_display_class_init (GimpDisplayClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_display_set_property;
|
||||
object_class->get_property = gimp_display_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ID,
|
||||
g_param_spec_int ("id",
|
||||
NULL, NULL,
|
||||
0, G_MAXINT, 0,
|
||||
GIMP_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GIMP,
|
||||
g_param_spec_object ("gimp",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_GIMP,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_init (GimpDisplay *display)
|
||||
{
|
||||
display->priv = gimp_display_get_instance_private (display);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (object);
|
||||
GimpDisplayPrivate *private = display->priv;
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GIMP:
|
||||
{
|
||||
gint id;
|
||||
|
||||
display->gimp = g_value_get_object (value); /* don't ref the gimp */
|
||||
display->config = GIMP_DISPLAY_CONFIG (display->gimp->config);
|
||||
|
||||
do
|
||||
{
|
||||
id = display->gimp->next_display_id++;
|
||||
|
||||
if (display->gimp->next_display_id == G_MAXINT)
|
||||
display->gimp->next_display_id = 1;
|
||||
}
|
||||
while (gimp_display_get_by_id (display->gimp, id));
|
||||
|
||||
private->id = id;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
g_value_set_int (value, display->priv->id);
|
||||
break;
|
||||
|
||||
case PROP_GIMP:
|
||||
g_value_set_object (value, display->gimp);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* public functions */
|
||||
|
||||
gint
|
||||
gimp_display_get_id (GimpDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (display), -1);
|
||||
|
||||
return display->priv->id;
|
||||
}
|
||||
|
||||
GimpDisplay *
|
||||
gimp_display_get_by_id (Gimp *gimp,
|
||||
gint id)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
for (list = gimp_get_display_iter (gimp);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpDisplay *display = list->data;
|
||||
|
||||
if (gimp_display_get_id (display) == id)
|
||||
return display;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Gimp *
|
||||
gimp_display_get_gimp (GimpDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
|
||||
|
||||
return display->gimp;
|
||||
}
|
||||
61
app/core/gimpdisplay.h
Normal file
61
app/core/gimpdisplay.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DISPLAY_H__
|
||||
#define __GIMP_DISPLAY_H__
|
||||
|
||||
|
||||
#include "gimpobject.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_DISPLAY (gimp_display_get_type ())
|
||||
#define GIMP_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY, GimpDisplay))
|
||||
#define GIMP_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY, GimpDisplayClass))
|
||||
#define GIMP_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY))
|
||||
#define GIMP_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY))
|
||||
#define GIMP_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY, GimpDisplayClass))
|
||||
|
||||
|
||||
typedef struct _GimpDisplayClass GimpDisplayClass;
|
||||
typedef struct _GimpDisplayPrivate GimpDisplayPrivate;
|
||||
|
||||
struct _GimpDisplay
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
|
||||
Gimp *gimp;
|
||||
GimpDisplayConfig *config;
|
||||
|
||||
GimpDisplayPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GimpDisplayClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_display_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gint gimp_display_get_id (GimpDisplay *display);
|
||||
GimpDisplay * gimp_display_get_by_id (Gimp *gimp,
|
||||
gint id);
|
||||
|
||||
Gimp * gimp_display_get_gimp (GimpDisplay *display);
|
||||
|
||||
|
||||
#endif /* __GIMP_DISPLAY_H__ */
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
#include "core-types.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimplayermask.h"
|
||||
|
|
@ -383,7 +384,7 @@ gimp_param_image_init (GParamSpec *pspec)
|
|||
|
||||
static gboolean
|
||||
gimp_param_image_validate (GParamSpec *pspec,
|
||||
GValue *value)
|
||||
GValue *value)
|
||||
{
|
||||
GimpParamSpecImage *ispec = GIMP_PARAM_SPEC_IMAGE (pspec);
|
||||
GimpImage *image = value->data[0].v_pointer;
|
||||
|
|
@ -876,10 +877,10 @@ gimp_param_spec_vectors (const gchar *name,
|
|||
* GIMP_TYPE_PARAM_DISPLAY
|
||||
*/
|
||||
|
||||
static void gimp_param_display_class_init (GParamSpecClass *klass);
|
||||
static void gimp_param_display_init (GParamSpec *pspec);
|
||||
static gboolean gimp_param_display_validate (GParamSpec *pspec,
|
||||
GValue *value);
|
||||
static void gimp_param_display_class_init (GParamSpecClass *klass);
|
||||
static void gimp_param_display_init (GParamSpec *pspec);
|
||||
static gboolean gimp_param_display_validate (GParamSpec *pspec,
|
||||
GValue *value);
|
||||
|
||||
GType
|
||||
gimp_param_display_get_type (void)
|
||||
|
|
@ -909,33 +910,29 @@ gimp_param_display_get_type (void)
|
|||
static void
|
||||
gimp_param_display_class_init (GParamSpecClass *klass)
|
||||
{
|
||||
klass->value_type = g_type_from_name ("GimpDisplay");
|
||||
|
||||
g_assert (klass->value_type != G_TYPE_NONE);
|
||||
|
||||
klass->value_type = GIMP_TYPE_DISPLAY;
|
||||
klass->value_validate = gimp_param_display_validate;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_param_display_init (GParamSpec *pspec)
|
||||
{
|
||||
GimpParamSpecDisplay *ispec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
||||
GimpParamSpecDisplay *dspec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
||||
|
||||
ispec->none_ok = FALSE;
|
||||
dspec->none_ok = FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_param_display_validate (GParamSpec *pspec,
|
||||
GValue *value)
|
||||
{
|
||||
GimpParamSpecDisplay *ispec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
||||
GObject *display = value->data[0].v_pointer;
|
||||
GimpParamSpecDisplay *dspec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
||||
GimpDisplay *display = value->data[0].v_pointer;
|
||||
|
||||
if (! ispec->none_ok && display == NULL)
|
||||
if (! dspec->none_ok && display == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (display && ! g_value_type_compatible (G_OBJECT_TYPE (display),
|
||||
G_PARAM_SPEC_VALUE_TYPE (pspec)))
|
||||
if (display && ! GIMP_IS_DISPLAY (display))
|
||||
{
|
||||
g_object_unref (display);
|
||||
value->data[0].v_pointer = NULL;
|
||||
|
|
@ -952,12 +949,12 @@ gimp_param_spec_display (const gchar *name,
|
|||
gboolean none_ok,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GimpParamSpecDisplay *ispec;
|
||||
GimpParamSpecDisplay *dspec;
|
||||
|
||||
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_DISPLAY,
|
||||
dspec = g_param_spec_internal (GIMP_TYPE_PARAM_DISPLAY,
|
||||
name, nick, blurb, flags);
|
||||
|
||||
ispec->none_ok = none_ok ? TRUE : FALSE;
|
||||
dspec->none_ok = none_ok ? TRUE : FALSE;
|
||||
|
||||
return G_PARAM_SPEC (ispec);
|
||||
return G_PARAM_SPEC (dspec);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,13 +210,13 @@ struct _GimpParamSpecChannel
|
|||
GimpParamSpecDrawable parent_instance;
|
||||
};
|
||||
|
||||
GType gimp_param_channel_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_param_channel_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GParamSpec * gimp_param_spec_channel (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
gboolean none_ok,
|
||||
GParamFlags flags);
|
||||
GParamSpec * gimp_param_spec_channel (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
gboolean none_ok,
|
||||
GParamFlags flags);
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -305,7 +305,7 @@ GParamSpec * gimp_param_spec_vectors (const gchar *name,
|
|||
*/
|
||||
|
||||
#define GIMP_VALUE_HOLDS_DISPLAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value),\
|
||||
GIMP_TYPE_OBJECT))
|
||||
GIMP_TYPE_DISPLAY))
|
||||
|
||||
#define GIMP_TYPE_PARAM_DISPLAY (gimp_param_display_get_type ())
|
||||
#define GIMP_PARAM_SPEC_DISPLAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_DISPLAY, GimpParamSpecDisplay))
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ typedef struct _GimpCanvas GimpCanvas;
|
|||
typedef struct _GimpCanvasGroup GimpCanvasGroup;
|
||||
typedef struct _GimpCanvasItem GimpCanvasItem;
|
||||
|
||||
typedef struct _GimpDisplay GimpDisplay;
|
||||
typedef struct _GimpDisplayShell GimpDisplayShell;
|
||||
typedef struct _GimpMotionBuffer GimpMotionBuffer;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,19 +59,13 @@
|
|||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ID,
|
||||
PROP_GIMP,
|
||||
PROP_IMAGE,
|
||||
PROP_SHELL
|
||||
};
|
||||
|
||||
|
||||
typedef struct _GimpDisplayPrivate GimpDisplayPrivate;
|
||||
|
||||
struct _GimpDisplayPrivate
|
||||
struct _GimpDisplayImplPrivate
|
||||
{
|
||||
gint ID; /* unique identifier for this display */
|
||||
|
||||
GimpImage *image; /* pointer to the associated image */
|
||||
gint instance; /* the instance # of this display as
|
||||
* taken from the image at creation */
|
||||
|
|
@ -80,9 +74,6 @@ struct _GimpDisplayPrivate
|
|||
cairo_region_t *update_region;
|
||||
};
|
||||
|
||||
#define GIMP_DISPLAY_GET_PRIVATE(display) \
|
||||
((GimpDisplayPrivate *) gimp_display_get_instance_private ((GimpDisplay *) (display)))
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
|
|
@ -125,35 +116,22 @@ static void gimp_display_paint_area (GimpDisplay *displa
|
|||
gint h);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpDisplay, gimp_display, GIMP_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (GimpDisplay)
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpDisplayImpl, gimp_display_impl, GIMP_TYPE_DISPLAY,
|
||||
G_ADD_PRIVATE (GimpDisplayImpl)
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
|
||||
gimp_display_progress_iface_init))
|
||||
|
||||
#define parent_class gimp_display_parent_class
|
||||
#define parent_class gimp_display_impl_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_display_class_init (GimpDisplayClass *klass)
|
||||
gimp_display_impl_class_init (GimpDisplayImplClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_display_set_property;
|
||||
object_class->get_property = gimp_display_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_ID,
|
||||
g_param_spec_int ("id",
|
||||
NULL, NULL,
|
||||
0, G_MAXINT, 0,
|
||||
GIMP_PARAM_READABLE));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_GIMP,
|
||||
g_param_spec_object ("gimp",
|
||||
NULL, NULL,
|
||||
GIMP_TYPE_GIMP,
|
||||
GIMP_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property (object_class, PROP_IMAGE,
|
||||
g_param_spec_object ("image",
|
||||
NULL, NULL,
|
||||
|
|
@ -168,8 +146,9 @@ gimp_display_class_init (GimpDisplayClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_display_init (GimpDisplay *display)
|
||||
gimp_display_impl_init (GimpDisplayImpl *display)
|
||||
{
|
||||
display->priv = gimp_display_impl_get_instance_private (display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -192,31 +171,8 @@ gimp_display_set_property (GObject *object,
|
|||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (object);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_GIMP:
|
||||
{
|
||||
gint ID;
|
||||
|
||||
display->gimp = g_value_get_object (value); /* don't ref the gimp */
|
||||
display->config = GIMP_DISPLAY_CONFIG (display->gimp->config);
|
||||
|
||||
do
|
||||
{
|
||||
ID = display->gimp->next_display_id++;
|
||||
|
||||
if (display->gimp->next_display_id == G_MAXINT)
|
||||
display->gimp->next_display_id = 1;
|
||||
}
|
||||
while (gimp_display_get_by_id (display->gimp, ID));
|
||||
|
||||
private->ID = ID;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
|
|
@ -229,25 +185,16 @@ gimp_display_get_property (GObject *object,
|
|||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (object);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
g_value_set_int (value, private->ID);
|
||||
break;
|
||||
|
||||
case PROP_GIMP:
|
||||
g_value_set_object (value, display->gimp);
|
||||
break;
|
||||
|
||||
case PROP_IMAGE:
|
||||
g_value_set_object (value, private->image);
|
||||
g_value_set_object (value, display->priv->image);
|
||||
break;
|
||||
|
||||
case PROP_SHELL:
|
||||
g_value_set_object (value, private->shell);
|
||||
g_value_set_object (value, display->priv->shell);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -261,11 +208,11 @@ gimp_display_progress_start (GimpProgress *progress,
|
|||
gboolean cancellable,
|
||||
const gchar *message)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
return gimp_progress_start (GIMP_PROGRESS (private->shell), cancellable,
|
||||
if (display->priv->shell)
|
||||
return gimp_progress_start (GIMP_PROGRESS (display->priv->shell),
|
||||
cancellable,
|
||||
"%s", message);
|
||||
|
||||
return NULL;
|
||||
|
|
@ -274,21 +221,19 @@ gimp_display_progress_start (GimpProgress *progress,
|
|||
static void
|
||||
gimp_display_progress_end (GimpProgress *progress)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
gimp_progress_end (GIMP_PROGRESS (private->shell));
|
||||
if (display->priv->shell)
|
||||
gimp_progress_end (GIMP_PROGRESS (display->priv->shell));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_display_progress_is_active (GimpProgress *progress)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
return gimp_progress_is_active (GIMP_PROGRESS (private->shell));
|
||||
if (display->priv->shell)
|
||||
return gimp_progress_is_active (GIMP_PROGRESS (display->priv->shell));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -297,32 +242,31 @@ static void
|
|||
gimp_display_progress_set_text (GimpProgress *progress,
|
||||
const gchar *message)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
gimp_progress_set_text_literal (GIMP_PROGRESS (private->shell), message);
|
||||
if (display->priv->shell)
|
||||
gimp_progress_set_text_literal (GIMP_PROGRESS (display->priv->shell),
|
||||
message);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_progress_set_value (GimpProgress *progress,
|
||||
gdouble percentage)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
gimp_progress_set_value (GIMP_PROGRESS (private->shell), percentage);
|
||||
if (display->priv->shell)
|
||||
gimp_progress_set_value (GIMP_PROGRESS (display->priv->shell),
|
||||
percentage);
|
||||
}
|
||||
|
||||
static gdouble
|
||||
gimp_display_progress_get_value (GimpProgress *progress)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
return gimp_progress_get_value (GIMP_PROGRESS (private->shell));
|
||||
if (display->priv->shell)
|
||||
return gimp_progress_get_value (GIMP_PROGRESS (display->priv->shell));
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
|
@ -330,21 +274,19 @@ gimp_display_progress_get_value (GimpProgress *progress)
|
|||
static void
|
||||
gimp_display_progress_pulse (GimpProgress *progress)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
gimp_progress_pulse (GIMP_PROGRESS (private->shell));
|
||||
if (display->priv->shell)
|
||||
gimp_progress_pulse (GIMP_PROGRESS (display->priv->shell));
|
||||
}
|
||||
|
||||
static guint32
|
||||
gimp_display_progress_get_window_id (GimpProgress *progress)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
return gimp_progress_get_window_id (GIMP_PROGRESS (private->shell));
|
||||
if (display->priv->shell)
|
||||
return gimp_progress_get_window_id (GIMP_PROGRESS (display->priv->shell));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -356,11 +298,10 @@ gimp_display_progress_message (GimpProgress *progress,
|
|||
const gchar *domain,
|
||||
const gchar *message)
|
||||
{
|
||||
GimpDisplay *display = GIMP_DISPLAY (progress);
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImpl *display = GIMP_DISPLAY_IMPL (progress);
|
||||
|
||||
if (private->shell)
|
||||
return gimp_progress_message (GIMP_PROGRESS (private->shell), gimp,
|
||||
if (display->priv->shell)
|
||||
return gimp_progress_message (GIMP_PROGRESS (display->priv->shell), gimp,
|
||||
severity, domain, message);
|
||||
|
||||
return FALSE;
|
||||
|
|
@ -385,10 +326,10 @@ gimp_display_new (Gimp *gimp,
|
|||
GimpDialogFactory *dialog_factory,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
GimpDisplay *display;
|
||||
GimpDisplayPrivate *private;
|
||||
GimpImageWindow *window = NULL;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplay *display;
|
||||
GimpDisplayImplPrivate *private;
|
||||
GimpImageWindow *window = NULL;
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
|
||||
|
|
@ -398,11 +339,11 @@ gimp_display_new (Gimp *gimp,
|
|||
if (gimp->no_interface)
|
||||
return NULL;
|
||||
|
||||
display = g_object_new (GIMP_TYPE_DISPLAY,
|
||||
display = g_object_new (GIMP_TYPE_DISPLAY_IMPL,
|
||||
"gimp", gimp,
|
||||
NULL);
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
private = GIMP_DISPLAY_IMPL (display)->priv;
|
||||
|
||||
/* refs the image */
|
||||
if (image)
|
||||
|
|
@ -472,12 +413,12 @@ gimp_display_new (Gimp *gimp,
|
|||
void
|
||||
gimp_display_delete (GimpDisplay *display)
|
||||
{
|
||||
GimpDisplayPrivate *private;
|
||||
GimpTool *active_tool;
|
||||
GimpDisplayImplPrivate *private;
|
||||
GimpTool *active_tool;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
private = GIMP_DISPLAY_IMPL (display)->priv;
|
||||
|
||||
/* remove the display from the list */
|
||||
gimp_container_remove (display->gimp->displays, GIMP_OBJECT (display));
|
||||
|
|
@ -548,39 +489,6 @@ gimp_display_close (GimpDisplay *display)
|
|||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_display_get_id (GimpDisplay *display)
|
||||
{
|
||||
GimpDisplayPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (display), -1);
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
|
||||
return private->ID;
|
||||
}
|
||||
|
||||
GimpDisplay *
|
||||
gimp_display_get_by_id (Gimp *gimp,
|
||||
gint id)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
|
||||
|
||||
for (list = gimp_get_display_iter (gimp);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpDisplay *display = list->data;
|
||||
|
||||
if (gimp_display_get_id (display) == id)
|
||||
return display;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_get_action_name:
|
||||
* @display:
|
||||
|
|
@ -597,34 +505,26 @@ gimp_display_get_action_name (GimpDisplay *display)
|
|||
gimp_display_get_id (display));
|
||||
}
|
||||
|
||||
Gimp *
|
||||
gimp_display_get_gimp (GimpDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
|
||||
|
||||
return display->gimp;
|
||||
}
|
||||
|
||||
GimpImage *
|
||||
gimp_display_get_image (GimpDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
|
||||
|
||||
return GIMP_DISPLAY_GET_PRIVATE (display)->image;
|
||||
return GIMP_DISPLAY_IMPL (display)->priv->image;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_set_image (GimpDisplay *display,
|
||||
GimpImage *image)
|
||||
{
|
||||
GimpDisplayPrivate *private;
|
||||
GimpImage *old_image = NULL;
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplayImplPrivate *private;
|
||||
GimpImage *old_image = NULL;
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
||||
g_return_if_fail (image == NULL || GIMP_IS_IMAGE (image));
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
private = GIMP_DISPLAY_IMPL (display)->priv;
|
||||
|
||||
shell = gimp_display_get_shell (display);
|
||||
|
||||
|
|
@ -694,36 +594,28 @@ gimp_display_set_image (GimpDisplay *display,
|
|||
gint
|
||||
gimp_display_get_instance (GimpDisplay *display)
|
||||
{
|
||||
GimpDisplayPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (display), 0);
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
|
||||
return private->instance;
|
||||
return GIMP_DISPLAY_IMPL (display)->priv->instance;
|
||||
}
|
||||
|
||||
GimpDisplayShell *
|
||||
gimp_display_get_shell (GimpDisplay *display)
|
||||
{
|
||||
GimpDisplayPrivate *private;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY (display), NULL);
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
|
||||
return GIMP_DISPLAY_SHELL (private->shell);
|
||||
return GIMP_DISPLAY_SHELL (GIMP_DISPLAY_IMPL (display)->priv->shell);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_empty (GimpDisplay *display)
|
||||
{
|
||||
GimpDisplayPrivate *private;
|
||||
GList *iter;
|
||||
GimpDisplayImplPrivate *private;
|
||||
GList *iter;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
private = GIMP_DISPLAY_IMPL (display)->priv;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (private->image));
|
||||
|
||||
|
|
@ -746,12 +638,12 @@ gimp_display_fill (GimpDisplay *display,
|
|||
GimpUnit unit,
|
||||
gdouble scale)
|
||||
{
|
||||
GimpDisplayPrivate *private;
|
||||
GimpDisplayImplPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
||||
g_return_if_fail (GIMP_IS_IMAGE (image));
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
private = GIMP_DISPLAY_IMPL (display)->priv;
|
||||
|
||||
g_return_if_fail (private->image == NULL);
|
||||
|
||||
|
|
@ -769,11 +661,11 @@ gimp_display_update_area (GimpDisplay *display,
|
|||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpDisplayPrivate *private;
|
||||
GimpDisplayImplPrivate *private;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (display));
|
||||
|
||||
private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
private = GIMP_DISPLAY_IMPL (display)->priv;
|
||||
|
||||
if (now)
|
||||
{
|
||||
|
|
@ -824,7 +716,7 @@ gimp_display_flush_now (GimpDisplay *display)
|
|||
static void
|
||||
gimp_display_flush_update_region (GimpDisplay *display)
|
||||
{
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayImplPrivate *private = GIMP_DISPLAY_IMPL (display)->priv;
|
||||
|
||||
if (private->update_region)
|
||||
{
|
||||
|
|
@ -856,12 +748,12 @@ gimp_display_paint_area (GimpDisplay *display,
|
|||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpDisplayPrivate *private = GIMP_DISPLAY_GET_PRIVATE (display);
|
||||
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
||||
gint image_width = gimp_image_get_width (private->image);
|
||||
gint image_height = gimp_image_get_height (private->image);
|
||||
gint x1, y1, x2, y2;
|
||||
gdouble x1_f, y1_f, x2_f, y2_f;
|
||||
GimpDisplayImplPrivate *private = GIMP_DISPLAY_IMPL (display)->priv;
|
||||
GimpDisplayShell *shell = gimp_display_get_shell (display);
|
||||
gint image_width = gimp_image_get_width (private->image);
|
||||
gint image_height = gimp_image_get_height (private->image);
|
||||
gint x1, y1, x2, y2;
|
||||
gdouble x1_f, y1_f, x2_f, y2_f;
|
||||
|
||||
/* Bounds check */
|
||||
x1 = CLAMP (x, 0, image_width);
|
||||
|
|
|
|||
|
|
@ -15,39 +15,41 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DISPLAY_H__
|
||||
#define __GIMP_DISPLAY_H__
|
||||
#ifndef __GIMP_DISPLAY_IMPL_H__
|
||||
#define __GIMP_DISPLAY_IMPL_H__
|
||||
|
||||
|
||||
#include "core/gimpobject.h"
|
||||
#include "core/gimpdisplay.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_DISPLAY (gimp_display_get_type ())
|
||||
#define GIMP_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY, GimpDisplay))
|
||||
#define GIMP_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY, GimpDisplayClass))
|
||||
#define GIMP_IS_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY))
|
||||
#define GIMP_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY))
|
||||
#define GIMP_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY, GimpDisplayClass))
|
||||
#define GIMP_TYPE_DISPLAY_IMPL (gimp_display_impl_get_type ())
|
||||
#define GIMP_DISPLAY_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY_IMPL, GimpDisplayImpl))
|
||||
#define GIMP_DISPLAY_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY_IMPL, GimpDisplayImplClass))
|
||||
#define GIMP_IS_DISPLAY_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY_IMPL))
|
||||
#define GIMP_IS_DISPLAY_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY_IMPL))
|
||||
#define GIMP_DISPLAY_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY_IMPL, GimpDisplayImplClass))
|
||||
|
||||
|
||||
typedef struct _GimpDisplayClass GimpDisplayClass;
|
||||
typedef struct _GimpDisplayImpl GimpDisplayImpl;
|
||||
typedef struct _GimpDisplayImplClass GimpDisplayImplClass;
|
||||
typedef struct _GimpDisplayImplPrivate GimpDisplayImplPrivate;
|
||||
|
||||
struct _GimpDisplay
|
||||
|
||||
struct _GimpDisplayImpl
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
GimpDisplay parent_instance;
|
||||
|
||||
Gimp *gimp;
|
||||
GimpDisplayConfig *config;
|
||||
GimpDisplayImplPrivate *priv;
|
||||
|
||||
};
|
||||
|
||||
struct _GimpDisplayClass
|
||||
struct _GimpDisplayImplClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
GimpDisplayClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_display_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_display_impl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpDisplay * gimp_display_new (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
|
|
@ -59,14 +61,8 @@ GimpDisplay * gimp_display_new (Gimp *gimp,
|
|||
void gimp_display_delete (GimpDisplay *display);
|
||||
void gimp_display_close (GimpDisplay *display);
|
||||
|
||||
gint gimp_display_get_id (GimpDisplay *display);
|
||||
GimpDisplay * gimp_display_get_by_id (Gimp *gimp,
|
||||
gint id);
|
||||
|
||||
gchar * gimp_display_get_action_name (GimpDisplay *display);
|
||||
|
||||
Gimp * gimp_display_get_gimp (GimpDisplay *display);
|
||||
|
||||
GimpImage * gimp_display_get_image (GimpDisplay *display);
|
||||
void gimp_display_set_image (GimpDisplay *display,
|
||||
GimpImage *image);
|
||||
|
|
@ -92,4 +88,4 @@ void gimp_display_flush (GimpDisplay *display);
|
|||
void gimp_display_flush_now (GimpDisplay *display);
|
||||
|
||||
|
||||
#endif /* __GIMP_DISPLAY_H__ */
|
||||
#endif /* __GIMP_DISPLAY_IMPL_H__ */
|
||||
|
|
|
|||
|
|
@ -682,7 +682,7 @@ file_open_from_command_line (Gimp *gimp,
|
|||
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpObject *display;
|
||||
GimpDisplay *display;
|
||||
GimpPDBStatusType status;
|
||||
gboolean success = FALSE;
|
||||
GError *error = NULL;
|
||||
|
|
|
|||
|
|
@ -128,17 +128,14 @@ static guint32 gui_get_user_time (Gimp *gimp);
|
|||
static GFile * gui_get_theme_dir (Gimp *gimp);
|
||||
static GFile * gui_get_icon_theme_dir (Gimp *gimp);
|
||||
static GimpObject * gui_get_window_strategy (Gimp *gimp);
|
||||
static GimpObject * gui_get_empty_display (Gimp *gimp);
|
||||
static GimpObject * gui_display_get_by_id (Gimp *gimp,
|
||||
gint ID);
|
||||
static gint gui_display_get_id (GimpObject *display);
|
||||
static guint32 gui_display_get_window_id (GimpObject *display);
|
||||
static GimpObject * gui_display_create (Gimp *gimp,
|
||||
static GimpDisplay * gui_get_empty_display (Gimp *gimp);
|
||||
static guint32 gui_display_get_window_id (GimpDisplay *display);
|
||||
static GimpDisplay * gui_display_create (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
gdouble scale,
|
||||
GObject *monitor);
|
||||
static void gui_display_delete (GimpObject *display);
|
||||
static void gui_display_delete (GimpDisplay *display);
|
||||
static void gui_displays_reconnect (Gimp *gimp,
|
||||
GimpImage *old_image,
|
||||
GimpImage *new_image);
|
||||
|
|
@ -146,7 +143,7 @@ static gboolean gui_wait (Gimp *gimp,
|
|||
GimpWaitable *waitable,
|
||||
const gchar *message);
|
||||
static GimpProgress * gui_new_progress (Gimp *gimp,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
static void gui_free_progress (Gimp *gimp,
|
||||
GimpProgress *progress);
|
||||
static gboolean gui_pdb_dialog_new (Gimp *gimp,
|
||||
|
|
@ -203,8 +200,6 @@ gui_vtable_init (Gimp *gimp)
|
|||
gimp->gui.get_icon_theme_dir = gui_get_icon_theme_dir;
|
||||
gimp->gui.get_window_strategy = gui_get_window_strategy;
|
||||
gimp->gui.get_empty_display = gui_get_empty_display;
|
||||
gimp->gui.display_get_by_id = gui_display_get_by_id;
|
||||
gimp->gui.display_get_id = gui_display_get_id;
|
||||
gimp->gui.display_get_window_id = gui_display_get_window_id;
|
||||
gimp->gui.display_create = gui_display_create;
|
||||
gimp->gui.display_delete = gui_display_delete;
|
||||
|
|
@ -345,16 +340,16 @@ gui_get_window_strategy (Gimp *gimp)
|
|||
return gimp_multi_window_strategy_get_singleton ();
|
||||
}
|
||||
|
||||
static GimpObject *
|
||||
static GimpDisplay *
|
||||
gui_get_empty_display (Gimp *gimp)
|
||||
{
|
||||
GimpObject *display = NULL;
|
||||
GimpDisplay *display = NULL;
|
||||
|
||||
if (gimp_container_get_n_children (gimp->displays) == 1)
|
||||
{
|
||||
display = gimp_container_get_first_child (gimp->displays);
|
||||
display = (GimpDisplay *) gimp_container_get_first_child (gimp->displays);
|
||||
|
||||
if (gimp_display_get_image (GIMP_DISPLAY (display)))
|
||||
if (gimp_display_get_image (display))
|
||||
{
|
||||
/* The display was not empty */
|
||||
display = NULL;
|
||||
|
|
@ -364,21 +359,8 @@ gui_get_empty_display (Gimp *gimp)
|
|||
return display;
|
||||
}
|
||||
|
||||
static GimpObject *
|
||||
gui_display_get_by_id (Gimp *gimp,
|
||||
gint id)
|
||||
{
|
||||
return (GimpObject *) gimp_display_get_by_id (gimp, id);
|
||||
}
|
||||
|
||||
static gint
|
||||
gui_display_get_id (GimpObject *display)
|
||||
{
|
||||
return gimp_display_get_id (GIMP_DISPLAY (display));
|
||||
}
|
||||
|
||||
static guint32
|
||||
gui_display_get_window_id (GimpObject *display)
|
||||
gui_display_get_window_id (GimpDisplay *display)
|
||||
{
|
||||
GimpDisplay *disp = GIMP_DISPLAY (display);
|
||||
GimpDisplayShell *shell = gimp_display_get_shell (disp);
|
||||
|
|
@ -394,7 +376,7 @@ gui_display_get_window_id (GimpObject *display)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static GimpObject *
|
||||
static GimpDisplay *
|
||||
gui_display_create (Gimp *gimp,
|
||||
GimpImage *image,
|
||||
GimpUnit unit,
|
||||
|
|
@ -433,13 +415,13 @@ gui_display_create (Gimp *gimp,
|
|||
gimp_context_set_display (context, display);
|
||||
}
|
||||
|
||||
return GIMP_OBJECT (display);
|
||||
return display;
|
||||
}
|
||||
|
||||
static void
|
||||
gui_display_delete (GimpObject *display)
|
||||
gui_display_delete (GimpDisplay *display)
|
||||
{
|
||||
gimp_display_close (GIMP_DISPLAY (display));
|
||||
gimp_display_close (display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -563,8 +545,8 @@ gui_wait (Gimp *gimp,
|
|||
}
|
||||
|
||||
static GimpProgress *
|
||||
gui_new_progress (Gimp *gimp,
|
||||
GimpObject *display)
|
||||
gui_new_progress (Gimp *gimp,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (display == NULL || GIMP_IS_DISPLAY (display), NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpdisplay.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ display_id_is_valid_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
valid = (gimp_get_display_by_id (gimp, display_id) != NULL);
|
||||
valid = (gimp_display_get_by_id (gimp, display_id) != NULL);
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
|
|
@ -77,7 +78,7 @@ display_new_invoker (GimpProcedure *procedure,
|
|||
gboolean success = TRUE;
|
||||
GimpValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
GimpObject *display = NULL;
|
||||
GimpDisplay *display = NULL;
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
|
||||
|
|
@ -117,7 +118,7 @@ display_delete_invoker (GimpProcedure *procedure,
|
|||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GimpObject *display;
|
||||
GimpDisplay *display;
|
||||
|
||||
display = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
|
||||
|
|
@ -140,7 +141,7 @@ display_get_window_handle_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
GimpValueArray *return_vals;
|
||||
GimpObject *display;
|
||||
GimpDisplay *display;
|
||||
gint window = 0;
|
||||
|
||||
display = g_value_get_object (gimp_value_array_index (args, 0));
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "core/gimp.h"
|
||||
#include "core/gimp-memsize.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpdisplay.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
#include "core/gimpprogress.h"
|
||||
|
|
@ -66,7 +67,7 @@ static void gimp_procedure_real_execute_async (GimpProcedure *proced
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
|
||||
static void gimp_procedure_free_strings (GimpProcedure *procedure);
|
||||
static gboolean gimp_procedure_validate_args (GimpProcedure *procedure,
|
||||
|
|
@ -220,7 +221,7 @@ gimp_procedure_real_execute_async (GimpProcedure *procedure,
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display)
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpValueArray *return_vals;
|
||||
GError *error = NULL;
|
||||
|
|
@ -496,7 +497,7 @@ gimp_procedure_execute_async (GimpProcedure *procedure,
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display,
|
||||
GimpDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
|
||||
|
|
@ -504,7 +505,7 @@ gimp_procedure_execute_async (GimpProcedure *procedure,
|
|||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
||||
g_return_if_fail (args != NULL);
|
||||
g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display));
|
||||
g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display));
|
||||
g_return_if_fail (error == NULL || *error == NULL);
|
||||
|
||||
if (gimp_procedure_validate_args (procedure,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ struct _GimpProcedureClass
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ void gimp_procedure_execute_async (GimpProcedure *procedure,
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display,
|
||||
GimpDisplay *display,
|
||||
GError **error);
|
||||
|
||||
gint gimp_procedure_name_compare (GimpProcedure *proc1,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ progress_init_invoker (GimpProcedure *procedure,
|
|||
{
|
||||
gboolean success = TRUE;
|
||||
const gchar *message;
|
||||
GimpObject *gdisplay;
|
||||
GimpDisplay *gdisplay;
|
||||
|
||||
message = g_value_get_string (gimp_value_array_index (args, 0));
|
||||
gdisplay = g_value_get_object (gimp_value_array_index (args, 1));
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "plug-in-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdisplay.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "plug-in-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdisplay.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
#include "core/gimppdbprogress.h"
|
||||
#include "core/gimpprogress.h"
|
||||
|
|
@ -91,12 +92,12 @@ gimp_plug_in_progress_detach (GimpProgress *progress)
|
|||
void
|
||||
gimp_plug_in_progress_start (GimpPlugIn *plug_in,
|
||||
const gchar *message,
|
||||
GimpObject *display)
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpPlugInProcFrame *proc_frame;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
|
||||
g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display));
|
||||
g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display));
|
||||
|
||||
proc_frame = gimp_plug_in_get_proc_frame (plug_in);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ gint gimp_plug_in_progress_detach (GimpProgress *progress);
|
|||
|
||||
void gimp_plug_in_progress_start (GimpPlugIn *plug_in,
|
||||
const gchar *message,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
void gimp_plug_in_progress_end (GimpPlugIn *plug_in,
|
||||
GimpPlugInProcFrame *proc_frame);
|
||||
void gimp_plug_in_progress_set_text (GimpPlugIn *plug_in,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include "config/gimpguiconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdisplay.h"
|
||||
#include "core/gimpprogress.h"
|
||||
|
||||
#include "pdb/gimppdbcontext.h"
|
||||
|
|
@ -151,7 +152,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
|
|||
GimpPlugInProcedure *procedure,
|
||||
GimpValueArray *args,
|
||||
gboolean synchronous,
|
||||
GimpObject *display)
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpValueArray *return_vals = NULL;
|
||||
GimpPlugIn *plug_in;
|
||||
|
|
@ -161,7 +162,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
|
|||
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (procedure), NULL);
|
||||
g_return_val_if_fail (args != NULL, NULL);
|
||||
g_return_val_if_fail (display == NULL || GIMP_IS_OBJECT (display), NULL);
|
||||
g_return_val_if_fail (display == NULL || GIMP_IS_DISPLAY (display), NULL);
|
||||
|
||||
plug_in = gimp_plug_in_new (manager, context, progress, procedure, NULL);
|
||||
|
||||
|
|
@ -194,7 +195,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
|
|||
return return_vals;
|
||||
}
|
||||
|
||||
display_id = display ? gimp_get_display_id (manager->gimp, display) : -1;
|
||||
display_id = display ? gimp_display_get_id (display) : -1;
|
||||
|
||||
icon_theme_dir = gimp_get_icon_theme_dir (manager->gimp);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ GimpValueArray * gimp_plug_in_manager_call_run (GimpPlugInManager *man
|
|||
GimpPlugInProcedure *procedure,
|
||||
GimpValueArray *args,
|
||||
gboolean synchronous,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
|
||||
/* Run a temp plug-in proc as if it were a procedure database procedure
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ static void gimp_plug_in_procedure_execute_async (GimpProcedure *procedur
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
|
||||
static GFile * gimp_plug_in_procedure_real_get_file (GimpPlugInProcedure *procedure);
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display)
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpPlugInProcedure *plug_in_procedure = GIMP_PLUG_IN_PROCEDURE (procedure);
|
||||
GError *error = NULL;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static void gimp_temporary_procedure_execute_async (GimpProcedure *proce
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display);
|
||||
GimpDisplay *display);
|
||||
|
||||
static GFile * gimp_temporary_procedure_get_file (GimpPlugInProcedure *procedure);
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ gimp_temporary_procedure_execute_async (GimpProcedure *procedure,
|
|||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
GimpValueArray *args,
|
||||
GimpObject *display)
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpTemporaryProcedure *temp_procedure = GIMP_TEMPORARY_PROCEDURE (procedure);
|
||||
GimpValueArray *return_vals;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ static GimpAlignmentType
|
|||
GimpDock *dock);
|
||||
static gboolean gimp_dock_window_should_add_to_recent (GimpDockWindow *dock_window);
|
||||
static void gimp_dock_window_display_changed (GimpDockWindow *dock_window,
|
||||
GimpObject *display,
|
||||
GimpDisplay *display,
|
||||
GimpContext *context);
|
||||
static void gimp_dock_window_image_changed (GimpDockWindow *dock_window,
|
||||
GimpImage *image,
|
||||
|
|
@ -155,7 +155,7 @@ static void gimp_dock_window_dock_removed (GimpDockWindo
|
|||
GimpDock *dock,
|
||||
GimpDockColumns *dock_columns);
|
||||
static void gimp_dock_window_factory_display_changed (GimpContext *context,
|
||||
GimpObject *display,
|
||||
GimpDisplay *display,
|
||||
GimpDock *dock);
|
||||
static void gimp_dock_window_factory_image_changed (GimpContext *context,
|
||||
GimpImage *image,
|
||||
|
|
@ -844,7 +844,7 @@ gimp_dock_window_image_flush (GimpImage *image,
|
|||
{
|
||||
if (image == gimp_context_get_image (dock_window->p->context))
|
||||
{
|
||||
GimpObject *display = gimp_context_get_display (dock_window->p->context);
|
||||
GimpDisplay *display = gimp_context_get_display (dock_window->p->context);
|
||||
|
||||
if (display)
|
||||
gimp_ui_manager_update (dock_window->p->ui_manager, display);
|
||||
|
|
@ -919,7 +919,7 @@ gimp_dock_window_dock_removed (GimpDockWindow *dock_window,
|
|||
|
||||
static void
|
||||
gimp_dock_window_factory_display_changed (GimpContext *context,
|
||||
GimpObject *display,
|
||||
GimpDisplay *display,
|
||||
GimpDock *dock)
|
||||
{
|
||||
GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (dock);
|
||||
|
|
@ -942,7 +942,7 @@ gimp_dock_window_factory_image_changed (GimpContext *context,
|
|||
|
||||
static void
|
||||
gimp_dock_window_display_changed (GimpDockWindow *dock_window,
|
||||
GimpObject *display,
|
||||
GimpDisplay *display,
|
||||
GimpContext *context)
|
||||
{
|
||||
/* make sure auto-follow-active works both ways */
|
||||
|
|
@ -991,9 +991,9 @@ gimp_dock_window_image_changed (GimpDockWindow *dock_window,
|
|||
}
|
||||
else if (image != NULL && ! gimp_container_is_empty (display_container))
|
||||
{
|
||||
GimpObject *display;
|
||||
GimpImage *display_image;
|
||||
gboolean find_display = TRUE;
|
||||
GimpDisplay *display;
|
||||
GimpImage *display_image;
|
||||
gboolean find_display = TRUE;
|
||||
|
||||
display = gimp_context_get_display (context);
|
||||
|
||||
|
|
@ -1018,7 +1018,7 @@ gimp_dock_window_image_changed (GimpDockWindow *dock_window,
|
|||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
display = GIMP_OBJECT (list->data);
|
||||
display = list->data;
|
||||
|
||||
g_object_get (display, "image", &display_image, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -183,9 +183,9 @@ gimp_drawable_tree_view_select_item (GimpContainerView *view,
|
|||
{
|
||||
Gimp *gimp = image->gimp;
|
||||
GimpContext *context = gimp_get_user_context (gimp);
|
||||
GObject *display = gimp_context_get_display (context);
|
||||
GimpDisplay *display = gimp_context_get_display (context);
|
||||
|
||||
gimp_message_literal (gimp, display, GIMP_MESSAGE_WARNING,
|
||||
gimp_message_literal (gimp, G_OBJECT (display), GIMP_MESSAGE_WARNING,
|
||||
_("Cannot select item while a floating "
|
||||
"selection is active."));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -341,9 +341,9 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
|
|||
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
|
||||
const gchar *type_name = NULL;
|
||||
|
||||
if (! strcmp (g_type_name (value_type), "GimpDisplay"))
|
||||
if (g_type_is_a (value_type, GIMP_TYPE_DISPLAY))
|
||||
{
|
||||
/* strcmp() because GimpDisplay is not visible from app/plug-in */
|
||||
/* g_type_is_a() because the core has a GimpDisplay subclasses */
|
||||
type_name = "GimpParamDisplay";
|
||||
}
|
||||
else if (value_type == GIMP_TYPE_IMAGE)
|
||||
|
|
@ -416,14 +416,14 @@ get_item_by_id (gpointer gimp,
|
|||
#endif
|
||||
}
|
||||
|
||||
static GObject *
|
||||
static GimpDisplay *
|
||||
get_display_by_id (gpointer gimp,
|
||||
gint id)
|
||||
{
|
||||
#ifdef LIBGIMP_COMPILATION
|
||||
return (GObject *) gimp_display_get_by_id (id);
|
||||
return gimp_display_get_by_id (id);
|
||||
#else
|
||||
return (GObject *) gimp_get_display_by_id (gimp, id);
|
||||
return gimp_display_get_by_id (gimp, id);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -835,25 +835,11 @@ _gimp_value_to_gp_param (const GValue *value,
|
|||
}
|
||||
else if (GIMP_VALUE_HOLDS_DISPLAY (value))
|
||||
{
|
||||
GObject *display = g_value_get_object (value);
|
||||
gint id = -1;
|
||||
|
||||
#if 0
|
||||
if (full_copy)
|
||||
{
|
||||
g_free (param->type_name);
|
||||
param->type_name = "GObject";
|
||||
}
|
||||
else
|
||||
param->type_name = (gchar *) "GObject";
|
||||
#endif
|
||||
GimpDisplay *display = g_value_get_object (value);
|
||||
|
||||
param->param_type = GP_PARAM_TYPE_INT;
|
||||
|
||||
if (display)
|
||||
g_object_get (display, "id", &id, NULL);
|
||||
|
||||
param->data.d_int = id;
|
||||
param->data.d_int = display ? gimp_display_get_id (display) : -1;
|
||||
}
|
||||
else if (G_VALUE_HOLDS_PARAM (value))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -222,10 +222,10 @@ gimp_param_item_validate (GParamSpec *pspec,
|
|||
**/
|
||||
GParamSpec *
|
||||
gimp_param_spec_item (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
gboolean none_ok,
|
||||
GParamFlags flags)
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
gboolean none_ok,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GimpParamSpecItem *ispec;
|
||||
|
||||
|
|
@ -894,9 +894,9 @@ gimp_param_display_class_init (GParamSpecClass *klass)
|
|||
static void
|
||||
gimp_param_display_init (GParamSpec *pspec)
|
||||
{
|
||||
GimpParamSpecDisplay *ispec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
||||
GimpParamSpecDisplay *dspec = GIMP_PARAM_SPEC_DISPLAY (pspec);
|
||||
|
||||
ispec->none_ok = FALSE;
|
||||
dspec->none_ok = FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -944,12 +944,12 @@ gimp_param_spec_display (const gchar *name,
|
|||
gboolean none_ok,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GimpParamSpecDisplay *ispec;
|
||||
GimpParamSpecDisplay *dspec;
|
||||
|
||||
ispec = g_param_spec_internal (GIMP_TYPE_PARAM_DISPLAY,
|
||||
dspec = g_param_spec_internal (GIMP_TYPE_PARAM_DISPLAY,
|
||||
name, nick, blurb, flags);
|
||||
|
||||
ispec->none_ok = none_ok ? TRUE : FALSE;
|
||||
dspec->none_ok = none_ok ? TRUE : FALSE;
|
||||
|
||||
return G_PARAM_SPEC (ispec);
|
||||
return G_PARAM_SPEC (dspec);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ HELP
|
|||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
valid = (gimp_get_display_by_id (gimp, display_id) != NULL);
|
||||
valid = (gimp_display_get_by_id (gimp, display_id) != NULL);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
|
@ -210,7 +210,8 @@ CODE
|
|||
}
|
||||
|
||||
|
||||
@headers = qw("core/gimp.h");
|
||||
@headers = qw("core/gimp.h"
|
||||
"core/gimpdisplay.h");
|
||||
|
||||
@procs = qw(display_id_is_valid
|
||||
display_new
|
||||
|
|
|
|||
|
|
@ -152,8 +152,8 @@ package Gimp::CodeGen::pdb;
|
|||
gtype => 'GIMP_TYPE_DISPLAY',
|
||||
type => 'GimpDisplay *',
|
||||
const_type => 'GimpDisplay *',
|
||||
app_type => 'GimpObject *',
|
||||
app_const_type => 'GimpObject *',
|
||||
app_type => 'GimpDisplay *',
|
||||
app_const_type => 'GimpDisplay *',
|
||||
init_value => 'NULL',
|
||||
out_annotate => '(transfer none)',
|
||||
get_value_func => '$var = g_value_get_object ($value)',
|
||||
|
|
|
|||
Loading…
Reference in a new issue