Commit Graph

98 Commits

Author SHA1 Message Date
Michael Natterer 1b7d63cce9 Use g_set_object() in a lot of places, and splrinkle some g_clear_object() 2018-06-01 12:59:52 +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
Ell e029795dfb app: add gimp_widget_blink(); use instead of gimp_dockable_blink()
gimp_dockable_blink() is used to attract the user's attention to a
specific dockable.  Generalize this to arbitrary widgets, by
replacing gimp_dockable_blink[_cancel]() with
gimp_widget_blink[_cancel](), in gimpwidgets-utils.c.
2017-10-28 10:07:10 -04:00
Michael Natterer 6f2948fe54 app: don't let GimpColorTool change displays when GimpDrawTool has a widget
because widgets are bound to one GimpDisplayShell. Also, chain up
unconditionally in gimp_color_tool_draw(), we always want to draw the
widget even while picking colors.
2017-07-01 16:26:34 +02:00
Michael Natterer bcb6b77bde app: change GimpColorTool to not touch tool->display and tool->drawable
Instead, pass a GimpDisplay around in all virtual functions and use
that instead. Some preparation for more fancy subclasses using
GimpToolWidgets.
2017-06-30 21:23:29 +02:00
Michael Natterer 523b73ff04 app: move guide and sample point picking to gimpimage-pick-item.[ch]
They are not actually items, but close enough.
2017-06-22 09:43:50 +02:00
Ell bfadac145b app: add GimpColorTool::can_pick() virtual function
Determines if the tool can pick at a given coordinate, without
actually picking.  The default implementation uses
gimp_image_coords_in_active_pickable(); GimpFilterTool overrides
this function, to return TRUE whenever the active picker has
pick_abyss == TRUE.

Use this function when updating the cursor, and when determining
whether to draw the sample-average region indicator.
2017-05-03 13:38:50 -04:00
Michael Natterer 3d986425b2 Bug 768058 - Color picker tool should be able to ignore snapping
Don't snap to anything when picking colors.
2017-01-01 17:59:26 +01:00
Michael Natterer adad7c651c Bug 167203 - color picker tools should always draw outline
Move the entire drawing control logic to gimp_color_tool_oper_update()
which gets invoked on hovering, and don't mess with it in
button_press() and button_release(). Tested to work with the color
picker, paint and filter tools.
2017-01-01 17:35:57 +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 7889ec08f7 Bug 668016 - Accidentally clicking ruler loses active tool's state
Add two new tools, GimpGuideTool and GimpSamplePointTool. They are
one-trick-ponies and can only create new or move existing guides and
sample points. They can't be selected from the toolbox, only
temporarily pushed as active tools on top of any active tool using
their public start() APIs.

Use that API to enable them when the rulers are clicked, and replace
the entire guide and sample point moving code in GimpMoveTool and
GimpColorTool by simple calls to that API.

This might look like overkill but can easily be used for other
features like moving guides from within the paint tools (mirror
painting) or gegl filters (preview curtain).
2016-04-03 16:41:42 +02:00
Michael Natterer 2a43ab240b app: don't access GimpSamplePoint members directly
Use the new accessors instead. Clean up guide and sample point code in
image crop and resize a bit.
2016-01-04 22:06:27 +01:00
Michael Natterer 8c80ee14ff Bug 748749 - picked colors don't match image colors...
...when a color profile is active

This commit doesn't fix anything, but it prepares the code to do the
right thing:

It passes the actual raw image pixels through the entire color picking
mechanism to the widgets which display colors, particularly
GimpColorFrame.

This is needed for GimpColorFrame's "Pixel" mode (as opposed to its
RGB, HSV etc. modes) which is supposed to show the raw pixel values
from the image.

Before this commit, it was recreating the raw pixel values from the
GimpRGB value it knows, which will become impossible when we correctly
pick color managed GimpRGB values soon.
2015-08-25 00:05:59 +02:00
Michael Natterer 3a6962e0bd app: some cosmetic code cleanup in the color picker tools 2014-12-01 13:49:40 +01:00
Michael Natterer bebdcbe0bf app: change enum GimpColorPickState to { START, UPDATE, END }
It used to be { NEW, UPDATE } but that didn't allow to distinguish the
final END update, which we will soon need for automatic color history
updating. Make sure all places that handle motion events on colors
(pick from canvas, gradient editor) correctly send and handle END
events.
2014-11-28 12:00:53 +01:00
Michael Natterer 843866e7e7 app: make things behave more reasonable with multiple monitors
There is now a preference option that determines whether windows
should be opened on the same monitor as before. It should be disabled
when the machine gets monitors plugged/unplugged dynamically ("laptop")
and enabled when there is a static multi-monitor setup ("wokstation").
This is merely the current simplistic policy on top of the newly added
underlying infrastructure:

