mirror of https://github.com/GNOME/gimp.git
app/display/Makefile.am split icon code to its own file.
2008-03-25 Sven Neumann <sven@gimp.org> * app/display/Makefile.am * app/display/gimpdisplayshell-icon.[ch]: split icon code to its own file. * app/display/gimpdisplayshell.c * app/display/gimpdisplayshell-handlers.c: changed accordingly. svn path=/trunk/; revision=25227
This commit is contained in:
parent
3f43ea0853
commit
bfd94e8e6b
|
@ -1,3 +1,12 @@
|
|||
2008-03-25 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/display/Makefile.am
|
||||
* app/display/gimpdisplayshell-icon.[ch]: split icon code to its
|
||||
own file.
|
||||
|
||||
* app/display/gimpdisplayshell.c
|
||||
* app/display/gimpdisplayshell-handlers.c: changed accordingly.
|
||||
|
||||
2008-03-25 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/display/gimpstatusbar.c (gimp_statusbar_peek): fixed
|
||||
|
|
|
@ -41,6 +41,8 @@ libappdisplay_a_sources = \
|
|||
gimpdisplayshell-filter-dialog.h \
|
||||
gimpdisplayshell-layer-select.c \
|
||||
gimpdisplayshell-layer-select.h \
|
||||
gimpdisplayshell-icon.c \
|
||||
gimpdisplayshell-icon.h \
|
||||
gimpdisplayshell-preview.c \
|
||||
gimpdisplayshell-preview.h \
|
||||
gimpdisplayshell-progress.c \
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "gimpdisplayshell-callbacks.h"
|
||||
#include "gimpdisplayshell-draw.h"
|
||||
#include "gimpdisplayshell-handlers.h"
|
||||
#include "gimpdisplayshell-icon.h"
|
||||
#include "gimpdisplayshell-scale.h"
|
||||
#include "gimpdisplayshell-selection.h"
|
||||
#include "gimpdisplayshell-title.h"
|
||||
|
@ -694,7 +695,7 @@ gimp_display_shell_idle_update_icon (gpointer data)
|
|||
|
||||
shell->icon_idle_id = 0;
|
||||
|
||||
gimp_display_shell_update_icon (shell);
|
||||
gimp_display_shell_icon_update (shell);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpviewable.h"
|
||||
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-icon.h"
|
||||
|
||||
|
||||
void
|
||||
gimp_display_shell_icon_update (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
image = shell->display->image;
|
||||
|
||||
if (image)
|
||||
{
|
||||
Gimp *gimp = shell->display->gimp;
|
||||
GdkPixbuf *pixbuf;
|
||||
gint width;
|
||||
gint height;
|
||||
gdouble factor = ((gdouble) gimp_image_get_height (image) /
|
||||
(gdouble) gimp_image_get_width (image));
|
||||
|
||||
if (factor >= 1)
|
||||
{
|
||||
height = MAX (shell->icon_size, 1);
|
||||
width = MAX (((gdouble) shell->icon_size) / factor, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
height = MAX (((gdouble) shell->icon_size) * factor, 1);
|
||||
width = MAX (shell->icon_size, 1);
|
||||
}
|
||||
|
||||
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image),
|
||||
gimp_get_user_context (gimp),
|
||||
width, height);
|
||||
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DISPLAY_SHELL_ICON_H__
|
||||
#define __GIMP_DISPLAY_SHELL_ICON_H__
|
||||
|
||||
|
||||
void gimp_display_shell_icon_update (GimpDisplayShell *shell);
|
||||
|
||||
|
||||
#endif /* __GIMP_DISPLAY_SHELL_ICON_H__ */
|
|
@ -1736,47 +1736,6 @@ gimp_display_shell_resume (GimpDisplayShell *shell)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_update_icon (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
image = shell->display->image;
|
||||
|
||||
if (image)
|
||||
{
|
||||
Gimp *gimp = shell->display->gimp;
|
||||
GdkPixbuf *pixbuf;
|
||||
gint width;
|
||||
gint height;
|
||||
gdouble factor = ((gdouble) gimp_image_get_height (image) /
|
||||
(gdouble) gimp_image_get_width (image));
|
||||
|
||||
if (factor >= 1)
|
||||
{
|
||||
height = MAX (shell->icon_size, 1);
|
||||
width = MAX (((gdouble) shell->icon_size) / factor, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
height = MAX (((gdouble) shell->icon_size) * factor, 1);
|
||||
width = MAX (shell->icon_size, 1);
|
||||
}
|
||||
|
||||
pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image),
|
||||
gimp_get_user_context (gimp),
|
||||
width, height);
|
||||
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), pixbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_window_set_icon (GTK_WINDOW (shell), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_shrink_wrap (GimpDisplayShell *shell,
|
||||
gboolean grow_only)
|
||||
|
|
Loading…
Reference in New Issue