Commit Graph

3245 Commits

Author SHA1 Message Date
Michael Natterer bab75b7365 Change a bazillion URLs to https://
Including all user-visible link and links called from code, like
the help pages.
2018-07-14 14:19:27 +02:00
Michael Natterer 0fa991fb5f app: undeprecate gimpdisplayshell-selection.c 2018-07-13 19:09:01 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 17429c585f app: undeprecate GimpDisplayXfer, no more gdk_cairo_create() 2018-07-03 23:26:41 +02:00
Michael Natterer 716412a807 app: undeprecate GimpStatusbar
The call to gtk_container_resize_children() was probably completely
useless in GTK+ 3.x anyway.
2018-07-03 23:25:24 +02:00
Michael Natterer 7efb8576a1 app: prepare gimpdisplayshell-selection for undeprecation
with a patch that is mergable to 2-10.
2018-07-03 19:43:05 +02:00
Michael Natterer 67062a5867 app: undeprecate gimpdisplayshell-layer-select 2018-07-03 15:51:45 +02:00
Michael Natterer 3089a20167 app: remove all calls to gdk_window_process_updated()
- remove gimp_widget_flush_expose()
- remove the "now" argument to gimp_display_shell_flush() and make it
  only update widget states
- rename gimp_display_flush_whenever() to gimp_display_flush_update_region()
  and call gimp_display_shell_flush() separately in the only case we
  passed FALSE to flush_whenever()
- remove th flush_now interval logic from GimpDisplay, as soon as we
  have exposed the canvas, we are in the loop for the next frame clock
  tick anyway, so delaying a useless and removed process_updates serves
  no purpose
- in gimptool-progress.c, create the invisible grab widget also for
  non-cencelable cases, so we can always safely run the main loop
  manually to make the progress updates visible
- in gimp-gegl-apply-operation.c, always run the main loop manually
  to make the progress updates visible
- in gimpstatusbar.c, leave some FIXME comments as reminder that
  we might need the same logic as in gimptool-progress.c
2018-07-01 16:40:27 +02:00
Michael Natterer c0480f502d app: don't do any queue_resize() in the canvas' size-allocate callback
which means we can't setup scrollbars there. Move the code to a
GtkTickCallback which runs before the next frame after the
size-allocate.

Also put the center_image_on_size_allocate() code there because it has
to run after the canvas' tick callback, and the order of tick
callbacks can't be controlled.

As a side effect we now have a flag in GimpDisplayShell which
indicates that there will be a size allocate before the next frame, so
simply skip drawing the canvas completely. This fixes new images
jumping around when they are first shown.
2018-06-28 00:52:08 +02:00
Michael Natterer 80997a8646 Remove most GTK_ADJUSTMENT() and (GtkAdjutment *) casts
they are obsolete in GTK+ 3.x because GtkAdjustment cannot be passed
around as GtkObject any longer, GtkObject is gone.
2018-06-24 18:15:16 +02:00
Salamandar 8feb51954b Fix encoding. The world should be utf-8. 2018-06-15 17:34:59 +00:00
Ell d3a3c35317 Issue #1646 - Transform preview looks wrong with selection
In GimpCanvasTransformPreview, when the image mask is not empty,
make sure to align it with the drawable using a gegl:translate
node, before combining both at the gegl:opacity node.  Otherwise,
the mask is applied at the wrong offset when the drawable's offset
is not (0, 0).
2018-06-15 01:59:40 -04:00
Ell 47b7e7be7d Issue #1602 - Numeric selection size wrong after switching tools
In GimpToolRectangle, call gimp_tool_rectangle_update_options()
when the "[xy][12]" properties change, so that the "x", "y",
"width", and "height" properties are updated accordingly.

In particular, we set these properties when committing an empty
rectangle select tool, to init the rectangle to the current
selection bounds, and this call is necessary so that the "x", "y",
"width", and "height" tool options are properly updated as well.
2018-06-14 12:33:41 -04:00
Michael Natterer 33d2595d22 app: make GimpCursorView fit narrow docks
Replace "Selection Bounding Box" by simply "Selection" and add a tooltip
to the frame that says it's the bounding box.
2018-06-14 12:32:40 +02:00
Michael Natterer 5a7925c5dc app: set CSS names on GimpToolDialog and GimpOverlayDialog 2018-06-10 23:56:17 +02:00
Michael Natterer 655b170619 app: remove more GimpDock and GimpDockbook API in favor of GtkNotebook
mostly adding/removing widgets, use the plain GTK+ APIs instead.
Also, cleanup and cruft removal.
2018-06-08 02:40:31 +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 614cdcc0a8 app: add gimp_tool_widget_changed()
... which emits the "changed" signal, for use in subclasses to
notify the tool about widget changes not resulting from property
changes.
2018-06-05 04:04:47 -04:00
Ell 52a92a34d8 app: implement GimpToolWidget::hit() in all tool widgets
... and move the common functionality of their hit() and hover()
implementation to a separate function.
2018-06-05 04:04:47 -04:00
Ell 385203f4d6 app: add GimpToolWidget::hit() virtual function
... which takes the same arguments as GimpToolWidget::hover(), and
performs a hit-test, returning one of the following values:

  - GIMP_HIT_DIRECT:  The point corresponds to one of the widget's
    elements directly.

  - GIMP_HIT_INDIRECT:  The point does not correspond to one of the
    widget's elements directly, but the widget otherwise responds
    to press events at this point.

  - GIMP_HIT_NONE:  The widget does not respond to press events at
    this point.

Unlike hover(), hit() should not have any side effects.
2018-06-05 04:04:47 -04:00
Ell 5e736c697f app: implement GimpToolWidget::leave_notify() in various tool widgets
... by having them disable item highlights, and any other proximity
indication, when the cursor leaves the widget.
2018-06-05 04:04:47 -04:00
Ell be7eff980e app: add GimpToolWidget::leave_notify() vfunc
... which should be called on a widget when the cursor leaves the
widget, i.e., when it stops receiving hover events.

Have the default implementation clear the tool status.
2018-06-05 04:04:47 -04:00
Ell 49089fc427 app: respond to "focus-changed" signal in various tool widgets
... by disabling persistent item highlights when unfocused.
2018-06-05 04:04:47 -04:00
Ell eeed9c413b app: add gimp_tool_widget_{set,get}_focus(); "focus-changed" signal
The next few commits are going to add support for using multiple
tool widgets simultaneously.  As a first step, add a notion of a
focused tool widget, by adding gimp_tool_widget_{set,get}_focus(),
which tools/subclasses can use to control focus, and a
corresponding "focus-changed" signal, which tools/subclasses can
use to respond to focus changes.
2018-06-05 04:04:47 -04:00
Michael Natterer 1806b66c5a Issue #1560 - invisible canvas flip/rotation buttons...
...at the bottom of image window

Need to show/hide the event box, not just the labels/icons inside.
2018-06-04 15:13:23 +02:00
Michael Natterer 792cd581a2 Issue #1531 - Zooming with mouse movement should keep track of original point
When Control-Button2-Zooming, remember the start point, pass it to
gimp_display_shell_scale_drag() and force gimp_display_shell_scale()
to zoom around that point by passing GIMP_ZOOM_FOCUS_POINTER and
faking the point using gimp_display_shell_push_zoom_focus_pointer_pos().
2018-06-04 11:42:02 +02:00
Jehan 82f7e8c6c3 app: fix application icon compositing with the canvas on display scale.
This fixes this error on gdk_pixbuf_composite():
> assertion 'dest_x >= 0 && dest_x + dest_width <= dest->width' failed
2018-05-31 00:27:23 +02:00
Michael Natterer 0ecf0818a5 app: don't set a permanent size request on the canvas
Reset the canvas size request from gimp_display_shell_constructed() in
gimp_display_shell_canvas_size_allocate() so the image window can be
made smaller again. GTK+ 3.x always respects size requests.
2018-05-29 21:09:44 +02:00
Jehan e5c08832cb Issue #1509 - GIMP master Git zoom in/out scrolling is reversed. 2018-05-26 22:41:54 +02:00
Michael Natterer d9e016bd37 app: undeprecate gimpdisplayshell-scale.c and fix "unused variable" warning 2018-05-23 23:44:19 +02:00
Michael Natterer b33c6bc072 app: fix drawing of the canvas padding color
Remove all clipping hacks for drawing the canvas background, turns out
they never worked and we were relying on the pattern set on the
window, gah!

Also remove deprecated attempts to get a backgroud color and simply
don't show a color box in the menus for "from theme" cases.
2018-05-23 22:46:54 +02:00
Michael Natterer a628511a4e app: don't use gtk_window_parse_geometry() in GimpImageWindow 2018-05-22 12:33:58 +02:00
Timm Bäder f677a5abe8 app: remove RC style from GimpImageWindow
without replacement, we can always add CSS later if we don't like it
with whatever theme.
2018-05-22 11:14:50 +02:00
Michael Natterer 3c9272ef96 app: fix positioning of the text tool's style overlay 2018-05-22 01:59:26 +02:00
Michael Natterer 602dfb9a38 app: the last s/GdkDeviceManager/GdkSeat/ 2018-05-20 21:06:35 +02:00
Michael Natterer f3f61379f7 app: remove the option to enable tearoff menus 2018-05-20 21:06:35 +02:00
Michael Natterer e76c1305a5 app: derive GimpStatusbar from GtkFrame not GtkStatusbar
we were not using a single GtkStatusBar features, it was only in the
way. Remove broken size allocation logic and simply set a minimum
height of 3em in CSS. Also ellipsize the label, long labels had funny
effects since changing the overall GimpDisplayShell packing to pure
GtkGrid.
2018-05-20 21:06:35 +02:00
Michael Natterer 7f6b58d6ce app: kill the mess of boxes in GimpDisplayShell, use a grid for everything 2018-05-20 21:06:35 +02:00
Michael Natterer 0c9ac3bca9 app: use a cairo recording surface to measure GimpCanvasPath's extents
This gets rid of using the deprecated gdk_cairo_create().
2018-05-20 21:06:35 +02:00
Michael Natterer 4133a032de Undeprecate/improve GimpScaleComboBox and GimpUnitComboBox
Remove label-scale style properties and gtk_widget_modify_font()
hacks and theme them using CSS.
2018-05-20 21:06:35 +02:00
Michael Natterer 2dd2f1509b Enable and fix smooth scrolling and zooming
- Fix gimp_scroll_adjustment_values() for smooth scroll events
- Set GDK_SMOOTH_SCROLL_MASK on all widgets where we set GDK_SCROLL_MASK
- Add GIMP_ZOOM_SMOOTH to enum GimpZoomType
- Add "gdouble delta" to gimp_zoom_model_step()
- Change the meaning of the "scale" parameter to "scale or delta" in
  all functions that take GimpZoomType and a scale factor.
2018-05-20 21:06:34 +02:00
Michael Natterer e4d05a4758 app: use gimp_scroll_adjustment_values() in GimpNavigationEditor
and change signature of GimpNavigationView::scroll() to have
a GdkEventScroll instead of a GdkScrollDirection.
2018-05-20 21:06:34 +02:00
Michael Natterer fa3abc957b app: set GDK_SCROLL_MASK on widgets that need scroll events 2018-05-20 21:06:34 +02:00
Michael Natterer 613d02ca3a app: use gimp_scroll_adjustment_values() for scrolling the canvas 2018-05-20 21:06:34 +02:00
Michael Natterer bdbec7941c Use the new macros from the last commit in all files
...and gone are the annoying warnings.
2018-05-20 21:06:34 +02:00
Michael Natterer 4e7eead7e3 app: set all GtkPaned widgets to have wide handles
the narrow handles' event areas did overlap with our own widgets close
to the handle.
2018-05-20 21:06:34 +02:00
Michael Natterer 1d8696cd80 Get rid of gdk_flush() globally, use gdk_display_flush() 2018-05-20 21:06:34 +02:00
Ell 6e76cdf4d3 app: fix empty display unstable-version message 2018-05-20 21:06:33 +02:00
Ell ed46a405ae app: fix canvas motion compression
In gimp_display_shell_canvas_tool_events(), use
gdk_window_set_event_compression(), instead of implementing our own
motion compression, which used to introduce all sorts of weird
effects when combined with extended input devices, that we had to
hackishly work around.

For tools that use GIMP_MOTION_MODE_EXACT, we call
gdk_window_set_event_compression() to disable motion compression
for the canvas window upon initializing the tool in response to a
GDK_BUTTON_PRESS event, and again to re-eanble compression upon the
corresponding GDK_BUTTON_RELEASE event.

This commit also merges
gimp_display_shell_canvas_tool_events_internal() back into
gimp_display_shell_canvas_tool_events().  The split was a detail
of our custom motion compression implementation.
2018-05-20 21:06:33 +02:00
Michael Natterer 885f66158a app: kill all except one GtkAlignment, the tag popup one is a bit tricky 2018-05-20 21:06:33 +02:00
Michael Natterer c2763afd30 app: port gimp_display_shell_set_initial_scale() to the monitor's workarea 2018-05-20 21:06:33 +02:00
Michael Natterer 4a39edf241 app: disable motion compression, have to figure how to control GTK+'s 2018-05-20 21:06:33 +02:00
Michael Natterer 7f3f1afa28 app: port gimp_navigation_editor_popup() to GdkMonitor's workarea 2018-05-20 21:06:33 +02:00
Ell 75b9fa0aea app: take window scale-factor into account when rendering image
In gimp_display_shell_draw_image(), enable the code that adjusts
the scale-factor used for rendering the image by the window scale
factor, so that we make full use of the screen resolution even on
HiDPI displays.  This also fixes artifacts along render-chunk
borders.
2018-05-20 21:06:33 +02:00
Jehan 7642715c17 app: allow setting parent for dialogs created by GimpDialogFactory.
Fixes a bunch of:
> Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
2018-05-20 21:06:33 +02:00
Simon Budig 9d000f749f app/display: get rid of GtkTable 2018-05-20 21:06:33 +02:00
Michael Natterer d5c75afe2f app: honor the use-header-bar setting in GimpToolDialog 2018-05-20 21:06:32 +02:00
Michael Natterer 3571fc3ae2 app: port GimpCursorView to GtkGrid 2018-05-20 21:06:30 +02:00
Michael Natterer 65d4450b3e app, themes: move GimpDisplayShell styling to CSS
Looks half-decent again now.
2018-05-20 21:06:30 +02:00
Michael Natterer 03feaf39c3 app: port GimpDisplayShell to use GtkGrid 2018-05-20 21:06:30 +02:00
Michael Natterer 2f1a4fdc67 app: gimp_ui_manager_ui_popup_at_pointer() and use it where appropriate
Only one call to gimp_ui_manager_ui_popup() left...
2018-05-20 21:06:30 +02:00
Michael Natterer ab1edce8af app: use gimp_ui_menager_up_popup_at_widget() for the quick mask menu 2018-05-20 21:06:30 +02:00
Jehan 26710104ba Revert "Bug 794356 - Rulers always shown for subsequent image views"
This reverts commit ea48b9f31c.
Final revert of GTK+2 hack.
2018-05-20 21:06:30 +02:00
Jehan e7e7f00528 Revert "Bug 784480 - Clicking on-canvas GUI with a tablet stylus crashes..."
This reverts commit a8bc8d202c.
Continue removing the same GTK+2 hack.
2018-05-20 21:06:30 +02:00
Jehan 654ef12d58 Revert "Bug 794356 - Rulers always shown for subsequent image views"
This reverts commit 7230d5d777.
Remove GTK+2 only hack.
2018-05-20 21:06:30 +02:00
Michael Natterer b28228d911 app: add gimp_ui_manager_ui_popup_at_widget()
and use it where we used to pass gimp_button_menu_position() to
gimp_ui_manager_up_popup(), remove gimp_button_menu_position() because
it's now unused.
2018-05-20 21:06:30 +02:00
Michael Natterer 4c68fb70d4 app: use gtk_widget_get_preferred_size() in gimp_tool_gui_canvas_resized() 2018-05-20 21:06:30 +02:00
Michael Natterer 251d2f494e app: port some stuff to gdk_seat_grab/ungrab 2018-05-20 21:06:30 +02:00
Michael Natterer 5ece7a8d1f Port a lot of stuff from GdkScreen/monitor_number to GdkMonitor
including some fixes for getting pointer coords, and needed
API changes in libgimpwidgets.
2018-05-20 21:06:30 +02:00
Michael Natterer 09e6313c14 app: use gimp_color_display_stack_get_filters() instead of stack->filters 2018-05-20 21:06:29 +02:00
Michael Natterer 922f55ab85 app: s/GtkObject/GtkAdjustment/ in gimpdisplayhsell-rotate-dialog.c 2018-05-20 21:06:29 +02:00
Michael Natterer 1fdc472c68 app: make the statusbar's progress label visible again
and remove setting of removed align properties. The label alignment is
broken now until that feature comes back to gtk+.
2018-05-20 21:06:29 +02:00
Michael Natterer 8bb1637013 app: port GimpNavigationEditor to GtkStyleContext 2018-05-20 21:06:29 +02:00
Michael Natterer 76859c3c32 app: make input devices, grabs and therefore generally tools work again
- add new "device from event" apparatus that works on GTK+ 3.x
- fix the active device selection mechanism
- use the new device grabbing functions
- make sure we don't process events while we have a grab on
  another device
