From 33c16998cd42c530b9aafb95d05375034c5556f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 15 Jun 2005 03:29:10 +0000 Subject: [PATCH] Removed unused constants. People is now almost font-sensitive (only the width is fixed). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13137 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/people/PeopleView.cpp | 14 ++++++--- src/apps/people/PeopleView.h | 54 -------------------------------- src/apps/people/PeopleWindow.cpp | 2 +- 3 files changed, 10 insertions(+), 60 deletions(-) diff --git a/src/apps/people/PeopleView.cpp b/src/apps/people/PeopleView.cpp index e5f999c557..96f30d0414 100644 --- a/src/apps/people/PeopleView.cpp +++ b/src/apps/people/PeopleView.cpp @@ -28,7 +28,7 @@ TPeopleView::TPeopleView(BRect rect, char *title, entry_ref *ref) - :BView(rect, title, B_FOLLOW_ALL, B_WILL_DRAW) + :BView(rect, title, B_FOLLOW_NONE, B_WILL_DRAW) { if (ref) fFile = new BFile(ref, O_RDWR); @@ -51,15 +51,19 @@ TPeopleView::AttachedToWindow(void) BRect bounds = Bounds(); BFont font = *be_plain_font; - int32 offset = int32(font.StringWidth(HPHONE_TEXT) + 10.5); + int32 offset = int32(font.StringWidth(gFields[F_HPHONE].name) + 10.5); + font_height fontHeight; + font.GetHeight(&fontHeight); + int32 textHeight = int32(fontHeight.ascent + fontHeight.descent + + fontHeight.leading + 12.5); BRect rect; int32 row = 0; for (int32 i = 0; gFields[i].attribute; i++, row++) { const char *name = gFields[i].name; - rect.Set(NAME_H, NAME_V + row * 25, - bounds.right - NAME_H, NAME_V + (row + 1) * 25); + rect.Set(NAME_H, NAME_V + row * textHeight, + bounds.right - NAME_H, NAME_V + (row + 1) * textHeight); int32 labelOffset = offset; if (i == F_NAME) @@ -103,7 +107,7 @@ TPeopleView::AttachedToWindow(void) AddChild(field); fField[F_NAME]->MakeFocus(); - ResizeTo(bounds.right, rect.bottom + NAME_V); + ResizeTo(bounds.right, rect.bottom - 5 + NAME_V); } diff --git a/src/apps/people/PeopleView.h b/src/apps/people/PeopleView.h index 774a6d8685..fcda3ad7bb 100644 --- a/src/apps/people/PeopleView.h +++ b/src/apps/people/PeopleView.h @@ -15,63 +15,9 @@ #include "PeopleApp.h" -#define TEXT_HEIGHT 16 #define NAME_H 10 #define NAME_V 10 -#define NAME_WIDTH 300 -#define NAME_TEXT "Name:" -#define NICKNAME_H 10 -#define NICKNAME_V (NAME_V + 25) -#define NICKNAME_WIDTH 300 -#define NICKNAME_TEXT "Nickname:" -#define COMPANY_H 10 -#define COMPANY_V (NICKNAME_V + 25) -#define COMPANY_WIDTH 300 -#define COMPANY_TEXT "Company:" -#define ADDRESS_H 10 -#define ADDRESS_V (COMPANY_V + 25) -#define ADDRESS_WIDTH 300 -#define ADDRESS_TEXT "Address:" -#define CITY_H 10 -#define CITY_V (ADDRESS_V + 25) -#define CITY_WIDTH 300 -#define CITY_TEXT "City:" -#define STATE_H 10 -#define STATE_V (CITY_V + 25) #define STATE_WIDTH 175 -#define STATE_TEXT "State:" -#define ZIP_H (STATE_H + STATE_WIDTH) -#define ZIP_V (CITY_V + 25) -#define ZIP_WIDTH 125 -#define ZIP_TEXT "Zip:" -#define COUNTRY_H 10 -#define COUNTRY_V (ZIP_V + 25) -#define COUNTRY_WIDTH 300 -#define COUNTRY_TEXT "Country:" -#define HPHONE_H 10 -#define HPHONE_V (COUNTRY_V + 25) -#define HPHONE_WIDTH 300 -#define HPHONE_TEXT "Home Phone:" -#define WPHONE_H 10 -#define WPHONE_V (HPHONE_V + 25) -#define WPHONE_WIDTH 300 -#define WPHONE_TEXT "Work Phone:" -#define FAX_H 10 -#define FAX_V (WPHONE_V + 25) -#define FAX_WIDTH 300 -#define FAX_TEXT "Fax:" -#define EMAIL_H 10 -#define EMAIL_V (FAX_V + 25) -#define EMAIL_WIDTH 300 -#define EMAIL_TEXT "E-mail:" -#define URL_H 10 -#define URL_V (EMAIL_V + 25) -#define URL_WIDTH 300 -#define URL_TEXT "URL:" -#define GROUP_H 10 -#define GROUP_V (URL_V + 25) -#define GROUP_WIDTH 300 -#define GROUP_TEXT "Group:" class TTextControl; diff --git a/src/apps/people/PeopleWindow.cpp b/src/apps/people/PeopleWindow.cpp index 1a94843d92..0b34fa16e3 100644 --- a/src/apps/people/PeopleWindow.cpp +++ b/src/apps/people/PeopleWindow.cpp @@ -75,8 +75,8 @@ TPeopleWindow::TPeopleWindow(BRect frame, char *title, entry_ref *ref) rect.OffsetTo(0, menuBar->Bounds().bottom + 1); fView = new TPeopleView(rect, "PeopleView", fRef); - ResizeTo(frame.Width(), fView->Frame().bottom); AddChild(fView); + ResizeTo(fView->Frame().right, fView->Frame().bottom); }