Eliminated _UpdateControls(), some style fixes

This commit is contained in:
John Scipione
2013-04-08 23:11:42 -04:00
parent 4600a90cd0
commit 7ef12e5cad
2 changed files with 18 additions and 16 deletions
+18 -15
View File
@@ -1,10 +1,11 @@
/* /*
* Copyright 2002-2011, Haiku. All rights reserved. * Copyright 2002-2013 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* DarkWyrm ([email protected]) * DarkWyrm, [email protected]
* Rene Gollent ([email protected]) * Rene Gollent, [email protected]
* John Scipione, [email protected]
*/ */
@@ -134,8 +135,8 @@ void
APRView::MessageReceived(BMessage *msg) APRView::MessageReceived(BMessage *msg)
{ {
if (msg->WasDropped()) { if (msg->WasDropped()) {
rgb_color *color; rgb_color* color = NULL;
ssize_t size; ssize_t size = 0;
if (msg->FindData("RGBColor", (type_code)'RGBC', (const void**)&color, if (msg->FindData("RGBColor", (type_code)'RGBC', (const void**)&color,
&size) == B_OK) { &size) == B_OK) {
@@ -153,6 +154,7 @@ APRView::MessageReceived(BMessage *msg)
Window()->PostMessage(kMsgUpdate); Window()->PostMessage(kMsgUpdate);
break; break;
} }
case ATTRIBUTE_CHOSEN: case ATTRIBUTE_CHOSEN:
{ {
// Received when the user chooses a GUI fAttribute from the list // Received when the user chooses a GUI fAttribute from the list
@@ -169,6 +171,7 @@ APRView::MessageReceived(BMessage *msg)
Window()->PostMessage(kMsgUpdate); Window()->PostMessage(kMsgUpdate);
break; break;
} }
default: default:
BView::MessageReceived(msg); BView::MessageReceived(msg);
break; break;
@@ -194,9 +197,13 @@ APRView::SetDefaults()
{ {
fCurrentSet = ColorSet::DefaultColorSet(); fCurrentSet = ColorSet::DefaultColorSet();
_UpdateControls();
_UpdateAllColors(); _UpdateAllColors();
rgb_color color = fCurrentSet.GetColor(fWhich);
fPicker->SetValue(color);
fColorPreview->SetColor(color);
fColorPreview->Invalidate();
Window()->PostMessage(kMsgUpdate); Window()->PostMessage(kMsgUpdate);
} }
@@ -206,9 +213,13 @@ APRView::Revert()
{ {
fCurrentSet = fPrevSet; fCurrentSet = fPrevSet;
_UpdateControls();
_UpdateAllColors(); _UpdateAllColors();
rgb_color color = fCurrentSet.GetColor(fWhich);
fPicker->SetValue(color);
fColorPreview->SetColor(color);
fColorPreview->Invalidate();
Window()->PostMessage(kMsgUpdate); Window()->PostMessage(kMsgUpdate);
} }
@@ -246,14 +257,6 @@ APRView::_SetCurrentColor(rgb_color color)
{ {
fCurrentSet.SetColor(fWhich, color); fCurrentSet.SetColor(fWhich, color);
set_ui_color(fWhich, color); set_ui_color(fWhich, color);
_UpdateControls();
}
void
APRView::_UpdateControls()
{
rgb_color color = fCurrentSet.GetColor(fWhich);
int32 currentIndex = fAttrList->CurrentSelection(); int32 currentIndex = fAttrList->CurrentSelection();
ColorWhichItem* item = (ColorWhichItem*)fAttrList->ItemAt(currentIndex); ColorWhichItem* item = (ColorWhichItem*)fAttrList->ItemAt(currentIndex);
-1
View File
@@ -52,7 +52,6 @@ public:
private: private:
void _SetCurrentColor(rgb_color color); void _SetCurrentColor(rgb_color color);
void _UpdateControls();
void _UpdateAllColors(); void _UpdateAllColors();
private: private: