First pass at building for Haiku.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23426 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol
2008-01-11 23:49:42 +00:00
parent f03e236672
commit fa8d1c38f2
6 changed files with 112 additions and 19 deletions
+4 -6
View File
@@ -8,16 +8,15 @@
/* returns true if == */
bool CompareMessages(BMessage &a, BMessage &b)
{
void *cookie = NULL;
const char *name;
char *name;
type_code code;
int32 count, i;
int32 count, index, i;
const void *adata, *bdata;
ssize_t asize, bsize;
if (a.what != b.what)
return false;
while (a.GetNextName(&cookie, &name, &code, &count) == B_OK) {
for (index = 0; a.GetInfo(B_ANY_TYPE, index, &name, &code, &count) == B_OK; i++) {
for (i = 0; i < count; i++) {
if (a.FindData(name, code, i, &adata, &asize) != B_OK)
return false;
@@ -29,9 +28,8 @@ bool CompareMessages(BMessage &a, BMessage &b)
return false;
}
}
cookie = NULL;
/* cross compare */
while (b.GetNextName(&cookie, &name, &code, &count) == B_OK) {
for (index = 0; b.GetInfo(B_ANY_TYPE, index, &name, &code, &count) == B_OK; i++) {
type_code acode;
int32 acount;
if (a.GetInfo(name, &acode, &acount) < B_OK)
+53 -5
View File
@@ -58,9 +58,8 @@ bool LookUpFieldName(const char **name, const char *field_name, BMessage *names)
status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, BMessage *names)
{
int32 index;
void *cookie = NULL;
const char *field_name;
int32 field, index;
char *field_name;
type_code field_code;
int32 field_count;
char buffer[80];
@@ -93,10 +92,10 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, B
// stream.Write(tabs+2, tabCount-2);
stream.Write(buffer, strlen(buffer));
while (message->GetNextName(&cookie,
for (field = 0; message->GetInfo(B_ANY_TYPE, field,
&field_name,
&field_code,
&field_count) == B_OK) {
&field_count) == B_OK; field++) {
if (LookUpFieldName(&easy_name, field_name, names)) {
stream.Write(tabs+1, tabCount);
stream.Write("// ", 3);
@@ -121,6 +120,7 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, B
DumpMessageToStream(&m, stream, tabCount, names);
}
break;
#ifdef B_BEOS_VERSION_DANO
case 'FONt':
{
BFont f;
@@ -140,6 +140,54 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, B
stream.Write("\n", 1);
}
break;
#else
case 'FONt':
{
BFont f;
const void *data;
ssize_t len;
if (message->FindData(field_name, index, &data, &len) >= B_OK) {
if (len <= (ssize_t)sizeof(f)) {
// Hack: only Dano has BFont : public BFlattenable
memcpy((void *)&f, data, len);
//stream << f;
font_family family;
font_style style;
font_height height;
f.GetFamilyAndStyle(&family, &style);
f.GetHeight(&height);
BString s;
s << "BFont(" << family;
s << "/" << style << "/" << f.Size();
s << ", shear=" << f.Shear();
s << ", rot=" << f.Rotation();
s << ", height=" << height.ascent;
s << "+" << height.descent;
s << "+" << height.leading << ")";
stream.Write(s.String(), s.Length());
} // else too big
}
stream.Write("\n", 1);
}
break;
case B_RGB_COLOR_TYPE:
{
rgb_color c;
const void *data;
ssize_t len;
if (message->FindData(field_name, index, &data, &len) >= B_OK) {
if (len <= (ssize_t)sizeof(c)) {
// Hack
memcpy((void *)&c, data, len);
sprintf(buffer, "rgb_color(%d,%d,%d,%d)",
c.red, c.green, c.blue, c.alpha);
stream.Write(buffer, strlen(buffer));
} // else too big
}
stream.Write("\n", 1);
}
break;
#endif
case B_BOOL_TYPE:
{
bool value;
+3 -1
View File
@@ -165,7 +165,7 @@ status_t escape_find_directory(BString *dir)
status_t unescape_find_directory(BString *dir)
{
status_t err;
status_t err = B_ERROR;
int32 s, e;
BString tok;
BPath path;
@@ -180,7 +180,9 @@ status_t unescape_find_directory(BString *dir)
_BORK(B_DESKTOP_DIRECTORY);
_BORK(B_TRASH_DIRECTORY);
#ifdef B_BEOS_VERSION_DANO
_BORK(B_ROOT_DIRECTORY);
#endif
_BORK(B_BEOS_DIRECTORY);
_BORK(B_BEOS_SYSTEM_DIRECTORY);
+7 -1
View File
@@ -5,6 +5,8 @@
#include <Font.h>
#include <String.h>
#include <Message.h>
#include <TypeConstants.h>
#include "DumpMessage.h"
#define MAX_TEXT_LINE_INPUT_SIZE 4096
@@ -192,7 +194,7 @@ status_t Parse_Msg_rgb_color(BMessage *msg, TextLineInputDataIO *st, char *name)
if (!has_alpha)
v.alpha = 255;
//msg->AddRGBColor(name, v);
msg->AddData(name, (type_code)'RGBC', &v, 4);
msg->AddData(name, B_RGB_COLOR_TYPE, &v, 4);
return B_OK;
}
@@ -255,7 +257,11 @@ status_t Parse_Msg_BFont(BMessage *msg, TextLineInputDataIO *st, char *name)
f.SetFamilyAndStyle(ff, fs);
f.SetSize(size);
//f.PrintToStream();
#ifdef B_BEOS_VERSION_DANO
msg->AddFlat(name, &f);
#else
msg->AddData(name, 'FONt', (void *)&f, sizeof(f));
#endif
return B_OK;
}
+27 -3
View File
@@ -2,10 +2,20 @@
#include "ThemeInterfaceView.h"
#include "ThemeManager.h"
#include "UITheme.h"
#include <BeBuild.h>
#ifdef B_ZETA_VERSION
#include <locale/Locale.h>
#else
#define _T(v) v
#define B_LANGUAGE_CHANGED '_BLC'
#define B_PREF_APP_SET_DEFAULTS 'zPAD'
#define B_PREF_APP_REVERT 'zPAR'
#define B_PREF_APP_ADDON_REF 'zPAA'
#endif
#include <Button.h>
#include <CheckBox.h>
#include <Font.h>
#include <Roster.h>
#include <View.h>
#include <stdio.h>
@@ -24,10 +34,16 @@ ThemeAddonItem::ThemeAddonItem(BRect bounds, ThemeInterfaceView *iview, int32 id
tman = iview->GetThemeManager();
fAddonName = tman->AddonName(id);
BString tip(tman->AddonDescription(id));
#ifdef B_BEOS_VERSION_DANO
SetToolTipText(tip.String());
SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR);
SetLowUIColor(B_UI_PANEL_BACKGROUND_COLOR);
SetHighUIColor(B_UI_PANEL_TEXT_COLOR);
#else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
#endif
BMessage *apply = new BMessage(CB_APPLY);
apply->AddInt32("addon", id);
BMessage *save = new BMessage(CB_SAVE);
@@ -35,14 +51,18 @@ ThemeAddonItem::ThemeAddonItem(BRect bounds, ThemeInterfaceView *iview, int32 id
BMessage *prefs = new BMessage(BTN_PREFS);
prefs->AddInt32("addon", id);
fApplyBox = new BCheckBox(BRect(CTRL_OFF_X, CTRL_OFF_Y, CTRL_OFF_X+50, CTRL_OFF_Y+30), "apply", _T("Apply"), apply);
fApplyBox->SetToolTipText(_T("Use this information from themes"));
fApplyBox->SetValue((tman->AddonFlags(id) & Z_THEME_ADDON_DO_SET_ALL)?B_CONTROL_ON:B_CONTROL_OFF);
fSaveBox = new BCheckBox(BRect(CTRL_OFF_X+50+CTRL_SPACING, CTRL_OFF_Y, CTRL_OFF_X+100+CTRL_SPACING, CTRL_OFF_Y+30), "save", _T("Save"), save);
fSaveBox->SetToolTipText(_T("Save this information to themes"));
fSaveBox->SetValue((tman->AddonFlags(id) & Z_THEME_ADDON_DO_RETRIEVE)?B_CONTROL_ON:B_CONTROL_OFF);
#ifdef B_BEOS_VERSION_DANO
fApplyBox->SetToolTipText(_T("Use this information from themes"));
fSaveBox->SetToolTipText(_T("Save this information to themes"));
#endif
#ifdef HAVE_PREF_BTN
fPrefsBtn = new BButton(BRect(CTRL_OFF_X+100+CTRL_SPACING*2, CTRL_OFF_Y, CTRL_OFF_X+150+CTRL_SPACING*2, CTRL_OFF_Y+30), "prefs", _T("Preferences"), prefs);
#ifdef B_BEOS_VERSION_DANO
fPrefsBtn->SetToolTipText(_T("Run the preferences panel for this topic."));
#endif
#endif
BFont fnt;
GetFont(&fnt);
@@ -95,12 +115,16 @@ void ThemeAddonItem::Draw(BRect)
void ThemeAddonItem::RelocalizeStrings()
{
fApplyBox->SetLabel(_T("Apply"));
fApplyBox->SetToolTipText(_T("Use this information from themes"));
fSaveBox->SetLabel(_T("Save"));
#ifdef B_BEOS_VERSION_DANO
fApplyBox->SetToolTipText(_T("Use this information from themes"));
fSaveBox->SetToolTipText(_T("Save this information to themes"));
#endif
#ifdef HAVE_PREF_BTN
fPrefsBtn->SetLabel(_T("Preferences"));
#ifdef B_BEOS_VERSION_DANO
fPrefsBtn->SetToolTipText(_T("Run the preferences panel for this topic."));
#endif
#endif
RelayoutButtons();
}
+18 -3
View File
@@ -1,16 +1,25 @@
#include <add-ons/pref_app/PrefPanel.h>
#include <Alert.h>
#include <Bitmap.h>
#include <Box.h>
#include <DataIO.h>
#include <Entry.h>
#include <File.h>
#include <BeBuild.h>
#ifdef B_ZETA_VERSION
#include <add-ons/pref_app/PrefPanel.h>
#include <locale/Locale.h>
#include <Resources.h>
#include <Separator.h>
#else
#define _T(v) v
#define B_PREF_APP_ENABLE_REVERT 'zPAE'
#define B_PREF_APP_SET_DEFAULTS 'zPAD'
#define B_PREF_APP_REVERT 'zPAR'
#define B_PREF_APP_ADDON_REF 'zPAA'
#endif
#include <Resources.h>
#include <TranslationUtils.h>
#include <TranslatorFormats.h>
#include <be/app/Roster.h>
#include <Roster.h>
#include <Button.h>
#include <ListView.h>
@@ -21,6 +30,8 @@
#include <Application.h>
#include <MessageFilter.h>
#include <stdio.h>
#include "UITheme.h"
#include "TextInputAlert.h"
@@ -103,7 +114,11 @@ ThemeInterfaceView::AllAttached()
BView::AllAttached();
fPopupInvoker = new BInvoker(new BMessage(kReallyCreateTheme), this);
#ifdef B_BEOS_VERSION_DANO
SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR);
#else
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
#endif
fThemeManager = new ThemeManager;
fThemeManager->LoadThemes();