Commit Graph

517 Commits

Author SHA1 Message Date
Lukas Oberhuber 1ee1224d05 app: Add in gimpconsoleapp and gimpcoreapp interface
GimpApp is a GtkApplication
GimpCoreApp is an interface for common functions
GimpConsoleApp is a GApplication (to avoid linking in Gtk)
2022-10-09 16:12:07 +02:00
Niels De Graef 27fe67814e app: initial work on moving to GtkApplication.
Reviewer's message (Jehan): This was a work-in-progress by Niels, which
we only keep in this state because Lukas worked over it. I have rebased
and fix-amended many broken part of this commit, because various things
had been changed in these areas of code since this commit was initially
written.
2022-10-09 16:12:07 +02:00
Oleksii Samorukov 6b5d1a0d46 Fix reference from gimp_param_spec_duplicate to gimp_config_param_spec_duplicate 2020-01-17 11:17:03 +01:00
Jehan 506a0476f4 app: check last GIMP release from gimp.org/gimp_versions.json.
GIMP will now process the remote gimp_versions json file to look if one
is using the last version of GIMP. This initial code doesn't act up yet
on this information. This will come in further commits.

Here are the characteristics:
- Since this requires internet access, a new checkbox is available in
  the Preferences dialog, allowing to disable version checks. Note that
  it is enabled by default as it is an important security feature, but
  it has to be deactivatable.
- The remote access is done as an async operation because we don't want
  it to block the startup in any way (for whatever reason). Also it
  doesn't output errors if it fails to not be a bother (you don't
  technically need internet access for an image program).
- We don't check at every startup. At each successful check, we save a
  timestamp to prevent too frequent useless checks (I set it the timer
  to a week or more for now).
2019-12-13 17:51:44 +01:00
Jehan 5f2a6940e3 app, devel-docs: remove dangling DBUS_GLIB_* variables.
dbus-glib is no more a dependency since commit c4460e84, i.e. already
since 2013!
2019-11-16 19:19:02 +01:00
Michael Natterer 967cbb4fad app: use the GParamSpec's name in gimp_pdb_dump()
and remove gimp_pdb_compat_arg_type_from_gtype(). The core is now free
of PDB legacy code.
2019-08-30 11:43:53 +02:00
Michael Natterer 32ea28b6b1 app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
  information needed for constructing all GParamSpecs we use, don't
  use GimpPDBArgType in GPProcInstall but an enum private to the wire
  protocol plus the GParamSpec's GType name. Bump the wire protocol
  version.

- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
  take care of converting between GPParamDef and GParamSpec. They
  share code as far as possible.

- Change pluginrc writing and parsing to re-use GPParamDef and the
  utility functions from gimpgpparamspecs.

- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
  the entire core uses proper GParamSpecs from the wire protocol now,
  the whole file will follow down the drain once we use a GValue
  representation on the wire too.

- In gimp_plug_in_handle_proc_install(), change the "run-mode"
  parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
  already an enum). and change all places in app/ to treat it as an
  enum value.

- plug-ins: fix cml-explorer to register correctly, a typo in
  "run-mode" was never noticed until now.

- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
  between old-style wire communication and using GParamSpec and
  GValue, it contains some functions that are subject to change or
  even removal in the next steps.

- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
  able to actually install procedures the new way.

- plug-ins: change goat-exercise to completely use the new GimpPlugIn
  and GimpProcedure API, look here to see how plug-ins will look in
  the future, of course subject to change until this is finished.

- Next: changing GPParam to transmit all information about a GValue.
2019-07-28 17:34:40 +02:00
Michael Natterer 679fd5f231 Issue #2794 - Gimp crash just on File Open and Edit Preferences
As suggested by LRN, change gimp_sigfatal_handler() on Windows to
dstinguish between fatal and non-fatal exceptions so we don't abort on
each minor hickup.
2019-05-28 11:55:59 +02:00
Jehan 406279e4ef app: new "gex" format (GIMP Extension).
File extension (.gex) may still change if anything better is proposed.
This format is currently just a compressed archive containing the
extension data (plug-in, brushes or whatever) and the metadata file.

For now, opening such file will simply install it as a new extension,
keeping all file permissions and structure. Of course in the future, it
will have to trigger a confirmation dialog.

Currently the compression used is zip, which is just a first draft. This
is not a decisive choice as well. We could use some tarball compressed
in whatever other compression algorithm. I use libarchive as a new
dependency to support unarchiving as it seems to be a common library
(and since it is already used by AppStream-glib anyway, this doesn't add
any actual dependency, just make it direct).
2019-04-12 18:49:18 +02:00
Michael Natterer a4e77e57f6 app, plug-ins: start consolidating brush and pattern loading/saving code
We currently have brush and pattern I/O code in both the core and
plug-ins. This commit starts removing plug-in code in favor of having
one copy of the code in the core, much like XCF loading and saving is
implemented.

Add app/file-data/ module with file procedure registering code, for
now just with an implementation of file-gbr-load.

Remove the file-gbr-load code from the file-gbr plug-in.
2019-02-11 12:51:31 +01:00
Jehan 4d84c1d7ee app, libgimpbase: --enable-relocatable-bundle replaces --enable-binreloc
Older --enable-binreloc configure option had basically the same purpose
as the newer --enable-relocatable-bundle, though the old binreloc was
only used for gimpenv.c code.
As a consequence, commit 10ce702188 was still not working fine since
gimp_installation_directory_file() also need binreloc enabled (to be
actually relocatable).

Let's get rid of this whole mess, by implying we want binreloc code to
be used when --enable-relocatable-bundle is ON. We don't need the
m4macros anymore, since AM_BINRELOC was basically just checking that
`/proc/self/maps` was present. But anyway being present at compile time
does not mean it will be at runtime (nor the opposite). So this test is
not that useful. The binreloc code will anyway fallback gracefully to
the non-binreloc code (i.e. trying to use build-time install paths) if
the procfs is lacking at runtime.
2019-02-05 14:50:31 +01:00
Ell 889e2e26ee app: remove gimp-scratch; replace with gegl-scratch
The scratch allocator has been moved to GEGL (commit
gegl@b99032d799dda3436ffa8c1cc28f8b0d34fb965d).  Remove gimp-
scratch, and replace all its uses with gegl-scratch.
2019-01-06 07:37:19 -05:00
Ell ae6bebb981 app: fix gimp-scratch linking 2018-12-01 06:22:48 -05:00
Oleksii Samorukov 28d376ae3e tests: OSX - activate GIMP window when tests are running
If window is not focused gimp_test_utils_synthesize_key_event would
fail.

(cherry picked from commit 63e86da6f3)
2018-11-23 23:20:20 +01:00
Ell 7cdd1ebeef app: add source location information to the Linux GimpBacktrace backend
When libbacktrace is available, use it to retrieve source location
information in the Linux GimpBacktrace backend.
2018-09-22 22:39:08 -04:00
Ell 667efc221d app: add Windows backend to GimpBacktrace
The Windows backend produces full, multithreaded backtraces.  When
DrMingw is available, it also provides full symbol and (where
available) source-location information.  Otherwise, it provides
symbol information for most of our libraries, but not for the GIMP
binary itself.
2018-09-03 15:57:53 -04:00
Ell 80bf686c94 app: add GimpBacktrace
GimpBacktrace provides an interface for creating and traversing
multi-threaded backtraces, as well as querying symbol information.
While we already have some backtrace functionality, it relies on
external tools for the most part, and as such is rather expensive,
and is only meant for producing opaque backtraces.  GimpBacktrace,
on the other hand, is meant to be relatively cheap (we're going to
use it for profiling,) and allow inspection of the backtrace data.
In the future, it might make sense to replace some, or all, of the
other backtrace functions with GimpBacktrace.

