cyberjunk / meridian59-dotnet

New 3D client and tools for Meridian 59
GNU General Public License v3.0
34 stars 35 forks source link

Resize MultiLineEditboxes to fit text where possible. #302

Closed skittles1 closed 5 years ago

skittles1 commented 5 years ago

Object descriptions (mainly for items) and spell descriptions tend to force a scrollbar on the inspection window as the window isn't large enough to display all the text. At the same time, a default larger window would look strange for short descriptions. This change dynamically resizes the window so more of the text will fit, from the current min up to the current max size.

Object inspection windows with inscriptions aren't resized as this is less of a problem, and the main focus (inscription editbox) on the most common items with inscriptions already uses the available max space.

Closes #31.

One question about this - instead of calling SetLayout() for a changed Description in UIObjectDetails.cpp, it could instead check if the object has an inscription and call Window->setHeight without all the other adjustments. Think that is better than the way it is now?

cyberjunk commented 5 years ago

One thing:

I think I would prefer if your new 'GetAdjustedWindowHeightWithMLEB()' would be inside ControllerUI. There are already some small CEGUI related helper functions there, like 'IsRecursiveChildOf()' or 'SetVUMeterColorFromProgress()'. And since it's exclusive to CEGUI (params, output and code uses nothing else and is called from nowhere else), I feel this would be the better place.

One question about this - instead of calling SetLayout() for a changed Description in UIObjectDetails.cpp, it could instead check if the object has an inscription and call Window->setHeight without all the other adjustments. Think that is better than the way it is now?

Not sure if I understand it, if it creates same behaviour with better code I'm always a fan of it :-)

skittles1 commented 5 years ago

Moved the function to ControllerUI and fixed up the SetLayout() call.

cyberjunk commented 5 years ago

Thanks