plug-ins/flame/flame.c ported the last two users of gimpmenu.h to

2004-04-22  Sven Neumann  <sven@gimp.org>

	* plug-ins/flame/flame.c
	* plug-ins/gimpressionist/brush.c: ported the last two users of
	gimpmenu.h to GimpDrawableComboBox.

	* libgimp/gimpmenu.[ch]: declared the functions found here as
	deprecated.

	* plug-ins/common/plugindetails.c
	* plug-ins/ifscompose/ifscompose.c: silent the compiler.
This commit is contained in:
Sven Neumann 2004-04-21 23:09:16 +00:00 committed by Sven Neumann
parent 36dc39becb
commit e72a025671
14 changed files with 712 additions and 695 deletions

View File

@ -1,3 +1,15 @@
2004-04-22 Sven Neumann <sven@gimp.org>
* plug-ins/flame/flame.c
* plug-ins/gimpressionist/brush.c: ported the last two users of
gimpmenu.h to GimpDrawableComboBox.
* libgimp/gimpmenu.[ch]: declared the functions found here as
deprecated.
* plug-ins/common/plugindetails.c
* plug-ins/ifscompose/ifscompose.c: silent the compiler.
2004-04-21 Sven Neumann <sven@gimp.org>
* libgimp/gimpdrawablecombobox.c

View File

@ -1,3 +1,7 @@
2004-04-22 Sven Neumann <sven@gimp.org>
* libgimp/Makefile.am: specify --deprecated-guards.
2004-04-21 Sven Neumann <sven@gimp.org>
* libgimpwidgets/libgimpwidgets-sections.txt

View File

@ -13,7 +13,7 @@ DOC_SOURCE_DIR = $(top_srcdir)/$(DOC_MODULE)
SCANGOBJ_OPTIONS =
# Extra options to supply to gtkdoc-scan
SCAN_OPTIONS =
SCAN_OPTIONS = --deprecated-guards="GIMP_DISABLE_DEPRECATED"
# Extra options to supply to gtkdoc-mkdb
MKDB_OPTIONS = --sgml-mode --output-format=xml

View File

@ -9,13 +9,11 @@ gimpdrawablecombobox
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### USER_FUNCTION GimpDrawableConstraintFunc ##### -->
<para>

View File

@ -9,13 +9,11 @@ gimpimagecombobox
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### USER_FUNCTION GimpImageConstraintFunc ##### -->
<para>

View File

@ -9,13 +9,11 @@ gimppixbuf
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### ENUM GimpPixbufTransparency ##### -->
<para>

View File

@ -28,8 +28,12 @@
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "gimp.h"
#include "gimpui.h"
#undef GIMP_DISABLE_DEPRECATED
#include "gimpmenu.h"
#include "libgimp-intl.h"

View File

@ -22,6 +22,13 @@
#ifndef __GIMP_MENU_H__
#define __GIMP_MENU_H__
/* These functions are deprecated and should not be used in newly
* written code.
*/
#ifndef GIMP_DISABLE_DEPRECATED
G_BEGIN_DECLS
@ -52,4 +59,7 @@ GtkWidget * gimp_drawable_menu_new (GimpConstraintFunc constraint,
G_END_DECLS
#endif /* GIMP_DISABLE_DEPRECATED */
#endif /* __GIMP_MENU_H__ */

View File

@ -462,7 +462,7 @@ list_store_select_callback (GtkTreeSelection *selection,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
LIST_PINFO_COLUMN, &pinfo,
LIST_PATH_COLUMN, &mpath,
-1);
@ -513,7 +513,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
TREE_PINFO_COLUMN, &pinfo,
TREE_MPATH_COLUMN, &mpath,
-1);
@ -532,7 +532,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
/* Walk through the list, reading each row */
gchar *picked_mpath;
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
LIST_PATH_COLUMN, &picked_mpath,
-1);
if (picked_mpath && !strcmp (mpath, picked_mpath))
@ -544,7 +544,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
valid = gtk_tree_model_iter_next (model, &iter);
}
g_free (mpath);
if (found)
{
GtkTreeSelection *list_selection;
@ -571,6 +571,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
procedure_general_select_callback (pdesc, pinfo);
}
#if 0
static void
pinfo_free (gpointer p)
{
@ -583,6 +584,7 @@ pinfo_free (gpointer p)
g_free (pinfo->realname);
g_free (pinfo);
}
#endif
static gboolean
find_existing_mpath_helper (GtkTreeModel *model,
@ -596,7 +598,7 @@ find_existing_mpath_helper (GtkTreeModel *model,
GtkTreeIter child;
gchar *picked_mpath;
gtk_tree_model_get (model, iter,
gtk_tree_model_get (model, iter,
TREE_MPATH_COLUMN, &picked_mpath,
-1);
if (!strcmp(mpath, picked_mpath))
@ -609,7 +611,7 @@ find_existing_mpath_helper (GtkTreeModel *model,
if (gtk_tree_model_iter_children (model, &child, iter))
{
gtk_tree_path_down (path);
if (find_existing_mpath_helper (model, &child, path,
if (find_existing_mpath_helper (model, &child, path,
mpath, return_iter) )
{
g_free (picked_mpath);
@ -1084,7 +1086,7 @@ gimp_plugin_desc (void)
plugindesc->tree_view = GTK_TREE_VIEW (tree_view);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Menu Path/Name"),
column = gtk_tree_view_column_new_with_attributes (_("Menu Path/Name"),
renderer,
"text",
TREE_PATH_NAME_COLUMN,

View File

@ -462,7 +462,7 @@ list_store_select_callback (GtkTreeSelection *selection,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
LIST_PINFO_COLUMN, &pinfo,
LIST_PATH_COLUMN, &mpath,
-1);
@ -513,7 +513,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
TREE_PINFO_COLUMN, &pinfo,
TREE_MPATH_COLUMN, &mpath,
-1);
@ -532,7 +532,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
/* Walk through the list, reading each row */
gchar *picked_mpath;
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
LIST_PATH_COLUMN, &picked_mpath,
-1);
if (picked_mpath && !strcmp (mpath, picked_mpath))
@ -544,7 +544,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
valid = gtk_tree_model_iter_next (model, &iter);
}
g_free (mpath);
if (found)
{
GtkTreeSelection *list_selection;
@ -571,6 +571,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
procedure_general_select_callback (pdesc, pinfo);
}
#if 0
static void
pinfo_free (gpointer p)
{
@ -583,6 +584,7 @@ pinfo_free (gpointer p)
g_free (pinfo->realname);
g_free (pinfo);
}
#endif
static gboolean
find_existing_mpath_helper (GtkTreeModel *model,
@ -596,7 +598,7 @@ find_existing_mpath_helper (GtkTreeModel *model,
GtkTreeIter child;
gchar *picked_mpath;
gtk_tree_model_get (model, iter,
gtk_tree_model_get (model, iter,
TREE_MPATH_COLUMN, &picked_mpath,
-1);
if (!strcmp(mpath, picked_mpath))
@ -609,7 +611,7 @@ find_existing_mpath_helper (GtkTreeModel *model,
if (gtk_tree_model_iter_children (model, &child, iter))
{
gtk_tree_path_down (path);
if (find_existing_mpath_helper (model, &child, path,
if (find_existing_mpath_helper (model, &child, path,
mpath, return_iter) )
{
g_free (picked_mpath);
@ -1084,7 +1086,7 @@ gimp_plugin_desc (void)
plugindesc->tree_view = GTK_TREE_VIEW (tree_view);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Menu Path/Name"),
column = gtk_tree_view_column_new_with_attributes (_("Menu Path/Name"),
renderer,
"text",
TREE_PATH_NAME_COLUMN,

View File

@ -462,7 +462,7 @@ list_store_select_callback (GtkTreeSelection *selection,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
LIST_PINFO_COLUMN, &pinfo,
LIST_PATH_COLUMN, &mpath,
-1);
@ -513,7 +513,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
TREE_PINFO_COLUMN, &pinfo,
TREE_MPATH_COLUMN, &mpath,
-1);
@ -532,7 +532,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
/* Walk through the list, reading each row */
gchar *picked_mpath;
gtk_tree_model_get (model, &iter,
gtk_tree_model_get (model, &iter,
LIST_PATH_COLUMN, &picked_mpath,
-1);
if (picked_mpath && !strcmp (mpath, picked_mpath))
@ -544,7 +544,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
valid = gtk_tree_model_iter_next (model, &iter);
}
g_free (mpath);
if (found)
{
GtkTreeSelection *list_selection;
@ -571,6 +571,7 @@ tree_store_select_callback (GtkTreeSelection *selection,
procedure_general_select_callback (pdesc, pinfo);
}
#if 0
static void
pinfo_free (gpointer p)
{
@ -583,6 +584,7 @@ pinfo_free (gpointer p)
g_free (pinfo->realname);
g_free (pinfo);
}
#endif
static gboolean
find_existing_mpath_helper (GtkTreeModel *model,
@ -596,7 +598,7 @@ find_existing_mpath_helper (GtkTreeModel *model,
GtkTreeIter child;
gchar *picked_mpath;
gtk_tree_model_get (model, iter,
gtk_tree_model_get (model, iter,
TREE_MPATH_COLUMN, &picked_mpath,
-1);
if (!strcmp(mpath, picked_mpath))
@ -609,7 +611,7 @@ find_existing_mpath_helper (GtkTreeModel *model,
if (gtk_tree_model_iter_children (model, &child, iter))
{
gtk_tree_path_down (path);
if (find_existing_mpath_helper (model, &child, path,
if (find_existing_mpath_helper (model, &child, path,
mpath, return_iter) )
{
g_free (picked_mpath);
@ -1084,7 +1086,7 @@ gimp_plugin_desc (void)
plugindesc->tree_view = GTK_TREE_VIEW (tree_view);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Menu Path/Name"),
column = gtk_tree_view_column_new_with_attributes (_("Menu Path/Name"),
renderer,
"text",
TREE_PATH_NAME_COLUMN,

View File

@ -203,11 +203,6 @@ run (const gchar *name,
gimp_get_data ("plug_in_flame", &config);
maybe_init_cp ();
/* reusing a drawable_ID from the last run is a bad idea
since the drawable might have vanished (bug #37761) */
if (config.cmap_drawable >= 0)
config.cmap_drawable = GRADIENT_DRAWABLE;
drawable = gimp_drawable_get (param[2].data.d_drawable);
config.cp.width = drawable->width;
config.cp.height = drawable->height;
@ -219,6 +214,13 @@ run (const gchar *name,
status = GIMP_PDB_EXECUTION_ERROR;
}
}
else
{
/* reusing a drawable_ID from the last run is a bad idea
since the drawable might have vanished (bug #37761) */
if (config.cmap_drawable >= 0)
config.cmap_drawable = GRADIENT_DRAWABLE;
}
}
if (status == GIMP_PDB_SUCCESS)
@ -469,7 +471,7 @@ make_file_dlg (const gchar *title,
NULL);
g_object_add_weak_pointer (G_OBJECT (file_dlg), (gpointer *) &file_dlg);
g_object_add_weak_pointer (G_OBJECT (file_dlg), (gpointer) &file_dlg);
gtk_dialog_set_default_response (GTK_DIALOG (file_dlg), GTK_RESPONSE_OK);
gtk_window_set_destroy_with_parent (GTK_WINDOW (file_dlg), TRUE);
@ -857,26 +859,18 @@ set_cmap_preview (void)
}
static void
gradient_cb (GtkWidget *widget,
gpointer data)
cmap_callback (GtkWidget *widget,
gpointer data)
{
config.cmap_drawable = GPOINTER_TO_INT (data);
set_cmap_preview();
set_flame_preview();
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
&config.cmap_drawable);
set_cmap_preview ();
set_flame_preview ();
/* set_edit_preview(); */
}
static void
cmap_callback (gint32 id,
gpointer data)
{
config.cmap_drawable = id;
set_cmap_preview();
set_flame_preview();
/* set_edit_preview(); */
}
static gint
static gboolean
cmap_constrain (gint32 image_id,
gint32 drawable_id,
gpointer data)
@ -1072,12 +1066,9 @@ dialog (void)
{
GtkWidget *sep;
GtkWidget *menu;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *menuitem;
GtkWidget *option_menu;
gint32 save_drawable = config.cmap_drawable;
GtkWidget *combo;
sep = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (box), sep, FALSE, FALSE, 0);
@ -1091,25 +1082,19 @@ dialog (void)
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
option_menu = gtk_option_menu_new ();
gtk_box_pack_start (GTK_BOX (hbox), option_menu, FALSE, FALSE, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);
menu = gimp_drawable_menu_new (cmap_constrain, cmap_callback,
0, config.cmap_drawable);
combo = gimp_drawable_combo_box_new (cmap_constrain, NULL);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
config.cmap_drawable = save_drawable;
#if 0
menuitem = gtk_menu_item_new_with_label (_("Black"));
g_signal_connect (menuitem, "activate",
G_CALLBACK (gradient_cb),
(gpointer) BLACK_DRAWABLE);
gtk_menu_prepend (GTK_MENU (menu), menuitem);
if (BLACK_DRAWABLE == save_drawable)
gtk_menu_set_active (GTK_MENU (menu), 0);
gtk_widget_show (menuitem);
gimp_int_combo_box_prepend (GIMP_INT_COMBO_BOX (combo),
GIMP_INT_STORE_VALUE, BLACK_DRAWABLE,
GIMP_INT_STORE_LABEL, _("Black"),
-1);
#endif
{
static gchar *names[] =
static const gchar *names[] =
{
"sunny harvest",
"rose",
@ -1118,41 +1103,41 @@ dialog (void)
"ernst anti-pope",
"gris josette"
};
static gint good[] = { 10, 20, 68, 79, 70, 75 };
gint i, n = G_N_ELEMENTS (good);
static const gint good[] = { 10, 20, 68, 79, 70, 75 };
for (i = 0; i < n; i++)
gint i;
for (i = 0; i < G_N_ELEMENTS (good); i++)
{
gint d = TABLE_DRAWABLE - good[i];
gint value = TABLE_DRAWABLE - good[i];
menuitem = gtk_menu_item_new_with_label (names[i]);
g_signal_connect (menuitem, "activate",
G_CALLBACK (gradient_cb),
GINT_TO_POINTER (d));
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menuitem);
if (d == save_drawable)
gtk_menu_set_active (GTK_MENU (menu), 0);
gtk_widget_show (menuitem);
}
gimp_int_combo_box_prepend (GIMP_INT_COMBO_BOX (combo),
GIMP_INT_STORE_VALUE, value,
GIMP_INT_STORE_LABEL, names[i],
-1);
}
}
menuitem = gtk_menu_item_new_with_label (_("Custom Gradient"));
g_signal_connect (menuitem, "activate",
G_CALLBACK (gradient_cb),
(gpointer) GRADIENT_DRAWABLE);
gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menuitem);
if (GRADIENT_DRAWABLE == save_drawable)
gtk_menu_set_active (GTK_MENU (menu), 0);
gtk_widget_show (menuitem);
gimp_int_combo_box_prepend (GIMP_INT_COMBO_BOX (combo),
GIMP_INT_STORE_VALUE, GRADIENT_DRAWABLE,
GIMP_INT_STORE_LABEL, _("Custom Gradient"),
GIMP_INT_STORE_STOCK_ID, GIMP_STOCK_GRADIENT,
-1);
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
gtk_widget_show (option_menu);
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
config.cmap_drawable,
G_CALLBACK (cmap_callback),
NULL);
gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
gtk_widget_show (combo);
cmap_preview = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (cmap_preview), 32, 32);
gtk_box_pack_end (GTK_BOX (hbox), cmap_preview, FALSE, FALSE, 0);
gtk_widget_show (cmap_preview);
set_cmap_preview ();
}

View File

@ -28,54 +28,59 @@
#include <libgimp/stdplugins-intl.h>
GtkWidget *brushlist = NULL;
static GtkWidget *brushprev = NULL;
GtkObject *brushreliefadjust = NULL;
GtkObject *brushaspectadjust = NULL;
GtkObject *brushgammaadjust = NULL;
static GtkListStore *brushstore;
GtkWidget *brushlist = NULL;
GtkObject *brushreliefadjust = NULL;
GtkObject *brushaspectadjust = NULL;
GtkObject *brushgammaadjust = NULL;
GtkWidget *brushdrawablemenu = NULL;
static GtkWidget *brushemptyitem;
gint brushfile = 2;
ppm_t brushppm = {0, 0, NULL};
gint32 brushdrawableid;
static GtkWidget *brushprev = NULL;
static GtkListStore *brushstore = NULL;
int brushfile = 2;
static void updatebrushprev (char *fn);
ppm_t brushppm = {0,0,NULL};
static void updatebrushprev(char *fn);
static gboolean colorfile(char *fn)
static gboolean colorfile (char *fn)
{
return fn && strstr(fn, ".ppm");
}
static void brushdmenuselect(gint32 id, gpointer data)
static void
brushdmenuselect (GtkWidget *widget,
gpointer data)
{
GimpPixelRgn src_rgn;
guchar *src_row;
guchar *src;
gint id;
gint alpha, has_alpha, bpp;
gint x, y;
ppm_t *p;
gint x1, y1, x2, y2;
gint row, col;
GimpDrawable *drawable;
int rowstride;
gint rowstride;
if(brushfile == 2) return; /* Not finished GUI-building yet */
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &id);
if (brushfile) {
/* unselectall(brushlist); */
if(GTK_IS_WIDGET(presetsavebutton))
gtk_widget_set_sensitive(GTK_WIDGET(presetsavebutton), FALSE);
}
if (id == -1)
return;
gtk_adjustment_set_value(GTK_ADJUSTMENT(brushgammaadjust), 1.0);
gtk_adjustment_set_value(GTK_ADJUSTMENT(brushaspectadjust), 0.0);
if (brushfile == 2)
return; /* Not finished GUI-building yet */
drawable = gimp_drawable_get(id);
if (brushfile)
{
/* unselectall(brushlist); */
if (GTK_IS_WIDGET (presetsavebutton))
gtk_widget_set_sensitive (GTK_WIDGET (presetsavebutton), FALSE);
}
gtk_adjustment_set_value (GTK_ADJUSTMENT (brushgammaadjust), 1.0);
gtk_adjustment_set_value (GTK_ADJUSTMENT (brushaspectadjust), 0.0);
drawable = gimp_drawable_get (id);
gimp_drawable_mask_bounds (drawable->drawable_id, &x1, &y1, &x2, &y2);
@ -218,10 +223,13 @@ savebrush (GtkWidget *wg,
gtk_widget_show (window);
}
static gboolean validdrawable(gint32 imageid, gint32 drawableid, gpointer data)
static gboolean
validdrawable (gint32 imageid,
gint32 drawableid,
gpointer data)
{
if(drawableid == -1) return TRUE;
return (gimp_drawable_is_rgb(drawableid) || gimp_drawable_is_gray(drawableid));
return (gimp_drawable_is_rgb (drawableid) ||
gimp_drawable_is_gray (drawableid));
}
void reloadbrush(char *fn, ppm_t *p)
@ -360,10 +368,9 @@ void create_brushpage(GtkNotebook *notebook)
GtkWidget *box1, *box2, *box3, *thispage;
GtkWidget *view;
GtkWidget *tmpw, *table;
GtkWidget *dmenu;
GtkWidget *combo;
GtkWidget *label;
GtkTreeSelection *selection;
GtkWidget *emptyitem;
label = gtk_label_new_with_mnemonic (_("_Brush"));
@ -428,19 +435,14 @@ void create_brushpage(GtkNotebook *notebook)
gtk_box_pack_start(GTK_BOX(box3), tmpw,FALSE,FALSE,0);
gtk_widget_show (tmpw);
brushemptyitem = emptyitem = gtk_menu_item_new_with_label( _("(None)"));
g_signal_connect (emptyitem, "activate",
G_CALLBACK (dummybrushdmenuselect),
NULL);
gtk_widget_show(emptyitem);
combo = gimp_drawable_combo_box_new (validdrawable, NULL);
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo), -1,
G_CALLBACK (brushdmenuselect),
NULL);
tmpw = gtk_option_menu_new();
gtk_box_pack_start(GTK_BOX(box3),tmpw, FALSE, FALSE, 0);
gtk_widget_show(tmpw);
gtk_box_pack_start(GTK_BOX (box3), combo, FALSE, FALSE, 0);
gtk_widget_show (combo);
brushdrawablemenu = dmenu = gimp_drawable_menu_new(validdrawable, brushdmenuselect, NULL, -1);
gtk_menu_shell_prepend (GTK_MENU_SHELL (dmenu), emptyitem);
gtk_option_menu_set_menu(GTK_OPTION_MENU(tmpw), dmenu);
tmpw = gtk_button_new_from_stock (GTK_STOCK_SAVE_AS);
gtk_box_pack_start(GTK_BOX(box3),tmpw, FALSE, FALSE, 0);
g_signal_connect (tmpw, "clicked", G_CALLBACK(savebrush), NULL);

File diff suppressed because it is too large Load Diff