mirror of https://github.com/GNOME/gimp.git
themes/Default/images/Makefile.am
2003-04-03 Sven Neumann <sven@gimp.org> * themes/Default/images/Makefile.am * themes/Default/images/stock-template-16.png * themes/Default/images/stock-texture-64.png: new icons by Jimmac. * libgimpwidgets/gimpstock.[ch]: register the new icons. * app/widgets/gimppreview.[ch]: added the possibility to set a background pixmap on the preview widget. * app/gui/dialogs-constructors.c * app/display/gimpnavigationview.[ch] * app/widgets/gimpselectioneditor.[ch]: set a background on the navigation and selection previews when layer previews are disabled in the preferences.
This commit is contained in:
parent
cf84c4c03f
commit
c556c957a2
19
ChangeLog
19
ChangeLog
|
@ -1,10 +1,27 @@
|
|||
2003-04-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* themes/Default/images/Makefile.am
|
||||
* themes/Default/images/stock-template-16.png
|
||||
* themes/Default/images/stock-texture-64.png: new icons by Jimmac.
|
||||
|
||||
* libgimpwidgets/gimpstock.[ch]: register the new icons.
|
||||
|
||||
* app/widgets/gimppreview.[ch]: added the possibility to set a
|
||||
background pixmap on the preview widget.
|
||||
|
||||
* app/gui/dialogs-constructors.c
|
||||
* app/display/gimpnavigationview.[ch]
|
||||
* app/widgets/gimpselectioneditor.[ch]: set a background on the
|
||||
navigation and selection previews when layer previews are disabled
|
||||
in the preferences.
|
||||
|
||||
2003-04-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* docs/keybindings.txt: updated list of keybindings provided by
|
||||
Owen <oc@webone.com.au>.
|
||||
|
||||
* docs/Makefile.am
|
||||
* cheat_sheet.txt: removed this hopelessly outdated file.
|
||||
* docs/cheat_sheet.txt: removed this hopelessly outdated file.
|
||||
|
||||
2003-04-02 Sven Neumann <sven@gimp.org>
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "config/gimpcoreconfig.h"
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "widgets/gimpbrusheditor.h"
|
||||
#include "widgets/gimpbrushfactoryview.h"
|
||||
|
@ -801,7 +801,7 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
|
|||
|
||||
gimage = gimp_context_get_image (context);
|
||||
|
||||
view = gimp_selection_editor_new (gimage);
|
||||
view = gimp_selection_editor_new (gimage, context->gimp->config);
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Selection Editor"), _("Selection"),
|
||||
|
@ -1003,7 +1003,8 @@ dialogs_navigation_view_new (GimpDialogFactory *factory,
|
|||
if (gdisp)
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
view = gimp_navigation_view_new (shell);
|
||||
view = gimp_navigation_view_new (shell,
|
||||
GIMP_DISPLAY_CONFIG (context->gimp->config));
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Display Navigation"), _("Navigation"),
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "widgets/gimpnavigationpreview.h"
|
||||
|
@ -57,6 +56,7 @@ static void gimp_navigation_view_init (GimpNavigationView *view);
|
|||
static void gimp_navigation_view_destroy (GtkObject *object);
|
||||
|
||||
static GtkWidget * gimp_navigation_view_new_private (GimpDisplayShell *shell,
|
||||
GimpDisplayConfig *config,
|
||||
gboolean popup);
|
||||
|
||||
static gboolean gimp_navigation_view_button_release (GtkWidget *widget,
|
||||
|
@ -94,6 +94,9 @@ static void gimp_navigation_view_shell_scrolled (GimpDisplayShell *shell,
|
|||
static void gimp_navigation_view_shell_reconnect (GimpDisplayShell *shell,
|
||||
GimpNavigationView *view);
|
||||
static void gimp_navigation_view_update_marker (GimpNavigationView *view);
|
||||
static void gimp_navigation_view_set_background (GObject *config,
|
||||
GParamSpec *pspec,
|
||||
GimpPreview *preview);
|
||||
|
||||
|
||||
static GimpEditorClass *parent_class = NULL;
|
||||
|
@ -192,9 +195,10 @@ gimp_navigation_view_destroy (GtkObject *object)
|
|||
/* public functions */
|
||||
|
||||
GtkWidget *
|
||||
gimp_navigation_view_new (GimpDisplayShell *shell)
|
||||
gimp_navigation_view_new (GimpDisplayShell *shell,
|
||||
GimpDisplayConfig *config)
|
||||
{
|
||||
return gimp_navigation_view_new_private (shell, FALSE);
|
||||
return gimp_navigation_view_new_private (shell, config, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -266,6 +270,7 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
|
|||
|
||||
if (! shell->nav_popup)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
GtkWidget *frame;
|
||||
|
||||
shell->nav_popup = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
|
@ -275,7 +280,10 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
|
|||
gtk_container_add (GTK_CONTAINER (shell->nav_popup), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
view = GIMP_NAVIGATION_VIEW (gimp_navigation_view_new_private (shell,
|
||||
config,
|
||||
TRUE));
|
||||
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (view));
|
||||
gtk_widget_show (GTK_WIDGET (view));
|
||||
|
@ -341,22 +349,20 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
|
|||
|
||||
static GtkWidget *
|
||||
gimp_navigation_view_new_private (GimpDisplayShell *shell,
|
||||
GimpDisplayConfig *config,
|
||||
gboolean popup)
|
||||
{
|
||||
GimpNavigationView *view;
|
||||
|
||||
g_return_val_if_fail (! shell || GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_CONFIG (config), NULL);
|
||||
g_return_val_if_fail (! popup || (popup && shell), NULL);
|
||||
|
||||
view = g_object_new (GIMP_TYPE_NAVIGATION_VIEW, NULL);
|
||||
|
||||
if (popup)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
GimpPreview *preview;
|
||||
|
||||
preview = GIMP_PREVIEW (view->preview);
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
GimpPreview *preview = GIMP_PREVIEW (view->preview);
|
||||
|
||||
gimp_preview_set_size (preview,
|
||||
config->nav_preview_size * 3,
|
||||
|
@ -444,6 +450,15 @@ gimp_navigation_view_new_private (GimpDisplayShell *shell,
|
|||
if (shell)
|
||||
gimp_navigation_view_set_shell (view, shell);
|
||||
|
||||
|
||||
if (! GIMP_CORE_CONFIG (config)->layer_previews)
|
||||
gimp_preview_set_background (GIMP_PREVIEW (view->preview),
|
||||
GIMP_STOCK_TEXTURE);
|
||||
|
||||
g_signal_connect_object (config, "notify::layer-previews",
|
||||
G_CALLBACK (gimp_navigation_view_set_background),
|
||||
view->preview, 0);
|
||||
|
||||
return GTK_WIDGET (view);
|
||||
}
|
||||
|
||||
|
@ -685,3 +700,18 @@ gimp_navigation_view_update_marker (GimpNavigationView *view)
|
|||
view->shell->disp_width / xratio,
|
||||
view->shell->disp_height / yratio);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_navigation_view_set_background (GObject *config,
|
||||
GParamSpec *pspec,
|
||||
GimpPreview *preview)
|
||||
{
|
||||
gboolean layer_previews;
|
||||
|
||||
g_object_get (config,
|
||||
"layer-previews", &layer_previews,
|
||||
NULL);
|
||||
|
||||
gimp_preview_set_background (preview,
|
||||
layer_previews ? NULL : GIMP_STOCK_TEXTURE);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,8 @@ struct _GimpNavigationViewClass
|
|||
|
||||
GType gimp_navigation_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_navigation_view_new (GimpDisplayShell *shell);
|
||||
GtkWidget * gimp_navigation_view_new (GimpDisplayShell *shell,
|
||||
GimpDisplayConfig *config);
|
||||
void gimp_navigation_view_set_shell (GimpNavigationView *view,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "widgets/gimpnavigationpreview.h"
|
||||
|
@ -57,6 +56,7 @@ static void gimp_navigation_view_init (GimpNavigationView *view);
|
|||
static void gimp_navigation_view_destroy (GtkObject *object);
|
||||
|
||||
static GtkWidget * gimp_navigation_view_new_private (GimpDisplayShell *shell,
|
||||
GimpDisplayConfig *config,
|
||||
gboolean popup);
|
||||
|
||||
static gboolean gimp_navigation_view_button_release (GtkWidget *widget,
|
||||
|
@ -94,6 +94,9 @@ static void gimp_navigation_view_shell_scrolled (GimpDisplayShell *shell,
|
|||
static void gimp_navigation_view_shell_reconnect (GimpDisplayShell *shell,
|
||||
GimpNavigationView *view);
|
||||
static void gimp_navigation_view_update_marker (GimpNavigationView *view);
|
||||
static void gimp_navigation_view_set_background (GObject *config,
|
||||
GParamSpec *pspec,
|
||||
GimpPreview *preview);
|
||||
|
||||
|
||||
static GimpEditorClass *parent_class = NULL;
|
||||
|
@ -192,9 +195,10 @@ gimp_navigation_view_destroy (GtkObject *object)
|
|||
/* public functions */
|
||||
|
||||
GtkWidget *
|
||||
gimp_navigation_view_new (GimpDisplayShell *shell)
|
||||
gimp_navigation_view_new (GimpDisplayShell *shell,
|
||||
GimpDisplayConfig *config)
|
||||
{
|
||||
return gimp_navigation_view_new_private (shell, FALSE);
|
||||
return gimp_navigation_view_new_private (shell, config, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -266,6 +270,7 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
|
|||
|
||||
if (! shell->nav_popup)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
GtkWidget *frame;
|
||||
|
||||
shell->nav_popup = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
|
@ -275,7 +280,10 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
|
|||
gtk_container_add (GTK_CONTAINER (shell->nav_popup), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
|
||||
view = GIMP_NAVIGATION_VIEW (gimp_navigation_view_new_private (shell,
|
||||
config,
|
||||
TRUE));
|
||||
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (view));
|
||||
gtk_widget_show (GTK_WIDGET (view));
|
||||
|
@ -341,22 +349,20 @@ gimp_navigation_view_popup (GimpDisplayShell *shell,
|
|||
|
||||
static GtkWidget *
|
||||
gimp_navigation_view_new_private (GimpDisplayShell *shell,
|
||||
GimpDisplayConfig *config,
|
||||
gboolean popup)
|
||||
{
|
||||
GimpNavigationView *view;
|
||||
|
||||
g_return_val_if_fail (! shell || GIMP_IS_DISPLAY_SHELL (shell), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_CONFIG (config), NULL);
|
||||
g_return_val_if_fail (! popup || (popup && shell), NULL);
|
||||
|
||||
view = g_object_new (GIMP_TYPE_NAVIGATION_VIEW, NULL);
|
||||
|
||||
if (popup)
|
||||
{
|
||||
GimpDisplayConfig *config;
|
||||
GimpPreview *preview;
|
||||
|
||||
preview = GIMP_PREVIEW (view->preview);
|
||||
config = GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config);
|
||||
GimpPreview *preview = GIMP_PREVIEW (view->preview);
|
||||
|
||||
gimp_preview_set_size (preview,
|
||||
config->nav_preview_size * 3,
|
||||
|
@ -444,6 +450,15 @@ gimp_navigation_view_new_private (GimpDisplayShell *shell,
|
|||
if (shell)
|
||||
gimp_navigation_view_set_shell (view, shell);
|
||||
|
||||
|
||||
if (! GIMP_CORE_CONFIG (config)->layer_previews)
|
||||
gimp_preview_set_background (GIMP_PREVIEW (view->preview),
|
||||
GIMP_STOCK_TEXTURE);
|
||||
|
||||
g_signal_connect_object (config, "notify::layer-previews",
|
||||
G_CALLBACK (gimp_navigation_view_set_background),
|
||||
view->preview, 0);
|
||||
|
||||
return GTK_WIDGET (view);
|
||||
}
|
||||
|
||||
|
@ -685,3 +700,18 @@ gimp_navigation_view_update_marker (GimpNavigationView *view)
|
|||
view->shell->disp_width / xratio,
|
||||
view->shell->disp_height / yratio);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_navigation_view_set_background (GObject *config,
|
||||
GParamSpec *pspec,
|
||||
GimpPreview *preview)
|
||||
{
|
||||
gboolean layer_previews;
|
||||
|
||||
g_object_get (config,
|
||||
"layer-previews", &layer_previews,
|
||||
NULL);
|
||||
|
||||
gimp_preview_set_background (preview,
|
||||
layer_previews ? NULL : GIMP_STOCK_TEXTURE);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,8 @@ struct _GimpNavigationViewClass
|
|||
|
||||
GType gimp_navigation_view_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_navigation_view_new (GimpDisplayShell *shell);
|
||||
GtkWidget * gimp_navigation_view_new (GimpDisplayShell *shell,
|
||||
GimpDisplayConfig *config);
|
||||
void gimp_navigation_view_set_shell (GimpNavigationView *view,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "config/gimpcoreconfig.h"
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "widgets/gimpbrusheditor.h"
|
||||
#include "widgets/gimpbrushfactoryview.h"
|
||||
|
@ -801,7 +801,7 @@ dialogs_selection_editor_new (GimpDialogFactory *factory,
|
|||
|
||||
gimage = gimp_context_get_image (context);
|
||||
|
||||
view = gimp_selection_editor_new (gimage);
|
||||
view = gimp_selection_editor_new (gimage, context->gimp->config);
|
||||
|
||||
dockable = dialogs_dockable_new (view,
|
||||
_("Selection Editor"), _("Selection"),
|
||||
|
@ -1003,7 +1003,8 @@ dialogs_navigation_view_new (GimpDialogFactory *factory,
|
|||
if (gdisp)
|
||||
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
|
||||
|
||||
view = gimp_navigation_view_new (shell);
|
||||
view = gimp_navigation_view_new (shell,
|
||||
GIMP_DISPLAY_CONFIG (context->gimp->config));
|
||||
|
||||
return dialogs_dockable_new (view,
|
||||
_("Display Navigation"), _("Navigation"),
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
GDK_ENTER_NOTIFY_MASK | \
|
||||
GDK_LEAVE_NOTIFY_MASK)
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
CLICKED,
|
||||
|
@ -60,6 +61,7 @@ static void gimp_preview_class_init (GimpPreviewClass *klass);
|
|||
static void gimp_preview_init (GimpPreview *preview);
|
||||
|
||||
static void gimp_preview_destroy (GtkObject *object);
|
||||
static void gimp_preview_realize (GtkWidget *widget);
|
||||
static void gimp_preview_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gimp_preview_size_allocate (GtkWidget *widget,
|
||||
|
@ -81,6 +83,8 @@ static void gimp_preview_update_callback (GimpPreviewRenderer *renderer
|
|||
static GimpViewable * gimp_preview_drag_viewable (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_preview_set_back_pixmap (GimpPreview *preview);
|
||||
|
||||
|
||||
static guint preview_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
@ -157,6 +161,7 @@ gimp_preview_class_init (GimpPreviewClass *klass)
|
|||
object_class->destroy = gimp_preview_destroy;
|
||||
|
||||
widget_class->activate_signal = preview_signals[CLICKED];
|
||||
widget_class->realize = gimp_preview_realize;
|
||||
widget_class->size_request = gimp_preview_size_request;
|
||||
widget_class->size_allocate = gimp_preview_size_allocate;
|
||||
widget_class->expose_event = gimp_preview_expose_event;
|
||||
|
@ -183,6 +188,8 @@ gimp_preview_init (GimpPreview *preview)
|
|||
|
||||
preview->in_button = FALSE;
|
||||
|
||||
preview->bg_stock_id = NULL;
|
||||
|
||||
gtk_widget_set_events (GTK_WIDGET (preview), PREVIEW_EVENT_MASK);
|
||||
}
|
||||
|
||||
|
@ -201,10 +208,23 @@ gimp_preview_destroy (GtkObject *object)
|
|||
g_object_unref (preview->renderer);
|
||||
preview->renderer = NULL;
|
||||
}
|
||||
if (preview->bg_stock_id)
|
||||
{
|
||||
g_free (preview->bg_stock_id);
|
||||
preview->bg_stock_id = NULL;
|
||||
}
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_realize (GtkWidget *widget)
|
||||
{
|
||||
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
||||
|
||||
gimp_preview_set_back_pixmap (GIMP_PREVIEW (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
|
@ -662,6 +682,8 @@ gimp_preview_set_viewable (GimpPreview *preview,
|
|||
g_object_add_weak_pointer (G_OBJECT (preview->viewable),
|
||||
(gpointer *) &preview->viewable);
|
||||
}
|
||||
|
||||
gimp_preview_set_back_pixmap (preview);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -729,6 +751,20 @@ gimp_preview_set_border_color (GimpPreview *preview,
|
|||
gimp_preview_renderer_set_border_color (preview->renderer, color);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_set_background (GimpPreview *preview,
|
||||
const gchar *stock_id)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW (preview));
|
||||
|
||||
if (preview->bg_stock_id)
|
||||
g_free (preview->bg_stock_id);
|
||||
|
||||
preview->bg_stock_id = g_strdup (stock_id);
|
||||
|
||||
gimp_preview_set_back_pixmap (preview);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
@ -765,3 +801,56 @@ gimp_preview_drag_viewable (GtkWidget *widget,
|
|||
{
|
||||
return GIMP_PREVIEW (widget)->viewable;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_set_back_pixmap (GimpPreview *preview)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixmap *pixmap = NULL;
|
||||
|
||||
if (! GTK_WIDGET_REALIZED (preview))
|
||||
return;
|
||||
|
||||
widget = GTK_WIDGET (preview);
|
||||
|
||||
if (preview->bg_stock_id && preview->viewable)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = gtk_widget_render_icon (widget,
|
||||
preview->bg_stock_id,
|
||||
GTK_ICON_SIZE_DIALOG, NULL);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
colormap = gdk_drawable_get_colormap (widget->window);
|
||||
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
pixmap = gdk_pixmap_new (widget->window, width, height,
|
||||
gdk_colormap_get_visual (colormap)->depth);
|
||||
gdk_drawable_set_colormap (pixmap, colormap);
|
||||
|
||||
gdk_draw_rectangle (pixmap, widget->style->white_gc,
|
||||
TRUE,
|
||||
0, 0, width, height);
|
||||
|
||||
gdk_draw_pixbuf (pixmap, widget->style->white_gc,
|
||||
pixbuf, 0, 0,
|
||||
0, 0, width, height,
|
||||
GDK_RGB_DITHER_NORMAL, 0, 0);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_window_set_back_pixmap (widget->window, pixmap, FALSE);
|
||||
|
||||
if (pixmap)
|
||||
g_object_unref (pixmap);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,8 @@ struct _GimpPreview
|
|||
|
||||
/*< private >*/
|
||||
gboolean in_button;
|
||||
guint press_state;
|
||||
GdkModifierType press_state;
|
||||
gchar *bg_stock_id;
|
||||
};
|
||||
|
||||
struct _GimpPreviewClass
|
||||
|
@ -107,6 +108,8 @@ void gimp_preview_set_dot_for_dot (GimpPreview *preview,
|
|||
gboolean dot_for_dot);
|
||||
void gimp_preview_set_border_color (GimpPreview *preview,
|
||||
const GimpRGB *border_color);
|
||||
void gimp_preview_set_background (GimpPreview *preview,
|
||||
const gchar *stock_id);
|
||||
|
||||
|
||||
#endif /* __GIMP_PREVIEW_H__ */
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "tools/tools-types.h"
|
||||
|
||||
#include "config/gimpcoreconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
|
@ -77,6 +79,9 @@ static void gimp_selection_editor_drop_color (GtkWidget *widget,
|
|||
|
||||
static void gimp_selection_editor_mask_changed (GimpImage *gimage,
|
||||
GimpSelectionEditor *editor);
|
||||
static void gimp_selection_editor_set_background (GObject *config,
|
||||
GParamSpec *pspec,
|
||||
GimpPreview *preview);
|
||||
|
||||
|
||||
static GimpImageEditorClass *parent_class = NULL;
|
||||
|
@ -224,14 +229,24 @@ gimp_selection_editor_set_image (GimpImageEditor *image_editor,
|
|||
#define PREVIEW_HEIGHT 256
|
||||
|
||||
GtkWidget *
|
||||
gimp_selection_editor_new (GimpImage *gimage)
|
||||
gimp_selection_editor_new (GimpImage *gimage,
|
||||
GimpCoreConfig *config)
|
||||
{
|
||||
GimpSelectionEditor *editor;
|
||||
|
||||
g_return_val_if_fail (! gimage || GIMP_IS_IMAGE (gimage), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CORE_CONFIG (config), NULL);
|
||||
|
||||
editor = g_object_new (GIMP_TYPE_SELECTION_EDITOR, NULL);
|
||||
|
||||
if (! config->layer_previews)
|
||||
gimp_preview_set_background (GIMP_PREVIEW (editor->preview),
|
||||
GIMP_STOCK_TEXTURE);
|
||||
|
||||
g_signal_connect_object (config, "notify::layer-previews",
|
||||
G_CALLBACK (gimp_selection_editor_set_background),
|
||||
editor->preview, 0);
|
||||
|
||||
if (gimage)
|
||||
gimp_image_editor_set_image (GIMP_IMAGE_EDITOR (editor), gimage);
|
||||
|
||||
|
@ -431,3 +446,18 @@ gimp_selection_editor_mask_changed (GimpImage *gimage,
|
|||
{
|
||||
gimp_preview_renderer_invalidate (GIMP_PREVIEW (editor->preview)->renderer);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_selection_editor_set_background (GObject *config,
|
||||
GParamSpec *pspec,
|
||||
GimpPreview *preview)
|
||||
{
|
||||
gboolean layer_previews;
|
||||
|
||||
g_object_get (config,
|
||||
"layer-previews", &layer_previews,
|
||||
NULL);
|
||||
|
||||
gimp_preview_set_background (preview,
|
||||
layer_previews ? NULL : GIMP_STOCK_TEXTURE);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,8 @@ struct _GimpSelectionEditorClass
|
|||
|
||||
GType gimp_selection_editor_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_selection_editor_new (GimpImage *gimage);
|
||||
GtkWidget * gimp_selection_editor_new (GimpImage *gimage,
|
||||
GimpCoreConfig *config);
|
||||
|
||||
|
||||
#endif /* __GIMP_SELECTION_EDITOR_H__ */
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
GDK_ENTER_NOTIFY_MASK | \
|
||||
GDK_LEAVE_NOTIFY_MASK)
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
CLICKED,
|
||||
|
@ -60,6 +61,7 @@ static void gimp_preview_class_init (GimpPreviewClass *klass);
|
|||
static void gimp_preview_init (GimpPreview *preview);
|
||||
|
||||
static void gimp_preview_destroy (GtkObject *object);
|
||||
static void gimp_preview_realize (GtkWidget *widget);
|
||||
static void gimp_preview_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gimp_preview_size_allocate (GtkWidget *widget,
|
||||
|
@ -81,6 +83,8 @@ static void gimp_preview_update_callback (GimpPreviewRenderer *renderer
|
|||
static GimpViewable * gimp_preview_drag_viewable (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void gimp_preview_set_back_pixmap (GimpPreview *preview);
|
||||
|
||||
|
||||
static guint preview_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
@ -157,6 +161,7 @@ gimp_preview_class_init (GimpPreviewClass *klass)
|
|||
object_class->destroy = gimp_preview_destroy;
|
||||
|
||||
widget_class->activate_signal = preview_signals[CLICKED];
|
||||
widget_class->realize = gimp_preview_realize;
|
||||
widget_class->size_request = gimp_preview_size_request;
|
||||
widget_class->size_allocate = gimp_preview_size_allocate;
|
||||
widget_class->expose_event = gimp_preview_expose_event;
|
||||
|
@ -183,6 +188,8 @@ gimp_preview_init (GimpPreview *preview)
|
|||
|
||||
preview->in_button = FALSE;
|
||||
|
||||
preview->bg_stock_id = NULL;
|
||||
|
||||
gtk_widget_set_events (GTK_WIDGET (preview), PREVIEW_EVENT_MASK);
|
||||
}
|
||||
|
||||
|
@ -201,10 +208,23 @@ gimp_preview_destroy (GtkObject *object)
|
|||
g_object_unref (preview->renderer);
|
||||
preview->renderer = NULL;
|
||||
}
|
||||
if (preview->bg_stock_id)
|
||||
{
|
||||
g_free (preview->bg_stock_id);
|
||||
preview->bg_stock_id = NULL;
|
||||
}
|
||||
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_realize (GtkWidget *widget)
|
||||
{
|
||||
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
||||
|
||||
gimp_preview_set_back_pixmap (GIMP_PREVIEW (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
|
@ -662,6 +682,8 @@ gimp_preview_set_viewable (GimpPreview *preview,
|
|||
g_object_add_weak_pointer (G_OBJECT (preview->viewable),
|
||||
(gpointer *) &preview->viewable);
|
||||
}
|
||||
|
||||
gimp_preview_set_back_pixmap (preview);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -729,6 +751,20 @@ gimp_preview_set_border_color (GimpPreview *preview,
|
|||
gimp_preview_renderer_set_border_color (preview->renderer, color);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_preview_set_background (GimpPreview *preview,
|
||||
const gchar *stock_id)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PREVIEW (preview));
|
||||
|
||||
if (preview->bg_stock_id)
|
||||
g_free (preview->bg_stock_id);
|
||||
|
||||
preview->bg_stock_id = g_strdup (stock_id);
|
||||
|
||||
gimp_preview_set_back_pixmap (preview);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
@ -765,3 +801,56 @@ gimp_preview_drag_viewable (GtkWidget *widget,
|
|||
{
|
||||
return GIMP_PREVIEW (widget)->viewable;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_preview_set_back_pixmap (GimpPreview *preview)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkPixmap *pixmap = NULL;
|
||||
|
||||
if (! GTK_WIDGET_REALIZED (preview))
|
||||
return;
|
||||
|
||||
widget = GTK_WIDGET (preview);
|
||||
|
||||
if (preview->bg_stock_id && preview->viewable)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = gtk_widget_render_icon (widget,
|
||||
preview->bg_stock_id,
|
||||
GTK_ICON_SIZE_DIALOG, NULL);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
colormap = gdk_drawable_get_colormap (widget->window);
|
||||
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
pixmap = gdk_pixmap_new (widget->window, width, height,
|
||||
gdk_colormap_get_visual (colormap)->depth);
|
||||
gdk_drawable_set_colormap (pixmap, colormap);
|
||||
|
||||
gdk_draw_rectangle (pixmap, widget->style->white_gc,
|
||||
TRUE,
|
||||
0, 0, width, height);
|
||||
|
||||
gdk_draw_pixbuf (pixmap, widget->style->white_gc,
|
||||
pixbuf, 0, 0,
|
||||
0, 0, width, height,
|
||||
GDK_RGB_DITHER_NORMAL, 0, 0);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_window_set_back_pixmap (widget->window, pixmap, FALSE);
|
||||
|
||||
if (pixmap)
|
||||
g_object_unref (pixmap);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,8 @@ struct _GimpPreview
|
|||
|
||||
/*< private >*/
|
||||
gboolean in_button;
|
||||
guint press_state;
|
||||
GdkModifierType press_state;
|
||||
gchar *bg_stock_id;
|
||||
};
|
||||
|
||||
struct _GimpPreviewClass
|
||||
|
@ -107,6 +108,8 @@ void gimp_preview_set_dot_for_dot (GimpPreview *preview,
|
|||
gboolean dot_for_dot);
|
||||
void gimp_preview_set_border_color (GimpPreview *preview,
|
||||
const GimpRGB *border_color);
|
||||
void gimp_preview_set_background (GimpPreview *preview,
|
||||
const gchar *stock_id);
|
||||
|
||||
|
||||
#endif /* __GIMP_PREVIEW_H__ */
|
||||
|
|
|
@ -174,6 +174,7 @@ static GtkStockItem gimp_stock_items[] =
|
|||
{ GIMP_STOCK_CHANNEL_BLUE, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_CHANNEL_GRAY, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_CHANNEL_ALPHA, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_TEMPLATE, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
|
||||
{ GIMP_STOCK_SELECTION_ALL, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_SELECTION_NONE, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
|
@ -181,6 +182,7 @@ static GtkStockItem gimp_stock_items[] =
|
|||
{ GIMP_STOCK_SELECTION_SHRINK, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
|
||||
{ GIMP_STOCK_NAVIGATION, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_TEXTURE, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_QMASK_OFF, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
{ GIMP_STOCK_QMASK_ON, NULL, 0, 0, LIBGIMP_DOMAIN },
|
||||
|
||||
|
@ -384,6 +386,7 @@ gimp_stock_menu_pixbufs[] =
|
|||
{ GIMP_STOCK_IMAGE, stock_image_16 },
|
||||
{ GIMP_STOCK_LAYER, stock_layer_16 },
|
||||
{ GIMP_STOCK_TEXT_LAYER, stock_text_layer_16 },
|
||||
{ GIMP_STOCK_TEMPLATE, stock_template_16 },
|
||||
|
||||
{ GIMP_STOCK_LINKED, stock_linked_12 },
|
||||
{ GIMP_STOCK_VISIBLE, stock_eye_12 },
|
||||
|
@ -486,7 +489,9 @@ gimp_stock_dialog_pixbufs[] =
|
|||
{ GIMP_STOCK_QUESTION, stock_question_64 },
|
||||
{ GIMP_STOCK_WARNING, stock_warning_64 },
|
||||
{ GIMP_STOCK_WILBER, stock_wilber_64 },
|
||||
{ GIMP_STOCK_WILBER_EEK, stock_wilber_eek_64 }
|
||||
{ GIMP_STOCK_WILBER_EEK, stock_wilber_eek_64 },
|
||||
|
||||
{ GIMP_STOCK_TEXTURE, stock_texture_64 }
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
@ -142,6 +142,7 @@ G_BEGIN_DECLS
|
|||
#define GIMP_STOCK_CHANNEL_BLUE "gimp-channel-blue"
|
||||
#define GIMP_STOCK_CHANNEL_GRAY "gimp-channel-gray"
|
||||
#define GIMP_STOCK_CHANNEL_ALPHA "gimp-channel-alpha"
|
||||
#define GIMP_STOCK_TEMPLATE "gimp-template"
|
||||
|
||||
#define GIMP_STOCK_IMAGES "gimp-images"
|
||||
#define GIMP_STOCK_LAYERS "gimp-layers"
|
||||
|
@ -174,6 +175,7 @@ G_BEGIN_DECLS
|
|||
#define GIMP_STOCK_WARNING "gimp-warning"
|
||||
#define GIMP_STOCK_WILBER "gimp-wilber"
|
||||
#define GIMP_STOCK_WILBER_EEK "gimp-wilber-eek"
|
||||
#define GIMP_STOCK_TEXTURE "gimp-texture"
|
||||
|
||||
|
||||
void gimp_stock_init (void);
|
||||
|
|
|
@ -62,6 +62,7 @@ STOCK_MENU_IMAGES = \
|
|||
stock-selection-none-16.png \
|
||||
stock-selection-shrink-16.png \
|
||||
stock-swap-colors-12.png \
|
||||
stock-template-16.png \
|
||||
stock-text-layer-16.png \
|
||||
stock-tool-options-16.png \
|
||||
stock-warning-16.png \
|
||||
|
@ -148,6 +149,7 @@ STOCK_DIALOG_IMAGES = \
|
|||
stock-layer-48.png \
|
||||
stock-question-64.png \
|
||||
stock-text-layer-48.png \
|
||||
stock-texture-64.png \
|
||||
stock-warning-64.png \
|
||||
stock-wilber-64.png \
|
||||
stock-wilber-eek-64.png
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 499 B |
Binary file not shown.
After Width: | Height: | Size: 198 B |
Loading…
Reference in New Issue