- compensate for some really obscure (and likely broken) behavior
  of XI2, it feels like we are the first real users...
2018-05-20 21:06:29 +02:00
Michael Natterer 4b322b8326 app: use GdkRGBA instead of GdkColor in some places 2018-05-20 21:06:29 +02:00
Michael Natterer 8c975484ab app: check whether child widgets exist in GtkWidget::style_updated()
because it is emitted repeatedly during widget construction, when not
everything is in place yet.
2018-05-20 21:06:28 +02:00
Michael Natterer e713ad4a43 app: implement GtkWidget::style_updated() instead of style_set() 2018-05-20 21:06:28 +02:00
Michael Natterer eb312ed55a app: remove calls to gtk_widget_get,set_extension_events() 2018-05-20 21:06:27 +02:00
Michael Natterer 5b3e3023cd app: port setting the canvas padding color to GtkStyleContext 2018-05-20 21:06:27 +02:00
Michael Natterer 64cde17687 app: don't connect to "size-requst" because that's deprecated
Instead, connect to "style-set" and calculate the widget's size
request there. Also fix the label's offsets after whatever GTK+ text
drawing changes.
2018-05-20 21:06:27 +02:00
Michael Natterer 27df9b617a app: didn't completely commit the display shell expose() -> draw() change 2018-05-20 21:06:26 +02:00
Michael Natterer 86e033d495 app: port to GtkWidget::draw() 2018-05-20 21:06:26 +02:00
Michael Natterer f8ef0c71c2 app: can't set the scale combo entry's properties in init() any longer
Set them in constructed() instead.
2018-05-20 21:06:26 +02:00
Michael Natterer a0a303bb42 app: remove call to gtk_statusbar_set_has_resize_grip() 2018-05-20 21:06:26 +02:00
Michael Natterer 9dfc455c12 app: port to GtkWidget::draw() (incompletely) 2018-05-20 21:06:26 +02:00
Michael Natterer 27659afa7c app: pass the cairo_region_t to gdk_window_invalidate_region() directly 2018-05-20 21:06:26 +02:00
Michael Natterer df65b0bdcd app: use gtk_widget_get_preferred_size() instead of size_request() 2018-05-20 21:06:26 +02:00
Michael Natterer e888be6a9a app: port GimpScalComboBox to GTK+ 3.0 2018-05-20 21:06:26 +02:00
Michael Natterer 3c8d9a1de8 app: use gtk_widget_get_preferred_size() instead of size_request() 2018-05-20 21:06:26 +02:00
Michael Natterer 1a04428815 app: remove obsolete (GtkObject **) casts 2018-05-20 21:06:26 +02:00
Michael Natterer 04961e056d app: no need to alloc colors any longer, GdkColormap is gone 2018-05-20 21:06:26 +02:00
Michael Natterer bb0eb4a7c3 Revert "app: Fix on canvas widgets ignoring clicks from tablets - bug 614441"
This reverts commit a059c0e7eb.
2018-05-20 21:06:26 +02:00
Michael Natterer ef2cf21f10 Bug 796252 - Mouse wheel zooming should center on cursor...
... _even at low zoom levels_

Pass GIMP_ZOOM_FOCUS_POINTER to gimp_display_shell_scale() when
wheel-scrolling, and change the scaling code to really honor
GIMP_ZOOM_FOCUS_POINTER and not apply magic image centering.

This keep the same point centered under the mouse for wheel-scrolling
and the zoom tool (== when the zooming is really triggered at a
certain mouse position).
2018-05-19 15:24:52 +02:00
Michael Natterer 2f629072f1 Bug 787919 - Tool options are lost when switching device
GimpDeviceInfo is the only way to store per-device settings like
color, brush etc. It used to be derived from GimpContext and therefore
limited to the context's properties, causing everything else (all
tool-individual options) to be lost on device change.

Derive it from GimpToolPreset instead, so it's capable of storing
arbitrary tool options.

Adapt things to the new class hierarchy and add a bunch of signal
handlers that make sure the active device's GimpDeviceInfo is updated
properly when the tool changes. Also change device switching
accordingly.

Change GimpDeviceStatus to only show the stuff that is relevant to
each device's tool.

And various small changes to make things work properly...
2018-05-16 02:09:19 +02:00
luz.paz 69b2e84924 Source and trivial typos
Found via `codespell` and `grep`
2018-05-12 23:44:47 +02:00
Michael Natterer 48f6d1b8ee app: avoid scaling GimpCanvasArc to zero, it causes a non-invertable matrix 2018-05-04 11:48:44 +02:00
Michael Natterer 4cc8481b66 app: get rid of a few forgotten stock-ids and new_from_stock() 2018-04-29 04:50:17 +02:00
luz.paz 4a77ff2d3d Bug 795557 - Misc. typo fixes in source, comments and doxygen (pt3)
Found via `codespell` and grep.
2018-04-25 23:49:06 +02:00
Michael Natterer 01e5a6b133 app: improve drawing of sample points so they are always visible
Draw them a bit brighter and larger, and with a dark shadow like tool
lines so they are visible on all backgrounds.
2018-04-19 16:20:41 +02:00
Michael Natterer 428110f63f app: remove non-cut/copy/paste functions from gimp-edit.[ch]
Move them to the new files gimpdrawable-edit.[ch] and
gimpimage-fade.[ch].
2018-04-18 23:48:33 +02:00
Jehan 3ac794816a Bug 724692 - Canvas rotation stuck with specific order of actions.
Commit b279c2d217 was breaking a specific use case, which I oversaw:
when space bar activates the move tool, you may want to release the
space bar while mouse button is pressed, and expect to still be able to
move the layer/selection/guide, but releasing space was stopping the
move immediately. The move tool must only be deactivated when both space
and button 1 are released, and the move itself must continue as long as
button 1 is pressed (when started while space was pressed).

As a nice side effect of this commit, panning and canvas rotation are
also improved since now they can be continued while releasing space
(respectively shift-space) if mouse button 1 was pressed, and up until
the mouse button is released. Pressing space again, then releasing the
mouse, back and forth, also work as expected (i.e. move tool stay
activated though the move stops; and panning or rotation continue).

Of course now we don't get anymore panning/rotation stuck while neither
space nor mouse buttons are pressed (which was the original bug). At
least one of these need to stay pressed for panning/rotation/move to
stay activated. And initial activation is obviously always through
(shift-)space only.
2018-04-14 15:36:08 +02:00
Ell 5430e7794c app: various fixes in GimpToolGyroscope
Invert zoom adjustment using the mouse or the keyboard when in
inverse mode.  Take zoom factor into account when panning using the
keyboard.  Fix motion cancelation.
2018-04-11 04:53:26 -04:00
Ell 6453b371a9 app: fix status message of GimpToolGyroscope 2018-04-10 11:08:37 -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
luz.paz 7fdb963e01 Bug 794996 - Misc. typo fixes in comments in app/
Found via `codespell -q 3 --skip="./po*"`
2018-04-08 21:25:56 +02:00
Ell db50c72c24 app: align display paint area to a coarse grid
Align rectangles added to the display paint area, in
gimp_display_paint_area(), to a coarse grid, to reduce the
complexity of ther overall area.  This is similar to commit
49285463e6, however the alignment
happens in display space, instead of image space.
2018-04-08 09:42:47 -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 bea27171ad app: throttle statusbar progress updates
Statusbar progress updates that update the progress bar are
relatively expensive, slowing down operations that report progress
frequently.  Only update the progress bar if a certain amount of
time has passed since the last update, to counter that.
2018-04-07 12:05:59 -04:00
Michael Natterer 7230d5d777 Bug 794356 - Rulers always shown for subsequent image views
Remove the connect_after() hack from GimpImageWindow again and instead
add gimp_display_shell_canvas_realize_after() and restore the configured
ruler visibility there. Should work for all cases now.
2018-04-03 22:36:17 +02:00
Michael Natterer b46b9d8921 Bug 772126 - Make GimpColorFrame handle very long numbers
Add "ellipsize" property to GimpColorFrame and set it to
PANGO_ELLIPSIZE_END in the the pointer information dockable.

Better cut off long numbers than make them expand the dock.
2018-04-03 01:47:53 +02:00
Michael Natterer ea48b9f31c Bug 794356 - Rulers always shown for subsequent image views
gimp_image_window_constructed(): connect_after to the notebook's
"switch-page" signal so gimp_display_shell_appearance_update() is
called after gimp_display_shell_canvas_realize(). Just another hack
to fix the hack...
2018-04-02 22:21:41 +02:00
Massimo Valentini 2aa4426d4f app: improvements in code executed a lot while painting.
This keeps the same rectangle packing behaviour, so to behave exactly as
before for what concerns batching the updates, but should be lighter
when looping to find the first good rectangle to use.