GimpBacktrace currently only supports Linux.  By default, it uses
dladdr() to query symbol information, which is somewhat limited (in
particular, it doesn't work for static functions.)  When libunwind
is installed, GimpBacktrace uses it to get more complete symbol
information.  libunwind is currently an optional dependency, but it
might make sense to promote it to a mandatory, or opt-out,
dependency, as it's lightweight and widely available.

On other platforms, the GimpBacktrace interface can still be used,
but it always returns NULL backtraces.
2018-09-02 02:54:43 -04:00
Jehan b70424b20a app: add base classes for the extension manager.
Right now it only loads AppStream data, which is completely useless, yet
is a base of a managed extension system. Having proper metadata is what
will allow to actually know what is installed.
This is only the first draft.

Note that I am not adding the extension path into GimpCoreConfig on
purpose, since the point is not to have people manage their extension
directories manually anymore.
The extensions will be loaded from the build-time system path or the
config directory, and that's all.
What will probably be stored in the config though will be the remote
repositories URLs (allowing third-party extension repositories).
2018-07-02 21:16:14 +02:00
Ell 19f4abbbd6 app: even more Windows-specific fixes in gimpdashboard.c
... and app/Makefile.am
2018-06-28 11:03:46 -04:00
Michael Natterer 5674e31850 Generate icon resources where they are needed, and don't include .c files
Treat the gimp-core-pixbufs and gimp-icon-pixbufs resources like we
changed the cursor resources before, and clean out a lot of cruft from
icons/ (there is no need to generate stuff in all icon themes when we
include only one fallback icon from one theme).
2018-06-13 20:02:05 +02:00
Michael Natterer de5babe943 app: move -u gimp_tool_cursors_get_resource to gimp_LDFLAGS
so it's not in the common AM_LDFLAGS that are used also for
gimp-console.
2018-06-13 19:36:17 +02:00
Ell 80de723022 app: add GimpAsyncSet
GimpAsyncSet represents a dynamic set of running GimpAsync objects.
The objects are automatically removed from the set once they're
synced.

GimpAsyncSet implements the GimpWaitable and GimpCancelable
interfaces, allowing the entire set to be waited-on or canceled.

Additionally, GimpAsyncSet provides an "empty" property, which
indicates whether the set is empty or not.  This allows responding
to the completion of all the GimpAsync objects through the set's
"notify::empty" signal, or drive UI changes through property
bindings.
2018-05-29 16:04:28 -04:00
Ell 4cc92ebd74 app: add GimpUncancelableWaitable
GimpUncancelableWaitable is a simple proxy object for another
GimpWaitable object, implementing only the GimpWaitable interface.
Its main purpose is to mask away the cancelability of an object
implementing both GimpWaitable and GimpCancelable.
2018-05-29 16:04:28 -04:00
Michael Natterer 4e472986c2 app: force gimp-tool-cursors.c to be linked into the binary 2018-05-28 20:20:13 +02:00
Ell 86b89cf62a app: add gimp-parallel
Add gimp-parallel.[cc,h], which provides a set of parallel
algorithms.

These currently include:

  - gimp_parallel_distribute():  Calls a callback function in
    parallel on multiple threads, passing it the current thread
    index, and the total number of threads.  Allows specifying the
    maximal number of threads used.

  - gimp_parallel_distribute_range():  Splits a range of integers
    between multiple threads, passing the sub-range to a callback
    function.  Allows specifying the minimal sub-range size.

  - gimp_parallel_distribute_area():  Splits a rectangular area
    between multiple threads, passing the sub-area to a callback
    function.  Allows specifying the minimal sub-area.

The callback function is passed using an appropriately-typed
function pointer, and a user-data pointer.  Additionally, when used
in a C++ file, each of the above functions has an overloaded
template version, taking the callback through a generic parameter,
without a user-data pointer, which allows using function objects.
2018-04-04 17:49:46 -04:00
Michael Natterer 452b1bd558 Stop leaking properties of the distcheck machine into the tarball
Some gimprc properties' default values depend on the machine where
"make dist" in run. We had an ugly hack in place to force
(num-processors 1) in the installed system gimprc and its manpage, but
were still leaking "tile-cache-size" and "mypaint-brush-path".

The files are generated by the hidden options --dump-gimprc-system
and --dump-gimprc-manpage which exist only for this purpose.

In gimpconfig-dump.c, special case the three properties in
dump_gimprc_system() and dump_gimprc_manpage() to output constant
default values for "num-processors" and "tile-cache-size" and
output @mypaint_brushes_dir@ in "mypaint-brush-path" which can
be replaced at configure time.

Also introduce etc/gimprc.in so @mypaint_brushes_dir@ can actually be
substituted for the installed system gimprc.
2018-03-30 13:19:22 +02:00
Michael Natterer 614b81ffb4 app, tools: rename "gimpdebug" to "gimp-debug-tool"
and use GIMP_TOOL_VERSION instead of hardcoding "2.0" in both
tools/Makefile.am and app/errors.c
2018-02-04 14:09:22 +01:00
Jehan 44f23bdf0c app: move git-version.h generation to the repository root.
The reason is that this file is now included for a binary in tools/ as
well (the debug binary) and tools/ contents needs to be built before
app/. Even using BUILT_SOURCES in the Makefile under app/ is not enough.
Anyway it makes sense that this file should be under the root of the
repository since that describes the status of the source repository. So
let's move it up one folder.
2018-01-29 20:17:41 +01:00
Jehan 1b4efd2d5a app, tools: rename app/version.[ch] to app/gimp-version.[ch].
Since commit 9fdf35550b, I removed the GIMP_APP_GLUE_COMPILATION check
because we need to have the whole versioning info from the new debug
widget. It just makes sense to go further and just make this a proper
internal API to get version information.
2018-01-29 01:48:30 +01:00
Jehan b318694bb2 app, tools: install the debug tools in libexec when appropriate.
AFAIK this means on all platforms but Win32 and macOS which would rather
need relative path and therefore cannot make use of build-time
LIBEXECDIR. Anyway on these platforms, leaving the binary in BINDIR is
not likely to "pollute" too much as it would on Linux or BSD where
people often use terminal.
2018-01-28 15:43:07 +01:00
Ell 09c2ba4cc2 app: fix git-version.h when building linked working tree
When building a linked working tree, $(top_srcdir)/.git is a
regular file, and not a directory.  Change the recipe for
git-version.h to allow that.
2017-12-06 04:50:02 -05:00
Jehan 2c19ea2145 app: add compiler info in `gimp -v`. 2017-09-10 01:21:55 +02:00
Ell 71bbd88e00 app: layer mode code shuffling
Commit 3635cf04ab moved the special
handling of bottom-layer compositing to GimpOperationLayerMode.
This required giving the op more control over the process()
function of its subclasses.  As a temporary workaround, the commit
bypassed the subclasses entirely, using "gimp:layer-mode" for all
modes.  This is the reckoning :)

Add a process() virtual function to GimpOperationLayerMode, which
its subclasses should override instead of
GeglOperationPointComposer3's process() functions.  Reinstate the
subclasses (by returning the correct op in
gimp_layer_mode_get_oepration()), and have them override this
function.

Improve the way gimp_operation_layer_mode_process() dispatches to
the actual process function, to slightly lower its overhead and
fix some thread-safety issues.

Remove the "function" field of the layer-mode info array, and have
gimp_layer_mode_get_function() return the
GimpOperationLayerMode::process() function of the corresponding
op's class (caching the result, to keep it cheap.)  This reduces
redundancy, allows us to make the ops' process() functions private,
and simplifies SSE dispatching (only used by NORMAL mode,
currently.)

Move the blend and composite functions of the non-specialized
layer modes to gimpoperationlayermode-{blend,composite}.[hc],
respectively, to improve code organization.

Move the SSE2 composite functions to a separate file, so that they
can be built as part of libapplayermodes_sse2, allowing
libapplayermodes to be built without SSE2 compiler flags.  This
allows building GIMP with SSE acceleration enabled, while running
the resulting binary on a target with no SSE accelration.

Add a "blend_function" field to the layer-mode info array, and use
it to specify the blend function for the non-specialized modes.
This replaces the separate switch() statement that we used
previously.

Remove the "affected_region" field of the layer-mode info array.
We don't need it anymore, since we can go back to using
GimpOperationLayerMode's virtual get_affected_region() function.

Last but not least, a bunch of code cleanups and consistency
adjustments.
2017-08-17 11:19:37 -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
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 2dbf1b46b2 app: rename gimp_layer_mode_is_linear() to gimp_layer_mode_wants_linear_data() 2017-01-31 01:43:48 +01:00
Michael Natterer dd3eec6198 app: change linking order of the sub-libs of app/operations
so layer-modes/ can use the enums in enums-types.h without failing to
link.
2017-01-17 14:28:40 +01:00
Michael Natterer a24e232522 app: move functions on enum GimpLayerMode to new files gimp-layer-modes.[ch] 2017-01-15 15:25:03 +01:00
Michael Natterer fd070eeb25 app: start moving layer modes into their own build directories
New directories:

operations/layer-modes/
operations/layer-modes-legacy/
2017-01-09 21:58:18 +01:00
Michael Natterer 0ce364ee4d configure.ac, app: require liblcms2 >= 2.7
and add an lcms2 runtime version check to app/sanity.c

Fixes:
Bug 736701 - LCMS2 rounding errors cause problems with certain GIMP blend modes
2016-09-15 12:52:20 +02:00
Michael Natterer 631110e061 app: merge units.[ch] into core/gimp-units.[ch]
and initialize units in gimp_init(). This was completely
over-engineered but in the end boils down to a bad hack that needs a
static "the_unit_gimp" pointer anyway, so let's at least have the hacks
in one file.
2016-09-12 23:51:29 +02:00
Jehan ff5587cd53 app: fix win32 build with Dr. MinGW.
GIMPDIR and GIMP_USER_VERSION macros need to be defined in app/ as well!
2016-06-12 04:04:11 +02:00
Michael Natterer 0bfa402c1a Argh, this was meant to be squashed into the previous commit... 2016-05-26 22:18:50 +02:00
Mukund Sivaraman 6a6604871f windows: Add support for generating crash backtraces using Dr. MingW 2016-01-02 18:55:37 +05:30
Daniel Sabo c97a529968 app: Change mypaint dependency from libmypaint-gegl to just libmypaint 2015-12-28 09:18:46 -08:00
Michael Natterer cb8e16aae8 app: move app/batch.[ch] to app/core/gimp-batch.[ch]
There is no reason batch processing should be considered "glue code".
2015-09-30 01:57:33 +02:00
Michael Natterer 4266f86e08 app: remove tons of linker workarounds from Makefilea
either linkers got smarter or our structure got better, or this breaks
on whatever other linkers again...
2015-08-27 21:44:15 +02:00
Michael Natterer 46eef4d09d app: remove references to plug_in_icc_profile_apply_rgb() from Makefiles 2015-08-27 13:52:26 +02:00
Jehan 77b04551c8 app: clean compilation with external libmypaint.
The work-in-progress was using a source tree of libmypaint embedded
into GIMP tree. This is a cleaning with pkg-config test in configure,
and correct includes.
2015-03-30 22:38:35 +02:00
Michael Natterer 071ede915a app: first draft of GimpMybrushTool, which uses MyPaint brushes 2015-03-30 22:38:34 +02:00