diff --git a/src/preferences/menu/FontMenu.cpp b/src/preferences/menu/FontMenu.cpp index 79497bcebb..33b2c59c89 100644 --- a/src/preferences/menu/FontMenu.cpp +++ b/src/preferences/menu/FontMenu.cpp @@ -48,6 +48,7 @@ FontMenu::GetFonts() } } + void FontMenu::Update() { @@ -55,23 +56,28 @@ FontMenu::Update() // related stuff out of the FontMenu class // so it can be easily reused in other apps get_menu_info(&info); - + // font menu BFont font; font.SetFamilyAndStyle(info.f_family, info.f_style); font.SetSize(info.font_size); - SetFont(&font); - SetViewColor(info.background_color); - InvalidateLayout(); - // font style menus - for (int i = 0; i < CountItems(); i++) { - ItemAt(i)->Submenu()->SetFont(&font); - } - + + if (LockLooper()) { + SetFont(&font); + SetViewColor(info.background_color); + // font style menus + for (int i = 0; i < CountItems(); i++) + ItemAt(i)->Submenu()->SetFont(&font); + InvalidateLayout(); + Invalidate(); + UnlockLooper(); + } + ClearAllMarkedItems(); PlaceCheckMarkOnFont(info.f_family, info.f_style); } + status_t FontMenu::PlaceCheckMarkOnFont(font_family family, font_style style) { @@ -80,24 +86,18 @@ FontMenu::PlaceCheckMarkOnFont(font_family family, font_style style) BMenu *styleMenu; fontFamilyItem = FindItem(family); - if ((fontFamilyItem != NULL) && (family != NULL)) - { + if ((fontFamilyItem != NULL) && (family != NULL)) { fontFamilyItem->SetMarked(true); styleMenu = fontFamilyItem->Submenu(); - if ((styleMenu != NULL) && (style != NULL)) - { + if ((styleMenu != NULL) && (style != NULL)) { fontStyleItem = styleMenu->FindItem(style); if (fontStyleItem != NULL) - { fontStyleItem->SetMarked(true); - } - } - else + } else return B_ERROR; - } - else + } else return B_ERROR; return B_OK; diff --git a/src/preferences/menu/FontSizeMenu.cpp b/src/preferences/menu/FontSizeMenu.cpp index 86b5827f63..7c2f4b5060 100644 --- a/src/preferences/menu/FontSizeMenu.cpp +++ b/src/preferences/menu/FontSizeMenu.cpp @@ -57,15 +57,15 @@ FontSizeMenu::Update() get_menu_info(&info); BFont font; - Supermenu()->Window()->Lock(); - font.SetFamilyAndStyle(info.f_family, info.f_style); - font.SetSize(info.font_size); - SetFont(&font); - SetViewColor(info.background_color); - Supermenu()->Window()->Unlock(); - set_menu_info(&info); - - InvalidateLayout(); - Invalidate(); + if (LockLooper()) { + font.SetFamilyAndStyle(info.f_family, info.f_style); + font.SetSize(info.font_size); + SetFont(&font); + SetViewColor(info.background_color); + InvalidateLayout(); + Invalidate(); + UnlockLooper(); + } + SetEnabled(true); } diff --git a/src/preferences/menu/MenuBar.cpp b/src/preferences/menu/MenuBar.cpp index 4da772ece9..a97b825eb8 100644 --- a/src/preferences/menu/MenuBar.cpp +++ b/src/preferences/menu/MenuBar.cpp @@ -131,15 +131,17 @@ MenuBar::Update() set_menu(); BFont font; - Window()->Lock(); - font.SetFamilyAndStyle(info.f_family, info.f_style); - font.SetSize(info.font_size); - SetFont(&font); - SetViewColor(info.background_color); - Window()->Unlock(); - - // force the menu to redraw - InvalidateLayout(); + if (LockLooper()) { + font.SetFamilyAndStyle(info.f_family, info.f_style); + font.SetSize(info.font_size); + SetFont(&font); + SetViewColor(info.background_color); + + // force the menu to redraw + InvalidateLayout(); + Invalidate(); + UnlockLooper(); + } } @@ -147,5 +149,6 @@ void MenuBar::FrameResized(float width, float height) { Window()->ResizeTo(width + 80, height + 55); - Window()->PostMessage(UPDATE_WINDOW); + Window()->PostMessage(UPDATE_WINDOW); + BMenuBar::FrameResized(width, height); }