mirror of https://github.com/GNOME/gimp.git
Some moving of unused files so they don't clutter app/...
2001-11-19 Michael Natterer <mitch@gimp.org> Some moving of unused files so they don't clutter app/... * app/gdisplay_color.[ch] * app/gdisplay_color_ui.[ch]: removed... * app/display/gimpdisplayshell-filter.[ch] * app/display/gimpdisplayshell-filter-dialog.[ch]: ...added here.
This commit is contained in:
parent
2e21005a38
commit
6f2533b164
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2001-11-19 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Some moving of unused files so they don't clutter app/...
|
||||
|
||||
* app/gdisplay_color.[ch]
|
||||
* app/gdisplay_color_ui.[ch]: removed...
|
||||
|
||||
* app/display/gimpdisplayshell-filter.[ch]
|
||||
* app/display/gimpdisplayshell-filter-dialog.[ch]: ...added here.
|
||||
|
||||
2001-11-19 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplay-foreach.c: forgot to commit last time.
|
||||
|
|
|
@ -1,365 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1999 Manish Singh
|
||||
*
|
||||
* 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 <string.h>
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
#include "gdisplay_color.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimpimageP.h"
|
||||
#include "gimpui.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
typedef struct _ColorDisplayInfo ColorDisplayInfo;
|
||||
|
||||
struct _ColorDisplayInfo
|
||||
{
|
||||
gchar *name;
|
||||
GimpColorDisplayMethods methods;
|
||||
GSList *refs;
|
||||
};
|
||||
|
||||
static GHashTable *color_display_table = NULL;
|
||||
|
||||
static void color_display_foreach_real (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data);
|
||||
static void gdisplay_color_detach_real (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node,
|
||||
gboolean unref);
|
||||
static gint node_name_compare (ColorDisplayNode *node,
|
||||
const gchar *name);
|
||||
|
||||
void
|
||||
color_display_init (void)
|
||||
{
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT gboolean
|
||||
gimp_color_display_register (const gchar *name,
|
||||
GimpColorDisplayMethods *methods)
|
||||
{
|
||||
ColorDisplayInfo *info;
|
||||
|
||||
info = g_new (ColorDisplayInfo, 1);
|
||||
|
||||
info->name = g_strdup (name);
|
||||
info->methods = *methods;
|
||||
info->refs = NULL;
|
||||
|
||||
if (!color_display_table)
|
||||
color_display_table = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
if (g_hash_table_lookup (color_display_table, name))
|
||||
return FALSE;
|
||||
|
||||
if (!methods->convert)
|
||||
return FALSE;
|
||||
|
||||
g_hash_table_insert (color_display_table, info->name, info);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT gboolean
|
||||
gimp_color_display_unregister (const gchar *name)
|
||||
{
|
||||
ColorDisplayInfo *info;
|
||||
GimpDisplay *gdisp;
|
||||
GList *node;
|
||||
|
||||
if ((info = g_hash_table_lookup (color_display_table, name)))
|
||||
{
|
||||
GSList *refs = info->refs;
|
||||
|
||||
while (refs)
|
||||
{
|
||||
gdisp = (GimpDisplay *) refs->data;
|
||||
|
||||
node = g_list_find_custom (gdisp->cd_list, (gpointer) name,
|
||||
(GCompareFunc) node_name_compare);
|
||||
gdisp->cd_list = g_list_remove_link (gdisp->cd_list, node);
|
||||
|
||||
gdisplay_color_detach_real (gdisp, node->data, FALSE);
|
||||
|
||||
g_list_free_1 (node);
|
||||
|
||||
refs = refs->next;
|
||||
}
|
||||
|
||||
g_slist_free (info->refs);
|
||||
|
||||
g_hash_table_remove (color_display_table, name);
|
||||
|
||||
g_free (info->name);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct _DisplayForeachData DisplayForeachData;
|
||||
|
||||
struct _DisplayForeachData
|
||||
{
|
||||
GimpCDFunc func;
|
||||
gpointer user_data;
|
||||
};
|
||||
|
||||
void
|
||||
color_display_foreach (GimpCDFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
DisplayForeachData data;
|
||||
|
||||
data.func = func;
|
||||
data.user_data = user_data;
|
||||
|
||||
g_hash_table_foreach (color_display_table, color_display_foreach_real, &data);
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_foreach_real (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
DisplayForeachData *data = (DisplayForeachData *) user_data;
|
||||
data->func (key, data->user_data);
|
||||
}
|
||||
|
||||
ColorDisplayNode *
|
||||
gdisplay_color_attach (GimpDisplay *gdisp,
|
||||
const gchar *name)
|
||||
{
|
||||
ColorDisplayInfo *info;
|
||||
ColorDisplayNode *node;
|
||||
|
||||
g_return_val_if_fail (gdisp != NULL, NULL);
|
||||
|
||||
if ((info = g_hash_table_lookup (color_display_table, name)))
|
||||
{
|
||||
node = g_new (ColorDisplayNode, 1);
|
||||
|
||||
node->cd_name = g_strdup (name);
|
||||
node->cd_ID = NULL;
|
||||
|
||||
if (!info->refs && info->methods.init)
|
||||
info->methods.init ();
|
||||
|
||||
info->refs = g_slist_append (info->refs, gdisp);
|
||||
|
||||
if (info->methods.new)
|
||||
node->cd_ID = info->methods.new (gdisp->gimage->base_type);
|
||||
|
||||
node->cd_convert = info->methods.convert;
|
||||
|
||||
gdisp->cd_list = g_list_append (gdisp->cd_list, node);
|
||||
|
||||
return node;
|
||||
}
|
||||
else
|
||||
g_warning ("Tried to attach a nonexistant color display");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ColorDisplayNode *
|
||||
gdisplay_color_attach_clone (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node)
|
||||
{
|
||||
ColorDisplayInfo *info;
|
||||
ColorDisplayNode *clone;
|
||||
|
||||
g_return_val_if_fail (gdisp != NULL, NULL);
|
||||
g_return_val_if_fail (node != NULL, NULL);
|
||||
|
||||
if ((info = g_hash_table_lookup (color_display_table, node->cd_name)))
|
||||
{
|
||||
clone = g_new (ColorDisplayNode, 1);
|
||||
|
||||
clone->cd_name = g_strdup (node->cd_name);
|
||||
clone->cd_ID = NULL;
|
||||
|
||||
info->refs = g_slist_append (info->refs, gdisp);
|
||||
|
||||
if (info->methods.clone)
|
||||
node->cd_ID = info->methods.clone (node->cd_ID);
|
||||
|
||||
node->cd_convert = info->methods.convert;
|
||||
|
||||
gdisp->cd_list = g_list_append (gdisp->cd_list, node);
|
||||
|
||||
return node;
|
||||
}
|
||||
else
|
||||
g_warning ("Tried to clone a nonexistant color display");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_color_detach (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node)
|
||||
{
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
|
||||
gdisp->cd_list = g_list_remove (gdisp->cd_list, node);
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_color_detach_destroy (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node)
|
||||
{
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
|
||||
gdisplay_color_detach_real (gdisp, node, TRUE);
|
||||
gdisp->cd_list = g_list_remove (gdisp->cd_list, node);
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_color_detach_all (GimpDisplay *gdisp)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
|
||||
list = gdisp->cd_list;
|
||||
|
||||
while (list)
|
||||
{
|
||||
gdisplay_color_detach_real (gdisp, list->data, TRUE);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_list_free (gdisp->cd_list);
|
||||
gdisp->cd_list = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdisplay_color_detach_real (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node,
|
||||
gboolean unref)
|
||||
{
|
||||
ColorDisplayInfo *info;
|
||||
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
g_return_if_fail (node != NULL);
|
||||
|
||||
if ((info = g_hash_table_lookup (color_display_table, node->cd_name)))
|
||||
{
|
||||
if (info->methods.destroy)
|
||||
info->methods.destroy (node->cd_ID);
|
||||
|
||||
if (unref)
|
||||
info->refs = g_slist_remove (info->refs, gdisp);
|
||||
|
||||
if (!info->refs && info->methods.finalize)
|
||||
info->methods.finalize ();
|
||||
}
|
||||
|
||||
g_free (node->cd_name);
|
||||
g_free (node);
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_color_reorder_up (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node)
|
||||
{
|
||||
GList *node_list;
|
||||
|
||||
node_list = g_list_find (gdisp->cd_list, node);
|
||||
|
||||
if (node_list->prev)
|
||||
{
|
||||
node_list->data = node_list->prev->data;
|
||||
node_list->prev->data = node;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_color_reorder_down (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node)
|
||||
{
|
||||
GList *node_list;
|
||||
|
||||
g_return_if_fail (gdisp != NULL);
|
||||
|
||||
node_list = g_list_find (gdisp->cd_list, node);
|
||||
|
||||
if (node_list->next)
|
||||
{
|
||||
node_list->data = node_list->next->data;
|
||||
node_list->next->data = node;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
node_name_compare (ColorDisplayNode *node,
|
||||
const char *name)
|
||||
{
|
||||
return strcmp (node->cd_name, name);
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_color_configure (ColorDisplayNode *node,
|
||||
GFunc ok_func,
|
||||
gpointer ok_data,
|
||||
GFunc cancel_func,
|
||||
gpointer cancel_data)
|
||||
{
|
||||
ColorDisplayInfo *info;
|
||||
|
||||
g_return_if_fail (node != NULL);
|
||||
|
||||
if ((info = g_hash_table_lookup (color_display_table, node->cd_name)))
|
||||
{
|
||||
if (info->methods.configure)
|
||||
info->methods.configure (node->cd_ID,
|
||||
ok_func, ok_data,
|
||||
cancel_func, cancel_data);
|
||||
}
|
||||
else
|
||||
g_warning ("Tried to configure a nonexistant color display");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_color_configure_cancel (ColorDisplayNode *node)
|
||||
{
|
||||
ColorDisplayInfo *info;
|
||||
|
||||
g_return_if_fail (node != NULL);
|
||||
|
||||
if ((info = g_hash_table_lookup (color_display_table, node->cd_name)))
|
||||
{
|
||||
if (info->methods.cancel)
|
||||
info->methods.cancel (node->cd_ID);
|
||||
}
|
||||
else
|
||||
g_warning ("Tried to configure cancel a nonexistant color display");
|
||||
|
||||
return;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1999 Manish Singh
|
||||
*
|
||||
* 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 __GDISPLAY_COLOR_H__
|
||||
#define __GDISPLAY_COLOR_H__
|
||||
|
||||
#include "libgimp/gimpcolordisplay.h"
|
||||
|
||||
|
||||
typedef struct _ColorDisplayNode ColorDisplayNode;
|
||||
|
||||
struct _ColorDisplayNode {
|
||||
gpointer cd_ID;
|
||||
gchar *cd_name;
|
||||
GimpColorDisplayConvert cd_convert;
|
||||
};
|
||||
|
||||
typedef void (*GimpCDFunc) (const gchar *name,
|
||||
gpointer user_data);
|
||||
|
||||
void color_display_init (void);
|
||||
void color_display_foreach (GimpCDFunc func,
|
||||
gpointer user_data);
|
||||
|
||||
ColorDisplayNode * gdisplay_color_attach (GimpDisplay *gdisp,
|
||||
const gchar *name);
|
||||
ColorDisplayNode * gdisplay_color_attach_clone (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node);
|
||||
void gdisplay_color_detach (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node);
|
||||
void gdisplay_color_detach_destroy (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node);
|
||||
void gdisplay_color_detach_all (GimpDisplay *gdisp);
|
||||
void gdisplay_color_reorder_up (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node);
|
||||
void gdisplay_color_reorder_down (GimpDisplay *gdisp,
|
||||
ColorDisplayNode *node);
|
||||
|
||||
void gdisplay_color_configure (ColorDisplayNode *node,
|
||||
GFunc ok_func,
|
||||
gpointer ok_data,
|
||||
GFunc cancel_func,
|
||||
gpointer cancel_data);
|
||||
void gdisplay_color_configure_cancel (ColorDisplayNode *node);
|
||||
|
||||
#endif /* __GDISPLAY_COLOR_H__ */
|
|
@ -1,543 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1999 Manish Singh
|
||||
*
|
||||
* 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 "libgimpbase/gimpbsse.h"
|
||||
|
||||
#include "apptypes.h"
|
||||
|
||||
#include "color_area.h"
|
||||
#include "dialog_handler.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gdisplay_color.h"
|
||||
#include "gdisplay_color_ui.h"
|
||||
#include "gimpimageP.h"
|
||||
#include "gimpui.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
typedef struct _ColorDisplayDialog ColorDisplayDialog;
|
||||
|
||||
struct _ColorDisplayDialog
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
|
||||
GtkWidget *shell;
|
||||
|
||||
GtkWidget *src;
|
||||
GtkWidget *dest;
|
||||
|
||||
gint src_row;
|
||||
gint dest_row;
|
||||
|
||||
gboolean modified;
|
||||
|
||||
GList *old_nodes;
|
||||
GList *conf_nodes;
|
||||
|
||||
GtkWidget *buttons[5];
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
BUTTON_ADD,
|
||||
BUTTON_REMOVE,
|
||||
BUTTON_UP,
|
||||
BUTTON_DOWN,
|
||||
BUTTON_CONFIGURE
|
||||
};
|
||||
|
||||
typedef void (*ButtonCallback) (GtkWidget *, gpointer);
|
||||
|
||||
typedef struct _ButtonInfo ButtonInfo;
|
||||
|
||||
struct _ButtonInfo
|
||||
{
|
||||
const gchar *label;
|
||||
ButtonCallback callback;
|
||||
};
|
||||
|
||||
static void make_dialog (ColorDisplayDialog *cdd);
|
||||
|
||||
static void color_display_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_display_cancel_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_display_add_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_display_remove_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_display_up_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_display_down_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_display_configure_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void src_list_populate (const char *name,
|
||||
gpointer data);
|
||||
static void dest_list_populate (GList *node_list,
|
||||
GtkWidget *dest);
|
||||
|
||||
static void select_src (GtkWidget *widget,
|
||||
gint row,
|
||||
gint column,
|
||||
GdkEventButton *event,
|
||||
gpointer data);
|
||||
static void unselect_src (GtkWidget *widget,
|
||||
gint row,
|
||||
gint column,
|
||||
GdkEventButton *event,
|
||||
gpointer data);
|
||||
static void select_dest (GtkWidget *widget,
|
||||
gint row,
|
||||
gint column,
|
||||
GdkEventButton *event,
|
||||
gpointer data);
|
||||
static void unselect_dest (GtkWidget *widget,
|
||||
gint row,
|
||||
gint column,
|
||||
GdkEventButton *event,
|
||||
gpointer data);
|
||||
|
||||
static void color_display_update_up_and_down(ColorDisplayDialog *cdd);
|
||||
|
||||
#define LIST_WIDTH 180
|
||||
#define LIST_HEIGHT 180
|
||||
|
||||
#define UPDATE_DISPLAY(gdisp) G_STMT_START { \
|
||||
if (gdisp != color_area_gdisp) \
|
||||
{ \
|
||||
gdisplay_expose_full (gdisp); \
|
||||
gdisplay_flush (gdisp); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
static void
|
||||
make_dialog (ColorDisplayDialog *cdd)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *scrolled_win;
|
||||
GtkWidget *vbbox;
|
||||
gchar *titles[2];
|
||||
gint i;
|
||||
|
||||
static ButtonInfo buttons[] =
|
||||
{
|
||||
{ N_("Add"), color_display_add_callback },
|
||||
{ N_("Remove"), color_display_remove_callback },
|
||||
{ N_("Up"), color_display_up_callback },
|
||||
{ N_("Down"), color_display_down_callback },
|
||||
{ N_("Configure"), color_display_configure_callback }
|
||||
};
|
||||
|
||||
cdd->shell = gimp_dialog_new (_("Color Display Filters"), "display_color",
|
||||
gimp_standard_help_func,
|
||||
"dialogs/display_filters/display_filters.html",
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
GTK_STOCK_OK, color_display_ok_callback,
|
||||
cdd, NULL, NULL, TRUE, FALSE,
|
||||
GTK_STOCK_CANCEL, color_display_cancel_callback,
|
||||
cdd, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
dialog_register (cdd->shell);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox,
|
||||
TRUE, TRUE, 4);
|
||||
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 5);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
|
||||
titles[0] = _("Available Filters");
|
||||
titles[1] = NULL;
|
||||
cdd->src = gtk_clist_new_with_titles (1, titles);
|
||||
gtk_widget_set_usize (cdd->src, LIST_WIDTH, LIST_HEIGHT);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (cdd->src));
|
||||
gtk_clist_set_auto_sort (GTK_CLIST (cdd->src), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), cdd->src);
|
||||
|
||||
g_signal_connect (G_OBJECT (cdd->src), "select_row",
|
||||
G_CALLBACK (select_src),
|
||||
cdd);
|
||||
g_signal_connect (G_OBJECT (cdd->src), "unselect_row",
|
||||
G_CALLBACK (unselect_src),
|
||||
cdd);
|
||||
|
||||
vbbox = gtk_vbutton_box_new ();
|
||||
gtk_vbutton_box_set_layout_default (GTK_BUTTONBOX_START);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbbox, FALSE, FALSE, 2);
|
||||
|
||||
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (scrolled_win), 5);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0);
|
||||
|
||||
titles[0] = _("Active Filters");
|
||||
titles[1] = NULL;
|
||||
cdd->dest = gtk_clist_new_with_titles (1, titles);
|
||||
gtk_widget_set_usize (cdd->dest, LIST_WIDTH, LIST_HEIGHT);
|
||||
gtk_clist_column_titles_passive (GTK_CLIST (cdd->dest));
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_win), cdd->dest);
|
||||
|
||||
g_signal_connect (G_OBJECT (cdd->dest), "select_row",
|
||||
G_CALLBACK (select_dest),
|
||||
cdd);
|
||||
g_signal_connect (G_OBJECT (cdd->dest), "unselect_row",
|
||||
G_CALLBACK (unselect_dest),
|
||||
cdd);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
cdd->buttons[i] =
|
||||
gtk_button_new_with_label (gettext (buttons[i].label));
|
||||
gtk_box_pack_start (GTK_BOX (vbbox), cdd->buttons[i], FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (cdd->buttons[i]), "clicked",
|
||||
G_CALLBACK (buttons[i].callback),
|
||||
cdd);
|
||||
gtk_widget_set_sensitive (cdd->buttons[i], FALSE);
|
||||
}
|
||||
|
||||
gtk_widget_show_all (hbox);
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
GimpDisplay *gdisp = cdd->gdisp;
|
||||
GList *list;
|
||||
|
||||
dialog_unregister(cdd->shell);
|
||||
gtk_widget_destroy (GTK_WIDGET (cdd->shell));
|
||||
gdisp->cd_ui = NULL;
|
||||
|
||||
if (cdd->modified)
|
||||
{
|
||||
list = cdd->old_nodes;
|
||||
|
||||
while (list)
|
||||
{
|
||||
if (!g_list_find (gdisp->cd_list, list->data))
|
||||
gdisplay_color_detach_destroy (gdisp, list->data);
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_list_free (cdd->old_nodes);
|
||||
|
||||
UPDATE_DISPLAY (gdisp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_cancel_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
GimpDisplay *gdisp = cdd->gdisp;
|
||||
GList *list;
|
||||
GList *next;
|
||||
|
||||
dialog_unregister(cdd->shell);
|
||||
gtk_widget_destroy (GTK_WIDGET (cdd->shell));
|
||||
gdisp->cd_ui = NULL;
|
||||
|
||||
if (cdd->modified)
|
||||
{
|
||||
list = gdisp->cd_list;
|
||||
gdisp->cd_list = cdd->old_nodes;
|
||||
|
||||
while (list)
|
||||
{
|
||||
next = list->next;
|
||||
|
||||
if (!g_list_find (cdd->old_nodes, list->data))
|
||||
gdisplay_color_detach_destroy (gdisp, list->data);
|
||||
|
||||
list = next;
|
||||
}
|
||||
|
||||
UPDATE_DISPLAY (gdisp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_update_up_and_down (ColorDisplayDialog *cdd)
|
||||
{
|
||||
gtk_widget_set_sensitive (cdd->buttons[BUTTON_UP], cdd->dest_row > 0);
|
||||
gtk_widget_set_sensitive (cdd->buttons[BUTTON_DOWN], cdd->dest_row >= 0 &&
|
||||
cdd->dest_row < GTK_CLIST (cdd->dest)->rows - 1);
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_add_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
GimpDisplay *gdisp = cdd->gdisp;
|
||||
gchar *name = NULL;
|
||||
ColorDisplayNode *node;
|
||||
gint row;
|
||||
|
||||
if (cdd->src_row < 0)
|
||||
return;
|
||||
|
||||
gtk_clist_get_text (GTK_CLIST (cdd->src), cdd->src_row, 0, &name);
|
||||
|
||||
if (!name)
|
||||
return;
|
||||
|
||||
cdd->modified = TRUE;
|
||||
|
||||
node = gdisplay_color_attach (gdisp, name);
|
||||
|
||||
row = gtk_clist_append (GTK_CLIST (cdd->dest), &name);
|
||||
gtk_clist_set_row_data (GTK_CLIST (cdd->dest), row, node);
|
||||
|
||||
color_display_update_up_and_down (cdd);
|
||||
|
||||
UPDATE_DISPLAY (gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_remove_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
GimpDisplay *gdisp = cdd->gdisp;
|
||||
ColorDisplayNode *node;
|
||||
|
||||
if (cdd->dest_row < 0)
|
||||
return;
|
||||
|
||||
node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row);
|
||||
gtk_clist_remove (GTK_CLIST (cdd->dest), cdd->dest_row);
|
||||
|
||||
cdd->modified = TRUE;
|
||||
|
||||
if (g_list_find (cdd->old_nodes, node))
|
||||
gdisplay_color_detach (gdisp, node);
|
||||
else
|
||||
gdisplay_color_detach_destroy (gdisp, node);
|
||||
|
||||
cdd->dest_row = -1;
|
||||
|
||||
color_display_update_up_and_down (cdd);
|
||||
|
||||
UPDATE_DISPLAY (gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_up_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
GimpDisplay *gdisp = cdd->gdisp;
|
||||
ColorDisplayNode *node;
|
||||
|
||||
if (cdd->dest_row < 1)
|
||||
return;
|
||||
|
||||
node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row);
|
||||
gtk_clist_row_move (GTK_CLIST (cdd->dest), cdd->dest_row, cdd->dest_row - 1);
|
||||
|
||||
gdisplay_color_reorder_up (gdisp, node);
|
||||
cdd->modified = TRUE;
|
||||
|
||||
cdd->dest_row--;
|
||||
|
||||
color_display_update_up_and_down (cdd);
|
||||
|
||||
UPDATE_DISPLAY (gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_down_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
GimpDisplay *gdisp = cdd->gdisp;
|
||||
ColorDisplayNode *node;
|
||||
|
||||
if (cdd->dest_row < 0)
|
||||
return;
|
||||
|
||||
if (cdd->dest_row >= GTK_CLIST (cdd->dest)->rows -1)
|
||||
return;
|
||||
|
||||
node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row);
|
||||
gtk_clist_row_move (GTK_CLIST (cdd->dest), cdd->dest_row, cdd->dest_row + 1);
|
||||
|
||||
gdisplay_color_reorder_down (gdisp, node);
|
||||
cdd->modified = TRUE;
|
||||
|
||||
cdd->dest_row++;
|
||||
|
||||
color_display_update_up_and_down (cdd);
|
||||
|
||||
UPDATE_DISPLAY (gdisp);
|
||||
}
|
||||
|
||||
static void
|
||||
color_display_configure_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
GimpDisplay *gdisp = cdd->gdisp;
|
||||
ColorDisplayNode *node;
|
||||
|
||||
if (cdd->dest_row < 0)
|
||||
return;
|
||||
|
||||
node = gtk_clist_get_row_data (GTK_CLIST (cdd->dest), cdd->dest_row);
|
||||
|
||||
if (!g_list_find (cdd->conf_nodes, node))
|
||||
cdd->conf_nodes = g_list_append (cdd->conf_nodes, node);
|
||||
|
||||
gdisplay_color_configure (node, NULL, NULL, NULL, NULL);
|
||||
|
||||
cdd->modified = TRUE;
|
||||
UPDATE_DISPLAY (gdisp);
|
||||
}
|
||||
|
||||
void
|
||||
gdisplay_color_ui_new (GimpDisplay *gdisp)
|
||||
{
|
||||
ColorDisplayDialog *cdd;
|
||||
|
||||
cdd = g_new0 (ColorDisplayDialog, 1);
|
||||
|
||||
make_dialog (cdd);
|
||||
|
||||
gtk_clist_clear (GTK_CLIST (cdd->src));
|
||||
gtk_clist_clear (GTK_CLIST (cdd->dest));
|
||||
|
||||
color_display_foreach (src_list_populate, cdd->src);
|
||||
|
||||
cdd->old_nodes = gdisp->cd_list;
|
||||
dest_list_populate (gdisp->cd_list, cdd->dest);
|
||||
gdisp->cd_list = g_list_copy (cdd->old_nodes);
|
||||
|
||||
cdd->gdisp = gdisp;
|
||||
|
||||
cdd->src_row = -1;
|
||||
cdd->dest_row = -1;
|
||||
|
||||
gdisp->cd_ui = cdd->shell;
|
||||
}
|
||||
|
||||
static void
|
||||
src_list_populate (const char *name,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_clist_append (GTK_CLIST (data), (gchar **) &name);
|
||||
}
|
||||
|
||||
static void
|
||||
dest_list_populate (GList *node_list,
|
||||
GtkWidget *dest)
|
||||
{
|
||||
ColorDisplayNode *node;
|
||||
int row;
|
||||
|
||||
while (node_list)
|
||||
{
|
||||
node = node_list->data;
|
||||
|
||||
row = gtk_clist_append (GTK_CLIST (dest), &node->cd_name);
|
||||
gtk_clist_set_row_data (GTK_CLIST (dest), row, node);
|
||||
|
||||
node_list = node_list->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
select_src (GtkWidget *widget,
|
||||
gint row,
|
||||
gint column,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
cdd->src_row = row;
|
||||
gtk_widget_set_sensitive (cdd->buttons[BUTTON_ADD], TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
unselect_src (GtkWidget *widget,
|
||||
gint row,
|
||||
gint column,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
cdd->src_row = -1;
|
||||
gtk_widget_set_sensitive (cdd->buttons[BUTTON_ADD], FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
select_dest (GtkWidget *widget,
|
||||
gint row,
|
||||
gint column,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
|
||||
cdd->dest_row = row;
|
||||
|
||||
gtk_widget_set_sensitive (cdd->buttons[BUTTON_REMOVE], TRUE);
|
||||
gtk_widget_set_sensitive (cdd->buttons[BUTTON_CONFIGURE], TRUE);
|
||||
|
||||
color_display_update_up_and_down (cdd);
|
||||
}
|
||||
|
||||
static void
|
||||
unselect_dest (GtkWidget *widget,
|
||||
gint row,
|
||||
gint column,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
ColorDisplayDialog *cdd = data;
|
||||
|
||||
cdd->dest_row = -1;
|
||||
|
||||
gtk_widget_set_sensitive (cdd->buttons[BUTTON_REMOVE], FALSE);
|
||||
gtk_widget_set_sensitive (cdd->buttons[BUTTON_CONFIGURE], FALSE);
|
||||
|
||||
color_display_update_up_and_down (cdd);
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1999 Manish Singh
|
||||
*
|
||||
* 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 __GDISPLAY_COLOR_UI_H__
|
||||
#define __GDISPLAY_COLOR_UI_H__
|
||||
|
||||
|
||||
void gdisplay_color_ui_new (GimpDisplay *gdisp);
|
||||
|
||||
|
||||
#endif /* __GDISPLAY_COLOR_UI_H__ */
|
Loading…
Reference in New Issue