gimp/plug-ins/gimpressionist/general.c

250 lines
8.2 KiB
C
Raw Normal View History

1999-08-26 22:29:37 +00:00
#include "config.h"
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 13:26:29 +00:00
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
1999-08-26 22:29:37 +00:00
#include "gimpressionist.h"
#include "infile.h"
app/gimpprogress.c app/nav_window.c app/ops_buttons.c app/undo_history.c 2001-12-29 Michael Natterer <mitch@gimp.org> * app/gimpprogress.c * app/nav_window.c * app/ops_buttons.c * app/undo_history.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/brush-editor.c * app/gui/channels-commands.c * app/gui/color-area.c * app/gui/color-notebook.c * app/gui/color-select.c * app/gui/colormap-dialog.c * app/gui/convert-dialog.c * app/gui/device-status-dialog.c * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/info-dialog.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-editor.c * app/gui/palettes-commands.c * app/gui/paths-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/resolution-calibrate-dialog.c * app/gui/splash.c * app/gui/tips-dialog.c * app/gui/toolbox.c * app/gui/user-install-dialog.c * app/tools/gimpbrightnesscontrasttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpcolorbalancetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpcurvestool.c * app/tools/gimphuesaturationtool.c * app/tools/gimpinktool.c * app/tools/gimplevelstool.c * app/tools/gimpposterizetool.c * app/tools/gimprotatetool.c * app/tools/gimpthresholdtool.c * app/tools/paint_options.c * app/tools/selection_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimpcolorpanel.c * app/widgets/gimpcomponentlistitem.c * app/widgets/gimpconstrainedhwrapbox.c * app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainerlistview.c * app/widgets/gimpcontainermenuimpl.c * app/widgets/gimpdialogfactory.c * app/widgets/gimpdnd.c * app/widgets/gimpdock.c * app/widgets/gimpdockbook.c * app/widgets/gimpdrawablelistitem.c * app/widgets/gimpdrawablelistview.c * app/widgets/gimpfontselection-dialog.c * app/widgets/gimphistogramview.c * app/widgets/gimpitemfactory.c * app/widgets/gimplayerlistitem.c * app/widgets/gimplistitem.[ch] * app/widgets/gimpmenuitem.c * app/widgets/gimppreview.[ch] * app/widgets/gtkhwrapbox.c * app/widgets/gtkvwrapbox.c * app/widgets/gtkwrapbox.c * libgimp/gimpbrushmenu.c * libgimp/gimpexport.c * libgimp/gimpgradientmenu.c * libgimp/gimpmenu.c * libgimp/gimppatternmenu.c * libgimpwidgets/gimpbutton.c * libgimpwidgets/gimpchainbutton.[ch] * libgimpwidgets/gimpcolorarea.h * libgimpwidgets/gimpcolorbutton.c * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppatheditor.c * libgimpwidgets/gimppixmap.h * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpstock.[ch] * libgimpwidgets/gimpwidgets.h * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/Events.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c * plug-ins/bmp/bmpwrite.c * plug-ins/dbbrowser/dbbrowser_utils.c * plug-ins/fits/fits.c * plug-ins/flame/flame.c * plug-ins/fp/fp_gtk.c * plug-ins/fp/fp_misc.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gfli/gfli.c * plug-ins/gimpressionist/*.c * plug-ins/imagemap/*.[ch] * plug-ins/maze/maze_face.c * plug-ins/mosaic/mosaic.c * plug-ins/pagecurl/pagecurl.c * plug-ins/print/print_gimp.h * plug-ins/rcm/rcm_callback.c * plug-ins/rcm/rcm_dialog.c * plug-ins/rcm/rcm_misc.c * plug-ins/script-fu/script-fu-console.c * plug-ins/script-fu/script-fu-scripts.c * plug-ins/script-fu/script-fu-server.c * plug-ins/sel2path/sel2path.c * plug-ins/sel2path/sel2path_adv_dialog.c * plug-ins/sgi/sgi.c * plug-ins/webbrowser/webbrowser.c * plug-ins/xjt/xjt.c * plug-ins/common/[A-n]*.c: compile with GTK_DISABLE_DEPRECATED defined. Not everything is fully ported yet, had to #undef GTK_DISABLE_DEPRECATED in many places and added #warnings when doing so. * pixmaps/Makefile.am * pixmaps/chain.xpm: removed. * themes/Default/Makefile.am * themes/Default/images/Makefile.am * themes/Default/images/stock-button-hchain-broken.png * themes/Default/images/stock-button-hchain.png * themes/Default/images/stock-button-vchain-broken.png * themes/Default/images/stock-button-vchain.png: new stock icons.
2001-12-29 13:26:29 +00:00
#include "libgimp/stdplugins-intl.h"
#define COLORBUTTONWIDTH 30
1999-08-26 22:29:37 +00:00
#define COLORBUTTONHEIGHT 20
#define NUMGENERALBGRADIO 4
static GtkWidget *generalbgradio[NUMGENERALBGRADIO];
static GtkWidget *generalpaintedges = NULL;
static GtkObject *generaldarkedgeadjust = NULL;
static GtkWidget *generaltileable;
static GtkWidget *generaldropshadow = NULL;
static GtkWidget *generalcolbutton;
static GtkObject *generalshadowadjust = NULL;
static GtkObject *generalshadowdepth = NULL;
static GtkObject *generalshadowblur = NULL;
static GtkObject *devthreshadjust = NULL;
static int normalize_bg(int n)
{
return (!img_has_alpha && (n == 3)) ? 1 : n;
}
1999-08-26 22:29:37 +00:00
static void general_bg_store(GtkWidget *wg, void *d)
1999-08-26 22:29:37 +00:00
{
pcvals.generalbgtype = normalize_bg (GPOINTER_TO_INT (d));
}
void general_store(void)
{
pcvals.generalpaintedges = GTK_TOGGLE_BUTTON(generalpaintedges)->active;
pcvals.generaldarkedge = GTK_ADJUSTMENT(generaldarkedgeadjust)->value;
pcvals.generaltileable = GTK_TOGGLE_BUTTON(generaltileable)->active;
pcvals.generaldropshadow = GTK_TOGGLE_BUTTON(generaldropshadow)->active;
pcvals.generalshadowdarkness = GTK_ADJUSTMENT(generalshadowadjust)->value;
pcvals.generalshadowdepth = GTK_ADJUSTMENT(generalshadowdepth)->value;
pcvals.generalshadowblur = GTK_ADJUSTMENT(generalshadowblur)->value;
pcvals.devthresh = GTK_ADJUSTMENT(devthreshadjust)->value;
}
void general_restore(void)
{
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (generalbgradio[normalize_bg (pcvals.generalbgtype)]
),
TRUE
);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (generalpaintedges),
pcvals.generalpaintedges);
gtk_adjustment_set_value (GTK_ADJUSTMENT (generaldarkedgeadjust),
pcvals.generaldarkedge);
gtk_adjustment_set_value (GTK_ADJUSTMENT (generalshadowadjust),
pcvals.generalshadowdarkness);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (generaldropshadow),
pcvals.generaldropshadow);
gtk_adjustment_set_value (GTK_ADJUSTMENT (generalshadowdepth),
pcvals.generalshadowdepth);
gtk_adjustment_set_value (GTK_ADJUSTMENT (generalshadowblur),
pcvals.generalshadowblur);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (generaltileable),
pcvals.generaltileable);
gimp_color_button_set_color (GIMP_COLOR_BUTTON (generalcolbutton),
&pcvals.color);
gtk_adjustment_set_value (GTK_ADJUSTMENT (devthreshadjust),
pcvals.devthresh);
1999-08-26 22:29:37 +00:00
}
static void selectcolor(GtkWidget *widget, gpointer data)
1999-08-26 22:29:37 +00:00
{
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON(generalbgradio[BG_TYPE_SOLID]),
TRUE
);
}
static GtkWidget *create_general_button (GtkWidget *box, int idx,
gchar *label, gchar *help_string,
GSList **radio_group
)
{
return create_radio_button (box, idx, general_bg_store, label,
help_string, radio_group, generalbgradio);
1999-08-26 22:29:37 +00:00
}
void create_generalpage(GtkNotebook *notebook)
{
GtkWidget *box1, *box2, *box3, *box4, *thispage;
2002-12-12 20:11:24 +00:00
GtkWidget *label, *tmpw, *frame, *table;
GSList * radio_group = NULL;
1999-08-26 22:29:37 +00:00
label = gtk_label_new_with_mnemonic (_("_General"));
1999-08-26 22:29:37 +00:00
thispage = gtk_vbox_new(FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (thispage), 12);
1999-08-26 22:29:37 +00:00
gtk_widget_show(thispage);
frame = gimp_frame_new (_("Background"));
gtk_box_pack_start(GTK_BOX(thispage), frame, FALSE, FALSE, 0);
2002-12-12 20:11:24 +00:00
gtk_widget_show (frame);
1999-08-26 22:29:37 +00:00
box3 = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER(frame), box3);
gtk_widget_show (box3);
1999-08-26 22:29:37 +00:00
create_general_button(box3, BG_TYPE_KEEP_ORIGINAL, _("Keep original"),
_("Preserve the original image as a background"),
&radio_group
);
create_general_button(box3, BG_TYPE_FROM_PAPER, _("From paper"),
_("Copy the texture of the selected paper as a background"),
&radio_group
);
box4 = gtk_hbox_new (FALSE, 6);
1999-08-26 22:29:37 +00:00
gtk_box_pack_start(GTK_BOX(box3), box4, FALSE, FALSE, 0);
gtk_widget_show(box4);
create_general_button(box4, BG_TYPE_SOLID, _("Solid"),
_("Solid colored background"),
&radio_group
);
1999-08-26 22:29:37 +00:00
generalcolbutton = gimp_color_button_new (_("Color"),
COLORBUTTONWIDTH,
COLORBUTTONHEIGHT,
&pcvals.color,
GIMP_COLOR_AREA_FLAT);
g_signal_connect (generalcolbutton, "clicked",
G_CALLBACK (selectcolor), NULL);
g_signal_connect (generalcolbutton, "color_changed",
G_CALLBACK (gimp_color_button_get_color),
&pcvals.color);
gtk_box_pack_start(GTK_BOX(box4), generalcolbutton, FALSE, FALSE, 0);
gtk_widget_show (generalcolbutton);
tmpw =
create_general_button(box3, BG_TYPE_TRANSPARENT, _("Transparent"),
_("Use a transparent background; Only the strokes painted will be visible"),
&radio_group
);
1999-08-26 22:29:37 +00:00
if(!img_has_alpha)
gtk_widget_set_sensitive (tmpw, FALSE);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (generalbgradio[pcvals.generalbgtype]), TRUE);
1999-08-26 22:29:37 +00:00
box1 = gtk_hbox_new (FALSE, 12);
2002-12-12 20:11:24 +00:00
gtk_box_pack_start(GTK_BOX(thispage), box1, FALSE, FALSE, 0);
1999-08-26 22:29:37 +00:00
gtk_widget_show (box1);
box2 = gtk_vbox_new (FALSE, 6);
2002-12-12 20:11:24 +00:00
gtk_box_pack_start(GTK_BOX(box1), box2, FALSE, FALSE, 0);
1999-08-26 22:29:37 +00:00
gtk_widget_show (box2);
2002-12-12 20:11:24 +00:00
tmpw = gtk_check_button_new_with_label( _("Paint edges"));
generalpaintedges = tmpw;
1999-08-26 22:29:37 +00:00
gtk_box_pack_start (GTK_BOX (box2), tmpw, FALSE, FALSE, 0);
gtk_widget_show (tmpw);
gimp_help_set_help_data
(tmpw, _("Selects if to place strokes all the way out to the edges of the image"), NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tmpw),
pcvals.generalpaintedges);
1999-08-26 22:29:37 +00:00
generaltileable = tmpw = gtk_check_button_new_with_label( _("Tileable"));
1999-08-26 22:29:37 +00:00
gtk_box_pack_start (GTK_BOX (box2), tmpw, FALSE, FALSE, 0);
gtk_widget_show (tmpw);
gimp_help_set_help_data
(tmpw, _("Selects if the resulting image should be seamlessly tileable"), NULL);
2002-12-12 20:11:24 +00:00
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tmpw),
pcvals.generaltileable);
1999-08-26 22:29:37 +00:00
2002-12-12 20:11:24 +00:00
tmpw = gtk_check_button_new_with_label( _("Drop Shadow"));
generaldropshadow = tmpw;
1999-08-26 22:29:37 +00:00
gtk_box_pack_start (GTK_BOX (box2), tmpw, FALSE, FALSE, 0);
gtk_widget_show (tmpw);
gimp_help_set_help_data
(tmpw, _("Adds a shadow effect to each brush stroke"), NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(tmpw),
pcvals.generaldropshadow);
1999-08-26 22:29:37 +00:00
table = gtk_table_new (5, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE(table), 6);
gtk_table_set_row_spacings (GTK_TABLE(table), 6);
2002-12-12 20:11:24 +00:00
gtk_box_pack_start(GTK_BOX(box1), table, FALSE, FALSE, 0);
gtk_widget_show (table);
generaldarkedgeadjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 0,
2002-12-12 20:11:24 +00:00
_("Edge darken:"),
150, 6, pcvals.generaldarkedge,
0.0, 1.0, 0.01, 0.1, 2,
2002-12-12 20:11:24 +00:00
TRUE, 0, 0,
_("How much to \"darken\" the edges of each brush stroke"),
NULL);
generalshadowadjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 1,
2002-12-12 20:11:24 +00:00
_("Shadow darken:"),
150, 6, pcvals.generalshadowdarkness,
0.0, 99.0, 0.1, 1, 2,
2002-12-12 20:11:24 +00:00
TRUE, 0, 0,
_("How much to \"darken\" the drop shadow"),
NULL);
generalshadowdepth =
gimp_scale_entry_new (GTK_TABLE(table), 0, 2,
2002-12-12 20:11:24 +00:00
_("Shadow depth:"),
150, 6, pcvals.generalshadowdepth,
0, 99, 1, 5, 0,
2002-12-12 20:11:24 +00:00
TRUE, 0, 0,
_("The depth of the drop shadow, i.e. how far apart from the object it should be"),
NULL);
generalshadowblur =
gimp_scale_entry_new (GTK_TABLE(table), 0, 3,
2002-12-12 20:11:24 +00:00
_("Shadow blur:"),
150, 6, pcvals.generalshadowblur,
0, 99, 1, 5, 0,
2002-12-12 20:11:24 +00:00
TRUE, 0, 0,
_("How much to blur the drop shadow"),
NULL);
devthreshadjust =
gimp_scale_entry_new (GTK_TABLE(table), 0, 4,
_("Deviation threshold:"),
2002-12-12 20:11:24 +00:00
150, 6, pcvals.devthresh,
0.0, 1.0, 0.01, 0.01, 2,
2002-12-12 20:11:24 +00:00
TRUE, 0, 0,
_("A bailout-value for adaptive selections"),
NULL);
1999-08-26 22:29:37 +00:00
gtk_notebook_append_page_menu (notebook, thispage, label, NULL);
1999-08-26 22:29:37 +00:00
}