mirror of https://github.com/GNOME/gimp.git
app/gimphelp.h libgimp/gimp.h declare the gimp_standard_help_func in
2000-01-11 Michael Natterer <mitch@gimp.org> * app/gimphelp.h * libgimp/gimp.h * libgimp/gimphelpui.[ch]: declare the gimp_standard_help_func in gimphelpui.h because libgimp widgets must not include libgimp/gimp.h. * libgimp/gimpdialog.c * libgimp/gimpexport.c * libgimp/gimpunitmenu.c: use the dialog constructor for the export dialog and the unit selection. * plug-ins/gpc/gpc.[ch] * plug-ins/megawidget/megawidget.[ch]: removed unused functions (dialog creation and some other stuff). The rest of these libs is scheduled for removal, too... * plug-ins/AlienMap/AlienMap.c * plug-ins/AlienMap/Makefile.am * plug-ins/AlienMap2/AlienMap2.c * plug-ins/AlienMap2/Makefile.am * plug-ins/borderaverage/Makefile.am * plug-ins/borderaverage/borderaverage.c * plug-ins/common/align_layers.c * plug-ins/common/blur.c * plug-ins/common/colortoalpha.c * plug-ins/common/compose.c * plug-ins/common/decompose.c * plug-ins/common/gauss_iir.c * plug-ins/common/gauss_rle.c * plug-ins/common/mapcolor.c * plug-ins/common/max_rgb.c * plug-ins/common/mblur.c * plug-ins/common/noisify.c * plug-ins/common/spread.c * plug-ins/common/xbm.c * plug-ins/common/xpm.c * plug-ins/fp/Makefile.am * plug-ins/fp/fp_gtk.c * plug-ins/rcm/Makefile.am * plug-ins/rcm/rcm_callback.[ch] * plug-ins/rcm/rcm_dialog.c * plug-ins/sinus/sinus.c: standard ui (spacings etc.) for some more plugins. Did some indentation, prototyping and I18N fixes.
This commit is contained in:
parent
63fd0799da
commit
d5e99ee9a5
45
ChangeLog
45
ChangeLog
|
@ -1,3 +1,48 @@
|
|||
2000-01-11 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gimphelp.h
|
||||
* libgimp/gimp.h
|
||||
* libgimp/gimphelpui.[ch]: declare the gimp_standard_help_func in
|
||||
gimphelpui.h because libgimp widgets must not include libgimp/gimp.h.
|
||||
|
||||
* libgimp/gimpdialog.c
|
||||
* libgimp/gimpexport.c
|
||||
* libgimp/gimpunitmenu.c: use the dialog constructor for the
|
||||
export dialog and the unit selection.
|
||||
|
||||
* plug-ins/gpc/gpc.[ch]
|
||||
* plug-ins/megawidget/megawidget.[ch]: removed unused functions
|
||||
(dialog creation and some other stuff). The rest of these libs is
|
||||
scheduled for removal, too...
|
||||
|
||||
* plug-ins/AlienMap/AlienMap.c
|
||||
* plug-ins/AlienMap/Makefile.am
|
||||
* plug-ins/AlienMap2/AlienMap2.c
|
||||
* plug-ins/AlienMap2/Makefile.am
|
||||
* plug-ins/borderaverage/Makefile.am
|
||||
* plug-ins/borderaverage/borderaverage.c
|
||||
* plug-ins/common/align_layers.c
|
||||
* plug-ins/common/blur.c
|
||||
* plug-ins/common/colortoalpha.c
|
||||
* plug-ins/common/compose.c
|
||||
* plug-ins/common/decompose.c
|
||||
* plug-ins/common/gauss_iir.c
|
||||
* plug-ins/common/gauss_rle.c
|
||||
* plug-ins/common/mapcolor.c
|
||||
* plug-ins/common/max_rgb.c
|
||||
* plug-ins/common/mblur.c
|
||||
* plug-ins/common/noisify.c
|
||||
* plug-ins/common/spread.c
|
||||
* plug-ins/common/xbm.c
|
||||
* plug-ins/common/xpm.c
|
||||
* plug-ins/fp/Makefile.am
|
||||
* plug-ins/fp/fp_gtk.c
|
||||
* plug-ins/rcm/Makefile.am
|
||||
* plug-ins/rcm/rcm_callback.[ch]
|
||||
* plug-ins/rcm/rcm_dialog.c
|
||||
* plug-ins/sinus/sinus.c: standard ui (spacings etc.) for some
|
||||
more plugins. Did some indentation, prototyping and I18N fixes.
|
||||
|
||||
Tue Jan 11 13:32:41 CET 2000 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/gap/gap_navigator_dialog.c: some changes to make it use
|
||||
|
|
|
@ -31,9 +31,6 @@ enum
|
|||
HELP_BROWSER_NETSCAPE
|
||||
};
|
||||
|
||||
/* the standard help function */
|
||||
void gimp_standard_help_func (gchar *help_data);
|
||||
|
||||
/* the main help function */
|
||||
void gimp_help (gchar *help_data);
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@ enum
|
|||
HELP_BROWSER_NETSCAPE
|
||||
};
|
||||
|
||||
/* the standard help function */
|
||||
void gimp_standard_help_func (gchar *help_data);
|
||||
|
||||
/* the main help function */
|
||||
void gimp_help (gchar *help_data);
|
||||
|
||||
|
|
|
@ -876,7 +876,6 @@ void gimp_parasite_detach (const char *name);
|
|||
* Help *
|
||||
****************************************/
|
||||
|
||||
void gimp_standard_help_func (gchar *help_data);
|
||||
void gimp_plugin_help_func (gchar *help_data);
|
||||
void gimp_help (gchar *help_data);
|
||||
|
||||
|
|
|
@ -141,8 +141,6 @@ gimp_dialog_newv (const gchar *title,
|
|||
/* prepare the action_area */
|
||||
gimp_dialog_create_action_areav (GTK_DIALOG (dialog), args);
|
||||
|
||||
gimp_dialog_set_icon (dialog);
|
||||
|
||||
/* connect the "F1" help key */
|
||||
if (help_func)
|
||||
gimp_help_connect_help_accel (dialog, help_func, help_data);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gimp.h"
|
||||
#include "gimpdialog.h"
|
||||
#include "gimpenums.h"
|
||||
#include "gimpexport.h"
|
||||
#include "gimpintl.h"
|
||||
|
@ -119,8 +120,8 @@ static ExportAction export_action_merge =
|
|||
{
|
||||
export_merge,
|
||||
NULL,
|
||||
N_("can't handle layers"),
|
||||
{ N_("Merge visible layers"), NULL },
|
||||
N_("can't Handle Layers"),
|
||||
{ N_("Merge Visible Layers"), NULL },
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -128,8 +129,8 @@ static ExportAction export_action_animate_or_merge =
|
|||
{
|
||||
NULL,
|
||||
export_merge,
|
||||
N_("can only handle layers as animation frames"),
|
||||
{ N_("Save as animation"), N_("Merge visible layers") },
|
||||
N_("can only Handle Layers as Animation Frames"),
|
||||
{ N_("Save as Animation"), N_("Merge Visible Layers") },
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -137,7 +138,7 @@ static ExportAction export_action_flatten =
|
|||
{
|
||||
&export_flatten,
|
||||
NULL,
|
||||
N_("can't handle transparency"),
|
||||
N_("can't Handle Transparency"),
|
||||
{ N_("Flatten Image"), NULL },
|
||||
0
|
||||
};
|
||||
|
@ -146,7 +147,7 @@ static ExportAction export_action_convert_rgb =
|
|||
{
|
||||
&export_convert_rgb,
|
||||
NULL,
|
||||
N_("can only handle RGB images"),
|
||||
N_("can only Handle RGB Images"),
|
||||
{ N_("Convert to RGB"), NULL },
|
||||
0
|
||||
};
|
||||
|
@ -155,8 +156,8 @@ static ExportAction export_action_convert_grayscale =
|
|||
{
|
||||
&export_convert_grayscale,
|
||||
NULL,
|
||||
N_("can only handle grayscale images"),
|
||||
{ N_("Convert to grayscale"), NULL },
|
||||
N_("can only Handle Grayscale Images"),
|
||||
{ N_("Convert to Grayscale"), NULL },
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -164,8 +165,9 @@ static ExportAction export_action_convert_indexed =
|
|||
{
|
||||
&export_convert_indexed,
|
||||
NULL,
|
||||
N_("can only handle indexed images"),
|
||||
{ N_("Convert to indexed using default settings\n(Do it manually to tune the result)"), NULL },
|
||||
N_("can only Handle Indexed Images"),
|
||||
{ N_("Convert to indexed using default settings\n"
|
||||
"(Do it manually to tune the result)"), NULL },
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -173,8 +175,8 @@ static ExportAction export_action_convert_rgb_or_grayscale =
|
|||
{
|
||||
&export_convert_rgb,
|
||||
&export_convert_grayscale,
|
||||
N_("can only handle RGB or grayscale images"),
|
||||
{ N_("Convert to RGB"), N_("Convert to grayscale")},
|
||||
N_("can only Handle RGB or Grayscale Images"),
|
||||
{ N_("Convert to RGB"), N_("Convert to Grayscale")},
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -182,8 +184,9 @@ static ExportAction export_action_convert_rgb_or_indexed =
|
|||
{
|
||||
&export_convert_rgb,
|
||||
&export_convert_indexed,
|
||||
N_("can only handle RGB or indexed images"),
|
||||
{ N_("Convert to RGB"), N_("Convert to indexed using default settings\n(Do it manually to tune the result)")},
|
||||
N_("can only Handle RGB or Indexed Images"),
|
||||
{ N_("Convert to RGB"), N_("Convert to indexed using default settings\n"
|
||||
"(Do it manually to tune the result)")},
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -191,9 +194,10 @@ static ExportAction export_action_convert_indexed_or_grayscale =
|
|||
{
|
||||
&export_convert_indexed,
|
||||
&export_convert_grayscale,
|
||||
N_("can only handle grayscale or indexed images"),
|
||||
{ N_("Convert to indexed using default settings\n(Do it manually to tune the result)"),
|
||||
N_("Convert to grayscale") },
|
||||
N_("can only Handle Grayscale or Indexed Images"),
|
||||
{ N_("Convert to indexed using default settings\n"
|
||||
"(Do it manually to tune the result)"),
|
||||
N_("Convert to Grayscale") },
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -201,8 +205,8 @@ static ExportAction export_action_add_alpha =
|
|||
{
|
||||
&export_add_alpha,
|
||||
NULL,
|
||||
N_("needs an alpha channel"),
|
||||
{ N_("Add alpha channel"), NULL},
|
||||
N_("needs an Alpha Channel"),
|
||||
{ N_("Add Alpha Channel"), NULL},
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -253,14 +257,13 @@ static gint
|
|||
export_dialog (GSList *actions,
|
||||
gchar *format)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *button;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *label;
|
||||
GSList *list;
|
||||
gchar *text;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
GSList *list;
|
||||
gchar *text;
|
||||
ExportAction *action;
|
||||
|
||||
dialog_return = EXPORT_CANCEL;
|
||||
|
@ -272,44 +275,23 @@ export_dialog (GSList *actions,
|
|||
*/
|
||||
|
||||
/* the dialog */
|
||||
dialog = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), _("Export File"));
|
||||
gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
||||
dialog = gimp_dialog_new (_("Export File"), "export_file",
|
||||
gimp_standard_help_func, "dialogs/export_file.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, FALSE, FALSE,
|
||||
|
||||
_("Export"), export_export_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
_("Ignore"), export_skip_callback,
|
||||
NULL, NULL, NULL, FALSE, FALSE,
|
||||
_("Cancel"), gtk_widget_destroy,
|
||||
NULL, 1, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
|
||||
(GtkSignalFunc) export_cancel_callback, NULL);
|
||||
|
||||
/* Action area */
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), FALSE);
|
||||
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->action_area), hbbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Export"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) export_export_callback, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Ignore"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) export_skip_callback, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Cancel"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy, GTK_OBJECT (dialog));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
GTK_SIGNAL_FUNC (export_cancel_callback),
|
||||
NULL);
|
||||
|
||||
/* the headline */
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
|
@ -317,7 +299,8 @@ export_dialog (GSList *actions,
|
|||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
label = gtk_label_new (_("Your image should be exported before it can be saved for the following reasons:"));
|
||||
label = gtk_label_new (_("Your image should be exported before it "
|
||||
"can be saved for the following reasons:"));
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
@ -325,14 +308,16 @@ export_dialog (GSList *actions,
|
|||
|
||||
for (list = actions; list; list = list->next)
|
||||
{
|
||||
action = (ExportAction*)(list->data);
|
||||
action = (ExportAction *) (list->data);
|
||||
|
||||
text = g_strdup_printf ("%s %s", format, gettext (action->reason));
|
||||
frame = gtk_frame_new (text);
|
||||
g_free (text);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
|
||||
|
||||
if (action->possibilities[0] && action->possibilities[1])
|
||||
{
|
||||
|
@ -344,7 +329,8 @@ export_dialog (GSList *actions,
|
|||
radio_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) export_toggle_callback, &action->choice);
|
||||
GTK_SIGNAL_FUNC (export_toggle_callback),
|
||||
&action->choice);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
gtk_widget_show (button);
|
||||
|
||||
|
@ -376,17 +362,17 @@ export_dialog (GSList *actions,
|
|||
}
|
||||
|
||||
/* the footline */
|
||||
label = gtk_label_new (_("The export conversion won't modify your original image."));
|
||||
label = gtk_label_new (_("The export conversion won't modify "
|
||||
"your original image."));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
gtk_main ();
|
||||
|
||||
return (dialog_return);
|
||||
return dialog_return;
|
||||
}
|
||||
|
||||
|
||||
GimpExportReturnType
|
||||
gimp_export_image (gint32 *image_ID_ptr,
|
||||
gint32 *drawable_ID_ptr,
|
||||
|
@ -507,12 +493,5 @@ gimp_export_image (gint32 *image_ID_ptr,
|
|||
}
|
||||
g_slist_free (actions);
|
||||
|
||||
return (dialog_return);
|
||||
return dialog_return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gimpdialog.h"
|
||||
#include "gimphelpui.h"
|
||||
|
||||
/* external functions */
|
||||
|
@ -84,6 +85,12 @@ gimp_help_connect_help_accel (GtkWidget *widget,
|
|||
if (!help_func)
|
||||
return;
|
||||
|
||||
/* for convenience we set the wm icon here because
|
||||
* this function is called for almost all gimp windows
|
||||
*/
|
||||
if (GTK_IS_WINDOW (widget))
|
||||
gimp_dialog_set_icon (widget);
|
||||
|
||||
/* set up the help signals and tips query widget */
|
||||
if (!tips_query)
|
||||
{
|
||||
|
@ -156,9 +163,9 @@ gimp_help_connect_help_accel (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_help_set_help_data (GtkWidget *widget,
|
||||
gchar *tooltip,
|
||||
gchar *help_data)
|
||||
gimp_help_set_help_data (GtkWidget *widget,
|
||||
const gchar *tooltip,
|
||||
gchar *help_data)
|
||||
{
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
|
|
@ -33,6 +33,9 @@ void gimp_help_free (void);
|
|||
void gimp_help_enable_tooltips (void);
|
||||
void gimp_help_disable_tooltips (void);
|
||||
|
||||
/* the standard gimp help function */
|
||||
void gimp_standard_help_func (gchar *help_data);
|
||||
|
||||
/* connect the "F1" accelerator of a window */
|
||||
void gimp_help_connect_help_accel (GtkWidget *widget,
|
||||
GimpHelpFunc help_func,
|
||||
|
@ -40,7 +43,7 @@ void gimp_help_connect_help_accel (GtkWidget *widget,
|
|||
|
||||
/* set help data for non-window widgets */
|
||||
void gimp_help_set_help_data (GtkWidget *widget,
|
||||
gchar *tool_tip,
|
||||
const gchar *tool_tip,
|
||||
gchar *help_data);
|
||||
|
||||
/* activate the context help inspector */
|
||||
|
|
|
@ -21,9 +21,10 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "gimpdialog.h"
|
||||
#include "gimpunitmenu.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "gimpintl.h"
|
||||
|
||||
/* private functions */
|
||||
static const gchar * gimp_unit_menu_build_string (gchar *format,
|
||||
|
@ -443,23 +444,27 @@ gimp_unit_menu_selection_delete_callback (GtkWidget *widget,
|
|||
static void
|
||||
gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
||||
{
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *scrolled_win;
|
||||
GtkWidget *button;
|
||||
gchar *titles[2];
|
||||
gchar *row[2];
|
||||
GUnit unit;
|
||||
gint num_units;
|
||||
gint unit_width;
|
||||
gint factor_width;
|
||||
gchar *titles[2];
|
||||
gchar *row[2];
|
||||
GUnit unit;
|
||||
gint num_units;
|
||||
gint unit_width;
|
||||
gint factor_width;
|
||||
|
||||
gum->selection = gtk_dialog_new ();
|
||||
gtk_window_set_wmclass (GTK_WINDOW (gum->selection),
|
||||
"unit_selection", "Gimp");
|
||||
gtk_window_set_title (GTK_WINDOW (gum->selection), _("Unit Selection"));
|
||||
gtk_window_set_policy (GTK_WINDOW (gum->selection), FALSE, TRUE, FALSE);
|
||||
gtk_window_position (GTK_WINDOW (gum->selection), GTK_WIN_POS_MOUSE);
|
||||
gum->selection =
|
||||
gimp_dialog_new (_("Unit Selection"), "unit_selection",
|
||||
gimp_standard_help_func, "dialogs/unit_selection.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Select"), gimp_unit_menu_selection_select_callback,
|
||||
gum, NULL, NULL, TRUE, FALSE,
|
||||
_("Close"), gimp_unit_menu_selection_close_callback,
|
||||
gum, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (gum->selection), "delete_event",
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_delete_callback),
|
||||
|
@ -526,35 +531,6 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&gum->clist);
|
||||
|
||||
/* the action area */
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG (gum->selection)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (gum->selection)->action_area),
|
||||
FALSE);
|
||||
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (gum->selection)->action_area), hbbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Select"));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_select_callback),
|
||||
gum);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Close"));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_close_callback),
|
||||
gum);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (gum->selection);
|
||||
|
||||
|
|
|
@ -141,8 +141,6 @@ gimp_dialog_newv (const gchar *title,
|
|||
/* prepare the action_area */
|
||||
gimp_dialog_create_action_areav (GTK_DIALOG (dialog), args);
|
||||
|
||||
gimp_dialog_set_icon (dialog);
|
||||
|
||||
/* connect the "F1" help key */
|
||||
if (help_func)
|
||||
gimp_help_connect_help_accel (dialog, help_func, help_data);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gimpdialog.h"
|
||||
#include "gimphelpui.h"
|
||||
|
||||
/* external functions */
|
||||
|
@ -84,6 +85,12 @@ gimp_help_connect_help_accel (GtkWidget *widget,
|
|||
if (!help_func)
|
||||
return;
|
||||
|
||||
/* for convenience we set the wm icon here because
|
||||
* this function is called for almost all gimp windows
|
||||
*/
|
||||
if (GTK_IS_WINDOW (widget))
|
||||
gimp_dialog_set_icon (widget);
|
||||
|
||||
/* set up the help signals and tips query widget */
|
||||
if (!tips_query)
|
||||
{
|
||||
|
@ -156,9 +163,9 @@ gimp_help_connect_help_accel (GtkWidget *widget,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_help_set_help_data (GtkWidget *widget,
|
||||
gchar *tooltip,
|
||||
gchar *help_data)
|
||||
gimp_help_set_help_data (GtkWidget *widget,
|
||||
const gchar *tooltip,
|
||||
gchar *help_data)
|
||||
{
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
|
|
@ -33,6 +33,9 @@ void gimp_help_free (void);
|
|||
void gimp_help_enable_tooltips (void);
|
||||
void gimp_help_disable_tooltips (void);
|
||||
|
||||
/* the standard gimp help function */
|
||||
void gimp_standard_help_func (gchar *help_data);
|
||||
|
||||
/* connect the "F1" accelerator of a window */
|
||||
void gimp_help_connect_help_accel (GtkWidget *widget,
|
||||
GimpHelpFunc help_func,
|
||||
|
@ -40,7 +43,7 @@ void gimp_help_connect_help_accel (GtkWidget *widget,
|
|||
|
||||
/* set help data for non-window widgets */
|
||||
void gimp_help_set_help_data (GtkWidget *widget,
|
||||
gchar *tool_tip,
|
||||
const gchar *tool_tip,
|
||||
gchar *help_data);
|
||||
|
||||
/* activate the context help inspector */
|
||||
|
|
|
@ -21,9 +21,10 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "gimpdialog.h"
|
||||
#include "gimpunitmenu.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "gimpintl.h"
|
||||
|
||||
/* private functions */
|
||||
static const gchar * gimp_unit_menu_build_string (gchar *format,
|
||||
|
@ -443,23 +444,27 @@ gimp_unit_menu_selection_delete_callback (GtkWidget *widget,
|
|||
static void
|
||||
gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
||||
{
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *scrolled_win;
|
||||
GtkWidget *button;
|
||||
gchar *titles[2];
|
||||
gchar *row[2];
|
||||
GUnit unit;
|
||||
gint num_units;
|
||||
gint unit_width;
|
||||
gint factor_width;
|
||||
gchar *titles[2];
|
||||
gchar *row[2];
|
||||
GUnit unit;
|
||||
gint num_units;
|
||||
gint unit_width;
|
||||
gint factor_width;
|
||||
|
||||
gum->selection = gtk_dialog_new ();
|
||||
gtk_window_set_wmclass (GTK_WINDOW (gum->selection),
|
||||
"unit_selection", "Gimp");
|
||||
gtk_window_set_title (GTK_WINDOW (gum->selection), _("Unit Selection"));
|
||||
gtk_window_set_policy (GTK_WINDOW (gum->selection), FALSE, TRUE, FALSE);
|
||||
gtk_window_position (GTK_WINDOW (gum->selection), GTK_WIN_POS_MOUSE);
|
||||
gum->selection =
|
||||
gimp_dialog_new (_("Unit Selection"), "unit_selection",
|
||||
gimp_standard_help_func, "dialogs/unit_selection.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("Select"), gimp_unit_menu_selection_select_callback,
|
||||
gum, NULL, NULL, TRUE, FALSE,
|
||||
_("Close"), gimp_unit_menu_selection_close_callback,
|
||||
gum, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (gum->selection), "delete_event",
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_delete_callback),
|
||||
|
@ -526,35 +531,6 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
|||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&gum->clist);
|
||||
|
||||
/* the action area */
|
||||
gtk_container_set_border_width
|
||||
(GTK_CONTAINER (GTK_DIALOG (gum->selection)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (gum->selection)->action_area),
|
||||
FALSE);
|
||||
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (gum->selection)->action_area), hbbox,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Select"));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_select_callback),
|
||||
gum);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Close"));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_close_callback),
|
||||
gum);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (gum->selection);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,6 +17,7 @@ INCLUDES = \
|
|||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,6 +17,7 @@ INCLUDES = \
|
|||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
|
|
@ -17,9 +17,10 @@ AM_CPPFLAGS = \
|
|||
-DLOCALEDIR=\""$(localedir)"\"
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/plug-ins/megawidget/libmegawidget.a \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(top_builddir)/plug-ins/libgck/gck/libgck.la \
|
||||
$(top_builddir)/plug-ins/megawidget/libmegawidget.a \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
|
|
|
@ -19,13 +19,20 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "gck/gck.h"
|
||||
#include "plug-ins/megawidget/megawidget.h"
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/* Declare local functions.
|
||||
|
@ -37,13 +44,16 @@ static void run (char *name,
|
|||
int *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
static void borderaverage(GDrawable *drawable, guchar *res_r, guchar *res_g, guchar *res_b);
|
||||
static void borderaverage (GDrawable *drawable,
|
||||
guchar *res_r, guchar *res_g, guchar *res_b);
|
||||
|
||||
static gint borderaverage_dialog(void);
|
||||
static gint borderaverage_dialog (void);
|
||||
|
||||
static void add_new_color (gint bytes, guchar* buffer, gint* cube, gint bucket_expo);
|
||||
static void add_new_color (gint bytes, guchar* buffer, gint* cube,
|
||||
gint bucket_expo);
|
||||
|
||||
void menu_callback(GtkWidget *widget, gpointer client_data);
|
||||
static void menu_callback (GtkWidget *widget,
|
||||
gpointer client_data);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
|
@ -53,23 +63,24 @@ GPlugInInfo PLUG_IN_INFO =
|
|||
run, /* run_proc */
|
||||
};
|
||||
|
||||
static gint borderaverage_thickness = 3;
|
||||
static gint borderaverage_bucket_exponent = 4;
|
||||
static gint borderaverage_thickness = 3;
|
||||
static gint borderaverage_bucket_exponent = 4;
|
||||
|
||||
struct borderaverage_data {
|
||||
gint thickness;
|
||||
gint bucket_exponent;
|
||||
} borderaverage_data = { 3, 4 };
|
||||
struct borderaverage_data
|
||||
{
|
||||
gint thickness;
|
||||
gint bucket_exponent;
|
||||
} borderaverage_data = { 3, 4 };
|
||||
|
||||
gchar * menu_labels[] =
|
||||
{
|
||||
"1 (nonsense?)", "2", "4", "8", "16", "32", "64", "128", "256 (nonsense?)"
|
||||
};
|
||||
{
|
||||
"1 (nonsense?)", "2", "4", "8", "16", "32", "64", "128", "256 (nonsense?)"
|
||||
};
|
||||
|
||||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef args[] =
|
||||
{
|
||||
|
@ -80,10 +91,10 @@ query ()
|
|||
{ PARAM_INT32, "bucket_exponent", "Bits for bucket size (default=4: 16 Levels)" },
|
||||
};
|
||||
static GParamDef return_vals[] =
|
||||
{
|
||||
{
|
||||
{ PARAM_INT32, "num_channels", "Number of color channels returned (always 3)" },
|
||||
{ PARAM_INT8ARRAY, "color_vals", "The average color of the specified border"},
|
||||
};
|
||||
{ PARAM_INT8ARRAY, "color_vals", "The average color of the specified border"},
|
||||
};
|
||||
static int nargs = sizeof (args) / sizeof (args[0]);
|
||||
static int nreturn_vals = sizeof (return_vals) / sizeof (return_vals[0]);
|
||||
|
||||
|
@ -109,81 +120,90 @@ run (char *name,
|
|||
int *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
{
|
||||
static GParam values[3];
|
||||
GDrawable *drawable;
|
||||
GRunModeType run_mode;
|
||||
GStatusType status = STATUS_SUCCESS;
|
||||
gint8 *result_color;
|
||||
static GParam values[3];
|
||||
GDrawable *drawable;
|
||||
GRunModeType run_mode;
|
||||
GStatusType status = STATUS_SUCCESS;
|
||||
gint8 *result_color;
|
||||
|
||||
INIT_I18N_UI();
|
||||
INIT_I18N_UI();
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
/* get the return memory */
|
||||
result_color = (gint8 *) g_new(gint8, 3);
|
||||
/* get the return memory */
|
||||
result_color = (gint8 *) g_new(gint8, 3);
|
||||
|
||||
/* Get the specified drawable */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
/* Get the specified drawable */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
|
||||
switch (run_mode) {
|
||||
case RUN_INTERACTIVE:
|
||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||
borderaverage_thickness = borderaverage_data.thickness;
|
||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||
if (! borderaverage_dialog())
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
break;
|
||||
switch (run_mode)
|
||||
{
|
||||
case RUN_INTERACTIVE:
|
||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||
borderaverage_thickness = borderaverage_data.thickness;
|
||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||
if (! borderaverage_dialog())
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
break;
|
||||
|
||||
case RUN_NONINTERACTIVE:
|
||||
if (nparams != 5)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
borderaverage_thickness = param[3].data.d_int32;
|
||||
borderaverage_bucket_exponent = param[4].data.d_int32;
|
||||
case RUN_NONINTERACTIVE:
|
||||
if (nparams != 5)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
borderaverage_thickness = param[3].data.d_int32;
|
||||
borderaverage_bucket_exponent = param[4].data.d_int32;
|
||||
break;
|
||||
|
||||
break;
|
||||
case RUN_WITH_LAST_VALS:
|
||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||
borderaverage_thickness = borderaverage_data.thickness;
|
||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||
break;
|
||||
|
||||
case RUN_WITH_LAST_VALS:
|
||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||
borderaverage_thickness = borderaverage_data.thickness;
|
||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
/* Make sure that the drawable is RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->id))
|
||||
{
|
||||
gimp_progress_init ("borderaverage");
|
||||
borderaverage (drawable,
|
||||
&result_color[0], &result_color[1], &result_color[2]);
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
{
|
||||
gimp_palette_set_foreground (result_color[0],
|
||||
result_color[1],
|
||||
result_color[2]);
|
||||
gimp_displays_flush ();
|
||||
}
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
borderaverage_data.thickness = borderaverage_thickness;
|
||||
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
||||
gimp_set_data ("plug_in_borderaverage",
|
||||
&borderaverage_data, sizeof (borderaverage_data));
|
||||
}
|
||||
|
||||
if (status == STATUS_SUCCESS) {
|
||||
/* Make sure that the drawable is RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->id)) {
|
||||
gimp_progress_init ("borderaverage");
|
||||
borderaverage (drawable, &result_color[0], &result_color[1], &result_color[2]);
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE) {
|
||||
gimp_palette_set_foreground(result_color[0],result_color[1],result_color[2]);
|
||||
gimp_displays_flush ();
|
||||
}
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
borderaverage_data.thickness = borderaverage_thickness;
|
||||
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
||||
gimp_set_data("plug_in_borderaverage", &borderaverage_data, sizeof(borderaverage_data));
|
||||
} else {
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
*nreturn_vals = 3;
|
||||
*return_vals = values;
|
||||
}
|
||||
*nreturn_vals = 3;
|
||||
*return_vals = values;
|
||||
|
||||
values[0].type = PARAM_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
values[0].type = PARAM_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
values[1].type = PARAM_INT32;
|
||||
values[1].data.d_int32 = 3;
|
||||
values[1].type = PARAM_INT32;
|
||||
values[1].data.d_int32 = 3;
|
||||
|
||||
values[2].type = PARAM_INT8ARRAY;
|
||||
values[2].data.d_int8array = result_color;
|
||||
values[2].type = PARAM_INT8ARRAY;
|
||||
values[2].data.d_int8array = result_color;
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -192,185 +212,233 @@ borderaverage (GDrawable *drawable,
|
|||
guchar *res_g,
|
||||
guchar *res_b)
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
gint x1, x2, y1, y2;
|
||||
gint bytes;
|
||||
gint max;
|
||||
|
||||
guchar r, g, b;
|
||||
|
||||
guchar *buffer;
|
||||
gint bucket_num, bucket_expo, bucket_rexpo;
|
||||
|
||||
gint* cube;
|
||||
|
||||
gint row, col, i,j,k; /* index variables */
|
||||
|
||||
GPixelRgn myPR;
|
||||
|
||||
|
||||
/* allocate and clear the cube before */
|
||||
bucket_expo = borderaverage_bucket_exponent;
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
cube = (gint*) malloc( (1 << (bucket_rexpo * 3)) * sizeof(gint) );
|
||||
bucket_num = 1 << bucket_rexpo;
|
||||
|
||||
for (i = 0; i < bucket_num; i++) {
|
||||
for (j = 0; j < bucket_num; j++) {
|
||||
for (k = 0; k < bucket_num; k++) {
|
||||
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get the input area. This is the bounding box of the selection in
|
||||
* the image (or the entire image if there is no selection). Only
|
||||
* operating on the input area is simply an optimization. It doesn't
|
||||
* need to be done for correct operation. (It simply makes it go
|
||||
* faster, since fewer pixels need to be operated on).
|
||||
*/
|
||||
gint width;
|
||||
gint height;
|
||||
gint x1, x2, y1, y2;
|
||||
gint bytes;
|
||||
gint max;
|
||||
|
||||
guchar r, g, b;
|
||||
|
||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
||||
guchar *buffer;
|
||||
gint bucket_num, bucket_expo, bucket_rexpo;
|
||||
|
||||
/* Get the size of the input image. (This will/must be the same
|
||||
* as the size of the output image.
|
||||
*/
|
||||
width = drawable->width;
|
||||
height = drawable->height;
|
||||
bytes = drawable->bpp;
|
||||
gint* cube;
|
||||
|
||||
/* allocate row buffer */
|
||||
buffer = (guchar *) malloc ((x2 - x1) * bytes);
|
||||
gint row, col, i,j,k; /* index variables */
|
||||
|
||||
GPixelRgn myPR;
|
||||
|
||||
/* initialize the pixel regions */
|
||||
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
||||
|
||||
/* loop through the rows, performing our magic*/
|
||||
for (row = y1; row < y2; row++) {
|
||||
|
||||
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
||||
/* allocate and clear the cube before */
|
||||
bucket_expo = borderaverage_bucket_exponent;
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
cube = g_new (gint, 1 << (bucket_rexpo * 3));
|
||||
bucket_num = 1 << bucket_rexpo;
|
||||
|
||||
if (row < y1 + borderaverage_thickness ||
|
||||
row >= y2 - borderaverage_thickness) {
|
||||
/* add the whole row */
|
||||
for (col = 0; col < ((x2 - x1) * bytes); col += bytes) {
|
||||
add_new_color(bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
} else {
|
||||
/* add the left border */
|
||||
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes) {
|
||||
add_new_color(bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
/* add the right border */
|
||||
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
||||
col < ((x2 - x1) * bytes); col += bytes) {
|
||||
add_new_color(bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((row % 5) == 0)
|
||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||
for (i = 0; i < bucket_num; i++)
|
||||
{
|
||||
for (j = 0; j < bucket_num; j++)
|
||||
{
|
||||
for (k = 0; k < bucket_num; k++)
|
||||
{
|
||||
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
max = 0; r = 0; g = 0; b = 0;
|
||||
|
||||
/* get max of cube */
|
||||
for (i = 0; i < bucket_num; i++) {
|
||||
for (j = 0; j < bucket_num; j++) {
|
||||
for (k = 0; k < bucket_num; k++) {
|
||||
if (cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] > max) {
|
||||
max = cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k];
|
||||
r = (i<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* return the color */
|
||||
*res_r = r;
|
||||
*res_g = g;
|
||||
*res_b = b;
|
||||
}
|
||||
|
||||
free (buffer);
|
||||
/* Get the input area. This is the bounding box of the selection in
|
||||
* the image (or the entire image if there is no selection). Only
|
||||
* operating on the input area is simply an optimization. It doesn't
|
||||
* need to be done for correct operation. (It simply makes it go
|
||||
* faster, since fewer pixels need to be operated on).
|
||||
*/
|
||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
||||
|
||||
/* Get the size of the input image. (This will/must be the same
|
||||
* as the size of the output image.
|
||||
*/
|
||||
width = drawable->width;
|
||||
height = drawable->height;
|
||||
bytes = drawable->bpp;
|
||||
|
||||
/* allocate row buffer */
|
||||
buffer = g_new (guchar, (x2 - x1) * bytes);
|
||||
|
||||
/* initialize the pixel regions */
|
||||
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
||||
|
||||
/* loop through the rows, performing our magic*/
|
||||
for (row = y1; row < y2; row++)
|
||||
{
|
||||
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
||||
|
||||
if (row < y1 + borderaverage_thickness ||
|
||||
row >= y2 - borderaverage_thickness)
|
||||
{
|
||||
/* add the whole row */
|
||||
for (col = 0; col < ((x2 - x1) * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add the left border */
|
||||
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
/* add the right border */
|
||||
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
||||
col < ((x2 - x1) * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
}
|
||||
|
||||
if ((row % 5) == 0)
|
||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||
}
|
||||
|
||||
max = 0; r = 0; g = 0; b = 0;
|
||||
|
||||
/* get max of cube */
|
||||
for (i = 0; i < bucket_num; i++)
|
||||
{
|
||||
for (j = 0; j < bucket_num; j++)
|
||||
{
|
||||
for (k = 0; k < bucket_num; k++)
|
||||
{
|
||||
if (cube[(i << (bucket_rexpo << 1)) +
|
||||
(j << bucket_rexpo) + k] > max)
|
||||
{
|
||||
max = cube[(i << (bucket_rexpo << 1)) +
|
||||
(j << bucket_rexpo) + k];
|
||||
r = (i<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* return the color */
|
||||
*res_r = r;
|
||||
*res_g = g;
|
||||
*res_b = b;
|
||||
|
||||
g_free (buffer);
|
||||
g_free (cube);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_new_color (gint bytes,
|
||||
guchar *buffer,
|
||||
gint *cube,
|
||||
gint bucket_expo)
|
||||
{
|
||||
guchar r,g,b;
|
||||
gint bucket_rexpo;
|
||||
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
r = buffer[0] >>bucket_expo;
|
||||
if (bytes > 1) {
|
||||
g = buffer[1] >>bucket_expo;
|
||||
} else {
|
||||
g = 0;
|
||||
}
|
||||
if (bytes > 2) {
|
||||
b = buffer[2] >>bucket_expo;
|
||||
} else {
|
||||
b = 0;
|
||||
}
|
||||
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
||||
guchar r, g, b;
|
||||
gint bucket_rexpo;
|
||||
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
r = buffer[0] >>bucket_expo;
|
||||
if (bytes > 1)
|
||||
{
|
||||
g = buffer[1] >>bucket_expo;
|
||||
}
|
||||
else
|
||||
{
|
||||
g = 0;
|
||||
}
|
||||
if (bytes > 2)
|
||||
{
|
||||
b = buffer[2] >>bucket_expo;
|
||||
}
|
||||
else
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
||||
}
|
||||
|
||||
static gboolean run_flag = FALSE;
|
||||
|
||||
static void
|
||||
borderaverage_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
run_flag = TRUE;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
static gint
|
||||
borderaverage_dialog ()
|
||||
borderaverage_dialog (void)
|
||||
{
|
||||
GtkWidget *dlg, *frame, *vbox2;
|
||||
GtkWidget *vbox, *menu;
|
||||
gint runp;
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *menu;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
gint argc;
|
||||
|
||||
/* Set args */
|
||||
argc = 1;
|
||||
argv = g_new(gchar *, 1);
|
||||
argv[0] = g_strdup("borderaverage");
|
||||
gtk_init(&argc, &argv);
|
||||
gtk_rc_parse(gimp_gtkrc());
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("borderaverage");
|
||||
|
||||
dlg = mw_app_new("plug_in_borderaverage", _("Borderaverage"), &runp);
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show(vbox);
|
||||
dlg = gimp_dialog_new (_("Borderaverage"), "borderaverage",
|
||||
gimp_plugin_help_func, "filters/borderaverage.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
mw_ientry_new(vbox, _("Border Size"), _("Thickness"), &borderaverage_thickness);
|
||||
_("OK"), borderaverage_ok_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
_("Cancel"), gtk_widget_destroy,
|
||||
NULL, 1, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
frame=gck_frame_new(_("Number of colors"),vbox,GTK_SHADOW_ETCHED_IN,FALSE,FALSE,0,2);
|
||||
vbox2=gck_vbox_new(frame,FALSE,TRUE,TRUE,5,0,5);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dlg)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
menu=gck_option_menu_new(_("Bucket Size:"),vbox2,TRUE,TRUE,0,
|
||||
menu_labels,(GtkSignalFunc)menu_callback, NULL);
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(menu),borderaverage_bucket_exponent);
|
||||
gtk_widget_show(menu);
|
||||
mw_ientry_new (vbox, _("Border Size"), _("Thickness:"),
|
||||
&borderaverage_thickness);
|
||||
|
||||
gtk_widget_show(dlg);
|
||||
gtk_main();
|
||||
gdk_flush();
|
||||
frame = gtk_frame_new (_("Number of Colors"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
if (runp)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
menu = gck_option_menu_new (_("Bucket Size:"), vbox2, TRUE, TRUE, 0,
|
||||
menu_labels,
|
||||
(GtkSignalFunc) menu_callback, NULL);
|
||||
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (menu),
|
||||
borderaverage_bucket_exponent);
|
||||
gtk_widget_show (menu);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
gdk_flush ();
|
||||
|
||||
return run_flag;
|
||||
}
|
||||
|
||||
|
||||
void menu_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
borderaverage_bucket_exponent=(gint)gtk_object_get_data(GTK_OBJECT(widget),"_GckOptionMenuItemID");
|
||||
borderaverage_bucket_exponent=
|
||||
(gint) gtk_object_get_data (GTK_OBJECT (widget),"_GckOptionMenuItemID");
|
||||
}
|
||||
|
|
|
@ -583,39 +583,40 @@ DIALOG ()
|
|||
gtk_widget_show (frame);
|
||||
gtk_widget_show (hbox);
|
||||
#else
|
||||
frame = gtkW_frame_new (GTK_DIALOG (dlg)->vbox, _("Parameter settings"));
|
||||
frame = gtkW_frame_new (GTK_DIALOG (dlg)->vbox, _("Parameter Settings"));
|
||||
table = gtkW_table_new (frame, 7, 2);
|
||||
gtkW_table_add_menu (table, _("Horizontal style"), 0, index++,
|
||||
gtkW_table_add_menu (table, _("Horizontal Style:"), 0, index++,
|
||||
(GtkSignalFunc) gtkW_menu_update,
|
||||
&VALS.h_style,
|
||||
h_style_menu,
|
||||
sizeof (h_style_menu) / sizeof (h_style_menu[0]));
|
||||
gtkW_table_add_menu (table, _("Horizontal base"), 0, index++,
|
||||
gtkW_table_add_menu (table, _("Horizontal Base:"), 0, index++,
|
||||
(GtkSignalFunc) gtkW_menu_update,
|
||||
&VALS.h_base,
|
||||
h_base_menu,
|
||||
sizeof (h_base_menu) / sizeof (h_base_menu[0]));
|
||||
gtkW_table_add_menu (table, _("Vertical style"), 0, index++,
|
||||
gtkW_table_add_menu (table, _("Vertical Style:"), 0, index++,
|
||||
(GtkSignalFunc) gtkW_menu_update,
|
||||
&VALS.v_style,
|
||||
v_style_menu,
|
||||
sizeof (v_style_menu) / sizeof (v_style_menu[0]));
|
||||
gtkW_table_add_menu (table, _("Vertical base"), 0, index++,
|
||||
gtkW_table_add_menu (table, _("Vertical Base:"), 0, index++,
|
||||
(GtkSignalFunc) gtkW_menu_update,
|
||||
&VALS.v_base,
|
||||
v_base_menu,
|
||||
sizeof (v_base_menu) / sizeof (v_base_menu[0]));
|
||||
#endif
|
||||
|
||||
gtkW_table_add_toggle (table, _("Ignore the bottom layer even if visible"),
|
||||
gtkW_table_add_toggle (table, _("Ignore the Bottom Layer even if Visible"),
|
||||
0, index++,
|
||||
(GtkSignalFunc) gtkW_toggle_update,
|
||||
&VALS.ignore_bottom);
|
||||
gtkW_table_add_toggle (table, _("Use the (invisible) bottom layer as the base"),
|
||||
gtkW_table_add_toggle (table,
|
||||
_("Use the (Invisible) Bottom Layer as the Base"),
|
||||
0, index++,
|
||||
(GtkSignalFunc) gtkW_toggle_update,
|
||||
&VALS.base_is_bottom_layer);
|
||||
gtkW_table_add_iscale_entry (table, _("Grid size"),
|
||||
gtkW_table_add_iscale_entry (table, _("Grid Size:"),
|
||||
0, index++,
|
||||
(GtkSignalFunc) gtkW_iscale_update,
|
||||
(GtkSignalFunc) gtkW_ientry_update,
|
||||
|
@ -753,8 +754,8 @@ gtkW_message_dialog (gint gtk_was_initialized, gchar *message)
|
|||
|
||||
dlg = gtkW_message_dialog_new (PLUG_IN_NAME);
|
||||
|
||||
table = gtk_table_new (1,1, FALSE);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), GTKW_BORDER_WIDTH);
|
||||
table = gtk_table_new (1, 1, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new (message);
|
||||
|
@ -796,7 +797,9 @@ gtkW_table_new (GtkWidget *parent, gint col, gint row)
|
|||
GtkWidget *table;
|
||||
|
||||
table = gtk_table_new (col,row, FALSE);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), GTKW_BORDER_WIDTH);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (parent), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
|
@ -857,9 +860,9 @@ gtkW_frame_new (GtkWidget *parent,
|
|||
|
||||
frame = gtk_frame_new (name);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), GTKW_BORDER_WIDTH);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
if (parent != NULL)
|
||||
gtk_box_pack_start (GTK_BOX(parent), frame, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (parent), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
return frame;
|
||||
|
@ -902,9 +905,9 @@ gtkW_table_add_iscale_entry (GtkWidget *table,
|
|||
GtkWidget *label, *hbox, *scale, *entry;
|
||||
|
||||
label = gtk_label_new (name);
|
||||
gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.5);
|
||||
gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE(table), label, x, x+1, y, y+1,
|
||||
GTK_FILL|GTK_EXPAND, 0 & GTK_FILL, 5, 0);
|
||||
GTK_FILL|GTK_EXPAND, 0 & GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
|
@ -917,9 +920,8 @@ gtkW_table_add_iscale_entry (GtkWidget *table,
|
|||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
||||
gtk_widget_set_usize (scale, GTKW_SCALE_WIDTH, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
(GtkSignalFunc) scale_update, value);
|
||||
|
||||
|
@ -1020,9 +1022,9 @@ gtkW_table_add_menu (GtkWidget *table,
|
|||
gint i;
|
||||
|
||||
label = gtk_label_new (name);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, x, x + 1, y, y + 1,
|
||||
GTK_FILL|GTK_EXPAND, 0 & GTK_FILL, GTKW_BORDER_WIDTH, 0);
|
||||
GTK_FILL|GTK_EXPAND, 0 & GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,13 +19,20 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "gck/gck.h"
|
||||
#include "plug-ins/megawidget/megawidget.h"
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
|
||||
|
||||
|
||||
/* Declare local functions.
|
||||
|
@ -37,13 +44,16 @@ static void run (char *name,
|
|||
int *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
static void borderaverage(GDrawable *drawable, guchar *res_r, guchar *res_g, guchar *res_b);
|
||||
static void borderaverage (GDrawable *drawable,
|
||||
guchar *res_r, guchar *res_g, guchar *res_b);
|
||||
|
||||
static gint borderaverage_dialog(void);
|
||||
static gint borderaverage_dialog (void);
|
||||
|
||||
static void add_new_color (gint bytes, guchar* buffer, gint* cube, gint bucket_expo);
|
||||
static void add_new_color (gint bytes, guchar* buffer, gint* cube,
|
||||
gint bucket_expo);
|
||||
|
||||
void menu_callback(GtkWidget *widget, gpointer client_data);
|
||||
static void menu_callback (GtkWidget *widget,
|
||||
gpointer client_data);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
|
@ -53,23 +63,24 @@ GPlugInInfo PLUG_IN_INFO =
|
|||
run, /* run_proc */
|
||||
};
|
||||
|
||||
static gint borderaverage_thickness = 3;
|
||||
static gint borderaverage_bucket_exponent = 4;
|
||||
static gint borderaverage_thickness = 3;
|
||||
static gint borderaverage_bucket_exponent = 4;
|
||||
|
||||
struct borderaverage_data {
|
||||
gint thickness;
|
||||
gint bucket_exponent;
|
||||
} borderaverage_data = { 3, 4 };
|
||||
struct borderaverage_data
|
||||
{
|
||||
gint thickness;
|
||||
gint bucket_exponent;
|
||||
} borderaverage_data = { 3, 4 };
|
||||
|
||||
gchar * menu_labels[] =
|
||||
{
|
||||
"1 (nonsense?)", "2", "4", "8", "16", "32", "64", "128", "256 (nonsense?)"
|
||||
};
|
||||
{
|
||||
"1 (nonsense?)", "2", "4", "8", "16", "32", "64", "128", "256 (nonsense?)"
|
||||
};
|
||||
|
||||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef args[] =
|
||||
{
|
||||
|
@ -80,10 +91,10 @@ query ()
|
|||
{ PARAM_INT32, "bucket_exponent", "Bits for bucket size (default=4: 16 Levels)" },
|
||||
};
|
||||
static GParamDef return_vals[] =
|
||||
{
|
||||
{
|
||||
{ PARAM_INT32, "num_channels", "Number of color channels returned (always 3)" },
|
||||
{ PARAM_INT8ARRAY, "color_vals", "The average color of the specified border"},
|
||||
};
|
||||
{ PARAM_INT8ARRAY, "color_vals", "The average color of the specified border"},
|
||||
};
|
||||
static int nargs = sizeof (args) / sizeof (args[0]);
|
||||
static int nreturn_vals = sizeof (return_vals) / sizeof (return_vals[0]);
|
||||
|
||||
|
@ -109,81 +120,90 @@ run (char *name,
|
|||
int *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
{
|
||||
static GParam values[3];
|
||||
GDrawable *drawable;
|
||||
GRunModeType run_mode;
|
||||
GStatusType status = STATUS_SUCCESS;
|
||||
gint8 *result_color;
|
||||
static GParam values[3];
|
||||
GDrawable *drawable;
|
||||
GRunModeType run_mode;
|
||||
GStatusType status = STATUS_SUCCESS;
|
||||
gint8 *result_color;
|
||||
|
||||
INIT_I18N_UI();
|
||||
INIT_I18N_UI();
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
/* get the return memory */
|
||||
result_color = (gint8 *) g_new(gint8, 3);
|
||||
/* get the return memory */
|
||||
result_color = (gint8 *) g_new(gint8, 3);
|
||||
|
||||
/* Get the specified drawable */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
/* Get the specified drawable */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
|
||||
switch (run_mode) {
|
||||
case RUN_INTERACTIVE:
|
||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||
borderaverage_thickness = borderaverage_data.thickness;
|
||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||
if (! borderaverage_dialog())
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
break;
|
||||
switch (run_mode)
|
||||
{
|
||||
case RUN_INTERACTIVE:
|
||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||
borderaverage_thickness = borderaverage_data.thickness;
|
||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||
if (! borderaverage_dialog())
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
break;
|
||||
|
||||
case RUN_NONINTERACTIVE:
|
||||
if (nparams != 5)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
borderaverage_thickness = param[3].data.d_int32;
|
||||
borderaverage_bucket_exponent = param[4].data.d_int32;
|
||||
case RUN_NONINTERACTIVE:
|
||||
if (nparams != 5)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
borderaverage_thickness = param[3].data.d_int32;
|
||||
borderaverage_bucket_exponent = param[4].data.d_int32;
|
||||
break;
|
||||
|
||||
break;
|
||||
case RUN_WITH_LAST_VALS:
|
||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||
borderaverage_thickness = borderaverage_data.thickness;
|
||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||
break;
|
||||
|
||||
case RUN_WITH_LAST_VALS:
|
||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||
borderaverage_thickness = borderaverage_data.thickness;
|
||||
borderaverage_bucket_exponent = borderaverage_data.bucket_exponent;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
/* Make sure that the drawable is RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->id))
|
||||
{
|
||||
gimp_progress_init ("borderaverage");
|
||||
borderaverage (drawable,
|
||||
&result_color[0], &result_color[1], &result_color[2]);
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
{
|
||||
gimp_palette_set_foreground (result_color[0],
|
||||
result_color[1],
|
||||
result_color[2]);
|
||||
gimp_displays_flush ();
|
||||
}
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
borderaverage_data.thickness = borderaverage_thickness;
|
||||
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
||||
gimp_set_data ("plug_in_borderaverage",
|
||||
&borderaverage_data, sizeof (borderaverage_data));
|
||||
}
|
||||
|
||||
if (status == STATUS_SUCCESS) {
|
||||
/* Make sure that the drawable is RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->id)) {
|
||||
gimp_progress_init ("borderaverage");
|
||||
borderaverage (drawable, &result_color[0], &result_color[1], &result_color[2]);
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE) {
|
||||
gimp_palette_set_foreground(result_color[0],result_color[1],result_color[2]);
|
||||
gimp_displays_flush ();
|
||||
}
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
borderaverage_data.thickness = borderaverage_thickness;
|
||||
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
||||
gimp_set_data("plug_in_borderaverage", &borderaverage_data, sizeof(borderaverage_data));
|
||||
} else {
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
*nreturn_vals = 3;
|
||||
*return_vals = values;
|
||||
}
|
||||
*nreturn_vals = 3;
|
||||
*return_vals = values;
|
||||
|
||||
values[0].type = PARAM_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
values[0].type = PARAM_STATUS;
|
||||
values[0].data.d_status = status;
|
||||
|
||||
values[1].type = PARAM_INT32;
|
||||
values[1].data.d_int32 = 3;
|
||||
values[1].type = PARAM_INT32;
|
||||
values[1].data.d_int32 = 3;
|
||||
|
||||
values[2].type = PARAM_INT8ARRAY;
|
||||
values[2].data.d_int8array = result_color;
|
||||
values[2].type = PARAM_INT8ARRAY;
|
||||
values[2].data.d_int8array = result_color;
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -192,185 +212,233 @@ borderaverage (GDrawable *drawable,
|
|||
guchar *res_g,
|
||||
guchar *res_b)
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
gint x1, x2, y1, y2;
|
||||
gint bytes;
|
||||
gint max;
|
||||
|
||||
guchar r, g, b;
|
||||
|
||||
guchar *buffer;
|
||||
gint bucket_num, bucket_expo, bucket_rexpo;
|
||||
|
||||
gint* cube;
|
||||
|
||||
gint row, col, i,j,k; /* index variables */
|
||||
|
||||
GPixelRgn myPR;
|
||||
|
||||
|
||||
/* allocate and clear the cube before */
|
||||
bucket_expo = borderaverage_bucket_exponent;
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
cube = (gint*) malloc( (1 << (bucket_rexpo * 3)) * sizeof(gint) );
|
||||
bucket_num = 1 << bucket_rexpo;
|
||||
|
||||
for (i = 0; i < bucket_num; i++) {
|
||||
for (j = 0; j < bucket_num; j++) {
|
||||
for (k = 0; k < bucket_num; k++) {
|
||||
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get the input area. This is the bounding box of the selection in
|
||||
* the image (or the entire image if there is no selection). Only
|
||||
* operating on the input area is simply an optimization. It doesn't
|
||||
* need to be done for correct operation. (It simply makes it go
|
||||
* faster, since fewer pixels need to be operated on).
|
||||
*/
|
||||
gint width;
|
||||
gint height;
|
||||
gint x1, x2, y1, y2;
|
||||
gint bytes;
|
||||
gint max;
|
||||
|
||||
guchar r, g, b;
|
||||
|
||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
||||
guchar *buffer;
|
||||
gint bucket_num, bucket_expo, bucket_rexpo;
|
||||
|
||||
/* Get the size of the input image. (This will/must be the same
|
||||
* as the size of the output image.
|
||||
*/
|
||||
width = drawable->width;
|
||||
height = drawable->height;
|
||||
bytes = drawable->bpp;
|
||||
gint* cube;
|
||||
|
||||
/* allocate row buffer */
|
||||
buffer = (guchar *) malloc ((x2 - x1) * bytes);
|
||||
gint row, col, i,j,k; /* index variables */
|
||||
|
||||
GPixelRgn myPR;
|
||||
|
||||
/* initialize the pixel regions */
|
||||
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
||||
|
||||
/* loop through the rows, performing our magic*/
|
||||
for (row = y1; row < y2; row++) {
|
||||
|
||||
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
||||
/* allocate and clear the cube before */
|
||||
bucket_expo = borderaverage_bucket_exponent;
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
cube = g_new (gint, 1 << (bucket_rexpo * 3));
|
||||
bucket_num = 1 << bucket_rexpo;
|
||||
|
||||
if (row < y1 + borderaverage_thickness ||
|
||||
row >= y2 - borderaverage_thickness) {
|
||||
/* add the whole row */
|
||||
for (col = 0; col < ((x2 - x1) * bytes); col += bytes) {
|
||||
add_new_color(bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
} else {
|
||||
/* add the left border */
|
||||
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes) {
|
||||
add_new_color(bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
/* add the right border */
|
||||
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
||||
col < ((x2 - x1) * bytes); col += bytes) {
|
||||
add_new_color(bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((row % 5) == 0)
|
||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||
for (i = 0; i < bucket_num; i++)
|
||||
{
|
||||
for (j = 0; j < bucket_num; j++)
|
||||
{
|
||||
for (k = 0; k < bucket_num; k++)
|
||||
{
|
||||
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
max = 0; r = 0; g = 0; b = 0;
|
||||
|
||||
/* get max of cube */
|
||||
for (i = 0; i < bucket_num; i++) {
|
||||
for (j = 0; j < bucket_num; j++) {
|
||||
for (k = 0; k < bucket_num; k++) {
|
||||
if (cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] > max) {
|
||||
max = cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k];
|
||||
r = (i<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* return the color */
|
||||
*res_r = r;
|
||||
*res_g = g;
|
||||
*res_b = b;
|
||||
}
|
||||
|
||||
free (buffer);
|
||||
/* Get the input area. This is the bounding box of the selection in
|
||||
* the image (or the entire image if there is no selection). Only
|
||||
* operating on the input area is simply an optimization. It doesn't
|
||||
* need to be done for correct operation. (It simply makes it go
|
||||
* faster, since fewer pixels need to be operated on).
|
||||
*/
|
||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
||||
|
||||
/* Get the size of the input image. (This will/must be the same
|
||||
* as the size of the output image.
|
||||
*/
|
||||
width = drawable->width;
|
||||
height = drawable->height;
|
||||
bytes = drawable->bpp;
|
||||
|
||||
/* allocate row buffer */
|
||||
buffer = g_new (guchar, (x2 - x1) * bytes);
|
||||
|
||||
/* initialize the pixel regions */
|
||||
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
||||
|
||||
/* loop through the rows, performing our magic*/
|
||||
for (row = y1; row < y2; row++)
|
||||
{
|
||||
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
||||
|
||||
if (row < y1 + borderaverage_thickness ||
|
||||
row >= y2 - borderaverage_thickness)
|
||||
{
|
||||
/* add the whole row */
|
||||
for (col = 0; col < ((x2 - x1) * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add the left border */
|
||||
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
/* add the right border */
|
||||
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
||||
col < ((x2 - x1) * bytes); col += bytes)
|
||||
{
|
||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||
}
|
||||
}
|
||||
|
||||
if ((row % 5) == 0)
|
||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||
}
|
||||
|
||||
max = 0; r = 0; g = 0; b = 0;
|
||||
|
||||
/* get max of cube */
|
||||
for (i = 0; i < bucket_num; i++)
|
||||
{
|
||||
for (j = 0; j < bucket_num; j++)
|
||||
{
|
||||
for (k = 0; k < bucket_num; k++)
|
||||
{
|
||||
if (cube[(i << (bucket_rexpo << 1)) +
|
||||
(j << bucket_rexpo) + k] > max)
|
||||
{
|
||||
max = cube[(i << (bucket_rexpo << 1)) +
|
||||
(j << bucket_rexpo) + k];
|
||||
r = (i<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* return the color */
|
||||
*res_r = r;
|
||||
*res_g = g;
|
||||
*res_b = b;
|
||||
|
||||
g_free (buffer);
|
||||
g_free (cube);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_new_color (gint bytes,
|
||||
guchar *buffer,
|
||||
gint *cube,
|
||||
gint bucket_expo)
|
||||
{
|
||||
guchar r,g,b;
|
||||
gint bucket_rexpo;
|
||||
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
r = buffer[0] >>bucket_expo;
|
||||
if (bytes > 1) {
|
||||
g = buffer[1] >>bucket_expo;
|
||||
} else {
|
||||
g = 0;
|
||||
}
|
||||
if (bytes > 2) {
|
||||
b = buffer[2] >>bucket_expo;
|
||||
} else {
|
||||
b = 0;
|
||||
}
|
||||
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
||||
guchar r, g, b;
|
||||
gint bucket_rexpo;
|
||||
|
||||
bucket_rexpo = 8 - bucket_expo;
|
||||
r = buffer[0] >>bucket_expo;
|
||||
if (bytes > 1)
|
||||
{
|
||||
g = buffer[1] >>bucket_expo;
|
||||
}
|
||||
else
|
||||
{
|
||||
g = 0;
|
||||
}
|
||||
if (bytes > 2)
|
||||
{
|
||||
b = buffer[2] >>bucket_expo;
|
||||
}
|
||||
else
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
||||
}
|
||||
|
||||
static gboolean run_flag = FALSE;
|
||||
|
||||
static void
|
||||
borderaverage_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
run_flag = TRUE;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
static gint
|
||||
borderaverage_dialog ()
|
||||
borderaverage_dialog (void)
|
||||
{
|
||||
GtkWidget *dlg, *frame, *vbox2;
|
||||
GtkWidget *vbox, *menu;
|
||||
gint runp;
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *menu;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
gint argc;
|
||||
|
||||
/* Set args */
|
||||
argc = 1;
|
||||
argv = g_new(gchar *, 1);
|
||||
argv[0] = g_strdup("borderaverage");
|
||||
gtk_init(&argc, &argv);
|
||||
gtk_rc_parse(gimp_gtkrc());
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("borderaverage");
|
||||
|
||||
dlg = mw_app_new("plug_in_borderaverage", _("Borderaverage"), &runp);
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show(vbox);
|
||||
dlg = gimp_dialog_new (_("Borderaverage"), "borderaverage",
|
||||
gimp_plugin_help_func, "filters/borderaverage.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
mw_ientry_new(vbox, _("Border Size"), _("Thickness"), &borderaverage_thickness);
|
||||
_("OK"), borderaverage_ok_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
_("Cancel"), gtk_widget_destroy,
|
||||
NULL, 1, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
frame=gck_frame_new(_("Number of colors"),vbox,GTK_SHADOW_ETCHED_IN,FALSE,FALSE,0,2);
|
||||
vbox2=gck_vbox_new(frame,FALSE,TRUE,TRUE,5,0,5);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dlg)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
menu=gck_option_menu_new(_("Bucket Size:"),vbox2,TRUE,TRUE,0,
|
||||
menu_labels,(GtkSignalFunc)menu_callback, NULL);
|
||||
gtk_option_menu_set_history(GTK_OPTION_MENU(menu),borderaverage_bucket_exponent);
|
||||
gtk_widget_show(menu);
|
||||
mw_ientry_new (vbox, _("Border Size"), _("Thickness:"),
|
||||
&borderaverage_thickness);
|
||||
|
||||
gtk_widget_show(dlg);
|
||||
gtk_main();
|
||||
gdk_flush();
|
||||
frame = gtk_frame_new (_("Number of Colors"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
if (runp)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
menu = gck_option_menu_new (_("Bucket Size:"), vbox2, TRUE, TRUE, 0,
|
||||
menu_labels,
|
||||
(GtkSignalFunc) menu_callback, NULL);
|
||||
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (menu),
|
||||
borderaverage_bucket_exponent);
|
||||
gtk_widget_show (menu);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
gdk_flush ();
|
||||
|
||||
return run_flag;
|
||||
}
|
||||
|
||||
|
||||
void menu_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
borderaverage_bucket_exponent=(gint)gtk_object_get_data(GTK_OBJECT(widget),"_GckOptionMenuItemID");
|
||||
borderaverage_bucket_exponent=
|
||||
(gint) gtk_object_get_data (GTK_OBJECT (widget),"_GckOptionMenuItemID");
|
||||
}
|
||||
|
|
|
@ -28,45 +28,48 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#define PRV_WIDTH 40
|
||||
#define PRV_HEIGHT 20
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
guchar color[3];
|
||||
} C2AValues;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
gint run;
|
||||
} C2AInterface;
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *color_button;
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *color_button;
|
||||
} C2APreview;
|
||||
|
||||
/* Declare local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
static void toalpha (GDrawable *drawable);
|
||||
|
||||
static void toalpha_render_row (const guchar *src_row,
|
||||
guchar *dest_row,
|
||||
gint row_width,
|
||||
const gint bytes);
|
||||
guchar *dest_row,
|
||||
gint row_width,
|
||||
const gint bytes);
|
||||
/* UI stuff */
|
||||
static gint colortoalpha_dialog (GDrawable *drawable);
|
||||
static void C2A_close_callback (GtkWidget *widget, gpointer data);
|
||||
static void C2A_ok_callback (GtkWidget *widget, gpointer data);
|
||||
static gint colortoalpha_dialog (GDrawable *drawable);
|
||||
static void colortoalpha_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static GRunModeType run_mode;
|
||||
|
||||
|
@ -96,7 +99,7 @@ static C2APreview ppreview =
|
|||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef args[] =
|
||||
{
|
||||
|
@ -125,10 +128,10 @@ query ()
|
|||
}
|
||||
|
||||
static void
|
||||
run (char *name,
|
||||
int nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
{
|
||||
static GParam values[1];
|
||||
|
@ -152,33 +155,33 @@ run (char *name,
|
|||
image_ID = param[1].data.d_image;
|
||||
|
||||
switch (run_mode)
|
||||
{
|
||||
case RUN_INTERACTIVE:
|
||||
gimp_get_data ("plug_in_colortoalpha", &pvals);
|
||||
if (! colortoalpha_dialog (drawable ))
|
||||
{
|
||||
gimp_drawable_detach (drawable);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case RUN_NONINTERACTIVE:
|
||||
if (nparams != 3)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
pvals.color[0] = param[3].data.d_color.red;
|
||||
pvals.color[1] = param[3].data.d_color.green;
|
||||
pvals.color[2] = param[3].data.d_color.blue;
|
||||
}
|
||||
break;
|
||||
case RUN_INTERACTIVE:
|
||||
gimp_get_data ("plug_in_colortoalpha", &pvals);
|
||||
if (! colortoalpha_dialog (drawable ))
|
||||
{
|
||||
gimp_drawable_detach (drawable);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case RUN_NONINTERACTIVE:
|
||||
if (nparams != 3)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
pvals.color[0] = param[3].data.d_color.red;
|
||||
pvals.color[1] = param[3].data.d_color.green;
|
||||
pvals.color[2] = param[3].data.d_color.blue;
|
||||
}
|
||||
break;
|
||||
|
||||
case RUN_WITH_LAST_VALS:
|
||||
gimp_get_data ("plug_in_colortoalpha", &pvals);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case RUN_WITH_LAST_VALS:
|
||||
gimp_get_data ("plug_in_colortoalpha", &pvals);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
|
@ -294,15 +297,15 @@ toalpha_render_row (const guchar *src_data,
|
|||
However, since v1 < COLOR_RED, for example, all of these
|
||||
are negative so we have to invert the operator to reduce
|
||||
the amount of typing to fix the problem. :) */
|
||||
colortoalpha(&v1, &v2, &v3, &v4,
|
||||
(float)pvals.color[0],
|
||||
(float)pvals.color[1],
|
||||
(float)pvals.color[2]);
|
||||
colortoalpha (&v1, &v2, &v3, &v4,
|
||||
(float)pvals.color[0],
|
||||
(float)pvals.color[1],
|
||||
(float)pvals.color[2]);
|
||||
|
||||
dest_data[col*bytes ] = (int)v1;
|
||||
dest_data[col*bytes +1] = (int)v2;
|
||||
dest_data[col*bytes +2] = (int)v3;
|
||||
dest_data[col*bytes +3] = (int)v4;
|
||||
dest_data[col * bytes ] = (int) v1;
|
||||
dest_data[col * bytes + 1] = (int) v2;
|
||||
dest_data[col * bytes + 2] = (int) v3;
|
||||
dest_data[col * bytes + 3] = (int) v4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,9 +319,10 @@ toalpha_render_region (const GPixelRgn srcPR,
|
|||
|
||||
for (row = 0; row < srcPR.h ; row++)
|
||||
{
|
||||
if (srcPR.bpp!=4) {
|
||||
gimp_message("Not the proper bpp! \n");
|
||||
exit(1);
|
||||
if (srcPR.bpp!=4)
|
||||
{
|
||||
gimp_message ("Not the proper bpp! \n");
|
||||
exit(1);
|
||||
}
|
||||
toalpha_render_row (src_ptr, dest_ptr,
|
||||
srcPR.w,
|
||||
|
@ -384,12 +388,12 @@ colortoalpha_dialog (GDrawable *drawable)
|
|||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
|
||||
guchar *color_cube;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
guchar *color_cube;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("colortoalpha");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
@ -410,7 +414,7 @@ colortoalpha_dialog (GDrawable *drawable)
|
|||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("OK"), C2A_ok_callback,
|
||||
_("OK"), colortoalpha_ok_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
_("Cancel"), gtk_widget_destroy,
|
||||
NULL, 1, NULL, FALSE, TRUE,
|
||||
|
@ -418,33 +422,33 @@ colortoalpha_dialog (GDrawable *drawable)
|
|||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
GTK_SIGNAL_FUNC (C2A_close_callback),
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
table = gtk_table_new (1, 3, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
|
||||
label = gtk_label_new (_("From:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach_defaults ( GTK_TABLE(table), label, 0, 1, 0, 1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
button = gimp_color_button_new (_("Color to Alpha Color Picker"),
|
||||
PRV_WIDTH, PRV_HEIGHT,
|
||||
pvals.color, 3);
|
||||
gtk_table_attach (GTK_TABLE(table), button, 1, 2, 0, 1,
|
||||
GTK_FILL, GTK_SHRINK, 4, 4) ;
|
||||
gtk_widget_show(button);
|
||||
ppreview.color_button = button;
|
||||
|
||||
label = gtk_label_new (_("to alpha"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach_defaults ( GTK_TABLE(table), label, 2, 3, 0, 1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
label = gtk_label_new (_("From:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach_defaults (GTK_TABLE(table), label, 0, 1, 0, 1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
button = gimp_color_button_new (_("Color to Alpha Color Picker"),
|
||||
PRV_WIDTH, PRV_HEIGHT,
|
||||
pvals.color, 3);
|
||||
gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1,
|
||||
GTK_FILL, GTK_SHRINK, 4, 4) ;
|
||||
gtk_widget_show (button);
|
||||
ppreview.color_button = button;
|
||||
|
||||
label = gtk_label_new (_("to Alpha"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach_defaults (GTK_TABLE(table), label, 2, 3, 0, 1);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
|
@ -453,18 +457,11 @@ colortoalpha_dialog (GDrawable *drawable)
|
|||
return pint.run;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
C2A_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
C2A_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
colortoalpha_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
pint.run = TRUE;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
|
|
@ -49,8 +49,9 @@ static char ident[] = "@(#) GIMP Compose plug-in v1.03 17-Mar-99";
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
/* Declare local functions
|
||||
|
@ -98,8 +99,6 @@ static gint check_gray (gint32 image_id,
|
|||
static void image_menu_callback (gint32 id,
|
||||
gpointer data);
|
||||
|
||||
static void compose_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void compose_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void compose_type_toggle_update (GtkWidget *widget,
|
||||
|
@ -813,23 +812,22 @@ compose_dialog (char *compose_type,
|
|||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
GTK_SIGNAL_FUNC (compose_close_callback),
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
/* parameter settings */
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The left frame keeps the compose type toggles */
|
||||
left_frame = gtk_frame_new (_("Compose channels:"));
|
||||
left_frame = gtk_frame_new (_("Compose Channels"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (left_frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (left_frame), 5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), left_frame, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), left_frame, FALSE, FALSE, 0);
|
||||
|
||||
left_vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (left_vbox), 5);
|
||||
left_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (left_vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (left_frame), left_vbox);
|
||||
|
||||
/* The right frame keeps the selection menues for images. */
|
||||
|
@ -837,31 +835,30 @@ compose_dialog (char *compose_type,
|
|||
/* in the left frame is changed, fill in the right part first. */
|
||||
/* Otherwise it can occur, that a non-existing label might be changed. */
|
||||
|
||||
right_frame = gtk_frame_new (_("Channel representations:"));
|
||||
right_frame = gtk_frame_new (_("Channel Representations"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (right_frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (right_frame), 5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), right_frame, TRUE, TRUE, 0);
|
||||
|
||||
right_vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (right_vbox), 5);
|
||||
right_vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (right_vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (right_frame), right_vbox);
|
||||
|
||||
table = gtk_table_new (MAX_COMPOSE_IMAGES, 3, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
|
||||
table = gtk_table_new (MAX_COMPOSE_IMAGES, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* Channel names */
|
||||
for (j = 0; j < MAX_COMPOSE_IMAGES; j++)
|
||||
{
|
||||
composeint.channel_label[j] = label =
|
||||
gtk_label_new (gettext (compose_dsc[compose_idx].channel_name[j]));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 1, 2, j, j+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
{
|
||||
composeint.channel_label[j] = label =
|
||||
gtk_label_new (gettext (compose_dsc[compose_idx].channel_name[j]));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, j, j+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
/* Set sensitivity of last label */
|
||||
sensitive = (strcmp (compose_dsc[compose_idx].channel_name[3],
|
||||
CHNL_NA) != 0);
|
||||
|
@ -869,35 +866,36 @@ compose_dialog (char *compose_type,
|
|||
|
||||
/* Menues to select images */
|
||||
for (j = 0; j < MAX_COMPOSE_IMAGES; j++)
|
||||
{
|
||||
composeint.select_ID[j] = drawable_ID;
|
||||
composeint.channel_menu[j] = image_option_menu = gtk_option_menu_new ();
|
||||
image_menu = gimp_drawable_menu_new (check_gray, image_menu_callback,
|
||||
&(composeint.select_ID[j]), composeint.select_ID[j]);
|
||||
gtk_table_attach (GTK_TABLE (table), image_option_menu, 2, 3, j, j+1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
{
|
||||
composeint.select_ID[j] = drawable_ID;
|
||||
composeint.channel_menu[j] = image_option_menu = gtk_option_menu_new ();
|
||||
image_menu = gimp_drawable_menu_new (check_gray, image_menu_callback,
|
||||
&(composeint.select_ID[j]),
|
||||
composeint.select_ID[j]);
|
||||
gtk_table_attach (GTK_TABLE (table), image_option_menu, 1, 2, j, j+1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
|
||||
gtk_widget_show (image_option_menu);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (image_option_menu), image_menu);
|
||||
}
|
||||
gtk_widget_show (image_option_menu);
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (image_option_menu), image_menu);
|
||||
}
|
||||
gtk_widget_set_sensitive (composeint.channel_menu[3], sensitive);
|
||||
|
||||
/* Compose types */
|
||||
group = NULL;
|
||||
for (j = 0; j < MAX_COMPOSE_TYPES; j++)
|
||||
{
|
||||
toggle = gtk_radio_button_new_with_label (group,
|
||||
gettext(compose_dsc[j].compose_type));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (toggle));
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), toggle, TRUE, TRUE, 0);
|
||||
composeint.compose_flag[j] = (j == compose_idx);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) compose_type_toggle_update,
|
||||
&(composeint.compose_flag[j]));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
composeint.compose_flag[j]);
|
||||
gtk_widget_show (toggle);
|
||||
}
|
||||
{
|
||||
toggle = gtk_radio_button_new_with_label (group,
|
||||
gettext(compose_dsc[j].compose_type));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (toggle));
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), toggle, TRUE, TRUE, 0);
|
||||
composeint.compose_flag[j] = (j == compose_idx);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) compose_type_toggle_update,
|
||||
&(composeint.compose_flag[j]));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
composeint.compose_flag[j]);
|
||||
gtk_widget_show (toggle);
|
||||
}
|
||||
|
||||
gtk_widget_show (left_vbox);
|
||||
gtk_widget_show (right_vbox);
|
||||
|
@ -1020,18 +1018,11 @@ image_menu_callback (gint32 id,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
compose_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
compose_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{int j;
|
||||
{
|
||||
int j;
|
||||
|
||||
composeint.run = TRUE;
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
|
|
|
@ -41,8 +41,8 @@ static char ident[] = "@(#) GIMP Decompose plug-in v1.01 19-Mar-99";
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
|
@ -107,8 +107,6 @@ static void extract_yellowk (unsigned char *src, int bpp, int numpix,
|
|||
|
||||
static gint decompose_dialog (void);
|
||||
|
||||
static void decompose_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void decompose_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void decompose_toggle_update (GtkWidget *widget,
|
||||
|
@ -190,7 +188,7 @@ static GRunModeType run_mode;
|
|||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef args[] =
|
||||
{
|
||||
|
@ -230,12 +228,13 @@ query ()
|
|||
args, return_vals);
|
||||
}
|
||||
|
||||
static void show_message (const char *message)
|
||||
static void
|
||||
show_message (const char *message)
|
||||
{
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
gimp_message (message);
|
||||
else
|
||||
printf ("%s\n", message);
|
||||
g_print ("%s\n", message);
|
||||
}
|
||||
|
||||
|
||||
|
@ -990,35 +989,35 @@ decompose_dialog (void)
|
|||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
GTK_SIGNAL_FUNC (decompose_close_callback),
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
/* parameter settings */
|
||||
frame = gtk_frame_new (_("Extract channels:"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
group = NULL;
|
||||
for (j = 0; j < NUM_EXTRACT_TYPES; j++)
|
||||
{
|
||||
if (!extract[j].dialog) continue;
|
||||
toggle = gtk_radio_button_new_with_label (group, extract[j].type);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (toggle));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
|
||||
decoint.extract_flag[j] =
|
||||
(cmp_icase (decovals.extract_type, extract[j].type) == 0);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) decompose_toggle_update,
|
||||
&(decoint.extract_flag[j]));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
decoint.extract_flag[j]);
|
||||
gtk_widget_show (toggle);
|
||||
}
|
||||
{
|
||||
if (!extract[j].dialog) continue;
|
||||
toggle = gtk_radio_button_new_with_label (group, extract[j].type);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (toggle));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
|
||||
decoint.extract_flag[j] =
|
||||
(cmp_icase (decovals.extract_type, extract[j].type) == 0);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
GTK_SIGNAL_FUNC (decompose_toggle_update),
|
||||
&(decoint.extract_flag[j]));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
decoint.extract_flag[j]);
|
||||
gtk_widget_show (toggle);
|
||||
}
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (frame);
|
||||
gtk_widget_show (dlg);
|
||||
|
@ -1029,32 +1028,23 @@ decompose_dialog (void)
|
|||
return decoint.run;
|
||||
}
|
||||
|
||||
|
||||
/* Decompose interface functions */
|
||||
|
||||
static void
|
||||
decompose_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
decompose_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{int j;
|
||||
{
|
||||
int j;
|
||||
|
||||
decoint.run = TRUE;
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
|
||||
for (j = 0; j < NUM_EXTRACT_TYPES; j++)
|
||||
{
|
||||
if (decoint.extract_flag[j])
|
||||
{
|
||||
strcpy (decovals.extract_type, extract[j].type);
|
||||
break;
|
||||
if (decoint.extract_flag[j])
|
||||
{
|
||||
strcpy (decovals.extract_type, extract[j].type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -108,7 +108,7 @@ static BlurInterface bint =
|
|||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef args[] =
|
||||
{
|
||||
|
@ -280,35 +280,36 @@ gauss_iir_dialog (void)
|
|||
NULL);
|
||||
|
||||
/* parameter settings */
|
||||
frame = gtk_frame_new ( _("Parameter Settings"));
|
||||
frame = gtk_frame_new (_("Parameter Settings"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 10);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
toggle = gtk_check_button_new_with_label ( _("Blur Horizontally"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
|
||||
toggle = gtk_check_button_new_with_label (_("Blur Horizontally"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) gauss_toggle_update,
|
||||
&bvals.horizontal);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.horizontal);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
toggle = gtk_check_button_new_with_label ( _("Blur Vertically"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
|
||||
toggle = gtk_check_button_new_with_label (_("Blur Vertically"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) gauss_toggle_update,
|
||||
&bvals.vertical);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ( _("Blur Radius: "));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
|
||||
label = gtk_label_new (_("Blur Radius:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
#include <libgimp/gimpmath.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
|
@ -53,10 +53,10 @@ static void run (gchar *name,
|
|||
gint *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
static void gauss_rle (GDrawable *drawable,
|
||||
gint horizontal,
|
||||
gint vertical,
|
||||
gdouble std_dev);
|
||||
static void gauss_rle (GDrawable *drawable,
|
||||
gint horizontal,
|
||||
gint vertical,
|
||||
gdouble std_dev);
|
||||
|
||||
/*
|
||||
* Gaussian blur interface
|
||||
|
@ -279,33 +279,34 @@ gauss_rle_dialog (void)
|
|||
/* parameter settings */
|
||||
frame = gtk_frame_new (_("Parameter Settings"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 10);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
toggle = gtk_check_button_new_with_label (_("Blur Horizontally"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) gauss_toggle_update,
|
||||
GTK_SIGNAL_FUNC (gauss_toggle_update),
|
||||
&bvals.horizontal);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.horizontal);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
toggle = gtk_check_button_new_with_label (_("Blur Vertically"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) gauss_toggle_update,
|
||||
GTK_SIGNAL_FUNC (gauss_toggle_update),
|
||||
&bvals.vertical);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Blur Radius: "));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
|
||||
label = gtk_label_new (_("Blur Radius:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
|
@ -314,7 +315,7 @@ gauss_rle_dialog (void)
|
|||
g_snprintf (buffer, sizeof (buffer), "%f", bvals.radius);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) gauss_entry_callback,
|
||||
GTK_SIGNAL_FUNC (gauss_entry_callback),
|
||||
NULL);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
|
|
|
@ -59,22 +59,25 @@ typedef struct
|
|||
|
||||
PluginValues plvals =
|
||||
{
|
||||
{ { 0, 0, 0}, { 255, 255, 255 }, { 0, 0, 0 }, { 255, 255, 255 } },
|
||||
{
|
||||
{ 0, 0, 0},
|
||||
{ 255, 255, 255 },
|
||||
{ 0, 0, 0 },
|
||||
{ 255, 255, 255 }
|
||||
},
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
gint run_flag = FALSE;
|
||||
|
||||
|
||||
/* Declare some local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
|
@ -91,7 +94,8 @@ static void add_color_button (int csel_index,
|
|||
int left,
|
||||
int top,
|
||||
GtkWidget *table);
|
||||
static void color_mapping (GDrawable *drawable);
|
||||
|
||||
static void color_mapping (GDrawable *drawable);
|
||||
|
||||
|
||||
/* The run mode */
|
||||
|
@ -106,10 +110,8 @@ static char *csel_title[4] =
|
|||
};
|
||||
|
||||
|
||||
|
||||
MAIN ()
|
||||
|
||||
|
||||
static void
|
||||
query (void)
|
||||
|
||||
|
@ -168,10 +170,10 @@ Other colors are mapped by interpolation."),
|
|||
|
||||
|
||||
static void
|
||||
run (char *name,
|
||||
int nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
|
||||
{
|
||||
|
@ -193,100 +195,101 @@ run (char *name,
|
|||
values[0].data.d_status = status;
|
||||
|
||||
while (status == STATUS_SUCCESS)
|
||||
{
|
||||
if (nparams < 3)
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
if (nparams < 3)
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make sure the drawable is RGB color */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
if (!gimp_drawable_is_rgb (drawable->id))
|
||||
{
|
||||
gimp_message (_("Color Mapping / Adjust FG/BG:\nCannot operate on grey/indexed images"));
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp (name, "plug_in_color_adjust") == 0)
|
||||
{
|
||||
if (nparams != 3) /* Make sure all the arguments are there */
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
c = &(plvals.colors[0][0]); /* First source color */
|
||||
gimp_palette_get_foreground (c, c+1, c+2);
|
||||
c = &(plvals.colors[1][0]); /* Second source color */
|
||||
gimp_palette_get_background (c, c+1, c+2);
|
||||
c = &(plvals.colors[2][0]); /* First destination color */
|
||||
c[0] = c[1] = c[2] = 0; /* Foreground mapped to black */
|
||||
c = &(plvals.colors[3][0]); /* second destination color */
|
||||
c[0] = c[1] = c[2] = 255; /* Background mapped to white */
|
||||
plvals.map_mode = 0;
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_init (_("Adjusting Foreground/Background"));
|
||||
|
||||
color_mapping (drawable);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp (name, "plug_in_color_map") == 0)
|
||||
{
|
||||
if (run_mode == RUN_NONINTERACTIVE)
|
||||
{
|
||||
if (nparams != 8) /* Make sure all the arguments are there */
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
plvals.colors[j][0] = param[3+j].data.d_color.red;
|
||||
plvals.colors[j][1] = param[3+j].data.d_color.green;
|
||||
plvals.colors[j][2] = param[3+j].data.d_color.blue;
|
||||
}
|
||||
plvals.map_mode = param[7].data.d_int32;
|
||||
}
|
||||
else if (run_mode == RUN_INTERACTIVE)
|
||||
{
|
||||
gimp_get_data (name, &plvals);
|
||||
|
||||
c = &(plvals.colors[0][0]); /* First source color */
|
||||
gimp_palette_get_foreground (c, c+1, c+2);
|
||||
c = &(plvals.colors[1][0]); /* Second source color */
|
||||
gimp_palette_get_background (c, c+1, c+2);
|
||||
|
||||
if (!dialog ())
|
||||
break;
|
||||
}
|
||||
else if (run_mode == RUN_WITH_LAST_VALS)
|
||||
{
|
||||
gimp_get_data (name, &plvals);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_init (_("Mapping colors"));
|
||||
|
||||
color_mapping (drawable);
|
||||
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
gimp_set_data (name, &plvals, sizeof (plvals));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make sure the drawable is RGB color */
|
||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||
if (!gimp_drawable_is_rgb (drawable->id))
|
||||
{
|
||||
gimp_message (_("Color Mapping / Adjust FG/BG:\nCannot operate on grey/indexed images"));
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp (name, "plug_in_color_adjust") == 0)
|
||||
{
|
||||
if (nparams != 3) /* Make sure all the arguments are there */
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
c = &(plvals.colors[0][0]); /* First source color */
|
||||
gimp_palette_get_foreground (c, c+1, c+2);
|
||||
c = &(plvals.colors[1][0]); /* Second source color */
|
||||
gimp_palette_get_background (c, c+1, c+2);
|
||||
c = &(plvals.colors[2][0]); /* First destination color */
|
||||
c[0] = c[1] = c[2] = 0; /* Foreground mapped to black */
|
||||
c = &(plvals.colors[3][0]); /* second destination color */
|
||||
c[0] = c[1] = c[2] = 255; /* Background mapped to white */
|
||||
plvals.map_mode = 0;
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_init (_("Adjusting Foreground/Background"));
|
||||
|
||||
color_mapping (drawable);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcmp (name, "plug_in_color_map") == 0)
|
||||
{
|
||||
if (run_mode == RUN_NONINTERACTIVE)
|
||||
{
|
||||
if (nparams != 8) /* Make sure all the arguments are there */
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
plvals.colors[j][0] = param[3+j].data.d_color.red;
|
||||
plvals.colors[j][1] = param[3+j].data.d_color.green;
|
||||
plvals.colors[j][2] = param[3+j].data.d_color.blue;
|
||||
}
|
||||
plvals.map_mode = param[7].data.d_int32;
|
||||
}
|
||||
else if (run_mode == RUN_INTERACTIVE)
|
||||
{
|
||||
gimp_get_data (name, &plvals);
|
||||
|
||||
c = &(plvals.colors[0][0]); /* First source color */
|
||||
gimp_palette_get_foreground (c, c+1, c+2);
|
||||
c = &(plvals.colors[1][0]); /* Second source color */
|
||||
gimp_palette_get_background (c, c+1, c+2);
|
||||
|
||||
if (!dialog ()) break;
|
||||
}
|
||||
else if (run_mode == RUN_WITH_LAST_VALS)
|
||||
{
|
||||
gimp_get_data (name, &plvals);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = STATUS_CALLING_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_init (_("Mapping colors"));
|
||||
|
||||
color_mapping (drawable);
|
||||
|
||||
if (run_mode == RUN_INTERACTIVE)
|
||||
gimp_set_data (name, &plvals, sizeof (plvals));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if ((status == STATUS_SUCCESS) && (run_mode != RUN_NONINTERACTIVE))
|
||||
gimp_displays_flush ();
|
||||
|
||||
|
@ -294,16 +297,15 @@ run (char *name,
|
|||
values[0].data.d_status = status;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
dialog ()
|
||||
dialog (void)
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *table;
|
||||
guchar *color_cube;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
guchar *color_cube;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
|
@ -319,6 +321,7 @@ dialog ()
|
|||
color_cube = gimp_color_cube ();
|
||||
gtk_preview_set_color_cube (color_cube[0], color_cube[1],
|
||||
color_cube[2], color_cube[3]);
|
||||
|
||||
gtk_widget_set_default_visual (gtk_preview_get_visual ());
|
||||
gtk_widget_set_default_colormap (gtk_preview_get_cmap ());
|
||||
|
||||
|
@ -339,21 +342,22 @@ dialog ()
|
|||
NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The table keeps the color selections */
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
|
||||
table = gtk_table_new (2, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 1, 6);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
add_color_button (0, 0, 1, table);
|
||||
add_color_button (1, 0, 2, table);
|
||||
add_color_button (2, 2, 1, table);
|
||||
add_color_button (3, 2, 2, table);
|
||||
add_color_button (0, 0, 0, table);
|
||||
add_color_button (1, 2, 0, table);
|
||||
add_color_button (2, 0, 1, table);
|
||||
add_color_button (3, 2, 1, table);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
|
@ -363,43 +367,30 @@ dialog ()
|
|||
return run_flag;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_color_button (int csel_index,
|
||||
int left,
|
||||
int top,
|
||||
add_color_button (gint csel_index,
|
||||
gint left,
|
||||
gint top,
|
||||
GtkWidget *table)
|
||||
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, left, left+1, top, top+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
label = gtk_label_new ((left == 0) ? _("From:") : _("To:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, left, left+1, top, top+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
label = gtk_label_new ((left == 0) ? _("From:") : _("To:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, left+1, left+2, top, top+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
|
||||
button = gimp_color_button_new (gettext (csel_title[csel_index]),
|
||||
PRV_WIDTH, PRV_HEIGHT,
|
||||
plvals.colors[csel_index], 3);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (hbox);
|
||||
button = gimp_color_button_new (gettext (csel_title[csel_index]),
|
||||
PRV_WIDTH, PRV_HEIGHT,
|
||||
plvals.colors[csel_index], 3);
|
||||
gtk_table_attach (GTK_TABLE (table), button, left+1, left+2, top, top+1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapcolor_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -411,7 +402,6 @@ mapcolor_ok_callback (GtkWidget *widget,
|
|||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
get_mapping (guchar *src_col1,
|
||||
guchar *src_col2,
|
||||
|
@ -428,30 +418,29 @@ get_mapping (guchar *src_col1,
|
|||
|
||||
/* Currently we always do a linear mapping */
|
||||
|
||||
colormap[0] = redmap;
|
||||
colormap[1] = greenmap;
|
||||
colormap[2] = bluemap;
|
||||
colormap[0] = redmap;
|
||||
colormap[1] = greenmap;
|
||||
colormap[2] = bluemap;
|
||||
|
||||
switch (map_mode)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
for (rgb = 0; rgb < 3; rgb++)
|
||||
{
|
||||
a = src_col1[rgb]; as = dst_col1[rgb];
|
||||
b = src_col2[rgb]; bs = dst_col2[rgb];
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
j = ((i - a) * (bs - as)) / (b - a) + as;
|
||||
if (j > 255) j = 255; else if (j < 0) j = 0;
|
||||
colormap[rgb][i] = j;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (map_mode)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
for (rgb = 0; rgb < 3; rgb++)
|
||||
{
|
||||
a = src_col1[rgb]; as = dst_col1[rgb];
|
||||
b = src_col2[rgb]; bs = dst_col2[rgb];
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
j = ((i - a) * (bs - as)) / (b - a) + as;
|
||||
if (j > 255) j = 255; else if (j < 0) j = 0;
|
||||
colormap[rgb][i] = j;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
color_mapping (GDrawable *drawable)
|
||||
|
||||
|
@ -490,31 +479,31 @@ color_mapping (GDrawable *drawable)
|
|||
processed = 0;
|
||||
progress = 0.0;
|
||||
for (; pr != NULL; pr = gimp_pixel_rgns_process (pr))
|
||||
{
|
||||
for (y = 0; y < src_rgn.h; y++)
|
||||
{
|
||||
src = src_rgn.data + y * src_rgn.rowstride;
|
||||
dest = dest_rgn.data + y * dest_rgn.rowstride;
|
||||
for (x = 0; x < src_rgn.w; x++)
|
||||
{
|
||||
dest[0] = redmap[src[0]];
|
||||
dest[1] = greenmap[src[1]];
|
||||
dest[2] = bluemap[src[2]];
|
||||
if (bpp > 3) dest[3] = src[3];
|
||||
src += bpp;
|
||||
dest += bpp;
|
||||
processed++;
|
||||
}
|
||||
for (y = 0; y < src_rgn.h; y++)
|
||||
{
|
||||
src = src_rgn.data + y * src_rgn.rowstride;
|
||||
dest = dest_rgn.data + y * dest_rgn.rowstride;
|
||||
for (x = 0; x < src_rgn.w; x++)
|
||||
{
|
||||
dest[0] = redmap[src[0]];
|
||||
dest[1] = greenmap[src[1]];
|
||||
dest[2] = bluemap[src[2]];
|
||||
if (bpp > 3) dest[3] = src[3];
|
||||
src += bpp;
|
||||
dest += bpp;
|
||||
processed++;
|
||||
}
|
||||
}
|
||||
if (l_run_mode != RUN_NONINTERACTIVE)
|
||||
{
|
||||
if ((double)processed/(double)total - progress > 0.1)
|
||||
{
|
||||
progress = (double)processed/(double)total;
|
||||
gimp_progress_update (progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l_run_mode != RUN_NONINTERACTIVE)
|
||||
{
|
||||
if ((double)processed/(double)total - progress > 0.1)
|
||||
{
|
||||
progress = (double)processed/(double)total;
|
||||
gimp_progress_update (progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l_run_mode != RUN_NONINTERACTIVE)
|
||||
gimp_progress_update (1.0);
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
|
@ -45,24 +45,21 @@
|
|||
#define OK_CALLBACK _max_rgbok_callback
|
||||
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
static GStatusType MAIN_FUNCTION (gint32 drawable_id);
|
||||
static gint DIALOG ();
|
||||
static GStatusType MAIN_FUNCTION (gint32 drawable_id);
|
||||
static gint DIALOG ();
|
||||
|
||||
static void
|
||||
OK_CALLBACK (GtkWidget *widget, gpointer data);
|
||||
static void OK_CALLBACK (GtkWidget *widget, gpointer data);
|
||||
|
||||
/* gtkWrapper functions */
|
||||
#define PROGRESS_UPDATE_NUM 100
|
||||
#define ENTRY_WIDTH 100
|
||||
#define SCALE_WIDTH 100
|
||||
static void
|
||||
gtkW_close_callback (GtkWidget *widget, gpointer data);
|
||||
static void
|
||||
gtkW_toggle_update (GtkWidget *widget, gpointer data);
|
||||
static GSList *
|
||||
gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
||||
|
@ -70,26 +67,18 @@ gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
|||
GSList *group,
|
||||
GtkSignalFunc update,
|
||||
gint *value);
|
||||
GtkWidget *gtkW_check_button_new (GtkWidget *parent,
|
||||
gchar *name,
|
||||
GtkSignalFunc update,
|
||||
gint *value);
|
||||
GtkWidget *gtkW_frame_new (GtkWidget *parent, gchar *name);
|
||||
GtkWidget *gtkW_table_new (GtkWidget *parent, gint col, gint row);
|
||||
GtkWidget *gtkW_hbox_new (GtkWidget *parent);
|
||||
GtkWidget *gtkW_vbox_new (GtkWidget *parent);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
query, /* query_proc */
|
||||
run, /* run_proc */
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
query, /* query_proc */
|
||||
run, /* run_proc */
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint max_p; /* gint, gdouble, and so on */
|
||||
gint max_p; /* gint, gdouble, and so on */
|
||||
} ValueType;
|
||||
|
||||
static ValueType VALS =
|
||||
|
@ -104,13 +93,13 @@ typedef struct
|
|||
|
||||
static Interface INTERFACE = { FALSE };
|
||||
|
||||
gint hold_max;
|
||||
gint hold_min;
|
||||
gint hold_max;
|
||||
gint hold_min;
|
||||
|
||||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef args [] =
|
||||
{
|
||||
|
@ -265,17 +254,17 @@ MAIN_FUNCTION (gint32 drawable_id)
|
|||
static int
|
||||
DIALOG ()
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
GSList *group = NULL;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
GSList *group = NULL;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup (PLUG_IN_NAME);
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
|
||||
|
@ -292,24 +281,27 @@ DIALOG ()
|
|||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtkW_close_callback),
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
hbox = gtkW_hbox_new ((GTK_DIALOG (dlg)->vbox));
|
||||
frame = gtkW_frame_new (hbox, _("Parameter Settings"));
|
||||
/*
|
||||
table = gtkW_table_new (frame, 2, 2);
|
||||
gtkW_table_add_toggle (table, "Hold the maximal channel", 0, 2, 1,
|
||||
(GtkSignalFunc) gtkW_toggle_update, &VALS.max_p);
|
||||
gtk_widget_show (table);
|
||||
*/
|
||||
vbox = gtkW_vbox_new (frame);
|
||||
group = gtkW_vbox_add_radio_button (vbox, _("Hold the maximal channels"), group,
|
||||
(GtkSignalFunc) gtkW_toggle_update,
|
||||
&hold_max);
|
||||
group = gtkW_vbox_add_radio_button (vbox, _("Hold the minimal channels"), group,
|
||||
(GtkSignalFunc) gtkW_toggle_update,
|
||||
&hold_min);
|
||||
frame = gtk_frame_new (_("Parameter Settings"));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
group =
|
||||
gtkW_vbox_add_radio_button (vbox, _("Hold the Maximal Channels"), group,
|
||||
(GtkSignalFunc) gtkW_toggle_update,
|
||||
&hold_max);
|
||||
group =
|
||||
gtkW_vbox_add_radio_button (vbox, _("Hold the Minimal Channels"), group,
|
||||
(GtkSignalFunc) gtkW_toggle_update,
|
||||
&hold_min);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
|
@ -331,13 +323,6 @@ OK_CALLBACK (GtkWidget *widget,
|
|||
|
||||
/* VFtext interface functions */
|
||||
|
||||
static void
|
||||
gtkW_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
gtkW_toggle_update (GtkWidget *widget,
|
||||
gpointer data)
|
||||
|
@ -352,76 +337,6 @@ gtkW_toggle_update (GtkWidget *widget,
|
|||
*toggle_val = FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtkW_table_new (GtkWidget *parent, gint col, gint row)
|
||||
{
|
||||
GtkWidget *table;
|
||||
|
||||
table = gtk_table_new (col,row, FALSE);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), 10);
|
||||
gtk_container_add (GTK_CONTAINER (parent), table);
|
||||
return table;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtkW_hbox_new (GtkWidget *parent)
|
||||
{
|
||||
GtkWidget *hbox;
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (parent), hbox, FALSE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
return hbox;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtkW_vbox_new (GtkWidget *parent)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 10);
|
||||
/* gtk_box_pack_start (GTK_BOX (parent), vbox, TRUE, TRUE, 0); */
|
||||
gtk_container_add (GTK_CONTAINER (parent), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtkW_check_button_new (GtkWidget *parent,
|
||||
gchar *name,
|
||||
GtkSignalFunc update,
|
||||
gint *value)
|
||||
{
|
||||
GtkWidget *toggle;
|
||||
|
||||
toggle = gtk_check_button_new_with_label (name);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) update,
|
||||
value);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), *value);
|
||||
gtk_container_add (GTK_CONTAINER (parent), toggle);
|
||||
gtk_widget_show (toggle);
|
||||
return toggle;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtkW_frame_new (GtkWidget *parent,
|
||||
gchar *name)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
|
||||
frame = gtk_frame_new (name);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 5);
|
||||
gtk_box_pack_start (GTK_BOX(parent), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
return frame;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
||||
gchar *name,
|
||||
|
@ -440,4 +355,3 @@ gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
|||
gtk_widget_show (toggle);
|
||||
return group;
|
||||
}
|
||||
/* end of max_rgb.c */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -35,8 +35,8 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
|
@ -58,10 +58,10 @@ typedef struct
|
|||
/* Declare local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
static void run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
static void noisify (GDrawable * drawable);
|
||||
|
@ -106,7 +106,7 @@ static NoisifyInterface noise_int =
|
|||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef args[] =
|
||||
{
|
||||
|
@ -139,10 +139,10 @@ query ()
|
|||
}
|
||||
|
||||
static void
|
||||
run (char *name,
|
||||
int nparams,
|
||||
run (gchar *name,
|
||||
gint nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
gint *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
{
|
||||
static GParam values[1];
|
||||
|
@ -202,9 +202,10 @@ run (char *name,
|
|||
}
|
||||
|
||||
/* Make sure that the drawable is gray or RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->id) || gimp_drawable_is_gray (drawable->id))
|
||||
if (gimp_drawable_is_rgb (drawable->id) ||
|
||||
gimp_drawable_is_gray (drawable->id))
|
||||
{
|
||||
gimp_progress_init ( _("Adding Noise..."));
|
||||
gimp_progress_init (_("Adding Noise..."));
|
||||
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
||||
|
||||
/* seed the random number generator */
|
||||
|
@ -248,14 +249,18 @@ noisify (GDrawable *drawable)
|
|||
noise = 0;
|
||||
|
||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
||||
gimp_pixel_rgn_init (&src_rgn, drawable, x1, y1, (x2 - x1), (y2 - y1), FALSE, FALSE);
|
||||
gimp_pixel_rgn_init (&dest_rgn, drawable, x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
|
||||
gimp_pixel_rgn_init (&src_rgn, drawable,
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE, FALSE);
|
||||
gimp_pixel_rgn_init (&dest_rgn, drawable,
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
|
||||
|
||||
/* Initialize progress */
|
||||
progress = 0;
|
||||
max_progress = (x2 - x1) * (y2 - y1);
|
||||
|
||||
for (pr = gimp_pixel_rgns_register (2, &src_rgn, &dest_rgn); pr != NULL; pr = gimp_pixel_rgns_process (pr))
|
||||
for (pr = gimp_pixel_rgns_register (2, &src_rgn, &dest_rgn);
|
||||
pr != NULL;
|
||||
pr = gimp_pixel_rgns_process (pr))
|
||||
{
|
||||
src_row = src_rgn.data;
|
||||
dest_row = dest_rgn.data;
|
||||
|
@ -311,10 +316,10 @@ noisify_dialog (gint channels)
|
|||
GtkWidget *toggle;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *table;
|
||||
gchar *buffer;
|
||||
gchar *buffer;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
int i;
|
||||
gint argc;
|
||||
gint i;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
|
@ -340,88 +345,73 @@ noisify_dialog (gint channels)
|
|||
NULL);
|
||||
|
||||
/* parameter settings */
|
||||
frame = gtk_frame_new ( _("Parameter Settings"));
|
||||
frame = gtk_frame_new (_("Parameter Settings"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
table = gtk_table_new (channels + 1, 3, FALSE);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), 10);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
toggle = gtk_check_button_new_with_label ( _("Independent"));
|
||||
toggle = gtk_check_button_new_with_label (_("Independent"));
|
||||
gtk_table_attach (GTK_TABLE (table), toggle, 0, 2, 0, 1, GTK_FILL, 0, 0, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) noisify_toggle_update,
|
||||
GTK_SIGNAL_FUNC (noisify_toggle_update),
|
||||
&nvals.independent);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), nvals.independent);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
/* for (i = 0; i < channels; i++)
|
||||
{
|
||||
sprintf (buffer, "Channel #%d", i);
|
||||
dialog_create_value(buffer, GTK_TABLE(table), i+1, &nvals.noise[i], 0.0, 1.0);
|
||||
}
|
||||
*/
|
||||
|
||||
if (channels == 1)
|
||||
{
|
||||
buffer = g_strdup_printf( _("Gray"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 1, &nvals.noise[0], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
dialog_create_value (_("Gray:"), GTK_TABLE (table), 1,
|
||||
&nvals.noise[0], 0.0, 1.0);
|
||||
}
|
||||
|
||||
else if (channels == 2)
|
||||
{
|
||||
buffer = g_strdup_printf( _("Gray"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 1, &nvals.noise[0], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
buffer = g_strdup_printf( _("Alpha"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 2, &nvals.noise[1], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
dialog_create_value (_("Gray:"), GTK_TABLE (table), 1,
|
||||
&nvals.noise[0], 0.0, 1.0);
|
||||
dialog_create_value (_("Alpha:"), GTK_TABLE (table), 2,
|
||||
&nvals.noise[1], 0.0, 1.0);
|
||||
}
|
||||
|
||||
else if (channels == 3)
|
||||
{
|
||||
buffer = g_strdup_printf( _("Red"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 1, &nvals.noise[0], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
buffer = g_strdup_printf( _("Green"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 2, &nvals.noise[1], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
buffer = g_strdup_printf( _("Blue"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 3, &nvals.noise[2], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
dialog_create_value (_("Red:"), GTK_TABLE (table), 1,
|
||||
&nvals.noise[0], 0.0, 1.0);
|
||||
dialog_create_value (_("Green:"), GTK_TABLE (table), 2,
|
||||
&nvals.noise[1], 0.0, 1.0);
|
||||
dialog_create_value (_("Blue:"), GTK_TABLE (table), 3,
|
||||
&nvals.noise[2], 0.0, 1.0);
|
||||
}
|
||||
|
||||
else if (channels == 4)
|
||||
{
|
||||
buffer = g_strdup_printf( _("Red"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 1, &nvals.noise[0], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
buffer = g_strdup_printf( _("Green"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 2, &nvals.noise[1], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
buffer = g_strdup_printf( _("Blue"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 3, &nvals.noise[2], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
buffer = g_strdup_printf( _("Alpha"));
|
||||
dialog_create_value(buffer, GTK_TABLE(table), 4, &nvals.noise[3], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
dialog_create_value (_("Red:"), GTK_TABLE (table), 1,
|
||||
&nvals.noise[0], 0.0, 1.0);
|
||||
dialog_create_value (_("Green:"), GTK_TABLE (table), 2,
|
||||
&nvals.noise[1], 0.0, 1.0);
|
||||
dialog_create_value (_("Blue:"), GTK_TABLE (table), 3,
|
||||
&nvals.noise[2], 0.0, 1.0);
|
||||
dialog_create_value (_("Alpha:"), GTK_TABLE (table), 4,
|
||||
&nvals.noise[3], 0.0, 1.0);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
for (i = 0; i < channels; i++)
|
||||
{
|
||||
buffer = g_strdup_printf( _("Channel #%d"), i);
|
||||
dialog_create_value(buffer, GTK_TABLE(table), i+1, &nvals.noise[i], 0.0, 1.0);
|
||||
g_free(buffer);
|
||||
buffer = g_strdup_printf (_("Channel #%d"), i);
|
||||
dialog_create_value (buffer, GTK_TABLE(table), i + 1,
|
||||
&nvals.noise[i], 0.0, 1.0);
|
||||
g_free (buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gtk_widget_show (frame);
|
||||
gtk_widget_show (table);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
|
@ -439,7 +429,7 @@ noisify_dialog (gint channels)
|
|||
* Springer Verlag, New York, 1988.
|
||||
*/
|
||||
static gdouble
|
||||
gauss ()
|
||||
gauss (void)
|
||||
{
|
||||
gint i;
|
||||
gdouble sum = 0.0;
|
||||
|
@ -493,10 +483,10 @@ dialog_create_value (char *title,
|
|||
GtkObject *scale_data;
|
||||
gchar buf[256];
|
||||
|
||||
label = gtk_label_new(title);
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
||||
gtk_table_attach(table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 4, 0);
|
||||
gtk_widget_show(label);
|
||||
label = gtk_label_new (title);
|
||||
gtk_misc_set_alignment (GTK_MISC(label), 1.0, 0.5);
|
||||
gtk_table_attach (table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
scale_data = gtk_adjustment_new(*value, left, right,
|
||||
(right - left) / 200.0,
|
||||
|
@ -509,7 +499,8 @@ dialog_create_value (char *title,
|
|||
|
||||
scale = gtk_hscale_new(GTK_ADJUSTMENT(scale_data));
|
||||
gtk_widget_set_usize(scale, SCALE_WIDTH, 0);
|
||||
gtk_table_attach(table, scale, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_table_attach(table, scale, 1, 2, row, row + 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_scale_set_draw_value(GTK_SCALE(scale), FALSE);
|
||||
gtk_scale_set_digits(GTK_SCALE(scale), 3);
|
||||
gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_CONTINUOUS);
|
||||
|
@ -524,7 +515,8 @@ dialog_create_value (char *title,
|
|||
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||
(GtkSignalFunc) noisify_entry_update,
|
||||
value);
|
||||
gtk_table_attach(GTK_TABLE(table), entry, 2, 3, row, row + 1, GTK_FILL, GTK_FILL, 4, 0);
|
||||
gtk_table_attach (GTK_TABLE(table), entry, 2, 3, row, row + 1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show(entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,14 @@
|
|||
#define TILE_CACHE_SIZE 16
|
||||
#define ENTRY_WIDTH 50
|
||||
|
||||
typedef struct {
|
||||
gdouble spread_amount_x;
|
||||
gdouble spread_amount_y;
|
||||
typedef struct
|
||||
{
|
||||
gdouble spread_amount_x;
|
||||
gdouble spread_amount_y;
|
||||
} SpreadValues;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
gint run;
|
||||
} SpreadInterface;
|
||||
|
||||
|
@ -73,12 +75,13 @@ static GTile * spread_pixel (GDrawable * drawable,
|
|||
guchar * pixel);
|
||||
|
||||
static void spread_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void spread_fentry_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
gpointer data);
|
||||
static void spread_fentry_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void spread_fscale_callback (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
|
||||
static void spread_fscale_callback (GtkAdjustment *adjustment,
|
||||
gpointer data);
|
||||
/***** Local vars *****/
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
|
@ -105,7 +108,7 @@ static SpreadInterface pint =
|
|||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef args[] =
|
||||
{
|
||||
|
@ -127,7 +130,7 @@ query ()
|
|||
"Spencer Kimball and Peter Mattis, ported by Brian Degenhardt and Federico Mena Quintero",
|
||||
"Federico Mena Quintero and Brian Degenhardt",
|
||||
"1997",
|
||||
N_("<Image>/Filters/Noise/Spread..."),
|
||||
N_("<Image>/Filters/Noise/Spread..."),
|
||||
"RGB*, GRAY*",
|
||||
PROC_PLUG_IN,
|
||||
nargs, nreturn_vals,
|
||||
|
@ -200,7 +203,7 @@ run (gchar *name,
|
|||
/* Make sure that the drawable is gray or RGB color */
|
||||
if (gimp_drawable_is_rgb (drawable->id) || gimp_drawable_is_gray (drawable->id))
|
||||
{
|
||||
gimp_progress_init ( _("Spreading..."));
|
||||
gimp_progress_init (_("Spreading..."));
|
||||
|
||||
/* set the tile cache size */
|
||||
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
||||
|
@ -227,8 +230,6 @@ run (gchar *name,
|
|||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
|
||||
/*****/
|
||||
|
||||
static void
|
||||
spread (GDrawable *drawable)
|
||||
{
|
||||
|
@ -296,13 +297,13 @@ spread (GDrawable *drawable)
|
|||
The corners are less sharp with this algorithm.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Spread the image! */
|
||||
|
||||
|
||||
gimp_pixel_rgn_init (&dest_rgn, drawable, x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
|
||||
for (pr = gimp_pixel_rgns_register (1, &dest_rgn); pr != NULL; pr = gimp_pixel_rgns_process (pr))
|
||||
gimp_pixel_rgn_init (&dest_rgn, drawable,
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
|
||||
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
|
||||
pr != NULL;
|
||||
pr = gimp_pixel_rgns_process (pr))
|
||||
{
|
||||
destrow = dest_rgn.data;
|
||||
|
||||
|
@ -351,7 +352,7 @@ spread (GDrawable *drawable)
|
|||
|
||||
|
||||
static gint
|
||||
spread_dialog ()
|
||||
spread_dialog (void)
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *label;
|
||||
|
@ -390,7 +391,7 @@ spread_dialog ()
|
|||
NULL);
|
||||
|
||||
/* parameter settings */
|
||||
frame = gtk_frame_new ( _("Parameter Settings"));
|
||||
frame = gtk_frame_new (_("Parameter Settings"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
|
@ -405,7 +406,7 @@ spread_dialog ()
|
|||
label = gtk_label_new (_("Horizontal Spread Amount:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
GTK_FILL , GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
|
@ -440,7 +441,7 @@ spread_dialog ()
|
|||
label = gtk_label_new (_("Vertical Spread Amount:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 10, 5);
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
|
@ -482,20 +483,18 @@ spread_dialog ()
|
|||
return pint.run;
|
||||
}
|
||||
|
||||
/*****/
|
||||
|
||||
static GTile *
|
||||
spread_pixel (GDrawable * drawable,
|
||||
GTile * tile,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2,
|
||||
gint x,
|
||||
gint y,
|
||||
gint * row,
|
||||
gint * col,
|
||||
guchar * pixel)
|
||||
GTile * tile,
|
||||
gint x1,
|
||||
gint y1,
|
||||
gint x2,
|
||||
gint y2,
|
||||
gint x,
|
||||
gint y,
|
||||
gint * row,
|
||||
gint * col,
|
||||
guchar * pixel)
|
||||
{
|
||||
static guchar empty_pixel[4] = {0, 0, 0, 0};
|
||||
guchar *data;
|
||||
|
@ -531,7 +530,7 @@ spread_pixel (GDrawable * drawable,
|
|||
|
||||
static void
|
||||
spread_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
pint.run = TRUE;
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
|
|
|
@ -38,13 +38,17 @@
|
|||
/* #define VERBOSE 2 */
|
||||
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
/* Wear your GIMP with pride! */
|
||||
|
@ -102,8 +106,6 @@ static gint save_image (char *filename,
|
|||
gint32 image_ID,
|
||||
gint32 drawable_ID);
|
||||
static gint save_dialog (gint32 drawable_ID);
|
||||
static void close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void save_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void save_toggle_update (GtkWidget *widget,
|
||||
|
@ -695,20 +697,13 @@ load_image (char *filename)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static int gtk_initialized = FALSE;
|
||||
|
||||
|
||||
static void
|
||||
not_bw_dialog (void)
|
||||
{
|
||||
GtkWidget *dlg, *button, *hbbox, *label, *frame, *vbox;
|
||||
GtkWidget *dlg, *label, *frame, *vbox;
|
||||
|
||||
if (!gtk_initialized)
|
||||
{
|
||||
|
@ -716,40 +711,25 @@ not_bw_dialog (void)
|
|||
return;
|
||||
}
|
||||
|
||||
dlg = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), _("XBM Warning"));
|
||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
(GtkSignalFunc) close_callback,
|
||||
dlg);
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "delete_event",
|
||||
(GtkSignalFunc) close_callback,
|
||||
dlg);
|
||||
dlg = gimp_dialog_new (_("XBM Warning"), "xbm",
|
||||
gimp_plugin_help_func, "filters/xbm.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
/* Action area */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dlg)->action_area), FALSE);
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dlg)->action_area), hbbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
_("Cancel"), gtk_main_quit,
|
||||
NULL, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
button = gtk_button_new_with_label (_("Cancel"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (dlg));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
NULL);
|
||||
|
||||
/* the warning message */
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE,
|
||||
TRUE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
label = gtk_label_new (_("The image which you are trying to save as\n"
|
||||
|
@ -757,12 +737,13 @@ not_bw_dialog (void)
|
|||
"Please convert it to a black and white\n"
|
||||
"(1-bit) indexed image and try again."));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (frame);
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
gtk_widget_destroy (GTK_WIDGET (dlg));
|
||||
gdk_flush ();
|
||||
}
|
||||
|
||||
|
@ -953,7 +934,7 @@ save_image (char *filename,
|
|||
|
||||
|
||||
static void
|
||||
init_gtk ()
|
||||
init_gtk (void)
|
||||
{
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
@ -968,65 +949,44 @@ init_gtk ()
|
|||
}
|
||||
|
||||
static gint
|
||||
save_dialog (gint32 drawable_ID)
|
||||
save_dialog (gint32 drawable_ID)
|
||||
{
|
||||
GtkWidget *dlg, *hbbox, *button, *toggle, *label, *entry, *frame, *hbox, *vbox;
|
||||
GtkWidget *dlg, *toggle, *label, *entry, *frame, *hbox, *vbox;
|
||||
|
||||
xsint.run = FALSE;
|
||||
|
||||
dlg = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), _("Save as XBM"));
|
||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
||||
dlg = gimp_dialog_new (_("Save as XBM"), "xbm",
|
||||
gimp_plugin_help_func, "filters/xbm.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("OK"), save_ok_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
_("Cancel"), gtk_widget_destroy,
|
||||
NULL, 1, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
(GtkSignalFunc) close_callback,
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "delete_event",
|
||||
(GtkSignalFunc) close_callback,
|
||||
dlg);
|
||||
|
||||
/* Action area */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dlg)->action_area), FALSE);
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dlg)->action_area), hbbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("OK"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) save_ok_callback,
|
||||
dlg);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Cancel"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (dlg));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
|
||||
/* parameter settings */
|
||||
frame = gtk_frame_new (_("XBM Options"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 5);
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
/* comment string. */
|
||||
hbox = gtk_hbox_new(FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Description: "));
|
||||
label = gtk_label_new (_("Description:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
@ -1035,27 +995,26 @@ save_dialog (gint32 drawable_ID)
|
|||
gtk_widget_set_usize (entry, 240, 0);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), xsvals.comment);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) comment_entry_callback,
|
||||
GTK_SIGNAL_FUNC (comment_entry_callback),
|
||||
NULL);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* X10 format */
|
||||
toggle = gtk_check_button_new_with_label (_("X10 format bitmap"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, TRUE, TRUE, 0);
|
||||
toggle = gtk_check_button_new_with_label (_("X10 Format Bitmap"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||
(GtkSignalFunc) save_toggle_update,
|
||||
GTK_SIGNAL_FUNC (save_toggle_update),
|
||||
&xsvals.x10_format);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), xsvals.x10_format);
|
||||
gtk_widget_show (toggle);
|
||||
|
||||
/* prefix */
|
||||
hbox = gtk_hbox_new(FALSE, 5);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new (_("Identifier prefix: "));
|
||||
label = gtk_label_new (_("Identifier Prefix:"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
@ -1063,7 +1022,7 @@ save_dialog (gint32 drawable_ID)
|
|||
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), xsvals.prefix);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) prefix_entry_callback,
|
||||
GTK_SIGNAL_FUNC (prefix_entry_callback),
|
||||
NULL);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
|
@ -1105,6 +1064,7 @@ save_ok_callback (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
xsint.run = TRUE;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
|
@ -1122,21 +1082,3 @@ save_toggle_update (GtkWidget *widget,
|
|||
else
|
||||
*toggle_val = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
Local Variables:
|
||||
compile-command:"gcc -Wall -Wmissing-prototypes -g -O -o xbm xbm.c -lgimp -lgtk -lgdk -lglib -lm"
|
||||
End:
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -30,15 +30,19 @@ Previous...Inherited code from Ray Lehtiniemi, who inherited it from S & P.
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/xpm.h>
|
||||
#include "gtk/gtk.h"
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
static const char linenoise [] =
|
||||
|
@ -93,15 +97,12 @@ static gint save_image (char *filename,
|
|||
|
||||
static void init_gtk (void);
|
||||
static gint save_dialog (void);
|
||||
static void save_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void save_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void save_scale_update (GtkAdjustment *adjustment,
|
||||
double *scale_val);
|
||||
|
||||
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
NULL, /* init_proc */
|
||||
|
@ -121,11 +122,10 @@ static XpmSaveInterface xpmint =
|
|||
};
|
||||
|
||||
|
||||
|
||||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
query (void)
|
||||
{
|
||||
static GParamDef load_args[] =
|
||||
{
|
||||
|
@ -234,8 +234,8 @@ run (char *name,
|
|||
case RUN_INTERACTIVE:
|
||||
case RUN_WITH_LAST_VALS:
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "XPM",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED |
|
||||
CAN_HANDLE_ALPHA));
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY |
|
||||
CAN_HANDLE_INDEXED | CAN_HANDLE_ALPHA));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
|
@ -750,7 +750,7 @@ save_image (char *filename,
|
|||
}
|
||||
|
||||
static void
|
||||
init_gtk ()
|
||||
init_gtk (void)
|
||||
{
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
@ -764,71 +764,56 @@ init_gtk ()
|
|||
}
|
||||
|
||||
static gint
|
||||
save_dialog ()
|
||||
save_dialog (void)
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *label;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *scale;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *table;
|
||||
GtkObject *scale_data;
|
||||
|
||||
dlg = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), _("Save as Xpm"));
|
||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
||||
dlg = gimp_dialog_new (_("Save as XPM"), "xpm",
|
||||
gimp_plugin_help_func, "filters/xpm.html",
|
||||
GTK_WIN_POS_MOUSE,
|
||||
FALSE, TRUE, FALSE,
|
||||
|
||||
_("OK"), save_ok_callback,
|
||||
NULL, NULL, NULL, TRUE, FALSE,
|
||||
_("Cancel"), gtk_widget_destroy,
|
||||
NULL, 1, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||
(GtkSignalFunc) save_close_callback,
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
/* Action area */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dlg)->action_area), FALSE);
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dlg)->action_area), hbbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("OK"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) save_ok_callback,
|
||||
dlg);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Cancel"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (dlg));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* parameter settings */
|
||||
frame = gtk_frame_new (_("Parameter Settings"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (frame), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
table = gtk_table_new (1, 2, FALSE);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), 10);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
label = gtk_label_new (_("Alpha Threshold"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 5, 0);
|
||||
label = gtk_label_new (_("Alpha Threshold:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
scale_data = gtk_adjustment_new (xpmvals.threshold, 0.0, 1.0, 0.01, 0.01, 0.0);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
||||
gtk_widget_set_usize (scale, SCALE_WIDTH, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), scale, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), scale, 1, 2, 0, 1,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 2);
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||
gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed",
|
||||
(GtkSignalFunc) save_scale_update,
|
||||
GTK_SIGNAL_FUNC (save_scale_update),
|
||||
&xpmvals.threshold);
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (scale);
|
||||
|
@ -843,21 +828,12 @@ save_dialog ()
|
|||
return xpmint.run;
|
||||
}
|
||||
|
||||
|
||||
/* Save interface functions */
|
||||
|
||||
static void
|
||||
save_close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
save_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
xpmint.run = TRUE;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ INCLUDES = \
|
|||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
|
1379
plug-ins/fp/fp_gtk.c
1379
plug-ins/fp/fp_gtk.c
File diff suppressed because it is too large
Load Diff
|
@ -66,21 +66,6 @@ gpc_toggle_update(GtkWidget *widget, gpointer data) {
|
|||
else
|
||||
*toggle_val = FALSE;
|
||||
}
|
||||
/*
|
||||
* DESTROY callback - quit this plug-in
|
||||
*/
|
||||
void
|
||||
gpc_close_callback(GtkWidget *widget, gpointer data) {
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
/*
|
||||
* CANCEL BUTTON callback - go away without saving state, etc.
|
||||
*/
|
||||
void
|
||||
gpc_cancel_callback(GtkWidget *widget, gpointer data) {
|
||||
gtk_widget_destroy(GTK_WIDGET(data));
|
||||
}
|
||||
|
||||
/*
|
||||
* SCALE UPDATE callback - update the SCALE widget's data
|
||||
|
@ -150,26 +135,6 @@ gpc_set_tooltip(GtkWidget *widget, const char *tip)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ADD ACTION BUTTON to a dialog
|
||||
*/
|
||||
void
|
||||
gpc_add_action_button(char *label, GtkSignalFunc callback, GtkWidget *dialog,
|
||||
char *tip)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
button = gtk_button_new_with_label(label);
|
||||
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked", callback, dialog);
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
|
||||
button, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default(button);
|
||||
gtk_widget_show(button);
|
||||
gpc_set_tooltip(button, tip);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ADD RADIO BUTTON to a dialog
|
||||
*/
|
||||
|
@ -191,23 +156,6 @@ gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ADD LABEL widget to a dialog at given location
|
||||
*/
|
||||
void
|
||||
gpc_add_label(char *value, GtkWidget *table, int left, int right,
|
||||
int top, int bottom)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new(value);
|
||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
||||
gtk_table_attach(GTK_TABLE(table), label, left, right, top, bottom,
|
||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 5, 0);
|
||||
gtk_widget_show(label);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ADD HORIZONTAL SCALE widget to a dialog at given location
|
||||
*/
|
||||
|
|
|
@ -46,12 +46,6 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
gpc_close_callback(GtkWidget *widget, gpointer data);
|
||||
|
||||
void
|
||||
gpc_cancel_callback(GtkWidget *widget, gpointer data);
|
||||
|
||||
void
|
||||
gpc_scale_update(GtkAdjustment *adjustment, double *scale_val);
|
||||
|
||||
|
@ -64,18 +58,10 @@ gpc_setup_tooltips(GtkWidget *parent);
|
|||
void
|
||||
gpc_set_tooltip(GtkWidget *widget, const char *tip);
|
||||
|
||||
void
|
||||
gpc_add_action_button(char *label, GtkSignalFunc callback, GtkWidget *dialog,
|
||||
char *tip);
|
||||
|
||||
void
|
||||
gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
|
||||
gint *value, char *tip);
|
||||
|
||||
void
|
||||
gpc_add_label(char *value, GtkWidget *parent, int left, int right,
|
||||
int top, int bottom);
|
||||
|
||||
void
|
||||
gpc_add_hscale(GtkWidget *table, int width, float low, float high,
|
||||
gdouble *val, int left, int right, int top, int bottom, char *tip);
|
||||
|
|
|
@ -59,8 +59,6 @@ static void mw_scale_entry_new(GtkWidget *table, gchar *name,
|
|||
static void mw_entry_new(GtkWidget *parent, gchar *fname,
|
||||
gchar *name, gpointer variablep,
|
||||
guchar *buffer, GtkCallback entry_cb);
|
||||
static void ui_ok_callback(GtkWidget *widget, gpointer data);
|
||||
static void ui_close_callback(GtkWidget *widget, gpointer data);
|
||||
static void ui_fscale_callback(GtkAdjustment *adj, gpointer data);
|
||||
static void ui_fentry_callback(GtkWidget *widget, gpointer data);
|
||||
static void ui_iscale_callback(GtkAdjustment *adj, gpointer data);
|
||||
|
@ -69,72 +67,12 @@ static void ui_toggle_callback(GtkWidget *widget, gpointer data);
|
|||
static void ui_ientry_alone_callback(GtkWidget *widget, gpointer data);
|
||||
static void ui_fentry_alone_callback(GtkWidget *widget, gpointer data);
|
||||
static void ui_value_toggle_callback(GtkWidget *widget, gpointer data);
|
||||
static void create_color_selection (GtkWidget *widget, struct mwColorSel *cs);
|
||||
static void color_selection_cancel (GtkWidget *widget, struct mwColorSel *cs);
|
||||
static void color_selection_destroy_window (GtkWidget *widget,
|
||||
GtkWidget **window);
|
||||
static void color_selection_changed_cb (GtkWidget *w, struct mwColorSel *cs);
|
||||
static void color_selection_ok_cb (GtkWidget *w, struct mwColorSel *cs);
|
||||
static void color_select_fill_button_color(GtkWidget *preview, gdouble *color);
|
||||
|
||||
#ifndef NO_PREVIEW
|
||||
static mw_preview_t *mw_do_preview = NULL;
|
||||
static gint do_preview = 1;
|
||||
#endif
|
||||
|
||||
GtkWidget *
|
||||
mw_app_new(gchar *resname, gchar *appname, gint *runpp){
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *button;
|
||||
GtkWidget *hbbox;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new(gchar *, 1);
|
||||
*runpp = 0;
|
||||
|
||||
argv[0] = g_strdup(resname);
|
||||
gtk_init(&argc, &argv);
|
||||
gtk_rc_parse(gimp_gtkrc());
|
||||
|
||||
dlg = gtk_dialog_new();
|
||||
gtk_object_set_data(GTK_OBJECT(dlg), "runp", runpp);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(dlg), appname);
|
||||
gtk_window_position(GTK_WINDOW(dlg), GTK_WIN_POS_MOUSE);
|
||||
gtk_signal_connect(GTK_OBJECT(dlg), "destroy",
|
||||
(GtkSignalFunc) ui_close_callback,
|
||||
NULL);
|
||||
|
||||
/* Action area */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 2);
|
||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dlg)->action_area), FALSE);
|
||||
hbbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbbox), 4);
|
||||
gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dlg)->action_area), hbbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("OK"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) ui_ok_callback,
|
||||
dlg);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Cancel"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (dlg));
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
return dlg;
|
||||
}
|
||||
|
||||
void
|
||||
mw_fscale_entry_new(GtkWidget *table, gchar *name,
|
||||
gfloat lorange, gfloat hirange,
|
||||
|
@ -312,42 +250,6 @@ mw_toggle_button_new(GtkWidget *parent, gchar *fname,
|
|||
}
|
||||
}
|
||||
|
||||
struct mwColorSel * mw_color_select_button_create(
|
||||
GtkWidget *parent, gchar *name, gdouble *color,
|
||||
gint opacity)
|
||||
{
|
||||
#define COLOR_SAMPLE_SIZE 30
|
||||
GtkWidget *button;
|
||||
struct mwColorSel *cs = g_new(struct mwColorSel,1);
|
||||
|
||||
cs->name = (guchar *)name;
|
||||
cs->color = color;
|
||||
cs->opacity = opacity;
|
||||
cs->window = NULL;
|
||||
|
||||
button = gtk_button_new();
|
||||
gtk_box_pack_start(GTK_BOX(parent),button,FALSE,FALSE,0);
|
||||
gtk_widget_show(button);
|
||||
|
||||
cs->preview = gtk_preview_new(GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size(GTK_PREVIEW(cs->preview),
|
||||
COLOR_SAMPLE_SIZE,COLOR_SAMPLE_SIZE);
|
||||
gtk_container_add (GTK_CONTAINER(button),cs->preview);
|
||||
gtk_widget_show(cs->preview);
|
||||
|
||||
color_select_fill_button_color(cs->preview,color);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(button),"clicked",
|
||||
(GtkSignalFunc)create_color_selection,
|
||||
cs);
|
||||
|
||||
return cs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void mw_ientry_new(GtkWidget *parent, gchar *fname,
|
||||
gchar *name, gint *varp)
|
||||
{
|
||||
|
@ -564,19 +466,6 @@ mw_entry_new(GtkWidget *parent, gchar *fname,
|
|||
gtk_widget_show (hbox);
|
||||
}
|
||||
|
||||
static void
|
||||
ui_close_callback(GtkWidget *widget, gpointer data){
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static void
|
||||
ui_ok_callback(GtkWidget *widget, gpointer data){
|
||||
gint *rp;
|
||||
rp = gtk_object_get_data(GTK_OBJECT(data), "runp");
|
||||
*rp=1;
|
||||
gtk_widget_destroy(GTK_WIDGET(data));
|
||||
}
|
||||
|
||||
static void
|
||||
ui_fscale_callback(GtkAdjustment *adj, gpointer data){
|
||||
GtkWidget *ent;
|
||||
|
@ -729,128 +618,3 @@ ui_value_toggle_callback(GtkWidget *widget, gpointer data) {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* color_selection_* stuff */
|
||||
|
||||
static void
|
||||
color_selection_ok_cb (GtkWidget *w,
|
||||
struct mwColorSel *cs)
|
||||
{
|
||||
GtkColorSelection *colorsel;
|
||||
|
||||
colorsel=GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(cs->window)->colorsel);
|
||||
gtk_color_selection_get_color(colorsel,cs->color);
|
||||
gtk_widget_destroy(cs->window);
|
||||
color_select_fill_button_color(cs->preview, cs->color);
|
||||
#ifndef NO_PREVIEW
|
||||
if (do_preview && mw_do_preview!=NULL) (*mw_do_preview)(NULL);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
color_selection_changed_cb (GtkWidget *w,
|
||||
struct mwColorSel *cs)
|
||||
{
|
||||
GtkColorSelection *colorsel;
|
||||
|
||||
colorsel=GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(cs->window)->colorsel);
|
||||
gtk_color_selection_get_color(colorsel,cs->color);
|
||||
#ifndef NO_PREVIEW
|
||||
if (do_preview && mw_do_preview!=NULL) (*mw_do_preview)(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
color_selection_destroy_window (GtkWidget *widget,
|
||||
GtkWidget **window)
|
||||
{
|
||||
*window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
color_selection_cancel (GtkWidget *widget,
|
||||
struct mwColorSel *cs)
|
||||
{
|
||||
(cs->color)[0]=cs->savcolor[0];
|
||||
(cs->color)[1]=cs->savcolor[1];
|
||||
(cs->color)[2]=cs->savcolor[2];
|
||||
if (cs->opacity)
|
||||
(cs->color)[3]=cs->savcolor[3];
|
||||
gtk_widget_destroy(cs->window);
|
||||
cs->window = NULL;
|
||||
#ifndef NO_PREVIEW
|
||||
if (do_preview && mw_do_preview!=NULL) (*mw_do_preview)(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
create_color_selection (GtkWidget *widget,
|
||||
struct mwColorSel *cs)
|
||||
{
|
||||
if (!(cs->window)) {
|
||||
cs->window = gtk_color_selection_dialog_new ((const gchar *)cs->name);
|
||||
cs->savcolor[0]=cs->color[0]; /* For the cancel .... */
|
||||
cs->savcolor[1]=cs->color[1];
|
||||
cs->savcolor[2]=cs->color[2];
|
||||
if (cs->opacity)
|
||||
cs->savcolor[3]=cs->color[3];
|
||||
|
||||
gtk_color_selection_set_opacity(
|
||||
GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(cs->window)->colorsel),cs->opacity);
|
||||
|
||||
gtk_color_selection_set_update_policy(
|
||||
GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(cs->window)->colorsel),GTK_UPDATE_DELAYED);
|
||||
gtk_widget_destroy ( GTK_COLOR_SELECTION_DIALOG(cs->window)->help_button );
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (cs->window), "destroy",
|
||||
(GtkSignalFunc) color_selection_destroy_window,
|
||||
&(cs->window));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(cs->window)->colorsel),
|
||||
"color_changed",(GtkSignalFunc) color_selection_changed_cb,
|
||||
cs);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (cs->window)->ok_button),
|
||||
"clicked", (GtkSignalFunc) color_selection_ok_cb,
|
||||
cs);
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (cs->window)->cancel_button),
|
||||
"clicked", (GtkSignalFunc) color_selection_cancel,
|
||||
cs);
|
||||
}
|
||||
|
||||
gtk_color_selection_set_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(cs->window)->colorsel),cs->color);
|
||||
|
||||
gtk_window_position (GTK_WINDOW (cs->window), GTK_WIN_POS_MOUSE);
|
||||
gtk_widget_show(cs->window);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
color_select_fill_button_color(GtkWidget *preview, gdouble *color)
|
||||
{
|
||||
gint i;
|
||||
guchar buf[3*COLOR_SAMPLE_SIZE];
|
||||
|
||||
for (i=0;i<COLOR_SAMPLE_SIZE;i++)
|
||||
{
|
||||
buf[3*i] = (guchar)(255.999*color[0]);
|
||||
buf[3*i+1] = (guchar)(255.999*color[1]);
|
||||
buf[3*i+2] = (guchar)(255.999*color[2]);
|
||||
}
|
||||
for (i=0;i<COLOR_SAMPLE_SIZE;i++)
|
||||
gtk_preview_draw_row(GTK_PREVIEW(preview),buf,0,i,COLOR_SAMPLE_SIZE);
|
||||
|
||||
gtk_widget_draw (preview, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* end of megawidget/megawidget.c */
|
||||
|
||||
|
||||
|
|
|
@ -45,20 +45,10 @@ struct mwPreview {
|
|||
guchar *bits;
|
||||
};
|
||||
|
||||
struct mwColorSel {
|
||||
gdouble *color;
|
||||
gdouble savcolor[4];
|
||||
gint opacity;
|
||||
guchar *name;
|
||||
GtkWidget *window;
|
||||
GtkWidget *preview;
|
||||
};
|
||||
|
||||
#ifndef PREVIEW_SIZE
|
||||
#define PREVIEW_SIZE 100
|
||||
#endif
|
||||
|
||||
GtkWidget *mw_app_new(gchar *resname, gchar *appname, gint *runpp);
|
||||
void mw_fscale_entry_new(GtkWidget *table, char *name,
|
||||
gfloat lorange, gfloat hirange,
|
||||
gfloat st_inc, gfloat pg_inc, gfloat pgsiz,
|
||||
|
@ -84,10 +74,6 @@ GtkWidget *mw_ientry_button_new(GtkWidget *parent, gchar *fname,
|
|||
gchar *name, gint *varp);
|
||||
GtkWidget *mw_fentry_button_new(GtkWidget *parent, gchar *fname,
|
||||
gchar *name, gdouble *varp);
|
||||
struct mwColorSel *mw_color_select_button_create(GtkWidget *parent,
|
||||
gchar *name,
|
||||
gdouble *color,
|
||||
gint opacity);
|
||||
|
||||
void mw_ientry_new(GtkWidget *parent, gchar *fname,
|
||||
gchar *name, gint *varp);
|
||||
|
@ -103,4 +89,3 @@ struct mwPreview *mw_preview_build(GDrawable *drw);
|
|||
struct mwPreview *mw_preview_build_virgin(GDrawable *drw);
|
||||
|
||||
#endif /* MEGAWIDGET_H */
|
||||
/* end of megawidget/megawidget.h */
|
||||
|
|
|
@ -26,6 +26,7 @@ INCLUDES = \
|
|||
-I$(includedir)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
/*---------------------------------------------------------------------------
|
||||
* Change log:
|
||||
*
|
||||
* Version 2.0, 04 April 1999.
|
||||
|
@ -34,7 +34,7 @@
|
|||
* Version 1.0, 27 March 1997.
|
||||
* Initial (unstable) release by Pavel Grinfeld
|
||||
*
|
||||
*-----------------------------------------------------------------------------------*/
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -52,9 +52,9 @@
|
|||
#include "rcm_pixmaps.h"
|
||||
#include "rcm_callback.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Misc functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
float rcm_units_factor(gint units)
|
||||
{
|
||||
|
@ -103,24 +103,21 @@ void rcm_set_pixmap(GtkWidget **widget, GtkWidget *parent,
|
|||
gtk_widget_show(*widget);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Ok/Cancel Buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Ok Button */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_close_callback(GtkWidget *widget, gpointer data)
|
||||
void rcm_ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void rcm_ok_callback(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_widget_destroy(GTK_WIDGET(data));
|
||||
Current.Success = 1;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Circle buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_360_degrees(GtkWidget *button, RcmCircle *circle)
|
||||
{
|
||||
|
@ -159,9 +156,9 @@ void rcm_a_to_b(GtkWidget *button, RcmCircle *circle)
|
|||
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Misc: units buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void rcm_spinbutton_to_degrees(GtkWidget *button, float value, GtkWidget *label)
|
||||
{
|
||||
|
@ -209,7 +206,7 @@ void rcm_switch_to_degrees(GtkWidget *button, gpointer *value)
|
|||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void rcm_spinbutton_to_radians(GtkWidget *button, float value, GtkWidget *label)
|
||||
{
|
||||
|
@ -257,7 +254,7 @@ void rcm_switch_to_radians(GtkWidget *button, gpointer *value)
|
|||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void rcm_spinbutton_to_radians_over_PI(GtkWidget *button, float value, GtkWidget *label)
|
||||
{
|
||||
|
@ -305,9 +302,9 @@ void rcm_switch_to_radians_over_PI(GtkWidget *button, gpointer *value)
|
|||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Misc: Gray: mode buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_switch_to_gray_to(GtkWidget *button, gpointer *value)
|
||||
{
|
||||
|
@ -325,9 +322,9 @@ void rcm_switch_to_gray_from(GtkWidget *button, gpointer *value)
|
|||
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Misc: Preview buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_preview_as_you_drag(GtkWidget *button, gpointer *value)
|
||||
{
|
||||
|
@ -337,7 +334,7 @@ void rcm_preview_as_you_drag(GtkWidget *button, gpointer *value)
|
|||
Current.RealTime = FALSE;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static void rcm_change_preview(void)
|
||||
{
|
||||
|
@ -362,7 +359,7 @@ static void rcm_change_preview(void)
|
|||
gtk_widget_show(Current.Bna->after);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_selection_in_context(GtkWidget *button, gpointer *value)
|
||||
{
|
||||
|
@ -386,9 +383,9 @@ void rcm_entire_image(GtkWidget *button, gpointer *value)
|
|||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Circle events */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_expose_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
||||
{
|
||||
|
@ -407,7 +404,7 @@ gint rcm_expose_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_button_press_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
||||
{
|
||||
|
@ -452,7 +449,7 @@ gint rcm_button_press_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circl
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_release_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
||||
{
|
||||
|
@ -466,7 +463,7 @@ gint rcm_release_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
||||
{
|
||||
|
@ -524,9 +521,9 @@ gint rcm_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circ
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Gray circle events */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_gray_expose_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
||||
{
|
||||
|
@ -543,7 +540,7 @@ gint rcm_gray_expose_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_gray_button_press_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
||||
{
|
||||
|
@ -577,7 +574,7 @@ gint rcm_gray_button_press_event(GtkWidget *widget, GdkEvent *event, RcmGray *ci
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_gray_release_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
||||
{
|
||||
|
@ -594,7 +591,7 @@ gint rcm_gray_release_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_gray_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
||||
{
|
||||
|
@ -639,9 +636,9 @@ gint rcm_gray_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmGray *c
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Spinbuttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_set_alpha(GtkWidget *entry, gpointer data)
|
||||
{
|
||||
|
@ -661,7 +658,7 @@ void rcm_set_alpha(GtkWidget *entry, gpointer data)
|
|||
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_set_beta(GtkWidget *entry, gpointer data)
|
||||
{
|
||||
|
@ -681,7 +678,7 @@ void rcm_set_beta(GtkWidget *entry, gpointer data)
|
|||
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_set_hue(GtkWidget *entry, gpointer data)
|
||||
{
|
||||
|
@ -704,7 +701,7 @@ void rcm_set_hue(GtkWidget *entry, gpointer data)
|
|||
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_set_satur(GtkWidget *entry, gpointer data)
|
||||
{
|
||||
|
@ -725,7 +722,7 @@ void rcm_set_satur(GtkWidget *entry, gpointer data)
|
|||
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_set_gray_sat(GtkWidget *entry, gpointer data)
|
||||
{
|
||||
|
@ -743,4 +740,4 @@ void rcm_set_gray_sat(GtkWidget *entry, gpointer data)
|
|||
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
/*---------------------------------------------------------------------------
|
||||
* Change log:
|
||||
*
|
||||
* Version 2.0, 04 April 1999.
|
||||
|
@ -34,11 +34,11 @@
|
|||
* Version 1.0, 27 March 1997.
|
||||
* Initial (unstable) release by Pavel Grinfeld
|
||||
*
|
||||
*-----------------------------------------------------------------------------------*/
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Misc functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
float rcm_units_factor(gint units);
|
||||
|
||||
|
@ -47,17 +47,15 @@ gchar *rcm_units_string(gint units);
|
|||
void rcm_set_pixmap(GtkWidget **widget, GtkWidget *parent,
|
||||
GtkWidget *label_box, char **pixmap_data);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Ok/Cancel Buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_close_callback(GtkWidget *widget, gpointer data);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Ok Button */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_ok_callback(GtkWidget *widget, gpointer data);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Circle buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_360_degrees(GtkWidget *button, RcmCircle *circle);
|
||||
|
||||
|
@ -65,9 +63,9 @@ void rcm_cw_ccw(GtkWidget *button, RcmCircle *circle);
|
|||
|
||||
void rcm_a_to_b(GtkWidget *button, RcmCircle *circle);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Misc: units buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_switch_to_degrees(GtkWidget *button, gpointer *value);
|
||||
|
||||
|
@ -75,17 +73,17 @@ void rcm_switch_to_radians(GtkWidget *button, gpointer *value);
|
|||
|
||||
void rcm_switch_to_radians_over_PI(GtkWidget *button, gpointer *value);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Misc: Gray: mode buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_switch_to_gray_to(GtkWidget *button, gpointer *value);
|
||||
|
||||
void rcm_switch_to_gray_from(GtkWidget *button, gpointer *value);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Misc: Preview buttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_preview_as_you_drag(GtkWidget *button, gpointer *value);
|
||||
|
||||
|
@ -95,9 +93,9 @@ void rcm_selection(GtkWidget *button, gpointer *value);
|
|||
|
||||
void rcm_entire_image(GtkWidget *button, gpointer *value);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Circle events */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_expose_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle);
|
||||
|
||||
|
@ -107,9 +105,9 @@ gint rcm_release_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle);
|
|||
|
||||
gint rcm_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Gray circle events */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
gint rcm_gray_expose_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle);
|
||||
|
||||
|
@ -119,9 +117,9 @@ gint rcm_gray_release_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
|||
|
||||
gint rcm_gray_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Spinbuttons */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void rcm_set_alpha(GtkWidget *entry, gpointer data);
|
||||
|
||||
|
@ -133,4 +131,4 @@ void rcm_set_satur(GtkWidget *entry, gpointer data);
|
|||
|
||||
void rcm_set_gray_sat(GtkWidget *entry, gpointer data);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue