* Linking fixes

* Will put Haiku code there...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23430 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-01-12 01:11:45 +00:00
parent abafff63f4
commit 578f3ba69f
4 changed files with 379 additions and 1 deletions

View File

@ -39,7 +39,10 @@ status_t MakeScreenshot(BBitmap **here)
scaledBmp = new BBitmap(scaledBounds, B_BITMAP_ACCEPTS_VIEWS, B_RGB32/*shot->ColorSpace()*/);
err = scaledBmp->InitCheck();
if (!err) {
err = ENOSYS;
#ifdef B_ZETA_VERSION
err = ScaleBitmap(*shot, *scaledBmp);
#endif
if (err) {
// filtered scaling didn't work, do it manually
BView *v = new BView(scaledBounds, "scaleview", B_FOLLOW_NONE, 0);

View File

@ -700,7 +700,11 @@ void ThemeInterfaceView::SetScreenshot(BBitmap *shot)
if (shot)
{
BBitmap scaled(fScreenshotPane->Bounds(), B_RGB32);
if( B_OK == ScaleBitmap(*shot, scaled) )
status_t err = ENOSYS;
#ifdef B_ZETA_VERSION
err = ScaleBitmap(*shot, scaled);
#endif
if( err == B_OK )
{
fScreenshotPane->SetViewBitmap(&scaled);
}

View File

@ -0,0 +1,208 @@
/*
* ui_settings ThemesAddon class
*/
#include <BeBuild.h>
//#ifdef B_BEOS_VERSION_DANO
#if 0
#include <Alert.h>
#include <Application.h>
#include <InterfaceDefs.h>
#include <Entry.h>
#include <Font.h>
#include <Message.h>
#include <Roster.h>
#include <stdio.h>
#include <string.h>
#include "ThemesAddon.h"
#include "UITheme.h"
#ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_ui_settings
#endif
//#define A_NAME "UI Settings"
#define A_NAME "System Colors and Fonts"
#define A_MSGNAME Z_THEME_UI_SETTINGS
#define A_DESCRIPTION "System colors, fonts and other goodies"
class UISettingsThemesAddon : public ThemesAddon {
public:
UISettingsThemesAddon();
~UISettingsThemesAddon();
const char *Description();
status_t RunPreferencesPanel();
status_t AddNames(BMessage &names);
status_t ApplyTheme(BMessage &theme, uint32 flags=0L);
status_t MakeTheme(BMessage &theme, uint32 flags=0L);
status_t ApplyDefaultTheme(uint32 flags=0L);
};
UISettingsThemesAddon::UISettingsThemesAddon()
: ThemesAddon(A_NAME, A_MSGNAME)
{
}
UISettingsThemesAddon::~UISettingsThemesAddon()
{
}
const char *UISettingsThemesAddon::Description()
{
return A_DESCRIPTION;
}
status_t UISettingsThemesAddon::RunPreferencesPanel()
{
status_t err = B_OK;
entry_ref ref;
BEntry ent;
/*
err = ent.SetTo("/boot/beos/preferences/Colors");
if (!err) {
err = ent.GetRef(&ref);
if (!err) {
err = be_roster->Launch(&ref);
}
}
*/
if (!err)
return B_OK;
err = ent.SetTo("/system/add-ons/Preferences/Appearance");
if (!err) {
err = ent.GetRef(&ref);
if (!err) {
err = be_roster->Launch(&ref);
if (err) {
BMessage msg(B_REFS_RECEIVED);
msg.AddRef("refs", &ref);
be_app_messenger.SendMessage(&msg);
}
}
}
return err;
}
status_t UISettingsThemesAddon::AddNames(BMessage &names)
{
BMessage uisettings;
BMessage uinames;
status_t err;
const char *str, *value;
type_code code;
int32 i;
err = get_ui_settings(&uisettings, &uinames);
if (err)
return err;
names.AddString(Z_THEME_UI_SETTINGS, "UI Settings");
// hack for legacy fonts
names.AddString("be:f:be_plain_font", "System Plain");
names.AddString("be:f:be_bold_font", "System Bold");
names.AddString("be:f:be_fixed_font", "System Fixed");
for (i = 0; uinames.GetInfo(B_STRING_TYPE, i, &str, &code) == B_OK;i++)
if (uinames.FindString(str, &value) == B_OK)
names.AddString(str, value);
return B_OK;
}
status_t UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
{
BMessage uisettings;
BFont fnt;
status_t err;
(void)flags;
err = MyMessage(theme, uisettings);
if (err)
return err;
// hack for legacy fonts
err = uisettings.FindFlat("be:f:be_plain_font", &fnt);
uisettings.RemoveName("be:f:be_plain_font");
if (err == B_OK)
BFont::SetStandardFont(B_PLAIN_FONT, &fnt);
err = uisettings.FindFlat("be:f:be_bold_font", &fnt);
uisettings.RemoveName("be:f:be_bold_font");
if (err == B_OK)
BFont::SetStandardFont(B_BOLD_FONT, &fnt);
err = uisettings.FindFlat("be:f:be_fixed_font", &fnt);
uisettings.RemoveName("be:f:be_fixed_font");
if (err == B_OK)
BFont::SetStandardFont(B_FIXED_FONT, &fnt);
update_ui_settings(uisettings);
return B_OK;
}
status_t UISettingsThemesAddon::MakeTheme(BMessage &theme, uint32 flags)
{
BMessage uisettings;
BMessage names;
BFont fnt;
status_t err;
(void)flags;
err = MyMessage(theme, uisettings);
if (err)
uisettings.MakeEmpty();
err = get_ui_settings(&uisettings, &names);
if (err)
return err;
// hack for legacy fonts
err = BFont::GetStandardFont(B_PLAIN_FONT, &fnt);
uisettings.AddFlat("be:f:be_plain_font", &fnt);
err = BFont::GetStandardFont(B_BOLD_FONT, &fnt);
uisettings.AddFlat("be:f:be_bold_font", &fnt);
err = BFont::GetStandardFont(B_FIXED_FONT, &fnt);
uisettings.AddFlat("be:f:be_fixed_font", &fnt);
err = SetMyMessage(theme, uisettings);
return err;
}
status_t UISettingsThemesAddon::ApplyDefaultTheme(uint32 flags)
{
BMessage theme;
BMessage uisettings;
BFont fnt;
status_t err;
err = get_default_settings(&uisettings);
if (err)
return err;
// hack for legacy fonts
err = BFont::GetStandardFont((font_which)(B_PLAIN_FONT-100), &fnt);
uisettings.AddFlat("be:f:be_plain_font", &fnt);
err = BFont::GetStandardFont((font_which)(B_BOLD_FONT-100), &fnt);
uisettings.AddFlat("be:f:be_bold_font", &fnt);
err = BFont::GetStandardFont((font_which)(B_FIXED_FONT-100), &fnt);
uisettings.AddFlat("be:f:be_fixed_font", &fnt);
theme.AddMessage(A_MSGNAME, &uisettings);
return ApplyTheme(theme, flags);
}
ThemesAddon *instanciate_themes_addon()
{
return (ThemesAddon *) new UISettingsThemesAddon;
}
#endif /* B_BEOS_VERSION_DANO */

View File

@ -0,0 +1,163 @@
/*
* window_decor ThemesAddon class
*/
#include <BeBuild.h>
//#ifdef B_BEOS_VERSION_DANO
#if 0
#include <Alert.h>
#include <Application.h>
#include <Directory.h>
#include <Entry.h>
#include <InterfaceDefs.h>
#include <MediaFiles.h>
#include <Message.h>
#include <Messenger.h>
#include <Path.h>
#include <Roster.h>
#include <String.h>
#include <stdio.h>
#include <string.h>
#include "ThemesAddon.h"
#include "UITheme.h"
#ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_window_decor
#endif
#define A_NAME "Window Decor"
#define A_MSGNAME Z_THEME_WINDOW_DECORATIONS
#define A_DESCRIPTION "Window decorations and scrollbars"
class DecorThemesAddon : public ThemesAddon {
public:
DecorThemesAddon();
~DecorThemesAddon();
const char *Description();
status_t RunPreferencesPanel();
status_t AddNames(BMessage &names);
status_t ApplyTheme(BMessage &theme, uint32 flags=0L);
status_t MakeTheme(BMessage &theme, uint32 flags=0L);
status_t ApplyDefaultTheme(uint32 flags=0L);
};
DecorThemesAddon::DecorThemesAddon()
: ThemesAddon(A_NAME, A_MSGNAME)
{
}
DecorThemesAddon::~DecorThemesAddon()
{
}
const char *DecorThemesAddon::Description()
{
return A_DESCRIPTION;
}
status_t DecorThemesAddon::RunPreferencesPanel()
{
status_t err;
entry_ref ref;
BEntry ent;
err = ent.SetTo("/system/add-ons/Preferences/Appearance");
if (!err) {
err = ent.GetRef(&ref);
if (!err) {
err = be_roster->Launch(&ref);
if (err) {
BMessage msg(B_REFS_RECEIVED);
msg.AddRef("refs", &ref);
be_app_messenger.SendMessage(&msg);
}
}
}
return err;
}
status_t DecorThemesAddon::AddNames(BMessage &names)
{
names.AddString(Z_THEME_WINDOW_DECORATIONS, "Window decorations and scrollbars");
names.AddString("window:decor", "Window decor");
names.AddString("window:decor_globals", "Window decor parameters");
return B_OK;
}
status_t DecorThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
{
BMessage window_decor;
BMessage globals;
BString decorName;
status_t err;
(void)flags;
err = MyMessage(theme, window_decor);
if (err)
return err;
#ifdef B_BEOS_VERSION_DANO
if (window_decor.FindString("window:decor", &decorName) == B_OK)
set_window_decor(decorName.String(),
(window_decor.FindMessage("window:decor_globals", &globals) == B_OK)?&globals:NULL);
#else
extern void __set_window_decor(int32 theme);
int32 decorNr = 0;
if (window_decor.FindInt32("window:R5:decor", &decorNr) == B_OK)
__set_window_decor(decorNr);
#endif
// XXX: add colors à la WindowShade ?
return B_OK;
}
status_t DecorThemesAddon::MakeTheme(BMessage &theme, uint32 flags)
{
BMessage window_decor;
BMessage globals;
BString decorName;
status_t err;
(void)flags;
err = MyMessage(theme, window_decor);
if (err)
window_decor.MakeEmpty();
#ifdef B_BEOS_VERSION_DANO
err = get_window_decor(&decorName, &globals);
if (err == B_OK) {
window_decor.AddString("window:decor", decorName.String());
window_decor.AddMessage("window:decor_globals", &globals);
}
#else
window_decor.AddInt32("window:R5:decor", 0);
#endif
err = SetMyMessage(theme, window_decor);
return err;
}
status_t DecorThemesAddon::ApplyDefaultTheme(uint32 flags)
{
BMessage theme;
BMessage window_decor;
window_decor.AddString("window:decor", "R5");
window_decor.AddInt32("window:R5:decor", 0L);
theme.AddMessage(A_MSGNAME, &window_decor);
return ApplyTheme(theme, flags);
}
ThemesAddon *instanciate_themes_addon()
{
return (ThemesAddon *) new DecorThemesAddon;
}
#endif /* B_BEOS_VERSION_DANO */