Commit Graph

127 Commits

Author SHA1 Message Date
Ell 615035c101 app, cursors: add GimpToolTransform3DGrid tool widget
Add a new GimpToolTransform3DGrid tool widget, subclassed from
GimpToolTransformGrid, which can be used to perform 3D
transformations.

The widget can be in one of three modes:

  CAMERA - allows adjusting the primary vanishing point by moving a
  handle.

  MOVE   - allows moving the object through dragging.

  ROTATE - allows rotating the object through dragging.

By default, controlling the transformation through dragging applies
to the X and Y axes.  Holding Shift (or setting the "constrain-
axis" property) restricts the motion to only one of the axes.

For the MOVE and ROTATE mode, holding Ctrl (or setting the "z-axis"
property) allows controlling the Z axis instead.

For the same modes, holding Alt (or setting the "local-frame"
property), applies the adjustments in the object's local frame of
reference, instead of the display's global frame of reference.
2020-01-06 21:52:51 +02:00
Michael Natterer 1caff42c30 app: add missing space in gimp-mkenums command in config/ and display/ 2019-10-29 22:13:34 +01:00
Ell e2f31852fb app, menus: add "show canvas boundary" display option
Add a "show canvas boundary" display option, and a corresponding
"View" menu item and default-apperance preferences option.  When
enabled (the default), the canvas boundary is shown as an orange/
black dashed line in "show all" mode.
2019-09-04 20:47:25 +03:00
Michael Natterer 9aa6aa1f04 app: make display update much faster again
Introduce a render cache that keeps the result of scaling, color
management, display filters and shell mask (for tools like fuzzy
select).

Change gimpdisplayshell-render.[ch] to only render to the cache and
manage a cairo region of the cache's valid area. Call cache
invalidation functions form various places. Change the API of all
render functions to be in display coordinates.

Also get rid of gimpdisplayxfer.[ch] because we now have a
canvas-sized cairo surface which is a surface similar to the
destination surface.
2019-07-16 17:15:34 +02:00
Ell 4ef06b9922 app: add GimpToolWidgetGroup
GimpToolWidgetGroup is a tool widget acting as a container for
child widgets, multiplexing widget events and demultiplexing tool
events.  It can be used by tools to display multiple widgets
simultaneously.

The group keeps track of the current focus widget, and hover
widget.  Certain events are only dispatched to/forwarded from these
widgets.

The hover widget is determined by performing a hit test for all the
children, starting from the last child.  The first widget returning
GIMP_HIT_DIRECT, if any, is selected as the hover widget;
otherwise, if the current focus widget returns GIMP_HIT_INDIRECT,
it's selected; otherwise, if exactly one widget returns
GIMP_HIT_INDIRECT, it's selected; otherwise, there is no hover
widget.

The focus widget is set when clicking on a widget (or
programatically, using gimp_tool_widget_set_focus()).
Additionally, the group can raise the clicked widget to the top of
the stack (see gimp_tool_widget_group_set_auto_raise().)
2018-06-05 04:04:47 -04:00
Ell 634d5ae57d app: add GimpToolGyroscope
GimpToolGyroscope is a tool widget providing canvas interaction for
3D rotation.  The widget doesn't preset a UI, but rather
facilitates panning, rotation, and zoom, by dragging the canvas, or
using the keyboard.

Rotation is expressed using yaw/pitch/roll angles (performed in
this order).  A zoom factor can be specified, which affects the
magnitude of the rotation per distance traveled.  The widget can
operate in inverse mode, performing an inverse transformation.
2018-04-10 10:18:48 -04:00
Ell 6ebc3f1b09 Makefiles: don't use -xobjective-c when linking files on Mac
Last commit caused -xobjective-c to be passed during linking on
Mac, causing object files to be treated as source files.  Add a
-xnone flag to AM_LDFLAGS, canceling the effect of -xobjective-c.

Additinally, add a -xobjective-c++ flag to AM_CXXFLAGS, so that we
can use Objective-C in C++ files on Mac, if we ever need to.
2018-04-08 04:03:55 -04:00
Ell 06950be7f0 Makefiles: don't use -xobjective-c when compiling C++ files on Mac
On Mac, pass -xobjective-c to the compiler through AM_CFLAGS, not
AM_CPPFLAGS, so that it's only used for C sources, and not C++
sources.  In the latter case, it clashes with the -std=... flag,
spewing an error.  Thanks, Partha :)
2018-04-07 16:57:52 -04:00
Ell 984ed6cefd app: constrain line angles in display space, not image space
Add an offset_angle parameter to gimp_constrain_line(), which
offsets the radial lines by a given angle.

