app/widgets/gimpcontainerpopup.[ch] added "preview_size" and

2003-04-12  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcontainerpopup.[ch]
	* app/widgets/gimpviewablebutton.[ch]: added "preview_size" and
	"preview_border_width" parameters to the constructors and use them
	when creating the popup.

	* app/tools/gimptextoptions.c
	* app/tools/paint_options.c
	* app/widgets/gimptemplateeditor.c: changed accordingly. Create the
	icon popup without borders.
This commit is contained in:
Michael Natterer 2003-04-12 20:02:16 +00:00 committed by Michael Natterer
parent f82440ff48
commit a4be816fa6
9 changed files with 73 additions and 14 deletions

View File

@ -1,3 +1,15 @@
2003-04-12 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainerpopup.[ch]
* app/widgets/gimpviewablebutton.[ch]: added "preview_size" and
"preview_border_width" parameters to the constructors and use them
when creating the popup.
* app/tools/gimptextoptions.c
* app/tools/paint_options.c
* app/widgets/gimptemplateeditor.c: changed accordingly. Create the
icon popup without borders.
2003-04-12 Michael Natterer <mitch@gimp.org>
* app/config/gimpconfig-params.h: made object properties

View File

@ -127,7 +127,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
tool_options->tool_info->tool_type != GIMP_TYPE_INK_TOOL)
{
button = gimp_viewable_button_new (context->gimp->brush_factory->container,
context, 24,
context,
GIMP_PREVIEW_SIZE_SMALL, 1,
dialog_factory,
"gimp-brush-grid",
GIMP_STOCK_TOOL_PAINTBRUSH,
@ -143,7 +144,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
tool_options->tool_info->tool_type == GIMP_TYPE_CLONE_TOOL)
{
button = gimp_viewable_button_new (context->gimp->pattern_factory->container,
context, 24,
context,
GIMP_PREVIEW_SIZE_SMALL, 1,
dialog_factory,
"gimp-pattern-grid",
GIMP_STOCK_TOOL_BUCKET_FILL,
@ -158,7 +160,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
if (tool_options->tool_info->tool_type == GIMP_TYPE_BLEND_TOOL)
{
button = gimp_viewable_button_new (context->gimp->gradient_factory->container,
context, 32,
context,
GIMP_PREVIEW_SIZE_SMALL * 2, 1,
dialog_factory,
"gimp-gradient-list",
GIMP_STOCK_TOOL_BLEND,

View File

@ -259,7 +259,8 @@ gimp_text_options_gui (GimpToolOptions *tool_options)
gtk_widget_show (table);
button = gimp_viewable_button_new (GIMP_CONTEXT (options)->gimp->fonts,
GIMP_CONTEXT (options), 24,
GIMP_CONTEXT (options),
GIMP_PREVIEW_SIZE_SMALL, 1,
dialog_factory,
"gimp-font-list",
GIMP_STOCK_TOOL_TEXT,

View File

@ -127,7 +127,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
tool_options->tool_info->tool_type != GIMP_TYPE_INK_TOOL)
{
button = gimp_viewable_button_new (context->gimp->brush_factory->container,
context, 24,
context,
GIMP_PREVIEW_SIZE_SMALL, 1,
dialog_factory,
"gimp-brush-grid",
GIMP_STOCK_TOOL_PAINTBRUSH,
@ -143,7 +144,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
tool_options->tool_info->tool_type == GIMP_TYPE_CLONE_TOOL)
{
button = gimp_viewable_button_new (context->gimp->pattern_factory->container,
context, 24,
context,
GIMP_PREVIEW_SIZE_SMALL, 1,
dialog_factory,
"gimp-pattern-grid",
GIMP_STOCK_TOOL_BUCKET_FILL,
@ -158,7 +160,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
if (tool_options->tool_info->tool_type == GIMP_TYPE_BLEND_TOOL)
{
button = gimp_viewable_button_new (context->gimp->gradient_factory->container,
context, 32,
context,
GIMP_PREVIEW_SIZE_SMALL * 2, 1,
dialog_factory,
"gimp-gradient-list",
GIMP_STOCK_TOOL_BLEND,

View File

@ -31,13 +31,14 @@
#include "core/gimpcontext.h"
#include "core/gimpcontainer.h"
#include "core/gimpmarshal.h"
#include "core/gimpviewable.h"
#include "gimpcontainereditor.h"
#include "gimpcontainerpopup.h"
#include "gimpcontainergridview.h"
#include "gimpcontainertreeview.h"
#include "gimpdialogfactory.h"
#include "gimppreview.h"
#include "gimppreviewrenderer.h"
#include "gimp-intl.h"
@ -162,6 +163,9 @@ gimp_container_popup_class_init (GimpContainerPopupClass *klass)
static void
gimp_container_popup_init (GimpContainerPopup *popup)
{
popup->preview_size = GIMP_PREVIEW_SIZE_SMALL;
popup->preview_border_width = 1;
popup->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (popup->frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (popup), popup->frame);
@ -356,6 +360,8 @@ gimp_container_popup_context_changed (GimpContext *context,
GtkWidget *
gimp_container_popup_new (GimpContainer *container,
GimpContext *context,
gint preview_size,
gint preview_border_width,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const gchar *dialog_stock_id,
@ -365,6 +371,11 @@ gimp_container_popup_new (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (preview_size > 0 &&
preview_size <= GIMP_VIEWABLE_MAX_POPUP_SIZE, NULL);
g_return_val_if_fail (preview_border_width >= 0 &&
preview_border_width <= GIMP_PREVIEW_MAX_BORDER_WIDTH,
NULL);
g_return_val_if_fail (dialog_factory == NULL ||
GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
if (dialog_factory)
@ -383,6 +394,9 @@ gimp_container_popup_new (GimpContainer *container,
popup->orig_context = context;
popup->context = gimp_context_new (context->gimp, "popup", context);
popup->preview_size = preview_size;
popup->preview_border_width = preview_border_width;
g_signal_connect (popup->context,
gimp_context_type_to_signal_name (container->children_type),
G_CALLBACK (gimp_container_popup_context_changed),
@ -454,13 +468,16 @@ gimp_container_popup_create_view (GimpContainerPopup *popup,
view_type,
popup->container,
popup->context,
GIMP_PREVIEW_SIZE_SMALL, 1,
popup->preview_size,
popup->preview_border_width,
FALSE, /* reorderable */
NULL, NULL);
gimp_container_view_set_size_request (GIMP_CONTAINER_VIEW (GIMP_CONTAINER_EDITOR (popup->editor)->view),
6 * (GIMP_PREVIEW_SIZE_SMALL + 2),
8 * (GIMP_PREVIEW_SIZE_SMALL + 2));
6 * (popup->preview_size +
2 * popup->preview_border_width),
10 * (popup->preview_size +
2 * popup->preview_border_width));
if (GIMP_IS_CONTAINER_GRID_VIEW (popup->editor->view))
gtk_widget_hide (GIMP_CONTAINER_GRID_VIEW (popup->editor->view)->name_label);
@ -507,7 +524,8 @@ gimp_container_popup_smaller_clicked (GtkWidget *button,
popup->editor->view->preview_size * 0.8);
gimp_container_view_set_preview_size (popup->editor->view,
preview_size, 1);
preview_size,
popup->preview_border_width);
}
static void
@ -520,7 +538,8 @@ gimp_container_popup_larger_clicked (GtkWidget *button,
popup->editor->view->preview_size * 1.2);
gimp_container_view_set_preview_size (popup->editor->view,
preview_size, 1);
preview_size,
popup->preview_border_width);
}
static void

View File

@ -44,6 +44,9 @@ struct _GimpContainerPopup
GimpContext *orig_context;
GimpContext *context;
gint preview_size;
gint preview_border_width;
GtkWidget *frame;
GimpContainerEditor *editor;
@ -66,6 +69,8 @@ GType gimp_container_popup_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_container_popup_new (GimpContainer *container,
GimpContext *context,
gint preview_size,
gint preview_border_width,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const gchar *dialog_stock_id,

View File

@ -419,7 +419,7 @@ gimp_template_editor_new (Gimp *gimp,
button = gimp_viewable_button_new (editor->stock_id_container,
editor->stock_id_context,
GIMP_PREVIEW_SIZE_SMALL,
GIMP_PREVIEW_SIZE_SMALL, 0,
NULL, NULL, NULL, NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,

View File

@ -34,6 +34,7 @@
#include "gimpcontainerpopup.h"
#include "gimpdialogfactory.h"
#include "gimppropwidgets.h"
#include "gimppreviewrenderer.h"
#include "gimpviewablebutton.h"
#include "gimp-intl.h"
@ -99,6 +100,8 @@ gimp_viewable_button_class_init (GimpViewableButtonClass *klass)
static void
gimp_viewable_button_init (GimpViewableButton *button)
{
button->preview_size = GIMP_PREVIEW_SIZE_SMALL;
button->preview_border_width = 1;
}
static void
@ -191,6 +194,8 @@ gimp_viewable_button_clicked (GtkButton *button)
popup = gimp_container_popup_new (viewable_button->container,
viewable_button->context,
viewable_button->preview_size,
viewable_button->preview_border_width,
viewable_button->dialog_factory,
viewable_button->dialog_identifier,
viewable_button->dialog_stock_id,
@ -202,6 +207,7 @@ GtkWidget *
gimp_viewable_button_new (GimpContainer *container,
GimpContext *context,
gint preview_size,
gint preview_border_width,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const gchar *dialog_stock_id,
@ -214,6 +220,9 @@ gimp_viewable_button_new (GimpContainer *container,
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
g_return_val_if_fail (preview_size > 0 &&
preview_size <= GIMP_VIEWABLE_MAX_POPUP_SIZE, NULL);
g_return_val_if_fail (preview_border_width >= 0 &&
preview_border_width <= GIMP_PREVIEW_MAX_BORDER_WIDTH,
NULL);
g_return_val_if_fail (dialog_factory == NULL ||
GIMP_IS_DIALOG_FACTORY (dialog_factory), NULL);
if (dialog_factory)
@ -228,6 +237,9 @@ gimp_viewable_button_new (GimpContainer *container,
button->container = container;
button->context = context;
button->preview_size = preview_size;
button->preview_border_width = preview_border_width;
if (dialog_factory)
{
button->dialog_factory = dialog_factory;

View File

@ -43,6 +43,9 @@ struct _GimpViewableButton
GimpContainer *container;
GimpContext *context;
gint preview_size;
gint preview_border_width;
GimpDialogFactory *dialog_factory;
gchar *dialog_identifier;
gchar *dialog_stock_id;
@ -62,6 +65,7 @@ GType gimp_viewable_button_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_viewable_button_new (GimpContainer *container,
GimpContext *context,
gint preview_size,
gint preview_border_width,
GimpDialogFactory *dialog_factory,
const gchar *dialog_identifier,
const gchar *dialog_stock_id,