From 7ef12e5cad734146b5690f3bb04bc260d598c1c9 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Mon, 8 Apr 2013 22:40:06 -0400 Subject: [PATCH] Eliminated _UpdateControls(), some style fixes --- src/preferences/appearance/APRView.cpp | 33 ++++++++++++++------------ src/preferences/appearance/APRView.h | 1 - 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/preferences/appearance/APRView.cpp b/src/preferences/appearance/APRView.cpp index 3962de0c28..f86e4e926a 100644 --- a/src/preferences/appearance/APRView.cpp +++ b/src/preferences/appearance/APRView.cpp @@ -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. * * Authors: - * DarkWyrm (darkwyrm@earthlink.net) - * Rene Gollent (rene@gollent.com) + * DarkWyrm, darkwyrm@earthlink.net + * Rene Gollent, rene@gollent.com + * John Scipione, jscipione@gmail.com */ @@ -134,8 +135,8 @@ void APRView::MessageReceived(BMessage *msg) { if (msg->WasDropped()) { - rgb_color *color; - ssize_t size; + rgb_color* color = NULL; + ssize_t size = 0; if (msg->FindData("RGBColor", (type_code)'RGBC', (const void**)&color, &size) == B_OK) { @@ -153,6 +154,7 @@ APRView::MessageReceived(BMessage *msg) Window()->PostMessage(kMsgUpdate); break; } + case ATTRIBUTE_CHOSEN: { // Received when the user chooses a GUI fAttribute from the list @@ -169,6 +171,7 @@ APRView::MessageReceived(BMessage *msg) Window()->PostMessage(kMsgUpdate); break; } + default: BView::MessageReceived(msg); break; @@ -194,9 +197,13 @@ APRView::SetDefaults() { fCurrentSet = ColorSet::DefaultColorSet(); - _UpdateControls(); _UpdateAllColors(); + rgb_color color = fCurrentSet.GetColor(fWhich); + fPicker->SetValue(color); + fColorPreview->SetColor(color); + fColorPreview->Invalidate(); + Window()->PostMessage(kMsgUpdate); } @@ -206,9 +213,13 @@ APRView::Revert() { fCurrentSet = fPrevSet; - _UpdateControls(); _UpdateAllColors(); + rgb_color color = fCurrentSet.GetColor(fWhich); + fPicker->SetValue(color); + fColorPreview->SetColor(color); + fColorPreview->Invalidate(); + Window()->PostMessage(kMsgUpdate); } @@ -246,14 +257,6 @@ APRView::_SetCurrentColor(rgb_color color) { fCurrentSet.SetColor(fWhich, color); set_ui_color(fWhich, color); - _UpdateControls(); -} - - -void -APRView::_UpdateControls() -{ - rgb_color color = fCurrentSet.GetColor(fWhich); int32 currentIndex = fAttrList->CurrentSelection(); ColorWhichItem* item = (ColorWhichItem*)fAttrList->ItemAt(currentIndex); diff --git a/src/preferences/appearance/APRView.h b/src/preferences/appearance/APRView.h index 41b65cd54d..6f1317850a 100644 --- a/src/preferences/appearance/APRView.h +++ b/src/preferences/appearance/APRView.h @@ -52,7 +52,6 @@ public: private: void _SetCurrentColor(rgb_color color); - void _UpdateControls(); void _UpdateAllColors(); private: