Beispiel #1
0
static void
gimp_tagged_container_class_init (GimpTaggedContainerClass *klass)
{
  GObjectClass               *g_object_class    = G_OBJECT_CLASS (klass);
  GimpObjectClass            *gimp_object_class = GIMP_OBJECT_CLASS (klass);
  GimpContainerClass         *container_class   = GIMP_CONTAINER_CLASS (klass);
  GimpFilteredContainerClass *filtered_class    = GIMP_FILTERED_CONTAINER_CLASS (klass);

  g_object_class->dispose        = gimp_tagged_container_dispose;

  gimp_object_class->get_memsize = gimp_tagged_container_get_memsize;

  container_class->clear         = gimp_tagged_container_clear;

  filtered_class->src_add        = gimp_tagged_container_src_add;
  filtered_class->src_remove     = gimp_tagged_container_src_remove;
  filtered_class->src_freeze     = gimp_tagged_container_src_freeze;
  filtered_class->src_thaw       = gimp_tagged_container_src_thaw;

  klass->tag_count_changed       = gimp_tagged_container_tag_count_changed;

  gimp_tagged_container_signals[TAG_COUNT_CHANGED] =
    g_signal_new ("tag-count-changed",
                  GIMP_TYPE_TAGGED_CONTAINER,
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (GimpTaggedContainerClass, tag_count_changed),
                  NULL, NULL,
                  gimp_marshal_VOID__INT,
                  G_TYPE_NONE, 1,
                  G_TYPE_INT);
}
Beispiel #2
0
static void
gimp_list_class_init (GimpListClass *klass)
{
  GObjectClass       *object_class      = G_OBJECT_CLASS (klass);
  GimpObjectClass    *gimp_object_class = GIMP_OBJECT_CLASS (klass);
  GimpContainerClass *container_class   = GIMP_CONTAINER_CLASS (klass);

  object_class->set_property          = gimp_list_set_property;
  object_class->get_property          = gimp_list_get_property;

  gimp_object_class->get_memsize      = gimp_list_get_memsize;

  container_class->add                = gimp_list_add;
  container_class->remove             = gimp_list_remove;
  container_class->reorder            = gimp_list_reorder;
  container_class->clear              = gimp_list_clear;
  container_class->have               = gimp_list_have;
  container_class->foreach            = gimp_list_foreach;
  container_class->get_child_by_name  = gimp_list_get_child_by_name;
  container_class->get_child_by_index = gimp_list_get_child_by_index;
  container_class->get_child_index    = gimp_list_get_child_index;

  g_object_class_install_property (object_class, PROP_UNIQUE_NAMES,
                                   g_param_spec_boolean ("unique-names",
                                                         NULL, NULL,
                                                         FALSE,
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT_ONLY));

  g_object_class_install_property (object_class, PROP_SORT_FUNC,
                                   g_param_spec_pointer ("sort-func",
                                                         NULL, NULL,
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT));
}
Beispiel #3
0
static void
gimp_tagged_container_clear (GimpContainer *container)
{
  GimpFilteredContainer *filtered_container = GIMP_FILTERED_CONTAINER (container);
  GimpTaggedContainer   *tagged_container   = GIMP_TAGGED_CONTAINER (container);
  GList                 *list;

  for (list = GIMP_LIST (filtered_container->src_container)->queue->head;
       list;
       list = g_list_next (list))
    {
      g_signal_handlers_disconnect_by_func (list->data,
                                            gimp_tagged_container_tag_added,
                                            tagged_container);
      g_signal_handlers_disconnect_by_func (list->data,
                                            gimp_tagged_container_tag_removed,
                                            tagged_container);
    }

  if (tagged_container->tag_ref_counts)
    {
      g_hash_table_remove_all (tagged_container->tag_ref_counts);
      tagged_container->tag_count = 0;
    }

  GIMP_CONTAINER_CLASS (parent_class)->clear (container);
}
static void
gimp_filter_stack_remove (GimpContainer *container,
                          GimpObject    *object)
{
  GimpFilterStack *stack  = GIMP_FILTER_STACK (container);
  GimpFilter      *filter = GIMP_FILTER (object);
  gint             n_children;

  if (stack->graph)
    {
      gimp_filter_stack_remove_node (stack, filter);
      gegl_node_remove_child (stack->graph, gimp_filter_get_node (filter));
    }

  GIMP_CONTAINER_CLASS (parent_class)->remove (container, object);

  gimp_filter_set_is_last_node (filter, FALSE);

  n_children = gimp_container_get_n_children (container);

  if (n_children > 0)
    {
      GimpFilter *last_node = (GimpFilter *)
        gimp_container_get_child_by_index (container, n_children - 1);

      gimp_filter_set_is_last_node (last_node, TRUE);
    }
}
Beispiel #5
0
static void
gimp_filter_stack_class_init (GimpFilterStackClass *klass)
{
  GObjectClass       *object_class    = G_OBJECT_CLASS (klass);
  GimpContainerClass *container_class = GIMP_CONTAINER_CLASS (klass);

  object_class->constructed = gimp_filter_stack_constructed;
  object_class->finalize    = gimp_filter_stack_finalize;

  container_class->add      = gimp_filter_stack_add;
  container_class->remove   = gimp_filter_stack_remove;
  container_class->reorder  = gimp_filter_stack_reorder;
}
Beispiel #6
0
static void
gimp_filter_stack_add (GimpContainer *container,
                       GimpObject    *object)
{
  GimpFilterStack *stack  = GIMP_FILTER_STACK (container);
  GimpFilter      *filter = GIMP_FILTER (object);

  GIMP_CONTAINER_CLASS (parent_class)->add (container, object);

  gimp_filter_stack_update_last_node (stack);

  if (stack->graph)
    {
      gegl_node_add_child (stack->graph, gimp_filter_get_node (filter));
      gimp_filter_stack_add_node (stack, filter);
    }
}
static void
gimp_filter_stack_reorder (GimpContainer *container,
                           GimpObject    *object,
                           gint           new_index)
{
  GimpFilterStack *stack  = GIMP_FILTER_STACK (container);
  GimpFilter      *filter = GIMP_FILTER (object);
  gint             n_children;
  gint             old_index;

  n_children = gimp_container_get_n_children (container);
  old_index  = gimp_container_get_child_index (container, object);

  if (stack->graph)
    gimp_filter_stack_remove_node (stack, filter);

  if (old_index == n_children -1)
    {
      gimp_filter_set_is_last_node (filter, FALSE);
    }
  else if (new_index == n_children - 1)
    {
      GimpFilter *last_node = (GimpFilter *)
        gimp_container_get_child_by_index (container, n_children - 1);

      gimp_filter_set_is_last_node (last_node, FALSE);
    }

  GIMP_CONTAINER_CLASS (parent_class)->reorder (container, object, new_index);

  if (new_index == n_children - 1)
    {
      gimp_filter_set_is_last_node (filter, TRUE);
    }
  else if (old_index == n_children - 1)
    {
      GimpFilter *last_node = (GimpFilter *)
        gimp_container_get_child_by_index (container, n_children - 1);

      gimp_filter_set_is_last_node (last_node, TRUE);
    }

  if (stack->graph)
    gimp_filter_stack_add_node (stack, filter);
}
Beispiel #8
0
static void
gimp_filter_stack_reorder (GimpContainer *container,
                           GimpObject    *object,
                           gint           new_index)
{
  GimpFilterStack *stack  = GIMP_FILTER_STACK (container);
  GimpFilter      *filter = GIMP_FILTER (object);

  if (stack->graph)
    gimp_filter_stack_remove_node (stack, filter);

  GIMP_CONTAINER_CLASS (parent_class)->reorder (container, object, new_index);

  gimp_filter_stack_update_last_node (stack);

  if (stack->graph)
    gimp_filter_stack_add_node (stack, filter);
}