11-05-2022, 09:20 AM
“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” ― Brian Kernighan
Not a scheme expert. Code typically too clever to be debuggable (I don't even know how to print a value in Scheme...). You obviously try to play a clever trick to get the guide position but it it obviously wrong: if you are layer or image-centric, this doesn't just change the sign of the position.
IMHO, the simplest way:
Not a scheme expert. Code typically too clever to be debuggable (I don't even know how to print a value in Scheme...). You obviously try to play a clever trick to get the guide position but it it obviously wrong: if you are layer or image-centric, this doesn't just change the sign of the position.
IMHO, the simplest way:
- If you work on an image, then offsets are 0,0, and W&H are the image dimension
- If you work on layer, then offset are the layer's offset and W&H are the layers dimension
- offsetX+position (left),
- offsetY+position (top),
- offsetX+width-position (right),
- offsetY+height-position (bottom).
- I had to drop the get bit in your gimp-drawable-get-{offset,width,height} (ie, gimp-drawable-height is what works for me, what version of Gimp are you using)?
- (if (= in_toggle TRUE) ...) is better written (if in_toggle ...)
- (* -1 position) is better written (- position)