Commit Graph

19905 Commits

Author SHA1 Message Date
Ell 5effdd03b4 app: add dedicated op for pass through mode, with shortcuts
Pass through mode uses the same compositing logic as REPLACE mode,
however, it's a special case of REPLACE, where the layer is already
composited against the backdrop.  This allows us to take a few
shortcuts that aren't generally applicable to REPLACE mode.

Add a dedicated op class for pass through mode, derived from the
REPLACE mode op, implementing these shortcuts.
2017-08-31 11:39:38 -04:00
Michael Natterer 2e6c39ed9c pdb, libgimp: rename gimp_drawable_invert() to _invert_non_linear()
and add gimp_drawable_invert_linear(). Also, finally deprecate
gimp_invert() and port all its uses in plug-ins and scripts to
gimp_drawable_invert_non_linear() so the result is the same.
2017-08-30 12:27:17 +02:00
Ell 494d18941d Bug 785152 - The default GIMP brush should not be a clipboard brush
Fix the default brush name -- "Round Fuzzy" was gone for a while :P

The fact that "Hardness 050" was the default brush regardless is a
conincidence; see the bug report for more details.
2017-08-28 16:03:00 -04:00
Michael Natterer 2a9bacb528 configure.ac: require Babl >= 0.1.31 and GEGL >= 0.3.21 2017-08-28 11:34:48 +02:00
Ell 0ef3795f0a */Makefile.am: work around a bug in the new glib-genmarshal
glib-genmarshal was rewritten in glib 2.53.4, and as of now (2.53.6)
it has a bug where it unconditionally generates marshaler bodies,
even for standard marshalers, even with --stdinc.  This causes
libgimpwidgets to define and export g_cclosure_marshal_VOID__INT()
and g_cclosure_marshal_VOID__OBJECT(), which upsets defcheck, and
breaks the build.

Work around this for now by using --header --body when generating
the marshal.c files, which includes the prototypes in the source,
instead of including the header ourselves.  This is the only code
path where the new glib-genmarshal doesn't generate bodies for
standard marshalers.  Note, however, that this usage is deprecated,
so we'll probably want to change it back once it's fixed.
2017-08-27 15:33:09 -04:00
Ell 58fdaae3ad enums: add intermediate generated enum files to .gitignore 2017-08-24 15:35:27 -04:00
Michael Natterer 1c740f0d21 app: update .gitignore in app/gegl/ 2017-08-24 20:14:56 +02:00
Michael Natterer e16c8a2352 Move the new "default_new_layer_mode" APIs to the image...
...in both the core and libgimp.

Images now know what the default mode for new layers is:

- NORMAL for empty images
- NORMAL for images with any non-legacy layer
- NORMAL_LEGAVY for images with only legacy layers

This changes behavior when layers are created from the UI, but *also*
when created by plug-ins (yes there is a compat issue here):

- Most (all?) single-layer file importers now create NORMAL layers
- Screenshot, Webpage etc also create NORMAL layers

Scripts that create images from scratch (logos etc) should not be
affected because they usually have NORMAL_LEGACY hardcoded.

3rd party plug-ins and scripts will also behave old-style unless they
get ported to gimp_image_get_default_new_layer_mode().
2017-08-21 20:18:00 +02:00
Ell f13c177ea7 app: fix babl format names in luminance mode
More refactoring fallout :P
2017-08-20 17:15:32 -04:00
Michael Natterer 59fae30b53 pdb: add new procedure gimp-get-default-new-layer-mode
Which returns GimpCoreConfig::default-new-layer-mode and will be
used to make plug-ins create layers/images in the configured way.
2017-08-20 16:12:53 +02:00
Michael Natterer 1cbb2f3309 app: add a comment to test-xcf.c about why we use LEGACY layer modes 2017-08-20 15:02:46 +02:00
Michael Natterer 7ce77c47cc app: stop hardcoding NORMAL_LEGACY for new layers/images
Use GimpCoreConfig::default-new-layer-mode instead.
2017-08-20 15:02:46 +02:00
Michael Natterer a256cf3338 app: add GimpCoreConfig::default-new-layer-mode
which for now has no UI and still defaults to NORMAL_LEGACY.
2017-08-20 14:09:35 +02:00
Michael Natterer b89d10a830 app: fix compositing of non-LEGACY layers in "show mask" mode
gimp_layer_update_mode_node(): when showing the mask, set mode to
NORMAL, and make sure that the composite space is PERCEPTUAL for
LEGACY layers, and LINEAR (or whatever is chosen in layer attibutes)
otherwise.
2017-08-20 14:09:35 +02:00
Michael Natterer 730573375d app: use GIMP_LAYER_MODE_NORMAL for most tests in app/tests/ 2017-08-20 14:09:35 +02:00
Ell 77f51dd737 app: specify blend function for GIMP_LAYER_MODE_COLOR_ERASE_LEGACY
This is what happens when you edit code with sed :P
2017-08-19 15:37:49 -04:00
Michael Natterer 0cfe550639 app, pdb: change a lot of GIMP_LAYER_MODE_NORMAL_LEGACY to just NORMAL
this commit changes just those which make no difference to
functionality: property and object member defaults that get overridden
anyway, return values of g_return_val_if_fail(), some other stuff.
2017-08-19 20:33:47 +02:00
Michael Natterer 58a68f5e98 app: add a missing case to a switch in GimpToolRectangle
The case's code was there but unreachable. This fix probably makes no
difference, but it was broken.
2017-08-19 20:05:00 +02:00
Øyvind Kolås bac042db39 app/gegl: temp hotfix to disable threading in gegl:copy-buffer 2017-08-19 17:12:15 +02:00
Michael Natterer 94c6bb4603 Bug 783755 - Smudge should blend the smudged colors using linear RGB
Looked a bit deeper into heal: while I didn't try to understand what
it's actually doing, this is strange: there is a comment that says
that healing should done in perceptual space, and the code uses
R'G'B'A float (at least it completely did before the last commit).

On the other hand, the code adds and subtracts temporary buffers,
which screams "gamma artifacts" unless done in linear space.

This commit changes everything to use linear float buffers,
and removes the comment. It "looks" right to me now, please test.
2017-08-18 23:54:26 +02:00
Ell 64ade97702 app: move libappgegl's SSE2 bits to a separate library
Split libappgegl into libappgegl-generic and libappgegl-sse2, and
move the SSE2 code (part of the newly added smudge code) to the
latter, so that the rest of the code can be compiled without SSE2
compiler flags.  This allows building GIMP with SSE acceleration
enabled, while running the resulting binary on a target with no
SSE accelration.
2017-08-17 13:04:27 -04:00
Ell 71bbd88e00 app: layer mode code shuffling
Commit 3635cf04ab moved the special
handling of bottom-layer compositing to GimpOperationLayerMode.
This required giving the op more control over the process()
function of its subclasses.  As a temporary workaround, the commit
bypassed the subclasses entirely, using "gimp:layer-mode" for all
modes.  This is the reckoning :)

Add a process() virtual function to GimpOperationLayerMode, which
its subclasses should override instead of
GeglOperationPointComposer3's process() functions.  Reinstate the
subclasses (by returning the correct op in
gimp_layer_mode_get_oepration()), and have them override this
function.

Improve the way gimp_operation_layer_mode_process() dispatches to
the actual process function, to slightly lower its overhead and
fix some thread-safety issues.

Remove the "function" field of the layer-mode info array, and have
gimp_layer_mode_get_function() return the
GimpOperationLayerMode::process() function of the corresponding
op's class (caching the result, to keep it cheap.)  This reduces
redundancy, allows us to make the ops' process() functions private,
and simplifies SSE dispatching (only used by NORMAL mode,
currently.)

Move the blend and composite functions of the non-specialized
layer modes to gimpoperationlayermode-{blend,composite}.[hc],
respectively, to improve code organization.

Move the SSE2 composite functions to a separate file, so that they
can be built as part of libapplayermodes_sse2, allowing
libapplayermodes to be built without SSE2 compiler flags.  This
allows building GIMP with SSE acceleration enabled, while running
the resulting binary on a target with no SSE accelration.

Add a "blend_function" field to the layer-mode info array, and use
it to specify the blend function for the non-specialized modes.
This replaces the separate switch() statement that we used
previously.

Remove the "affected_region" field of the layer-mode info array.
We don't need it anymore, since we can go back to using
GimpOperationLayerMode's virtual get_affected_region() function.

Last but not least, a bunch of code cleanups and consistency
adjustments.
2017-08-17 11:19:37 -04:00
Øyvind Kolås 4410ab0db0 bump required GEGL version to 0.3.20 2017-08-15 23:11:12 +02:00
Jehan a3cd156265 app: remove useless double space.
I don't think there is any good reason for the distance/angle to be
separated by 2 spaces from the status message.
2017-08-15 21:12:17 +02:00
Jehan 78244f9cb5 Bug 785816 - show angle in degrees when drawing straight lines.
Paint tools in straight line mode (shift click) will now display the
angle in status bar. Angle 0 is considered as the horizontal line from
left to right, and angle is measured counterclockwise from there, which
is the most common convention.
2017-08-15 20:57:50 +02:00
Øyvind Kolås 90a808e863 bump required babl version to 0.1.30 2017-08-15 20:54:05 +02:00
Michael Natterer b926de5ada Bug 783755 - Smudge should blend the smudged colors using linear RGB
Use GIMP_LAYER_MODE_NORMAL (not NORMAL_LEGACY) when falling back from
gimp_paint_core_replace() to gimp_paint_core_paste() for layers
without alpha. Adapt the format of the used paint buffers accordingly.
2017-08-12 21:35:47 +02:00
Michael Natterer 26a238c5fb app: default the number of threads used to g_get_num_processors()
Let the bug reporting begin.
2017-08-08 23:03:20 +02:00
Ell 67fc418c3c app: adapt gimp_image_merge_layers() to handle pass-through groups ...
... and fix flatten-image along the way.  *And* do some cleanup.

Currently, gimp_image_merge_layers() combines the layers on its own,
one by one.  This is incompatible with pass-through groups, because
the group's buffer is rendered independently of its backdrop, while
we need to take the backdrop into account when mergeing the group.

Instead, render the subgraph of the parent graph, corresponding to
the set of merged layers, directly into the new layer.  Since the
layers we merge are always visible and continuous, all we need is a
minor massage to the parent graph to make it work.  This takes care
of pass-through groups intrinsicly.

This commit also changes the behavior of flatten-image:  Currently,
the flattened layers are rendered directly on top of the opaque
background, which can make previously-hidden areas (due to layers
using composite modes other than src-over, or legacy layer modes)
visible.  This is almost certainly not desirable.

Instead, construct the graph such that the flattened layers are
combined with the background only after being merged with one
another.
2017-08-08 15:39:28 -04:00
Ell 3635cf04ab app: move bottom-layer special casing to GimpOperationLayerMode
GimpFilter's is_last_node field only reflects the item's position
within the parent stack.  When a layer is contained in a pass-
through group, it can be the last layer of the group, while not
being the last layer in the graph as a whole (paticularly, if
there are visible layers below the group).  In fact, when we have
nested pass-through groups, whether or not a layer is the last
node depends on which group we're considering as the root (since
we exclude the backdrop from the group's projection, resulting in
different graphs for different groups).

