diff --git a/data/artwork/icons/Action_GoBack_3_Large b/data/artwork/icons/Action_GoBack_3_Large new file mode 100644 index 0000000000..c019d521f4 Binary files /dev/null and b/data/artwork/icons/Action_GoBack_3_Large differ diff --git a/data/artwork/icons/Action_GoForward_3_Large b/data/artwork/icons/Action_GoForward_3_Large new file mode 100644 index 0000000000..8c150e589b Binary files /dev/null and b/data/artwork/icons/Action_GoForward_3_Large differ diff --git a/data/artwork/icons/Action_GoUp_3_Large b/data/artwork/icons/Action_GoUp_3_Large new file mode 100644 index 0000000000..e21fabf152 Binary files /dev/null and b/data/artwork/icons/Action_GoUp_3_Large differ diff --git a/src/kits/tracker/ContainerWindow.cpp b/src/kits/tracker/ContainerWindow.cpp index 12b91a1e88..c9b3efe923 100644 --- a/src/kits/tracker/ContainerWindow.cpp +++ b/src/kits/tracker/ContainerWindow.cpp @@ -44,6 +44,8 @@ All rights reserved. #include #include #include +#include +#include #include #include #include @@ -116,14 +118,11 @@ namespace BPrivate { class DraggableContainerIcon : public BView { public: - DraggableContainerIcon(BRect rect, const char* name, - uint32 resizeMask); + DraggableContainerIcon(); - virtual void AttachedToWindow(); virtual void MouseDown(BPoint where); virtual void MouseUp(BPoint); virtual void MouseMoved(BPoint point, uint32, const BMessage*); - virtual void FrameMoved(BPoint); virtual void Draw(BRect updateRect); private: @@ -145,9 +144,6 @@ struct StaggerOneParams { }; -const int32 kContainerWidthMinLimit = 120; -const int32 kContainerWindowHeightLimit = 85; - const int32 kWindowStaggerBy = 17; @@ -311,25 +307,15 @@ AddMimeTypeString(BStringList& list, Model* model) // #pragma mark - DraggableContainerIcon -DraggableContainerIcon::DraggableContainerIcon(BRect rect, const char* name, - uint32 resizeMask) +DraggableContainerIcon::DraggableContainerIcon() : - BView(rect, name, resizeMask, B_WILL_DRAW | B_FRAME_EVENTS), + BView("DraggableContainerIcon", B_WILL_DRAW), fDragButton(0), fDragStarted(false) { } -void -DraggableContainerIcon::AttachedToWindow() -{ - SetViewColor(Parent()->ViewColor()); - FrameMoved(BPoint(0, 0)); - // this decides whether to hide the icon or not -} - - void DraggableContainerIcon::MouseDown(BPoint where) { @@ -456,49 +442,17 @@ DraggableContainerIcon::MouseMoved(BPoint where, uint32, const BMessage*) } -void -DraggableContainerIcon::FrameMoved(BPoint) -{ - BMenuBar* bar = dynamic_cast(Parent()); - ThrowOnAssert(bar != NULL); - - // TODO: ugly hack following: - // This is a trick to get the actual width of all menu items - // (BMenuBar may not have set the item coordinates yet...) - float width, height; - uint32 resizingMode = bar->ResizingMode(); - bar->SetResizingMode(B_FOLLOW_NONE); - bar->GetPreferredSize(&width, &height); - bar->SetResizingMode(resizingMode); - - //BMenuItem* item = bar->ItemAt(bar->CountItems() - 1); - //if (item == NULL) - // return; - - // BeOS shifts the coordinates for hidden views, so we cannot - // use them to decide if we should be visible or not... - - float gap = bar->Frame().Width() - 2 - width; //item->Frame().right; - - if (gap <= Bounds().Width() && !IsHidden()) - Hide(); - else if (gap > Bounds().Width() && IsHidden()) - Show(); -} - - void DraggableContainerIcon::Draw(BRect updateRect) { BContainerWindow* window = dynamic_cast(Window()); ThrowOnAssert(window != NULL); - if (be_control_look != NULL) { - BRect rect(Bounds()); - rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR); - be_control_look->DrawMenuBarBackground(this, rect, updateRect, base, - 0, 0); - } + BRect rect(Bounds()); + rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR); + be_control_look->DrawBorder(this, rect, updateRect, base, B_PLAIN_BORDER, + 0, BControlLook::B_BOTTOM_BORDER); + be_control_look->DrawMenuBarBackground(this, rect, updateRect, base); // Draw the icon, straddling the border #ifdef __HAIKU__ @@ -507,9 +461,10 @@ DraggableContainerIcon::Draw(BRect updateRect) #else SetDrawingMode(B_OP_OVER); #endif - float iconOffset = (Bounds().Width() - B_MINI_ICON) / 2; + float iconOffsetX = (Bounds().Width() - B_MINI_ICON) / 2; + float iconOffsetY = (Bounds().Height() - B_MINI_ICON) / 2; IconCache::sIconCache->Draw(window->TargetModel(), this, - BPoint(iconOffset, iconOffset), kNormalIcon, B_MINI_ICON, true); + BPoint(iconOffsetX, iconOffsetY), kNormalIcon, B_MINI_ICON, true); } @@ -518,10 +473,15 @@ DraggableContainerIcon::Draw(BRect updateRect) BContainerWindow::BContainerWindow(LockingList* list, uint32 containerWindowFlags, window_look look, window_feel feel, - uint32 flags, uint32 workspace) + uint32 flags, uint32 workspace, bool useLayouts, bool isDeskWindow) : BWindow(InitialWindowRect(feel), "TrackerWindow", look, feel, flags, workspace), + fMenuContainer(NULL), + fPoseContainer(NULL), + fBorderedView(NULL), + fVScrollBarContainer(NULL), + fCountContainer(NULL), fFileContextMenu(NULL), fWindowContextMenu(NULL), fDropContextMenu(NULL), @@ -534,6 +494,7 @@ BContainerWindow::BContainerWindow(LockingList* list, fOpenWithItem(NULL), fNavigationItem(NULL), fMenuBar(NULL), + fDraggableIcon(NULL), fNavigator(NULL), fPoseView(NULL), fWindowList(list), @@ -546,6 +507,7 @@ BContainerWindow::BContainerWindow(LockingList* list, fIsTrash(false), fInTrash(false), fIsPrinters(false), + fIsDesktop(isDeskWindow), fContainerWindowFlags(containerWindowFlags), fBackgroundImage(NULL), fSavedZoomRect(0, 0, -1, -1), @@ -553,7 +515,7 @@ BContainerWindow::BContainerWindow(LockingList* list, fDragMessage(NULL), fCachedTypesList(NULL), fStateNeedsSaving(false), - fSaveStateIsEnabled(dynamic_cast(this) == NULL), + fSaveStateIsEnabled(!fIsDesktop), fIsWatchingPath(false) { InitIconPreloader(); @@ -563,6 +525,29 @@ BContainerWindow::BContainerWindow(LockingList* list, list->AddItem(this); } + if (useLayouts) { + SetFlags(Flags() | B_AUTO_UPDATE_SIZE_LIMITS); + + fRootLayout = new BGroupLayout(B_VERTICAL, 0); + fRootLayout->SetInsets(0); + SetLayout(fRootLayout); + fRootLayout->Owner()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + if (!fIsDesktop) { + fMenuContainer = new BGroupView(B_HORIZONTAL, 0); + fRootLayout->AddView(fMenuContainer); + + fPoseContainer = new BGridView(0.0, 0.0); + fRootLayout->AddView(fPoseContainer); + + fBorderedView = new BorderedView; + fPoseContainer->GridLayout()->AddView(fBorderedView, 0, 1); + + fCountContainer = new BGroupView(B_HORIZONTAL, 0); + fPoseContainer->GridLayout()->AddView(fCountContainer, 0, 2); + } + } + AddCommonFilter(new BMessageFilter(B_MOUSE_DOWN, ActivateWindowFilter)); Run(); @@ -726,9 +711,9 @@ BContainerWindow::Quit() BPoseView* -BContainerWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) +BContainerWindow::NewPoseView(Model* model, uint32 viewMode) { - return new BPoseView(model, rect, viewMode); + return new BPoseView(model, viewMode); } @@ -749,31 +734,20 @@ void BContainerWindow::CreatePoseView(Model* model) { UpdateIfTrash(model); - BRect rect(Bounds()); + + fPoseView = NewPoseView(model, kListMode); + fBorderedView->GroupLayout()->AddView(fPoseView); + fBorderedView->EnableBorderHighlight(false); TrackerSettings settings; - if (settings.SingleWindowBrowse() && settings.ShowNavigator() - && model->IsDirectory()) { - rect.top += BNavigator::CalcNavigatorHeight() + 1; - } - - rect.right -= B_V_SCROLL_BAR_WIDTH; - rect.bottom -= B_H_SCROLL_BAR_HEIGHT; - fPoseView = NewPoseView(model, rect, kListMode); - AddChild(fPoseView); - if (settings.SingleWindowBrowse() && model->IsDirectory() && !fPoseView->IsFilePanel()) { - BRect rect(Bounds()); - rect.top = 0; - // The KeyMenuBar isn't attached yet, otherwise we'd use that - // to get the offset. - rect.bottom = BNavigator::CalcNavigatorHeight(); - fNavigator = new BNavigator(model, rect); - if (!settings.ShowNavigator()) + fNavigator = new BNavigator(model); + fPoseContainer->GridLayout()->AddView(fNavigator, 0, 0, 2); + if (!settings.ShowNavigator()) { fNavigator->Hide(); - - AddChild(fNavigator); + fBorderedView->GroupLayout()->SetInsets(1, 0, 1, 1); + } } SetPathWatchingEnabled(settings.ShowNavigator() @@ -885,7 +859,6 @@ BContainerWindow::RepopulateMenus() void BContainerWindow::Init(const BMessage* message) { - float y_delta; BEntry entry; ASSERT(fPoseView != NULL); @@ -909,30 +882,10 @@ BContainerWindow::Init(const BMessage* message) TrackerSettings settings; if (ShouldAddMenus()) { - // add menu bar, menus and resize poseview to fit - fMenuBar = new BMenuBar(BRect(0, 0, Bounds().Width() + 1, 1), - "MenuBar"); + fMenuBar = new BMenuBar("MenuBar"); fMenuBar->SetBorder(B_BORDER_FRAME); + fMenuContainer->GroupLayout()->AddView(fMenuBar); AddMenus(); - AddChild(fMenuBar); - - y_delta = KeyMenuBar()->Bounds().Height() + 1; - - float navigatorDelta = 0; - - if (Navigator() && settings.ShowNavigator()) { - Navigator()->MoveTo(BPoint(0, y_delta)); - navigatorDelta = BNavigator::CalcNavigatorHeight() + 1; - } - - fPoseView->MoveTo(BPoint(0, navigatorDelta + y_delta)); - fPoseView->ResizeBy(0, -(y_delta)); - if (fPoseView->VScrollBar()) { - fPoseView->VScrollBar()->MoveBy(0, - KeyMenuBar()->Bounds().Height()); - fPoseView->VScrollBar()->ResizeBy(0, - -(KeyMenuBar()->Bounds().Height())); - } if (!TargetModel()->IsRoot() && !IsTrash()) _AddFolderIcon(); @@ -999,7 +952,7 @@ BContainerWindow::Init(const BMessage* message) MarkAttributeMenu(fAttrMenu); CheckScreenIntersect(); - if (fBackgroundImage != NULL && dynamic_cast(this) == NULL + if (fBackgroundImage != NULL && !fIsDesktop && PoseView()->ViewMode() != kListMode) { fBackgroundImage->Show(PoseView(), current_workspace()); } @@ -1011,13 +964,44 @@ BContainerWindow::Init(const BMessage* message) SetFlags(Flags() & ~B_NO_WORKSPACE_ACTIVATION); } +void +BContainerWindow::InitLayout() +{ + BLayoutItem* item + = fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView()); + BSize minSize = item->MinSize(); + BSize maxSize = item->MaxSize(); + item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight)); + item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight)); + + item = fCountContainer->GroupLayout()->AddView(fPoseView->CountView()); + minSize = item->MinSize(); + maxSize = item->MaxSize(); + item->SetExplicitMinSize(BSize(kCountViewWidth, minSize.Height())); + item->SetExplicitMaxSize(BSize(kCountViewWidth, maxSize.Height())); + + // Eliminate the extra borders + fMenuContainer->GroupLayout()->SetInsets(0, 0, -1, 0); + fPoseContainer->GridLayout()->SetInsets(-1, 0, -1, -1); + fCountContainer->GroupLayout()->SetInsets(0, -1, 0, 0); + + if (fPoseView->VScrollBar() != NULL) { + fVScrollBarContainer = new BGroupView(B_VERTICAL, 0); + fVScrollBarContainer->GroupLayout()->AddView(fPoseView->VScrollBar()); + fVScrollBarContainer->GroupLayout()->SetInsets(-1, 0, 0, 1); + fPoseContainer->GridLayout()->AddView(fVScrollBarContainer, 1, 1); + } + if (fPoseView->HScrollBar() != NULL) { + BGroupView* hScrollBarContainer = new BGroupView(B_VERTICAL, 0); + hScrollBarContainer->GroupLayout()->AddView(fPoseView->HScrollBar()); + hScrollBarContainer->GroupLayout()->SetInsets(0, -1, 0, 0); + fCountContainer->GroupLayout()->AddView(hScrollBarContainer); + } +} void BContainerWindow::RestoreState() { - SetSizeLimits(kContainerWidthMinLimit, 10000, - kContainerWindowHeightLimit, 10000); - UpdateTitle(); WindowStateNodeOpener opener(this, false); @@ -1031,9 +1015,6 @@ BContainerWindow::RestoreState() void BContainerWindow::RestoreState(const BMessage &message) { - SetSizeLimits(kContainerWidthMinLimit, 10000, - kContainerWindowHeightLimit, 10000); - UpdateTitle(); RestoreWindowState(message); @@ -1046,13 +1027,15 @@ BContainerWindow::RestoreState(const BMessage &message) void BContainerWindow::RestoreStateCommon() { + if (!fIsDesktop) + InitLayout(); + if (BootedInSafeMode()) // don't pick up backgrounds in safe mode return; WindowStateNodeOpener opener(this, false); - bool isDesktop = dynamic_cast(this) != NULL; if (!TargetModel()->IsRoot() && opener.Node() != NULL) { // don't pick up background image for root disks // to do this, would have to have a unique attribute for the @@ -1060,16 +1043,16 @@ BContainerWindow::RestoreStateCommon() // for R4 this was not done to make things simpler // the default image will still work though fBackgroundImage = BackgroundImage::GetBackgroundImage( - opener.Node(), isDesktop); + opener.Node(), fIsDesktop); // look for background image info in the window's node } BNode defaultingNode; - if (fBackgroundImage == NULL && !isDesktop + if (fBackgroundImage == NULL && !fIsDesktop && DefaultStateSourceNode(kDefaultFolderTemplate, &defaultingNode)) { // look for background image info in the source for defaults fBackgroundImage = BackgroundImage::GetBackgroundImage(&defaultingNode, - isDesktop); + fIsDesktop); } } @@ -1101,21 +1084,20 @@ BContainerWindow::UpdateBackgroundImage() if (BootedInSafeMode()) return; - bool isDesktop = dynamic_cast(this) != NULL; WindowStateNodeOpener opener(this, false); if (!TargetModel()->IsRoot() && opener.Node() != NULL) { fBackgroundImage = BackgroundImage::Refresh(fBackgroundImage, - opener.Node(), isDesktop, PoseView()); + opener.Node(), fIsDesktop, PoseView()); } // look for background image info in the window's node BNode defaultingNode; - if (!fBackgroundImage && !isDesktop + if (!fBackgroundImage && !fIsDesktop && DefaultStateSourceNode(kDefaultFolderTemplate, &defaultingNode)) { // look for background image info in the source for defaults fBackgroundImage = BackgroundImage::Refresh(fBackgroundImage, - &defaultingNode, isDesktop, PoseView()); + &defaultingNode, fIsDesktop, PoseView()); } } @@ -1172,14 +1154,6 @@ BContainerWindow::WorkspacesChanged(uint32, uint32) void BContainerWindow::ViewModeChanged(uint32 oldMode, uint32 newMode) { - if (fMenuBar != NULL) { - // make sure the draggable icon hides if it doesn't - // have space left anymore - BView* view = fMenuBar->FindView("ThisContainer"); - if (view != NULL) - view->FrameMoved(view->Frame().LeftTop()); - } - if (fBackgroundImage == NULL) return; @@ -1341,13 +1315,6 @@ BContainerWindow::ShouldAddScrollBars() const } -bool -BContainerWindow::ShouldAddCountView() const -{ - return true; -} - - Model* BContainerWindow::TargetModel() const { @@ -1589,20 +1556,17 @@ BContainerWindow::MessageReceived(BMessage* message) // Update draggable folder icon if (fMenuBar != NULL) { - BView* view = fMenuBar->FindView("ThisContainer"); if (!TargetModel()->IsRoot() && !IsTrash()) { // Folder icon should be visible, but in single // window navigation, it might not be. - if (view != NULL) { + if (fDraggableIcon != NULL) { IconCache::sIconCache->IconChanged( TargetModel()); - view->Invalidate(); + fDraggableIcon->Invalidate(); } else _AddFolderIcon(); - } else if (view != NULL) { - view->RemoveSelf(); - fMenuBar->Invalidate(); - } + } else if (fDraggableIcon != NULL) + fDraggableIcon->RemoveSelf(); } // Update window title @@ -1664,21 +1628,19 @@ BContainerWindow::MessageReceived(BMessage* message) && TargetModel()->IsDirectory() && !PoseView()->IsFilePanel() && !PoseView()->IsDesktopWindow()) { - BRect rect(Bounds()); - rect.top = KeyMenuBar()->Bounds().Height() + 1; - rect.bottom = rect.top - + BNavigator::CalcNavigatorHeight(); - fNavigator = new BNavigator(TargetModel(), rect); + fNavigator = new BNavigator(TargetModel()); + fPoseContainer->GridLayout()->AddView(fNavigator, + 0, 0, 2); fNavigator->Hide(); - AddChild(fNavigator); + fBorderedView->GroupLayout()->SetInsets(1, 0, + 1, 1); SetPathWatchingEnabled(settings.ShowNavigator() || settings.ShowFullPathInTitleBar()); } if (!settings.SingleWindowBrowse() - && dynamic_cast(this) == NULL - && TargetModel()->IsDesktop()) { - // close the "Desktop" window, but not the Desktop + && !fIsDesktop && TargetModel()->IsDesktop()) { + // Close the "Desktop" window, but not the Desktop this->Quit(); } @@ -2800,7 +2762,7 @@ BContainerWindow::ShowContextMenu(BPoint loc, const entry_ref* ref, BView*) return; // Repopulate desktop menu if IsDesktop - if (dynamic_cast(this)) + if (fIsDesktop) RepopulateMenus(); MenusEnded(); @@ -3310,21 +3272,25 @@ BContainerWindow::_UpdateSelectionMIMEInfo() void BContainerWindow::_AddFolderIcon() { - if (fMenuBar == NULL) + if (fMenuBar == NULL) { + // We don't want to add the icon if there's no menubar return; + } + float iconSize = fMenuBar->Bounds().Height() - 2; if (iconSize < 16) iconSize = 16; - float iconPosY = 1 + (fMenuBar->Bounds().Height() - 2 - - iconSize) / 2; - BView* icon = new(std::nothrow) DraggableContainerIcon( - BRect(Bounds().Width() - 4 - iconSize + 1, iconPosY, - Bounds().Width() - 4, iconPosY + iconSize - 1), "ThisContainer", - B_FOLLOW_RIGHT); - if (icon != NULL) - fMenuBar->AddChild(icon); -} + fDraggableIcon = new(std::nothrow) + DraggableContainerIcon; + + if (fDraggableIcon != NULL) { + BLayoutItem* item = + fMenuContainer->GroupLayout()->AddView(fDraggableIcon); + item->SetExplicitMinSize(BSize(iconSize + 5, iconSize)); + item->SetExplicitMaxSize(BSize(iconSize + 5, item->MaxSize().Height())); + } +} BMenuItem* @@ -4116,46 +4082,26 @@ BContainerWindow::ShowNavigator(bool show) return; if (Navigator() == NULL) { - BRect rect(Bounds()); - rect.top = KeyMenuBar()->Bounds().Height() + 1; - rect.bottom = rect.top + BNavigator::CalcNavigatorHeight(); - fNavigator = new BNavigator(TargetModel(), rect); - AddChild(fNavigator); + fNavigator = new BNavigator(TargetModel()); + fPoseContainer->GridLayout()->AddView(fNavigator, 0, 0, 2); } - if (Navigator()->IsHidden()) { - if (Navigator()->Bounds().top == 0) - Navigator()->MoveTo(0, KeyMenuBar()->Bounds().Height() + 1); - // This is if the navigator was created with a .top = 0. + if (Navigator()->IsHidden()) Navigator()->Show(); - } - float displacement = Navigator()->Frame().Height() + 1; - - PoseView()->MoveBy(0, displacement); - PoseView()->ResizeBy(0, -displacement); - - if (PoseView()->VScrollBar()) { - PoseView()->VScrollBar()->MoveBy(0, displacement); - PoseView()->VScrollBar()->ResizeBy(0, -displacement); + if (PoseView()->VScrollBar()) PoseView()->UpdateScrollRange(); - } + + fBorderedView->GroupLayout()->SetInsets(1); } else { if (!Navigator() || Navigator()->IsHidden()) return; - float displacement = Navigator()->Frame().Height() + 1; - - PoseView()->ResizeBy(0, displacement); - PoseView()->MoveBy(0, -displacement); - - if (PoseView()->VScrollBar()) { - PoseView()->VScrollBar()->ResizeBy(0, displacement); - PoseView()->VScrollBar()->MoveBy(0, -displacement); + if (PoseView()->VScrollBar()) PoseView()->UpdateScrollRange(); - } fNavigator->Hide(); + fBorderedView->GroupLayout()->SetInsets(1, 0, 1, 1); } } @@ -4398,119 +4344,65 @@ WindowStateNodeOpener::Node() const } -// #pragma mark - BackgroundView +// #pragma mark - BorderedView -BackgroundView::BackgroundView(BRect frame) +BorderedView::BorderedView() : - BView(frame, "", B_FOLLOW_ALL, - B_FRAME_EVENTS | B_WILL_DRAW | B_PULSE_NEEDED) + BGroupView(B_VERTICAL, 0), + fEnableBorderHighlight(true) { + GroupLayout()->SetInsets(1); + SetViewColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), + B_DARKEN_2_TINT)); } void -BackgroundView::AttachedToWindow() +BorderedView::WindowActivated(bool active) { - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + // Update border color + PoseViewFocused(active); +} + + +void BorderedView::EnableBorderHighlight(bool enable) +{ + fEnableBorderHighlight = enable; + PoseViewFocused(false); } void -BackgroundView::FrameResized(float, float) -{ - Invalidate(); -} - - -void -BackgroundView::PoseViewFocused(bool focused) -{ - Invalidate(); - - BContainerWindow* window = dynamic_cast(Window()); - if (window == NULL) - return; - - BScrollBar* hScrollBar = window->PoseView()->HScrollBar(); - if (hScrollBar != NULL) - hScrollBar->SetBorderHighlighted(focused); - - BScrollBar* vScrollBar = window->PoseView()->VScrollBar(); - if (vScrollBar != NULL) - vScrollBar->SetBorderHighlighted(focused); - - BCountView* countView = window->PoseView()->CountView(); - if (countView != NULL) - countView->SetBorderHighlighted(focused); -} - - -void -BackgroundView::WindowActivated(bool) -{ - Invalidate(); -} - - -void -BackgroundView::Draw(BRect updateRect) +BorderedView::PoseViewFocused(bool focused) { BContainerWindow* window = dynamic_cast(Window()); if (window == NULL) return; - BPoseView* poseView = window->PoseView(); - BRect frame(poseView->Frame()); - frame.InsetBy(-1, -1); - frame.top -= kTitleViewHeight; - frame.bottom += B_H_SCROLL_BAR_HEIGHT; - frame.right += B_V_SCROLL_BAR_WIDTH; + rgb_color base; + if (focused && window->IsActive() && fEnableBorderHighlight) { + base = ui_color(B_KEYBOARD_NAVIGATION_COLOR); - if (be_control_look != NULL) { - uint32 flags = 0; - if (window->IsActive() && window->PoseView()->IsFocus()) - flags |= BControlLook::B_FOCUSED; + BScrollBar* hScrollBar = window->PoseView()->HScrollBar(); + if (hScrollBar != NULL) + hScrollBar->SetBorderHighlighted(focused); - frame.top--; - frame.InsetBy(-1, -1); - BRect rect(frame); - rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); - - BScrollBar* hScrollBar = poseView->HScrollBar(); - BScrollBar* vScrollBar = poseView->VScrollBar(); - - BRect verticalScrollBarFrame(0, 0, -1, -1); - if (vScrollBar) - verticalScrollBarFrame = vScrollBar->Frame(); - BRect horizontalScrollBarFrame(0, 0, -1, -1); - if (hScrollBar) { - horizontalScrollBarFrame = hScrollBar->Frame(); - // CountView extends horizontal scroll bar frame: - horizontalScrollBarFrame.left = frame.left + 1; - } - - be_control_look->DrawScrollViewFrame(this, rect, updateRect, - verticalScrollBarFrame, horizontalScrollBarFrame, base, - B_FANCY_BORDER, flags); - - return; + BScrollBar* vScrollBar = window->PoseView()->VScrollBar(); + if (vScrollBar != NULL) + vScrollBar->SetBorderHighlighted(focused); + } else { + base = ui_color(B_PANEL_BACKGROUND_COLOR); + base = tint_color(base, B_DARKEN_2_TINT); } + SetViewColor(base); - SetHighColor(100, 100, 100); - StrokeRect(frame); - - // draw the pose view focus - if (window->IsActive() && window->PoseView()->IsFocus()) { - frame.InsetBy(-2, -2); - SetHighColor(keyboard_navigation_color()); - StrokeRect(frame); - } + Invalidate(); } void -BackgroundView::Pulse() +BorderedView::Pulse() { BContainerWindow* window = dynamic_cast(Window()); if (window != NULL) diff --git a/src/kits/tracker/ContainerWindow.h b/src/kits/tracker/ContainerWindow.h index a6c66c6c58..4b48b857f6 100644 --- a/src/kits/tracker/ContainerWindow.h +++ b/src/kits/tracker/ContainerWindow.h @@ -35,6 +35,7 @@ All rights reserved. #define _CONTAINER_WINDOW_H +#include #include #include @@ -44,6 +45,9 @@ All rights reserved. #include "TaskLoop.h" +class BGridView; +class BGroupLayout; +class BGroupView; class BPopUpMenu; class BMenuBar; @@ -51,11 +55,13 @@ namespace BPrivate { class BNavigator; class BPoseView; +class DraggableContainerIcon; class ModelMenuItem; class AttributeStreamNode; class BackgroundImage; class Model; class ModelNodeLazyOpener; +class BorderedView; class SelectionWindow; @@ -92,13 +98,14 @@ public: uint32 containerWindowFlags, window_look look = B_DOCUMENT_WINDOW_LOOK, window_feel feel = B_NORMAL_WINDOW_FEEL, - uint32 flags = B_WILL_ACCEPT_FIRST_CLICK - | B_NO_WORKSPACE_ACTIVATION, - uint32 workspace = B_CURRENT_WORKSPACE); + uint32 flags = B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION, + uint32 workspace = B_CURRENT_WORKSPACE, bool useLayouts = true, + bool isDeskWindow = false); virtual ~BContainerWindow(); virtual void Init(const BMessage* message = NULL); + virtual void InitLayout(); static BRect InitialWindowRect(window_feel); @@ -123,7 +130,6 @@ public: // virtuals that control setup of window virtual bool ShouldAddMenus() const; virtual bool ShouldAddScrollBars() const; - virtual bool ShouldAddCountView() const; virtual void CheckScreenIntersect(); @@ -206,7 +212,7 @@ public: bool IsPathWatchingEnabled(void) const; protected: - virtual BPoseView* NewPoseView(Model*, BRect, uint32); + virtual BPoseView* NewPoseView(Model*, uint32); // instantiate a different flavor of BPoseView for different // ContainerWindows @@ -274,6 +280,13 @@ protected: BObjectList*, void*, BStringList&); void LoadAddOn(BMessage*); + BGroupLayout* fRootLayout; + BGroupView* fMenuContainer; + BGridView* fPoseContainer; + BorderedView* fBorderedView; + BGroupView* fVScrollBarContainer; + BGroupView* fCountContainer; + BPopUpMenu* fFileContextMenu; BPopUpMenu* fWindowContextMenu; BPopUpMenu* fDropContextMenu; @@ -286,6 +299,7 @@ protected: BMenuItem* fOpenWithItem; ModelMenuItem* fNavigationItem; BMenuBar* fMenuBar; + DraggableContainerIcon* fDraggableIcon; BNavigator* fNavigator; BPoseView* fPoseView; LockingList* fWindowList; @@ -301,6 +315,7 @@ protected: bool fIsTrash; bool fInTrash; bool fIsPrinters; + bool fIsDesktop; uint32 fContainerWindowFlags; BackgroundImage* fBackgroundImage; @@ -357,22 +372,22 @@ private: }; -class BackgroundView : public BView { - // background view placed in a BContainerWindow, under the pose view +class BorderedView : public BGroupView { public: - BackgroundView(BRect); - virtual void AttachedToWindow(); - virtual void FrameResized(float, float); - virtual void Draw(BRect); + BorderedView(); void PoseViewFocused(bool); virtual void Pulse(); + void EnableBorderHighlight(bool); + protected: virtual void WindowActivated(bool); private: - typedef BView _inherited; + bool fEnableBorderHighlight; + + typedef BGroupView _inherited; }; diff --git a/src/kits/tracker/CountView.cpp b/src/kits/tracker/CountView.cpp index a1d3c7c813..8943200832 100644 --- a/src/kits/tracker/CountView.cpp +++ b/src/kits/tracker/CountView.cpp @@ -61,14 +61,12 @@ const bigtime_t kBarberPoleDelay = 500000; // #pragma mark - BCountView -BCountView::BCountView(BRect bounds, BPoseView* view) +BCountView::BCountView(BPoseView* view) : - BView(bounds, "CountVw", B_FOLLOW_LEFT + B_FOLLOW_BOTTOM, - B_PULSE_NEEDED | B_WILL_DRAW), + BView("CountVw", B_PULSE_NEEDED | B_WILL_DRAW), fLastCount(-1), fPoseView(view), fShowingBarberPole(false), - fBorderHighlighted(false), fBarberPoleMap(NULL), fLastBarberPoleOffset(5), fStartSpinningAfter(0), @@ -113,17 +111,6 @@ BCountView::Pulse() } -void -BCountView::WindowActivated(bool active) -{ - if (fBorderHighlighted) { - BRect dirty(Bounds()); - dirty.bottom = dirty.top; - Invalidate(dirty); - } -} - - void BCountView::EndBarberPole() { @@ -172,7 +159,7 @@ BRect BCountView::TextInvalRect() const { BRect result = Bounds(); - result.InsetBy(4, 2); + result.InsetBy(4, 3); // if the barber pole is not present, use its space for text if (fShowingBarberPole) @@ -186,7 +173,7 @@ BRect BCountView::TextAndBarberPoleRect() const { BRect result = Bounds(); - result.InsetBy(4, 2); + result.InsetBy(4, 3); return result; } @@ -211,17 +198,11 @@ BCountView::Draw(BRect updateRect) { BRect bounds(Bounds()); - if (be_control_look != NULL) { - rgb_color base = ViewColor(); - if (fBorderHighlighted && Window()->IsActive()) - SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR)); - else - SetHighColor(tint_color(base, B_DARKEN_2_TINT)); - StrokeLine(bounds.LeftTop(), bounds.RightTop()); - bounds.top++; - be_control_look->DrawMenuBarBackground(this, bounds, updateRect, - ViewColor()); - } + be_control_look->DrawBorder(this, bounds, updateRect, ViewColor(), + B_PLAIN_BORDER, 0, + BControlLook::B_BOTTOM_BORDER | BControlLook::B_LEFT_BORDER); + be_control_look->DrawMenuBarBackground(this, bounds, updateRect, + ViewColor()); BString itemString; if (IsTypingAhead()) @@ -408,16 +389,3 @@ BCountView::IsFiltering() const { return fFilterString.Length() > 0; } - - -void -BCountView::SetBorderHighlighted(bool highlighted) -{ - if (fBorderHighlighted == highlighted) - return; - - fBorderHighlighted = highlighted; - BRect dirty(Bounds()); - dirty.bottom = dirty.top; - Invalidate(dirty); -} diff --git a/src/kits/tracker/CountView.h b/src/kits/tracker/CountView.h index 52ad97ee2d..625358e327 100644 --- a/src/kits/tracker/CountView.h +++ b/src/kits/tracker/CountView.h @@ -43,18 +43,20 @@ namespace BPrivate { class BPoseView; +const int32 kCountViewWidth = 76; + + class BCountView : public BView { // displays the item count and a barber pole while the view is updating public: - BCountView(BRect, BPoseView*); + BCountView(BPoseView*); ~BCountView(); virtual void Draw(BRect); virtual void MouseDown(BPoint); virtual void AttachedToWindow(); virtual void Pulse(); - virtual void WindowActivated(bool active); void CheckCount(); void StartBarberPole(); @@ -70,8 +72,6 @@ public: const char* Filter() const; bool IsFiltering() const; - void SetBorderHighlighted(bool highlighted); - private: BRect BarberPoleInnerRect() const; BRect BarberPoleOuterRect() const; @@ -82,7 +82,6 @@ private: int32 fLastCount; BPoseView* fPoseView; bool fShowingBarberPole : 1; - bool fBorderHighlighted : 1; BBitmap* fBarberPoleMap; float fLastBarberPoleOffset; bigtime_t fStartSpinningAfter; diff --git a/src/kits/tracker/DeskWindow.cpp b/src/kits/tracker/DeskWindow.cpp index a0991c162b..c22e1809a3 100644 --- a/src/kits/tracker/DeskWindow.cpp +++ b/src/kits/tracker/DeskWindow.cpp @@ -191,7 +191,8 @@ BDeskWindow::BDeskWindow(LockingList* windowList) BContainerWindow(windowList, 0, kPrivateDesktopWindowLook, kPrivateDesktopWindowFeel, B_NOT_MOVABLE | B_WILL_ACCEPT_FIRST_CLICK | B_NOT_ZOOMABLE | B_NOT_CLOSABLE | B_NOT_MINIMIZABLE - | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES), + | B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES, + false, true), fDeskShelf(NULL), fTrashContextMenu(NULL), fNodeRef(NULL), @@ -240,6 +241,12 @@ BDeskWindow::Init(const BMessage*) PoseView()->SetShowHideSelection(false); ResizeTo(fOldFrame.Width(), fOldFrame.Height()); + InitKeyIndices(); + InitAddonsList(false); + ApplyShortcutPreferences(false); + + _inherited::Init(); + entry_ref ref; BPath path; if (!BootedInSafeMode() && FSFindTrackerSettingsDir(&path) == B_OK) { @@ -252,11 +259,6 @@ BDeskWindow::Init(const BMessage*) if (fDeskShelf != NULL) fDeskShelf->SetDisplaysZombies(true); } - InitKeyIndices(); - InitAddonsList(false); - ApplyShortcutPreferences(false); - - _inherited::Init(); } @@ -402,16 +404,16 @@ BDeskWindow::Quit() BPoseView* -BDeskWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) +BDeskWindow::NewPoseView(Model* model, uint32 viewMode) { - return new DesktopPoseView(model, rect, viewMode); + return new DesktopPoseView(model, viewMode); } void BDeskWindow::CreatePoseView(Model* model) { - fPoseView = NewPoseView(model, Bounds(), kIconMode); + fPoseView = NewPoseView(model, kIconMode); fPoseView->SetIconMapping(false); fPoseView->SetEnsurePosesVisible(true); fPoseView->SetAutoScroll(false); @@ -431,6 +433,8 @@ BDeskWindow::CreatePoseView(Model* model) fPoseView->SetViewColor(desktopColor); fPoseView->SetLowColor(desktopColor); + fPoseView->SetResizingMode(B_FOLLOW_ALL); + fPoseView->ResizeTo(Bounds().Size()); AddChild(fPoseView); PoseView()->StartSettingsWatch(); diff --git a/src/kits/tracker/DeskWindow.h b/src/kits/tracker/DeskWindow.h index 8ece04cee4..e1f2141ae4 100644 --- a/src/kits/tracker/DeskWindow.h +++ b/src/kits/tracker/DeskWindow.h @@ -72,7 +72,7 @@ public: protected: virtual void AddWindowContextMenus(BMenu*); - virtual BPoseView* NewPoseView(Model*, BRect, uint32); + virtual BPoseView* NewPoseView(Model*, uint32); virtual void WorkspaceActivated(int32, bool); virtual void MessageReceived(BMessage*); diff --git a/src/kits/tracker/DesktopPoseView.cpp b/src/kits/tracker/DesktopPoseView.cpp index 569c36ccf2..dfdb1276df 100644 --- a/src/kits/tracker/DesktopPoseView.cpp +++ b/src/kits/tracker/DesktopPoseView.cpp @@ -56,10 +56,9 @@ All rights reserved. // #pragma mark - DesktopPoseView -DesktopPoseView::DesktopPoseView(Model* model, BRect frame, uint32 viewMode, - uint32 resizeMask) +DesktopPoseView::DesktopPoseView(Model* model, uint32 viewMode) : - BPoseView(model, frame, viewMode, resizeMask) + BPoseView(model, viewMode) { SetFlags(Flags() | B_DRAW_ON_CHILDREN); } diff --git a/src/kits/tracker/DesktopPoseView.h b/src/kits/tracker/DesktopPoseView.h index f3debda33d..bbc19dba57 100644 --- a/src/kits/tracker/DesktopPoseView.h +++ b/src/kits/tracker/DesktopPoseView.h @@ -47,8 +47,7 @@ namespace BPrivate { class DesktopPoseView : public BPoseView { // overrides BPoseView to add desktop-view specific code public: - DesktopPoseView(Model*, BRect, uint32 viewMode, - uint32 resizeMask = B_FOLLOW_ALL); + DesktopPoseView(Model*, uint32 viewMode); static EntryListBase* InitDesktopDirentIterator(BPoseView*, const entry_ref*); diff --git a/src/kits/tracker/FilePanelPriv.cpp b/src/kits/tracker/FilePanelPriv.cpp index d6e8421991..65937d8fa9 100644 --- a/src/kits/tracker/FilePanelPriv.cpp +++ b/src/kits/tracker/FilePanelPriv.cpp @@ -66,6 +66,7 @@ All rights reserved. #include "AttributeStream.h" #include "AutoLock.h" #include "Commands.h" +#include "CountView.h" #include "DesktopPoseView.h" #include "DirMenu.h" #include "FavoritesMenu.h" @@ -159,7 +160,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger* target, window_look look, window_feel feel, bool hideWhenDone) : BContainerWindow(0, containerWindowFlags, look, feel, 0, - B_CURRENT_WORKSPACE), + B_CURRENT_WORKSPACE, false), fDirMenu(NULL), fDirMenuField(NULL), fTextControl(NULL), @@ -231,6 +232,7 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger* target, fTaskLoop = new PiggybackTaskLoop; AutoLock lock(this); + fBorderedView = new BorderedView; CreatePoseView(model); fPoseView->SetRefFilter(filter); if (!fIsSavePanel) @@ -641,9 +643,9 @@ TFilePanel::GetNextEntryRef(entry_ref* ref) BPoseView* -TFilePanel::NewPoseView(Model* model, BRect rect, uint32) +TFilePanel::NewPoseView(Model* model, uint32) { - return new BFilePanelPoseView(model, rect); + return new BFilePanelPoseView(model); } @@ -651,7 +653,9 @@ void TFilePanel::Init(const BMessage*) { BRect windRect(Bounds()); - AddChild(fBackView = new BackgroundView(windRect)); + fBackView = new BView(Bounds(), "View", B_FOLLOW_ALL, 0); + fBackView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + AddChild(fBackView); // add poseview menu bar fMenuBar = new BMenuBar(BRect(0, 0, windRect.Width(), 1), "MenuBar"); @@ -763,31 +767,47 @@ TFilePanel::Init(const BMessage*) } else fButtonText.SetTo(B_TRANSLATE("Open")); + // Add PoseView + fBorderedView->SetName("PoseView"); + fBorderedView->SetResizingMode(B_FOLLOW_ALL); + fBorderedView->EnableBorderHighlight(true); + rect = windRect; rect.OffsetTo(10, fDirMenuField->Frame().bottom + 10); rect.bottom = windRect.bottom - 60; rect.right -= B_V_SCROLL_BAR_WIDTH + 20; + fBorderedView->MoveTo(rect.LeftTop()); + fBorderedView->ResizeTo(rect.Width(), rect.Height()); - // re-parent the poseview to our backview - // ToDo: - // This is terrible, fix it up - PoseView()->RemoveSelf(); - if (fIsSavePanel) - fBackView->AddChild(PoseView(), fTextControl); - else - fBackView->AddChild(PoseView()); - - PoseView()->MoveTo(rect.LeftTop()); - PoseView()->ResizeTo(rect.Width(), rect.Height()); PoseView()->AddScrollBars(); PoseView()->SetDragEnabled(false); PoseView()->SetDropEnabled(false); PoseView()->SetSelectionHandler(this); PoseView()->SetSelectionChangedHook(true); PoseView()->DisableSaveLocation(); - PoseView()->VScrollBar()->MoveBy(0, -1); - PoseView()->VScrollBar()->ResizeBy(0, 1); + // horizontal + rect = fBorderedView->Frame(); + rect.top = rect.bottom; + rect.bottom = rect.top + (float)B_H_SCROLL_BAR_HEIGHT; + PoseView()->HScrollBar()->MoveTo(rect.LeftTop()); + PoseView()->HScrollBar()->ResizeTo(rect.Size()); + PoseView()->HScrollBar()->SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM); + fBackView->AddChild(PoseView()->HScrollBar()); + + // vertical + rect = fBorderedView->Frame(); + rect.left = rect.right; + rect.right = rect.left + (float)B_V_SCROLL_BAR_WIDTH; + PoseView()->VScrollBar()->MoveTo(rect.LeftTop()); + PoseView()->VScrollBar()->ResizeTo(rect.Size()); + PoseView()->VScrollBar()->SetResizingMode(B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT); + fBackView->AddChild(PoseView()->VScrollBar()); + + if (fIsSavePanel) + fBackView->AddChild(fBorderedView, fTextControl); + else + fBackView->AddChild(fBorderedView); AddShortcut('W', B_COMMAND_KEY, new BMessage(kCancelButton)); AddShortcut('H', B_COMMAND_KEY, new BMessage(kSwitchToHome)); @@ -877,6 +897,35 @@ TFilePanel::RestoreState() RestoreWindowState(NULL); PoseView()->Init(NULL); } + + // Finish UI creation now that the PoseView is initialized + BLayoutItem* item + = fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView()); + BSize minSize = item->MinSize(); + BSize maxSize = item->MaxSize(); + item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight)); + item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight)); + + BRect rect(fBorderedView->Frame()); + rect.right = rect.left + kCountViewWidth; + rect.top = rect.bottom + 1; + rect.bottom = rect.top + PoseView()->HScrollBar()->Bounds().Height() - 1; + PoseView()->CountView()->MoveTo(rect.LeftTop()); + PoseView()->CountView()->ResizeTo(rect.Size()); + PoseView()->CountView()->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); + fBackView->AddChild(PoseView()->CountView(), fBorderedView); + + PoseView()->HScrollBar()->MoveBy(kCountViewWidth + 1, 0); + PoseView()->HScrollBar()->ResizeBy(-kCountViewWidth - 1, 0); + + // The Be Book states that the BTitleView will have a name of "TitleView", + // and so some apps will try to grab it by that name and move it around. + // They don't need to, because resizing "PoseView" (really the BorderedView) + // will resize the BTitleView as well. So just create a dummy view here + // so that they don't get NULL when trying to find the view. + BView* dummyTitleView = new BView(BRect(), "TitleView", B_FOLLOW_NONE, 0); + fBackView->AddChild(dummyTitleView); + dummyTitleView->Hide(); } @@ -1650,9 +1699,9 @@ TFilePanel::WindowActivated(bool active) // #pragma mark - -BFilePanelPoseView::BFilePanelPoseView(Model* model, BRect frame, - uint32 resizeMask) - : BPoseView(model, frame, kListMode, resizeMask), +BFilePanelPoseView::BFilePanelPoseView(Model* model) + : + BPoseView(model, kListMode), fIsDesktop(model->IsDesktop()) { } diff --git a/src/kits/tracker/FilePanelPriv.h b/src/kits/tracker/FilePanelPriv.h index fc2447085d..22acfd7a08 100644 --- a/src/kits/tracker/FilePanelPriv.h +++ b/src/kits/tracker/FilePanelPriv.h @@ -50,7 +50,7 @@ class BMenuField; namespace BPrivate { -class BackgroundView; +class BorderedView; class BDirMenu; class AttributeStreamNode; class BFilePanelPoseView; @@ -103,7 +103,7 @@ public: bool TrackingMenu() const; protected: - BPoseView* NewPoseView(Model* model, BRect rect, uint32 viewMode); + BPoseView* NewPoseView(Model* model, uint32); virtual void Init(const BMessage* message = NULL); virtual void SaveState(bool hide = true); virtual void SaveState(BMessage &) const; @@ -130,8 +130,6 @@ protected: const char* button2 = NULL, const char* button3 = NULL); private: - friend class BackgroundView; - bool SwitchDirToDesktopIfNeeded(entry_ref &ref); bool CanOpenParent() const; void SwitchDirMenuTo(const entry_ref* ref); @@ -142,7 +140,7 @@ private: bool fIsSavePanel; uint32 fNodeFlavors; - BackgroundView* fBackView; + BView* fBackView; BDirMenu* fDirMenu; BMenuField* fDirMenuField; BTextControl* fTextControl; @@ -160,7 +158,7 @@ private: class BFilePanelPoseView : public BPoseView { public: - BFilePanelPoseView(Model*, BRect, uint32 resizeMask = B_FOLLOW_ALL); + BFilePanelPoseView(Model*); virtual bool IsFilePanel() const; virtual bool FSNotification(const BMessage*); diff --git a/src/kits/tracker/Navigator.cpp b/src/kits/tracker/Navigator.cpp index 74efc5bffc..59628f9c35 100644 --- a/src/kits/tracker/Navigator.cpp +++ b/src/kits/tracker/Navigator.cpp @@ -35,7 +35,6 @@ All rights reserved. #include "Navigator.h" -#include #include #include @@ -52,139 +51,24 @@ static const int32 kMaxHistory = 32; } -// BPictureButton() will crash when giving zero pointers, -// although we really want and have to set up the -// pictures when we can, e.g. on a AttachedToWindow. -static BPicture sPicture; - -static const float kButtonWidth = 19.0f; -static const float kButtonSpacing = 31.0f; - // button width and spacing forms a golden rectangle -static const float kLeftMargin = 9.0f; - - -// #pragma mark - BNavigatorButton - - -BNavigatorButton::BNavigatorButton(BRect rect, const char* name, - BMessage* message, int32 resIDon, int32 resIDoff, int32 resIDdisabled) - : - BPictureButton(rect, name, &sPicture, &sPicture, message), - fResIDOn(resIDon), - fResIDOff(resIDoff), - fResIDDisabled(resIDdisabled) -{ - // Clear to background color to avoid ugly border on click - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); -} - - -BNavigatorButton::~BNavigatorButton() -{ -} - - -void -BNavigatorButton::AttachedToWindow() -{ - BBitmap* bmpOn = 0; - GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDOn, - &bmpOn); - SetPicture(bmpOn, true, true); - delete bmpOn; - - BBitmap* bmpOff = 0; - GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDOff, - &bmpOff); - SetPicture(bmpOff, true, false); - delete bmpOff; - - BBitmap* bmpDisabled = 0; - GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, fResIDDisabled, - &bmpDisabled); - SetPicture(bmpDisabled, false, false); - SetPicture(bmpDisabled, false, true); - delete bmpDisabled; -} - - -void -BNavigatorButton::SetPicture(BBitmap* bitmap, bool enabled, bool on) -{ - if (bitmap != NULL) { - BPicture picture; - BView view(bitmap->Bounds(), "", 0, 0); - AddChild(&view); - view.BeginPicture(&picture); - view.SetHighColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - view.FillRect(view.Bounds()); - view.SetDrawingMode(B_OP_OVER); - view.DrawBitmap(bitmap, BPoint(0, 0)); - view.EndPicture(); - RemoveChild(&view); - if (enabled) - on ? SetEnabledOn(&picture) : SetEnabledOff(&picture); - else - on ? SetDisabledOn(&picture) : SetDisabledOff(&picture); - } -} - // #pragma mark - BNavigator -BNavigator::BNavigator(const Model* model, BRect rect, uint32 resizeMask) +BNavigator::BNavigator(const Model* model) : - BView(rect, "Navigator", resizeMask, B_WILL_DRAW), - fBack(0), - fForw(0), - fUp(0), + BToolbar(BRect()), // FIXME in BToolbar: pointless BRect() fBackHistory(8, true), fForwHistory(8, true) { // Get initial path model->GetPath(&fPath); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - - float top = 2 + (be_plain_font->Size() - 8) / 2; - - // Set up widgets - fBack = new BNavigatorButton( - BRect(kLeftMargin, top, kLeftMargin + kButtonWidth - 1, - top + kButtonWidth - 2), - "Back", new BMessage(kNavigatorCommandBackward), - R_ResBackNavActiveSel, R_ResBackNavActive, R_ResBackNavInactive); - fBack->SetEnabled(false); - AddChild(fBack); - - fForw = new BNavigatorButton( - BRect(kLeftMargin + kButtonSpacing, top, - kLeftMargin + kButtonSpacing + kButtonWidth - 1, - top + kButtonWidth - 2), - "Forw", new BMessage(kNavigatorCommandForward), - R_ResForwNavActiveSel, R_ResForwNavActive, R_ResForwNavInactive); - fForw->SetEnabled(false); - AddChild(fForw); - - fUp = new BNavigatorButton( - BRect(kLeftMargin + kButtonSpacing * 2, top, - kLeftMargin + kButtonSpacing * 2 + kButtonWidth - 1, - top + kButtonWidth - 2), - "Up", new BMessage(kNavigatorCommandUp), R_ResUpNavActiveSel, - R_ResUpNavActive, R_ResUpNavInactive); - fUp->SetEnabled(false); - AddChild(fUp); - - fLocation = new BTextControl( - BRect(kLeftMargin + kButtonSpacing * 3, 2, - rect.Width() - 2, 2 + kButtonWidth), - "Location", "", "", new BMessage(kNavigatorCommandLocation), - B_FOLLOW_LEFT_RIGHT); + fLocation = new BTextControl("Location", "", "", + new BMessage(kNavigatorCommandLocation)); fLocation->SetDivider(0); - AddChild(fLocation); + + GroupLayout()->SetInsets(0, 0, B_USE_HALF_ITEM_INSETS, 0); } @@ -196,10 +80,29 @@ BNavigator::~BNavigator() void BNavigator::AttachedToWindow() { - // All messages should arrive here - fBack->SetTarget(this); - fForw->SetTarget(this); - fUp->SetTarget(this); + // Set up toolbar items + BBitmap* bmpBack = new BBitmap(BRect(0, 0, 19, 19), B_RGBA32); + GetTrackerResources()->GetIconResource(R_ResBackNav, B_MINI_ICON, + bmpBack); + AddAction(kNavigatorCommandBackward, this, bmpBack); + SetActionEnabled(kNavigatorCommandBackward, false); + delete bmpBack; + + BBitmap* bmpForw = new BBitmap(BRect(0, 0, 19, 19), B_RGBA32); + GetTrackerResources()->GetIconResource(R_ResForwNav, B_MINI_ICON, + bmpForw); + AddAction(kNavigatorCommandForward, this, bmpForw); + SetActionEnabled(kNavigatorCommandForward, false); + delete bmpForw; + + BBitmap* bmpUp = new BBitmap(BRect(0, 0, 19, 19), B_RGBA32); + GetTrackerResources()->GetIconResource(R_ResUpNav, B_MINI_ICON, + bmpUp); + AddAction(kNavigatorCommandUp, this, bmpUp); + SetActionEnabled(kNavigatorCommandUp, false); + delete bmpUp; + + GroupLayout()->AddView(fLocation); fLocation->SetTarget(this); } @@ -212,25 +115,6 @@ BNavigator::AllAttached() } -void -BNavigator::Draw(BRect) -{ - rgb_color bgColor = ui_color(B_PANEL_BACKGROUND_COLOR); - rgb_color shineColor = ui_color(B_SHINE_COLOR); - rgb_color halfDarkColor = tint_color(bgColor, B_DARKEN_1_TINT); - rgb_color darkColor = tint_color(bgColor, B_DARKEN_2_TINT); - // Draws a beveled smooth border - BeginLineArray(4); - AddLine(Bounds().LeftTop(), Bounds().RightTop(), shineColor); - AddLine(Bounds().LeftTop(), Bounds().LeftBottom() - BPoint(0, 1), - shineColor); - AddLine(Bounds().LeftBottom() - BPoint(-1, 1), - Bounds().RightBottom() - BPoint(0, 1), halfDarkColor); - AddLine(Bounds().LeftBottom(), Bounds().RightBottom(), darkColor); - EndLineArray(); -} - - void BNavigator::MessageReceived(BMessage* message) { @@ -434,24 +318,16 @@ BNavigator::UpdateLocation(const Model* newmodel, int32 action) BEntry entry; if (entry.SetTo(fPath.Path()) == B_OK) { BEntry parentEntry; - fUp->SetEnabled(entry.GetParent(&parentEntry) == B_OK - && !FSIsDeskDir(&parentEntry)); + bool enable = entry.GetParent(&parentEntry) == B_OK + && !FSIsDeskDir(&parentEntry); + SetActionEnabled(kNavigatorCommandUp, enable); } // Enable history buttons if history contains something - fForw->SetEnabled(fForwHistory.CountItems() > 0); - fBack->SetEnabled(fBackHistory.CountItems() > 1); + SetActionEnabled(kNavigatorCommandForward, fForwHistory.CountItems() > 0); + SetActionEnabled(kNavigatorCommandBackward, fBackHistory.CountItems() > 1); // Avoid loss of selection and cursor position if (action != kActionLocation) fLocation->SetText(fPath.Path()); } - - -float -BNavigator::CalcNavigatorHeight(void) -{ - // Empiric formula from how much space the textview - // will take once it is attached (using be_plain_font): - return ceilf(11.0f + be_plain_font->Size() * (1.0f + 7.0f / 30.0f)); -} diff --git a/src/kits/tracker/Navigator.h b/src/kits/tracker/Navigator.h index 8cb559950a..c7c8b9d51d 100644 --- a/src/kits/tracker/Navigator.h +++ b/src/kits/tracker/Navigator.h @@ -35,8 +35,7 @@ All rights reserved. #define _NAVIGATOR_H -#include -#include +#include #include "ContainerWindow.h" #include "Model.h" @@ -64,40 +63,16 @@ enum NavigationAction }; -// Custom BPictureButton which takes -// bitmap resource IDs as arguments -class BNavigatorButton : public BPictureButton { +class BNavigator : public BToolbar { public: - BNavigatorButton(BRect rect, const char* name, BMessage* message, - int32 resIDon, int32 resIDoff, int32 resIDdisabled); - - ~BNavigatorButton(); - - virtual void AttachedToWindow(); - - void SetPicture(BBitmap*, bool enabled, bool on); - -private: - int32 fResIDOn; - int32 fResIDOff; - int32 fResIDDisabled; -}; - - -class BNavigator : public BView { -public: - BNavigator(const Model* model, BRect rect, - uint32 resizeMask = B_FOLLOW_LEFT_RIGHT); + BNavigator(const Model* model); ~BNavigator(); void UpdateLocation(const Model* newmodel, int32 action); - static float CalcNavigatorHeight(void); - BContainerWindow* Window() const; protected: - virtual void Draw(BRect rect); virtual void MessageReceived(BMessage* msg); virtual void AttachedToWindow(); virtual void AllAttached(); @@ -112,9 +87,6 @@ protected: private: BPath fPath; - BNavigatorButton* fBack; - BNavigatorButton* fForw; - BNavigatorButton* fUp; BTextControl* fLocation; BObjectList fBackHistory; diff --git a/src/kits/tracker/OpenWithWindow.cpp b/src/kits/tracker/OpenWithWindow.cpp index 1e1bfbc68e..ff0edb4254 100644 --- a/src/kits/tracker/OpenWithWindow.cpp +++ b/src/kits/tracker/OpenWithWindow.cpp @@ -45,11 +45,14 @@ All rights reserved. #include #include #include +#include +#include #include #include #include #include #include +#include #include #include @@ -81,10 +84,9 @@ const rgb_color kOpenWithDefaultColor = { 0xFF, 0xFF, 0xCC, 255}; OpenWithContainerWindow::OpenWithContainerWindow(BMessage* entriesToOpen, - LockingList* windowList, window_look look, window_feel feel, - uint32 flags, uint32 workspace) + LockingList* windowList) : - BContainerWindow(windowList, 0, look, feel, flags, workspace), + BContainerWindow(windowList, 0), fEntriesToOpen(entriesToOpen) { AutoLock lock(this); @@ -93,58 +95,28 @@ OpenWithContainerWindow::OpenWithContainerWindow(BMessage* entriesToOpen, MoveTo(windowRect.LeftTop()); ResizeTo(windowRect.Width(), windowRect.Height()); - // add a background view; use the standard BackgroundView here, the same - // as the file panel is using - BRect rect(Bounds()); - BackgroundView* backgroundView = new BackgroundView(rect); - AddChild(backgroundView); + // Create controls + fButtonContainer = new BGroupView(B_HORIZONTAL, B_USE_ITEM_SPACING); + fButtonContainer->GroupLayout()->SetInsets(0, B_USE_ITEM_INSETS, + B_USE_ITEM_INSETS, 0); - rect = Bounds(); - - // add buttons - - fLaunchButton = new BButton(rect, "ok", B_TRANSLATE("Open"), - new BMessage(kDefaultButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); - fLaunchButton->ResizeToPreferred(); - fLaunchButton->MoveTo(rect.right - 10 - kDocumentKnobWidth - - fLaunchButton->Bounds().Width(), - rect.bottom - 10.0f - fLaunchButton->Bounds().Height()); - backgroundView->AddChild(fLaunchButton); - - BRect buttonRect = fLaunchButton->Frame(); - fLaunchAndMakeDefaultButton = new BButton(buttonRect, "make default", - B_TRANSLATE("Open and make preferred"), - new BMessage(kOpenAndMakeDefault), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); - // wide button, have to resize to fit text - fLaunchAndMakeDefaultButton->ResizeToPreferred(); - fLaunchAndMakeDefaultButton->MoveBy(-10.0f - - fLaunchAndMakeDefaultButton->Bounds().Width(), 0.0f); - backgroundView->AddChild(fLaunchAndMakeDefaultButton); - fLaunchAndMakeDefaultButton->SetEnabled(false); - - buttonRect = fLaunchAndMakeDefaultButton->Frame(); - BButton* button = new BButton(buttonRect, "cancel", B_TRANSLATE("Cancel"), - new BMessage(kCancelButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); - button->ResizeToPreferred(); - button->MoveBy(-10.0f - button->Bounds().Width(), 0.0f); - backgroundView->AddChild(button); - - fMinimalWidth = button->Bounds().Width() + fLaunchButton->Bounds().Width() - + fLaunchAndMakeDefaultButton->Bounds().Width() + kDocumentKnobWidth - + 40.0f; + fLaunchButton = new BButton("ok", B_TRANSLATE("Open"), + new BMessage(kDefaultButton)); fLaunchButton->MakeDefault(true); - // add pose view + fLaunchAndMakeDefaultButton = new BButton("make default", + B_TRANSLATE("Open and make preferred"), + new BMessage(kOpenAndMakeDefault)); + // wide button, have to resize to fit text + fLaunchAndMakeDefaultButton->SetEnabled(false); - rect.OffsetTo(10.0f, 10.0f); - rect.bottom = buttonRect.top - 15.0f; + fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"), + new BMessage(kCancelButton)); - rect.right -= B_V_SCROLL_BAR_WIDTH + 20.0f; - rect.bottom -= B_H_SCROLL_BAR_HEIGHT; - // make room for scrollbars and a margin - fPoseView = NewPoseView(0, rect, kListMode); - backgroundView->AddChild(fPoseView); + // Add pose view + fPoseView = NewPoseView(NULL, kListMode); + fBorderedView->GroupLayout()->AddView(fPoseView); fPoseView->SetFlags(fPoseView->Flags() | B_NAVIGABLE); fPoseView->SetPoseEditing(false); @@ -175,9 +147,9 @@ OpenWithContainerWindow::~OpenWithContainerWindow() BPoseView* -OpenWithContainerWindow::NewPoseView(Model*, BRect rect, uint32) +OpenWithContainerWindow::NewPoseView(Model*, uint32) { - return new OpenWithPoseView(rect); + return new OpenWithPoseView; } @@ -447,6 +419,28 @@ OpenWithContainerWindow::Init(const BMessage* message) } +void +OpenWithContainerWindow::InitLayout() +{ + _inherited::InitLayout(); + + // Remove the menu container, since we don't have a menu bar + fMenuContainer->RemoveSelf(); + + // Reset insets + fRootLayout->SetInsets(B_USE_ITEM_INSETS); + fPoseContainer->GridLayout()->SetInsets(0); + fVScrollBarContainer->GroupLayout()->SetInsets(-1, 0, 0, 0); + fCountContainer->GroupLayout()->SetInsets(0); + + fRootLayout->AddView(fButtonContainer); + fButtonContainer->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); + fButtonContainer->GroupLayout()->AddView(fCancelButton); + fButtonContainer->GroupLayout()->AddView(fLaunchAndMakeDefaultButton); + fButtonContainer->GroupLayout()->AddView(fLaunchButton); +} + + void OpenWithContainerWindow::RestoreState() { @@ -460,6 +454,7 @@ OpenWithContainerWindow::RestoreState() RestoreWindowState(NULL); fPoseView->Init(NULL); } + InitLayout(); } @@ -473,7 +468,6 @@ OpenWithContainerWindow::RestoreState(const BMessage &message) void OpenWithContainerWindow::RestoreWindowState(AttributeStreamNode* node) { - SetSizeLimits(fMinimalWidth, 10000, 160, 10000); if (node == NULL) return; @@ -538,9 +532,9 @@ OpenWithContainerWindow::SetCanOpen(bool on) // #pragma mark - OpenWithPoseView -OpenWithPoseView::OpenWithPoseView(BRect frame, uint32 resizeMask) +OpenWithPoseView::OpenWithPoseView() : - BPoseView(new Model(), frame, kListMode, resizeMask), + BPoseView(new Model(), kListMode), fHaveCommonPreferredApp(false), fIterator(NULL) { diff --git a/src/kits/tracker/OpenWithWindow.h b/src/kits/tracker/OpenWithWindow.h index cb4c111f59..e8a625b2a3 100644 --- a/src/kits/tracker/OpenWithWindow.h +++ b/src/kits/tracker/OpenWithWindow.h @@ -48,6 +48,7 @@ All rights reserved. #include "SlowMenu.h" #include "Utilities.h" +class BGroupView; namespace BPrivate { @@ -138,14 +139,12 @@ private: class OpenWithContainerWindow : public BContainerWindow { public: OpenWithContainerWindow(BMessage* entriesToOpen, - LockingList* windowList, - window_look look = B_DOCUMENT_WINDOW_LOOK, - window_feel feel = B_NORMAL_WINDOW_FEEL, - uint32 flags = 0, uint32 workspace = B_CURRENT_WORKSPACE); + LockingList* windowList); // eventually get opened by the selected app virtual ~OpenWithContainerWindow(); virtual void Init(const BMessage* message); + virtual void InitLayout(); const BMessage* EntryList() const; // return the list of the entries we are supposed to open @@ -156,8 +155,7 @@ public: OpenWithPoseView* PoseView() const; protected: - virtual BPoseView* NewPoseView(Model* model, BRect rect, - uint32 viewMode); + virtual BPoseView* NewPoseView(Model* model, uint32 viewMode); virtual bool ShouldAddMenus() const; virtual void ShowContextMenu(BPoint, const entry_ref*, BView*); @@ -191,7 +189,9 @@ private: BMessage* fEntriesToOpen; BButton* fLaunchButton; BButton* fLaunchAndMakeDefaultButton; - float fMinimalWidth; + BButton* fCancelButton; + + BGroupView* fButtonContainer; typedef BContainerWindow _inherited; }; @@ -199,7 +199,7 @@ private: class OpenWithPoseView : public BPoseView { public: - OpenWithPoseView(BRect, uint32 resizeMask = B_FOLLOW_ALL); + OpenWithPoseView(); virtual void OpenSelection(BPose*, int32*); // open entries with the selected app diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp index 486c3c8fa1..943aca6cac 100644 --- a/src/kits/tracker/PoseView.cpp +++ b/src/kits/tracker/PoseView.cpp @@ -111,7 +111,6 @@ using std::max; const float kDoubleClickTresh = 6; -const float kCountViewWidth = 76; const uint32 kAddNewPoses = 'Tanp'; const uint32 kAddPosesCompleted = 'Tapc'; @@ -203,13 +202,12 @@ static int PoseCompareAddWidget(const BPose* p1, const BPose* p2, BPoseView* view); -// #pragma mark - BPoseView +// #pragma mark - BPoseView -BPoseView::BPoseView(Model* model, BRect bounds, uint32 viewMode, - uint32 resizeMask) +BPoseView::BPoseView(Model* model, uint32 viewMode) : - BView(bounds, "PoseView", resizeMask, B_WILL_DRAW | B_PULSE_NEEDED), + BView("BPoseView", B_WILL_DRAW | B_PULSE_NEEDED), fIsDrawingSelectionRect(false), fHScrollBar(NULL), fVScrollBar(NULL), @@ -320,23 +318,11 @@ BPoseView::InitCommon() { BContainerWindow* window = ContainerWindow(); - // create title view for window - BRect rect(Frame()); - rect.bottom = rect.top + kTitleViewHeight; - fTitleView = new BTitleView(rect, this); - if (ViewMode() == kListMode) { - // resize and move poseview - MoveBy(0, kTitleViewHeight + 1); - ResizeBy(0, -(kTitleViewHeight + 1)); - - if (Parent() != NULL) - Parent()->AddChild(fTitleView); - else - Window()->AddChild(fTitleView); - } - - if (fHScrollBar) + // Create the TitleView and CountView + fTitleView = new BTitleView(this); + if (fHScrollBar != NULL) fHScrollBar->SetTitleView(fTitleView); + fCountView = new BCountView(this); BPoint origin; if (ViewMode() == kListMode) @@ -361,9 +347,6 @@ BPoseView::InitCommon() StartWatching(); // turn on volume node monitor, metamime monitor, etc. - if (window != NULL && window->ShouldAddCountView()) - AddCountView(); - // populate the window if (window != NULL && window->IsTrash()) AddTrashPoses(); @@ -938,16 +921,6 @@ BPoseView::Pulse() } -void -BPoseView::MoveBy(float x, float y) -{ - if (fTitleView && fTitleView->Window()) - fTitleView->MoveBy(x, y); - - _inherited::MoveBy(x, y); -} - - void BPoseView::ScrollTo(BPoint where) { @@ -1063,13 +1036,22 @@ BPoseView::MakeFocus(bool focused) _inherited::MakeFocus(focused); if (invalidate) { - BackgroundView* view = dynamic_cast(Parent()); + BorderedView* view = dynamic_cast(Parent()); if (view != NULL) view->PoseViewFocused(focused); } } +BSize +BPoseView::MinSize() +{ + // Between the BTitleView, BCountView, and scrollbars, + // we don't need any extra room. + return BSize(0, 0); +} + + void BPoseView::WindowActivated(bool active) { @@ -2080,33 +2062,8 @@ BPoseView::EnableScrollBars() void BPoseView::AddScrollBars() { - AutoLock lock(Window()); - if (!lock) - return; - - BRect bounds(Frame()); - - // horizontal - BRect rect(bounds); - rect.top = rect.bottom + 1; - rect.bottom = rect.top + (float)B_H_SCROLL_BAR_HEIGHT; - rect.right++; - fHScrollBar = new BHScrollBar(rect, "HScrollBar", this); - if (Parent() != NULL) - Parent()->AddChild(fHScrollBar); - else - Window()->AddChild(fHScrollBar); - - // vertical - rect = bounds; - rect.left = rect.right + 1; - rect.right = rect.left + (float)B_V_SCROLL_BAR_WIDTH; - rect.bottom++; - fVScrollBar = new BScrollBar(rect, "VScrollBar", this, 0, 100, B_VERTICAL); - if (Parent() != NULL) - Parent()->AddChild(fVScrollBar); - else - Window()->AddChild(fVScrollBar); + fHScrollBar = new TScrollBar("HScrollBar", this, 0, 100); + fVScrollBar = new BScrollBar("VScrollBar", this, 0, 100, B_VERTICAL); } @@ -2118,30 +2075,6 @@ BPoseView::UpdateCount() } -void -BPoseView::AddCountView() -{ - AutoLock lock(Window()); - if (!lock) - return; - - BRect rect(Frame()); - rect.right = rect.left + kCountViewWidth; - rect.top = rect.bottom + 1; - rect.bottom = rect.top + (float)B_H_SCROLL_BAR_HEIGHT - 1; - fCountView = new BCountView(rect, this); - if (Parent() != NULL) - Parent()->AddChild(fCountView); - else - Window()->AddChild(fCountView); - - if (fHScrollBar != NULL) { - fHScrollBar->MoveBy(kCountViewWidth + 1, 0); - fHScrollBar->ResizeBy(-kCountViewWidth - 1, 0); - } -} - - void BPoseView::MessageReceived(BMessage* message) { @@ -3093,26 +3026,15 @@ BPoseView::SetViewMode(uint32 newMode) if (fFiltering) ClearFilter(); - fTitleView->RemoveSelf(); - if (window != NULL) window->HideAttributeMenu(); - MoveBy(0, -(kTitleViewHeight + 1)); - ResizeBy(0, kTitleViewHeight + 1); + fTitleView->Hide(); } else if (newMode == kListMode) { - MoveBy(0, kTitleViewHeight + 1); - ResizeBy(0, -(kTitleViewHeight + 1)); - if (window != NULL) window->ShowAttributeMenu(); - fTitleView->ResizeTo(Frame().Width(), fTitleView->Frame().Height()); - fTitleView->MoveTo(Frame().left, Frame().top - (kTitleViewHeight + 1)); - if (Parent() != NULL) - Parent()->AddChild(fTitleView); - else - Window()->AddChild(fTitleView); + fTitleView->Show(); } CommitActivePose(); @@ -8402,28 +8324,15 @@ BPoseView::SwitchDir(const entry_ref* newDirRef, AttributeStreamNode* node) if (viewStateRestored) { if (ViewMode() == kListMode && oldMode != kListMode) { - - MoveBy(0, kTitleViewHeight + 1); - ResizeBy(0, -(kTitleViewHeight + 1)); - if (ContainerWindow()) ContainerWindow()->ShowAttributeMenu(); - fTitleView->ResizeTo(Frame().Width(), fTitleView->Frame().Height()); - fTitleView->MoveTo(Frame().left, Frame().top - - (kTitleViewHeight + 1)); - if (Parent() != NULL) - Parent()->AddChild(fTitleView); - else - Window()->AddChild(fTitleView); + fTitleView->Show(); } else if (ViewMode() != kListMode && oldMode == kListMode) { - fTitleView->RemoveSelf(); + fTitleView->Hide(); if (ContainerWindow()) ContainerWindow()->HideAttributeMenu(); - - MoveBy(0, -(kTitleViewHeight + 1)); - ResizeBy(0, kTitleViewHeight + 1); } else if (ViewMode() == kListMode && oldMode == kListMode) fTitleView->Invalidate(); @@ -10444,19 +10353,19 @@ BPoseView::ExcludeTrashFromSelection() } -// #pragma mark - BHScrollBar +// #pragma mark - TScrollBar -BHScrollBar::BHScrollBar(BRect bounds, const char* name, BView* target) +TScrollBar::TScrollBar(const char* name, BView* target, float min, float max) : - BScrollBar(bounds, name, target, 0, 1, B_HORIZONTAL), - fTitleView(0) + BScrollBar(name, target, min, max, B_HORIZONTAL), + fTitleView(NULL) { } void -BHScrollBar::ValueChanged(float value) +TScrollBar::ValueChanged(float value) { if (fTitleView) { BPoint origin = fTitleView->LeftTop(); diff --git a/src/kits/tracker/PoseView.h b/src/kits/tracker/PoseView.h index 6bcd75240e..131f872958 100644 --- a/src/kits/tracker/PoseView.h +++ b/src/kits/tracker/PoseView.h @@ -91,8 +91,8 @@ namespace BPrivate { class BCountView; class BContainerWindow; -class BHScrollBar; class EntryListBase; +class TScrollBar; const int32 kSmallStep = 10; @@ -106,8 +106,7 @@ const uint32 kCheckTypeahead = 'Tcty'; class BPoseView : public BView { public: - BPoseView(Model*, BRect, uint32 viewMode, - uint32 resizeMask = B_FOLLOW_ALL); + BPoseView(Model*, uint32 viewMode); virtual ~BPoseView(); // setup, teardown @@ -164,6 +163,7 @@ public: virtual void AttachedToWindow(); virtual void WindowActivated(bool active); virtual void MakeFocus(bool = true); + virtual BSize MinSize(); virtual void Draw(BRect update_rect); virtual void DrawAfterChildren(BRect update_rect); virtual void MouseMoved(BPoint, uint32, const BMessage*); @@ -174,7 +174,6 @@ public: virtual void MouseIdle(const BMessage*); virtual void KeyDown(const char*, int32); virtual void Pulse(); - virtual void MoveBy(float, float); virtual void ScrollTo(BPoint); // misc. mode setters @@ -199,9 +198,10 @@ public: virtual void UpdateScrollRange(); virtual void SetScrollBarsTo(BPoint); virtual void AddScrollBars(); - BHScrollBar* HScrollBar() const; + BScrollBar* HScrollBar() const; BScrollBar* VScrollBar() const ; BCountView* CountView() const; + BTitleView* TitleView() const; void DisableScrollBars(); void EnableScrollBars(); @@ -638,7 +638,6 @@ protected: void RemoveFromExtent(const BRect&); virtual void EditQueries(); - virtual void AddCountView(); void HandleAttrMenuItemSelected(BMessage*); void TryUpdatingBrokenLinks(); @@ -690,7 +689,7 @@ private: void MoveSelectionOrEntryToTrash(const entry_ref* ref, bool selectNext); protected: - BHScrollBar* fHScrollBar; + TScrollBar* fHScrollBar; BScrollBar* fVScrollBar; Model* fModel; BPose* fActivePose; @@ -797,9 +796,9 @@ protected: }; -class BHScrollBar : public BScrollBar { +class TScrollBar : public BScrollBar { public: - BHScrollBar(BRect, const char*, BView*); + TScrollBar(const char*, BView*, float, float); void SetTitleView(BView*); // BScrollBar overrides @@ -890,7 +889,7 @@ BPoseView::MimeTypesInSelection() } -inline BHScrollBar* +inline BScrollBar* BPoseView::HScrollBar() const { return fHScrollBar; @@ -911,6 +910,13 @@ BPoseView::CountView() const } +inline BTitleView* +BPoseView::TitleView() const +{ + return fTitleView; +} + + inline bool BPoseView::StateNeedsSaving() { @@ -1163,6 +1169,13 @@ BPoseView::SetSelectionHandler(BLooper* looper) } +inline void +TScrollBar::SetTitleView(BView* view) +{ + fTitleView = view; +} + + inline void BPoseView::SetRefFilter(BRefFilter* filter) { @@ -1179,13 +1192,6 @@ BPoseView::RefFilter() const } -inline void -BHScrollBar::SetTitleView(BView* view) -{ - fTitleView = view; -} - - inline BPose* BPoseView::FindPose(const Model* model, int32* index) const { diff --git a/src/kits/tracker/QueryContainerWindow.cpp b/src/kits/tracker/QueryContainerWindow.cpp index ad041ce99f..1d568ac186 100644 --- a/src/kits/tracker/QueryContainerWindow.cpp +++ b/src/kits/tracker/QueryContainerWindow.cpp @@ -56,19 +56,17 @@ All rights reserved. BQueryContainerWindow::BQueryContainerWindow(LockingList* windowList, - uint32 containerWindowFlags, window_look look, window_feel feel, - uint32 flags, uint32 workspace) + uint32 containerWindowFlags) : - BContainerWindow(windowList, containerWindowFlags, look, feel, - flags, workspace) + BContainerWindow(windowList, containerWindowFlags) { } BPoseView* -BQueryContainerWindow::NewPoseView(Model* model, BRect rect, uint32) +BQueryContainerWindow::NewPoseView(Model* model, uint32) { - return new BQueryPoseView(model, rect); + return new BQueryPoseView(model); } @@ -82,12 +80,11 @@ BQueryContainerWindow::PoseView() const void BQueryContainerWindow::CreatePoseView(Model* model) { - BRect rect(Bounds()); - rect.right -= B_V_SCROLL_BAR_WIDTH; - rect.bottom -= B_H_SCROLL_BAR_HEIGHT; - fPoseView = NewPoseView(model, rect, kListMode); + fPoseView = NewPoseView(model, kListMode); - AddChild(fPoseView); + fBorderedView->GroupLayout()->AddView(fPoseView); + fBorderedView->EnableBorderHighlight(false); + fBorderedView->GroupLayout()->SetInsets(0, 0, 1, 1); } diff --git a/src/kits/tracker/QueryContainerWindow.h b/src/kits/tracker/QueryContainerWindow.h index 4b8462698f..b263ebf400 100644 --- a/src/kits/tracker/QueryContainerWindow.h +++ b/src/kits/tracker/QueryContainerWindow.h @@ -51,18 +51,14 @@ class BQueryPoseView; class BQueryContainerWindow : public BContainerWindow { public: BQueryContainerWindow(LockingList* windowList, - uint32 containerWindowFlags, - window_look look = B_DOCUMENT_WINDOW_LOOK, - window_feel feel = B_NORMAL_WINDOW_FEEL, - uint32 flags = B_WILL_ACCEPT_FIRST_CLICK | B_NO_WORKSPACE_ACTIVATION, - uint32 workspace = B_CURRENT_WORKSPACE); + uint32 containerWindowFlags); BQueryPoseView* PoseView() const; bool ActiveOnDevice(dev_t) const; protected: virtual void CreatePoseView(Model*); - virtual BPoseView* NewPoseView(Model* model, BRect rect, uint32 viewMode); + virtual BPoseView* NewPoseView(Model* model, uint32 viewMode); virtual void AddWindowMenu(BMenu* menu); virtual void AddWindowContextMenus(BMenu* menu); diff --git a/src/kits/tracker/QueryPoseView.cpp b/src/kits/tracker/QueryPoseView.cpp index 1823e209aa..cdfdd18977 100644 --- a/src/kits/tracker/QueryPoseView.cpp +++ b/src/kits/tracker/QueryPoseView.cpp @@ -77,9 +77,9 @@ using std::nothrow; // #pragma mark - BQueryPoseView -BQueryPoseView::BQueryPoseView(Model* model, BRect frame, uint32 resizeMask) +BQueryPoseView::BQueryPoseView(Model* model) : - BPoseView(model, frame, kListMode, resizeMask), + BPoseView(model, kListMode), fShowResultsFromTrash(false), fQueryList(NULL), fQueryListContainer(NULL), diff --git a/src/kits/tracker/QueryPoseView.h b/src/kits/tracker/QueryPoseView.h index 48b79896e0..26524ce04c 100644 --- a/src/kits/tracker/QueryPoseView.h +++ b/src/kits/tracker/QueryPoseView.h @@ -49,7 +49,7 @@ class QueryEntryListCollection; class BQueryPoseView : public BPoseView { public: - BQueryPoseView(Model*, BRect, uint32 resizeMask = B_FOLLOW_ALL); + BQueryPoseView(Model*); virtual ~BQueryPoseView(); virtual void MessageReceived(BMessage* message); diff --git a/src/kits/tracker/TitleView.cpp b/src/kits/tracker/TitleView.cpp index 9d2c2e8d5a..9d310dc801 100644 --- a/src/kits/tracker/TitleView.cpp +++ b/src/kits/tracker/TitleView.cpp @@ -102,9 +102,9 @@ _DrawOutline(BView* view, BRect where) // #pragma mark - BTitleView -BTitleView::BTitleView(BRect frame, BPoseView* view) +BTitleView::BTitleView(BPoseView* view) : - BView(frame, "TitleView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW), + BView("BTitleView", B_WILL_DRAW), fPoseView(view), fTitleList(10, true), fHorizontalResizeCursor(B_CURSOR_ID_RESIZE_EAST_WEST), diff --git a/src/kits/tracker/TitleView.h b/src/kits/tracker/TitleView.h index 3cd917fdc3..959632e098 100644 --- a/src/kits/tracker/TitleView.h +++ b/src/kits/tracker/TitleView.h @@ -63,7 +63,7 @@ const int32 kColumnStart = 40; class BTitleView : public BView { public: - BTitleView(BRect, BPoseView*); + BTitleView(BPoseView*); virtual ~BTitleView(); virtual void MouseDown(BPoint where); diff --git a/src/kits/tracker/Tracker.cpp b/src/kits/tracker/Tracker.cpp index 287b65b8b2..d98c594833 100644 --- a/src/kits/tracker/Tracker.cpp +++ b/src/kits/tracker/Tracker.cpp @@ -1059,8 +1059,10 @@ TTracker::OpenContainerWindow(Model* model, BMessage* originalRefsList, window = new BContainerWindow(&fWindowList, openFlags); } - if (model != NULL) + if (model != NULL && window->LockLooper()) { window->CreatePoseView(model); + window->UnlockLooper(); + } BMessage restoreStateMessage(kRestoreState); diff --git a/src/kits/tracker/TrackerIcons.h b/src/kits/tracker/TrackerIcons.h index 2520d99918..d7f4b79f56 100644 --- a/src/kits/tracker/TrackerIcons.h +++ b/src/kits/tracker/TrackerIcons.h @@ -96,15 +96,9 @@ enum { R_MoveStatusBitmap = 1039, R_CopyStatusBitmap = 1040, R_TrashStatusBitmap = 1041, - R_ResBackNavActive = 1042, - R_ResBackNavInactive = 1043, - R_ResForwNavActive = 1044, - R_ResForwNavInactive = 1045, - R_ResUpNavActive = 1046, - R_ResUpNavInactive = 1047, - R_ResBackNavActiveSel = 1048, - R_ResForwNavActiveSel = 1049, - R_ResUpNavActiveSel = 1050, + R_ResBackNav = 1042, + R_ResForwNav = 1043, + R_ResUpNav = 1044, R_ShareIcon = 1051, R_MICN_ShareIcon = 1051 }; diff --git a/src/kits/tracker/TrackerIcons.rdef b/src/kits/tracker/TrackerIcons.rdef index a2225c5d04..092c9cc2f6 100644 --- a/src/kits/tracker/TrackerIcons.rdef +++ b/src/kits/tracker/TrackerIcons.rdef @@ -704,6 +704,31 @@ resource(R_BookmarkIcon) #'VICN' array { $"000A06010C1001178422040A07010C00" }; +resource(R_ResBackNav) #'VICN' array { + $"6E6369660304006603005900020006020000003C6000C000000000004C000048" + $"A0000080FF80FF00B300010A0722353622362C482C483E363E3648030A000100" + $"1240A32D00000000000040A32444CEA044D04B01178322040A0101001240A32D" + $"00000000000040A32442FA1242FD7201178322040A0201000240A32D00000000" + $"000040A32442FA1242FD72" +}; + +resource(R_ResForwNav) #'VICN' array { + $"6E6369660304006603005900020006020000003C6000C000000000004C000048" + $"A0000080FF80FF00B300010A0748353448343E223E222C342C3422030A000100" + $"1240A32D00000000000040A32444D19644D04B01178322040A0101001240A32D" + $"00000000000040A32442FFFF42FD7201178322040A0201000240A32D00000000" + $"000040A32442FFFF42FD72" +}; + + +resource(R_ResUpNav) #'VICN' array { + $"6E6369660304006603BB5205020006020000003C6000C000000000004C000048" + $"A00000FFD27CFFD58E05010A07352248363E363E482C482C362236030A000100" + $"1240A32400000000000040A32D44D04B44CEA001178322040A0101001240A324" + $"00000000000040A32D42FD7242FA1201178322040A0201000240A32400000000" + $"000040A32D42FD7242FA12" +}; + #endif // HAIKU_TARGET_PLATFORM_HAIKU resource(2, "BEOS:L:application/x-vnd.Be-query") #'ICON' array { @@ -2513,259 +2538,6 @@ resource(R_TrashStatusBitmap) archive(, 0x00000000) BBitmap { } }; - -resource(R_ResBackNavActive) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF3B3B18FFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFF3B353B1418FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFF3B35353B1418FFFFFFFFFFFFFFFF3F" - $"FFFFFFFF3B3435353B3B3B3B3B3B3B3B18FFFF3F" - $"FFFFFF3B34343535363637373737373B1418FF3F" - $"FFFF3B3434343535363637373737373B1418FF3F" - $"FF3B343434353536363637373737373B1418FF3F" - $"FF183B3535353536363637373737373B1418FF3F" - $"FFFF183B35363636363737373737373B1418FF3F" - $"FFFFFF183B3636373B3B3B3B3B3B3B3B1418FF3F" - $"FFFFFFFF183B37373B141414141414141418FF3F" - $"FFFFFFFFFF183B373B1418181818181818FFFF3F" - $"FFFFFFFFFFFF183B3B1418FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF18141418FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF1818FFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - -resource(R_ResBackNavInactive) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFF001800FFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFF00181800FFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFF001C18180000000000000000FFFFFF3F" - $"FFFFFF001C1C18181515111111111100FFFFFF3F" - $"FFFF001C1C1C18181515111111111100FFFFFF3F" - $"FF001C1C1C1818151515111111111100FFFFFF3F" - $"FFFF0018181818151515111111111100FFFFFF3F" - $"FFFFFF00181515151511111111111100FFFFFF3F" - $"FFFFFFFF001515110000000000000000FFFFFF3F" - $"FFFFFFFFFF00111100FFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFF001100FFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - -resource(R_ResForwNavActive) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF3B3B18FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF3B353B18FFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF3B35363B18FFFFFFFFFFFF3F" - $"FF3B3B3B3B3B3B3B3B3536363B18FFFFFFFFFF3F" - $"FF3B34343434353535363636373B18FFFFFFFF3F" - $"FF3B3434343535353536363637373B18FFFFFF3F" - $"FF3B343435353535363636373737373B18FFFF3F" - $"FF3B3535353535363636373737373B141418FF3F" - $"FF3B35353536363636373737373B141418FFFF3F" - $"FF3B3B3B3B3B3B3B3B3737373B141418FFFFFF3F" - $"FF181414141414143B37373B141418FFFFFFFF3F" - $"FFFF1818181818183B373B141418FFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF3B3B141418FFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF18141418FFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFF1818FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - -resource(R_ResForwNavInactive) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF001800FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF00181500FFFFFFFFFFFFFF3F" - $"FF000000000000000018151500FFFFFFFFFFFF3F" - $"FF001C1C1C1C1818181515151100FFFFFFFFFF3F" - $"FF001C1C1C18181818151515111100FFFFFFFF3F" - $"FF001C1C181818181515151111111100FFFFFF3F" - $"FF0018181818181515151111111100FFFFFFFF3F" - $"FF00181818151515151111111100FFFFFFFFFF3F" - $"FF000000000000000011111100FFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF00111100FFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF001100FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - -resource(R_ResUpNavActive) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF00E50018FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFF00E5BDBD0018FFFFFFFFFFFFFF3F" - $"FFFFFFFFFF00E5BDBDBDBD0018FFFFFFFFFFFF3F" - $"FFFFFFFF00E5BDBDBDBDBDBD0018FFFFFFFFFF3F" - $"FFFFFF00E5BDBDBDBDBDBDBDBD0018FFFFFFFF3F" - $"FFFF00E5E5E5BDBDBDBDBD9898980018FFFFFF3F" - $"FF00000000E5BDBDBDBDBD980000000018FFFF3F" - $"FFFF141400E5BDBDBDBDBD9800141418FFFFFF3F" - $"FFFFFF1800E5BDBDBDBDBD98001418FFFFFFFF3F" - $"FFFFFFFF00E5BDBDBDBDBD98001418FFFFFFFF3F" - $"FFFFFFFF00E5989898989898001418FFFFFFFF3F" - $"FFFFFFFF0000000000000000001418FFFFFFFF3F" - $"FFFFFFFF18141414141414141418FFFFFFFFFF3F" - $"FFFFFFFFFF181818181818181818FFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - -resource(R_ResUpNavInactive) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF001C00FFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFF001C171700FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFF001C1717171700FFFFFFFFFFFFFF3F" - $"FFFFFFFF001C17171717171700FFFFFFFFFFFF3F" - $"FFFFFF001C171717171717171700FFFFFFFFFF3F" - $"FFFF001C1C1C171717171712121200FFFFFFFF3F" - $"FF000000001C17171717171200000000FFFFFF3F" - $"FFFFFFFF001C17171717171200FFFFFFFFFFFF3F" - $"FFFFFFFF001C17171717171200FFFFFFFFFFFF3F" - $"FFFFFFFF001C17171717171200FFFFFFFFFFFF3F" - $"FFFFFFFF001C12121212121200FFFFFFFFFFFF3F" - $"FFFFFFFF000000000000000000FFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - -resource(R_ResBackNavActiveSel) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF3B353BFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFF3B35353BFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFF3B3435353B3B3B3B3B3B3B3BFFFF3F" - $"FFFFFFFF3B34343535363637373737373BFFFF3F" - $"FFFFFF3B3434343535363637373737373BFFFF3F" - $"FFFF3B343434353536363637373737373BFFFF3F" - $"FFFFFF3B3535353536363637373737373BFFFF3F" - $"FFFFFFFF3B35363636363737373737373BFFFF3F" - $"FFFFFFFFFF3B3636373B3B3B3B3B3B3B3BFFFF3F" - $"FFFFFFFFFFFF3B37373BFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF3B373BFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - -resource(R_ResForwNavActiveSel) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFF3B353BFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFF3B35363BFFFFFFFFFFFF3F" - $"FFFF3B3B3B3B3B3B3B3B3536363BFFFFFFFFFF3F" - $"FFFF3B34343434353535363636373BFFFFFFFF3F" - $"FFFF3B3434343535353536363637373BFFFFFF3F" - $"FFFF3B343435353535363636373737373BFFFF3F" - $"FFFF3B3535353535363636373737373BFFFFFF3F" - $"FFFF3B35353536363636373737373BFFFFFFFF3F" - $"FFFF3B3B3B3B3B3B3B3B3737373BFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFF3B37373BFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFF3B373BFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - -resource(R_ResUpNavActiveSel) archive(, 0x00000000) BBitmap { - "_frame" = rect { 0.0, 0.0, 18.0, 18.0 }, - "_cspace" = 4, - "_bmflags" = 1, - "_rowbytes" = 20, - "_data" = array { - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFF00E500FFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFF00E5BDBD00FFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFF00E5BDBDBDBD00FFFFFFFFFFFF3F" - $"FFFFFFFFFF00E5BDBDBDBDBDBD00FFFFFFFFFF3F" - $"FFFFFFFF00E5BDBDBDBDBDBDBDBD00FFFFFFFF3F" - $"FFFFFF00E5E5E5BDBDBDBDBD98989800FFFFFF3F" - $"FFFF00000000E5BDBDBDBDBD9800000000FFFF3F" - $"FFFFFFFFFF00E5BDBDBDBDBD9800FFFFFFFFFF3F" - $"FFFFFFFFFF00E5BDBDBDBDBD9800FFFFFFFFFF3F" - $"FFFFFFFFFF00E5BDBDBDBDBD9800FFFFFFFFFF3F" - $"FFFFFFFFFF00E598989898989800FFFFFFFFFF3F" - $"FFFFFFFFFF000000000000000000FFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F" - } -}; - resource(R_ShareIcon) #'ICON' array { $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" diff --git a/src/kits/tracker/VirtualDirectoryPoseView.cpp b/src/kits/tracker/VirtualDirectoryPoseView.cpp index 2bd477660b..a44921d94d 100644 --- a/src/kits/tracker/VirtualDirectoryPoseView.cpp +++ b/src/kits/tracker/VirtualDirectoryPoseView.cpp @@ -27,10 +27,9 @@ namespace BPrivate { // #pragma mark - VirtualDirectoryPoseView -VirtualDirectoryPoseView::VirtualDirectoryPoseView(Model* model, BRect frame, - uint32 resizeMask) +VirtualDirectoryPoseView::VirtualDirectoryPoseView(Model* model) : - BPoseView(model, frame, resizeMask), + BPoseView(model, kListMode), fDirectoryPaths(), fRootDefinitionFileRef(-1, -1), fFileChangeTime(-1), diff --git a/src/kits/tracker/VirtualDirectoryPoseView.h b/src/kits/tracker/VirtualDirectoryPoseView.h index 54b5188cc4..71fb19f0c4 100644 --- a/src/kits/tracker/VirtualDirectoryPoseView.h +++ b/src/kits/tracker/VirtualDirectoryPoseView.h @@ -21,9 +21,7 @@ class VirtualDirectoryEntryList; class VirtualDirectoryPoseView : public BPoseView { public: - VirtualDirectoryPoseView(Model* model, - BRect frame, - uint32 resizeMask = B_FOLLOW_ALL); + VirtualDirectoryPoseView(Model* model); virtual ~VirtualDirectoryPoseView(); virtual void MessageReceived(BMessage* message); diff --git a/src/kits/tracker/VirtualDirectoryWindow.cpp b/src/kits/tracker/VirtualDirectoryWindow.cpp index 81dae8a50c..76860fdf06 100644 --- a/src/kits/tracker/VirtualDirectoryWindow.cpp +++ b/src/kits/tracker/VirtualDirectoryWindow.cpp @@ -74,17 +74,16 @@ VirtualDirectoryWindow::VirtualDirectoryWindow(LockingList* windowList, void VirtualDirectoryWindow::CreatePoseView(Model* model) { - BRect rect(Bounds()); - rect.right -= B_V_SCROLL_BAR_WIDTH; - rect.bottom -= B_H_SCROLL_BAR_HEIGHT; - fPoseView = NewPoseView(model, rect, kListMode); + fPoseView = NewPoseView(model, kListMode); - AddChild(fPoseView); + fBorderedView->GroupLayout()->AddView(fPoseView); + fBorderedView->EnableBorderHighlight(false); + fBorderedView->GroupLayout()->SetInsets(0, 0, 1, 1); } BPoseView* -VirtualDirectoryWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) +VirtualDirectoryWindow::NewPoseView(Model* model, uint32 viewMode) { // If the model (or rather the entry_ref to it) came from another // application, it may refer to a subdirectory we cannot use directly. The @@ -117,7 +116,7 @@ VirtualDirectoryWindow::NewPoseView(Model* model, BRect rect, uint32 viewMode) } } - return new VirtualDirectoryPoseView(model, rect); + return new VirtualDirectoryPoseView(model); } diff --git a/src/kits/tracker/VirtualDirectoryWindow.h b/src/kits/tracker/VirtualDirectoryWindow.h index 2c1ab4d167..fd815a1197 100644 --- a/src/kits/tracker/VirtualDirectoryWindow.h +++ b/src/kits/tracker/VirtualDirectoryWindow.h @@ -28,8 +28,7 @@ public: protected: virtual void CreatePoseView(Model* model); - virtual BPoseView* NewPoseView(Model* model, BRect rect, - uint32 viewMode); + virtual BPoseView* NewPoseView(Model* model, uint32 viewMode); virtual void AddWindowMenu(BMenu* menu); virtual void AddWindowContextMenus(BMenu* menu);