mirror of https://github.com/GNOME/gimp.git
if the label_widget is a button, set the button label as bold. Cache the
2004-05-03 Sven Neumann <sven@gimp.org> * libgimpwidgets/gimpframe.c: if the label_widget is a button, set the button label as bold. Cache the indentation instead of calculating it over and over again. * themes/Default/gtkrc: set HIG-compliant spacing for the action_area. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_enum_radio_box_new() for a radio group that is no embedded in a frame. * app/widgets/gimpstrokeeditor.c: use a frame-less radio box for the Stroke style. * app/gui/file-new-dialog.c * app/gui/grid-dialog.c * app/gui/stroke-dialog.c: HIG-compliant spacings.
This commit is contained in:
parent
bc0a9f7e97
commit
311f033d34
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2004-05-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpframe.c: if the label_widget is a button, set
|
||||
the button label as bold. Cache the indentation instead of
|
||||
calculating it over and over again.
|
||||
|
||||
* themes/Default/gtkrc: set HIG-compliant spacing for the
|
||||
action_area.
|
||||
|
||||
* app/widgets/gimppropwidgets.[ch]: added
|
||||
gimp_prop_enum_radio_box_new() for a radio group that is no
|
||||
embedded in a frame.
|
||||
|
||||
* app/widgets/gimpstrokeeditor.c: use a frame-less radio box for
|
||||
the Stroke style.
|
||||
|
||||
* app/gui/file-new-dialog.c
|
||||
* app/gui/grid-dialog.c
|
||||
* app/gui/stroke-dialog.c: HIG-compliant spacings.
|
||||
|
||||
2004-05-03 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpdock.c (gimp_dock_key_press_event): new function
|
||||
|
|
|
@ -100,7 +100,7 @@ grid_dialog_new (GimpImage *gimage,
|
|||
editor = gimp_grid_editor_new (grid,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (editor), 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
|
||||
editor);
|
||||
|
||||
|
|
|
@ -117,8 +117,8 @@ file_new_dialog_new (Gimp *gimp)
|
|||
gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
|
||||
|
||||
/* vbox holding the rest of the dialog */
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
|
||||
main_vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox),
|
||||
main_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
|
|
@ -144,15 +144,15 @@ stroke_dialog_new (GimpItem *item,
|
|||
g_object_set_data_full (G_OBJECT (dialog), "gimp-stroke-options", options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
|
||||
main_vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
|
||||
/* the stroke frame */
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
frame = gimp_frame_new (NULL);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
|
@ -182,7 +182,7 @@ stroke_dialog_new (GimpItem *item,
|
|||
|
||||
/* the paint tool frame */
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
frame = gimp_frame_new (NULL);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
|
|
|
@ -117,8 +117,8 @@ file_new_dialog_new (Gimp *gimp)
|
|||
gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
|
||||
|
||||
/* vbox holding the rest of the dialog */
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
|
||||
main_vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->vbox),
|
||||
main_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
|
|
@ -100,7 +100,7 @@ grid_dialog_new (GimpImage *gimage,
|
|||
editor = gimp_grid_editor_new (grid,
|
||||
gimage->xresolution,
|
||||
gimage->yresolution);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (editor), 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
|
||||
editor);
|
||||
|
||||
|
|
|
@ -144,15 +144,15 @@ stroke_dialog_new (GimpItem *item,
|
|||
g_object_set_data_full (G_OBJECT (dialog), "gimp-stroke-options", options,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 6);
|
||||
main_vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
|
||||
/* the stroke frame */
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
frame = gimp_frame_new (NULL);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
|
@ -182,7 +182,7 @@ stroke_dialog_new (GimpItem *item,
|
|||
|
||||
/* the paint tool frame */
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
frame = gimp_frame_new (NULL);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
|
|
|
@ -616,6 +616,55 @@ gimp_prop_enum_radio_frame_new (GObject *config,
|
|||
return frame;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_enum_radio_box_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gint minimum,
|
||||
gint maximum)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
gint value;
|
||||
|
||||
param_spec = check_param_spec (config, property_name,
|
||||
G_TYPE_PARAM_ENUM, G_STRLOC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
if (minimum != maximum)
|
||||
{
|
||||
vbox = gimp_enum_radio_box_new_with_range (param_spec->value_type,
|
||||
minimum, maximum,
|
||||
G_CALLBACK (gimp_prop_radio_button_callback),
|
||||
config,
|
||||
&button);
|
||||
}
|
||||
else
|
||||
{
|
||||
vbox = gimp_enum_radio_box_new (param_spec->value_type,
|
||||
G_CALLBACK (gimp_prop_radio_button_callback),
|
||||
config,
|
||||
&button);
|
||||
}
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), value);
|
||||
|
||||
set_param_spec (G_OBJECT (vbox), NULL, param_spec);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_radio_button_notify),
|
||||
button);
|
||||
|
||||
g_object_set_data (G_OBJECT (vbox), "radio-button", button);
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_boolean_radio_frame_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
|
|
|
@ -61,6 +61,10 @@ GtkWidget * gimp_prop_enum_radio_frame_new (GObject *config,
|
|||
const gchar *title,
|
||||
gint minimum,
|
||||
gint maximum);
|
||||
GtkWidget * gimp_prop_enum_radio_box_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gint minimum,
|
||||
gint maximum);
|
||||
GtkWidget * gimp_prop_enum_stock_box_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *stock_prefix,
|
||||
|
|
|
@ -261,6 +261,7 @@ gimp_stroke_editor_constructor (GType type,
|
|||
_("Dash Pattern:"), 1.0, 0.5, frame, 2, FALSE);
|
||||
|
||||
box = gimp_enum_combo_box_new (GIMP_TYPE_DASH_PRESET);
|
||||
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (box), GIMP_DASH_CUSTOM);
|
||||
g_signal_connect (box, "changed",
|
||||
G_CALLBACK (gimp_stroke_editor_dash_preset),
|
||||
editor->options);
|
||||
|
@ -280,8 +281,8 @@ gimp_stroke_editor_constructor (GType type,
|
|||
gtk_widget_show (button);
|
||||
row++;
|
||||
|
||||
box = gimp_prop_enum_radio_frame_new (G_OBJECT (editor->options), "style",
|
||||
_("Style"), 0, 0);
|
||||
box = gimp_prop_enum_radio_box_new (G_OBJECT (editor->options), "style",
|
||||
0, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), box, 0, 3, row, row + 1,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (box);
|
||||
|
|
|
@ -30,20 +30,24 @@
|
|||
|
||||
|
||||
#define DEFAULT_LABEL_SPACING 6
|
||||
#define GIMP_FRAME_INDENT_KEY "gimp-frame-indent"
|
||||
|
||||
|
||||
static void gimp_frame_class_init (GimpFrameClass *klass);
|
||||
static void gimp_frame_init (GimpFrame *frame);
|
||||
|
||||
static void gimp_frame_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gimp_frame_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gimp_frame_child_allocate (GtkFrame *frame,
|
||||
GtkAllocation *allocation);
|
||||
static gboolean gimp_frame_expose (GtkWidget *widget,
|
||||
static void gimp_frame_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous);
|
||||
static gboolean gimp_frame_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static void gimp_frame_label_widget_notify (GtkFrame *frame);
|
||||
static gint gimp_frame_left_margin (GtkWidget *widget);
|
||||
static gint gimp_frame_get_indent (GtkWidget *widget);
|
||||
|
||||
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
|
@ -90,7 +94,8 @@ gimp_frame_class_init (GimpFrameClass *klass)
|
|||
|
||||
widget_class->size_request = gimp_frame_size_request;
|
||||
widget_class->size_allocate = gimp_frame_size_allocate;
|
||||
widget_class->expose_event = gimp_frame_expose;
|
||||
widget_class->style_set = gimp_frame_style_set;
|
||||
widget_class->expose_event = gimp_frame_expose_event;
|
||||
|
||||
frame_class->compute_child_allocation = gimp_frame_child_allocate;
|
||||
|
||||
|
@ -122,7 +127,7 @@ gimp_frame_size_request (GtkWidget *widget,
|
|||
|
||||
if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget))
|
||||
{
|
||||
gint spacing;
|
||||
gint spacing;
|
||||
|
||||
gtk_widget_size_request (frame->label_widget, requisition);
|
||||
|
||||
|
@ -140,12 +145,12 @@ gimp_frame_size_request (GtkWidget *widget,
|
|||
|
||||
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
|
||||
{
|
||||
gint left_margin = gimp_frame_left_margin (widget);
|
||||
gint indent = gimp_frame_get_indent (widget);
|
||||
|
||||
gtk_widget_size_request (bin->child, &child_requisition);
|
||||
|
||||
requisition->width = MAX (requisition->width,
|
||||
child_requisition.width + left_margin);
|
||||
child_requisition.width + indent);
|
||||
requisition->height += child_requisition.height;
|
||||
}
|
||||
|
||||
|
@ -200,8 +205,8 @@ gimp_frame_child_allocate (GtkFrame *frame,
|
|||
GtkWidget *widget = GTK_WIDGET (frame);
|
||||
GtkAllocation *allocation = &widget->allocation;
|
||||
gint border_width = GTK_CONTAINER (frame)->border_width;
|
||||
gint top_margin = 0;
|
||||
gint left_margin = gimp_frame_left_margin (widget);
|
||||
gint spacing = 0;
|
||||
gint indent = gimp_frame_get_indent (widget);
|
||||
|
||||
if (frame->label_widget)
|
||||
{
|
||||
|
@ -211,21 +216,21 @@ gimp_frame_child_allocate (GtkFrame *frame,
|
|||
&child_requisition);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"label_spacing", &top_margin,
|
||||
"label_spacing", &spacing,
|
||||
NULL);
|
||||
|
||||
top_margin += child_requisition.height;
|
||||
spacing += child_requisition.height;
|
||||
}
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
child_allocation->x = border_width + left_margin;
|
||||
child_allocation->x = border_width + indent;
|
||||
else
|
||||
child_allocation->x = border_width;
|
||||
|
||||
child_allocation->y = border_width + top_margin;
|
||||
child_allocation->y = border_width + spacing;
|
||||
child_allocation->width = MAX (1,
|
||||
allocation->width -
|
||||
2 * border_width - left_margin);
|
||||
2 * border_width - indent);
|
||||
child_allocation->height = MAX (1,
|
||||
allocation->height -
|
||||
child_allocation->y - border_width);
|
||||
|
@ -234,9 +239,16 @@ gimp_frame_child_allocate (GtkFrame *frame,
|
|||
child_allocation->y += allocation->y;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_frame_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (widget), GIMP_FRAME_INDENT_KEY, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_frame_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
gimp_frame_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
{
|
||||
|
@ -251,34 +263,59 @@ gimp_frame_expose (GtkWidget *widget,
|
|||
static void
|
||||
gimp_frame_label_widget_notify (GtkFrame *frame)
|
||||
{
|
||||
if (frame->label_widget && GTK_IS_LABEL (frame->label_widget))
|
||||
if (frame->label_widget)
|
||||
{
|
||||
PangoAttrList *attrs;
|
||||
PangoAttribute *attr;
|
||||
GtkLabel *label = NULL;
|
||||
|
||||
attrs = pango_attr_list_new ();
|
||||
if (GTK_IS_LABEL (frame->label_widget))
|
||||
{
|
||||
label = GTK_LABEL (frame->label_widget);
|
||||
}
|
||||
else if (GTK_IS_BIN (frame->label_widget))
|
||||
{
|
||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (frame->label_widget));
|
||||
|
||||
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
|
||||
attr->start_index = 0;
|
||||
attr->end_index = -1;
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
if (GTK_IS_LABEL (child))
|
||||
label = GTK_LABEL (child);
|
||||
}
|
||||
|
||||
gtk_label_set_attributes (GTK_LABEL (frame->label_widget), attrs);
|
||||
if (label)
|
||||
{
|
||||
PangoAttrList *attrs;
|
||||
PangoAttribute *attr;
|
||||
|
||||
pango_attr_list_unref (attrs);
|
||||
attrs = pango_attr_list_new ();
|
||||
|
||||
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
|
||||
attr->start_index = 0;
|
||||
attr->end_index = -1;
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
|
||||
gtk_label_set_attributes (label, attrs);
|
||||
|
||||
pango_attr_list_unref (attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gimp_frame_left_margin (GtkWidget *widget)
|
||||
gimp_frame_get_indent (GtkWidget *widget)
|
||||
{
|
||||
PangoLayout *layout;
|
||||
gint width;
|
||||
gint width = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
GIMP_FRAME_INDENT_KEY));
|
||||
|
||||
/* the HIG suggests to use four spaces so do just that */
|
||||
layout = gtk_widget_create_pango_layout (widget, " ");
|
||||
pango_layout_get_pixel_size (layout, &width, NULL);
|
||||
g_object_unref (layout);
|
||||
if (! width)
|
||||
{
|
||||
PangoLayout *layout;
|
||||
|
||||
/* the HIG suggests to use four spaces so do just that */
|
||||
layout = gtk_widget_create_pango_layout (widget, " ");
|
||||
pango_layout_get_pixel_size (layout, &width, NULL);
|
||||
g_object_unref (layout);
|
||||
|
||||
g_object_set_data (G_OBJECT (widget),
|
||||
GIMP_FRAME_INDENT_KEY, GINT_TO_POINTER (width));
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
|
|
@ -616,6 +616,55 @@ gimp_prop_enum_radio_frame_new (GObject *config,
|
|||
return frame;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_enum_radio_box_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gint minimum,
|
||||
gint maximum)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *button;
|
||||
gint value;
|
||||
|
||||
param_spec = check_param_spec (config, property_name,
|
||||
G_TYPE_PARAM_ENUM, G_STRLOC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
if (minimum != maximum)
|
||||
{
|
||||
vbox = gimp_enum_radio_box_new_with_range (param_spec->value_type,
|
||||
minimum, maximum,
|
||||
G_CALLBACK (gimp_prop_radio_button_callback),
|
||||
config,
|
||||
&button);
|
||||
}
|
||||
else
|
||||
{
|
||||
vbox = gimp_enum_radio_box_new (param_spec->value_type,
|
||||
G_CALLBACK (gimp_prop_radio_button_callback),
|
||||
config,
|
||||
&button);
|
||||
}
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), value);
|
||||
|
||||
set_param_spec (G_OBJECT (vbox), NULL, param_spec);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_radio_button_notify),
|
||||
button);
|
||||
|
||||
g_object_set_data (G_OBJECT (vbox), "radio-button", button);
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_boolean_radio_frame_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
|
|
|
@ -61,6 +61,10 @@ GtkWidget * gimp_prop_enum_radio_frame_new (GObject *config,
|
|||
const gchar *title,
|
||||
gint minimum,
|
||||
gint maximum);
|
||||
GtkWidget * gimp_prop_enum_radio_box_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gint minimum,
|
||||
gint maximum);
|
||||
GtkWidget * gimp_prop_enum_stock_box_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
const gchar *stock_prefix,
|
||||
|
|
|
@ -52,8 +52,8 @@ style "gimp-default-style"
|
|||
GimpEditor::button_spacing = 2
|
||||
GimpEditor::button_icon_size = menu
|
||||
GtkDialog::content_area_border = 0
|
||||
GtkDialog::button_spacing = 4
|
||||
GtkDialog::action_area_border = 6
|
||||
GtkDialog::button_spacing = 6
|
||||
GtkDialog::action_area_border = 12
|
||||
}
|
||||
|
||||
class "GtkWidget" style "gimp-default-style"
|
||||
|
|
Loading…
Reference in New Issue