Add an option to draw ruler tips as a power of 2
ClosedPublic

Authored by zachmann on Oct 10 2017, 2:52 PM.

Details

Summary

Added option to show pixel rules with a width of 64 pixel.
The config setting is saved to the document.

This implements the feature described in

https://phabricator.kde.org/T4874

Diff Detail

Repository
R37 Krita
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zachmann created this revision.Oct 10 2017, 2:52 PM
dkazakov requested changes to this revision.Oct 11 2017, 8:47 PM

Hi, @zachmann!

I have tested your patch and there seems to be a few bugs/features (I don't understand :) ):

  1. When enabling "Multiple of 2" mode, I cannot see the logic, which units use it, and which not... As far as I can see:
    • px, pt, cm, mm --- use multiples of two
    • pi, cc, in --- don't use the multiple

As far as I can guess, only px should use this multiplier...

  1. When saving/reloading the image, the option is not activated. I don't know why. I can see the code doing some XML saving in the patch, but it seems it fails to pass this value to the GUI
  1. If we save "use multiple of 2" value to .kra file, I guess we should also save the choice of the unit... It was not in the original task, but I guess it would be logical.

Here is a video recording showing the issue (when I close the file the canvas is not updated, it is a known bug of my video driver):

This revision now requires changes to proceed.Oct 11 2017, 8:47 PM

I have tested your patch and there seems to be a few bugs/features (I don't understand :) ):

  1. When enabling "Multiple of 2" mode, I cannot see the logic, which units use it, and which not... As far as I can see:
    • px, pt, cm, mm --- use multiples of two
    • pi, cc, in --- don't use the multiple

      As far as I can guess, only px should use this multiplier...

The feature is only there for pixel. The other units don't use it. It is just that the show the values but that they do also without t

  1. When saving/reloading the image, the option is not activated. I don't know why. I can see the code doing some XML saving in the patch, but it seems it fails to pass this value to the GUI

The problem was that the stuff was only saved when guides where used.

  1. If we save "use multiple of 2" value to .kra file, I guess we should also save the choice of the unit... It was not in the original task, but I guess it would be logical.

This is the question. The show rulers seems to be saved in the krita config and not saved int document as the multiple of two. Should this and the unit saved in the document?

Here is a video recording showing the issue (when I close the file the canvas is not updated, it is a known bug of my video driver):

zachmann updated this revision to Diff 20910.Oct 17 2017, 4:23 PM

Save the guides and the multiple of two when there are changes to the config. This also fixes the problem that the Show guides, Snap to guides, Lock guides was only saved when the there was a guide in the document.

dkazakov requested changes to this revision.Oct 23 2017, 7:39 AM
  1. When enabling "Multiple of 2" mode, I cannot see the logic, which units use it, and which not... As far as I can see:
    • px, pt, cm, mm --- use multiples of two
    • pi, cc, in --- don't use the multiple

The feature is only there for pixel. The other units don't use it. It is just that the show the values but that they do also without t

It sounds like a bug :(

  1. If we save "use multiple of 2" value to .kra file, I guess we should also save the choice of the unit... It was not in the original task, but I guess it would be logical.

This is the question. The show rulers seems to be saved in the krita config and not saved int document as the multiple of two. Should this and the unit saved in the document?

I guess both the options (unit and use-power-of-two) should be saved into .kra. If you really like it, you can make KisConfig store the last manually switched by the user value and use it as the default for newly cretaed documents. That would be the best option from usability point of view. Right now, power-of-two option seem to be saved/loaded correctly (tested), but the units not (obvoiusly)

There is still one blocking bug with the power-of-two option:

  1. Create a document, make sure that power-of-two options is switched off
  2. Create the second document and enable power-of-two option
  3. Press Ctrl+W to close the second document

Now you see the first document, with the rulers' units rendered as if the power-of-two option is enabled, although it is not enabled.

This revision now requires changes to proceed.Oct 23 2017, 7:39 AM
zachmann updated this revision to Diff 23622.Dec 7 2017, 5:56 PM

Fixed updating on switching different images.
Saved unit to the kra file.

dkazakov accepted this revision.Dec 11 2017, 10:14 AM

Hi, @zachmann!

The patch looks and works perfectly fine now! Please push!

And thank you very much for your work! :)

This revision is now accepted and ready to land.Dec 11 2017, 10:14 AM
This revision was automatically updated to reflect the committed changes.