Style fixes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42270 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -37,25 +37,27 @@ BFileControl::BFileControl(BRect rect, const char* name, const char* label,
|
|||||||
// determine font height
|
// determine font height
|
||||||
font_height fontHeight;
|
font_height fontHeight;
|
||||||
GetFontHeight(&fontHeight);
|
GetFontHeight(&fontHeight);
|
||||||
float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 13;
|
float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent
|
||||||
|
+ fontHeight.leading) + 13;
|
||||||
BString selectString = B_TRANSLATE("Select" B_UTF8_ELLIPSIS);
|
BString selectString = B_TRANSLATE("Select" B_UTF8_ELLIPSIS);
|
||||||
float labelWidth = StringWidth(selectString) + 20;
|
float labelWidth = StringWidth(selectString) + 20;
|
||||||
rect = Bounds();
|
rect = Bounds();
|
||||||
rect.right -= labelWidth;
|
rect.right -= labelWidth;
|
||||||
rect.top = 4; rect.bottom = itemHeight + 2;
|
rect.top = 4;
|
||||||
fText = new BTextControl(rect,"file_path",label,pathOfFile,NULL);
|
rect.bottom = itemHeight + 2;
|
||||||
|
fText = new BTextControl(rect,"file_path", label, pathOfFile, NULL);
|
||||||
if (label)
|
if (label)
|
||||||
fText->SetDivider(fText->StringWidth(label) + 6);
|
fText->SetDivider(fText->StringWidth(label) + 6);
|
||||||
AddChild(fText);
|
AddChild(fText);
|
||||||
|
|
||||||
fButton = new BButton(BRect(0,0,1,1), "select_file", selectString,
|
fButton = new BButton(BRect(0, 0, 1, 1), "select_file", selectString,
|
||||||
new BMessage(kMsgSelectButton));
|
new BMessage(kMsgSelectButton));
|
||||||
fButton->ResizeToPreferred();
|
fButton->ResizeToPreferred();
|
||||||
fButton->MoveBy(rect.right + 6,
|
fButton->MoveBy(rect.right + 6,
|
||||||
(rect.Height() - fButton->Frame().Height()) / 2);
|
(rect.Height() - fButton->Frame().Height()) / 2);
|
||||||
AddChild(fButton);
|
AddChild(fButton);
|
||||||
|
|
||||||
fPanel = new BFilePanel(B_OPEN_PANEL,NULL,NULL,flavors,false);
|
fPanel = new BFilePanel(B_OPEN_PANEL, NULL, NULL, flavors, false);
|
||||||
|
|
||||||
ResizeToPreferred();
|
ResizeToPreferred();
|
||||||
}
|
}
|
||||||
@@ -79,7 +81,7 @@ BFileControl::AttachedToWindow()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BFileControl::MessageReceived(BMessage *msg)
|
BFileControl::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
switch (msg->what)
|
switch (msg->what)
|
||||||
{
|
{
|
||||||
@@ -99,7 +101,7 @@ BFileControl::MessageReceived(BMessage *msg)
|
|||||||
case B_REFS_RECEIVED:
|
case B_REFS_RECEIVED:
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (msg->FindRef("refs",&ref) >= B_OK)
|
if (msg->FindRef("refs", &ref) >= B_OK)
|
||||||
{
|
{
|
||||||
BEntry entry(&ref);
|
BEntry entry(&ref);
|
||||||
if (entry.InitCheck() >= B_OK)
|
if (entry.InitCheck() >= B_OK)
|
||||||
@@ -120,7 +122,7 @@ BFileControl::MessageReceived(BMessage *msg)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BFileControl::SetText(const char *pathOfFile)
|
BFileControl::SetText(const char* pathOfFile)
|
||||||
{
|
{
|
||||||
fText->SetText(pathOfFile);
|
fText->SetText(pathOfFile);
|
||||||
}
|
}
|
||||||
@@ -142,7 +144,7 @@ BFileControl::SetEnabled(bool enabled)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BFileControl::GetPreferredSize(float *width, float *height)
|
BFileControl::GetPreferredSize(float* width, float* height)
|
||||||
{
|
{
|
||||||
*width = fButton->Frame().right + 5;
|
*width = fButton->Frame().right + 5;
|
||||||
*height = fText->Bounds().Height() + 8;
|
*height = fText->Bounds().Height() + 8;
|
||||||
@@ -163,7 +165,7 @@ BMailFileConfigView::BMailFileConfigView(const char* label, const char*name,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BMailFileConfigView::SetTo(const BMessage *archive, BMessage *meta)
|
BMailFileConfigView::SetTo(const BMessage* archive, BMessage* meta)
|
||||||
{
|
{
|
||||||
fMeta = meta;
|
fMeta = meta;
|
||||||
BString path = (fUseMeta ? meta : archive)->FindString(fName);
|
BString path = (fUseMeta ? meta : archive)->FindString(fName);
|
||||||
@@ -174,14 +176,13 @@ BMailFileConfigView::SetTo(const BMessage *archive, BMessage *meta)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMailFileConfigView::Archive(BMessage *into, bool /*deep*/) const
|
BMailFileConfigView::Archive(BMessage* into, bool /*deep*/) const
|
||||||
{
|
{
|
||||||
const char *path = Text();
|
const char* path = Text();
|
||||||
BMessage *archive = fUseMeta ? fMeta : into;
|
BMessage* archive = fUseMeta ? fMeta : into;
|
||||||
|
|
||||||
if (archive->ReplaceString(fName,path) != B_OK)
|
if (archive->ReplaceString(fName,path) != B_OK)
|
||||||
archive->AddString(fName,path);
|
archive->AddString(fName,path);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user