- pass integer monitor numbers around in all places where we already
  pass around a GdkScreen. Pass the "current" monitor to these changed
  APIs, where "current" is either the monitor where the action-triggering
  widget is, or if that is unavailable the monitor where the mouse is.

- add gimp_widget_get_monitor() in order to easily get to the monitor,
  just like gtk_widget_get_screen().

- add screen and monitor parameters in some places that were missed
  before.

- in sessionrc, save all window positions relative to the window's
  monitor, and save the monitor separately, if it's not the screen's
  primary monitor.

- when restoring window positions, use the stored monitor when the new
  prefs options says so (use the screen's primary monitor if there is
  no stored monitor), otherwise use current monitor that is now passed
  around.
2014-05-02 03:01:23 +02:00
Michael Natterer 0bdb74710a app: rename the value-1...value-4 actions to opacity, size, aspect, angle 2014-04-19 20:09:39 +02:00
Michael Natterer 83dffbc03e app: fix signature of GimpColorTool's "picked" signal 2013-05-30 22:34:55 +02:00
Michael Natterer b8558f8859 app: add coordinates to GimpColorTool's and GimpImageMapTool's "picked"
signals and vfuncs. This is currently unused, but GEGL operations
can soon pick coordinates just like they can pick colors.
2013-05-30 19:29:36 +02:00
Michael Natterer 62c5a737fd app: fix conditions for guide and sample point moving/removing
Simply check the transfomred coords against the canvas extents and the
untransformed against the image contents instead of using
untransform_viewport(). The code is easier to read now, and
untransform_viewport() is still broken and can't really be implemented
properly when the canvas is rotated.
2013-04-25 09:30:46 +02:00
Michael Natterer ca6323f382 app: fix signal signature of GimpColorTool::picked()
A Babl format is not of GIMP_TYPE_IMAGE_TYPE, this would have horribly
crashed on 64bit, I guess...
2012-05-02 17:51:02 +02:00
Michael Natterer 36e982e2ed app: port gimp_image_pick_color() to return a Babl format
instead of a GimpImageType.
2012-05-02 17:50:39 +02:00
Michael Natterer 0a68527edc app: move the GimpWindowStrategy interface from display/ to widgets/ 2012-01-30 23:33:21 +01:00
Michael Natterer 325bce54a7 app: port dockable showing to using GimpWindowStrategy API
so it works right in SWM. Fixed actions/, tools/, and app/ for now.
2012-01-30 23:24:44 +01:00
Martin Nordholts 64d2dc122a app: Add and use gimp_dialog_factory_find_widget() 2012-01-10 19:47:52 +01:00
Michael Natterer 7d39d800fc app: GimpColorTool and GimpMoveTool: don't start the draw tool twice
and some minor coding style cleanup.
2011-04-04 19:20:04 +02:00
Michael Natterer 036c5aff73 app: constify "color" parameter in GimpColorTool::picked() 2011-04-04 00:08:57 +02:00
Michael Natterer ea34b145e8 app: some random tool cleanup 2011-04-04 00:01:30 +02:00
Michael Natterer 545e65dda6 app: add gimp_display_shell_selection_pause() and _resume()
and use them instead of gimp_display_shell_selection_control() with
the resp. enum values. Remove the GIMP_SELECTION_PAUSE and _RESUME
enums values and thus the presence of this concept in the core.
2010-10-09 14:26:33 +02:00
Sven Neumann 8587e1e920 app/tools: introduce gimp_draw_tool_add_crosshair()
gimp_draw_tool_add_crosshair() is a convenience function that
adds two intersecting guide lines in a stroke group.
2010-10-04 22:02:12 +02:00
Sven Neumann 5a3dc38af0 app/tools: draw two guides for the moving sample point
Instead of drawing two lines cropped at image borders, use two guides
that extend all across the canvas and also put them into a stroke group.