Instead of rolling our own graph traversal, just move the relevant
logic to GimpOperationLayerMode, and let GEGL do the work for us.
At processing time, we can tell if we're the last node by checking
if we have any input.

For this to work, GimpOperationLayerMode's process() function needs
to have control over what's going on.  Replace the derived op
classes, which override process(), with a call to the layer mode's
function (as per gimp_layer_mode_get_function()) in
GimpOperationLayerMode's process() function.  (Well, actually, this
commit keeps the ops around, and just hacks around them in
gimp_layer_mode_get_operation(), because laziness :P)

Keep using the layer's is_last_node property to do the invalidation.
2017-08-08 15:39:28 -04:00
Ell 1ca1e15dd0 app: implement {begin,end}_render() for GimpGroupLayer
Use them to connect/disconnect the stack graph when the group is
in pass-through mode.
2017-08-08 15:39:28 -04:00
Ell 1c68617302 app: use {begin,end}_render() and GimpTileHandlerProjectable ...
... in GimpProjection and gimp_display_shell_render() (the latter
is not really necessary, but whatever.)
2017-08-08 15:39:27 -04:00
Ell 426bc371cd app: add GimpTileHandlerProjectable
GimpTileHandlerProjectable is similar to GimpTileHandlerValidate,
except that it calls {begin,end}_render() on its associated
projectable before validating.
2017-08-08 15:39:27 -04:00
Ell f0aec02dff app: add gimp_projectable_{begin,end}_render()
In pass-through mode, the group layer-stack's input is connected to
the backdrop.  However, when rendering the group's projection, we
want to render the stack independently of the backdrop.
Unfortunately, we can't use the stack's graph as a subgraph of two
different graphs.

To work around that, the next few commits add a mechanism for a
projectable to be notified before and after its graph is being
rendered.  We use this mechanism to disconnect the stack's graph
from the backdrop before rendering the projection, and reconnect
it afterwards.  Yep, it's ugly, but it's better than having to
maintain n copies of (each node of) the graph (each nesting level
requires an extra copy.)

This commit adds {begin,end}_render() functions to GimpProjectable.
These functions should be called right before/after rendering the
projectable's graph.
2017-08-08 15:39:27 -04:00
Ell dc1d61ff91 app: handle excludes_backdrop in GimpGroupLayer
When any of the children of a pass-through group excludes its
backdrop, the group itself should exclude the backdrop too.  Override
get_excludes_backdrop() to follow this logic, and call
update_excludes_backdrop() when this condition might change.

Note that we always composite pass-through groups using src-over mode,
so to actually hide the backdrop, we need to disconnect it from the
group's mode node's input pad (and reconnect it, when the backdrop is
no longer hidden).
2017-08-08 15:39:27 -04:00
Ell 10371ec22f app: implement pass-through mode in GimpGroupLayer
Override GimpDrawable::get_source_node() for GimpGroupLayer.  Use
a node that contains both the drawable's buffer-source node, and the
layer stack's graph node.  Choose which one of these to connect to
the source node's output based on the group's layer mode: the stack
graph for pass-through mode, and the buffer-source node for all the
rest.

When in pass-through mode, connect the source node's input (which
receives the backdrop) to the stack graph's input.  Keep maintaining
the projection in pass-through mode.  ATM, the projection uses the
same graph as the source node, so it's rendered against the group's
backdrop -- we don't want that.  The next few commits fix it.

Update the group's drawable directly upon filter stack update in
pass-though mode, because the group's graph doesn't go through the
projection.

TODO: if any of the group's children (or a child of a nested pass-
through group, etc.) uses dst-atop/src-in, this needs special
attention.
2017-08-08 15:39:27 -04:00
Ell ac3190215b app: connect layer backdrop to source node's input
Make sure the input of the layer's filter node is connected to its
source node (when it has an input pad), so that, once we implement
pass-though mode, the group's source node can see the backdrop.
2017-08-08 15:39:27 -04:00
Ell 785a0834a2 app: add GimpDrawable::get_source_node() vfunc
For pass-through groups, we want to use the group's layer-stack
graph directly in its filter node, in place of the drawable's
buffer-source node.  Add a get_source_node() vfunc to GimpDrawable,
which defaults to returning the buffer-source node, and use it in
gimp_drawable_get_source_node() instead of using the buffer-source
node directly.  We'll later override this function for
GimpGroupLayer.
2017-08-08 15:39:26 -04:00
Ell 440d8d6855 app: add pass-through layer mode
Only add the enum-value/mode-info for now.  Pass-through mode
appears above normal mode, in the default group, for layer groups
only.
2017-08-08 15:39:26 -04:00
Ell 7ecd3f2783 Bug 785890 - libappgegl doesn't use SSE2 compiler flags ...
... causing compilation to fail on 32 bit targets

Use SSE2 compiler flags when building libappgegl, since it's used by
the new smudge tool code.

Avoid using SSE for the smudge tool if SSE acceleration is disabled
at runtime, or if the buffers are not properly aligned.
2017-08-06 14:13:01 -04:00
Michael Natterer c41e8eca86 Bug 785535 - Histogram not updating in real when filters are active
Add "gboolean with_filters" to gimp_drawable_calculate_histogram(),
which is passed as FALSE in almost all places, except the histogram
dockable where we want to see both the drawable's unmodified histogram
*and* the histogram after filters are applied.
2017-08-05 17:15:31 +02:00
Michael Natterer 572063765f app: use "const GeglRectangle*" in the GimpTileHandlerValidate API 2017-08-05 15:49:06 +02:00
Michael Natterer 12f920d8bf app: change GimpTileHandlerValidate's API to use GeglRectangle
instead of x, y, width, height.
2017-08-05 15:43:41 +02:00
Michael Natterer bf6c3cb4ba app: add gimp_drawable_has_filters()
which returns TRUE if the drawable has any visible filter.
2017-08-05 15:37:56 +02:00
Ell 2d11d29157 app: improve GimpToolLine slider motion clamping/constraint
During constrained motion, round the slider value before clamping
it, so that the slider limits are always enforced.  Additionally,
snap the slider to 1/12-ths of the line length, rather than
1/24-ths.

Make sure that sliders can never have negative-zero values, which
can result in a -inf base for spiral.
2017-07-30 14:03:03 -04:00
Jehan 7c171b4df9 app: exclusive visibility in item group only toggles within the group.
Shift-click should actually toggle only within a given group. The new
capability of toggling only a sub-item, brought by commit 970e9ac is
still feasible in 2 steps: first toggling the parent (item group), then
the desired child.
It brings now a third possibility with exclusive toggle among many
children items, without touching other groups and top-level items.
2017-07-30 16:35:37 +02:00
Ell 06a4e1549f app: swap base and balance slider order in spiral
... so that when the base and balance sliders overlap, the base
slider is the one that's picked, since the balance slider is
constrained by the base, but not the other way around.
2017-07-30 07:40:44 -04:00
Ell 8e946ca307 app: don't calculate balance when base == 1 in spiral, to avoid NaN 2017-07-30 07:25:30 -04:00
Michael Natterer 1acaa4444b app: make number-of-threads default value calculation less obfuscated 2017-07-29 00:08:59 +02:00
Ell eef09abf3a app, menus: add gegl:spiral to the menus 2017-07-28 17:48:03 -04:00
Jehan 1ec2bccc8a app, docs: s/in order do/in order to/. 2017-07-28 23:11:48 +02:00
Jehan 1941e5139e app: minor s/placeolder/placeholder/ 2017-07-28 22:57:09 +02:00
Ell 8121769dc9 app: don't propagate NULL error when saving XCFs
xcf_save_foo() can fail without setting the error object, in which
case trying to propagate it emits a CRITICAL.
2017-07-28 16:51:08 -04:00
Ell 6b84293078 app: limit allowable tile data size in XCFs
When loading tiles from an XCF, reject tiles whose on-disk size is
greater than 1.5 times the size of an uncompressed tile -- a limit
that is already present for the last tile in the buffer.  This
should allow for the possibility of negative compression, while
restricting placing a realistic limit.

Currently, no limit is placed on the on-disk tile data size.  When
loading RLE- and zlib-compressed tiles, a buffer large enough to
hold the entire on-disk tile data, up to 2GB, is allocated on the
stack, and the data is read into it.  If the file is smaller than
the reported tile data size, the area of the buffer past the end
of the file is not touched.  This allows a malicious XCF to write
up to 2GB of arbitrary data, at an arbitrary offset, up to 2GB,
below the stack.

Note that a similar issue had existed for earlier versions of GIMP
(see commit d7a9e6079d), however,
since prior to 2.9 the tile data buffer was allocated on the heap,
the potential risk is far smaller.
2017-07-28 16:51:08 -04:00
Michael Natterer 7a10afca39 app: turn magic matching debug output into GIMP_LOG() 2017-07-28 22:35:13 +02:00
Michael Natterer d227a0d71f app: disable gimp_display_shell_profile_update() debug output 2017-07-28 22:34:41 +02:00
Michael Natterer bb93e3401f Bug 785427 - GIMP crashes after applying any GEGL filter
Need to access GimpSettings' "time" property using gint64 variables
now.
2017-07-27 22:20:09 +02:00
Michael Natterer 2a7a53b384 Bug 785240 - Naming the first color in a new palette is hard
Use the proper API to select a newly added palette color, so all
internal states are updated and the entry becomes editable.
2017-07-25 22:50:15 +02:00
Michael Natterer 713995e27d Bug 784261 - Have some nice error message for formats known to work...
...with known plugins

Add new plug-in file-raw-placeholder.c that registers itself for
loading all RAW formats from file-raw/file-formats.h, but does nothing
except returning an error message pointing to darktable and
RawTherapee.

When no real RAW loader is installed, this plug-in is selected
automatically as RAW loader, otherwise the first installed RAW loader
is used. Selecting another in prefs still works as before.
2017-07-24 22:19:53 +02:00
Michael Natterer 287cfb1413 app: some more g_clear_pointer() in gimp_plug_in_manager_finalize() 2017-07-24 22:18:54 +02:00
Michael Natterer 0b9dd1d800 configure.ac: require gexiv2 >= 0.10.6 2017-07-23 15:58:28 +02:00
Michael Natterer 7d5f1e44f2 app: change GimpSettings to store its time as gint64
and use GDateTime for handling it.
2017-07-23 15:18:55 +02:00
Michael Natterer bcda53ee7b Bug 785001 - Enhanced smudge tool: Smudge with painting
Apply patches from shark0r that alow to mix in both constant and
gradient color while smudging; and clean up the patches.
2017-07-23 14:44:22 +02:00
Jehan 894d85f64a app: GIMP_MAX_NUM_THREADS should follow max value of GeglConfig's...
... "threads" property.
Actually there is no need of having a public GEGL_MAX_THREADS as written
in the previous commit. We can just retrieve the max for a GObject
property.
2017-07-18 16:41:32 +02:00
Jehan 32ffabcba4 Bug 784226 - Maximum of processing threads hard-coded to 16.
Raise GIMP_MAX_NUM_THREADS to 64, following the changes in GEGL (see
GEGL commits 6d128ac and f26acbb). This is still considered unstable and
to be used at one's own risk (cf. GIMP commit 1f5739d) but at least, it
could allow discovering and fixing bugs.
It would be nice if GEGL_MAX_THREADS could be public so that to not have
to edit this by hand at each change.
2017-07-18 16:07:15 +02:00
Jehan 3fa2127854 app: fixes for previously contributed commit.
- trailing whitespaces cleaned out;
- vectors are called "path" in all visible strings;
- do not check for floating selection and active channel: oppositely to
  layers, a vector can be selected in the same time as a channel, and
  while there is a floating selection.
2017-07-18 13:35:02 +02:00
Lionel N 2de6beaea8 Bug 585607 - Vectors select (next, previous, top & bottom)
Now possible to have keybindings for previous/next/top/bottom vector
2017-07-18 13:27:29 +02:00
Michael Natterer 04a53dbce3 app: consistently name the filter tool presets "Presets" in the GUI 2017-07-18 00:30:55 +02:00
Michael Natterer bef155ef30 app: prepend "Last used: " to the names of the automatic filter presets
and add a tooltip about renaming them in order to save them
permanently.
2017-07-18 00:29:45 +02:00
Michael Natterer 9af78831ea app: add a tooltip to the color temperature preset menu button 2017-07-18 00:28:56 +02:00
Michael Natterer cb0757e1c5 app: split some utils out of gimppropgui.[ch] to gimppropgui-utils.[ch] 2017-07-16 20:14:18 +02:00
Michael Natterer 694fde485e app: fix area-based scale_limits in gimp_prop_widget_new_from_pspec()
Don't set scale limits outside the hard limits of the GParamSpec,
and remove debug g_printerr().
2017-07-16 16:44:49 +02:00
Massimo Valentini f2306abc0a Bug 761170: Warnings building with clang
Fix some of the warnings.
2017-07-15 21:05:56 +02:00
Michael Natterer 4208aceafe app: make GimpToolTransformGrid handle modifiers itself
and update the grid as soon as a constraint is changed, not only on
the next motion. Change GimpTransformTool to forward the events to the
widget if it exists, but still handle them if it doesn't (yes this
code duplication is ugly, but the widget can hardly handle events if
it doesn't exist...).
2017-07-15 19:34:08 +02:00
Michael Natterer 0a5251c97a app: simplify gimp_transform_tool_modifier_key()
No need to have n g_object_set() to set n properties, use one call
instead.
2017-07-15 19:17:07 +02:00
Michael Natterer 0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
2017-07-15 18:42:44 +02:00
Michael Natterer f3561549bb app: fix leaks when freeing the list of accum_buffers in gimpsmudge.c 2017-07-15 18:42:43 +02:00
Michael Natterer a223ba8f40 Bug 707745 - Selected text is hard to read in the text tool's on-canvas editor
Change the text selection to draw an outline around each selected
glyph. It looks just as ugly as before but at least keeps the text
readable regardless of its color.
2017-07-13 12:34:54 +02:00
Ell e15a444656 Bug 784799 - select > shrink and border produce horizontal gaps in selection
The grow, shrink, and border ops are written to process the entire
input at once, so chunking breaks them.  Just make them non-threaded
for now.
2017-07-11 16:49:49 -04:00
Michael Natterer 4f2c0dd846 Bug 784802 - crop tool incorrectly detects current aspect ratio
When starting the crop tool, set its default aspect ratio to that of
the current layer/image. Dunno what change exactly broke it, but it
was broken.
2017-07-11 21:35:32 +02:00
Michael Natterer 8f6c0fd17c app: use some canvas item highlighting in GimpCageTool
and don't draw two handles on top of each other for selected points.
2017-07-11 12:43:24 +02:00
Michael Natterer f73b7f986b app: remove obsolete prototypes from gimpmovetool.h 2017-07-11 12:42:30 +02:00
Michael Natterer 44d7a26613 app: remove GimpFilterTool's "drawable" member
and use GimpTool's drawable. I guess at some point tool->drawable was
somewhat unpredictable, this is not the case any longer.
2017-07-10 23:28:49 +02:00
Michael Natterer 77f1424777 app: fix modifying the selection while GimpRectangleSelectTool is active
if did revert to the previous selection and thus break stuff like
enbaling quick mask or inverting the selection, because I merged the
undo magic it does into gimp_rectangle_select_tool_halt(), whereas
before it was done by the former gimp_rectangle_tool_cancel(), so only
on explicit cancel not HALT from whatever source.

Do the same in the new code and move the undo magic from halt() to
rectangle_response(CANCEL), which is exactly the same distinction as
with the old GimpRectangleTool code.
2017-07-09 20:51:49 +02:00
Ell 27d5dcf20a app: don't remove dirname in save dialog when adding file extension
When the user provides a filename without an extension in the save
dialog, we add one for them, update the filename in the dialog, and
retry.  However, the updated filename is made up of only the
basename, leaving out the dirname part, if specified.  This means
that if the user enters "/somedir/somefile", the new filename
becomes "somefile.xcf", which refers to the current directory,
instead of "somedir".

Fix this by maintaining the dirname when adding a file extension.
2017-07-09 14:45:01 -04:00
Michael Natterer 5bf0e3c3d2 app: fix initializing a rectangle select by clicking into a selection
Don't unconditionally call COMMIT in rectangle_response(), because
that now implicitly HALTs the tool. Instead, check if we got here
because of a click, and call our commit() directly.
2017-07-09 20:09:23 +02:00
Michael Natterer afb9941c80 app: allow to close a GimpToolPolygon without committing it
so we can edit a complete shape, and reopen it to continue editing,
instead of immediately selecting when the first point is clicked.
2017-07-09 19:26:19 +02:00
Michael Natterer 4f7fff8cb8 app: change some gimp-operation-config.[ch] parameters to GObject
They were GimpObject for no reason, also inconsistent with other
places where we deal with config objects.
2017-07-09 19:20:55 +02:00
Michael Natterer 29795a29eb app: remove all "has_settings" stuff from the GimpFilterTool API
Instead, use gimp_operation_config_list_properties() to figure if an
operation has editable properties directly in
gimp_filter_tool_get_operation().
2017-07-09 18:59:54 +02:00
Michael Natterer 51cc6893ab app: add gimp_operation_config_list_properties()
which is the same as g_object_class_list_properties() but filters
out the properties for which we don't want to create a GUI.

Use it in gimp_prop_gui_new().
2017-07-09 17:59:29 +02:00
Michael Natterer 2a75df030e app: rename all GimpOperationTool variables to "op_tool"
Mostly to fix my own confusion, the variable name "tool" is used for
GimpTool everywhere else.
2017-07-09 17:31:25 +02:00
Michael Natterer 6a312a71f3 app: simplify GimpTool::undo() and ::redo()
Check for gimp_tool_can_undo() and can_redo() in gimptool.c, before
calling undo() and redo(), instead of doing the same in each tool
individually.
2017-07-09 17:22:06 +02:00
Michael Natterer 1c01f10329 app: rename gimp_transform_tool_transform() to gimp_transform_tool_commit()
and modernize some more stuff like initialize().
2017-07-09 16:48:52 +02:00
Michael Natterer 0459e301b7 Bug 784716 - Bump Map not working
GimpOperationTool's aux inputs were not properly ported to the new way
filter tools work (complete destruction and re-creation of the tool
dialog).

Split creating the operation GUI and adding it to the dialog into
separate functions, and call them at the right places.
2017-07-09 16:27:46 +02:00
Michael Natterer ef294f4a54 app: clean up how tools are COMMITed and HALTed
Call HALT generically in gimp_tool_control() after calling COMMIT, and
remove all hacks in tools that call both COMMIT and HALT or call
halt() from commit().

Some tools interact with their subclasses (e.g. filter tool and
operation tool), and it's essential that COMMIT runs through the
entire class hierarchy before HALT.

Probably breaks something, please test.
2017-07-09 16:25:42 +02:00
Michael Natterer 23ae146d95 Bug 777485 - Move unified transform tool shear handles to places...
...corresponding to the spec
2017-07-08 18:21:33 +02:00
Michael Natterer a5fe6b8372 Clean up metadata menu stuff: capitalization, separator, indentation 2017-07-08 09:39:31 +02:00
Alexandre Prokoudine c68239e937 Make new Metadata submenu and new dialogs' captions translatable.
Adjust the tooltip for the Edit Metadata menu item.
2017-07-08 03:16:41 +03:00
Michael Natterer 16cfcf1bde app: remove some #if 0'ed code from GimpToolPolygon 2017-07-06 12:32:36 +02:00
Michael Natterer 787f645c57 app: fiddle less with GimpFilterTool internals in GimpOperationTool
Use gimp_filter_tool_disable_color_picking() in
gimp_operation_tool_set_operation() instead of poking around manually.
2017-07-05 20:54:21 +02:00
Michael Natterer 84269cc608 app: move the add_controller() callback to GimpFilterTool
Why I added it to GimpOperationTool first, I have no idea...
2017-07-05 20:33:11 +02:00
Michael Natterer 3f6e9e429d app: don't crash in gimp_tool_info_get_description()
Found and tracked down by Elle Stone.
2017-07-05 18:34:37 +02:00
Michael Natterer f6c2e807e0 app: don't completely clear a GimpOperationTool when it's halted
Need to keep around the operation's name and its description, so
everything can be re-created when an image is clicked.

Instead, completely shut down GimpOperationTool when GimpGeglTool is
halted, so the next click will bring up a dialog with only the
operation selection combo.
2017-07-05 12:28:40 +02:00
Michael Natterer bc708fb2fb app: fix curves and levels tool to not crash with how GimpFilterTool works now
The tool dialog can now be completely shut down and re-created, make
sure we don't run into dangling pointers in the time when there is no
dialog.
2017-07-05 12:24:47 +02:00
Michael Natterer bc1997eeeb app: fix shutdown of GimpHistogramView
Not only unref the histograms, also disconnect from their signals.
2017-07-05 12:21:23 +02:00
Michael Natterer 36656175d1 app: some more s/blurb/label/ and s/help/tooltip/ in app/tools/ 2017-07-04 22:36:24 +02:00
Michael Natterer c682c5466c app: add an optional "label" to GimpTool which overrides GimpToolInfo's
Remove GimpFilterTool's "title" and use the GimpTool's "label" instead.
2017-07-04 22:31:17 +02:00
Michael Natterer d521510967 app: fix rectangle and ellipse select tool cursors
Actually use the cursor returned by gimp_tool_widget_get_cursor(),
not ignoring stuff seems to make stuff work...
2017-07-04 22:27:31 +02:00
Michael Natterer 25f4ae317e app: don't try to commit the crop tool when it has no display
Fixes a bunch of warnings that were only by coincidence not crashers.
2017-07-04 22:21:52 +02:00
Michael Natterer e21be2f3d9 app: rename GimpToolInfo's "blurb" and "help" members
to "label" and "tooltip". More standard names, less confusion.
2017-07-04 21:58:11 +02:00
Michael Natterer 1f42d65e21 app: remove undo_desc, icon_name, help_id stuff from GimpFilterTool
and its subclasses. Simply use the new GimpTool APIs now.
2017-07-04 20:43:28 +02:00
Michael Natterer 8e68743efa app: add gimp_tool_set/get_undo_desc/icon_name/help_id()
which allow to override stuff from GimpToolInfo for dynamic tools like
GimpFilterTool and friends. When NULL, the getters are falling back to
GimpToolInfo strings.
2017-07-04 20:43:28 +02:00
Michael Natterer 89d611f291 app: GimpFilterTool: remove members "import_dialog_title"...
...and "export_dialog_title"

It's ridiculous to keep this code around for strings that are only
marginally different (and not better) than the strings we can generate
from other strings we have anyway.
2017-07-04 20:43:28 +02:00
Michael Natterer 54683840e3 app: rename GimpTool::get_undo_desc() and ::get_redo_desc()
to ::can_undo() and ::can_redo(). They still return description
strings and the new naming is slightly off :) but get_undo_desc() will
be needed for something else soon, and half of the time the functions
are indeed used to check whether there are undo/redo staps at all.
2017-07-04 20:43:28 +02:00
Ell bfb51b0782 app: don't compute slider values for 0-length lines while dragging
... to avoid getting NaNs.
2017-07-04 10:43:01 -04:00
Michael Natterer 76644b7367 app: add a "status_title" to GimpCreateControllerFunc
so the status bar now says "Spiral:" or "Supernova:" instead of just
"Line:".
2017-07-04 12:51:05 +02:00
Ell 04b407a019 app: s/slider_count/n_sliders/ in GimpToolLine and firends
Yep yep yep.
2017-07-03 18:10:30 -04:00
Ell c7bc765a10 app: use sliders to control "balance" and "base" for gegl:spiral
Switch the gegl:spiral prop gui from using a line controller to
a slider-line controller, and use sliders to control the "balance"
and "base" properties.
2017-07-03 15:10:49 -04:00
Ell 60586a8817 app: add sliders to GimpToolLine; add slider-line controller
Add supprt for placing sliders on a GimpToolLine -- handles that can
be dragged over the line.  The sliders are accesible through a new
"sliders" property, and via the gimp_tool_line_{get,set}_sliders()
functions.

Add a slider-line controller, which works like a line controller,
but whose callback also supplies/takes an array of sliders.

Note that the data type for individual sliders is called
GimpControllerSlider (in particular, it's not line specific), so
that we may use it with other controller/tool-widget types in the
future.
2017-07-03 15:10:47 -04:00
Michael Natterer 6de4fca580 app: add a custom GUI for gegl:supernova, with an on-canvas controller 2017-07-03 12:45:59 +02:00
Michael Natterer e8ee5475b7 app: move all propgui files from app/widgets/ to new folder app/propgui/
We are getting more and app/widgets/ is already too large.
2017-07-03 12:29:41 +02:00
Michael Natterer fd257971cc app: fix gimp_operation_tool_sync_op() to use the right output extents
Use the new gimp_filter_tool_get_drawable_area() instead of always
using gimp_item_mask_intersect() which is only right when the
operation is applied to the "selection" region. Also call
gimp_operation_tool_sync_op() when the region is changed in the UI.
2017-07-03 02:51:37 +02:00
Ell e701700a88 app: only use area dim., not off., for ui range of pixel-distance op props
Don't offset the ui range of op properties that use pixel-distance
units to the top-left corner of the region, since they're relative;
only do that for pixel-coordinate units.  Let their ui range be
[0, width/height].
2017-07-02 20:00:19 -04:00
Ell 54fd810173 app: make the "force" option insensitive for the pencil tool
It has no effect.
2017-07-02 19:26:30 -04:00
Ell 9de19a1f9a app: orient the spiral op line controller so that 0-degree rotation points right
This way, it runs to the middle of the spiral arm, and stays centered
even when balance != 0.
2017-07-02 19:14:38 -04:00
Michael Natterer 2da59e7ba3 app: add a "status-title" string property to GimpToolLine
which defaults to "Line: ". Set it to "Blend: " in the blend tool.
2017-07-03 01:02:23 +02:00
Michael Natterer f4f2de1b5c app: start an infrastructure for on-canvas controllers for operations
Pass a "GimpCreateControllerFunc" to all gimppropgui-*.[ch]
constructors which takes a callback (to update the config object when
the on-canvas GUI) and a controller type that determines the
callback's signature, and returns another callback (to update the
on-canvas GUI when the config object changes).

In GimpOperationTool, pass such a GimpCreateControllerFunc that
handles creating and adding on-canvas controller via the new
gimpfiltertool-widgets.[ch]. So far, a simple line like in the
blend tool is supported.

Add a custom GUI for gegl:spiral, and have its origin, radius and
angle controlled by such a line.
2017-07-03 00:45:59 +02:00
Michael Natterer a2c331011d app: add new function gimp_filter_tool_get_drawable_area()
which return's the used drawable's offsets and a GeglRectangle
where the filter is applied according to GimpFilterOptions::region
(either the selection or the whole drawable).
2017-07-03 00:45:59 +02:00
Michael Natterer 00a9659c28 app: add virtual function GimpFilterTool::config_notify()
and call it from GimpFilterTool's "notify" callback. Remove signal
connections from all subblasses and instead implement ::config_notify().

