Commit 70ce7bae authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/Makefile.am removed.

2001-10-22  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/docindex.[ch]: removed.

	* app/widgets/Makefile.am
	* app/widgets/widgets-types.h
	* app/widgets/gimpdocumentview.[ch]: new widget as replacement.

	* app/core/gimpcontext.[ch]: added context->imagefile property.

	* app/app_procs.c
	* app/file-save.c
	* app/gui/dialogs-constructors.[ch]
	* app/gui/dialogs.c
	* app/gui/file-open-dialog.c
	* app/gui/file-save-dialog.c
	* app/gui/gui.c
	* app/gui/menus.c
	* app/gui/test-commands.c: changed accordingly.

	* app/widgets/gimpcontainerview.[ch]: added "gboolean reorderable"
	property which needs to be set by subclasses.

	* app/widgets/gimpdrawablelistview.c: removed the "insert_item"
	implementation which was used to make the items reorderable.

	* app/widgets/gimpcontainerlistview.[ch]: make the list items
	reorderable depending on view->reorderable.

	* app/widgets/gimpbufferview.c: made it reorderable.

	* app/widgets/gimpcontainereditor.[ch]
	* app/widgets/gimpcontainergridview.[ch]
	* app/widgets/gimpdatafactoryview.c: changed accordingly.
