mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Width of labels in native look editor is adjusted based on the longest label
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@449 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -58,6 +58,23 @@ void NativeLookEditor::resizeViewers() {
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
const int default_height = 17;
|
||||
// Determine label width
|
||||
{
|
||||
label_width = 0;
|
||||
wxClientDC dc(this);
|
||||
dc.SetFont(*wxNORMAL_FONT);
|
||||
FOR_EACH(v, viewers) {
|
||||
ValueEditor* e = v->getEditor();
|
||||
if (!e || e->drawLabel()) {
|
||||
// width of the label string
|
||||
int w;
|
||||
Style& s = *v->getStyle();
|
||||
String text = tr(*set->game, s.fieldP->name, capitalize_sentence(s.fieldP->name));
|
||||
dc.GetTextExtent(text,&w,nullptr);
|
||||
label_width = max(label_width, w + label_margin);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set editor sizes
|
||||
FOR_EACH(v, viewers) {
|
||||
StyleP s = v->getStyle();
|
||||
|
||||
Reference in New Issue
Block a user