The config object belongs to GimpFilterTool, and only GimpFilterTool
should know when it's created and can be connected to.
2017-07-03 00:45:59 +02:00
Michael Natterer 9e55fb8ecf app: call gimp_filter_tool_get_operation() in initialize() not constructed()
so things from the tool's previous use get destroyed, including their
(maybe dangling) signal connections. Also shut down more stuff in
halt(), including destroying not just hiding the GUI.
2017-07-03 00:45:59 +02:00
Piotr Drąg ddee27f6d4 Fix typos in translatable strings 2017-07-02 17:47:08 +02:00
Michael Natterer 6f2948fe54 app: don't let GimpColorTool change displays when GimpDrawTool has a widget
because widgets are bound to one GimpDisplayShell. Also, chain up
unconditionally in gimp_color_tool_draw(), we always want to draw the
widget even while picking colors.
2017-07-01 16:26:34 +02:00
Michael Natterer 3d08a52e1f app: add an optional GimpToolWidget to GimpFilterTool
The widget is fed events by GimpFilterTool, the actual interaction
with the filters operation and config will be done by subclasses.

The order of precedence when there are multiple possible canvas
interactions is: moving the split preview guide, color picking,
widget.
2017-07-01 16:24:01 +02:00
Ell be193acfe0 app: fix parent_class type of GimpOperationScalarMultiplyClass 2017-06-30 16:24:49 -04:00
Michael Natterer bcb6b77bde app: change GimpColorTool to not touch tool->display and tool->drawable
Instead, pass a GimpDisplay around in all virtual functions and use
that instead. Some preparation for more fancy subclasses using
GimpToolWidgets.
2017-06-30 21:23:29 +02:00
Michael Natterer b85842893d app: brightness-contrast: move gimp_tool_control_activate,halt() around a bit 2017-06-30 21:20:32 +02:00
Michael Natterer 33c84f38bc app: GimpPaintTool: don't chain up to start/halt the tool
because the parent class is about to be refactored a bit, and the
actual code executed by chaining up is just 4 lines.
2017-06-30 16:39:28 +02:00
Michael Natterer 5377213a82 app: HALT the crop tool when clicking on another display
instead of calling COMMIT. Not all tools are the same, this might be
right for other tools, but for crop it just feels broken.
2017-06-29 22:17:29 +02:00
Michael Natterer 79207bd3bf app: restore the crop tool's "Click or press Enter to crop" status message
it probably got lost when improving GimpToolRectangle's messages.
Also add a default idle status message "Click-Drag to draw a crop
rectangle".
2017-06-29 22:15:17 +02:00
Michael Natterer e8c6382302 app: re-enable GimpRectangleTool's "suppress_updates" keyboard moving hack
so a handle can be moved with the cursor keys even if it moves away
from under the mouse pointer.
2017-06-29 22:02:48 +02:00
Michael Natterer 56d87724a3 app: don't base GimpToolRectangle's new "is_first" on rectangle extents
they also get set externally so are broken to use. Instead, simply set
"is_first" to TRUE in init() and to FALSE in button_release().
2017-06-29 20:48:41 +02:00
Michael Natterer 26b9e7a357 app: set better status title strings in crop, text, rectangle select 2017-06-29 20:38:04 +02:00
Michael Natterer 2aff5b0a5a app: add new string property "status-title" to GimpToolRectangle
and use it for the statusbar message instead of just always "Rectangle: ".
2017-06-29 20:37:17 +02:00
Michael Natterer c9abe09440 app: improve GimpToolRectangle's statusbar messages 2017-06-29 20:21:02 +02:00
Michael Natterer 9dc6d4f515 app: improve button release behavior or GimpToolRectangle a lot
- introduce new state "boolean is_first" which tracks if the currently
  drawn rectangle is the first with this instance
- cancel the widget if there was no movement when creating the first
  rectangle
- undo to the previous rectangle if the user created a zero-extent
  rectangle
- also undo to the previous rectangle if a newly drawn rectangle is
  canceled with button-3 release
2017-06-29 20:01:08 +02:00
Michael Natterer 5c8c30112a app: treat a NO_MOTION release like NORMAL one in GimpToolRectangle
which stops unexpected behavior that was there even before the new
code (like a rectangle without a selection).
2017-06-29 16:48:02 +02:00
Michael Natterer ff915b68c9 app: fix warnings and crashes in rectangle select and crop
We can't rely on g_object_unref() in halt() for breaking all property
GBindings between the tool options and GimpToolRectangle, because we
might be in the middle of a signal emission which also refs and keeps
the rectangle alive until the last callback returns. So we had
dangling rectangles interacting with tool options.

Remember all bindings in a list, and break them explicitly when we
shut down the rectangle in halt().

Also, forgot to unset the display's highlight in the rectangle
selection tool.
2017-06-29 15:06:27 +02:00
Michael Natterer e7964e499c app: we were leaking a reference in gimp_tool_rectangle_button_release()
because of bailing out early after emitting "response". Instead, don't
ref the object around this function, and move the "response" emission
to the end of the function.
2017-06-29 15:04:13 +02:00
Michael Natterer 5e08d71437 app: gimp_tools_exit(): destroy the tool manager before the tool options
The tool manager still keeps an active tool which it unrefs on
destruction, triggering a final HALT on the tool, which may want to
lookup tool options to reset something. Happened with the new
widget-ported rectangle select tool.
2017-06-29 12:58:03 +02:00
Michael Natterer 8bf20a6c21 app: use integer not unsigned integer for GimpGeglConfig::num-processors 2017-06-28 21:15:45 +02:00