mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
99e78c7074
commit
70ce7bae9b
36
ChangeLog
36
ChangeLog
|
@ -1,3 +1,39 @@
|
|||
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);
|
||||
document_index_add (absolute);
|
||||
menus_last_opened_add (absolute);
|
||||
|
||||
g_free (absolute);
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "menus.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "docindex.h"
|
||||
#include "gimprc.h"
|
||||
#include "file-save.h"
|
||||
#include "file-utils.h"
|
||||
|
|
854
app/docindex.c
854
app/docindex.c
|
@ -1,854 +0,0 @@
|
|||
/* docindex.c - Creates the window used by the document index in go and gimp.
|
||||
*
|
||||
* Copyright (C) 1998 Chris Lahey.
|
||||
*
|
||||
* 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, 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "gui/gui-types.h"
|
||||
|
||||
#include "core/gimpobject.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
||||
#include "widgets/gimpdnd.h"
|
||||
|
||||
#include "gui/file-commands.h"
|
||||
#include "gui/file-open-dialog.h"
|
||||
|
||||
#include "docindex.h"
|
||||
#include "ops_buttons.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "pixmaps/folder.xpm"
|
||||
#include "pixmaps/raise.xpm"
|
||||
#include "pixmaps/lower.xpm"
|
||||
#include "pixmaps/delete.xpm"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *list;
|
||||
} IdeaManager;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gboolean boole;
|
||||
const gchar *string;
|
||||
gpointer data;
|
||||
} BoolCharPair;
|
||||
|
||||
|
||||
/* forward declarations */
|
||||
|
||||
static void create_idea_list (void);
|
||||
static void idea_add_in_position (const gchar *label,
|
||||
gint position);
|
||||
static void open_idea_window (void);
|
||||
static void open_or_raise (const gchar *file_name,
|
||||
gboolean try_raise);
|
||||
|
||||
static void idea_open_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void idea_open_or_raise_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void idea_up_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void idea_to_top_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void idea_down_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void idea_to_bottom_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void idea_remove_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void idea_hide_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void load_idea_manager (IdeaManager *ideas);
|
||||
static void save_idea_manager (IdeaManager *ideas);
|
||||
|
||||
static void clear_white (FILE *fp);
|
||||
static gint getinteger (FILE *fp);
|
||||
|
||||
|
||||
/* local variables */
|
||||
|
||||
static IdeaManager *ideas = NULL;
|
||||
static GList *idea_list = NULL;
|
||||
|
||||
|
||||
/* the ops buttons */
|
||||
static GCallback open_ext_callbacks[] =
|
||||
{
|
||||
G_CALLBACK (idea_open_or_raise_callback),
|
||||
G_CALLBACK (file_open_cmd_callback),
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
static GCallback raise_ext_callbacks[] =
|
||||
{
|
||||
G_CALLBACK (idea_to_top_callback),
|
||||
NULL, NULL, NULL
|
||||
};
|
||||
|
||||
static GCallback lower_ext_callbacks[] =
|
||||
{
|
||||
G_CALLBACK (idea_to_bottom_callback),
|
||||
NULL, NULL, NULL
|
||||
};
|
||||
|
||||
static OpsButton ops_buttons[] =
|
||||
{
|
||||
{ folder_xpm,
|
||||
G_CALLBACK (idea_open_callback), open_ext_callbacks,
|
||||
N_("Open the selected entry\n"
|
||||
"<Shift> Raise window if already open\n"
|
||||
"<Ctrl> Load Image dialog"), NULL,
|
||||
NULL },
|
||||
{ raise_xpm,
|
||||
G_CALLBACK (idea_up_callback), raise_ext_callbacks,
|
||||
N_("Move the selected entry up in the index\n"
|
||||
"<Shift> To top"), NULL,
|
||||
NULL },
|
||||
{ lower_xpm,
|
||||
G_CALLBACK (idea_down_callback), lower_ext_callbacks,
|
||||
N_("Move the selected entry down in the index\n"
|
||||
"<Shift> To bottom"), NULL,
|
||||
NULL },
|
||||
{ delete_xpm,
|
||||
G_CALLBACK (idea_remove_callback), NULL,
|
||||
N_("Remove the selected entry from the index"), NULL,
|
||||
NULL },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
/* dnd stuff */
|
||||
|
||||
static GtkTargetEntry drag_types[] =
|
||||
{
|
||||
GIMP_TARGET_URI_LIST,
|
||||
GIMP_TARGET_TEXT_PLAIN,
|
||||
GIMP_TARGET_NETSCAPE_URL
|
||||
};
|
||||
static gint n_drag_types = sizeof (drag_types) / sizeof (drag_types[0]);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GtkWidget *
|
||||
document_index_create (void)
|
||||
{
|
||||
if (ideas)
|
||||
gdk_window_raise (ideas->window->window);
|
||||
else
|
||||
open_idea_window ();
|
||||
|
||||
return ideas->window;
|
||||
}
|
||||
|
||||
void
|
||||
document_index_free (void)
|
||||
{
|
||||
idea_hide_callback (NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
document_index_add (const gchar *title)
|
||||
{
|
||||
idea_add_in_position (title, 0);
|
||||
}
|
||||
|
||||
FILE *
|
||||
document_index_parse_init (void)
|
||||
{
|
||||
FILE *fp;
|
||||
gchar *desktopfile;
|
||||
gint dummy;
|
||||
|
||||
desktopfile = gimp_personal_rc_file ("ideas");
|
||||
|
||||
fp = fopen (desktopfile, "r");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
/* eventually strip away the old file format's first line */
|
||||
if (fscanf (fp, "%i %i %i %i", &dummy, &dummy, &dummy, &dummy) != 4)
|
||||
{
|
||||
fclose (fp);
|
||||
fp = fopen (desktopfile, "r");
|
||||
}
|
||||
}
|
||||
|
||||
g_free (desktopfile);
|
||||
|
||||
return fp;
|
||||
}
|
||||
|
||||
gchar *
|
||||
document_index_parse_line (FILE * fp)
|
||||
{
|
||||
gint length;
|
||||
gchar *filename;
|
||||
|
||||
length = getinteger (fp);
|
||||
|
||||
if (!feof (fp) && !ferror (fp))
|
||||
{
|
||||
filename = g_malloc0 (length + 1);
|
||||
filename[fread (filename, 1, length, fp)] = 0;
|
||||
clear_white (fp);
|
||||
return filename;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* local functions */
|
||||
|
||||
static void
|
||||
load_from_list (gpointer data,
|
||||
gpointer data_null)
|
||||
{
|
||||
idea_add_in_position ((const gchar *) data, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
load_idea_manager (IdeaManager *ideas)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
|
||||
if (! idea_list)
|
||||
fp = document_index_parse_init ();
|
||||
|
||||
if (idea_list || fp)
|
||||
{
|
||||
gtk_widget_show (ideas->window);
|
||||
|
||||
if (fp)
|
||||
{
|
||||
gchar *title;
|
||||
|
||||
clear_white (fp);
|
||||
|
||||
while ((title = document_index_parse_line (fp)))
|
||||
{
|
||||
idea_add_in_position (title, -1);
|
||||
g_free (title);
|
||||
}
|
||||
fclose (fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_list_foreach (idea_list, load_from_list, NULL);
|
||||
g_list_foreach (idea_list, (GFunc) g_free, NULL);
|
||||
g_list_free (idea_list);
|
||||
idea_list = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_show (ideas->window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
save_to_ideas (gpointer data,
|
||||
gpointer user_data)
|
||||
{
|
||||
gchar *title;
|
||||
|
||||
title = GTK_LABEL (GTK_BIN (data)->child)->label;
|
||||
|
||||
fprintf ((FILE *) user_data, "%d %s\n", strlen (title), title);
|
||||
}
|
||||
|
||||
static void
|
||||
save_list_to_ideas (gpointer data,
|
||||
gpointer user_data)
|
||||
{
|
||||
gchar *title;
|
||||
|
||||
title = (gchar *) data;
|
||||
|
||||
fprintf ((FILE *) user_data, "%d %s\n", strlen (title), title);
|
||||
}
|
||||
|
||||
static void
|
||||
save_idea_manager (IdeaManager *ideas)
|
||||
{
|
||||
FILE *fp;
|
||||
gchar *desktopfile;
|
||||
|
||||
/* open persistant desktop file. */
|
||||
desktopfile = gimp_personal_rc_file ("ideas");
|
||||
fp = fopen (desktopfile, "w");
|
||||
g_free (desktopfile);
|
||||
|
||||
if (fp)
|
||||
{
|
||||
if (ideas)
|
||||
{
|
||||
g_list_foreach (GTK_LIST (ideas->list)->children, save_to_ideas, fp);
|
||||
}
|
||||
else if (idea_list)
|
||||
{
|
||||
g_list_foreach (idea_list, save_list_to_ideas, fp);
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
save_to_list (gpointer data,
|
||||
gpointer null_data)
|
||||
{
|
||||
gchar *title;
|
||||
|
||||
title = g_strdup (GTK_LABEL (GTK_BIN (data)->child)->label);
|
||||
|
||||
idea_list = g_list_append (idea_list, title);
|
||||
}
|
||||
|
||||
static void
|
||||
create_idea_list (void)
|
||||
{
|
||||
if (idea_list)
|
||||
{
|
||||
g_list_foreach (idea_list, (GFunc) g_free, NULL);
|
||||
g_list_free (idea_list);
|
||||
idea_list = 0;
|
||||
}
|
||||
|
||||
g_list_foreach (GTK_LIST (ideas->list)->children, save_to_list, NULL);
|
||||
}
|
||||
|
||||
static gint
|
||||
list_item_callback (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
if (GTK_IS_LIST_ITEM (widget) &&
|
||||
event->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
open_or_raise (GTK_LABEL (GTK_BIN (widget)->child)->label, FALSE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
check_needed (gpointer data,
|
||||
gpointer user_data)
|
||||
{
|
||||
BoolCharPair *pair;
|
||||
|
||||
pair = (BoolCharPair *) user_data;
|
||||
|
||||
if (strcmp (pair->string, GTK_LABEL (GTK_BIN (data)->child)->label) == 0)
|
||||
{
|
||||
pair->boole = TRUE;
|
||||
pair->data = data;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_needed_list (gpointer data,
|
||||
gpointer user_data)
|
||||
{
|
||||
BoolCharPair *pair;
|
||||
|
||||
pair = (BoolCharPair *) user_data;
|
||||
|
||||
if (strcmp (pair->string, (gchar *) data) == 0)
|
||||
{
|
||||
pair->boole = TRUE;
|
||||
pair->data = data;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_add_in_position_with_select (const gchar *title,
|
||||
gint position,
|
||||
gboolean select)
|
||||
{
|
||||
BoolCharPair pair;
|
||||
|
||||
pair.boole = FALSE;
|
||||
pair.string = title;
|
||||
pair.data = NULL;
|
||||
|
||||
if (ideas)
|
||||
{
|
||||
g_list_foreach (GTK_LIST (ideas->list)->children, check_needed, &pair);
|
||||
|
||||
if (! pair.boole)
|
||||
{
|
||||
GtkWidget *listitem;
|
||||
GList *list = NULL;
|
||||
|
||||
listitem = gtk_list_item_new_with_label (title);
|
||||
list = g_list_append (list, listitem);
|
||||
|
||||
if (position < 0)
|
||||
gtk_list_append_items (GTK_LIST (ideas->list), list);
|
||||
else
|
||||
gtk_list_insert_items (GTK_LIST (ideas->list), list, position);
|
||||
|
||||
g_signal_connect (G_OBJECT (listitem), "button_press_event",
|
||||
G_CALLBACK (list_item_callback),
|
||||
NULL);
|
||||
|
||||
gtk_widget_show (listitem);
|
||||
|
||||
if (select)
|
||||
gtk_list_item_select (GTK_LIST_ITEM (listitem));
|
||||
}
|
||||
else /* move entry to top */
|
||||
{
|
||||
gchar *title;
|
||||
|
||||
title = g_strdup (GTK_LABEL (GTK_BIN (pair.data)->child)->label);
|
||||
gtk_container_remove (GTK_CONTAINER (ideas->list),
|
||||
GTK_WIDGET (pair.data));
|
||||
idea_add_in_position_with_select (title, 0, TRUE);
|
||||
g_free (title);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! idea_list)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = document_index_parse_init ();
|
||||
|
||||
if (fp)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
while ((filename = document_index_parse_line (fp)))
|
||||
{
|
||||
idea_list = g_list_append (idea_list, g_strdup (filename));
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
}
|
||||
|
||||
g_list_foreach (idea_list, check_needed_list, &pair);
|
||||
|
||||
if (! pair.boole)
|
||||
{
|
||||
if (position < 0)
|
||||
idea_list = g_list_prepend (idea_list, g_strdup (title));
|
||||
else
|
||||
idea_list = g_list_insert (idea_list, g_strdup (title), position);
|
||||
}
|
||||
else /* move entry to top */
|
||||
{
|
||||
idea_list = g_list_remove (idea_list, pair.data);
|
||||
g_free (pair.data);
|
||||
idea_list = g_list_prepend (idea_list, g_strdup (title));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_add_in_position (const gchar *title,
|
||||
gint position)
|
||||
{
|
||||
idea_add_in_position_with_select (title, position, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
raise_if_match (gpointer data,
|
||||
gpointer user_data)
|
||||
{
|
||||
GDisplay *gdisp;
|
||||
BoolCharPair *pair;
|
||||
const gchar *filename;
|
||||
|
||||
gdisp = (GDisplay *) data;
|
||||
pair = (BoolCharPair *) user_data;
|
||||
|
||||
filename = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
|
||||
|
||||
if (filename &&
|
||||
strcmp (pair->string, filename) == 0)
|
||||
{
|
||||
pair->boole = TRUE;
|
||||
gdk_window_raise (gdisp->shell->window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
open_or_raise (const gchar *file_name,
|
||||
gboolean try_raise)
|
||||
{
|
||||
BoolCharPair pair;
|
||||
|
||||
pair.boole = FALSE;
|
||||
pair.string = file_name;
|
||||
pair.data = NULL;
|
||||
|
||||
if (try_raise)
|
||||
{
|
||||
gdisplays_foreach (raise_if_match, &pair);
|
||||
|
||||
if (! pair.boole)
|
||||
{
|
||||
file_open_with_display (file_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
file_open_with_display (file_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* file parsing functions */
|
||||
|
||||
static gint
|
||||
getinteger (FILE *fp)
|
||||
{
|
||||
gchar nextchar;
|
||||
gint response = 0;
|
||||
gboolean negative = FALSE;
|
||||
|
||||
while (isspace (nextchar = fgetc (fp)))
|
||||
/* empty statement */ ;
|
||||
|
||||
if (nextchar == '-')
|
||||
{
|
||||
negative = TRUE;
|
||||
while (isspace (nextchar = fgetc (fp)))
|
||||
/* empty statement */ ;
|
||||
}
|
||||
|
||||
for (; '0' <= nextchar && '9' >= nextchar; nextchar = fgetc (fp))
|
||||
{
|
||||
response *= 10;
|
||||
response += nextchar - '0';
|
||||
}
|
||||
for (; isspace (nextchar); nextchar = fgetc (fp))
|
||||
/* empty statement */ ;
|
||||
|
||||
if (!feof(fp))
|
||||
ungetc (nextchar, fp);
|
||||
if (negative)
|
||||
response = -response;
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
static void
|
||||
clear_white (FILE *fp)
|
||||
{
|
||||
gint nextchar;
|
||||
|
||||
while (isspace (nextchar = fgetc (fp)))
|
||||
/* empty statement */ ;
|
||||
|
||||
if (!feof(fp))
|
||||
ungetc (nextchar, fp);
|
||||
}
|
||||
|
||||
|
||||
/* toolbar / dialog callbacks */
|
||||
|
||||
static gint
|
||||
idea_move (GtkWidget *widget,
|
||||
gint distance,
|
||||
gboolean select)
|
||||
{
|
||||
gint orig_position;
|
||||
gint position;
|
||||
gchar *title;
|
||||
|
||||
orig_position = g_list_index (GTK_LIST (ideas->list)->children, widget);
|
||||
position = orig_position + distance;
|
||||
|
||||
if (position < 0)
|
||||
position = 0;
|
||||
|
||||
if (position >= g_list_length (GTK_LIST (ideas->list)->children))
|
||||
position = g_list_length (GTK_LIST (ideas->list)->children) - 1;
|
||||
|
||||
if (position != orig_position)
|
||||
{
|
||||
title = g_strdup (GTK_LABEL (GTK_BIN (widget)->child)->label);
|
||||
gtk_container_remove (GTK_CONTAINER (ideas->list), widget);
|
||||
idea_add_in_position_with_select (title, position, select);
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
return position - orig_position;
|
||||
}
|
||||
|
||||
static void
|
||||
idea_open_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *selected;
|
||||
|
||||
if (GTK_LIST (ideas->list)->selection)
|
||||
{
|
||||
selected = GTK_LIST (ideas->list)->selection->data;
|
||||
open_or_raise (GTK_LABEL (GTK_BIN (selected)->child)->label, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
file_open_dialog_show ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_open_or_raise_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *selected;
|
||||
|
||||
if (GTK_LIST (ideas->list)->selection)
|
||||
{
|
||||
selected = GTK_LIST (ideas->list)->selection->data;
|
||||
open_or_raise (GTK_LABEL (GTK_BIN (selected)->child)->label, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
file_open_dialog_show ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_up_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *selected;
|
||||
|
||||
if (GTK_LIST (ideas->list)->selection)
|
||||
{
|
||||
selected = GTK_LIST (ideas->list)->selection->data;
|
||||
idea_move (selected, -1, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_to_top_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *selected;
|
||||
|
||||
if (GTK_LIST (ideas->list)->selection)
|
||||
{
|
||||
selected = GTK_LIST (ideas->list)->selection->data;
|
||||
idea_move (selected, - g_list_length (GTK_LIST (ideas->list)->children),
|
||||
TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_down_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *selected;
|
||||
|
||||
if (GTK_LIST (ideas->list)->selection)
|
||||
{
|
||||
selected = GTK_LIST (ideas->list)->selection->data;
|
||||
idea_move (selected, 1, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_to_bottom_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *selected;
|
||||
|
||||
if (GTK_LIST (ideas->list)->selection)
|
||||
{
|
||||
selected = GTK_LIST (ideas->list)->selection->data;
|
||||
idea_move (selected, g_list_length (GTK_LIST (ideas->list)->children),
|
||||
TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_remove (GtkWidget *widget)
|
||||
{
|
||||
gint position;
|
||||
|
||||
position = g_list_index (GTK_LIST (ideas->list)->children, widget);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (ideas->list), widget);
|
||||
|
||||
if (g_list_length (GTK_LIST (ideas->list)->children) - 1 < position)
|
||||
position = g_list_length (GTK_LIST (ideas->list)->children) - 1;
|
||||
|
||||
gtk_list_select_item (GTK_LIST (ideas->list), position);
|
||||
}
|
||||
|
||||
static void
|
||||
idea_remove_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *selected;
|
||||
|
||||
if (GTK_LIST (ideas->list)->selection)
|
||||
{
|
||||
selected = GTK_LIST (ideas->list)->selection->data;
|
||||
idea_remove (selected);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
idea_hide_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
if (ideas || idea_list)
|
||||
save_idea_manager (ideas);
|
||||
|
||||
/* False if exiting */
|
||||
if (ideas)
|
||||
{
|
||||
create_idea_list ();
|
||||
|
||||
gtk_widget_destroy (ideas->window);
|
||||
g_free (ideas);
|
||||
ideas = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ops_buttons_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *selected = NULL;
|
||||
gint length = 0;
|
||||
gint index = -1;
|
||||
|
||||
length = g_list_length (GTK_LIST (ideas->list)->children);
|
||||
|
||||
if (GTK_LIST (ideas->list)->selection)
|
||||
{
|
||||
selected = GTK_LIST (ideas->list)->selection->data;
|
||||
index = g_list_index (GTK_LIST (ideas->list)->children, selected);
|
||||
}
|
||||
|
||||
#define SET_OPS_SENSITIVE(button,condition) \
|
||||
gtk_widget_set_sensitive (ops_buttons[(button)].widget, \
|
||||
(condition) != 0)
|
||||
|
||||
SET_OPS_SENSITIVE (1, selected && index > 0);
|
||||
SET_OPS_SENSITIVE (2, selected && index < (length - 1));
|
||||
SET_OPS_SENSITIVE (3, selected);
|
||||
|
||||
#undef SET_OPS_SENSITIVE
|
||||
}
|
||||
|
||||
static void
|
||||
open_idea_window (void)
|
||||
{
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *scrolled_win;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *button_box;
|
||||
gint i;
|
||||
|
||||
ideas = g_new0 (IdeaManager, 1);
|
||||
|
||||
ideas->window = gimp_dialog_new (_("Document Index"), "docindex",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/document_index.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
GTK_STOCK_CLOSE, idea_hide_callback,
|
||||
NULL, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_drag_dest_set (ideas->window,
|
||||
GTK_DEST_DEFAULT_ALL,
|
||||
drag_types, n_drag_types,
|
||||
GDK_ACTION_COPY);
|
||||
|
||||
gimp_dnd_file_dest_set (ideas->window, gimp_dnd_open_files, NULL);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (ideas->window)->vbox),
|
||||
main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
/* Scrolled window */
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrolled_win);
|
||||
|
||||
/* Setup list */
|
||||
ideas->list = gtk_list_new ();
|
||||
gtk_list_set_selection_mode (GTK_LIST (ideas->list), GTK_SELECTION_BROWSE);
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
ideas->list);
|
||||
gtk_widget_show (ideas->list);
|
||||
|
||||
/* The ops buttons */
|
||||
abox = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (ideas->window)->action_area), abox,
|
||||
FALSE, FALSE, 4);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
button_box = ops_button_box_new (ops_buttons, OPS_BUTTON_NORMAL);
|
||||
gtk_container_add (GTK_CONTAINER (abox), button_box);
|
||||
gtk_widget_show (button_box);
|
||||
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
if (ops_buttons[i].widget == NULL)
|
||||
break;
|
||||
|
||||
gtk_misc_set_padding (GTK_MISC (GTK_BIN (ops_buttons[i].widget)->child),
|
||||
12, 0);
|
||||
}
|
||||
|
||||
/* Load and Show window */
|
||||
load_idea_manager (ideas);
|
||||
|
||||
g_signal_connect (G_OBJECT (ideas->list), "selection_changed",
|
||||
G_CALLBACK (ops_buttons_update),
|
||||
NULL);
|
||||
|
||||
ops_buttons_update (NULL, NULL);
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/* docindex.h - Header file for the document index.
|
||||
*
|
||||
* Copyright (C) 1998 Chris Lahey.
|
||||
*
|
||||
* 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, 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.
|
||||
*/
|
||||
|
||||
#ifndef __DOCINDEX_H__
|
||||
#define __DOCINDEX_H__
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
GtkWidget * document_index_create (void);
|
||||
void document_index_free (void);
|
||||
|
||||
void document_index_add (const gchar *label);
|
||||
|
||||
FILE * document_index_parse_init (void);
|
||||
gchar * document_index_parse_line (FILE *fp);
|
||||
|
||||
|
||||
#endif /* __DOCINDEX_H__ */
|
|
@ -69,7 +69,6 @@
|
|||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "docindex.h"
|
||||
#include "gui/menus.h"
|
||||
|
||||
#include "file-save.h"
|
||||
|
@ -178,7 +177,6 @@ file_save (GimpImage *gimage,
|
|||
gimp_image_clean_all (gimage);
|
||||
|
||||
gimp_documents_add (gimage->gimp, filename);
|
||||
document_index_add (filename);
|
||||
menus_last_opened_add (filename);
|
||||
|
||||
/* use the same plug-in for this image next time */
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "docindex.h"
|
||||
#include "gui/menus.h"
|
||||
|
||||
#include "file-save.h"
|
||||
|
@ -178,7 +177,6 @@ file_save (GimpImage *gimage,
|
|||
gimp_image_clean_all (gimage);
|
||||
|
||||
gimp_documents_add (gimage->gimp, filename);
|
||||
document_index_add (filename);
|
||||
menus_last_opened_add (filename);
|
||||
|
||||
/* use the same plug-in for this image next time */
|
||||
|
|
|
@ -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);
|
||||
document_index_add (absolute);
|
||||
menus_last_opened_add (absolute);
|
||||
|
||||
g_free (absolute);
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "menus.h"
|
||||
|
||||
#include "app_procs.h"
|
||||
#include "docindex.h"
|
||||
#include "gimprc.h"
|
||||
#include "file-save.h"
|
||||
#include "file-utils.h"
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "color-select.h"
|
||||
#include "devices.h"
|
||||
#include "dialogs.h"
|
||||
#include "docindex.h"
|
||||
#include "file-open-dialog.h"
|
||||
#include "file-save-dialog.h"
|
||||
#include "gradient-select.h"
|
||||
|
@ -292,31 +291,22 @@ gui_init (Gimp *gimp)
|
|||
gimp_dialog_factory_dialog_new (global_dialog_factory, "gimp:toolbox");
|
||||
|
||||
/* Fill the "last opened" menu items with the first last_opened_size
|
||||
* elements of the docindex
|
||||
* elements of gimp->documents
|
||||
*/
|
||||
{
|
||||
FILE *fp;
|
||||
gchar **filenames = g_new0 (gchar *, gimprc.last_opened_size);
|
||||
gint i;
|
||||
GimpImagefile *imagefile;
|
||||
gint i;
|
||||
|
||||
if ((fp = document_index_parse_init ()))
|
||||
for (i = gimprc.last_opened_size - 1; i >= 0; i--)
|
||||
{
|
||||
/* read the filenames... */
|
||||
for (i = 0; i < gimprc.last_opened_size; i++)
|
||||
if ((filenames[i] = document_index_parse_line (fp)) == NULL)
|
||||
break;
|
||||
imagefile = (GimpImagefile *)
|
||||
gimp_container_get_child_by_index (gimp->documents, i);
|
||||
|
||||
/* ...and add them in reverse order */
|
||||
for (--i; i >= 0; i--)
|
||||
{
|
||||
menus_last_opened_add (filenames[i]);
|
||||
g_free (filenames[i]);
|
||||
}
|
||||
if (! imagefile)
|
||||
continue;
|
||||
|
||||
fclose (fp);
|
||||
menus_last_opened_add (gimp_object_get_name (GIMP_OBJECT (imagefile)));
|
||||
}
|
||||
|
||||
g_free (filenames);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,7 +354,6 @@ gui_exit (Gimp *gimp)
|
|||
dialogs_exit (gimp);
|
||||
|
||||
/* handle this in the dialog factory: */
|
||||
document_index_free ();
|
||||
tool_options_dialog_free ();
|
||||
toolbox_free ();
|
||||
|
||||
|
|
|
@ -243,9 +243,9 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
|
||||
SEPARATOR ("/File/Dialogs/---"),
|
||||
|
||||
{ { N_("/File/Dialogs/Document Index..."), NULL,
|
||||
dialogs_create_toplevel_cmd_callback, 0 },
|
||||
"gimp:document-index-dialog",
|
||||
{ { N_("/File/Dialogs/Document History..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
"gimp:document-history",
|
||||
"file/dialogs/document_index.html", NULL },
|
||||
{ { N_("/File/Dialogs/Error Console..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
|
@ -866,9 +866,9 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
|
||||
SEPARATOR ("/Dialogs/---"),
|
||||
|
||||
{ { N_("/Dialogs/Document Index..."), NULL,
|
||||
dialogs_create_toplevel_cmd_callback, 0 },
|
||||
"gimp:document-index-dialog",
|
||||
{ { N_("/Dialogs/Document History..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
"gimp:document-history",
|
||||
"dialogs/document_index.html", NULL },
|
||||
{ { N_("/Dialogs/Error Console..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
|
|
|
@ -134,6 +134,7 @@ container_multi_view_new (gboolean list,
|
|||
view = gimp_container_list_view_new (container,
|
||||
context,
|
||||
preview_size,
|
||||
FALSE,
|
||||
5, 5);
|
||||
}
|
||||
else
|
||||
|
@ -141,6 +142,7 @@ container_multi_view_new (gboolean list,
|
|||
view = gimp_container_grid_view_new (container,
|
||||
context,
|
||||
preview_size,
|
||||
FALSE,
|
||||
5, 5);
|
||||
}
|
||||
|
||||
|
|
|
@ -243,9 +243,9 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
|
||||
SEPARATOR ("/File/Dialogs/---"),
|
||||
|
||||
{ { N_("/File/Dialogs/Document Index..."), NULL,
|
||||
dialogs_create_toplevel_cmd_callback, 0 },
|
||||
"gimp:document-index-dialog",
|
||||
{ { N_("/File/Dialogs/Document History..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
"gimp:document-history",
|
||||
"file/dialogs/document_index.html", NULL },
|
||||
{ { N_("/File/Dialogs/Error Console..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
|
@ -866,9 +866,9 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
|
||||
SEPARATOR ("/Dialogs/---"),
|
||||
|
||||
{ { N_("/Dialogs/Document Index..."), NULL,
|
||||
dialogs_create_toplevel_cmd_callback, 0 },
|
||||
"gimp:document-index-dialog",
|
||||
{ { N_("/Dialogs/Document History..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
"gimp:document-history",
|
||||
"dialogs/document_index.html", NULL },
|
||||
{ { N_("/Dialogs/Error Console..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
|
|
|
@ -48,6 +48,8 @@ libappwidgets_a_SOURCES = @STRIP_BEGIN@ \
|
|||
gimpdockable.h \
|
||||
gimpdockbook.c \
|
||||
gimpdockbook.h \
|
||||
gimpdocumentview.c \
|
||||
gimpdocumentview.h \
|
||||
gimpdrawablelistitem.c \
|
||||
gimpdrawablelistitem.h \
|
||||
gimpdrawablelistview.c \
|
||||
|
|
|
@ -132,6 +132,7 @@ gimp_buffer_view_new (GimpViewType view_type,
|
|||
container,
|
||||
context,
|
||||
preview_size,
|
||||
TRUE, /* reorderable */
|
||||
min_items_x,
|
||||
min_items_y,
|
||||
context_func))
|
||||
|
|
|
@ -109,6 +109,7 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
|
|||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gboolean reorderable,
|
||||
gint min_items_x,
|
||||
gint min_items_y,
|
||||
GimpContainerContextFunc context_func)
|
||||
|
@ -130,6 +131,7 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
|
|||
GIMP_CONTAINER_VIEW (gimp_container_grid_view_new (container,
|
||||
context,
|
||||
preview_size,
|
||||
reorderable,
|
||||
min_items_x,
|
||||
min_items_y));
|
||||
break;
|
||||
|
@ -139,6 +141,7 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
|
|||
GIMP_CONTAINER_VIEW (gimp_container_list_view_new (container,
|
||||
context,
|
||||
preview_size,
|
||||
reorderable,
|
||||
min_items_x,
|
||||
min_items_y));
|
||||
break;
|
||||
|
|
|
@ -78,6 +78,7 @@ gboolean gimp_container_editor_construct (GimpContainerEditor *editor,
|
|||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gboolean reorderable,
|
||||
gint min_items_x,
|
||||
gint min_items_y,
|
||||
GimpContainerContextFunc context_func);
|
||||
|
|
|
@ -167,6 +167,7 @@ GtkWidget *
|
|||
gimp_container_grid_view_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gboolean reorderable,
|
||||
gint min_items_x,
|
||||
gint min_items_y)
|
||||
{
|
||||
|
@ -185,6 +186,7 @@ gimp_container_grid_view_new (GimpContainer *container,
|
|||
view = GIMP_CONTAINER_VIEW (grid_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = reorderable ? TRUE : FALSE;
|
||||
|
||||
window_border =
|
||||
GTK_SCROLLED_WINDOW (grid_view->scrolled_win)->vscrollbar->requisition.width +
|
||||
|
|
|
@ -57,6 +57,7 @@ GType gimp_container_grid_view_get_type (void);
|
|||
GtkWidget * gimp_container_grid_view_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gboolean reorderable,
|
||||
gint min_items_x,
|
||||
gint min_items_y);
|
||||
|
||||
|
|
|
@ -152,6 +152,7 @@ GtkWidget *
|
|||
gimp_container_list_view_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gboolean reorderable,
|
||||
gint min_items_x,
|
||||
gint min_items_y)
|
||||
{
|
||||
|
@ -170,6 +171,7 @@ gimp_container_list_view_new (GimpContainer *container,
|
|||
view = GIMP_CONTAINER_VIEW (list_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = reorderable ? TRUE : FALSE;
|
||||
|
||||
window_border =
|
||||
GTK_SCROLLED_WINDOW (list_view->scrolled_win)->vscrollbar->requisition.width +
|
||||
|
@ -207,6 +209,10 @@ gimp_container_list_view_insert_item (GimpContainerView *view,
|
|||
gimp_list_item_set_name_func (GIMP_LIST_ITEM (list_item),
|
||||
view->get_name_func);
|
||||
|
||||
if (view->reorderable)
|
||||
gimp_list_item_set_reorderable (GIMP_LIST_ITEM (list_item), TRUE,
|
||||
view->container);
|
||||
|
||||
g_signal_connect (G_OBJECT (list_item), "button_press_event",
|
||||
G_CALLBACK (gimp_container_list_view_item_activated),
|
||||
list_view);
|
||||
|
|
|
@ -55,6 +55,7 @@ GType gimp_container_list_view_get_type (void);
|
|||
GtkWidget * gimp_container_list_view_new (GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gboolean reorderable,
|
||||
gint min_items_x,
|
||||
gint min_items_y);
|
||||
|
||||
|
|
|
@ -195,14 +195,18 @@ gimp_container_view_class_init (GimpContainerViewClass *klass)
|
|||
static void
|
||||
gimp_container_view_init (GimpContainerView *view)
|
||||
{
|
||||
view->container = NULL;
|
||||
view->context = NULL;
|
||||
view->container = NULL;
|
||||
view->context = NULL;
|
||||
|
||||
view->hash_table = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
view->hash_table = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
|
||||
view->preview_size = 0;
|
||||
view->preview_size = 0;
|
||||
view->reorderable = FALSE;
|
||||
|
||||
view->button_box = NULL;
|
||||
view->get_name_func = NULL;
|
||||
|
||||
view->button_box = NULL;
|
||||
view->dnd_widget = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -46,6 +46,7 @@ struct _GimpContainerView
|
|||
GHashTable *hash_table;
|
||||
|
||||
gint preview_size;
|
||||
gboolean reorderable;
|
||||
|
||||
GimpItemGetNameFunc get_name_func;
|
||||
|
||||
|
|
|
@ -165,9 +165,7 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
|
|||
{
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
g_return_val_if_fail (factory_view != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), FALSE);
|
||||
g_return_val_if_fail (factory != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), FALSE);
|
||||
g_return_val_if_fail (preview_size > 0 && preview_size <= 64, FALSE);
|
||||
g_return_val_if_fail (min_items_x > 0 && min_items_x <= 64, FALSE);
|
||||
|
@ -181,6 +179,7 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
|
|||
factory->container,
|
||||
context,
|
||||
preview_size,
|
||||
FALSE, /* reorderable */
|
||||
min_items_x,
|
||||
min_items_y,
|
||||
context_func))
|
||||
|
|
|
@ -0,0 +1,351 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdocumentview.c
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* 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 "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpedit.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimagefile.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplay-foreach.h"
|
||||
|
||||
#include "gui/file-open-dialog.h"
|
||||
|
||||
#include "gimpcontainerview.h"
|
||||
#include "gimpdocumentview.h"
|
||||
#include "gimpdnd.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void gimp_document_view_class_init (GimpDocumentViewClass *klass);
|
||||
static void gimp_document_view_init (GimpDocumentView *view);
|
||||
|
||||
static void gimp_document_view_open_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view);
|
||||
static void gimp_document_view_open_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDocumentView *view);
|
||||
static void gimp_document_view_delete_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view);
|
||||
static void gimp_document_view_refresh_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view);
|
||||
|
||||
static void gimp_document_view_select_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable);
|
||||
static void gimp_document_view_activate_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable);
|
||||
|
||||
|
||||
static GimpContainerEditorClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_document_view_get_type (void)
|
||||
{
|
||||
static GType view_type = 0;
|
||||
|
||||
if (! view_type)
|
||||
{
|
||||
static const GTypeInfo view_info =
|
||||
{
|
||||
sizeof (GimpDocumentViewClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_document_view_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpDocumentView),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_document_view_init,
|
||||
};
|
||||
|
||||
view_type = g_type_register_static (GIMP_TYPE_CONTAINER_EDITOR,
|
||||
"GimpDocumentView",
|
||||
&view_info, 0);
|
||||
}
|
||||
|
||||
return view_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_class_init (GimpDocumentViewClass *klass)
|
||||
{
|
||||
GimpContainerEditorClass *editor_class;
|
||||
|
||||
editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
editor_class->select_item = gimp_document_view_select_item;
|
||||
editor_class->activate_item = gimp_document_view_activate_item;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_init (GimpDocumentView *view)
|
||||
{
|
||||
view->open_button = NULL;
|
||||
view->delete_button = NULL;
|
||||
view->refresh_button = NULL;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_document_view_new (GimpViewType view_type,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gint min_items_x,
|
||||
gint min_items_y,
|
||||
GimpContainerContextFunc context_func)
|
||||
{
|
||||
GimpDocumentView *document_view;
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
document_view = g_object_new (GIMP_TYPE_DOCUMENT_VIEW, NULL);
|
||||
|
||||
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (document_view),
|
||||
view_type,
|
||||
container,
|
||||
context,
|
||||
preview_size,
|
||||
TRUE, /* reorderable */
|
||||
min_items_x,
|
||||
min_items_y,
|
||||
context_func))
|
||||
{
|
||||
g_object_unref (G_OBJECT (document_view));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (document_view);
|
||||
|
||||
document_view->open_button =
|
||||
gimp_container_view_add_button (editor->view,
|
||||
GTK_STOCK_OPEN,
|
||||
_("Open the selected entry\n"
|
||||
"<Shift> Raise window if already open\n"
|
||||
"<Ctrl> Open image dialog"),
|
||||
NULL,
|
||||
G_CALLBACK (gimp_document_view_open_clicked),
|
||||
G_CALLBACK (gimp_document_view_open_extended_clicked),
|
||||
editor);
|
||||
|
||||
document_view->delete_button =
|
||||
gimp_container_view_add_button (editor->view,
|
||||
GIMP_STOCK_DELETE,
|
||||
_("Remove selected entry"), NULL,
|
||||
G_CALLBACK (gimp_document_view_delete_clicked),
|
||||
NULL,
|
||||
editor);
|
||||
|
||||
document_view->refresh_button =
|
||||
gimp_container_view_add_button (editor->view,
|
||||
GIMP_STOCK_REFRESH,
|
||||
_("Refresh (check files for existence)"),
|
||||
NULL,
|
||||
G_CALLBACK (gimp_document_view_refresh_clicked),
|
||||
NULL,
|
||||
editor);
|
||||
|
||||
/* set button sensitivity */
|
||||
if (GIMP_CONTAINER_EDITOR_GET_CLASS (editor)->select_item)
|
||||
GIMP_CONTAINER_EDITOR_GET_CLASS (editor)->select_item
|
||||
(editor, (GimpViewable *) gimp_context_get_imagefile (context));
|
||||
|
||||
gimp_container_view_enable_dnd (editor->view,
|
||||
GTK_BUTTON (document_view->open_button),
|
||||
GIMP_TYPE_IMAGEFILE);
|
||||
gimp_container_view_enable_dnd (editor->view,
|
||||
GTK_BUTTON (document_view->delete_button),
|
||||
GIMP_TYPE_IMAGEFILE);
|
||||
|
||||
return GTK_WIDGET (document_view);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_open_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
|
||||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
{
|
||||
file_open_with_display (gimp_object_get_name (GIMP_OBJECT (imagefile)));
|
||||
}
|
||||
else
|
||||
{
|
||||
file_open_dialog_show ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
typedef struct _RaiseClosure RaiseClosure;
|
||||
|
||||
struct _RaiseClosure
|
||||
{
|
||||
const gchar *name;
|
||||
gboolean found;
|
||||
};
|
||||
|
||||
static void
|
||||
gimp_document_view_raise_display (gpointer data,
|
||||
gpointer user_data)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
RaiseClosure *closure;
|
||||
const gchar *filename;
|
||||
|
||||
gdisp = (GimpDisplay *) data;
|
||||
closure = (RaiseClosure *) user_data;
|
||||
|
||||
filename = gimp_object_get_name (GIMP_OBJECT (gdisp->gimage));
|
||||
|
||||
if (filename && ! strcmp (closure->name, filename))
|
||||
{
|
||||
closure->found = TRUE;
|
||||
gdk_window_raise (gdisp->shell->window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_open_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
|
||||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
{
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
{
|
||||
file_open_dialog_show ();
|
||||
}
|
||||
else if (state & GDK_SHIFT_MASK)
|
||||
{
|
||||
RaiseClosure closure;
|
||||
|
||||
closure.name = gimp_object_get_name (GIMP_OBJECT (imagefile));
|
||||
closure.found = FALSE;
|
||||
|
||||
gdisplays_foreach (gimp_document_view_raise_display, &closure);
|
||||
|
||||
if (! closure.found)
|
||||
{
|
||||
file_open_with_display (closure.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
file_open_dialog_show ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_delete_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
GimpImagefile *imagefile;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
imagefile = gimp_context_get_imagefile (editor->view->context);
|
||||
|
||||
if (imagefile && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (imagefile)))
|
||||
{
|
||||
gimp_container_remove (editor->view->container,
|
||||
GIMP_OBJECT (imagefile));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_refresh_clicked (GtkWidget *widget,
|
||||
GimpDocumentView *view)
|
||||
{
|
||||
GimpContainerEditor *editor;
|
||||
|
||||
editor = GIMP_CONTAINER_EDITOR (view);
|
||||
|
||||
g_print ("refresh clicked\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_select_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpDocumentView *view;
|
||||
|
||||
gboolean delete_sensitive = FALSE;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
|
||||
|
||||
view = GIMP_DOCUMENT_VIEW (editor);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
{
|
||||
delete_sensitive = TRUE;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (view->delete_button, delete_sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_activate_item (GimpContainerEditor *editor,
|
||||
GimpViewable *viewable)
|
||||
{
|
||||
GimpDocumentView *view;
|
||||
|
||||
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item)
|
||||
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item (editor, viewable);
|
||||
|
||||
view = GIMP_DOCUMENT_VIEW (editor);
|
||||
|
||||
if (viewable && gimp_container_have (editor->view->container,
|
||||
GIMP_OBJECT (viewable)))
|
||||
{
|
||||
gimp_document_view_open_clicked (NULL, view);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdocumentview.h
|
||||
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DOCUMENT_VIEW_H__
|
||||
#define __GIMP_DOCUMENT_VIEW_H__
|
||||
|
||||
|
||||
#include "gimpcontainereditor.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_DOCUMENT_VIEW (gimp_document_view_get_type ())
|
||||
#define GIMP_DOCUMENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DOCUMENT_VIEW, GimpDocumentView))
|
||||
#define GIMP_DOCUMENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DOCUMENT_VIEW, GimpDocumentViewClass))
|
||||
#define GIMP_IS_DOCUMENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DOCUMENT_VIEW))
|
||||
#define GIMP_IS_DOCUMENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DOCUMENT_VIEW))
|
||||
#define GIMP_DOCUMENT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DOCUMENT_VIEW, GimpDocumentViewClass))
|
||||
|
||||
|
||||
typedef struct _GimpDocumentViewClass GimpDocumentViewClass;
|
||||
|
||||
struct _GimpDocumentView
|
||||
{
|
||||
GimpContainerEditor parent_instance;
|
||||
|
||||
GtkWidget *open_button;
|
||||
GtkWidget *delete_button;
|
||||
GtkWidget *refresh_button;
|
||||
};
|
||||
|
||||
struct _GimpDocumentViewClass
|
||||
{
|
||||
GimpContainerEditorClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_document_view_get_type (void);
|
||||
|
||||
GtkWidget * gimp_document_view_new (GimpViewType view_type,
|
||||
GimpContainer *container,
|
||||
GimpContext *context,
|
||||
gint preview_size,
|
||||
gint min_items_x,
|
||||
gint min_items_y,
|
||||
GimpContainerContextFunc context_func);
|
||||
|
||||
|
||||
#endif /* __GIMP_DOCUMENT_VIEW_H__ */
|
|
@ -61,9 +61,6 @@ static void gimp_drawable_list_view_destroy (GtkObject *obj
|
|||
static void gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static gpointer gimp_drawable_list_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index);
|
||||
static void gimp_drawable_list_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
|
@ -167,7 +164,6 @@ gimp_drawable_list_view_class_init (GimpDrawableListViewClass *klass)
|
|||
|
||||
object_class->destroy = gimp_drawable_list_view_destroy;
|
||||
|
||||
container_view_class->insert_item = gimp_drawable_list_view_insert_item;
|
||||
container_view_class->select_item = gimp_drawable_list_view_select_item;
|
||||
container_view_class->activate_item = gimp_drawable_list_view_activate_item;
|
||||
container_view_class->context_item = gimp_drawable_list_view_context_item;
|
||||
|
@ -313,6 +309,7 @@ gimp_drawable_list_view_new (gint preview_size,
|
|||
view = GIMP_CONTAINER_VIEW (list_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = TRUE;
|
||||
|
||||
list_view->drawable_type = drawable_type;
|
||||
list_view->signal_name = g_strdup (signal_name);
|
||||
|
@ -422,25 +419,6 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
|
|||
|
||||
/* GimpContainerView methods */
|
||||
|
||||
static gpointer
|
||||
gimp_drawable_list_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index)
|
||||
{
|
||||
gpointer list_item = NULL;
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item)
|
||||
list_item = GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item (view,
|
||||
viewable,
|
||||
index);
|
||||
|
||||
if (list_item)
|
||||
gimp_list_item_set_reorderable (GIMP_LIST_ITEM (list_item),
|
||||
TRUE, view->container);
|
||||
|
||||
return list_item;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
|
|
|
@ -61,9 +61,6 @@ static void gimp_drawable_list_view_destroy (GtkObject *obj
|
|||
static void gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static gpointer gimp_drawable_list_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index);
|
||||
static void gimp_drawable_list_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
|
@ -167,7 +164,6 @@ gimp_drawable_list_view_class_init (GimpDrawableListViewClass *klass)
|
|||
|
||||
object_class->destroy = gimp_drawable_list_view_destroy;
|
||||
|
||||
container_view_class->insert_item = gimp_drawable_list_view_insert_item;
|
||||
container_view_class->select_item = gimp_drawable_list_view_select_item;
|
||||
container_view_class->activate_item = gimp_drawable_list_view_activate_item;
|
||||
container_view_class->context_item = gimp_drawable_list_view_context_item;
|
||||
|
@ -313,6 +309,7 @@ gimp_drawable_list_view_new (gint preview_size,
|
|||
view = GIMP_CONTAINER_VIEW (list_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = TRUE;
|
||||
|
||||
list_view->drawable_type = drawable_type;
|
||||
list_view->signal_name = g_strdup (signal_name);
|
||||
|
@ -422,25 +419,6 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
|
|||
|
||||
/* GimpContainerView methods */
|
||||
|
||||
static gpointer
|
||||
gimp_drawable_list_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index)
|
||||
{
|
||||
gpointer list_item = NULL;
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item)
|
||||
list_item = GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item (view,
|
||||
viewable,
|
||||
index);
|
||||
|
||||
if (list_item)
|
||||
gimp_list_item_set_reorderable (GIMP_LIST_ITEM (list_item),
|
||||
TRUE, view->container);
|
||||
|
||||
return list_item;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
|
|
|
@ -243,9 +243,9 @@ static GimpItemFactoryEntry toolbox_entries[] =
|
|||
|
||||
SEPARATOR ("/File/Dialogs/---"),
|
||||
|
||||
{ { N_("/File/Dialogs/Document Index..."), NULL,
|
||||
dialogs_create_toplevel_cmd_callback, 0 },
|
||||
"gimp:document-index-dialog",
|
||||
{ { N_("/File/Dialogs/Document History..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
"gimp:document-history",
|
||||
"file/dialogs/document_index.html", NULL },
|
||||
{ { N_("/File/Dialogs/Error Console..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
|
@ -866,9 +866,9 @@ static GimpItemFactoryEntry image_entries[] =
|
|||
|
||||
SEPARATOR ("/Dialogs/---"),
|
||||
|
||||
{ { N_("/Dialogs/Document Index..."), NULL,
|
||||
dialogs_create_toplevel_cmd_callback, 0 },
|
||||
"gimp:document-index-dialog",
|
||||
{ { N_("/Dialogs/Document History..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
"gimp:document-history",
|
||||
"dialogs/document_index.html", NULL },
|
||||
{ { N_("/Dialogs/Error Console..."), NULL,
|
||||
dialogs_create_dockable_cmd_callback, 0 },
|
||||
|
|
|
@ -61,9 +61,6 @@ static void gimp_drawable_list_view_destroy (GtkObject *obj
|
|||
static void gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static gpointer gimp_drawable_list_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index);
|
||||
static void gimp_drawable_list_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
|
@ -167,7 +164,6 @@ gimp_drawable_list_view_class_init (GimpDrawableListViewClass *klass)
|
|||
|
||||
object_class->destroy = gimp_drawable_list_view_destroy;
|
||||
|
||||
container_view_class->insert_item = gimp_drawable_list_view_insert_item;
|
||||
container_view_class->select_item = gimp_drawable_list_view_select_item;
|
||||
container_view_class->activate_item = gimp_drawable_list_view_activate_item;
|
||||
container_view_class->context_item = gimp_drawable_list_view_context_item;
|
||||
|
@ -313,6 +309,7 @@ gimp_drawable_list_view_new (gint preview_size,
|
|||
view = GIMP_CONTAINER_VIEW (list_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = TRUE;
|
||||
|
||||
list_view->drawable_type = drawable_type;
|
||||
list_view->signal_name = g_strdup (signal_name);
|
||||
|
@ -422,25 +419,6 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
|
|||
|
||||
/* GimpContainerView methods */
|
||||
|
||||
static gpointer
|
||||
gimp_drawable_list_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index)
|
||||
{
|
||||
gpointer list_item = NULL;
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item)
|
||||
list_item = GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item (view,
|
||||
viewable,
|
||||
index);
|
||||
|
||||
if (list_item)
|
||||
gimp_list_item_set_reorderable (GIMP_LIST_ITEM (list_item),
|
||||
TRUE, view->container);
|
||||
|
||||
return list_item;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
|
|
|
@ -61,9 +61,6 @@ static void gimp_drawable_list_view_destroy (GtkObject *obj
|
|||
static void gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
|
||||
GimpImage *gimage);
|
||||
|
||||
static gpointer gimp_drawable_list_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index);
|
||||
static void gimp_drawable_list_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
gpointer insert_data);
|
||||
|
@ -167,7 +164,6 @@ gimp_drawable_list_view_class_init (GimpDrawableListViewClass *klass)
|
|||
|
||||
object_class->destroy = gimp_drawable_list_view_destroy;
|
||||
|
||||
container_view_class->insert_item = gimp_drawable_list_view_insert_item;
|
||||
container_view_class->select_item = gimp_drawable_list_view_select_item;
|
||||
container_view_class->activate_item = gimp_drawable_list_view_activate_item;
|
||||
container_view_class->context_item = gimp_drawable_list_view_context_item;
|
||||
|
@ -313,6 +309,7 @@ gimp_drawable_list_view_new (gint preview_size,
|
|||
view = GIMP_CONTAINER_VIEW (list_view);
|
||||
|
||||
view->preview_size = preview_size;
|
||||
view->reorderable = TRUE;
|
||||
|
||||
list_view->drawable_type = drawable_type;
|
||||
list_view->signal_name = g_strdup (signal_name);
|
||||
|
@ -422,25 +419,6 @@ gimp_drawable_list_view_real_set_image (GimpDrawableListView *view,
|
|||
|
||||
/* GimpContainerView methods */
|
||||
|
||||
static gpointer
|
||||
gimp_drawable_list_view_insert_item (GimpContainerView *view,
|
||||
GimpViewable *viewable,
|
||||
gint index)
|
||||
{
|
||||
gpointer list_item = NULL;
|
||||
|
||||
if (GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item)
|
||||
list_item = GIMP_CONTAINER_VIEW_CLASS (parent_class)->insert_item (view,
|
||||
viewable,
|
||||
index);
|
||||
|
||||
if (list_item)
|
||||
gimp_list_item_set_reorderable (GIMP_LIST_ITEM (list_item),
|
||||
TRUE, view->container);
|
||||
|
||||
return list_item;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_list_view_select_item (GimpContainerView *view,
|
||||
GimpViewable *item,
|
||||
|
|
|
@ -138,6 +138,7 @@ typedef struct _GimpChannelListView GimpChannelListView;
|
|||
|
||||
typedef struct _GimpContainerEditor GimpContainerEditor;
|
||||
typedef struct _GimpBufferView GimpBufferView;
|
||||
typedef struct _GimpDocumentView GimpDocumentView;
|
||||
typedef struct _GimpDataFactoryView GimpDataFactoryView;
|
||||
typedef struct _GimpBrushFactoryView GimpBrushFactoryView;
|
||||
|
||||
|
|
Loading…
Reference in New Issue