enhance usage of units in the Quick Start wizard (Geometry tab)#3156
enhance usage of units in the Quick Start wizard (Geometry tab)#3156octaeder wants to merge 5 commits intotexstudio-org:masterfrom
Conversation
remove code: it makes no sense enabling (setChecked) the row where you changed a unit. If it where not enabled then you couldn't change the unit (nor the value).
use function and it's inverse: When you change a unit then recalculate the value: 1.5cm = 15mm
Units must be setup first, then the values. Otherwise value is first used with unit mm and then adopted to the given unit. But this is wrong.
|
hmmm, what is the use case for this ? From a GUI point of view, having the units twice is undesired. |
|
Your case has a quite simple solution: Choose your unit first. You may have to copy paste your number, but that can be done without thinking: When you notice that changing the unit also changes the value, then undo the change of unit, copy the number to clipboard, change the unit again and past the number. The user will quickly learn that changing a unit will change the number. Since conversion ratios are not close to 1 it's quite unlikely that you used 18cm previously and now you want to use 18in from some source, because 18in is a quite large size. So in this case it's likely that you will need new numbers. But what do you do when your source states a length in unit "in" or "pt" but you are used to or all your other lengths are already in mm or cm? Then you need a calculator, must know the conversion rule, and must retype the new numbers. This is quite complicated. Another case: You want to do your setup with mouse clicks. Then changing from 100mm to 10cm might be useful so 5 clicks are enough to change value from 10cm to value 15cm. But if you start with 100mm then this would be nearly impossible. Or you want to go on from 15cm to 15.5cm. Here you could change to 150mm, use 5 clicks and you are done, or you change back to 15.5cm in case you prefer cm in your LaTeX document. In addition: I can remove the suffix from the spin boxes. Please confirm that I should do so. |
|
Note: When units are changed we need the old and the new unit to know how to convert the number. Currently the old value is derived from the suffix of the spin box value. So the suffixes must be replaced by some variables holding the old unit. |
|
From my point of view, use case of quick start/geometry in descending order of probability:
In any case, the change makes a probable scenario harder to use in favor of a very unlikely one. |
|
new PR #3157 |
This PR enhances the page geometry configuration that is part of the Quick Start wizard. It addresses following observations.
Lengths are given with a number combined with a unit. When you change the unit from cm to mm the number is not adjusted (image). Simply changing the unit means that the length shrinks to one tenth of the original length in this case. Even so the image doesn't change (workaround: change temp. the number with up/down buttons). In fact the image should not change but the number should increase by a factor of 10. This is implemented by the PR.
You can enter unknown units (like pico meters pm or nano meters nm) or even any text. In this case dialog uses mm internally. Unit dm is not in the list of the combo boxes, but is recognized when you enter it manually. But dm is not known to LaTeX. In fact there is no reason why one should enter units manually (in general necessary unit conversion formulae would miss). The PR therefore sets attribute editable to false for those combo boxes.
Test
Changing units: 127mm = 12.7cm = 5in (since 25.4*5=125+2=127):
These values are correctly saved in and loaded from the ini file. The LaTeX code looks fine: