Commit Graph

50 Commits

Author SHA1 Message Date
Ell 8738d2f22b app: add a gyroscope controller to prop-gui
Add a gyroscope controller, providing a prop-gui interface to
GimpToolGyroscope.

Implement the gyroscope controller in GimpFilterTool.
2018-04-10 10:18:48 -04:00
Michael Natterer 9090a98498 app: fix new g_object_ref() warnings in gimp_filter_tool_edit_as()
g_object_ref() now returns the same type that was passed in. Cast the
argument to GObject* to match the variable the return value is
assigned to.
2018-04-01 14:55:11 +02:00
Ell cada28e91e app: reset GimpFilterTool widget when resetting settings
Add a gimp_filter_tool_reset_widget() function, which resets the
tool widget associated with the filter's controller -- i.e., it
resets those properties of the widget that aren't controlled by the
op's properties to some "default" state.  For most controller types
this is a NOP; for transform-grid controllers, we move the pivot
back to the center of the drawable, w.r.t. the current transform.

Call gimp_filter_tool_reset_widget() after resetting or reloading
the tool's config.
2018-03-18 14:35:11 -04: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
Michael Natterer 82fde3e6c4 app: remove the split preview guide in gimp_filter_tool_get_operation()
so when switching ops in the GEGL tool, the new one doesn't show a
guide that does nothing until one toggles "Split view" twice.
2018-01-05 14:13:12 +01: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
Michael Natterer bb93e3401f Bug 785427 - GIMP crashes after applying any GEGL filter
Need to access GimpSettings' "time" property using gint64 variables
now.
2017-07-27 22:20:09 +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 44d7a26613 app: remove GimpFilterTool's "drawable" member
and use GimpTool's drawable. I guess at some point tool->drawable was
somewhat unpredictable, this is not the case any longer.
2017-07-10 23:28:49 +02:00
Michael Natterer 4f7fff8cb8 app: change some gimp-operation-config.[ch] parameters to GObject
They were GimpObject for no reason, also inconsistent with other
places where we deal with config objects.
2017-07-09 19:20:55 +02:00
Michael Natterer 29795a29eb app: remove all "has_settings" stuff from the GimpFilterTool API
Instead, use gimp_operation_config_list_properties() to figure if an
operation has editable properties directly in
gimp_filter_tool_get_operation().
2017-07-09 18:59:54 +02:00
Michael Natterer ef294f4a54 app: clean up how tools are COMMITed and HALTed
Call HALT generically in gimp_tool_control() after calling COMMIT, and
remove all hacks in tools that call both COMMIT and HALT or call
halt() from commit().

Some tools interact with their subclasses (e.g. filter tool and
operation tool), and it's essential that COMMIT runs through the
entire class hierarchy before HALT.

Probably breaks something, please test.
2017-07-09 16:25:42 +02:00
Michael Natterer 84269cc608 app: move the add_controller() callback to GimpFilterTool
Why I added it to GimpOperationTool first, I have no idea...
2017-07-05 20:33:11 +02:00
Michael Natterer c682c5466c app: add an optional "label" to GimpTool which overrides GimpToolInfo's
Remove GimpFilterTool's "title" and use the GimpTool's "label" instead.
2017-07-04 22:31:17 +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
Michael Natterer 1f42d65e21 app: remove undo_desc, icon_name, help_id stuff from GimpFilterTool
and its subclasses. Simply use the new GimpTool APIs now.
2017-07-04 20:43:28 +02:00
Michael Natterer 89d611f291 app: GimpFilterTool: remove members "import_dialog_title"...
...and "export_dialog_title"

It's ridiculous to keep this code around for strings that are only
marginally different (and not better) than the strings we can generate
from other strings we have anyway.
2017-07-04 20:43:28 +02:00
Michael Natterer a2c331011d app: add new function gimp_filter_tool_get_drawable_area()
which return's the used drawable's offsets and a GeglRectangle
where the filter is applied according to GimpFilterOptions::region
(either the selection or the whole drawable).
2017-07-03 00:45:59 +02:00
Michael Natterer 00a9659c28 app: add virtual function GimpFilterTool::config_notify()
and call it from GimpFilterTool's "notify" callback. Remove signal
connections from all subblasses and instead implement ::config_notify().

The config object belongs to GimpFilterTool, and only GimpFilterTool
should know when it's created and can be connected to.
2017-07-03 00:45:59 +02:00
Michael Natterer 9e55fb8ecf app: call gimp_filter_tool_get_operation() in initialize() not constructed()
so things from the tool's previous use get destroyed, including their
(maybe dangling) signal connections. Also shut down more stuff in
halt(), including destroying not just hiding the GUI.
2017-07-03 00:45:59 +02:00
Michael Natterer 3d08a52e1f app: add an optional GimpToolWidget to GimpFilterTool
The widget is fed events by GimpFilterTool, the actual interaction
with the filters operation and config will be done by subclasses.

The order of precedence when there are multiple possible canvas
interactions is: moving the split preview guide, color picking,
widget.
2017-07-01 16:24:01 +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 4f4d6b27cf app: register the "settings folder" (e.g. GIMPDIR/curves) with the settings type
and remove all settings_folder API and values from GimpFilterTool and
its subclasses.
2017-06-05 22:00:17 +02:00
Ell a5b03ddf2e app: add gimp_filter_tool_{enable,disable}_color_picking()
Subclasses of GimpFilterTool should use these functions to control
picking, instead of using gimp_color_tool_{enable,disable}()
directly.  This makes sure that the tool's picking state is
consistent, and allows the caller to control the pick identifier,
and use abyss picking (not currently needed by any subclass, but
maybe in the future, who knows.)
2017-05-30 17:40:42 -04:00
Michael Natterer 90698524d9 app: change gimp_operation_config_new() to _get_type()
Return only the config object's GType and do the g_object_new() in the
caller (one caller only needs the type, there is no need to create a
dummy object just to get to its type).
2017-05-29 08:04:52 +02:00
Ell bd5ec4613b app: improve GimpFilterTool::can_pick()
Make sure the drawable we're about to pick from is actually the
filter tool's drawable.
2017-05-03 14:50:50 -04: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
Ell bc4589968c app: in prop gui & co., allow picking outside drawable bounds
Add a boolean 'pick_abyss' parameter to GimpCreatePickerFunc.  When
this parameter is TRUE, the picker should pick outside the bounds
of the drawable.  Use FALSE for color pickers, and TRUE for position
pickers.
2017-05-03 11:03:36 -04:00
Michael Natterer 4455cd984d Bug 779620 - "Advanced Color Options" in filter dialogs is confusing
Hide "Advanced Color Options" by default, and add a toggle to show
them to prefs -> color management.
2017-05-01 02:09:27 +02:00
Elle Stone c940b5d376 Bug 779620 - "Advanced Color Options" in filter dialogs is confusing
Change wording in Advanced Color Options drop-down menu to not imply
that GIMP isn't color-managed.

Slightly changed wording from Elle's original patch (mitch).

Also set the combo box' "ellipsize" property to END because it's too
wide. As mentioned before, this doesn't work for whatever reason,
hints are appreciated :)
2017-05-01 00:45:36 +02:00
Michael Natterer 530b62a53e app: s/imagemap/drawablefilter/ in some comments 2017-04-30 21:15:26 +02:00
Michael Natterer 3c0cffe53d app: add GimpFilterTool::set_config()
and use it to set saved settings on the tool. In GimpOperationTool's
implementation, re-sync the config's output-extent properties with the
drawable.
2017-03-30 23:21:46 +02:00
Michael Natterer da70cc7446 app: make GimpFilterTool always have a container of recent settings
and a GimpSettingsBox. This brings savable settings to all ops, also
the automatic ones in the GEGL tool. It also makes the code cleaner
and more general.
2017-03-28 23:58:52 +02:00
Michael Natterer 8352f356ee app: remove some overengineering from GimpFilterTool
GimpFilterTool::get_settings_ui() is no longer needed, replace
it by a simple utility function in gimpfiltertool-settings.c.

Also, use the GimpFilterOptions functions added earlier, and some
random cleanup.
2017-03-25 14:57:15 +01:00
Michael Natterer 3aeebfa178 app: remove all class variables from GimpFilterToolClass
and add them as return values to GimpFilterToool::get_operation(), so
the tools is configured entirely per-instance now.

This makes get_operations()'s signature more evil, but helps making
GimpOperationTool less conplicated and convoluted.
2017-03-25 11:32:17 +01:00
Michael Natterer ee6c7ec7b7 Bug 780015 - Filter settings are not properly restored after Gimp restart
Filters settings used to be serialized and deserialized only
when a filter tool's GUI was shown, too late for the code that
re-runs/re-shows filters with previous values.

Move the entire loading/saving code to gimp-operation-config.c, even
adding/removing the dummy separator item between timestamped automatic
history and manually saved settings. Load the settings automatically
when a settings container is requested, but still trigger saving from
the few places the container is changed in the GUI; could also
automate that later.

This commit also moves all settings of filters that have their own
tools from gimpdir/tool-options/ to gimpdir/filters/. Add compat code
to try the old filename if the new doesn't exist, so files are
migrated automatically.

WIP, but this step already fixes the bug.
2017-03-24 01:29:50 +01:00
Michael Natterer 93787cd049 app: completely set up the filter in gimp_filter_tool_create_filter()
which got renamed from create_map() in this commit too. "Completely"
means including insane options like color_managed and gamma_hack, they
are confusing enough so they should at least work correctly.
2017-02-22 23:59:10 +01: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
Michael Natterer 891f85e805 app: move gimp-gegl-config.[ch] to operations/
and rename it to gimp-operation-config.[ch].
2017-02-05 20:17:31 +01:00
Thomas Manni 0d4dd11e2a Bug 777880 - better handling of sensitivity functions for channel combobox on threshold, levels and curves tools
- set the filter_tool->drawable before showing the tool gui.
- set the sensitivity functions for channel combobox of threshold,
  levels and curves tools dialogs only once during dialog creations.
- use the filter_tool->drawable inside the sensitivity functions
2017-01-29 14:07:06 +01:00
Jehan 3fa016fb4b app: clean out tab indentations. 2016-12-21 04:05:32 +01:00
Michael Natterer 483c282687 Bug 766988 - Colors applied to images are not color managed
Add color management to GimpDrawableFilter and GimpFilterTool, GEGL
ops applied to drawables can be applied in color managed space
now. Sadly, this is very slow, so disabled by default.

I'm sure the profile guessing based on the operation's format doesn't
always work, but this general bug counts as fixed now.
2016-11-07 15:39:48 +01:00
Michael Natterer 13b1e6aafc app: clean up a lot of werid code in GimpColorOptions and GimpFilterOptions
First of all, derive GimpFilterOptions from GimpColorOptions, not the
other way around, which was a sick way of magically showing the right
options for various tools. That approach has failed and needed
additional hacks to do the right thing. Simply have the right class
hierarchy and call the right tool options GUI constructors and done.

Remove gimp_histogram_options_gui(), we don't need histogram scale
controls in tool options when we already have them next to the
histograms in the tool dialogs.

Also remove gimp_histogram_options_connect_view() and use a simple
g_object_bind_property() instead.
2016-05-13 22:06:14 +02:00
Michael Natterer 9fb70a44f2 app: rename GimpImageMap to GimpDrawableFilter
and gimpdrawable-filter.[ch] to gimpdrawable-filters.[ch] because of
the name clash.
2016-05-12 01:49:53 +02:00
Michael Natterer e7d2edb665 app: connect to the new operation progress in GimpFilterTool 2016-05-11 22:51:58 +02:00
Michael Natterer 9bb03073b6 app: turn the "Gamma Hack" into a non-serializable property
To make it at least behave like other widgets in the dialogs while it
exits.
2016-05-11 14:33:08 +02:00
Michael Natterer 059a92b4b6 app: rename "image_map" member of GimpFilterTool to "filter" 2016-05-11 10:19:50 +02:00
Michael Natterer 3bd783283e app: change the prefs property from image-map-tool-max-recent to filter-tool
but still parse the old property too.
2016-05-11 01:03:40 +02:00
Michael Natterer 67e192e77b app: remove gimp_filter_tool_preview()
Its remaining two callers are more obvious when doing a simple call to
gimp_image_map_apply() manually.
2016-05-10 15:57:49 +02:00
Michael Natterer 6a9ce551cb app: rename GimpImageMapTool to GimpFilterTool 2016-05-10 13:52:24 +02:00