* Introduced a minimum cell size. This fixes bug #200.
* Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16680 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
422f5908e8
commit
68953d3a35
@ -21,9 +21,8 @@
|
|||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
const uint32 U_COLOR_CONTROL_RED_CHANGED_MSG = 'CCRC';
|
static const uint32 kMsgColorEntered = 'ccol';
|
||||||
const uint32 U_COLOR_CONTROL_GREEN_CHANGED_MSG = 'CCGC';
|
static const uint32 kMinCellSize = 6;
|
||||||
const uint32 U_COLOR_CONTROL_BLUE_CHANGED_MSG = 'CCBC';
|
|
||||||
|
|
||||||
|
|
||||||
BColorControl::BColorControl(BPoint leftTop, color_control_layout layout,
|
BColorControl::BColorControl(BPoint leftTop, color_control_layout layout,
|
||||||
@ -62,7 +61,7 @@ BColorControl::_InitData(color_control_layout layout, float size,
|
|||||||
{
|
{
|
||||||
fColumns = layout;
|
fColumns = layout;
|
||||||
fRows = 256 / fColumns;
|
fRows = 256 / fColumns;
|
||||||
fCellSize = size;
|
fCellSize = max_c(kMinCellSize, size);
|
||||||
fFocusedComponent = 0;
|
fFocusedComponent = 0;
|
||||||
|
|
||||||
if (archive) {
|
if (archive) {
|
||||||
@ -82,7 +81,7 @@ BColorControl::_InitData(color_control_layout layout, float size,
|
|||||||
// red
|
// red
|
||||||
|
|
||||||
fRedText = new BTextControl(rect, "_red", "Red:", "0",
|
fRedText = new BTextControl(rect, "_red", "Red:", "0",
|
||||||
new BMessage('ccol'), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
new BMessage(kMsgColorEntered), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
B_WILL_DRAW | B_NAVIGABLE);
|
||||||
fRedText->SetDivider(labelWidth);
|
fRedText->SetDivider(labelWidth);
|
||||||
|
|
||||||
@ -98,7 +97,7 @@ BColorControl::_InitData(color_control_layout layout, float size,
|
|||||||
|
|
||||||
rect.OffsetBy(0.0f, offset);
|
rect.OffsetBy(0.0f, offset);
|
||||||
fGreenText = new BTextControl(rect, "_green", "Green:", "0",
|
fGreenText = new BTextControl(rect, "_green", "Green:", "0",
|
||||||
new BMessage('ccol'), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
new BMessage(kMsgColorEntered), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
B_WILL_DRAW | B_NAVIGABLE);
|
||||||
fGreenText->SetDivider(labelWidth);
|
fGreenText->SetDivider(labelWidth);
|
||||||
|
|
||||||
@ -112,7 +111,7 @@ BColorControl::_InitData(color_control_layout layout, float size,
|
|||||||
|
|
||||||
rect.OffsetBy(0.0f, offset);
|
rect.OffsetBy(0.0f, offset);
|
||||||
fBlueText = new BTextControl(rect, "_blue", "Blue:", "0",
|
fBlueText = new BTextControl(rect, "_blue", "Blue:", "0",
|
||||||
new BMessage('ccol'), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
new BMessage(kMsgColorEntered), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW | B_NAVIGABLE);
|
B_WILL_DRAW | B_NAVIGABLE);
|
||||||
fBlueText->SetDivider(labelWidth);
|
fBlueText->SetDivider(labelWidth);
|
||||||
|
|
||||||
@ -287,10 +286,9 @@ void
|
|||||||
BColorControl::MessageReceived(BMessage *message)
|
BColorControl::MessageReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case 'ccol':
|
case kMsgColorEntered:
|
||||||
{
|
{
|
||||||
rgb_color color;
|
rgb_color color;
|
||||||
|
|
||||||
color.red = strtol(fRedText->Text(), NULL, 10);
|
color.red = strtol(fRedText->Text(), NULL, 10);
|
||||||
color.green = strtol(fGreenText->Text(), NULL, 10);
|
color.green = strtol(fGreenText->Text(), NULL, 10);
|
||||||
color.blue = strtol(fBlueText->Text(), NULL, 10);
|
color.blue = strtol(fBlueText->Text(), NULL, 10);
|
||||||
@ -449,7 +447,7 @@ BColorControl::_UpdateOffscreen(BRect update)
|
|||||||
void
|
void
|
||||||
BColorControl::SetCellSize(float cellSide)
|
BColorControl::SetCellSize(float cellSide)
|
||||||
{
|
{
|
||||||
fCellSize = cellSide;
|
fCellSize = max_c(kMinCellSize, cellSide);
|
||||||
|
|
||||||
ResizeToPreferred();
|
ResizeToPreferred();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user