* The InfoWindow's name text view is now using DisallowFilenameKeys() as well.

* DisallowFilenameKeys() no longer forbids the ':', as there is no reason to do
  so.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33894 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-11-05 12:37:43 +00:00
parent f4ee0103a2
commit a63c61839e
2 changed files with 18 additions and 16 deletions

View File

@ -1853,16 +1853,19 @@ AttributeView::BeginEditingTitle()
fTitleEditView = new BTextView(textFrame, "text_editor",
textRect, &font, 0, B_FOLLOW_ALL, B_WILL_DRAW);
fTitleEditView->SetText(fModel->Name());
DisallowFilenameKeys(fTitleEditView);
// Reset the width of the text rect
textRect = fTitleEditView->TextRect();
textRect.right = fTitleEditView->LineWidth() + 20;
fTitleEditView->SetTextRect(textRect);
fTitleEditView->SetWordWrap(false);
// Add filter for catching B_RETURN and B_ESCAPE key's
fTitleEditView->AddFilter(new BMessageFilter(B_KEY_DOWN, AttributeView::TextViewFilter));
fTitleEditView->AddFilter(
new BMessageFilter(B_KEY_DOWN, AttributeView::TextViewFilter));
BScrollView *scrollView = new BScrollView("BorderView",
fTitleEditView, 0, 0, false, false, B_PLAIN_BORDER);
BScrollView *scrollView = new BScrollView("BorderView", fTitleEditView,
0, 0, false, false, B_PLAIN_BORDER);
AddChild(scrollView);
fTitleEditView->SelectAll();
fTitleEditView->MakeFocus();

View File

@ -91,7 +91,7 @@ HashString(const char *string, uint32 seed)
{
char ch;
uint32 result = seed;
while((ch = *string++) != 0) {
result = (result << 7) ^ (result >> 24);
result ^= ch;
@ -129,7 +129,7 @@ ValidateStream(BMallocIO *stream, uint32 key, int32 version)
int32 testVersion;
if (stream->Read(&testKey, sizeof(uint32)) <= 0
|| stream->Read(&testVersion, sizeof(int32)) <=0)
|| stream->Read(&testVersion, sizeof(int32)) <=0)
return false;
return testKey == key && testVersion == version;
@ -139,7 +139,6 @@ ValidateStream(BMallocIO *stream, uint32 key, int32 version)
void
DisallowFilenameKeys(BTextView *textView)
{
textView->DisallowChar(':');
textView->DisallowChar('/');
}
@ -473,7 +472,7 @@ namespace BPrivate {
* "from" is always transparent, "to" opaque.
*/
void
void
FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, int32 to)
{
// check parameters
@ -507,7 +506,7 @@ FadeRGBA32Horizontal(uint32 *bits, int32 width, int32 height, int32 from, int32
* "from" is always transparent, "to" opaque.
*/
void
void
FadeRGBA32Vertical(uint32 *bits, int32 width, int32 height, int32 from, int32 to)
{
// check parameters
@ -723,7 +722,7 @@ FlickerFreeStringView::Draw(BRect)
loc.x = bounds.left + (2 - eInfo.left);
break;
}
case B_ALIGN_CENTER:
{
float width = StringWidth(Text());
@ -731,7 +730,7 @@ FlickerFreeStringView::Draw(BRect)
loc.x = center - (width/2);
break;
}
case B_ALIGN_RIGHT:
{
float width = StringWidth(Text());
@ -906,7 +905,7 @@ TitledSeparatorItem::Draw()
parent->DrawString(truncatedLabel.String());
parent->MovePenTo(loc);
parent->SetHighColor(ShiftMenuBackgroundColor(B_DISABLED_LABEL_TINT));
parent->SetHighColor(ShiftMenuBackgroundColor(B_DISABLED_LABEL_TINT));
parent->DrawString(truncatedLabel.String());
parent->PopState();
@ -1390,7 +1389,7 @@ GetAppSignatureFromAttr(BFile *file, char *result)
// avoids using the BAppFileInfo API when retrieving the
// app signature -- the call is expensive because by default
// the resource fork is scanned to read the attribute
#ifdef B_APP_FILE_INFO_IS_FAST
BAppFileInfo appFileInfo(file);
return appFileInfo.GetSignature(result);
@ -1436,7 +1435,7 @@ GetAppIconFromAttr(BFile *file, BBitmap *result, icon_size size)
// }
// }
//
// // try again with R5 icons
// // try again with R5 icons
// attrName = size == B_LARGE_ICON ? kAttrLargeIcon : kAttrMiniIcon;
// type = size == B_LARGE_ICON ? LARGE_ICON_TYPE : MINI_ICON_TYPE;
//
@ -1533,7 +1532,7 @@ PositionPassingMenuItem::PositionPassingMenuItem(BMenu *menu,
}
status_t
status_t
PositionPassingMenuItem::Invoke(BMessage *message)
{
if (!Menu())
@ -1612,7 +1611,7 @@ ComputeTypeAheadScore(const char *text, const char *match, size_t matchLength,
score = 0;
break;
}
bool wordStart = k == 0 || isspace(text[k - 1]);
if (wordStart)
score++;
@ -1623,7 +1622,7 @@ ComputeTypeAheadScore(const char *text, const char *match, size_t matchLength,
if (match[j - 1] == text[k - 1])
score += 0.7;
}
score += 1.f / (k + 1);
k++;
}