BToolbar: rename to BToolBar.

"BToolBar" matches the current convention ("BStatusBar", "BMenuBar", etc.)
I've no idea what I was thinking when I renamed this before...

Also adjust all users of BToolBar (Tracker and ShowImage).
This commit is contained in:
Augustin Cavalier
2015-02-11 22:54:48 -05:00
parent d7cde0634b
commit 94a4c1c456
7 changed files with 69 additions and 70 deletions
@@ -1,5 +1,5 @@
/* /*
* Copyright 2011-2014, Haiku, Inc. All rights reserved. * Copyright 2011-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _TOOLBAR_H #ifndef _TOOLBAR_H
@@ -12,11 +12,11 @@ class BButton;
namespace BPrivate { namespace BPrivate {
class BToolbar : public BGroupView { class BToolBar : public BGroupView {
public: public:
BToolbar(BRect frame, BToolBar(BRect frame,
orientation ont = B_HORIZONTAL); orientation ont = B_HORIZONTAL);
virtual ~BToolbar(); virtual ~BToolBar();
virtual void Hide(); virtual void Hide();
@@ -42,12 +42,12 @@ private:
void _AddView(BView* view); void _AddView(BView* view);
BButton* _FindButton(uint32 command) const; BButton* _FindButton(uint32 command) const;
void _HideToolTips() const; void _HideToolTips() const;
orientation fOrientation; orientation fOrientation;
}; };
} // namespace BPrivate } // namespace BPrivate
using BPrivate::BToolbar; using BPrivate::BToolBar;
#endif // _TOOLBAR_H #endif // _TOOLBAR_H
+39 -40
View File
@@ -45,7 +45,6 @@
#include <ScrollView.h> #include <ScrollView.h>
#include <String.h> #include <String.h>
#include <SupportDefs.h> #include <SupportDefs.h>
#include <Toolbar.h>
#include <TranslationDefs.h> #include <TranslationDefs.h>
#include <TranslationUtils.h> #include <TranslationUtils.h>
#include <TranslatorRoster.h> #include <TranslatorRoster.h>
@@ -138,7 +137,7 @@ ShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref,
fBrowseMenu(NULL), fBrowseMenu(NULL),
fGoToPageMenu(NULL), fGoToPageMenu(NULL),
fSlideShowDelayMenu(NULL), fSlideShowDelayMenu(NULL),
fToolbar(NULL), fToolBar(NULL),
fImageView(NULL), fImageView(NULL),
fStatusView(NULL), fStatusView(NULL),
fProgressWindow(new ProgressWindow()), fProgressWindow(new ProgressWindow()),
@@ -171,48 +170,48 @@ ShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref,
// Create the tool bar // Create the tool bar
BRect viewFrame = contentView->Bounds(); BRect viewFrame = contentView->Bounds();
viewFrame.right -= B_V_SCROLL_BAR_WIDTH; viewFrame.right -= B_V_SCROLL_BAR_WIDTH;
fToolbar = new BToolbar(viewFrame); fToolBar = new BToolBar(viewFrame);
// Add the tool icons. // Add the tool icons.
// fToolbar->AddAction(MSG_FILE_OPEN, be_app, // fToolBar->AddAction(MSG_FILE_OPEN, be_app,
// tool_bar_icon(kIconDocumentOpen), B_TRANSLATE("Open" B_UTF8_ELLIPSIS)); // tool_bar_icon(kIconDocumentOpen), B_TRANSLATE("Open" B_UTF8_ELLIPSIS));
fToolbar->AddAction(MSG_FILE_PREV, this, fToolBar->AddAction(MSG_FILE_PREV, this,
tool_bar_icon(kIconGoPrevious), B_TRANSLATE("Previous file"), false); tool_bar_icon(kIconGoPrevious), B_TRANSLATE("Previous file"), false);
fToolbar->AddAction(MSG_FILE_NEXT, this, tool_bar_icon(kIconGoNext), fToolBar->AddAction(MSG_FILE_NEXT, this, tool_bar_icon(kIconGoNext),
B_TRANSLATE("Next file"), false); B_TRANSLATE("Next file"), false);
BMessage* fullScreenSlideShow = new BMessage(MSG_SLIDE_SHOW); BMessage* fullScreenSlideShow = new BMessage(MSG_SLIDE_SHOW);
fullScreenSlideShow->AddBool("full screen", true); fullScreenSlideShow->AddBool("full screen", true);
fToolbar->AddAction(fullScreenSlideShow, this, fToolBar->AddAction(fullScreenSlideShow, this,
tool_bar_icon(kIconMediaMovieLibrary), B_TRANSLATE("Slide show"), tool_bar_icon(kIconMediaMovieLibrary), B_TRANSLATE("Slide show"),
false); false);
fToolbar->AddSeparator(); fToolBar->AddSeparator();
fToolbar->AddAction(MSG_SELECTION_MODE, this, fToolBar->AddAction(MSG_SELECTION_MODE, this,
tool_bar_icon(kIconDrawRectangularSelection), tool_bar_icon(kIconDrawRectangularSelection),
B_TRANSLATE("Selection mode"), false); B_TRANSLATE("Selection mode"), false);
fToolbar->AddSeparator(); fToolBar->AddSeparator();
fToolbar->AddAction(kMsgOriginalSize, this, fToolBar->AddAction(kMsgOriginalSize, this,
tool_bar_icon(kIconZoomOriginal), B_TRANSLATE("Original size"), true); tool_bar_icon(kIconZoomOriginal), B_TRANSLATE("Original size"), true);
fToolbar->AddAction(kMsgFitToWindow, this, fToolBar->AddAction(kMsgFitToWindow, this,
tool_bar_icon(kIconZoomFitBest), B_TRANSLATE("Fit to window"), false); tool_bar_icon(kIconZoomFitBest), B_TRANSLATE("Fit to window"), false);
fToolbar->AddAction(MSG_ZOOM_IN, this, tool_bar_icon(kIconZoomIn), fToolBar->AddAction(MSG_ZOOM_IN, this, tool_bar_icon(kIconZoomIn),
B_TRANSLATE("Zoom in"), false); B_TRANSLATE("Zoom in"), false);
fToolbar->AddAction(MSG_ZOOM_OUT, this, tool_bar_icon(kIconZoomOut), fToolBar->AddAction(MSG_ZOOM_OUT, this, tool_bar_icon(kIconZoomOut),
B_TRANSLATE("Zoom out"), false); B_TRANSLATE("Zoom out"), false);
fToolbar->AddGlue(); fToolBar->AddGlue();
fToolbar->AddAction(MSG_FULL_SCREEN, this, fToolBar->AddAction(MSG_FULL_SCREEN, this,
tool_bar_icon(kIconViewWindowed), B_TRANSLATE("Leave full screen"), tool_bar_icon(kIconViewWindowed), B_TRANSLATE("Leave full screen"),
false); false);
fToolbar->SetActionVisible(MSG_FULL_SCREEN, false); fToolBar->SetActionVisible(MSG_FULL_SCREEN, false);
fToolbar->ResizeTo(viewFrame.Width(), fToolbar->MinSize().height); fToolBar->ResizeTo(viewFrame.Width(), fToolBar->MinSize().height);
contentView->AddChild(fToolbar); contentView->AddChild(fToolBar);
if (fShowToolBar) if (fShowToolBar)
viewFrame.top = fToolbar->Frame().bottom + 1; viewFrame.top = fToolBar->Frame().bottom + 1;
else else
fToolbar->Hide(); fToolBar->Hide();
fToolBarVisible = fShowToolBar; fToolBarVisible = fShowToolBar;
@@ -256,7 +255,7 @@ ShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref,
contentView->AddChild(fVerticalScrollBar); contentView->AddChild(fVerticalScrollBar);
// Update minimum window size // Update minimum window size
float toolBarMinWidth = fToolbar->MinSize().width; float toolBarMinWidth = fToolBar->MinSize().width;
SetSizeLimits(std::max(menuBarMinWidth, toolBarMinWidth), 100000, 100, SetSizeLimits(std::max(menuBarMinWidth, toolBarMinWidth), 100000, 100,
100000); 100000);
@@ -362,7 +361,7 @@ ShowImageWindow::_BuildViewMenu(BMenu* menu, bool popupMenu)
_AddItemMenu(menu, B_TRANSLATE("Show tool bar"), kMsgToggleToolBar, _AddItemMenu(menu, B_TRANSLATE("Show tool bar"), kMsgToggleToolBar,
'B', 0, this); 'B', 0, this);
_MarkMenuItem(menu, kMsgToggleToolBar, _MarkMenuItem(menu, kMsgToggleToolBar,
!fToolbar->IsHidden(fToolbar)); !fToolBar->IsHidden(fToolBar));
} }
if (popupMenu) { if (popupMenu) {
@@ -553,7 +552,7 @@ ShowImageWindow::_ToggleMenuItem(uint32 what)
marked = !item->IsMarked(); marked = !item->IsMarked();
item->SetMarked(marked); item->SetMarked(marked);
} }
fToolbar->SetActionPressed(what, marked); fToolBar->SetActionPressed(what, marked);
return marked; return marked;
} }
@@ -564,7 +563,7 @@ ShowImageWindow::_EnableMenuItem(BMenu* menu, uint32 what, bool enable)
BMenuItem* item = menu->FindItem(what); BMenuItem* item = menu->FindItem(what);
if (item && item->IsEnabled() != enable) if (item && item->IsEnabled() != enable)
item->SetEnabled(enable); item->SetEnabled(enable);
fToolbar->SetActionEnabled(what, enable); fToolBar->SetActionEnabled(what, enable);
} }
@@ -574,7 +573,7 @@ ShowImageWindow::_MarkMenuItem(BMenu* menu, uint32 what, bool marked)
BMenuItem* item = menu->FindItem(what); BMenuItem* item = menu->FindItem(what);
if (item && item->IsMarked() != marked) if (item && item->IsMarked() != marked)
item->SetMarked(marked); item->SetMarked(marked);
fToolbar->SetActionPressed(what, marked); fToolBar->SetActionPressed(what, marked);
} }
@@ -893,13 +892,13 @@ ShowImageWindow::MessageReceived(BMessage* message)
if (item->IsMarked()) { if (item->IsMarked()) {
item->SetMarked(false); item->SetMarked(false);
_StopSlideShow(); _StopSlideShow();
fToolbar->SetActionPressed(MSG_SLIDE_SHOW, false); fToolBar->SetActionPressed(MSG_SLIDE_SHOW, false);
} else if (_ClosePrompt()) { } else if (_ClosePrompt()) {
item->SetMarked(true); item->SetMarked(true);
if (!fFullScreen && fullScreen) if (!fFullScreen && fullScreen)
_ToggleFullScreen(); _ToggleFullScreen();
_StartSlideShow(); _StartSlideShow();
fToolbar->SetActionPressed(MSG_SLIDE_SHOW, true); fToolBar->SetActionPressed(MSG_SLIDE_SHOW, true);
} }
break; break;
} }
@@ -911,7 +910,7 @@ ShowImageWindow::MessageReceived(BMessage* message)
item->SetMarked(false); item->SetMarked(false);
_StopSlideShow(); _StopSlideShow();
fToolbar->SetActionPressed(MSG_SLIDE_SHOW, false); fToolBar->SetActionPressed(MSG_SLIDE_SHOW, false);
break; break;
} }
@@ -1032,7 +1031,7 @@ ShowImageWindow::MessageReceived(BMessage* message)
{ {
float offset; float offset;
if (message->FindFloat("offset", &offset) == B_OK) { if (message->FindFloat("offset", &offset) == B_OK) {
fToolbar->MoveBy(0, offset); fToolBar->MoveBy(0, offset);
fScrollView->ResizeBy(0, -offset); fScrollView->ResizeBy(0, -offset);
fScrollView->MoveBy(0, offset); fScrollView->MoveBy(0, offset);
fVerticalScrollBar->ResizeBy(0, -offset); fVerticalScrollBar->ResizeBy(0, -offset);
@@ -1049,11 +1048,11 @@ ShowImageWindow::MessageReceived(BMessage* message)
if (message->FindFloat("offset", &offset) == B_OK if (message->FindFloat("offset", &offset) == B_OK
&& message->FindBool("show", &show) == B_OK) { && message->FindBool("show", &show) == B_OK) {
// Compensate rounding errors with the final placement // Compensate rounding errors with the final placement
fToolbar->MoveTo(fToolbar->Frame().left, offset); fToolBar->MoveTo(fToolBar->Frame().left, offset);
if (!show) if (!show)
fToolbar->Hide(); fToolBar->Hide();
BRect frame = fToolbar->Parent()->Bounds(); BRect frame = fToolBar->Parent()->Bounds();
frame.top = fToolbar->Frame().bottom + 1; frame.top = fToolBar->Frame().bottom + 1;
fScrollView->MoveTo(fScrollView->Frame().left, frame.top); fScrollView->MoveTo(fScrollView->Frame().left, frame.top);
fScrollView->ResizeTo(fScrollView->Bounds().Width(), fScrollView->ResizeTo(fScrollView->Bounds().Width(),
frame.Height() - B_H_SCROLL_BAR_HEIGHT + 1); frame.Height() - B_H_SCROLL_BAR_HEIGHT + 1);
@@ -1213,7 +1212,7 @@ ShowImageWindow::_ClosePrompt()
BAlert* alert = new BAlert(B_TRANSLATE("Close document"), prompt.String(), BAlert* alert = new BAlert(B_TRANSLATE("Close document"), prompt.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Close")); B_TRANSLATE("Cancel"), B_TRANSLATE("Close"));
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() == 0) { if (alert->Go() == 0) {
// Cancel // Cancel
return false; return false;
@@ -1286,7 +1285,7 @@ ShowImageWindow::_ToggleFullScreen()
SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE)); SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
} }
fToolbar->SetActionVisible(MSG_FULL_SCREEN, fFullScreen); fToolBar->SetActionVisible(MSG_FULL_SCREEN, fFullScreen);
_SetToolBarVisible(!fFullScreen && fShowToolBar); _SetToolBarVisible(!fFullScreen && fShowToolBar);
MoveTo(frame.left, frame.top); MoveTo(frame.left, frame.top);
@@ -1518,11 +1517,11 @@ ShowImageWindow::_SetToolBarVisible(bool visible, bool animate)
return; return;
fToolBarVisible = visible; fToolBarVisible = visible;
float diff = fToolbar->Bounds().Height() + 2; float diff = fToolBar->Bounds().Height() + 2;
if (!visible) if (!visible)
diff = -diff; diff = -diff;
else else
fToolbar->Show(); fToolBar->Show();
if (animate) { if (animate) {
// Slide the controls into view. We do this with messages in order // Slide the controls into view. We do this with messages in order
@@ -1543,9 +1542,9 @@ ShowImageWindow::_SetToolBarVisible(bool visible, bool animate)
fScrollView->MoveBy(0, diff); fScrollView->MoveBy(0, diff);
fVerticalScrollBar->ResizeBy(0, -diff); fVerticalScrollBar->ResizeBy(0, -diff);
fVerticalScrollBar->MoveBy(0, diff); fVerticalScrollBar->MoveBy(0, diff);
fToolbar->MoveBy(0, diff); fToolBar->MoveBy(0, diff);
if (!visible) if (!visible)
fToolbar->Hide(); fToolBar->Hide();
} }
} }
+2 -2
View File
@@ -11,7 +11,7 @@
#define SHOW_IMAGE_WINDOW_H #define SHOW_IMAGE_WINDOW_H
#include <Toolbar.h> #include <ToolBar.h>
#include <Window.h> #include <Window.h>
#include "ImageFileNavigator.h" #include "ImageFileNavigator.h"
@@ -114,7 +114,7 @@ private:
BMenu* fGoToPageMenu; BMenu* fGoToPageMenu;
BMenu* fSlideShowDelayMenu; BMenu* fSlideShowDelayMenu;
BMenu* fRatingMenu; BMenu* fRatingMenu;
BToolbar* fToolbar; BToolBar* fToolBar;
bool fToolBarVisible; bool fToolBarVisible;
BScrollView* fScrollView; BScrollView* fScrollView;
BScrollBar* fVerticalScrollBar; BScrollBar* fVerticalScrollBar;
+1 -1
View File
@@ -53,7 +53,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
StringForSize.cpp StringForSize.cpp
TextTable.cpp TextTable.cpp
Thread.cpp Thread.cpp
Toolbar.cpp ToolBar.cpp
Variant.cpp Variant.cpp
; ;
@@ -2,7 +2,7 @@
* Copyright 2011 Stephan Aßmus <superstippi@gmx.de> * Copyright 2011 Stephan Aßmus <superstippi@gmx.de>
* All rights reserved. Distributed under the terms of the MIT license. * All rights reserved. Distributed under the terms of the MIT license.
*/ */
#include "Toolbar.h" #include "ToolBar.h"
#include <Button.h> #include <Button.h>
#include <ControlLook.h> #include <ControlLook.h>
@@ -44,7 +44,7 @@ LockableButton::MouseDown(BPoint point)
} }
BToolbar::BToolbar(BRect frame, orientation ont) BToolBar::BToolBar(BRect frame, orientation ont)
: :
BGroupView(ont), BGroupView(ont),
fOrientation(ont) fOrientation(ont)
@@ -61,23 +61,23 @@ BToolbar::BToolbar(BRect frame, orientation ont)
} }
BToolbar::~BToolbar() BToolBar::~BToolBar()
{ {
} }
void void
BToolbar::Hide() BToolBar::Hide()
{ {
BView::Hide(); BView::Hide();
// TODO: This could be fixed in BView instead. Looking from the // TODO: This could be fixed in BView instead. Looking from the
// BButtons, they are not hidden though, only their parent is... // BButtons, they are not hidden though, only their parent is...
_HideToolTips(); _HideToolTips();
} }
void void
BToolbar::AddAction(uint32 command, BHandler* target, const BBitmap* icon, BToolBar::AddAction(uint32 command, BHandler* target, const BBitmap* icon,
const char* toolTipText, bool lockable) const char* toolTipText, bool lockable)
{ {
AddAction(new BMessage(command), target, icon, toolTipText, lockable); AddAction(new BMessage(command), target, icon, toolTipText, lockable);
@@ -85,7 +85,7 @@ BToolbar::AddAction(uint32 command, BHandler* target, const BBitmap* icon,
void void
BToolbar::AddAction(BMessage* message, BHandler* target, BToolBar::AddAction(BMessage* message, BHandler* target,
const BBitmap* icon, const char* toolTipText, bool lockable) const BBitmap* icon, const char* toolTipText, bool lockable)
{ {
@@ -104,7 +104,7 @@ BToolbar::AddAction(BMessage* message, BHandler* target,
void void
BToolbar::AddSeparator() BToolBar::AddSeparator()
{ {
orientation ont = (fOrientation == B_HORIZONTAL) ? orientation ont = (fOrientation == B_HORIZONTAL) ?
B_VERTICAL : B_HORIZONTAL; B_VERTICAL : B_HORIZONTAL;
@@ -113,14 +113,14 @@ BToolbar::AddSeparator()
void void
BToolbar::AddGlue() BToolBar::AddGlue()
{ {
GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
} }
void void
BToolbar::SetActionEnabled(uint32 command, bool enabled) BToolBar::SetActionEnabled(uint32 command, bool enabled)
{ {
if (BButton* button = _FindButton(command)) if (BButton* button = _FindButton(command))
button->SetEnabled(enabled); button->SetEnabled(enabled);
@@ -128,7 +128,7 @@ BToolbar::SetActionEnabled(uint32 command, bool enabled)
void void
BToolbar::SetActionPressed(uint32 command, bool pressed) BToolBar::SetActionPressed(uint32 command, bool pressed)
{ {
if (BButton* button = _FindButton(command)) if (BButton* button = _FindButton(command))
button->SetValue(pressed); button->SetValue(pressed);
@@ -136,7 +136,7 @@ BToolbar::SetActionPressed(uint32 command, bool pressed)
void void
BToolbar::SetActionVisible(uint32 command, bool visible) BToolBar::SetActionVisible(uint32 command, bool visible)
{ {
BButton* button = _FindButton(command); BButton* button = _FindButton(command);
if (button == NULL) if (button == NULL)
@@ -151,7 +151,7 @@ BToolbar::SetActionVisible(uint32 command, bool visible)
void void
BToolbar::Pulse() BToolBar::Pulse()
{ {
// TODO: Perhaps this could/should be addressed in BView instead. // TODO: Perhaps this could/should be addressed in BView instead.
if (IsHidden()) if (IsHidden())
@@ -160,7 +160,7 @@ BToolbar::Pulse()
void void
BToolbar::FrameResized(float width, float height) BToolBar::FrameResized(float width, float height)
{ {
// TODO: There seems to be a bug in app_server which does not // TODO: There seems to be a bug in app_server which does not
// correctly trigger invalidation of views which are shown, when // correctly trigger invalidation of views which are shown, when
@@ -170,14 +170,14 @@ BToolbar::FrameResized(float width, float height)
void void
BToolbar::_AddView(BView* view) BToolBar::_AddView(BView* view)
{ {
GroupLayout()->AddView(view); GroupLayout()->AddView(view);
} }
BButton* BButton*
BToolbar::_FindButton(uint32 command) const BToolBar::_FindButton(uint32 command) const
{ {
for (int32 i = 0; BView* view = ChildAt(i); i++) { for (int32 i = 0; BView* view = ChildAt(i); i++) {
BButton* button = dynamic_cast<BButton*>(view); BButton* button = dynamic_cast<BButton*>(view);
@@ -197,7 +197,7 @@ BToolbar::_FindButton(uint32 command) const
void void
BToolbar::_HideToolTips() const BToolBar::_HideToolTips() const
{ {
for (int32 i = 0; BView* view = ChildAt(i); i++) for (int32 i = 0; BView* view = ChildAt(i); i++)
view->HideToolTip(); view->HideToolTip();
+1 -1
View File
@@ -57,7 +57,7 @@ static const int32 kMaxHistory = 32;
BNavigator::BNavigator(const Model* model) BNavigator::BNavigator(const Model* model)
: :
BToolbar(BRect()), // FIXME in BToolbar: pointless BRect() BToolBar(BRect()), // FIXME in BToolbar: pointless BRect()
fBackHistory(8, true), fBackHistory(8, true),
fForwHistory(8, true) fForwHistory(8, true)
{ {
+2 -2
View File
@@ -35,7 +35,7 @@ All rights reserved.
#define _NAVIGATOR_H #define _NAVIGATOR_H
#include <Toolbar.h> #include <ToolBar.h>
#include "ContainerWindow.h" #include "ContainerWindow.h"
#include "Model.h" #include "Model.h"
@@ -63,7 +63,7 @@ enum NavigationAction
}; };
class BNavigator : public BToolbar { class BNavigator : public BToolBar {
public: public:
BNavigator(const Model* model); BNavigator(const Model* model);
~BNavigator(); ~BNavigator();