[Gimp-developer] Any examples for gimp-progress-install?

2010-10-30 Thread Gino D
Hi.

I would like to precisely understand how the gimp-progress-install
procedure works; sorry, I have tried to see the source code for this
purpose, but I am still not very experienced in reading and managing
it, and I have some difficulty in figuring out what a
progress-callback exactly represents.

More than anything, I am interested in knowing in which cases and for
what purposes the aforesaid procedure (as well as related commands,
such as gimp-progress-uninstall and gimp-progress-cancel) could be
used within scripts. Can you give me some examples?

Thanks in advance.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Getting the ID of a nested layer on GIMP 2.7.1

2010-10-18 Thread Gino D
On Fri, Oct 15, 2010 at 1:59 PM, LightningIsMyName
lightningismyn...@gmail.com wrote:

 Try gimp_item_is_group to check if a layer is a group layer, Then you
 can use gimp_item_get_children (on the group layers) to get the
 children by their order (topmost to bottomost). Finally, you can use
 gimp_item_get_parent to get the parent layerof a layer inside a layer
 group.

 ~LightningIsMyName


On Fri, Oct 15, 2010 at 4:57 PM, Martin Nordholts ense...@gmail.com wrote:

 Also note that the latest code from git is packaged in tarballs here
 each night:
 ftp://gimptest.flamingtext.com/pub/nightly-tarballs/

  / Martin


Thanks for the hints and the link.

Sorry if my question seems trivial (unfortunately, I'm still a newbie
in this field), but out of curiosity are those nightly tarballs
suitable for building GIMP under Windows too?
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] Getting the ID of a nested layer on GIMP 2.7.1

2010-10-15 Thread Gino D
Hi.

Correct me if I'm wrong, but I have seemed to notice that the
gimp-image-get-layers procedure, when running on GIMP 2.7.1, doesn't
return the identifiers of the layers nested within groups, while
yielding the ones of unattached layers and layer groups.
So, how may such identifiers be obtained? Is there any
procedure/stratagem for this purpose?

Thanks in advance.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Layer-Visibility in rotate tool: always 100%

2010-08-17 Thread Gino D
2010/8/17  oli...@first.in-berlin.de:
 Hello,
 in the rotate tool, when I make the visibility  100%
 this simply does not work.
 The layer that will be rotated is always 100% visibile.
 Will it be enough to mention it here (because of a possible quick fix)?
 Or should I file a bug-report (or maybe there already is one for that
 problem?)?
 It's Gimp 2.6.7.
 Ciao,
  Oliver


There is to add that, besides the opacity, also the layer mode is not
correctly previewed during the handling of the Rotate Tool, since the
rotating layer is always shown as if its mode would be temporarily set
to Normal even when it doesn't.
Moreover, this flaw seems to affect other Transform Tools as well,
like Scale, Shear and Perspective.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Creating unique file names with Script-Fu

2010-07-08 Thread Gino D
2010/7/8 Kevin for...@gimpusers.com:
 Would it not be possible to create a reasonably unique name using the tiny-fu,
 ftx extension, (time) function? That should give you a name unique to the
 current time, at least if you don't try and use it more than once in the
 current second.

 You'd probably still need to do some collision avoidance just to be safe.

 --
 Kevin (via www.gimpusers.com)


Yes, this is another viable possibility. Thanks for your suggestion.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Creating unique file names with Script-Fu

2010-06-29 Thread Gino D
2010/6/27 Jon Cruz j...@joncruz.org:

 On Jun 23, 2010, at 10:58 AM, Gino D wrote:

 After doing several tests, my impression is that such a stratagem
 should work well. Nevertheless, I'm not totally sure of its
 infallibility, because, among other things, I don't know if the
 character “!” is really the first valid symbol on all operating
 systems supported by GIMP,

 As a minor note, I can confirm that ! is not the first valid symbol on all 
 operating
 systems. Most operating systems allow for many more characters than Windows
 does.


That's exactly what I feared. However, now it's clear that this kind
of problem can be avoided by following the method previously proposed
by Rob, which, being based on sorted lists of file names, is sure to
be OS independent, unlike the dir-read-entry command.

Anyway, thanks for the information.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Creating unique file names with Script-Fu

2010-06-27 Thread Gino D
2010/6/25 Rob Antonishen rob.antonis...@gmail.com:

 Add in a merge sort (i used these three functions):

    (define split
      (lambda (ls)
  ...
          (split-h ls ls '()

    (define merge
      (lambda (pred ls1 ls2)
     ...
          (else (cons (car ls2) (merge pred ls1 (cdr ls2)))

    (define merge-sort
      (lambda (pred ls)
      ...
                    (merge-sort pred (cdr splits

 Then get a sorted directory like like so:
 (set! varFileList (merge-sort string=? (cadr (file-glob
 (string-append varDirectory DIR-SEPARATOR *)  1

 -Rob A


Well done, Rob, and what an interesting revelation! Though not so long
ago, indeed, I have collected all the Script-Fu procedures returned by
the “oblist” command invocation in a text file, with the purpose of
having them always within reach, nevertheless I hadn’t noticed the
existence of the “file-glob” procedure before now. Hence, thanks a lot
for highlighting this command, as well as for contriving those
powerful procedures whereby it is possible to achieve a sorted
directory.

The approach you suggest is a good alternative to the employment of
the “dir-read-entry” procedure, which actually might be unreliable in
certain cases, as Saulgoode points out, depending to what kind of
filesystem the target directory belongs to.

In fact, after obtaining an alphabetically ordered list with the names
of the folder's elements, it would be possible to exploit even the
last element rather than the first one, by producing a new string that
concatenates this ending string, the character “z”, and finally the
string “.pat”, so as to get a file name that should be unique and
non-confrontational.

Thank you again for your contribution.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Creating unique file names with Script-Fu

2010-06-24 Thread Gino D
Hi.

2010/6/23  saulgo...@flashingtwelve.brickfilms.com:

 I do not believe it is possible for a Script-fu to delete files. You
 will need to either do this outside of GIMP or write a plug-in.


Deletion of files is made possible by the “file-delete” procedure, as
shown at the end of the sequence of commands I proposed in my initial
post.


 The following code snippet uses 'gimp-temp-name' -- which generates a
 filename that has an extremely good chance of being unique...


The idea of employing the “gimp-temp-name” procedure for generating a
most likely unique file name is very interesting. Thanks for your
suggestion and the snippet you devised. Pity that such procedure
affects only the GIMP temporary directory; if it were effective in
every folder, it would be great, especially for the issue we are
discussing.

By chance, can you tell me if my previous conjectures about the
priority of the exclamation point are correct, besides on Windows, on
other operating systems too?
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] Creating unique file names with Script-Fu

2010-06-23 Thread Gino D
Hi.

I'm working on a script in which I would like to insert a sequence of
commands aimed to save a drawable as PAT file and eventually, when no
longer needed, eliminate the file in question. This trick allows to
create a temporary pattern existing only during the script execution,
so as to fill a layer or a channel with the content of the drawable
this pattern derives from.

The problem is that I can’t choose whatever arbitrary name for the PAT
file, because the destination folder might contain a file with the
same name, which would therefore run the risk of being overwritten and
lastly removed by the script. So, this observation points out the
necessity of implementing a method for creating unique file names by
means of the Scipt-Fu language.

Personally, instead of writing conditional statements which cyclically
verify the existence of a certain file name (with the “file-exists?”
procedure), I have thought about the possibility of using the
“dir-read-entry” procedure. Supposing to store the result of this
command into a variable named F1, if F1 equals #EOF, the target
directory is empty, thus any name can be chosen (for instance,
“0.pat”). If the folder is not empty instead, F1 will return the name
of the alphabetically first element (file or folder) inside such
directory. In this case, a solution may be to create a new string
called F2 by connecting the character “!”, the string F1 and, finally,
the string “.pat”. Having noticed that the exclamation point is the
first available symbol for naming files/folders (at least, on Windows
platform), well the string F2 shall precede the string F1 in
alphabetical order, so as to furnish, this way, a valid and unique
file name which doesn't already exist within the folder, as confirmed
by the fact that further invocations of “dir-read-entry” will return
strings of higher order.

In short, here is the set of procedures I imagine:

(define PD (string-append gimp-data-directory \\patterns\\))
(define STM (dir-open-stream PD))
(define F1 (dir-read-entry STM))
(if (eof-object? F1)
   (define F2 (string-append PD 0.pat))
   (define F2 (string-append PD ! F1 .pat))
)
(file-pat-save 1 IMG DRW1 F2 “” “My Pattern”)
(dir-close-stream STM)
(gimp-patterns-refresh)
(gimp-context-set-pattern “My Pattern”)
(gimp-edit-bucket-fill DRW2 2 0 100 255 1 0 0)
(file-delete F2)
(gimp-patterns-refresh)

After doing several tests, my impression is that such a stratagem
should work well. Nevertheless, I'm not totally sure of its
infallibility, because, among other things, I don't know if the
character “!” is really the first valid symbol on all operating
systems supported by GIMP, as well as I can't figure out if there are
any character combinations that invalidate my remarks on the
alphabetical priority performed by appending the exclamation point
before whatever string.

Can anyone clarify my doubts and definitely confirm or deny the
effectiveness of the method I have just stated? Moreover, any
suggestions on how to generate unique file names in a different and
simpler way?

Thanks in advance.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Gimp UX: Paste

2010-06-04 Thread Gino D
2010/6/3 Rob Antonishen rob.antonis...@gmail.com:
 I've been following this with interest.

 To play with it, I created a script:
 http://ffaat.pointclark.net/incoming/scripts/paste-as-new-centered.scm

 It registers as Edit-Paste As-New Centered Layer

 -Rob A


Thank you, Rob, for creating this useful script.

If I may, I would like to suggest a little improvement aimed to get
rid of the only snag the script could encounter, occurring when the
active drawable is a floating selection. Indeed, although the event of
pasting into such a quasi-layer is surely rare and atypical, all the
same this operation alters both the floating selection and the
drawable it is attached to, since eventually the former will be
anchored to the latter and its content replaced by the pasted object.

So, it might be worthwhile forcing the script to ignore floating
selections, for instance with this initial condition:

(case (car (gimp-layer-is-floating-sel active-layer))
   ((1)
  (gimp-message The script doesn't affect floating selections.)
  (quit)
   )
)

In order to make the script effective even on any floating selection,
another solution might be to transform at first this object into a
layer (through the gimp-floating-sel-to-layer procedure), but the
problem of this choice is that such procedure returns an error if the
floating selection belongs to a channel or a layer mask.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Gimp UX: Paste

2010-06-03 Thread Gino D
Hi.

2010/6/2 Jason Simanek jsima...@gmail.com:

 Thanks for pointing out the usefulness of floating selections for
 scripting/plugins. That makes a lot of sense. But if that is the only
 usefulness for this special type of layer I think it should be a special
 behavior that can be employed by script and plugin writers, not the default
 in the GUI.

 What Gino just told me is that the floating selections are a special type of
 layer whose special properties can only be perceived or employed by scripts.
 How would a normal mouse-user derive any usefulness from the qualities of
 this special layer?

 In this case it seems the interest in making Gimp scriptable has overridden
 the interest in making Gimp's UI intuitive.

 -Jason Simanek


Though previously I myself have stressed the importance of the
floating selections for scripting, nevertheless I think that even the
GUI environment takes advantage of what these objects permit to do,
that is the fusion of a pasted/created layer into another drawable
without losing the initial characteristics of the latter.

Having said that, if there is no need to merge layers together, but
you simply want to manage the pasted object as indipendent layer, then
the optimal solution is to use the Paste as New Layer command rather
than the Paste command, which actually generates floating
selections. According to me, the only small drawback of the former
choice consists in the fact that such new pasted layer doesn't come
centered on the target image (as it would be convenient), whereas, on
the contrary, every floating selection (when pasted) does.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Gimp UX: Paste

2010-06-02 Thread Gino D
Hi.

2010/6/2 Jason Simanek jsima...@gmail.com:

 A new layer is non-destructive. Why is there a need for this other type
 of layer? The name 'floating selection' isn't even accurate. This is a
 collection of pixels. It is not a selection. A selection is an ephemeral
 mask not a collection of specific pixels.
 . . .

 Jason Simanek


Until some time ago, I also doubt the usefulness of this kind of
layer. Recently, however, I discovered that the floating selections
can be really handy, especially when they are put into action within
the scripts. Often, indeed, with the purpose of obtaining a specific
type of effect for a drawable through the Script-Fu language, it is
necessary to make the script perform, one or more times, the fusion
between the starting drawable and a new drawable, which is usually a
modified copy of the first one. This combination can be accomplished
either by merging the created drawable down or by anchoring it towards
the original one, depending, respectively, on whether it has been
added as new layer/channel or pasted as floating selection.

But the first approach can be slightly destructive about the
properties the initial drawable had - like its ID, opacity, linked
state, layer's mask (if present), lock alpha channel setting,
combination mode -, because the eventual drawable derived from the
fusion won't keep any of them. Particularly, the loss of the ID voids
the variable it was been stored in, so it becomes essential to
re-define it every time like this:
(define drw (car (gimp-image-get-active-drawable img))).

The anchorage of a floating selection, instead, allows to really
maintain the integrity of the drawable to which such floating object
belongs, including all the important features listed above.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


[Gimp-developer] GIMP 2.7 and Single Window Mode

2010-01-04 Thread Gino D
Hi.

Inside a web page, I've read that the release of GIMP 2.7 already
anticipates several features of the stable version 2.8, including the
ability to activate the Single Window Mode. Nevertheless, I guess the
article was referring only to the Linux version of the program, because the
author explained a way to activate it (via the Window Management item of the
Preferences Panel) that I haven't been able to replicate into Windows.

Can you please tell me if what I've read is true or not? And if yes, by
chance is it somehow possible to test the Single Window Mode within the
Windows version of GIMP 2.7.0 which at present is available on
Sourceforge.net?

Thanks in advance.
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer