mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-05 02:09:37 +00:00
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 changed files with 5129 additions and 5567 deletions
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>
|
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
|
* plug-ins/gap/gap_navigator_dialog.c: some changes to make it use
|
||||||
|
|
|
@ -31,9 +31,6 @@ enum
|
||||||
HELP_BROWSER_NETSCAPE
|
HELP_BROWSER_NETSCAPE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* the standard help function */
|
|
||||||
void gimp_standard_help_func (gchar *help_data);
|
|
||||||
|
|
||||||
/* the main help function */
|
/* the main help function */
|
||||||
void gimp_help (gchar *help_data);
|
void gimp_help (gchar *help_data);
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@ enum
|
||||||
HELP_BROWSER_NETSCAPE
|
HELP_BROWSER_NETSCAPE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* the standard help function */
|
|
||||||
void gimp_standard_help_func (gchar *help_data);
|
|
||||||
|
|
||||||
/* the main help function */
|
/* the main help function */
|
||||||
void gimp_help (gchar *help_data);
|
void gimp_help (gchar *help_data);
|
||||||
|
|
||||||
|
|
|
@ -876,7 +876,6 @@ void gimp_parasite_detach (const char *name);
|
||||||
* Help *
|
* Help *
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
void gimp_standard_help_func (gchar *help_data);
|
|
||||||
void gimp_plugin_help_func (gchar *help_data);
|
void gimp_plugin_help_func (gchar *help_data);
|
||||||
void gimp_help (gchar *help_data);
|
void gimp_help (gchar *help_data);
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,6 @@ gimp_dialog_newv (const gchar *title,
|
||||||
/* prepare the action_area */
|
/* prepare the action_area */
|
||||||
gimp_dialog_create_action_areav (GTK_DIALOG (dialog), args);
|
gimp_dialog_create_action_areav (GTK_DIALOG (dialog), args);
|
||||||
|
|
||||||
gimp_dialog_set_icon (dialog);
|
|
||||||
|
|
||||||
/* connect the "F1" help key */
|
/* connect the "F1" help key */
|
||||||
if (help_func)
|
if (help_func)
|
||||||
gimp_help_connect_help_accel (dialog, help_func, help_data);
|
gimp_help_connect_help_accel (dialog, help_func, help_data);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "gimp.h"
|
#include "gimp.h"
|
||||||
|
#include "gimpdialog.h"
|
||||||
#include "gimpenums.h"
|
#include "gimpenums.h"
|
||||||
#include "gimpexport.h"
|
#include "gimpexport.h"
|
||||||
#include "gimpintl.h"
|
#include "gimpintl.h"
|
||||||
|
@ -119,8 +120,8 @@ static ExportAction export_action_merge =
|
||||||
{
|
{
|
||||||
export_merge,
|
export_merge,
|
||||||
NULL,
|
NULL,
|
||||||
N_("can't handle layers"),
|
N_("can't Handle Layers"),
|
||||||
{ N_("Merge visible layers"), NULL },
|
{ N_("Merge Visible Layers"), NULL },
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,8 +129,8 @@ static ExportAction export_action_animate_or_merge =
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
export_merge,
|
export_merge,
|
||||||
N_("can only handle layers as animation frames"),
|
N_("can only Handle Layers as Animation Frames"),
|
||||||
{ N_("Save as animation"), N_("Merge visible layers") },
|
{ N_("Save as Animation"), N_("Merge Visible Layers") },
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ static ExportAction export_action_flatten =
|
||||||
{
|
{
|
||||||
&export_flatten,
|
&export_flatten,
|
||||||
NULL,
|
NULL,
|
||||||
N_("can't handle transparency"),
|
N_("can't Handle Transparency"),
|
||||||
{ N_("Flatten Image"), NULL },
|
{ N_("Flatten Image"), NULL },
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
@ -146,7 +147,7 @@ static ExportAction export_action_convert_rgb =
|
||||||
{
|
{
|
||||||
&export_convert_rgb,
|
&export_convert_rgb,
|
||||||
NULL,
|
NULL,
|
||||||
N_("can only handle RGB images"),
|
N_("can only Handle RGB Images"),
|
||||||
{ N_("Convert to RGB"), NULL },
|
{ N_("Convert to RGB"), NULL },
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
@ -155,8 +156,8 @@ static ExportAction export_action_convert_grayscale =
|
||||||
{
|
{
|
||||||
&export_convert_grayscale,
|
&export_convert_grayscale,
|
||||||
NULL,
|
NULL,
|
||||||
N_("can only handle grayscale images"),
|
N_("can only Handle Grayscale Images"),
|
||||||
{ N_("Convert to grayscale"), NULL },
|
{ N_("Convert to Grayscale"), NULL },
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -164,8 +165,9 @@ static ExportAction export_action_convert_indexed =
|
||||||
{
|
{
|
||||||
&export_convert_indexed,
|
&export_convert_indexed,
|
||||||
NULL,
|
NULL,
|
||||||
N_("can only handle indexed images"),
|
N_("can only Handle Indexed Images"),
|
||||||
{ N_("Convert to indexed using default settings\n(Do it manually to tune the result)"), NULL },
|
{ N_("Convert to indexed using default settings\n"
|
||||||
|
"(Do it manually to tune the result)"), NULL },
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -173,8 +175,8 @@ static ExportAction export_action_convert_rgb_or_grayscale =
|
||||||
{
|
{
|
||||||
&export_convert_rgb,
|
&export_convert_rgb,
|
||||||
&export_convert_grayscale,
|
&export_convert_grayscale,
|
||||||
N_("can only handle RGB or grayscale images"),
|
N_("can only Handle RGB or Grayscale Images"),
|
||||||
{ N_("Convert to RGB"), N_("Convert to grayscale")},
|
{ N_("Convert to RGB"), N_("Convert to Grayscale")},
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -182,8 +184,9 @@ static ExportAction export_action_convert_rgb_or_indexed =
|
||||||
{
|
{
|
||||||
&export_convert_rgb,
|
&export_convert_rgb,
|
||||||
&export_convert_indexed,
|
&export_convert_indexed,
|
||||||
N_("can only handle RGB or indexed images"),
|
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_("Convert to RGB"), N_("Convert to indexed using default settings\n"
|
||||||
|
"(Do it manually to tune the result)")},
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -191,9 +194,10 @@ static ExportAction export_action_convert_indexed_or_grayscale =
|
||||||
{
|
{
|
||||||
&export_convert_indexed,
|
&export_convert_indexed,
|
||||||
&export_convert_grayscale,
|
&export_convert_grayscale,
|
||||||
N_("can only handle grayscale or indexed images"),
|
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 indexed using default settings\n"
|
||||||
N_("Convert to grayscale") },
|
"(Do it manually to tune the result)"),
|
||||||
|
N_("Convert to Grayscale") },
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -201,8 +205,8 @@ static ExportAction export_action_add_alpha =
|
||||||
{
|
{
|
||||||
&export_add_alpha,
|
&export_add_alpha,
|
||||||
NULL,
|
NULL,
|
||||||
N_("needs an alpha channel"),
|
N_("needs an Alpha Channel"),
|
||||||
{ N_("Add alpha channel"), NULL},
|
{ N_("Add Alpha Channel"), NULL},
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -254,10 +258,9 @@ export_dialog (GSList *actions,
|
||||||
gchar *format)
|
gchar *format)
|
||||||
{
|
{
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *button;
|
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
GtkWidget *hbbox;
|
GtkWidget *button;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GSList *list;
|
GSList *list;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
@ -272,44 +275,23 @@ export_dialog (GSList *actions,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* the dialog */
|
/* the dialog */
|
||||||
dialog = gtk_dialog_new ();
|
dialog = gimp_dialog_new (_("Export File"), "export_file",
|
||||||
gtk_window_set_title (GTK_WINDOW (dialog), _("Export File"));
|
gimp_standard_help_func, "dialogs/export_file.html",
|
||||||
gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
|
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",
|
gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
|
||||||
(GtkSignalFunc) export_cancel_callback, NULL);
|
GTK_SIGNAL_FUNC (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);
|
|
||||||
|
|
||||||
/* the headline */
|
/* the headline */
|
||||||
vbox = gtk_vbox_new (FALSE, 6);
|
vbox = gtk_vbox_new (FALSE, 6);
|
||||||
|
@ -317,7 +299,8 @@ export_dialog (GSList *actions,
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||||
gtk_widget_show (vbox);
|
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_line_wrap (GTK_LABEL (label), TRUE);
|
||||||
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
|
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||||
|
@ -326,13 +309,15 @@ export_dialog (GSList *actions,
|
||||||
for (list = actions; list; list = list->next)
|
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));
|
text = g_strdup_printf ("%s %s", format, gettext (action->reason));
|
||||||
frame = gtk_frame_new (text);
|
frame = gtk_frame_new (text);
|
||||||
g_free (text);
|
g_free (text);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||||
|
|
||||||
hbox = gtk_hbox_new (FALSE, 4);
|
hbox = gtk_hbox_new (FALSE, 4);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
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])
|
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));
|
radio_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
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_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
|
||||||
|
@ -376,17 +362,17 @@ export_dialog (GSList *actions,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the footline */
|
/* 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_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
return (dialog_return);
|
return dialog_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GimpExportReturnType
|
GimpExportReturnType
|
||||||
gimp_export_image (gint32 *image_ID_ptr,
|
gimp_export_image (gint32 *image_ID_ptr,
|
||||||
gint32 *drawable_ID_ptr,
|
gint32 *drawable_ID_ptr,
|
||||||
|
@ -507,12 +493,5 @@ gimp_export_image (gint32 *image_ID_ptr,
|
||||||
}
|
}
|
||||||
g_slist_free (actions);
|
g_slist_free (actions);
|
||||||
|
|
||||||
return (dialog_return);
|
return dialog_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "gimpdialog.h"
|
||||||
#include "gimphelpui.h"
|
#include "gimphelpui.h"
|
||||||
|
|
||||||
/* external functions */
|
/* external functions */
|
||||||
|
@ -84,6 +85,12 @@ gimp_help_connect_help_accel (GtkWidget *widget,
|
||||||
if (!help_func)
|
if (!help_func)
|
||||||
return;
|
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 */
|
/* set up the help signals and tips query widget */
|
||||||
if (!tips_query)
|
if (!tips_query)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +164,7 @@ gimp_help_connect_help_accel (GtkWidget *widget,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_help_set_help_data (GtkWidget *widget,
|
gimp_help_set_help_data (GtkWidget *widget,
|
||||||
gchar *tooltip,
|
const gchar *tooltip,
|
||||||
gchar *help_data)
|
gchar *help_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
|
|
|
@ -33,6 +33,9 @@ void gimp_help_free (void);
|
||||||
void gimp_help_enable_tooltips (void);
|
void gimp_help_enable_tooltips (void);
|
||||||
void gimp_help_disable_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 */
|
/* connect the "F1" accelerator of a window */
|
||||||
void gimp_help_connect_help_accel (GtkWidget *widget,
|
void gimp_help_connect_help_accel (GtkWidget *widget,
|
||||||
GimpHelpFunc help_func,
|
GimpHelpFunc help_func,
|
||||||
|
@ -40,7 +43,7 @@ void gimp_help_connect_help_accel (GtkWidget *widget,
|
||||||
|
|
||||||
/* set help data for non-window widgets */
|
/* set help data for non-window widgets */
|
||||||
void gimp_help_set_help_data (GtkWidget *widget,
|
void gimp_help_set_help_data (GtkWidget *widget,
|
||||||
gchar *tool_tip,
|
const gchar *tool_tip,
|
||||||
gchar *help_data);
|
gchar *help_data);
|
||||||
|
|
||||||
/* activate the context help inspector */
|
/* activate the context help inspector */
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "gimpdialog.h"
|
||||||
#include "gimpunitmenu.h"
|
#include "gimpunitmenu.h"
|
||||||
|
|
||||||
#include "libgimp/gimpintl.h"
|
#include "gimpintl.h"
|
||||||
|
|
||||||
/* private functions */
|
/* private functions */
|
||||||
static const gchar * gimp_unit_menu_build_string (gchar *format,
|
static const gchar * gimp_unit_menu_build_string (gchar *format,
|
||||||
|
@ -443,10 +444,8 @@ gimp_unit_menu_selection_delete_callback (GtkWidget *widget,
|
||||||
static void
|
static void
|
||||||
gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
||||||
{
|
{
|
||||||
GtkWidget *hbbox;
|
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *scrolled_win;
|
GtkWidget *scrolled_win;
|
||||||
GtkWidget *button;
|
|
||||||
gchar *titles[2];
|
gchar *titles[2];
|
||||||
gchar *row[2];
|
gchar *row[2];
|
||||||
GUnit unit;
|
GUnit unit;
|
||||||
|
@ -454,12 +453,18 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
||||||
gint unit_width;
|
gint unit_width;
|
||||||
gint factor_width;
|
gint factor_width;
|
||||||
|
|
||||||
gum->selection = gtk_dialog_new ();
|
gum->selection =
|
||||||
gtk_window_set_wmclass (GTK_WINDOW (gum->selection),
|
gimp_dialog_new (_("Unit Selection"), "unit_selection",
|
||||||
"unit_selection", "Gimp");
|
gimp_standard_help_func, "dialogs/unit_selection.html",
|
||||||
gtk_window_set_title (GTK_WINDOW (gum->selection), _("Unit Selection"));
|
GTK_WIN_POS_MOUSE,
|
||||||
gtk_window_set_policy (GTK_WINDOW (gum->selection), FALSE, TRUE, FALSE);
|
FALSE, TRUE, FALSE,
|
||||||
gtk_window_position (GTK_WINDOW (gum->selection), GTK_WIN_POS_MOUSE);
|
|
||||||
|
_("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_connect (GTK_OBJECT (gum->selection), "delete_event",
|
||||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_delete_callback),
|
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),
|
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||||
&gum->clist);
|
&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 (vbox);
|
||||||
gtk_widget_show (gum->selection);
|
gtk_widget_show (gum->selection);
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,6 @@ gimp_dialog_newv (const gchar *title,
|
||||||
/* prepare the action_area */
|
/* prepare the action_area */
|
||||||
gimp_dialog_create_action_areav (GTK_DIALOG (dialog), args);
|
gimp_dialog_create_action_areav (GTK_DIALOG (dialog), args);
|
||||||
|
|
||||||
gimp_dialog_set_icon (dialog);
|
|
||||||
|
|
||||||
/* connect the "F1" help key */
|
/* connect the "F1" help key */
|
||||||
if (help_func)
|
if (help_func)
|
||||||
gimp_help_connect_help_accel (dialog, help_func, help_data);
|
gimp_help_connect_help_accel (dialog, help_func, help_data);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "gimpdialog.h"
|
||||||
#include "gimphelpui.h"
|
#include "gimphelpui.h"
|
||||||
|
|
||||||
/* external functions */
|
/* external functions */
|
||||||
|
@ -84,6 +85,12 @@ gimp_help_connect_help_accel (GtkWidget *widget,
|
||||||
if (!help_func)
|
if (!help_func)
|
||||||
return;
|
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 */
|
/* set up the help signals and tips query widget */
|
||||||
if (!tips_query)
|
if (!tips_query)
|
||||||
{
|
{
|
||||||
|
@ -157,7 +164,7 @@ gimp_help_connect_help_accel (GtkWidget *widget,
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_help_set_help_data (GtkWidget *widget,
|
gimp_help_set_help_data (GtkWidget *widget,
|
||||||
gchar *tooltip,
|
const gchar *tooltip,
|
||||||
gchar *help_data)
|
gchar *help_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (widget != NULL);
|
g_return_if_fail (widget != NULL);
|
||||||
|
|
|
@ -33,6 +33,9 @@ void gimp_help_free (void);
|
||||||
void gimp_help_enable_tooltips (void);
|
void gimp_help_enable_tooltips (void);
|
||||||
void gimp_help_disable_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 */
|
/* connect the "F1" accelerator of a window */
|
||||||
void gimp_help_connect_help_accel (GtkWidget *widget,
|
void gimp_help_connect_help_accel (GtkWidget *widget,
|
||||||
GimpHelpFunc help_func,
|
GimpHelpFunc help_func,
|
||||||
|
@ -40,7 +43,7 @@ void gimp_help_connect_help_accel (GtkWidget *widget,
|
||||||
|
|
||||||
/* set help data for non-window widgets */
|
/* set help data for non-window widgets */
|
||||||
void gimp_help_set_help_data (GtkWidget *widget,
|
void gimp_help_set_help_data (GtkWidget *widget,
|
||||||
gchar *tool_tip,
|
const gchar *tool_tip,
|
||||||
gchar *help_data);
|
gchar *help_data);
|
||||||
|
|
||||||
/* activate the context help inspector */
|
/* activate the context help inspector */
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
*/
|
*/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "gimpdialog.h"
|
||||||
#include "gimpunitmenu.h"
|
#include "gimpunitmenu.h"
|
||||||
|
|
||||||
#include "libgimp/gimpintl.h"
|
#include "gimpintl.h"
|
||||||
|
|
||||||
/* private functions */
|
/* private functions */
|
||||||
static const gchar * gimp_unit_menu_build_string (gchar *format,
|
static const gchar * gimp_unit_menu_build_string (gchar *format,
|
||||||
|
@ -443,10 +444,8 @@ gimp_unit_menu_selection_delete_callback (GtkWidget *widget,
|
||||||
static void
|
static void
|
||||||
gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
||||||
{
|
{
|
||||||
GtkWidget *hbbox;
|
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *scrolled_win;
|
GtkWidget *scrolled_win;
|
||||||
GtkWidget *button;
|
|
||||||
gchar *titles[2];
|
gchar *titles[2];
|
||||||
gchar *row[2];
|
gchar *row[2];
|
||||||
GUnit unit;
|
GUnit unit;
|
||||||
|
@ -454,12 +453,18 @@ gimp_unit_menu_create_selection (GimpUnitMenu *gum)
|
||||||
gint unit_width;
|
gint unit_width;
|
||||||
gint factor_width;
|
gint factor_width;
|
||||||
|
|
||||||
gum->selection = gtk_dialog_new ();
|
gum->selection =
|
||||||
gtk_window_set_wmclass (GTK_WINDOW (gum->selection),
|
gimp_dialog_new (_("Unit Selection"), "unit_selection",
|
||||||
"unit_selection", "Gimp");
|
gimp_standard_help_func, "dialogs/unit_selection.html",
|
||||||
gtk_window_set_title (GTK_WINDOW (gum->selection), _("Unit Selection"));
|
GTK_WIN_POS_MOUSE,
|
||||||
gtk_window_set_policy (GTK_WINDOW (gum->selection), FALSE, TRUE, FALSE);
|
FALSE, TRUE, FALSE,
|
||||||
gtk_window_position (GTK_WINDOW (gum->selection), GTK_WIN_POS_MOUSE);
|
|
||||||
|
_("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_connect (GTK_OBJECT (gum->selection), "delete_event",
|
||||||
GTK_SIGNAL_FUNC (gimp_unit_menu_selection_delete_callback),
|
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),
|
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||||
&gum->clist);
|
&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 (vbox);
|
||||||
gtk_widget_show (gum->selection);
|
gtk_widget_show (gum->selection);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,6 +17,7 @@ INCLUDES = \
|
||||||
-I$(includedir)
|
-I$(includedir)
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
$(top_builddir)/libgimp/libgimp.la \
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(INTLLIBS)
|
$(INTLLIBS)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,6 +17,7 @@ INCLUDES = \
|
||||||
-I$(includedir)
|
-I$(includedir)
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
$(top_builddir)/libgimp/libgimp.la \
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(INTLLIBS)
|
$(INTLLIBS)
|
||||||
|
|
|
@ -17,9 +17,10 @@ AM_CPPFLAGS = \
|
||||||
-DLOCALEDIR=\""$(localedir)"\"
|
-DLOCALEDIR=\""$(localedir)"\"
|
||||||
|
|
||||||
LDADD = \
|
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/libgck/gck/libgck.la \
|
||||||
|
$(top_builddir)/plug-ins/megawidget/libmegawidget.a \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(INTLLIBS)
|
$(INTLLIBS)
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <gtk/gtk.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 "gck/gck.h"
|
||||||
#include "plug-ins/megawidget/megawidget.h"
|
#include "plug-ins/megawidget/megawidget.h"
|
||||||
|
|
||||||
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Declare local functions.
|
/* Declare local functions.
|
||||||
|
@ -37,13 +44,16 @@ static void run (char *name,
|
||||||
int *nreturn_vals,
|
int *nreturn_vals,
|
||||||
GParam **return_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 =
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
|
@ -56,7 +66,8 @@ GPlugInInfo PLUG_IN_INFO =
|
||||||
static gint borderaverage_thickness = 3;
|
static gint borderaverage_thickness = 3;
|
||||||
static gint borderaverage_bucket_exponent = 4;
|
static gint borderaverage_bucket_exponent = 4;
|
||||||
|
|
||||||
struct borderaverage_data {
|
struct borderaverage_data
|
||||||
|
{
|
||||||
gint thickness;
|
gint thickness;
|
||||||
gint bucket_exponent;
|
gint bucket_exponent;
|
||||||
} borderaverage_data = { 3, 4 };
|
} borderaverage_data = { 3, 4 };
|
||||||
|
@ -69,7 +80,7 @@ gchar * menu_labels[] =
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] =
|
static GParamDef args[] =
|
||||||
{
|
{
|
||||||
|
@ -125,7 +136,8 @@ run (char *name,
|
||||||
/* Get the specified drawable */
|
/* Get the specified drawable */
|
||||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||||
|
|
||||||
switch (run_mode) {
|
switch (run_mode)
|
||||||
|
{
|
||||||
case RUN_INTERACTIVE:
|
case RUN_INTERACTIVE:
|
||||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||||
borderaverage_thickness = borderaverage_data.thickness;
|
borderaverage_thickness = borderaverage_data.thickness;
|
||||||
|
@ -140,7 +152,6 @@ run (char *name,
|
||||||
if (status == STATUS_SUCCESS)
|
if (status == STATUS_SUCCESS)
|
||||||
borderaverage_thickness = param[3].data.d_int32;
|
borderaverage_thickness = param[3].data.d_int32;
|
||||||
borderaverage_bucket_exponent = param[4].data.d_int32;
|
borderaverage_bucket_exponent = param[4].data.d_int32;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RUN_WITH_LAST_VALS:
|
case RUN_WITH_LAST_VALS:
|
||||||
|
@ -153,21 +164,30 @@ run (char *name,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == STATUS_SUCCESS) {
|
if (status == STATUS_SUCCESS)
|
||||||
|
{
|
||||||
/* Make sure that the drawable is RGB color */
|
/* Make sure that the drawable is RGB color */
|
||||||
if (gimp_drawable_is_rgb (drawable->id)) {
|
if (gimp_drawable_is_rgb (drawable->id))
|
||||||
|
{
|
||||||
gimp_progress_init ("borderaverage");
|
gimp_progress_init ("borderaverage");
|
||||||
borderaverage (drawable, &result_color[0], &result_color[1], &result_color[2]);
|
borderaverage (drawable,
|
||||||
|
&result_color[0], &result_color[1], &result_color[2]);
|
||||||
|
|
||||||
if (run_mode != RUN_NONINTERACTIVE) {
|
if (run_mode != RUN_NONINTERACTIVE)
|
||||||
gimp_palette_set_foreground(result_color[0],result_color[1],result_color[2]);
|
{
|
||||||
|
gimp_palette_set_foreground (result_color[0],
|
||||||
|
result_color[1],
|
||||||
|
result_color[2]);
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
}
|
}
|
||||||
if (run_mode == RUN_INTERACTIVE)
|
if (run_mode == RUN_INTERACTIVE)
|
||||||
borderaverage_data.thickness = borderaverage_thickness;
|
borderaverage_data.thickness = borderaverage_thickness;
|
||||||
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
||||||
gimp_set_data("plug_in_borderaverage", &borderaverage_data, sizeof(borderaverage_data));
|
gimp_set_data ("plug_in_borderaverage",
|
||||||
} else {
|
&borderaverage_data, sizeof (borderaverage_data));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
status = STATUS_EXECUTION_ERROR;
|
status = STATUS_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,29 +229,29 @@ borderaverage (GDrawable *drawable,
|
||||||
|
|
||||||
GPixelRgn myPR;
|
GPixelRgn myPR;
|
||||||
|
|
||||||
|
|
||||||
/* allocate and clear the cube before */
|
/* allocate and clear the cube before */
|
||||||
bucket_expo = borderaverage_bucket_exponent;
|
bucket_expo = borderaverage_bucket_exponent;
|
||||||
bucket_rexpo = 8 - bucket_expo;
|
bucket_rexpo = 8 - bucket_expo;
|
||||||
cube = (gint*) malloc( (1 << (bucket_rexpo * 3)) * sizeof(gint) );
|
cube = g_new (gint, 1 << (bucket_rexpo * 3));
|
||||||
bucket_num = 1 << bucket_rexpo;
|
bucket_num = 1 << bucket_rexpo;
|
||||||
|
|
||||||
for (i = 0; i < bucket_num; i++) {
|
for (i = 0; i < bucket_num; i++)
|
||||||
for (j = 0; j < bucket_num; j++) {
|
{
|
||||||
for (k = 0; k < bucket_num; k++) {
|
for (j = 0; j < bucket_num; j++)
|
||||||
|
{
|
||||||
|
for (k = 0; k < bucket_num; k++)
|
||||||
|
{
|
||||||
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get the input area. This is the bounding box of the selection in
|
/* 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
|
* the image (or the entire image if there is no selection). Only
|
||||||
* operating on the input area is simply an optimization. It doesn't
|
* operating on the input area is simply an optimization. It doesn't
|
||||||
* need to be done for correct operation. (It simply makes it go
|
* need to be done for correct operation. (It simply makes it go
|
||||||
* faster, since fewer pixels need to be operated on).
|
* faster, since fewer pixels need to be operated on).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
||||||
|
|
||||||
/* Get the size of the input image. (This will/must be the same
|
/* Get the size of the input image. (This will/must be the same
|
||||||
|
@ -242,35 +262,40 @@ borderaverage (GDrawable *drawable,
|
||||||
bytes = drawable->bpp;
|
bytes = drawable->bpp;
|
||||||
|
|
||||||
/* allocate row buffer */
|
/* allocate row buffer */
|
||||||
buffer = (guchar *) malloc ((x2 - x1) * bytes);
|
buffer = g_new (guchar, (x2 - x1) * bytes);
|
||||||
|
|
||||||
/* initialize the pixel regions */
|
/* initialize the pixel regions */
|
||||||
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
||||||
|
|
||||||
/* loop through the rows, performing our magic*/
|
/* loop through the rows, performing our magic*/
|
||||||
for (row = y1; row < y2; row++) {
|
for (row = y1; row < y2; row++)
|
||||||
|
{
|
||||||
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
||||||
|
|
||||||
if (row < y1 + borderaverage_thickness ||
|
if (row < y1 + borderaverage_thickness ||
|
||||||
row >= y2 - borderaverage_thickness) {
|
row >= y2 - borderaverage_thickness)
|
||||||
|
{
|
||||||
/* add the whole row */
|
/* add the whole row */
|
||||||
for (col = 0; col < ((x2 - x1) * bytes); col += bytes) {
|
for (col = 0; col < ((x2 - x1) * bytes); col += bytes)
|
||||||
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* add the left border */
|
/* add the left border */
|
||||||
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes) {
|
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes)
|
||||||
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
/* add the right border */
|
/* add the right border */
|
||||||
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
||||||
col < ((x2 - x1) * bytes); col += bytes) {
|
col < ((x2 - x1) * bytes); col += bytes)
|
||||||
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((row % 5) == 0)
|
if ((row % 5) == 0)
|
||||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||||
}
|
}
|
||||||
|
@ -278,11 +303,17 @@ borderaverage (GDrawable *drawable,
|
||||||
max = 0; r = 0; g = 0; b = 0;
|
max = 0; r = 0; g = 0; b = 0;
|
||||||
|
|
||||||
/* get max of cube */
|
/* get max of cube */
|
||||||
for (i = 0; i < bucket_num; i++) {
|
for (i = 0; i < bucket_num; i++)
|
||||||
for (j = 0; j < bucket_num; j++) {
|
{
|
||||||
for (k = 0; k < bucket_num; k++) {
|
for (j = 0; j < bucket_num; j++)
|
||||||
if (cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] > max) {
|
{
|
||||||
max = cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k];
|
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));
|
r = (i<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
|
@ -296,10 +327,10 @@ borderaverage (GDrawable *drawable,
|
||||||
*res_g = g;
|
*res_g = g;
|
||||||
*res_b = b;
|
*res_b = b;
|
||||||
|
|
||||||
free (buffer);
|
g_free (buffer);
|
||||||
|
g_free (cube);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_new_color (gint bytes,
|
add_new_color (gint bytes,
|
||||||
guchar *buffer,
|
guchar *buffer,
|
||||||
|
@ -311,25 +342,44 @@ add_new_color (gint bytes,
|
||||||
|
|
||||||
bucket_rexpo = 8 - bucket_expo;
|
bucket_rexpo = 8 - bucket_expo;
|
||||||
r = buffer[0] >>bucket_expo;
|
r = buffer[0] >>bucket_expo;
|
||||||
if (bytes > 1) {
|
if (bytes > 1)
|
||||||
|
{
|
||||||
g = buffer[1] >>bucket_expo;
|
g = buffer[1] >>bucket_expo;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
g = 0;
|
g = 0;
|
||||||
}
|
}
|
||||||
if (bytes > 2) {
|
if (bytes > 2)
|
||||||
|
{
|
||||||
b = buffer[2] >>bucket_expo;
|
b = buffer[2] >>bucket_expo;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
b = 0;
|
b = 0;
|
||||||
}
|
}
|
||||||
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean run_flag = FALSE;
|
||||||
borderaverage_dialog ()
|
|
||||||
|
static void
|
||||||
|
borderaverage_ok_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg, *frame, *vbox2;
|
run_flag = TRUE;
|
||||||
GtkWidget *vbox, *menu;
|
|
||||||
gint runp;
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
borderaverage_dialog (void)
|
||||||
|
{
|
||||||
|
GtkWidget *dlg;
|
||||||
|
GtkWidget *frame;
|
||||||
|
GtkWidget *vbox2;
|
||||||
|
GtkWidget *vbox;
|
||||||
|
GtkWidget *menu;
|
||||||
gchar **argv;
|
gchar **argv;
|
||||||
gint argc;
|
gint argc;
|
||||||
|
|
||||||
|
@ -337,40 +387,58 @@ borderaverage_dialog ()
|
||||||
argc = 1;
|
argc = 1;
|
||||||
argv = g_new (gchar *, 1);
|
argv = g_new (gchar *, 1);
|
||||||
argv[0] = g_strdup ("borderaverage");
|
argv[0] = g_strdup ("borderaverage");
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
gtk_rc_parse (gimp_gtkrc ());
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
|
||||||
dlg = mw_app_new("plug_in_borderaverage", _("Borderaverage"), &runp);
|
dlg = gimp_dialog_new (_("Borderaverage"), "borderaverage",
|
||||||
|
gimp_plugin_help_func, "filters/borderaverage.html",
|
||||||
|
GTK_WIN_POS_MOUSE,
|
||||||
|
FALSE, TRUE, FALSE,
|
||||||
|
|
||||||
vbox = gtk_vbox_new(FALSE, 0);
|
_("OK"), borderaverage_ok_callback,
|
||||||
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
|
NULL, NULL, NULL, TRUE, FALSE,
|
||||||
|
_("Cancel"), gtk_widget_destroy,
|
||||||
|
NULL, 1, NULL, FALSE, TRUE,
|
||||||
|
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
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_box_pack_start (GTK_BOX (GTK_DIALOG(dlg)->vbox), vbox, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
mw_ientry_new(vbox, _("Border Size"), _("Thickness"), &borderaverage_thickness);
|
mw_ientry_new (vbox, _("Border Size"), _("Thickness:"),
|
||||||
|
&borderaverage_thickness);
|
||||||
|
|
||||||
|
frame = gtk_frame_new (_("Number of Colors"));
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
frame=gck_frame_new(_("Number of colors"),vbox,GTK_SHADOW_ETCHED_IN,FALSE,FALSE,0,2);
|
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||||
vbox2=gck_vbox_new(frame,FALSE,TRUE,TRUE,5,0,5);
|
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 = gck_option_menu_new (_("Bucket Size:"), vbox2, TRUE, TRUE, 0,
|
||||||
menu_labels,(GtkSignalFunc)menu_callback, NULL);
|
menu_labels,
|
||||||
gtk_option_menu_set_history(GTK_OPTION_MENU(menu),borderaverage_bucket_exponent);
|
(GtkSignalFunc) menu_callback, NULL);
|
||||||
|
|
||||||
|
gtk_option_menu_set_history (GTK_OPTION_MENU (menu),
|
||||||
|
borderaverage_bucket_exponent);
|
||||||
gtk_widget_show (menu);
|
gtk_widget_show (menu);
|
||||||
|
|
||||||
gtk_widget_show (dlg);
|
gtk_widget_show (dlg);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
gdk_flush ();
|
gdk_flush ();
|
||||||
|
|
||||||
if (runp)
|
return run_flag;
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void menu_callback (GtkWidget *widget,
|
void menu_callback (GtkWidget *widget,
|
||||||
gpointer client_data)
|
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 (frame);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
#else
|
#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);
|
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,
|
(GtkSignalFunc) gtkW_menu_update,
|
||||||
&VALS.h_style,
|
&VALS.h_style,
|
||||||
h_style_menu,
|
h_style_menu,
|
||||||
sizeof (h_style_menu) / sizeof (h_style_menu[0]));
|
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,
|
(GtkSignalFunc) gtkW_menu_update,
|
||||||
&VALS.h_base,
|
&VALS.h_base,
|
||||||
h_base_menu,
|
h_base_menu,
|
||||||
sizeof (h_base_menu) / sizeof (h_base_menu[0]));
|
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,
|
(GtkSignalFunc) gtkW_menu_update,
|
||||||
&VALS.v_style,
|
&VALS.v_style,
|
||||||
v_style_menu,
|
v_style_menu,
|
||||||
sizeof (v_style_menu) / sizeof (v_style_menu[0]));
|
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,
|
(GtkSignalFunc) gtkW_menu_update,
|
||||||
&VALS.v_base,
|
&VALS.v_base,
|
||||||
v_base_menu,
|
v_base_menu,
|
||||||
sizeof (v_base_menu) / sizeof (v_base_menu[0]));
|
sizeof (v_base_menu) / sizeof (v_base_menu[0]));
|
||||||
#endif
|
#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++,
|
0, index++,
|
||||||
(GtkSignalFunc) gtkW_toggle_update,
|
(GtkSignalFunc) gtkW_toggle_update,
|
||||||
&VALS.ignore_bottom);
|
&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++,
|
0, index++,
|
||||||
(GtkSignalFunc) gtkW_toggle_update,
|
(GtkSignalFunc) gtkW_toggle_update,
|
||||||
&VALS.base_is_bottom_layer);
|
&VALS.base_is_bottom_layer);
|
||||||
gtkW_table_add_iscale_entry (table, _("Grid size"),
|
gtkW_table_add_iscale_entry (table, _("Grid Size:"),
|
||||||
0, index++,
|
0, index++,
|
||||||
(GtkSignalFunc) gtkW_iscale_update,
|
(GtkSignalFunc) gtkW_iscale_update,
|
||||||
(GtkSignalFunc) gtkW_ientry_update,
|
(GtkSignalFunc) gtkW_ientry_update,
|
||||||
|
@ -754,7 +755,7 @@ gtkW_message_dialog (gint gtk_was_initialized, gchar *message)
|
||||||
dlg = gtkW_message_dialog_new (PLUG_IN_NAME);
|
dlg = gtkW_message_dialog_new (PLUG_IN_NAME);
|
||||||
|
|
||||||
table = gtk_table_new (1, 1, FALSE);
|
table = gtk_table_new (1, 1, FALSE);
|
||||||
gtk_container_border_width (GTK_CONTAINER (table), GTKW_BORDER_WIDTH);
|
gtk_container_set_border_width (GTK_CONTAINER (table), 6);
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), table, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), table, TRUE, TRUE, 0);
|
||||||
|
|
||||||
label = gtk_label_new (message);
|
label = gtk_label_new (message);
|
||||||
|
@ -796,7 +797,9 @@ gtkW_table_new (GtkWidget *parent, gint col, gint row)
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
|
|
||||||
table = gtk_table_new (col,row, FALSE);
|
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_container_add (GTK_CONTAINER (parent), table);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
|
@ -857,7 +860,7 @@ gtkW_frame_new (GtkWidget *parent,
|
||||||
|
|
||||||
frame = gtk_frame_new (name);
|
frame = gtk_frame_new (name);
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
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)
|
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);
|
gtk_widget_show (frame);
|
||||||
|
@ -902,9 +905,9 @@ gtkW_table_add_iscale_entry (GtkWidget *table,
|
||||||
GtkWidget *label, *hbox, *scale, *entry;
|
GtkWidget *label, *hbox, *scale, *entry;
|
||||||
|
|
||||||
label = gtk_label_new (name);
|
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_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);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
hbox = gtk_hbox_new (FALSE, 5);
|
hbox = gtk_hbox_new (FALSE, 5);
|
||||||
|
@ -917,9 +920,8 @@ gtkW_table_add_iscale_entry (GtkWidget *table,
|
||||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
||||||
gtk_widget_set_usize (scale, GTKW_SCALE_WIDTH, 0);
|
gtk_widget_set_usize (scale, GTKW_SCALE_WIDTH, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 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_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",
|
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||||
(GtkSignalFunc) scale_update, value);
|
(GtkSignalFunc) scale_update, value);
|
||||||
|
|
||||||
|
@ -1020,9 +1022,9 @@ gtkW_table_add_menu (GtkWidget *table,
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
label = gtk_label_new (name);
|
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_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);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
menu = gtk_menu_new ();
|
menu = gtk_menu_new ();
|
||||||
|
|
|
@ -51,18 +51,21 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "libgimp/gimp.h"
|
|
||||||
#include "libgimp/gimpui.h"
|
|
||||||
#include "gtk/gtk.h"
|
|
||||||
#include <plug-ins/gpc/gpc.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#include <gtk/gtk.h>
|
||||||
#include "config.h"
|
|
||||||
#endif
|
#include <libgimp/gimp.h>
|
||||||
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
#include <plug-ins/gpc/gpc.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
@ -123,15 +126,14 @@ static BlurInterface blur_int = {
|
||||||
********************************/
|
********************************/
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run(
|
static void run (char *name,
|
||||||
char *name,
|
|
||||||
int nparams,
|
int nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
int *nreturn_vals,
|
||||||
GParam **return_vals
|
GParam **return_vals);
|
||||||
);
|
|
||||||
|
|
||||||
GPlugInInfo PLUG_IN_INFO = {
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
NULL, /* quit_proc */
|
NULL, /* quit_proc */
|
||||||
query, /* query_proc */
|
query, /* query_proc */
|
||||||
|
@ -140,20 +142,16 @@ GPlugInInfo PLUG_IN_INFO = {
|
||||||
|
|
||||||
static void blur (GDrawable *drawable);
|
static void blur (GDrawable *drawable);
|
||||||
|
|
||||||
static inline void blur_prepare_row(
|
static inline void blur_prepare_row (GPixelRgn *pixel_rgn,
|
||||||
GPixelRgn *pixel_rgn,
|
|
||||||
guchar *data,
|
guchar *data,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int w
|
int w);
|
||||||
);
|
|
||||||
|
|
||||||
static gint blur_dialog();
|
static gint blur_dialog (void);
|
||||||
|
|
||||||
static void blur_ok_callback(
|
static void blur_ok_callback (GtkWidget *widget,
|
||||||
GtkWidget *widget,
|
gpointer data);
|
||||||
gpointer data
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************ Guts ***********************************/
|
/************************************ Guts ***********************************/
|
||||||
|
@ -169,16 +167,18 @@ MAIN()
|
||||||
********************************/
|
********************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query()
|
query (void)
|
||||||
|
{
|
||||||
|
static GParamDef args_ni[] =
|
||||||
{
|
{
|
||||||
static GParamDef args_ni[] = {
|
|
||||||
{ PARAM_INT32, "run_mode", "non-interactive" },
|
{ PARAM_INT32, "run_mode", "non-interactive" },
|
||||||
{ PARAM_IMAGE, "image", "Input image (unused)" },
|
{ PARAM_IMAGE, "image", "Input image (unused)" },
|
||||||
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
|
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
|
||||||
};
|
};
|
||||||
static int nargs_ni = sizeof(args_ni) / sizeof (args_ni[0]);
|
static int nargs_ni = sizeof(args_ni) / sizeof (args_ni[0]);
|
||||||
|
|
||||||
static GParamDef args[] = {
|
static GParamDef args[] =
|
||||||
|
{
|
||||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ PARAM_IMAGE, "image", "Input image (unused)" },
|
{ PARAM_IMAGE, "image", "Input image (unused)" },
|
||||||
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
|
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
|
||||||
|
@ -225,7 +225,6 @@ query()
|
||||||
args_ni, return_vals);
|
args_ni, return_vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
*
|
*
|
||||||
* run() - main routine
|
* run() - main routine
|
||||||
|
@ -242,7 +241,6 @@ run (char *name,
|
||||||
int *nreturn_vals,
|
int *nreturn_vals,
|
||||||
GParam **return_vals)
|
GParam **return_vals)
|
||||||
{
|
{
|
||||||
|
|
||||||
GDrawable *drawable;
|
GDrawable *drawable;
|
||||||
GRunModeType run_mode;
|
GRunModeType run_mode;
|
||||||
GStatusType status = STATUS_SUCCESS; /* assume the best! */
|
GStatusType status = STATUS_SUCCESS; /* assume the best! */
|
||||||
|
@ -265,9 +263,10 @@ run (char *name,
|
||||||
* Make sure the drawable type is appropriate.
|
* Make sure the drawable type is appropriate.
|
||||||
*/
|
*/
|
||||||
if (gimp_drawable_is_rgb(drawable->id) ||
|
if (gimp_drawable_is_rgb(drawable->id) ||
|
||||||
gimp_drawable_is_gray(drawable->id)) {
|
gimp_drawable_is_gray(drawable->id))
|
||||||
|
{
|
||||||
switch (run_mode) {
|
switch (run_mode)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* If we're running interactively, pop up the dialog box.
|
* If we're running interactively, pop up the dialog box.
|
||||||
*/
|
*/
|
||||||
|
@ -276,6 +275,7 @@ run (char *name,
|
||||||
if (!blur_dialog()) /* return on Cancel */
|
if (!blur_dialog()) /* return on Cancel */
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're not interactive (probably scripting), we
|
* If we're not interactive (probably scripting), we
|
||||||
* get the parameters from the param[] array, since
|
* get the parameters from the param[] array, since
|
||||||
|
@ -284,7 +284,8 @@ run (char *name,
|
||||||
*/
|
*/
|
||||||
case RUN_NONINTERACTIVE:
|
case RUN_NONINTERACTIVE:
|
||||||
if ((strcmp(name, "plug_in_blur_randomize") == 0) &&
|
if ((strcmp(name, "plug_in_blur_randomize") == 0) &&
|
||||||
(nparams == 7)) {
|
(nparams == 7))
|
||||||
|
{
|
||||||
pivals.blur_pct = (gdouble)param[3].data.d_float;
|
pivals.blur_pct = (gdouble)param[3].data.d_float;
|
||||||
pivals.blur_pct = (gdouble)MIN(100.0, pivals.blur_pct);
|
pivals.blur_pct = (gdouble)MIN(100.0, pivals.blur_pct);
|
||||||
pivals.blur_pct = (gdouble)MAX(1.0, pivals.blur_pct);
|
pivals.blur_pct = (gdouble)MAX(1.0, pivals.blur_pct);
|
||||||
|
@ -296,30 +297,37 @@ run (char *name,
|
||||||
pivals.seed_type = (gint) MAX(SEED_TIME, param[5].data.d_int32);
|
pivals.seed_type = (gint) MAX(SEED_TIME, param[5].data.d_int32);
|
||||||
pivals.blur_seed = (gint) param[6].data.d_int32;
|
pivals.blur_seed = (gint) param[6].data.d_int32;
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
} else if ((strcmp(name, PLUG_IN_NAME) == 0) &&
|
}
|
||||||
(nparams == 3)) {
|
else if ((strcmp(name, PLUG_IN_NAME) == 0) &&
|
||||||
|
(nparams == 3))
|
||||||
|
{
|
||||||
pivals.blur_pct = (gdouble) 100.0;
|
pivals.blur_pct = (gdouble) 100.0;
|
||||||
pivals.blur_rcount = (gdouble) 1.0;
|
pivals.blur_rcount = (gdouble) 1.0;
|
||||||
pivals.seed_type = SEED_TIME;
|
pivals.seed_type = SEED_TIME;
|
||||||
pivals.blur_seed = 0;
|
pivals.blur_seed = 0;
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
status = STATUS_CALLING_ERROR;
|
status = STATUS_CALLING_ERROR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're running with the last set of values, get those values.
|
* If we're running with the last set of values, get those values.
|
||||||
*/
|
*/
|
||||||
case RUN_WITH_LAST_VALS:
|
case RUN_WITH_LAST_VALS:
|
||||||
gimp_get_data(PLUG_IN_NAME, &pivals);
|
gimp_get_data(PLUG_IN_NAME, &pivals);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hopefully we never get here!
|
* Hopefully we never get here!
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (status == STATUS_SUCCESS) {
|
if (status == STATUS_SUCCESS)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* JUST DO IT!
|
* JUST DO IT!
|
||||||
*/
|
*/
|
||||||
|
@ -338,17 +346,21 @@ run (char *name,
|
||||||
/*
|
/*
|
||||||
* If we ran interactively (even repeating) update the display.
|
* If we ran interactively (even repeating) update the display.
|
||||||
*/
|
*/
|
||||||
if (run_mode != RUN_NONINTERACTIVE) {
|
if (run_mode != RUN_NONINTERACTIVE)
|
||||||
|
{
|
||||||
gimp_displays_flush();
|
gimp_displays_flush();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* If we use the dialog popup, set the data for future use.
|
* If we use the dialog popup, set the data for future use.
|
||||||
*/
|
*/
|
||||||
if (run_mode == RUN_INTERACTIVE) {
|
if (run_mode == RUN_INTERACTIVE)
|
||||||
|
{
|
||||||
gimp_set_data(PLUG_IN_NAME, &pivals, sizeof(BlurVals));
|
gimp_set_data(PLUG_IN_NAME, &pivals, sizeof(BlurVals));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* If we got the wrong drawable type, we need to complain.
|
* If we got the wrong drawable type, we need to complain.
|
||||||
*/
|
*/
|
||||||
|
@ -381,17 +393,23 @@ blur_prepare_row (GPixelRgn *pixel_rgn,
|
||||||
{
|
{
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
if (y == 0) {
|
if (y == 0)
|
||||||
|
{
|
||||||
gimp_pixel_rgn_get_row(pixel_rgn, data, x, (y + 1), w);
|
gimp_pixel_rgn_get_row(pixel_rgn, data, x, (y + 1), w);
|
||||||
} else if (y == pixel_rgn->h) {
|
}
|
||||||
|
else if (y == pixel_rgn->h)
|
||||||
|
{
|
||||||
gimp_pixel_rgn_get_row(pixel_rgn, data, x, (y - 1), w);
|
gimp_pixel_rgn_get_row(pixel_rgn, data, x, (y - 1), w);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
gimp_pixel_rgn_get_row(pixel_rgn, data, x, y, w);
|
gimp_pixel_rgn_get_row(pixel_rgn, data, x, y, w);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Fill in edge pixels
|
* Fill in edge pixels
|
||||||
*/
|
*/
|
||||||
for (b = 0; b < pixel_rgn->bpp; b++) {
|
for (b = 0; b < pixel_rgn->bpp; b++)
|
||||||
|
{
|
||||||
data[-(gint)pixel_rgn->bpp + b] = data[b];
|
data[-(gint)pixel_rgn->bpp + b] = data[b];
|
||||||
data[w * pixel_rgn->bpp + b] = data[(w - 1) * pixel_rgn->bpp + b];
|
data[w * pixel_rgn->bpp + b] = data[(w - 1) * pixel_rgn->bpp + b];
|
||||||
}
|
}
|
||||||
|
@ -459,7 +477,8 @@ blur (GDrawable *drawable)
|
||||||
cr = cur_row + bytes;
|
cr = cur_row + bytes;
|
||||||
nr = next_row + bytes;
|
nr = next_row + bytes;
|
||||||
|
|
||||||
for (cnt = 1; cnt <= pivals.blur_rcount; cnt++) {
|
for (cnt = 1; cnt <= pivals.blur_rcount; cnt++)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* prepare the first row and previous row
|
* prepare the first row and previous row
|
||||||
*/
|
*/
|
||||||
|
@ -468,18 +487,23 @@ blur (GDrawable *drawable)
|
||||||
/*
|
/*
|
||||||
* loop through the rows, applying the selected convolution
|
* loop through the rows, applying the selected convolution
|
||||||
*/
|
*/
|
||||||
for (row = y1; row < y2; row++) {
|
for (row = y1; row < y2; row++)
|
||||||
|
{
|
||||||
/* prepare the next row */
|
/* prepare the next row */
|
||||||
blur_prepare_row(sp, nr, x1, row + 1, (x2 - x1));
|
blur_prepare_row(sp, nr, x1, row + 1, (x2 - x1));
|
||||||
|
|
||||||
d = dest;
|
d = dest;
|
||||||
ind = 0;
|
ind = 0;
|
||||||
for (col = 0; col < (x2 - x1) * bytes; col++) {
|
for (col = 0; col < (x2 - x1) * bytes; col++)
|
||||||
if (((rand() % 100)) <= (gint) pivals.blur_pct) {
|
{
|
||||||
|
if (((rand() % 100)) <= (gint) pivals.blur_pct)
|
||||||
|
{
|
||||||
ind++;
|
ind++;
|
||||||
if (ind==bytes || !(has_alpha)) {
|
if (ind==bytes || !(has_alpha))
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* If no alpha channel, or if there is one and this is it...
|
* If no alpha channel,
|
||||||
|
* or if there is one and this is it...
|
||||||
*/
|
*/
|
||||||
*d++ = ((gint) pr[col - bytes] + (gint) pr[col] +
|
*d++ = ((gint) pr[col - bytes] + (gint) pr[col] +
|
||||||
(gint) pr[col + bytes] +
|
(gint) pr[col + bytes] +
|
||||||
|
@ -488,11 +512,15 @@ blur (GDrawable *drawable)
|
||||||
(gint) nr[col - bytes] + (gint) nr[col] +
|
(gint) nr[col - bytes] + (gint) nr[col] +
|
||||||
(gint) nr[col + bytes]) / 9;
|
(gint) nr[col + bytes]) / 9;
|
||||||
ind = 0;
|
ind = 0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* otherwise we have an alpha channel, but this is a color channel
|
* otherwise we have an alpha channel,
|
||||||
|
* but this is a color channel
|
||||||
*/
|
*/
|
||||||
*d++ = ((gint) (((gdouble) (pr[col - bytes] * pr[col - ind])
|
*d++ = ((gint)
|
||||||
|
(((gdouble) (pr[col - bytes] * pr[col - ind])
|
||||||
+ (gdouble) (pr[col] * pr[col + bytes - ind])
|
+ (gdouble) (pr[col] * pr[col + bytes - ind])
|
||||||
+ (gdouble) (pr[col + bytes] * pr[col + 2*bytes - ind])
|
+ (gdouble) (pr[col + bytes] * pr[col + 2*bytes - ind])
|
||||||
+ (gdouble) (cr[col - bytes] * cr[col - ind])
|
+ (gdouble) (cr[col - bytes] * cr[col - ind])
|
||||||
|
@ -515,7 +543,9 @@ blur (GDrawable *drawable)
|
||||||
* Otherwise, this pixel was not selected for randomization,
|
* Otherwise, this pixel was not selected for randomization,
|
||||||
* so use the current value.
|
* so use the current value.
|
||||||
*/
|
*/
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
*d++ = (gint) cr[col];
|
*d++ = (gint) cr[col];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,12 +566,16 @@ blur (GDrawable *drawable)
|
||||||
/*
|
/*
|
||||||
* if we have more cycles to perform, swap the src and dest Pixel Regions
|
* if we have more cycles to perform, swap the src and dest Pixel Regions
|
||||||
*/
|
*/
|
||||||
if (cnt < pivals.blur_rcount) {
|
if (cnt < pivals.blur_rcount)
|
||||||
if (tp != NULL) {
|
{
|
||||||
|
if (tp != NULL)
|
||||||
|
{
|
||||||
tp = dp;
|
tp = dp;
|
||||||
dp = sp;
|
dp = sp;
|
||||||
sp = tp;
|
sp = tp;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
tp = &srcPR;
|
tp = &srcPR;
|
||||||
sp = &destPR;
|
sp = &destPR;
|
||||||
dp = &destPR2;
|
dp = &destPR2;
|
||||||
|
@ -565,30 +599,24 @@ blur (GDrawable *drawable)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
*
|
|
||||||
* GUI ROUTINES
|
* GUI ROUTINES
|
||||||
*
|
|
||||||
********************************/
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************
|
|
||||||
*
|
|
||||||
* blur_dialog() - set up the plug-in's dialog box
|
|
||||||
*
|
|
||||||
********************************/
|
********************************/
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
blur_dialog ()
|
blur_dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg, *entry, *frame,
|
GtkWidget *dlg;
|
||||||
*seed_hbox, *seed_vbox, *table;
|
GtkWidget *label;
|
||||||
|
GtkWidget *entry;
|
||||||
|
GtkWidget *frame;
|
||||||
|
GtkWidget *seed_hbox;
|
||||||
|
GtkWidget *seed_vbox;
|
||||||
|
GtkWidget *table;
|
||||||
GSList *seed_group = NULL;
|
GSList *seed_group = NULL;
|
||||||
gchar **argv;
|
gchar **argv;
|
||||||
gint argc;
|
gint argc;
|
||||||
gchar buffer[10];
|
gchar buffer[10];
|
||||||
/*
|
|
||||||
* various initializations
|
|
||||||
*/
|
|
||||||
gint do_time = (pivals.seed_type == SEED_TIME);
|
gint do_time = (pivals.seed_type == SEED_TIME);
|
||||||
gint do_user = (pivals.seed_type == SEED_USER);
|
gint do_user = (pivals.seed_type == SEED_USER);
|
||||||
|
|
||||||
|
@ -598,10 +626,7 @@ blur_dialog ()
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
gtk_rc_parse (gimp_gtkrc ());
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
/*
|
|
||||||
* Open a new dialog, label it and set up its
|
|
||||||
* destroy callback.
|
|
||||||
*/
|
|
||||||
dlg = gimp_dialog_new (BLUR_VERSION, "blur",
|
dlg = gimp_dialog_new (BLUR_VERSION, "blur",
|
||||||
gimp_plugin_help_func, "filters/blur.html",
|
gimp_plugin_help_func, "filters/blur.html",
|
||||||
GTK_WIN_POS_MOUSE,
|
GTK_WIN_POS_MOUSE,
|
||||||
|
@ -615,7 +640,7 @@ blur_dialog ()
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
GTK_SIGNAL_FUNC (gpc_close_callback),
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
NULL);
|
NULL);
|
||||||
/*
|
/*
|
||||||
* Parameter settings
|
* Parameter settings
|
||||||
|
@ -624,57 +649,69 @@ blur_dialog ()
|
||||||
*/
|
*/
|
||||||
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_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_box_pack_start (GTK_BOX (GTK_DIALOG(dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||||
|
|
||||||
table = gtk_table_new (4, 2, FALSE);
|
table = gtk_table_new (4, 2, 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);
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
gpc_setup_tooltips (table);
|
gpc_setup_tooltips (table);
|
||||||
/*
|
|
||||||
* Randomization seed initialization controls
|
label = gtk_label_new (_("Randomization Seed:"));
|
||||||
*/
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||||
gpc_add_label(_("Randomization Seed:"), table, 0, 1, 1, 2);
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Box to hold seed initialization radio buttons
|
* Box to hold seed initialization radio buttons
|
||||||
*/
|
*/
|
||||||
seed_vbox = gtk_vbox_new (FALSE, 2);
|
seed_vbox = gtk_vbox_new (FALSE, 2);
|
||||||
gtk_container_border_width(GTK_CONTAINER(seed_vbox), 5);
|
|
||||||
gtk_table_attach (GTK_TABLE (table), seed_vbox, 1, 2, 1, 2,
|
gtk_table_attach (GTK_TABLE (table), seed_vbox, 1, 2, 1, 2,
|
||||||
GTK_FILL | GTK_EXPAND, GTK_FILL, 5, 0);
|
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
|
||||||
/*
|
/*
|
||||||
* Time button
|
* Time button
|
||||||
*/
|
*/
|
||||||
gpc_add_radio_button (&seed_group, _("Current Time"), seed_vbox, &do_time,
|
gpc_add_radio_button (&seed_group, _("Current Time"), seed_vbox, &do_time,
|
||||||
_("Seed random number generator from the current time - this guarantees a reasonable randomization"));
|
_("Seed random number generator from the current "
|
||||||
|
"time - this guarantees a reasonable randomization"));
|
||||||
/*
|
/*
|
||||||
* Box to hold seed user initialization controls
|
* Box to hold seed user initialization controls
|
||||||
*/
|
*/
|
||||||
seed_hbox = gtk_hbox_new(FALSE, 3);
|
seed_hbox = gtk_hbox_new (FALSE, 4);
|
||||||
gtk_container_border_width(GTK_CONTAINER(seed_hbox), 0);
|
|
||||||
gtk_box_pack_start (GTK_BOX (seed_vbox), seed_hbox, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (seed_vbox), seed_hbox, FALSE, FALSE, 0);
|
||||||
/*
|
/*
|
||||||
* User button
|
* User button
|
||||||
*/
|
*/
|
||||||
gpc_add_radio_button (&seed_group, _("Other Value"), seed_hbox, &do_user,
|
gpc_add_radio_button (&seed_group, _("Other Value"), seed_hbox, &do_user,
|
||||||
_("Enable user-entered value for random number generator seed - this allows you to repeat a given \"random\" operation"));
|
_("Enable user-entered value for random number "
|
||||||
|
"generator seed - this allows you to repeat a "
|
||||||
|
"given \"random\" operation"));
|
||||||
/*
|
/*
|
||||||
* Randomization seed number (text)
|
* Randomization seed number (text)
|
||||||
*/
|
*/
|
||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
gtk_widget_set_usize (entry, ENTRY_WIDTH, 0);
|
gtk_widget_set_usize (entry, ENTRY_WIDTH, 0);
|
||||||
gtk_box_pack_start(GTK_BOX(seed_hbox), entry, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(seed_hbox), entry, FALSE, FALSE, 0);
|
||||||
sprintf(buffer, "%d", pivals.blur_seed);
|
g_snprintf (buffer, sizeof (buffer), "%d", pivals.blur_seed);
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
||||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||||
(GtkSignalFunc) gpc_text_update, &pivals.blur_seed);
|
(GtkSignalFunc) gpc_text_update,
|
||||||
|
&pivals.blur_seed);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (entry);
|
||||||
gpc_set_tooltip (entry, _("Value for seeding the random number generator"));
|
gpc_set_tooltip (entry, _("Value for seeding the random number generator"));
|
||||||
gtk_widget_show (seed_hbox);
|
gtk_widget_show (seed_hbox);
|
||||||
/*
|
/*
|
||||||
* Randomization percentage label & scale (1 to 100)
|
* Randomization percentage label & scale (1 to 100)
|
||||||
*/
|
*/
|
||||||
gpc_add_label(_("Randomization %:"), table, 0, 1, 2, 3);
|
label = gtk_label_new (_("Randomization %:"));
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||||
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
|
||||||
gpc_add_hscale (table, SCALE_WIDTH,
|
gpc_add_hscale (table, SCALE_WIDTH,
|
||||||
1.0, 100.0, &pivals.blur_pct, 1, 2, 2, 3,
|
1.0, 100.0, &pivals.blur_pct, 1, 2, 2, 3,
|
||||||
_("Percentage of pixels to be filtered"));
|
_("Percentage of pixels to be filtered"));
|
||||||
|
@ -682,7 +719,11 @@ blur_dialog ()
|
||||||
/*
|
/*
|
||||||
* Repeat count label & scale (1 to 100)
|
* Repeat count label & scale (1 to 100)
|
||||||
*/
|
*/
|
||||||
gpc_add_label(_("Repeat:"), table, 0, 1, 3, 4);
|
label = gtk_label_new (_("Repeat:"));
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||||
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
|
||||||
gpc_add_hscale (table, SCALE_WIDTH,
|
gpc_add_hscale (table, SCALE_WIDTH,
|
||||||
1.0, 100.0, &pivals.blur_rcount, 1, 2, 3, 4,
|
1.0, 100.0, &pivals.blur_rcount, 1, 2, 3, 4,
|
||||||
_("Number of times to apply filter"));
|
_("Number of times to apply filter"));
|
||||||
|
@ -695,12 +736,16 @@ blur_dialog ()
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
gdk_flush ();
|
gdk_flush ();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out which type of seed initialization to apply.
|
* Figure out which type of seed initialization to apply.
|
||||||
*/
|
*/
|
||||||
if (do_time) {
|
if (do_time)
|
||||||
|
{
|
||||||
pivals.seed_type = SEED_TIME;
|
pivals.seed_type = SEED_TIME;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
pivals.seed_type = SEED_USER;
|
pivals.seed_type = SEED_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,5 +758,6 @@ blur_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
blur_int.run = TRUE;
|
blur_int.run = TRUE;
|
||||||
|
|
||||||
gtk_widget_destroy (GTK_WIDGET (data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <gtk/gtk.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 "gck/gck.h"
|
||||||
#include "plug-ins/megawidget/megawidget.h"
|
#include "plug-ins/megawidget/megawidget.h"
|
||||||
|
|
||||||
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Declare local functions.
|
/* Declare local functions.
|
||||||
|
@ -37,13 +44,16 @@ static void run (char *name,
|
||||||
int *nreturn_vals,
|
int *nreturn_vals,
|
||||||
GParam **return_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 =
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
|
@ -56,7 +66,8 @@ GPlugInInfo PLUG_IN_INFO =
|
||||||
static gint borderaverage_thickness = 3;
|
static gint borderaverage_thickness = 3;
|
||||||
static gint borderaverage_bucket_exponent = 4;
|
static gint borderaverage_bucket_exponent = 4;
|
||||||
|
|
||||||
struct borderaverage_data {
|
struct borderaverage_data
|
||||||
|
{
|
||||||
gint thickness;
|
gint thickness;
|
||||||
gint bucket_exponent;
|
gint bucket_exponent;
|
||||||
} borderaverage_data = { 3, 4 };
|
} borderaverage_data = { 3, 4 };
|
||||||
|
@ -69,7 +80,7 @@ gchar * menu_labels[] =
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] =
|
static GParamDef args[] =
|
||||||
{
|
{
|
||||||
|
@ -125,7 +136,8 @@ run (char *name,
|
||||||
/* Get the specified drawable */
|
/* Get the specified drawable */
|
||||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||||
|
|
||||||
switch (run_mode) {
|
switch (run_mode)
|
||||||
|
{
|
||||||
case RUN_INTERACTIVE:
|
case RUN_INTERACTIVE:
|
||||||
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
gimp_get_data("plug_in_borderaverage", &borderaverage_data);
|
||||||
borderaverage_thickness = borderaverage_data.thickness;
|
borderaverage_thickness = borderaverage_data.thickness;
|
||||||
|
@ -140,7 +152,6 @@ run (char *name,
|
||||||
if (status == STATUS_SUCCESS)
|
if (status == STATUS_SUCCESS)
|
||||||
borderaverage_thickness = param[3].data.d_int32;
|
borderaverage_thickness = param[3].data.d_int32;
|
||||||
borderaverage_bucket_exponent = param[4].data.d_int32;
|
borderaverage_bucket_exponent = param[4].data.d_int32;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RUN_WITH_LAST_VALS:
|
case RUN_WITH_LAST_VALS:
|
||||||
|
@ -153,21 +164,30 @@ run (char *name,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == STATUS_SUCCESS) {
|
if (status == STATUS_SUCCESS)
|
||||||
|
{
|
||||||
/* Make sure that the drawable is RGB color */
|
/* Make sure that the drawable is RGB color */
|
||||||
if (gimp_drawable_is_rgb (drawable->id)) {
|
if (gimp_drawable_is_rgb (drawable->id))
|
||||||
|
{
|
||||||
gimp_progress_init ("borderaverage");
|
gimp_progress_init ("borderaverage");
|
||||||
borderaverage (drawable, &result_color[0], &result_color[1], &result_color[2]);
|
borderaverage (drawable,
|
||||||
|
&result_color[0], &result_color[1], &result_color[2]);
|
||||||
|
|
||||||
if (run_mode != RUN_NONINTERACTIVE) {
|
if (run_mode != RUN_NONINTERACTIVE)
|
||||||
gimp_palette_set_foreground(result_color[0],result_color[1],result_color[2]);
|
{
|
||||||
|
gimp_palette_set_foreground (result_color[0],
|
||||||
|
result_color[1],
|
||||||
|
result_color[2]);
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
}
|
}
|
||||||
if (run_mode == RUN_INTERACTIVE)
|
if (run_mode == RUN_INTERACTIVE)
|
||||||
borderaverage_data.thickness = borderaverage_thickness;
|
borderaverage_data.thickness = borderaverage_thickness;
|
||||||
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
borderaverage_data.bucket_exponent = borderaverage_bucket_exponent;
|
||||||
gimp_set_data("plug_in_borderaverage", &borderaverage_data, sizeof(borderaverage_data));
|
gimp_set_data ("plug_in_borderaverage",
|
||||||
} else {
|
&borderaverage_data, sizeof (borderaverage_data));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
status = STATUS_EXECUTION_ERROR;
|
status = STATUS_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,29 +229,29 @@ borderaverage (GDrawable *drawable,
|
||||||
|
|
||||||
GPixelRgn myPR;
|
GPixelRgn myPR;
|
||||||
|
|
||||||
|
|
||||||
/* allocate and clear the cube before */
|
/* allocate and clear the cube before */
|
||||||
bucket_expo = borderaverage_bucket_exponent;
|
bucket_expo = borderaverage_bucket_exponent;
|
||||||
bucket_rexpo = 8 - bucket_expo;
|
bucket_rexpo = 8 - bucket_expo;
|
||||||
cube = (gint*) malloc( (1 << (bucket_rexpo * 3)) * sizeof(gint) );
|
cube = g_new (gint, 1 << (bucket_rexpo * 3));
|
||||||
bucket_num = 1 << bucket_rexpo;
|
bucket_num = 1 << bucket_rexpo;
|
||||||
|
|
||||||
for (i = 0; i < bucket_num; i++) {
|
for (i = 0; i < bucket_num; i++)
|
||||||
for (j = 0; j < bucket_num; j++) {
|
{
|
||||||
for (k = 0; k < bucket_num; k++) {
|
for (j = 0; j < bucket_num; j++)
|
||||||
|
{
|
||||||
|
for (k = 0; k < bucket_num; k++)
|
||||||
|
{
|
||||||
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Get the input area. This is the bounding box of the selection in
|
/* 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
|
* the image (or the entire image if there is no selection). Only
|
||||||
* operating on the input area is simply an optimization. It doesn't
|
* operating on the input area is simply an optimization. It doesn't
|
||||||
* need to be done for correct operation. (It simply makes it go
|
* need to be done for correct operation. (It simply makes it go
|
||||||
* faster, since fewer pixels need to be operated on).
|
* faster, since fewer pixels need to be operated on).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
||||||
|
|
||||||
/* Get the size of the input image. (This will/must be the same
|
/* Get the size of the input image. (This will/must be the same
|
||||||
|
@ -242,35 +262,40 @@ borderaverage (GDrawable *drawable,
|
||||||
bytes = drawable->bpp;
|
bytes = drawable->bpp;
|
||||||
|
|
||||||
/* allocate row buffer */
|
/* allocate row buffer */
|
||||||
buffer = (guchar *) malloc ((x2 - x1) * bytes);
|
buffer = g_new (guchar, (x2 - x1) * bytes);
|
||||||
|
|
||||||
/* initialize the pixel regions */
|
/* initialize the pixel regions */
|
||||||
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
gimp_pixel_rgn_init (&myPR, drawable, 0, 0, width, height, FALSE, FALSE);
|
||||||
|
|
||||||
/* loop through the rows, performing our magic*/
|
/* loop through the rows, performing our magic*/
|
||||||
for (row = y1; row < y2; row++) {
|
for (row = y1; row < y2; row++)
|
||||||
|
{
|
||||||
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
gimp_pixel_rgn_get_row (&myPR, buffer, x1, row, (x2-x1));
|
||||||
|
|
||||||
if (row < y1 + borderaverage_thickness ||
|
if (row < y1 + borderaverage_thickness ||
|
||||||
row >= y2 - borderaverage_thickness) {
|
row >= y2 - borderaverage_thickness)
|
||||||
|
{
|
||||||
/* add the whole row */
|
/* add the whole row */
|
||||||
for (col = 0; col < ((x2 - x1) * bytes); col += bytes) {
|
for (col = 0; col < ((x2 - x1) * bytes); col += bytes)
|
||||||
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* add the left border */
|
/* add the left border */
|
||||||
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes) {
|
for (col = 0; col < (borderaverage_thickness * bytes); col += bytes)
|
||||||
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
/* add the right border */
|
/* add the right border */
|
||||||
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
for (col = ((x2 - x1 - borderaverage_thickness) * bytes);
|
||||||
col < ((x2 - x1) * bytes); col += bytes) {
|
col < ((x2 - x1) * bytes); col += bytes)
|
||||||
|
{
|
||||||
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
add_new_color (bytes, &buffer[col], cube, bucket_expo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((row % 5) == 0)
|
if ((row % 5) == 0)
|
||||||
gimp_progress_update ((double) row / (double) (y2 - y1));
|
gimp_progress_update ((double) row / (double) (y2 - y1));
|
||||||
}
|
}
|
||||||
|
@ -278,11 +303,17 @@ borderaverage (GDrawable *drawable,
|
||||||
max = 0; r = 0; g = 0; b = 0;
|
max = 0; r = 0; g = 0; b = 0;
|
||||||
|
|
||||||
/* get max of cube */
|
/* get max of cube */
|
||||||
for (i = 0; i < bucket_num; i++) {
|
for (i = 0; i < bucket_num; i++)
|
||||||
for (j = 0; j < bucket_num; j++) {
|
{
|
||||||
for (k = 0; k < bucket_num; k++) {
|
for (j = 0; j < bucket_num; j++)
|
||||||
if (cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k] > max) {
|
{
|
||||||
max = cube[(i << (bucket_rexpo << 1)) + (j << bucket_rexpo) + k];
|
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));
|
r = (i<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
g = (j<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
b = (k<<bucket_expo) + (1<<(bucket_expo - 1));
|
||||||
|
@ -296,10 +327,10 @@ borderaverage (GDrawable *drawable,
|
||||||
*res_g = g;
|
*res_g = g;
|
||||||
*res_b = b;
|
*res_b = b;
|
||||||
|
|
||||||
free (buffer);
|
g_free (buffer);
|
||||||
|
g_free (cube);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_new_color (gint bytes,
|
add_new_color (gint bytes,
|
||||||
guchar *buffer,
|
guchar *buffer,
|
||||||
|
@ -311,25 +342,44 @@ add_new_color (gint bytes,
|
||||||
|
|
||||||
bucket_rexpo = 8 - bucket_expo;
|
bucket_rexpo = 8 - bucket_expo;
|
||||||
r = buffer[0] >>bucket_expo;
|
r = buffer[0] >>bucket_expo;
|
||||||
if (bytes > 1) {
|
if (bytes > 1)
|
||||||
|
{
|
||||||
g = buffer[1] >>bucket_expo;
|
g = buffer[1] >>bucket_expo;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
g = 0;
|
g = 0;
|
||||||
}
|
}
|
||||||
if (bytes > 2) {
|
if (bytes > 2)
|
||||||
|
{
|
||||||
b = buffer[2] >>bucket_expo;
|
b = buffer[2] >>bucket_expo;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
b = 0;
|
b = 0;
|
||||||
}
|
}
|
||||||
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
cube[(r << (bucket_rexpo << 1)) + (g << bucket_rexpo) + b]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gboolean run_flag = FALSE;
|
||||||
borderaverage_dialog ()
|
|
||||||
|
static void
|
||||||
|
borderaverage_ok_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg, *frame, *vbox2;
|
run_flag = TRUE;
|
||||||
GtkWidget *vbox, *menu;
|
|
||||||
gint runp;
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
borderaverage_dialog (void)
|
||||||
|
{
|
||||||
|
GtkWidget *dlg;
|
||||||
|
GtkWidget *frame;
|
||||||
|
GtkWidget *vbox2;
|
||||||
|
GtkWidget *vbox;
|
||||||
|
GtkWidget *menu;
|
||||||
gchar **argv;
|
gchar **argv;
|
||||||
gint argc;
|
gint argc;
|
||||||
|
|
||||||
|
@ -337,40 +387,58 @@ borderaverage_dialog ()
|
||||||
argc = 1;
|
argc = 1;
|
||||||
argv = g_new (gchar *, 1);
|
argv = g_new (gchar *, 1);
|
||||||
argv[0] = g_strdup ("borderaverage");
|
argv[0] = g_strdup ("borderaverage");
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
gtk_rc_parse (gimp_gtkrc ());
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
|
||||||
dlg = mw_app_new("plug_in_borderaverage", _("Borderaverage"), &runp);
|
dlg = gimp_dialog_new (_("Borderaverage"), "borderaverage",
|
||||||
|
gimp_plugin_help_func, "filters/borderaverage.html",
|
||||||
|
GTK_WIN_POS_MOUSE,
|
||||||
|
FALSE, TRUE, FALSE,
|
||||||
|
|
||||||
vbox = gtk_vbox_new(FALSE, 0);
|
_("OK"), borderaverage_ok_callback,
|
||||||
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
|
NULL, NULL, NULL, TRUE, FALSE,
|
||||||
|
_("Cancel"), gtk_widget_destroy,
|
||||||
|
NULL, 1, NULL, FALSE, TRUE,
|
||||||
|
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
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_box_pack_start (GTK_BOX (GTK_DIALOG(dlg)->vbox), vbox, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
mw_ientry_new(vbox, _("Border Size"), _("Thickness"), &borderaverage_thickness);
|
mw_ientry_new (vbox, _("Border Size"), _("Thickness:"),
|
||||||
|
&borderaverage_thickness);
|
||||||
|
|
||||||
|
frame = gtk_frame_new (_("Number of Colors"));
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
frame=gck_frame_new(_("Number of colors"),vbox,GTK_SHADOW_ETCHED_IN,FALSE,FALSE,0,2);
|
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||||
vbox2=gck_vbox_new(frame,FALSE,TRUE,TRUE,5,0,5);
|
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 = gck_option_menu_new (_("Bucket Size:"), vbox2, TRUE, TRUE, 0,
|
||||||
menu_labels,(GtkSignalFunc)menu_callback, NULL);
|
menu_labels,
|
||||||
gtk_option_menu_set_history(GTK_OPTION_MENU(menu),borderaverage_bucket_exponent);
|
(GtkSignalFunc) menu_callback, NULL);
|
||||||
|
|
||||||
|
gtk_option_menu_set_history (GTK_OPTION_MENU (menu),
|
||||||
|
borderaverage_bucket_exponent);
|
||||||
gtk_widget_show (menu);
|
gtk_widget_show (menu);
|
||||||
|
|
||||||
gtk_widget_show (dlg);
|
gtk_widget_show (dlg);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
gdk_flush ();
|
gdk_flush ();
|
||||||
|
|
||||||
if (runp)
|
return run_flag;
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void menu_callback (GtkWidget *widget,
|
void menu_callback (GtkWidget *widget,
|
||||||
gpointer client_data)
|
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,33 +28,36 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include <libgimp/gimp.h>
|
||||||
#include "libgimp/gimpui.h"
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
#define PRV_WIDTH 40
|
#define PRV_WIDTH 40
|
||||||
#define PRV_HEIGHT 20
|
#define PRV_HEIGHT 20
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
guchar color[3];
|
guchar color[3];
|
||||||
} C2AValues;
|
} C2AValues;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
gint run;
|
gint run;
|
||||||
} C2AInterface;
|
} C2AInterface;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
GtkWidget *color_button;
|
GtkWidget *color_button;
|
||||||
} C2APreview;
|
} C2APreview;
|
||||||
|
|
||||||
/* Declare local functions.
|
/* Declare local functions.
|
||||||
*/
|
*/
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (char *name,
|
static void run (gchar *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals);
|
GParam **return_vals);
|
||||||
|
|
||||||
static void toalpha (GDrawable *drawable);
|
static void toalpha (GDrawable *drawable);
|
||||||
|
@ -65,8 +68,8 @@ static void toalpha_render_row (const guchar *src_row,
|
||||||
const gint bytes);
|
const gint bytes);
|
||||||
/* UI stuff */
|
/* UI stuff */
|
||||||
static gint colortoalpha_dialog (GDrawable *drawable);
|
static gint colortoalpha_dialog (GDrawable *drawable);
|
||||||
static void C2A_close_callback (GtkWidget *widget, gpointer data);
|
static void colortoalpha_ok_callback (GtkWidget *widget,
|
||||||
static void C2A_ok_callback (GtkWidget *widget, gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static GRunModeType run_mode;
|
static GRunModeType run_mode;
|
||||||
|
|
||||||
|
@ -96,7 +99,7 @@ static C2APreview ppreview =
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] =
|
static GParamDef args[] =
|
||||||
{
|
{
|
||||||
|
@ -125,10 +128,10 @@ query ()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run (char *name,
|
run (gchar *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals)
|
GParam **return_vals)
|
||||||
{
|
{
|
||||||
static GParam values[1];
|
static GParam values[1];
|
||||||
|
@ -316,7 +319,8 @@ toalpha_render_region (const GPixelRgn srcPR,
|
||||||
|
|
||||||
for (row = 0; row < srcPR.h ; row++)
|
for (row = 0; row < srcPR.h ; row++)
|
||||||
{
|
{
|
||||||
if (srcPR.bpp!=4) {
|
if (srcPR.bpp!=4)
|
||||||
|
{
|
||||||
gimp_message ("Not the proper bpp! \n");
|
gimp_message ("Not the proper bpp! \n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -410,7 +414,7 @@ colortoalpha_dialog (GDrawable *drawable)
|
||||||
GTK_WIN_POS_MOUSE,
|
GTK_WIN_POS_MOUSE,
|
||||||
FALSE, TRUE, FALSE,
|
FALSE, TRUE, FALSE,
|
||||||
|
|
||||||
_("OK"), C2A_ok_callback,
|
_("OK"), colortoalpha_ok_callback,
|
||||||
NULL, NULL, NULL, TRUE, FALSE,
|
NULL, NULL, NULL, TRUE, FALSE,
|
||||||
_("Cancel"), gtk_widget_destroy,
|
_("Cancel"), gtk_widget_destroy,
|
||||||
NULL, 1, NULL, FALSE, TRUE,
|
NULL, 1, NULL, FALSE, TRUE,
|
||||||
|
@ -418,11 +422,14 @@ colortoalpha_dialog (GDrawable *drawable)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
GTK_SIGNAL_FUNC (C2A_close_callback),
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
table = gtk_table_new (1, 3, FALSE);
|
table = gtk_table_new (1, 3, FALSE);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
|
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:"));
|
label = gtk_label_new (_("From:"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||||
|
@ -437,14 +444,11 @@ colortoalpha_dialog (GDrawable *drawable)
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
ppreview.color_button = button;
|
ppreview.color_button = button;
|
||||||
|
|
||||||
label = gtk_label_new (_("to alpha"));
|
label = gtk_label_new (_("to Alpha"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||||
gtk_table_attach_defaults (GTK_TABLE(table), label, 2, 3, 0, 1);
|
gtk_table_attach_defaults (GTK_TABLE(table), label, 2, 3, 0, 1);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), table, TRUE, TRUE, 0);
|
|
||||||
gtk_widget_show (table);
|
|
||||||
|
|
||||||
gtk_widget_show (dlg);
|
gtk_widget_show (dlg);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
@ -453,18 +457,11 @@ colortoalpha_dialog (GDrawable *drawable)
|
||||||
return pint.run;
|
return pint.run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
C2A_close_callback (GtkWidget *widget,
|
colortoalpha_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
gtk_main_quit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
C2A_ok_callback (GtkWidget *widget,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
pint.run = TRUE;
|
pint.run = TRUE;
|
||||||
|
|
||||||
gtk_widget_destroy (GTK_WIDGET (data));
|
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 <gtk/gtk.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include <libgimp/gimp.h>
|
||||||
#include "libgimp/gimpui.h"
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
/* Declare local functions
|
/* Declare local functions
|
||||||
|
@ -98,8 +99,6 @@ static gint check_gray (gint32 image_id,
|
||||||
static void image_menu_callback (gint32 id,
|
static void image_menu_callback (gint32 id,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
static void compose_close_callback (GtkWidget *widget,
|
|
||||||
gpointer data);
|
|
||||||
static void compose_ok_callback (GtkWidget *widget,
|
static void compose_ok_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void compose_type_toggle_update (GtkWidget *widget,
|
static void compose_type_toggle_update (GtkWidget *widget,
|
||||||
|
@ -813,23 +812,22 @@ compose_dialog (char *compose_type,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
GTK_SIGNAL_FUNC (compose_close_callback),
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* parameter settings */
|
/* parameter settings */
|
||||||
hbox = gtk_hbox_new (FALSE, 0);
|
hbox = gtk_hbox_new (FALSE, 6);
|
||||||
gtk_container_set_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_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
/* The left frame keeps the compose type toggles */
|
/* 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_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, FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), left_frame, TRUE, TRUE, 0);
|
|
||||||
|
|
||||||
left_vbox = gtk_vbox_new (FALSE, 5);
|
left_vbox = gtk_vbox_new (FALSE, 2);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (left_vbox), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (left_vbox), 4);
|
||||||
gtk_container_add (GTK_CONTAINER (left_frame), left_vbox);
|
gtk_container_add (GTK_CONTAINER (left_frame), left_vbox);
|
||||||
|
|
||||||
/* The right frame keeps the selection menues for images. */
|
/* The right frame keeps the selection menues for images. */
|
||||||
|
@ -837,18 +835,17 @@ compose_dialog (char *compose_type,
|
||||||
/* in the left frame is changed, fill in the right part first. */
|
/* in the left frame is changed, fill in the right part first. */
|
||||||
/* Otherwise it can occur, that a non-existing label might be changed. */
|
/* 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_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);
|
gtk_box_pack_start (GTK_BOX (hbox), right_frame, TRUE, TRUE, 0);
|
||||||
|
|
||||||
right_vbox = gtk_vbox_new (FALSE, 5);
|
right_vbox = gtk_vbox_new (FALSE, 0);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (right_vbox), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (right_vbox), 4);
|
||||||
gtk_container_add (GTK_CONTAINER (right_frame), right_vbox);
|
gtk_container_add (GTK_CONTAINER (right_frame), right_vbox);
|
||||||
|
|
||||||
table = gtk_table_new (MAX_COMPOSE_IMAGES, 3, FALSE);
|
table = gtk_table_new (MAX_COMPOSE_IMAGES, 2, FALSE);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
gtk_box_pack_start (GTK_BOX (right_vbox), table, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (right_vbox), table, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
|
@ -857,8 +854,8 @@ compose_dialog (char *compose_type,
|
||||||
{
|
{
|
||||||
composeint.channel_label[j] = label =
|
composeint.channel_label[j] = label =
|
||||||
gtk_label_new (gettext (compose_dsc[compose_idx].channel_name[j]));
|
gtk_label_new (gettext (compose_dsc[compose_idx].channel_name[j]));
|
||||||
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, 1, 2, j, j+1,
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, j, j+1,
|
||||||
GTK_FILL, GTK_FILL, 0, 0);
|
GTK_FILL, GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
}
|
}
|
||||||
|
@ -873,8 +870,9 @@ compose_dialog (char *compose_type,
|
||||||
composeint.select_ID[j] = drawable_ID;
|
composeint.select_ID[j] = drawable_ID;
|
||||||
composeint.channel_menu[j] = image_option_menu = gtk_option_menu_new ();
|
composeint.channel_menu[j] = image_option_menu = gtk_option_menu_new ();
|
||||||
image_menu = gimp_drawable_menu_new (check_gray, image_menu_callback,
|
image_menu = gimp_drawable_menu_new (check_gray, image_menu_callback,
|
||||||
&(composeint.select_ID[j]), composeint.select_ID[j]);
|
&(composeint.select_ID[j]),
|
||||||
gtk_table_attach (GTK_TABLE (table), image_option_menu, 2, 3, j, j+1,
|
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_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||||
|
|
||||||
gtk_widget_show (image_option_menu);
|
gtk_widget_show (image_option_menu);
|
||||||
|
@ -1020,18 +1018,11 @@ image_menu_callback (gint32 id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
compose_close_callback (GtkWidget *widget,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
gtk_main_quit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compose_ok_callback (GtkWidget *widget,
|
compose_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{int j;
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
composeint.run = TRUE;
|
composeint.run = TRUE;
|
||||||
gtk_widget_destroy (GTK_WIDGET (data));
|
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 <gtk/gtk.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include <libgimp/gimp.h>
|
||||||
#include "libgimp/gimpui.h"
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.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 gint decompose_dialog (void);
|
||||||
|
|
||||||
static void decompose_close_callback (GtkWidget *widget,
|
|
||||||
gpointer data);
|
|
||||||
static void decompose_ok_callback (GtkWidget *widget,
|
static void decompose_ok_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void decompose_toggle_update (GtkWidget *widget,
|
static void decompose_toggle_update (GtkWidget *widget,
|
||||||
|
@ -190,7 +188,7 @@ static GRunModeType run_mode;
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] =
|
static GParamDef args[] =
|
||||||
{
|
{
|
||||||
|
@ -230,12 +228,13 @@ query ()
|
||||||
args, return_vals);
|
args, return_vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_message (const char *message)
|
static void
|
||||||
|
show_message (const char *message)
|
||||||
{
|
{
|
||||||
if (run_mode == RUN_INTERACTIVE)
|
if (run_mode == RUN_INTERACTIVE)
|
||||||
gimp_message (message);
|
gimp_message (message);
|
||||||
else
|
else
|
||||||
printf ("%s\n", message);
|
g_print ("%s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -990,17 +989,17 @@ decompose_dialog (void)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
GTK_SIGNAL_FUNC (decompose_close_callback),
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* parameter settings */
|
/* parameter settings */
|
||||||
frame = gtk_frame_new (_("Extract channels:"));
|
frame = gtk_frame_new (_("Extract channels:"));
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
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);
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 5);
|
vbox = gtk_vbox_new (FALSE, 2);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
|
|
||||||
group = NULL;
|
group = NULL;
|
||||||
|
@ -1013,7 +1012,7 @@ decompose_dialog (void)
|
||||||
decoint.extract_flag[j] =
|
decoint.extract_flag[j] =
|
||||||
(cmp_icase (decovals.extract_type, extract[j].type) == 0);
|
(cmp_icase (decovals.extract_type, extract[j].type) == 0);
|
||||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||||
(GtkSignalFunc) decompose_toggle_update,
|
GTK_SIGNAL_FUNC (decompose_toggle_update),
|
||||||
&(decoint.extract_flag[j]));
|
&(decoint.extract_flag[j]));
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||||
decoint.extract_flag[j]);
|
decoint.extract_flag[j]);
|
||||||
|
@ -1029,20 +1028,11 @@ decompose_dialog (void)
|
||||||
return decoint.run;
|
return decoint.run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Decompose interface functions */
|
|
||||||
|
|
||||||
static void
|
|
||||||
decompose_close_callback (GtkWidget *widget,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
gtk_main_quit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
decompose_ok_callback (GtkWidget *widget,
|
decompose_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{int j;
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
decoint.run = TRUE;
|
decoint.run = TRUE;
|
||||||
gtk_widget_destroy (GTK_WIDGET (data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
|
|
|
@ -108,7 +108,7 @@ static BlurInterface bint =
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] =
|
static GParamDef args[] =
|
||||||
{
|
{
|
||||||
|
@ -282,14 +282,15 @@ gauss_iir_dialog (void)
|
||||||
/* parameter settings */
|
/* 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_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_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);
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
|
|
||||||
toggle = gtk_check_button_new_with_label (_("Blur Horizontally"));
|
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",
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||||
(GtkSignalFunc) gauss_toggle_update,
|
(GtkSignalFunc) gauss_toggle_update,
|
||||||
&bvals.horizontal);
|
&bvals.horizontal);
|
||||||
|
@ -297,18 +298,18 @@ gauss_iir_dialog (void)
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
toggle = gtk_check_button_new_with_label (_("Blur Vertically"));
|
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",
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||||
(GtkSignalFunc) gauss_toggle_update,
|
(GtkSignalFunc) gauss_toggle_update,
|
||||||
&bvals.vertical);
|
&bvals.vertical);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
|
||||||
gtk_widget_show (toggle);
|
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);
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||||
|
|
||||||
label = gtk_label_new (_("Blur Radius:"));
|
label = gtk_label_new (_("Blur Radius:"));
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include <libgimp/gimp.h>
|
||||||
#include "libgimp/gimpui.h"
|
#include <libgimp/gimpui.h>
|
||||||
|
#include <libgimp/gimpmath.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
@ -279,33 +279,34 @@ gauss_rle_dialog (void)
|
||||||
/* parameter settings */
|
/* 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_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_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);
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
|
|
||||||
toggle = gtk_check_button_new_with_label (_("Blur Horizontally"));
|
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",
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||||
(GtkSignalFunc) gauss_toggle_update,
|
GTK_SIGNAL_FUNC (gauss_toggle_update),
|
||||||
&bvals.horizontal);
|
&bvals.horizontal);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.horizontal);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.horizontal);
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
toggle = gtk_check_button_new_with_label (_("Blur Vertically"));
|
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",
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||||
(GtkSignalFunc) gauss_toggle_update,
|
GTK_SIGNAL_FUNC (gauss_toggle_update),
|
||||||
&bvals.vertical);
|
&bvals.vertical);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), bvals.vertical);
|
||||||
gtk_widget_show (toggle);
|
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);
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||||
|
|
||||||
label = gtk_label_new (_("Blur Radius:"));
|
label = gtk_label_new (_("Blur Radius:"));
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
entry = gtk_entry_new ();
|
entry = gtk_entry_new ();
|
||||||
|
@ -314,7 +315,7 @@ gauss_rle_dialog (void)
|
||||||
g_snprintf (buffer, sizeof (buffer), "%f", bvals.radius);
|
g_snprintf (buffer, sizeof (buffer), "%f", bvals.radius);
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
||||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||||
(GtkSignalFunc) gauss_entry_callback,
|
GTK_SIGNAL_FUNC (gauss_entry_callback),
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (entry);
|
||||||
|
|
||||||
|
|
|
@ -59,21 +59,24 @@ typedef struct
|
||||||
|
|
||||||
PluginValues plvals =
|
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
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
gint run_flag = FALSE;
|
gint run_flag = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/* Declare some local functions.
|
/* Declare some local functions.
|
||||||
*/
|
*/
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (char *name,
|
static void run (char *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals);
|
GParam **return_vals);
|
||||||
|
|
||||||
GPlugInInfo PLUG_IN_INFO =
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
|
@ -91,6 +94,7 @@ static void add_color_button (int csel_index,
|
||||||
int left,
|
int left,
|
||||||
int top,
|
int top,
|
||||||
GtkWidget *table);
|
GtkWidget *table);
|
||||||
|
|
||||||
static void color_mapping (GDrawable *drawable);
|
static void color_mapping (GDrawable *drawable);
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,10 +110,8 @@ static char *csel_title[4] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query (void)
|
query (void)
|
||||||
|
|
||||||
|
@ -168,10 +170,10 @@ Other colors are mapped by interpolation."),
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run (char *name,
|
run (gchar *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals)
|
GParam **return_vals)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -261,7 +263,8 @@ run (char *name,
|
||||||
c = &(plvals.colors[1][0]); /* Second source color */
|
c = &(plvals.colors[1][0]); /* Second source color */
|
||||||
gimp_palette_get_background (c, c+1, c+2);
|
gimp_palette_get_background (c, c+1, c+2);
|
||||||
|
|
||||||
if (!dialog ()) break;
|
if (!dialog ())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (run_mode == RUN_WITH_LAST_VALS)
|
else if (run_mode == RUN_WITH_LAST_VALS)
|
||||||
{
|
{
|
||||||
|
@ -294,9 +297,8 @@ run (char *name,
|
||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
dialog ()
|
dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg;
|
GtkWidget *dlg;
|
||||||
GtkWidget *hbox;
|
GtkWidget *hbox;
|
||||||
|
@ -319,6 +321,7 @@ dialog ()
|
||||||
color_cube = gimp_color_cube ();
|
color_cube = gimp_color_cube ();
|
||||||
gtk_preview_set_color_cube (color_cube[0], color_cube[1],
|
gtk_preview_set_color_cube (color_cube[0], color_cube[1],
|
||||||
color_cube[2], color_cube[3]);
|
color_cube[2], color_cube[3]);
|
||||||
|
|
||||||
gtk_widget_set_default_visual (gtk_preview_get_visual ());
|
gtk_widget_set_default_visual (gtk_preview_get_visual ());
|
||||||
gtk_widget_set_default_colormap (gtk_preview_get_cmap ());
|
gtk_widget_set_default_colormap (gtk_preview_get_cmap ());
|
||||||
|
|
||||||
|
@ -339,21 +342,22 @@ dialog ()
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
hbox = gtk_hbox_new (FALSE, 0);
|
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_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
/* The table keeps the color selections */
|
/* The table keeps the color selections */
|
||||||
table = gtk_table_new (4, 2, FALSE);
|
table = gtk_table_new (2, 4, FALSE);
|
||||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
|
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_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
add_color_button (0, 0, 1, table);
|
add_color_button (0, 0, 0, table);
|
||||||
add_color_button (1, 0, 2, table);
|
add_color_button (1, 2, 0, table);
|
||||||
add_color_button (2, 2, 1, table);
|
add_color_button (2, 0, 1, table);
|
||||||
add_color_button (3, 2, 2, table);
|
add_color_button (3, 2, 1, table);
|
||||||
|
|
||||||
gtk_widget_show (dlg);
|
gtk_widget_show (dlg);
|
||||||
|
|
||||||
|
@ -363,43 +367,30 @@ dialog ()
|
||||||
return run_flag;
|
return run_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
add_color_button (int csel_index,
|
add_color_button (gint csel_index,
|
||||||
int left,
|
gint left,
|
||||||
int top,
|
gint top,
|
||||||
GtkWidget *table)
|
GtkWidget *table)
|
||||||
|
|
||||||
{
|
{
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *hbox;
|
|
||||||
|
|
||||||
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:"));
|
label = gtk_label_new ((left == 0) ? _("From:") : _("To:"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
gtk_table_attach (GTK_TABLE (table), label, left, left+1, top, top+1,
|
||||||
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);
|
GTK_FILL, GTK_FILL, 0, 0);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
|
||||||
button = gimp_color_button_new (gettext (csel_title[csel_index]),
|
button = gimp_color_button_new (gettext (csel_title[csel_index]),
|
||||||
PRV_WIDTH, PRV_HEIGHT,
|
PRV_WIDTH, PRV_HEIGHT,
|
||||||
plvals.colors[csel_index], 3);
|
plvals.colors[csel_index], 3);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
gtk_table_attach (GTK_TABLE (table), button, left+1, left+2, top, top+1,
|
||||||
|
GTK_FILL, GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gtk_widget_show (hbox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mapcolor_ok_callback (GtkWidget *widget,
|
mapcolor_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -411,7 +402,6 @@ mapcolor_ok_callback (GtkWidget *widget,
|
||||||
gtk_widget_destroy (GTK_WIDGET (data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_mapping (guchar *src_col1,
|
get_mapping (guchar *src_col1,
|
||||||
guchar *src_col2,
|
guchar *src_col2,
|
||||||
|
@ -451,7 +441,6 @@ get_mapping (guchar *src_col1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
color_mapping (GDrawable *drawable)
|
color_mapping (GDrawable *drawable)
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include <libgimp/gimp.h>
|
||||||
#include "libgimp/gimpui.h"
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
@ -45,24 +45,21 @@
|
||||||
#define OK_CALLBACK _max_rgbok_callback
|
#define OK_CALLBACK _max_rgbok_callback
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (char *name,
|
static void run (gchar *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals);
|
GParam **return_vals);
|
||||||
static GStatusType MAIN_FUNCTION (gint32 drawable_id);
|
static GStatusType MAIN_FUNCTION (gint32 drawable_id);
|
||||||
static gint DIALOG ();
|
static gint DIALOG ();
|
||||||
|
|
||||||
static void
|
static void OK_CALLBACK (GtkWidget *widget, gpointer data);
|
||||||
OK_CALLBACK (GtkWidget *widget, gpointer data);
|
|
||||||
|
|
||||||
/* gtkWrapper functions */
|
/* gtkWrapper functions */
|
||||||
#define PROGRESS_UPDATE_NUM 100
|
#define PROGRESS_UPDATE_NUM 100
|
||||||
#define ENTRY_WIDTH 100
|
#define ENTRY_WIDTH 100
|
||||||
#define SCALE_WIDTH 100
|
#define SCALE_WIDTH 100
|
||||||
static void
|
static void
|
||||||
gtkW_close_callback (GtkWidget *widget, gpointer data);
|
|
||||||
static void
|
|
||||||
gtkW_toggle_update (GtkWidget *widget, gpointer data);
|
gtkW_toggle_update (GtkWidget *widget, gpointer data);
|
||||||
static GSList *
|
static GSList *
|
||||||
gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
||||||
|
@ -70,14 +67,6 @@ gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
||||||
GSList *group,
|
GSList *group,
|
||||||
GtkSignalFunc update,
|
GtkSignalFunc update,
|
||||||
gint *value);
|
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 =
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
|
@ -110,7 +99,7 @@ gint hold_min;
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args [] =
|
static GParamDef args [] =
|
||||||
{
|
{
|
||||||
|
@ -266,7 +255,6 @@ static int
|
||||||
DIALOG ()
|
DIALOG ()
|
||||||
{
|
{
|
||||||
GtkWidget *dlg;
|
GtkWidget *dlg;
|
||||||
GtkWidget *hbox;
|
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GSList *group = NULL;
|
GSList *group = NULL;
|
||||||
|
@ -276,6 +264,7 @@ DIALOG ()
|
||||||
argc = 1;
|
argc = 1;
|
||||||
argv = g_new (gchar *, 1);
|
argv = g_new (gchar *, 1);
|
||||||
argv[0] = g_strdup (PLUG_IN_NAME);
|
argv[0] = g_strdup (PLUG_IN_NAME);
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
gtk_rc_parse (gimp_gtkrc ());
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
|
||||||
|
@ -292,22 +281,25 @@ DIALOG ()
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
GTK_SIGNAL_FUNC (gtkW_close_callback),
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
hbox = gtkW_hbox_new ((GTK_DIALOG (dlg)->vbox));
|
frame = gtk_frame_new (_("Parameter Settings"));
|
||||||
frame = gtkW_frame_new (hbox, _("Parameter Settings"));
|
gtk_container_set_border_width (GTK_CONTAINER (frame), 6);
|
||||||
/*
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), frame);
|
||||||
table = gtkW_table_new (frame, 2, 2);
|
gtk_widget_show (frame);
|
||||||
gtkW_table_add_toggle (table, "Hold the maximal channel", 0, 2, 1,
|
|
||||||
(GtkSignalFunc) gtkW_toggle_update, &VALS.max_p);
|
vbox = gtk_vbox_new (FALSE, 2);
|
||||||
gtk_widget_show (table);
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||||
*/
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
vbox = gtkW_vbox_new (frame);
|
gtk_widget_show (vbox);
|
||||||
group = gtkW_vbox_add_radio_button (vbox, _("Hold the maximal channels"), group,
|
|
||||||
|
group =
|
||||||
|
gtkW_vbox_add_radio_button (vbox, _("Hold the Maximal Channels"), group,
|
||||||
(GtkSignalFunc) gtkW_toggle_update,
|
(GtkSignalFunc) gtkW_toggle_update,
|
||||||
&hold_max);
|
&hold_max);
|
||||||
group = gtkW_vbox_add_radio_button (vbox, _("Hold the minimal channels"), group,
|
group =
|
||||||
|
gtkW_vbox_add_radio_button (vbox, _("Hold the Minimal Channels"), group,
|
||||||
(GtkSignalFunc) gtkW_toggle_update,
|
(GtkSignalFunc) gtkW_toggle_update,
|
||||||
&hold_min);
|
&hold_min);
|
||||||
|
|
||||||
|
@ -331,13 +323,6 @@ OK_CALLBACK (GtkWidget *widget,
|
||||||
|
|
||||||
/* VFtext interface functions */
|
/* VFtext interface functions */
|
||||||
|
|
||||||
static void
|
|
||||||
gtkW_close_callback (GtkWidget *widget,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
gtk_main_quit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtkW_toggle_update (GtkWidget *widget,
|
gtkW_toggle_update (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -352,76 +337,6 @@ gtkW_toggle_update (GtkWidget *widget,
|
||||||
*toggle_val = FALSE;
|
*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 *
|
static GSList *
|
||||||
gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
||||||
gchar *name,
|
gchar *name,
|
||||||
|
@ -440,4 +355,3 @@ gtkW_vbox_add_radio_button (GtkWidget *vbox,
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
/* end of max_rgb.c */
|
|
||||||
|
|
|
@ -68,13 +68,15 @@
|
||||||
|
|
||||||
#define MBLUR_MAX MBLUR_ZOOM
|
#define MBLUR_MAX MBLUR_ZOOM
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
gint32 mblur_type;
|
gint32 mblur_type;
|
||||||
gint32 length;
|
gint32 length;
|
||||||
gint32 angle;
|
gint32 angle;
|
||||||
} mblur_vals_t;
|
} mblur_vals_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
gint col, row;
|
gint col, row;
|
||||||
gint img_width, img_height, img_bpp, img_has_alpha;
|
gint img_width, img_height, img_bpp, img_has_alpha;
|
||||||
gint tile_width, tile_height;
|
gint tile_width, tile_height;
|
||||||
|
@ -86,15 +88,18 @@ typedef struct {
|
||||||
/***** Prototypes *****/
|
/***** Prototypes *****/
|
||||||
|
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run(char *name,
|
static void run (gchar *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals);
|
GParam **return_vals);
|
||||||
|
|
||||||
static pixel_fetcher_t *pixel_fetcher_new (GDrawable *drawable);
|
static pixel_fetcher_t *pixel_fetcher_new (GDrawable *drawable);
|
||||||
static void pixel_fetcher_set_bg_color(pixel_fetcher_t *pf, guchar r, guchar g, guchar b, guchar a);
|
static void pixel_fetcher_set_bg_color (pixel_fetcher_t *pf,
|
||||||
static void pixel_fetcher_get_pixel(pixel_fetcher_t *pf, int x, int y, guchar *pixel);
|
guchar r, guchar g,
|
||||||
|
guchar b, guchar a);
|
||||||
|
static void pixel_fetcher_get_pixel (pixel_fetcher_t *pf,
|
||||||
|
int x, int y, guchar *pixel);
|
||||||
static void pixel_fetcher_destroy (pixel_fetcher_t *pf);
|
static void pixel_fetcher_destroy (pixel_fetcher_t *pf);
|
||||||
|
|
||||||
static void mblur (void);
|
static void mblur (void);
|
||||||
|
@ -107,20 +112,23 @@ static void dialog_scale_update(GtkAdjustment *, gint32 *);
|
||||||
static void dialog_toggle_update (GtkWidget *, gint32);
|
static void dialog_toggle_update (GtkWidget *, gint32);
|
||||||
|
|
||||||
static gboolean mblur_dialog (void);
|
static gboolean mblur_dialog (void);
|
||||||
|
|
||||||
/***** Variables *****/
|
/***** Variables *****/
|
||||||
|
|
||||||
GPlugInInfo PLUG_IN_INFO = {
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
NULL, /* quit_proc */
|
NULL, /* quit_proc */
|
||||||
query, /* query_proc */
|
query, /* query_proc */
|
||||||
run /* run_proc */
|
run /* run_proc */
|
||||||
}; /* PLUG_IN_INFO */
|
};
|
||||||
|
|
||||||
static mblur_vals_t mbvals = {
|
static mblur_vals_t mbvals =
|
||||||
|
{
|
||||||
MBLUR_LINEAR, /* mblur_type */
|
MBLUR_LINEAR, /* mblur_type */
|
||||||
5, /* length */
|
5, /* length */
|
||||||
45 /* radius */
|
45 /* radius */
|
||||||
}; /* mb_vals */
|
};
|
||||||
|
|
||||||
static gboolean mb_run = FALSE;
|
static gboolean mb_run = FALSE;
|
||||||
|
|
||||||
|
@ -134,16 +142,13 @@ static double cen_x, cen_y;
|
||||||
|
|
||||||
/***** Functions *****/
|
/***** Functions *****/
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
MAIN()
|
MAIN()
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query (void)
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] = {
|
static GParamDef args[] =
|
||||||
|
{
|
||||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||||
{ PARAM_IMAGE, "image", "Input image" },
|
{ PARAM_IMAGE, "image", "Input image" },
|
||||||
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
|
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
|
||||||
|
@ -171,15 +176,13 @@ query(void)
|
||||||
nreturn_vals,
|
nreturn_vals,
|
||||||
args,
|
args,
|
||||||
return_vals);
|
return_vals);
|
||||||
} /* query */
|
}
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run(char *name,
|
run (gchar *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals)
|
GParam **return_vals)
|
||||||
{
|
{
|
||||||
static GParam values[1];
|
static GParam values[1];
|
||||||
|
@ -188,7 +191,7 @@ run(char *name,
|
||||||
GStatusType status;
|
GStatusType status;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("Waiting... (pid %d)\n", getpid());
|
g_print ("Waiting... (pid %d)\n", getpid ());
|
||||||
kill (getpid (), SIGSTOP);
|
kill (getpid (), SIGSTOP);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -220,31 +223,32 @@ run(char *name,
|
||||||
cen_x = (double) (sel_x1 + sel_x2 - 1) / 2.0;
|
cen_x = (double) (sel_x1 + sel_x2 - 1) / 2.0;
|
||||||
cen_y = (double) (sel_y1 + sel_y2 - 1) / 2.0;
|
cen_y = (double) (sel_y1 + sel_y2 - 1) / 2.0;
|
||||||
|
|
||||||
switch (run_mode) {
|
switch (run_mode)
|
||||||
|
{
|
||||||
case RUN_INTERACTIVE:
|
case RUN_INTERACTIVE:
|
||||||
INIT_I18N_UI();
|
INIT_I18N_UI();
|
||||||
/* Possibly retrieve data */
|
|
||||||
|
|
||||||
|
/* Possibly retrieve data */
|
||||||
gimp_get_data (PLUG_IN_NAME, &mbvals);
|
gimp_get_data (PLUG_IN_NAME, &mbvals);
|
||||||
|
|
||||||
/* Get information from the dialog */
|
/* Get information from the dialog */
|
||||||
|
|
||||||
if (!mblur_dialog())
|
if (!mblur_dialog())
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RUN_NONINTERACTIVE:
|
case RUN_NONINTERACTIVE:
|
||||||
INIT_I18N();
|
INIT_I18N();
|
||||||
/* Make sure all the arguments are present */
|
|
||||||
|
|
||||||
|
/* Make sure all the arguments are present */
|
||||||
if (nparams != 6)
|
if (nparams != 6)
|
||||||
status = STATUS_CALLING_ERROR;
|
status = STATUS_CALLING_ERROR;
|
||||||
|
|
||||||
if (status == STATUS_SUCCESS) {
|
if (status == STATUS_SUCCESS)
|
||||||
|
{
|
||||||
mbvals.mblur_type = param[3].data.d_int32;
|
mbvals.mblur_type = param[3].data.d_int32;
|
||||||
mbvals.length = param[4].data.d_int32;
|
mbvals.length = param[4].data.d_int32;
|
||||||
mbvals.angle = param[5].data.d_int32;
|
mbvals.angle = param[5].data.d_int32;
|
||||||
} /* if */
|
}
|
||||||
|
|
||||||
if ((mbvals.mblur_type < 0) && (mbvals.mblur_type > MBLUR_ZOOM))
|
if ((mbvals.mblur_type < 0) && (mbvals.mblur_type > MBLUR_ZOOM))
|
||||||
status= STATUS_CALLING_ERROR;
|
status= STATUS_CALLING_ERROR;
|
||||||
|
@ -252,46 +256,44 @@ run(char *name,
|
||||||
|
|
||||||
case RUN_WITH_LAST_VALS:
|
case RUN_WITH_LAST_VALS:
|
||||||
INIT_I18N();
|
INIT_I18N();
|
||||||
/* Possibly retrieve data */
|
|
||||||
|
|
||||||
|
/* Possibly retrieve data */
|
||||||
gimp_get_data (PLUG_IN_NAME, &mbvals);
|
gimp_get_data (PLUG_IN_NAME, &mbvals);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
} /* switch */
|
}
|
||||||
|
|
||||||
/* Blur the image */
|
/* Blur the image */
|
||||||
|
|
||||||
if ((status == STATUS_SUCCESS) &&
|
if ((status == STATUS_SUCCESS) &&
|
||||||
(gimp_drawable_is_rgb(drawable->id) ||
|
(gimp_drawable_is_rgb(drawable->id) ||
|
||||||
gimp_drawable_is_gray(drawable->id))) {
|
gimp_drawable_is_gray(drawable->id)))
|
||||||
|
{
|
||||||
/* Set the tile cache size */
|
/* Set the tile cache size */
|
||||||
|
gimp_tile_cache_ntiles (2 * (drawable->width +
|
||||||
gimp_tile_cache_ntiles(2 * (drawable->width + gimp_tile_width() - 1) / gimp_tile_width());
|
gimp_tile_width () - 1) / gimp_tile_width ());
|
||||||
|
|
||||||
/* Run! */
|
/* Run! */
|
||||||
|
|
||||||
mblur ();
|
mblur ();
|
||||||
|
|
||||||
/* If run mode is interactive, flush displays */
|
/* If run mode is interactive, flush displays */
|
||||||
|
|
||||||
if (run_mode != RUN_NONINTERACTIVE)
|
if (run_mode != RUN_NONINTERACTIVE)
|
||||||
gimp_displays_flush ();
|
gimp_displays_flush ();
|
||||||
|
|
||||||
/* Store data */
|
/* Store data */
|
||||||
|
|
||||||
if (run_mode == RUN_INTERACTIVE)
|
if (run_mode == RUN_INTERACTIVE)
|
||||||
gimp_set_data (PLUG_IN_NAME, &mbvals, sizeof(mblur_vals_t));
|
gimp_set_data (PLUG_IN_NAME, &mbvals, sizeof(mblur_vals_t));
|
||||||
} else if (status == STATUS_SUCCESS)
|
}
|
||||||
|
else if (status == STATUS_SUCCESS)
|
||||||
status = STATUS_EXECUTION_ERROR;
|
status = STATUS_EXECUTION_ERROR;
|
||||||
|
|
||||||
values[0].data.d_status = status;
|
values[0].data.d_status = status;
|
||||||
|
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
} /* run */
|
}
|
||||||
|
|
||||||
/*****/
|
|
||||||
static void
|
static void
|
||||||
mblur_linear (void)
|
mblur_linear (void)
|
||||||
{
|
{
|
||||||
|
@ -309,13 +311,14 @@ mblur_linear(void)
|
||||||
int x, y, i, xx, yy, n;
|
int x, y, i, xx, yy, n;
|
||||||
int dx, dy, px, py, swapdir, err, e, s1, s2;
|
int dx, dy, px, py, swapdir, err, e, s1, s2;
|
||||||
|
|
||||||
|
gimp_pixel_rgn_init (&dest_rgn, drawable,
|
||||||
gimp_pixel_rgn_init(&dest_rgn, drawable, sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE);
|
sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE);
|
||||||
|
|
||||||
pft = pixel_fetcher_new (drawable);
|
pft = pixel_fetcher_new (drawable);
|
||||||
|
|
||||||
gimp_palette_get_background (&bg_color[0], &bg_color[1], &bg_color[2]);
|
gimp_palette_get_background (&bg_color[0], &bg_color[1], &bg_color[2]);
|
||||||
pixel_fetcher_set_bg_color(pft, bg_color[0], bg_color[1], bg_color[2], (img_has_alpha ? 0 : 255));
|
pixel_fetcher_set_bg_color (pft, bg_color[0], bg_color[1], bg_color[2],
|
||||||
|
(img_has_alpha ? 0 : 255));
|
||||||
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
max_progress = sel_width * sel_height;
|
max_progress = sel_width * sel_height;
|
||||||
|
@ -329,27 +332,34 @@ mblur_linear(void)
|
||||||
* dx = abs(x2-x1), s1 = sign(x2-x1)
|
* dx = abs(x2-x1), s1 = sign(x2-x1)
|
||||||
* dy = abs(y2-y1), s2 = sign(y2-y1)
|
* dy = abs(y2-y1), s2 = sign(y2-y1)
|
||||||
*/
|
*/
|
||||||
if ((dx = px) != 0) {
|
if ((dx = px) != 0)
|
||||||
if (dx < 0) {
|
{
|
||||||
|
if (dx < 0)
|
||||||
|
{
|
||||||
dx = -dx;
|
dx = -dx;
|
||||||
s1 = -1;
|
s1 = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
s1 = 1;
|
s1 = 1;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
s1 = 0;
|
s1 = 0;
|
||||||
|
|
||||||
if ((dy = py) != 0) {
|
if ((dy = py) != 0)
|
||||||
if (dy < 0) {
|
{
|
||||||
|
if (dy < 0)
|
||||||
|
{
|
||||||
dy = -dy;
|
dy = -dy;
|
||||||
s2 = -1;
|
s2 = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
s2 = 1;
|
s2 = 1;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
s2 = 0;
|
s2 = 0;
|
||||||
|
|
||||||
if (dy > dx) {
|
if (dy > dx)
|
||||||
|
{
|
||||||
swapdir = dx;
|
swapdir = dx;
|
||||||
dx = dy;
|
dx = dy;
|
||||||
dy = swapdir;
|
dy = swapdir;
|
||||||
|
@ -362,24 +372,31 @@ mblur_linear(void)
|
||||||
err = dy - dx; /* Initial error term */
|
err = dy - dx; /* Initial error term */
|
||||||
dx *= 2;
|
dx *= 2;
|
||||||
|
|
||||||
for (pr = gimp_pixel_rgns_register (1, &dest_rgn); pr != NULL; pr = gimp_pixel_rgns_process (pr)) {
|
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
|
||||||
|
pr != NULL;
|
||||||
|
pr = gimp_pixel_rgns_process (pr))
|
||||||
|
{
|
||||||
dest = dest_rgn.data;
|
dest = dest_rgn.data;
|
||||||
|
|
||||||
for (y = dest_rgn.y; y < (dest_rgn.y + dest_rgn.h); y++) {
|
for (y = dest_rgn.y; y < (dest_rgn.y + dest_rgn.h); y++)
|
||||||
|
{
|
||||||
d = dest;
|
d = dest;
|
||||||
|
|
||||||
for (x = dest_rgn.x; x < (dest_rgn.x + dest_rgn.w); x++) {
|
for (x = dest_rgn.x; x < (dest_rgn.x + dest_rgn.w); x++)
|
||||||
|
{
|
||||||
xx = x; yy = y; e = err;
|
xx = x; yy = y; e = err;
|
||||||
for (c= 0; c < img_bpp; c++) sum[c]= 0;
|
for (c= 0; c < img_bpp; c++)
|
||||||
|
sum[c]= 0;
|
||||||
|
|
||||||
for (i = 0; i < n; ) {
|
for (i = 0; i < n; )
|
||||||
|
{
|
||||||
pixel_fetcher_get_pixel (pft, xx, yy, pixel);
|
pixel_fetcher_get_pixel (pft, xx, yy, pixel);
|
||||||
for (c= 0; c < img_bpp; c++)
|
for (c= 0; c < img_bpp; c++)
|
||||||
sum[c]+= pixel[c];
|
sum[c]+= pixel[c];
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
while (e >= 0) {
|
while (e >= 0)
|
||||||
|
{
|
||||||
if (swapdir)
|
if (swapdir)
|
||||||
xx += s1;
|
xx += s1;
|
||||||
else
|
else
|
||||||
|
@ -391,7 +408,8 @@ mblur_linear(void)
|
||||||
else
|
else
|
||||||
xx += s1;
|
xx += s1;
|
||||||
e += dy;
|
e += dy;
|
||||||
if ((xx < sel_x1)||(xx >= sel_x2)||(yy < sel_y1)||(yy >= sel_y2))
|
if ((xx < sel_x1) || (xx >= sel_x2) ||
|
||||||
|
(yy < sel_y1) || (yy >= sel_y2))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,12 +454,14 @@ mblur_radial(void)
|
||||||
xx = 0.0;
|
xx = 0.0;
|
||||||
yy = 0.0;
|
yy = 0.0;
|
||||||
|
|
||||||
gimp_pixel_rgn_init(&dest_rgn, drawable, sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE);
|
gimp_pixel_rgn_init (&dest_rgn, drawable,
|
||||||
|
sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE);
|
||||||
|
|
||||||
pft = pixel_fetcher_new (drawable);
|
pft = pixel_fetcher_new (drawable);
|
||||||
|
|
||||||
gimp_palette_get_background (&bg_color[0], &bg_color[1], &bg_color[2]);
|
gimp_palette_get_background (&bg_color[0], &bg_color[1], &bg_color[2]);
|
||||||
pixel_fetcher_set_bg_color(pft, bg_color[0], bg_color[1], bg_color[2], (img_has_alpha ? 0 : 255));
|
pixel_fetcher_set_bg_color (pft, bg_color[0], bg_color[1], bg_color[2],
|
||||||
|
(img_has_alpha ? 0 : 255));
|
||||||
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
max_progress = sel_width * sel_height;
|
max_progress = sel_width * sel_height;
|
||||||
|
@ -453,23 +473,28 @@ mblur_radial(void)
|
||||||
n = 4 * angle * sqrt (R) + 2;
|
n = 4 * angle * sqrt (R) + 2;
|
||||||
theta = angle / ((float) (n - 1));
|
theta = angle / ((float) (n - 1));
|
||||||
|
|
||||||
if (((ct = malloc(n*sizeof(float))) == NULL) ||
|
if (((ct = g_new (float, n)) == NULL) ||
|
||||||
((st = malloc(n*sizeof(float))) == NULL))
|
((st = g_new (float, n)) == NULL))
|
||||||
return;
|
return;
|
||||||
offset = theta * (n - 1) / 2;
|
offset = theta * (n - 1) / 2;
|
||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i)
|
||||||
|
{
|
||||||
ct[i] = cos (theta * i - offset);
|
ct[i] = cos (theta * i - offset);
|
||||||
st[i] = sin (theta * i - offset);
|
st[i] = sin (theta * i - offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pr = gimp_pixel_rgns_register (1, &dest_rgn); pr != NULL; pr = gimp_pixel_rgns_process (pr)) {
|
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
|
||||||
|
pr != NULL;
|
||||||
|
pr = gimp_pixel_rgns_process (pr))
|
||||||
|
{
|
||||||
dest = dest_rgn.data;
|
dest = dest_rgn.data;
|
||||||
|
|
||||||
for (y = dest_rgn.y; y < (dest_rgn.y + dest_rgn.h); y++) {
|
for (y = dest_rgn.y; y < (dest_rgn.y + dest_rgn.h); y++)
|
||||||
|
{
|
||||||
d = dest;
|
d = dest;
|
||||||
|
|
||||||
for (x = dest_rgn.x; x < (dest_rgn.x + dest_rgn.w); x++) {
|
for (x = dest_rgn.x; x < (dest_rgn.x + dest_rgn.w); x++)
|
||||||
|
{
|
||||||
xr = x-cen_x;
|
xr = x-cen_x;
|
||||||
yr = y-cen_y;
|
yr = y-cen_y;
|
||||||
r = sqrt (xr * xr + yr * yr);
|
r = sqrt (xr * xr + yr * yr);
|
||||||
|
@ -480,9 +505,11 @@ mblur_radial(void)
|
||||||
else if (step > n-1)
|
else if (step > n-1)
|
||||||
step = n-1;
|
step = n-1;
|
||||||
|
|
||||||
for (c=0; c < img_bpp; c++) sum[c]=0;
|
for (c = 0; c < img_bpp; c++)
|
||||||
|
sum[c] = 0;
|
||||||
|
|
||||||
for (i = 0, count = 0; i < n; i += step) {
|
for (i = 0, count = 0; i < n; i += step)
|
||||||
|
{
|
||||||
xx = cen_x + xr * ct[i] - yr * st[i];
|
xx = cen_x + xr * ct[i] - yr * st[i];
|
||||||
yy = cen_y + xr * st[i] + yr * ct[i];
|
yy = cen_y + xr * st[i] + yr * ct[i];
|
||||||
if ((yy < sel_y1) || (yy >= sel_y2) ||
|
if ((yy < sel_y1) || (yy >= sel_y2) ||
|
||||||
|
@ -513,8 +540,9 @@ mblur_radial(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
pixel_fetcher_destroy (pft);
|
pixel_fetcher_destroy (pft);
|
||||||
free(ct);
|
|
||||||
free(st);
|
g_free (ct);
|
||||||
|
g_free (st);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -537,12 +565,14 @@ mblur_zoom(void)
|
||||||
xx = 0.0;
|
xx = 0.0;
|
||||||
yy = 0.0;
|
yy = 0.0;
|
||||||
|
|
||||||
gimp_pixel_rgn_init(&dest_rgn, drawable, sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE);
|
gimp_pixel_rgn_init (&dest_rgn, drawable,
|
||||||
|
sel_x1, sel_y1, sel_width, sel_height, TRUE, TRUE);
|
||||||
|
|
||||||
pft = pixel_fetcher_new (drawable);
|
pft = pixel_fetcher_new (drawable);
|
||||||
|
|
||||||
gimp_palette_get_background (&bg_color[0], &bg_color[1], &bg_color[2]);
|
gimp_palette_get_background (&bg_color[0], &bg_color[1], &bg_color[2]);
|
||||||
pixel_fetcher_set_bg_color(pft, bg_color[0], bg_color[1], bg_color[2], (img_has_alpha ? 0 : 255));
|
pixel_fetcher_set_bg_color (pft, bg_color[0], bg_color[1], bg_color[2],
|
||||||
|
(img_has_alpha ? 0 : 255));
|
||||||
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
max_progress = sel_width * sel_height;
|
max_progress = sel_width * sel_height;
|
||||||
|
@ -550,18 +580,23 @@ mblur_zoom(void)
|
||||||
n = mbvals.length;
|
n = mbvals.length;
|
||||||
f = 0.02;
|
f = 0.02;
|
||||||
|
|
||||||
for (pr = gimp_pixel_rgns_register (1, &dest_rgn); pr != NULL; pr = gimp_pixel_rgns_process (pr))
|
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
|
||||||
|
pr != NULL;
|
||||||
|
pr = gimp_pixel_rgns_process (pr))
|
||||||
{
|
{
|
||||||
dest = dest_rgn.data;
|
dest = dest_rgn.data;
|
||||||
|
|
||||||
for (y = dest_rgn.y; y < (dest_rgn.y + dest_rgn.h); y++) {
|
for (y = dest_rgn.y; y < (dest_rgn.y + dest_rgn.h); y++)
|
||||||
|
{
|
||||||
d = dest;
|
d = dest;
|
||||||
|
|
||||||
for (x = dest_rgn.x; x < (dest_rgn.x + dest_rgn.w); x++) {
|
for (x = dest_rgn.x; x < (dest_rgn.x + dest_rgn.w); x++)
|
||||||
|
{
|
||||||
|
for (c = 0; c < img_bpp; c++)
|
||||||
|
sum[c] = 0;
|
||||||
|
|
||||||
for (c=0; c < img_bpp; c++) sum[c]=0;
|
for (i = 0; i < n; ++i)
|
||||||
|
{
|
||||||
for (i = 0; i < n; ++i) {
|
|
||||||
xx = cen_x + (x-cen_x) * (1.0 + f * i);
|
xx = cen_x + (x-cen_x) * (1.0 + f * i);
|
||||||
yy = cen_y + (y-cen_y) * (1.0 + f * i);
|
yy = cen_y + (y-cen_y) * (1.0 + f * i);
|
||||||
|
|
||||||
|
@ -574,7 +609,6 @@ mblur_zoom(void)
|
||||||
sum[c] += pixel[c];
|
sum[c] += pixel[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
pixel_fetcher_get_pixel (pft, xx, yy, d);
|
pixel_fetcher_get_pixel (pft, xx, yy, d);
|
||||||
|
@ -611,7 +645,7 @@ mblur(void)
|
||||||
mblur_zoom ();
|
mblur_zoom ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_drawable_flush (drawable);
|
gimp_drawable_flush (drawable);
|
||||||
|
@ -620,9 +654,7 @@ mblur(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************
|
/*****************************************
|
||||||
*
|
|
||||||
* pixel_fetcher from whirlpinch plug-in
|
* pixel_fetcher from whirlpinch plug-in
|
||||||
*
|
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
static pixel_fetcher_t *
|
static pixel_fetcher_t *
|
||||||
|
@ -630,7 +662,7 @@ pixel_fetcher_new(GDrawable *drawable)
|
||||||
{
|
{
|
||||||
pixel_fetcher_t *pf;
|
pixel_fetcher_t *pf;
|
||||||
|
|
||||||
pf = g_malloc(sizeof(pixel_fetcher_t));
|
pf = g_new (pixel_fetcher_t, 1);
|
||||||
|
|
||||||
pf->col = -1;
|
pf->col = -1;
|
||||||
pf->row = -1;
|
pf->row = -1;
|
||||||
|
@ -649,13 +681,14 @@ pixel_fetcher_new(GDrawable *drawable)
|
||||||
pf->tile = NULL;
|
pf->tile = NULL;
|
||||||
|
|
||||||
return pf;
|
return pf;
|
||||||
} /* pixel_fetcher_new */
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pixel_fetcher_set_bg_color(pixel_fetcher_t *pf, guchar r, guchar g, guchar b, guchar a)
|
pixel_fetcher_set_bg_color (pixel_fetcher_t *pf,
|
||||||
|
guchar r,
|
||||||
|
guchar g,
|
||||||
|
guchar b,
|
||||||
|
guchar a)
|
||||||
{
|
{
|
||||||
pf->bg_color[0] = r;
|
pf->bg_color[0] = r;
|
||||||
pf->bg_color[1] = g;
|
pf->bg_color[1] = g;
|
||||||
|
@ -663,13 +696,13 @@ pixel_fetcher_set_bg_color(pixel_fetcher_t *pf, guchar r, guchar g, guchar b, gu
|
||||||
|
|
||||||
if (pf->img_has_alpha)
|
if (pf->img_has_alpha)
|
||||||
pf->bg_color[pf->img_bpp - 1] = a;
|
pf->bg_color[pf->img_bpp - 1] = a;
|
||||||
} /* pixel_fetcher_set_bg_color */
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pixel_fetcher_get_pixel(pixel_fetcher_t *pf, int x, int y, guchar *pixel)
|
pixel_fetcher_get_pixel (pixel_fetcher_t *pf,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
guchar *pixel)
|
||||||
{
|
{
|
||||||
gint col, row;
|
gint col, row;
|
||||||
gint coloff, rowoff;
|
gint coloff, rowoff;
|
||||||
|
@ -677,12 +710,13 @@ pixel_fetcher_get_pixel(pixel_fetcher_t *pf, int x, int y, guchar *pixel)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((x < sel_x1) || (x >= sel_x2) ||
|
if ((x < sel_x1) || (x >= sel_x2) ||
|
||||||
(y < sel_y1) || (y >= sel_y2)) {
|
(y < sel_y1) || (y >= sel_y2))
|
||||||
|
{
|
||||||
for (i = 0; i < pf->img_bpp; i++)
|
for (i = 0; i < pf->img_bpp; i++)
|
||||||
pixel[i] = pf->bg_color[i];
|
pixel[i] = pf->bg_color[i];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} /* if */
|
}
|
||||||
|
|
||||||
col = x / pf->tile_width;
|
col = x / pf->tile_width;
|
||||||
coloff = x % pf->tile_width;
|
coloff = x % pf->tile_width;
|
||||||
|
@ -691,7 +725,8 @@ pixel_fetcher_get_pixel(pixel_fetcher_t *pf, int x, int y, guchar *pixel)
|
||||||
|
|
||||||
if ((col != pf->col) ||
|
if ((col != pf->col) ||
|
||||||
(row != pf->row) ||
|
(row != pf->row) ||
|
||||||
(pf->tile == NULL)) {
|
(pf->tile == NULL))
|
||||||
|
{
|
||||||
if (pf->tile != NULL)
|
if (pf->tile != NULL)
|
||||||
gimp_tile_unref (pf->tile, FALSE);
|
gimp_tile_unref (pf->tile, FALSE);
|
||||||
|
|
||||||
|
@ -700,16 +735,13 @@ pixel_fetcher_get_pixel(pixel_fetcher_t *pf, int x, int y, guchar *pixel)
|
||||||
|
|
||||||
pf->col = col;
|
pf->col = col;
|
||||||
pf->row = row;
|
pf->row = row;
|
||||||
} /* if */
|
}
|
||||||
|
|
||||||
p = pf->tile->data + pf->img_bpp * (pf->tile->ewidth * rowoff + coloff);
|
p = pf->tile->data + pf->img_bpp * (pf->tile->ewidth * rowoff + coloff);
|
||||||
|
|
||||||
for (i = pf->img_bpp; i; i--)
|
for (i = pf->img_bpp; i; i--)
|
||||||
*pixel++ = *p++;
|
*pixel++ = *p++;
|
||||||
} /* pixel_fetcher_get_pixel */
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pixel_fetcher_destroy (pixel_fetcher_t *pf)
|
pixel_fetcher_destroy (pixel_fetcher_t *pf)
|
||||||
|
@ -718,21 +750,23 @@ pixel_fetcher_destroy(pixel_fetcher_t *pf)
|
||||||
gimp_tile_unref (pf->tile, FALSE);
|
gimp_tile_unref (pf->tile, FALSE);
|
||||||
|
|
||||||
g_free (pf);
|
g_free (pf);
|
||||||
} /* pixel_fetcher_destroy */
|
}
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
*
|
|
||||||
* UI
|
* UI
|
||||||
*
|
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
mblur_dialog (void)
|
mblur_dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *oframe, *iframe;
|
GtkWidget *oframe;
|
||||||
GtkWidget *evbox, *ovbox, *ivbox;
|
GtkWidget *iframe;
|
||||||
GtkWidget *button, *label;
|
GtkWidget *ovbox;
|
||||||
|
GtkWidget *ivbox;
|
||||||
|
GtkWidget *table;
|
||||||
|
GtkWidget *button;
|
||||||
|
GtkWidget *label;
|
||||||
|
|
||||||
GtkWidget *scale;
|
GtkWidget *scale;
|
||||||
GtkObject *adjustment;
|
GtkObject *adjustment;
|
||||||
|
@ -765,68 +799,39 @@ mblur_dialog (void)
|
||||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/********************/
|
oframe = gtk_frame_new (_("Parameter Settings"));
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (oframe), 6);
|
||||||
evbox= gtk_vbox_new(FALSE, 5);
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (evbox), 5);
|
|
||||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
|
|
||||||
evbox, FALSE,FALSE,0);
|
|
||||||
|
|
||||||
oframe= gtk_frame_new( _("Options"));
|
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (oframe), GTK_SHADOW_ETCHED_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (oframe), GTK_SHADOW_ETCHED_IN);
|
||||||
gtk_box_pack_start(GTK_BOX(evbox),
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), oframe);
|
||||||
oframe, TRUE, TRUE, 0);
|
|
||||||
|
|
||||||
ovbox= gtk_vbox_new(FALSE, 5);
|
ovbox = gtk_vbox_new (FALSE, 4);
|
||||||
gtk_container_border_width (GTK_CONTAINER (ovbox), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (ovbox), 4);
|
||||||
gtk_container_add (GTK_CONTAINER (oframe), ovbox);
|
gtk_container_add (GTK_CONTAINER (oframe), ovbox);
|
||||||
|
|
||||||
label=gtk_label_new( _("Length"));
|
iframe = gtk_frame_new (_("Blur Type"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
|
||||||
gtk_box_pack_start(GTK_BOX(ovbox), label, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show(label);
|
|
||||||
|
|
||||||
adjustment = gtk_adjustment_new( mbvals.length, 0.0, 256.0,
|
|
||||||
1.0, 1.0, 1.0);
|
|
||||||
gtk_signal_connect(adjustment,"value_changed",
|
|
||||||
(GtkSignalFunc) dialog_scale_update,
|
|
||||||
&(mbvals.length));
|
|
||||||
|
|
||||||
scale= gtk_hscale_new( GTK_ADJUSTMENT(adjustment));
|
|
||||||
gtk_widget_set_usize(GTK_WIDGET(scale), 150, 30);
|
|
||||||
gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_DELAYED);
|
|
||||||
gtk_scale_set_digits(GTK_SCALE(scale), 0);
|
|
||||||
gtk_scale_set_draw_value(GTK_SCALE(scale), TRUE);
|
|
||||||
gtk_box_pack_start(GTK_BOX(ovbox), scale, FALSE, FALSE,0);
|
|
||||||
gtk_widget_show( scale );
|
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
iframe= gtk_frame_new( _("Blur type"));
|
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (iframe), GTK_SHADOW_ETCHED_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (iframe), GTK_SHADOW_ETCHED_IN);
|
||||||
gtk_box_pack_start(GTK_BOX(ovbox),
|
gtk_box_pack_start (GTK_BOX (ovbox), iframe, FALSE, FALSE, 0);
|
||||||
iframe, FALSE, FALSE, 0);
|
|
||||||
|
|
||||||
ivbox= gtk_vbox_new(FALSE, 5);
|
ivbox= gtk_vbox_new (FALSE, 2);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (ivbox), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (ivbox), 2);
|
||||||
gtk_container_add (GTK_CONTAINER (iframe), ivbox);
|
gtk_container_add (GTK_CONTAINER (iframe), ivbox);
|
||||||
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char * name[3]= { N_("Linear"), N_("Radial"), N_("Zoom")};
|
gchar *name[3]= { N_("Linear"), N_("Radial"), N_("Zoom")};
|
||||||
|
|
||||||
button = NULL;
|
button = NULL;
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
button= gtk_radio_button_new_with_label(
|
button= gtk_radio_button_new_with_label
|
||||||
(button==NULL)? NULL :
|
((button == NULL) ? NULL :
|
||||||
gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
|
gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
|
||||||
gettext (name[i]));
|
gettext (name[i]));
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||||
(mbvals.mblur_type == i));
|
(mbvals.mblur_type == i));
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||||
(GtkSignalFunc) dialog_toggle_update,
|
GTK_SIGNAL_FUNC (dialog_toggle_update),
|
||||||
(gpointer) i);
|
(gpointer) i);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (ivbox), button, FALSE, FALSE,0);
|
gtk_box_pack_start (GTK_BOX (ivbox), button, FALSE, FALSE,0);
|
||||||
|
@ -837,31 +842,54 @@ mblur_dialog (void)
|
||||||
gtk_widget_show (ivbox);
|
gtk_widget_show (ivbox);
|
||||||
gtk_widget_show (iframe);
|
gtk_widget_show (iframe);
|
||||||
|
|
||||||
/*****/
|
table = gtk_table_new (2, 2, FALSE);
|
||||||
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
|
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||||
|
gtk_box_pack_start (GTK_BOX (ovbox), table, FALSE, FALSE, 0);
|
||||||
|
|
||||||
label=gtk_label_new( _("Angle"));
|
label = gtk_label_new( _("Length:"));
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||||
gtk_box_pack_start(GTK_BOX(ovbox), label, FALSE, FALSE, 0);
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
|
||||||
|
adjustment = gtk_adjustment_new (mbvals.length, 0.0, 256.0,
|
||||||
|
1.0, 1.0, 1.0);
|
||||||
|
gtk_signal_connect (adjustment, "value_changed",
|
||||||
|
GTK_SIGNAL_FUNC (dialog_scale_update),
|
||||||
|
&(mbvals.length));
|
||||||
|
|
||||||
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
||||||
|
gtk_widget_set_usize (GTK_WIDGET (scale), 150, -1);
|
||||||
|
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||||
|
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||||
|
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
|
||||||
|
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 0, 1);
|
||||||
|
gtk_widget_show (scale);
|
||||||
|
|
||||||
|
label = gtk_label_new (_("Angle:"));
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||||
|
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 1, 2);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
adjustment = gtk_adjustment_new (mbvals.angle, 0.0, 360.0,
|
adjustment = gtk_adjustment_new (mbvals.angle, 0.0, 360.0,
|
||||||
1.0, 1.0, 1.0);
|
1.0, 1.0, 1.0);
|
||||||
gtk_signal_connect (adjustment, "value_changed",
|
gtk_signal_connect (adjustment, "value_changed",
|
||||||
(GtkSignalFunc) dialog_scale_update,
|
GTK_SIGNAL_FUNC (dialog_scale_update),
|
||||||
&(mbvals.angle));
|
&(mbvals.angle));
|
||||||
|
|
||||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
|
||||||
gtk_widget_set_usize(GTK_WIDGET(scale), 150, 30);
|
gtk_widget_set_usize (GTK_WIDGET (scale), 150, -1);
|
||||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||||
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
|
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
|
||||||
gtk_box_pack_start(GTK_BOX(ovbox), scale, FALSE, FALSE,0);
|
gtk_table_attach_defaults (GTK_TABLE (table), scale, 1, 2, 1, 2);
|
||||||
gtk_widget_show (scale);
|
gtk_widget_show (scale);
|
||||||
|
|
||||||
|
gtk_widget_show (table);
|
||||||
|
|
||||||
gtk_widget_show (ovbox);
|
gtk_widget_show (ovbox);
|
||||||
|
|
||||||
gtk_widget_show (oframe);
|
gtk_widget_show (oframe);
|
||||||
gtk_widget_show(evbox);
|
|
||||||
gtk_widget_show (dialog);
|
gtk_widget_show (dialog);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include "libgimp/gimp.h"
|
#include <libgimp/gimp.h>
|
||||||
#include "libgimp/gimpui.h"
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
|
@ -58,10 +58,10 @@ typedef struct
|
||||||
/* Declare local functions.
|
/* Declare local functions.
|
||||||
*/
|
*/
|
||||||
static void query (void);
|
static void query (void);
|
||||||
static void run (char *name,
|
static void run (gchar *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals);
|
GParam **return_vals);
|
||||||
|
|
||||||
static void noisify (GDrawable * drawable);
|
static void noisify (GDrawable * drawable);
|
||||||
|
@ -106,7 +106,7 @@ static NoisifyInterface noise_int =
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] =
|
static GParamDef args[] =
|
||||||
{
|
{
|
||||||
|
@ -139,10 +139,10 @@ query ()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run (char *name,
|
run (gchar *name,
|
||||||
int nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
int *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals)
|
GParam **return_vals)
|
||||||
{
|
{
|
||||||
static GParam values[1];
|
static GParam values[1];
|
||||||
|
@ -202,7 +202,8 @@ run (char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that the drawable is gray or RGB color */
|
/* 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);
|
gimp_tile_cache_ntiles (TILE_CACHE_SIZE);
|
||||||
|
@ -248,14 +249,18 @@ noisify (GDrawable *drawable)
|
||||||
noise = 0;
|
noise = 0;
|
||||||
|
|
||||||
gimp_drawable_mask_bounds (drawable->id, &x1, &y1, &x2, &y2);
|
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 (&src_rgn, drawable,
|
||||||
gimp_pixel_rgn_init (&dest_rgn, drawable, x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
|
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 */
|
/* Initialize progress */
|
||||||
progress = 0;
|
progress = 0;
|
||||||
max_progress = (x2 - x1) * (y2 - y1);
|
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;
|
src_row = src_rgn.data;
|
||||||
dest_row = dest_rgn.data;
|
dest_row = dest_rgn.data;
|
||||||
|
@ -314,7 +319,7 @@ noisify_dialog (gint channels)
|
||||||
gchar *buffer;
|
gchar *buffer;
|
||||||
gchar **argv;
|
gchar **argv;
|
||||||
gint argc;
|
gint argc;
|
||||||
int i;
|
gint i;
|
||||||
|
|
||||||
argc = 1;
|
argc = 1;
|
||||||
argv = g_new (gchar *, 1);
|
argv = g_new (gchar *, 1);
|
||||||
|
@ -342,86 +347,71 @@ noisify_dialog (gint channels)
|
||||||
/* parameter settings */
|
/* 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_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_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||||
|
|
||||||
table = gtk_table_new (channels + 1, 3, FALSE);
|
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);
|
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_table_attach (GTK_TABLE (table), toggle, 0, 2, 0, 1, GTK_FILL, 0, 0, 0);
|
||||||
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||||
(GtkSignalFunc) noisify_toggle_update,
|
GTK_SIGNAL_FUNC (noisify_toggle_update),
|
||||||
&nvals.independent);
|
&nvals.independent);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), nvals.independent);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), nvals.independent);
|
||||||
gtk_widget_show (toggle);
|
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)
|
if (channels == 1)
|
||||||
{
|
{
|
||||||
buffer = g_strdup_printf( _("Gray"));
|
dialog_create_value (_("Gray:"), GTK_TABLE (table), 1,
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 1, &nvals.noise[0], 0.0, 1.0);
|
&nvals.noise[0], 0.0, 1.0);
|
||||||
g_free(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (channels == 2)
|
else if (channels == 2)
|
||||||
{
|
{
|
||||||
buffer = g_strdup_printf( _("Gray"));
|
dialog_create_value (_("Gray:"), GTK_TABLE (table), 1,
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 1, &nvals.noise[0], 0.0, 1.0);
|
&nvals.noise[0], 0.0, 1.0);
|
||||||
g_free(buffer);
|
dialog_create_value (_("Alpha:"), GTK_TABLE (table), 2,
|
||||||
buffer = g_strdup_printf( _("Alpha"));
|
&nvals.noise[1], 0.0, 1.0);
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 2, &nvals.noise[1], 0.0, 1.0);
|
|
||||||
g_free(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (channels == 3)
|
else if (channels == 3)
|
||||||
{
|
{
|
||||||
buffer = g_strdup_printf( _("Red"));
|
dialog_create_value (_("Red:"), GTK_TABLE (table), 1,
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 1, &nvals.noise[0], 0.0, 1.0);
|
&nvals.noise[0], 0.0, 1.0);
|
||||||
g_free(buffer);
|
dialog_create_value (_("Green:"), GTK_TABLE (table), 2,
|
||||||
buffer = g_strdup_printf( _("Green"));
|
&nvals.noise[1], 0.0, 1.0);
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 2, &nvals.noise[1], 0.0, 1.0);
|
dialog_create_value (_("Blue:"), GTK_TABLE (table), 3,
|
||||||
g_free(buffer);
|
&nvals.noise[2], 0.0, 1.0);
|
||||||
buffer = g_strdup_printf( _("Blue"));
|
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 3, &nvals.noise[2], 0.0, 1.0);
|
|
||||||
g_free(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (channels == 4)
|
else if (channels == 4)
|
||||||
{
|
{
|
||||||
buffer = g_strdup_printf( _("Red"));
|
dialog_create_value (_("Red:"), GTK_TABLE (table), 1,
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 1, &nvals.noise[0], 0.0, 1.0);
|
&nvals.noise[0], 0.0, 1.0);
|
||||||
g_free(buffer);
|
dialog_create_value (_("Green:"), GTK_TABLE (table), 2,
|
||||||
buffer = g_strdup_printf( _("Green"));
|
&nvals.noise[1], 0.0, 1.0);
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 2, &nvals.noise[1], 0.0, 1.0);
|
dialog_create_value (_("Blue:"), GTK_TABLE (table), 3,
|
||||||
g_free(buffer);
|
&nvals.noise[2], 0.0, 1.0);
|
||||||
buffer = g_strdup_printf( _("Blue"));
|
dialog_create_value (_("Alpha:"), GTK_TABLE (table), 4,
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), 3, &nvals.noise[2], 0.0, 1.0);
|
&nvals.noise[3], 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < channels; i++)
|
for (i = 0; i < channels; i++)
|
||||||
{
|
{
|
||||||
buffer = g_strdup_printf (_("Channel #%d"), i);
|
buffer = g_strdup_printf (_("Channel #%d"), i);
|
||||||
dialog_create_value(buffer, GTK_TABLE(table), i+1, &nvals.noise[i], 0.0, 1.0);
|
dialog_create_value (buffer, GTK_TABLE(table), i + 1,
|
||||||
|
&nvals.noise[i], 0.0, 1.0);
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
gtk_widget_show (dlg);
|
gtk_widget_show (dlg);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
@ -439,7 +429,7 @@ noisify_dialog (gint channels)
|
||||||
* Springer Verlag, New York, 1988.
|
* Springer Verlag, New York, 1988.
|
||||||
*/
|
*/
|
||||||
static gdouble
|
static gdouble
|
||||||
gauss ()
|
gauss (void)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gdouble sum = 0.0;
|
gdouble sum = 0.0;
|
||||||
|
@ -494,8 +484,8 @@ dialog_create_value (char *title,
|
||||||
gchar buf[256];
|
gchar buf[256];
|
||||||
|
|
||||||
label = gtk_label_new (title);
|
label = gtk_label_new (title);
|
||||||
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(table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 4, 0);
|
gtk_table_attach (table, label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
scale_data = gtk_adjustment_new(*value, left, right,
|
scale_data = gtk_adjustment_new(*value, left, right,
|
||||||
|
@ -509,7 +499,8 @@ dialog_create_value (char *title,
|
||||||
|
|
||||||
scale = gtk_hscale_new(GTK_ADJUSTMENT(scale_data));
|
scale = gtk_hscale_new(GTK_ADJUSTMENT(scale_data));
|
||||||
gtk_widget_set_usize(scale, SCALE_WIDTH, 0);
|
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_draw_value(GTK_SCALE(scale), FALSE);
|
||||||
gtk_scale_set_digits(GTK_SCALE(scale), 3);
|
gtk_scale_set_digits(GTK_SCALE(scale), 3);
|
||||||
gtk_range_set_update_policy(GTK_RANGE(scale), GTK_UPDATE_CONTINUOUS);
|
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",
|
gtk_signal_connect(GTK_OBJECT(entry), "changed",
|
||||||
(GtkSignalFunc) noisify_entry_update,
|
(GtkSignalFunc) noisify_entry_update,
|
||||||
value);
|
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);
|
gtk_widget_show(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,14 @@
|
||||||
#define TILE_CACHE_SIZE 16
|
#define TILE_CACHE_SIZE 16
|
||||||
#define ENTRY_WIDTH 50
|
#define ENTRY_WIDTH 50
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
gdouble spread_amount_x;
|
gdouble spread_amount_x;
|
||||||
gdouble spread_amount_y;
|
gdouble spread_amount_y;
|
||||||
} SpreadValues;
|
} SpreadValues;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
gint run;
|
gint run;
|
||||||
} SpreadInterface;
|
} SpreadInterface;
|
||||||
|
|
||||||
|
@ -79,6 +81,7 @@ static void spread_fentry_callback (GtkWidget *widget,
|
||||||
|
|
||||||
static void spread_fscale_callback (GtkAdjustment *adjustment,
|
static void spread_fscale_callback (GtkAdjustment *adjustment,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
|
||||||
/***** Local vars *****/
|
/***** Local vars *****/
|
||||||
|
|
||||||
GPlugInInfo PLUG_IN_INFO =
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
|
@ -105,7 +108,7 @@ static SpreadInterface pint =
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] =
|
static GParamDef args[] =
|
||||||
{
|
{
|
||||||
|
@ -227,8 +230,6 @@ run (gchar *name,
|
||||||
gimp_drawable_detach (drawable);
|
gimp_drawable_detach (drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spread (GDrawable *drawable)
|
spread (GDrawable *drawable)
|
||||||
{
|
{
|
||||||
|
@ -296,13 +297,13 @@ spread (GDrawable *drawable)
|
||||||
The corners are less sharp with this algorithm.
|
The corners are less sharp with this algorithm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Spread the image! */
|
/* Spread the image! */
|
||||||
|
|
||||||
|
gimp_pixel_rgn_init (&dest_rgn, drawable,
|
||||||
gimp_pixel_rgn_init (&dest_rgn, drawable, x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
|
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))
|
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
|
||||||
|
pr != NULL;
|
||||||
|
pr = gimp_pixel_rgns_process (pr))
|
||||||
{
|
{
|
||||||
destrow = dest_rgn.data;
|
destrow = dest_rgn.data;
|
||||||
|
|
||||||
|
@ -351,7 +352,7 @@ spread (GDrawable *drawable)
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
spread_dialog ()
|
spread_dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg;
|
GtkWidget *dlg;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
@ -405,7 +406,7 @@ spread_dialog ()
|
||||||
label = gtk_label_new (_("Horizontal Spread Amount:"));
|
label = gtk_label_new (_("Horizontal Spread Amount:"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
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);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
hbox = gtk_hbox_new (FALSE, 4);
|
hbox = gtk_hbox_new (FALSE, 4);
|
||||||
|
@ -440,7 +441,7 @@ spread_dialog ()
|
||||||
label = gtk_label_new (_("Vertical Spread Amount:"));
|
label = gtk_label_new (_("Vertical Spread Amount:"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
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);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
hbox = gtk_hbox_new (FALSE, 4);
|
hbox = gtk_hbox_new (FALSE, 4);
|
||||||
|
@ -482,8 +483,6 @@ spread_dialog ()
|
||||||
return pint.run;
|
return pint.run;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****/
|
|
||||||
|
|
||||||
static GTile *
|
static GTile *
|
||||||
spread_pixel (GDrawable * drawable,
|
spread_pixel (GDrawable * drawable,
|
||||||
GTile * tile,
|
GTile * tile,
|
||||||
|
|
|
@ -38,13 +38,17 @@
|
||||||
/* #define VERBOSE 2 */
|
/* #define VERBOSE 2 */
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.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"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
/* Wear your GIMP with pride! */
|
/* Wear your GIMP with pride! */
|
||||||
|
@ -102,8 +106,6 @@ static gint save_image (char *filename,
|
||||||
gint32 image_ID,
|
gint32 image_ID,
|
||||||
gint32 drawable_ID);
|
gint32 drawable_ID);
|
||||||
static gint save_dialog (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,
|
static void save_ok_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void save_toggle_update (GtkWidget *widget,
|
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 int gtk_initialized = FALSE;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
not_bw_dialog (void)
|
not_bw_dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg, *button, *hbbox, *label, *frame, *vbox;
|
GtkWidget *dlg, *label, *frame, *vbox;
|
||||||
|
|
||||||
if (!gtk_initialized)
|
if (!gtk_initialized)
|
||||||
{
|
{
|
||||||
|
@ -716,40 +711,25 @@ not_bw_dialog (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg = gtk_dialog_new ();
|
dlg = gimp_dialog_new (_("XBM Warning"), "xbm",
|
||||||
gtk_window_set_title (GTK_WINDOW (dlg), _("XBM Warning"));
|
gimp_plugin_help_func, "filters/xbm.html",
|
||||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
GTK_WIN_POS_MOUSE,
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
FALSE, TRUE, FALSE,
|
||||||
(GtkSignalFunc) close_callback,
|
|
||||||
dlg);
|
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "delete_event",
|
|
||||||
(GtkSignalFunc) close_callback,
|
|
||||||
dlg);
|
|
||||||
|
|
||||||
/* Action area */
|
_("Cancel"), gtk_main_quit,
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 2);
|
NULL, NULL, NULL, TRUE, TRUE,
|
||||||
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 (_("Cancel"));
|
NULL);
|
||||||
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);
|
|
||||||
|
|
||||||
/* the warning message */
|
/* the warning message */
|
||||||
frame = gtk_frame_new (NULL);
|
frame = gtk_frame_new (NULL);
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
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,
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame,
|
||||||
TRUE, 0);
|
TRUE, TRUE, 0);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 5);
|
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);
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
|
|
||||||
label = gtk_label_new (_("The image which you are trying to save as\n"
|
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"
|
"Please convert it to a black and white\n"
|
||||||
"(1-bit) indexed image and try again."));
|
"(1-bit) indexed image and try again."));
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
|
||||||
|
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
gtk_widget_show (dlg);
|
gtk_widget_show (dlg);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
gtk_widget_destroy (GTK_WIDGET (dlg));
|
|
||||||
gdk_flush ();
|
gdk_flush ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,7 +934,7 @@ save_image (char *filename,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_gtk ()
|
init_gtk (void)
|
||||||
{
|
{
|
||||||
gchar **argv;
|
gchar **argv;
|
||||||
gint argc;
|
gint argc;
|
||||||
|
@ -970,61 +951,40 @@ init_gtk ()
|
||||||
static gint
|
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;
|
xsint.run = FALSE;
|
||||||
|
|
||||||
dlg = gtk_dialog_new ();
|
dlg = gimp_dialog_new (_("Save as XBM"), "xbm",
|
||||||
gtk_window_set_title (GTK_WINDOW (dlg), _("Save as XBM"));
|
gimp_plugin_help_func, "filters/xbm.html",
|
||||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
GTK_WIN_POS_MOUSE,
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
FALSE, TRUE, FALSE,
|
||||||
(GtkSignalFunc) close_callback,
|
|
||||||
|
_("OK"), save_ok_callback,
|
||||||
|
NULL, NULL, NULL, TRUE, FALSE,
|
||||||
|
_("Cancel"), gtk_widget_destroy,
|
||||||
|
NULL, 1, NULL, FALSE, TRUE,
|
||||||
|
|
||||||
NULL);
|
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);
|
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
|
NULL);
|
||||||
|
|
||||||
/* parameter settings */
|
/* parameter settings */
|
||||||
frame = gtk_frame_new (_("XBM Options"));
|
frame = gtk_frame_new (_("XBM Options"));
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
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_widget_show (frame);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
vbox = gtk_vbox_new (FALSE, 4);
|
||||||
vbox = gtk_vbox_new (FALSE, 5);
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||||
gtk_container_border_width (GTK_CONTAINER (vbox), 5);
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
|
|
||||||
/* comment string. */
|
/* comment string. */
|
||||||
hbox = gtk_hbox_new(FALSE, 5);
|
hbox = gtk_hbox_new (FALSE, 4);
|
||||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
|
||||||
|
|
||||||
label = gtk_label_new (_("Description:"));
|
label = gtk_label_new (_("Description:"));
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
|
@ -1035,27 +995,26 @@ save_dialog (gint32 drawable_ID)
|
||||||
gtk_widget_set_usize (entry, 240, 0);
|
gtk_widget_set_usize (entry, 240, 0);
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), xsvals.comment);
|
gtk_entry_set_text (GTK_ENTRY (entry), xsvals.comment);
|
||||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||||
(GtkSignalFunc) comment_entry_callback,
|
GTK_SIGNAL_FUNC (comment_entry_callback),
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (entry);
|
||||||
|
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
/* X10 format */
|
/* X10 format */
|
||||||
toggle = gtk_check_button_new_with_label (_("X10 format bitmap"));
|
toggle = gtk_check_button_new_with_label (_("X10 Format Bitmap"));
|
||||||
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",
|
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
|
||||||
(GtkSignalFunc) save_toggle_update,
|
GTK_SIGNAL_FUNC (save_toggle_update),
|
||||||
&xsvals.x10_format);
|
&xsvals.x10_format);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), xsvals.x10_format);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), xsvals.x10_format);
|
||||||
gtk_widget_show (toggle);
|
gtk_widget_show (toggle);
|
||||||
|
|
||||||
/* prefix */
|
/* prefix */
|
||||||
hbox = gtk_hbox_new(FALSE, 5);
|
hbox = gtk_hbox_new (FALSE, 4);
|
||||||
gtk_container_border_width (GTK_CONTAINER (hbox), 0);
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 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_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
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_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
|
||||||
gtk_entry_set_text (GTK_ENTRY (entry), xsvals.prefix);
|
gtk_entry_set_text (GTK_ENTRY (entry), xsvals.prefix);
|
||||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||||
(GtkSignalFunc) prefix_entry_callback,
|
GTK_SIGNAL_FUNC (prefix_entry_callback),
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (entry);
|
||||||
|
|
||||||
|
@ -1105,6 +1064,7 @@ save_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
xsint.run = TRUE;
|
xsint.run = TRUE;
|
||||||
|
|
||||||
gtk_widget_destroy (GTK_WIDGET (data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,21 +1082,3 @@ save_toggle_update (GtkWidget *widget,
|
||||||
else
|
else
|
||||||
*toggle_val = FALSE;
|
*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 "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/xpm.h>
|
#include <X11/xpm.h>
|
||||||
#include "gtk/gtk.h"
|
|
||||||
#include "libgimp/gimp.h"
|
#include <gtk/gtk.h>
|
||||||
#include "libgimp/gimpui.h"
|
|
||||||
|
#include <libgimp/gimp.h>
|
||||||
|
#include <libgimp/gimpui.h>
|
||||||
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
static const char linenoise [] =
|
static const char linenoise [] =
|
||||||
|
@ -93,15 +97,12 @@ static gint save_image (char *filename,
|
||||||
|
|
||||||
static void init_gtk (void);
|
static void init_gtk (void);
|
||||||
static gint save_dialog (void);
|
static gint save_dialog (void);
|
||||||
static void save_close_callback (GtkWidget *widget,
|
|
||||||
gpointer data);
|
|
||||||
static void save_ok_callback (GtkWidget *widget,
|
static void save_ok_callback (GtkWidget *widget,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
static void save_scale_update (GtkAdjustment *adjustment,
|
static void save_scale_update (GtkAdjustment *adjustment,
|
||||||
double *scale_val);
|
double *scale_val);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GPlugInInfo PLUG_IN_INFO =
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
NULL, /* init_proc */
|
NULL, /* init_proc */
|
||||||
|
@ -121,11 +122,10 @@ static XpmSaveInterface xpmint =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
static void
|
static void
|
||||||
query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef load_args[] =
|
static GParamDef load_args[] =
|
||||||
{
|
{
|
||||||
|
@ -234,8 +234,8 @@ run (char *name,
|
||||||
case RUN_INTERACTIVE:
|
case RUN_INTERACTIVE:
|
||||||
case RUN_WITH_LAST_VALS:
|
case RUN_WITH_LAST_VALS:
|
||||||
export = gimp_export_image (&image_ID, &drawable_ID, "XPM",
|
export = gimp_export_image (&image_ID, &drawable_ID, "XPM",
|
||||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED |
|
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY |
|
||||||
CAN_HANDLE_ALPHA));
|
CAN_HANDLE_INDEXED | CAN_HANDLE_ALPHA));
|
||||||
if (export == EXPORT_CANCEL)
|
if (export == EXPORT_CANCEL)
|
||||||
{
|
{
|
||||||
*nreturn_vals = 1;
|
*nreturn_vals = 1;
|
||||||
|
@ -750,7 +750,7 @@ save_image (char *filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_gtk ()
|
init_gtk (void)
|
||||||
{
|
{
|
||||||
gchar **argv;
|
gchar **argv;
|
||||||
gint argc;
|
gint argc;
|
||||||
|
@ -764,71 +764,56 @@ init_gtk ()
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
save_dialog ()
|
save_dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg;
|
GtkWidget *dlg;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *hbbox;
|
|
||||||
GtkWidget *button;
|
|
||||||
GtkWidget *scale;
|
GtkWidget *scale;
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *table;
|
GtkWidget *table;
|
||||||
GtkObject *scale_data;
|
GtkObject *scale_data;
|
||||||
|
|
||||||
dlg = gtk_dialog_new ();
|
dlg = gimp_dialog_new (_("Save as XPM"), "xpm",
|
||||||
gtk_window_set_title (GTK_WINDOW (dlg), _("Save as Xpm"));
|
gimp_plugin_help_func, "filters/xpm.html",
|
||||||
gtk_window_position (GTK_WINDOW (dlg), GTK_WIN_POS_MOUSE);
|
GTK_WIN_POS_MOUSE,
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
FALSE, TRUE, FALSE,
|
||||||
(GtkSignalFunc) save_close_callback,
|
|
||||||
|
_("OK"), save_ok_callback,
|
||||||
|
NULL, NULL, NULL, TRUE, FALSE,
|
||||||
|
_("Cancel"), gtk_widget_destroy,
|
||||||
|
NULL, 1, NULL, FALSE, TRUE,
|
||||||
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Action area */
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->action_area), 2);
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dlg)->action_area), FALSE);
|
NULL);
|
||||||
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 */
|
/* 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_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);
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, TRUE, TRUE, 0);
|
||||||
|
|
||||||
table = gtk_table_new (1, 2, FALSE);
|
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);
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||||
|
|
||||||
label = gtk_label_new (_("Alpha Threshold"));
|
label = gtk_label_new (_("Alpha Threshold:"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
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, 5, 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_data = gtk_adjustment_new (xpmvals.threshold, 0.0, 1.0, 0.01, 0.01, 0.0);
|
||||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (scale_data));
|
||||||
gtk_widget_set_usize (scale, SCALE_WIDTH, 0);
|
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_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
|
||||||
gtk_scale_set_digits (GTK_SCALE (scale), 2);
|
gtk_scale_set_digits (GTK_SCALE (scale), 2);
|
||||||
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
|
||||||
gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed",
|
gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed",
|
||||||
(GtkSignalFunc) save_scale_update,
|
GTK_SIGNAL_FUNC (save_scale_update),
|
||||||
&xpmvals.threshold);
|
&xpmvals.threshold);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
gtk_widget_show (scale);
|
gtk_widget_show (scale);
|
||||||
|
@ -843,21 +828,12 @@ save_dialog ()
|
||||||
return xpmint.run;
|
return xpmint.run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Save interface functions */
|
|
||||||
|
|
||||||
static void
|
|
||||||
save_close_callback (GtkWidget *widget,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
gtk_main_quit ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
save_ok_callback (GtkWidget *widget,
|
save_ok_callback (GtkWidget *widget,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
xpmint.run = TRUE;
|
xpmint.run = TRUE;
|
||||||
|
|
||||||
gtk_widget_destroy (GTK_WIDGET (data));
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ INCLUDES = \
|
||||||
-I$(includedir)
|
-I$(includedir)
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
$(top_builddir)/libgimp/libgimp.la \
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(INTLLIBS)
|
$(INTLLIBS)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -66,21 +66,6 @@ gpc_toggle_update(GtkWidget *widget, gpointer data) {
|
||||||
else
|
else
|
||||||
*toggle_val = FALSE;
|
*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
|
* 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
|
* 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
|
* 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
|
void
|
||||||
gpc_scale_update(GtkAdjustment *adjustment, double *scale_val);
|
gpc_scale_update(GtkAdjustment *adjustment, double *scale_val);
|
||||||
|
|
||||||
|
@ -64,18 +58,10 @@ gpc_setup_tooltips(GtkWidget *parent);
|
||||||
void
|
void
|
||||||
gpc_set_tooltip(GtkWidget *widget, const char *tip);
|
gpc_set_tooltip(GtkWidget *widget, const char *tip);
|
||||||
|
|
||||||
void
|
|
||||||
gpc_add_action_button(char *label, GtkSignalFunc callback, GtkWidget *dialog,
|
|
||||||
char *tip);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
|
gpc_add_radio_button(GSList **group, char *label, GtkWidget *box,
|
||||||
gint *value, char *tip);
|
gint *value, char *tip);
|
||||||
|
|
||||||
void
|
|
||||||
gpc_add_label(char *value, GtkWidget *parent, int left, int right,
|
|
||||||
int top, int bottom);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gpc_add_hscale(GtkWidget *table, int width, float low, float high,
|
gpc_add_hscale(GtkWidget *table, int width, float low, float high,
|
||||||
gdouble *val, int left, int right, int top, int bottom, char *tip);
|
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,
|
static void mw_entry_new(GtkWidget *parent, gchar *fname,
|
||||||
gchar *name, gpointer variablep,
|
gchar *name, gpointer variablep,
|
||||||
guchar *buffer, GtkCallback entry_cb);
|
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_fscale_callback(GtkAdjustment *adj, gpointer data);
|
||||||
static void ui_fentry_callback(GtkWidget *widget, gpointer data);
|
static void ui_fentry_callback(GtkWidget *widget, gpointer data);
|
||||||
static void ui_iscale_callback(GtkAdjustment *adj, 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_ientry_alone_callback(GtkWidget *widget, gpointer data);
|
||||||
static void ui_fentry_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 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
|
#ifndef NO_PREVIEW
|
||||||
static mw_preview_t *mw_do_preview = NULL;
|
static mw_preview_t *mw_do_preview = NULL;
|
||||||
static gint do_preview = 1;
|
static gint do_preview = 1;
|
||||||
#endif
|
#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
|
void
|
||||||
mw_fscale_entry_new(GtkWidget *table, gchar *name,
|
mw_fscale_entry_new(GtkWidget *table, gchar *name,
|
||||||
gfloat lorange, gfloat hirange,
|
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,
|
void mw_ientry_new(GtkWidget *parent, gchar *fname,
|
||||||
gchar *name, gint *varp)
|
gchar *name, gint *varp)
|
||||||
{
|
{
|
||||||
|
@ -564,19 +466,6 @@ mw_entry_new(GtkWidget *parent, gchar *fname,
|
||||||
gtk_widget_show (hbox);
|
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
|
static void
|
||||||
ui_fscale_callback(GtkAdjustment *adj, gpointer data){
|
ui_fscale_callback(GtkAdjustment *adj, gpointer data){
|
||||||
GtkWidget *ent;
|
GtkWidget *ent;
|
||||||
|
@ -729,128 +618,3 @@ ui_value_toggle_callback(GtkWidget *widget, gpointer data) {
|
||||||
#endif
|
#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;
|
guchar *bits;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mwColorSel {
|
|
||||||
gdouble *color;
|
|
||||||
gdouble savcolor[4];
|
|
||||||
gint opacity;
|
|
||||||
guchar *name;
|
|
||||||
GtkWidget *window;
|
|
||||||
GtkWidget *preview;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef PREVIEW_SIZE
|
#ifndef PREVIEW_SIZE
|
||||||
#define PREVIEW_SIZE 100
|
#define PREVIEW_SIZE 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GtkWidget *mw_app_new(gchar *resname, gchar *appname, gint *runpp);
|
|
||||||
void mw_fscale_entry_new(GtkWidget *table, char *name,
|
void mw_fscale_entry_new(GtkWidget *table, char *name,
|
||||||
gfloat lorange, gfloat hirange,
|
gfloat lorange, gfloat hirange,
|
||||||
gfloat st_inc, gfloat pg_inc, gfloat pgsiz,
|
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);
|
gchar *name, gint *varp);
|
||||||
GtkWidget *mw_fentry_button_new(GtkWidget *parent, gchar *fname,
|
GtkWidget *mw_fentry_button_new(GtkWidget *parent, gchar *fname,
|
||||||
gchar *name, gdouble *varp);
|
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,
|
void mw_ientry_new(GtkWidget *parent, gchar *fname,
|
||||||
gchar *name, gint *varp);
|
gchar *name, gint *varp);
|
||||||
|
@ -103,4 +89,3 @@ struct mwPreview *mw_preview_build(GDrawable *drw);
|
||||||
struct mwPreview *mw_preview_build_virgin(GDrawable *drw);
|
struct mwPreview *mw_preview_build_virgin(GDrawable *drw);
|
||||||
|
|
||||||
#endif /* MEGAWIDGET_H */
|
#endif /* MEGAWIDGET_H */
|
||||||
/* end of megawidget/megawidget.h */
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ INCLUDES = \
|
||||||
-I$(includedir)
|
-I$(includedir)
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
|
$(top_builddir)/libgimp/libgimpui.la \
|
||||||
$(top_builddir)/libgimp/libgimp.la \
|
$(top_builddir)/libgimp/libgimp.la \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(INTLLIBS)
|
$(INTLLIBS)
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
* Change log:
|
* Change log:
|
||||||
*
|
*
|
||||||
* Version 2.0, 04 April 1999.
|
* Version 2.0, 04 April 1999.
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
* Version 1.0, 27 March 1997.
|
* Version 1.0, 27 March 1997.
|
||||||
* Initial (unstable) release by Pavel Grinfeld
|
* Initial (unstable) release by Pavel Grinfeld
|
||||||
*
|
*
|
||||||
*-----------------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -52,9 +52,9 @@
|
||||||
#include "rcm_pixmaps.h"
|
#include "rcm_pixmaps.h"
|
||||||
#include "rcm_callback.h"
|
#include "rcm_callback.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Misc functions */
|
/* Misc functions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
float rcm_units_factor(gint units)
|
float rcm_units_factor(gint units)
|
||||||
{
|
{
|
||||||
|
@ -103,24 +103,21 @@ void rcm_set_pixmap(GtkWidget **widget, GtkWidget *parent,
|
||||||
gtk_widget_show(*widget);
|
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;
|
Current.Success = 1;
|
||||||
|
|
||||||
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Circle buttons */
|
/* Circle buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_360_degrees(GtkWidget *button, RcmCircle *circle)
|
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);
|
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Misc: units buttons */
|
/* Misc: units buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void rcm_spinbutton_to_degrees(GtkWidget *button, float value, GtkWidget *label)
|
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)
|
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)
|
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 */
|
/* Misc: Gray: mode buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_switch_to_gray_to(GtkWidget *button, gpointer *value)
|
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);
|
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Misc: Preview buttons */
|
/* Misc: Preview buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_preview_as_you_drag(GtkWidget *button, gpointer *value)
|
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;
|
Current.RealTime = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void rcm_change_preview(void)
|
static void rcm_change_preview(void)
|
||||||
{
|
{
|
||||||
|
@ -362,7 +359,7 @@ static void rcm_change_preview(void)
|
||||||
gtk_widget_show(Current.Bna->after);
|
gtk_widget_show(Current.Bna->after);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_selection_in_context(GtkWidget *button, gpointer *value)
|
void rcm_selection_in_context(GtkWidget *button, gpointer *value)
|
||||||
{
|
{
|
||||||
|
@ -386,9 +383,9 @@ void rcm_entire_image(GtkWidget *button, gpointer *value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Circle events */
|
/* Circle events */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_expose_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_button_press_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_release_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Gray circle events */
|
/* Gray circle events */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_gray_expose_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_gray_button_press_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_gray_release_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_gray_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Spinbuttons */
|
/* Spinbuttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_set_alpha(GtkWidget *entry, gpointer data)
|
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);
|
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_set_beta(GtkWidget *entry, gpointer data)
|
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);
|
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_set_hue(GtkWidget *entry, gpointer data)
|
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);
|
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_set_satur(GtkWidget *entry, gpointer data)
|
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);
|
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_set_gray_sat(GtkWidget *entry, gpointer data)
|
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);
|
rcm_render_preview(Current.Bna->after, CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
* Change log:
|
* Change log:
|
||||||
*
|
*
|
||||||
* Version 2.0, 04 April 1999.
|
* Version 2.0, 04 April 1999.
|
||||||
|
@ -34,11 +34,11 @@
|
||||||
* Version 1.0, 27 March 1997.
|
* Version 1.0, 27 March 1997.
|
||||||
* Initial (unstable) release by Pavel Grinfeld
|
* Initial (unstable) release by Pavel Grinfeld
|
||||||
*
|
*
|
||||||
*-----------------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Misc functions */
|
/* Misc functions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
float rcm_units_factor(gint units);
|
float rcm_units_factor(gint units);
|
||||||
|
|
||||||
|
@ -47,17 +47,15 @@ gchar *rcm_units_string(gint units);
|
||||||
void rcm_set_pixmap(GtkWidget **widget, GtkWidget *parent,
|
void rcm_set_pixmap(GtkWidget **widget, GtkWidget *parent,
|
||||||
GtkWidget *label_box, char **pixmap_data);
|
GtkWidget *label_box, char **pixmap_data);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Ok/Cancel Buttons */
|
/* Ok Button */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_close_callback(GtkWidget *widget, gpointer data);
|
|
||||||
|
|
||||||
void rcm_ok_callback(GtkWidget *widget, gpointer data);
|
void rcm_ok_callback(GtkWidget *widget, gpointer data);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Circle buttons */
|
/* Circle buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_360_degrees(GtkWidget *button, RcmCircle *circle);
|
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);
|
void rcm_a_to_b(GtkWidget *button, RcmCircle *circle);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Misc: units buttons */
|
/* Misc: units buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_switch_to_degrees(GtkWidget *button, gpointer *value);
|
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);
|
void rcm_switch_to_radians_over_PI(GtkWidget *button, gpointer *value);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Misc: Gray: mode buttons */
|
/* Misc: Gray: mode buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_switch_to_gray_to(GtkWidget *button, gpointer *value);
|
void rcm_switch_to_gray_to(GtkWidget *button, gpointer *value);
|
||||||
|
|
||||||
void rcm_switch_to_gray_from(GtkWidget *button, gpointer *value);
|
void rcm_switch_to_gray_from(GtkWidget *button, gpointer *value);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Misc: Preview buttons */
|
/* Misc: Preview buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_preview_as_you_drag(GtkWidget *button, gpointer *value);
|
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);
|
void rcm_entire_image(GtkWidget *button, gpointer *value);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Circle events */
|
/* Circle events */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_expose_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle);
|
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);
|
gint rcm_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmCircle *circle);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Gray circle events */
|
/* Gray circle events */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint rcm_gray_expose_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle);
|
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);
|
gint rcm_gray_motion_notify_event(GtkWidget *widget, GdkEvent *event, RcmGray *circle);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Spinbuttons */
|
/* Spinbuttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void rcm_set_alpha(GtkWidget *entry, gpointer data);
|
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);
|
void rcm_set_gray_sat(GtkWidget *entry, gpointer data);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
* Change log:
|
* Change log:
|
||||||
*
|
*
|
||||||
* Version 2.0, 04 April 1999.
|
* Version 2.0, 04 April 1999.
|
||||||
|
@ -34,15 +34,19 @@
|
||||||
* Version 1.0, 27 March 1997.
|
* Version 1.0, 27 March 1997.
|
||||||
* Initial (unstable) release by Pavel Grinfeld
|
* Initial (unstable) release by Pavel Grinfeld
|
||||||
*
|
*
|
||||||
*-----------------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "libgimp/gimp.h"
|
|
||||||
|
#include <libgimp/gimp.h>
|
||||||
|
#include <libgimp/gimpui.h>
|
||||||
|
#include <libgimp/gimpmath.h>
|
||||||
|
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
#include "rcm.h"
|
#include "rcm.h"
|
||||||
|
@ -52,9 +56,9 @@
|
||||||
#include "rcm_callback.h"
|
#include "rcm_callback.h"
|
||||||
#include "rcm_dialog.h"
|
#include "rcm_dialog.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Defines */
|
/* Defines */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define INITIAL_ALPHA 0
|
#define INITIAL_ALPHA 0
|
||||||
#define INITIAL_BETA (PI/2.0)
|
#define INITIAL_BETA (PI/2.0)
|
||||||
|
@ -69,9 +73,9 @@
|
||||||
GDK_BUTTON1_MOTION_MASK | \
|
GDK_BUTTON1_MOTION_MASK | \
|
||||||
GDK_POINTER_MOTION_HINT_MASK
|
GDK_POINTER_MOTION_HINT_MASK
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Previews: create one preview */
|
/* Previews: create one preview */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
rcm_create_one_preview (GtkWidget **preview,
|
rcm_create_one_preview (GtkWidget **preview,
|
||||||
|
@ -91,9 +95,9 @@ rcm_create_one_preview (GtkWidget **preview,
|
||||||
gtk_container_add(GTK_CONTAINER(*frame), *preview);
|
gtk_container_add(GTK_CONTAINER(*frame), *preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Previews */
|
/* Previews */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
rcm_create_previews (void)
|
rcm_create_previews (void)
|
||||||
|
@ -109,10 +113,8 @@ rcm_create_previews (void)
|
||||||
Current.reduced->width, Current.reduced->height);
|
Current.reduced->width, Current.reduced->height);
|
||||||
|
|
||||||
/* Previews: frame */
|
/* Previews: frame */
|
||||||
|
|
||||||
frame = gtk_frame_new (_("Preview"));
|
frame = gtk_frame_new (_("Preview"));
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||||
gtk_container_border_width(GTK_CONTAINER(frame), 4);
|
|
||||||
|
|
||||||
alabel = gtk_label_new (_("Rotated"));
|
alabel = gtk_label_new (_("Rotated"));
|
||||||
gtk_widget_show (alabel);
|
gtk_widget_show (alabel);
|
||||||
|
@ -121,8 +123,7 @@ rcm_create_previews (void)
|
||||||
gtk_widget_show (blabel);
|
gtk_widget_show (blabel);
|
||||||
|
|
||||||
table = gtk_table_new (4, 1, FALSE);
|
table = gtk_table_new (4, 1, FALSE);
|
||||||
gtk_container_border_width(GTK_CONTAINER(table), 4);
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||||
gtk_table_set_row_spacings(GTK_TABLE(table), 0);
|
|
||||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||||
|
@ -145,9 +146,9 @@ rcm_create_previews (void)
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Main: Create one pixmap button */
|
/* Main: Create one pixmap button */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
rcm_create_pixmap_button (GtkWidget **label,
|
rcm_create_pixmap_button (GtkWidget **label,
|
||||||
|
@ -160,7 +161,6 @@ rcm_create_pixmap_button (GtkWidget **label,
|
||||||
gint pos)
|
gint pos)
|
||||||
{
|
{
|
||||||
/* create button */
|
/* create button */
|
||||||
|
|
||||||
*xpm_button = gtk_button_new();
|
*xpm_button = gtk_button_new();
|
||||||
gtk_signal_connect(GTK_OBJECT(*xpm_button), "clicked", callback, data);
|
gtk_signal_connect(GTK_OBJECT(*xpm_button), "clicked", callback, data);
|
||||||
gtk_widget_show(*xpm_button);
|
gtk_widget_show(*xpm_button);
|
||||||
|
@ -169,27 +169,23 @@ rcm_create_pixmap_button (GtkWidget **label,
|
||||||
0, 1, pos, pos+1, GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 2);
|
0, 1, pos, pos+1, GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 2);
|
||||||
|
|
||||||
/* create hbox */
|
/* create hbox */
|
||||||
|
|
||||||
*label_box = gtk_hbox_new(FALSE, 0);
|
*label_box = gtk_hbox_new(FALSE, 0);
|
||||||
gtk_widget_show(*label_box);
|
gtk_widget_show(*label_box);
|
||||||
|
|
||||||
/* create label */
|
/* create label */
|
||||||
|
|
||||||
*label = gtk_label_new(text);
|
*label = gtk_label_new(text);
|
||||||
gtk_widget_show(*label);
|
gtk_widget_show(*label);
|
||||||
|
|
||||||
/* put label and pixmap in hbox */
|
/* put label and pixmap in hbox */
|
||||||
|
|
||||||
gtk_box_pack_end(GTK_BOX(*label_box), *label, TRUE, FALSE, 0);
|
gtk_box_pack_end(GTK_BOX(*label_box), *label, TRUE, FALSE, 0);
|
||||||
|
|
||||||
/* create hbox in button */
|
/* create hbox in button */
|
||||||
|
|
||||||
gtk_container_add(GTK_CONTAINER(*xpm_button), *label_box);
|
gtk_container_add(GTK_CONTAINER(*xpm_button), *label_box);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Set buttons pixmaps */
|
/* Set buttons pixmaps */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
rcm_set_pixmaps (RcmCircle *circle)
|
rcm_set_pixmaps (RcmCircle *circle)
|
||||||
|
@ -199,9 +195,9 @@ rcm_set_pixmaps (RcmCircle *circle)
|
||||||
rcm_set_pixmap(&circle->f360_pixmap, circle->f360_button->parent, circle->f360_box, rcm_360);
|
rcm_set_pixmap(&circle->f360_pixmap, circle->f360_button->parent, circle->f360_box, rcm_360);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Main: One circles with values and buttons */
|
/* Main: One circles with values and buttons */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
RcmCircle*
|
RcmCircle*
|
||||||
rcm_create_one_circle (gint height,
|
rcm_create_one_circle (gint height,
|
||||||
|
@ -221,7 +217,6 @@ rcm_create_one_circle (gint height,
|
||||||
st->angle->cw_ccw = 1;
|
st->angle->cw_ccw = 1;
|
||||||
|
|
||||||
/** Main: Circle: create (main) frame **/
|
/** Main: Circle: create (main) frame **/
|
||||||
|
|
||||||
st->frame = gtk_frame_new(label_content);
|
st->frame = gtk_frame_new(label_content);
|
||||||
gtk_container_border_width(GTK_CONTAINER(st->frame), 0);
|
gtk_container_border_width(GTK_CONTAINER(st->frame), 0);
|
||||||
gtk_widget_show(st->frame);
|
gtk_widget_show(st->frame);
|
||||||
|
@ -229,21 +224,18 @@ rcm_create_one_circle (gint height,
|
||||||
/** Main: Circle: create frame & preview **/
|
/** Main: Circle: create frame & preview **/
|
||||||
|
|
||||||
/* create frame */
|
/* create frame */
|
||||||
|
|
||||||
frame = gtk_frame_new(NULL);
|
frame = gtk_frame_new(NULL);
|
||||||
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
|
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||||
gtk_container_border_width(GTK_CONTAINER(frame), 0);
|
gtk_container_border_width(GTK_CONTAINER(frame), 0);
|
||||||
gtk_widget_show(frame);
|
gtk_widget_show(frame);
|
||||||
|
|
||||||
/* create preview */
|
/* create preview */
|
||||||
|
|
||||||
st->preview = gtk_preview_new(GTK_PREVIEW_COLOR);
|
st->preview = gtk_preview_new(GTK_PREVIEW_COLOR);
|
||||||
gtk_preview_size(GTK_PREVIEW(st->preview), height, height);
|
gtk_preview_size(GTK_PREVIEW(st->preview), height, height);
|
||||||
gtk_widget_show(st->preview);
|
gtk_widget_show(st->preview);
|
||||||
gtk_container_add(GTK_CONTAINER(frame), st->preview);
|
gtk_container_add(GTK_CONTAINER(frame), st->preview);
|
||||||
|
|
||||||
/* set signals */
|
/* set signals */
|
||||||
|
|
||||||
gtk_widget_set_events(st->preview, RANGE_ADJUST_MASK);
|
gtk_widget_set_events(st->preview, RANGE_ADJUST_MASK);
|
||||||
|
|
||||||
gtk_signal_connect_after(GTK_OBJECT(st->preview), "expose_event",
|
gtk_signal_connect_after(GTK_OBJECT(st->preview), "expose_event",
|
||||||
|
@ -261,14 +253,13 @@ rcm_create_one_circle (gint height,
|
||||||
rcm_render_circle(st->preview, SUM, MARGIN);
|
rcm_render_circle(st->preview, SUM, MARGIN);
|
||||||
|
|
||||||
/** Main: Circle: create table for buttons **/
|
/** Main: Circle: create table for buttons **/
|
||||||
|
|
||||||
button_table = gtk_table_new(3, 1, FALSE);
|
button_table = gtk_table_new(3, 1, FALSE);
|
||||||
gtk_widget_show(button_table);
|
gtk_widget_show(button_table);
|
||||||
|
|
||||||
/** Main: Circle: Buttons **/
|
/** Main: Circle: Buttons **/
|
||||||
|
|
||||||
rcm_create_pixmap_button(&label, &xpm_button, &label_box, rcm_cw_ccw, st,
|
rcm_create_pixmap_button(&label, &xpm_button, &label_box, rcm_cw_ccw, st,
|
||||||
(st->angle->cw_ccw>0) ? _("Switch to clockwise") : _("Switch to c/clockwise"),
|
(st->angle->cw_ccw>0) ?
|
||||||
|
_("Switch to clockwise") : _("Switch to c/clockwise"),
|
||||||
button_table, 0);
|
button_table, 0);
|
||||||
st->cw_ccw_pixmap = NULL;
|
st->cw_ccw_pixmap = NULL;
|
||||||
st->cw_ccw_button = xpm_button;
|
st->cw_ccw_button = xpm_button;
|
||||||
|
@ -288,12 +279,10 @@ rcm_create_one_circle (gint height,
|
||||||
st->f360_button = xpm_button;
|
st->f360_button = xpm_button;
|
||||||
|
|
||||||
/** Main: Circle: Legend **/
|
/** Main: Circle: Legend **/
|
||||||
|
|
||||||
legend_table = gtk_table_new(1, 6, FALSE);
|
legend_table = gtk_table_new(1, 6, FALSE);
|
||||||
gtk_widget_show(legend_table);
|
gtk_widget_show(legend_table);
|
||||||
|
|
||||||
/* spinbutton 1 */
|
/* spinbutton 1 */
|
||||||
|
|
||||||
label = gtk_label_new(_("From"));
|
label = gtk_label_new(_("From"));
|
||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
gtk_table_attach(GTK_TABLE(legend_table), label, 0,1, 0,1,
|
gtk_table_attach(GTK_TABLE(legend_table), label, 0,1, 0,1,
|
||||||
|
@ -309,7 +298,6 @@ rcm_create_one_circle (gint height,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 2, 4);
|
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 2, 4);
|
||||||
|
|
||||||
/* label */
|
/* label */
|
||||||
|
|
||||||
st->alpha_units_label = gtk_label_new(rcm_units_string(Current.Units));
|
st->alpha_units_label = gtk_label_new(rcm_units_string(Current.Units));
|
||||||
gtk_widget_show(st->alpha_units_label);
|
gtk_widget_show(st->alpha_units_label);
|
||||||
|
|
||||||
|
@ -317,7 +305,6 @@ rcm_create_one_circle (gint height,
|
||||||
0, GTK_EXPAND, 4, 4);
|
0, GTK_EXPAND, 4, 4);
|
||||||
|
|
||||||
/* spinbutton 2 */
|
/* spinbutton 2 */
|
||||||
|
|
||||||
label = gtk_label_new(_("to"));
|
label = gtk_label_new(_("to"));
|
||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
gtk_table_attach(GTK_TABLE(legend_table), label, 3,4, 0,1,
|
gtk_table_attach(GTK_TABLE(legend_table), label, 3,4, 0,1,
|
||||||
|
@ -333,7 +320,6 @@ rcm_create_one_circle (gint height,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 2, 4);
|
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 2, 4);
|
||||||
|
|
||||||
/* label */
|
/* label */
|
||||||
|
|
||||||
st->beta_units_label = gtk_label_new(rcm_units_string(Current.Units));
|
st->beta_units_label = gtk_label_new(rcm_units_string(Current.Units));
|
||||||
gtk_widget_show(st->beta_units_label);
|
gtk_widget_show(st->beta_units_label);
|
||||||
|
|
||||||
|
@ -341,7 +327,6 @@ rcm_create_one_circle (gint height,
|
||||||
0, GTK_EXPAND, 4, 4);
|
0, GTK_EXPAND, 4, 4);
|
||||||
|
|
||||||
/* Main: Circle: create table for Preview / Buttons / Legend */
|
/* Main: Circle: create table for Preview / Buttons / Legend */
|
||||||
|
|
||||||
st->table= gtk_table_new(2, 2, FALSE);
|
st->table= gtk_table_new(2, 2, FALSE);
|
||||||
gtk_widget_show(st->table);
|
gtk_widget_show(st->table);
|
||||||
|
|
||||||
|
@ -355,47 +340,38 @@ rcm_create_one_circle (gint height,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0, 2);
|
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0, 2);
|
||||||
|
|
||||||
/* add table to (main) frame */
|
/* add table to (main) frame */
|
||||||
|
|
||||||
gtk_container_add(GTK_CONTAINER(st->frame), st->table);
|
gtk_container_add(GTK_CONTAINER(st->frame), st->table);
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Main */
|
/* Main */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
rcm_create_main (void)
|
rcm_create_main (void)
|
||||||
{
|
{
|
||||||
GtkWidget *table;
|
GtkWidget *vbox;
|
||||||
|
|
||||||
/* Main: create previews */
|
|
||||||
|
|
||||||
Current.From = rcm_create_one_circle (SUM, _("From"));
|
Current.From = rcm_create_one_circle (SUM, _("From"));
|
||||||
Current.To = rcm_create_one_circle (SUM, _("To"));
|
Current.To = rcm_create_one_circle (SUM, _("To"));
|
||||||
|
|
||||||
/* Main: create table */
|
vbox = gtk_vbox_new (FALSE, 4);
|
||||||
|
|
||||||
table = gtk_table_new(3, 2, FALSE);
|
gtk_box_pack_start (GTK_BOX (vbox), Current.From->frame,
|
||||||
gtk_container_border_width(GTK_CONTAINER(table), 0);
|
FALSE, FALSE, 0);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), Current.To->frame,
|
||||||
|
FALSE, FALSE, 0);
|
||||||
|
|
||||||
/* Main: insert previews in table */
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
gtk_table_attach(GTK_TABLE(table), Current.From->frame, 0, 1, 0, 1,
|
return vbox;
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0, 0);
|
|
||||||
|
|
||||||
gtk_table_attach(GTK_TABLE(table), Current.To->frame, 0, 1, 1, 2,
|
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0, 0);
|
|
||||||
|
|
||||||
gtk_widget_show(table);
|
|
||||||
|
|
||||||
return table;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Misc: Gray */
|
/* Misc: Gray */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
RcmGray*
|
RcmGray*
|
||||||
rcm_create_gray (void)
|
rcm_create_gray (void)
|
||||||
|
@ -416,15 +392,12 @@ rcm_create_gray (void)
|
||||||
st->action_flag = VIRGIN;
|
st->action_flag = VIRGIN;
|
||||||
|
|
||||||
/** Gray **/
|
/** Gray **/
|
||||||
|
|
||||||
st->frame = frame = gtk_frame_new (_("Gray"));
|
st->frame = frame = gtk_frame_new (_("Gray"));
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
/* Gray: Circle: Circle (Preview) */
|
/* Gray: Circle: Circle (Preview) */
|
||||||
|
|
||||||
previewframe = gtk_frame_new (NULL);
|
previewframe = gtk_frame_new (NULL);
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (previewframe), GTK_SHADOW_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (previewframe), GTK_SHADOW_IN);
|
||||||
gtk_container_border_width (GTK_CONTAINER(previewframe), 0);
|
|
||||||
gtk_widget_show (previewframe);
|
gtk_widget_show (previewframe);
|
||||||
|
|
||||||
st->preview = preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
st->preview = preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||||
|
@ -447,101 +420,102 @@ rcm_create_gray (void)
|
||||||
(GtkSignalFunc) rcm_gray_motion_notify_event, st);
|
(GtkSignalFunc) rcm_gray_motion_notify_event, st);
|
||||||
|
|
||||||
/* Gray: Circle: Legend */
|
/* Gray: Circle: Legend */
|
||||||
|
|
||||||
legend_table = gtk_table_new (2, 3, FALSE);
|
legend_table = gtk_table_new (2, 3, FALSE);
|
||||||
|
gtk_table_set_col_spacings (GTK_TABLE (legend_table), 4);
|
||||||
|
gtk_table_set_row_spacings (GTK_TABLE (legend_table), 2);
|
||||||
gtk_widget_show (legend_table);
|
gtk_widget_show (legend_table);
|
||||||
gtk_container_border_width(GTK_CONTAINER(legend_table), 1);
|
|
||||||
|
|
||||||
/* Gray: Circle: Spinbutton 1 */
|
/* Gray: Circle: Spinbutton 1 */
|
||||||
|
label = gtk_label_new(_("Hue:"));
|
||||||
label = gtk_label_new(_("Hue"));
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||||
gtk_widget_show(label);
|
|
||||||
gtk_table_attach (GTK_TABLE (legend_table), label, 0, 1, 0, 1,
|
gtk_table_attach (GTK_TABLE (legend_table), label, 0, 1, 0, 1,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0, 2);
|
GTK_FILL, GTK_FILL, 0, 0);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
|
||||||
st->hue = INITIAL_GRAY_HUE;
|
st->hue = INITIAL_GRAY_HUE;
|
||||||
adj = (GtkAdjustment *) gtk_adjustment_new (st->hue, 0.0, 2.0, 0.0001, 0.001, 0.0);
|
adj = (GtkAdjustment *) gtk_adjustment_new (st->hue, 0.0, 2.0, 0.0001, 0.001, 0.0);
|
||||||
st->hue_entry = entry = gtk_spin_button_new (adj, 0.01, 4);
|
st->hue_entry = entry = gtk_spin_button_new (adj, 0.01, 4);
|
||||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON(entry), TRUE);
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON(entry), TRUE);
|
||||||
gtk_widget_set_usize (entry, 75, 0);
|
gtk_widget_set_usize (entry, 75, 0);
|
||||||
gtk_widget_show(entry);
|
gtk_signal_connect (GTK_OBJECT(entry), "changed",
|
||||||
gtk_signal_connect(GTK_OBJECT(entry), "changed", (GtkSignalFunc)rcm_set_hue, st);
|
(GtkSignalFunc) rcm_set_hue, st);
|
||||||
gtk_table_attach (GTK_TABLE (legend_table), entry, 1, 2, 0, 1,
|
gtk_table_attach (GTK_TABLE (legend_table), entry, 1, 2, 0, 1,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0 ,2);
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
|
||||||
|
gtk_widget_show (entry);
|
||||||
|
|
||||||
/* Gray: Circle: units label */
|
/* Gray: Circle: units label */
|
||||||
|
|
||||||
st->hue_units_label = gtk_label_new (rcm_units_string (Current.Units));
|
st->hue_units_label = gtk_label_new (rcm_units_string (Current.Units));
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||||
|
gtk_table_attach (GTK_TABLE (legend_table), st->hue_units_label, 2, 3, 0, 1,
|
||||||
|
GTK_EXPAND, GTK_EXPAND, 0, 0);
|
||||||
gtk_widget_show (st->hue_units_label);
|
gtk_widget_show (st->hue_units_label);
|
||||||
|
|
||||||
gtk_table_attach(GTK_TABLE(legend_table), st->hue_units_label, 2,3, 0,1,
|
|
||||||
GTK_EXPAND, GTK_EXPAND, 0, 2);
|
|
||||||
|
|
||||||
/* Gray: Circle: Spinbutton 2 */
|
/* Gray: Circle: Spinbutton 2 */
|
||||||
|
label = gtk_label_new (_("Saturation:"));
|
||||||
label = gtk_label_new(_("Saturation"));
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||||
gtk_widget_show(label);
|
|
||||||
gtk_table_attach (GTK_TABLE (legend_table), label, 0, 1, 1, 2,
|
gtk_table_attach (GTK_TABLE (legend_table), label, 0, 1, 1, 2,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0, 2);
|
GTK_FILL, GTK_FILL, 0, 0);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
|
||||||
st->satur = INITIAL_GRAY_SAT;
|
st->satur = INITIAL_GRAY_SAT;
|
||||||
adj = (GtkAdjustment *) gtk_adjustment_new (st->satur, 0.0, 1.0, 0.0001, 0.001, 0.0);
|
adj = (GtkAdjustment *) gtk_adjustment_new (st->satur, 0.0, 1.0, 0.0001, 0.001, 0.0);
|
||||||
st->satur_entry = entry = gtk_spin_button_new (adj, 0.01, 4);
|
st->satur_entry = entry = gtk_spin_button_new (adj, 0.01, 4);
|
||||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (entry), TRUE);
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (entry), TRUE);
|
||||||
gtk_widget_set_usize (entry, 75, 0);
|
gtk_widget_set_usize (entry, 75, 0);
|
||||||
gtk_widget_show(entry);
|
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||||
gtk_signal_connect(GTK_OBJECT(entry), "changed", (GtkSignalFunc)rcm_set_satur, st);
|
(GtkSignalFunc) rcm_set_satur, st);
|
||||||
gtk_table_attach (GTK_TABLE (legend_table), entry, 1, 2, 1, 2,
|
gtk_table_attach (GTK_TABLE (legend_table), entry, 1, 2, 1, 2,
|
||||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 2);
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 2);
|
||||||
|
gtk_widget_show (entry);
|
||||||
|
|
||||||
/** Gray: Operation-Mode **/
|
/** Gray: Operation-Mode **/
|
||||||
|
|
||||||
as_or_to_frame = gtk_frame_new (_("Mode"));
|
as_or_to_frame = gtk_frame_new (_("Mode"));
|
||||||
gtk_container_border_width (GTK_CONTAINER (as_or_to_frame), 4);
|
|
||||||
gtk_widget_show (as_or_to_frame);
|
gtk_widget_show (as_or_to_frame);
|
||||||
|
|
||||||
radio_box = gtk_vbox_new(FALSE, 3);
|
radio_box = gtk_vbox_new (FALSE, 2);
|
||||||
gtk_container_add (GTK_CONTAINER (as_or_to_frame), radio_box);
|
gtk_container_add (GTK_CONTAINER (as_or_to_frame), radio_box);
|
||||||
gtk_container_border_width(GTK_CONTAINER(radio_box), 4);
|
gtk_container_set_border_width (GTK_CONTAINER (radio_box), 4);
|
||||||
gtk_widget_show (radio_box);
|
gtk_widget_show (radio_box);
|
||||||
|
|
||||||
/* Gray: Operation-Mode: two radio buttons */
|
/* Gray: Operation-Mode: two radio buttons */
|
||||||
|
|
||||||
button = gtk_radio_button_new_with_label(group, _("Treat as this"));
|
button = gtk_radio_button_new_with_label(group, _("Treat as this"));
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gtk_box_pack_start(GTK_BOX(radio_box), button, TRUE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||||
if (Current.Gray_to_from == GRAY_FROM) gtk_button_clicked(GTK_BUTTON(button));
|
if (Current.Gray_to_from == GRAY_FROM)
|
||||||
|
gtk_button_clicked (GTK_BUTTON (button));
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||||
(GtkSignalFunc) rcm_switch_to_gray_from,
|
(GtkSignalFunc) rcm_switch_to_gray_from,
|
||||||
&(Current.Gray_to_from));
|
&(Current.Gray_to_from));
|
||||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||||
|
|
||||||
|
|
||||||
button = gtk_radio_button_new_with_label (group, _("Change to this"));
|
button = gtk_radio_button_new_with_label (group, _("Change to this"));
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gtk_box_pack_start(GTK_BOX(radio_box), button, TRUE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||||
if (Current.Gray_to_from == GRAY_TO) gtk_button_clicked(GTK_BUTTON(button));
|
if (Current.Gray_to_from == GRAY_TO)
|
||||||
|
gtk_button_clicked (GTK_BUTTON (button));
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||||
(GtkSignalFunc) rcm_switch_to_gray_to,
|
(GtkSignalFunc) rcm_switch_to_gray_to,
|
||||||
&(Current.Gray_to_from));
|
&(Current.Gray_to_from));
|
||||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||||
|
|
||||||
/** Gray: What is gray? **/
|
/** Gray: What is gray? **/
|
||||||
|
|
||||||
gray_sat_frame = gtk_frame_new(_("What is Gray?"));
|
gray_sat_frame = gtk_frame_new(_("What is Gray?"));
|
||||||
gtk_container_border_width(GTK_CONTAINER(gray_sat_frame), 4);
|
|
||||||
gtk_widget_show (gray_sat_frame);
|
gtk_widget_show (gray_sat_frame);
|
||||||
|
|
||||||
table = gtk_table_new (1, 3, FALSE);
|
table = gtk_table_new (1, 3, FALSE);
|
||||||
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
label = gtk_label_new(_("Saturation"));
|
label = gtk_label_new(_("Saturation"));
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0,0);
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||||
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
|
||||||
|
|
||||||
label = gtk_label_new ("<=");
|
label = gtk_label_new ("<=");
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1, GTK_EXPAND|GTK_FILL, GTK_EXPAND, 0,0);
|
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1,
|
||||||
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
|
||||||
|
|
||||||
st->gray_sat = INITIAL_GRAY_RSAT;
|
st->gray_sat = INITIAL_GRAY_RSAT;
|
||||||
adj = (GtkAdjustment *) gtk_adjustment_new (st->gray_sat, 0.0, 1.0, 0.0001, 0.001, 0.0);
|
adj = (GtkAdjustment *) gtk_adjustment_new (st->gray_sat, 0.0, 1.0, 0.0001, 0.001, 0.0);
|
||||||
|
@ -549,27 +523,31 @@ rcm_create_gray (void)
|
||||||
st->gray_sat_entry = entry = gtk_spin_button_new (adj, 0.01, 4);
|
st->gray_sat_entry = entry = gtk_spin_button_new (adj, 0.01, 4);
|
||||||
gtk_widget_set_usize (entry, 75, 0);
|
gtk_widget_set_usize (entry, 75, 0);
|
||||||
gtk_widget_show (entry);
|
gtk_widget_show (entry);
|
||||||
gtk_signal_connect(GTK_OBJECT(entry), "changed", (GtkSignalFunc)rcm_set_gray_sat, st);
|
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||||
gtk_table_attach(GTK_TABLE(table), entry, 2, 3, 0, 1, GTK_EXPAND|GTK_FILL, GTK_EXPAND, 2, 0);
|
(GtkSignalFunc) rcm_set_gray_sat, st);
|
||||||
|
gtk_table_attach (GTK_TABLE (table), entry, 2, 3, 0, 1,
|
||||||
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (gray_sat_frame), table);
|
gtk_container_add (GTK_CONTAINER (gray_sat_frame), table);
|
||||||
|
|
||||||
/** add all frames to table **/
|
/** add all frames to table **/
|
||||||
|
|
||||||
/* add preview and legend to table */
|
/* add preview and legend to table */
|
||||||
|
|
||||||
mini_table = gtk_table_new (2, 1, FALSE);
|
mini_table = gtk_table_new (2, 1, FALSE);
|
||||||
|
gtk_table_set_row_spacings (GTK_TABLE (mini_table), 4);
|
||||||
gtk_widget_show (mini_table);
|
gtk_widget_show (mini_table);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (mini_table), previewframe, 0, 1, 0, 1,
|
gtk_table_attach (GTK_TABLE (mini_table), previewframe, 0, 1, 0, 1,
|
||||||
GTK_EXPAND, GTK_EXPAND, 0, 0);
|
GTK_SHRINK, GTK_SHRINK, 0, 0);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (mini_table), legend_table, 0, 1, 1, 2,
|
gtk_table_attach (GTK_TABLE (mini_table), legend_table, 0, 1, 1, 2,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
|
GTK_SHRINK, GTK_SHRINK, 0, 0);
|
||||||
|
|
||||||
/* add mini_table & two frames to table */
|
/* add mini_table & two frames to table */
|
||||||
|
|
||||||
table = gtk_table_new (2, 2, FALSE);
|
table = gtk_table_new (2, 2, FALSE);
|
||||||
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
|
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), mini_table, 0, 1, 0, 2,
|
gtk_table_attach (GTK_TABLE (table), mini_table, 0, 1, 0, 2,
|
||||||
|
@ -584,15 +562,14 @@ rcm_create_gray (void)
|
||||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||||
|
|
||||||
/* update circle (preview) */
|
/* update circle (preview) */
|
||||||
|
|
||||||
rcm_render_circle (preview, GRAY_SUM, GRAY_MARGIN);
|
rcm_render_circle (preview, GRAY_SUM, GRAY_MARGIN);
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* Misc */
|
/* Misc */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
rcm_create_misc (void)
|
rcm_create_misc (void)
|
||||||
|
@ -607,58 +584,57 @@ rcm_create_misc (void)
|
||||||
GSList *preview_group = NULL;
|
GSList *preview_group = NULL;
|
||||||
|
|
||||||
/** Misc: Gray circle **/
|
/** Misc: Gray circle **/
|
||||||
|
|
||||||
Current.Gray = rcm_create_gray ();
|
Current.Gray = rcm_create_gray ();
|
||||||
|
|
||||||
/** Misc: Used unit selection **/
|
/** Misc: Used unit selection **/
|
||||||
|
|
||||||
units_frame = gtk_frame_new (_("Units"));
|
units_frame = gtk_frame_new (_("Units"));
|
||||||
gtk_widget_show (units_frame);
|
gtk_widget_show (units_frame);
|
||||||
|
|
||||||
units_vbox=gtk_vbox_new(FALSE, 3);
|
units_vbox = gtk_vbox_new (FALSE, 2);
|
||||||
gtk_container_add (GTK_CONTAINER (units_frame), units_vbox);
|
gtk_container_add (GTK_CONTAINER (units_frame), units_vbox);
|
||||||
gtk_container_border_width(GTK_CONTAINER(units_vbox), 4);
|
gtk_container_set_border_width (GTK_CONTAINER (units_vbox), 4);
|
||||||
gtk_widget_show (units_vbox);
|
gtk_widget_show (units_vbox);
|
||||||
|
|
||||||
/* Misc: Used unit selection: 3 radio buttons */
|
/* Misc: Used unit selection: 3 radio buttons */
|
||||||
|
button = gtk_radio_button_new_with_label (units_group, _("Radians"));
|
||||||
button = gtk_radio_button_new_with_label(units_group, N_("Radians"));
|
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gtk_box_pack_start(GTK_BOX(units_vbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (units_vbox), button, FALSE, FALSE, 0);
|
||||||
if (Current.Units == RADIANS) gtk_button_clicked(GTK_BUTTON(button));
|
if (Current.Units == RADIANS)
|
||||||
|
gtk_button_clicked (GTK_BUTTON (button));
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||||
(GtkSignalFunc) rcm_switch_to_radians, NULL);
|
(GtkSignalFunc) rcm_switch_to_radians, NULL);
|
||||||
units_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
units_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||||
|
|
||||||
button = gtk_radio_button_new_with_label(units_group, N_("Radians/Pi"));
|
button = gtk_radio_button_new_with_label (units_group, _("Radians/Pi"));
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gtk_box_pack_start(GTK_BOX(units_vbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (units_vbox), button, FALSE, FALSE, 0);
|
||||||
if (Current.Units == RADIANS_OVER_PI) gtk_button_clicked(GTK_BUTTON(button));
|
if (Current.Units == RADIANS_OVER_PI)
|
||||||
|
gtk_button_clicked (GTK_BUTTON (button));
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||||
(GtkSignalFunc) rcm_switch_to_radians_over_PI, NULL);
|
(GtkSignalFunc) rcm_switch_to_radians_over_PI, NULL);
|
||||||
units_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
units_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||||
|
|
||||||
button = gtk_radio_button_new_with_label(units_group, N_("Degrees"));
|
button = gtk_radio_button_new_with_label (units_group, _("Degrees"));
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
gtk_box_pack_start(GTK_BOX(units_vbox), button, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (units_vbox), button, FALSE, FALSE, 0);
|
||||||
if (Current.Units == DEGREES) gtk_button_clicked(GTK_BUTTON(button));
|
if (Current.Units == DEGREES)
|
||||||
|
gtk_button_clicked (GTK_BUTTON (button));
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||||
(GtkSignalFunc) rcm_switch_to_degrees, NULL);
|
(GtkSignalFunc) rcm_switch_to_degrees, NULL);
|
||||||
|
|
||||||
/** Misc: Preview settings **/
|
/** Misc: Preview settings **/
|
||||||
|
|
||||||
/* Misc: Preview settings: Continuous update ?! */
|
/* Misc: Preview settings: Continuous update ?! */
|
||||||
|
|
||||||
preview_frame = gtk_frame_new (_("Preview"));
|
preview_frame = gtk_frame_new (_("Preview"));
|
||||||
preview_vbox = gtk_vbox_new (FALSE, 4);
|
preview_vbox = gtk_vbox_new (FALSE, 4);
|
||||||
gtk_container_border_width(GTK_CONTAINER(preview_vbox), 4);
|
gtk_container_set_border_width (GTK_CONTAINER (preview_vbox), 4);
|
||||||
gtk_widget_show (preview_vbox);
|
gtk_widget_show (preview_vbox);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (preview_frame), preview_vbox);
|
gtk_container_add (GTK_CONTAINER (preview_frame), preview_vbox);
|
||||||
gtk_widget_show (preview_frame);
|
gtk_widget_show (preview_frame);
|
||||||
|
|
||||||
button = gtk_check_button_new_with_label (_("Continuous update"));
|
button = gtk_check_button_new_with_label (_("Continuous update"));
|
||||||
gtk_box_pack_start(GTK_BOX(preview_vbox), button, TRUE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(preview_vbox), button, FALSE, FALSE, 0);
|
||||||
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), Current.RealTime);
|
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), Current.RealTime);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||||
|
@ -668,34 +644,32 @@ rcm_create_misc (void)
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
|
||||||
/* Misc: Preview settings: Area */
|
/* Misc: Preview settings: Area */
|
||||||
|
hbox = gtk_hbox_new (FALSE, 4);
|
||||||
hbox = gtk_hbox_new(FALSE,2);
|
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
gtk_box_pack_start(GTK_BOX(preview_vbox), hbox, TRUE, FALSE, 4);
|
gtk_box_pack_start (GTK_BOX (preview_vbox), hbox, FALSE, FALSE, 4);
|
||||||
|
|
||||||
label = gtk_label_new(_("Area"));
|
label = gtk_label_new (_("Area:"));
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 4);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
/* create menu entries */
|
/* create menu entries */
|
||||||
|
|
||||||
menu = gtk_menu_new ();
|
menu = gtk_menu_new ();
|
||||||
|
|
||||||
item = gtk_radio_menu_item_new_with_label(preview_group, N_("Entire Image"));
|
item = gtk_radio_menu_item_new_with_label (preview_group, _("Entire Image"));
|
||||||
preview_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
preview_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||||
gtk_menu_append (GTK_MENU (menu), item);
|
gtk_menu_append (GTK_MENU (menu), item);
|
||||||
gtk_widget_show (item);
|
gtk_widget_show (item);
|
||||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||||
(GtkSignalFunc) rcm_entire_image, NULL);
|
(GtkSignalFunc) rcm_entire_image, NULL);
|
||||||
|
|
||||||
item = gtk_radio_menu_item_new_with_label(preview_group, N_("Selection"));
|
item = gtk_radio_menu_item_new_with_label (preview_group, _("Selection"));
|
||||||
preview_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
preview_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||||
gtk_menu_append (GTK_MENU (menu), item);
|
gtk_menu_append (GTK_MENU (menu), item);
|
||||||
gtk_widget_show (item);
|
gtk_widget_show (item);
|
||||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||||
(GtkSignalFunc) rcm_selection, NULL);
|
(GtkSignalFunc) rcm_selection, NULL);
|
||||||
|
|
||||||
item = gtk_radio_menu_item_new_with_label(preview_group, N_("Context"));
|
item = gtk_radio_menu_item_new_with_label (preview_group, _("Context"));
|
||||||
preview_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
preview_group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
|
||||||
gtk_widget_show (item);
|
gtk_widget_show (item);
|
||||||
gtk_menu_append (GTK_MENU (menu), item);
|
gtk_menu_append (GTK_MENU (menu), item);
|
||||||
|
@ -703,7 +677,6 @@ rcm_create_misc (void)
|
||||||
(GtkSignalFunc) rcm_selection_in_context, NULL);
|
(GtkSignalFunc) rcm_selection_in_context, NULL);
|
||||||
|
|
||||||
/* create (options) menu */
|
/* create (options) menu */
|
||||||
|
|
||||||
root = gtk_option_menu_new ();
|
root = gtk_option_menu_new ();
|
||||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (root), menu);
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (root), menu);
|
||||||
gtk_option_menu_set_history (GTK_OPTION_MENU (root), 4);
|
gtk_option_menu_set_history (GTK_OPTION_MENU (root), 4);
|
||||||
|
@ -712,36 +685,34 @@ rcm_create_misc (void)
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), root, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), root, FALSE, FALSE, 0);
|
||||||
|
|
||||||
table = gtk_table_new (2, 2, FALSE);
|
table = gtk_table_new (2, 2, FALSE);
|
||||||
gtk_widget_show(table);
|
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||||
gtk_container_border_width(GTK_CONTAINER(table),0);
|
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||||
|
|
||||||
/** add frames (gray/preview/units) to table **/
|
/** add frames (gray/preview/units) to table **/
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), Current.Gray->frame, 0, 2, 0, 1,
|
gtk_table_attach (GTK_TABLE (table), Current.Gray->frame, 0, 2, 0, 1,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 4);
|
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), preview_frame, 0, 1, 1, 2,
|
gtk_table_attach (GTK_TABLE (table), preview_frame, 0, 1, 1, 2,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 4);
|
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), units_frame, 1, 2, 1, 2,
|
gtk_table_attach (GTK_TABLE (table), units_frame, 1, 2, 1, 2,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_FILL, 4, 4);
|
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
|
||||||
|
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* create and call main dialog */
|
/* create and call main dialog */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
gint
|
gint
|
||||||
rcm_dialog (void)
|
rcm_dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *table, *dlg, *hbox, *notebook;
|
GtkWidget *table, *dlg, *hbox, *notebook;
|
||||||
GtkWidget *previews, *mains, *miscs;
|
GtkWidget *previews, *mains, *miscs;
|
||||||
GtkWidget *hbbox;
|
|
||||||
GtkWidget *button;
|
|
||||||
|
|
||||||
guchar *color_cube;
|
guchar *color_cube;
|
||||||
gchar **argv;
|
gchar **argv;
|
||||||
|
@ -754,7 +725,6 @@ rcm_dialog (void)
|
||||||
Current.Bna = g_new (RcmBna, 1);
|
Current.Bna = g_new (RcmBna, 1);
|
||||||
|
|
||||||
/* init GTK and install colormap */
|
/* init GTK and install colormap */
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
gtk_rc_parse (gimp_gtkrc ());
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
|
||||||
|
@ -769,40 +739,25 @@ rcm_dialog (void)
|
||||||
|
|
||||||
/* Create dialog */
|
/* Create dialog */
|
||||||
|
|
||||||
dlg = gtk_dialog_new();
|
dlg = gimp_dialog_new (_("Colormap Rotation"), "rcm",
|
||||||
|
gimp_plugin_help_func, "filters/rcm.html",
|
||||||
|
GTK_WIN_POS_MOUSE,
|
||||||
|
FALSE, TRUE, FALSE,
|
||||||
|
|
||||||
|
_("OK"), rcm_ok_callback,
|
||||||
|
NULL, NULL, NULL, TRUE, FALSE,
|
||||||
|
_("Cancel"), gtk_widget_destroy,
|
||||||
|
NULL, 1, NULL, FALSE, TRUE,
|
||||||
|
|
||||||
|
NULL);
|
||||||
|
|
||||||
Current.Bna->dlg = dlg;
|
Current.Bna->dlg = dlg;
|
||||||
|
|
||||||
gtk_window_set_title(GTK_WINDOW(dlg), _("Colormap Rotation"));
|
|
||||||
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
(GtkSignalFunc) rcm_close_callback, NULL);
|
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) rcm_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);
|
|
||||||
|
|
||||||
/* Create sub-dialogs */
|
/* Create sub-dialogs */
|
||||||
|
|
||||||
Current.reduced = rcm_reduce_image (Current.drawable, Current.mask,
|
Current.reduced = rcm_reduce_image (Current.drawable, Current.mask,
|
||||||
MAX_PREVIEW_SIZE, ENTIRE_IMAGE);
|
MAX_PREVIEW_SIZE, ENTIRE_IMAGE);
|
||||||
previews = rcm_create_previews ();
|
previews = rcm_create_previews ();
|
||||||
|
@ -814,41 +769,37 @@ rcm_dialog (void)
|
||||||
rcm_render_preview (Current.Bna->after, CURRENT);
|
rcm_render_preview (Current.Bna->after, CURRENT);
|
||||||
|
|
||||||
/* H-Box */
|
/* H-Box */
|
||||||
|
hbox = gtk_hbox_new (FALSE, 6);
|
||||||
hbox = gtk_hbox_new(FALSE, 2);
|
gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
||||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dlg)->vbox), hbox, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dlg)->vbox), hbox, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (hbox);
|
gtk_widget_show (hbox);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX(hbox), previews, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX(hbox), previews, TRUE, TRUE, 0);
|
||||||
|
|
||||||
/* Notebook */
|
/* Notebook */
|
||||||
|
|
||||||
notebook = gtk_notebook_new ();
|
notebook = gtk_notebook_new ();
|
||||||
gtk_container_border_width(GTK_CONTAINER(notebook), 4);
|
|
||||||
gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
|
gtk_notebook_set_tab_pos (GTK_NOTEBOOK(notebook), GTK_POS_TOP);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (notebook);
|
gtk_widget_show (notebook);
|
||||||
|
|
||||||
table = gtk_table_new (1, 2, FALSE);
|
table = gtk_table_new (1, 2, FALSE);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
gtk_table_attach (GTK_TABLE (table), mains, 1, 2, 0, 1,
|
gtk_table_attach (GTK_TABLE (table), mains, 1, 2, 0, 1,
|
||||||
GTK_EXPAND|GTK_FILL, GTK_EXPAND|GTK_FILL, 4, 0);
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
|
||||||
|
|
||||||
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, gtk_label_new(_("Main")));
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), table,
|
||||||
|
gtk_label_new (_("Main")));
|
||||||
|
|
||||||
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), miscs, gtk_label_new(_("Misc")));
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), miscs,
|
||||||
|
gtk_label_new (_("Misc")));
|
||||||
/* show dialog */
|
|
||||||
|
|
||||||
gtk_widget_show (dlg);
|
gtk_widget_show (dlg);
|
||||||
|
|
||||||
/* set pixmaps */
|
|
||||||
|
|
||||||
rcm_set_pixmaps (Current.From);
|
rcm_set_pixmaps (Current.From);
|
||||||
rcm_set_pixmaps (Current.To);
|
rcm_set_pixmaps (Current.To);
|
||||||
|
|
||||||
/* Flush display, start main-loop */
|
|
||||||
|
|
||||||
gdk_flush ();
|
gdk_flush ();
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* Please send any patches or suggestions to me: Xavier.Bouchoux@ensimag.imag.fr.
|
* Please send any patches or suggestions to me: Xavier.Bouchoux@ensimag.imag.fr.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* Version 0.99 */
|
/* Version 0.99 */
|
||||||
|
|
||||||
#define USE_LOGO
|
#define USE_LOGO
|
||||||
|
@ -36,15 +35,18 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include "libgimp/gimpui.h"
|
#include <libgimp/gimpui.h>
|
||||||
#include "libgimp/stdplugins-intl.h"
|
#include <libgimp/gimpmath.h>
|
||||||
|
|
||||||
#include <plug-ins/megawidget/megawidget.h>
|
#include <plug-ins/megawidget/megawidget.h>
|
||||||
|
|
||||||
|
#include "libgimp/stdplugins-intl.h"
|
||||||
|
|
||||||
#ifdef USE_LOGO
|
#ifdef USE_LOGO
|
||||||
#include "sinus_logo.h"
|
#include "sinus_logo.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -71,7 +73,8 @@
|
||||||
#define IDEAL 0L /* Perturbation settings */
|
#define IDEAL 0L /* Perturbation settings */
|
||||||
#define PERTURBED 1L
|
#define PERTURBED 1L
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
gdouble scalex;
|
gdouble scalex;
|
||||||
gdouble scaley;
|
gdouble scaley;
|
||||||
gdouble cmplx;
|
gdouble cmplx;
|
||||||
|
@ -86,10 +89,22 @@ typedef struct {
|
||||||
} SinusVals;
|
} SinusVals;
|
||||||
|
|
||||||
static SinusVals svals =
|
static SinusVals svals =
|
||||||
{ 15.0, 15.0, 1.0, 0.0, 42, TRUE, PERTURBED, LINEAR,
|
{
|
||||||
USE_COLORS, { 255, 255, 0, 255 }, { 0, 0, 255, 255 } };
|
15.0,
|
||||||
|
15.0,
|
||||||
|
1.0,
|
||||||
|
0.0,
|
||||||
|
42,
|
||||||
|
TRUE,
|
||||||
|
PERTURBED,
|
||||||
|
LINEAR,
|
||||||
|
USE_COLORS,
|
||||||
|
{ 255, 255, 0, 255 },
|
||||||
|
{ 0, 0, 255, 255 }
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
gint height, width;
|
gint height, width;
|
||||||
double c11,c12,c13, c21,c22,c23, c31,c32,c33;
|
double c11,c12,c13, c21,c22,c23, c31,c32,c33;
|
||||||
double (*blend) (double );
|
double (*blend) (double );
|
||||||
|
@ -104,26 +119,29 @@ static GDrawable *drawable;
|
||||||
|
|
||||||
/* Declare functions */
|
/* Declare functions */
|
||||||
|
|
||||||
static void query ();
|
static void query (void);
|
||||||
static void run (gchar *name,
|
static void run (gchar *name,
|
||||||
gint nparams,
|
gint nparams,
|
||||||
GParam *param,
|
GParam *param,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GParam **return_vals);
|
GParam **return_vals);
|
||||||
static void sinus();
|
static void sinus (void);
|
||||||
|
|
||||||
double frac( double v );
|
static gdouble linear (gdouble v);
|
||||||
double linear (double v);
|
static gdouble bilinear (gdouble v);
|
||||||
double bilinear(double v);
|
static gdouble cosinus (gdouble v);
|
||||||
double cosinus(double v);
|
|
||||||
int sinus_dialog(void);
|
|
||||||
void sinus_do_preview(GtkWidget *w);
|
|
||||||
|
|
||||||
void DrawPreviewImage(gint DoCompute);
|
static gint sinus_dialog (void);
|
||||||
inline void compute_block_4(guchar *dest_row, guint rowstride,gint x0,gint y0,gint h,gint w, params *p);
|
static void sinus_do_preview (GtkWidget *widget);
|
||||||
inline void compute_block_3(guchar *dest_row, guint rowstride,gint x0,gint y0,gint h,gint w, params *p);
|
|
||||||
inline void compute_block_2(guchar *dest_row, guint rowstride,gint x0,gint y0,gint h,gint w, params *p);
|
inline void compute_block_4 (guchar *dest_row, guint rowstride,
|
||||||
inline void compute_block_1(guchar *dest_row, guint rowstride,gint x0,gint y0,gint h,gint w, params *p);
|
gint x0, gint y0, gint h, gint w, params *p);
|
||||||
|
inline void compute_block_3 (guchar *dest_row, guint rowstride,
|
||||||
|
gint x0, gint y0, gint h, gint w, params *p);
|
||||||
|
inline void compute_block_2 (guchar *dest_row, guint rowstride,
|
||||||
|
gint x0, gint y0, gint h, gint w, params *p);
|
||||||
|
inline void compute_block_1 (guchar *dest_row, guint rowstride,
|
||||||
|
gint x0, gint y0, gint h, gint w, params *p);
|
||||||
|
|
||||||
GPlugInInfo PLUG_IN_INFO =
|
GPlugInInfo PLUG_IN_INFO =
|
||||||
{
|
{
|
||||||
|
@ -133,11 +151,10 @@ GPlugInInfo PLUG_IN_INFO =
|
||||||
run, /* run_proc */
|
run, /* run_proc */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MAIN ()
|
MAIN ()
|
||||||
|
|
||||||
|
static void
|
||||||
static void query ()
|
query (void)
|
||||||
{
|
{
|
||||||
static GParamDef args[] =
|
static GParamDef args[] =
|
||||||
{
|
{
|
||||||
|
@ -258,7 +275,9 @@ run (gchar *name,
|
||||||
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
drawable = gimp_drawable_get (param[2].data.d_drawable);
|
||||||
|
|
||||||
/* Make sure that the drawable is gray or RGB */
|
/* Make sure that the drawable is gray or RGB */
|
||||||
if (( status == STATUS_SUCCESS) && (gimp_drawable_is_rgb (drawable->id) || gimp_drawable_is_gray (drawable->id)))
|
if ((status == STATUS_SUCCESS) &&
|
||||||
|
(gimp_drawable_is_rgb (drawable->id) ||
|
||||||
|
gimp_drawable_is_gray (drawable->id)))
|
||||||
{
|
{
|
||||||
gimp_progress_init ("Calculating picture...");
|
gimp_progress_init ("Calculating picture...");
|
||||||
gimp_tile_cache_ntiles (1);
|
gimp_tile_cache_ntiles (1);
|
||||||
|
@ -294,7 +313,8 @@ prepare_coef (params *p)
|
||||||
double scaley=svals.scaley;
|
double scaley=svals.scaley;
|
||||||
|
|
||||||
srand(svals.seed);
|
srand(svals.seed);
|
||||||
switch (svals.colorization) {
|
switch (svals.colorization)
|
||||||
|
{
|
||||||
case BILINEAR:
|
case BILINEAR:
|
||||||
p->blend = bilinear;
|
p->blend = bilinear;
|
||||||
break;
|
break;
|
||||||
|
@ -306,7 +326,8 @@ prepare_coef (params *p)
|
||||||
p->blend = linear;
|
p->blend = linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (svals.perturbation==IDEAL) {
|
if (svals.perturbation==IDEAL)
|
||||||
|
{
|
||||||
p->c11= 0*rand();
|
p->c11= 0*rand();
|
||||||
p->c12= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley; /*rand+rand is used to keep */
|
p->c12= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley; /*rand+rand is used to keep */
|
||||||
p->c13= (2*G_PI*rand())/RAND_MAX;
|
p->c13= (2*G_PI*rand())/RAND_MAX;
|
||||||
|
@ -316,7 +337,9 @@ prepare_coef (params *p)
|
||||||
p->c31= (2.0*rand()/(RAND_MAX+1.0)-1)*scalex; /*and perturbed coefs (I hope...)*/
|
p->c31= (2.0*rand()/(RAND_MAX+1.0)-1)*scalex; /*and perturbed coefs (I hope...)*/
|
||||||
p->c32= 0*rand();
|
p->c32= 0*rand();
|
||||||
p->c33= (2*G_PI*rand())/RAND_MAX;
|
p->c33= (2*G_PI*rand())/RAND_MAX;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
p->c11= (2.0*rand()/(RAND_MAX+1.0)-1)*scalex;
|
p->c11= (2.0*rand()/(RAND_MAX+1.0)-1)*scalex;
|
||||||
p->c12= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley;
|
p->c12= (2.0*rand()/(RAND_MAX+1.0)-1)*scaley;
|
||||||
p->c13= (2*G_PI*rand())/RAND_MAX;
|
p->c13= (2*G_PI*rand())/RAND_MAX;
|
||||||
|
@ -328,7 +351,8 @@ prepare_coef (params *p)
|
||||||
p->c33= (2*G_PI*rand())/RAND_MAX;
|
p->c33= (2*G_PI*rand())/RAND_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (svals.tiling) {
|
if (svals.tiling)
|
||||||
|
{
|
||||||
p->c11= ROUND_TO_INT(p->c11/(2*G_PI))*2*G_PI;
|
p->c11= ROUND_TO_INT(p->c11/(2*G_PI))*2*G_PI;
|
||||||
p->c12= ROUND_TO_INT(p->c12/(2*G_PI))*2*G_PI;
|
p->c12= ROUND_TO_INT(p->c12/(2*G_PI))*2*G_PI;
|
||||||
p->c21= ROUND_TO_INT(p->c21/(2*G_PI))*2*G_PI;
|
p->c21= ROUND_TO_INT(p->c21/(2*G_PI))*2*G_PI;
|
||||||
|
@ -340,11 +364,15 @@ prepare_coef (params *p)
|
||||||
col2.a=svals.col2[3];
|
col2.a=svals.col2[3];
|
||||||
col1.a=svals.col1[3];
|
col1.a=svals.col1[3];
|
||||||
|
|
||||||
if (drawable_is_grayscale) {
|
if (drawable_is_grayscale)
|
||||||
|
{
|
||||||
col1.r=col1.g=col1.b=255;
|
col1.r=col1.g=col1.b=255;
|
||||||
col2.r=col2.g=col2.b=0;
|
col2.r=col2.g=col2.b=0;
|
||||||
} else {
|
}
|
||||||
switch (svals.colors) {
|
else
|
||||||
|
{
|
||||||
|
switch (svals.colors)
|
||||||
|
{
|
||||||
case USE_COLORS:
|
case USE_COLORS:
|
||||||
col1.r=svals.col1[0];
|
col1.r=svals.col1[0];
|
||||||
col1.g=svals.col1[1];
|
col1.g=svals.col1[1];
|
||||||
|
@ -371,11 +399,10 @@ prepare_coef (params *p)
|
||||||
p->dg=(int)col2.g-col1.g;
|
p->dg=(int)col2.g-col1.g;
|
||||||
p->db=(int)col2.b-col1.b;
|
p->db=(int)col2.b-col1.b;
|
||||||
p->da=(int)col2.a-col1.a;
|
p->da=(int)col2.a-col1.a;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sinus ()
|
sinus (void)
|
||||||
{
|
{
|
||||||
params p;
|
params p;
|
||||||
gint bytes;
|
gint bytes;
|
||||||
|
@ -396,53 +423,59 @@ sinus ()
|
||||||
progress = 0;
|
progress = 0;
|
||||||
max_progress = (ix2-ix1)*(iy2-iy1);
|
max_progress = (ix2-ix1)*(iy2-iy1);
|
||||||
|
|
||||||
for (pr= gimp_pixel_rgns_register(1, &dest_rgn); pr != NULL; pr = gimp_pixel_rgns_process(pr)) {
|
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
|
||||||
switch (bytes) {
|
pr != NULL;
|
||||||
|
pr = gimp_pixel_rgns_process (pr))
|
||||||
|
{
|
||||||
|
switch (bytes)
|
||||||
|
{
|
||||||
case 4:
|
case 4:
|
||||||
compute_block_4(dest_rgn.data, dest_rgn.rowstride, dest_rgn.x, dest_rgn.y, dest_rgn.w, dest_rgn.h, &p);
|
compute_block_4 (dest_rgn.data, dest_rgn.rowstride,
|
||||||
|
dest_rgn.x, dest_rgn.y, dest_rgn.w, dest_rgn.h, &p);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
compute_block_3(dest_rgn.data, dest_rgn.rowstride, dest_rgn.x, dest_rgn.y, dest_rgn.w, dest_rgn.h, &p);
|
compute_block_3 (dest_rgn.data, dest_rgn.rowstride,
|
||||||
|
dest_rgn.x, dest_rgn.y, dest_rgn.w, dest_rgn.h, &p);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
compute_block_2(dest_rgn.data, dest_rgn.rowstride, dest_rgn.x, dest_rgn.y, dest_rgn.w, dest_rgn.h, &p);
|
compute_block_2 (dest_rgn.data, dest_rgn.rowstride,
|
||||||
|
dest_rgn.x, dest_rgn.y, dest_rgn.w, dest_rgn.h, &p);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
compute_block_1(dest_rgn.data, dest_rgn.rowstride, dest_rgn.x, dest_rgn.y, dest_rgn.w, dest_rgn.h, &p);
|
compute_block_1 (dest_rgn.data, dest_rgn.rowstride,
|
||||||
|
dest_rgn.x, dest_rgn.y, dest_rgn.w, dest_rgn.h, &p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
progress += dest_rgn.w * dest_rgn.h;
|
progress += dest_rgn.w * dest_rgn.h;
|
||||||
gimp_progress_update ((double) progress / (double) max_progress);
|
gimp_progress_update ((double) progress / (double) max_progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gimp_drawable_flush (drawable);
|
gimp_drawable_flush (drawable);
|
||||||
gimp_drawable_merge_shadow (drawable->id, TRUE);
|
gimp_drawable_merge_shadow (drawable->id, TRUE);
|
||||||
gimp_drawable_update (drawable->id, ix1, iy1, (ix2-ix1), (iy2-iy1));
|
gimp_drawable_update (drawable->id, ix1, iy1, (ix2-ix1), (iy2-iy1));
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
gdouble
|
||||||
linear (double v)
|
linear (gdouble v)
|
||||||
{
|
{
|
||||||
register double a = v - (int) v;
|
register double a = v - (int) v;
|
||||||
return (a < 0 ? 1.0 + a : a);
|
return (a < 0 ? 1.0 + a : a);
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
gdouble
|
||||||
bilinear (double v)
|
bilinear (gdouble v)
|
||||||
{
|
{
|
||||||
register double a = v - (int) v;
|
register double a = v - (int) v;
|
||||||
a = (a < 0 ? 1.0 + a : a);
|
a = (a < 0 ? 1.0 + a : a);
|
||||||
return (a > 0.5 ? 2 - 2 * a : 2 * a);
|
return (a > 0.5 ? 2 - 2 * a : 2 * a);
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
gdouble
|
||||||
cosinus (double v)
|
cosinus (gdouble v)
|
||||||
{
|
{
|
||||||
return 0.5-0.5*sin((v+0.25)*G_PI*2);
|
return 0.5-0.5*sin((v+0.25)*G_PI*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
compute_block_4 (guchar *dest_row,
|
compute_block_4 (guchar *dest_row,
|
||||||
guint rowstride,
|
guint rowstride,
|
||||||
|
@ -456,10 +489,12 @@ compute_block_4 (guchar *dest_row,
|
||||||
double x,y, grey;
|
double x,y, grey;
|
||||||
guchar *dest;
|
guchar *dest;
|
||||||
|
|
||||||
for (j=y0; j<(y0+h); j++) {
|
for (j = y0; j < (y0 + h); j++)
|
||||||
|
{
|
||||||
y=((double)j)/p->height;
|
y=((double)j)/p->height;
|
||||||
dest = dest_row;
|
dest = dest_row;
|
||||||
for (i= x0; i<(x0+w); i++) {
|
for (i= x0; i<(x0+w); i++)
|
||||||
|
{
|
||||||
x=((double)i)/p->width;
|
x=((double)i)/p->width;
|
||||||
|
|
||||||
grey = sin(p->c11*x + p->c12*y + p->c13) * (0.5+0.5*sin(p->c31*x + p->c32*y +p->c33)) \
|
grey = sin(p->c11*x + p->c12*y + p->c13) * (0.5+0.5*sin(p->c31*x + p->c32*y +p->c33)) \
|
||||||
|
@ -487,10 +522,13 @@ compute_block_3 (guchar *dest_row,
|
||||||
gint i,j;
|
gint i,j;
|
||||||
double x,y, grey;
|
double x,y, grey;
|
||||||
guchar *dest;
|
guchar *dest;
|
||||||
for (j=y0; j<(y0+h); j++) {
|
|
||||||
|
for (j=y0; j<(y0+h); j++)
|
||||||
|
{
|
||||||
y=((double)j)/p->height;
|
y=((double)j)/p->height;
|
||||||
dest = dest_row;
|
dest = dest_row;
|
||||||
for (i= x0; i<(x0+w); i++) {
|
for (i= x0; i<(x0+w); i++)
|
||||||
|
{
|
||||||
x=((double)i)/p->width;
|
x=((double)i)/p->width;
|
||||||
|
|
||||||
grey = sin(p->c11*x + p->c12*y + p->c13) * (0.5+0.5*sin(p->c31*x + p->c32*y +p->c33)) \
|
grey = sin(p->c11*x + p->c12*y + p->c13) * (0.5+0.5*sin(p->c31*x + p->c32*y +p->c33)) \
|
||||||
|
@ -518,10 +556,12 @@ compute_block_2 (guchar *dest_row,
|
||||||
double x,y, grey;
|
double x,y, grey;
|
||||||
guchar *dest;
|
guchar *dest;
|
||||||
|
|
||||||
for (j=y0; j<(y0+h); j++) {
|
for (j=y0; j<(y0+h); j++)
|
||||||
|
{
|
||||||
y=((double)j)/p->height;
|
y=((double)j)/p->height;
|
||||||
dest = dest_row;
|
dest = dest_row;
|
||||||
for (i= x0; i<(x0+w); i++) {
|
for (i= x0; i<(x0+w); i++)
|
||||||
|
{
|
||||||
x=((double)i)/p->width;
|
x=((double)i)/p->width;
|
||||||
|
|
||||||
grey = sin(p->c11*x + p->c12*y + p->c13) * (0.5+0.5*sin(p->c31*x + p->c32*y +p->c33)) \
|
grey = sin(p->c11*x + p->c12*y + p->c13) * (0.5+0.5*sin(p->c31*x + p->c32*y +p->c33)) \
|
||||||
|
@ -548,10 +588,12 @@ compute_block_1 (guchar *dest_row,
|
||||||
double x,y, grey;
|
double x,y, grey;
|
||||||
guchar *dest;
|
guchar *dest;
|
||||||
|
|
||||||
for (j=y0; j<(y0+h); j++) {
|
for (j=y0; j<(y0+h); j++)
|
||||||
|
{
|
||||||
y=((double)j)/p->height;
|
y=((double)j)/p->height;
|
||||||
dest = dest_row;
|
dest = dest_row;
|
||||||
for (i= x0; i<(x0+w); i++) {
|
for (i= x0; i<(x0+w); i++)
|
||||||
|
{
|
||||||
x=((double)i)/p->width;
|
x=((double)i)/p->width;
|
||||||
|
|
||||||
grey = sin(p->c11*x + p->c12*y + p->c13) * (0.5+0.5*sin(p->c31*x + p->c32*y +p->c33)) \
|
grey = sin(p->c11*x + p->c12*y + p->c13) * (0.5+0.5*sin(p->c31*x + p->c32*y +p->c33)) \
|
||||||
|
@ -564,12 +606,10 @@ compute_block_1 (guchar *dest_row,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------*/
|
/* ---------------------------------------------------------------*/
|
||||||
/* -------------------------- UI ------------------------------- */
|
/* -------------------------- UI ------------------------------- */
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alpha_scale_cb (GtkAdjustment *adj,
|
alpha_scale_cb (GtkAdjustment *adj,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -601,16 +641,26 @@ alpha_scale_update (GtkWidget *color_button,
|
||||||
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adj), data);
|
gtk_signal_handler_unblock_by_data (GTK_OBJECT (adj), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean run_flag = FALSE;
|
||||||
|
|
||||||
|
static void
|
||||||
|
sinus_ok_callback (GtkWidget *widget,
|
||||||
|
gpointer data)
|
||||||
|
{
|
||||||
|
run_flag = TRUE;
|
||||||
|
|
||||||
|
gtk_widget_destroy (GTK_WIDGET (data));
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
/* The note book */
|
/* The note book */
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
int
|
|
||||||
|
gint
|
||||||
sinus_dialog (void)
|
sinus_dialog (void)
|
||||||
{
|
{
|
||||||
GtkWidget *dlg;
|
GtkWidget *dlg;
|
||||||
GtkWidget *preview;
|
GtkWidget *preview;
|
||||||
gint runp;
|
|
||||||
GtkWidget *main_hbox, *notebook;
|
GtkWidget *main_hbox, *notebook;
|
||||||
GtkWidget *page,*frame, *label, *vbox, *hbox, *table;
|
GtkWidget *page,*frame, *label, *vbox, *hbox, *table;
|
||||||
GtkWidget *push_col1 = NULL;
|
GtkWidget *push_col1 = NULL;
|
||||||
|
@ -648,21 +698,38 @@ sinus_dialog (void)
|
||||||
argc = 1;
|
argc = 1;
|
||||||
argv = g_new (gchar *, 1);
|
argv = g_new (gchar *, 1);
|
||||||
argv[0] = g_strdup ("sinus");
|
argv[0] = g_strdup ("sinus");
|
||||||
|
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
gtk_rc_parse (gimp_gtkrc ());
|
gtk_rc_parse (gimp_gtkrc ());
|
||||||
|
|
||||||
/* Create Main window with a vbox */
|
/* Create Main window with a vbox */
|
||||||
/* ============================== */
|
/* ============================== */
|
||||||
dlg = mw_app_new("plug_in_sinus", _("Sinus"), &runp);
|
dlg = gimp_dialog_new (_("Sinus"), "sinus",
|
||||||
main_hbox = gtk_hbox_new(FALSE, 5);
|
gimp_plugin_help_func, "filters/sinus.html",
|
||||||
gtk_container_border_width(GTK_CONTAINER(main_hbox), 5);
|
GTK_WIN_POS_MOUSE,
|
||||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->vbox), main_hbox, TRUE, TRUE, 0);
|
FALSE, TRUE, FALSE,
|
||||||
|
|
||||||
|
_("OK"), sinus_ok_callback,
|
||||||
|
NULL, NULL, NULL, TRUE, FALSE,
|
||||||
|
_("Cancel"), gtk_widget_destroy,
|
||||||
|
NULL, 1, NULL, FALSE, TRUE,
|
||||||
|
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
|
||||||
|
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
main_hbox = gtk_hbox_new (FALSE, 6);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (main_hbox), 6);
|
||||||
|
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), main_hbox,
|
||||||
|
TRUE, TRUE, 0);
|
||||||
gtk_widget_show (main_hbox);
|
gtk_widget_show (main_hbox);
|
||||||
|
|
||||||
/* Create preview */
|
/* Create preview */
|
||||||
/* ============== */
|
/* ============== */
|
||||||
vbox = gtk_vbox_new(TRUE, 5);
|
vbox = gtk_vbox_new (TRUE, 4);
|
||||||
gtk_box_pack_start(GTK_BOX(main_hbox), vbox, TRUE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (main_hbox), vbox, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
preview = mw_preview_new (vbox, thePreview, &sinus_do_preview);
|
preview = mw_preview_new (vbox, thePreview, &sinus_do_preview);
|
||||||
|
@ -675,8 +742,10 @@ sinus_dialog (void)
|
||||||
gtk_widget_show (logo);
|
gtk_widget_show (logo);
|
||||||
|
|
||||||
data = (guchar *) logo_data;
|
data = (guchar *) logo_data;
|
||||||
for (y=0;y<100; y++) {
|
for (y = 0; y < 100; y++)
|
||||||
for (x=0; x<100; x++) {
|
{
|
||||||
|
for (x=0; x<100; x++)
|
||||||
|
{
|
||||||
HEADER_PIXEL (data, (&buf[3 * x]));
|
HEADER_PIXEL (data, (&buf[3 * x]));
|
||||||
}
|
}
|
||||||
gtk_preview_draw_row (GTK_PREVIEW(logo), (guchar *) buf, 0, y, 100);
|
gtk_preview_draw_row (GTK_PREVIEW(logo), (guchar *) buf, 0, y, 100);
|
||||||
|
@ -693,14 +762,15 @@ sinus_dialog (void)
|
||||||
/* Create the drawing settings frame */
|
/* Create the drawing settings frame */
|
||||||
/* ================================= */
|
/* ================================= */
|
||||||
page = gtk_vbox_new (FALSE, 5);
|
page = gtk_vbox_new (FALSE, 5);
|
||||||
gtk_container_border_width(GTK_CONTAINER(page), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (page), 4);
|
||||||
|
|
||||||
frame= gtk_frame_new (_("Drawing settings"));
|
frame = gtk_frame_new (_("Drawing Settings"));
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||||
gtk_box_pack_start(GTK_BOX(page), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
table = gtk_table_new(4, 2, FALSE);
|
|
||||||
gtk_container_border_width(GTK_CONTAINER (table), 5);
|
table = gtk_table_new(3, 2, FALSE);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (table), 4);
|
||||||
gtk_container_add (GTK_CONTAINER(frame), table);
|
gtk_container_add (GTK_CONTAINER(frame), table);
|
||||||
mw_fscale_entry_new (table, _("X Scale: "), 0.0001, 100.0, 0.001, 5, 0,
|
mw_fscale_entry_new (table, _("X Scale: "), 0.0001, 100.0, 0.001, 5, 0,
|
||||||
0, 1, 1, 2, &(svals.scalex));
|
0, 1, 1, 2, &(svals.scalex));
|
||||||
|
@ -710,15 +780,18 @@ sinus_dialog (void)
|
||||||
0, 1, 3, 4, &(svals.cmplx));
|
0, 1, 3, 4, &(svals.cmplx));
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
frame= gtk_frame_new (_("Calculation settings"));
|
frame= gtk_frame_new (_("Calculation Settings"));
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||||
gtk_box_pack_start(GTK_BOX(page), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
vbox= gtk_vbox_new(FALSE, 5);
|
|
||||||
|
vbox = gtk_vbox_new (FALSE, 2);
|
||||||
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
mw_ientry_new(vbox, NULL, _("Random seed:"), &svals.seed);
|
|
||||||
mw_toggle_button_new(vbox, NULL, _("Force tiling?"), &svals.tiling);
|
mw_ientry_new (vbox, NULL, _("Random Seed:"), &svals.seed);
|
||||||
|
mw_toggle_button_new (vbox, NULL, _("Force Tiling?"), &svals.tiling);
|
||||||
mw_value_radio_group_new (vbox, NULL , coefs_radio, &svals.perturbation);
|
mw_value_radio_group_new (vbox, NULL , coefs_radio, &svals.perturbation);
|
||||||
|
|
||||||
label = gtk_label_new (_("Settings"));
|
label = gtk_label_new (_("Settings"));
|
||||||
|
@ -726,32 +799,34 @@ sinus_dialog (void)
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label);
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label);
|
||||||
gtk_widget_show (page);
|
gtk_widget_show (page);
|
||||||
|
|
||||||
|
|
||||||
/* Color settings dialog: */
|
/* Color settings dialog: */
|
||||||
/* ====================== */
|
/* ====================== */
|
||||||
page = gtk_vbox_new(FALSE, 5);
|
page = gtk_vbox_new (FALSE, 4);
|
||||||
gtk_container_border_width(GTK_CONTAINER(page), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (page), 4);
|
||||||
|
|
||||||
frame = gtk_frame_new (_("Colors"));
|
frame = gtk_frame_new (_("Colors"));
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||||
gtk_box_pack_start(GTK_BOX(page), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(page), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (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);
|
||||||
|
|
||||||
if (drawable_is_grayscale)
|
if (drawable_is_grayscale)
|
||||||
{
|
{
|
||||||
/*if in grey scale, the colors are necessarily black and white */
|
/*if in grey scale, the colors are necessarily black and white */
|
||||||
label = gtk_label_new (_("The colors are white and black."));
|
label = gtk_label_new (_("The colors are white and black."));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
|
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
|
||||||
gtk_container_add(GTK_CONTAINER(frame), label);
|
gtk_container_add (GTK_CONTAINER (vbox), label);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vbox= gtk_vbox_new(FALSE, 5);
|
|
||||||
gtk_container_add(GTK_CONTAINER(frame), vbox);
|
|
||||||
gtk_widget_show(vbox);
|
|
||||||
mw_value_radio_group_new (vbox, NULL, colors_radio, &svals.colors);
|
mw_value_radio_group_new (vbox, NULL, colors_radio, &svals.colors);
|
||||||
hbox = gtk_hbox_new (TRUE, 20);
|
hbox = gtk_hbox_new (TRUE, 20);
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
||||||
|
|
||||||
push_col1 = gimp_color_button_new (_("First Color"), 32, 32, svals.col1, 4);
|
push_col1 = gimp_color_button_new (_("First Color"), 32, 32, svals.col1, 4);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), push_col1, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), push_col1, FALSE, FALSE, 0);
|
||||||
|
@ -766,15 +841,17 @@ sinus_dialog (void)
|
||||||
|
|
||||||
frame = gtk_frame_new (_("Alpha Channels"));
|
frame = gtk_frame_new (_("Alpha Channels"));
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||||
gtk_box_pack_start(GTK_BOX(page), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
table = gtk_table_new (3, 2, FALSE);
|
table = gtk_table_new (2, 2, FALSE);
|
||||||
gtk_container_border_width(GTK_CONTAINER (table), 5);
|
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);
|
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||||
|
|
||||||
label = gtk_label_new (_("First Color:"));
|
label = gtk_label_new (_("First Color:"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||||
GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
|
GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
@ -788,7 +865,8 @@ sinus_dialog (void)
|
||||||
{
|
{
|
||||||
gtk_object_set_user_data (GTK_OBJECT (push_col1), adj);
|
gtk_object_set_user_data (GTK_OBJECT (push_col1), adj);
|
||||||
gtk_signal_connect (GTK_OBJECT (push_col1), "color_changed",
|
gtk_signal_connect (GTK_OBJECT (push_col1), "color_changed",
|
||||||
(GtkSignalFunc) alpha_scale_update, &svals.col1[3]);
|
(GtkSignalFunc) alpha_scale_update,
|
||||||
|
&svals.col1[3]);
|
||||||
}
|
}
|
||||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
|
||||||
gtk_scale_set_digits (GTK_SCALE (scale), 2);
|
gtk_scale_set_digits (GTK_SCALE (scale), 2);
|
||||||
|
@ -798,7 +876,7 @@ sinus_dialog (void)
|
||||||
gtk_widget_show (scale);
|
gtk_widget_show (scale);
|
||||||
|
|
||||||
label = gtk_label_new (_("Second Color:"));
|
label = gtk_label_new (_("Second Color:"));
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
|
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
|
||||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
|
||||||
GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
|
GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
@ -811,7 +889,8 @@ sinus_dialog (void)
|
||||||
if (push_col2)
|
if (push_col2)
|
||||||
{
|
{
|
||||||
gtk_signal_connect (GTK_OBJECT (push_col2), "color_changed",
|
gtk_signal_connect (GTK_OBJECT (push_col2), "color_changed",
|
||||||
(GtkSignalFunc) alpha_scale_update, &svals.col2[3]);
|
(GtkSignalFunc) alpha_scale_update,
|
||||||
|
&svals.col2[3]);
|
||||||
gtk_object_set_user_data (GTK_OBJECT (push_col2), adj);
|
gtk_object_set_user_data (GTK_OBJECT (push_col2), adj);
|
||||||
}
|
}
|
||||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
|
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
|
||||||
|
@ -833,87 +912,91 @@ sinus_dialog (void)
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label);
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label);
|
||||||
gtk_widget_show (page);
|
gtk_widget_show (page);
|
||||||
|
|
||||||
|
|
||||||
/* blend settings dialog: */
|
/* blend settings dialog: */
|
||||||
/* ====================== */
|
/* ====================== */
|
||||||
label = gtk_label_new (_("Blend"));
|
page = gtk_vbox_new (FALSE, 4);
|
||||||
gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
|
gtk_container_set_border_width (GTK_CONTAINER (page), 4);
|
||||||
page = gtk_vbox_new(FALSE, 5);
|
|
||||||
gtk_container_border_width(GTK_CONTAINER(page), 5);
|
|
||||||
|
|
||||||
frame = gtk_frame_new(_("Blend settings"));
|
frame = gtk_frame_new (_("Blend Settings"));
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||||
gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0);
|
||||||
gtk_widget_show (frame);
|
gtk_widget_show (frame);
|
||||||
|
|
||||||
vbox= gtk_vbox_new(FALSE, 5);
|
vbox = gtk_vbox_new (FALSE, 4);
|
||||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
gtk_container_border_width(GTK_CONTAINER(vbox), 5);
|
gtk_container_border_width (GTK_CONTAINER (vbox), 4);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
mw_value_radio_group_new (vbox, _("Gradient"), coloriz_radio, &svals.colorization);
|
mw_value_radio_group_new (vbox, _("Gradient"), coloriz_radio, &svals.colorization);
|
||||||
|
|
||||||
table = gtk_table_new(2, 2, FALSE);
|
table = gtk_table_new (1, 3, FALSE);
|
||||||
gtk_container_border_width(GTK_CONTAINER (table), 5);
|
|
||||||
gtk_container_add (GTK_CONTAINER (vbox), table);
|
gtk_container_add (GTK_CONTAINER (vbox), table);
|
||||||
|
|
||||||
mw_fscale_entry_new(table, _("Exponent "), -7.5, 7.5, 0.01, 5.0, 0.0,
|
mw_fscale_entry_new (table, _("Exponent:"), -7.5, 7.5, 0.01, 5.0, 0.0,
|
||||||
0, 1, 0, 1, &svals.blend_power);
|
0, 1, 0, 1, &svals.blend_power);
|
||||||
gtk_widget_show (table);
|
gtk_widget_show (table);
|
||||||
|
|
||||||
|
label = gtk_label_new (_("Blend"));
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label);
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label);
|
||||||
gtk_widget_show (page);
|
gtk_widget_show (page);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gtk_widget_show (dlg);
|
gtk_widget_show (dlg);
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
gdk_flush ();
|
gdk_flush ();
|
||||||
|
|
||||||
/* argp->type = mw_radio_result(mode); */
|
/* argp->type = mw_radio_result(mode); */
|
||||||
return runp;
|
return run_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Draw preview image. if DoCompute is TRUE then recompute image. */
|
/* Draw preview image. if DoCompute is TRUE then recompute image. */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
void sinus_do_preview(GtkWidget *w)
|
void
|
||||||
|
sinus_do_preview (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
static GtkWidget *theWidget = NULL;
|
static GtkWidget *theWidget = NULL;
|
||||||
gint y,rowsize;
|
gint y,rowsize;
|
||||||
guchar *buf, *savbuf;
|
guchar *buf, *savbuf;
|
||||||
params p;
|
params p;
|
||||||
|
|
||||||
if(theWidget==NULL){
|
if (theWidget == NULL)
|
||||||
theWidget=w;
|
{
|
||||||
|
theWidget = widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rowsize = thePreview->width * thePreview->bpp;
|
rowsize = thePreview->width * thePreview->bpp;
|
||||||
savbuf = buf = (guchar *)malloc(thePreview->width*thePreview->height*thePreview->bpp);
|
savbuf = buf = g_new (guchar, thePreview->width*thePreview->height*thePreview->bpp);
|
||||||
if (buf != NULL) {
|
if (buf != NULL)
|
||||||
|
{
|
||||||
p.height = thePreview->height;
|
p.height = thePreview->height;
|
||||||
p.width = thePreview->width;
|
p.width = thePreview->width;
|
||||||
prepare_coef (&p);
|
prepare_coef (&p);
|
||||||
|
|
||||||
|
|
||||||
if (thePreview->bpp == 3)
|
if (thePreview->bpp == 3)
|
||||||
compute_block_3(buf, rowsize,0,0,thePreview->width,thePreview->height, &p);
|
compute_block_3 (buf, rowsize, 0, 0,
|
||||||
else if (thePreview->bpp == 1) {
|
thePreview->width, thePreview->height, &p);
|
||||||
compute_block_1(buf, rowsize,0,0,thePreview->width,thePreview->height, &p);
|
else if (thePreview->bpp == 1)
|
||||||
|
{
|
||||||
|
compute_block_1 (buf, rowsize, 0, 0,
|
||||||
|
thePreview->width, thePreview->height, &p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf (stderr, "Uh Oh.... Little sinus preview-only problem...\n");
|
fprintf (stderr, "Uh Oh.... Little sinus preview-only problem...\n");
|
||||||
|
|
||||||
for (y=0;y<thePreview->height; y++) {
|
for (y = 0; y < thePreview->height; y++)
|
||||||
|
{
|
||||||
gtk_preview_draw_row (GTK_PREVIEW (theWidget),
|
gtk_preview_draw_row (GTK_PREVIEW (theWidget),
|
||||||
buf, 0, y, thePreview->width);
|
buf, 0, y, thePreview->width);
|
||||||
buf += rowsize;
|
buf += rowsize;
|
||||||
}
|
}
|
||||||
free(savbuf);
|
g_free (savbuf);
|
||||||
gtk_widget_draw (theWidget, NULL);
|
gtk_widget_draw (theWidget, NULL);
|
||||||
gdk_flush ();
|
gdk_flush ();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fprintf (stderr,"Not enough mem for sinus Preview...\n");
|
fprintf (stderr,"Not enough mem for sinus Preview...\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue