From 6572adb23b19f663c0bc2343c9f02ec554e912be Mon Sep 17 00:00:00 2001 From: barrett Date: Fri, 4 Jan 2013 13:52:14 +0000 Subject: [PATCH] Codestyle fixes, patch created by Freemann2430 during GCI2012 --- libs/libdownload/Action.h | 8 +-- libs/libdownload/ActionDownload.cpp | 9 ++- libs/libdownload/ActionDownload.h | 69 ++++++++++++++------- libs/libdownload/DownloadManager.cpp | 17 +++++- libs/libdownload/DownloadManager.h | 6 +- libs/libdownload/QueueFileDownload.cpp | 11 +++- libs/libdownload/QueueMultiActions.cpp | 10 ++++ libs/libdownload/QueueMultiActions.h | 26 ++++---- libs/libdownload/ReflowingTextView.cpp | 80 ++++++++++++++++++------- libs/libinterface/BitmapMenuItem.cpp | 17 +++--- libs/libinterface/BitmapMenuItem.h | 19 +++--- libs/libinterface/BitmapUtils.cpp | 8 +-- libs/libinterface/BitmapView.h | 30 +++++----- libs/libinterface/Divider.h | 3 +- libs/libinterface/NotifyingTextView.cpp | 6 +- libs/libinterface/NotifyingTextView.h | 22 +++---- libs/libinterface/PictureView.h | 2 +- libs/libinterface/ToolButton.cpp | 32 +++++----- 18 files changed, 237 insertions(+), 138 deletions(-) diff --git a/libs/libdownload/Action.h b/libs/libdownload/Action.h index 0ee3f0d..1396ce0 100644 --- a/libs/libdownload/Action.h +++ b/libs/libdownload/Action.h @@ -13,14 +13,14 @@ class Action { public: - Action() { fActionID = 0; } - virtual ~Action() {} + Action() { fActionID = 0; } + virtual ~Action() {} virtual status_t Perform(BMessage* errors) = 0; virtual BString GetDescription() = 0; - void SetActionID(const ActionID id) { fActionID = id; } - ActionID GetActionID() const { return fActionID; } + void SetActionID(const ActionID id) { fActionID = id; } + ActionID GetActionID() const { return fActionID; } private: ActionID fActionID; diff --git a/libs/libdownload/ActionDownload.cpp b/libs/libdownload/ActionDownload.cpp index 43d2731..138b336 100644 --- a/libs/libdownload/ActionDownload.cpp +++ b/libs/libdownload/ActionDownload.cpp @@ -170,18 +170,21 @@ ActionDownload::Perform(BMessage* errors) return status; } + BString ActionDownload::GetDescription() { return "HTTP File download"; } + BString ActionDownload::GetLocalPath() { return BPath(&fDest).Path(); } + void ActionDownload::fillMessage(ActionDownload* ad, BMessage* msg) { @@ -196,7 +199,6 @@ ActionDownload::fillMessage(ActionDownload* ad, BMessage* msg) } - void ActionDownload::sendProgressX(ActionDownload* ad, double max, double current) { @@ -253,6 +255,7 @@ ActionDownload::sendError(BLooper* looper,uint32 amsg,Status st,BString descr){ */ // + int ActionDownload::callback(void* data, double dltotal, @@ -267,6 +270,7 @@ ActionDownload::callback(void* data, return 0; } + size_t ActionDownload::save_file( void* ptr, size_t size, size_t nmemb, void* data) { @@ -280,6 +284,7 @@ ActionDownload::save_file( void* ptr, size_t size, size_t nmemb, void* data) } } BFile* file = ad->file; - if (ad->ShouldStop()) return 0; + if (ad->ShouldStop()) + return 0; return file->Write(ptr, size * nmemb); } diff --git a/libs/libdownload/ActionDownload.h b/libs/libdownload/ActionDownload.h index 6edf4b4..7cfdd60 100644 --- a/libs/libdownload/ActionDownload.h +++ b/libs/libdownload/ActionDownload.h @@ -27,55 +27,77 @@ public: OK_DOWNLOADED // 5 }; - ActionDownload(BString URL, entry_ref dest, + ActionDownload(BString URL, entry_ref dest, bool allowResume, BLooper* target = NULL, uint32 msg = 0); - virtual ~ActionDownload(); + virtual ~ActionDownload(); status_t Perform(BMessage* errors); BString GetDescription(); BString GetLocalPath(); - void SetLooper(BLooper* loop, uint32 msg) { +void +SetLooper(BLooper* loop, uint32 msg) +{ fTarget = loop; fMsg = msg; - }; - BLooper* Looper() { +}; + +BLooper* +Looper() +{ return fTarget; - } - uint32 MessageWhat() { +} + +uint32 +MessageWhat() +{ return fMsg; - } +} // For compatibility: - void SetExtraData(BString extra) { +void +SetExtraData(BString extra) +{ extraInfo.AddString("extra", extra); - } +} - void SetKey(BString key, BString data) { +void +SetKey(BString key, BString data) +{ extraInfo.AddString(key.String(), data); - } +} - void SetRef(BString key, entry_ref* ref) { +void +SetRef(BString key, entry_ref* ref) +{ extraInfo.AddRef(key.String(), ref); - } +} - status_t GetRef(BString key, entry_ref* ref) { +status_t +GetRef(BString key, entry_ref* ref) +{ return extraInfo.FindRef(key.String(), ref); - } +} - BString GetKey(BString key) { +BString GetKey(BString key) +{ BString data; extraInfo.FindString(key.String(), &data); return data; - } +} - void SetShouldStop(bool stop) { +void +SetShouldStop(bool stop) +{ fShouldStop = stop; - } - bool ShouldStop() { +} + +bool +ShouldStop() +{ return fShouldStop; - } +} void SetDownloadManager(DownloadManager* downloadManager); @@ -87,7 +109,8 @@ private: //curl callbacks: static size_t save_file ( void* ptr, size_t size, size_t nmemb, void* stream); - static int callback (void* clientp, double dltotal, double dlnow, double , double); + static int callback (void* clientp, double dltotal, + double dlnow, double , double); CURL* curl; BString fUrl; diff --git a/libs/libdownload/DownloadManager.cpp b/libs/libdownload/DownloadManager.cpp index aa0a0a7..b2208e5 100644 --- a/libs/libdownload/DownloadManager.cpp +++ b/libs/libdownload/DownloadManager.cpp @@ -13,20 +13,25 @@ #define DEFAULT_ITEMS_DOWNLOAD 1 -DownloadManager::DownloadManager(BLooper* target): fTarget(target) +DownloadManager::DownloadManager(BLooper* target) + : + fTarget(target) { } + void DownloadManager::Enqueue(QueueType type, ActionDownload* ad) { if (!fQueue[type]) { - fQueue[type] = new QueueFileDownload("queue_downloads", DEFAULT_ITEMS_DOWNLOAD, fTarget, DOWNLOAD_INFO); + fQueue[type] = new QueueFileDownload("queue_downloads", + DEFAULT_ITEMS_DOWNLOAD, fTarget, DOWNLOAD_INFO); } ad->SetDownloadManager(this); fQueue[type]->AddAction(ad); } + void DownloadManager::TryStopCurrentAction(QueueType type, BString key, BString value) { @@ -46,6 +51,7 @@ DownloadManager::TryStopCurrentAction(QueueType type, BString key, BString value } } + bool DownloadManager::RemoveFromQueue(QueueType type , BString key, BString value) { @@ -78,6 +84,7 @@ DownloadManager::RemoveFromQueue(QueueType type , BString key, BString value) return false; } + void DownloadManager::RemoveQueue(QueueType type, BList* removed) { @@ -103,6 +110,7 @@ DownloadManager::RemoveQueue(QueueType type, BList* removed) } } + void DownloadManager::LoadProxySetting(BMessage* data) { @@ -158,6 +166,7 @@ DownloadManager::FinishCurl(CURL* curl) curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD , fUserpwd.String() ); } + thread_id DownloadManager::SingleThreadAction(ActionDownload* action) { @@ -165,11 +174,13 @@ DownloadManager::SingleThreadAction(ActionDownload* action) if (action->Looper() == NULL) { action->SetLooper(fTarget, DOWNLOAD_INFO); } - thread_id id = spawn_thread(DownloadManager::SingleThreadPerform, "single_action_thread", B_NORMAL_PRIORITY, (void*)action); + thread_id id = spawn_thread(DownloadManager::SingleThreadPerform, + "single_action_thread", B_NORMAL_PRIORITY, (void*)action); resume_thread(id); return id; } + int32 DownloadManager::SingleThreadPerform(void* a) { diff --git a/libs/libdownload/DownloadManager.h b/libs/libdownload/DownloadManager.h index e8ba986..e9f2169 100644 --- a/libs/libdownload/DownloadManager.h +++ b/libs/libdownload/DownloadManager.h @@ -19,11 +19,9 @@ class ActionDownload; class DownloadManager { public: - enum QueueType { - DOWNLOADS_QUEUE = 0 - }; + enum QueueType {DOWNLOADS_QUEUE = 0}; - DownloadManager(BLooper* target); + DownloadManager(BLooper* target); void Enqueue(QueueType, ActionDownload*); diff --git a/libs/libdownload/QueueFileDownload.cpp b/libs/libdownload/QueueFileDownload.cpp index e000d77..809fedb 100644 --- a/libs/libdownload/QueueFileDownload.cpp +++ b/libs/libdownload/QueueFileDownload.cpp @@ -14,18 +14,21 @@ void QueueFileDownload::ActionReadyToPerform(Action* action) { ActionDownload* ad = dynamic_cast(action); - if (!ad) return; + if (!ad) + return; ad->SetLooper(fLooper, fMsg); } + void QueueFileDownload::ActionPerformed(Action* action, status_t state, BMessage* msg) { ActionDownload* ad = dynamic_cast(action); - if (!ad) return; + if (!ad) + return; BMessage notify(*msg); notify.what = fMsg; @@ -36,11 +39,13 @@ QueueFileDownload::ActionPerformed(Action* action, status_t state, BMessage* msg return; } + void QueueFileDownload::SuppressAction(Action* action) { ActionDownload* ad = dynamic_cast(action); - if (!ad) return; + if (!ad) + return; ad->SetShouldStop(true); } diff --git a/libs/libdownload/QueueMultiActions.cpp b/libs/libdownload/QueueMultiActions.cpp index 262854a..9145e89 100644 --- a/libs/libdownload/QueueMultiActions.cpp +++ b/libs/libdownload/QueueMultiActions.cpp @@ -69,6 +69,7 @@ QueueMultiActions::Lock() return (value == B_NO_ERROR); } + void QueueMultiActions::Unlock() { @@ -76,6 +77,7 @@ QueueMultiActions::Unlock() release_sem(fLock); } + void QueueMultiActions::SetDownloadCount(int fProposedCount) { @@ -138,6 +140,7 @@ QueueMultiActions::AddAction(Action* a) } } + Action* QueueMultiActions::CurrentAction(int index) { @@ -145,6 +148,7 @@ QueueMultiActions::CurrentAction(int index) return fCurrentAction[index]; } + void QueueMultiActions::SetCurrentAction(Action* action, int index) { @@ -152,6 +156,7 @@ QueueMultiActions::SetCurrentAction(Action* action, int index) fCurrentAction[index] = action; } + int32 QueueMultiActions::CountActions() { @@ -159,6 +164,7 @@ QueueMultiActions::CountActions() return fList.CountItems(); } + Action* QueueMultiActions::ActionAt(int32 pos) { @@ -166,6 +172,7 @@ QueueMultiActions::ActionAt(int32 pos) return fList.ItemAt(pos); } + void QueueMultiActions::RemoveActionAt(int32 pos) { @@ -173,18 +180,21 @@ QueueMultiActions::RemoveActionAt(int32 pos) fList.RemoveItemAt(pos); } + bool QueueMultiActions::IsLocked() { return fLocked; } + void QueueMultiActions::KIllThread(int id) { fID[id] = 0; } + int32 QueueMultiActions::ManageTheQueue(void* data) { diff --git a/libs/libdownload/QueueMultiActions.h b/libs/libdownload/QueueMultiActions.h index af9bc8e..85a319e 100644 --- a/libs/libdownload/QueueMultiActions.h +++ b/libs/libdownload/QueueMultiActions.h @@ -19,35 +19,37 @@ class QueueMultiActions public: - QueueMultiActions(const char* name, int count); - virtual ~QueueMultiActions(); + QueueMultiActions(const char* name, int count); + virtual ~QueueMultiActions(); void AddAction(Action* ); //BEFORE CALLING CurrentAction, you MUST Lock() the Queue! - Action* CurrentAction(int index); + Action* CurrentAction(int index); int32 CountActions(); - int CountThreads() { + + + int CountThreads() { return fCount; } - Action* ActionAt(int32 pos); - void RemoveActionAt(int32 pos); + Action* ActionAt(int32 pos); + void RemoveActionAt(int32 pos); - void SetDownloadCount(int count); + void SetDownloadCount(int count); - bool Lock(); - void Unlock(); - bool IsLocked(); + bool Lock(); + void Unlock(); + bool IsLocked(); protected: - static int32 ManageTheQueue(void*); +static int32 ManageTheQueue(void*); - virtual void ActionReadyToPerform(Action*) = 0; +virtual void ActionReadyToPerform(Action*) = 0; virtual void ActionPerformed(Action*, status_t, BMessage*) = 0; virtual void SuppressAction(Action*) = 0; diff --git a/libs/libdownload/ReflowingTextView.cpp b/libs/libdownload/ReflowingTextView.cpp index 3d8499d..5cf267c 100644 --- a/libs/libdownload/ReflowingTextView.cpp +++ b/libs/libdownload/ReflowingTextView.cpp @@ -16,30 +16,45 @@ enum { RTV_HIDE_TOOLTIP }; -ReflowingTextView::ReflowingTextView(BRect frame, const char* name, BRect textRect, uint32 resizeMask, uint32 flags) : BTextView(frame, name, textRect, resizeMask, flags), _showTipRunner(NULL), _canShow(false), _urlTip(NULL), _currentLinkStart(-1) + +ReflowingTextView::ReflowingTextView(BRect frame, const char* name, + BRect textRect, uint32 resizeMask, uint32 flags) + : + BTextView(frame, name, textRect, resizeMask, flags), + _showTipRunner(NULL), + _canShow(false), + _urlTip(NULL), + _currentLinkStart(-1) { // empty } + ReflowingTextView::~ReflowingTextView() { if ((_urlTip) && (_urlTip->Lock())) _urlTip->Quit(); delete _showTipRunner; } -void ReflowingTextView::AttachedToWindow() + +void +ReflowingTextView::AttachedToWindow() { BTextView::AttachedToWindow(); // FixTextRect(); } -void ReflowingTextView::FrameResized(float w, float h) + +void +ReflowingTextView::FrameResized(float w, float h) { BTextView::FrameResized(w, h); // FixTextRect(); } -void ReflowingTextView::MouseMoved(BPoint where, uint32 code, const BMessage* msg) + +void +ReflowingTextView::MouseMoved(BPoint where, uint32 code, const BMessage* msg) { const URLLink* link = NULL; if (code == B_INSIDE_VIEW) { @@ -89,7 +104,9 @@ void ReflowingTextView::MouseMoved(BPoint where, uint32 code, const BMessage* ms BTextView::MouseMoved(where, code, msg); } -void ReflowingTextView::MessageReceived(BMessage* msg) + +void +ReflowingTextView::MessageReceived(BMessage* msg) { switch (msg->what) { case RTV_SHOW_TOOLTIP: @@ -112,12 +129,18 @@ void ReflowingTextView::MessageReceived(BMessage* msg) } } -void ReflowingTextView::UpdateToolTip() + +void +ReflowingTextView::UpdateToolTip() { if ((_canShow) && (_currentLinkStart >= 0)) { if (_urlTip == NULL) { - _urlTip = new BWindow(BRect(0, 0, 5, 5), NULL, B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_AVOID_FOCUS); - BView* blackBorder = new BView(_urlTip->Bounds(), NULL, B_FOLLOW_ALL_SIDES, 0); + _urlTip = new BWindow(BRect(0, 0, 5, 5), NULL, + B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, + B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | + B_AVOID_FOCUS); + BView* blackBorder = new BView(_urlTip->Bounds(), NULL, + B_FOLLOW_ALL_SIDES, 0); const rgb_color black = {0, 0, 0, 255}; blackBorder->SetViewColor(black); _urlTip->AddChild(blackBorder); @@ -130,7 +153,8 @@ void ReflowingTextView::UpdateToolTip() yellowInterior->SetViewColor(hiliteYellow); blackBorder->AddChild(yellowInterior); - _urlStringView = new BStringView(yellowInterior->Bounds(), NULL, "", B_FOLLOW_ALL_SIDES); + _urlStringView = new BStringView(yellowInterior->Bounds(), NULL, "", + B_FOLLOW_ALL_SIDES); _urlStringView->SetLowColor(hiliteYellow); _urlStringView->SetViewColor(hiliteYellow); yellowInterior->AddChild(_urlStringView); @@ -140,13 +164,15 @@ void ReflowingTextView::UpdateToolTip() _urlStringView->GetFontHeight(&ttfh); float urlHeight = 20.0f; BPoint pt = PointAt(_currentLinkStart, &urlHeight); - _urlTip->MoveTo(ConvertToScreen(pt) + BPoint(15.0f, -(ttfh.ascent + ttfh.descent + 3.0f))); + _urlTip->MoveTo(ConvertToScreen(pt) + BPoint(15.0f, + -(ttfh.ascent + ttfh.descent + 3.0f))); - _urlTip->ResizeTo(muscleMin(_urlStringView->StringWidth(_currentURLString.String()) + 4.0f, 400.0f), ttfh.ascent + ttfh.descent + 2.0f); + _urlTip->ResizeTo(muscleMin(_urlStringView->StringWidth(_currentURLString.String()) + + 4.0f, 400.0f), ttfh.ascent + ttfh.descent + 2.0f); _urlStringView->SetText(_currentURLString.String()); _urlTip->SetWorkspaces(B_CURRENT_WORKSPACE); if (_urlTip->IsHidden()) _urlTip->Show(); - _urlTip->Unlock(); + _urlTip->Unlock(); } } else if (_urlTip) { if (_urlTip->Lock()) { @@ -156,9 +182,12 @@ void ReflowingTextView::UpdateToolTip() } } -void ReflowingTextView::MouseDown(BPoint where) + +void +ReflowingTextView::MouseDown(BPoint where) { - if (IsFocus() == false) MakeFocus(); + if (IsFocus() == false) + MakeFocus(); const URLLink* url = GetURLAt(where); if (url) { char* allocBuf = NULL; @@ -197,36 +226,47 @@ void ReflowingTextView::MouseDown(BPoint where) BTextView::MouseDown(where); } -void ReflowingTextView::FixTextRect() + +void +ReflowingTextView::FixTextRect() { BRect t(Frame()); SetTextRect(t); } -void ReflowingTextView::Clear() + +void +ReflowingTextView::Clear() { Delete(0, TextLength() - 1); _urls.Clear(); } -void ReflowingTextView::AddURLRegion(uint32 start, uint32 len, const BString& optHiddenURL) + +void +ReflowingTextView::AddURLRegion(uint32 start, uint32 len, const BString& optHiddenURL) { _urls.AddTail(URLLink(start, len, optHiddenURL)); } -void ReflowingTextView::SetCommandURLTarget(const BMessenger& target, const BMessage& queryMsg, const BMessage& privMsg) + +void +ReflowingTextView::SetCommandURLTarget(const BMessenger& target, const BMessage& queryMsg, const BMessage& privMsg) { _commandTarget = target; _queryMessage = queryMsg; _privMessage = privMsg; } -const ReflowingTextView::URLLink* ReflowingTextView::GetURLAt(BPoint pt) const + +const +ReflowingTextView::URLLink* ReflowingTextView::GetURLAt(BPoint pt) const { uint32 offset = (uint32) OffsetAt(pt); for (int i = _urls.GetNumItems() - 1; i >= 0; i--) { const URLLink& url = _urls[i]; - if ((offset >= url.GetStart()) && (offset < url.GetStart() + url.GetLength())) return &url; + if ((offset >= url.GetStart()) && (offset < url.GetStart() + url.GetLength())) + return &url; } return NULL; } diff --git a/libs/libinterface/BitmapMenuItem.cpp b/libs/libinterface/BitmapMenuItem.cpp index cea2586..e2e79bc 100644 --- a/libs/libinterface/BitmapMenuItem.cpp +++ b/libs/libinterface/BitmapMenuItem.cpp @@ -7,16 +7,18 @@ #include BitmapMenuItem::BitmapMenuItem(const char *label, BMessage *msg, - BBitmap *bitmap, char shortcut, - uint32 modifiers) - : BMenuItem(label,msg,shortcut,modifiers), - fBitmap(bitmap) + BBitmap *bitmap, char shortcut, + uint32 modifiers) + : + BMenuItem(label,msg,shortcut,modifiers), + fBitmap(bitmap) { } BitmapMenuItem::BitmapMenuItem(BMessage *data) - : BMenuItem(data) + : + BMenuItem(data) { fBitmap = (BBitmap*) BBitmap::Instantiate(data); } @@ -73,12 +75,13 @@ BitmapMenuItem::DrawContent(void) drawrect.bottom--; drawrect.top++; drawrect.left = ContentLocation().x; + if (fBitmap) { // Scale the fBitmap down to completely fit within the field's height if (fBitmap->Bounds().Height() > drawrect.Height()) { drawrect.right = drawrect.left + - (fBitmap->Bounds().Width() * - (Frame().Height() / fBitmap->Bounds().Height())); + (fBitmap->Bounds().Width() * + (Frame().Height() / fBitmap->Bounds().Height())); } else { drawrect.right = drawrect.left + fBitmap->Bounds().Width(); } diff --git a/libs/libinterface/BitmapMenuItem.h b/libs/libinterface/BitmapMenuItem.h index 0988268..dacd8ca 100644 --- a/libs/libinterface/BitmapMenuItem.h +++ b/libs/libinterface/BitmapMenuItem.h @@ -16,25 +16,24 @@ BitmapMenuItems -- the bitmap does not obscure the checkmark. */ -class BitmapMenuItem : public BMenuItem -{ +class BitmapMenuItem : public BMenuItem { public: - BitmapMenuItem(const char *label, BMessage *msg, - BBitmap *bitmap, char shortcut = 0, - uint32 modifiers = 0); - BitmapMenuItem(BMessage *data); - virtual ~BitmapMenuItem(void); + BitmapMenuItem(const char *label, BMessage *msg, + BBitmap *bitmap, char shortcut = 0, + uint32 modifiers = 0); + BitmapMenuItem(BMessage *data); + virtual ~BitmapMenuItem(void); virtual status_t Archive(BMessage *data, bool deep = true) const; virtual void GetContentSize(float *width, float *height); virtual void DrawContent(void); virtual void SetBitmap(BBitmap *bitmap); - BBitmap * Bitmap(void) const; + BBitmap* Bitmap(void) const; private: - BBitmap *fBitmap; - float fBaselineOffset; + BBitmap *fBitmap; + float fBaselineOffset; }; #endif diff --git a/libs/libinterface/BitmapUtils.cpp b/libs/libinterface/BitmapUtils.cpp index 231ef6a..4f85b6f 100644 --- a/libs/libinterface/BitmapUtils.cpp +++ b/libs/libinterface/BitmapUtils.cpp @@ -23,7 +23,7 @@ BBitmap* ReadNodeIcon(const char* name, icon_size size, bool followSymlink) { BEntry entry(name, followSymlink); - entry_ref ref; + entry_ref ref; entry.GetRef(&ref); @@ -32,8 +32,8 @@ ReadNodeIcon(const char* name, icon_size size, bool followSymlink) BBitmap* ret = new BBitmap(BRect(0, 0, (float)size - 1, (float)size - 1), B_RGBA32); if (BIconUtils::GetIcon(&node, BEOS_ICON_ATTRIBUTE, BEOS_MINI_ICON_ATTRIBUTE, BEOS_LARGE_ICON_ATTRIBUTE, size, ret) != B_OK) { - delete ret; - ret = NULL; + delete ret; + ret = NULL; } return ret; @@ -127,7 +127,7 @@ RescaleBitmap(const BBitmap* src, float width, float height) for (int32 x = 0; x <= width; x++) memcpy((void*)((uint32)dstRow + (x * bpp)), (void*)((uint32)srcRow - + ((uint32)(x * dx) * bpp)), bpp); + + ((uint32)(x * dx) * bpp)), bpp); } return res; diff --git a/libs/libinterface/BitmapView.h b/libs/libinterface/BitmapView.h index 93c2349..afb2746 100644 --- a/libs/libinterface/BitmapView.h +++ b/libs/libinterface/BitmapView.h @@ -11,29 +11,29 @@ class BBitmap; class BitmapView : public BView { public: - BitmapView(const char* name = NULL, uint32 flags - = B_WILL_DRAW); - ~BitmapView(); + BitmapView(const char* name = NULL, + uint32 flags = B_WILL_DRAW); + ~BitmapView(); - virtual void AttachedToWindow(); + virtual void AttachedToWindow(); - status_t InitCheck(); + status_t InitCheck(); - BBitmap* Bitmap() const; + BBitmap* Bitmap() const; - status_t SetBitmap(const char* filename); - status_t SetBitmap(const BBitmap* bitmap); + status_t SetBitmap(const char* filename); + status_t SetBitmap(const BBitmap* bitmap); - virtual BSize MinSize(); - virtual BSize MaxSize(); - virtual BSize PreferredSize(); + virtual BSize MinSize(); + virtual BSize MaxSize(); + virtual BSize PreferredSize(); - virtual void Draw(BRect frame); + virtual void Draw(BRect frame); private: - BBitmap* fBitmap; - float fWidth; - float fHeight; + BBitmap* fBitmap; + float fWidth; + float fHeight; }; #endif // _BITMAP_VIEW_H diff --git a/libs/libinterface/Divider.h b/libs/libinterface/Divider.h index 783db7b..391eb22 100644 --- a/libs/libinterface/Divider.h +++ b/libs/libinterface/Divider.h @@ -12,7 +12,8 @@ class BMessenger; class Divider : public BView { public: - Divider(const char* name, uint32 flags = B_FRAME_EVENTS | B_WILL_DRAW); + Divider(const char* name, uint32 flags = + B_FRAME_EVENTS | B_WILL_DRAW); virtual ~Divider(); Divider(BMessage* archive); diff --git a/libs/libinterface/NotifyingTextView.cpp b/libs/libinterface/NotifyingTextView.cpp index 6e43a90..b61d8d5 100644 --- a/libs/libinterface/NotifyingTextView.cpp +++ b/libs/libinterface/NotifyingTextView.cpp @@ -23,7 +23,7 @@ NotifyingTextView::NotifyingTextView(const char* name, uint32 flags) NotifyingTextView::~NotifyingTextView() { if (fMessenger != NULL) - delete fMessenger; + delete fMessenger; } @@ -51,8 +51,8 @@ NotifyingTextView::SetMessage(BMessage* msg) void -NotifyingTextView::InsertText(const char* text, int32 length, int32 offset, - const text_run_array* runs) +NotifyingTextView::InsertText(const char* text, int32 length, + int32 offset, const text_run_array* runs) { if ((fMessenger != NULL) && fMessenger->IsValid()) { BMessage msg(*fMessage); diff --git a/libs/libinterface/NotifyingTextView.h b/libs/libinterface/NotifyingTextView.h index a00f1b7..792779b 100644 --- a/libs/libinterface/NotifyingTextView.h +++ b/libs/libinterface/NotifyingTextView.h @@ -14,23 +14,23 @@ class BMessenger; class NotifyingTextView : public BTextView { public: - NotifyingTextView(const char* name, uint32 flags - = B_WILL_DRAW | B_PULSE_NEEDED); - ~NotifyingTextView(); + NotifyingTextView(const char* name, uint32 flags + = B_WILL_DRAW | B_PULSE_NEEDED); + ~NotifyingTextView(); - void SetTarget(const BHandler* handler); + void SetTarget(const BHandler* handler); - BMessage* Message() const; - void SetMessage(BMessage* msg); + BMessage* Message() const; + void SetMessage(BMessage* msg); protected: - virtual void InsertText(const char* text, int32 length, int32 offset, - const text_run_array* runs = NULL); - virtual void DeleteText(int32 start, int32 finish); + virtual void InsertText(const char* text, int32 length, + int32 offset, const text_run_array* runs = NULL); + virtual void DeleteText(int32 start, int32 finish); private: - BMessenger* fMessenger; - BMessage* fMessage; + BMessenger* fMessenger; + BMessage* fMessage; }; #endif // _NOTIFYING_TEXT_VIEW_H diff --git a/libs/libinterface/PictureView.h b/libs/libinterface/PictureView.h index a46cf65..6ac6b85 100644 --- a/libs/libinterface/PictureView.h +++ b/libs/libinterface/PictureView.h @@ -12,7 +12,7 @@ class BBitmap; class PictureView : public BView { public: PictureView(const char* name, const char* filename, - uint32 flags = B_WILL_DRAW); + uint32 flags = B_WILL_DRAW); ~PictureView(); status_t InitCheck(); diff --git a/libs/libinterface/ToolButton.cpp b/libs/libinterface/ToolButton.cpp index eb68bfc..b9a6e51 100644 --- a/libs/libinterface/ToolButton.cpp +++ b/libs/libinterface/ToolButton.cpp @@ -28,35 +28,37 @@ const uint32 kToolbarIconSize = 16; // this should go on BControlLook -ToolButton::ToolButton(const char* name, const char* label, BMessage* message, - uint32 flags) - : - BControl(name, label, message, +ToolButton::ToolButton(const char* name, const char* label, + BMessage* message, uint32 flags) + : + BControl(name, label, message, flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), - fBitmap(NULL), - fMenu(NULL), - fPreferredSize(-1, -1) + fBitmap(NULL), + fMenu(NULL), + fPreferredSize(-1, -1) { SetFontSize(be_plain_font->Size() * 0.85f); } ToolButton::ToolButton(const char* label, BMessage* message) - : BControl(NULL, label, message, + : + BControl(NULL, label, message, B_WILL_DRAW | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE), - fBitmap(NULL), - fMenu(NULL), - fPreferredSize(-1, -1) + fBitmap(NULL), + fMenu(NULL), + fPreferredSize(-1, -1) { SetFontSize(be_plain_font->Size() * 0.85f); } ToolButton::ToolButton(BMessage* archive) - : BControl(archive), - fBitmap(NULL), - fMenu(NULL), - fPreferredSize(-1, -1) + : + BControl(archive), + fBitmap(NULL), + fMenu(NULL), + fPreferredSize(-1, -1) { SetFontSize(be_plain_font->Size() * 0.85f); }