Commit 1d625ed2 authored by Philip Lafleur's avatar Philip Lafleur Committed by Philip Lafleur

Replaced "Preview" checkbutton with a combobox with options "Outline",

2004-07-02  Philip Lafleur  <plafleur@cvs.gnome.org>

	* app/tools/gimptransformoptions.[ch]:
	* app/tools/gimptransformtool.c:
	* app/tools/tools-enums.[ch]: Replaced "Preview" checkbutton with
	a combobox with options "Outline", "Grid", "Image", and
	"Image + Grid".
parent 1c9e4b57
2004-07-02 Philip Lafleur <plafleur@cvs.gnome.org>
* app/tools/gimptransformoptions.[ch]:
* app/tools/gimptransformtool.c:
* app/tools/tools-enums.[ch]: Replaced "Preview" checkbutton with
a combobox with options "Outline", "Grid", "Image", and
"Image + Grid".
2004-07-02 Sven Neumann <sven@gimp.org>
* app/actions/edit-actions.c: don't let the Paste menu items
......@@ -50,7 +58,7 @@
* plug-ins/script-fu/scripts/blend-anim.scm
* plug-ins/script-fu/scripts/glossy.scm
* plug-ins/script-fu/scripts/test-sphere.scm: fixed typos
2004-07-01 Sven Neumann <sven@gimp.org>
* app/widgets/gimpselectiondata.[ch]: added (yet unused) functions
......
......@@ -51,7 +51,7 @@ enum
PROP_SUPERSAMPLE,
PROP_RECURSION_LEVEL,
PROP_CLIP,
PROP_SHOW_PREVIEW,
PROP_PREVIEW_TYPE,
PROP_GRID_TYPE,
PROP_GRID_SIZE,
PROP_CONSTRAIN_1,
......@@ -62,20 +62,21 @@ enum
static void gimp_transform_options_init (GimpTransformOptions *options);
static void gimp_transform_options_class_init (GimpTransformOptionsClass *options_class);
static void gimp_transform_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_transform_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_transform_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_transform_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_transform_options_reset (GimpToolOptions *tool_options);static void gimp_transform_options_set_defaults (GimpToolOptions *tool_options);
static void gimp_transform_options_reset (GimpToolOptions *tool_options);
static void gimp_transform_options_set_defaults (GimpToolOptions *tool_options);
static void gimp_transform_options_grid_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box);
static void gimp_transform_options_preview_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box);
static GimpToolOptionsClass *parent_class = NULL;
......@@ -163,10 +164,11 @@ gimp_transform_options_class_init (GimpTransformOptionsClass *klass)
"clip", NULL,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_PREVIEW,
"show-preview", NULL,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PREVIEW_TYPE,
"preview-type", NULL,
GIMP_TYPE_TRANSFORM_PREVIEW_TYPE,
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_GRID_TYPE,
"grid-type", NULL,
GIMP_TYPE_TRANSFORM_GRID_TYPE,
......@@ -221,8 +223,8 @@ gimp_transform_options_set_property (GObject *object,
case PROP_CLIP:
options->clip = g_value_get_boolean (value);
break;
case PROP_SHOW_PREVIEW:
options->show_preview = g_value_get_boolean (value);
case PROP_PREVIEW_TYPE:
options->preview_type = g_value_get_enum (value);
break;
case PROP_GRID_TYPE:
options->grid_type = g_value_get_enum (value);
......@@ -272,8 +274,8 @@ gimp_transform_options_get_property (GObject *object,
case PROP_CLIP:
g_value_set_boolean (value, options->clip);
break;
case PROP_SHOW_PREVIEW:
g_value_set_boolean (value, options->show_preview);
case PROP_PREVIEW_TYPE:
g_value_set_enum (value, options->preview_type);
break;
case PROP_GRID_TYPE:
g_value_set_enum (value, options->grid_type);
......@@ -394,31 +396,49 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
/* the preview toggle button */
button = gimp_prop_check_button_new (config, "show-preview", _("Preview"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
/* the grid frame */
/* the preview frame */
frame = gimp_frame_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
/* the preview type menu */
hbox = gtk_hbox_new (FALSE, 4);
gtk_frame_set_label_widget (GTK_FRAME (frame), hbox);
gtk_widget_show (hbox);
label = gtk_label_new (_("Preview:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
combo = gimp_prop_enum_combo_box_new (config, "preview-type", 0, 0);
gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
gtk_widget_show (combo);
/* the grid type menu */
button = gtk_vbox_new (FALSE, 4);
gtk_container_add (GTK_CONTAINER (frame), button);
gtk_widget_show (button);
combo = gimp_prop_enum_combo_box_new (config, "grid-type", 0, 0);
gtk_frame_set_label_widget (GTK_FRAME (frame), combo);
gtk_box_pack_start (GTK_BOX (button), combo, FALSE, FALSE, 0);
gtk_widget_show (combo);
/* the grid density scale */
table = gtk_table_new (1, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_container_add (GTK_CONTAINER (frame), table);
gtk_box_pack_start (GTK_BOX (button), table, FALSE, FALSE, 0);
gtk_widget_show (table);
g_signal_connect (config, "notify::grid-type",
G_CALLBACK (gimp_transform_options_grid_notify),
table);
gtk_widget_set_sensitive (button,
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_GRID ||
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID);
g_signal_connect (config, "notify::preview-type",
G_CALLBACK (gimp_transform_options_preview_notify),
button);
gimp_prop_scale_entry_new (config, "grid-size",
GTK_TABLE (table), 0, 0,
......@@ -503,11 +523,13 @@ gimp_transform_options_gui (GimpToolOptions *tool_options)
/* private functions */
static void
gimp_transform_options_grid_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box)
gimp_transform_options_preview_notify (GimpTransformOptions *options,
GParamSpec *pspec,
GtkWidget *density_box)
{
gtk_widget_set_sensitive (density_box,
options->grid_type !=
GIMP_TRANSFORM_GRID_TYPE_NONE);
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_GRID ||
options->preview_type ==
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID);
}
......@@ -36,19 +36,19 @@ typedef struct _GimpToolOptionsClass GimpTransformOptionsClass;
struct _GimpTransformOptions
{
GimpToolOptions parent_instance;
GimpTransformType type;
GimpTransformDirection direction;
GimpInterpolationType interpolation;
gboolean supersample;
gint recursion_level;
gboolean clip;
gboolean show_preview;
GimpTransformGridType grid_type;
gint grid_size;
gboolean constrain_1;
gboolean constrain_2;
GimpToolOptions parent_instance;
GimpTransformType type;
GimpTransformDirection direction;
GimpInterpolationType interpolation;
gboolean supersample;
gint recursion_level;
gboolean clip;
GimpTransformPreviewType preview_type;
GimpTransformGridType grid_type;
gint grid_size;
gboolean constrain_1;
gboolean constrain_2;
};
......
......@@ -136,6 +136,8 @@ static void gimp_transform_tool_doit (GimpTransformTool *tr_tool,
GimpDisplay *gdisp);
static void gimp_transform_tool_grid_recalc (GimpTransformTool *tr_tool);
static void gimp_transform_tool_force_expose_preview (GimpTransformTool *tr_tool);
static void gimp_transform_tool_response (GtkWidget *widget,
gint response_id,
GimpTransformTool *tr_tool);
......@@ -143,9 +145,6 @@ static void gimp_transform_tool_response (GtkWidget *widget,
static void gimp_transform_tool_notify_type (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool);
static void gimp_transform_tool_notify_grid (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool);
static void gimp_transform_tool_notify_preview (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool);
......@@ -289,15 +288,15 @@ gimp_transform_tool_constructor (GType type,
G_CALLBACK (gimp_transform_tool_notify_preview),
tr_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options,
"notify::grid-type",
G_CALLBACK (gimp_transform_tool_notify_grid),
"notify::preview-type",
G_CALLBACK (gimp_transform_tool_notify_preview),
tr_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options,
"notify::grid-size",
G_CALLBACK (gimp_transform_tool_notify_grid),
"notify::grid-type",
G_CALLBACK (gimp_transform_tool_notify_preview),
tr_tool, 0);
g_signal_connect_object (tool->tool_info->tool_options,
"notify::show-preview",
"notify::grid-size",
G_CALLBACK (gimp_transform_tool_notify_preview),
tr_tool, 0);
}
......@@ -1131,23 +1130,34 @@ gimp_transform_tool_transform_bounding_box (GimpTransformTool *tr_tool)
void
gimp_transform_tool_expose_preview (GimpTransformTool *tr_tool)
{
static gint last_x = 0;
static gint last_y = 0;
static gint last_w = 0;
static gint last_h = 0;
GimpDisplayShell *shell;
GimpTransformOptions *options;
gdouble dx [4], dy [4];
gint area_x, area_y, area_w, area_h;
gint i;
g_return_if_fail (GIMP_IS_TRANSFORM_TOOL (tr_tool));
options =
GIMP_TRANSFORM_OPTIONS (GIMP_TOOL (tr_tool)->tool_info->tool_options);
if (! (tr_tool->use_grid && options->show_preview))
if ((options->preview_type == GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE ||
options->preview_type == GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID) &&
options->type == GIMP_TRANSFORM_TYPE_LAYER &&
options->direction == GIMP_TRANSFORM_FORWARD)
gimp_transform_tool_force_expose_preview (tr_tool);
}
static void
gimp_transform_tool_force_expose_preview (GimpTransformTool *tr_tool)
{
static gint last_x = 0;
static gint last_y = 0;
static gint last_w = 0;
static gint last_h = 0;
GimpDisplayShell *shell;
gdouble dx [4], dy [4];
gint area_x, area_y, area_w, area_h;
gint i;
g_return_if_fail (GIMP_IS_TRANSFORM_TOOL (tr_tool));
if (! tr_tool->use_grid)
return;
g_return_if_fail (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tr_tool)));
......@@ -1311,6 +1321,10 @@ gimp_transform_tool_grid_recalc (GimpTransformTool *tr_tool)
tr_tool->tgrid_coords = NULL;
}
if (options->preview_type != GIMP_TRANSFORM_PREVIEW_TYPE_GRID &&
options->preview_type != GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID)
return;
switch (options->grid_type)
{
case GIMP_TRANSFORM_GRID_TYPE_N_LINES:
......@@ -1439,10 +1453,12 @@ gimp_transform_tool_prepare (GimpTransformTool *tr_tool,
options =
GIMP_TRANSFORM_OPTIONS (GIMP_TOOL (tr_tool)->tool_info->tool_options);
if (options->type == GIMP_TRANSFORM_TYPE_LAYER &&
options->direction == GIMP_TRANSFORM_FORWARD)
if ((options->preview_type == GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE ||
options->preview_type == GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID) &&
options->type == GIMP_TRANSFORM_TYPE_LAYER &&
options->direction == GIMP_TRANSFORM_FORWARD)
gimp_display_shell_set_show_transform (GIMP_DISPLAY_SHELL (gdisp->shell),
options->show_preview);
TRUE);
else
gimp_display_shell_set_show_transform (GIMP_DISPLAY_SHELL (gdisp->shell),
FALSE);
......@@ -1530,51 +1546,78 @@ gimp_transform_tool_notify_type (GimpTransformOptions *options,
}
static void
gimp_transform_tool_notify_grid (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool)
gimp_transform_tool_notify_preview (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool)
{
if (tr_tool->function == TRANSFORM_CREATING)
return;
GimpDisplayShell *shell = NULL;
if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tr_tool)))
shell = GIMP_DISPLAY_SHELL (GIMP_DRAW_TOOL (tr_tool)->gdisp->shell);
switch (options->preview_type)
{
default:
case GIMP_TRANSFORM_PREVIEW_TYPE_OUTLINE:
if (shell)
{
gimp_display_shell_set_show_transform (shell, FALSE);
gimp_transform_tool_force_expose_preview (tr_tool);
}
break;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
case GIMP_TRANSFORM_PREVIEW_TYPE_GRID:
if (shell)
{
gimp_display_shell_set_show_transform (shell, FALSE);
gimp_transform_tool_force_expose_preview (tr_tool);
}
gimp_transform_tool_grid_recalc (tr_tool);
gimp_transform_tool_transform_bounding_box (tr_tool);
if (tr_tool->function != TRANSFORM_CREATING)
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
gimp_transform_tool_grid_recalc (tr_tool);
gimp_transform_tool_transform_bounding_box (tr_tool);
static void
gimp_transform_tool_notify_preview (GimpTransformOptions *options,
GParamSpec *pspec,
GimpTransformTool *tr_tool)
{
GimpDisplayShell *shell;
gboolean show_preview;
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
break;
if (! gimp_draw_tool_is_active (GIMP_DRAW_TOOL (tr_tool)))
return;
case GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE:
if (shell)
{
if (options->type == GIMP_TRANSFORM_TYPE_LAYER &&
options->direction == GIMP_TRANSFORM_FORWARD)
gimp_display_shell_set_show_transform (shell, TRUE);
else
gimp_display_shell_set_show_transform (shell, FALSE);
shell = GIMP_DISPLAY_SHELL (GIMP_DRAW_TOOL (tr_tool)->gdisp->shell);
gimp_transform_tool_force_expose_preview (tr_tool);
}
break;
if (options->type == GIMP_TRANSFORM_TYPE_LAYER &&
options->direction == GIMP_TRANSFORM_FORWARD)
{
gimp_display_shell_set_show_transform (shell, options->show_preview);
case GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID:
if (shell)
{
if (options->type == GIMP_TRANSFORM_TYPE_LAYER &&
options->direction == GIMP_TRANSFORM_FORWARD)
gimp_display_shell_set_show_transform (shell, TRUE);
else
gimp_display_shell_set_show_transform (shell, FALSE);
/* expose area to clean up if preview is being turned off */
show_preview = options->show_preview;
options->show_preview = TRUE;
gimp_transform_tool_force_expose_preview (tr_tool);
}
gimp_transform_tool_expose_preview (tr_tool);
if (tr_tool->function != TRANSFORM_CREATING)
{
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tr_tool));
options->show_preview = show_preview;
}
else
{
gimp_display_shell_set_show_transform (shell, FALSE);
gimp_transform_tool_grid_recalc (tr_tool);
gimp_transform_tool_transform_bounding_box (tr_tool);
gimp_transform_tool_expose_preview (tr_tool);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tr_tool));
}
break;
}
}
......@@ -108,9 +108,29 @@ gimp_vector_mode_get_type (void)
}
static const GEnumValue gimp_transform_preview_type_enum_values[] =
{
{ GIMP_TRANSFORM_PREVIEW_TYPE_OUTLINE, N_("Outline"), "outline" },
{ GIMP_TRANSFORM_PREVIEW_TYPE_GRID, N_("Grid"), "grid" },
{ GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE, N_("Image"), "image" },
{ GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID, N_("Image + Grid"), "image-grid" },
{ 0, NULL, NULL }
};
GType
gimp_transform_preview_type_get_type (void)
{
static GType enum_type = 0;
if (!enum_type)
enum_type = g_enum_register_static ("GimpTransformPreviewType", gimp_transform_preview_type_enum_values);
return enum_type;
}
static const GEnumValue gimp_transform_grid_type_enum_values[] =
{
{ GIMP_TRANSFORM_GRID_TYPE_NONE, N_("Don't show grid"), "none" },
{ GIMP_TRANSFORM_GRID_TYPE_N_LINES, N_("Number of grid lines"), "n-lines" },
{ GIMP_TRANSFORM_GRID_TYPE_SPACING, N_("Grid line spacing"), "spacing" },
{ 0, NULL, NULL }
......
......@@ -82,13 +82,25 @@ typedef enum
} GimpVectorMode;
#define GIMP_TYPE_TRANSFORM_PREVIEW_TYPE (gimp_transform_preview_type_get_type ())
GType gimp_transform_preview_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_TRANSFORM_PREVIEW_TYPE_OUTLINE, /*< desc="Outline" >*/
GIMP_TRANSFORM_PREVIEW_TYPE_GRID, /*< desc="Grid" >*/
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE, /*< desc="Image" >*/
GIMP_TRANSFORM_PREVIEW_TYPE_IMAGE_GRID /*< desc="Image + Grid" >*/
} GimpTransformPreviewType;
#define GIMP_TYPE_TRANSFORM_GRID_TYPE (gimp_transform_grid_type_get_type ())
GType gimp_transform_grid_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_TRANSFORM_GRID_TYPE_NONE, /*< desc="Don't show grid" >*/
GIMP_TRANSFORM_GRID_TYPE_N_LINES, /*< desc="Number of grid lines" >*/
GIMP_TRANSFORM_GRID_TYPE_SPACING /*< desc="Grid line spacing" >*/
} GimpTransformGridType;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment