app/actions/view-actions.c app/actions/view-commands.[ch]

2005-03-05  Michael Natterer  <mitch@gimp.org>

	* app/actions/view-actions.c
	* app/actions/view-commands.[ch]
	* app/config/gimprc-blurbs.h
	* app/core/core-enums.[ch]
	* app/core/gimp.c
	* app/core/gimpimage-crop.c
	* app/core/gimpimage-undo-push.[ch]
	* app/core/gimpimage.c
	* app/display/gimpdisplayoptions.[ch]
	* app/display/gimpdisplayshell-appearance.[ch]
	* app/display/gimpdisplayshell-callbacks.c
	* app/display/gimpdisplayshell-draw.[ch]
	* app/widgets/gimphelp-ids.h
	* menus/image-menu.xml.in: reordered stuff to be in guides, grid,
	sample points order. Some cleanup and indentation.
This commit is contained in:
Michael Natterer
2005-03-05 00:10:40 +00:00
committed by Michael Natterer
parent 9df474c666
commit be6a9d2a8b
21 changed files with 350 additions and 330 deletions

View File

@ -1,3 +1,21 @@
2005-03-05 Michael Natterer <mitch@gimp.org>
* app/actions/view-actions.c
* app/actions/view-commands.[ch]
* app/config/gimprc-blurbs.h
* app/core/core-enums.[ch]
* app/core/gimp.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-undo-push.[ch]
* app/core/gimpimage.c
* app/display/gimpdisplayoptions.[ch]
* app/display/gimpdisplayshell-appearance.[ch]
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-draw.[ch]
* app/widgets/gimphelp-ids.h
* menus/image-menu.xml.in: reordered stuff to be in guides, grid,
sample points order. Some cleanup and indentation.
2005-03-04 Raphaël Quinet <raphael@gimp.org>
* plug-ins/metadata/xmpdump.c: test program that tries to extract

View File

@ -138,18 +138,18 @@ static GimpToggleActionEntry view_toggle_actions[] =
TRUE,
GIMP_HELP_VIEW_SHOW_GUIDES },
{ "view-show-sample-points", NULL,
N_("Show Sample Points"), NULL, NULL,
G_CALLBACK (view_toggle_sample_points_cmd_callback),
TRUE,
GIMP_HELP_VIEW_SHOW_SAMPLE_POINTS },
{ "view-show-grid", NULL,
N_("S_how Grid"), NULL, NULL,
G_CALLBACK (view_toggle_grid_cmd_callback),
FALSE,
GIMP_HELP_VIEW_SHOW_GRID },
{ "view-show-sample-points", NULL,
N_("Show Sample Points"), NULL, NULL,
G_CALLBACK (view_toggle_sample_points_cmd_callback),
TRUE,
GIMP_HELP_VIEW_SHOW_SAMPLE_POINTS },
{ "view-snap-to-guides", NULL,
N_("Sn_ap to Guides"), NULL, NULL,
G_CALLBACK (view_snap_to_guides_cmd_callback),
@ -528,8 +528,8 @@ view_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("view-show-layer-boundary", gdisp);
SET_ACTIVE ("view-show-layer-boundary", gdisp && options->show_layer_boundary);
SET_ACTIVE ("view-show-guides", gdisp && options->show_guides);
SET_ACTIVE ("view-show-sample-points", gdisp && options->show_sample_points);
SET_ACTIVE ("view-show-grid", gdisp && options->show_grid);
SET_ACTIVE ("view-show-sample-points", gdisp && options->show_sample_points);
SET_ACTIVE ("view-snap-to-guides", gdisp && shell->snap_to_guides);
SET_ACTIVE ("view-snap-to-grid", gdisp && shell->snap_to_grid);
SET_ACTIVE ("view-snap-to-canvas", gdisp && shell->snap_to_canvas);

View File

@ -472,22 +472,6 @@ view_toggle_guides_cmd_callback (GtkAction *action,
gimp_display_shell_set_show_guides (shell, active);
}
void
view_toggle_sample_points_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gboolean active;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
gimp_display_shell_set_show_sample_points (shell, active);
}
void
view_toggle_grid_cmd_callback (GtkAction *action,
gpointer data)
@ -504,6 +488,22 @@ view_toggle_grid_cmd_callback (GtkAction *action,
gimp_display_shell_set_show_grid (shell, active);
}
void
view_toggle_sample_points_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gboolean active;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
gimp_display_shell_set_show_sample_points (shell, active);
}
void
view_snap_to_guides_cmd_callback (GtkAction *action,
gpointer data)

View File

@ -67,10 +67,10 @@ void view_toggle_statusbar_cmd_callback (GtkAction *action,
gpointer data);
void view_toggle_guides_cmd_callback (GtkAction *action,
gpointer data);
void view_toggle_sample_points_cmd_callback (GtkAction *action,
gpointer data);
void view_toggle_grid_cmd_callback (GtkAction *action,
gpointer data);
void view_toggle_sample_points_cmd_callback (GtkAction *action,
gpointer data);
void view_snap_to_guides_cmd_callback (GtkAction *action,
gpointer data);

View File

@ -318,14 +318,14 @@ N_("When enabled, the layer boundary is visible by default. This can also " \
N_("When enabled, the guides are visible by default. This can also be " \
"toggled with the \"View->Show Guides\" command.")
#define SHOW_SAMPLE_POINTS_BLURB \
N_("When enabled, the sample points are visible by default. This can also be " \
"toggled with the \"View->Show Sample Points\" command.")
#define SHOW_GRID_BLURB \
N_("When enabled, the grid is visible by default. This can also be toggled " \
"with the \"View->Show Grid\" command.")
#define SHOW_SAMPLE_POINTS_BLURB \
N_("When enabled, the sample points are visible by default. This can also be " \
"toggled with the \"View->Show Sample Points\" command.")
#define SHOW_TIPS_BLURB \
N_("Enable to display a handy GIMP tip on startup.")

View File

@ -689,8 +689,8 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, "GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE", "group-image-layers-merge" },
{ GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE, "GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE", "group-image-vectors-merge" },
{ GIMP_UNDO_GROUP_IMAGE_QMASK, "GIMP_UNDO_GROUP_IMAGE_QMASK", "group-image-qmask" },
{ GIMP_UNDO_GROUP_IMAGE_GRID, "GIMP_UNDO_GROUP_IMAGE_GRID", "group-image-grid" },
{ GIMP_UNDO_GROUP_IMAGE_GUIDE, "GIMP_UNDO_GROUP_IMAGE_GUIDE", "group-image-guide" },
{ GIMP_UNDO_GROUP_IMAGE_GRID, "GIMP_UNDO_GROUP_IMAGE_GRID", "group-image-grid" },
{ GIMP_UNDO_GROUP_IMAGE_SAMPLE_POINT, "GIMP_UNDO_GROUP_IMAGE_SAMPLE_POINT", "group-image-sample-point" },
{ GIMP_UNDO_GROUP_DRAWABLE, "GIMP_UNDO_GROUP_DRAWABLE", "group-drawable" },
{ GIMP_UNDO_GROUP_DRAWABLE_MOD, "GIMP_UNDO_GROUP_DRAWABLE_MOD", "group-drawable-mod" },
@ -719,8 +719,8 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_IMAGE_TYPE, "GIMP_UNDO_IMAGE_TYPE", "image-type" },
{ GIMP_UNDO_IMAGE_SIZE, "GIMP_UNDO_IMAGE_SIZE", "image-size" },
{ GIMP_UNDO_IMAGE_RESOLUTION, "GIMP_UNDO_IMAGE_RESOLUTION", "image-resolution" },
{ GIMP_UNDO_IMAGE_GRID, "GIMP_UNDO_IMAGE_GRID", "image-grid" },
{ GIMP_UNDO_IMAGE_GUIDE, "GIMP_UNDO_IMAGE_GUIDE", "image-guide" },
{ GIMP_UNDO_IMAGE_GRID, "GIMP_UNDO_IMAGE_GRID", "image-grid" },
{ GIMP_UNDO_IMAGE_SAMPLE_POINT, "GIMP_UNDO_IMAGE_SAMPLE_POINT", "image-sample-point" },
{ GIMP_UNDO_IMAGE_COLORMAP, "GIMP_UNDO_IMAGE_COLORMAP", "image-colormap" },
{ GIMP_UNDO_DRAWABLE, "GIMP_UNDO_DRAWABLE", "drawable" },
@ -772,8 +772,8 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, N_("Merge layers"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE, N_("Merge vectors"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_QMASK, N_("Quick Mask"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_GRID, N_("Grid"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_GUIDE, N_("Guide"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_GRID, N_("Grid"), NULL },
{ GIMP_UNDO_GROUP_IMAGE_SAMPLE_POINT, N_("Sample Point"), NULL },
{ GIMP_UNDO_GROUP_DRAWABLE, N_("Drawable"), NULL },
{ GIMP_UNDO_GROUP_DRAWABLE_MOD, N_("Drawable mod"), NULL },
@ -802,8 +802,8 @@ gimp_undo_type_get_type (void)
{ GIMP_UNDO_IMAGE_TYPE, N_("Image type"), NULL },
{ GIMP_UNDO_IMAGE_SIZE, N_("Image size"), NULL },
{ GIMP_UNDO_IMAGE_RESOLUTION, N_("Resolution change"), NULL },
{ GIMP_UNDO_IMAGE_GRID, N_("Grid"), NULL },
{ GIMP_UNDO_IMAGE_GUIDE, N_("Guide"), NULL },
{ GIMP_UNDO_IMAGE_GRID, N_("Grid"), NULL },
{ GIMP_UNDO_IMAGE_SAMPLE_POINT, N_("Sample Point"), NULL },
{ GIMP_UNDO_IMAGE_COLORMAP, N_("Change indexed palette"), NULL },
{ GIMP_UNDO_DRAWABLE, N_("Drawable"), NULL },

View File

@ -334,8 +334,8 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_GROUP_IMAGE_LAYERS_MERGE, /*< desc="Merge layers" >*/
GIMP_UNDO_GROUP_IMAGE_VECTORS_MERGE,/*< desc="Merge vectors" >*/
GIMP_UNDO_GROUP_IMAGE_QMASK, /*< desc="Quick Mask" >*/
GIMP_UNDO_GROUP_IMAGE_GRID, /*< desc="Grid" >*/
GIMP_UNDO_GROUP_IMAGE_GUIDE, /*< desc="Guide" >*/
GIMP_UNDO_GROUP_IMAGE_GRID, /*< desc="Grid" >*/
GIMP_UNDO_GROUP_IMAGE_SAMPLE_POINT, /*< desc="Sample Point" >*/
GIMP_UNDO_GROUP_DRAWABLE, /*< desc="Drawable" >*/
GIMP_UNDO_GROUP_DRAWABLE_MOD, /*< desc="Drawable mod" >*/
@ -369,8 +369,8 @@ typedef enum /*< pdb-skip >*/
GIMP_UNDO_IMAGE_TYPE, /*< desc="Image type" >*/
GIMP_UNDO_IMAGE_SIZE, /*< desc="Image size" >*/
GIMP_UNDO_IMAGE_RESOLUTION, /*< desc="Resolution change" >*/
GIMP_UNDO_IMAGE_GRID, /*< desc="Grid" >*/
GIMP_UNDO_IMAGE_GUIDE, /*< desc="Guide" >*/
GIMP_UNDO_IMAGE_GRID, /*< desc="Grid" >*/
GIMP_UNDO_IMAGE_SAMPLE_POINT, /*< desc="Sample Point" >*/
GIMP_UNDO_IMAGE_COLORMAP, /*< desc="Change indexed palette" >*/
GIMP_UNDO_DRAWABLE, /*< desc="Drawable" >*/

View File

@ -239,10 +239,10 @@ gimp_init (Gimp *gimp)
gimp->images = gimp_list_new_weak (GIMP_TYPE_IMAGE, FALSE);
gimp_object_set_name (GIMP_OBJECT (gimp->images), "images");
gimp->next_image_ID = 1;
gimp->next_guide_ID = 1;
gimp->next_image_ID = 1;
gimp->next_guide_ID = 1;
gimp->next_sample_point_ID = 1;
gimp->image_table = g_hash_table_new (g_direct_hash, NULL);
gimp->image_table = g_hash_table_new (g_direct_hash, NULL);
gimp->next_item_ID = 1;
gimp->item_table = g_hash_table_new (g_direct_hash, NULL);

View File

@ -252,7 +252,8 @@ gimp_image_crop (GimpImage *gimage,
if (remove_sample_point)
gimp_image_remove_sample_point (gimage, sample_point, TRUE);
else if (new_x != sample_point->x || new_y != sample_point->y)
gimp_image_move_sample_point (gimage, sample_point, new_x, new_y, TRUE);
gimp_image_move_sample_point (gimage, sample_point,
new_x, new_y, TRUE);
}
gimp_image_undo_group_end (gimage);

View File

@ -307,83 +307,6 @@ undo_free_image_resolution (GimpUndo *undo,
}
/****************/
/* Grid Undo */
/****************/
typedef struct _GridUndo GridUndo;
struct _GridUndo
{
GimpGrid *grid;
};
static gboolean undo_pop_image_grid (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum);
static void undo_free_image_grid (GimpUndo *undo,
GimpUndoMode undo_mode);
gboolean
gimp_image_undo_push_image_grid (GimpImage *gimage,
const gchar *undo_desc,
GimpGrid *grid)
{
GimpUndo *new;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (GIMP_IS_GRID (grid), FALSE);
if ((new = gimp_image_undo_push (gimage, GIMP_TYPE_UNDO,
sizeof (GridUndo),
sizeof (GridUndo),
GIMP_UNDO_IMAGE_GRID, undo_desc,
GIMP_DIRTY_IMAGE_META,
undo_pop_image_grid,
undo_free_image_grid,
NULL)))
{
GridUndo *gu = new->data;
gu->grid = gimp_config_duplicate (GIMP_CONFIG (grid));
return TRUE;
}
return FALSE;
}
static gboolean
undo_pop_image_grid (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum)
{
GridUndo *gu = undo->data;
GimpGrid *grid;
grid = gimp_config_duplicate (GIMP_CONFIG (undo->gimage->grid));
gimp_image_set_grid (undo->gimage, gu->grid, FALSE);
g_object_unref (gu->grid);
gu->grid = grid;
return TRUE;
}
static void
undo_free_image_grid (GimpUndo *undo,
GimpUndoMode undo_mode)
{
GridUndo *gu = undo->data;
if (gu->grid)
g_object_unref (gu->grid);
g_free (gu);
}
/****************/
/* Guide Undo */
/****************/
@ -483,6 +406,83 @@ undo_free_image_guide (GimpUndo *undo,
}
/****************/
/* Grid Undo */
/****************/
typedef struct _GridUndo GridUndo;
struct _GridUndo
{
GimpGrid *grid;
};
static gboolean undo_pop_image_grid (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum);
static void undo_free_image_grid (GimpUndo *undo,
GimpUndoMode undo_mode);
gboolean
gimp_image_undo_push_image_grid (GimpImage *gimage,
const gchar *undo_desc,
GimpGrid *grid)
{
GimpUndo *new;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (GIMP_IS_GRID (grid), FALSE);
if ((new = gimp_image_undo_push (gimage, GIMP_TYPE_UNDO,
sizeof (GridUndo),
sizeof (GridUndo),
GIMP_UNDO_IMAGE_GRID, undo_desc,
GIMP_DIRTY_IMAGE_META,
undo_pop_image_grid,
undo_free_image_grid,
NULL)))
{
GridUndo *gu = new->data;
gu->grid = gimp_config_duplicate (GIMP_CONFIG (grid));
return TRUE;
}
return FALSE;
}
static gboolean
undo_pop_image_grid (GimpUndo *undo,
GimpUndoMode undo_mode,
GimpUndoAccumulator *accum)
{
GridUndo *gu = undo->data;
GimpGrid *grid;
grid = gimp_config_duplicate (GIMP_CONFIG (undo->gimage->grid));
gimp_image_set_grid (undo->gimage, gu->grid, FALSE);
g_object_unref (gu->grid);
gu->grid = grid;
return TRUE;
}
static void
undo_free_image_grid (GimpUndo *undo,
GimpUndoMode undo_mode)
{
GridUndo *gu = undo->data;
if (gu->grid)
g_object_unref (gu->grid);
g_free (gu);
}
/**********************/
/* Sampe Point Undo */
/**********************/
@ -491,9 +491,9 @@ typedef struct _SamplePointUndo SamplePointUndo;
struct _SamplePointUndo
{
GimpSamplePoint *sample_point;
gint x;
gint y;
GimpSamplePoint *sample_point;
gint x;
gint y;
};
static gboolean undo_pop_image_sample_point (GimpUndo *undo,
@ -523,9 +523,9 @@ gimp_image_undo_push_image_sample_point (GimpImage *gimage,
{
SamplePointUndo *gu = new->data;
gu->sample_point = gimp_image_sample_point_ref (sample_point);
gu->x = sample_point->x;
gu->y = sample_point->y;
gu->sample_point = gimp_image_sample_point_ref (sample_point);
gu->x = sample_point->x;
gu->y = sample_point->y;
return TRUE;
}
@ -547,7 +547,8 @@ undo_pop_image_sample_point (GimpUndo *undo,
if (gu->sample_point->x == -1)
{
undo->gimage->sample_points = g_list_prepend (undo->gimage->sample_points, gu->sample_point);
undo->gimage->sample_points = g_list_prepend (undo->gimage->sample_points,
gu->sample_point);
gu->sample_point->x = gu->x;
gu->sample_point->y = gu->y;
gimp_image_sample_point_ref (gu->sample_point);

View File

@ -28,12 +28,12 @@ gboolean gimp_image_undo_push_image_size (GimpImage *gimage,
const gchar *undo_desc);
gboolean gimp_image_undo_push_image_resolution (GimpImage *gimage,
const gchar *undo_desc);
gboolean gimp_image_undo_push_image_grid (GimpImage *gimage,
const gchar *undo_desc,
GimpGrid *grid);
gboolean gimp_image_undo_push_image_guide (GimpImage *gimage,
const gchar *undo_desc,
GimpGuide *guide);
gboolean gimp_image_undo_push_image_grid (GimpImage *gimage,
const gchar *undo_desc,
GimpGrid *grid);
gboolean gimp_image_undo_push_image_sample_point (GimpImage *gimage,
const gchar *undo_desc,
GimpSamplePoint *sample_point);

View File

@ -543,10 +543,8 @@ gimp_image_init (GimpImage *gimage)
gimage->projection = gimp_projection_new (gimage);
gimage->guides = NULL;
gimage->sample_points = NULL;
gimage->grid = NULL;
gimage->sample_points = NULL;
gimage->layers = gimp_list_new (GIMP_TYPE_LAYER, TRUE);
gimage->channels = gimp_list_new (GIMP_TYPE_CHANNEL, TRUE);
@ -867,19 +865,20 @@ gimp_image_finalize (GObject *object)
gimage->guides = NULL;
}
if (gimage->sample_points)
{
g_list_foreach (gimage->sample_points, (GFunc) gimp_image_sample_point_unref, NULL);
g_list_free (gimage->sample_points);
gimage->sample_points = NULL;
}
if (gimage->grid)
{
g_object_unref (gimage->grid);
gimage->grid = NULL;
}
if (gimage->sample_points)
{
g_list_foreach (gimage->sample_points,
(GFunc) gimp_image_sample_point_unref, NULL);
g_list_free (gimage->sample_points);
gimage->sample_points = NULL;
}
if (gimage->undo_stack)
{
g_object_unref (gimage->undo_stack);
@ -936,12 +935,12 @@ gimp_image_get_memsize (GimpObject *object,
gui_size);
memsize += gimp_g_list_get_memsize (gimage->guides, sizeof (GimpGuide));
memsize += gimp_g_list_get_memsize (gimage->sample_points, sizeof (GimpSamplePoint));
if (gimage->grid)
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->grid), gui_size);
memsize += gimp_g_list_get_memsize (gimage->sample_points,
sizeof (GimpSamplePoint));
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->layers),
gui_size);
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->channels),
@ -1662,7 +1661,8 @@ gimp_image_update_sample_point (GimpImage *gimage,
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (sample_point != NULL);
g_signal_emit (gimage, gimp_image_signals[UPDATE_SAMPLE_POINT], 0, sample_point);
g_signal_emit (gimage, gimp_image_signals[UPDATE_SAMPLE_POINT], 0,
sample_point);
}
void

View File

@ -48,8 +48,8 @@ enum
PROP_SHOW_SELECTION,
PROP_SHOW_LAYER_BOUNDARY,
PROP_SHOW_GUIDES,
PROP_SHOW_SAMPLE_POINTS,
PROP_SHOW_GRID,
PROP_SHOW_SAMPLE_POINTS,
PROP_PADDING_MODE,
PROP_PADDING_COLOR
};
@ -182,14 +182,14 @@ gimp_display_options_class_init (GimpDisplayOptionsClass *klass)
"show-guides", SHOW_GUIDES_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SAMPLE_POINTS,
"show-sample-points", SHOW_SAMPLE_POINTS_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_GRID,
"show-grid", SHOW_GRID_BLURB,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SAMPLE_POINTS,
"show-sample-points", SHOW_SAMPLE_POINTS_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PADDING_MODE,
"padding-mode", CANVAS_PADDING_MODE_BLURB,
GIMP_TYPE_CANVAS_PADDING_MODE,
@ -240,14 +240,14 @@ gimp_display_options_fs_class_init (GimpDisplayOptionsClass *klass)
"show-guides", SHOW_GUIDES_BLURB,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SAMPLE_POINTS,
"show-sample-points", SHOW_SAMPLE_POINTS_BLURB,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_GRID,
"show-grid", SHOW_GRID_BLURB,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_SAMPLE_POINTS,
"show-sample-points", SHOW_SAMPLE_POINTS_BLURB,
FALSE,
0);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PADDING_MODE,
"padding-mode", CANVAS_PADDING_MODE_BLURB,
GIMP_TYPE_CANVAS_PADDING_MODE,
@ -296,12 +296,12 @@ gimp_display_options_set_property (GObject *object,
case PROP_SHOW_GUIDES:
options->show_guides = g_value_get_boolean (value);
break;
case PROP_SHOW_SAMPLE_POINTS:
options->show_sample_points = g_value_get_boolean (value);
break;
case PROP_SHOW_GRID:
options->show_grid = g_value_get_boolean (value);
break;
case PROP_SHOW_SAMPLE_POINTS:
options->show_sample_points = g_value_get_boolean (value);
break;
case PROP_PADDING_MODE:
options->padding_mode = g_value_get_enum (value);
break;
@ -346,12 +346,12 @@ gimp_display_options_get_property (GObject *object,
case PROP_SHOW_GUIDES:
g_value_set_boolean (value, options->show_guides);
break;
case PROP_SHOW_SAMPLE_POINTS:
g_value_set_boolean (value, options->show_sample_points);
break;
case PROP_SHOW_GRID:
g_value_set_boolean (value, options->show_grid);
break;
case PROP_SHOW_SAMPLE_POINTS:
g_value_set_boolean (value, options->show_sample_points);
break;
case PROP_PADDING_MODE:
g_value_set_enum (value, options->padding_mode);
break;

View File

@ -49,8 +49,8 @@ struct _GimpDisplayOptions
gboolean show_selection;
gboolean show_layer_boundary;
gboolean show_guides;
gboolean show_sample_points;
gboolean show_grid;
gboolean show_sample_points;
GimpCanvasPaddingMode padding_mode;
GimpRGB padding_color;
gboolean padding_mode_set;

View File

@ -344,35 +344,6 @@ gimp_display_shell_get_show_transform (GimpDisplayShell *shell)
return shell->show_transform_preview;
}
void
gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayOptions *options;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
options = GET_OPTIONS (shell);
g_object_set (options, "show-grid", show, NULL);
if (shell->gdisp->gimage->grid)
gimp_display_shell_expose_full (shell);
SET_ACTIVE (shell->menubar_manager, "view-show-grid", show);
if (IS_ACTIVE_DISPLAY (shell))
SET_ACTIVE (shell->popup_manager, "view-show-grid", show);
}
gboolean
gimp_display_shell_get_show_grid (GimpDisplayShell *shell)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
return GET_OPTIONS (shell)->show_grid;
}
void
gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
gboolean show)
@ -402,6 +373,35 @@ gimp_display_shell_get_show_guides (GimpDisplayShell *shell)
return GET_OPTIONS (shell)->show_guides;
}
void
gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
gboolean show)
{
GimpDisplayOptions *options;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
options = GET_OPTIONS (shell);
g_object_set (options, "show-grid", show, NULL);
if (shell->gdisp->gimage->grid)
gimp_display_shell_expose_full (shell);
SET_ACTIVE (shell->menubar_manager, "view-show-grid", show);
if (IS_ACTIVE_DISPLAY (shell))
SET_ACTIVE (shell->popup_manager, "view-show-grid", show);
}
gboolean
gimp_display_shell_get_show_grid (GimpDisplayShell *shell)
{
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
return GET_OPTIONS (shell)->show_grid;
}
void
gimp_display_shell_set_show_sample_points (GimpDisplayShell *shell,
gboolean show)

View File

@ -20,72 +20,72 @@
#define __GIMP_DISPLAY_SHELL_APPEARANCE_H__
void gimp_display_shell_set_fullscreen (GimpDisplayShell *shell,
gboolean fullscreen);
gboolean gimp_display_shell_get_fullscreen (GimpDisplayShell *shell);
void gimp_display_shell_set_fullscreen (GimpDisplayShell *shell,
gboolean fullscreen);
gboolean gimp_display_shell_get_fullscreen (GimpDisplayShell *shell);
void gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_menubar (GimpDisplayShell *shell);
void gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_menubar (GimpDisplayShell *shell);
void gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_rulers (GimpDisplayShell *shell);
void gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_rulers (GimpDisplayShell *shell);
void gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_scrollbars (GimpDisplayShell *shell);
void gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_scrollbars (GimpDisplayShell *shell);
void gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_statusbar (GimpDisplayShell *shell);
void gimp_display_shell_set_show_statusbar (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_statusbar (GimpDisplayShell *shell);
void gimp_display_shell_set_show_selection (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_selection (GimpDisplayShell *shell);
void gimp_display_shell_set_show_selection (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_selection (GimpDisplayShell *shell);
void gimp_display_shell_set_show_layer (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_layer (GimpDisplayShell *shell);
void gimp_display_shell_set_show_layer (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_layer (GimpDisplayShell *shell);
void gimp_display_shell_set_show_transform (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_transform (GimpDisplayShell *shell);
void gimp_display_shell_set_show_transform (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_transform (GimpDisplayShell *shell);
void gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_grid (GimpDisplayShell *shell);
void gimp_display_shell_set_show_grid (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_grid (GimpDisplayShell *shell);
void gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_guides (GimpDisplayShell *shell);
void gimp_display_shell_set_show_guides (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_guides (GimpDisplayShell *shell);
void gimp_display_shell_set_snap_to_grid (GimpDisplayShell *shell,
gboolean snap);
gboolean gimp_display_shell_get_snap_to_grid (GimpDisplayShell *shell);
void gimp_display_shell_set_show_sample_points (GimpDisplayShell *shell,
gboolean show);
gboolean gimp_display_shell_get_show_sample_points (GimpDisplayShell *shell);
void gimp_display_shell_set_snap_to_grid (GimpDisplayShell *shell,
gboolean snap);
gboolean gimp_display_shell_get_snap_to_grid (GimpDisplayShell *shell);
void gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell,
gboolean snap);
gboolean gimp_display_shell_get_snap_to_guides (GimpDisplayShell *shell);
void gimp_display_shell_set_snap_to_guides (GimpDisplayShell *shell,
gboolean snap);
gboolean gimp_display_shell_get_snap_to_guides (GimpDisplayShell *shell);
void gimp_display_shell_set_snap_to_canvas (GimpDisplayShell *shell,
gboolean snap);
gboolean gimp_display_shell_get_snap_to_canvas (GimpDisplayShell *shell);
void gimp_display_shell_set_snap_to_canvas (GimpDisplayShell *shell,
gboolean snap);
gboolean gimp_display_shell_get_snap_to_canvas (GimpDisplayShell *shell);
void gimp_display_shell_set_snap_to_vectors (GimpDisplayShell *shell,
gboolean snap);
gboolean gimp_display_shell_get_snap_to_vectors (GimpDisplayShell *shell);
void gimp_display_shell_set_snap_to_vectors (GimpDisplayShell *shell,
gboolean snap);
gboolean gimp_display_shell_get_snap_to_vectors (GimpDisplayShell *shell);
void gimp_display_shell_set_padding (GimpDisplayShell *shell,
GimpCanvasPaddingMode mode,
const GimpRGB *color);
void gimp_display_shell_get_padding (GimpDisplayShell *shell,
GimpCanvasPaddingMode *mode,
GimpRGB *color);
void gimp_display_shell_set_padding (GimpDisplayShell *shell,
GimpCanvasPaddingMode mode,
const GimpRGB *color);
void gimp_display_shell_get_padding (GimpDisplayShell *shell,
GimpCanvasPaddingMode *mode,
GimpRGB *color);
#endif /* __GIMP_DISPLAY_SHELL_APPEARANCE_H__ */

View File

@ -204,27 +204,27 @@ gimp_display_shell_events (GtkWidget *widget,
options = fullscreen ? shell->fullscreen_options : shell->options;
gimp_display_shell_set_show_menubar (shell,
options->show_menubar);
gimp_display_shell_set_show_rulers (shell,
options->show_rulers);
gimp_display_shell_set_show_scrollbars (shell,
options->show_scrollbars);
gimp_display_shell_set_show_statusbar (shell,
options->show_statusbar);
gimp_display_shell_set_show_selection (shell,
options->show_selection);
gimp_display_shell_set_show_layer (shell,
options->show_layer_boundary);
gimp_display_shell_set_show_guides (shell,
options->show_guides);
gimp_display_shell_set_show_menubar (shell,
options->show_menubar);
gimp_display_shell_set_show_rulers (shell,
options->show_rulers);
gimp_display_shell_set_show_scrollbars (shell,
options->show_scrollbars);
gimp_display_shell_set_show_statusbar (shell,
options->show_statusbar);
gimp_display_shell_set_show_selection (shell,
options->show_selection);
gimp_display_shell_set_show_layer (shell,
options->show_layer_boundary);
gimp_display_shell_set_show_guides (shell,
options->show_guides);
gimp_display_shell_set_show_grid (shell,
options->show_grid);
gimp_display_shell_set_show_sample_points (shell,
options->show_sample_points);
gimp_display_shell_set_show_grid (shell,
options->show_grid);
gimp_display_shell_set_padding (shell,
options->padding_mode,
&options->padding_color);
gimp_display_shell_set_padding (shell,
options->padding_mode,
&options->padding_color);
group = gimp_ui_manager_get_action_group (shell->menubar_manager,
"view");
@ -411,12 +411,12 @@ gimp_display_shell_canvas_expose (GtkWidget *widget,
/* draw the guides */
gimp_display_shell_draw_guides (shell);
/* draw the sample points */
gimp_display_shell_draw_sample_points (shell);
/* draw the grid */
gimp_display_shell_draw_grid (shell, &eevent->area);
/* draw the sample points */
gimp_display_shell_draw_sample_points (shell);
/* and the cursor (if we have a software cursor) */
gimp_display_shell_draw_cursor (shell);

View File

@ -124,73 +124,6 @@ gimp_display_shell_draw_guides (GimpDisplayShell *shell)
}
}
void
gimp_display_shell_draw_sample_point (GimpDisplayShell *shell,
GimpSamplePoint *sample_point,
gboolean active)
{
gint x1, x2;
gint y1, y2;
gint x, y;
gint w, h;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (sample_point != NULL);
if (sample_point->x < 0)
return;
gimp_display_shell_transform_xy (shell,
sample_point->x,
sample_point->y,
&x, &y, FALSE);
x1 = x - GIMP_SAMPLE_POINT_DRAW_SIZE;
x2 = x + GIMP_SAMPLE_POINT_DRAW_SIZE;
y1 = y - GIMP_SAMPLE_POINT_DRAW_SIZE;
y2 = y + GIMP_SAMPLE_POINT_DRAW_SIZE;
gdk_drawable_get_size (shell->canvas->window, &w, &h);
if (x < 0 || y < 0 || x >= w || y >= h)
return;
if (x1 < 0) x1 = 0;
if (y1 < 0) y1 = 0;
if (x2 > w) x2 = w;
if (y2 > h) y2 = h;
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas),
(active ?
GIMP_CANVAS_STYLE_GUIDE_ACTIVE :
GIMP_CANVAS_STYLE_GUIDE_NORMAL), x, y1, x, y2);
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas),
(active ?
GIMP_CANVAS_STYLE_GUIDE_ACTIVE :
GIMP_CANVAS_STYLE_GUIDE_NORMAL), x1, y, x2, y);
}
void
gimp_display_shell_draw_sample_points (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (gimp_display_shell_get_show_sample_points (shell))
{
GList *list;
for (list = shell->gdisp->gimage->sample_points;
list;
list = g_list_next (list))
{
gimp_display_shell_draw_sample_point(shell,
(GimpSamplePoint *) list->data,
FALSE);
}
}
}
void
gimp_display_shell_draw_grid (GimpDisplayShell *shell,
const GdkRectangle *area)
@ -359,6 +292,73 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
}
}
void
gimp_display_shell_draw_sample_point (GimpDisplayShell *shell,
GimpSamplePoint *sample_point,
gboolean active)
{
gint x1, x2;
gint y1, y2;
gint x, y;
gint w, h;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (sample_point != NULL);
if (sample_point->x < 0)
return;
gimp_display_shell_transform_xy (shell,
sample_point->x,
sample_point->y,
&x, &y, FALSE);
x1 = x - GIMP_SAMPLE_POINT_DRAW_SIZE;
x2 = x + GIMP_SAMPLE_POINT_DRAW_SIZE;
y1 = y - GIMP_SAMPLE_POINT_DRAW_SIZE;
y2 = y + GIMP_SAMPLE_POINT_DRAW_SIZE;
gdk_drawable_get_size (shell->canvas->window, &w, &h);
if (x < 0 || y < 0 || x >= w || y >= h)
return;
if (x1 < 0) x1 = 0;
if (y1 < 0) y1 = 0;
if (x2 > w) x2 = w;
if (y2 > h) y2 = h;
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas),
(active ?
GIMP_CANVAS_STYLE_GUIDE_ACTIVE :
GIMP_CANVAS_STYLE_GUIDE_NORMAL), x, y1, x, y2);
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas),
(active ?
GIMP_CANVAS_STYLE_GUIDE_ACTIVE :
GIMP_CANVAS_STYLE_GUIDE_NORMAL), x1, y, x2, y);
}
void
gimp_display_shell_draw_sample_points (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (gimp_display_shell_get_show_sample_points (shell))
{
GList *list;
for (list = shell->gdisp->gimage->sample_points;
list;
list = g_list_next (list))
{
gimp_display_shell_draw_sample_point(shell,
(GimpSamplePoint *) list->data,
FALSE);
}
}
}
void
gimp_display_shell_draw_vector (GimpDisplayShell *shell,
GimpVectors *vectors)

