Commit Graph

3245 Commits

Author SHA1 Message Date
Luca Bacci abe7c53cf5 Use GetStartupInfoW () 2023-01-24 14:48:44 +00:00
programmer_ceds 62e2716b21 Expand from Centre Issue (Fixes issue #7954) 2023-01-11 21:29:19 +00:00
valadaptive ea28ac0bbd app: Fix "Handle Transform" handle snap location
(cherry picked from commit d6d2e56c00)
2023-01-03 15:59:55 +01:00
Jehan 143496af22 app, menus, pdb: new "Paste as Single Layer( in Place)?" actions.
When the clipboard contains raw image data or single layers, it's the same as
the normal "Paste" (and "Paste In Place" respectively). These actions are useful
if you want to copy a bunch of layers and paste them "merged" into a single
layers (since now the copy-paste of multiple layers will create multiple
layers).
It is somehow similar to the "Copy Visible" action except that it works on
selected layers only and work at paste time, making the action more versatile.
2022-11-12 22:34:51 +01:00
Jehan 92cc33d52a app: fix a use of gimp_edit_paste().
When dropping a buffer, we just consider it like common data pasting, hence we
leave the GIMP_PASTE_TYPE_NEW_LAYER_OR_FLOATING algorithm decide what type of
paste it will be.
2022-11-12 19:07:47 +01:00
Jacob Boerema 9ba5b8dbd6 app: fix issues in gimpmodifiersmanager.c found by coverity
- buttons_key doesn't get freed.
- modifiers could theoretically be used uninitialized.
2022-11-08 16:57:04 -05:00
Niels De Graef 27fe67814e app: initial work on moving to GtkApplication.
Reviewer's message (Jehan): This was a work-in-progress by Niels, which
we only keep in this state because Lukas worked over it. I have rebased
and fix-amended many broken part of this commit, because various things
had been changed in these areas of code since this commit was initially
written.
2022-10-09 16:12:07 +02:00
Jehan ca230cb770 meson: fix warnings of deprecated features.
Now that we bumped our meson requirement, meson is complaining about
several features now deprecated even in the minimum required meson
version:

s/meson.source_root/meson.project_source_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.

s/meson.build_root/meson.project_build_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.

Fixing using path() on xdg_email and python ExternalProgram variables:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead

s/get_pkgconfig_variable *(\([^)]*\))/get_variable(pkgconfig: \1)/ to
fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead
2022-08-31 01:29:37 +02:00
Jehan 203652651d app: properly release shell scrolling on button release.
If we released first the modifiers, then the pointer button during
scrolling, we could end up blocked on scrolling. This makes sure the
button release is the finale scroll unlock, allowing modifiers to be
only used for starting the scroll.

It also fixes activating custom actions, by storing the action
description from the initial modifiers at press time, not release time.
2022-08-21 17:38:04 +02:00
Jehan 7f1dd80ab2 app: fixing the soft-proof profile chooser.
The GimpColorProfileComboBox widget requires the profile chooser dialog
to be explicitly constructed. It doesn't create it by itself.

I guess I hadn't tested clicking this "Select color profile from disk…"
combo item during review. I only selected visible profiles in the list!
2022-08-18 16:42:39 +02:00
Alx Sa 7b7ce8c5f0 display: Show Soft-Proofing menu in status bar
This adds a Soft-Proofing pop-over menu when right-clicking the toggle
in GimpStatusBar. It lets users toggle proofing, using BPC and showing
out-of-gamut colors. It also lets users change the profile and
rendering intent.
2022-08-17 11:37:10 -04:00
Jehan d72a42ed20 app: add a modifier action for opacity change.
Opacity and brush size are among the 2 most common tool options which
people might want to often change, though we should likely later add all
other common types of tool settings angle, aspect ratio, spacing, etc.

