Commit b46b9d89 authored by Michael Natterer's avatar Michael Natterer 😴

Bug 772126 - Make GimpColorFrame handle very long numbers

Add "ellipsize" property to GimpColorFrame and set it to
PANGO_ELLIPSIZE_END in the the pointer information dockable.

Better cut off long numbers than make them expand the dock.
parent 5e2600db
......@@ -320,6 +320,8 @@ gimp_cursor_view_init (GimpCursorView *view)
view->priv->color_frame_1 = gimp_color_frame_new ();
gimp_color_frame_set_mode (GIMP_COLOR_FRAME (view->priv->color_frame_1),
GIMP_COLOR_FRAME_MODE_PIXEL);
gimp_color_frame_set_ellipsize (GIMP_COLOR_FRAME (view->priv->color_frame_1),
PANGO_ELLIPSIZE_END);
gtk_box_pack_start (GTK_BOX (view->priv->color_hbox), view->priv->color_frame_1,
TRUE, TRUE, 0);
gtk_widget_show (view->priv->color_frame_1);
......
......@@ -43,7 +43,8 @@ enum
PROP_HAS_NUMBER,
PROP_NUMBER,
PROP_HAS_COLOR_AREA,
PROP_HAS_COORDS
PROP_HAS_COORDS,
PROP_ELLIPSIZE,
};
......@@ -122,6 +123,13 @@ gimp_color_frame_class_init (GimpColorFrameClass *klass)
NULL, NULL,
FALSE,
GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_ELLIPSIZE,
g_param_spec_enum ("ellipsize",
NULL, NULL,
PANGO_TYPE_ELLIPSIZE_MODE,
PANGO_ELLIPSIZE_NONE,
GIMP_PARAM_READWRITE));
}
static void
......@@ -182,7 +190,7 @@ gimp_color_frame_init (GimpColorFrame *frame)
gtk_label_set_selectable (GTK_LABEL (frame->value_labels[i]), TRUE);
gtk_label_set_xalign (GTK_LABEL (frame->value_labels[i]), 1.0);
gtk_box_pack_end (GTK_BOX (hbox), frame->value_labels[i],
FALSE, FALSE, 0);
TRUE, TRUE, 0);
gtk_widget_show (frame->value_labels[i]);
}
......@@ -249,6 +257,10 @@ gimp_color_frame_get_property (GObject *object,
g_value_set_enum (value, frame->frame_mode);
break;
case PROP_ELLIPSIZE:
g_value_set_enum (value, frame->ellipsize);
break;
case PROP_HAS_NUMBER:
g_value_set_boolean (value, frame->has_number);
break;
......@@ -285,6 +297,10 @@ gimp_color_frame_set_property (GObject *object,
gimp_color_frame_set_mode (frame, g_value_get_enum (value));
break;
case PROP_ELLIPSIZE:
gimp_color_frame_set_ellipsize (frame, g_value_get_enum (value));
break;
case PROP_HAS_NUMBER:
gimp_color_frame_set_has_number (frame, g_value_get_boolean (value));
break;
......@@ -417,6 +433,27 @@ gimp_color_frame_set_mode (GimpColorFrame *frame,
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (frame->menu), mode);
}
void
gimp_color_frame_set_ellipsize (GimpColorFrame *frame,
PangoEllipsizeMode ellipsize)
{
gint i;
g_return_if_fail (GIMP_IS_COLOR_FRAME (frame));
if (ellipsize != frame->ellipsize)
{
frame->ellipsize = ellipsize;
for (i = 0; i < GIMP_COLOR_FRAME_ROWS; i++)
{
if (frame->value_labels[i])
gtk_label_set_ellipsize (GTK_LABEL (frame->value_labels[i]),
ellipsize);
}
}
}
void
gimp_color_frame_set_has_number (GimpColorFrame *frame,
gboolean has_number)
......
......@@ -46,6 +46,8 @@ struct _GimpColorFrame
GimpColorFrameMode frame_mode;
PangoEllipsizeMode ellipsize;
gboolean has_number;
gint number;
......@@ -80,6 +82,9 @@ GtkWidget * gimp_color_frame_new (void);
void gimp_color_frame_set_mode (GimpColorFrame *frame,
GimpColorFrameMode mode);
void gimp_color_frame_set_ellipsize (GimpColorFrame *frame,
PangoEllipsizeMode ellipsize);
void gimp_color_frame_set_has_number (GimpColorFrame *frame,
gboolean has_number);
void gimp_color_frame_set_number (GimpColorFrame *frame,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment