clean up calculations of ListViewItem positions in Interfaces add-on; remove delete profile option which doesn't make sense
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40311 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2009 Haiku Inc. All rights reserved.
|
* Copyright 2004-2011 Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Philippe Houdoin
|
* Philippe Houdoin
|
||||||
* Fredrik Modéen
|
* Fredrik Modéen
|
||||||
|
* Alexander von Gluck IV, <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -78,8 +79,14 @@ InterfaceListItem::Update(BView* owner, const BFont* font)
|
|||||||
font_height height;
|
font_height height;
|
||||||
font->GetHeight(&height);
|
font->GetHeight(&height);
|
||||||
|
|
||||||
// TODO: take into account icon height, if he's taller...
|
float lineHeight = ceilf(height.ascent) + ceilf(height.descent)
|
||||||
SetHeight((height.ascent+height.descent+height.leading) * 3.0 + 8);
|
+ ceilf(height.leading);
|
||||||
|
|
||||||
|
fFirstlineOffset = 2 + ceilf(height.ascent + height.leading / 2);
|
||||||
|
fSecondlineOffset = fFirstlineOffset + lineHeight;
|
||||||
|
fThirdlineOffset = fFirstlineOffset + (lineHeight * 2);
|
||||||
|
|
||||||
|
SetHeight(3 * lineHeight + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -90,11 +97,7 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
|
|||||||
if (!list)
|
if (!list)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
font_height height;
|
owner->PushState();
|
||||||
BFont font;
|
|
||||||
owner->GetFont(&font);
|
|
||||||
font.GetHeight(&height);
|
|
||||||
float fntheight = height.ascent+height.descent+height.leading;
|
|
||||||
|
|
||||||
BRect bounds = list->ItemFrame(list->IndexOf(this));
|
BRect bounds = list->ItemFrame(list->IndexOf(this));
|
||||||
|
|
||||||
@@ -116,9 +119,9 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
|
|||||||
owner->SetHighColor( oldcolor );
|
owner->SetHighColor( oldcolor );
|
||||||
|
|
||||||
BPoint iconPt = bounds.LeftTop() + BPoint(4,4);
|
BPoint iconPt = bounds.LeftTop() + BPoint(4,4);
|
||||||
BPoint namePt = iconPt + BPoint(32+8, fntheight);
|
BPoint namePt = BPoint(32+12, fFirstlineOffset);
|
||||||
BPoint driverPt = iconPt + BPoint(32+8, fntheight*2);
|
BPoint driverPt = BPoint(32+12, fSecondlineOffset);
|
||||||
BPoint commentPt = iconPt + BPoint(32+8, fntheight*3);
|
BPoint commentPt = BPoint(32+12, fThirdlineOffset);
|
||||||
|
|
||||||
drawing_mode mode = owner->DrawingMode();
|
drawing_mode mode = owner->DrawingMode();
|
||||||
if (fSettings->IsDisabled()) {
|
if (fSettings->IsDisabled()) {
|
||||||
@@ -151,6 +154,8 @@ InterfaceListItem::DrawItem(BView* owner, BRect /*bounds*/, bool complete)
|
|||||||
|
|
||||||
owner->SetHighColor(oldcolor);
|
owner->SetHighColor(oldcolor);
|
||||||
owner->SetDrawingMode(mode);
|
owner->SetDrawingMode(mode);
|
||||||
|
|
||||||
|
owner->PopState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ private:
|
|||||||
BBitmap* fIcon;
|
BBitmap* fIcon;
|
||||||
BNetworkInterface fInterface;
|
BNetworkInterface fInterface;
|
||||||
Settings* fSettings;
|
Settings* fSettings;
|
||||||
|
float fFirstlineOffset;
|
||||||
|
float fSecondlineOffset;
|
||||||
|
float fThirdlineOffset;
|
||||||
|
float fStateWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
SubDir HAIKU_TOP src tests kits net preflet ;
|
SubDir HAIKU_TOP src tests kits net preflet ;
|
||||||
|
|
||||||
SimpleTest NetworkSetup :
|
Preference NetworkSetup :
|
||||||
NetworkSetup.cpp
|
NetworkSetup.cpp
|
||||||
NetworkSetupWindow.cpp
|
NetworkSetupWindow.cpp
|
||||||
NetworkSetupProfile.cpp
|
NetworkSetupProfile.cpp
|
||||||
NetworkSetupAddOn.cpp
|
NetworkSetupAddOn.cpp
|
||||||
: be root $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS)
|
: be root $(TARGET_LIBSTDC++) $(HAIKU_LOCALE_LIBS)
|
||||||
|
: NetworkSetup.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
SubInclude HAIKU_TOP src tests kits net preflet InterfacesAddOn ;
|
SubInclude HAIKU_TOP src tests kits net preflet InterfacesAddOn ;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#define SOFTWARE_EDITOR "Haiku"
|
#define SOFTWARE_EDITOR "Haiku"
|
||||||
#define NAME "NetworkSettings"
|
#define NAME "NetworkSetup"
|
||||||
#define SOFTWARE_VERSION_LABEL "0.1.0 alpha"
|
#define SOFTWARE_VERSION_LABEL "0.1.0 alpha"
|
||||||
|
|
||||||
#define APPLICATION_SIGNATURE "application/x-vnd." SOFTWARE_EDITOR "-" NAME
|
#define APPLICATION_SIGNATURE "application/x-vnd." SOFTWARE_EDITOR "-" NAME
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
|||||||
BWindow(BRect(100, 100, 300, 300), title, B_TITLED_WINDOW,
|
BWindow(BRect(100, 100, 300, 300), title, B_TITLED_WINDOW,
|
||||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
|
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
|
||||||
{
|
{
|
||||||
BBox *topDivider = new BBox(B_EMPTY_STRING);
|
|
||||||
topDivider->SetBorder(B_PLAIN_BORDER);
|
|
||||||
|
|
||||||
// ---- Profiles section
|
// ---- Profiles section
|
||||||
BMenu *profilesPopup = new BPopUpMenu("<none>");
|
BMenu *profilesPopup = new BPopUpMenu("<none>");
|
||||||
_BuildProfilesMenu(profilesPopup, SELECT_PROFILE_MSG);
|
_BuildProfilesMenu(profilesPopup, SELECT_PROFILE_MSG);
|
||||||
@@ -74,7 +71,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
|||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(button)
|
.Add(button)
|
||||||
.End()
|
.End()
|
||||||
.Add(topDivider)
|
|
||||||
.Add(fPanel)
|
.Add(fPanel)
|
||||||
.Add(bottomDivider)
|
.Add(bottomDivider)
|
||||||
.AddGroup(B_HORIZONTAL, 5)
|
.AddGroup(B_HORIZONTAL, 5)
|
||||||
@@ -87,7 +83,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
|||||||
|
|
||||||
_BuildShowTabView(SHOW_MSG);
|
_BuildShowTabView(SHOW_MSG);
|
||||||
|
|
||||||
topDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
|
|
||||||
bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
|
bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
|
||||||
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
|
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
|
||||||
fMinAddonViewRect.Height()));
|
fMinAddonViewRect.Height()));
|
||||||
@@ -119,10 +114,6 @@ NetworkSetupWindow::MessageReceived(BMessage* msg)
|
|||||||
case NEW_PROFILE_MSG:
|
case NEW_PROFILE_MSG:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DELETE_PROFILE_MSG: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SELECT_PROFILE_MSG: {
|
case SELECT_PROFILE_MSG: {
|
||||||
BPath name;
|
BPath name;
|
||||||
const char *path;
|
const char *path;
|
||||||
@@ -206,8 +197,6 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
|
|||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(NEW_PROFILE_MSG)));
|
new BMessage(NEW_PROFILE_MSG)));
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Delete"),
|
|
||||||
new BMessage(DELETE_PROFILE_MSG)));
|
|
||||||
|
|
||||||
if (strlen(current_profile)) {
|
if (strlen(current_profile)) {
|
||||||
item = menu->FindItem(current_profile);
|
item = menu->FindItem(current_profile);
|
||||||
|
|||||||
Reference in New Issue
Block a user