diff --git a/src/preferences/menu/AutoSettingsMenu.cpp b/src/preferences/menu/AutoSettingsMenu.cpp index 114ddbe585..8aedb705a4 100644 --- a/src/preferences/menu/AutoSettingsMenu.cpp +++ b/src/preferences/menu/AutoSettingsMenu.cpp @@ -3,7 +3,7 @@ * Distributed under the terms of the MIT License. * * Authors: - * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ diff --git a/src/preferences/menu/AutoSettingsMenu.h b/src/preferences/menu/AutoSettingsMenu.h index b516f4a86c..b0fb115879 100644 --- a/src/preferences/menu/AutoSettingsMenu.h +++ b/src/preferences/menu/AutoSettingsMenu.h @@ -1,10 +1,11 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: - * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ + #ifndef AUTO_SETTINGS_MENU_H #define AUTO_SETTINGS_MENU_H @@ -20,3 +21,4 @@ class AutoSettingsMenu : public BMenu { }; #endif // AUTO_SETTINGS_MENU_H + diff --git a/src/preferences/menu/BitmapMenuItem.cpp b/src/preferences/menu/BitmapMenuItem.cpp index 68194f3439..09264f9638 100644 --- a/src/preferences/menu/BitmapMenuItem.cpp +++ b/src/preferences/menu/BitmapMenuItem.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ @@ -15,7 +16,7 @@ // BitmapMenuItem class definition BitmapMenuItem::BitmapMenuItem(const char* name, BMessage* message, - BBitmap* bmp, char shortcut, uint32 modifiers) + BBitmap* bmp, char shortcut, uint32 modifiers) : BMenuItem(name, message, shortcut, modifiers), fBitmap(bmp), fName(name) diff --git a/src/preferences/menu/BitmapMenuItem.h b/src/preferences/menu/BitmapMenuItem.h index 12af2bea5a..77a85f8c63 100644 --- a/src/preferences/menu/BitmapMenuItem.h +++ b/src/preferences/menu/BitmapMenuItem.h @@ -1,20 +1,19 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ + #ifndef BITMAP_MENU_ITEM_H #define BITMAP_MENU_ITEM_H - #include #include class BBitmap; - - class BitmapMenuItem : public BMenuItem { public: BitmapMenuItem(const char* name, BMessage* message, BBitmap* bmp, diff --git a/src/preferences/menu/ColorWindow.cpp b/src/preferences/menu/ColorWindow.cpp index 8f54b44b6d..cf7e69ec55 100644 --- a/src/preferences/menu/ColorWindow.cpp +++ b/src/preferences/menu/ColorWindow.cpp @@ -59,11 +59,6 @@ ColorWindow::ColorWindow(BMessenger owner) } -ColorWindow::~ColorWindow() -{ -} - - void ColorWindow::Quit() { diff --git a/src/preferences/menu/ColorWindow.h b/src/preferences/menu/ColorWindow.h index 84b050c312..6528afbcb8 100644 --- a/src/preferences/menu/ColorWindow.h +++ b/src/preferences/menu/ColorWindow.h @@ -1,11 +1,13 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) * Vasilis Kaoutsis, kaoutsis@sch.gr */ + #ifndef COLOR_WINDOW_H #define COLOR_WINDOW_H @@ -21,13 +23,12 @@ class BButton; class ColorWindow : public BWindow { public: ColorWindow(BMessenger owner); - ~ColorWindow(); virtual void Quit(); virtual void MessageReceived(BMessage* message); private: - BColorControl* fColorControl; + BColorControl* fColorControl; BButton* fDefaultButton; BButton* fRevertButton; menu_info fRevertInfo; diff --git a/src/preferences/menu/FontMenu.cpp b/src/preferences/menu/FontMenu.cpp index f3c0e3a829..dde7f0d231 100644 --- a/src/preferences/menu/FontMenu.cpp +++ b/src/preferences/menu/FontMenu.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ @@ -14,8 +15,6 @@ #include #include -#include - FontMenu::FontMenu() : AutoSettingsMenu("Font", B_ITEMS_IN_COLUMN) @@ -48,30 +47,32 @@ void FontMenu::GetFonts() { int32 numFamilies = count_font_families(); - for ( int32 i = 0; i < numFamilies; i++ ) { - font_family *family = (font_family*)malloc(sizeof(font_family)); + for (int32 i = 0; i < numFamilies; i++) { + font_family family; uint32 flags; - if ( get_font_family(i, family, &flags) == B_OK ) { - BMenu *fontStyleMenu = new BMenu(*family, B_ITEMS_IN_COLUMN); + if (get_font_family(i, &family, &flags) == B_OK) { + BMenu *fontStyleMenu = new BMenu(family, B_ITEMS_IN_COLUMN); fontStyleMenu->SetRadioMode(true); - int32 numStyles = count_font_styles(*family); - for ( int32 j = 0; j < numStyles; j++ ) { - font_style *style = (font_style*)malloc(sizeof(font_style)); - if ( get_font_style(*family, j, style, &flags) == B_OK ) { + int32 numStyles = count_font_styles(family); + for (int32 j = 0; j < numStyles; j++) { + font_style style; + if (get_font_style(family, j, &style, &flags) == B_OK) { BMessage *msg = new BMessage(MENU_FONT_STYLE); - msg->AddPointer("family", family); - msg->AddPointer("style", style); - BMenuItem *fontStyleItem = new BMenuItem(*style, msg, 0, 0); + msg->AddString("family", family); + msg->AddString("style", style); + BMenuItem *fontStyleItem = new BMenuItem(style, msg); fontStyleMenu->AddItem(fontStyleItem); } } + BMessage *msg = new BMessage(MENU_FONT_FAMILY); - msg->AddPointer("family", family); - font_style *style = (font_style*)malloc(sizeof(font_style)); + msg->AddString("family", family); + // if font family selected, we need to change style to // first style - if ( get_font_style(*family, 0, style, &flags) == B_OK ) - msg->AddPointer("style", style); + font_style style; + if (get_font_style(family, 0, &style, &flags) == B_OK) + msg->AddString("style", style); BMenuItem *fontFamily = new BMenuItem(fontStyleMenu, msg); AddItem(fontFamily); } diff --git a/src/preferences/menu/FontSizeMenu.cpp b/src/preferences/menu/FontSizeMenu.cpp index 27f3f09644..e8df3d8e79 100644 --- a/src/preferences/menu/FontSizeMenu.cpp +++ b/src/preferences/menu/FontSizeMenu.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ @@ -69,3 +70,4 @@ FontSizeMenu::AttachedToWindow() item->SetMarked(true); } + diff --git a/src/preferences/menu/MenuApp.cpp b/src/preferences/menu/MenuApp.cpp index 4a0d9fee54..dc2785185d 100644 --- a/src/preferences/menu/MenuApp.cpp +++ b/src/preferences/menu/MenuApp.cpp @@ -1,10 +1,10 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * - * Jack Burton + * Stefano Ceccherini (stefano.ceccherini@gmail.com) * Vasilis Kaoutsis, kaoutsis@sch.gr */ diff --git a/src/preferences/menu/MenuApp.h b/src/preferences/menu/MenuApp.h index 8d959f6388..7392bcb298 100644 --- a/src/preferences/menu/MenuApp.h +++ b/src/preferences/menu/MenuApp.h @@ -4,7 +4,7 @@ * * Authors: * - * Jack Burton + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ #ifndef MENU_APP_H #define MENU_APP_H diff --git a/src/preferences/menu/MenuBar.cpp b/src/preferences/menu/MenuBar.cpp index 46eeb770d9..a411899802 100644 --- a/src/preferences/menu/MenuBar.cpp +++ b/src/preferences/menu/MenuBar.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) * Vasilis Kaoutsis, kaoutsis@sch.gr */ diff --git a/src/preferences/menu/MenuBar.h b/src/preferences/menu/MenuBar.h index e2a9ad5eee..5b454b2e66 100644 --- a/src/preferences/menu/MenuBar.h +++ b/src/preferences/menu/MenuBar.h @@ -1,9 +1,10 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ #ifndef MENU_BAR_H #define MENU_BAR_H @@ -12,8 +13,6 @@ #include class BMenuItem; - - class MenuBar : public BMenuBar { public: MenuBar(); diff --git a/src/preferences/menu/MenuSettings.cpp b/src/preferences/menu/MenuSettings.cpp index 7237f44837..046f5c2737 100644 --- a/src/preferences/menu/MenuSettings.cpp +++ b/src/preferences/menu/MenuSettings.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ diff --git a/src/preferences/menu/MenuWindow.cpp b/src/preferences/menu/MenuWindow.cpp index 9c7b0e4b84..3b5c0c8653 100644 --- a/src/preferences/menu/MenuWindow.cpp +++ b/src/preferences/menu/MenuWindow.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) * Vasilis Kaoutsis, kaoutsis@sch.gr */ @@ -64,11 +65,6 @@ MenuWindow::MenuWindow(BRect rect) } -MenuWindow::~MenuWindow() -{ -} - - void MenuWindow::MessageReceived(BMessage *msg) { @@ -96,13 +92,14 @@ MenuWindow::MessageReceived(BMessage *msg) case MENU_FONT_STYLE: { fRevert = true; - font_family *family; - msg->FindPointer("family", (void**)&family); - font_style *style; - msg->FindPointer("style", (void**)&style); + const font_family *family; + msg->FindString("family", (const char **)&family); + const font_style *style; + msg->FindString("style", (const char **)&style); + settings->Get(info); - memcpy(info.f_family, family, sizeof(info.f_family)); - memcpy(info.f_style, style, sizeof(info.f_style)); + strlcpy(info.f_family, (const char *)family, B_FONT_FAMILY_LENGTH); + strlcpy(info.f_style, (const char *)style, B_FONT_STYLE_LENGTH); settings->Set(info); Update(); break; @@ -116,14 +113,6 @@ MenuWindow::MessageReceived(BMessage *msg) Update(); break; - case MENU_SEP_TYPE: - fRevert = true; - settings->Get(info); - msg->FindInt32("sep", &info.separator); - settings->Set(info); - Update(); - break; - case ALLWAYS_TRIGGERS_MSG: fRevert = true; settings->Get(info); diff --git a/src/preferences/menu/MenuWindow.h b/src/preferences/menu/MenuWindow.h index ba18232926..c87bcd91e4 100644 --- a/src/preferences/menu/MenuWindow.h +++ b/src/preferences/menu/MenuWindow.h @@ -1,10 +1,12 @@ /* - * Copyright 2002-2006, Haiku Inc. All rights reserved. + * Copyright 2002-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * + * Stefano Ceccherini (stefano.ceccherini@gmail.com) */ + #ifndef MENU_WINDOW_H #define MENU_WINDOW_H @@ -16,13 +18,10 @@ class ColorWindow; class BButton; class MenuBar; - - class MenuWindow : public BWindow { public: MenuWindow(BRect frame); - virtual ~MenuWindow(); - + virtual void MessageReceived(BMessage *message); virtual bool QuitRequested(); diff --git a/src/preferences/menu/msg.h b/src/preferences/menu/msg.h index df5ee7338a..6e8a9acb22 100644 --- a/src/preferences/menu/msg.h +++ b/src/preferences/menu/msg.h @@ -35,7 +35,5 @@ const uint32 MENU_FONT_FAMILY = 'mffm'; const uint32 MENU_FONT_STYLE = 'mfst'; const uint32 MENU_FONT_SIZE = 'mfsz'; -// seperator -const uint32 MENU_SEP_TYPE = 'mstp'; #endif // MESSAGES_H