app/Makefile.am taken behind the curtain and shot. (famous words of Seth

2001-05-11  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/lc_dialog.[ch]: taken behind the curtain and shot.
	(famous words of Seth Burgess on #gimp)

	* app/app_procs.c
	* app/gdisplay.c
	* app/gimage.c
	* app/gui/commands.c
	* app/gui/gui.c
	* app/gui/menus.c
	* app/gui/preferences-dialog.c: don't #include it or call it's
	functions any more.

	* app/gui/dialogs-commands.[ch]: added a constructor for a dock
	which looks like the old L&C dialog (taken from test-commands.*)

	* app/gui/test-commands.[ch]: removed here.

	* app/gui/dialogs-constructors.[ch]: wrapped the old
	paths-dialog.* stuff in a dockable which can be created only
	once. Will go away as soon as the new path stuff is there.

	* app/gui/dialogs.c: added the paths dockable, removed lc_dialog.

	* app/gui/paths-dialog.c: some changes to make it work without the
	lc_dialog around it. Will probably crash randomly and refuse to
	update it's contents properly (scheduled for removal).
This commit is contained in:
Michael Natterer 2001-05-11 17:02:30 +00:00 committed by Michael Natterer
parent 02b52b70f0
commit 3bd0b97ec3
31 changed files with 301 additions and 966 deletions

View File

@ -1,3 +1,33 @@
2001-05-11 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/lc_dialog.[ch]: taken behind the curtain and shot.
(famous words of Seth Burgess on #gimp)
* app/app_procs.c
* app/gdisplay.c
* app/gimage.c
* app/gui/commands.c
* app/gui/gui.c
* app/gui/menus.c
* app/gui/preferences-dialog.c: don't #include it or call it's
functions any more.
* app/gui/dialogs-commands.[ch]: added a constructor for a dock
which looks like the old L&C dialog (taken from test-commands.*)
* app/gui/test-commands.[ch]: removed here.
* app/gui/dialogs-constructors.[ch]: wrapped the old
paths-dialog.* stuff in a dockable which can be created only
once. Will go away as soon as the new path stuff is there.
* app/gui/dialogs.c: added the paths dockable, removed lc_dialog.
* app/gui/paths-dialog.c: some changes to make it work without the
lc_dialog around it. Will probably crash randomly and refuse to
update it's contents properly (scheduled for removal).
2001-05-11 Michael Natterer <mitch@gimp.org>
* app/gui/Makefile.am

View File

@ -39,8 +39,6 @@ gimp_SOURCES = \
gimpprogress.h \
gimpui.c \
gimpui.h \
lc_dialog.c \
lc_dialog.h \
nav_window.c \
nav_window.h \
ops_buttons.c \

View File

@ -89,3 +89,36 @@ dialogs_remove_tab_cmd_callback (GtkWidget *widget,
gimp_dockbook_remove (dockbook, dockable);
}
}
void
dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GtkWidget *dock;
GtkWidget *dockbook;
GtkWidget *dockable;
dock = gimp_dialog_factory_dock_new (global_dock_factory);
dockbook = gimp_dockbook_new ();
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
"gimp:layer-list");
if (dockable)
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
"gimp:channel-list");
if (dockable)
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
"gimp:path-list");
if (dockable)
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
gtk_widget_show (dock);
}

View File

@ -31,5 +31,9 @@ void dialogs_remove_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __DIALOGS_COMMANDS_H__ */

View File

@ -62,7 +62,6 @@
#include "global_edit.h"
#include "image_render.h"
#include "nav_window.h"
#include "lc_dialog.h"
#include "plug_in.h"
#include "resize.h"
#include "scale.h"
@ -1076,7 +1075,6 @@ image_resize_callback (GtkWidget *widget,
image_resize->resize->offset_x,
image_resize->resize->offset_y);
gdisplays_flush ();
lc_dialog_update_image_list ();
}
else
{

View File

@ -72,7 +72,6 @@
#include "gimprc.h"
#include "gimpparasite.h"
#include "global_edit.h"
#include "lc_dialog.h"
#include "plug_in.h"
#include "module_db.h"

View File

@ -44,7 +44,6 @@
#include "gdisplay_ops.h"
#include "gui/info-window.h"
#include "interface.h"
#include "lc_dialog.h"
#include "gui/menus.h"
#include "nav_window.h"
@ -222,8 +221,6 @@ gdisplay_new (GimpImage *gimage,
gtk_object_ref (GTK_OBJECT (gimage));
gtk_object_sink (GTK_OBJECT (gimage));
lc_dialog_preview_update (gimage);
/* We're interested in clean and dirty signals so we can update the
* title if need be. */
gtk_signal_connect (GTK_OBJECT (gimage), "dirty",
@ -2553,9 +2550,6 @@ gdisplays_flush_whenever (gboolean now)
gdisplay_flush_whenever ((GDisplay *) list->data, now);
}
/* for convenience, we call the L&C flush here */
lc_dialog_flush ();
flushing = FALSE;
}

View File

@ -25,6 +25,7 @@
#include "apptypes.h"
#include "widgets/widgets-types.h"
#include "tools/tools-types.h" /* FIXME: remove as soon as paths-dialog.* is gone */
#include "core/gimpbrushgenerated.h"
#include "core/gimpchannel.h"
@ -62,8 +63,8 @@
#include "gradient-editor.h"
#include "gradient-select.h"
#include "layers-commands.h"
#include "lc_dialog.h"
#include "palette-editor.h"
#include "paths-dialog.h"
#include "pattern-select.h"
#include "preferences-dialog.h"
#include "tips-dialog.h"
@ -107,6 +108,8 @@ static void dialogs_set_data_context_func (GimpDockable *dockable,
GimpContext *context);
static void dialogs_set_drawable_context_func (GimpDockable *dockable,
GimpContext *context);
static void dialogs_set_path_context_func (GimpDockable *dockable,
GimpContext *context);
static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
const gchar *name,
@ -117,6 +120,9 @@ static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
static void dialogs_drawable_view_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDrawableListView *view);
static void dialogs_path_view_image_changed (GimpContext *context,
GimpImage *gimage,
GtkWidget *view);
static gchar * dialogs_tool_name_func (GtkWidget *widget);
@ -130,17 +136,6 @@ dialogs_toolbox_get (GimpDialogFactory *factory,
return toolbox_create ();
}
GtkWidget *
dialogs_lc_get (GimpDialogFactory *factory,
GimpContext *context)
{
GDisplay *gdisp;
gdisp = gimp_context_get_display (context);
return lc_dialog_create (gdisp ? gdisp->gimage : NULL);
}
GtkWidget *
dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context)
@ -605,6 +600,33 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
return dockable;
}
GtkWidget *
dialogs_path_list_view_new (GimpDialogFactory *factory,
GimpContext *context)
{
static GtkWidget *view = NULL;
GtkWidget *dockable;
if (view)
return NULL;
view = paths_dialog_create ();
gtk_signal_connect (GTK_OBJECT (view), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&view);
dockable = dialogs_dockable_new (view,
"Path List", "Paths",
NULL,
dialogs_set_path_context_func);
dialogs_set_path_context_func (GIMP_DOCKABLE (dockable), context);
return dockable;
}
/* editor dialogs */
@ -871,6 +893,48 @@ dialogs_set_drawable_context_func (GimpDockable *dockable,
}
}
static void
dialogs_set_path_context_func (GimpDockable *dockable,
GimpContext *context)
{
GtkWidget *view;
view = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dockable),
"gimp-dialogs-view");
if (view)
{
GimpContext *old_context;
old_context = (GimpContext *) gtk_object_get_data (GTK_OBJECT (view),
"gimp-dialogs-context");
if (old_context)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (old_context),
GTK_SIGNAL_FUNC (dialogs_path_view_image_changed),
view);
}
if (context)
{
gtk_signal_connect (GTK_OBJECT (context), "image_changed",
GTK_SIGNAL_FUNC (dialogs_path_view_image_changed),
view);
dialogs_path_view_image_changed (context,
gimp_context_get_image (context),
view);
}
else
{
dialogs_path_view_image_changed (NULL, NULL, view);
}
gtk_object_set_data (GTK_OBJECT (view), "gimp-dialogs-context", context);
}
}
static GtkWidget *
dialogs_dockable_new (GtkWidget *widget,
const gchar *name,
@ -900,6 +964,14 @@ dialogs_drawable_view_image_changed (GimpContext *context,
gimp_drawable_list_view_set_image (view, gimage);
}
static void
dialogs_path_view_image_changed (GimpContext *context,
GimpImage *gimage,
GtkWidget *widget)
{
paths_dialog_update (gimage);
}
static gchar *
dialogs_tool_name_func (GtkWidget *widget)
{

View File

@ -90,6 +90,8 @@ GtkWidget * dialogs_layer_list_view_new (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_channel_list_view_new (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
GimpContext *context);
void dialogs_edit_brush_func (GimpData *data);
void dialogs_edit_gradient_func (GimpData *data);

View File

@ -39,7 +39,6 @@ GimpDialogFactory *global_dock_factory = NULL;
static const GimpDialogFactoryEntry toplevel_entries[] =
{
{ "gimp:toolbox", dialogs_toolbox_get, TRUE, TRUE, TRUE },
{ "gimp:lc-dialog", dialogs_lc_get, TRUE, TRUE, TRUE },
{ "gimp:tool-options-dialog", dialogs_tool_options_get, TRUE, TRUE, FALSE },
{ "gimp:device-status-dialog", dialogs_device_status_get, TRUE, TRUE, FALSE },
{ "gimp:brush-select-dialog", dialogs_brush_select_get, TRUE, TRUE, FALSE },
@ -76,7 +75,8 @@ static const GimpDialogFactoryEntry dock_entries[] =
{ "gimp:tool-grid", dialogs_tool_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:layer-list", dialogs_layer_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE }
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:path-list", dialogs_path_list_view_new, TRUE, FALSE, FALSE }
};
static const gint n_dock_entries = (sizeof (dock_entries) /
sizeof (dock_entries[0]));

View File

@ -42,7 +42,6 @@
#include "gimphelp.h"
#include "gimprc.h"
#include "image_render.h"
#include "lc_dialog.h"
#include "resolution_calibrate.h"
#include "tile_cache.h"
@ -883,7 +882,7 @@ prefs_cancel_callback (GtkWidget *widget,
/* restore variables which need some magic */
if (preview_size != old_preview_size)
{
lc_dialog_rebuild (old_preview_size);
/* lc_dialog_rebuild (old_preview_size); FIXME: update preview size */
layer_select_update_preview_size ();
}
if (nav_preview_size != old_nav_preview_size)
@ -1018,7 +1017,9 @@ static void
prefs_preview_size_callback (GtkWidget *widget,
gpointer data)
{
lc_dialog_rebuild ((long) gtk_object_get_user_data (GTK_OBJECT (widget)));
/* FIXME: update preview size
lc_dialog_rebuild ((long) gtk_object_get_user_data (GTK_OBJECT (widget)));
*/
layer_select_update_preview_size ();
}

View File

@ -44,7 +44,6 @@
#include "gdisplay_ops.h"
#include "gui/info-window.h"
#include "interface.h"
#include "lc_dialog.h"
#include "gui/menus.h"
#include "nav_window.h"
@ -222,8 +221,6 @@ gdisplay_new (GimpImage *gimage,
gtk_object_ref (GTK_OBJECT (gimage));
gtk_object_sink (GTK_OBJECT (gimage));
lc_dialog_preview_update (gimage);
/* We're interested in clean and dirty signals so we can update the
* title if need be. */
gtk_signal_connect (GTK_OBJECT (gimage), "dirty",
@ -2553,9 +2550,6 @@ gdisplays_flush_whenever (gboolean now)
gdisplay_flush_whenever ((GDisplay *) list->data, now);
}
/* for convenience, we call the L&C flush here */
lc_dialog_flush ();
flushing = FALSE;
}

View File

@ -44,7 +44,6 @@
#include "gdisplay_ops.h"
#include "gui/info-window.h"
#include "interface.h"
#include "lc_dialog.h"
#include "gui/menus.h"
#include "nav_window.h"
@ -222,8 +221,6 @@ gdisplay_new (GimpImage *gimage,
gtk_object_ref (GTK_OBJECT (gimage));
gtk_object_sink (GTK_OBJECT (gimage));
lc_dialog_preview_update (gimage);
/* We're interested in clean and dirty signals so we can update the
* title if need be. */
gtk_signal_connect (GTK_OBJECT (gimage), "dirty",
@ -2553,9 +2550,6 @@ gdisplays_flush_whenever (gboolean now)
gdisplay_flush_whenever ((GDisplay *) list->data, now);
}
/* for convenience, we call the L&C flush here */
lc_dialog_flush ();
flushing = FALSE;
}

View File

@ -33,7 +33,6 @@
#include "dialog_handler.h"
#include "gdisplay.h"
#include "lc_dialog.h"
#include "gui/palette-import-dialog.h"
#include "context_manager.h"
@ -152,7 +151,6 @@ static void
gimage_rename_handler (GimpImage *gimage)
{
gdisplays_update_title (gimage);
lc_dialog_update_image_list ();
palette_import_image_renamed (gimage);
}

View File

@ -62,7 +62,6 @@
#include "global_edit.h"
#include "image_render.h"
#include "nav_window.h"
#include "lc_dialog.h"
#include "plug_in.h"
#include "resize.h"
#include "scale.h"
@ -1076,7 +1075,6 @@ image_resize_callback (GtkWidget *widget,
image_resize->resize->offset_x,
image_resize->resize->offset_y);
gdisplays_flush ();
lc_dialog_update_image_list ();
}
else
{

View File

@ -89,3 +89,36 @@ dialogs_remove_tab_cmd_callback (GtkWidget *widget,
gimp_dockbook_remove (dockbook, dockable);
}
}
void
dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GtkWidget *dock;
GtkWidget *dockbook;
GtkWidget *dockable;
dock = gimp_dialog_factory_dock_new (global_dock_factory);
dockbook = gimp_dockbook_new ();
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
"gimp:layer-list");
if (dockable)
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
"gimp:channel-list");
if (dockable)
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
"gimp:path-list");
if (dockable)
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
gtk_widget_show (dock);
}

View File

@ -31,5 +31,9 @@ void dialogs_remove_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_lc_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __DIALOGS_COMMANDS_H__ */

View File

@ -25,6 +25,7 @@
#include "apptypes.h"
#include "widgets/widgets-types.h"
#include "tools/tools-types.h" /* FIXME: remove as soon as paths-dialog.* is gone */
#include "core/gimpbrushgenerated.h"
#include "core/gimpchannel.h"
@ -62,8 +63,8 @@
#include "gradient-editor.h"
#include "gradient-select.h"
#include "layers-commands.h"
#include "lc_dialog.h"
#include "palette-editor.h"
#include "paths-dialog.h"
#include "pattern-select.h"
#include "preferences-dialog.h"
#include "tips-dialog.h"
@ -107,6 +108,8 @@ static void dialogs_set_data_context_func (GimpDockable *dockable,
GimpContext *context);
static void dialogs_set_drawable_context_func (GimpDockable *dockable,
GimpContext *context);
static void dialogs_set_path_context_func (GimpDockable *dockable,
GimpContext *context);
static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
const gchar *name,
@ -117,6 +120,9 @@ static GtkWidget * dialogs_dockable_new (GtkWidget *widget,
static void dialogs_drawable_view_image_changed (GimpContext *context,
GimpImage *gimage,
GimpDrawableListView *view);
static void dialogs_path_view_image_changed (GimpContext *context,
GimpImage *gimage,
GtkWidget *view);
static gchar * dialogs_tool_name_func (GtkWidget *widget);
@ -130,17 +136,6 @@ dialogs_toolbox_get (GimpDialogFactory *factory,
return toolbox_create ();
}
GtkWidget *
dialogs_lc_get (GimpDialogFactory *factory,
GimpContext *context)
{
GDisplay *gdisp;
gdisp = gimp_context_get_display (context);
return lc_dialog_create (gdisp ? gdisp->gimage : NULL);
}
GtkWidget *
dialogs_tool_options_get (GimpDialogFactory *factory,
GimpContext *context)
@ -605,6 +600,33 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
return dockable;
}
GtkWidget *
dialogs_path_list_view_new (GimpDialogFactory *factory,
GimpContext *context)
{
static GtkWidget *view = NULL;
GtkWidget *dockable;
if (view)
return NULL;
view = paths_dialog_create ();
gtk_signal_connect (GTK_OBJECT (view), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&view);
dockable = dialogs_dockable_new (view,
"Path List", "Paths",
NULL,
dialogs_set_path_context_func);
dialogs_set_path_context_func (GIMP_DOCKABLE (dockable), context);
return dockable;
}
/* editor dialogs */
@ -871,6 +893,48 @@ dialogs_set_drawable_context_func (GimpDockable *dockable,
}
}
static void
dialogs_set_path_context_func (GimpDockable *dockable,
GimpContext *context)
{
GtkWidget *view;
view = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dockable),
"gimp-dialogs-view");
if (view)
{
GimpContext *old_context;
old_context = (GimpContext *) gtk_object_get_data (GTK_OBJECT (view),
"gimp-dialogs-context");
if (old_context)
{
gtk_signal_disconnect_by_func (GTK_OBJECT (old_context),
GTK_SIGNAL_FUNC (dialogs_path_view_image_changed),
view);
}
if (context)
{
gtk_signal_connect (GTK_OBJECT (context), "image_changed",
GTK_SIGNAL_FUNC (dialogs_path_view_image_changed),
view);
dialogs_path_view_image_changed (context,
gimp_context_get_image (context),
view);
}
else
{
dialogs_path_view_image_changed (NULL, NULL, view);
}
gtk_object_set_data (GTK_OBJECT (view), "gimp-dialogs-context", context);
}
}
static GtkWidget *
dialogs_dockable_new (GtkWidget *widget,
const gchar *name,
@ -900,6 +964,14 @@ dialogs_drawable_view_image_changed (GimpContext *context,
gimp_drawable_list_view_set_image (view, gimage);
}
static void
dialogs_path_view_image_changed (GimpContext *context,
GimpImage *gimage,
GtkWidget *widget)
{
paths_dialog_update (gimage);
}
static gchar *
dialogs_tool_name_func (GtkWidget *widget)
{

View File

@ -90,6 +90,8 @@ GtkWidget * dialogs_layer_list_view_new (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_channel_list_view_new (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
GimpContext *context);
void dialogs_edit_brush_func (GimpData *data);
void dialogs_edit_gradient_func (GimpData *data);

View File

@ -39,7 +39,6 @@ GimpDialogFactory *global_dock_factory = NULL;
static const GimpDialogFactoryEntry toplevel_entries[] =
{
{ "gimp:toolbox", dialogs_toolbox_get, TRUE, TRUE, TRUE },
{ "gimp:lc-dialog", dialogs_lc_get, TRUE, TRUE, TRUE },
{ "gimp:tool-options-dialog", dialogs_tool_options_get, TRUE, TRUE, FALSE },
{ "gimp:device-status-dialog", dialogs_device_status_get, TRUE, TRUE, FALSE },
{ "gimp:brush-select-dialog", dialogs_brush_select_get, TRUE, TRUE, FALSE },
@ -76,7 +75,8 @@ static const GimpDialogFactoryEntry dock_entries[] =
{ "gimp:tool-grid", dialogs_tool_grid_view_new, FALSE, FALSE, FALSE },
{ "gimp:layer-list", dialogs_layer_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE }
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE },
{ "gimp:path-list", dialogs_path_list_view_new, TRUE, FALSE, FALSE }
};
static const gint n_dock_entries = (sizeof (dock_entries) /
sizeof (dock_entries[0]));

View File

@ -44,7 +44,6 @@
#include "gui.h"
#include "gximage.h"
#include "image_render.h"
#include "lc_dialog.h"
#include "menus.h"
#include "palette-editor.h"
#include "pattern-select.h"
@ -156,7 +155,6 @@ gui_exit (void)
dialogs_exit ();
/* handle this in the dialog factory: */
lc_dialog_free ();
document_index_free ();
error_console_free ();
tool_options_dialog_free ();

View File

@ -62,7 +62,6 @@
#include "global_edit.h"
#include "image_render.h"
#include "nav_window.h"
#include "lc_dialog.h"
#include "plug_in.h"
#include "resize.h"
#include "scale.h"
@ -1076,7 +1075,6 @@ image_resize_callback (GtkWidget *widget,
image_resize->resize->offset_x,
image_resize->resize->offset_y);
gdisplays_flush ();
lc_dialog_update_image_list ();
}
else
{

View File

@ -127,7 +127,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/File/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:lc-dialog") },
{ { N_("/File/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_create_lc_cmd_callback, 0 },
"file/dialogs/layers_and_channels.html", NULL },
{ { N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:tool-options-dialog") },
"file/dialogs/tool_options.html", NULL },
@ -167,8 +167,6 @@ static GimpItemFactoryEntry toolbox_entries[] =
NULL, NULL },
{ { N_("/File/Test Dialogs/Grid Dock..."), NULL, test_grid_dock_cmd_callback, 1 },
NULL, NULL },
{ { N_("/File/Test Dialogs/Image Dock..."), NULL, test_image_dock_cmd_callback, 1 },
NULL, NULL },
{ { "/File/Test Dialogs/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
@ -862,6 +860,9 @@ static GimpItemFactoryEntry dialogs_entries[] =
{ { N_("/Add Tab/Channel List..."), NULL, dialogs_add_tab_cmd_callback,
GPOINTER_TO_UINT ("gimp:channel-list") },
NULL, NULL },
{ { N_("/Add Tab/Path List..."), NULL, dialogs_add_tab_cmd_callback,
GPOINTER_TO_UINT ("gimp:path-list") },
NULL, NULL },
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },

View File

@ -47,7 +47,6 @@
#include "floating_sel.h"
#include "gimprc.h"
#include "image_render.h"
#include "lc_dialog.h"
#include "path.h"
#include "pathP.h"
#include "path_transform.h"
@ -133,10 +132,6 @@ static void paths_unselect_row (GtkWidget *widget,
gpointer data);
static gint paths_list_events (GtkWidget *widget,
GdkEvent *event);
static void paths_dialog_map_callback (GtkWidget *widget,
gpointer data);
static void paths_dialog_unmap_callback (GtkWidget *widget,
gpointer data);
static void paths_update_paths (gpointer data,
gint row);
static void paths_update_preview (GimpBezierSelectTool *bezier_sel);
@ -146,17 +141,13 @@ static void paths_dialog_add_point_callback (GtkWidget *, gpointer);
static void paths_dialog_delete_point_callback (GtkWidget *, gpointer);
static void paths_dialog_edit_point_callback (GtkWidget *, gpointer);
static void paths_dialog_advanced_to_path_callback (GtkWidget *, gpointer);
static void paths_dialog_null_callback (GtkWidget *, gpointer);
static void path_close (Path *);
/* the ops buttons */
static GtkSignalFunc to_path_ext_callbacks[] =
{
paths_dialog_advanced_to_path_callback, /* SHIFT */
paths_dialog_null_callback, /* CTRL */
paths_dialog_null_callback, /* MOD1 */
paths_dialog_null_callback, /* SHIFT + CTRL */
paths_dialog_advanced_to_path_callback, NULL, NULL, NULL
};
static OpsButton paths_ops_buttons[] =
@ -323,7 +314,6 @@ paths_dialog_create (void)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS);
gtk_widget_set_usize (scrolled_win, LIST_WIDTH, LIST_HEIGHT);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 2);
paths_dialog->paths_list = paths_list = gtk_clist_new (2);
@ -334,8 +324,6 @@ paths_dialog_create (void)
gtk_clist_set_selection_mode (GTK_CLIST (paths_list), GTK_SELECTION_BROWSE);
gtk_clist_set_reorderable (GTK_CLIST (paths_list), FALSE);
gtk_clist_set_column_width (GTK_CLIST (paths_list), 0, locked_width);
gtk_clist_set_column_min_width (GTK_CLIST (paths_list), 1,
LIST_WIDTH - locked_width - 4);
gtk_clist_set_column_auto_resize (GTK_CLIST (paths_list), 1, TRUE);
gtk_container_add (GTK_CONTAINER (scrolled_win), paths_list);
@ -376,14 +364,6 @@ paths_dialog_create (void)
paths_dialog->ops_menu = paths_factory->widget;
paths_dialog->accel_group = paths_factory->accel_group;;
/* Set up signals for map/unmap for the accelerators */
gtk_signal_connect (GTK_OBJECT (vbox), "map",
(GtkSignalFunc) paths_dialog_map_callback,
NULL);
gtk_signal_connect (GTK_OBJECT (vbox), "unmap",
(GtkSignalFunc) paths_dialog_unmap_callback,
NULL);
paths_dialog_set_menu_sensitivity ();
paths_dialog_set_default_op ();
@ -1336,13 +1316,6 @@ paths_dialog_advanced_to_path_callback (GtkWidget *widget,
}
static void
paths_dialog_null_callback (GtkWidget *widget,
gpointer data)
{
/* Maybe some more here later? */
}
void
paths_dialog_sel_to_path_callback (GtkWidget *widget,
gpointer data)
@ -1460,30 +1433,6 @@ paths_dialog_edit_path_attributes_callback (GtkWidget *widget,
paths_dialog_edit_path_query (paths_dialog->paths_list);
}
static void
paths_dialog_map_callback (GtkWidget *widget,
gpointer data)
{
if (!paths_dialog)
return;
gtk_window_add_accel_group (GTK_WINDOW (lc_dialog->shell),
paths_dialog->accel_group);
paths_dialog_preview_extents ();
}
static void
paths_dialog_unmap_callback (GtkWidget *widget,
gpointer data)
{
if (!paths_dialog)
return;
gtk_window_remove_accel_group (GTK_WINDOW (lc_dialog->shell),
paths_dialog->accel_group);
}
void
paths_dialog_destroy_cb (GtkObject *object,
gpointer data)

View File

@ -42,7 +42,6 @@
#include "gimphelp.h"
#include "gimprc.h"
#include "image_render.h"
#include "lc_dialog.h"
#include "resolution_calibrate.h"
#include "tile_cache.h"
@ -883,7 +882,7 @@ prefs_cancel_callback (GtkWidget *widget,
/* restore variables which need some magic */
if (preview_size != old_preview_size)
{
lc_dialog_rebuild (old_preview_size);
/* lc_dialog_rebuild (old_preview_size); FIXME: update preview size */
layer_select_update_preview_size ();
}
if (nav_preview_size != old_nav_preview_size)
@ -1018,7 +1017,9 @@ static void
prefs_preview_size_callback (GtkWidget *widget,
gpointer data)
{
lc_dialog_rebuild ((long) gtk_object_get_user_data (GTK_OBJECT (widget)));
/* FIXME: update preview size
lc_dialog_rebuild ((long) gtk_object_get_user_data (GTK_OBJECT (widget)));
*/
layer_select_update_preview_size ();
}

View File

@ -572,28 +572,3 @@ test_grid_dock_cmd_callback (GtkWidget *widget,
{
test_dock_new (GIMP_VIEW_TYPE_GRID);
}
void
test_image_dock_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GtkWidget *dock;
GtkWidget *dockbook;
GtkWidget *dockable;
dock = gimp_dialog_factory_dock_new (global_dock_factory);
dockbook = gimp_dockbook_new ();
gimp_dock_add_book (GIMP_DOCK (dock), GIMP_DOCKBOOK (dockbook), 0);
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
"gimp:layer-list");
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
dockable = gimp_dialog_factory_dialog_new (global_dock_factory,
"gimp:channel-list");
gimp_dock_add (GIMP_DOCK (dock), GIMP_DOCKABLE (dockable), -1, -1);
gtk_widget_show (dock);
}

View File

@ -38,7 +38,6 @@ void test_multi_container_grid_view_cmd_callback (GtkWidget *, gpointer);
void test_list_dock_cmd_callback (GtkWidget *, gpointer);
void test_grid_dock_cmd_callback (GtkWidget *, gpointer);
void test_image_dock_cmd_callback (GtkWidget *, gpointer);
#endif /* __TEST_COMMANDS_H__ */

View File

@ -1,740 +0,0 @@
/* 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 <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "widgets/widgets-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimpdialogfactory.h"
#include "gui/dialogs.h"
#include "gui/paths-dialog.h"
#include "context_manager.h"
#include "dialog_handler.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "image_render.h"
#include "lc_dialog.h"
#include "temp_buf.h"
#include "libgimp/gimplimits.h"
#include "libgimp/gimpintl.h"
#define MENU_THUMBNAIL_SIZE 24
/* local function prototypes */
static void lc_dialog_update (GimpImage *gimage);
static void lc_dialog_image_menu_callback (GtkWidget *widget,
gpointer data);
static void lc_dialog_auto_callback (GtkWidget *widget,
gpointer data);
static gint lc_dialog_close_callback (GtkWidget *widget,
gpointer data);
static void lc_dialog_add_callback (GimpContainer *container,
GimpImage *gimage,
gpointer data);
static void lc_dialog_remove_callback (GimpContainer *container,
GimpImage *gimage,
gpointer data);
static void lc_dialog_change_image (GimpContext *context,
GimpImage *gimage,
gpointer data);
static void lc_dialog_help_func (const gchar *help_data);
static void lc_dialog_image_menu_preview_update_callback (GtkWidget *widget,
gpointer data);
static void lc_dialog_fill_preview_with_thumb (GtkWidget *widget,
GimpImage *gimage,
gint width,
gint height);
/* FIXME: move these to a better place */
static GtkWidget * lc_dialog_create_image_menu (GimpImage **def,
gint *default_index,
GtkSignalFunc callback);
static void lc_dialog_create_image_menu_callback (gpointer image,
gpointer data);
/* the main dialog structure */
LCDialog * lc_dialog = NULL;
/*********************************/
/* Public L&C dialog functions */
/*********************************/
GtkWidget *
lc_dialog_create (GimpImage *gimage)
{
GtkWidget *util_box;
GtkWidget *auto_button;
GtkWidget *label;
GtkWidget *separator;
gint default_index;
if (lc_dialog)
{
if (gimage)
lc_dialog_update (gimage);
lc_dialog_update_image_list ();
return lc_dialog->shell;
}
lc_dialog = g_new0 (LCDialog, 1);
lc_dialog->gimage = NULL;
lc_dialog->auto_follow_active = TRUE;
lc_dialog->shell = gimp_dialog_new ("Old Paths Dialog",
"layers_channels_paths",
lc_dialog_help_func,
"dialogs/layers_and_channels.html",
GTK_WIN_POS_NONE,
FALSE, TRUE, FALSE,
"_delete_event_", lc_dialog_close_callback,
lc_dialog, NULL, NULL, TRUE, TRUE,
NULL);
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_DIALOG (lc_dialog->shell)->vbox)), 0)));
gtk_widget_hide (GTK_DIALOG (lc_dialog->shell)->action_area);
/* Register the dialog */
dialog_register (lc_dialog->shell);
/* The toplevel vbox */
lc_dialog->subshell = gtk_vbox_new (FALSE, 1);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (lc_dialog->shell)->vbox),
lc_dialog->subshell);
/* The hbox to hold the image option menu box */
util_box = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (util_box), 2);
gtk_box_pack_start (GTK_BOX (lc_dialog->subshell), util_box, FALSE, FALSE, 0);
/* The GIMP image option menu */
label = gtk_label_new (_("Image:"));
gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
gtk_widget_show (label);
lc_dialog->image_option_menu = gtk_option_menu_new ();
lc_dialog->image_menu =
lc_dialog_create_image_menu (&gimage, &default_index,
lc_dialog_image_menu_callback);
gtk_box_pack_start (GTK_BOX (util_box), lc_dialog->image_option_menu,
TRUE, TRUE, 0);
gimp_help_set_help_data (lc_dialog->image_option_menu, NULL, "#image_menu");
gtk_widget_show (lc_dialog->image_option_menu);
gtk_option_menu_set_menu (GTK_OPTION_MENU (lc_dialog->image_option_menu),
lc_dialog->image_menu);
if (default_index != -1)
gtk_option_menu_set_history
(GTK_OPTION_MENU (lc_dialog->image_option_menu), default_index);
/* The Auto-button */
auto_button = gtk_toggle_button_new_with_label (_("Auto"));
gtk_box_pack_start (GTK_BOX (util_box), auto_button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (auto_button), "clicked",
(GtkSignalFunc) lc_dialog_auto_callback,
auto_button);
gimp_help_set_help_data (auto_button, NULL, "#auto_button");
gtk_widget_show (auto_button);
/* State will be set when the sub-dialogs exists (see below) */
gtk_widget_show (util_box);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (lc_dialog->subshell), separator,
FALSE, FALSE, 0);
gtk_widget_show (separator);
/* The notebook widget */
lc_dialog->notebook = gtk_notebook_new ();
gtk_container_set_border_width (GTK_CONTAINER (lc_dialog->notebook), 2);
gtk_box_pack_start (GTK_BOX (lc_dialog->subshell), lc_dialog->notebook,
TRUE, TRUE, 0);
label = gtk_label_new (_("Paths"));
gtk_notebook_append_page (GTK_NOTEBOOK (lc_dialog->notebook),
paths_dialog_create (), label);
gtk_widget_show (label);
/* Now all notebook pages exist, we can set the Auto-togglebutton */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (auto_button),
lc_dialog->auto_follow_active);
gtk_widget_show (lc_dialog->notebook);
/* The action area */
gtk_container_set_border_width
(GTK_CONTAINER (GTK_DIALOG (lc_dialog->shell)->action_area), 1);
gtk_signal_connect (GTK_OBJECT (image_context), "add",
GTK_SIGNAL_FUNC (lc_dialog_add_callback), NULL);
gtk_signal_connect (GTK_OBJECT (image_context), "remove",
GTK_SIGNAL_FUNC (lc_dialog_remove_callback), NULL);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), "image_changed",
GTK_SIGNAL_FUNC (lc_dialog_change_image), NULL);
lc_dialog_update (gimage);
lc_dialog_update_image_list ();
gtk_widget_show (lc_dialog->subshell);
gdisplays_flush ();
return lc_dialog->shell;
}
void
lc_dialog_free (void)
{
if (lc_dialog == NULL)
return;
gtk_widget_destroy (lc_dialog->shell);
g_free (lc_dialog);
lc_dialog = NULL;
}
void
lc_dialog_rebuild (gint new_preview_size)
{
GimpImage *gimage;
gboolean flag;
gimage = NULL;
flag = FALSE;
if (lc_dialog)
{
flag = TRUE;
gimage = lc_dialog->gimage;
/* Unregister the dialog */
dialog_unregister (lc_dialog->shell);
lc_dialog_free ();
}
preview_size = new_preview_size;
render_setup (transparency_type, transparency_size);
if (flag)
gimp_dialog_factory_dialog_new (global_dialog_factory, "gimp:lc-dialog");
}
void
lc_dialog_flush (void)
{
if (! lc_dialog || lc_dialog->gimage == NULL)
return;
paths_dialog_flush ();
}
static gint
image_menu_preview_update_do (GimpImage *gimage)
{
if (lc_dialog)
{
gtk_container_foreach (GTK_CONTAINER (lc_dialog->image_menu),
lc_dialog_image_menu_preview_update_callback,
(gpointer) gimage);
}
return FALSE;
}
void
lc_dialog_menu_preview_dirty (GtkObject *obj,
gpointer data)
{
if (!preview_size)
return;
/* Update preview at a less busy time */
gtk_idle_add ((GtkFunction) image_menu_preview_update_do, obj);
}
void
lc_dialog_preview_update (GimpImage *gimage)
{
if (!preview_size)
return;
gtk_idle_add ((GtkFunction) image_menu_preview_update_do, gimage);
}
static void
lc_dialog_image_menu_preview_update_callback (GtkWidget *widget,
gpointer data)
{
GtkWidget *menu_preview;
GimpImage *gimage;
GimpImage *gimage_to_update;
gimage_to_update = (GimpImage *) data;
/* This is called via an idle function, so it is possible
* that the client_data no longer points to a GimpImage.. So don't
* pass it to the GIMP_IMAGE() cast function. We never deference
* it here anyways.
*/
menu_preview = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (widget),
"menu_preview");
gimage = (GimpImage *) gtk_object_get_data (GTK_OBJECT (widget),
"menu_preview_gimage");
if (menu_preview && gimage && gimage_to_update == gimage &&
gimp_container_have (image_context, (GimpObject *) gimage))
{
/* Must update the preview? */
lc_dialog_fill_preview_with_thumb (menu_preview,
gimage,
MENU_THUMBNAIL_SIZE,
MENU_THUMBNAIL_SIZE);
gtk_widget_queue_draw (GTK_WIDGET (menu_preview));
}
}
void
lc_dialog_update_image_list (void)
{
GimpImage *default_gimage;
gint default_index;
if (lc_dialog == NULL)
return;
default_gimage = lc_dialog->gimage;
lc_dialog->image_menu =
lc_dialog_create_image_menu (&default_gimage, &default_index,
lc_dialog_image_menu_callback);
gtk_option_menu_set_menu (GTK_OPTION_MENU (lc_dialog->image_option_menu),
lc_dialog->image_menu);
if (default_index != -1)
{
gtk_option_menu_set_history
(GTK_OPTION_MENU (lc_dialog->image_option_menu), default_index);
lc_dialog_update (default_gimage);
gdisplays_flush ();
if (! GTK_WIDGET_IS_SENSITIVE (lc_dialog->subshell))
gtk_widget_set_sensitive (lc_dialog->subshell, TRUE);
}
else
{
lc_dialog->gimage = NULL;
if (GTK_WIDGET_IS_SENSITIVE (lc_dialog->subshell))
gtk_widget_set_sensitive (lc_dialog->subshell, FALSE);
}
}
/**********************************/
/* Private L&C dialog functions */
/**********************************/
static void
lc_dialog_update (GimpImage *gimage)
{
if (! lc_dialog || lc_dialog->gimage == gimage)
return;
lc_dialog->gimage = gimage;
paths_dialog_update (gimage);
}
typedef struct
{
GimpImage **def;
gint *default_index;
GtkSignalFunc callback;
GtkWidget *menu;
gint num_items;
GimpImage *id;
} IMCBData;
static void
lc_dialog_fill_preview_with_thumb (GtkWidget *widget,
GimpImage *gimage,
gint width,
gint height)
{
guchar *drawable_data;
TempBuf *buf = NULL;
gint bpp;
gint x, y;
guchar *src;
gdouble r, g, b, a;
gdouble c0, c1;
guchar *p0, *p1, *even, *odd;
gdouble ratio;
bpp = 0; /* Only returned */
/* Get right aspect ratio */
if (gimage->width > gimage->height)
{
ratio = (gdouble) width / (gdouble) gimage->width;
}
else
{
ratio = (gdouble) height / (gdouble) gimage->height;
}
width = RINT (ratio * (gdouble) gimage->width);
height = RINT (ratio * (gdouble) gimage->height);
if (width < 1) width = 1;
if (height < 1) height = 1;
if (ratio > 1.0) /* Preview is scaling up! */
{
TempBuf *tmp;
tmp = gimp_viewable_get_new_preview (GIMP_VIEWABLE (gimage),
gimage->width,
gimage->height);
buf = temp_buf_scale (tmp, width, height);
temp_buf_free (tmp);
}
else
{
buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (gimage),
width,
height);
}
gtk_preview_size (GTK_PREVIEW (widget), width, height);
drawable_data = temp_buf_data (buf);
bpp = buf->bytes;
/* Draw the thumbnail with checks */
src = drawable_data;
even = g_malloc (width * 3);
odd = g_malloc (width * 3);
for (y = 0; y < height; y++)
{
p0 = even;
p1 = odd;
for (x = 0; x < width; x++)
{
if (bpp == 4)
{
r = ((gdouble) src[x * 4 + 0]) / 255.0;
g = ((gdouble) src[x * 4 + 1]) / 255.0;
b = ((gdouble) src[x * 4 + 2]) / 255.0;
a = ((gdouble) src[x * 4 + 3]) / 255.0;
}
else
{
r = ((gdouble) src[x * bpp + 0]) / 255.0;
g = b = r;
a = ((gdouble) src[x * bpp + 1]) / 255.0;
}
if ((x / GIMP_CHECK_SIZE_SM) & 1)
{
c0 = GIMP_CHECK_LIGHT;
c1 = GIMP_CHECK_DARK;
}
else
{
c0 = GIMP_CHECK_DARK;
c1 = GIMP_CHECK_LIGHT;
}
*p0++ = (c0 + (r - c0) * a) * 255.0;
*p0++ = (c0 + (g - c0) * a) * 255.0;
*p0++ = (c0 + (b - c0) * a) * 255.0;
*p1++ = (c1 + (r - c1) * a) * 255.0;
*p1++ = (c1 + (g - c1) * a) * 255.0;
*p1++ = (c1 + (b - c1) * a) * 255.0;
}
if ((y / GIMP_CHECK_SIZE_SM) & 1)
{
gtk_preview_draw_row (GTK_PREVIEW (widget),
(guchar *) odd, 0, y, width);
}
else
{
gtk_preview_draw_row (GTK_PREVIEW (widget),
(guchar *) even, 0, y, width);
}
src += width * bpp;
}
g_free (even);
g_free (odd);
temp_buf_free (buf);
}
static void
lc_dialog_create_image_menu_callback (gpointer im,
gpointer d)
{
GimpImage *gimage = GIMP_IMAGE (im);
IMCBData *data = (IMCBData *) d;
gchar *image_name;
gchar *menu_item_label;
GtkWidget *menu_item;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *wcolor_box;
GtkWidget *wlabel;
/* make sure the default index gets set to _something_, if possible */
if (*data->default_index == -1)
{
data->id = gimage;
*data->default_index = data->num_items;
}
if (gimage == *data->def)
{
data->id = *data->def;
*data->default_index = data->num_items;
}
image_name = g_basename (gimp_image_filename (gimage));
menu_item_label =
g_strdup_printf ("%s-%d", image_name, gimp_image_get_ID (gimage));
menu_item = gtk_menu_item_new();
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
data->callback,
gimage);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (menu_item), hbox);
gtk_widget_show (hbox);
if (preview_size)
{
vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
wcolor_box = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_set_dither (GTK_PREVIEW (wcolor_box), GDK_RGB_DITHER_MAX);
gtk_widget_set_usize (GTK_WIDGET (wcolor_box),
MENU_THUMBNAIL_SIZE, MENU_THUMBNAIL_SIZE);
lc_dialog_fill_preview_with_thumb (wcolor_box,
gimage,
MENU_THUMBNAIL_SIZE,
MENU_THUMBNAIL_SIZE);
gtk_container_add (GTK_CONTAINER (vbox), wcolor_box);
gtk_widget_show (wcolor_box);
if (gtk_object_get_data (GTK_OBJECT (gimage),
"menu_preview_dirty") == NULL)
{
/* Only add this signal once */
gtk_object_set_data (GTK_OBJECT (gimage), "menu_preview_dirty",
(gpointer) 1);
gtk_signal_connect_after (GTK_OBJECT (gimage), "dirty",
GTK_SIGNAL_FUNC (lc_dialog_menu_preview_dirty),
NULL);
}
gtk_object_set_data (GTK_OBJECT (menu_item), "menu_preview",
wcolor_box);
gtk_object_set_data (GTK_OBJECT (menu_item), "menu_preview_gimage",
gimage);
}
gtk_container_add (GTK_CONTAINER (data->menu), menu_item);
wlabel = gtk_label_new (menu_item_label);
gtk_misc_set_alignment (GTK_MISC (wlabel), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), wlabel, TRUE, TRUE, 4);
gtk_widget_show (wlabel);
gtk_widget_show (menu_item);
g_free (menu_item_label);
data->num_items++;
}
static GtkWidget *
lc_dialog_create_image_menu (GimpImage **def,
gint *default_index,
GtkSignalFunc callback)
{
IMCBData data;
data.def = def;
data.default_index = default_index;
data.callback = callback;
data.menu = gtk_menu_new ();
data.num_items = 0;
data.id = NULL;
*default_index = -1;
gimp_container_foreach (image_context,
lc_dialog_create_image_menu_callback,
&data);
if (! data.num_items)
{
GtkWidget *menu_item;
menu_item = gtk_menu_item_new_with_label (_("none"));
gtk_container_add (GTK_CONTAINER (data.menu), menu_item);
gtk_widget_show (menu_item);
}
*def = data.id;
return data.menu;
}
static void
lc_dialog_image_menu_callback (GtkWidget *widget,
gpointer data)
{
if (! lc_dialog)
return;
lc_dialog_update (GIMP_IMAGE (data));
gdisplays_flush ();
}
static void
lc_dialog_auto_callback (GtkWidget *widget,
gpointer data)
{
GimpContext *context;
if (! lc_dialog)
return;
lc_dialog->auto_follow_active =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
context = gimp_context_get_user ();
if (lc_dialog->auto_follow_active)
lc_dialog_change_image (context,
gimp_context_get_image (context),
NULL);
}
static gint
lc_dialog_close_callback (GtkWidget *widget,
gpointer data)
{
if (! lc_dialog)
return TRUE;
lc_dialog->gimage = NULL;
gtk_widget_hide (lc_dialog->shell);
return TRUE;
}
static void
lc_dialog_add_callback (GimpContainer *container,
GimpImage *gimage,
gpointer data)
{
if (! lc_dialog)
return;
lc_dialog_update_image_list ();
}
static void
lc_dialog_remove_callback (GimpContainer *container,
GimpImage *gimage,
gpointer data)
{
if (! lc_dialog)
return;
lc_dialog_update_image_list ();
}
static void
lc_dialog_change_image (GimpContext *context,
GimpImage *gimage,
gpointer data)
{
if (! lc_dialog || ! lc_dialog->auto_follow_active)
return;
if (gimage && gimp_container_have (image_context, GIMP_OBJECT (gimage)))
{
lc_dialog_update (gimage);
lc_dialog_update_image_list ();
}
}
static void
lc_dialog_help_func (const gchar *help_data)
{
gchar *help_page;
gint page_num;
static gchar* dialog_names[] = { "paths" };
page_num =
gtk_notebook_get_current_page (GTK_NOTEBOOK (lc_dialog->notebook));
if (page_num > 0)
return;
help_page = g_strconcat (dialog_names[page_num], "/",
"dialogs/",
dialog_names[page_num], ".html",
NULL);
gimp_standard_help_func (help_page);
g_free (help_page);
}

View File

@ -1,74 +0,0 @@
/* 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.
*/
#ifndef __LC_DIALOG_H__
#define __LC_DIALOG_H__
#define PREVIEW_EVENT_MASK (GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | \
GDK_ENTER_NOTIFY_MASK)
#define BUTTON_EVENT_MASK (GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK | \
GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | \
GDK_BUTTON_RELEASE_MASK)
#define LIST_WIDTH 200
#define LIST_HEIGHT 150
#define NORMAL 0
#define SELECTED 1
#define INSENSITIVE 2
typedef struct _LCDialog LCDialog;
struct _LCDialog
{
GtkWidget *shell;
GtkWidget *subshell;
GtkWidget *image_menu;
GtkWidget *image_option_menu;
GimpImage *gimage;
gboolean auto_follow_active;
GtkWidget *notebook;
};
/* Main dialog structure */
extern LCDialog *lc_dialog;
GtkWidget * lc_dialog_create (GimpImage *gimage);
void lc_dialog_free (void);
/* implies free & create
*/
void lc_dialog_rebuild (gint new_preview_size);
void lc_dialog_flush (void);
void lc_dialog_update_image_list (void);
void lc_dialog_preview_update (GimpImage *gimage);
void lc_dialog_menu_preview_dirty (GtkObject *,gpointer);
#endif /* __LC_DIALOG_H__ */

View File

@ -127,7 +127,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/File/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:lc-dialog") },
{ { N_("/File/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_create_lc_cmd_callback, 0 },
"file/dialogs/layers_and_channels.html", NULL },
{ { N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:tool-options-dialog") },
"file/dialogs/tool_options.html", NULL },
@ -167,8 +167,6 @@ static GimpItemFactoryEntry toolbox_entries[] =
NULL, NULL },
{ { N_("/File/Test Dialogs/Grid Dock..."), NULL, test_grid_dock_cmd_callback, 1 },
NULL, NULL },
{ { N_("/File/Test Dialogs/Image Dock..."), NULL, test_image_dock_cmd_callback, 1 },
NULL, NULL },
{ { "/File/Test Dialogs/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
@ -862,6 +860,9 @@ static GimpItemFactoryEntry dialogs_entries[] =
{ { N_("/Add Tab/Channel List..."), NULL, dialogs_add_tab_cmd_callback,
GPOINTER_TO_UINT ("gimp:channel-list") },
NULL, NULL },
{ { N_("/Add Tab/Path List..."), NULL, dialogs_add_tab_cmd_callback,
GPOINTER_TO_UINT ("gimp:path-list") },
NULL, NULL },
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },

View File

@ -127,7 +127,7 @@ static GimpItemFactoryEntry toolbox_entries[] =
{ { "/File/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
{ { N_("/File/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:lc-dialog") },
{ { N_("/File/Dialogs/Layers, Channels & Paths..."), "<control>L", dialogs_create_lc_cmd_callback, 0 },
"file/dialogs/layers_and_channels.html", NULL },
{ { N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_create_toplevel_cmd_callback, GPOINTER_TO_UINT ("gimp:tool-options-dialog") },
"file/dialogs/tool_options.html", NULL },
@ -167,8 +167,6 @@ static GimpItemFactoryEntry toolbox_entries[] =
NULL, NULL },
{ { N_("/File/Test Dialogs/Grid Dock..."), NULL, test_grid_dock_cmd_callback, 1 },
NULL, NULL },
{ { N_("/File/Test Dialogs/Image Dock..."), NULL, test_image_dock_cmd_callback, 1 },
NULL, NULL },
{ { "/File/Test Dialogs/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },
@ -862,6 +860,9 @@ static GimpItemFactoryEntry dialogs_entries[] =
{ { N_("/Add Tab/Channel List..."), NULL, dialogs_add_tab_cmd_callback,
GPOINTER_TO_UINT ("gimp:channel-list") },
NULL, NULL },
{ { N_("/Add Tab/Path List..."), NULL, dialogs_add_tab_cmd_callback,
GPOINTER_TO_UINT ("gimp:path-list") },
NULL, NULL },
{ { "/Add Tab/---", NULL, NULL, 0, "<Separator>" },
NULL, NULL },