2008-01-28 21:08:35 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
1999-08-26 22:29:37 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2001-12-29 13:26:29 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2003-02-04 12:50:42 +00:00
|
|
|
#include <libgimp/gimp.h>
|
2002-11-19 20:25:57 +00:00
|
|
|
#include <libgimp/gimpui.h>
|
|
|
|
|
1999-08-26 22:29:37 +00:00
|
|
|
#include "gimpressionist.h"
|
2004-07-02 13:31:25 +00:00
|
|
|
#include "placement.h"
|
2001-12-29 13:26:29 +00:00
|
|
|
|
|
|
|
#include "libgimp/stdplugins-intl.h"
|
1999-08-26 22:29:37 +00:00
|
|
|
|
|
|
|
|
2004-07-21 13:48:13 +00:00
|
|
|
#define NUM_PLACE_RADIO 2
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-07-21 13:48:13 +00:00
|
|
|
static GtkWidget *placement_radio[NUM_PLACE_RADIO];
|
|
|
|
static GtkWidget *placement_center = NULL;
|
|
|
|
static GtkObject *brush_density_adjust = NULL;
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
void
|
2004-11-14 02:50:33 +00:00
|
|
|
place_restore (void)
|
1999-08-26 22:29:37 +00:00
|
|
|
{
|
2004-09-02 23:28:44 +00:00
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON (placement_radio[pcvals.place_type]), TRUE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (placement_center),
|
|
|
|
pcvals.placement_center);
|
|
|
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (brush_density_adjust),
|
|
|
|
pcvals.brush_density);
|
2004-07-02 13:31:25 +00:00
|
|
|
}
|
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
int
|
|
|
|
place_type_input (int in)
|
2004-07-25 14:29:27 +00:00
|
|
|
{
|
2004-09-02 23:28:44 +00:00
|
|
|
return CLAMP_UP_TO (in, NUM_PLACE_RADIO);
|
2004-07-25 14:29:27 +00:00
|
|
|
}
|
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
void
|
2004-11-14 02:50:33 +00:00
|
|
|
place_store (void)
|
2004-07-02 13:31:25 +00:00
|
|
|
{
|
2008-06-29 13:34:05 +00:00
|
|
|
pcvals.placement_center = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (placement_center));
|
1999-08-26 22:29:37 +00:00
|
|
|
}
|
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
void
|
|
|
|
create_placementpage (GtkNotebook *notebook)
|
1999-08-26 22:29:37 +00:00
|
|
|
{
|
2004-05-25 15:27:46 +00:00
|
|
|
GtkWidget *vbox;
|
2002-12-12 20:11:24 +00:00
|
|
|
GtkWidget *label, *tmpw, *table, *frame;
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2002-11-19 20:25:57 +00:00
|
|
|
label = gtk_label_new_with_mnemonic (_("Pl_acement"));
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
vbox = gtk_vbox_new (FALSE, 12);
|
2004-05-25 15:27:46 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
2004-09-02 23:28:44 +00:00
|
|
|
gtk_widget_show (vbox);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2003-11-14 18:05:39 +00:00
|
|
|
frame = gimp_int_radio_group_new (TRUE, _("Placement"),
|
2004-09-02 23:28:44 +00:00
|
|
|
G_CALLBACK (gimp_radio_button_update),
|
|
|
|
&pcvals.place_type, 0,
|
|
|
|
|
|
|
|
_("Randomly"),
|
|
|
|
PLACEMENT_TYPE_RANDOM,
|
|
|
|
&placement_radio[PLACEMENT_TYPE_RANDOM],
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
_("Evenly distributed"),
|
|
|
|
PLACEMENT_TYPE_EVEN_DIST,
|
|
|
|
&placement_radio[PLACEMENT_TYPE_EVEN_DIST],
|
2003-11-14 18:05:39 +00:00
|
|
|
|
2004-09-02 23:28:44 +00:00
|
|
|
NULL);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-05-25 15:27:46 +00:00
|
|
|
gimp_help_set_help_data
|
2004-09-02 23:28:44 +00:00
|
|
|
(placement_radio[PLACEMENT_TYPE_RANDOM],
|
|
|
|
_("Place strokes randomly around the image"),
|
|
|
|
NULL);
|
2004-05-25 15:27:46 +00:00
|
|
|
gimp_help_set_help_data
|
2004-09-02 23:28:44 +00:00
|
|
|
(placement_radio[PLACEMENT_TYPE_EVEN_DIST],
|
2004-07-02 13:31:25 +00:00
|
|
|
_("The strokes are evenly distributed across the image"),
|
2003-10-24 20:57:29 +00:00
|
|
|
NULL);
|
2004-09-02 23:28:44 +00:00
|
|
|
|
2004-05-25 15:27:46 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
1999-08-26 22:29:37 +00:00
|
|
|
|
2004-05-25 15:27:46 +00:00
|
|
|
gtk_toggle_button_set_active
|
2004-07-29 18:41:47 +00:00
|
|
|
(GTK_TOGGLE_BUTTON (placement_radio[pcvals.place_type]), TRUE);
|
2002-11-19 20:25:57 +00:00
|
|
|
|
2005-10-06 11:10:34 +00:00
|
|
|
placement_center = gtk_check_button_new_with_mnemonic ( _("Centered"));
|
|
|
|
tmpw = placement_center;
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), tmpw, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (tmpw);
|
|
|
|
gimp_help_set_help_data
|
|
|
|
(tmpw, _("Focus the brush strokes around the center of the image"), NULL);
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tmpw),
|
|
|
|
pcvals.placement_center);
|
|
|
|
|
2002-11-19 20:25:57 +00:00
|
|
|
table = gtk_table_new (1, 3, FALSE);
|
2004-09-02 23:28:44 +00:00
|
|
|
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
2002-11-19 20:25:57 +00:00
|
|
|
gtk_widget_show (table);
|
|
|
|
|
2004-07-21 13:48:13 +00:00
|
|
|
brush_density_adjust =
|
2004-09-02 23:28:44 +00:00
|
|
|
gimp_scale_entry_new (GTK_TABLE (table), 0, 0,
|
|
|
|
_("Stroke _density:"),
|
|
|
|
100, -1, pcvals.brush_density,
|
|
|
|
1.0, 50.0, 1.0, 5.0, 0,
|
|
|
|
TRUE, 0, 0,
|
|
|
|
_("The relative density of the brush strokes"),
|
|
|
|
NULL);
|
2005-06-30 16:03:24 +00:00
|
|
|
g_signal_connect (brush_density_adjust, "value-changed",
|
2002-11-19 20:25:57 +00:00
|
|
|
G_CALLBACK (gimp_double_adjustment_update),
|
2004-07-29 18:41:47 +00:00
|
|
|
&pcvals.brush_density);
|
2002-11-19 20:25:57 +00:00
|
|
|
|
2004-05-25 15:27:46 +00:00
|
|
|
gtk_notebook_append_page_menu (notebook, vbox, label, NULL);
|
1999-08-26 22:29:37 +00:00
|
|
|
}
|