Close parent popover when activating the color picker to release the
input grab, so the canvas can receive events and the dropper can work.
Add close_parent_popover() utility function to avoid code duplication.
Guard against empty optional in dropper-tool.cpp as a final defence.
Fixes inkscape/inkscape#6029
The text cursor shouldn't indicate that it can have input when the
canvas widget isn't in focus. We fix this by making it's visibility
depend on the in_focus state controlled by existing signals.
Reset the display mode (e.g. outline mode) for every new tab opened.
Don't persist it between sessions, or even during a session.
There's definitely an issue this fixes, but I can't seem to find it.
* Handle URI-based file paths during d&d if local paths are missing
* Place imported files at drop position passing location explicitly
* Fix memory leaks by freeing path and uri strings after use
* Update to use gdk_file_list_get_files() for GTK4 file list handling
This commit adds support for splitting all types of file paths on
Linux and Windows. If applicable, paths are also normalized during
splitting. The implementation keeps string copying to a minimum for
improved performance. Tests are included for all the supported path
types.
The old file splitting functionality was limited, and made code
that depended on it fragile. The root cause of the problem was
that paths on Windows and Linux are incompatible. The old function
was simple and left most of this complexity to the caller. The new
implementation is more robust and supports both platforms properly.
* Remove lpe update code from _selChanged. Changing the selection should
not trigger an LPE update.
* Originally, the removed code was added as part of undo fixes for LPE
code. But it ended up patching the problem instead of fixing it in a
semantically correct manner. The undo / redo issues are mostly related
to improper transactions to the document from the path effect class.
To address these issues, we should fix each live path effect
individually instead of patching commonly used workflows as it could
introduce performance regressions and unexpected updates to the
document.
Partially fixes: inkscape/inkscape#1351
This looks like a copy&paste oversight. As a result, copying
to the clipboard sometimes randomly ran the odf export code for
the povray mime type, resulting in weird behaviour.
This allows the paint server code to be unit tested in later versions. There are some limitations
to this refactoring including use of virtual functions instead of casting so we can use templates
in renderers.
ll SPObjects must implement their virtual functions, so the base classes all return empty objects
where possible and this pushed the design in a certain direction for some calls.
* Move sp-gradient spread, units and vector to sp-paint-server-data.h
* Move mesh gradient patches data from display/drawing-paintserver to sp-paint-server-data
* Allow SPPaintServer to be used as a template class in a renderer by providing data from sp-paint-server-data in a consistant way from the base class using virtual functions.
* Add getPaintType and enum class to decide what type of paint server we have instead of cast
* Add SPGradient virtual for gathering geometric gradient data for Lienar and Radial gradients
* Add SPMeshGradient virtual for gathering mesh patches data for the Mesh gradient
* Pack gradient geometric data into SPGradientVector and return in getGradientVector
* Harmonize const and API between Mesh Gradients and Linear/Radial Gradients
* Move add create_drawing_paintserver calls to display/drawing-paintserver in a single call
* Remove `mg` MeshGradient pointer from MeshArray and remove back-linking. This indicates bad
API design for some of these calls as the functions used mg and had little to do with the MeshArray
but for now we just push the MeshGradient object back in as an argument.
* Change drawing-paintserver constructors to take paint-server-data objects instead of individual arguments.
Remove remaining uses of SCALE24_TO_FLOAT and FROM_FLOAT macros which were only
used for SPIFloat and can easily be folded into the object itself.
Harmonize the default data type use with SPIEnum, SPILength and SPIFontSize
this allows the rendering engine nr-style.cpp to use the right rendering value
which is always the computed value and not need to think about the internal
implementation of the style variable between `value`, `computed` and will allow
these variable to be made private in the future.
Mikekov: Add `as_double` and `as_enum` getter functions for the new explicit interface.
* In the multi-color autotrace mode, max scans is used to set the
`color_count` value. It determines the number of colors a color bitmap
is reduced to. The allowed values are 1 to 256.
* The crash occurred because of incrementing scans value by 1 in
multi-color autotrace mode while invoking setColorCount. Since, the
maximum value allowed for the scan adjustment is 256, this'd result in
color count being set to 257. Hence, resulting in a crash because of
out of range value.
Fixes: inkscape/inkscape#5475
Use boost intrusive multiset instead of std::list, now insert takes O(log n)
instead of O(n) with n number of items on canvas. Erase remains O(1).
No more memory allocation or failure paths on cache insertion
at the expense of slightly larger DrawingItem struct.
In 'transform_rotate', 'transform_rotate_step', and 'transform_rotate_screen' multiply the rotation angle by 'yaxisdir()' to ensures the visual rotation the action (CW vs CCW).
calculate the visual angle' relative to 'yaxisdir()' for generating the Undo History message.
Fixes: inkscape/inkscape#5992
* Implement supersampling for CLI tests, allowing lower fuzz thresholds.
* Merge l2compare.sh into check_output.sh to reduce duplication.
* Always use L2 metric for fuzzy raster comparisons, not absolute error.
* Fix 09-text-layout.svg to add 'arabic' css class to some text that was
missing it, use 'Noto Sans Hebrew' for hebrew text, and re-show some
cut-off text. Update bundled Noto Sans fonts that it depends on.
* Fix test-store writing to source directory.
* Update reference images and adjust fuzz. Only significant reference
image change is the peppercarrot one, where some previously missing
text ("日本語") actually appears now.
Commits:
Preliminary non-vertical axis implementation
Add option to set vertical angle for axonometric grids
Fixed the math for calculating the y axis angle in the axonometric grid
Initial grid snapping with !angle_y_vertical implemented
Update comments to clarify axis behavior in axonometric grids
Change angle_y_vertical to use RegisteredCheckButton and update preferences initialization
Add button to swap axonometric grid axes in document properties dialog
Documented & moved derived_angle_y to mathfns.h and added update_derived_angle_y method for shared behavior
Renamed gridangleyvertical to angleyvertical
Comment: "[the prefix 'grid'] should never have been used for any of the attributes, but we should start by not adding new ones" - @doctormo
I forgot the pi/2 - angle when porting to derived_angle_y rad
When those states change, actually notice and save the preference
for them. This way the "remember last window state" preference will
work as expected for maximized/fullscreened windows.
Added isDirect to Colors::Space::* which tells us if a color space is
backed by a single icc profile, and no other processing steps with some
public method cleanups.
Removed Lab toXYZ and fromXYZ which were orphaned by previous commit.
Reformatted CairoTransform into generic SurfaceTransform so it can work
with any memory surface of pixels and in a greater number of data formats.
Split out CMS transform class from SurfaceTransforms and use a base class
Allowing for different assumptions with formatting and alpha premultiplication.
Add a forward.h header to make including color namespaces easier and cleaner.
Clean up generic testing utils for VectorIs Add colors and some better flexibility
for arrays and vectors in testing.
This color space allows surfaces to be converted to luminosity masks
and varius other useful alpha related filtering for the new rendering
engine.
We use lcms2 to hold the gray scale profile for quicker conversions.
The transform-cms is modified so it can cope with outputs which do
not have an allpha channel of their own. Tests for this are added.
Most color conversion will be done with std::vectors of doubles
but to speed up and provide compile time checks for color converting
on Surfaces we want the ability to take an array directly at some
but not all of the various levels.
Formalise the interface for ProfileSpace and the Convertable type
using a self-referential templating pattern.
Move most conversion code to static functions and make as agnostic
to the array type as possible, allowing for convertors to use them
directly without expensive vector types.
The selection describer code was assuming that a selection can only
hold visible items (SPItems) but it actually holds SPObjects, which
can include non-visible items.
This code changes the selection describer to more consistently work
with SPItems only, and to ignore SPObjects.
Fixes inkscape/inkscape#6125
If no optimizations are on, you get tons of warnings like:
/usr/include/features.h:435:4: warning: #warning _FORTIFY_SOURCE
requires compiling with optimization (-O) [-Wcpp]
| # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
| ^~~~~~~
Which clutter the console and obscure actual warnings like unused
variables or unused results.
Poppler version 26.05.0 changed the return type of
gfx8bit->getEncoding() from char** to const std::array<const char*,256>&.
this caused a compilation error due to type incompatibility:
error: assigning to 'char **' from incompatible type 'const std::array<const char *, 256>
error: no viable conversion from 'const std::array<const char *, 256>' to 'char **'
4.20 deprecated one global dark mode setting and introduced another.
But it not only deprecated but broke the old one.
4.22 seems to fix this, but let's just assign the correct setting
depending on the gtk version.
Fixes inkscape/inkscape#4891
During export, a new LPETiling() instance was being created, with a
default "prev_unit" value of "px".
This prev_unit value was then compared to the current unit value, and
the gap size was converted to the new unit. But on instantiation, the
unit and gap size were already correct. So this applied a pointless
extra conversion from px to the current unit.
Fixes inkscape/inkscape#6157
When creating a powerclip, transformations from the clip source were
not being applied. And when you duplicate an object, the coords of that
object will be the same, but just with a transformation applied.
So if you duplicated an object, then used it as a clip source, the
inverse clip LPE code was ignoring the transformation and the clip
would miss the intended target entirely.
This applies the clip's i2dt_affine() when calculating the inverse
clip.
Fixes inkscape/inkscape#6158
When opening a raster image (like png), we were loading the output
extension for that image and trying to call its save() method, which
did nothing because raster output extensions don't define that method.
Such extensions are designed for the export-as flow and provide the
export_raster method instead.
Determining which extension to use for saving a file was also happening
too low in the stack, after the save filename had already been chosen
and where it was awkward to switch to a save-as approach.
So I've added some logic to determine which extension to use ahead of
time (and ignoring raster output extensions for this) and also switch
the save filename to use the target extension.
Now Inkscape::Extension::save requires an extension argument and does
not support autodetection (that autodetection is handled a layer up).
And some related cleanups:
- If an Output extension ever *does* have its save() method called,
we now display a user error instead of simply actingn like it worked.
This is done by throwing an exception in the default handler.
- The extension error messages were using GLib::ustring::compose
instead of GLib::ustring::sprintf, so the filenames weren't being
injected. This is now fixed.
- Previously if save() failed (even on a user cancel), you'd still get
shown the save-as dialog. Which doesn't really make sense. You only
want to see that if we don't know how to save the current extension.
Fixes #2667
The filter editor added a new search box for adding stock filters
in commit 602d7346.
And then later some if its properties were dropped in commit
af136a50.
But neither commit actually connected this search box to anything.
It didn't exist in 1.4. Let's just remove it for now. We can always
add it back later once it's working.
Fixes #6181
We were trying to detach and re-attach the mask when moved, but trying
to reattach it to a URI that was only saved in one code path.
Rather than rely on a possibly stale URI, just grab the URI right
before detaching, and re-attach to that spot. Then we can drop the
saved URI altogether.
Some tests had to be updated as part of this, because previously, the
mask bounding boxes paths were never being updated as part of the test
since the mask was getting internally deleted. And since there's been
drift over the years on these tests, the bounding boxes were one or two
pixels offset, which failed the tests. So I updated the tests to what
Inkscape writes out these days for these mask boxes.
Fixes #6154
There was some internal confusion about whether they were stored as
a Uint or a Color and additionally, the preferences dialog wasn't
signalling that icons should update when the pref changed.
- Use one preference, not two for custom icon colors.
- Rename the checkbox to be clearer ("Change icon colors")
- Hide controls if that checkbox is disabled
- Reorganize the controls to be better aligned with each other
LPEs were not being pasted correctly (using the '&' shortcut) because
the effect definition was not being imported correctly and the pasting
code couldn't find it when it went to apply it.
This is fixed by:
- When prevent_id_clashes() is called, examining the clipboard for
references, to prevent it holding stale references to nodes that have
been renamed. This involved internally keeping track of the XML repr
node, because the clipboard does not have a corresponding SPObject.
- Removing the 'from_clipboard' parameter to prevent_id_clashes(),
whose only purpose was to prevent similar LPE nodes from being
renamed if from_clipboard were false. But... from_clipboard was only
being passed in as false *during* paste operations from the
clipboard. And during those paste operations, we still want to copy
similar LPEs (rather than reference the existing LPE twice).
So just drop this confusing parameter.
- After importing defs, gather the new def names from the adjusted
clipboard.
- Look for imported defs in the target document, not the source
document. This technically doesn't matter, since there are no clashes
anymore, the def will be in both documents. But it just felt like it
made sense to be looking in the same document that you are going to
reference it from.
Fixes #5694
Undo/redo is broken after this - the satellites are restored but
without the connection to the original LPE. So things don't work
right.
But... undo/redo was broken the exact same way before this change
when flattening. So this is not a new issue.
So there's a separate bug here with restore satellite connections
during a redo. But this commit is just solving the deletion issue.
Fixes #6170
There was rendering garbage you could see on the sides of the image,
because we were asking Cairo to render using the PAD extend mode.
But we really want NONE for this case. We use PAD because we don't want
gaps when filling an image with patterns.
So this commit makes the extend type conditional, and sets it to PAD
for images generated by SPPattern.
Fixes #6160
The code originally drafted was non-functional, and made some
assumptions about how drag and drop works for Gtk4 which were
not true. We replace the whole thing with a new implementation.
We use Gtk standard cursors for this generic widget and call them
by name. There are now three cursors in use:
"": inherited, a pointer, used on buttons
"col-resize": For draging left and right
"text": Used for label to indicate text input
Fixes: #6156
* Simplifies packaging on distros that don't provide capypdf, since we
no longer have to worry about where to install this vendored library.
Consequently, capypdf can now be enabled in PPA builds.
* Removes a Windows-specific workaround from the test suite (098a53bd).
This requires bumping capypdf to 0.21.0.