In rtree_insert(), some conditions in the if tests are implied by
previous conditions. And therefore the 2 successive for loops are
actually identical.

In rtree_node_insert(), it is wrong/harmful to insert zero sized
rectangles in the tree because they can never be selected and just make
the list longer. So rtree_node_create() should just return NULL when w
or h are 0.

See bug 694917, comments 51 to 61.
2018-03-31 00:18:46 +02:00
Michael Natterer 69d5201d59 app: fix formatting in previous commit 2018-03-28 00:44:33 +02:00
Øyvind Kolås a7b0d55fc5 app: only create GeglBuffer wrapper for cairo-data when used
As suggested by massimo in bug #694917, move unconditional creation/destruction
of a wrapper GeglBuffer object from top-level scope of the function to the
single conditional scope where it is used.
2018-03-28 00:37:06 +02:00
Zhouyang a6fd24a953 Bug 793951 - Fix crashes when some external APIs fail
Check the return values of some functions and set errors or print
a message to stderr if they fail.
2018-03-26 21:27:42 +02:00
Michael Natterer 9a365eaf8b Bug 794378 - GIMP crashed while I was moving the image window
Use a weak pointer in GimpToolGui to not keep a dangling
private->viewable around.
2018-03-20 19:02:43 +01:00
Jehan 8aaf77ba11 app: return from gimp_display_shell_space_pressed() immediately when...
... scrolling in progress.
In particular, this could happen while panning with mouse middle click
and hitting space. This space should simply be ignored.
2018-03-16 19:52:16 +01:00
Jehan b279c2d217 Bug 724692 - Canvas rotation stuck with specific order of actions.
The bug was affecting actually both canvas rotation and panning when
done with space key. If the first mouse button was also clicked, then
released after the space key, we ended up in some stuck action. It could
only be unstuck by hitting/releasing space again.

I am actually unsure that this was not originally done on purpose,
especially since the code has these 2 status variables space_pressed and
space_release_pending, but really apart from looking at this code, the
behavior just looks very buggy and impracticable.
The new behavior is to just stop the canvas panning/rotation as soon as
space is released (which is also how it is documented in our manual, and
how everyone seems to use the feature). I only kept the variable
space_release_pending, which I use as was used space_pressed before.
2018-03-16 14:23:41 +01:00
Ell dc1852049e app: throttle GimpCanvasProgress updates
Avoid redrawing GimpCanvasProgress items upon
GimpProgress::set_value() if a minimal amount of time hasn't passed
since the last call.  This notably improves performance of
frequently-updated GimpCanvasProgress items.
2018-03-16 04:34:00 -04:00
Ell 1cc90e52bb app: fix indentation in gimpcanvasprogress.c 2018-03-16 04:34:00 -04:00
Ell efa8040780 app: rename gimp_cairo_foo() functions to follow cairo naming scheme
Really pedantic stuff :)  Rename the functions in gimp-cairo.h to
follow the naming scheme employed by cairo, so that they don't feel
out of place.
2018-03-07 06:18:20 -05:00
Ell 4a0cc01dfa Bug 793539 - Gimp stops each time you close a picture
Don't choke when calling gimp_tool_rectangle_set_constraint() while
there's no active image, or while the active image has no active
layer, which can happen when updating the default aspect ratio of
the crop tool.  This would previously result in CRITICALs.

Additionally, use weak pointers for the crop tool's current_image
and current_layer members, to avoid potential dangling pointers.
While not currently necessary, this makes the code less dependent
on the exact order of events.
2018-02-18 09:41:14 -05:00
Jehan 77ed476113 app: add GIMP_MESSAGE_BUG_WARNING + GIMP_MESSAGE_BUG_CRITICAL severity.
Since a few commits, I don't generate the traces anymore in errors.c but
delay this to gui-message.c and rely on the message severity to decide
whether or not generating traces.
Unfortunately none of the current severities are properly describing
this new type of messages. Even GIMP_MESSAGE_ERROR is used everywhere in
our code NOT for actual programming bug, but often for data errors
(which are not bugs but proper messages and should obviously not prompt
a debug trace).
2018-02-12 18:22:15 +01:00
Michael Natterer 539927ebfa app: replace all g_assert() by the newly added gimp_assert()
which is just a #define to g_assert for now, but can now easily be
turned into something that does some nicer debugging using our new
stack trace infrastructure. This commit also reverts all constructed()
functions to use assert again.
2018-02-11 22:23:10 +01:00
Ell 534e5971fc app: don't set properties of invisible handles in GimpToolTransformGrid
This avoids warnings when the handle positions the handle-transform
tool result in a matrix that transforms the TransformGrid's handles
(which are all invisible) to coordinates that are outside of the
corresponding properties' range.
2018-02-04 14:45:24 -05:00
Ell 275815c808 app: misc cleanup in gimpcoords-interpolate
Fix indentation, typos, style.  Use array parameters for the
control points, instead of using individual by-value parameters.
Use GArray* for the results, instead of GArray**.  Verify
arguments.

Adapt the rest of the code to the changes.
2018-02-03 05:58:42 -05:00
Ell 1cae93ac42 app: use gimp_transform_polygon() in GimpCanvasPolygon
... so that clipping is done properly.
2018-02-03 05:58:41 -05:00
Ell 5f58a7a260 app: pass near-plane z-coordinate to gegl:transform
... so that GEGL performs the same clipping we do.
2018-01-28 16:37:34 -05:00
Ell 258e60f1b7 app: use gimp_transform_polygon() in GimpCanvasBoundary
... so that clipping is done properly.
2018-01-28 16:37:34 -05:00
Ell 4626190ac7 app: use gimp_transform_polygon() in GimpCanvasTransformGuides
Add a "clip" property to GimpCavnasTransformGuides.  When set, use
gimp_transform_polygon() for transforming the guides and the
bounding box, so that they're properly clipped.

Add a corresponding "clip-guides" property to
GimpToolTransformGrid, and set it to TRUE in GimpToolHandleGrid, so
that the handle-transform tool's guides are clipped properly.
2018-01-28 16:37:34 -05:00
Ell 9900573345 app: use gimp_transform_polygon() in GimpCanvasTransformPreview
... so that clipping is done properly.
2018-01-28 16:37:34 -05:00
Michael Natterer 5da3bdb4ea app: fix GimpToolCompass for one perfectly vertical line
the angle arc and the small helper line were displayed on opposite
sides of the first point. Now they are on the same side, just like for
all other angles.
2018-01-28 15:24:29 +01:00
Ell 0334595cc1 app: port GimpHandleGrid from gimp_transform_matrix_handles() to ...
... gimp_transform_matrix_generic()

Replace the separate x/y coordinate arrays of GimpHandleGrid with
GimpVector2 arrays, and use gimp_transform_matrix_generic(),
instead of gimp_transform_matrix_handles(), when calculating the
matrix.  When the resulting matrix is invalid, hide the guides.
2018-01-27 07:30:29 -05:00
Ell 6a64f09681 app: add show-guides property to GimpToolTransformGrid
... which can be used to control the guides' visibility.

Will be used by the next commit, to hide the guides in
GimpToolHandleGrid when the tranformation is invalid.
2018-01-27 07:30:29 -05:00
Ell 5cd0ecc998 app: fix rotation pivot of GimpCanvasHandle
This fixes the erratic 1-pixel movement of transform-grid handles.
2018-01-27 07:30:28 -05:00
Jehan 8120694759 app: add include to fix a warning.
The build warning was:
> warning: implicit declaration of function ‘memcmp’ [-Wimplicit-function-declaration]
2018-01-21 17:31:57 +01:00
Michael Natterer a8bc8d202c Bug 784480 - Clicking on-canvas GUI with a tablet stylus crashes...
...if "Show rulers" is disabled

Add HACK to gimp_display_shell_canvas_realize() that makes sure the
rulers are always mapped once for each new GimpDisplayShell. This
seems to magically fix all the crashes.
2018-01-16 21:48:48 +01:00
Michael Natterer 3568f1cb3b app: reorder a line in gimp_display_shell_constructed()
just for consistency, no logic is changed.
2018-01-16 21:35:36 +01:00
Ell 7f56393138 app: use GEGL for transform-tools preview
Before you get too exceited -- no, this commit doesn't integrate
transform previews into the image graph :)  We still use a
separate canvas-item overlay, just like before, but instead of
using an impromptu implementation to render the preview, we use
gegl:transform.  We properly adjust the matrix passed to the op
according to the display scale, so that we still render only as
much as needed.