View File

@ -24,12 +24,12 @@ void gimp_display_shell_draw_guide (GimpDisplayShell *shell,
GimpGuide *guide,
gboolean active);
void gimp_display_shell_draw_guides (GimpDisplayShell *shell);
void gimp_display_shell_draw_sample_point (GimpDisplayShell *shell,
GimpSamplePoint *sample_point,
gboolean active);
void gimp_display_shell_draw_sample_points (GimpDisplayShell *shell);
void gimp_display_shell_draw_grid (GimpDisplayShell *shell,
const GdkRectangle *area);
void gimp_display_shell_draw_sample_point (GimpDisplayShell *shell,
GimpSamplePoint *sample_point,
gboolean active);
void gimp_display_shell_draw_sample_points (GimpDisplayShell *shell);
void gimp_display_shell_draw_vector (GimpDisplayShell *shell,
GimpVectors *vectors);
void gimp_display_shell_draw_vectors (GimpDisplayShell *shell);

View File

@ -79,9 +79,9 @@
#define GIMP_HELP_VIEW_SHOW_SELECTION "gimp-view-show-selection"
#define GIMP_HELP_VIEW_SHOW_LAYER_BOUNDARY "gimp-view-show-layer-boundary"
#define GIMP_HELP_VIEW_SHOW_GUIDES "gimp-view-show-guides"
#define GIMP_HELP_VIEW_SNAP_TO_GUIDES "gimp-view-snap-to-guides"
#define GIMP_HELP_VIEW_SHOW_SAMPLE_POINTS "gimp-view-show-sample-points"
#define GIMP_HELP_VIEW_SHOW_GRID "gimp-view-show-grid"
#define GIMP_HELP_VIEW_SHOW_SAMPLE_POINTS "gimp-view-show-sample-points"
#define GIMP_HELP_VIEW_SNAP_TO_GUIDES "gimp-view-snap-to-guides"
#define GIMP_HELP_VIEW_SNAP_TO_GRID "gimp-view-snap-to-grid"
#define GIMP_HELP_VIEW_SNAP_TO_CANVAS "gimp-view-snap-to-canvas"
#define GIMP_HELP_VIEW_SNAP_TO_VECTORS "gimp-view-snap-to-vectors"

View File

@ -240,8 +240,8 @@
<menuitem action="view-show-selection" />
<menuitem action="view-show-layer-boundary" />
<menuitem action="view-show-guides" />
<menuitem action="view-show-sample-points" />
<menuitem action="view-show-grid" />
<menuitem action="view-show-sample-points" />
<separator />
<menuitem action="view-snap-to-guides" />
<menuitem action="view-snap-to-grid" />