Also set a default style in the preferences. Mark the menuitem with the

default family/style.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33947 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2009-11-08 12:30:01 +00:00
parent e3b9a828db
commit fba4e002b1
3 changed files with 9 additions and 4 deletions

View File

@ -61,7 +61,8 @@ AppearancePrefView::AppearancePrefView(BRect frame, const char *name,
BRect r(5, 5, 261, 25);
BMenu *menu = _MakeFontMenu(MSG_HALF_FONT_CHANGED,
PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY));
PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY),
PrefHandler::Default()->getString(PREF_HALF_FONT_STYLE));
fFont = new BMenuField(r, "font", "Font:", menu);
fFont->SetDivider(colorDividerSize);
fFont->SetAlignment(B_ALIGN_RIGHT);
@ -227,7 +228,8 @@ IsFontUsable(const BFont &font)
BMenu *
AppearancePrefView::_MakeFontMenu(uint32 command, const char *defaultFontName)
AppearancePrefView::_MakeFontMenu(uint32 command,
const char *defaultFamily, const char *defaultStyle)
{
BPopUpMenu *menu = new BPopUpMenu("");
int32 numFamilies = count_font_families();
@ -252,7 +254,8 @@ AppearancePrefView::_MakeFontMenu(uint32 command, const char *defaultFontName)
BMenuItem *item = new BMenuItem(itemLabel,
message);
menu->AddItem(item);
if (!strcmp(defaultFontName, family))
if (!strcmp(defaultFamily, family)
&& !strcmp(defaultStyle, style))
item->SetMarked(true);
}
}

View File

@ -29,7 +29,8 @@ class AppearancePrefView : public PrefView {
virtual void GetPreferredSize(float *_width, float *_height);
private:
BMenu* _MakeFontMenu(uint32 command, const char *defaultFont);
BMenu* _MakeFontMenu(uint32 command, const char *defaultFamily,
const char *defaultStyle);
BMenu* _MakeSizeMenu(uint32 command, uint8 defaultSize);
BMenuField *fFont;

View File

@ -35,6 +35,7 @@ static const pref_defaults kTermDefaults[] = {
{ PREF_ROWS, "25" },
{ PREF_HALF_FONT_FAMILY, "Courier10 BT" },
{ PREF_HALF_FONT_STYLE, "Regular" },
{ PREF_HALF_FONT_SIZE, "12" },
{ PREF_TEXT_FORE_COLOR, " 0, 0, 0" },