Commit Graph

18 Commits

Author SHA1 Message Date
Michael Natterer a20fb094d9 libgimp: remove gimp_plug_in_create_procedure() from the API
no plug-in code ever needs to call it.
2019-09-10 12:11:32 +02:00
Michael Natterer 75bf3865b8 libgimp: memory/lifecycle manage the new libgmp proxy objects
Turn GimpPlugIn into the main factory for all proxies and keep the
main hash tables there. The hash tables keep the initial reference.

For each GimpProcedure::run(), have s "sub-factory" which hands out
proxies to the actual procedure code. Each run() has hash tables of
its own which hold additional references. When run() is done, get rid
of its hash tables and their references, *and* drop the main plug-in
reference counts from the global hashes if the proxies' refcount has
dropped to one.
2019-08-23 17:30:04 +02:00
Michael Natterer a04e287966 libgimp: fold gimpplugin-private.c into gimpplugin.c
having that separation was a bad idea in the first place. Private,
really private, totally private in a separate file? just merge them.
2019-08-22 22:24:33 +02:00
Michael Natterer 1e6abab1d3 libgimp: name parameters "procedure_name" not just "name"
and some random cleanup.
2019-08-07 10:43:07 +02:00
Michael Natterer 3c001a6123 libgimp: separate legacy from GimpPlugIn wire communication
Move all old wire code to gimplegacy.c and add wire code to
GimpPlugIn, which now talks with the GIMP core all by itself.

Add some more ASSERT_NO_PLUG_IN_EXISTS assertions to gimplegacy.c and
fix new code that was still using legacy API.
2019-08-06 22:21:50 +02:00
Michael Natterer 9a027140c8 libgimp: add read- and write-channel construct properties to GimpPlugIn
and change all GimpPlugIn-based code to get the channels from the
plug-in singleton instead of from the global variables.
2019-08-06 21:29:48 +02:00
Michael Natterer ad8dcff199 libgimp: add _gimp_plug_in_read_expect_msg()
and make the places who need it dispatch between it and
_gimp_read_expect_msg() depending on whether there is a GimpPlugIn
instance. Also clean up some includes.
2019-08-03 12:52:22 +02:00
Michael Natterer 3dd79f42c3 Revert "libgimp: move _gimp_read_expect_msg() back to gimp.c"
This reverts commit 366047f423.
2019-08-03 12:37:32 +02:00
Michael Natterer 366047f423 libgimp: move _gimp_read_expect_msg() back to gimp.c
and make it distinguish between old and new plug-in running.
2019-08-02 18:26:52 +02:00
Michael Natterer 856fe16070 libgimp: add _gimp_plug_in_run() and copy the main plug-in loop to GimpPlugIn
Move the legacy loop code to gimplegacy.c. Also remove some more stuff
from gimp.c, old and new are now completely separate apart from one
glitch which wll go next...
2019-08-02 17:05:51 +02:00
Michael Natterer 1e2efcf95e libgmp: reorder GimpPlugIn's query(), init(), quit()
in plug-in lifecycle order.
2019-08-02 12:05:28 +02:00
Michael Natterer 5f8d0ef27b libgimp: add gimp_plug_in_extension_enable() and _extension_process()
Start copying all the actual wire communication to GimpPlugIn, and
move the legacy versions to gimplegacy.c.

This implies having the entire protocol code twice, but without any
if(PLUG_IN) { plug_in_stuff(); } else { legacy_stuff(); }

At the moment it is a wild mixture of old and new, but when finished
the wire code in gimplegacy.c will be entirely separate from the wire
code in GimpPlugIn, which will make it easy to g_assert() that only
one API is used by a plug-in.
2019-08-02 12:02:20 +02:00
Michael Natterer 8c4f73df8d app, libgimp: add copyright notices to the new stuff, minor cleanup 2019-07-31 00:13:49 +02:00
Michael Natterer d64c0ebd30 libgimp: change GimpPlugIn and GimpProcedures so temp procs work 2019-07-30 21:02:58 +02:00
Michael Natterer 7a9e0d984e libgimp: add more registering API to GimpPlugIn and GimpProcedure
Icon, menu branch, translation domain and help domain can now be
registered using the objects' API instead of the direct PDB calls.
2019-07-30 19:23:55 +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 8a462e867d libgimp: add a GimpProcedure class
Mostly the same code as GimpProcedure in app/pdb/.

Move the "run" function to GimpProcedure. Add API to GimpPlugIn to
list and create procedures, and always keep a list of the plug-ins
procedures around. Still only using the old params and return_vals.
2019-07-26 02:11:35 +02:00
Michael Natterer f2d399b17b libgimp: add initial version of a GimpPlugIn class
The new way of doing plug-ins:

- subclass GimpPlugIn in your plug-in
- implement its query() and run() methods, run() will move to a
  new GimpProcedure class soon
- instead of MAIN(), say GIMP_MAIN(YOUR_PLUG_IN_TYPE)

Instead of keeping around a GimpPlugInInfo struct, libgimp will
create an instance of your plug-in class, keep it around during
the plug-in's lifetime, and call its virtual functions.
2019-07-25 23:07:24 +02:00