parent 99e78c70
2001-10-22 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/docindex.[ch]: removed.
* app/widgets/Makefile.am
* app/widgets/widgets-types.h
* app/widgets/gimpdocumentview.[ch]: new widget as replacement.
* app/core/gimpcontext.[ch]: added context->imagefile property.
* app/app_procs.c
* app/file-save.c
* app/gui/dialogs-constructors.[ch]
* app/gui/dialogs.c
* app/gui/file-open-dialog.c
* app/gui/file-save-dialog.c
* app/gui/gui.c
* app/gui/menus.c
* app/gui/test-commands.c: changed accordingly.
* app/widgets/gimpcontainerview.[ch]: added "gboolean reorderable"
property which needs to be set by subclasses.
* app/widgets/gimpdrawablelistview.c: removed the "insert_item"
implementation which was used to make the items reorderable.
* app/widgets/gimpcontainerlistview.[ch]: make the list items
reorderable depending on view->reorderable.
* app/widgets/gimpbufferview.c: made it reorderable.
* app/widgets/gimpcontainereditor.[ch]
* app/widgets/gimpcontainergridview.[ch]
* app/widgets/gimpdatafactoryview.c: changed accordingly.
2001-10-22 Michael Natterer <mitch@gimp.org>
General cleanup of the selection tools and their PDB wrappers:
......
......@@ -14,8 +14,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
colormaps.h \
devices.c \
devices.h \
docindex.c \
docindex.h \
gimpprogress.c \
gimpprogress.h \
nav_window.c \
......
......@@ -53,7 +53,6 @@
#include "app_procs.h"
#include "batch.h"
#include "colormaps.h"
#include "docindex.h"
#include "errors.h"
#include "gimprc.h"
#include "plug_in.h"
......
......@@ -37,6 +37,7 @@
#include "gimpcontext.h"
#include "gimpcoreconfig.h"
#include "gimpdatafactory.h"
#include "gimpimagefile.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimpmarshal.h"
......@@ -187,6 +188,19 @@ static void gimp_context_real_set_buffer (GimpContext *context,
static void gimp_context_copy_buffer (GimpContext *src,
GimpContext *dest);
/* imagefile */
static void gimp_context_imagefile_dirty (GimpImagefile *imagefile,
GimpContext *context);
static void gimp_context_imagefile_removed (GimpContainer *container,
GimpImagefile *imagefile,
GimpContext *context);
static void gimp_context_imagefile_list_thaw (GimpContainer *container,
GimpContext *context);
static void gimp_context_real_set_imagefile (GimpContext *context,
GimpImagefile *imagefile);
static void gimp_context_copy_imagefile (GimpContext *src,
GimpContext *dest);
/* properties & signals */
......@@ -204,7 +218,8 @@ enum
PROP_PATTERN,
PROP_GRADIENT,
PROP_PALETTE,
PROP_BUFFER
PROP_BUFFER,
PROP_IMAGEFILE
};
enum
......@@ -221,6 +236,7 @@ enum
GRADIENT_CHANGED,
PALETTE_CHANGED,
BUFFER_CHANGED,
IMAGEFILE_CHANGED,
LAST_SIGNAL
};
......@@ -237,7 +253,8 @@ static gchar *gimp_context_prop_names[] =
"pattern",
"gradient",
"palette",
"buffer"
"buffer",
"imagefile"
};
static GimpContextCopyPropFunc gimp_context_copy_prop_funcs[] =
......@@ -253,7 +270,8 @@ static GimpContextCopyPropFunc gimp_context_copy_prop_funcs[] =
gimp_context_copy_pattern,
gimp_context_copy_gradient,
gimp_context_copy_palette,
gimp_context_copy_buffer
gimp_context_copy_buffer,
gimp_context_copy_imagefile
};
static GType gimp_context_prop_types[] =
......@@ -269,6 +287,7 @@ static GType gimp_context_prop_types[] =
0,
0,
0,
0,
0
};
......@@ -285,7 +304,8 @@ static gchar *gimp_context_signal_names[] =
"pattern_changed",
"gradient_changed",
"palette_changed",
"buffer_changed"
"buffer_changed",
"imagefile_changed"
};
static GCallback gimp_context_signal_handlers[] =
......@@ -301,7 +321,8 @@ static GCallback gimp_context_signal_handlers[] =
G_CALLBACK (gimp_context_real_set_pattern),
G_CALLBACK (gimp_context_real_set_gradient),
G_CALLBACK (gimp_context_real_set_palette),
G_CALLBACK (gimp_context_real_set_buffer)
G_CALLBACK (gimp_context_real_set_buffer),
G_CALLBACK (gimp_context_real_set_imagefile)
};
......@@ -467,6 +488,16 @@ gimp_context_class_init (GimpContextClass *klass)
G_TYPE_NONE, 1,
GIMP_TYPE_BUFFER);
gimp_context_signals[IMAGEFILE_CHANGED] =
g_signal_new (gimp_context_signal_names[IMAGEFILE_CHANGED],
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpContextClass, imagefile_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GIMP_TYPE_IMAGEFILE);
object_class->set_property = gimp_context_set_property;
object_class->get_property = gimp_context_get_property;
object_class->finalize = gimp_context_finalize;
......@@ -483,14 +514,16 @@ gimp_context_class_init (GimpContextClass *klass)
klass->gradient_changed = NULL;
klass->palette_changed = NULL;
klass->buffer_changed = NULL;
klass->imagefile_changed = NULL;
gimp_context_prop_types[GIMP_CONTEXT_PROP_IMAGE] = GIMP_TYPE_IMAGE;
gimp_context_prop_types[GIMP_CONTEXT_PROP_TOOL] = GIMP_TYPE_TOOL_INFO;
gimp_context_prop_types[GIMP_CONTEXT_PROP_BRUSH] = GIMP_TYPE_BRUSH;
gimp_context_prop_types[GIMP_CONTEXT_PROP_PATTERN] = GIMP_TYPE_PATTERN;
gimp_context_prop_types[GIMP_CONTEXT_PROP_GRADIENT] = GIMP_TYPE_GRADIENT;
gimp_context_prop_types[GIMP_CONTEXT_PROP_PALETTE] = GIMP_TYPE_PALETTE;
gimp_context_prop_types[GIMP_CONTEXT_PROP_BUFFER] = GIMP_TYPE_BUFFER;
gimp_context_prop_types[GIMP_CONTEXT_PROP_IMAGE] = GIMP_TYPE_IMAGE;
gimp_context_prop_types[GIMP_CONTEXT_PROP_TOOL] = GIMP_TYPE_TOOL_INFO;
gimp_context_prop_types[GIMP_CONTEXT_PROP_BRUSH] = GIMP_TYPE_BRUSH;
gimp_context_prop_types[GIMP_CONTEXT_PROP_PATTERN] = GIMP_TYPE_PATTERN;
gimp_context_prop_types[GIMP_CONTEXT_PROP_GRADIENT] = GIMP_TYPE_GRADIENT;
gimp_context_prop_types[GIMP_CONTEXT_PROP_PALETTE] = GIMP_TYPE_PALETTE;
gimp_context_prop_types[GIMP_CONTEXT_PROP_BUFFER] = GIMP_TYPE_BUFFER;
gimp_context_prop_types[GIMP_CONTEXT_PROP_IMAGEFILE] = GIMP_TYPE_IMAGEFILE;
g_object_class_install_property (object_class,
PROP_IMAGE,
......@@ -576,6 +609,13 @@ gimp_context_class_init (GimpContextClass *klass)
NULL, NULL,
GIMP_TYPE_BUFFER,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_IMAGEFILE,
g_param_spec_object (gimp_context_prop_names[IMAGEFILE_CHANGED],
NULL, NULL,
GIMP_TYPE_IMAGEFILE,
G_PARAM_READWRITE));
}
static void
......@@ -612,6 +652,7 @@ gimp_context_init (GimpContext *context)
context->palette_name = NULL;
context->buffer = NULL;
context->imagefile = NULL;
}
static void
......@@ -688,6 +729,12 @@ gimp_context_finalize (GObject *object)
context->buffer = NULL;
}
if (context->imagefile)
{
g_object_unref (G_OBJECT (context->imagefile));
context->imagefile = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -739,6 +786,9 @@ gimp_context_set_property (GObject *object,
case PROP_BUFFER:
gimp_context_set_buffer (context, g_value_get_object (value));
break;
case PROP_IMAGEFILE:
gimp_context_set_imagefile (context, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -793,6 +843,9 @@ gimp_context_get_property (GObject *object,
case PROP_BUFFER:
g_value_set_object (value, gimp_context_get_buffer (context));
break;
case PROP_IMAGEFILE:
g_value_set_object (value, gimp_context_get_imagefile (context));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -878,6 +931,15 @@ gimp_context_new (Gimp *gimp,
G_OBJECT (context),
0);
g_signal_connect_object (G_OBJECT (gimp->documents), "remove",
G_CALLBACK (gimp_context_imagefile_removed),
G_OBJECT (context),
0);
g_signal_connect_object (G_OBJECT (gimp->documents), "thaw",
G_CALLBACK (gimp_context_imagefile_list_thaw),
G_OBJECT (context),
0);
if (template)
{
context->defined_props = template->defined_props;
......@@ -2495,3 +2557,170 @@ gimp_context_copy_buffer (GimpContext *src,
}
*/
}
/*****************************************************************************/
/* imagefile ***************************************************************/
/*
static GimpImagefile *standard_imagefile = NULL;
*/
GimpImagefile *
gimp_context_get_imagefile (GimpContext *context)
{
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
return context->imagefile;
}
void
gimp_context_set_imagefile (GimpContext *context,
GimpImagefile *imagefile)
{
g_return_if_fail (GIMP_IS_CONTEXT (context));
context_find_defined (context, GIMP_CONTEXT_IMAGEFILE_MASK);
gimp_context_real_set_imagefile (context, imagefile);
}
void
gimp_context_imagefile_changed (GimpContext *context)
{
g_return_if_fail (GIMP_IS_CONTEXT (context));
g_signal_emit (G_OBJECT (context),
gimp_context_signals[IMAGEFILE_CHANGED], 0,
context->imagefile);
}
/* the active imagefile was modified */
static void
gimp_context_imagefile_dirty (GimpImagefile *imagefile,
GimpContext *context)
{
/*
g_free (context->imagefile_name);
context->imagefile_name = g_strdup (GIMP_OBJECT (imagefile)->name);
*/
gimp_context_imagefile_changed (context);
}
/* the global gradient list is there again after refresh */
static void
gimp_context_imagefile_list_thaw (GimpContainer *container,
GimpContext *context)
{
/*
GimpBuffer *imagefile;
if (! context->imagefile_name)
context->imagefile_name = g_strdup (context->gimp->config->default_imagefile);
if ((imagefile = (GimpImagefile *)
gimp_container_get_child_by_name (container,
context->imagefile_name)))
{
gimp_context_real_set_imagefile (context, imagefile);
return;
}
*/
if (gimp_container_num_children (container))
gimp_context_real_set_imagefile
(context,
GIMP_IMAGEFILE (gimp_container_get_child_by_index (container, 0)));
else
gimp_context_imagefile_changed (context);
/*
else
gimp_context_real_set_imagefile (context,
GIMP_IMAGEFILE (gimp_imagefile_get_standard ()));
*/
}
/* the active imagefile disappeared */
static void
gimp_context_imagefile_removed (GimpContainer *container,
GimpImagefile *imagefile,
GimpContext *context)
{
if (imagefile == context->imagefile)
{
context->imagefile = NULL;
g_signal_handlers_disconnect_by_func (G_OBJECT (imagefile),
gimp_context_imagefile_dirty,
context);
g_object_unref (G_OBJECT (imagefile));
if (! gimp_container_frozen (container))
gimp_context_imagefile_list_thaw (container, context);
}
}
static void
gimp_context_real_set_imagefile (GimpContext *context,
GimpImagefile *imagefile)
{
/*
if (! standard_imagefile)
standard_imagefile = GIMP_IMAGEFILE (gimp_imagefile_get_standard ());
*/
if (context->imagefile == imagefile)
return;
/*
if (context->imagefile_name && imagefile != standard_imagefile)
{
g_free (context->imagefile_name);
context->imagefile_name = NULL;
}
*/
/* disconnect from the old imagefile's signals */
if (context->imagefile)
{
g_signal_handlers_disconnect_by_func (G_OBJECT (context->imagefile),
gimp_context_imagefile_dirty,
context);
g_object_unref (G_OBJECT (context->imagefile));
}
context->imagefile = imagefile;
if (imagefile)
{
g_object_ref (G_OBJECT (imagefile));
g_signal_connect_object (G_OBJECT (imagefile), "name_changed",
G_CALLBACK (gimp_context_imagefile_dirty),
G_OBJECT (context),
0);
/*
if (imagefile != standard_imagefile)
context->imagefile_name = g_strdup (GIMP_OBJECT (imagefile)->name);
*/
}
gimp_context_imagefile_changed (context);
}
static void
gimp_context_copy_imagefile (GimpContext *src,
GimpContext *dest)
{
gimp_context_real_set_imagefile (dest, src->imagefile);
/*
if ((!src->imagefile || src->imagefile == standard_imagefile) && src->imagefile_name)
{
g_free (dest->imagefile_name);
dest->imagefile_name = g_strdup (src->imagefile_name);
}
*/
}
......@@ -40,6 +40,7 @@ typedef enum
GIMP_CONTEXT_PROP_GRADIENT,
GIMP_CONTEXT_PROP_PALETTE,
GIMP_CONTEXT_PROP_BUFFER,
GIMP_CONTEXT_PROP_IMAGEFILE,
GIMP_CONTEXT_NUM_PROPS
} GimpContextPropType;
......@@ -57,6 +58,7 @@ typedef enum
GIMP_CONTEXT_GRADIENT_MASK = 1 << 9,
GIMP_CONTEXT_PALETTE_MASK = 1 << 10,
GIMP_CONTEXT_BUFFER_MASK = 1 << 11,
GIMP_CONTEXT_IMAGEFILE_MASK = 1 << 12,
/* aliases */
GIMP_CONTEXT_PAINT_PROPS_MASK = (GIMP_CONTEXT_FOREGROUND_MASK |
......@@ -71,6 +73,7 @@ typedef enum
GIMP_CONTEXT_TOOL_MASK |
GIMP_CONTEXT_PALETTE_MASK |
GIMP_CONTEXT_BUFFER_MASK |
GIMP_CONTEXT_IMAGEFILE_MASK |
GIMP_CONTEXT_PAINT_PROPS_MASK)
} GimpContextPropMask;
......@@ -120,6 +123,7 @@ struct _GimpContext
gchar *palette_name;
GimpBuffer *buffer;
GimpImagefile *imagefile;
};
struct _GimpContextClass
......@@ -152,6 +156,8 @@ struct _GimpContextClass
GimpPalette *palette);
void (* buffer_changed) (GimpContext *context,
GimpBuffer *buffer);
void (* imagefile_changed) (GimpContext *context,
GimpImagefile *imagefile);
};
......@@ -300,4 +306,11 @@ void gimp_context_set_buffer (GimpContext *context,
void gimp_context_buffer_changed (GimpContext *context);
/* imagefile */
GimpImagefile * gimp_context_get_imagefile (GimpContext *context);
void gimp_context_set_imagefile (GimpContext *context,
GimpImagefile *imagefile);
void gimp_context_imagefile_changed (GimpContext *context);
#endif /* __GIMP_CONTEXT_H__ */
......@@ -45,6 +45,7 @@
#include "widgets/gimpimagedock.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpdockbook.h"
#include "widgets/gimpdocumentview.h"
#include "widgets/gimpdrawablelistview.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimppreview.h"
......@@ -78,7 +79,6 @@
#include "app_procs.h"
#include "devices.h"
#include "docindex.h"
#include "gimprc.h"
#include "undo_history.h"
......@@ -205,13 +205,6 @@ dialogs_palette_select_get (GimpDialogFactory *factory,
return palette_dialog_create ();
}
GtkWidget *
dialogs_document_index_get (GimpDialogFactory *factory,
GimpContext *context)
{
return document_index_create ();
}
GtkWidget *
dialogs_preferences_get (GimpDialogFactory *factory,
GimpContext *context)
......@@ -350,6 +343,7 @@ dialogs_image_list_view_new (GimpDialogFactory *factory,
view = gimp_container_list_view_new (context->gimp->images,
context,
32,
FALSE,
5, 3);
return dialogs_dockable_new (view,
......@@ -448,6 +442,7 @@ dialogs_tool_list_view_new (GimpDialogFactory *factory,
view = gimp_container_list_view_new (context->gimp->tool_info_list,
context,
22,
FALSE,
5, 3);
return dialogs_dockable_new (view,
......@@ -487,6 +482,7 @@ dialogs_image_grid_view_new (GimpDialogFactory *factory,
view = gimp_container_grid_view_new (context->gimp->images,
context,
32,
FALSE,
5, 3);
return dialogs_dockable_new (view,
......@@ -585,6 +581,7 @@ dialogs_tool_grid_view_new (GimpDialogFactory *factory,
view = gimp_container_grid_view_new (context->gimp->tool_info_list,
context,
22,
FALSE,
5, 3);
return dialogs_dockable_new (view,
......@@ -747,15 +744,17 @@ dialogs_document_history_new (GimpDialogFactory *factory,
{
GtkWidget *view;
view = gimp_container_list_view_new (context->gimp->documents,
context,
32,
5, 3);
view = gimp_document_view_new (GIMP_VIEW_TYPE_LIST,
context->gimp->documents,
context,
32,
5, 3,
NULL);
return dialogs_dockable_new (view,
"Document History", "History",
NULL,
dialogs_set_view_context_func);
dialogs_set_editor_context_func);
}
GtkWidget *
......
......@@ -36,8 +36,6 @@ GtkWidget * dialogs_gradient_select_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_palette_select_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_document_index_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_preferences_get (GimpDialogFactory *factory,
GimpContext *context);
GtkWidget * dialogs_input_devices_get (GimpDialogFactory *factory,
......
......@@ -45,7 +45,6 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp:pattern-select-dialog", dialogs_pattern_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:gradient-select-dialog", dialogs_gradient_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:palette-select-dialog", dialogs_palette_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:document-index-dialog", dialogs_document_index_get, TRUE, TRUE, TRUE, TRUE },
{ "gimp:preferences-dialog", dialogs_preferences_get, TRUE, FALSE, FALSE, TRUE },
{ "gimp:input-devices-dialog", dialogs_input_devices_get, TRUE, FALSE, FALSE, TRUE },
{ "gimp:module-browser-dialog", dialogs_module_browser_get, TRUE, FALSE, FALSE, TRUE },
......@@ -58,8 +57,6 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp:gradient-editor", dialogs_gradient_editor_get, TRUE, TRUE, TRUE, FALSE },
{ "gimp:palette-editor", dialogs_palette_editor_get, TRUE, TRUE, TRUE, FALSE }
};
static const gint n_toplevel_entries = (sizeof (toplevel_entries) /
sizeof (toplevel_entries[0]));
static const GimpDialogFactoryEntry dock_entries[] =
{
......@@ -88,8 +85,6 @@ static const GimpDialogFactoryEntry dock_entries[] =
{ "gimp:error-console", dialogs_error_console_get, TRUE, FALSE, FALSE, TRUE }
};
static const gint n_dock_entries = (sizeof (dock_entries) /
sizeof (dock_entries[0]));
/* public functions */
......@@ -109,7 +104,7 @@ dialogs_init (Gimp *gimp)
menus_get_dialogs_factory (),
dialogs_dock_new);
for (i = 0; i < n_toplevel_entries; i++)
for (i = 0; i < G_N_ELEMENTS (toplevel_entries); i++)
gimp_dialog_factory_register_entry (global_dialog_factory,
toplevel_entries[i].identifier,
toplevel_entries[i].new_func,
......@@ -118,7 +113,7 @@ dialogs_init (Gimp *gimp)
toplevel_entries[i].remember_size,
toplevel_entries[i].remember_if_open);
for (i = 0; i < n_dock_entries; i++)
for (i = 0; i < G_N_ELEMENTS (dock_entries); i++)
gimp_dialog_factory_register_entry (global_dock_factory,
dock_entries[i].identifier,
dock_entries[i].new_func,
......@@ -134,6 +129,6 @@ dialogs_exit (Gimp *gimp)
g_object_unref (G_OBJECT (global_dialog_factory));
g_object_unref (G_OBJECT (global_dock_factory));
global_dialog_factory = NULL;
global_dock_factory = NULL;
global_dialog_factory = NULL;
global_dock_factory = NULL;
}
......@@ -53,7 +53,6 @@
#include "menus.h"
#include "app_procs.h"
#include "docindex.h"
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
......@@ -203,7 +202,6 @@ file_open_with_proc_and_display (const gchar *filename,
absolute = file_open_absolute_filename (filename);
gimp_documents_add (the_gimp, filename);