Add gimpdisplayshell-utils.[ch], with two new functions:

  - gimp_display_shell_get_constrained_line_offset_angle():
    Returns the offset angle to be passed to
    gimp_constrain_line(), in order to constrain line angles in
    display space, according to the shell's rotation angle and
    flip mode.

  - gimp_display_shell_constrain_line():  A convenience function
    which calls gimp_constrain_line() with the said offset angle.

Use the new functions in all instances where we constrain line
angles, so that angles are constrained in display space, rather
than image space.

The only exception is GimpEditSelectionTool, which keeps
constraining angles in image space, since it's not entirely obvious
that we want to constrain angles of dragged layers/selections in
display space.
2017-12-22 06:32:24 -05:00
Ell f7d6805ebb */Makefile.am: add abbreviations to generated enum files
Update the dprod production of generated enum files to include
abbreviated value descriptions, as per the previous commits.

Add a comment for translators above the abbreviated descriptions,
specifying the full description they abbreviate.
2017-11-30 03:10:14 -05:00
Michael Natterer be63a4a836 app: add new GimpToolWidget subclass GimpToolRectangle
which is a replacement for GimpRectangleTool. It's a massive piece of
code and I'm not sure everyting works as it should, but it seems to do
crop stuff without any glitches.
2017-06-26 19:19:16 +02:00
Michael Natterer 2192f520da app: add new GimpToolWidget subclass GimpToolPolygon
which is the free select curve.
2017-06-23 01:57:21 +02:00
Michael Natterer 3ab92c7290 app: add GimpToolWidget subclass GimpToolPath, a complete vectors editor 2017-06-21 23:27:20 +02:00
Michael Natterer 6bd316e070 app: add new GimpToolTransformGrid subclass GimpToolHandleGrid
which implents the handle transform tool's interaction.
2017-06-19 01:21:06 +02:00
Michael Natterer 457f6bf952 app: add GimpToolTransformGrid, GimpToolRotateGrid and GimpToolShearGrid
which do all transform tools' (except handle transform) canvas GUI and
their interaction.
2017-06-17 03:04:06 +02:00
Michael Natterer 18fe8f61a5 app: add GimpToolCompass, which is the entire canvas GUI of the measure tool 2017-06-11 23:38:55 +02:00
Michael Natterer 6fe578f269 app: add GimpToolLine, an subclass of GimpToolWidet
Implements the "line with handles" known from the blend tool, behind a
simple "x1, y1, x2, y2" interface.
2017-06-10 23:51:06 +02:00
Michael Natterer b026689e20 app: add new base class GimpToolWidget
which encapsulates a bunch of GimpCanvasItems plus their interaction,
using GimpTool-like virtual functions like button_press(),
button_release() motion() etc. Also has GimpDrawTool-like API to
manage the canvas items of its subclasses.
2017-06-10 23:47:54 +02:00
Ell 3ca48a0b30 enums: don't use comments in generated enum recipes
Works in bash, but apparently not portable.
2017-06-02 11:15:43 -04:00
Ell 5bcde32caf enums: run gimp-mkenums from the build dir
Commit 1e6acbd4e1 modified the
generated enum recipes to run gimp-mkenums from the source
directory, instead of the build directory, so that only the
basenames of the corresponding header files would appear in
the comment at the top of the generated files.  This was a
mistake -- $(GIMP_MKENUMS) is expecting to be invoked from the
build directory.

Switch back to running gimp-mkenums from the build directory.  To
avoid including the relative path from the build directory to the
source directory in the generated file, add a @basename@ production
variable to gimp-mkenums, which exapnds to the basename of the
input file, and use it instead of @filename@ in the recipes for the
generated enum files.
2017-05-22 20:29:18 -04:00
Ell f9fa0d1b18 enums: don't write generated enum files to src-dir if unchanged
When regenerating an enum file, don't copy it back to the source
directory if it hasn't actually changed.  This allows using a read-
only source directory where the enum header is newer than the
generated file, as long as they're not really out of sync.

