Some guidelinization...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27808 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol
2008-10-01 03:37:33 +00:00
parent 3f8cbad2d0
commit 0ad2d70ef7
11 changed files with 208 additions and 104 deletions
+17 -4
View File
@@ -37,6 +37,10 @@ static const deskbar_location kDeskbarLocationMap[] = {
B_DESKBAR_LEFT_BOTTOM, B_DESKBAR_RIGHT_BOTTOM, B_DESKBAR_BOTTOM
};
// #pragma mark -
BeThemeImporter::BeThemeImporter()
:ThemeImporter("BeTheme")
{
@@ -50,25 +54,32 @@ BeThemeImporter::BeThemeImporter()
fQuery.SetPredicate(QSTR);
}
BeThemeImporter::~BeThemeImporter()
{
FENTRY;
fQuery.Clear();
}
const char *BeThemeImporter::Description()
const char *
BeThemeImporter::Description()
{
FENTRY;
return "Imports BeTheme themes";
}
status_t BeThemeImporter::FetchThemes()
status_t
BeThemeImporter::FetchThemes()
{
FENTRY;
return fQuery.Fetch();
}
status_t BeThemeImporter::ImportNextTheme(BMessage **theme)
status_t
BeThemeImporter::ImportNextTheme(BMessage **theme)
{
FENTRY;
status_t err;
@@ -268,7 +279,9 @@ status_t BeThemeImporter::ImportNextTheme(BMessage **theme)
return B_OK;
}
status_t BeThemeImporter::EndImports()
status_t
BeThemeImporter::EndImports()
{
FENTRY;
fQuery.Clear();
+23 -6
View File
@@ -178,24 +178,33 @@ static struct sounds_map {
{ NULL, NULL }
};
// #pragma mark -
MSThemeImporter::MSThemeImporter()
:ThemeImporter("MSTheme")
{
FENTRY;
}
MSThemeImporter::~MSThemeImporter()
{
FENTRY;
}
const char *MSThemeImporter::Description()
const char *
MSThemeImporter::Description()
{
FENTRY;
return "Imports MSTheme themes";
}
status_t MSThemeImporter::FetchThemes()
status_t
MSThemeImporter::FetchThemes()
{
FENTRY;
status_t err = ENOENT;
@@ -238,7 +247,9 @@ status_t MSThemeImporter::FetchThemes()
return err;
}
status_t MSThemeImporter::ImportNextTheme(BMessage **theme)
status_t
MSThemeImporter::ImportNextTheme(BMessage **theme)
{
FENTRY;
status_t err;
@@ -545,13 +556,17 @@ status_t MSThemeImporter::ImportNextTheme(BMessage **theme)
return B_OK;
}
status_t MSThemeImporter::EndImports()
status_t
MSThemeImporter::EndImports()
{
FENTRY;
return B_OK;
}
bool MSThemeImporter::ScanDirectory(BDirectory &dir, int depth)
bool
MSThemeImporter::ScanDirectory(BDirectory &dir, int depth)
{
//FENTRY;
BEntry ent;
@@ -582,7 +597,9 @@ bool MSThemeImporter::ScanDirectory(BDirectory &dir, int depth)
return found;
}
status_t MSThemeImporter::ParseWinPath(BDirectory &rootDir, const char *from, BPath &to)
status_t
MSThemeImporter::ParseWinPath(BDirectory &rootDir, const char *from, BPath &to)
{
status_t err;
//FENTRY;
+4 -1
View File
@@ -18,7 +18,9 @@
// PRIVATE: in libzeta for now.
extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap);
status_t MakeScreenshot(BBitmap **here)
status_t
MakeScreenshot(BBitmap **here)
{
status_t err;
BScreen bs;
@@ -73,3 +75,4 @@ status_t MakeScreenshot(BBitmap **here)
return B_OK;
}
+2 -2
View File
@@ -5,7 +5,7 @@
#include <TextControl.h>
class TextInputAlert : public BAlert {
public:
public:
TextInputAlert(const char *title,
const char *text,
const char *initial, /* initial input value */
@@ -21,7 +21,7 @@ class TextInputAlert : public BAlert {
BTextControl *TextControl() const { return fText; };
private:
private:
BTextControl *fText;
};
+104 -64
View File
@@ -64,32 +64,44 @@ static const uint32 skOnlineThemes = 'TmOL';
static char* skThemeURL = "http://www.zeta-os.com/cms/download.php?list.4";
#define HIDESS_OFFSET (Bounds().Width()/2 - 130)
// ------------------------------------------------------------------------------
filter_result refs_filter(BMessage *message, BHandler **handler, BMessageFilter *filter)
// #pragma mark - refs_filter
filter_result
refs_filter(BMessage *message, BHandler **handler, BMessageFilter *filter)
{
(void)handler;
(void)filter;
switch (message->what) {
case B_REFS_RECEIVED:
message->PrintToStream();
break;
case B_REFS_RECEIVED:
message->PrintToStream();
break;
}
return B_DISPATCH_MESSAGE;
}
// ------------------------------------------------------------------------------
// #pragma mark - MyInvoker
class MyInvoker : public BInvoker {
public:
MyInvoker(BMessage* message, const BHandler* handler, const BLooper* looper = NULL);
virtual ~MyInvoker();
virtual status_t Invoke(BMessage* message = NULL);
void SetOwner(TextInputAlert *alert);
private:
TextInputAlert *fOwner;
public:
MyInvoker(BMessage* message,
const BHandler* handler,
const BLooper* looper = NULL);
virtual ~MyInvoker();
virtual status_t Invoke(BMessage* message = NULL);
void SetOwner(TextInputAlert *alert);
private:
TextInputAlert* fOwner;
};
MyInvoker::MyInvoker(BMessage* message, const BHandler* handler, const BLooper* looper)
MyInvoker::MyInvoker(BMessage* message,
const BHandler* handler,
const BLooper* looper)
: BInvoker(message, handler, looper)
{
}
@@ -120,21 +132,27 @@ MyInvoker::SetOwner(TextInputAlert *alert)
}
// ------------------------------------------------------------------------------
// #pragma mark -
//extern "C" BView *get_pref_view(const BRect& Bounds)
extern "C" BView *themes_pref(const BRect& Bounds)
extern "C" BView *
themes_pref(const BRect& Bounds)
{
return new ThemeInterfaceView(Bounds);
}
// ------------------------------------------------------------------------------
// #pragma mark - ThemeInterfaceView
ThemeInterfaceView::ThemeInterfaceView(BRect _bounds)
: BView(_bounds, "Themes", B_FOLLOW_ALL_SIDES, B_WILL_DRAW)
, fThemeManager(NULL)
, fScreenshotPaneHidden(false)
, fHasScreenshot(false)
, fPopupInvoker(NULL)
, fBox(NULL)
: BView(_bounds, "Themes", B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
fThemeManager(NULL),
fScreenshotPaneHidden(false),
fHasScreenshot(false),
fPopupInvoker(NULL),
fBox(NULL)
{
/*
BMessageFilter *filt = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, refs_filter);
@@ -144,14 +162,14 @@ ThemeInterfaceView::ThemeInterfaceView(BRect _bounds)
*/
}
// ------------------------------------------------------------------------------
ThemeInterfaceView::~ThemeInterfaceView()
{
delete fPopupInvoker;
delete fThemeManager;
}
// ------------------------------------------------------------------------------
void
ThemeInterfaceView::AllAttached()
{
@@ -280,14 +298,14 @@ ThemeInterfaceView::AllAttached()
PopulateThemeList();
}
// ------------------------------------------------------------------------------
void
ThemeInterfaceView::MessageReceived(BMessage *_msg)
{
ThemeManager *tman;
int32 value;
int32 id;
//_msg->PrintToStream();
switch(_msg->what)
{
case B_REFS_RECEIVED:
@@ -424,14 +442,16 @@ ThemeInterfaceView::MessageReceived(BMessage *_msg)
}
}
// ------------------------------------------------------------------------------
ThemeManager* ThemeInterfaceView::GetThemeManager()
ThemeManager*
ThemeInterfaceView::GetThemeManager()
{
return fThemeManager;
}
// ------------------------------------------------------------------------------
void ThemeInterfaceView::HideScreenshotPane(bool hide)
void
ThemeInterfaceView::HideScreenshotPane(bool hide)
{
BString lbl;
if (IsScreenshotPaneHidden() && hide)
@@ -462,14 +482,16 @@ void ThemeInterfaceView::HideScreenshotPane(bool hide)
}
// ------------------------------------------------------------------------------
bool ThemeInterfaceView::IsScreenshotPaneHidden()
bool
ThemeInterfaceView::IsScreenshotPaneHidden()
{
return fScreenshotPaneHidden;
}
// ------------------------------------------------------------------------------
void ThemeInterfaceView::PopulateThemeList()
void
ThemeInterfaceView::PopulateThemeList()
{
int i;
BControl *c;
@@ -478,20 +500,23 @@ void ThemeInterfaceView::PopulateThemeList()
if (c)
c->SetEnabled(false);
}
thread_id tid = spawn_thread(_ThemeListPopulatorTh, "ThemeListPopulator", B_LOW_PRIORITY, this);
thread_id tid = spawn_thread(_ThemeListPopulatorTh, "ThemeListPopulator",
B_LOW_PRIORITY, this);
resume_thread(tid);
}
// ------------------------------------------------------------------------------
int32 ThemeInterfaceView::_ThemeListPopulatorTh(void *arg)
int32
ThemeInterfaceView::_ThemeListPopulatorTh(void *arg)
{
ThemeInterfaceView *_this = (ThemeInterfaceView *)arg;
_this->_ThemeListPopulator();
return 0;
}
// ------------------------------------------------------------------------------
void ThemeInterfaceView::_ThemeListPopulator()
void
ThemeInterfaceView::_ThemeListPopulator()
{
status_t err;
int32 i, count;
@@ -548,6 +573,8 @@ void ThemeInterfaceView::_ThemeListPopulator()
LockLooper();
fThemeList->AddItem(ti);
UnlockLooper();
// rest a bit
snooze(1000);
}
}
// enable controls again
@@ -561,8 +588,9 @@ void ThemeInterfaceView::_ThemeListPopulator()
UnlockLooper();
}
// ------------------------------------------------------------------------------
void ThemeInterfaceView::PopulateAddonList()
void
ThemeInterfaceView::PopulateAddonList()
{
int32 i, count;
ViewItem *vi;
@@ -575,8 +603,9 @@ void ThemeInterfaceView::PopulateAddonList()
}
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::Revert()
status_t
ThemeInterfaceView::Revert()
{
status_t err = B_OK;
ThemeManager* tman = GetThemeManager();
@@ -589,8 +618,9 @@ status_t ThemeInterfaceView::Revert()
return B_OK;
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::ApplyDefaults()
status_t
ThemeInterfaceView::ApplyDefaults()
{
status_t err = B_OK;
ThemeManager* tman = GetThemeManager();
@@ -601,8 +631,9 @@ status_t ThemeInterfaceView::ApplyDefaults()
return err;
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::ApplySelected()
status_t
ThemeInterfaceView::ApplySelected()
{
status_t err;
ThemeManager* tman = GetThemeManager();
@@ -623,8 +654,9 @@ status_t ThemeInterfaceView::ApplySelected()
return err;
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::CreateNew(const char *name)
status_t
ThemeInterfaceView::CreateNew(const char *name)
{
status_t err;
ThemeManager* tman = GetThemeManager();
@@ -649,8 +681,9 @@ status_t ThemeInterfaceView::CreateNew(const char *name)
return B_OK;
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::SaveSelected()
status_t
ThemeInterfaceView::SaveSelected()
{
status_t err;
ThemeManager* tman = GetThemeManager();
@@ -680,8 +713,9 @@ status_t ThemeInterfaceView::SaveSelected()
return err;
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::DeleteSelected()
status_t
ThemeInterfaceView::DeleteSelected()
{
status_t err;
ThemeManager* tman = GetThemeManager();
@@ -710,8 +744,9 @@ status_t ThemeInterfaceView::DeleteSelected()
return err;
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::AddScreenshot()
status_t
ThemeInterfaceView::AddScreenshot()
{
status_t err;
ThemeManager* tman = GetThemeManager();
@@ -739,8 +774,9 @@ status_t ThemeInterfaceView::AddScreenshot()
return err;
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::ThemeSelected()
status_t
ThemeInterfaceView::ThemeSelected()
{
status_t err;
ThemeManager* tman = GetThemeManager();
@@ -795,18 +831,21 @@ status_t ThemeInterfaceView::ThemeSelected()
return err;
}
// ------------------------------------------------------------------------------
void ThemeInterfaceView::SetIsRevertable()
void
ThemeInterfaceView::SetIsRevertable()
{
BMessenger msgr(Parent());
msgr.SendMessage(B_PREF_APP_ENABLE_REVERT);
}
// PRIVATE: in libzeta for now.
extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap);
// ------------------------------------------------------------------------------
void ThemeInterfaceView::SetScreenshot(BBitmap *shot)
void
ThemeInterfaceView::SetScreenshot(BBitmap *shot)
{
// no screenshotpanel
if(NULL == fScreenshotPane)
@@ -837,8 +876,9 @@ void ThemeInterfaceView::SetScreenshot(BBitmap *shot)
delete shot;
}
// ------------------------------------------------------------------------------
status_t ThemeInterfaceView::AError(const char *func, status_t err)
status_t
ThemeInterfaceView::AError(const char *func, status_t err)
{
BAlert *alert;
BString msg;
+2 -2
View File
@@ -20,7 +20,7 @@ class MyInvoker;
class ThemeInterfaceView : public BView
{
public:
public:
ThemeInterfaceView(BRect _bounds);
virtual ~ThemeInterfaceView();
@@ -48,7 +48,7 @@ class ThemeInterfaceView : public BView
void SetScreenshot(BBitmap *shot);
status_t AError(const char *func, status_t err);
private:
private:
static int32 _ThemeListPopulatorTh(void *arg);
void _ThemeListPopulator();
+23 -6
View File
@@ -3,6 +3,10 @@
#include <Font.h>
#include <stdio.h>
// #pragma mark -
ThemeItem::ThemeItem(int32 id, const char *name, bool ro)
: BStringItem(name)
{
@@ -11,11 +15,14 @@ ThemeItem::ThemeItem(int32 id, const char *name, bool ro)
fRo = ro;
}
ThemeItem::~ThemeItem()
{
}
void ThemeItem::DrawItem(BView *owner, BRect frame, bool complete)
void
ThemeItem::DrawItem(BView *owner, BRect frame, bool complete)
{
rgb_color col;
if (fCurrent || fRo)
@@ -44,27 +51,37 @@ void ThemeItem::DrawItem(BView *owner, BRect frame, bool complete)
owner->PopState();
}
int32 ThemeItem::ThemeId()
int32
ThemeItem::ThemeId()
{
return fId;
}
bool ThemeItem::IsCurrent()
bool
ThemeItem::IsCurrent()
{
return fCurrent;
}
void ThemeItem::SetCurrent(bool set)
void
ThemeItem::SetCurrent(bool set)
{
fCurrent = set;
}
bool ThemeItem::IsReadOnly()
bool
ThemeItem::IsReadOnly()
{
return fRo;
}
void ThemeItem::SetReadOnly(bool set)
void
ThemeItem::SetReadOnly(bool set)
{
fRo = set;
}
+2 -2
View File
@@ -6,7 +6,7 @@
class ThemeItem : public BStringItem
{
public:
public:
ThemeItem(int32 id, const char *name, bool ro = false);
~ThemeItem();
void DrawItem(BView *owner, BRect frame, bool complete = false);
@@ -15,7 +15,7 @@ class ThemeItem : public BStringItem
bool IsReadOnly();
void SetReadOnly(bool set);
int32 ThemeId();
private:
private:
int32 fId;
bool fRo;
bool fCurrent;
+14 -7
View File
@@ -16,6 +16,7 @@ typedef struct font_folder_info {
char *name;
uint32 flags;
} font_folder_info;
typedef struct font_file_info {
char *name;
uint32 flags;
@@ -34,7 +35,8 @@ extern long _count_font_files_(long);
extern status_t _get_nth_font_file_(long, font_file_info **);
extern status_t _get_nth_font_folder_(long, font_folder_info **);
status_t find_font_file(entry_ref *to, font_family family, font_style style, float size)
status_t
find_font_file(entry_ref *to, font_family family, font_style style, float size)
{
#ifdef B_BEOS_VERSION_DANO
status_t err = ENOENT;
@@ -74,6 +76,7 @@ status_t find_font_file(entry_ref *to, font_family family, font_style style, flo
return ENOENT;
}
#define _BORK(_t) \
err = find_directory(_t, &path); \
if (!err && (s = dir->FindFirst(path.Path())) >= 0) { \
@@ -86,7 +89,8 @@ status_t find_font_file(entry_ref *to, font_family family, font_style style, flo
return B_OK; \
} \
status_t escape_find_directory(BString *dir)
status_t
escape_find_directory(BString *dir)
{
status_t err;
BPath path;
@@ -157,6 +161,7 @@ status_t escape_find_directory(BString *dir)
}
#undef _BORK
#define _BORK(_t) \
if (tok == #_t) { \
err = find_directory(_t, &path); \
@@ -167,7 +172,8 @@ status_t escape_find_directory(BString *dir)
} \
status_t unescape_find_directory(BString *dir)
status_t
unescape_find_directory(BString *dir)
{
status_t err = B_ERROR;
int32 s, e;
@@ -243,12 +249,13 @@ status_t unescape_find_directory(BString *dir)
return B_OK;
}
#undef _BORK
// copy a file including its attributes
#define BUFF_SZ 1024*1024
status_t copy_file(entry_ref *ref, const char *to)
status_t
copy_file(entry_ref *ref, const char *to)
{
char *buff;
status_t err = B_OK;
@@ -265,7 +272,8 @@ status_t copy_file(entry_ref *ref, const char *to)
}
int testhook()
int
testhook()
{
status_t err;
BString str("/boot/home/config/fonts/ttfonts/toto.ttf");
@@ -274,7 +282,6 @@ int testhook()
err = unescape_find_directory(&str);
printf("error 0x%08lx %s\n", err, str.String());
return 0;
return 1;
}
status_t
+10 -3
View File
@@ -4,7 +4,9 @@
#include <stdio.h>
#include <Debug.h>
ViewItem::ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 flags, uint32 level, bool expanded)
ViewItem::ViewItem(BRect bounds, const char *name,
uint32 resizeMask, uint32 flags, uint32 level, bool expanded)
: BView(bounds, name, resizeMask, flags), BListItem(level, expanded)
{
fOwner = NULL;
@@ -12,13 +14,16 @@ ViewItem::ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 fla
SetHeight(bounds.Height());
}
ViewItem::~ViewItem()
{
if (fOwner)
fOwner->RemoveChild(this);
}
void ViewItem::DrawItem(BView *ownerview, BRect frame, bool complete)
void
ViewItem::DrawItem(BView *ownerview, BRect frame, bool complete)
{
(void)frame; (void)complete;
if (!fOwner) {
@@ -40,7 +45,9 @@ void ViewItem::DrawItem(BView *ownerview, BRect frame, bool complete)
//BListItem::DrawItem(ownerview, frame, complete);
}
void ViewItem::Update(BView *ownerview, const BFont *font)
void
ViewItem::Update(BView *ownerview, const BFont *font)
{
PRINT(("ViewItem::Update()\n"));
(void)font;
+7 -7
View File
@@ -7,13 +7,13 @@
class ViewItem : public BView, public BListItem
{
public:
ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 flags, uint32 level = 0, bool expanded = true);
virtual ~ViewItem();
virtual void DrawItem(BView *ownerview, BRect frame, bool complete = false);
virtual void Update(BView *ownerview, const BFont *font);
private:
BListView *fOwner;
public:
ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 flags, uint32 level = 0, bool expanded = true);
virtual ~ViewItem();
virtual void DrawItem(BView *ownerview, BRect frame, bool complete = false);
virtual void Update(BView *ownerview, const BFont *font);
private:
BListView* fOwner;
};
#endif // _VIEW_ITEM_H_