Commit 8240ef1c authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

constrain popup size to GIMP_VIEWABLE_MAX_POPUP_SIZE but keep the aspect

2003-09-22  Sven Neumann  <sven@gimp.org>

	* app/core/gimpviewable.c (gimp_viewable_get_popup_size):
	constrain popup size to GIMP_VIEWABLE_MAX_POPUP_SIZE but keep the
	aspect ratio intact. Fixes bug #122923.

	* app/text/gimpfont.c: use a smaller font size for popups so we
	don't exceed the maximum size.
parent 7440dfd8
2003-09-22 Sven Neumann <sven@gimp.org>
* app/core/gimpviewable.c (gimp_viewable_get_popup_size):
constrain popup size to GIMP_VIEWABLE_MAX_POPUP_SIZE but keep the
aspect ratio intact. Fixes bug #122923.
* app/text/gimpfont.c: use a smaller font size for popups so we
don't exceed the maximum size.
2003-09-22 Sven Neumann <sven@gimp.org>
 
* plug-ins/common/svg.c: added a hack to work around the
......@@ -447,8 +447,25 @@ gimp_viewable_get_popup_size (GimpViewable *viewable,
width, height, dot_for_dot,
&w, &h))
{
w = MIN (w, GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
h = MIN (h, GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
if (w < 1) w = 1;
if (h < 1) h = 1;
if (w > GIMP_VIEWABLE_MAX_POPUP_SIZE ||
h > GIMP_VIEWABLE_MAX_POPUP_SIZE)
{
gdouble aspect = w / h;
if (w > h)
{
w = GIMP_VIEWABLE_MAX_POPUP_SIZE;
h = w / aspect;
}
else
{
h = GIMP_VIEWABLE_MAX_POPUP_SIZE;
w = h * aspect;
}
}
if (popup_width) *popup_width = w;
if (popup_height) *popup_height = h;
......
......@@ -36,9 +36,9 @@
/* This is a so-called pangram; it's supposed to
contain all characters found in the alphabet. */
#define GIMP_TEXT_PANGRAM N_("Pack my box with\nfive dozen liquor jugs.")
#define GIMP_TEXT_PANGRAM N_("Pack my box with\nfive dozen liquor jugs.")
#define GIMP_FONT_POPUP_SIZE (PANGO_SCALE * 32)
#define GIMP_FONT_POPUP_SIZE (PANGO_SCALE * 20)
enum
......@@ -197,7 +197,7 @@ gimp_font_set_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
}
static void
gimp_font_get_preview_size (GimpViewable *viewable,
......@@ -247,8 +247,8 @@ gimp_font_get_popup_size (GimpViewable *viewable,
pango_layout_set_text (font->popup_layout, gettext (GIMP_TEXT_PANGRAM), -1);
pango_layout_get_pixel_extents (font->popup_layout, NULL, &logical);
*popup_width = MIN (logical.width + 6, GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
*popup_height = MIN (logical.height + 6, GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
*popup_width = MIN (logical.width + 6, GIMP_VIEWABLE_MAX_POPUP_SIZE);
*popup_height = MIN (logical.height + 6, GIMP_VIEWABLE_MAX_POPUP_SIZE);
font->popup_width = *popup_width;
font->popup_height = *popup_height;
......
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