cleanups, updated copyrights

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21001 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2007-05-03 20:05:47 +00:00
parent a8ff4e33f1
commit def763251b
16 changed files with 59 additions and 71 deletions

View File

@ -3,7 +3,7 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */
#ifndef AUTO_SETTINGS_MENU_H #ifndef AUTO_SETTINGS_MENU_H
#define AUTO_SETTINGS_MENU_H #define AUTO_SETTINGS_MENU_H
@ -20,3 +21,4 @@ class AutoSettingsMenu : public BMenu {
}; };
#endif // AUTO_SETTINGS_MENU_H #endif // AUTO_SETTINGS_MENU_H

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */
@ -15,7 +16,7 @@
// BitmapMenuItem class definition // BitmapMenuItem class definition
BitmapMenuItem::BitmapMenuItem(const char* name, BMessage* message, BitmapMenuItem::BitmapMenuItem(const char* name, BMessage* message,
BBitmap* bmp, char shortcut, uint32 modifiers) BBitmap* bmp, char shortcut, uint32 modifiers)
: BMenuItem(name, message, shortcut, modifiers), : BMenuItem(name, message, shortcut, modifiers),
fBitmap(bmp), fBitmap(bmp),
fName(name) fName(name)

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */
#ifndef BITMAP_MENU_ITEM_H #ifndef BITMAP_MENU_ITEM_H
#define BITMAP_MENU_ITEM_H #define BITMAP_MENU_ITEM_H
#include <MenuItem.h> #include <MenuItem.h>
#include <String.h> #include <String.h>
class BBitmap; class BBitmap;
class BitmapMenuItem : public BMenuItem { class BitmapMenuItem : public BMenuItem {
public: public:
BitmapMenuItem(const char* name, BMessage* message, BBitmap* bmp, BitmapMenuItem(const char* name, BMessage* message, BBitmap* bmp,

View File

@ -59,11 +59,6 @@ ColorWindow::ColorWindow(BMessenger owner)
} }
ColorWindow::~ColorWindow()
{
}
void void
ColorWindow::Quit() ColorWindow::Quit()
{ {

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
* Vasilis Kaoutsis, kaoutsis@sch.gr * Vasilis Kaoutsis, kaoutsis@sch.gr
*/ */
#ifndef COLOR_WINDOW_H #ifndef COLOR_WINDOW_H
#define COLOR_WINDOW_H #define COLOR_WINDOW_H
@ -21,13 +23,12 @@ class BButton;
class ColorWindow : public BWindow { class ColorWindow : public BWindow {
public: public:
ColorWindow(BMessenger owner); ColorWindow(BMessenger owner);
~ColorWindow();
virtual void Quit(); virtual void Quit();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
private: private:
BColorControl* fColorControl; BColorControl* fColorControl;
BButton* fDefaultButton; BButton* fDefaultButton;
BButton* fRevertButton; BButton* fRevertButton;
menu_info fRevertInfo; menu_info fRevertInfo;

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */
@ -14,8 +15,6 @@
#include <MenuItem.h> #include <MenuItem.h>
#include <Message.h> #include <Message.h>
#include <stdlib.h>
FontMenu::FontMenu() FontMenu::FontMenu()
: AutoSettingsMenu("Font", B_ITEMS_IN_COLUMN) : AutoSettingsMenu("Font", B_ITEMS_IN_COLUMN)
@ -48,30 +47,32 @@ void
FontMenu::GetFonts() FontMenu::GetFonts()
{ {
int32 numFamilies = count_font_families(); int32 numFamilies = count_font_families();
for ( int32 i = 0; i < numFamilies; i++ ) { for (int32 i = 0; i < numFamilies; i++) {
font_family *family = (font_family*)malloc(sizeof(font_family)); font_family family;
uint32 flags; uint32 flags;
if ( get_font_family(i, family, &flags) == B_OK ) { if (get_font_family(i, &family, &flags) == B_OK) {
BMenu *fontStyleMenu = new BMenu(*family, B_ITEMS_IN_COLUMN); BMenu *fontStyleMenu = new BMenu(family, B_ITEMS_IN_COLUMN);
fontStyleMenu->SetRadioMode(true); fontStyleMenu->SetRadioMode(true);
int32 numStyles = count_font_styles(*family); int32 numStyles = count_font_styles(family);
for ( int32 j = 0; j < numStyles; j++ ) { for (int32 j = 0; j < numStyles; j++) {
font_style *style = (font_style*)malloc(sizeof(font_style)); font_style style;
if ( get_font_style(*family, j, style, &flags) == B_OK ) { if (get_font_style(family, j, &style, &flags) == B_OK) {
BMessage *msg = new BMessage(MENU_FONT_STYLE); BMessage *msg = new BMessage(MENU_FONT_STYLE);
msg->AddPointer("family", family); msg->AddString("family", family);
msg->AddPointer("style", style); msg->AddString("style", style);
BMenuItem *fontStyleItem = new BMenuItem(*style, msg, 0, 0); BMenuItem *fontStyleItem = new BMenuItem(style, msg);
fontStyleMenu->AddItem(fontStyleItem); fontStyleMenu->AddItem(fontStyleItem);
} }
} }
BMessage *msg = new BMessage(MENU_FONT_FAMILY); BMessage *msg = new BMessage(MENU_FONT_FAMILY);
msg->AddPointer("family", family); msg->AddString("family", family);
font_style *style = (font_style*)malloc(sizeof(font_style));
// if font family selected, we need to change style to // if font family selected, we need to change style to
// first style // first style
if ( get_font_style(*family, 0, style, &flags) == B_OK ) font_style style;
msg->AddPointer("style", style); if (get_font_style(family, 0, &style, &flags) == B_OK)
msg->AddString("style", style);
BMenuItem *fontFamily = new BMenuItem(fontStyleMenu, msg); BMenuItem *fontFamily = new BMenuItem(fontStyleMenu, msg);
AddItem(fontFamily); AddItem(fontFamily);
} }

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */
@ -69,3 +70,4 @@ FontSizeMenu::AttachedToWindow()
item->SetMarked(true); item->SetMarked(true);
} }

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Jack Burton * Stefano Ceccherini (stefano.ceccherini@gmail.com)
* Vasilis Kaoutsis, kaoutsis@sch.gr * Vasilis Kaoutsis, kaoutsis@sch.gr
*/ */

View File

@ -4,7 +4,7 @@
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Jack Burton * Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */
#ifndef MENU_APP_H #ifndef MENU_APP_H
#define MENU_APP_H #define MENU_APP_H

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
* Vasilis Kaoutsis, kaoutsis@sch.gr * Vasilis Kaoutsis, kaoutsis@sch.gr
*/ */

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */
#ifndef MENU_BAR_H #ifndef MENU_BAR_H
#define MENU_BAR_H #define MENU_BAR_H
@ -12,8 +13,6 @@
#include <MenuBar.h> #include <MenuBar.h>
class BMenuItem; class BMenuItem;
class MenuBar : public BMenuBar { class MenuBar : public BMenuBar {
public: public:
MenuBar(); MenuBar();

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
* Vasilis Kaoutsis, kaoutsis@sch.gr * Vasilis Kaoutsis, kaoutsis@sch.gr
*/ */
@ -64,11 +65,6 @@ MenuWindow::MenuWindow(BRect rect)
} }
MenuWindow::~MenuWindow()
{
}
void void
MenuWindow::MessageReceived(BMessage *msg) MenuWindow::MessageReceived(BMessage *msg)
{ {
@ -96,13 +92,14 @@ MenuWindow::MessageReceived(BMessage *msg)
case MENU_FONT_STYLE: case MENU_FONT_STYLE:
{ {
fRevert = true; fRevert = true;
font_family *family; const font_family *family;
msg->FindPointer("family", (void**)&family); msg->FindString("family", (const char **)&family);
font_style *style; const font_style *style;
msg->FindPointer("style", (void**)&style); msg->FindString("style", (const char **)&style);
settings->Get(info); settings->Get(info);
memcpy(info.f_family, family, sizeof(info.f_family)); strlcpy(info.f_family, (const char *)family, B_FONT_FAMILY_LENGTH);
memcpy(info.f_style, style, sizeof(info.f_style)); strlcpy(info.f_style, (const char *)style, B_FONT_STYLE_LENGTH);
settings->Set(info); settings->Set(info);
Update(); Update();
break; break;
@ -116,14 +113,6 @@ MenuWindow::MessageReceived(BMessage *msg)
Update(); Update();
break; break;
case MENU_SEP_TYPE:
fRevert = true;
settings->Get(info);
msg->FindInt32("sep", &info.separator);
settings->Set(info);
Update();
break;
case ALLWAYS_TRIGGERS_MSG: case ALLWAYS_TRIGGERS_MSG:
fRevert = true; fRevert = true;
settings->Get(info); settings->Get(info);

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* <unknown, please fill in who knows> * <unknown, please fill in who knows>
* Stefano Ceccherini (stefano.ceccherini@gmail.com)
*/ */
#ifndef MENU_WINDOW_H #ifndef MENU_WINDOW_H
#define MENU_WINDOW_H #define MENU_WINDOW_H
@ -16,13 +18,10 @@
class ColorWindow; class ColorWindow;
class BButton; class BButton;
class MenuBar; class MenuBar;
class MenuWindow : public BWindow { class MenuWindow : public BWindow {
public: public:
MenuWindow(BRect frame); MenuWindow(BRect frame);
virtual ~MenuWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
virtual bool QuitRequested(); virtual bool QuitRequested();

View File

@ -35,7 +35,5 @@ const uint32 MENU_FONT_FAMILY = 'mffm';
const uint32 MENU_FONT_STYLE = 'mfst'; const uint32 MENU_FONT_STYLE = 'mfst';
const uint32 MENU_FONT_SIZE = 'mfsz'; const uint32 MENU_FONT_SIZE = 'mfsz';
// seperator
const uint32 MENU_SEP_TYPE = 'mstp';
#endif // MESSAGES_H #endif // MESSAGES_H