From 28e96d8542a8e2c94df32ba8f5e4b34975db7476 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Fri, 28 Jan 2011 22:36:13 +0000 Subject: [PATCH] re-organize interface listitem drawing to be more efficent; move profile management button into profile drop-down git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40312 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../InterfacesAddOn/InterfacesListView.cpp | 60 +++++++++---------- .../kits/net/preflet/NetworkSetupWindow.cpp | 9 +-- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp b/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp index c7c738c792..80afdb5050 100644 --- a/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp +++ b/src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp @@ -101,30 +101,24 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete) BRect bounds = list->ItemFrame(list->IndexOf(this)); - rgb_color oldviewcolor = owner->ViewColor(); - rgb_color oldlowcolor = owner->LowColor(); - rgb_color oldcolor = owner->HighColor(); + rgb_color black= { 0,0,0,255 }; - rgb_color color = oldviewcolor; - if ( IsSelected() ) - color = tint_color(color, B_HIGHLIGHT_BACKGROUND_TINT); + if ( IsSelected() || complete ) { + if (IsSelected()) { + owner->SetHighColor(tint_color(owner->ViewColor() , B_HIGHLIGHT_BACKGROUND_TINT)); + } else { + owner->SetHighColor(owner->LowColor()); + } - owner->SetViewColor( color ); - owner->SetHighColor( color ); - owner->SetLowColor( color ); - owner->FillRect(bounds); - - owner->SetViewColor( oldviewcolor); - owner->SetLowColor( oldlowcolor ); - owner->SetHighColor( oldcolor ); + owner->FillRect(bounds); + } BPoint iconPt = bounds.LeftTop() + BPoint(4,4); BPoint namePt = BPoint(32+12, fFirstlineOffset); - BPoint driverPt = BPoint(32+12, fSecondlineOffset); - BPoint commentPt = BPoint(32+12, fThirdlineOffset); + BPoint v4addrPt = BPoint(32+12, fSecondlineOffset); + BPoint v6addrPt = BPoint(32+12, fThirdlineOffset); - drawing_mode mode = owner->DrawingMode(); - if (fSettings->IsDisabled()) { + if ( fSettings->IsDisabled() ) { owner->SetDrawingMode(B_OP_ALPHA); owner->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY); owner->SetHighColor(0, 0, 0, 32); @@ -133,27 +127,31 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete) owner->DrawBitmapAsync(fIcon, iconPt); - if (fSettings->IsDisabled()) - owner->SetHighColor(tint_color(oldcolor, B_LIGHTEN_1_TINT)); - + if ( fSettings->IsDisabled() ) + owner->SetHighColor(tint_color(black, B_LIGHTEN_1_TINT)); + else + owner->SetHighColor(black); + owner->SetFont(be_bold_font); owner->DrawString(Name(), namePt); owner->SetFont(be_plain_font); if (fSettings->IsDisabled()) - owner->DrawString("Disabled.", driverPt); + owner->DrawString("Disabled", v4addrPt); else { - BString str("Enabled, IPv4 address: "); - str << fSettings->IP(); - owner->DrawString(str.String(), driverPt); - if (fSettings->AutoConfigure()) - owner->DrawString("DHCP enabled", commentPt); + BString v4str("IPv4: "); + v4str << fSettings->IP(); + v4str << " ("; + if ( fSettings->AutoConfigure() ) + v4str << "DHCP"; else - owner->DrawString("DHCP disabled, use static IP address", commentPt); - } + v4str << "manual"; + v4str << ")"; + owner->DrawString(v4str.String(), v4addrPt); - owner->SetHighColor(oldcolor); - owner->SetDrawingMode(mode); + owner->DrawString("IPv6: none (auto)", v6addrPt); + // TODO : where will we keep this? + } owner->PopState(); } diff --git a/src/tests/kits/net/preflet/NetworkSetupWindow.cpp b/src/tests/kits/net/preflet/NetworkSetupWindow.cpp index 4d8f9be34d..cea67c5905 100644 --- a/src/tests/kits/net/preflet/NetworkSetupWindow.cpp +++ b/src/tests/kits/net/preflet/NetworkSetupWindow.cpp @@ -35,10 +35,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title) B_TRANSLATE("Profile:"), profilesPopup); profilesMenuField->SetFont(be_bold_font); - BButton *button = new BButton("manage_profiles", - B_TRANSLATE("Manage profiles" B_UTF8_ELLIPSIS), - new BMessage(MANAGE_PROFILES_MSG)); - // ---- Settings section fPanel = new BTabView("showview_box"); @@ -69,7 +65,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title) .AddGroup(B_HORIZONTAL, 5) .Add(profilesMenuField) .AddGlue() - .Add(button) .End() .Add(fPanel) .Add(bottomDivider) @@ -197,6 +192,8 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what) menu->AddSeparatorItem(); menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS), new BMessage(NEW_PROFILE_MSG))); + menu->AddItem(new BMenuItem(B_TRANSLATE("Manage" B_UTF8_ELLIPSIS), + new BMessage(MANAGE_PROFILES_MSG))); if (strlen(current_profile)) { item = menu->FindItem(current_profile); @@ -223,7 +220,7 @@ NetworkSetupWindow::_BuildShowTabView(int32 msg_what) if (!search_paths) return; - fMinAddonViewRect.Set(0, 0, 200, 200); // Minimum size + fMinAddonViewRect.Set(0, 0, 350, 200); // Minimum size search_paths = strdup(search_paths); char* next_path_token;