mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
Fixed up code that limits how small icons are before they
stop showing embedded text. Too bad you can't see it in action until embedded text is turned back on. * icons/eazel/i-regular.xml: Added an embedded-text rectangle for one size smaller icon than had one before. * libnautilus-extensions/nautilus-icon-factory.c: Added #defines for minimum embedded text rectangle width and height. (embedded_text_rect_usable): New function, ensures that the embedded text rectangle is sufficiently large. (nautilus_icon_factory_embed_text), (nautilus_icon_factory_embed_file_text): Use new function to skip embedded text if rectangle is nonexistent or too small. * src/file-manager/fm-icon-view.c: (get_icon_images_callback): Removed the text-rectangle size limit here since now there's a universal one inside nautilus_icon_factory.
This commit is contained in:
parent
4b7108ec5a
commit
574a7c840a
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
|||
2000-05-06 John Sullivan <sullivan@eazel.com>
|
||||
|
||||
Fixed up code that limits how small icons are before they
|
||||
stop showing embedded text. Too bad you can't see it in
|
||||
action until embedded text is turned back on.
|
||||
|
||||
* icons/eazel/i-regular.xml: Added an embedded-text rectangle
|
||||
for one size smaller icon than had one before.
|
||||
|
||||
* libnautilus-extensions/nautilus-icon-factory.c:
|
||||
Added #defines for minimum embedded text rectangle width
|
||||
and height.
|
||||
(embedded_text_rect_usable): New function, ensures that the
|
||||
embedded text rectangle is sufficiently large.
|
||||
(nautilus_icon_factory_embed_text),
|
||||
(nautilus_icon_factory_embed_file_text): Use new function to
|
||||
skip embedded text if rectangle is nonexistent or too small.
|
||||
|
||||
* src/file-manager/fm-icon-view.c:
|
||||
(get_icon_images_callback): Removed the text-rectangle size
|
||||
limit here since now there's a universal one inside
|
||||
nautilus_icon_factory.
|
||||
|
||||
2000-05-06 Darin Adler <darin@eazel.com>
|
||||
|
||||
* libnautilus-extensions/nautilus-directory-async.c:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<ICON_SET>
|
||||
<ICON SIZE="36" EMBEDDED_TEXT_RECTANGLE="4,3,25,31"/>
|
||||
<ICON SIZE="48" EMBEDDED_TEXT_RECTANGLE="5,4,38,47"/>
|
||||
<ICON SIZE="72" EMBEDDED_TEXT_RECTANGLE="6,6,51,62"/>
|
||||
<ICON SIZE="96" EMBEDDED_TEXT_RECTANGLE="8,8,76,94"/>
|
||||
|
|
|
@ -192,6 +192,9 @@ typedef struct {
|
|||
ArtIRect text_rect;
|
||||
} IconCacheKey;
|
||||
|
||||
#define MINIMUM_EMBEDDED_TEXT_RECT_WIDTH 20.0
|
||||
#define MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT 20.0
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
static void icon_theme_changed_callback (gpointer user_data);
|
||||
|
@ -1673,6 +1676,23 @@ nautilus_icon_factory_get_pixmap_and_mask_for_file (NautilusFile *file,
|
|||
gdk_pixbuf_unref (pixbuf);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
embedded_text_rect_usable (const ArtIRect *embedded_text_rect)
|
||||
{
|
||||
if (art_irect_empty (embedded_text_rect)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (embedded_text_rect->x1 - embedded_text_rect->x0
|
||||
< MINIMUM_EMBEDDED_TEXT_RECT_WIDTH ||
|
||||
embedded_text_rect->y1 - embedded_text_rect->y0
|
||||
< MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
nautilus_icon_factory_embed_text (GdkPixbuf *pixbuf_without_text,
|
||||
const ArtIRect *embedded_text_rect,
|
||||
|
@ -1703,9 +1723,9 @@ nautilus_icon_factory_embed_text (GdkPixbuf *pixbuf_without_text,
|
|||
}
|
||||
|
||||
/* Quick out for the case where there's no place to embed the
|
||||
* text or no text.
|
||||
* text or the place is too small or there's no text.
|
||||
*/
|
||||
if (art_irect_empty (embedded_text_rect) || nautilus_strlen (text) == 0) {
|
||||
if (!embedded_text_rect_usable (embedded_text_rect) || nautilus_strlen (text) == 0) {
|
||||
return gdk_pixbuf_ref (pixbuf_without_text);
|
||||
}
|
||||
|
||||
|
@ -1803,7 +1823,7 @@ nautilus_icon_factory_embed_file_text (GdkPixbuf *pixbuf_without_text,
|
|||
g_return_val_if_fail (file == NULL || NAUTILUS_IS_FILE (file), NULL);
|
||||
|
||||
/* Quick out to save us getting the file's text. */
|
||||
if (art_irect_empty (embedded_text_rect) && file == NULL) {
|
||||
if (!embedded_text_rect_usable (embedded_text_rect) && file == NULL) {
|
||||
return gdk_pixbuf_ref (pixbuf_without_text);
|
||||
}
|
||||
|
||||
|
|
|
@ -192,6 +192,9 @@ typedef struct {
|
|||
ArtIRect text_rect;
|
||||
} IconCacheKey;
|
||||
|
||||
#define MINIMUM_EMBEDDED_TEXT_RECT_WIDTH 20.0
|
||||
#define MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT 20.0
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
static void icon_theme_changed_callback (gpointer user_data);
|
||||
|
@ -1673,6 +1676,23 @@ nautilus_icon_factory_get_pixmap_and_mask_for_file (NautilusFile *file,
|
|||
gdk_pixbuf_unref (pixbuf);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
embedded_text_rect_usable (const ArtIRect *embedded_text_rect)
|
||||
{
|
||||
if (art_irect_empty (embedded_text_rect)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (embedded_text_rect->x1 - embedded_text_rect->x0
|
||||
< MINIMUM_EMBEDDED_TEXT_RECT_WIDTH ||
|
||||
embedded_text_rect->y1 - embedded_text_rect->y0
|
||||
< MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
nautilus_icon_factory_embed_text (GdkPixbuf *pixbuf_without_text,
|
||||
const ArtIRect *embedded_text_rect,
|
||||
|
@ -1703,9 +1723,9 @@ nautilus_icon_factory_embed_text (GdkPixbuf *pixbuf_without_text,
|
|||
}
|
||||
|
||||
/* Quick out for the case where there's no place to embed the
|
||||
* text or no text.
|
||||
* text or the place is too small or there's no text.
|
||||
*/
|
||||
if (art_irect_empty (embedded_text_rect) || nautilus_strlen (text) == 0) {
|
||||
if (!embedded_text_rect_usable (embedded_text_rect) || nautilus_strlen (text) == 0) {
|
||||
return gdk_pixbuf_ref (pixbuf_without_text);
|
||||
}
|
||||
|
||||
|
@ -1803,7 +1823,7 @@ nautilus_icon_factory_embed_file_text (GdkPixbuf *pixbuf_without_text,
|
|||
g_return_val_if_fail (file == NULL || NAUTILUS_IS_FILE (file), NULL);
|
||||
|
||||
/* Quick out to save us getting the file's text. */
|
||||
if (art_irect_empty (embedded_text_rect) && file == NULL) {
|
||||
if (!embedded_text_rect_usable (embedded_text_rect) && file == NULL) {
|
||||
return gdk_pixbuf_ref (pixbuf_without_text);
|
||||
}
|
||||
|
||||
|
|
|
@ -1017,16 +1017,16 @@ get_icon_images_callback (NautilusIconContainer *container,
|
|||
NAUTILUS_ICON_MAXIMUM_IMAGE_SIZE,
|
||||
&text_rect);
|
||||
nautilus_scalable_icon_unref (scalable_icon);
|
||||
if (icon_size_x < NAUTILUS_ICON_SIZE_STANDARD
|
||||
|| icon_size_y < NAUTILUS_ICON_SIZE_STANDARD) {
|
||||
pixbuf_with_text = pixbuf_without_text;
|
||||
} else {
|
||||
pixbuf_with_text = nautilus_icon_factory_embed_file_text
|
||||
(pixbuf_without_text,
|
||||
&text_rect,
|
||||
file);
|
||||
gdk_pixbuf_unref (pixbuf_without_text);
|
||||
}
|
||||
|
||||
/* Get the text to embed; this will bail out early if
|
||||
* the rect is too small.
|
||||
*/
|
||||
pixbuf_with_text = nautilus_icon_factory_embed_file_text
|
||||
(pixbuf_without_text,
|
||||
&text_rect,
|
||||
file);
|
||||
gdk_pixbuf_unref (pixbuf_without_text);
|
||||
|
||||
return pixbuf_with_text;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue