Commit b8798408 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

g_strdup() the stock_id passed to gimp_tool_info_new() because the

2002-03-14  Michael Natterer  <mitch@gimp.org>

	* app/core/gimptoolinfo.c: g_strdup() the stock_id passed to
	gimp_tool_info_new() because the caller's memory may disappear
	after registering the tool (tool modules).

	Made a GimpDock out of the toolbox:

	* app/gui/Makefile.am
	* app/gui/color-area.[ch]
	* app/gui/indicator-area.[ch]
	* app/gui/toolbox.[ch]: removed...

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimptoolbox-color-area.[ch]
	* app/widgets/gimptoolbox-indicator-area.[ch]
	* app/widgets/gimptoolbox.[ch]: ...and added here.

	* app/widgets/gimpdock.[ch]: don't set a minimal width. Added a
	"destroy_if_empty" boolean so we can prevent destruction of the
	toolbox if it's last dockable is removed. Added gimp_dock_construct()
	which is called from GimpImageDock and GimpToolbox.

	* app/widgets/gimpimagedock.[ch]: Default to not showing the image
	menu, set a minimal width here, misc. minor cleanup.

	* app/widgets/gimpdockbook.c: some more GIMP_IS_IMAGE_DOCK()
	checks, fixed dnd widget creation.

	* app/widgets/gimpdialogfactory.[ch]: changed
	gimp_dialog_factories_toggle() to take just the toolbox_factory as
	parameter. When restoring the session use the created dock's
	dialog factory to create dockables, not the the factory we
	created the dock from (for the toolbox).

	* app/display/gimpdisplayshell-callbacks.c: changed accordingly.

	* app/gui/dialogs.[ch]: create an own dialog factory for the toolbox
	and set dialogs_toolbox_new() as it's new_dock_func.

	* app/gui/dialogs-constructors.[ch]: changed dialogs_toolbox_get()
	accordingly.

	* app/gui/dialogs-commands.[ch]: added dialogs_show_toolbox(), ckeck
	if a dock is really a GimpImageDock before casting.

	* app/gui/gui.c
	* app/gui/menus.c
	* app/widgets/gimppaletteeditor.c: changed accordingly.

	* app/gui/color-notebook.c
	* app/gui/color-select.c
	* app/gui/colormap-dialog.c
	* app/gui/palette-editor-commands.c: removed useless inclusion of
	"gui/color-area.h".

	* themes/Default/gtkrc: set "gimp-dock-style" for GimpToolbox widgets.
parent d3a0e1a4
2002-03-14 Michael Natterer <mitch@gimp.org>
* app/core/gimptoolinfo.c: g_strdup() the stock_id passed to
gimp_tool_info_new() because the caller's memory may disappear
after registering the tool (tool modules).
Made a GimpDock out of the toolbox:
* app/gui/Makefile.am
* app/gui/color-area.[ch]
* app/gui/indicator-area.[ch]
* app/gui/toolbox.[ch]: removed...
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimptoolbox-color-area.[ch]
* app/widgets/gimptoolbox-indicator-area.[ch]
* app/widgets/gimptoolbox.[ch]: ...and added here.
* app/widgets/gimpdock.[ch]: don't set a minimal width. Added a
"destroy_if_empty" boolean so we can prevent destruction of the
toolbox if it's last dockable is removed. Added gimp_dock_construct()
which is called from GimpImageDock and GimpToolbox.
* app/widgets/gimpimagedock.[ch]: Default to not showing the image
menu, set a minimal width here, misc. minor cleanup.
* app/widgets/gimpdockbook.c: some more GIMP_IS_IMAGE_DOCK()
checks, fixed dnd widget creation.
* app/widgets/gimpdialogfactory.[ch]: changed
gimp_dialog_factories_toggle() to take just the toolbox_factory as
parameter. When restoring the session use the created dock's
dialog factory to create dockables, not the the factory we
created the dock from (for the toolbox).
* app/display/gimpdisplayshell-callbacks.c: changed accordingly.
* app/gui/dialogs.[ch]: create an own dialog factory for the toolbox
and set dialogs_toolbox_new() as it's new_dock_func.
* app/gui/dialogs-constructors.[ch]: changed dialogs_toolbox_get()
accordingly.
* app/gui/dialogs-commands.[ch]: added dialogs_show_toolbox(), ckeck
if a dock is really a GimpImageDock before casting.
* app/gui/gui.c
* app/gui/menus.c
* app/widgets/gimppaletteeditor.c: changed accordingly.
* app/gui/color-notebook.c
* app/gui/color-select.c
* app/gui/colormap-dialog.c
* app/gui/palette-editor-commands.c: removed useless inclusion of
"gui/color-area.h".
* themes/Default/gtkrc: set "gimp-dock-style" for GimpToolbox widgets.
2002-03-13 Manish Singh <yosh@gimp.org>
* tools/pdbgen/lib.pl: autogenerated libgimp/gimp_pdb.h
......
......@@ -36,6 +36,14 @@
#include "dialogs-commands.h"
void
dialogs_show_toolbox_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
dialogs_show_toolbox ();
}
void
dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
gpointer data,
......@@ -86,10 +94,11 @@ dialogs_add_tab_cmd_callback (GtkWidget *widget,
if (identifier)
{
dockable = gimp_dialog_factory_dockable_new (dockbook->dock->factory,
dockbook->dock,
identifier,
-1);
dockable =
gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory,
dockbook->dock,
identifier,
-1);
/* Maybe gimp_dialog_factory_dockable_new() returned an already
* existing singleton dockable, so check if it already is
......@@ -187,7 +196,7 @@ dialogs_toggle_view_cmd_callback (GtkWidget *widget,
preview_size = old_view->preview_size;
new_dockable =
gimp_dialog_factory_dockable_new (dockbook->dock->factory,
gimp_dialog_factory_dockable_new (dockbook->dock->dialog_factory,
dockbook->dock,
identifier,
preview_size);
......@@ -262,7 +271,7 @@ dialogs_toggle_image_menu_cmd_callback (GtkWidget *widget,
dockbook = (GimpDockbook *) gtk_item_factory_popup_data_from_widget (widget);
if (dockbook)
if (dockbook && GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
......@@ -278,7 +287,7 @@ dialogs_toggle_auto_cmd_callback (GtkWidget *widget,
dockbook = (GimpDockbook *) gtk_item_factory_popup_data_from_widget (widget);
if (dockbook)
if (dockbook && GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
gimp_image_dock_set_auto_follow_active (GIMP_IMAGE_DOCK (dockbook->dock),
GTK_CHECK_MENU_ITEM (widget)->active);
......@@ -305,6 +314,8 @@ dialogs_create_lc_cmd_callback (GtkWidget *widget,
dock = gimp_dialog_factory_dock_new (global_dock_factory);
gimp_image_dock_set_show_image_menu (GIMP_IMAGE_DOCK (dock), TRUE);
dockbook = gimp_dockbook_new ();
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
......@@ -360,6 +371,38 @@ dialogs_create_stuff_cmd_callback (GtkWidget *widget,
gtk_widget_show (dock);
}
void
dialogs_show_toolbox (void)
{
if (! global_toolbox_factory->open_dialogs)
{
GtkWidget *toolbox;
toolbox = gimp_dialog_factory_dock_new (global_toolbox_factory);
gtk_widget_show (toolbox);
}
else
{
GList *list;
for (list = global_toolbox_factory->open_dialogs;
list;
list = g_list_next (list))
{
if (GTK_WIDGET_TOPLEVEL (list->data))
{
if (GTK_WIDGET_VISIBLE (list->data))
gtk_widget_show (GTK_WIDGET (list->data));
else
gdk_window_raise (GTK_WIDGET (list->data)->window);
break;
}
}
}
}
void
dialogs_menu_update (GtkItemFactory *factory,
gpointer data)
......@@ -400,6 +443,8 @@ dialogs_menu_update (GtkItemFactory *factory,
#define SET_ACTIVE(path,active) \
gimp_item_factory_set_active (factory, (path), (active))
#define SET_VISIBLE(path,active) \
gimp_item_factory_set_visible (factory, (path), (active))
if (preview_size >= GIMP_PREVIEW_SIZE_GIGANTIC)
{
......@@ -447,11 +492,25 @@ dialogs_menu_update (GtkItemFactory *factory,
SET_ACTIVE ("/View as List", TRUE);
}
SET_ACTIVE ("/Show Image Menu",
GIMP_IMAGE_DOCK (dockbook->dock)->show_image_menu);
SET_ACTIVE ("/Auto Follow Active Image",
GIMP_IMAGE_DOCK (dockbook->dock)->auto_follow_active);
if (GIMP_IS_IMAGE_DOCK (dockbook->dock))
{
SET_VISIBLE ("/image-menu-separator", TRUE);
SET_VISIBLE ("/Show Image Menu", TRUE);
SET_VISIBLE ("/Auto Follow Active Image", TRUE);
SET_ACTIVE ("/Show Image Menu",
GIMP_IMAGE_DOCK (dockbook->dock)->show_image_menu);
SET_ACTIVE ("/Auto Follow Active Image",
GIMP_IMAGE_DOCK (dockbook->dock)->auto_follow_active);
}
else
{
SET_VISIBLE ("/image-menu-separator", FALSE);
SET_VISIBLE ("/Show Image Menu", FALSE);
SET_VISIBLE ("/Auto Follow Active Image", FALSE);
}
#undef SET_ACTIVE
#undef SET_VISIBLE
}
}
......@@ -20,6 +20,9 @@
#define __DIALOGS_COMMANDS_H__
void dialogs_show_toolbox_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
......@@ -55,6 +58,8 @@ void dialogs_create_stuff_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_show_toolbox (void);
void dialogs_menu_update (GtkItemFactory *factory,
gpointer data);
......
......@@ -31,8 +31,8 @@
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimptoolbox-color-area.h"
#include "color-area.h"
#include "color-notebook.h"
#include "palette-editor-commands.h"
......
......@@ -150,6 +150,11 @@ gimp_tool_info_finalize (GObject *object)
tool_info->help_data = NULL;
}
if (tool_info->stock_id)
{
g_object_unref (G_OBJECT (tool_info->stock_id));
tool_info->stock_id = NULL;
}
if (tool_info->stock_pixbuf)
{
g_object_unref (G_OBJECT (tool_info->stock_pixbuf));
......@@ -284,7 +289,7 @@ gimp_tool_info_new (Gimp *gimp,
tool_info->help_domain = g_strdup (help_domain);
tool_info->help_data = g_strdup (help_data);
tool_info->stock_id = stock_id;
tool_info->stock_id = g_strdup (stock_id);
tool_info->stock_pixbuf = stock_pixbuf;
if (stock_pixbuf)
......
......@@ -34,7 +34,6 @@
#include "gui-types.h"
#include "color-area.h"
#include "color-notebook.h"
#include "libgimp/gimpintl.h"
......
......@@ -56,13 +56,14 @@
#include "widgets/gimplistitem.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimppreview.h"
#include "widgets/gimptoolbox.h"
#include "widgets/gimptoolbox-color-area.h"
#include "widgets/gimpvectorslistview.h"
#include "about-dialog.h"
#include "brushes-commands.h"
#include "buffers-commands.h"
#include "channels-commands.h"
#include "color-area.h"
#include "colormap-dialog.h"
#include "device-status-dialog.h"
#include "dialogs.h"
......@@ -79,7 +80,6 @@
#include "preferences-dialog.h"
#include "tips-dialog.h"
#include "tool-options-dialog.h"
#include "toolbox.h"
#include "vectors-commands.h"
#include "gimprc.h"
......@@ -148,14 +148,6 @@ static void dialogs_indexed_palette_image_changed (GimpContext *context,
/* toplevel dialogs */
/**********************/
GtkWidget *
dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
return toolbox_create (context->gimp);
}
GtkWidget *
dialogs_device_status_get (GimpDialogFactory *factory,
GimpContext *context,
......@@ -248,6 +240,18 @@ dialogs_about_get (GimpDialogFactory *factory,
/* docks */
/***********/
GtkWidget *
dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
/* we pass "global_dock_factory", _not_ "global_toolbox_factory" to
* the toolbox constructor, because the toolbox_factory has no
* dockables registered
*/
return gimp_toolbox_new (global_dock_factory, context->gimp);
}
GtkWidget *
dialogs_dock_new (GimpDialogFactory *factory,
GimpContext *context,
......
......@@ -22,9 +22,6 @@
/* toplevel dialogs */
GtkWidget * dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_device_status_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......@@ -48,12 +45,18 @@ GtkWidget * dialogs_about_get (GimpDialogFactory *factory,
gint preview_size);
/* docks & dockables */
/* docks */
GtkWidget * dialogs_toolbox_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_dock_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
/* dockables */
GtkWidget * dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......
......@@ -32,13 +32,13 @@
#include "dialogs-constructors.h"
GimpDialogFactory *global_dialog_factory = NULL;
GimpDialogFactory *global_dock_factory = NULL;
GimpDialogFactory *global_dialog_factory = NULL;
GimpDialogFactory *global_dock_factory = NULL;
GimpDialogFactory *global_toolbox_factory = NULL;
static const GimpDialogFactoryEntry toplevel_entries[] =
{
{ "gimp:toolbox", dialogs_toolbox_get, 32, TRUE, TRUE, TRUE, TRUE },
{ "gimp:device-status-dialog", dialogs_device_status_get, 32, TRUE, TRUE, FALSE, TRUE },
{ "gimp:preferences-dialog", dialogs_preferences_get, 32, TRUE, FALSE, FALSE, TRUE },
{ "gimp:module-browser-dialog", dialogs_module_browser_get, 32, TRUE, FALSE, FALSE, TRUE },
......@@ -95,6 +95,11 @@ dialogs_init (Gimp *gimp)
NULL,
NULL);
global_toolbox_factory = gimp_dialog_factory_new ("toolbox",
gimp_get_user_context (gimp),
NULL,
dialogs_toolbox_get);
global_dock_factory = gimp_dialog_factory_new ("dock",
gimp_get_user_context (gimp),
gimp_item_factory_from_path ("<Dialogs>"),
......@@ -130,6 +135,18 @@ dialogs_exit (Gimp *gimp)
global_dialog_factory = NULL;
}
/* destroy the "global_toolbox_factory" _before_ destroying the
* "global_dock_factory" because the "global_toolbox_factory" owns
* dockables which were created by the "global_dock_factory". This
* way they are properly removed from the "global_dock_factory", which
* would complain about stale entries otherwise.
*/
if (global_toolbox_factory)
{
g_object_unref (G_OBJECT (global_toolbox_factory));
global_toolbox_factory = NULL;
}
if (global_dock_factory)
{
g_object_unref (G_OBJECT (global_dock_factory));
......
......@@ -22,6 +22,7 @@
extern GimpDialogFactory *global_dialog_factory;
extern GimpDialogFactory *global_dock_factory;
extern GimpDialogFactory *global_toolbox_factory;
void dialogs_init (Gimp *gimp);
......
......@@ -837,8 +837,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
{
/* Hide or show all dialogs */
gimp_dialog_factories_toggle (global_dialog_factory,
"gimp:toolbox");
gimp_dialog_factories_toggle (global_toolbox_factory);
}
return_val = TRUE;
......
......@@ -14,8 +14,6 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
buffers-commands.h \
channels-commands.c \
channels-commands.h \
color-area.c \
color-area.h \
color-notebook.c \
color-notebook.h \
color-select.c \
......@@ -65,8 +63,6 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
gui-types.h \
image-commands.c \
image-commands.h \
indicator-area.c \
indicator-area.h \
info-dialog.c \
info-dialog.h \
info-window.c \
......@@ -115,8 +111,6 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
tips-parser.h \
tool-options-dialog.c \
tool-options-dialog.h \
toolbox.c \
toolbox.h \
tools-commands.c \
tools-commands.h \
user-install-dialog.c \
......
/* The GIMP -- an 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 <stdio.h>
#include <string.h> /* memcpy */
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "widgets/gimpdnd.h"
#include "color-area.h"
#include "color-notebook.h"
#ifdef DISPLAY_FILTERS
#include "gdisplay_color.h"
#endif /* DISPLAY_FILTERS */
#include "libgimp/gimpintl.h"
typedef enum
{
FORE_AREA,
BACK_AREA,
SWAP_AREA,
DEF_AREA,
INVALID_AREA
} ColorAreaTarget;
/* local function prototypes */
static ColorAreaTarget color_area_target (gint x,
gint y);
static void color_area_draw_rect (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
guchar r,
guchar g,
guchar b);
static void color_area_draw (GimpContext *context);
static void color_area_select_callback (ColorNotebook *color_notebook,
const GimpRGB *color,
ColorNotebookState state,
gpointer data);
static void color_area_edit (GimpContext *context);
static gint color_area_events (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void color_area_realize (GtkWidget *widget,
gpointer data);
static void color_area_drop_color (GtkWidget *widget,
const GimpRGB *color,
gpointer data);
static void color_area_drag_color (GtkWidget *widget,
GimpRGB *color,
gpointer data);
static void color_area_color_changed (GimpContext *context,
GimpRGB *color,
gpointer data);
/* Global variables */
gint active_color = FOREGROUND;
GimpDisplay *color_area_gdisp = NULL;
/* Static variables */
static GdkGC *color_area_gc = NULL;
static GdkGC *mask_gc = NULL;
static GtkWidget *color_area = NULL;
static GdkPixmap *color_area_pixmap = NULL;
static GdkBitmap *color_area_mask = NULL;
static GdkPixmap *default_pixmap = NULL;
static GdkBitmap *default_mask = NULL;
static GdkPixmap *swap_pixmap = NULL;
static GdkBitmap *swap_mask = NULL;
static ColorNotebook *color_notebook = NULL;
static gboolean color_notebook_active = FALSE;
static gint edit_color;
static GimpRGB revert_fg;
static GimpRGB revert_bg;
/* dnd stuff */
static GtkTargetEntry color_area_target_table[] =
{
GIMP_TARGET_COLOR
};
/* public functions */
GtkWidget *
color_area_create (GimpContext *context,
gint width,
gint height,
GdkPixmap *default_pmap,
GdkBitmap *default_msk,
GdkPixmap *swap_pmap,
GdkBitmap *swap_msk)
{
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
color_area = gtk_drawing_area_new ();
gtk_widget_set_size_request (color_area, width, height);
gtk_widget_set_events (color_area,
GDK_EXPOSURE_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
#ifndef GDK_WINDOWING_DIRECTFB
g_signal_connect (G_OBJECT (color_area), "event",
G_CALLBACK (color_area_events),
context);
#endif
g_signal_connect (G_OBJECT (color_area), "realize",
G_CALLBACK (color_area_realize),
context);
default_pixmap = default_pmap;
default_mask = default_msk;
swap_pixmap = swap_pmap;
swap_mask = swap_msk;
/* dnd stuff */
gtk_drag_source_set (color_area,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
color_area_target_table,
G_N_ELEMENTS (color_area_target_table),
GDK_ACTION_COPY | GDK_ACTION_MOVE);
gimp_dnd_color_source_set (color_area, color_area_drag_color, context);
gtk_drag_dest_set (color_area,
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_DROP,
color_area_target_table,
G_N_ELEMENTS (color_area_target_table),
GDK_ACTION_COPY);
gimp_dnd_color_dest_set (color_area, color_area_drop_color, context);
g_signal_connect (G_OBJECT (context), "foreground_changed",
G_CALLBACK (color_area_color_changed),
color_area);
g_signal_connect (G_OBJECT (context), "background_changed",
G_CALLBACK (color_area_color_changed),
color_area);
#ifdef DISPLAY_FILTERS
/* display filter dummy gdisplay */
color_area_gdisp = g_new (GimpDisplay, 1);
color_area_gdisp->cd_list = NULL;
color_area_gdisp->cd_ui = NULL;
color_area_gdisp->gimage = g_new (GimpImage, 1);
color_area_gdisp->gimage->base_type = RGB;
#endif /* DISPLAY_FILTERS */
return color_area;
}
/* private functions */
static ColorAreaTarget
color_area_target (gint x,
gint y)
{
gint rect_w, rect_h;
gint width, height;
gdk_drawable_get_size (color_area_pixmap, &width, &height);
rect_w = width * 0.65;
rect_h = height * 0.65;
/* foreground active */
if (x > 0 && x < rect_w &&
y > 0 && y < rect_h)
return FORE_AREA;
else if (x > (width - rect_w) && x < width &&
y > (height - rect_h) && y < height)
return BACK_AREA;
else if (x > 0 && x < (width - rect_w) &&
y > rect_h && y < height)
return DEF_AREA;
else if (x > rect_w && x < width &&
y > 0 && y < (height - rect_h))
return SWAP_AREA;
else
return -1;
}
static void
color_area_draw_rect (GdkDrawable *drawable,
GdkGC *gc,
gint x,
gint y,
gint width,
gint height,
guchar r,
guchar g,
guchar b)
{
static guchar *color_area_rgb_buf = NULL;
static gint color_area_rgb_buf_size;
static gint rowstride;
gint xx, yy;
guchar *bp;
#ifdef DISPLAY_FILTERS
GList *list;
#endif /* DISPLAY_FILTERS */
rowstride = 3 * ((width + 3) & -4);
if (color_area_rgb_buf == NULL ||
color_area_rgb_buf_size < height * rowstride)
{
if (color_area_rgb_buf)
g_free (color_area_rgb_buf);
color_area_rgb_buf =
g_malloc (color_area_rgb_buf_size = rowstride * height);
}
bp = color_area_rgb_buf;
for (xx = 0; xx < width; xx++)
{
*bp++ = r;
*bp++ = g;
*bp++ = b;
}
bp = color_area_rgb_buf;
#ifdef DISPLAY_FILTERS
for (list = color_area_gdisp->cd_list; list; list = g_list_next (list))
{
ColorDisplayNode *node = (ColorDisplayNode *) list->data;
node->cd_convert (node->cd_ID, bp, width, 1, 3, rowstride);
}
#endif /* DISPLAY_FILTERS */
for (yy = 1; yy < height; yy++)
{
bp += rowstride;
memcpy (bp, color_area_rgb_buf, rowstride);
}
gdk_draw_rgb_image (drawable, gc, x, y, width, height,
GDK_RGB_DITHER_MAX,
color_area_rgb_buf,
rowstride);
}