Ejemplo n.º 1
0
static void
gimp_perspective_clone_tool_options_notify (GimpTool         *tool,
                                            GimpToolOptions  *options,
                                            const GParamSpec *pspec)
{
  GimpPerspectiveCloneTool    *clone_tool = GIMP_PERSPECTIVE_CLONE_TOOL (tool);
  GimpPaintTool               *paint_tool = GIMP_PAINT_TOOL (tool);
  GimpPerspectiveCloneOptions *clone_options;

  clone_options = GIMP_PERSPECTIVE_CLONE_OPTIONS (options);

  GIMP_TOOL_CLASS (parent_class)->options_notify (tool, options, pspec);

  if (! strcmp (pspec->name, "clone-mode"))
    {
      GimpPerspectiveClone *clone;

      clone = GIMP_PERSPECTIVE_CLONE (GIMP_PAINT_TOOL (tool)->core);

      gimp_draw_tool_pause (GIMP_DRAW_TOOL (clone_tool));

      if (clone_options->clone_mode == GIMP_PERSPECTIVE_CLONE_MODE_PAINT)
        {
          gimp_perspective_clone_set_transform (clone, &clone_tool->transform);

          gimp_paint_tool_set_active (paint_tool, TRUE);
        }
      else
        {
          gimp_paint_tool_set_active (paint_tool, FALSE);

          gimp_tool_control_set_precision (tool->control,
                                           GIMP_CURSOR_PRECISION_SUBPIXEL);

          /*  start drawing the bounding box and handles...  */
          if (tool->display &&
              ! gimp_draw_tool_is_active (GIMP_DRAW_TOOL (clone_tool)))
            {
              gimp_draw_tool_start (GIMP_DRAW_TOOL (clone_tool), tool->display);
            }
        }

      gimp_draw_tool_resume (GIMP_DRAW_TOOL (clone_tool));
    }
}
Ejemplo n.º 2
0
static void
gimp_perspective_clone_options_get_property (GObject    *object,
                                             guint       property_id,
                                             GValue     *value,
                                             GParamSpec *pspec)
{
  GimpPerspectiveCloneOptions *options = GIMP_PERSPECTIVE_CLONE_OPTIONS (object);

  switch (property_id)
    {
    case PROP_CLONE_MODE:
      g_value_set_enum (value, options->clone_mode);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
}