BColorControl: Create _SetCellSize() method
...eliminating duplicated code.
This commit is contained in:
@@ -102,6 +102,7 @@ private:
|
|||||||
uint8 shade) const;
|
uint8 shade) const;
|
||||||
BRect _PaletteSelectorFrame(uint8 colorIndex) const;
|
BRect _PaletteSelectorFrame(uint8 colorIndex) const;
|
||||||
BRect _RampFrame(uint8 rampIndex) const;
|
BRect _RampFrame(uint8 rampIndex) const;
|
||||||
|
void _SetCellSize(float size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BRect fPaletteFrame;
|
BRect fPaletteFrame;
|
||||||
|
|||||||
@@ -84,7 +84,8 @@ BColorControl::_InitData(color_control_layout layout, float size,
|
|||||||
// so we take the main_screen colorspace at startup
|
// so we take the main_screen colorspace at startup
|
||||||
fColumns = layout;
|
fColumns = layout;
|
||||||
fRows = 256 / fColumns;
|
fRows = 256 / fColumns;
|
||||||
fCellSize = ceil(max_c(kMinCellSize, size));
|
|
||||||
|
_SetCellSize(size);
|
||||||
|
|
||||||
fSelectedPaletteColorIndex = -1;
|
fSelectedPaletteColorIndex = -1;
|
||||||
fPreviousSelectedPaletteColorIndex = -1;
|
fPreviousSelectedPaletteColorIndex = -1;
|
||||||
@@ -611,6 +612,13 @@ BColorControl::_RampFrame(uint8 rampIndex) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BColorControl::_SetCellSize(float size)
|
||||||
|
{
|
||||||
|
fCellSize = ceilf(max_c(kMinCellSize, size));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BRect
|
BRect
|
||||||
BColorControl::_PaletteSelectorFrame(uint8 colorIndex) const
|
BColorControl::_PaletteSelectorFrame(uint8 colorIndex) const
|
||||||
{
|
{
|
||||||
@@ -635,9 +643,9 @@ BColorControl::_InitOffscreen()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BColorControl::SetCellSize(float cellSide)
|
BColorControl::SetCellSize(float size)
|
||||||
{
|
{
|
||||||
fCellSize = ceil(max_c(kMinCellSize, cellSide));
|
_SetCellSize(size);
|
||||||
_LayoutView();
|
_LayoutView();
|
||||||
ResizeToPreferred();
|
ResizeToPreferred();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user