Also apply a similar fix as in the move tool and don't use -1 but
G_MININT as the invalid sample point position.
2010-10-04 21:40:52 +02:00
Michael Natterer d88a348c18 app: add public API for the "guide-style" and "sample-point-style" properties
of the guide and sample point canvas items. They are too obscure to
additionally hide them, and these items are used rarely enough to
justify the additional parameter to the new() functions.
2010-10-03 22:14:40 +02:00
Michael Natterer 2ced18cc87 app: add gimp_draw_tool_add_sample_point()
and use it in the color tool. Also rename
gimp_draw_tool_add_guide_line() to gimp_draw_tool_add_guide().
2010-09-30 02:03:16 +02:00
Michael Natterer f5750647c1 app: use a GimpCanvasSamplePoint to draw the hovered sample point 2010-09-30 01:32:34 +02:00
Michael Natterer b3af235e79 app: rename all gimp_draw_tool_draw_foo() functions
to gimp_draw_tool_add_foo() because that's what they do now.
2010-09-25 19:02:22 +02:00
Michael Natterer ddc63de6d6 app: remove "gboolean use_offsets" from gimpdisplayshell-transform.[ch] 2010-09-23 19:24:04 +02:00
Michael Natterer 4d0c750327 app: get rid of "gboolean use_offsets" in the draw tool
and always pass image coordinates. Transform the coords manually in
the very few places which passed TRUE.
2010-09-23 19:23:27 +02:00
Michael Natterer 517e77b707 app: keep GimpColorTool->center_x and _y around in image coords 2010-09-23 01:04:22 +02:00
Michael Natterer 1d1ff1fedd app: port GimpDisplayShell sample point drawing to cairo
Same disclaimer about tool uglyness applies here. Will be fixed.
2010-08-12 13:13:15 +02:00
Michael Natterer 02b8eea086 app: restrict sample point drawing to the exposed region
With the same limitation as for guides in the last commit.
2010-05-02 15:58:51 +02:00
Martin Nordholts 11b1300b6f app: Introduce gimp_dialog_factory_get_singleton()
Instead of including dialogs/dialogs.h everywhere, introduce
gimp_dialog_factory_get_singleton(). The dialog factory singleton is
still initialized by dialogs.c though.

Right now the assumption is that we never will have another dialog
factory instance around. There were so many problems before when we
had four of them, so let's just keep one of them around.
2010-02-28 23:23:24 +01:00
Martin Nordholts 947e28596f app: Remove gimp_dialog_factory_from_name()
We only have one dialog factory now, and
gimp_dialog_factory_from_name() doesn't provide compile-time type
safety, so use global_dialog_factory directly instead.
2010-02-28 20:02:45 +01:00
Martin Nordholts 8b458fb591 app: Merge "toplevel" and "dock" dialog factories
Merge "toplevel" and "dock" dialog factories. The end goal is to have
only one dialog factory.
2010-02-20 09:28:26 +01:00
Michael Natterer 08f35de4ac Use gimp_display_get_image() instead of display->image 2009-10-07 19:00:42 +02:00
Michael Natterer d1ded0617f More gimp_display_get_shell() instead of display->shell 2009-10-05 19:58:03 +02:00
Michael Natterer 8ba18309eb Use display->gimp intead of display->image->gimp 2009-10-04 20:05:28 +02:00
Michael Natterer ac98c2c234 Use gimp_display_get_shell() instead of directly accessing it 2009-10-04 19:56:39 +02:00
Martin Nordholts 8bfcd14f9a app: Add GimpSessionInfo getters and setters 2009-09-20 14:51:03 +02:00
Michael Natterer 1a16b48c93 Add infrastructure for sending double and triple clicks to tools
* app/tools/tools-enums.[ch]: add enum GimpButtonPressType which can
be { NORMAL, DOUBLE, TRIPLE }

* app/tools/gimptool.[ch]: add press_type paramater to GimpTool::button_press()

* app/tools/gimp*tool.c
* app/tools/tool_manager.[ch]: changed accordingly.

* app/tools/gimptoolcontrol.[ch]: add members and API so tools can choose
to receive double and triple clicks.

* app/display/gimpdisplayshell-callbacks.c (gimp_display_shell_tool_events):
dispatch double and triple clicks to tools if they want them, and if they
became active by the preceding normal button press.
2009-06-20 17:37:31 +02:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00