diff --git a/src/apps/terminal/AppearPrefView.cpp b/src/apps/terminal/AppearPrefView.cpp index e0c447b8fe..f439841df1 100644 --- a/src/apps/terminal/AppearPrefView.cpp +++ b/src/apps/terminal/AppearPrefView.cpp @@ -24,31 +24,6 @@ #include "TermConst.h" -static bool -IsFontUsable(const BFont &font) -{ - // TODO: If BFont::IsFullAndHalfFixed() was implemented, we could - // use that. But I don't think it's easily implementable using - // Freetype. - - if (font.IsFixed()) - return true; - - bool widthOk = true; - int lastWidth = 0; - char buffer[2] = {0, 0}; - for (int c = 0x20 ; c <= 0x7e; c++){ - buffer[0] = c; - - int width = (int)ceilf(font.StringWidth(buffer)); - if (c > 0x20 && width != lastWidth) - widthOk = false; - lastWidth = width; - } - - return widthOk; -} - AppearancePrefView::AppearancePrefView(BRect frame, const char *name, BMessenger messenger) @@ -216,6 +191,32 @@ AppearancePrefView::MessageReceived(BMessage *msg) } +static bool +IsFontUsable(const BFont &font) +{ + // TODO: If BFont::IsFullAndHalfFixed() was implemented, we could + // use that. But I don't think it's easily implementable using + // Freetype. + + if (font.IsFixed()) + return true; + + // manually check if all applicable chars are the same width + char buffer[2] = { ' ', 0 }; + int firstWidth = (int)ceilf(font.StringWidth(buffer)); + + for (int c = ' '+1; c <= 0x7e; c++) { + buffer[0] = c; + int width = (int)ceilf(font.StringWidth(buffer)); + + if (width != firstWidth) + return false; + } + + return true; +} + + BMenu * AppearancePrefView::_MakeFontMenu(uint32 command, const char *defaultFontName) { diff --git a/src/apps/terminal/FindWindow.cpp b/src/apps/terminal/FindWindow.cpp index c91fdc7e59..e0747e5e4b 100644 --- a/src/apps/terminal/FindWindow.cpp +++ b/src/apps/terminal/FindWindow.cpp @@ -49,7 +49,8 @@ FindWindow::FindWindow (BRect frame, BMessenger messenger , BString &str, //These things are calculated from the top float textRadioTop = 12; float textRadioBottom = textRadioTop + 2 + lineHeight + 2 + 1; - float textRadioRight = fFindView->StringWidth("Use Text: ") + 30; + float textRadioLeft = 14; + float textRadioRight = textRadioLeft + fFindView->StringWidth("Use Text: ") + 30; float selectionRadioTop = textRadioBottom + 4; float selectionRadioBottom = selectionRadioTop + lineHeight + 8; @@ -61,7 +62,7 @@ FindWindow::FindWindow (BRect frame, BMessenger messenger , BString &str, float searchButtonRight = searchButtonLeft + fFindView->StringWidth("Find") + 60; //Build the Views - fTextRadio = new BRadioButton(BRect(14, textRadioTop, textRadioRight, textRadioBottom), + fTextRadio = new BRadioButton(BRect(textRadioLeft, textRadioTop, textRadioRight, textRadioBottom), "fTextRadio", "Use Text: ", NULL); fFindView->AddChild(fTextRadio); @@ -160,6 +161,8 @@ FindWindow::_SendFindMessage() message.AddBool("findselection", true); //Add the other parameters + // TODO: "usetext" is never checked for elsewhere and seems redundant with + // "findselection", why is it here? message.AddBool("usetext", fTextRadio->Value() == B_CONTROL_ON); message.AddBool("forwardsearch", fForwardSearchBox->Value() == B_CONTROL_ON); message.AddBool("matchcase", fMatchCaseBox->Value() == B_CONTROL_ON); @@ -167,3 +170,4 @@ FindWindow::_SendFindMessage() fFindDlgMessenger.SendMessage(&message); } + diff --git a/src/apps/terminal/TermApp.cpp b/src/apps/terminal/TermApp.cpp index 855409720b..ececce679e 100644 --- a/src/apps/terminal/TermApp.cpp +++ b/src/apps/terminal/TermApp.cpp @@ -129,10 +129,11 @@ TermApp::Quit() void TermApp::AboutRequested() { + // used spaces instead of tabs to avoid Murai's name being wrapped BAlert *alert = new BAlert("about", "Terminal\n" - "\twritten by Kazuho Okui and Takashi Murai\n" - "\tupdated by Kian Duffy and others\n\n" - "\tCopyright " B_UTF8_COPYRIGHT "2003-2008, Haiku.\n", "Ok"); + " written by Kazuho Okui and Takashi Murai\n" + " updated by Kian Duffy and others\n\n" + " Copyright " B_UTF8_COPYRIGHT "2003-2008, Haiku.\n", "Ok"); BTextView *view = alert->TextView(); view->SetStylable(true); diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index e53b75b7e0..c2411e7c3b 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -416,6 +416,7 @@ TermWindow::MessageReceived(BMessage *message) break; case MSG_FIND: + { fFindPanel->PostMessage(B_QUIT_REQUESTED); message->FindBool("findselection", &fFindSelection); if (!fFindSelection) @@ -424,8 +425,10 @@ TermWindow::MessageReceived(BMessage *message) _ActiveTermView()->GetSelection(fFindString); if (fFindString.Length() == 0) { - BAlert *alert = new BAlert("find failed", "No search string.", "Okay", NULL, + const char *errorMsg = (!fFindSelection) ? "No search string was entered." : "Nothing is selected."; + BAlert *alert = new BAlert("Find failed", errorMsg, "Ok", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->Go(); fFindPreviousMenuItem->SetEnabled(false); fFindNextMenuItem->SetEnabled(false); @@ -438,7 +441,7 @@ TermWindow::MessageReceived(BMessage *message) findresult = _ActiveTermView()->Find(fFindString, fForwardSearch, fMatchCase, fMatchWord); if (!findresult) { - BAlert *alert = new BAlert("find failed", "Not Found.", "Okay", NULL, + BAlert *alert = new BAlert("Find failed", "Text not found.", "Ok", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); alert->SetShortcut(0, B_ESCAPE); alert->Go(); @@ -451,6 +454,7 @@ TermWindow::MessageReceived(BMessage *message) fFindPreviousMenuItem->SetEnabled(true); fFindNextMenuItem->SetEnabled(true); break; + } case MENU_FIND_NEXT: case MENU_FIND_PREVIOUS: