mirror of https://github.com/GNOME/gimp.git
added "icon_size" parameters to gimp_enum_stock_box_new[_with_range]().
2003-03-31 Michael Natterer <mitch@gimp.org> * app/widgets/gimpenummenu.[ch]: added "icon_size" parameters to gimp_enum_stock_box_new[_with_range](). * app/tools/gimpcurvestool.c * app/widgets/gimppropwidgets.c: changed accordingly. * app/widgets/gimpeditor.[ch]: added gimp_editor_add_stock_box(). * app/widgets/widgets-enums.[ch]: register GimpViewType with the type system. * app/widgets/gimpcontainerpopup.c: use a stock box for the view as list/grid buttons.
This commit is contained in:
parent
ff2757dff8
commit
529c5e71c4
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2003-03-31 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/widgets/gimpenummenu.[ch]: added "icon_size" parameters
|
||||||
|
to gimp_enum_stock_box_new[_with_range]().
|
||||||
|
|
||||||
|
* app/tools/gimpcurvestool.c
|
||||||
|
* app/widgets/gimppropwidgets.c: changed accordingly.
|
||||||
|
|
||||||
|
* app/widgets/gimpeditor.[ch]: added gimp_editor_add_stock_box().
|
||||||
|
|
||||||
|
* app/widgets/widgets-enums.[ch]: register GimpViewType with
|
||||||
|
the type system.
|
||||||
|
|
||||||
|
* app/widgets/gimpcontainerpopup.c: use a stock box for the
|
||||||
|
view as list/grid buttons.
|
||||||
|
|
||||||
2003-03-31 Michael Natterer <mitch@gimp.org>
|
2003-03-31 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* plug-ins/common/xpm.c (save_image): free the original cmap
|
* plug-ins/common/xpm.c (save_image): free the original cmap
|
||||||
|
|
|
@ -719,7 +719,7 @@ gimp_curves_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
hbox = gimp_enum_stock_box_new (GIMP_TYPE_CURVE_TYPE,
|
hbox = gimp_enum_stock_box_new (GIMP_TYPE_CURVE_TYPE,
|
||||||
"gimp-curve",
|
"gimp-curve", GTK_ICON_SIZE_MENU,
|
||||||
G_CALLBACK (curves_curve_type_callback),
|
G_CALLBACK (curves_curve_type_callback),
|
||||||
c_tool,
|
c_tool,
|
||||||
&c_tool->curve_type);
|
&c_tool->curve_type);
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "gimpcontainereditor.h"
|
#include "gimpcontainereditor.h"
|
||||||
#include "gimpcontainerpopup.h"
|
#include "gimpcontainerpopup.h"
|
||||||
#include "gimpcontainergridview.h"
|
#include "gimpcontainergridview.h"
|
||||||
|
#include "gimpcontainertreeview.h"
|
||||||
#include "gimpdialogfactory.h"
|
#include "gimpdialogfactory.h"
|
||||||
#include "gimppreview.h"
|
#include "gimppreview.h"
|
||||||
|
|
||||||
|
@ -64,15 +65,13 @@ static void gimp_container_popup_real_confirm (GimpContainerPopup *popup);
|
||||||
static void gimp_container_popup_create_view (GimpContainerPopup *popup,
|
static void gimp_container_popup_create_view (GimpContainerPopup *popup,
|
||||||
GimpViewType view_type);
|
GimpViewType view_type);
|
||||||
|
|
||||||
static void gimp_container_popup_smaller_clicked (GtkWidget *button,
|
static void gimp_container_popup_smaller_clicked (GtkWidget *button,
|
||||||
GimpContainerPopup *popup);
|
GimpContainerPopup *popup);
|
||||||
static void gimp_container_popup_larger_clicked (GtkWidget *button,
|
static void gimp_container_popup_larger_clicked (GtkWidget *button,
|
||||||
GimpContainerPopup *popup);
|
GimpContainerPopup *popup);
|
||||||
static void gimp_container_popup_list_clicked (GtkWidget *button,
|
static void gimp_container_popup_view_type_toggled(GtkWidget *button,
|
||||||
GimpContainerPopup *popup);
|
GimpContainerPopup *popup);
|
||||||
static void gimp_container_popup_grid_clicked (GtkWidget *button,
|
static void gimp_container_popup_dialog_clicked (GtkWidget *button,
|
||||||
GimpContainerPopup *popup);
|
|
||||||
static void gimp_container_popup_dialog_clicked (GtkWidget *button,
|
|
||||||
GimpContainerPopup *popup);
|
GimpContainerPopup *popup);
|
||||||
|
|
||||||
|
|
||||||
|
@ -468,33 +467,21 @@ gimp_container_popup_create_view (GimpContainerPopup *popup,
|
||||||
editor = GIMP_EDITOR (popup->editor->view);
|
editor = GIMP_EDITOR (popup->editor->view);
|
||||||
|
|
||||||
gimp_editor_add_button (editor, GTK_STOCK_ZOOM_OUT,
|
gimp_editor_add_button (editor, GTK_STOCK_ZOOM_OUT,
|
||||||
_("Smaller Previews"), NULL,
|
_("Smaller previews"), NULL,
|
||||||
G_CALLBACK (gimp_container_popup_smaller_clicked),
|
G_CALLBACK (gimp_container_popup_smaller_clicked),
|
||||||
NULL,
|
NULL,
|
||||||
popup);
|
popup);
|
||||||
gimp_editor_add_button (editor, GTK_STOCK_ZOOM_IN,
|
gimp_editor_add_button (editor, GTK_STOCK_ZOOM_IN,
|
||||||
_("Larger Previews"), NULL,
|
_("Larger previews"), NULL,
|
||||||
G_CALLBACK (gimp_container_popup_larger_clicked),
|
G_CALLBACK (gimp_container_popup_larger_clicked),
|
||||||
NULL,
|
NULL,
|
||||||
popup);
|
popup);
|
||||||
|
|
||||||
button =
|
button = gimp_editor_add_stock_box (editor, GIMP_TYPE_VIEW_TYPE, "gimp",
|
||||||
gimp_editor_add_button (editor, GIMP_STOCK_LIST,
|
G_CALLBACK (gimp_container_popup_view_type_toggled),
|
||||||
_("View as List"), NULL,
|
popup);
|
||||||
G_CALLBACK (gimp_container_popup_list_clicked),
|
gimp_radio_group_set_active (GTK_RADIO_BUTTON (button),
|
||||||
NULL,
|
GINT_TO_POINTER (view_type));
|
||||||
popup);
|
|
||||||
if (view_type == GIMP_VIEW_TYPE_LIST)
|
|
||||||
gtk_widget_set_sensitive (button, FALSE);
|
|
||||||
|
|
||||||
button =
|
|
||||||
gimp_editor_add_button (editor, GIMP_STOCK_GRID,
|
|
||||||
_("View as Grid"), NULL,
|
|
||||||
G_CALLBACK (gimp_container_popup_grid_clicked),
|
|
||||||
NULL,
|
|
||||||
popup);
|
|
||||||
if (view_type == GIMP_VIEW_TYPE_GRID)
|
|
||||||
gtk_widget_set_sensitive (button, FALSE);
|
|
||||||
|
|
||||||
if (popup->dialog_factory)
|
if (popup->dialog_factory)
|
||||||
gimp_editor_add_button (editor, popup->dialog_stock_id,
|
gimp_editor_add_button (editor, popup->dialog_stock_id,
|
||||||
|
@ -533,21 +520,33 @@ gimp_container_popup_larger_clicked (GtkWidget *button,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_container_popup_list_clicked (GtkWidget *button,
|
gimp_container_popup_view_type_toggled (GtkWidget *button,
|
||||||
GimpContainerPopup *popup)
|
GimpContainerPopup *popup)
|
||||||
{
|
{
|
||||||
gtk_container_remove (GTK_CONTAINER (popup->frame),
|
if (GTK_TOGGLE_BUTTON (button)->active)
|
||||||
GTK_WIDGET (popup->editor));
|
{
|
||||||
gimp_container_popup_create_view (popup, GIMP_VIEW_TYPE_LIST);
|
GimpViewType view_type;
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
view_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
|
||||||
gimp_container_popup_grid_clicked (GtkWidget *button,
|
"gimp-item-data"));
|
||||||
GimpContainerPopup *popup)
|
|
||||||
{
|
switch (view_type)
|
||||||
gtk_container_remove (GTK_CONTAINER (popup->frame),
|
{
|
||||||
GTK_WIDGET (popup->editor));
|
case GIMP_VIEW_TYPE_LIST:
|
||||||
gimp_container_popup_create_view (popup, GIMP_VIEW_TYPE_GRID);
|
if (GIMP_IS_CONTAINER_TREE_VIEW (popup->editor->view))
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_VIEW_TYPE_GRID:
|
||||||
|
if (GIMP_IS_CONTAINER_GRID_VIEW (popup->editor->view))
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_container_remove (GTK_CONTAINER (popup->frame),
|
||||||
|
GTK_WIDGET (popup->editor));
|
||||||
|
gimp_container_popup_create_view (popup, view_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "gimpeditor.h"
|
#include "gimpeditor.h"
|
||||||
#include "gimpdnd.h"
|
#include "gimpdnd.h"
|
||||||
|
#include "gimpenummenu.h"
|
||||||
#include "gimpmenufactory.h"
|
#include "gimpmenufactory.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -270,3 +271,58 @@ gimp_editor_add_button (GimpEditor *editor,
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gimp_editor_add_stock_box (GimpEditor *editor,
|
||||||
|
GType enum_type,
|
||||||
|
const gchar *stock_prefix,
|
||||||
|
GCallback callback,
|
||||||
|
gpointer callback_data)
|
||||||
|
{
|
||||||
|
GtkWidget *hbox;
|
||||||
|
GtkWidget *first_button;
|
||||||
|
gint button_spacing;
|
||||||
|
GtkIconSize button_icon_size;
|
||||||
|
GList *children;
|
||||||
|
GList *list;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
||||||
|
g_return_val_if_fail (g_type_is_a (enum_type, G_TYPE_ENUM), NULL);
|
||||||
|
g_return_val_if_fail (stock_prefix != NULL, NULL);
|
||||||
|
|
||||||
|
gtk_widget_style_get (GTK_WIDGET (editor),
|
||||||
|
"button_spacing", &button_spacing,
|
||||||
|
"button_icon_size", &button_icon_size,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (! editor->button_box)
|
||||||
|
{
|
||||||
|
editor->button_box = gtk_hbox_new (TRUE, button_spacing);
|
||||||
|
gtk_box_pack_end (GTK_BOX (editor), editor->button_box, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (editor->button_box);
|
||||||
|
}
|
||||||
|
|
||||||
|
hbox = gimp_enum_stock_box_new (enum_type, stock_prefix, button_icon_size,
|
||||||
|
callback, callback_data,
|
||||||
|
&first_button);
|
||||||
|
|
||||||
|
children = gtk_container_get_children (GTK_CONTAINER (hbox));
|
||||||
|
|
||||||
|
for (list = children; list; list = g_list_next (list))
|
||||||
|
{
|
||||||
|
GtkWidget *button = list->data;
|
||||||
|
|
||||||
|
g_object_ref (button);
|
||||||
|
|
||||||
|
gtk_container_remove (GTK_CONTAINER (hbox), button);
|
||||||
|
gtk_box_pack_start (GTK_BOX (editor->button_box), button,
|
||||||
|
TRUE, TRUE, 0);
|
||||||
|
|
||||||
|
g_object_unref (button);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_list_free (children);
|
||||||
|
gtk_widget_destroy (hbox);
|
||||||
|
|
||||||
|
return first_button;
|
||||||
|
}
|
||||||
|
|
|
@ -52,22 +52,27 @@ struct _GimpEditorClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_editor_get_type (void) G_GNUC_CONST;
|
GType gimp_editor_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GtkWidget * gimp_editor_new (void);
|
GtkWidget * gimp_editor_new (void);
|
||||||
|
|
||||||
void gimp_editor_create_menu (GimpEditor *editor,
|
void gimp_editor_create_menu (GimpEditor *editor,
|
||||||
GimpMenuFactory *menu_factory,
|
GimpMenuFactory *menu_factory,
|
||||||
const gchar *menu_identifier,
|
const gchar *menu_identifier,
|
||||||
gpointer callback_data);
|
gpointer callback_data);
|
||||||
|
|
||||||
GtkWidget * gimp_editor_add_button (GimpEditor *editor,
|
GtkWidget * gimp_editor_add_button (GimpEditor *editor,
|
||||||
const gchar *stock_id,
|
const gchar *stock_id,
|
||||||
const gchar *tooltip,
|
const gchar *tooltip,
|
||||||
const gchar *help_data,
|
const gchar *help_data,
|
||||||
GCallback callback,
|
GCallback callback,
|
||||||
GCallback extended_callback,
|
GCallback extended_callback,
|
||||||
gpointer callback_data);
|
gpointer callback_data);
|
||||||
|
GtkWidget * gimp_editor_add_stock_box (GimpEditor *editor,
|
||||||
|
GType enum_type,
|
||||||
|
const gchar *stock_prefix,
|
||||||
|
GCallback callback,
|
||||||
|
gpointer callback_data);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_EDITOR_H__ */
|
#endif /* __GIMP_EDITOR_H__ */
|
||||||
|
|
|
@ -599,6 +599,7 @@ gimp_enum_radio_frame_new_with_range (GType enum_type,
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_enum_stock_box_new (GType enum_type,
|
gimp_enum_stock_box_new (GType enum_type,
|
||||||
const gchar *stock_prefix,
|
const gchar *stock_prefix,
|
||||||
|
GtkIconSize icon_size,
|
||||||
GCallback callback,
|
GCallback callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GtkWidget **first_button)
|
GtkWidget **first_button)
|
||||||
|
@ -613,7 +614,7 @@ gimp_enum_stock_box_new (GType enum_type,
|
||||||
box = gimp_enum_stock_box_new_with_range (enum_type,
|
box = gimp_enum_stock_box_new_with_range (enum_type,
|
||||||
enum_class->minimum,
|
enum_class->minimum,
|
||||||
enum_class->maximum,
|
enum_class->maximum,
|
||||||
stock_prefix,
|
stock_prefix, icon_size,
|
||||||
callback, callback_data,
|
callback, callback_data,
|
||||||
first_button);
|
first_button);
|
||||||
|
|
||||||
|
@ -627,6 +628,7 @@ gimp_enum_stock_box_new_with_range (GType enum_type,
|
||||||
gint minimum,
|
gint minimum,
|
||||||
gint maximum,
|
gint maximum,
|
||||||
const gchar *stock_prefix,
|
const gchar *stock_prefix,
|
||||||
|
GtkIconSize icon_size,
|
||||||
GCallback callback,
|
GCallback callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GtkWidget **first_button)
|
GtkWidget **first_button)
|
||||||
|
@ -665,7 +667,7 @@ gimp_enum_stock_box_new_with_range (GType enum_type,
|
||||||
|
|
||||||
stock_id = g_strconcat (stock_prefix, "-", value->value_nick, NULL);
|
stock_id = g_strconcat (stock_prefix, "-", value->value_nick, NULL);
|
||||||
|
|
||||||
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_MENU);
|
image = gtk_image_new_from_stock (stock_id, icon_size);
|
||||||
|
|
||||||
g_free (stock_id);
|
g_free (stock_id);
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ GtkWidget * gimp_enum_radio_frame_new_with_range (GType enum_type,
|
||||||
|
|
||||||
GtkWidget * gimp_enum_stock_box_new (GType enum_type,
|
GtkWidget * gimp_enum_stock_box_new (GType enum_type,
|
||||||
const gchar *stock_prefix,
|
const gchar *stock_prefix,
|
||||||
|
GtkIconSize icon_size,
|
||||||
GCallback callback,
|
GCallback callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GtkWidget **first_button);
|
GtkWidget **first_button);
|
||||||
|
@ -130,6 +131,7 @@ GtkWidget * gimp_enum_stock_box_new_with_range (GType enum_type,
|
||||||
gint minimum,
|
gint minimum,
|
||||||
gint maximum,
|
gint maximum,
|
||||||
const gchar *stock_prefix,
|
const gchar *stock_prefix,
|
||||||
|
GtkIconSize icon_size,
|
||||||
GCallback callback,
|
GCallback callback,
|
||||||
gpointer callback_data,
|
gpointer callback_data,
|
||||||
GtkWidget **first_button);
|
GtkWidget **first_button);
|
||||||
|
|
|
@ -577,6 +577,7 @@ gimp_prop_enum_stock_box_new (GObject *config,
|
||||||
box = gimp_enum_stock_box_new_with_range (param_spec->value_type,
|
box = gimp_enum_stock_box_new_with_range (param_spec->value_type,
|
||||||
minimum, maximum,
|
minimum, maximum,
|
||||||
stock_prefix,
|
stock_prefix,
|
||||||
|
GTK_ICON_SIZE_MENU,
|
||||||
G_CALLBACK (gimp_prop_radio_button_callback),
|
G_CALLBACK (gimp_prop_radio_button_callback),
|
||||||
config,
|
config,
|
||||||
&button);
|
&button);
|
||||||
|
@ -585,6 +586,7 @@ gimp_prop_enum_stock_box_new (GObject *config,
|
||||||
{
|
{
|
||||||
box = gimp_enum_stock_box_new (param_spec->value_type,
|
box = gimp_enum_stock_box_new (param_spec->value_type,
|
||||||
stock_prefix,
|
stock_prefix,
|
||||||
|
GTK_ICON_SIZE_MENU,
|
||||||
G_CALLBACK (gimp_prop_radio_button_callback),
|
G_CALLBACK (gimp_prop_radio_button_callback),
|
||||||
config,
|
config,
|
||||||
&button);
|
&button);
|
||||||
|
|
|
@ -65,5 +65,24 @@ gimp_histogram_scale_get_type (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const GEnumValue gimp_view_type_enum_values[] =
|
||||||
|
{
|
||||||
|
{ GIMP_VIEW_TYPE_LIST, N_("View as list"), "list" },
|
||||||
|
{ GIMP_VIEW_TYPE_GRID, N_("View as grid"), "grid" },
|
||||||
|
{ 0, NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
GType
|
||||||
|
gimp_view_type_get_type (void)
|
||||||
|
{
|
||||||
|
static GType enum_type = 0;
|
||||||
|
|
||||||
|
if (!enum_type)
|
||||||
|
enum_type = g_enum_register_static ("GimpViewType", gimp_view_type_enum_values);
|
||||||
|
|
||||||
|
return enum_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Generated data ends here */
|
/* Generated data ends here */
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,17 @@ typedef enum
|
||||||
} GimpHistogramScale;
|
} GimpHistogramScale;
|
||||||
|
|
||||||
|
|
||||||
|
#define GIMP_TYPE_VIEW_TYPE (gimp_view_type_get_type ())
|
||||||
|
|
||||||
|
GType gimp_view_type_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GIMP_VIEW_TYPE_LIST, /*< desc="View as list" >*/
|
||||||
|
GIMP_VIEW_TYPE_GRID /*< desc="View as grid" >*/
|
||||||
|
} GimpViewType;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* non-registered enums; register them if needed
|
* non-registered enums; register them if needed
|
||||||
*/
|
*/
|
||||||
|
@ -69,12 +80,6 @@ typedef enum /*< skip >*/
|
||||||
GIMP_PREVIEW_BG_WHITE
|
GIMP_PREVIEW_BG_WHITE
|
||||||
} GimpPreviewBG;
|
} GimpPreviewBG;
|
||||||
|
|
||||||
typedef enum /*< skip >*/
|
|
||||||
{
|
|
||||||
GIMP_VIEW_TYPE_GRID,
|
|
||||||
GIMP_VIEW_TYPE_LIST
|
|
||||||
} GimpViewType;
|
|
||||||
|
|
||||||
typedef enum /*< skip >*/
|
typedef enum /*< skip >*/
|
||||||
{
|
{
|
||||||
GIMP_DROP_NONE,
|
GIMP_DROP_NONE,
|
||||||
|
|
|
@ -577,6 +577,7 @@ gimp_prop_enum_stock_box_new (GObject *config,
|
||||||
box = gimp_enum_stock_box_new_with_range (param_spec->value_type,
|
box = gimp_enum_stock_box_new_with_range (param_spec->value_type,
|
||||||
minimum, maximum,
|
minimum, maximum,
|
||||||
stock_prefix,
|
stock_prefix,
|
||||||
|
GTK_ICON_SIZE_MENU,
|
||||||
G_CALLBACK (gimp_prop_radio_button_callback),
|
G_CALLBACK (gimp_prop_radio_button_callback),
|
||||||
config,
|
config,
|
||||||
&button);
|
&button);
|
||||||
|
@ -585,6 +586,7 @@ gimp_prop_enum_stock_box_new (GObject *config,
|
||||||
{
|
{
|
||||||
box = gimp_enum_stock_box_new (param_spec->value_type,
|
box = gimp_enum_stock_box_new (param_spec->value_type,
|
||||||
stock_prefix,
|
stock_prefix,
|
||||||
|
GTK_ICON_SIZE_MENU,
|
||||||
G_CALLBACK (gimp_prop_radio_button_callback),
|
G_CALLBACK (gimp_prop_radio_button_callback),
|
||||||
config,
|
config,
|
||||||
&button);
|
&button);
|
||||||
|
|
Loading…
Reference in New Issue