Diffusion Krita ba458423d537

Numerical input boxes for canvas resize

Authored by jospin on Aug 5 2016, 2:38 PM.

Description

Numerical input boxes for canvas resize

Summary: First integration of numeric parser spinboxes, for the moment just for the canvas resize function.

Test Plan: Open Krita, open an image and goto Image->Resize Canvas... You can then play around with the boxes, make them become red if you write a wrong expression (everytime the expression is valid you will see the size preview update, the corresponding offset and, if keep ratio is the to true, the other box and offset).

Reviewers: Krita, dkazakov

Reviewed By: Krita, dkazakov

Subscribers: woltherav, rempt, dkazakov, jospin

Maniphest Tasks: T1621

Differential Revision: https://phabricator.kde.org/D1875

dkazakov added a subscriber: dkazakov.

Added manual for auditors!

Hey Paragon, I documented this here:

https://docs.krita.org/Maths_input

I used the code to figure out the possibilities, but it seems exp, ln and log10 don't work? Any idea why?

Feel free to edit the page yourself, btw, the login is the same as the phabricator one.

Cool, thank you.

I've done a few corrections (not that much) on the doc.

On my computer ln and exp functions work like a charm. But yes, there's a problem with log10 :S .
When I've got the problem corrected do I commit directly on master ?

It is string freeze now, so that means you can commit all sorts of bugfixes, except the ones that change strings.

If in doubt, make a small diff, and let @rempt or @dkazakov take a look.

For ln() and exp() could you add examples that do work? Maybe I am just not choosing the right numbers.

The procedure I use to test is to open an image then go to image size. To test the functions you need a doublespinbox (intspinboxes just do arithmetic) so just select percent as a unit. Then I write my formulas for example:

ln(2) the result is 0.6931, When I take the exp(0.6931) I get 1.9999 back (roundoff error, the true natural logarithm of 2 is irrational)
exp(50) gives 10000.0000 which is the maximal value on can put in the spinbox (exp(50) is bigger but the system prevent the spinbox to go over it's max).
exp(1) gives 2.7183 which are the first decimals of e.

If you take the log of a negative value the system will compute a NaN (the natural logarithm of a negative number is not defined on the Reals) so the spinbox should display an error.

woltherav accepted this commit.Aug 11 2016, 4:13 PM

Thanks, I can confirm those working. I added the examples to the manual, as I can't really come up with any better ones. I haven't had to use either in at the least ten years. :p

I'll accept this, and once you fix lands we'll add log10 properly to the manual as well.

Merged Changes

This commit merges a very large number of changes. Only the first 50 are shown.
CommitAuthorDetailsCommitted
592deeddccfdjospin
Merge branch 'numericalboxes' of git://anongit.kde.org/krita into numericalboxes 
Aug 5 2016
76747ab49efajospin
[numericalboxes] fixed a few error that appeared after rebasing prior to land. 
Aug 5 2016
3b18d163fae5jospin
Remove single commented line. 
Aug 5 2016
9333546953eedkazakov/jospin
Fix whitespace/tabulations problem 
Aug 5 2016
6796bcc864fajospin
Move the .ui files that where forgotten in last commit (letting them in the… 
Aug 5 2016
d347feff6d65jospin
Correct code and coding conventions prior merging numericalboxes. 
Aug 5 2016
97dea18d915fjospin
Display the warning sign when a parsespinbox is in error state only if there's… 
Aug 5 2016
1e4ee51fa8d6jospin
Let a few last place of the code use the numercic parse spinboxes. 
Aug 5 2016
1eb223e761cdjospin
Fix an annoying bug whith the specific color selector and the parsespinBoxes. 
Aug 5 2016
9ea4c44f3f5cjospin
Transform the spinboxes in parsespinboxes in the paintops plugin. 
Aug 5 2016
d6f9150d95aejospin
Let the karbon plugin use the math parsing abilities 
Aug 5 2016
3f6738c29aa1jospin
Some little changes in kritaui regarding the use of KisIntParseSpinBox. 
Aug 5 2016
214d7dff1af6jospin
Let all the filters use the math parser spinboxes. 
Aug 5 2016
972539518bb5jospin
Let the widgets previously in kritawidgets use KisDoubleParseUnitSpinBox. 
Aug 5 2016
5c29b8237e05jospin
Move the classes that use KoUnitSpinBox from lib/widget in lib/ui/widget. 
Aug 5 2016
6d57fdea805ajospin
Use the parsespinboxes on all the dockers. 
Aug 5 2016
cfe61f40c637jospin
Create a replacement for KoUnitSpinBox that is able to parse math expression. 
Aug 5 2016
1334a0961b64jospin
Let the slider spinboxes use the math expression parser. 
Aug 5 2016
517de9e9dc2bjospin
[numerical boxes] assert that all the functions from the image and layer menu… 
Aug 5 2016
ee796f6dbf36jospin
[numerical boxes] treat all the forms in the ui/form folder. 
Aug 5 2016
eace306ac1dajospin
[numerical boxes] make use of parsespinboxes in the forms of the tools option… 
Aug 5 2016
d2386f8de50fjospin
[numerical boxes] Manage prefix and suffix in error cases. 
Aug 5 2016
1756968c1e6fjospin
[numerical boxes] add parsespinbox to the offsetimage extension. 
Aug 5 2016
63f6e2837b9ejospin
[numerical boxes] add license information to test files. 
Aug 5 2016
9b50b5495248jospin
[numerical boxes] Use the numerical boxes in all the imagesize extension. 
Aug 5 2016
0ca651c14490jospin
[numerical boxes] improve parser structure. 
Aug 5 2016
20a46f0b631fjospin
[numerical boxes] Implement a test for the parserSpinBoxes and correct what… 
Aug 5 2016
b717bb12d0bejospin
[numerical boxes] Add a test for simpleMathExpressionsParser. 
Aug 5 2016
2086e9efeeb7jospin
[numerical boxes] Icons for warning in parseSpinBoxes. 
Aug 5 2016
b48a6fb16582jospin
[numerical boxes] Allow to use floating point in int calculationsbefore… 
Aug 5 2016
cd78c034ef7fjospin
[numerical boxes] Correct style, add comments and do some small corrections to… 
Aug 5 2016
f3f6b9da80d9jospin
[numerical boxes] Improve the behavior of parseSpinBoxes (tested with resize… 
Aug 5 2016
798c281a243cjospin
[numerical boxes] first working version (only for the resize canva dialog for… 
Aug 5 2016
e4b5c29eea4ajospin
Remove single commented line. 
Aug 5 2016
70eaf2f14e02dkazakov
Fix whitespace/tabulations problem 
Aug 5 2016
dadb06944f9djospin
Move the .ui files that where forgotten in last commit (letting them in the… 
Aug 4 2016
6c78c5fb8269jospin
Correct code and coding conventions prior merging numericalboxes. 
Aug 3 2016
1bde5353e477jospin
Display the warning sign when a parsespinbox is in error state only if there's… 
Jul 27 2016
b7475b7b9769jospin
Let a few last place of the code use the numercic parse spinboxes. 
Jul 27 2016
a3bb206c7766jospin
Fix an annoying bug whith the specific color selector and the parsespinBoxes. 
Jul 27 2016
edca8e97fa2fjospin
Transform the spinboxes in parsespinboxes in the paintops plugin. 
Jul 26 2016
03498ff6475ajospin
Let the karbon plugin use the math parsing abilities 
Jul 24 2016
d4e2393560bcjospin
Some little changes in kritaui regarding the use of KisIntParseSpinBox. 
Jul 23 2016
f0a6472b426ajospin
Let all the filters use the math parser spinboxes. 
Jul 22 2016
1970da6ad2ccjospin
Let the widgets previously in kritawidgets use KisDoubleParseUnitSpinBox. 
Jul 21 2016
76c85f60f93ejospin
Move the classes that use KoUnitSpinBox from lib/widget in lib/ui/widget. 
Jul 21 2016
fb0fa0f52d24jospin
Use the parsespinboxes on all the dockers. 
Jul 21 2016
59d68b9d5fe6jospin
Create a replacement for KoUnitSpinBox that is able to parse math expression. 
Jul 21 2016
106a9e068945jospin
Let the slider spinboxes use the math expression parser. 
Jul 20 2016
32d0ceb9978ejospin
[numerical boxes] assert that all the functions from the image and layer menu… 
Jul 11 2016