From 1f0b41ba7fdcc573354eea3e1354520d9a036023 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 7 Jun 2013 17:14:56 -0400 Subject: [PATCH] BColorControl: Position text controls better Position the text control vertically in the middle of the ramp in the case that the text controls are pushed down so that the red, green, and blue text controls are next to the red, green, and blue ramps. --- src/kits/interface/ColorControl.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/kits/interface/ColorControl.cpp b/src/kits/interface/ColorControl.cpp index c2c4888c8b..3ac5d50d7c 100644 --- a/src/kits/interface/ColorControl.cpp +++ b/src/kits/interface/ColorControl.cpp @@ -196,16 +196,17 @@ BColorControl::_LayoutView() fPaletteFrame.bottom -= 1; } - BRect rect = fPaletteFrame.InsetByCopy(-kBevelSpacing, -kBevelSpacing); - // frame including bevel - - float offset = floorf(rect.bottom / 4); - float y = offset; - if (offset < _TextRectOffset()) { - offset = _TextRectOffset(); - y = 0; + float rampHeight = (float)(fRows * fCellSize / kRampCount); + float offset = _TextRectOffset(); + float y = 0; + if (rampHeight > fRedText->Frame().Height()) { + // there is enough room to fit kRampCount labels, + // shift text controls down by one ramp + offset = rampHeight; + y = floorf(offset + (offset - fRedText->Frame().Height()) / 2); } + BRect rect = _PaletteFrame(); fRedText->MoveTo(rect.right + kTextFieldsHSpacing, y); y += offset;