diff --git a/3rdparty/mmu_man/themes/BeThemeImporter.cpp b/3rdparty/mmu_man/themes/BeThemeImporter.cpp index 0e1e4f198e..6762a990be 100644 --- a/3rdparty/mmu_man/themes/BeThemeImporter.cpp +++ b/3rdparty/mmu_man/themes/BeThemeImporter.cpp @@ -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(); diff --git a/3rdparty/mmu_man/themes/MSThemeImporter.cpp b/3rdparty/mmu_man/themes/MSThemeImporter.cpp index 11f53559b7..e094e6537b 100644 --- a/3rdparty/mmu_man/themes/MSThemeImporter.cpp +++ b/3rdparty/mmu_man/themes/MSThemeImporter.cpp @@ -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; diff --git a/3rdparty/mmu_man/themes/MakeScreenshot.cpp b/3rdparty/mmu_man/themes/MakeScreenshot.cpp index b4e59597fb..f9efc1d505 100644 --- a/3rdparty/mmu_man/themes/MakeScreenshot.cpp +++ b/3rdparty/mmu_man/themes/MakeScreenshot.cpp @@ -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; } + diff --git a/3rdparty/mmu_man/themes/TextInputAlert.h b/3rdparty/mmu_man/themes/TextInputAlert.h index 61a419adb6..1b993e27b3 100644 --- a/3rdparty/mmu_man/themes/TextInputAlert.h +++ b/3rdparty/mmu_man/themes/TextInputAlert.h @@ -5,7 +5,7 @@ #include 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; }; diff --git a/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp b/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp index d080e77f52..772f4d16c2 100644 --- a/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp +++ b/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp @@ -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; diff --git a/3rdparty/mmu_man/themes/ThemeInterfaceView.h b/3rdparty/mmu_man/themes/ThemeInterfaceView.h index 4d7f140dfe..840dbeed0c 100644 --- a/3rdparty/mmu_man/themes/ThemeInterfaceView.h +++ b/3rdparty/mmu_man/themes/ThemeInterfaceView.h @@ -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(); diff --git a/3rdparty/mmu_man/themes/ThemeItem.cpp b/3rdparty/mmu_man/themes/ThemeItem.cpp index 1ded9606e9..9856986032 100644 --- a/3rdparty/mmu_man/themes/ThemeItem.cpp +++ b/3rdparty/mmu_man/themes/ThemeItem.cpp @@ -3,6 +3,10 @@ #include #include + +// #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; } diff --git a/3rdparty/mmu_man/themes/ThemeItem.h b/3rdparty/mmu_man/themes/ThemeItem.h index 1bf6015b56..febd1d895b 100644 --- a/3rdparty/mmu_man/themes/ThemeItem.h +++ b/3rdparty/mmu_man/themes/ThemeItem.h @@ -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; diff --git a/3rdparty/mmu_man/themes/Utils.cpp b/3rdparty/mmu_man/themes/Utils.cpp index c27b4b45b7..4a16eb7a66 100644 --- a/3rdparty/mmu_man/themes/Utils.cpp +++ b/3rdparty/mmu_man/themes/Utils.cpp @@ -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 diff --git a/3rdparty/mmu_man/themes/ViewItem.cpp b/3rdparty/mmu_man/themes/ViewItem.cpp index bedd0f9ab2..3534a7fe35 100644 --- a/3rdparty/mmu_man/themes/ViewItem.cpp +++ b/3rdparty/mmu_man/themes/ViewItem.cpp @@ -4,7 +4,9 @@ #include #include -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; diff --git a/3rdparty/mmu_man/themes/ViewItem.h b/3rdparty/mmu_man/themes/ViewItem.h index 52decb2164..92b5976a78 100644 --- a/3rdparty/mmu_man/themes/ViewItem.h +++ b/3rdparty/mmu_man/themes/ViewItem.h @@ -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_