I am also unsure using the enum action is the right call because what it
does is just taking into account the distance from initial click to
compute an opacity. Instead it might be more interesting to increase or
decrease slowly or rapidly by going right or left from the initial
click. We'll see. But it's a first step.
2022-08-17 16:46:26 +02:00
Jehan 76ddf4421c app, po: remove GimpControllerMouse code.
The mouse controller had many limitations:

* It was not per-device.
* It was a long hard-coded list of events, which made its evolution
  annoying and scrolling the list boring.
* It was starting at button 8, while the first buttons were supposed to
  be hardcoded interactions. And it stopped at button 12, while some
  device might have more buttons nowadays. See !386.
* The "Grab event" does not seem to work in many cases, according to
  feedbacks.

The new GimpModifiersEditor will now handle any button (except the first
button, which is reserved for tools), you can even override or change
default canvas actions (panning, rotation, etc.). It should not be
limited with a max button number either (though I haven't tested with a
device really having a lot of buttons since I don't have any such device
but I did emulate huge button numbers on my stylus with xsetwacom and it
did work well; hopefully I'll get feedbacks). And now it can even run
custom actions.
So basically it should deprecate the mouse controller as the modifiers
editor can do everything the controller could, and more (unless I missed
anything).
2022-08-17 14:20:18 +02:00
Jehan dd012d11d2 app: now support custom actions as input device button + modifiers.
Custom actions are basically any action (currently GtkAction) which can
be assigned a shortcut. Now they can also be assigned to an input device
button (with modifier or not).
2022-08-17 14:20:18 +02:00
Jehan 14e8703ff7 app: remove GIMP_MODIFIER_ACTION_BRUSH_SIZE, change defaults and labels.
* The relative brush size change was not implemented anyway. Maybe later.
* Also changing the defaults to GIMP_MODIFIER_ACTION_BRUSH_PIXEL_SIZE
  which I think might be the most understandable size variant.
* Finally re-label "Rotate" to "Rotate View" as per Aryeom's feedback
  because just "Rotate" is indeed confusing as it could mean several
  different actions in GIMP.
2022-08-17 14:20:18 +02:00
Jehan 23dd00b07f app: fix switching seamlessly from constrained to unconstrained canvas…
… rotation and back.
2022-08-17 14:20:18 +02:00
Jehan 156adee410 app: new modifier action to set brush size diameter.
Actually I am renaming GIMP_MODIFIER_ACTION_BRUSH_PIXEL_SIZE into
GIMP_MODIFIER_ACTION_BRUSH_RADIUS_PIXEL_SIZE, which allows to set the
brush size on-canvas, starting from center to border.

The new GIMP_MODIFIER_ACTION_BRUSH_PIXEL_SIZE now sets the brush size
from one border to another.
2022-08-17 14:20:18 +02:00
Jehan 1ab4661bf2 app: fix space actions on canvas.
Space: panning
Ctrl-space: zooming
Shift-space: rotating
Ctrl-shift-space: constrained rotating

Note that these are still hardcoded, unlike the actions through
modifiers + pointer buttons.
2022-08-17 14:20:18 +02:00
Jehan 89f55336a2 app: add a page in Preferences to set the canvas modifiers up.
Finally everything is getting assembled with this commit. It is now
possible to customize the modifiers which will be used on canvas.
2022-08-17 14:20:18 +02:00
Jehan 9d3ef444ea app: use modifiers set in GimpModifiersManager rather than hardcoded.
For now GimpModifiersManager returns the same modifiers as what was
previously hardcoded and we have no GUI yet to change the settings. But
the core of the new feature is in place.
2022-08-17 14:20:18 +02:00
Jehan 91b30145cb app: add a GimpModifiersManager object to GimpDisplayConfig.
This object's goal will be to manage customized modifiers per input
device button, which is why I add it to GimpDisplayConfig. It is in its
own new config file (`modifiersrc` in config dir) because it requires
GDK types access (well I could have done without, but it would have been
less semantic, hence not as good of an API). Anyway it is only useful
when running GIMP as GUI.

The GUI widget and the usage code to make this actually useful will come
in upcoming commits.
2022-08-17 14:20:18 +02:00
Jehan c7979e7f06 app: new double action "tools-mypaint-brush-pixel-size-set", used as…
… new action_pixel_size of GimpMyBrushTool.

MyPaint brush tool clearly shows the limits of my trick to have some
enum actions work with absolute values whereas others work with
per-mille values between the property min and max.

Indeed firstly MyBrush's "radius" value is logarithmic and can be
negative. Since the enum trick relies on the fact that negative values
are the semantic enumerated constants, it's broken in such case. The
second issue is that while it was acceptable to use int size for most
paint tools (even though they were double), here radius only goes from
-2.0 to 6.0; so using int values only would leave us with jumping brush
sizes.

So now I create a proper double action which simply takes pixel size and
use this from the on-canvas brush size changing. No weird trick, no int
or sign limitations.
I also add a new optional action_pixel_size in GimpToolControl.

Note: I'm also updating a bit the logic for the MyPaint brush outline
function gimp_mybrush_tool_get_outline(). Indeed after skimming a bit
through mypaint-brush.c code in libmypaint, I am not sure at all we need
to use the offset_by_random like this. And really this shown outline
seems more indicative than anything else when I see the actual size
printed by the various brushes. Finally here it was counter-productive
as I needed to get easily the logarithmic radius from the pointer
interaction on canvas.
2022-08-17 14:20:18 +02:00
Jehan 5be997fbdf app: display the brush outline (or fallback or circle) when resizing.
Bypass temporarily the "Show brush outline" settings when resizing
on-canvas.
2022-08-17 14:20:18 +02:00
Jehan b1124770e8 app: stop alt-right click brush size change when releasing Alt first.
Until now, it was only stopiing when releasing right click, but it's
actually more accurate when releasing the Alt key first as the button is
on the mouse/stylus (so releasing it can provoke small hand moves,
especially visible with stylus, I think). Now it stops whatever is
released first.
2022-08-17 14:20:18 +02:00
Jehan 43f0147bfe app: allow to change the brush size on alt-right click.
I started from mitch's patch (though code changed so it was not working,
yet I ended up with quite a different direction).

Modified from original proposition in #498:

* Do not mix opacity and brush size in a same action, one on horizontal
  movement, the other on vertical. The problem is that it's hard to stay
  perfectly horizontal or vertical, so you nearly necessarily change one
  while changing the other and this would be frustrating.
* Do not just use modifiers, but modifiers + right click. The logics is
  that left (or whatever is the first button) click is for the tool
  actions. The middle click for navigation (panning, rotation, and even
  layer navigation now). Right click for now is only for menu. With this
  change, let's use right click for various settings-related changes
  too. Also we already have people complaining with things like canvas
  rotation happening unexpectedly even though it requires button clicks.
  Imagine an action just made of modifiers! Many people would hit these
  by mistake all the time!
* Focus on brush size only for now. Instead of just calling the action
  repetitively with the "SElECT_NEXT" action as proposed in the original
  patch by mitch, let's compute the actual size between the press and
  release. This would allow to have a real visual hint and also would
  make it a lot more useful and meaningful to be an on-canvas change.
  Say you want to reproduce a stroke size on canvas. You can click the
  center and expand to retrieve approximately the size without computing
  it in pixels.

Limitations and future work:

* This is a first draft and I still want to test if it works well with
  the "lock brush to view" and with scale factor > 1.
* I want to associate this with work done for #7034 so that visual hint
  still appear even when we have no visual hint set.
* I am not so fond of with the way we use enum actions which doesn't
  really make satisfying logics (I hacked a bit over it, but it's
  getting ugly). I'm considering creating int/double actions to really
  set some values with exact numbers through actions.
* Right now we need to stop the right click first. I want to be able to
  stop the brush sizing with releasing Alt too.
* It would be nice to make this all more customizable, which is why I
  called internal variable "mod1_setting". The goal will be to have
  other types of actions possibly. Also it could be deactivatable for
  people really not liking these or hitting these by mistake (while not
  needing these). Same for the navigation shorcuts.
* Similarly the right-click menu could be deactivatable or switched to
  other actions conditionally (through Preferences). It is doubtful how
  useful it is (compared to using the same menus on top of the GUI)
  though I don't want to just delete the option because some people
  would clearly be used to it.
* I think we should start breaking down the whole tool events code a bit
  more, in particular the function gimp_display_shell_canvas_tool_events().
* For more settings, a small on-canvas GUI could be of interest where
  you could customize various values through sliders and buttons, and
  also where you could put your favorite brushes or dynamics or whatnot.
  It's not replacing the more complete dockable but could be a nice
  quick version for fast editing.
2022-08-17 14:20:18 +02:00
Alx Sa 0587a10543 core: Add simulation intent and BPC to GimpImage
Adds a simulation_bpc and simulation_intent to GimpImage to allow 
plug-ins to access it
for CMYK import/export.
Four pdb functions were added to enable this access:
image_get_simulation_bpc (), image_set_simulation_bpc (), 
image_get_simulation_intent (), and image_set_simulation_intent ().
Next, it updates menu options and code to support GimpImage's
internal simulation intent and bpc.
New 'simulation-intent-changed' and 'simulation-bpc-changed signal 
are emitted via
GimpColorManagedInterface so that relevant tools 
(such as the
CYMK color picker, GimpColorFrame, and future pop-overs)
 are aware of these changes.
2022-08-13 19:39:47 +00:00
Alx Sa b99b7d779e display: Add soft-proof toggle to status bar
Adds a soft-proof toggle button to GimpStatusBar. It's only active when
a simulation profile is set on the current image. It stays in sync with
the View menu soft-proofing option as well.
2022-08-01 23:22:05 +00:00
Jehan ccbf3c4bb0 app, libgimp*: add various stamp files to CLEANFILES.
Fixes:

> ERROR: files left in build directory after distclean:
2022-08-01 23:34:50 +02:00
Jehan 83e465ec16 app, libgimp*: updating autotools script in sync with meson.
Generated *enums.c now have an additional stamp no-op header include
(see last 2 commits). Sync this change into the autotools generation
scripts to prevent back and forth useless generation of these files each
time we switch from one build system to another.
2022-08-01 20:00:01 +02:00
Jehan 979acaaae2 app, libgimp*: commit the newly generated *enums.c files.
They are nearly the same as initially, except that now they include an
intermediate stamp header which will be generated by the build system.

The only 2 enums which don't need these includes (and are not versioned)
are libgimp/gimpenums.c and libgimpthumb/gimpthumb-enums.c.
2022-08-01 20:00:01 +02:00
Jehan 106f2a061d Issue #8145: meson: generation of '*-enums.c' files.
Our meson build system was not properly building the enums.c file,
because they are versionned.

I did a similar trick as what I did for the pdbgen, which is that I used
a wrapper script around the existing perl script, which sets proper
options and generate a stamp file in the end (which is considered by
meson as the actual custom target, not the C file since it is generated
in the source dir).

The most important part is that the stamp file is a generated header
source (not just a random text file) which is **included** by the
generated C file. This is what will force meson to regenerate the C file
if the header is updated, **then** build using this new version, not use
an outdated versionned version (which would make for hard to diagnose
bugs), through the indirection of the intermediate stamp header.

See #4201.
See also: https://github.com/mesonbuild/meson/issues/10196#issuecomment-1080742592
2022-08-01 19:59:53 +02:00
Lukas Oberhuber 831623f33f meson, macos: missing libraries and directories
These changes make it possible to build against homebrew for mac
libraries. Homebrew stores it's libraries in seperate folders and so
blanket includes were not working.

PYTHONPATH is not needed and interferes with homebrew build.
2022-07-21 13:25:22 +00:00
Nikc 93399de7cd Converting CMYK sample points to babl process 2022-07-20 22:35:13 +00:00
Lukas Oberhuber 042eddfb0a canvas: remove limits on ruler & statusbar updates
This removes rate limiting of ruler and statusbar updates which were
required to get acceptable performance on mac for drawing on the canvas.

This requires the latest changes on in Gtk 3.24 to be incorporated.
2022-07-05 13:02:30 +00:00
Alx Sa 0d7fed93ae core: Add softproof profile to GimpImage
Adds a simulation_profile to GimpImage to allow plug-ins to access it
for CMYK import/export.
Two pdb functions were added to enable this access:
image_get_simulation_profile () and image_set_simulation_profile()
Next, it updates menu options and code to support GimpImage's
internal simulation profile. Menu items are moved from View to Image's
Color Management section.
New 'simulation-profile-changed' signal is emitted via
GimpColorManagedInterface so that relevant tools (such as the
CYMK color picker, GimpColorFrame, and future dockable
dialogue) are aware of these changes.
2022-07-02 15:26:19 +02:00
Jacob Boerema b130349935 app: fix incorrect order of parameters horizontally and vertically
There was one case where horizontally and vertically were mixed up in a
call to gimp_display_shell_scale_image_stops_to_fit.

The more usual order of parameters is first horizontal and then vertical.
So, let's fix the actual functions that have the illogical order
of vertically, horizontally instead of fixing the one call.

This brings it in line with the order in other functions and makes it less
likely we mistakenly mess up the parameters.

Besides that gimp_display_shell_scale_image_stops_to_fit also was not
declared as a local function, so we add that too.
2022-06-02 13:26:05 -04:00
Ben Rogalski d90b84ba9d Custom transparency checkerboard colors
Reviewer (Jehan) note: cherry picked from MR !274. Still deciding
whether this will be pushed to gimp-2-10 branch too.

Fixed Conflicts from !274:
	app/dialogs/preferences-dialog.c
	app/display/gimpdisplayshell-draw.c
	app/plug-in/gimppluginmanager-call.c
	libgimp/gimp.c
	libgimp/gimp.h
	libgimpwidgets/gimppreviewarea.c
	libgimpwidgets/gimppreviewarea.h
	libgimpwidgets/gimpscrolledpreview.c
2022-05-14 16:27:15 +02:00
Niels De Graef 2b8ed6cfae app/display: Remove keyboard grab
Remove `gimp_display_shell_keyboard_grab()` and ...ungrab(), as there
doesn't seem to be any good reason to grab the keyboard away from the
compositor. More annoyingly, in some systems it will pop up a dialog
on each first click whether the user is okay with inhibiting shortcuts.
2022-05-05 14:35:51 +00:00
Povilas Kanapickas edcbf18fe6 app: Implement exclusiveness of zoom and rotate gestures
Performing zoom and rotation at the same time is inconvenient because
most of the time the user will want either zoom or rotation. This can be
solved by recognizing a "significant enough" zoom or rotation change
initiated by the gesture recognizer and then ignoring the other gesture.
2022-04-06 18:50:25 +00:00
Povilas Kanapickas e8cf57f157 app: Implement canvas support for touchpad gesture rotation by pinch 2022-04-06 18:50:25 +00:00
woob eb58b277d2 app: Add drag-to-zoom speed preference
Adds the new configuration option "drag-zoom-speed" to adjust the rate
at which mouse movement can zoom the canvas, ranging from 25% to 300%
of the base rate and applying to both drag-to-zoom modes.
This option can be found in the preferences dialog as:
  Image Windows -> Zoom & Resize Behavior -> Drag-to-zoom speed
2022-04-05 12:31:11 +00:00
woob 4cffd91af4 app: Halve the rate of distance-based drag-to-zoom scaling
Reduces the rate from +/- 1% of the current scale per pixel, to 0.5% to
allow for more fine control while zooming.
2022-04-05 12:31:11 +00:00
woob 505a78e715 app: Add option to re-enable previous drag-to-zoom behavior
Adds a new configuration option "drag-zoom-mode" to choose whether to
zoom by distance of movement (newly added) or by duration of movement
(previous behavior) when zooming via dragging the mouse, defaulting to
distance.
This option can be found in the preferences dialog as:
  Image Windows -> Zoom & Resize Behavior -> Drag-to-zoom behavior
2022-04-05 12:31:11 +00:00
woob 8b1025919f app: Smoother zooming while dragging with the mouse
Changes the behavior of gimp_display_shell_scale_drag() to factor in 
the distance dragged, rather than just scaling a flat +/- 10% for each 
detected movement event. The factor by which to change the scaling is 
also altered from 10% at each movement event, to 1% compounded for 
each pixel of distance dragged.  
This makes zooming via Ctrl + Middle Click or Ctrl + Spacebar behave 
more consistently and less jittery versus the previous method, while 
offering more fine grained control.
2022-04-05 12:31:11 +00:00
Jehan 7ca324fb2d Issue #7843: Middle clicking while manipulating canvas with spacebar…
… causes failed assertion.
2022-03-25 23:04:18 +01:00
Jehan fc063cb2ca app: use the unobtrusive cursor only in no-pointer+no-outline case.
We take a step back from the original MR which was proposing the "single
dot" cursor as a new "Pointer mode" option. I was really unsure this was
the best solution, especially reading again the whole original report.
It means that now nearly all of the original patch has been rewritten
another way, but let's leave the contributor commit as a start point to
get to where we are, and as acknowledgement of the contribution.

The reporter was annoyed by the crosshair when none were requested and
probably mostly for painting tools only (at least examples were about
brush or pencil, etc.) while showing outline. It looks to me like the
real issue was maybe when we were showing the big crosshair when using
the 4-arc fallback outline, for instance when using a dynamics changing
size. If so, this main issue is already fixed by my commit 64dc26064b.
No need of a new option for this, especially if the option can be as
confusing as a barely visible dot-cursor (I can already imagine the bug
reports of people tweaking random preferences and unhappy because the
pointer became invisible, while they don't know how they did it).

Instead I would say that when people specifically uncheck both "Show
brush outline" and "Show pointer" options, showing a huge crosshair
feels quite counter-productive. This is where I think that our small
unobtrusive cursor (probably a better name than "Single dot" by the way,
as it's not a single dot anymore) might be of use, the ultimate case
when someone really want a cursor as inconspicuous as possible, while
still having a visible feedback of the pointer position (even with
display-tablets, parallax issues make such a visual feedback important
to target where one paints).
So let's try this first and see how it goes.
2022-03-13 16:04:40 +01:00
L amander 187d2e3390 Issue #7034: Add single dot cursor mode 2022-03-13 16:04:40 +01:00
Jehan fc5e6e6c26 app: handle non-pixel cases to compute a reasonable max size for…
… cursor position label.

This should now resolve any weird jumping around of the cursor label,
hence the GUI. Of course, it could actually still happen when going
really off-canvas (though the max computation takes into account
reasonable off-canvas moving, which is totally possible, especially now
that we can view off-canvas so people can just work there and the GUI
should definitely not do weird stuff there as well).
2022-03-10 22:37:03 +00:00
Jehan 800539d518 app: get rid of macOS-only specific workaround code. 2022-03-10 22:37:03 +00:00
Jehan 3c11b4fd21 app: avoid jumping of label.
This issue was not confirmed to happen on Linux and Windows, but was
making ugly label resizes on macOS by just moving the cursor on canvas
normally. See video in:
https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/572#note_1389445

Ironically enough though, it started to happen even on Linux/X11, at
least, after commit 1baeffc913, which was the commit meant to fix this
on macOS!

This max size computation algorithm should work well enough for any
normal on-canvas usage, and even some off-canvas (yet close enough)
usage.

Note: this code only takes into account the pixel position case, for a
first implementation, which is why it's not pushed immediately in this
form.
2022-03-10 22:37:03 +00:00