From da2b227ec7153752aa26a830b49345bb821259f8 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sun, 16 Aug 2009 15:31:09 +0000 Subject: [PATCH] Preference panel : Reverted some of my "optimizations" since Ingo (correctly) points out that: * they (the way I did it) can do more worse than good in some case * they (the way I did it) are generally against our coding-style Sorry about that. (ticket #4245) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32439 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/AppearPrefView.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/apps/terminal/AppearPrefView.cpp b/src/apps/terminal/AppearPrefView.cpp index 3426f0937a..e0c447b8fe 100644 --- a/src/apps/terminal/AppearPrefView.cpp +++ b/src/apps/terminal/AppearPrefView.cpp @@ -221,16 +221,15 @@ AppearancePrefView::_MakeFontMenu(uint32 command, const char *defaultFontName) { BPopUpMenu *menu = new BPopUpMenu(""); int32 numFamilies = count_font_families(); - BFont font; - BMenuItem *item; - font_family family; uint32 flags; for (int32 i = 0; i < numFamilies; i++) { - if (get_font_family(i, &family, &flags) == B_OK) { + font_family family; + if (get_font_family(i, &family, &flags) == B_OK) { + BFont font; font.SetFamilyAndStyle(family, NULL); if (IsFontUsable(font)) { - item = new BMenuItem(family, new BMessage(command)); + BMenuItem *item = new BMenuItem(family, new BMessage(command)); menu->AddItem(item); if (!strcmp(defaultFontName, family)) item->SetMarked(true); @@ -249,15 +248,12 @@ AppearancePrefView::_MakeSizeMenu(uint32 command, uint8 defaultSize) int32 sizes[] = {9, 10, 11, 12, 14, 16, 18, 0}; bool found = false; - BString string; - - BMenuItem *item; for (uint32 i = 0; sizes[i]; i++) { - string.SetTo(""); + BString string; string << sizes[i]; - item = new BMenuItem(string.String(), new BMessage(command)); + BMenuItem *item = new BMenuItem(string.String(), new BMessage(command)); menu->AddItem(item); if (sizes[i] == defaultSize) { @@ -268,9 +264,9 @@ AppearancePrefView::_MakeSizeMenu(uint32 command, uint8 defaultSize) if (!found) { for (uint32 i = 0; sizes[i]; i++) { if (sizes[i] > defaultSize) { - string.SetTo(""); + BString string; string << defaultSize; - item = new BMenuItem(string.String(), new BMessage(command)); + BMenuItem *item = new BMenuItem(string.String(), new BMessage(command)); item->SetMarked(true); menu->AddItem(item, i); break;