OTOH, *do* touch the generated source-dir file even when unchanged,
in order to avoid re-running its recipe on the next build, however,
allow this to silently fail (which is harmless).
2017-05-22 17:58:04 -04:00
Ell 1e6acbd4e1 enums: generate enum files in source dir
We check them into git, so this makes it easier to keep them in
sync when using a separate build directory.

Case in point -- this commit also syncs a few enum files that went
out-of-sync with their headers.
2017-05-06 17:26:16 -04:00
Michael Natterer 388bf5d4ca app: add gimpdisplayshell-actions.[ch]
which contains functions to update shell-related actions in the "view"
group. Took the code out of gimpdisplayshell-appearance.c.
2016-05-14 22:54:11 +02:00
Kristian Rietveld cdc7542d46 Bug 756178 - Crash on new layer creation in fullscreen mode
Disable "new-style" fullscreen mode on OS X, we need support in
GTK+ in order for this to work properly. The currently available
fullscreen option in View > Fullscreen works fine and we plan to
migrate to the "new-style" fullscreen support in the future.
2016-04-17 00:39:40 +01:00
Michael Natterer 2f26016a47 app: move the code to update scrollbars and rulers to their own files
so they are gone from the "scale" and "scroll" namespaces because they
belong to neither and both. And because the files are way too large.
2016-01-05 18:05:38 +01:00
Michael Natterer 3267218143 app: add gimpdisplayshell-profile.[ch]
which will take over display color management from the display
filter module. This is WIP, the code is still unused.
2015-05-27 12:28:33 +02:00
Marek Dvoroznak 781f0b79f8 app: add canvas buffer preview
It is used by n-point deformation tool to preview a deformation process.
2015-02-27 20:21:52 +01:00
Michael Natterer 697572ccc0 app,libgimp*: fix includes to follow our include policy
- don't include <gdk-pixbuf/gdk-pixbuf.h> in headers in app/
- instead, include it in many .c files instead of <glib-object.h>,
  finally acknowledging the fact that app/ depends on gdk-pixbuf almost
  globally
- fix up includes as if libgimpbase depended in GIO, which it soon will
2013-10-15 01:58:39 +02:00
Michael Natterer 2876e43d00 app: add new helper object GimpToolGui
which delegates a tool's dialog to either a GimpToolDialog or an
embedded GimpOverlayDialog.
2013-06-07 10:24:51 +02:00
Michael Natterer ec786816bb */Makefile.am: merge INCLUDES into AM_CPPFLAGS
automake-1.13 finally warns about this anachronism.
2013-06-05 20:48:37 +02:00
Michael Natterer 977a194923 app: add a rotate dialog to rotate to exact degrees 2013-04-20 23:22:14 +02:00
Michael Natterer b3a9a6a3e3 Bug 55367 - Rotated view of the canvas (view is rotated, not image contents)
First version of display rotation, inspired by gimp-painter.
The rotation always happens around the image's center.

The only "UI" for rotating is currently shift+middle-drag and
shift+space-drag. Control constrains the angle to 15 degrees
and is currently the only way to go back to "no rotation".
2013-04-20 15:11:01 +02:00
Michael Natterer 52b92e740f app: rename gimpdisplayshell-style to gimpcanvas-style
because it doesn't and shouldn't depend on GimpDisplayShell at all.
In the future, it will take its defaults from the canvas' theme.
2013-04-18 16:46:01 +02:00
Michael Natterer b8e96c7141 app: rename gimpdisplay-transport.[ch] to gimpdisplayxfer.[ch]
so it matches the name of the stuff it implements.
2013-02-03 13:26:32 +01:00
Chris Wilson 4a81849e36 app: Use SHM transport for data transfer for display
Recent Cairo uses SHM transports when available, and exposes the ability
for its users to manage images shared between it and the display.
This allows us to eliminate copies, and if the architecture supports it
even to upload directly into GPU addressable memory without any copies
(all in normal system memory so we suffer no performance penalty when
applying the filters). The caveat is that we need to be aware of the
synchronize requirements, the cairo_surface_flush and
cairo_surface_mark_dirty, around access to the transport image. To
reduce the frequency of these barriers, we can subdivide the transport
image into small chunks as to satisfy individual updates and delay the
synchronisation barrier until we are forced to reuse earlier pixels.

