Skip to content
  • Jehan's avatar
    libgimp: PDB procedure arguments are not order-based anymore (API-wise). · 70438028
    Jehan authored
    As far as plug-in API is concerned, at least the calling API, order of arguments
    when calling PDB procedures doesn't matter anymore.
    
    Order still matters for creating procedures with standard arguments (for
    instance, "run-mode" is first, then image, or file, drawables or whatnot,
    depending on the subtype of procedure), but not for calling with libgimp.
    
    Concretely in this commit:
    
    - gimp_pdb_run_procedure_argv() was removed as it's intrinsically order-based.
    - gimp_pdb_run_procedure() and gimp_pdb_run_procedure_valist() stay but their
      semantic changes. Instead of an ordered list of (type, value) couple, it's now
      an unordered list of (name, type, value) triplets. This way, you can also
      ignore as many args as you want if you intend to keep them default. For
      instance, say you have a procedure with 20 args and you only want to change
      the last one and keep the 19 first with default values: while you used to have
      to write down all 20 args annoyingly, now you can just list the only arg you
      care about.
    
    There are 2 important consequences here:
    
    1. Calling PDB procedures becomes much more semantic, which means scripts with
       PDB calls are simpler (smaller list of arguments) and easier to read (when
       you had 5 int arguments in a row, you couldn't know what they refer to,
       except by always checking the PDB source; now you'll have associated names,
       such as "width", "height" and so on) hence maintain.
    2. We will have the ability to add arguments and even order the new arguments in
       middle of existing arguments without breaking compatibility. The only thing
       which will matter will be that default values of new arguments will have to
       behave like when the arg didn't exist. This way, existing scripts will not be
       broken. This will avoid us having to always create variants of PDB procedure
       (like original "file-bla-save", then variant "file-bla-save-2" and so on)
       each time we add arguments.
    
    Note: gimp_pdb_run_procedure_array() was not removed yet because it's currently
    used by the PDB. To be followed.
    70438028