apps: Convert to using Set*UIColor.

Signed-off-by: Augustin Cavalier <[email protected]>
Patches 0045-0075, 0077-0087 from looncraz, unmodified.
This commit is contained in:
looncraz
2016-01-04 07:33:09 -05:00
committed by Augustin Cavalier
parent f696e88a2c
commit fa19dd4470
108 changed files with 713 additions and 282 deletions
@@ -171,7 +171,7 @@ TeamMonitorWindow::TeamMonitorWindow()
layout->SetSpacing(inset);
SetLayout(layout);
layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
layout->View()->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fListView = new BListView("teams");
fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM));
@@ -606,7 +606,7 @@ TeamDescriptionView::TeamDescriptionView()
BAlignment(B_ALIGN_HORIZONTAL_UNSET, B_ALIGN_VERTICAL_CENTER));
BView* teamPropertiesView = new BView("team properties", B_WILL_DRAW);
teamPropertiesView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
teamPropertiesView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
teamPropertiesView->SetLayout(layout);
BGroupLayoutBuilder(layout)
@@ -738,7 +738,7 @@ AllShowingTextView::AllShowingTextView(const char* name)
{
MakeEditable(false);
MakeSelectable(false);
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -65,7 +65,7 @@ RuleFilterConfig::RuleFilterConfig(const BMailAddOnSettings& addOnSettings)
BMailSettingsView("rulefilter_config"),
fActionMenu(NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
MatchHeaderSettings settings(addOnSettings);
fAction = settings.Action();
@@ -32,7 +32,7 @@ NotifierConfigView::NotifierConfigView()
:
BMailSettingsView("notifier_config")
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false);
@@ -77,7 +77,7 @@ SpamFilterConfig::SpamFilterConfig(const BMessage* settings)
if (settings->FindFloat("SpamCutoffRatio", &fSpamCutoffRatio) != B_OK)
fSpamCutoffRatio = 0.99f;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fSubjectHintCheckBox = new BCheckBox("AddToSubject",
B_TRANSLATE("Add spam rating to start of subject"), NULL);
@@ -26,7 +26,7 @@ ConfigView::ConfigView()
:
BMailSettingsView("fortune_filter")
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fFileView = new MailFileConfigView(B_TRANSLATE("Fortune file:"),
"fortune_file", false, "", B_FILE_NODE);
@@ -56,7 +56,7 @@ DocInfoWindow::DocInfoWindow(BMessage *docInfo)
{
BRect bounds(Bounds());
BView *background = new BView(bounds, "bachground", B_FOLLOW_ALL, B_WILL_DRAW);
background->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
background->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(background);
bounds.InsetBy(10.0, 10.0);
@@ -238,7 +238,7 @@ DocInfoWindow::_SetupDocInfoView(BBox* panel)
bounds.right -= B_V_SCROLL_BAR_WIDTH;
bounds.InsetBy(2.0, 2.0);
fTable = new BView(bounds, "table", B_FOLLOW_ALL, B_WILL_DRAW);
fTable->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fTable->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTableScrollView = new BScrollView("scroll_table", fTable, B_FOLLOW_ALL, 0,
false, true);
@@ -124,7 +124,7 @@ FontsWindow::FontsWindow(Fonts *fonts)
// add a *dialog* background
BView* embeddingPanel = new BView("Embedding", B_WILL_DRAW
| B_FRAME_EVENTS | B_NAVIGABLE_JUMP);
embeddingPanel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
embeddingPanel->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// add font list
#if USE_CLV
@@ -166,7 +166,7 @@ FontsWindow::FontsWindow(Fonts *fonts)
// add a *dialog* background
BView* cjkPanel = new BView("CJK", B_WILL_DRAW | B_FRAME_EVENTS
| B_NAVIGABLE_JUMP);
cjkPanel->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
cjkPanel->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BListView* list =
new DragListView(BRect(),
@@ -88,7 +88,7 @@ SetupView::SetupView(BRect frame, BDirectory* directory)
: BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW),
fPrinterDirectory(directory)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -78,7 +78,7 @@ private:
IppSetupView::IppSetupView(BRect frame, BDirectory *d)
: BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW), dir(d)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
void IppSetupView::AttachedToWindow()
@@ -91,7 +91,7 @@ LprSetupView::LprSetupView(BRect frame, BDirectory *d)
:
BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW), fDir(d)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -32,7 +32,7 @@ GLifeConfig::GLifeConfig(BRect frame, GLifeState* pglsState)
m_pglsState(pglsState)
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// Info text
BStringView* name = new BStringView(frame, B_EMPTY_STRING,
@@ -40,7 +40,7 @@ ConfigView::ConfigView(BRect frame, Gravity* parent)
B_WILL_DRAW | B_NAVIGABLE))
{
SetLayout(new BGroupLayout(B_HORIZONTAL));
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fShadeList->SetSelectionMessage(new BMessage(kMsgShade));
+1 -1
View File
@@ -604,7 +604,7 @@ SettingsView::SettingsView(BRect frame)
void
SettingsView::AttachedToWindow()
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fWidthMenu->Menu()->SetTargetForItems(this);
fColorMenu->Menu()->SetTargetForItems(this);
@@ -60,7 +60,7 @@ SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name,
{
fSettings = settings;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BMessage *pMsg;
int32 val;
@@ -338,7 +338,7 @@ SpiderView::SpiderView(BRect frame, SpiderSaver* saver,
: BView(frame, "spider view", B_FOLLOW_NONE, B_WILL_DRAW | B_PULSE_NEEDED),
fSaver(saver)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
frame.OffsetTo(0.0, 0.0);
frame.InsetBy(10.0, 5.0);
+63 -11
View File
@@ -32,6 +32,7 @@
#include <MessageFormat.h>
#include <MessageRunner.h>
#include <Messenger.h>
#include <ObjectList.h>
#include <OS.h>
#include <Path.h>
#include <PathFinder.h>
@@ -143,11 +144,15 @@ public:
};
class AboutView;
class AboutWindow : public BWindow {
public:
AboutWindow();
virtual bool QuitRequested();
AboutView* fAboutView;
};
@@ -192,6 +197,7 @@ public:
~AboutView();
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void Pulse();
virtual void MessageReceived(BMessage* msg);
@@ -207,6 +213,7 @@ public:
void PickRandomHaiku();
void _AdjustTextColors();
private:
typedef std::map<std::string, PackageCredit*> PackageCreditMap;
@@ -220,10 +227,13 @@ private:
void _AddPackageCreditEntries();
BStringView* fMemView;
BTextView* fUptimeView;
BStringView* fUptimeView;
BView* fInfoView;
HyperTextView* fCreditsView;
BObjectList<BView> fTextViews;
BObjectList<BView> fSubTextViews;
BBitmap* fLogo;
bigtime_t fLastActionTime;
@@ -267,7 +277,8 @@ AboutWindow::AboutWindow()
B_TITLED_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS | B_NOT_ZOOMABLE)
{
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(new AboutView());
fAboutView = new AboutView();
AddChild(fAboutView);
// Make sure we take the minimal window size into account when centering
BSize size = GetLayout()->MinSize();
@@ -411,7 +422,6 @@ AboutView::AboutView()
fScrollRunner(NULL)
{
// Begin Construction of System Information controls
system_info systemInfo;
get_system_info(&systemInfo);
@@ -449,10 +459,12 @@ AboutView::AboutView()
}
BStringView* versionView = new BStringView("ostext", string);
fSubTextViews.AddItem(versionView);
versionView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
BStringView* abiView = new BStringView("abitext", B_HAIKU_ABI_NAME);
fSubTextViews.AddItem(abiView);
abiView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
@@ -500,6 +512,7 @@ AboutView::AboutView()
<< " " << get_cpu_model_string(platform, cpuVendor, cpuModel);
BStringView* cpuView = new BStringView("cputext", cpuType.String());
fSubTextViews.AddItem(cpuView);
cpuView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
@@ -511,16 +524,20 @@ AboutView::AboutView()
clockSpeed / 1000.0f);
BStringView* frequencyView = new BStringView("frequencytext", string);
fSubTextViews.AddItem(frequencyView);
frequencyView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
// RAM
BStringView *memSizeView = new BStringView("ramsizetext",
MemSizeToString(string, sizeof(string), &systemInfo));
fSubTextViews.AddItem(memSizeView);
memSizeView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
fMemView = new BStringView("ramtext",
MemUsageToString(string, sizeof(string), &systemInfo));
fSubTextViews.AddItem(fMemView);
fMemView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
@@ -539,22 +556,19 @@ AboutView::AboutView()
buildTimeDate.SetTo(kernelTimeDate);
BStringView* kernelView = new BStringView("kerneltext", buildTimeDate);
fSubTextViews.AddItem(kernelView);
kernelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
// Uptime
fUptimeView = new BTextView("uptimetext");
fUptimeView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fUptimeView->MakeEditable(false);
fUptimeView->MakeSelectable(false);
fUptimeView->SetWordWrap(true);
fUptimeView = new BStringView("uptimetext", "...");
fSubTextViews.AddItem(fUptimeView);
fUptimeView->SetText(UptimeToString(string, sizeof(string)));
const float offset = 5;
SetLayout(new BGroupLayout(B_HORIZONTAL, 0));
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BLayoutBuilder::Group<>((BGroupLayout*)GetLayout())
.AddGroup(B_VERTICAL, 0)
@@ -608,6 +622,14 @@ AboutView::AttachedToWindow()
BView::AttachedToWindow();
Window()->SetPulseRate(500000);
SetEventMask(B_POINTER_EVENTS);
DoLayout();
}
void
AboutView::AllAttached()
{
_AdjustTextColors();
}
@@ -647,6 +669,13 @@ void
AboutView::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case B_COLORS_UPDATED:
{
if (msg->HasColor(ui_color_name(B_PANEL_TEXT_COLOR)))
_AdjustTextColors();
break;
}
case SCROLL_CREDITS_VIEW:
{
BScrollBar* scrollBar =
@@ -816,6 +845,28 @@ AboutView::PickRandomHaiku()
}
void
AboutView::_AdjustTextColors()
{
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
rgb_color color = mix_color(ViewColor(), textColor, 192);
BView* view = NULL;
for (int32 index = 0; index < fSubTextViews.CountItems(); ++index) {
view = fSubTextViews.ItemAt(index);
view->SetHighColor(color);
view->Invalidate();
}
// Labels
for (int32 index = 0; index < fTextViews.CountItems(); ++index) {
view = fTextViews.ItemAt(index);
view->SetHighColor(textColor);
view->Invalidate();
}
}
BView*
AboutView::_CreateLabel(const char* name, const char* label)
{
@@ -823,6 +874,7 @@ AboutView::_CreateLabel(const char* name, const char* label)
labelView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_UNSET));
labelView->SetFont(be_bold_font);
fTextViews.AddItem(labelView);
return labelView;
}
@@ -837,7 +889,7 @@ AboutView::_CreateCreditsView()
fCreditsView->MakeEditable(false);
fCreditsView->SetWordWrap(true);
fCreditsView->SetInsets(5, 5, 5, 5);
fCreditsView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
fCreditsView->SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR);
BScrollView* creditsScroller = new BScrollView("creditsScroller",
fCreditsView, B_WILL_DRAW | B_FRAME_EVENTS, false, true,
+1 -1
View File
@@ -1,6 +1,6 @@
SubDir HAIKU_TOP src apps aboutsystem ;
UsePrivateHeaders app libroot shared ;
UsePrivateHeaders app interface libroot shared ;
Application AboutSystem :
AboutSystem.cpp
+5 -4
View File
@@ -576,7 +576,7 @@ ActivityView::ActivityView(const char* name, const BMessage* settings)
#endif
fSourcesLock("data sources")
{
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowUIColor(B_PANEL_BACKGROUND_COLOR);
_Init(settings);
@@ -1121,7 +1121,6 @@ ActivityView::MessageReceived(BMessage* message)
break;
}
case kMsgUpdateResolution:
{
int32 resolution;
@@ -1479,7 +1478,9 @@ ActivityView::Draw(BRect updateRect)
// draw legend
BRect legendFrame = _LegendFrame();
SetLowColor(fLegendBackgroundColor);
if (LowUIColor() == B_NO_COLOR)
SetLowColor(fLegendBackgroundColor);
if (drawBackground) {
BRect backgroundFrame(legendFrame);
backgroundFrame.bottom += kDraggerSize;
@@ -1520,7 +1521,7 @@ ActivityView::Draw(BRect updateRect)
TruncateString(&label, B_TRUNCATE_MIDDLE, possibleLabelWidth);
if (drawBackground)
SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
if (be_control_look == NULL) {
DrawString(label.String(), BPoint(6 + colorBox.right, y));
+1 -2
View File
@@ -68,8 +68,8 @@ ActivityWindow::ActivityWindow()
fLayout->SetSpacing(inset);
BView* top = new BView("top", 0, fLayout);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
layout->AddView(top);
top->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BMessage viewState;
int32 count = 0;
@@ -99,7 +99,6 @@ ActivityWindow::ActivityWindow()
topRect.top = menuBar->Bounds().bottom + 1;
BView* top = new BView(topRect, "top", B_FOLLOW_ALL, 0);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
layout->AddChild(top);
BMessage viewState;
@@ -38,6 +38,7 @@ public:
SetLimitLabels(min.String(), max.String());
SetHashMarks(B_HASH_MARKS_BOTTOM);
SetHashMarkCount(levels);
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
if (message != NULL)
SetModificationMessage(new BMessage(*message));
+7 -1
View File
@@ -34,7 +34,13 @@ BootManagerWindow::BootManagerWindow()
{
float minWidth, maxWidth, minHeight, maxHeight;
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
SetSizeLimits(250, maxWidth, 250, maxHeight);
// Use font to determine necessary size of window:
const BFont* font = be_plain_font;
minWidth = 400 * (double)font->Size() / 12.0f;
minHeight = 250 * (double)font->Size() / 12.0f;
SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
fWizardView = new WizardView("wizard");
BLayoutBuilder::Group<>(this)
+15 -5
View File
@@ -21,7 +21,7 @@ WizardPageView::WizardPageView(BMessage* settings, BRect frame,
BView(frame, name, resizingMode, flags),
fSettings(settings)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -30,7 +30,7 @@ WizardPageView::WizardPageView(BMessage* settings, const char* name)
BView(name, B_WILL_DRAW),
fSettings(settings)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -54,9 +54,10 @@ WizardPageView::CreateDescription(BRect frame, const char* name,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS);
view->MakeEditable(false);
view->SetViewColor(ViewColor());
view->SetViewUIColor(ViewUIColor());
view->SetStylable(true);
view->SetText(description);
return view;
}
@@ -67,9 +68,10 @@ WizardPageView::CreateDescription(const char* name,
{
BTextView* view = new BTextView("text");
view->MakeEditable(false);
view->SetViewColor(ViewColor());
view->SetViewUIColor(ViewUIColor());
view->SetStylable(true);
view->SetText(description);
return view;
}
@@ -84,7 +86,15 @@ WizardPageView::MakeHeading(BTextView* view)
BFont font;
view->GetFont(&font);
font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, indexFirstLineEnd, &font);
font.SetSize(font.Size() + 1);
rgb_color color = ui_color(B_PANEL_TEXT_COLOR);
view->SetFontAndColor(0, indexFirstLineEnd, &font, B_FONT_ALL,
&color);
font.SetFace(B_REGULAR_FACE);
font.SetSize(font.Size() - 1);
view->SetFontAndColor(indexFirstLineEnd + 1, view->TextLength(),
&font, B_FONT_ALL, &color);
}
}
+13 -3
View File
@@ -237,6 +237,8 @@ CharacterView::AttachedToWindow()
{
Window()->AddShortcut('C', B_SHIFT_KEY,
new BMessage(kMsgCopyAsEscapedString), this);
SetViewColor(255, 255, 255, 255);
SetLowColor(ViewColor());
}
@@ -402,6 +404,11 @@ CharacterView::Draw(BRect updateRect)
BFont font;
GetFont(&font);
rgb_color color = (rgb_color){0, 0, 0, 255};
rgb_color highlight = (rgb_color){220, 220, 220, 255};
rgb_color enclose = mix_color(highlight,
ui_color(B_CONTROL_HIGHLIGHT_COLOR), 128);
for (int32 i = _BlockAt(updateRect.LeftTop()); i < (int32)kNumUnicodeBlocks;
i++) {
if (!IsShowingBlock(i))
@@ -411,7 +418,7 @@ CharacterView::Draw(BRect updateRect)
if (y > updateRect.bottom)
break;
SetHighColor(0, 0, 0);
SetHighColor(color);
DrawString(kUnicodeBlocks[i].name, BPoint(3, y + fTitleBase));
y += fTitleHeight;
@@ -424,11 +431,14 @@ CharacterView::Draw(BRect updateRect)
&& y < updateRect.bottom) {
// Stroke frame around the active character
if (fHasCharacter && fCurrentCharacter == c) {
SetHighColor(tint_color(ViewColor(), 1.05f));
SetHighColor(highlight);
FillRect(BRect(x, y, x + fCharacterWidth,
y + fCharacterHeight - fGap));
SetHighColor(enclose);
StrokeRect(BRect(x, y, x + fCharacterWidth,
y + fCharacterHeight - fGap));
SetHighColor(0, 0, 0);
SetHighColor(color);
}
// Draw character
@@ -181,9 +181,9 @@ InspectorWindow::_Init()
.End()
.End();
fHexMode->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fEndianMode->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fTextMode->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fHexMode->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fEndianMode->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTextMode->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
int32 targetEndian = fTeam->GetArchitecture()->IsBigEndian()
? EndianModeBigEndian : EndianModeLittleEndian;
@@ -149,7 +149,7 @@ void
MemoryView::AttachedToWindow()
{
BView::AttachedToWindow();
SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR);
SetFont(be_fixed_font);
fCharWidth = be_fixed_font->StringWidth("a");
font_height fontHeight;
@@ -689,7 +689,7 @@ MemoryView::MaxSize()
void
MemoryView::_Init()
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -57,7 +57,7 @@ ExpressionPromptWindow::_Init()
BLayoutItem* inputItem = fExpressionInput->CreateTextViewLayoutItem();
inputItem->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET));
inputItem->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
labelItem->View()->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BLayoutBuilder::Group<>(this, B_VERTICAL)
.SetInsets(B_USE_DEFAULT_SPACING)
@@ -127,7 +127,7 @@ WatchPromptWindow::_Init()
fTypeField = new BMenuField("Type:", typeMenu);
BLayoutItem* labelItem = fTypeField->CreateLabelLayoutItem();
labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
labelItem->View()->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BLayoutBuilder::Group<>(this, B_VERTICAL)
.SetInsets(B_USE_DEFAULT_SPACING)
.AddGroup(B_HORIZONTAL, 4.0f)
+11 -6
View File
@@ -231,6 +231,12 @@ CalcView::AttachedToWindow()
void
CalcView::MessageReceived(BMessage* message)
{
if (message->what == B_COLORS_UPDATED
&& message->HasColor(ui_color_name(B_PANEL_BACKGROUND_COLOR))) {
_Colorize();
return;
}
if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
// if we are embedded in desktop we need to receive these
// message here since we don't have a parent BWindow
@@ -504,7 +510,7 @@ CalcView::Draw(BRect updateRect)
be_control_look->DrawLabel(this, key->label, frame, updateRect,
fBaseColor, flags, BAlignment(B_ALIGN_HORIZONTAL_CENTER,
B_ALIGN_VERTICAL_CENTER));
B_ALIGN_VERTICAL_CENTER), &fButtonTextColor);
key++;
}
@@ -1288,6 +1294,8 @@ CalcView::_AudioFeedback(bool inBackGround)
void
CalcView::_Colorize()
{
fBaseColor = ui_color(B_PANEL_BACKGROUND_COLOR);
// calculate light and dark color from base color
fLightColor.red = (uint8)(fBaseColor.red * 1.25);
fLightColor.green = (uint8)(fBaseColor.green * 1.25);
@@ -1300,16 +1308,13 @@ CalcView::_Colorize()
fDarkColor.alpha = 255;
// keypad text color
uint8 lightness = (fBaseColor.red + fBaseColor.green + fBaseColor.blue) / 3;
if (lightness > 200)
if (fBaseColor.Brightness() > 100)
fButtonTextColor = (rgb_color){ 0, 0, 0, 255 };
else
fButtonTextColor = (rgb_color){ 255, 255, 255, 255 };
// expression text color
lightness = (fExpressionBGColor.red
+ fExpressionBGColor.green + fExpressionBGColor.blue) / 3;
if (lightness > 200)
if (fExpressionBGColor.Brightness() > 100)
fExpressionTextColor = (rgb_color){ 0, 0, 0, 255 };
else
fExpressionTextColor = (rgb_color){ 255, 255, 255, 255 };
+24 -4
View File
@@ -26,7 +26,7 @@ PropertyListPlain::PropertyListPlain(const char* name)
:
BView(name, 0, NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLayout(new BGroupLayout(B_VERTICAL));
}
@@ -42,10 +42,13 @@ PropertyListPlain::AddAttributes(const Attributes& attributes)
{
RemoveAll();
BGroupLayoutBuilder layout(B_VERTICAL);
BTextView* view = new BTextView(BRect(0, 0, 1000, 1000),
"", BRect(5, 5, 995, 995), B_FOLLOW_ALL_SIDES);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BTextView* view = new BTextView(BRect(0, 0, 1000, 1000),
"attribs", BRect(5, 5, 995, 995), B_FOLLOW_ALL_SIDES);
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
view->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
view->MakeEditable(false);
for (unsigned int i = 0; i < attributes.size(); i++) {
@@ -59,6 +62,7 @@ PropertyListPlain::AddAttributes(const Attributes& attributes)
}
layout.Add(view);
fAttributeViews.AddItem(view);
AddChild(layout);
}
@@ -78,6 +82,22 @@ void
PropertyListPlain::MessageReceived(BMessage* message)
{
switch (message->what) {
case B_COLORS_UPDATED:
{
rgb_color color;
if (message->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color)
!= B_OK)
break;
BTextView* view = NULL;
int32 count = fAttributeViews.CountItems();
for (int32 index = 0; index < count; ++index) {
view = fAttributeViews.ItemAt(index);
view->SetFontAndColor(be_plain_font, 0, &color);
}
break;
}
default:
BView::MessageReceived(message);
}
+3
View File
@@ -10,6 +10,8 @@
#define PROPERTY_LIST_PLAIN_H
#include <ObjectList.h>
#include <TextView.h>
#include <View.h>
#include "Device.h"
@@ -28,6 +30,7 @@ public:
virtual void DetachedFromWindow();
private:
BView* rootView;
BObjectList<BTextView> fAttributeViews;
};
#endif /* PROPERTY_LIST_PLAIN_H */
+1 -1
View File
@@ -220,7 +220,7 @@ void ResourceUsageWindow::InitWindow(BList &list)
// Create the TabView and Tabs
BTabView *tabView = new BTabView(rtab,"resource_usage_tabview");
tabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tabView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
rtab = tabView->Bounds();
rtab.InsetBy(5,5);
+1 -1
View File
@@ -492,7 +492,7 @@ FindWindow::FindWindow(BRect _rect, BMessage& previous, BMessenger& target,
fTarget(target)
{
BView* view = new BView(Bounds(), "main", B_FOLLOW_ALL, 0);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(view);
int8 mode = kAsciiMode;
+3 -3
View File
@@ -251,7 +251,7 @@ IconView::AttachedToWindow()
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -480,7 +480,7 @@ HeaderView::HeaderView(const entry_ref *ref, DataEditor &editor)
fPosition(0),
fLastPosition(0)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
GridLayout()->SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING);
@@ -1102,7 +1102,7 @@ TypeView::TypeView(BRect rect, const char* name, int32 index,
DataEditor& editor, int32 resizingMode)
: BView(rect, name, resizingMode, B_FRAME_EVENTS)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTypeEditorView = GetTypeEditorAt(index, Frame(), editor);
if (fTypeEditorView == NULL) {
+8 -8
View File
@@ -205,7 +205,7 @@ TypeEditorView::TypeMatches()
StringEditor::StringEditor(DataEditor& editor)
: TypeEditorView(B_TRANSLATE("String editor"), 0, editor)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLayout(new BGroupLayout(B_VERTICAL));
BStringView *stringView = new BStringView(B_EMPTY_STRING,
@@ -283,7 +283,7 @@ StringEditor::MessageReceived(BMessage *message)
MimeTypeEditor::MimeTypeEditor(BRect rect, DataEditor& editor)
: TypeEditorView(rect, B_TRANSLATE("MIME type editor"), B_FOLLOW_LEFT_RIGHT, 0, editor)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTextControl = new BTextControl(rect.InsetByCopy(5, 5), B_EMPTY_STRING,
B_TRANSLATE("MIME type:"), NULL, new BMessage(kMsgValueChanged), B_FOLLOW_ALL);
@@ -374,7 +374,7 @@ MimeTypeEditor::MessageReceived(BMessage *message)
NumberEditor::NumberEditor(BRect rect, DataEditor &editor)
: TypeEditorView(rect, B_TRANSLATE("Number editor"), B_FOLLOW_LEFT_RIGHT, 0, editor)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTextControl = new BTextControl(rect.InsetByCopy(5, 5), B_EMPTY_STRING,
_TypeLabel(), NULL, new BMessage(kMsgValueChanged), B_FOLLOW_ALL);
@@ -750,7 +750,7 @@ NumberEditor::MessageReceived(BMessage *message)
BooleanEditor::BooleanEditor(BRect rect, DataEditor &editor)
: TypeEditorView(rect, B_TRANSLATE("Boolean editor"), B_FOLLOW_NONE, 0, editor)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BPopUpMenu *menu = new BPopUpMenu("bool");
BMessage *message;
@@ -906,7 +906,7 @@ ImageView::AttachedToWindow()
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fEditor.StartWatching(this);
if (fScaleSlider != NULL)
@@ -1119,7 +1119,7 @@ ImageView::_UpdateImage()
MessageView::MessageView(BRect rect, DataEditor &editor)
: TypeEditorView(rect, B_TRANSLATE("Message View"), B_FOLLOW_ALL, 0, editor)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
rect = Bounds().InsetByCopy(10, 10);
rect.right -= B_V_SCROLL_BAR_WIDTH;
@@ -1128,8 +1128,8 @@ MessageView::MessageView(BRect rect, DataEditor &editor)
fTextView = new BTextView(rect, B_EMPTY_STRING,
rect.OffsetToCopy(B_ORIGIN).InsetByCopy(5, 5),
B_FOLLOW_ALL, B_WILL_DRAW);
fTextView->SetViewColor(ViewColor());
fTextView->SetLowColor(ViewColor());
fTextView->SetViewUIColor(ViewUIColor());
fTextView->SetLowUIColor(ViewUIColor());
BScrollView *scrollView = new BScrollView("scroller", fTextView,
B_FOLLOW_ALL, B_WILL_DRAW, true, true);
+9 -4
View File
@@ -349,9 +349,8 @@ DiskView::DiskView(const BRect& frame, uint32 resizeMode,
SetLayout(layout);
SetViewColor(B_TRANSPARENT_COLOR);
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
SetHighColor(tint_color(base, B_DARKEN_2_TINT));
SetLowColor(tint_color(base, (B_DARKEN_2_TINT + B_DARKEN_1_TINT) / 2));
SetHighUIColor(B_PANEL_BACKGROUND_COLOR, B_DARKEN_2_TINT);
SetLowUIColor(B_PANEL_BACKGROUND_COLOR, 1.221f);
#ifdef HAIKU_TARGET_PLATFORM_LIBBE_TEST
PartitionView* view;
@@ -421,7 +420,13 @@ DiskView::Draw(BRect updateRect)
(bounds.Height() - (fh.ascent + fh.descent) * 2) / 2.0);
FillRoundRect(messageBounds, 4, 4, B_SOLID_LOW);
SetHighColor(tint_color(HighColor(), B_DARKEN_4_TINT));
rgb_color color = LowColor();
if (color.Brightness() > 100)
color = tint_color(color, B_DARKEN_4_TINT);
else
color = tint_color(color, B_LIGHTEN_2_TINT);
SetHighColor(color);
BPoint textOffset;
textOffset.x = messageBounds.left + fh.ascent;
textOffset.y = (messageBounds.top + messageBounds.bottom
+2 -2
View File
@@ -64,7 +64,7 @@ PasswordAlert::PasswordAlert(const char* title, const char* text)
fTextControl = new BTextControl(textControlRect, "_password_", text,
NULL, new BMessage('pass'), B_FOLLOW_ALL);
fTextControl->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fTextControl->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTextControl->TextView()->HideTyping(true);
fTextControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
fTextControl->SetDivider(10 + fTextControl->StringWidth(text));
@@ -190,7 +190,7 @@ TAlertView::TAlertView(BRect frame)
BView(frame, "TAlertView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
fIconBitmap(NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
+13 -1
View File
@@ -28,6 +28,7 @@
#include <MutableLocaleRoster.h>
#include <ObjectList.h>
#include <Path.h>
#include <Screen.h>
#include <ScrollView.h>
#include <SeparatorView.h>
#include <StringItem.h>
@@ -155,11 +156,22 @@ BootPromptWindow::BootPromptWindow()
{
SetSizeLimits(450, 16384, 350, 16384);
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
fInfoTextView = new BTextView("");
fInfoTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fInfoTextView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fInfoTextView->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
fInfoTextView->MakeEditable(false);
fInfoTextView->MakeSelectable(false);
// Carefully designed to not exceed the 640x480 resolution with a 12pt font.
float width = fInfoTextView->StringWidth("Thank you for trying out Haiku,"
" We hope you like it!") * 1.5;
float height = be_plain_font->Size() * 36;
BRect newFrame(0, 0, width, height);
newFrame = newFrame & BScreen().Frame();
ResizeTo(newFrame.Width(), newFrame.Height());
fDesktopButton = new BButton("", new BMessage(MSG_BOOT_DESKTOP));
fDesktopButton->SetTarget(be_app);
fDesktopButton->MakeDefault(true);
+1 -1
View File
@@ -48,7 +48,7 @@ ControlView::ControlView()
fCycleFonts(false),
fFontStyleindex(0)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
GroupLayout()->SetInsets(B_USE_WINDOW_SPACING);
}
@@ -238,6 +238,18 @@ CharacterStyle::SetForegroundColor(uint8 r, uint8 g, uint8 b, uint8 a)
}
bool
CharacterStyle::SetForegroundColor(color_which which)
{
CharacterStyleDataRef data = fStyleData->SetForegroundColor(which);
if (data == fStyleData)
return data->WhichForegroundColor() == which;
fStyleData = data;
return true;
}
bool
CharacterStyle::SetForegroundColor(rgb_color color)
{
@@ -257,6 +269,13 @@ CharacterStyle::ForegroundColor() const
}
color_which
CharacterStyle::WhichForegroundColor() const
{
return fStyleData->WhichForegroundColor();
}
bool
CharacterStyle::SetBackgroundColor(uint8 r, uint8 g, uint8 b, uint8 a)
{
@@ -264,6 +283,18 @@ CharacterStyle::SetBackgroundColor(uint8 r, uint8 g, uint8 b, uint8 a)
}
bool
CharacterStyle::SetBackgroundColor(color_which which)
{
CharacterStyleDataRef data = fStyleData->SetBackgroundColor(which);
if (data == fStyleData)
return data->WhichBackgroundColor() == which;
fStyleData = data;
return true;
}
bool
CharacterStyle::SetBackgroundColor(rgb_color color)
{
@@ -283,6 +314,25 @@ CharacterStyle::BackgroundColor() const
}
color_which
CharacterStyle::WhichBackgroundColor() const
{
return fStyleData->WhichBackgroundColor();
}
bool
CharacterStyle::SetStrikeOutColor(color_which which)
{
CharacterStyleDataRef data = fStyleData->SetStrikeOutColor(which);
if (data == fStyleData)
return data->WhichStrikeOutColor() == which;
fStyleData = data;
return true;
}
bool
CharacterStyle::SetStrikeOutColor(rgb_color color)
{
@@ -302,6 +352,25 @@ CharacterStyle::StrikeOutColor() const
}
color_which
CharacterStyle::WhichStrikeOutColor() const
{
return fStyleData->WhichStrikeOutColor();
}
bool
CharacterStyle::SetUnderlineColor(color_which which)
{
CharacterStyleDataRef data = fStyleData->SetUnderlineColor(which);
if (data == fStyleData)
return data->WhichUnderlineColor() == which;
fStyleData = data;
return true;
}
bool
CharacterStyle::SetUnderlineColor(rgb_color color)
{
@@ -321,6 +390,13 @@ CharacterStyle::UnderlineColor() const
}
color_which
CharacterStyle::WhichUnderlineColor() const
{
return fStyleData->WhichUnderlineColor();
}
bool
CharacterStyle::SetStrikeOut(uint8 strikeOut)
{
@@ -44,20 +44,28 @@ public:
bool SetForegroundColor(
uint8 r, uint8 g, uint8 b,
uint8 a = 255);
bool SetForegroundColor(color_which which);
bool SetForegroundColor(rgb_color color);
rgb_color ForegroundColor() const;
color_which WhichForegroundColor() const;
bool SetBackgroundColor(
uint8 r, uint8 g, uint8 b,
uint8 a = 255);
bool SetBackgroundColor(color_which which);
bool SetBackgroundColor(rgb_color color);
rgb_color BackgroundColor() const;
color_which WhichBackgroundColor() const;
bool SetStrikeOutColor(color_which which);
bool SetStrikeOutColor(rgb_color color);
rgb_color StrikeOutColor() const;
color_which WhichStrikeOutColor() const;
bool SetUnderlineColor(color_which which);
bool SetUnderlineColor(rgb_color color);
rgb_color UnderlineColor() const;
color_which WhichUnderlineColor() const;
bool SetStrikeOut(uint8 strikeOut);
uint8 StrikeOut() const;
@@ -65,7 +73,6 @@ public:
bool SetUnderline(uint8 underline);
uint8 Underline() const;
private:
BFont _FindFontForFace(uint16 face) const;
@@ -18,10 +18,15 @@ CharacterStyleData::CharacterStyleData()
fGlyphSpacing(0.0f),
fFgColor((rgb_color){ 0, 0, 0, 255 }),
fBgColor((rgb_color){ 255, 255, 255, 255 }),
fStrikeOutColor((rgb_color){ 0, 0, 0, 255 }),
fUnderlineColor((rgb_color){ 0, 0, 0, 255 }),
fWhichFgColor(B_PANEL_TEXT_COLOR),
fWhichBgColor(B_PANEL_BACKGROUND_COLOR),
fWhichStrikeOutColor(fWhichFgColor),
fWhichUnderlineColor(fWhichFgColor),
fFgColor(ui_color(fWhichFgColor)),
fBgColor(ui_color(fWhichBgColor)),
fStrikeOutColor(fFgColor),
fUnderlineColor(fFgColor),
fStrikeOutStyle(STRIKE_OUT_NONE),
fUnderlineStyle(UNDERLINE_NONE)
@@ -39,6 +44,11 @@ CharacterStyleData::CharacterStyleData(const CharacterStyleData& other)
fGlyphSpacing(other.fGlyphSpacing),
fWhichFgColor(other.fWhichFgColor),
fWhichBgColor(other.fWhichBgColor),
fWhichStrikeOutColor(other.fWhichStrikeOutColor),
fWhichUnderlineColor(other.fWhichUnderlineColor),
fFgColor(other.fFgColor),
fBgColor(other.fBgColor),
fStrikeOutColor(other.fStrikeOutColor),
@@ -63,6 +73,11 @@ CharacterStyleData::operator==(const CharacterStyleData& other) const
&& fGlyphSpacing == other.fGlyphSpacing
&& fWhichFgColor == other.fWhichFgColor
&& fWhichBgColor == other.fWhichBgColor
&& fWhichStrikeOutColor == other.fWhichStrikeOutColor
&& fWhichUnderlineColor == other.fWhichUnderlineColor
&& fFgColor == other.fFgColor
&& fBgColor == other.fBgColor
&& fStrikeOutColor == other.fStrikeOutColor
@@ -179,6 +194,21 @@ CharacterStyleData::SetGlyphSpacing(float glyphSpacing)
}
CharacterStyleDataRef
CharacterStyleData::SetForegroundColor(color_which which)
{
if (fWhichFgColor == which)
return CharacterStyleDataRef(this);
CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this);
if (ret == NULL)
return CharacterStyleDataRef(this);
ret->fWhichFgColor = which;
return CharacterStyleDataRef(ret, true);
}
CharacterStyleDataRef
CharacterStyleData::SetForegroundColor(rgb_color color)
{
@@ -190,6 +220,22 @@ CharacterStyleData::SetForegroundColor(rgb_color color)
return CharacterStyleDataRef(this);
ret->fFgColor = color;
ret->fWhichFgColor = B_NO_COLOR;
return CharacterStyleDataRef(ret, true);
}
CharacterStyleDataRef
CharacterStyleData::SetBackgroundColor(color_which which)
{
if (fWhichBgColor == which)
return CharacterStyleDataRef(this);
CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this);
if (ret == NULL)
return CharacterStyleDataRef(this);
ret->fWhichBgColor = which;
return CharacterStyleDataRef(ret, true);
}
@@ -205,6 +251,22 @@ CharacterStyleData::SetBackgroundColor(rgb_color color)
return CharacterStyleDataRef(this);
ret->fBgColor = color;
ret->fWhichBgColor = B_NO_COLOR;
return CharacterStyleDataRef(ret, true);
}
CharacterStyleDataRef
CharacterStyleData::SetStrikeOutColor(color_which which)
{
if (fWhichStrikeOutColor == which)
return CharacterStyleDataRef(this);
CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this);
if (ret == NULL)
return CharacterStyleDataRef(this);
ret->fWhichStrikeOutColor = which;
return CharacterStyleDataRef(ret, true);
}
@@ -220,6 +282,22 @@ CharacterStyleData::SetStrikeOutColor(rgb_color color)
return CharacterStyleDataRef(this);
ret->fStrikeOutColor = color;
ret->fWhichStrikeOutColor = B_NO_COLOR;
return CharacterStyleDataRef(ret, true);
}
CharacterStyleDataRef
CharacterStyleData::SetUnderlineColor(color_which which)
{
if (fWhichUnderlineColor == which)
return CharacterStyleDataRef(this);
CharacterStyleData* ret = new(std::nothrow) CharacterStyleData(*this);
if (ret == NULL)
return CharacterStyleDataRef(this);
ret->fWhichUnderlineColor = which;
return CharacterStyleDataRef(ret, true);
}
@@ -235,6 +313,7 @@ CharacterStyleData::SetUnderlineColor(rgb_color color)
return CharacterStyleDataRef(this);
ret->fUnderlineColor = color;
ret->fWhichUnderlineColor = B_NO_COLOR;
return CharacterStyleDataRef(ret, true);
}
@@ -68,21 +68,33 @@ public:
inline float GlyphSpacing() const
{ return fGlyphSpacing; }
CharacterStyleDataRef SetForegroundColor(color_which which);
CharacterStyleDataRef SetForegroundColor(rgb_color color);
inline rgb_color ForegroundColor() const
{ return fFgColor; }
inline color_which WhichForegroundColor() const
{ return fWhichFgColor; }
CharacterStyleDataRef SetBackgroundColor(color_which which);
CharacterStyleDataRef SetBackgroundColor(rgb_color color);
inline rgb_color BackgroundColor() const
{ return fBgColor; }
inline color_which WhichBackgroundColor() const
{ return fWhichBgColor; }
CharacterStyleDataRef SetStrikeOutColor(color_which which);
CharacterStyleDataRef SetStrikeOutColor(rgb_color color);
inline rgb_color StrikeOutColor() const
{ return fStrikeOutColor; }
inline color_which WhichStrikeOutColor() const
{ return fWhichStrikeOutColor; }
CharacterStyleDataRef SetUnderlineColor(color_which which);
CharacterStyleDataRef SetUnderlineColor(rgb_color color);
inline rgb_color UnderlineColor() const
{ return fUnderlineColor; }
inline color_which WhichUnderlineColor() const
{ return fWhichUnderlineColor; }
CharacterStyleDataRef SetStrikeOut(uint8 strikeOut);
inline uint8 StrikeOut() const
@@ -92,6 +104,7 @@ public:
inline uint8 Underline() const
{ return fUnderlineStyle; }
private:
CharacterStyleData& operator=(const CharacterStyleData& other);
@@ -112,6 +125,12 @@ private:
// Additional spacing to be applied between glyphs.
float fGlyphSpacing;
color_which fWhichFgColor;
color_which fWhichBgColor;
color_which fWhichStrikeOutColor;
color_which fWhichUnderlineColor;
rgb_color fFgColor;
rgb_color fBgColor;
@@ -123,5 +142,4 @@ private:
};
#endif // CHARACTER_STYLE_DATA_H
@@ -261,7 +261,7 @@ ParagraphLayout::Draw(BView* view, const BPoint& offset)
const Bullet& bullet = fParagraphStyle.Bullet();
if (bullet.Spacing() > 0.0f && bullet.String().Length() > 0) {
// Draw bullet at offset
view->SetHighColor(0, 0, 0, 255);
view->SetHighUIColor(B_PANEL_TEXT_COLOR);
BPoint bulletPos(offset);
bulletPos.x += fParagraphStyle.FirstLineInset()
+ fParagraphStyle.LineInset();
@@ -934,7 +934,11 @@ ParagraphLayout::_DrawSpan(BView* view, BPoint offset,
const CharacterStyle& style = span.Style();
view->SetFont(&style.Font());
view->SetHighColor(style.ForegroundColor());
if (style.WhichForegroundColor() != B_NO_COLOR)
view->SetHighUIColor(style.WhichForegroundColor());
else
view->SetHighColor(style.ForegroundColor());
// TODO: Implement other style properties
@@ -41,8 +41,8 @@ TextDocumentView::TextDocumentView(const char* name)
// Set default TextEditor
SetTextEditor(TextEditorRef(new(std::nothrow) TextEditor(), true));
SetViewColor(B_TRANSPARENT_COLOR);
SetLowColor(255, 255, 255, 255);
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowUIColor(ViewUIColor());
}
+1 -6
View File
@@ -10,9 +10,6 @@ TextView::TextView(const char* name)
:
BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS)
{
SetViewColor(B_TRANSPARENT_COLOR);
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BFont font;
GetFont(&font);
@@ -41,9 +38,7 @@ TextView::Draw(BRect updateRect)
void
TextView::AttachedToWindow()
{
BView* parent = Parent();
if (parent != NULL)
SetLowColor(parent->ViewColor());
AdoptParentColors();
}
+46 -15
View File
@@ -44,7 +44,8 @@ public:
new(std::nothrow) OnePackageMessagePackageListener(this)),
fSelected(false)
{
SetViewColor(255, 255, 255);
SetViewUIColor(B_LIST_BACKGROUND_COLOR);
SetHighUIColor(B_LIST_ITEM_TEXT_COLOR);
SetEventMask(B_POINTER_EVENTS);
fIconView = new BitmapView("package icon view");
@@ -67,25 +68,27 @@ public:
font.SetSize(std::max(9.0f, floorf(font.Size() * 0.92f)));
font.SetFamilyAndStyle(family, "Italic");
fPublisherView->SetFont(&font);
fPublisherView->SetHighColor(kLightBlack);
// Summary text view
fSummaryView = new MarkupTextView("package summary");
fSummaryView->SetSelectionEnabled(false);
fSummaryView = new BTextView("package summary");
fSummaryView->MakeSelectable(false);
fSummaryView->MakeEditable(false);
font = BFont(be_plain_font);
rgb_color color = HighColor();
fSummaryView->SetFontAndColor(&font, B_FONT_ALL, &color);
// Rating view
fRatingView = new RatingView("package rating view");
fAvgRating = new BStringView("package average rating", "");
fAvgRating->SetFont(&font);
fAvgRating->SetHighColor(kLightBlack);
fVoteInfo = new BStringView("package vote info", "");
// small font
GetFont(&font);
font.SetSize(std::max(9.0f, floorf(font.Size() * 0.85f)));
fVoteInfo->SetFont(&font);
fVoteInfo->SetHighColor(kLightBlack);
fVoteInfo->SetHighUIColor(HighUIColor());
BLayoutBuilder::Group<>(this)
.Add(fIconView)
@@ -119,6 +122,15 @@ public:
delete fPackageListener;
}
virtual void AllAttached()
{
for (int32 index = 0; index < CountChildren(); ++index) {
ChildAt(index)->SetViewUIColor(ViewUIColor());
ChildAt(index)->SetLowUIColor(ViewUIColor());
ChildAt(index)->SetHighUIColor(HighUIColor());
}
}
virtual void MessageReceived(BMessage* message)
{
switch (message->what) {
@@ -129,6 +141,13 @@ public:
case MSG_UPDATE_PACKAGE:
SetPackage(fPackageListener->Package());
break;
case B_COLORS_UPDATED:
{
if (message->HasColor(ui_color_name(B_LIST_ITEM_TEXT_COLOR)))
_UpdateColors();
break;
}
}
}
@@ -227,11 +246,18 @@ public:
return;
fSelected = selected;
rgb_color bgColor;
if (fSelected)
bgColor = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
else
bgColor = (rgb_color){ 255, 255, 255, 255 };
_UpdateColors();
}
void _UpdateColors()
{
color_which bgColor = B_LIST_BACKGROUND_COLOR;
color_which textColor = B_LIST_ITEM_TEXT_COLOR;
if (fSelected) {
bgColor = B_LIST_SELECTED_BACKGROUND_COLOR;
textColor = B_LIST_SELECTED_ITEM_TEXT_COLOR;
}
List<BView*, true> views;
@@ -248,10 +274,15 @@ public:
for (int32 i = 0; i < views.CountItems(); i++) {
BView* view = views.ItemAtFast(i);
view->SetViewColor(bgColor);
view->SetLowColor(bgColor);
view->SetViewUIColor(bgColor);
view->SetLowUIColor(bgColor);
view->SetHighUIColor(textColor);
view->Invalidate();
}
BFont font(be_plain_font);
rgb_color color = HighColor();
fSummaryView->SetFontAndColor(&font, B_FONT_ALL, &color);
}
private:
@@ -263,7 +294,7 @@ private:
BStringView* fTitleView;
BStringView* fPublisherView;
MarkupTextView* fSummaryView;
BTextView* fSummaryView;
RatingView* fRatingView;
BStringView* fAvgRating;
@@ -286,7 +317,7 @@ FeaturedPackagesView::FeaturedPackagesView()
SetLayout(layout);
ScrollableGroupView* containerView = new ScrollableGroupView();
containerView->SetViewColor(255, 255, 255);
containerView->SetViewUIColor(B_LIST_BACKGROUND_COLOR);
fPackageListLayout = containerView->GroupLayout();
BScrollView* scrollView = new BScrollView(
+51 -35
View File
@@ -14,6 +14,7 @@
#include <Button.h>
#include <CardLayout.h>
#include <Catalog.h>
#include <ColumnListView.h>
#include <Font.h>
#include <GridView.h>
#include <LayoutBuilder.h>
@@ -127,9 +128,8 @@ public:
BView("diagram bar view", B_WILL_DRAW),
fValue(0.0f)
{
SetViewColor(B_TRANSPARENT_COLOR);
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint);
SetHighUIColor(B_CONTROL_MARK_COLOR);
}
virtual ~DiagramBarView()
@@ -138,11 +138,6 @@ public:
virtual void AttachedToWindow()
{
BView* parent = Parent();
if (parent != NULL) {
SetLowColor(parent->ViewColor());
SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
}
}
virtual void Draw(BRect updateRect)
@@ -325,7 +320,7 @@ public:
fRatingLayout = new BCardLayout();
ratingStack->SetLayout(fRatingLayout);
ratingStack->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
ratingStack->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
ratingStack->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BGroupView* ratingGroup = new BGroupView(B_HORIZONTAL,
B_USE_SMALL_SPACING);
@@ -471,7 +466,7 @@ public:
fStatusLabel(NULL),
fStatusBar(NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLayout(fLayout);
fLayout->AddItem(BSpaceLayoutItem::CreateGlue());
@@ -684,11 +679,10 @@ public:
fEmailIcon("text/x-email"),
fWebsiteIcon("text/html")
{
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
kContentTint));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint);
fDescriptionView = new MarkupTextView("description view");
fDescriptionView->SetLowColor(ViewColor());
fDescriptionView->SetViewUIColor(ViewUIColor(), kContentTint);
fDescriptionView->SetInsets(be_plain_font->Size());
BScrollView* scrollView = new CustomScrollView(
@@ -714,17 +708,20 @@ public:
fEmailIconView = new BitmapView("email icon view");
fEmailLinkView = new LinkView("email link view", "",
new BMessage(MSG_EMAIL_PUBLISHER), kLightBlack);
new BMessage(MSG_EMAIL_PUBLISHER));
fEmailLinkView->SetFont(&smallFont);
fWebsiteIconView = new BitmapView("website icon view");
fWebsiteLinkView = new LinkView("website link view", "",
new BMessage(MSG_VISIT_PUBLISHER_WEBSITE), kLightBlack);
new BMessage(MSG_VISIT_PUBLISHER_WEBSITE));
fWebsiteLinkView->SetFont(&smallFont);
BGroupView* leftGroup = new BGroupView(B_VERTICAL,
B_USE_DEFAULT_SPACING);
leftGroup->SetViewColor(ViewColor());
fScreenshotView->SetViewUIColor(ViewUIColor(), kContentTint);
fEmailLinkView->SetViewUIColor(ViewUIColor(), kContentTint);
fWebsiteLinkView->SetViewUIColor(ViewUIColor(), kContentTint);
BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0.0f)
// .Add(BSpaceLayoutItem::CreateHorizontalStrut(32.0f))
@@ -760,6 +757,14 @@ public:
fWebsiteLinkView->SetTarget(this);
}
virtual void AllAttached()
{
SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint);
for (int32 index = 0; index < CountChildren(); ++index)
ChildAt(index)->AdoptParentColors();
}
virtual void MessageReceived(BMessage* message)
{
switch (message->what) {
@@ -867,8 +872,7 @@ public:
:
BGroupView(B_HORIZONTAL, 0.0f)
{
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
kContentTint));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint);
fAvatarView = new BitmapView("avatar view");
if (rating.User().Avatar().Get() != NULL) {
@@ -878,10 +882,10 @@ public:
fAvatarView->SetExplicitMinSize(BSize(16.0f, 16.0f));
fNameView = new BStringView("user name", rating.User().NickName());
BFont nameFont(be_bold_font);
nameFont.SetSize(std::max(9.0f, floorf(nameFont.Size() * 0.9f)));
fNameView->SetFont(&nameFont);
fNameView->SetHighColor(kLightBlack);
fNameView->SetExplicitMaxSize(
BSize(nameFont.StringWidth("xxxxxxxxxxxxxxxxxxxxxx"), B_SIZE_UNSET));
@@ -900,7 +904,6 @@ public:
BFont versionFont(be_plain_font);
versionFont.SetSize(std::max(9.0f, floorf(versionFont.Size() * 0.85f)));
fPackageVersionView->SetFont(&versionFont);
fPackageVersionView->SetHighColor(kLightBlack);
// TODO: User rating IDs to identify which rating to vote up or down
// BMessage* voteUpMessage = new BMessage(MSG_VOTE_UP);
@@ -928,7 +931,6 @@ public:
// fDownVoteCountView->SetText(voteCountLabel);
fTextView = new TextView("rating text");
fTextView->SetViewColor(ViewColor());
ParagraphStyle paragraphStyle(fTextView->ParagraphStyle());
paragraphStyle.SetJustify(true);
fTextView->SetParagraphStyle(paragraphStyle);
@@ -957,6 +959,21 @@ public:
.End()
.SetInsets(B_USE_DEFAULT_SPACING)
;
SetFlags(Flags() | B_WILL_DRAW);
}
void AllAttached()
{
for (int32 index = 0; index < CountChildren(); ++index)
ChildAt(index)->AdoptParentColors();
}
void Draw(BRect rect)
{
rgb_color color = mix_color(ViewColor(), ui_color(B_PANEL_TEXT_COLOR), 64);
SetHighColor(color);
StrokeLine(Bounds().LeftBottom(), Bounds().RightBottom());
}
private:
@@ -981,8 +998,8 @@ public:
:
BGridView("rating summary view", B_USE_HALF_ITEM_SPACING, 0.0f)
{
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
kContentTint - 0.1));
float tint = kContentTint - 0.1;
SetViewUIColor(B_PANEL_BACKGROUND_COLOR, tint);
BLayoutBuilder::Grid<> layoutBuilder(this);
@@ -995,7 +1012,7 @@ public:
label.SetToFormat("%" B_PRId32, 5 - i);
fLabelViews[i] = new BStringView("", label);
fLabelViews[i]->SetFont(&smallFont);
fLabelViews[i]->SetHighColor(kLightBlack);
fLabelViews[i]->SetViewUIColor(ViewUIColor(), tint);
layoutBuilder.Add(fLabelViews[i], 0, i);
fDiagramBarViews[i] = new DiagramBarView();
@@ -1003,7 +1020,7 @@ public:
fCountViews[i] = new BStringView("", "");
fCountViews[i]->SetFont(&smallFont);
fCountViews[i]->SetHighColor(kLightBlack);
fCountViews[i]->SetViewUIColor(ViewUIColor(), tint);
fCountViews[i]->SetAlignment(B_ALIGN_RIGHT);
layoutBuilder.Add(fCountViews[i], 2, i);
}
@@ -1049,14 +1066,13 @@ public:
fThumbsUpIcon(BitmapRef(new SharedBitmap(502), true)),
fThumbsDownIcon(BitmapRef(new SharedBitmap(503), true))
{
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
kContentTint));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint);
fRatingSummaryView = new RatingSummaryView();
ScrollableGroupView* ratingsContainerView = new ScrollableGroupView();
ratingsContainerView->SetViewColor(
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), kContentTint));
ratingsContainerView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR,
kContentTint);
fRatingContainerLayout = ratingsContainerView->GroupLayout();
BScrollView* scrollView = new RatingsScrollView(
@@ -1093,8 +1109,10 @@ public:
if (count == 0) {
BStringView* noRatingsView = new BStringView("no ratings",
B_TRANSLATE("No user ratings available."));
noRatingsView->SetViewUIColor(ViewUIColor(), kContentTint);
noRatingsView->SetAlignment(B_ALIGN_CENTER);
noRatingsView->SetHighColor(kLightBlack);
noRatingsView->SetHighColor(disable_color(ui_color(B_PANEL_TEXT_COLOR),
ViewColor()));
noRatingsView->SetExplicitMaxSize(
BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
fRatingContainerLayout->AddView(0, noRatingsView);
@@ -1178,8 +1196,7 @@ public:
:
BGroupView("package contents view", B_HORIZONTAL)
{
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
kContentTint));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint);
fPackageContents = new PackageContentsView("contents_list");
AddChild(fPackageContents);
@@ -1218,11 +1235,10 @@ public:
:
BGroupView("package changelog view", B_HORIZONTAL)
{
SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
kContentTint));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR, kContentTint);
fTextView = new MarkupTextView("changelog view");
fTextView->SetLowColor(ViewColor());
fTextView->SetLowUIColor(ViewUIColor());
fTextView->SetInsets(be_plain_font->Size());
BScrollView* scrollView = new CustomScrollView(
+3 -4
View File
@@ -632,10 +632,9 @@ public:
font.SetSize(9.0f);
SetFont(&font);
SetViewColor(B_TRANSPARENT_COLOR);
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetHighColor(tint_color(LowColor(), B_DARKEN_4_TINT));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowUIColor(ViewUIColor());
SetHighUIColor(LowUIColor(), B_DARKEN_4_TINT);
}
virtual BSize MinSize()
+2 -10
View File
@@ -18,8 +18,6 @@ BitmapView::BitmapView(const char* name)
fBitmap(NULL),
fScaleBitmap(true)
{
SetViewColor(B_TRANSPARENT_COLOR);
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
@@ -29,15 +27,9 @@ BitmapView::~BitmapView()
void
BitmapView::AttachedToWindow()
BitmapView::AllAttached()
{
BView* parent = Parent();
if (parent != NULL) {
rgb_color color = parent->ViewColor();
if (color == B_TRANSPARENT_COLOR)
color = parent->LowColor();
SetLowColor(color);
}
AdoptParentColors();
}
+1 -1
View File
@@ -17,7 +17,7 @@ public:
virtual ~BitmapView();
virtual void AttachedToWindow();
virtual void AllAttached();
virtual void Draw(BRect updateRect);
virtual BSize MinSize();
+35 -16
View File
@@ -10,18 +10,21 @@
#include <String.h>
LinkView::LinkView(const char* name, const char* string, BMessage* message,
rgb_color color)
LinkView::LinkView(const char* name, const char* string, BMessage* message)
:
BStringView(name, string),
BInvoker(message, NULL),
fNormalColor(color),
fHoverColor(make_color(1, 141, 211)),
fEnabled(true),
fMouseInside(false)
{
SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
SetExplicitMinSize(BSize(120, B_SIZE_UNSET));
}
void
LinkView::AttachedToWindow()
{
_UpdateLinkColor();
}
@@ -55,7 +58,7 @@ LinkView::Draw(BRect updateRect)
if (Text() == NULL)
return;
SetLowColor(ViewColor());
SetDrawingMode(B_OP_ALPHA);
font_height fontHeight;
GetFontHeight(&fontHeight);
@@ -82,18 +85,34 @@ LinkView::SetEnabled(bool enabled)
}
void
LinkView::MessageReceived(BMessage* message)
{
if (message->what == B_COLORS_UPDATED)
_UpdateLinkColor();
BStringView::MessageReceived(message);
}
void
LinkView::_UpdateLinkColor()
{
if (fEnabled && fMouseInside) {
SetHighColor(fHoverColor);
BCursor cursor(B_CURSOR_ID_FOLLOW_LINK);
SetViewCursor(&cursor, true);
Invalidate();
} else {
SetHighColor(fNormalColor);
BCursor cursor(B_CURSOR_SYSTEM_DEFAULT);
SetViewCursor(&cursor, true);
Invalidate();
}
BCursorID cursorID = B_CURSOR_ID_SYSTEM_DEFAULT;
float tint = B_DARKEN_1_TINT;
ViewUIColor(&tint);
if (fEnabled) {
if (fMouseInside) {
cursorID = B_CURSOR_ID_FOLLOW_LINK;
SetHighUIColor(B_LINK_HOVER_COLOR, tint);
} else
SetHighUIColor(B_LINK_TEXT_COLOR, tint);
} else
SetHighColor(disable_color(ui_color(B_LINK_TEXT_COLOR), ViewColor()));
BCursor cursor(cursorID);
SetViewCursor(&cursor, true);
Invalidate();
}
+4 -3
View File
@@ -13,7 +13,9 @@
class LinkView : public BStringView, public BInvoker {
public:
LinkView(const char* name, const char* string,
BMessage* message, rgb_color color);
BMessage* message);
virtual void AttachedToWindow();
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
@@ -21,14 +23,13 @@ public:
virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage* message);
void SetEnabled(bool enabled);
private:
void _UpdateLinkColor();
private:
rgb_color fNormalColor;
rgb_color fHoverColor;
bool fEnabled;
bool fMouseInside;
@@ -19,6 +19,13 @@ LinkedBitmapView::LinkedBitmapView(const char* name, BMessage* message)
}
void
LinkedBitmapView::AllAttached()
{
// We don't want to use BitmapView's default behavior here.
}
void
LinkedBitmapView::MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage)
@@ -16,6 +16,8 @@ public:
LinkedBitmapView(const char* name,
BMessage* message);
virtual void AllAttached();
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
virtual void MouseDown(BPoint where);
@@ -17,8 +17,8 @@ RatingView::RatingView(const char* name)
fStarBitmap(501),
fRating(-1.0f)
{
SetViewColor(B_TRANSPARENT_COLOR);
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowUIColor(ViewUIColor());
}
@@ -30,9 +30,7 @@ RatingView::~RatingView()
void
RatingView::AttachedToWindow()
{
BView* parent = Parent();
if (parent != NULL)
SetLowColor(parent->ViewColor());
AdoptParentColors();
}
+4 -4
View File
@@ -967,7 +967,7 @@ MainWindow::_CreateGUI()
layout->SetSpacing(0, 0);
BView* rootView = new BView("root view", 0, layout);
AddChild(rootView);
rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
rootView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BGroupView* leftTopView = new BGroupView(B_VERTICAL, 0);
layout->AddView(leftTopView, 0, 0);
@@ -982,7 +982,7 @@ MainWindow::_CreateGUI()
leftTopView->SetExplicitMinSize(BSize(splitWidth, B_SIZE_UNSET));
BGroupView* iconPreviews = new BGroupView(B_HORIZONTAL);
iconPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
iconPreviews->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
iconPreviews->GroupLayout()->SetSpacing(5);
// icon previews
@@ -1003,14 +1003,14 @@ MainWindow::_CreateGUI()
BGroupView* smallPreviews = new BGroupView(B_VERTICAL);
smallPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
smallPreviews->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
smallPreviews->GroupLayout()->SetSpacing(5);
smallPreviews->AddChild(fIconPreview16Folder);
smallPreviews->AddChild(fIconPreview16Menu);
BGroupView* mediumPreviews = new BGroupView(B_VERTICAL);
mediumPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
mediumPreviews->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
mediumPreviews->GroupLayout()->SetSpacing(5);
mediumPreviews->AddChild(fIconPreview32Folder);
+1 -1
View File
@@ -17,7 +17,7 @@ Group::Group(BRect frame, const char* name, orientation direction)
fInset(4.0),
fSpacing(0.0)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
// destructor
@@ -47,7 +47,7 @@ ColorPickerView::ColorPickerView(const char* name, rgb_color color,
b((float)color.blue / 255.0),
fRequiresUpdate(false)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
RGB_to_HSV(r, g, b, h, s, v);
+1 -1
View File
@@ -62,7 +62,7 @@ StyleView::StyleView(BRect frame)
fIgnoreControlGradientNotifications(false),
fPreviousBounds(frame.OffsetToCopy(B_ORIGIN))
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// style type
BMenu* menu = new BPopUpMenu(B_TRANSLATE("<unavailable>"));
+1 -1
View File
@@ -133,7 +133,7 @@ SwatchGroup::SwatchGroup(BRect frame)
// configure self
ResizeTo(width, fAlphaSlider->Frame().bottom + 4);
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
// add views
AddChild(fCurrentColorSV);
+2 -2
View File
@@ -270,7 +270,7 @@ UninstallView::MessageReceived(BMessage* msg)
void
UninstallView::_InitView()
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fAppList = new BListView("pkg_list", B_SINGLE_SELECTION_LIST);
fAppList->SetSelectionMessage(new BMessage(P_MSG_SELECT));
@@ -284,7 +284,7 @@ UninstallView::_InitView()
fDescription = new BTextView("description", B_WILL_DRAW);
fDescription->MakeSelectable(false);
fDescription->MakeEditable(false);
fDescription->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fDescription->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fDescription->SetText(fNoPackageSelectedString);
fButton = new BButton("removal", B_TRANSLATE("Remove"),
+1
View File
@@ -173,6 +173,7 @@ InstallerWindow::InstallerWindow()
fStatusView = new BTextView("statusView", be_plain_font, NULL,
B_WILL_DRAW);
fStatusView->SetViewColor(255, 255, 255, 255);
fStatusView->SetInsets(10, 0, 10, 0);
fStatusView->MakeEditable(false);
fStatusView->MakeSelectable(false);
+2 -1
View File
@@ -61,7 +61,8 @@ LoginApp::ReadyToRun()
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go(NULL);
} else {
BRect frame(0, 0, 450, 150);
float sizeDelta = (float)be_plain_font->Size()/12.0f;
BRect frame(0, 0, 450 * sizeDelta, 150 * sizeDelta);
frame.OffsetBySelf(screen.Frame().Width()/2 - frame.Width()/2,
screen.Frame().Height()/2 - frame.Height()/2);
fLoginWindow = new LoginWindow(frame);
+21 -4
View File
@@ -48,8 +48,8 @@ LoginView::LoginView(BRect frame)
{
// TODO: when I don't need to test in BeOS anymore,
// rewrite to use layout engine.
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ViewColor());
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowUIColor(ViewUIColor());
BRect r;
r.Set(CSEP, CSEP, LW, Bounds().Height() - 3 * CSEP - BH);
fUserList = new BListView(r, "users");
@@ -85,20 +85,24 @@ LoginView::LoginView(BRect frame)
fHaltButton = new BButton(buttonRect, "halt", B_TRANSLATE("Halt"),
new BMessage(kHaltAction));
fHaltButton->ResizeToPreferred();
AddChild(fHaltButton);
buttonRect.OffsetBySelf(CSEP + buttonWidth, 0);
buttonRect.OffsetBySelf(CSEP + fHaltButton->Frame().Width(), 0);
fRebootButton = new BButton(buttonRect, "reboot", B_TRANSLATE("Reboot"),
new BMessage(kRebootAction));
fRebootButton->ResizeToPreferred();
AddChild(fRebootButton);
BRect infoRect(buttonRect);
infoRect.OffsetBySelf(buttonWidth + CSEP, 0);
infoRect.OffsetBySelf(fRebootButton->Frame().Width() + CSEP, 0);
buttonRect.OffsetToSelf(Bounds().Width() - CSEP - buttonWidth,
Bounds().Height() - CSEP - BH);
fLoginButton = new BButton(buttonRect, "ok", B_TRANSLATE("OK"),
new BMessage(kAttemptLogin));
fLoginButton->ResizeToPreferred();
AddChild(fLoginButton);
infoRect.right = buttonRect.left - CSEP + 5;
@@ -128,6 +132,19 @@ LoginView::AttachedToWindow()
fUserList->MakeFocus();
// populate user list
BMessenger(this).SendMessage(kAddNextUser);
// size window relative to buttons
BRect bounds = Window()->Bounds();
float spacing = fHaltButton->Frame().left;
bounds.bottom = fLoginButton->Frame().bottom + spacing;
bounds.right = fLoginButton->Frame().right + spacing;
Window()->ResizeTo(bounds.Width(), bounds.Height());
// Center info view
BPoint leftTop = fInfoView->Frame().LeftTop();
leftTop.y += fHaltButton->Frame().Height() / 2;
leftTop.y -= fInfoView->Bounds().Height() / 2;
fInfoView->MoveTo(leftTop);
}
+2 -2
View File
@@ -808,7 +808,7 @@ void
TInfoView::AttachedToWindow()
{
BBox::AttachedToWindow();
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
dynamic_cast<TWindow*>(Window())->PixelCount(&fHPixelCount, &fVPixelCount);
fPixelSize = dynamic_cast<TWindow*>(Window())->PixelSize();
@@ -1050,7 +1050,6 @@ TMagnify::TMagnify(BRect r, TWindow* parent)
fParent(parent),
fStickCoordinates(false)
{
SetViewColor(B_TRANSPARENT_32_BIT);
}
@@ -1073,6 +1072,7 @@ TMagnify::AttachedToWindow()
resume_thread(fThread);
SetViewColor(B_TRANSPARENT_32_BIT);
MakeFocus();
}
+2 -2
View File
@@ -656,8 +656,8 @@ AddressTextControl::AddressTextControl(const char* name, BMessage* message)
.Add(fPopUpButton);
SetFlags(Flags() | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
SetLowColor(ViewColor());
SetViewColor(fTextView->ViewColor());
SetLowUIColor(ViewUIColor());
SetViewUIColor(fTextView->ViewUIColor());
SetExplicitAlignment(BAlignment(B_ALIGN_USE_FULL_WIDTH,
B_ALIGN_VERTICAL_CENTER));
+1 -1
View File
@@ -646,7 +646,7 @@ TContentView::TContentView(bool incoming, BFont* font,
fFocus(false),
fIncoming(incoming)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 0);
SetLayout(layout);
+1 -1
View File
@@ -154,7 +154,7 @@ TEnclosuresView::TEnclosuresView(BRect rect, BRect windowRect)
B_WILL_DRAW),
fFocus(false)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BFont font(be_plain_font);
font.SetSize(font.Size() * kPlainFontSizeScale);
+1 -1
View File
@@ -136,7 +136,7 @@ FindPanel::~FindPanel()
void FindPanel::AttachedToWindow()
{
BView::AttachedToWindow();
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
Window()->SetDefaultButton(fFindButton);
fFindButton->SetTarget(this);
+1 -1
View File
@@ -87,7 +87,7 @@ TStatusWindow::TStatusWindow(BRect rect, BMessenger target, const char* status)
fTarget(target)
{
BView* view = new BView(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(view);
BRect r(STATUS_FIELD_H, STATUS_FIELD_V,
+1 -1
View File
@@ -153,7 +153,7 @@ IconView::AttachedToWindow()
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -31,7 +31,7 @@ void
DurationView::AttachedToWindow()
{
BStringView::AttachedToWindow();
SetHighColor(tint_color(ViewColor(), B_DARKEN_4_TINT));
_UpdateTextColor();
}
@@ -46,6 +46,17 @@ DurationView::MouseDown(BPoint where)
}
void
DurationView::MessageReceived(BMessage* message)
{
if (message->what == B_COLORS_UPDATED
&& message->HasColor(ui_color_name(B_PANEL_TEXT_COLOR)))
_UpdateTextColor();
BStringView::MessageReceived(message);
}
BSize
DurationView::MinSize()
{
@@ -128,6 +139,13 @@ DurationView::_Update()
}
void
DurationView::_UpdateTextColor()
{
SetHighColor(mix_color(ViewColor(), ui_color(B_PANEL_TEXT_COLOR), 128));
}
void
DurationView::_GenerateString(bigtime_t duration)
{
@@ -17,6 +17,7 @@ public:
// BStringView interface
virtual void AttachedToWindow();
virtual void MouseDown(BPoint where);
virtual void MessageReceived(BMessage* message);
virtual BSize MinSize();
virtual BSize MaxSize();
@@ -39,6 +40,7 @@ public:
private:
void _Update();
void _UpdateTextColor();
void _GenerateString(bigtime_t duration);
private:
+6 -3
View File
@@ -236,11 +236,14 @@ NetworkStatusView::AttachedToWindow()
if ((Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0)
SetViewColor(B_TRANSPARENT_COLOR);
else
SetViewColor(Parent()->ViewColor());
AdoptParentColors();
} else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowColor(ViewColor());
if (ViewUIColor() != B_NO_COLOR)
SetLowUIColor(ViewUIColor());
else
SetLowColor(ViewColor());
start_watching_network(
B_WATCH_NETWORK_INTERFACE_CHANGES | B_WATCH_NETWORK_LINK_CHANGES, this);
@@ -24,7 +24,7 @@ NetworkStatusWindow::NetworkStatusWindow()
B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
{
BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(topView);
SetSizeLimits(25, 265, 25, 265);
+1 -1
View File
@@ -118,7 +118,7 @@ RadioView::AttachedToWindow()
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
+2
View File
@@ -1,5 +1,7 @@
SubDir HAIKU_TOP src apps overlayimage ;
UsePrivateHeaders interface ;
Application OverlayImage :
OverlayApp.cpp
OverlayView.cpp
+12 -2
View File
@@ -19,6 +19,7 @@
#include <String.h>
#include <TextView.h>
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Main view"
@@ -40,7 +41,9 @@ OverlayView::OverlayView(BRect frame)
SetViewColor(B_TRANSPARENT_COLOR);
fText = new BTextView(Bounds(), "bgView", Bounds(), B_FOLLOW_ALL, B_WILL_DRAW);
fText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
rgb_color color = ui_color(B_PANEL_TEXT_COLOR);
fText->SetFontAndColor(be_plain_font, B_FONT_ALL, &color);
AddChild(fText);
BString text;
text << B_TRANSLATE(
@@ -117,7 +120,14 @@ OverlayView::MessageReceived(BMessage *msg)
case B_ABOUT_REQUESTED:
OverlayAboutRequested();
break;
case B_COLORS_UPDATED:
{
rgb_color color;
if (msg->FindColor(ui_color_name(B_PANEL_TEXT_COLOR), &color)
== B_OK)
fText->SetFontAndColor(be_plain_font, B_FONT_ALL, &color);
break;
}
default:
BView::MessageReceived(msg);
break;
+1 -1
View File
@@ -32,7 +32,7 @@ OverlayWindow::OverlayWindow()
AddChild(replView);
BView *bgView = new BView(Bounds(), "bgView", B_FOLLOW_ALL, B_WILL_DRAW);
bgView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
bgView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(bgView);
}
+8 -5
View File
@@ -471,16 +471,19 @@ private:
void
PackageView::_InitView()
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
float fontHeight = be_plain_font->Size();
rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
BTextView* packageDescriptionView = new DescriptionTextView(
"package description", fontHeight * 13);
packageDescriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
packageDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
packageDescriptionView->SetText(fInfo.GetDescription());
packageDescriptionView->MakeEditable(false);
packageDescriptionView->MakeSelectable(false);
packageDescriptionView->SetFontAndColor(be_plain_font, B_FONT_ALL,
&textColor);
BScrollView* descriptionScrollView = new BScrollView(
"package description scroll view", packageDescriptionView,
@@ -500,11 +503,11 @@ PackageView::_InitView()
// Left inset needs to match BMenuField text offset
fInstallTypeDescriptionView->SetText(
B_TRANSLATE("No installation type selected"));
fInstallTypeDescriptionView->SetViewColor(
ui_color(B_PANEL_BACKGROUND_COLOR));
fInstallTypeDescriptionView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BFont font(be_plain_font);
font.SetSize(ceilf(font.Size() * 0.85));
fInstallTypeDescriptionView->SetFontAndColor(&font);
fInstallTypeDescriptionView->SetFontAndColor(&font, B_FONT_ALL,
&textColor);
BScrollView* installTypeScrollView = new BScrollView(
"install type description scroll view", fInstallTypeDescriptionView,
+1 -1
View File
@@ -54,7 +54,7 @@ PairsView::PairsView(BRect frame, const char* name, uint8 rows, uint8 cols,
fPositionX(new int32[fButtonsCount]),
fPositionY(new int32[fButtonsCount])
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
CreateGameBoard();
_SetPairsBoard();
}
+1 -1
View File
@@ -164,7 +164,7 @@ void
PatchRow::AttachedToWindow()
{
Window()->SetPulseRate(200000);
SetViewColor(Parent()->ViewColor());
AdoptParentColors();
int32 numChildren = CountChildren();
for (int32 i = 0; i < numChildren; i++) {
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
+2 -1
View File
@@ -37,7 +37,7 @@ PatchView::PatchView(BRect rect)
BView(rect, "PatchView", B_FOLLOW_ALL, B_WILL_DRAW),
fUnknownDeviceIcon(NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BRect iconRect(0, 0, LARGE_ICON_SIZE - 1, LARGE_ICON_SIZE - 1);
fUnknownDeviceIcon = new BBitmap(iconRect, B_RGBA32);
@@ -68,6 +68,7 @@ PatchView::AttachedToWindow()
BMessenger msgr(this);
roster->StartWatching(&msgr);
SetHighUIColor(B_PANEL_TEXT_COLOR);
}
+2 -2
View File
@@ -37,7 +37,7 @@ BatteryInfoView::BatteryInfoView()
fPreferredSize(200, 200),
fMaxStringSize(0, 0)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
}
@@ -346,7 +346,7 @@ ExtendedInfoWindow::ExtendedInfoWindow(PowerStatusDriverInterface* interface)
fDriverInterface->AcquireReference();
BView *view = new BView(Bounds(), "view", B_FOLLOW_ALL, 0);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(view);
BGroupLayout* mainLayout = new BGroupLayout(B_VERTICAL);
+14 -7
View File
@@ -118,10 +118,12 @@ void
PowerStatusView::AttachedToWindow()
{
BView::AttachedToWindow();
if (Parent())
SetLowColor(Parent()->ViewColor());
AdoptParentColors();
if (ViewUIColor() == B_NO_COLOR)
SetLowUIColor(B_PANEL_BACKGROUND_COLOR);
else
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowUIColor(ViewUIColor());
Update();
}
@@ -159,7 +161,10 @@ PowerStatusView::_DrawBattery(BRect rect)
float left = rect.left;
rect.left += rect.Width() / 11;
SetHighColor(0, 0, 0);
if (LowColor().Brightness() > 100)
SetHighColor(0, 0, 0);
else
SetHighColor(128, 128, 128);
float gap = 1;
if (rect.Height() > 8) {
@@ -190,7 +195,10 @@ PowerStatusView::_DrawBattery(BRect rect)
if (percent > 0) {
rect.InsetBy(gap, gap);
rgb_color base = {84, 84, 84, 255};
rgb_color base = (rgb_color){84, 84, 84, 255};
if (LowColor().Brightness() < 128)
base = (rgb_color){172, 172, 172, 255};
if (be_control_look != NULL) {
BRect empty = rect;
if (fHasBattery && percent > 0)
@@ -313,8 +321,7 @@ PowerStatusView::Draw(BRect updateRect)
SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
else {
SetDrawingMode(B_OP_OVER);
rgb_color c = Parent()->LowColor();
if (c.red + c.green + c.blue > 128 * 3)
if (LowColor().Brightness() > 100)
SetHighColor(0, 0, 0);
else
SetHighColor(255, 255, 255);
+1 -1
View File
@@ -20,7 +20,7 @@ PowerStatusWindow::PowerStatusWindow()
B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
{
BView* topView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(topView);
topView->AddChild(new PowerStatusReplicant(Bounds(), B_FOLLOW_ALL));
+1 -1
View File
@@ -47,7 +47,7 @@ PCWindow::PCWindow()
BRect rect = Bounds();
BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(topView);
// set up a rectangle && instantiate a new view
+4 -4
View File
@@ -198,10 +198,10 @@ ConfigView::AttachedToWindow()
// AttachedToWindow() gets called every time this tab is brought
// to the front, but we only want this initialization to happen once
if (fFirstTimeAttached) {
if (Parent() != NULL)
SetViewColor(Parent()->ViewColor());
else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AdoptParentColors();
if (Parent() == NULL)
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BMessenger messenger(this);
fColorControl->SetTarget(messenger);
+2 -3
View File
@@ -50,9 +50,8 @@ NormalPulseView::NormalPulseView(BRect rect)
: PulseView(rect, "NormalPulseView"),
fHasBrandLogo(false)
{
rgb_color color = { 168, 168, 168, 0xff };
SetViewColor(color);
SetLowColor(color);
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
SetLowUIColor(ViewUIColor());
mode1->SetLabel(B_TRANSLATE("Mini mode"));
mode1->SetMessage(new BMessage(PV_MINI_MODE));
+1 -1
View File
@@ -36,7 +36,7 @@ PrefsWindow::PrefsWindow(BRect frame, const char *name,
// This gives a nice look, and sets the background color correctly
BRect bounds = Bounds();
BView* topView = new BView(bounds, "ParentView", B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
topView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(topView);
bounds.top += 10;
+1 -1
View File
@@ -42,7 +42,7 @@ BitmapView::BitmapView(BRect frame, const char *name, BMessage *mod, BBitmap *bi
const char *label, border_style borderstyle, int32 resize, int32 flags)
: BView(frame, name, resize, flags)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
if (bitmap && bitmap->IsValid())
fBitmap = bitmap;
+1 -1
View File
@@ -31,7 +31,7 @@ ImageEditor::ImageEditor(const BRect &frame, ResourceData *data, BHandler *owner
imgsize.Set(0, 0, 200, 200);
BView *back = new BView(Bounds(), "back", B_FOLLOW_ALL, B_WILL_DRAW);
back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
back->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(back);
BRect r;
+1 -1
View File
@@ -7,7 +7,7 @@ UsePrivateHeaders shared interface ;
local columnViewSources ;
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
columnViewSources = ColumnListView.cpp ColumnTypes.cpp ColorTools.cpp ;
columnViewSources = ColumnListView.cpp ColumnTypes.cpp ;
}
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits interface ] ;
+1 -1
View File
@@ -75,7 +75,7 @@ Editor::~Editor(void)
StringEditView::StringEditView(const BRect &frame)
: BView(frame, "edit", B_FOLLOW_ALL, B_WILL_DRAW)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BRect r;
+1 -1
View File
@@ -50,7 +50,7 @@ ResView::ResView(const BRect &frame, const char *name, const int32 &resize,
fOpenPanel(NULL),
fSavePanel(NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
if (ref) {
fRef = new entry_ref;
*fRef = *ref;
+2 -2
View File
@@ -175,13 +175,13 @@ ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent,
BMenuField* menuLocation = new BMenuField(B_TRANSLATE("Save in:"),
fOutputPathMenu);
menuLocation->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
menuLocation->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fTranslatorMenu = new BMenu(B_TRANSLATE("Please select"));
_SetupTranslatorMenu();
BMenuField* menuFormat = new BMenuField(B_TRANSLATE("Save as:"),
fTranslatorMenu);
menuFormat->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
menuFormat->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BButton* showSettings = new BButton("",
B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), new BMessage(kSettings));
+1 -1
View File
@@ -38,7 +38,7 @@ ProgressWindow::ProgressWindow()
BRect rect = Bounds();
BView* view = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(view);
rect = view->Bounds().InsetByCopy(5, 5);
+3 -9
View File
@@ -45,15 +45,8 @@ ShowImageStatusView::AttachedToWindow()
BScrollBar* scrollBar = fScrollView->ScrollBar(B_HORIZONTAL);
MoveTo(0.0, scrollBar->Frame().top);
rgb_color color = B_TRANSPARENT_COLOR;
BView* parent = Parent();
if (parent != NULL)
color = parent->ViewColor();
if (color == B_TRANSPARENT_COLOR)
color = ui_color(B_PANEL_BACKGROUND_COLOR);
SetViewColor(color);
AdoptParentColors();
ResizeToPreferred();
}
@@ -98,7 +91,8 @@ ShowImageStatusView::Draw(BRect updateRect)
}
BRect bounds(Bounds());
rgb_color highColor = HighColor();
rgb_color highColor = ui_color(B_PANEL_TEXT_COLOR);
SetHighColor(tint_color(ViewColor(), B_DARKEN_2_TINT));
StrokeLine(bounds.LeftTop(), bounds.RightTop());
+1 -1
View File
@@ -164,7 +164,7 @@ ShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref,
// visible portion without colliding with the menu bar.
BView* contentView = new BView(BRect(), "content", B_FOLLOW_NONE, 0);
contentView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
contentView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
contentView->SetExplicitMinSize(BSize(250, 100));
AddChild(contentView);
+1 -1
View File
@@ -373,7 +373,7 @@ RecorderWindow::InitWindow()
fSoundList = new SoundListView(r, B_TRANSLATE("Sound List"),
B_FOLLOW_ALL);
fSoundList->SetSelectionMessage(new BMessage(SOUND_SELECTED));
fSoundList->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fSoundList->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
BScrollView *scroller = new BScrollView("scroller", fSoundList,
B_FOLLOW_ALL, 0, false, true, B_FANCY_BORDER);
fBottomBox->AddChild(scroller);

Some files were not shown because too many files have changed in this diff Show More