Problem: Currently it is not possible to see everything in the
outliner when there are e.g. long icon rows. This is because Blender
does not allow panning the view to the right, since it does not
know the actual width.
Most of the code to compute the width correctly was there already,
but there were a couple of issues that made it not work.
- The tree width was computed before the tree was drawn. This does not work, since the width is only known, after it is drawn.
- Every TreeElement stores its right-most position in xend. However, in the current code, the xend of e.g. an object is the position where the text ends. The xend of the icons is stored in the sub-tree-elements. Therefore, to compute the maximum width, you may not skip the closed tree elements.
- The current drawing code had an early exit when the icon row would not be visible anymore. This also skipped the calculation of xend. So it would work correctly, when the icon was visible a little bit, but not when it was not visible at all.
This patch fixes these issues. So even in more complex files, the
width is computed correcly. At least I haven't found a case, where
it does not.
Unfortunately, it does so, by potentionally adding quite a bit of
overhead, since I had to disable some optimizations. I haven't
measured if this has a noticable effect yet.
In general we should decide whether it is really worth the effort
to compute the exact width. We could just use a high fixed width.
Since we scroll almost exclusively vertically, the impact on the
user is negilible. One downside is that the horizontal scrollbar
does not make any sense anymore then.
The when the outliner mode is set to Data API, we could just
align the second column to the right, so that we don't need the
tree width there.