Note this bumps the required Cairo version to 1.12, and please be aware
that the XSHM transport requires bug fixes from cairo.git (will be
1.12.12)

v2: After further reflections with Mitch, we realized we can share the
transport surface between all canvases by attaching it to the common
screen.

v3: Fix a couple of typos in insert_node() introduced when switching
variables names.

v4: Encapsulating within an image surface rather than a subsurface was
hiding the backing SHM segment from cairo, causing it to allocate
further SHM resources to stream the upload. We should be able to use a
sub-surface here, but it is more convenient to wrap the pixels in an
image surface for rendering the filters (and conveniently masking the
callee flushes from invalidating our parent transport surface).

Cc: Michael Natterer <mitch@gimp.org>
2013-02-02 13:59:59 +01:00
Michael Natterer f70bc837fa app: remove gimpdisplay-utils.[ch], move its only function to gimpdisplay.[ch] 2012-02-11 17:57:27 +01:00
Michael Natterer 0a68527edc app: move the GimpWindowStrategy interface from display/ to widgets/ 2012-01-30 23:33:21 +01:00
Michael Natterer 056e09a6cb Remove the makefile.msc build system, it is unmaintained since 2008 2011-12-16 15:53:56 +01:00
Michael Natterer c2e6f24687 app: add GimpCanvasTransformGuides and use them in the transform tool
which removes a lot of code from the transform tool, and reduces the
number of canvas items used for the transform grid from possibly
gazillions to one.
2011-07-24 18:42:13 +02:00
Martin Nordholts 07556242b0 app: Make positioning of new dockables depend on window mode
Add GimpWindowingStrategy with create_dockable_dialog() and use it in
dialogs_create_dockable_cmd_callback(). There are two implementations:
GimpSingleWindowStrategy and GimpMultiWindowStrategy. Depending on the
window mode, we want new dockables to appear in different places when
created. In single-window mode, they should appear inside the single
image window. In multi-window mode, a new dock window is created.
2011-07-03 21:20:36 +02:00
Michael Natterer 4e6f43a890 app: add new item class GimpCanvasRectangleGuides and use it
Removes a lot of code from the rectangle tool and fixes off-by-one
drawing problems because in image coordinates, lines can't be aligned
correctly with rectangles.
2011-05-22 22:09:09 +02:00
Michael Natterer e09520fb08 app: add GimpMotionBuffer class to swallow all the event smoothing code
This commit only adds the class and removes the members from
GimpDisplayShell, so everything looks more ugly than before, but
I wanted the member moving separate from any refactorings.
2011-04-17 18:53:42 +02:00
Martin Nordholts 3b243bdcfe app: Add gimp_display_get_action_name() utility function 2011-04-07 07:12:32 +02:00
Michael Natterer f09be52c1b app: turn the transform preview into a GimpCanvasItem
And remove all the complicated handling code entirely. This makes
GimpTransformTool a lot less complex. As a nice side effect, the
preview is now always 100% in sync with the grid and handles.
2011-03-27 16:40:41 +02:00
Michael Natterer 1f5e180334 app: move GimpToolDialog from app/widgets/ to app/display/
Zero logic changes yet, just a rename.
2011-03-20 13:34:03 +01:00
Michael Natterer c09ad998a4 app: split tool event handling out into an own file
it was simply getting too hairy in the callbacks.c file.
2011-02-24 02:15:53 +01:00
Michael Natterer d504eeb048 app: move GimpDisplayShell pointer/keyboard grabbing to utility functions
Spit warnings in the functions if grabbing fails and return a boolean
success value. Bail out in the callers upon grab failure instead of
assuming that grabbing always succeeds and running into an
inconsistent state that can cause all sorts of problems.
2011-02-20 12:12:48 +01:00
Michael Natterer cff73863c5 app: add GimpCanvasProgress, an on-canvas progress item 2010-11-09 19:35:04 +01:00
Michael Natterer 1541d8b666 app: make the shift-coordinates-by-anchor functions public API 2010-11-09 11:27:51 +01:00
Sven Neumann a798c9456c app/display: add new canvas item GimpCanvasPassePartout
This is supposed to replace the GimpDisplayShell highlight API,
but it is not yet used.
2010-10-18 22:17:27 +02:00