GtkWidget *
gimp_container_combo_box_new (GimpContainer *container,
                              GimpContext   *context,
                              gint           view_size,
                              gint           view_border_width)
{
  GtkWidget         *combo_box;
  GimpContainerView *view;

  g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
                        NULL);
  g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);

  combo_box = g_object_new (GIMP_TYPE_CONTAINER_COMBO_BOX, NULL);

  view = GIMP_CONTAINER_VIEW (combo_box);

  gimp_container_view_set_view_size (view, view_size, view_border_width);

  if (container)
    gimp_container_view_set_container (view, container);

  if (context)
    gimp_container_view_set_context (view, context);

  return combo_box;
}
Пример #2
0
GtkWidget *
gimp_container_entry_new (GimpContainer *container,
                          GimpContext   *context,
                          gint           view_size,
                          gint           view_border_width)
{
  GtkWidget         *entry;
  GimpContainerView *view;

  g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
                        NULL);
  g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);

  entry = g_object_new (GIMP_TYPE_CONTAINER_ENTRY, NULL);

  view = GIMP_CONTAINER_VIEW (entry);

  gimp_container_view_set_view_size (view, view_size, view_border_width);

  if (container)
    gimp_container_view_set_container (view, container);

  if (context)
    gimp_container_view_set_context (view, context);

  return entry;
}
GtkWidget *
gimp_container_grid_view_new (GimpContainer *container,
                              GimpContext   *context,
                              gint           view_size,
                              gint           view_border_width)
{
  GimpContainerGridView *grid_view;
  GimpContainerView     *view;

  g_return_val_if_fail (container == NULL || GIMP_IS_CONTAINER (container),
                        NULL);
  g_return_val_if_fail (context == NULL || GIMP_IS_CONTEXT (context), NULL);
  g_return_val_if_fail (view_size  > 0 &&
                        view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, NULL);
  g_return_val_if_fail (view_border_width >= 0 &&
                        view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
                        NULL);

  grid_view = g_object_new (GIMP_TYPE_CONTAINER_GRID_VIEW, NULL);

  view = GIMP_CONTAINER_VIEW (grid_view);

  gimp_container_view_set_view_size (view, view_size, view_border_width);

  if (container)
    gimp_container_view_set_container (view, container);

  if (context)
    gimp_container_view_set_context (view, context);

  return GTK_WIDGET (grid_view);
}
Пример #4
0
static void
gimp_controller_list_constructed (GObject *object)
{
  GimpControllerList *list = GIMP_CONTROLLER_LIST (object);

  G_OBJECT_CLASS (parent_class)->constructed (object);

  g_assert (GIMP_IS_GIMP (list->gimp));

  gimp_container_view_set_container (GIMP_CONTAINER_VIEW (list->dest),
                                     gimp_controllers_get_list (list->gimp));

  gimp_container_view_set_context (GIMP_CONTAINER_VIEW (list->dest),
                                   gimp_get_user_context (list->gimp));
}
Пример #5
0
static void
gimp_text_style_editor_constructed (GObject *object)
{
  GimpTextStyleEditor *editor = GIMP_TEXT_STYLE_EDITOR (object);

  if (G_OBJECT_CLASS (parent_class)->constructed)
    G_OBJECT_CLASS (parent_class)->constructed (object);

  g_assert (GIMP_IS_GIMP (editor->gimp));
  g_assert (GIMP_IS_FONT_LIST (editor->fonts));
  g_assert (GIMP_IS_TEXT (editor->text));
  g_assert (GIMP_IS_TEXT_BUFFER (editor->buffer));

  editor->context = gimp_context_new (editor->gimp, "text style editor", NULL);

  g_signal_connect (editor->context, "font-changed",
                    G_CALLBACK (gimp_text_style_editor_font_changed),
                    editor);

  gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (editor->size_entry), 0,
                                  editor->resolution_y, TRUE);

  /* use the global user context so we get the global FG/BG colors */
  gimp_color_panel_set_context (GIMP_COLOR_PANEL (editor->color_button),
                                gimp_get_user_context (editor->gimp));

  gimp_container_view_set_container (GIMP_CONTAINER_VIEW (editor->font_entry),
                                     editor->fonts);
  gimp_container_view_set_context (GIMP_CONTAINER_VIEW (editor->font_entry),
                                   editor->context);

  gimp_text_style_editor_create_toggle (editor, editor->buffer->bold_tag,
                                        GTK_STOCK_BOLD,
                                        _("Bold"));
  gimp_text_style_editor_create_toggle (editor, editor->buffer->italic_tag,
                                        GTK_STOCK_ITALIC,
                                        _("Italic"));
  gimp_text_style_editor_create_toggle (editor, editor->buffer->underline_tag,
                                        GTK_STOCK_UNDERLINE,
                                        _("Underline"));
  gimp_text_style_editor_create_toggle (editor, editor->buffer->strikethrough_tag,
                                        GTK_STOCK_STRIKETHROUGH,
                                        _("Strikethrough"));

  g_signal_connect_swapped (editor->text, "notify::font",
                            G_CALLBACK (gimp_text_style_editor_update),
                            editor);
  g_signal_connect_swapped (editor->text, "notify::font-size",
                            G_CALLBACK (gimp_text_style_editor_update),
                            editor);
  g_signal_connect_swapped (editor->text, "notify::font-size-unit",
                            G_CALLBACK (gimp_text_style_editor_update),
                            editor);
  g_signal_connect_swapped (editor->text, "notify::color",
                            G_CALLBACK (gimp_text_style_editor_update),
                            editor);

  g_signal_connect_data (editor->buffer, "changed",
                         G_CALLBACK (gimp_text_style_editor_update),
                         editor, 0,
                         G_CONNECT_AFTER | G_CONNECT_SWAPPED);
  g_signal_connect_data (editor->buffer, "apply-tag",
                         G_CALLBACK (gimp_text_style_editor_update),
                         editor, 0,
                         G_CONNECT_AFTER | G_CONNECT_SWAPPED);
  g_signal_connect_data (editor->buffer, "remove-tag",
                         G_CALLBACK (gimp_text_style_editor_update),
                         editor, 0,
                         G_CONNECT_AFTER | G_CONNECT_SWAPPED);
  g_signal_connect_data (editor->buffer, "mark-set",
                         G_CALLBACK (gimp_text_style_editor_update),
                         editor, 0,
                         G_CONNECT_AFTER | G_CONNECT_SWAPPED);
}