speedcrunch/SpeedCrunch — pull request #40 by peclik (2014-09-26 20:44:44+00:00)
Title: Formats widget showing edited expression's result in different formats

Hi, I've added new Formats widget:

![formats](https://cloud.githubusercontent.com/assets/589865/4427297/ae21f20e-45bd-11e4-9131-79ac80f096ca.png)

* New dockable widget Formats - showing number in different formats; Hex, Bin, Oct, Exp. On the right are toggle buttons switching H <-> h format etc. (see below).

* Number are updated "online" how user edits number in editor (turning Partial result off will disable this feature).

* Added new function compln(n; bits) - similar to mask() for negative numbers but determines number of bits automatically from number and uses the least multiple of 'bits'. Real number is always truncated to integer (probably you can think out better name for it).

* To HMath::format added formats H, O, B formatting using new function compln().

* Docking system adjusted - I think it make more sense that corners are occupied by left and right dock areas (than top and bottom).

* New highlighting role - ResultApprox used in Formats widget to denote real numbers truncated to integer.

Future work:

* I was thinking about formatting numbers in two's complement notation with special tag, so that they can be used in editor and parsed as negative numbers.

* I am not sure now, what tag to use: e.g. 0X, 0B, 0O (uppercase letters) - but 0OF0 can be confusing, or 2x, 2b, 2o - noting the two's complement, but looks weird.

* I only started some changes for support of 2x..., but it's commented out for now. Anyway, I'm not brave anough to change floatio lib for this; I've only added future support to ResultDisplay::appendHistory().

* It would be good to add also two's complement forms to Result output format options, but it would require parsing of 2xNNN format.