This is both notably faster than the current code, and, for
perspective transforms, more accurate.
2018-01-15 14:58:23 -05:00
N Ferreira 3f7afd5494 Bug 792439 - Status bar: Rotated angle is too close to zoom arrow. 2018-01-12 01:50:51 +01:00
Jehan 21cb905dad Revert "app: use FAST filter when painting xfer surface"
This reverts commit 36258a671a.
This commit was making the rotated canvas rendering quite horrible to
the point that I think it would make the canvas rotation feature barely
usable. See bug 759287, comments 13 to 18.
I think we will need to find other ways to accelerate rendering.
Compromise on quality is possible, but I think that in this case, this
was more than just a compromise. It was more like completely abandonning
quality. We could even see the lines "spiking" while you were rotating!
Like your drawing was alive!
2018-01-10 03:52:54 +01:00
Ell b95bb99e05 app: in compress_motion(), remove accidentally added "break", fix comment 2018-01-04 08:48:11 -05:00
Ell d3b45f1875 Bug 791689 - On-Canvas GUI broken with extended input device
Improve the disabling/enabling of extended input events for the
canvas during enter/leave-notify events, in particular, so that
enter-notify events that are a result of pointer ungrabbing don't
erroneously reeanble extended input events.
2018-01-04 06:11:38 -05:00
Ell fa18044392 Bug 791689 - On-Canvas GUI broken with extended input device
Something about the unqueueing and requeueing of the entire event
queue during motion compression fries GTK's brain w.r.t. extended
input events.  Instead, have gimp_display_shell_compress_motion()
return the first non-compressed event to the caller, making it
responsible for dispatching it after handling the motion event.
2018-01-04 06:11:37 -05:00
Massimo Valentini 423ce6fca3 Bug 770689 - Custom transparency controller for dark...
...outside area of Crop Tool -> Highlight option

Add "highlight-opacity" property and turn the controlling GUI into an
expanding toggle that reveals an opacity slider.
2018-01-02 14:33:27 +01:00
Ell 37a6620006 app: don't upscale preallocated display buffers by GIMP_DISPLAY_RENDER_MAX_SCALE
After commit 8029508fbe, we always
render the image in chunks that are at most
GIMP_DISPLAY_RENDER_BUF_WIDTH x GIMP_DISPLAY_RENDER_BUF_HEIGHT,
even when the window's scale factor is > 1.
2017-12-31 11:57:22 -05:00
Ell 09e1c7f9b5 app: fix mask overlay position when zoom != 100%
... and the mask offset != (0, 0)

Thanks tmanni!
2017-12-31 11:57:22 -05:00
Ell eded91e118 Bug 753412 - New Canvas rotation feature rotates brush.
Replace the "lock brush size to zoom" paint option with a "lock
brush to view" option, which links the entire brush transform to
the view transform, so that the brush remains invariant in display
space under scaling, rotation, and reflection.
2017-12-22 17:52:29 -05:00
Jehan 5f00c189e6 app: also show line info (distance, angle) when moving an endpoint.
When you move an endpoint in the Blend Tool, angle and distance
information are especially important, in case you want to draw a
gradient with specific values.
2017-12-22 23:41:40 +01:00
Jehan e1621c32d3 app: use gimp_display_shell_get_line_status() for GimpToolLine.
Currently Blend tool only shows the vector coordinates whose usefulness
is a bit of a question. Now it will also show distance (in current shell
unit) and angle!
2017-12-22 23:24:24 +01:00
Jehan 0116d7316a app: new gimp_display_shell_get_line_status().
Factorize the code to show status for tools needing to show line
information.
2017-12-22 23:24:24 +01:00
Ell fff57f84a0 app: add gimpdisplayshell-utils.[ch]
... should have been part of last commit.
2017-12-22 06:59:21 -05: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 2315784110 Bug 791741 - Transparent rectangles when image is drawn
Add gimp_display_shell_[un]transform_with_scale(), which are
similar to gimp_display_shell_[un]transform(), however, they
transform the bounding box to/from uniformly-scaled image space,
given the scale factor as a parameter.  These functions are more
accurate than using gimp_display_shell_[un]transform() and applying
the scaling separately, in particular, when the scale matches the
(horizontal or vertical) display scale.

Use these functions in gimp_display_shell_draw_image(), to avoid an
off-by-one error when transforming screen-space chunks to image-
space chunks, which leads to the symptoms described in the bug.

Fix another potential off-by-one error affecting non-uniformly
scaled images, and window scale factors other than 1.
2017-12-19 15:04:51 -05:00
Ell 36258a671a app: use FAST filter when painting xfer surface
Use CAIRO_FILTER_FAST when painting the xfer surface to the
screen.  This notably improves performance when the canvas is
rotated, at the cost of lower filtering quality.
2017-12-09 10:41:16 -05:00
Ell 6d19e9e860 app: another off-by-one chunking fix 2017-12-09 10:41:16 -05:00
Ell 709c929d4f app: fix off-by-one error in last commit 2017-12-09 05:30:02 -05:00
Ell 8029508fbe Bug 759287 - Canvas Tearing While in Rotated Canvas View
Based on a patch by Massimo.

Move the entire image-space/screen-space transformation logic from
gimp_display_shell_render() to gimp_display_shell_draw_image(), so
that the former works entirely in image space, and do the chunking
and clipping in screen-space, making sure that image-space chunks
are never larger than
GIMP_DISPLAY_RENDER_BUF_WIDTH x GIMP_DISPLAY_RENDER_BUF_HEIGHT,
even when the window's scale factor is greater than 1.

Add a GIMP_BRICK_WALL environment variable, which, when set, shows
the screen-space chunk bounds.
2017-12-09 05:01:30 -05:00
Michael Natterer d60c237805 Bug 785781 - Additional Free Selection step (hitting Enter)...
...is a regression in common cases

Commit the free select tool on double click inside the polygon.

Done by implementing GimpCanvasItem::hit() in GimpCanvasPolygon, using
ugly code.
2017-12-01 22:19:42 +01: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
Jehan 80b04d06da Bug 789173 - Make canvas rotation information visible on the main window
Now add also flip information in the status bar so that one knows that
the canvas is flipped horizontally and/or vertically. Especially if you
often flip and rotate the canvas (or if you did it by mistake), at some
point, it may become confusing to remember whether this is the case. Now
it will be possible to check in a single glimpse at the status bar.
Similarly to what I previously did for the rotation information, hitting
the flip icons in status will allow to unflip easily without having to
go in menus or remember all shortcuts.
These information will be visible only when the canvas is flipped or
rotated.
2017-11-15 20:04:19 +01:00
Jehan 953a095563 Bug 789173 - Make canvas rotation information visible on the main window
The rotation angle is made visible in the status bar.
Clicking the angle label also opens the "Select Rotation Angle" dialog.
2017-11-15 20:02:54 +01:00
Ell 5d91657747 app: indentation fix to last commit 2017-11-14 11:34:32 -05:00
Ell 2e9ab59d19 app: use matrix to determine if doing perspective transform in preview
In GimpCanvasTransformPreview, use the transform matrix to
determine if we're doing a perspective transform, rather than
relying on a separate property, so that we don't use the slow
perspective path unnecessarily.

Consequently, remove the does_perspective member of
GimpTransformTool, since it's no longer used.
2017-11-14 11:24:56 -05:00
Jehan 788e04bddb app: GimpScaleComboBox resized appropriately with its contents.
Rather than having an oversized entry all the time, adapt it to the
visible zoom.
2017-11-14 05:08:02 +01:00
Jehan 864e3df7a9 app: fix comment typos. 2017-11-14 04:45:13 +01:00
Ell d591bf51f0 app: clear display filter stack when emptying a display 2017-11-12 12:11:30 -05:00
Ell 6ffa17bd33 app: avoid unnecessary work when all display filters are disabled
Return FALSE from gimp_display_shell_has_filter() when there are
filters, but they're all disabled, to avoid unnecessary extra
color conversions during rendering.
2017-11-05 09:03:04 -05:00
Ell 9cd8e7f9c6 app: apply display filters in sRGB, not monitor profile
When we have display filters, break the color profile transform in
two: first, convert from the image profile to sRGB, then apply the
filters, then convert from sRGB to the monitor profile.
2017-11-03 04:24:49 -04:00
Ell 5a726a028e app: use a propgui for display filters that return a NULL config widget
When a display filter's configure() function returns NULL, use a
propgui for the filter, instead of not showing a widget at all, to
spare filters the need to manually construct a configuration gui.
2017-11-02 16:12:33 -04:00
Ell a5a2b56850 app: use actual render area when processing display filters
When processing display filters, shift the filter buffer to the
top-left corner of the render area, and pass the actual render
area, instead of an area whose top-left coords are (0, 0), to the
display filter.  This allows for position-dependent display
filters.
2017-11-02 16:12:33 -04:00
Michael Natterer a5e1dd84fd app: implement GimpToolActiveModifiers in GimpTool
Change gimp_tool_set_active_modifier_state() to honor the new
GimpToolControlSetting. Explicitly set the mode to SEPARATE in
all tools that require modifier keys during a stroke.

And here comes the actual fix: change GimpTransformTool and
GimpToolTransformGrid to use SAME mode, and remove their
active_modifer_key() and hover_modifier() impls, so it makes no
difference whether a modifier is pressed before of after mouse button
press/release.
2017-10-29 16:42:53 +01:00
Ell b2bc33bdf1 app: blink the statusbar on warnings and errors
Statusbar messages are too easy to miss.  Blink the statusbar when
showing a warning or an error, to attract attention.
2017-10-28 10:08:10 -04:00
Ell c5b88702e6 app: allow specifying a callback function for propgui pickers
Allow propgui constructors to specify an (optional) callback function
when creating pickers, to be called when a color/coordinate is picked,
similarly to controller callbacks.

Implement picker callback support in GimpFilterTool.  When the active
picker has an associated callback function, call it instead of the
class's color_picked() function.

Add lots of "#include <gegl.h>" to .c files that miss it, which is
now necessary, since this commit adds a Babl* parameter in
propgui-types.h.
2017-10-16 12:38:37 -04:00
Ell 507bc43716 app: improve status messages of GimpToolLine
... to cover all the new stuff.
2017-10-09 12:48:50 -04:00
Ell dad521e334 app: add misc. parameters to GimpControllerSlider
Add parameters, controlling the behavior and appearance of sliders,
to GimpControllerSlider.  The macro GIMP_CONTROLLER_SLIDER_DEFAULT
expands to a nonmodifiable lvalue of type GimpControllerSlider,
whose members are initialized with the most common default values.

Handle the new parameters in GimpToolLine.  A slider using the new
"autohide" mode is only visible when selected, or when the cursor
is close enough to the line, between the slider's min and max
values, and no other handle is grabbed or hovered-over.
2017-10-09 12:48:50 -04:00
Ell 9e26d7ea5f app: add handle-clicked signal to GimpToolLine
... which is emitted when a handle is single/double/tripple clicked.

The signal handler returns a boolean value.  A return value of TRUE
stops further event processing, while a return value of FALSE allows
it.
2017-10-09 12:48:50 -04:00
Ell 50acb6690d app: add prepare-to-remove-slider signal to GimpToolLine
The signal is emitted when a slider is dragged away from the line,
and will be removed when the button is released, and when the
slider is dragged back to the vicinity of the line, and won't be
removed.  The last parameter of the signal is a boolean flag
differentiating between the two cases.

Note that a remove-slider signal may be emitted without a preceeding
prepare-to-remove-slider signal, however, is a prepare-to-remove-
slider signal is emitted with a TRUE last parameter, it must be
eventually followed by a remove-slider signal, or by another
prepare-to-remove-slider signal with a FALSE last parameter.
2017-10-09 12:48:49 -04:00
Ell bac7dac4ba app: allow adding and removing sliders to/from a GimpToolLine
Add support for adding and removing sliders to/from a GimpToolLine,
using three new signals:

  - can-add-slider:  Takes a double argument in the range [0,1],
    indicating a location along the line, and returns a boolean
    value, indicating whether a slider can be added at that
    location.

  - add-slider:  Takes a double argument in the range [0,1],
    indicating a location along the line, for which can-add-slider
    returned TRUE.  In response, should add a new slider at that
    location, and return its index, or a negative value if no
    slider was added.

  - remove-slider:  Takes a slider index.  In response, may remove
    the slider.

On the UI side, when the cursor is close enough to the line, but
not within the hit area of an existing handle, GimpToolLine checks
if a slider can be added at the cursor position, using can-add-
slider.  If a slider can be added, a dashed circle appears at the
cursor position along the line, indicating where a slider will be
added.  The cursor is added by clicking, which emits an add-slider
signal; if the signal returns a slider index, the new slider is
selected, and can be subsequently dragged.

Removing a slider is done by either selecting the slider and
pressing backspace (or delete, although we don't actually forward
it to the tool atm,) or by "tearing" the slider: when dragging
the slider, if the cursor is far enough from the liner, a dashed
circle appears around the slider, and releasing the mouse removes
the slider.
2017-10-09 12:48:49 -04:00
Ell 86954037de app: add dashed canvas handle types
Add DASHED variants for GIMP_HANDLE_{SQUARE,CIRCLE,DIAMOND}.
2017-10-09 12:48:49 -04:00
Ell 63ccbc4fb0 app: add keyboard control to GimpToolLine
Add support for moving the selected handle using the arrow keys,
with the same modifiers as GimpToolPath.
2017-10-09 12:48:49 -04:00
Ell d4cb1623ea app: add persistent handle selection to GimpToolLine
En route to on-canvas gradient editing, add support for persistent
handle selection to GimpToolLine (a handle being either an endpoint
or a slider).  Handles are selected through clicking, however,
unlike before, the selection persists after the mouse is released.
A new "selection" property specifies the currently-selected handle
(who knows, maybe in the future we'll add multi-selection), and a
new "selection-changed" signal is emitted when the selection changes.

The visual feedback has been changed to better suit the new behavior,
and the behaviors yet to be added:  The selected handle is marked
using highlighting; the highlighting doesn't change while hovering
over other handles.  Only the hit-test circle is used as hover
indication, however, we use a fixed-size circle, and only show the
circle for the currently hovered-over handle -- no more trippy
expanding circles :)

A few minor changes along the way:

  - The selected handle is now the (first) one that's closest to the
    cursor, instead of the first one to pass hit-testing.

  - We don't move the selectd handle upon button-press, only upon
    motion, so that handles can be selected without moving them.

  - Show a MOVE cursor modifier when hovering over a handle.
2017-10-09 12:48:49 -04:00
Ell 042650e18c app: rename slider-value variables in GimpToolLine
Rename the "t" variables, representing slider values, to "value".
2017-10-09 12:48:49 -04:00
Ell fb31a592c6 app: add gimp_tool_line_get_slider()
... and use it instead of using g_array_index() on the slider array
directly.
2017-10-09 12:48:48 -04:00
Michael Natterer a7620b08aa Bug 788399 - Corrupted display of sample points
In gimp_canvas_sample_point_get_extents(), use the drawn number's
actual size instead of some random constant that was good enough for
my own font size.
2017-10-01 19:39:56 +02:00
Ell 0d9a85a207 Bug 784643 - Crash when using transform tools
Fix buffer overflow in gimp_tool_transform_grid_get_cursor().
2017-09-11 15:09:35 -04:00
Ell 1773cd91a2 app: in GimpCursorView, move cursor info update to an idle function
Updating the cursor information involves sampling the active image/
drawable, which can be expensive, especially if there are filters
active that also respond to cursor motion, e.g., while using the
warp tool.

Move the actual updating to an idle function.  This dramatically
improves responsiveness in these situations.
2017-09-08 11:23:06 -04:00
Ell 58fdaae3ad enums: add intermediate generated enum files to .gitignore 2017-08-24 15:35:27 -04: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
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 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
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 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
Michael Natterer d227a0d71f app: disable gimp_display_shell_profile_update() debug output 2017-07-28 22:34:41 +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 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 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 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 16cfcf1bde app: remove some #if 0'ed code from GimpToolPolygon 2017-07-06 12:32:36 +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
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
Ell 04b407a019 app: s/slider_count/n_sliders/ in GimpToolLine and firends
Yep yep yep.
2017-07-03 18:10:30 -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 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 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
Piotr Drąg ddee27f6d4 Fix typos in translatable strings 2017-07-02 17:47:08 +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 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 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 a562860eed app: add boolean property "force-narrow-mode" to GimpToolRectangle
which allows to force outside handles without resorting to hacks.
2017-06-28 14:23:51 +02:00
Michael Natterer 719f96d89a app: fix gimp_tool_rectangle_frame_item()
it was setting double properties from integers, boom.
2017-06-28 14:13:10 +02:00
Michael Natterer 94bb1a78c1 app: some cleanup and fixes in GimpToolRectangle
- unset "rect_adjusting" before bailing out on button_release()
- update the integer rectangle when the double properties change
- don't try to show handles with a size of < 3
- remove unused members
- shorten some variable names
2017-06-27 17:46:47 +02:00
Michael Natterer 8a1d782b42 app: add optional round corners to GimpToolRectangle 2017-06-27 14:19:18 +02:00
Michael Natterer 75871cfa64 app: add the options to draw an ellipse within GimpToolRectangle 2017-06-27 00:46:55 +02:00
Michael Natterer 9d042e4de9 app: add gimp_canvas_arc_set() 2017-06-27 00:46:24 +02:00
Michael Natterer c07a5f0a61 app: add gimp_tool_widget_add_arc() 2017-06-27 00:45:45 +02:00
Michael Natterer 3a0aab71b6 app: gimp_tool_widget_get_cursor(): rename "cursor_modifier" to just "modifier"
The same in all subclasses.
2017-06-26 22:13:00 +02:00
Michael Natterer a3acb7422d app: move status message setting from GimpBlendTool to GimpToolLine 2017-06-26 21:48:43 +02:00
Michael Natterer 068f850c03 app: dispatch to the right vfunc in gimp_tool_widget_hover_modifier()
it was copy-paste dispatching to motion_modifier().
2017-06-26 21:39:51 +02: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 1ebf905ed3 app: change gimp_tool_widget_add_corner() to take x, y, width, height
instead of x1, y1, x2, y2.
2017-06-26 19:19:16 +02:00
Michael Natterer 00ea73f29a app: add a generic GimpToolWidget::response() signal
and a default key_press() handler that emits CONFIRM, CANCEL and RESET
responses. Remove code with the same purpose from all subclasses.

Change tools feed key_press() to the widget and connect to its
"response" instead of implementing key_press() themselves. This will
only be better and less code after the tool side of this is done
generically.
2017-06-25 23:23:27 +02:00
Michael Natterer d27359cca2 app: add gimp_tool_widget_add_rectangle(), _rectangle_guides(), _corner() 2017-06-25 21:07:24 +02:00
Michael Natterer 84e1f757ce app: store the snap offsets in GimpToolWidget
Rename gimp_tool_widget_snap_offsets() to set_snap_offsets(),
and add gimp_tool_widget_get_snap_offsets().

Also rename gimp_tool_widget_status() to set_status(), and
add new function and signal set_status_coords().
2017-06-24 21:09:18 +02:00
Michael Natterer d089aa629b app: rename enum GimpRectangleToolFixedRule to GimpRectangleFixedRule 2017-06-24 19:48:09 +02:00
Michael Natterer 6e2e8a6f08 app: move the rectangle tool enums from tools-enums to display-enums 2017-06-24 19:48:09 +02:00
Michael Natterer 9c3a2b5021 app: add gimp_canvas_corner_set() which sets everything except the anchor 2017-06-24 19:48:09 +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 9e2a3c7aee app: add gimp_tool_widget_add_polygon() and add_polygon_from_coords() 2017-06-23 01:44:56 +02:00
Michael Natterer 9d8f94375e app: add gimp_canvas_polygon_set_points()
and allow NULL points in both this function and new().
2017-06-23 01:40:35 +02:00
Michael Natterer 3ab92c7290 app: add GimpToolWidget subclass GimpToolPath, a complete vectors editor 2017-06-21 23:27:20 +02:00
Michael Natterer c4d5693903 app: add various handle and vectors hit tests to gimpcanvasitems-utils.[ch]
1:1 copies of the same functions in gimpdrawtool.[ch].
2017-06-21 23:21:26 +02:00
Michael Natterer 1aca558867 app: forgot to #include "gimptoolpath.h" in gimptoolwidget.c 2017-06-21 02:16:11 +02:00
Michael Natterer 82e2fa2e5e app: add gimp_tool_widget_add_path(), not used yet 2017-06-21 00:32:14 +02:00
Michael Natterer 91deb61475 app: add virtual functions GimpToolWidget::key_press() and ::key_release()
and api to call them. Not used anywhere yet.
2017-06-20 23:01:18 +02:00
Michael Natterer d2bfbfb748 app: some more cleanup in GimpToolLine
it was already working perfectly, but it's so simple I'd like to make
it "perfect" as a GimpToolWidget implementation example.
2017-06-20 19:07:24 +02:00
Michael Natterer 625ec4b773 app: add utility function gimp_canvas_handle_calc_size()
which is the code that calculates handle size based on pointer
proximity. Use the new function in GimpToolHandleGrid and
GimpToolLine, and clean up some stuff in GimpToolLine.
2017-06-20 01:02:23 +02:00
Michael Natterer 6560e3895b app: clear GimpToolTransformGrid's status when we leave proximity 2017-06-20 00:23:25 +02:00
Michael Natterer 77d516b588 app: another copy/paste error broke moving in GimpToolHandleGrid 2017-06-19 23:45:35 +02:00
Michael Natterer 055ca325f2 app: manage the preview opacity with an object binding too 2017-06-19 23:39:37 +02:00
Michael Natterer 0411801765 app: manage the transform tools' grid properties in GimpTransformTool
Simply use g_object_bind_property() to connect the grid properties of
GimpTransformOoptions and GimpToolTransformGrid and remove all other
grid property setting code.
2017-06-19 23:06:39 +02:00
Michael Natterer 96da8c1505 app: add status message to the handle transform tool
and fix a few glitches from tool widget porting.
2017-06-19 22:53:30 +02:00
Michael Natterer 546bbe1e14 app: add a transform matrix to GimpCanvasPolygon and all API using it 2017-06-19 21:53:49 +02:00
Michael Natterer 3ddfd107b9 app: add some newlines in gimpcanvasboundary.c 2017-06-19 21:53:20 +02:00
Michael Natterer b1dddcdc8f app: add #defines of standard handle sizes to gimpcanvashandle.h
The same values as in gimpdrawtool.h, tool widgets in display/ must
not include the draw tool header from tools/.
2017-06-19 10:46:05 +02:00
Michael Natterer 3b21c08b41 app: add proximity-sensitive handles to the handle transform tool
as known from the blend tool.
2017-06-19 08:02:12 +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 44d33bfd3b app: change return value of GimpToolWidget::button_press() from gboolean to gint
so widgets can return which handle was clicked. The values boolean
semantics stay the same so if(retval) gives the same result. This is
useful for the upcoming transform tool widgets.
2017-06-16 20:55:02 +02:00
Michael Natterer 1bc52dad71 app: return FALSE from gimp_canvas_item_hit() when the item is invisible 2017-06-14 00:16:09 +02:00
Michael Natterer 013bb4d81f app: add signal GimpToolWidget::snap_offsets() and API to emit it
so widgets can notify their handling tool of snap offsets.
2017-06-14 00:16:09 +02:00
Michael Natterer 495f90e6e2 app: allow to set an angle on a GimpCanvasHandle in GIMP_HANDLE_CROSS mode 2017-06-14 00:16:09 +02:00
Michael Natterer ad660a3c88 app: add gimp_tool_widget_add_transform_guides() 2017-06-14 00:16:09 +02:00
Michael Natterer 7082fc8b9e app: add x1,y1,x2,y2 parameters to gimp_canvas_transform_guides_set() 2017-06-14 00:16:09 +02:00
Ell b737463a3b app: fix event reordering during motion compression
... due to commit 5543a9da4f
2017-06-11 18:54:29 -04: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 e05ba83453 app: add signal GimpToolWidget::status() and API to emit it
for subclasses to set status messages.
2017-06-11 23:18:47 +02:00
Ell 5543a9da4f app: compress tool motion evnets more conservatively
When compressing tool motion events, only compress motion events
at the front of the event queue, targeted at the same widget as,
and having similar characteristics to, the initial motion event;
stop compressing upon the first mismatched event.

Previously, all pending motion events targeted at the canvas were
compressed, stopping only at a button-release event targeted at the
canvas.  As a result, when adding a guide by dragging from a ruler,
there could be a situation where a pending button-release event
targeted at the ruler would be followed by motion events targeted at
the canvas, with a cleared state mask.  These motion events would
get compressed to the initial motion event targeted at the ruler,
resulting in a motion event with a cleared state mask being processed
before the said button-release event.  This, in turn, would cause the
guide tool's cursor_update function to be called, while the tool is
still active, emitting a CRITICAL.  Sheesh.

The moral of the story is: let's play it safe.
2017-06-11 15:08:19 -04:00
Michael Natterer 3c5d7075c1 app: add gimp_canvas_handle_set_size() and use it in GimpToolLine 2017-06-11 18:46:30 +02:00
Michael Natterer b92d98857c app: add gimp_tool_widget_get_shell(), and implement get_property("item")
forgot the latter in the initial version.
2017-06-11 18:26:37 +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
Michael Natterer d6587795c3 app: properly remove the children when a GimpCanvasGroup gets destroyed
Call gimp_canvas_group_remove_item() and don't just unref them, so
their state gets restored and signals get disconnected. They may not
be owned by the group, or have other external references.
2017-06-10 22:08:09 +02:00
Michael Natterer 2e209ac440 app: keep GimpCanvasItem from emitting "update" during destruction
Simply increase its change_count in dispose(). There is really no
reason to build expensive update regions and emitting signals when we
are about to go away.
2017-06-10 22:00:38 +02:00
Michael Natterer a4d2acac38 app: add gimp_canvas_item_transform_distance() and transform_distance_square()
to allow items to measure distances, exactly like the identical
GimpDrawTool API.
2017-06-10 21:55:40 +02:00
Michael Natterer 53a84bc6ea app: move enums GimpButtonPressType and GimpButtonReleaseType
from tools-enums.h to display-enums.h, will need them there soon.
2017-06-10 12:25:16 +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
Michael Natterer 8f2471b112 Bug 772667 - instant freeze on rotate
Limit the number of lines drawn in the transform tool canvas grid to
one line every 5 image pixels. This should probably be done in display
pixels, didn't change that yet.
2017-05-14 22:28:51 +02:00
Michael Natterer 465eba3260 app: factor out button-2-motion handling code in GimpDisplayShell
less code in the huge gimp_display_shell_canvas_tool_events().
Also fix the rotating cursor in gimp_display_shell_start_scrolling().
2017-05-11 21:31:41 +02: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
Jehan 8c814a24d3 app: use gimp_unit_get_scaled_digits() in the Pointer Information dock.
gimp_unit_get_digits() won't return relevant information when using
higher resolution. gimp_unit_get_scaled_digits() will provide the right
amount of details relatively to the actual print resolution of the
active image.
2017-05-06 22:57:43 +02:00
Thomas Manni 3c7a54829d app: call the active vectors handler at the end of gimp_display_shell_connect
This enables correct display of the active path (in red color instead of blue)
when xcf files containing paths are opened.
2017-05-02 18:24:51 +02:00
Michael Natterer 4f5bd08b9e app: remove unused includes from gimpdisplayshell-dnd.c 2017-05-01 19:09:00 +02:00
Michael Natterer 536cc8531a app: keep the src image's resolution and unit in copied/cut GimpBuffers
and use them for the new image in "Paste as new image". We were using
the resolution and unit of the image the paste command was invoked
from, which is entirely random and useless.
2017-05-01 18:39:13 +02:00
Ell c97209ba4a app: fix abbreviated commit hashes
The abbreviated commit hash we show in the shell and the about
dialog is currently just the last 7 characters of 'git describe',
based on the assumption that abbreviated hashes are always 7-digits
long.  When the hash is longer than that, we're just showing a
nonsense commit.

This was never a good idea, since users can override this, and
since disambiguation can result in longer hashes, but since git
2.11, the default abbreviated hash length is determined based on
the size of the repository, which currently results in 10 digits
for us.

Let's just do it right.
2017-03-21 23:05:42 -04:00
Michael Natterer 157d70e396 Bug 768066 - Color picker tool should indicate pick position
Add optional coordinate display to GimpColorFrame, and enable it for
the color picker tool and the sample point dockable.
2017-03-11 00:01:01 +01:00
Michael Natterer dda54c1df8 Deprecate stock items for good and change all icon defines to GIMP_ICON_*
Try to sort all GIMP_ICON_* defines into FDO categories like in
https://specifications.freedesktop.org/icon-naming-spec/latest/ar01s04.html

Add defines for all icons we override, rename some icons to their FDO
standard names, and mark the ones we duplicate with a comment so we
don't forget to rename those to standard names in 3.0.
2017-03-05 16:01:59 +01:00
Ell d545b460d9 app: defer image menu updates to an idle function
In DEs which use a global menu, such as Unity, updating the menu
can be expensive.  This particularly affects canvas scaling and
rotation, for which updating the menu synchronously causes notable
lag.
2017-03-01 03:53:18 -05:00
Michael Natterer 3cf423f0cd *: rename NORMAL to NORMAL_LEGACY and NORMAL_LINEAR to NORMAL
and make NORMAL_LEGACY immutable.
2017-02-26 16:26:34 +01:00
Ell c11c955ef5 app: fix comment typo in previous commit 2017-02-23 05:39:46 -05:00
Ell 4c5f6a8e5b Bug 778966 - severe input lag with ruler and one window mode ...
.. due to gdk_pixbuf_scale() with themes using the pixbuf engine

Make GimpDisplayShell a subclass of GtkEventBox, so that it gets its
own window, isolating its events from those of its ancestors.

In particular, the "expose" event handler of GtkNotebook, which the
shell is a child of in SWM, is particularly slow with themes that
use the pixbuf engine.  If the notebook and the shell use the same
window, this can cause notable, and somtimes severe, lag when the
rulers or scrollbars are updated frequently, such as when rapidly
moving the cursor.
2017-02-22 18:46:10 -05:00
Ell f34ef2ab35 app: annhilate <math.h> from the face of last commit 2017-02-19 18:48:18 -05:00
Ell 1572bccc9f app: add support for subpixel image grids
In particular, this enables grids whose points of intersection
are at the middle of the image's pixels, which is useful for
undistorted painting with odd-sized brushes using tools other than
the pencil.

This commit also changes the grid visibility behavior, so that the
the visibiltiy of horizontal and vertical grid lines (depending on
the zoom level) is independent.
2017-02-19 18:13:41 -05:00
Michael Natterer 7da7bab09c app: get rid of icons in dialog buttons (use labels not stock IDs)
Nobody has them anymore, and they are deprecated in GTK+ 3.x. This
also fixes all conflicting mnemonics except those I missed, but we can
fix them now.
2017-02-12 16:18:54 +01:00
Jehan f44fb1ece4 app: more gimp_unit_get_scaled_digits() usage.
The print size displayed in image property and title format should use
gimp_unit_get_scaled_digits() instead of gimp_unit_get_digits() and
adding 1, which is quite random or magic number-y.
2017-01-24 00:28:33 +01:00
Jehan 2762662ca9 app: use gimp_unit_get_accurate_digits() in a few places. 2017-01-23 20:59:28 +01:00
Michael Natterer dba909a9fa Bug 776370 - Changing active layer breaks the GEGL operation dialog
We can't just switch to a GimpOperationTool by using the normal
gimp_context_set_tool() or gimp_context_tool_changed() because it
needs additional initialization like setting an operation at all.

In gimp_gegl_procedure_execute_async(), g_object_set_data() the used
procedure on the newly created tool.

In gimp_display_shell_initialize_tool(), when we re-create the active
tool because of a drawable change, check for the procedure and invoke
it again, instead of simply creating an empty operation tool by
calling gimp_context_tool_changed().
2017-01-23 00:05:18 +01:00
Jehan f836892314 Bug 763734 - better decimal places for physical units.
Compute the ideal decimal precision for cursor position and length
status so that you get the best precision on physical units depending
on the current resolution, yet avoiding over-precision (which can be
misleading). The unit's "digits" value is now used as a minimum
precision only.
2017-01-20 00:40:27 +01:00
Michael Natterer 66060e3307 app, libgimp*, plug-ins: replace enum GimpLayerModeEffects by GimpLayerMode
with proper value names. Mark most values as _BROKEN because they use
weird alpha compositing that has to die. Move GimpLayerModeEffects to
libgimpbase, deprecate it, and set it as compat enum for GimpLayerMode.
Add the GimpLayerModeEffects values as compat constants to script-fu
and pygimp.
2017-01-08 23:00:19 +01:00
Michael Natterer 237d83dc7f Bug 773462 - Color Picker should support range...
...regardless of image color precision

Split enum value GIMP_COLOR_FRAME_MODE_RGB into RGB_PERCENT and RGB_U8,
which display the current % values, and values in a range of 0..255.
2017-01-03 01:20:30 +01:00
Jehan 3fa016fb4b app: clean out tab indentations. 2016-12-21 04:05:32 +01:00
Michael Natterer 2e63533602 app: add GimpDockContainer::get_dialog_factory()
and use it where possible instead of gimp_dialog_factory_get_singleton().
Also reduce using this function in some other places.
2016-11-25 13:26:08 +01:00
Michael Natterer a3c65e6d17 app: get rid of including menus/ stuff from widgets/ and other places
Add GimpMenuFactory can always be found in a GimpDialogManager, use
gimp_dialog_factory_get_menu_factory() where we have a dialog factory
instead of accessing "global_menu_factory" or redundantly passing a
menu factory around where we already pass around a dialog factory.
2016-11-23 19:38:44 +01:00