Tracker: Eliminate the fixed count-view size altogether.

This moves the scroll bars and the count view into the layout
inside FilePanels, so more shim views for compatibility are now made.

Fixes #13179.
This commit is contained in:
Augustin Cavalier 2020-07-05 19:44:19 -04:00
parent 58f263a2c5
commit ec25a0451d
3 changed files with 39 additions and 52 deletions

View File

@ -1049,20 +1049,23 @@ BContainerWindow::InitLayout()
fCountContainer->GroupLayout()->AddView(fPoseView->CountView(), 0.25f);
bool forFilePanel = PoseView()->IsFilePanel();
if (!forFilePanel) {
// Eliminate the extra borders
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, -1, 0, 0);
fVScrollBarContainer->GroupLayout()->SetInsets(-1, forFilePanel ? 0 : -1, 0, 0);
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, -1);
hScrollBarContainer->GroupLayout()->SetInsets(0, -1, 0, forFilePanel ? 0 : -1);
fCountContainer->GroupLayout()->AddView(hScrollBarContainer);
}
}

View File

@ -43,8 +43,6 @@ 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

View File

@ -44,6 +44,7 @@ All rights reserved.
#include <Debug.h>
#include <Directory.h>
#include <FindDirectory.h>
#include <GridView.h>
#include <Locale.h>
#include <MenuBar.h>
#include <MenuField.h>
@ -245,6 +246,13 @@ TFilePanel::TFilePanel(file_panel_mode mode, BMessenger* target,
fBorderedView = new BorderedView;
CreatePoseView(model);
fBorderedView->GroupLayout()->SetInsets(1);
fPoseContainer = new BGridView(0.0, 0.0);
fPoseContainer->GridLayout()->AddView(fBorderedView, 0, 1);
fCountContainer = new BGroupView(B_HORIZONTAL, 0);
fPoseContainer->GridLayout()->AddView(fCountContainer, 0, 2);
fPoseView->SetRefFilter(filter);
if (!fIsSavePanel)
fPoseView->SetMultipleSelection(multipleSelection);
@ -735,16 +743,16 @@ TFilePanel::Init(const BMessage*)
// Add PoseView
PoseView()->SetName("ActualPoseView");
fBorderedView->SetName("PoseView");
fBorderedView->SetResizingMode(B_FOLLOW_ALL);
fPoseContainer->SetName("PoseView");
fPoseContainer->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());
fPoseContainer->MoveTo(rect.LeftTop());
fPoseContainer->ResizeTo(rect.Width(), rect.Height());
PoseView()->AddScrollBars();
PoseView()->SetDragEnabled(false);
@ -753,28 +761,10 @@ TFilePanel::Init(const BMessage*)
PoseView()->SetSelectionChangedHook(true);
PoseView()->DisableSaveLocation();
// 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);
fBackView->AddChild(fPoseContainer, fTextControl);
else
fBackView->AddChild(fBorderedView);
fBackView->AddChild(fPoseContainer);
AddShortcut('W', B_COMMAND_KEY, new BMessage(kCancelButton));
AddShortcut('H', B_COMMAND_KEY, new BMessage(kSwitchToHome));
@ -918,29 +908,25 @@ TFilePanel::RestoreState()
}
// Finish UI creation now that the PoseView is initialized
fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView());
InitLayout();
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.
#if 1
// The Be Book gives the names for some of these views so that apps could
// move them around if they needed to, but we have them here in layouts,
// so we need to change their names and add dummy views for compatibility.
// (The same is done for the PoseView above.)
fPoseView->TitleView()->SetName("ActualTitleView");
BView* dummyTitleView = new BView(BRect(), "TitleView", B_FOLLOW_NONE, 0);
fBackView->AddChild(dummyTitleView);
dummyTitleView->Hide();
fPoseView->CountView()->SetName("ActualCountView");
fPoseView->HScrollBar()->SetName("ActualHScrollBar");
fPoseView->VScrollBar()->SetName("ActualVScrollBar");
const char* views[] = {"TitleView", "HScrollBar", "VScrollBar", "CountVw", NULL};
for (int i = 0; views[i] != NULL; i++) {
BView* dummy = new BView(BRect(), views[i], B_FOLLOW_NONE, 0);
fBackView->AddChild(dummy);
dummy->Hide();
}
#endif
}