Ticket #5624: charmapfontmenu.patch
File charmapfontmenu.patch, 2.0 KB (added by , 14 years ago) |
---|
-
src/apps/charactermap/CharacterWindow.cpp
64 64 mutable char fText[32]; 65 65 }; 66 66 67 67 68 class RedirectUpAndDownFilter : public BMessageFilter { 68 69 public: 69 70 RedirectUpAndDownFilter(BHandler* target) … … 89 90 BHandler* fTarget; 90 91 }; 91 92 93 92 94 class EscapeMessageFilter : public BMessageFilter { 93 95 public: 94 96 EscapeMessageFilter(uint32 command) … … 298 300 case kMsgFontSelected: 299 301 { 300 302 BMenuItem* item; 303 301 304 if (message->FindPointer("source", (void**)&item) != B_OK) 302 305 break; 303 306 304 307 fSelectedFontItem->SetMarked(false); 305 308 306 309 // If it's the family menu, just select the first style 307 if (item->Submenu() != NULL) 310 if (item->Submenu() != NULL) { 311 item->SetMarked(true); 308 312 item = item->Submenu()->ItemAt(0); 313 } 309 314 310 315 if (item != NULL) { 311 316 item->SetMarked(true); 312 317 fSelectedFontItem = item; 313 314 318 _SetFont(item->Menu()->Name(), item->Label()); 319 item = item->Menu()->Superitem(); 320 item->SetMarked(true); 315 321 } 316 322 break; 317 323 } … … 467 473 CharacterWindow::_CreateFontMenu() 468 474 { 469 475 BMenu* menu = new BMenu("Font"); 476 BMenuItem* item; 470 477 471 478 font_family currentFamily; 472 479 font_style currentStyle; … … 475 482 476 483 int32 numFamilies = count_font_families(); 477 484 485 menu->SetRadioMode(true); 486 478 487 for (int32 i = 0; i < numFamilies; i++) { 479 488 font_family family; 480 489 if (get_font_family(i, &family) == B_OK) { … … 487 496 font_style style; 488 497 uint32 flags; 489 498 if (get_font_style(family, j, &style, &flags) == B_OK) { 490 BMenuItem* item = new BMenuItem(style, 491 new BMessage(kMsgFontSelected)); 499 item = new BMenuItem(style, new BMessage(kMsgFontSelected)); 492 500 subMenu->AddItem(item); 493 501 494 502 if (!strcmp(family, currentFamily) … … 501 509 } 502 510 } 503 511 512 item = menu->FindItem(currentFamily); 513 item->SetMarked(true); 514 504 515 return menu; 505 516 }