Commit Graph

88 Commits

Author SHA1 Message Date
Jehan 55083baa98 app: also make options_box into a GWeakRef.
While I am at it, let's spread the improvement to options_box which was
also a weak pointer with g_object_add_weak_pointer(). Let's make it
rather a GWeakRef for the same reason as I did options_gui.
2017-10-05 00:11:36 +02:00
Jehan 7be856a47d app: use GWeakRef instead of g_object_add_weak_pointer().
Other than multi-threading (which here is not the problem), using
GWeakRef has the other advantage that it makes the type of pointer
obvious, hence avoiding the kind of errors as fixed in commit 12df796.
One can't just change the pointer value directly, and has to use
g_weak_ref_set(), so such problem won't happen again.
2017-10-04 23:38:24 +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 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 2a75df030e app: rename all GimpOperationTool variables to "op_tool"
Mostly to fix my own confusion, the variable name "tool" is used for
GimpTool everywhere else.
2017-07-09 17:31:25 +02:00
Michael Natterer 0459e301b7 Bug 784716 - Bump Map not working
GimpOperationTool's aux inputs were not properly ported to the new way
filter tools work (complete destruction and re-creation of the tool
dialog).

Split creating the operation GUI and adding it to the dialog into
separate functions, and call them at the right places.
2017-07-09 16:27:46 +02:00
Michael Natterer 787f645c57 app: fiddle less with GimpFilterTool internals in GimpOperationTool
Use gimp_filter_tool_disable_color_picking() in
gimp_operation_tool_set_operation() instead of poking around manually.
2017-07-05 20:54:21 +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 f6c2e807e0 app: don't completely clear a GimpOperationTool when it's halted
Need to keep around the operation's name and its description, so
everything can be re-created when an image is clicked.

Instead, completely shut down GimpOperationTool when GimpGeglTool is
halted, so the next click will bring up a dialog with only the
operation selection combo.
2017-07-05 12:28:40 +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 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 76644b7367 app: add a "status_title" to GimpCreateControllerFunc
so the status bar now says "Spiral:" or "Supernova:" instead of just
"Line:".
2017-07-04 12:51:05 +02: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 fd257971cc app: fix gimp_operation_tool_sync_op() to use the right output extents
Use the new gimp_filter_tool_get_drawable_area() instead of always
using gimp_item_mask_intersect() which is only right when the
operation is applied to the "selection" region. Also call
gimp_operation_tool_sync_op() when the region is changed in the UI.
2017-07-03 02:51:37 +02:00
Michael Natterer f4f2de1b5c app: start an infrastructure for on-canvas controllers for operations
Pass a "GimpCreateControllerFunc" to all gimppropgui-*.[ch]
constructors which takes a callback (to update the config object when
the on-canvas GUI) and a controller type that determines the
callback's signature, and returns another callback (to update the
on-canvas GUI when the config object changes).

In GimpOperationTool, pass such a GimpCreateControllerFunc that
handles creating and adding on-canvas controller via the new
gimpfiltertool-widgets.[ch]. So far, a simple line like in the
blend tool is supported.

Add a custom GUI for gegl:spiral, and have its origin, radius and
angle controlled by such a line.
2017-07-03 00:45:59 +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
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 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 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
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
Michael Natterer a96c273621 app: add smarter soft boundaries for GimpSpinScale widgets
Pass a GeglRectangle to all gimp_prop_gui_*() functions, and set
the soft limits to the rectangle's extents if the GParamSpec
metadata's "unit" is "pixel-coordinate" or "pixel-distance".

In GimpSymmetryEditor, pass the image extents, in GimpOperationTool
pass the drawable extents.
2016-07-06 12:19:40 +02: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 b10fd2aa30 app: use the proper help ID in gimp_operation_tool_get_settings_ui()
GimpFilterTool has the right help ID since a while, no need to
use a dummy help ID aly longer.
2016-05-11 14:38:33 +02:00
Michael Natterer 6a9ce551cb app: rename GimpImageMapTool to GimpFilterTool 2016-05-10 13:52:24 +02:00
Michael Natterer c77357053c app: make gimp_image_map_tool_preview() private
- call it in gimp_image_map_tool_get_operation() so
  gimp_operation_tool_set_operation() doesn't need to call it

- gimp_image_map_tool_settings_import() doesn't need to call it because
  importing settings changes the config object anyway
2016-05-09 01:21:03 +02:00
Michael Natterer c6c458a2eb app: don't call gimp_image_map_tool_preview() in GimpOperationTool
Instead, emit "notify" in the config object, which is a hack,
but a temporary one. If should be the right code tho, if only
Gegl pads would be normal properties...
2016-05-09 01:07:21 +02:00
Michael Natterer 020b524e59 app: add gegl:gegl to Filters -> Generic
Also fix packing of the operation GUI in GimpOperationTool,
so the text box can expand.
2016-04-16 03:18:29 +01:00
Michael Natterer 7529fd987c app: change GEGL op GUI generation so widgets can expand vertically
Currently we only expand scrolled windows, which are used for
multiline text properties' GtkTextViews.
2016-03-26 20:28:24 +01:00
Michael Natterer 041659a2ab app: remove the recent_settings container from GimpImageMapToolClass
and use gimp_gegl_config_get_container() locally where needed. This
also removes some special code from gimpoperationtool.c.
2016-03-19 22:06:13 +01:00
Michael Natterer 3ac3dcde48 app: add a GParamFlags parameter to gimp_prop_gui_new()
If non-0 flags are passed, create widgets only if the GParamSpec flags
have all the passed flags.
2016-02-06 01:04:40 +01:00
Michael Natterer 8c09210d7d app: move stuff from GimpOperationTool to GimpImageMapTool
Add new string members to GimpImageMapTool and use them instead of the
resp. fields of GimpToolInfo. Change ::get_operation() to return the
operation name and a lot of strings for the UI, and create both the
GeglNode and the config object in GimpOperationTool. Lots of various
cleanups in GimpImageMapTool subclasses. This is an intermediate state
on the way of making the whole filter applying mechanism more generic
and less depending on subclasses.
2016-01-22 21:28:33 +01:00
Michael Natterer 39cc3eccd5 app: rename gimp-gegl-config-proxy.[ch] to gimp-gegl-config.[ch]
and rename its functions to make more sense.
2016-01-20 12:18:35 +01:00
Michael Natterer 06a5b2fa3f app: bring dialog titles and help IDs to GEGL filter dialogs
Add "title" and "help_id" parameters and members/properties to
GimpToolDialog, GimpToolGui, GimpOperationTool. Also make the order of
parameters more consistent.
2016-01-17 20:17:07 +01:00
Michael Natterer 6541c6b80b app: add icons to the generated gimp-gegl-config-proxy classes 2016-01-16 22:01:07 +01:00
Michael Natterer 0c784559c8 app: improve the layout of GimpBufferSourceBox
and add a label with the selected pickable's name.
2015-11-30 02:46:22 +01:00
Michael Natterer baae27c786 app: note to self: don't push intermediate commits... 2015-11-29 19:56:32 +01:00
Michael Natterer 6040aa2b97 app: use GimpBufferSourceBox in GimpOperationTool
and support ops with an arbitrary number of aux inputs.
2015-11-29 19:30:58 +01:00
Michael Natterer 22fc50c279 app: rename all values of enum GimpContextPropMask
from GIMP_CONTEXT_FOO_MASK to GIMP_CONTEXT_PROP_MASK_FOO.
Also rename the FIRST and LAST values of enum GimpContextPropType.
2015-09-08 21:18:49 +02:00
Michael Natterer 109d568b46 app: remove GimpOperationTool's "config" member
The same object is kept around by the GimpImageMapTool parent class.
2015-04-10 14:10:19 +02:00
Thomas Manni 960f54360f gimpoperationtool: add support for aux2 input buffer 2014-12-11 08:28:14 +01:00
Michael Natterer b200345a98 app: change GimpImageMapTool::get_settings_ui()'s "default_folder" to GFile 2014-07-29 11:56:49 +02:00
Michael Natterer 9a90bfa26a app: more gimp_directory() -> gimp_directory_file() 2014-07-29 11:56:49 +02:00
Michael Natterer 8c8135a881 app: port GimpImageMapTool's settings API from filename to GFile 2014-07-01 15:13:02 +02:00
Michael Natterer 8aa0019c2e app: clean up inclusion of gegl-plugin.h, mostly removals 2014-06-10 03:13:09 +02:00
Michael Natterer a06d570748 app: rename gimpproptable.[ch] to gimppropgui.[ch] 2014-05-27 02:15:48 +02:00
Michael Natterer bb73acbb15 app: create an empty node with the gegl:nop operation
so we can safely ask for its name (workaround for GEGL warning).
2014-05-24 03:04:26 +02:00