Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Troubles with guide position
#3
“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:
  • 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
Then your guides are at
  • offsetX+position (left),
  • offsetY+position (top),
  • offsetX+width-position (right),
  • offsetY+height-position (bottom).
Also, despite not being a Scheme person:
  • 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)
If you have Python support in your Gimp and always put the guides at the same place relative to image or layers, you can try my ofn-guide-presets script (use it as is or steal the code).
Reply


Messages In This Thread
Troubles with guide position - by alvk - 11-05-2022, 12:19 AM
RE: Troubles with guide position - by teapot - 11-05-2022, 08:49 AM
RE: Troubles with guide position - by alvk - 11-05-2022, 10:00 AM
RE: Troubles with guide position - by Ofnuts - 11-05-2022, 10:41 AM
RE: Troubles with guide position - by alvk - 11-05-2022, 10:57 AM
RE: Troubles with guide position - by Ofnuts - 11-05-2022, 09:20 AM

Forum Jump: