From c1bbe7400c2108119a06c4c5b9cd1c4d616f9338 Mon Sep 17 00:00:00 2001 From: stippi Date: Wed, 3 Mar 2010 10:20:17 +0000 Subject: [PATCH] Improved coding style and the looks of the matched pattern in choices. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@275 94f232f2-1747-11df-bad5-a5bfde151594 --- .../AutoCompleterDefaultImpl.cpp | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/apps/webpositive/autocompletion/AutoCompleterDefaultImpl.cpp b/src/apps/webpositive/autocompletion/AutoCompleterDefaultImpl.cpp index 7818f5b81b..95ce32c7a0 100644 --- a/src/apps/webpositive/autocompletion/AutoCompleterDefaultImpl.cpp +++ b/src/apps/webpositive/autocompletion/AutoCompleterDefaultImpl.cpp @@ -243,15 +243,19 @@ void BDefaultChoiceView::ListItem::DrawItem(BView* owner, BRect frame, bool complete) { - rgb_color textCol, backCol, matchCol; + rgb_color textColor; + rgb_color nonMatchTextColor; + rgb_color backColor; + rgb_color matchColor; if (IsSelected()) { - textCol = ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR); - backCol = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR); + textColor = ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR); + backColor = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR); } else { - textCol = ui_color(B_DOCUMENT_TEXT_COLOR); - backCol = ui_color(B_DOCUMENT_BACKGROUND_COLOR); + textColor = ui_color(B_DOCUMENT_TEXT_COLOR); + backColor = ui_color(B_DOCUMENT_BACKGROUND_COLOR); } - matchCol = tint_color(backCol, (B_NO_TINT + B_DARKEN_1_TINT) / 2); + matchColor = tint_color(backColor, (B_NO_TINT + B_DARKEN_1_TINT) / 2); + nonMatchTextColor = tint_color(backColor, 1.7); BFont font; font_height fontHeight; @@ -262,26 +266,28 @@ BDefaultChoiceView::ListItem::DrawItem(BView* owner, BRect frame, float w; if (fPreText.Length()) { w = owner->StringWidth(fPreText.String()); - owner->SetLowColor(backCol); + owner->SetLowColor(backColor); owner->FillRect(BRect(xPos, frame.top, xPos + w - 1, frame.bottom), B_SOLID_LOW); - owner->SetHighColor(textCol); + owner->SetHighColor(nonMatchTextColor); owner->DrawString(fPreText.String(), BPoint(xPos, yPos)); xPos += w; } if (fMatchText.Length()) { w = owner->StringWidth(fMatchText.String()); - owner->SetLowColor(matchCol); + owner->SetLowColor(matchColor); owner->FillRect(BRect(xPos, frame.top, xPos + w - 1, frame.bottom), B_SOLID_LOW); + owner->SetHighColor(textColor); owner->DrawString(fMatchText.String(), BPoint(xPos, yPos)); xPos += w; } if (fPostText.Length()) { w = owner->StringWidth(fPostText.String()); - owner->SetLowColor(backCol); + owner->SetLowColor(backColor); owner->FillRect(BRect(xPos, frame.top, xPos + w - 1, frame.bottom), B_SOLID_LOW); + owner->SetHighColor(nonMatchTextColor); owner->DrawString(fPostText.String(), BPoint(xPos, yPos)); } }