Patch by diver: selected font family is now check marked too.
Closes #5624. Thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38632 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -64,6 +64,7 @@ private:
|
|||||||
mutable char fText[32];
|
mutable char fText[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class RedirectUpAndDownFilter : public BMessageFilter {
|
class RedirectUpAndDownFilter : public BMessageFilter {
|
||||||
public:
|
public:
|
||||||
RedirectUpAndDownFilter(BHandler* target)
|
RedirectUpAndDownFilter(BHandler* target)
|
||||||
@@ -89,6 +90,7 @@ private:
|
|||||||
BHandler* fTarget;
|
BHandler* fTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class EscapeMessageFilter : public BMessageFilter {
|
class EscapeMessageFilter : public BMessageFilter {
|
||||||
public:
|
public:
|
||||||
EscapeMessageFilter(uint32 command)
|
EscapeMessageFilter(uint32 command)
|
||||||
@@ -298,20 +300,25 @@ CharacterWindow::MessageReceived(BMessage* message)
|
|||||||
case kMsgFontSelected:
|
case kMsgFontSelected:
|
||||||
{
|
{
|
||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
|
|
||||||
if (message->FindPointer("source", (void**)&item) != B_OK)
|
if (message->FindPointer("source", (void**)&item) != B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
fSelectedFontItem->SetMarked(false);
|
fSelectedFontItem->SetMarked(false);
|
||||||
|
|
||||||
// If it's the family menu, just select the first style
|
// If it's the family menu, just select the first style
|
||||||
if (item->Submenu() != NULL)
|
if (item->Submenu() != NULL) {
|
||||||
|
item->SetMarked(true);
|
||||||
item = item->Submenu()->ItemAt(0);
|
item = item->Submenu()->ItemAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
fSelectedFontItem = item;
|
fSelectedFontItem = item;
|
||||||
|
|
||||||
_SetFont(item->Menu()->Name(), item->Label());
|
_SetFont(item->Menu()->Name(), item->Label());
|
||||||
|
item = item->Menu()->Superitem();
|
||||||
|
item->SetMarked(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -467,6 +474,7 @@ BMenu*
|
|||||||
CharacterWindow::_CreateFontMenu()
|
CharacterWindow::_CreateFontMenu()
|
||||||
{
|
{
|
||||||
BMenu* menu = new BMenu("Font");
|
BMenu* menu = new BMenu("Font");
|
||||||
|
BMenuItem* item;
|
||||||
|
|
||||||
font_family currentFamily;
|
font_family currentFamily;
|
||||||
font_style currentStyle;
|
font_style currentStyle;
|
||||||
@@ -475,6 +483,8 @@ CharacterWindow::_CreateFontMenu()
|
|||||||
|
|
||||||
int32 numFamilies = count_font_families();
|
int32 numFamilies = count_font_families();
|
||||||
|
|
||||||
|
menu->SetRadioMode(true);
|
||||||
|
|
||||||
for (int32 i = 0; i < numFamilies; i++) {
|
for (int32 i = 0; i < numFamilies; i++) {
|
||||||
font_family family;
|
font_family family;
|
||||||
if (get_font_family(i, &family) == B_OK) {
|
if (get_font_family(i, &family) == B_OK) {
|
||||||
@@ -487,8 +497,7 @@ CharacterWindow::_CreateFontMenu()
|
|||||||
font_style style;
|
font_style style;
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
if (get_font_style(family, j, &style, &flags) == B_OK) {
|
if (get_font_style(family, j, &style, &flags) == B_OK) {
|
||||||
BMenuItem* item = new BMenuItem(style,
|
item = new BMenuItem(style, new BMessage(kMsgFontSelected));
|
||||||
new BMessage(kMsgFontSelected));
|
|
||||||
subMenu->AddItem(item);
|
subMenu->AddItem(item);
|
||||||
|
|
||||||
if (!strcmp(family, currentFamily)
|
if (!strcmp(family, currentFamily)
|
||||||
@@ -501,5 +510,8 @@ CharacterWindow::_CreateFontMenu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item = menu->FindItem(currentFamily);
|
||||||
|
item->SetMarked(true);
|
||||||
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user