Commit b9eef3d0 authored by Alexandre Prokoudine's avatar Alexandre Prokoudine

Merge branch 'master' into templates-update

parents ceb43bf7 073d7924
......@@ -160,6 +160,7 @@ Painting:
- Allow painting on transparent layers with modes other than normal.
- Add a specialized convolution algorithm for the hardness blur
to make it faster.
- New dynamics "Pressure Size".
File Formats
......@@ -186,6 +187,7 @@ File Formats
* loading 2bpp, 2 planes/1bpp, 3 planes/1bpp and 4bpp images.
* non-Black&White monochrome PCX files (any 2 colors according to
the palette).
- Add support for exporting multi-page PDF from image layers.
Printing
......
......@@ -64,6 +64,7 @@
#include "app.h"
#include "errors.h"
#include "language.h"
#include "sanity.h"
#include "gimp-debug.h"
#include "gimp-intl.h"
......@@ -179,6 +180,7 @@ app_run (const gchar *full_prog_name,
GMainLoop *run_loop;
GFile *default_folder = NULL;
GFile *gimpdir;
const gchar *abort_message;
if (filenames && filenames[0] && ! filenames[1] &&
g_file_test (filenames[0], G_FILE_TEST_IS_DIR))
......@@ -253,6 +255,13 @@ app_run (const gchar *full_prog_name,
/* change the locale if a language if specified */
language_init (gimp->config->language);
/* run the late-stage sanity check. it's important that this check is run
* after the call to language_init() (see comment in sanity_check_late().)
*/
abort_message = sanity_check_late ();
if (abort_message)
app_abort (no_interface, abort_message);
/* initialize lowlevel stuff */
gimp_gegl_init (gimp);
......
......@@ -676,45 +676,35 @@ gimp_brush_transform_mask (GimpBrush *brush,
if (! mask)
{
if (scale == 1.0 &&
aspect_ratio == 0.0 &&
angle == 0.0 &&
hardness == 1.0)
#if 0
/* This code makes sure that brushes using blur for hardness
* (all of them but generated) are blurred once and no more.
* It also makes hardnes dynamics not work for these brushes.
* This is intentional. Confoliving for each stamp is too expensive.*/
if (! brush->priv->blured_mask &&
! GIMP_IS_BRUSH_GENERATED(brush) &&
! GIMP_IS_BRUSH_PIPE(brush) && /*Cant cache pipes. Sanely anway*/
hardness < 1.0)
{
mask = gimp_temp_buf_copy (brush->priv->mask);
brush->priv->blured_mask = GIMP_BRUSH_GET_CLASS (brush)->transform_mask (brush,
1.0,
0.0,
0.0,
hardness);
brush->priv->blur_hardness = hardness;
}
else
{
#if 0
/* This code makes sure that brushes using blur for hardness
* (all of them but generated) are blurred once and no more.
* It also makes hardnes dynamics not work for these brushes.
* This is intentional. Confoliving for each stamp is too expensive.*/
if (! brush->priv->blured_mask &&
! GIMP_IS_BRUSH_GENERATED(brush) &&
! GIMP_IS_BRUSH_PIPE(brush) && /*Cant cache pipes. Sanely anway*/
hardness < 1.0)
{
brush->priv->blured_mask = GIMP_BRUSH_GET_CLASS (brush)->transform_mask (brush,
1.0,
0.0,
0.0,
hardness);
brush->priv->blur_hardness = hardness;
}
if (brush->priv->blured_mask)
{
effective_hardness = 1.0; /*Hardness has already been applied*/
}
if (brush->priv->blured_mask)
{
effective_hardness = 1.0; /*Hardness has already been applied*/
}
#endif
mask = GIMP_BRUSH_GET_CLASS (brush)->transform_mask (brush,
scale,
aspect_ratio,
angle,
effective_hardness);
}
mask = GIMP_BRUSH_GET_CLASS (brush)->transform_mask (brush,
scale,
aspect_ratio,
angle,
effective_hardness);
if (op)
{
......@@ -780,40 +770,30 @@ gimp_brush_transform_pixmap (GimpBrush *brush,
if (! pixmap)
{
if (scale == 1.0 &&
aspect_ratio == 0.0 &&
angle == 0.0 &&
hardness == 1.0)
{
pixmap = gimp_temp_buf_copy (brush->priv->pixmap);
}
else
{
#if 0
if (! brush->priv->blured_pixmap &&
! GIMP_IS_BRUSH_GENERATED(brush) &&
! GIMP_IS_BRUSH_PIPE(brush) /*Cant cache pipes. Sanely anway*/
&& hardness < 1.0)
{
brush->priv->blured_pixmap = GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush,
1.0,
0.0,
0.0,
hardness);
brush->priv->blur_hardness = hardness;
}
if (brush->priv->blured_pixmap) {
effective_hardness = 1.0; /*Hardness has already been applied*/
}
if (! brush->priv->blured_pixmap &&
! GIMP_IS_BRUSH_GENERATED(brush) &&
! GIMP_IS_BRUSH_PIPE(brush) /*Cant cache pipes. Sanely anway*/
&& hardness < 1.0)
{
brush->priv->blured_pixmap = GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush,
1.0,
0.0,
0.0,
hardness);
brush->priv->blur_hardness = hardness;
}
if (brush->priv->blured_pixmap) {
effective_hardness = 1.0; /*Hardness has already been applied*/
}
#endif
pixmap = GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush,
scale,
aspect_ratio,
angle,
effective_hardness);
}
pixmap = GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush,
scale,
aspect_ratio,
angle,
effective_hardness);
if (op)
{
......
......@@ -356,6 +356,14 @@ gimp_brush_generated_transform_mask (GimpBrush *gbrush,
else if (angle > 180.0)
angle = fmod (angle, 180.0);
if (scale == 1.0 &&
ratio == brush->aspect_ratio &&
angle == brush->angle &&
hardness == brush->hardness)
{
return gimp_temp_buf_copy (gimp_brush_get_mask (gbrush));
}
return gimp_brush_generated_calc (brush,
brush->shape,
brush->radius * scale,
......
......@@ -309,6 +309,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
case GIMP_HANDLE_FILLED_SQUARE:
case GIMP_HANDLE_DIAMOND:
case GIMP_HANDLE_FILLED_DIAMOND:
case GIMP_HANDLE_CROSS:
cairo_save (cr);
cairo_translate (cr, tx, ty);
cairo_rotate (cr, private->start_angle);
......@@ -320,10 +321,12 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
cairo_rectangle (cr, x, y, private->width - 1.0, private->height - 1.0);
_gimp_canvas_item_stroke (item, cr);
break;
case GIMP_HANDLE_FILLED_SQUARE:
cairo_rectangle (cr, x - 0.5, y - 0.5, private->width, private->height);
_gimp_canvas_item_fill (item, cr);
break;
case GIMP_HANDLE_DIAMOND:
case GIMP_HANDLE_FILLED_DIAMOND:
cairo_move_to (cr, x, y - (gdouble) private->height / 2.0);
......@@ -336,9 +339,19 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
else
_gimp_canvas_item_fill (item, cr);
break;
case GIMP_HANDLE_CROSS:
cairo_move_to (cr, x - private->width / 2, y);
cairo_line_to (cr, x + private->width / 2 - 0.5, y);
cairo_move_to (cr, x, y - private->height / 2);
cairo_line_to (cr, x, y + private->height / 2 - 0.5);
_gimp_canvas_item_stroke (item, cr);
break;
default:
g_assert_not_reached ();
}
cairo_restore (cr);
break;
......@@ -360,16 +373,6 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
_gimp_canvas_item_fill (item, cr);
break;
case GIMP_HANDLE_CROSS:
cairo_move_to (cr, x - private->width / 2, y);
cairo_line_to (cr, x + private->width / 2 - 0.5, y);
cairo_move_to (cr, x, y - private->height / 2);
cairo_line_to (cr, x, y + private->height / 2 - 0.5);
_gimp_canvas_item_stroke (item, cr);
break;
case GIMP_HANDLE_CROSSHAIR:
cairo_move_to (cr, x - private->width / 2, y);
cairo_line_to (cr, x - private->width * 0.4, y);
......
......@@ -393,7 +393,10 @@ gimp_canvas_item_hit (GimpCanvasItem *item,
{
g_return_val_if_fail (GIMP_IS_CANVAS_ITEM (item), FALSE);
return GIMP_CANVAS_ITEM_GET_CLASS (item)->hit (item, x, y);
if (item->private->visible)
return GIMP_CANVAS_ITEM_GET_CLASS (item)->hit (item, x, y);
return FALSE;
}
void
......
......@@ -590,6 +590,10 @@ gimp_canvas_transform_guides_new (GimpDisplayShell *shell,
void
gimp_canvas_transform_guides_set (GimpCanvasItem *guides,
const GimpMatrix3 *transform,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
GimpGuidesType type,
gint n_guides)
{
......@@ -599,6 +603,10 @@ gimp_canvas_transform_guides_set (GimpCanvasItem *guides,
g_object_set (guides,
"transform", transform,
"x1", x1,
"y1", y1,
"x2", x2,
"y2", y2,
"type", type,
"n-guides", n_guides,
NULL);
......
......@@ -60,6 +60,10 @@ GimpCanvasItem * gimp_canvas_transform_guides_new (GimpDisplayShell *shell
void gimp_canvas_transform_guides_set (GimpCanvasItem *guides,
const GimpMatrix3 *transform,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
GimpGuidesType type,
gint n_guides);
......
......@@ -25,9 +25,12 @@
#include "display-types.h"
#include "core/gimpmarshal.h"
#include "gimpcanvasgroup.h"
#include "gimpcanvashandle.h"
#include "gimpcanvasline.h"
#include "gimpcanvastransformguides.h"
#include "gimpdisplayshell.h"
#include "gimptoolwidget.h"
......@@ -42,6 +45,7 @@ enum
enum
{
CHANGED,
SNAP_OFFSETS,
STATUS,
LAST_SIGNAL
};
......@@ -98,6 +102,19 @@ gimp_tool_widget_class_init (GimpToolWidgetClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
widget_signals[SNAP_OFFSETS] =
g_signal_new ("snap-offsets",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpToolWidgetClass, snap_offsets),
NULL, NULL,
gimp_marshal_VOID__INT_INT_INT_INT,
G_TYPE_NONE, 4,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT,
G_TYPE_INT);
widget_signals[STATUS] =
g_signal_new ("status",
G_TYPE_FROM_CLASS (klass),
......@@ -233,6 +250,19 @@ gimp_tool_widget_get_item (GimpToolWidget *widget)
return widget->private->item;
}
void
gimp_tool_widget_snap_offsets (GimpToolWidget *widget,
gint offset_x,
gint offset_y,
gint width,
gint height)
{
g_return_if_fail (GIMP_IS_TOOL_WIDGET (widget));
g_signal_emit (widget, widget_signals[SNAP_OFFSETS], 0,
offset_x, offset_y, width, height);
}
void
gimp_tool_widget_status (GimpToolWidget *widget,
const gchar *status)
......@@ -376,6 +406,30 @@ gimp_tool_widget_add_handle (GimpToolWidget *widget,
return item;
}
GimpCanvasItem *
gimp_tool_widget_add_transform_guides (GimpToolWidget *widget,
const GimpMatrix3 *transform,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
GimpGuidesType type,
gint n_guides)
{
GimpCanvasItem *item;
g_return_val_if_fail (GIMP_IS_TOOL_WIDGET (widget), NULL);
item = gimp_canvas_transform_guides_new (widget->private->shell,
transform, x1, y1, x2, y2,
type, n_guides);
gimp_tool_widget_add_item (widget, item);
g_object_unref (item);
return item;
}
gboolean
gimp_tool_widget_button_press (GimpToolWidget *widget,
const GimpCoords *coords,
......
......@@ -49,6 +49,11 @@ struct _GimpToolWidgetClass
/* signals */
void (* changed) (GimpToolWidget *widget);
void (* snap_offsets) (GimpToolWidget *widget,
gint offset_x,
gint offset_y,
gint width,
gint height);
void (* status) (GimpToolWidget *widget,
const gchar *status);
......@@ -96,8 +101,13 @@ GType gimp_tool_widget_get_type (void) G_GNUC_CONST;
GimpDisplayShell * gimp_tool_widget_get_shell (GimpToolWidget *widget);
GimpCanvasItem * gimp_tool_widget_get_item (GimpToolWidget *widget);
/* for subclasses, to add emit status messages
/* for subclasses, to notify the handling tool
*/
void gimp_tool_widget_snap_offsets (GimpToolWidget *widget,
gint offset_x,
gint offset_y,
gint width,
gint height);
void gimp_tool_widget_status (GimpToolWidget *widget,
const gchar *status);
......@@ -117,18 +127,27 @@ void gimp_tool_widget_pop_group (GimpToolWidget *widget);
/* for subclasses, convenience functions to add specific items
*/
GimpCanvasItem * gimp_tool_widget_add_line (GimpToolWidget *widget,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
GimpCanvasItem * gimp_tool_widget_add_handle (GimpToolWidget *widget,
GimpHandleType type,
gdouble x,
gdouble y,
gint width,
gint height,
GimpHandleAnchor anchor);
GimpCanvasItem * gimp_tool_widget_add_line (GimpToolWidget *widget,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2);
GimpCanvasItem * gimp_tool_widget_add_handle (GimpToolWidget *widget,
GimpHandleType type,
gdouble x,
gdouble y,
gint width,
gint height,
GimpHandleAnchor anchor);
GimpCanvasItem * gimp_tool_widget_add_transform_guides
(GimpToolWidget *widget,
const GimpMatrix3 *transform,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
GimpGuidesType type,
gint n_guides);
/* for tools, to be called from the respective GimpTool method
* implementations
......
......@@ -536,7 +536,7 @@ main (int argc,
}
#endif
abort_message = sanity_check ();
abort_message = sanity_check_early ();
if (abort_message)
app_abort (no_interface, abort_message);
......
......@@ -33,6 +33,7 @@
#include "gimp-intl.h"
/* early-stage tests */
static gchar * sanity_check_gimp (void);
static gchar * sanity_check_glib (void);
static gchar * sanity_check_cairo (void);
......@@ -44,16 +45,22 @@ static gchar * sanity_check_lcms (void);
static gchar * sanity_check_gexiv2 (void);
static gchar * sanity_check_babl (void);
static gchar * sanity_check_gegl (void);
static gchar * sanity_check_gegl_ops (void);
static gchar * sanity_check_filename_encoding (void);
/* late-stage tests */
static gchar * sanity_check_gegl_ops (void);
/* public functions */
/* early-stage sanity check, performed before the call to app_run(). */
const gchar *
sanity_check (void)
sanity_check_early (void)
{
gchar *abort_message = sanity_check_gimp ();
gchar *abort_message = NULL;
if (! abort_message)
abort_message = sanity_check_gimp ();
if (! abort_message)
abort_message = sanity_check_glib ();
......@@ -86,10 +93,27 @@ sanity_check (void)
abort_message = sanity_check_gegl ();
if (! abort_message)
abort_message = sanity_check_gegl_ops ();
abort_message = sanity_check_filename_encoding ();
return abort_message;
}
/* late-stage sanity check, performed during app_run(), after the user
* configuration has been loaded.
*/
const gchar *
sanity_check_late (void)
{
gchar *abort_message = NULL;
/* the gegl ops test initializes all gegl ops; in particular, it initializes
* all the strings used by their properties, which appear in the ui. it
* must be run after we've called language_init(), potentially overriding
* LANGUAGE according to the user config, or else all affected strings would
* use the translation corresponding to the system locale, regardless.
*/
if (! abort_message)
abort_message = sanity_check_filename_encoding ();
abort_message = sanity_check_gegl_ops ();
return abort_message;
}
......@@ -97,6 +121,9 @@ sanity_check (void)
/* private functions */
/* early-stage tests */
static gboolean
sanity_check_version (guint major_version, guint required_major,
guint minor_version, guint required_minor,
......@@ -520,6 +547,58 @@ sanity_check_gegl (void)
return NULL;
}
static gchar *
sanity_check_filename_encoding (void)
{
gchar *result;
GError *error = NULL;
result = g_filename_to_utf8 ("", -1, NULL, NULL, &error);
if (! result)
{
gchar *msg =
g_strdup_printf
(_("The configured filename encoding cannot be converted to UTF-8: "
"%s\n\n"
"Please check the value of the environment variable "
"G_FILENAME_ENCODING."),
error->message);
g_error_free (error);
return msg;
}
g_free (result);
result = g_filename_to_utf8 (gimp_directory (), -1, NULL, NULL, &error);
if (! result)
{
gchar *msg =
g_strdup_printf
(_("The name of the directory holding the GIMP user configuration "
"cannot be converted to UTF-8: "
"%s\n\n"
"Your filesystem probably stores files in an encoding "
"other than UTF-8 and you didn't tell GLib about this. "
"Please set the environment variable G_FILENAME_ENCODING."),
error->message);
g_error_free (error);
return msg;
}
g_free (result);
return NULL;
}
/* late-stage tests */
static gchar *
sanity_check_gegl_ops (void)
{
......@@ -658,52 +737,3 @@ sanity_check_gegl_ops (void)
return NULL;
}
static gchar *
sanity_check_filename_encoding (void)
{
gchar *result;
GError *error = NULL;
result = g_filename_to_utf8 ("", -1, NULL, NULL, &error);
if (! result)
{
gchar *msg =
g_strdup_printf
(_("The configured filename encoding cannot be converted to UTF-8: "
"%s\n\n"
"Please check the value of the environment variable "
"G_FILENAME_ENCODING."),
error->message);
g_error_free (error);
return msg;
}
g_free (result);
result = g_filename_to_utf8 (gimp_directory (), -1, NULL, NULL, &error);
if (! result)
{
gchar *msg =
g_strdup_printf
(_("The name of the directory holding the GIMP user configuration "
"cannot be converted to UTF-8: "
"%s\n\n"
"Your filesystem probably stores files in an encoding "
"other than UTF-8 and you didn't tell GLib about this. "
"Please set the environment variable G_FILENAME_ENCODING."),
error->message);
g_error_free (error);
return msg;
}
g_free (result);
return NULL;
}
......@@ -23,7 +23,8 @@
#endif
const gchar * sanity_check (void);
const gchar * sanity_check_early (void);
const gchar * sanity_check_late (void);
#endif /* __SANITY_H__ */
......@@ -683,9 +683,9 @@ gimp_action_group_add_procedure_actions (GimpActionGroup *group,
* @group: the #GimpActionGroup to which @action belongs.
* @action: the #GimpAction.
*
* This function removes action from the groupe and clean any
* This function removes @action from @group and clean any
* accelerator this action may have set.
* If you wish only to only remove the action from the group, use
* If you wish to only remove the action from the group, use
* gtk_action_group_remove_action() instead.
*/
void
......
......@@ -3,12 +3,13 @@
dynamicsbasicdatadir = $(gimpdatadir)/dynamics/Basic
dynamicsbasicdata_DATA = \
Basic-Simple.gdyn \
Dynamics-Random.gdyn \
Negative-Size-Pressure.gdyn \
Pencil-Generic.gdyn \
Pencil-Shader.gdyn \
Pen-Generic.gdyn \
Pressure-Opacity.gdyn
Basic-Simple.gdyn \
Dynamics-Random.gdyn \
Negative-Size-Pressure.gdyn \
Pencil-Generic.gdyn \
Pencil-Shader.gdyn \
Pen-Generic.gdyn \
Pressure-Opacity.gdyn \
Pressure-Size.gdyn
EXTRA_DIST = $(dynamicsbasicdata_DATA)
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -115,6 +115,7 @@
#define SAVE_PROC "file-pdf-save"
#define SAVE2_PROC "file-pdf-save2"
#define SAVE_MULTI_PROC "file-pdf-save-multi"
#define PLUG_IN_BINARY "file-pdf-save"
#define PLUG_IN_ROLE "gimp-file-pdf-save"
......@@ -148,11 +149,10 @@ typedef enum
SA_VECTORIZE,
SA_IGNORE_HIDDEN,
SA_APPLY_MASKS,
SA_LAYERS_AS_PAGES,
SA_ARG_COUNT
} SaveArgs;
#define SA_ARG_COUNT_DEFAULT 5
typedef enum
{
SMA_RUN_MODE,
......@@ -171,6 +171,7 @@ typedef struct
gboolean vectorize;
gboolean ignore_hidden;
gboolean apply_masks;
gboolean layers_as_pages;
} PdfOptimize;
typedef struct
......@@ -258,16 +259,16 @@ static PdfMultiPage multi_page;
static PdfOptimize optimize =
{
TRUE, /* vectorize */
TRUE, /* ignore_hidden */
TRUE /* apply_masks */
TRUE, /* vectorize */
TRUE, /* ignore_hidden */
TRUE, /* apply_masks */
FALSE /* layers_as_pages */
};
static GtkTreeModel *model;
static GtkWidget *file_choose;
static gchar *file_name;
GimpPlugInInfo PLUG_IN_INFO =
{
NULL,
......@@ -285,26 +286,39 @@ query (void)
{
static GimpParamDef save_args[] =
{
{ GIMP_PDB_INT32, "run-mode", "Run mode" },
{ GIMP_PDB_IMAGE, "image", "Input image" },
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
{ GIMP_PDB_STRING, "filename", "The name of the file to save the image in" },
{ GIMP_PDB_STRING, "raw-filename", "The name of the file to save the image in" },
{ GIMP_PDB_INT32, "vectorize", "Convert bitmaps to vector graphics where possible. TRUE or FALSE" },
{ GIMP_PDB_INT32, "ignore-hidden","Omit hidden layers and layers with zero opacity. TRUE or FALSE" },