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
This commit is contained in:
Axel Dörfler 2005-06-15 03:29:10 +00:00
parent 779f323d92
commit 33c16998cd
3 changed files with 10 additions and 60 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}